Browse Source

fix(销售订单): 调整发货数量校验条件,由进度值判断改为比较已发货和总订单数量,修改发货打印模板,发货物品清单添加未出库数量和未发数量列,优化校验错误提示信息

liujt 1 month ago
parent
commit
e6abcd4bf7

+ 1 - 1
src/views/saleManage/saleOrder/index.vue

@@ -225,7 +225,7 @@
                       !row.saleTypeName.includes('受托')) &&
                     $hasPermission('eom:saleordersendrecord:save') &&
                     ((isTotalCount == '1' &&
-                      ![800, 1000].includes(row.progress)) ||
+                      row.sendTotalCount < row.productCount) ||
                       isTotalCount == 0)
                   "
                 >

+ 29 - 19
src/views/saleManage/saleOrder/invoice/components/inventoryTable.vue

@@ -769,30 +769,33 @@
           {
             width: 100,
             prop: 'notSendTotalCount',
-            label: '未数量',
+            label: '未出库数量',
             align: 'center',
             formatter: (row, column) => {
-              if (row.notSendTotalCount) {
-                return row.notSendTotalCount + ' ' + row.measuringUnit;
-              }
+              // if (row.notSendTotalCount) {
+                return row.notSendTotalCount
+              // }
             }
           },
           {
-            width: 120,
-            prop: 'packingSpecification',
+            width: 100,
+            prop: 'notGenerateSendCount',
+            label: '未发数量',
             align: 'center',
-            label: '包装规格',
-            showOverflowTooltip: true
+            formatter: (row, column) => {
+              // if (row.notGenerateSendCount) {
+                return row.notGenerateSendCount
+              // }
+            }
           },
-
           {
             width: 120,
             prop: 'totalCount',
             label: '计量数量',
             formatter: (row, column) => {
-              if (row.totalCount) {
+              // if (row.totalCount) {
                 return row.totalCount + ' ' + row.measuringUnit;
-              }
+              // }
             },
             align: 'center'
           },
@@ -807,6 +810,13 @@
             },
             align: 'center'
           },
+          {
+            width: 120,
+            prop: 'packingSpecification',
+            align: 'center',
+            label: '包装规格',
+            showOverflowTooltip: true
+          },
 
           // {
           //   width: 80,
@@ -1699,15 +1709,15 @@
       validateForm(callback) {
         //开始表单校验
         this.$refs.form.validate((valid, obj) => {
-          let is = false;
-          this.form.datasource.forEach((item) => {
-            if (Number(item.totalCount) > item.orderTotalCount) {
-              is = true;
-            }
-          });
+          // 找出所有发货数量超过订单剩余数量的产品
+          const exceededItems = this.form.datasource.filter(
+            (item) => Number(item.totalCount) > item.notGenerateSendCount
+          );
           // 退货单退货不校验数量,实物赔偿无法计算
-          if (is && this.sourceType != 3 && this.needProduce != 4) {
-            this.$message.warning('发货数量大于订单总数量');
+          if (exceededItems.length > 0 && this.sourceType != 3 && this.needProduce != 4) {
+            // 提取产品名称,生成详细提示消息
+            const productNames = exceededItems.map(item => item.productCode).join('、');
+            this.$message.warning(`${productNames} 的发货数量大于订单剩余数量`);
             if (this.isTotalCount == 1) {
               callback(false);
             }

+ 22 - 0
src/views/saleManage/saleOrder/invoice/components/inventoryTableDetails.vue

@@ -222,6 +222,28 @@
             headerSlot: 'headerTotalCount',
             align: 'center'
           },
+          {
+            width: 100,
+            prop: 'notSendTotalCount',
+            label: '未出库数量',
+            align: 'center',
+            formatter: (row, column) => {
+              // if (row.notSendTotalCount) {
+                return row.notSendTotalCount
+              // }
+            }
+          },
+          {
+            width: 100,
+            prop: 'notGenerateSendCount',
+            label: '未发数量',
+            align: 'center',
+            formatter: (row, column) => {
+              // if (row.notGenerateSendCount) {
+                return row.notGenerateSendCount
+              // }
+            }
+          },
           // {
           //   width: 150,
           //   prop: 'saleUnit',

+ 2 - 2
src/views/saleManage/saleOrder/invoice/components/print-template-ht.vue

@@ -83,8 +83,8 @@
               <!-- {{ item.specification }}/ -->
               {{ item.modelType }}
             </td>
-            <td style="padding: 5px"> {{ item.measuringUnit }}</td>
-            <td style="padding: 5px"> {{ item.totalCount }}</td>
+            <td style="padding: 5px"> {{ item.saleUnit }}</td>
+            <td style="padding: 5px"> {{ item.saleCount }}</td>
             <td style="padding: 5px;" v-if="isPrintPrice"> {{ item.singlePrice }}</td>
             <td style="padding: 5px;" v-if="isPrintPrice"> {{ item.taxRate }}{{ item.taxRate ? '%' : '0%' }}</td>
             <td style="padding: 5px;" v-if="isPrintPrice"> {{ item.totalPrice }}</td>