Procházet zdrojové kódy

fix:5402华泰【发货审批】发货审批,库存不足了,去删除物品去手动添加,添加的物品库存还有也不让选择,库存台账还有100的库存

mlchen před 1 dnem
rodič
revize
b5e9dd9647

+ 31 - 7
src/views/bpm/outgoingManagement/components/AssetsDialog.vue

@@ -179,9 +179,11 @@
             fixed="left"
             :selectable="
               (row) => {
-                return !this.productLists.some(
-                  (it) => it.categoryId == row.categoryId
-                ) && row.measureQuantity != 0;
+                return (
+                  !this.productLists.some(
+                    (it) => it.categoryId == row.categoryId
+                  ) && this.getAvailableQuantity(row) > 0
+                );
               }
             "
           >
@@ -195,7 +197,10 @@
             fixed="left"
             :selectable="
               (row) => {
-                return !this.productLists.some((it) => it.id == row.id) && row.measureQuantity != 0;
+                return (
+                  !this.productLists.some((it) => it.id == row.id) &&
+                  this.getAvailableQuantity(row) > 0
+                );
               }
             "
           >
@@ -287,6 +292,7 @@
             prop="measureQuantity"
             label="计量数量"
             width="120"
+            :formatter="formatMeasureQuantity"
           ></el-table-column>
           <el-table-column
             prop="measureUnit"
@@ -480,6 +486,23 @@
       formatSystemBatchNo(row) {
         return row.systemBatchNo || '-';
       },
+      // 批次入库数量不会随出库变化,发货选择必须使用当前库存余额扣除锁定量。
+      getAvailableQuantity(row) {
+        const inventoryBalance =
+          Number(
+            this.dimension == 2 ? row.availableCountBase : row.measureQuantity
+          ) || 0;
+        const lockQuantity = Number(row.lockQuantity) || 0;
+        return Math.max(
+          0,
+          Math.round((inventoryBalance - lockQuantity) * 100) / 100
+        );
+      },
+      formatMeasureQuantity(row) {
+        return this.dimension == 2
+          ? this.getAvailableQuantity(row)
+          : row.measureQuantity;
+      },
       async getFactoryList() {
         const res = await warehouseDefinition.getFactoryarea({
           pageNum: 1,
@@ -529,7 +552,8 @@
       },
       // 出库数量限制
       handleInput(row, value) {
-        if (row.outboundNum <= row.measureQuantity) {
+        const availableQuantity = this.getAvailableQuantity(row);
+        if (row.outboundNum <= availableQuantity) {
           // return (row.outboundNum = value.replace(/^(0+)|[^\d]+/g, ''));
 
           // 过滤掉非数字和小数点的字符
@@ -547,7 +571,7 @@
           }
           return (row.outboundNum = finalValue);
         } else {
-          row.outboundNum = row.measureQuantity;
+          row.outboundNum = availableQuantity;
         }
       },
       // 切换维度
@@ -569,7 +593,7 @@
           // 批次维度
           const data = await storageApi.getBatchList(this.searchForm);
           for (let i = 0; i < data.list.length; i++) {
-            data.list[i].outboundNum = data.list[i].measureQuantity;
+            data.list[i].outboundNum = this.getAvailableQuantity(data.list[i]);
           }
           this.tableData = data.list;
           this.total = data.count;

+ 2 - 2
vue.config.js

@@ -38,7 +38,7 @@ module.exports = {
         // target: 'http://124.71.68.31:50001', // 测试环境
         // target: 'http://124.71.68.31:50001',
         // target: 'http://192.168.1.105:18086',
-        // target: 'http://localhost:18086',
+        target: 'http://localhost:18086',
         // target: 'http://192.168.1.116:18086',
         // target: 'http://192.168.1.3:18086',
         // target: 'http://192.168.1.251:18186',
@@ -46,7 +46,7 @@ module.exports = {
         // target: 'http://192.168.1.3:18086',
         // target: 'http://aiot.zoomwin.com.cn:51001/api',
         // target: 'http://192.168.1.3:18086',
-        target: 'http://192.168.1.147:18086', // 陈兵
+        // target: 'http://192.168.1.147:18086', // 陈兵
         // target: 'http://192.168.1.116:18086', // 赵沙金
         // target: 'http://192.168.1.113:18086', // 郭丹