Bladeren bron

Merge branch 'dev' of http://123.60.180.165:4647/ZZYDOP/DOPCore into dev

Murphy 3 jaren geleden
bovenliggende
commit
8f25d3598a

+ 1 - 0
MicroServices/Business/Business.Application/BusinessApplicationAutoMapperProfile.cs

@@ -108,6 +108,7 @@ namespace Business
 
             CreateMap<OrderResourceDto, b_order_examine_result>();
             CreateMap<OrderItemDto, b_order_detail>();
+            CreateMap<DayBulletinBoard, b_day_bulletin_board>();
 
             CreateMap<mo_occupy, b_mo_occupy>()
                 .ForMember(d => d.Id, map => map.MapFrom(o => o.id));

+ 24 - 5
MicroServices/Business/Business.Application/ResourceExamineManagement/ResourceExamineAppService.cs

@@ -294,7 +294,8 @@ namespace Business.ResourceExamineManagement
             CalcBomViewAppService calcbomviewAppService,
             PurchaseOrderAppService purchaseOrderAppService,
             ICurrentTenant currentTenant,
-            MorderAppService morderAppService
+            MorderAppService morderAppService,
+            BusinessBangDbContext businessBangDbContext
             )
         {
             _mes_technique = mes_technique;
@@ -350,6 +351,7 @@ namespace Business.ResourceExamineManagement
             _purchaseOrderAppService = purchaseOrderAppService;
             _currentTenant = currentTenant;
             _morderAppService = morderAppService;
+            _businessBangDbContext = businessBangDbContext;
         }
         #endregion
 
@@ -1281,32 +1283,49 @@ namespace Business.ResourceExamineManagement
             //检查结果写入数据库
             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)
             {
                 var examine = ObjectMapper.Map<OrderResourceDto, b_order_examine_result>(ex);
-                examine.GenerateNewId();
+                examine.GenerateNewId(help.NextId());
                 examine.create_time = DateTime.Now;
                 examine.tenant_id = param.tenantId;
                 examine.factory_id = param.factoryId;
+                examine.create_time = DateTime.Now;
                 examineList.Add(examine);
 
                 ex.order_item_list.ForEach(s => {
                     var detail = ObjectMapper.Map<OrderItemDto, b_order_detail>(s);
-                    detail.GenerateNewId();
+                    detail.GenerateNewId(help.NextId());
                     detail.order_examine_id = examine.Id;
                     detail.tenant_id = param.tenantId;
                     detail.factory_id = param.factoryId;
+                    detail.create_time = DateTime.Now;
                     orderDetails.Add(detail);
                 });
             }
+
+            foreach (var item in rtn.DayBulletinBoardList)
+            {
+                var detail = ObjectMapper.Map<DayBulletinBoard, b_day_bulletin_board>(item);
+                detail.GenerateNewId(help.NextId());
+                detail.create_time = DateTime.Now.Date;
+                detail.tenant_id = param.tenantId;
+                detail.factory_id = param.factoryId;
+                daybulletinboards.Add(detail);
+            }
             if (examineList.Any())
             {
-                await _businessBangDbContext.b_order_examine_result.BulkInsertAsync(examineList,options=>options.AutoMapOutputDirection = false);
+                await _businessBangDbContext.b_order_examine_result.BulkInsertAsync(examineList, options => options.InsertKeepIdentity = true);
             }
             if (orderDetails.Any())
             {
-                await _businessBangDbContext.b_order_detail.BulkInsertAsync(orderDetails, options => options.AutoMapOutputDirection = false);
+                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);
             }
             
             return JsonConvert.SerializeObject(rtn);

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

@@ -185,7 +185,7 @@ namespace Business.SyncDataManagement
             }
 
             //同步物料BOM明细数据
-            var icbom_childs = _mysql_ic_bom_child.GetListAsync(s => s.tenant_id == 101).Result;
+            var icbom_childs = _mysql_ic_bom_child.GetListAsync().Result;
             if (icbom_childs.Count > 0)
             {
                 //先清空表数据

+ 2 - 0
MicroServices/Business/Business.EntityFrameworkCore/EntityFrameworkCore/Bang/BusinessBangDbContext.cs

@@ -43,6 +43,8 @@ namespace Business.EntityFrameworkCore
         public DbSet<b_order_detail> b_order_detail { get; set; }
 
         public DbSet<b_order_examine_result> b_order_examine_result { get; set; }
+
+        public DbSet<b_day_bulletin_board> b_day_bulletin_board { get; set; }
         #endregion
 
         public BusinessBangDbContext(DbContextOptions<BusinessBangDbContext> options)

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

@@ -0,0 +1,68 @@
+using Business.Core.Attributes;
+using Business.Model;
+using Microsoft.EntityFrameworkCore;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Bussiness.Model.Bang
+{
+    /// <summary>
+    /// 每天消耗物料明细
+    /// </summary>
+    [CollectionName("dopbang", "b_day_bulletin_board")]
+    [Comment("物料齐套明细")]
+    public class b_day_bulletin_board : BaseEntity
+    {
+        /// <summary>
+        /// 日期
+        /// </summary>
+        [Comment("日期")]
+        public string? day { get; set; }
+
+        /// <summary>
+        /// 物料名称
+        /// </summary>
+        [Comment("物料名称")]
+        public string? item_name { get; set; }
+
+        /// <summary>
+        /// 物料编码
+        /// </summary>
+        [Comment("物料编码")]
+        public string? item_number { get; set; }
+
+        /// <summary>
+        /// 库存占用数量
+        /// </summary>
+        [Comment("库存占用数量")]
+        public decimal? use_qty { get; set; }
+
+        /// <summary>
+        /// 自制数量
+        /// </summary>
+        [Comment("自制数量")]
+        public decimal? make_qty { get; set; }
+
+        /// <summary>
+        /// 在制占用数量
+        /// </summary>
+        [Comment("在制占用数量")]
+        public decimal? mo_qty { get; set; }
+
+        /// <summary>
+        /// 采购占用数量
+        /// </summary>
+        [Comment("采购占用数量")]
+        public decimal? purchase_occupy_qty { get; set; }
+
+        /// <summary>
+        /// 缺料数量
+        /// </summary>
+        [Comment("缺料数量")]
+        public decimal? self_lack_qty { get; set; }
+    }
+}

+ 8 - 0
MicroServices/Business/Bussiness.Model/Base/BaseEntity.cs

@@ -32,6 +32,14 @@ namespace Business.Model
             Id = snow.NextId();
         }
 
+        /// <summary>
+        /// 生成新的Id
+        /// </summary>
+        public void GenerateNewId(long id)
+        {
+            Id = id;
+        }
+
         /// <summary>
         /// 创建人
         /// </summary>