Commit 8eb844943f33c32cbe37b1928be3889eef361dad
1 parent
35d24c80
事务回滚
Showing
5 changed files
with
273 additions
and
239 deletions
src/main/java/com/huaheng/pc/receipt/receiptContainerDetail/service/ReceiptContainerDetailServiceImpl.java
@@ -20,6 +20,7 @@ import com.huaheng.pc.receipt.receiptDetail.service.ReceiptDetailService; | @@ -20,6 +20,7 @@ import com.huaheng.pc.receipt.receiptDetail.service.ReceiptDetailService; | ||
20 | import com.huaheng.pc.receipt.receiptHeader.domain.ReceiptHeader; | 20 | import com.huaheng.pc.receipt.receiptHeader.domain.ReceiptHeader; |
21 | import com.huaheng.pc.receipt.receiptHeader.service.ReceiptHeaderService; | 21 | import com.huaheng.pc.receipt.receiptHeader.service.ReceiptHeaderService; |
22 | import org.springframework.stereotype.Service; | 22 | import org.springframework.stereotype.Service; |
23 | +import org.springframework.transaction.annotation.Transactional; | ||
23 | 24 | ||
24 | import javax.annotation.Resource; | 25 | import javax.annotation.Resource; |
25 | import java.util.ArrayList; | 26 | import java.util.ArrayList; |
@@ -27,7 +28,7 @@ import java.util.List; | @@ -27,7 +28,7 @@ import java.util.List; | ||
27 | import java.util.Map; | 28 | import java.util.Map; |
28 | 29 | ||
29 | @Service | 30 | @Service |
30 | -public class ReceiptContainerDetailServiceImpl extends ServiceImpl<ReceiptContainerDetailMapper, ReceiptContainerDetail> implements ReceiptContainerDetailService{ | 31 | +public class ReceiptContainerDetailServiceImpl extends ServiceImpl<ReceiptContainerDetailMapper, ReceiptContainerDetail> implements ReceiptContainerDetailService { |
31 | 32 | ||
32 | @Resource | 33 | @Resource |
33 | private ReceiptDetailService receiptDetailService; | 34 | private ReceiptDetailService receiptDetailService; |
@@ -39,8 +40,10 @@ public class ReceiptContainerDetailServiceImpl extends ServiceImpl<ReceiptContai | @@ -39,8 +40,10 @@ public class ReceiptContainerDetailServiceImpl extends ServiceImpl<ReceiptContai | ||
39 | private MaterialService materialService; | 40 | private MaterialService materialService; |
40 | @Resource | 41 | @Resource |
41 | private LocationService locationService; | 42 | private LocationService locationService; |
43 | + | ||
42 | /** | 44 | /** |
43 | * 根据入库单编码查询入库组盘明细 | 45 | * 根据入库单编码查询入库组盘明细 |
46 | + * | ||
44 | * @param receiptCode 入库单编码 | 47 | * @param receiptCode 入库单编码 |
45 | * @return AjaxResult | 48 | * @return AjaxResult |
46 | */ | 49 | */ |
@@ -56,15 +59,16 @@ public class ReceiptContainerDetailServiceImpl extends ServiceImpl<ReceiptContai | @@ -56,15 +59,16 @@ public class ReceiptContainerDetailServiceImpl extends ServiceImpl<ReceiptContai | ||
56 | 59 | ||
57 | /** | 60 | /** |
58 | * 撤销入库组盘明细 | 61 | * 撤销入库组盘明细 |
62 | + * | ||
59 | * @param idList | 63 | * @param idList |
60 | * @return | 64 | * @return |
61 | */ | 65 | */ |
62 | @Override | 66 | @Override |
63 | public Boolean detailRemove(List<Integer> idList) { | 67 | public Boolean detailRemove(List<Integer> idList) { |
64 | - for (Integer id : idList){ | 68 | + for (Integer id : idList) { |
65 | ReceiptContainerDetail receiptContainerDetail = this.getById(id); | 69 | ReceiptContainerDetail receiptContainerDetail = this.getById(id); |
66 | //如果已生成任务不允许撤销 | 70 | //如果已生成任务不允许撤销 |
67 | - if (receiptContainerDetail.getStatus() < QuantityConstant.RECEIPT_CONTAINER_TASK){ | 71 | + if (receiptContainerDetail.getStatus() < QuantityConstant.RECEIPT_CONTAINER_TASK) { |
68 | //回滚入库单明细收货数量 | 72 | //回滚入库单明细收货数量 |
69 | ReceiptDetail receiptDetail = receiptDetailService.getById(receiptContainerDetail.getReceiptDetailId()); | 73 | ReceiptDetail receiptDetail = receiptDetailService.getById(receiptContainerDetail.getReceiptDetailId()); |
70 | receiptDetail.setTaskQty(receiptDetail.getTaskQty().subtract(receiptContainerDetail.getQty())); | 74 | receiptDetail.setTaskQty(receiptDetail.getTaskQty().subtract(receiptContainerDetail.getQty())); |
@@ -72,18 +76,22 @@ public class ReceiptContainerDetailServiceImpl extends ServiceImpl<ReceiptContai | @@ -72,18 +76,22 @@ public class ReceiptContainerDetailServiceImpl extends ServiceImpl<ReceiptContai | ||
72 | //如果为临时容器,则删除 | 76 | //如果为临时容器,则删除 |
73 | receiptContainerDetail.getContainerCode(); | 77 | receiptContainerDetail.getContainerCode(); |
74 | 78 | ||
75 | - if (!receiptDetailService.updateById(receiptDetail)){throw new SecurityException("回滚入库单明细失败");} | 79 | + if (!receiptDetailService.updateById(receiptDetail)) { |
80 | + throw new SecurityException("回滚入库单明细失败"); | ||
81 | + } | ||
76 | //删除组盘明细 | 82 | //删除组盘明细 |
77 | - if (!this.removeById(id)){ throw new ServiceException("回滚入库组盘失败");} | 83 | + if (!this.removeById(id)) { |
84 | + throw new ServiceException("回滚入库组盘失败"); | ||
85 | + } | ||
78 | LambdaQueryWrapper<ReceiptContainerDetail> lambdaQueryWrapper = Wrappers.lambdaQuery(); | 86 | LambdaQueryWrapper<ReceiptContainerDetail> lambdaQueryWrapper = Wrappers.lambdaQuery(); |
79 | lambdaQueryWrapper.eq(ReceiptContainerDetail::getReceiptContainerId, receiptContainerDetail.getReceiptContainerId()); | 87 | lambdaQueryWrapper.eq(ReceiptContainerDetail::getReceiptContainerId, receiptContainerDetail.getReceiptContainerId()); |
80 | List<ReceiptContainerDetail> list = this.list(lambdaQueryWrapper); | 88 | List<ReceiptContainerDetail> list = this.list(lambdaQueryWrapper); |
81 | - if (list.size() == 0){ | 89 | + if (list.size() == 0) { |
82 | String locationCode = receiptContainerDetail.getLocationCode(); | 90 | String locationCode = receiptContainerDetail.getLocationCode(); |
83 | - if(StringUtils.isNotEmpty(locationCode)) { | 91 | + if (StringUtils.isNotEmpty(locationCode)) { |
84 | locationService.updateStatus(locationCode, QuantityConstant.STATUS_LOCATION_EMPTY); | 92 | locationService.updateStatus(locationCode, QuantityConstant.STATUS_LOCATION_EMPTY); |
85 | } | 93 | } |
86 | - if (!receiptContainerHeaderService.removeById(receiptContainerDetail.getReceiptContainerId())){ | 94 | + if (!receiptContainerHeaderService.removeById(receiptContainerDetail.getReceiptContainerId())) { |
87 | throw new ServiceException("删除入库组盘头失败"); | 95 | throw new ServiceException("删除入库组盘头失败"); |
88 | } | 96 | } |
89 | } | 97 | } |
@@ -95,14 +103,16 @@ public class ReceiptContainerDetailServiceImpl extends ServiceImpl<ReceiptContai | @@ -95,14 +103,16 @@ public class ReceiptContainerDetailServiceImpl extends ServiceImpl<ReceiptContai | ||
95 | 103 | ||
96 | 104 | ||
97 | //如果入库组盘没有该入库单的组盘信息,回滚入库单状态 | 105 | //如果入库组盘没有该入库单的组盘信息,回滚入库单状态 |
98 | - if (containerDetailList.size() == 0){ | 106 | + if (containerDetailList.size() == 0) { |
99 | ReceiptHeader receiptHeader = new ReceiptHeader(); | 107 | ReceiptHeader receiptHeader = new ReceiptHeader(); |
100 | receiptHeader.setId(receiptContainerDetail.getReceiptId()); | 108 | receiptHeader.setId(receiptContainerDetail.getReceiptId()); |
101 | receiptHeader.setFirstStatus(QuantityConstant.RECEIPT_HEADER_RECEIVING); | 109 | receiptHeader.setFirstStatus(QuantityConstant.RECEIPT_HEADER_RECEIVING); |
102 | receiptHeader.setLastStatus(QuantityConstant.RECEIPT_HEADER_RECEIVING); | 110 | receiptHeader.setLastStatus(QuantityConstant.RECEIPT_HEADER_RECEIVING); |
103 | receiptHeader.setLastUpdatedBy(ShiroUtils.getName()); | 111 | receiptHeader.setLastUpdatedBy(ShiroUtils.getName()); |
104 | 112 | ||
105 | - if (!receiptHeaderService.updateById(receiptHeader)){ throw new ServiceException("回滚头表状态失败"); } | 113 | + if (!receiptHeaderService.updateById(receiptHeader)) { |
114 | + throw new ServiceException("回滚头表状态失败"); | ||
115 | + } | ||
106 | } | 116 | } |
107 | 117 | ||
108 | } else { | 118 | } else { |
@@ -127,16 +137,19 @@ public class ReceiptContainerDetailServiceImpl extends ServiceImpl<ReceiptContai | @@ -127,16 +137,19 @@ public class ReceiptContainerDetailServiceImpl extends ServiceImpl<ReceiptContai | ||
127 | // return AjaxResult.success(receiptContainerDetails); | 137 | // return AjaxResult.success(receiptContainerDetails); |
128 | // } | 138 | // } |
129 | 139 | ||
130 | - /**保存到组盘详细*/ | 140 | + /** |
141 | + * 保存到组盘详细 | ||
142 | + */ | ||
143 | + @Transactional(rollbackFor = Exception.class) | ||
131 | @Override | 144 | @Override |
132 | public List<Integer> insertTodayReceiptcContainerDetail(int headerId, int receiptId, List<Integer> receiptDetailId, List<ReceiptBill> receiptBills) { | 145 | public List<Integer> insertTodayReceiptcContainerDetail(int headerId, int receiptId, List<Integer> receiptDetailId, List<ReceiptBill> receiptBills) { |
133 | List<Integer> mReceiptContainerIds = new ArrayList<>(); | 146 | List<Integer> mReceiptContainerIds = new ArrayList<>(); |
134 | 147 | ||
135 | ReceiptHeader receiptHeader = receiptHeaderService.getById(receiptId); | 148 | ReceiptHeader receiptHeader = receiptHeaderService.getById(receiptId); |
136 | - if(receiptHeader == null) { | 149 | + if (receiptHeader == null) { |
137 | throw new ServiceException("没有找到入库单表头!"); | 150 | throw new ServiceException("没有找到入库单表头!"); |
138 | } | 151 | } |
139 | - for(int i=0; i<receiptBills.size(); i++) { | 152 | + for (int i = 0; i < receiptBills.size(); i++) { |
140 | ReceiptBill receiptBill = receiptBills.get(i); | 153 | ReceiptBill receiptBill = receiptBills.get(i); |
141 | Material condition2 = new Material(); | 154 | Material condition2 = new Material(); |
142 | condition2.setCode(receiptBill.getMaterialCode()); | 155 | condition2.setCode(receiptBill.getMaterialCode()); |
@@ -158,7 +171,7 @@ public class ReceiptContainerDetailServiceImpl extends ServiceImpl<ReceiptContai | @@ -158,7 +171,7 @@ public class ReceiptContainerDetailServiceImpl extends ServiceImpl<ReceiptContai | ||
158 | record.setInventorySts("good"); | 171 | record.setInventorySts("good"); |
159 | record.setQty(receiptBill.getQty()); | 172 | record.setQty(receiptBill.getQty()); |
160 | record.setContainerCode(receiptBills.get(0).getReceiptContainerCode()); | 173 | record.setContainerCode(receiptBills.get(0).getReceiptContainerCode()); |
161 | - if(receiptBill.getWeight() != null) { | 174 | + if (receiptBill.getWeight() != null) { |
162 | record.setWeight(receiptBill.getWeight()); | 175 | record.setWeight(receiptBill.getWeight()); |
163 | } | 176 | } |
164 | record.setCreatedBy(ShiroUtils.getName()); | 177 | record.setCreatedBy(ShiroUtils.getName()); |
@@ -168,7 +181,7 @@ public class ReceiptContainerDetailServiceImpl extends ServiceImpl<ReceiptContai | @@ -168,7 +181,7 @@ public class ReceiptContainerDetailServiceImpl extends ServiceImpl<ReceiptContai | ||
168 | detailyWrapper.eq(ReceiptContainerDetail::getReceiptContainerId, headerId) | 181 | detailyWrapper.eq(ReceiptContainerDetail::getReceiptContainerId, headerId) |
169 | .eq(ReceiptContainerDetail::getReceiptCode, receiptHeader.getCode()); | 182 | .eq(ReceiptContainerDetail::getReceiptCode, receiptHeader.getCode()); |
170 | ReceiptContainerDetail receiptContainerDetail = getOne(detailyWrapper); | 183 | ReceiptContainerDetail receiptContainerDetail = getOne(detailyWrapper); |
171 | - if(receiptContainerDetail == null) { | 184 | + if (receiptContainerDetail == null) { |
172 | save(record); | 185 | save(record); |
173 | mReceiptContainerIds.add(record.getId()); | 186 | mReceiptContainerIds.add(record.getId()); |
174 | } else { | 187 | } else { |
src/main/java/com/huaheng/pc/receipt/receiptContainerHeader/service/ReceiptContainerHeaderServiceImpl.java
@@ -44,9 +44,11 @@ import java.text.MessageFormat; | @@ -44,9 +44,11 @@ import java.text.MessageFormat; | ||
44 | import java.util.Calendar; | 44 | import java.util.Calendar; |
45 | import java.util.Date; | 45 | import java.util.Date; |
46 | import java.util.List; | 46 | import java.util.List; |
47 | -@Service | ||
48 | -public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContainerHeaderMapper, ReceiptContainerHeader> implements ReceiptContainerHeaderService{ | ||
49 | 47 | ||
48 | +@Service | ||
49 | +public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContainerHeaderMapper, ReceiptContainerHeader> implements ReceiptContainerHeaderService { | ||
50 | + @Resource | ||
51 | + private ReceiptContainerHeaderService receiptContainerHeaderService; | ||
50 | @Resource | 52 | @Resource |
51 | private TaskHeaderService taskHeaderService; | 53 | private TaskHeaderService taskHeaderService; |
52 | @Resource | 54 | @Resource |
@@ -74,22 +76,23 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | @@ -74,22 +76,23 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | ||
74 | 76 | ||
75 | /** | 77 | /** |
76 | * 保存入库组盘 | 78 | * 保存入库组盘 |
77 | - * @param receiptCode 入库单编码 | ||
78 | - * @param containerCode 容器编码 | 79 | + * |
80 | + * @param receiptCode 入库单编码 | ||
81 | + * @param containerCode 容器编码 | ||
79 | * @param receiptDetailId 入库单详情id | 82 | * @param receiptDetailId 入库单详情id |
80 | - * @param locationCode 库位编码 | ||
81 | - * @param qty 收货数量 | ||
82 | - * @param locatingRule 定位规则 | 83 | + * @param locationCode 库位编码 |
84 | + * @param qty 收货数量 | ||
85 | + * @param locatingRule 定位规则 | ||
83 | * @return 是否保存成功 | 86 | * @return 是否保存成功 |
84 | */ | 87 | */ |
85 | @Override | 88 | @Override |
86 | - @Transactional | 89 | + @Transactional(rollbackFor = Exception.class) |
87 | public AjaxResult saveContainer(String receiptCode, String containerCode, Integer receiptDetailId, | 90 | public AjaxResult saveContainer(String receiptCode, String containerCode, Integer receiptDetailId, |
88 | - String locationCode, BigDecimal qty, String locatingRule) { | 91 | + String locationCode, BigDecimal qty, String locatingRule) { |
89 | ReceiptDetail detail = receiptDetailService.getById(receiptDetailId); | 92 | ReceiptDetail detail = receiptDetailService.getById(receiptDetailId); |
90 | - AjaxResult ajaxResult=new AjaxResult(); | 93 | + AjaxResult ajaxResult = new AjaxResult(); |
91 | BigDecimal receiptQty = detail.getQty().subtract(detail.getTaskQty()); | 94 | BigDecimal receiptQty = detail.getQty().subtract(detail.getTaskQty()); |
92 | - if(receiptQty.compareTo(qty) < 0) { | 95 | + if (receiptQty.compareTo(qty) < 0) { |
93 | return AjaxResult.error("不允许超收"); | 96 | return AjaxResult.error("不允许超收"); |
94 | } | 97 | } |
95 | 98 | ||
@@ -103,12 +106,14 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | @@ -103,12 +106,14 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | ||
103 | } else if (taskType == 2) { | 106 | } else if (taskType == 2) { |
104 | throw new ServiceException("该物料不能放在这个容器上,请检查该物料是否可以混放"); | 107 | throw new ServiceException("该物料不能放在这个容器上,请检查该物料是否可以混放"); |
105 | } else { | 108 | } else { |
106 | - if (taskType == 0){ throw new ServiceException("容器状态未知"); } | 109 | + if (taskType == 0) { |
110 | + throw new ServiceException("容器状态未知"); | ||
111 | + } | ||
107 | } | 112 | } |
108 | //判断该物料是用大托盘还是小托盘 | 113 | //判断该物料是用大托盘还是小托盘 |
109 | - Material material=materialService.getMaterialByCode(detail.getMaterialCode()); | 114 | + Material material = materialService.getMaterialByCode(detail.getMaterialCode()); |
110 | Container container = containerService.getContainerByCode(containerCode); | 115 | Container container = containerService.getContainerByCode(containerCode); |
111 | - if(material!=null){ | 116 | + if (material != null) { |
112 | /* | 117 | /* |
113 | if (material.getIsHigh()!=null&&material.getIsHigh()==1){//只能用高托盘 | 118 | if (material.getIsHigh()!=null&&material.getIsHigh()==1){//只能用高托盘 |
114 | if (container.getContainerType().equals("S")){ | 119 | if (container.getContainerType().equals("S")){ |
@@ -131,19 +136,19 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | @@ -131,19 +136,19 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | ||
131 | checkLocationCode(locationCode, containerCode, taskType); | 136 | checkLocationCode(locationCode, containerCode, taskType); |
132 | 137 | ||
133 | int unCompleteCombineNumber = shipmentContainerHeaderService.getUnCompleteCombineNumber(containerCode); | 138 | int unCompleteCombineNumber = shipmentContainerHeaderService.getUnCompleteCombineNumber(containerCode); |
134 | - if(unCompleteCombineNumber > 0) { | 139 | + if (unCompleteCombineNumber > 0) { |
135 | throw new ServiceException("该托盘已经用于出库组盘"); | 140 | throw new ServiceException("该托盘已经用于出库组盘"); |
136 | } | 141 | } |
137 | /* 新建保存组盘头表记录*/ | 142 | /* 新建保存组盘头表记录*/ |
138 | //根据容器编码查询组盘表头记录 | 143 | //根据容器编码查询组盘表头记录 |
139 | LambdaQueryWrapper<ReceiptContainerHeader> lambda = Wrappers.lambdaQuery(); | 144 | LambdaQueryWrapper<ReceiptContainerHeader> lambda = Wrappers.lambdaQuery(); |
140 | lambda.eq(ReceiptContainerHeader::getContainerCode, containerCode) | 145 | lambda.eq(ReceiptContainerHeader::getContainerCode, containerCode) |
141 | - .eq(ReceiptContainerHeader::getStatus, QuantityConstant.RECEIPT_CONTAINER_BUILD); | 146 | + .eq(ReceiptContainerHeader::getStatus, QuantityConstant.RECEIPT_CONTAINER_BUILD); |
142 | List<ReceiptContainerHeader> list = this.list(lambda); | 147 | List<ReceiptContainerHeader> list = this.list(lambda); |
143 | 148 | ||
144 | ReceiptContainerHeader receiptContainerHeader = new ReceiptContainerHeader(); | 149 | ReceiptContainerHeader receiptContainerHeader = new ReceiptContainerHeader(); |
145 | //当size大于等于1表示容器已经有组盘了 | 150 | //当size大于等于1表示容器已经有组盘了 |
146 | - if (list.size() < 1){ | 151 | + if (list.size() < 1) { |
147 | ReceiptDetail receiptDetail = receiptDetailService.getById(receiptDetailId); | 152 | ReceiptDetail receiptDetail = receiptDetailService.getById(receiptDetailId); |
148 | receiptContainerHeader.setWarehouseCode(ShiroUtils.getWarehouseCode()); | 153 | receiptContainerHeader.setWarehouseCode(ShiroUtils.getWarehouseCode()); |
149 | receiptContainerHeader.setCompanyCode(receiptDetail.getCompanyCode()); | 154 | receiptContainerHeader.setCompanyCode(receiptDetail.getCompanyCode()); |
@@ -165,12 +170,12 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | @@ -165,12 +170,12 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | ||
165 | receiptContainerHeader.setLastUpdatedBy(ShiroUtils.getName()); | 170 | receiptContainerHeader.setLastUpdatedBy(ShiroUtils.getName()); |
166 | receiptContainerHeader.setLocatingRule(locatingRule); | 171 | receiptContainerHeader.setLocatingRule(locatingRule); |
167 | receiptContainerHeader.setCreatedBy("test"); | 172 | receiptContainerHeader.setCreatedBy("test"); |
168 | - if (!this.save(receiptContainerHeader)){ | 173 | + if (!this.save(receiptContainerHeader)) { |
169 | throw new ServiceException("入库组盘头表保存失败"); | 174 | throw new ServiceException("入库组盘头表保存失败"); |
170 | } | 175 | } |
171 | } else { | 176 | } else { |
172 | receiptContainerHeader = list.get(0); | 177 | receiptContainerHeader = list.get(0); |
173 | - if (receiptContainerHeader.getStatus() >= QuantityConstant.RECEIPT_CONTAINER_TASK && receiptContainerHeader.getStatus() < QuantityConstant.RECEIPT_CONTAINER_FINISHED){ | 178 | + if (receiptContainerHeader.getStatus() >= QuantityConstant.RECEIPT_CONTAINER_TASK && receiptContainerHeader.getStatus() < QuantityConstant.RECEIPT_CONTAINER_FINISHED) { |
174 | throw new ServiceException("容器已经生成任务,不能放物料了!"); | 179 | throw new ServiceException("容器已经生成任务,不能放物料了!"); |
175 | } | 180 | } |
176 | } | 181 | } |
@@ -181,7 +186,7 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | @@ -181,7 +186,7 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | ||
181 | receiptDetail.setId(receiptDetailId); | 186 | receiptDetail.setId(receiptDetailId); |
182 | receiptDetail.setTaskQty(qty.add(receiptDetail.getTaskQty())); | 187 | receiptDetail.setTaskQty(qty.add(receiptDetail.getTaskQty())); |
183 | //更新入库单详情的收货数量 | 188 | //更新入库单详情的收货数量 |
184 | - if (!receiptDetailService.updateById(receiptDetail)){ | 189 | + if (!receiptDetailService.updateById(receiptDetail)) { |
185 | throw new ServiceException("更新入库单详情失败"); | 190 | throw new ServiceException("更新入库单详情失败"); |
186 | } | 191 | } |
187 | 192 | ||
@@ -189,24 +194,24 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | @@ -189,24 +194,24 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | ||
189 | 194 | ||
190 | receiptContainerDetailAdd(receiptContainerHeaders.get(0), receiptDetail, qty, containerCode, locationCode); | 195 | receiptContainerDetailAdd(receiptContainerHeaders.get(0), receiptDetail, qty, containerCode, locationCode); |
191 | //如果单据数量等于已收数量,更新入库详情状态和入库单状态 | 196 | //如果单据数量等于已收数量,更新入库详情状态和入库单状态 |
192 | - if (receiptDetail.getQty().compareTo(receiptDetail.getTaskQty()) == 0){ | ||
193 | - if (StringUtils.isNotEmpty(locationCode)){ | 197 | + if (receiptDetail.getQty().compareTo(receiptDetail.getTaskQty()) == 0) { |
198 | + if (StringUtils.isNotEmpty(locationCode)) { | ||
194 | receiptDetail.setProcessStamp(QuantityConstant.RECEIPT_HEADER_POSITION.toString()); | 199 | receiptDetail.setProcessStamp(QuantityConstant.RECEIPT_HEADER_POSITION.toString()); |
195 | } else { | 200 | } else { |
196 | receiptDetail.setProcessStamp(QuantityConstant.RECEIPT_HEADER_RECEIVING.toString()); | 201 | receiptDetail.setProcessStamp(QuantityConstant.RECEIPT_HEADER_RECEIVING.toString()); |
197 | } | 202 | } |
198 | - if (!receiptDetailService.updateById(receiptDetail)){ | 203 | + if (!receiptDetailService.updateById(receiptDetail)) { |
199 | throw new ServiceException("更新入库详情处理标记失败"); | 204 | throw new ServiceException("更新入库详情处理标记失败"); |
200 | } | 205 | } |
201 | 206 | ||
202 | ReceiptDetail receiptDetail1 = receiptDetailService.queryflow(receiptDetail); | 207 | ReceiptDetail receiptDetail1 = receiptDetailService.queryflow(receiptDetail); |
203 | - if (!receiptDetailService.updateById(receiptDetail1)){ | 208 | + if (!receiptDetailService.updateById(receiptDetail1)) { |
204 | throw new ServiceException("更新入库详情下一流程失败"); | 209 | throw new ServiceException("更新入库详情下一流程失败"); |
205 | } | 210 | } |
206 | } | 211 | } |
207 | receiptDetailService.updateReceiptHeaderLastStatus(receiptDetail.getReceiptId()); | 212 | receiptDetailService.updateReceiptHeaderLastStatus(receiptDetail.getReceiptId()); |
208 | - JSONObject json=new JSONObject(); | ||
209 | - json.put("id",receiptContainerHeader.getId()); | 213 | + JSONObject json = new JSONObject(); |
214 | + json.put("id", receiptContainerHeader.getId()); | ||
210 | ajaxResult.setData(json); | 215 | ajaxResult.setData(json); |
211 | ajaxResult.setMsg("组盘成功"); | 216 | ajaxResult.setMsg("组盘成功"); |
212 | ajaxResult.setCode(200); | 217 | ajaxResult.setCode(200); |
@@ -215,19 +220,20 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | @@ -215,19 +220,20 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | ||
215 | 220 | ||
216 | /** | 221 | /** |
217 | * 超收检查 | 222 | * 超收检查 |
223 | + * | ||
218 | * @param detail | 224 | * @param detail |
219 | * @param qty | 225 | * @param qty |
220 | */ | 226 | */ |
221 | - private void checkOverReceiving(ReceiptDetail detail, BigDecimal qty){ | 227 | + private void checkOverReceiving(ReceiptDetail detail, BigDecimal qty) { |
222 | BigDecimal _total = detail.getTaskQty().add(qty); | 228 | BigDecimal _total = detail.getTaskQty().add(qty); |
223 | - if(_total.compareTo(detail.getQty()) <= 0){ | 229 | + if (_total.compareTo(detail.getQty()) <= 0) { |
224 | //收货量<=明细总量 | 230 | //收货量<=明细总量 |
225 | return; | 231 | return; |
226 | } | 232 | } |
227 | 233 | ||
228 | ConfigValue configValue = configValueMapper.getConfigValue(ShiroUtils.getWarehouseCode(), "receipt"); | 234 | ConfigValue configValue = configValueMapper.getConfigValue(ShiroUtils.getWarehouseCode(), "receipt"); |
229 | - ReceiptPreference preference = receiptPreferenceMapper.getReceiptPreference(ShiroUtils.getWarehouseCode(),configValue.getValue()); | ||
230 | - if(!preference.getAllowOverReceiving()){ | 235 | + ReceiptPreference preference = receiptPreferenceMapper.getReceiptPreference(ShiroUtils.getWarehouseCode(), configValue.getValue()); |
236 | + if (!preference.getAllowOverReceiving()) { | ||
231 | //入库首选项配置为不允许超收 | 237 | //入库首选项配置为不允许超收 |
232 | throw new ServiceException(String.format("不允许超收")); | 238 | throw new ServiceException(String.format("不允许超收")); |
233 | } | 239 | } |
@@ -235,19 +241,20 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | @@ -235,19 +241,20 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | ||
235 | //超收比例 | 241 | //超收比例 |
236 | BigDecimal _over_rate = new BigDecimal(String.valueOf(1 + preference.getAllowOverReceivingQty() / 100.0)); | 242 | BigDecimal _over_rate = new BigDecimal(String.valueOf(1 + preference.getAllowOverReceivingQty() / 100.0)); |
237 | //超收量上限 | 243 | //超收量上限 |
238 | - BigDecimal _total_over = detail.getQty().multiply (_over_rate); | ||
239 | - if(_total_over.compareTo(_total) >= 0){ | 244 | + BigDecimal _total_over = detail.getQty().multiply(_over_rate); |
245 | + if (_total_over.compareTo(_total) >= 0) { | ||
240 | //在入库首选项的超收范围内 | 246 | //在入库首选项的超收范围内 |
241 | return; | 247 | return; |
242 | } | 248 | } |
243 | 249 | ||
244 | //超过了入库首选项配置的超收比例 | 250 | //超过了入库首选项配置的超收比例 |
245 | throw new ServiceException(String.format("超收上限是: %s%", | 251 | throw new ServiceException(String.format("超收上限是: %s%", |
246 | - _over_rate.multiply(new BigDecimal(100)) )); | 252 | + _over_rate.multiply(new BigDecimal(100)))); |
247 | } | 253 | } |
248 | 254 | ||
249 | /** | 255 | /** |
250 | * 批量撤销入库组盘 | 256 | * 批量撤销入库组盘 |
257 | + * | ||
251 | * @param ids 容器头表标识列表 | 258 | * @param ids 容器头表标识列表 |
252 | * @return true 全部取消成功 | 259 | * @return true 全部取消成功 |
253 | */ | 260 | */ |
@@ -256,17 +263,19 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | @@ -256,17 +263,19 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | ||
256 | public Boolean cancelByIds(List<Integer> ids) { | 263 | public Boolean cancelByIds(List<Integer> ids) { |
257 | for (Integer id : ids) { | 264 | for (Integer id : ids) { |
258 | //如果已生成任务则不允许取消组盘 | 265 | //如果已生成任务则不允许取消组盘 |
259 | - if (this.getById(id).getStatus() < QuantityConstant.RECEIPT_CONTAINER_TASK){ | 266 | + if (this.getById(id).getStatus() < QuantityConstant.RECEIPT_CONTAINER_TASK) { |
260 | //根据组盘头表id查询组盘明细表 | 267 | //根据组盘头表id查询组盘明细表 |
261 | LambdaQueryWrapper<ReceiptContainerDetail> containerDetailLambda = Wrappers.lambdaQuery(); | 268 | LambdaQueryWrapper<ReceiptContainerDetail> containerDetailLambda = Wrappers.lambdaQuery(); |
262 | containerDetailLambda.eq(ReceiptContainerDetail::getReceiptContainerId, id); | 269 | containerDetailLambda.eq(ReceiptContainerDetail::getReceiptContainerId, id); |
263 | List<ReceiptContainerDetail> receiptContainerDetails = receiptContainerDetailService.list(containerDetailLambda); | 270 | List<ReceiptContainerDetail> receiptContainerDetails = receiptContainerDetailService.list(containerDetailLambda); |
264 | 271 | ||
265 | //查询入库单明细,减去已收数量,更新单据 | 272 | //查询入库单明细,减去已收数量,更新单据 |
266 | - for (ReceiptContainerDetail receiptContainerDetail: receiptContainerDetails){ | 273 | + for (ReceiptContainerDetail receiptContainerDetail : receiptContainerDetails) { |
267 | ReceiptDetail receiptDetail = receiptDetailService.getById(receiptContainerDetail.getReceiptDetailId()); | 274 | ReceiptDetail receiptDetail = receiptDetailService.getById(receiptContainerDetail.getReceiptDetailId()); |
268 | receiptDetail.setTaskQty(receiptDetail.getTaskQty().subtract(receiptContainerDetail.getQty())); | 275 | receiptDetail.setTaskQty(receiptDetail.getTaskQty().subtract(receiptContainerDetail.getQty())); |
269 | - if (!receiptDetailService.updateById(receiptDetail)){throw new ServiceException("回滚入库明细失败"); } | 276 | + if (!receiptDetailService.updateById(receiptDetail)) { |
277 | + throw new ServiceException("回滚入库明细失败"); | ||
278 | + } | ||
270 | 279 | ||
271 | containerDetailLambda = Wrappers.lambdaQuery(); | 280 | containerDetailLambda = Wrappers.lambdaQuery(); |
272 | containerDetailLambda.eq(ReceiptContainerDetail::getReceiptId, receiptContainerDetail.getReceiptId()); | 281 | containerDetailLambda.eq(ReceiptContainerDetail::getReceiptId, receiptContainerDetail.getReceiptId()); |
@@ -276,22 +285,24 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | @@ -276,22 +285,24 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | ||
276 | containerService.removeContainer(receiptContainerDetail.getContainerType(), receiptContainerDetail.getContainerCode()); | 285 | containerService.removeContainer(receiptContainerDetail.getContainerType(), receiptContainerDetail.getContainerCode()); |
277 | 286 | ||
278 | //如果入库组盘没有该入库单的组盘信息,回滚入库单状态 | 287 | //如果入库组盘没有该入库单的组盘信息,回滚入库单状态 |
279 | - if (containerDetailList == null){ | 288 | + if (containerDetailList == null) { |
280 | ReceiptHeader receiptHeader = new ReceiptHeader(); | 289 | ReceiptHeader receiptHeader = new ReceiptHeader(); |
281 | receiptHeader.setId(receiptContainerDetail.getReceiptId()); | 290 | receiptHeader.setId(receiptContainerDetail.getReceiptId()); |
282 | receiptHeader.setFirstStatus(QuantityConstant.RECEIPT_HEADER_RECEIVING); | 291 | receiptHeader.setFirstStatus(QuantityConstant.RECEIPT_HEADER_RECEIVING); |
283 | receiptHeader.setLastStatus(QuantityConstant.RECEIPT_HEADER_RECEIVING); | 292 | receiptHeader.setLastStatus(QuantityConstant.RECEIPT_HEADER_RECEIVING); |
284 | receiptHeader.setLastUpdatedBy(ShiroUtils.getName()); | 293 | receiptHeader.setLastUpdatedBy(ShiroUtils.getName()); |
285 | 294 | ||
286 | - if (!receiptHeaderService.updateById(receiptHeader)){ throw new ServiceException("回滚头表状态失败"); } | 295 | + if (!receiptHeaderService.updateById(receiptHeader)) { |
296 | + throw new ServiceException("回滚头表状态失败"); | ||
297 | + } | ||
287 | } | 298 | } |
288 | 299 | ||
289 | - if (!receiptContainerDetailService.removeById(receiptContainerDetail.getId())){ | ||
290 | - throw new ServiceException("删除入库组盘明细表失败,id是"+receiptContainerDetail.getId()); | 300 | + if (!receiptContainerDetailService.removeById(receiptContainerDetail.getId())) { |
301 | + throw new ServiceException("删除入库组盘明细表失败,id是" + receiptContainerDetail.getId()); | ||
291 | } | 302 | } |
292 | } | 303 | } |
293 | //删除入库组盘头表 | 304 | //删除入库组盘头表 |
294 | - if (!this.removeById(id)){ | 305 | + if (!this.removeById(id)) { |
295 | throw new ServiceException("删除入库组盘头表失败"); | 306 | throw new ServiceException("删除入库组盘头表失败"); |
296 | } | 307 | } |
297 | } else { | 308 | } else { |
@@ -331,7 +342,7 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | @@ -331,7 +342,7 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | ||
331 | 342 | ||
332 | AjaxResult ajaxResult = null; | 343 | AjaxResult ajaxResult = null; |
333 | for (ReceiptContainerView receiptContainerView : list) { | 344 | for (ReceiptContainerView receiptContainerView : list) { |
334 | - ajaxResult = saveContainer(receiptContainerView.getReceiptCode(), receiptContainerView.getReceiptContainerCode(), | 345 | + ajaxResult = saveContainer(receiptContainerView.getReceiptCode(), receiptContainerView.getReceiptContainerCode(), |
335 | receiptContainerView.getReceiptDetailId(), receiptContainerView.getLocationCode(), receiptContainerView.getQty(), null); | 346 | receiptContainerView.getReceiptDetailId(), receiptContainerView.getLocationCode(), receiptContainerView.getQty(), null); |
336 | } | 347 | } |
337 | return ajaxResult; | 348 | return ajaxResult; |
@@ -339,6 +350,7 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | @@ -339,6 +350,7 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | ||
339 | 350 | ||
340 | /** | 351 | /** |
341 | * 移动端校验库位 | 352 | * 移动端校验库位 |
353 | + * | ||
342 | * @param record | 354 | * @param record |
343 | * @return | 355 | * @return |
344 | */ | 356 | */ |
@@ -349,23 +361,24 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | @@ -349,23 +361,24 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | ||
349 | 361 | ||
350 | /** | 362 | /** |
351 | * 检查容器编码合法性 | 363 | * 检查容器编码合法性 |
364 | + * | ||
352 | * @param containerCode 容器编码 | 365 | * @param containerCode 容器编码 |
353 | - * @param materialCode 物料编码 | 366 | + * @param materialCode 物料编码 |
354 | * @return 返回容器状态,如果需自动生成容器编码返回1 | 367 | * @return 返回容器状态,如果需自动生成容器编码返回1 |
355 | */ | 368 | */ |
356 | @Transactional | 369 | @Transactional |
357 | public Integer checkContainer(String containerCode, String materialCode) { | 370 | public Integer checkContainer(String containerCode, String materialCode) { |
358 | Material material = materialService.getMaterialByCode(materialCode); | 371 | Material material = materialService.getMaterialByCode(materialCode); |
359 | - if (StringUtils.isEmpty(containerCode)){ | ||
360 | - if (material.getAutoGenSerialNum() == 0){ | ||
361 | - return 1; | ||
362 | - //需自动生成容器编码 | 372 | + if (StringUtils.isEmpty(containerCode)) { |
373 | + if (material.getAutoGenSerialNum() == 0) { | ||
374 | + return 1; | ||
375 | + //需自动生成容器编码 | ||
363 | } else { | 376 | } else { |
364 | throw new ServiceException("容器不能为空"); | 377 | throw new ServiceException("容器不能为空"); |
365 | } | 378 | } |
366 | } | 379 | } |
367 | - if (material == null){ | ||
368 | - throw new ServiceException("物料:"+materialCode+"不存在"); | 380 | + if (material == null) { |
381 | + throw new ServiceException("物料:" + materialCode + "不存在"); | ||
369 | } | 382 | } |
370 | /** | 383 | /** |
371 | * 判断物料是否可以放在当前容器 | 384 | * 判断物料是否可以放在当前容器 |
@@ -389,7 +402,7 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | @@ -389,7 +402,7 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | ||
389 | lambda.eq(Container::getCode, containerCode); | 402 | lambda.eq(Container::getCode, containerCode); |
390 | lambda.eq(Container::getWarehouseCode, ShiroUtils.getWarehouseCode()); | 403 | lambda.eq(Container::getWarehouseCode, ShiroUtils.getWarehouseCode()); |
391 | Container container = containerService.getOne(lambda); | 404 | Container container = containerService.getOne(lambda); |
392 | - if (container == null){ | 405 | + if (container == null) { |
393 | throw new ServiceException("该容器编号不存在"); | 406 | throw new ServiceException("该容器编号不存在"); |
394 | } | 407 | } |
395 | 408 | ||
@@ -400,21 +413,21 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | @@ -400,21 +413,21 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | ||
400 | .lt(TaskHeader::getStatus, QuantityConstant.TASK_STATUS_COMPLETED) | 413 | .lt(TaskHeader::getStatus, QuantityConstant.TASK_STATUS_COMPLETED) |
401 | .eq(TaskHeader::getWarehouseCode, ShiroUtils.getWarehouseCode()); | 414 | .eq(TaskHeader::getWarehouseCode, ShiroUtils.getWarehouseCode()); |
402 | //补充入库跳过校验 | 415 | //补充入库跳过校验 |
403 | - if (taskHeaderService.count(lambdaQueryWrapper) >0 && taskHeaderService.getOne(lambdaQueryWrapper).getStatus()==QuantityConstant.TASK_STATUS_ARRIVED_STATION){ | 416 | + if (taskHeaderService.count(lambdaQueryWrapper) > 0 && taskHeaderService.getOne(lambdaQueryWrapper).getStatus() == QuantityConstant.TASK_STATUS_ARRIVED_STATION) { |
404 | 417 | ||
405 | - }else{ | ||
406 | - if (container.getStatus().equals(QuantityConstant.STATUS_CONTAINER_LOCK)){ | 418 | + } else { |
419 | + if (container.getStatus().equals(QuantityConstant.STATUS_CONTAINER_LOCK)) { | ||
407 | throw new ServiceException("容器已经锁定,不能再组盘"); | 420 | throw new ServiceException("容器已经锁定,不能再组盘"); |
408 | } | 421 | } |
409 | } | 422 | } |
410 | if (taskHeaderService.count(lambdaQueryWrapper) > 0 && taskHeaderService.getOne(lambdaQueryWrapper).getTaskType() != 200) { | 423 | if (taskHeaderService.count(lambdaQueryWrapper) > 0 && taskHeaderService.getOne(lambdaQueryWrapper).getTaskType() != 200) { |
411 | throw new ServiceException("容器已经存在任务,请更换容器"); | 424 | throw new ServiceException("容器已经存在任务,请更换容器"); |
412 | } | 425 | } |
413 | - if (StringUtils.isEmpty(container.getLocationCode())){ | 426 | + if (StringUtils.isEmpty(container.getLocationCode())) { |
414 | return QuantityConstant.TASK_TYPE_WHOLERECEIPT; | 427 | return QuantityConstant.TASK_TYPE_WHOLERECEIPT; |
415 | - }else if (StringUtils.isNotEmpty(container.getStatus()) | ||
416 | - &&(container.getStatus().equals(QuantityConstant.STATUS_CONTAINER_EMPTY) | ||
417 | - ||container.getStatus().equals(QuantityConstant.STATUS_CONTAINER_SOME))) { | 428 | + } else if (StringUtils.isNotEmpty(container.getStatus()) |
429 | + && (container.getStatus().equals(QuantityConstant.STATUS_CONTAINER_EMPTY) | ||
430 | + || container.getStatus().equals(QuantityConstant.STATUS_CONTAINER_SOME))) { | ||
418 | return QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT; | 431 | return QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT; |
419 | } else if (QuantityConstant.STATUS_CONTAINER_FULL.equals(container.getStatus())) { | 432 | } else if (QuantityConstant.STATUS_CONTAINER_FULL.equals(container.getStatus())) { |
420 | throw new ServiceException("该容器已满,请更换容器"); | 433 | throw new ServiceException("该容器已满,请更换容器"); |
@@ -424,16 +437,17 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | @@ -424,16 +437,17 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | ||
424 | 437 | ||
425 | /** | 438 | /** |
426 | * 检查库位是否合法 | 439 | * 检查库位是否合法 |
427 | - * @param locationCode 库位编码 | 440 | + * |
441 | + * @param locationCode 库位编码 | ||
428 | * @param containerCode 容器编码 | 442 | * @param containerCode 容器编码 |
429 | - * @param taskType 任务类型 | 443 | + * @param taskType 任务类型 |
430 | * @return | 444 | * @return |
431 | */ | 445 | */ |
432 | @Transactional | 446 | @Transactional |
433 | - Boolean checkLocationCode(String locationCode, String containerCode, Integer taskType) { | 447 | + public Boolean checkLocationCode(String locationCode, String containerCode, Integer taskType) { |
434 | //如果选了库位,就要校验库位和已经组盘的库位是否一致,避免重入库 | 448 | //如果选了库位,就要校验库位和已经组盘的库位是否一致,避免重入库 |
435 | if (StringUtils.isEmpty(locationCode)) { | 449 | if (StringUtils.isEmpty(locationCode)) { |
436 | - if (QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT == taskType.intValue()) { | 450 | + if (QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT == taskType.intValue()) { |
437 | throw new ServiceException("补充入库,必须填写库位"); | 451 | throw new ServiceException("补充入库,必须填写库位"); |
438 | } else { | 452 | } else { |
439 | return true; | 453 | return true; |
@@ -450,10 +464,10 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | @@ -450,10 +464,10 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | ||
450 | .lt(TaskHeader::getStatus, QuantityConstant.TASK_STATUS_COMPLETED) | 464 | .lt(TaskHeader::getStatus, QuantityConstant.TASK_STATUS_COMPLETED) |
451 | .eq(TaskHeader::getWarehouseCode, ShiroUtils.getWarehouseCode()); | 465 | .eq(TaskHeader::getWarehouseCode, ShiroUtils.getWarehouseCode()); |
452 | //补充入库跳过校验 | 466 | //补充入库跳过校验 |
453 | - if (taskHeaderService.count(lambdaQueryWrapper) >0 && taskHeaderService.getOne(lambdaQueryWrapper).getStatus()==QuantityConstant.TASK_STATUS_ARRIVED_STATION && taskHeaderService.getOne(lambdaQueryWrapper).getTaskType()==QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT){ | 467 | + if (taskHeaderService.count(lambdaQueryWrapper) > 0 && taskHeaderService.getOne(lambdaQueryWrapper).getStatus() == QuantityConstant.TASK_STATUS_ARRIVED_STATION && taskHeaderService.getOne(lambdaQueryWrapper).getTaskType() == QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT) { |
454 | 468 | ||
455 | - }else{ | ||
456 | - if (!QuantityConstant.STATUS_LOCATION_EMPTY.equals(location.getStatus()) ) { | 469 | + } else { |
470 | + if (!QuantityConstant.STATUS_LOCATION_EMPTY.equals(location.getStatus())) { | ||
457 | throw new ServiceException("库位不是空闲状态!"); | 471 | throw new ServiceException("库位不是空闲状态!"); |
458 | } | 472 | } |
459 | } | 473 | } |
@@ -463,11 +477,11 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | @@ -463,11 +477,11 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | ||
463 | throw new ServiceException("库位(" + locationCode + ")有容器(" + location.getContainerCode() + "),不能整盘入库!"); | 477 | throw new ServiceException("库位(" + locationCode + ")有容器(" + location.getContainerCode() + "),不能整盘入库!"); |
464 | } | 478 | } |
465 | } | 479 | } |
466 | - if(QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT== taskType.intValue()) { | ||
467 | - if (StringUtils.isEmpty(location.getContainerCode())){ | 480 | + if (QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT == taskType.intValue()) { |
481 | + if (StringUtils.isEmpty(location.getContainerCode())) { | ||
468 | throw new ServiceException("库位(" + locationCode + ")没有容器,不能补充入库!"); | 482 | throw new ServiceException("库位(" + locationCode + ")没有容器,不能补充入库!"); |
469 | } else if (!location.getContainerCode().equals(containerCode)) { | 483 | } else if (!location.getContainerCode().equals(containerCode)) { |
470 | - throw new ServiceException("库位(" + containerCode + ")对应的容器是:" + location.getContainerCode()+ ",请重选库位!"); | 484 | + throw new ServiceException("库位(" + containerCode + ")对应的容器是:" + location.getContainerCode() + ",请重选库位!"); |
471 | } | 485 | } |
472 | } | 486 | } |
473 | return true; | 487 | return true; |
@@ -475,13 +489,14 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | @@ -475,13 +489,14 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | ||
475 | 489 | ||
476 | /** | 490 | /** |
477 | * 增加组盘明细记录 | 491 | * 增加组盘明细记录 |
478 | - * @param 入库组盘头表id | ||
479 | - * @param receiptDetail 入库详情 | ||
480 | - * @param qty 收货数量 | ||
481 | - * @param containerCode 容器编码 | 492 | + * |
493 | + * @param receiptContainerHeader | ||
494 | + * @param receiptDetail 入库详情 | ||
495 | + * @param qty 收货数量 | ||
496 | + * @param containerCode 容器编码 | ||
482 | */ | 497 | */ |
483 | @Transactional | 498 | @Transactional |
484 | - public void receiptContainerDetailAdd(ReceiptContainerHeader receiptContainerHeader, ReceiptDetail receiptDetail, BigDecimal qty, String containerCode, String locationCode){ | 499 | + public void receiptContainerDetailAdd(ReceiptContainerHeader receiptContainerHeader, ReceiptDetail receiptDetail, BigDecimal qty, String containerCode, String locationCode) { |
485 | int receiptContainerHeaderId = receiptContainerHeader.getId(); | 500 | int receiptContainerHeaderId = receiptContainerHeader.getId(); |
486 | LambdaQueryWrapper<ReceiptContainerDetail> lambda = Wrappers.lambdaQuery(); | 501 | LambdaQueryWrapper<ReceiptContainerDetail> lambda = Wrappers.lambdaQuery(); |
487 | lambda.eq(ReceiptContainerDetail::getReceiptContainerId, receiptContainerHeaderId) | 502 | lambda.eq(ReceiptContainerDetail::getReceiptContainerId, receiptContainerHeaderId) |
@@ -490,7 +505,7 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | @@ -490,7 +505,7 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | ||
490 | .last("Limit 1"); | 505 | .last("Limit 1"); |
491 | ReceiptContainerDetail receiptContainerDetail = receiptContainerDetailService.getOne(lambda); | 506 | ReceiptContainerDetail receiptContainerDetail = receiptContainerDetailService.getOne(lambda); |
492 | 507 | ||
493 | - if (receiptContainerDetail == null){ | 508 | + if (receiptContainerDetail == null) { |
494 | //查询入库头表 | 509 | //查询入库头表 |
495 | LambdaQueryWrapper<ReceiptHeader> receiptHeaderLambda = Wrappers.lambdaQuery(); | 510 | LambdaQueryWrapper<ReceiptHeader> receiptHeaderLambda = Wrappers.lambdaQuery(); |
496 | receiptHeaderLambda.eq(ReceiptHeader::getId, receiptDetail.getReceiptId()) | 511 | receiptHeaderLambda.eq(ReceiptHeader::getId, receiptDetail.getReceiptId()) |
@@ -530,12 +545,12 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | @@ -530,12 +545,12 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | ||
530 | receiptContainerDetail.setInventorySts(receiptDetail.getInventorySts()); | 545 | receiptContainerDetail.setInventorySts(receiptDetail.getInventorySts()); |
531 | receiptContainerDetail.setCreatedBy(ShiroUtils.getName()); | 546 | receiptContainerDetail.setCreatedBy(ShiroUtils.getName()); |
532 | receiptContainerDetail.setLastUpdatedBy(ShiroUtils.getName()); | 547 | receiptContainerDetail.setLastUpdatedBy(ShiroUtils.getName()); |
533 | - if (!receiptContainerDetailService.save(receiptContainerDetail)){ | 548 | + if (!receiptContainerDetailService.save(receiptContainerDetail)) { |
534 | throw new ServiceException("保存入库组盘详情失败"); | 549 | throw new ServiceException("保存入库组盘详情失败"); |
535 | } | 550 | } |
536 | } else { | 551 | } else { |
537 | receiptContainerDetail.setQty(receiptContainerDetail.getQty().add(qty)); | 552 | receiptContainerDetail.setQty(receiptContainerDetail.getQty().add(qty)); |
538 | - if (!receiptContainerDetailService.updateById(receiptContainerDetail)){ | 553 | + if (!receiptContainerDetailService.updateById(receiptContainerDetail)) { |
539 | throw new ServiceException("更新入库组盘详情失败"); | 554 | throw new ServiceException("更新入库组盘详情失败"); |
540 | } | 555 | } |
541 | } | 556 | } |
@@ -545,10 +560,11 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | @@ -545,10 +560,11 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | ||
545 | 560 | ||
546 | /** | 561 | /** |
547 | * 自动生成容器编码 | 562 | * 自动生成容器编码 |
563 | + * | ||
548 | * @return 容器编码 | 564 | * @return 容器编码 |
549 | */ | 565 | */ |
550 | @Transactional | 566 | @Transactional |
551 | - public String createContainer(){ | 567 | + public String createContainer() { |
552 | String code = MessageFormat.format("{0}{1}", | 568 | String code = MessageFormat.format("{0}{1}", |
553 | "LS", | 569 | "LS", |
554 | String.format("%d", Calendar.getInstance().getTimeInMillis())); | 570 | String.format("%d", Calendar.getInstance().getTimeInMillis())); |
@@ -562,7 +578,7 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | @@ -562,7 +578,7 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | ||
562 | container.setLastUpdatedBy(ShiroUtils.getName()); | 578 | container.setLastUpdatedBy(ShiroUtils.getName()); |
563 | container.setEnable(true); | 579 | container.setEnable(true); |
564 | container.setStatus(QuantityConstant.STATUS_CONTAINER_EMPTY); | 580 | container.setStatus(QuantityConstant.STATUS_CONTAINER_EMPTY); |
565 | - if (!containerService.save(container)){ | 581 | + if (!containerService.save(container)) { |
566 | throw new ServiceException("新增容器失败"); | 582 | throw new ServiceException("新增容器失败"); |
567 | } | 583 | } |
568 | return code; | 584 | return code; |
@@ -591,7 +607,7 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | @@ -591,7 +607,7 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | ||
591 | .eq(ReceiptContainerHeader::getStatus, 0); | 607 | .eq(ReceiptContainerHeader::getStatus, 0); |
592 | 608 | ||
593 | ReceiptContainerHeader receiptContainerHeader = getOne(receiptContainerHeaderLambada); | 609 | ReceiptContainerHeader receiptContainerHeader = getOne(receiptContainerHeaderLambada); |
594 | - if(receiptContainerHeader == null) { | 610 | + if (receiptContainerHeader == null) { |
595 | save(recorder); | 611 | save(recorder); |
596 | } else { | 612 | } else { |
597 | return receiptContainerHeader.getId(); | 613 | return receiptContainerHeader.getId(); |
@@ -605,6 +621,7 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | @@ -605,6 +621,7 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | ||
605 | 621 | ||
606 | /** | 622 | /** |
607 | * 取消入库任务 | 623 | * 取消入库任务 |
624 | + * | ||
608 | * @param id 入库组盘头id | 625 | * @param id 入库组盘头id |
609 | * @return | 626 | * @return |
610 | */ | 627 | */ |
@@ -617,7 +634,7 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | @@ -617,7 +634,7 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | ||
617 | ReceiptContainerHeader receiptContainerHeader = new ReceiptContainerHeader(); | 634 | ReceiptContainerHeader receiptContainerHeader = new ReceiptContainerHeader(); |
618 | receiptContainerHeader.setStatus(QuantityConstant.RECEIPT_CONTAINER_BUILD); | 635 | receiptContainerHeader.setStatus(QuantityConstant.RECEIPT_CONTAINER_BUILD); |
619 | receiptContainerHeader.setId(id); | 636 | receiptContainerHeader.setId(id); |
620 | - if (!updateById(receiptContainerHeader)){ | 637 | + if (!updateById(receiptContainerHeader)) { |
621 | throw new ServiceException("回滚入库组盘头表失败"); | 638 | throw new ServiceException("回滚入库组盘头表失败"); |
622 | } | 639 | } |
623 | 640 | ||
@@ -659,7 +676,7 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | @@ -659,7 +676,7 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | ||
659 | .lt(ReceiptContainerHeader::getStatus, QuantityConstant.RECEIPT_CONTAINER_FINISHED); | 676 | .lt(ReceiptContainerHeader::getStatus, QuantityConstant.RECEIPT_CONTAINER_FINISHED); |
660 | int number = 0; | 677 | int number = 0; |
661 | List<ReceiptContainerHeader> receiptContainerHeaderList = list(receiptContainerHeaderLambdaQueryWrapper); | 678 | List<ReceiptContainerHeader> receiptContainerHeaderList = list(receiptContainerHeaderLambdaQueryWrapper); |
662 | - if(receiptContainerHeaderList != null && receiptContainerHeaderList.size() > 0) { | 679 | + if (receiptContainerHeaderList != null && receiptContainerHeaderList.size() > 0) { |
663 | number = receiptContainerHeaderList.size(); | 680 | number = receiptContainerHeaderList.size(); |
664 | } | 681 | } |
665 | return number; | 682 | return number; |
src/main/java/com/huaheng/pc/shipment/shipmentDetail/service/ShipmentDetailServiceImpl.java
@@ -23,6 +23,7 @@ import com.huaheng.pc.shipment.wave.service.WaveService; | @@ -23,6 +23,7 @@ import com.huaheng.pc.shipment.wave.service.WaveService; | ||
23 | import com.huaheng.pc.task.taskDetail.domain.TaskDetail; | 23 | import com.huaheng.pc.task.taskDetail.domain.TaskDetail; |
24 | import org.springframework.beans.factory.annotation.Autowired; | 24 | import org.springframework.beans.factory.annotation.Autowired; |
25 | import org.springframework.stereotype.Service; | 25 | import org.springframework.stereotype.Service; |
26 | + | ||
26 | import javax.annotation.Resource; | 27 | import javax.annotation.Resource; |
27 | import java.math.BigDecimal; | 28 | import java.math.BigDecimal; |
28 | import java.util.ArrayList; | 29 | import java.util.ArrayList; |
@@ -35,11 +36,12 @@ import com.huaheng.pc.shipment.shipmentDetail.domain.ShipmentDetail; | @@ -35,11 +36,12 @@ import com.huaheng.pc.shipment.shipmentDetail.domain.ShipmentDetail; | ||
35 | import org.springframework.transaction.annotation.Transactional; | 36 | import org.springframework.transaction.annotation.Transactional; |
36 | 37 | ||
37 | @Service | 38 | @Service |
38 | -public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, ShipmentDetail> implements ShipmentDetailService{ | 39 | +public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, ShipmentDetail> implements ShipmentDetailService { |
39 | 40 | ||
40 | @Autowired | 41 | @Autowired |
41 | private ShipmentHeaderService shipmentHeaderService; | 42 | private ShipmentHeaderService shipmentHeaderService; |
42 | - | 43 | + @Resource |
44 | + private ShipmentDetailService shipmentDetailService; | ||
43 | @Autowired | 45 | @Autowired |
44 | private MaterialService materialService; | 46 | private MaterialService materialService; |
45 | @Resource | 47 | @Resource |
@@ -62,11 +64,12 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, | @@ -62,11 +64,12 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, | ||
62 | * @return | 64 | * @return |
63 | */ | 65 | */ |
64 | @Override | 66 | @Override |
67 | + @Transactional(rollbackFor = Exception.class) | ||
65 | public AjaxResult insertDetail(ShipmentDetail shipmentDetail) { | 68 | public AjaxResult insertDetail(ShipmentDetail shipmentDetail) { |
66 | //查看主单是否存在 | 69 | //查看主单是否存在 |
67 | LambdaQueryWrapper<ShipmentHeader> lambdaQueryWrapper = Wrappers.lambdaQuery(); | 70 | LambdaQueryWrapper<ShipmentHeader> lambdaQueryWrapper = Wrappers.lambdaQuery(); |
68 | - lambdaQueryWrapper.eq(ShipmentHeader::getId,shipmentDetail.getShipmentId()) | ||
69 | - .eq(ShipmentHeader::getWarehouseCode,ShiroUtils.getWarehouseCode()); | 71 | + lambdaQueryWrapper.eq(ShipmentHeader::getId, shipmentDetail.getShipmentId()) |
72 | + .eq(ShipmentHeader::getWarehouseCode, ShiroUtils.getWarehouseCode()); | ||
70 | ShipmentHeader shipmentHeader = shipmentHeaderService.getOne(lambdaQueryWrapper); | 73 | ShipmentHeader shipmentHeader = shipmentHeaderService.getOne(lambdaQueryWrapper); |
71 | if (shipmentHeader == null) { | 74 | if (shipmentHeader == null) { |
72 | return AjaxResult.error("找不到主单据"); | 75 | return AjaxResult.error("找不到主单据"); |
@@ -78,15 +81,14 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, | @@ -78,15 +81,14 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, | ||
78 | 81 | ||
79 | //查找物料 | 82 | //查找物料 |
80 | LambdaQueryWrapper<Material> lam = Wrappers.lambdaQuery(); | 83 | LambdaQueryWrapper<Material> lam = Wrappers.lambdaQuery(); |
81 | - lam.eq(Material::getCode,shipmentDetail.getMaterialCode()) | ||
82 | - .eq(Material::getWarehouseCode,ShiroUtils.getWarehouseCode()); | 84 | + lam.eq(Material::getCode, shipmentDetail.getMaterialCode()) |
85 | + .eq(Material::getWarehouseCode, ShiroUtils.getWarehouseCode()); | ||
83 | Material material = materialService.getOne(lam); | 86 | Material material = materialService.getOne(lam); |
84 | if (material == null) { | 87 | if (material == null) { |
85 | return AjaxResult.error("物料未找到"); | 88 | return AjaxResult.error("物料未找到"); |
86 | } | 89 | } |
87 | if (StringUtils.isNotEmpty(material.getCompanyCode()) && | 90 | if (StringUtils.isNotEmpty(material.getCompanyCode()) && |
88 | - ShiroUtils.getCompanyCodeList().contains(material.getCompanyCode()) == false) | ||
89 | - { | 91 | + ShiroUtils.getCompanyCodeList().contains(material.getCompanyCode()) == false) { |
90 | return AjaxResult.error("物料不属于当前货主!"); | 92 | return AjaxResult.error("物料不属于当前货主!"); |
91 | } | 93 | } |
92 | shipmentDetail.setId(null); | 94 | shipmentDetail.setId(null); |
@@ -102,15 +104,14 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, | @@ -102,15 +104,14 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, | ||
102 | shipmentDetail.setLastUpdated(null); | 104 | shipmentDetail.setLastUpdated(null); |
103 | shipmentDetail.setLastUpdatedBy(ShiroUtils.getName()); | 105 | shipmentDetail.setLastUpdatedBy(ShiroUtils.getName()); |
104 | shipmentDetail.setLastUpdatedByName(ShiroUtils.getName()); | 106 | shipmentDetail.setLastUpdatedByName(ShiroUtils.getName()); |
105 | - if (this.save(shipmentDetail)==true){ | 107 | + if (this.save(shipmentDetail) == true) { |
106 | //更新单据总行数与总数量 | 108 | //更新单据总行数与总数量 |
107 | shipmentHeader.setTotalLines(shipmentHeader.getTotalLines() + 1); | 109 | shipmentHeader.setTotalLines(shipmentHeader.getTotalLines() + 1); |
108 | shipmentHeader.setTotalQty(shipmentHeader.getTotalQty().add(shipmentDetail.getQty())); | 110 | shipmentHeader.setTotalQty(shipmentHeader.getTotalQty().add(shipmentDetail.getQty())); |
109 | shipmentHeaderService.saveOrUpdate(shipmentHeader); | 111 | shipmentHeaderService.saveOrUpdate(shipmentHeader); |
110 | - updateShipmentHeader(shipmentHeader); | 112 | + shipmentDetailService.updateShipmentHeader(shipmentHeader); |
111 | return AjaxResult.success("新增单据明细成功"); | 113 | return AjaxResult.success("新增单据明细成功"); |
112 | - } | ||
113 | - else { | 114 | + } else { |
114 | return AjaxResult.error("新增单据明细失败"); | 115 | return AjaxResult.error("新增单据明细失败"); |
115 | } | 116 | } |
116 | } | 117 | } |
@@ -123,13 +124,13 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, | @@ -123,13 +124,13 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, | ||
123 | * @return | 124 | * @return |
124 | */ | 125 | */ |
125 | @Override | 126 | @Override |
126 | - @Transactional | 127 | + @Transactional(rollbackFor = Exception.class) |
127 | public AjaxResult deleteDetail(String id) { | 128 | public AjaxResult deleteDetail(String id) { |
128 | if (StringUtils.isEmpty(id)) { | 129 | if (StringUtils.isEmpty(id)) { |
129 | return AjaxResult.error("id不能为空"); | 130 | return AjaxResult.error("id不能为空"); |
130 | } | 131 | } |
131 | String[] ids = id.split(","); | 132 | String[] ids = id.split(","); |
132 | - List<Map<String,Integer>> list = shipmentDetailMapper.SelectFirstStatus(id); | 133 | + List<Map<String, Integer>> list = shipmentDetailMapper.SelectFirstStatus(id); |
133 | if (list.size() < 1) { | 134 | if (list.size() < 1) { |
134 | return AjaxResult.error("找不到主单据!"); | 135 | return AjaxResult.error("找不到主单据!"); |
135 | } | 136 | } |
@@ -141,29 +142,27 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, | @@ -141,29 +142,27 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, | ||
141 | } | 142 | } |
142 | Integer result = shipmentDetailMapper.batchDelete(ids); | 143 | Integer result = shipmentDetailMapper.batchDelete(ids); |
143 | if (result > 0) { | 144 | if (result > 0) { |
144 | - Integer headerId=list.get(0).get("id"); | ||
145 | - Map<String,String> map= shipmentDetailMapper.StatisticalByReceiptId(headerId); | ||
146 | - if(DataUtils.getInteger(map.get("totalLines")) <= 0) { | 145 | + Integer headerId = list.get(0).get("id"); |
146 | + Map<String, String> map = shipmentDetailMapper.StatisticalByReceiptId(headerId); | ||
147 | + if (DataUtils.getInteger(map.get("totalLines")) <= 0) { | ||
147 | shipmentHeaderService.removeById(headerId); | 148 | shipmentHeaderService.removeById(headerId); |
148 | - } | ||
149 | - else { | 149 | + } else { |
150 | //更新表头的总行数和总数量统计 | 150 | //更新表头的总行数和总数量统计 |
151 | ShipmentHeader shipmentHeader = new ShipmentHeader(); | 151 | ShipmentHeader shipmentHeader = new ShipmentHeader(); |
152 | shipmentHeader.setId(headerId); | 152 | shipmentHeader.setId(headerId); |
153 | // shipmentHeader.setTotalLines(DataUtils.getInteger(map.get("totalLines"))); | 153 | // shipmentHeader.setTotalLines(DataUtils.getInteger(map.get("totalLines"))); |
154 | // shipmentHeader.setTotalQty(DataUtils.getBigDecimal(map.get("totalQty"))); | 154 | // shipmentHeader.setTotalQty(DataUtils.getBigDecimal(map.get("totalQty"))); |
155 | // shipmentHeaderService.saveOrUpdate(shipmentHeader); | 155 | // shipmentHeaderService.saveOrUpdate(shipmentHeader); |
156 | - updateShipmentHeader(shipmentHeader); | 156 | + shipmentDetailService.updateShipmentHeader(shipmentHeader); |
157 | } | 157 | } |
158 | return AjaxResult.success("删除单据明细成功"); | 158 | return AjaxResult.success("删除单据明细成功"); |
159 | - } | ||
160 | - else { | 159 | + } else { |
161 | return AjaxResult.error("删除单据明细失败"); | 160 | return AjaxResult.error("删除单据明细失败"); |
162 | } | 161 | } |
163 | } | 162 | } |
164 | 163 | ||
165 | /** | 164 | /** |
166 | - ** 查找没有出库完的详情 | 165 | + * * 查找没有出库完的详情 |
167 | */ | 166 | */ |
168 | @Override | 167 | @Override |
169 | public Integer countUnCompleted(Integer shipmentId) { | 168 | public Integer countUnCompleted(Integer shipmentId) { |
@@ -171,10 +170,10 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, | @@ -171,10 +170,10 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, | ||
171 | shipmentDetailLambdaQueryWrapper.eq(ShipmentDetail::getShipmentId, shipmentId); | 170 | shipmentDetailLambdaQueryWrapper.eq(ShipmentDetail::getShipmentId, shipmentId); |
172 | List<ShipmentDetail> shipmentDetailList = list(shipmentDetailLambdaQueryWrapper); | 171 | List<ShipmentDetail> shipmentDetailList = list(shipmentDetailLambdaQueryWrapper); |
173 | int n = 0; | 172 | int n = 0; |
174 | - for(ShipmentDetail shipmentDetail : shipmentDetailList) { | 173 | + for (ShipmentDetail shipmentDetail : shipmentDetailList) { |
175 | BigDecimal qty = shipmentDetail.getQty(); | 174 | BigDecimal qty = shipmentDetail.getQty(); |
176 | BigDecimal taskQty = shipmentDetail.getTaskQty(); | 175 | BigDecimal taskQty = shipmentDetail.getTaskQty(); |
177 | - if(qty.compareTo(taskQty) > 0) { | 176 | + if (qty.compareTo(taskQty) > 0) { |
178 | n++; | 177 | n++; |
179 | } | 178 | } |
180 | } | 179 | } |
@@ -190,72 +189,71 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, | @@ -190,72 +189,71 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, | ||
190 | * 修改加入波次的子单,修改子单和主单的状态,并修改子单的waveId | 189 | * 修改加入波次的子单,修改子单和主单的状态,并修改子单的waveId |
191 | */ | 190 | */ |
192 | @Override | 191 | @Override |
193 | - @Transactional | 192 | + @Transactional(rollbackFor = Exception.class) |
194 | public void saveWave(String ids, String code) { | 193 | public void saveWave(String ids, String code) { |
195 | Integer status = QuantityConstant.SHIPMENT_HEADER_POOL; | 194 | Integer status = QuantityConstant.SHIPMENT_HEADER_POOL; |
196 | - List<ShipmentHeader> shipmentHeaderList =shipmentPreferenceService.checkShipmentProcess(ids,status,code); | 195 | + List<ShipmentHeader> shipmentHeaderList = shipmentPreferenceService.checkShipmentProcess(ids, status, code); |
197 | 196 | ||
198 | //找到波次主表,看系统是否有此波次 | 197 | //找到波次主表,看系统是否有此波次 |
199 | - LambdaQueryWrapper<WaveMaster> lam=Wrappers.lambdaQuery(); | ||
200 | - lam.eq(WaveMaster::getCode,code) | ||
201 | - .eq(WaveMaster::getWarehouseCode,ShiroUtils.getWarehouseCode()); | ||
202 | - WaveMaster waveMaster=waveMasterService.getOne(lam); | ||
203 | - if(waveMaster == null){ | 198 | + LambdaQueryWrapper<WaveMaster> lam = Wrappers.lambdaQuery(); |
199 | + lam.eq(WaveMaster::getCode, code) | ||
200 | + .eq(WaveMaster::getWarehouseCode, ShiroUtils.getWarehouseCode()); | ||
201 | + WaveMaster waveMaster = waveMasterService.getOne(lam); | ||
202 | + if (waveMaster == null) { | ||
204 | throw new ServiceException("系统没有此波次"); | 203 | throw new ServiceException("系统没有此波次"); |
205 | } | 204 | } |
206 | 205 | ||
207 | - if(Convert.toIntArray(ids).length >waveMaster.getMaxShipments()){ | 206 | + if (Convert.toIntArray(ids).length > waveMaster.getMaxShipments()) { |
208 | throw new ServiceException("加入波次的单据数量超过波次的单据限制"); | 207 | throw new ServiceException("加入波次的单据数量超过波次的单据限制"); |
209 | } | 208 | } |
210 | 209 | ||
211 | - List<ShipmentDetail> shipmentDetailList=new ArrayList<>(); | ||
212 | - BigDecimal qty=new BigDecimal(0); | 210 | + List<ShipmentDetail> shipmentDetailList = new ArrayList<>(); |
211 | + BigDecimal qty = new BigDecimal(0); | ||
213 | //检查出库子表是否有处于波次的 | 212 | //检查出库子表是否有处于波次的 |
214 | - for (Integer id : Convert.toIntArray(ids)) | ||
215 | - { | ||
216 | - LambdaQueryWrapper<ShipmentDetail> lamDetail=Wrappers.lambdaQuery(); | ||
217 | - lamDetail.eq(ShipmentDetail::getWarehouseCode,ShiroUtils.getWarehouseCode()) | ||
218 | - .eq(ShipmentDetail::getShipmentId,id); | ||
219 | - List<ShipmentDetail> shipmentDetails=this.list(lamDetail); | ||
220 | - if(shipmentDetails == null || shipmentDetails.size() == 0){ | ||
221 | - throw new ServiceException("系统没有主单id为"+id+"的子单"); | 213 | + for (Integer id : Convert.toIntArray(ids)) { |
214 | + LambdaQueryWrapper<ShipmentDetail> lamDetail = Wrappers.lambdaQuery(); | ||
215 | + lamDetail.eq(ShipmentDetail::getWarehouseCode, ShiroUtils.getWarehouseCode()) | ||
216 | + .eq(ShipmentDetail::getShipmentId, id); | ||
217 | + List<ShipmentDetail> shipmentDetails = this.list(lamDetail); | ||
218 | + if (shipmentDetails == null || shipmentDetails.size() == 0) { | ||
219 | + throw new ServiceException("系统没有主单id为" + id + "的子单"); | ||
222 | } | 220 | } |
223 | 221 | ||
224 | //查看是否有单据处于波次中 | 222 | //查看是否有单据处于波次中 |
225 | - for(ShipmentDetail shipmentDetail : shipmentDetails) { | 223 | + for (ShipmentDetail shipmentDetail : shipmentDetails) { |
226 | if (shipmentDetail.getWaveId() != 0) { | 224 | if (shipmentDetail.getWaveId() != 0) { |
227 | throw new ServiceException("主单id为" + id + "子单id为" + shipmentDetail.getId() + "的子单已加入波次,不可再加入波次"); | 225 | throw new ServiceException("主单id为" + id + "子单id为" + shipmentDetail.getId() + "的子单已加入波次,不可再加入波次"); |
228 | } | 226 | } |
229 | - if(shipmentDetail.getQty().compareTo(shipmentDetail.getTaskQty())!=0) { | 227 | + if (shipmentDetail.getQty().compareTo(shipmentDetail.getTaskQty()) != 0) { |
230 | shipmentDetailList.add(shipmentDetail); | 228 | shipmentDetailList.add(shipmentDetail); |
231 | qty = qty.add(shipmentDetail.getQty().subtract(shipmentDetail.getTaskQty())); | 229 | qty = qty.add(shipmentDetail.getQty().subtract(shipmentDetail.getTaskQty())); |
232 | } | 230 | } |
233 | } | 231 | } |
234 | } | 232 | } |
235 | 233 | ||
236 | - if(shipmentDetailList.size()>waveMaster.getMaxLines()){ | 234 | + if (shipmentDetailList.size() > waveMaster.getMaxLines()) { |
237 | throw new ServiceException("加入波次的总行数超过波次的行数限制"); | 235 | throw new ServiceException("加入波次的总行数超过波次的行数限制"); |
238 | } | 236 | } |
239 | 237 | ||
240 | - Boolean flag=false; | 238 | + Boolean flag = false; |
241 | 239 | ||
242 | //查看波次是否建成未执行 | 240 | //查看波次是否建成未执行 |
243 | LambdaQueryWrapper<Wave> waveLam = Wrappers.lambdaQuery(); | 241 | LambdaQueryWrapper<Wave> waveLam = Wrappers.lambdaQuery(); |
244 | - waveLam.eq(Wave::getStatus,QuantityConstant.WAVE_STATUS_BUILD) | ||
245 | - .eq(Wave::getWaveMode,code) | ||
246 | - .eq(Wave::getWarehouseCode,ShiroUtils.getWarehouseCode()); | 242 | + waveLam.eq(Wave::getStatus, QuantityConstant.WAVE_STATUS_BUILD) |
243 | + .eq(Wave::getWaveMode, code) | ||
244 | + .eq(Wave::getWarehouseCode, ShiroUtils.getWarehouseCode()); | ||
247 | Wave wave = waveService.getOne(waveLam); | 245 | Wave wave = waveService.getOne(waveLam); |
248 | - if(wave != null && (wave.getTotalShipments()+Convert.toIntArray(ids).length)<= waveMaster.getMaxShipments() | ||
249 | - && (wave.getTotalLines()+shipmentDetailList.size()<= waveMaster.getMaxLines())){ | 246 | + if (wave != null && (wave.getTotalShipments() + Convert.toIntArray(ids).length) <= waveMaster.getMaxShipments() |
247 | + && (wave.getTotalLines() + shipmentDetailList.size() <= waveMaster.getMaxLines())) { | ||
250 | //修改波次 | 248 | //修改波次 |
251 | wave.setTotalShipments(Convert.toIntArray(ids).length + wave.getTotalShipments()); | 249 | wave.setTotalShipments(Convert.toIntArray(ids).length + wave.getTotalShipments()); |
252 | wave.setTotalLines(shipmentDetailList.size() + wave.getTotalLines()); | 250 | wave.setTotalLines(shipmentDetailList.size() + wave.getTotalLines()); |
253 | wave.setTotalQty(qty.add(wave.getTotalQty())); | 251 | wave.setTotalQty(qty.add(wave.getTotalQty())); |
254 | wave.setLastUpdatedBy(ShiroUtils.getName()); | 252 | wave.setLastUpdatedBy(ShiroUtils.getName()); |
255 | 253 | ||
256 | - }else { | 254 | + } else { |
257 | //创建波次 | 255 | //创建波次 |
258 | - wave=new Wave(); | 256 | + wave = new Wave(); |
259 | wave.setWarehouseCode(ShiroUtils.getWarehouseCode()); | 257 | wave.setWarehouseCode(ShiroUtils.getWarehouseCode()); |
260 | wave.setMasterCode(code); | 258 | wave.setMasterCode(code); |
261 | wave.setWaveName(waveMaster.getName()); | 259 | wave.setWaveName(waveMaster.getName()); |
@@ -272,27 +270,27 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, | @@ -272,27 +270,27 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, | ||
272 | } | 270 | } |
273 | 271 | ||
274 | //修改出库子单,加入波次ID,并修改状态为波次 | 272 | //修改出库子单,加入波次ID,并修改状态为波次 |
275 | - for(ShipmentDetail shipmentDetail :shipmentDetailList){ | 273 | + for (ShipmentDetail shipmentDetail : shipmentDetailList) { |
276 | shipmentDetail.setWaveId(wave.getId()); | 274 | shipmentDetail.setWaveId(wave.getId()); |
277 | - if(shipmentDetail.getStatus()<QuantityConstant.SHIPMENT_HEADER_WAVE) { | 275 | + if (shipmentDetail.getStatus() < QuantityConstant.SHIPMENT_HEADER_WAVE) { |
278 | shipmentDetail.setStatus(QuantityConstant.SHIPMENT_HEADER_WAVE); | 276 | shipmentDetail.setStatus(QuantityConstant.SHIPMENT_HEADER_WAVE); |
279 | } | 277 | } |
280 | } | 278 | } |
281 | 279 | ||
282 | flag = this.updateBatchById(shipmentDetailList); | 280 | flag = this.updateBatchById(shipmentDetailList); |
283 | - if(flag == false){ | 281 | + if (flag == false) { |
284 | throw new ServiceException("出库子单加入波次失败"); | 282 | throw new ServiceException("出库子单加入波次失败"); |
285 | } | 283 | } |
286 | 284 | ||
287 | - for(ShipmentHeader shipmentHeader :shipmentHeaderList){ | 285 | + for (ShipmentHeader shipmentHeader : shipmentHeaderList) { |
288 | shipmentHeader.setWaveId(wave.getId()); | 286 | shipmentHeader.setWaveId(wave.getId()); |
289 | shipmentHeader.setFirstStatus(QuantityConstant.SHIPMENT_HEADER_WAVE); | 287 | shipmentHeader.setFirstStatus(QuantityConstant.SHIPMENT_HEADER_WAVE); |
290 | - if(shipmentHeader.getLastStatus()<QuantityConstant.SHIPMENT_HEADER_WAVE) { | 288 | + if (shipmentHeader.getLastStatus() < QuantityConstant.SHIPMENT_HEADER_WAVE) { |
291 | shipmentHeader.setLastStatus(QuantityConstant.SHIPMENT_HEADER_WAVE); | 289 | shipmentHeader.setLastStatus(QuantityConstant.SHIPMENT_HEADER_WAVE); |
292 | } | 290 | } |
293 | } | 291 | } |
294 | flag = shipmentHeaderService.updateBatchById(shipmentHeaderList); | 292 | flag = shipmentHeaderService.updateBatchById(shipmentHeaderList); |
295 | - if(flag == false){ | 293 | + if (flag == false) { |
296 | throw new ServiceException("修改主单状态失败"); | 294 | throw new ServiceException("修改主单状态失败"); |
297 | } | 295 | } |
298 | 296 | ||
@@ -301,7 +299,7 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, | @@ -301,7 +299,7 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, | ||
301 | 299 | ||
302 | //查看最高状态和最低状态 | 300 | //查看最高状态和最低状态 |
303 | @Override | 301 | @Override |
304 | - public Map<String,Integer> selectStatus(Integer id) { | 302 | + public Map<String, Integer> selectStatus(Integer id) { |
305 | return shipmentDetailMapper.selectStatus(id); | 303 | return shipmentDetailMapper.selectStatus(id); |
306 | } | 304 | } |
307 | 305 | ||
@@ -323,32 +321,34 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, | @@ -323,32 +321,34 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, | ||
323 | @Override | 321 | @Override |
324 | public Boolean insertDetails(List<ShipmentDetail> shipmentDetails) { | 322 | public Boolean insertDetails(List<ShipmentDetail> shipmentDetails) { |
325 | int flag = shipmentDetailMapper.insertDetails(shipmentDetails); | 323 | int flag = shipmentDetailMapper.insertDetails(shipmentDetails); |
326 | - if(flag > 0){ | 324 | + if (flag > 0) { |
327 | return true; | 325 | return true; |
328 | - }else { | 326 | + } else { |
329 | return false; | 327 | return false; |
330 | } | 328 | } |
331 | } | 329 | } |
332 | 330 | ||
333 | /** | 331 | /** |
334 | * 更新入库单头表状态 | 332 | * 更新入库单头表状态 |
333 | + * | ||
335 | * @param shipmentHeader 入库单按头表 | 334 | * @param shipmentHeader 入库单按头表 |
336 | * @return | 335 | * @return |
337 | */ | 336 | */ |
338 | @Override | 337 | @Override |
338 | + @Transactional(rollbackFor = Exception.class) | ||
339 | public AjaxResult updateShipmentHeader(ShipmentHeader shipmentHeader) { | 339 | public AjaxResult updateShipmentHeader(ShipmentHeader shipmentHeader) { |
340 | BigDecimal totalQty = new BigDecimal(0); | 340 | BigDecimal totalQty = new BigDecimal(0); |
341 | int totalLines = 0; | 341 | int totalLines = 0; |
342 | LambdaQueryWrapper<ShipmentDetail> shipmentDetailLambdaQueryWrapper = Wrappers.lambdaQuery(); | 342 | LambdaQueryWrapper<ShipmentDetail> shipmentDetailLambdaQueryWrapper = Wrappers.lambdaQuery(); |
343 | shipmentDetailLambdaQueryWrapper.eq(ShipmentDetail::getShipmentId, shipmentHeader.getId()); | 343 | shipmentDetailLambdaQueryWrapper.eq(ShipmentDetail::getShipmentId, shipmentHeader.getId()); |
344 | - List<ShipmentDetail> shipmentDetailList = list(shipmentDetailLambdaQueryWrapper); | ||
345 | - for(ShipmentDetail shipmentDetail : shipmentDetailList) { | 344 | + List<ShipmentDetail> shipmentDetailList = list(shipmentDetailLambdaQueryWrapper); |
345 | + for (ShipmentDetail shipmentDetail : shipmentDetailList) { | ||
346 | totalLines++; | 346 | totalLines++; |
347 | totalQty = totalQty.add(shipmentDetail.getQty()); | 347 | totalQty = totalQty.add(shipmentDetail.getQty()); |
348 | } | 348 | } |
349 | shipmentHeader.setTotalQty(totalQty); | 349 | shipmentHeader.setTotalQty(totalQty); |
350 | shipmentHeader.setTotalLines(totalLines); | 350 | shipmentHeader.setTotalLines(totalLines); |
351 | - if (!shipmentHeaderService.updateById(shipmentHeader)){ | 351 | + if (!shipmentHeaderService.updateById(shipmentHeader)) { |
352 | return AjaxResult.error("出库头表更新失败"); | 352 | return AjaxResult.error("出库头表更新失败"); |
353 | } | 353 | } |
354 | return AjaxResult.success("入库头表更新成功"); | 354 | return AjaxResult.success("入库头表更新成功"); |
src/main/java/com/huaheng/pc/shipment/shipmentHeader/service/ShipmentHeaderServiceImpl.java
@@ -39,7 +39,7 @@ import java.util.List; | @@ -39,7 +39,7 @@ import java.util.List; | ||
39 | import java.util.Map; | 39 | import java.util.Map; |
40 | 40 | ||
41 | @Service | 41 | @Service |
42 | -public class ShipmentHeaderServiceImpl extends ServiceImpl<ShipmentHeaderMapper, ShipmentHeader> implements ShipmentHeaderService{ | 42 | +public class ShipmentHeaderServiceImpl extends ServiceImpl<ShipmentHeaderMapper, ShipmentHeader> implements ShipmentHeaderService { |
43 | 43 | ||
44 | @Autowired | 44 | @Autowired |
45 | private IDictDataService dictDataService; | 45 | private IDictDataService dictDataService; |
@@ -63,12 +63,12 @@ public class ShipmentHeaderServiceImpl extends ServiceImpl<ShipmentHeaderMapper, | @@ -63,12 +63,12 @@ public class ShipmentHeaderServiceImpl extends ServiceImpl<ShipmentHeaderMapper, | ||
63 | private ShipmentTypeService shipmentTypeService; | 63 | private ShipmentTypeService shipmentTypeService; |
64 | 64 | ||
65 | //新增出库主单 | 65 | //新增出库主单 |
66 | + @Transactional(rollbackFor = Exception.class) | ||
66 | @Override | 67 | @Override |
67 | public AjaxResult<Boolean> saveHeader(ShipmentHeader shipmentHeader) { | 68 | public AjaxResult<Boolean> saveHeader(ShipmentHeader shipmentHeader) { |
68 | 69 | ||
69 | - if(shipmentTypeService.checkCode(shipmentHeader.getShipmentType()) == false) | ||
70 | - { | ||
71 | - return AjaxResult.error("没有对应的出库单类型"); | 70 | + if (shipmentTypeService.checkCode(shipmentHeader.getShipmentType()) == false) { |
71 | + return AjaxResult.error("没有对应的出库单类型"); | ||
72 | } | 72 | } |
73 | String code = createCode(shipmentHeader.getShipmentType()); | 73 | String code = createCode(shipmentHeader.getShipmentType()); |
74 | shipmentHeader.setId(null); | 74 | shipmentHeader.setId(null); |
@@ -80,43 +80,40 @@ public class ShipmentHeaderServiceImpl extends ServiceImpl<ShipmentHeaderMapper, | @@ -80,43 +80,40 @@ public class ShipmentHeaderServiceImpl extends ServiceImpl<ShipmentHeaderMapper, | ||
80 | shipmentHeader.setCreatedBy(ShiroUtils.getName()); | 80 | shipmentHeader.setCreatedBy(ShiroUtils.getName()); |
81 | shipmentHeader.setWarehouseCode(ShiroUtils.getWarehouseCode()); | 81 | shipmentHeader.setWarehouseCode(ShiroUtils.getWarehouseCode()); |
82 | shipmentHeader.setCode(code); | 82 | shipmentHeader.setCode(code); |
83 | - if(StringUtils.isNotEmpty(shipmentHeader.getCustomerCode())){ | 83 | + if (StringUtils.isNotEmpty(shipmentHeader.getCustomerCode())) { |
84 | LambdaQueryWrapper<Customer> customerLambd = Wrappers.lambdaQuery(); | 84 | LambdaQueryWrapper<Customer> customerLambd = Wrappers.lambdaQuery(); |
85 | - customerLambd.eq(Customer::getCode,shipmentHeader.getCustomerCode()); | ||
86 | - Customer customer =customerService.getOne(customerLambd); | ||
87 | - if(customer == null){ | 85 | + customerLambd.eq(Customer::getCode, shipmentHeader.getCustomerCode()); |
86 | + Customer customer = customerService.getOne(customerLambd); | ||
87 | + if (customer == null) { | ||
88 | return AjaxResult.error("客户编码错误,wms系统没有此客户"); | 88 | return AjaxResult.error("客户编码错误,wms系统没有此客户"); |
89 | } | 89 | } |
90 | } | 90 | } |
91 | boolean result = this.save(shipmentHeader); | 91 | boolean result = this.save(shipmentHeader); |
92 | - return AjaxResult.toAjax(result); | 92 | + return AjaxResult.toAjax(result); |
93 | } | 93 | } |
94 | 94 | ||
95 | 95 | ||
96 | //根据单据类型建单据号 | 96 | //根据单据类型建单据号 |
97 | + @Transactional(rollbackFor = Exception.class) | ||
97 | @Override | 98 | @Override |
98 | - public String createCode(String shipmentType) | ||
99 | - { | 99 | + public String createCode(String shipmentType) { |
100 | String code = null; | 100 | String code = null; |
101 | Date now = new Date(); | 101 | Date now = new Date(); |
102 | SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd"); | 102 | SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd"); |
103 | LambdaQueryWrapper<ShipmentHeader> lambda = Wrappers.lambdaQuery(); | 103 | LambdaQueryWrapper<ShipmentHeader> lambda = Wrappers.lambdaQuery(); |
104 | lambda.select(ShipmentHeader::getCode).eq(ShipmentHeader::getShipmentType, shipmentType) | 104 | lambda.select(ShipmentHeader::getCode).eq(ShipmentHeader::getShipmentType, shipmentType) |
105 | - .inSql(ShipmentHeader::getCode, "select code from shipment_header where code like '"+shipmentType+"%'") | 105 | + .inSql(ShipmentHeader::getCode, "select code from shipment_header where code like '" + shipmentType + "%'") |
106 | .orderByDesc(ShipmentHeader::getId).last("Limit 1"); | 106 | .orderByDesc(ShipmentHeader::getId).last("Limit 1"); |
107 | ShipmentHeader shipmentHeader = this.getOne(lambda); | 107 | ShipmentHeader shipmentHeader = this.getOne(lambda); |
108 | String maxCode = null; | 108 | String maxCode = null; |
109 | - if(shipmentHeader != null){ | 109 | + if (shipmentHeader != null) { |
110 | maxCode = shipmentHeader.getCode(); | 110 | maxCode = shipmentHeader.getCode(); |
111 | } | 111 | } |
112 | // String maxCode = shipmentHeaderMapper.createCode(shipmentType); | 112 | // String maxCode = shipmentHeaderMapper.createCode(shipmentType); |
113 | - if (maxCode != null && maxCode.length() > 13 && maxCode.substring(maxCode.length() - 13, maxCode.length() - 5).equals(df.format(now))) | ||
114 | - { | 113 | + if (maxCode != null && maxCode.length() > 13 && maxCode.substring(maxCode.length() - 13, maxCode.length() - 5).equals(df.format(now))) { |
115 | Integer Count = Integer.valueOf(maxCode.substring(maxCode.length() - 5, maxCode.length())); | 114 | Integer Count = Integer.valueOf(maxCode.substring(maxCode.length() - 5, maxCode.length())); |
116 | code = shipmentType + df.format(now) + String.format("%05d", Count + 1); | 115 | code = shipmentType + df.format(now) + String.format("%05d", Count + 1); |
117 | - } | ||
118 | - else | ||
119 | - { | 116 | + } else { |
120 | code = shipmentType + df.format(now) + "00001"; | 117 | code = shipmentType + df.format(now) + "00001"; |
121 | } | 118 | } |
122 | return code; | 119 | return code; |
@@ -124,41 +121,43 @@ public class ShipmentHeaderServiceImpl extends ServiceImpl<ShipmentHeaderMapper, | @@ -124,41 +121,43 @@ public class ShipmentHeaderServiceImpl extends ServiceImpl<ShipmentHeaderMapper, | ||
124 | 121 | ||
125 | /** | 122 | /** |
126 | * 根据Id更新这个单据的首尾状态 | 123 | * 根据Id更新这个单据的首尾状态 |
124 | + * | ||
127 | * @param shipmentId | 125 | * @param shipmentId |
128 | * @return | 126 | * @return |
129 | */ | 127 | */ |
130 | @Override | 128 | @Override |
131 | - public AjaxResult updateShipmentStatus(int shipmentId) { | 129 | + @Transactional(rollbackFor = Exception.class) |
130 | + public AjaxResult updateShipmentStatus(int shipmentId) { | ||
132 | //获取这个单 | 131 | //获取这个单 |
133 | ShipmentHeader shipmentHeader = this.getById(shipmentId); | 132 | ShipmentHeader shipmentHeader = this.getById(shipmentId); |
134 | - if(shipmentHeader==null){ | ||
135 | - return AjaxResult.error("单据未找到,Id:"+shipmentId); | 133 | + if (shipmentHeader == null) { |
134 | + return AjaxResult.error("单据未找到,Id:" + shipmentId); | ||
136 | } | 135 | } |
137 | //查询是否有生成出库货箱,如果有,则返回出库货箱的最高与最低状态 | 136 | //查询是否有生成出库货箱,如果有,则返回出库货箱的最高与最低状态 |
138 | - Map<String,Integer> map = shipmentContainerHeaderService.getShipmentContainerMaxAndMinStatusByShipmentID(shipmentId); | ||
139 | - if(map==null){ | 137 | + Map<String, Integer> map = shipmentContainerHeaderService.getShipmentContainerMaxAndMinStatusByShipmentID(shipmentId); |
138 | + if (map == null) { | ||
140 | //说明没有货箱,则直接首位均为新建 | 139 | //说明没有货箱,则直接首位均为新建 |
141 | shipmentHeader.setFirstStatus(QuantityConstant.RECEIPT_HEADER_POOL); | 140 | shipmentHeader.setFirstStatus(QuantityConstant.RECEIPT_HEADER_POOL); |
142 | shipmentHeader.setLastStatus(QuantityConstant.RECEIPT_HEADER_POOL); | 141 | shipmentHeader.setLastStatus(QuantityConstant.RECEIPT_HEADER_POOL); |
143 | this.saveOrUpdate(shipmentHeader); | 142 | this.saveOrUpdate(shipmentHeader); |
144 | - }else { | 143 | + } else { |
145 | int firstStatus = map.get("maxStatus"); | 144 | int firstStatus = map.get("maxStatus"); |
146 | int lastStatus = map.get("minStatus"); | 145 | int lastStatus = map.get("minStatus"); |
147 | - if(firstStatus<=QuantityConstant.SHIPMENT_CONTAINER_FINISHED){ | 146 | + if (firstStatus <= QuantityConstant.SHIPMENT_CONTAINER_FINISHED) { |
148 | shipmentHeader.setFirstStatus(QuantityConstant.SHIPMENT_HEADER_GROUPDISK); | 147 | shipmentHeader.setFirstStatus(QuantityConstant.SHIPMENT_HEADER_GROUPDISK); |
149 | } | 148 | } |
150 | - if(firstStatus==QuantityConstant.SHIPMENT_CONTAINER_REVIEWSUCCESS){ | 149 | + if (firstStatus == QuantityConstant.SHIPMENT_CONTAINER_REVIEWSUCCESS) { |
151 | shipmentHeader.setFirstStatus(QuantityConstant.SHIPMENT_HEADER_COMPLETED); | 150 | shipmentHeader.setFirstStatus(QuantityConstant.SHIPMENT_HEADER_COMPLETED); |
152 | } | 151 | } |
153 | - if(lastStatus <=QuantityConstant.SHIPMENT_CONTAINER_FINISHED){ | 152 | + if (lastStatus <= QuantityConstant.SHIPMENT_CONTAINER_FINISHED) { |
154 | shipmentHeader.setLastStatus(QuantityConstant.SHIPMENT_HEADER_GROUPDISK); | 153 | shipmentHeader.setLastStatus(QuantityConstant.SHIPMENT_HEADER_GROUPDISK); |
155 | } | 154 | } |
156 | - if(lastStatus==QuantityConstant.SHIPMENT_CONTAINER_REVIEWSUCCESS){ | 155 | + if (lastStatus == QuantityConstant.SHIPMENT_CONTAINER_REVIEWSUCCESS) { |
157 | shipmentHeader.setLastStatus(QuantityConstant.SHIPMENT_HEADER_COMPLETED); | 156 | shipmentHeader.setLastStatus(QuantityConstant.SHIPMENT_HEADER_COMPLETED); |
158 | } | 157 | } |
159 | //是否存在未配盘的数量,如果是,则尾状态为新建 | 158 | //是否存在未配盘的数量,如果是,则尾状态为新建 |
160 | Integer UnCompleted = shipmentDetailService.countUnCompleted(shipmentId); | 159 | Integer UnCompleted = shipmentDetailService.countUnCompleted(shipmentId); |
161 | - if(UnCompleted != null && UnCompleted.intValue() > 0){ | 160 | + if (UnCompleted != null && UnCompleted.intValue() > 0) { |
162 | shipmentHeader.setLastStatus(QuantityConstant.SHIPMENT_HEADER_POOL); | 161 | shipmentHeader.setLastStatus(QuantityConstant.SHIPMENT_HEADER_POOL); |
163 | } | 162 | } |
164 | this.saveOrUpdate(shipmentHeader); | 163 | this.saveOrUpdate(shipmentHeader); |
@@ -170,15 +169,15 @@ public class ShipmentHeaderServiceImpl extends ServiceImpl<ShipmentHeaderMapper, | @@ -170,15 +169,15 @@ public class ShipmentHeaderServiceImpl extends ServiceImpl<ShipmentHeaderMapper, | ||
170 | 169 | ||
171 | //出库单字段变为历史出库单 | 170 | //出库单字段变为历史出库单 |
172 | @Override | 171 | @Override |
173 | - @Transactional | 172 | + @Transactional(rollbackFor = Exception.class) |
174 | public AjaxResult addHistory(ShipmentHeader shipmentHeader) throws InvocationTargetException, IllegalAccessException { | 173 | public AjaxResult addHistory(ShipmentHeader shipmentHeader) throws InvocationTargetException, IllegalAccessException { |
175 | //单据主单重复 | 174 | //单据主单重复 |
176 | LambdaQueryWrapper<ShipmentHeaderHistory> headerHistoryLamb = Wrappers.lambdaQuery(); | 175 | LambdaQueryWrapper<ShipmentHeaderHistory> headerHistoryLamb = Wrappers.lambdaQuery(); |
177 | - headerHistoryLamb.eq(ShipmentHeaderHistory::getCode,shipmentHeader.getCode()) | ||
178 | - .eq(ShipmentHeaderHistory::getWarehouseCode,shipmentHeader.getWarehouseCode()); | 176 | + headerHistoryLamb.eq(ShipmentHeaderHistory::getCode, shipmentHeader.getCode()) |
177 | + .eq(ShipmentHeaderHistory::getWarehouseCode, shipmentHeader.getWarehouseCode()); | ||
179 | 178 | ||
180 | - ShipmentHeaderHistory headerHistory =shipmentHeaderHistoryService.getOne(headerHistoryLamb); | ||
181 | - if(headerHistory == null) { | 179 | + ShipmentHeaderHistory headerHistory = shipmentHeaderHistoryService.getOne(headerHistoryLamb); |
180 | + if (headerHistory == null) { | ||
182 | //历史出库主单 | 181 | //历史出库主单 |
183 | ShipmentHeaderHistory shipmentHeaderHistory = new ShipmentHeaderHistory(); | 182 | ShipmentHeaderHistory shipmentHeaderHistory = new ShipmentHeaderHistory(); |
184 | // BeanUtils.copyProperties(shipmentHeaderHistory, shipmentHeader); | 183 | // BeanUtils.copyProperties(shipmentHeaderHistory, shipmentHeader); |
@@ -205,26 +204,27 @@ public class ShipmentHeaderServiceImpl extends ServiceImpl<ShipmentHeaderMapper, | @@ -205,26 +204,27 @@ public class ShipmentHeaderServiceImpl extends ServiceImpl<ShipmentHeaderMapper, | ||
205 | throw new ServiceException("存入历史出库主单失败"); | 204 | throw new ServiceException("存入历史出库主单失败"); |
206 | } | 205 | } |
207 | } | 206 | } |
208 | - LambdaQueryWrapper<ShipmentDetail> lambdaQueryWrapper = Wrappers.lambdaQuery(); | ||
209 | - lambdaQueryWrapper.eq(ShipmentDetail::getWarehouseCode, shipmentHeader.getWarehouseCode()) | ||
210 | - .eq(ShipmentDetail::getShipmentCode, shipmentHeader.getCode()); | ||
211 | - List<ShipmentDetail> shipmentDetails = shipmentDetailService.list(lambdaQueryWrapper); | 207 | + LambdaQueryWrapper<ShipmentDetail> lambdaQueryWrapper = Wrappers.lambdaQuery(); |
208 | + lambdaQueryWrapper.eq(ShipmentDetail::getWarehouseCode, shipmentHeader.getWarehouseCode()) | ||
209 | + .eq(ShipmentDetail::getShipmentCode, shipmentHeader.getCode()); | ||
210 | + List<ShipmentDetail> shipmentDetails = shipmentDetailService.list(lambdaQueryWrapper); | ||
212 | 211 | ||
213 | - //历史出库子单 | ||
214 | - List<ShipmentDetailHistory> shipmentDetailHistories = new ArrayList<>(); | ||
215 | - for (ShipmentDetail item : shipmentDetails) { | ||
216 | - ShipmentDetailHistory shipmentDetailHistory = new ShipmentDetailHistory(); | ||
217 | - BeanUtils.copyProperties(shipmentDetailHistory, item); | ||
218 | - shipmentDetailHistories.add(shipmentDetailHistory); | ||
219 | - } | ||
220 | - Boolean flag = shipmentDetailHistoryService.saveBatch(shipmentDetailHistories); | ||
221 | - if (flag == false) { | ||
222 | - throw new ServiceException("存入历史出库子单失败"); | ||
223 | - } | 212 | + //历史出库子单 |
213 | + List<ShipmentDetailHistory> shipmentDetailHistories = new ArrayList<>(); | ||
214 | + for (ShipmentDetail item : shipmentDetails) { | ||
215 | + ShipmentDetailHistory shipmentDetailHistory = new ShipmentDetailHistory(); | ||
216 | + BeanUtils.copyProperties(shipmentDetailHistory, item); | ||
217 | + shipmentDetailHistories.add(shipmentDetailHistory); | ||
218 | + } | ||
219 | + Boolean flag = shipmentDetailHistoryService.saveBatch(shipmentDetailHistories); | ||
220 | + if (flag == false) { | ||
221 | + throw new ServiceException("存入历史出库子单失败"); | ||
222 | + } | ||
224 | return null; | 223 | return null; |
225 | } | 224 | } |
226 | 225 | ||
227 | - /**审核出库单,加入订单池 | 226 | + /** |
227 | + * 审核出库单,加入订单池 | ||
228 | * 1、找到主单,确定主单的状态是否小于100 | 228 | * 1、找到主单,确定主单的状态是否小于100 |
229 | * 2.小于100时,把主单和相应的子单加入到list中,大于等于100时,直接跳过 | 229 | * 2.小于100时,把主单和相应的子单加入到list中,大于等于100时,直接跳过 |
230 | * 3.将修改后的主单列表和子单列表进行修改,加入订单池 | 230 | * 3.将修改后的主单列表和子单列表进行修改,加入订单池 |
@@ -234,53 +234,53 @@ public class ShipmentHeaderServiceImpl extends ServiceImpl<ShipmentHeaderMapper, | @@ -234,53 +234,53 @@ public class ShipmentHeaderServiceImpl extends ServiceImpl<ShipmentHeaderMapper, | ||
234 | */ | 234 | */ |
235 | 235 | ||
236 | @Override | 236 | @Override |
237 | - @Transactional | 237 | + @Transactional(rollbackFor = Exception.class) |
238 | public AjaxResult review(String ids) { | 238 | public AjaxResult review(String ids) { |
239 | 239 | ||
240 | List<ShipmentHeader> shipmentHeaders = new ArrayList<>(); | 240 | List<ShipmentHeader> shipmentHeaders = new ArrayList<>(); |
241 | List<ShipmentDetail> shipmentDetails = new ArrayList<>(); | 241 | List<ShipmentDetail> shipmentDetails = new ArrayList<>(); |
242 | 242 | ||
243 | //1、找到主单,确定主单的状态是否小于100 | 243 | //1、找到主单,确定主单的状态是否小于100 |
244 | - for (Integer id : Convert.toIntArray(ids)){ | 244 | + for (Integer id : Convert.toIntArray(ids)) { |
245 | ShipmentHeader shipmentHeader = this.getById(id); | 245 | ShipmentHeader shipmentHeader = this.getById(id); |
246 | - if(shipmentHeader == null){ | ||
247 | - return AjaxResult.error("id为"+id+"的主单在系统不存在"); | 246 | + if (shipmentHeader == null) { |
247 | + return AjaxResult.error("id为" + id + "的主单在系统不存在"); | ||
248 | } | 248 | } |
249 | 249 | ||
250 | //2.小于100时,把主单和相应的子单加入到list中,大于等于100时,直接跳过 | 250 | //2.小于100时,把主单和相应的子单加入到list中,大于等于100时,直接跳过 |
251 | - if(shipmentHeader.getFirstStatus() < QuantityConstant.SHIPMENT_HEADER_POOL && shipmentHeader.getLastStatus() <QuantityConstant.SHIPMENT_HEADER_POOL){ | 251 | + if (shipmentHeader.getFirstStatus() < QuantityConstant.SHIPMENT_HEADER_POOL && shipmentHeader.getLastStatus() < QuantityConstant.SHIPMENT_HEADER_POOL) { |
252 | shipmentHeader.setFirstStatus(QuantityConstant.SHIPMENT_HEADER_POOL); | 252 | shipmentHeader.setFirstStatus(QuantityConstant.SHIPMENT_HEADER_POOL); |
253 | shipmentHeader.setLastStatus(QuantityConstant.SHIPMENT_HEADER_POOL); | 253 | shipmentHeader.setLastStatus(QuantityConstant.SHIPMENT_HEADER_POOL); |
254 | shipmentHeaders.add(shipmentHeader); | 254 | shipmentHeaders.add(shipmentHeader); |
255 | 255 | ||
256 | LambdaQueryWrapper<ShipmentDetail> lam = Wrappers.lambdaQuery(); | 256 | LambdaQueryWrapper<ShipmentDetail> lam = Wrappers.lambdaQuery(); |
257 | - lam.eq(ShipmentDetail::getShipmentId,id) | ||
258 | - .eq(ShipmentDetail::getWarehouseCode,ShiroUtils.getWarehouseCode()); | 257 | + lam.eq(ShipmentDetail::getShipmentId, id) |
258 | + .eq(ShipmentDetail::getWarehouseCode, ShiroUtils.getWarehouseCode()); | ||
259 | List<ShipmentDetail> shipmentDetailList = shipmentDetailService.list(lam); | 259 | List<ShipmentDetail> shipmentDetailList = shipmentDetailService.list(lam); |
260 | - if(!shipmentDetailList.isEmpty()){ | ||
261 | - for(ShipmentDetail shipmentDetail : shipmentDetailList){ | 260 | + if (!shipmentDetailList.isEmpty()) { |
261 | + for (ShipmentDetail shipmentDetail : shipmentDetailList) { | ||
262 | shipmentDetail.setStatus(QuantityConstant.SHIPMENT_HEADER_POOL); | 262 | shipmentDetail.setStatus(QuantityConstant.SHIPMENT_HEADER_POOL); |
263 | } | 263 | } |
264 | shipmentDetails.addAll(shipmentDetailList); | 264 | shipmentDetails.addAll(shipmentDetailList); |
265 | - }else { | ||
266 | - return AjaxResult.error("id为"+id+"的出库明细在系统不存在"); | 265 | + } else { |
266 | + return AjaxResult.error("id为" + id + "的出库明细在系统不存在"); | ||
267 | } | 267 | } |
268 | } | 268 | } |
269 | } | 269 | } |
270 | 270 | ||
271 | - if(shipmentHeaders.isEmpty()){ | 271 | + if (shipmentHeaders.isEmpty()) { |
272 | return AjaxResult.error("选中的单据不需要订单审核"); | 272 | return AjaxResult.error("选中的单据不需要订单审核"); |
273 | } | 273 | } |
274 | - if(shipmentDetails.isEmpty()){ | 274 | + if (shipmentDetails.isEmpty()) { |
275 | return AjaxResult.error("选中的单据不需要订单审核或没有子单"); | 275 | return AjaxResult.error("选中的单据不需要订单审核或没有子单"); |
276 | } | 276 | } |
277 | // 3.将修改后的主单列表和子单列表进行修改,加入订单池 | 277 | // 3.将修改后的主单列表和子单列表进行修改,加入订单池 |
278 | Boolean flag = this.updateBatchById(shipmentHeaders); | 278 | Boolean flag = this.updateBatchById(shipmentHeaders); |
279 | - if (flag == false){ | 279 | + if (flag == false) { |
280 | throw new ServiceException("修改主单状态失败"); | 280 | throw new ServiceException("修改主单状态失败"); |
281 | } | 281 | } |
282 | flag = shipmentDetailService.updateBatchById(shipmentDetails); | 282 | flag = shipmentDetailService.updateBatchById(shipmentDetails); |
283 | - if (flag == false){ | 283 | + if (flag == false) { |
284 | throw new ServiceException("修改明细状态失败"); | 284 | throw new ServiceException("修改明细状态失败"); |
285 | } | 285 | } |
286 | return AjaxResult.success("订单审核成功,成功加入订单池"); | 286 | return AjaxResult.success("订单审核成功,成功加入订单池"); |
src/main/java/com/huaheng/pc/task/taskDetail/service/TaskDetailServiceImpl.java
@@ -20,6 +20,7 @@ import com.huaheng.pc.inventory.cycleCountDetail.service.CycleCountDetailService | @@ -20,6 +20,7 @@ import com.huaheng.pc.inventory.cycleCountDetail.service.CycleCountDetailService | ||
20 | import com.huaheng.pc.task.taskHeader.domain.TaskHeader; | 20 | import com.huaheng.pc.task.taskHeader.domain.TaskHeader; |
21 | import com.huaheng.pc.task.taskHeader.service.TaskHeaderService; | 21 | import com.huaheng.pc.task.taskHeader.service.TaskHeaderService; |
22 | import org.springframework.stereotype.Service; | 22 | import org.springframework.stereotype.Service; |
23 | + | ||
23 | import javax.annotation.Resource; | 24 | import javax.annotation.Resource; |
24 | import java.util.ArrayList; | 25 | import java.util.ArrayList; |
25 | import java.util.List; | 26 | import java.util.List; |
@@ -30,7 +31,7 @@ import com.huaheng.pc.task.taskDetail.domain.TaskDetail; | @@ -30,7 +31,7 @@ import com.huaheng.pc.task.taskDetail.domain.TaskDetail; | ||
30 | import org.springframework.transaction.annotation.Transactional; | 31 | import org.springframework.transaction.annotation.Transactional; |
31 | 32 | ||
32 | @Service | 33 | @Service |
33 | -public class TaskDetailServiceImpl extends ServiceImpl<TaskDetailMapper, TaskDetail> implements TaskDetailService{ | 34 | +public class TaskDetailServiceImpl extends ServiceImpl<TaskDetailMapper, TaskDetail> implements TaskDetailService { |
34 | 35 | ||
35 | 36 | ||
36 | @Resource | 37 | @Resource |
@@ -50,23 +51,24 @@ public class TaskDetailServiceImpl extends ServiceImpl<TaskDetailMapper, TaskDet | @@ -50,23 +51,24 @@ public class TaskDetailServiceImpl extends ServiceImpl<TaskDetailMapper, TaskDet | ||
50 | 51 | ||
51 | /** | 52 | /** |
52 | * 盘点任务首选项 | 53 | * 盘点任务首选项 |
54 | + * | ||
53 | * @param taskDetailList | 55 | * @param taskDetailList |
54 | * @return | 56 | * @return |
55 | */ | 57 | */ |
56 | - @Transactional | 58 | + @Transactional(rollbackFor = Exception.class) |
57 | @Override | 59 | @Override |
58 | public List<TaskDetail> preferenceRealize(List<TaskDetail> taskDetailList) { | 60 | public List<TaskDetail> preferenceRealize(List<TaskDetail> taskDetailList) { |
59 | /*查出盘点明细,找出盘点首选项,根据首选项显示字段*/ | 61 | /*查出盘点明细,找出盘点首选项,根据首选项显示字段*/ |
60 | List<TaskDetail> taskDetails = new ArrayList<>(); | 62 | List<TaskDetail> taskDetails = new ArrayList<>(); |
61 | 63 | ||
62 | - for (TaskDetail item:taskDetailList){ | 64 | + for (TaskDetail item : taskDetailList) { |
63 | //盘点明细 | 65 | //盘点明细 |
64 | CycleCountDetail cycleCountDetailtemp = new CycleCountDetail(); | 66 | CycleCountDetail cycleCountDetailtemp = new CycleCountDetail(); |
65 | cycleCountDetailtemp.setCycleCountHeadCode(item.getBillCode()); | 67 | cycleCountDetailtemp.setCycleCountHeadCode(item.getBillCode()); |
66 | cycleCountDetailtemp.setId(item.getBillDetailId()); | 68 | cycleCountDetailtemp.setId(item.getBillDetailId()); |
67 | LambdaQueryWrapper<CycleCountDetail> detailLambdaQueryWrapper = Wrappers.lambdaQuery(cycleCountDetailtemp); | 69 | LambdaQueryWrapper<CycleCountDetail> detailLambdaQueryWrapper = Wrappers.lambdaQuery(cycleCountDetailtemp); |
68 | CycleCountDetail cycleCountDetail = cycleCountDetailService.getOne(detailLambdaQueryWrapper); | 70 | CycleCountDetail cycleCountDetail = cycleCountDetailService.getOne(detailLambdaQueryWrapper); |
69 | - if(cycleCountDetail == null){ | 71 | + if (cycleCountDetail == null) { |
70 | throw new SecurityException("没有找到子任务对应的盘点明细!"); | 72 | throw new SecurityException("没有找到子任务对应的盘点明细!"); |
71 | } | 73 | } |
72 | //找盘点首选项 | 74 | //找盘点首选项 |
@@ -75,27 +77,27 @@ public class TaskDetailServiceImpl extends ServiceImpl<TaskDetailMapper, TaskDet | @@ -75,27 +77,27 @@ public class TaskDetailServiceImpl extends ServiceImpl<TaskDetailMapper, TaskDet | ||
75 | cycleCountPreferenceTemp.setWarehouseCode(cycleCountDetail.getWarehouseCode()); | 77 | cycleCountPreferenceTemp.setWarehouseCode(cycleCountDetail.getWarehouseCode()); |
76 | LambdaQueryWrapper<CycleCountPreference> preferenceLambdaQueryWrapper = Wrappers.lambdaQuery(cycleCountPreferenceTemp); | 78 | LambdaQueryWrapper<CycleCountPreference> preferenceLambdaQueryWrapper = Wrappers.lambdaQuery(cycleCountPreferenceTemp); |
77 | CycleCountPreference cycleCountPreference = cycleCountPreferenceService.getOne(preferenceLambdaQueryWrapper); | 79 | CycleCountPreference cycleCountPreference = cycleCountPreferenceService.getOne(preferenceLambdaQueryWrapper); |
78 | - if(cycleCountPreference == null){ | 80 | + if (cycleCountPreference == null) { |
79 | throw new SecurityException("没有找到盘点首选项!"); | 81 | throw new SecurityException("没有找到盘点首选项!"); |
80 | } | 82 | } |
81 | //根据首选项判断数据 | 83 | //根据首选项判断数据 |
82 | - if(cycleCountPreference.getPromptLocation() == false){ | 84 | + if (cycleCountPreference.getPromptLocation() == false) { |
83 | //库位 | 85 | //库位 |
84 | item.setFromLocation(""); | 86 | item.setFromLocation(""); |
85 | item.setToLocation(""); | 87 | item.setToLocation(""); |
86 | } | 88 | } |
87 | - if(cycleCountPreference.getPromptLpn() == false){ | 89 | + if (cycleCountPreference.getPromptLpn() == false) { |
88 | //容器 | 90 | //容器 |
89 | item.setContainerCode(""); | 91 | item.setContainerCode(""); |
90 | } | 92 | } |
91 | - if(cycleCountPreference.getPromptItem() == false){ | 93 | + if (cycleCountPreference.getPromptItem() == false) { |
92 | //物料 | 94 | //物料 |
93 | item.setMaterialCode(""); | 95 | item.setMaterialCode(""); |
94 | item.setMaterialName(""); | 96 | item.setMaterialName(""); |
95 | item.setMaterialUnit(""); | 97 | item.setMaterialUnit(""); |
96 | item.setMaterialSpec(""); | 98 | item.setMaterialSpec(""); |
97 | } | 99 | } |
98 | - if(cycleCountPreference.getPromptQuantity() == false){ | 100 | + if (cycleCountPreference.getPromptQuantity() == false) { |
99 | //系统数量 | 101 | //系统数量 |
100 | item.setQty(null); | 102 | item.setQty(null); |
101 | } | 103 | } |
@@ -107,6 +109,7 @@ public class TaskDetailServiceImpl extends ServiceImpl<TaskDetailMapper, TaskDet | @@ -107,6 +109,7 @@ public class TaskDetailServiceImpl extends ServiceImpl<TaskDetailMapper, TaskDet | ||
107 | /** | 109 | /** |
108 | * 任务位置拣货单打印 | 110 | * 任务位置拣货单打印 |
109 | * 根据任务头表id查询任务明细,根据上架或拣货货规则排序 | 111 | * 根据任务头表id查询任务明细,根据上架或拣货货规则排序 |
112 | + * | ||
110 | * @param ids 头表id数组 | 113 | * @param ids 头表id数组 |
111 | * @return | 114 | * @return |
112 | */ | 115 | */ |
@@ -130,12 +133,12 @@ public class TaskDetailServiceImpl extends ServiceImpl<TaskDetailMapper, TaskDet | @@ -130,12 +133,12 @@ public class TaskDetailServiceImpl extends ServiceImpl<TaskDetailMapper, TaskDet | ||
130 | } | 133 | } |
131 | //Integer数组转object数组 | 134 | //Integer数组转object数组 |
132 | Object[] objects = new Object[ids.length]; | 135 | Object[] objects = new Object[ids.length]; |
133 | - try{ | ||
134 | - for(int i = 0; i < ids.length ; i++){ | ||
135 | - Object a = (ids[i]); | 136 | + try { |
137 | + for (int i = 0; i < ids.length; i++) { | ||
138 | + Object a = (ids[i]); | ||
136 | objects[i] = a; | 139 | objects[i] = a; |
137 | } | 140 | } |
138 | - }catch (Exception e){ | 141 | + } catch (Exception e) { |
139 | throw new ServiceException(e.toString()); | 142 | throw new ServiceException(e.toString()); |
140 | } | 143 | } |
141 | LambdaQueryWrapper<TaskDetail> queryWrapper = Wrappers.lambdaQuery(); | 144 | LambdaQueryWrapper<TaskDetail> queryWrapper = Wrappers.lambdaQuery(); |
@@ -147,6 +150,7 @@ public class TaskDetailServiceImpl extends ServiceImpl<TaskDetailMapper, TaskDet | @@ -147,6 +150,7 @@ public class TaskDetailServiceImpl extends ServiceImpl<TaskDetailMapper, TaskDet | ||
147 | 150 | ||
148 | /** | 151 | /** |
149 | * 根据任务头表id查询任务明细 | 152 | * 根据任务头表id查询任务明细 |
153 | + * | ||
150 | * @param id | 154 | * @param id |
151 | * @return | 155 | * @return |
152 | */ | 156 | */ |