2023-05-23 16:13:17 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								/// <summary>  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								///INTERFACE IMPLIMENT FOR TABLE t_wmsImportSeeds  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								///By wm with codesmith.   
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								///on 07/21/2019  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								/// </summary>  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								using  System ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								using  System.Data.SqlClient ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								using  DeiNiu.Utils ;   
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								namespace  DeiNiu.wms.Data.Model  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    [Serializable]   class  WmsImportSeeds_Imp  :  WmsImportSeeds_base_Imp  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    {  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        protected  override  void  CmdPrepare ( SqlCommand  sqlCmd ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        {  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            base . CmdPrepare ( sqlCmd ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            WmsImportSeeds  mObj  =  (  WmsImportSeeds ) modelObj ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            switch  ( _cust_op_flag ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								             case  99 :   //query with dic 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    _strSql  =  "SELECT *,0 AS isLightUp, 0 AS isPicked ,ROW_NUMBER() OVER (ORDER BY ID DESC) as sortNo  FROM v_seeds  WHERE DR = 1 "  +  mObj . CmdParameters [ 0 ] . ToString ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    _strSql  =  "SELECT * FROM ("  +  _strSql  +  " )AS SORTEDTB WHERE sortNo BETWEEN @START AND @END"  +  " ORDER BY ID DESC" ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    _strSql  + =  ";SELECT COUNT(*) FROM v_seeds  WHERE DR = 1 "  +  mObj . CmdParameters [ 0 ] . ToString ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . CommandText  =  _strSql ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . Parameters . AddWithValue ( "@START" ,  this . _rownumStart ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . Parameters . AddWithValue ( "@END" ,  this . _rownumEnd ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . CommandText  =  _strSql ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                case  100 :   //by seedsNo 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    _strSql  =  "SELECT * FROM t_wmsImportSeeds WHERE seedsNo = @seedsNo order by custName" ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . CommandText  =  _strSql ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . Parameters . AddWithValue ( "@seedsNo" ,  mObj . CmdParameters [ 0 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                case  201 : // start load seeds with deskId, 适合不同仓库不同seedsno的情况 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    String  cols  =  "[partion],[deskId], [elabId] ,[port],[seedsNo] ,[barcode] ,[custName] ,[itemName]  ,[count] ,[countOut] ,[unit] ,[category1] ,[category2],[category3] ,[spec] ,[elabAddress] ,[description]" ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    _strSql  =  "insert t_wmsImportSeeds_tmp({0}) select {1} from v_availableSeeds " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                                +  " WHERE deskId = @deskId and seedsNo =@seedsNo " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    _strSql  =  String . Format ( _strSql ,  cols ,  cols ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    _strSql  + =  ";" ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    _strSql  + =  "delete from  t_wmsImportSeeds WHERE deskId = @deskId and seedsNo =@seedsNo " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . CommandText  =  _strSql ;  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                      
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                     sqlCmd . Parameters . AddWithValue ( "@deskId" ,  mObj . CmdParameters [ 0 ] ) ;                   
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                     sqlCmd . Parameters . AddWithValue ( "@seedsNo" ,  mObj . CmdParameters [ 1 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                      
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								                case  301 :   //start light an item, 适合不同仓库不同seedsno的情况,  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    _strSql  =  "update t_wmsImportSeeds_tmp " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                        +  "set color= @color,operater =@operater,state=1" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                        +  "WHERE deskId = @deskId and seedsNo=@seedsNo and barcode =@barcode" ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . CommandText  =  _strSql ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . Parameters . AddWithValue ( "@deskId" ,  mObj . CmdParameters [ 0 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . Parameters . AddWithValue ( "@seedsNo" ,  mObj . CmdParameters [ 1 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . Parameters . AddWithValue ( "@barcode" ,  mObj . CmdParameters [ 2 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . Parameters . AddWithValue ( "@operater" ,  mObj . CmdParameters [ 3 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . Parameters . AddWithValue ( "@color" ,  mObj . CmdParameters [ 4 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								                case  200 : // start load seeds ,  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    cols  =  "[deskId], [elabId] ,[port],[seedsNo] ,[barcode] ,[custName] ,[itemName]  ,[count] ,[countOut] ,[unit] ,[category1] ,[category2],[category3] ,[spec] ,[elabAddress] ,[description],[picktime],[createtime]" ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                     _strSql  =  "insert t_wmsImportSeeds_tmp({0},[state],[partion]) select {1},{2},@partion from t_wmsImportSeeds " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                                +  " WHERE  seedsNo =@seedsNo " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    _strSql  + =  ";delete from  t_wmsImportSeeds WHERE seedsNo =@seedsNo " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    _strSql  + =  ";insert t_wmsImportSeeds_history({0},[state],[operater],[lastmodified],[partion]) " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                               +  " select {1},[state],[operater],[lastmodified],[partion] from t_wmsImportSeeds_tmp" ; //把历史已完成分拣的数据导入history 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    _strSql  + =  " where state={3}" ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    _strSql  + =  ";delete from  t_wmsImportSeeds_tmp WHERE state={3} " ;  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    _strSql  + =  "; update t_wmsImportSeeds_tmp set deskid =(select deskid from t_wmsDeskCustomer where custName= t_wmsImportSeeds_tmp.custName and partion =t_wmsImportSeeds_tmp.partion)" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                               + " , port =(select portNo from t_wmsDeskCustomer where custName= t_wmsImportSeeds_tmp.custName and partion =t_wmsImportSeeds_tmp.partion)"   
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                               +  " where seedsNo =@seedsNo and partion=@partion" ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    _strSql  =  String . Format ( _strSql ,  cols ,  cols ,  ( int ) enumSeedsState . 处 理 中 ,  ( int ) enumSeedsState . 已 按 灭 ) ;  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . CommandText  =  _strSql ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . Parameters . AddWithValue ( "@partion" ,  mObj . CmdParameters [ 0 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . Parameters . AddWithValue ( "@seedsNo" ,  mObj . CmdParameters [ 1 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                case  300 :   //start light an item,根据deskId ->custNames, 结合 barcode找到亮灯数据 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    _strSql  =  "select top 150  * from t_wmsImportSeeds_tmp "   
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                        +  "WHERE  seedsNo=@seedsNo and barcode =@barcode " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                        +  "and state <@state" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                        // + " and (/*elabId > 0*/ or exists(select 1 from t_wmsDeskCustomer where deskId=@deskId and custName = t_wmsImportSeeds_tmp.custName))"; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                       + " and (  exists(select 1 from t_wmsDeskCustomer where deskId=@deskId and custName = t_wmsImportSeeds_tmp.custName))" ;  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                        sqlCmd . CommandText  =  _strSql ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                     sqlCmd . Parameters . AddWithValue ( "@deskId" ,  mObj . CmdParameters [ 0 ] ) ;                   
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                     sqlCmd . Parameters . AddWithValue ( "@seedsNo" ,  mObj . CmdParameters [ 1 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                     sqlCmd . Parameters . AddWithValue ( "@barcode" ,  mObj . CmdParameters [ 2 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                     sqlCmd . Parameters . AddWithValue ( "@state" ,  enumSeedsState . 已 按 灭 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                case  302 :   //反查亮灯 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    _strSql  =  "select top 150 * from v_seeds " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                        +  "WHERE  seedsNo=@seedsNo and barcode =@barcode " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                        +  " and state =@state" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                        +  " and operater =@operater" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                        +  " and exists(select 1 from t_wmsDeskCustomer where deskId=@deskId and custName = v_seeds.custName)" ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . CommandText  =  _strSql ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . Parameters . AddWithValue ( "@deskId" ,  mObj . CmdParameters [ 0 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . Parameters . AddWithValue ( "@seedsNo" ,  mObj . CmdParameters [ 1 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . Parameters . AddWithValue ( "@barcode" ,  mObj . CmdParameters [ 2 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . Parameters . AddWithValue ( "@operater" ,  mObj . CmdParameters [ 3 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . Parameters . AddWithValue ( "@state" ,  enumSeedsState . 已 按 灭 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                case  400 :   //get seeds by barcode 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    _strSql  =  "update t_wmsImportSeeds_tmp " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                        +  "set color= @color,operater =@operater,state=1" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                        +  "WHERE deskId = @deskId and seedsNo=@seedsNo and barcode =@barcode" ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . CommandText  =  _strSql ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . Parameters . AddWithValue ( "@deskId" ,  mObj . CmdParameters [ 0 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . Parameters . AddWithValue ( "@seedsNo" ,  mObj . CmdParameters [ 1 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . Parameters . AddWithValue ( "@barcode" ,  mObj . CmdParameters [ 2 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . Parameters . AddWithValue ( "@operater" ,  mObj . CmdParameters [ 3 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . Parameters . AddWithValue ( "@color" ,  mObj . CmdParameters [ 4 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                case  500 :   //更新亮灯状态 相应灯光按灭事件 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    _strSql  =  "update t_wmsImportSeeds_tmp set state = @stateLight, picktime = getdate()  WHERE id =@id " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                          +  " and state!= @stateLight" ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                //    _strSql += " and state < @statePicked"; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . CommandText  =  _strSql ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . Parameters . AddWithValue ( "@id" ,  mObj . CmdParameters [ 0 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . Parameters . AddWithValue ( "@stateLight" ,  mObj . CmdParameters [ 1 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                 //   sqlCmd.Parameters.AddWithValue("@statePicked", enumSeedsState.已亮灯); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                case  600 :   //删除分拣单 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    _strSql  =  "delete from t_wmsImportSeeds where seedsNo =@seedsNo ; " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    _strSql  + =  " delete from t_wmsImportSeeds_tmp where seedsNo =@seedsNo ; " ;  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . CommandText  =  _strSql ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . Parameters . AddWithValue ( "@seedsNo" ,  mObj . CmdParameters [ 0 ] ) ;  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                case  601 :   //查询可删除分拣单 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    _strSql  =  " select count(1) from v_seeds where seedsNo =@seedsNo and state >= @state; " ;  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . CommandText  =  _strSql ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . Parameters . AddWithValue ( "@seedsNo" ,  mObj . CmdParameters [ 0 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . Parameters . AddWithValue ( "@state" , ( int ) enumSeedsState . 已 亮 灯 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                case  700 :   //查询可删除分拣单 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    _strSql  =  " select sum(countOut),sum(count),itemName from v_seeds where seedsNo =@seedsNo and barcode = @barcode group by itemName " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . CommandText  =  _strSql ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . Parameters . AddWithValue ( "@seedsNo" ,  mObj . CmdParameters [ 0 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . Parameters . AddWithValue ( "@barcode" ,  mObj . CmdParameters [ 1 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                case  800 :   //by name 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    _strSql  =  "SELECT * FROM t_wmsImportSeeds_tmp WHERE deskId = @deskId and barcode=@barcode" ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . CommandText  =  _strSql ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . Parameters . AddWithValue ( "@deskId" ,  mObj . CmdParameters [ 0 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . Parameters . AddWithValue ( "@barcode" ,  mObj . CmdParameters [ 1 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                case  900 :   //auto adjust 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                   // _strSql = "SELECT   dbo.t_wmsDeskCustomer.custName, dbo.t_wmsDeskCustomer.portNo, dbo.v_seeds.seedsNo, dbo.v_seeds.barcode, dbo.v_seeds.count, dbo.v_seeds.countOut"; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                   // _strSql += " left outer join dbo.v_seeds   ON dbo.t_wmsDeskCustomer.custName = dbo.v_seeds.custName "; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    _strSql  =  "SELECT  dbo.t_wmsDeskCustomer.portNo, dbo.t_wmsImportSeeds_tmp.* " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    _strSql  + =  " FROM dbo.t_wmsDeskCustomer LEFT OUTER JOIN dbo.t_wmsImportSeeds_tmp ON dbo.t_wmsDeskCustomer.custName = dbo.t_wmsImportSeeds_tmp.custName" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                              +  " and dbo.t_wmsDeskCustomer.partion =dbo.t_wmsImportSeeds_tmp.partion " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    _strSql  + =  " where seedsno=@seedsNo and barcode=@barcode and count>0 and t_wmsImportSeeds_tmp.state <3 " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    _strSql  + =  " order by portNo" ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . CommandText  =  _strSql ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . Parameters . AddWithValue ( "@seedsNo" ,  mObj . CmdParameters [ 0 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . Parameters . AddWithValue ( "@barcode" ,  mObj . CmdParameters [ 1 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                  case  910 :   //update to original 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    _strSql  =  "update t_wmsImportSeeds_tmp set countout=[count] where seedsno=@seedsNo and barcode=@barcode and state <3;" ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . CommandText  =  _strSql ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . Parameters . AddWithValue ( "@seedsNo" ,  mObj . CmdParameters [ 0 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . Parameters . AddWithValue ( "@barcode" ,  mObj . CmdParameters [ 1 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                case  1000 :   //  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    _strSql  =  "SELECT * FROM t_wmsImportSeeds_tmp WHERE deskId = @deskId and barcode=@barcode" ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . CommandText  =  _strSql ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . Parameters . AddWithValue ( "@deskId" ,  mObj . CmdParameters [ 0 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . Parameters . AddWithValue ( "@barcode" ,  mObj . CmdParameters [ 1 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                case  1100 :   //  根据波次号 和 商品条码取一次分播数据 for 亮灯 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    _strSql  =  " SELECT   dbo.t_wmsImportSeeds_tmp.seedsNo, dbo.t_wmsImportSeeds_tmp.barcode, dbo.t_wmsImportSeeds_tmp.itemName, " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                            +  " dbo.t_wmsImportSeeds_tmp.unit, dbo.t_wmsImportSeeds_tmp.spec, dbo.t_wmsDeskCustomer.deskId," 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                            +  " sum( dbo.t_wmsImportSeeds_tmp.countOut) as countOut" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                            +  " FROM      dbo.t_wmsImportSeeds_tmp LEFT OUTER JOIN dbo.t_wmsDeskCustomer ON dbo.t_wmsImportSeeds_tmp.custName = dbo.t_wmsDeskCustomer.custName " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                            +  " and dbo.t_wmsDeskCustomer.partion =dbo.t_wmsImportSeeds_tmp.partion " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                            +  " WHERE seedsNo = @seedsNo and barcode=@barcode and isnull(category1,'0')!='1'"  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                            +  " GROUP BY dbo.t_wmsImportSeeds_tmp.seedsNo, dbo.t_wmsImportSeeds_tmp.barcode, dbo.t_wmsImportSeeds_tmp.itemName, dbo.t_wmsImportSeeds_tmp.unit, dbo.t_wmsImportSeeds_tmp.spec, dbo.t_wmsDeskCustomer.deskId  " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                            +  "  having t_wmsDeskCustomer.deskid is not null" ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . CommandText  =  _strSql ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . Parameters . AddWithValue ( "@seedsNo" ,  mObj . CmdParameters [ 0 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . Parameters . AddWithValue ( "@barcode" ,  mObj . CmdParameters [ 1 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                case  1101 :   //  根据波次号 和 商品条码取一次分播数据 for 显示在界面 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    _strSql  =  " SELECT   dbo.t_wmsImportSeeds_tmp.seedsNo, dbo.t_wmsImportSeeds_tmp.barcode, dbo.t_wmsImportSeeds_tmp.itemName, " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                            +  " dbo.t_wmsImportSeeds_tmp.unit, dbo.t_wmsImportSeeds_tmp.spec, dbo.t_wmsDeskCustomer.deskId," 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                            +  " sum( dbo.t_wmsImportSeeds_tmp.countOut) as countOut" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                            +  " FROM      dbo.t_wmsImportSeeds_tmp LEFT OUTER JOIN dbo.t_wmsDeskCustomer ON dbo.t_wmsImportSeeds_tmp.custName = dbo.t_wmsDeskCustomer.custName " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                            +  " and dbo.t_wmsDeskCustomer.partion =dbo.t_wmsImportSeeds_tmp.partion " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                            +  " WHERE seedsNo = @seedsNo and barcode=@barcode and isnull(category1,'0')='1'   and  dbo.t_wmsImportSeeds_tmp.operater =@operater " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                            +  " GROUP BY dbo.t_wmsImportSeeds_tmp.seedsNo, dbo.t_wmsImportSeeds_tmp.barcode, dbo.t_wmsImportSeeds_tmp.itemName, dbo.t_wmsImportSeeds_tmp.unit, dbo.t_wmsImportSeeds_tmp.spec, dbo.t_wmsDeskCustomer.deskId  " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                            +  "  having t_wmsDeskCustomer.deskid is not null" ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . CommandText  =  _strSql ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . Parameters . AddWithValue ( "@seedsNo" ,  mObj . CmdParameters [ 0 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . Parameters . AddWithValue ( "@barcode" ,  mObj . CmdParameters [ 1 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . Parameters . AddWithValue ( "@operater" ,  mObj . CmdParameters [ 2 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                case  1200 :   // pick over desk seeds 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    _strSql  =  "update t_wmsImportSeeds_tmp set category1 = '1',deskid=@deskId WHERE seedsNo=@seedsNo and barcode=@barcode  and " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                             +  " exists(select 1 from [t_wmsDeskCustomer] where custName = t_wmsImportSeeds_tmp.custName  and partion = t_wmsImportSeeds_tmp.partion   and deskId =@deskId) " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . CommandText  =  _strSql ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . Parameters . AddWithValue ( "@seedsNo" ,  mObj . CmdParameters [ 0 ] ) ;  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . Parameters . AddWithValue ( "@barcode" ,  mObj . CmdParameters [ 1 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . Parameters . AddWithValue ( "@deskId" ,  mObj . CmdParameters [ 2 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								               
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                case  1300 :   //  根据波次号 和 商品条码取一次分播数据 for 显示在界面  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    _strSql  =  " SELECT   dbo.t_wmsImportSeeds_tmp.seedsNo, dbo.t_wmsImportSeeds_tmp.barcode, dbo.t_wmsImportSeeds_tmp.itemName, " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                            +  " dbo.t_wmsImportSeeds_tmp.unit, dbo.t_wmsImportSeeds_tmp.spec, dbo.t_wmsDeskCustomer.deskId,category1," 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                            +  " sum( dbo.t_wmsImportSeeds_tmp.countOut) as countOut" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                            +  " FROM      dbo.t_wmsImportSeeds_tmp LEFT OUTER JOIN dbo.t_wmsDeskCustomer ON dbo.t_wmsImportSeeds_tmp.custName = dbo.t_wmsDeskCustomer.custName " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                               +  " and dbo.t_wmsDeskCustomer.partion =dbo.t_wmsImportSeeds_tmp.partion " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                               +  " WHERE seedsNo = @seedsNo and barcode=@barcode "  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                           // +" and isnull(category1,'0')=@category1" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                            +  " GROUP BY dbo.t_wmsImportSeeds_tmp.seedsNo, dbo.t_wmsImportSeeds_tmp.barcode, dbo.t_wmsImportSeeds_tmp.itemName, dbo.t_wmsImportSeeds_tmp.unit, dbo.t_wmsImportSeeds_tmp.spec, dbo.t_wmsDeskCustomer.deskId,category1  " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                           +  "  having t_wmsDeskCustomer.deskid is not null" ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . CommandText  =  _strSql ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . Parameters . AddWithValue ( "@seedsNo" ,  mObj . CmdParameters [ 0 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . Parameters . AddWithValue ( "@barcode" ,  mObj . CmdParameters [ 1 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                   // sqlCmd.Parameters.AddWithValue("@category1", mObj.CmdParameters[2]); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                case  1400 :   // pick over desk seeds 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    _strSql  =  " select * from v_sumCntBySeedsBarcode128 where seedsNo=@seedsNo and barcode= @barcode" ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                             
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . CommandText  =  _strSql ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . Parameters . AddWithValue ( "@seedsNo" ,  mObj . CmdParameters [ 0 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . Parameters . AddWithValue ( "@barcode" ,  mObj . CmdParameters [ 1 ] ) ;  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                case  1310 :   //query with desk 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    _strSql  =  "SELECT *,0 AS isLightUp, 0 AS isPicked ,ROW_NUMBER() OVER (ORDER BY deskId DESC) as sortNo  FROM [v_seedsDesk]  WHERE 1=1 "  +  mObj . CmdParameters [ 0 ] . ToString ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    _strSql  =  "SELECT * FROM ("  +  _strSql  +  " )AS SORTEDTB WHERE sortNo BETWEEN @START AND @END"  +  " ORDER BY deskId " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    _strSql  + =  ";SELECT COUNT(*) FROM [v_seedsDesk]  WHERE 1 = 1 "  +  mObj . CmdParameters [ 0 ] . ToString ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . CommandText  =  _strSql ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . Parameters . AddWithValue ( "@START" ,  this . _rownumStart ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . Parameters . AddWithValue ( "@END" ,  this . _rownumEnd ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . CommandText  =  _strSql ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                case  1500 : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    _strSql  =  "  select count(*) ,custname   from v_seeds where  countout!= count " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                            +  " and CAST(createtime AS date) = CAST(GETDATE()  AS date)" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                            +  " and custname = @custName" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                            +  " having  sum( abs(countout -count)) <@cnt ;" ;  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . Parameters . AddWithValue ( "@custName" ,  mObj . CmdParameters [ 0 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . Parameters . AddWithValue ( "@cnt" ,  mObj . CmdParameters [ 1 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . CommandText  =  _strSql ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                case  1510 :  //当日调整总数小于店铺设定值的店铺列表 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    _strSql  =  " select * from t_wmsDeskCustomer a where exists( " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                        +  " select count(*) ,custname   from [epick].[dbo].v_seeds where  countout!= count   and CAST( createtime  AS date) = CAST( GETDATE()  AS date) and custname= a.custName  group by custname" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                        +  " having sum(abs(countout -count))< a.diffLimit );" ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . CommandText  =  _strSql ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    break ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-04 22:41:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                case  1600 : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    _strSql  =  "delete  FROM  [t_wmsImportSeeds_tmp]  where createtime <  getdate()-2;"  + 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                        "delete  FROM  [t_wmsImportSeeds]  where createtime <  getdate()-2;"  + 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                        "delete  FROM  [t_wmsImportSeeds_history]  where createtime <  getdate()-7;" ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    sqlCmd . CommandText  =  _strSql ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    break ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-23 16:13:17 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}