ysy hace 2 años
padre
commit
2dd129540a

+ 110 - 0
src/api/bpm/components/materialPlan/index.js

@@ -0,0 +1,110 @@
+import request from '@/utils/request';
+
+/**
+ * 列表
+ */
+export async function getList (data) {
+  const res = await request.post('/aps/batchingplan/page', 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));
+}
+
+
+// 根据销售订单计算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/apspurchaseplan/submit`,data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+

+ 9 - 0
src/api/bpm/task.js

@@ -111,3 +111,12 @@ export function approveTaskWithVariables(data) {
     data: data
   });
 }
+
+export function apspurchaseplan(data) {
+  return request({
+    url: '/bpm/apspurchaseplan/assign',
+    method: 'POST',
+    data: data
+  });
+}
+

+ 297 - 0
src/views/bpm/handleTask/components/materialPlan/detailDialog.vue

@@ -0,0 +1,297 @@
+<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:annex="{ row }">
+                {{ row.annex }}
+              </template>
+            </ele-pro-table>
+          </div>
+        </template>
+      </ele-pro-table>
+    </el-form>
+  </div>
+</template>
+  
+<script>
+import { getById } from '@/api/bpm/components/materialPlan/index';
+import { getFile } from '@/api/system/file';
+
+export default {
+  props: {
+    businessId: {
+      default: ''
+    }
+  },
+  mixins: [],
+
+  data() {
+    return {
+      visible: false,
+      title: '采购配料计划',
+
+      // 表格列配置
+      columns: [
+        {
+          width: 45,
+          type: 'expand',
+          columnKey: 'materialList',
+          align: 'center',
+          slot: 'expand'
+        },
+
+        {
+          width: 50,
+          label: '序号',
+          type: 'index',
+          align: 'center',
+          slot: 'index'
+        },
+
+        {
+          prop: 'code',
+          label: '销售订单号',
+          showOverflowTooltip: true,
+          align: 'center',
+          minWidth: 170
+        },
+        {
+          prop: 'customerName',
+          label: '客户名称',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'deliveryNum',
+          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: 'packingCountBase',
+          label: '计量库存',
+          sortable: 'custom',
+          align: 'center'
+        },
+
+        {
+          label: '计量单位',
+          prop: 'unit',
+          align: 'center'
+        },
+
+        {
+          label: '需求数量',
+        
+          action: 'demandQuantity',
+          align: 'center'
+        },
+
+        {
+          label: '采购数量',
+          action: 'purchaseQuantity',
+          align: 'center'
+        },
+
+        {
+          label: '要求到货时间',
+          action: ' requireDeliveryTime',
+          align: 'center'
+        },
+
+        {
+          label: '到货方式',
+          slot: 'deliveryMethod',
+          action: ' deliveryMethod',
+          align: 'center'
+        },
+
+        {
+          label: '附件图纸',
+          slot: 'annex',
+          action: ' annex',
+          align: 'center'
+        },
+
+   
+      ],
+
+      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.$refs.table.toggleRowExpansionAll()
+      }
+    }
+  }
+};
+</script>
+  
+<style lang="scss" scoped>
+:deep(.el-table__expanded-cell) {
+
+  padding-bottom: 30px !important;
+  border-bottom: 12px solid #CCFFCC !important;
+}
+</style>
+
+

+ 139 - 0
src/views/bpm/handleTask/components/materialPlan/submit.vue

@@ -0,0 +1,139 @@
+<template>
+  <el-col :span="16" :offset="6">
+    <el-form label-width="100px" ref="formRef" :model="form">
+      <el-form-item label="采购员" prop="technicianId" style="margin-bottom: 20px" :rules="{
+        required: true,
+        message: '请选择',
+        trigger: 'change'
+      }">
+        <el-select v-model="form.technicianId" clearable style="width: 100%" :filterable="true">
+          <el-option v-for="item in userOptions" @click.native="form.userName = item.name" :key="item.id"
+            :label="item.name" :value="item.id" />
+        </el-select>
+      </el-form-item>
+      <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>
+
+
+    </div>
+
+  </el-col>
+</template>
+
+<script>
+
+import { apspurchaseplan, approveTaskWithVariables } 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: {
+        technicianId: '',
+        reason: ''
+      },
+      userOptions: []
+    };
+  },
+  created() {
+    this.userOptions = [];
+    listAllUserBind().then((data) => {
+      this.userOptions.push(...data);
+    });
+  },
+  methods: {
+
+
+    async handleAudit(status, type) {
+      //生产主管审批选择技术员
+
+      if (!this.form.technicianId && status == 1) {
+        this.$message.warning(`请选择采购员!`);
+        return;
+      }
+
+
+      this._approveTaskWithVariables(status);
+    },
+    async _approveTaskWithVariables(status) {
+
+
+      if (status == 1) {
+
+        apspurchaseplan({
+          businessId: this.businessId,
+          id: this.taskId,
+          userId: this.form.technicianId,
+          userName: this.form.userName,
+          reason: this.form.reason,
+          pass: true
+
+        }).then((res) => {
+          if (res.data.code != '-1') {
+            this.$emit('handleAudit', {
+              status,
+              title: ''
+            });
+          }
+        });
+      } else if (status == 0) {
+        approveTaskWithVariables({
+          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);
+        });
+      });
+    }
+  }
+};
+</script>
+
+<style lang="scss"></style>

+ 1 - 0
src/views/bpm/todo/index.vue

@@ -215,6 +215,7 @@
       /** 处理审批按钮 */
 
       handleAudit(type, row) {
+
         if (type == 'audit') {
           this.$refs.handleTaskRef.open({
             id: row.processInstance.id,