|
|
|
@ -52,6 +52,10 @@ public class IoGenInvService {
|
|
|
|
|
IoCodeService codeService;
|
|
|
|
|
@Resource
|
|
|
|
|
IBasicBusTypePreService basicBusTypePreService;
|
|
|
|
|
@Resource
|
|
|
|
|
InvUserProductService invUserProductService;
|
|
|
|
|
@Resource
|
|
|
|
|
InvUserProductDetailService invUserProductDetailService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
@ -122,6 +126,64 @@ public class IoGenInvService {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//生成用户普通库存
|
|
|
|
|
public void genNorInvUser(String orderId) {
|
|
|
|
|
IoOrderEntity orderEntity = orderService.findByBillNo(orderId);
|
|
|
|
|
List<IoOrderDetailResultEntity> orderDetailResultEntities = orderDetailResultService.findByOrderId(orderId);
|
|
|
|
|
List<IoCodeEntity> codeEnttities = codeService.findByOrderId(orderId);
|
|
|
|
|
|
|
|
|
|
//生成库存产品表
|
|
|
|
|
for (IoOrderDetailResultEntity orderDetailResultEntity : orderDetailResultEntities) {
|
|
|
|
|
InvUserProductEntity invUserProductEntity = invUserProductService.selectByUnique(orderDetailResultEntity.getBindRlFk(), orderDetailResultEntity.getBatchNo(), orderDetailResultEntity.getSupId(), orderEntity.getDeptCode(), orderEntity.getInvCode(),orderEntity.getCreateUser(),ConstantStatus.ACTION_TYPE_NORMAL);
|
|
|
|
|
if (invUserProductEntity == null) {
|
|
|
|
|
invUserProductEntity = new InvUserProductEntity();
|
|
|
|
|
invUserProductEntity.setRelIdFk(orderDetailResultEntity.getBindRlFk());
|
|
|
|
|
invUserProductEntity.setNameCode(orderDetailResultEntity.getNameCode());
|
|
|
|
|
invUserProductEntity.setBatchNo(orderDetailResultEntity.getBatchNo());
|
|
|
|
|
invUserProductEntity.setProductionDate(orderDetailResultEntity.getProductDate());
|
|
|
|
|
invUserProductEntity.setExpireDate(orderDetailResultEntity.getExpireDate());
|
|
|
|
|
invUserProductEntity.setInCount(0);
|
|
|
|
|
invUserProductEntity.setType(ConstantStatus.ACTION_TYPE_NORMAL);
|
|
|
|
|
invUserProductEntity.setOutCount(0);
|
|
|
|
|
invUserProductEntity.setSupId(orderDetailResultEntity.getSupId());
|
|
|
|
|
invUserProductEntity.setDeptCode(orderEntity.getDeptCode());
|
|
|
|
|
invUserProductEntity.setInvCode(orderEntity.getInvCode());
|
|
|
|
|
invUserProductEntity.setCreateTime(new Date());
|
|
|
|
|
invUserProductEntity.setUpdateTime(new Date());
|
|
|
|
|
invUserProductService.addInvUserProduct(invUserProductEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (orderEntity.getMainAction().equals(ConstantType.TYPE_OUT)) {
|
|
|
|
|
invUserProductEntity.setOutCount(invUserProductEntity.getOutCount() + orderDetailResultEntity.getReCount());
|
|
|
|
|
} else if (orderEntity.getMainAction().equals(ConstantType.TYPE_PUT)) {
|
|
|
|
|
invUserProductEntity.setInCount(invUserProductEntity.getInCount() + orderDetailResultEntity.getReCount());
|
|
|
|
|
}
|
|
|
|
|
invUserProductEntity.setReCount(invUserProductEntity.getInCount() - invUserProductEntity.getOutCount());
|
|
|
|
|
invUserProductEntity.setUpdateTime(new Date());
|
|
|
|
|
invUserProductService.updateInvUserProduct(invUserProductEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//生成库存码详情
|
|
|
|
|
List<InvUserProductDetailEntity> invUserProductDetailEntityList = new ArrayList<>();
|
|
|
|
|
for (IoCodeEntity codeEntity : codeEnttities) {
|
|
|
|
|
InvUserProductDetailEntity invUserProductDetailEntity = new InvUserProductDetailEntity();
|
|
|
|
|
BeanUtils.copyProperties(codeEntity, invUserProductDetailEntity);
|
|
|
|
|
invUserProductDetailEntity.setRelId(codeEntity.getRelId());
|
|
|
|
|
invUserProductDetailEntity.setUpdateTime(new Date());
|
|
|
|
|
invUserProductDetailEntity.setId(null);
|
|
|
|
|
invUserProductDetailEntity.setInvSpaceCode(codeEntity.getWarehouseCode());
|
|
|
|
|
invUserProductDetailEntity.setPurchaseType(ConstantStatus.PRUCHASE_COMMON);
|
|
|
|
|
if (invUserProductDetailEntity.getMainAction().equals(ConstantType.TYPE_PUT)) {
|
|
|
|
|
invUserProductDetailEntity.setInCount(invUserProductDetailEntity.getReCount());
|
|
|
|
|
} else if (invUserProductDetailEntity.getMainAction().equals(ConstantType.TYPE_OUT)) {
|
|
|
|
|
invUserProductDetailEntity.setOutCount(invUserProductDetailEntity.getReCount());
|
|
|
|
|
}
|
|
|
|
|
invUserProductDetailEntityList.add(invUserProductDetailEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
invUserProductDetailService.addInvUserProductDetailList(invUserProductDetailEntityList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
InvPreProductService invPreProductService;
|
|
|
|
@ -189,6 +251,67 @@ public class IoGenInvService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//生成用户寄售库存
|
|
|
|
|
public void genUserPreInv(String orderId) {
|
|
|
|
|
IoOrderEntity orderEntity = orderService.findByBillNo(orderId);
|
|
|
|
|
List<IoOrderDetailResultEntity> orderDetailResultEntities = orderDetailResultService.findByOrderId(orderId);
|
|
|
|
|
List<IoCodeEntity> codeEnttities = codeService.findByOrderId(orderId);
|
|
|
|
|
|
|
|
|
|
//生成库存产品表
|
|
|
|
|
for (IoOrderDetailResultEntity orderDetailResultEntity : orderDetailResultEntities) {
|
|
|
|
|
InvUserProductEntity invUserProductEntity = invUserProductService.selectByUnique(orderDetailResultEntity.getBindRlFk(), orderDetailResultEntity.getBatchNo(), orderDetailResultEntity.getSupId(), orderEntity.getDeptCode(), orderEntity.getInvCode(),orderEntity.getCreateUser(),ConstantStatus.ACTION_TYPE_PREIN);
|
|
|
|
|
if (invUserProductEntity == null) {
|
|
|
|
|
invUserProductEntity = new InvUserProductEntity();
|
|
|
|
|
invUserProductEntity.setRelIdFk(orderDetailResultEntity.getBindRlFk());
|
|
|
|
|
invUserProductEntity.setNameCode(orderDetailResultEntity.getNameCode());
|
|
|
|
|
invUserProductEntity.setBatchNo(orderDetailResultEntity.getBatchNo());
|
|
|
|
|
invUserProductEntity.setProductionDate(orderDetailResultEntity.getProductDate());
|
|
|
|
|
invUserProductEntity.setExpireDate(orderDetailResultEntity.getExpireDate());
|
|
|
|
|
invUserProductEntity.setInCount(0);
|
|
|
|
|
invUserProductEntity.setType(ConstantStatus.ACTION_TYPE_PREIN);
|
|
|
|
|
invUserProductEntity.setOutCount(0);
|
|
|
|
|
invUserProductEntity.setSupId(orderDetailResultEntity.getSupId());
|
|
|
|
|
invUserProductEntity.setDeptCode(orderEntity.getDeptCode());
|
|
|
|
|
invUserProductEntity.setInvCode(orderEntity.getInvCode());
|
|
|
|
|
invUserProductEntity.setCreateTime(new Date());
|
|
|
|
|
invUserProductEntity.setUpdateTime(new Date());
|
|
|
|
|
invUserProductService.addInvUserProduct(invUserProductEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (orderEntity.getMainAction().equals(ConstantType.TYPE_OUT)) {
|
|
|
|
|
invUserProductEntity.setOutCount(invUserProductEntity.getOutCount() + orderDetailResultEntity.getReCount());
|
|
|
|
|
} else if (orderEntity.getMainAction().equals(ConstantType.TYPE_PUT)) {
|
|
|
|
|
invUserProductEntity.setInCount(invUserProductEntity.getInCount() + orderDetailResultEntity.getReCount());
|
|
|
|
|
}
|
|
|
|
|
invUserProductEntity.setReCount(invUserProductEntity.getInCount() - invUserProductEntity.getOutCount());
|
|
|
|
|
invUserProductEntity.setUpdateTime(new Date());
|
|
|
|
|
invUserProductService.updateInvUserProduct(invUserProductEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//生成库存码详情
|
|
|
|
|
List<InvUserProductDetailEntity> invUserProductDetailEntityList = new ArrayList<>();
|
|
|
|
|
for (IoCodeEntity codeEntity : codeEnttities) {
|
|
|
|
|
InvUserProductDetailEntity invUserProductDetailEntity = new InvUserProductDetailEntity();
|
|
|
|
|
BeanUtils.copyProperties(codeEntity, invUserProductDetailEntity);
|
|
|
|
|
invUserProductDetailEntity.setRelId(codeEntity.getRelId());
|
|
|
|
|
invUserProductDetailEntity.setUpdateTime(new Date());
|
|
|
|
|
invUserProductDetailEntity.setId(null);
|
|
|
|
|
invUserProductDetailEntity.setInvSpaceCode(codeEntity.getWarehouseCode());
|
|
|
|
|
invUserProductDetailEntity.setPurchaseType(ConstantStatus.PRUCHASE_COMMON);
|
|
|
|
|
if (invUserProductDetailEntity.getMainAction().equals(ConstantType.TYPE_PUT)) {
|
|
|
|
|
invUserProductDetailEntity.setInCount(invUserProductDetailEntity.getReCount());
|
|
|
|
|
} else if (invUserProductDetailEntity.getMainAction().equals(ConstantType.TYPE_OUT)) {
|
|
|
|
|
invUserProductDetailEntity.setOutCount(invUserProductDetailEntity.getReCount());
|
|
|
|
|
}
|
|
|
|
|
invUserProductDetailEntityList.add(invUserProductDetailEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
invUserProductDetailService.addInvUserProductDetailList(invUserProductDetailEntityList);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
InvPreinProductService invPreinProductService;
|
|
|
|
|
|
|
|
|
@ -272,5 +395,66 @@ public class IoGenInvService {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//生成用户预验收库存
|
|
|
|
|
public void genUserPreInInv(String orderId) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IoOrderEntity orderEntity = orderService.findByBillNo(orderId);
|
|
|
|
|
List<IoOrderDetailResultEntity> orderDetailResultEntities = orderDetailResultService.findByOrderId(orderId);
|
|
|
|
|
List<IoCodeEntity> codeEnttities = codeService.findByOrderId(orderId);
|
|
|
|
|
//生成库存产品表
|
|
|
|
|
for (IoOrderDetailResultEntity orderDetailResultEntity : orderDetailResultEntities) {
|
|
|
|
|
InvUserProductEntity invUserProductEntity = invUserProductService.selectByUnique(orderDetailResultEntity.getBindRlFk(), orderDetailResultEntity.getBatchNo(), orderDetailResultEntity.getSupId(), orderEntity.getDeptCode(), orderEntity.getInvCode(),orderEntity.getCreateUser(),ConstantStatus.ACTION_TYPE_ADVANCE);
|
|
|
|
|
if (invUserProductEntity == null) {
|
|
|
|
|
invUserProductEntity = new InvUserProductEntity();
|
|
|
|
|
invUserProductEntity.setRelIdFk(orderDetailResultEntity.getBindRlFk());
|
|
|
|
|
invUserProductEntity.setNameCode(orderDetailResultEntity.getNameCode());
|
|
|
|
|
invUserProductEntity.setBatchNo(orderDetailResultEntity.getBatchNo());
|
|
|
|
|
invUserProductEntity.setProductionDate(orderDetailResultEntity.getProductDate());
|
|
|
|
|
invUserProductEntity.setExpireDate(orderDetailResultEntity.getExpireDate());
|
|
|
|
|
invUserProductEntity.setInCount(0);
|
|
|
|
|
invUserProductEntity.setType(ConstantStatus.ACTION_TYPE_ADVANCE);
|
|
|
|
|
invUserProductEntity.setOutCount(0);
|
|
|
|
|
invUserProductEntity.setSupId(orderDetailResultEntity.getSupId());
|
|
|
|
|
invUserProductEntity.setDeptCode(orderEntity.getDeptCode());
|
|
|
|
|
invUserProductEntity.setInvCode(orderEntity.getInvCode());
|
|
|
|
|
invUserProductEntity.setCreateTime(new Date());
|
|
|
|
|
invUserProductEntity.setUpdateTime(new Date());
|
|
|
|
|
invUserProductService.addInvUserProduct(invUserProductEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (orderEntity.getMainAction().equals(ConstantType.TYPE_OUT)) {
|
|
|
|
|
invUserProductEntity.setOutCount(invUserProductEntity.getOutCount() + orderDetailResultEntity.getReCount());
|
|
|
|
|
} else if (orderEntity.getMainAction().equals(ConstantType.TYPE_PUT)) {
|
|
|
|
|
invUserProductEntity.setInCount(invUserProductEntity.getInCount() + orderDetailResultEntity.getReCount());
|
|
|
|
|
}
|
|
|
|
|
invUserProductEntity.setReCount(invUserProductEntity.getInCount() - invUserProductEntity.getOutCount());
|
|
|
|
|
invUserProductEntity.setUpdateTime(new Date());
|
|
|
|
|
invUserProductService.updateInvUserProduct(invUserProductEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//生成库存码详情
|
|
|
|
|
List<InvUserProductDetailEntity> invUserProductDetailEntityList = new ArrayList<>();
|
|
|
|
|
for (IoCodeEntity codeEntity : codeEnttities) {
|
|
|
|
|
InvUserProductDetailEntity invUserProductDetailEntity = new InvUserProductDetailEntity();
|
|
|
|
|
BeanUtils.copyProperties(codeEntity, invUserProductDetailEntity);
|
|
|
|
|
invUserProductDetailEntity.setRelId(codeEntity.getRelId());
|
|
|
|
|
invUserProductDetailEntity.setUpdateTime(new Date());
|
|
|
|
|
invUserProductDetailEntity.setId(null);
|
|
|
|
|
invUserProductDetailEntity.setInvSpaceCode(codeEntity.getWarehouseCode());
|
|
|
|
|
invUserProductDetailEntity.setPurchaseType(ConstantStatus.PRUCHASE_COMMON);
|
|
|
|
|
if (invUserProductDetailEntity.getMainAction().equals(ConstantType.TYPE_PUT)) {
|
|
|
|
|
invUserProductDetailEntity.setInCount(invUserProductDetailEntity.getReCount());
|
|
|
|
|
} else if (invUserProductDetailEntity.getMainAction().equals(ConstantType.TYPE_OUT)) {
|
|
|
|
|
invUserProductDetailEntity.setOutCount(invUserProductDetailEntity.getReCount());
|
|
|
|
|
}
|
|
|
|
|
invUserProductDetailEntityList.add(invUserProductDetailEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
invUserProductDetailService.addInvUserProductDetailList(invUserProductDetailEntityList);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|