| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  |  | 
					
						
							|  |  |  |  | /// <summary> | 
					
						
							|  |  |  |  | ///INTERFACE CLASS FOR TABLE t_wmsStockPandian | 
					
						
							|  |  |  |  | ///By wm   | 
					
						
							|  |  |  |  | ///on 07/27/2018 | 
					
						
							|  |  |  |  | /// </summary> | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | using System; | 
					
						
							|  |  |  |  | using System.Collections.Generic; | 
					
						
							|  |  |  |  | using System.Linq; | 
					
						
							|  |  |  |  | using System.Text; | 
					
						
							|  |  |  |  | using System.Data; | 
					
						
							| 
									
										
										
										
											2023-11-21 19:18:23 +08:00
										 |  |  |  | using DeiNiu.Utils; | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | namespace DeiNiu.wms.Data.Model | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     [Serializable] | 
					
						
							|  |  |  |  |     public class WmsStockPandian : WmsStockPandian_base | 
					
						
							|  |  |  |  |     { | 
					
						
							|  |  |  |  |         public WmsStockPandian() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         public WmsStockPandian(int id): base(id) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         public WmsStockPandian(DataRow dr): base(dr) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         public WmsStockPandian(string orderNo) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             // TODO: Complete member initialization | 
					
						
							|  |  |  |  |             cmdParameters[0] = orderNo;  | 
					
						
							|  |  |  |  |             getModel(100); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |       protected override void getImp() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             model_imp = new WmsStockPandian_Imp();   | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         //begin cust db operation, query, excute sql etc. | 
					
						
							|  |  |  |  |         public DataSet QueryByName(string name) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |               | 
					
						
							|  |  |  |  |             cmdParameters[0] = name; | 
					
						
							|  |  |  |  |             return  CustQuery(100); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |           | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-21 19:18:23 +08:00
										 |  |  |  |         public string getPlusCondition() | 
					
						
							|  |  |  |  |         { | 
					
						
							| 
									
										
										
										
											2024-02-06 19:36:47 +08:00
										 |  |  |  |             string wherePlus = " and skuid >0 and voltype<=3 and whtype =0 and shelfCount>0 "; | 
					
						
							| 
									
										
										
										
											2023-11-21 19:18:23 +08:00
										 |  |  |  |             if ((enumPandianType)type == enumPandianType.拣货位盘点) | 
					
						
							|  |  |  |  |             { | 
					
						
							| 
									
										
										
										
											2024-04-12 09:43:41 +08:00
										 |  |  |  |               // wherePlus = "  and voltype=0 and ( createtime +1  >= getdate()  or lastmodified +1>=getdate() )"; | 
					
						
							|  |  |  |  |                 wherePlus = " and ( cast( createtime as date) = cast( getdate() as date)  or  cast( lastmodified as date) = cast( getdate() as date) )"; | 
					
						
							| 
									
										
										
										
											2023-11-21 19:18:23 +08:00
										 |  |  |  |             } | 
					
						
							|  |  |  |  |             else if ((enumPandianType)type == enumPandianType.存储位盘点) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 wherePlus = "  and voltype>0 and voltype<=3 and ( createtime +1  >= getdate()  or lastmodified +1>=getdate() )"; | 
					
						
							|  |  |  |  |             } | 
					
						
							| 
									
										
										
										
											2024-02-06 19:36:47 +08:00
										 |  |  |  |             return wherePlus +" and state =0 "; | 
					
						
							| 
									
										
										
										
											2023-11-21 19:18:23 +08:00
										 |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         public int createDetailMirror( string condition ) | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  |         { | 
					
						
							| 
									
										
										
										
											2024-02-06 19:36:47 +08:00
										 |  |  |  |            // string sqlWhere = getCondition(this.condition); | 
					
						
							| 
									
										
										
										
											2023-11-21 19:18:23 +08:00
										 |  |  |  |           | 
					
						
							| 
									
										
										
										
											2024-02-06 19:36:47 +08:00
										 |  |  |  |          //   sqlWhere+= getPlusCondition(); | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |             //create stock mirror | 
					
						
							| 
									
										
										
										
											2023-11-21 19:18:23 +08:00
										 |  |  |  |             cmdParameters[0] = condition; | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  |             cmdParameters[1] = orderNo; | 
					
						
							|  |  |  |  |             cmdParameters[2] = operater; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-21 19:18:23 +08:00
										 |  |  |  |           return  CustOper(200); | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-21 19:18:23 +08:00
										 |  |  |  |         public DataSet getPandianBanlance(string orderNo,int startPag,int endPage) | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  |         { | 
					
						
							|  |  |  |  |             cmdParameters[0] = orderNo; | 
					
						
							| 
									
										
										
										
											2023-11-21 19:18:23 +08:00
										 |  |  |  |             cmdParameters[1] = startPag; | 
					
						
							|  |  |  |  |             cmdParameters[2] = endPage; | 
					
						
							|  |  |  |  |             return CustQuery(300) ; | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         public DataSet getPandianBanlanceDetail(string orderNo,int startpage,int endpage ,string goodsId ="") | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             cmdParameters[0] = orderNo; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             cmdParameters[1] = goodsId; | 
					
						
							|  |  |  |  |             cmdParameters[2] = startpage; | 
					
						
							|  |  |  |  |             cmdParameters[3] = endpage; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             return CustQuery(400) ; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         public DataTable getPandianOrder(string orderNo) | 
					
						
							|  |  |  |  |         {  | 
					
						
							|  |  |  |  |             cmdParameters[0] = orderNo;   | 
					
						
							|  |  |  |  |             return CustQuery(500).Tables[0]; | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         public DataTable getPandianBanlanceDetail(string orderNo) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             cmdParameters[0] = orderNo; | 
					
						
							|  |  |  |  |             return CustQuery(600).Tables[0]; | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |          public int deleteAdjust(string orderNo) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |               cmdParameters[0] = orderNo; | 
					
						
							|  |  |  |  |               return CustOper(700); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |          //begin cust db operation, query, excute sql etc. | 
					
						
							|  |  |  |  |          public DataTable getPandianOrders(int ownerId, int status) | 
					
						
							|  |  |  |  |          { | 
					
						
							|  |  |  |  |              cmdParameters[0] = ownerId; | 
					
						
							|  |  |  |  |              cmdParameters[1] = status; | 
					
						
							|  |  |  |  |              return CustQuery(800).Tables[0]; | 
					
						
							|  |  |  |  |          } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-02-06 19:36:47 +08:00
										 |  |  |  |         public bool canStartNewPandian() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |              | 
					
						
							|  |  |  |  |             return CustQuery(810).Tables[0].Rows.Count==0; | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  |         public bool finishPandian(string orderNo,string condition){ | 
					
						
							|  |  |  |  |               | 
					
						
							|  |  |  |  |             if ( ID == 0) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 return false; | 
					
						
							| 
									
										
										
										
											2023-11-21 19:18:23 +08:00
										 |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             return updateStockStatus(enumStockLocationStatus.正常, condition)>0; | 
					
						
							|  |  |  |  |           //  cmdParameters[0] = getCondition( condition); | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-21 19:18:23 +08:00
										 |  |  |  |          //  return CustOper(900)>0; | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  |               | 
					
						
							|  |  |  |  |         } | 
					
						
							| 
									
										
										
										
											2023-11-21 19:18:23 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |        public int updateStockStatus(enumStockLocationStatus state,string condition) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |              | 
					
						
							|  |  |  |  |             cmdParameters[0] = condition ; | 
					
						
							|  |  |  |  |             cmdParameters[1] = (int)state; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             return CustOper(900); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         public DataTable getPandianTargetItem(string orderNo, string locationId) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             cmdParameters[0] = orderNo; | 
					
						
							|  |  |  |  |             cmdParameters[1] = locationId; | 
					
						
							|  |  |  |  |             return CustQuery(1000).Tables[0]; | 
					
						
							|  |  |  |  |         } | 
					
						
							| 
									
										
										
										
											2024-02-06 19:36:47 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |         public void clean() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             CustOper(1300); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         public DataTable getPandianTasksByLoc(int part ,int channel,int shelf) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             cmdParameters[0] = part; | 
					
						
							|  |  |  |  |             cmdParameters[1] = channel; | 
					
						
							|  |  |  |  |             cmdParameters[2] = shelf; | 
					
						
							|  |  |  |  |             return CustQuery(1400).Tables[0]; | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-21 19:18:23 +08:00
										 |  |  |  |         public DataTable getPandianTargetItems(string orderNo ) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             cmdParameters[0] = orderNo;  | 
					
						
							|  |  |  |  |             return CustQuery(1100).Tables[0]; | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         public DataSet queryPandianResult(string orderNo, int startpage, int endpage, string goodsId="") | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             cmdParameters[0] = orderNo;  | 
					
						
							|  |  |  |  |             cmdParameters[1] = goodsId; | 
					
						
							|  |  |  |  |             cmdParameters[2] = startpage; | 
					
						
							|  |  |  |  |             cmdParameters[3] = endpage; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             return CustQuery(410); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         public DataSet queryPandianResultSum(string orderNo, int startpage, int endpage, string goodsId) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             cmdParameters[0] = orderNo; | 
					
						
							|  |  |  |  |             cmdParameters[1] = goodsId; | 
					
						
							|  |  |  |  |             cmdParameters[2] = startpage; | 
					
						
							|  |  |  |  |             cmdParameters[3] = endpage;  | 
					
						
							|  |  |  |  |             return CustQuery(420); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-02-06 19:36:47 +08:00
										 |  |  |  |         public WmsStockPandian getCurrentPandianOrder() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             DataTable dt = CustQuery(1500).Tables[0]; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             foreach(DataRow dr in dt.Rows) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 return new WmsStockPandian(dr); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             return new WmsStockPandian();    | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-21 19:18:23 +08:00
										 |  |  |  |         public WmsOrderRequest createErpOrder() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             WmsOrderRequest wor = new WmsOrderRequest(); | 
					
						
							|  |  |  |  |             wor.orderNo = orderNo; | 
					
						
							|  |  |  |  |             wor.orderType = (int)enumOrderType.盘点通知; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             wor.orderTypeName =  ((enumPandianType) type). ToString(); | 
					
						
							|  |  |  |  |             wor.state = (int)enumOrderStatus.已完成; | 
					
						
							|  |  |  |  |             wor.referOrderNo = orderNo; | 
					
						
							|  |  |  |  |             wor.operater = operater; | 
					
						
							|  |  |  |  |             wor.requestBy = operater; | 
					
						
							|  |  |  |  |             wor.approvedBy = operater; | 
					
						
							| 
									
										
										
										
											2024-03-06 20:48:05 +08:00
										 |  |  |  |             wor.approveDate = wor.getDateTime(); | 
					
						
							| 
									
										
										
										
											2023-11-21 19:18:23 +08:00
										 |  |  |  |             wor.description = String.Format("盘点单号:{0}, 类型:{1},结束时间:{2}, 过滤条件:{3}", orderNo, ((enumPandianType)type).ToString(), endTime, condition); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             wor.Add(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             cmdParameters[0] = orderNo; | 
					
						
							|  |  |  |  |             CustOper(1200); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             return wor; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							| 
									
										
										
										
											2024-02-06 19:36:47 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |         public DataTable getPandianRunningDiff(int part) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             cmdParameters[0] = part; | 
					
						
							|  |  |  |  |             return CustQuery(1600).Tables[0]; | 
					
						
							|  |  |  |  |         } | 
					
						
							| 
									
										
										
										
											2024-03-06 20:48:05 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |         public string getCurrentPandian() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |              | 
					
						
							|  |  |  |  |             DataTable dt = CustQuery(1700).Tables[0]; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             foreach(DataRow dr in dt.Rows) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 return dr["orderNo"].ToString(); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             return ""; | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  |     } | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  |   |