Commit 7f1699b1a8e7653ceffe9736ac6aa14606a06f48
1 parent
4466ef77
任务完成-入库任务
Showing
3 changed files
with
86 additions
and
77 deletions
src/main/java/com/huaheng/pc/task/taskHeader/controller/TaskHeaderController.java
... | ... | @@ -108,7 +108,7 @@ public class TaskHeaderController extends BaseController { |
108 | 108 | /** |
109 | 109 | * 完成任务 |
110 | 110 | */ |
111 | - @RequiresPermissions("task:task:complete") | |
111 | + @RequiresPermissions("task:taskHeader:complete") | |
112 | 112 | @Log(title = "任务-任务管理", operating = "PC完成立库任务", action = BusinessType.UPDATE) |
113 | 113 | @PostMapping( "/completeTaskByWMS") |
114 | 114 | @ResponseBody |
... | ... |
src/main/java/com/huaheng/pc/task/taskHeader/service/TaskHeaderServiceImpl.java
... | ... | @@ -12,7 +12,10 @@ import com.huaheng.pc.config.location.domain.Location; |
12 | 12 | import com.huaheng.pc.config.location.service.LocationService; |
13 | 13 | import com.huaheng.pc.inventory.inventoryDetail.domain.InventoryDetail; |
14 | 14 | import com.huaheng.pc.inventory.inventoryDetail.service.InventoryDetailService; |
15 | +import com.huaheng.pc.inventory.inventoryHeader.domain.InventoryHeader; | |
16 | +import com.huaheng.pc.inventory.inventoryHeader.service.InventoryHeaderService; | |
15 | 17 | import com.huaheng.pc.inventory.inventoryTransaction.domain.InventoryTransaction; |
18 | +import com.huaheng.pc.inventory.inventoryTransaction.service.InventoryTransactionService; | |
16 | 19 | import com.huaheng.pc.receipt.receiptContainerHeader.domain.ReceiptContainerHeader; |
17 | 20 | import com.huaheng.pc.shipment.shipmentContainerDetail.domain.ShipmentContainerDetail; |
18 | 21 | import com.huaheng.pc.shipment.shipmentContainerDetail.service.ShipmentContainerDetailService; |
... | ... | @@ -54,6 +57,12 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
54 | 57 | @Autowired |
55 | 58 | private TaskHeaderService taskHeaderService; |
56 | 59 | |
60 | + @Autowired | |
61 | + private InventoryHeaderService inventoryHeaderService; | |
62 | + | |
63 | + @Autowired | |
64 | + private InventoryTransactionService inventoryTransactionService; | |
65 | + | |
57 | 66 | @Resource |
58 | 67 | private TaskHeaderMapper taskHeaderMapper; |
59 | 68 | |
... | ... | @@ -239,7 +248,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
239 | 248 | throw new ServiceException("任务(" + taskId + ")任务已经是完成的!"); |
240 | 249 | } |
241 | 250 | //如果没有库位不能完成 |
242 | - if (StringUtils.isEmpty(task.getPickingCartPos())) { | |
251 | + if (StringUtils.isEmpty(task.getLocationCode())) { | |
243 | 252 | throw new ServiceException("任务" + taskId + "没有库位,执行中止"); |
244 | 253 | } |
245 | 254 | this.completeTask(task); |
... | ... | @@ -286,83 +295,83 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
286 | 295 | public AjaxResult completeReceiptTask(TaskHeader task) throws Exception { |
287 | 296 | // String LocationCode = task.getIsDoubleIn().intValue() == 0 ? task.getDestinationLocation() : task.getSecondDestinationLocation(); |
288 | 297 | List<Map<String, Object>> taskReceiptContainerDetail =taskHeaderMapper.getReceiptTask(task.getId()); |
298 | + if (taskReceiptContainerDetail.size()<1){ | |
299 | + return AjaxResult.success("未找到对应任务的入库单号!!!"); | |
300 | + } | |
289 | 301 | for (Map<String, Object> map : taskReceiptContainerDetail) { |
290 | 302 | //将未完成的任务数量更新到库存表 |
291 | 303 | if (DataUtils.getInteger(map.get("status")) < 100) { |
292 | -// //更新库存表 | |
293 | -// BigDecimal inventoryQty = new BigDecimal("0"); | |
294 | -// Inventory condition = new Inventory(); | |
295 | -// condition.setWarehouseId(ShiroUtils.getWarehouseId()); | |
296 | -// condition.setLocationCode(LocationCode); | |
297 | -// condition.setReceiptDetailId(DataUtils.getInteger(map.get("billDetailId"))); | |
298 | -// condition.setContainerCode(DataUtils.getString(map.get("containerCode"))); | |
299 | -// Inventory inventory = inventoryService.selectFirstEntity(condition); | |
300 | -// if (inventory == null) | |
301 | -// { | |
302 | -// inventory = new Inventory(); | |
303 | -// inventory.setWarehouseId(DataUtils.getInteger(map.get("warehouseId"))); | |
304 | -// inventory.setWarehouseCode(DataUtils.getString(map.get("warehouseCode"))); | |
305 | -// inventory.setLocationCode(LocationCode); | |
306 | -// inventory.setContainerCode(DataUtils.getString(map.get("containerCode"))); | |
307 | -// inventory.setSourceCode(DataUtils.getString(map.get("sourceCode"))); | |
308 | -// inventory.setSourceLine(DataUtils.getString(map.get("sourceLine"))); | |
309 | -// inventory.setCompanyId(task.getCompanyId()); | |
310 | -// inventory.setCompanyCode(task.getCompanyCode()); | |
311 | -// inventory.setMaterialCode(DataUtils.getString(map.get("materialCode"))); | |
312 | -// inventory.setMaterialName(DataUtils.getString(map.get("materialName"))); | |
313 | -// inventory.setReceiptCode(DataUtils.getString(map.get("billCode"))); | |
314 | -// inventory.setReceiptId(DataUtils.getInteger(map.get("billId"))); | |
315 | -// inventory.setReceiptDetailId(DataUtils.getInteger(map.get("billDetailId"))); | |
316 | -// inventory.setBatch(DataUtils.getString(map.get("batch"))); | |
317 | -// inventory.setLot(DataUtils.getString(map.get("lot"))); | |
318 | -// inventory.setProject(DataUtils.getString(map.get("project"))); | |
319 | -// inventory.setManufactureDate(DataUtils.getDateTime(map.get("manufactureDate"))); | |
320 | -// inventory.setExpirationDate(DataUtils.getDateTime(map.get("expirationDate"))); | |
321 | -// inventory.setStatus(DataUtils.getString((map.get("inventoryStatus")))); | |
322 | -// inventory.setQty(DataUtils.getBigDecimal(map.get("qty"))); | |
323 | -// inventory.setCostPrice(DataUtils.getBigDecimal(map.get("price"))); | |
324 | -// inventory.setCreatedBy(ShiroUtils.getLoginName()); | |
325 | -// inventory.setLastUpdatedBy(ShiroUtils.getLoginName()); | |
326 | -// inventoryService.insert(inventory); | |
327 | -// } | |
328 | -// else | |
329 | -// { | |
330 | -// inventoryQty = inventory.getQty(); | |
331 | -// inventory.setQty(inventory.getQty().add(DataUtils.getBigDecimal(map.get("qty")))); | |
332 | -// inventory.setLastUpdatedBy(ShiroUtils.getLoginName()); | |
333 | -// inventoryService.updateByModel(inventory); | |
334 | -// } | |
335 | -// //记录库存交易记录 | |
336 | -// InventoryTransaction inventoryTransaction = new InventoryTransaction(); | |
337 | -// inventoryTransaction.setType("receipt"); | |
338 | -// inventoryTransaction.setWarehouseId(DataUtils.getInteger(map.get("warehouseId"))); | |
339 | -// inventoryTransaction.setWarehouseCode(DataUtils.getString(map.get("warehouseCode"))); | |
340 | -// inventoryTransaction.setCompanyId(task.getCompanyId()); | |
341 | -// inventoryTransaction.setCompanyCode(task.getCompanyCode()); | |
342 | -// inventoryTransaction.setLocationCode(LocationCode); | |
343 | -// inventoryTransaction.setContainerCode(DataUtils.getString(map.get("containerCode"))); | |
344 | -// inventoryTransaction.setSourceCode(DataUtils.getString(map.get("sourceCode"))); | |
345 | -// inventoryTransaction.setSourceLine(DataUtils.getString(map.get("sourceLine"))); | |
346 | -// inventoryTransaction.setMaterialCode(DataUtils.getString(map.get("materialCode"))); | |
347 | -// inventoryTransaction.setMaterialName(DataUtils.getString(map.get("materialName"))); | |
348 | -// inventoryTransaction.setBillCode(DataUtils.getString(map.get("billCode"))); | |
349 | -// inventoryTransaction.setBillId(DataUtils.getInteger(map.get("billId"))); | |
350 | -// inventoryTransaction.setBillDetailId(DataUtils.getInteger(map.get("billDetailId"))); | |
351 | -// inventoryTransaction.setBatch(DataUtils.getString(map.get("batch"))); | |
352 | -// inventoryTransaction.setLot(DataUtils.getString(map.get("lot"))); | |
353 | -// inventoryTransaction.setProject(DataUtils.getString(map.get("project"))); | |
354 | -// inventoryTransaction.setManufactureDate(DataUtils.getDateTime(map.get("manufactureDate"))); | |
355 | -// inventoryTransaction.setExpirationDate(DataUtils.getDateTime(map.get("expirationDate"))); | |
356 | -// inventoryTransaction.setStatus(DataUtils.getString((map.get("inventoryStatus")))); | |
357 | -// inventoryTransaction.setQty(inventoryQty); | |
358 | -// inventoryTransaction.setTaskQty(DataUtils.getBigDecimal(map.get("qty"))); | |
359 | -// inventoryTransaction.setCostPrice(DataUtils.getBigDecimal(map.get("price"))); | |
360 | -// //inventoryTransaction.setCreatedBy(ShiroUtils.getLoginName()); | |
361 | -// inventoryTransaction.setCreated(null); | |
362 | -// inventoryTransaction.setCreatedBy(ShiroUtils.getLoginName()); | |
363 | -// inventoryTransaction.setLastUpdated(null); | |
364 | -// inventoryTransaction.setLastUpdatedBy(ShiroUtils.getLoginName()); | |
365 | -// inventoryTransactionService.insert(inventoryTransaction); | |
304 | + LambdaQueryWrapper<InventoryDetail> inventory =Wrappers.lambdaQuery(); | |
305 | + inventory.eq(InventoryDetail::getWarehouseCode,ShiroUtils.getWarehouseCode()) | |
306 | + .eq(InventoryDetail::getLocationCode,task.getLocationCode()) | |
307 | + .eq(InventoryDetail::getReceiptDetailId,DataUtils.getString(map.get("id"))) | |
308 | + .eq(InventoryDetail::getContainerCode,DataUtils.getString(map.get("containerCode"))); | |
309 | + InventoryDetail detail=inventoryDetailService.getOne(inventory); | |
310 | + if (detail == null) | |
311 | + { | |
312 | + //添加库存单 | |
313 | + InventoryHeader header = new InventoryHeader(); | |
314 | + header.setWarehouseCode(DataUtils.getString(map.get("warehouseCode")));//仓库 | |
315 | + header.setCompanyCode(task.getCompanyCode());//货主 | |
316 | + header.setContainerCode(DataUtils.getString(map.get("containerCode")));//容器号 | |
317 | + header.setTotalQty(DataUtils.getInteger(map.get("totalQty")));//总数量 | |
318 | + header.setLocking(1); | |
319 | + header.setEnable(1); | |
320 | + header.setCreatedBy(ShiroUtils.getLoginName()); | |
321 | + header.setCreated(new Date()); | |
322 | + header.setLastUpdated(new Date()); | |
323 | + inventoryHeaderService.save(header); | |
324 | + //库存明细添加 | |
325 | + detail = new InventoryDetail(); | |
326 | + detail.setInventoryHeaderId(header.getId());//库存头ID | |
327 | + detail.setWarehouseCode(DataUtils.getString(map.get("warehouseCode")));//仓库 | |
328 | + detail.setCompanyCode(task.getCompanyCode());//货主 | |
329 | + detail.setLocationCode(task.getLocationCode());//库位号 | |
330 | + detail.setContainerCode(DataUtils.getString(map.get("containerCode")));//容器号 | |
331 | + detail.setMaterialCode(DataUtils.getString(map.get("materialCode")));//物料号 | |
332 | + detail.setMaterialName(DataUtils.getString(map.get("materialName")));//物料名称 | |
333 | + detail.setMaterialSpec(DataUtils.getString(map.get("materialSpec")));//物料规格 | |
334 | + detail.setReceiptCode(DataUtils.getString(map.get("receiptCode")));//入库单编码 | |
335 | + detail.setReceiptDetailId(DataUtils.getInteger(map.get("id")));//入库单明细ID | |
336 | + detail.setBatch(DataUtils.getString(map.get("batch")));//批次 | |
337 | + detail.setLot(DataUtils.getString(map.get("lot")));//批号 | |
338 | + detail.setInventorySts(DataUtils.getString(map.get("inventorySts")));//库存状态 | |
339 | + detail.setManufactureDate(DataUtils.getDateTime(map.get("manufactureDate")));//生产日期 | |
340 | + detail.setExpirationDate(DataUtils.getDateTime(map.get("expirationDate")));//失效日期 | |
341 | + detail.setQty(DataUtils.getBigDecimal(map.get("qty")));//数量 | |
342 | + detail.setTaskQty(DataUtils.getBigDecimal(map.get("taskQty"))); | |
343 | + detail.setCreatedBy(ShiroUtils.getLoginName());//创建人 | |
344 | + detail.setLastUpdatedBy(ShiroUtils.getLoginName());//创建时间 | |
345 | + inventoryDetailService.save(detail); | |
346 | + } | |
347 | + else | |
348 | + { | |
349 | + detail.setQty(detail.getQty().add(DataUtils.getBigDecimal(map.get("qty")))); | |
350 | + detail.setLastUpdatedBy(ShiroUtils.getLoginName()); | |
351 | + LambdaUpdateWrapper<InventoryDetail> lambdaUpdateWrapper = Wrappers.lambdaUpdate(); | |
352 | + lambdaUpdateWrapper.eq(InventoryDetail::getId,DataUtils.getInteger(map.get("id"))); | |
353 | + inventoryDetailService.update(detail, lambdaUpdateWrapper); | |
354 | + } | |
355 | + //记录库存交易记录 | |
356 | + InventoryTransaction inventoryTransaction = new InventoryTransaction(); | |
357 | + inventoryTransaction.setTransactionType(10); | |
358 | + inventoryTransaction.setWarehouseCode(DataUtils.getString(map.get("warehouseCode"))); | |
359 | + inventoryTransaction.setCompanyCode(task.getCompanyCode()); | |
360 | + inventoryTransaction.setLocationCode(task.getLocationCode()); | |
361 | + inventoryTransaction.setContainerCode(DataUtils.getString(map.get("containerCode"))); | |
362 | + inventoryTransaction.setMaterialCode(DataUtils.getString(map.get("materialCode"))); | |
363 | + inventoryTransaction.setMaterialName(DataUtils.getString(map.get("materialName"))); | |
364 | + inventoryTransaction.setBillCode(DataUtils.getString(map.get("receiptCode"))); | |
365 | + inventoryTransaction.setBillDetailId(DataUtils.getInteger(map.get("id"))); | |
366 | + inventoryTransaction.setBatch(DataUtils.getString(map.get("batch"))); | |
367 | + inventoryTransaction.setLot(DataUtils.getString(map.get("lot"))); | |
368 | + inventoryTransaction.setManufactureDate(DataUtils.getDateTime(map.get("manufactureDate"))); | |
369 | + inventoryTransaction.setExpirationDate(DataUtils.getDateTime(map.get("expirationDate"))); | |
370 | + inventoryTransaction.setInventorySts(DataUtils.getString((map.get("inventorySts")))); | |
371 | + inventoryTransaction.setTaskQty(DataUtils.getInteger(map.get("taskQty"))); | |
372 | + inventoryTransaction.setCreated(new Date()); | |
373 | + inventoryTransaction.setCreatedBy(ShiroUtils.getLoginName()); | |
374 | + inventoryTransactionService.save(inventoryTransaction); | |
366 | 375 | // //修改任务明细的状态为完成 |
367 | 376 | // TaskDetail taskDetail = new TaskDetail(); |
368 | 377 | // taskDetail.setId(DataUtils.getInteger(map.get("taskDetailId"))); |
... | ... |
src/main/resources/templates/task/taskHeader/taskHeader.html
... | ... | @@ -439,7 +439,7 @@ |
439 | 439 | /*任务列表-完成任务*/ |
440 | 440 | function complete(taskId) { |
441 | 441 | $.modal.confirm("确定完成任务?", function() { |
442 | - var url = ctx + 'task/task/completeTaskByWMS'; | |
442 | + var url = ctx + 'task/taskHeader/completeTaskByWMS'; | |
443 | 443 | var data = { "taskId" : taskId }; |
444 | 444 | $.operate.post(url, data); |
445 | 445 | }); |
... | ... |