Commit 43ac55c83ea7fd7087edfb51e766622ed28c2fe9
1 parent
70e81aed
不符合流程的操作报错
Showing
5 changed files
with
29 additions
and
12 deletions
src/main/java/com/huaheng/pc/config/shipmentPreference/service/ShipmentPreferenceService.java
... | ... | @@ -10,6 +10,6 @@ public interface ShipmentPreferenceService extends IService<ShipmentPreference>{ |
10 | 10 | |
11 | 11 | |
12 | 12 | //查看出库此操作是否符合出库首选项的出库流程 |
13 | - List<ShipmentHeader> checkShipmentProcess(String ids, Integer code); | |
13 | + List<ShipmentHeader> checkShipmentProcess(String ids, Integer status,String code); | |
14 | 14 | |
15 | 15 | } |
... | ... |
src/main/java/com/huaheng/pc/config/shipmentPreference/service/ShipmentPreferenceServiceImpl.java
... | ... | @@ -45,11 +45,11 @@ public class ShipmentPreferenceServiceImpl extends ServiceImpl<ShipmentPreferenc |
45 | 45 | * 4、判断单据是否按出库流程操作 |
46 | 46 | * |
47 | 47 | * @param ids 出库单id |
48 | - * @param code 状态流 | |
48 | + * @param status 状态流 | |
49 | 49 | * @return |
50 | 50 | */ |
51 | 51 | @Override |
52 | - public List<ShipmentHeader> checkShipmentProcess(String ids, Integer code) { | |
52 | + public List<ShipmentHeader> checkShipmentProcess(String ids, Integer status,String code) { | |
53 | 53 | |
54 | 54 | LambdaQueryWrapper<ConfigValue> configValueLambdaQueryWrapper=Wrappers.lambdaQuery(); |
55 | 55 | configValueLambdaQueryWrapper.eq(ConfigValue::getModuleType,"shipment") |
... | ... | @@ -80,21 +80,33 @@ public class ShipmentPreferenceServiceImpl extends ServiceImpl<ShipmentPreferenc |
80 | 80 | LambdaQueryWrapper<StatusFlowDetail> statusFlowDetailLamb = Wrappers.lambdaQuery(); |
81 | 81 | statusFlowDetailLamb.eq(StatusFlowDetail::getHeaderId,statusFlowHeader.getId()) |
82 | 82 | .eq(StatusFlowDetail::getWarehouseCode,ShiroUtils.getWarehouseCode()) |
83 | - .eq(StatusFlowDetail::getFlowCode,code.toString()); | |
83 | + .eq(StatusFlowDetail::getFlowCode,status.toString()); | |
84 | 84 | StatusFlowDetail statusFlowDetail = statusFlowDetailService.getOne(statusFlowDetailLamb); |
85 | 85 | |
86 | 86 | List<ShipmentHeader> shipmentHeaderList = new ArrayList<>(); |
87 | - if(statusFlowDetail != null && statusFlowDetail.getNessary() == 1){ | |
88 | - for (Integer id : Convert.toIntArray(ids)) | |
89 | - { | |
90 | - //判断单据是否按出库流程操作 | |
91 | - ShipmentHeader shipmentHeader = shipmentHeaderService.getById(id); | |
92 | - if(shipmentHeader == null || shipmentHeader.getFirstStatus()<code){ | |
87 | + if(statusFlowDetail != null && statusFlowDetail.getNessary() == 1) { | |
88 | + if (StringUtils.isNotEmpty(ids)) { | |
89 | + for (Integer id : Convert.toIntArray(ids)) { | |
90 | + //判断单据是否按出库流程操作 | |
91 | + ShipmentHeader shipmentHeader = shipmentHeaderService.getById(id); | |
92 | + if (shipmentHeader == null || shipmentHeader.getFirstStatus() < status) { | |
93 | + throw new ServiceException("单据状态不对,此操作不符合出库流程,请按照出库流程出库"); | |
94 | + } | |
95 | + shipmentHeaderList.add(shipmentHeader); | |
96 | + } | |
97 | + } | |
98 | + else { | |
99 | + LambdaQueryWrapper<ShipmentHeader> lam = Wrappers.lambdaQuery(); | |
100 | + lam.eq(ShipmentHeader::getCode,code) | |
101 | + .eq(ShipmentHeader::getWarehouseCode,ShiroUtils.getWarehouseCode()); | |
102 | + ShipmentHeader shipmentHeader = shipmentHeaderService.getOne(lam); | |
103 | + if (shipmentHeader == null || shipmentHeader.getFirstStatus() < status) { | |
93 | 104 | throw new ServiceException("单据状态不对,此操作不符合出库流程,请按照出库流程出库"); |
94 | 105 | } |
95 | 106 | shipmentHeaderList.add(shipmentHeader); |
96 | 107 | } |
97 | 108 | } |
109 | + | |
98 | 110 | return shipmentHeaderList; |
99 | 111 | } |
100 | 112 | } |
... | ... |
src/main/java/com/huaheng/pc/shipment/shipmentContainerHeader/service/ShipmentContainerHeaderServiceImpl.java
... | ... | @@ -472,7 +472,7 @@ public class ShipmentContainerHeaderServiceImpl extends ServiceImpl<ShipmentCont |
472 | 472 | if(shipmentHeader == null){ |
473 | 473 | throw new ServiceException("系统没有此单据"); |
474 | 474 | } |
475 | - shipmentPreferenceService.checkShipmentProcess(shipmentHeader.getId().toString(),100); | |
475 | + shipmentPreferenceService.checkShipmentProcess(shipmentHeader.getId().toString(),100,shipmentCode); | |
476 | 476 | |
477 | 477 | LambdaQueryWrapper<ShipmentDetail> lambdaQueryWrapper = Wrappers.lambdaQuery(); |
478 | 478 | lambdaQueryWrapper.eq(ShipmentDetail::getShipmentCode, shipmentCode) |
... | ... |
src/main/java/com/huaheng/pc/shipment/shipmentDetail/service/ShipmentDetailServiceImpl.java
... | ... | @@ -174,7 +174,7 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, |
174 | 174 | @Transactional |
175 | 175 | public void saveWave(String ids, String code) { |
176 | 176 | Integer status = 100; |
177 | - List<ShipmentHeader> shipmentHeaderList =shipmentPreferenceService.checkShipmentProcess(ids,status); | |
177 | + List<ShipmentHeader> shipmentHeaderList =shipmentPreferenceService.checkShipmentProcess(ids,status,code); | |
178 | 178 | |
179 | 179 | //找到波次主表,看系统是否有此波次 |
180 | 180 | LambdaQueryWrapper<WaveMaster> lam=Wrappers.lambdaQuery(); |
... | ... |
src/main/java/com/huaheng/pc/shipment/shippingCombination/controller/ShippingCombinationController.java
... | ... | @@ -53,6 +53,8 @@ public class ShippingCombinationController extends BaseController { |
53 | 53 | ShipmentContainerDetailService shipmentContainerDetailService; |
54 | 54 | @Autowired |
55 | 55 | ShipmentHeaderService shipmentHeaderService; |
56 | + @Autowired | |
57 | + ShipmentPreferenceService shipmentPreferenceService; | |
56 | 58 | |
57 | 59 | |
58 | 60 | /** |
... | ... | @@ -65,6 +67,9 @@ public class ShippingCombinationController extends BaseController { |
65 | 67 | @GetMapping() |
66 | 68 | public String ShippingCombination(String shipmentCode, ModelMap map){ |
67 | 69 | map.put("code", shipmentCode); |
70 | + Integer status = 100; | |
71 | + String ids=""; | |
72 | + List<ShipmentHeader> shipmentHeaderList =shipmentPreferenceService.checkShipmentProcess(ids,status,shipmentCode); | |
68 | 73 | return prefix+"/shippingCombination"; |
69 | 74 | } |
70 | 75 | |
... | ... |