From 77bc3a65b83a58c9fc30fb80679a93bc45a2cb84 Mon Sep 17 00:00:00 2001
From: z8018 <1282578289@qq.com>
Date: 星期四, 18 十二月 2025 19:11:22 +0800
Subject: [PATCH] 修复前端拣选页面问题

---
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs |   34 ++++++++++++++++++++++++----------
 1 files changed, 24 insertions(+), 10 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_TaskInfoService/TaskService.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_TaskInfoService/TaskService.cs"
index 8405d4c..922cf88 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_TaskInfoService/TaskService.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_TaskInfoService/TaskService.cs"
@@ -90,6 +90,7 @@
         private readonly ITask_HtyService _task_HtyService;
         private readonly IRepository<Dt_AllocateMaterialInfo> _allocateMaterialInfo;
         private readonly IRepository<Dt_AllocateMaterialInfo_Hty> _allocateMaterialInfo_Hty;
+        private readonly HttpClientHelper _httpClientHelper;
         public IRepository<Dt_Task> Repository => BaseDal;
 
         private Dictionary<string, SqlSugar.OrderByType> _taskOrderBy = new()
@@ -109,7 +110,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) : 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) : base(BaseDal)
         {
             _mapper = mapper;
             _unitOfWorkManage = unitOfWorkManage;
@@ -135,6 +136,7 @@
             _task_HtyService = task_HtyService;
             _allocateMaterialInfo = allocateMaterialInfo;
             _allocateMaterialInfo_Hty = allocateMaterialInfo_Hty;
+            _httpClientHelper = httpClientHelper;
         }
 
         public async Task TaskStatusChange(string taskNum, TaskStatusEnum taskStatusEnum)
@@ -358,8 +360,10 @@
                                }).ToList();
                             allocatefeedmodel.Details = groupedData;
 
-                            var feedbackresult = await _invokeMESService.FeedbackAllocate(allocatefeedmodel);
-                            if (feedbackresult != null && feedbackresult.code == 200)
+                            //var feedbackresult = await _invokeMESService.FeedbackAllocate(allocatefeedmodel);
+
+                            var response = responseModel(inboundOrder, 3, null, allocatefeedmodel);
+                            if (response != null && response.IsSuccess)
                             {
                                 _inboundOrderService.Db.Updateable<Dt_InboundOrder>().SetColumns(it => new Dt_InboundOrder { ReturnToMESStatus = 1 })
                                 .Where(it => it.Id == inboundOrder.Id).ExecuteCommand();
@@ -464,7 +468,7 @@
 
                             //var feedbackresult = await _invokeMESService.FeedbackInbound(feedmodel);
 
-                            var response= responseModel(feedmodel, inboundOrder);
+                            var response= responseModel(inboundOrder,2, feedmodel);
 
                             if (response != null && response.IsSuccess)
                             {
@@ -493,15 +497,25 @@
             return WebResponseContent.Instance.OK();
         }
 
-        public HttpResponseResult<MesResponseDTO> responseModel(FeedbackInboundRequestModel model,Dt_InboundOrder order)
+        public HttpResponseResult<MesResponseDTO> responseModel(Dt_InboundOrder order, int InterfaceType, FeedbackInboundRequestModel model = null, AllocateDto allocateDto = null)
         {
             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;
-            //string apiUrl = AppSettings.GetValue("AllocationFeedbackUrl");
-            string apiUrl = "http://127.0.0.1:450/api/AldMaterialWarehousing/MaterialWarehousing";
-            httpResponseResult = _httpClientHelper.Post<MesResponseDTO>(apiUrl, model.Serialize());
+            string apiUrl = string.Empty;            
+            if (model != null)
+            {
+                apiUrl = AppSettings.GetValue("AldMaterialWarehousing");
+                httpResponseResult = _httpClientHelper.Post<MesResponseDTO>(apiUrl, model.Serialize());
+                requestData = model.Serialize();
+            }
+            else
+            {
+                apiUrl = AppSettings.GetValue("AldAllocationOperation");
+                httpResponseResult = _httpClientHelper.Post<MesResponseDTO>(apiUrl, allocateDto.Serialize());
+                requestData = allocateDto.Serialize(); 
+            }
             httpResponseResult.ApiUrl = apiUrl;
             bool isSuccess = httpResponseResult.IsSuccess && httpResponseResult.Data.Code == "200";
             string message = "鎴愬姛";
@@ -519,7 +533,7 @@
             Dt_MesReturnRecord mesReturnRecord = new Dt_MesReturnRecord()
             {
                 ApiUrl = httpResponseResult.ApiUrl,
-                InterfaceType = 2,
+                InterfaceType = InterfaceType,
                 OrderId = order.Id,
                 OrderNo = order.InboundOrderNo,
                 RequestCode = reqCode,
@@ -534,7 +548,7 @@
                 SuccessTime = httpResponseResult.IsSuccess ? DateTime.Now : null
             };
             _unitOfWorkManage.Db.Insertable(mesReturnRecord).ExecuteCommand();
-            
+
             return httpResponseResult;
         }
 

--
Gitblit v1.9.3