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

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

@@ -436,3 +436,17 @@ export async function listBomRoutingFile(bomCategoryId, routingId) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+
+// 根据计划id查询辅材信息
+export async function findAssistMaterialInfoByPlanId(params) {
+  const res = await request.get(
+    '/aps/productionplan/findAssistMaterialInfoByPlanId',
+    {
+      params
+    }
+  );
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 1065 - 0
src/views/productionPlan/components/auxiliaryMaterial.vue

@@ -0,0 +1,1065 @@
+<template>
+  <div>
+    <ele-modal
+      width="90vw"
+      :visible.sync="visible"
+      v-if="visible"
+      :close-on-click-modal="false"
+      row-key="code"
+      custom-class="ele-dialog-form"
+      :title="'齐套性检查'"
+      :maxable="true"
+      append-to-body
+    >
+      <div v-loading="loading">
+        <el-form label-width="107px" :model="planInfo" class="plan_form">
+          <el-row :gutter="20" type="flex" style="flex-wrap: wrap">
+            <el-col :span="6">
+              <el-form-item label="名称:">
+                <el-input readonly v-model="planInfo.productName"></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="6">
+              <el-form-item label="计划编号:">
+                <el-input
+                  readonly
+                  v-model="planInfo.productionPlanCode"
+                ></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="6">
+              <el-form-item label="规格:">
+                <el-input readonly v-model="planInfo.specification"></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="6">
+              <el-form-item label="型号:">
+                <el-input readonly v-model="planInfo.model"></el-input>
+              </el-form-item>
+            </el-col>
+          </el-row>
+          <el-row>
+            <el-col :span="6">
+              <el-form-item label="编码:">
+                <el-input readonly v-model="planInfo.productCode"></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="6">
+              <el-form-item label="牌号:">
+                <el-input readonly v-model="planInfo.brandNo"></el-input>
+              </el-form-item>
+            </el-col>
+          </el-row>
+        </el-form>
+        <div class="form-wrapper">
+          <div
+            class="left_tree"
+            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 :style="{ width: rightWidth }">
+            <div>
+              <ele-pro-table
+                ref="table"
+                :needPage="false"
+                :columns="columns"
+                :init-load="false"
+                :datasource="datasourceList"
+                row-key="code"
+                :cache-key="`ProductionPlanTable`"
+                border
+                height="40vh"
+                key="id"
+                :selection.sync="selection"
+              >
+                <template v-slot:default>
+                  <div class="tool">
+                    <div class="tool_l"> </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.bomType"
+                              :label="item.bomName"
+                              :value="item.bomType"
+                            >
+                            </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="medium"
+                    >下发采购计划</el-button
+                  >
+                  <el-button
+                    v-if="produceType == 1"
+                    type="primary"
+                    @click="issuePlan"
+                    size="medium"
+                    >下发生产计划</el-button
+                  >
+                </template> -->
+                <!-- 默认按订单 -->
+                <!-- <template v-slot:toolbar v-if="produceType != 2">
+                  <el-form :inline="true">
+                    <el-form-item label="定额计算方法:">
+                      <el-radio-group
+                        v-model="quota_calculation"
+                        @change="selectCalculate"
+                      >
+                        <el-radio :label="1">按订单数量</el-radio>
+                        <el-radio :label="2">按缺料数量</el-radio>
+                      </el-radio-group>
+                    </el-form-item>
+                  </el-form>
+                </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> -->
+                <template v-slot:inventoryQuantity="{ row }">
+                  <el-link
+                    type="primary"
+                    :underline="false"
+                    @click="stockDetail(row)"
+                  >
+                    {{ row.inventoryQuantity }}
+                  </el-link>
+                </template>
+
+                <template v-slot:code="{ row }">
+                  <el-link
+                    :underline="false"
+                    type="primary"
+                    @click="openDetails(row)"
+                  >
+                    {{ row.code }}
+                  </el-link>
+                </template>
+
+                <template v-slot:inTransitNum="{ row }">
+                  <el-link
+                    type="primary"
+                    :underline="false"
+                    @click="currentDetail(row)"
+                  >
+                    {{ row.inTransitNum }}
+                  </el-link>
+                </template>
+                <template v-slot:inventoryStatusText="{ row }">
+                  <div
+                    :class="
+                      row.inventoryStatusText == '缺料'
+                        ? 'statusRed'
+                        : 'statusGreen'
+                    "
+                  >
+                    {{ row.inventoryStatusText }}
+                  </div>
+                </template>
+                <template v-slot:inTransitStatusText="{ row }">
+                  <div
+                    :class="
+                      row.inTransitStatusText == '缺料'
+                        ? 'statusRed'
+                        : 'statusGreen'
+                    "
+                  >
+                    {{ row.inTransitStatusText }}
+                  </div>
+                </template>
+                <template v-slot:finalStateText="{ row }">
+                  <div
+                    :class="
+                      row.finalStateText == '缺料' ? 'statusRed' : 'statusGreen'
+                    "
+                  >
+                    {{ row.finalStateText }}
+                  </div>
+                </template>
+
+                <template v-slot:numberProductionStateText="{ row }">
+                  <div
+                    :class="
+                      row.numberProductionStateText == '缺料'
+                        ? 'statusRed'
+                        : 'statusGreen'
+                    "
+                  >
+                    {{ row.numberProductionStateText }}
+                  </div>
+                </template>
+                <template v-slot:productFinalStateText="{ row }">
+                  <div
+                    :class="
+                      row.productFinalStateText == '缺料'
+                        ? 'statusRed'
+                        : 'statusGreen'
+                    "
+                  >
+                    {{ row.productFinalStateText }}
+                  </div>
+                </template>
+
+                <template v-slot:finishCount="{ row }">
+                  <div>
+                    <div v-if="row.finishCount > 0">{{ row.finishCount }}</div>
+                    <div v-else>-</div>
+                  </div>
+                </template>
+                <!-- <template v-slot:action="{ row }">
+                  <el-link
+                    type="primary"
+                    :underline="false"
+                    @click="issuePlan(row)"
+                  >
+                    下发生产计划
+                  </el-link>
+                </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>
+
+    <stockDetailDialog ref="stockDetailDialog" />
+    <currentDetailDialog ref="currentDetailDialog" />
+    <purchaseDialog ref="purchaseDialogRef" :orderType="2" @success="success" />
+    <routeResourceData ref="routeResourceDataRef" />
+    <factoryAdd
+      ref="factoryAddRef"
+      :isAdd="false"
+      :factoryType="3"
+      @close="factoryClose"
+    ></factoryAdd>
+  </div>
+</template>
+
+<script>
+  import {
+    findMaterialInfoByPlanId,
+    findAssistMaterialInfoByPlanId,
+    bomVersionList,
+    listBomType,
+    getProductKitting
+  } from '@/api/productionPlan/index.js';
+  import factoryAdd from './factoryAdd';
+  import stockDetailDialog from './stockDetailDialog.vue';
+  import currentDetailDialog from './currentDetailDialog.vue';
+  import producePlan from '@/views/materialPlan/components/producePlan.vue';
+  import purchaseDialog from './purchaseDialog.vue';
+  import { issueProductionPlan } from '@/api/productionPlan/index.js';
+  import routeResourceData from './routeResourceData.vue';
+  export default {
+    components: {
+      stockDetailDialog,
+      currentDetailDialog,
+      producePlan,
+      purchaseDialog,
+      factoryAdd,
+      routeResourceData
+    },
+    computed: {
+      fieldShow() {
+        return this.produceType != 2 && this.quota_calculation === 2;
+      },
+      columns() {
+        return [
+          {
+            width: 45,
+            type: 'selection',
+            columnKey: 'selection',
+            align: 'center',
+            slot: 'selection',
+            fixed: 'left'
+          },
+          {
+            columnKey: 'index',
+            label: '序号',
+            type: 'index',
+            width: 55,
+            align: 'center',
+            fixed: 'left'
+          },
+
+          {
+            prop: 'code',
+            slot: 'code',
+            label: '工序编码',
+            align: 'center',
+            minWidth: 100,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'name',
+            label: '工序名称',
+            align: 'center',
+            minWidth: 100,
+            showOverflowTooltip: true
+          },
+
+          {
+            prop: 'workCenterName',
+            label: '所属工作中心',
+            align: 'center',
+            minWidth: 100,
+            showOverflowTooltip: true
+          },
+
+          {
+            slot: 'finalStateText',
+            prop: 'finalStateText',
+            label: '最终状态',
+            align: 'center',
+            minWidth: 80,
+            fixed: 'right'
+          }
+          // {
+          //   columnKey: 'action',
+          //   label: '操作',
+          //   width: 120,
+          //   align: 'center',
+          //   resizable: false,
+          //   fixed: 'right',
+          //   show: this.produceType == 1,
+          //   slot: 'action'
+          // }
+        ];
+      }
+    },
+    data() {
+      return {
+        visible: false,
+        kitComInfo: {},
+        // requiredFormingNum: 0,
+        formInline: {
+          finalState: 0,
+          attributeType: 2,
+          bomId: '',
+          time: ''
+        },
+        finalStateList: [
+          {
+            label: '全部',
+            value: 0
+          },
+          {
+            label: '齐套',
+            value: 1
+          },
+          {
+            label: '缺料',
+            value: 2
+          }
+        ],
+        ids: [],
+        leftShow: false,
+        leftWidth: '0%',
+        rightWidth: '100%',
+        cardList: [],
+        treeProps: {
+          label: 'code',
+          children: 'children'
+        },
+        planInfo: {
+          salesCode: ''
+        },
+        datasourceAllList: [], // 表格物料全部数据
+        datasourceList: [], // 表格物料数据
+        bomListV: [], // BOM版本
+        bomListType: [], // BOM 类型
+        planId: '',
+        selectNodeId: '',
+        loading: false,
+        produceType: 1,
+        selection: [],
+        attributeList: [
+          {
+            value: 'all',
+            label: '全部'
+          },
+          {
+            value: 2,
+            label: '采购件'
+          },
+          {
+            value: 3,
+            label: '外协件'
+          }
+        ],
+        baseCount: '',
+        baseUnit: '',
+        quota_calculation: 1,
+        pickerOptions: {
+          // 限制最大可选日期为今天
+          disabledDate(time) {
+            const today = new Date();
+            return time.getTime() > today.getTime();
+          }
+        },
+        startTime: []
+      };
+    },
+    watch: {
+      leftShow(newVal, oldVal) {
+        if (newVal) {
+          this.leftWidth = '230px';
+          this.rightWidth = 'calc(100% - 240px)';
+        } else {
+          this.leftWidth = '0';
+          this.rightWidth = '100%';
+        }
+      }
+    },
+    mounted() {},
+    methods: {
+      async handleNodeClick(data) {
+        this.planInfo = data;
+        try {
+          await this.getKitting();
+          await this.getBomData(data);
+          this.selectNodeId = data.id;
+        } catch (e) {
+          console.log(e, '错误');
+        }
+      },
+      async getKitting() {
+        let { startTime, endTime } = this.getTimeData();
+        let params = {
+          categoryId: this.planInfo.categoryId,
+          startTime,
+          endTime
+        };
+        const res = await getProductKitting(params);
+        if (res) {
+          this.kitComInfo = res;
+        }
+      },
+      getTimeData() {
+        let startTime = '';
+        let endTime = '';
+        if (this.startTime.length > 0) {
+          startTime = this.startTime[0];
+          endTime = this.startTime[1];
+        }
+        return { startTime, endTime };
+      },
+      initTime() {
+        // 获取当前日期(今天)
+        const today = new Date(); // 注意:月份是0-based,8月对应7
+        // 计算三个月前的日期
+        const threeMonthsAgo = new Date(today);
+        threeMonthsAgo.setMonth(today.getMonth() - 3);
+        let start = this.formatDate(threeMonthsAgo);
+        let end = this.formatDate(today);
+        this.startTime = [start, end];
+      },
+      formatDate(date) {
+        const year = date.getFullYear();
+        const month = String(date.getMonth() + 1).padStart(2, '0');
+        const day = String(date.getDate()).padStart(2, '0');
+        return `${year}-${month}-${day}`;
+      },
+      selectCalculate(val) {
+        this.attributeChange(this.formInline.attributeType);
+      },
+      reload(where) {
+        this.$nextTick(() => {
+          this.$refs.table.reload({ page: 1, where });
+        });
+      },
+      stockDetail(row) {
+        this.$refs.stockDetailDialog.open({ bomCode: row.code });
+      },
+      currentDetail(row) {
+        this.$refs.currentDetailDialog.open({ bomCode: row.code });
+      },
+      // 选择BOM类型
+      async bomTypeChange(e, type) {
+        this.formInline.bomType = e;
+        const params = {
+          categoryId: this.planInfo.categoryId,
+          bomType: e,
+          isTemp: 0
+        };
+        const res = await bomVersionList(params);
+        if (!res || res.length == 0) {
+          this.bomListV = [];
+          return;
+        }
+        let list = [];
+        res.forEach((el) => {
+          if (el.status != 1) return;
+          let obj = {
+            bomId: el.id,
+            id: el.id,
+            versions: `V${el.versions}.0`
+          };
+          list.push(obj);
+        });
+        this.bomListV = list;
+        if (type == 'init') {
+          let obj = list.find((el) => el.bomId == this.planInfo.bomCategoryId);
+          let id = obj ? obj.bomId : list[0].bomId;
+          this.formInline.bomId = id;
+          this.bomVChange(id);
+        } else {
+          let id = list[0].bomId;
+          this.formInline.bomId = id;
+          this.bomVChange(id);
+        }
+        // let data = this.bomListType.find((el) => el.id === e);
+        // if (!data) return;
+        // this.bomListV = data.bomList;
+        // 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;
+        // return
+        // let bomData = list.find((el) => el.bomId == e);
+        // if (!bomData) return;
+        // let data = this.bomListV.find((el) => el.bomId === e);
+        // this.getMaterialData({ bomId: e }, this.formInline.attributeType);
+      },
+      // 查询采购价跟外协件两个类型数据
+      async dataMerging() {
+        if (!this.formInline.bomId) {
+          return;
+        }
+        let kitting = this.quota_calculation == 1 ? false : true;
+        let { startTime, endTime } = this.getTimeData();
+        let params1 = {
+          planId: this.planId,
+          bomVersionId: this.formInline.bomId,
+          produceType: 2,
+          startTime,
+          endTime,
+          kitting: kitting
+        };
+        let params2 = {
+          planId: this.planId,
+          bomVersionId: this.formInline.bomId,
+          produceType: 3,
+          startTime,
+          endTime,
+          kitting: kitting
+        };
+        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;
+          // 这里可以继续对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, attributeType) {
+        if (attributeType == 'all') {
+          this.dataMerging();
+          return;
+        }
+        let kitting = this.quota_calculation == 1 ? false : true;
+        let produceType =
+          this.produceType == 1
+            ? 1
+            : this.produceType == 4
+            ? 4
+            : attributeType == 2
+            ? 2
+            : attributeType == 3
+            ? 3
+            : '';
+        let { startTime, endTime } = this.getTimeData();
+        let params = {
+          planId: this.planId,
+          bomVersionId: data.bomId,
+          produceType: produceType,
+          startTime,
+          endTime,
+          kitting: kitting
+        };
+        this.loading = true;
+        try {
+          const result = await findMaterialInfoByPlanId(params);
+          this.resultProcess(result);
+          this.loading = false;
+        } catch (err) {
+          this.loading = false;
+        }
+      },
+      // 结果数据处理
+      resultProcess(result) {
+        this.datasourceList = [];
+        if (!result || result.length == 0) {
+          this.baseCount = '';
+          this.baseUnit = '';
+          return;
+        }
+        let first = result[0];
+        this.baseCount = first.baseCount;
+        this.baseUnit = first.measuringUnit;
+        result.forEach((item) => {
+          item.batchNo = this.planInfo.batchNo;
+          item.salesCode = this.planInfo.salesCode;
+          item.finalState =
+            item.finalStateText == '齐套'
+              ? 1
+              : item.finalStateText == '缺料'
+              ? 2
+              : '';
+        });
+        this.datasourceAllList = result;
+        this.finalChange(this.formInline.finalState);
+      },
+      // 选择状态
+      finalChange(e) {
+        if (e === 0 || !e) {
+          this.datasourceList = this.datasourceAllList;
+          return;
+        }
+        this.datasourceList = this.datasourceAllList.filter(
+          (item) => item.finalState === e
+        );
+      },
+      isAllChecked() {
+        let datasourceList = this.datasourceList.filter(
+          (el) => el.finalStateText == '缺料' && !el.hasIssued
+        );
+        if (datasourceList.length) {
+          this.$refs.table.setSelectedRowKeys(
+            datasourceList.map((el) => el.code)
+          );
+        }
+      },
+      // 批量采购
+      async bulkPurchase() {
+        if (this.selection.length == 0) {
+          return this.$message.warning('请至少选择一条数据');
+        }
+        for (let i = 0; i < this.selection.length; i++) {
+          let el = this.selection[i];
+          if (el.finalState == 1) {
+            return this.$message.warning('必须选择最终状态为缺料的数据');
+          }
+          if (el.hasIssued) {
+            return this.$message.warning('必须选择下发状态为未下发的数据');
+          }
+        }
+        let arr = JSON.parse(JSON.stringify(this.selection));
+        let obj = this.bomListType.find(
+          (el) => el.bomType === this.formInline.bomType
+        );
+        let data = {
+          ...this.planInfo,
+          bomId: this.formInline.bomId,
+          bomType: obj.bomType
+        };
+        this.$refs.purchaseDialogRef.open(arr, data);
+      },
+      success() {
+        this.bomVChange(this.formInline.bomId);
+      },
+      async open(itemData) {
+        this.visible = true;
+        this.planInfo = itemData;
+
+        await this.getFindAssistMaterialInfoByPlanId(itemData);
+        await this.getBomData(itemData);
+      },
+
+      async getFindAssistMaterialInfoByPlanId(itemData) {
+        const res = await findAssistMaterialInfoByPlanId({
+          planId: itemData.productionPlanId,
+          bomVersionId: itemData.bomCategoryId,
+          routingId: itemData.produceRoutingId
+        });
+
+        this.datasourceList = res;
+      },
+
+      cancel() {
+        this.clearData();
+        this.visible = false;
+      },
+      clearData() {
+        this.formInline = {
+          finalState: 0,
+          attributeType: 2,
+          bomId: ''
+        };
+        this.baseCount = '';
+        this.baseUnit = '';
+        this.bomListV = [];
+        this.bomListType = [];
+        this.datasourceList = [];
+        this.datasourceAllList = [];
+      },
+      // 获取bom 数据
+      async getBomData(data) {
+        // this.loading = true;
+        try {
+          this.planId = data.productionPlanId;
+          let params = { categoryId: data.categoryId };
+          const res = await listBomType(params);
+          if (!res || res.length === 0) return;
+          let bomMap = {
+            1: 'PBOM',
+            2: 'MBOM',
+            3: 'ABOM'
+          };
+          let list = res.map((item) => {
+            return {
+              bomType: item.bomType,
+              id: item.id,
+              bomId: item.id,
+              bomName: bomMap[item.bomType]
+            };
+          });
+          let bom = list.find((el) => el.bomType == data.produceType);
+          let bomType = bom ? bom.bomType : list[0].bomType;
+          this.bomListType = list;
+          this.formInline.bomType = bomType;
+          this.bomTypeChange(bomType, 'init');
+          // console.log(res, 'res 333');
+          // const params = {
+          //   categoryId: data.categoryId,
+          //   bomType: data.produceType,
+          //   isTemp: 0
+          // };
+          // const res = bomVersionList(params);
+          return;
+          // const res = await findBomCategoryByCategoryIdV2(
+          //   data.bomCategoryId,
+          //   this.produceType
+          // );
+          // this.loading = false;
+          // if (!res || res.length == 0) {
+          //   this.bomListD = [];
+          //   this.datasourceList = [];
+          //   return;
+          // }
+          // let obj = {};
+          // let bomMap = {
+          //   1: 'PBOM',
+          //   2: 'MBOM',
+          //   3: 'ABOM'
+          // };
+          // if (this.produceType == 1) {
+          //   delete bomMap[1];
+          // }
+          // let result = res.filter((item) => item.bomType != 1);
+          // result.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);
+          // if (list.length == 0) return;
+          // this.bomListType = list;
+          // 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);
+          this.loading = false;
+        }
+      },
+
+      openDetails(row) {
+        this.$refs.routeResourceDataRef.open(row.resource);
+      },
+
+      issuePlan() {
+        if (this.selection.length == 0) {
+          return this.$message.warning('请至少选择一条数据');
+        }
+        for (let i = 0; i < this.selection.length; i++) {
+          let el = this.selection[i];
+          if (el.finalState == 1) {
+            return this.$message.warning('必须选择最终状态为缺料的数据');
+          }
+          // if (el.hasIssued) {
+          //   return this.$message.warning('必须选择下发状态为未下发的数据');
+          // }
+        }
+        let obj = this.bomListType.find(
+          (el) => el.bomType === this.formInline.bomType
+        );
+        const addPOList = this.fieldProcessing(this.selection);
+        // this.$alert('确定要将所选的数据下发生产计划吗', {
+        //   confirmButtonText: '确定',
+        //   callback: (action) => {
+        //     let param = {
+        //       addPOList: addPOList,
+        //       produceType: obj.bomType,
+        //       id: this.planInfo.id
+        //     };
+        //     batchSave(param).then((res) => {
+        //       this.$message.success('操作成功');
+        //       this.bomVChange(this.formInline.bomId);
+        //     });
+        //   }
+        // });
+
+        this.$confirm('确定要将所选的数据下发生产计划吗?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消'
+        })
+          .then(() => {
+            let param = {
+              addPOList: addPOList,
+              produceType: obj.bomType,
+              id: this.planInfo.id
+            };
+            issueProductionPlan(param).then((res) => {
+              this.$message.success('操作成功');
+              this.bomVChange(this.formInline.bomId);
+            });
+          })
+          .catch(() => {});
+
+        // this.$refs.factoryAddRef.open();
+        // this.$refs.factoryAddRef.confirmChoose([row]);
+      },
+
+      // 字段处理
+      fieldProcessing(arr) {
+        // return;
+        let list = arr.map((item) => {
+          return {
+            id: item.resourceBomId,
+            categoryId: item.categoryId,
+            productCode: item.code,
+            productName: item.name,
+            specification: item.specification,
+            produceRoutingId: item.produceRoutingId || '',
+            produceRoutingName: item.produceRoutingName || '',
+            requiredFormingNum: item.finalShortageQuantity,
+            startTime: this.planInfo.startTime,
+            endTime: this.planInfo.endTime,
+            unit: item.unit,
+            brandNo: item.brandNo || '',
+            batchNo: this.planInfo.batchNo,
+            model: item.model,
+            resourceType: 0
+          };
+        });
+        return list || [];
+      },
+      factoryClose(val) {
+        // this.factoryObj = {};
+      },
+      onSubmit() {
+        this.getKitting();
+        this.attributeChange(this.formInline.attributeType);
+      }
+      // confirm() {
+      //   this.visible = false;
+      // },
+      // async merge() {
+      //   this.reload({ planIds: this.ids, productType: 1, merge: 2 });
+      // },
+      // tabClick() {
+      //   this.reload({ planIds: this.ids, productType: 1 });
+      // }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  .mt20 {
+    margin-top: 20px;
+  }
+
+  .el-form-item {
+    margin-bottom: 0 !important;
+  }
+  .optionButton {
+    display: flex;
+    justify-content: flex-end;
+    padding-bottom: 3px;
+  }
+  .statusRed {
+    color: red;
+    :deep(.el-input__inner) {
+      color: red;
+    }
+  }
+
+  .statusGreen {
+    color: green;
+    :deep(.el-input__inner) {
+      color: green;
+    }
+  }
+  .form-wrapper {
+    display: flex;
+  }
+  .planInfo {
+    // display: flex;
+    font-size: 16px;
+  }
+  .plan_form {
+    .el-col {
+      margin-bottom: 16px;
+    }
+  }
+
+  .left_tree {
+    max-height: 600px;
+    min-height: 300px;
+    overflow: auto;
+    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>

+ 6 - 3
src/views/productionPlan/components/checkProductionPreparations.vue

@@ -229,6 +229,7 @@
     </ele-modal>
 
     <kitting-complete ref="kittingCompleteRef"></kitting-complete>
+    <auxiliary-material ref="auxiliaryMaterialRef"></auxiliary-material>
   </ele-modal>
 </template>
 
@@ -244,10 +245,11 @@
   } from '@/api/productionPlan';
   import { listOrganizations, getUserPage } from '@/api/system/organization';
   import kittingComplete from './kittingComplete.vue';
+  import auxiliaryMaterial from './auxiliaryMaterial.vue';
   import { setFileUrl } from '@/components/addDoc/util.js';
 
   export default {
-    components: { kittingComplete },
+    components: { kittingComplete, auxiliaryMaterial },
     props: {
       type: {
         type: String,
@@ -555,7 +557,6 @@
         this.$emit('update');
       },
       async kittingComplete(item) {
-        this.productionData = item;
         if (item.preType == '6') {
           this.$confirm('是否确认齐套?', '提示', {
             confirmButtonText: '齐套',
@@ -608,11 +609,13 @@
           this.fileTitle = '工艺文件';
 
           this.fileVisible = true;
-        } else {
+        } else if (item.preType == '1') {
           this.itemData.productionPlanId =
             this.itemData.productionPlanId || this.itemData.id;
           const list = [this.itemData];
           this.$refs.kittingCompleteRef.open(list);
+        } else if (item.preType == '2') {
+          this.$refs.auxiliaryMaterialRef.open(this.itemData);
         }
       },
 

+ 237 - 0
src/views/productionPlan/components/routeResourceData.vue

@@ -0,0 +1,237 @@
+<template>
+  <div>
+    <ele-modal
+      width="90vw"
+      :visible.sync="visible"
+      v-if="visible"
+      :close-on-click-modal="false"
+      row-key="code"
+      custom-class="ele-dialog-form"
+      :title="'齐套性检查'"
+      :maxable="true"
+      append-to-body
+    >
+      <div>
+        <div>
+          <ele-pro-table
+            ref="table"
+            :needPage="false"
+            :columns="columns"
+            :datasource="datasourceList"
+            row-key="code"
+            :cache-key="`ProductionPlanTable`"
+            border
+            height="40vh"
+            key="id"
+          >
+            <template v-slot:availableCountBase="{ row }">
+              <span> {{ row.availableCountBase }}{{ row.measuringUnit }} </span>
+            </template>
+
+            <template v-slot:baseCount="{ row }">
+              <span> {{ row.baseCount }}{{ row.measuringUnit }} </span>
+            </template>
+
+            <template v-slot:count="{ row }">
+              <span> {{ row.count }}{{ row.measuringUnit }} </span>
+            </template>
+
+            <template v-slot:demandQuantity="{ row }">
+              <span> {{ row.demandQuantity }}{{ row.measuringUnit }} </span>
+            </template>
+          </ele-pro-table>
+        </div>
+      </div>
+      <div slot="footer">
+        <el-button plain @click="cancel">取消</el-button>
+      </div>
+    </ele-modal>
+
+    <!-- <stockDetailDialog ref="stockDetailDialog" />
+    <currentDetailDialog ref="currentDetailDialog" />
+    <purchaseDialog ref="purchaseDialogRef" :orderType="2" @success="success" />
+    <factoryAdd
+      ref="factoryAddRef"
+      :isAdd="false"
+      :factoryType="3"
+      @close="factoryClose"
+    ></factoryAdd> -->
+  </div>
+</template>
+
+<script>
+  import {
+    findMaterialInfoByPlanId,
+    findAssistMaterialInfoByPlanId,
+    bomVersionList,
+    listBomType,
+    getProductKitting
+  } from '@/api/productionPlan/index.js';
+  import factoryAdd from './factoryAdd';
+  import stockDetailDialog from './stockDetailDialog.vue';
+  import currentDetailDialog from './currentDetailDialog.vue';
+  import producePlan from '@/views/materialPlan/components/producePlan.vue';
+  import purchaseDialog from './purchaseDialog.vue';
+  import { issueProductionPlan } from '@/api/productionPlan/index.js';
+  export default {
+    components: {
+      stockDetailDialog,
+      currentDetailDialog,
+      producePlan,
+      purchaseDialog,
+      factoryAdd
+    },
+    computed: {
+      fieldShow() {
+        return this.produceType != 2 && this.quota_calculation === 2;
+      },
+      columns() {
+        return [
+          {
+            columnKey: 'index',
+            label: '序号',
+            type: 'index',
+            width: 55,
+            align: 'center',
+            fixed: 'left'
+          },
+
+          {
+            prop: 'categoryCode',
+            label: '物品编码',
+            align: 'center',
+            minWidth: 100,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'categoryName',
+            label: '物品名称',
+            align: 'center',
+            minWidth: 100,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'availableCountBase',
+            slot: 'availableCountBase',
+            label: '库存数量',
+            align: 'center',
+            minWidth: 100,
+            showOverflowTooltip: true
+          },
+
+          {
+            prop: 'baseCount',
+            slot: 'baseCount',
+            label: '基础数量',
+            align: 'center',
+            minWidth: 100,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'demandQuantity',
+            slot: 'demandQuantity',
+            label: '定额数量',
+            align: 'center',
+            minWidth: 100,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'count',
+            slot: 'count',
+            label: '数量',
+            align: 'center',
+            minWidth: 100,
+            showOverflowTooltip: true
+          }
+        ];
+      }
+    },
+    data() {
+      return {
+        visible: false,
+        datasourceList: []
+      };
+    },
+    watch: {
+      leftShow(newVal, oldVal) {
+        if (newVal) {
+          this.leftWidth = '230px';
+          this.rightWidth = 'calc(100% - 240px)';
+        } else {
+          this.leftWidth = '0';
+          this.rightWidth = '100%';
+        }
+      }
+    },
+    mounted() {},
+    methods: {
+      async open(itemDataList) {
+        this.visible = true;
+        console.log('itemDataList', itemDataList);
+        this.datasourceList = itemDataList;
+        console.log('datasourceList', this.datasourceList);
+      },
+
+      cancel() {
+        this.visible = false;
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  .mt20 {
+    margin-top: 20px;
+  }
+
+  .el-form-item {
+    margin-bottom: 0 !important;
+  }
+  .optionButton {
+    display: flex;
+    justify-content: flex-end;
+    padding-bottom: 3px;
+  }
+  .statusRed {
+    color: red;
+    :deep(.el-input__inner) {
+      color: red;
+    }
+  }
+
+  .statusGreen {
+    color: green;
+    :deep(.el-input__inner) {
+      color: green;
+    }
+  }
+  .form-wrapper {
+    display: flex;
+  }
+  .planInfo {
+    // display: flex;
+    font-size: 16px;
+  }
+  .plan_form {
+    .el-col {
+      margin-bottom: 16px;
+    }
+  }
+
+  .left_tree {
+    max-height: 600px;
+    min-height: 300px;
+    overflow: auto;
+    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>

+ 1 - 1
src/views/requirementListPlan/details.vue

@@ -353,7 +353,7 @@
           },
           {
             prop: 'pickQuantity',
-            label: '已领数量',
+            label: '申领数量',
             width: 100,
             align: 'center',
             showOverflowTooltip: true