Kaynağa Gözat

齐套性检查功能完善+bug修改 转生产计划bug修改

jingshuyong 10 ay önce
ebeveyn
işleme
2d3b92e91b

+ 3 - 3
qiankun_config/store.js

@@ -18,9 +18,9 @@ export default function (state) {
   if (state.user?.info) {
     store.commit('user/setUserInfo', state.user.info);
   }
-  if (state.user?.authorityDept) {
-    store.dispatch('user/getCurrentUserAuthorityDept');
-  }
+  // if (state.user?.authorityDept) {
+  //   store.dispatch('user/getCurrentUserAuthorityDept');
+  // }
 }
 
 export const createMutationObserve = ({ modules = [] }) => {

+ 4 - 4
src/store/modules/user.js

@@ -87,10 +87,10 @@ export default {
     }
   },
   actions: {
-    async getCurrentUserAuthorityDept({ commit }) {
-      const info = await getCurrentUserAuthorityDeptAPI();
-      commit('setAuthorityDept', info);
-    },
+    // async getCurrentUserAuthorityDept({ commit }) {
+    //   const info = await getCurrentUserAuthorityDeptAPI();
+    //   commit('setAuthorityDept', info);
+    // },
     /**
      * 请求用户信息、权限、角色、菜单
      */

+ 1 - 1
src/views/login/index.vue

@@ -191,7 +191,7 @@
               this.$store.commit('user/setUserInfo', res.data);
               this.loading = false;
               this.$message.success(res.message);
-              this.$store.dispatch('user/getCurrentUserAuthorityDept');
+              // this.$store.dispatch('user/getCurrentUserAuthorityDept');
               this.goHome();
             })
             .catch((e) => {

+ 1 - 1
src/views/productionPlan/components/factoryAdd/index.vue

@@ -381,7 +381,7 @@
               >
             </template>
           </ele-pro-table>
-          <div class="add-product">
+          <div class="add-product" @click="addEquipment">
             <i class="el-icon-circle-plus-outline"></i>
           </div>
         </el-row>

+ 126 - 15
src/views/productionPlan/components/homogeneityInspectDialog.vue

@@ -131,6 +131,23 @@
                         </el-option>
                       </el-select>
                     </el-form-item>
+                    <el-form-item label="属性类型" v-if="produceType == 2">
+                      <el-select
+                        size="mini"
+                        v-model="formInline.attributeType"
+                        placeholder="属性类型"
+                        class="select-type"
+                        @change="attributeChange"
+                      >
+                        <el-option
+                          v-for="item in attributeList"
+                          :key="item.value"
+                          :label="item.label"
+                          :value="item.value"
+                        >
+                        </el-option>
+                      </el-select>
+                    </el-form-item>
                     <el-form-item label="最终状态">
                       <el-select
                         class="select-type"
@@ -463,7 +480,8 @@
         visible: false,
         // requiredFormingNum: 0,
         formInline: {
-          finalState: 0
+          finalState: 0,
+          attributeType: 2
         },
         finalStateList: [
           {
@@ -499,7 +517,21 @@
         selectNodeId: '',
         loading: false,
         produceType: 1,
-        selection: []
+        selection: [],
+        attributeList: [
+          {
+            value: 'all',
+            label: '全部'
+          },
+          {
+            value: 2,
+            label: '采购件'
+          },
+          {
+            value: 3,
+            label: '外协件'
+          }
+        ]
       };
     },
     watch: {
@@ -516,10 +548,10 @@
     mounted() {},
     methods: {
       handleNodeClick(data) {
+        this.planInfo = data;
         this.clearData();
         this.getBomData(data);
         this.selectNodeId = data.id;
-        this.planInfo = data;
       },
       reload(where) {
         this.$nextTick(() => {
@@ -542,28 +574,98 @@
         this.$refs.currentDetailDialog.open({ bomCode: row.code });
       },
       // 选择BOM类型
-      async bomTypeChange(e) {
+      async bomTypeChange(e, type) {
         this.formInline.bomType = e;
         let data = this.bomListType.find((el) => el.id === e);
         if (!data) return;
         this.bomListV = data.bomList;
-        await this.bomVChange(data.bomList[0].bomId);
+        let idx = 0;
+        if (type == 'init') {
+          idx = data.bomList.findIndex(
+            (item) => item.bomId == this.planInfo.bomCategoryId
+          );
+        }
+        const index = idx != -1 ? idx : 0;
+        await this.bomVChange(data.bomList[index].bomId);
       },
       // 选择BOM版本
       async bomVChange(e) {
         this.formInline.bomId = e;
         let data = this.bomListV.find((el) => el.bomId === e);
         if (!data) return;
-        await this.getMaterialData(data);
+        await this.getMaterialData(data, this.formInline.attributeType);
+      },
+      // 查询采购价跟外协件两个类型数据
+      async dataMerging() {
+        let params1 = {
+          planId: this.planId,
+          bomVersionId: this.formInline.bomId,
+          produceType: 2
+        };
+        let params2 = {
+          planId: this.planId,
+          bomVersionId: this.formInline.bomId,
+          produceType: 3
+        };
+        this.loading = true;
+        try {
+          // 直接调用接口函数,因为其返回Promise,无需额外包装
+          let p1 = findMaterialInfoByPlanId(params1);
+          let p2 = findMaterialInfoByPlanId(params2);
+          // 使用Promise.all并行执行多个Promise
+          let results = await Promise.all([p1, p2]);
+          this.loading = false;
+          console.log(results, 'results');
+          // 这里可以继续对results做后续处理,比如解构等
+          const [result1, result2] = results;
+          // 示例:可以接着处理result1和result2,比如合并数据等
+          const mergeData = this.handleMergedData(result1, result2);
+          this.resultProcess(mergeData);
+        } catch (error) {
+          this.loading = false;
+          console.error('接口请求出错:', error);
+        }
+      },
+      handleMergedData(result1, result2) {
+        // 处理合并后的数据逻辑
+        return [...result1, ...result2];
+      },
+      // 切换属性
+      async attributeChange(e) {
+        if (e == 'all') {
+          this.dataMerging();
+          return;
+        }
+        let data = this.bomListV.find(
+          (el) => el.bomId === this.formInline.bomId
+        );
+        if (!data) return;
+        await this.getMaterialData(data, e);
       },
       // 获取物料数据信息
-      async getMaterialData(data) {
+      async getMaterialData(data, attributeType) {
+        if (attributeType == 'all') {
+          this.dataMerging();
+          return;
+        }
+        let produceType =
+          this.produceType == 1 ? 1 : attributeType == 2 ? 2 : 3;
         let params = {
           planId: this.planId,
           bomVersionId: data.bomId,
-          produceType: this.produceType
+          produceType: produceType
         };
-        const result = await findMaterialInfoByPlanId(params);
+        this.loading = true;
+        try {
+          const result = await findMaterialInfoByPlanId(params);
+          this.resultProcess(result);
+          this.loading = false;
+        } catch (err) {
+          this.loading = false;
+        }
+      },
+      // 结果数据处理
+      resultProcess(result) {
         result.map((item) => {
           item.batchNo = this.planInfo.batchNo;
           item.salesCode = this.planInfo.salesCode;
@@ -575,7 +677,7 @@
               : '';
         });
         this.datasourceAllList = result;
-        this.finalChange(0);
+        this.finalChange(this.formInline.finalState);
       },
       // 选择状态
       finalChange(e) {
@@ -658,7 +760,8 @@
       },
       clearData() {
         this.formInline = {
-          finalState: 0
+          finalState: 0,
+          attributeType: 2
         };
         this.bomListV = [];
         this.bomListType = [];
@@ -671,7 +774,7 @@
         try {
           this.planId = data.id;
           const res = await findBomCategoryByCategoryId(data.categoryId);
-           this.loading = false;
+          this.loading = false;
           if (!res || res.length == 0) {
             this.bomListD = [];
             this.datasourceList = [];
@@ -701,10 +804,18 @@
             }
           });
           let list = Object.values(obj);
-          console.log(list,'list')
-          if(list.length == 0) return;
+          if (list.length == 0) return;
           this.bomListType = list;
-          await this.bomTypeChange(list[0].id);
+          let bomObj = res.find(
+            (item) => item.bomId == this.planInfo.bomCategoryId
+          );
+          console.log(bomObj, 'bomObj');
+          let idx = 0;
+          if (bomObj && bomObj.bomId) {
+            idx = list.findIndex((item) => item.bomType == bomObj.bomType);
+          }
+          const index = idx != -1 ? idx : 0;
+          await this.bomTypeChange(list[index].id, 'init');
           this.loading = false;
         } catch (err) {
           this.$message.error(err.message);

+ 0 - 1
src/views/productionPlan/components/purchaseDialog.vue

@@ -91,7 +91,6 @@
         :columns="columns2"
         :datasource="materialList"
         :need-page="false"
-        height="300px"
         class="el-form-box"
         :toolkit="[]"
         :selection.sync="selection"

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

@@ -1030,7 +1030,8 @@
           .catch(() => {});
       },
       handleSelectionChange(list) {
-        if (list.length > 1) {
+        console.log(list,'list ___')
+        if (list.length > 0) {
           let _list = [];
           list.forEach((e) => {
             if (e.childList.length > 0 && e.splitBatch != 2) {

+ 21 - 18
src/views/saleOrder/components/create-order.vue

@@ -763,24 +763,23 @@
             const data = await findBomCategoryByCategoryIds(ids);
             this.handleResult(res.productInfoList, data, 'init');
           }
-
           this.disabledList = res.productInfoList;
           this.form = res;
-          // 如果没有bom版本的选择的话
-          this.disabledList.forEach((item, index) => {
-            if (item.bomVersionList && item.bomVersionList.length > 0) {
-              return;
-            }
-            let productType = item.productType;
-            let list = item.producedList;
-            if (!productType && list && list.length > 0) {
-              productType = list[0].code;
-            }
-            if (!productType) {
-              return;
-            }
-            this.changeProductType(item, index);
-          });
+          // // 如果没有bom版本的选择的话
+          // this.disabledList.forEach((item, index) => {
+          //   if (item.bomVersionList && item.bomVersionList.length > 0) {
+          //     return;
+          //   }
+          //   let productType = item.productType;
+          //   let list = item.producedList;
+          //   if (!productType && list && list.length > 0) {
+          //     productType = list[0].code;
+          //   }
+          //   if (!productType) {
+          //     return;
+          //   }
+          //   this.changeProductType(item, index);
+          // });
         });
       },
       cancel() {
@@ -1067,6 +1066,7 @@
           let ids = result.map((item) => item.categoryId);
           const res = await findBomCategoryByCategoryIds(ids);
           let datas = JSON.parse(JSON.stringify(result));
+          console.log(datas,'datas 00000')
           datas = await this.handleResult(datas, res);
           this.form.productInfoList = this.form.productInfoList.concat(datas);
         } else {
@@ -1093,7 +1093,6 @@
       },
       //
       async handleResult(result, res, type) {
-        console.log(result, 'result 1111');
         result.forEach((item) => {
           if (!res[item.categoryId]) {
             return;
@@ -1105,7 +1104,10 @@
           let arr = [];
           let first = val[0];
           arr = val.filter((item) => item.bomType == first.bomType);
-          item.productType = first.bomType - 0;
+          if (!item.productType) {
+            item.productType = first.bomType - 0;
+          }
+          console.log(arr,'arr')
           let list = this.calculationType(val);
           item.producedList = list;
           if (!type) {
@@ -1194,6 +1196,7 @@
         };
         this.wipeData(index);
         bomListByPlan(param).then((res) => {
+          console.log(res, 'res 3333');
           let arr = res || [];
           let data = this.form.productInfoList[index];
           if (arr.length) {

+ 132 - 19
src/views/saleOrder/components/orderHomogeneityInspectDialog.vue

@@ -137,6 +137,23 @@
                         </el-option>
                       </el-select>
                     </el-form-item>
+                    <el-form-item label="属性类型" v-if="produceType == 2">
+                      <el-select
+                        size="mini"
+                        v-model="formInline.attributeType"
+                        placeholder="属性类型"
+                        class="select-type"
+                        @change="attributeChange"
+                      >
+                        <el-option
+                          v-for="item in attributeList"
+                          :key="item.value"
+                          :label="item.label"
+                          :value="item.value"
+                        >
+                        </el-option>
+                      </el-select>
+                    </el-form-item>
                     <el-form-item label="最终状态">
                       <el-select
                         class="select-type"
@@ -235,13 +252,13 @@
         <el-button plain @click="cancel">取消</el-button>
         <!-- <el-button type="primary" @click="confirm">确定</el-button> -->
       </div>
-      <CreateOrder
+      <!-- <CreateOrder
         ref="createDialog"
         name="createDialog1"
         :is-add="false"
         v-if="orderShow"
         @refresh="refresh"
-      ></CreateOrder>
+      ></CreateOrder> -->
     </ele-modal>
 
     <stockDetailDialog ref="stockDetailDialog" />
@@ -261,12 +278,12 @@
   import stockDetailDialog from '../../productionPlan/components/stockDetailDialog.vue';
   import currentDetailDialog from '../../productionPlan/components/currentDetailDialog.vue';
   import purchaseDialog from '@/views/productionPlan/components/purchaseDialog.vue';
-  import CreateOrder from './create-order.vue';
+  // import CreateOrder from './create-order.vue';
   // import { findBomCategoryByCategoryId } from '@/api/productionPlan/index';
   // import CreateOrder from '../components/create-order.vue';
   export default {
     components: {
-      CreateOrder,
+      // CreateOrder,
       stockDetailDialog,
       currentDetailDialog,
       purchaseDialog
@@ -440,7 +457,8 @@
         bomIdList: [],
         requiredFormingNum: 0,
         formInline: {
-          finalState: 0
+          finalState: 0,
+          attributeType: 2
         },
         finalStateList: [
           {
@@ -487,7 +505,21 @@
         bomCode: '',
         produceType: 1,
         selection: [],
-        orderShow: false
+        orderShow: false,
+        attributeList: [
+          {
+            value: 'all',
+            label: '全部'
+          },
+          {
+            value: 2,
+            label: '采购件'
+          },
+          {
+            value: 3,
+            label: '外协件'
+          }
+        ]
       };
     },
     watch: {
@@ -604,8 +636,7 @@
           let bomMap = {
             1: 'PBOM',
             2: 'MBOM',
-            3: 'ABOM',
-            4: 'EBOM'
+            3: 'ABOM'
           };
           res.map((el) => {
             el.bomName = bomMap[el.bomType];
@@ -622,8 +653,17 @@
             }
           });
           let list = Object.values(obj);
+          if (list.length == 0) return;
           this.bomListType = list;
-          await this.bomTypeChange(list[0].id);
+          let bomObj = res.find(
+            (item) => item.bomId == this.orderInfo.bomCategoryId
+          );
+          let idx = 0;
+          if (bomObj && bomObj.bomId) {
+            idx = list.findIndex((item) => item.bomType == bomObj.bomType);
+          }
+          const index = idx != -1 ? idx : 0;
+          await this.bomTypeChange(list[index].id, 'init');
           this.loading = false;
         } catch (err) {
           this.$message.error(err.message);
@@ -631,7 +671,7 @@
         }
       },
       // 选择BOM类型
-      async bomTypeChange(e) {
+      async bomTypeChange(e, type) {
         this.formInline.bomType = e;
         this.bomCode = '';
         let data = this.bomListType.find((el) => el.id === e);
@@ -642,7 +682,14 @@
             name: data.name
           };
         });
-        await this.bomVChange(data.bomList[0].bomId);
+        let idx = 0;
+        if (type == 'init') {
+          idx = data.bomList.findIndex(
+            (item) => item.bomId == this.orderInfo.bomCategoryId
+          );
+        }
+        const index = idx != -1 ? idx : 0;
+        await this.bomVChange(data.bomList[index].bomId);
       },
       // 选择BOM版本
       async bomVChange(e) {
@@ -650,17 +697,72 @@
         let data = this.bomListV.find((el) => el.bomId === e);
         if (!data) return;
         this.bomCode = data.code;
-        await this.getMaterialData(data);
+        await this.getMaterialData(data, this.formInline.attributeType);
+      },
+
+      // 查询采购价跟外协件两个类型数据
+      async dataMerging() {
+        let params1 = {
+          salesOrderId: this.salesOrderId,
+          bomVersionId: this.formInline.bomId,
+          produceType: 2
+        };
+        let params2 = {
+          salesOrderId: this.salesOrderId,
+          bomVersionId: this.formInline.bomId,
+          produceType: 3
+        };
+        this.loading = true;
+        try {
+          // 直接调用接口函数,因为其返回Promise,无需额外包装
+          let p1 = findMaterialInfoSalesorder(params1);
+          let p2 = findMaterialInfoSalesorder(params2);
+          // 使用Promise.all并行执行多个Promise
+          let results = await Promise.all([p1, p2]);
+          this.loading = false;
+          console.log(results, 'results');
+          // 这里可以继续对results做后续处理,比如解构等
+          const [result1, result2] = results;
+          // 示例:可以接着处理result1和result2,比如合并数据等
+          const mergeData = this.handleMergedData(result1, result2);
+          console.log(mergeData, 'mergeData');
+          this.resultProcess(mergeData);
+        } catch (error) {
+          this.loading = false;
+          console.error('接口请求出错:', error);
+        }
+      },
+      handleMergedData(result1, result2) {
+        // 处理合并后的数据逻辑
+        return [...result1, ...result2];
+      },
+      // 切换属性
+      async attributeChange(e) {
+        if (e == 'all') {
+          this.dataMerging();
+          return;
+        }
+        let data = this.bomListV.find(
+          (el) => el.bomId === this.formInline.bomId
+        );
+        if (!data) return;
+        await this.getMaterialData(data, e);
       },
       // 获取物料数据信息
-      async getMaterialData(data) {
+      async getMaterialData(data, attributeType) {
+        if (attributeType == 'all') {
+          this.dataMerging();
+          return;
+        }
         let params = {};
         let api = null;
         if (this.source == 'list') {
+          let produceType =
+            this.produceType == 1 ? 1 : attributeType == 2 ? 2 : 3;
           params = {
             salesOrderId: this.salesOrderId,
             bomVersionId: data.bomId,
-            produceType: this.produceType
+            produceType: produceType
           };
           api = findMaterialInfoSalesorder;
         } else {
@@ -671,9 +773,18 @@
             requiredFormingNum: this.orderInfo.contractNum
           };
         }
-
-        // let api = this.source == 'list' ? findMaterialInfoSalesorder : findMaterialInfoByCategory;
-        const result = await api(params);
+        this.loading = true;
+        try {
+          const result = await api(params);
+          // 结果数据处理
+          this.resultProcess(result);
+          this.loading = false;
+        } catch (err) {
+          this.loading = false;
+        }
+      },
+      // 结果数据处理
+      resultProcess(result) {
         result.map((item) => {
           item.batchNo = this.orderInfo.batchNo;
           item.productCode = this.orderInfo.productCode;
@@ -685,7 +796,8 @@
               : '';
         });
         this.datasourceAllList = result;
-        this.finalChange(0);
+        this.finalChange(this.formInline.finalState);
+
       },
       // 选择状态
       finalChange(e) {
@@ -796,7 +908,8 @@
       },
       clearData() {
         this.formInline = {
-          finalState: 0
+          finalState: 0,
+          attributeType: 2
         };
         this.bomListV = [];
         this.bomListType = [];

+ 18 - 18
src/views/saleOrder/salesToProduction.vue

@@ -87,21 +87,21 @@
         factoryList: [],
 
         // 表单验证规则
-        rules: {
-          produceRoutingId: [
-            { required: true, message: '请选择工艺路线', trigger: 'blur' }
-          ],
-
-          produceType: [
-            { required: true, message: '请选择生产类型', trigger: 'blur' }
-          ],
-          bomCategoryId: [
-            { required: true, message: '请选择BOM版本', trigger: 'blur' }
-          ],
-          factoriesId: [
-            { required: true, message: '请选择所属工厂', trigger: 'change' }
-          ]
-        },
+        // rules: {
+        //   produceRoutingId: [
+        //     { required: true, message: '请选择工艺路线', trigger: 'blur' }
+        //   ],
+
+        //   produceType: [
+        //     { required: true, message: '请选择生产类型', trigger: 'blur' }
+        //   ],
+        //   bomCategoryId: [
+        //     { required: true, message: '请选择BOM版本', trigger: 'blur' }
+        //   ],
+        //   factoriesId: [
+        //     { required: true, message: '请选择所属工厂', trigger: 'change' }
+        //   ]
+        // },
         // selection: [],
         loading: false
       };
@@ -117,9 +117,9 @@
     },
     created() {
       console.log(111111111111111111)
-      this.requestDict('按单按库');
-      this.requestDict('订单类型');
-      this.requestDict('交付要求');
+      // this.requestDict('按单按库');
+      // this.requestDict('订单类型');
+      // this.requestDict('交付要求');
 
       this.getByCodeFn();
       this.getFactoryList();

+ 3 - 3
src/views/saleOrder/salesToProductionNew.vue

@@ -379,9 +379,9 @@
             { required: true, message: '请选择工艺路线', trigger: 'blur' }
           ],
 
-          factoriesId: [
-            { required: true, message: '请选择所属工厂', trigger: 'blur' }
-          ]
+          // factoriesId: [
+          //   { required: true, message: '请选择所属工厂', trigger: 'change' }
+          // ]
         },
         // selection: [],
         loading: false,

+ 4 - 4
src/views/saleOrder/salesToProductionNewTwo.vue

@@ -224,7 +224,7 @@
 
           <el-col v-bind="styleResponsive ? { lg: 5, md: 10 } : { span: 5 }">
             <!-- prop="factoriesId" -->
-            <el-form-item label="所属工厂:" prop="factoriesId">
+            <el-form-item label="所属工厂:" required>
               <el-select
                 v-model="form.factoriesId"
                 style="width: 100%"
@@ -863,9 +863,9 @@
           //   bomCategoryId: [
           //     { required: true, message: '请选择BOM版本', trigger: 'blur' }
           //   ],
-          factoriesId: [
-            { required: true, message: '请选择所属工厂', trigger: 'change' }
-          ]
+          // factoriesId: [
+          //   { required: true, message: '请选择所属工厂', trigger: 'change' }
+          // ]
         },
         // selection: [],
         loading: false,