预验收,寄售撤回bug

master
anthonywj 2 years ago
parent 422311d7df
commit 2ca37b890a

@ -204,8 +204,29 @@ public class IoOrderServiceImpl implements IoOrderService {
BasicBussinessTypeEntity basicBussinessTypeEntity = basicBussinessTypeService.findByAction(orderEntity.getAction());
//判断单据是否是预验收单据,如果是预验收单据,则删除预验收库库存
if (basicBussinessTypeEntity.getActionType() == ConstantStatus.ACTION_TYPE_PREIN) {
preinOrderService.deleteByOrderId(billNo);
preinDetailService.deleteByOrderId(billNo);
//删除普通库存
List<InvPreInProductDetailEntity> invProductDetailEntities = invPreinProductDetailService.selectByOrderIdFk(billNo);
if (CollUtil.isNotEmpty(invProductDetailEntities)) {
for (InvPreInProductDetailEntity invProductDetailEntity : invProductDetailEntities) {
//更新库存
InvPreinProductEntity invProductEntity = invPreinProductService.selectByUnique(invProductDetailEntity.getRelId(), invProductDetailEntity.getBatchNo(), invProductDetailEntity.getSupId(), invProductDetailEntity.getDeptCode(), invProductDetailEntity.getInvCode());
if (invProductEntity != null) {
if (ConstantType.TYPE_PUT.equals(invProductDetailEntity.getMainAction())) {
int count = invProductEntity.getInCount() - invProductDetailEntity.getReCount();
invProductEntity.setInCount(count);
} else if (ConstantType.TYPE_OUT.equals(invProductDetailEntity.getMainAction())) {
int count = invProductEntity.getOutCount() - invProductDetailEntity.getReCount();
invProductEntity.setOutCount(count);
}
//计算实际数量
invProductEntity.setReCount(invProductEntity.getInCount() - invProductEntity.getOutCount());
invPreinProductService.update(invProductEntity);
}
}
//删除库存详情
invPreinProductDetailService.deleteByOrderId(billNo);
}
} else if (basicBussinessTypeEntity.getActionType() == ConstantStatus.ACTION_TYPE_ADVANCE) {
//是否寄售,删除寄售库存
List<InvPreProductDetailEntity> invProductDetailEntities = invPreProductDetailService.selectByOrderIdFk(billNo);
@ -296,20 +317,33 @@ public class IoOrderServiceImpl implements IoOrderService {
if (orderEntity.getStatus() == ConstantStatus.ORDER_STATUS_AUDITED) {
BasicBussinessTypeEntity basicBussinessTypeEntity = basicBussinessTypeService.findByAction(orderEntity.getAction());
//预验收库存
if (basicBussinessTypeEntity.getActionType() == ConstantStatus.ACTION_TYPE_PREIN) {
InvPreinDetailEntity invPreinDetailEntity = preinDetailService.findByCode(billNo, code);
int count = invPreinDetailEntity.getCount() - 1;
InvPreInProductDetailEntity invProductDetailEntity = invPreinProductDetailService.selectByCode(billNo, code);
int count = invProductDetailEntity.getCount() - 1;
if (count == 0) {
preinDetailService.deleteById(invPreinDetailEntity.getId());
invPreinProductDetailService.deleteById(invProductDetailEntity.getId() + "");
} else {
invPreinDetailEntity.setCount(count);
int reCount = udiCalCountUtil.getActCount(invPreinDetailEntity.getNameCode());
invPreinDetailEntity.setReCount(invPreinDetailEntity.getReCount() - reCount);
preinDetailService.update(invPreinDetailEntity);
//更新详情表
invProductDetailEntity.setCount(count);
int reCount = udiCalCountUtil.getActCount(invProductDetailEntity.getNameCode());
invProductDetailEntity.setReCount(invProductDetailEntity.getReCount() - reCount);
invPreinProductDetailService.update(invProductDetailEntity);
}
//更新产品表
InvPreinProductEntity invProductEntity = invPreinProductService.selectByUnique(invProductDetailEntity.getRelId(), invProductDetailEntity.getBatchNo(), invProductDetailEntity.getSupId(), invProductDetailEntity.getDeptCode(), invProductDetailEntity.getInvCode());
if (invProductEntity != null) {
if (ConstantType.TYPE_PUT.equals(invProductDetailEntity.getMainAction())) {
int inCount = invProductEntity.getInCount() - invProductDetailEntity.getReCount();
invProductEntity.setInCount(inCount);
} else if (ConstantType.TYPE_OUT.equals(invProductDetailEntity.getMainAction())) {
int outCount = invProductEntity.getOutCount() - invProductDetailEntity.getReCount();
invProductEntity.setOutCount(outCount);
}
invProductEntity.setReCount(invProductEntity.getInCount() - invProductEntity.getOutCount());
}
invPreinProductService.update(invProductEntity);
} else if (basicBussinessTypeEntity.getActionType() == ConstantStatus.ACTION_TYPE_ADVANCE) { //寄售库存
InvPreProductDetailEntity invProductDetailEntity = invPreProductDetailService.selectByCode(billNo, code);
@ -385,9 +419,9 @@ public class IoOrderServiceImpl implements IoOrderService {
@Resource
InvPreinOrderService invPreinOrderService;
InvPreinProductService invPreinProductService;
@Resource
InvPreinDetailService invPreinDetailService;
InvPreinProductDetailService invPreinProductDetailService;
//已验收单据撤回
@Override
@ -398,8 +432,43 @@ public class IoOrderServiceImpl implements IoOrderService {
//预验收撤回---直接删除预验收库存
if (bussinessTypeEntity.getActionType() == ConstantStatus.ACTION_TYPE_PREIN) {
invPreinOrderService.deleteByOrderId(billNo);
invPreinDetailService.deleteByOrderId(billNo);
List<InvPreInProductDetailEntity> invProductDetailEntities = invPreinProductDetailService.selectByOrderIdFk(billNo);
if (CollUtil.isNotEmpty(invProductDetailEntities)) {
for (InvPreInProductDetailEntity invProductDetailEntity : invProductDetailEntities) {
InvPreinProductEntity invProductEntity = invPreinProductService.selectByUnique(invProductDetailEntity.getRelId(), invProductDetailEntity.getBatchNo(), invProductDetailEntity.getSupId(),
invProductDetailEntity.getDeptCode(), invProductDetailEntity.getInvCode());
if (ConstantType.TYPE_PUT.equals(invProductDetailEntity.getMainAction())) {
int count = invProductEntity.getInCount() - invProductDetailEntity.getReCount();
invProductEntity.setInCount(count);
} else if (ConstantType.TYPE_OUT.equals(invProductDetailEntity.getMainAction())) {
int count = invProductEntity.getOutCount() - invProductDetailEntity.getReCount();
invProductEntity.setOutCount(count);
}
invProductEntity.setReCount(invProductEntity.getInCount() - invProductEntity.getOutCount());
invPreinProductService.update(invProductEntity);
}
invPreinProductDetailService.deleteByOrderId(billNo);
}
} else if (bussinessTypeEntity.getActionType() == ConstantStatus.ACTION_TYPE_ADVANCE) {
List<InvPreProductDetailEntity> invProductDetailEntities = invPreProductDetailService.selectByOrderIdFk(billNo);
if (CollUtil.isNotEmpty(invProductDetailEntities)) {
for (InvPreProductDetailEntity invProductDetailEntity : invProductDetailEntities) {
InvPreProductEntity invProductEntity = invPreProductService.selectByUnique(invProductDetailEntity.getRelId(), invProductDetailEntity.getBatchNo(), invProductDetailEntity.getSupId(),
invProductDetailEntity.getDeptCode(), invProductDetailEntity.getInvCode());
if (ConstantType.TYPE_PUT.equals(invProductDetailEntity.getMainAction())) {
int count = invProductEntity.getInCount() - invProductDetailEntity.getReCount();
invProductEntity.setInCount(count);
} else if (ConstantType.TYPE_OUT.equals(invProductDetailEntity.getMainAction())) {
int count = invProductEntity.getOutCount() - invProductDetailEntity.getReCount();
invProductEntity.setOutCount(count);
}
invProductEntity.setReCount(invProductEntity.getInCount() - invProductEntity.getOutCount());
invPreProductService.update(invProductEntity);
}
invPreProductDetailService.deleteByOrderId(billNo);
}
} else {
List<InvProductDetailEntity> invProductDetailEntities = invProductDetailService.selectByOrderIdFk(billNo);
if (CollUtil.isNotEmpty(invProductDetailEntities)) {

Loading…
Cancel
Save