Compare commits
6 Commits
3353de9b2f
...
d775904dc3
| Author | SHA1 | Date |
|---|---|---|
|
|
d775904dc3 | |
|
|
c99ba06d89 | |
|
|
b952b9610a | |
|
|
3a099795c2 | |
|
|
491344f1d6 | |
|
|
b3f1fdf2ae |
|
|
@ -0,0 +1,28 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 查询待办详情
|
||||
export function getTodoDetail(query) {
|
||||
return request({
|
||||
url: '/flow/todo/detail',
|
||||
method: 'post',
|
||||
data: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询已完成流程列表
|
||||
export function listCompletedFlows(data) {
|
||||
return request({
|
||||
url: '/flow/completed/all/list',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
// 通用审批
|
||||
export function approveTask(data) {
|
||||
return request({
|
||||
url: '/flow/todo/approve',
|
||||
method: 'post',
|
||||
data: data,
|
||||
needLoading: true
|
||||
})
|
||||
}
|
||||
|
|
@ -8,6 +8,22 @@ export function listPurchaseorder(query) {
|
|||
params: query
|
||||
})
|
||||
}
|
||||
export function listVendorPurchaseorder(query) {
|
||||
return request({
|
||||
url: '/sip/purchaseorder/vendor/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询待审批采购单主表列表
|
||||
export function listApprovePurchaseorder(query) {
|
||||
return request({
|
||||
url: '/sip/purchaseorder/approveList',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询采购单主表详细
|
||||
export function getPurchaseorder(id) {
|
||||
|
|
@ -40,14 +56,55 @@ export function applyPurchaseorder(data) {
|
|||
return request({
|
||||
url: '/sip/purchaseorder/apply',
|
||||
method: 'put',
|
||||
data: data
|
||||
data: data,
|
||||
needLoading: true
|
||||
})
|
||||
}
|
||||
|
||||
// 删除采购单主表
|
||||
// 查询采购单历史记录
|
||||
export function getPurchaseOrderHistory(purchaseId) {
|
||||
return request({
|
||||
url: '/sip/purchaseorder/history/' + purchaseId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 查询单个采购单历史记录详情
|
||||
export function getPurchaseOrderHistoryDetail(id) {
|
||||
return request({
|
||||
url: '/sip/purchaseorder/history/detail/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 撤回采购订单
|
||||
export function delPurchaseorder(id) {
|
||||
return request({
|
||||
url: '/sip/purchaseorder/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 发起供应商确认
|
||||
export function vendorConfirmStatus(data) {
|
||||
return request({
|
||||
url: '/sip/purchaseorder/vendorConfirmStatus',
|
||||
method: 'put',
|
||||
data:data
|
||||
})
|
||||
}
|
||||
export function recallPurchaseorder(id) {
|
||||
return request({
|
||||
url: '/sip/purchaseorder/recall/' + id,
|
||||
method: 'put'
|
||||
})
|
||||
}
|
||||
|
||||
// 查询已审批采购单主表列表
|
||||
export function listApprovedPurchaseorder(query) {
|
||||
return request({
|
||||
url: '/sip/purchaseorder/approved/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ export default {
|
|||
|
||||
<style lang="scss" scoped>
|
||||
.approve-layout {
|
||||
max-height: 100vh;
|
||||
|
||||
background-color: #F8F5F0;
|
||||
padding: 20px;
|
||||
display: flex;
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ import ApproveLayout from '@/views/approve/ApproveLayout.vue';
|
|||
import html2canvas from 'html2canvas';
|
||||
import jsPDF from 'jspdf';
|
||||
|
||||
import OrderInfoDisplay from '@/components/order/OrderInfoDisplay.vue';
|
||||
import OrderInfoDisplay from '@/views/project/order/components/OrderInfoDisplay.vue';
|
||||
|
||||
export default {
|
||||
name: "Approve",
|
||||
|
|
|
|||
|
|
@ -0,0 +1,308 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="120px">
|
||||
<!-- 搜索表单内容 -->
|
||||
<el-form-item label="采购单号" prop="purchaseNo">
|
||||
<el-input v-model="queryParams.purchaseNo" placeholder="请输入采购单号" clearable @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="制造商名称" prop="vendorName">
|
||||
<el-input v-model="queryParams.vendorName" placeholder="请输入制造商名称" clearable @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="汇智负责人" prop="ownerName">
|
||||
<el-input v-model="queryParams.ownerName" placeholder="请输入采购方名称" clearable @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="提交日期">
|
||||
<el-date-picker
|
||||
v-model="dateRangeApplyTime"
|
||||
style="width: 240px"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
type="datetimerange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
></el-date-picker>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-table v-loading="loading" :data="purchaseorderList">
|
||||
<!-- 表格列定义 -->
|
||||
<el-table-column label="序号" type="index" width="50" align="center" />
|
||||
<el-table-column label="采购单号" align="center" prop="purchaseNo" />
|
||||
<el-table-column label="制造商名称" align="center" prop="vendorName"/>
|
||||
<el-table-column label="联系人" align="center" prop="vendorUser" />
|
||||
<el-table-column label="含税总金额" align="center" prop="totalAmount" />
|
||||
<el-table-column label="提交日期" align="center" prop="applyTime" >
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.applyTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="汇智负责人" align="center" prop="ownerName" />
|
||||
<el-table-column label="审批节点" align="center" prop="approveNode" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="200">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-view" @click="handleApprove(scope.row)">审批</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList"/>
|
||||
|
||||
<!-- 审批详情主对话框 -->
|
||||
<el-dialog title="采购单审批" :visible.sync="detailDialogVisible" width="80%" append-to-body>
|
||||
<div v-loading="detailLoading" style="max-height: 70vh; overflow-y: auto; padding: 20px;">
|
||||
<ApproveLayout title="采购单详情" >
|
||||
<purchase-order-detail-view ref="detailViewOnly" :order-data="form" >
|
||||
</purchase-order-detail-view>
|
||||
<template #footer>
|
||||
<span>订单编号: {{ form.purchaseNo }}</span>
|
||||
</template>
|
||||
</ApproveLayout>
|
||||
|
||||
<el-divider content-position="left">流转意见</el-divider>
|
||||
<div class="process-container">
|
||||
<el-timeline>
|
||||
<el-timeline-item v-for="log in approveLogs" :key="log.id" :timestamp="log.approveTime" placement="top">
|
||||
<el-card>
|
||||
<h4>{{ log.approveOpinion }}</h4>
|
||||
<p><b>操作人:</b> {{ log.approveUserName }} ({{ log.roleName }})</p>
|
||||
<p><b>接收人:</b> {{ log.nextAllApproveUserName }} </p>
|
||||
<p><b>审批状态:</b> <el-tag size="small">{{ getStatusText(log.approveStatus) }}</el-tag></p>
|
||||
</el-card>
|
||||
</el-timeline-item>
|
||||
</el-timeline>
|
||||
<div v-if="!approveLogs || approveLogs.length === 0">暂无流转过程数据。</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="openOpinionDialog('approve')">同意</el-button>
|
||||
<el-button type="danger" @click="openOpinionDialog('reject')">驳回</el-button>
|
||||
<el-button @click="detailDialogVisible = false">取 消</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
|
||||
|
||||
|
||||
<!-- 审批意见对话框 (三级) -->
|
||||
<el-dialog :title="confirmDialogTitle" :visible.sync="opinionDialogVisible" width="30%" append-to-body>
|
||||
<el-form ref="opinionForm" :model="opinionForm" :rules="opinionRules" label-width="100px">
|
||||
<el-form-item label="审批意见" prop="approveOpinion">
|
||||
<el-input v-model="opinionForm.approveOpinion" type="textarea" :rows="4" placeholder="请输入审批意见"/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="opinionDialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="showConfirmDialog()">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listApprovePurchaseorder, getPurchaseorder } from "@/api/sip/purchaseorder";
|
||||
import { listAllVendor } from "@/api/base/vendor";
|
||||
import { getDicts } from "@/api/system/dict/data";
|
||||
import { getTodoDetail, listCompletedFlows, approveTask } from "@/api/flow";
|
||||
import PurchaseOrderDetailView from "@/views/purchaseorder/components/PurchaseOrderDetailView.vue";
|
||||
import ApproveLayout from "@/views/approve/ApproveLayout.vue";
|
||||
|
||||
export default {
|
||||
name: "PurchaseOrderApprove",
|
||||
components: {ApproveLayout, PurchaseOrderDetailView},
|
||||
dicts: ['approve_status', 'vendor_confirm_status', 'purchase_status'],
|
||||
data() {
|
||||
return {
|
||||
// 列表页数据
|
||||
loading: true,
|
||||
showSearch: true,
|
||||
total: 0,
|
||||
purchaseorderList: [],
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
purchaseNo: null,
|
||||
buyerName: null,
|
||||
vendorName: null,
|
||||
ownerName: null,
|
||||
approveStatus: '1',
|
||||
params:{
|
||||
applyTimeStart: null,
|
||||
applyTimeEnd: null,
|
||||
}
|
||||
|
||||
},
|
||||
// 时间范围选择器
|
||||
dateRangeApplyTime: [],
|
||||
detailDialogVisible: false,
|
||||
detailLoading: false,
|
||||
productTypeOptions: [],
|
||||
vendorOptions: [],
|
||||
selectedVendor: {},
|
||||
form: {
|
||||
omsPurchaseOrderItemList: []
|
||||
},
|
||||
approveLogs: [],
|
||||
opinionForm: {
|
||||
approveOpinion: ''
|
||||
},
|
||||
opinionRules: {
|
||||
approveOpinion: [{ required: true, message: '审批意见不能为空', trigger: 'blur' }],
|
||||
},
|
||||
// 审批意见对话框数据
|
||||
opinionDialogVisible: false,
|
||||
processKey: null,
|
||||
taskId: null,
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
this.getVendorList();
|
||||
getDicts("product_type").then(response => {
|
||||
this.productTypeOptions = response.data;
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
// 列表页方法
|
||||
getList() {
|
||||
this.loading = true;
|
||||
this.queryParams.params.applyTimeStart = this.dateRangeApplyTime && this.dateRangeApplyTime.length > 0 ? this.dateRangeApplyTime[0] : null;
|
||||
this.queryParams.params.applyTimeEnd = this.dateRangeApplyTime && this.dateRangeApplyTime.length > 0 ? this.dateRangeApplyTime[1] : null;
|
||||
listApprovePurchaseorder(this.queryParams).then(response => {
|
||||
this.purchaseorderList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
resetQuery() {
|
||||
this.dateRangeApplyTime = [];
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 详情对话框方法
|
||||
handleApprove(row) {
|
||||
this.resetDetailForm();
|
||||
this.currentOrderId = row.id;
|
||||
this.processKey=row.processKey
|
||||
this.taskId=row.taskId
|
||||
this.detailLoading = true;
|
||||
this.detailDialogVisible = true;
|
||||
getPurchaseorder(this.currentOrderId).then(response => {
|
||||
this.form = response.data;
|
||||
this.handleVendorChange(this.form.vendorId);
|
||||
this.loadApproveHistory(this.currentOrderId); // 加载流转日志
|
||||
this.detailLoading = false;
|
||||
// // 获取 processKey 和 taskId
|
||||
// getTodoDetail({ businessKey: this.form.purchaseNo, processKeyList: ['purchase_order_online'] }).then(res => {
|
||||
// if (res.data) {
|
||||
// this.processKey = res.data.processKey;
|
||||
// this.taskId = res.data.taskId;
|
||||
// } else {
|
||||
// this.$modal.msgWarning("未能获取到待办任务详情!");
|
||||
// }
|
||||
// }).catch(error => {
|
||||
// console.error("获取待办任务详情失败: ", error);
|
||||
// this.$modal.msgError("获取待办任务详情失败!");
|
||||
// }).finally(() => {
|
||||
// this.detailLoading = false;
|
||||
// });
|
||||
|
||||
}).catch(error => {
|
||||
console.error("获取采购订单详情失败: ", error);
|
||||
this.$modal.msgError("获取采购订单详情失败!");
|
||||
this.detailLoading = false;
|
||||
});
|
||||
},
|
||||
resetDetailForm() {
|
||||
this.form = { omsPurchaseOrderItemList: [] };
|
||||
this.selectedVendor = {};
|
||||
this.approveLogs = [];
|
||||
this.opinionForm.approveOpinion = '';
|
||||
},
|
||||
getVendorList() {
|
||||
listAllVendor().then(res => { this.vendorOptions = res.data; });
|
||||
},
|
||||
handleVendorChange(vendorId) {
|
||||
if (vendorId) {
|
||||
this.selectedVendor = this.vendorOptions.find(item => item.vendorId === vendorId) || {};
|
||||
} else {
|
||||
this.selectedVendor = {};
|
||||
}
|
||||
},
|
||||
loadApproveHistory(id) {
|
||||
const purchaseNo = this.form.purchaseNo; // 假设form中包含purchaseNo
|
||||
if (purchaseNo) {
|
||||
listCompletedFlows({ processKeyList: ['purchase_order_online'], businessKey: purchaseNo }).then(response => {
|
||||
this.approveLogs = response.data;
|
||||
}).catch(error => {
|
||||
console.error("获取流转历史失败: ", error);
|
||||
this.$modal.msgError("获取流转历史失败!");
|
||||
});
|
||||
} else {
|
||||
console.warn("缺少 purchaseNo,无法查询流转历史。");
|
||||
this.approveLogs = [];
|
||||
}
|
||||
},
|
||||
// 打开审批意见对话框
|
||||
openOpinionDialog(type) {
|
||||
this.currentApproveType = type;
|
||||
this.confirmDialogTitle = type === 'approve' ? '同意审批' : '驳回审批';
|
||||
this.opinionDialogVisible = true;
|
||||
this.opinionForm.approveOpinion = ''; // Clear previous opinion
|
||||
this.$nextTick(() => {
|
||||
this.$refs.opinionForm.clearValidate(); // Clear previous validation messages
|
||||
});
|
||||
},
|
||||
// 确认对话框方法
|
||||
showConfirmDialog() {
|
||||
this.$refs.opinionForm.validate(valid => {
|
||||
if (valid) {
|
||||
this.opinionDialogVisible = false; // 关闭意见对话框
|
||||
this.submitApproval(); // 直接提交审批
|
||||
}
|
||||
});
|
||||
},
|
||||
submitApproval() {
|
||||
const approveBtn = this.currentApproveType === 'approve' ? 1 : 0; // 1:通过, 0:驳回
|
||||
const params = {
|
||||
businessKey: this.form.purchaseNo,
|
||||
processKey: this.processKey,
|
||||
taskId: this.taskId,
|
||||
variables: {
|
||||
comment: this.opinionForm.approveOpinion,
|
||||
approveBtn: approveBtn
|
||||
}
|
||||
};
|
||||
|
||||
approveTask(params).then(response => {
|
||||
this.$modal.msgSuccess(this.confirmDialogTitle + "成功");
|
||||
this.detailDialogVisible = false;
|
||||
this.getList(); // 刷新列表
|
||||
}).catch(error => {
|
||||
console.error("审批失败: ", error);
|
||||
this.$modal.msgError("审批失败!" + error.msg || error.message);
|
||||
});
|
||||
},
|
||||
// 通用方法
|
||||
getStatusText(status) {
|
||||
const textMap = { '1': '提交审批', '2': '驳回', '3': '批准' };
|
||||
return textMap[String(status)] || '提交审批';
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.process-container {
|
||||
padding: 10px;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,233 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="120px">
|
||||
<!-- 搜索表单内容 -->
|
||||
<el-form-item label="采购单号" prop="purchaseNo">
|
||||
<el-input v-model="queryParams.purchaseNo" placeholder="请输入采购单号" clearable @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="制造商名称" prop="vendorName">
|
||||
<el-input v-model="queryParams.vendorName" placeholder="请输入制造商名称" clearable @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="汇智负责人" prop="ownerName">
|
||||
<el-input v-model="queryParams.ownerName" placeholder="请输入采购方名称" clearable @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="提交日期">
|
||||
<el-date-picker
|
||||
v-model="dateRangeApplyTime"
|
||||
style="width: 240px"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
type="datetimerange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
></el-date-picker>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-table v-loading="loading" :data="purchaseorderList">
|
||||
<!-- 表格列定义 -->
|
||||
<el-table-column label="序号" type="index" width="50" align="center" />
|
||||
<el-table-column label="采购单号" align="center" prop="purchaseNo" />
|
||||
<el-table-column label="制造商名称" align="center" prop="vendorName"/>
|
||||
<el-table-column label="联系人" align="center" prop="vendorUser" />
|
||||
<el-table-column label="含税总金额" align="center" prop="totalAmount" />
|
||||
<el-table-column label="提交日期" align="center" prop="applyTime" >
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.applyTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="审批日期" align="center" prop="todoApproveTime" >
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.todoApproveTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="汇智负责人" align="center" prop="ownerName" />
|
||||
<el-table-column label="审批节点" align="center" prop="approveNode" width="100">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.approveNode || '-' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="200">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-view" @click="handleView(scope.row)">查看</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList"/>
|
||||
|
||||
<!-- 审批详情主对话框 (查看模式) -->
|
||||
<el-dialog title="采购单详情" :visible.sync="detailDialogVisible" width="80%" append-to-body>
|
||||
<div v-loading="detailLoading" style="max-height: 70vh; overflow-y: auto; padding: 20px;">
|
||||
<ApproveLayout title="采购单详情" >
|
||||
<purchase-order-detail-view ref="detailViewOnly" :order-data="form" >
|
||||
</purchase-order-detail-view>
|
||||
<template #footer>
|
||||
<span>订单编号: {{ form.purchaseNo }}</span>
|
||||
</template>
|
||||
</ApproveLayout>
|
||||
|
||||
<el-divider content-position="left">流转意见</el-divider>
|
||||
<div class="process-container">
|
||||
<el-timeline>
|
||||
<el-timeline-item v-for="log in approveLogs" :key="log.id" :timestamp="log.approveTime" placement="top">
|
||||
<el-card>
|
||||
<h4>{{ log.approveOpinion }}</h4>
|
||||
<p><b>操作人:</b> {{ log.approveUserName }} ({{ log.roleName }})</p>
|
||||
<p><b>接收人:</b> {{ log.nextAllApproveUserName }} </p>
|
||||
<p><b>审批状态:</b> <el-tag size="small">{{ getStatusText(log.approveStatus) }}</el-tag></p>
|
||||
</el-card>
|
||||
</el-timeline-item>
|
||||
</el-timeline>
|
||||
<div v-if="!approveLogs || approveLogs.length === 0">暂无流转过程数据。</div>
|
||||
</div>
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="detailDialogVisible = false">关 闭</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getPurchaseorder } from "@/api/sip/purchaseorder";
|
||||
import { listAllVendor } from "@/api/base/vendor";
|
||||
import { getDicts } from "@/api/system/dict/data";
|
||||
import { listCompletedFlows } from "@/api/flow";
|
||||
import PurchaseOrderDetailView from "@/views/purchaseorder/components/PurchaseOrderDetailView.vue";
|
||||
import ApproveLayout from "@/views/approve/ApproveLayout.vue";
|
||||
// 新增的API接口
|
||||
import { listApprovedPurchaseorder } from "@/api/sip/purchaseorder";
|
||||
|
||||
|
||||
export default {
|
||||
name: "PurchaseOrderApprovedList",
|
||||
components: {ApproveLayout, PurchaseOrderDetailView},
|
||||
dicts: ['approve_status', 'vendor_confirm_status', 'purchase_status'],
|
||||
data() {
|
||||
return {
|
||||
// 列表页数据
|
||||
loading: true,
|
||||
showSearch: true,
|
||||
total: 0,
|
||||
purchaseorderList: [],
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
purchaseNo: null,
|
||||
buyerName: null,
|
||||
vendorName: null,
|
||||
ownerName: null,
|
||||
approveStatus: '3', // 已审批状态通常为3
|
||||
params:{
|
||||
applyTimeStart: null,
|
||||
applyTimeEnd: null,
|
||||
}
|
||||
},
|
||||
// 时间范围选择器
|
||||
dateRangeApplyTime: [],
|
||||
detailDialogVisible: false,
|
||||
detailLoading: false,
|
||||
productTypeOptions: [],
|
||||
vendorOptions: [],
|
||||
selectedVendor: {},
|
||||
form: {
|
||||
omsPurchaseOrderItemList: []
|
||||
},
|
||||
approveLogs: [],
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
this.getVendorList();
|
||||
getDicts("product_type").then(response => {
|
||||
this.productTypeOptions = response.data;
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
// 列表页方法
|
||||
getList() {
|
||||
this.loading = true;
|
||||
this.queryParams.params.applyTimeStart = this.dateRangeApplyTime && this.dateRangeApplyTime.length > 0 ? this.dateRangeApplyTime[0] : null;
|
||||
this.queryParams.params.applyTimeEnd = this.dateRangeApplyTime && this.dateRangeApplyTime.length > 0 ? this.dateRangeApplyTime[1] : null;
|
||||
listApprovedPurchaseorder(this.queryParams).then(response => { // Changed API call
|
||||
this.purchaseorderList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
resetQuery() {
|
||||
this.dateRangeApplyTime = [];
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 详情对话框方法 (查看模式)
|
||||
handleView(row) {
|
||||
this.resetDetailForm();
|
||||
this.currentOrderId = row.id;
|
||||
this.detailLoading = true;
|
||||
this.detailDialogVisible = true;
|
||||
getPurchaseorder(this.currentOrderId).then(response => {
|
||||
this.form = response.data;
|
||||
this.handleVendorChange(this.form.vendorId);
|
||||
this.loadApproveHistory(this.currentOrderId); // 加载流转日志
|
||||
this.detailLoading = false;
|
||||
}).catch(error => {
|
||||
console.error("获取采购订单详情失败: ", error);
|
||||
this.$modal.msgError("获取采购订单详情失败!");
|
||||
this.detailLoading = false;
|
||||
});
|
||||
},
|
||||
resetDetailForm() {
|
||||
this.form = { omsPurchaseOrderItemList: [] };
|
||||
this.selectedVendor = {};
|
||||
this.approveLogs = [];
|
||||
},
|
||||
getVendorList() {
|
||||
listAllVendor().then(res => { this.vendorOptions = res.data; });
|
||||
},
|
||||
handleVendorChange(vendorId) {
|
||||
if (vendorId) {
|
||||
this.selectedVendor = this.vendorOptions.find(item => item.vendorId === vendorId) || {};
|
||||
} else {
|
||||
this.selectedVendor = {};
|
||||
}
|
||||
},
|
||||
loadApproveHistory(id) {
|
||||
const purchaseNo = this.form.purchaseNo; // 假设form中包含purchaseNo
|
||||
if (purchaseNo) {
|
||||
listCompletedFlows({ processKeyList: ['purchase_order_online'], businessKey: purchaseNo }).then(response => {
|
||||
this.approveLogs = response.data;
|
||||
}).catch(error => {
|
||||
console.error("获取流转历史失败: ", error);
|
||||
this.$modal.msgError("获取流转历史失败!");
|
||||
});
|
||||
} else {
|
||||
console.warn("缺少 purchaseNo,无法查询流转历史。");
|
||||
this.approveLogs = [];
|
||||
}
|
||||
},
|
||||
// 通用方法
|
||||
getStatusText(status) {
|
||||
const textMap = { '1': '提交审批', '2': '驳回', '3': '批准' };
|
||||
return textMap[String(status)] || '提交审批';
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.process-container {
|
||||
padding: 10px;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -88,7 +88,7 @@ import { getDicts } from "@/api/system/dict/data";
|
|||
import CheckoutDialog from './CheckoutDialog.vue';
|
||||
import OuterDetailDialog from './OuterDetailDialog.vue';
|
||||
import OrderDetailDrawer from "@/views/project/order/OrderDetailDrawer.vue";
|
||||
import OrderInfo from "@/components/order/OrderInfoDisplay.vue";
|
||||
import OrderInfo from "@/views/project/order/components/OrderInfoDisplay.vue";
|
||||
|
||||
export default {
|
||||
name: "ExecutionEdit",
|
||||
|
|
|
|||
|
|
@ -96,10 +96,11 @@
|
|||
<el-table-column label="操作" width="200">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
v-if="scope.row.id === -1 && ((updateFile && scope.row.fileSort !== '2') || (uploadFinalFile && scope.row.fileSort === '2'))"
|
||||
v-if="scope.row.id === -1 && ((updateFile && scope.row.fileSort !== '3') || (uploadFinalFile && scope.row.fileSort === '3'))"
|
||||
type="text"
|
||||
icon="el-icon-upload"
|
||||
@click="importList(scope.$index)"
|
||||
:disabled="false"
|
||||
>上传
|
||||
</el-button> <el-button
|
||||
v-if="scope.row.id !== -1"
|
||||
|
|
@ -122,7 +123,7 @@
|
|||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="delUploadRow(scope.$index, scope.row.id)"
|
||||
:disabled="form.orderStatus === '2'"
|
||||
:disabled="false"
|
||||
>删除
|
||||
</el-button>
|
||||
</template>
|
||||
|
|
@ -166,7 +167,7 @@
|
|||
import { getOrder, addOrder, updateOrder, delContractFile, uploadContractFile, getProject } from "@/api/project/order";
|
||||
import ProductConfig from '@/views/project/info/ProductConfig.vue';
|
||||
import SelectCommitType from "./SelectCommitType.vue";
|
||||
import OrderInfo from '@/components/order/OrderInfo.vue';
|
||||
import OrderInfo from '@/views/project/order/components/OrderInfo.vue';
|
||||
import SelectProject from "@/views/project/info/SelectProject";
|
||||
import SelectUser from "@/views/system/user/selectUser";
|
||||
import SelectPartner from "@/views/system/partner/selectPartner";
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@
|
|||
<script>
|
||||
import { getOrder } from "@/api/project/order";
|
||||
import ProductConfig from '@/views/project/info/ProductConfig.vue';
|
||||
import OrderInfo from '@/components/order/OrderInfoDisplay.vue';
|
||||
import OrderInfo from '@/views/project/order/components/OrderInfoDisplay.vue';
|
||||
|
||||
export default {
|
||||
name: "OrderDetailDrawer",
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@
|
|||
</el-form>
|
||||
<select-user :visible.sync="purchaserSelectOpen" @user-selected="handlePurchaserSelect"></select-user>
|
||||
<select-user :visible.sync="ownerSelectOpen" @user-selected="handleOwnerSelect"></select-user>
|
||||
<select-product :visible.sync="productSelectOpen" @product-selected="handleProductSelected" :product-type="currentProductType"></select-product>
|
||||
<select-product :visible.sync="productSelectOpen" @product-selected="handleProductSelected" :vendor-code="currentVendorCode" :product-type="currentProductType"></select-product>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
@ -193,7 +193,12 @@ import {preciseCurrencyRound} from "@/utils/ruoyi";
|
|||
export default {
|
||||
name: "PurchaseOrderDetail",
|
||||
components: { SelectUser, SelectProduct },
|
||||
|
||||
props: {
|
||||
orderData: {
|
||||
type: Object,
|
||||
default: null
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 产品选择弹窗
|
||||
|
|
@ -202,6 +207,7 @@ export default {
|
|||
editingProductIndex: -1,
|
||||
// 当前编辑的产品类型
|
||||
currentProductType: null,
|
||||
currentVendorCode: null,
|
||||
// 产品类型字典
|
||||
productTypeOptions: [],
|
||||
// 制造商选项
|
||||
|
|
@ -233,7 +239,7 @@ export default {
|
|||
status: 0,
|
||||
approveStatus: 0,
|
||||
approveNode: null,
|
||||
confirmStatus: 0,
|
||||
confirmStatus: null,
|
||||
omsPurchaseOrderItemList: [
|
||||
{
|
||||
productType: null,
|
||||
|
|
@ -265,7 +271,8 @@ export default {
|
|||
computed: {
|
||||
totalAmountWithTax() {
|
||||
const total = this.form.omsPurchaseOrderItemList?.reduce((acc, cur) => acc + (cur.amountTotal || 0), 0);
|
||||
return preciseCurrencyRound(total) || 0;
|
||||
this.form.totalAmount=preciseCurrencyRound(total) || 0;
|
||||
return this.form.totalAmount;
|
||||
},
|
||||
totalAmountWithoutTax() {
|
||||
const total = this.form.omsPurchaseOrderItemList?.reduce((acc, cur) => {
|
||||
|
|
@ -279,22 +286,51 @@ export default {
|
|||
return (preciseCurrencyRound((this.totalAmountWithTax - this.totalAmountWithoutTax )) ) || 0;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
orderData: {
|
||||
handler(newVal) {
|
||||
if (newVal) {
|
||||
this.form = JSON.parse(JSON.stringify(newVal));
|
||||
// 等待 vendorOptions 加载完成后再处理制造商
|
||||
this.$nextTick(() => {
|
||||
this.handleVendorChange(this.form.vendorId);
|
||||
// 确保 omsPurchaseOrderItemList 至少有一个空行
|
||||
if (this.form.omsPurchaseOrderItemList && this.form.omsPurchaseOrderItemList.length === 0) {
|
||||
this.form.omsPurchaseOrderItemList.push(this.getNewPurchaseOrderItem());
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// orderData 为 null 时重置表单为新增状态
|
||||
this.resetForm();
|
||||
}
|
||||
},
|
||||
immediate: false,
|
||||
deep: false
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getVendorList().then(() => {
|
||||
getDicts("product_type").then(response => {
|
||||
this.productTypeOptions = response.data;
|
||||
});
|
||||
// 如果已经有 orderData 则立即处理
|
||||
if (this.orderData) {
|
||||
this.form = JSON.parse(JSON.stringify(this.orderData));
|
||||
this.handleVendorChange(this.form.vendorId);
|
||||
if (this.form.omsPurchaseOrderItemList && this.form.omsPurchaseOrderItemList.length === 0) {
|
||||
this.form.omsPurchaseOrderItemList.push(this.getNewPurchaseOrderItem());
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
loadPurchaseOrder(id) {
|
||||
if (id){
|
||||
// 此方法保留用于兼容性,实际数据通过 prop 传递
|
||||
if (!this.orderData && id) {
|
||||
getPurchaseorder(id).then(response => {
|
||||
this.form = response.data;
|
||||
console.log(this.form)
|
||||
// 加载订单后,根据vendorId回显制造商信息
|
||||
this.handleVendorChange(this.form.vendorId);
|
||||
// 确保 omsPurchaseOrderItemList 至少有一个空行如果它是空的
|
||||
if (this.form.omsPurchaseOrderItemList && this.form.omsPurchaseOrderItemList.length === 0) {
|
||||
this.form.omsPurchaseOrderItemList.push(this.getNewPurchaseOrderItem());
|
||||
}
|
||||
|
|
@ -307,6 +343,10 @@ export default {
|
|||
this.$modal.msgWarning("请先选择产品类型");
|
||||
return;
|
||||
}
|
||||
if (!this.currentVendorCode){
|
||||
this.$modal.msgWarning("请先选择制造商");
|
||||
return;
|
||||
}
|
||||
this.editingProductIndex = index;
|
||||
this.currentProductType = this.form.omsPurchaseOrderItemList[index].productType;
|
||||
this.productSelectOpen = true;
|
||||
|
|
@ -352,9 +392,11 @@ export default {
|
|||
/** 计算含税小计 */
|
||||
calculateRowTotal(row) {
|
||||
if (row.quantity != null && row.price != null) {
|
||||
row.amountTotal = Math.round(row.quantity * row.price * 100) / 100;
|
||||
row.amountTotal = preciseCurrencyRound(row.quantity * row.price);
|
||||
row.taxTotal = row.amountTotal - preciseCurrencyRound(row.amountTotal / (1 + row.taxRate));
|
||||
} else {
|
||||
row.amountTotal = 0;
|
||||
row.taxTotal = 0;
|
||||
}
|
||||
},
|
||||
/** 获取厂商列表 */
|
||||
|
|
@ -368,9 +410,11 @@ export default {
|
|||
if (vendorId) {
|
||||
this.selectedVendor = this.vendorOptions.find(item => item.vendorId === vendorId) || {};
|
||||
this.form.warehouseId = this.selectedVendor.warehouseId
|
||||
this.currentVendorCode=this.selectedVendor.vendorCode;
|
||||
} else {
|
||||
this.selectedVendor = {};
|
||||
this.form.warehouseId = null;
|
||||
this.currentVendorCode = null;
|
||||
}
|
||||
},
|
||||
/** 处理采购员选择 */
|
||||
|
|
@ -430,7 +474,7 @@ export default {
|
|||
status: 0,
|
||||
approveStatus: 0,
|
||||
approveNode: null,
|
||||
confirmStatus: 0,
|
||||
confirmStatus: null,
|
||||
omsPurchaseOrderItemList: [
|
||||
{
|
||||
productType: null,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,386 @@
|
|||
<template>
|
||||
<div style="overflow-y: auto; padding: 20px;">
|
||||
<div style="display: flex;align-items: center;justify-content: space-between;">
|
||||
<span id="projectNameBox" style="margin-left: 10px;color: black;font-size: 30px">
|
||||
采购订单
|
||||
</span>
|
||||
<el-button type="primary" v-show="showHistory" plain icon="el-icon-time" size="mini" @click="handleViewHistory">历史记录</el-button>
|
||||
</div>
|
||||
|
||||
<el-form ref="form" :model="form" label-width="180px">
|
||||
<el-divider content-position="left">基础信息</el-divider>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="采购方名称" prop="buyerName">
|
||||
<span>{{ form.buyerName }}</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="公司地址" prop="buyerAddress">
|
||||
<span>{{ form.buyerAddress }}</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-divider content-position="left">制造商信息</el-divider>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="制造商" prop="vendorId">
|
||||
<span>{{ selectedVendor.vendorName }}</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row v-if="selectedVendor.vendorId">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="制造商地址">
|
||||
<span>{{ selectedVendor.vendorAddress }}</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="联系人">
|
||||
<span>{{ selectedVendor.vendorUser }}</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="联系电话">
|
||||
<span>{{ selectedVendor.vendorPhone }}</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="联系邮箱">
|
||||
<span>{{ selectedVendor.vendorEmail }}</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-divider content-position="left">订单信息</el-divider>
|
||||
<el-row>
|
||||
<el-col :span="12" v-show="form.purchaseNo">
|
||||
<el-form-item label="采购编号" prop="purchaseNo">
|
||||
<span>{{ form.purchaseNo }}</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" v-show="form.createTime">
|
||||
<el-form-item label="发起日期" prop="createTime">
|
||||
<span>{{ parseTime(form.createTime, '{y}-{m}-{d}') }}</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="币别" prop="currency">
|
||||
<span>人民币(RMB)</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="采购员" prop="purchaserId">
|
||||
<span>{{ form.purchaserName }}</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="联系电话" prop="purchaserMobile">
|
||||
<span>{{ form.purchaserMobile }}</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="联系邮箱" prop="purchaserEmail">
|
||||
<span>{{ form.purchaserEmail }}</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="入库仓" prop="warehouseId">
|
||||
<span>{{ selectedVendor.warehouseName }}</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="付款方式" prop="payMethod">
|
||||
<span>{{ selectedVendor.payType === '1' ? '出库付款' : '入库付款' }}</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="汇智负责人" prop="ownerId">
|
||||
<span>{{ form.ownerName }}</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<span>{{ form.remark }}</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-divider content-position="left">采购列表</el-divider>
|
||||
<el-table :data="form.omsPurchaseOrderItemList" style="width: 100%">
|
||||
<el-table-column type="index" label="序号" width="50"></el-table-column>
|
||||
<el-table-column label="产品类型">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ selectDictLabel(productTypeOptions, scope.row.productType) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="产品编码" prop="productCode">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.productCode }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="产品型号">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.productModel }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="产品描述" show-overflow-tooltip>
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.productDescription }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="数量">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.quantity }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="单位">
|
||||
<span>台</span>
|
||||
</el-table-column>
|
||||
<el-table-column label="单价">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.price }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="含税小计" prop="amountTotal"></el-table-column>
|
||||
<el-table-column label="交货日期">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.deliveryDate, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="summary-footer" style="margin-top: 20px; text-align: right;">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="22" style="font-weight: bold;">不含税总计金额:</el-col>
|
||||
<el-col :span="2">{{ totalAmountWithoutTax.toFixed(2) }}</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="22" style="font-weight: bold;">税额合计:</el-col>
|
||||
<el-col :span="2">{{ totalTaxAmount.toFixed(2) }}</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="22" style="font-weight: bold;">含税总计金额:</el-col>
|
||||
<el-col :span="2">{{ totalAmountWithTax.toFixed(2) }}</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="22" style="font-weight: bold;">供应商:</el-col>
|
||||
<el-col :span="2">{{ selectedVendor.vendorName }}</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
<div style="margin-top: 40px;">
|
||||
<el-row>
|
||||
<el-col :span="24" style="font-weight: bold; margin-bottom: 10px;">注意事项:</el-col>
|
||||
<el-col :span="24">1. 供应商应当按照采购方要求开具全额增值税,增值税发票备注栏内应当注明采购方对应的采购单号和紫光汇智OMS平台送货单号。</el-col>
|
||||
<el-col :span="24">2. 紫光汇智OMS送货单为供应商送货凭证,应当准确无误地确认采购方的采购单号、请购单号码、规格、数量。</el-col>
|
||||
<el-col :span="24">3. 供应商应当对每一款产品妥善包装,并在外包装上标明该产品的料号、名称及相应的数量。</el-col>
|
||||
<el-col :span="24">4. 供应商应当严格按质按量按时交货, 若因供应商产品的质量、数量、交货时间等非不可抗力原因延迟交货,采购方有权追究责任。</el-col>
|
||||
<el-col :span="24">5. 凡是经采购方检验不合格的产品,供应商应当在2日内补回,如未能及时补回给采购方造成损失,采购方有权向供应商要求索赔。如有特殊情况,应及时和采购员沟通,并在协商日期内补回。</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</el-form>
|
||||
|
||||
<!-- 历史记录弹窗 -->
|
||||
<el-dialog title="历史记录" :visible.sync="showHistoryDialog" width="80%" append-to-body>
|
||||
<el-table :data="historyList" style="width: 100%">
|
||||
|
||||
<el-table-column label="采购编号" align="center" prop="purchaseNo" width="180"></el-table-column>
|
||||
<el-table-column label="采购方名称" align="center" prop="buyerName" width="120"></el-table-column>
|
||||
<el-table-column label="版本号" align="center" prop="version" width="80"></el-table-column>
|
||||
<el-table-column label="制造商名称" align="center" prop="vendorName" width="120"></el-table-column>
|
||||
<el-table-column label="联系人" align="center" prop="vendorUser" width="120"></el-table-column>
|
||||
<el-table-column label="联系电话" align="center" prop="vendorPhone" width="120"></el-table-column>
|
||||
<el-table-column label="含税总计金额" align="center" prop="totalAmount" width="120"></el-table-column>
|
||||
<el-table-column label="发起日期" align="center" prop="createTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="发起日期" align="center" prop="approveTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.approveTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="审批状态" align="center" prop="approveStatus" width="100">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.approve_status" :value="scope.row.approveStatus"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-view"
|
||||
@click="handleViewHistoryDetail(scope.row)"
|
||||
>查看详情
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {getPurchaseorder, getPurchaseOrderHistory} from "@/api/sip/purchaseorder";
|
||||
import {listAllVendor} from "@/api/base/vendor";
|
||||
import {getDicts} from "@/api/system/dict/data";
|
||||
import {preciseCurrencyRound} from "@/utils/ruoyi";
|
||||
|
||||
|
||||
export default {
|
||||
name: "PurchaseOrderDetailView",
|
||||
dicts: ['approve_status'],
|
||||
props: {
|
||||
orderData: {
|
||||
type: Object,
|
||||
default: null
|
||||
},
|
||||
showHistory: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
productTypeOptions: [],
|
||||
vendorOptions: [],
|
||||
selectedVendor: {},
|
||||
form: {
|
||||
id: null,
|
||||
purchaseNo: null,
|
||||
buyerName: '紫光汇智信息技术有限公司',
|
||||
buyerAddress: '重庆市南岸区广福大道12号行政中心B区3号楼14-17',
|
||||
vendorId: null,
|
||||
currency: 'RMB',
|
||||
purchaserId: null,
|
||||
purchaserName: null,
|
||||
purchaserMobile: null,
|
||||
purchaserEmail: null,
|
||||
warehouseId: null,
|
||||
payMethod: null,
|
||||
ownerId: null,
|
||||
ownerName: null,
|
||||
remark: null,
|
||||
totalAmount: null,
|
||||
status: 0,
|
||||
approveStatus: 0,
|
||||
approveNode: null,
|
||||
confirmStatus: 0,
|
||||
omsPurchaseOrderItemList: []
|
||||
},
|
||||
historyList: [],
|
||||
showHistoryDialog: false,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
totalAmountWithTax() {
|
||||
const total = this.form.omsPurchaseOrderItemList?.reduce((acc, cur) => acc + (cur.amountTotal || 0), 0);
|
||||
return preciseCurrencyRound(total) || 0;
|
||||
},
|
||||
totalAmountWithoutTax() {
|
||||
const total = this.form.omsPurchaseOrderItemList?.reduce((acc, cur) => {
|
||||
const amount = cur.quantity * cur.price || 0;
|
||||
const taxRate = cur.taxRate || 0;
|
||||
return acc + (amount / (1 + taxRate));
|
||||
}, 0);
|
||||
return (preciseCurrencyRound(total)) || 0;
|
||||
},
|
||||
totalTaxAmount() {
|
||||
return (preciseCurrencyRound((this.totalAmountWithTax - this.totalAmountWithoutTax))) || 0;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
orderData: {
|
||||
handler(newVal) {
|
||||
if (newVal) {
|
||||
this.form = JSON.parse(JSON.stringify(newVal));
|
||||
// 等待 vendorOptions 加载完成后再处理制造商
|
||||
this.$nextTick(() => {
|
||||
this.handleVendorChange(this.form.vendorId);
|
||||
});
|
||||
}
|
||||
},
|
||||
immediate: false,
|
||||
deep: false
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getVendorList().then(() => {
|
||||
getDicts("product_type").then(response => {
|
||||
this.productTypeOptions = response.data;
|
||||
});
|
||||
// 如果已经有 orderData 则立即处理
|
||||
if (this.orderData) {
|
||||
this.form = JSON.parse(JSON.stringify(this.orderData));
|
||||
this.handleVendorChange(this.form.vendorId);
|
||||
}
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
loadPurchaseOrder(id) {
|
||||
// 此方法保留用于兼容性,实际数据通过 prop 传递
|
||||
if (!this.orderData && id) {
|
||||
getPurchaseorder(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.handleVendorChange(this.form.vendorId);
|
||||
});
|
||||
}
|
||||
},
|
||||
getVendorList() {
|
||||
return listAllVendor().then(res => {
|
||||
this.vendorOptions = res.data;
|
||||
})
|
||||
},
|
||||
handleVendorChange(vendorId) {
|
||||
if (vendorId) {
|
||||
this.selectedVendor = this.vendorOptions.find(item => item.vendorId === vendorId) || {};
|
||||
} else {
|
||||
this.selectedVendor = {};
|
||||
}
|
||||
},
|
||||
resetForm() {
|
||||
this.form = {
|
||||
id: null,
|
||||
purchaseNo: null,
|
||||
buyerName: '紫光汇智信息技术有限公司',
|
||||
buyerAddress: '重庆市南岸区广福大道12号行政中心B区3号楼14-17',
|
||||
vendorId: null,
|
||||
currency: 'RMB',
|
||||
purchaserId: null,
|
||||
purchaserName: null,
|
||||
purchaserMobile: null,
|
||||
purchaserEmail: null,
|
||||
warehouseId: null,
|
||||
payMethod: null,
|
||||
ownerId: null,
|
||||
ownerName: null,
|
||||
remark: null,
|
||||
totalAmount: null,
|
||||
status: 0,
|
||||
approveStatus: 0,
|
||||
approveNode: null,
|
||||
confirmStatus: 0,
|
||||
omsPurchaseOrderItemList: []
|
||||
};
|
||||
this.selectedVendor = {};
|
||||
},
|
||||
handleViewHistory() {
|
||||
if (this.form.id) {
|
||||
getPurchaseOrderHistory(this.form.id).then(response => {
|
||||
this.historyList = response.data;
|
||||
this.showHistoryDialog = true;
|
||||
});
|
||||
} else {
|
||||
this.$modal.msgWarning("请先加载订单详情");
|
||||
}
|
||||
},
|
||||
handleViewHistoryDetail(row) {
|
||||
this.$emit('view-history-detail', row);
|
||||
this.showHistoryDialog = false; // 关闭历史记录弹窗
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
|
|
@ -121,7 +121,7 @@
|
|||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="200">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
v-if="scope.row.approveStatus === 0 || scope.row.approveStatus === 3"
|
||||
v-if="scope.row.approveStatus === '0' || scope.row.approveStatus === '3'"
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
|
|
@ -130,7 +130,7 @@
|
|||
>修改
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="scope.row.approveStatus === 0 || scope.row.approveStatus === 3"
|
||||
v-if="scope.row.approveStatus === '0' || scope.row.approveStatus === '3'"
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-s-promotion"
|
||||
|
|
@ -139,7 +139,7 @@
|
|||
>申请采购
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="scope.row.approveStatus === 0 || scope.row.approveStatus === 3"
|
||||
v-if="scope.row.approveStatus === '0' || scope.row.approveStatus === '3'"
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
|
|
@ -148,7 +148,7 @@
|
|||
>删除
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="scope.row.approveStatus === 1 || scope.row.approveStatus === 3"
|
||||
v-if="scope.row.approveStatus === '1' || scope.row.approveStatus === '2'"
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-view"
|
||||
|
|
@ -156,6 +156,25 @@
|
|||
v-hasPermi="['sip:purchaseorder:query']"
|
||||
>查看详情
|
||||
</el-button>
|
||||
<!-- 发起供应商确认按钮 -->
|
||||
<el-button
|
||||
v-if="scope.row.flowType === 'online' && scope.row.approveStatus==='2' && (!scope.row.confirmStatus || scope.row.confirmStatus === ''|| scope.row.confirmStatus === '2')"
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-s-promotion"
|
||||
@click="handleInitiateVendorConfirmation(scope.row)"
|
||||
v-hasPermi="['sip:purchaseorder:edit']"
|
||||
>发起供应商确认
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="scope.row.approveStatus === '2' && (!scope.row.confirmStatus || scope.row.confirmStatus === '')"
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-refresh-left"
|
||||
@click="handleRecall(scope.row)"
|
||||
v-hasPermi="['sip:purchaseorder:recall']"
|
||||
>撤回
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
|
@ -169,8 +188,9 @@
|
|||
/>
|
||||
|
||||
<!-- 添加或修改采购单主表对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="80vw" append-to-body>
|
||||
<purchase-order-detail ref="purchaseOrderDetail" @close="open = false"
|
||||
<el-dialog :title="title" :visible.sync="open" width="80vw" append-to-body >
|
||||
<purchase-order-detail ref="purchaseOrderDetail" :order-data="currentOrderData"
|
||||
@close="open = false"
|
||||
@success="getList">
|
||||
|
||||
</purchase-order-detail>
|
||||
|
|
@ -180,20 +200,59 @@
|
|||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 流程类型选择对话框 -->
|
||||
<el-dialog
|
||||
title="选择流程类型"
|
||||
:visible.sync="openFlowTypeDialog"
|
||||
width="30%"
|
||||
append-to-body
|
||||
>
|
||||
<el-form :model="{ flowType: selectedFlowType }" ref="flowTypeForm" label-width="80px">
|
||||
<el-form-item label="流程类型" prop="flowType"
|
||||
:rules="[{ required: true, message: '请选择流程类型', trigger: 'change' }]">
|
||||
<el-select v-model="selectedFlowType" placeholder="请选择流程类型" style="width:100%">
|
||||
<el-option label="线上" value="online"></el-option>
|
||||
<el-option label="线下" value="offline"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitApplyWithFlowType">确 定</el-button>
|
||||
<el-button @click="openFlowTypeDialog = false">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 订单详情抽屉 -->
|
||||
<el-drawer
|
||||
title="订单详情"
|
||||
:visible.sync="showDetailDrawer"
|
||||
direction="rtl"
|
||||
size="80%"
|
||||
append-to-body
|
||||
>
|
||||
<ApproveLayout title="紫光汇智信息技术有限公司" >
|
||||
<purchase-order-detail-view ref="detailViewOnly" @close="showDetailDrawer = false"
|
||||
@success="getList">
|
||||
<ApproveLayout title="采购单详情" v-if="showDetailDrawer">
|
||||
<purchase-order-detail-view ref="detailViewOnly" :order-data="detailOrderData" @close="showDetailDrawer = false"
|
||||
@success="getList" :showHistory="true"
|
||||
@view-history-detail="handleViewHistoryDetailEvent">
|
||||
</purchase-order-detail-view>
|
||||
<template #footer>
|
||||
<span>{{ currentDetailPurchaseNo }}</span>
|
||||
<span>订单编号: {{ currentDetailPurchaseNo }}</span>
|
||||
</template>
|
||||
</ApproveLayout>
|
||||
</el-drawer>
|
||||
|
||||
<!-- 历史订单详情抽屉 -->
|
||||
<el-drawer
|
||||
title="历史订单详情"
|
||||
:visible.sync="showHistoryDetailDrawer"
|
||||
direction="rtl"
|
||||
size="80%"
|
||||
>
|
||||
<ApproveLayout title="采购单历史详情" v-if="showHistoryDetailDrawer">
|
||||
<purchase-order-detail-view ref="historyDetailView" :order-data="historyDetailOrderData" @close="showHistoryDetailDrawer = false">
|
||||
</purchase-order-detail-view>
|
||||
<template #footer>
|
||||
<span>订单编号: {{ historyDetailOrderData ? historyDetailOrderData.purchaseNo : '' }}</span>
|
||||
<span v-if="historyDetailOrderData"> | 版本号: {{ historyDetailOrderData.version }}</span>
|
||||
</template>
|
||||
</ApproveLayout>
|
||||
</el-drawer>
|
||||
|
|
@ -207,7 +266,11 @@ import {
|
|||
delPurchaseorder,
|
||||
addPurchaseorder,
|
||||
updatePurchaseorder,
|
||||
applyPurchaseorder
|
||||
applyPurchaseorder,
|
||||
getPurchaseOrderHistory,
|
||||
getPurchaseOrderHistoryDetail,
|
||||
recallPurchaseorder,
|
||||
vendorConfirmStatus // 导入发起供应商确认接口
|
||||
} from "@/api/sip/purchaseorder";
|
||||
import PurchaseOrderDetail from './components/PurchaseOrderDetail';
|
||||
import ApproveLayout from "@/views/approve/ApproveLayout.vue";
|
||||
|
|
@ -236,6 +299,11 @@ export default {
|
|||
// 总条数
|
||||
total: 0,
|
||||
currentOrderId: null,
|
||||
// 当前订单数据
|
||||
currentOrderData: null,
|
||||
openFlowTypeDialog: false, // 控制流程类型选择对话框的显示
|
||||
currentApplyingOrder: null, // 当前正在申请采购的订单数据
|
||||
selectedFlowType: null, // 选定的流程类型
|
||||
// 采购单主表表格数据
|
||||
purchaseorderList: [],
|
||||
// 弹出层标题
|
||||
|
|
@ -244,10 +312,14 @@ export default {
|
|||
open: false,
|
||||
// 是否显示详情抽屉
|
||||
showDetailDrawer: false,
|
||||
// 详情订单ID
|
||||
detailOrderId: null,
|
||||
// 详情订单数据
|
||||
detailOrderData: null,
|
||||
// 当前详情订单编号
|
||||
currentDetailPurchaseNo: null,
|
||||
// 是否显示历史详情抽屉
|
||||
showHistoryDetailDrawer: false,
|
||||
// 历史详情订单数据
|
||||
historyDetailOrderData: null,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
|
|
@ -267,30 +339,32 @@ export default {
|
|||
};
|
||||
},
|
||||
created() {
|
||||
console.log(this.$route.query)
|
||||
this.getList();
|
||||
},
|
||||
watch:{
|
||||
// 监听currentOrderId变化
|
||||
// 监听对话框打开
|
||||
open(val) {
|
||||
if (val) {
|
||||
this.$nextTick(()=>{
|
||||
this.$refs.purchaseOrderDetail?.loadPurchaseOrder(this.currentOrderId)
|
||||
})
|
||||
}else{
|
||||
this.currentOrderId=null
|
||||
this.$refs.purchaseOrderDetail?.resetForm()
|
||||
if (!val) {
|
||||
this.currentOrderId = null;
|
||||
this.currentOrderData = null;
|
||||
this.$refs.purchaseOrderDetail?.resetForm();
|
||||
}
|
||||
},
|
||||
// 监听详情抽屉变化
|
||||
showDetailDrawer(val) {
|
||||
if (val) {
|
||||
this.$nextTick(()=>{
|
||||
this.$refs.detailViewOnly?.loadPurchaseOrder(this.detailOrderId)
|
||||
})
|
||||
} else {
|
||||
this.detailOrderId = null;
|
||||
if (!val) {
|
||||
this.detailOrderData = null;
|
||||
this.currentDetailPurchaseNo = null;
|
||||
this.$refs.detailViewOnly?.resetForm();
|
||||
}
|
||||
},
|
||||
// 监听历史详情抽屉变化
|
||||
showHistoryDetailDrawer(val) {
|
||||
if (!val) {
|
||||
this.historyDetailOrderData = null;
|
||||
this.$refs.historyDetailView?.resetForm();
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
|
@ -327,17 +401,19 @@ export default {
|
|||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
|
||||
this.currentOrderData = null;
|
||||
this.currentOrderId = null;
|
||||
this.open = true;
|
||||
this.title = "添加采购单主表";
|
||||
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.currentOrderId = row.id;
|
||||
this.open = true;
|
||||
this.title = "修改采购单主表";
|
||||
|
||||
getPurchaseorder(row.id).then(response => {
|
||||
this.currentOrderData = response.data;
|
||||
this.currentOrderId = row.id;
|
||||
this.open = true;
|
||||
this.title = "修改采购单主表";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
|
|
@ -356,21 +432,72 @@ export default {
|
|||
},
|
||||
/** 申请采购按钮操作 */
|
||||
handleApply(row) {
|
||||
this.$modal.confirm('是否确认申请采购编号为"' + row.purchaseNo + '"的数据项?').then(() => {
|
||||
let form = {...row};
|
||||
form.approveStatus = 1; // 设置审批状态为 1 (审批中)
|
||||
return applyPurchaseorder(form);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("申请采购成功");
|
||||
}).catch(() => {
|
||||
});
|
||||
this.currentApplyingOrder = row; // 保存当前订单数据
|
||||
this.selectedFlowType = null; // 重置选定的流程类型
|
||||
this.openFlowTypeDialog = true; // 打开流程类型选择对话框
|
||||
},
|
||||
/** 查看详情按钮操作 */
|
||||
handleViewDetails(row) {
|
||||
this.detailOrderId = row.id;
|
||||
this.currentDetailPurchaseNo = row.purchaseNo;
|
||||
this.showDetailDrawer = true;
|
||||
getPurchaseorder(row.id).then(response => {
|
||||
this.detailOrderData = response.data;
|
||||
this.currentDetailPurchaseNo = row.purchaseNo;
|
||||
this.showDetailDrawer = true;
|
||||
});
|
||||
},
|
||||
/** 处理查看历史详情事件 */
|
||||
handleViewHistoryDetailEvent(row) {
|
||||
getPurchaseOrderHistoryDetail(row.id).then(response => {
|
||||
this.historyDetailOrderData = response.data;
|
||||
this.showHistoryDetailDrawer = true;
|
||||
this.showDetailDrawer = false; // 关闭当前详情抽屉
|
||||
});
|
||||
},
|
||||
/** 提交申请采购(带流程类型) */
|
||||
submitApplyWithFlowType() {
|
||||
this.$refs.flowTypeForm.validate(valid => {
|
||||
if (valid) {
|
||||
let form = {...this.currentApplyingOrder};
|
||||
form.approveStatus = '1'; // 设置审批状态为 1 (审批中)
|
||||
form.flowType = this.selectedFlowType; // 添加流程类型
|
||||
applyPurchaseorder(form).then(() => {
|
||||
this.openFlowTypeDialog = false; // 关闭对话框
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("申请采购成功");
|
||||
}).catch(() => {
|
||||
this.openFlowTypeDialog = false; // 关闭对话框
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 撤回按钮操作 */
|
||||
handleRecall(row) {
|
||||
this.$modal.confirm('是否确认撤回采购订单编号为"' + row.purchaseNo + '"的数据项?').then(() => {
|
||||
recallPurchaseorder(row.id).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("撤回成功");
|
||||
});
|
||||
this.getList(); // 刷新列表以反映状态变化
|
||||
}).catch(() => {
|
||||
});
|
||||
},
|
||||
/** 发起供应商确认操作 */
|
||||
handleInitiateVendorConfirmation(row) {
|
||||
this.$modal.confirm('是否确认发起供应商确认编号为"' + row.purchaseNo + '"的数据项?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
// 调用后端发起供应商确认接口
|
||||
let data = {
|
||||
id: row.id,
|
||||
confirmStatus: '0' // 设置确认状态为 1 (待确认)
|
||||
};
|
||||
vendorConfirmStatus(data).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("发起供应商确认成功");
|
||||
});
|
||||
}).catch(() => {
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -0,0 +1,472 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="120px">
|
||||
<el-form-item label="采购单号" prop="purchaseNo">
|
||||
<el-input
|
||||
v-model="queryParams.purchaseNo"
|
||||
placeholder="请输入采购单号"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="采购方名称" prop="buyerName">
|
||||
<el-input
|
||||
v-model="queryParams.buyerName"
|
||||
placeholder="请输入采购方名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="制造商名称" prop="vendorName">
|
||||
<el-input
|
||||
v-model="queryParams.vendorName"
|
||||
placeholder="请输入制造商名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="汇智负责人" prop="ownerName">
|
||||
<el-input
|
||||
v-model="queryParams.ownerName"
|
||||
placeholder="请输入汇智负责人"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="供应商确认状态" prop="confirmStatus">
|
||||
<el-select v-model="queryParams.confirmStatus" placeholder="请选择供应商确认状态" clearable>
|
||||
<el-option
|
||||
v-for="dict in dict.type.vendor_confirm_status"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<!-- <el-row :gutter="10" class="mb8">-->
|
||||
<!-- <el-col :span="1.5">-->
|
||||
<!-- <el-button-->
|
||||
<!-- type="primary"-->
|
||||
<!-- plain-->
|
||||
<!-- icon="el-icon-plus"-->
|
||||
<!-- size="mini"-->
|
||||
<!-- @click="handleAdd"-->
|
||||
<!-- v-hasPermi="['sip:purchaseorder:add']"-->
|
||||
<!-- >新增-->
|
||||
<!-- </el-button>-->
|
||||
<!-- </el-col>-->
|
||||
<!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>-->
|
||||
<!-- </el-row>-->
|
||||
|
||||
<el-table v-loading="loading" :data="purchaseorderList" @selection-change="handleSelectionChange">
|
||||
<!-- <el-table-column type="selection" width="55" align="center" />-->
|
||||
<el-table-column label="采购编号" align="center" prop="purchaseNo" width="180"/>
|
||||
<el-table-column label="采购方名称" align="center" prop="buyerName" />
|
||||
<el-table-column label="制造商名称" align="center" prop="vendorName" width="120"/>
|
||||
<el-table-column label="联系人" align="center" prop="vendorUser" width="100"/>
|
||||
<el-table-column label="联系电话" align="center" prop="vendorPhone" width="120"/>
|
||||
<el-table-column label="含税总计金额" align="center" prop="totalAmount" width="120"/>
|
||||
<el-table-column label="发起日期" align="center" prop="createTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="汇智负责人" align="center" prop="ownerName" width="120"/>
|
||||
|
||||
<el-table-column label="供应商确认状态" align="center" prop="confirmStatus" width="120">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.vendor_confirm_status" :value="scope.row.confirmStatus"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="200">
|
||||
<template slot-scope="scope">
|
||||
|
||||
<el-button
|
||||
v-if="scope.row.approveStatus === '1' || scope.row.approveStatus === '2'"
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-view"
|
||||
@click="handleViewDetails(scope.row)"
|
||||
v-hasPermi="['sip:purchaseorder:query']"
|
||||
>查看详情
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改采购单主表对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="80vw" append-to-body>
|
||||
<purchase-order-detail ref="purchaseOrderDetail" :order-data="currentOrderData"
|
||||
@close="open = false"
|
||||
@success="getList">
|
||||
|
||||
</purchase-order-detail>
|
||||
<template slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 流程类型选择对话框 -->
|
||||
<el-dialog
|
||||
title="选择流程类型"
|
||||
:visible.sync="openFlowTypeDialog"
|
||||
width="30%"
|
||||
append-to-body
|
||||
>
|
||||
<el-form :model="{ flowType: selectedFlowType }" ref="flowTypeForm" label-width="80px">
|
||||
<el-form-item label="流程类型" prop="flowType"
|
||||
:rules="[{ required: true, message: '请选择流程类型', trigger: 'change' }]">
|
||||
<el-select v-model="selectedFlowType" placeholder="请选择流程类型" style="width:100%">
|
||||
<el-option label="线上" value="online"></el-option>
|
||||
<el-option label="线下" value="offline"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitApplyWithFlowType">确 定</el-button>
|
||||
<el-button @click="openFlowTypeDialog = false">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 订单详情 -->
|
||||
|
||||
<template v-if="detailOrderData">
|
||||
|
||||
<el-dialog
|
||||
v-if="detailOrderData.confirmStatus === '0' "
|
||||
:visible.sync="showDetailDrawer"
|
||||
@close="showDetailDrawer=false"
|
||||
width="80vw"
|
||||
>
|
||||
<ApproveLayout title="采购单详情" style="max-height: 70vh;overflow-y: auto">
|
||||
<purchase-order-detail-view ref="dialogViewOnly" :order-data="detailOrderData"
|
||||
@close="showDetailDrawer = false"
|
||||
@success="getList" :showHistory="true"
|
||||
@view-history-detail="handleViewHistoryDetailEvent">
|
||||
</purchase-order-detail-view>
|
||||
<template #footer>
|
||||
<span> {{ currentDetailPurchaseNo }}</span>
|
||||
</template>
|
||||
</ApproveLayout>
|
||||
<template #footer class="dialog-footer">
|
||||
<el-button type="primary" @click="vendorConfirm('1')">确 认</el-button>
|
||||
<el-button type="danger" @click="vendorConfirm('2')">驳 回</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<el-drawer
|
||||
v-else
|
||||
:visible.sync="showDetailDrawer"
|
||||
@close="showDetailDrawer=false"
|
||||
size="80vw"
|
||||
>
|
||||
<ApproveLayout title="采购单详情">
|
||||
<purchase-order-detail-view ref="detailViewOnly" :order-data="detailOrderData"
|
||||
@close="showDetailDrawer = false"
|
||||
@success="getList" :showHistory="true"
|
||||
@view-history-detail="handleViewHistoryDetailEvent">
|
||||
</purchase-order-detail-view>
|
||||
<template #footer>
|
||||
<span>订单编号: {{ currentDetailPurchaseNo }}</span>
|
||||
</template>
|
||||
</ApproveLayout>
|
||||
</el-drawer>
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<!-- 历史订单详情抽屉 -->
|
||||
<el-drawer
|
||||
title="历史订单详情"
|
||||
:visible.sync="showHistoryDetailDrawer"
|
||||
direction="rtl"
|
||||
size="80%"
|
||||
>
|
||||
<ApproveLayout title="采购单历史详情" v-if="showHistoryDetailDrawer">
|
||||
<purchase-order-detail-view ref="historyDetailView" :order-data="historyDetailOrderData"
|
||||
@close="showHistoryDetailDrawer = false">
|
||||
</purchase-order-detail-view>
|
||||
<template #footer>
|
||||
<span>订单编号: {{ historyDetailOrderData ? historyDetailOrderData.purchaseNo : '' }}</span>
|
||||
<span v-if="historyDetailOrderData"> | 版本号: {{ historyDetailOrderData.version }}</span>
|
||||
</template>
|
||||
</ApproveLayout>
|
||||
</el-drawer>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
applyPurchaseorder,
|
||||
delPurchaseorder,
|
||||
getPurchaseorder,
|
||||
getPurchaseOrderHistoryDetail,
|
||||
listVendorPurchaseorder,
|
||||
recallPurchaseorder,
|
||||
vendorConfirmStatus
|
||||
} from "@/api/sip/purchaseorder";
|
||||
import PurchaseOrderDetail from './components/PurchaseOrderDetail';
|
||||
import ApproveLayout from "@/views/approve/ApproveLayout.vue";
|
||||
import PurchaseOrderDetailView from "@/views/purchaseorder/components/PurchaseOrderDetailView.vue";
|
||||
|
||||
|
||||
export default {
|
||||
name: "Purchaseorder",
|
||||
dicts: ['approve_status', 'vendor_confirm_status', 'purchase_status'],
|
||||
components: {
|
||||
PurchaseOrderDetail,
|
||||
ApproveLayout,
|
||||
PurchaseOrderDetailView
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
currentOrderId: null,
|
||||
// 当前订单数据
|
||||
currentOrderData: null,
|
||||
openFlowTypeDialog: false, // 控制流程类型选择对话框的显示
|
||||
currentApplyingOrder: null, // 当前正在申请采购的订单数据
|
||||
selectedFlowType: null, // 选定的流程类型
|
||||
// 采购单主表表格数据
|
||||
purchaseorderList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 是否显示详情抽屉
|
||||
showDetailDrawer: false,
|
||||
// 详情订单数据
|
||||
detailOrderData: null,
|
||||
// 当前详情订单编号
|
||||
currentDetailPurchaseNo: null,
|
||||
// 是否显示历史详情抽屉
|
||||
showHistoryDetailDrawer: false,
|
||||
// 历史详情订单数据
|
||||
historyDetailOrderData: null,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
purchaseNo: null,
|
||||
buyerName: null,
|
||||
vendorName: null,
|
||||
ownerName: null,
|
||||
approveStatus: null,
|
||||
confirmStatus: '0',
|
||||
status: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
console.log(this.$route.query)
|
||||
this.getList();
|
||||
},
|
||||
watch: {
|
||||
// 监听对话框打开
|
||||
open(val) {
|
||||
if (!val) {
|
||||
this.currentOrderId = null;
|
||||
this.currentOrderData = null;
|
||||
this.$refs.purchaseOrderDetail?.resetForm();
|
||||
}
|
||||
},
|
||||
// 监听详情抽屉变化
|
||||
showDetailDrawer(val) {
|
||||
if (!val) {
|
||||
this.detailOrderData = null;
|
||||
this.currentDetailPurchaseNo = null;
|
||||
this.$refs.detailViewOnly?.resetForm();
|
||||
this.$refs.dialogViewOnly?.resetForm();
|
||||
}
|
||||
},
|
||||
// 监听历史详情抽屉变化
|
||||
showHistoryDetailDrawer(val) {
|
||||
if (!val) {
|
||||
this.historyDetailOrderData = null;
|
||||
this.$refs.historyDetailView?.resetForm();
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
/** 查询采购单主表列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listVendorPurchaseorder(this.queryParams).then(response => {
|
||||
this.purchaseorderList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
|
||||
},
|
||||
vendorConfirm(type) {
|
||||
// 调用后端发起供应商确认接口
|
||||
let data = {
|
||||
id: this.detailOrderData.id,
|
||||
confirmStatus: type // 设置确认状态为 1 (待确认)
|
||||
};
|
||||
vendorConfirmStatus(data).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("操作成功");
|
||||
});
|
||||
},
|
||||
// 表单重置
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.id)
|
||||
this.single = selection.length !== 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.currentOrderData = null;
|
||||
this.currentOrderId = null;
|
||||
this.open = true;
|
||||
this.title = "添加采购单主表";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
getPurchaseorder(row.id).then(response => {
|
||||
this.currentOrderData = response.data;
|
||||
this.currentOrderId = row.id;
|
||||
this.open = true;
|
||||
this.title = "修改采购单主表";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs.purchaseOrderDetail.submitForm()
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$modal.confirm('是否确认删除采购单主表编号为"' + ids + '"的数据项?').then(function () {
|
||||
return delPurchaseorder(ids);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {
|
||||
});
|
||||
},
|
||||
/** 申请采购按钮操作 */
|
||||
handleApply(row) {
|
||||
this.currentApplyingOrder = row; // 保存当前订单数据
|
||||
this.selectedFlowType = null; // 重置选定的流程类型
|
||||
this.openFlowTypeDialog = true; // 打开流程类型选择对话框
|
||||
},
|
||||
/** 查看详情按钮操作 */
|
||||
handleViewDetails(row) {
|
||||
getPurchaseorder(row.id).then(response => {
|
||||
this.detailOrderData = response.data;
|
||||
console.log(this.detailOrderData)
|
||||
this.currentDetailPurchaseNo = row.purchaseNo;
|
||||
console.log('1111')
|
||||
this.$nextTick(() => {
|
||||
console.log(2222)
|
||||
this.showDetailDrawer = true;
|
||||
});
|
||||
});
|
||||
},
|
||||
/** 处理查看历史详情事件 */
|
||||
handleViewHistoryDetailEvent(row) {
|
||||
getPurchaseOrderHistoryDetail(row.id).then(response => {
|
||||
this.historyDetailOrderData = response.data;
|
||||
this.showHistoryDetailDrawer = true;
|
||||
this.showDetailDrawer = false; // 关闭当前详情抽屉
|
||||
});
|
||||
},
|
||||
/** 提交申请采购(带流程类型) */
|
||||
submitApplyWithFlowType() {
|
||||
this.$refs.flowTypeForm.validate(valid => {
|
||||
if (valid) {
|
||||
let form = {...this.currentApplyingOrder};
|
||||
form.approveStatus = '1'; // 设置审批状态为 1 (审批中)
|
||||
form.flowType = this.selectedFlowType; // 添加流程类型
|
||||
applyPurchaseorder(form).then(() => {
|
||||
this.openFlowTypeDialog = false; // 关闭对话框
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("申请采购成功");
|
||||
}).catch(() => {
|
||||
this.openFlowTypeDialog = false; // 关闭对话框
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 撤回按钮操作 */
|
||||
handleRecall(row) {
|
||||
this.$modal.confirm('是否确认撤回采购订单编号为"' + row.purchaseNo + '"的数据项?').then(() => {
|
||||
recallPurchaseorder(row.id).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("撤回成功");
|
||||
});
|
||||
this.getList(); // 刷新列表以反映状态变化
|
||||
}).catch(() => {
|
||||
});
|
||||
},
|
||||
/** 发起供应商确认操作 */
|
||||
handleInitiateVendorConfirmation(row) {
|
||||
this.$modal.confirm('是否确认发起供应商确认编号为"' + row.purchaseNo + '"的数据项?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
// 调用后端发起供应商确认接口
|
||||
let data = {
|
||||
id: row.id,
|
||||
confirmStatus: '0' // 设置确认状态为 1 (待确认)
|
||||
};
|
||||
vendorConfirmStatus(data).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("发起供应商确认成功");
|
||||
});
|
||||
}).catch(() => {
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
@ -60,6 +60,10 @@ export default {
|
|||
productType: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
vendorCode: {
|
||||
type: String,
|
||||
default: '',
|
||||
}
|
||||
},
|
||||
data() {
|
||||
|
|
@ -76,7 +80,8 @@ export default {
|
|||
pageSize: 10,
|
||||
productCode: null,
|
||||
model: null,
|
||||
type: this.productType // Pass productType to query params
|
||||
type: this.productType, // Pass productType to query params
|
||||
vendorCode:null
|
||||
},
|
||||
};
|
||||
},
|
||||
|
|
@ -92,6 +97,12 @@ export default {
|
|||
if (this.visible) {
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
vendorCode(val) {
|
||||
this.queryParams.vendorCode = val;
|
||||
if (this.visible) {
|
||||
this.getList();
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ import lombok.Data;
|
|||
@Data
|
||||
public class Definition {
|
||||
/** 故障工单 */
|
||||
private String orderApprove;
|
||||
private String orderApproveOnline;
|
||||
private String orderApproveOffline;
|
||||
private String purchaseOrderApprove;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ public class Instance {
|
|||
/** 订单审批 */
|
||||
private Map<String, Object> order_approve_online;
|
||||
private Map<String, Object> order_approve_offline;
|
||||
private Map<String, Object> purchase_order_online;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,34 @@
|
|||
package com.ruoyi.common.enums;
|
||||
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author : ch
|
||||
* @version : 1.0
|
||||
* @ClassName : ApproveStatusEnum
|
||||
* @Description :
|
||||
* @DATE : Created in 16:02 2025/11/26
|
||||
* <pre> Copyright: Copyright(c) 2025 </pre>
|
||||
* <pre> Company : 紫光汇智信息技术有限公司 </pre>
|
||||
* Modification History:
|
||||
* Date Author Version Discription
|
||||
* --------------------------------------------------------------------------
|
||||
* 2025/11/26 ch 1.0 Why & What is modified: <修改原因描述> *
|
||||
*/
|
||||
@Getter
|
||||
public enum ApproveStatusEnum {
|
||||
WAIT_COMMIT("0", "待提交"),
|
||||
WAIT_APPROVE("1", "待审核"),
|
||||
APPROVE_COMPLETE("2", "审批完成"),
|
||||
APPROVE_REJECT("3", "已驳回"),
|
||||
;
|
||||
|
||||
private final String value;
|
||||
private final String code;
|
||||
|
||||
ApproveStatusEnum(String code, String value) {
|
||||
this.code = code;
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
|
|
@ -13,6 +13,7 @@ import java.util.stream.Collectors;
|
|||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.ruoyi.common.config.RuoYiConfig;
|
||||
import com.ruoyi.common.config.flow.ProcessConfig;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
|
|
@ -77,7 +78,7 @@ public class ProjectOrderInfoController extends BaseController
|
|||
@Autowired
|
||||
private IProjectOrderFileLogService fileLogService;
|
||||
@Autowired
|
||||
private TemplateEngine templateEngine;
|
||||
private ProcessConfig processConfig;
|
||||
@Autowired
|
||||
private TodoService todoService;
|
||||
@Autowired
|
||||
|
|
@ -107,6 +108,7 @@ public class ProjectOrderInfoController extends BaseController
|
|||
mmap.put("projectOrderInfo", projectOrderInfo);
|
||||
mmap.put("user", ShiroUtils.getSysUser());
|
||||
Todo todo = new Todo();
|
||||
todo.setProcessKeyList(Arrays.asList(processConfig.getDefinition().getOrderApproveOffline(), processConfig.getDefinition().getOrderApproveOnline()));
|
||||
todo.setBusinessKey(projectOrderInfo.getOrderCode());
|
||||
mmap.put("approveLog", todoService.selectTodoCompletedList(todo));
|
||||
todo.setApproveUser(ShiroUtils.getUserId().toString());
|
||||
|
|
|
|||
|
|
@ -4,15 +4,20 @@ import com.ruoyi.common.annotation.Log;
|
|||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.ApproveStatusEnum;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.sip.domain.OmsPurchaseOrder;
|
||||
import com.ruoyi.sip.flowable.domain.Todo;
|
||||
import com.ruoyi.sip.flowable.service.TodoService;
|
||||
import com.ruoyi.sip.service.IOmsPurchaseOrderHistoryService;
|
||||
import com.ruoyi.sip.service.IOmsPurchaseOrderService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -28,6 +33,11 @@ public class OmsPurchaseOrderController extends BaseController
|
|||
@Autowired
|
||||
private IOmsPurchaseOrderService omsPurchaseOrderService;
|
||||
|
||||
@Autowired
|
||||
private IOmsPurchaseOrderHistoryService omsPurchaseOrderHistoryService;
|
||||
@Autowired
|
||||
private TodoService todoService;
|
||||
|
||||
/**
|
||||
* 查询采购单主表列表
|
||||
*/
|
||||
|
|
@ -37,6 +47,46 @@ public class OmsPurchaseOrderController extends BaseController
|
|||
{
|
||||
startPage();
|
||||
List<OmsPurchaseOrder> list = omsPurchaseOrderService.selectOmsPurchaseOrderList(omsPurchaseOrder);
|
||||
clearPage();
|
||||
todoService.fillPurchaseOrderApproveNode(list);
|
||||
return getDataTable(list);
|
||||
}
|
||||
/**
|
||||
* 查询采购单主表列表
|
||||
*/
|
||||
@RequiresPermissions("sip:purchaseorder:list")
|
||||
@GetMapping("/vendor/list")
|
||||
public TableDataInfo listVendor(OmsPurchaseOrder omsPurchaseOrder)
|
||||
{
|
||||
|
||||
omsPurchaseOrder.setApproveStatus(ApproveStatusEnum.APPROVE_COMPLETE.getCode());
|
||||
omsPurchaseOrder.setFlowType(OmsPurchaseOrder.FlowTypeEnum.ONLINE.getCode());
|
||||
startPage();
|
||||
List<OmsPurchaseOrder> list = omsPurchaseOrderService.selectOmsPurchaseOrderList(omsPurchaseOrder);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询待审批采购单主表列表
|
||||
*/
|
||||
@RequiresPermissions("sip:purchaseorder:list")
|
||||
@GetMapping("/approveList")
|
||||
public TableDataInfo listApprove(OmsPurchaseOrder omsPurchaseOrder)
|
||||
{
|
||||
startPage();
|
||||
List<OmsPurchaseOrder> list = omsPurchaseOrderService.listApprove(omsPurchaseOrder);
|
||||
clearPage();
|
||||
todoService.fillPurchaseOrderApproveNode(list);
|
||||
return getDataTable(list);
|
||||
}
|
||||
@RequiresPermissions("sip:purchaseorder:list")
|
||||
@GetMapping("/approved/list")
|
||||
public TableDataInfo listApproved(OmsPurchaseOrder omsPurchaseOrder)
|
||||
{
|
||||
startPage();
|
||||
List<OmsPurchaseOrder> list = omsPurchaseOrderService.listApproved(omsPurchaseOrder);
|
||||
clearPage();
|
||||
todoService.fillPurchaseOrderApproveNode(list);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
|
@ -85,6 +135,17 @@ public class OmsPurchaseOrderController extends BaseController
|
|||
return toAjax(omsPurchaseOrderService.updateOmsPurchaseOrder(omsPurchaseOrder));
|
||||
}
|
||||
|
||||
/**
|
||||
* 发起供应商确认
|
||||
*/
|
||||
@RequiresPermissions("sip:purchaseorder:edit")
|
||||
@Log(title = "采购单主表", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/vendorConfirmStatus")
|
||||
public AjaxResult vendorConfirmStatus(@RequestBody OmsPurchaseOrder omsPurchaseOrder)
|
||||
{
|
||||
return toAjax(omsPurchaseOrderService.vendorConfirmStatus(omsPurchaseOrder));
|
||||
}
|
||||
|
||||
/**
|
||||
* 申请采购单主表
|
||||
*/
|
||||
|
|
@ -96,6 +157,37 @@ public class OmsPurchaseOrderController extends BaseController
|
|||
return toAjax(omsPurchaseOrderService.applyForPurchaseOrder(omsPurchaseOrder));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取采购单历史记录列表
|
||||
*/
|
||||
@RequiresPermissions("sip:purchaseorder:query")
|
||||
@GetMapping(value = "/history/{purchaseId}")
|
||||
public AjaxResult getHistoryList(@PathVariable("purchaseId") Long purchaseId)
|
||||
{
|
||||
return success(omsPurchaseOrderHistoryService.selectOmsPurchaseOrderHistoryListByPurchaseId(purchaseId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单个采购单历史记录详细信息
|
||||
*/
|
||||
@RequiresPermissions("sip:purchaseorder:query")
|
||||
@GetMapping(value = "/history/detail/{id}")
|
||||
public AjaxResult getHistoryDetailInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(omsPurchaseOrderHistoryService.selectOmsPurchaseOrderHistoryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 撤回采购单主表
|
||||
*/
|
||||
@RequiresPermissions("sip:purchaseorder:recall")
|
||||
@Log(title = "采购单主表", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/recall/{id}")
|
||||
public AjaxResult recall(@PathVariable("id") Long id)
|
||||
{
|
||||
return toAjax(omsPurchaseOrderService.recallPurchaseOrder(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除采购单主表
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
package com.ruoyi.sip.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
|
@ -73,22 +75,69 @@ public class OmsPurchaseOrder extends BaseEntity
|
|||
private Integer status;
|
||||
|
||||
/** 审批状态(0草稿 1审批中 2已通过 3驳回) */
|
||||
private Integer approveStatus;
|
||||
private String approveStatus;
|
||||
|
||||
/** 审批时间 */
|
||||
private Date approveTime;
|
||||
|
||||
/** 当前审批节点 */
|
||||
private String approveNode;
|
||||
|
||||
/** 确认状态(0待确认 1已确认) */
|
||||
private Integer confirmStatus;
|
||||
/** 确认状态(待审批、已确认、或空) */
|
||||
private String confirmStatus;
|
||||
|
||||
/** 流程类型(online线上 offline线下) */
|
||||
private String flowType;
|
||||
|
||||
/** 删除标志(0正常 1删除) */
|
||||
private Integer delFlag;
|
||||
|
||||
/** 版本号 */
|
||||
private Integer version;
|
||||
private Long approveUser;
|
||||
private Date applyTime;
|
||||
private Date todoApproveTime;
|
||||
private String processKey;
|
||||
private String todoId;
|
||||
private String taskId;
|
||||
|
||||
|
||||
/** 采购单明细表信息 */
|
||||
private List<OmsPurchaseOrderItem> omsPurchaseOrderItemList;
|
||||
|
||||
@Getter
|
||||
public enum ConfirmStatusEnum {
|
||||
WAIT_CONFIRM("0", "待确认"),
|
||||
CONFIRM("1", "已确认"),
|
||||
REJECT("2", "已驳回"),
|
||||
|
||||
;
|
||||
|
||||
private final String value;
|
||||
private final String code;
|
||||
|
||||
ConfirmStatusEnum(String code, String value) {
|
||||
this.code = code;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
}
|
||||
@Getter
|
||||
public enum FlowTypeEnum {
|
||||
ONLINE("online", "线上"),
|
||||
OFFLINE("offline", "线下"),
|
||||
|
||||
|
||||
;
|
||||
|
||||
private final String value;
|
||||
private final String code;
|
||||
|
||||
FlowTypeEnum(String code, String value) {
|
||||
this.code = code;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,94 @@
|
|||
package com.ruoyi.sip.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 采购单历史记录对象 oms_purchase_order_history
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-11-26
|
||||
*/
|
||||
@Data
|
||||
public class OmsPurchaseOrderHistory extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
private Long id;
|
||||
|
||||
/** 关联的原始采购单ID */
|
||||
private Long purchaseId;
|
||||
|
||||
/** 采购单号(系统生成) */
|
||||
private String purchaseNo;
|
||||
|
||||
/** 采购方名称 */
|
||||
private String buyerName;
|
||||
|
||||
/** 采购方地址 */
|
||||
private String buyerAddress;
|
||||
|
||||
/** 制造商ID */
|
||||
private Long vendorId;
|
||||
|
||||
private String vendorName;
|
||||
private String vendorUser;
|
||||
private String vendorPhone;
|
||||
/** 币别(固定人民币) */
|
||||
private String currency;
|
||||
|
||||
/** 采购员ID */
|
||||
private Long purchaserId;
|
||||
|
||||
|
||||
/** 采购员姓名 */
|
||||
private String purchaserName;
|
||||
|
||||
/** 采购员电话 */
|
||||
private String purchaserMobile;
|
||||
|
||||
/** 采购员邮箱 */
|
||||
private String purchaserEmail;
|
||||
|
||||
/** 入库仓库ID */
|
||||
private Long warehouseId;
|
||||
|
||||
/** 付款方式 */
|
||||
private String payMethod;
|
||||
|
||||
/** 汇智负责人ID */
|
||||
private Long ownerId;
|
||||
|
||||
/** 汇智负责人姓名 */
|
||||
private String ownerName;
|
||||
|
||||
/** 含税总金额 */
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
/** 采购状态(0待入库 1部分入库 2已完成) */
|
||||
private Integer status;
|
||||
|
||||
/** 审批状态(0草稿 1审批中 2已通过 3驳回) */
|
||||
private Integer approveStatus;
|
||||
|
||||
/** 审批时间 */
|
||||
private java.util.Date approveTime;
|
||||
|
||||
/** 当前审批节点 */
|
||||
private String approveNode;
|
||||
|
||||
/** 确认状态(0待确认 1已确认) */
|
||||
private String confirmStatus;
|
||||
|
||||
/** 删除标志(0正常 1删除) */
|
||||
private Integer delFlag;
|
||||
private String flowType;
|
||||
|
||||
/** 版本号 */
|
||||
private Integer version;
|
||||
private List<OmsPurchaseOrderItemHistory> omsPurchaseOrderItemList;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
package com.ruoyi.sip.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* 采购单明细历史记录表对象 oms_purchase_order_item_history
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-11-26
|
||||
*/
|
||||
@Data
|
||||
public class OmsPurchaseOrderItemHistory extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
private Long id;
|
||||
|
||||
/** 关联采购单历史ID */
|
||||
private Long purchaseHistoryId;
|
||||
|
||||
/** 关联原始采购单ID */
|
||||
private Long originalPurchaseId;
|
||||
|
||||
/** 产品CODE */
|
||||
private String productCode;
|
||||
|
||||
/** 0:待入库 1:已完成 */
|
||||
private Long innerStatus;
|
||||
|
||||
/** 数量 */
|
||||
private BigDecimal quantity;
|
||||
|
||||
/** 单价 */
|
||||
private BigDecimal price;
|
||||
|
||||
/** 税率百分比 */
|
||||
private BigDecimal taxRate;
|
||||
|
||||
/** 税额 */
|
||||
private BigDecimal taxTotal;
|
||||
|
||||
/** 含税金额 */
|
||||
private BigDecimal amountTotal;
|
||||
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private Date deliveryDate;
|
||||
private String productType;
|
||||
private String productModel;
|
||||
private String productDescription;
|
||||
|
||||
}
|
||||
|
|
@ -65,6 +65,12 @@ public class TodoController extends BaseController {
|
|||
List<Todo> list = todoService.selectTodoCompletedList(todo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
@PostMapping("/completed/all/list")
|
||||
@ResponseBody
|
||||
public AjaxResult allCompletedList( @RequestBody Todo todo) {
|
||||
|
||||
return AjaxResult.success(todoService.selectTodoCompletedList(todo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询审批详情
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ public class Todo extends BaseEntity
|
|||
/** 流程key */
|
||||
|
||||
private String processKey;
|
||||
private List<String> processKeyList;
|
||||
|
||||
/** 流程名称 */
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ package com.ruoyi.sip.flowable.service;
|
|||
import com.ruoyi.sip.flowable.domain.Todo;
|
||||
import org.flowable.engine.runtime.ProcessInstance;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 流程相关接口模板定义
|
||||
*/
|
||||
|
|
@ -46,4 +48,6 @@ public interface TodoCommonTemplate {
|
|||
}
|
||||
|
||||
|
||||
void fillBusinessInfo(List<Todo> todoCompletedList);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.ruoyi.sip.flowable.service;
|
||||
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.sip.domain.OmsPurchaseOrder;
|
||||
import com.ruoyi.sip.domain.ProjectOrderInfo;
|
||||
import com.ruoyi.sip.flowable.domain.Todo;
|
||||
import org.flowable.engine.runtime.ProcessInstance;
|
||||
|
|
@ -95,7 +96,12 @@ public interface TodoService
|
|||
* @param
|
||||
* @return
|
||||
*/
|
||||
TodoCommonTemplate getTodoExecuteInstance(Todo todo);
|
||||
default TodoCommonTemplate getTodoExecuteInstance(Todo todo) {
|
||||
return getTodoExecuteInstance(todo.getProcessKey());
|
||||
}
|
||||
|
||||
|
||||
TodoCommonTemplate getTodoExecuteInstance(String processKey);
|
||||
|
||||
/**
|
||||
* 1-待审批 2-驳回 3-通过
|
||||
|
|
@ -128,4 +134,6 @@ public interface TodoService
|
|||
Todo selectLastApproveTodo(String businessKey,String taskName);
|
||||
|
||||
void fillOrderApproveNode(List<ProjectOrderInfo> list);
|
||||
|
||||
void fillPurchaseOrderApproveNode(List<OmsPurchaseOrder> list);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,11 +9,12 @@ import com.ruoyi.common.core.domain.AjaxResult;
|
|||
import com.ruoyi.common.core.domain.entity.SysRole;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
import com.ruoyi.common.utils.ShiroUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.bean.BeanUtils;
|
||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||
import com.ruoyi.sip.domain.OmsPurchaseOrder;
|
||||
import com.ruoyi.sip.domain.ProjectOrderInfo;
|
||||
import com.ruoyi.sip.flowable.controller.TodoController;
|
||||
import com.ruoyi.sip.flowable.domain.Todo;
|
||||
import com.ruoyi.sip.flowable.mapper.TodoMapper;
|
||||
import com.ruoyi.sip.flowable.service.TodoCommonTemplate;
|
||||
|
|
@ -69,6 +70,8 @@ public class TodoServiceImpl implements TodoService {
|
|||
private String orderOnlineFlowKey;
|
||||
@Value("${process.definition.orderApproveOffline}")
|
||||
private String orderOfflineFlowKey;
|
||||
@Value("${process.definition.purchaseOrderApprove}")
|
||||
private String purchaseOrderApproveFlowKey;
|
||||
/**
|
||||
* 查询待办
|
||||
*
|
||||
|
|
@ -163,26 +166,27 @@ public class TodoServiceImpl implements TodoService {
|
|||
todoDto.setRoleName(userRoleMap.get(Long.parseLong(todoDto.getApproveUser())));
|
||||
}
|
||||
//关联业务信息
|
||||
List<String> businessKeyList = todoCompletedList.stream().map(Todo::getBusinessKey).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(businessKeyList)){
|
||||
List<ProjectOrderInfo> orderInfoList = projectOrderInfoService.listByCodeList(businessKeyList);
|
||||
Map<String, ProjectOrderInfo> orderInfoMap = orderInfoList.stream().collect(Collectors.toMap(ProjectOrderInfo::getOrderCode, Function.identity(), (v1, v2) -> v1));
|
||||
todoCompletedList.forEach(item -> {
|
||||
ProjectOrderInfo projectOrderInfo = orderInfoMap.get(item.getBusinessKey());
|
||||
if (ObjectUtils.isEmpty(projectOrderInfo)) {
|
||||
return;
|
||||
}
|
||||
item.setBusinessId(projectOrderInfo.getId());
|
||||
item.setProjectCode(projectOrderInfo.getProjectCode());
|
||||
item.setBusinessName(projectOrderInfo.getProjectName());
|
||||
});
|
||||
}
|
||||
|
||||
// dealBusinessInfo(todo, todoCompletedList);
|
||||
|
||||
|
||||
return todoCompletedList;
|
||||
}
|
||||
|
||||
private void dealBusinessInfo(Todo todo, List<Todo> todoCompletedList) {
|
||||
if (CollUtil.isEmpty(todoCompletedList)) {
|
||||
return;
|
||||
}
|
||||
TodoCommonTemplate todoExecuteInstance = null;
|
||||
if (todo.getProcessKeyList().contains(processConfig.getDefinition().getOrderApproveOnline()) || todo.getProcessKeyList().contains(processConfig.getDefinition().getOrderApproveOffline())) {
|
||||
todoExecuteInstance = getTodoExecuteInstance(processConfig.getDefinition().getOrderApproveOnline());
|
||||
} else if (todo.getProcessKeyList().contains(processConfig.getDefinition().getPurchaseOrderApprove())) {
|
||||
todoExecuteInstance = getTodoExecuteInstance(processConfig.getDefinition().getPurchaseOrderApprove());
|
||||
}
|
||||
if (todoExecuteInstance != null) {
|
||||
todoExecuteInstance.fillBusinessInfo(todoCompletedList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Todo> selectGQOrYQCompletedList(Todo todo) {
|
||||
return todoMapper.selectGQOrYQCompletedList(todo);
|
||||
|
|
@ -213,6 +217,12 @@ public class TodoServiceImpl implements TodoService {
|
|||
|
||||
@Override
|
||||
public AjaxResult todoApprove(Todo todo) {
|
||||
List<Todo> todoList = this.selectTodoList(todo);
|
||||
String userId = ShiroUtils.getUserId().toString();
|
||||
long count = todoList.stream().filter(item -> userId.equalsIgnoreCase(item.getApproveUser())).count();
|
||||
if (count<=0){
|
||||
return AjaxResult.error("审批失败,当前审批人无权限审批");
|
||||
}
|
||||
complete(todo);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
|
@ -229,9 +239,9 @@ public class TodoServiceImpl implements TodoService {
|
|||
* @return 执行实例对象
|
||||
*/
|
||||
@Override
|
||||
public TodoCommonTemplate getTodoExecuteInstance(Todo todo) {
|
||||
public TodoCommonTemplate getTodoExecuteInstance(String processKey) {
|
||||
Instance instance = processConfig.getInstance();
|
||||
Method method = BeanUtils.findMethod(instance.getClass(), "get" + todo.getProcessKey().substring(0, 1).toUpperCase() + todo.getProcessKey().substring(1));
|
||||
Method method = BeanUtils.findMethod(instance.getClass(), "get" + processKey.substring(0, 1).toUpperCase() + processKey.substring(1));
|
||||
try {
|
||||
Map<String, Object> instanceMap = (Map<String, Object>) method.invoke(instance, null);
|
||||
return SpringUtils.getBean((String) instanceMap.get("beanName"));
|
||||
|
|
@ -344,6 +354,22 @@ public class TodoServiceImpl implements TodoService {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillPurchaseOrderApproveNode(List<OmsPurchaseOrder> list) {
|
||||
List<String> businessKeyList = list.stream().map(OmsPurchaseOrder::getPurchaseNo).collect(Collectors.toList());
|
||||
if (CollUtil.isEmpty(businessKeyList)) {
|
||||
return;
|
||||
}
|
||||
List<Todo> todoList = todoMapper.listTodoByBusinessKeyAndProcessKey(businessKeyList, Collections.singletonList(purchaseOrderApproveFlowKey));
|
||||
Map<String, String> approveUserNameMap = todoList.stream()
|
||||
.collect(Collectors.groupingBy(Todo::getBusinessKey,
|
||||
Collectors.mapping(Todo::getApproveUserName,
|
||||
Collectors.joining("、"))));
|
||||
for (OmsPurchaseOrder orderInfo : list) {
|
||||
orderInfo.setApproveNode(approveUserNameMap.get(orderInfo.getPurchaseNo()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 流程审批
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -0,0 +1,45 @@
|
|||
package com.ruoyi.sip.mapper;
|
||||
|
||||
import com.ruoyi.sip.domain.OmsPurchaseOrderHistory;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 采购单历史记录Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-11-26
|
||||
*/
|
||||
public interface OmsPurchaseOrderHistoryMapper
|
||||
{
|
||||
/**
|
||||
* 新增采购单历史记录
|
||||
*
|
||||
* @param omsPurchaseOrderHistory 采购单历史记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertOmsPurchaseOrderHistory(OmsPurchaseOrderHistory omsPurchaseOrderHistory);
|
||||
|
||||
/**
|
||||
* 根据采购ID查询采购单历史记录列表
|
||||
*
|
||||
* @param purchaseId 采购ID
|
||||
* @return 采购单历史记录集合
|
||||
*/
|
||||
public List<OmsPurchaseOrderHistory> selectOmsPurchaseOrderHistoryListByPurchaseId(Long purchaseId);
|
||||
|
||||
/**
|
||||
* 根据ID查询采购单历史记录
|
||||
*
|
||||
* @param id 历史记录ID
|
||||
* @return 采购单历史记录
|
||||
*/
|
||||
public OmsPurchaseOrderHistory selectOmsPurchaseOrderHistoryById(Long id);
|
||||
|
||||
/**
|
||||
* 根据历史采购单ID查询其明细项列表
|
||||
*
|
||||
* @param purchaseHistoryId 历史采购单ID
|
||||
* @return 采购单明细历史记录集合
|
||||
*/
|
||||
public List<com.ruoyi.sip.domain.OmsPurchaseOrderItemHistory> selectOmsPurchaseOrderItemHistoryListByPurchaseHistoryId(Long purchaseHistoryId);
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package com.ruoyi.sip.mapper;
|
||||
|
||||
import com.ruoyi.sip.domain.OmsPurchaseOrderItemHistory;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 采购单明细历史记录Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-11-26
|
||||
*/
|
||||
public interface OmsPurchaseOrderItemHistoryMapper
|
||||
{
|
||||
/**
|
||||
* 批量新增采购单明细历史记录
|
||||
*
|
||||
* @param omsPurchaseOrderItemHistoryList 采购单明细历史记录列表
|
||||
* @return 结果
|
||||
*/
|
||||
public int batchOmsPurchaseOrderItemHistory(List<OmsPurchaseOrderItemHistory> omsPurchaseOrderItemHistoryList);
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@ package com.ruoyi.sip.mapper;
|
|||
import java.util.List;
|
||||
import com.ruoyi.sip.domain.OmsPurchaseOrder;
|
||||
import com.ruoyi.sip.domain.OmsPurchaseOrderItem;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 采购单主表Mapper接口
|
||||
|
|
@ -90,4 +91,13 @@ public interface OmsPurchaseOrderMapper
|
|||
List<OmsPurchaseOrderItem> listItemByPurchaseId(Long id);
|
||||
|
||||
int updateOmsPurchaseOrderStatus(OmsPurchaseOrder omsPurchaseOrder);
|
||||
|
||||
void updateOmsPurchaseOrderByCode(OmsPurchaseOrder omsPurchaseOrder);
|
||||
|
||||
List<OmsPurchaseOrder> listApprove(@Param("entity") OmsPurchaseOrder omsPurchaseOrder, @Param("tableName") String tableName);
|
||||
|
||||
OmsPurchaseOrder selectByNo(String businessKey);
|
||||
|
||||
List<OmsPurchaseOrder> listByCodeList(List<String> businessKeyList);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,36 @@
|
|||
package com.ruoyi.sip.service;
|
||||
|
||||
import com.ruoyi.sip.domain.OmsPurchaseOrderHistory;
|
||||
|
||||
/**
|
||||
* 采购单历史记录Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-11-26
|
||||
*/
|
||||
public interface IOmsPurchaseOrderHistoryService
|
||||
{
|
||||
/**
|
||||
* 新增采购单历史记录
|
||||
*
|
||||
* @param omsPurchaseOrderHistory 采购单历史记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertOmsPurchaseOrderHistory(OmsPurchaseOrderHistory omsPurchaseOrderHistory);
|
||||
|
||||
/**
|
||||
* 根据采购ID查询采购单历史记录列表
|
||||
*
|
||||
* @param purchaseId 采购ID
|
||||
* @return 采购单历史记录集合
|
||||
*/
|
||||
public java.util.List<OmsPurchaseOrderHistory> selectOmsPurchaseOrderHistoryListByPurchaseId(Long purchaseId);
|
||||
|
||||
/**
|
||||
* 根据ID查询采购单历史记录详情
|
||||
*
|
||||
* @param id 历史记录ID
|
||||
* @return 采购单历史记录
|
||||
*/
|
||||
public OmsPurchaseOrderHistory selectOmsPurchaseOrderHistoryById(Long id);
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ package com.ruoyi.sip.service;
|
|||
|
||||
import java.util.List;
|
||||
import com.ruoyi.sip.domain.OmsPurchaseOrder;
|
||||
import com.ruoyi.sip.flowable.domain.Todo;
|
||||
|
||||
/**
|
||||
* 采购单主表Service接口
|
||||
|
|
@ -53,7 +54,7 @@ public interface IOmsPurchaseOrderService
|
|||
|
||||
/**
|
||||
* 批量删除采购单主表
|
||||
*
|
||||
*
|
||||
* @param ids 需要删除的采购单主表主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
|
|
@ -61,9 +62,29 @@ public interface IOmsPurchaseOrderService
|
|||
|
||||
/**
|
||||
* 删除采购单主表信息
|
||||
*
|
||||
*
|
||||
* @param id 采购单主表主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteOmsPurchaseOrderById(Long id);
|
||||
|
||||
/**
|
||||
* 发起供应商确认
|
||||
*
|
||||
* @param omsPurchaseOrder 采购单主表
|
||||
* @return 结果
|
||||
*/
|
||||
public int vendorConfirmStatus(OmsPurchaseOrder omsPurchaseOrder);
|
||||
|
||||
/**
|
||||
* 撤回采购订单
|
||||
*
|
||||
* @param id 采购单主表主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int recallPurchaseOrder(Long id);
|
||||
|
||||
List<OmsPurchaseOrder> listApprove(OmsPurchaseOrder omsPurchaseOrder);
|
||||
|
||||
List<OmsPurchaseOrder> listApproved(OmsPurchaseOrder omsPurchaseOrder);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,56 @@
|
|||
package com.ruoyi.sip.service.impl;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.sip.mapper.OmsPurchaseOrderHistoryMapper;
|
||||
import com.ruoyi.sip.domain.OmsPurchaseOrderHistory;
|
||||
import com.ruoyi.sip.service.IOmsPurchaseOrderHistoryService;
|
||||
|
||||
/**
|
||||
* 采购单历史记录Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-11-26
|
||||
*/
|
||||
@Service
|
||||
public class OmsPurchaseOrderHistoryServiceImpl implements IOmsPurchaseOrderHistoryService {
|
||||
@Autowired
|
||||
private OmsPurchaseOrderHistoryMapper omsPurchaseOrderHistoryMapper;
|
||||
|
||||
/**
|
||||
* 新增采购单历史记录
|
||||
*
|
||||
* @param omsPurchaseOrderHistory 采购单历史记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertOmsPurchaseOrderHistory(OmsPurchaseOrderHistory omsPurchaseOrderHistory) {
|
||||
return omsPurchaseOrderHistoryMapper.insertOmsPurchaseOrderHistory(omsPurchaseOrderHistory);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据采购ID查询采购单历史记录列表
|
||||
*
|
||||
* @param purchaseId 采购ID
|
||||
* @return 采购单历史记录集合
|
||||
*/
|
||||
@Override
|
||||
public java.util.List<OmsPurchaseOrderHistory> selectOmsPurchaseOrderHistoryListByPurchaseId(Long purchaseId) {
|
||||
return omsPurchaseOrderHistoryMapper.selectOmsPurchaseOrderHistoryListByPurchaseId(purchaseId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID查询采购单历史记录详情
|
||||
*
|
||||
* @param id 历史记录ID
|
||||
* @return 采购单历史记录
|
||||
*/
|
||||
@Override
|
||||
public OmsPurchaseOrderHistory selectOmsPurchaseOrderHistoryById(Long id) {
|
||||
OmsPurchaseOrderHistory history = omsPurchaseOrderHistoryMapper.selectOmsPurchaseOrderHistoryById(id);
|
||||
if (history != null) {
|
||||
history.setOmsPurchaseOrderItemList(omsPurchaseOrderHistoryMapper.selectOmsPurchaseOrderItemHistoryListByPurchaseHistoryId(id));
|
||||
}
|
||||
return history;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,19 +1,35 @@
|
|||
package com.ruoyi.sip.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.ruoyi.common.enums.ApproveStatusEnum;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.ShiroUtils;
|
||||
import com.ruoyi.sip.domain.*;
|
||||
import com.ruoyi.sip.flowable.domain.Todo;
|
||||
import com.ruoyi.sip.flowable.service.DeleteFlowableProcessInstanceCmd;
|
||||
import com.ruoyi.sip.flowable.service.TodoCommonTemplate;
|
||||
import com.ruoyi.sip.flowable.service.TodoService;
|
||||
import com.ruoyi.sip.mapper.OmsPurchaseOrderItemHistoryMapper;
|
||||
import com.ruoyi.sip.mapper.OmsPurchaseOrderHistoryMapper;
|
||||
import com.ruoyi.sip.service.ICnareaService;
|
||||
import com.ruoyi.sip.service.IVendorInfoService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.flowable.engine.ManagementService;
|
||||
import org.flowable.engine.TaskService;
|
||||
import org.flowable.engine.runtime.ProcessInstance;
|
||||
import org.flowable.task.api.Task;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import com.ruoyi.sip.mapper.OmsPurchaseOrderMapper;
|
||||
|
|
@ -21,6 +37,8 @@ import com.ruoyi.sip.service.IOmsPurchaseOrderService;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static com.ruoyi.common.utils.ShiroUtils.getSysUser;
|
||||
|
||||
/**
|
||||
* 采购单主表Service业务层处理
|
||||
*
|
||||
|
|
@ -28,7 +46,9 @@ import javax.annotation.Resource;
|
|||
* @date 2025-11-24
|
||||
*/
|
||||
@Service
|
||||
public class OmsPurchaseOrderServiceImpl implements IOmsPurchaseOrderService
|
||||
@Slf4j
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class OmsPurchaseOrderServiceImpl implements IOmsPurchaseOrderService, TodoCommonTemplate
|
||||
{
|
||||
@Resource
|
||||
private OmsPurchaseOrderMapper omsPurchaseOrderMapper;
|
||||
|
|
@ -43,6 +63,10 @@ public class OmsPurchaseOrderServiceImpl implements IOmsPurchaseOrderService
|
|||
private ICnareaService cnareaService;
|
||||
@Autowired
|
||||
private IVendorInfoService vendorInfoService;
|
||||
@Autowired
|
||||
private TodoService todoService;
|
||||
@Autowired
|
||||
protected ManagementService managementService;
|
||||
/**
|
||||
* 查询采购单主表
|
||||
*
|
||||
|
|
@ -152,9 +176,40 @@ public class OmsPurchaseOrderServiceImpl implements IOmsPurchaseOrderService
|
|||
@Override
|
||||
public int applyForPurchaseOrder(OmsPurchaseOrder omsPurchaseOrder) {
|
||||
omsPurchaseOrder.setUpdateTime(DateUtils.getNowDate());
|
||||
//开启流程
|
||||
List<ProcessInstance> processInstanceList = todoService.listProcessInstance(omsPurchaseOrder.getPurchaseNo());
|
||||
if (CollUtil.isNotEmpty(processInstanceList)) {
|
||||
for (ProcessInstance processInstance : processInstanceList) {
|
||||
//删除流程实例 不删流程实例可能导致 提交流程被驳回后 另外一个无法提交审核 因为流程驳回是驳回后,流程处理人是售前A
|
||||
DeleteFlowableProcessInstanceCmd cmd = new DeleteFlowableProcessInstanceCmd(processInstance.getProcessInstanceId(), "删除流程实例", true);
|
||||
managementService.executeCommand(cmd);
|
||||
}
|
||||
todoService.deleteTodoByBusinessKey(omsPurchaseOrder.getPurchaseNo());
|
||||
}
|
||||
|
||||
// String orderFlowKey = ProjectOrderInfo.ProcessTypeEnum.ONLINE.getCode().equals(projectOrderInfo.getProcessType()) ?
|
||||
// orderOnlineFlowKey : orderOfflineFlowKey;
|
||||
String flowKey="purchase_order_online";
|
||||
//启动流程
|
||||
todoService.startProcess(getFlowBusinessKey(omsPurchaseOrder.getPurchaseNo()), new HashMap<String, Object>() {{
|
||||
|
||||
put("applyUserName", ShiroUtils.getSysUser().getUserName());
|
||||
put("applyUser", ShiroUtils.getUserId());
|
||||
|
||||
put("extendField1", omsPurchaseOrder.getVersion().toString());
|
||||
}}, flowKey);
|
||||
todoService.completed(null, null, getFlowBusinessKey(omsPurchaseOrder.getPurchaseNo()));
|
||||
|
||||
|
||||
return omsPurchaseOrderMapper.updateOmsPurchaseOrderStatus(omsPurchaseOrder);
|
||||
}
|
||||
|
||||
private String getFlowBusinessKey(String purchaseNo) {
|
||||
return purchaseNo;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void saveOrderHistory(OmsPurchaseOrder oldOrder) {
|
||||
// 复制主表信息到历史表
|
||||
|
|
@ -206,6 +261,19 @@ public class OmsPurchaseOrderServiceImpl implements IOmsPurchaseOrderService
|
|||
return omsPurchaseOrderMapper.deleteOmsPurchaseOrderById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OmsPurchaseOrder> listApprove(OmsPurchaseOrder omsPurchaseOrder) {
|
||||
omsPurchaseOrder.setApproveUser(ShiroUtils.getUserId());
|
||||
return omsPurchaseOrderMapper.listApprove(omsPurchaseOrder,"bu_todo");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OmsPurchaseOrder> listApproved(OmsPurchaseOrder omsPurchaseOrder) {
|
||||
omsPurchaseOrder.setApproveUser(ShiroUtils.getUserId());
|
||||
return omsPurchaseOrderMapper.listApprove(omsPurchaseOrder,"bu_todo_completed");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增采购单明细表信息
|
||||
*
|
||||
|
|
@ -229,5 +297,135 @@ public class OmsPurchaseOrderServiceImpl implements IOmsPurchaseOrderService
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发起供应商确认
|
||||
*
|
||||
* @param omsPurchaseOrder 采购单主表
|
||||
* @return 结果
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public int vendorConfirmStatus(OmsPurchaseOrder omsPurchaseOrder) {
|
||||
omsPurchaseOrder.setUpdateTime(DateUtils.getNowDate());
|
||||
return omsPurchaseOrderMapper.updateOmsPurchaseOrder(omsPurchaseOrder);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 撤回采购订单
|
||||
*
|
||||
* @param id 采购单主表主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public int recallPurchaseOrder(Long id) {
|
||||
OmsPurchaseOrder omsPurchaseOrder = omsPurchaseOrderMapper.selectOmsPurchaseOrderById(id);
|
||||
if (omsPurchaseOrder == null) {
|
||||
throw new ServiceException("采购订单不存在");
|
||||
}
|
||||
// 只有审批状态为“已通过”(2) 且 供应商确认状态为空或 null 时才能撤回
|
||||
if (ApproveStatusEnum.APPROVE_COMPLETE.getCode().equals(omsPurchaseOrder.getApproveStatus()) &&
|
||||
(StringUtils.isEmpty(omsPurchaseOrder.getConfirmStatus()) || "".equals(omsPurchaseOrder.getConfirmStatus()))) {
|
||||
// 保存历史记录
|
||||
saveOrderHistory(omsPurchaseOrder);
|
||||
|
||||
omsPurchaseOrder.setApproveStatus(ApproveStatusEnum.WAIT_COMMIT.getCode()); // 设置为待审批(草稿)
|
||||
omsPurchaseOrder.setApproveTime(null); // 清空审批时间
|
||||
omsPurchaseOrder.setUpdateTime(DateUtils.getNowDate());
|
||||
omsPurchaseOrder.setVersion(omsPurchaseOrder.getVersion() + 1); // 版本号 +1
|
||||
return omsPurchaseOrderMapper.updateOmsPurchaseOrder(omsPurchaseOrder);
|
||||
} else {
|
||||
throw new ServiceException("当前订单状态不允许撤回");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean multiInstanceApproveCallback(String activityName, ProcessInstance processInstance) {
|
||||
String flowBusinessKey = processInstance.getBusinessKey();
|
||||
String[] split = flowBusinessKey.split("#");
|
||||
String businessKey = split.length > 1 ? split[1] : split[0];
|
||||
Map<String, Object> processVariables = processInstance.getProcessVariables();
|
||||
Integer approveBtn = (Integer) processVariables.get("approveBtn");
|
||||
if ("公司领导".equals(activityName) && approveBtn == 1) {
|
||||
handleCompanyLeaderApproval(businessKey);
|
||||
}
|
||||
return TodoCommonTemplate.super.multiInstanceApproveCallback(activityName, processInstance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillBusinessInfo(List<Todo> todoCompletedList) {
|
||||
if (CollUtil.isEmpty(todoCompletedList)){
|
||||
return;
|
||||
}
|
||||
List<String> businessKeyList = todoCompletedList.stream().map(Todo::getBusinessKey).collect(Collectors.toList());
|
||||
List<OmsPurchaseOrder> orderInfoList = omsPurchaseOrderMapper.listByCodeList(businessKeyList);
|
||||
Map<String, OmsPurchaseOrder> orderInfoMap = orderInfoList.stream().collect(Collectors.toMap(OmsPurchaseOrder::getPurchaseNo, Function.identity(), (v1, v2) -> v1));
|
||||
todoCompletedList.forEach(item -> {
|
||||
OmsPurchaseOrder orderInfo = orderInfoMap.get(item.getBusinessKey());
|
||||
if (ObjectUtils.isEmpty(orderInfo)) {
|
||||
return;
|
||||
}
|
||||
item.setBusinessId(orderInfo.getId());
|
||||
item.setBusinessName(orderInfo.getPurchaseNo());
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean todoApproveCallback(Todo todo) {
|
||||
if (CollUtil.isEmpty(todo.getVariables())) {
|
||||
return TodoCommonTemplate.super.todoApproveCallback(todo);
|
||||
}
|
||||
|
||||
Integer approveBtn = (Integer) todo.getVariables().get("approveBtn");
|
||||
if (approveBtn == null) {
|
||||
return TodoCommonTemplate.super.todoApproveCallback(todo);
|
||||
}
|
||||
|
||||
String taskName = todo.getTaskName();
|
||||
String businessKey = todo.getBusinessKey();
|
||||
|
||||
// 审批驳回处理
|
||||
if (approveBtn.equals(0)) {
|
||||
handleRejectOrder( businessKey);
|
||||
}
|
||||
|
||||
return TodoCommonTemplate.super.todoApproveCallback(todo);
|
||||
}
|
||||
|
||||
private void handleCompanyLeaderApproval(String businessKey) {
|
||||
OmsPurchaseOrder omsPurchaseOrder = new OmsPurchaseOrder();
|
||||
omsPurchaseOrder.setPurchaseNo(businessKey);
|
||||
omsPurchaseOrder.setApproveStatus(ApproveStatusEnum.APPROVE_COMPLETE.getCode());
|
||||
omsPurchaseOrder.setApproveTime(DateUtils.getNowDate());
|
||||
omsPurchaseOrder.setUpdateTime(DateUtils.getNowDate());
|
||||
omsPurchaseOrderMapper.updateOmsPurchaseOrderByCode(omsPurchaseOrder);
|
||||
}
|
||||
|
||||
private void handleRejectOrder(String businessKey) {
|
||||
OmsPurchaseOrder omsPurchaseOrder = new OmsPurchaseOrder();
|
||||
omsPurchaseOrder.setPurchaseNo(businessKey);
|
||||
omsPurchaseOrder.setApproveStatus(ApproveStatusEnum.APPROVE_REJECT.getCode());
|
||||
omsPurchaseOrder.setApproveTime(DateUtils.getNowDate());
|
||||
omsPurchaseOrder.setUpdateTime(DateUtils.getNowDate());
|
||||
omsPurchaseOrderMapper.updateOmsPurchaseOrderByCode(omsPurchaseOrder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object completedTodoDetail(String businessKey, String processKey, String todoId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object todoDetail(String businessKey, String processKey, String todoId) {
|
||||
OmsPurchaseOrder omsPurchaseOrder = omsPurchaseOrderMapper.selectByNo(businessKey);
|
||||
List<OmsPurchaseOrderItem> omsPurchaseOrderItems = omsPurchaseOrderMapper.listItemByPurchaseId(omsPurchaseOrder.getId());
|
||||
omsPurchaseOrder.setOmsPurchaseOrderItemList(omsPurchaseOrderItems);
|
||||
|
||||
|
||||
|
||||
return omsPurchaseOrder;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1186,6 +1186,25 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService, To
|
|||
return TodoCommonTemplate.super.todoApproveCallback(todo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillBusinessInfo(List<Todo> todoCompletedList) {
|
||||
if (CollUtil.isEmpty(todoCompletedList)){
|
||||
return;
|
||||
}
|
||||
List<String> businessKeyList = todoCompletedList.stream().map(Todo::getBusinessKey).collect(Collectors.toList());
|
||||
List<ProjectOrderInfo> orderInfoList = this.listByCodeList(businessKeyList);
|
||||
Map<String, ProjectOrderInfo> orderInfoMap = orderInfoList.stream().collect(Collectors.toMap(ProjectOrderInfo::getOrderCode, Function.identity(), (v1, v2) -> v1));
|
||||
todoCompletedList.forEach(item -> {
|
||||
ProjectOrderInfo projectOrderInfo = orderInfoMap.get(item.getBusinessKey());
|
||||
if (ObjectUtils.isEmpty(projectOrderInfo)) {
|
||||
return;
|
||||
}
|
||||
item.setBusinessId(projectOrderInfo.getId());
|
||||
item.setProjectCode(projectOrderInfo.getProjectCode());
|
||||
item.setBusinessName(projectOrderInfo.getProjectName());
|
||||
});
|
||||
}
|
||||
|
||||
private void handlePartnerApproval(String businessKey) {
|
||||
// ProjectOrderInfo dbProjectOrderInfo = projectOrderInfoMapper.selectProjectOrderInfoByCode(businessKey);
|
||||
addStock(businessKey);
|
||||
|
|
|
|||
|
|
@ -31,17 +31,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<select id="selectTodoList" parameterType="Todo" resultType="todo">
|
||||
<include refid="selectTodoVo"/>
|
||||
<where>
|
||||
<if test="todoId != null and todoId != ''"> and todo_id = #{todoId}</if>
|
||||
<if test="businessKey != null and businessKey != ''"> and business_key = #{businessKey}</if>
|
||||
<if test="processKey != null and processKey != ''"> and process_key = #{processKey}</if>
|
||||
<if test="processName != null and processName != ''"> and process_name like concat('%', #{processName}, '%')</if>
|
||||
<if test="taskName != null and taskName != ''"> and task_name like concat('%', #{taskName}, '%')</if>
|
||||
<if test="approveUserName != null and approveUserName != ''"> and approve_user_name = #{approveUserName}</if>
|
||||
<if test="applyUserName != null and applyUserName != ''"> and apply_user_name like concat('%', #{applyUserName}, '%')</if>
|
||||
<if test="applyTime != null "> and date_format(apply_time,'%y%m%d') = date_format(#{applyTime},'%y%m%d')</if>
|
||||
<if test="extendField1 != null and extendField1 != ''"> and extend_field1 like concat('%',#{extendField1},'%')</if>
|
||||
<if test="extendField2 != null and extendField2 != ''"> and extend_field2 like concat('%',#{extendField2},'%')</if>
|
||||
<if test="processInstanceId != null and processInstanceId != ''"> and process_instance_id = #{processInstanceId}</if>
|
||||
<if test="todoId != null and todoId != ''">and todo_id = #{todoId}</if>
|
||||
<if test="businessKey != null and businessKey != ''">and business_key = #{businessKey}</if>
|
||||
<if test="processKey != null and processKey != ''">and process_key = #{processKey}</if>
|
||||
<if test="processKeyList != null and processKeyList != ''">and process_key in
|
||||
<foreach collection="processKeyList" item="item" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="processName != null and processName != ''">and process_name like concat('%', #{processName},
|
||||
'%')
|
||||
</if>
|
||||
<if test="taskName != null and taskName != ''">and task_name like concat('%', #{taskName}, '%')</if>
|
||||
<if test="approveUserName != null and approveUserName != ''">and approve_user_name = #{approveUserName}
|
||||
</if>
|
||||
<if test="applyUserName != null and applyUserName != ''">and apply_user_name like concat('%',
|
||||
#{applyUserName}, '%')
|
||||
</if>
|
||||
<if test="applyTime != null ">and date_format(apply_time,'%y%m%d') = date_format(#{applyTime},'%y%m%d')</if>
|
||||
<if test="extendField1 != null and extendField1 != ''">and extend_field1 like
|
||||
concat('%',#{extendField1},'%')
|
||||
</if>
|
||||
<if test="extendField2 != null and extendField2 != ''">and extend_field2 like
|
||||
concat('%',#{extendField2},'%')
|
||||
</if>
|
||||
<if test="processInstanceId != null and processInstanceId != ''">and process_instance_id =
|
||||
#{processInstanceId}
|
||||
</if>
|
||||
<if test="searchValue != null and searchValue != ''">
|
||||
AND (todo_id like concat('%',#{searchValue},'%') or extend_field1 like concat('%',#{searchValue},'%'))
|
||||
</if>
|
||||
|
|
@ -63,6 +79,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="todoId != null and todoId != ''">and todo_id = #{todoId}</if>
|
||||
<if test="businessKey != null and businessKey != ''">and business_key = #{businessKey}</if>
|
||||
<if test="processKey != null and processKey != ''">and process_key = #{processKey}</if>
|
||||
<if test="processKeyList != null and processKeyList != ''">and process_key in
|
||||
<foreach collection="processKeyList" item="item" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="processName != null and processName != ''">and process_name like concat('%', #{processName},
|
||||
'%')
|
||||
</if>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,156 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.sip.mapper.OmsPurchaseOrderHistoryMapper">
|
||||
|
||||
<resultMap type="OmsPurchaseOrderHistory" id="OmsPurchaseOrderHistoryResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="purchaseId" column="purchase_id" />
|
||||
<result property="purchaseNo" column="purchase_no" />
|
||||
<result property="buyerName" column="buyer_name" />
|
||||
<result property="buyerAddress" column="buyer_address" />
|
||||
<result property="vendorId" column="vendor_id" />
|
||||
<result property="vendorName" column="vendor_name" />
|
||||
<result property="vendorUser" column="vendor_user" />
|
||||
<result property="vendorPhone" column="vendor_phone" />
|
||||
<result property="currency" column="currency" />
|
||||
<result property="purchaserId" column="purchaser_id" />
|
||||
<result property="purchaserName" column="purchaser_name" />
|
||||
<result property="purchaserMobile" column="purchaser_mobile" />
|
||||
<result property="purchaserEmail" column="purchaser_email" />
|
||||
<result property="warehouseId" column="warehouse_id" />
|
||||
<result property="payMethod" column="pay_method" />
|
||||
<result property="ownerId" column="owner_id" />
|
||||
<result property="ownerName" column="owner_name" />
|
||||
<result property="totalAmount" column="total_amount" />
|
||||
<result property="status" column="status" />
|
||||
<result property="approveStatus" column="approve_status" />
|
||||
<result property="approveTime" column="approve_time" />
|
||||
<result property="approveNode" column="approve_node" />
|
||||
<result property="confirmStatus" column="confirm_status" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<result property="version" column="version" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="remark" column="remark" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectOmsPurchaseOrderHistoryVo">
|
||||
select id, purchase_id, purchase_no, buyer_name, buyer_address, vendor_id, vendor_name, vendor_user, vendor_phone, currency, purchaser_id, purchaser_name, purchaser_mobile, purchaser_email, warehouse_id, pay_method, owner_id, owner_name, total_amount, status, approve_status, approve_time, approve_node, confirm_status, del_flag, version, create_by, create_time, update_by, update_time, remark from oms_purchase_order_history
|
||||
</sql>
|
||||
|
||||
<insert id="insertOmsPurchaseOrderHistory" parameterType="OmsPurchaseOrderHistory" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into oms_purchase_order_history
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="purchaseId != null">purchase_id,</if>
|
||||
<if test="purchaseNo != null">purchase_no,</if>
|
||||
<if test="buyerName != null">buyer_name,</if>
|
||||
<if test="buyerAddress != null">buyer_address,</if>
|
||||
<if test="vendorId != null">vendor_id,</if>
|
||||
<if test="vendorName != null">vendor_name,</if>
|
||||
<if test="vendorUser != null">vendor_user,</if>
|
||||
<if test="vendorPhone != null">vendor_phone,</if>
|
||||
<if test="currency != null">currency,</if>
|
||||
<if test="purchaserId != null">purchaser_id,</if>
|
||||
<if test="purchaserName != null">purchaser_name,</if>
|
||||
<if test="purchaserMobile != null">purchaser_mobile,</if>
|
||||
<if test="purchaserEmail != null">purchaser_email,</if>
|
||||
<if test="warehouseId != null">warehouse_id,</if>
|
||||
<if test="payMethod != null">pay_method,</if>
|
||||
<if test="ownerId != null">owner_id,</if>
|
||||
<if test="ownerName != null">owner_name,</if>
|
||||
<if test="totalAmount != null">total_amount,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="approveStatus != null">approve_status,</if>
|
||||
<if test="approveTime != null">approve_time,</if>
|
||||
<if test="approveNode != null">approve_node,</if>
|
||||
<if test="confirmStatus != null">confirm_status,</if>
|
||||
<if test="delFlag != null">del_flag,</if>
|
||||
<if test="version != null">version,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="flowType != null">flow_type,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="purchaseId != null">#{purchaseId},</if>
|
||||
<if test="purchaseNo != null">#{purchaseNo},</if>
|
||||
<if test="buyerName != null">#{buyerName},</if>
|
||||
<if test="buyerAddress != null">#{buyerAddress},</if>
|
||||
<if test="vendorId != null">#{vendorId},</if>
|
||||
<if test="vendorName != null">#{vendorName},</if>
|
||||
<if test="vendorUser != null">#{vendorUser},</if>
|
||||
<if test="vendorPhone != null">#{vendorPhone},</if>
|
||||
<if test="currency != null">#{currency},</if>
|
||||
<if test="purchaserId != null">#{purchaserId},</if>
|
||||
<if test="purchaserName != null">#{purchaserName},</if>
|
||||
<if test="purchaserMobile != null">#{purchaserMobile},</if>
|
||||
<if test="purchaserEmail != null">#{purchaserEmail},</if>
|
||||
<if test="warehouseId != null">#{warehouseId},</if>
|
||||
<if test="payMethod != null">#{payMethod},</if>
|
||||
<if test="ownerId != null">#{ownerId},</if>
|
||||
<if test="ownerName != null">#{ownerName},</if>
|
||||
<if test="totalAmount != null">#{totalAmount},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="approveStatus != null">#{approveStatus},</if>
|
||||
<if test="approveTime != null">#{approveTime},</if>
|
||||
<if test="approveNode != null">#{approveNode},</if>
|
||||
<if test="confirmStatus != null">#{confirmStatus},</if>
|
||||
<if test="delFlag != null">#{delFlag},</if>
|
||||
<if test="version != null">#{version},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="flowType != null">#{flowType},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<select id="selectOmsPurchaseOrderHistoryListByPurchaseId" parameterType="Long" resultMap="OmsPurchaseOrderHistoryResult">
|
||||
<include refid="selectOmsPurchaseOrderHistoryVo"/>
|
||||
where purchase_id = #{purchaseId}
|
||||
order by version desc
|
||||
</select>
|
||||
|
||||
<select id="selectOmsPurchaseOrderHistoryById" parameterType="Long" resultMap="OmsPurchaseOrderHistoryResult">
|
||||
<include refid="selectOmsPurchaseOrderHistoryVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<resultMap type="OmsPurchaseOrderItemHistory" id="OmsPurchaseOrderItemHistoryResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="purchaseHistoryId" column="purchase_history_id" />
|
||||
<result property="originalPurchaseId" column="original_purchase_id" />
|
||||
<result property="productCode" column="product_code" />
|
||||
<result property="innerStatus" column="inner_status" />
|
||||
<result property="quantity" column="quantity" />
|
||||
<result property="price" column="price" />
|
||||
<result property="taxRate" column="tax_rate" />
|
||||
<result property="taxTotal" column="tax_total" />
|
||||
<result property="amountTotal" column="amount_total" />
|
||||
<result property="deliveryDate" column="delivery_date" />
|
||||
<result property="productType" column="product_type" />
|
||||
<result property="productModel" column="product_model" />
|
||||
<result property="productDescription" column="product_description" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="remark" column="remark" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectOmsPurchaseOrderItemHistoryVo">
|
||||
select id, purchase_history_id, original_purchase_id, product_code, inner_status, quantity, price, tax_rate, tax_total, amount_total, delivery_date, product_type, product_model, product_description, create_by, create_time, update_by, update_time, remark from oms_purchase_order_item_history
|
||||
</sql>
|
||||
|
||||
<select id="selectOmsPurchaseOrderItemHistoryListByPurchaseHistoryId" parameterType="Long" resultMap="OmsPurchaseOrderItemHistoryResult">
|
||||
<include refid="selectOmsPurchaseOrderItemHistoryVo"/>
|
||||
where purchase_history_id = #{purchaseHistoryId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.sip.mapper.OmsPurchaseOrderItemHistoryMapper">
|
||||
|
||||
<resultMap type="OmsPurchaseOrderItemHistory" id="OmsPurchaseOrderItemHistoryResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="purchaseHistoryId" column="purchase_history_id" />
|
||||
<result property="originalPurchaseId" column="original_purchase_id" />
|
||||
<result property="productCode" column="product_code" />
|
||||
<result property="innerStatus" column="inner_status" />
|
||||
<result property="quantity" column="quantity" />
|
||||
<result property="price" column="price" />
|
||||
<result property="taxRate" column="tax_rate" />
|
||||
<result property="taxTotal" column="tax_total" />
|
||||
<result property="amountTotal" column="amount_total" />
|
||||
<result property="deliveryDate" column="delivery_date" />
|
||||
<result property="productType" column="product_type" />
|
||||
<result property="productModel" column="product_model" />
|
||||
<result property="productDescription" column="product_description" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="remark" column="remark" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectOmsPurchaseOrderItemHistoryVo">
|
||||
select id, purchase_history_id, original_purchase_id, product_code, inner_status, quantity, price, tax_rate, tax_total, amount_total, delivery_date, product_type, product_model, product_description, create_by, create_time, update_by, update_time, remark from oms_purchase_order_item_history
|
||||
</sql>
|
||||
|
||||
<insert id="batchOmsPurchaseOrderItemHistory" parameterType="java.util.List">
|
||||
insert into oms_purchase_order_item_history (purchase_history_id, original_purchase_id, product_code, inner_status, quantity, price, tax_rate, tax_total, amount_total, delivery_date, product_type, product_model, product_description, create_by, create_time, update_by, update_time, remark) values
|
||||
<foreach item="item" index="index" collection="list" separator=",">
|
||||
(#{item.purchaseHistoryId}, #{item.originalPurchaseId}, #{item.productCode}, #{item.innerStatus}, #{item.quantity}, #{item.price}, #{item.taxRate}, #{item.taxTotal}, #{item.amountTotal}, #{item.deliveryDate}, #{item.productType}, #{item.productModel}, #{item.productDescription}, #{item.createBy}, sysdate(), #{item.updateBy}, sysdate(), #{item.remark})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,312 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.sip.mapper.OmsPurchaseOrderMapper">
|
||||
|
||||
<resultMap type="OmsPurchaseOrder" id="OmsPurchaseOrderResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="purchaseNo" column="purchase_no" />
|
||||
<result property="buyerName" column="buyer_name" />
|
||||
<result property="buyerAddress" column="buyer_address" />
|
||||
<result property="vendorId" column="vendor_id" />
|
||||
<result property="currency" column="currency" />
|
||||
<result property="purchaserId" column="purchaser_id" />
|
||||
<result property="purchaserName" column="purchaser_name" />
|
||||
<result property="purchaserMobile" column="purchaser_mobile" />
|
||||
<result property="purchaserEmail" column="purchaser_email" />
|
||||
<result property="warehouseId" column="warehouse_id" />
|
||||
<result property="payMethod" column="pay_method" />
|
||||
<result property="ownerId" column="owner_id" />
|
||||
<result property="ownerName" column="owner_name" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="totalAmount" column="total_amount" />
|
||||
<result property="status" column="status" />
|
||||
<result property="approveStatus" column="approve_status" />
|
||||
<result property="approveTime" column="approve_time" />
|
||||
<result property="approveNode" column="approve_node" />
|
||||
<result property="confirmStatus" column="confirm_status" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="OmsPurchaseOrderItem" id="OmsPurchaseOrderItemResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="purchaseId" column="purchase_id" />
|
||||
<result property="productCode" column="product_code" />
|
||||
<result property="innerStatus" column="inner_status" />
|
||||
<result property="quantity" column="quantity" />
|
||||
<result property="price" column="price" />
|
||||
<result property="taxRate" column="tax_rate" />
|
||||
<result property="taxTotal" column="tax_total" />
|
||||
<result property="amountTotal" column="amount_total" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectOmsPurchaseOrderVo">
|
||||
select t1.id, t1.purchase_no, t1.buyer_name, t1.buyer_address, t1.vendor_id, t1.currency, t1.purchaser_id, t1.purchaser_name
|
||||
, t1.purchaser_mobile, t1.purchaser_email, t1.warehouse_id, t1.pay_method, t1.owner_id, t1.owner_name, t1.remark, t1.total_amount
|
||||
, t1.status, t1.approve_status, t1.approve_time, t1.approve_node, t1.confirm_status, t1.create_time, t1.update_time, t1.del_flag,t1.version,t1.flow_type
|
||||
from oms_purchase_order t1
|
||||
</sql>
|
||||
<sql id="selectOmsPurchaseOrderItemVo">
|
||||
SELECT
|
||||
t1.id,
|
||||
t1.purchase_id,
|
||||
t1.product_code,
|
||||
t1.quantity,
|
||||
t1.price,
|
||||
t1.tax_rate,
|
||||
t1.tax_total,
|
||||
t1.amount_total,
|
||||
t1.inner_status,
|
||||
t1.delivery_date,
|
||||
t2.type as product_type,t2.model as product_model,t2.description as product_description
|
||||
FROM
|
||||
oms_purchase_order_item t1 left join product_info t2 on t1.product_code = t2.product_code
|
||||
</sql>
|
||||
<sql id="selectOmsPurchaseOrderRelationVo">
|
||||
select t1.id, t1.purchase_no, t1.buyer_name, t1.buyer_address, t1.vendor_id, t1.currency, t1.purchaser_id, t1.purchaser_name
|
||||
, t1.purchaser_mobile, t1.purchaser_email, t1.warehouse_id, t1.pay_method, t1.owner_id, t1.owner_name, t1.remark, t1.total_amount,t1.flow_type
|
||||
, t1.status, t1.approve_status, t1.approve_time, t1.approve_node, t1.confirm_status, t1.create_time, t1.update_time, t1.del_flag,t1.version
|
||||
,t2.vendor_name,t2.vendor_user,t2.vendor_phone
|
||||
from oms_purchase_order t1
|
||||
left join oms_vendor_info t2 on t1.vendor_id = t2.vendor_id
|
||||
</sql>
|
||||
|
||||
<select id="selectOmsPurchaseOrderList" parameterType="OmsPurchaseOrder" resultMap="OmsPurchaseOrderResult">
|
||||
<include refid="selectOmsPurchaseOrderRelationVo"/>
|
||||
<where>
|
||||
<if test="purchaseNo != null and purchaseNo != ''"> and t1.purchase_no = #{purchaseNo}</if>
|
||||
<if test="buyerName != null and buyerName != ''"> and t1.buyer_name = #{buyerName}</if>
|
||||
<if test="vendorId != null "> and t1.vendor_id = #{vendorId}</if>
|
||||
<if test="status != null "> and t1.status = #{status}</if>
|
||||
<if test="confirmStatus != null "> and t1.confirm_status = #{confirmStatus}</if>
|
||||
<if test="approveStatus != null "> and t1.approve_status = #{approveStatus}</if>
|
||||
<if test="flowType != null "> and t1.flow_type = #{flowType}</if>
|
||||
<if test="vendorName != null "> and t2.vendor_name = #{vendorName}</if>
|
||||
<if test="ownerName != null "> and t1.owner_name = #{ownerName}</if>
|
||||
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectOmsPurchaseOrderById" parameterType="Long" resultMap="OmsPurchaseOrderResult">
|
||||
<include refid="selectOmsPurchaseOrderRelationVo"/>
|
||||
where t1.id = #{id}
|
||||
</select>
|
||||
<select id="selectMaxOrderCode" resultType="java.lang.Integer">
|
||||
select ifnull( max(SUBSTR( purchase_no FROM LENGTH(#{province})+1 FOR 3 )), 0 )
|
||||
from oms_purchase_order
|
||||
where purchase_no like concat(#{province}, '%')
|
||||
</select>
|
||||
<select id="listItemByPurchaseId" resultMap="OmsPurchaseOrderItemResult">
|
||||
<include refid="selectOmsPurchaseOrderItemVo"/>
|
||||
where purchase_id = #{purchaseId}
|
||||
</select>
|
||||
<select id="listApprove" resultType="com.ruoyi.sip.domain.OmsPurchaseOrder">
|
||||
select t1.id, t1.purchase_no, t1.buyer_name, t1.buyer_address, t1.vendor_id, t1.currency, t1.purchaser_id, t1.purchaser_name
|
||||
, t1.purchaser_mobile, t1.purchaser_email, t1.warehouse_id, t1.pay_method, t1.owner_id, t1.owner_name, t1.remark, t1.total_amount,t1.flow_type
|
||||
, t1.status, t1.approve_status, t1.approve_time, t1.approve_node, t1.confirm_status, t1.create_time, t1.update_time, t1.del_flag,t1.version
|
||||
,t2.vendor_name,t2.vendor_user,t2.vendor_phone
|
||||
,t3.apply_time,t3.process_key,t3.todo_id,t3.task_id
|
||||
<if test="'bu_todo_completed'.equals(tableName)">
|
||||
,t3.approve_time as todo_approve_time
|
||||
</if>
|
||||
from oms_purchase_order t1
|
||||
left join oms_vendor_info t2 on t1.vendor_id = t2.vendor_id
|
||||
inner join ${tableName} t3 on (t3.process_key in ('purchase_order_online') and t3.approve_user=#{entity.approveUser} and t3.task_name!='商务' and t3.business_key=t1.purchase_no)
|
||||
<where>
|
||||
<if test="entity.purchaseNo != null and entity.purchaseNo != ''"> and t1.purchase_no = #{entity.purchaseNo}</if>
|
||||
<if test="entity.vendorName != null "> and t2.vendor_name = #{entity.vendorName}</if>
|
||||
<if test="entity.ownerName != null "> and t1.owner_name = #{entity.ownerName}</if>
|
||||
<if test="entity.approveUser != null "> and t3.approve_user = #{entity.approveUser}</if>
|
||||
<if test="entity.params.applyTimeStart != null and entity.params.applyTimeEnd != ''">
|
||||
<choose>
|
||||
<when test="entity.params.applyTimeStart != null and entity.params.applyTimeEnd != null">
|
||||
and t3.apply_time between date_format(#{entity.params.applyTimeStart}, '%Y-%m-%d 00:00:00') and
|
||||
date_format(#{entity.params.applyTimeEnd}, '%Y-%m-%d 23:59:59')
|
||||
</when>
|
||||
<when test="entity.params.applyTimeStart != null">
|
||||
and t3.apply_time <![CDATA[ >= ]]> date_format(#{entity.params.applyTimeStart}, '%Y-%m-%d 00:00:00')
|
||||
</when>
|
||||
<when test="entity.params.applyTimeEnd != null">
|
||||
and t3.apply_time <![CDATA[ <= ]]> date_format(#{entity.params.applyTimeEnd}, '%Y-%m-%d 23:59:59')
|
||||
</when>
|
||||
|
||||
</choose>
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="selectByNo" resultType="com.ruoyi.sip.domain.OmsPurchaseOrder">
|
||||
<include refid="selectOmsPurchaseOrderRelationVo"/>
|
||||
where t1.purchase_no = #{businessKey}
|
||||
</select>
|
||||
<select id="listByCodeList" resultType="com.ruoyi.sip.domain.OmsPurchaseOrder">
|
||||
<include refid="selectOmsPurchaseOrderRelationVo"/>
|
||||
where t1.purchase_no in
|
||||
<foreach item="item" collection="list" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<insert id="insertOmsPurchaseOrder" parameterType="OmsPurchaseOrder" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into oms_purchase_order
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="purchaseNo != null">purchase_no,</if>
|
||||
<if test="buyerName != null">buyer_name,</if>
|
||||
<if test="buyerAddress != null">buyer_address,</if>
|
||||
<if test="vendorId != null">vendor_id,</if>
|
||||
<if test="currency != null">currency,</if>
|
||||
<if test="purchaserId != null">purchaser_id,</if>
|
||||
<if test="purchaserName != null">purchaser_name,</if>
|
||||
<if test="purchaserMobile != null">purchaser_mobile,</if>
|
||||
<if test="purchaserEmail != null">purchaser_email,</if>
|
||||
<if test="warehouseId != null">warehouse_id,</if>
|
||||
<if test="payMethod != null">pay_method,</if>
|
||||
<if test="ownerId != null">owner_id,</if>
|
||||
<if test="ownerName != null">owner_name,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="totalAmount != null">total_amount,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="approveStatus != null">approve_status,</if>
|
||||
<if test="approveTime != null">approve_time,</if>
|
||||
<if test="approveNode != null">approve_node,</if>
|
||||
<if test="confirmStatus != null">confirm_status,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="delFlag != null">del_flag,</if>
|
||||
<if test="version != null">version,</if>
|
||||
<if test="flowType != null">flow_type,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="purchaseNo != null">#{purchaseNo},</if>
|
||||
<if test="buyerName != null">#{buyerName},</if>
|
||||
<if test="buyerAddress != null">#{buyerAddress},</if>
|
||||
<if test="vendorId != null">#{vendorId},</if>
|
||||
<if test="currency != null">#{currency},</if>
|
||||
<if test="purchaserId != null">#{purchaserId},</if>
|
||||
<if test="purchaserName != null">#{purchaserName},</if>
|
||||
<if test="purchaserMobile != null">#{purchaserMobile},</if>
|
||||
<if test="purchaserEmail != null">#{purchaserEmail},</if>
|
||||
<if test="warehouseId != null">#{warehouseId},</if>
|
||||
<if test="payMethod != null">#{payMethod},</if>
|
||||
<if test="ownerId != null">#{ownerId},</if>
|
||||
<if test="ownerName != null">#{ownerName},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="totalAmount != null">#{totalAmount},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="approveStatus != null">#{approveStatus},</if>
|
||||
<if test="approveTime != null">#{approveTime},</if>
|
||||
<if test="approveNode != null">#{approveNode},</if>
|
||||
<if test="confirmStatus != null">#{confirmStatus},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="delFlag != null">#{delFlag},</if>
|
||||
<if test="version != null">#{version},</if>
|
||||
<if test="flowType != null">#{flowType},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateOmsPurchaseOrder" parameterType="OmsPurchaseOrder">
|
||||
update oms_purchase_order
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="purchaseNo != null">purchase_no = #{purchaseNo},</if>
|
||||
<if test="buyerName != null">buyer_name = #{buyerName},</if>
|
||||
<if test="buyerAddress != null">buyer_address = #{buyerAddress},</if>
|
||||
<if test="vendorId != null">vendor_id = #{vendorId},</if>
|
||||
<if test="currency != null">currency = #{currency},</if>
|
||||
<if test="purchaserId != null">purchaser_id = #{purchaserId},</if>
|
||||
<if test="purchaserName != null">purchaser_name = #{purchaserName},</if>
|
||||
<if test="purchaserMobile != null">purchaser_mobile = #{purchaserMobile},</if>
|
||||
<if test="purchaserEmail != null">purchaser_email = #{purchaserEmail},</if>
|
||||
<if test="warehouseId != null">warehouse_id = #{warehouseId},</if>
|
||||
<if test="payMethod != null">pay_method = #{payMethod},</if>
|
||||
<if test="ownerId != null">owner_id = #{ownerId},</if>
|
||||
<if test="ownerName != null">owner_name = #{ownerName},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="totalAmount != null">total_amount = #{totalAmount},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="approveStatus != null">approve_status = #{approveStatus},</if>
|
||||
<if test="approveTime != null">approve_time = #{approveTime},</if>
|
||||
<if test="approveNode != null">approve_node = #{approveNode},</if>
|
||||
<if test="confirmStatus != null">confirm_status = #{confirmStatus},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||
<if test="version != null">version = #{version},</if>
|
||||
<if test="flowType != null">flow_type=#{flowType},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="updateOmsPurchaseOrderStatus" parameterType="OmsPurchaseOrder">
|
||||
update oms_purchase_order
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="buyerName != null">buyer_name = #{buyerName},</if>
|
||||
<if test="buyerAddress != null">buyer_address = #{buyerAddress},</if>
|
||||
<if test="vendorId != null">vendor_id = #{vendorId},</if>
|
||||
<if test="currency != null">currency = #{currency},</if>
|
||||
<if test="purchaserId != null">purchaser_id = #{purchaserId},</if>
|
||||
<if test="purchaserName != null">purchaser_name = #{purchaserName},</if>
|
||||
<if test="purchaserMobile != null">purchaser_mobile = #{purchaserMobile},</if>
|
||||
<if test="purchaserEmail != null">purchaser_email = #{purchaserEmail},</if>
|
||||
<if test="warehouseId != null">warehouse_id = #{warehouseId},</if>
|
||||
<if test="payMethod != null">pay_method = #{payMethod},</if>
|
||||
<if test="ownerId != null">owner_id = #{ownerId},</if>
|
||||
<if test="ownerName != null">owner_name = #{ownerName},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="totalAmount != null">total_amount = #{totalAmount},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="approveStatus != null">approve_status = #{approveStatus},</if>
|
||||
<if test="approveTime != null">approve_time = #{approveTime},</if>
|
||||
<if test="approveNode != null">approve_node = #{approveNode},</if>
|
||||
<if test="confirmStatus != null">confirm_status = #{confirmStatus},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||
<if test="version != null">version = #{version},</if>
|
||||
<if test="flowType != null">flow_type=#{flowType},</if>
|
||||
</trim>
|
||||
where purchase_no = #{purchaseNo}
|
||||
</update>
|
||||
<update id="updateOmsPurchaseOrderByCode">
|
||||
update oms_purchase_order
|
||||
<set>
|
||||
|
||||
</set>
|
||||
set approve_status = #{approveStatus},
|
||||
approve_time = #{approveTime},
|
||||
update_time = #{updateTime}
|
||||
where purchase_no = #{purchaseNo}
|
||||
</update>
|
||||
|
||||
<delete id="deleteOmsPurchaseOrderById" parameterType="Long">
|
||||
delete from oms_purchase_order where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteOmsPurchaseOrderByIds" parameterType="String">
|
||||
delete from oms_purchase_order where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteOmsPurchaseOrderItemByPurchaseIds" parameterType="String">
|
||||
delete from oms_purchase_order_item where purchase_id in
|
||||
<foreach item="purchaseId" collection="array" open="(" separator="," close=")">
|
||||
#{purchaseId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteOmsPurchaseOrderItemByPurchaseId" parameterType="Long">
|
||||
delete from oms_purchase_order_item where purchase_id = #{purchaseId}
|
||||
</delete>
|
||||
|
||||
<insert id="batchOmsPurchaseOrderItem">
|
||||
insert into oms_purchase_order_item( purchase_id, product_code, inner_status, quantity, price, tax_rate, tax_total, amount_total,delivery_date) values
|
||||
<foreach item="item" index="index" collection="list" separator=",">
|
||||
( #{item.purchaseId}, #{item.productCode}, #{item.innerStatus}, #{item.quantity},
|
||||
#{item.price}, #{item.taxRate}, #{item.taxTotal}, #{item.amountTotal}, #{item.deliveryDate})
|
||||
</foreach>
|
||||
</insert>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue