public Hu AgingHu(Hu hu) { var huStatus = this.huMgr.GetHuStatus(hu.HuId); if (huStatus.Status != CodeMaster.HuStatus.Location) { throw new BusinessException(Resources.EXT.ServiceLan.CouldNotBurnInNotInInventory); } if (huStatus.IsFreeze) { throw new BusinessException(Resources.EXT.ServiceLan.CouldNotBurnInForFreeze); } if (hu.HuOption == CodeMaster.HuOption.Aged) { throw new BusinessException(Resources.EXT.ServiceLan.CouldNotBurnInHasBurnIn); } else if (hu.HuOption == CodeMaster.HuOption.UnAging || hu.HuOption == CodeMaster.HuOption.NoNeed) { hu.AgingStartTime = DateTime.Now; } else { throw new BusinessException(Resources.EXT.ServiceLan.CouldNotBurnInOther); } this.genericMgr.Update(hu); return hu; }
public Hu AgedHu(Hu hu, DateTime effectiveDate) { if (hu.HuOption == CodeMaster.HuOption.UnAging || hu.HuOption == CodeMaster.HuOption.NoNeed) { if (!hu.AgingStartTime.HasValue) { throw new BusinessException(Resources.EXT.ServiceLan.CouldNotBurnInNotStart); } var huLocationLotDetail = locationDetailMgr.GetHuLocationLotDetail(hu.HuId); if (huLocationLotDetail == null) { throw new BusinessException(Resources.EXT.ServiceLan.CouldNotBurnInNotInInventory); } Hu newHu = huMgr.CloneHu(hu, hu.Qty); newHu.HuOption = CodeMaster.HuOption.Aged; newHu.AgingEndTime = DateTime.Now; IList<ItemExchange> itemExchangeList = new List<ItemExchange>(); ItemExchange itemExchange = new ItemExchange(); itemExchange.BaseUom = hu.BaseUom; itemExchange.EffectiveDate = effectiveDate; itemExchange.OldHu = hu.HuId; itemExchange.IsVoid = false; itemExchange.ItemFrom = hu.Item; itemExchange.ItemTo = hu.Item; itemExchange.LocationFrom = huLocationLotDetail.Location; itemExchange.LocationTo = huLocationLotDetail.Location; itemExchange.ItemExchangeType = CodeMaster.ItemExchangeType.Aging; itemExchange.NewBaseUom = hu.BaseUom; itemExchange.NewHu = newHu.HuId; itemExchange.NewQty = newHu.Qty; itemExchange.NewUnitQty = newHu.UnitQty; itemExchange.NewUom = newHu.Uom; itemExchange.Qty = hu.Qty; itemExchange.QualityType = huLocationLotDetail.QualityType; string region = this.genericMgr.FindById<Location>(huLocationLotDetail.Location).Region; itemExchange.RegionFrom = region; itemExchange.RegionTo = region; itemExchange.UnitQty = hu.UnitQty; itemExchange.Uom = hu.Uom; itemExchange.LotNo = hu.LotNo; this.genericMgr.Create(itemExchange); itemExchangeList.Add(itemExchange); locationDetailMgr.InventoryExchange(itemExchangeList); newHu.RefId = itemExchange.Id; //newHu.HuTemplate = "BarCodeEX.xls"; this.genericMgr.Update(newHu); return newHu; } else { throw new BusinessException(Resources.EXT.ServiceLan.CouldNotBurnIn); } }
public IList<Hu> CreateHu(ReceiptMaster receiptMaster, ReceiptDetail receiptDetail, DateTime effectiveDate) { IList<Hu> huList = new List<Hu>(); decimal remainReceivedQty = receiptDetail.ReceivedQty; receiptDetail.LotNo = LotNoHelper.GenerateLotNo(effectiveDate); //取生效日期为批号生成日期 IDictionary<string, decimal> huIdDic = numberControlMgr.GetHuId(receiptDetail); if (huIdDic != null && huIdDic.Count > 0) { foreach (string huId in huIdDic.Keys) { Hu hu = new Hu(); hu.HuId = huId; hu.LotNo = receiptDetail.LotNo; hu.Item = receiptDetail.Item; hu.ItemDescription = receiptDetail.ItemDescription; hu.BaseUom = receiptDetail.BaseUom; hu.Qty = huIdDic[huId]; hu.ManufactureParty = receiptMaster.PartyFrom; //取区域代码为制造商代码 hu.ManufactureDate = LotNoHelper.ResolveLotNo(receiptDetail.LotNo); hu.PrintCount = 0; hu.ConcessionCount = 0; hu.ReferenceItemCode = receiptDetail.ReferenceItemCode; hu.UnitCount = receiptDetail.UnitCount; hu.UnitQty = itemMgr.ConvertItemUomQty(receiptDetail.Item, receiptDetail.Uom, 1, receiptDetail.BaseUom); hu.Uom = receiptDetail.Uom; hu.IsOdd = hu.Qty < receiptDetail.MinUc; hu.OrderNo = receiptDetail.OrderNo; hu.ReceiptNo = receiptMaster.ReceiptNo; hu.Flow = receiptMaster.Flow; hu.IpNo = receiptMaster.IpNo; hu.IsChangeUnitCount = false; hu.Remark = receiptDetail.Remark; hu.Direction = receiptDetail.Direction; hu.Flow = receiptDetail.Flow; hu.Shift = receiptMaster.Shift; //hu.UnitCountDescription = receiptDetail.UnitCountDescription; var item = this.itemMgr.GetCacheItem(receiptDetail.Item); hu.MaterialsGroup = this.GetMaterialsGroupDescrption(item.MaterialsGroup); hu.HuTemplate = receiptMaster.HuTemplate; hu.HuOption = GetHuOption(item); if (item.Warranty > 0) { hu.ExpireDate = hu.ManufactureDate.AddDays(item.Warranty); } if (item.WarnLeadTime > 0) { hu.RemindExpireDate = hu.ManufactureDate.AddDays(item.WarnLeadTime); } this.genericMgr.Create(hu); //this.AsyncSendPrintData(hu); huList.Add(hu); } } return huList; }
public IList<Hu> CreateHu(FlowMaster flowMaster, IList<FlowDetail> flowDetailList) { IList<Hu> huList = new List<Hu>(); foreach (FlowDetail flowDetail in flowDetailList) { IDictionary<string, decimal> huIdDic = numberControlMgr.GetHuId(flowDetail); if (huIdDic != null && huIdDic.Count > 0) { foreach (string huId in huIdDic.Keys) { Hu hu = new Hu(); hu.HuId = huId; hu.LotNo = flowDetail.LotNo; hu.Item = flowDetail.Item; hu.ItemDescription = genericMgr.FindById<Item>(flowDetail.Item).Description; hu.BaseUom = flowDetail.BaseUom; hu.Qty = huIdDic[huId]; hu.ManufactureParty = flowDetail.ManufactureParty; hu.ManufactureDate = LotNoHelper.ResolveLotNo(flowDetail.LotNo); hu.PrintCount = 0; hu.ConcessionCount = 0; hu.ReferenceItemCode = flowDetail.ReferenceItemCode; hu.UnitCount = flowDetail.UnitCount; hu.UnitQty = itemMgr.ConvertItemUomQty(flowDetail.Item, flowDetail.Uom, 1, flowDetail.BaseUom); hu.Uom = flowDetail.Uom; hu.IsOdd = hu.Qty < hu.UnitCount; hu.SupplierLotNo = flowDetail.SupplierLotNo; hu.IsChangeUnitCount = flowDetail.IsChangeUnitCount; hu.UnitCountDescription = flowDetail.UnitCountDescription; hu.ContainerDesc = flowDetail.ContainerDescription; hu.LocationTo = flowMaster.PartyTo; genericMgr.Create(hu); //this.AsyncSendPrintData(hu); //创建条码中间表 this.CreateBarCode(hu, string.Empty); huList.Add(hu); } } } return huList; }
public IList<Hu> CreateHu(ReceiptMaster receiptMaster, ReceiptDetail receiptDetail, DateTime effectiveDate) { IList<Hu> huList = new List<Hu>(); decimal remainReceivedQty = receiptDetail.ReceivedQty; receiptDetail.LotNo = LotNoHelper.GenerateLotNo(effectiveDate); //取生效日期为批号生成日期 IDictionary<string, decimal> huIdDic = numberControlMgr.GetHuId(receiptDetail); if (huIdDic != null && huIdDic.Count > 0) { foreach (string huId in huIdDic.Keys) { Hu hu = new Hu(); hu.HuId = huId; hu.LotNo = receiptDetail.LotNo; hu.Item = receiptDetail.Item; hu.ItemDescription = receiptDetail.ItemDescription; hu.BaseUom = receiptDetail.BaseUom; hu.Qty = huIdDic[huId]; hu.ManufactureParty = receiptMaster.PartyFrom; //取区域代码为制造商代码 hu.ManufactureDate = LotNoHelper.ResolveLotNo(receiptDetail.LotNo); hu.PrintCount = 0; hu.ConcessionCount = 0; hu.ReferenceItemCode = receiptDetail.ReferenceItemCode; hu.UnitCount = receiptDetail.UnitCount; hu.UnitQty = itemMgr.ConvertItemUomQty(receiptDetail.Item, receiptDetail.Uom, 1, receiptDetail.BaseUom); hu.Uom = receiptDetail.Uom; hu.IsOdd = hu.Qty < hu.UnitCount; hu.OrderNo = receiptDetail.OrderNo; hu.ReceiptNo = receiptMaster.ReceiptNo; hu.IsChangeUnitCount = false; //hu.UnitCountDescription = receiptDetail.UnitCountDescription; genericMgr.Create(hu); //创建条码中间表 this.CreateBarCode(hu,string.Empty); //this.AsyncSendPrintData(hu); huList.Add(hu); } } return huList; }
public IList<Hu> CreateHu(IpMaster ipMaster, IList<IpDetail> ipDetailList) { IList<Hu> huList = new List<Hu>(); foreach (IpDetail ipDetail in ipDetailList) { IDictionary<string, decimal> huIdDic = numberControlMgr.GetHuId(ipDetail); if (huIdDic != null && huIdDic.Count > 0) { foreach (string huId in huIdDic.Keys) { Hu hu = new Hu(); hu.HuId = huId; hu.LotNo = ipDetail.LotNo; hu.Item = ipDetail.Item; hu.ItemDescription = ipDetail.ItemDescription; hu.BaseUom = ipDetail.BaseUom; hu.Qty = huIdDic[huId]; hu.ManufactureParty = ipDetail.ManufactureParty; hu.ManufactureDate = LotNoHelper.ResolveLotNo(ipDetail.LotNo); hu.PrintCount = 0; hu.ConcessionCount = 0; hu.ReferenceItemCode = ipDetail.ReferenceItemCode; hu.UnitCount = ipDetail.UnitCount; hu.UnitQty = ipDetail.UnitQty; hu.Uom = ipDetail.Uom; hu.IsOdd = hu.Qty < hu.UnitCount; hu.IsChangeUnitCount = ipDetail.IsChangeUnitCount; hu.UnitCountDescription = ipDetail.UnitCountDescription; hu.SupplierLotNo = ipDetail.SupplierLotNo; hu.ContainerDesc = ipDetail.ContainerDescription; hu.LocationTo = ipMaster.PartyTo; genericMgr.Create(hu); //this.AsyncSendPrintData(hu); //创建条码中间表 this.CreateBarCode(hu, ipMaster.IpNo); huList.Add(hu); } } } return huList; }
public IList<Hu> CreateHu(Item item) { IList<Hu> huList = new List<Hu>(); IDictionary<string, decimal> huIdDic = numberControlMgr.GetHuId(item); if (huIdDic != null && huIdDic.Count > 0) { foreach (string huId in huIdDic.Keys) { Hu hu = new Hu(); hu.HuId = huId; hu.LotNo = item.LotNo; hu.Item = item.Code; hu.ItemDescription = item.Description; hu.BaseUom = item.Uom; hu.Qty = huIdDic[huId]; hu.ManufactureParty = item.ManufactureParty; hu.ManufactureDate = item.ManufactureDate; hu.PrintCount = 0; hu.ConcessionCount = 0; hu.ReferenceItemCode = item.ReferenceCode; hu.UnitCount = item.HuUnitCount; hu.UnitQty = itemMgr.ConvertItemUomQty(item.Code, item.HuUom, 1, item.Uom); hu.Uom = item.HuUom; hu.IsOdd = hu.Qty < hu.UnitCount; hu.SupplierLotNo = item.SupplierLotNo; hu.IsChangeUnitCount = true; hu.ContainerDesc = item.Container; hu.MaterialsGroup = this.GetMaterialsGroupDescrption(item.MaterialsGroup); hu.Direction = item.Deriction; hu.Remark = item.Remark; hu.HuOption = item.HuOption; hu.HuTemplate = item.HuTemplate; if (item.Warranty > 0) { hu.ExpireDate = hu.ManufactureDate.AddDays(item.Warranty); } if (item.WarnLeadTime > 0) { hu.RemindExpireDate = hu.ManufactureDate.AddDays(item.WarnLeadTime); } this.genericMgr.Create(hu); //this.AsyncSendPrintData(hu); huList.Add(hu); } } return huList; }
public IList<Hu> CreateHu(IpMaster ipMaster, IList<IpDetail> ipDetailList) { IList<Hu> huList = new List<Hu>(); foreach (IpDetail ipDetail in ipDetailList) { IDictionary<string, decimal> huIdDic = numberControlMgr.GetHuId(ipDetail); if (huIdDic != null && huIdDic.Count > 0) { foreach (string huId in huIdDic.Keys) { Hu hu = new Hu(); hu.HuId = huId; hu.LotNo = ipDetail.LotNo; hu.Item = ipDetail.Item; hu.ItemDescription = ipDetail.ItemDescription; hu.BaseUom = ipDetail.BaseUom; hu.Qty = huIdDic[huId]; hu.ManufactureParty = ipDetail.ManufactureParty; hu.ManufactureDate = ipDetail.ManufactureDate; hu.PrintCount = 0; hu.ConcessionCount = 0; hu.ReferenceItemCode = ipDetail.ReferenceItemCode; hu.UnitCount = ipDetail.UnitCount; hu.UnitQty = ipDetail.UnitQty; hu.Uom = ipDetail.Uom; hu.IsOdd = ipDetail.HuQty < ipDetail.MinUc; hu.IsChangeUnitCount = ipDetail.IsChangeUnitCount; hu.UnitCountDescription = ipDetail.UnitCountDescription; hu.SupplierLotNo = ipDetail.SupplierLotNo; hu.ContainerDesc = ipDetail.ContainerDescription; hu.LocationTo = ipDetail.LocationTo; hu.OrderNo = ipDetail.OrderNo; hu.IpNo = ipDetail.IpNo; hu.Flow = ipDetail.Flow; var item = this.itemMgr.GetCacheItem(ipDetail.Item); hu.MaterialsGroup = this.GetMaterialsGroupDescrption(item.MaterialsGroup); hu.HuOption = GetHuOption(item); hu.HuTemplate = ipMaster.HuTemplate; hu.Remark = ipDetail.Remark; if (item.Warranty > 0) { hu.ExpireDate = hu.ManufactureDate.AddDays(item.Warranty); } if (item.WarnLeadTime > 0) { hu.RemindExpireDate = hu.ManufactureDate.AddDays(item.WarnLeadTime); } this.genericMgr.Create(hu); //this.AsyncSendPrintData(hu); huList.Add(hu); } } } return huList; }
public IList<Hu> CreateHu(OrderMaster orderMaster, IList<OrderDetail> orderDetailList, bool isScrapHu = false) { IList<Hu> huList = new List<Hu>(); foreach (OrderDetail orderDetail in orderDetailList) { IDictionary<string, decimal> huIdDic = numberControlMgr.GetHuId(orderDetail); if (huIdDic != null && huIdDic.Count > 0) { foreach (string huId in huIdDic.Keys) { var item = orderDetail.CurrentItem; if (item == null) { item = this.itemMgr.GetCacheItem(orderDetail.Item); } Hu hu = new Hu(); hu.HuId = huId; hu.LotNo = orderDetail.LotNo; hu.Qty = huIdDic[huId]; if (isScrapHu) { hu.Item = item.Code; hu.ItemDescription = item.Description; hu.BaseUom = item.Uom; hu.Uom = item.Uom; hu.UnitCount = item.UnitCount; hu.UnitQty = 1; hu.Qty = 0; hu.HuTemplate = "BarCodeEXScrap.xls"; } else { hu.Item = orderDetail.Item; hu.ItemDescription = orderDetail.ItemDescription; hu.BaseUom = orderDetail.BaseUom; hu.Uom = orderDetail.Uom; hu.UnitCount = orderDetail.UnitCount; hu.UnitQty = orderDetail.UnitQty; hu.HuTemplate = orderMaster.HuTemplate; } hu.ManufactureParty = orderDetail.ManufactureParty; hu.ManufactureDate = orderDetail.ManufactureDate; hu.PrintCount = 0; hu.ConcessionCount = 0; hu.ReferenceItemCode = orderDetail.ReferenceItemCode; //hu.IsOdd = hu.Qty < hu.UnitCount; hu.IsChangeUnitCount = orderDetail.IsChangeUnitCount; hu.UnitCountDescription = orderDetail.UnitCountDescription; hu.SupplierLotNo = orderDetail.SupplierLotNo; hu.ContainerDesc = orderDetail.ContainerDescription; hu.LocationTo = string.IsNullOrWhiteSpace(orderDetail.LocationTo) ? orderMaster.LocationTo : orderDetail.LocationTo; hu.OrderNo = orderDetail.OrderNo; hu.Shift = orderMaster.Shift; hu.Flow = orderMaster.Flow; hu.MaterialsGroup = GetMaterialsGroupDescrption(item.MaterialsGroup); hu.HuOption = GetHuOption(item); if (item.Warranty > 0) { hu.ExpireDate = hu.ManufactureDate.AddDays(item.Warranty); } if (item.WarnLeadTime > 0) { hu.RemindExpireDate = hu.ManufactureDate.AddDays(item.WarnLeadTime); } this.genericMgr.Create(hu); //this.AsyncSendPrintData(hu); huList.Add(hu); } } } return huList; }
public string Print(Hu hu) { string HuTemplate = hu.HuTemplate; IList<PrintHu> huList = new List<PrintHu>(); PrintHu printHu = Mapper.Map<Hu, PrintHu>(hu); if (!string.IsNullOrWhiteSpace(hu.ManufactureParty)) { printHu.ManufacturePartyDescription = queryMgr.FindById<Party>(hu.ManufactureParty).Name; } if (!string.IsNullOrWhiteSpace(hu.Direction)) { printHu.Direction = this.genericMgr.FindById<HuTo>(printHu.Direction).CodeDescription; } if (string.IsNullOrWhiteSpace(hu.HuTemplate)) { HuTemplate = this.systemMgr.GetEntityPreferenceValue(Entity.SYS.EntityPreference.CodeEnum.DefaultBarCodeTemplate); } huList.Add(printHu); IList<object> data = new List<object>(); data.Add(huList); data.Add(CurrentUser.FullName); return reportGen.WriteToFile(HuTemplate, data); }
public Hu CloneHu(Hu oldHu, decimal qty) { IList<Hu> huList = new List<Hu>(); IDictionary<string, decimal> huIdDic = numberControlMgr.GetHuId(oldHu.LotNo, oldHu.Item, oldHu.ManufactureParty, oldHu.UnitQty, oldHu.UnitQty); if (huIdDic != null && huIdDic.Count > 0) { foreach (string huId in huIdDic.Keys) { Hu hu = new Hu(); hu.HuId = huId; hu.LotNo = oldHu.LotNo; hu.Item = oldHu.Item; hu.ItemDescription = oldHu.ItemDescription; hu.BaseUom = oldHu.BaseUom; hu.Qty = qty; hu.ManufactureParty = oldHu.ManufactureParty; hu.ManufactureDate = LotNoHelper.ResolveLotNo(oldHu.LotNo); hu.PrintCount = 0; hu.ConcessionCount = 0; hu.ReferenceItemCode = oldHu.ReferenceItemCode; hu.UnitCount = oldHu.UnitCount; hu.UnitQty = oldHu.UnitQty; hu.Uom = oldHu.Uom; hu.IsOdd = hu.Qty < hu.UnitCount; hu.IsChangeUnitCount = oldHu.IsChangeUnitCount; hu.UnitCountDescription = oldHu.UnitCountDescription; genericMgr.Create(hu); this.AsyncSendPrintData(hu); huList.Add(hu); } } return huList[0]; }
public void AsyncSendPrintData(Hu hu) { //AsyncSend asyncSend = new AsyncSend(this.SendPrintData); //asyncSend.BeginInvoke(hu, null, null); try { var subPrintOrderList = this.genericMgr.FindAll<SubPrintOrder>(); var pubPrintOrders = subPrintOrderList.Where(p => (p.Flow == hu.Flow || string.IsNullOrWhiteSpace(p.Flow)) && (p.UserId == hu.CreateUserId || p.UserId == 0) && (p.Region == hu.ManufactureParty || string.IsNullOrWhiteSpace(p.Region)) && (p.Location == hu.LocationTo || string.IsNullOrWhiteSpace(p.Location)) && p.ExcelTemplate == hu.HuTemplate) .Select(p => new PubPrintOrder { Client = p.Client, ExcelTemplate = p.ExcelTemplate, Code = hu.HuId, Printer = p.Printer }); foreach (var pubPrintOrder in pubPrintOrders) { this.genericMgr.Create(pubPrintOrder); } } catch (Exception ex) { pubSubLog.Error("Send data to print sevrer error:", ex); } }
public IList<Hu> CreateHu(FlowMaster flowMaster, IList<FlowDetail> flowDetailList) { IList<Hu> huList = new List<Hu>(); foreach (FlowDetail flowDetail in flowDetailList) { IDictionary<string, decimal> huIdDic = numberControlMgr.GetHuId(flowDetail); if (huIdDic != null && huIdDic.Count > 0) { foreach (string huId in huIdDic.Keys) { var item = this.itemMgr.GetCacheItem(flowDetail.Item); if (string.IsNullOrWhiteSpace(flowDetail.ReferenceItemCode)) { flowDetail.ReferenceItemCode = item.ReferenceCode; } Hu hu = new Hu(); hu.HuId = huId; hu.LotNo = flowDetail.LotNo; hu.Item = flowDetail.Item; hu.ItemDescription = item.Description; hu.BaseUom = flowDetail.BaseUom; hu.Qty = huIdDic[huId]; hu.ManufactureParty = flowDetail.ManufactureParty; hu.ManufactureDate = flowDetail.ManufactureDate; hu.PrintCount = 0; hu.ConcessionCount = 0; hu.ReferenceItemCode = flowDetail.ReferenceItemCode; hu.UnitCount = flowDetail.UnitCount; hu.UnitQty = itemMgr.ConvertItemUomQty(flowDetail.Item, flowDetail.Uom, 1, flowDetail.BaseUom); hu.Uom = flowDetail.Uom; hu.IsOdd = flowDetail.HuQty < flowDetail.MinUc; hu.SupplierLotNo = flowDetail.SupplierLotNo; hu.IsChangeUnitCount = flowDetail.IsChangeUnitCount; hu.UnitCountDescription = flowDetail.UnitCountDescription; hu.ContainerDesc = flowDetail.ContainerDescription; hu.LocationTo = string.IsNullOrWhiteSpace(flowDetail.LocationTo) ? flowMaster.LocationTo : flowDetail.LocationTo; hu.Flow = flowDetail.Flow; hu.MaterialsGroup = GetMaterialsGroupDescrption(item.MaterialsGroup); hu.HuTemplate = flowMaster.HuTemplate; hu.HuOption = GetHuOption(item); hu.Remark = flowDetail.Remark; if (item.Warranty > 0) { hu.ExpireDate = hu.ManufactureDate.AddDays(item.Warranty); } if (item.WarnLeadTime > 0) { hu.RemindExpireDate = hu.ManufactureDate.AddDays(item.WarnLeadTime); } this.genericMgr.Create(hu); //this.AsyncSendPrintData(hu); huList.Add(hu); } } } return huList; }
public IList<Hu> CreateHu(PickTask pickTask, string lotNo) { IList<Hu> huList = new List<Hu>(); IDictionary<string, decimal> huIdDic = numberControlMgr.GetHuId(lotNo, pickTask.Item, pickTask.Supplier, pickTask.OrderedQty, pickTask.UnitCount); OrderDetail od = this.genericMgr.FindById<OrderDetail>(pickTask.OrdDetId); if (huIdDic != null && huIdDic.Count > 0) { foreach (string huId in huIdDic.Keys) { Hu hu = new Hu(); hu.HuId = huId; hu.LotNo = lotNo; hu.Item = pickTask.Item; hu.ItemDescription = pickTask.ItemDesc; hu.BaseUom = pickTask.BaseUom; hu.Qty = huIdDic[huId]; if(String.IsNullOrEmpty(pickTask.Supplier)) { hu.ManufactureParty = pickTask.PartyFrom; } else { hu.ManufactureParty = pickTask.Supplier; } if(String.IsNullOrEmpty(lotNo)) { hu.ManufactureDate = DateTime.Now; } else { hu.ManufactureDate = LotNoHelper.ResolveLotNo(lotNo); } hu.PrintCount = 0; hu.ConcessionCount = 0; hu.ReferenceItemCode = od.ReferenceItemCode; hu.UnitCount = pickTask.UnitCount; hu.UnitQty = od.UnitQty; hu.Uom = pickTask.Uom; hu.IsOdd = hu.Qty < hu.UnitCount; hu.IsChangeUnitCount = od.IsChangeUnitCount; hu.UnitCountDescription = od.UnitCountDescription; hu.SupplierLotNo = od.SupplierLotNo; hu.ContainerDesc = od.ContainerDescription; hu.LocationTo = pickTask.LocationTo; hu.Flow = pickTask.Flow; hu.OrderNo = pickTask.OrderNo; hu.Bin = od.BinTo; genericMgr.Create(hu); //this.AsyncSendPrintData(hu); huList.Add(hu); } } return huList; }
public IList<Hu> CreateHu(OrderDetail orderDetail, Boolean isRepack, string manufactureParty, string lotNo, decimal totalQty, decimal unitQty, decimal huQty, string oldHus, string binTo, Boolean isRepackForOrder) { IList<Hu> huList = new List<Hu>(); IDictionary<string, decimal> huIdDic = numberControlMgr.GetHuId(lotNo, orderDetail.Item, manufactureParty, totalQty, unitQty); if (huIdDic != null && huIdDic.Count > 0) { Hu hu = new Hu(); hu.HuId = huIdDic.SingleOrDefault().Key; hu.LotNo = lotNo; hu.Item = orderDetail.Item; hu.ItemDescription = orderDetail.ItemDescription; hu.BaseUom = orderDetail.BaseUom; hu.Qty = huQty; hu.ManufactureParty = manufactureParty; hu.ManufactureDate = LotNoHelper.ResolveLotNo(lotNo); hu.PrintCount = 0; hu.ConcessionCount = 0; hu.ReferenceItemCode = orderDetail.ReferenceItemCode; hu.UnitCount = orderDetail.UnitCount; hu.UnitQty = orderDetail.UnitQty; hu.Uom = orderDetail.Uom; hu.IsOdd = huQty != hu.UnitCount; hu.IsChangeUnitCount = orderDetail.IsChangeUnitCount; hu.UnitCountDescription = orderDetail.UnitCountDescription; hu.Bin = binTo; hu.LocationTo = orderDetail.LocationTo; hu.OldHus = oldHus; genericMgr.Create(hu); //this.AsyncSendPrintData(hu); this.genericMgr.Create(hu); huList.Add(hu); HuMapping huMapping = new HuMapping(); huMapping.HuId = huIdDic.SingleOrDefault().Key; huMapping.OldHus = oldHus; huMapping.Item = orderDetail.Item; if (isRepackForOrder == true) { huMapping.OrderNo = orderDetail.OrderNo; huMapping.OrderDetId = orderDetail.Id; } else { huMapping.OrderNo = ""; huMapping.OrderDetId = 0; } huMapping.IsRepack = isRepack; huMapping.Qty = huQty; huMapping.IsEffective = false; this.genericMgr.Create(huMapping); } return huList; }
public void AsyncSendPrintData(Hu hu) { AsyncSend asyncSend = new AsyncSend(this.SendPrintData); asyncSend.BeginInvoke(hu, null, null); }
public void SendPrintData(Hu hu) { try { PrintHu printHu = Mapper.Map<Hu, PrintHu>(hu); proxy = pubSubMgr.CreateProxy(); proxy.Publish(printHu); } catch (Exception ex) { pubSubLog.Error("Send data to print sevrer error:", ex); } }
private void CreateBarCode(Hu hu, string asn) { genericMgr.Create(new CreateBarCode { HuId = hu.HuId, LotNo = hu.LotNo, Item = hu.Item, Qty = hu.Qty, ManufactureParty = hu.ManufactureParty, ASN = asn, CreateDate = DateTime.Now, IsCreateDat=false }); }
public Hu CreateHu(Item item, string huId) { Hu hu = new Hu(); hu.HuId = huId; hu.LotNo = item.LotNo; hu.Item = item.Code; hu.ItemDescription = item.Description; hu.BaseUom = item.Uom; hu.Qty = item.HuQty; hu.ManufactureParty = item.ManufactureParty; hu.ManufactureDate = LotNoHelper.ResolveLotNo(item.LotNo); hu.PrintCount = 0; hu.ConcessionCount = 0; hu.ReferenceItemCode = item.ReferenceCode; hu.UnitCount = item.HuUnitCount; hu.UnitQty = itemMgr.ConvertItemUomQty(item.Code, item.HuUom, 1, item.Uom); hu.Uom = item.HuUom; hu.IsOdd = hu.Qty < hu.UnitCount; hu.SupplierLotNo = item.SupplierLotNo; hu.IsChangeUnitCount = true; hu.MaterialsGroup = this.GetMaterialsGroupDescrption(item.MaterialsGroup); hu.HuOption = GetHuOption(item); hu.HuTemplate = systemMgr.GetEntityPreferenceValue(Entity.SYS.EntityPreference.CodeEnum.DefaultBarCodeTemplate); if (item.Warranty > 0) { hu.ExpireDate = hu.ManufactureDate.AddDays(item.Warranty); } if (item.WarnLeadTime > 0) { hu.RemindExpireDate = hu.ManufactureDate.AddDays(item.WarnLeadTime); } this.genericMgr.Create(hu); return hu; }
public Hu FilterHu(Hu hu, decimal newQty, DateTime effectiveDate) { var huLocationLotDetail = locationDetailMgr.GetHuLocationLotDetail(hu.HuId); if (huLocationLotDetail == null) { throw new BusinessException(Resources.EXT.ServiceLan.CouldNotFilterNotInInventory); } Hu newHu = huMgr.CloneHu(hu, newQty); newHu.HuOption = CodeMaster.HuOption.Filtered; IList<ItemExchange> itemExchangeList = new List<ItemExchange>(); ItemExchange itemExchange = new ItemExchange(); itemExchange.BaseUom = hu.BaseUom; itemExchange.EffectiveDate = effectiveDate; itemExchange.OldHu = hu.HuId; itemExchange.IsVoid = false; itemExchange.ItemFrom = hu.Item; itemExchange.ItemTo = hu.Item; itemExchange.LocationFrom = huLocationLotDetail.Location; itemExchange.LocationTo = huLocationLotDetail.Location; itemExchange.ItemExchangeType = CodeMaster.ItemExchangeType.Filter; itemExchange.NewBaseUom = hu.BaseUom; itemExchange.NewHu = newHu.HuId; itemExchange.NewQty = newHu.Qty; itemExchange.NewUnitQty = newHu.UnitQty; itemExchange.NewUom = newHu.Uom; itemExchange.Qty = hu.Qty; itemExchange.QualityType = huLocationLotDetail.QualityType; string region = this.genericMgr.FindById<Location>(huLocationLotDetail.Location).Region; itemExchange.RegionFrom = region; itemExchange.RegionTo = region; itemExchange.UnitQty = hu.UnitQty; itemExchange.Uom = hu.Uom; itemExchange.LotNo = hu.LotNo; this.genericMgr.Create(itemExchange); itemExchangeList.Add(itemExchange); locationDetailMgr.InventoryExchange(itemExchangeList); newHu.RefId = itemExchange.Id; this.genericMgr.Update(newHu); return newHu; }
public Hu CloneHu(Hu oldHu, decimal qty) { if (qty <= 0) { throw new BusinessException(Resources.EXT.ServiceLan.HuQtyMustMoreThenZore); } IDictionary<string, decimal> huIdDic = numberControlMgr.GetHuId(oldHu.LotNo, oldHu.Item, oldHu.ManufactureParty, oldHu.UnitCount, oldHu.UnitCount); if (huIdDic != null && huIdDic.Count > 0) { var huId = huIdDic.Keys.First(); Hu hu = Mapper.Map<Hu, Hu>(oldHu); ; hu.HuId = huId; hu.Qty = qty; hu.PrintCount = 0; hu.ConcessionCount = 0; hu.IsOdd = hu.Qty < hu.UnitCount && oldHu.IsOdd; hu.RefHu = oldHu.HuId; this.genericMgr.Create(hu); this.AsyncSendPrintData(hu); return hu; } return null; }
public IList<Hu> CreateHu(Item item) { IList<Hu> huList = new List<Hu>(); IDictionary<string, decimal> huIdDic = numberControlMgr.GetHuId(item); if (huIdDic != null && huIdDic.Count > 0) { foreach (string huId in huIdDic.Keys) { Hu hu = new Hu(); hu.HuId = huId; hu.LotNo = item.LotNo; hu.Item = item.Code; hu.ItemDescription = item.Description; hu.BaseUom = item.Uom; hu.Qty = huIdDic[huId]; hu.ManufactureParty = item.ManufactureParty; hu.ManufactureDate = LotNoHelper.ResolveLotNo(item.LotNo); hu.PrintCount = 0; hu.ConcessionCount = 0; hu.ReferenceItemCode = item.ReferenceCode; hu.UnitCount = item.HuUnitCount; hu.UnitQty = itemMgr.ConvertItemUomQty(item.Code, item.Uom, 1, item.HuUom); hu.Uom = item.HuUom; hu.IsOdd = hu.Qty < hu.UnitCount; hu.SupplierLotNo = item.supplierLotNo; hu.IsChangeUnitCount = true; genericMgr.Create(hu); hu.ContainerDesc = item.Container; //this.AsyncSendPrintData(hu); //创建条码中间表 this.CreateBarCode(hu, string.Empty); huList.Add(hu); } } return huList; }
public IList<Hu> CreateHu(OrderDetail orderDetail, Boolean isRepack, string manufactureParty, string lotNo, decimal totalQty, decimal unitQty, decimal huQty, string oldHus, string binTo, Boolean isRepackForOrder) { IList<Hu> huList = new List<Hu>(); IDictionary<string, decimal> huIdDic = numberControlMgr.GetHuId(lotNo, orderDetail.Item, manufactureParty, totalQty, unitQty); if (huIdDic != null && huIdDic.Count > 0) { Hu hu = new Hu(); hu.HuId = huIdDic.SingleOrDefault().Key; hu.LotNo = lotNo; hu.Item = orderDetail.Item; hu.ItemDescription = orderDetail.ItemDescription; hu.BaseUom = orderDetail.BaseUom; hu.Qty = huQty; hu.ManufactureParty = manufactureParty; hu.ManufactureDate = LotNoHelper.ResolveLotNo(lotNo); hu.PrintCount = 0; hu.ConcessionCount = 0; hu.ReferenceItemCode = orderDetail.ReferenceItemCode; hu.UnitCount = orderDetail.UnitCount; hu.UnitQty = orderDetail.UnitQty; hu.Uom = orderDetail.Uom; hu.IsOdd = huQty != hu.UnitCount; hu.IsChangeUnitCount = orderDetail.IsChangeUnitCount; hu.UnitCountDescription = orderDetail.UnitCountDescription; hu.BinTo = binTo; hu.LocationTo = orderDetail.LocationTo; hu.OldHus = oldHus; var item = this.itemMgr.GetCacheItem(orderDetail.Item); hu.MaterialsGroup = this.GetMaterialsGroupDescrption(item.MaterialsGroup); hu.Direction = orderDetail.Direction; hu.RefId = orderDetail.Id; hu.HuOption = GetHuOption(item); if (item.Warranty > 0) { hu.ExpireDate = hu.ManufactureDate.AddDays(item.Warranty); } if (item.WarnLeadTime > 0) { hu.RemindExpireDate = hu.ManufactureDate.AddDays(item.WarnLeadTime); } this.genericMgr.Create(hu); huList.Add(hu); } return huList; }
public Hu CreateHu(Item item, string huId) { Hu hu = new Hu(); hu.HuId = huId; hu.LotNo = string.IsNullOrWhiteSpace(item.LotNo) ? com.Sconit.Utility.LotNoHelper.GenerateLotNo() : item.LotNo; hu.Item = item.Code; hu.ItemDescription = item.Description; hu.BaseUom = item.Uom; hu.Qty = item.HuQty; hu.ManufactureParty = item.ManufactureParty; hu.ManufactureDate = LotNoHelper.ResolveLotNo(hu.LotNo); hu.PrintCount = 0; hu.ConcessionCount = 0; hu.ReferenceItemCode = item.ReferenceCode; hu.UnitCount = item.HuUnitCount; hu.UnitQty = itemMgr.ConvertItemUomQty(item.Code, item.Uom, 1, item.HuUom); hu.Uom = item.HuUom; hu.IsOdd = hu.Qty < hu.UnitCount; hu.SupplierLotNo = item.supplierLotNo; hu.IsChangeUnitCount = true; genericMgr.Create(hu); //创建条码中间表 this.CreateBarCode(hu, string.Empty); return hu; }
public void CancelAgingHu(Hu hu, DateTime effectiveDate) { if (hu.HuOption != CodeMaster.HuOption.Aged) { throw new BusinessException(Resources.EXT.ServiceLan.CouldNotVoidIsNotBurnIn); } ItemExchange itemExchange = this.genericMgr.FindById<ItemExchange>(hu.RefId); CancelItemExchangeHu(itemExchange, effectiveDate); }
private void RecordModifyExpiredDateTransaction(Hu huId, DateTime oldEptime) { User user = com.Sconit.Entity.SecurityContextHolder.Get(); HuIdEpDateChangeTransaction huIdEpDateChangeTransaction = new HuIdEpDateChangeTransaction(); huIdEpDateChangeTransaction.CreateDate = DateTime.Now; huIdEpDateChangeTransaction.CreateUserName = user.FullName; huIdEpDateChangeTransaction.CreateUserId = user.Id; huIdEpDateChangeTransaction.HuId = huId.HuId; huIdEpDateChangeTransaction.LotNo = huId.LotNo; huIdEpDateChangeTransaction.Bin = huId.Bin; huIdEpDateChangeTransaction.Item = huId.Item; huIdEpDateChangeTransaction.OldExpiredDate = oldEptime; huIdEpDateChangeTransaction.NewExpiredDate = DateTime.Parse(huId.ExpireDateValue); huIdEpDateChangeTransaction.Location = huId.Location; this.genericMgr.Create(huIdEpDateChangeTransaction); }
public void CancelFilterHu(Hu hu, decimal outQty, DateTime effectiveDate) { if (hu.HuOption != CodeMaster.HuOption.Filtered) { throw new BusinessException(Resources.EXT.ServiceLan.CouldNotFilterVoidHasNotFiltered); } ItemExchange itemExchange = this.genericMgr.FindById<ItemExchange>(hu.RefId); CancelItemExchangeHu(itemExchange, effectiveDate); }
public ActionResult _Update(Hu Hu) { if (Hu.ExpireDateValue == null) { SaveErrorMessage(Resources.EXT.ControllerLan.Con_OverTimeTimeCanNotBeEmpty); } //else if (DateTime.Parse(Hu.ExpireDateValue) < DateTime.Now) //{ // SaveErrorMessage("过期时间不能小于当前日期。"); //} else { Hu upHu = base.genericMgr.FindById<Hu>(Hu.HuId); DateTime oldEptime = upHu.ExpireDate.Value; upHu.ExpireDate = DateTime.Parse(Hu.ExpireDateValue); this.genericMgr.Update(upHu); SaveSuccessMessage(Resources.EXT.ControllerLan.Con_ModificateSuccessfully); RecordModifyExpiredDateTransaction(Hu, oldEptime); } GridCommand command = (GridCommand)TempData["GridCommand"]; HuTransSearchModel searchModel = (HuTransSearchModel)TempData["searchModel"]; TempData["GridCommand"] = command; TempData["searchModel"] = searchModel; string isIncludeAllSelect = ""; if (!searchModel.IsIncludeAll) { isIncludeAllSelect = "(a.ExpireDate <GETDATE() and a.ExpireDate is not null) and"; } string sql = @"Select a.HuId,b.Qty,a.Item ,a.RefItemCode As ReferenceItemCode,a.ItemDesc As ItemDescription , a.LotNo,b.Location,a.UC As UnitCount,a.Uom, dbo.FormatDate(a.ExpireDate,'YYYY-MM-DD') As ExpireDateValue, Case when a.RemindExpireDate is null then '' else dbo.FormatDate(a.RemindExpireDate,'YYYY-MM-DD') End As RemindExpireDateValue from INV_Hu a ,VIEW_LocationLotDet b where a.HuId =b.HuId and " + isIncludeAllSelect + " a.HuId is not null and " + "a.Item like '" + searchModel.Item + "%' and b.Location like '" + searchModel.Location + "%'and a.LotNo between '" + searchModel.LotNo + "' and '" + searchModel.LotNoTo + "'"; int total = this.genericMgr.FindAllWithNativeSql<int>("select count(*) from (" + sql + ") as r1").First(); string sortingStatement = " Order by r1.Location,r1.Item"; sql = string.Format("select * from (select RowId=ROW_NUMBER()OVER({0}),r1.* from ({1}) as r1 ) as rt where rt.RowId between {2} and {3}", sortingStatement, sql, (command.Page - 1) * command.PageSize + 1, command.PageSize * command.Page); var ds = this.genericMgr.GetDatasetBySql(sql, null); var itemCategoryList = this.genericMgr.FindAll<ItemCategory>(); IList<Hu> huTypeList = Utility.IListHelper.DataTableToList<Hu>(ds.Tables[0]); foreach (var huData in huTypeList) { huData.MaterialsGroup = itemMgr.GetCacheItem(huData.Item).MaterialsGroup; huData.MaterialsGroupDesc = GetItemCategory(huData.MaterialsGroup, Sconit.CodeMaster.SubCategory.MaterialsGroup, itemCategoryList).Description; } GridModel<Hu> gridModel = new GridModel<Hu>(); gridModel.Total = total; gridModel.Data = huTypeList; return PartialView(gridModel); }
private IList<Hu> GetPartsHu(OrderMaster orderMaster, IList<OrderDetail> orderDetailList) { IList<Hu> huList = new List<Hu>(); foreach (OrderDetail orderDetail in orderDetailList) { int huCount = Convert.ToInt32(orderDetail.HuQty % orderDetail.UnitCount == 0 ? orderDetail.HuQty / orderDetail.UnitCount : (orderDetail.HuQty / orderDetail.UnitCount) + 1); var lastHuQty = orderDetail.HuQty % orderDetail.UnitCount; for (int i = 0; i < huCount; i++) { var item = this.itemMgr.GetCacheItem(orderDetail.Item); Hu hu = new Hu(); //hu.HuId = huId; hu.LotNo = orderDetail.LotNo; hu.Qty = (i + 1 == huCount) ? (lastHuQty > 0 ? lastHuQty : orderDetail.UnitCount) : orderDetail.UnitCount; hu.Item = orderDetail.Item; hu.ItemDescription = orderDetail.ItemDescription; hu.BaseUom = orderDetail.BaseUom; hu.Uom = orderDetail.Uom; hu.UnitCount = orderDetail.UnitCount; hu.UnitQty = orderDetail.UnitQty; hu.HuTemplate = orderMaster.HuTemplate; hu.ManufactureParty = orderDetail.ManufactureParty; hu.ManufactureDate = orderDetail.ManufactureDate; hu.PrintCount = 0; hu.ConcessionCount = 0; hu.ReferenceItemCode = orderDetail.ReferenceItemCode; //hu.IsOdd = hu.Qty < hu.UnitCount; hu.IsChangeUnitCount = orderDetail.IsChangeUnitCount; hu.UnitCountDescription = orderDetail.UnitCountDescription; hu.SupplierLotNo = orderDetail.SupplierLotNo; hu.ContainerDesc = orderDetail.ContainerDescription; hu.LocationTo = string.IsNullOrWhiteSpace(orderDetail.LocationTo) ? orderMaster.LocationTo : orderDetail.LocationTo; hu.OrderNo = orderDetail.OrderNo; hu.Shift = orderMaster.Shift; hu.Flow = orderMaster.Flow; hu.MaterialsGroup = GetMaterialsGroupDescrption(item.MaterialsGroup); //hu.HuOption = GetHuOption(item); huList.Add(hu); } } return huList; }
public ReceiptMaster ReceiveUrgentExOrder(FlowDetail flowDetail) { var flowMaster = flowDetail.CurrentFlowMaster; if(flowMaster == null) { flowMaster = genericMgr.FindById<FlowMaster>(flowDetail.Flow); } var orderMaster = orderMgr.TransferFlow2Order(flowMaster, false); OrderDetail orderDetail = new OrderDetail(); var item = this.itemMgr.GetCacheItem(flowDetail.Item); orderDetail.Item = item.Code; orderDetail.UnitCount = flowDetail.UnitCount; orderDetail.Uom = flowDetail.Uom; orderDetail.ItemDescription = item.Description; orderDetail.BaseUom = item.Uom; orderDetail.Sequence = 10; orderDetail.MinUnitCount = item.UnitCount; orderDetail.OrderedQty = (decimal)flowDetail.CurrentQty; orderDetail.IsInspect = flowDetail.IsFreeze; orderDetail.ReferenceItemCode = item.ReferenceCode; orderDetail.UnitCountDescription = flowDetail.UnitCountDescription; orderDetail.ContainerDescription = flowDetail.ContainerDescription; orderDetail.Remark = flowDetail.Remark; if(item.ItemOption == com.Sconit.CodeMaster.ItemOption.NeedAging) { orderDetail.OldOption = Sconit.CodeMaster.HuOption.UnAging; } else { orderDetail.OldOption = Sconit.CodeMaster.HuOption.NoNeed; } var productType = this.genericMgr.FindById<ProductType>(flowDetail.ProductType); orderDetail.ScheduleType = productType.SubType; orderMaster.AddOrderDetail(orderDetail); if(flowMaster.Code == "EXV") { orderMaster.ProductLineFacility = "EXV"; } orderMaster.IsAutoRelease = true; orderMaster.IsAutoStart = true; orderMaster.IsAutoReceive = false; orderMaster.IsOpenOrder = false; orderMaster.Shift = flowDetail.Shift; DateTime startTime = DateTime.Now; DateTime windowTime = DateTime.Now; workingCalendarMgr.GetStartTimeAndWindowTime(orderMaster.Shift, DateTime.Now.AddHours(-7.75).Date, out startTime, out windowTime); orderMaster.StartTime = startTime; orderMaster.WindowTime = windowTime; orderMaster.Priority = CodeMaster.OrderPriority.Urgent; orderMaster.CreateHuOption = Sconit.CodeMaster.CreateHuOption.Receive; orderMaster.EffectiveDate = startTime.Date; var bomDetail = this.bomMgr.GetOnlyNextLevelBomDetail(flowDetail.Item, orderMaster.StartTime) .Where(p => p.Item.StartsWith("29")).FirstOrDefault(); if(bomDetail != null) { item = itemMgr.GetCacheItem(bomDetail.Item); orderMaster.ReferenceOrderNo = bomDetail.Item; } orderMaster.SubType = CodeMaster.OrderSubType.Normal; orderMgr.CreateOrder(orderMaster); var receiptMaster = new ReceiptMaster(); if(flowDetail.CurrentQty <= 0) { Hu hu = new Hu(); hu.Qty = 0; hu.Item = item.Code; hu.ItemDescription = item.Description; hu.BaseUom = item.Uom; hu.Uom = item.Uom; hu.UnitCount = item.UnitCount; hu.UnitQty = 1; hu.Qty = 0; hu.HuTemplate = "BarCodeEXScrap.xls"; hu.ManufactureDate = DateTime.Now.AddHours(-7.75).Date; hu.LotNo = Utility.LotNoHelper.GenerateLotNo(hu.ManufactureDate); hu.PrintCount = 0; hu.ConcessionCount = 0; hu.ReferenceItemCode = item.ReferenceCode; hu.LocationTo = flowDetail.LocationTo; if(string.IsNullOrWhiteSpace(hu.LocationTo)) { hu.LocationTo = flowMaster.LocationTo; } hu.Shift = flowDetail.Shift; hu.Flow = flowDetail.Flow; hu.OrderNo = orderMaster.OrderNo; receiptMaster.HuList = new List<Hu>(); receiptMaster.HuList.Add(hu); receiptMaster.CreateHuOption = orderMaster.CreateHuOption; receiptMaster.HuTemplate = orderMaster.HuTemplate; orderMgr.ManualCloseOrder(orderMaster); } else { OrderDetailInput orderDetailInput = new OrderDetailInput(); orderDetailInput.ReceiveQty = (decimal)flowDetail.CurrentQty; orderMaster.OrderDetails[0].AddOrderDetailInput(orderDetailInput); receiptMaster = orderMgr.ReceiveOrder(orderMaster.OrderDetails); receiptMaster.HuList = receiptMaster.ReceiptDetails.SelectMany(p => p.ReceiptLocationDetails.Select(q => q.HuId)) .Select(p => { return this.genericMgr.FindById<Hu>(p); }).ToList(); foreach(var hu in receiptMaster.HuList) { hu.ItemVersion = flowDetail.ProductType; this.genericMgr.Update(hu); } } return receiptMaster; }