1
heshaofeng
2025-11-09 f747c5151051c12a1c44eaf5ef49f0a3805702b0
1
已添加1个文件
已修改6个文件
195 ■■■■■ 文件已修改
项目代码/WIDESEA_WMSClient/src/extension/inbound/extend/Pallet.vue 47 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WIDESEA_WMSClient/src/extension/inbound/inboundOrder.js 59 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WIDESEA_WMSClient/src/extension/outbound/outboundOrder.js 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_DTO/Inbound/PalletSumQuantityDTO.cs 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_IInboundService/IInboundOrderService.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Inbound/InboundOrderController.cs 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ÏîÄ¿´úÂë/WIDESEA_WMSClient/src/extension/inbound/extend/Pallet.vue
@@ -126,6 +126,8 @@
            <span><i class="el-icon-tickets"></i> ç»„盘数据</span>
            <span class="list-actions">
              <el-tag type="primary">共 {{ materials.length }} æ¡è®°å½•</el-tag>
              <el-tag type="primary">已组盘 {{ totalStockCount }}</el-tag>
              <el-tag type="primary">库存数量 {{ totalStockSum }}<span>{{ uniqueUnit }}</span></el-tag>
              <el-tag v-if="trayBarcode" type="success">托盘: {{ trayBarcode }}</el-tag>
    <!--           <el-button 
                v-if="materials.length > 0"
@@ -197,6 +199,7 @@
import VolTable from '@/components/basic/VolTable.vue';
import { ElLoading, ElMessage,ElMessageBox  } from 'element-plus';
import { ref, onMounted, onUnmounted } from 'vue'
import InboundOrder from '../../../views/inbound/inboundOrder.vue';
export default {
  name: 'BarcodeScanner',
@@ -225,6 +228,13 @@
          scanTimer: null,
          manualInputTimer: null,
          scanTarget: 'tray', // å½“前扫码目标: tray æˆ– material
          // åº“存统计相关变量
          totalStockSum: 0,
          totalStockCount: 0,
          uniqueUnit: '',
          sumLoading: false,
          sumError: ''
    }
  },
  computed: {
@@ -245,6 +255,7 @@
      this.$nextTick(() => {
        setTimeout(() => {
          this.focusTrayInput();
          this.fetchStockStatistics(); // åŠ è½½ç»Ÿè®¡æ•°æ®
        }, 300);
      });
    }
@@ -263,6 +274,7 @@
        this.palletForm = { palletCode: '', barcode: '' };
        this.backData = [];
        this.$refs.palletForm?.reset();
        this.fetchStockStatistics(); // å•据号变了,刷新统计
      }
    }
  },
@@ -283,6 +295,37 @@
         this.clearAllTimers();
      },
      methods: {
        // æ–°å¢žï¼šæŸ¥è¯¢åŽç«¯åº“存统计数据(调用之前的 SumQuantity æŽ¥å£ï¼‰
    async fetchStockStatistics() {
      // å•据号为空时不查询
      if (!this.docNo) {
        this.sumError = '单据号为空,无法统计';
        return;
      }
      this.sumLoading = true;
      this.sumError = '';
      try {
        // è°ƒç”¨åŽç«¯ç»Ÿè®¡æŽ¥å£ï¼ˆæ›¿æ¢ä¸ºä½ çš„实际接口路径)
        const response = await http.post('/api/InboundOrder/UnPalletQuantity?orderNo='+this.docNo, {
        });
        // ç»‘定数据(匹配 PalletSumQuantityDTO ç»“构)
        if (response.data) {
          this.totalStockSum = response.data.stockSumQuantity || 0; // æ€»åº“存数量
          this.totalStockCount = response.data.stockCount || 0;     // æ€»åº“存记录数
          this.uniqueUnit = response.data.uniqueUnit || '';               // è®¡é‡å•位
        }
      } catch (err) {
        this.sumError = '统计加载失败';
        this.totalStockSum = 0;
        this.totalStockCount = 0;
        console.error('库存统计查询异常:', err);
      } finally {
        this.sumLoading = false;
      }
    },
         // é‡ç½®æ‰€æœ‰æ•°æ®
    resetData() {
      console.log('重置弹框数据');
@@ -298,6 +341,10 @@
      this.currentFocus = 'tray';
      this.scanTarget = 'tray';
      this.clearAllTimers();
      this.totalStockSum = 0;
      this.totalStockCount = 0;
      this.sumLoading = false;
      this.sumError = '';
    },
    
    // æ¸…除所有计时器
ÏîÄ¿´úÂë/WIDESEA_WMSClient/src/extension/inbound/inboundOrder.js
@@ -40,12 +40,57 @@
          const targetRow = selectedRows[0];
     
          this.$emit('openPalletDialog', targetRow.inboundOrderNo);
        }
      },
      {
  name: '分批入库',
  type: 'primary',
  value: '分批入库',
  onClick: async function () {
    console.log('分批入库按钮被点击,开始校验');
    const selectedRows = this.$refs.table.getSelected();
    // æ ¡éªŒ1:是否选中行(至少选择一条)
    if (selectedRows.length === 0) {
      console.log('校验不通过:未选中任何单据');
      ElMessage.warning('请选择至少一条单据');
      return;
    }
    // æ”¶é›†æ‰€æœ‰é€‰ä¸­å•据的编号(过滤无单据号的异常行)
    const inboundOrderNos = selectedRows
      .filter(row => row.inboundOrderNo)
      .map(row => row.inboundOrderNo);
    // æ ¡éªŒ2:是否有有效单据号
    if (inboundOrderNos.length === 0) {
      console.log('校验不通过:选中单据无有效编号');
      ElMessage.warning('选中的单据中无有效编号,请重新选择');
      return;
    }
    try {
      console.log('发起分批入库请求,参数:', { inboundOrderNos});
      const response = await http.post('/api/InboundOrder/BatchInbound', {
        inboundOrderNos: inboundOrderNos,
      });
      const { status, message, data } = response;
      if (status) {
        console.log('分批入库成功,后端返回:', data);
        ElMessage.success(`分批入库成功!共处理${inboundOrderNos.length}条单据`);
        this.refresh(); // å…¥åº“成功后刷新列表(复用原有逻辑)
      } else {
        console.log('分批入库失败,后端提示:', message);
        ElMessage.error(message || data?.message || '分批入库失败');
      }
    } catch (error) {
      console.error('分批入库请求异常:', error);
      ElMessage.error('网络异常或接口错误,请稍后重试');
    }
  }
},
     {
  name: '空托盘入库',
  type: 'primary',
@@ -76,16 +121,16 @@
        rules: {
          // æ–™ç®±ç æ ¡éªŒï¼šä»…保留字符串类型,移除必填要求(空值可通过)
          boxCode: [
            { required: true, message: '请输入料箱码', trigger: 'blur' },
            { type: 'string', message: '料箱码必须为字符串', trigger: 'blur' }
          ]
        },
        ref: 'batchInForm'
      }, [
        // æ–™ç®±ç è¾“入项(可选填)
        h(ElFormItem, { label: '料箱码', prop: 'boxCode' }, [
        h(ElFormItem, { label: '料箱码', prop: 'boxCode',required:true }, [
          h(ElInput, {
            type: 'text',
            placeholder: '可选输入料箱码,不填则默认入库', // æç¤ºå¯ç©ºè§„则
            modelValue: formData.boxCode,
            'onUpdate:modelValue': (val) => {
              formData.boxCode = val;
@@ -113,8 +158,8 @@
              }
              // å…¥åº“接口提交:料箱码为空时传递空字符串,后端需支持该字段可选
              http.post('/api/wmsTask/BatchInboundTask', {
                boxCode: formData.boxCode // å¯ç©ºï¼šç”¨æˆ·è¾“入或空字符串
              http.post('/api/InboundOrder/EmptyMaterielGroup', {
                palletCode: formData.boxCode // å¯ç©ºï¼šç”¨æˆ·è¾“入或空字符串
              }).then(({ data, status, message }) => {
                if (status) {
                  ElMessage.success(`入库成功${formData.boxCode ? ',料箱码:' + formData.boxCode : ''}`);
ÏîÄ¿´úÂë/WIDESEA_WMSClient/src/extension/outbound/outboundOrder.js
@@ -50,9 +50,9 @@
  onClick: function () {
    
    // 2. ç”Ÿæˆ3-12站台选项(默认第一个为站台3)
    const platformOptions = Array.from({ length: 10 }, (_, i) => {
      const num = i + 3;
      return { label: `站台${num}`, value: `PLATFORM${num.toString().padStart(3, '0')}` };
    const platformOptions = Array.from({ length: 1 }, (_, i) => {
      const num = 1;
      return { label: `站台${num}`, value: `1-2` };
    });
    const mountNode = document.createElement('div');
@@ -176,9 +176,8 @@
                return;
              }
              http.post('/api/wmsTask/BatchOutboundTask', {
                palletCode: formData.palletCode,
                platform: formData.selectedPlatform
              http.post('/api/Task/PalletOutboundTask?palletCode='+formData.palletCode+'&endStation='+formData.selectedPlatform, {
              }).then(({ data, status, message }) => {
                if (status) {
                  ElMessage.success(`出库成功,分配的托盘编号:${data.palletCode || formData.palletCode}`);
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_DTO/Inbound/PalletSumQuantityDTO.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WIDESEA_DTO.Inbound
{
    public class PalletSumQuantityDTO
    {
        public decimal StockSumQuantity { get; set; }
        public int StockCount { get; set; }
        public string UniqueUnit { get; set; }
    }
}
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_IInboundService/IInboundOrderService.cs
@@ -22,6 +22,6 @@
        WebResponseContent BarcodeMaterielGroup(BarcodeMaterielGroupDTO materielGroupDTO);
        WebResponseContent EmptyMaterielGroup(EmptyBarcodeMaterielGroupDTO materielGroupDTO);
        WebResponseContent UnPalletQuantity(string orderNo);
    }
}
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs
@@ -33,9 +33,11 @@
        private readonly IMaterialUnitService _materialUnitService;
        private readonly IInboundOrderDetailService _inboundOrderDetailService;
        private readonly IRepository<Dt_InboundOrderDetail> _inboundOrderDetailRepository;
        private readonly IRepository<Dt_StockInfoDetail> _stockDetailRepository;
        private readonly IRepository<Dt_InboundOrder> _inboundOrderRepository;
        public IRepository<Dt_InboundOrder> Repository => BaseDal;
        public InboundOrderService(IRepository<Dt_InboundOrder> BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_InboundOrderDetail> inboundOrderDetailRepository, IRepository<Dt_Task> taskRepository, IStockService stockService, IInboundOrderDetailService inboundOrderDetailService, IMaterialUnitService materialUnitService) : base(BaseDal)
        public InboundOrderService(IRepository<Dt_InboundOrder> BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_InboundOrderDetail> inboundOrderDetailRepository, IRepository<Dt_Task> taskRepository, IStockService stockService, IInboundOrderDetailService inboundOrderDetailService, IMaterialUnitService materialUnitService,IRepository<Dt_StockInfoDetail> stockDetailRepository,IRepository<Dt_InboundOrder> inboundOrderRepository) : base(BaseDal)
        {
            _mapper = mapper;
            _unitOfWorkManage = unitOfWorkManage;
@@ -44,6 +46,8 @@
            _stockService = stockService;
            _inboundOrderDetailService = inboundOrderDetailService;
            _materialUnitService = materialUnitService;
            _stockDetailRepository = stockDetailRepository;
            _inboundOrderRepository = inboundOrderRepository;
        }
        public async Task<WebResponseContent> ReceiveInboundOrder(List<Dt_InboundOrder> models, int operateType)
@@ -548,6 +552,51 @@
        }
        public WebResponseContent UnPalletQuantity(string orderNo)
        {
            // åˆå§‹åŒ–返回DTO(默认值都为0,避免null)
            var resultDTO = new PalletSumQuantityDTO
            {
                StockSumQuantity = 0,
                StockCount = 0,
                UniqueUnit=""
            };
            WebResponseContent content = new WebResponseContent();
            try
            {
                if (string.IsNullOrWhiteSpace(orderNo))
                {
                  return content.Error("传入的订单号orderNo为空或空白");
                }
                var orderDetail = _inboundOrderRepository.Db.Queryable<Dt_InboundOrder>().Includes(x => x.Details).Where(s => s.InboundOrderNo == orderNo).First();
                if (orderDetail == null)
                {
                   return content.Error("未找到单据");
                }
               var unitGroups = orderDetail.Details.GroupBy(d => d.Unit).ToList();
                if (unitGroups.Count == 1)
                {
                    resultDTO.UniqueUnit = unitGroups.First().Key;
                }
                else
                {
                    resultDTO.UniqueUnit = "";
                }
                var validDetails = _stockDetailRepository.Db.Queryable<Dt_StockInfoDetail>().Where(s => s.OrderNo == orderNo).ToList();
                resultDTO.StockSumQuantity = orderDetail.Details.Sum(d => d.OrderQuantity);
                resultDTO.StockCount = orderDetail.Details.Count;
                if(validDetails.Any())
                {
                     resultDTO.StockSumQuantity -= validDetails.Sum(d => d.StockQuantity);
                    // æ˜Žç»†è®°å½•数:符合条件的有效记录条数
                    resultDTO.StockCount -= validDetails.Count;
                }
                return content.OK("",resultDTO);
            }
            catch (Exception ex)
            {
              return content.Error("SumQuantity ç»Ÿè®¡åº“存数量失败,订单号:{OrderNo}");
            }
        }
    }
}
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Inbound/InboundOrderController.cs
@@ -194,5 +194,11 @@
        }
        [HttpPost, Route("UnPalletQuantity"), AllowAnonymous, MethodParamsValidate]
        public WebResponseContent UnPalletQuantity(string orderNo)
        {
            return Service.UnPalletQuantity(orderNo);
        }
    }
}