pan
2025-11-18 6b6c66cd99a4e73eea9bc68c8d7c63fd08180fb9
项目代码/WMS无仓储版/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>
@@ -154,9 +160,29 @@
                _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,