Commit db7c5fca65996f6d2c8ecd773b3208a2af729e61
1 parent
9b3fb0b5
判断此操作是否按找出库流程操作
Showing
3 changed files
with
99 additions
and
5 deletions
src/main/java/com/huaheng/pc/config/shipmentPreference/service/ShipmentPreferenceService.java
... | ... | @@ -2,8 +2,14 @@ package com.huaheng.pc.config.shipmentPreference.service; |
2 | 2 | |
3 | 3 | import com.baomidou.mybatisplus.extension.service.IService; |
4 | 4 | import com.huaheng.pc.config.shipmentPreference.domain.ShipmentPreference; |
5 | +import com.huaheng.pc.shipment.shipmentHeader.domain.ShipmentHeader; | |
6 | + | |
7 | +import java.util.List; | |
5 | 8 | |
6 | 9 | public interface ShipmentPreferenceService extends IService<ShipmentPreference>{ |
7 | 10 | |
8 | 11 | |
12 | + //查看出库此操作是否符合出库首选项的出库流程 | |
13 | + List<ShipmentHeader> checkShipmentProcess(String ids, Integer code); | |
14 | + | |
9 | 15 | } |
... | ... |
src/main/java/com/huaheng/pc/config/shipmentPreference/service/ShipmentPreferenceServiceImpl.java
1 | 1 | package com.huaheng.pc.config.shipmentPreference.service; |
2 | 2 | |
3 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
4 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |
3 | 5 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
6 | +import com.huaheng.common.exception.service.ServiceException; | |
7 | +import com.huaheng.common.support.Convert; | |
8 | +import com.huaheng.common.utils.StringUtils; | |
9 | +import com.huaheng.common.utils.security.ShiroUtils; | |
4 | 10 | import com.huaheng.pc.config.shipmentPreference.domain.ShipmentPreference; |
5 | 11 | import com.huaheng.pc.config.shipmentPreference.mapper.ShipmentPreferenceMapper; |
12 | +import com.huaheng.pc.config.statusFlow.domain.StatusFlowDetail; | |
13 | +import com.huaheng.pc.config.statusFlow.domain.StatusFlowHeader; | |
14 | +import com.huaheng.pc.config.statusFlow.service.StatusFlowDetailService; | |
15 | +import com.huaheng.pc.config.statusFlow.service.StatusFlowHeaderService; | |
16 | +import com.huaheng.pc.shipment.shipmentHeader.domain.ShipmentHeader; | |
17 | +import com.huaheng.pc.shipment.shipmentHeader.service.ShipmentHeaderService; | |
18 | +import org.springframework.beans.factory.annotation.Autowired; | |
6 | 19 | import org.springframework.stereotype.Service; |
7 | 20 | |
21 | +import java.util.ArrayList; | |
22 | +import java.util.List; | |
23 | + | |
8 | 24 | @Service("shipmentPreference") |
9 | 25 | public class ShipmentPreferenceServiceImpl extends ServiceImpl<ShipmentPreferenceMapper, ShipmentPreference> implements ShipmentPreferenceService { |
10 | 26 | |
27 | + @Autowired | |
28 | + private ShipmentPreferenceService shipmentPreferenceService; | |
29 | + @Autowired | |
30 | + private StatusFlowHeaderService statusFlowHeaderService; | |
31 | + @Autowired | |
32 | + private StatusFlowDetailService statusFlowDetailService; | |
33 | + @Autowired | |
34 | + private ShipmentHeaderService shipmentHeaderService; | |
35 | + | |
36 | + | |
37 | + /** | |
38 | + * 1、找出出库首选项 | |
39 | + * 2、查看出库首选项的出库流程 | |
40 | + * 3、找到该状态流的出库流程明细 | |
41 | + * 4、判断单据是否按出库流程操作 | |
42 | + * | |
43 | + * @param ids 出库单id | |
44 | + * @param code 状态流 | |
45 | + * @return | |
46 | + */ | |
47 | + @Override | |
48 | + public List<ShipmentHeader> checkShipmentProcess(String ids, Integer code) { | |
49 | + //查找出库首选项 | |
50 | + ShipmentPreference shipmentPreference = shipmentPreferenceService.list().get(0); | |
51 | + if(shipmentPreference == null){ | |
52 | + throw new ServiceException("系统没有设置出库首选"); | |
53 | + } | |
54 | + if(StringUtils.isEmpty(shipmentPreference.getShippingFlow())){ | |
55 | + throw new ServiceException("出库首选没有绑定出库流程"); | |
56 | + } | |
57 | + | |
58 | + //查看出库流程 | |
59 | + LambdaQueryWrapper<StatusFlowHeader> statusFlowHeaderLam = Wrappers.lambdaQuery(); | |
60 | + statusFlowHeaderLam.eq(StatusFlowHeader::getCode,shipmentPreference.getShippingFlow()) | |
61 | + .eq(StatusFlowHeader::getWarehouseCode, ShiroUtils.getWarehouseCode()); | |
62 | + StatusFlowHeader statusFlowHeader = statusFlowHeaderService.getOne(statusFlowHeaderLam); | |
63 | + if(statusFlowHeader == null){ | |
64 | + throw new ServiceException("出库首选绑定的出库流程不在系统中"); | |
65 | + } | |
66 | + //查看流程明细 | |
67 | + LambdaQueryWrapper<StatusFlowDetail> statusFlowDetailLamb = Wrappers.lambdaQuery(); | |
68 | + statusFlowDetailLamb.eq(StatusFlowDetail::getHeaderId,statusFlowHeader.getId()) | |
69 | + .eq(StatusFlowDetail::getWarehouseCode,ShiroUtils.getWarehouseCode()) | |
70 | + .eq(StatusFlowDetail::getFlowCode,code.toString()); | |
71 | + StatusFlowDetail statusFlowDetail = statusFlowDetailService.getOne(statusFlowDetailLamb); | |
72 | + | |
73 | + List<ShipmentHeader> shipmentHeaderList = new ArrayList<>(); | |
74 | + if(statusFlowDetail != null && statusFlowDetail.getNessary() == 1){ | |
75 | + for (Integer id : Convert.toIntArray(ids)) | |
76 | + { | |
77 | + //判断单据是否按出库流程操作 | |
78 | + ShipmentHeader shipmentHeader = shipmentHeaderService.getById(id); | |
79 | + if(shipmentHeader == null || shipmentHeader.getFirstStatus()<code){ | |
80 | + throw new ServiceException("单据状态不对,此操作不符合出库流程,请按照出库流程出库"); | |
81 | + } | |
82 | + shipmentHeaderList.add(shipmentHeader); | |
83 | + } | |
84 | + } | |
85 | + return shipmentHeaderList; | |
86 | + } | |
11 | 87 | } |
... | ... |
src/main/java/com/huaheng/pc/shipment/shipmentDetail/service/ShipmentDetailServiceImpl.java
... | ... | @@ -10,6 +10,12 @@ import com.huaheng.common.utils.security.ShiroUtils; |
10 | 10 | import com.huaheng.framework.web.domain.AjaxResult; |
11 | 11 | import com.huaheng.pc.config.material.domain.Material; |
12 | 12 | import com.huaheng.pc.config.material.service.MaterialService; |
13 | +import com.huaheng.pc.config.shipmentPreference.domain.ShipmentPreference; | |
14 | +import com.huaheng.pc.config.shipmentPreference.service.ShipmentPreferenceService; | |
15 | +import com.huaheng.pc.config.statusFlow.domain.StatusFlowDetail; | |
16 | +import com.huaheng.pc.config.statusFlow.domain.StatusFlowHeader; | |
17 | +import com.huaheng.pc.config.statusFlow.service.StatusFlowDetailService; | |
18 | +import com.huaheng.pc.config.statusFlow.service.StatusFlowHeaderService; | |
13 | 19 | import com.huaheng.pc.config.waveMaster.domain.WaveMaster; |
14 | 20 | import com.huaheng.pc.config.waveMaster.service.WaveMasterService; |
15 | 21 | import com.huaheng.pc.shipment.shipmentHeader.domain.ShipmentHeader; |
... | ... | @@ -43,6 +49,12 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, |
43 | 49 | private WaveMasterService waveMasterService; |
44 | 50 | @Autowired |
45 | 51 | private WaveService waveService; |
52 | + @Autowired | |
53 | + private ShipmentPreferenceService shipmentPreferenceService; | |
54 | + @Autowired | |
55 | + private StatusFlowHeaderService statusFlowHeaderService; | |
56 | + @Autowired | |
57 | + private StatusFlowDetailService statusFlowDetailService; | |
46 | 58 | |
47 | 59 | /** |
48 | 60 | * 新增出库明细 |
... | ... | @@ -152,6 +164,7 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, |
152 | 164 | |
153 | 165 | |
154 | 166 | /** |
167 | + * 查看选中的单据状态是否符合出库流程 | |
155 | 168 | * 选中的单据加入波次 |
156 | 169 | * 根据选中的主单ID和波次主表的code,判断主单之和是否符合波次的限制条件, |
157 | 170 | * 看此code的波次是否建成未开始执行,如果是则只需修改波次属性,否则创建新的波次, |
... | ... | @@ -160,6 +173,9 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, |
160 | 173 | @Override |
161 | 174 | @Transactional |
162 | 175 | public void saveWave(String ids, String code) { |
176 | + Integer status = 100; | |
177 | + List<ShipmentHeader> shipmentHeaderList =shipmentPreferenceService.checkShipmentProcess(ids,status); | |
178 | + | |
163 | 179 | //找到波次主表,看系统是否有此波次 |
164 | 180 | LambdaQueryWrapper<WaveMaster> lam=Wrappers.lambdaQuery(); |
165 | 181 | lam.eq(WaveMaster::getCode,code) |
... | ... | @@ -248,12 +264,8 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, |
248 | 264 | throw new ServiceException("出库子单加入波次失败"); |
249 | 265 | } |
250 | 266 | |
251 | - List<ShipmentHeader> shipmentHeaderList=new ArrayList<>(); | |
252 | - //修改主单状态 | |
253 | - for (Integer id : Convert.toIntArray(ids)){ | |
254 | - ShipmentHeader shipmentHeader = shipmentHeaderService.getById(id); | |
267 | + for(ShipmentHeader shipmentHeader :shipmentHeaderList){ | |
255 | 268 | shipmentHeader.setLastStatus(200); |
256 | - shipmentHeaderList.add(shipmentHeader); | |
257 | 269 | } |
258 | 270 | flag = shipmentHeaderService.updateBatchById(shipmentHeaderList); |
259 | 271 | if(flag == false){ |
... | ... |