Parcourir la source

产销性能修改

Murphy il y a 2 ans
Parent
commit
8b1379630e

+ 1 - 1
MicroServices/Business/Business.Application/DOP/SyncDOPAppService.cs

@@ -243,7 +243,7 @@ namespace Business.DOP
                 //工厂库存
                 var itemSap = ItemInvList.Find(b => b.MATNR == a.ItemNumber);
                 if(itemSap!=null)
-                    a.FactoryInv =itemSap.LABST.ToDecimal();
+                    a.FactoryInv =itemSap.LABST;
                 //国科库存
                 var platformInventoryGK=  platformInvList.Find(b => b.SpecificationModel == a.Model && b.Code== "HW0002");
                 if (platformInventoryGK != null)

+ 49 - 68
MicroServices/Business/Business.Application/ReplenishmentManagement/ReplenishmentAppService.cs

@@ -457,8 +457,7 @@ namespace Business.Replenishment
             var DMSItemList = _DMS_IN_ITEMMAPPING.Select(a => sapItemList.Contains(a.CfnERPCode));
             var gkhwStock = _DMS_IN_LOCDETAIL.Select(a => (a.DealerCode == "RQ000005" || a.DealerCode == "RQ000002"));
 
-            var sapInvList = _SAPInv.Select(a => a.WERKS == input.factory_id.ToString() && 
-            sapItemList.Contains(a.MATNR) && a.SOBKZ.ToUpper() == "O" && (a.LGORT== "5008" || a.LGORT== "5009" || a.LGORT== "5010" || a.LGORT== "8000" || a.LGORT == "8001"|| a.LGORT == "8002" || a.LGORT == "8003"|| a.LGORT == "8004"|| a.LGORT == "8005"));
+            var sapInvList = _SAPInv.Select(a => a.WERKS == input.factory_id.ToString() && sapItemList.Contains(a.MATNR) && (a.SOBKZ.ToUpper() == "O"));
             // 获取某年某月的起始日期和结束日期
             DateTime start = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
             DateTime end = start.AddMonths(1).AddDays(-1);
@@ -512,7 +511,7 @@ namespace Business.Replenishment
                 var prodLine = prodLines.Where(x => x.Part == yearDemands[i].SAPItemNumber).OrderBy(x => x.Sequence).FirstOrDefault();
                 //不同库位库存数量
                 //5008成品线边库,8001成品合格库,8000成品待检
-                var locationList = locations.Where(x => x.ItemNum == yearDemands[i].SAPItemNumber && (x.Location == "5008" || x.Location == "8000" || x.Location == "8001")).ToList();
+                var locationList = locations.Where(x => x.ItemNum == yearDemands[i].SAPItemNumber && (x.Location == "5008" || x.Location == "5009"|| x.Location == "5010" || x.Location == "8000" || x.Location == "8001"|| x.Location == "8002"|| x.Location == "8002"|| x.Location == "8003"|| x.Location == "8004"|| x.Location == "8005")).ToList();
                 //平台数据
                 decimal? hwStock = 0;
                 if (DMSItemList.Find(d => d.CfnERPCode == yearDemands[i].SAPItemNumber) != null)
@@ -552,7 +551,7 @@ namespace Business.Replenishment
                 decimal? InSterilizationQty = 0.00m;
                 if (sapInvList.Count > 0 && sapInvList.Any(a => a.MATNR == yearDemands[i].SAPItemNumber))
                 {
-                    InSterilizationQty = sapInvList.Where(a => a.MATNR == yearDemands[i].SAPItemNumber).Sum(x => Convert.ToDecimal(x.LABST) + Convert.ToDecimal(x.INSME) + Convert.ToDecimal(x.SPEME));
+                    InSterilizationQty = sapInvList.Where(a => a.MATNR == yearDemands[i].SAPItemNumber && a.SOBKZ.ToUpper()=="O").Sum(x => Convert.ToDecimal(x.LABST) + Convert.ToDecimal(x.INSME) + Convert.ToDecimal(x.SPEME));
                 }
                 var locationSum = (locationList.Count == 0 ? 0 : locationList.Sum(x => x.AvailStatusQty.GetValueOrDefault() + x.Assay.GetValueOrDefault())) + gkStock + hwStock + (ship.Count == 0 ? 0 : ship.Sum(x => x.QtyToShip)) + itemInProduct + InSterilizationQty;
                 //前面N个月的生产数量
@@ -707,8 +706,7 @@ namespace Business.Replenishment
             shipList.OrderBy(a => a.PlanMonth);
             var shipItemList= shipList.Select(a=>a.SAPItemNumber).Distinct().ToList();
             var ropPlan = _replenishmentROPWeekPlan.GetListAsync(x => shipItemList.Contains(x.number) && planMons.Contains(x.planmonth) && !x.IsDeleted && x.factory_id == input.factory_id).Result;
-            var sapInvList = _SAPInv.Select(a => a.WERKS == input.factory_id.ToString() &&
-            shipItemList.Contains(a.MATNR) && a.SOBKZ.ToUpper() == "O" && (a.LGORT == "5008" || a.LGORT == "5009" || a.LGORT == "5010" || a.LGORT == "8000" || a.LGORT == "8001" || a.LGORT == "8002" || a.LGORT == "8003" || a.LGORT == "8004" || a.LGORT == "8005"));
+            var sapInvList = _SAPInv.Select(a => a.WERKS == input.factory_id.ToString() && shipItemList.Contains(a.MATNR) && (a.SOBKZ.ToUpper() == "O"));
             foreach (var item in shipList)
             {
                 var ropItem = ropPlan.Find(x => x.number == item.SAPItemNumber);
@@ -806,9 +804,9 @@ namespace Business.Replenishment
                         plan.Inventory2 = 0;
                     }
                     decimal InSterilizationQty = 0.00m;
-                    if (sapInvList.Count > 0 && sapInvList.Any(a => a.MATNR == item.SAPItemNumber))
+                    if (sapInvList.Count > 0 && sapInvList.Any(a => a.MATNR == item.SAPItemNumber && a.SOBKZ.ToUpper() == "O"))
                     {
-                        InSterilizationQty = sapInvList.Where(a => a.MATNR == item.SAPItemNumber).Sum(x => Convert.ToDecimal(x.LABST) + Convert.ToDecimal(x.INSME) + Convert.ToDecimal(x.SPEME));
+                        InSterilizationQty = sapInvList.Where(a => a.MATNR == item.SAPItemNumber && a.SOBKZ.ToUpper()=="O").Sum(x => Convert.ToDecimal(x.LABST) + Convert.ToDecimal(x.INSME) + Convert.ToDecimal(x.SPEME));
                     }
                     plan.DuringSterilization = InSterilizationQty;
                     plan.InProduction = InProdcutQty.Find(a => a.ItemNumber == item.SAPItemNumber).Qty;
@@ -841,7 +839,7 @@ namespace Business.Replenishment
                 {
                     var planList = productionMasters.Select(a => a.PlanMonth).ToList();
                     await _productionMasterPlan.DeleteAsync(a => planList.Contains(a.PlanMonth) && a.factory_id == input.factory_id);
-                    await _productionMasterPlan.InsertManyAsync(productionMasters);
+                    await _businessDbContext.BulkInsertAsync(productionMasters);
                     await unitOfWork.CompleteAsync();
                 }
                 catch (Exception e)
@@ -1032,7 +1030,7 @@ namespace Business.Replenishment
             {
                 //库存合计 + 在制 + 灭菌中 (InvMaster没有过滤灭菌中状态可能已经算在可用库存中了)
                 //5008成品线边库,8001成品合格库,8000成品待检
-                if (item.Location == "5008" || item.Location == "8000" || item.Location == "8001")
+                if (item.Location == "5008"|| item.Location == "5009"|| item.Location == "5010" || item.Location == "8000" || item.Location == "8001"|| item.Location == "8002"|| item.Location == "8003"|| item.Location == "8004"|| item.Location == "8005")
                 {
                     if (dictItemStock.ContainsKey(item.ItemNum))
                     {
@@ -1977,7 +1975,7 @@ namespace Business.Replenishment
                     }
                     else if (middleItem > 0)
                     {
-                        itemQty = Math.Ceiling(Math.Ceiling(itemQty.GetValueOrDefault() / middleItem) * middleItem);
+                        itemQty = Math.Ceiling(Math.Ceiling(itemQty.GetValueOrDefault()/ (3*middleItem)) * middleItem);
                     }
                     if(!weeksubPlanList.Any(a=>a.ItemNumber== subProductItemModel[key].item_number && a.PlanMonth== kMonth))
                     {
@@ -2264,8 +2262,9 @@ namespace Business.Replenishment
                 priority++;
             }
             _workOrdMaster.Update(workMasters);
-            await _mysql_mes_morder.UpdateManyAsync(mes_Morders);
-            await _replenishmentWeekPlan.UpdateManyAsync(weekPlan);
+            await _businessDbContext.BulkUpdateAsync(mes_Morders);
+            await _businessDbContext.BulkUpdateAsync(weekPlan);
+      
             return "OK";
         }
 
@@ -2366,7 +2365,7 @@ namespace Business.Replenishment
             }
             if (updateList.Count > 0)
             {
-                await _replenishmentWeekPlan.UpdateManyAsync(updateList);
+                await _businessDbContext.BulkUpdateAsync(updateList);
                 List<WorkOrdMaster> itemUpdate = new List<WorkOrdMaster>();
                 List<WorkOrdDetail> itemDetailUpdate = new List<WorkOrdDetail>();
                 List<WorkOrdRouting> itemRoutingUpdate = new List<WorkOrdRouting>();
@@ -2415,8 +2414,8 @@ namespace Business.Replenishment
                 _workOrdMaster.Update(itemUpdate);
                 _workOrdDetail.Update(itemDetailUpdate);
                 _workOrdRouting.Update(itemRoutingUpdate);
-                await _mysql_mes_morder.UpdateManyAsync(itemMesmorderList);
-                await _mysql_mes_moentry.UpdateManyAsync(itemMesmorderEntryList);
+                await _businessDbContext.BulkUpdateAsync(itemMesmorderList);
+                await _businessDbContext.BulkUpdateAsync(itemMesmorderEntryList);
             }
 
             //补货
@@ -2447,7 +2446,7 @@ namespace Business.Replenishment
             });
             if (weekPlanAdd.Count > 0)
             {
-                await _replenishmentWeekPlan.UpdateManyAsync(weekPlanAdd);
+                await _businessDbContext.BulkInsertAsync(weekPlanAdd);
                 List<WorkOrdMaster> itemUpdate = new List<WorkOrdMaster>();
                 List<WorkOrdDetail> itemDetailUpdate = new List<WorkOrdDetail>();
                 List<WorkOrdRouting> itemRoutingUpdate = new List<WorkOrdRouting>();
@@ -2496,8 +2495,8 @@ namespace Business.Replenishment
                 _workOrdMaster.Update(itemUpdate);
                 _workOrdDetail.Update(itemDetailUpdate);
                 _workOrdRouting.Update(itemRoutingUpdate);
-                await _mysql_mes_morder.UpdateManyAsync(itemMesmorderList);
-                await _mysql_mes_moentry.UpdateManyAsync(itemMesmorderEntryList);
+                await _businessDbContext.BulkUpdateAsync(itemMesmorderList);
+                await _businessDbContext.BulkUpdateAsync(itemMesmorderEntryList);
             }
 
             //DOP运行资源检查每个原材料SKU的可用库存,当可用库存<=修正后ROP时,自动生成月度采购申请(Purchase request,PR46年月日4位流水号)=EOP;可用库存为没有被其他SO和PO占用的(合格原材料库存+在途库存);
@@ -2674,13 +2673,12 @@ namespace Business.Replenishment
                     }
                 }
             });
-            //await _mysql_srm_pr_main.DeleteManyAsync(prDeleteList);
-            await _mysql_srm_pr_main.UpdateManyAsync(prUpdateList);
+            await _businessDbContext.BulkUpdateAsync(prUpdateList);
             prList.ForEach(a =>
             {
                 a.GenerateNewId(help.NextId());
             });
-            await _mysql_srm_pr_main.InsertManyAsync(prList);
+            await _businessDbContext.BulkInsertAsync(prList);
             return "OK";
         }
 
@@ -3067,55 +3065,28 @@ namespace Business.Replenishment
         public List<EOPDto> CalcStock(List<string> itemNumbers,InputDto input)
         {
             List<EOPDto> itemQty = new List<EOPDto>();
-            var itemList=_mysql_ic_item.GetListAsync(a => itemNumbers.Contains(a.number) && a.factory_id == input.factory_id  && !a.IsDeleted).Result;
-            //获取成品库存、灭菌库存、在制库存(会从SAP同步的库存表更新到LocationDetail、ic_item表中)
             var locations = _invMaster.Select(p => p.Domain == input.factory_id.ToString() && itemNumbers.Contains(p.ItemNum) && p.IsActive);
-            var pooccupylist=_mysql_srm_po_occupy.GetListAsync(a => a.state == 1 && !a.IsDeleted && a.factory_id == input.factory_id ).Result;
-            var poList = _mysql_srm_po_list.GetListAsync(a=> pooccupylist.Select(p=>p.polist_id).ToList().Contains(a.Id) && pooccupylist.Select(p => p.polist_row).ToList().Contains(a.polist_row) && a.factory_id == input.factory_id  && !a.IsDeleted).Result;
-            var molist=_mysql_mes_morder.GetListAsync(a => itemNumbers.Contains(a.product_code) && a.factory_id == input.factory_id  && !a.IsDeleted).Result;
-            var proccupylist=_mysql_srm_pr_main_occupy.GetListAsync(a=> molist.Select(p=>p.morder_no).ToList().Contains(a.morder_mo) && a.factory_id == input.factory_id  && !a.IsDeleted).Result;
-
-            //TODO:完善占用逻辑
-            //srm_pr_main pr = new srm_pr_main();
-            //pr.state = 1;
-            //srm_po_main po = new srm_po_main();
-            ////po.state.GetValueOrDefault() != 3;
-            //srm_po_occupy srm_Po_Occupy = new srm_po_occupy();
-            ////srm_Po_Occupy.polist_id = pr.Id;po.id;
-
+            var sapInvList = _SAPInv.Select(a => a.WERKS == input.factory_id.ToString() && itemNumbers.Contains(a.MATNR) && (a.SOBKZ.ToUpper() == "O"));
+            var stockOccupyList = _mysql_ic_item_stockoccupy.GetListAsync(a=> itemNumbers.Contains(a.icitem_number) && a.factory_id == input.factory_id  && !a.IsDeleted).Result;
             itemNumbers.ForEach(a =>
             {
                 EOPDto eOPDto=new EOPDto();
                 eOPDto.ItemNumber = a;
                 decimal stockqty = 0;
-                if (locations.Find(s => s.ItemNum == a && (s.Location == "5008" || s.Location == "8000" || s.Location == "8001")) !=null)
+                if (locations.Any(s => s.ItemNum == a))
                 {
-                    stockqty = locations.Find(s => s.ItemNum == a && (s.Location == "5008" || s.Location == "8000" || s.Location == "8001")).AvailStatusQty.GetValueOrDefault();
+                    stockqty = locations.Where(s => s.ItemNum == a).Sum(x => x.AvailStatusQty.GetValueOrDefault());
                 }
-                decimal poOccupyQty = 0;
-                for(int i=0;i<pooccupylist.Count;i++)
+                decimal InSterilizationQty = 0;
+                if (sapInvList.Count > 0 && sapInvList.Any(s => s.MATNR ==a))
                 {
-                    for(int j=0;j<poList.Count;j++)
-                    {
-                        if (pooccupylist[i].polist_id== poList[j].Id && pooccupylist[i].polist_row == poList[j].polist_row && poList[j].ItemNum==a)
-                        {
-                            poOccupyQty += pooccupylist[i].qty.Value;
-                        }
-                    }
+                    InSterilizationQty = sapInvList.Where(s => s.MATNR == a && s.SOBKZ.ToUpper() == "O").Sum(x => Convert.ToDecimal(x.LABST) + Convert.ToDecimal(x.INSME) + Convert.ToDecimal(x.SPEME));
                 }
+                stockqty += InSterilizationQty;
 
-                decimal prOccupyQty = 0;
-                for (int i = 0; i < proccupylist.Count; i++)
-                {
-                    for (int j = 0; j < molist.Count; j++)
-                    {
-                        if (proccupylist[i].morder_mo == molist[j].morder_no  && molist[j].product_code == a)
-                        {
-                            prOccupyQty += proccupylist[i].qty.Value;
-                        }
-                    }
-                }
-                eOPDto.Qty = stockqty - poOccupyQty - prOccupyQty;
+                var occupyQty=stockOccupyList.Where(s => s.icitem_number == a).Sum(s => s.quantity);
+                stockqty -= occupyQty;
+                eOPDto.Qty = stockqty;
                 itemQty.Add(eOPDto);
             });
             return itemQty;
@@ -3746,13 +3717,11 @@ namespace Business.Replenishment
                 {
                     var moSrm_po_main = ObjectMapper.Map<List<srm_po_main>, List<mo_srm_po_main>>(srm_po_main);
                     moSrm_po_main.ForEach(item => { item.GenerateNewId(help.NextId()); item.bang_id = bangid; });
-                    //await _srm_po_main.InsertManyAsync(moSrm_po_main);
                     await MongoHelper<mo_srm_po_main>.InsertManyAsync(moSrm_po_main);
                     //订单明细--根据在途PO过滤出有效的Po_list
                     srm_po_list = srm_po_list.Where(s => srm_po_main.Select(x => x.Id).Contains(s.po_id.GetValueOrDefault())).ToList();
                     var moSrm_po_list = ObjectMapper.Map<List<srm_po_list>, List<mo_srm_po_list>>(srm_po_list);
                     moSrm_po_list.ForEach(item => { item.GenerateNewId(help.NextId()); item.bang_id = bangid; });
-                    //await _srm_po_list.InsertManyAsync(moSrm_po_list);
                     await MongoHelper<mo_srm_po_list>.InsertManyAsync(moSrm_po_list);
                 }
                 //采购订单明细占用详情
@@ -3761,7 +3730,6 @@ namespace Business.Replenishment
                 {
                     var moSrm_po_occupy = ObjectMapper.Map<List<srm_po_occupy>, List<mo_srm_po_occupy>>(srm_po_occupy);
                     moSrm_po_occupy.ForEach(item => { item.GenerateNewId(help.NextId()); item.bang_id = bangid; });
-                    //await _srm_po_occupy.InsertManyAsync(moSrm_po_occupy);
                     await MongoHelper<mo_srm_po_occupy>.InsertManyAsync(moSrm_po_occupy);
                 }
             }
@@ -3772,7 +3740,6 @@ namespace Business.Replenishment
             {
                 var moSrm_pr_main = ObjectMapper.Map<List<srm_pr_main>, List<mo_srm_pr_main>>(srm_pr_main);
                 moSrm_pr_main.ForEach(item => { item.GenerateNewId(help.NextId()); item.bang_id = bangid; });
-                //await _srm_pr_main.InsertManyAsync(moSrm_pr_main);
                 await MongoHelper<mo_srm_pr_main>.InsertManyAsync(moSrm_pr_main);
 
                 //采购申请占用详情
@@ -3782,7 +3749,6 @@ namespace Business.Replenishment
                 {
                     var moSrm_pr_occupy = ObjectMapper.Map<List<srm_po_occupy>, List<mo_srm_po_occupy>>(srm_pr_occupy);
                     moSrm_pr_occupy.ForEach(item => { item.GenerateNewId(help.NextId()); item.bang_id = bangid; });
-                    //await _srm_po_occupy.InsertManyAsync(moSrm_pr_occupy);
                     await MongoHelper<mo_srm_po_occupy>.InsertManyAsync(moSrm_pr_occupy);
                 }
             }
@@ -4098,8 +4064,6 @@ namespace Business.Replenishment
             if (addList.Any())
             {
                 _businessDbContext.BulkInsert(addList);
-
-                //await _mysql_b_bom_pretreatment.InsertManyAsync(addList);
             }
         }
 
@@ -4116,9 +4080,14 @@ namespace Business.Replenishment
                 input.year = DateTime.Now.Year;
                 input.month = DateTime.Now.Month;
             }
+            if (DateTime.Now.Month >= 10)
+            {
+                input.year = DateTime.Now.AddYears(1).Year;
+                input.month = DateTime.Now.Month;
+            }
             var ropParam = GetROPParam(input.factory_id.ToString());
             //获取滚动未来六个月数据
-            var monthlist = GetPlanMonth(6);
+            var monthlist = GetYearPlanMonth(input.year);
             var productList = _replenishmentAnnualProduction.GetListAsync(a => monthlist.Contains(a.PlanMonth) && !a.IsDeleted && a.factory_id == input.factory_id).Result.OrderBy(s=>s.OrderNum).ToList();
             var itemList= productList.Select(a=>a.SAPItemNumber).Distinct().ToList();
             var planList=_mysql_ic_item.GetListAsync(a=>itemList.Contains(a.number) && a.factory_id==input.factory_id && !a.IsDeleted).Result.ToList();
@@ -4479,6 +4448,18 @@ namespace Business.Replenishment
             }
             return result;
         }
+
+        public List<string> GetYearPlanMonth(int year)
+        {
+            List<string> result = new List<string>();
+            for (int i = 0; i < 12; i++)
+            {
+                var months = Convert.ToDateTime($"{year}-01-01");
+                months = months.AddMonths(i);
+                result.Add($"{months.Year}-{months.Month.ToString("00")}");
+            }
+            return result;
+        }
         /// <summary>
         /// 获取前面几个月PlanMonth
         /// </summary>

+ 1 - 1
MicroServices/Business/Business.Application/ResourceExamineManagement/CalcBomViewAppService.cs

@@ -1628,7 +1628,7 @@ namespace Business.ResourceExamineManagement
             srm_Pr.icitem_id = returnlist.item_id;//物料id
             srm_Pr.icitem_name = returnlist.item_name;//物料名称
             srm_Pr.num = returnlist.num;
-            if (plan_date != null && !IsStraight)
+            if (plan_date != null)
             {
                 //-1为提前一天准备
                 srm_Pr.pr_sarrive_date = plan_date.GetValueOrDefault().AddDays(-1 - (int)(Math.Ceiling(plan.clean_leadtime.GetValueOrDefault())));

+ 17 - 21
MicroServices/Business/Business.Application/ResourceExamineManagement/ResourceExamineAppService.cs

@@ -849,16 +849,16 @@ namespace Business.ResourceExamineManagement
                     }*/
                     if (_CalcBomViewAppService.mordersInsertList.Any())
                     {
-                        await _mes_morder.InsertManyAsync(_CalcBomViewAppService.mordersInsertList);
+                        await MongoHelper<mo_mes_morder>.InsertManyAsync(_CalcBomViewAppService.mordersInsertList);
                     }  
                     if (prmainlist.Any())
                     {
-                        await _srm_pr_main.InsertManyAsync(prmainlist);
+                        await MongoHelper<mo_srm_pr_main>.InsertManyAsync(prmainlist);
                     }
                     if (_CalcBomViewAppService.mooccupyAllInsertList.Any())
                     {
                         _CalcBomViewAppService.mooccupyAllInsertList.ForEach(s => { s.tenant_id = param.company_id.GetValueOrDefault(); s.company_id = param.company_id; s.factory_id = param.factoryId; });
-                        await _mes_mooccupy.InsertManyAsync(_CalcBomViewAppService.mooccupyAllInsertList);
+                        await MongoHelper<mo_mes_mooccupy>.InsertManyAsync(_CalcBomViewAppService.mooccupyAllInsertList);
                         /*var moOccupy = ObjectMapper.Map<List<mo_mes_mooccupy>, List<mes_mooccupy>>(_CalcBomViewAppService.mooccupyAllInsertList);
                         _businessDbContext.BulkInsert(moOccupy);*/
                         rtn.mooccupyAllList = _CalcBomViewAppService.mooccupyAllInsertList;
@@ -866,14 +866,14 @@ namespace Business.ResourceExamineManagement
                     if (_CalcBomViewAppService.moentriesInsertList.Any())
                     {
                         _CalcBomViewAppService.moentriesInsertList.ForEach(s => { s.tenant_id = param.company_id.GetValueOrDefault(); s.company_id = param.company_id; s.factory_id = param.factoryId; });
-                        await _mes_moentry.InsertManyAsync(_CalcBomViewAppService.moentriesInsertList);
+                        await MongoHelper<mo_mes_moentry>.InsertManyAsync(_CalcBomViewAppService.moentriesInsertList);
                         /*var mesmoentrys = ObjectMapper.Map<List<mo_mes_moentry>, List<mes_moentry>>(_CalcBomViewAppService.moentriesInsertList);
                         _businessDbContext.BulkInsert(mesmoentrys);*/
                     }
                     if (_CalcBomViewAppService.orderList.Any())
                     {
                         _CalcBomViewAppService.orderList.ForEach(s => { s.tenant_id = param.company_id.GetValueOrDefault(); s.company_id = param.company_id; s.factory_id = param.factoryId; });
-                        await _mes_oorder.InsertManyAsync(_CalcBomViewAppService.orderList);
+                        await MongoHelper<mo_mes_oorder>.InsertManyAsync(_CalcBomViewAppService.orderList);
                         /*var ooders = ObjectMapper.Map<List<mo_mes_oorder>, List<mes_oorder>>(_CalcBomViewAppService.orderList);
                         _businessDbContext.BulkInsert(ooders);*/
                         rtn.order_list = _CalcBomViewAppService.orderList;
@@ -881,12 +881,12 @@ namespace Business.ResourceExamineManagement
                     if (_CalcBomViewAppService.newStockOccList.Any())
                     {
                         _CalcBomViewAppService.newStockOccList.ForEach(s => { s.GenerateNewId(help.NextId()); s.tenant_id = param.company_id.GetValueOrDefault(); s.company_id = param.company_id; s.factory_id = param.factoryId; });
-                        await _ic_item_stockoccupy.InsertManyAsync(_CalcBomViewAppService.newStockOccList);
+                        await MongoHelper<mo_ic_item_stockoccupy>.InsertManyAsync(_CalcBomViewAppService.newStockOccList);
                     }
                     if (_CalcBomViewAppService.srm_Po_OccupiesInsert.Any())
                     {
                         _CalcBomViewAppService.srm_Po_OccupiesInsert.ForEach(s => { s.GenerateNewId(help.NextId()); s.tenant_id = param.company_id.GetValueOrDefault(); s.company_id = param.company_id; s.factory_id = param.factoryId; });
-                        await _srm_po_occupy.InsertManyAsync(_CalcBomViewAppService.srm_Po_OccupiesInsert);
+                        await MongoHelper<mo_srm_po_occupy>.InsertManyAsync(_CalcBomViewAppService.srm_Po_OccupiesInsert);
                         /*var poOccupies = ObjectMapper.Map<List<mo_srm_po_occupy>, List<srm_po_occupy>>(_CalcBomViewAppService.srm_Po_OccupiesInsert);
                         _businessDbContext.BulkInsert(poOccupies);*/
                     }
@@ -1017,7 +1017,6 @@ namespace Business.ResourceExamineManagement
                     }
                     if (bomExamineList.Any())
                     {
-                        //await _mysql_bom_child_examine.InsertManyAsync(bomExamineList);
                         _businessBangDbContext.BulkInsert(bomExamineList.OrderBy(s => s.num_order).ToList());
                     }
                     if (mooccupyList.Any())
@@ -1973,7 +1972,7 @@ namespace Business.ResourceExamineManagement
                 var moIcitemStokc = ObjectMapper.Map<List<ic_item_stock>, List<mo_ic_item_stock>>(icitemStokc);
                 moIcitemStokc.ForEach(item => { item.GenerateNewId(help.NextId()); });
                 //插入数据
-                await _ic_item_stock.InsertManyAsync(moIcitemStokc);
+                await MongoHelper<mo_ic_item_stock>.InsertManyAsync(moIcitemStokc);
             }
 
             var workordmsters = _workOrdMaster.Select(s => s.Domain == factoryId.ToString() && string.IsNullOrEmpty(s.Status) != true && s.Status.ToLower() != "c");
@@ -2012,7 +2011,7 @@ namespace Business.ResourceExamineManagement
                     {
                         var mo_item_occupy = ObjectMapper.Map<List<ic_item_stockoccupy>, List<mo_ic_item_stockoccupy>>(item_occupy);
                         mo_item_occupy.ForEach(item => { item.GenerateNewId(help.NextId()); item.bang_id = bangid; });
-                        await _ic_item_stockoccupy.InsertManyAsync(mo_item_occupy);
+                        await MongoHelper<mo_ic_item_stockoccupy>.InsertManyAsync(mo_item_occupy);
                     }
                 }
 
@@ -2023,7 +2022,7 @@ namespace Business.ResourceExamineManagement
                     mes_morder.ForEach(item => { item.bang_id = bangid; });
                     var moMes_morder = ObjectMapper.Map<List<mes_morder>, List<mo_mes_morder>>(mes_morder);
                     moMes_morder.ForEach(item => { item.GenerateNewId(help.NextId()); });
-                    await _mes_morder.InsertManyAsync(moMes_morder);
+                    await MongoHelper<mo_mes_morder>.InsertManyAsync(moMes_morder);
                 }
                 //工单子表
                 var mes_moentry = _mysql_mes_moentry.GetListAsync(x => x.company_id == companyId && x.factory_id == factoryId).Result;
@@ -2032,7 +2031,7 @@ namespace Business.ResourceExamineManagement
                     mes_moentry.ForEach(item => { item.bang_id = bangid; });
                     var moMes_moentry = ObjectMapper.Map<List<mes_moentry>, List<mo_mes_moentry>>(mes_moentry);
                     moMes_moentry.ForEach(item => { item.GenerateNewId(help.NextId()); });
-                    await _mes_moentry.InsertManyAsync(moMes_moentry);
+                    await MongoHelper<mo_mes_moentry>.InsertManyAsync(moMes_moentry);
                 }
 
                 //在制工单占用记录表
@@ -2041,7 +2040,7 @@ namespace Business.ResourceExamineManagement
                 {
                     var moMes_mooccupy = ObjectMapper.Map<List<mes_mooccupy>, List<mo_mes_mooccupy>>(mes_mooccupy);
                     moMes_mooccupy.ForEach(item => { item.GenerateNewId(help.NextId()); item.bang_id = bangid; });
-                    await _mes_mooccupy.InsertManyAsync(moMes_mooccupy);
+                    await MongoHelper<mo_mes_mooccupy>.InsertManyAsync(moMes_mooccupy);
                 }
             }
             //根据物料信息,只同步在途未关闭的采购订单和采购申请
@@ -2056,13 +2055,12 @@ namespace Business.ResourceExamineManagement
                 {
                     var moSrm_po_main = ObjectMapper.Map<List<srm_po_main>, List<mo_srm_po_main>>(srm_po_main);
                     moSrm_po_main.ForEach(item => { item.GenerateNewId(help.NextId()); item.bang_id = bangid; });
-                    await _srm_po_main.InsertManyAsync(moSrm_po_main);
-
+                    await MongoHelper<mo_srm_po_main>.InsertManyAsync(moSrm_po_main);
                     //订单明细--根据在途PO过滤出有效的Po_list
                     srm_po_list = srm_po_list.Where(s => srm_po_main.Select(x => x.Id).Contains(s.po_id.GetValueOrDefault())).ToList();
                     var moSrm_po_list = ObjectMapper.Map<List<srm_po_list>, List<mo_srm_po_list>>(srm_po_list);
                     moSrm_po_list.ForEach(item => { item.GenerateNewId(help.NextId()); item.bang_id = bangid; });
-                    await _srm_po_list.InsertManyAsync(moSrm_po_list);
+                    await MongoHelper<mo_srm_po_list>.InsertManyAsync(moSrm_po_list);
                 }
                 //采购订单明细占用详情
                 var srm_po_occupy = _mysql_srm_po_occupy.GetListAsync(x => x.company_id == companyId && x.factory_id == factoryId && srm_po_list.Select(c => c.Id).Contains(x.polist_id.GetValueOrDefault())).Result;
@@ -2070,7 +2068,7 @@ namespace Business.ResourceExamineManagement
                 {
                     var moSrm_po_occupy = ObjectMapper.Map<List<srm_po_occupy>, List<mo_srm_po_occupy>>(srm_po_occupy);
                     moSrm_po_occupy.ForEach(item => { item.GenerateNewId(help.NextId()); item.bang_id = bangid; });
-                    await _srm_po_occupy.InsertManyAsync(moSrm_po_occupy);
+                    await MongoHelper<mo_srm_po_occupy>.InsertManyAsync(moSrm_po_occupy);
                 }
             }
 
@@ -2080,7 +2078,7 @@ namespace Business.ResourceExamineManagement
             {
                 var moSrm_pr_main = ObjectMapper.Map<List<srm_pr_main>, List<mo_srm_pr_main>>(srm_pr_main);
                 moSrm_pr_main.ForEach(item => { item.GenerateNewId(help.NextId()); item.bang_id = bangid; });
-                await _srm_pr_main.InsertManyAsync(moSrm_pr_main);
+                await MongoHelper<mo_srm_pr_main>.InsertManyAsync(moSrm_pr_main);
 
                 //采购申请占用详情
                 var srm_pr_occupy = _mysql_srm_po_occupy.GetListAsync(x => x.company_id == companyId && x.factory_id == factoryId && srm_pr_main.Select(c => c.Id).Contains(x.polist_id.GetValueOrDefault())).Result;
@@ -2088,7 +2086,7 @@ namespace Business.ResourceExamineManagement
                 {
                     var moSrm_pr_occupy = ObjectMapper.Map<List<srm_po_occupy>, List<mo_srm_po_occupy>>(srm_pr_occupy);
                     moSrm_pr_occupy.ForEach(item => { item.GenerateNewId(help.NextId()); item.bang_id = bangid; });
-                    await _srm_po_occupy.InsertManyAsync(moSrm_pr_occupy);
+                    await MongoHelper<mo_srm_po_occupy>.InsertManyAsync(moSrm_pr_occupy);
                 }
             }
         }
@@ -3709,8 +3707,6 @@ namespace Business.ResourceExamineManagement
             if (addList.Any())
             {
                 _businessDbContext.BulkInsert(addList);
-
-                //await _mysql_b_bom_pretreatment.InsertManyAsync(addList);
             }
         }
 

+ 1 - 1
MicroServices/Business/Business.Application/SystemJobManagement/SystemJobAppService.cs

@@ -931,7 +931,7 @@ namespace Business.SystemJobManagement
         {
             try
             {
-                Thread.Sleep(120000);
+                Thread.Sleep(100);
             }
             catch (Exception ex)
             {

+ 3 - 3
MicroServices/Business/Business.Domain/StructuredDB/WMS/SAPInv.cs

@@ -42,19 +42,19 @@ namespace Business.StructuredDB.WMS
         /// 非限制库存量
         /// </summary>
         [Comment("非限制库存量")]
-        public string LABST { get; set; }
+        public decimal LABST { get; set; }
 
         /// <summary>
         /// 质检库存
         /// </summary>
         [Comment("质检库存")]
-        public string INSME { get; set; }
+        public decimal INSME { get; set; }
 
         /// <summary>
         /// 冻结库存
         /// </summary>
         [Comment("冻结库存")]
-        public string SPEME { get; set; }
+        public decimal SPEME { get; set; }
 
         /// <summary>
         /// 库存标识 K/O

+ 1 - 1
MicroServices/Business/Business.Host/Business.Host.csproj

@@ -9,7 +9,7 @@
   </PropertyGroup>
 
   <ItemGroup>
-	 <PackageReference Include="Huffey.Quartz.MUI" Version="1.0.3" />
+	 <PackageReference Include="Huffey.Quartz.MUI" Version="1.0.4" />
 	 <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.3" />
     <PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="6.0.3" />
     <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.5">