Commit 9cdc5795246538fb34a322ba5424239c087c5b33
1 parent
0d86cf9f
修改状态
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 | 151 | } |
152 | 152 | |
153 | 153 | |
154 | - //选中的单据加入波次 | |
154 | + /** | |
155 | + * 选中的单据加入波次 | |
156 | + * 根据选中的主单ID和波次主表的code,判断主单之和是否符合波次的限制条件, | |
157 | + * 看此code的波次是否建成未开始执行,如果是则只需修改波次属性,否则创建新的波次, | |
158 | + * 修改加入波次的子单,修改子单和主单的状态,并修改子单的waveId | |
159 | + */ | |
155 | 160 | @Override |
156 | 161 | @Transactional |
157 | 162 | public void saveWave(String ids, String code) { |
... | ... | @@ -228,14 +233,29 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, |
228 | 233 | } |
229 | 234 | } |
230 | 235 | |
231 | - //修改出库子单 | |
236 | + //修改出库子单,加入波次ID,并修改状态为波次 | |
232 | 237 | for(ShipmentDetail shipmentDetail :shipmentDetailList){ |
233 | 238 | shipmentDetail.setWaveId(wave.getId()); |
239 | + shipmentDetail.setStatus(200); | |
234 | 240 | } |
235 | 241 | |
236 | 242 | flag = this.updateBatchById(shipmentDetailList); |
237 | 243 | if(flag == false){ |
238 | 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
src/main/java/com/huaheng/pc/shipment/wave/controller/WaveController.java
... | ... | @@ -173,4 +173,20 @@ public class WaveController extends BaseController { |
173 | 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("/startWave") | |
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 | 3 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
4 | 4 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
5 | 5 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
6 | +import com.huaheng.common.exception.service.ServiceException; | |
6 | 7 | import com.huaheng.common.support.Convert; |
7 | 8 | import com.huaheng.common.utils.security.ShiroUtils; |
8 | 9 | import com.huaheng.framework.web.domain.AjaxResult; |
... | ... | @@ -28,12 +29,28 @@ public class WaveService extends ServiceImpl<WaveMapper, Wave> { |
28 | 29 | @Autowired |
29 | 30 | private ShipmentContainerHeaderService shipmentContainerHeaderService; |
30 | 31 | |
31 | - //开始波次,对带有此波次号的单据进行后续的后台操作 | |
32 | + /** | |
33 | + * 开始波次,对带有此波次号的单据进行后续的后台操作 | |
34 | + * 1、查看波次是否符合开始波次的条件 | |
35 | + * 2、整合波次的所有子单单据 | |
36 | + * 3、对每个单据自动组盘,失败则回退 | |
37 | + * 4、生成任务 | |
38 | + * 5、修改波次的状态 | |
39 | + */ | |
32 | 40 | |
33 | 41 | @Transactional |
34 | 42 | public AjaxResult startWave(String ids) { |
43 | + List<Wave> waves = new ArrayList<>(); | |
35 | 44 | List<ShipmentDetail> list = new ArrayList<>(); |
36 | 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 | 55 | LambdaQueryWrapper<ShipmentDetail> lam = Wrappers.lambdaQuery(); |
39 | 56 | lam.eq(ShipmentDetail::getWaveId,id) |
... | ... | @@ -52,6 +69,27 @@ public class WaveService extends ServiceImpl<WaveMapper, Wave> { |
52 | 69 | //生成任务 |
53 | 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 | 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 | 231 | }; |
232 | 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 | 251 | </script> |
235 | 252 | </body> |
236 | 253 | </html> |
237 | 254 | \ No newline at end of file |
... | ... |