Przeglądaj źródła

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

jingshuyong 10 miesięcy temu
rodzic
commit
f8e74cf9aa

+ 4 - 4
src/api/productionPlan/index.js

@@ -222,9 +222,9 @@ export async function getOrderBomRoot(data) {
 }
 
 // 根据产品查询BOM分类
-export async function findBomCategoryByCategoryId(categoryId) {
+export async function findBomCategoryByCategoryId(categoryId, produceType) {
   const res = await request.get(
-    `/aps/productionplan/findBomCategoryByCategoryId/${categoryId}`
+    `/aps/productionplan/findBomCategoryByCategoryId/${categoryId}?produceType=${produceType}`
   );
   if (res.data.code == 0) {
     return res.data.data;
@@ -247,9 +247,9 @@ export async function findMaterialInfoByPlanId(params) {
 }
 
 // 根据产品查询BOM分类
-export async function findBomSalesorderCategoryId(categoryId) {
+export async function findBomSalesorderCategoryId(categoryId, produceType) {
   const res = await request.get(
-    `/aps/salesorder/findBomCategoryByCategoryId/${categoryId}`
+    `/aps/salesorder/findBomCategoryByCategoryId/${categoryId}?produceType=${produceType}`
   );
   if (res.data.code == 0) {
     return res.data.data;

+ 52 - 42
src/views/materialPlan/components/plan-edit-dialog.vue

@@ -24,6 +24,7 @@
               :key="formData.demandType"
               placeholder="请选择"
               style="width: 100%"
+              @change="changeDemandType"
               :disabled="type == 'detail'"
             >
               <el-option
@@ -872,12 +873,11 @@
         this.tableData = this.$refs.table.getData();
         this.$refs.saleOrderRef.open(this.tableData);
       },
-      chooseOrder(list) {
+      async chooseOrder(list) {
         let salesOrderIds = [];
         console.log(list, 'listlistlistlistlistlistlistlistlist 获取的数据');
         const tableList = this.$refs.table.getData() || [];
         const existingIds = tableList.map((item) => item.id);
-
         console.log(existingIds, '获取已存在的ID');
 
         const list1 = list.filter((item) => !existingIds.includes(item.id));
@@ -889,51 +889,62 @@
         list1.forEach((m) => {
           salesOrderIds.push(m.id);
         });
-
-        if (salesOrderIds.length > 0) {
-          listBomBySalesOrderIdsOverride({
+        if (salesOrderIds.length === 0) return;
+        // if (salesOrderIds.length > 0) {
+        try {
+          let res = await listBomBySalesOrderIdsOverride({
             salesOrderIds: salesOrderIds,
             demandType: this.formData.demandType
-          }).then((res) => {
-            res.forEach((m) => {
-              console.log(m, 'm');
-              if (m.materialList.length > 0) {
-                m.materialList.forEach((p) => {
-                  p.detailId = m.id;
-                });
-              }
-            });
-            this.bomType = 1;
-
-            const finalData = res.filter(
-              (item) => !tableList.some((existing) => existing.id === item.id)
-            );
-
-            this.bomCategoryList = finalData;
-
-            const finalDates = finalData.map((item) => {
-              // if (item.bomCategoryList.bomType == '1') {
-
-              // }
-              if (item.bomCategoryList.length > 0) {
-                item.bomCategoryList.forEach((items) => {});
-              }
-            });
-
-            console.log(finalData, 'finalData');
-
-            this.$refs.table.setData([...tableList, ...finalData]);
-
-            this.$nextTick(() => {
-              this.expandedRowKeys = this.$refs.table
-                .getData()
-                .map((item) => item.id);
-              this.$refs.table.toggleRowExpansionAll();
+          });
+          this.renderTable(tableList, res);
+        } catch (e) {
+          this.$refs.table.setData([]);
+          this.expandedRowKeys = [];
+        }
+      },
+      renderTable(tableList, res) {
+        if (!res || res.length === 0) {
+          this.$refs.table.setData([]);
+          this.expandedRowKeys = [];
+          return;
+        }
+        res.forEach((m) => {
+          if (m.materialList.length > 0) {
+            m.materialList.forEach((p) => {
+              p.detailId = m.id;
             });
+          }
+        });
+        this.bomType = 1;
+        const finalData = res.filter(
+          (item) => !tableList.some((existing) => existing.id === item.id)
+        );
+        this.bomCategoryList = finalData;
+        this.$refs.table.setData([...tableList, ...finalData]);
+        this.$nextTick(() => {
+          this.expandedRowKeys = this.$refs.table
+            .getData()
+            .map((item) => item.id);
+          this.$refs.table.toggleRowExpansionAll();
+        });
+      },
+      async changeDemandType(e) {
+        const tableList = this.$refs.table.getData() || [];
+        if (!tableList || tableList.length === 0) {
+          return;
+        }
+        try {
+          const salesOrderIds = tableList.map((item) => item.id);
+          const res = await listBomBySalesOrderIdsOverride({
+            salesOrderIds: salesOrderIds,
+            demandType: e
           });
+          this.renderTable(tableList, res);
+        } catch (e) {
+          this.$refs.table.setData([]);
+          this.expandedRowKeys = [];
         }
       },
-
       categorySelect(row) {
         this.$refs.productRefs.open(row.materialList, row, this.type);
       },
@@ -1073,7 +1084,6 @@
       },
       // 处理表格选中行的变化
       handleSelectionChange(selection) {
-        console.log(selection, 'sssssssselectionsssssss');
         this.multipleSelection = selection;
       },
       handleCancel() {

+ 5 - 2
src/views/materialPlan/components/produceOrder-search.vue

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

+ 44 - 34
src/views/materialPlan/components/producePlan.vue

@@ -24,6 +24,7 @@
               :key="formData.demandType"
               placeholder="请选择"
               style="width: 100%"
+              @change="changeDemandType"
               :disabled="type == 'detail'"
             >
               <el-option
@@ -513,7 +514,7 @@
           detailRemoveIds: [],
           materialRemoveIds: [],
           orderType: 2,
-          sourceType:1
+          sourceType: 1
         },
         demandTypeList: [
           {
@@ -941,54 +942,63 @@
         this.tableData = this.$refs.table.getData();
         this.$refs.produceOrderRef.open(this.tableData);
       },
-      chooseOrder(list) {
+      async chooseOrder(list) {
         console.log(list, 'list222');
         let planIds = [];
-
         const tableList = this.$refs.table.getData() || [];
         const existingIds = tableList.map((item) => item.id);
-
         console.log(existingIds, '获取已存在的ID');
-
         const list1 = list.filter((item) => !existingIds.includes(item.id));
         if (list1.length === 0) {
           this.$message.warning('所选数据已存在');
           return;
         }
-
         list1.forEach((m) => {
           planIds.push(m.id);
         });
-
-        if (planIds.length > 0) {
-          listBomByPlanIdsOverride({
-            planIds: planIds,
-            demandType: this.formData.demandType
-          }).then((res) => {
-            res.forEach((m) => {
-              console.log(m, 'm');
-              if (m.materialList.length > 0) {
-                m.materialList.forEach((p) => {
-                  p.detailId = m.id;
-                });
-              }
-            });
-
-            const finalData = res.filter(
-              (item) => !tableList.some((existing) => existing.id === item.id)
-            );
-            console.log(finalData, 'finalData');
-            let dataList = this.getBpmList(finalData);
-            // this.$refs.table.setData([...tableList, ...finalData]);
-             this.$refs.table.setData([...tableList, ...dataList]);
-
-            this.$nextTick(() => {
-              this.expandedRowKeys = this.$refs.table
-                .getData()
-                .map((item) => item.bomId);
-              this.$refs.table.toggleRowExpansionAll();
+        if (planIds.length === 0) return;
+        let res = await listBomByPlanIdsOverride({
+          planIds: planIds,
+          demandType: this.formData.demandType
+        });
+        this.renderTable(tableList, res);
+      },
+      renderTable(tableList, res) {
+        res.forEach((m) => {
+          if (m.materialList.length > 0) {
+            m.materialList.forEach((p) => {
+              p.detailId = m.id;
             });
+          }
+        });
+        const finalData = res.filter(
+          (item) => !tableList.some((existing) => existing.id === item.id)
+        );
+        let dataList = this.getBpmList(finalData);
+        this.$refs.table.setData([...tableList, ...dataList]);
+
+        this.$nextTick(() => {
+          this.expandedRowKeys = this.$refs.table
+            .getData()
+            .map((item) => item.bomId);
+          this.$refs.table.toggleRowExpansionAll();
+        });
+      },
+      async changeDemandType(e) {
+        const tableList = this.$refs.table.getData() || [];
+        if (!tableList || tableList.length === 0) {
+          return;
+        }
+        try {
+          const planIds = tableList.map((item) => item.id);
+          const res = await listBomByPlanIdsOverride({
+            planIds: planIds,
+            demandType: e
           });
+          this.renderTable(tableList, res);
+        } catch (e) {
+          this.$refs.table.setData([]);
+          this.expandedRowKeys = [];
         }
       },
       categorySelect(row) {

+ 151 - 35
src/views/productionPlan/components/homogeneityInspectDialog.vue

@@ -75,31 +75,137 @@
                 key="id"
                 :selection.sync="selection"
               >
-                <template v-slot:toolbar>
+                <template v-slot:default>
+                  <div class="tool">
+                    <div class="tool_l">
+                      <el-button
+                        v-if="produceType == 2"
+                        type="primary"
+                        @click="bulkPurchase"
+                        size="medium"
+                        >下发采购计划</el-button
+                      >
+                      <el-button
+                        v-if="produceType == 1"
+                        type="primary"
+                        @click="issuePlan"
+                        size="medium"
+                        >下发生产计划</el-button
+                      >
+                    </div>
+                    <div class="tool_r">
+                      <el-form
+                        :inline="true"
+                        :model="formInline"
+                        class="demo-form-inline"
+                      >
+                        <el-form-item label="BOM类型">
+                          <el-select
+                            size="medium"
+                            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="medium"
+                            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="属性类型" v-if="produceType == 2">
+                          <el-select
+                            size="medium"
+                            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"
+                            size="medium"
+                            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>
+                    </div>
+                  </div>
+                </template>
+
+                <!-- <template v-slot:toolbar>
                   <el-button
                     v-if="produceType == 2"
                     type="primary"
                     @click="bulkPurchase"
-                    size="mini"
+                    size="medium"
                     >下发采购计划</el-button
                   >
                   <el-button
                     v-if="produceType == 1"
                     type="primary"
                     @click="issuePlan"
-                    size="mini"
+                    size="medium"
                     >下发生产计划</el-button
                   >
-                </template>
+                </template> -->
+
                 <template v-slot:toolkit>
-                  <el-form
+                  <el-form :inline="true">
+                    <el-form-item label="基本数量">
+                      <el-input size="medium" v-model="baseCount" disabled>
+                        <template slot="append">{{ baseUnit }}</template>
+                      </el-input>
+                    </el-form-item>
+                  </el-form>
+
+                  <!-- <el-form
                     :inline="true"
                     :model="formInline"
                     class="demo-form-inline"
                   >
                     <el-form-item label="BOM类型">
                       <el-select
-                        size="mini"
+                        size="medium"
                         v-model="formInline.bomType"
                         placeholder="BOM类型"
                         class="select-type"
@@ -117,7 +223,7 @@
                     <el-form-item label="BOM版本">
                       <el-select
                         class="select-type"
-                        size="mini"
+                        size="medium"
                         v-model="formInline.bomId"
                         placeholder="BOM版本"
                         @change="bomVChange"
@@ -133,7 +239,7 @@
                     </el-form-item>
                     <el-form-item label="属性类型" v-if="produceType == 2">
                       <el-select
-                        size="mini"
+                        size="medium"
                         v-model="formInline.attributeType"
                         placeholder="属性类型"
                         class="select-type"
@@ -151,7 +257,7 @@
                     <el-form-item label="最终状态">
                       <el-select
                         class="select-type"
-                        size="mini"
+                        size="medium"
                         v-model="formInline.finalState"
                         placeholder="最终状态"
                         @change="finalChange"
@@ -165,7 +271,7 @@
                         </el-option>
                       </el-select>
                     </el-form-item>
-                  </el-form>
+                  </el-form> -->
                 </template>
                 <template v-slot:inventoryQuantity="{ row }">
                   <el-link
@@ -268,7 +374,6 @@
 
     <stockDetailDialog ref="stockDetailDialog" />
     <currentDetailDialog ref="currentDetailDialog" />
-    <producePlan ref="produceRef" @success="reloads"></producePlan>
     <purchaseDialog ref="purchaseDialogRef" :orderType="2" @success="success" />
     <factoryAdd
       ref="factoryAddRef"
@@ -281,14 +386,10 @@
 
 <script>
   import {
-    homogeneityInspect,
-    homogeneityInspectMerge,
     findMaterialInfoByPlanId,
     findBomCategoryByCategoryId,
-    getBom
   } from '@/api/productionPlan/index.js';
   import factoryAdd from './factoryAdd';
-  import { listBomByPlanIdsOverride } from '@/api/materialPlan/index';
   import stockDetailDialog from './stockDetailDialog.vue';
   import currentDetailDialog from './currentDetailDialog.vue';
   import producePlan from '@/views/materialPlan/components/producePlan.vue';
@@ -349,6 +450,19 @@
             minWidth: 100,
             showOverflowTooltip: true
           },
+          {
+            prop: 'level',
+            label: '层级',
+            align: 'center',
+            minWidth: 50
+          },
+          {
+            prop: 'supplierName',
+            label: '供应商',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 140
+          },
           {
             prop: 'demandQuantity',
             label: '定额数量',
@@ -531,7 +645,9 @@
             value: 3,
             label: '外协件'
           }
-        ]
+        ],
+        baseCount: '',
+        baseUnit: ''
       };
     },
     watch: {
@@ -666,7 +782,15 @@
       },
       // 结果数据处理
       resultProcess(result) {
-        result.map((item) => {
+        if (!result || result.length == 0) {
+          this.baseCount = '';
+          this.baseUnit = '';
+          return;
+        }
+        let first = result[0];
+        this.baseCount = first.baseCount;
+        this.baseUnit = first.unit;
+        result.forEach((item) => {
           item.batchNo = this.planInfo.batchNo;
           item.salesCode = this.planInfo.salesCode;
           item.finalState =
@@ -713,27 +837,10 @@
           bomType: obj.bomType
         };
         this.$refs.purchaseDialogRef.open(arr, data);
-        // let planIds = list.map((item) => item.id);
-        // let data = {
-        //   planIds: ['1948548495278911490', '1948548022580850689'],
-        //   demandType: '1'
-        // };
-        // this.$refs.produceRef.visible = true;
-        // const o = this.cardList.find((el) => el.id === this.selectNodeId);
-        // let obj = JSON.parse(JSON.stringify(o));
-        // obj.materialList = list;
-        // this.$nextTick(() => {
-        //   this.$refs.purchaseDialogRef.open([obj], '生产计划');
-        // });
-        // const result = await listBomByPlanIdsOverride(data);
       },
       success() {
         this.bomVChange(this.formInline.bomId);
       },
-      // 采购申请
-      // purchase(row) {
-      //   this.bulkPurchase([row]);
-      // },
       async open(dataList, produceType) {
         this.visible = true;
 
@@ -773,7 +880,7 @@
         this.loading = true;
         try {
           this.planId = data.id;
-          const res = await findBomCategoryByCategoryId(data.categoryId);
+          const res = await findBomCategoryByCategoryId(data.categoryId,this.produceType);
           this.loading = false;
           if (!res || res.length == 0) {
             this.bomListD = [];
@@ -940,4 +1047,13 @@
     border: 1px solid #ccc;
     margin-right: 10px;
   }
+
+  .tool {
+    display: flex;
+    align-items: center;
+    justify-content: space-between;
+    padding: 5px 10px;
+    border-left: 1px solid #ededed;
+    border-right: 1px solid #ededed;
+  }
 </style>

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

@@ -520,7 +520,13 @@
             label: '规格',
             align: 'center',
             minWidth: 150,
-
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'stockNum',
+            label: '库存',
+            align: 'center',
+            minWidth: 100,
             showOverflowTooltip: true
           },
           {
@@ -1030,7 +1036,7 @@
           .catch(() => {});
       },
       handleSelectionChange(list) {
-        console.log(list,'list ___')
+        console.log(list, 'list ___');
         if (list.length > 0) {
           let _list = [];
           list.forEach((e) => {

+ 145 - 91
src/views/saleOrder/components/orderHomogeneityInspectDialog.vue

@@ -1,7 +1,7 @@
 <template>
   <div>
     <ele-modal
-      width="80vw"
+      width="90vw"
       :visible.sync="visible"
       :close-on-click-modal="false"
       row-key="code"
@@ -81,95 +81,101 @@
                 :datasource="datasourceList"
                 :selection.sync="selection"
               >
-                <template v-slot:toolbar>
-                  <el-button
-                    v-if="produceType == 2"
-                    type="primary"
-                    @click="bulkPurchase"
-                    size="mini"
-                    >下发采购计划</el-button
-                  >
-                  <!-- <el-button
-                    v-if="produceType == 1"
-                    type="primary"
-                    @click="issuePlan"
-                    size="mini"
-                    >下发销售订单</el-button
-                  > -->
-                </template>
-                <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="属性类型" v-if="produceType == 2">
-                      <el-select
-                        size="mini"
-                        v-model="formInline.attributeType"
-                        placeholder="属性类型"
-                        class="select-type"
-                        @change="attributeChange"
+                <template v-slot:default>
+                  <div class="tool">
+                    <div class="tool_l">
+                      <el-button
+                        v-if="produceType == 2"
+                        type="primary"
+                        @click="bulkPurchase"
+                        size="medium"
+                        >下发采购计划</el-button
                       >
-                        <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"
-                        size="mini"
-                        v-model="formInline.finalState"
-                        placeholder="最终状态"
-                        @change="finalChange"
+                    </div>
+                    <div class="tool_r">
+                      <el-form
+                        :inline="true"
+                        :model="formInline"
+                        class="demo-form-inline"
                       >
-                        <el-option
-                          v-for="item in finalStateList"
-                          :key="item.value"
-                          :label="item.label"
-                          :value="item.value"
-                        >
-                        </el-option>
-                      </el-select>
+                        <el-form-item label="BOM类型">
+                          <el-select
+                            size="medium"
+                            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="medium"
+                            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="属性类型" v-if="produceType == 2">
+                          <el-select
+                            size="medium"
+                            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"
+                            size="medium"
+                            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>
+                    </div>
+                  </div>
+                </template>
+                <template v-slot:toolkit>
+                  <el-form :inline="true">
+                    <el-form-item label="基本数量">
+                      <el-input size="medium" v-model="baseCount" disabled>
+                        <template slot="append">{{ baseUnit }}</template>
+                      </el-input>
                     </el-form-item>
                   </el-form>
                 </template>
@@ -335,12 +341,32 @@
             minWidth: 100,
             showOverflowTooltip: true
           },
+          {
+            prop: 'level',
+            label: '层级',
+            align: 'center',
+            minWidth: 50
+          },
+          {
+            prop: 'supplierName',
+            label: '供应商',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 140
+          },
           {
             prop: 'demandQuantity',
             label: '定额数量',
             showOverflowTooltip: true,
             align: 'center'
           },
+          {
+            prop: 'unit',
+            label: '单位',
+            showOverflowTooltip: true,
+            align: 'center',
+            width: 60
+          },
           {
             prop: 'totalUnshippedQuantity',
             label: '未发总数',
@@ -519,7 +545,9 @@
             value: 3,
             label: '外协件'
           }
-        ]
+        ],
+        baseCount: '',
+        baseUnit: ''
       };
     },
     watch: {
@@ -625,7 +653,10 @@
         this.loading = true;
         try {
           this.salesOrderId = data.id;
-          const res = await findBomSalesorderCategoryId(data.categoryId);
+          const res = await findBomSalesorderCategoryId(
+            data.categoryId,
+            this.produceType
+          );
           this.loading = false;
           if (!res || res.length == 0) {
             this.bomListD = [];
@@ -702,6 +733,9 @@
 
       // 查询采购价跟外协件两个类型数据
       async dataMerging() {
+        if (!this.formInline.bomId) {
+          return;
+        }
         let params1 = {
           salesOrderId: this.salesOrderId,
           bomVersionId: this.formInline.bomId,
@@ -785,6 +819,14 @@
       },
       // 结果数据处理
       resultProcess(result) {
+        if (!result || result.length == 0) {
+          this.baseCount = '';
+          this.baseUnit = '';
+          return;
+        }
+        let first = result[0];
+        this.baseCount = first.baseCount;
+        this.baseUnit = first.measuringUnit;
         result.map((item) => {
           item.batchNo = this.orderInfo.batchNo;
           item.productCode = this.orderInfo.productCode;
@@ -797,7 +839,6 @@
         });
         this.datasourceAllList = result;
         this.finalChange(this.formInline.finalState);
-
       },
       // 选择状态
       finalChange(e) {
@@ -959,4 +1000,17 @@
     border: 1px solid #ccc;
     margin-right: 10px;
   }
+
+  // ::v-deep .basic_quantity{
+  //   padding-top: 4px;
+  // }
+
+  .tool {
+    display: flex;
+    align-items: center;
+    justify-content: space-between;
+    padding: 5px 10px;
+    border-left: 1px solid #ededed;
+    border-right: 1px solid #ededed;
+  }
 </style>

+ 16 - 3
src/views/saleOrder/index.vue

@@ -29,8 +29,9 @@
         row-key="id"
         @sort-change="onSortChange"
         @columns-change="handleColumnChange"
-        :cache-key="cacheKeyUrl"
+      
       >
+      <!--   :cache-key="cacheKeyUrl" -->
         <template v-slot:code="{ row }">
           <el-link :underline="false" type="primary" @click="openDetails(row)">
             {{ row.code }}
@@ -152,7 +153,7 @@
         selection: [],
 
         newColumns: [],
-        cacheKeyUrl: 'c32a9c7d-aps-saleOrder',
+        // cacheKeyUrl: 'c32a9c7d-aps-saleOrder',
         columnsVersion: 1,
         // 订单类型
         orderTypeList: [
@@ -253,6 +254,13 @@
             minWidth: 150,
             showOverflowTooltip: true
           },
+          {
+            prop: 'stockNum',
+            label: '库存',
+            align: 'center',
+            minWidth: 100,
+            showOverflowTooltip: true
+          },
           {
             prop: 'productionCodes',
             label: '生产编号',
@@ -496,7 +504,12 @@
               }
             }
           }
-          this.$refs.orderHomogeneityInspectDialog.open(data2, first, 'list',val);
+          this.$refs.orderHomogeneityInspectDialog.open(
+            data2,
+            first,
+            'list',
+            val
+          );
           // if (flag) {
           //   // 齐料
           //   if (type == 2) {

+ 6 - 2
src/views/saleOrder/salesToProductionNewTwo.vue

@@ -381,10 +381,14 @@
           >
             <template slot-scope="scope">
               <el-input
-                v-model.number="scope.row.batchNo"
+                v-model="scope.row.batchNo"
                 size="small"
                 style="width: 100%"
                 placeholder="批次号"
+                @input="
+                  (value) =>
+                    (scope.row.batchNo = value.replace(/[^a-zA-Z0-9_-]/g, ''))
+                "
               ></el-input>
             </template>
           </el-table-column>
@@ -840,7 +844,7 @@
         rules: {
           produceRoutingId: [
             { required: true, message: '请选择工艺路线', trigger: 'blur' }
-          ],
+          ]
           // startTime: [
           //   {
           //     type: 'date',