|
|
|
@ -22,6 +22,7 @@ import com.glxp.api.dao.basic.BasicCorpDao;
|
|
|
|
|
import com.glxp.api.dao.inout.IoOrderDao;
|
|
|
|
|
import com.glxp.api.dao.thrsys.ThrSystemBusApiDao;
|
|
|
|
|
import com.glxp.api.dao.thrsys.ThrSystemDao;
|
|
|
|
|
import com.glxp.api.entity.auth.InvWarehouseEntity;
|
|
|
|
|
import com.glxp.api.entity.basic.BasicBussinessTypeEntity;
|
|
|
|
|
import com.glxp.api.entity.basic.BasicCorpEntity;
|
|
|
|
|
import com.glxp.api.entity.inout.*;
|
|
|
|
@ -969,6 +970,24 @@ public class IoOrderServiceImpl implements IoOrderService {
|
|
|
|
|
return orderDao.selectOrderIdList(data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void updateOrderInventory(String billNo, Integer status) {
|
|
|
|
|
//查询单据表
|
|
|
|
|
QueryWrapper<IoOrderEntity> ew = new QueryWrapper<>();
|
|
|
|
|
ew.eq("billNo", billNo);
|
|
|
|
|
IoOrderEntity ioOrderEntity = orderDao.selectVoOne(ew);
|
|
|
|
|
//查询单据result表
|
|
|
|
|
List<IoOrderDetailResultEntity> ioOrderDetailResultEntityList = ioOrderDetailResultService.findByOrderId(billNo);
|
|
|
|
|
//查询产库信息
|
|
|
|
|
InvWarehouseEntity invWarehouseEntity = invWarehouseDao.filterGroupInvSubAndcode(ioOrderEntity.getInvCode());
|
|
|
|
|
if (ioOrderEntity != null && invWarehouseEntity != null) {
|
|
|
|
|
//判断是哪个类型的库存
|
|
|
|
|
if (invWarehouseEntity.getAdvanceType() == ConstantStatus.ACTION_TYPE_NORMAL) {
|
|
|
|
|
setInvProductEntityList(ioOrderDetailResultEntityList, ioOrderEntity);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询此单据关联的所有单据
|
|
|
|
|
*
|
|
|
|
@ -1072,4 +1091,60 @@ public class IoOrderServiceImpl implements IoOrderService {
|
|
|
|
|
return orderDao.getfilterOrderList(filterOrderRequest);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Boolean setInvProductEntityList(List<IoOrderDetailResultEntity> ioOrderDetailResultEntityList,IoOrderEntity ioOrderEntity) {
|
|
|
|
|
|
|
|
|
|
for (IoOrderDetailResultEntity ioOrderDetailResultEntity : ioOrderDetailResultEntityList) {
|
|
|
|
|
//查询该产品是不是存在
|
|
|
|
|
InvProductEntity invProductEntity = invProductService.selectByUnique(ioOrderDetailResultEntity.getBindRlFk(), ioOrderDetailResultEntity.getBatchNo(),
|
|
|
|
|
ioOrderDetailResultEntity.getSupId(),ioOrderEntity.getDeptCode(),ioOrderEntity.getInvCode());
|
|
|
|
|
if (invProductEntity == null) {
|
|
|
|
|
//没有该产品就填充数据
|
|
|
|
|
invProductEntity = new InvProductEntity();
|
|
|
|
|
invProductEntity.setRelIdFk(ioOrderDetailResultEntity.getBindRlFk());
|
|
|
|
|
invProductEntity.setNameCode(ioOrderDetailResultEntity.getNameCode());
|
|
|
|
|
invProductEntity.setBatchNo(ioOrderDetailResultEntity.getBatchNo());
|
|
|
|
|
invProductEntity.setProductionDate(ioOrderDetailResultEntity.getProductDate());
|
|
|
|
|
invProductEntity.setExpireDate(ioOrderDetailResultEntity.getExpireDate());
|
|
|
|
|
invProductEntity.setInCount(0);
|
|
|
|
|
invProductEntity.setOutCount(0);
|
|
|
|
|
invProductEntity.setSupId(ioOrderDetailResultEntity.getSupId());
|
|
|
|
|
invProductEntity.setDeptCode(ioOrderEntity.getDeptCode());
|
|
|
|
|
invProductEntity.setInvCode(ioOrderEntity.getInvCode());
|
|
|
|
|
invProductEntity.setCreateTime(new Date());
|
|
|
|
|
invProductEntity.setUpdateTime(new Date());
|
|
|
|
|
invProductEntity.setNowStock(0); //现存量
|
|
|
|
|
invProductEntity.setFrozenCount(0); //冻结量
|
|
|
|
|
invProductEntity.setPlanInCount(0);//预计入库量
|
|
|
|
|
invProductEntity.setPlanOutCount(0);//预计出库量
|
|
|
|
|
invProductEntity.setOnWayCount(0);//在途库存
|
|
|
|
|
invProductEntity.setAvailableStock(0);//可用库存
|
|
|
|
|
}
|
|
|
|
|
if (ioOrderEntity.getMainAction().equals(ConstantType.TYPE_PUT)) {
|
|
|
|
|
//出库
|
|
|
|
|
if (ioOrderEntity.getStatus() == ConstantStatus.ORDER_STATUS_CHECK_SUCCESS) {
|
|
|
|
|
invProductEntity.setPlanOutCount((invProductEntity.getPlanOutCount() != null ? invProductEntity.getPlanOutCount() : 0) + ioOrderDetailResultEntity.getReCount());//预计出库量
|
|
|
|
|
invProductEntity.setFrozenCount((invProductEntity.getFrozenCount() != null ? invProductEntity.getFrozenCount() : 0) + ioOrderDetailResultEntity.getReCount());//预计出库量
|
|
|
|
|
} else if (ioOrderEntity.getStatus() == ConstantStatus.ORDER_STATUS_AUDITED) {
|
|
|
|
|
invProductEntity.setPlanOutCount((invProductEntity.getPlanOutCount() != null ? invProductEntity.getPlanOutCount() : 0) - ioOrderDetailResultEntity.getReCount());//预计出库量
|
|
|
|
|
invProductEntity.setFrozenCount((invProductEntity.getFrozenCount() != null ? invProductEntity.getFrozenCount() : 0) - ioOrderDetailResultEntity.getReCount());//预计出库量
|
|
|
|
|
}
|
|
|
|
|
} else if (ioOrderEntity.getMainAction().equals(ConstantType.TYPE_OUT)) {
|
|
|
|
|
//入库
|
|
|
|
|
if (ioOrderEntity.getStatus() == ConstantStatus.ORDER_STATUS_CHECK_SUCCESS) {
|
|
|
|
|
invProductEntity.setPlanInCount((invProductEntity.getInCount() != null ? invProductEntity.getInCount() : 0) + ioOrderDetailResultEntity.getReCount());//预计出库量
|
|
|
|
|
} else if (ioOrderEntity.getStatus() == ConstantStatus.ORDER_STATUS_AUDITED) {
|
|
|
|
|
invProductEntity.setPlanInCount((invProductEntity.getInCount() != null ? invProductEntity.getInCount() : 0) - ioOrderDetailResultEntity.getReCount());//预计出库量
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//判断有没有id走插入或者更新方法
|
|
|
|
|
if (invProductEntity.getId() == null) {
|
|
|
|
|
invProductService.insert(invProductEntity);
|
|
|
|
|
} else {
|
|
|
|
|
invProductService.update(invProductEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|