public void DoReceiveIp(List<Entity.SD.ORD.IpDetailInput> ipDetailInputList, DateTime? effDate) { if (ipDetailInputList == null || ipDetailInputList.Count() == 0) { throw new com.Sconit.Entity.Exception.BusinessException("没有要收货的明细"); } IList<Entity.ORD.IpDetail> baseIpDetailList = new List<Entity.ORD.IpDetail>(); var detIds = ipDetailInputList.Select(i => i.Id).Distinct(); foreach (var id in detIds) { var ipDatail = genericMgr.FindById<Entity.ORD.IpDetail>(id); var q_1 = ipDetailInputList.Where(o => o.Id == id); if (q_1 != null) { ipDatail.IpDetailInputs = new List<Entity.ORD.IpDetailInput>(); foreach (var odi in q_1) { var baseIpDetailInput = new Entity.ORD.IpDetailInput(); baseIpDetailInput.HuId = odi.HuId; baseIpDetailInput.ReceiveQty = odi.ReceiveQty; baseIpDetailInput.ShipQty = odi.ShipQty; baseIpDetailInput.LotNo = odi.LotNo; baseIpDetailInput.Bin = odi.Bin; ipDatail.IpDetailInputs.Add(baseIpDetailInput); } } baseIpDetailList.Add(ipDatail); } //可能这些ipDetail分属于多个ipMstr,这里要分开调用 IList<string> ipNoList = (from det in baseIpDetailList select det.IpNo).Distinct().ToList(); foreach (string ipNo in ipNoList) { var recIpDetail = (from ipdetail in baseIpDetailList where ipdetail.IpNo == ipNo select ipdetail).ToList(); if (effDate.HasValue) { this.orderMgr.ReceiveIp(recIpDetail, effDate.Value); } else { this.orderMgr.ReceiveIp(recIpDetail); } } }
public void DoReceiveKit(string kitNo, DateTime? effDate) { var baseIpDetails = this.genericMgr.FindAll<Entity.ORD.IpDetail>(" from IpDetail i where i.OrderNo = ? ", kitNo); foreach (var baseIpDetail in baseIpDetails) { baseIpDetail.IpLocationDetails = this.genericMgr.FindAll<Entity.ORD.IpLocationDetail>(" from IpLocationDetail i where i.IpDetailI d= ? ", baseIpDetail.Id); foreach (var ipLocationDetail in baseIpDetail.IpLocationDetails) { var baseIpDetailInput = new Entity.ORD.IpDetailInput(); baseIpDetailInput.HuId = ipLocationDetail.HuId; baseIpDetailInput.ReceiveQty = ipLocationDetail.Qty / baseIpDetail.UnitQty; baseIpDetailInput.LotNo = ipLocationDetail.LotNo; baseIpDetail.IpDetailInputs.Add(baseIpDetailInput); } } effDate = effDate.HasValue ? effDate.Value : DateTime.Now; this.orderMgr.ReceiveIp(baseIpDetails, effDate.Value); }
public string DoReceiveIp(List<Entity.SI.SD_ORD.IpDetailInput> ipDetailInputList, DateTime? effDate) { if (ipDetailInputList == null || ipDetailInputList.Count() == 0) { throw new com.Sconit.Entity.Exception.BusinessException("没有要收货的明细"); } IList<Entity.ORD.IpDetail> baseIpDetailList = new List<Entity.ORD.IpDetail>(); var detIds = ipDetailInputList.Select(i => i.Id).Distinct(); foreach (var id in detIds) { var ipDatail = genericMgr.FindById<Entity.ORD.IpDetail>(id); var q_1 = ipDetailInputList.Where(o => o.Id == id); if (q_1 != null) { ipDatail.IpDetailInputs = new List<Entity.ORD.IpDetailInput>(); foreach (var odi in q_1) { var baseIpDetailInput = new Entity.ORD.IpDetailInput(); baseIpDetailInput.HuId = odi.HuId; baseIpDetailInput.ReceiveQty = odi.ReceiveQty; baseIpDetailInput.ShipQty = odi.ShipQty; baseIpDetailInput.LotNo = odi.LotNo; baseIpDetailInput.Bin = odi.Bin; ipDatail.IpDetailInputs.Add(baseIpDetailInput); } } baseIpDetailList.Add(ipDatail); } string recerptNo = string.Empty; if (effDate.HasValue) { recerptNo = this.orderMgr.ReceiveIp(baseIpDetailList, effDate.Value).ReceiptNo; } else { recerptNo = this.orderMgr.ReceiveIp(baseIpDetailList).ReceiptNo; } return recerptNo; }