Commit db5e17703db73be24750555a2881fdec5ef99df7
1 parent
49c3b9d5
入库完成任务改成批量提交
Showing
4 changed files
with
166 additions
and
68 deletions
src/main/java/com/huaheng/pc/receipt/receiptDetail/service/ReceiptDetailServiceImpl.java
... | ... | @@ -558,7 +558,7 @@ public class ReceiptDetailServiceImpl extends ServiceImpl<ReceiptDetailMapper, R |
558 | 558 | } |
559 | 559 | } |
560 | 560 | } |
561 | - LambdaQueryWrapper<InventoryDetail> invlambdaDetails = Wrappers.lambdaQuery(); | |
561 | + /* LambdaQueryWrapper<InventoryDetail> invlambdaDetails = Wrappers.lambdaQuery(); | |
562 | 562 | invlambdaDetails.eq(InventoryDetail::getReceiptCode, receiptHeader.getCode()); |
563 | 563 | List<InventoryDetail> invDetails = inventoryDetailService.list(invlambdaDetails); |
564 | 564 | int totalqty=0; |
... | ... | @@ -567,7 +567,7 @@ public class ReceiptDetailServiceImpl extends ServiceImpl<ReceiptDetailMapper, R |
567 | 567 | } |
568 | 568 | if(receiptHeader.getTotalQty().intValue()!=totalqty){ |
569 | 569 | minStatus=minStatusOld; |
570 | - } | |
570 | + }*/ | |
571 | 571 | //若更新状态值小于头状态,更新尾状态否则更新头尾状态 |
572 | 572 | /* for (ReceiptDetail receiptDetail : receiptDetails) { |
573 | 573 | if(receiptDetail.getTotalQty().subtract(receiptDetail.getOpenQty()).compareTo(BigDecimal.ZERO) == 0) { |
... | ... |
src/main/java/com/huaheng/pc/task/taskHeader/domain/TaskReceiptCompleteDomain.java
0 → 100644
1 | +package com.huaheng.pc.task.taskHeader.domain; | |
2 | + | |
3 | +import com.baomidou.mybatisplus.annotation.*; | |
4 | +import com.huaheng.pc.barcode.barcodeDetail.domain.BarCodeDetail; | |
5 | +import com.huaheng.pc.inventory.inventoryDetail.domain.InventoryDetail; | |
6 | +import com.huaheng.pc.inventory.inventoryHeader.domain.InventoryHeader; | |
7 | +import com.huaheng.pc.inventory.inventoryTransaction.domain.InventoryTransaction; | |
8 | +import com.huaheng.pc.receipt.receiptContainerDetail.domain.ReceiptContainerDetail; | |
9 | +import com.huaheng.pc.receipt.receiptDetail.domain.ReceiptDetail; | |
10 | +import com.huaheng.pc.task.taskDetail.domain.TaskDetail; | |
11 | +import io.swagger.annotations.ApiModel; | |
12 | +import io.swagger.annotations.ApiModelProperty; | |
13 | +import lombok.Data; | |
14 | + | |
15 | +import java.io.Serializable; | |
16 | +import java.math.BigDecimal; | |
17 | +import java.util.*; | |
18 | + | |
19 | +@Data | |
20 | +public class TaskReceiptCompleteDomain implements Serializable { | |
21 | + | |
22 | + private List<BarCodeDetail> barCodeDetailList=new ArrayList<>(); | |
23 | + | |
24 | + private InventoryHeader inventoryHeader; | |
25 | + | |
26 | + private List<InventoryTransaction> inventoryTransactionList=new ArrayList<>(); | |
27 | + | |
28 | + private List<InventoryDetail> inventoryDetailList=new ArrayList<>(); | |
29 | + | |
30 | + | |
31 | + private List<ReceiptContainerDetail> receiptContainerDetailList; | |
32 | + | |
33 | + private List<ReceiptDetail> receiptDetailList; | |
34 | + | |
35 | + private List<TaskDetail> taskDetailList=new ArrayList<>(); | |
36 | + | |
37 | + private Set<String> receiptDetailSet=new HashSet<>(); | |
38 | + | |
39 | + private BigDecimal totalQty; | |
40 | + | |
41 | +} | |
... | ... |
src/main/java/com/huaheng/pc/task/taskHeader/service/ReceiptTaskService.java
... | ... | @@ -57,6 +57,7 @@ import com.huaheng.pc.task.agvTask.service.AgvTaskService; |
57 | 57 | import com.huaheng.pc.task.taskDetail.domain.TaskDetail; |
58 | 58 | import com.huaheng.pc.task.taskDetail.service.TaskDetailService; |
59 | 59 | import com.huaheng.pc.task.taskHeader.domain.TaskHeader; |
60 | +import com.huaheng.pc.task.taskHeader.domain.TaskReceiptCompleteDomain; | |
60 | 61 | import com.huaheng.pc.task.taskHeader.mapper.TaskHeaderMapper; |
61 | 62 | import org.springframework.stereotype.Service; |
62 | 63 | import org.springframework.transaction.annotation.Transactional; |
... | ... | @@ -391,6 +392,7 @@ public class ReceiptTaskService { |
391 | 392 | // } |
392 | 393 | //} |
393 | 394 | InventoryHeader inventoryHeader = null; |
395 | + // 补充入库,修改库存明细库位 | |
394 | 396 | if(task.getTaskType().equals(QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT)) { |
395 | 397 | LambdaQueryWrapper<InventoryHeader> lambdaQueryWrapper = Wrappers.lambdaQuery(); |
396 | 398 | lambdaQueryWrapper.eq(InventoryHeader::getWarehouseCode, warehouseCode) |
... | ... | @@ -403,7 +405,7 @@ public class ReceiptTaskService { |
403 | 405 | location.setContainerCode(""); |
404 | 406 | location.setStatus(QuantityConstant.STATUS_LOCATION_EMPTY); |
405 | 407 | locationService.updateById(location); |
406 | - inventoryHeader.setLocationCode(task.getToLocation()); | |
408 | + /*inventoryHeader.setLocationCode(task.getToLocation()); | |
407 | 409 | inventoryHeaderService.updateById(inventoryHeader); |
408 | 410 | LambdaQueryWrapper<InventoryDetail> lambdaQueryWrapper2 = Wrappers.lambdaQuery(); |
409 | 411 | lambdaQueryWrapper2.eq(InventoryDetail::getWarehouseCode, warehouseCode) |
... | ... | @@ -415,7 +417,16 @@ public class ReceiptTaskService { |
415 | 417 | inventoryDetail.setZoneCode(location.getZoneCode()); |
416 | 418 | inventoryDetailService.updateById(inventoryDetail); |
417 | 419 | } |
418 | - } | |
420 | + }*/ | |
421 | + | |
422 | + /*LambdaUpdateWrapper<InventoryDetail> wrapper = Wrappers.lambdaUpdate(); | |
423 | + wrapper.eq(InventoryDetail::getWarehouseCode, warehouseCode) | |
424 | + .eq(InventoryDetail::getInventoryHeaderId, inventoryHeader.getId()) | |
425 | + .set(InventoryDetail::getLocationCode, task.getToLocation()) | |
426 | + .set(InventoryDetail::getZoneCode, task.getZoneCode()); | |
427 | + inventoryDetailService.update(wrapper);*/ | |
428 | + | |
429 | + | |
419 | 430 | } |
420 | 431 | } |
421 | 432 | if (StringUtils.isNull(inventoryHeader)) { |
... | ... | @@ -455,6 +466,12 @@ public class ReceiptTaskService { |
455 | 466 | ReceiptDetail receiptDetail = null; |
456 | 467 | BarCodeDetail barCodeDetail = null; |
457 | 468 | /* 遍历任务明细,修改关联的入库组盘、入库单状态、添加库存*/ |
469 | + TaskReceiptCompleteDomain taskReceiptCompleteDomain=new TaskReceiptCompleteDomain(); | |
470 | + taskReceiptCompleteDomain.setTotalQty(inventoryHeader.getTotalQty()); | |
471 | + taskReceiptCompleteDomain.setInventoryHeader(inventoryHeader); | |
472 | + List<BarCodeDetail> barCodeDetails=new ArrayList<>(); | |
473 | + List<TaskDetail> taskDetails=new ArrayList<>(); | |
474 | + List<ReceiptDetail> receiptDetails=new ArrayList<>(); | |
458 | 475 | for (TaskDetail taskDetail : taskDetailList) { |
459 | 476 | if (taskDetail.getStatus() < QuantityConstant.TASK_STATUS_COMPLETED) { |
460 | 477 | if(StringUtils.isNullNew(taskDetail.getWeights())){ |
... | ... | @@ -474,28 +491,22 @@ public class ReceiptTaskService { |
474 | 491 | if(taskDetail.getTypeId() == 1){ |
475 | 492 | /*查询包装成品入库单明细*/ |
476 | 493 | barCodeDetail = barCodeDetailService.getById(taskDetail.getBarcodeDetailsId()); |
477 | - this.addInventoryDetails(taskDetail, barCodeDetail, inventoryHeader,task); | |
494 | + taskReceiptCompleteDomain=this.addInventoryDetails(taskDetail, barCodeDetail, inventoryHeader,task,taskReceiptCompleteDomain); | |
495 | + List<BarCodeDetail> barCodeDetailList=taskReceiptCompleteDomain.getBarCodeDetailList(); | |
478 | 496 | barCodeDetail.setProcessStamp(String.valueOf(QuantityConstant.RECEIPT_HEADER_POSTING)); |
479 | - barCodeDetailService.updateById(barCodeDetail); | |
497 | + barCodeDetails.add(barCodeDetail); | |
498 | +// barCodeDetailService.updateById(barCodeDetail); | |
480 | 499 | |
481 | 500 | }else{ |
482 | 501 | |
483 | 502 | if (StringUtils.isNotNull(receiptDetail)) { |
484 | - this.addInventoryDetail(taskDetail, receiptDetail, inventoryHeader,task); | |
485 | - //修改组盘表状态为完成 | |
486 | - /* ReceiptContainerDetail receiptContainerDetail = new ReceiptContainerDetail(); | |
487 | - receiptContainerDetail.setStatus(QuantityConstant.RECEIPT_CONTAINER_FINISHED); | |
488 | - receiptContainerDetail.setLastUpdatedBy(receiptDetail.getCreatedBy()); | |
489 | - LambdaUpdateWrapper<ReceiptContainerDetail> receiptContainerDetailLambdaUpdateWrapper = Wrappers.lambdaUpdate(); | |
490 | - receiptContainerDetailLambdaUpdateWrapper.eq(ReceiptContainerDetail::getId, taskDetail.getAllocationId()); | |
491 | - if (!receiptContainerDetailService.update(receiptContainerDetail, receiptContainerDetailLambdaUpdateWrapper)){ | |
492 | - throw new ServiceException("更新组盘状态失败"); | |
493 | - }*/ | |
503 | + taskReceiptCompleteDomain=this.addInventoryDetail(taskDetail, receiptDetail, inventoryHeader,task,taskReceiptCompleteDomain); | |
494 | 504 | } else { |
495 | 505 | throw new ServiceException("未找到id:" + taskDetail.getBillDetailId() + "入库单明细"); |
496 | 506 | } |
497 | 507 | |
498 | 508 | } |
509 | + | |
499 | 510 | //修改组盘表状态为完成 |
500 | 511 | ReceiptContainerDetail receiptContainerDetail = new ReceiptContainerDetail(); |
501 | 512 | receiptContainerDetail.setStatus(QuantityConstant.RECEIPT_CONTAINER_FINISHED); |
... | ... | @@ -505,24 +516,36 @@ public class ReceiptTaskService { |
505 | 516 | if (!receiptContainerDetailService.update(receiptContainerDetail, receiptContainerDetailLambdaUpdateWrapper)){ |
506 | 517 | throw new ServiceException("更新组盘状态失败"); |
507 | 518 | } |
508 | - receiptDetail.setProcessStamp(String.valueOf(QuantityConstant.RECEIPT_HEADER_POSTING)); | |
519 | + if(receiptDetail.getUnitId2Qty()==null){ | |
520 | + receiptDetail.setUnitId2Qty(new BigDecimal(0)); | |
521 | + } | |
522 | + receiptDetail.setUnitId2Qty(receiptDetail.getUnitId2Qty().add(taskDetail.getQty())); | |
523 | + if(receiptDetail.getTotalQty().compareTo(receiptDetail.getUnitId2Qty())==0){ | |
524 | + receiptDetail.setProcessStamp(String.valueOf(QuantityConstant.RECEIPT_HEADER_POSTING)); | |
525 | + } | |
509 | 526 | receiptDetailService.updateById(receiptDetail); |
510 | 527 | receiptDetailService.updateReceiptHeaderLastStatus(receiptDetail.getReceiptId()); |
511 | - materialWarningService.materialWarning(taskDetail.getMaterialCode(), taskDetail.getCompanyCode()); | |
512 | - Location location = locationService.getLocationByCode(task.getToLocation(), ShiroUtils.getWarehouseCode()); | |
513 | - if(location != null) { | |
514 | - task.setZoneCode(location.getZoneCode()); | |
515 | - } | |
528 | +// materialWarningService.materialWarning(taskDetail.getMaterialCode(), taskDetail.getCompanyCode()); | |
529 | + | |
516 | 530 | taskDetail.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); |
517 | - taskDetailService.updateById(taskDetail); | |
531 | + taskDetails.add(taskDetail); | |
532 | +// taskDetailService.updateById(taskDetail); | |
518 | 533 | } |
519 | 534 | } |
535 | + Location location = locationService.getLocationByCode(task.getToLocation(), ShiroUtils.getWarehouseCode()); | |
536 | + if(location != null) { | |
537 | + task.setZoneCode(location.getZoneCode()); | |
538 | + } | |
539 | + taskReceiptCompleteDomain.setBarCodeDetailList(barCodeDetails); | |
540 | + taskReceiptCompleteDomain.setTaskDetailList(taskDetails); | |
541 | + //save批量提交数据 | |
542 | + saveOrUpdateTaskCompleteTable(taskReceiptCompleteDomain); | |
520 | 543 | if (StringUtils.isNull(inventoryHeader)) { |
521 | 544 | throw new ServiceException("库存添加失败"); |
522 | 545 | } |
523 | 546 | |
524 | 547 | //修改库位状态和对应的容器 |
525 | - Location location = new Location(); | |
548 | +// Location location = new Location(); | |
526 | 549 | location.setContainerCode(task.getContainerCode()); |
527 | 550 | location.setWarehouseCode(warehouseCode); |
528 | 551 | location.setStatus(QuantityConstant.STATUS_LOCATION_EMPTY); |
... | ... | @@ -531,10 +554,10 @@ public class ReceiptTaskService { |
531 | 554 | location.setWeight(container1.getWeight()); |
532 | 555 | location.setHeight(container1.getHeight()); |
533 | 556 | } |
534 | - LambdaUpdateWrapper<Location> locationLambdaUpdateWrapper = Wrappers.lambdaUpdate(); | |
557 | + /* LambdaUpdateWrapper<Location> locationLambdaUpdateWrapper = Wrappers.lambdaUpdate(); | |
535 | 558 | locationLambdaUpdateWrapper.eq(Location::getCode, task.getToLocation()); |
536 | - locationLambdaUpdateWrapper.eq(Location::getWarehouseCode, warehouseCode); | |
537 | - if (!locationService.update(location, locationLambdaUpdateWrapper)){ | |
559 | + locationLambdaUpdateWrapper.eq(Location::getWarehouseCode, warehouseCode);*/ | |
560 | + if (!locationService.updateById(location)){ | |
538 | 561 | throw new ServiceException("更新库位失败"); |
539 | 562 | } |
540 | 563 | |
... | ... | @@ -571,6 +594,39 @@ public class ReceiptTaskService { |
571 | 594 | return AjaxResult.success(); |
572 | 595 | } |
573 | 596 | |
597 | + public void saveOrUpdateTaskCompleteTable(TaskReceiptCompleteDomain taskReceiptCompleteDomain){ | |
598 | + List<BarCodeDetail> barCodeDetailList=taskReceiptCompleteDomain.getBarCodeDetailList(); | |
599 | + List<InventoryTransaction> inventoryTransactionList=taskReceiptCompleteDomain.getInventoryTransactionList(); | |
600 | + List<InventoryDetail> inventoryDetailList=taskReceiptCompleteDomain.getInventoryDetailList(); | |
601 | + List<ReceiptDetail> receiptDetailList=taskReceiptCompleteDomain.getReceiptDetailList(); | |
602 | + List<TaskDetail> taskDetails=taskReceiptCompleteDomain.getTaskDetailList(); | |
603 | +// Set<String> receiptDetailSet=taskReceiptCompleteDomain.getReceiptDetailSet(); | |
604 | + InventoryHeader inventoryHeader=taskReceiptCompleteDomain.getInventoryHeader(); | |
605 | + BigDecimal totalQty=taskReceiptCompleteDomain.getTotalQty(); | |
606 | + | |
607 | + if(inventoryDetailList!=null&&inventoryDetailList.size()>0){ | |
608 | + inventoryDetailService.saveOrUpdateBatch(inventoryDetailList); | |
609 | + } | |
610 | + inventoryHeader.setTotalQty(totalQty); | |
611 | + inventoryHeaderService.saveOrUpdate(inventoryHeader); | |
612 | + if(barCodeDetailList!=null&&barCodeDetailList.size()>0){ | |
613 | + barCodeDetailService.updateBatchById(barCodeDetailList); | |
614 | + } | |
615 | + if(inventoryTransactionList!=null&&inventoryTransactionList.size()>0){ | |
616 | + inventoryTransactionService.saveBatch(inventoryTransactionList); | |
617 | + } | |
618 | + /*if(receiptDetailList!=null&&receiptDetailList.size()>0){ | |
619 | + receiptDetailService.updateBatchById(receiptDetailList); | |
620 | + }*/ | |
621 | + if(taskDetails!=null&&taskDetails.size()>0){ | |
622 | + taskDetailService.updateBatchById(taskDetails); | |
623 | + } | |
624 | + | |
625 | + | |
626 | + | |
627 | + | |
628 | + } | |
629 | + | |
574 | 630 | |
575 | 631 | |
576 | 632 | |
... | ... | @@ -582,9 +638,12 @@ public class ReceiptTaskService { |
582 | 638 | * @param inventoryHeader 库存头表 |
583 | 639 | * @return 任务数量 |
584 | 640 | */ |
585 | - private BigDecimal addInventoryDetail(TaskDetail taskDetail, | |
641 | + private TaskReceiptCompleteDomain addInventoryDetail(TaskDetail taskDetail, | |
586 | 642 | ReceiptDetail receiptDetail, |
587 | - InventoryHeader inventoryHeader,TaskHeader task) { | |
643 | + InventoryHeader inventoryHeader,TaskHeader task,TaskReceiptCompleteDomain taskReceiptCompleteDomain) { | |
644 | + List<InventoryDetail> inventoryDetailList=taskReceiptCompleteDomain.getInventoryDetailList(); | |
645 | + List<InventoryTransaction> inventoryTransactionList=taskReceiptCompleteDomain.getInventoryTransactionList(); | |
646 | + | |
588 | 647 | String warehouseCode = inventoryHeader.getWarehouseCode(); |
589 | 648 | /*该入库明细是否已存在库存明细记录,已存在更新数量、不存在新增记录*/ |
590 | 649 | LambdaQueryWrapper<InventoryDetail> inventory = Wrappers.lambdaQuery(); |
... | ... | @@ -665,11 +724,12 @@ public class ReceiptTaskService { |
665 | 724 | inventoryDetail.setCountryCode(taskDetail.getCountryCode()); |
666 | 725 | inventoryDetail.setBarcodeDetailsCode(taskDetail.getBarcodeDetailsCode()); |
667 | 726 | } |
668 | - if (!inventoryDetailService.saveOrUpdate(inventoryDetail)) { | |
727 | + inventoryDetailList.add(inventoryDetail); | |
728 | + /*if (!inventoryDetailService.saveOrUpdate(inventoryDetail)) { | |
669 | 729 | throw new ServiceException("保存库存明细失败"); |
670 | - } | |
671 | - inventoryHeader.setTotalQty(inventoryHeader.getTotalQty().add(taskDetail.getQty())); | |
672 | - inventoryHeaderService.updateById(inventoryHeader); | |
730 | + }*/ | |
731 | + /* inventoryHeader.setTotalQty(inventoryHeader.getTotalQty().add(taskDetail.getQty())); | |
732 | + inventoryHeaderService.updateById(inventoryHeader);*/ | |
673 | 733 | //记录库存交易记录 |
674 | 734 | InventoryTransaction inventoryTransaction = new InventoryTransaction(); |
675 | 735 | inventoryTransaction.setTransactionType(QuantityConstant.INVENTORY_TRANSACTION_RECEIPT); |
... | ... | @@ -687,10 +747,15 @@ public class ReceiptTaskService { |
687 | 747 | inventoryTransaction.setLot(receiptDetail.getLot()); |
688 | 748 | inventoryTransaction.setInventorySts(receiptDetail.getInventorySts()); |
689 | 749 | inventoryTransaction.setTaskQty(receiptQty); |
690 | - if (!inventoryTransactionService.save(inventoryTransaction)) { | |
750 | + /*if (!inventoryTransactionService.save(inventoryTransaction)) { | |
691 | 751 | throw new ServiceException("新增库存记录失败"); |
692 | - } | |
693 | - return receiptQty; | |
752 | + }*/ | |
753 | + inventoryTransactionList.add(inventoryTransaction); | |
754 | + | |
755 | + taskReceiptCompleteDomain.setInventoryDetailList(inventoryDetailList); | |
756 | + taskReceiptCompleteDomain.setInventoryTransactionList(inventoryTransactionList); | |
757 | + taskReceiptCompleteDomain.setTotalQty(taskReceiptCompleteDomain.getTotalQty().add(taskDetail.getQty())); | |
758 | + return taskReceiptCompleteDomain; | |
694 | 759 | } |
695 | 760 | |
696 | 761 | |
... | ... | @@ -707,36 +772,20 @@ public class ReceiptTaskService { |
707 | 772 | * @param inventoryHeader 库存头表 |
708 | 773 | * @return 任务数量 |
709 | 774 | */ |
710 | - private BigDecimal addInventoryDetails(TaskDetail taskDetail, | |
775 | + private TaskReceiptCompleteDomain addInventoryDetails(TaskDetail taskDetail, | |
711 | 776 | BarCodeDetail barCodeDetail, |
712 | - InventoryHeader inventoryHeader,TaskHeader task) { | |
777 | + InventoryHeader inventoryHeader,TaskHeader task,TaskReceiptCompleteDomain taskReceiptCompleteDomain) { | |
778 | +// TaskReceiptCompleteDomain taskReceiptCompleteDomain=new TaskReceiptCompleteDomain(); | |
779 | + List<InventoryDetail> inventoryDetailList=taskReceiptCompleteDomain.getInventoryDetailList(); | |
780 | + List<InventoryTransaction> inventoryTransactionList=taskReceiptCompleteDomain.getInventoryTransactionList(); | |
713 | 781 | String warehouseCode = inventoryHeader.getWarehouseCode(); |
714 | - /*该入库明细是否已存在库存明细记录,已存在更新数量、不存在新增记录*/ | |
715 | -// LambdaQueryWrapper<InventoryDetail> inventory = Wrappers.lambdaQuery(); | |
716 | -// inventory.eq(InventoryDetail::getWarehouseCode, warehouseCode) | |
717 | -// .eq(InventoryDetail::getLocationCode, inventoryHeader.getLocationCode()) | |
718 | -// .eq(InventoryDetail::getMaterialCode, taskDetail.getMaterialCode()) | |
719 | -// .eq(InventoryDetail::getContainerCode, inventoryHeader.getContainerCode()) | |
720 | -// .eq(InventoryDetail::getCompanyCode, taskDetail.getCompanyCode()) | |
721 | -// .eq(InventoryDetail::getBatteryPackTwoCode,taskDetail.getBatteryPackTwoCode()) | |
722 | -// .eq(InventoryDetail::getBarcodeDetailsCode,taskDetail.getBarcodeDetailsCode()) | |
723 | -// .eq(InventoryDetail::getBatch,taskDetail.getBatch()) | |
724 | -// .eq(InventoryDetail::getReceiptDetailId, taskDetail.getBillDetailId()); | |
725 | -// InventoryDetail inventoryDetail = inventoryDetailService.getOne(inventory); | |
782 | + | |
726 | 783 | Material material = materialService.findAllByCode(taskDetail.getMaterialCode(), warehouseCode); |
727 | 784 | // Material material = materialService.findAllByCode(receiptDetail.getMaterialCode(), warehouseCode); |
728 | 785 | /*单位换算*/ |
729 | 786 | BigDecimal receiptQty = taskDetail.getQty(); |
730 | 787 | |
731 | -// if (StringUtils.isNotNull(inventoryDetail)) { | |
732 | -// inventoryDetail.setQty(inventoryDetail.getQty().add(taskDetail.getQty())); | |
733 | -// inventoryDetail.setWeights(inventoryDetail.getWeights().add(taskDetail.getWeights())); | |
734 | -// inventoryDetail.setDayShift(barCodeDetail.getDayShift()); | |
735 | -// inventoryDetail.setRegenerationCode(barCodeDetail.getRegenerationCode()); | |
736 | -// | |
737 | -// // inventoryDetail.setMaterialBatch(); | |
738 | -// } | |
739 | -// else { | |
788 | + | |
740 | 789 | InventoryDetail inventoryDetail = new InventoryDetail(); |
741 | 790 | if(null!=barCodeDetail){ |
742 | 791 | BarCodeHeader barCodeHeader = barCodeHeaderService.getById(barCodeDetail.getReceiptId()); |
... | ... | @@ -788,12 +837,14 @@ public class ReceiptTaskService { |
788 | 837 | one.setTotalWeight(taskDetail.getWeights()+""); |
789 | 838 | inventoryDetail.setInventorySts(taskDetail.getInventorySts()); |
790 | 839 | inventoryHeader.setTotalLines(inventoryHeader.getTotalLines()+1); |
791 | -// } | |
792 | - if (!inventoryDetailService.save(inventoryDetail)) { | |
840 | + | |
841 | + inventoryDetailList.add(inventoryDetail); | |
842 | + /*if (!inventoryDetailService.save(inventoryDetail)) { | |
793 | 843 | throw new ServiceException("保存库存明细失败"); |
794 | - } | |
795 | - inventoryHeader.setTotalQty(inventoryHeader.getTotalQty().add(taskDetail.getQty())); | |
796 | - inventoryHeaderService.updateById(inventoryHeader); | |
844 | + }*/ | |
845 | + /*inventoryHeader.setTotalQty(inventoryHeader.getTotalQty().add(taskDetail.getQty())); | |
846 | + inventoryHeaderService.updateById(inventoryHeader);*/ | |
847 | + | |
797 | 848 | //记录库存交易记录 |
798 | 849 | InventoryTransaction inventoryTransaction = new InventoryTransaction(); |
799 | 850 | inventoryTransaction.setTransactionType(QuantityConstant.INVENTORY_TRANSACTION_RECEIPT); |
... | ... | @@ -809,10 +860,16 @@ public class ReceiptTaskService { |
809 | 860 | inventoryTransaction.setBillDetailId(taskDetail.getBillDetailId()); |
810 | 861 | inventoryTransaction.setBatch(barCodeDetail==null?null:barCodeDetail.getBatch()); |
811 | 862 | inventoryTransaction.setTaskQty(receiptQty); |
812 | - if (!inventoryTransactionService.save(inventoryTransaction)) { | |
863 | + | |
864 | + inventoryTransactionList.add(inventoryTransaction); | |
865 | + | |
866 | + taskReceiptCompleteDomain.setInventoryDetailList(inventoryDetailList); | |
867 | + taskReceiptCompleteDomain.setInventoryTransactionList(inventoryTransactionList); | |
868 | + taskReceiptCompleteDomain.setTotalQty(taskReceiptCompleteDomain.getTotalQty().add(taskDetail.getQty())); | |
869 | + /*if (!inventoryTransactionService.save(inventoryTransaction)) { | |
813 | 870 | throw new ServiceException("新增库存记录失败"); |
814 | - } | |
815 | - return receiptQty; | |
871 | + }*/ | |
872 | + return taskReceiptCompleteDomain; | |
816 | 873 | } |
817 | 874 | |
818 | 875 | |
... | ... |
src/main/resources/templates/receipt/receiptHeader/receiptHeader.html
... | ... | @@ -303,7 +303,7 @@ |
303 | 303 | if (row.firstStatus == 800 && row.lastStatus == 800 && row.receiptType!='CPRK') { |
304 | 304 | actions.push('<a class="btn btn-warning btn-xs ' + receiveFlag + '" href="#" onclick="receive(\''+row.id+'\')"><i class="fa fa-upload"></i>回传</a>'); |
305 | 305 | } |
306 | - if (row.firstStatus === 800 && row.lastStatus < 800) { | |
306 | + if (row.firstStatus >= 200 && row.lastStatus < 800) { | |
307 | 307 | actions.push('<a class="btn btn-danger btn-xs ' + receiveFlag + '" href="#" onclick="completeReceipt(\''+row.id+'\')"><i class="fa fa-upload"></i>提前完成单据</a>'); |
308 | 308 | } |
309 | 309 | return actions.join(''); |
... | ... |