Browse Source

[feat] 生产管理 仓库管理

新增如果生产领料单审核通过后,自动生成出库单后端接口
新增根据生产单号和生产订单领料号查询生产订单领料详情后端接口
新增自动生产出库单详情后端接口
修改生产领料单VO类的物料合计和数量合计
dev
liuxiaoxu 5 months ago
parent
commit
679918bfb5
  1. 8
      ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeorderPickController.java
  2. 4
      ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysMakeorderPickVo.java
  3. 6
      ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysMakeorderPickDetailMapper.java
  4. 8
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseOutOrderService.java
  5. 93
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseOutOrderServiceImpl.java
  6. 9
      ruoyi-admin/src/main/resources/mapper/system/SysMakeorderPickDetailMapper.xml

8
ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeorderPickController.java

@ -12,6 +12,7 @@ import com.ruoyi.process.general.service.IProcessService;
import com.ruoyi.system.domain.SysMakeorderPick; import com.ruoyi.system.domain.SysMakeorderPick;
import com.ruoyi.system.domain.SysMakeorderPickVo; import com.ruoyi.system.domain.SysMakeorderPickVo;
import com.ruoyi.system.service.ISysMakeorderPickService; import com.ruoyi.system.service.ISysMakeorderPickService;
import com.ruoyi.warehouse.service.IWarehouseOutOrderService;
import org.activiti.engine.RuntimeService; import org.activiti.engine.RuntimeService;
import org.activiti.engine.TaskService; import org.activiti.engine.TaskService;
import org.activiti.engine.runtime.ProcessInstance; import org.activiti.engine.runtime.ProcessInstance;
@ -52,7 +53,8 @@ public class SysMakeorderPickController extends BaseController
@Autowired @Autowired
private IProcessService processService; private IProcessService processService;
@Autowired
private IWarehouseOutOrderService warehouseOutOrderService;
@RequiresPermissions("system:makeorderpick:view") @RequiresPermissions("system:makeorderpick:view")
@GetMapping() @GetMapping()
@ -169,6 +171,10 @@ public class SysMakeorderPickController extends BaseController
if (processIsFinish) { if (processIsFinish) {
// 审核通过 // 审核通过
makeorderPickVo.setAuditStatus("1"); makeorderPickVo.setAuditStatus("1");
//查找审核通过的领料单
SysMakeorderPickVo sysMakeorderPickVo = sysMakeorderPickService.selectSysMakeorderPickById(makeorderPickVo.getId());
//如果领料单审核通过,生产出库单
warehouseOutOrderService.generateWarehouseOutOrderByMakeorderPick(sysMakeorderPickVo);
// 提交 // 提交
if("submit".equals(instanceType)){ if("submit".equals(instanceType)){
// 使用状态-是 // 使用状态-是

4
ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysMakeorderPickVo.java

@ -33,9 +33,9 @@ public class SysMakeorderPickVo extends SysMakeorderPick {
private String instanceTypeName; private String instanceTypeName;
/*物料合计*/ /*物料合计*/
private Double materialSum; private Integer materialSum;
/*数量合计*/ /*数量合计*/
private Double enterpriseSum; private Integer enterpriseSum;
/** /**
* 关键词 * 关键词

6
ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysMakeorderPickDetailMapper.java

@ -74,4 +74,10 @@ public interface SysMakeorderPickDetailMapper
* @return 结果 * @return 结果
*/ */
public int restoreSysMakeorderPickDetailById(Long id); public int restoreSysMakeorderPickDetailById(Long id);
/*
* 根据生产单号和领料单号查询 领料单详情信息
* */
List<SysMakeorderPickDetail> selectSysMakeorderPickDetailByNo(SysMakeorderPickDetail sysMakeorderPickDetail);
} }

8
ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseOutOrderService.java

@ -1,6 +1,8 @@
package com.ruoyi.warehouse.service; package com.ruoyi.warehouse.service;
import java.util.List; import java.util.List;
import com.ruoyi.system.domain.SysMakeorderPickVo;
import com.ruoyi.warehouse.domain.WarehouseOutOrder; import com.ruoyi.warehouse.domain.WarehouseOutOrder;
/** /**
@ -87,4 +89,10 @@ public interface IWarehouseOutOrderService
* 修改保存销售单-出库 * 修改保存销售单-出库
*/ */
int updateRefundsExchangesOutWarehouse(WarehouseOutOrder warehouseOutOrder); int updateRefundsExchangesOutWarehouse(WarehouseOutOrder warehouseOutOrder);
/*
* 领料单审核通过后生成出库单
* */
int generateWarehouseOutOrderByMakeorderPick(SysMakeorderPickVo sysMakeorderPickVo);
} }

93
ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseOutOrderServiceImpl.java

@ -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);
}
}
} }

9
ruoyi-admin/src/main/resources/mapper/system/SysMakeorderPickDetailMapper.xml

@ -57,6 +57,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id} where id = #{id}
</select> </select>
<select id="selectSysMakeorderPickDetailByNo" parameterType="SysMakeorderPickDetail" resultMap="SysMakeorderPickDetailResult">
<include refid="selectSysMakeorderPickDetailVo"/>
where a.make_no = #{makeNo}
and a.pick_no = #{pickNo}
</select>
<insert id="insertSysMakeorderPickDetail" parameterType="SysMakeorderPickDetail" useGeneratedKeys="true" keyProperty="id"> <insert id="insertSysMakeorderPickDetail" parameterType="SysMakeorderPickDetail" useGeneratedKeys="true" keyProperty="id">
insert into sys_makeorder_pick_detail insert into sys_makeorder_pick_detail
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">

Loading…
Cancel
Save