|
@ -2,9 +2,15 @@ package com.ruoyi.warehouse.service.impl; |
|
|
|
|
|
|
|
|
import java.util.Date; |
|
|
import java.util.Date; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
import com.ruoyi.common.core.redis.RedisCache; |
|
|
import com.ruoyi.common.utils.DateUtils; |
|
|
import com.ruoyi.common.utils.DateUtils; |
|
|
import com.ruoyi.common.utils.ShiroUtils; |
|
|
import com.ruoyi.common.utils.ShiroUtils; |
|
|
import com.ruoyi.common.utils.StringUtils; |
|
|
import com.ruoyi.common.utils.StringUtils; |
|
|
|
|
|
import com.ruoyi.system.domain.SysMakeorderPickDetail; |
|
|
|
|
|
import com.ruoyi.system.domain.SysMakeorderPickVo; |
|
|
|
|
|
import com.ruoyi.system.mapper.SysMakeorderPickDetailMapper; |
|
|
|
|
|
import com.ruoyi.system.mapper.SysMakeorderPickMapper; |
|
|
import com.ruoyi.warehouse.domain.WarehouseOutOrderDetail; |
|
|
import com.ruoyi.warehouse.domain.WarehouseOutOrderDetail; |
|
|
import com.ruoyi.warehouse.mapper.WarehouseOutOrderDetailMapper; |
|
|
import com.ruoyi.warehouse.mapper.WarehouseOutOrderDetailMapper; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
@ -32,6 +38,15 @@ public class WarehouseOutOrderServiceImpl implements IWarehouseOutOrderService |
|
|
@Autowired |
|
|
@Autowired |
|
|
private WarehouseOutOrderDetailMapper outOrderDetailMapper; |
|
|
private WarehouseOutOrderDetailMapper outOrderDetailMapper; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private SysMakeorderPickMapper sysMakeorderPickMapper; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private SysMakeorderPickDetailMapper makeorderPickDetailMapper; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private RedisCache redisCache; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 查询仓库出库单 |
|
|
* 查询仓库出库单 |
|
|
* |
|
|
* |
|
@ -211,4 +226,82 @@ public class WarehouseOutOrderServiceImpl implements IWarehouseOutOrderService |
|
|
} |
|
|
} |
|
|
return updateRows; |
|
|
return updateRows; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
|
* 领料单审核通过后生成出库单 |
|
|
|
|
|
* */ |
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
|
@Override |
|
|
|
|
|
public int generateWarehouseOutOrderByMakeorderPick(SysMakeorderPickVo sysMakeorderPickVo) { |
|
|
|
|
|
|
|
|
|
|
|
WarehouseOutOrder warehouseOutOrder = new WarehouseOutOrder(); |
|
|
|
|
|
SysMakeorderPickVo tempSysMakeorderPickVo = sysMakeorderPickMapper.selectSysMakeorderPickById(sysMakeorderPickVo.getId()); |
|
|
|
|
|
if (tempSysMakeorderPickVo == null){ |
|
|
|
|
|
log.warn("生产领料单数据为空:{}",sysMakeorderPickVo.getId()); |
|
|
|
|
|
throw new RuntimeException("生产领料单数据为空:" + sysMakeorderPickVo.getId()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
String outOrderCode = redisCache.generateBillNo("CK"); |
|
|
|
|
|
warehouseOutOrder.setOutOrderCode(outOrderCode); |
|
|
|
|
|
warehouseOutOrder.setWarehouseOutStatus("4"); |
|
|
|
|
|
warehouseOutOrder.setRelatedOrderCode(tempSysMakeorderPickVo.getMakeNo()); |
|
|
|
|
|
warehouseOutOrder.setMakeNo(tempSysMakeorderPickVo.getMakeNo()); |
|
|
|
|
|
//标明来源是生产订单
|
|
|
|
|
|
warehouseOutOrder.setWarehouseOrderType("1"); |
|
|
|
|
|
warehouseOutOrder.setWarehouseOutType("1"); |
|
|
|
|
|
warehouseOutOrder.setMaterialSum(tempSysMakeorderPickVo.getMaterialSum()); |
|
|
|
|
|
warehouseOutOrder.setEnterpriseSum(tempSysMakeorderPickVo.getEnterpriseSum()); |
|
|
|
|
|
|
|
|
|
|
|
warehouseOutOrder.setCreateBy(sysMakeorderPickVo.getApplyUser()); |
|
|
|
|
|
warehouseOutOrder.setCreateTime(new Date()); |
|
|
|
|
|
warehouseOutOrder.setApplyName(sysMakeorderPickVo.getApplyUser()); |
|
|
|
|
|
//生成出库单数据
|
|
|
|
|
|
int insertResult = warehouseOutOrderMapper.insertWarehouseOutOrder(warehouseOutOrder); |
|
|
|
|
|
if (insertResult <= 0){ |
|
|
|
|
|
log.warn("添加出库单信息失败"); |
|
|
|
|
|
throw new RuntimeException("添加出库单信息失败"); |
|
|
|
|
|
} |
|
|
|
|
|
//生成出库单详情相关信息
|
|
|
|
|
|
generateWarehouseOutOrder(sysMakeorderPickVo, tempSysMakeorderPickVo, outOrderCode); |
|
|
|
|
|
return insertResult; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//生成出库单详情相关信息
|
|
|
|
|
|
private void generateWarehouseOutOrder(SysMakeorderPickVo sysMakeorderPickVo, SysMakeorderPickVo tempSysMakeorderPickVo, String outOrderCode) { |
|
|
|
|
|
SysMakeorderPickDetail tempMakeorderPickDetail = new SysMakeorderPickDetail(); |
|
|
|
|
|
tempMakeorderPickDetail.setPickNo(tempSysMakeorderPickVo.getPickNo()); |
|
|
|
|
|
tempMakeorderPickDetail.setMakeNo(tempSysMakeorderPickVo.getMakeNo()); |
|
|
|
|
|
//查询生产物料领料单详情
|
|
|
|
|
|
List<SysMakeorderPickDetail> sysMakeorderPickDetails = makeorderPickDetailMapper.selectSysMakeorderPickDetailByNo(tempMakeorderPickDetail); |
|
|
|
|
|
for (SysMakeorderPickDetail sysMakeorderPickDetail : sysMakeorderPickDetails) { |
|
|
|
|
|
WarehouseOutOrderDetail warehouseOutOrderDetail = new WarehouseOutOrderDetail(); |
|
|
|
|
|
warehouseOutOrderDetail.setOutOrderCode(outOrderCode); |
|
|
|
|
|
warehouseOutOrderDetail.setWarehouseOutStatus("4"); |
|
|
|
|
|
warehouseOutOrderDetail.setRelatedOrderCode(tempSysMakeorderPickVo.getMakeNo()); |
|
|
|
|
|
warehouseOutOrderDetail.setMakeNo(tempSysMakeorderPickVo.getMakeNo()); |
|
|
|
|
|
//标明来源是生产订单
|
|
|
|
|
|
warehouseOutOrderDetail.setWarehouseOrderType("1"); |
|
|
|
|
|
warehouseOutOrderDetail.setWarehouseOutType("1"); |
|
|
|
|
|
warehouseOutOrderDetail.setMaterialSum(tempSysMakeorderPickVo.getMaterialSum()); |
|
|
|
|
|
warehouseOutOrderDetail.setEnterpriseSum(tempSysMakeorderPickVo.getEnterpriseSum()); |
|
|
|
|
|
|
|
|
|
|
|
warehouseOutOrderDetail.setCreateBy(sysMakeorderPickVo.getApplyUser()); |
|
|
|
|
|
warehouseOutOrderDetail.setCreateTime(new Date()); |
|
|
|
|
|
warehouseOutOrderDetail.setApplyName(sysMakeorderPickVo.getApplyUser()); |
|
|
|
|
|
//物料相关信息
|
|
|
|
|
|
warehouseOutOrderDetail.setMaterialNo(sysMakeorderPickDetail.getMaterialNo()); |
|
|
|
|
|
warehouseOutOrderDetail.setMaterialName(sysMakeorderPickDetail.getMaterialName()); |
|
|
|
|
|
warehouseOutOrderDetail.setMaterialDescribe(sysMakeorderPickDetail.getDescribe()); |
|
|
|
|
|
warehouseOutOrderDetail.setMaterialUnit(sysMakeorderPickDetail.getUnit()); |
|
|
|
|
|
warehouseOutOrderDetail.setMaterialBrand(sysMakeorderPickDetail.getBrand()); |
|
|
|
|
|
warehouseOutOrderDetail.setMaterialProcessMethod(sysMakeorderPickDetail.getProcessMethod()); |
|
|
|
|
|
warehouseOutOrderDetail.setMakeNum(tempSysMakeorderPickVo.getMaterialSum()); |
|
|
|
|
|
if (StringUtils.isNotEmpty(sysMakeorderPickDetail.getDescribe())){ |
|
|
|
|
|
String[] splitDescribe = sysMakeorderPickDetail.getDescribe().split(","); |
|
|
|
|
|
warehouseOutOrderDetail.setMaterialModel(splitDescribe[0]); |
|
|
|
|
|
warehouseOutOrderDetail.setMaterialSpecification(splitDescribe[1]); |
|
|
|
|
|
} |
|
|
|
|
|
outOrderDetailMapper.insertWarehouseOutOrderDetail(warehouseOutOrderDetail); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|