Commit 36f99e0cb29343473e8651842f8df1e486adcce1
Merge remote-tracking branch 'origin/develop' into develop
Showing
5 changed files
with
95 additions
and
3 deletions
src/main/java/com/huaheng/pc/shipment/shipmentDetail/service/ShipmentDetailServiceImpl.java
@@ -151,7 +151,12 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, | @@ -151,7 +151,12 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, | ||
151 | } | 151 | } |
152 | 152 | ||
153 | 153 | ||
154 | - //选中的单据加入波次 | 154 | + /** |
155 | + * 选中的单据加入波次 | ||
156 | + * 根据选中的主单ID和波次主表的code,判断主单之和是否符合波次的限制条件, | ||
157 | + * 看此code的波次是否建成未开始执行,如果是则只需修改波次属性,否则创建新的波次, | ||
158 | + * 修改加入波次的子单,修改子单和主单的状态,并修改子单的waveId | ||
159 | + */ | ||
155 | @Override | 160 | @Override |
156 | @Transactional | 161 | @Transactional |
157 | public void saveWave(String ids, String code) { | 162 | public void saveWave(String ids, String code) { |
@@ -228,14 +233,29 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, | @@ -228,14 +233,29 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, | ||
228 | } | 233 | } |
229 | } | 234 | } |
230 | 235 | ||
231 | - //修改出库子单 | 236 | + //修改出库子单,加入波次ID,并修改状态为波次 |
232 | for(ShipmentDetail shipmentDetail :shipmentDetailList){ | 237 | for(ShipmentDetail shipmentDetail :shipmentDetailList){ |
233 | shipmentDetail.setWaveId(wave.getId()); | 238 | shipmentDetail.setWaveId(wave.getId()); |
239 | + shipmentDetail.setStatus(200); | ||
234 | } | 240 | } |
235 | 241 | ||
236 | flag = this.updateBatchById(shipmentDetailList); | 242 | flag = this.updateBatchById(shipmentDetailList); |
237 | if(flag == false){ | 243 | if(flag == false){ |
238 | throw new ServiceException("出库子单加入波次失败"); | 244 | throw new ServiceException("出库子单加入波次失败"); |
239 | } | 245 | } |
246 | + | ||
247 | + List<ShipmentHeader> shipmentHeaderList=new ArrayList<>(); | ||
248 | + //修改主单状态 | ||
249 | + for (Integer id : Convert.toIntArray(ids)){ | ||
250 | + ShipmentHeader shipmentHeader = shipmentHeaderService.getById(id); | ||
251 | + shipmentHeader.setFirstStatus(200); | ||
252 | + shipmentHeader.setLastStatus(200); | ||
253 | + shipmentHeaderList.add(shipmentHeader); | ||
254 | + } | ||
255 | + flag = shipmentHeaderService.updateBatchById(shipmentHeaderList); | ||
256 | + if(flag == false){ | ||
257 | + throw new ServiceException("修改主单状态失败"); | ||
258 | + } | ||
259 | + | ||
240 | } | 260 | } |
241 | } | 261 | } |
src/main/java/com/huaheng/pc/shipment/shipmentHeader/controller/ShipmentHeaderController.java
@@ -272,6 +272,7 @@ public class ShipmentHeaderController extends BaseController | @@ -272,6 +272,7 @@ public class ShipmentHeaderController extends BaseController | ||
272 | } | 272 | } |
273 | 273 | ||
274 | shipmentDetailService.saveWave(ids,code); | 274 | shipmentDetailService.saveWave(ids,code); |
275 | + | ||
275 | return AjaxResult.success("加入波次成功"); | 276 | return AjaxResult.success("加入波次成功"); |
276 | } | 277 | } |
277 | 278 |
src/main/java/com/huaheng/pc/shipment/wave/controller/WaveController.java
@@ -173,4 +173,20 @@ public class WaveController extends BaseController { | @@ -173,4 +173,20 @@ public class WaveController extends BaseController { | ||
173 | return result; | 173 | return result; |
174 | } | 174 | } |
175 | 175 | ||
176 | + | ||
177 | + /** | ||
178 | + * 开始波次 | ||
179 | + */ | ||
180 | + @RequiresPermissions("shipment:wave:freed") | ||
181 | + @Log(title = "出库-波次", operating = "开始波次", action = BusinessType.UPDATE) | ||
182 | + @PostMapping("/freed") | ||
183 | + @ResponseBody | ||
184 | + public AjaxResult freed(String ids) { | ||
185 | + if (StringUtils.isEmpty(ids)){ | ||
186 | + return AjaxResult.error("id不能为空"); | ||
187 | + } | ||
188 | + AjaxResult result=waveService.freed(ids); | ||
189 | + return result; | ||
190 | + } | ||
191 | + | ||
176 | } | 192 | } |
src/main/java/com/huaheng/pc/shipment/wave/service/WaveService.java
@@ -3,6 +3,7 @@ package com.huaheng.pc.shipment.wave.service; | @@ -3,6 +3,7 @@ package com.huaheng.pc.shipment.wave.service; | ||
3 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 3 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
4 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | 4 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
5 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 5 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
6 | +import com.huaheng.common.exception.service.ServiceException; | ||
6 | import com.huaheng.common.support.Convert; | 7 | import com.huaheng.common.support.Convert; |
7 | import com.huaheng.common.utils.security.ShiroUtils; | 8 | import com.huaheng.common.utils.security.ShiroUtils; |
8 | import com.huaheng.framework.web.domain.AjaxResult; | 9 | import com.huaheng.framework.web.domain.AjaxResult; |
@@ -28,12 +29,28 @@ public class WaveService extends ServiceImpl<WaveMapper, Wave> { | @@ -28,12 +29,28 @@ public class WaveService extends ServiceImpl<WaveMapper, Wave> { | ||
28 | @Autowired | 29 | @Autowired |
29 | private ShipmentContainerHeaderService shipmentContainerHeaderService; | 30 | private ShipmentContainerHeaderService shipmentContainerHeaderService; |
30 | 31 | ||
31 | - //开始波次,对带有此波次号的单据进行后续的后台操作 | 32 | + /** |
33 | + * 开始波次,对带有此波次号的单据进行后续的后台操作 | ||
34 | + * 1、查看波次是否符合开始波次的条件 | ||
35 | + * 2、整合波次的所有子单单据 | ||
36 | + * 3、对每个单据自动组盘,失败则回退 | ||
37 | + * 4、生成任务 | ||
38 | + * 5、修改波次的状态 | ||
39 | + */ | ||
32 | 40 | ||
33 | @Transactional | 41 | @Transactional |
34 | public AjaxResult startWave(String ids) { | 42 | public AjaxResult startWave(String ids) { |
43 | + List<Wave> waves = new ArrayList<>(); | ||
35 | List<ShipmentDetail> list = new ArrayList<>(); | 44 | List<ShipmentDetail> list = new ArrayList<>(); |
36 | for (Integer id : Convert.toIntArray(ids)) { | 45 | for (Integer id : Convert.toIntArray(ids)) { |
46 | + | ||
47 | + //查看此波次的状态,状态不为o时,无法开始波次 | ||
48 | + Wave wave = this.getById(id); | ||
49 | + if(wave == null || wave.getStatus() != 0){ | ||
50 | + return AjaxResult.error("id为"+id+"的波次找不到,或者状态不能做开始操作"); | ||
51 | + } | ||
52 | + waves.add(wave); | ||
53 | + | ||
37 | //找到此波次的单据 | 54 | //找到此波次的单据 |
38 | LambdaQueryWrapper<ShipmentDetail> lam = Wrappers.lambdaQuery(); | 55 | LambdaQueryWrapper<ShipmentDetail> lam = Wrappers.lambdaQuery(); |
39 | lam.eq(ShipmentDetail::getWaveId,id) | 56 | lam.eq(ShipmentDetail::getWaveId,id) |
@@ -52,6 +69,27 @@ public class WaveService extends ServiceImpl<WaveMapper, Wave> { | @@ -52,6 +69,27 @@ public class WaveService extends ServiceImpl<WaveMapper, Wave> { | ||
52 | //生成任务 | 69 | //生成任务 |
53 | shipmentContainerHeaderService.createTask(Arrays.asList(Convert.toIntArray(ajaxResult.getData().toString()))); | 70 | shipmentContainerHeaderService.createTask(Arrays.asList(Convert.toIntArray(ajaxResult.getData().toString()))); |
54 | } | 71 | } |
72 | + | ||
73 | + for(Wave wave : waves){ | ||
74 | + wave.setStatus(400); | ||
75 | + wave.setCurrentWaveStep("生成任务"); | ||
76 | + } | ||
77 | + Boolean flag = this.updateBatchById(waves); | ||
78 | + if(flag == false){ | ||
79 | + throw new ServiceException("波次运行失败,修改波次状态时报错"); | ||
80 | + } | ||
55 | return AjaxResult.success("波次运行成功"); | 81 | return AjaxResult.success("波次运行成功"); |
56 | } | 82 | } |
83 | + | ||
84 | + | ||
85 | + /** | ||
86 | + * 释放波次,执行任务 | ||
87 | + * @param ids | ||
88 | + * @return | ||
89 | + */ | ||
90 | + @Transactional | ||
91 | + public AjaxResult freed(String ids) { | ||
92 | + | ||
93 | + return null; | ||
94 | + } | ||
57 | } | 95 | } |
src/main/resources/templates/shipment/wave/wave.html
@@ -231,6 +231,23 @@ | @@ -231,6 +231,23 @@ | ||
231 | }; | 231 | }; |
232 | localSubmit(url, "post", "json", data); | 232 | localSubmit(url, "post", "json", data); |
233 | } | 233 | } |
234 | + | ||
235 | + | ||
236 | + //释放 | ||
237 | + function freed() { | ||
238 | + var rows = $("#bootstrap-table").bootstrapTable('getSelections'); | ||
239 | + if (rows.length == 0) { | ||
240 | + $.modal.alertWarning("请至少选择一条记录"); | ||
241 | + return; | ||
242 | + } | ||
243 | + var url = prefix + "/freed"; | ||
244 | + var data = { | ||
245 | + "ids": rows.map(function (v) { | ||
246 | + return v.id; | ||
247 | + }).join(',') | ||
248 | + }; | ||
249 | + localSubmit(url, "post", "json", data); | ||
250 | + } | ||
234 | </script> | 251 | </script> |
235 | </body> | 252 | </body> |
236 | </html> | 253 | </html> |
237 | \ No newline at end of file | 254 | \ No newline at end of file |