public void CreateInspectTransfer(Location location, IList<InspectDetail> inspectDetailList) { var orderMaster = new Entity.ORD.OrderMaster(); var inspectNoList = (from inp in inspectDetailList select inp.InspectNo).Distinct().ToList(); if (inspectNoList.Count() > 1) { throw new BusinessException("多个报验单待验明细不能合并移库。"); } InspectMaster inspectMaster = genericMgr.FindById<InspectMaster>(inspectNoList[0]); var locationFrom = this.genericMgr.FindById<Entity.MD.Location>(inspectDetailList[0].LocationFrom); var partyFrom = this.genericMgr.FindById<Entity.MD.Party>(locationFrom.Region); var partyTo = this.genericMgr.FindById<Entity.MD.Party>(location.Region); orderMaster.LocationFrom = locationFrom.Code; orderMaster.IsShipScanHu = inspectMaster.Type == com.Sconit.CodeMaster.InspectType.Barcode; orderMaster.IsReceiveScanHu = inspectMaster.Type == com.Sconit.CodeMaster.InspectType.Barcode; orderMaster.LocationFromName = locationFrom.Name; orderMaster.LocationTo = location.Code; orderMaster.LocationToName = location.Name; orderMaster.PartyFrom = partyFrom.Code; orderMaster.PartyFromName = partyFrom.Name; orderMaster.PartyTo = partyTo.Code; orderMaster.PartyToName = partyTo.Name; orderMaster.Type = CodeMaster.OrderType.Transfer; orderMaster.StartTime = DateTime.Now; orderMaster.WindowTime = DateTime.Now; orderMaster.EffectiveDate = DateTime.Now; orderMaster.QualityType = com.Sconit.CodeMaster.QualityType.Inspect; orderMaster.IsQuick = true; orderMaster.OrderDetails = new List<OrderDetail>(); int seq = 1; var groupInspectDetailList = from d in inspectDetailList group d by new { d.Item, d.CurrentLocation } into result select result; foreach (var inspectDetail in groupInspectDetailList) { var currentInspectDetailList = inspectDetailList.Where(p => p.Item == inspectDetail.Key.Item && p.CurrentLocation == inspectDetail.Key.CurrentLocation).ToList(); var orderDetail = new OrderDetail(); var orderDetailInputList = new List<OrderDetailInput>(); Mapper.Map(currentInspectDetailList[0], orderDetail); orderDetail.OrderType = com.Sconit.CodeMaster.OrderType.Transfer; orderDetail.QualityType = com.Sconit.CodeMaster.QualityType.Inspect; orderDetail.LocationFrom = inspectDetail.Key.CurrentLocation; orderDetail.LocationFromName = genericMgr.FindById<Location>(inspectDetail.Key.CurrentLocation).Name; orderDetail.LocationTo = location.Code; orderDetail.LocationToName = location.Name; orderDetail.Sequence = seq++; foreach (InspectDetail insp in currentInspectDetailList) { var orderDetailInput = new OrderDetailInput(); if (inspectMaster.Type == com.Sconit.CodeMaster.InspectType.Barcode) { orderDetailInput.HuId = insp.HuId; orderDetailInput.LotNo = insp.LotNo; } orderDetailInput.QualityType = com.Sconit.CodeMaster.QualityType.Inspect; orderDetailInput.OccupyType = com.Sconit.CodeMaster.OccupyType.Inspect; orderDetailInput.OccupyReferenceNo = inspectMaster.InspectNo; orderDetailInput.ReceiveQty = insp.CurrentTransferQty; orderDetail.RequiredQty += insp.CurrentTransferQty; orderDetail.OrderedQty += insp.CurrentTransferQty; orderDetailInputList.Add(orderDetailInput); } orderDetail.OrderDetailInputs = orderDetailInputList; orderMaster.OrderDetails.Add(orderDetail); } CreateOrder(orderMaster); #region 更新检验明细 foreach (InspectDetail insp in inspectDetailList) { insp.CurrentLocation = location.Code; genericMgr.Update(insp); } #endregion }
public ActionResult _SAPLocationAjaxLoading(string text) { IList<object> locationobjectList = null; IList<Location> locationList = new List<Location>(); if (text == "") locationobjectList = base.genericMgr.FindAllWithNativeSql<object>("select distinct top 20 SAPLocation from md_location "); else locationobjectList = base.genericMgr.FindAllWithNativeSql<object>(string.Format(selectLikeSAPLocationStatement, text)); if (locationobjectList.Count != 0) { foreach (object obj in locationobjectList) { Location cation = new Location(); cation.SAPLocation = obj.ToString(); locationList.Add(cation); } } return new JsonResult { Data = new SelectList(locationList, "SAPLocation", "SAPLocation") }; }
public ActionResult _SAPLocationComboBox(string controlName, string controlId, string selectedValue, bool? enable, bool? isChange) { ViewBag.ControlName = controlName; ViewBag.ControlId = controlId; ViewBag.Enable = enable; ViewBag.isChange = isChange; IList<object> locationobjectList = new List<object>(); IList<Location> locationList = new List<Location>(); if (selectedValue != null && selectedValue.Trim() != string.Empty) { locationobjectList = base.genericMgr.FindAllWithNativeSql<object>(string.Format(selectSAPLocationStatement, selectedValue)); if (locationobjectList.Count != 0) { foreach (object obj in locationobjectList) { Location cation = new Location(); cation.SAPLocation = obj.ToString(); locationList.Add(cation); } } } return PartialView(new SelectList(locationList, "SAPLocation", "SAPLocation", selectedValue)); }
private void CreateItemStandardPackByType(FlowDetail flowDetail, Location loc, string type) { if (loc.SAPLocation == "1000") { this.genericMgr.Create(new ItemStandardPackDAT { Item = flowDetail.Item, FlowDetId = flowDetail.Id, Pack = flowDetail.UnitCountDescription, UC = type == "O" ? flowDetail.MinUnitCount : flowDetail.UnitCount, IOType = type, Location = loc.SAPLocation, Plant = GetSAPPlant(), CreateDate = DateTime.Now }); } }
public ActionResult _Edit(Location location) { if (ModelState.IsValid) { base.genericMgr.Update(location); SaveSuccessMessage(Resources.MD.Location.Location_Updated); } return PartialView(location); }
public ActionResult New(Location location) { if (ModelState.IsValid) { if (base.genericMgr.FindAll<long>(duiplicateVerifyStatement, new object[] { location.Code })[0] > 0) { SaveErrorMessage(Resources.ErrorMessage.Errors_Existing_Code, location.Code); } else { base.genericMgr.Create(location); SaveSuccessMessage(Resources.MD.Location.Location_Added); return RedirectToAction("Edit/" + location.Code); } } return View(location); }