From 6b6c66cd99a4e73eea9bc68c8d7c63fd08180fb9 Mon Sep 17 00:00:00 2001
From: pan <antony1029@163.com>
Date: 星期二, 18 十一月 2025 16:12:46 +0800
Subject: [PATCH] 提交

---
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_OutboundService/SplitPackageService.cs |   36 +++++++++++++++++++++++++++++++-----
 1 files changed, 31 insertions(+), 5 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_OutboundService/SplitPackageService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_OutboundService/SplitPackageService.cs"
index 18b32f1..b0b9bab 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_OutboundService/SplitPackageService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_OutboundService/SplitPackageService.cs"
@@ -1,4 +1,5 @@
 锘縰sing Microsoft.AspNetCore.Http;
+using Microsoft.Extensions.Logging;
 using Org.BouncyCastle.Asn1.Ocsp;
 using System;
 using System.Collections.Generic;
@@ -9,6 +10,7 @@
 using WIDESEA_Core;
 using WIDESEA_Core.BaseRepository;
 using WIDESEA_Core.BaseServices;
+using WIDESEA_DTO.Basic;
 using WIDESEA_DTO.Outbound;
 using WIDESEA_IBasicService;
 using WIDESEA_IOutboundService;
@@ -26,14 +28,18 @@
         private readonly IStockInfoDetailService _stockInfoDetailService;
         private readonly IOutStockLockInfoService _outStockLockInfoService;
         private readonly IDailySequenceService _dailySequenceService;
+        private readonly IInvokeMESService _invokeMESService;
 
-        public SplitPackageService(IRepository<Dt_SplitPackageRecord> BaseDal, IUnitOfWorkManage unitOfWorkManage, IStockInfoService stockInfoService, IOutStockLockInfoService outStockLockInfoService, IStockInfoDetailService stockInfoDetailService, IDailySequenceService dailySequenceService) : base(BaseDal)
+        private readonly ILogger<SplitPackageService> _logger;
+        public SplitPackageService(IRepository<Dt_SplitPackageRecord> BaseDal, IUnitOfWorkManage unitOfWorkManage, IStockInfoService stockInfoService, IOutStockLockInfoService outStockLockInfoService, IStockInfoDetailService stockInfoDetailService, IDailySequenceService dailySequenceService, IInvokeMESService invokeMESService, ILogger<SplitPackageService> logger) : base(BaseDal)
         {
             _unitOfWorkManage = unitOfWorkManage;
             _stockInfoService = stockInfoService;
             _outStockLockInfoService = outStockLockInfoService;
             _stockInfoDetailService = stockInfoDetailService;
             _dailySequenceService = dailySequenceService;
+            _invokeMESService = invokeMESService;
+            _logger = logger;
         }
 
         /// <summary>
@@ -153,10 +159,30 @@
                 await Db.Insertable(splitHistory).ExecuteCommandAsync();
 
                 _unitOfWorkManage.CommitTran();
-
-                // 7. 鍥炰紶鏂版潯鐮佺粰MES
-                // await SendBarcodeToMES(newBarcode, request.MaterielCode, request.SplitQuantity);
-
+                              
+                try
+                {
+                    MaterielToMesDTO dto = new MaterielToMesDTO
+                    {
+                        batchNo = stockDetail.BatchNo,
+                        factoryArea = stockDetail.FactoryArea,
+                        materialCode = stockDetail.MaterielCode,
+                        newmaterialCode = newBarcode,
+                        oldmaterialCode = request.OriginalBarcode,
+                        operationType = 1,
+                        qty = remainingQty,
+                        supplyCode = stockDetail.SupplyCode,
+                        unit = stockDetail.BarcodeUnit,
+                        warehouseCode = stockDetail.WarehouseCode,
+                        reqCode = Guid.NewGuid().ToString(),
+                        reqTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
+                    };
+                    _invokeMESService.NewMaterielToMes(dto);
+                }
+                catch(Exception ex)
+                {
+                    _logger.LogError("SplitPackage 鍥炰紶MES:  " + ex.Message);
+                }
                 return WebResponseContent.Instance.OK("鎷嗗寘鎴愬姛", new
                 {
                     NewBarcode = newBarcode,

--
Gitblit v1.9.3