|
@@ -22,6 +22,7 @@ using MongoDB.Driver;
|
|
|
using MongoDB.Driver.Linq;
|
|
using MongoDB.Driver.Linq;
|
|
|
using Newtonsoft.Json;
|
|
using Newtonsoft.Json;
|
|
|
using Newtonsoft.Json.Linq;
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
|
+using NPOI.POIFS.Storage;
|
|
|
using NPOI.SS.Formula.Functions;
|
|
using NPOI.SS.Formula.Functions;
|
|
|
using NPOI.XWPF.UserModel;
|
|
using NPOI.XWPF.UserModel;
|
|
|
using NUglify.JavaScript.Syntax;
|
|
using NUglify.JavaScript.Syntax;
|
|
@@ -1044,6 +1045,297 @@ namespace Business.ResourceExamineManagement
|
|
|
return JsonConvert.SerializeObject("ok");
|
|
return JsonConvert.SerializeObject("ok");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /// <summary>
|
|
|
|
|
+ /// 订单变更计划重排
|
|
|
|
|
+ /// </summary>
|
|
|
|
|
+ /// <param name="input"></param>
|
|
|
|
|
+ /// <param name="type">类型(0,销售订单 1,全域订单)</param>
|
|
|
|
|
+ /// <returns></returns>
|
|
|
|
|
+ /// <exception cref="NotImplementedException"></exception>
|
|
|
|
|
+ public async Task<string> OrderChangeRefresh(string ids)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (string.IsNullOrEmpty(ids))
|
|
|
|
|
+ {
|
|
|
|
|
+ throw new NotImplementedException("请输入正确的订单号!");
|
|
|
|
|
+ }
|
|
|
|
|
+ ResourceCheckInputDto input = new ResourceCheckInputDto();
|
|
|
|
|
+ input.sorderId = AnalysisIdList(ids);
|
|
|
|
|
+ //资源检查结果
|
|
|
|
|
+ PschedDto rtn = new PschedDto();
|
|
|
|
|
+ List<crm_seorder> sorders = new List<crm_seorder>();
|
|
|
|
|
+ List<crm_seorderentry> sentrys = new List<crm_seorderentry>();
|
|
|
|
|
+ //生成当前计算bangid
|
|
|
|
|
+ long bangid = help.NextId();
|
|
|
|
|
+ //获取订单数据
|
|
|
|
|
+ sorders = _mysql_crm_seorder.GetListAsync(p => input.sorderId.Contains(p.Id) && !p.IsDeleted).Result;
|
|
|
|
|
+ if (!sorders.Any())
|
|
|
|
|
+ {
|
|
|
|
|
+ new NLogHelper("ResourceExamineAppService").WriteLog("ReceiveResult", "订单数据不存在", _currentTenant.Id.ToString());
|
|
|
|
|
+ return "订单数据不存在";
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //获取订单行数据
|
|
|
|
|
+ sentrys = await _mysql_crm_seorderentry.GetListAsync(p => input.sorderId.Contains(p.seorder_id.GetValueOrDefault()) && (p.progress == "1" || p.progress == "2" || p.progress == "0") && !p.IsDeleted);
|
|
|
|
|
+ if (!sentrys.Any())
|
|
|
|
|
+ {
|
|
|
|
|
+ new NLogHelper("ResourceExamineAppService").WriteLog("ReceiveResult", "订单行数据不存在", _currentTenant.Id.ToString());
|
|
|
|
|
+ return "订单行数据不存在";
|
|
|
|
|
+ }
|
|
|
|
|
+ input.company_id = sorders[0].company_id;
|
|
|
|
|
+ input.factoryId = sorders[0].tenant_id.GetValueOrDefault();
|
|
|
|
|
+
|
|
|
|
|
+ //资源检查入参全局变量赋值
|
|
|
|
|
+ param.company_id = input.company_id;
|
|
|
|
|
+ param.factoryId = input.factoryId;
|
|
|
|
|
+ param.checkflag = true;
|
|
|
|
|
+
|
|
|
|
|
+ param.sorderId = sorders[0].Id;
|
|
|
|
|
+ param.company_id = input.company_id;
|
|
|
|
|
+ param.factoryId = input.factoryId;
|
|
|
|
|
+ //param.checkflag = true;
|
|
|
|
|
+ _morderAppService.param = param;
|
|
|
|
|
+ _purchaseOrderAppService.param = param;
|
|
|
|
|
+ rtn.sorderid = input.sorderId;
|
|
|
|
|
+ if (sorders[0].order_type.GetValueOrDefault() == 1)
|
|
|
|
|
+ {
|
|
|
|
|
+ _CalcBomViewAppService.morder_type = MorderEnum.XsMorder;
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ _CalcBomViewAppService.morder_type = MorderEnum.JhMorder;
|
|
|
|
|
+ }
|
|
|
|
|
+ _CalcBomViewAppService.param = param;
|
|
|
|
|
+ //_CalcBomViewAppService.IsStraight = true;
|
|
|
|
|
+ _CalcBomViewAppService.seorder = sorders[0];//销售订单
|
|
|
|
|
+ //资源检查明细list
|
|
|
|
|
+ List<ExamineResult> examines = new List<ExamineResult>();
|
|
|
|
|
+ ExamineResult dtl;
|
|
|
|
|
+ //查询对应工单
|
|
|
|
|
+ List<mes_moentry> mo_Mes_Moentries = _mysql_mes_moentry.GetListAsync(x => sentrys.Select(s=>s.Id).ToList().Contains(x.soentry_id.GetValueOrDefault())).Result;
|
|
|
|
|
+ List<mes_morder> mo_Mes_Morders = _mysql_mes_morder.GetListAsync(a => mo_Mes_Moentries.Select(s=>s.moentry_mono).ToList().Contains(a.morder_no)).Result;
|
|
|
|
|
+ //对比物料、数量、交期等信息是否有变更
|
|
|
|
|
+ for (int i = 0; i < sentrys.Count; i++)
|
|
|
|
|
+ {
|
|
|
|
|
+ var curmoen = mo_Mes_Moentries.Find(x => x.soentry_id == sentrys[i].Id);
|
|
|
|
|
+ var curmo = mo_Mes_Morders.Find(a => a.morder_no == curmoen.moentry_mono);
|
|
|
|
|
+ if (curmo.product_code != sentrys[i].item_number)
|
|
|
|
|
+ {
|
|
|
|
|
+ return "此订单行的物料信息有变更无法重排";
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ //处理订单行优先级
|
|
|
|
|
+ sentrys = _priorityAppService.CalcOrderEntryPriority(sorders, sentrys);
|
|
|
|
|
+
|
|
|
|
|
+ //删除同步Mysql后旧数据
|
|
|
|
|
+ await DeleteMySqlOldData(sentrys);
|
|
|
|
|
+
|
|
|
|
|
+ //通过订单行的产品代码获取物料BOM数据
|
|
|
|
|
+ List<mo_ic_bom> boms = _ic_bom.GetListAsync(p => sentrys.Select(m => m.item_number).Contains(p.item_number) && p.tenant_id == input.factoryId && p.company_id == input.company_id && !p.IsDeleted).Result.ToList();
|
|
|
|
|
+ //物料信息
|
|
|
|
|
+ //List<mo_ic_item> icitemlist = _ic_item.GetListAsync(p => sentrys.Select(m => m.item_number).Contains(p.number) && !p.IsDeleted).Result;
|
|
|
|
|
+ //物料信息
|
|
|
|
|
+ List<mo_ic_item> icitemlist = new List<mo_ic_item>();
|
|
|
|
|
+ //物料库存表
|
|
|
|
|
+ List<mo_ic_item_stock> stocklist = new List<mo_ic_item_stock>();
|
|
|
|
|
+ //物料占用记录
|
|
|
|
|
+ List<mo_ic_item_stockoccupy> sklist = new List<mo_ic_item_stockoccupy>();
|
|
|
|
|
+
|
|
|
|
|
+ var pretreatments = _mysql_b_bom_pretreatment.GetListAsync(s => boms.Select(c => c.mysql_id).ToList().Contains(s.sourceid)).Result;
|
|
|
|
|
+ List<mo_ic_bom> autoCreates = new List<mo_ic_bom>();
|
|
|
|
|
+ boms.ForEach(p =>
|
|
|
|
|
+ {
|
|
|
|
|
+ if (!pretreatments.Where(s => s.sourceid == p.mysql_id).Any())
|
|
|
|
|
+ {
|
|
|
|
|
+ autoCreates.Add(p);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ if (autoCreates.Any() || !boms.Any() || icitemlist.Count != boms.Count)
|
|
|
|
|
+ {
|
|
|
|
|
+ AutoCreateBomBill(param.company_id.ToString(), autoCreates);
|
|
|
|
|
+ pretreatments = _mysql_b_bom_pretreatment.GetListAsync(s => boms.Select(c => c.mysql_id).ToList().Contains(s.sourceid)).Result;
|
|
|
|
|
+ sentrys.ForEach(s => {
|
|
|
|
|
+ if (!pretreatments.Where(p => p.bom_number == s.item_number).Any())
|
|
|
|
|
+ {
|
|
|
|
|
+ var curicitem = icitemlist.Find(c => c.number == s.item_number);
|
|
|
|
|
+ //bom未生成
|
|
|
|
|
+ var fid = help.NextId();
|
|
|
|
|
+ b_bom_pretreatment bomChildExamineDto = new b_bom_pretreatment();
|
|
|
|
|
+ bomChildExamineDto.fid = fid;
|
|
|
|
|
+ bomChildExamineDto.bom_child_id = null;
|
|
|
|
|
+ bomChildExamineDto.bom_id = null;
|
|
|
|
|
+ bomChildExamineDto.bom_number = s.item_number;
|
|
|
|
|
+ bomChildExamineDto.qty = 1;
|
|
|
|
|
+ bomChildExamineDto.erp_cls = curicitem == null ? 1 : curicitem.erp_cls.GetValueOrDefault();
|
|
|
|
|
+ bomChildExamineDto.item_id = curicitem == null ? 0 : curicitem.mysql_id;
|
|
|
|
|
+ bomChildExamineDto.item_name = curicitem == null ? "" : curicitem.name;
|
|
|
|
|
+ bomChildExamineDto.item_number = s.item_number;
|
|
|
|
|
+ bomChildExamineDto.level = 1;
|
|
|
|
|
+ bomChildExamineDto.model = curicitem == null ? "" : curicitem.model;
|
|
|
|
|
+ bomChildExamineDto.unit = curicitem == null ? "" : curicitem.unit;
|
|
|
|
|
+ bomChildExamineDto.num = "1";
|
|
|
|
|
+ bomChildExamineDto.parent_id = 0;
|
|
|
|
|
+ bomChildExamineDto.type = 0;
|
|
|
|
|
+ bomChildExamineDto.PurLT = curicitem == null ? 0 : curicitem.PurLT;
|
|
|
|
|
+ bomChildExamineDto.clean_leadtime = curicitem == null ? 0 : curicitem.clean_leadtime;
|
|
|
|
|
+ bomChildExamineDto.BOMDesignTime = curicitem == null ? 0 : curicitem.BOMDesignTime;
|
|
|
|
|
+ bomChildExamineDto.RoutingDesignTime = curicitem == null ? 0 : curicitem.RoutingDesignTime;
|
|
|
|
|
+ pretreatments.Add(bomChildExamineDto);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ await AsyncItemStockFromWMS(pretreatments);
|
|
|
|
|
+
|
|
|
|
|
+ //数据库快照-同步mysql库数据到mongoDB中
|
|
|
|
|
+ await DbSnapShot(input.company_id, input.factoryId, bangid, pretreatments);
|
|
|
|
|
+
|
|
|
|
|
+ //记录订单行的物料齐套时间
|
|
|
|
|
+ List<KittingTimeDto> kittingTimes = new List<KittingTimeDto>();
|
|
|
|
|
+ DataInitialization(boms, bangid, icitemlist, stocklist, pretreatments, sklist);
|
|
|
|
|
+
|
|
|
|
|
+ List<string> GenerateMoList = new List<string>();
|
|
|
|
|
+ var moNbrlistDto = _serialNumberAppService.GetBillNo(input.factoryId.ToString(), "M5", sentrys.Count, "", 1);
|
|
|
|
|
+ if (moNbrlistDto.Any())
|
|
|
|
|
+ {
|
|
|
|
|
+ foreach (var nbr in moNbrlistDto)
|
|
|
|
|
+ {
|
|
|
|
|
+ GenerateMoList.Add(nbr.NbrResult);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ _CalcBomViewAppService.GenerateMoList = GenerateMoList;
|
|
|
|
|
+ foreach (var item in sentrys)
|
|
|
|
|
+ {
|
|
|
|
|
+ //工单资源检查信息
|
|
|
|
|
+ dtl = new ExamineResult();
|
|
|
|
|
+ dtl.sorderid = sorders[0].Id;
|
|
|
|
|
+ dtl.bill_no = sorders[0].bill_no;
|
|
|
|
|
+ dtl.sentry_id = item.Id;
|
|
|
|
|
+ dtl.entry_seq = item.entry_seq;
|
|
|
|
|
+ dtl.need_qty = item.qty.GetValueOrDefault();
|
|
|
|
|
+ dtl.need_time = item.plan_date;
|
|
|
|
|
+ dtl.bangid = bangid;
|
|
|
|
|
+ dtl.prd_code = item.item_number;
|
|
|
|
|
+
|
|
|
|
|
+ var bomlist = boms.Where(p => p.item_number == item.item_number).ToList();
|
|
|
|
|
+ List<BomChildExamineDto> getBomList = new List<BomChildExamineDto>();
|
|
|
|
|
+ if (bomlist.Count == 1)
|
|
|
|
|
+ {
|
|
|
|
|
+ //获取当前物料bom数据
|
|
|
|
|
+ var childBom = boms.Where(p => p.item_number == item.item_number).FirstOrDefault();
|
|
|
|
|
+
|
|
|
|
|
+ dtl.bom_number = childBom.bom_number;
|
|
|
|
|
+
|
|
|
|
|
+ var itemPrelist = pretreatments.Where(s => s.sourceid == childBom.mysql_id).ToList();
|
|
|
|
|
+ if (!itemPrelist.Any())
|
|
|
|
|
+ {
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ getBomList = ObjectMapper.Map<List<b_bom_pretreatment>, List<BomChildExamineDto>>(itemPrelist);
|
|
|
|
|
+
|
|
|
|
|
+ getBomList.ForEach(s => s.sentry_id = item.Id);
|
|
|
|
|
+ //库存初始化
|
|
|
|
|
+ _CalcBomViewAppService.BomStock(getBomList, stocklist, bangid);
|
|
|
|
|
+ _CalcBomViewAppService.newStockOccList = new List<mo_ic_item_stockoccupy>();
|
|
|
|
|
+
|
|
|
|
|
+ //计算
|
|
|
|
|
+ _CalcBomViewAppService.CalcView(getBomList, bangid, item.qty.GetValueOrDefault(), item.plan_date, sklist, item, icitemlist);
|
|
|
|
|
+ //TODO:最晚开始时间
|
|
|
|
|
+ var curFacDtl = leadTimeList.FirstOrDefault(p => p.item_id == childBom.icitem_id);
|
|
|
|
|
+ //最晚开工时间=订单行客户要求交期-运输提前期-库存提前期-生产提前期-下单提前期-生产时间
|
|
|
|
|
+ dtl.latest_times = item.plan_date.GetValueOrDefault().AddDays(-Convert.ToDouble(curFacDtl?.transportation_leadtime.GetValueOrDefault() + curFacDtl?.stock_leadtime.GetValueOrDefault() + curFacDtl?.production_leadtime.GetValueOrDefault() + curFacDtl?.order_leadtime.GetValueOrDefault() + _CalcBomViewAppService.ProductionTimeDay));
|
|
|
|
|
+ //物料齐套时间
|
|
|
|
|
+ dtl.kitting_times = getBomList.Where(p => p.is_use).OrderByDescending(m => m.kitting_time).First().kitting_time.GetValueOrDefault();
|
|
|
|
|
+ //TODO:最早开始时间默认3天后(后期调整,因为要计算排产,计算产能这一类,才能得到开工时间)
|
|
|
|
|
+ dtl.earliest_times = dtl.kitting_times.AddDays(1);
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ dtl.bom_number = item.item_number;
|
|
|
|
|
+ var curicitem = icitemlist.Find(c => c.number == item.item_number);
|
|
|
|
|
+ // TODO:最晚开始时间
|
|
|
|
|
+ var curFacDtl = leadTimeList.FirstOrDefault(p => p.item_id == curicitem.mysql_id);
|
|
|
|
|
+ var itemPrelist = pretreatments.Where(s => s.bom_number == item.item_number).ToList();
|
|
|
|
|
+ getBomList = ObjectMapper.Map<List<b_bom_pretreatment>, List<BomChildExamineDto>>(itemPrelist);
|
|
|
|
|
+ //库存初始化
|
|
|
|
|
+ _CalcBomViewAppService.BomStock(getBomList, stocklist, bangid);
|
|
|
|
|
+
|
|
|
|
|
+ //生成主工单
|
|
|
|
|
+ GenerateMorderDto generateMorderDto = new GenerateMorderDto()
|
|
|
|
|
+ {
|
|
|
|
|
+ seorderentry = item,
|
|
|
|
|
+ seorder = sorders[0],
|
|
|
|
|
+ ic_Item = curicitem,
|
|
|
|
|
+ BomNumber = item.item_number,
|
|
|
|
|
+ version = getBomList[0].version,
|
|
|
|
|
+ number = item.item_number,
|
|
|
|
|
+ Quantity = item.qty.GetValueOrDefault(),
|
|
|
|
|
+ morder_type = _CalcBomViewAppService.morder_type,
|
|
|
|
|
+ work_order_type = MorderEnum.CgMorder,
|
|
|
|
|
+ morder_state = MorderEnum.Initial_state,//MorderEnum.Initial_state,按要求,变成未发布工单,在周计划发布那里发布工单
|
|
|
|
|
+ bang_id = bangid,
|
|
|
|
|
+ morder_no = GenerateMoList[0]
|
|
|
|
|
+ };
|
|
|
|
|
+ _CalcBomViewAppService.CreateMainOrder(generateMorderDto, getBomList[0], new List<BomChildExamineDto>(), new List<BomChildExamineDto>(), bangid, item.plan_date.GetValueOrDefault(), sklist, item, icitemlist, Convert.ToInt32(getBomList[0].RoutingDesignTime.GetValueOrDefault() == 0 ? 1 : getBomList[0].RoutingDesignTime.GetValueOrDefault()));
|
|
|
|
|
+
|
|
|
|
|
+ //最晚开工时间=订单行客户要求交期-运输提前期-库存提前期-生产提前期-下单提前期-生产时间
|
|
|
|
|
+ dtl.latest_times = item.plan_date.GetValueOrDefault().AddDays(-Convert.ToDouble(curFacDtl?.transportation_leadtime.GetValueOrDefault() + curFacDtl?.stock_leadtime.GetValueOrDefault() + curFacDtl?.production_leadtime.GetValueOrDefault() + curFacDtl?.order_leadtime.GetValueOrDefault() + _CalcBomViewAppService.ProductionTimeDay));
|
|
|
|
|
+ //物料齐套时间
|
|
|
|
|
+ dtl.kitting_times = dtl.latest_times.AddDays(Convert.ToDouble(getBomList[0].BOMDesignTime.GetValueOrDefault() + getBomList[0].PurLT));
|
|
|
|
|
+ //TODO:最早开始时间默认3天后(后期调整,因为要计算排产,计算产能这一类,才能得到开工时间)
|
|
|
|
|
+ dtl.earliest_times = dtl.kitting_times.AddDays(1);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //再评审状态改为确认
|
|
|
|
|
+ item.progress = item.progress == "0" ? "3" : "2";
|
|
|
|
|
+ //替代关系展开list
|
|
|
|
|
+ dtl.BomChildExamineList = getBomList;
|
|
|
|
|
+ //添加订单行开工信息
|
|
|
|
|
+ examines.Add(dtl);
|
|
|
|
|
+
|
|
|
|
|
+ //记录订单行的建议交期
|
|
|
|
|
+ KittingTimeDto dto = new KittingTimeDto();
|
|
|
|
|
+ dto.sentry_id = item.Id;
|
|
|
|
|
+ dto.ItemNum = item.item_number;
|
|
|
|
|
+ dto.LackQty = getBomList.First(p => p.level == 1).lack_qty;
|
|
|
|
|
+ dto.kitting_time = dtl.kitting_times;
|
|
|
|
|
+ kittingTimes.Add(dto);
|
|
|
|
|
+ }
|
|
|
|
|
+ //计算订单行的建议交期(产能/物料)
|
|
|
|
|
+ CalcSuggestDate(sentrys, kittingTimes, icitemlist);
|
|
|
|
|
+ rtn.mordersList = _CalcBomViewAppService.mordersInsertList;
|
|
|
|
|
+ examines.ForEach(async p => {
|
|
|
|
|
+ var sent = sentrys.Find(s => s.Id == p.sentry_id);
|
|
|
|
|
+ if (sent != null)
|
|
|
|
|
+ {
|
|
|
|
|
+ p.sys_material_date = sent.sys_material_date;
|
|
|
|
|
+ p.sys_capacity_date = sent.sys_capacity_date;
|
|
|
|
|
+ }
|
|
|
|
|
+ var moen = _CalcBomViewAppService.moentriesInsertList.Find(m => m.soentry_id == p.sentry_id);
|
|
|
|
|
+ var morder= _CalcBomViewAppService.mordersInsertList.Find(m => m.morder_no == moen.moentry_mono);
|
|
|
|
|
+ var dbmoen= mo_Mes_Moentries.Find(m => m.soentry_id == p.sentry_id);
|
|
|
|
|
+ var dbmorder= mo_Mes_Morders.Find(m => m.morder_no == dbmoen.moentry_mono);
|
|
|
|
|
+ if (morder != null && dbmorder != null)
|
|
|
|
|
+ {
|
|
|
|
|
+ //刷新工单信息
|
|
|
|
|
+ await WorkOrdUpdateByNo(dbmorder.morder_no, morder.need_number.GetValueOrDefault().ToString(), morder.moentry_sys_stime.ToString(), null, dbmorder.tenant_id.ToString(), "Admin");
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ //检查结果写入数据库
|
|
|
|
|
+ await ExamineResultInsertDBAsync(examines);
|
|
|
|
|
+ //清空快照数据
|
|
|
|
|
+ await ClearSnapShot(bangid);
|
|
|
|
|
+ //生成日计划,工单资源检查
|
|
|
|
|
+ await ProductionSchedule(input.factoryId.ToString());
|
|
|
|
|
+ //生成物料需求
|
|
|
|
|
+ await CreateDemandSchedule(input.factoryId.ToString());
|
|
|
|
|
+ //生成交货单,不足补充采购申请
|
|
|
|
|
+ await _replenishmentAppService.CreateDeliverySchedule(input.factoryId.ToString(),"Admin");
|
|
|
|
|
+ //生成采购订单
|
|
|
|
|
+ await AutoTransferDoOrPo(input.factoryId.ToString());
|
|
|
|
|
+
|
|
|
|
|
+ return "ok";
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public async Task ExamineResultInsertDBAsync(List<ExamineResult> examines)
|
|
public async Task ExamineResultInsertDBAsync(List<ExamineResult> examines)
|
|
|
{
|
|
{
|
|
|
//检查结果写入数据库
|
|
//检查结果写入数据库
|
|
@@ -7673,14 +7965,13 @@ namespace Business.ResourceExamineManagement
|
|
|
return "数量不正确,请检查";
|
|
return "数量不正确,请检查";
|
|
|
if (string.IsNullOrEmpty(instockdate))
|
|
if (string.IsNullOrEmpty(instockdate))
|
|
|
return "工单开工日期不正确,请检查";
|
|
return "工单开工日期不正确,请检查";
|
|
|
- if (string.IsNullOrEmpty(priority))
|
|
|
|
|
|
|
+ if (string.IsNullOrEmpty(priority) && userAccount!="Admin")
|
|
|
return "优先级不正确,请检查";
|
|
return "优先级不正确,请检查";
|
|
|
if (string.IsNullOrEmpty(workord))
|
|
if (string.IsNullOrEmpty(workord))
|
|
|
return "工单号为空,请检查";
|
|
return "工单号为空,请检查";
|
|
|
try
|
|
try
|
|
|
{
|
|
{
|
|
|
- //先执行工单数量、优先级、开工日期、完工日期的修改
|
|
|
|
|
- decimal newpriority = Convert.ToDecimal(priority);
|
|
|
|
|
|
|
+
|
|
|
DateTime newinstockdate = Convert.ToDateTime(instockdate);
|
|
DateTime newinstockdate = Convert.ToDateTime(instockdate);
|
|
|
decimal newqty = Convert.ToDecimal(qty);
|
|
decimal newqty = Convert.ToDecimal(qty);
|
|
|
WorkOrdMaster work = null;
|
|
WorkOrdMaster work = null;
|
|
@@ -7692,6 +7983,9 @@ namespace Business.ResourceExamineManagement
|
|
|
if (work == null)
|
|
if (work == null)
|
|
|
return "未查找到对应工单,请刷新界面重试。";
|
|
return "未查找到对应工单,请刷新界面重试。";
|
|
|
|
|
|
|
|
|
|
+ //先执行工单数量、优先级、开工日期、完工日期的修改
|
|
|
|
|
+ decimal newpriority = string.IsNullOrEmpty(priority) && userAccount == "Admin" ? work.Priority : Convert.ToDecimal(priority);
|
|
|
|
|
+
|
|
|
TimeSpan difference = newinstockdate.Subtract(work.OrdDate.GetValueOrDefault());
|
|
TimeSpan difference = newinstockdate.Subtract(work.OrdDate.GetValueOrDefault());
|
|
|
int daysDifference = difference.Days;
|
|
int daysDifference = difference.Days;
|
|
|
work.OrdDate = newinstockdate;
|
|
work.OrdDate = newinstockdate;
|