Commit 2a87cd0ba8552144fe3ec18f5f134d93220e9cb4
1 parent
974cb270
update
Showing
12 changed files
with
318 additions
and
260 deletions
src/main/java/com/huaheng/HuaHengApplication.java
... | ... | @@ -15,7 +15,7 @@ import org.springframework.context.annotation.Bean; |
15 | 15 | */ |
16 | 16 | @MapperScan({"com.huaheng.pc.**.**.mapper"}) |
17 | 17 | //添加SecurityAutoConfiguration.class,防止报java.lang.ArrayStoreException错 |
18 | -@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class }) | |
18 | +@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class}) | |
19 | 19 | public class HuaHengApplication { |
20 | 20 | |
21 | 21 | @Bean // 此处相当于将undertow server注入到spring-context 中,这里相对于tomcat设置要多此动作 |
... | ... |
src/main/java/com/huaheng/api/mes/controller/MesReceiptController.java
... | ... | @@ -101,7 +101,7 @@ public class MesReceiptController extends BaseController { |
101 | 101 | private static Logger logger = LoggerFactory.getLogger(ReflectUtils.class); |
102 | 102 | |
103 | 103 | @PostMapping("/receipt") |
104 | - @ApiLogger(apiName = "添加入库单及其明细", from="ROBOT") | |
104 | + @ApiLogger(apiName = "添加入库单及其明细", from = "ROBOT") | |
105 | 105 | @ApiOperation("添加入库单及其明细") |
106 | 106 | public AjaxResult receipt(@RequestBody ReceiptDTO receiptDTO) { |
107 | 107 | AjaxResult ajaxResult = handleQuest("receipt", new MultiProcessListener() { |
... | ... | @@ -117,11 +117,12 @@ public class MesReceiptController extends BaseController { |
117 | 117 | |
118 | 118 | /** |
119 | 119 | * 添加出库单及其明细 |
120 | + * | |
120 | 121 | * @param receiptDTO |
121 | 122 | * @return |
122 | 123 | */ |
123 | 124 | @PostMapping("/shipment") |
124 | - @ApiLogger(apiName = "添加出库单及其明细", from="ROBOT") | |
125 | + @ApiLogger(apiName = "添加出库单及其明细", from = "ROBOT") | |
125 | 126 | @ApiOperation("添加出库单及其明细") |
126 | 127 | public AjaxResult shipment(@RequestBody ReceiptDTO receiptDTO) { |
127 | 128 | AjaxResult ajaxResult = handleQuest("shipment", new MultiProcessListener() { |
... | ... | @@ -156,13 +157,14 @@ public class MesReceiptController extends BaseController { |
156 | 157 | |
157 | 158 | /** |
158 | 159 | * 入库单参数_判空处理 |
160 | + * | |
159 | 161 | * @param ajaxResult |
160 | 162 | * @param shipmentHeader |
161 | 163 | * @param shipemtnDetails |
162 | 164 | */ |
163 | - private boolean enterIsNull(AjaxResult ajaxResult, Header shipmentHeader, List<Detail> shipemtnDetails){ | |
165 | + private boolean enterIsNull(AjaxResult ajaxResult, Header shipmentHeader, List<Detail> shipemtnDetails) { | |
164 | 166 | |
165 | - if (isNullData(ajaxResult, shipmentHeader, shipemtnDetails)){ | |
167 | + if (isNullData(ajaxResult, shipmentHeader, shipemtnDetails)) { | |
166 | 168 | return true; |
167 | 169 | } |
168 | 170 | |
... | ... | @@ -172,11 +174,11 @@ public class MesReceiptController extends BaseController { |
172 | 174 | } else if (StringUtils.isEmpty(shipmentHeader.getReferCode())) { |
173 | 175 | ajaxResult.setCode(RetCode.FAIL).setMsg("单据单号不能为空!!!"); |
174 | 176 | return true; |
175 | - }else if (shipmentHeader.getTotalQty() == null || shipmentHeader.getTotalQty().intValue() <= 0) { | |
177 | + } else if (shipmentHeader.getTotalQty() == null || shipmentHeader.getTotalQty().intValue() <= 0) { | |
176 | 178 | ajaxResult.setCode(RetCode.FAIL).setMsg("数量不能为空!!!"); |
177 | 179 | } |
178 | 180 | |
179 | - shipemtnDetails.forEach(shipemtnDetail->{ | |
181 | + shipemtnDetails.forEach(shipemtnDetail -> { | |
180 | 182 | if (StringUtils.isEmpty(shipemtnDetail.getMaterialCode())) { |
181 | 183 | ajaxResult.setCode(RetCode.FAIL).setMsg("物料编码不能为空!!!"); |
182 | 184 | } else if (shipemtnDetail.getTotalQty() == null || shipemtnDetail.getQty().intValue() <= 0) { |
... | ... | @@ -188,12 +190,13 @@ public class MesReceiptController extends BaseController { |
188 | 190 | |
189 | 191 | /** |
190 | 192 | * 出库单参数_判空处理 |
193 | + * | |
191 | 194 | * @param ajaxResult |
192 | 195 | * @param shipmentHeader |
193 | 196 | * @param shipemtnDetails |
194 | 197 | */ |
195 | - private boolean outIsNull (AjaxResult ajaxResult, Header shipmentHeader, List<Detail> shipemtnDetails){ | |
196 | - if (isNullData(ajaxResult, shipmentHeader, shipemtnDetails)){ | |
198 | + private boolean outIsNull(AjaxResult ajaxResult, Header shipmentHeader, List<Detail> shipemtnDetails) { | |
199 | + if (isNullData(ajaxResult, shipmentHeader, shipemtnDetails)) { | |
197 | 200 | return true; |
198 | 201 | } |
199 | 202 | |
... | ... | @@ -202,7 +205,7 @@ public class MesReceiptController extends BaseController { |
202 | 205 | return true; |
203 | 206 | } |
204 | 207 | |
205 | - shipemtnDetails.forEach(shipemtnDetail->{ | |
208 | + shipemtnDetails.forEach(shipemtnDetail -> { | |
206 | 209 | if (StringUtils.isEmpty(shipemtnDetail.getMaterialCode())) { |
207 | 210 | ajaxResult.setCode(RetCode.FAIL).setMsg("物料编码不能为空!!!"); |
208 | 211 | } |
... | ... | @@ -229,7 +232,7 @@ public class MesReceiptController extends BaseController { |
229 | 232 | */ |
230 | 233 | @PostMapping("/cancelEnterWarehouse") |
231 | 234 | @ApiOperation("入库单单据取消") |
232 | - @ApiLogger(apiName = "入库单单据取消", from="ROBOT") | |
235 | + @ApiLogger(apiName = "入库单单据取消", from = "ROBOT") | |
233 | 236 | public AjaxResult cancelEnterWarehouse(@RequestBody ReceiptDTO receiptDTO) { |
234 | 237 | AjaxResult ajaxResult = handleQuest("cancelEnterWarehouse", new MultiProcessListener() { |
235 | 238 | @Override |
... | ... | @@ -247,7 +250,7 @@ public class MesReceiptController extends BaseController { |
247 | 250 | */ |
248 | 251 | @PostMapping("/cancelOutWarehouse") |
249 | 252 | @ApiOperation("出库单单据取消") |
250 | - @ApiLogger(apiName = "出库单单据取消", from="ROBOT") | |
253 | + @ApiLogger(apiName = "出库单单据取消", from = "ROBOT") | |
251 | 254 | public AjaxResult cancelOutWarehouse(@RequestBody ReceiptDTO receiptDTO) { |
252 | 255 | AjaxResult ajaxResult = handleQuest("cancelOutWarehouse", new MultiProcessListener() { |
253 | 256 | @Override |
... | ... | @@ -267,7 +270,7 @@ public class MesReceiptController extends BaseController { |
267 | 270 | ajaxResult.setCode(RetCode.FAIL).setMsg("总数量不能为空!!!"); |
268 | 271 | } |
269 | 272 | }); |
270 | - if (isNull || StringUtils.isNotEmpty(ajaxResult.getMsg())){ | |
273 | + if (isNull || StringUtils.isNotEmpty(ajaxResult.getMsg())) { | |
271 | 274 | return ajaxResult; |
272 | 275 | } |
273 | 276 | return ajaxResult; |
... | ... | @@ -277,37 +280,37 @@ public class MesReceiptController extends BaseController { |
277 | 280 | * 查询库存 |
278 | 281 | */ |
279 | 282 | @PostMapping("/searchInventory") |
280 | - @ApiLogger(apiName = "查询库存", from="ROBOT") | |
283 | + @ApiLogger(apiName = "查询库存", from = "ROBOT") | |
281 | 284 | @ApiOperation("查询库存") |
282 | 285 | public AjaxResult searchInventory(@RequestBody Detail detailed) { |
283 | 286 | |
284 | - String materialName = detailed.getMaterialName(); | |
287 | + String materialName = detailed.getMaterialName(); | |
285 | 288 | String materialCode = detailed.getMaterialCode(); |
286 | 289 | String containerCode = detailed.getContainerCode(); |
287 | 290 | |
288 | 291 | LambdaQueryWrapper<InventoryDetail> lambdaQueryWrapper = Wrappers.lambdaQuery(); |
289 | 292 | // 物料编码 |
290 | - if (StringUtils.isNotEmpty(materialName)){ | |
293 | + if (StringUtils.isNotEmpty(materialName)) { | |
291 | 294 | lambdaQueryWrapper.eq(InventoryDetail::getMaterialName, materialName); |
292 | 295 | } |
293 | 296 | // 物料名称 |
294 | - if (StringUtils.isNotEmpty(materialCode)){ | |
297 | + if (StringUtils.isNotEmpty(materialCode)) { | |
295 | 298 | lambdaQueryWrapper.eq(InventoryDetail::getMaterialCode, materialCode); |
296 | 299 | } |
297 | 300 | // 托盘号 |
298 | - if (StringUtils.isNotEmpty(containerCode)){ | |
301 | + if (StringUtils.isNotEmpty(containerCode)) { | |
299 | 302 | lambdaQueryWrapper.eq(InventoryDetail::getContainerCode, containerCode); |
300 | 303 | } |
301 | 304 | |
302 | - if (StringUtils.isEmpty(materialName) && StringUtils.isEmpty(containerCode) && StringUtils.isEmpty(containerCode)){ | |
305 | + if (StringUtils.isEmpty(materialName) && StringUtils.isEmpty(containerCode) && StringUtils.isEmpty(containerCode)) { | |
303 | 306 | lambdaQueryWrapper.gt(InventoryDetail::getQty, 0); |
304 | 307 | } |
305 | 308 | List<InventoryDetail> detailList = inventoryDetailService.list(lambdaQueryWrapper); |
306 | 309 | |
307 | 310 | List<InventoryVO> inventoryVOList = new ArrayList<>(); |
308 | - detailList.forEach(detail->{ | |
311 | + detailList.forEach(detail -> { | |
309 | 312 | InventoryVO inventoryVO = new InventoryVO(); |
310 | - BeanUtils.copyProperties(detail,inventoryVO); | |
313 | + BeanUtils.copyProperties(detail, inventoryVO); | |
311 | 314 | inventoryVO.setWarehouse("035"); |
312 | 315 | inventoryVOList.add(inventoryVO); |
313 | 316 | }); |
... | ... | @@ -318,14 +321,15 @@ public class MesReceiptController extends BaseController { |
318 | 321 | |
319 | 322 | /** |
320 | 323 | * 获取出入库单明细记录 |
324 | + * | |
321 | 325 | * @return AjaxResult |
322 | 326 | */ |
323 | 327 | @PostMapping("/getShipmentDetail") |
324 | - @ApiLogger(apiName = "获取出入库单明细记录", from="ROBOT") | |
328 | + @ApiLogger(apiName = "获取出入库单明细记录", from = "ROBOT") | |
325 | 329 | @ApiOperation("获取出入库单明细记录") |
326 | 330 | public AjaxResult getShipmentDetail(@RequestBody GetOrderHistoryDTO getOrderHistoryDTO) { |
327 | 331 | |
328 | - if(StringUtils.isEmpty(getOrderHistoryDTO.getEndTime()) || StringUtils.isEmpty(getOrderHistoryDTO.getStartTime())){ | |
332 | + if (StringUtils.isEmpty(getOrderHistoryDTO.getEndTime()) || StringUtils.isEmpty(getOrderHistoryDTO.getStartTime())) { | |
329 | 333 | return AjaxResult.error("开始时间和结束时间不能为空!!!"); |
330 | 334 | } |
331 | 335 | LambdaQueryWrapper<InventoryTransaction> lambdaQueryWrapper = Wrappers.lambdaQuery(); |
... | ... | @@ -347,7 +351,7 @@ public class MesReceiptController extends BaseController { |
347 | 351 | */ |
348 | 352 | @PostMapping("/getMaterial") |
349 | 353 | @ApiOperation("获取外部物料信息") |
350 | - public List<Material> getMaterial(){ | |
354 | + public List<Material> getMaterial() { | |
351 | 355 | List<Material> materialList = new ArrayList<>(); |
352 | 356 | try { |
353 | 357 | // String sql = "SELECT * FROM [dbo].[sys_user] WHERE createTime > (select DATEADD(HOUR,-3,getdate())) AND createTime <= (select GETDATE())"; |
... | ... | @@ -357,7 +361,7 @@ public class MesReceiptController extends BaseController { |
357 | 361 | |
358 | 362 | //DATEDIFF() 函数返回两个日期之间的天数。 |
359 | 363 | |
360 | - String sql="SELECT\n" + | |
364 | + String sql = "SELECT\n" + | |
361 | 365 | "\ta.cinvcode,\n" + |
362 | 366 | "\ta.cinvname,\n" + |
363 | 367 | "\ta.cDefWareHouse,\n" + |
... | ... | @@ -377,13 +381,13 @@ public class MesReceiptController extends BaseController { |
377 | 381 | "\tLEFT JOIN [dbo].[Inventory_extradefine] c ON a.cinvcode= c.cinvcode\n" + |
378 | 382 | "\tLEFT JOIN [dbo].[InventoryClass] d on a.cinvccode= d.cinvccode \n" + |
379 | 383 | "WHERE ( datediff( DAY, a.dSDate, getdate( ) ) = 0 OR a.dModifyDate >= DATEADD( HOUR, - 4, GETDATE( ) ) ) \n" + |
380 | - "\tAND a.cDefWareHouse IN ( '035', '003' ,'001')" ; | |
384 | + "\tAND a.cDefWareHouse IN ( '035', '003' ,'001')"; | |
381 | 385 | |
382 | 386 | ResultSet resultSet = SqlServer.find(sql); |
383 | - if (resultSet == null){ | |
387 | + if (resultSet == null) { | |
384 | 388 | return materialList; |
385 | 389 | } |
386 | - while(resultSet.next()){ | |
390 | + while (resultSet.next()) { | |
387 | 391 | // 字段要与海王表一致 |
388 | 392 | String code = resultSet.getString("cInvCode");//物料编码 |
389 | 393 | String name = resultSet.getString("cInvName");//物料名称 |
... | ... | @@ -428,7 +432,9 @@ public class MesReceiptController extends BaseController { |
428 | 432 | return materialList; |
429 | 433 | } |
430 | 434 | |
431 | - /** 当前时间向推几小时 */ | |
435 | + /** | |
436 | + * 当前时间向推几小时 | |
437 | + */ | |
432 | 438 | public String dateRoll(int ihour) { |
433 | 439 | DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
434 | 440 | // 获取当前时间 |
... | ... | @@ -442,17 +448,17 @@ public class MesReceiptController extends BaseController { |
442 | 448 | /** |
443 | 449 | * 查询站台任务明细列表 |
444 | 450 | */ |
445 | - @ApiLogger(apiName = "查询站台任务明细列表", from="ROBOT") | |
451 | + @ApiLogger(apiName = "查询站台任务明细列表", from = "ROBOT") | |
446 | 452 | @PostMapping("/kanbanInfo") |
447 | 453 | @CrossOrigin |
448 | - public AjaxResult kanbanInfo(@RequestBody TaskDetail taskDetail){ | |
454 | + public AjaxResult kanbanInfo(@RequestBody TaskDetail taskDetail) { | |
449 | 455 | String fromLocation = taskDetail.getFromLocation(); |
450 | 456 | if (StringUtils.isEmpty(fromLocation)) { |
451 | 457 | return AjaxResult.error("站台不能为空!!!"); |
452 | 458 | } |
453 | 459 | LambdaQueryWrapper<TaskDetail> wrapper = Wrappers.lambdaQuery(); |
454 | 460 | wrapper.eq(TaskDetail::getFromLocation, fromLocation) |
455 | - .lt(TaskDetail::getStatus,"100"); | |
461 | + .lt(TaskDetail::getStatus, "100"); | |
456 | 462 | List<TaskDetail> taskDetailList = taskDetailService.list(wrapper); |
457 | 463 | return AjaxResult.success(taskDetailList); |
458 | 464 | } |
... | ... | @@ -462,7 +468,7 @@ public class MesReceiptController extends BaseController { |
462 | 468 | */ |
463 | 469 | //@ApiLogger(apiName = "post调用E_Rd_In(MOM)入库接口", from="ROBOT") |
464 | 470 | @PostMapping("/postE_Rd_In") |
465 | - public ReturnInfo postE_Rd_In(@RequestBody ReceiptDetail receiptDetail){ | |
471 | + public ReturnInfo postE_Rd_In(@RequestBody ReceiptDetail receiptDetail) { | |
466 | 472 | User user = userService.selectUserByEmail(receiptDetail.getLastUpdatedBy()); |
467 | 473 | ReceiptHeader receiptHeader = receiptHeaderService.getById(receiptDetail.getReceiptId()); //59 |
468 | 474 | JSONObject Rd_In_M = new JSONObject(); |
... | ... | @@ -471,8 +477,8 @@ public class MesReceiptController extends BaseController { |
471 | 477 | Rd_In_M.put("cBusType", receiptHeader.getReceiptType()); |
472 | 478 | Rd_In_M.put("TAID", receiptHeader.getTAID()); |
473 | 479 | Rd_In_M.put("FAID", receiptHeader.getFAID()); |
474 | - Rd_In_M.put("UserNo", user.getLoginName()); | |
475 | - Rd_In_M.put("warehouse", receiptHeader.getWarehouse()); | |
480 | + Rd_In_M.put("UserNo", user.getLoginName()); | |
481 | + Rd_In_M.put("warehouse", receiptHeader.getWarehouse()); | |
476 | 482 | |
477 | 483 | JSONArray jsonArray = new JSONArray(); |
478 | 484 | JSONObject Rd_In_S = new JSONObject(); |
... | ... | @@ -509,7 +515,7 @@ public class MesReceiptController extends BaseController { |
509 | 515 | */ |
510 | 516 | //@ApiLogger(apiName = "post调用E_Rd_In(MOM)其他入库接口", from="ROBOT") |
511 | 517 | @PostMapping("/postOther_E_Rd_In") |
512 | - public ReturnInfo postOther_E_Rd_In(@RequestBody List<ReceiptDetail> receiptDetails,ReceiptHeader receiptHeader){ | |
518 | + public ReturnInfo postOther_E_Rd_In(@RequestBody List<ReceiptDetail> receiptDetails, ReceiptHeader receiptHeader) { | |
513 | 519 | OtherReceiptDomain domain = new OtherReceiptDomain(); |
514 | 520 | |
515 | 521 | OtherReceiptHeader receiptHeader1 = new OtherReceiptHeader(); |
... | ... | @@ -552,7 +558,7 @@ public class MesReceiptController extends BaseController { |
552 | 558 | String str = JSONObject.toJSONString(data); |
553 | 559 | |
554 | 560 | JSONObject jsonObject = JSONObject.parseObject(str); |
555 | - return postMOM("E_Rd_In", jsonObject,"其他入库回传"); | |
561 | + return postMOM("E_Rd_In", jsonObject, "其他入库回传"); | |
556 | 562 | } |
557 | 563 | |
558 | 564 | /** |
... | ... | @@ -576,7 +582,7 @@ public class MesReceiptController extends BaseController { |
576 | 582 | String codes = ids.substring(1, ids.length()); |
577 | 583 | String[] headerIdArr = codes.split(","); |
578 | 584 | |
579 | - List<ShipmentHeader> shipmentHeaderList=new ArrayList<>(); | |
585 | + List<ShipmentHeader> shipmentHeaderList = new ArrayList<>(); | |
580 | 586 | List<ShipmentHeaderHistory> list2 = shipmentHeaderHistoryService.list(new LambdaQueryWrapper<ShipmentHeaderHistory>().in(ShipmentHeaderHistory::getCode, headerIdArr)); |
581 | 587 | for (ShipmentHeaderHistory shipmentHeaderHistory : list2) { |
582 | 588 | ShipmentHeader shipmentHeader1 = new ShipmentHeader(); |
... | ... | @@ -658,25 +664,25 @@ public class MesReceiptController extends BaseController { |
658 | 664 | |
659 | 665 | public JSONArray getRd_Out_S(ShipmentHeader shipmentHeader, List<ShipmentDetail> shipmentDetailList) { |
660 | 666 | JSONArray jsonArray = new JSONArray(); |
661 | - shipmentDetailList.forEach(shipmentDetail->{ | |
667 | + shipmentDetailList.forEach(shipmentDetail -> { | |
662 | 668 | JSONObject Rd_Out_S = new JSONObject(); |
663 | 669 | Rd_Out_S.put("MGPK", shipmentHeader.getMOMID()); |
664 | - Rd_Out_S.put("SGPK", shipmentDetail.getMOMID()); | |
665 | - Rd_Out_S.put("SNNO", shipmentDetail.getSNNO()); | |
666 | - Rd_Out_S.put("cInvCode", shipmentDetail.getMaterialCode()); | |
670 | + Rd_Out_S.put("SGPK", shipmentDetail.getMOMID()); | |
671 | + Rd_Out_S.put("SNNO", shipmentDetail.getSNNO()); | |
672 | + Rd_Out_S.put("cInvCode", shipmentDetail.getMaterialCode()); | |
667 | 673 | // 实际入库数量 |
668 | - Rd_Out_S.put("Iquantity", shipmentDetail.getTaskQty()); | |
674 | + Rd_Out_S.put("Iquantity", shipmentDetail.getTaskQty()); | |
669 | 675 | // MOM传入的入库数量 |
670 | - Rd_Out_S.put("iFQuantity", shipmentDetail.getQty()); | |
671 | - Rd_Out_S.put("cwhcode", shipmentDetail.getWarehouseCode()); | |
672 | - Rd_Out_S.put("MOCode", shipmentDetail.getNoticeNo()); | |
673 | - Rd_Out_S.put("ISUrgent", shipmentDetail.getIsUrgent()); | |
674 | - Rd_Out_S.put("updatedBy", shipmentDetail.getLastUpdatedBy()); | |
675 | - Rd_Out_S.put("warehouse", shipmentHeader.getWarehouse()); | |
676 | - Rd_Out_S.put("warehouseName", shipmentHeader.getWarehouseName()); | |
677 | - Rd_Out_S.put("creatorCode", shipmentDetail.getLastUpdatedBy()); | |
678 | - Rd_Out_S.put("creatorName", shipmentDetail.getLastUpdatedByName()); | |
679 | - Rd_Out_S.put("requestedStartDate", shipmentHeader.getRequestedStartDate()); | |
676 | + Rd_Out_S.put("iFQuantity", shipmentDetail.getQty()); | |
677 | + Rd_Out_S.put("cwhcode", shipmentDetail.getWarehouseCode()); | |
678 | + Rd_Out_S.put("MOCode", shipmentDetail.getNoticeNo()); | |
679 | + Rd_Out_S.put("ISUrgent", shipmentDetail.getIsUrgent()); | |
680 | + Rd_Out_S.put("updatedBy", shipmentDetail.getLastUpdatedBy()); | |
681 | + Rd_Out_S.put("warehouse", shipmentHeader.getWarehouse()); | |
682 | + Rd_Out_S.put("warehouseName", shipmentHeader.getWarehouseName()); | |
683 | + Rd_Out_S.put("creatorCode", shipmentDetail.getLastUpdatedBy()); | |
684 | + Rd_Out_S.put("creatorName", shipmentDetail.getLastUpdatedByName()); | |
685 | + Rd_Out_S.put("requestedStartDate", shipmentHeader.getRequestedStartDate()); | |
680 | 686 | jsonArray.add(Rd_Out_S); |
681 | 687 | }); |
682 | 688 | return jsonArray; |
... | ... | @@ -691,20 +697,22 @@ public class MesReceiptController extends BaseController { |
691 | 697 | Rd_Out_M.put("cBusType", shipmentHeader.getShipmentType()); |
692 | 698 | Rd_Out_M.put("TAID", shipmentHeader.getTAID()); |
693 | 699 | Rd_Out_M.put("FAID", shipmentHeader.getFAID()); |
694 | - if (user==null) { | |
700 | + if (user == null) { | |
695 | 701 | Rd_Out_M.put("UserNo", shipmentHeader.getCreatedBy()); |
696 | - }else { | |
697 | - Rd_Out_M.put("UserNo", user.getLoginName()); | |
702 | + } else { | |
703 | + Rd_Out_M.put("UserNo", user.getLoginName()); | |
698 | 704 | } |
699 | - Rd_Out_M.put("warehouse", shipmentHeader.getWarehouse()); | |
700 | - Rd_Out_M.put("cDepCode", "01030101");//部门编码 | |
701 | - Rd_Out_M.put("cWhCode", shipmentHeader.getWarehouse());//仓库编码 | |
705 | + Rd_Out_M.put("warehouse", shipmentHeader.getWarehouse()); | |
706 | + Rd_Out_M.put("cDepCode", "01030101");//部门编码 | |
707 | + Rd_Out_M.put("cWhCode", shipmentHeader.getWarehouse());//仓库编码 | |
702 | 708 | return Rd_Out_M; |
703 | 709 | } |
704 | 710 | |
705 | - /** utf-8 转 GB2312 */ | |
706 | - public String getGB(String action){ | |
707 | - byte [] Rd_Out; //中间用ISO-8859-1过渡 | |
711 | + /** | |
712 | + * utf-8 转 GB2312 | |
713 | + */ | |
714 | + public String getGB(String action) { | |
715 | + byte[] Rd_Out; //中间用ISO-8859-1过渡 | |
708 | 716 | String data = null; |
709 | 717 | try { |
710 | 718 | Rd_Out = action.getBytes("8859_1"); |
... | ... | @@ -717,13 +725,13 @@ public class MesReceiptController extends BaseController { |
717 | 725 | |
718 | 726 | |
719 | 727 | /** |
720 | - * @param action MOM行为 | |
728 | + * @param action MOM行为 | |
721 | 729 | * @param JObject 行为参数 |
722 | 730 | * @return |
723 | 731 | */ |
724 | - public ReturnInfo postMOM(String action, JSONObject JObject, String apiName){ | |
732 | + public ReturnInfo postMOM(String action, JSONObject JObject, String apiName) { | |
725 | 733 | String url = addressService.selectAddress(QuantityConstant.MOM); |
726 | - return CallaMOM.getMsg(action, JObject,apiName,url); | |
734 | + return CallaMOM.getMsg(action, JObject, apiName, url); | |
727 | 735 | } |
728 | 736 | |
729 | 737 | |
... | ... |
src/main/java/com/huaheng/api/wcs/service/warecellAllocation/LocationAllocationServiceImpl.java
... | ... | @@ -137,6 +137,9 @@ public class LocationAllocationServiceImpl implements LocationAllocationService |
137 | 137 | stopWatch.start("bbb"); |
138 | 138 | roadWays.removeAll(removeRoadWays); |
139 | 139 | Collections.shuffle(roadWays); |
140 | + if (roadWays.size()==0) { | |
141 | + return "可能是双伸位巷道保留库位数不够了"; | |
142 | + } | |
140 | 143 | String roadWay = roadWays.get(0); |
141 | 144 | LambdaQueryWrapper<Location> locationLambda = Wrappers.lambdaQuery(); |
142 | 145 | locationLambda.eq(Location::getArea, area). |
... | ... |
src/main/java/com/huaheng/api/wcs/service/warecellAllocation/WarecellAllocationServiceImpl.java
... | ... | @@ -213,6 +213,8 @@ public class WarecellAllocationServiceImpl implements WarecellAllocationService |
213 | 213 | locationTypeCodeList, high, area, roadWays, warehouseCode, containerCode, materialAreaCode); |
214 | 214 | if (StringUtils.isEmpty(locationCode)) { |
215 | 215 | return AjaxResult.error("没有库位可分配"); |
216 | + } else if (locationCode.length()>15) { | |
217 | + return AjaxResult.error(locationCode,"巷道:"+roadWays); | |
216 | 218 | } |
217 | 219 | |
218 | 220 | locationService.updateStatus(locationCode, |
... | ... |
src/main/java/com/huaheng/pc/monitor/job/task/RyTask.java
... | ... | @@ -182,7 +182,7 @@ public class RyTask extends BaseController { |
182 | 182 | .eq(ShipmentHeader::getFirstStatus, QuantityConstant.SHIPMENT_HEADER_COMPLETED) |
183 | 183 | .eq(ShipmentHeader::getLastStatus, QuantityConstant.SHIPMENT_HEADER_COMPLETED) |
184 | 184 | .lt(ShipmentHeader::getPushErrorCount, 2) |
185 | - .eq(ShipmentHeader::getDeleted,0) | |
185 | + .eq(ShipmentHeader::getDeleted, 0) | |
186 | 186 | .eq(ShipmentHeader::getPushSuccessStatus, BigDecimal.ZERO.intValue())); |
187 | 187 | for (ShipmentHeader shipmentHeader : shipmentHeaderList) { |
188 | 188 | //299:其他出库 |
... | ... | @@ -215,7 +215,7 @@ public class RyTask extends BaseController { |
215 | 215 | receiptHeader.setPushErrorCount(receiptHeader.getPushErrorCount() + 1); |
216 | 216 | try { |
217 | 217 | ReturnInfo returnInfo = mesReceiptController.postOther_E_Rd_In(receiptDetailList, receiptHeader); |
218 | - if(returnInfo == null){ | |
218 | + if (returnInfo == null) { | |
219 | 219 | receiptHeader.setErrorMsg("入库回传:接口地址错误或返回为空"); |
220 | 220 | receiptHeader.setPushSuccessStatus(2); |
221 | 221 | receiptHeaderService.updateById(receiptHeader); |
... | ... | @@ -457,89 +457,89 @@ public class RyTask extends BaseController { |
457 | 457 | |
458 | 458 | |
459 | 459 | //回传单据的记录历史单据 |
460 | - public void gcBill(){ | |
460 | + public void gcBill() { | |
461 | 461 | LambdaQueryWrapper<ReceiptHeader> query = Wrappers.lambdaQuery(); |
462 | - query .eq(ReceiptHeader::getFirstStatus,QuantityConstant.RECEIPT_HEADER_RETURN) | |
463 | - .eq(ReceiptHeader::getLastStatus,QuantityConstant.RECEIPT_HEADER_RETURN) | |
464 | - .eq(ReceiptHeader::getPushSuccessStatus,1) | |
462 | + query.eq(ReceiptHeader::getFirstStatus, QuantityConstant.RECEIPT_HEADER_RETURN) | |
463 | + .eq(ReceiptHeader::getLastStatus, QuantityConstant.RECEIPT_HEADER_RETURN) | |
464 | + .eq(ReceiptHeader::getPushSuccessStatus, 1) | |
465 | 465 | .eq(ReceiptHeader::getDeleted, true) |
466 | 466 | .last("LIMIT 1"); |
467 | 467 | List<ReceiptHeader> receiptHeaders = receiptHeaderService.list(query); |
468 | 468 | |
469 | 469 | LambdaQueryWrapper<ShipmentHeader> query1 = Wrappers.lambdaQuery(); |
470 | - query1 .eq(ShipmentHeader::getFirstStatus,QuantityConstant.RECEIPT_HEADER_RETURN) | |
471 | - .eq(ShipmentHeader::getLastStatus,QuantityConstant.RECEIPT_HEADER_RETURN) | |
472 | - .in(ShipmentHeader::getPushSuccessStatus,1,3) //回传成功和提前过账 | |
470 | + query1.eq(ShipmentHeader::getFirstStatus, QuantityConstant.RECEIPT_HEADER_RETURN) | |
471 | + .eq(ShipmentHeader::getLastStatus, QuantityConstant.RECEIPT_HEADER_RETURN) | |
472 | + .in(ShipmentHeader::getPushSuccessStatus, 1, 3) //回传成功和提前过账 | |
473 | 473 | .eq(ShipmentHeader::getDeleted, false) |
474 | 474 | .last("LIMIT 1"); |
475 | 475 | List<ShipmentHeader> shipmentHeaders = shipmentHeaderService.list(query1); |
476 | 476 | |
477 | 477 | for (ReceiptHeader receiptHeader : receiptHeaders) { |
478 | - try{ | |
478 | + try { | |
479 | 479 | //新增入库单历史 |
480 | 480 | receiptHeaderHistoryService.saveById(String.valueOf(receiptHeader.getId()), "回传"); |
481 | 481 | receiptHeader.setDeleted(false); |
482 | 482 | if (!receiptHeaderService.updateById(receiptHeader)) { |
483 | 483 | throw new ServiceException("删除头表失败"); |
484 | 484 | } |
485 | - }catch (Exception e){ | |
485 | + } catch (Exception e) { | |
486 | 486 | e.printStackTrace(); |
487 | 487 | } |
488 | 488 | } |
489 | 489 | |
490 | 490 | for (ShipmentHeader shipmentHeader : shipmentHeaders) { |
491 | - try{ | |
491 | + try { | |
492 | 492 | //新增入库单历史 |
493 | 493 | shipmentHeaderHistoryService.saveById(String.valueOf(shipmentHeader.getId()), "回传"); |
494 | 494 | shipmentHeader.setDeleted(true); |
495 | 495 | if (!shipmentHeaderService.updateById(shipmentHeader)) { |
496 | 496 | throw new ServiceException("删除头表失败"); |
497 | 497 | } |
498 | - }catch (Exception e){ | |
498 | + } catch (Exception e) { | |
499 | 499 | e.printStackTrace(); |
500 | 500 | } |
501 | 501 | |
502 | 502 | } |
503 | 503 | } |
504 | 504 | |
505 | - public void gcBill2(){ | |
505 | + public void gcBill2() { | |
506 | 506 | LambdaQueryWrapper<ReceiptHeader> query = Wrappers.lambdaQuery(); |
507 | - query.eq(ReceiptHeader::getFirstStatus,QuantityConstant.RECEIPT_HEADER_POSTING) | |
508 | - .eq(ReceiptHeader::getLastStatus,QuantityConstant.RECEIPT_HEADER_POSTING) | |
507 | + query.eq(ReceiptHeader::getFirstStatus, QuantityConstant.RECEIPT_HEADER_POSTING) | |
508 | + .eq(ReceiptHeader::getLastStatus, QuantityConstant.RECEIPT_HEADER_POSTING) | |
509 | 509 | .eq(ReceiptHeader::getDeleted, true) |
510 | 510 | .last("LIMIT 1"); |
511 | 511 | List<ReceiptHeader> receiptHeaders = receiptHeaderService.list(query); |
512 | 512 | |
513 | 513 | LambdaQueryWrapper<ShipmentHeader> query1 = Wrappers.lambdaQuery(); |
514 | - query1.eq(ShipmentHeader::getLastStatus,QuantityConstant.SHIPMENT_HEADER_COMPLETED) | |
515 | - .eq(ShipmentHeader::getLastStatus,QuantityConstant.SHIPMENT_HEADER_COMPLETED) | |
514 | + query1.eq(ShipmentHeader::getLastStatus, QuantityConstant.SHIPMENT_HEADER_COMPLETED) | |
515 | + .eq(ShipmentHeader::getLastStatus, QuantityConstant.SHIPMENT_HEADER_COMPLETED) | |
516 | 516 | .eq(ShipmentHeader::getDeleted, false) |
517 | 517 | .last("LIMIT 1"); |
518 | 518 | List<ShipmentHeader> shipmentHeaders = shipmentHeaderService.list(query1); |
519 | 519 | |
520 | 520 | |
521 | 521 | for (ReceiptHeader receiptHeader : receiptHeaders) { |
522 | - try{ | |
522 | + try { | |
523 | 523 | //新增入库单历史 |
524 | 524 | receiptHeaderHistoryService.saveById(String.valueOf(receiptHeader.getId()), "回传"); |
525 | 525 | receiptHeader.setDeleted(false); |
526 | 526 | if (!receiptHeaderService.updateById(receiptHeader)) { |
527 | 527 | throw new ServiceException("删除头表失败"); |
528 | 528 | } |
529 | - }catch (Exception e){ | |
529 | + } catch (Exception e) { | |
530 | 530 | e.printStackTrace(); |
531 | 531 | } |
532 | 532 | } |
533 | 533 | |
534 | 534 | for (ShipmentHeader shipmentHeader : shipmentHeaders) { |
535 | - try{ | |
535 | + try { | |
536 | 536 | //新增入库单历史 |
537 | 537 | shipmentHeaderHistoryService.saveById(String.valueOf(shipmentHeader.getId()), "回传"); |
538 | 538 | shipmentHeader.setDeleted(true); |
539 | 539 | if (!shipmentHeaderService.updateById(shipmentHeader)) { |
540 | 540 | throw new ServiceException("删除头表失败"); |
541 | 541 | } |
542 | - }catch (Exception e){ | |
542 | + } catch (Exception e) { | |
543 | 543 | e.printStackTrace(); |
544 | 544 | } |
545 | 545 | |
... | ... | @@ -547,14 +547,14 @@ public class RyTask extends BaseController { |
547 | 547 | } |
548 | 548 | |
549 | 549 | |
550 | - public void restoreHistoryDate(){ | |
550 | + public void restoreHistoryDate() { | |
551 | 551 | receiptRestore(); |
552 | 552 | shipmentRestore(); |
553 | 553 | } |
554 | 554 | |
555 | - public void receiptRestore(){ | |
555 | + public void receiptRestore() { | |
556 | 556 | LambdaQueryWrapper<ReceiptHeaderHistory> query = Wrappers.lambdaQuery(); |
557 | - query.eq(ReceiptHeaderHistory::getVersion,0) | |
557 | + query.eq(ReceiptHeaderHistory::getVersion, 0) | |
558 | 558 | .orderByAsc(ReceiptHeaderHistory::getId) |
559 | 559 | .last("LIMIT 20"); |
560 | 560 | List<ReceiptHeaderHistory> list = receiptHeaderHistoryService.list(query); |
... | ... | @@ -562,17 +562,17 @@ public class RyTask extends BaseController { |
562 | 562 | Set<String> codes = list.stream().map(ReceiptHeaderHistory::getCode).collect(Collectors.toSet()); |
563 | 563 | |
564 | 564 | LambdaQueryWrapper<ReceiptHeader> query1 = Wrappers.lambdaQuery(); |
565 | - query1.in(ReceiptHeader::getCode,codes); | |
565 | + query1.in(ReceiptHeader::getCode, codes); | |
566 | 566 | List<ReceiptHeader> receiptHeaders = receiptHeaderService.list(query1); |
567 | 567 | |
568 | - HashMap<String,ReceiptHeader> map = new HashMap<>(); | |
568 | + HashMap<String, ReceiptHeader> map = new HashMap<>(); | |
569 | 569 | for (ReceiptHeader receiptHeader : receiptHeaders) { |
570 | - map.put(receiptHeader.getCode(),receiptHeader); | |
570 | + map.put(receiptHeader.getCode(), receiptHeader); | |
571 | 571 | } |
572 | 572 | List<ReceiptHeaderHistory> histories = new ArrayList<>(); |
573 | 573 | for (ReceiptHeaderHistory receiptHeaderHistory : list) { |
574 | 574 | ReceiptHeader receiptHeader = map.get(receiptHeaderHistory.getCode()); |
575 | - if(receiptHeader !=null){ | |
575 | + if (receiptHeader != null) { | |
576 | 576 | receiptHeaderHistory.setLastUpdated(receiptHeader.getLastUpdated()); |
577 | 577 | receiptHeaderHistory.setCreated(receiptHeader.getCreated()); |
578 | 578 | receiptHeaderHistory.setVersion(BigDecimal.ONE.intValue()); |
... | ... | @@ -582,9 +582,9 @@ public class RyTask extends BaseController { |
582 | 582 | receiptHeaderHistoryService.updateBatchById(histories); |
583 | 583 | } |
584 | 584 | |
585 | - public void shipmentRestore(){ | |
585 | + public void shipmentRestore() { | |
586 | 586 | LambdaQueryWrapper<ShipmentHeaderHistory> query = Wrappers.lambdaQuery(); |
587 | - query.eq(ShipmentHeaderHistory::getVersion,0) | |
587 | + query.eq(ShipmentHeaderHistory::getVersion, 0) | |
588 | 588 | .orderByAsc(ShipmentHeaderHistory::getId) |
589 | 589 | .last("LIMIT 20"); |
590 | 590 | List<ShipmentHeaderHistory> shipmentHeaderHistorys = shipmentHeaderHistoryService.list(query); |
... | ... | @@ -592,17 +592,17 @@ public class RyTask extends BaseController { |
592 | 592 | Set<String> codes = shipmentHeaderHistorys.stream().map(ShipmentHeaderHistory::getCode).collect(Collectors.toSet()); |
593 | 593 | |
594 | 594 | LambdaQueryWrapper<ShipmentHeader> query1 = Wrappers.lambdaQuery(); |
595 | - query1.in(ShipmentHeader::getCode,codes); | |
595 | + query1.in(ShipmentHeader::getCode, codes); | |
596 | 596 | List<ShipmentHeader> ShipmentHeaders = shipmentHeaderService.list(query1); |
597 | 597 | |
598 | - HashMap<String,ShipmentHeader> map = new HashMap<>(); | |
598 | + HashMap<String, ShipmentHeader> map = new HashMap<>(); | |
599 | 599 | for (ShipmentHeader shipmentHeader : ShipmentHeaders) { |
600 | - map.put(shipmentHeader.getCode(),shipmentHeader); | |
600 | + map.put(shipmentHeader.getCode(), shipmentHeader); | |
601 | 601 | } |
602 | 602 | List<ShipmentHeaderHistory> histories = new ArrayList<>(); |
603 | 603 | for (ShipmentHeaderHistory shipmentHeaderHistory : shipmentHeaderHistorys) { |
604 | 604 | ShipmentHeader shipmentHeader = map.get(shipmentHeaderHistory.getCode()); |
605 | - if(shipmentHeader !=null){ | |
605 | + if (shipmentHeader != null) { | |
606 | 606 | shipmentHeaderHistory.setLastUpdated(shipmentHeader.getLastUpdated()); |
607 | 607 | shipmentHeaderHistory.setCreated(shipmentHeader.getCreated()); |
608 | 608 | shipmentHeaderHistory.setVersion(BigDecimal.ONE.intValue()); |
... | ... |
src/main/java/com/huaheng/pc/task/taskHeader/controller/LocationContainerController.java
... | ... | @@ -88,22 +88,22 @@ public class LocationContainerController extends BaseController { |
88 | 88 | @RequiresPermissions("task:locationContainer:list") |
89 | 89 | @PostMapping("/list") |
90 | 90 | @ResponseBody |
91 | - public TableDataInfo list(TaskHeader taskHeader, @ApiParam(name="createdBegin",value="类型") String createdBegin,@ApiParam(name="createdEnd",value="类型") String createdEnd) { | |
91 | + public TableDataInfo list(TaskHeader taskHeader, @ApiParam(name = "createdBegin", value = "类型") String createdBegin, @ApiParam(name = "createdEnd", value = "类型") String createdEnd) { | |
92 | 92 | PageDomain pageDomain = TableSupport.buildPageRequest(); |
93 | 93 | Integer pageNum = pageDomain.getPageNum(); |
94 | 94 | Integer pageSize = pageDomain.getPageSize(); |
95 | 95 | String type = StringUtils.isNotBlank(taskHeader.getZoneCode()) ? taskHeader.getZoneCode() : "locationCode"; |
96 | 96 | |
97 | 97 | if (type.equals("containerCode")) { |
98 | - String countSql="containerCode,SUM( CASE WHEN internalTaskType = 100 THEN 1 ELSE 0 END ) AS inQty,SUM( CASE WHEN internalTaskType = 200 THEN 1 ELSE 0 END ) AS outQty,COUNT(*) AS taskQty"; | |
98 | + String countSql = "containerCode,SUM( CASE WHEN internalTaskType = 100 THEN 1 ELSE 0 END ) AS inQty,SUM( CASE WHEN internalTaskType = 200 THEN 1 ELSE 0 END ) AS outQty,COUNT(*) AS taskQty"; | |
99 | 99 | QueryWrapper<TaskHeader> queryWrap = new QueryWrapper<>(); |
100 | 100 | queryWrap |
101 | 101 | .select(countSql) |
102 | 102 | .like(StringUtils.isNotEmpty(taskHeader.getContainerCode()), "containerCode", taskHeader.getContainerCode())//容器 |
103 | 103 | .in("internalTaskType", 100, 200) |
104 | 104 | .groupBy("containerCode") |
105 | - .ge(StringUtils.isNotEmpty(createdBegin), "created", createdBegin) | |
106 | - .le(StringUtils.isNotEmpty(createdEnd), "created", createdEnd) | |
105 | + .ge(StringUtils.isNotEmpty(createdBegin), "completeTime", createdBegin) | |
106 | + .le(StringUtils.isNotEmpty(createdEnd), "completeTime", createdEnd) | |
107 | 107 | .orderByDesc("taskQty"); |
108 | 108 | |
109 | 109 | if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)) { |
... | ... | @@ -116,10 +116,10 @@ public class LocationContainerController extends BaseController { |
116 | 116 | } |
117 | 117 | } |
118 | 118 | |
119 | - List<TaskHeader> list = taskHeaderMapper.selectTaskStats(taskHeader.getToLocation(),createdBegin,createdEnd); | |
119 | + List<TaskHeader> list = taskHeaderMapper.selectTaskStats(taskHeader.getToLocation(), createdBegin, createdEnd); | |
120 | 120 | |
121 | 121 | //PageHelper.startPage(pageNum, pageSize); |
122 | - if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)){ | |
122 | + if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)) { | |
123 | 123 | // 计算起始位置 |
124 | 124 | int startIndex = (pageNum - 1) * pageSize; |
125 | 125 | // 计算需要查询的数量 |
... | ... |
src/main/java/com/huaheng/pc/task/taskHeader/service/CycleCountTaskService.java
... | ... | @@ -37,7 +37,7 @@ import java.util.concurrent.CopyOnWriteArrayList; |
37 | 37 | |
38 | 38 | /** |
39 | 39 | * 盘点服务层 |
40 | - * */ | |
40 | + */ | |
41 | 41 | @Service |
42 | 42 | public class CycleCountTaskService { |
43 | 43 | |
... | ... | @@ -62,9 +62,6 @@ public class CycleCountTaskService { |
62 | 62 | private InventoryDetailService inventoryDetailService; |
63 | 63 | |
64 | 64 | |
65 | - | |
66 | - | |
67 | - | |
68 | 65 | /** |
69 | 66 | * 盘点任务取消 |
70 | 67 | */ |
... | ... | @@ -126,8 +123,8 @@ public class CycleCountTaskService { |
126 | 123 | InventoryHeader inventoryHeader = inventoryHeaderService.getOne(inventoryHeaderLambdaQueryWrapper); |
127 | 124 | Container container = new Container(); |
128 | 125 | container.setStatus(QuantityConstant.STATUS_CONTAINER_EMPTY); |
129 | - if(inventoryHeader != null) { | |
130 | - if(inventoryHeader.getContainerStatus().equals(QuantityConstant.STATUS_CONTAINER_SOME)) { | |
126 | + if (inventoryHeader != null) { | |
127 | + if (inventoryHeader.getContainerStatus().equals(QuantityConstant.STATUS_CONTAINER_SOME)) { | |
131 | 128 | container.setStatus(QuantityConstant.STATUS_CONTAINER_SOME); |
132 | 129 | } |
133 | 130 | } |
... | ... | @@ -141,6 +138,7 @@ public class CycleCountTaskService { |
141 | 138 | |
142 | 139 | /** |
143 | 140 | * 生成单条盘点任务 |
141 | + * | |
144 | 142 | * @param cycleCoutDetailId |
145 | 143 | * @return |
146 | 144 | */ |
... | ... | @@ -149,16 +147,22 @@ public class CycleCountTaskService { |
149 | 147 | /*任务主表中存在库位,在盘点明细中生成任务时,不同的容器生成不同的主任务*/ |
150 | 148 | //校验有没有相同容器正在执行任务. |
151 | 149 | CycleCountDetail cycleCountDetail = cycleCountDetailService.getById(cycleCoutDetailId); |
152 | - if(StringUtils.isNull(cycleCountDetail)){ | |
150 | + if (StringUtils.isNull(cycleCountDetail)) { | |
153 | 151 | return AjaxResult.error("盘点明细ID错误,没有该条明细"); |
154 | 152 | } |
153 | +// List<TaskHeader> list = taskHeaderService.list(new LambdaQueryWrapper<TaskHeader>() | |
154 | +// .ne(TaskHeader::getStatus,100) | |
155 | +// .eq(TaskHeader::getContainerCode, cycleCountDetail.getContainerCode())); | |
156 | +// if (list.size()>0) { | |
157 | +// return AjaxResult.error("该托盘有任务了,请完成了任务再"); | |
158 | +// } | |
155 | 159 | //查出明细的子单 |
156 | 160 | CycleCountDetailChild child = new CycleCountDetailChild(); |
157 | 161 | child.setCycleCountHeadCode(cycleCountDetail.getCycleCountHeadCode()); |
158 | 162 | child.setCycleCountDetailId(cycleCountDetail.getId()); |
159 | 163 | LambdaQueryWrapper<CycleCountDetailChild> childLambdaQueryWrapper = Wrappers.lambdaQuery(child); |
160 | 164 | List<CycleCountDetailChild> childList = cycleCountDetailChildService.list(childLambdaQueryWrapper); |
161 | - if(childList.size() < 1){ | |
165 | + if (childList.size() < 1) { | |
162 | 166 | return AjaxResult.error("盘点明细没有子单"); |
163 | 167 | } |
164 | 168 | Location location = locationService.getLocationByCode( |
... | ... | @@ -166,7 +170,7 @@ public class CycleCountTaskService { |
166 | 170 | /*if(!loc.getStatus().equals(QuantityConstant.STATUS_EMPTY)){ |
167 | 171 | return AjaxResult.error(cycleCountDetail.getLocationCode() + "库位不在空闲状态,请先完成其他任务,操作失败!"); |
168 | 172 | }*/ |
169 | - if(StringUtils.isEmpty(location.getContainerCode())){ | |
173 | + if (StringUtils.isEmpty(location.getContainerCode())) { | |
170 | 174 | return AjaxResult.error(cycleCountDetail.getLocationCode() + "库位中没有容器,操作失败!"); |
171 | 175 | } |
172 | 176 | //生成任务同时锁定库位 |
... | ... | @@ -176,7 +180,7 @@ public class CycleCountTaskService { |
176 | 180 | task.setWarehouseCode(ShiroUtils.getWarehouseCode()); |
177 | 181 | task.setCompanyCode(cycleCountDetail.getCompanyCode()); |
178 | 182 | task.setAllocationHeadId(cycleCountDetail.getId());//明细ID写入主任务 |
179 | - if(location != null) { | |
183 | + if (location != null) { | |
180 | 184 | task.setZoneCode(location.getZoneCode()); |
181 | 185 | } |
182 | 186 | task.setReferenceCode(cycleCountDetail.getCycleCountHeadCode()); //写入盘点主单号 |
... | ... | @@ -191,17 +195,17 @@ public class CycleCountTaskService { |
191 | 195 | task.setCreatedBy(ShiroUtils.getName()); |
192 | 196 | task.setLastUpdatedBy(ShiroUtils.getName()); |
193 | 197 | task.setLastUpdated(new Date()); |
194 | - if(taskHeaderService.save(task)){ | |
198 | + if (taskHeaderService.save(task)) { | |
195 | 199 | //锁定库位状态 |
196 | 200 | locationService.updateStatus(location.getContainerCode(), QuantityConstant.STATUS_LOCATION_LOCK); |
197 | 201 | cycleCountDetail.setTaskHeaderId(task.getId()); //盘点明细修改状态task数据源 |
198 | - }else{ | |
202 | + } else { | |
199 | 203 | throw new ServiceException("盘点任务主表生成失败!"); |
200 | 204 | } |
201 | 205 | |
202 | 206 | //写入任务细表 |
203 | 207 | TaskDetail taskDetail = new TaskDetail(); |
204 | - for(CycleCountDetailChild item: childList){ | |
208 | + for (CycleCountDetailChild item : childList) { | |
205 | 209 | |
206 | 210 | taskDetail.setTaskId(task.getId());//主单ID |
207 | 211 | taskDetail.setTaskType(task.getTaskType()); |
... | ... | @@ -226,7 +230,7 @@ public class CycleCountTaskService { |
226 | 230 | taskDetail.setCreatedBy(ShiroUtils.getName()); |
227 | 231 | taskDetail.setLastUpdated(new Date()); |
228 | 232 | taskDetail.setLastUpdatedBy(ShiroUtils.getName()); |
229 | - if(taskDetailService.save(taskDetail) == false){ | |
233 | + if (taskDetailService.save(taskDetail) == false) { | |
230 | 234 | throw new ServiceException("盘点任务明细生成失败!"); |
231 | 235 | } |
232 | 236 | // 修改子单状态 |
... | ... | @@ -257,7 +261,8 @@ public class CycleCountTaskService { |
257 | 261 | |
258 | 262 | /** |
259 | 263 | * 盘点完成 |
260 | - *盘点有差异完成时状态为105 | |
264 | + * 盘点有差异完成时状态为105 | |
265 | + * | |
261 | 266 | * @param taskHeader |
262 | 267 | * @return |
263 | 268 | */ |
... | ... | @@ -266,6 +271,7 @@ public class CycleCountTaskService { |
266 | 271 | /*盘点完成,传入任务主单,查出任务明细,通过任务明细查找盘点的明细单, |
267 | 272 | 完成任务同时,修改盘点细单和主单的状态,完成后库存锁复位*/ |
268 | 273 | //修改任务主单状态 |
274 | + taskHeader.setCompleteTime(new Date()); | |
269 | 275 | taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); |
270 | 276 | taskHeader.setLastUpdatedBy(ShiroUtils.getName()); //更新用户 |
271 | 277 | taskHeader.setLastUpdated(new Date()); //更新时间 |
... | ... | @@ -293,14 +299,14 @@ public class CycleCountTaskService { |
293 | 299 | cycleCountDetailChild.setCycleCountDetailId(cycleCountDetail.getId()); |
294 | 300 | LambdaQueryWrapper<CycleCountDetailChild> childLambdaQueryWrapper = Wrappers.lambdaQuery(cycleCountDetailChild); |
295 | 301 | List<CycleCountDetailChild> childList = cycleCountDetailChildService.list(childLambdaQueryWrapper); |
296 | - if(childList.size() > 0){ | |
297 | - for (CycleCountDetailChild child : childList){ | |
302 | + if (childList.size() > 0) { | |
303 | + for (CycleCountDetailChild child : childList) { | |
298 | 304 | //判断是否差异状态 |
299 | - if(child.getGapQty().compareTo(BigDecimal.ZERO) != 0){ | |
305 | + if (child.getGapQty().compareTo(BigDecimal.ZERO) != 0) { | |
300 | 306 | difference = true; |
301 | 307 | //有差异 |
302 | 308 | child.setChildStatus(QuantityConstant.CYCLECOUNT_STATUS_DIFFERENCE); |
303 | - }else{ | |
309 | + } else { | |
304 | 310 | //没有差异就是 盘点完成 |
305 | 311 | child.setChildStatus(QuantityConstant.CYCLECOUNT_STATUS_COMPLETED); |
306 | 312 | } |
... | ... | @@ -309,35 +315,35 @@ public class CycleCountTaskService { |
309 | 315 | } |
310 | 316 | //取消库存盘点锁 |
311 | 317 | InventoryHeader inventoryHeader = inventoryHeaderService.getById(cycleCountDetail.getInventoryDetailId()); |
312 | - if(StringUtils.isNotNull(inventoryHeader)){ | |
313 | - inventoryHeader.setLocking(1); | |
314 | - inventoryHeader.setLockRemark(""); | |
315 | - inventoryHeaderService.updateById(inventoryHeader); | |
316 | - //库存明细最后盘点时间 | |
317 | - LambdaQueryWrapper<InventoryDetail> inventoryDetail = Wrappers.lambdaQuery(); | |
318 | - inventoryDetail | |
319 | - .eq(InventoryDetail::getWarehouseCode,inventoryHeader.getWarehouseCode()) | |
320 | - .eq(InventoryDetail::getInventoryHeaderId,inventoryHeader.getId()); | |
321 | - List<InventoryDetail> inventoryDetailList = inventoryDetailService.list(inventoryDetail); | |
322 | - if(inventoryDetailList.size() < 1 ){ | |
323 | - throw new ServiceException("盘点的库存明细错误!"); | |
324 | - } | |
325 | - inventoryDetailList.forEach(i -> i.setLastCycleCountDate(new Date())); | |
326 | - inventoryDetailService.updateBatchById(inventoryDetailList); | |
327 | - } | |
328 | - if (!taskHeaderService.saveOrUpdate(taskHeader) || | |
329 | - !taskDetailService.saveOrUpdateBatch(list) || | |
330 | - !cycleCountDetailChildService.saveOrUpdateBatch(cycChildList) | |
331 | - ) { | |
332 | - throw new ServiceException("盘点任务单据状态更新失败!"); | |
318 | + if (StringUtils.isNotNull(inventoryHeader)) { | |
319 | + inventoryHeader.setLocking(1); | |
320 | + inventoryHeader.setLockRemark(""); | |
321 | + inventoryHeaderService.updateById(inventoryHeader); | |
322 | + //库存明细最后盘点时间 | |
323 | + LambdaQueryWrapper<InventoryDetail> inventoryDetail = Wrappers.lambdaQuery(); | |
324 | + inventoryDetail | |
325 | + .eq(InventoryDetail::getWarehouseCode, inventoryHeader.getWarehouseCode()) | |
326 | + .eq(InventoryDetail::getInventoryHeaderId, inventoryHeader.getId()); | |
327 | + List<InventoryDetail> inventoryDetailList = inventoryDetailService.list(inventoryDetail); | |
328 | + if (inventoryDetailList.size() < 1) { | |
329 | + throw new ServiceException("盘点的库存明细错误!"); | |
333 | 330 | } |
331 | + inventoryDetailList.forEach(i -> i.setLastCycleCountDate(new Date())); | |
332 | + inventoryDetailService.updateBatchById(inventoryDetailList); | |
333 | + } | |
334 | + if (!taskHeaderService.saveOrUpdate(taskHeader) || | |
335 | + !taskDetailService.saveOrUpdateBatch(list) || | |
336 | + !cycleCountDetailChildService.saveOrUpdateBatch(cycChildList) | |
337 | + ) { | |
338 | + throw new ServiceException("盘点任务单据状态更新失败!"); | |
334 | 339 | } |
340 | + } | |
335 | 341 | |
336 | 342 | //盘点明细状态 |
337 | - if(difference){ | |
343 | + if (difference) { | |
338 | 344 | //有差异 |
339 | 345 | cycleCountDetail.setEnableStatus(QuantityConstant.CYCLECOUNT_STATUS_DIFFERENCE); |
340 | - }else { | |
346 | + } else { | |
341 | 347 | cycleCountDetail.setEnableStatus(QuantityConstant.CYCLECOUNT_STATUS_COMPLETED); |
342 | 348 | } |
343 | 349 | cycleCountDetail.setCompletedBy(taskHeader.getCreatedBy()); |
... | ... | @@ -354,18 +360,4 @@ public class CycleCountTaskService { |
354 | 360 | } |
355 | 361 | |
356 | 362 | |
357 | - | |
358 | - | |
359 | - | |
360 | - | |
361 | - | |
362 | - | |
363 | - | |
364 | - | |
365 | - | |
366 | - | |
367 | - | |
368 | - | |
369 | - | |
370 | - | |
371 | 363 | } |
... | ... |
src/main/java/com/huaheng/pc/task/taskHeader/service/ReceiptTaskService.java
... | ... | @@ -587,7 +587,7 @@ public class ReceiptTaskService { |
587 | 587 | receiptHeader.setPushSuccessStatus(2);//单据回传失败 |
588 | 588 | taskHeader.setBackMoM(3);//3回传失败 |
589 | 589 | taskHeader.setPushErrorCount(taskHeader.getPushErrorCount() + 1); |
590 | - }else{ | |
590 | + } else { | |
591 | 591 | if (returnInfo.hasError()) { |
592 | 592 | BigDecimal pushQty = receiptHeader.getPushQty().add(taskDetail.getQty()); |
593 | 593 | receiptHeader.setPushQty(pushQty); |
... | ... |
src/main/java/com/huaheng/pc/task/taskHeader/service/TransferTaskService.java
... | ... | @@ -28,6 +28,7 @@ import org.springframework.transaction.annotation.Transactional; |
28 | 28 | import javax.annotation.Resource; |
29 | 29 | import java.math.BigDecimal; |
30 | 30 | import java.util.ArrayList; |
31 | +import java.util.Date; | |
31 | 32 | import java.util.List; |
32 | 33 | import java.util.stream.Collectors; |
33 | 34 | |
... | ... | @@ -54,8 +55,9 @@ public class TransferTaskService { |
54 | 55 | |
55 | 56 | /** |
56 | 57 | * 创建立库移库任务 |
58 | + * | |
57 | 59 | * @param sourceLocationCode 源库位 |
58 | - * @param desLocationCode 目的库位 | |
60 | + * @param desLocationCode 目的库位 | |
59 | 61 | * @return |
60 | 62 | */ |
61 | 63 | @Transactional(rollbackFor = Exception.class) |
... | ... | @@ -93,19 +95,19 @@ public class TransferTaskService { |
93 | 95 | if (taskHeaderService.getUncompleteTaskInNear(desLocation) > 0) { |
94 | 96 | return AjaxResult.error("目标库位:" + desLocationCode + "旁边存在任务,请完成任务以后再分配"); |
95 | 97 | } |
96 | - if(!sourceLocation.getRoadway().equals(desLocation.getRoadway())) { | |
98 | + if (!sourceLocation.getRoadway().equals(desLocation.getRoadway())) { | |
97 | 99 | return AjaxResult.error("目标库位和源库位不在同一个巷道"); |
98 | 100 | } |
99 | 101 | |
100 | - if(!sourceLocation.getHigh().equals(desLocation.getHigh())) { | |
102 | + if (!sourceLocation.getHigh().equals(desLocation.getHigh())) { | |
101 | 103 | return AjaxResult.error("目标库位和源库位高度不一样"); |
102 | 104 | } |
103 | 105 | |
104 | - if(!sourceLocation.getLocationType().equals(desLocation.getLocationType())) { | |
106 | + if (!sourceLocation.getLocationType().equals(desLocation.getLocationType())) { | |
105 | 107 | return AjaxResult.error("目标库位和源库位库位类型不一样"); |
106 | 108 | } |
107 | 109 | |
108 | - if(!sourceLocation.getArea().equals(desLocation.getArea())) { | |
110 | + if (!sourceLocation.getArea().equals(desLocation.getArea())) { | |
109 | 111 | return AjaxResult.error("目标库位和源库位不在同一个区域"); |
110 | 112 | } |
111 | 113 | |
... | ... | @@ -114,16 +116,16 @@ public class TransferTaskService { |
114 | 116 | container.setLastStatus(container.getStatus()); |
115 | 117 | containerService.updateById(container); |
116 | 118 | |
117 | - if(sourceLocation.getRowFlag() == QuantityConstant.ROW_OUT) { | |
119 | + if (sourceLocation.getRowFlag() == QuantityConstant.ROW_OUT) { | |
118 | 120 | Location location1 = locationService.getNear(sourceLocation); //内侧库位 |
119 | 121 | String locationCode = location1.getCode(); |
120 | - if(StringUtils.isNotEmpty(location1.getContainerCode())) { | |
122 | + if (StringUtils.isNotEmpty(location1.getContainerCode())) { | |
121 | 123 | LambdaQueryWrapper<TaskHeader> taskHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(); |
122 | 124 | taskHeaderLambdaQueryWrapper.eq(TaskHeader::getFromLocation, locationCode) |
123 | 125 | .eq(TaskHeader::getWarehouseCode, warehouseCode) |
124 | 126 | .lt(TaskHeader::getStatus, QuantityConstant.TASK_STATUS_COMPLETED); |
125 | 127 | TaskHeader taskHeader = taskHeaderService.getOne(taskHeaderLambdaQueryWrapper); |
126 | - if(taskHeader != null) { | |
128 | + if (taskHeader != null) { | |
127 | 129 | preTaskNo = taskHeader.getId(); |
128 | 130 | } else { |
129 | 131 | return AjaxResult.error("源库位:" + sourceLocationCode + "旁边库位有托盘无法移库"); |
... | ... | @@ -134,7 +136,7 @@ public class TransferTaskService { |
134 | 136 | .eq(TaskHeader::getWarehouseCode, warehouseCode) |
135 | 137 | .lt(TaskHeader::getStatus, QuantityConstant.TASK_STATUS_COMPLETED); |
136 | 138 | TaskHeader taskHeader = taskHeaderService.getOne(taskHeaderLambdaQueryWrapper); |
137 | - if(taskHeader != null) { | |
139 | + if (taskHeader != null) { | |
138 | 140 | return AjaxResult.error("源库位:" + sourceLocationCode + "旁边库位有任务无法移库"); |
139 | 141 | } |
140 | 142 | } |
... | ... | @@ -167,7 +169,8 @@ public class TransferTaskService { |
167 | 169 | taskDetail.setTaskId(taskHeader.getId()); |
168 | 170 | taskDetail.setTaskType(taskHeader.getTaskType()); |
169 | 171 | taskDetail.setInternalTaskType(taskHeader.getInternalTaskType()); |
170 | - taskDetail.setWarehouseCode(taskHeader.getWarehouseCode());; | |
172 | + taskDetail.setWarehouseCode(taskHeader.getWarehouseCode()); | |
173 | + ; | |
171 | 174 | taskDetail.setCompanyCode(inventoryDetail.getCompanyCode()); |
172 | 175 | taskDetail.setMaterialCode(inventoryDetail.getMaterialCode()); |
173 | 176 | taskDetail.setMaterialName(inventoryDetail.getMaterialName()); |
... | ... | @@ -201,9 +204,11 @@ public class TransferTaskService { |
201 | 204 | |
202 | 205 | /** |
203 | 206 | * 完成移库任务 |
207 | + * | |
204 | 208 | * @param taskHeader |
205 | 209 | */ |
206 | 210 | public AjaxResult completeTransferTask(TaskHeader taskHeader) { |
211 | + taskHeader.setCompleteTime(new Date()); | |
207 | 212 | taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); |
208 | 213 | List<TaskDetail> taskDetailList = taskDetailService.findByTaskId(taskHeader.getId()); |
209 | 214 | /* 库存头表id*/ |
... | ... | @@ -251,25 +256,25 @@ public class TransferTaskService { |
251 | 256 | inventoryTransaction.setTransactionType(QuantityConstant.INVENTORY_TRANSACTION_TRANSFEROUT); |
252 | 257 | inventoryTransactionService.save(inventoryTransaction); |
253 | 258 | } |
254 | - if (taskDetailList.size() != 0 ){ | |
259 | + if (taskDetailList.size() != 0) { | |
255 | 260 | taskDetailService.saveOrUpdateBatch(taskDetailList); |
256 | 261 | } |
257 | 262 | if (!taskHeaderService.saveOrUpdate(taskHeader)) { |
258 | 263 | throw new ServiceException("任务单据状态更新失败!"); |
259 | 264 | } |
260 | - if(inventoryDetail != null) { | |
265 | + if (inventoryDetail != null) { | |
261 | 266 | containerService.updateLocationCodeAndStatus(taskHeader.getContainerCode(), |
262 | 267 | taskHeader.getToLocation(), QuantityConstant.STATUS_CONTAINER_SOME, warehouseCode); |
263 | 268 | } else { |
264 | 269 | Container container = containerService.getContainerByCode(taskHeader.getContainerCode()); |
265 | - if(container.getLastStatus().equalsIgnoreCase(QuantityConstant.STATUS_CONTAINER_MANY)) { | |
270 | + if (container.getLastStatus().equalsIgnoreCase(QuantityConstant.STATUS_CONTAINER_MANY)) { | |
266 | 271 | //恢复托盘组的状态 |
267 | 272 | containerService.updateLocationCodeAndStatus(taskHeader.getContainerCode(), |
268 | 273 | taskHeader.getToLocation(), QuantityConstant.STATUS_CONTAINER_MANY, warehouseCode); |
269 | 274 | container = containerService.getContainerByCode(taskHeader.getContainerCode()); |
270 | 275 | container.setLastStatus(QuantityConstant.EMPTY_STRING); |
271 | 276 | containerService.updateById(container); |
272 | - }else { | |
277 | + } else { | |
273 | 278 | containerService.updateLocationCodeAndStatus(taskHeader.getContainerCode(), |
274 | 279 | taskHeader.getToLocation(), QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode); |
275 | 280 | } |
... | ... |
src/main/java/com/huaheng/pc/task/taskHeader/service/WorkTaskService.java
... | ... | @@ -38,11 +38,13 @@ import org.springframework.transaction.annotation.Transactional; |
38 | 38 | import javax.annotation.Resource; |
39 | 39 | import java.math.BigDecimal; |
40 | 40 | import java.util.ArrayList; |
41 | +import java.util.Date; | |
41 | 42 | import java.util.List; |
42 | 43 | import java.util.stream.Collectors; |
43 | 44 | |
44 | 45 | /** |
45 | 46 | * 工作任务 |
47 | + * | |
46 | 48 | * @author mahua |
47 | 49 | */ |
48 | 50 | @Service |
... | ... | @@ -71,17 +73,18 @@ public class WorkTaskService { |
71 | 73 | |
72 | 74 | /** |
73 | 75 | * 创建入库任务 |
74 | - * @param containerCode 容器编码 | |
76 | + * | |
77 | + * @param containerCode 容器编码 | |
75 | 78 | * @param destinationLocation 目标库位,目标库位为空时自动分配 |
76 | 79 | * @return |
77 | 80 | */ |
78 | 81 | @Transactional(rollbackFor = Exception.class) |
79 | - public AjaxResult createEmptyIn(String containerCode, String destinationLocation){ | |
82 | + public AjaxResult createEmptyIn(String containerCode, String destinationLocation) { | |
80 | 83 | Container container = containerService.getContainerByCode(containerCode); |
81 | - if(StringUtils.isNull(container)) { | |
84 | + if (StringUtils.isNull(container)) { | |
82 | 85 | return AjaxResult.error("容器不存在"); |
83 | 86 | } |
84 | - if (StringUtils.isNotEmpty(container.getLocationCode())) { | |
87 | + if (StringUtils.isNotEmpty(container.getLocationCode())) { | |
85 | 88 | return AjaxResult.error("容器已在库位" + container.getLocationCode() + "上"); |
86 | 89 | } |
87 | 90 | |
... | ... | @@ -91,13 +94,12 @@ public class WorkTaskService { |
91 | 94 | return AjaxResult.error("目标库位不存在"); |
92 | 95 | } |
93 | 96 | if (StringUtils.isNotEmpty(location.getContainerCode())) { |
94 | - return AjaxResult.error(destinationLocation+"上已存在容器"+location.getContainerCode()); | |
97 | + return AjaxResult.error(destinationLocation + "上已存在容器" + location.getContainerCode()); | |
95 | 98 | } |
96 | 99 | if (!QuantityConstant.STATUS_LOCATION_EMPTY.equals(location.getStatus())) { |
97 | 100 | return AjaxResult.error("目标库位非空闲"); |
98 | 101 | } |
99 | - } | |
100 | - else { | |
102 | + } else { | |
101 | 103 | List<ReceiptPreference> receiptPreferences = preferenceService.list(); |
102 | 104 | if (receiptPreferences.isEmpty()) { |
103 | 105 | return AjaxResult.error("入库首选项不存在"); |
... | ... | @@ -111,7 +113,7 @@ public class WorkTaskService { |
111 | 113 | return AjaxResult.error("首选项绑定的空库位规则不存在"); |
112 | 114 | } |
113 | 115 | QueryWrapper<Location> queryWrapper = new QueryWrapper<>(); |
114 | - queryWrapper.eq("1",1).last(filterConfigDetail.getStatement()); | |
116 | + queryWrapper.eq("1", 1).last(filterConfigDetail.getStatement()); | |
115 | 117 | Location location = locationService.getOne(queryWrapper); |
116 | 118 | if (StringUtils.isNull(location)) { |
117 | 119 | return AjaxResult.error("没有库位可分配"); |
... | ... | @@ -124,7 +126,7 @@ public class WorkTaskService { |
124 | 126 | LambdaQueryWrapper<TaskHeader> headerQueryWrapper = Wrappers.lambdaQuery(); |
125 | 127 | headerQueryWrapper.ne(TaskHeader::getStatus, QuantityConstant.TASK_STATUS_COMPLETED) |
126 | 128 | .eq(TaskHeader::getContainerCode, containerCode); |
127 | - if (taskHeaderService.count(headerQueryWrapper) > 0) { | |
129 | + if (taskHeaderService.count(headerQueryWrapper) > 0) { | |
128 | 130 | return AjaxResult.error("容器已存在任务"); |
129 | 131 | } |
130 | 132 | |
... | ... | @@ -146,15 +148,15 @@ public class WorkTaskService { |
146 | 148 | taskHeader.setTaskType(QuantityConstant.TASK_TYPE_EMPTYRECEIPT); |
147 | 149 | taskHeader.setInternalTaskType(QuantityConstant.TASK_INTENERTYPE_RECEIPT); |
148 | 150 | Location location = locationService.getLocationByCode(destinationLocation); |
149 | - if(location != null) { | |
151 | + if (location != null) { | |
150 | 152 | taskHeader.setZoneCode(location.getZoneCode()); |
151 | 153 | } |
152 | 154 | taskHeader.setContainerCode(containerCode); |
153 | 155 | taskHeader.setToLocation(destinationLocation); |
154 | 156 | taskHeader.setStatus(QuantityConstant.TASK_STATUS_BUILD); |
155 | - if(taskHeaderService.save(taskHeader)){ | |
157 | + if (taskHeaderService.save(taskHeader)) { | |
156 | 158 | //锁定库位状态 |
157 | - if(StringUtils.isNotEmpty(destinationLocation)) { | |
159 | + if (StringUtils.isNotEmpty(destinationLocation)) { | |
158 | 160 | locationService.updateStatus(destinationLocation, QuantityConstant.STATUS_LOCATION_LOCK); |
159 | 161 | } |
160 | 162 | } else { |
... | ... | @@ -170,17 +172,18 @@ public class WorkTaskService { |
170 | 172 | |
171 | 173 | /** |
172 | 174 | * 创建入库任务 |
173 | - * @param containerCode 容器编码 | |
175 | + * | |
176 | + * @param containerCode 容器编码 | |
174 | 177 | * @param destinationLocation 目标库位,目标库位为空时自动分配 |
175 | 178 | * @return |
176 | 179 | */ |
177 | 180 | @Transactional(rollbackFor = Exception.class) |
178 | - public AjaxResult createManyEmptyIn(String containerCode, String destinationLocation, String warehouseCode){ | |
181 | + public AjaxResult createManyEmptyIn(String containerCode, String destinationLocation, String warehouseCode) { | |
179 | 182 | Container container = containerService.getContainerByCode(containerCode, warehouseCode); |
180 | - if(StringUtils.isNull(container)) { | |
183 | + if (StringUtils.isNull(container)) { | |
181 | 184 | return AjaxResult.error("容器不存在"); |
182 | 185 | } |
183 | - if (StringUtils.isNotEmpty(container.getLocationCode())) { | |
186 | + if (StringUtils.isNotEmpty(container.getLocationCode())) { | |
184 | 187 | return AjaxResult.error("容器已在库位" + container.getLocationCode() + "上"); |
185 | 188 | } |
186 | 189 | |
... | ... | @@ -190,7 +193,7 @@ public class WorkTaskService { |
190 | 193 | return AjaxResult.error("目标库位不存在"); |
191 | 194 | } |
192 | 195 | if (StringUtils.isNotEmpty(location.getContainerCode())) { |
193 | - return AjaxResult.error(destinationLocation+"上已存在容器"+location.getContainerCode()); | |
196 | + return AjaxResult.error(destinationLocation + "上已存在容器" + location.getContainerCode()); | |
194 | 197 | } |
195 | 198 | if (!QuantityConstant.STATUS_LOCATION_EMPTY.equals(location.getStatus())) { |
196 | 199 | return AjaxResult.error("目标库位非空闲"); |
... | ... | @@ -201,7 +204,7 @@ public class WorkTaskService { |
201 | 204 | LambdaQueryWrapper<TaskHeader> headerQueryWrapper = Wrappers.lambdaQuery(); |
202 | 205 | headerQueryWrapper.ne(TaskHeader::getStatus, QuantityConstant.TASK_STATUS_COMPLETED) |
203 | 206 | .eq(TaskHeader::getContainerCode, containerCode); |
204 | - if (taskHeaderService.count(headerQueryWrapper) > 0) { | |
207 | + if (taskHeaderService.count(headerQueryWrapper) > 0) { | |
205 | 208 | return AjaxResult.error("容器已存在任务"); |
206 | 209 | } |
207 | 210 | |
... | ... | @@ -223,13 +226,13 @@ public class WorkTaskService { |
223 | 226 | taskHeader.setTaskType(QuantityConstant.TASK_TYPE_MANY_EMPTYRECEIPT); |
224 | 227 | taskHeader.setInternalTaskType(QuantityConstant.TASK_INTENERTYPE_RECEIPT); |
225 | 228 | Location location = locationService.getLocationByCode(destinationLocation, warehouseCode); |
226 | - if(location != null) { | |
229 | + if (location != null) { | |
227 | 230 | taskHeader.setZoneCode(location.getZoneCode()); |
228 | 231 | } |
229 | 232 | taskHeader.setContainerCode(containerCode); |
230 | 233 | taskHeader.setToLocation(destinationLocation); |
231 | 234 | taskHeader.setStatus(QuantityConstant.TASK_STATUS_BUILD); |
232 | - if(!taskHeaderService.save(taskHeader)){ | |
235 | + if (!taskHeaderService.save(taskHeader)) { | |
233 | 236 | throw new ServiceException("空托入库主表生成失败!"); |
234 | 237 | } |
235 | 238 | //锁库位 |
... | ... | @@ -241,22 +244,23 @@ public class WorkTaskService { |
241 | 244 | |
242 | 245 | /** |
243 | 246 | * 创建入库任务 |
247 | + * | |
244 | 248 | * @param firstContainerCode 容器编码 |
245 | - * @param number 数量 | |
249 | + * @param number 数量 | |
246 | 250 | * @return |
247 | 251 | */ |
248 | 252 | @Transactional(rollbackFor = Exception.class) |
249 | - public AjaxResult createBatchEmptyIn(String firstContainerCode, Integer number){ | |
253 | + public AjaxResult createBatchEmptyIn(String firstContainerCode, Integer number) { | |
250 | 254 | List<String> containerCodeList = new ArrayList<>(); |
251 | 255 | List<TaskHeader> taskHeaderList = new ArrayList<>(); |
252 | - for(int i=0; i < number; i++) { | |
256 | + for (int i = 0; i < number; i++) { | |
253 | 257 | int length = firstContainerCode.length(); |
254 | 258 | String code = firstContainerCode.substring(1, length); |
255 | 259 | int count = Integer.parseInt(code) + i; |
256 | - String contrainerCode = firstContainerCode.substring(0,1) + String.format("%05d", count); | |
260 | + String contrainerCode = firstContainerCode.substring(0, 1) + String.format("%05d", count); | |
257 | 261 | containerCodeList.add(contrainerCode); |
258 | 262 | } |
259 | - for(String containerCode : containerCodeList) { | |
263 | + for (String containerCode : containerCodeList) { | |
260 | 264 | Container container = containerService.getContainerByCode(containerCode); |
261 | 265 | if (StringUtils.isNull(container)) { |
262 | 266 | return AjaxResult.error("容器不存在"); |
... | ... | @@ -309,9 +313,10 @@ public class WorkTaskService { |
309 | 313 | /** |
310 | 314 | * 创建空托出库任务 |
311 | 315 | * 容器编码与源库位只需要填一个 |
312 | - * @param containerCode 容器编码 | |
316 | + * | |
317 | + * @param containerCode 容器编码 | |
313 | 318 | * @param sourceLocation 源库位 |
314 | - * @param port 出库口 | |
319 | + * @param port 出库口 | |
315 | 320 | * @return |
316 | 321 | */ |
317 | 322 | @Transactional |
... | ... | @@ -324,10 +329,10 @@ public class WorkTaskService { |
324 | 329 | if (StringUtils.isNotEmpty(containerCode)) { |
325 | 330 | Container container = containerService.getContainerByCode(containerCode, warehouseCode); |
326 | 331 | if (StringUtils.isNull(container)) { |
327 | - return AjaxResult.error(containerCode+"容器不存在"); | |
332 | + return AjaxResult.error(containerCode + "容器不存在"); | |
328 | 333 | } |
329 | 334 | if (!QuantityConstant.STATUS_CONTAINER_EMPTY.equals(container.getStatus())) { |
330 | - return AjaxResult.error(containerCode+"容器状态不为空,不能执行空托出库"); | |
335 | + return AjaxResult.error(containerCode + "容器状态不为空,不能执行空托出库"); | |
331 | 336 | } |
332 | 337 | if (StringUtils.isEmpty(container.getLocationCode())) { |
333 | 338 | return AjaxResult.error("该容器不在库位上"); |
... | ... | @@ -349,13 +354,13 @@ public class WorkTaskService { |
349 | 354 | if (StringUtils.isNotEmpty(sourceLocation)) { |
350 | 355 | Location location = locationService.getLocationByCode(sourceLocation, warehouseCode); |
351 | 356 | if (StringUtils.isNull(location)) { |
352 | - return AjaxResult.error(sourceLocation+"库位不存在"); | |
357 | + return AjaxResult.error(sourceLocation + "库位不存在"); | |
353 | 358 | } |
354 | 359 | if (!QuantityConstant.STATUS_LOCATION_EMPTY.equals(location.getStatus())) { |
355 | - return AjaxResult.error(location.getCode()+"库位状态不为空闲不能执行出库"); | |
360 | + return AjaxResult.error(location.getCode() + "库位状态不为空闲不能执行出库"); | |
356 | 361 | } |
357 | 362 | if (StringUtils.isEmpty(location.getContainerCode())) { |
358 | - return AjaxResult.error(location.getCode()+"库位上没有容器"); | |
363 | + return AjaxResult.error(location.getCode() + "库位上没有容器"); | |
359 | 364 | } |
360 | 365 | if (StringUtils.isNotEmpty(containerCode)) { |
361 | 366 | if (!location.getContainerCode().equals(containerCode)) { |
... | ... | @@ -376,16 +381,16 @@ public class WorkTaskService { |
376 | 381 | taskHeader.setTaskType(QuantityConstant.TASK_TYPE_EMPTYSHIPMENT); |
377 | 382 | taskHeader.setInternalTaskType(QuantityConstant.TASK_INTENERTYPE_SHIPMENT); |
378 | 383 | taskHeader.setContainerCode(conCode); |
379 | - if(location != null) { | |
384 | + if (location != null) { | |
380 | 385 | taskHeader.setZoneCode(location.getZoneCode()); |
381 | 386 | } |
382 | 387 | taskHeader.setStatus(QuantityConstant.TASK_STATUS_BUILD); |
383 | 388 | taskHeader.setFromLocation(locationCode); |
384 | 389 | taskHeader.setToLocation(""); |
385 | 390 | taskHeader.setPort(port); |
386 | - if(taskHeaderService.save(taskHeader)){ | |
391 | + if (taskHeaderService.save(taskHeader)) { | |
387 | 392 | //锁定库位状态 |
388 | - locationService.updateStatus(locationCode,QuantityConstant.STATUS_LOCATION_LOCK, warehouseCode); | |
393 | + locationService.updateStatus(locationCode, QuantityConstant.STATUS_LOCATION_LOCK, warehouseCode); | |
389 | 394 | LambdaQueryWrapper<Container> containerLambdaQueryWrapper = Wrappers.lambdaQuery(); |
390 | 395 | containerLambdaQueryWrapper.eq(Container::getCode, conCode); |
391 | 396 | Container container = containerService.getOne(containerLambdaQueryWrapper); |
... | ... | @@ -404,7 +409,7 @@ public class WorkTaskService { |
404 | 409 | taskDetail.setFromLocation(taskHeader.getFromLocation()); |
405 | 410 | taskDetail.setToLocation(taskHeader.getToLocation()); |
406 | 411 | taskDetail.setContainerCode(taskHeader.getContainerCode()); |
407 | - if(!taskDetailService.save(taskDetail)){ | |
412 | + if (!taskDetailService.save(taskDetail)) { | |
408 | 413 | throw new ServiceException("空托出库任务明细生成失败!"); |
409 | 414 | } |
410 | 415 | return AjaxResult.success(taskHeader.getId()); |
... | ... | @@ -414,9 +419,10 @@ public class WorkTaskService { |
414 | 419 | /** |
415 | 420 | * 创建空托出库任务 |
416 | 421 | * 容器编码与源库位只需要填一个 |
417 | - * @param containerCode 容器编码 | |
422 | + * | |
423 | + * @param containerCode 容器编码 | |
418 | 424 | * @param sourceLocation 源库位 |
419 | - * @param port 出库口 | |
425 | + * @param port 出库口 | |
420 | 426 | * @return |
421 | 427 | */ |
422 | 428 | @Transactional |
... | ... | @@ -429,10 +435,10 @@ public class WorkTaskService { |
429 | 435 | if (StringUtils.isNotEmpty(containerCode)) { |
430 | 436 | Container container = containerService.getContainerByCode(containerCode); |
431 | 437 | if (StringUtils.isNull(container)) { |
432 | - return AjaxResult.error(containerCode+"容器不存在"); | |
438 | + return AjaxResult.error(containerCode + "容器不存在"); | |
433 | 439 | } |
434 | 440 | if (!QuantityConstant.STATUS_CONTAINER_EMPTY.equals(container.getStatus())) { |
435 | - return AjaxResult.error(containerCode+"容器状态不为空,不能执行空托出库"); | |
441 | + return AjaxResult.error(containerCode + "容器状态不为空,不能执行空托出库"); | |
436 | 442 | } |
437 | 443 | if (StringUtils.isEmpty(container.getLocationCode())) { |
438 | 444 | return AjaxResult.error("该容器不在库位上"); |
... | ... | @@ -454,13 +460,13 @@ public class WorkTaskService { |
454 | 460 | if (StringUtils.isNotEmpty(sourceLocation)) { |
455 | 461 | Location location = locationService.getLocationByCode(sourceLocation); |
456 | 462 | if (StringUtils.isNull(location)) { |
457 | - return AjaxResult.error(sourceLocation+"库位不存在"); | |
463 | + return AjaxResult.error(sourceLocation + "库位不存在"); | |
458 | 464 | } |
459 | 465 | if (!QuantityConstant.STATUS_LOCATION_EMPTY.equals(location.getStatus())) { |
460 | - return AjaxResult.error(location.getCode()+"库位状态不为空闲不能执行出库"); | |
466 | + return AjaxResult.error(location.getCode() + "库位状态不为空闲不能执行出库"); | |
461 | 467 | } |
462 | 468 | if (StringUtils.isEmpty(location.getContainerCode())) { |
463 | - return AjaxResult.error(location.getCode()+"库位上没有容器"); | |
469 | + return AjaxResult.error(location.getCode() + "库位上没有容器"); | |
464 | 470 | } |
465 | 471 | if (StringUtils.isNotEmpty(containerCode)) { |
466 | 472 | if (!location.getContainerCode().equals(containerCode)) { |
... | ... | @@ -481,16 +487,16 @@ public class WorkTaskService { |
481 | 487 | taskHeader.setTaskType(QuantityConstant.TASK_TYPE_EMPTYSHIPMENT); |
482 | 488 | taskHeader.setInternalTaskType(QuantityConstant.TASK_INTENERTYPE_SHIPMENT); |
483 | 489 | taskHeader.setContainerCode(conCode); |
484 | - if(location != null) { | |
490 | + if (location != null) { | |
485 | 491 | taskHeader.setZoneCode(location.getZoneCode()); |
486 | 492 | } |
487 | 493 | taskHeader.setStatus(QuantityConstant.TASK_STATUS_BUILD); |
488 | 494 | taskHeader.setFromLocation(locationCode); |
489 | 495 | taskHeader.setToLocation(""); |
490 | 496 | taskHeader.setPort(port); |
491 | - if(taskHeaderService.save(taskHeader)){ | |
497 | + if (taskHeaderService.save(taskHeader)) { | |
492 | 498 | //锁定库位状态 |
493 | - locationService.updateStatus(locationCode,QuantityConstant.STATUS_LOCATION_LOCK); | |
499 | + locationService.updateStatus(locationCode, QuantityConstant.STATUS_LOCATION_LOCK); | |
494 | 500 | LambdaQueryWrapper<Container> containerLambdaQueryWrapper = Wrappers.lambdaQuery(); |
495 | 501 | containerLambdaQueryWrapper.eq(Container::getCode, conCode); |
496 | 502 | Container container = containerService.getOne(containerLambdaQueryWrapper); |
... | ... | @@ -509,7 +515,7 @@ public class WorkTaskService { |
509 | 515 | taskDetail.setFromLocation(taskHeader.getFromLocation()); |
510 | 516 | taskDetail.setToLocation(taskHeader.getToLocation()); |
511 | 517 | taskDetail.setContainerCode(taskHeader.getContainerCode()); |
512 | - if(!taskDetailService.save(taskDetail)){ | |
518 | + if (!taskDetailService.save(taskDetail)) { | |
513 | 519 | throw new ServiceException("空托出库任务明细生成失败!"); |
514 | 520 | } |
515 | 521 | return AjaxResult.success(taskHeader.getId()); |
... | ... | @@ -525,8 +531,9 @@ public class WorkTaskService { |
525 | 531 | /** |
526 | 532 | * 创建空托出库任务 |
527 | 533 | * 容器编码与源库位只需要填一个 |
534 | + * | |
528 | 535 | * @param containerCode 容器编码 |
529 | - * @param port 出库口 | |
536 | + * @param port 出库口 | |
530 | 537 | * @return |
531 | 538 | */ |
532 | 539 | @Transactional |
... | ... | @@ -537,10 +544,10 @@ public class WorkTaskService { |
537 | 544 | if (StringUtils.isNotEmpty(containerCode)) { |
538 | 545 | Container container = containerService.getContainerByCode(containerCode, warehouseCode); |
539 | 546 | if (StringUtils.isNull(container)) { |
540 | - return AjaxResult.error(containerCode+"容器不存在"); | |
547 | + return AjaxResult.error(containerCode + "容器不存在"); | |
541 | 548 | } |
542 | 549 | if (!QuantityConstant.STATUS_CONTAINER_MANY.equals(container.getStatus())) { |
543 | - return AjaxResult.error(containerCode+"容器状态不为MANY,不能执行空托出库"); | |
550 | + return AjaxResult.error(containerCode + "容器状态不为MANY,不能执行空托出库"); | |
544 | 551 | } |
545 | 552 | if (StringUtils.isEmpty(container.getLocationCode())) { |
546 | 553 | return AjaxResult.error("该容器不在库位上"); |
... | ... | @@ -561,18 +568,18 @@ public class WorkTaskService { |
561 | 568 | taskHeader.setTaskType(QuantityConstant.TASK_TYPE_MANY_EMPTYSHIPMENT); |
562 | 569 | taskHeader.setInternalTaskType(QuantityConstant.TASK_INTENERTYPE_SHIPMENT); |
563 | 570 | taskHeader.setContainerCode(containerCode); |
564 | - if(location != null) { | |
571 | + if (location != null) { | |
565 | 572 | taskHeader.setZoneCode(location.getZoneCode()); |
566 | 573 | } |
567 | 574 | taskHeader.setStatus(QuantityConstant.TASK_STATUS_BUILD); |
568 | 575 | taskHeader.setFromLocation(locationCode); |
569 | 576 | taskHeader.setToLocation(""); |
570 | 577 | taskHeader.setPort(port); |
571 | - if(!taskHeaderService.save(taskHeader)){ | |
578 | + if (!taskHeaderService.save(taskHeader)) { | |
572 | 579 | throw new ServiceException("空托出库主表生成失败!"); |
573 | 580 | } |
574 | 581 | //锁定库位状态 |
575 | - locationService.updateStatus(locationCode,QuantityConstant.STATUS_LOCATION_LOCK, warehouseCode); | |
582 | + locationService.updateStatus(locationCode, QuantityConstant.STATUS_LOCATION_LOCK, warehouseCode); | |
576 | 583 | Container container = containerService.getContainerByCode(containerCode, warehouseCode); |
577 | 584 | container.setStatus(QuantityConstant.STATUS_CONTAINER_LOCK); |
578 | 585 | container.setLastStatus(QuantityConstant.STATUS_CONTAINER_MANY); |
... | ... | @@ -590,13 +597,17 @@ public class WorkTaskService { |
590 | 597 | wcsTask = taskAssignService.switchTaskTypeToWcs(wcsTask); |
591 | 598 | return AjaxResult.success(wcsTask); |
592 | 599 | } |
600 | + | |
593 | 601 | /** |
594 | 602 | * 完成空托盘入库任务 |
603 | + * | |
595 | 604 | * @param taskHeader 任务头表 |
596 | 605 | * @return |
597 | 606 | */ |
598 | 607 | public AjaxResult completeEmptyIn(TaskHeader taskHeader) { |
599 | 608 | taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); |
609 | + //设置子任务状态为已执行 | |
610 | + taskHeader.setCompleteTime(new Date()); | |
600 | 611 | if (!taskHeaderService.updateById(taskHeader)) { |
601 | 612 | throw new ServiceException("任务单据状态更新失败!"); |
602 | 613 | } |
... | ... | @@ -612,10 +623,12 @@ public class WorkTaskService { |
612 | 623 | |
613 | 624 | /** |
614 | 625 | * 完成空托盘组入库任务 |
626 | + * | |
615 | 627 | * @param taskHeader 任务头表 |
616 | 628 | * @return |
617 | 629 | */ |
618 | 630 | public AjaxResult completeManyEmptyIn(TaskHeader taskHeader) { |
631 | + taskHeader.setCompleteTime(new Date()); | |
619 | 632 | taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); |
620 | 633 | if (!taskHeaderService.updateById(taskHeader)) { |
621 | 634 | throw new ServiceException("任务单据状态更新失败!"); |
... | ... | @@ -631,13 +644,14 @@ public class WorkTaskService { |
631 | 644 | } |
632 | 645 | |
633 | 646 | |
634 | - | |
635 | 647 | /** |
636 | 648 | * 完成空托出库任务 |
649 | + * | |
637 | 650 | * @param taskHeader 任务头表 |
638 | 651 | * @return |
639 | 652 | */ |
640 | 653 | public AjaxResult completeEmptyOut(TaskHeader taskHeader) { |
654 | + taskHeader.setCompleteTime(new Date()); | |
641 | 655 | taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); |
642 | 656 | if (!taskHeaderService.updateById(taskHeader)) { |
643 | 657 | throw new ServiceException("任务单据状态更新失败!"); |
... | ... | @@ -645,17 +659,19 @@ public class WorkTaskService { |
645 | 659 | //解锁容器,更新库位 |
646 | 660 | containerService.updateLocationCodeAndStatus(taskHeader.getContainerCode(), |
647 | 661 | "", QuantityConstant.STATUS_CONTAINER_EMPTY, taskHeader.getWarehouseCode()); //解锁库位,更新容器 |
648 | - locationService.updateContainerCodeAndStatus(taskHeader.getFromLocation(), | |
662 | + locationService.updateContainerCodeAndStatus(taskHeader.getFromLocation(), | |
649 | 663 | "", QuantityConstant.STATUS_LOCATION_EMPTY, taskHeader.getWarehouseCode()); |
650 | - return AjaxResult.success(); | |
664 | + return AjaxResult.success(); | |
651 | 665 | } |
652 | 666 | |
653 | 667 | /** |
654 | 668 | * 完成空托出库任务 |
669 | + * | |
655 | 670 | * @param taskHeader 任务头表 |
656 | 671 | * @return |
657 | 672 | */ |
658 | 673 | public AjaxResult completeManyEmptyOut(TaskHeader taskHeader) { |
674 | + taskHeader.setCompleteTime(new Date()); | |
659 | 675 | taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); |
660 | 676 | if (!taskHeaderService.updateById(taskHeader)) { |
661 | 677 | throw new ServiceException("任务单据状态更新失败!"); |
... | ... | @@ -671,8 +687,9 @@ public class WorkTaskService { |
671 | 687 | |
672 | 688 | /** |
673 | 689 | * 创建出库查看任务 |
690 | + * | |
674 | 691 | * @param locationCodeList 库位编码列表 |
675 | - * @param port 出库口 | |
692 | + * @param port 出库口 | |
676 | 693 | * @return |
677 | 694 | */ |
678 | 695 | public AjaxResult createCheckOutTask(List<String> locationCodeList, String port) { |
... | ... | @@ -682,7 +699,7 @@ public class WorkTaskService { |
682 | 699 | throw new ServiceException("库存没有库位!"); |
683 | 700 | } |
684 | 701 | if (!QuantityConstant.STATUS_LOCATION_EMPTY.equals(location.getStatus())) { |
685 | - throw new ServiceException(locationCode+"状态非空闲,操作失败"); | |
702 | + throw new ServiceException(locationCode + "状态非空闲,操作失败"); | |
686 | 703 | } |
687 | 704 | if (StringUtils.isEmpty(location.getContainerCode())) { |
688 | 705 | throw new ServiceException(locationCode + "没有容器,操作失败"); |
... | ... | @@ -693,7 +710,7 @@ public class WorkTaskService { |
693 | 710 | taskHeader.setTaskType(QuantityConstant.TASK_TYPE_VIEW); |
694 | 711 | taskHeader.setInternalTaskType(QuantityConstant.TASK_INTENERTYPE_WORK); |
695 | 712 | taskHeader.setContainerCode(location.getContainerCode()); |
696 | - if(location != null) { | |
713 | + if (location != null) { | |
697 | 714 | taskHeader.setZoneCode(location.getZoneCode()); |
698 | 715 | } |
699 | 716 | taskHeader.setFromLocation(locationCode); |
... | ... | @@ -744,6 +761,7 @@ public class WorkTaskService { |
744 | 761 | |
745 | 762 | /** |
746 | 763 | * 根据库存头表id生成出库查看任务 |
764 | + * | |
747 | 765 | * @param ids 库存头id |
748 | 766 | */ |
749 | 767 | public AjaxResult createCheckOutTaskByIds(List<Integer> ids, String port) { |
... | ... | @@ -757,10 +775,12 @@ public class WorkTaskService { |
757 | 775 | |
758 | 776 | /** |
759 | 777 | * 完成出库查看任务 |
778 | + * | |
760 | 779 | * @param taskHeader 任务头表 |
761 | 780 | * @return |
762 | 781 | */ |
763 | 782 | public AjaxResult completeCheckOutTask(TaskHeader taskHeader) { |
783 | + taskHeader.setCompleteTime(new Date()); | |
764 | 784 | if (taskHeader.getStatus().equals(QuantityConstant.TASK_STATUS_COMPLETED)) { |
765 | 785 | return AjaxResult.error("任务已完成"); |
766 | 786 | } |
... | ... | @@ -771,7 +791,7 @@ public class WorkTaskService { |
771 | 791 | String containerCode = taskHeader.getContainerCode(); |
772 | 792 | taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); |
773 | 793 | List<TaskDetail> taskDetailList = taskDetailService.findByTaskId(taskHeader.getId()); |
774 | - if(taskDetailList != null && taskDetailList.size() > 0) { | |
794 | + if (taskDetailList != null && taskDetailList.size() > 0) { | |
775 | 795 | for (TaskDetail item : taskDetailList) { |
776 | 796 | item.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); |
777 | 797 | } |
... | ... | @@ -793,16 +813,16 @@ public class WorkTaskService { |
793 | 813 | lambdaQueryWrapper.eq(InventoryHeader::getWarehouseCode, warehouseCode) |
794 | 814 | .eq(InventoryHeader::getLocationCode, taskHeader.getFromLocation()) |
795 | 815 | .eq(InventoryHeader::getContainerCode, containerCode); |
796 | - InventoryHeader inventoryHeader= inventoryHeaderService.getOne(lambdaQueryWrapper); | |
797 | - if(inventoryHeader != null) { | |
816 | + InventoryHeader inventoryHeader = inventoryHeaderService.getOne(lambdaQueryWrapper); | |
817 | + if (inventoryHeader != null) { | |
798 | 818 | inventoryHeader.setLocationCode(taskHeader.getToLocation()); |
799 | 819 | inventoryHeaderService.updateById(inventoryHeader); |
800 | 820 | LambdaQueryWrapper<InventoryDetail> lambdaQueryWrapper2 = Wrappers.lambdaQuery(); |
801 | 821 | lambdaQueryWrapper2.eq(InventoryDetail::getWarehouseCode, warehouseCode) |
802 | 822 | .eq(InventoryDetail::getInventoryHeaderId, inventoryHeader.getId()); |
803 | 823 | List<InventoryDetail> inventoryDetails = inventoryDetailService.list(lambdaQueryWrapper2); |
804 | - if(inventoryDetails != null && inventoryDetails.size() > 0) { | |
805 | - for(InventoryDetail inventoryDetail : inventoryDetails) { | |
824 | + if (inventoryDetails != null && inventoryDetails.size() > 0) { | |
825 | + for (InventoryDetail inventoryDetail : inventoryDetails) { | |
806 | 826 | inventoryDetail.setLocationCode(taskHeader.getToLocation()); |
807 | 827 | inventoryDetailService.updateById(inventoryDetail); |
808 | 828 | } |
... | ... | @@ -816,7 +836,8 @@ public class WorkTaskService { |
816 | 836 | |
817 | 837 | /** |
818 | 838 | * 创建空托出库查看任务 |
819 | - * @param containerCode 容器 | |
839 | + * | |
840 | + * @param containerCode 容器 | |
820 | 841 | * @param sourceLocation 库位 |
821 | 842 | * @return |
822 | 843 | */ |
... | ... | @@ -830,10 +851,10 @@ public class WorkTaskService { |
830 | 851 | if (StringUtils.isNotEmpty(containerCode)) { |
831 | 852 | Container container = containerService.getContainerByCode(containerCode); |
832 | 853 | if (StringUtils.isNull(container)) { |
833 | - return AjaxResult.error(containerCode+"容器不存在"); | |
854 | + return AjaxResult.error(containerCode + "容器不存在"); | |
834 | 855 | } |
835 | 856 | if (!QuantityConstant.STATUS_CONTAINER_EMPTY.equals(container.getStatus())) { |
836 | - return AjaxResult.error(containerCode+"容器状态不为空,不能执行空托出库"); | |
857 | + return AjaxResult.error(containerCode + "容器状态不为空,不能执行空托出库"); | |
837 | 858 | } |
838 | 859 | if (StringUtils.isEmpty(container.getLocationCode())) { |
839 | 860 | return AjaxResult.error("该容器不在库位上"); |
... | ... | @@ -855,13 +876,13 @@ public class WorkTaskService { |
855 | 876 | if (StringUtils.isNotEmpty(sourceLocation)) { |
856 | 877 | Location location = locationService.getLocationByCode(sourceLocation); |
857 | 878 | if (StringUtils.isNull(location)) { |
858 | - return AjaxResult.error(sourceLocation+"库位不存在"); | |
879 | + return AjaxResult.error(sourceLocation + "库位不存在"); | |
859 | 880 | } |
860 | 881 | if (!QuantityConstant.STATUS_LOCATION_EMPTY.equals(location.getStatus())) { |
861 | - return AjaxResult.error(location.getCode()+"库位状态不为空闲不能执行出库"); | |
882 | + return AjaxResult.error(location.getCode() + "库位状态不为空闲不能执行出库"); | |
862 | 883 | } |
863 | 884 | if (StringUtils.isEmpty(location.getContainerCode())) { |
864 | - return AjaxResult.error(location.getCode()+"库位上没有容器"); | |
885 | + return AjaxResult.error(location.getCode() + "库位上没有容器"); | |
865 | 886 | } |
866 | 887 | if (StringUtils.isNotEmpty(containerCode)) { |
867 | 888 | if (!location.getContainerCode().equals(containerCode)) { |
... | ... | @@ -883,7 +904,7 @@ public class WorkTaskService { |
883 | 904 | taskHeader.setInternalTaskType(QuantityConstant.TASK_INTENERTYPE_WORK); |
884 | 905 | taskHeader.setContainerCode(conCode); |
885 | 906 | Location location = locationService.getLocationByCode(sourceLocation); |
886 | - if(location != null) { | |
907 | + if (location != null) { | |
887 | 908 | taskHeader.setZoneCode(location.getZoneCode()); |
888 | 909 | } |
889 | 910 | taskHeader.setStatus(QuantityConstant.TASK_STATUS_BUILD); |
... | ... | @@ -894,11 +915,11 @@ public class WorkTaskService { |
894 | 915 | taskHeader.setToLocation(locationCode); |
895 | 916 | } |
896 | 917 | taskHeader.setPort(port); |
897 | - if(!taskHeaderService.save(taskHeader)){ | |
918 | + if (!taskHeaderService.save(taskHeader)) { | |
898 | 919 | throw new ServiceException("空托出库主表生成失败!"); |
899 | 920 | } |
900 | 921 | //锁定库位状态 |
901 | - locationService.updateStatus(locationCode,QuantityConstant.STATUS_LOCATION_LOCK, ShiroUtils.getWarehouseCode()); | |
922 | + locationService.updateStatus(locationCode, QuantityConstant.STATUS_LOCATION_LOCK, ShiroUtils.getWarehouseCode()); | |
902 | 923 | containerService.updateStatus(containerCode, QuantityConstant.STATUS_CONTAINER_LOCK, ShiroUtils.getWarehouseCode()); |
903 | 924 | |
904 | 925 | return AjaxResult.success(taskHeader.getId()); |
... | ... |
src/main/resources/application-druid.properties
... | ... | @@ -17,7 +17,6 @@ spring.datasource.druid.master.password=HHsoft123. |
17 | 17 | #spring.datasource.druid.wcs.url = jdbc:mysql://172.16.29.45:3306/huahengwcs3?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2b8 |
18 | 18 | #spring.datasource.druid.wcs.username=softhuaheng |
19 | 19 | #spring.datasource.druid.wcs.password=HHrobot123. |
20 | - | |
21 | 20 | # \u521D\u59CB\u8FDE\u63A5\u6570 |
22 | 21 | spring.datasource.druid.initial-size=4 |
23 | 22 | # \u6700\u5C0F\u8FDE\u63A5\u6C60\u6570\u91CF |
... | ... | @@ -43,8 +42,6 @@ spring.datasource.druid.filter.stat.log-slow-sql=true |
43 | 42 | spring.datasource.druid.filter.stat.slow-sql-millis=1000 |
44 | 43 | spring.datasource.druid.filter.stat.merge-sql=false |
45 | 44 | spring.datasource.druid.filter.wall.config.multi-statement-allow=true |
46 | - | |
47 | - | |
48 | 45 | #\u65E5\u5FD7\u914D\u7F6E <DEBUG<INFO<WARN<ERROR<FATAL<OFF |
49 | 46 | logging.level.com.huaheng=INFO |
50 | 47 | #mapper\u5C42\u65E5\u5FD7 |
... | ... |
src/main/resources/mybatis/monitor/ApiLogMapper.xml
... | ... | @@ -24,25 +24,55 @@ |
24 | 24 | <result property="exception" column="exception"/> |
25 | 25 | </resultMap> |
26 | 26 | <sql id="selectapiLogVo"> |
27 | - select id, apiName, apiMethod, ip, requestFrom, responseBy, url, requestTime, responseTime, requestHeader, requestBody, responseHeader, responseBody, duration, httpCode, retCode, `exception` from api_log | |
27 | + select id, | |
28 | + apiName, | |
29 | + apiMethod, | |
30 | + ip, | |
31 | + requestFrom, | |
32 | + responseBy, | |
33 | + url, | |
34 | + requestTime, | |
35 | + responseTime, | |
36 | + requestHeader, | |
37 | + requestBody, | |
38 | + responseHeader, | |
39 | + responseBody, | |
40 | + duration, | |
41 | + httpCode, | |
42 | + retCode, | |
43 | + `exception` | |
44 | + from api_log | |
28 | 45 | </sql> |
29 | 46 | <select id="getRequestFromList" resultType="java.lang.String"> |
30 | - select distinct(requestFrom) from api_log order by requestFrom asc | |
47 | + select distinct(requestFrom) | |
48 | + from api_log | |
49 | + order by requestFrom asc | |
31 | 50 | </select> |
32 | 51 | <select id="getResponseByList" resultType="java.lang.String"> |
33 | - select distinct(responseBy) from api_log order by responseBy asc | |
52 | + select distinct(responseBy) | |
53 | + from api_log | |
54 | + order by responseBy asc | |
34 | 55 | </select> |
35 | 56 | <select id="getHttpCodeList" resultType="java.lang.String"> |
36 | - select distinct(httpCode) from api_log order by httpCode asc | |
57 | + select distinct(httpCode) | |
58 | + from api_log | |
59 | + order by httpCode asc | |
37 | 60 | </select> |
38 | 61 | <select id="getApiNameList" resultType="java.lang.String"> |
39 | - select distinct(apiName) from api_log order by apiName asc | |
62 | + select distinct(apiName) | |
63 | + from api_log | |
64 | + order by apiName asc | |
40 | 65 | </select> |
41 | 66 | <select id="getRetCodeList" resultType="java.lang.String"> |
42 | - select distinct(retCode) from api_log order by retCode asc | |
67 | + select distinct(retCode) | |
68 | + from api_log | |
69 | + order by retCode asc | |
43 | 70 | </select> |
44 | 71 | |
45 | 72 | <update id="truncateTable"> |
46 | - DELETE FROM api_log WHERE apiName IN ('wcs任务完成','TaskAssign', '获取电视出库信息','获取出站口出库信息','获取电视入库信息','wcs到达拣选台','wcs调用wms分配库位','wms下发任务到wcs') | |
73 | + DELETE | |
74 | + FROM api_log | |
75 | + WHERE apiName IN ('wcs任务完成', 'TaskAssign', '获取电视出库信息', '获取出站口出库信息', '获取电视入库信息', | |
76 | + 'wcs到达拣选台', 'wcs调用wms分配库位', 'wms下发任务到wcs', '更新物料') | |
47 | 77 | </update> |
48 | 78 | </mapper> |
... | ... |