|
|
|
@ -1128,8 +1128,11 @@ public class IoAddInoutService {
|
|
|
|
|
lastInBatch = lastList.get(0).getInBatchNo();
|
|
|
|
|
} else {
|
|
|
|
|
InvProductDetailEntity invProductDetailEntity = invProductDetailService.selectLastInBatch(bussinessTypeEntity, codeTempEntity.getRelId() + "", codeTempEntity.getBatchNo(), codeTempEntity.getInvCode(), codeTempEntity.getMainAction());
|
|
|
|
|
if (invProductDetailEntity != null)
|
|
|
|
|
if (invProductDetailEntity != null) {
|
|
|
|
|
lastInBatch = invProductDetailEntity.getInBatchNo();
|
|
|
|
|
codeTempEntity.setPrice(invProductDetailEntity.getPrice());
|
|
|
|
|
codeTempEntity.setInBatchNo(invProductDetailEntity.getInBatchNo());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (lastInBatch == null && exitCount == 0) {
|
|
|
|
|
//首次出库,获取入库最早批次
|
|
|
|
@ -1141,13 +1144,19 @@ public class IoAddInoutService {
|
|
|
|
|
} else {
|
|
|
|
|
//非首次出库
|
|
|
|
|
//1.获取当前批次已出库数量
|
|
|
|
|
Integer outCount = IntUtil.value(invProductDetailService.selectCountByInBatch(codeTempEntity.getRelId() + "", codeTempEntity.getBatchNo(), bussinessTypeEntity, lastInBatch,codeTempEntity.getInvCode(), ConstantType.TYPE_OUT));
|
|
|
|
|
Integer outCount = IntUtil.value(invProductDetailService.selectCountByInBatch(codeTempEntity.getRelId() + "", codeTempEntity.getBatchNo(), bussinessTypeEntity, lastInBatch, codeTempEntity.getInvCode(), ConstantType.TYPE_OUT));
|
|
|
|
|
//2.获取当前批次入库数量
|
|
|
|
|
Integer inCount = IntUtil.value(invProductDetailService.selectCountByInBatch(codeTempEntity.getRelId() + "", codeTempEntity.getBatchNo(), bussinessTypeEntity, lastInBatch,codeTempEntity.getInvCode(), ConstantType.TYPE_PUT));
|
|
|
|
|
Integer inCount = IntUtil.value(invProductDetailService.selectCountByInBatch(codeTempEntity.getRelId() + "", codeTempEntity.getBatchNo(), bussinessTypeEntity, lastInBatch, codeTempEntity.getInvCode(), ConstantType.TYPE_PUT));
|
|
|
|
|
//3.若数量还有剩,则此次出库为当前批次
|
|
|
|
|
if (inCount >= (outCount + extiReCount + codeTempEntity.getReCount())) {
|
|
|
|
|
codeTempEntity.setPrice(lastList.get(0).getPrice());
|
|
|
|
|
codeTempEntity.setInBatchNo(lastList.get(0).getInBatchNo());
|
|
|
|
|
|
|
|
|
|
if (lastList != null) {
|
|
|
|
|
codeTempEntity.setPrice(lastList.get(0).getPrice());
|
|
|
|
|
codeTempEntity.setInBatchNo(lastList.get(0).getInBatchNo());
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
// 4.若数量不足,则出下一批次
|
|
|
|
|
InvProductDetailEntity nextInvProduct = invProductDetailService.selectNextInBatch(bussinessTypeEntity, codeTempEntity.getRelId() + "", codeTempEntity.getBatchNo(), codeTempEntity.getInvCode(), ConstantType.TYPE_PUT, lastList.get(0).getInBatchNo());
|
|
|
|
|