Selaa lähdekoodia

fix:4701【采购订单】宝盛--采购收货单收货时同一物料不同价格,收货后该物料状态还是未收货

mlchen 1 viikko sitten
vanhempi
commit
e1917a320d

+ 1 - 0
src/views/warehouseManagement/components/outboundRequisitionDialog.vue

@@ -446,6 +446,7 @@ export default {
             let data = res.map((item, index) => {
               return {
                 ...item,
+                sourceReceiveProductId: item.sourceReceiveProductId,
                 index,
                 packingQuantity: 1,
                 minPackingQuantity: item.measureQuantity,

+ 49 - 1
src/views/warehouseManagement/stockManagement/add.vue

@@ -1374,6 +1374,11 @@
       }
     },
     watch: {
+      'formData.bizType'(newValue) {
+        if (String(newValue) !== '2') {
+          this.clearInboundRequestId();
+        }
+      },
       packingList: {
         handler(newVal) {
           console.log('包装列表', newVal);
@@ -1444,6 +1449,7 @@
                 categoryModel: item.modelType, // 物品型号
                 specification: item.specification, // 规格
                 brandNum: item.brandNum, // 牌号
+                sourceReceiveProductId: item.sourceReceiveProductId,
                 batchNo: item.batchNo || batchNo, // 批次号
                 systemBatchNo: item.systemBatchNo || '', // 系统内部批次号
                 minPackingQuantity: item.quantity, // 最小包装单元数量
@@ -1817,9 +1823,22 @@
         console.log('query-----------', query);
         console.log(this.formData.bizType, 'bbbbbtype');
         if (this.formData.bizType != 10) {
+          const sourceChanged =
+            this.formData.sourceBizNo !== query.sourceBizNo ||
+            String(this.formData.bizType) !== String(query.bizType);
           this.formData.sourceBizNo = query.sourceBizNo;
           this.formData.bizType = query.bizType;
           this.formData.extInfo.assetType = query.assetType.split(',');
+          if (String(query.bizType) === '2' && sourceChanged) {
+            this.clearInboundRequestId();
+            this.$set(
+              this.formData.extInfo,
+              'inboundRequestId',
+              this.createInboundRequestId()
+            );
+          } else if (String(query.bizType) !== '2') {
+            this.clearInboundRequestId();
+          }
           const batchNo = await getCode('lot_number_code');
           // 获取包装规格
           let packingSpecification =
@@ -2055,9 +2074,32 @@
       // 清除单据来源
       clearSourceBizNo() {
         this.$set(this.formData, 'sourceBizNo', '');
+        this.clearInboundRequestId();
         this.productList = [];
         this.packingList = [];
       },
+      // 生成采购入库请求标识,失败重试时复用同一个标识。
+      createInboundRequestId() {
+        const crypto = window.crypto || window.msCrypto;
+        if (crypto?.randomUUID) {
+          return crypto.randomUUID();
+        }
+        const random = Math.random().toString(36).slice(2);
+        return `inbound-${Date.now()}-${random}`;
+      },
+      ensureInboundRequestId() {
+        if (!this.formData.extInfo.inboundRequestId) {
+          this.$set(
+            this.formData.extInfo,
+            'inboundRequestId',
+            this.createInboundRequestId()
+          );
+        }
+        return this.formData.extInfo.inboundRequestId;
+      },
+      clearInboundRequestId() {
+        this.$delete(this.formData.extInfo, 'inboundRequestId');
+      },
       // 返回
       back() {
         this.$router.go(-1);
@@ -2465,6 +2507,9 @@
 
               return;
             }
+            if (!obj.id && String(obj.bizType) === '2') {
+              obj.extInfo.inboundRequestId = this.ensureInboundRequestId();
+            }
             let api = obj.id ? storageApi.update : storageApi.storage;
             api(obj)
               .then(async (res) => {
@@ -2484,6 +2529,9 @@
                     } else {
                       this.$message.success('操作成功');
                     }
+                    if (!obj.id && String(obj.bizType) === '2') {
+                      this.clearInboundRequestId();
+                    }
                     // 委外入库(非采购)
 
                     this.saveLoading = false;
@@ -2491,9 +2539,9 @@
                     this.back();
                   } catch (error) {
                     this.saveLoading = false;
+                    console.log('提交流程失败', error);
                     // this.$router.push('/warehouseManagement/stockManagement');
                     this.back();
-                    console.log('提交流程失败', error);
                   }
                 }
               })

+ 1 - 1
vue.config.js

@@ -43,7 +43,7 @@ module.exports = {
         // target: 'http://124.71.68.31:50001',
         // target: 'http://192.168.1.132:18086',
         // target: 'http://192.168.1.105:18086', //开发
-        target: 'http://192.168.1.251:18086', //开发
+        target: 'http://localhost:18086', //开发
         // target: 'http://192.168.1.251:18186', //测试
         // target: 'http://192.168.1.116:18086',