pan
2025-12-01 13c22c3a105e051af9d0c76adfc2f95833a684a8
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
@@ -51,6 +51,7 @@
using WIDESEA_IStockService;
using WIDESEA_ITaskInfoService;
using WIDESEA_Model.Models;
using WIDESEA_Model.Models.Outbound;
namespace WIDESEA_TaskInfoService
{
@@ -65,6 +66,7 @@
        private readonly IInboundOrderService _inboundOrderService;
        private readonly IInboundOrderDetailService _inboundOrderDetailService;
        private readonly IRepository<Dt_OutboundBatch> _OutboundBatchRepository;
        private readonly IOutboundOrderService _outboundOrderService;
        private readonly IOutboundOrderDetailService _outboundOrderDetailService;
        private readonly IOutStockLockInfoService _outStockLockInfoService;
@@ -93,7 +95,7 @@
        public List<int> TaskOutboundTypes => typeof(TaskTypeEnum).GetEnumIndexList();
        public TaskService(IRepository<Dt_Task> BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_StockInfo> stockRepository, ILocationInfoService locationInfoService, IInboundOrderService inboundOrderService, ILocationStatusChangeRecordService locationStatusChangeRecordService, IESSApiService eSSApiService, ILogger<TaskService> logger, IStockService stockService, IRecordService recordService, IInboundOrderDetailService inboundOrderDetailService, IOutboundOrderService outboundOrderService, IOutboundOrderDetailService outboundOrderDetailService, IInvokeMESService invokeMESService, IOutStockLockInfoService outStockLockInfoService, IAllocateService allocateService) : base(BaseDal)
        public TaskService(IRepository<Dt_Task> BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_StockInfo> stockRepository, ILocationInfoService locationInfoService, IInboundOrderService inboundOrderService, ILocationStatusChangeRecordService locationStatusChangeRecordService, IESSApiService eSSApiService, ILogger<TaskService> logger, IStockService stockService, IRecordService recordService, IInboundOrderDetailService inboundOrderDetailService, IOutboundOrderService outboundOrderService, IOutboundOrderDetailService outboundOrderDetailService, IInvokeMESService invokeMESService, IOutStockLockInfoService outStockLockInfoService, IAllocateService allocateService, IRepository<Dt_OutboundBatch> outboundBatchRepository) : base(BaseDal)
        {
            _mapper = mapper;
            _unitOfWorkManage = unitOfWorkManage;
@@ -111,6 +113,7 @@
            _invokeMESService = invokeMESService;
            _outStockLockInfoService = outStockLockInfoService;
            _allocateService = allocateService;
            _OutboundBatchRepository = outboundBatchRepository;
        }
@@ -270,16 +273,16 @@
            {
                foreach (var inboundOrder in inboundOrders)
                {
                    if (inboundOrder.OrderType == InOrderTypeEnum.Allocat.ObjToInt())//调拨入库
                    if (inboundOrder.OrderType == InOrderTypeEnum.AllocatInbound.ObjToInt())//调拨入库
                    {
                        if (inboundOrder != null && inboundOrder.OrderStatus == InOrderStatusEnum.入库完成.ObjToInt())
                        {
                            var allocate = _allocateService.Repository.QueryData(x => x.OrderNo == inboundOrder.InboundOrderNo).First();
                            var feedmodel = new AllocateDto
                            var allocatefeedmodel = new AllocateDto
                            {
                                ReqCode = Guid.NewGuid().ToString(),
                                ReqTime = DateTime.Now.ToString(),
                                BusinessType = "2",
                                BusinessType = "3",
                                FactoryArea = inboundOrder.FactoryArea,
                                OperationType = 1,
                                Operator = inboundOrder.Operator,
@@ -308,9 +311,9 @@
                                       Unit = row.Unit
                                   }).ToList()
                               }).ToList();
                            feedmodel.Details = groupedData;
                            allocatefeedmodel.Details = groupedData;
                            var result = await _invokeMESService.FeedbackAllocate(feedmodel);
                            var result = await _invokeMESService.FeedbackAllocate(allocatefeedmodel);
                            if (result != null && result.code == 200)
                            {
                                _inboundOrderService.Db.Updateable<Dt_InboundOrder>().SetColumns(it => new Dt_InboundOrder { ReturnToMESStatus = 1 })
@@ -322,6 +325,13 @@
                    }
                    else if (inboundOrder.OrderType == InOrderTypeEnum.ReCheck.ObjToInt()) //重检入库
                    {
                        //不需要回传。占一个位置。
                    }
                    else if (inboundOrder.OrderType == InOrderTypeEnum.InternalAllocat.ObjToInt()) //智仓调智仓
                    {
                        _logger.LogInformation($"InboundTaskCompleted å›žå†™MES  : {inboundOrder.InboundOrderNo }  ,ordertype: {InOrderTypeEnum.InternalAllocat.ObjToInt()} "  );
                        // BusinessTypeEnum.智仓调智仓
                    }
                    else
@@ -382,6 +392,13 @@
            return WebResponseContent.Instance.OK();
        }
        public async Task<WebResponseContent> OutAllocateTaskCompleted(Dt_Task task)
        {
            _logger.LogInformation($"TaskService  OutAllocateTaskCompleted: {task.TaskNum}");
           return  await OutboundTaskCompleted(task);
        }
        public async Task<WebResponseContent> OutboundTaskCompleted(Dt_Task task)
        {
            _logger.LogInformation($"TaskService  OutboundTaskCompleted: {task.TaskNum}");
@@ -583,6 +600,7 @@
                bool allCompleted = true;
                foreach (var detail in orderDetails)
                {
                    _logger.LogInformation($"TaskService  HandleOutboundOrderToMESCompletion: {outboundOrder.OrderNo} , {detail.NeedOutQuantity}");
                    if (detail.OverOutQuantity < detail.NeedOutQuantity)
                    {
                        allCompleted = false;
@@ -607,7 +625,7 @@
                    if (outboundOrder.OrderType == OutOrderTypeEnum.Allocate.ObjToInt())
                    {
                        var allocate = _allocateService.Repository.QueryData(x => x.UpperOrderNo == outboundOrder.UpperOrderNo).First();
                        var feedmodel = new AllocateDto
                        var allocatefeedmodel = new AllocateDto
                        {
                            ReqCode = Guid.NewGuid().ToString(),
                            ReqTime = DateTime.Now.ToString(),
@@ -650,10 +668,9 @@
                                }).ToList()
                            };
                            feedmodel.Details.Add(detailModel);
                            allocatefeedmodel.Details.Add(detailModel);
                        }
                        var result = await _invokeMESService.FeedbackAllocate(feedmodel);
                        var result = await _invokeMESService.FeedbackAllocate(allocatefeedmodel);
                        if (result != null && result.code == 200)
                        {
                            await _outboundOrderDetailService.Db.Updateable<Dt_OutboundOrderDetail>()
@@ -670,7 +687,7 @@
                    }
                    else if (outboundOrder.OrderType == OutOrderTypeEnum.ReCheck.ObjToInt())
                    {
                        //不用回传
                    }
                    else
                    {
@@ -711,14 +728,13 @@
                                    barcode = lockInfo.CurrentBarcode,
                                    supplyCode = lockInfo.SupplyCode,
                                    batchNo = lockInfo.BatchNo,
                                    unit = lockInfo.Unit,
                                    qty = lockInfo.PickedQty // æ¡ç çº§åˆ«çš„æ•°é‡ä»ç”¨é”å®šè®°å½•
                                    unit = lockInfo.BarcodeUnit,
                                    qty = lockInfo.BarcodeQty // æ¡ç çº§åˆ«çš„æ•°é‡ä»ç”¨é”å®šè®°å½•
                                }).ToList()
                            };
                            feedmodel.details.Add(detailModel);
                        }
                        var result = await _invokeMESService.FeedbackOutbound(feedmodel);
                        if (result != null && result.code == 200)
                        {