Commit 8bac25a4 by ice

修改转单功能中调拨根据调出库区的不同进行分单

parent fa2be4e5
...@@ -199,14 +199,18 @@ public class StockTransferController { ...@@ -199,14 +199,18 @@ public class StockTransferController {
String username = sysUser.getUsername(); String username = sysUser.getUsername();
judgeInvId(jsonArray); judgeInvId(jsonArray);
JSONArray jsonArr = getJSONArray(jsonArray); JSONArray jsonArr = getJSONArray(jsonArray);
//根据调入库存不同进行分组 //根据调出库区、调入库存不同进行分组
List<JSONArrayModel> list = jsonArr.toJavaList(JSONArrayModel.class); List<JSONArrayModel> list = jsonArr.toJavaList(JSONArrayModel.class);
Map<String,List<JSONArrayModel>> jsonMap = list.stream().collect(Collectors.groupingBy(JSONArrayModel::getIn_inv_id)); Map<String, Map<String, List<JSONArrayModel>>> jsonMap = list.stream().collect(Collectors.groupingBy(JSONArrayModel::getSubinv_id,Collectors.groupingBy(JSONArrayModel::getIn_inv_id)));
Set set = jsonMap.entrySet(); Set firstSet = jsonMap.entrySet();
for(Iterator iterator = set.iterator();iterator.hasNext();){ for(Iterator firstIterator = firstSet.iterator();firstIterator.hasNext();) {
Map.Entry firstEntry = (Map.Entry) firstIterator.next();
Map<String, List<JSONArrayModel>> listMap = (Map<String, List<JSONArrayModel>>) firstEntry.getValue();
Set secondSet = listMap.entrySet();
for (Iterator secondIterator = secondSet.iterator(); secondIterator.hasNext();) {
Map.Entry secondEntry = (Map.Entry) secondIterator.next();
List<JSONArrayModel> jsonObjectList = (List<JSONArrayModel>) secondEntry.getValue();
String orderNumber = propertiesServer.generateFlowingWater("WAR_TRANSFER_NUMBER"); String orderNumber = propertiesServer.generateFlowingWater("WAR_TRANSFER_NUMBER");
Map.Entry entry = (Map.Entry) iterator.next();
List<JSONArrayModel> jsonObjectList = (List<JSONArrayModel>) entry.getValue();
Inventory inventory = getInventory(jsonObjectList.get(0).getIn_inv_id()); Inventory inventory = getInventory(jsonObjectList.get(0).getIn_inv_id());
WarTransfer warTransfer = new WarTransfer(); WarTransfer warTransfer = new WarTransfer();
warTransfer.setId(UuidUtil.get32UUIDString()); warTransfer.setId(UuidUtil.get32UUIDString());
...@@ -224,9 +228,9 @@ public class StockTransferController { ...@@ -224,9 +228,9 @@ public class StockTransferController {
warTransfer.setSysOrgCode(map.get("sys_org_code")); warTransfer.setSysOrgCode(map.get("sys_org_code"));
warTransfer.setOrderNumber(orderNumber); warTransfer.setOrderNumber(orderNumber);
warTransfer.setOrderStatus("new"); warTransfer.setOrderStatus("new");
if(jsonObjectList.get(0).getInv_id().equals(jsonObjectList.get(0).getIn_inv_id())){ if (jsonObjectList.get(0).getInv_id().equals(jsonObjectList.get(0).getIn_inv_id())) {
warTransfer.setOrderType("SUBINVENTORY_TRANSFER"); warTransfer.setOrderType("SUBINVENTORY_TRANSFER");
}else{ } else {
warTransfer.setOrderType("OTHERINVENTORY_TRANSFER"); warTransfer.setOrderType("OTHERINVENTORY_TRANSFER");
} }
warTransfer.setDeliveryName(""); warTransfer.setDeliveryName("");
...@@ -236,12 +240,12 @@ public class StockTransferController { ...@@ -236,12 +240,12 @@ public class StockTransferController {
JSONArrayModel jsonArrayModel = jsonObjectList.get(i); JSONArrayModel jsonArrayModel = jsonObjectList.get(i);
Integer balance = Integer.valueOf(jsonArrayModel.getBalance()); Integer balance = Integer.valueOf(jsonArrayModel.getBalance());
Integer quantity = Integer.valueOf(jsonArrayModel.getQuantity()); Integer quantity = Integer.valueOf(jsonArrayModel.getQuantity());
if(quantity.compareTo(balance)>0){ if (quantity.compareTo(balance) > 0) {
throw ErrorEnum.Error.createException("转单失败,存在调拨数量大于库存现有量!"); throw ErrorEnum.Error.createException("转单失败,存在调拨数量大于库存现有量!");
} }
WarTransferLine warTransferLine = new WarTransferLine(); WarTransferLine warTransferLine = new WarTransferLine();
warTransferLine.setId(UuidUtil.get32UUIDString()); warTransferLine.setId(UuidUtil.get32UUIDString());
warTransferLine.setLineNumber(String.valueOf(i+1)); warTransferLine.setLineNumber(String.valueOf(i + 1));
warTransferLine.setSubinvCode(jsonArrayModel.getSubinv_code()); warTransferLine.setSubinvCode(jsonArrayModel.getSubinv_code());
warTransferLine.setSubinvName(jsonArrayModel.getSubinv_name()); warTransferLine.setSubinvName(jsonArrayModel.getSubinv_name());
warTransferLine.setLocatorCode(jsonArrayModel.getLocator_code()); warTransferLine.setLocatorCode(jsonArrayModel.getLocator_code());
...@@ -254,9 +258,10 @@ public class StockTransferController { ...@@ -254,9 +258,10 @@ public class StockTransferController {
warTransferLine.setAttribute1(jsonArrayModel.getBalance()); warTransferLine.setAttribute1(jsonArrayModel.getBalance());
warTransferLineList.add(warTransferLine); warTransferLineList.add(warTransferLine);
} }
transferService.saveMain(warTransfer,warTransferLineList); transferService.saveMain(warTransfer, warTransferLineList);
orderNumList.add(orderNumber); orderNumList.add(orderNumber);
} }
}
return orderNumList; return orderNumList;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment