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

添加替代料齐套检查结果保存

heteng 3 лет назад
Родитель
Сommit
1ed5ad90e6

+ 20 - 6
MicroServices/Business/Business.Application/ResourceExamineManagement/ResourceExamineAppService.cs

@@ -29,6 +29,7 @@ using Volo.Abp.Domain.Repositories;
 using Volo.Abp.MultiTenancy;
 using Volo.Abp.ObjectMapping;
 using ZstdSharp.Unsafe;
+using static Spire.Pdf.General.Render.Decode.Jpeg2000.j2k.codestream.HeaderInfo;
 
 namespace Business.ResourceExamineManagement
 {
@@ -1279,16 +1280,28 @@ namespace Business.ResourceExamineManagement
             var result = await OrderKittingCheck(input);
             OrderResourceViewDto rtn = DataPackage(result);
             rtn.DayBulletinBoardList = rtn.DayBulletinBoardList.OrderByDescending(d => d.day).ToList();
+            //保存检查结果
+            SaveExamineResult(rtn.KittingCheckResultList, rtn.DayBulletinBoardList, 1);
+            return JsonConvert.SerializeObject(rtn);
+        }
 
+        /// <summary>
+        /// 工单齐套检查/替代料齐套检查结果保存
+        /// </summary>
+        /// <param name="KittingCheckResultList"></param>
+        /// <param name="DayBulletinBoardList"></param>
+        public async void SaveExamineResult(List<OrderResourceDto> KittingCheckResultList, List<DayBulletinBoard> DayBulletinBoardList,int type)
+        {
             //检查结果写入数据库
             List<b_order_examine_result> examineList = new List<b_order_examine_result>();
             List<b_order_detail> orderDetails = new List<b_order_detail>();
             List<b_day_bulletin_board> daybulletinboards = new List<b_day_bulletin_board>();
 
-            foreach (var ex in rtn.KittingCheckResultList)
+            foreach (var ex in KittingCheckResultList)
             {
                 var examine = ObjectMapper.Map<OrderResourceDto, b_order_examine_result>(ex);
                 examine.GenerateNewId(help.NextId());
+                examine.type = type;
                 examine.create_time = DateTime.Now;
                 examine.tenant_id = param.tenantId;
                 examine.factory_id = param.factoryId;
@@ -1306,10 +1319,11 @@ namespace Business.ResourceExamineManagement
                 });
             }
 
-            foreach (var item in rtn.DayBulletinBoardList)
+            foreach (var item in DayBulletinBoardList)
             {
                 var detail = ObjectMapper.Map<DayBulletinBoard, b_day_bulletin_board>(item);
                 detail.GenerateNewId(help.NextId());
+                detail.type = type;
                 detail.create_time = DateTime.Now.Date;
                 detail.tenant_id = param.tenantId;
                 detail.factory_id = param.factoryId;
@@ -1321,14 +1335,12 @@ namespace Business.ResourceExamineManagement
             }
             if (orderDetails.Any())
             {
-                await _businessBangDbContext.b_order_detail.BulkInsertAsync(orderDetails, options=> options.InsertKeepIdentity = true);
+                await _businessBangDbContext.b_order_detail.BulkInsertAsync(orderDetails, options => options.InsertKeepIdentity = true);
             }
             if (daybulletinboards.Any())
             {
-                //await _businessBangDbContext.b_day_bulletin_board.BulkInsertAsync(daybulletinboards, options => options.AutoMapOutputDirection = false);
+                await _businessBangDbContext.b_day_bulletin_board.BulkInsertAsync(daybulletinboards, options => options.InsertKeepIdentity = true);
             }
-            
-            return JsonConvert.SerializeObject(rtn);
         }
 
         /// <summary>
@@ -1341,6 +1353,8 @@ namespace Business.ResourceExamineManagement
             var result = await OrderKittingCheck(input);
             OrderResourceViewDto rtn = DataPackage(result, true);
             rtn.DayBulletinBoardList = rtn.DayBulletinBoardList.OrderByDescending(d => d.day).ToList();
+            //保存检查结果
+            SaveExamineResult(rtn.KittingCheckResultList, rtn.DayBulletinBoardList, 2);
             return JsonConvert.SerializeObject(rtn);
         }
 

+ 6 - 0
MicroServices/Business/Bussiness.Model/Bang/b_day_bulletin_board.cs

@@ -23,6 +23,12 @@ namespace Bussiness.Model.Bang
         [Comment("日期")]
         public string? day { get; set; }
 
+        /// <summary>
+        /// 类别:1-工单齐套检查;2-替代料齐套检查
+        /// </summary>
+        [Comment("类别")]
+        public int? type { get; set; }
+
         /// <summary>
         /// 物料名称
         /// </summary>

+ 6 - 0
MicroServices/Business/Bussiness.Model/Bang/b_order_examine_result.cs

@@ -30,6 +30,12 @@ namespace Bussiness.Model.Bang
         [Comment("生产工单编号")]
         public string? order_no { get; set; }
 
+        /// <summary>
+        /// 类别:1-工单齐套检查;2-替代料齐套检查
+        /// </summary>
+        [Comment("类别")]
+        public int? type { get; set; }
+
         /// <summary>
         /// 开工日期
         /// </summary>