220 lines
		
	
	
		
			5.6 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			220 lines
		
	
	
		
			5.6 KiB
		
	
	
	
		
			C#
		
	
	
	
|  |  | |||
|  | /// <summary> | |||
|  | ///LOGIC CLASS FOR TABLE t_tmsStock | |||
|  | ///By wm with codesmith.  | |||
|  | ///on 07/27/2017 | |||
|  | /// </summary> | |||
|  | 
 | |||
|  | using System; | |||
|  | using System.Collections.Generic; | |||
|  | using System.Linq; | |||
|  | using System.Text; | |||
|  | using DeiNiu.wms.Data.Model; | |||
|  | using System.Data; | |||
|  | using System.Transactions; | |||
|  | 
 | |||
|  | namespace DeiNiu.wms.Logical | |||
|  | { | |||
|  |     [Serializable] | |||
|  |     public class lTmsStock   :lbase | |||
|  |     { | |||
|  |         TmsStock _obj; | |||
|  |         public lTmsStock() | |||
|  |         { | |||
|  |              initialize(); | |||
|  |         } | |||
|  |   | |||
|  |         public  TmsStock getTmsStock | |||
|  |         { | |||
|  |             get | |||
|  |             { | |||
|  |                 return _obj; | |||
|  |             } | |||
|  |         } | |||
|  |          | |||
|  |        public lTmsStock(int operId) | |||
|  |             : base(operId) | |||
|  |         { | |||
|  |             initialize(); | |||
|  |         } | |||
|  |          | |||
|  |    | |||
|  | 		/// <summary> | |||
|  | 		/// get all data | |||
|  | 		/// </summary> | |||
|  |         public DataSet getAllData() | |||
|  |         { | |||
|  |            return _obj.Query(); | |||
|  |         } | |||
|  | 
 | |||
|  |         /// <summary> | |||
|  |         /// get all data | |||
|  |         /// </summary> | |||
|  |         public DataSet getAllActiveData() | |||
|  |         { | |||
|  |             return _obj.QueryActived(); | |||
|  |         } | |||
|  | 
 | |||
|  | 
 | |||
|  | 
 | |||
|  | 		/// <summary> | |||
|  | 		/// get a record by id | |||
|  | 		/// </summary> | |||
|  |         public void initialize(int id) | |||
|  | 		{ | |||
|  |             _obj = id != 0 ? new TmsStock(id) : new TmsStock(); | |||
|  | 		} | |||
|  | 
 | |||
|  |         /// <summary> | |||
|  | 		/// get a record by id 0 | |||
|  | 		/// </summary> | |||
|  |         public void initialize() | |||
|  |         { | |||
|  |             initialize(0); | |||
|  |         } | |||
|  | 
 | |||
|  |          /// <summary> | |||
|  |         /// get a record by id | |||
|  |         /// </summary> | |||
|  |         public void initialize(DataRow dr) | |||
|  |         { | |||
|  |             _obj =   new TmsStock(dr); | |||
|  |         } | |||
|  |          | |||
|  |         protected override DeiNiu.Data.BaseObject.BaseModel getModel() | |||
|  |         { | |||
|  |             return _obj; | |||
|  |         } | |||
|  |   | |||
|  |         //begin cust db operation, query, excute sql etc. | |||
|  |          | |||
|  |       | |||
|  |         /// <summary> | |||
|  |         /// update in a transaction scrop | |||
|  |         /// </summary> | |||
|  | 
 | |||
|  |         public void update() | |||
|  |         { | |||
|  |             if (valid()) | |||
|  |             { | |||
|  |                 using (TransactionScope scope = new TransactionScope()) | |||
|  |                 { | |||
|  | 
 | |||
|  |                     //Node tmp = new Node(); | |||
|  |                     //tmp.parentid = 1; | |||
|  |                     //tmp.name = "test trans" + DateTime.Now; | |||
|  |                     //tmp.description = "this is for transTest"; | |||
|  |                     //tmp.Add(); | |||
|  |                     _obj.Update(); | |||
|  | 
 | |||
|  |                     scope.Complete(); | |||
|  |                 } | |||
|  |             } | |||
|  |         } | |||
|  |          | |||
|  |          private bool valid() | |||
|  |         { | |||
|  |             return true; | |||
|  |         } | |||
|  | 
 | |||
|  | 
 | |||
|  |         /// <summary> | |||
|  |         /// 拼箱拼袋入待装车集货库 | |||
|  |         /// </summary> | |||
|  |         /// <param name="pickOrderNo"></param> | |||
|  |         /// <param name="custId"></param> | |||
|  |         /// <param name="boxCnt"></param> | |||
|  |         /// <param name="bagCnt"></param> | |||
|  |         /// <returns></returns> | |||
|  |          public bool newBulkTransStore(string pickOrderNo, string custId, | |||
|  |              int boxCnt, int bagCnt) | |||
|  |          { | |||
|  |              TmsLineDetail tld = new TmsLineDetail().getLineDetailByCustId(custId); | |||
|  |              if (boxCnt + bagCnt == 0) //播种复核台前置打印,数量为一个包装 | |||
|  |              { | |||
|  |                  bagCnt = 1; | |||
|  |              } | |||
|  |              using (TransactionScope scope = new TransactionScope()) | |||
|  |              { | |||
|  | 
 | |||
|  |                  if (bagCnt > 0) | |||
|  |                  { | |||
|  | 
 | |||
|  |                      List<WmsLocation> locBags = _obj.getFreeLocation(tld.lineId, Utils.enumWhLocVol.散货拼袋, Utils.enumWhType.集货库, bagCnt); | |||
|  | 
 | |||
|  |                      if (locBags.Count == 0) | |||
|  |                      { | |||
|  |                          for (int i = 0; i < bagCnt; i++) | |||
|  |                          { | |||
|  |                              WmsLocation loc = new WmsLocation(); | |||
|  |                              loc.locationId = "JL.BAG.0.1"+i; | |||
|  |                              locBags.Add(loc); | |||
|  |                          } | |||
|  |                      } | |||
|  | 
 | |||
|  |                      foreach (WmsLocation loc in locBags) | |||
|  |                      { | |||
|  |                          _obj.count = 1; | |||
|  |                          _obj.pickOrderNo = pickOrderNo; | |||
|  |                          _obj.locationId = loc.locationId; | |||
|  |                          _obj.operater = operId; | |||
|  |                          _obj.Add(); | |||
|  | 
 | |||
|  |                      } | |||
|  |                  } | |||
|  |                  | |||
|  |                  if (boxCnt > 0) | |||
|  |                  { | |||
|  | 
 | |||
|  |                      List<WmsLocation> locBoxs = _obj.getFreeLocation(tld.lineId, Utils.enumWhLocVol.散货拼箱, Utils.enumWhType.集货库, boxCnt); | |||
|  |                      if (locBoxs.Count == 0) | |||
|  |                      { | |||
|  |                          for (int i = 0; i < boxCnt; i++) | |||
|  |                          { | |||
|  |                              WmsLocation loc = new WmsLocation(); | |||
|  |                              loc.locationId = "JL.BOX.0.1"+i; | |||
|  |                              locBoxs.Add(loc); | |||
|  |                          } | |||
|  |                           | |||
|  |                      } | |||
|  |                       | |||
|  |                      foreach (WmsLocation loc in locBoxs) | |||
|  |                      { | |||
|  |                          _obj.count = 1; | |||
|  |                          _obj.pickOrderNo = pickOrderNo; | |||
|  |                          _obj.locationId = loc.locationId; | |||
|  |                          _obj.operater = operId; | |||
|  |                          _obj.Add(); | |||
|  | 
 | |||
|  |                      } | |||
|  |                  } | |||
|  | 
 | |||
|  |                   scope.Complete(); | |||
|  |              } | |||
|  |                | |||
|  |              return true; | |||
|  |          } | |||
|  | 
 | |||
|  | 
 | |||
|  | 
 | |||
|  |         /// <summary> | |||
|  |         /// get tms stock bulk detail | |||
|  |         /// </summary> | |||
|  |         /// <param name="pickOrderNo"></param> | |||
|  |         /// <returns></returns> | |||
|  |          public DataTable getTmsStockBulkDetail(string pickOrderNo) | |||
|  |          {  | |||
|  |              return _obj.getTmsStockBulkDetail(pickOrderNo); | |||
|  | 
 | |||
|  |          } | |||
|  | 
 | |||
|  | 
 | |||
|  |          public int deleteRec(string pickOrderNo) | |||
|  |          { | |||
|  |              return _obj.deleteRec(pickOrderNo); | |||
|  |          } | |||
|  |     } | |||
|  |      | |||
|  |      | |||
|  | } | |||
|  |   |