feat(approve): 新增采购单审批功能模块
- 新增审批状态枚举类 ApproveStatusEnum - 扩展流程定义配置,增加线上线下订单及采购单审批字段 - 新增流程相关 API 接口,包括待办详情和已完成流程列表查询 - 新增采购单审批页面,支持审批操作、流转历史查看 - 新增采购单历史记录实体类及相关服务接口和 Mapper 实现 - 修改采购单实体类,调整审批状态为字符串类型并新增相关字段 - 更新采购单控制器,增加审批列表、历史记录查询接口 - 增加采购单历史详情抽屉展示功能,支持版本管理 - 优化前端审批状态判断逻辑,统一使用字符串比较 - 新增采购单申请时设置审批状态为"待审核"的功能逻辑dev_1.0.0
parent
3353de9b2f
commit
b3f1fdf2ae
|
|
@ -0,0 +1,19 @@
|
|||
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
|
||||
})
|
||||
}
|
||||
|
|
@ -9,6 +9,15 @@ export function listPurchaseorder(query) {
|
|||
})
|
||||
}
|
||||
|
||||
// 查询待审批采购单主表列表
|
||||
export function listApprovePurchaseorder(query) {
|
||||
return request({
|
||||
url: '/sip/purchaseorder/approveList',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询采购单主表详细
|
||||
export function getPurchaseorder(id) {
|
||||
return request({
|
||||
|
|
@ -44,6 +53,22 @@ export function applyPurchaseorder(data) {
|
|||
})
|
||||
}
|
||||
|
||||
// 查询采购单历史记录
|
||||
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({
|
||||
|
|
|
|||
|
|
@ -0,0 +1,288 @@
|
|||
<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="采购单详情" :style="{ 'max-height': '90vh' }" >
|
||||
<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> <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>
|
||||
|
||||
<el-divider content-position="left">审批操作</el-divider>
|
||||
<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-item>
|
||||
<el-button type="primary" @click="showConfirmDialog('approve')">同意</el-button>
|
||||
<el-button type="danger" @click="showConfirmDialog('reject')">驳回</el-button>
|
||||
<el-button @click="detailDialogVisible = false">取消</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 审批确认对话框 (二级) -->
|
||||
<el-dialog :title="confirmDialogTitle" :visible.sync="confirmDialogVisible" width="50%" append-to-body>
|
||||
<div v-loading="confirmDetailLoading">
|
||||
<p v-if="confirmDetailData">确认提交对 **{{ confirmDetailData.applyUserName }}** 发起的 **{{ confirmDetailData.taskName }}** 的审批吗?</p>
|
||||
<el-empty v-else description="暂无审批详情数据"></el-empty>
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="confirmDialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="submitApproval">确 定</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 } 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' }],
|
||||
},
|
||||
// 确认对话框数据
|
||||
confirmDialogVisible: false,
|
||||
confirmDialogTitle: '',
|
||||
confirmDetailLoading: false,
|
||||
confirmDetailData: null,
|
||||
currentApproveType: '',
|
||||
currentOrderId: 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.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 = [];
|
||||
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 = [];
|
||||
}
|
||||
},
|
||||
// 确认对话框方法
|
||||
showConfirmDialog(type) {
|
||||
this.$refs.opinionForm.validate(valid => {
|
||||
if (valid) {
|
||||
this.currentApproveType = type;
|
||||
this.confirmDialogTitle = type === 'approve' ? '同意审批' : '驳回审批';
|
||||
this.confirmDetailData = null;
|
||||
this.confirmDialogVisible = true;
|
||||
this.confirmDetailLoading = true;
|
||||
|
||||
// 模拟调用 getTodoDetail
|
||||
setTimeout(() => {
|
||||
this.confirmDetailData = {
|
||||
taskName: "采购单审批流程",
|
||||
assigneeName: "当前用户",
|
||||
applyUserName: this.form.ownerName,
|
||||
applyTime: this.form.createTime,
|
||||
remark: "请尽快处理"
|
||||
};
|
||||
this.confirmDetailLoading = false;
|
||||
}, 500);
|
||||
}
|
||||
});
|
||||
},
|
||||
submitApproval() {
|
||||
const action = this.currentApproveType === 'approve' ? '审批通过' : '审批驳回';
|
||||
this.$modal.msgSuccess(action);
|
||||
this.confirmDialogVisible = false;
|
||||
this.detailDialogVisible = false;
|
||||
this.getList(); // 刷新列表
|
||||
},
|
||||
// 通用方法
|
||||
getStatusText(status) {
|
||||
const textMap = { '1': '审批中', '2': '批准', '3': '驳回' };
|
||||
return textMap[String(status)] || '未知';
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.process-container {
|
||||
padding: 10px;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<h2>已审批列表 (待实现)</h2>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "PurchaseOrderApprovedList"
|
||||
};
|
||||
</script>
|
||||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,368 @@
|
|||
<template>
|
||||
<div style="max-height: 70vh;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;
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getVendorList().then(() => {
|
||||
getDicts("product_type").then(response => {
|
||||
this.productTypeOptions = response.data;
|
||||
});
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
loadPurchaseOrder(id) {
|
||||
if (this.orderData) {
|
||||
this.form = this.orderData;
|
||||
this.handleVendorChange(this.form.vendorId);
|
||||
} else if (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' "
|
||||
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 === '3'"
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-view"
|
||||
|
|
@ -186,14 +186,31 @@
|
|||
:visible.sync="showDetailDrawer"
|
||||
direction="rtl"
|
||||
size="80%"
|
||||
append-to-body
|
||||
>
|
||||
<ApproveLayout title="紫光汇智信息技术有限公司" >
|
||||
<ApproveLayout title="采购单详情" :style="{ 'max-height': '90vh' }" v-if="showDetailDrawer">
|
||||
<purchase-order-detail-view ref="detailViewOnly" @close="showDetailDrawer = false"
|
||||
@success="getList">
|
||||
@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="采购单历史详情" :style="{ 'max-height': '90vh' }" 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 +224,9 @@ import {
|
|||
delPurchaseorder,
|
||||
addPurchaseorder,
|
||||
updatePurchaseorder,
|
||||
applyPurchaseorder
|
||||
applyPurchaseorder,
|
||||
getPurchaseOrderHistory,
|
||||
getPurchaseOrderHistoryDetail
|
||||
} from "@/api/sip/purchaseorder";
|
||||
import PurchaseOrderDetail from './components/PurchaseOrderDetail';
|
||||
import ApproveLayout from "@/views/approve/ApproveLayout.vue";
|
||||
|
|
@ -248,6 +267,10 @@ export default {
|
|||
detailOrderId: null,
|
||||
// 当前详情订单编号
|
||||
currentDetailPurchaseNo: null,
|
||||
// 是否显示历史详情抽屉
|
||||
showHistoryDetailDrawer: false,
|
||||
// 历史详情订单数据
|
||||
historyDetailOrderData: null,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
|
|
@ -289,8 +312,20 @@ export default {
|
|||
})
|
||||
} else {
|
||||
this.detailOrderId = null;
|
||||
this.currentDetailPurchaseNo = null;
|
||||
this.$refs.detailViewOnly?.resetForm();
|
||||
}
|
||||
},
|
||||
// 监听历史详情抽屉变化
|
||||
showHistoryDetailDrawer(val) {
|
||||
if (!val) {
|
||||
this.historyDetailOrderData = null;
|
||||
this.$refs.historyDetailView?.resetForm();
|
||||
}else{
|
||||
this.$nextTick(()=>{
|
||||
this.$refs.historyDetailView?.loadPurchaseOrder(this.detailOrderId)
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
|
@ -358,7 +393,7 @@ export default {
|
|||
handleApply(row) {
|
||||
this.$modal.confirm('是否确认申请采购编号为"' + row.purchaseNo + '"的数据项?').then(() => {
|
||||
let form = {...row};
|
||||
form.approveStatus = 1; // 设置审批状态为 1 (审批中)
|
||||
form.approveStatus = '1'; // 设置审批状态为 1 (审批中)
|
||||
return applyPurchaseorder(form);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
|
|
@ -371,6 +406,14 @@ export default {
|
|||
this.detailOrderId = row.id;
|
||||
this.currentDetailPurchaseNo = row.purchaseNo;
|
||||
this.showDetailDrawer = true;
|
||||
},
|
||||
/** 处理查看历史详情事件 */
|
||||
handleViewHistoryDetailEvent(row) {
|
||||
getPurchaseOrderHistoryDetail(row.id).then(response => {
|
||||
this.historyDetailOrderData = response.data;
|
||||
this.showHistoryDetailDrawer = true;
|
||||
this.showDetailDrawer = false; // 关闭当前详情抽屉
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
|
|
|
|||
|
|
@ -7,6 +7,9 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
|||
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;
|
||||
|
|
@ -28,6 +31,11 @@ public class OmsPurchaseOrderController extends BaseController
|
|||
@Autowired
|
||||
private IOmsPurchaseOrderService omsPurchaseOrderService;
|
||||
|
||||
@Autowired
|
||||
private IOmsPurchaseOrderHistoryService omsPurchaseOrderHistoryService;
|
||||
@Autowired
|
||||
private TodoService todoService;
|
||||
|
||||
/**
|
||||
* 查询采购单主表列表
|
||||
*/
|
||||
|
|
@ -40,6 +48,20 @@ public class OmsPurchaseOrderController extends BaseController
|
|||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出采购单主表列表
|
||||
*/
|
||||
|
|
@ -96,6 +118,26 @@ 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));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除采购单主表
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
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;
|
||||
|
|
@ -73,7 +74,10 @@ public class OmsPurchaseOrder extends BaseEntity
|
|||
private Integer status;
|
||||
|
||||
/** 审批状态(0草稿 1审批中 2已通过 3驳回) */
|
||||
private Integer approveStatus;
|
||||
private String approveStatus;
|
||||
|
||||
/** 审批时间 */
|
||||
private Date approveTime;
|
||||
|
||||
/** 当前审批节点 */
|
||||
private String approveNode;
|
||||
|
|
@ -86,6 +90,11 @@ public class OmsPurchaseOrder extends BaseEntity
|
|||
|
||||
/** 版本号 */
|
||||
private Integer version;
|
||||
private Long approveUser;
|
||||
private Date applyTime;
|
||||
private String processKey;
|
||||
private String todoId;
|
||||
|
||||
|
||||
/** 采购单明细表信息 */
|
||||
private List<OmsPurchaseOrderItem> omsPurchaseOrderItemList;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,93 @@
|
|||
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 Integer confirmStatus;
|
||||
|
||||
/** 删除标志(0正常 1删除) */
|
||||
private Integer delFlag;
|
||||
|
||||
/** 版本号 */
|
||||
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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ import com.ruoyi.common.core.text.Convert;
|
|||
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 +69,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 +165,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);
|
||||
|
|
@ -229,9 +232,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 +347,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);
|
||||
}
|
||||
|
|
@ -90,4 +90,12 @@ public interface OmsPurchaseOrderMapper
|
|||
List<OmsPurchaseOrderItem> listItemByPurchaseId(Long id);
|
||||
|
||||
int updateOmsPurchaseOrderStatus(OmsPurchaseOrder omsPurchaseOrder);
|
||||
|
||||
void updateOmsPurchaseOrderByCode(OmsPurchaseOrder omsPurchaseOrder);
|
||||
|
||||
List<OmsPurchaseOrder> listApprove(OmsPurchaseOrder omsPurchaseOrder);
|
||||
|
||||
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接口
|
||||
|
|
@ -66,4 +67,6 @@ public interface IOmsPurchaseOrderService
|
|||
* @return 结果
|
||||
*/
|
||||
public int deleteOmsPurchaseOrderById(Long id);
|
||||
|
||||
List<OmsPurchaseOrder> listApprove(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,12 @@ public class OmsPurchaseOrderServiceImpl implements IOmsPurchaseOrderService
|
|||
return omsPurchaseOrderMapper.deleteOmsPurchaseOrderById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OmsPurchaseOrder> listApprove(OmsPurchaseOrder omsPurchaseOrder) {
|
||||
return omsPurchaseOrderMapper.listApprove(omsPurchaseOrder);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增采购单明细表信息
|
||||
*
|
||||
|
|
@ -229,5 +290,97 @@ public class OmsPurchaseOrderServiceImpl implements IOmsPurchaseOrderService
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean multiInstanceApproveCallback(String activityName, ProcessInstance processInstance) {
|
||||
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);
|
||||
} else if (approveBtn.equals(1)) {
|
||||
|
||||
// 审批通过处理
|
||||
if ("公司领导".equals(taskName)) {
|
||||
handleCompanyLeaderApproval(businessKey);
|
||||
// //黄雪秋处理 流程状态更改
|
||||
// if (ShiroUtils.getUserId().equals(118L)) {
|
||||
// handleCompanyLeaderApproval(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,154 @@
|
|||
<?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>
|
||||
</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>
|
||||
</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,299 @@
|
|||
<?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
|
||||
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.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 purchase_no = #{purchaseNo}</if>
|
||||
<if test="vendorId != null "> and vendor_id = #{vendorId}</if>
|
||||
<if test="status != null "> and status = #{status}</if>
|
||||
<if test="approveStatus != null "> and approve_status = #{approveStatus}</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.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
|
||||
from oms_purchase_order t1
|
||||
left join oms_vendor_info t2 on t1.vendor_id = t2.vendor_id
|
||||
inner join bu_todo t3 on t3.process_key in ('purchase_order_online') and t3.business_key=t1.purchase_no
|
||||
<where>
|
||||
<if test="purchaseNo != null and purchaseNo != ''"> and t1.purchase_no = #{purchaseNo}</if>
|
||||
<if test="vendorName != null "> and t2.vendor_name = #{vendorName}</if>
|
||||
<if test="ownerName != null "> and t1.owner_name = #{ownerName}</if>
|
||||
<if test="approveUser != null "> and t3.approve_user = #{approveUser}</if>
|
||||
<if test="params.applyTimeStart != null and params.applyTimeEnd != ''">
|
||||
<choose>
|
||||
<when test="params.applyTimeStart != null and params.applyTimeEnd != null">
|
||||
and t3.apply_time between date_format(#{params.applyTimeStart}, '%Y-%m-%d 00:00:00') and
|
||||
date_format(#{params.applyTimeEnd}, '%Y-%m-%d 23:59:59')
|
||||
</when>
|
||||
<when test="params.applyTimeStart != null">
|
||||
and t3.apply_time <![CDATA[ >= ]]> date_format(#{params.applyTimeStart}, '%Y-%m-%d 00:00:00')
|
||||
</when>
|
||||
<when test="params.applyTimeEnd != null">
|
||||
and t3.apply_time <![CDATA[ <= ]]> date_format(#{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>
|
||||
</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>
|
||||
</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>
|
||||
</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>
|
||||
</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