Esempio n. 1
0
        public OrderMaster CreateExScrapOrder(MrpExScrap mrpExScrap)
        {
            var newOrder = new OrderMaster();
            Item item = this.itemMgr.GetCacheItem(mrpExScrap.Item);
            mrpExScrap.ItemDescription = item.Description;
            this.genericMgr.Create(mrpExScrap);
            if(mrpExScrap.Item == BusinessConstants.VIRTUALSECTION)
            {
                //nothing todo
            }
            else if(mrpExScrap.ScrapType == CodeMaster.ScheduleType.MES24 || mrpExScrap.ScrapType == CodeMaster.ScheduleType.MES25)
            {
                //只记录废品数,无材料消耗
                DateTime startTime = mrpExScrap.EffectDate;
                DateTime windowTime = mrpExScrap.EffectDate;
                workingCalendarMgr.GetStartTimeAndWindowTime(mrpExScrap.Shift, mrpExScrap.EffectDate, out startTime, out windowTime);

                FlowMaster flowMaster = this.genericMgr.FindById<FlowMaster>(mrpExScrap.Flow);
                newOrder = orderMgr.TransferFlow2Order(flowMaster, false);
                newOrder.Shift = mrpExScrap.Shift;
                newOrder.StartTime = startTime;
                newOrder.WindowTime = windowTime;
                newOrder.EffectiveDate = mrpExScrap.EffectDate;
                newOrder.ReferenceOrderNo = mrpExScrap.Id.ToString();
                newOrder.Priority = CodeMaster.OrderPriority.Normal;

                OrderDetail newOrderDetail = new OrderDetail();
                newOrderDetail.Item = item.Code;
                newOrderDetail.UnitCount = (decimal)item.UnitCount;
                newOrderDetail.Uom = "KG";
                newOrderDetail.BaseUom = item.Uom;
                newOrderDetail.ItemDescription = item.Description;
                newOrderDetail.Sequence = 10;
                newOrderDetail.MinUnitCount = item.UnitCount;
                newOrderDetail.OrderedQty = (decimal)mrpExScrap.ScrapQty;
                newOrderDetail.LocationFrom = flowMaster.LocationFrom;
                newOrderDetail.LocationTo = flowMaster.LocationTo;
                newOrderDetail.CurrentScrapQty = newOrderDetail.OrderedQty;
                newOrderDetail.ScheduleType = mrpExScrap.ScrapType;

                newOrder.ExternalOrderNo = newOrderDetail.ScheduleType.ToString();
                newOrder.AddOrderDetail(newOrderDetail);
                newOrder.SubType = CodeMaster.OrderSubType.Other;
                newOrder.IsQuick = true;
                newOrder.IsShipScanHu = false;
                newOrder.IsReceiveScanHu = false;
                newOrder.CreateHuOption = CodeMaster.CreateHuOption.None;
                orderMgr.CreateOrder(newOrder, true);
                mrpExScrap.OrderNo = newOrder.OrderNo;
            }
            return newOrder;
        }
 public ActionResult Edit(MrpExScrap mrpExScrap)
 {
     if (ModelState.IsValid)
     {
         this.genericMgr.UpdateWithTrim(mrpExScrap);
         SaveSuccessMessage(Resources.MRP.MrpExScrap.MrpExScrap_Updated);
     }
     return View(mrpExScrap);
 }
 public ActionResult New(MrpExScrap mrpExScrap)
 {
     if (ModelState.IsValid)
     {
         try
         {
             //todo 校验给时间段是否生产了此断面
             if (false)
             {
                 //SaveErrorMessage(Resources.SYS.ErrorMessage.Errors_Existing_Code, mrpExScrap.Flow);
             }
             else
             {
                 //mrpExScrapMgr.CreateMrpExScrap(mrpExScrap);
                 mrpOrderMgr.CreateExScrapOrder(mrpExScrap);
                 SaveSuccessMessage(Resources.MRP.MrpExScrap.MrpExScrap_Added);
                 return RedirectToAction("Edit/" + mrpExScrap.Id);
             }
         }
         catch (Exception ex)
         {
             SaveErrorMessage(Resources.EXT.ControllerLan.Con_NewAddedUnsuccessfully_1, ex.Message);
         }
     }
     return View(mrpExScrap);
 }
Esempio n. 4
0
 public void CancelExScrapOrder(MrpExScrap mrpExScrap)
 {
     if(!string.IsNullOrWhiteSpace(mrpExScrap.OrderNo))
     {
         var receiptDetails = this.genericMgr.FindAll<ReceiptDetail>(" from ReceiptDetail where OrderNo =?", mrpExScrap.OrderNo);
         receiptMgr.CancelReceipt(receiptDetails.First().ReceiptNo);
         orderMgr.ManualCloseOrder(mrpExScrap.OrderNo);
     }
     mrpExScrap.IsVoid = true;
     this.genericMgr.Update(mrpExScrap);
 }