2023-05-23 16:13:17 +08:00
/// <summary>
///INTERFACE IMPLIMENT FOR TABLE t_wmsOutPickLable
///By wm with codesmith.
///on 05/22/2017
/// </summary>
using System ;
using System.Data.SqlClient ;
using DeiNiu.Utils ;
namespace DeiNiu.wms.Data.Model
{
[Serializable] class WmsOutPickLable_Imp : WmsOutPickLable_base_Imp
{
protected override void CmdPrepare ( SqlCommand sqlCmd )
{
base . CmdPrepare ( sqlCmd ) ;
WmsOutPickLable mObj = ( WmsOutPickLable ) modelObj ;
bool isShowAll = false ;
string wherestr = "" ;
switch ( _cust_op_flag )
{
case 99 : //query with dic
break ;
case 401 : //可亮灯第三方数据
_strSql = "SELECT * FROM [v_unpick_toLight] where state=0 order by pickorderno,port,color" ;
sqlCmd . CommandText = _strSql ;
break ;
case 402 : //第三方数据,location 需要维护的数据
_strSql = "SELECT distinct locationid FROM t_wmsOutPickLable a where not exists(select 1 from t_wmslocation where locationid =a.locationid)" ;
sqlCmd . CommandText = _strSql ;
break ;
case 403 : //第三方数据,当前波次
_strSql = "SELECT *,0 AS isLightUp, 0 AS isPicked FROM t_wmsOutPickLable_tmp" ;
_strSql + = "; SELECT distinct locationId FROM t_wmsOutPickLable a where not exists(select 1 from t_wmslocation where locationid =a.locationid)" ;
sqlCmd . CommandText = _strSql ;
break ;
case 500 : //to get current wave picking list by state
_strSql = "SELECT a.* FROM [t_wmsOutPickLable_tmp] a where state =@state" ;
sqlCmd . Parameters . AddWithValue ( "@state" , mObj . CmdParameters [ 0 ] ) ;
sqlCmd . CommandText = _strSql ;
break ;
case 600 : //拣选结束lable 回传数据
wherestr = " where state = 0 and color =@color and elabId =@elabId and elabAddress=@elabAddress " ;
_strSql = " update [t_wmsOutPickLable_tmp] set state = @state , pickCount =@pickCount "
+ wherestr ;
_strSql + = "; update [t_wmsOutPickLable] set state = @state , pickCount =@pickCount "
+ wherestr ;
sqlCmd . Parameters . AddWithValue ( "@state" , ( int ) DeiNiu . Utils . enumPickState . 已 拣 ) ; //can be picked more than onece?
sqlCmd . Parameters . AddWithValue ( "@color" , mObj . CmdParameters [ 0 ] ) ;
sqlCmd . Parameters . AddWithValue ( "@elabId" , mObj . CmdParameters [ 1 ] ) ;
sqlCmd . Parameters . AddWithValue ( "@pickCount" , mObj . CmdParameters [ 2 ] ) ;
sqlCmd . Parameters . AddWithValue ( "@elabAddress" , mObj . CmdParameters [ 3 ] ) ;
sqlCmd . CommandText = _strSql ;
break ;
case 620 : //seeding结束lable 回传数据
wherestr = " where state = 1 and port =@port and seedsNo=@seedsNo and elabId =@elabId" ;
_strSql = "update [t_wmsOutSeeds_tmp] set state = @state , pickCount =@pickCount "
+ wherestr ;
sqlCmd . Parameters . AddWithValue ( "@state" , ( int ) DeiNiu . Utils . enumSeedsState . 已 按 灭 ) ; //can be picked more than onece?
sqlCmd . Parameters . AddWithValue ( "@port" , mObj . CmdParameters [ 0 ] ) ;
sqlCmd . Parameters . AddWithValue ( "@seedsNo" , mObj . CmdParameters [ 1 ] ) ;
sqlCmd . Parameters . AddWithValue ( "@elabId" , mObj . CmdParameters [ 2 ] ) ;
sqlCmd . CommandText = _strSql ;
break ;
case 720 : // 清除第三方临时数据 , 已完成部分的t_wmsOutPickLable的数据, 由第三方负责转入历史表t_wmsOutPickLable_history
_strSql = "" ;
#if DEBUG
#else
string cols = "[pickOrderNo],[waveOrder] ,[color] ,[count] ,[locationId],[elabId] ,[port] ,[elabAddress] ,[state] ,[pickCount] ,[description] ,[operater],[createtime],[lastmodified]" ;
_strSql + = string . Format ( "; insert into t_wmsOutPickLable_history ({0}) select {1} from t_wmsOutPickLable where waveOrder=@waveOrder ; " , cols , cols ) ;
_strSql + = " delete from [t_wmsOutPickLable] where waveOrder=@waveOrder ; " ;
#endif
_strSql + = "; delete from t_wmsOutPickLable_tmp " ;
_strSql + = "; delete from t_wmsOutPickLable_history where createtime+@days<getdate() " ;
// WmsConstants.HISTORY_REC_KEEP_DAYS = 1;
sqlCmd . Parameters . AddWithValue ( "@state" , ( int ) DeiNiu . Utils . enumPickState . 已 拣 ) ;
sqlCmd . Parameters . AddWithValue ( "@waveOrder" , mObj . CmdParameters [ 0 ] ) ;
sqlCmd . Parameters . AddWithValue ( "@desc" , mObj . CmdParameters [ 1 ] ) ;
2023-09-04 22:41:19 +08:00
sqlCmd . Parameters . AddWithValue ( "@days" , pickConstants . HISTORY_REC_KEEP_DAYS ) ;
2023-05-23 16:13:17 +08:00
sqlCmd . CommandText = _strSql ;
break ;
case 800 : //pick list by waveorder
_strSql = "SELECT elabid as ele_lab_id,elabAddress as ele_address,port,count as pick_count,count as send_count, color ,color as ele_order "
+ " FROM [t_wmsOutPickLable_tmp] a where state =@state and waveOrder =@waveOrder order by port,color" ;
sqlCmd . Parameters . AddWithValue ( "@waveOrder" , mObj . CmdParameters [ 0 ] ) ;
sqlCmd . Parameters . AddWithValue ( "@state" , ( int ) DeiNiu . Utils . enumPickState . 未 拣 ) ;
sqlCmd . CommandText = _strSql ;
break ;
case 900 : //get pick detail by state
_strSql = "SELECT elabid as ele_lab_id,elabAddress as ele_address,port,count as pick_count,count - pickCount as send_count, color ,color as ele_order"
+ " FROM [t_wmsOutPickLable_tmp] a where state =@state order by port,color" ;
sqlCmd . Parameters . AddWithValue ( "@state" , mObj . CmdParameters [ 0 ] ) ;
sqlCmd . CommandText = _strSql ;
break ;
case 1000 :
_strSql = "update t_WaveFlag set isReady=@isReady" ;
sqlCmd . Parameters . AddWithValue ( "@isReady" , mObj . CmdParameters [ 0 ] ) ;
sqlCmd . CommandText = _strSql ;
break ;
case 1100 :
_strSql = "SELECT distinct [channel] as ele_address, [shelf] as pick_count, 1 as color,1 as ele_order ,[elabId] as ele_lab_id ,[port] FROM [epick].[dbo].[t_wmsLocation] where isnull(elabid,0)>0 order by port" ;
sqlCmd . CommandText = _strSql ;
break ;
}
}
}
}