public IList<Hu> GetHuByPickTask(PickTask task) { IList<Hu> hus = new List<Hu>(); IList<string> ph = this.genericMgr.FindAllWithNativeSql<string>("select RepackHu from ord_PickHu where PickId = ? ", task.PickId); if (ph != null && ph.Count > 0) { //已经生成过 hus = huMgr.LoadHus(ph); } else { //第一次 hus = huMgr.CreateHu(task, string.Empty); if (hus != null && hus.Count > 0) { foreach (Hu h in hus) { PickHu newPh = new PickHu(); newPh.PickId = task.PickId; newPh.RepackHu = h.HuId; this.genericMgr.Create(newPh); } } } return hus; }
private PickTask CreatePickTaskFromOrder(OrderMaster orderMaster, OrderDetail od) { PickTask task = new PickTask(); task.PickId = GeneratePickTaskId(); task.OrderNo = orderMaster.OrderNo; task.OrdDetId = od.Id; task.DemandType = CodeMaster.PickDemandType.Purchase; task.IsHold = false; task.Flow = orderMaster.Flow; task.FlowDesc = orderMaster.FlowDescription; task.Item = od.Item; task.ItemDesc = od.ItemDescription; task.Uom = od.Uom; task.BaseUom = od.BaseUom; task.PartyFrom = orderMaster.PartyFrom; task.PartyFromName = orderMaster.PartyFromName; task.PartyTo = orderMaster.PartyTo; task.PartyToName = orderMaster.PartyToName; task.LocationFrom = od.LocationFrom; task.LocationFromName = od.LocationFromName; task.LocationTo = od.LocationTo; task.LocationToName = od.LocationToName; task.WindowTime = orderMaster.WindowTime; task.ReleaseDate = orderMaster.ReleaseDate.Value; task.Supplier = od.ManufactureParty; task.SupplierName = od.ManufactureParty; task.UnitCount = od.UnitCount; //可拣数 IList<PickTask> pickTaskList = this.genericMgr.FindAll<PickTask>("from PickTask where OrdDetId = ?", od.Id); decimal? sumPickTaskReqQty = 0; decimal? sumPickTaskShipQty = 0; if (pickTaskList != null && pickTaskList.Count() > 0) { sumPickTaskReqQty = pickTaskList.Sum(p => p.OrderedQty); sumPickTaskShipQty = pickTaskList.Sum(p => p.ShippedQty); } task.OrderedQty = od.OrderedQty - od.ShippedQty - (sumPickTaskReqQty.HasValue ? sumPickTaskReqQty.Value : decimal.Zero) + (sumPickTaskShipQty.HasValue ? sumPickTaskShipQty.Value : decimal.Zero); task.PickedQty = 0; task.ShippedQty = 0; task.Picker = this.GetPicker(task.Item,task.LocationFrom); task.PrintCount = 0; task.Memo = ""; this.genericMgr.Create(task); return task; }
public string GetDefaultPicker(PickTask task) { string defaultPicker = ""; IList<PickRule> rules = this.genericMgr.FindAll<PickRule>("from PickRule where Item = ? and Location = ? Order by Id desc", new object[] { task.Item, task.LocationFrom }); if (rules != null) { foreach (PickRule pr in rules) { defaultPicker = pr.Picker; break; } } if (defaultPicker != "") { return defaultPicker; } else { IList<Picker> pickers = this.genericMgr.FindAll<Picker>("from Picker where Location = ? ", task.LocationFrom); if (pickers != null) { foreach (Picker p in pickers) { defaultPicker = p.Code; break; } } if (defaultPicker != "") { return defaultPicker; } } return defaultPicker; }
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; }