Murphy vor 2 Jahren
Ursprung
Commit
1b1b1aced1

+ 1 - 4
MicroServices/Business/Buissness.UnitTest/Security/FakeCurrentPrincipalAccessor.cs

@@ -21,9 +21,7 @@ namespace Buissness.TestBase
             {
                 lock (this)
                 {
-                    if (_principal == null)
-                    {
-                        _principal = new ClaimsPrincipal(
+                    _principal ??= new ClaimsPrincipal(
                             new ClaimsIdentity(
                                 new List<Claim>
                                 {
@@ -33,7 +31,6 @@ namespace Buissness.TestBase
                                 }
                             )
                         );
-                    }
                 }
             }
 

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

@@ -291,7 +291,7 @@ namespace Business.ResourceExamineManagement
                             if (level1Dto.lack_qty > 0)
                             {
                                 //先计算末级数据的齐套时间。
-                                if (childList.Count() > 0)
+                                if (childList.Count > 0)
                                 {
                                     MatterTileDevelop(level1Dto, childList, returnlist, sklist, bangid, plan_date, sentrys, icitemlist);
                                     level1Dto.kitting_time = childList.Max(s => s.kitting_time);
@@ -657,7 +657,7 @@ namespace Business.ResourceExamineManagement
                         item.lack_qty -= moo_qty;
                         item.kitting_time = DateTime.Now;
                         //先计算末级数据的齐套时间。
-                        if (cilList.Count() > 0)
+                        if (cilList.Count > 0)
                         {
                             CalcIcitem(cilList, returnlist, bangid, sklist, plan_date, icitemlist, sentrys, childidList);
                             
@@ -709,7 +709,7 @@ namespace Business.ResourceExamineManagement
                     if (item.lack_qty > 0 && (param.checkflag || (!param.checkflag && param.checkPlan)))
                     {
                         //先计算末级数据的齐套时间。
-                        if (cilList.Count() > 0)
+                        if (cilList.Count > 0)
                         {
                             CalcIcitem(cilList, returnlist, bangid, sklist, plan_date, icitemlist, sentrys, childidList);
                             item.kitting_time = cilList.Max(s => s.kitting_time);
@@ -740,7 +740,7 @@ namespace Business.ResourceExamineManagement
                 {
                     item.kitting_time = DateTime.Now;
                     //先计算末级数据的齐套时间。
-                    if (cilList.Count() > 0)
+                    if (cilList.Count > 0)
                     {
                         CalcIcitem(cilList, returnlist, bangid, sklist, plan_date, icitemlist, sentrys, childidList);
                         item.kitting_time = cilList.Max(s => s.kitting_time);
@@ -789,7 +789,7 @@ namespace Business.ResourceExamineManagement
                     break;
                 case 2://整批加混用
                     WholeBatchCheck(sublist, returnlist, sklist, select, bangid);
-                    if (select.Count() == 0)
+                    if (select.Count == 0)
                     {
                         //走混用
                         MixedUse(item, sublist, returnlist, sklist, bangid, parent, plan_date, icitemlist, sentrys, childidList);
@@ -851,7 +851,7 @@ namespace Business.ResourceExamineManagement
         public void WholeBatch(BomChildExamineDto item, List<BomChildExamineDto> sublist, List<BomChildExamineDto> returnlist, List<mo_ic_item_stockoccupy> sklist, List<BomChildExamineDto> select, long bangid, BomChildExamineDto parent, DateTime
             ? plan_date, List<mo_ic_item> icitemlist, crm_seorderentry sentrys, List<long> childidList)
         {
-            if (select.Count() == 0)
+            if (select.Count == 0)
             {
                 //如果为空,则默认使用优先级为0的集合作为替代关系
                 if (item.substitute_mode == 0)
@@ -1065,7 +1065,7 @@ namespace Business.ResourceExamineManagement
                         if (sct.erp_cls == 1)
                         {
                             //先计算末级数据的齐套时间。
-                            if (cilList.Count() > 0)
+                            if (cilList.Count > 0)
                             {
                                 CalcIcitem(cilList, returnlist, bangid, sklist, plan_date, icitemlist, sentrys, childidList);
                                 sct.kitting_time = cilList.Max(s => s.kitting_time);
@@ -1112,7 +1112,7 @@ namespace Business.ResourceExamineManagement
                             if (sct.lack_qty > 0 && (param.checkflag || (!param.checkflag && param.checkPlan)))
                             {
                                 //先计算末级数据的齐套时间。
-                                if (cilList.Count() > 0)
+                                if (cilList.Count > 0)
                                 {
                                     CalcIcitem(cilList, returnlist, bangid, sklist, plan_date, icitemlist, sentrys, childidList);
                                     sct.kitting_time = cilList.Max(s => s.kitting_time);
@@ -1140,7 +1140,7 @@ namespace Business.ResourceExamineManagement
                         }
                         else
                         {
-                            if (cilList.Count() > 0)
+                            if (cilList.Count > 0)
                             {
                                 CalcIcitem(cilList, returnlist, bangid, sklist, plan_date, icitemlist, sentrys, childidList);
                                 sct.kitting_time = cilList.Max(s => s.kitting_time);
@@ -1165,7 +1165,7 @@ namespace Business.ResourceExamineManagement
             //再计算一边占用情况,这里根据父级产品额缺料量*当前子料的使用数量-子料库存量。得出当前子物料的缺料数量
             var parent = returnlist.Find(s => s.fid == item.parent_id);
             decimal stockQty = sklist.Where(s => s.icitem_id == item.item_id && s.bang_id == bangid).Sum(p => p.quantity);
-            item.sqty = item.sqty - stockQty;
+            item.sqty -= stockQty;
             item.lack_qty = parent.lack_qty * item.qty - item.sqty;
             item.lack_qty = item.lack_qty > 0 ? item.lack_qty : 0;
             item.self_lack_qty = item.lack_qty;

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

@@ -1038,7 +1038,7 @@ namespace Business.ResourceExamineManagement
             var moPrlist = ObjectMapper.Map<List<srm_pr_main>, List<mo_srm_pr_main>>(prlist);
             foreach (var pr in prlist)
             {
-                bool bl = pr.sentry_id == null ? true : false;
+                bool bl = pr.sentry_id == null;
                 //找到是否生成了新的PR
                 //var newPr = insetPrList.Find(s => s.pr_purchaseid == pr.pr_purchaseid && s.icitem_id == pr.icitem_id && (s.sentry_id == null) == bl);
                 var newPr = insetPrList.Find(s => s.pr_purchaseid == pr.pr_purchaseid && s.icitem_id == pr.icitem_id);

+ 75 - 302
MicroServices/Business/Business.Application/SystemJobManagement/SystemJobAppService.cs

@@ -1,18 +1,12 @@
-using Business.Core.Attributes;
-using Business.Core.Configuration;
-using Business.Core.Utilities;
-using Business.Core.Web;
+using Business.Core.Utilities;
 using Business.Domain;
 using Business.EntityFrameworkCore;
 using Business.EntityFrameworkCore.SqlRepositories;
 using Business.ResourceExamineManagement;
 using Business.SystemJob;
-using MongoDB.Driver;
 using NLog;
 using System;
 using System.Collections.Generic;
-using System.Configuration;
-using System.Linq;
 using System.Threading.Tasks;
 using Volo.Abp.Application.Services;
 using Volo.Abp.Domain.Repositories;
@@ -26,31 +20,26 @@ namespace Business.SystemJobManagement
         /// 物料bom
         /// </summary>
         private IRepository<ic_bom, long> _mysql_ic_bom;
-        private readonly IRepository<mo_ic_bom, long> _ic_bom;
 
         /// <summary>
         /// 物料bom子表
         /// </summary>
         private IRepository<ic_bom_child, long> _mysql_ic_bom_child;
-        private readonly IRepository<mo_ic_bom_child, long> _ic_bom_child;
 
         /// <summary>
         /// 物料
         /// </summary>
         private IRepository<ic_item, long> _mysql_ic_item;
-        private readonly IRepository<mo_ic_item, long> _ic_item;
 
         /// <summary>
         /// 供应商
         /// </summary>
         private IRepository<srm_supplier, long> _mysql_srm_supplier;
-        private readonly IRepository<mo_srm_supplier, long> _srm_supplier;
 
         /// <summary>
         /// 物料采购报价单
         /// </summary>
         private IRepository<srm_purchase, long> _mysql_srm_purchase;
-        private readonly IRepository<mo_srm_purchase, long> _srm_purchase;
 
         /// <summary>
         /// 物料采购报价单
@@ -81,19 +70,16 @@ namespace Business.SystemJobManagement
         /// <summary>
         /// 替代群组
         /// </summary>
-        private readonly IRepository<mo_ic_substitute, long> _ic_substitute;
         private IRepository<ic_substitute, long> _mysql_ic_substitute;
 
         /// <summary>
         /// 物料替代多群组
         /// </summary>
-        private readonly IRepository<mo_ic_substitute_group, long> _ic_substitute_group;
         private IRepository<ic_substitute_group, long> _mysql_ic_substitute_group;
 
         /// <summary>
         /// 物料替代多群组明细
         /// </summary>
-        private readonly IRepository<mo_ic_substitute_group_detail, long> _ic_substitute_group_detail;
         private IRepository<ic_substitute_group_detail, long> _mysql_ic_substitute_group_detail;
 
         /// <summary>
@@ -115,87 +101,10 @@ namespace Business.SystemJobManagement
         private IRepository<mes_tech_process, long> _mysql_mes_tech_process;
 
 
-
-        /// <summary>
-        /// 工单
-        /// </summary>
-        private ISqlRepository<WorkOrdMaster> _workOrdMaster;
-
-        /// <summary>
-        /// 工单物料明细
-        /// </summary>
-        private ISqlRepository<WorkOrdDetail> _workOrdDetail;
-
-        /// <summary>
-        /// 工单工艺路线明细
-        /// </summary>
-        private ISqlRepository<WorkOrdRouting> _workOrdRouting;
-
-        /// <summary>
-        /// 库存主数据
-        /// </summary>
-        private ISqlRepository<InvMaster> _invMaster;
-
-        /// <summary>
-        /// 生产线明细
-        /// </summary>
-        private ISqlRepository<ProdLineDetail> _prodLineDetail;
-
-        /// <summary>
-        /// 生产周期明细
-        /// </summary>
-        private ISqlRepository<PeriodSequenceDet> _periodSequenceDet;
-
-        /// <summary>
-        /// 排产结果明细
-        /// </summary>
-        private ISqlRepository<ScheduleResultOpMaster> _scheduleResultOpMaster;
-
-        /// <summary>
-        /// 工作日历数据
-        /// </summary>
-        private ISqlRepository<ShopCalendarWorkCtr> _shopCalendarWorkCtr;
-
-        /// <summary>
-        /// 产线休息时间记录表
-        /// </summary>
-        private ISqlRepository<QualityLineWorkDetail> _qualityLineWorkDetail;
-
-        /// <summary>
-        /// 节假日记录表
-        /// </summary>
-        private ISqlRepository<HolidayMaster> _holidayMaster;
-
-
-        private readonly ICurrentTenant _currentTenant;
-
-        /// <summary>
-        /// 工作日历数据
-        /// </summary>
-        private List<ShopCalendarWorkCtr> calendars;
-
-        /// <summary>
-        /// 产线休息记录数据
-        /// </summary>
-        private List<QualityLineWorkDetail> qualityLines;
-
-        /// <summary>
-        /// 节假日记录数据
-        /// </summary>
-        private List<HolidayMaster> holidays;
-
         /// <summary>
         /// 生产排产
         /// </summary>
         private readonly ProductionScheduleAppService _productionScheduleAppService;
-        private readonly IRepository<mo_srm_pr_main, long> _srm_pr_main;
-        private IRepository<srm_pr_main, long> _mysql_srm_pr_main;
-        private readonly IRepository<mo_srm_po_main, long> _srm_po_main;
-        private IRepository<srm_po_main, long> _mysql_srm_po_main;
-        private readonly IRepository<mo_srm_po_list, long> _srm_po_list;
-        private IRepository<srm_po_list, long> _mysql_srm_po_list;
-
-        private IRepository<b_mo_order, long> _mysql_b_mo_order;
 
         public SystemJobAppService(
          IRepository<ic_bom, long> mysql_ic_bom,
@@ -217,36 +126,10 @@ namespace Business.SystemJobManagement
          ISqlRepository<ConsigneeAddressMaster> consigneeAddressMaster,
          ISqlRepository<ItemMaster> itemMaster,
          ISqlRepository<ProductStructureMaster> productStructureMaster,
-         ISqlRepository<WorkOrdMaster> workOrdMaster,
-         ISqlRepository<WorkOrdDetail> workOrdDetail,
-         ISqlRepository<WorkOrdRouting> workOrdRouting,
-         ISqlRepository<ProdLineDetail> prodLineDetail,
-         ISqlRepository<PeriodSequenceDet> periodSequenceDet,
-         ISqlRepository<ScheduleResultOpMaster> scheduleResultOpMaster,
-         ISqlRepository<InvMaster> invMaster,
-         ISqlRepository<ShopCalendarWorkCtr> shopCalendarWorkCtr,
-         ISqlRepository<QualityLineWorkDetail> qualityLineWorkDetail,
-         ISqlRepository<HolidayMaster> holidayMaster,
-         ICurrentTenant currentTenant,
-         IRepository<mo_ic_bom,long> ic_bom,
-         IRepository<mo_ic_bom_child,long> ic_bom_child,
-         IRepository<mo_ic_item, long> ic_item,
-         IRepository<mo_ic_substitute, long> ic_substitute,
-         IRepository<mo_ic_substitute_group, long> ic_substitute_group,
-         IRepository<mo_ic_substitute_group_detail, long> ic_substitute_group_detail,
-         IRepository<mo_srm_supplier, long> srm_supplier,
          IRepository<mo_mes_technique, long> mes_technique,
          IRepository<mo_mes_process, long> mes_process,
          IRepository<mo_mes_tech_process, long> mes_tech_process,
-         IRepository<mo_srm_purchase, long> srm_purchase,
          ProductionScheduleAppService productionScheduleAppService,
-         IRepository<b_mo_order, long> mysql_b_mo_order,
-         IRepository<mo_srm_pr_main, long> srm_pr_main,
-         IRepository<srm_pr_main, long> mysql_srm_pr_main,
-         IRepository<mo_srm_po_list, long> srm_po_list,
-         IRepository<srm_po_list, long> mysql_srm_po_list,
-         IRepository<mo_srm_po_main, long> srm_po_main,
-         IRepository<srm_po_main, long> mysql_srm_po_main,
          BusinessDbContext businessDbContext
          )
         {
@@ -269,37 +152,11 @@ namespace Business.SystemJobManagement
             _consigneeAddressMaster = consigneeAddressMaster;
             _itemMaster = itemMaster;
             _productStructureMaster = productStructureMaster;
-            _ic_bom = ic_bom;
-            _ic_bom_child = ic_bom_child;
-            _ic_item = ic_item;
-            _ic_substitute = ic_substitute;
-            _ic_substitute_group = ic_substitute_group;
-            _ic_substitute_group_detail = ic_substitute_group_detail;
-            _srm_supplier = srm_supplier;
             _mes_technique = mes_technique;
             _mes_process = mes_process;
             _mes_tech_process = mes_tech_process;
-            _srm_purchase = srm_purchase;
             _businessDbContext = businessDbContext;
             _itemMaster = itemMaster;
-            _workOrdMaster = workOrdMaster;
-            _workOrdDetail = workOrdDetail;
-            _workOrdRouting = workOrdRouting;
-            _prodLineDetail = prodLineDetail;
-            _periodSequenceDet = periodSequenceDet;
-            _scheduleResultOpMaster = scheduleResultOpMaster;
-            _invMaster = invMaster;
-            _shopCalendarWorkCtr = shopCalendarWorkCtr;
-            _qualityLineWorkDetail = qualityLineWorkDetail;
-            _holidayMaster = holidayMaster;
-            _currentTenant = currentTenant;
-            _mysql_b_mo_order = mysql_b_mo_order;
-            _mysql_srm_po_list = mysql_srm_po_list;
-            _srm_po_list = srm_po_list;
-            _mysql_srm_po_main = mysql_srm_po_main;
-            _srm_po_main = srm_po_main;
-            _mysql_srm_pr_main = mysql_srm_pr_main;
-            _srm_pr_main = srm_pr_main;
             _productionScheduleAppService = productionScheduleAppService;
         }
 
@@ -339,176 +196,92 @@ namespace Business.SystemJobManagement
         {
             try
             {
-                //var srm_purchase1 = _mysql_srm_pr_main.GetListAsync().Result;
-                //if (srm_purchase1.Count > 0)
-                //{
-                //    //先清空表数据
-                //    await MongoHelper<mo_srm_pr_main>.DeleteManyAsync(p => p.mysql_id != -1);
-                //    var mosrm_purchase = ObjectMapper.Map<List<srm_pr_main>, List<mo_srm_pr_main>>(srm_purchase1);
-                //    mosrm_purchase.ForEach(s => s.GenerateNewId(help.NextId()));
-                //    await MongoHelper<mo_srm_pr_main>.InsertManyAsync(mosrm_purchase);
-                //}
-
-                //var srm_purchase2 = _mysql_srm_po_main.GetListAsync().Result;
-                //if (srm_purchase2.Count > 0)
-                //{
-                //    //先清空表数据
-                //    await MongoHelper<mo_srm_po_main>.DeleteManyAsync(p => p.mysql_id != -1);
-                //    var mosrm_purchase = ObjectMapper.Map<List<srm_po_main>, List<mo_srm_po_main>>(srm_purchase2);
-                //    mosrm_purchase.ForEach(s => s.GenerateNewId(help.NextId()));
-                //    await MongoHelper<mo_srm_po_main>.InsertManyAsync(mosrm_purchase);
-                //}
-
-                //var srm_purchase3 = _mysql_srm_po_list.GetListAsync().Result;
-                //if (srm_purchase3.Count > 0)
-                //{
-                //    //先清空表数据
-                //    await MongoHelper<mo_srm_po_list>.DeleteManyAsync(p => p.mysql_id != -1);
-                //    var mosrm_purchase = ObjectMapper.Map<List<srm_po_list>, List<mo_srm_po_list>>(srm_purchase3);
-                //    mosrm_purchase.ForEach(s => s.GenerateNewId(help.NextId()));
-                //    await MongoHelper<mo_srm_po_list>.InsertManyAsync(mosrm_purchase);
-                //}
                 //物料采购报价单
-                //List<srm_purchase> srm_purchases = _mysql_srm_purchase.GetListAsync().Result;
-                //if (srm_purchases.Count > 0)
-                //{
-                //    //先清空表数据
-                //    await _srm_purchase.DeleteAsync(p => p.mysql_id != -1);
-                //    var mosrm_purchase = ObjectMapper.Map<List<srm_purchase>, List<mo_srm_purchase>>(srm_purchases);
-                //    mosrm_purchase.ForEach(s => s.GenerateNewId(help.NextId()));
-                //    //_srm_purchase.InsertManyAsync(mosrm_purchase);
-                //    await MongoHelper<mo_srm_purchase>.InsertManyAsync(mosrm_purchase);
-                //}
+                List<srm_purchase> srm_purchases = _mysql_srm_purchase.GetListAsync().Result;
+                if (srm_purchases.Count > 0)
+                {
+                    //先清空表数据
+                    await MongoHelper<mo_srm_purchase>.DeleteManyAsync(p => p.mysql_id != -1);
+                    var mosrm_purchase = ObjectMapper.Map<List<srm_purchase>, List<mo_srm_purchase>>(srm_purchases);
+                    mosrm_purchase.ForEach(s => s.GenerateNewId(help.NextId()));
+                    await MongoHelper<mo_srm_purchase>.InsertManyAsync(mosrm_purchase);
+                }
                 //同步物料BOM明细数据
-                //var icbom_childs = _mysql_ic_bom_child.GetListAsync().Result;
-                //if (icbom_childs.Count > 0)
-                //{
-                //    //先清空表数据
-                //    //await _ic_bom_child.DeleteAsync(p => p.mysql_id != -1);
-                //    await MongoHelper<mo_ic_bom_child>.DeleteManyAsync(p => p.mysql_id != -1);
-                //    var moIcbom_childs = ObjectMapper.Map<List<ic_bom_child>, List<mo_ic_bom_child>>(icbom_childs);
-                //    moIcbom_childs.ForEach(s => s.GenerateNewId(help.NextId()));
-                //    //插入数据
-                //    //_ic_bom_child.InsertManyAsync(moIcbom_childs);
-                //    await MongoHelper<mo_ic_bom_child>.InsertManyAsync(moIcbom_childs);
-                //}
-
-                ////同步物料Bom数据
-                //var icBoms = _mysql_ic_bom.GetListAsync().Result;
-                //if (icBoms.Count > 0)
-                //{
-                //    //先清空表数据
-                //    await _ic_bom.DeleteAsync(p => p.mysql_id != -1);
-                //    var moIcBoms = ObjectMapper.Map<List<ic_bom>, List<mo_ic_bom>>(icBoms);
-                //    moIcBoms.ForEach(s => s.GenerateNewId(help.NextId()));
-                //    //插入数据
-                //    //_ic_bom.InsertManyAsync(moIcBoms);
-                //    await MongoHelper<mo_ic_bom>.InsertManyAsync(moIcBoms);
-                //}
+                var icbom_childs = _mysql_ic_bom_child.GetListAsync().Result;
+                if (icbom_childs.Count > 0)
+                {
+                    //先清空表数据
+                    await MongoHelper<mo_ic_bom_child>.DeleteManyAsync(p => p.mysql_id != -1);
+                    var moIcbom_childs = ObjectMapper.Map<List<ic_bom_child>, List<mo_ic_bom_child>>(icbom_childs);
+                    moIcbom_childs.ForEach(s => s.GenerateNewId(help.NextId()));
+                    await MongoHelper<mo_ic_bom_child>.InsertManyAsync(moIcbom_childs);
+                }
+
+                //同步物料Bom数据
+                var icBoms = _mysql_ic_bom.GetListAsync().Result;
+                if (icBoms.Count > 0)
+                {
+                    //先清空表数据
+                    await MongoHelper<mo_ic_bom>.DeleteManyAsync(p => p.mysql_id != -1);
+                    var moIcBoms = ObjectMapper.Map<List<ic_bom>, List<mo_ic_bom>>(icBoms);
+                    moIcBoms.ForEach(s => s.GenerateNewId(help.NextId()));
+                    await MongoHelper<mo_ic_bom>.InsertManyAsync(moIcBoms);
+                }
 
                 //同步物料数据
-                //var icItems = _mysql_ic_item.GetListAsync().Result;
-                //if (icItems.Count > 0)
-                //{
-                //    //先清空表数据
-                //    await MongoHelper<mo_ic_item>.DeleteManyAsync(p => p.mysql_id != -1);
-                //    var moIcItems = ObjectMapper.Map<List<ic_item>, List<mo_ic_item>>(icItems);
-                //    moIcItems.ForEach(s => s.GenerateNewId(help.NextId()));
-                //    //插入数据
-                //    //_ic_item.InsertManyAsync(moIcItems);
-                //    await MongoHelper<mo_ic_item>.InsertManyAsync(moIcItems);
-                //}
+                var icItems = _mysql_ic_item.GetListAsync().Result;
+                if (icItems.Count > 0)
+                {
+                    //先清空表数据
+                    await MongoHelper<mo_ic_item>.DeleteManyAsync(p => p.mysql_id != -1);
+                    var moIcItems = ObjectMapper.Map<List<ic_item>, List<mo_ic_item>>(icItems);
+                    moIcItems.ForEach(s => s.GenerateNewId(help.NextId()));
+                    await MongoHelper<mo_ic_item>.InsertManyAsync(moIcItems);
+                }
 
                 //同步替代群组数据
-                //var subtitutes = _mysql_ic_substitute.GetListAsync().Result;
-                //if (subtitutes.Count > 0)
-                //{
-                //    //先清空表数据
-                //    await _ic_substitute.DeleteAsync(p => p.mysql_id != -1);
-                //    var moSubtitutes = ObjectMapper.Map<List<ic_substitute>, List<mo_ic_substitute>>(subtitutes);
-                //    moSubtitutes.ForEach(s => s.GenerateNewId(help.NextId()));
-                //    //插入数据
-                //    //_ic_substitute.InsertManyAsync(moSubtitutes);
-                //    await MongoHelper<mo_ic_substitute>.InsertManyAsync(moSubtitutes);
-                //}
+                var subtitutes = _mysql_ic_substitute.GetListAsync().Result;
+                if (subtitutes.Count > 0)
+                {
+                    //先清空表数据
+                    await MongoHelper<mo_ic_substitute>.DeleteManyAsync(p => p.mysql_id != -1);
+                    var moSubtitutes = ObjectMapper.Map<List<ic_substitute>, List<mo_ic_substitute>>(subtitutes);
+                    moSubtitutes.ForEach(s => s.GenerateNewId(help.NextId()));
+                    await MongoHelper<mo_ic_substitute>.InsertManyAsync(moSubtitutes);
+                }
 
                 //同步物料替代多群组数据
-                //var subAlls = _mysql_ic_substitute_group.GetListAsync().Result;
-                //if (subAlls.Count > 0)
-                //{
-                //    //先清空表数据
-                //    await _ic_substitute_group.DeleteAsync(p => p.mysql_id != -1);
-                //    var moSubAlls = ObjectMapper.Map<List<ic_substitute_group>, List<mo_ic_substitute_group>>(subAlls);
-                //    moSubAlls.ForEach(s => s.GenerateNewId(help.NextId()));
-                //    //插入数据
-                //    //_ic_substitute_group.InsertManyAsync(moSubAlls);
-                //    await MongoHelper<mo_ic_substitute_group>.InsertManyAsync(moSubAlls);
-                //}
+                var subAlls = _mysql_ic_substitute_group.GetListAsync().Result;
+                if (subAlls.Count > 0)
+                {
+                    //先清空表数据
+                    await MongoHelper<mo_ic_substitute_group>.DeleteManyAsync(p => p.mysql_id != -1);
+                    var moSubAlls = ObjectMapper.Map<List<ic_substitute_group>, List<mo_ic_substitute_group>>(subAlls);
+                    moSubAlls.ForEach(s => s.GenerateNewId(help.NextId()));
+                    await MongoHelper<mo_ic_substitute_group>.InsertManyAsync(moSubAlls);
+                }
 
                 //同步物料替代多群组明细数据
-                //var subAllDtls = _mysql_ic_substitute_group_detail.GetListAsync().Result;
-                //if (subAllDtls.Count > 0)
-                //{
-                //    //先清空表数据
-                //    await _ic_substitute_group_detail.DeleteAsync(p => p.mysql_id != -1);
-                //    var moSubAllDtls = ObjectMapper.Map<List<ic_substitute_group_detail>, List<mo_ic_substitute_group_detail>>(subAllDtls);
-                //    moSubAllDtls.ForEach(s => s.GenerateNewId(help.NextId()));
-                //    //插入数据
-                //    //_ic_substitute_group_detail.InsertManyAsync(moSubAllDtls);
-                //    await MongoHelper<mo_ic_substitute_group_detail>.InsertManyAsync(moSubAllDtls);
-                //}
+                var subAllDtls = _mysql_ic_substitute_group_detail.GetListAsync().Result;
+                if (subAllDtls.Count > 0)
+                {
+                    //先清空表数据
+                    await MongoHelper<mo_ic_substitute_group_detail>.DeleteManyAsync(p => p.mysql_id != -1);
+                    var moSubAllDtls = ObjectMapper.Map<List<ic_substitute_group_detail>, List<mo_ic_substitute_group_detail>>(subAllDtls);
+                    moSubAllDtls.ForEach(s => s.GenerateNewId(help.NextId()));
+                    await MongoHelper<mo_ic_substitute_group_detail>.InsertManyAsync(moSubAllDtls);
+                }
 
                 //同步供应商数据
-                //var suppliers = _mysql_srm_supplier.GetListAsync().Result;
-                //if (suppliers.Count > 0)
-                //{
-                //    //先清空表数据
-                //    await _srm_supplier.DeleteAsync(p => p.mysql_id != -1);
-                //    var moSuppliers = ObjectMapper.Map<List<srm_supplier>, List<mo_srm_supplier>>(suppliers);
-                //    moSuppliers.ForEach(s => s.GenerateNewId(help.NextId()));
-                //    //插入数据
-                //    //_srm_supplier.InsertManyAsync(moSuppliers);
-                //    await MongoHelper<mo_srm_supplier>.InsertManyAsync(moSuppliers);
-                //}
-
-                //同步工艺路径数据
-                //var techs = _mysql_mes_technique.GetListAsync().Result;
-                //if (techs.Count > 0)
-                //{
-                //    //先清空表数据
-                //    await _mes_technique.DeleteAsync(p => p.mysql_id != -1);
-                //    var moTechs = ObjectMapper.Map<List<mes_technique>, List<mo_mes_technique>>(techs);
-                //    moTechs.ForEach(s => s.GenerateNewId(help.NextId()));
-                //    //插入数据
-                //    //_mes_technique.InsertManyAsync(moTechs);
-                //    await MongoHelper<mo_mes_technique>.InsertManyAsync(moTechs);
-                //}
-
-                //同步工序数据
-                //var processes = _mysql_mes_process.GetListAsync().Result;
-                //if (processes.Count > 0)
-                //{
-                //    //先清空表数据
-                //    await _mes_process.DeleteAsync(p => p.mysql_id != -1);
-                //    var moProcesses = ObjectMapper.Map<List<mes_process>, List<mo_mes_process>>(processes);
-                //    moProcesses.ForEach(s => s.GenerateNewId(help.NextId()));
-                //    //插入数据
-                //    //_mes_process.InsertManyAsync(moProcesses);
-                //    await MongoHelper<mo_mes_process>.InsertManyAsync(moProcesses);
-                //}
-
-                //同步工艺关联工序数据
-                //var tech_procs = _mysql_mes_tech_process.GetListAsync().Result;
-                //if (tech_procs.Count > 0)
-                //{
-                //    //先清空表数据
-                //    await _mes_tech_process.DeleteAsync(p => p.mysql_id != -1);
-                //    var moTech_procs = ObjectMapper.Map<List<mes_tech_process>, List<mo_mes_tech_process>>(tech_procs);
-                //    moTech_procs.ForEach(s => s.GenerateNewId(help.NextId()));
-                //    //插入数据
-                //    //_mes_tech_process.InsertManyAsync(moTech_procs);
-                //    await MongoHelper<mo_mes_tech_process>.InsertManyAsync(moTech_procs);
-                //}
+                var suppliers = _mysql_srm_supplier.GetListAsync().Result;
+                if (suppliers.Count > 0)
+                {
+                    //先清空表数据
+                    await MongoHelper<mo_srm_supplier>.DeleteManyAsync(p => p.mysql_id != -1);
+                    var moSuppliers = ObjectMapper.Map<List<srm_supplier>, List<mo_srm_supplier>>(suppliers);
+                    moSuppliers.ForEach(s => s.GenerateNewId(help.NextId()));
+                    await MongoHelper<mo_srm_supplier>.InsertManyAsync(moSuppliers);
+                }
             }
             catch (Exception ex)
             {

+ 2 - 2
MicroServices/Business/Business.Core/Configuration/AppConfigurations.cs

@@ -12,7 +12,7 @@ namespace Business.Core.Configuration
             ConfigurationCache = new ConcurrentDictionary<string, IConfigurationRoot>();
         }
 
-        public static IConfigurationRoot Get(string path, string environmentName = null)
+        public static IConfigurationRoot Get(string path, string? environmentName = null)
         {
             var cacheKey = path + "#" + environmentName;
             return ConfigurationCache.GetOrAdd(
@@ -21,7 +21,7 @@ namespace Business.Core.Configuration
             );
         }
 
-        private static IConfigurationRoot BuildConfiguration(string path, string environmentName = null)
+        private static IConfigurationRoot BuildConfiguration(string path, string? environmentName = null)
         {
             var builder = new ConfigurationBuilder()
                 .SetBasePath(path)

+ 11 - 11
MicroServices/Business/Business.Core/Utilities/Encrypt.cs

@@ -81,7 +81,7 @@ namespace Business.Core.Utilities
         /// <summary>
         /// DES密钥,24位字符串
         /// </summary>
-        public static string DesKey = "#s^un2ye21fcv%|f0XpR,+vh";
+        private static string DesKey = "#s^un2ye21fcv%|f0XpR,+vh";
 
         /// <summary>
         /// DES加密
@@ -100,7 +100,7 @@ namespace Business.Core.Utilities
         /// <param name="encoding">编码</param>
         /// <param name="cipherMode">加密模式</param>
         /// <param name="paddingMode">填充模式</param>
-        public static string DesEncrypt(object value, string key, Encoding encoding = null, CipherMode cipherMode = CipherMode.ECB, PaddingMode paddingMode = PaddingMode.PKCS7)
+        public static string DesEncrypt(object value, string key, Encoding? encoding = null, CipherMode cipherMode = CipherMode.ECB, PaddingMode paddingMode = PaddingMode.PKCS7)
         {
             string text = value.SafeString();
             if (ValidateDes(text, key) == false)
@@ -134,7 +134,7 @@ namespace Business.Core.Utilities
         /// <summary>
         /// 获取加密结果
         /// </summary>
-        private static string GetEncryptResult(string value, Encoding encoding, ICryptoTransform transform)
+        private static string GetEncryptResult(string value, Encoding? encoding, ICryptoTransform transform)
         {
             encoding ??= Encoding.UTF8;
             var bytes = encoding.GetBytes(value);
@@ -159,7 +159,7 @@ namespace Business.Core.Utilities
         /// <param name="encoding">编码</param>
         /// <param name="cipherMode">加密模式</param>
         /// <param name="paddingMode">填充模式</param>
-        public static string DesDecrypt(object value, string key, Encoding encoding = null, CipherMode cipherMode = CipherMode.ECB, PaddingMode paddingMode = PaddingMode.PKCS7)
+        public static string DesDecrypt(object value, string key, Encoding? encoding = null, CipherMode cipherMode = CipherMode.ECB, PaddingMode paddingMode = PaddingMode.PKCS7)
         {
             string text = value.SafeString();
             if (!ValidateDes(text, key))
@@ -171,7 +171,7 @@ namespace Business.Core.Utilities
         /// <summary>
         /// 获取解密结果
         /// </summary>
-        private static string GetDecryptResult(string value, Encoding encoding, ICryptoTransform transform)
+        private static string GetDecryptResult(string value, Encoding? encoding, ICryptoTransform transform)
         {
             encoding ??= Encoding.UTF8;
             var bytes = System.Convert.FromBase64String(value);
@@ -208,7 +208,7 @@ namespace Business.Core.Utilities
         /// <summary>
         /// AES密钥
         /// </summary>
-        public static string AesKey = "QaP1AF8utIarcBqdhYTZpVGbiNQ9M6IL";
+        private static string AesKey = "QaP1AF8utIarcBqdhYTZpVGbiNQ9M6IL";
 
         /// <summary>
         /// AES加密
@@ -228,7 +228,7 @@ namespace Business.Core.Utilities
         /// <param name="cipherMode">加密模式</param>
         /// <param name="paddingMode">填充模式</param>
         /// <param name="iv">初始化向量</param>
-        public static string AesEncrypt(string value, string key, Encoding encoding = null, CipherMode cipherMode = CipherMode.CBC, PaddingMode paddingMode = PaddingMode.PKCS7, byte[] iv = null)
+        public static string AesEncrypt(string value, string key, Encoding? encoding = null, CipherMode cipherMode = CipherMode.CBC, PaddingMode paddingMode = PaddingMode.PKCS7, byte[]? iv = null)
         {
             if (value.IsEmpty() || key.IsEmpty())
                 return string.Empty;
@@ -269,7 +269,7 @@ namespace Business.Core.Utilities
         /// <param name="cipherMode">加密模式</param>
         /// <param name="paddingMode">填充模式</param>
         /// <param name="iv">初始化向量</param>
-        public static string AesDecrypt(string value, string key, Encoding encoding = null, CipherMode cipherMode = CipherMode.CBC, PaddingMode paddingMode = PaddingMode.PKCS7, byte[] iv = null)
+        public static string AesDecrypt(string value, string key, Encoding? encoding = null, CipherMode cipherMode = CipherMode.CBC, PaddingMode paddingMode = PaddingMode.PKCS7, byte[]? iv = null)
         {
             if (value.IsEmpty() || key.IsEmpty())
                 return string.Empty;
@@ -289,7 +289,7 @@ namespace Business.Core.Utilities
         /// <param name="value">值</param>
         /// <param name="key">密钥</param>
         /// <param name="encoding">字符编码</param>
-        public static string HmacSha256(string value, string key, Encoding encoding = null)
+        public static string HmacSha256(string value, string key, Encoding? encoding = null)
         {
             if (value.IsEmpty() || key.IsEmpty())
                 return string.Empty;
@@ -311,7 +311,7 @@ namespace Business.Core.Utilities
         /// <param name="encoding">编码</param>
         /// <param name="hashAlgorithm">加密算法,默认值: HashAlgorithmName.SHA1</param>
         /// <param name="rsaKeyType">Rsa密钥类型,默认值: Pkcs1</param>
-        public static string RsaSign(string value, string privateKey, Encoding encoding = null, HashAlgorithmName? hashAlgorithm = null, RSAKeyType rsaKeyType = RSAKeyType.Pkcs1)
+        public static string RsaSign(string value, string privateKey, Encoding? encoding = null, HashAlgorithmName? hashAlgorithm = null, RSAKeyType rsaKeyType = RSAKeyType.Pkcs1)
         {
             if (value.IsEmpty() || privateKey.IsEmpty())
                 return string.Empty;
@@ -339,7 +339,7 @@ namespace Business.Core.Utilities
         /// <param name="sign">签名</param>
         /// <param name="encoding">编码</param>
         /// <param name="hashAlgorithm">加密算法,默认值: HashAlgorithmName.SHA1</param>
-        public static bool RsaVerify(string value, string publicKey, string sign, Encoding encoding = null, HashAlgorithmName? hashAlgorithm = null)
+        public static bool RsaVerify(string value, string publicKey, string sign, Encoding? encoding = null, HashAlgorithmName? hashAlgorithm = null)
         {
             if (value.IsEmpty() || publicKey.IsEmpty() || sign.IsEmpty())
                 return false;

+ 3 - 3
MicroServices/Business/Business.Core/Utilities/MongoHelper.cs

@@ -13,9 +13,9 @@ namespace Business.Core.Utilities
             var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder());
             string mongodbUrl = configuration["ConnectionStrings:MongoDB"];
             MongoClient client = new MongoClient(mongodbUrl);
-            CollectionNameAttribute collectonName_T = typeof(T).GetCustomAttributes(typeof(CollectionNameAttribute), true).FirstOrDefault() as CollectionNameAttribute;
-            IMongoDatabase dataBase_T = client.GetDatabase(collectonName_T.DatabaseName);
-            IMongoCollection<T> mongoCollection_T = dataBase_T.GetCollection<T>(collectonName_T.CollectionName);
+            CollectionNameAttribute? collectonName_T = typeof(T).GetCustomAttributes(typeof(CollectionNameAttribute), true).FirstOrDefault() as CollectionNameAttribute;
+            IMongoDatabase dataBase_T = client.GetDatabase(collectonName_T?.DatabaseName);
+            IMongoCollection<T> mongoCollection_T = dataBase_T.GetCollection<T>(collectonName_T?.CollectionName);
             return mongoCollection_T;
         }
         public static async Task InsertManyAsync(IEnumerable<T> documents, CancellationToken cancellationToken = default(CancellationToken))

+ 0 - 11
MicroServices/Business/Business.Domain/MongoDB/MES/IC/mo_ic_bom.cs

@@ -2,17 +2,6 @@
 using Microsoft.EntityFrameworkCore;
 using System;
 using System.ComponentModel.DataAnnotations;
-using Business.Core.Attributes;
-using Microsoft.EntityFrameworkCore;
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.ComponentModel.DataAnnotations;
-using System.ComponentModel.DataAnnotations.Schema;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Volo.Abp;
 
 namespace Business.Domain
 {

+ 1 - 1
MicroServices/Business/Business.Host/appsettings.json

@@ -17,7 +17,7 @@
     "DOPLog": "Server=123.60.180.165;Database=dopbiz;uid=sa;pwd=5h3n9)uN;Trusted_Connection=false;TrustServerCertificate=True",
     "DOPBang": "Server=123.60.180.165;Database=dopbiz;uid=sa;pwd=5h3n9)uN;Trusted_Connection=false;TrustServerCertificate=True",
     "DOPExt": "Server=123.60.180.165;Database=dopbiz;uid=sa;pwd=5h3n9)uN;Trusted_Connection=false;TrustServerCertificate=True",
-    "MongoDB": "mongodb://zzydop:h1Q$us3r@123.60.180.165/dopbase",
+    "MongoDB": "mongodb://zzydop:h1Q$us3r@123.60.180.165/dopbase"
   },
   "Redis": {
     "Configuration": "192.168.1.191"

+ 2 - 2
MicroServices/Business/Bussiness.EntityFrameworkCore.Test/EntityFrameworkCore/EntityFrameworkCoreTestModule.cs

@@ -18,7 +18,7 @@ namespace Bussiness.EntityFrameworkCore.Test
         )]
     public class EntityFrameworkCoreTestModule : AbpModule
     {
-        private SqliteConnection _sqliteConnection;
+        private SqliteConnection? _sqliteConnection;
 
         public override void ConfigureServices(ServiceConfigurationContext context)
         {
@@ -45,7 +45,7 @@ namespace Bussiness.EntityFrameworkCore.Test
 
         public override void OnApplicationShutdown(ApplicationShutdownContext context)
         {
-            _sqliteConnection.Dispose();
+            _sqliteConnection?.Dispose();
         }
 
         private static SqliteConnection CreateDatabaseAndGetConnection()