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

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

tangdi 3 лет назад
Родитель
Сommit
407fe9a946

+ 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));

+ 15 - 0
MicroServices/Business/Business.Application/ResourceExamineManagement/ResourceExamineAppService.cs

@@ -1283,6 +1283,7 @@ 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)
             {
@@ -1304,6 +1305,16 @@ namespace Business.ResourceExamineManagement
                     orderDetails.Add(detail);
                 });
             }
+
+            foreach (var item in rtn.DayBulletinBoardList)
+            {
+                var detail = ObjectMapper.Map<DayBulletinBoard, b_day_bulletin_board>(item);
+                detail.GenerateNewId();
+                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);
@@ -1312,6 +1323,10 @@ namespace Business.ResourceExamineManagement
             {
                 await _businessBangDbContext.b_order_detail.BulkInsertAsync(orderDetails, options => options.AutoMapOutputDirection = false);
             }
+            if (daybulletinboards.Any())
+            {
+                await _businessBangDbContext.b_day_bulletin_board.BulkInsertAsync(daybulletinboards, options => options.AutoMapOutputDirection = false);
+            }
             
             return JsonConvert.SerializeObject(rtn);
         }

+ 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)

+ 4 - 1
MicroServices/Business/Business.Host/Program.cs

@@ -4,6 +4,7 @@ using Business.Core.MongoDBHelper;
 using Microsoft.AspNetCore.Hosting;
 using Microsoft.Extensions.Configuration;
 using Microsoft.Extensions.Hosting;
+using NLog;
 using NLog.Web;
 using Serilog;
 using Serilog.Events;
@@ -21,7 +22,9 @@ namespace Business
                 .AddEnvironmentVariables()
                 .Build();
             NLog.Extensions.Logging.ConfigSettingLayoutRenderer.DefaultConfiguration = configuration;
-
+            var appBasePath = System.IO.Directory.GetCurrentDirectory();
+            NLog.GlobalDiagnosticsContext.Set("appbasepath", appBasePath);
+            var logger = LogManager.LoadConfiguration("nlog.config").GetCurrentClassLogger();
             Log.Logger = new LoggerConfiguration()
 #if DEBUG
                 .MinimumLevel.Debug()

+ 3 - 3
MicroServices/Business/Business.Host/nlog.config

@@ -4,7 +4,7 @@
       autoReload="true"
 	  throwExceptions="true"
       internalLogLevel="Info"
-      internalLogFile="${basedir}/NLog/${date:format=yyyyMM}/Bussiness.txt">
+      internalLogFile="${gdc:item=appbasepath}\log\internal-nlog.txt">
 	<extensions>
 		<add assembly="NLog.Web.AspNetCore"/>
 	</extensions>
@@ -15,8 +15,8 @@
 		<!--把日志输出到控制台 -->
 		<target xsi:type="Console" name="lifetimeConsole" layout="${level:truncate=4:tolower=true}: ${logger}[0]${newline}      ${message}${exception:format=tostring}" />
 		<!-- 把日志记录到文件(通用) -->
-		<target xsi:type="File" name="allfile" fileName="${basedir}\..\Log\${date:format=yyyyMM}\${var:AppName}-all-${shortdate}.txt" encoding="UTF-8"
-            archiveFileName="${basedir}\..\Log\WMSAPI-all-${shortdate}.{#}.txt" archiveAboveSize="10485760"
+		<target xsi:type="File" name="allfile" fileName="${gdc:item=appbasepath}\logs\nlog-${shortdate}.log" encoding="UTF-8"
+            archiveFileName="${gdc:item=appbasepath}\logs\nlog-${shortdate}.{#}.log" archiveAboveSize="10485760"
             layout="${longdate}|${event-properties:item=EventId_Id:whenEmpty=0}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}" />
 		<!--把日志输出到数据库 -->
 		<target xsi:type="Database" name="database" dbProvider="MySqlConnector.MySqlConnection, MySqlConnector" connectionString="${configsetting:item=ConnectionStrings.DOPLog}">

+ 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; }
+    }
+}