1
647556386
2025-12-18 d9ec03b2322334f4ade52b3e9ec69517e2ddf314
1
已修改2个文件
82 ■■■■■ 文件已修改
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundService.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs 81 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundService.cs
@@ -1486,7 +1486,6 @@
                    {
                        UpdateOutboundOrderStatus(request.OrderNo, OutOrderStatusEnum.出库完成.ObjToInt());
                        //todo: å›žä¼ MES
                    }
                }
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
@@ -43,6 +43,7 @@
using WIDESEA_Core.Helper;
using WIDESEA_Core.Util;
using WIDESEA_DTO.Allocate;
using WIDESEA_DTO.Base;
using WIDESEA_DTO.Basic;
using WIDESEA_DTO.Inbound;
using WIDESEA_DTO.Outbound;
@@ -91,6 +92,7 @@
        private readonly IRepository<Dt_AllocateMaterialInfo> _allocateMaterialInfo;
        private readonly IRepository<Dt_AllocateMaterialInfo_Hty> _allocateMaterialInfo_Hty;
        private readonly HttpClientHelper _httpClientHelper;
        private readonly IBasicService _basicService;
        public IRepository<Dt_Task> Repository => BaseDal;
        private Dictionary<string, SqlSugar.OrderByType> _taskOrderBy = new()
@@ -110,7 +112,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, IRepository<Dt_OutboundBatch> outboundBatchRepository, IRepository<Dt_ReCheckOrder> reCheckOrderRepository, IRepository<Dt_AllocateOrderDetail> allocateOrderDetailRepository, IRepository<Dt_AllocateOrder> allocateOrderRepository, IMaterialUnitService materialUnitService, ITask_HtyService task_HtyService, IRepository<Dt_AllocateMaterialInfo> allocateMaterialInfo, IRepository<Dt_AllocateMaterialInfo_Hty> allocateMaterialInfo_Hty, HttpClientHelper httpClientHelper) : 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, IRepository<Dt_ReCheckOrder> reCheckOrderRepository, IRepository<Dt_AllocateOrderDetail> allocateOrderDetailRepository, IRepository<Dt_AllocateOrder> allocateOrderRepository, IMaterialUnitService materialUnitService, ITask_HtyService task_HtyService, IRepository<Dt_AllocateMaterialInfo> allocateMaterialInfo, IRepository<Dt_AllocateMaterialInfo_Hty> allocateMaterialInfo_Hty, HttpClientHelper httpClientHelper, IBasicService basicService) : base(BaseDal)
        {
            _mapper = mapper;
            _unitOfWorkManage = unitOfWorkManage;
@@ -137,6 +139,7 @@
            _allocateMaterialInfo = allocateMaterialInfo;
            _allocateMaterialInfo_Hty = allocateMaterialInfo_Hty;
            _httpClientHelper = httpClientHelper;
            _basicService = basicService;
        }
        public async Task TaskStatusChange(string taskNum, TaskStatusEnum taskStatusEnum)
@@ -738,6 +741,33 @@
                {
                    await Db.Deleteable(task).ExecuteCommandAsync();
                }
                Dt_OutboundOrder outboundOrder = _outboundOrderService.Db.Queryable<Dt_OutboundOrder>().Where(x => x.OrderNo == stockInfo.Details.FirstOrDefault().OrderNo).Includes(x=>x.Details).First();
                if(outboundOrder.OrderStatus == OutOrderStatusEnum.出库完成.ObjToInt())
                {
                    HttpResponseResult<MesResponseDTO> httpResponseResult = new HttpResponseResult<MesResponseDTO>();
                    string reqCode = Guid.NewGuid().ToString();
                    string reqTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                    string requestData = string.Empty;
                    List<string> lineNos = new List<string>();
                    Dt_AllocateOrder allocateOrder = _allocateOrderRepository.QueryFirst(x => x.OrderNo == outboundOrder.OrderNo);
                    if (allocateOrder == null)
                    {
                        return WebResponseContent.Instance.Error($"未找到对应的调拨单");
                    }
                    AllocationReturnDTO? returnDTO = BuildAllocationFeedbackData(outboundOrder, allocateOrder.FromWarehouse, allocateOrder.ToWarehouse);
                    if (returnDTO == null)
                    {
                        return WebResponseContent.Instance.Error($"构建回调对象失败");
                    }
                    string apiUrl = AppSettings.GetValue("AllocationFeedbackUrl"); ;
                    returnDTO.ReqCode = reqCode;
                    returnDTO.ReqTime = reqTime;
                    requestData = returnDTO.Serialize();
                    lineNos = returnDTO.Details.Select(x => x.LineNo).ToList();
                    httpResponseResult = _httpClientHelper.Post<MesResponseDTO>(apiUrl, requestData);
                    httpResponseResult.ApiUrl = apiUrl;
                }
                try
                {
                    _locationStatusChangeRecordService.AddLocationStatusChangeRecord(locationInfo, beforelocationStatus, StockChangeType.Inbound.ObjToInt(), "", task.TaskNum);
@@ -755,6 +785,55 @@
            }
        }
        public AllocationReturnDTO? BuildAllocationFeedbackData(Dt_OutboundOrder outboundOrder, string fromWarehouse, string toWarehouse)
        {
            try
            {
                List<Dt_OutboundOrderDetail> details = outboundOrder.Details;
                List<AllocationDetail> returnDetails = new List<AllocationDetail>();
                foreach (var detail in details)
                {
                    List<Barcodes>? barcodes = JsonConvert.DeserializeObject<List<Barcodes>>(detail.ReturnJsonData);
                    if (barcodes != null && barcodes.Any())
                    {
                        UnitConvertResultDTO currentResult = _basicService.UnitQuantityConvert(detail.MaterielCode, detail.Unit, detail.BarcodeUnit, detail.CurrentDeliveryQty);
                        UnitConvertResultDTO totalResult = _basicService.UnitQuantityConvert(detail.MaterielCode, detail.Unit, detail.BarcodeUnit, detail.OrderQuantity);
                        returnDetails.Add(new AllocationDetail
                        {
                            Barcodes = barcodes,
                            BatchNo = detail.BatchNo,
                            LineNo = detail.lineNo,
                            MaterialCode = detail.MaterielCode,
                            Qty = totalResult.ToQuantity,
                            WarehouseCode = detail.WarehouseCode,
                            Unit = detail.BarcodeUnit
                        });
                    }
                }
                AllocationReturnDTO outboundReturnDTO = new AllocationReturnDTO()
                {
                    Business_type = outboundOrder.BusinessType,
                    Details = returnDetails,
                    FactoryArea = outboundOrder.FactoryArea,
                    OperationType = 1,
                    OrderNo = outboundOrder.OrderNo,
                    FromWarehouse = fromWarehouse,
                    ToWarehouse = toWarehouse
                };
                return outboundReturnDTO;
            }
            catch (Exception ex)
            {
                return null;
            }
        }
        public async Task<WebResponseContent> InPickTaskCompleted(Dt_Task task)
        {