Commit 63e6b8736d1dcebcecd473a58eb39acb7797d444
1 parent
e52db63a
增加取消组盘 取消配盘功能
Showing
14 changed files
with
273 additions
and
196 deletions
ant-design-vue-jeecg/src/views/system/receipt/ReceiptContainerHeaderList.vue
... | ... | @@ -122,8 +122,8 @@ |
122 | 122 | <a v-if="record.status == 0 && record.taskType == 200" @click="selectPort(record)">生成任务</a> |
123 | 123 | <a v-else-if="record.status == 0" @click="createTask(record)">生成任务</a> |
124 | 124 | <a-divider type="vertical"/> |
125 | - <a-popconfirm v-if="record.status == 0" v-has="'receiptContainerHeader:delete'" title="确定取消配盘吗?" @confirm="() => handleDelete(record.id)"> | |
126 | - <a>取消配盘</a> | |
125 | + <a-popconfirm v-if="record.status == 0" v-has="'receiptContainerHeader:delete'" title="确定取消组盘吗?" @confirm="() => handleDelete(record.id)"> | |
126 | + <a>取消组盘</a> | |
127 | 127 | </a-popconfirm> |
128 | 128 | <a-divider type="vertical"/> |
129 | 129 | <a-dropdown> |
... | ... |
ant-design-vue-jeecg/src/views/system/shipment/ShipmentContainerHeaderList.vue
... | ... | @@ -124,17 +124,17 @@ |
124 | 124 | </template> |
125 | 125 | |
126 | 126 | <span slot="action" slot-scope="text, record"> |
127 | - <a v-has="'shipmentContainerHeader:edit'" @click="handleEdit(record)">编辑</a> | |
128 | - <a-divider type="vertical"/> | |
129 | 127 | <a v-if="record.status == 0" @click="selectPort(record)">生成任务</a> |
130 | 128 | <a-divider type="vertical"/> |
129 | + <a-popconfirm v-if="record.status == 0" v-has="'shipmentContainerHeader:delete'" title="确定取消配盘吗?" @confirm="() => handleDelete(record.id)"> | |
130 | + <a>取消配盘</a> | |
131 | + </a-popconfirm> | |
132 | + <a-divider type="vertical"/> | |
131 | 133 | <a-dropdown> |
132 | 134 | <a class="ant-dropdown-link">更多 <a-icon type="down"/></a> |
133 | - <a-menu slot="overlay" v-has="'shipmentContainerHeader:delete'"> | |
135 | + <a-menu slot="overlay" > | |
134 | 136 | <a-menu-item> |
135 | - <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> | |
136 | - <a>删除</a> | |
137 | - </a-popconfirm> | |
137 | + <a v-has="'receiptContainerHeader:edit'" @click="handleEdit(record)">编辑</a> | |
138 | 138 | </a-menu-item> |
139 | 139 | </a-menu> |
140 | 140 | </a-dropdown> |
... | ... |
huaheng-wms-core/pom.xml
1 | 1 | <?xml version="1.0"?> |
2 | 2 | <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" |
3 | - xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |
3 | + xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |
4 | 4 | <modelVersion>4.0.0</modelVersion> |
5 | 5 | |
6 | 6 | <parent> |
... | ... | @@ -79,6 +79,12 @@ |
79 | 79 | <artifactId>jimureport-spring-boot-starter</artifactId> |
80 | 80 | <version>1.4.32</version> |
81 | 81 | </dependency> |
82 | + | |
83 | + <dependency> | |
84 | + <groupId>org.springframework.boot</groupId> | |
85 | + <artifactId>spring-boot-starter-validation</artifactId> | |
86 | + </dependency> | |
87 | + | |
82 | 88 | </dependencies> |
83 | 89 | |
84 | 90 | <build> |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiptContainerHeader/service/impl/ReceiptContainerHeaderServiceImpl.java
... | ... | @@ -338,12 +338,13 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai |
338 | 338 | List<ReceiptContainerDetail> receiptContainerDetailList = receiptContainerDetailService.getReceiptContainerDetailListByHeaderId(id); |
339 | 339 | for (ReceiptContainerDetail receiptContainerDetail : receiptContainerDetailList) { |
340 | 340 | ReceiptDetail receiptDetail = receiptDetailService.getById(receiptContainerDetail.getReceiptDetailId()); |
341 | - if (receiptDetail != null) { | |
342 | - receiptDetail.setStatus(QuantityConstant.RECEIPT_HEADER_BUILD); | |
343 | - receiptDetail.setTaskQty(receiptDetail.getTaskQty().subtract(receiptContainerDetail.getQty())); | |
344 | - if (!receiptDetailService.updateById(receiptDetail)) { | |
345 | - throw new ServiceException("取消组盘失败, 更新入库明细失败id是" + receiptContainerDetail.getReceiptDetailId()); | |
346 | - } | |
341 | + if (receiptDetail == null) { | |
342 | + throw new ServiceException("取消组盘失败, 没有找到入库组盘详情id是" + receiptContainerDetail.getReceiptDetailId()); | |
343 | + } | |
344 | + receiptDetail.setStatus(QuantityConstant.RECEIPT_HEADER_BUILD); | |
345 | + receiptDetail.setTaskQty(receiptDetail.getTaskQty().subtract(receiptContainerDetail.getQty())); | |
346 | + if (!receiptDetailService.updateById(receiptDetail)) { | |
347 | + throw new ServiceException("取消组盘失败, 更新入库明细失败id是" + receiptContainerDetail.getReceiptDetailId()); | |
347 | 348 | } |
348 | 349 | if (!receiptContainerDetailService.removeById(receiptContainerDetail.getId())) { |
349 | 350 | throw new ServiceException("取消组盘失败, 删除入库组盘明细表失败id是" + receiptContainerDetail.getId()); |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiptHeader/controller/ReceiptHeaderController.java
... | ... | @@ -42,7 +42,6 @@ import org.springframework.web.multipart.MultipartFile; |
42 | 42 | import org.springframework.web.multipart.MultipartHttpServletRequest; |
43 | 43 | import org.springframework.web.servlet.ModelAndView; |
44 | 44 | |
45 | -import com.aliyun.oss.ServiceException; | |
46 | 45 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
47 | 46 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
48 | 47 | import com.baomidou.mybatisplus.core.metadata.IPage; |
... | ... | @@ -142,7 +141,6 @@ public class ReceiptHeaderController extends JeecgController<ReceiptHeader, IRec |
142 | 141 | @DeleteMapping(value = "/delete") |
143 | 142 | public Result<String> delete(@RequestParam(name = "id", required = true) String id) { |
144 | 143 | receiptHeaderService.delMain(id, QuantityConstant.WMS_DELETE_RECEIPT); |
145 | - | |
146 | 144 | return Result.OK("删除成功!"); |
147 | 145 | } |
148 | 146 | |
... | ... | @@ -251,26 +249,7 @@ public class ReceiptHeaderController extends JeecgController<ReceiptHeader, IRec |
251 | 249 | @RequiresPermissions("receiptDetail:delete") |
252 | 250 | @DeleteMapping(value = "/deleteReceiptDetail") |
253 | 251 | public Result<String> deleteReceiptDetail(@RequestParam(name = "id", required = true) String id) { |
254 | - ReceiptDetail receiptDetail = receiptDetailService.getById(id); | |
255 | - if (receiptDetail == null) { | |
256 | - return Result.error("删除失败, 没有找到入库单详情"); | |
257 | - } | |
258 | - ReceiptHeader receiptHeader = receiptHeaderService.getById(receiptDetail.getReceiptId()); | |
259 | - if (receiptHeader == null) { | |
260 | - return Result.error("删除失败, 没有找到入库单"); | |
261 | - } | |
262 | - if (receiptHeader.getFirstStatus().intValue() != QuantityConstant.RECEIPT_HEADER_BUILD) { | |
263 | - return Result.error("删除失败, 入库单必须是新建状态才能删除详情"); | |
264 | - } | |
265 | - boolean success = receiptDetailService.removeById(id); | |
266 | - if (!success) { | |
267 | - throw new ServiceException("删除详情失败"); | |
268 | - } | |
269 | - success = receiptHeaderService.updateReceiptHeader(receiptDetail.getReceiptId()); | |
270 | - if (!success) { | |
271 | - throw new ServiceException("更新入库单头数量失败"); | |
272 | - } | |
273 | - return Result.OK("删除成功!"); | |
252 | + return receiptDetailService.removeDetailById(id); | |
274 | 253 | } |
275 | 254 | |
276 | 255 | /** |
... | ... | @@ -283,8 +262,7 @@ public class ReceiptHeaderController extends JeecgController<ReceiptHeader, IRec |
283 | 262 | @RequiresPermissions("receiptDetail:deleteBatch") |
284 | 263 | @DeleteMapping(value = "/deleteBatchReceiptDetail") |
285 | 264 | public Result<String> deleteBatchReceiptDetail(@RequestParam(name = "ids", required = true) String ids) { |
286 | - this.receiptDetailService.removeByIds(Arrays.asList(ids.split(","))); | |
287 | - return Result.OK("批量删除成功!"); | |
265 | + return receiptDetailService.removeDetailListById(Arrays.asList(ids.split(","))); | |
288 | 266 | } |
289 | 267 | |
290 | 268 | /** |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiptHeader/entity/ReceiptDetail.java
1 | 1 | package org.jeecg.modules.wms.receipt.receiptHeader.entity; |
2 | 2 | |
3 | 3 | import java.io.Serializable; |
4 | +import java.util.Date; | |
5 | + | |
6 | +import org.jeecg.common.aspect.annotation.Dict; | |
7 | +import org.jeecgframework.poi.excel.annotation.Excel; | |
8 | + | |
4 | 9 | import com.baomidou.mybatisplus.annotation.IdType; |
5 | 10 | import com.baomidou.mybatisplus.annotation.TableId; |
6 | 11 | import com.baomidou.mybatisplus.annotation.TableName; |
7 | -import org.jeecg.common.aspect.annotation.Dict; | |
8 | -import lombok.Data; | |
9 | -import com.fasterxml.jackson.annotation.JsonFormat; | |
10 | -import org.springframework.format.annotation.DateTimeFormat; | |
11 | -import org.jeecgframework.poi.excel.annotation.Excel; | |
12 | -import java.util.Date; | |
12 | + | |
13 | 13 | import io.swagger.annotations.ApiModel; |
14 | 14 | import io.swagger.annotations.ApiModelProperty; |
15 | -import java.io.UnsupportedEncodingException; | |
15 | +import lombok.Data; | |
16 | 16 | |
17 | 17 | /** |
18 | 18 | * @Description: 入库单详情 |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiptHeader/service/IReceiptDetailService.java
1 | 1 | package org.jeecg.modules.wms.receipt.receiptHeader.service; |
2 | 2 | |
3 | -import com.baomidou.mybatisplus.extension.service.IService; | |
3 | +import java.util.List; | |
4 | + | |
4 | 5 | import org.jeecg.common.api.vo.Result; |
5 | 6 | import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptDetail; |
6 | -import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptHeader; | |
7 | 7 | |
8 | -import java.util.List; | |
8 | +import com.baomidou.mybatisplus.extension.service.IService; | |
9 | 9 | |
10 | 10 | /** |
11 | 11 | * @Description: 入库单详情 |
... | ... | @@ -18,4 +18,8 @@ public interface IReceiptDetailService extends IService<ReceiptDetail> { |
18 | 18 | public List<ReceiptDetail> selectByMainId(String mainId); |
19 | 19 | |
20 | 20 | public Result saveReceiptDetail(ReceiptDetail receiptDetail); |
21 | + | |
22 | + public Result removeDetailById(String id); | |
23 | + | |
24 | + public Result removeDetailListById(List<String> idList); | |
21 | 25 | } |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiptHeader/service/impl/ReceiptDetailServiceImpl.java
1 | 1 | package org.jeecg.modules.wms.receipt.receiptHeader.service.impl; |
2 | 2 | |
3 | -import com.alibaba.fastjson.JSON; | |
4 | -import com.aliyun.oss.ServiceException; | |
3 | +import java.math.BigDecimal; | |
4 | +import java.util.ArrayList; | |
5 | +import java.util.List; | |
6 | + | |
7 | +import javax.annotation.Resource; | |
8 | + | |
5 | 9 | import org.jeecg.common.api.vo.Result; |
6 | 10 | import org.jeecg.modules.wms.config.material.entity.Material; |
7 | 11 | import org.jeecg.modules.wms.config.material.service.IMaterialService; |
... | ... | @@ -13,19 +17,17 @@ import org.jeecg.modules.wms.receipt.receiptHeader.service.IReceiptHeaderService |
13 | 17 | import org.jeecg.utils.HuahengJwtUtil; |
14 | 18 | import org.jeecg.utils.StringUtils; |
15 | 19 | import org.jeecg.utils.constant.QuantityConstant; |
20 | +import org.springframework.beans.factory.annotation.Autowired; | |
16 | 21 | import org.springframework.stereotype.Service; |
22 | +import org.springframework.transaction.annotation.Transactional; | |
17 | 23 | |
18 | -import java.util.ArrayList; | |
19 | -import java.util.List; | |
24 | +import com.alibaba.fastjson.JSON; | |
25 | +import com.aliyun.oss.ServiceException; | |
20 | 26 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
21 | 27 | |
22 | 28 | import cn.monitor4all.logRecord.annotation.OperationLog; |
23 | 29 | import cn.monitor4all.logRecord.context.LogRecordContext; |
24 | 30 | |
25 | -import org.springframework.beans.factory.annotation.Autowired; | |
26 | - | |
27 | -import javax.annotation.Resource; | |
28 | - | |
29 | 31 | /** |
30 | 32 | * @Description: 入库单详情 |
31 | 33 | * @Author: jeecg-boot |
... | ... | @@ -50,6 +52,16 @@ public class ReceiptDetailServiceImpl extends ServiceImpl<ReceiptDetailMapper, R |
50 | 52 | } |
51 | 53 | |
52 | 54 | @Override |
55 | + public boolean save(ReceiptDetail entity) { | |
56 | + BigDecimal qty = entity.getQty(); | |
57 | + if (qty.compareTo(BigDecimal.ZERO) < 0) { | |
58 | + throw new ServiceException("单据数量不能小于0"); | |
59 | + } | |
60 | + return super.save(entity); | |
61 | + } | |
62 | + | |
63 | + @Override | |
64 | + @Transactional(rollbackFor = ServiceException.class) | |
53 | 65 | @OperationLog(bizId = "''", bizType = "'入库单追踪'", tag = "'入库详情添加'", extra = "#extraJsonString", msg = "''", operatorId = "#username", recordReturnValue = true) |
54 | 66 | public Result saveReceiptDetail(ReceiptDetail receiptDetail) { |
55 | 67 | ReceiptHeader receiptHeader = receiptHeaderService.getById(receiptDetail.getReceiptId()); |
... | ... | @@ -95,4 +107,43 @@ public class ReceiptDetailServiceImpl extends ServiceImpl<ReceiptDetailMapper, R |
95 | 107 | LogRecordContext.putVariable("extraJsonString", JSON.toJSONString(receiptDetailList)); |
96 | 108 | return Result.OK("添加成功!"); |
97 | 109 | } |
110 | + | |
111 | + @Override | |
112 | + @Transactional(rollbackFor = ServiceException.class) | |
113 | + public Result removeDetailById(String id) { | |
114 | + ReceiptDetail receiptDetail = receiptDetailService.getById(id); | |
115 | + if (receiptDetail == null) { | |
116 | + return Result.error("删除失败, 没有找到入库单详情"); | |
117 | + } | |
118 | + BigDecimal taskQty = receiptDetail.getTaskQty(); | |
119 | + if (taskQty.compareTo(BigDecimal.ZERO) != 0) { | |
120 | + return Result.error("删除失败, 收货数量不为0"); | |
121 | + } | |
122 | + ReceiptHeader receiptHeader = receiptHeaderService.getById(receiptDetail.getReceiptId()); | |
123 | + if (receiptHeader == null) { | |
124 | + return Result.error("删除失败, 没有找到入库单"); | |
125 | + } | |
126 | + if (receiptHeader.getFirstStatus().intValue() != QuantityConstant.RECEIPT_HEADER_BUILD) { | |
127 | + return Result.error("删除失败, 入库单必须是新建状态才能删除详情"); | |
128 | + } | |
129 | + boolean success = receiptDetailService.removeById(id); | |
130 | + if (!success) { | |
131 | + throw new ServiceException("删除详情失败"); | |
132 | + } | |
133 | + success = receiptHeaderService.updateReceiptHeader(receiptDetail.getReceiptId()); | |
134 | + if (!success) { | |
135 | + throw new ServiceException("更新入库单头数量失败"); | |
136 | + } | |
137 | + return Result.OK("删除成功!"); | |
138 | + } | |
139 | + | |
140 | + @Override | |
141 | + @Transactional(rollbackFor = ServiceException.class) | |
142 | + public Result removeDetailListById(List<String> idList) { | |
143 | + Result result = null; | |
144 | + for (String id : idList) { | |
145 | + result = removeDetailById(id); | |
146 | + } | |
147 | + return result; | |
148 | + } | |
98 | 149 | } |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentContainerHeader/controller/ShipmentContainerHeaderController.java
1 | 1 | package org.jeecg.modules.wms.shipment.shipmentContainerHeader.controller; |
2 | 2 | |
3 | -import org.apache.shiro.authz.annotation.RequiresPermissions; | |
4 | -import org.jeecg.common.system.query.QueryGenerator; | |
5 | -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |
6 | -import com.baomidou.mybatisplus.core.metadata.IPage; | |
7 | -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |
8 | -import lombok.extern.slf4j.Slf4j; | |
9 | -import org.jeecg.common.system.base.controller.JeecgController; | |
10 | -import org.jeecg.common.api.vo.Result; | |
11 | -import org.springframework.beans.factory.annotation.Autowired; | |
12 | -import org.springframework.web.bind.annotation.*; | |
3 | +import java.io.IOException; | |
4 | +import java.util.Arrays; | |
5 | +import java.util.List; | |
6 | +import java.util.Map; | |
7 | +import java.util.stream.Collectors; | |
8 | + | |
13 | 9 | import javax.servlet.http.HttpServletRequest; |
14 | 10 | import javax.servlet.http.HttpServletResponse; |
15 | -import org.springframework.web.servlet.ModelAndView; | |
16 | -import java.util.Arrays; | |
11 | + | |
12 | +import org.apache.shiro.SecurityUtils; | |
13 | +import org.apache.shiro.authz.annotation.RequiresPermissions; | |
14 | +import org.jeecg.common.api.vo.Result; | |
15 | +import org.jeecg.common.aspect.annotation.AutoLog; | |
16 | +import org.jeecg.common.system.base.controller.JeecgController; | |
17 | +import org.jeecg.common.system.query.QueryGenerator; | |
18 | +import org.jeecg.common.system.vo.LoginUser; | |
17 | 19 | import org.jeecg.common.util.oConvertUtils; |
18 | 20 | import org.jeecg.modules.wms.shipment.shipmentContainerHeader.entity.ShipmentContainerDetail; |
19 | 21 | import org.jeecg.modules.wms.shipment.shipmentContainerHeader.entity.ShipmentContainerHeader; |
20 | -import org.jeecg.modules.wms.shipment.shipmentContainerHeader.service.IShipmentContainerHeaderService; | |
21 | 22 | import org.jeecg.modules.wms.shipment.shipmentContainerHeader.service.IShipmentContainerDetailService; |
22 | -import io.swagger.annotations.Api; | |
23 | -import io.swagger.annotations.ApiOperation; | |
24 | -import org.jeecg.common.aspect.annotation.AutoLog; | |
25 | -import org.apache.shiro.SecurityUtils; | |
26 | -import org.jeecg.common.system.vo.LoginUser; | |
23 | +import org.jeecg.modules.wms.shipment.shipmentContainerHeader.service.IShipmentContainerHeaderService; | |
27 | 24 | import org.jeecgframework.poi.excel.ExcelImportUtil; |
28 | 25 | import org.jeecgframework.poi.excel.def.NormalExcelConstants; |
29 | 26 | import org.jeecgframework.poi.excel.entity.ExportParams; |
30 | 27 | import org.jeecgframework.poi.excel.entity.ImportParams; |
31 | 28 | import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; |
29 | +import org.springframework.beans.factory.annotation.Autowired; | |
30 | +import org.springframework.web.bind.annotation.*; | |
32 | 31 | import org.springframework.web.multipart.MultipartFile; |
33 | 32 | import org.springframework.web.multipart.MultipartHttpServletRequest; |
34 | -import java.io.IOException; | |
35 | -import java.util.List; | |
36 | -import java.util.Map; | |
37 | -import java.util.stream.Collectors; | |
33 | +import org.springframework.web.servlet.ModelAndView; | |
34 | + | |
35 | +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |
36 | +import com.baomidou.mybatisplus.core.metadata.IPage; | |
37 | +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |
38 | + | |
39 | +import io.swagger.annotations.Api; | |
40 | +import io.swagger.annotations.ApiOperation; | |
41 | +import lombok.extern.slf4j.Slf4j; | |
38 | 42 | |
39 | 43 | /** |
40 | 44 | * @Description: 出库组盘 |
... | ... | @@ -114,8 +118,8 @@ public class ShipmentContainerHeaderController extends JeecgController<ShipmentC |
114 | 118 | @RequiresPermissions("shipmentContainerHeader:delete") |
115 | 119 | @DeleteMapping(value = "/delete") |
116 | 120 | public Result<String> delete(@RequestParam(name = "id", required = true) String id) { |
117 | - shipmentContainerHeaderService.delMain(id); | |
118 | - return Result.OK("删除成功!"); | |
121 | + Result result = shipmentContainerHeaderService.cancelCombine(Integer.parseInt(id)); | |
122 | + return result; | |
119 | 123 | } |
120 | 124 | |
121 | 125 | /** |
... | ... | @@ -128,8 +132,10 @@ public class ShipmentContainerHeaderController extends JeecgController<ShipmentC |
128 | 132 | @RequiresPermissions("shipmentContainerHeader:deleteBatch") |
129 | 133 | @DeleteMapping(value = "/deleteBatch") |
130 | 134 | public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) { |
131 | - this.shipmentContainerHeaderService.delBatchMain(Arrays.asList(ids.split(","))); | |
132 | - return Result.OK("批量删除成功!"); | |
135 | + List<String> idList = Arrays.asList(ids.split(",")); | |
136 | + List<Integer> idInterList = idList.stream().map(Integer::parseInt).collect(Collectors.toList()); | |
137 | + Result result = shipmentContainerHeaderService.cancelCombine(idInterList); | |
138 | + return result; | |
133 | 139 | } |
134 | 140 | |
135 | 141 | /** |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentContainerHeader/service/IShipmentContainerHeaderService.java
1 | 1 | package org.jeecg.modules.wms.shipment.shipmentContainerHeader.service; |
2 | 2 | |
3 | -import org.jeecg.modules.wms.shipment.shipmentContainerHeader.entity.ShipmentContainerDetail; | |
4 | -import org.jeecg.modules.wms.shipment.shipmentContainerHeader.entity.ShipmentContainerHeader; | |
5 | -import com.baomidou.mybatisplus.extension.service.IService; | |
6 | -import org.springframework.beans.factory.annotation.Autowired; | |
7 | 3 | import java.io.Serializable; |
8 | 4 | import java.util.Collection; |
9 | 5 | import java.util.List; |
10 | 6 | |
7 | +import org.jeecg.common.api.vo.Result; | |
8 | +import org.jeecg.modules.wms.shipment.shipmentContainerHeader.entity.ShipmentContainerHeader; | |
9 | + | |
10 | +import com.baomidou.mybatisplus.extension.service.IService; | |
11 | + | |
11 | 12 | /** |
12 | 13 | * @Description: 出库组盘 |
13 | 14 | * @Author: jeecg-boot |
... | ... | @@ -41,4 +42,16 @@ public interface IShipmentContainerHeaderService extends IService<ShipmentContai |
41 | 42 | * @return |
42 | 43 | */ |
43 | 44 | boolean cancelShipmentTask(Integer shipmentContainerHeaderId); |
45 | + | |
46 | + /** | |
47 | + * 取消配盘 | |
48 | + * @return | |
49 | + */ | |
50 | + Result cancelCombine(Integer id); | |
51 | + | |
52 | + /** | |
53 | + * 取消配盘 | |
54 | + * @return | |
55 | + */ | |
56 | + Result cancelCombine(List<Integer> ids); | |
44 | 57 | } |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentContainerHeader/service/impl/ShipmentContainerHeaderServiceImpl.java
1 | 1 | package org.jeecg.modules.wms.shipment.shipmentContainerHeader.service.impl; |
2 | 2 | |
3 | -import com.aliyun.oss.ServiceException; | |
4 | -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
5 | -import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |
6 | -import org.jeecg.modules.wms.receipt.receiptContainerHeader.entity.ReceiptContainerDetail; | |
7 | -import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptDetail; | |
8 | -import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptHeader; | |
9 | -import org.jeecg.modules.wms.shipment.shipmentContainerHeader.entity.ShipmentContainerHeader; | |
3 | +import java.io.Serializable; | |
4 | +import java.util.ArrayList; | |
5 | +import java.util.Collection; | |
6 | +import java.util.List; | |
7 | +import java.util.stream.Collectors; | |
8 | + | |
9 | +import javax.annotation.Resource; | |
10 | + | |
11 | +import org.jeecg.common.api.vo.Result; | |
12 | +import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; | |
13 | +import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryDetailService; | |
10 | 14 | import org.jeecg.modules.wms.shipment.shipmentContainerHeader.entity.ShipmentContainerDetail; |
15 | +import org.jeecg.modules.wms.shipment.shipmentContainerHeader.entity.ShipmentContainerHeader; | |
11 | 16 | import org.jeecg.modules.wms.shipment.shipmentContainerHeader.mapper.ShipmentContainerDetailMapper; |
12 | 17 | import org.jeecg.modules.wms.shipment.shipmentContainerHeader.mapper.ShipmentContainerHeaderMapper; |
13 | 18 | import org.jeecg.modules.wms.shipment.shipmentContainerHeader.service.IShipmentContainerDetailService; |
14 | 19 | import org.jeecg.modules.wms.shipment.shipmentContainerHeader.service.IShipmentContainerHeaderService; |
15 | 20 | import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentDetail; |
16 | -import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentHeader; | |
17 | 21 | import org.jeecg.modules.wms.shipment.shipmentHeader.service.IShipmentDetailService; |
18 | 22 | import org.jeecg.modules.wms.shipment.shipmentHeader.service.IShipmentHeaderService; |
19 | 23 | import org.jeecg.utils.constant.QuantityConstant; |
20 | -import org.springframework.stereotype.Service; | |
21 | -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |
22 | 24 | import org.springframework.beans.factory.annotation.Autowired; |
25 | +import org.springframework.stereotype.Service; | |
23 | 26 | import org.springframework.transaction.annotation.Transactional; |
24 | 27 | |
25 | -import javax.annotation.Resource; | |
26 | -import java.io.Serializable; | |
27 | -import java.util.ArrayList; | |
28 | -import java.util.List; | |
29 | -import java.util.Collection; | |
30 | -import java.util.stream.Collectors; | |
28 | +import com.aliyun.oss.ServiceException; | |
29 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
30 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |
31 | +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |
31 | 32 | |
32 | 33 | /** |
33 | 34 | * @Description: 出库组盘 |
... | ... | @@ -49,6 +50,8 @@ public class ShipmentContainerHeaderServiceImpl extends ServiceImpl<ShipmentCont |
49 | 50 | private IShipmentHeaderService shipmentHeaderService; |
50 | 51 | @Resource |
51 | 52 | private IShipmentContainerDetailService shipmentContainerDetailService; |
53 | + @Resource | |
54 | + private IInventoryDetailService inventoryDetailService; | |
52 | 55 | |
53 | 56 | @Override |
54 | 57 | @Transactional |
... | ... | @@ -164,4 +167,53 @@ public class ShipmentContainerHeaderServiceImpl extends ServiceImpl<ShipmentCont |
164 | 167 | return true; |
165 | 168 | } |
166 | 169 | |
170 | + @Override | |
171 | + @Transactional(rollbackFor = ServiceException.class) | |
172 | + public Result cancelCombine(Integer id) { | |
173 | + ShipmentContainerHeader shipmentContainerHeader = this.getById(id); | |
174 | + if (shipmentContainerHeader == null) { | |
175 | + return Result.error("取消出库配盘失败, 没有找到出库组盘头id是" + id); | |
176 | + } | |
177 | + int status = shipmentContainerHeader.getStatus(); | |
178 | + if (status >= QuantityConstant.SHIPMENT_CONTAINER_TASK) { | |
179 | + return Result.error("取消出库配盘失败,已经生成出库任务"); | |
180 | + } | |
181 | + List<ShipmentContainerDetail> shipmentContainerDetailList = shipmentContainerDetailService.getShipmentContainerDetailListByHeaderId(id); | |
182 | + for (ShipmentContainerDetail shipmentContainerDetail : shipmentContainerDetailList) { | |
183 | + ShipmentDetail shipmentDetail = shipmentDetailService.getById(shipmentContainerDetail.getShipmentDetailId()); | |
184 | + if (shipmentDetail == null) { | |
185 | + throw new ServiceException("取消出库配盘失败, 没有找到出库单详情id是" + shipmentContainerDetail.getShipmentDetailId()); | |
186 | + } | |
187 | + shipmentDetail.setStatus(QuantityConstant.SHIPMENT_HEADER_BUILD); | |
188 | + shipmentDetail.setTaskQty(shipmentDetail.getTaskQty().subtract(shipmentContainerDetail.getQty())); | |
189 | + if (!shipmentDetailService.updateById(shipmentDetail)) { | |
190 | + throw new ServiceException("取消出库配盘失败, 更新出库明细失败id是" + shipmentContainerDetail.getShipmentDetailId()); | |
191 | + } | |
192 | + if (!shipmentContainerDetailService.removeById(shipmentContainerDetail.getId())) { | |
193 | + throw new ServiceException("取消出库配盘失败, 删除出库组盘明细表失败id是" + shipmentContainerDetail.getId()); | |
194 | + } | |
195 | + if (!shipmentHeaderService.updateShipmentHeaderStatus(shipmentDetail.getShipmentId())) { | |
196 | + throw new ServiceException("取消出库配盘失败, 更新出库单头失败"); | |
197 | + } | |
198 | + InventoryDetail inventoryDetail = inventoryDetailService.getById(shipmentContainerDetail.getInventoryDetailId()); | |
199 | + inventoryDetail.setTaskQty(inventoryDetail.getTaskQty().subtract(shipmentContainerDetail.getQty())); | |
200 | + if (!inventoryDetailService.updateById(inventoryDetail)) { | |
201 | + throw new ServiceException("取消出库配盘失败, 解锁库存详情失败"); | |
202 | + } | |
203 | + } | |
204 | + if (!this.removeById(id)) { | |
205 | + throw new ServiceException("取消出库配盘失败, 删除出库组盘头表失败id是" + id); | |
206 | + } | |
207 | + return Result.ok("取消配盘成功"); | |
208 | + } | |
209 | + | |
210 | + @Override | |
211 | + public Result cancelCombine(List<Integer> ids) { | |
212 | + Result result = null; | |
213 | + for (Integer id : ids) { | |
214 | + result = cancelCombine(id); | |
215 | + } | |
216 | + return result; | |
217 | + } | |
218 | + | |
167 | 219 | } |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/entity/TaskHeader.java
... | ... | @@ -3,6 +3,8 @@ package org.jeecg.modules.wms.task.taskHeader.entity; |
3 | 3 | import java.io.Serializable; |
4 | 4 | import java.util.Date; |
5 | 5 | |
6 | +import javax.validation.constraints.NotEmpty; | |
7 | + | |
6 | 8 | import org.jeecg.common.aspect.annotation.Dict; |
7 | 9 | import org.jeecgframework.poi.excel.annotation.Excel; |
8 | 10 | |
... | ... | @@ -45,6 +47,7 @@ public class TaskHeader implements Serializable { |
45 | 47 | /** 仓库 */ |
46 | 48 | @Excel(name = "仓库", width = 15) |
47 | 49 | @ApiModelProperty(value = "仓库") |
50 | + @NotEmpty(message = "仓库编码不能为空") | |
48 | 51 | private String warehouseCode; |
49 | 52 | /** 货主 */ |
50 | 53 | @Excel(name = "货主", width = 15) |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java
... | ... | @@ -6,16 +6,13 @@ import java.util.ArrayList; |
6 | 6 | import java.util.Collection; |
7 | 7 | import java.util.Date; |
8 | 8 | import java.util.List; |
9 | -import java.util.concurrent.CopyOnWriteArrayList; | |
10 | 9 | import java.util.stream.Collectors; |
11 | 10 | |
12 | 11 | import javax.annotation.Resource; |
13 | 12 | |
14 | -import org.apache.poi.hpsf.Decimal; | |
15 | 13 | import org.apache.shiro.SecurityUtils; |
16 | 14 | import org.jeecg.common.api.vo.Result; |
17 | 15 | import org.jeecg.common.system.vo.LoginUser; |
18 | -import org.jeecg.modules.system.entity.SysDepartRolePermission; | |
19 | 16 | import org.jeecg.modules.wms.api.wcs.service.LocationAllocationService; |
20 | 17 | import org.jeecg.modules.wms.api.wcs.service.WcsService; |
21 | 18 | import org.jeecg.modules.wms.config.container.entity.Container; |
... | ... | @@ -26,7 +23,6 @@ import org.jeecg.modules.wms.config.locationHigh.entity.LocationHigh; |
26 | 23 | import org.jeecg.modules.wms.config.locationHigh.service.ILocationHighService; |
27 | 24 | import org.jeecg.modules.wms.config.locationType.entity.LocationType; |
28 | 25 | import org.jeecg.modules.wms.config.locationType.service.ILocationTypeService; |
29 | -import org.jeecg.modules.wms.config.material.service.IMaterialService; | |
30 | 26 | import org.jeecg.modules.wms.config.parameterConfiguration.service.IParameterConfigurationService; |
31 | 27 | import org.jeecg.modules.wms.config.port.entity.Port; |
32 | 28 | import org.jeecg.modules.wms.config.port.service.IPortService; |
... | ... | @@ -63,7 +59,6 @@ import org.jeecg.modules.wms.task.taskHeader.mapper.TaskDetailMapper; |
63 | 59 | import org.jeecg.modules.wms.task.taskHeader.mapper.TaskHeaderMapper; |
64 | 60 | import org.jeecg.modules.wms.task.taskHeader.service.ITaskDetailService; |
65 | 61 | import org.jeecg.modules.wms.task.taskHeader.service.ITaskHeaderService; |
66 | -import org.jeecg.utils.HuahengJwtUtil; | |
67 | 62 | import org.jeecg.utils.StringUtils; |
68 | 63 | import org.jeecg.utils.constant.QuantityConstant; |
69 | 64 | import org.springframework.beans.factory.annotation.Autowired; |
... | ... | @@ -1395,7 +1390,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1395 | 1390 | if (!success) { |
1396 | 1391 | throw new ServiceException("完成分拣出库任务,更新目标库位失败"); |
1397 | 1392 | } |
1398 | - success = containerService.updateLocationCodeAndStatus(containerCode, toLocationCode, containerStatus, warehouseCode); | |
1393 | + success = containerService.updateStatus(containerCode, containerStatus, warehouseCode); | |
1399 | 1394 | if (!success) { |
1400 | 1395 | throw new ServiceException("完成分拣出库任务,更新容器失败"); |
1401 | 1396 | } |
... | ... | @@ -1515,73 +1510,62 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1515 | 1510 | return Result.OK("完成空托盘入库成功"); |
1516 | 1511 | } |
1517 | 1512 | |
1518 | - | |
1519 | - | |
1520 | - | |
1521 | 1513 | /** |
1522 | 1514 | * 盘点完成 |
1523 | - *盘点有差异完成时状态为105 | |
1524 | - * @param taskHeader | |
1515 | + * 盘点有差异完成时状态为105 | |
1516 | + * @param taskHeader | |
1525 | 1517 | * @return |
1526 | 1518 | */ |
1527 | 1519 | @Transactional(rollbackFor = Exception.class) |
1528 | 1520 | public Result completeCycleCountTask(TaskHeader taskHeader) { |
1529 | - /*盘点完成,传入任务主单,查出任务明细,通过任务明细查找盘点的明细单, | |
1530 | - 完成任务同时,修改盘点细单和主单的状态,完成后库存锁复位*/ | |
1521 | + /* | |
1522 | + * 盘点完成,传入任务主单,查出任务明细,通过任务明细查找盘点的明细单, | |
1523 | + * 完成任务同时,修改盘点细单和主单的状态,完成后库存锁复位 | |
1524 | + */ | |
1531 | 1525 | |
1532 | - LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); | |
1526 | + LoginUser sysUser = (LoginUser)SecurityUtils.getSubject().getPrincipal(); | |
1533 | 1527 | taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); |
1534 | - //更新用户 | |
1528 | + // 更新用户 | |
1535 | 1529 | taskHeader.setUpdateBy(sysUser.getUsername()); |
1536 | - //更新时间 | |
1530 | + // 更新时间 | |
1537 | 1531 | taskHeader.setUpdateTime(new Date()); |
1538 | 1532 | |
1539 | - | |
1540 | - //1.先拿到盘点单主单据 | |
1533 | + // 1.先拿到盘点单主单据 | |
1541 | 1534 | CycleCountDetail cycleCountDetail = cycleCountDetailService.getById(taskHeader.getShipmentContainerHeaderId()); |
1542 | 1535 | |
1543 | - if ((cycleCountDetail.getCountedQty().add(cycleCountDetail.getGapQty())).compareTo(BigDecimal.ZERO)==0) | |
1544 | - { | |
1545 | - return Result.error("盘点单据系统实盘数量跟差异数量0,不能完成 单据号" +cycleCountDetail.getCycleCountHeadCode()); | |
1536 | + if ((cycleCountDetail.getCountedQty().add(cycleCountDetail.getGapQty())).compareTo(BigDecimal.ZERO) == 0) { | |
1537 | + return Result.error("盘点单据系统实盘数量跟差异数量0,不能完成 单据号" + cycleCountDetail.getCycleCountHeadCode()); | |
1546 | 1538 | } |
1547 | 1539 | |
1548 | - //2.盘点单主单据查明细单据list | |
1540 | + // 2.盘点单主单据查明细单据list | |
1549 | 1541 | LambdaQueryWrapper<CycleCountDetailChild> childLambdaQueryWrapper = new LambdaQueryWrapper<CycleCountDetailChild>(); |
1550 | - childLambdaQueryWrapper.eq(CycleCountDetailChild::getCycleCountDetailid,cycleCountDetail.getId()); | |
1542 | + childLambdaQueryWrapper.eq(CycleCountDetailChild::getCycleCountDetailid, cycleCountDetail.getId()); | |
1551 | 1543 | List<CycleCountDetailChild> children = cycleCountDetailChildService.list(childLambdaQueryWrapper); |
1552 | 1544 | |
1553 | - //3.单据list如果差异数量+生成入库单,差异数-生成出库单进行回传类型其他出库单 | |
1554 | - | |
1545 | + // 3.单据list如果差异数量+生成入库单,差异数-生成出库单进行回传类型其他出库单 | |
1555 | 1546 | |
1556 | 1547 | InventoryHeader inventoryHeader = inventoryHeaderService.getById(cycleCountDetail.getInventoryHeaderId()); |
1557 | 1548 | |
1558 | - int outboundOrderId=0; | |
1559 | - String outboundOrderCode=null; | |
1560 | - int warehousingOrderId=0; | |
1561 | - String warehousingOrderCode=null; | |
1549 | + int outboundOrderId = 0; | |
1550 | + String outboundOrderCode = null; | |
1551 | + int warehousingOrderId = 0; | |
1552 | + String warehousingOrderCode = null; | |
1562 | 1553 | |
1563 | - | |
1564 | - for (CycleCountDetailChild child : children) | |
1565 | - { | |
1566 | - if (!child.getChildStatus().equals(QuantityConstant.CYCLECOUNT_STATUS_REGISTERED)) | |
1567 | - { | |
1554 | + for (CycleCountDetailChild child : children) { | |
1555 | + if (!child.getChildStatus().equals(QuantityConstant.CYCLECOUNT_STATUS_REGISTERED)) { | |
1568 | 1556 | throw new ServiceException("当前任务里面还有没有进行登记的数据,不能完成任务"); |
1569 | 1557 | } |
1570 | 1558 | |
1571 | - | |
1572 | - if (child.getInventoryDetaiId()!=null) | |
1573 | - { | |
1559 | + if (child.getInventoryDetaiId() != null) { | |
1574 | 1560 | InventoryDetail inventoryDetail = inventoryDetailService.getById(child.getInventoryDetaiId()); |
1575 | - if (inventoryDetail==null) | |
1576 | - { | |
1561 | + if (inventoryDetail == null) { | |
1577 | 1562 | throw new ServiceException("盘点还没完成 库存明细单据就不存在了 可能出现了问题或者所容器没成功"); |
1578 | 1563 | } |
1579 | 1564 | inventoryHeader.setTotalQty(inventoryHeader.getTotalQty().add(child.getGapQty())); |
1580 | 1565 | inventoryDetail.setQty(child.getCountedQty()); |
1581 | 1566 | inventoryDetailService.updateById(inventoryDetail); |
1582 | - }else | |
1583 | - { | |
1584 | - InventoryDetail inventoryDetail=new InventoryDetail(); | |
1567 | + } else { | |
1568 | + InventoryDetail inventoryDetail = new InventoryDetail(); | |
1585 | 1569 | inventoryDetail.setInventoryHeaderId(inventoryHeader.getId()); |
1586 | 1570 | inventoryDetail.setWarehouseCode(inventoryHeader.getWarehouseCode()); |
1587 | 1571 | inventoryDetail.setCompanyCode(inventoryHeader.getCompanyCode()); |
... | ... | @@ -1600,30 +1584,27 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1600 | 1584 | child.setInventoryDetaiId(inventoryDetail.getId()); |
1601 | 1585 | } |
1602 | 1586 | |
1603 | - | |
1604 | 1587 | child.setChildStatus(QuantityConstant.CYCLECOUNT_STATUS_COMPLETED); |
1605 | - if (child.getGapQty().compareTo(BigDecimal.ZERO) == 1) | |
1606 | - { | |
1607 | - if (warehousingOrderId==0) { | |
1588 | + if (child.getGapQty().compareTo(BigDecimal.ZERO) == 1) { | |
1589 | + if (warehousingOrderId == 0) { | |
1608 | 1590 | ReceiptHeader receiptHeader = new ReceiptHeader(); |
1609 | 1591 | receiptHeader.setWarehouseCode(taskHeader.getWarehouseCode()); |
1610 | 1592 | receiptHeader.setCompanyCode(taskHeader.getCompanyCode()); |
1611 | 1593 | receiptHeader.setType(QuantityConstant.RECEIPT_BILL_TYPE_OR); |
1612 | - receiptHeader.setRemark("盘盈 单号"+cycleCountDetail.getCycleCountHeadCode()); | |
1594 | + receiptHeader.setRemark("盘盈 单号" + cycleCountDetail.getCycleCountHeadCode()); | |
1613 | 1595 | Result result = receiptHeaderService.saveReceiptHeader(receiptHeader); |
1614 | - if (result.getCode() != 200) | |
1615 | - { | |
1596 | + if (result.getCode() != 200) { | |
1616 | 1597 | return result; |
1617 | 1598 | } |
1618 | 1599 | receiptHeader.setFirstStatus(QuantityConstant.RECEIPT_HEADER_COMPLETED); |
1619 | 1600 | receiptHeader.setLastStatus(QuantityConstant.RECEIPT_HEADER_COMPLETED); |
1620 | 1601 | receiptHeaderService.updateById(receiptHeader); |
1621 | - //生成入库单并且赋值给warehousingOrderId | |
1622 | - warehousingOrderId=receiptHeader.getId(); | |
1623 | - warehousingOrderCode=receiptHeader.getCode(); | |
1602 | + // 生成入库单并且赋值给warehousingOrderId | |
1603 | + warehousingOrderId = receiptHeader.getId(); | |
1604 | + warehousingOrderCode = receiptHeader.getCode(); | |
1624 | 1605 | } |
1625 | 1606 | |
1626 | - //生成明细 | |
1607 | + // 生成明细 | |
1627 | 1608 | ReceiptDetail receiptDetail = new ReceiptDetail(); |
1628 | 1609 | receiptDetail.setReceiptId(warehousingOrderId); |
1629 | 1610 | receiptDetail.setReceiptCode(warehousingOrderCode); |
... | ... | @@ -1641,8 +1622,8 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1641 | 1622 | receiptDetail.setStatus(QuantityConstant.RECEIPT_HEADER_COMPLETED); |
1642 | 1623 | receiptDetailService.save(receiptDetail); |
1643 | 1624 | |
1644 | - //增加库存交易记录 | |
1645 | - InventoryTransaction inventoryTransaction=new InventoryTransaction(); | |
1625 | + // 增加库存交易记录 | |
1626 | + InventoryTransaction inventoryTransaction = new InventoryTransaction(); | |
1646 | 1627 | inventoryTransaction.setWarehouseCode(taskHeader.getWarehouseCode()); |
1647 | 1628 | inventoryTransaction.setCompanyCode(taskHeader.getCompanyCode()); |
1648 | 1629 | inventoryTransaction.setContainerCode(child.getContainerCode()); |
... | ... | @@ -1662,38 +1643,31 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1662 | 1643 | |
1663 | 1644 | } |
1664 | 1645 | |
1646 | + if (child.getGapQty().compareTo(BigDecimal.ZERO) == -1) { | |
1665 | 1647 | |
1666 | - | |
1667 | - if (child.getGapQty().compareTo(BigDecimal.ZERO) == -1) | |
1668 | - { | |
1669 | - | |
1670 | - if (child.getGapQty().abs().compareTo(child.getSystemQty()) > -1) | |
1671 | - { | |
1648 | + if (child.getGapQty().abs().compareTo(child.getSystemQty()) > -1) { | |
1672 | 1649 | inventoryDetailService.removeById(child.getInventoryDetaiId()); |
1673 | 1650 | } |
1674 | 1651 | |
1675 | - | |
1676 | - if (outboundOrderId==0) | |
1677 | - { | |
1652 | + if (outboundOrderId == 0) { | |
1678 | 1653 | ShipmentHeader shipmentHeader = new ShipmentHeader(); |
1679 | 1654 | shipmentHeader.setWarehouseCode(taskHeader.getWarehouseCode()); |
1680 | 1655 | shipmentHeader.setCompanyCode(taskHeader.getCompanyCode()); |
1681 | 1656 | shipmentHeader.setType(QuantityConstant.SHIPMENT_BILL_TYPE_OS); |
1682 | - shipmentHeader.setRemark("盘亏 单号"+cycleCountDetail.getCycleCountHeadCode()); | |
1657 | + shipmentHeader.setRemark("盘亏 单号" + cycleCountDetail.getCycleCountHeadCode()); | |
1683 | 1658 | Result result = shipmentHeaderService.saveShipmentHeader(shipmentHeader); |
1684 | - if (result.getCode() != 200) | |
1685 | - { | |
1659 | + if (result.getCode() != 200) { | |
1686 | 1660 | return result; |
1687 | 1661 | } |
1688 | 1662 | shipmentHeader.setFirstStatus(QuantityConstant.RECEIPT_HEADER_COMPLETED); |
1689 | 1663 | shipmentHeader.setLastStatus(QuantityConstant.RECEIPT_HEADER_COMPLETED); |
1690 | 1664 | shipmentHeaderService.updateById(shipmentHeader); |
1691 | - //生成出库单并且赋值给outboundOrderId | |
1692 | - outboundOrderId=shipmentHeader.getId(); | |
1693 | - outboundOrderCode=shipmentHeader.getCode(); | |
1665 | + // 生成出库单并且赋值给outboundOrderId | |
1666 | + outboundOrderId = shipmentHeader.getId(); | |
1667 | + outboundOrderCode = shipmentHeader.getCode(); | |
1694 | 1668 | |
1695 | 1669 | } |
1696 | - //生成明细 | |
1670 | + // 生成明细 | |
1697 | 1671 | ShipmentDetail shipmentDetail = new ShipmentDetail(); |
1698 | 1672 | shipmentDetail.setShipmentId(outboundOrderId); |
1699 | 1673 | shipmentDetail.setShipmentCode(outboundOrderCode); |
... | ... | @@ -1711,7 +1685,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1711 | 1685 | shipmentDetail.setStatus(QuantityConstant.RECEIPT_HEADER_COMPLETED); |
1712 | 1686 | shipmentDetailService.save(shipmentDetail); |
1713 | 1687 | |
1714 | - InventoryTransaction inventoryTransaction=new InventoryTransaction(); | |
1688 | + InventoryTransaction inventoryTransaction = new InventoryTransaction(); | |
1715 | 1689 | inventoryTransaction.setWarehouseCode(taskHeader.getWarehouseCode()); |
1716 | 1690 | inventoryTransaction.setCompanyCode(taskHeader.getCompanyCode()); |
1717 | 1691 | inventoryTransaction.setContainerCode(child.getContainerCode()); |
... | ... | @@ -1732,45 +1706,33 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1732 | 1706 | cycleCountDetailChildService.updateById(child); |
1733 | 1707 | } |
1734 | 1708 | |
1735 | - | |
1736 | - if (inventoryHeader.getTotalQty().compareTo(BigDecimal.ZERO)<1) | |
1737 | - { | |
1709 | + if (inventoryHeader.getTotalQty().compareTo(BigDecimal.ZERO) < 1) { | |
1738 | 1710 | inventoryHeaderService.removeById(inventoryHeader); |
1739 | 1711 | } |
1740 | 1712 | |
1741 | 1713 | inventoryHeaderService.updateById(inventoryHeader); |
1742 | 1714 | |
1743 | - //4.完成当前任务 | |
1715 | + // 4.完成当前任务 | |
1744 | 1716 | if (!taskHeaderService.saveOrUpdate(taskHeader)) { |
1745 | 1717 | throw new ServiceException("盘点任务单据状态更新失败!"); |
1746 | 1718 | } |
1747 | - //盘点明细状态 | |
1719 | + // 盘点明细状态 | |
1748 | 1720 | cycleCountDetail.setEnableStatus(QuantityConstant.CYCLECOUNT_STATUS_COMPLETED); |
1749 | 1721 | cycleCountDetail.setCompletedBy(sysUser.getUsername()); |
1750 | 1722 | cycleCountDetail.setCompletedAt(new Date()); |
1751 | 1723 | cycleCountDetailService.updateById(cycleCountDetail); |
1752 | - //更新主单状态 | |
1724 | + // 更新主单状态 | |
1753 | 1725 | cycleCountHeaderService.updataHeaderStatus(cycleCountDetail.getCycleCountHeadCode()); |
1754 | 1726 | |
1727 | + // 释放库位 | |
1728 | + locationService.updateStatus(cycleCountDetail.getLocationCode(), QuantityConstant.STATUS_LOCATION_EMPTY, taskHeader.getWarehouseCode()); | |
1755 | 1729 | |
1756 | - //释放库位 | |
1757 | - locationService.updateStatus(cycleCountDetail.getLocationCode(), | |
1758 | - QuantityConstant.STATUS_LOCATION_EMPTY, taskHeader.getWarehouseCode()); | |
1759 | - | |
1760 | - | |
1761 | - //还原容器状态 | |
1762 | - containerService.restoreContainer(cycleCountDetail.getContainerCode(),taskHeader.getWarehouseCode()); | |
1730 | + // 还原容器状态 | |
1731 | + containerService.restoreContainer(cycleCountDetail.getContainerCode(), taskHeader.getWarehouseCode()); | |
1763 | 1732 | |
1764 | 1733 | return Result.OK("完成盘点任务成功"); |
1765 | 1734 | } |
1766 | 1735 | |
1767 | - | |
1768 | - | |
1769 | - | |
1770 | - | |
1771 | - | |
1772 | - | |
1773 | - | |
1774 | 1736 | /** |
1775 | 1737 | * 完成空托盘出库任务 |
1776 | 1738 | * @param taskHeader 任务 |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/utils/interceptor/HuahengBatisInterceptor.java
... | ... | @@ -12,6 +12,7 @@ import org.apache.ibatis.plugin.*; |
12 | 12 | import org.apache.shiro.SecurityUtils; |
13 | 13 | import org.jeecg.common.system.vo.LoginUser; |
14 | 14 | import org.jeecg.common.util.oConvertUtils; |
15 | +import org.jeecg.utils.HuahengJwtUtil; | |
15 | 16 | import org.springframework.stereotype.Component; |
16 | 17 | |
17 | 18 | import lombok.extern.slf4j.Slf4j; |
... | ... | @@ -113,7 +114,7 @@ public class HuahengBatisInterceptor implements Interceptor { |
113 | 114 | if (sysUser != null) { |
114 | 115 | // 登录账号 |
115 | 116 | field.setAccessible(true); |
116 | - field.set(parameter, sysUser.getRealname()); | |
117 | + field.set(parameter, HuahengJwtUtil.getCurrentOperator()); | |
117 | 118 | field.setAccessible(false); |
118 | 119 | } |
119 | 120 | } |
... | ... |