diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/impl/MesServiceImpl.java b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/MesServiceImpl.java index c35caab..b88d374 100644 --- a/youchain-system/src/main/java/com/youchain/businessdata/service/impl/MesServiceImpl.java +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/MesServiceImpl.java @@ -133,10 +133,14 @@ public class MesServiceImpl implements MesService { if (pick == null) { return gdNo + ":" + itemCode + ":" + station + "工单WMS不存在,叫料失败!"; } - if (pick.getCallPoint() == null || pick.getCallPoint().length() <= 0) { + String currentCallPoint = pick.getCallPoint(); + if (currentCallPoint == null || currentCallPoint.isEmpty()) { pick.setCallPoint(pointCode); } else { - pick.setCallPoint(pick.getCallPoint() + "," + pointCode); + Set callPointSet = new HashSet<>(Arrays.asList(currentCallPoint.split(","))); + callPointSet.add(pointCode); + String newCallPoint = String.join(",", callPointSet); + pick.setCallPoint(newCallPoint); } pick.setIsCall(true); pickRepository.save(pick); @@ -150,10 +154,14 @@ public class MesServiceImpl implements MesService { if (pick == null) { return gdNo + ":" + completeCode + ":" + station + "工单WMS不存在,叫料失败!"; } - if (pick.getCallPoint() == null || pick.getCallPoint().length() <= 0) { + String currentCallPoint = pick.getCallPoint(); + if (currentCallPoint == null || currentCallPoint.isEmpty()) { pick.setCallPoint(pointCode); } else { - pick.setCallPoint(pick.getCallPoint() + "," + pointCode); + Set callPointSet = new HashSet<>(Arrays.asList(currentCallPoint.split(","))); + callPointSet.add(pointCode); + String newCallPoint = String.join(",", callPointSet); + pick.setCallPoint(newCallPoint); } pick.setIsCall(true); pickRepository.save(pick); diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/impl/TaskServiceImpl.java b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/TaskServiceImpl.java index 070318d..64333ea 100644 --- a/youchain-system/src/main/java/com/youchain/businessdata/service/impl/TaskServiceImpl.java +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/TaskServiceImpl.java @@ -582,27 +582,30 @@ public class TaskServiceImpl implements TaskService { public void moveInventory(Task task, Stock dstStock, double moveQty) { //将占用数量移位,原库存回库内 Inventory inventory = inventoryService.findById(task.getInvId()); - ItemKey itemKey = inventory.getItemKey(); - Dept dept = inventory.getDept(); PickDetail pickDetail = task.getPickDetail(); - synchronized (inventory) { - inventory.setQueuedQty(inventory.getQueuedQty() - moveQty); - inventory.setQuantity(inventory.getQuantity() - moveQty); - inventoryService.update(inventory); + Inventory newInventory = null; + if (inventory != null) { + ItemKey itemKey = inventory.getItemKey(); + Dept dept = inventory.getDept(); + synchronized (inventory) { + inventory.setQueuedQty(inventory.getQueuedQty() - moveQty); + inventory.setQuantity(inventory.getQuantity() - moveQty); + inventoryService.update(inventory); - if (inventory.getQuantity() == 0) { - inventoryService.deleteAll(new Long[]{inventory.getId()}); + if (inventory.getQuantity() == 0) { + inventoryService.deleteAll(new Long[]{inventory.getId()}); + } } + //生成新库存 + newInventory = inventoryService.createInventory(itemKey, dstStock.getPoint(), dstStock, dept, moveQty); } - //生成新库存 - Inventory newInventory = inventoryService.createInventory(itemKey, dstStock.getPoint(), dstStock, dept, moveQty); //更新Task double planQty = task.getPlanQty(); String status = task.getTaskStatus(); - task.setInvId(inventory.getId()); - task.setNewInvId(newInventory.getId()); + task.setInvId(inventory==null?null:inventory.getId()); + task.setNewInvId(newInventory==null?null:newInventory.getId()); task.setMoveQty(task.getMoveQty() + moveQty); task.setDstStock(dstStock); task.setDstStockCode(dstStock.getCode()); diff --git a/youchain-system/src/test/java/com/youchain/EladminSystemApplicationTests.java b/youchain-system/src/test/java/com/youchain/EladminSystemApplicationTests.java index c1bbe98..d3d9a98 100644 --- a/youchain-system/src/test/java/com/youchain/EladminSystemApplicationTests.java +++ b/youchain-system/src/test/java/com/youchain/EladminSystemApplicationTests.java @@ -27,6 +27,16 @@ public class EladminSystemApplicationTests { } public static void main(String[] args) { + String pointCode = "QXJL002"; + String currentCallPoint="QXJL001,QXJL002,QXJL001"; + Set callPointSet = new HashSet<>(Arrays.asList(currentCallPoint.split(","))); + callPointSet.add(pointCode); + String newCallPoint = String.join(",", callPointSet); + System.out.println(newCallPoint); + + } + + public void cc1(){ JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); // 设置服务接口 factory.setServiceClass(TestService.class); @@ -34,8 +44,6 @@ public class EladminSystemApplicationTests { factory.setAddress("http://example.com/yourService"); String result = testService.pickAndPost("123"); - - } public void cc(){