|
|
@ -1010,20 +1010,20 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
// 如果物料数量可以出库并且库位数量充足
|
|
|
// 如果物料数量可以出库并且库位数量充足
|
|
|
if (inventory.getQuantity() >= trueOut && flag) { |
|
|
if (inventory.getQuantity() >= trueOut && flag) { |
|
|
// 当前出库数量
|
|
|
// 当前出库数量
|
|
|
Double quantity = trueOut * 100; |
|
|
double quantity = trueOut * 100; |
|
|
inventory.setQuantity(inventory.getQuantity() - quantity.intValue()); |
|
|
inventory.setQuantity(inventory.getQuantity() - (int) quantity); |
|
|
inventory.setNumberOfTemporary(inventory.getNumberOfTemporary() - quantity.intValue()); |
|
|
inventory.setNumberOfTemporary(inventory.getNumberOfTemporary() - (int) quantity); |
|
|
// 修改物料信息
|
|
|
// 修改物料信息
|
|
|
materialMapper.updateInventory(inventory); |
|
|
materialMapper.updateInventory(inventory); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 修改当前库位存放物料的数量
|
|
|
// 修改当前库位存放物料的数量
|
|
|
placeAndMaterialByMidAndPid.setQuantity(placeAndMaterialByMidAndPid.getQuantity() - quantity.intValue()); |
|
|
placeAndMaterialByMidAndPid.setQuantity(placeAndMaterialByMidAndPid.getQuantity() - (int) quantity); |
|
|
placeMapper.updateMaterialAndPlace(placeAndMaterialByMidAndPid); |
|
|
placeMapper.updateMaterialAndPlace(placeAndMaterialByMidAndPid); |
|
|
|
|
|
|
|
|
// 修改库位数量
|
|
|
// 修改库位数量
|
|
|
Place placeById = placeMapper.findPlaceById(placeId); |
|
|
Place placeById = placeMapper.findPlaceById(placeId); |
|
|
placeById.setQuantity(placeById.getQuantity() - quantity.intValue()); |
|
|
placeById.setQuantity(placeById.getQuantity() - (int) quantity); |
|
|
placeMapper.UpdatePlace(placeById); |
|
|
placeMapper.UpdatePlace(placeById); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1057,9 +1057,9 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
materialAndProducedDateByMid) { |
|
|
materialAndProducedDateByMid) { |
|
|
if (materialAndProducedDate.getInventory() > quantity) { |
|
|
if (materialAndProducedDate.getInventory() > quantity) { |
|
|
// 设置使用的数量
|
|
|
// 设置使用的数量
|
|
|
materialAndProducedDate.setExpendnum(materialAndProducedDate.getExpendnum() + quantity.intValue()); |
|
|
materialAndProducedDate.setExpendnum(materialAndProducedDate.getExpendnum() + (int) quantity); |
|
|
// 设置剩余的数量
|
|
|
// 设置剩余的数量
|
|
|
materialAndProducedDate.setInventory(materialAndProducedDate.getInventory() - quantity.intValue()); |
|
|
materialAndProducedDate.setInventory(materialAndProducedDate.getInventory() - (int) quantity); |
|
|
materialMapper.updateMaterialAndProducedDate(materialAndProducedDate); |
|
|
materialMapper.updateMaterialAndProducedDate(materialAndProducedDate); |
|
|
// 跳出循环
|
|
|
// 跳出循环
|
|
|
break; |
|
|
break; |
|
|
@ -1073,8 +1073,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
restResponse.setData(""); |
|
|
restResponse.setData(""); |
|
|
restResponse.setStatusInfo(new StatusInfo("出库失败", "出库失败,库存不足")); |
|
|
restResponse.setStatusInfo(new StatusInfo("出库失败", "出库失败,库存不足")); |
|
|
} |
|
|
} |
|
|
} |
|
|
} else { |
|
|
else { |
|
|
|
|
|
// 如果是拆单后的出库
|
|
|
// 如果是拆单后的出库
|
|
|
|
|
|
|
|
|
// 用于获取对应的拆单记录
|
|
|
// 用于获取对应的拆单记录
|
|
|
@ -1179,8 +1178,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
updateApplicationMinOutInfo(id, applicationOutMinById, record, trueOut, userByPort, placeId, userAgent); |
|
|
updateApplicationMinOutInfo(id, applicationOutMinById, record, trueOut, userByPort, placeId, userAgent); |
|
|
} |
|
|
} else { |
|
|
else { |
|
|
|
|
|
// 如果当前拆单没有父级
|
|
|
// 如果当前拆单没有父级
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1233,7 +1231,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
// 如果是库存转移订单
|
|
|
// 如果是库存转移订单
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
if (record.getIstransfer() == 1) { |
|
|
if (record.getIstransfer() == 1) { |
|
|
map.put("quantity", "1"); |
|
|
map.put("quantity", trueOut.toString()); |
|
|
map.put("applicantId", record.getApplicantId()); |
|
|
map.put("applicantId", record.getApplicantId()); |
|
|
map.put("minRecordId", applicationOutMinById.getId()); // 出库订单编号
|
|
|
map.put("minRecordId", applicationOutMinById.getId()); // 出库订单编号
|
|
|
transferMaterial(map); |
|
|
transferMaterial(map); |
|
|
@ -1260,14 +1258,12 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
restResponse.setData(""); |
|
|
restResponse.setData(""); |
|
|
restResponse.setStatusInfo(new StatusInfo("出库成功", "出库成功")); |
|
|
restResponse.setStatusInfo(new StatusInfo("出库成功", "出库成功")); |
|
|
|
|
|
|
|
|
} |
|
|
} else { |
|
|
else { |
|
|
|
|
|
restResponse.setStatus(508); |
|
|
restResponse.setStatus(508); |
|
|
restResponse.setData(""); |
|
|
restResponse.setData(""); |
|
|
restResponse.setStatusInfo(new StatusInfo("出库失败", "出库失败,库存不足")); |
|
|
restResponse.setStatusInfo(new StatusInfo("出库失败", "出库失败,库存不足")); |
|
|
} |
|
|
} |
|
|
} |
|
|
} else { |
|
|
else { |
|
|
|
|
|
// 如果大于
|
|
|
// 如果大于
|
|
|
|
|
|
|
|
|
// 获取库存重要减少的数量
|
|
|
// 获取库存重要减少的数量
|
|
|
@ -1330,7 +1326,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
// 如果是库存转移订单
|
|
|
// 如果是库存转移订单
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
if (record.getIstransfer() == 1) { |
|
|
if (record.getIstransfer() == 1) { |
|
|
map.put("quantity", String.valueOf((double)surplus_redundant / 100)); |
|
|
map.put("quantity", String.valueOf(trueOut)); |
|
|
map.put("applicantId", record.getApplicantId()); |
|
|
map.put("applicantId", record.getApplicantId()); |
|
|
map.put("minRecordId", applicationOutMinById.getId()); // 出库订单编号
|
|
|
map.put("minRecordId", applicationOutMinById.getId()); // 出库订单编号
|
|
|
transferMaterial(map); |
|
|
transferMaterial(map); |
|
|
@ -1350,8 +1346,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} else { |
|
|
else { |
|
|
|
|
|
// 如果拆单库存处理记录不存在
|
|
|
// 如果拆单库存处理记录不存在
|
|
|
|
|
|
|
|
|
int scale = splitUnitService.findSplitInfoScaleQuantity(splitInfo, -1); |
|
|
int scale = splitUnitService.findSplitInfoScaleQuantity(splitInfo, -1); |
|
|
@ -1391,11 +1386,13 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
} else { |
|
|
} else { |
|
|
insertForSplitInventory.put("price", 0); |
|
|
insertForSplitInventory.put("price", 0); |
|
|
} |
|
|
} |
|
|
insertForSplitInventory.put("quantity", residue_realQuantity); |
|
|
insertForSplitInventory.put("quantity", String.valueOf(residue_realQuantity)); |
|
|
insertForSplitInventory.put("unit", unit); |
|
|
insertForSplitInventory.put("unit", unit); |
|
|
insertForSplitInventory.put("depositoryId", applicationOutMinById.getDepositoryId()); |
|
|
insertForSplitInventory.put("depositoryId", applicationOutMinById.getDepositoryId()); |
|
|
insertForSplitInventory.put("placeId", placeAndMaterialByMidAndPid.getPid()); |
|
|
insertForSplitInventory.put("placeId", placeAndMaterialByMidAndPid.getPid()); |
|
|
insertForSplitInventory.put("type", "in"); |
|
|
insertForSplitInventory.put("type", "in"); |
|
|
|
|
|
insertForSplitInventory.put("flagForApproval", false); |
|
|
|
|
|
|
|
|
splitUnitService.addSplitInventory(insertForSplitInventory); |
|
|
splitUnitService.addSplitInventory(insertForSplitInventory); |
|
|
Integer new_id = ObjectFormatUtil.toInteger(insertForSplitInventory.get("newInMid")); |
|
|
Integer new_id = ObjectFormatUtil.toInteger(insertForSplitInventory.get("newInMid")); |
|
|
depositoryRecordMapper.deleteApplicationInRecordById(new_id); |
|
|
depositoryRecordMapper.deleteApplicationInRecordById(new_id); |
|
|
@ -1404,7 +1401,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
// 如果是库存转移订单
|
|
|
// 如果是库存转移订单
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
if (record.getIstransfer() == 1) { |
|
|
if (record.getIstransfer() == 1) { |
|
|
map.put("quantity", String.valueOf(residue)); |
|
|
map.put("quantity", String.valueOf(trueOut)); |
|
|
map.put("applicantId", record.getApplicantId()); |
|
|
map.put("applicantId", record.getApplicantId()); |
|
|
map.put("minRecordId", applicationOutMinById.getId()); // 出库订单编号
|
|
|
map.put("minRecordId", applicationOutMinById.getId()); // 出库订单编号
|
|
|
transferMaterial(map); |
|
|
transferMaterial(map); |
|
|
@ -1785,7 +1782,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
map.put("pass", pass); |
|
|
map.put("pass", pass); |
|
|
map.put("id", record.getId()); |
|
|
map.put("id", record.getId()); |
|
|
map.put("outTime",System.currentTimeMillis()); |
|
|
map.put("outTime", System.currentTimeMillis()); |
|
|
// 修改状态为完成
|
|
|
// 修改状态为完成
|
|
|
depositoryRecordMapper.updateApplicationOutRecord(map); |
|
|
depositoryRecordMapper.updateApplicationOutRecord(map); |
|
|
|
|
|
|
|
|
@ -2265,8 +2262,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
if ("".equals(toPlaceId) || "0".equals(toPlaceId)) { |
|
|
if ("".equals(toPlaceId) || "0".equals(toPlaceId)) { |
|
|
map.put("toPlaceId", 0); |
|
|
map.put("toPlaceId", 0); |
|
|
} |
|
|
} |
|
|
|
|
|
map.put("quantity", (int) (quantity * 100)); |
|
|
// depositoryRecordMapper.insertApplicationInRecord(map);
|
|
|
|
|
|
transferRecordMapper.addTransferRecord(map);// 插入转移记录
|
|
|
transferRecordMapper.addTransferRecord(map);// 插入转移记录
|
|
|
Integer transferId = ObjectFormatUtil.toInteger(map.get("id")); |
|
|
Integer transferId = ObjectFormatUtil.toInteger(map.get("id")); |
|
|
//清除主键
|
|
|
//清除主键
|
|
|
@ -2918,7 +2914,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
map.put("depositoryId", transferRecord.getToId()); |
|
|
map.put("depositoryId", transferRecord.getToId()); |
|
|
map.put("placeId", transferRecord.getToPlaceId()); |
|
|
map.put("placeId", transferRecord.getToPlaceId()); |
|
|
map.put("unit", unit); |
|
|
map.put("unit", unit); |
|
|
if ("-1".equals(unit)) { |
|
|
if ("-1".equals(unit) || inventoryById.getUnit().equals(unit)) { |
|
|
// 如果是基础单位
|
|
|
// 如果是基础单位
|
|
|
|
|
|
|
|
|
if (inventories.size() > 0) { |
|
|
if (inventories.size() > 0) { |
|
|
@ -2932,18 +2928,18 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 进行入库操作
|
|
|
// 进行入库操作
|
|
|
applicationInPlace(map, false); |
|
|
applicationInPlace(map, true); |
|
|
} else { |
|
|
} else { |
|
|
// 如果不在该仓库,插入一条新记录
|
|
|
// 如果不在该仓库,插入一条新记录
|
|
|
Map<String, Object> insert = new HashMap<>(); |
|
|
Map<String, Object> insert = new HashMap<>(); |
|
|
// 转移数量
|
|
|
// 转移数量
|
|
|
Integer quantity = ObjectFormatUtil.toInteger(map.get("quantity")); |
|
|
Double quantity = ObjectFormatUtil.toDouble(map.get("quantity")); |
|
|
// 转移到的仓库
|
|
|
// 转移到的仓库
|
|
|
insert.put("depositoryId", transferRecord.getToId()); |
|
|
insert.put("depositoryId", transferRecord.getToId()); |
|
|
// 库存物料
|
|
|
// 库存物料
|
|
|
insert.put("mid", inventoryById.getMid()); |
|
|
insert.put("mid", inventoryById.getMid()); |
|
|
// 数量
|
|
|
// 数量
|
|
|
insert.put("quantity", quantity); |
|
|
insert.put("quantity", (int) (quantity * 100)); |
|
|
// 仓库编码
|
|
|
// 仓库编码
|
|
|
insert.put("depositoryCode", inventoryById.getDepositoryCode()); |
|
|
insert.put("depositoryCode", inventoryById.getDepositoryCode()); |
|
|
// 生产日期
|
|
|
// 生产日期
|
|
|
@ -2961,13 +2957,13 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
|
|
|
|
|
// 转入库位
|
|
|
// 转入库位
|
|
|
Place toPlace = placeMapper.findPlaceById(transferRecord.getToPlaceId()); |
|
|
Place toPlace = placeMapper.findPlaceById(transferRecord.getToPlaceId()); |
|
|
toPlace.setQuantity(toPlace.getQuantity() + quantity); |
|
|
toPlace.setQuantity(toPlace.getQuantity() + (int) (quantity * 100)); |
|
|
placeMapper.UpdatePlace(toPlace); // 修改转入库位额度
|
|
|
placeMapper.UpdatePlace(toPlace); // 修改转入库位额度
|
|
|
|
|
|
|
|
|
// 设置参数
|
|
|
// 设置参数
|
|
|
toPlaceTemp.put("mid", inventory.getId()); |
|
|
toPlaceTemp.put("mid", inventory.getId()); |
|
|
toPlaceTemp.put("pid", toPlace.getId()); |
|
|
toPlaceTemp.put("pid", toPlace.getId()); |
|
|
toPlaceTemp.put("quantity", quantity); |
|
|
toPlaceTemp.put("quantity", (int) (quantity * 100)); |
|
|
// 获取转入物料具体所在库位
|
|
|
// 获取转入物料具体所在库位
|
|
|
MaterialAndPlace toMaterialAndPlace = placeMapper.findPlaceAndMaterialByMidAndPid(toPlaceTemp); |
|
|
MaterialAndPlace toMaterialAndPlace = placeMapper.findPlaceAndMaterialByMidAndPid(toPlaceTemp); |
|
|
if (toMaterialAndPlace == null) { |
|
|
if (toMaterialAndPlace == null) { |
|
|
@ -2975,7 +2971,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
placeMapper.addMaterialOnPlace(toPlaceTemp); |
|
|
placeMapper.addMaterialOnPlace(toPlaceTemp); |
|
|
} else { |
|
|
} else { |
|
|
// 如果存在记录
|
|
|
// 如果存在记录
|
|
|
toMaterialAndPlace.setQuantity(toMaterialAndPlace.getQuantity() + quantity); |
|
|
toMaterialAndPlace.setQuantity(toMaterialAndPlace.getQuantity() + (int) (quantity * 100)); |
|
|
placeMapper.updateMaterialAndPlace(toMaterialAndPlace); |
|
|
placeMapper.updateMaterialAndPlace(toMaterialAndPlace); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
@ -2993,7 +2989,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
int scaleQuantity = splitUnitService.findSplitInfoScaleQuantity(splitInfo, -1); |
|
|
int scaleQuantity = splitUnitService.findSplitInfoScaleQuantity(splitInfo, -1); |
|
|
|
|
|
|
|
|
// 获取当前转移的数量
|
|
|
// 获取当前转移的数量
|
|
|
Integer quantity = ObjectFormatUtil.toInteger(map.get("quantity")); |
|
|
Double quantity = ObjectFormatUtil.toDouble(map.get("quantity")); |
|
|
|
|
|
|
|
|
if (inventories.size() > 0) { |
|
|
if (inventories.size() > 0) { |
|
|
// 如果在转入的仓库中存在该物料的库存记录
|
|
|
// 如果在转入的仓库中存在该物料的库存记录
|
|
|
@ -3007,11 +3003,11 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
paramForInventoryToPlace.put("mid", inventory.getId()); |
|
|
paramForInventoryToPlace.put("mid", inventory.getId()); |
|
|
// 获取当前物料是否存在于当前库位
|
|
|
// 获取当前物料是否存在于当前库位
|
|
|
MaterialAndPlace placeAndMaterial = placeMapper.findPlaceAndMaterialByMidAndPid(paramForInventoryToPlace); |
|
|
MaterialAndPlace placeAndMaterial = placeMapper.findPlaceAndMaterialByMidAndPid(paramForInventoryToPlace); |
|
|
|
|
|
Map<String, Object> paramForSplitInventory = new HashMap<>(); |
|
|
if (placeAndMaterial != null) { |
|
|
if (placeAndMaterial != null) { |
|
|
// 如果存在于当前库位
|
|
|
// 如果存在于当前库位
|
|
|
|
|
|
|
|
|
// 用于查询当前拆单记录的库存记录
|
|
|
// 用于查询当前拆单记录的库存记录
|
|
|
Map<String, Object> paramForSplitInventory = new HashMap<>(); |
|
|
|
|
|
paramForSplitInventory.put("sid", splitInfo.getId()); |
|
|
paramForSplitInventory.put("sid", splitInfo.getId()); |
|
|
paramForSplitInventory.put("iid", placeAndMaterial.getId()); |
|
|
paramForSplitInventory.put("iid", placeAndMaterial.getId()); |
|
|
|
|
|
|
|
|
@ -3020,13 +3016,13 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
if (splitInventory != null) { |
|
|
if (splitInventory != null) { |
|
|
|
|
|
|
|
|
// 如果存在该库存记录
|
|
|
// 如果存在该库存记录
|
|
|
if (splitInfo.getQuantity() >= splitInventory.getSaveQuantity() + quantity) { |
|
|
if (splitInfo.getQuantity() * 100 >= splitInventory.getSaveQuantity() + quantity * 100) { |
|
|
// 如果没达到当前进制数量
|
|
|
// 如果没达到当前进制数量
|
|
|
|
|
|
|
|
|
// 设置当前转移后的库存数量
|
|
|
// 设置当前转移后的库存数量
|
|
|
splitInventory.setSaveQuantity(splitInventory.getSaveQuantity() + quantity); |
|
|
splitInventory.setSaveQuantity(splitInventory.getSaveQuantity() + (int) (quantity * 100)); |
|
|
// 设置当前增加的数量
|
|
|
// 设置当前增加的数量
|
|
|
splitInventory.setInQuantity(splitInventory.getInQuantity() + quantity); |
|
|
splitInventory.setInQuantity(splitInventory.getInQuantity() + (int) (quantity * 100)); |
|
|
// 修改当前拆单库存处理记录
|
|
|
// 修改当前拆单库存处理记录
|
|
|
splitUnitMapper.updateSplitInventory(splitInventory); |
|
|
splitUnitMapper.updateSplitInventory(splitInventory); |
|
|
} else { |
|
|
} else { |
|
|
@ -3034,26 +3030,26 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 计算当前转移的处理数量,即进位数(下取整)
|
|
|
// 计算当前转移的处理数量,即进位数(下取整)
|
|
|
int disposeQuantity = (int) Math.round(Math.floor(quantity / (double) splitInfo.getQuantity())); |
|
|
double disposeQuantity = Math.round(Math.floor(quantity / (double) splitInfo.getQuantity())); |
|
|
|
|
|
|
|
|
// 最终存储到拆单处理的数量(进位后剩余的数量)
|
|
|
// 最终存储到拆单处理的数量(进位后剩余的数量)
|
|
|
double saveQuantity = quantity - disposeQuantity * splitInfo.getQuantity(); |
|
|
double saveQuantity = quantity - disposeQuantity * splitInfo.getQuantity(); |
|
|
|
|
|
|
|
|
// 最终存储数量(现存数量+进位后剩余数量)
|
|
|
// 最终存储数量(现存数量+进位后剩余数量)
|
|
|
int realQuantity = (int) Math.round(saveQuantity) + splitInventory.getSaveQuantity(); |
|
|
double realQuantity = Math.round(saveQuantity) + (int) (splitInventory.getSaveQuantity() / 100); |
|
|
|
|
|
|
|
|
if (realQuantity >= splitInfo.getQuantity()) { |
|
|
if (realQuantity >= splitInfo.getQuantity()) { |
|
|
// 如果当前入库的数量大于拆单规定的进制数量
|
|
|
// 如果当前入库的数量大于拆单规定的进制数量
|
|
|
|
|
|
|
|
|
// 计算要进的数目
|
|
|
// 计算要进的数目
|
|
|
int quantity_in = (realQuantity / splitInfo.getQuantity()); |
|
|
int quantity_in = (int)(realQuantity / splitInfo.getQuantity()); |
|
|
// 更新处理数量
|
|
|
// 更新处理数量
|
|
|
disposeQuantity += quantity_in; |
|
|
disposeQuantity += quantity_in; |
|
|
// 拆单库存实际入库的数量
|
|
|
// 拆单库存实际入库的数量
|
|
|
realQuantity = realQuantity - quantity_in * splitInfo.getQuantity(); |
|
|
realQuantity = realQuantity - quantity_in * splitInfo.getQuantity(); |
|
|
} |
|
|
} |
|
|
// 设置当前计量单位的库存
|
|
|
// 设置当前计量单位的库存
|
|
|
splitInventory.setSaveQuantity(realQuantity); |
|
|
splitInventory.setSaveQuantity((int) (realQuantity * 100)); |
|
|
// 更新当前数据
|
|
|
// 更新当前数据
|
|
|
splitUnitMapper.updateSplitInventory(splitInventory); |
|
|
splitUnitMapper.updateSplitInventory(splitInventory); |
|
|
if (disposeQuantity != 0) { |
|
|
if (disposeQuantity != 0) { |
|
|
@ -3080,9 +3076,10 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
SplitInfo parentSplitInfo = splitUnitMapper.findSplitInfoById(splitInfo.getParentId()); |
|
|
SplitInfo parentSplitInfo = splitUnitMapper.findSplitInfoById(splitInfo.getParentId()); |
|
|
splitUnitService.updateSplitInfoSaveQuantity(parentSplitInfo, disposeQuantity, placeAndMaterial.getId(), map, quantity, splitInfo); |
|
|
splitUnitService.updateSplitInfoSaveQuantity(parentSplitInfo, disposeQuantity, placeAndMaterial.getId(), map, quantity, splitInfo); |
|
|
} else { |
|
|
} else { |
|
|
applicationInPlace(map, false); |
|
|
applicationInPlace(map, true); |
|
|
map.put("applicationInId", map.get("id")); |
|
|
// map.put("applicationInId", map.get("id"));
|
|
|
map.remove("id"); |
|
|
depositoryRecordMapper.deleteApplicationInRecordById(ObjectFormatUtil.toInteger(map.get("id"))); |
|
|
|
|
|
// map.remove("id");
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
@ -3099,28 +3096,29 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
if (quantity < splitInfo.getQuantity()) { |
|
|
if (quantity < splitInfo.getQuantity()) { |
|
|
// 如果当前转移数量小于进制数量
|
|
|
// 如果当前转移数量小于进制数量
|
|
|
|
|
|
|
|
|
|
|
|
insertForSplitInventory.put("flagForApproval", true); |
|
|
// 设置入库数量
|
|
|
// 设置入库数量
|
|
|
insertForSplitInventory.put("inQuantity", quantity); |
|
|
insertForSplitInventory.put("inQuantity", (int) (quantity * 100)); |
|
|
// 设置当前库存数
|
|
|
// 设置当前库存数
|
|
|
insertForSplitInventory.put("saveQuantity", quantity); |
|
|
insertForSplitInventory.put("saveQuantity", (int) (quantity * 100)); |
|
|
splitUnitMapper.addSplitInventory(insertForSplitInventory); |
|
|
splitUnitMapper.addSplitInventory(insertForSplitInventory); |
|
|
} else { |
|
|
} else { |
|
|
// 如果不小于
|
|
|
// 如果不小于
|
|
|
|
|
|
|
|
|
// 计算处理数量(下取整)
|
|
|
// 计算处理数量(下取整)
|
|
|
int disposeQuantity = (int) Math.round(Math.floor(quantity / (double) splitInfo.getQuantity())); |
|
|
double disposeQuantity = Math.round(Math.floor(quantity / (double) splitInfo.getQuantity())); |
|
|
|
|
|
|
|
|
// 最终存储到拆单处理的数量
|
|
|
// 最终存储到拆单处理的数量
|
|
|
double saveQuantity = quantity - disposeQuantity * splitInfo.getQuantity(); |
|
|
double saveQuantity = quantity - disposeQuantity * splitInfo.getQuantity(); |
|
|
|
|
|
|
|
|
// 最终存储数量
|
|
|
// 最终存储数量
|
|
|
int realQuantity = (int) Math.round(saveQuantity); |
|
|
double realQuantity = Math.round(saveQuantity); |
|
|
|
|
|
|
|
|
if (realQuantity >= splitInfo.getQuantity()) { |
|
|
if (realQuantity >= splitInfo.getQuantity()) { |
|
|
// 如果当前入库的数量大于拆单规定的进制数量
|
|
|
// 如果当前入库的数量大于拆单规定的进制数量
|
|
|
|
|
|
|
|
|
// 计算要进的数目
|
|
|
// 计算要进的数目
|
|
|
int quantity_in = (realQuantity / splitInfo.getQuantity()); |
|
|
int quantity_in = (int)(realQuantity / splitInfo.getQuantity()); |
|
|
// 更新处理数量
|
|
|
// 更新处理数量
|
|
|
disposeQuantity += quantity_in; |
|
|
disposeQuantity += quantity_in; |
|
|
// 拆单库存实际入库的数量
|
|
|
// 拆单库存实际入库的数量
|
|
|
@ -3130,7 +3128,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
// 设置入库数量
|
|
|
// 设置入库数量
|
|
|
insertForSplitInventory.put("inQuantity", 0); |
|
|
insertForSplitInventory.put("inQuantity", 0); |
|
|
// 设置当前计量单位的库存
|
|
|
// 设置当前计量单位的库存
|
|
|
insertForSplitInventory.put("saveQuantity", realQuantity); |
|
|
insertForSplitInventory.put("saveQuantity", (int) (realQuantity * 100)); |
|
|
|
|
|
|
|
|
// 先添加一条拆单库存记录
|
|
|
// 先添加一条拆单库存记录
|
|
|
splitUnitMapper.addSplitInventory(insertForSplitInventory); |
|
|
splitUnitMapper.addSplitInventory(insertForSplitInventory); |
|
|
@ -3169,17 +3167,16 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
// 如果不存在于当前库位
|
|
|
// 如果不存在于当前库位
|
|
|
|
|
|
|
|
|
// 用于添加一条物料于库位的对应关系
|
|
|
// 用于添加一条物料于库位的对应关系
|
|
|
Map<String, Object> insertForMaterialAndPlace = new HashMap<>(); |
|
|
paramForSplitInventory.put("mid", inventory.getId()); |
|
|
insertForMaterialAndPlace.put("mid", inventory.getId()); |
|
|
paramForSplitInventory.put("pid", transferRecord.getToPlaceId()); |
|
|
insertForMaterialAndPlace.put("pid", transferRecord.getToPlaceId()); |
|
|
paramForSplitInventory.put("quantity", 0); |
|
|
insertForMaterialAndPlace.put("quantity", 0); |
|
|
|
|
|
// 先添加一条记录
|
|
|
// 先添加一条记录
|
|
|
placeMapper.addMaterialOnPlace(insertForMaterialAndPlace); |
|
|
placeMapper.addMaterialOnPlace(paramForSplitInventory); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 用于插入拆单库存记录
|
|
|
// 用于插入拆单库存记录
|
|
|
Map<String, Object> insertForSplitInventory = new HashMap<>(); |
|
|
Map<String, Object> insertForSplitInventory = new HashMap<>(); |
|
|
insertForSplitInventory.put("iid", insertForMaterialAndPlace.get("id")); |
|
|
insertForSplitInventory.put("iid", paramForSplitInventory.get("id")); |
|
|
insertForSplitInventory.put("sid", splitInfo.getId()); |
|
|
insertForSplitInventory.put("sid", splitInfo.getId()); |
|
|
insertForSplitInventory.put("outQuantity", 0); |
|
|
insertForSplitInventory.put("outQuantity", 0); |
|
|
|
|
|
|
|
|
@ -3187,9 +3184,9 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
// 如果当前转移数量小于进制数量
|
|
|
// 如果当前转移数量小于进制数量
|
|
|
|
|
|
|
|
|
// 设置入库数量
|
|
|
// 设置入库数量
|
|
|
insertForSplitInventory.put("inQuantity", quantity); |
|
|
insertForSplitInventory.put("inQuantity", (int) (quantity * 100)); |
|
|
// 设置当前库存数
|
|
|
// 设置当前库存数
|
|
|
insertForSplitInventory.put("saveQuantity", quantity); |
|
|
insertForSplitInventory.put("saveQuantity", (int) (quantity * 100)); |
|
|
splitUnitMapper.addSplitInventory(insertForSplitInventory); |
|
|
splitUnitMapper.addSplitInventory(insertForSplitInventory); |
|
|
} else { |
|
|
} else { |
|
|
// 如果不小于
|
|
|
// 如果不小于
|
|
|
@ -3200,7 +3197,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
} else { |
|
|
} else { |
|
|
map.put("price", 0); |
|
|
map.put("price", 0); |
|
|
} |
|
|
} |
|
|
updateSplitInventoryForMoreScale(inventoryById, map, splitInfo, quantity, insertForMaterialAndPlace, insertForSplitInventory); |
|
|
updateSplitInventoryForMoreScale(inventoryById, map, splitInfo, quantity, paramForSplitInventory, insertForSplitInventory); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -3238,9 +3235,9 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
// 如果当前转移数量小于进制数量
|
|
|
// 如果当前转移数量小于进制数量
|
|
|
|
|
|
|
|
|
// 设置入库数量
|
|
|
// 设置入库数量
|
|
|
insertForSplitInventory.put("inQuantity", quantity); |
|
|
insertForSplitInventory.put("inQuantity", (int) (quantity * 100)); |
|
|
// 设置当前库存数
|
|
|
// 设置当前库存数
|
|
|
insertForSplitInventory.put("saveQuantity", quantity); |
|
|
insertForSplitInventory.put("saveQuantity", (int) (quantity * 100)); |
|
|
splitUnitMapper.addSplitInventory(insertForSplitInventory); |
|
|
splitUnitMapper.addSplitInventory(insertForSplitInventory); |
|
|
} else { |
|
|
} else { |
|
|
// 如果不小于
|
|
|
// 如果不小于
|
|
|
@ -3269,22 +3266,22 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
* @param insertForMaterialAndPlace 用于添加物料与库位对应关系的数据 |
|
|
* @param insertForMaterialAndPlace 用于添加物料与库位对应关系的数据 |
|
|
* @param insertForSplitInventory 用于添加一条新的拆单库存处理记录 |
|
|
* @param insertForSplitInventory 用于添加一条新的拆单库存处理记录 |
|
|
*/ |
|
|
*/ |
|
|
void updateSplitInventoryForMoreScale(Inventory material, Map<String, Object> map, SplitInfo splitInfo, Integer quantity, Map<String, Object> insertForMaterialAndPlace, Map<String, Object> insertForSplitInventory) { |
|
|
void updateSplitInventoryForMoreScale(Inventory material, Map<String, Object> map, SplitInfo splitInfo, double quantity, Map<String, Object> insertForMaterialAndPlace, Map<String, Object> insertForSplitInventory) { |
|
|
|
|
|
|
|
|
// 计算处理数量(下取整)
|
|
|
// 计算处理数量(下取整)
|
|
|
int disposeQuantity = (int) Math.round(Math.floor(quantity / (double) splitInfo.getQuantity())); |
|
|
double disposeQuantity = Math.round(Math.floor(quantity / (double) splitInfo.getQuantity())); |
|
|
|
|
|
|
|
|
// 最终存储到拆单处理的数量
|
|
|
// 最终存储到拆单处理的数量
|
|
|
double saveQuantity = quantity - disposeQuantity * splitInfo.getQuantity(); |
|
|
double saveQuantity = quantity - disposeQuantity * splitInfo.getQuantity(); |
|
|
|
|
|
|
|
|
// 最终存储数量
|
|
|
// 最终存储数量
|
|
|
int realQuantity = (int) Math.round(saveQuantity); |
|
|
double realQuantity = Math.round(saveQuantity); |
|
|
|
|
|
|
|
|
if (realQuantity >= splitInfo.getQuantity()) { |
|
|
if (realQuantity >= splitInfo.getQuantity()) { |
|
|
// 如果当前入库的数量大于拆单规定的进制数量
|
|
|
// 如果当前入库的数量大于拆单规定的进制数量
|
|
|
|
|
|
|
|
|
// 计算要进的数目
|
|
|
// 计算要进的数目
|
|
|
int quantity_in = (realQuantity / splitInfo.getQuantity()); |
|
|
int quantity_in = (int)(realQuantity / splitInfo.getQuantity()); |
|
|
// 更新处理数量
|
|
|
// 更新处理数量
|
|
|
disposeQuantity += quantity_in; |
|
|
disposeQuantity += quantity_in; |
|
|
// 拆单库存实际入库的数量
|
|
|
// 拆单库存实际入库的数量
|
|
|
@ -3294,7 +3291,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
// 设置入库数量
|
|
|
// 设置入库数量
|
|
|
insertForSplitInventory.put("inQuantity", 0); |
|
|
insertForSplitInventory.put("inQuantity", 0); |
|
|
// 设置当前计量单位的库存
|
|
|
// 设置当前计量单位的库存
|
|
|
insertForSplitInventory.put("saveQuantity", realQuantity); |
|
|
insertForSplitInventory.put("saveQuantity", (int) (realQuantity * 100)); |
|
|
|
|
|
|
|
|
// 先添加一条拆单库存记录
|
|
|
// 先添加一条拆单库存记录
|
|
|
splitUnitMapper.addSplitInventory(insertForSplitInventory); |
|
|
splitUnitMapper.addSplitInventory(insertForSplitInventory); |
|
|
@ -3312,7 +3309,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
map.put("newInMid", insertForMaterialAndPlace.get("id")); |
|
|
map.put("newInMid", insertForMaterialAndPlace.get("id")); |
|
|
|
|
|
|
|
|
// 实际入库数量
|
|
|
// 实际入库数量
|
|
|
map.put("realQuantity", quantity.toString()); |
|
|
map.put("realQuantity", String.valueOf(quantity)); |
|
|
if (splitInfo.getParentId() != null) { |
|
|
if (splitInfo.getParentId() != null) { |
|
|
SplitInfo parentSplitInfo = splitUnitMapper.findSplitInfoById(splitInfo.getParentId()); |
|
|
SplitInfo parentSplitInfo = splitUnitMapper.findSplitInfoById(splitInfo.getParentId()); |
|
|
splitUnitService.updateSplitInfoSaveQuantity(parentSplitInfo, disposeQuantity, ObjectFormatUtil.toInteger(insertForMaterialAndPlace.get("id")), map, quantity, splitInfo); |
|
|
splitUnitService.updateSplitInfoSaveQuantity(parentSplitInfo, disposeQuantity, ObjectFormatUtil.toInteger(insertForMaterialAndPlace.get("id")), map, quantity, splitInfo); |
|
|
|