Просмотр исходного кода

Merge branch 'master' of http://123.60.180.165:4647/ZZYDOP/DOPCore

# Conflicts:
#	MicroServices/Business/Business.Application/ResourceExamineManagement/MorderAppService.cs
zhengly 3 лет назад
Родитель
Сommit
12544dc824

+ 6 - 3
MicroServices/Business/Business.Application/ResourceExamineManagement/MorderAppService.cs

@@ -183,7 +183,7 @@ namespace Business.ResourceExamineManagement
         /// <param name="DeliverDate">交付日期</param>
         /// <param name="seorderentry_id">销售订单子表ID</param>
         /// <returns></returns>
-        public async Task<List<mes_mooccupy>> CheckMorder(string bomNumber, decimal Quantity, DateTime DeliverDate, crm_seorderentry seorderentry, ic_item ic_Item)
+        public async Task<List<mes_mooccupy>> CheckMorder(string bomNumber, decimal? Quantity, DateTime DeliverDate, crm_seorderentry seorderentry, ic_item ic_Item,bool flag = true)
         {
             if (string.IsNullOrEmpty(bomNumber) || Quantity == null)
             {
@@ -291,7 +291,10 @@ namespace Business.ResourceExamineManagement
                 }
 
             }
-            await _mes_mooccupy.InsertMany(mes_Mooccupies);
+            if (flag)
+            {
+                await _mes_mooccupy.InsertMany(mes_Mooccupies);
+            }
             #region 注释
             //  if (morderDataList.Count > 0)
             //  {
@@ -378,7 +381,7 @@ namespace Business.ResourceExamineManagement
             //  }
             #endregion
             //TODO:返回占用数据,外层每个BOM根据占用工单数据判断是否满足。
-            return mes_Mooccupies;
+            return mes_Mooccupies.OrderByDescending(s=>s.moo_etime).ToList();
         }
         /// <summary>
         /// 拼接工单占用表

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

@@ -1337,7 +1337,7 @@ namespace Business.ResourceExamineManagement
                         //得到库存最小数量,去占用,然后剩余的丢第二个循环里去占用。
                         //获取物料详情
                         var ic_item = icitemlist.Find(s => s.Id == hy.item_id);
-                        var mooccupylist = _morderAppService.CheckMorder(hy.bom_number, hy.lack_qty, plan_date.GetValueOrDefault(), sentrys, ic_item).Result;
+                        var mooccupylist = _morderAppService.CheckMorder(hy.bom_number, hy.lack_qty, plan_date.GetValueOrDefault(), sentrys, ic_item, false).Result;
                         decimal moo_qty = mooccupylist.Sum(s => s.moo_qty.GetValueOrDefault());
                         decimal make = (hy.sqty + moo_qty) / hy.qty;
                         if (Math.Floor(hy.qty) == hy.qty)

+ 10 - 10
MicroServices/Business/Business.Application/SyncDataManagement/SyncMySQLDataAppService.cs

@@ -175,7 +175,7 @@ namespace Business.SyncDataManagement
             var icBoms = await _mysql_ic_bom.GetListAsync();
             if (icBoms.Count > 0)
             {
-                //先清空表数据(删除mongodb中的集合)
+                //先清空表数据
                 await _ic_bom.DeleteAll();
                 //插入数据
                 await _ic_bom.InsertMany(icBoms);
@@ -185,7 +185,7 @@ namespace Business.SyncDataManagement
             var icbom_childs = await _mysql_ic_bom_child.GetListAsync();
             if (icbom_childs.Count > 0)
             {
-                //先清空表数据(删除mongodb中的集合)
+                //先清空表数据
                 await _ic_bom_child.DeleteAll();
                 //插入数据
                 await _ic_bom_child.InsertMany(icbom_childs);
@@ -195,7 +195,7 @@ namespace Business.SyncDataManagement
             var icItems = await _mysql_ic_item.GetListAsync();
             if (icItems.Count > 0)
             {
-                //先清空表数据(删除mongodb中的集合)
+                //先清空表数据
                 await _ic_item.DeleteAll();
                 //插入数据
                 await _ic_item.InsertMany(icItems);
@@ -205,7 +205,7 @@ namespace Business.SyncDataManagement
             var subtitutes = await _mysql_ic_substitute.GetListAsync();
             if (subtitutes.Count > 0)
             {
-                //先清空表数据(删除mongodb中的集合)
+                //先清空表数据
                 await _ic_substitute.DeleteAll();
                 //插入数据
                 await _ic_substitute.InsertMany(subtitutes);
@@ -215,7 +215,7 @@ namespace Business.SyncDataManagement
             var subAlls = await _mysql_ic_substitute_all.GetListAsync();
             if (subAlls.Count > 0)
             {
-                //先清空表数据(删除mongodb中的集合)
+                //先清空表数据
                 await _ic_substitute_all.DeleteAll();
                 //插入数据
                 await _ic_substitute_all.InsertMany(subAlls);
@@ -225,7 +225,7 @@ namespace Business.SyncDataManagement
             var subAllDtls = await _mysql_ic_substitute_all_dtl.GetListAsync();
             if (subAllDtls.Count > 0)
             {
-                //先清空表数据(删除mongodb中的集合)
+                //先清空表数据
                 await _ic_substitute_all_dtl.DeleteAll();
                 //插入数据
                 await _ic_substitute_all_dtl.InsertMany(subAllDtls);
@@ -235,7 +235,7 @@ namespace Business.SyncDataManagement
             var suppliers = await _mysql_srm_supplier.GetListAsync();
             if (suppliers.Count > 0)
             {
-                //先清空表数据(删除mongodb中的集合)
+                //先清空表数据
                 await _srm_supplier.DeleteAll();
                 //插入数据
                 await _srm_supplier.InsertMany(suppliers);
@@ -245,7 +245,7 @@ namespace Business.SyncDataManagement
             var techs = await _mysql_mes_technique.GetListAsync();
             if (techs.Count > 0)
             {
-                //先清空表数据(删除mongodb中的集合)
+                //先清空表数据
                 await _mes_technique.DeleteAll();
                 //插入数据
                 await _mes_technique.InsertMany(techs);
@@ -255,7 +255,7 @@ namespace Business.SyncDataManagement
             var processes = await _mysql_mes_process.GetListAsync();
             if (suppliers.Count > 0)
             {
-                //先清空表数据(删除mongodb中的集合)
+                //先清空表数据
                 await _mes_process.DeleteAll();
                 //插入数据
                 await _mes_process.InsertMany(processes);
@@ -265,7 +265,7 @@ namespace Business.SyncDataManagement
             var tech_procs = await _mysql_mes_tech_process.GetListAsync();
             if (tech_procs.Count > 0)
             {
-                //先清空表数据(删除mongodb中的集合)
+                //先清空表数据
                 await _mes_tech_process.DeleteAll();
                 //插入数据
                 await _mes_tech_process.InsertMany(tech_procs);

+ 1 - 1
MicroServices/Business/Business.Core/MongoDBHelper/IMongoDB.cs

@@ -93,7 +93,7 @@ namespace Business.Core.MongoDBHelper
         Task<DeleteResult> Delete(FilterDefinition<T> filter, bool isOne = false);
 
         /// <summary>
-        /// 删除数据-直接删除集合,慎用,慎用,慎用
+        /// 删除集合数据
         /// </summary>
         /// <returns></returns>
         Task DeleteAll();

+ 2 - 2
MicroServices/Business/Business.Core/MongoDBHelper/MongoDBTools.cs

@@ -255,12 +255,12 @@ namespace Business.Core.MongoDBHelper
         }
 
         /// <summary>
-        /// 删除数据-直接删除集合,慎用,慎用,慎用
+        /// 删除集合全部数据
         /// </summary>
         /// <returns></returns>
         public Task DeleteAll()
         {
-            return dataBase.DropCollectionAsync(collectonName.CollectionName);
+            return mongoCollection.DeleteManyAsync(p=>p.Id != -1);
         }
     }
 }