tangdi il y a 3 ans
Parent
commit
ea4e5550ec

+ 9 - 54
MicroServices/Business/Business.Application.Contracts/ResourceExamineManagement/Dto/BomChildExamineDto.cs

@@ -47,7 +47,7 @@ namespace Business.ResourceExamineManagement.Dto
         /// <summary>
         /// 订单行ID
         /// </summary>
-        public long order_id { get; set; }
+        public long sentry_id { get; set; }
 
         /// <summary>
         /// BOMid
@@ -55,7 +55,7 @@ namespace Business.ResourceExamineManagement.Dto
         public long? bom_id { get; set; }
 
         /// <summary>
-        /// 
+        /// 项次
         /// </summary>
         public string num { get; set; }
 
@@ -74,11 +74,6 @@ namespace Business.ResourceExamineManagement.Dto
         /// </summary>
         public long item_id { get; set; }
 
-        /// <summary>
-        /// 物料编码
-        /// </summary>
-        public string item_code { get; set; }
-
         /// <summary>
         /// 物料名称
         /// </summary>
@@ -89,11 +84,6 @@ namespace Business.ResourceExamineManagement.Dto
         /// </summary>
         public string model { get; set; }
 
-        /// <summary>
-        /// 物料状态
-        /// </summary>
-        public string item_state { get; set; }
-
         /// <summary>
         /// 单位
         /// </summary>
@@ -119,31 +109,11 @@ namespace Business.ResourceExamineManagement.Dto
         /// </summary>
         public decimal qty { get; set; }
 
-        /// <summary>
-        /// 订单需求数量
-        /// </summary>
-        public decimal order_qty { get; set; }
-
         /// <summary>
         /// 库存数量
         /// </summary>
         public decimal sqty { get; set; }
 
-        /// <summary>
-        /// 基于物料可制造数量
-        /// </summary>
-        public decimal can_make_qty { get; set; }
-
-        /// <summary>
-        /// PR
-        /// </summary>
-        public decimal pr_qty { get; set; }
-
-        /// <summary>
-        /// PO
-        /// </summary>
-        public decimal po_qty { get; set; }
-
         /// <summary>
         /// 缺料数量
         /// </summary>
@@ -162,7 +132,7 @@ namespace Business.ResourceExamineManagement.Dto
         /// <summary>
         /// 委外数量
         /// </summary>
-        public decimal Subcontracting_qty { get; set; }
+        public decimal subcontracting_qty { get; set; }
 
         /// <summary>
         /// 齐套时间
@@ -174,7 +144,7 @@ namespace Business.ResourceExamineManagement.Dto
         /// </summary>
         public DateTime? satisfy_time { get; set; }
 
-        /// <summary>
+        /*/// <summary>
         /// 计划员
         /// </summary>
         public string plan_user { get; set; }
@@ -187,7 +157,7 @@ namespace Business.ResourceExamineManagement.Dto
         /// <summary>
         /// 来源
         /// </summary>
-        public string source { get; set; }
+        public string source { get; set; }*/
 
         /// <summary>
         /// 是否BOM
@@ -219,10 +189,10 @@ namespace Business.ResourceExamineManagement.Dto
         /// </summary>
         public int substitute_all_num { get; set; }
 
-        /// <summary>
+        /*/// <summary>
         /// 替代数量
         /// </summary>
-        public decimal replace_amount { get; set; }
+        public decimal replace_amount { get; set; }*/
 
         /// <summary>
         /// 替代策略
@@ -239,7 +209,7 @@ namespace Business.ResourceExamineManagement.Dto
         /// </summary>
         public int stock_state { get; set; }
 
-        /// <summary>
+        /*/// <summary>
         /// 物料状态--0.缺料 1.充足 2.可制,时间满足 3.可制,时间不满足 4.采购 5.委外
         /// </summary>
         public int group_state { get; set; }
@@ -254,7 +224,7 @@ namespace Business.ResourceExamineManagement.Dto
         /// </summary>
         public decimal kz { get; set; }
 
-        /*/// <summary>
+        /// <summary>
         /// 产品缺量
         /// </summary>
         public decimal lack { get; set; }*/
@@ -274,24 +244,9 @@ namespace Business.ResourceExamineManagement.Dto
         /// </summary>
         public decimal mo_qty { get; set; }
 
-        /// <summary>
-        /// 被父级可制占用,为了实现占用计算
-        /// </summary>
-        public decimal use_ParentItemOccupy { get; set; }
-
-        /// <summary>
-        /// 是否显示
-        /// </summary>
-        public bool is_show { get; set; }
-
         /// <summary>
         /// 是否使用此物料
         /// </summary>
         public bool is_use { get; set; }
-
-        /// <summary>
-        /// 计算时使用
-        /// </summary>
-        public decimal calc_use { get; set; }
     }
 }

+ 14 - 0
MicroServices/Business/Business.Application.Contracts/ResourceExamineManagement/Dto/PschedDto.cs

@@ -38,6 +38,20 @@ namespace Business.ResourceExamineManagement.Dto
         /// 委外订单
         /// </summary>
         public List<mo_mes_oorder> order_list { get; set; }
+
+        /// <summary>
+        /// 在制工单占用记录
+        /// </summary>
+        public List<mo_mes_mooccupy> mooccupyAllList { get; set; }
+
+        /// <summary>
+        /// 主工单记录
+        /// </summary>
+        public List<mo_mes_morder> mordersList { get; set; }
+        /// <summary>
+        /// 子工单记录
+        /// </summary>
+        public List<mo_mes_moentry> moentriesList { get; set; }
     }
 
     /// <summary>

+ 9 - 0
MicroServices/Business/Business.Application.Contracts/ResourceExamineManagement/Dto/SRMPRDto.cs

@@ -14,5 +14,14 @@ namespace Business.ResourceExamineManagement.Dto
         public DateTime lastStartTmie { get; set; }
 
         public mo_srm_pr_main srm_Pr_Main { get; set; }
+
+        /// <summary>
+        /// 项次号
+        /// </summary>
+        public string item_no { get; set; }
+        /// <summary>
+        /// 订单行主键
+        /// </summary>
+        public long orderentry_id { get; set; }
     }
 }

+ 5 - 0
MicroServices/Business/Business.Application/ResourceExamineManagement/CalcBomViewAppService.cs

@@ -391,6 +391,7 @@ namespace Business.ResourceExamineManagement
                             factoryId = param.factoryId
 
                         };
+                        item.make_qty = item.lack_qty;
                         var minute = _productExamineAppService.ProductiveExamine(prodExamine);
                         //系统建议完工日期为 开工日期+产能检查时间=完工日期
                         var Day = minute.Result / (60 * 10); //返回的分钟除以十个小时得出工作天数;
@@ -403,6 +404,7 @@ namespace Business.ResourceExamineManagement
                 {
                     //采购申请
                     var SRMPRDto = CreateSRMPR(item, input.tenantId, input.factoryId, bangid, item.erp_cls, leadTimeList, supplierList, planList, plan_date.Value);
+                    item.purchase_qty = item.lack_qty;
                     item.kitting_time = SRMPRDto.lastStartTmie;
                     SRMPRDtoList.Add(SRMPRDto);
                 }
@@ -416,6 +418,7 @@ namespace Business.ResourceExamineManagement
                     }
                     //1.先生成委外工单。
                     var mesorder = CreateMesOOder(item, input.tenantId, input.factoryId, bangid, leadTimeList, supplierList, plan_date.Value);
+                    item.subcontracting_qty = item.lack_qty;
                     item.kitting_time = mesorder.ooentry_etime;
                     orderList.Add(mesorder);
                 }
@@ -804,6 +807,8 @@ namespace Business.ResourceExamineManagement
             decimal? totalLeadTime = leadTime.transportation_leadtime + leadTime.stock_leadtime + leadTime.production_leadtime + leadTime.order_leadtime;
 
             sRMPR.srm_Pr_Main = srm_Pr;
+            sRMPR.item_no = returnlist.num;
+            sRMPR.orderentry_id = returnlist.sentry_id;
             sRMPR.lastStartTmie = deliveryDate.AddDays((double)totalLeadTime * -1);//减去提前期
             return sRMPR;
         }

+ 4 - 5
MicroServices/Business/Business.Application/ResourceExamineManagement/PretreatmentAppService.cs

@@ -89,14 +89,13 @@ namespace Business.ResourceExamineManagement
                 return;
             }
             dto.item_id = item.mysql_id;
-            dto.item_name = bom.item_name;
-            dto.item_code = bom.item_number;
+            dto.item_name = item.name;
+            dto.item_number = item.number;
             dto.model = item.model;
             dto.unit = bom.unit;
             dto.erp_cls = item.erp_cls;
             dto.erp_cls_name = item.erp_cls_name;
             dto.type = type;
-            dto.item_number = item.number;
 
             //var bdto = ObjectMapper.Map<ic_bom,BomChildExamineDto>(bom);
             returnlist.Add(dto);
@@ -146,7 +145,7 @@ namespace Business.ResourceExamineManagement
                         childDto.parent_id = dto.id;
                         childDto.item_id = icitem.mysql_id;
                         childDto.item_name = icitem.name;
-                        childDto.item_code = icitem.number;
+                        childDto.item_number = icitem.number;
                         childDto.num = childNum;
                         childDto.num_order = order_num;
                         childDto.model = icitem.model;
@@ -271,7 +270,7 @@ namespace Business.ResourceExamineManagement
             dto.parent_id = toDto.parent_id;
             dto.item_id = icitem.mysql_id;
             dto.item_name = icitem.name;
-            dto.item_code = icitem.number;
+            dto.item_number = icitem.number;
             dto.num = toDto.num;
             dto.num_order = toDto.num_order;
             dto.model = icitem.model;

+ 4 - 2
MicroServices/Business/Business.Application/ResourceExamineManagement/ProductExamineAppService.cs

@@ -88,14 +88,16 @@ namespace Business.ResourceExamineManagement
             mo_mes_technique tech = _mes_technique.Find(p => p.bom == param.bom_number && p.bomver == param.version && p.tenant_id == param.tenantId && p.factory_id == param.factoryId && !p.IsDeleted).Result.FirstOrDefault();
             if (tech == null)
             {
-                throw new NotImplementedException("请先配置工艺路径!");
+                return param.packages * 100;
+                //throw new NotImplementedException("请先配置工艺路径!");
             }
 
             //1.2、获取工艺路径关联工序数据
             List<mo_mes_tech_process> tech_Processes = await _mes_tech_process.GetManyByCondition(p => p.tech_id == tech.mysql_id && p.tenant_id == param.tenantId && p.factory_id == param.factoryId && !p.IsDeleted);
             if (tech_Processes.Count == 0)
             {
-                throw new NotImplementedException("请先配置工序!");
+                return param.packages * 100;
+                //throw new NotImplementedException("请先配置工序!");
             }
 
             //1.3、获取当前工艺路径下的工序数据

+ 10 - 4
MicroServices/Business/Business.Application/ResourceExamineManagement/ResourceExamineAppService.cs

@@ -415,6 +415,7 @@ namespace Business.ResourceExamineManagement
             {
                 //工单资源检查信息
                 dtl = new ExamineResult();
+                dtl.sorderid = rtn.sorderid;
                 dtl.sentry_id = item.Id;
                 //TODO:最早开始时间默认3天后(后期调整)
                 dtl.earliest_times = DateTime.Now.Date.AddDays(3);
@@ -425,14 +426,14 @@ namespace Business.ResourceExamineManagement
                 var getBomList = _pretreatmentAppService.BomPretreatment(childBom.mysql_id, bomlist, bomchildlist, icitemlist);
                 //bom替代关系组装
                 _pretreatmentAppService.BomSubstitute(getBomList, bomlist, bomchildlist, icitemlist, sublist, suballlist, subdtllist);
+
+                getBomList.ForEach(s => s.sentry_id = item.Id);
                 //库存初始化
                 _CalcBomViewAppService.BomStock(getBomList, stocklist, bangid);
                 //计算
                 _CalcBomViewAppService.CalcView(getBomList, bangid, item.qty.Value, input, item.plan_date, sklist, item, icitemlist);
 
-                //批量保存 后期考虑子工单
-                await _mes_morder.InsertMany(_CalcBomViewAppService.mordersList);
-                await _mes_moentry.InsertMany(_CalcBomViewAppService.moentriesList);
+                
 
                 //TODO:最晚开始时间
                 var curFacDtl = leadTimeList.FirstOrDefault(p => p.item_id == childBom.icitem_id);
@@ -451,10 +452,15 @@ namespace Business.ResourceExamineManagement
             {
                 await _mes_mooccupy.InsertMany(_CalcBomViewAppService.mooccupyAllList);
             }
+            //批量保存 后期考虑子工单
+            await _mes_morder.InsertMany(_CalcBomViewAppService.mordersList);
+            await _mes_moentry.InsertMany(_CalcBomViewAppService.moentriesList);
 
-            //订单行资源检查明细list
+            rtn.mooccupyAllList = _CalcBomViewAppService.mooccupyAllList;
             rtn.srm_pr_list = _CalcBomViewAppService.SRMPRDtoList;
             rtn.order_list = _CalcBomViewAppService.orderList;
+            //订单行资源检查明细list
+            rtn.mordersList = _CalcBomViewAppService.mordersList;
             rtn.examines = examines;
             rtn.sklist = sklist;