用户库存代码提交

pro
郑明梁 2 years ago
parent cc736af286
commit 75f346c7a7

@ -2,6 +2,7 @@ package com.glxp.api.dao.inv;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.glxp.api.dao.BaseMapperPlus;
import com.glxp.api.entity.inv.InvUserProductDetailEntity; import com.glxp.api.entity.inv.InvUserProductDetailEntity;
/** /**
@ -9,7 +10,7 @@ import com.glxp.api.entity.inv.InvUserProductDetailEntity;
* @description inv_user_product_detail()Mapper * @description inv_user_product_detail()Mapper
* @createDate 2023-05-12 10:19:43 * @createDate 2023-05-12 10:19:43
*/ */
public interface InvUserProductDetailDao extends BaseMapper<InvUserProductDetailEntity> { public interface InvUserProductDetailDao extends BaseMapperPlus<InvUserProductDetailDao,InvUserProductDetailEntity,InvUserProductDetailEntity> {
} }

@ -105,4 +105,5 @@ public class InvProductEntity {
@TableField(value = "updateTime") @TableField(value = "updateTime")
private Date updateTime; private Date updateTime;
} }

@ -142,4 +142,11 @@ public class InvUserProductEntity {
private Integer availableStock; private Integer availableStock;
@TableField(value = "type")
private Integer type;
@TableField(value = "userId")
private String userId;
} }

@ -52,6 +52,10 @@ public class IoGenInvService {
IoCodeService codeService; IoCodeService codeService;
@Resource @Resource
IBasicBusTypePreService basicBusTypePreService; IBasicBusTypePreService basicBusTypePreService;
@Resource
InvUserProductService invUserProductService;
@Resource
InvUserProductDetailService invUserProductDetailService;
@Resource @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 @Resource
InvPreProductService invPreProductService; 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 @Resource
InvPreinProductService invPreinProductService; 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);
}
} }

@ -17,6 +17,8 @@ public interface InvUserProductDetailService{
Boolean addInvUserProductDetail(InvUserProductDetailEntity invUserProductDetailEntity); Boolean addInvUserProductDetail(InvUserProductDetailEntity invUserProductDetailEntity);
Boolean addInvUserProductDetailList(List<InvUserProductDetailEntity> invUserProductDetailEntityList);
Boolean updateInvUserProductDetail(InvUserProductDetailEntity invUserProductDetailEntity); Boolean updateInvUserProductDetail(InvUserProductDetailEntity invUserProductDetailEntity);
Boolean delectInvUserProductDetail(InvUserProductDetailEntity invUserProductDetailEntity); Boolean delectInvUserProductDetail(InvUserProductDetailEntity invUserProductDetailEntity);

@ -2,6 +2,7 @@ package com.glxp.api.service.inv;
import com.glxp.api.common.res.BaseResponse; import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.entity.inv.InvProductEntity;
import com.glxp.api.entity.inv.InvUserProductEntity; import com.glxp.api.entity.inv.InvUserProductEntity;
import java.util.List; import java.util.List;
@ -21,5 +22,7 @@ public interface InvUserProductService{
Boolean delectInvUserProduct(InvUserProductEntity invUserProductEntity); Boolean delectInvUserProduct(InvUserProductEntity invUserProductEntity);
InvUserProductEntity selectByUnique(Long relId, String batchNo, String supId, String deptCode, String invCode,String userId,Integer type);
} }

@ -30,6 +30,11 @@ public class InvUserProductDetailServiceImpl implements InvUserProductDetailServ
return invUserProductDetailDao.insert(invUserProductDetailEntity) == 1 ? true : false; return invUserProductDetailDao.insert(invUserProductDetailEntity) == 1 ? true : false;
} }
@Override
public Boolean addInvUserProductDetailList(List<InvUserProductDetailEntity> invUserProductDetailEntityList) {
return invUserProductDetailDao.insertBatch(invUserProductDetailEntityList);
}
@Override @Override
public Boolean updateInvUserProductDetail(InvUserProductDetailEntity invUserProductDetailEntity) { public Boolean updateInvUserProductDetail(InvUserProductDetailEntity invUserProductDetailEntity) {
return invUserProductDetailDao.updateById(invUserProductDetailEntity) == 1 ? true : false; return invUserProductDetailDao.updateById(invUserProductDetailEntity) == 1 ? true : false;

@ -1,7 +1,10 @@
package com.glxp.api.service.inv.impl; package com.glxp.api.service.inv.impl;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.glxp.api.dao.inv.InvUserProductDao; import com.glxp.api.dao.inv.InvUserProductDao;
import com.glxp.api.entity.inv.InvProductEntity;
import com.glxp.api.entity.inv.InvUserProductEntity; import com.glxp.api.entity.inv.InvUserProductEntity;
import com.glxp.api.service.inv.InvUserProductService; import com.glxp.api.service.inv.InvUserProductService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -39,4 +42,11 @@ public class InvUserProductServiceImpl implements InvUserProductService {
public Boolean delectInvUserProduct(InvUserProductEntity invUserProductEntity) { public Boolean delectInvUserProduct(InvUserProductEntity invUserProductEntity) {
return invUserProductDao.deleteById(invUserProductEntity) == 1 ? true : false; return invUserProductDao.deleteById(invUserProductEntity) == 1 ? true : false;
} }
@Override
public InvUserProductEntity selectByUnique(Long relId, String batchNo, String supId, String deptCode, String invCode,String userId,Integer type) {
return invUserProductDao.selectOne(new QueryWrapper<InvUserProductEntity>().eq("relIdFk", relId).eq(StrUtil.isNotEmpty(batchNo), "batchNo", batchNo)
.isNull(StrUtil.isEmpty(batchNo), "batchNo").eq("supId", supId).eq("deptCode", deptCode)
.eq("invCode", invCode).eq("userId",userId).eq("type",type));
}
} }

Loading…
Cancel
Save