Commit b468da61443efed63ab4e19b1df455d8a4f27776
Merge remote-tracking branch 'origin/develop' into develop
Showing
5 changed files
with
219 additions
and
40 deletions
src/main/java/com/huaheng/pc/inventory/cycleCountDetail/controller/CycleCountDetailController.java
@@ -34,6 +34,7 @@ import org.springframework.web.bind.annotation.RequestMapping; | @@ -34,6 +34,7 @@ import org.springframework.web.bind.annotation.RequestMapping; | ||
34 | import org.springframework.web.bind.annotation.ResponseBody; | 34 | import org.springframework.web.bind.annotation.ResponseBody; |
35 | 35 | ||
36 | import javax.annotation.Resource; | 36 | import javax.annotation.Resource; |
37 | +import java.math.BigDecimal; | ||
37 | import java.util.Collections; | 38 | import java.util.Collections; |
38 | import java.util.List; | 39 | import java.util.List; |
39 | 40 | ||
@@ -118,7 +119,6 @@ public class CycleCountDetailController extends BaseController { | @@ -118,7 +119,6 @@ public class CycleCountDetailController extends BaseController { | ||
118 | 119 | ||
119 | } | 120 | } |
120 | 121 | ||
121 | - | ||
122 | /** | 122 | /** |
123 | * 新增盘点明细 | 123 | * 新增盘点明细 |
124 | */ | 124 | */ |
@@ -215,10 +215,30 @@ public class CycleCountDetailController extends BaseController { | @@ -215,10 +215,30 @@ public class CycleCountDetailController extends BaseController { | ||
215 | return cycleCountDetailService.createCycleCoutTaskByDetailId(cycleCoutdetailId); | 215 | return cycleCountDetailService.createCycleCoutTaskByDetailId(cycleCoutdetailId); |
216 | } | 216 | } |
217 | 217 | ||
218 | + /** | ||
219 | + *实盘登记 | ||
220 | + * @param detailId | ||
221 | + * @param qty | ||
222 | + * @return | ||
223 | + */ | ||
224 | + //@RequiresPermissions("inventory:cyclecountDetail:confirm") | ||
225 | + @PostMapping("/confirmGapQty") | ||
226 | + @ResponseBody | ||
227 | + public AjaxResult confirmGapQty(Integer detailId, BigDecimal qty){ | ||
228 | + return cycleCountDetailService.confirmGapQty(detailId,qty); | ||
229 | + } | ||
218 | 230 | ||
219 | - | ||
220 | - | ||
221 | - | 231 | + /** |
232 | + * 差异复盘 | ||
233 | + * @param cycleCountHeadCode | ||
234 | + * @return | ||
235 | + */ | ||
236 | + //@RequiresPermissions("inventory:cyclecountDetail:cyclecountRepeat") | ||
237 | + @PostMapping("/createCyclecountWithGapQty") | ||
238 | + @ResponseBody | ||
239 | + public AjaxResult createCyclecountWithGapQty(String cycleCountHeadCode){ | ||
240 | + return cycleCountDetailService.createCyclecountWithGapQty(cycleCountHeadCode); | ||
241 | + } | ||
222 | 242 | ||
223 | 243 | ||
224 | 244 |
src/main/java/com/huaheng/pc/inventory/cycleCountDetail/service/CycleCountDetailService.java
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService; | @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService; | ||
4 | import com.huaheng.framework.web.domain.AjaxResult; | 4 | import com.huaheng.framework.web.domain.AjaxResult; |
5 | import com.huaheng.pc.inventory.cycleCountDetail.domain.CycleCountDetail; | 5 | import com.huaheng.pc.inventory.cycleCountDetail.domain.CycleCountDetail; |
6 | 6 | ||
7 | +import java.math.BigDecimal; | ||
7 | 8 | ||
8 | 9 | ||
9 | public interface CycleCountDetailService extends IService<CycleCountDetail> { | 10 | public interface CycleCountDetailService extends IService<CycleCountDetail> { |
@@ -15,7 +16,11 @@ public interface CycleCountDetailService extends IService<CycleCountDetail> { | @@ -15,7 +16,11 @@ public interface CycleCountDetailService extends IService<CycleCountDetail> { | ||
15 | 16 | ||
16 | AjaxResult createCycleCoutTaskByDetailId(Integer cycleCoutdetailId); | 17 | AjaxResult createCycleCoutTaskByDetailId(Integer cycleCoutdetailId); |
17 | 18 | ||
19 | + AjaxResult confirmGapQty(Integer detailId, BigDecimal qty); | ||
18 | 20 | ||
21 | + void updataDetailStatus(Integer detailid,Integer status); | ||
22 | + | ||
23 | + AjaxResult createCyclecountWithGapQty(String cycleCountHeadCode); | ||
19 | 24 | ||
20 | 25 | ||
21 | 26 |
src/main/java/com/huaheng/pc/inventory/cycleCountDetail/service/CycleCountDetailServiceImpl.java
@@ -23,6 +23,7 @@ import org.springframework.stereotype.Service; | @@ -23,6 +23,7 @@ import org.springframework.stereotype.Service; | ||
23 | import org.springframework.transaction.annotation.Transactional; | 23 | import org.springframework.transaction.annotation.Transactional; |
24 | 24 | ||
25 | import javax.annotation.Resource; | 25 | import javax.annotation.Resource; |
26 | +import java.math.BigDecimal; | ||
26 | import java.util.ArrayList; | 27 | import java.util.ArrayList; |
27 | import java.util.Date; | 28 | import java.util.Date; |
28 | import java.util.List; | 29 | import java.util.List; |
@@ -46,6 +47,43 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap | @@ -46,6 +47,43 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap | ||
46 | 47 | ||
47 | 48 | ||
48 | 49 | ||
50 | + | ||
51 | + | ||
52 | + | ||
53 | + | ||
54 | + | ||
55 | + /** | ||
56 | + * 执行任务修改状态为10 | ||
57 | + * @param detailid | ||
58 | + */ | ||
59 | + @Transactional | ||
60 | + @Override | ||
61 | + public void updataDetailStatus(Integer detailid,Integer status) { | ||
62 | + /*传入明细ID,状态,通过明细ID修改状态,并修改主单状态 */ | ||
63 | + if(detailid == null || status == null){ | ||
64 | + throw new ServiceException("明细ID或状态不能为空!"); | ||
65 | + } | ||
66 | + CycleCountDetail cycleCountDetail = this.getById(detailid) ;//盘点明细单 | ||
67 | + cycleCountDetail.setEnableStatus(status); | ||
68 | + cycleCountDetail.setLastUpdated(new Date()); | ||
69 | + cycleCountDetail.setLastUpdatedBy(ShiroUtils.getLoginName());//更新用户 | ||
70 | + //主单 | ||
71 | + CycleCountHeader cycleCountHeader = new CycleCountHeader(); | ||
72 | + cycleCountHeader.setCode(cycleCountDetail.getCycleCountHeadCode()); | ||
73 | + cycleCountHeader.setWarehouseCode(cycleCountDetail.getWarehouseCode()); | ||
74 | + cycleCountHeader.setCompanyCode(cycleCountDetail.getCompanyCode()); | ||
75 | + LambdaQueryWrapper<CycleCountHeader> lambdaQueryWrapper = Wrappers.lambdaQuery(cycleCountHeader); | ||
76 | + cycleCountHeader = cycleCountHeaderService.getOne(lambdaQueryWrapper); | ||
77 | + if(cycleCountHeader.getStatusCyc() < 10 ){ | ||
78 | + //主单状态小于10则修改 | ||
79 | + cycleCountHeader.setStatusCyc(status); //主单状态 | ||
80 | + cycleCountHeaderService.saveOrUpdate(cycleCountHeader); | ||
81 | + } | ||
82 | + if(!this.saveOrUpdate(cycleCountDetail)){ | ||
83 | + throw new ServiceException("更新盘点执行状态失败!"); | ||
84 | + } | ||
85 | + } | ||
86 | + | ||
49 | /** | 87 | /** |
50 | * 新增盘点明细 | 88 | * 新增盘点明细 |
51 | * */ | 89 | * */ |
@@ -118,7 +156,6 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap | @@ -118,7 +156,6 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap | ||
118 | return AjaxResult.success("生成盘点明细成功"); | 156 | return AjaxResult.success("生成盘点明细成功"); |
119 | } | 157 | } |
120 | 158 | ||
121 | - | ||
122 | /** | 159 | /** |
123 | * 生成全部盘点任务 | 160 | * 生成全部盘点任务 |
124 | * @param cycleCountHeadCode | 161 | * @param cycleCountHeadCode |
@@ -196,7 +233,6 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap | @@ -196,7 +233,6 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap | ||
196 | } | 233 | } |
197 | 234 | ||
198 | //查询任务头和明细有相同容器,没有就新增任务头和明细 | 235 | //查询任务头和明细有相同容器,没有就新增任务头和明细 |
199 | - | ||
200 | LambdaQueryWrapper<TaskHeader> taskHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(); | 236 | LambdaQueryWrapper<TaskHeader> taskHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(); |
201 | taskHeaderLambdaQueryWrapper | 237 | taskHeaderLambdaQueryWrapper |
202 | .lt(TaskHeader::getStatus,100) | 238 | .lt(TaskHeader::getStatus,100) |
@@ -207,12 +243,9 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap | @@ -207,12 +243,9 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap | ||
207 | .eq(TaskHeader::getContainerCode,cycleCountDetail.getContainerCode());//容器 | 243 | .eq(TaskHeader::getContainerCode,cycleCountDetail.getContainerCode());//容器 |
208 | List<TaskHeader> taskHeaderList = taskHeaderService.list(taskHeaderLambdaQueryWrapper); | 244 | List<TaskHeader> taskHeaderList = taskHeaderService.list(taskHeaderLambdaQueryWrapper); |
209 | 245 | ||
210 | - | ||
211 | TaskHeader task = new TaskHeader(); | 246 | TaskHeader task = new TaskHeader(); |
212 | TaskDetail taskDetail = new TaskDetail(); | 247 | TaskDetail taskDetail = new TaskDetail(); |
213 | - | ||
214 | if(taskHeaderList.size() <= 0){ | 248 | if(taskHeaderList.size() <= 0){ |
215 | - | ||
216 | //存在相同容器的主任务直接加入该条主任务的明细 | 249 | //存在相同容器的主任务直接加入该条主任务的明细 |
217 | task.setWarehouseCode(ShiroUtils.getWarehouseCode()); | 250 | task.setWarehouseCode(ShiroUtils.getWarehouseCode()); |
218 | task.setCompanyCode(cycleCountDetail.getCompanyCode()); | 251 | task.setCompanyCode(cycleCountDetail.getCompanyCode()); |
@@ -242,7 +275,6 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap | @@ -242,7 +275,6 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap | ||
242 | taskDetail.setWarehouseCode(task.getWarehouseCode()); | 275 | taskDetail.setWarehouseCode(task.getWarehouseCode()); |
243 | cycleCountDetail.setTaskHeaderId(task.getId()); //盘点明细修改状态task数据源 | 276 | cycleCountDetail.setTaskHeaderId(task.getId()); //盘点明细修改状态task数据源 |
244 | }else{ | 277 | }else{ |
245 | - | ||
246 | //取其中一条主单即可 | 278 | //取其中一条主单即可 |
247 | TaskHeader taskHeader = taskHeaderList.get(0); | 279 | TaskHeader taskHeader = taskHeaderList.get(0); |
248 | taskDetail.setTaskId(taskHeader.getId());//主单ID | 280 | taskDetail.setTaskId(taskHeader.getId());//主单ID |
@@ -254,7 +286,6 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap | @@ -254,7 +286,6 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap | ||
254 | taskDetail.setWarehouseCode(taskHeader.getWarehouseCode()); | 286 | taskDetail.setWarehouseCode(taskHeader.getWarehouseCode()); |
255 | cycleCountDetail.setTaskHeaderId(taskHeader.getId());//盘点明细修改状态taskHeader数据源 | 287 | cycleCountDetail.setTaskHeaderId(taskHeader.getId());//盘点明细修改状态taskHeader数据源 |
256 | } | 288 | } |
257 | - | ||
258 | taskDetail.setBillCode(cycleCountDetail.getCycleCountHeadCode()); | 289 | taskDetail.setBillCode(cycleCountDetail.getCycleCountHeadCode()); |
259 | taskDetail.setBillDetailId(cycleCountDetail.getId()); | 290 | taskDetail.setBillDetailId(cycleCountDetail.getId()); |
260 | taskDetail.setMaterialCode(cycleCountDetail.getMaterialCode()); | 291 | taskDetail.setMaterialCode(cycleCountDetail.getMaterialCode()); |
@@ -273,7 +304,6 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap | @@ -273,7 +304,6 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap | ||
273 | if(taskDetailService.save(taskDetail) == false){ | 304 | if(taskDetailService.save(taskDetail) == false){ |
274 | throw new ServiceException("盘点任务明细生成失败!"); | 305 | throw new ServiceException("盘点任务明细生成失败!"); |
275 | } | 306 | } |
276 | - | ||
277 | //修改细单状态 | 307 | //修改细单状态 |
278 | cycleCountDetail.setTaskHeaderId(taskDetail.getId()); | 308 | cycleCountDetail.setTaskHeaderId(taskDetail.getId()); |
279 | //cycleCountDetail.setTaskHeaderId(task.getId()); | 309 | //cycleCountDetail.setTaskHeaderId(task.getId()); |
@@ -283,7 +313,6 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap | @@ -283,7 +313,6 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap | ||
283 | cycleCountDetail.setTaskHeaderId(task.getId()); | 313 | cycleCountDetail.setTaskHeaderId(task.getId()); |
284 | cycleCountDetail.setTaskDetailId(taskDetail.getId()); | 314 | cycleCountDetail.setTaskDetailId(taskDetail.getId()); |
285 | this.saveOrUpdate(cycleCountDetail); | 315 | this.saveOrUpdate(cycleCountDetail); |
286 | - | ||
287 | //修改主单状态 | 316 | //修改主单状态 |
288 | CycleCountHeader cycleCountHeader = new CycleCountHeader(); | 317 | CycleCountHeader cycleCountHeader = new CycleCountHeader(); |
289 | cycleCountHeader.setCode(cycleCountDetail.getCycleCountHeadCode()); | 318 | cycleCountHeader.setCode(cycleCountDetail.getCycleCountHeadCode()); |
@@ -296,6 +325,124 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap | @@ -296,6 +325,124 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap | ||
296 | return AjaxResult.success("盘点任务生成成功"); | 325 | return AjaxResult.success("盘点任务生成成功"); |
297 | } | 326 | } |
298 | 327 | ||
328 | + /** | ||
329 | + * 实盘登记 | ||
330 | + * 登记完成后,修改状态为15 | ||
331 | + * @param detailId | ||
332 | + * @param qty | ||
333 | + * @return | ||
334 | + */ | ||
335 | + @Transactional | ||
336 | + @Override | ||
337 | + public AjaxResult confirmGapQty(Integer detailId, BigDecimal qty) { | ||
338 | + CycleCountDetail cyclecountDetail = this.getById(detailId); //明细单据 | ||
339 | + CycleCountHeader cycleCountHeader =new CycleCountHeader(); | ||
340 | + cycleCountHeader.setWarehouseCode(cyclecountDetail.getWarehouseCode()); | ||
341 | + cycleCountHeader.setCompanyCode(cyclecountDetail.getCompanyCode()); | ||
342 | + cycleCountHeader.setCode(cyclecountDetail.getCycleCountHeadCode()); | ||
343 | + LambdaQueryWrapper<CycleCountHeader> cycleCountHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(cycleCountHeader); | ||
344 | + cycleCountHeader = cycleCountHeaderService.getOne(cycleCountHeaderLambdaQueryWrapper); //主单 | ||
345 | + //任务执行后再实盘登记 | ||
346 | + if(cyclecountDetail.getEnableStatus() < 10){ | ||
347 | + return AjaxResult.error("盘点任务未执行不能登记数量!"); | ||
348 | + } | ||
349 | + if(cyclecountDetail.getEnableStatus() == 100){ | ||
350 | + return AjaxResult.error("盘点任务完成后不能再登记数量!"); | ||
351 | + } | ||
352 | + if(cycleCountHeader==null){ | ||
353 | + return AjaxResult.error("主单据不存在"); | ||
354 | + } | ||
355 | + /*if(cyclecountDetail.getEnableStatus() == 10){ | ||
356 | + return AjaxResult.error("该条已调整,不能重复调整!"); | ||
357 | + }*/ | ||
358 | + if(qty.compareTo(new BigDecimal("0")) < 0){ | ||
359 | + return AjaxResult.error("实盘登记数不能小于0"); | ||
360 | + } | ||
361 | + if(cyclecountDetail.getInventoryDetailId() != null){ | ||
362 | + InventoryDetail inventoryDetail = inventoryDetailService.getById(cyclecountDetail.getInventoryDetailId()); | ||
363 | + if (inventoryDetail == null) { | ||
364 | + return AjaxResult.error("没有对应库存信息,请重建盘点单"); | ||
365 | + } | ||
366 | + if(qty.compareTo(inventoryDetail.getTaskQty()) < 0){ | ||
367 | + return AjaxResult.error("登记数量不能小于任务分配数量"); | ||
368 | + } | ||
369 | + } | ||
370 | + cyclecountDetail.setCountedQty(qty); | ||
371 | + cyclecountDetail.setGapQty(qty.subtract(cyclecountDetail.getSystemQty())); | ||
372 | + cyclecountDetail.setEnableStatus(15); | ||
373 | + cyclecountDetail.setLastUpdatedBy(ShiroUtils.getLoginName()); | ||
374 | + cyclecountDetail.setLastUpdated(new Date()); | ||
375 | + this.saveOrUpdate(cyclecountDetail); | ||
376 | + //修改主单状态 | ||
377 | + cycleCountHeaderService.updataHeaderStatus(cycleCountHeader.getCode()); | ||
378 | + | ||
379 | + return AjaxResult.success("登记成功"); | ||
380 | + } | ||
381 | + | ||
382 | + | ||
383 | + /** | ||
384 | + * 差异复盘 | ||
385 | + * @param cycleCountHeaderCode | ||
386 | + * @return | ||
387 | + */ | ||
388 | + @Transactional | ||
389 | + @Override | ||
390 | + public AjaxResult createCyclecountWithGapQty(String cycleCountHeaderCode) { | ||
391 | + /*找出实盘登记中数量有差异的,重新生成盘点单*/ | ||
392 | + | ||
393 | + | ||
394 | + CycleCountHeader cycleCountHeader = new CycleCountHeader(); | ||
395 | + cycleCountHeader.setWarehouseCode(ShiroUtils.getWarehouseCode()); | ||
396 | + cycleCountHeader.setCode(cycleCountHeaderCode); | ||
397 | + LambdaQueryWrapper<CycleCountHeader> lambdaQueryWrapper = Wrappers.lambdaQuery(cycleCountHeader); | ||
398 | + cycleCountHeader = cycleCountHeaderService.getOne(lambdaQueryWrapper);//主单 | ||
399 | + if(cycleCountHeader == null){ | ||
400 | + return AjaxResult.error("盘点单不存在"); | ||
401 | + } | ||
402 | + //不能重复生成,使用盘点单编码查找sourceCode源盘点单号,已存在就是重复 | ||
403 | + CycleCountHeader cy = new CycleCountHeader(); | ||
404 | + cy.setSourceCode(cycleCountHeader.getCode()); | ||
405 | + cy.setWarehouseCode(cycleCountHeader.getWarehouseCode()); | ||
406 | + cy.setCompanyCode(cycleCountHeader.getCompanyCode()); | ||
407 | + LambdaQueryWrapper<CycleCountHeader> lam = Wrappers.lambdaQuery(cy); | ||
408 | + CycleCountHeader countHeader = cycleCountHeaderService.getOne(lam); | ||
409 | + if(countHeader != null){ | ||
410 | + return AjaxResult.error("该单据已生成复盘单,请勿重复生成!"); | ||
411 | + } | ||
412 | + CycleCountDetail cycleCountDetail = new CycleCountDetail(); | ||
413 | + cycleCountDetail.setTaskHeaderId(cycleCountHeader.getId()); | ||
414 | + cycleCountDetail.setWarehouseCode(cycleCountHeader.getWarehouseCode()); | ||
415 | + cycleCountDetail.setCompanyCode(cycleCountHeader.getCompanyCode()); | ||
416 | + LambdaQueryWrapper<CycleCountDetail> cycleCountDetailLambdaQueryWrapper = Wrappers.lambdaQuery(); | ||
417 | + List<CycleCountDetail> cycleCountDetails = this.list(cycleCountDetailLambdaQueryWrapper);//明细 | ||
418 | + //生成复盘盘点主单 | ||
419 | + cycleCountHeader.setCode(cycleCountHeaderService.createCode()); | ||
420 | + cycleCountHeader.setRound(cycleCountHeader.getRound() + 1);//盘点轮次+1 | ||
421 | + cycleCountHeader.setCreated(new Date()); | ||
422 | + cycleCountHeader.setCreatedBy(ShiroUtils.getLoginName()); | ||
423 | + cycleCountHeader.setSourceCode(cycleCountHeaderCode);//源盘点单号 | ||
424 | + if(!cycleCountHeaderService.saveOrUpdate(cycleCountHeader)){ | ||
425 | + throw new ServiceException("复盘主单生成失败!"); | ||
426 | + } | ||
427 | + //获取差异数量不为零的子单重新再生成盘点单 | ||
428 | + List<CycleCountDetail> cycleCountDetailList = new ArrayList<>(); | ||
429 | + for(CycleCountDetail item:cycleCountDetails){ | ||
430 | + //getGapQty不能为null默认值为0 | ||
431 | + int f = item.getGapQty().compareTo(BigDecimal.ZERO); | ||
432 | + if(f > 0){ | ||
433 | + item.setCountedQty(null); | ||
434 | + item.setGapQty(BigDecimal.ZERO); | ||
435 | + item.setCreatedBy(ShiroUtils.getLoginName()); | ||
436 | + item.setCreated(new Date()); | ||
437 | + cycleCountDetailList.add(item); | ||
438 | + } | ||
439 | + | ||
440 | + } | ||
441 | + if(!this.saveBatch(cycleCountDetailList)){ | ||
442 | + throw new ServiceException("复盘明细子单生成失败"); | ||
443 | + } | ||
444 | + return AjaxResult.success("生成复盘单成功!"); | ||
445 | + } | ||
299 | 446 | ||
300 | 447 | ||
301 | 448 |
src/main/java/com/huaheng/pc/task/taskHeader/service/TaskHeaderServiceImpl.java
@@ -312,10 +312,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -312,10 +312,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
312 | } | 312 | } |
313 | 313 | ||
314 | /** | 314 | /** |
315 | - * 下发WCS执行任务 | ||
316 | - */ | ||
317 | - /** | ||
318 | - * | 315 | + *下发WCS执行任务 |
319 | * 执行任务 | 316 | * 执行任务 |
320 | * */ | 317 | * */ |
321 | @Override | 318 | @Override |
@@ -324,6 +321,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -324,6 +321,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
324 | TaskHeader task = null; | 321 | TaskHeader task = null; |
325 | for (Integer taskId : taskIds) { | 322 | for (Integer taskId : taskIds) { |
326 | task = taskHeaderService.getById(taskId); | 323 | task = taskHeaderService.getById(taskId); |
324 | + | ||
327 | if (task.getStatus() > 9) { | 325 | if (task.getStatus() > 9) { |
328 | return AjaxResult.error("任务" + taskId + "已经下发,请不要重复下发,操作中止"); | 326 | return AjaxResult.error("任务" + taskId + "已经下发,请不要重复下发,操作中止"); |
329 | } | 327 | } |
@@ -335,17 +333,25 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -335,17 +333,25 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
335 | task.setLastUpdatedBy(ShiroUtils.getLoginName()); | 333 | task.setLastUpdatedBy(ShiroUtils.getLoginName()); |
336 | taskHeaderService.saveOrUpdate(task); | 334 | taskHeaderService.saveOrUpdate(task); |
337 | //修改任务明细状态 | 335 | //修改任务明细状态 |
338 | - TaskDetail record = new TaskDetail(); | ||
339 | - record.setStatus(10); | ||
340 | - record.setLastUpdated(new Date()); | ||
341 | - record.setLastUpdatedBy(ShiroUtils.getLoginName()); | ||
342 | - record.setProcessStamp("100"); | ||
343 | - taskDetailService.updateById(record); | ||
344 | - LambdaUpdateWrapper<TaskDetail> lambdaUpdateWrapper = Wrappers.lambdaUpdate(); | ||
345 | - lambdaUpdateWrapper.eq(TaskDetail::getTaskId, task.getId()); | ||
346 | - if (!taskDetailService.update(record, lambdaUpdateWrapper)){ | 336 | + LambdaQueryWrapper<TaskDetail> lambdaWrapper = Wrappers.lambdaQuery(); |
337 | + lambdaWrapper.eq(TaskDetail::getTaskId, task.getId()); | ||
338 | + List<TaskDetail> taskDetailList = taskDetailService.list(lambdaWrapper); | ||
339 | + List<TaskDetail> taskDetails = new ArrayList<>(); | ||
340 | + for (TaskDetail item:taskDetailList){ | ||
341 | + item.setStatus(10); | ||
342 | + item.setLastUpdated(new Date()); | ||
343 | + item.setLastUpdatedBy(ShiroUtils.getLoginName()); | ||
344 | + item.setProcessStamp("100"); | ||
345 | + taskDetails.add(item); | ||
346 | + //盘点执行修改盘点单据状态为10 | ||
347 | + if(task.getTaskType() == 700){ | ||
348 | + cycleCountDetailService.updataDetailStatus(item.getBillDetailId(),10); | ||
349 | + } | ||
350 | + } | ||
351 | + if (!taskDetailService.saveOrUpdateBatch(taskDetails)){ | ||
347 | throw new ServiceException("更新任务明细失败"); | 352 | throw new ServiceException("更新任务明细失败"); |
348 | } | 353 | } |
354 | + | ||
349 | // //修改入库明细 | 355 | // //修改入库明细 |
350 | // if (task.getInternalTaskType()==100){ | 356 | // if (task.getInternalTaskType()==100){ |
351 | // ReceiptDetail receiptDetail = receiptDetailService.queryflow(receiptDetailService.getById(record.getId())); | 357 | // ReceiptDetail receiptDetail = receiptDetailService.queryflow(receiptDetailService.getById(record.getId())); |
@@ -387,7 +393,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -387,7 +393,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
387 | 393 | ||
388 | 394 | ||
389 | } | 395 | } |
390 | - return AjaxResult.success("下发任务成功", task); | 396 | + return AjaxResult.success("执行下发任务成功", task); |
391 | } | 397 | } |
392 | 398 | ||
393 | @Override | 399 | @Override |
@@ -416,7 +422,6 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -416,7 +422,6 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
416 | * 完成任务 | 422 | * 完成任务 |
417 | * | 423 | * |
418 | * @param task | 424 | * @param task |
419 | - * @throws Exception | ||
420 | */ | 425 | */ |
421 | @Transactional | 426 | @Transactional |
422 | public void completeTask(TaskHeader task) { | 427 | public void completeTask(TaskHeader task) { |
@@ -429,7 +434,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -429,7 +434,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
429 | // 出库任务 | 434 | // 出库任务 |
430 | completeShipmentTask(task); | 435 | completeShipmentTask(task); |
431 | } | 436 | } |
432 | - // 900 出库查看,包过空托出库查看 | 437 | + // 900 出库查看,空托出库查看 |
433 | if ( task.getTaskType() == 900) { | 438 | if ( task.getTaskType() == 900) { |
434 | completeSeeOutTask(task); | 439 | completeSeeOutTask(task); |
435 | } | 440 | } |
@@ -1004,10 +1009,6 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -1004,10 +1009,6 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
1004 | @Transactional | 1009 | @Transactional |
1005 | public void completeEmptyIn(TaskHeader taskHeader) { | 1010 | public void completeEmptyIn(TaskHeader taskHeader) { |
1006 | 1011 | ||
1007 | - //解锁容器,更新库位 | ||
1008 | - containerService.updateLocationCodeAndStatus(taskHeader.getContainerCode(),taskHeader.getToLocation(),"empty"); | ||
1009 | - //解锁库位,更新容器 | ||
1010 | - locationService.updateContainerCodeAndStatus(taskHeader.getToLocation(),taskHeader.getContainerCode(),"empty"); | ||
1011 | //完成任务,修改主单和明细状态 | 1012 | //完成任务,修改主单和明细状态 |
1012 | taskHeader.setStatus(100); | 1013 | taskHeader.setStatus(100); |
1013 | taskHeader.setLastUpdatedBy(ShiroUtils.getLoginName()); | 1014 | taskHeader.setLastUpdatedBy(ShiroUtils.getLoginName()); |
@@ -1026,9 +1027,14 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -1026,9 +1027,14 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
1026 | item.setLastUpdated(new Date()); //更新时间 | 1027 | item.setLastUpdated(new Date()); //更新时间 |
1027 | taskDetailList.add(item); | 1028 | taskDetailList.add(item); |
1028 | } | 1029 | } |
1029 | - if (taskDetailService.saveOrUpdateBatch(taskDetailList) == false || taskHeaderService.saveOrUpdate(taskHeader) == false) { | 1030 | + if (taskDetailService.saveOrUpdateBatch(taskDetailList) == false || |
1031 | + taskHeaderService.saveOrUpdate(taskHeader) == false) { | ||
1030 | throw new ServiceException("任务单据状态更新失败!"); | 1032 | throw new ServiceException("任务单据状态更新失败!"); |
1031 | } | 1033 | } |
1034 | + //解锁容器,更新库位 | ||
1035 | + containerService.updateLocationCodeAndStatus(taskHeader.getContainerCode(),taskHeader.getToLocation(),"empty"); | ||
1036 | + //解锁库位,更新容器 | ||
1037 | + locationService.updateContainerCodeAndStatus(taskHeader.getToLocation(),taskHeader.getContainerCode(),"empty"); | ||
1032 | 1038 | ||
1033 | } | 1039 | } |
1034 | 1040 | ||
@@ -1038,10 +1044,6 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -1038,10 +1044,6 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
1038 | */ | 1044 | */ |
1039 | @Transactional | 1045 | @Transactional |
1040 | public void completeEmptyOut(TaskHeader taskHeader) { | 1046 | public void completeEmptyOut(TaskHeader taskHeader) { |
1041 | - //更新货位 | ||
1042 | - locationService.updateContainerCodeAndStatus(taskHeader.getFromLocation(), "", "empty"); | ||
1043 | - //更新容器信息 | ||
1044 | - containerService.updateLocationCodeAndStatus(taskHeader.getContainerCode(), "", "empty"); | ||
1045 | 1047 | ||
1046 | taskHeader.setStatus(100); | 1048 | taskHeader.setStatus(100); |
1047 | taskHeader.setLastUpdatedBy(ShiroUtils.getLoginName()); | 1049 | taskHeader.setLastUpdatedBy(ShiroUtils.getLoginName()); |
@@ -1063,6 +1065,11 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -1063,6 +1065,11 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
1063 | if (taskDetailService.saveOrUpdateBatch(taskDetailList) == false || taskHeaderService.saveOrUpdate(taskHeader) == false) { | 1065 | if (taskDetailService.saveOrUpdateBatch(taskDetailList) == false || taskHeaderService.saveOrUpdate(taskHeader) == false) { |
1064 | throw new ServiceException("任务单据状态更新失败!"); | 1066 | throw new ServiceException("任务单据状态更新失败!"); |
1065 | } | 1067 | } |
1068 | + //更新货位 | ||
1069 | + locationService.updateContainerCodeAndStatus(taskHeader.getFromLocation(), "", "empty"); | ||
1070 | + //更新容器信息 | ||
1071 | + containerService.updateLocationCodeAndStatus(taskHeader.getContainerCode(), "", "empty"); | ||
1072 | + | ||
1066 | } | 1073 | } |
1067 | 1074 | ||
1068 | /** | 1075 | /** |
src/main/resources/templates/inventory/cycleCountDetail/cycleCountDetail.html
@@ -88,10 +88,10 @@ | @@ -88,10 +88,10 @@ | ||
88 | shiro:hasPermission="inventory:cycleCountDetail:add"> | 88 | shiro:hasPermission="inventory:cycleCountDetail:add"> |
89 | <i class="fa fa-plus"></i> 新增 | 89 | <i class="fa fa-plus"></i> 新增 |
90 | </a> | 90 | </a> |
91 | - <!--<a class="btn btn-outline btn-danger btn-rounded" onclick="createCyclecountWithGapQty()" | 91 | + <a class="btn btn-outline btn-danger btn-rounded" onclick="createCyclecountWithGapQty()" |
92 | shiro:hasPermission="inventory:cyclecountDetail:cyclecountRepeat"> | 92 | shiro:hasPermission="inventory:cyclecountDetail:cyclecountRepeat"> |
93 | <i class="fa fa-vcard"></i> 差异复盘 | 93 | <i class="fa fa-vcard"></i> 差异复盘 |
94 | - </a>--> | 94 | + </a> |
95 | <a class="btn btn-outline btn-danger btn-rounded" onclick="outcheckAll()" | 95 | <a class="btn btn-outline btn-danger btn-rounded" onclick="outcheckAll()" |
96 | shiro:hasPermission="inventory:cyclecountDetail:createTask"> | 96 | shiro:hasPermission="inventory:cyclecountDetail:createTask"> |
97 | <i class="fa fa-vcard"></i> 生成全部盘点任务 | 97 | <i class="fa fa-vcard"></i> 生成全部盘点任务 |