From 1378fc4cd7abc24ed3a982e09437c2c8a74e9f2f Mon Sep 17 00:00:00 2001
From: 647556386 <647556386@qq.com>
Date: 星期二, 27 一月 2026 19:06:32 +0800
Subject: [PATCH] 代码优化

---
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_BasicService/MESOperation/FeedbackMesService.cs           |   10 +++
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs                    |   50 ++--------------
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundService.cs                        |   16 ++++
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_BasicService/LocationInfoService.cs                       |    2 
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Outbound/OutboundOrderController.cs |    1 
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_InboundService/InboundService.cs                          |    6 +
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_InboundService/TakeStockOrderService.cs                   |    5 +
 项目代码/WIDESEA_WMSClient/src/extension/outbound/extend/EmptyTrayOutbound.vue                       |   53 +++++++++++++++--
 项目代码/WIDESEA_WMSClient/src/views/outbound/outboundOrder.vue                                      |    7 ++
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_DTO/Outbound/OutboundOrderAddDTO.cs                       |    2 
 10 files changed, 96 insertions(+), 56 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/outbound/extend/EmptyTrayOutbound.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/outbound/extend/EmptyTrayOutbound.vue"
index 3460293..e368a58 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/outbound/extend/EmptyTrayOutbound.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/outbound/extend/EmptyTrayOutbound.vue"
@@ -4,7 +4,10 @@
       <el-form ref="form" :model="form" label-width="90px">
         <el-form-item label="鍑哄簱鍖哄煙:">
           <el-select v-model="locationType" placeholder="璇烽�夋嫨鍑哄簱鍖哄煙">
-            <el-option v-for="item in locationTypes" :key="item.locationType" :label="item.locationTypeDesc.toString()"
+            <el-option 
+              v-for="item in locationTypes" 
+              :key="item.locationType" 
+              :label="item.locationTypeDesc.toString()"
               :value="item.locationType">
             </el-option>
           </el-select>
@@ -12,17 +15,34 @@
       </el-form>
       <el-form ref="form" :model="form" label-width="90px">
         <el-form-item label="鍑哄簱鏁伴噺:">
-          <el-input-number v-model="num" :min="1" :max="999" :controls="true" placeholder="璇烽�夋嫨鍑哄簱鏁伴噺"
-            style="width: 100%;"></el-input-number>
+          <el-input-number 
+            v-model="num" 
+            :min="1" 
+            :max="999" 
+            :controls="true" 
+            placeholder="璇烽�夋嫨鍑哄簱鏁伴噺"
+            style="width: 100%;">
+          </el-input-number>
         </el-form-item>
       </el-form>
     </template>
     <template #footer>
       <div>
-        <el-button type="danger" size="small" plain @click="submit">
+        <!-- 娣诲姞loading鐘舵�佸拰disabled灞炴�� -->
+        <el-button 
+          type="danger" 
+          size="small" 
+          plain 
+          @click="submit"
+          :loading="isSubmitting"
+          :disabled="isSubmitting">
           <i class="el-icon-check">纭</i>
         </el-button>
-        <el-button size="small" type="primary" plain @click="() => { this.show = false }">
+        <el-button 
+          size="small" 
+          type="primary" 
+          plain 
+          @click="() => { this.show = false }">
           <i class="el-icon-close">鍏抽棴</i>
         </el-button>
       </div>
@@ -42,6 +62,8 @@
       show: false,
       locationTypes: [],
       locationType: "",
+      // 鏂板鎻愪氦鐘舵�佹爣璇�
+      isSubmitting: false
     }
   },
   methods: {
@@ -50,6 +72,15 @@
       this.getData();
     },
     submit() {
+      // 1. 楠岃瘉蹇呭~椤�
+      if (!this.locationType) {
+        this.$message.warning('璇烽�夋嫨鍑哄簱鍖哄煙');
+        return;
+      }
+      
+      // 2. 璁剧疆鎻愪氦鐘舵�佷负true锛岀鐢ㄦ寜閽�
+      this.isSubmitting = true;
+      
       this.$emit('parentCall', ($vue) => {
         this.http.post(`/api/Task/PalletOutboundTask?num=${this.num}&locationType=${this.locationType}`, {}, '鏁版嵁澶勭悊涓�...')
           .then((x) => {
@@ -61,9 +92,17 @@
               $vue.refresh();
             }
           })
+          .catch((error) => {
+            // 鎹曡幏璇锋眰寮傚父锛屾彁绀虹敤鎴�
+            this.$message.error('璇锋眰澶辫触锛岃绋嶅悗閲嶈瘯');
+            console.error('鎻愪氦澶辫触:', error);
+          })
+          .finally(() => {
+            // 3. 璇锋眰瀹屾垚锛堟垚鍔�/澶辫触锛夊悗閲嶇疆鎻愪氦鐘舵��
+            this.isSubmitting = false;
+          });
       })
     },
-
     getData() {
       this.http.post("api/LocationInfo/GetLocationTypes", null, "鏌ヨ涓�")
         .then((x) => {
@@ -72,4 +111,4 @@
     },
   }
 }
-</script>
+</script>
\ No newline at end of file
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/outbound/outboundOrder.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/outbound/outboundOrder.vue"
index ff541ea..6666ae3 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/outbound/outboundOrder.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/outbound/outboundOrder.vue"
@@ -206,6 +206,13 @@
         align: "left"
       },
       {
+        field: "departmentName",
+        title: "鎷夌嚎鍚嶇О",
+        type: "string",
+        width: 120,
+        align: "left"
+      },
+      {
         field: "departmentCode",
         title: "淇敼鏃堕棿",
         type: "string",
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_BasicService/LocationInfoService.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_BasicService/LocationInfoService.cs"
index 68178ef..c93a8eb 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_BasicService/LocationInfoService.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_BasicService/LocationInfoService.cs"
@@ -116,7 +116,7 @@
 
         private readonly static object _locker = new object();
         static List<LocationCache> locationCaches = new List<LocationCache>();
-        private int locationCacheTime = 20;
+        private int locationCacheTime = 10;
         /// <summary>
         /// 
         /// </summary>
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_BasicService/MESOperation/FeedbackMesService.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_BasicService/MESOperation/FeedbackMesService.cs"
index 00e76f5..038f964 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_BasicService/MESOperation/FeedbackMesService.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_BasicService/MESOperation/FeedbackMesService.cs"
@@ -109,7 +109,15 @@
                     {
                         if (returnRecords.Count() == returnRecords.Count(x => x.ReturnStatus == 1))
                         {
-                            outboundOrder.ReturnToMESStatus = 1;
+                            if(outboundOrder.OrderStatus != OutOrderStatusEnum.鍑哄簱瀹屾垚.ObjToInt())
+                            {
+                                outboundOrder.ReturnToMESStatus = 3;
+                            }
+                            else
+                            {
+                                outboundOrder.ReturnToMESStatus = 1;
+                            }
+                            
                         }
                         else if (returnRecords.Count(x => x.ReturnStatus == 2) > 0)
                         {
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_DTO/Outbound/OutboundOrderAddDTO.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_DTO/Outbound/OutboundOrderAddDTO.cs"
index 13efd64..9c7fcb1 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_DTO/Outbound/OutboundOrderAddDTO.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_DTO/Outbound/OutboundOrderAddDTO.cs"
@@ -75,6 +75,8 @@
 
         public int operationType { get; set; }
 
+        public string lineName { get; set; }
+
         public List<OutBoundDetailsModel> details { get; set; }
 
     }
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_InboundService/InboundService.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_InboundService/InboundService.cs"
index 5990115..0f239c0 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_InboundService/InboundService.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_InboundService/InboundService.cs"
@@ -167,7 +167,11 @@
                 {
                     return content.Error($"璇ユ墭鐩樼粍鐩樹粨搴撲负{stockInfo.Details.FirstOrDefault()?.WarehouseCode}涓庡綋鍓嶄粨搴搟palletDto.WarehouseType}涓嶄竴鑷达紝涓嶅厑璁哥粍鐩�");
                 }
-
+                var isWarehouse = _inboundOrderDetailRepository.QueryFirst(x => x.OrderId == inboundOrder.Id && !string.IsNullOrEmpty(x.WarehouseCode));
+                if (isWarehouse != null && inboundOrder.BusinessType == "11" && isWarehouse.WarehouseCode != palletDto.WarehouseType)
+                {
+                    return content.Error($"涓�涓噰璐崟鎹噷闈笉鍏佽缁勭洏涓や釜浠撳簱锛岃閲嶆柊閫夋嫨浠撳簱锛屼笂涓�涓粍鐩樹粨搴撲负{isWarehouse.WarehouseCode}");
+                }
                 if (!_locationInfoService.QueryLocationCount(Convert.ToInt32(palletDto.locationType)))
                 {
                     return content.Error($"璇ュ簱鍖簕palletDto.locationType}涓嶅瓨鍦ㄧ┖闂插簱浣�");
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_InboundService/TakeStockOrderService.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_InboundService/TakeStockOrderService.cs"
index ded4b28..abfb087 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_InboundService/TakeStockOrderService.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_InboundService/TakeStockOrderService.cs"
@@ -259,6 +259,11 @@
                 // 鍒嗛厤鏂拌揣浣�
                 var newLocation = _locationInfoService.AssignLocation(stock.LocationType);
 
+                if (newLocation == null)
+                {
+                    return WebResponseContent.Instance.Error("娌℃湁绌洪棽搴撲綅鍙洖搴�");
+                }
+
                 var newTask = new Dt_Task()
                 {
                     CurrentAddress = takeStockOrder.Remark,
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/OutboundService.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/OutboundService.cs"
index 26c2a23..0e2a158 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/OutboundService.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/OutboundService.cs"
@@ -209,7 +209,7 @@
                 string responseMsg = totalActualAllocate == totalNeedAllocate
                     ? "鍒嗘嫞浠诲姟鍒嗛厤鎴愬姛"
                     : $"鍒嗘嫞浠诲姟鍒嗛厤瀹屾垚锛堝疄闄呭垎閰峽totalActualAllocate}锛岄渶姹倇totalNeedAllocate}锛屽簱瀛樹笉瓒抽儴鍒嗘湭鍒嗛厤锛�";
-                if(totalActualAllocate == 0)
+                if(totalActualAllocate == 0 && !outboundOrder.Details.Any(x=>x.LockQuantity >0))
                 {
                     UpdateOutboundOrderStatus(request.OrderNo, (int)OutOrderStatusEnum.鏈紑濮�);
                     return WebResponseContent.Instance.Error("鍒嗛厤搴撳瓨鏁伴噺涓�0锛屾棤娉曞嚭搴�");
@@ -1490,8 +1490,15 @@
                         {
                             barcodeQuantity = item.LockQuantity - item.OverOutQuantity;
                             allocatedQuantity -= (item.LockQuantity - item.OverOutQuantity);
+                            if (item.ReturnToMESStatus == 0)
+                            {
+                                item.CurrentDeliveryQty = item.LockQuantity;
+                            }
+                            else
+                            {
+                                item.CurrentDeliveryQty += item.LockQuantity - item.OverOutQuantity;
+                            }
                             item.OverOutQuantity = item.LockQuantity;
-                            item.CurrentDeliveryQty = item.LockQuantity;
                         }
 
                         updateDetails.Add(item);
@@ -2022,6 +2029,11 @@
                 // 鍒嗛厤鏂拌揣浣�
                 var newLocation = _locationInfoService.AssignLocation(stock.LocationType);
 
+                if(newLocation == null)
+                {
+                    return WebResponseContent.Instance.Error("娌℃湁绌洪棽搴撲綅鍙洖搴�");
+                }
+
                 var newTask = new Dt_Task()
                 {
                     CurrentAddress = stations.GetValueOrDefault(station) ?? "",
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_Inbound.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_Inbound.cs"
index 15db8e1..c025179 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_Inbound.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_Inbound.cs"
@@ -133,52 +133,14 @@
                     _stockRepository.UpdateData(stockInfo);
                     _unitOfWorkManage.CommitTran();
                 }
-                //TaskModel esstask = new TaskModel()
-                //{
-                //    taskType = "putaway",
-                //    taskGroupCode = "",
-                //    groupPriority = 0,
-                //    tasks = new List<TasksType>
-                //    {
-                //            new()
-                //            {
-                //                taskCode=newTask.TaskNum.ToString(),
-                //                taskPriority=0,
-                //                taskDescribe=new TaskDescribeType{
-                //                containerCode=palletCode,
-                //                containerType= "CT_KUBOT_STANDARD",
-                //                fromLocationCode=stations.GetValueOrDefault(stationCode)??"",
-                //                toStationCode="",
-                //                toLocationCode=locationInfo.LocationCode,
-                //                deadline=0,storageTag=""
-                //                }
-                //            }
-                //    }
-                //};
- 
-                //var result = await _eSSApiService.CreateTaskAsync(esstask);
-
-                //_logger.LogInformation("鍒涘缓浠诲姟杩斿洖:  " + result);
-                //if (result)
+                await _eSSApiService.MoveContainerAsync(new WIDESEA_DTO.Basic.MoveContainerRequest
                 {
-                    try
-                    {
-                        await _eSSApiService.MoveContainerAsync(new WIDESEA_DTO.Basic.MoveContainerRequest
-                        {
-                            slotCode = stationCode,
-                            containerCode = palletCode
-                        });
-                    }
-                    catch (Exception ex) { 
-                    
+                    slotCode = stationCode,
+                    containerCode = palletCode
+                });
 
-                    }
-                    return WebResponseContent.Instance.OK();
-                }
-                //else
-                //{
-                //    return WebResponseContent.Instance.Error("涓嬪彂鏈哄櫒浜轰换鍔″け璐ワ紒");
-                //}
+            return WebResponseContent.Instance.OK();
+                
             }
             catch (Exception ex)
             {
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_WMSServer/Controllers/Outbound/OutboundOrderController.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_WMSServer/Controllers/Outbound/OutboundOrderController.cs"
index 7d21e90..088b88d 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_WMSServer/Controllers/Outbound/OutboundOrderController.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_WMSServer/Controllers/Outbound/OutboundOrderController.cs"
@@ -64,6 +64,7 @@
             dt_OutboundOrder.IsBatch = model.isBatch;
             dt_OutboundOrder.FactoryArea = model.factoryArea;
             dt_OutboundOrder.CreateType = OrderCreateTypeEnum.UpperSystemPush.ObjToInt();
+            dt_OutboundOrder.DepartmentName = model.lineName??"";
 
             var content =await Service.ReceiveOutboundOrder(dt_OutboundOrder, model.operationType);
 

--
Gitblit v1.9.3