Просмотр исходного кода

Merge branch 'dev' of http://110.41.163.243:9980/kd-aiot/kd-aiot-frontend-aps into dengfei

695593266@qq.com 7 месяцев назад
Родитель
Сommit
e41481ff9d

+ 8 - 3
src/views/productionPlan/components/factoryAdd/index.vue

@@ -447,6 +447,7 @@
     getUpdateInfoByCode
   } from '@/api/saleOrder';
   import contactDialog from '@/components/contactDialog/openContactDialog.vue';
+  import { deepClone } from '@/utils';
 
   export default {
     components: {
@@ -1018,7 +1019,8 @@
         this.$refs.equipmentRefs.open();
       },
 
-      async confirmChoose(list) {
+      async confirmChoose(data) {
+        let list = deepClone(data);
         list.map((el) => (el.selectionRowShow = false));
         if (this.clientEnvironmentId == 4) {
           list.map((v) => {
@@ -1147,10 +1149,13 @@
             }
           });
         } catch (err) {}
+        console.log(result, 'result');
+        // return
         this.form.productInfoList.push(...result);
         this.changeLineNumber();
 
         this.$refs.tableRef.setData(this.form.productInfoList);
+        // console.log(this.form.productInfoList, 'this.form.productInfoList');
         //重置
         this.$set(this.form, 'produceType', '');
         this.$set(this.form, 'bomCategoryId', '');
@@ -1240,13 +1245,13 @@
             row.routingList = arr;
             this.$set(row, 'produceRoutingId', arr[0].id);
             this.$set(
-              this.form.productInfoList[index],
+              row,
               'produceRoutingId',
               arr[0].id
             );
 
             row.selectionRowShow = false;
-            this.$set(this.form.productInfoList[index], 'routingList', arr);
+            this.$set(row, 'routingList', arr);
             // });
           }
           this.$forceUpdate();

+ 3 - 3
src/views/productionPlan/components/homogeneityInspectDialog.vue

@@ -80,7 +80,7 @@
                 <el-input readonly v-model="planInfo.productNum"></el-input>
               </el-form-item>
             </el-col>
-            <el-col :span="6" v-if="produceType == 2">
+            <el-col :span="6" v-if="produceType != 2">
               <el-form-item label="未发总数:">
                 <el-input
                   readonly
@@ -97,7 +97,7 @@
                 ></el-input>
               </el-form-item>
             </el-col>
-            <el-col :span="6" v-if="produceType == 2">
+            <el-col :span="6" v-if="produceType!= 2">
               <el-form-item label="在制总数:">
                 <el-input
                   readonly
@@ -105,7 +105,7 @@
                 ></el-input>
               </el-form-item>
             </el-col>
-            <el-col :span="6" v-if="produceType == 2">
+            <el-col :span="6" v-if="produceType != 2">
               <el-form-item label="最终缺料数量:">
                 <el-input
                   readonly

+ 1 - 0
src/views/productionPlan/index.vue

@@ -94,6 +94,7 @@
           <el-dropdown-menu slot="dropdown">
             <el-dropdown-item command="1"> 自制件 </el-dropdown-item>
             <el-dropdown-item command="2"> 采购件 </el-dropdown-item>
+            <el-dropdown-item command="1"> 受托件 </el-dropdown-item>
           </el-dropdown-menu>
         </el-dropdown>
         <el-button

+ 54 - 26
src/views/saleOrder/components/create-order.vue

@@ -895,8 +895,10 @@
                 );
               }
               item.lackNum = null;
-              if(item.bomVersionList?.length&&item.productType){
-                  item.bomVersionList=item.bomVersionList.filter(el=>el.bomType==item.productType)
+              if (item.bomVersionList?.length && item.productType) {
+                item.bomVersionList = item.bomVersionList.filter(
+                  (el) => el.bomType == item.productType
+                );
               }
             });
           }
@@ -907,11 +909,6 @@
               promiselist.push(this.getBomInfo(el));
             });
             await Promise.all(promiselist);
-
-            console.log(this.disabledList, '3333');
-            // let ids = res.productInfoList.map((item) => item.categoryId);
-            // const data = await findBomCategoryByCategoryIds(ids);
-            // this.handleResult(res.productInfoList, data, 'init');
           }
 
           this.disabledList = res.productInfoList;
@@ -919,9 +916,9 @@
           const promiseProduct = [];
           this.form.productInfoList.forEach(async (el, index) => {
             let lis = el.producedList;
-            if (!el.bomCategoryId && lis && lis.length > 0) {
-              el.productType = el.producedList[0].code;
-              promiseProduct.push(this.changeProductType(el, index));
+            if (lis && lis.length > 0) {
+              el.productType = el.productType || el.producedList[0].code;
+              promiseProduct.push(this.changeProductType(el, index, 'init'));
             }
           });
           await Promise.all(promiseProduct);
@@ -1383,20 +1380,36 @@
       },
 
       // 选择生产类型
-      async changeProductType(row, index) {
+      async changeProductType(row, index, type) {
         let param = {
           bomType: row.productType,
           categoryId: row.categoryId
         };
-        this.wipeData(index);
+        if (type != 'init') {
+          this.wipeData(index);
+        }
         const res = await bomListByPlan(param);
         console.log(res, 'res 3333');
         let arr = res || [];
-        let data = this.form.productInfoList[index];
+        // let data = this.form.productInfoList[index];
         if (arr.length) {
-          this.form.productInfoList[index].bomVersionList = arr;
-          row.bomCategoryId = arr[0].id;
-          await this.changeBomId(row, index);
+          this.$set(this.form.productInfoList[index], 'bomVersionList', arr);
+
+          if (type == 'init') {
+            this.$set(
+              this.form.productInfoList[index],
+              'bomCategoryId',
+              row.bomCategoryId || arr[0].id
+            );
+          } else {
+            this.$set(
+              this.form.productInfoList[index],
+              'bomCategoryId',
+              arr[0].id
+            );
+          }
+
+          await this.changeBomId(row, index, type);
           let arrAll = JSON.parse(JSON.stringify(this.form));
           this.$set(this, 'form', arrAll);
         }
@@ -1414,22 +1427,37 @@
       },
 
       // 选择BOM
-      async changeBomId(row, index) {
-        console.log(row, '这里看看吧');
+      async changeBomId(row, index, type) {
         const res = await bomRoutingList(row.bomCategoryId);
         let arr = res || [];
         // if (arr.length == 0) {
         //   row.produceRoutingId = '';
         // }
-        console.log(arr, 'arr');
+        this.$set(this.form.productInfoList[index], 'routingList', arr);
         if (arr.length > 0) {
-          this.$set(this.form.productInfoList[index], 'routingList', arr);
-          row.produceRoutingName = arr[0].name;
-          this.$set(
-            this.form.productInfoList[index],
-            'produceRoutingId',
-            arr[0].id
-          );
+          if (type == 'init') {
+            this.$set(
+              this.form.productInfoList[index],
+              'produceRoutingName',
+              row.produceRoutingName || arr[0].name
+            );
+            this.$set(
+              this.form.productInfoList[index],
+              'produceRoutingId',
+              row.produceRoutingId || arr[0].id
+            );
+          } else {
+            this.$set(
+              this.form.productInfoList[index],
+              'produceRoutingName',
+              arr[0].name
+            );
+            this.$set(
+              this.form.productInfoList[index],
+              'produceRoutingId',
+              arr[0].id
+            );
+          }
         }
         this.$forceUpdate();
       },

+ 5 - 2
src/views/saleOrder/components/order-search.vue

@@ -367,6 +367,7 @@
               <el-dropdown-menu slot="dropdown">
                 <el-dropdown-item command="1"> 自制件 </el-dropdown-item>
                 <el-dropdown-item command="2"> 采购件 </el-dropdown-item>
+                <el-dropdown-item command="1"> 受托件 </el-dropdown-item>
                 <!-- <el-dropdown-item command="3"> 外协件 </el-dropdown-item> -->
               </el-dropdown-menu>
             </el-dropdown>
@@ -690,9 +691,11 @@
             delete bomMap[item.bomType];
           }
         });
-        if (arr.length > 0 && produceType) {
+        if (arr.length) {
           let obj = arr.find((el) => el.code == produceType);
-          produceType = obj ? produceType : arr[0].code;
+          produceType = obj
+            ? produceType
+            : arr.filter((el) => el.code != 1)?.[0]?.code;
         }
         if (arr.length == 0) {
           produceType = '';

+ 17 - 12
src/views/saleOrder/salesToProductionNewTwo.vue

@@ -1133,7 +1133,7 @@
         //   this.form.endTime = new Date(data.endTime);
         // }
         this.form.productionRequirements =
-            data?.salesOrders[0]?.productionRequirements || '';
+          data?.salesOrders[0]?.productionRequirements || '';
         if (!data.bomCategoryId || data.bomCategoryId == null) {
           this.form.produceType = '';
           this.selectionRowShow = true;
@@ -1249,6 +1249,13 @@
             this.form.produceRoutingId = queryD.produceRoutingId;
             this.selectionRowShow = true;
           }
+          if (this.form.produceType == 1) {
+            this.form.produceType = '';
+            this.form.bomCategoryId = '';
+            this.form.produceRoutingId = '';
+            this.form.produceRoutingName = '';
+            return;
+          }
         }
         this.bomListVersion(type);
       },
@@ -1305,18 +1312,16 @@
               res.factoriesId || this.$route.query.factoriesId;
           }
 
-          // this.form.produceType =
-          //   res.produceType || this.$route.query.produceType
-          //     ? parseInt(this.$route.query.produceType)
-          //     : null;
-          this.form.produceType = this.$route.query.produceType
-            ? parseInt(this.$route.query.produceType)
-            : res.produceType;
-          console.log('this.form', this.form, res);
-          this.changeProduceType('init');
+          this.form.produceType =
+            res.produceType ||
+            (this.$route.query.produceType
+              ? parseInt(this.$route.query.produceType)
+              : null);
+
           this.form.bomCategoryId =
             res.bomCategoryId || this.$route.query.bomCategoryId;
-          // this.changeBomId();
+          this.changeProduceType('init');
+
           if (this.clientEnvironmentId == '4') {
             if (this.form.salesOrders[0].productName.includes('板材')) {
               this.changeProduct({
@@ -1459,7 +1464,7 @@
         let flag = this.parameterVerification();
         // 必填参数校验
         if (!flag) return;
-        this.$refs.form.validate((valid,obj) => {
+        this.$refs.form.validate((valid, obj) => {
           if (valid) {
             if (this.form.produceType == 1) {
               this.$message.warning('请选择MBOM或者ABOM');

+ 3 - 1
src/views/workOrder/components/order-search.vue

@@ -286,7 +286,9 @@
           { label: '终止', value: 10 },
           { label: '待下达', value: 8 },
           { label: '待生产', value: 4 },
-          { label: '生产中', value: 5 }
+          { label: '生产中', value: 5 },
+          { label: '已完结', value: 6 },
+          { label: '已延期', value: 7 }
         ],
         teamList: []
       };