Преглед изворни кода

销售订单 新增时可以查询齐套性检查

jingshuyong пре 10 месеци
родитељ
комит
940dd0b1f3

+ 15 - 1
src/api/productionPlan/index.js

@@ -269,4 +269,18 @@ export async function findMaterialInfoSalesorder(params) {
     return res.data.data;
   }
   return Promise.reject(new Error(res.data.message));
-}
+}
+
+// 根据产品ID查询物料信息
+export async function findMaterialInfoByCategory(params) {
+  const res = await request.get(
+    '/aps/salesorder/findMaterialInfoByCategoryId',
+    {
+      params
+    }
+  );
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 17 - 10
src/views/saleOrder/components/create-order.vue

@@ -63,14 +63,16 @@
                 clearable
                 v-model="form.customerName"
                 :disabled="form.saleType == 3"
-                style="width:calc(100% - 80px);"
+                style="width: calc(100% - 80px)"
               />
               <!-- <el-button style="margin-left: 3px;" size="small" type="primary" @click.native="$refs.contactDialogRef.open()"
               >选择
             </el-button> -->
-            <contactDialog style="margin-left: 3px;" @changeParent="contactDialogSuccess"></contactDialog>
+              <contactDialog
+                style="margin-left: 3px"
+                @changeParent="contactDialogSuccess"
+              ></contactDialog>
             </el-form-item>
-      
           </el-col>
 
           <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
@@ -527,7 +529,8 @@
       EquipmentDialog,
       orderHomogeneityInspectDialog,
       orderHomogeneityInspectInstallDialog,
-      ProcessRoute,contactDialog
+      ProcessRoute,
+      contactDialog
     },
     data() {
       return {
@@ -729,11 +732,11 @@
         this.visible = false;
       },
 
-      contactDialogSuccess(data){
-        this.$set(this.form,'customerName',data.name)
-        this.$set(this.form,'simpleName',data.simpleName)
-        this.$set(this.form,'serialNo',data.serialNo)
-        this.$set(this.form,'simpleName',data.simpleName)
+      contactDialogSuccess(data) {
+        this.$set(this.form, 'customerName', data.name);
+        this.$set(this.form, 'simpleName', data.simpleName);
+        this.$set(this.form, 'serialNo', data.serialNo);
+        this.$set(this.form, 'simpleName', data.simpleName);
       },
       // 表格:模数、数量(方)、块数输入框 输入事件
       tableHandleKeyUp(row, index, e, name) {
@@ -1076,10 +1079,14 @@
           this.$message.warning('请选择BOM版本');
           return;
         }
+        if (!row.contractNum) {
+          this.$message.warning('请输入订单数量且订单数量不能为0');
+          return;
+        }
         if (row.productType == 2) {
           let data = [];
           data.push(row);
-          this.$refs.orderHomogeneityInspectDialog.open(data, this.form);
+          this.$refs.orderHomogeneityInspectDialog.open(data, this.form,'new');
         } else if (row.productType == 3) {
           this.$refs.orderHomogeneityInspectInstallDialog.open([row.id]);
         } else {

+ 31 - 8
src/views/saleOrder/components/orderHomogeneityInspectDialog.vue

@@ -150,7 +150,7 @@
       </div>
       <div slot="footer">
         <el-button plain @click="cancel">取消</el-button>
-        <el-button type="primary" @click="confirm">确定</el-button>
+        <!-- <el-button type="primary" @click="confirm">确定</el-button> -->
       </div>
     </ele-modal>
 
@@ -166,6 +166,7 @@
     homogeneityInspectMerge,
     findBomSalesorderCategoryId,
     findMaterialInfoSalesorder,
+    findMaterialInfoByCategory,
     getBom
   } from '@/api/productionPlan/index.js';
   import { orderHomogeneityInspect } from '@/api/saleOrder/index.js';
@@ -322,7 +323,7 @@
             label: '最终状态',
             align: 'center',
             minWidth: 80
-          },
+          }
           // {
           //   columnKey: 'action',
           //   label: '操作',
@@ -349,7 +350,10 @@
           contractNum: '',
           specification: '',
           model: ''
-        }
+        },
+        salesOrderId:'',
+        // 来源
+        source: 'list'
       };
     },
     watch: {
@@ -383,7 +387,8 @@
       currentDetail(row) {
         this.$refs.currentDetailDialog.open(row);
       },
-      open(dataList, order) {
+      open(dataList, order, source = 'list') {
+        this.source = source;
         console.log(order, 'order order order 1');
         console.log(dataList, 'dataList');
         this.visible = true;
@@ -434,16 +439,17 @@
       handleNodeClick(data) {
         this.clearData();
         this.getBomData(data);
-        this.selectNodeId = data.id;
+        // this.selectNodeId = data.id;
         this.orderInfo = data;
         // console.log(data);
         // this.reload({planIds: [data.id]});
       },
       // 获取bom 数据
       async getBomData(data) {
+        console.log(data,'datadatadatadata')
         this.loading = true;
         try {
-          this.planId = data.id;
+          this.salesOrderId = data.id;
           const res = await findBomSalesorderCategoryId(data.categoryId);
           if (!res || res.length == 0) {
             this.bomListD = [];
@@ -496,8 +502,25 @@
       },
       // 获取物料数据信息
       async getMaterialData(data) {
-        let params = { planId: this.planId, bomVersionId: data.bomId };
-        const result = await findMaterialInfoSalesorder(params);
+        let params = {};
+        let api = null;
+        if (this.source == 'list') {
+          params = {
+            salesOrderId: this.salesOrderId,
+            bomVersionId: data.bomId
+          };
+          api = findMaterialInfoSalesorder;
+        } else {
+          api = findMaterialInfoByCategory;
+          params = {
+            categoryId: this.orderInfo.categoryId,
+            bomVersionId: this.orderInfo.bomCategoryId,
+            requiredFormingNum: this.orderInfo.contractNum
+          };
+        }
+
+        // let api = this.source == 'list' ? findMaterialInfoSalesorder : findMaterialInfoByCategory;
+        const result = await api(params);
         result.map((item) => {
           item.batchNo = this.orderInfo.batchNo;
           item.productCode = this.orderInfo.productCode;