yijing 1 anno fa
parent
commit
c86ea58d2f

+ 167 - 0
src/api/bpm/components/cuttingPlan/index.js

@@ -0,0 +1,167 @@
+import request from '@/utils/request';
+
+export function apsbaitingplan(data) {
+  return request({
+    url: '/bpm/apsbaitingplan/assign',
+    method: 'POST',
+    data: data
+  });
+}
+
+/**
+ * 列表
+ */
+export async function getList(data) {
+  const res = await request.post('/aps/batchingplan/page2', data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+/**
+ * 保存
+ */
+export async function save(data) {
+  const res = await request.post('/aps/batchingplan/save', data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+/**
+ * 修改
+ */
+export async function del(data) {
+  const res = await request.delete('/aps/batchingplan/delete', { data });
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+/**
+ * 发布信息返显
+ */
+export async function getById(id) {
+  const res = await request.get(`/aps/batchingplan/getById/${id}`);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+/**
+ * 详情
+ */
+export async function getPlanInfoById(id) {
+  const res = await request.get(`/aps/batchingplan/getPlanInfoById/${id}`);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+/**
+ * 发布信息返显
+ */
+export async function getReleaseInfoById(id) {
+  const res = await request.get(`/aps/batchingplan/getReleaseInfoById/${id}`);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 获取列表
+export async function getMaterialList(data) {
+  const res = await request.get(`/wms/outin/getRealTimeInventory`, {
+    params: data
+  });
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 批量根据生产计划计算bom列表信息
+// export async function listBomBySalesOrderIds(data) {
+//   const res = await request.post(`/aps/batchingplandetail/listBomBySalesOrderIds`,data);
+//   if (res.data.code == 0) {
+//     return res.data.data;
+//   }
+//   return Promise.reject(new Error(res.data.message));
+// }
+
+// 销售订单
+export async function baitingListBomBySalesOrderIds(data) {
+  const res = await request.post(
+    `/aps/batchingplandetail/baitingListBomBySalesOrderIds`,
+    data
+  );
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 生产订单
+export async function listBomByPlanIdsOverride(data) {
+  const res = await request.post(
+    `/aps/batchingplandetail/listBomByPlanIdsOverride`,
+    data
+  );
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 根据销售订单计算bom列表信息
+export async function listBomBySalesOrderId(data) {
+  const res = await request.post(
+    `/aps/batchingplandetail/listBomBySalesOrderId`,
+    data
+  );
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 提交
+export async function submit(data) {
+  const res = await request.post(`/bpm/apsbaitingplan/submit`, data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+export async function listBomByWorkOrderIds(data) {
+  const res = await request.post(
+    `/aps/batchingplandetail/listBomByMesWorkOrderIds`,
+    data
+  );
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 根据工艺路线返回工序
+
+export async function getTaskListById(id) {
+  const res = await request.get(`/main/produceversion/getTaskListById/${id}`);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 配料计划选择生产工单分页
+export async function dosingPage(data) {
+  const res = await request.post(`/mes/workorder/dosingPage`, data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 346 - 0
src/views/bpm/handleTask/components/cuttingPlan/detailDialog.vue

@@ -0,0 +1,346 @@
+<template>
+  <div>
+    <headerTitle title="下料信息"></headerTitle>
+    <el-form
+      :model="formData"
+      ref="formRef"
+      label-width="120px"
+      class="ele-body"
+      :rules="rules"
+    >
+      <el-row :gutter="32">
+        <el-col :span="12">
+          <el-form-item label="计划名称" prop="name">
+            <el-input placeholder="请选择" v-model="formData.name"></el-input>
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="12">
+          <el-form-item label="备注" prop="remark">
+            <el-input placeholder="备注" v-model="formData.remark"></el-input>
+          </el-form-item>
+        </el-col>
+      </el-row>
+    </el-form>
+
+    <el-form :model="formData" ref="tableForm">
+      <ele-pro-table
+        ref="table"
+        :needPage="false"
+        :columns="columns"
+        row-key="id"
+      >
+        <!-- 展开内容 -->
+        <template v-slot:expand="{ row }">
+          <div
+            style="
+              width: calc(100% - 95px);
+              min-height: 60px;
+              margin-left: 95px;
+            "
+            v-if="row.materialList.length > 0"
+          >
+            <ele-pro-table
+              :toolbar="false"
+              toolsTheme="none"
+              ref="table2"
+              :need-page="false"
+              :datasource="row.materialList"
+              :columns="columns2"
+              row-key="id"
+            >
+              <template v-slot:sort="{ $index }">
+                {{ $index }}
+              </template>
+
+              <template v-slot:deliveryMethod="{ row }">
+                {{ row.deliveryMethod == 1 ? '一次性到货' : '分批到货' }}
+              </template>
+
+              <template v-slot:requireDeliveryTime="{ row }">
+                <span v-if="row.deliveryMethod == 1">{{
+                  row.requireDeliveryTime
+                }}</span>
+
+                <el-link
+                  type="primary"
+                  :underline="false"
+                  v-if="row.deliveryMethod == 2"
+                  @click.native="handleMethod(row)"
+                >
+                  设置分批时间
+                </el-link>
+              </template>
+
+              <template v-slot:imgUrl="{ row }">
+                <div v-if="row.imgUrl && row.imgUrl?.length">
+                  <el-link
+                    v-for="link in row.imgUrl"
+                    :key="link.id"
+                    type="primary"
+                    :underline="false"
+                    @click="downloadFile(link)"
+                  >
+                    {{ link.name }}</el-link
+                  >
+                </div>
+              </template>
+
+              <template v-slot:files="{ row }">
+                <div v-if="row.files && row.files?.length">
+                  <el-link
+                    v-for="link in row.files"
+                    :key="link.id"
+                    type="primary"
+                    :underline="false"
+                    @click="downloadFile(link)"
+                  >
+                    {{ link.name }}</el-link
+                  >
+                </div>
+              </template>
+            </ele-pro-table>
+          </div>
+        </template>
+      </ele-pro-table>
+    </el-form>
+
+    <timeDialog ref="timeDialogRef"></timeDialog>
+  </div>
+</template>
+
+<script>
+  import { getById } from '@/api/bpm/components/cuttingPlan/index';
+  import { getFile } from '@/api/system/file';
+  import timeDialog from './timeDialog';
+
+  export default {
+    components: {
+      timeDialog
+    },
+    props: {
+      businessId: {
+        default: ''
+      }
+    },
+    mixins: [],
+
+    data() {
+      return {
+        visible: false,
+
+        // 表格列配置
+        columns: [
+          {
+            width: 45,
+            type: 'expand',
+            columnKey: 'materialList',
+            align: 'center',
+            slot: 'expand'
+          },
+
+          {
+            width: 50,
+            label: '序号',
+            type: 'index',
+            align: 'center',
+            slot: 'index'
+          },
+
+          {
+            prop: 'salesOrderCode',
+            label: '销售订单号',
+            showOverflowTooltip: true,
+            align: 'center',
+            minWidth: 170
+          },
+          {
+            prop: 'customerName',
+            label: '客户名称',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'serialNo',
+            label: '客户代号',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'productCode',
+            label: '编码',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 140
+          },
+
+          {
+            prop: 'productName',
+            label: '名称',
+            align: 'center',
+            minWidth: 120
+          },
+
+          {
+            prop: 'model',
+            label: '型号',
+            align: 'center',
+            minWidth: 120
+          },
+
+          {
+            prop: 'brandNo',
+            label: '牌号',
+            align: 'center'
+          },
+
+          {
+            prop: 'deliveryTime',
+            label: '交付日期',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'contractNum',
+            label: '合同数量',
+            align: 'center'
+          },
+          {
+            prop: 'lackNum',
+            label: '欠交数量',
+            align: 'center'
+          }
+        ],
+
+        columns2: [
+          {
+            width: 50,
+            label: '序号',
+            prop: 'sort',
+            slot: 'sort',
+            align: 'center'
+          },
+
+          {
+            label: '物料名称',
+            prop: 'name',
+            align: 'center'
+          },
+
+          {
+            label: '物料编码',
+            prop: 'code',
+            align: 'center'
+          },
+          {
+            label: '牌号',
+            prop: 'brandNum',
+            align: 'center'
+          },
+          {
+            label: '型号',
+            prop: 'modelType',
+            align: 'center'
+          },
+
+          {
+            prop: 'inventoryQuantity',
+            label: '库存',
+            showOverflowTooltip: true
+          },
+
+          {
+            prop: 'unit',
+            label: '计量单位',
+            showOverflowTooltip: true,
+            action: 'unit'
+          },
+
+          {
+            label: '需求数量',
+            prop: 'demandQuantity',
+            align: 'center'
+          },
+
+          {
+            label: '采购数量',
+            prop: 'purchaseQuantity',
+            align: 'center'
+          },
+
+          {
+            label: '到货方式',
+            slot: 'deliveryMethod',
+            action: 'deliveryMethod',
+            align: 'center'
+          },
+
+          {
+            label: '要求到货时间',
+            slot: 'requireDeliveryTime',
+            action: 'requireDeliveryTime',
+            align: 'center'
+          },
+
+          {
+            label: '图纸',
+            slot: 'imgUrl',
+            action: 'imgUrl',
+            align: 'center'
+          },
+
+          {
+            label: '附件',
+            slot: 'files',
+            action: ' files',
+            align: 'center',
+            minWidth: 140
+          }
+        ],
+
+        rules: {},
+
+        formData: {
+          name: '',
+          remark: '',
+          detailRemoveIds: [],
+          materialRemoveIds: []
+        }
+      };
+    },
+    created() {
+      this.getDetailData(this.businessId);
+    },
+    methods: {
+      downloadFile(file) {
+        getFile({ objectName: file.storePath }, file.name);
+      },
+      async getDetailData(id) {
+        this.loading = true;
+        const res = await getById(id);
+        this.loading = false;
+        if (res) {
+          this.$set(this.formData, 'name', res.name);
+          this.$set(this.formData, 'remark', res.remark);
+          this.formData['id'] = res.id;
+          this.$refs.table.setData([...res.salesOrderList]);
+          this.$nextTick(() => {
+            this.$refs.table.toggleRowExpansionAll();
+            this.$forceUpdate();
+          });
+        }
+      },
+
+      handleMethod(row) {
+        this.$refs.timeDialogRef.open(row);
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  :deep(.el-table__expanded-cell) {
+    padding-bottom: 30px !important;
+    border-bottom: 12px solid #ccffcc !important;
+  }
+</style>

+ 165 - 0
src/views/bpm/handleTask/components/cuttingPlan/submit.vue

@@ -0,0 +1,165 @@
+<template>
+  <el-col :span="16" :offset="6">
+    <el-form label-width="100px" ref="formRef" :model="form">
+      <el-form-item
+        label="审批建议"
+        prop="reason"
+        style="margin-bottom: 20px"
+        :rules="{
+          required: true,
+          message: '请选择',
+          trigger: 'change'
+        }"
+      >
+        <el-input
+          type="textarea"
+          v-model="form.reason"
+          placeholder="请输入审批建议"
+        />
+      </el-form-item>
+    </el-form>
+    <div style="margin-left: 10%; margin-bottom: 20px; font-size: 14px">
+      <el-button
+        icon="el-icon-edit-outline"
+        type="success"
+        size="mini"
+        @click="handleAudit(1)"
+        >通过
+      </el-button>
+
+      <el-button
+        icon="el-icon-circle-close"
+        type="danger"
+        size="mini"
+        @click="handleAudit(0)"
+        >驳回
+      </el-button>
+
+      <el-dropdown
+        @command="(command) => handleCommand(command)"
+        style="margin-left: 30px"
+      >
+        <span class="el-dropdown-link"
+          >更多<i class="el-icon-arrow-down el-icon--right"></i
+        ></span>
+        <el-dropdown-menu slot="dropdown">
+          <el-dropdown-item command="cancel">作废</el-dropdown-item>
+        </el-dropdown-menu>
+      </el-dropdown>
+    </div>
+  </el-col>
+</template>
+
+<script>
+  import { cancel } from '@/api/bpm/components/apsMeterialPlan';
+  import { apsbaitingplan } from '@/api/bpm/components/cuttingPlan/index';
+
+  import { rejectTask } from '@/api/bpm/task';
+  import { listAllUserBind } from '@/api/system/organization';
+
+  // 流程实例的详情页,可用于审批
+  export default {
+    name: '',
+    components: {},
+    props: {
+      businessId: {
+        default: ''
+      },
+      taskId: {
+        default: ''
+      },
+      id: {
+        default: ''
+      },
+
+      taskDefinitionKey: {
+        default: ''
+      }
+    },
+    data() {
+      return {
+        form: {
+          reason: ''
+        },
+        userOptions: []
+      };
+    },
+    created() {
+      this.userOptions = [];
+      listAllUserBind().then((data) => {
+        this.userOptions.push(...data);
+      });
+    },
+    methods: {
+      async handleAudit(status, type) {
+        this._approveTaskWithVariables(status);
+      },
+      async _approveTaskWithVariables(status) {
+        if (status == 1) {
+          apsbaitingplan({
+            businessId: this.businessId,
+            id: this.taskId,
+            reason: this.form.reason,
+            pass: true
+          }).then((res) => {
+            if (res.data.code != '-1') {
+              this.$emit('handleAudit', {
+                status,
+                title: ''
+              });
+            }
+          });
+        } else if (status == 0) {
+          let API = rejectTask;
+          API({
+            id: this.taskId,
+            reason: this.form.reason,
+            pass: false
+          }).then((res) => {
+            if (res.data.code != '-1') {
+              this.$emit('handleAudit', {
+                status,
+                title: '驳回'
+              });
+            }
+          });
+        }
+      },
+
+      getTableValue() {
+        return new Promise((resolve, reject) => {
+          this.$emit('getTableValue', async (data) => {
+            resolve(await data);
+          });
+        });
+      },
+
+      //更多
+      handleCommand(command) {
+        if (command === 'cancel') {
+          this.$confirm('是否确认作废?', {
+            type: 'warning',
+            cancelButtonText: '取消',
+            confirmButtonText: '确定'
+          })
+            .then(() => {
+              cancel({
+                id: this.taskId,
+                reason: this.form.reason,
+                businessId: this.businessId
+              })
+                .then(() => {
+                  this.$emit('handleClose');
+                })
+                .catch(() => {
+                  this.$message.error('流程作废失败');
+                });
+            })
+            .catch(() => {});
+        }
+      }
+    }
+  };
+</script>
+
+<style lang="scss"></style>

+ 125 - 0
src/views/bpm/handleTask/components/cuttingPlan/timeDialog.vue

@@ -0,0 +1,125 @@
+<template>
+  <el-dialog
+    :title="title"
+    :visible.sync="visible"
+    :before-close="handleClose"
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    append-to-body
+    width="35%"
+  >
+    <el-form
+      :model="form"
+      ref="tableForm"
+      class="tableForm"
+      :rules="tableFormRules"
+    >
+      <el-table
+        ref="multipleTable"
+        :data="form.timeList"
+        tooltip-effect="dark"
+        style="width: 100%"
+        stripe
+        :header-cell-style="{ background: '#EEEEEE', border: 'none' }"
+      >
+        <el-table-column label="数量" prop="purchaseQuantity">
+          <template slot-scope="{ row, $index }">
+            <el-form-item :prop="'timeList.' + $index + '.purchaseQuantity'">
+              <el-input
+                placeholder="请输入"
+                disabled
+                v-model="row.purchaseQuantity"
+              ></el-input>
+            </el-form-item>
+          </template>
+        </el-table-column>
+
+        <el-table-column label="到货时间">
+          <template slot-scope="{ row, $index }">
+            <el-form-item
+              :prop="'timeList.' + $index + '.requireDeliveryTime'"
+              :rules="tableFormRules.requireDeliveryTime"
+            >
+              <el-date-picker
+                disabled
+                v-model="row.requireDeliveryTime"
+                value-format="timestamp"
+                placeholder="请选择日期"
+              >
+              </el-date-picker>
+            </el-form-item> </template
+        ></el-table-column>
+      </el-table>
+    </el-form>
+
+    <div class="btns">
+      <el-button size="small" @click="handleClose">取消</el-button>
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+  export default {
+    components: {},
+    data() {
+      return {
+        visible: false,
+        title: '设置分批时间',
+
+        current: null,
+        form: {
+          timeList: [
+            {
+              requireDeliveryTime: null,
+              purchaseQuantity: null
+            }
+          ]
+        },
+
+        tableFormRules: {
+          purchaseQuantity: {
+            required: true,
+            message: '请输入数量',
+            trigger: 'blur'
+          },
+
+          requireDeliveryTime: {
+            required: true,
+            message: '请选择日期',
+            trigger: 'change'
+          }
+        }
+      };
+    },
+
+    watch: {},
+    methods: {
+      open(row) {
+        this.form.timeList = row.timeList;
+        this.current = row;
+        this.visible = true;
+      },
+
+      handleClose() {
+        this.visible = false;
+        this.form.timeList = [
+          {
+            requireDeliveryTime: null,
+            purchaseQuantity: null
+          }
+        ];
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  .btns {
+    margin-top: 20px;
+    text-align: center;
+  }
+
+  .el-form-item {
+    margin-bottom: 20px !important;
+  }
+</style>