|
|
|
@ -1119,12 +1119,14 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
} |
|
|
|
} |
|
|
|
}).start(); |
|
|
|
} else { |
|
|
|
} |
|
|
|
else { |
|
|
|
restResponse.setStatus(508); |
|
|
|
restResponse.setData(""); |
|
|
|
restResponse.setStatusInfo(new StatusInfo("出库失败", "出库失败,库存不足")); |
|
|
|
} |
|
|
|
} else { |
|
|
|
} |
|
|
|
else { |
|
|
|
// 如果是拆单后的出库
|
|
|
|
|
|
|
|
// 用于获取对应的拆单记录
|
|
|
|
@ -1151,6 +1153,9 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
if (splitInventory != null) { |
|
|
|
// 如果拆单库存处理记录存在
|
|
|
|
|
|
|
|
// 未出库时库存记录
|
|
|
|
double oldSplitInventory = splitInventory.getSaveQuantity() / 100.0; |
|
|
|
|
|
|
|
if (splitInventory.getSaveQuantity() >= trueOut * 100) { |
|
|
|
// 如果当前待处理树可以满足需求
|
|
|
|
|
|
|
|
@ -1185,7 +1190,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
restResponse.setStatusInfo(new StatusInfo("出库成功", "出库成功")); |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
} |
|
|
|
else { |
|
|
|
// 如果不能满足需求
|
|
|
|
|
|
|
|
// 获取对应的拆单记录
|
|
|
|
@ -1206,10 +1212,12 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
|
|
|
|
// 将当前库存设置为0
|
|
|
|
splitInventory.setSaveQuantity(0); |
|
|
|
|
|
|
|
// 修改库存数量
|
|
|
|
splitUnitMapper.updateSplitInventory(splitInventory); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 获取当前父级拆单记录
|
|
|
|
SplitInfo parentSplitInfo = splitUnitMapper.findSplitInfoById(splitInfoById.getParentId()); |
|
|
|
|
|
|
|
@ -1226,10 +1234,17 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
map.put("unit", applicationOutMinById.getUnit()); |
|
|
|
transferMaterial(map); |
|
|
|
} |
|
|
|
}else{ |
|
|
|
trueOut = 0.0; |
|
|
|
splitInventory.setSaveQuantity((int)(oldSplitInventory * 100)); |
|
|
|
splitInventory.setOutQuantity(splitInventory.getOutQuantity() - (int)(oldSplitInventory * 100)); |
|
|
|
// 修改库存数量
|
|
|
|
splitUnitMapper.updateSplitInventory(splitInventory); |
|
|
|
} |
|
|
|
|
|
|
|
updateApplicationMinOutInfo(id, applicationOutMinById, record, trueOut, userByPort, placeId, userAgent); |
|
|
|
} else { |
|
|
|
} |
|
|
|
else { |
|
|
|
// 如果当前拆单没有父级
|
|
|
|
|
|
|
|
|
|
|
|
@ -1314,7 +1329,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
restResponse.setData(""); |
|
|
|
restResponse.setStatusInfo(new StatusInfo("出库失败", "出库失败,库存不足")); |
|
|
|
} |
|
|
|
} else { |
|
|
|
} |
|
|
|
else { |
|
|
|
// 如果大于
|
|
|
|
|
|
|
|
// 获取库存重要减少的数量
|
|
|
|
@ -1333,6 +1349,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
splitInventory.setSaveQuantity(splitInventory.getSaveQuantity() - saveQuantity); |
|
|
|
} |
|
|
|
splitInventory.setOutQuantity(splitInventory.getOutQuantity() + saveQuantity); |
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
|
params.put("mid", inventory.getId()); |
|
|
|
params.put("pid", placeId); |
|
|
|
@ -1346,7 +1364,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
// 如果当前库存中的物料库存不足以出库
|
|
|
|
flag = false; |
|
|
|
} |
|
|
|
} else { |
|
|
|
} |
|
|
|
else { |
|
|
|
restResponse.setStatus(566); |
|
|
|
restResponse.setData(""); |
|
|
|
restResponse.setStatusInfo(new StatusInfo("出库失败", "当前位置未发现该物料")); |
|
|
|
@ -1373,6 +1392,9 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
placeById.setQuantity(placeById.getQuantity() - surplus_redundant); |
|
|
|
placeMapper.UpdatePlace(placeById); |
|
|
|
|
|
|
|
// 修改拆单单位库存
|
|
|
|
splitUnitMapper.updateSplitInventory(splitInventory); |
|
|
|
|
|
|
|
|
|
|
|
// 如果是库存转移订单
|
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
@ -1397,7 +1419,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
} |
|
|
|
else { |
|
|
|
// 如果拆单库存处理记录不存在
|
|
|
|
|
|
|
|
int scale = splitUnitService.findSplitInfoScaleQuantity(splitInfo, -1); |
|
|
|
@ -1465,7 +1488,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
restResponse.setStatusInfo(new StatusInfo("出库成功", "出库成功")); |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
} |
|
|
|
else { |
|
|
|
restResponse.setStatus(508); |
|
|
|
restResponse.setData(""); |
|
|
|
restResponse.setStatusInfo(new StatusInfo("出库失败", "出库失败,库存不足")); |
|
|
|
@ -1521,7 +1545,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
restResponse.setStatus(200); |
|
|
|
restResponse.setData(""); |
|
|
|
restResponse.setStatusInfo(new StatusInfo("出库成功", "出库成功")); |
|
|
|
} else { |
|
|
|
} |
|
|
|
else { |
|
|
|
|
|
|
|
// 如果当前库存拆单记录的库存不能满足需要
|
|
|
|
|
|
|
|
@ -1595,7 +1620,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
restResponse.setData(""); |
|
|
|
restResponse.setStatusInfo(new StatusInfo("出库成功", "出库成功")); |
|
|
|
|
|
|
|
} else { |
|
|
|
} |
|
|
|
else { |
|
|
|
// 如果当前当前父级与其的库存数量不大于要出库的数量
|
|
|
|
|
|
|
|
if (parentSplitInfo.getParentId() != null) { |
|
|
|
@ -1644,7 +1670,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
} else { |
|
|
|
return restResponse1; |
|
|
|
} |
|
|
|
} else { |
|
|
|
} |
|
|
|
else { |
|
|
|
// 如果没有父级
|
|
|
|
|
|
|
|
// 获取当前拆单单位与顶级之间的进制
|
|
|
|
@ -1673,7 +1700,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
placeMapper.updateMaterialAndPlace(materialAndPlace); |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
} |
|
|
|
else { |
|
|
|
// 如果不可出库
|
|
|
|
restResponse.setStatus(508); |
|
|
|
restResponse.setData(""); |
|
|
|
@ -1682,28 +1710,48 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} |
|
|
|
else { |
|
|
|
// 如果已经没有父级
|
|
|
|
|
|
|
|
// 获取顶级与当前单位之间的进制
|
|
|
|
double splitInfoScaleQuantityForAll = splitUnitService.findSplitInfoScaleQuantity(splitInfo, -1); |
|
|
|
// 获取基础单位与当前实际出库单位单位之间的进制
|
|
|
|
double splitInfoScaleQuantityForAll = splitUnitService.findSplitInfoScaleQuantity(realSplitInfo, -1); |
|
|
|
// 计算库存减少的数目
|
|
|
|
int surplus_redundant = (int) Math.ceil(nowQuantity / splitInfoScaleQuantityForAll); |
|
|
|
|
|
|
|
// 获取对应的库存
|
|
|
|
Inventory inventory = materialMapper.findInventoryById(materialAndPlace.getMid()); |
|
|
|
|
|
|
|
if(surplus_redundant == 0) { |
|
|
|
surplus_redundant = 1; |
|
|
|
} |
|
|
|
// 设置当前库存数量
|
|
|
|
materialAndPlace.setQuantity(materialAndPlace.getQuantity() - surplus_redundant); |
|
|
|
inventory.setQuantity(inventory.getQuantity() - surplus_redundant); |
|
|
|
materialAndPlace.setQuantity(materialAndPlace.getQuantity() - surplus_redundant * 100); |
|
|
|
inventory.setQuantity(inventory.getQuantity() - surplus_redundant * 100); |
|
|
|
|
|
|
|
|
|
|
|
// 修改库存数量
|
|
|
|
materialMapper.updateInventory(inventory); |
|
|
|
placeMapper.updateMaterialAndPlace(materialAndPlace); |
|
|
|
|
|
|
|
Map<String,Object> insertForOut = new HashMap<>(); |
|
|
|
insertForOut.put("unit",realSplitInfo.getNewUnit()); |
|
|
|
insertForOut.put("quantity",surplus_redundant * splitInfoScaleQuantityForAll - nowQuantity); |
|
|
|
insertForOut.put("placeId",materialAndPlace.getPid()); |
|
|
|
insertForOut.put("depositoryId",materialAndPlace.getDid()); |
|
|
|
insertForOut.put("mid", inventory.getMid()); |
|
|
|
insertForOut.put("mcode", inventory.getCode()); |
|
|
|
insertForOut.put("type", "in"); |
|
|
|
insertForOut.put("flagForApproval", false); |
|
|
|
splitUnitService.addSplitInventory(insertForOut); |
|
|
|
|
|
|
|
Integer new_id = ObjectFormatUtil.toInteger(insertForOut.get("applicationInIdForOut")); |
|
|
|
depositoryRecordMapper.deleteApplicationInRecordById(new_id); |
|
|
|
|
|
|
|
restResponse.setData(surplus_redundant); |
|
|
|
} |
|
|
|
} else { |
|
|
|
} |
|
|
|
else { |
|
|
|
// 如果不能满足需求
|
|
|
|
|
|
|
|
restResponse.setStatus(508); |
|
|
|
|