|
|
@ -262,7 +262,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
String code = createCode(dname, "outOrderNumber", "out", company.getName()); |
|
|
String code = createCode(dname, "outOrderNumber", "out", company.getName()); |
|
|
map.put("code", code); |
|
|
map.put("code", code); |
|
|
map.put("pass", 3); |
|
|
map.put("pass", 3); |
|
|
map.put("quantity",quantity); |
|
|
map.put("quantity", quantity); |
|
|
return depositoryRecordMapper.insertApplicationOutRecord(map); |
|
|
return depositoryRecordMapper.insertApplicationOutRecord(map); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -865,7 +865,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
public List<ApplicationOutRecordMinP> findApplicationOutRecordMinByParent(Integer id) { |
|
|
public List<ApplicationOutRecordMinP> findApplicationOutRecordMinByParent(Integer id) { |
|
|
List<ApplicationOutRecordMin> outRecordMinByParent = depositoryRecordMapper.findApplicationOutRecordMinByParent(id); |
|
|
List<ApplicationOutRecordMin> outRecordMinByParent = depositoryRecordMapper.findApplicationOutRecordMinByParent(id); |
|
|
List<ApplicationOutRecordMinP> recordMinPList = new ArrayList<>(); |
|
|
List<ApplicationOutRecordMinP> recordMinPList = new ArrayList<>(); |
|
|
for (ApplicationOutRecordMin aorm:outRecordMinByParent |
|
|
for (ApplicationOutRecordMin aorm : outRecordMinByParent |
|
|
) { |
|
|
) { |
|
|
ApplicationOutRecordMinP aormP = new ApplicationOutRecordMinP(aorm); |
|
|
ApplicationOutRecordMinP aormP = new ApplicationOutRecordMinP(aorm); |
|
|
recordMinPList.add(aormP); |
|
|
recordMinPList.add(aormP); |
|
|
@ -894,7 +894,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
public List<ApplicationOutRecordMinP> findApplicationOutMinByCondition(Map<String, Object> map) { |
|
|
public List<ApplicationOutRecordMinP> findApplicationOutMinByCondition(Map<String, Object> map) { |
|
|
List<ApplicationOutRecordMin> condition = depositoryRecordMapper.findApplicationOutMinByCondition(map); |
|
|
List<ApplicationOutRecordMin> condition = depositoryRecordMapper.findApplicationOutMinByCondition(map); |
|
|
List<ApplicationOutRecordMinP> result = new ArrayList<>(); |
|
|
List<ApplicationOutRecordMinP> result = new ArrayList<>(); |
|
|
for (ApplicationOutRecordMin aorm:condition |
|
|
for (ApplicationOutRecordMin aorm : condition |
|
|
) { |
|
|
) { |
|
|
result.add(new ApplicationOutRecordMinP(aorm)); |
|
|
result.add(new ApplicationOutRecordMinP(aorm)); |
|
|
} |
|
|
} |
|
|
@ -913,7 +913,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
map.put("parentId", parentId); |
|
|
map.put("parentId", parentId); |
|
|
List<ApplicationOutRecordMin> applicationOutMinByCondition = depositoryRecordMapper.findApplicationOutMinByCondition(map); |
|
|
List<ApplicationOutRecordMin> applicationOutMinByCondition = depositoryRecordMapper.findApplicationOutMinByCondition(map); |
|
|
List<ApplicationOutRecordMinP> applicationOutRecordMinPList = new ArrayList<>(); |
|
|
List<ApplicationOutRecordMinP> applicationOutRecordMinPList = new ArrayList<>(); |
|
|
for (ApplicationOutRecordMin recordMin:applicationOutMinByCondition |
|
|
for (ApplicationOutRecordMin recordMin : applicationOutMinByCondition |
|
|
) { |
|
|
) { |
|
|
ApplicationOutRecordMinP recordMinP = new ApplicationOutRecordMinP(recordMin); |
|
|
ApplicationOutRecordMinP recordMinP = new ApplicationOutRecordMinP(recordMin); |
|
|
applicationOutRecordMinPList.add(recordMinP); |
|
|
applicationOutRecordMinPList.add(recordMinP); |
|
|
@ -953,7 +953,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
Integer istransfer = record.getIstransfer(); |
|
|
Integer istransfer = record.getIstransfer(); |
|
|
|
|
|
|
|
|
// 获取要出库的数量
|
|
|
// 获取要出库的数量
|
|
|
Integer trueOut = ObjectFormatUtil.toInteger(param.get("trueOut")); |
|
|
Double trueOut = ObjectFormatUtil.toDouble(param.get("trueOut")); |
|
|
// 获取出库库位
|
|
|
// 获取出库库位
|
|
|
Integer placeId = ObjectFormatUtil.toInteger(param.get("placeId")); |
|
|
Integer placeId = ObjectFormatUtil.toInteger(param.get("placeId")); |
|
|
|
|
|
|
|
|
@ -978,7 +978,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
placeAndMaterialByMidAndPid = placeMapper.findPlaceAndMaterialByMidAndPid(params); |
|
|
placeAndMaterialByMidAndPid = placeMapper.findPlaceAndMaterialByMidAndPid(params); |
|
|
if (placeAndMaterialByMidAndPid != null) { |
|
|
if (placeAndMaterialByMidAndPid != null) { |
|
|
// 如果当前库位存在该物料
|
|
|
// 如果当前库位存在该物料
|
|
|
if (placeAndMaterialByMidAndPid.getQuantity() < trueOut) { |
|
|
if (placeAndMaterialByMidAndPid.getQuantity() < trueOut * 100) { |
|
|
// 如果当前库位数量不足
|
|
|
// 如果当前库位数量不足
|
|
|
flag = false; |
|
|
flag = false; |
|
|
} |
|
|
} |
|
|
@ -1010,20 +1010,20 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
// 如果物料数量可以出库并且库位数量充足
|
|
|
// 如果物料数量可以出库并且库位数量充足
|
|
|
if (inventory.getQuantity() >= trueOut && flag) { |
|
|
if (inventory.getQuantity() >= trueOut && flag) { |
|
|
// 当前出库数量
|
|
|
// 当前出库数量
|
|
|
Integer quantity = trueOut; |
|
|
Double quantity = trueOut * 100; |
|
|
inventory.setQuantity(inventory.getQuantity() - quantity); |
|
|
inventory.setQuantity(inventory.getQuantity() - quantity.intValue()); |
|
|
inventory.setNumberOfTemporary(inventory.getNumberOfTemporary() - quantity); |
|
|
inventory.setNumberOfTemporary(inventory.getNumberOfTemporary() - quantity.intValue()); |
|
|
// 修改物料信息
|
|
|
// 修改物料信息
|
|
|
materialMapper.updateInventory(inventory); |
|
|
materialMapper.updateInventory(inventory); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 修改当前库位存放物料的数量
|
|
|
// 修改当前库位存放物料的数量
|
|
|
placeAndMaterialByMidAndPid.setQuantity(placeAndMaterialByMidAndPid.getQuantity() - quantity); |
|
|
placeAndMaterialByMidAndPid.setQuantity(placeAndMaterialByMidAndPid.getQuantity() - quantity.intValue()); |
|
|
placeMapper.updateMaterialAndPlace(placeAndMaterialByMidAndPid); |
|
|
placeMapper.updateMaterialAndPlace(placeAndMaterialByMidAndPid); |
|
|
|
|
|
|
|
|
// 修改库位数量
|
|
|
// 修改库位数量
|
|
|
Place placeById = placeMapper.findPlaceById(placeId); |
|
|
Place placeById = placeMapper.findPlaceById(placeId); |
|
|
placeById.setQuantity(placeById.getQuantity() - quantity); |
|
|
placeById.setQuantity(placeById.getQuantity() - quantity.intValue()); |
|
|
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); |
|
|
materialAndProducedDate.setExpendnum(materialAndProducedDate.getExpendnum() + quantity.intValue()); |
|
|
// 设置剩余的数量
|
|
|
// 设置剩余的数量
|
|
|
materialAndProducedDate.setInventory(materialAndProducedDate.getInventory() - quantity); |
|
|
materialAndProducedDate.setInventory(materialAndProducedDate.getInventory() - quantity.intValue()); |
|
|
materialMapper.updateMaterialAndProducedDate(materialAndProducedDate); |
|
|
materialMapper.updateMaterialAndProducedDate(materialAndProducedDate); |
|
|
// 跳出循环
|
|
|
// 跳出循环
|
|
|
break; |
|
|
break; |
|
|
@ -1073,7 +1073,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
restResponse.setData(""); |
|
|
restResponse.setData(""); |
|
|
restResponse.setStatusInfo(new StatusInfo("出库失败", "出库失败,库存不足")); |
|
|
restResponse.setStatusInfo(new StatusInfo("出库失败", "出库失败,库存不足")); |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} |
|
|
|
|
|
else { |
|
|
// 如果是拆单后的出库
|
|
|
// 如果是拆单后的出库
|
|
|
|
|
|
|
|
|
// 用于获取对应的拆单记录
|
|
|
// 用于获取对应的拆单记录
|
|
|
@ -1100,16 +1101,16 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
if (splitInventory != null) { |
|
|
if (splitInventory != null) { |
|
|
// 如果拆单库存处理记录存在
|
|
|
// 如果拆单库存处理记录存在
|
|
|
|
|
|
|
|
|
if (splitInventory.getSaveQuantity() >= trueOut) { |
|
|
if (splitInventory.getSaveQuantity() >= trueOut * 100) { |
|
|
// 如果当前待处理树可以满足需求
|
|
|
// 如果当前待处理树可以满足需求
|
|
|
|
|
|
|
|
|
splitInventory.setSaveQuantity(splitInventory.getSaveQuantity() - trueOut); |
|
|
splitInventory.setSaveQuantity(splitInventory.getSaveQuantity() - (int) (trueOut * 100)); |
|
|
|
|
|
|
|
|
// 设置当前拆单后的出库数量
|
|
|
// 设置当前拆单后的出库数量
|
|
|
if (splitInventory.getOutQuantity() != null) { |
|
|
if (splitInventory.getOutQuantity() != null) { |
|
|
splitInventory.setOutQuantity(splitInventory.getOutQuantity() + trueOut); |
|
|
splitInventory.setOutQuantity(splitInventory.getOutQuantity() + (int) (trueOut * 100)); |
|
|
} else { |
|
|
} else { |
|
|
splitInventory.setOutQuantity(trueOut); |
|
|
splitInventory.setOutQuantity((int) (trueOut * 100)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 修改库存处理记录
|
|
|
// 修改库存处理记录
|
|
|
@ -1141,7 +1142,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
SplitInfo splitInfoById = splitUnitMapper.findSplitInfoById(splitInventory.getSid()); |
|
|
SplitInfo splitInfoById = splitUnitMapper.findSplitInfoById(splitInventory.getSid()); |
|
|
|
|
|
|
|
|
// 获取剩余不足的数量
|
|
|
// 获取剩余不足的数量
|
|
|
int surplus = trueOut - splitInventory.getSaveQuantity(); |
|
|
int surplus = (int) (trueOut * 100 - splitInventory.getSaveQuantity()); |
|
|
|
|
|
|
|
|
if (splitInfoById.getParentId() != null) { |
|
|
if (splitInfoById.getParentId() != null) { |
|
|
// 如果当前拆单有父级
|
|
|
// 如果当前拆单有父级
|
|
|
@ -1178,11 +1179,12 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
updateApplicationMinOutInfo(id, applicationOutMinById, record, trueOut, userByPort, placeId, userAgent); |
|
|
updateApplicationMinOutInfo(id, applicationOutMinById, record, trueOut, userByPort, placeId, userAgent); |
|
|
} else { |
|
|
} |
|
|
|
|
|
else { |
|
|
// 如果当前拆单没有父级
|
|
|
// 如果当前拆单没有父级
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (surplus <= splitInfoById.getQuantity()) { |
|
|
if (surplus <= splitInfoById.getQuantity() * 100) { |
|
|
|
|
|
|
|
|
// 如果当前未处理的数量小于当前拆单库存数量
|
|
|
// 如果当前未处理的数量小于当前拆单库存数量
|
|
|
|
|
|
|
|
|
@ -1196,7 +1198,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
|
|
|
|
|
if (placeAndMaterialByMidAndPid != null) { |
|
|
if (placeAndMaterialByMidAndPid != null) { |
|
|
// 如果当前库位存在该物料
|
|
|
// 如果当前库位存在该物料
|
|
|
if (placeAndMaterialByMidAndPid.getQuantity() < 1) { |
|
|
if (placeAndMaterialByMidAndPid.getQuantity() < 100) { |
|
|
// 如果当前库存中的物料库存不足以出库
|
|
|
// 如果当前库存中的物料库存不足以出库
|
|
|
flag = false; |
|
|
flag = false; |
|
|
} |
|
|
} |
|
|
@ -1208,10 +1210,10 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 如果物料数量可以出库并且库位数量充足
|
|
|
// 如果物料数量可以出库并且库位数量充足
|
|
|
if (inventory.getQuantity() >= 1 && flag) { |
|
|
if (inventory.getQuantity() >= 100 && flag) { |
|
|
|
|
|
|
|
|
// 令库存-1
|
|
|
// 令库存-1
|
|
|
inventory.setQuantity(inventory.getQuantity() - 1); |
|
|
inventory.setQuantity(inventory.getQuantity() - 100); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 修改库存记录
|
|
|
// 修改库存记录
|
|
|
@ -1219,12 +1221,12 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 修改当前库位存放物料的数量
|
|
|
// 修改当前库位存放物料的数量
|
|
|
placeAndMaterialByMidAndPid.setQuantity(placeAndMaterialByMidAndPid.getQuantity() - 1); |
|
|
placeAndMaterialByMidAndPid.setQuantity(placeAndMaterialByMidAndPid.getQuantity() - 100); |
|
|
placeMapper.updateMaterialAndPlace(placeAndMaterialByMidAndPid); |
|
|
placeMapper.updateMaterialAndPlace(placeAndMaterialByMidAndPid); |
|
|
|
|
|
|
|
|
// 修改库位数量
|
|
|
// 修改库位数量
|
|
|
Place placeById = placeMapper.findPlaceById(placeId); |
|
|
Place placeById = placeMapper.findPlaceById(placeId); |
|
|
placeById.setQuantity(placeById.getQuantity() - 1); |
|
|
placeById.setQuantity(placeById.getQuantity() - 100); |
|
|
placeMapper.UpdatePlace(placeById); |
|
|
placeMapper.UpdatePlace(placeById); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1238,8 +1240,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 设置剩余拆单库存处理数量
|
|
|
// 设置剩余拆单库存处理数量
|
|
|
splitInventory.setSaveQuantity(splitInfoById.getQuantity() + splitInventory.getSaveQuantity() - trueOut); |
|
|
splitInventory.setSaveQuantity(splitInfoById.getQuantity() * 100 + splitInventory.getSaveQuantity() - (int) (trueOut * 100)); |
|
|
splitInventory.setOutQuantity(splitInventory.getOutQuantity() + trueOut); |
|
|
splitInventory.setOutQuantity(splitInventory.getOutQuantity() + (int) (trueOut * 100)); |
|
|
splitUnitMapper.updateSplitInventory(splitInventory); |
|
|
splitUnitMapper.updateSplitInventory(splitInventory); |
|
|
|
|
|
|
|
|
// 如果是库存转移订单
|
|
|
// 如果是库存转移订单
|
|
|
@ -1258,16 +1260,18 @@ 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 { |
|
|
// 如果大于
|
|
|
// 如果大于
|
|
|
|
|
|
|
|
|
// 获取库存重要减少的数量
|
|
|
// 获取库存重要减少的数量
|
|
|
int surplus_redundant = surplus / splitInfoById.getQuantity(); |
|
|
int surplus_redundant = surplus / (splitInfoById.getQuantity() * 100); |
|
|
// 获取拆单库存处理中要处理数量
|
|
|
// 获取拆单库存处理中要处理数量
|
|
|
int saveQuantity = surplus - surplus_redundant * splitInfoById.getQuantity(); |
|
|
int saveQuantity = surplus - surplus_redundant * splitInfoById.getQuantity(); |
|
|
|
|
|
|
|
|
@ -1275,8 +1279,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
// 如果要处理的数量大于剩余数量
|
|
|
// 如果要处理的数量大于剩余数量
|
|
|
|
|
|
|
|
|
// 获取一个数量
|
|
|
// 获取一个数量
|
|
|
surplus_redundant += 1; |
|
|
surplus_redundant += 100; |
|
|
splitInventory.setSaveQuantity(splitInfoById.getQuantity() + splitInventory.getSaveQuantity() - saveQuantity); |
|
|
splitInventory.setSaveQuantity(splitInfoById.getQuantity() * 100 + splitInventory.getSaveQuantity() - saveQuantity); |
|
|
} else { |
|
|
} else { |
|
|
// 如果不大于
|
|
|
// 如果不大于
|
|
|
splitInventory.setSaveQuantity(splitInventory.getSaveQuantity() - saveQuantity); |
|
|
splitInventory.setSaveQuantity(splitInventory.getSaveQuantity() - saveQuantity); |
|
|
@ -1326,7 +1330,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(surplus_redundant)); |
|
|
map.put("quantity", String.valueOf((double)surplus_redundant / 100)); |
|
|
map.put("applicantId", record.getApplicantId()); |
|
|
map.put("applicantId", record.getApplicantId()); |
|
|
map.put("minRecordId", applicationOutMinById.getId()); // 出库订单编号
|
|
|
map.put("minRecordId", applicationOutMinById.getId()); // 出库订单编号
|
|
|
transferMaterial(map); |
|
|
transferMaterial(map); |
|
|
@ -1346,33 +1350,34 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} else { |
|
|
} |
|
|
|
|
|
else { |
|
|
// 如果拆单库存处理记录不存在
|
|
|
// 如果拆单库存处理记录不存在
|
|
|
|
|
|
|
|
|
int scale = splitUnitService.findSplitInfoScaleQuantity(splitInfo, -1); |
|
|
int scale = splitUnitService.findSplitInfoScaleQuantity(splitInfo, -1); |
|
|
if (inventory.getQuantity() * scale > trueOut) { |
|
|
if (inventory.getQuantity() * scale >= trueOut) { |
|
|
// 如果当前库存数量满足要求
|
|
|
// 如果当前库存数量满足要求
|
|
|
|
|
|
|
|
|
// 获取当前出库的具体数目
|
|
|
// 获取当前出库的具体数目
|
|
|
int residue = (int) Math.ceil(trueOut / (double) splitInfo.getQuantity()); |
|
|
int residue = (int) Math.ceil(trueOut / (double) splitInfo.getQuantity()); |
|
|
// 获取剩余数目
|
|
|
// 获取剩余数目
|
|
|
int residue_realQuantity = residue * scale - trueOut; |
|
|
double residue_realQuantity = residue * scale - trueOut; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 设置新库存
|
|
|
// 设置新库存
|
|
|
inventory.setQuantity(inventory.getQuantity() - residue); |
|
|
inventory.setQuantity(inventory.getQuantity() - residue * 100); |
|
|
|
|
|
|
|
|
//更新库存
|
|
|
//更新库存
|
|
|
materialMapper.updateInventory(inventory); |
|
|
materialMapper.updateInventory(inventory); |
|
|
|
|
|
|
|
|
// 更新对应库位的库存
|
|
|
// 更新对应库位的库存
|
|
|
// 修改当前库位存放物料的数量
|
|
|
// 修改当前库位存放物料的数量
|
|
|
placeAndMaterialByMidAndPid.setQuantity(placeAndMaterialByMidAndPid.getQuantity() - residue); |
|
|
placeAndMaterialByMidAndPid.setQuantity(placeAndMaterialByMidAndPid.getQuantity() - residue * 100); |
|
|
placeMapper.updateMaterialAndPlace(placeAndMaterialByMidAndPid); |
|
|
placeMapper.updateMaterialAndPlace(placeAndMaterialByMidAndPid); |
|
|
|
|
|
|
|
|
// 修改库位数量
|
|
|
// 修改库位数量
|
|
|
Place placeById = placeMapper.findPlaceById(placeId); |
|
|
Place placeById = placeMapper.findPlaceById(placeId); |
|
|
placeById.setQuantity(placeById.getQuantity() - residue); |
|
|
placeById.setQuantity(placeById.getQuantity() - residue * 100); |
|
|
placeMapper.UpdatePlace(placeById); |
|
|
placeMapper.UpdatePlace(placeById); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1434,7 +1439,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
* @param realSplitInfo 实际出库的拆单记录 |
|
|
* @param realSplitInfo 实际出库的拆单记录 |
|
|
* @return |
|
|
* @return |
|
|
*/ |
|
|
*/ |
|
|
public RestResponse updateOutSplitInventoryInfo(SplitInfo splitInfo, MaterialAndPlace materialAndPlace, int quantity, int nowQuantity, SplitInfo realSplitInfo) { |
|
|
public RestResponse updateOutSplitInventoryInfo(SplitInfo splitInfo, MaterialAndPlace materialAndPlace, double quantity, double nowQuantity, SplitInfo realSplitInfo) { |
|
|
// 定义返回值
|
|
|
// 定义返回值
|
|
|
RestResponse restResponse = new RestResponse(); |
|
|
RestResponse restResponse = new RestResponse(); |
|
|
// 用于获取当前拆单记录对应的拆单库存记录
|
|
|
// 用于获取当前拆单记录对应的拆单库存记录
|
|
|
@ -1444,15 +1449,15 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
SplitInventory splitInventoryForSplitInfo = splitUnitMapper.findSplitInventoryByIidAndSid(paramForSplitInventory); |
|
|
SplitInventory splitInventoryForSplitInfo = splitUnitMapper.findSplitInventoryByIidAndSid(paramForSplitInventory); |
|
|
// 获取当前拆单记录与实际出库拆单之间的进制
|
|
|
// 获取当前拆单记录与实际出库拆单之间的进制
|
|
|
int parentScale = splitUnitService.findSplitInfoScaleQuantity(realSplitInfo, splitInfo.getId()); |
|
|
int parentScale = splitUnitService.findSplitInfoScaleQuantity(realSplitInfo, splitInfo.getId()); |
|
|
if (splitInventoryForSplitInfo.getSaveQuantity() * parentScale >= nowQuantity) { |
|
|
if (splitInventoryForSplitInfo.getSaveQuantity() * parentScale >= nowQuantity * 100) { |
|
|
// 如果当前库存拆单记录的库存可以满足需要
|
|
|
// 如果当前库存拆单记录的库存可以满足需要
|
|
|
|
|
|
|
|
|
// 计算当前拆单库存具体减少的数量
|
|
|
// 计算当前拆单库存具体减少的数量
|
|
|
int realSaveQuantity = (int) Math.ceil(nowQuantity / (double) parentScale); |
|
|
int realSaveQuantity = (int) Math.ceil(nowQuantity / (double) parentScale); |
|
|
// 设置当前拆单库存
|
|
|
// 设置当前拆单库存
|
|
|
splitInventoryForSplitInfo.setSaveQuantity(splitInventoryForSplitInfo.getSaveQuantity() - realSaveQuantity); |
|
|
splitInventoryForSplitInfo.setSaveQuantity(splitInventoryForSplitInfo.getSaveQuantity() - realSaveQuantity * 100); |
|
|
// 设置当前拆单出库库存数
|
|
|
// 设置当前拆单出库库存数
|
|
|
splitInventoryForSplitInfo.setOutQuantity(splitInventoryForSplitInfo.getOutQuantity() + realSaveQuantity); |
|
|
splitInventoryForSplitInfo.setOutQuantity(splitInventoryForSplitInfo.getOutQuantity() + realSaveQuantity * 100); |
|
|
// 修改库存记录
|
|
|
// 修改库存记录
|
|
|
splitUnitMapper.updateSplitInventory(splitInventoryForSplitInfo); |
|
|
splitUnitMapper.updateSplitInventory(splitInventoryForSplitInfo); |
|
|
|
|
|
|
|
|
@ -1462,7 +1467,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
paramForSplitInventory.put("sid", splitInfoByParentId.getId()); |
|
|
paramForSplitInventory.put("sid", splitInfoByParentId.getId()); |
|
|
// 获取对应子类的库存
|
|
|
// 获取对应子类的库存
|
|
|
SplitInventory splitInventoryBySplitInfoByParentId = splitUnitMapper.findSplitInventoryByIidAndSid(paramForSplitInventory); |
|
|
SplitInventory splitInventoryBySplitInfoByParentId = splitUnitMapper.findSplitInventoryByIidAndSid(paramForSplitInventory); |
|
|
splitInventoryBySplitInfoByParentId.setSaveQuantity(realSaveQuantity * parentScale - nowQuantity); |
|
|
splitInventoryBySplitInfoByParentId.setSaveQuantity((int) (realSaveQuantity * parentScale - nowQuantity) * 100); |
|
|
splitUnitMapper.updateSplitInventory(splitInventoryBySplitInfoByParentId); |
|
|
splitUnitMapper.updateSplitInventory(splitInventoryBySplitInfoByParentId); |
|
|
} |
|
|
} |
|
|
restResponse.setStatus(200); |
|
|
restResponse.setStatus(200); |
|
|
@ -1517,7 +1522,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
// 设置当前库存数量
|
|
|
// 设置当前库存数量
|
|
|
splitInventoryForSplitInfo.setSaveQuantity(scale * splitInfo.getQuantity() - splitInventoryForSplitInfo.getSaveQuantity()); |
|
|
splitInventoryForSplitInfo.setSaveQuantity(scale * splitInfo.getQuantity() - splitInventoryForSplitInfo.getSaveQuantity()); |
|
|
// 设置当前出库数量
|
|
|
// 设置当前出库数量
|
|
|
splitInventoryForSplitInfo.setOutQuantity(splitInventoryForSplitInfo.getOutQuantity() + ((quantity - splitInventoryForSplitInfo.getSaveQuantity()))); |
|
|
splitInventoryForSplitInfo.setOutQuantity((int) (splitInventoryForSplitInfo.getOutQuantity() + ((quantity * 100 - splitInventoryForSplitInfo.getSaveQuantity())))); |
|
|
// 修改当前拆单库存处理记录
|
|
|
// 修改当前拆单库存处理记录
|
|
|
|
|
|
|
|
|
} else { |
|
|
} else { |
|
|
@ -1531,9 +1536,9 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
splitUnitMapper.updateSplitInventory(parentSplitInventoryForSplitInfo); |
|
|
splitUnitMapper.updateSplitInventory(parentSplitInventoryForSplitInfo); |
|
|
|
|
|
|
|
|
// 设置当前拆单库存数
|
|
|
// 设置当前拆单库存数
|
|
|
splitInventoryForSplitInfo.setSaveQuantity(splitInventoryForSplitInfo.getSaveQuantity() - quantity); |
|
|
splitInventoryForSplitInfo.setSaveQuantity(splitInventoryForSplitInfo.getSaveQuantity() - (int) (quantity * 100)); |
|
|
// 设置当前拆单库存出库数
|
|
|
// 设置当前拆单库存出库数
|
|
|
splitInventoryForSplitInfo.setOutQuantity(splitInventoryForSplitInfo.getOutQuantity() + quantity); |
|
|
splitInventoryForSplitInfo.setOutQuantity(splitInventoryForSplitInfo.getOutQuantity() + (int) (quantity * 100)); |
|
|
// 修改当前拆单库存处理记录
|
|
|
// 修改当前拆单库存处理记录
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
@ -1566,7 +1571,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
splitInfoScaleQuantity *= splitUnitService.findSplitInfoScaleQuantity(realSplitInfo, parentSplitInfo.getId()); |
|
|
splitInfoScaleQuantity *= splitUnitService.findSplitInfoScaleQuantity(realSplitInfo, parentSplitInfo.getId()); |
|
|
} |
|
|
} |
|
|
if (data != null && !"".equals(data.toString())) { |
|
|
if (data != null && !"".equals(data.toString())) { |
|
|
int surplus_redundant = ObjectFormatUtil.toInteger(data) * (int) splitInfoScaleQuantity; |
|
|
double surplus_redundant = ObjectFormatUtil.toDouble(data) * splitInfoScaleQuantity; |
|
|
if (surplus_redundant - nowQuantity == 0) { |
|
|
if (surplus_redundant - nowQuantity == 0) { |
|
|
// 如果刚好完成出库且没有剩余
|
|
|
// 如果刚好完成出库且没有剩余
|
|
|
restResponse.setStatus(200); |
|
|
restResponse.setStatus(200); |
|
|
@ -1602,7 +1607,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
// 如果可以出库
|
|
|
// 如果可以出库
|
|
|
|
|
|
|
|
|
// 计算当前不足的数量
|
|
|
// 计算当前不足的数量
|
|
|
int residue_quantity = realQuantity - nowQuantity; |
|
|
double residue_quantity = realQuantity - nowQuantity; |
|
|
|
|
|
|
|
|
// 计算库存需要减少的数量
|
|
|
// 计算库存需要减少的数量
|
|
|
int inventory_quantity = (int) Math.ceil((double) residue_quantity / splitInfoQuantity); |
|
|
int inventory_quantity = (int) Math.ceil((double) residue_quantity / splitInfoQuantity); |
|
|
@ -1673,7 +1678,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
* @param userAgent user-agent |
|
|
* @param userAgent user-agent |
|
|
*/ |
|
|
*/ |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
void updateApplicationMinOutInfo(Integer id, ApplicationOutRecordMin applicationOutMinById, ApplicationOutRecord record, Integer trueOut, UserByPort userByPort, Integer placeId, String userAgent) { |
|
|
void updateApplicationMinOutInfo(Integer id, ApplicationOutRecordMin applicationOutMinById, ApplicationOutRecord record, Double trueOut, UserByPort userByPort, Integer placeId, String userAgent) { |
|
|
String redisMinRecordKey = "minRecord:" + id; // 设置redis中子订单键值
|
|
|
String redisMinRecordKey = "minRecord:" + id; // 设置redis中子订单键值
|
|
|
// 修改redis中本子订单状态
|
|
|
// 修改redis中本子订单状态
|
|
|
// redisTemplate.opsForHash().put(redisMinRecordKey,"state","2");
|
|
|
// redisTemplate.opsForHash().put(redisMinRecordKey,"state","2");
|
|
|
@ -1681,7 +1686,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
// redisTemplate.opsForHash().put(redisMinRecordKey,"manager",userByPort.getId().toString());
|
|
|
// redisTemplate.opsForHash().put(redisMinRecordKey,"manager",userByPort.getId().toString());
|
|
|
|
|
|
|
|
|
// 修改当前已经出库的数量
|
|
|
// 修改当前已经出库的数量
|
|
|
applicationOutMinById.setTrueOut(trueOut + applicationOutMinById.getTrueOut()); |
|
|
applicationOutMinById.setTrueOut((int) (trueOut * 100) + applicationOutMinById.getTrueOut()); |
|
|
if (applicationOutMinById.getQuantity() - applicationOutMinById.getTrueOut() > 0) { |
|
|
if (applicationOutMinById.getQuantity() - applicationOutMinById.getTrueOut() > 0) { |
|
|
// 如果当前子订单中的物料并未完全出库
|
|
|
// 如果当前子订单中的物料并未完全出库
|
|
|
depositoryRecordMapper.updateApplicationOutRecordMin(applicationOutMinById); |
|
|
depositoryRecordMapper.updateApplicationOutRecordMin(applicationOutMinById); |
|
|
@ -2631,7 +2636,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
// 用于调用入库方法而创建的
|
|
|
// 用于调用入库方法而创建的
|
|
|
Map<String, Object> paramForUpdateInventory = new HashMap<>(); |
|
|
Map<String, Object> paramForUpdateInventory = new HashMap<>(); |
|
|
paramForUpdateInventory.put("mid", recordP.getMid()); |
|
|
paramForUpdateInventory.put("mid", recordP.getMid()); |
|
|
paramForUpdateInventory.put("quantity", (double)recordP.getQuantity() / 100); |
|
|
paramForUpdateInventory.put("quantity", (double) recordP.getQuantity() / 100); |
|
|
paramForUpdateInventory.put("depositoryId", recordP.getDepositoryId()); |
|
|
paramForUpdateInventory.put("depositoryId", recordP.getDepositoryId()); |
|
|
paramForUpdateInventory.put("placeId", recordP.getPlaceId()); |
|
|
paramForUpdateInventory.put("placeId", recordP.getPlaceId()); |
|
|
if (materialById.getUnit().equals(recordP.getAirUnit())) { |
|
|
if (materialById.getUnit().equals(recordP.getAirUnit())) { |
|
|
@ -3630,7 +3635,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
public List<ApplicationOutRecordP> findApplicationOutRecordByDepository(String depositoryId) { |
|
|
public List<ApplicationOutRecordP> findApplicationOutRecordByDepository(String depositoryId) { |
|
|
List<ApplicationOutRecord> recordList = depositoryRecordMapper.findApplicationOutRecordByDepository(depositoryId); |
|
|
List<ApplicationOutRecord> recordList = depositoryRecordMapper.findApplicationOutRecordByDepository(depositoryId); |
|
|
List<ApplicationOutRecordP> result = new ArrayList<>(); |
|
|
List<ApplicationOutRecordP> result = new ArrayList<>(); |
|
|
for (ApplicationOutRecord record:recordList |
|
|
for (ApplicationOutRecord record : recordList |
|
|
) { |
|
|
) { |
|
|
ApplicationOutRecordP recordP = new ApplicationOutRecordP(record); |
|
|
ApplicationOutRecordP recordP = new ApplicationOutRecordP(record); |
|
|
result.add(recordP); |
|
|
result.add(recordP); |
|
|
@ -3890,7 +3895,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
Material materialById = materialMapper.findMaterialById(mid); |
|
|
Material materialById = materialMapper.findMaterialById(mid); |
|
|
if (materialById.getPrice() != null) { |
|
|
if (materialById.getPrice() != null) { |
|
|
|
|
|
|
|
|
sum += (materialById.getPrice() / 100) * ((double)applicationOutRecordMin.getQuantity() / 100); |
|
|
sum += (materialById.getPrice() / 100) * ((double) applicationOutRecordMin.getQuantity() / 100); |
|
|
} else { |
|
|
} else { |
|
|
sum += 0; |
|
|
sum += 0; |
|
|
} |
|
|
} |
|
|
@ -4592,8 +4597,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
// 数量
|
|
|
// 数量
|
|
|
double count = 0; |
|
|
double count = 0; |
|
|
for (ApplicationOutRecordMin recordMin : minList) { |
|
|
for (ApplicationOutRecordMin recordMin : minList) { |
|
|
double quantity =(double) recordMin.getQuantity() / 100; |
|
|
double quantity = (double) recordMin.getQuantity() / 100; |
|
|
count += quantity ; |
|
|
count += quantity; |
|
|
// 获取当前出库物料
|
|
|
// 获取当前出库物料
|
|
|
Inventory materialById = materialMapper.findInventoryById(recordMin.getMid()); |
|
|
Inventory materialById = materialMapper.findInventoryById(recordMin.getMid()); |
|
|
// 计算当前出库金额
|
|
|
// 计算当前出库金额
|
|
|
|