From 679918bfb5adf13c6920e9f7d3ea82d19156c2fc Mon Sep 17 00:00:00 2001 From: liuxiaoxu <1793812695@qq.com> Date: Wed, 26 Jun 2024 10:34:33 +0800 Subject: [PATCH] =?UTF-8?q?[feat]=20=E7=94=9F=E4=BA=A7=E7=AE=A1=E7=90=86?= =?UTF-8?q?=20=E4=BB=93=E5=BA=93=E7=AE=A1=E7=90=86=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=A6=82=E6=9E=9C=E7=94=9F=E4=BA=A7=E9=A2=86=E6=96=99=E5=8D=95?= =?UTF-8?q?=E5=AE=A1=E6=A0=B8=E9=80=9A=E8=BF=87=E5=90=8E=EF=BC=8C=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E7=94=9F=E6=88=90=E5=87=BA=E5=BA=93=E5=8D=95=E5=90=8E?= =?UTF-8?q?=E7=AB=AF=E6=8E=A5=E5=8F=A3=20=E6=96=B0=E5=A2=9E=E6=A0=B9?= =?UTF-8?q?=E6=8D=AE=E7=94=9F=E4=BA=A7=E5=8D=95=E5=8F=B7=E5=92=8C=E7=94=9F?= =?UTF-8?q?=E4=BA=A7=E8=AE=A2=E5=8D=95=E9=A2=86=E6=96=99=E5=8F=B7=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E7=94=9F=E4=BA=A7=E8=AE=A2=E5=8D=95=E9=A2=86=E6=96=99?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E5=90=8E=E7=AB=AF=E6=8E=A5=E5=8F=A3=20?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=87=AA=E5=8A=A8=E7=94=9F=E4=BA=A7=E5=87=BA?= =?UTF-8?q?=E5=BA=93=E5=8D=95=E8=AF=A6=E6=83=85=E5=90=8E=E7=AB=AF=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=20=E4=BF=AE=E6=94=B9=E7=94=9F=E4=BA=A7=E9=A2=86?= =?UTF-8?q?=E6=96=99=E5=8D=95VO=E7=B1=BB=E7=9A=84=E7=89=A9=E6=96=99?= =?UTF-8?q?=E5=90=88=E8=AE=A1=E5=92=8C=E6=95=B0=E9=87=8F=E5=90=88=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SysMakeorderPickController.java | 8 +- .../system/domain/SysMakeorderPickVo.java | 4 +- .../mapper/SysMakeorderPickDetailMapper.java | 6 ++ .../service/IWarehouseOutOrderService.java | 8 ++ .../impl/WarehouseOutOrderServiceImpl.java | 93 +++++++++++++++++++ .../system/SysMakeorderPickDetailMapper.xml | 11 ++- 6 files changed, 126 insertions(+), 4 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeorderPickController.java b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeorderPickController.java index 57c8f353..b301e1aa 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeorderPickController.java +++ b/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.SysMakeorderPickVo; import com.ruoyi.system.service.ISysMakeorderPickService; +import com.ruoyi.warehouse.service.IWarehouseOutOrderService; import org.activiti.engine.RuntimeService; import org.activiti.engine.TaskService; import org.activiti.engine.runtime.ProcessInstance; @@ -52,7 +53,8 @@ public class SysMakeorderPickController extends BaseController @Autowired private IProcessService processService; - + @Autowired + private IWarehouseOutOrderService warehouseOutOrderService; @RequiresPermissions("system:makeorderpick:view") @GetMapping() @@ -169,6 +171,10 @@ public class SysMakeorderPickController extends BaseController if (processIsFinish) { // 审核通过 makeorderPickVo.setAuditStatus("1"); + //查找审核通过的领料单 + SysMakeorderPickVo sysMakeorderPickVo = sysMakeorderPickService.selectSysMakeorderPickById(makeorderPickVo.getId()); + //如果领料单审核通过,生产出库单 + warehouseOutOrderService.generateWarehouseOutOrderByMakeorderPick(sysMakeorderPickVo); // 提交 if("submit".equals(instanceType)){ // 使用状态-是 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysMakeorderPickVo.java b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysMakeorderPickVo.java index 09a7d5e2..f722abd9 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysMakeorderPickVo.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysMakeorderPickVo.java @@ -33,9 +33,9 @@ public class SysMakeorderPickVo extends SysMakeorderPick { private String instanceTypeName; /*物料合计*/ - private Double materialSum; + private Integer materialSum; /*数量合计*/ - private Double enterpriseSum; + private Integer enterpriseSum; /** * 关键词 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysMakeorderPickDetailMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysMakeorderPickDetailMapper.java index 80fab2a7..b234c08f 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysMakeorderPickDetailMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysMakeorderPickDetailMapper.java @@ -74,4 +74,10 @@ public interface SysMakeorderPickDetailMapper * @return 结果 */ public int restoreSysMakeorderPickDetailById(Long id); + + + /* + * 根据生产单号和领料单号查询 领料单详情信息 + * */ + List selectSysMakeorderPickDetailByNo(SysMakeorderPickDetail sysMakeorderPickDetail); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseOutOrderService.java b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseOutOrderService.java index 45a1ee14..7c4665dc 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseOutOrderService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseOutOrderService.java @@ -1,6 +1,8 @@ package com.ruoyi.warehouse.service; import java.util.List; + +import com.ruoyi.system.domain.SysMakeorderPickVo; import com.ruoyi.warehouse.domain.WarehouseOutOrder; /** @@ -87,4 +89,10 @@ public interface IWarehouseOutOrderService * 修改保存销售单-出库 */ int updateRefundsExchangesOutWarehouse(WarehouseOutOrder warehouseOutOrder); + + + /* + * 领料单审核通过后生成出库单 + * */ + int generateWarehouseOutOrderByMakeorderPick(SysMakeorderPickVo sysMakeorderPickVo); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseOutOrderServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseOutOrderServiceImpl.java index b1f7fb87..8f654a63 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseOutOrderServiceImpl.java +++ b/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.List; + +import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.ShiroUtils; 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.mapper.WarehouseOutOrderDetailMapper; import lombok.extern.slf4j.Slf4j; @@ -32,6 +38,15 @@ public class WarehouseOutOrderServiceImpl implements IWarehouseOutOrderService @Autowired 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; } + + /* + * 领料单审核通过后生成出库单 + * */ + @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 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); + } + } } diff --git a/ruoyi-admin/src/main/resources/mapper/system/SysMakeorderPickDetailMapper.xml b/ruoyi-admin/src/main/resources/mapper/system/SysMakeorderPickDetailMapper.xml index f5d32637..5ee983b3 100644 --- a/ruoyi-admin/src/main/resources/mapper/system/SysMakeorderPickDetailMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/system/SysMakeorderPickDetailMapper.xml @@ -56,7 +56,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where id = #{id} - + + + + + + insert into sys_makeorder_pick_detail