|
|
|
@ -453,9 +453,15 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
}
|
|
|
|
|
if (StrUtil.isNotEmpty(orderId)) {//非首次添加
|
|
|
|
|
if (StrUtil.isEmpty(udiEntity.getSerialNo())) {//该单据已有该产品
|
|
|
|
|
//无序列号,则可能存在多个预验收入库单
|
|
|
|
|
IoCodeTempEntity codeTempEntity = codeTempService.findByUnique(orderId, code);
|
|
|
|
|
List<InvPreinDetailEntity> invPreinDetailEntities = invPreinDetailService.findByCode(code);
|
|
|
|
|
int count = 0;
|
|
|
|
|
for (InvPreinDetailEntity temp : invPreinDetailEntities) {
|
|
|
|
|
count = count + temp.getCount();
|
|
|
|
|
}
|
|
|
|
|
if (codeTempEntity != null) {
|
|
|
|
|
if (invProductDetailEntity.getCount() < (codeTempEntity.getMyCount() + 1)) {
|
|
|
|
|
if (count < (codeTempEntity.getMyCount() + 1)) {
|
|
|
|
|
return ResultVOUtils.error(500, "超出预验收库存数量");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -497,6 +503,9 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
if (codeEnttitys.size() > 0) {
|
|
|
|
|
exitLocalEntity = isExitLocal(code, codeEnttitys);
|
|
|
|
|
if (exitLocalEntity != null) {
|
|
|
|
|
if (StrUtil.isEmpty(exitLocalEntity.getSupId()) || exitLocalEntity.getRelId() == null) {
|
|
|
|
|
return ResultVOUtils.error(500, "当前UDI码已存在,且存在异常未处理!");
|
|
|
|
|
}
|
|
|
|
|
udiRelevanceResponses = udiRelevanceService.selectGroupByNameCode(exitLocalEntity.getNameCode());
|
|
|
|
|
BeanUtils.copyProperties(exitLocalEntity, genDetaiEntity);
|
|
|
|
|
genDetaiEntity.setCount(1);
|
|
|
|
@ -781,7 +790,7 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
// return ResultVOUtils.error(500, "当前库存不足,不允许0库存出库");
|
|
|
|
|
// }
|
|
|
|
|
} else {
|
|
|
|
|
int count = invProductDetailService.vailStockCount(codeTempEntity.getRelId(), codeTempEntity.getDeptCode(), codeTempEntity.getInvCode(), null);
|
|
|
|
|
int count = invProductDetailService.vailStockCount(codeTempEntity.getRelId(), codeTempEntity.getBatchNo(), codeTempEntity.getSupId(), codeTempEntity.getDeptCode(), codeTempEntity.getInvCode(), null);
|
|
|
|
|
if (count <= 0) {
|
|
|
|
|
return ResultVOUtils.error(500, "当前库存不足,不允许0库存出库");
|
|
|
|
|
} else {
|
|
|
|
@ -857,7 +866,7 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
IoOrderEntity orderEntity = orderService.findByBillNo(codeTempEntity.getOrderId());
|
|
|
|
|
if (codeTempEntity.getMyCount() > 1) {
|
|
|
|
|
codeTempEntity.setCount(codeTempEntity.getMyCount() - 1);
|
|
|
|
|
codeTempEntity.setReCount(codeTempEntity.getMyCount() - udiCalCountUtil.getActCount(codeTempEntity.getRelId()));
|
|
|
|
|
codeTempEntity.setReCount(codeTempEntity.getMyReCount() - udiCalCountUtil.getActCount(codeTempEntity.getRelId()));
|
|
|
|
|
codeTempService.updateById(codeTempEntity);
|
|
|
|
|
} else {
|
|
|
|
|
codeTempService.deleteById(id);
|
|
|
|
@ -870,8 +879,8 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
int orderCount = orderDetailCodeEntity.getCount();
|
|
|
|
|
int orderReCount = orderDetailCodeEntity.getReCount();
|
|
|
|
|
if (orderCount > 1) {
|
|
|
|
|
orderDetailCodeEntity.setCount(orderCount - codeTempEntity.getMyCount());
|
|
|
|
|
orderDetailCodeEntity.setReCount(orderReCount - codeTempEntity.getMyReCount());
|
|
|
|
|
orderDetailCodeEntity.setCount(orderCount - 1);
|
|
|
|
|
orderDetailCodeEntity.setReCount(orderReCount - udiCalCountUtil.getActCount(codeTempEntity.getRelId()));
|
|
|
|
|
ioOrderDetailCodeService.update(orderDetailCodeEntity);
|
|
|
|
|
} else {
|
|
|
|
|
ioOrderDetailCodeService.deleteById(orderDetailCodeEntity.getId());
|
|
|
|
|