Commit 99dfb0b04bdd9e01d2ce82218bd6bfcdf9d6d5f0
1 parent
6b540ec5
优化入库单审核流程
Showing
12 changed files
with
447 additions
and
74 deletions
ant-design-vue-jeecg/src/api/api.js
... | ... | @@ -215,6 +215,14 @@ export const queryWarehouse = (params) => getAction("/config/sysUserWarehouse/qu |
215 | 215 | export const getAllWarehouseList = (params) => getAction("/config/warehouse/getAllWarehouseList", params); |
216 | 216 | //查询所有库区 |
217 | 217 | export const getAllZoneList = (params) => getAction("/config/zone/getAllZoneList", params); |
218 | + | |
219 | +//入库单提交审核 | |
220 | +export const createReceiptAuditFlow = (params) => getAction("/audit/audit/createReceiptAuditFlow", params); | |
221 | +//入库单审核 | |
222 | +export const auditReceipt = (params) => getAction("/audit/audit/auditReceipt", params); | |
223 | +//查询审核流程进度 | |
224 | +export const searchAuditFlow = (params) => getAction("/audit/audit/searchAuditFlow", params); | |
225 | + | |
218 | 226 | // 中转HTTP请求 |
219 | 227 | export const transitRESTful = { |
220 | 228 | get: (url, parameter) => getAction(getTransitURL(url), parameter), |
... | ... |
ant-design-vue-jeecg/src/views/system/flow/FlowProcess.vue
0 → 100644
1 | +<template> | |
2 | + <j-modal | |
3 | + :title="title" | |
4 | + :width="width" | |
5 | + :visible="visible" | |
6 | + :confirmLoading="confirmLoading" | |
7 | + @ok="close" | |
8 | + @cancel="close" | |
9 | + cancelText="关闭"> | |
10 | + <a-card :bordered="false"> | |
11 | + <div> | |
12 | + <div style="font-size: 16px; color: rgba(0, 0, 0, 0.85); font-weight: 500; margin-bottom: 20px;">订单编号:{{flowInfo.code}}</div> | |
13 | + <a-row style="margin-bottom: 16px"> | |
14 | + <a-col :xs="24" :sm="12" :md="12" :lg="12" :xl="6"> | |
15 | + <span style="color: rgba(0, 0, 0, 0.85)">创建人:{{flowInfo.createBy}}</span> | |
16 | + </a-col> | |
17 | + <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="12"> | |
18 | + <span style="color: rgba(0, 0, 0, 0.85)">创建时间:{{flowInfo.createTime}}</span> | |
19 | + </a-col> | |
20 | + </a-row> | |
21 | + | |
22 | + <a-card :bordered="false" title="流程进度"> | |
23 | + <a-steps style="margin-right: 14px;" :direction="isMobile() && 'vertical' || 'horizontal'" :current="flowInfo.seq-1" progressDot> | |
24 | + <a-step v-for="(sa,index) in flowInfo.list" :title="sa.auditor"> | |
25 | + <div style="fontSize: 12px; color: rgba(0, 0, 0, 0.45); position: relative; left:8px;" | |
26 | + slot="description"> | |
27 | + <div v-if="sa.sequence=='0'" style="margin: 8px 0 4px;font-size:16px;" > | |
28 | + 创建单据 | |
29 | + </div> | |
30 | + <div v-if="sa.status=='1'&&index!=flowInfo.list.length-1" style="margin: 8px 0 4px;font-size:16px;color: #00DB00"> | |
31 | + 审核通过 | |
32 | + </div> | |
33 | + <div v-if="sa.status=='2'" style="margin: 8px 0 4px;font-size:16px;color: red"> | |
34 | + 审核驳回 | |
35 | + </div> | |
36 | + <div v-if="sa.status==null&&sa.sequence!='0'" style="margin: 8px 0 4px;font-size:16px;color:lightseagreen"> | |
37 | + 待审核 | |
38 | + </div> | |
39 | + <div v-if="sa.status=='1'&&index==flowInfo.list.length-1" style="margin: 8px 0 4px;font-size:16px;color: #50bfff"> | |
40 | + 审核完成 | |
41 | + </div> | |
42 | + <div v-if="sa.remark!=null&&sa.remark!=''" style="margin: 8px 0 4px"> | |
43 | + 备注:{{sa.remark}} | |
44 | + </div> | |
45 | + <div v-if="sa.updateTime==null" style="margin: 8px 0 4px"> | |
46 | + 时间:{{sa.createTime}} | |
47 | + </div> | |
48 | + <div v-if="sa.updateTime!=null" style="margin: 8px 0 4px"> | |
49 | + 时间:{{sa.updateTime}} | |
50 | + </div> | |
51 | + </div> | |
52 | + </a-step> | |
53 | + </a-steps> | |
54 | + </a-card> | |
55 | + </div> | |
56 | + </a-card> | |
57 | + </j-modal> | |
58 | +</template> | |
59 | + | |
60 | +<script> | |
61 | + | |
62 | +import {mixinDevice} from '@/utils/mixin.js' | |
63 | +import {searchAuditFlow} from '@/api/api' | |
64 | +const directionType = { | |
65 | + horizontal: 'horizontal', | |
66 | + vertical: 'vertical' | |
67 | +} | |
68 | + | |
69 | +export default { | |
70 | + name: "Success", | |
71 | + components: { | |
72 | + }, | |
73 | + mixins: [mixinDevice], | |
74 | + data() { | |
75 | + return { | |
76 | + confirmLoading: false, | |
77 | + visible: false, | |
78 | + title: '审核流程进度', | |
79 | + width: 1100, | |
80 | + directionType, | |
81 | + flowInfo:[] | |
82 | + } | |
83 | + }, | |
84 | + methods: { | |
85 | + close() { | |
86 | + this.$emit('close'); | |
87 | + this.visible = false; | |
88 | + this.$refs.form.clearValidate(); | |
89 | + }, | |
90 | + edit(record) { | |
91 | + this.visible = true; | |
92 | + let params={ | |
93 | + receiptId:record.id, | |
94 | + } | |
95 | + searchAuditFlow(params).then((res) => { | |
96 | + this.flowInfo=res; | |
97 | + }); | |
98 | + }, | |
99 | + } | |
100 | +} | |
101 | +</script> | |
102 | + | |
103 | +<style > | |
104 | +.ant-steps-item-description{ | |
105 | + margin-right: 14px !important; | |
106 | +} | |
107 | +</style> | |
0 | 108 | \ No newline at end of file |
... | ... |
ant-design-vue-jeecg/src/views/system/receipt/ReceiptHeaderList.vue
... | ... | @@ -176,13 +176,17 @@ |
176 | 176 | <a-popconfirm v-has="'receiptHeader:back'" v-if="record.lastStatus == 800" title="确定回传吗?" @confirm="() => hanleBack(record)"> |
177 | 177 | <a><a-button type="default">回传</a-button><a-divider type="vertical"/></a> |
178 | 178 | </a-popconfirm> |
179 | - <a v-if="record.lastStatus < 800 && record.nextAuditor ==null " @click="receive(record)" v-has="'receiptHeader:receive'"><a-button type="primary">组盘</a-button><a-divider type="vertical"/></a> | |
179 | + <a v-if="record.lastStatus < 800 && record.firstStatus ==15 " @click="receive(record)" v-has="'receiptHeader:receive'"><a-button type="primary">组盘</a-button><a-divider type="vertical"/></a> | |
180 | + <a v-if="record.firstStatus == '0' " @click="createAudit(record)"><a-button type="primary">提交审核</a-button><a-divider type="vertical"/></a> | |
180 | 181 | <a v-if="record.nextAuditor == username " @click="audit(record)"><a-button type="primary">审核</a-button><a-divider type="vertical"/></a> |
181 | 182 | <a v-if="record.lastStatus == 850" @click="viewReason(record)"><a-button type="danger">原因</a-button><a-divider type="vertical"/></a> |
182 | 183 | <a-dropdown> |
183 | 184 | <a class="ant-dropdown-link">更多 <a-icon type="down"/></a> |
184 | 185 | <a-menu slot="overlay"> |
185 | 186 | <a-menu-item v-has="'receiptHeader:edit'"> |
187 | + <a v-if="record.firstStatus > 0 " @click="openProcess(record)"><a-button type="primary">审核进度</a-button><a-divider type="vertical"/></a> | |
188 | + </a-menu-item> | |
189 | + <a-menu-item v-has="'receiptHeader:edit'"> | |
186 | 190 | <a @click="handleEdit(record)">编辑</a> |
187 | 191 | </a-menu-item> |
188 | 192 | <a-menu-item v-has="'receiptHeader:delete'"> |
... | ... | @@ -207,6 +211,7 @@ |
207 | 211 | <receiptHeader-modal ref="modalForm" @ok="modalFormOk"></receiptHeader-modal> |
208 | 212 | <receive-modal ref="modalForm2" @ok="modalFormOk"></receive-modal> |
209 | 213 | <receipt-audit-modal ref="auditForm"></receipt-audit-modal> |
214 | + <flow-process ref="porcessForm"></flow-process> | |
210 | 215 | </a-card> |
211 | 216 | </template> |
212 | 217 | |
... | ... | @@ -221,9 +226,10 @@ import {initDictOptions, filterMultiDictText} from '@/components/dict/JDictSelec |
221 | 226 | import '@/assets/less/TableExpand.less' |
222 | 227 | import {getCompanyList} from '@/api/api' |
223 | 228 | import {getReceiptTypeList} from '@/api/api' |
224 | -import {getSupplierList, backErpReceipt} from '@/api/api' | |
229 | +import {getSupplierList, backErpReceipt,createReceiptAuditFlow} from '@/api/api' | |
225 | 230 | import ReceiveModal from "./modules/ReceiveModal"; |
226 | 231 | import { notification } from 'ant-design-vue'; |
232 | +import FlowProcess from "../flow/FlowProcess"; | |
227 | 233 | import store from '@/store' |
228 | 234 | |
229 | 235 | |
... | ... | @@ -235,6 +241,7 @@ export default { |
235 | 241 | ReceiveModal, |
236 | 242 | ReceiptDetailList, |
237 | 243 | ReceiptHeaderModal, |
244 | + FlowProcess, | |
238 | 245 | username:'' |
239 | 246 | }, |
240 | 247 | data() { |
... | ... | @@ -418,8 +425,26 @@ export default { |
418 | 425 | this.selectedMainId = '' |
419 | 426 | }, |
420 | 427 | audit(record){ |
421 | - this.$refs.auditForm.edit(record) | |
422 | - | |
428 | + this.$refs.auditForm.edit(record,this.username) | |
429 | + }, | |
430 | + createAudit(record){ | |
431 | + let params={ | |
432 | + receiptId:record.id, | |
433 | + type:record.type, | |
434 | + createBy:record.createBy | |
435 | + } | |
436 | + createReceiptAuditFlow(params).then((res) => { | |
437 | + if (res.success) { | |
438 | + //this.$message.success(res.message) | |
439 | + this.$refs.porcessForm.edit(record) | |
440 | + this.loadData(); | |
441 | + }else { | |
442 | + this.$message.error(res.message) | |
443 | + } | |
444 | + }); | |
445 | + }, | |
446 | + openProcess(record){ | |
447 | + this.$refs.porcessForm.edit(record) | |
423 | 448 | }, |
424 | 449 | onSelectChange(selectedRowKeys, selectionRows) { |
425 | 450 | this.selectedMainId = selectedRowKeys[0].toString(); |
... | ... |
ant-design-vue-jeecg/src/views/system/receipt/modules/ReceiptAuditModal.vue
... | ... | @@ -9,7 +9,7 @@ |
9 | 9 | @cancel="handleCancel" |
10 | 10 | cancelText="关闭"> |
11 | 11 | <a-spin :spinning="confirmLoading"> |
12 | - <a-form-model ref="form" :model="model" :rules="validatorRules"> | |
12 | + <a-form-model ref="form" :model="model" > | |
13 | 13 | <a-row> |
14 | 14 | <a-col :span="24"> |
15 | 15 | <a-form-model-item label="审核结果" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="companyCode"> |
... | ... | @@ -34,10 +34,7 @@ |
34 | 34 | <script> |
35 | 35 | |
36 | 36 | import {httpAction} from '@/api/manage' |
37 | -import {validateDuplicateValue} from '@/utils/util' | |
38 | -import {getCompanyList} from '@/api/api' | |
39 | -import {getReceiptTypeList} from '@/api/api' | |
40 | -import {getSupplierList} from '@/api/api' | |
37 | +import {auditReceipt} from '@/api/api' | |
41 | 38 | |
42 | 39 | export default { |
43 | 40 | name: "ReceiptAuditModal", |
... | ... | @@ -48,6 +45,8 @@ export default { |
48 | 45 | width: 800, |
49 | 46 | visible: false, |
50 | 47 | model: {}, |
48 | + receiptId: '', | |
49 | + username: '', | |
51 | 50 | labelCol: { |
52 | 51 | xs: {span: 24}, |
53 | 52 | sm: {span: 5}, |
... | ... | @@ -70,7 +69,9 @@ export default { |
70 | 69 | this.modelDefault = JSON.parse(JSON.stringify(this.model)); |
71 | 70 | }, |
72 | 71 | methods: { |
73 | - edit(record) { | |
72 | + edit(record,username) { | |
73 | + this.receiptId=record.id | |
74 | + this.username=username | |
74 | 75 | this.model = Object.assign({}, record); |
75 | 76 | this.visible = true; |
76 | 77 | }, |
... | ... | @@ -80,35 +81,21 @@ export default { |
80 | 81 | this.$refs.form.clearValidate(); |
81 | 82 | }, |
82 | 83 | handleOk() { |
83 | - const that = this; | |
84 | - // 触发表单验证 | |
85 | - this.$refs.form.validate(valid => { | |
86 | - if (valid) { | |
87 | - that.confirmLoading = true; | |
88 | - let httpurl = ''; | |
89 | - let method = ''; | |
90 | - if (!this.model.id) { | |
91 | - httpurl += this.url.add; | |
92 | - method = 'post'; | |
93 | - } else { | |
94 | - httpurl += this.url.edit; | |
95 | - method = 'put'; | |
96 | - } | |
97 | - httpAction(httpurl, this.model, method).then((res) => { | |
98 | - if (res.success) { | |
99 | - that.$message.success(res.message); | |
100 | - that.$emit('ok'); | |
101 | - } else { | |
102 | - that.$message.warning(res.message); | |
103 | - } | |
104 | - }).finally(() => { | |
105 | - that.confirmLoading = false; | |
106 | - that.close(); | |
107 | - }) | |
108 | - } else { | |
109 | - return false | |
84 | + let params={ | |
85 | + receiptId:this.receiptId, | |
86 | + status:this.model.status, | |
87 | + remark:this.model.remark, | |
88 | + auditorid:this.username | |
89 | + } | |
90 | + auditReceipt(params).then((res) => { | |
91 | + if (res.success) { | |
92 | + this.$message.success(res.message) | |
93 | + this.visible = false; | |
94 | + this.loadData(); | |
95 | + }else { | |
96 | + this.$message.error(res.message) | |
110 | 97 | } |
111 | - }) | |
98 | + }); | |
112 | 99 | }, |
113 | 100 | handleCancel() { |
114 | 101 | this.close() |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/audit/controller/AuditController.java
... | ... | @@ -13,6 +13,7 @@ import org.jeecg.common.api.vo.Result; |
13 | 13 | import org.jeecg.common.system.query.QueryGenerator; |
14 | 14 | import org.jeecg.common.util.oConvertUtils; |
15 | 15 | import org.jeecg.modules.wms.audit.entity.Audit; |
16 | +import org.jeecg.modules.wms.audit.entity.AuditFlow; | |
16 | 17 | import org.jeecg.modules.wms.audit.service.IAuditService; |
17 | 18 | |
18 | 19 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
... | ... | @@ -49,7 +50,7 @@ import org.jeecg.common.aspect.annotation.AutoLog; |
49 | 50 | public class AuditController extends JeecgController<Audit, IAuditService> { |
50 | 51 | @Autowired |
51 | 52 | private IAuditService auditService; |
52 | - | |
53 | + | |
53 | 54 | /** |
54 | 55 | * 分页列表查询 |
55 | 56 | * |
... | ... | @@ -71,7 +72,7 @@ public class AuditController extends JeecgController<Audit, IAuditService> { |
71 | 72 | IPage<Audit> pageList = auditService.page(page, queryWrapper); |
72 | 73 | return Result.OK(pageList); |
73 | 74 | } |
74 | - | |
75 | + | |
75 | 76 | /** |
76 | 77 | * 添加 |
77 | 78 | * |
... | ... | @@ -85,7 +86,7 @@ public class AuditController extends JeecgController<Audit, IAuditService> { |
85 | 86 | auditService.save(audit); |
86 | 87 | return Result.OK("添加成功!"); |
87 | 88 | } |
88 | - | |
89 | + | |
89 | 90 | /** |
90 | 91 | * 编辑 |
91 | 92 | * |
... | ... | @@ -99,7 +100,7 @@ public class AuditController extends JeecgController<Audit, IAuditService> { |
99 | 100 | auditService.updateById(audit); |
100 | 101 | return Result.OK("编辑成功!"); |
101 | 102 | } |
102 | - | |
103 | + | |
103 | 104 | /** |
104 | 105 | * 通过id删除 |
105 | 106 | * |
... | ... | @@ -113,7 +114,7 @@ public class AuditController extends JeecgController<Audit, IAuditService> { |
113 | 114 | auditService.removeById(id); |
114 | 115 | return Result.OK("删除成功!"); |
115 | 116 | } |
116 | - | |
117 | + | |
117 | 118 | /** |
118 | 119 | * 批量删除 |
119 | 120 | * |
... | ... | @@ -127,7 +128,7 @@ public class AuditController extends JeecgController<Audit, IAuditService> { |
127 | 128 | this.auditService.removeByIds(Arrays.asList(ids.split(","))); |
128 | 129 | return Result.OK("批量删除成功!"); |
129 | 130 | } |
130 | - | |
131 | + | |
131 | 132 | /** |
132 | 133 | * 通过id查询 |
133 | 134 | * |
... | ... | @@ -168,4 +169,22 @@ public class AuditController extends JeecgController<Audit, IAuditService> { |
168 | 169 | return super.importExcel(request, response, Audit.class); |
169 | 170 | } |
170 | 171 | |
172 | + @ApiOperation(value="提交入库单审核", notes="提交入库单审核") | |
173 | + @GetMapping(value = "/createReceiptAuditFlow") | |
174 | + public Result<Audit> createReceiptAuditFlow(Audit audit) { | |
175 | + return auditService.createReceiptAuditFlow(audit); | |
176 | + } | |
177 | + | |
178 | + @ApiOperation(value="入库单审核", notes="入库单审核") | |
179 | + @GetMapping(value = "/auditReceipt") | |
180 | + public Result<Audit> auditReceipt(Audit audit) { | |
181 | + return auditService.auditReceipt(audit); | |
182 | + } | |
183 | + | |
184 | + @ApiOperation(value="查询审核流程进度", notes="查询审核流程进度") | |
185 | + @GetMapping(value = "/searchAuditFlow") | |
186 | + public AuditFlow searchAuditFlow(Audit audit) { | |
187 | + return auditService.searchAuditFlow(audit); | |
188 | + } | |
189 | + | |
171 | 190 | } |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/audit/entity/Audit.java
... | ... | @@ -5,6 +5,7 @@ import java.io.UnsupportedEncodingException; |
5 | 5 | import java.util.Date; |
6 | 6 | import java.math.BigDecimal; |
7 | 7 | import com.baomidou.mybatisplus.annotation.IdType; |
8 | +import com.baomidou.mybatisplus.annotation.TableField; | |
8 | 9 | import com.baomidou.mybatisplus.annotation.TableId; |
9 | 10 | import com.baomidou.mybatisplus.annotation.TableName; |
10 | 11 | import lombok.Data; |
... | ... | @@ -75,4 +76,8 @@ public class Audit implements Serializable { |
75 | 76 | @Excel(name = "备注", width = 15) |
76 | 77 | @ApiModelProperty(value = "备注") |
77 | 78 | private String remark; |
79 | + | |
80 | + /**单据类型*/ | |
81 | + @TableField(exist = false) | |
82 | + private String type; | |
78 | 83 | } |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/audit/entity/AuditFlow.java
0 → 100644
1 | +package org.jeecg.modules.wms.audit.entity; | |
2 | + | |
3 | +import com.baomidou.mybatisplus.annotation.IdType; | |
4 | +import com.baomidou.mybatisplus.annotation.TableField; | |
5 | +import com.baomidou.mybatisplus.annotation.TableId; | |
6 | +import com.baomidou.mybatisplus.annotation.TableName; | |
7 | +import io.swagger.annotations.ApiModel; | |
8 | +import io.swagger.annotations.ApiModelProperty; | |
9 | +import lombok.Data; | |
10 | +import lombok.EqualsAndHashCode; | |
11 | +import lombok.experimental.Accessors; | |
12 | +import org.jeecgframework.poi.excel.annotation.Excel; | |
13 | + | |
14 | +import java.io.Serializable; | |
15 | +import java.util.Date; | |
16 | +import java.util.List; | |
17 | + | |
18 | +/** | |
19 | + * @Description: 审核表 | |
20 | + * @Author: jeecg-boot | |
21 | + * @Date: 2023-07-26 | |
22 | + * @Version: V1.0 | |
23 | + */ | |
24 | +@Data | |
25 | +@Accessors(chain = true) | |
26 | +@EqualsAndHashCode(callSuper = false) | |
27 | +public class AuditFlow implements Serializable { | |
28 | + private static final long serialVersionUID = 1L; | |
29 | + | |
30 | + //单号 | |
31 | + private String code; | |
32 | + //单据类型 | |
33 | + private String type; | |
34 | + //创建人 | |
35 | + private String createBy; | |
36 | + //创建时间 | |
37 | + private Date createTime; | |
38 | + | |
39 | + //当前审核序号 | |
40 | + private Integer seq; | |
41 | + | |
42 | + public List<Audit> list; | |
43 | +} | |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/audit/service/IAuditService.java
1 | 1 | package org.jeecg.modules.wms.audit.service; |
2 | 2 | |
3 | +import org.jeecg.common.api.vo.Result; | |
3 | 4 | import org.jeecg.modules.wms.audit.entity.Audit; |
4 | 5 | import com.baomidou.mybatisplus.extension.service.IService; |
6 | +import org.jeecg.modules.wms.audit.entity.AuditFlow; | |
7 | +import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptHeader; | |
5 | 8 | |
6 | 9 | /** |
7 | 10 | * @Description: 审核表 |
... | ... | @@ -13,7 +16,7 @@ public interface IAuditService extends IService<Audit> { |
13 | 16 | /** |
14 | 17 | * 审核入库单据 |
15 | 18 | */ |
16 | - boolean auditReceipt(Audit audit); | |
19 | + Result<Audit> auditReceipt(Audit audit); | |
17 | 20 | |
18 | 21 | |
19 | 22 | /** |
... | ... | @@ -26,5 +29,21 @@ public interface IAuditService extends IService<Audit> { |
26 | 29 | */ |
27 | 30 | Audit searchPreviousAuditor(Audit audit); |
28 | 31 | |
32 | + /** | |
33 | + * 判断审核流程是否走完 | |
34 | + */ | |
35 | + boolean judgmentFinsh(Audit audit); | |
36 | + | |
37 | + | |
38 | + /** | |
39 | + * 入库单提交审核 | |
40 | + */ | |
41 | + Result<Audit>createReceiptAuditFlow(Audit audit); | |
42 | + | |
43 | + /** | |
44 | + * 查询单据审核进度 | |
45 | + */ | |
46 | + AuditFlow searchAuditFlow(Audit audit); | |
47 | + | |
29 | 48 | |
30 | 49 | } |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/audit/service/impl/AuditServiceImpl.java
1 | 1 | package org.jeecg.modules.wms.audit.service.impl; |
2 | 2 | |
3 | 3 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
4 | +import org.apache.shiro.SecurityUtils; | |
5 | +import org.checkerframework.checker.units.qual.A; | |
6 | +import org.jeecg.common.api.vo.Result; | |
7 | +import org.jeecg.common.exception.JeecgBootException; | |
8 | +import org.jeecg.common.system.vo.LoginUser; | |
4 | 9 | import org.jeecg.modules.wms.audit.entity.Audit; |
10 | +import org.jeecg.modules.wms.audit.entity.AuditFlow; | |
5 | 11 | import org.jeecg.modules.wms.audit.mapper.AuditMapper; |
6 | 12 | import org.jeecg.modules.wms.audit.service.IAuditService; |
13 | +import org.jeecg.modules.wms.flow.entity.FlowDetail; | |
14 | +import org.jeecg.modules.wms.flow.service.IFlowDetailService; | |
15 | +import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptHeader; | |
16 | +import org.jeecg.modules.wms.receipt.receiptHeader.service.IReceiptHeaderService; | |
17 | +import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentHeader; | |
18 | +import org.jeecg.modules.wms.shipment.shipmentHeader.service.IShipmentHeaderService; | |
7 | 19 | import org.jeecg.utils.StringUtils; |
20 | +import org.jeecg.utils.constant.QuantityConstant; | |
8 | 21 | import org.springframework.stereotype.Service; |
9 | 22 | |
10 | 23 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
11 | 24 | |
25 | +import javax.annotation.Resource; | |
26 | +import javax.transaction.Transactional; | |
27 | +import java.util.ArrayList; | |
28 | +import java.util.List; | |
29 | + | |
12 | 30 | /** |
13 | 31 | * @Description: 审核表 |
14 | 32 | * @Author: jeecg-boot |
... | ... | @@ -17,8 +35,18 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
17 | 35 | */ |
18 | 36 | @Service |
19 | 37 | public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements IAuditService { |
38 | + @Resource | |
39 | + private IReceiptHeaderService receiptHeaderService; | |
40 | + @Resource | |
41 | + private IShipmentHeaderService shipmentHeaderService; | |
42 | + @Resource | |
43 | + private IFlowDetailService iFlowDetailService; | |
44 | + | |
45 | + | |
46 | + | |
20 | 47 | @Override |
21 | - public boolean auditReceipt(Audit audit) { | |
48 | + @Transactional | |
49 | + public Result<Audit> auditReceipt(Audit audit) { | |
22 | 50 | //根据入库单id,用户名称,找到审核数据 |
23 | 51 | LambdaQueryWrapper<Audit>lambdaQueryWrapper=new LambdaQueryWrapper<>(); |
24 | 52 | lambdaQueryWrapper.eq(Audit::getReceiptId,audit.getReceiptId()) |
... | ... | @@ -27,16 +55,57 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements |
27 | 55 | if (StringUtils.isNotNull(audit1)){ |
28 | 56 | audit1.setStatus(audit.getStatus()); |
29 | 57 | audit1.setRemark(audit.getRemark()); |
30 | - this.updateById(audit1); | |
31 | - } | |
58 | + if(this.updateById(audit1)){ | |
59 | + if (audit.getStatus().equals(QuantityConstant.AUDIT_YES_STATUS)){ | |
60 | + ReceiptHeader receiptHeader=new ReceiptHeader(); | |
61 | + receiptHeader.setId(Integer.parseInt(audit1.getReceiptId())); | |
62 | + //查询下一个审核人 | |
63 | + Audit nextAudit=searchNextAuditor(audit1); | |
64 | + if (StringUtils.isNull(nextAudit)){ | |
65 | + receiptHeader.setNextAuditor(String.valueOf(QuantityConstant.RECEIPT_HEADER_FINSH)); | |
66 | + receiptHeader.setFirstStatus(QuantityConstant.RECEIPT_HEADER_FINSH); | |
67 | + receiptHeader.setLastStatus(QuantityConstant.RECEIPT_HEADER_FINSH); | |
68 | + receiptHeaderService.updateById(receiptHeader); | |
69 | + return Result.ok("审核流程结束!"); | |
70 | + }else{ | |
71 | + receiptHeader.setFirstStatus(QuantityConstant.RECEIPT_HEADER_VERIFYING); | |
72 | + receiptHeader.setLastStatus(QuantityConstant.RECEIPT_HEADER_VERIFYING); | |
73 | + receiptHeader.setNextAuditor(String.valueOf(nextAudit.getAuditorid())); | |
74 | + receiptHeaderService.updateById(receiptHeader); | |
75 | + return Result.ok("审核通过,下一审核人:"+nextAudit.getAuditor()); | |
76 | + } | |
32 | 77 | |
33 | - return false; | |
78 | + }else{ | |
79 | + //驳回 | |
80 | + ReceiptHeader receiptHeader=new ReceiptHeader(); | |
81 | + receiptHeader.setId(Integer.parseInt(audit1.getReceiptId())); | |
82 | + //查询上一个审核人 | |
83 | + Audit nextAudit=searchPreviousAuditor(audit1); | |
84 | + if (StringUtils.isNull(nextAudit)){ | |
85 | + //驳回到创建人 | |
86 | + receiptHeader.setNextAuditor(null); | |
87 | + receiptHeader.setFirstStatus(QuantityConstant.RECEIPT_HEADER_BUILD); | |
88 | + receiptHeader.setLastStatus(QuantityConstant.RECEIPT_HEADER_BUILD); | |
89 | + receiptHeaderService.updateById(receiptHeader); | |
90 | + return Result.ok("驳回到创建人!"); | |
91 | + }else { | |
92 | + receiptHeader.setNextAuditor(String.valueOf(nextAudit.getAuditorid())); | |
93 | + receiptHeader.setFirstStatus(QuantityConstant.RECEIPT_HEADER_REJECTED); | |
94 | + receiptHeader.setLastStatus(QuantityConstant.RECEIPT_HEADER_REJECTED); | |
95 | + receiptHeaderService.updateById(receiptHeader); | |
96 | + return Result.ok("审核驳回,下一审核人:"+nextAudit.getAuditor()); | |
97 | + } | |
98 | + } | |
99 | + } | |
100 | + } | |
101 | + return Result.error("审核失败!!"); | |
34 | 102 | } |
35 | 103 | |
36 | 104 | @Override |
37 | 105 | public Audit searchNextAuditor(Audit audit) { |
38 | 106 | LambdaQueryWrapper<Audit>lambdaQueryWrapper=new LambdaQueryWrapper<>(); |
39 | - lambdaQueryWrapper.eq(Audit::getReceiptId,audit.getReceiptId()) | |
107 | + lambdaQueryWrapper.eq(StringUtils.isNotEmpty(audit.getReceiptId()),Audit::getReceiptId,audit.getReceiptId()) | |
108 | + .eq(StringUtils.isNotEmpty(audit.getShipmentId()),Audit::getShipmentId,audit.getShipmentId()) | |
40 | 109 | .gt(Audit::getSequence,audit.getSequence()) |
41 | 110 | .orderByAsc(Audit::getSequence).last("limit 1"); |
42 | 111 | Audit audit1=this.getOne(lambdaQueryWrapper); |
... | ... | @@ -46,10 +115,114 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements |
46 | 115 | @Override |
47 | 116 | public Audit searchPreviousAuditor(Audit audit) { |
48 | 117 | LambdaQueryWrapper<Audit>lambdaQueryWrapper=new LambdaQueryWrapper<>(); |
49 | - lambdaQueryWrapper.eq(Audit::getReceiptId,audit.getReceiptId()) | |
118 | + lambdaQueryWrapper.eq(StringUtils.isNotEmpty(audit.getReceiptId()),Audit::getReceiptId,audit.getReceiptId()) | |
119 | + .eq(StringUtils.isNotEmpty(audit.getShipmentId()),Audit::getShipmentId,audit.getShipmentId()) | |
50 | 120 | .lt(Audit::getSequence,audit.getSequence()) |
51 | 121 | .orderByDesc(Audit::getSequence).last("limit 1"); |
52 | 122 | Audit audit1=this.getOne(lambdaQueryWrapper); |
53 | 123 | return audit1; |
54 | 124 | } |
125 | + | |
126 | + @Override | |
127 | + public boolean judgmentFinsh(Audit audit) { | |
128 | + LambdaQueryWrapper<Audit>lambdaQueryWrapper=new LambdaQueryWrapper<>(); | |
129 | + lambdaQueryWrapper.eq(StringUtils.isNotEmpty(audit.getReceiptId()),Audit::getReceiptId,audit.getReceiptId()) | |
130 | + .eq(StringUtils.isNotEmpty(audit.getShipmentId()),Audit::getShipmentId,audit.getShipmentId()) | |
131 | + .orderByDesc(Audit::getSequence).last("limit 1"); | |
132 | + Audit audit1=this.getOne(lambdaQueryWrapper); | |
133 | + boolean flag=false; | |
134 | + if (StringUtils.isNotNull(audit1)){ | |
135 | + if (QuantityConstant.AUDIT_YES_STATUS.equals(audit.getStatus())){ | |
136 | + flag= true; | |
137 | + } | |
138 | + } | |
139 | + return flag; | |
140 | + } | |
141 | + | |
142 | + @Override | |
143 | + @Transactional | |
144 | + public Result<Audit> createReceiptAuditFlow(Audit audit) { | |
145 | + //先把提交人加入审核表 | |
146 | + LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); | |
147 | + if (!sysUser.getRealname().equals(audit.getCreateBy())){ | |
148 | + return Result.error("当前单据提交人,不是单据创建人!!!"); | |
149 | + } | |
150 | + //查询当前单据是否有审核流程 | |
151 | + List<FlowDetail> flowDetailList=iFlowDetailService.getFlowDetailList(QuantityConstant.RECEIPT_AUDIT,audit.getType()); | |
152 | + if (flowDetailList.size()>0){ | |
153 | + Audit audit0=new Audit(); | |
154 | + audit0.setReceiptId(String.valueOf(audit.getReceiptId())); | |
155 | + audit0.setAuditor(sysUser.getRealname()); | |
156 | + audit0.setAuditorid(sysUser.getUsername()); | |
157 | + audit0.setSequence(0); | |
158 | + if (!this.save(audit0)){ | |
159 | + throw new JeecgBootException("提交审核失败!!"); | |
160 | + } | |
161 | + List<Audit>auditList=new ArrayList<>(); | |
162 | + for (FlowDetail flowDetail:flowDetailList){ | |
163 | + Audit audit1=new Audit(); | |
164 | + audit1.setAuditor(flowDetail.getAuditor()); | |
165 | + audit1.setAuditorid(flowDetail.getAuditorId()); | |
166 | + audit1.setSequence(flowDetail.getSequence()); | |
167 | + audit1.setReceiptId(String.valueOf(audit.getReceiptId())); | |
168 | + auditList.add(audit1); | |
169 | + } | |
170 | + if(this.saveBatch(auditList)){ | |
171 | + //更新入库单头表,下一个审核人id | |
172 | + ReceiptHeader receiptHeader1=new ReceiptHeader(); | |
173 | + receiptHeader1.setId(Integer.valueOf(audit.getReceiptId())); | |
174 | + receiptHeader1.setFirstStatus(QuantityConstant.RECEIPT_HEADER_VERIFYING); | |
175 | + receiptHeader1.setLastStatus(QuantityConstant.RECEIPT_HEADER_VERIFYING); | |
176 | + receiptHeader1.setNextAuditor(flowDetailList.get(0).getAuditorId()); | |
177 | + receiptHeaderService.updateById(receiptHeader1); | |
178 | + } | |
179 | + return Result.ok("提交审核成功,下一审核人:"+flowDetailList.get(0).getAuditor()); | |
180 | + }else{ | |
181 | + //没有审核流程,直接审核完成 | |
182 | + ReceiptHeader receiptHeader1=new ReceiptHeader(); | |
183 | + receiptHeader1.setId(Integer.valueOf(audit.getReceiptId())); | |
184 | + receiptHeader1.setFirstStatus(QuantityConstant.RECEIPT_HEADER_FINSH); | |
185 | + receiptHeader1.setLastStatus(QuantityConstant.RECEIPT_HEADER_FINSH); | |
186 | + receiptHeaderService.updateById(receiptHeader1); | |
187 | + return Result.ok("当前单据没有审核流程,直接完成!!"); | |
188 | + } | |
189 | + } | |
190 | + | |
191 | + @Override | |
192 | + public AuditFlow searchAuditFlow(Audit audit) { | |
193 | + AuditFlow auditFlow=new AuditFlow(); | |
194 | + //查询单据信息 | |
195 | + if (StringUtils.isNotEmpty(audit.getReceiptId())){ | |
196 | + ReceiptHeader receiptHeader=receiptHeaderService.getById(audit.getReceiptId()); | |
197 | + auditFlow.setCode(receiptHeader.getCode()); | |
198 | + auditFlow.setCreateBy(receiptHeader.getCreateBy()); | |
199 | + auditFlow.setCreateTime(receiptHeader.getCreateTime()); | |
200 | + auditFlow.setType(receiptHeader.getType()); | |
201 | + } | |
202 | + if (StringUtils.isNotEmpty(audit.getShipmentId())){ | |
203 | + ShipmentHeader shipmentHeader=shipmentHeaderService.getById(audit.getShipmentId()); | |
204 | + auditFlow.setCode(shipmentHeader.getCode()); | |
205 | + auditFlow.setCreateBy(shipmentHeader.getCreateBy()); | |
206 | + auditFlow.setCreateTime(shipmentHeader.getCreateTime()); | |
207 | + auditFlow.setType(shipmentHeader.getType()); | |
208 | + } | |
209 | + LambdaQueryWrapper<Audit>lambdaQueryWrapper=new LambdaQueryWrapper<>(); | |
210 | + lambdaQueryWrapper.eq(StringUtils.isNotEmpty(audit.getReceiptId()),Audit::getReceiptId,audit.getReceiptId()) | |
211 | + .eq(StringUtils.isNotEmpty(audit.getShipmentId()),Audit::getShipmentId,audit.getShipmentId()) | |
212 | + .orderByAsc(Audit::getSequence); | |
213 | + List<Audit>list=this.list(lambdaQueryWrapper); | |
214 | + auditFlow.setList(list); | |
215 | + | |
216 | + //查询当前审核序号 | |
217 | + LambdaQueryWrapper<Audit>lambdaQueryWrapper2=new LambdaQueryWrapper<>(); | |
218 | + lambdaQueryWrapper2.eq(StringUtils.isNotEmpty(audit.getReceiptId()),Audit::getReceiptId,audit.getReceiptId()) | |
219 | + .eq(StringUtils.isNotEmpty(audit.getShipmentId()),Audit::getShipmentId,audit.getShipmentId()) | |
220 | + .eq(Audit::getStatus,1) | |
221 | + .orderByDesc(Audit::getSequence).last("limit 1"); | |
222 | + Audit audit1=this.getOne(lambdaQueryWrapper2); | |
223 | + if (StringUtils.isNotNull(audit1)){ | |
224 | + auditFlow.setSeq(audit1.getSequence()+1); | |
225 | + } | |
226 | + return auditFlow; | |
227 | + } | |
55 | 228 | } |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/flow/service/impl/FlowDetailServiceImpl.java
... | ... | @@ -7,6 +7,7 @@ import org.jeecg.modules.wms.flow.mapper.FlowDetailMapper; |
7 | 7 | import org.jeecg.modules.wms.flow.service.IFlowDetailService; |
8 | 8 | import org.jeecg.modules.wms.flow.service.IFlowHeaderService; |
9 | 9 | import org.jeecg.utils.StringUtils; |
10 | +import org.jeecg.utils.constant.QuantityConstant; | |
10 | 11 | import org.springframework.stereotype.Service; |
11 | 12 | |
12 | 13 | import java.util.ArrayList; |
... | ... | @@ -42,12 +43,14 @@ public class FlowDetailServiceImpl extends ServiceImpl<FlowDetailMapper, FlowDet |
42 | 43 | LambdaQueryWrapper<FlowHeader>lambdaQueryWrapper=new LambdaQueryWrapper<>(); |
43 | 44 | lambdaQueryWrapper.eq(FlowHeader::getDocumentType,documentType) |
44 | 45 | .eq(FlowHeader::getFlowType,flowType) |
46 | + .eq(FlowHeader::getFlowStatus, 1) | |
45 | 47 | .orderByDesc(FlowHeader::getId).last("limit 1"); |
46 | 48 | FlowHeader flowHeader=iFlowHeaderService.getOne(lambdaQueryWrapper); |
47 | 49 | //没有根据单据类型,找到流程就根据入库单类型查找 |
48 | 50 | if (StringUtils.isNull(flowHeader)){ |
49 | 51 | lambdaQueryWrapper=new LambdaQueryWrapper<>(); |
50 | 52 | lambdaQueryWrapper.eq(FlowHeader::getFlowType,flowType) |
53 | + .eq(FlowHeader::getFlowStatus, 1) | |
51 | 54 | .orderByDesc(FlowHeader::getId).last("limit 1"); |
52 | 55 | flowHeader=iFlowHeaderService.getOne(lambdaQueryWrapper); |
53 | 56 | } |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiptHeader/service/impl/ReceiptHeaderServiceImpl.java
... | ... | @@ -123,29 +123,6 @@ public class ReceiptHeaderServiceImpl extends ServiceImpl<ReceiptHeaderMapper, R |
123 | 123 | if (!success) { |
124 | 124 | return Result.OK("添加失败!"); |
125 | 125 | } |
126 | - //查询当前单据是否有审核流程 | |
127 | - List<FlowDetail>flowDetailList=iFlowDetailService.getFlowDetailList(QuantityConstant.RECEIPT_AUDIT,receiptHeader.getType()); | |
128 | - if (flowDetailList.size()>0){ | |
129 | - List<Audit>auditList=new ArrayList<>(); | |
130 | - for (FlowDetail flowDetail:flowDetailList){ | |
131 | - Audit audit=new Audit(); | |
132 | - audit.setAuditor(flowDetail.getAuditor()); | |
133 | - audit.setAuditorid(flowDetail.getAuditorId()); | |
134 | - audit.setSequence(flowDetail.getSequence()); | |
135 | - audit.setReceiptId(String.valueOf(receiptHeader.getId())); | |
136 | - auditList.add(audit); | |
137 | - } | |
138 | - if(iAuditService.saveBatch(auditList)){ | |
139 | - //更新入库单头表,下一个审核人id | |
140 | - ReceiptHeader receiptHeader1=new ReceiptHeader(); | |
141 | - receiptHeader1.setId(receiptHeader.getId()); | |
142 | - receiptHeader1.setNextAuditor(flowDetailList.get(0).getAuditorId()); | |
143 | - receiptHeaderService.updateById(receiptHeader1); | |
144 | - } | |
145 | - } | |
146 | - if (!success) { | |
147 | - return Result.OK("添加失败!"); | |
148 | - } | |
149 | 126 | return Result.OK("添加成功!", receiptHeader); |
150 | 127 | } |
151 | 128 | |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/utils/constant/QuantityConstant.java
... | ... | @@ -388,6 +388,13 @@ public class QuantityConstant { |
388 | 388 | // 出库单审核流程 |
389 | 389 | public static final Integer SHIPMENT_AUDIT = 2; |
390 | 390 | |
391 | + //审核通过 | |
392 | + public static final Integer AUDIT_YES_STATUS = 1; | |
393 | + //审核驳回 | |
394 | + public static final Integer AUDIT_NO_STATUS = 2; | |
395 | + | |
396 | + | |
397 | + | |
391 | 398 | // WCS库位信息查询 |
392 | 399 | public static final String ADDRESS_WCS_LOCATION_INFO = "WCS_LOCATION_INFO"; |
393 | 400 | |
... | ... |