647556386
2026-01-27 1378fc4cd7abc24ed3a982e09437c2c8a74e9f2f
代码优化
已修改10个文件
152 ■■■■■ 文件已修改
项目代码/WIDESEA_WMSClient/src/extension/outbound/extend/EmptyTrayOutbound.vue 53 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WIDESEA_WMSClient/src/views/outbound/outboundOrder.vue 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_BasicService/LocationInfoService.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_BasicService/MESOperation/FeedbackMesService.cs 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_DTO/Outbound/OutboundOrderAddDTO.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_InboundService/InboundService.cs 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_InboundService/TakeStockOrderService.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundService.cs 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs 50 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Outbound/OutboundOrderController.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ÏîÄ¿´úÂë/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>
ÏîÄ¿´úÂë/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",
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/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>
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/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)
                        {
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/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; }
    }
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/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}不存在空闲库位");
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/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,
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/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) ?? "",
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/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)
            {
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/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);