ソースを参照

生产计划 销售订单 齐套性检查 功能完成

jingshuyong 1 年間 前
コミット
6e28cac68b

+ 25 - 0
src/api/productionPlan/index.js

@@ -245,3 +245,28 @@ export async function findMaterialInfoByPlanId(params) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+
+// 根据产品查询BOM分类
+export async function findBomSalesorderCategoryId(categoryId) {
+  const res = await request.get(
+    `/aps/salesorder/findBomCategoryByCategoryId/${categoryId}`
+  );
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 根据计划id查询物料信息
+export async function findMaterialInfoSalesorder(params) {
+  const res = await request.get(
+    '/aps/salesorder/findMaterialInfoBySalesOrderId',
+    {
+      params
+    }
+  );
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 1 - 1
src/views/materialPlan/components/produceOrder-search.vue

@@ -382,7 +382,7 @@
         where: { ...defaultWhere },
         treeData: [],
         productTypeList: [
-          { code: 1, name: '加工(MBOM)' },
+          { code: 2, name: '加工(MBOM)' },
           { code: 3, name: '装配(ABOM)' }
         ]
       };

+ 34 - 30
src/views/productionPlan/components/factoryAdd/index.vue

@@ -83,14 +83,9 @@
                 size="mini"
                 v-model="form.startTime"
                 @change="handleStartTimeChange(form)"
-                type="date"
+                type="datetime"
                 placeholder="选择日期"
-                value-format="yyyy-MM-dd"
-                :pickerOptions="{
-                  disabledDate: (time) =>
-                    time.getTime() <
-                    new Date(new Date().setHours(0, 0, 0, 0)).getTime()
-                }"
+                value-format="yyyy-MM-dd HH:mm:ss"
               >
               </el-date-picker>
             </el-form-item>
@@ -106,14 +101,9 @@
                 size="mini"
                 v-model="form.endTime"
                 @change="handleEndTimeChange(form)"
-                type="date"
+                type="datetime"
                 placeholder="选择日期"
-                value-format="yyyy-MM-dd"
-                :pickerOptions="{
-                  disabledDate: (time) =>
-                    time.getTime() <
-                    new Date(new Date().setHours(0, 0, 0, 0)).getTime()
-                }"
+                value-format="yyyy-MM-dd HH:mm:ss"
               >
               </el-date-picker>
             </el-form-item>
@@ -128,14 +118,9 @@
                 style="width: 100%"
                 size="mini"
                 v-model="form.reqMoldTime"
-                :pickerOptions="{
-                  disabledDate: (time) =>
-                    time.getTime() <
-                    new Date(new Date().setHours(0, 0, 0, 0)).getTime()
-                }"
-                type="date"
+                type="datetime"
                 placeholder="选择日期"
-                value-format="yyyy-MM-dd"
+                value-format="yyyy-MM-dd HH:mm:ss"
               >
               </el-date-picker>
             </el-form-item>
@@ -159,10 +144,10 @@
               <el-input
                 v-model.number="row.requiredFormingNum"
                 size="small"
-                type="number"
+                type="text"
                 style="width: 100%"
                 placeholder="输入要求生产数量"
-                @input="tableHandleKeyUp(row, 'procut')"
+                @input="(e) => handleQuantityInput(e, row)"
               ></el-input>
               <!-- placeholder="输入要求生产数量" @input="tableHandleKeyUp(row, 'sum')"></el-input> -->
             </template>
@@ -440,7 +425,8 @@
   export default {
     components: {
       EquipmentDialog,
-      ProcessRoute,contactDialog
+      ProcessRoute,
+      contactDialog
     },
     props: {
       factoryType: {
@@ -747,6 +733,14 @@
             { required: true, message: '请选择工艺路线', trigger: 'blur' }
           ],
 
+          startTime: [
+            { required: true, message: '请选择计划开始日期', trigger: 'blur' }
+          ],
+
+          endTime: [
+            { required: true, message: '请选择计划结束日期', trigger: 'blur' }
+          ],
+
           reqMoldTime: [
             { required: true, message: '请选择要求完成日期', trigger: 'blur' }
           ],
@@ -1037,12 +1031,11 @@
           this.$forceUpdate();
         });
       },
-      contactDialogSuccess(data){
-        console.log(data,'data 11')
+      contactDialogSuccess(data) {
+        console.log(data, 'data 11');
         // serialNo
         this.form.serialNo = data.serialNo;
-        this.$set(this.form,'customerName',data.name)
-
+        this.$set(this.form, 'customerName', data.name);
       },
       // 清空BOM 跟工艺路线
       wipeData(index) {
@@ -1218,7 +1211,7 @@
         // return
         // , index, e, name
         if (name == 'procut') {
-          row.return;
+          return;
         }
         if (row.specification && this.clientEnvironmentId == 4) {
           let modelArr = row.specification.split('*');
@@ -1331,7 +1324,18 @@
           }
         }
       },
-
+      // 数量正则 quantity
+      handleQuantityInput(e, row) {
+        // 过滤非数字字符(包括负号)
+        let value = e.replace(/[^\d]/g, '');
+        value = value.replace(/-/g, '');
+        // 限制不能以 0 开头(除非是 0 本身)
+        if (value.startsWith('0') && value.length > 1) {
+          value = value.slice(1);
+        }
+        // 更新绑定值
+        row.requiredFormingNum = value;
+      },
       changeProduceType(e) {
         if (this.clientEnvironmentId !== 4) {
           this.form.bomCategoryId = '';

+ 178 - 130
src/views/productionPlan/components/homogeneityInspectDialog.vue

@@ -9,7 +9,7 @@
       :title="'齐套性检查'"
       :maxable="true"
     >
-      <div class="form-wrapper">
+      <div class="form-wrapper" v-loading="loading">
         <div v-show="leftShow" :style="{ width: leftWidth }">
           <el-tree
             ref="treeRef"
@@ -24,7 +24,7 @@
         <div :style="{ width: rightWidth }">
           <div v-if="!leftShow" class="planInfo">
             <el-row style="width: 100%">
-              <el-col
+              <!-- <el-col
                 :span="planInfo.salesCode ? 6 : planInfo.salesCode.length * 6"
               >
                 <div style="color: blue; display: flex">
@@ -35,13 +35,15 @@
                     ></div
                   >
                 </div>
-              </el-col>
-              <el-col :span="6"> 计划编号:{{ planInfo.code }} </el-col>
-              <el-col :span="6"> 批次号:{{ planInfo.batchNo }} </el-col>
+              </el-col> -->
+              
+              <!-- <el-col :span="6"> 批次号:{{ planInfo.batchNo }} </el-col> -->
               <el-col :span="6"> 名称:{{ planInfo.productName }} </el-col>
-              <el-col :span="6"> 规格:{{ planInfo.specification }} </el-col>
-              <el-col :span="6"> 型号:{{ planInfo.model }} </el-col>
-              <el-col :span="6"> 计划数量:{{ planInfo.productNum }} </el-col>
+              <el-col :span="5"> 规格:{{ planInfo.specification }} </el-col>
+              <el-col :span="5"> 型号:{{ planInfo.model }} </el-col>
+              <el-col :span="2"> 牌号:{{ planInfo.brandNo }} </el-col>
+              <el-col :span="4"> 计划编号:{{ planInfo.code }} </el-col>
+              <el-col :span="2"> 计划数量:{{ planInfo.productNum }} </el-col>
             </el-row>
             <el-row> </el-row>
           </div>
@@ -55,9 +57,9 @@
               :datasource="datasourceList"
             >
               <template v-slot:toolbar>
-                <el-button type="primary" @click="bulkPurchase" size="mini"
+                <!-- <el-button type="primary" @click="bulkPurchase" size="mini"
                   >采购申请</el-button
-                >
+                > -->
               </template>
               <template v-slot:toolkit>
                 <el-form
@@ -99,6 +101,23 @@
                       </el-option>
                     </el-select>
                   </el-form-item>
+                  <el-form-item label="最终状态">
+                    <el-select
+                      class="select-type"
+                      size="mini"
+                      v-model="formInline.finalState"
+                      placeholder="最终状态"
+                      @change="finalChange"
+                    >
+                      <el-option
+                        v-for="item in finalStateList"
+                        :key="item.value"
+                        :label="item.label"
+                        :value="item.value"
+                      >
+                      </el-option>
+                    </el-select>
+                  </el-form-item>
                 </el-form>
               </template>
               <template v-slot:stockCount="{ row }">
@@ -119,19 +138,35 @@
                   {{ row.currentCount }}
                 </el-link>
               </template>
-              <template v-slot:stockColor="{ row }">
-                <div :class="{ statusRed: row.stockStatus == '缺料' }">
-                  {{ row.stockStatus }}
+              <template v-slot:inventoryStatusText="{ row }">
+                <div
+                  :class="
+                    row.inventoryStatusText == '缺料'
+                      ? 'statusRed'
+                      : 'statusGreen'
+                  "
+                >
+                  {{ row.inventoryStatusText }}
                 </div>
               </template>
-              <template v-slot:currentColor="{ row }">
-                <div :class="{ statusRed: row.currentStatus == '缺料' }">
-                  {{ row.currentStatus }}
+              <template v-slot:inTransitStatusText="{ row }">
+                <div
+                  :class="
+                    row.inTransitStatusText == '缺料'
+                      ? 'statusRed'
+                      : 'statusGreen'
+                  "
+                >
+                  {{ row.inTransitStatusText }}
                 </div>
               </template>
-              <template v-slot:finishColor="{ row }">
-                <div :class="{ statusRed: row.finishStatus == '缺料' }">
-                  {{ row.finishStatus }}
+              <template v-slot:finalStateText="{ row }">
+                <div
+                  :class="
+                    row.finalStateText == '缺料' ? 'statusRed' : 'statusGreen'
+                  "
+                >
+                  {{ row.finalStateText }}
                 </div>
               </template>
               <template v-slot:finishCount="{ row }">
@@ -140,7 +175,7 @@
                   <div v-else>-</div>
                 </div>
               </template>
-              <template v-slot:action="{ row }">
+              <!-- <template v-slot:action="{ row }">
                 <el-link
                   type="primary"
                   :underline="false"
@@ -148,7 +183,7 @@
                 >
                   采购申请
                 </el-link>
-              </template>
+              </template> -->
             </ele-pro-table>
           </div>
         </div>
@@ -189,19 +224,27 @@
     data() {
       return {
         visible: false,
-
-        formData: {},
-        requestData: {
-          deviceCode: '',
-          deviceName: '',
-          deviceId: ''
-        },
         requiredFormingNum: 0,
-        formInline: {},
+        formInline: {
+          finalState: 0
+        },
+        finalStateList: [
+          {
+            label: '全部',
+            value: 0
+          },
+          {
+            label: '齐套',
+            value: 1
+          },
+          {
+            label: '缺料',
+            value: 2
+          }
+        ],
         // form: {
         //   homogeneityInspect: []
         // },
-        rules: {},
         columns: [
           {
             columnKey: 'index',
@@ -209,37 +252,30 @@
             type: 'index',
             width: 55,
             align: 'center',
-            showOverflowTooltip: true,
-            fixed: 'left'
-          },
-          {
-            width: 45,
-            type: 'selection',
-            columnKey: 'selection',
-            align: 'center',
-            slot: 'selection',
             fixed: 'left'
           },
+          // {
+          //   width: 45,
+          //   type: 'selection',
+          //   columnKey: 'selection',
+          //   align: 'center',
+          //   slot: 'selection',
+          //   fixed: 'left'
+          // },
           {
-            prop: 'productCode',
-            label: '计划编号',
+            prop: 'batchNo',
+            label: '批次号',
             align: 'center',
             minWidth: 100,
             showOverflowTooltip: true
           },
           {
-            prop: 'opCode',
-            label: '工序编码',
+            prop: 'salesCode',
+            label: '销售订单号',
             align: 'center',
             minWidth: 100,
             showOverflowTooltip: true
           },
-          {
-            prop: 'taskName',
-            label: '工序名称',
-            align: 'center',
-            minWidth: 100
-          },
           {
             prop: 'code',
             label: '物料编码',
@@ -251,39 +287,36 @@
             prop: 'name',
             label: '物料名称',
             align: 'center',
-            minWidth: 100
+            minWidth: 100,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'demandQuantity',
+            label: '定额数量',
+            showOverflowTooltip: true,
+            align: 'center'
           },
           {
             prop: 'inventoryQuantity',
-            label: '库存',
-            showOverflowTooltip: true
+            label: '库存数量',
+            showOverflowTooltip: true,
+            align: 'center'
           },
           {
             prop: 'secureInventory',
             label: '安全库存',
-            showOverflowTooltip: true
+            showOverflowTooltip: true,
+            align: 'center'
           },
           {
             prop: 'lockQuantity',
             label: '锁库数量',
-            showOverflowTooltip: true
-          },
-
-          {
-            label: '采购数量',
-            align: 'center',
-            minWidth: 120
-          },
-          {
-            slot: 'stockCount',
-            prop: 'stockCount',
-            label: '库存数量',
-            align: 'center',
-            minWidth: 80
+            showOverflowTooltip: true,
+            align: 'center'
           },
           {
-            slot: 'stockStatus',
-            prop: 'stockStatus',
+            slot: 'inventoryStatusText',
+            prop: 'inventoryStatusText',
             label: '库存状态',
             align: 'center',
             minWidth: 80
@@ -296,41 +329,46 @@
             minWidth: 80
           },
           {
-            slot: 'currentColor',
-            prop: 'currentStatus',
+            prop: 'inTransitOrdersNum',
+            label: '在途已关联数量	',
+            align: 'center',
+            minWidth: 120
+          },
+          {
+            slot: 'inTransitStatusText',
+            prop: 'inTransitStatusText',
             label: '在途状态',
             align: 'center',
             minWidth: 80
           },
           {
-            label: '最终缺料数量',
+            label: '最终可用数量',
+            prop: 'finalAvailableQuantity',
             align: 'center',
-            minWidth: 80,
-            formatter: (row) => {
-              let total =
-                row.demandQuantity - row.inTransitNum - row.inventoryQuantity;
-              if (total < 0) {
-                return 0;
-              }
-              return total;
-            }
+            minWidth: 110
           },
           {
-            slot: 'finishColor',
-            prop: 'finishStatus',
-            label: '最终状态',
+            label: '最终缺料数量',
+            prop: 'finalShortageQuantity',
             align: 'center',
-            minWidth: 80
+            minWidth: 120
           },
           {
-            columnKey: 'action',
-            label: '操作',
-            width: 120,
+            slot: 'finalStateText',
+            prop: 'finalStateText',
+            label: '最终状态',
             align: 'center',
-            resizable: false,
-            fixed: 'right',
-            slot: 'action'
+            minWidth: 80
           }
+          // {
+          //   columnKey: 'action',
+          //   label: '操作',
+          //   width: 120,
+          //   align: 'center',
+          //   resizable: false,
+          //   fixed: 'right',
+          //   slot: 'action'
+          // }
         ],
         ids: [],
         leftShow: false,
@@ -344,11 +382,13 @@
         planInfo: {
           salesCode: ''
         },
+        datasourceAllList: [], // 表格物料全部数据
         datasourceList: [], // 表格物料数据
         bomListV: [], // BOM版本
         bomListType: [], // BOM 类型
         planId: '',
-        selectNodeId: ''
+        selectNodeId: '',
+        loading: false
       };
     },
     watch: {
@@ -365,9 +405,10 @@
     mounted() {},
     methods: {
       handleNodeClick(data) {
+        this.clearData();
         this.getBomData(data);
         this.selectNodeId = data.id;
-        // this.reload({ planIds: [data.id] });
+        this.planInfo = data;
       },
       reload(where) {
         this.$nextTick(() => {
@@ -390,25 +431,46 @@
         this.$refs.currentDetailDialog.open(row);
       },
       // 选择BOM类型
-      bomTypeChange(e) {
+      async bomTypeChange(e) {
         this.formInline.bomType = e;
         let data = this.bomListType.find((el) => el.id === e);
         if (!data) return;
         this.bomListV = data.bomList;
-        this.bomVChange(data.bomList[0].bomId);
+        await this.bomVChange(data.bomList[0].bomId);
       },
       // 选择BOM版本
-      bomVChange(e) {
+      async bomVChange(e) {
         this.formInline.bomId = e;
         let data = this.bomListV.find((el) => el.bomId === e);
         if (!data) return;
-        this.getMaterialData(data);
+        await this.getMaterialData(data);
       },
       // 获取物料数据信息
       async getMaterialData(data) {
         let params = { planId: this.planId, bomVersionId: data.bomId };
         const result = await findMaterialInfoByPlanId(params);
-        this.datasourceList = result;
+        result.map((item) => {
+          item.batchNo = this.planInfo.batchNo;
+          item.salesCode = this.planInfo.salesCode;
+          item.finalState =
+            item.finalStateText == '齐套'
+              ? 1
+              : item.finalStateText == '缺料'
+              ? 2
+              : '';
+        });
+        this.datasourceAllList = result;
+        this.finalChange(0);
+      },
+      // 选择状态
+      finalChange(e) {
+        if (e === 0 || !e) {
+          this.datasourceList = this.datasourceAllList;
+          return;
+        }
+        this.datasourceList = this.datasourceAllList.filter(
+          (item) => item.finalState === e
+        );
       },
       // 批量采购
       async bulkPurchase(list) {
@@ -434,55 +496,35 @@
         this.bulkPurchase([row]);
       },
       async open(dataList) {
-        console.log(dataList, '00000000000');
         this.visible = true;
         this.cardList = dataList;
-        // .map((item) => {
-        //   return {
-        //     id: item.id,
-        //     code: item.code,
-        //     categoryId: item.categoryId,
-        //     children: []
-        //   };
-        // });
         if (dataList.length === 1) {
           this.leftShow = false;
         } else {
           this.leftShow = true;
           const firstNodeKey = dataList[0].id;
           this.$nextTick(() => {
-            console.log(this.$refs, '00000000000');
             this.$refs.treeRef.setCurrentKey(firstNodeKey);
           });
         }
         this.handleNodeClick(dataList[0]);
-        // for (let item of this.cardList) {
-        //   let children = [];
-        //   if (item.salesCode) {
-        //     for (let ele of item.salesCode) {
-        //       children.push({ code: ele, id: item.id });
-        //     }
-        //   }
-        //   item.children = children;
-        // }
-        // this.planInfo = dataList.length > 0 ? dataList[0] : null;
-        // console.log(this.cardList,'cardListcardList');
-        // if (dataList.length > 1) {
-        //   this.leftShow = true;
-        // } else {
-        //   this.leftShow = false;
-        // }
-        // if (this.planInfo) {
-        //   this.reload({ planIds: [this.planInfo.id] });
-        // }
       },
       cancel() {
-        this.formData = {};
+        this.clearData();
         this.visible = false;
       },
-
+      clearData() {
+        this.formInline = {
+          finalState: 0
+        };
+        this.bomListV = [];
+        this.bomListType = [];
+        this.datasourceList = [];
+        this.datasourceAllList = [];
+      },
       // 获取bom 数据
       async getBomData(data) {
+        this.loading = true;
         try {
           this.planId = data.id;
           const res = await findBomCategoryByCategoryId(data.categoryId);
@@ -513,9 +555,11 @@
           });
           let list = Object.values(obj);
           this.bomListType = list;
-          this.bomTypeChange(list[0].id);
+          await this.bomTypeChange(list[0].id);
+          this.loading = false;
         } catch (err) {
           this.$message.error(err.message);
+          this.loading = false;
         }
       },
 
@@ -548,6 +592,10 @@
   .statusRed {
     color: red;
   }
+
+  .statusGreen {
+    color: green;
+  }
   .planInfo {
   }
   .form-wrapper {

+ 1 - 1
src/views/productionPlan/components/productionPlan-search.vue

@@ -367,7 +367,7 @@
         where: { ...defaultWhere },
         treeData: [],
         productTypeList: [
-          { code: 1, name: '加工(MBOM)' },
+          { code: 2, name: '加工(MBOM)' },
           { code: 3, name: '装配(ABOM)' }
         ]
       };

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

@@ -498,7 +498,7 @@
             prop: 'productName',
             label: '名称',
             align: 'center',
-
+            showOverflowTooltip: true,
             minWidth: 140
           },
           {
@@ -536,7 +536,34 @@
             slot: 'priority',
             sortable: 'custom'
           },
-
+          {
+            prop: 'productType',
+            label: '生产类型',
+            align: 'center',
+            width: 120,
+            formatter: (row) => {
+              if (row.produceType == 2) {
+                return '加工(MBOM)';
+              }
+              if (row.produceType == 3) {
+                return '装配(ABOM)';
+              }
+              return '';
+            }
+          },
+          {
+            prop: 'bomCategoryName',
+            label: 'BOM版本',
+            align: 'center',
+            width: 130,
+            showOverflowTooltip: true,
+            formatter: (row) => {
+              if (row.bomCategoryName) {
+                return `${row.bomCategoryName} (V${row.bomCategoryVersions}.0)`;
+              }
+              return '';
+            }
+          },
           {
             prop: 'produceRoutingName',
             label: '工艺路线',

+ 421 - 175
src/views/saleOrder/components/orderHomogeneityInspectDialog.vue

@@ -1,103 +1,173 @@
 <template>
   <div>
-  <ele-modal
-    width="80vw"
-    :visible.sync="visible"
-    :close-on-click-modal="false"
-    row-key="code"
-    custom-class="ele-dialog-form"
-    :title="'齐套性检查'"
-    :maxable="true"
-  >
-    <div class="form-wrapper">
-      <div v-if="leftShow" :style="{width: leftWidth}">
-        <el-tree :expand-on-click-node="false" :data="cardList" :props="treeProps" @node-click="handleNodeClick"></el-tree>
-      </div>
-      <div :style="{width: rightWidth}">
-        <div v-if="!leftShow" class="planInfo">
-          <el-row style="width: 100%;">
-<!--            <el-col :span="planInfo.salesCode ? 6 : planInfo.salesCode.length * 6">-->
-<!--              <div style="color: blue; display: flex;">-->
-<!--                <div>销售单号:</div><div v-if="planInfo.salesCode"><span v-for="item in planInfo.salesCode"> {{item}}</span></div>-->
-<!--              </div>-->
-<!--            </el-col>-->
-            <el-col :span="6">
-              销售单号:{{orderInfo.code}}
-            </el-col>
-            <el-col :span="6">
-              编号:{{orderInfo.productCode}}
-            </el-col>
-            <el-col :span="6">
-              名称:{{orderInfo.productName}}
-            </el-col>
-            <el-col :span="6">
-              规格:{{orderInfo.specification}}
-            </el-col>
-            <el-col :span="6">
-              型号:{{orderInfo.model}}
-            </el-col>
-            <el-col :span="6">
-              合同数量:{{orderInfo.contractNum}}
-            </el-col>
-          </el-row>
+    <ele-modal
+      width="80vw"
+      :visible.sync="visible"
+      :close-on-click-modal="false"
+      row-key="code"
+      custom-class="ele-dialog-form"
+      :title="'齐套性检查'"
+      :maxable="true"
+    >
+      <div class="form-wrapper" v-loading="loading">
+        <div v-show="leftShow" :style="{ width: leftWidth }">
+          <el-tree
+            ref="treeRef"
+            :expand-on-click-node="false"
+            :data="cardList"
+            :props="treeProps"
+            node-key="id"
+            highlight-current
+            @node-click="handleNodeClick"
+          ></el-tree>
         </div>
-        <div>
-          <ele-pro-table
-            ref="table"
-            :needPage="false"
-            :columns="columns"
-            key="checkTable"
-            :init-load="false"
-            :datasource="datasource"
-          >
-            <template v-slot:stockCount="{ row }">
-              <el-link type="primary" :underline="false" @click="stockDetail(row)">
-                {{ row.stockCount }}
-              </el-link>
-            </template>
-            <template v-slot:currentCount="{ row }">
-              <el-link type="primary" :underline="false" @click="currentDetail(row)">
-                {{ row.currentCount }}
-              </el-link>
-            </template>
-            <template v-slot:stockColor="{ row }">
-              <div :class="{'statusRed' : row.stockStatus == '缺料'}">
-                {{row.stockStatus}}
-              </div>
-            </template>
-            <template v-slot:currentColor="{ row }">
-              <div :class="{'statusRed' : row.currentStatus == '缺料'}">
-                {{row.currentStatus}}
-              </div>
-            </template>
-            <template v-slot:finishColor="{ row }">
-              <div :class="{'statusRed' : row.finishStatus == '缺料'}">
-                {{row.finishStatus}}
-              </div>
-            </template>
-            <template v-slot:finishCount="{ row }">
-              <div>
-                <div v-if="row.finishCount > 0">{{row.finishCount}}</div>
-                <div v-else>-</div>
-              </div>
-            </template>
-          </ele-pro-table>
+        <div :style="{ width: rightWidth }">
+          <div v-if="!leftShow" class="planInfo">
+            <el-row style="width: 100%">
+              <!--            <el-col :span="planInfo.salesCode ? 6 : planInfo.salesCode.length * 6">-->
+              <!--              <div style="color: blue; display: flex;">-->
+              <!--                <div>销售单号:</div><div v-if="planInfo.salesCode"><span v-for="item in planInfo.salesCode"> {{item}}</span></div>-->
+              <!--              </div>-->
+              <!--            </el-col>-->
+              <el-col :span="6"> 销售单号:{{ orderInfo.code }} </el-col>
+              <el-col :span="6"> 编号:{{ orderInfo.productCode }} </el-col>
+              <el-col :span="6"> 名称:{{ orderInfo.productName }} </el-col>
+              <el-col :span="6"> 规格:{{ orderInfo.specification }} </el-col>
+              <el-col :span="6"> 型号:{{ orderInfo.model }} </el-col>
+              <el-col :span="6"> 合同数量:{{ orderInfo.contractNum }} </el-col>
+            </el-row>
+          </div>
+          <div>
+            <ele-pro-table
+              ref="table"
+              :needPage="false"
+              :columns="columns"
+              key="checkTable"
+              :init-load="false"
+              :datasource="datasourceList"
+            >
+              <template v-slot:toolkit>
+                <el-form
+                  :inline="true"
+                  :model="formInline"
+                  class="demo-form-inline"
+                >
+                  <el-form-item label="BOM类型">
+                    <el-select
+                      size="mini"
+                      v-model="formInline.bomType"
+                      placeholder="BOM类型"
+                      class="select-type"
+                      @change="bomTypeChange"
+                    >
+                      <el-option
+                        v-for="item in bomListType"
+                        :key="item.id"
+                        :label="item.bomName"
+                        :value="item.id"
+                      >
+                      </el-option>
+                    </el-select>
+                  </el-form-item>
+                  <el-form-item label="BOM版本">
+                    <el-select
+                      class="select-type"
+                      size="mini"
+                      v-model="formInline.bomId"
+                      placeholder="BOM版本"
+                      @change="bomVChange"
+                    >
+                      <el-option
+                        v-for="item in bomListV"
+                        :key="item.bomId"
+                        :label="item.versions"
+                        :value="item.bomId"
+                      >
+                      </el-option>
+                    </el-select>
+                  </el-form-item>
+                  <el-form-item label="最终状态">
+                    <el-select
+                      class="select-type"
+                      size="mini"
+                      v-model="formInline.finalState"
+                      placeholder="最终状态"
+                      @change="finalChange"
+                    >
+                      <el-option
+                        v-for="item in finalStateList"
+                        :key="item.value"
+                        :label="item.label"
+                        :value="item.value"
+                      >
+                      </el-option>
+                    </el-select>
+                  </el-form-item>
+                </el-form>
+              </template>
+              <template v-slot:stockCount="{ row }">
+                <el-link
+                  type="primary"
+                  :underline="false"
+                  @click="stockDetail(row)"
+                >
+                  {{ row.stockCount }}
+                </el-link>
+              </template>
+              <template v-slot:currentCount="{ row }">
+                <el-link
+                  type="primary"
+                  :underline="false"
+                  @click="currentDetail(row)"
+                >
+                  {{ row.currentCount }}
+                </el-link>
+              </template>
+              <template v-slot:stockColor="{ row }">
+                <div :class="{ statusRed: row.stockStatus == '缺料' }">
+                  {{ row.stockStatus }}
+                </div>
+              </template>
+              <template v-slot:currentColor="{ row }">
+                <div :class="{ statusRed: row.currentStatus == '缺料' }">
+                  {{ row.currentStatus }}
+                </div>
+              </template>
+              <template v-slot:finishColor="{ row }">
+                <div :class="{ statusRed: row.finishStatus == '缺料' }">
+                  {{ row.finishStatus }}
+                </div>
+              </template>
+              <template v-slot:finishCount="{ row }">
+                <div>
+                  <div v-if="row.finishCount > 0">{{ row.finishCount }}</div>
+                  <div v-else>-</div>
+                </div>
+              </template>
+            </ele-pro-table>
+          </div>
         </div>
       </div>
-    </div>
-    <div slot="footer">
-      <el-button plain @click="cancel">取消</el-button>
-      <el-button type="primary" @click="confirm">确定</el-button>
-    </div>
-  </ele-modal>
+      <div slot="footer">
+        <el-button plain @click="cancel">取消</el-button>
+        <el-button type="primary" @click="confirm">确定</el-button>
+      </div>
+    </ele-modal>
 
-  <stockDetailDialog ref="stockDetailDialog" />
+    <stockDetailDialog ref="stockDetailDialog" />
 
-  <currentDetailDialog ref="currentDetailDialog" />
+    <currentDetailDialog ref="currentDetailDialog" />
   </div>
 </template>
 
 <script>
+  import {
+    homogeneityInspect,
+    homogeneityInspectMerge,
+    findBomSalesorderCategoryId,
+    findMaterialInfoSalesorder,
+    getBom
+  } from '@/api/productionPlan/index.js';
   import { orderHomogeneityInspect } from '@/api/saleOrder/index.js';
   import stockDetailDialog from '../../productionPlan/components/stockDetailDialog.vue';
   import currentDetailDialog from '../../productionPlan/components/currentDetailDialog.vue';
@@ -111,95 +181,157 @@
         visible: false,
 
         bomIdList: [],
-        formData: {},
-        requestData: {
-          deviceCode: '',
-          deviceName: '',
-          deviceId: ''
-        },
         requiredFormingNum: 0,
-
+        formInline: {
+          finalState: 0
+        },
+        finalStateList: [
+          {
+            label: '全部',
+            value: 0
+          },
+          {
+            label: '齐套',
+            value: 1
+          },
+          {
+            label: '缺料',
+            value: 2
+          }
+        ],
+        loading: false,
+        datasourceAllList: [], // 表格物料全部数据
+        datasourceList: [], // 表格物料数据
+        bomListV: [], // BOM版本
+        bomListType: [], // BOM 类型
         form: {
           homogeneityInspect: []
         },
 
-        rules: {},
-
         columns: [
           {
-            prop: 'opCode',
-            label: '工序编码',
+            columnKey: 'index',
+            label: '序号',
+            type: 'index',
+            width: 55,
+            align: 'center',
+            fixed: 'left'
+          },
+          {
+            width: 45,
+            type: 'selection',
+            columnKey: 'selection',
+            align: 'center',
+            slot: 'selection',
+            fixed: 'left'
+          },
+          {
+            prop: 'batchNo',
+            label: '批次号',
             align: 'center',
             minWidth: 100,
             showOverflowTooltip: true
           },
           {
-            prop: 'opName',
-            label: '工序名称',
+            prop: 'productCode',
+            label: '编码',
             align: 'center',
-            minWidth: 100
+            minWidth: 100,
+            showOverflowTooltip: true
           },
           {
-            prop: 'bomCode',
+            prop: 'code',
             label: '物料编码',
             align: 'center',
             minWidth: 100,
             showOverflowTooltip: true
           },
           {
-            prop: 'bomName',
+            prop: 'name',
             label: '物料名称',
             align: 'center',
-            minWidth: 100
+            minWidth: 100,
+            showOverflowTooltip: true
           },
           {
-            prop: 'count',
+            prop: 'demandQuantity',
             label: '定额数量',
-            align: 'center',
-            minWidth: 80
+            showOverflowTooltip: true,
+            align: 'center'
           },
           {
-            slot: 'stockCount',
-            prop: 'stockCount',
+            prop: 'inventoryQuantity',
             label: '库存数量',
-            align: 'center',
-            minWidth: 80
+            showOverflowTooltip: true,
+            align: 'center'
+          },
+          {
+            prop: 'secureInventory',
+            label: '安全库存',
+            showOverflowTooltip: true,
+            align: 'center'
+          },
+          {
+            prop: 'lockQuantity',
+            label: '锁库数量',
+            showOverflowTooltip: true,
+            align: 'center'
           },
           {
-            slot: 'stockColor',
-            prop: 'stockStatus',
+            slot: 'inventoryStatusText',
+            prop: 'inventoryStatusText',
             label: '库存状态',
             align: 'center',
             minWidth: 80
           },
           {
-            slot: 'currentCount',
-            prop: 'currentCount',
+            slot: 'inTransitNum',
+            prop: 'inTransitNum',
             label: '在途数量',
             align: 'center',
             minWidth: 80
           },
           {
-            slot: 'currentColor',
-            prop: 'currentStatus',
+            prop: 'inTransitOrdersNum',
+            label: '在途已关联数量	',
+            align: 'center',
+            minWidth: 120
+          },
+          {
+            slot: 'inTransitStatusText',
+            prop: 'inTransitStatusText',
             label: '在途状态',
             align: 'center',
             minWidth: 80
           },
           {
-            slot: 'finishCount',
-            prop: 'finishCount',
+            label: '最终可用数量',
+            prop: 'finalAvailableQuantity',
+            align: 'center',
+            minWidth: 110
+          },
+          {
             label: '最终缺料数量',
+            prop: 'finalShortageQuantity',
             align: 'center',
-            minWidth: 80
+            minWidth: 120
           },
           {
-            slot: 'finishColor',
-            prop: 'finishStatus',
+            slot: 'finalStateText',
+            prop: 'finalStateText',
             label: '最终状态',
             align: 'center',
             minWidth: 80
           },
+          // {
+          //   columnKey: 'action',
+          //   label: '操作',
+          //   width: 120,
+          //   align: 'center',
+          //   resizable: false,
+          //   fixed: 'right',
+          //   slot: 'action'
+          // }
         ],
         ids: [],
         leftShow: false,
@@ -208,10 +340,7 @@
         cardList: [],
         treeProps: {
           label: 'code',
-          children: 'children',
-        },
-        planInfo: {
-          salesCode: '',
+          children: 'children'
         },
         orderInfo: {
           code: '',
@@ -219,64 +348,82 @@
           productName: '',
           contractNum: '',
           specification: '',
-          model: '',
+          model: ''
         }
       };
     },
     watch: {
-      leftShow(newVal, oldVal){
-        if(newVal){
-          this.leftWidth = '15%';
-          this.rightWidth = '85%';
+      leftShow(newVal, oldVal) {
+        if (newVal) {
+          this.leftWidth = '230px';
+          this.rightWidth = 'calc(100% - 230px)';
         } else {
-          this.leftWidth = '0%';
+          this.leftWidth = '0';
           this.rightWidth = '100%';
         }
       }
     },
     methods: {
-        reload(where) {
+      reload(where) {
+        this.$nextTick(() => {
+          this.$refs.table.reload({ page: 1, where });
+        });
+      },
+      /* 表格数据源 */
+      datasource({ page, limit, where }) {
+        return orderHomogeneityInspect({
+          pageNum: page,
+          size: limit,
+          ...where
+        });
+      },
+      stockDetail(row) {
+        this.$refs.stockDetailDialog.open(row);
+      },
+      currentDetail(row) {
+        this.$refs.currentDetailDialog.open(row);
+      },
+      open(dataList, order) {
+        console.log(order, 'order order order 1');
+        console.log(dataList, 'dataList');
+        this.visible = true;
+        this.cardList = dataList.map((el) => {
+          return {
+            ...order,
+            ...el
+          };
+        });
+        if (dataList.length === 1) {
+          this.leftShow = false;
+        } else {
+          this.leftShow = true;
+          const firstNodeKey = dataList[0].id;
           this.$nextTick(() => {
-            this.$refs.table.reload({ page: 1, where });
-          });
-        },
-        /* 表格数据源 */
-        datasource({ page, limit, where }) {
-          return orderHomogeneityInspect({
-            pageNum: page,
-            size: limit,
-            ...where,
+            this.$refs.treeRef.setCurrentKey(firstNodeKey);
           });
-        },
-       stockDetail(row) {
-         this.$refs.stockDetailDialog.open(row);
-       },
-       currentDetail(row) {
-         this.$refs.currentDetailDialog.open(row);
-       },
-      open(data, order) {
-         this.visible = true;
-         this.bomIdList = [];
-         if(data){
-           if(data.length == 1){
-             this.orderInfo = data[0];
-             this.orderInfo.code = order.code;
-             console.log(this.orderInfo);
-             this.leftShow = false;
-           } else {
-             this.leftShow = true;
-           }
-           let list = [];
-           for(let item of data){
-             list.push({bomId: item.bomCategoryId, planNum: item.contractNum});
-           }
-           this.bomIdList = list;
-           this.reload({bomIdList: this.bomIdList});
-         }
-
+        }
+        this.handleNodeClick(this.cardList[0]);
+        // this.visible = true;
+        // this.bomIdList = [];
+        // if (data) {
+        //   if (data.length == 1) {
+        //     this.orderInfo = data[0];
+        //     this.orderInfo.code = order.code;
+        //     console.log(this.orderInfo);
+        //     this.leftShow = false;
+        //   } else {
+        //     this.leftShow = true;
+        //   }
+        //   let list = [];
+        //   for (let item of data) {
+        //     list.push({ bomId: item.bomCategoryId, planNum: item.contractNum });
+        //   }
+        //   this.bomIdList = list;
+        //   this.reload({ bomIdList: this.bomIdList });
+        // }
       },
       cancel() {
-        this.formData = {};
+        this.clearData();
         this.visible = false;
       },
 
@@ -284,10 +431,105 @@
         this.visible = false;
       },
 
-      handleNodeClick(data){
-          console.log(data);
+      handleNodeClick(data) {
+        this.clearData();
+        this.getBomData(data);
+        this.selectNodeId = data.id;
+        this.orderInfo = data;
+        // console.log(data);
         // this.reload({planIds: [data.id]});
       },
+      // 获取bom 数据
+      async getBomData(data) {
+        this.loading = true;
+        try {
+          this.planId = data.id;
+          const res = await findBomSalesorderCategoryId(data.categoryId);
+          if (!res || res.length == 0) {
+            this.bomListD = [];
+            this.datasourceList = [];
+            return;
+          }
+          let obj = {};
+          let bomMap = {
+            1: 'PBOM',
+            2: 'MBOM',
+            3: 'ABOM',
+            4: 'EBOM'
+          };
+          res.map((el) => {
+            el.bomName = bomMap[el.bomType];
+            let OBMINFO = {
+              bomId: el.bomId,
+              bomType: el.type,
+              versions: `V${el.versions}.0`
+            };
+            if (obj[el.bomType]) {
+              obj[el.bomType].bomList.unshift(OBMINFO);
+            } else {
+              obj[el.bomType] = { ...el, bomList: [OBMINFO] };
+            }
+          });
+          let list = Object.values(obj);
+          this.bomListType = list;
+          await this.bomTypeChange(list[0].id);
+          this.loading = false;
+        } catch (err) {
+          this.$message.error(err.message);
+          this.loading = false;
+        }
+      },
+      // 选择BOM类型
+      async bomTypeChange(e) {
+        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);
+      },
+      // 选择BOM版本
+      async bomVChange(e) {
+        this.formInline.bomId = e;
+        let data = this.bomListV.find((el) => el.bomId === e);
+        if (!data) return;
+        await this.getMaterialData(data);
+      },
+      // 获取物料数据信息
+      async getMaterialData(data) {
+        let params = { planId: this.planId, bomVersionId: data.bomId };
+        const result = await findMaterialInfoSalesorder(params);
+        result.map((item) => {
+          item.batchNo = this.orderInfo.batchNo;
+          item.productCode = this.orderInfo.productCode;
+          item.finalState =
+            item.finalStateText == '齐套'
+              ? 1
+              : item.finalStateText == '缺料'
+              ? 2
+              : '';
+        });
+        this.datasourceAllList = result;
+        this.finalChange(0);
+      },
+      // 选择状态
+      finalChange(e) {
+        if (e === 0 || !e) {
+          this.datasourceList = this.datasourceAllList;
+          return;
+        }
+        this.datasourceList = this.datasourceAllList.filter(
+          (item) => item.finalState === e
+        );
+      },
+      clearData() {
+        this.formInline = {
+          finalState: 0
+        };
+        this.bomListV = [];
+        this.bomListType = [];
+        this.datasourceList = [];
+        this.datasourceAllList = [];
+      }
     }
   };
 </script>
@@ -300,8 +542,12 @@
   .el-form-item {
     margin-bottom: 0 !important;
   }
-  .planInfo{
+  .planInfo {
     display: flex;
     font-size: 16px;
   }
+
+  .form-wrapper {
+    display: flex;
+  }
 </style>

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

@@ -446,7 +446,7 @@
             }
           });
           let res = await getByCodeList(codeList);
-          console.log(res);
+          console.log(res,'0000000000000000');
           let flag = true;
           let type = 0;
           let data = [];

+ 13 - 7
src/views/saleOrder/salesToProductionNew.vue

@@ -516,7 +516,7 @@
         }
       },
 
-      bomListVersion() {
+      bomListVersion(type) {
         let categoryId = '';
         if (this.form.salesOrders.length) {
           categoryId = this.form.salesOrders[0].categoryId;
@@ -533,13 +533,19 @@
           this.bomVersionList = res || [];
           if (res.length) {
             let o = res[0];
-            this.$set(this.form, 'bomCategoryId', o.id);
+            if (type == 'init') {
+              let query = this.$route.query;
+              let id = query.bomCategoryId ? query.bomCategoryId : o.id;
+              this.$set(this.form, 'bomCategoryId', id);
+            } else {
+              this.$set(this.form, 'bomCategoryId', o.id);
+            }
             this.changeBomId();
           }
         });
       },
 
-      changeProduceType() {
+      changeProduceType(type) {
         if (this.clientEnvironmentId == 4) {
           return false;
         }
@@ -554,7 +560,7 @@
         this.form.produceRoutingName = '';
         this.form.produceVersionName = '';
         this.selectionRowShow = false; // ****
-        this.bomListVersion();
+        this.bomListVersion(type);
       },
 
       changeBomId() {
@@ -592,7 +598,7 @@
           //   this.form.produceType = 2;
           //   this.bomListVersion();
           // }
-          this.bomListVersion();
+          // this.bomListVersion();
           this.form.produceRoutingName =
             res.produceRoutingName || this.$route.query.produceRoutingName;
           this.form.produceRoutingId =
@@ -601,6 +607,7 @@
             res.factoriesId || this.$route.query.factoriesId;
           this.form.bomCategoryId =
             res.bomCategoryId || this.$route.query.bomCategoryId;
+          this.changeProduceType('init');
           this.changeBomId();
           console.log(this.form.factoriesId, '99999999999999');
           if (this.clientEnvironmentId == '4') {
@@ -1061,7 +1068,7 @@
     margin-bottom: 0;
   }
 
-    .header_required {
+  .header_required {
     position: relative;
   }
 
@@ -1072,5 +1079,4 @@
     top: 11px;
     left: 15px;
   }
-
 </style>

+ 18 - 8
src/views/saleOrder/salesToProductionNewTwo.vue

@@ -821,6 +821,7 @@
         marginList: [],
         bomVersionList: [],
         routingList: [],
+        init: '1',
         factoryList: [],
         // 表单验证规则
         rules: {
@@ -978,7 +979,7 @@
         const data = await getUpdateInfoById(id);
 
         console.log(data, '订单的data');
-
+        console.log(11111111111111111111111111111);
         this.form = data;
         this.initTime();
         // if (data.startTime) {
@@ -1045,7 +1046,8 @@
         }
       },
 
-      bomListVersion() {
+      bomListVersion(type) {
+        console.log(type,'type 传递的参数 33')
         let categoryId = '';
 
         if (this.form.salesOrders.length) {
@@ -1063,12 +1065,18 @@
           this.bomVersionList = res || [];
           if (res.length) {
             let o = res[0];
-            this.$set(this.form, 'bomCategoryId', o.id);
+            if (type == 'init') {
+              let query = this.$route.query;
+              let id = query.bomCategoryId ? query.bomCategoryId : o.id;
+              this.$set(this.form, 'bomCategoryId', id);
+            } else {
+              this.$set(this.form, 'bomCategoryId', o.id);
+            }
             this.changeBomId();
           }
         });
       },
-      changeProduceType() {
+      changeProduceType(type) {
         if (this.clientEnvironmentId == 4) {
           return false;
         }
@@ -1083,7 +1091,7 @@
         this.form.produceRoutingName = '';
         this.form.produceVersionName = '';
         this.selectionRowShow = false; // ****
-        this.bomListVersion();
+        this.bomListVersion(type);
       },
 
       changeBomId() {
@@ -1119,9 +1127,11 @@
       getSaleInfo() {
         let params = JSON.parse(this.$route.query.selection);
         productionToPlan(params).then((res) => {
+          console.log(this.$route.query);
           this.form = deepClone(res);
+          console.log(222222222222222222222222, '===');
           this.initTime();
-          this.bomListVersion();
+          // this.bomListVersion('init');
 
           this.form.produceRoutingName =
             res.produceRoutingName || this.$route.query.produceRoutingName;
@@ -1136,10 +1146,10 @@
           this.form.produceType = this.$route.query.produceType
             ? parseInt(this.$route.query.produceType)
             : res.produceType;
-          this.changeProduceType();
+          this.changeProduceType('init');
           this.form.bomCategoryId =
             res.bomCategoryId || this.$route.query.bomCategoryId;
-          this.changeBomId();
+          // this.changeBomId();
           if (this.clientEnvironmentId == '4') {
             if (this.form.salesOrders[0].productName.includes('板材')) {
               this.changeProduct({

+ 29 - 1
src/views/workOrder/index.vue

@@ -388,7 +388,7 @@
             minWidth: 220,
             sortable: true
           },
-           {
+          {
             prop: 'taskName',
             action: 'taskName',
             label: '工序进度',
@@ -401,6 +401,34 @@
             align: 'center',
             minWidth: 150
           },
+          {
+            prop: 'productType',
+            label: '生产类型',
+            align: 'center',
+            width: 120,
+            formatter: (row) => {
+              if (row.produceType == 2) {
+                return '加工(MBOM)';
+              }
+              if (row.produceType == 3) {
+                return '装配(ABOM)';
+              }
+              return '';
+            }
+          },
+          {
+            prop: 'bomCategoryName',
+            label: 'BOM版本',
+            align: 'center',
+            width: 130,
+            showOverflowTooltip: true,
+            formatter: (row) => {
+              if (row.bomCategoryName) {
+                return `${row.bomCategoryName} (V${row.bomCategoryVersions}.0)`;
+              }
+              return '';
+            }
+          },
           {
             prop: 'produceRoutingName',
             label: '工艺路线',