From 8af73dacf514af1227790b4bfb3f36bcce4d99fa Mon Sep 17 00:00:00 2001 From: liuxiaoxu <1793812695@qq.com> Date: Tue, 25 Jun 2024 19:34:57 +0800 Subject: [PATCH] =?UTF-8?q?[fix]=E7=94=9F=E4=BA=A7=E7=AE=A1=E7=90=86=20?= =?UTF-8?q?=E4=BB=93=E5=BA=93=E7=AE=A1=E7=90=86=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E4=BB=93=E5=BA=93=E5=85=A5=E5=BA=93=E5=8D=95=E9=87=87=E8=B4=AD?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E7=9A=84=E5=85=A5=E5=BA=93=E9=97=AE=E9=A2=98?= =?UTF-8?q?=20=E6=96=B0=E5=A2=9E=E6=A0=B9=E6=8D=AE=E5=85=A5=E5=BA=93?= =?UTF-8?q?=E5=8D=95=E5=8F=B7=E6=9F=A5=E8=AF=A2=E7=94=9F=E4=BA=A7=E5=8D=95?= =?UTF-8?q?=E5=8F=B7=E5=90=8E=E7=AB=AF=E6=8E=A5=E5=8F=A3=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=85=A5=E5=BA=93-=E9=87=87=E8=B4=AD=E5=8D=95(?= =?UTF-8?q?=E9=87=87=E8=B4=AD=E5=85=A5=E5=BA=93)=20=E5=90=8E=E7=AB=AF?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/mapper/SysMakeOrderMapper.java | 6 +++ .../system/service/ISysMakeOrderService.java | 7 +++ .../service/impl/SysMakeOrderServiceImpl.java | 45 +++++++++++++++++++ .../WarehouseStorageOrderController.java | 2 +- .../IWarehouseStorageOrderService.java | 5 +++ .../WarehouseStorageOrderServiceImpl.java | 39 ++++++++++++++++ .../mapper/system/SysMakeOrderMapper.xml | 10 +++++ .../storageOrder/storagePurchase.html | 3 +- 8 files changed, 115 insertions(+), 2 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysMakeOrderMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysMakeOrderMapper.java index 9f0311d9..c31a1a5f 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysMakeOrderMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysMakeOrderMapper.java @@ -113,4 +113,10 @@ public interface SysMakeOrderMapper * 根据生产单号查询生产单 * */ SysMakeOrder selectMakeOrderByMakeNo(String makeNo); + + + /* + * 根据入库单号查询生产单号 + * */ + String selectMakeByWarehouseStorageCode(String warehouseStorageCode); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysMakeOrderService.java b/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysMakeOrderService.java index 03efbb39..1228a758 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysMakeOrderService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysMakeOrderService.java @@ -2,6 +2,8 @@ package com.ruoyi.system.service; import com.ruoyi.system.domain.SysMakeOrder; import com.ruoyi.system.dto.SysMakeorderMaterialDto; +import com.ruoyi.warehouse.domain.WarehouseStorageOrder; +import com.ruoyi.warehouse.domain.WarehouseStorageOrderDetail; import java.util.List; @@ -105,4 +107,9 @@ public interface ISysMakeOrderService * 品质管理制程检验工序关联生产单号 * */ List selectAllMakeNos(); + + /* + * 仓库采购入库单进行入库的时候更新生产订单数据 + * */ + int updateSysMakeOrderByWarehouseStorageOrder(WarehouseStorageOrder warehouseStorageOrder, List warehouseStorageOrderDetailList); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysMakeOrderServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysMakeOrderServiceImpl.java index 25929610..f42ff0f2 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysMakeOrderServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysMakeOrderServiceImpl.java @@ -5,6 +5,7 @@ import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.ShiroUtils; +import com.ruoyi.common.utils.StringUtils; import com.ruoyi.erp.domain.ErpBom; import com.ruoyi.erp.service.IErpBomService; import com.ruoyi.purchase.service.IPurchasePlanService; @@ -15,12 +16,16 @@ import com.ruoyi.system.domain.SysSalesOrderVo; import com.ruoyi.system.dto.SysMakeorderMaterialDto; import com.ruoyi.system.mapper.SysMakeOrderMapper; import com.ruoyi.system.service.*; +import com.ruoyi.warehouse.domain.WarehouseStorageOrder; +import com.ruoyi.warehouse.domain.WarehouseStorageOrderDetail; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; +import java.util.Date; import java.util.List; /** @@ -30,6 +35,7 @@ import java.util.List; * @date 2023-12-18 */ @Service +@Slf4j public class SysMakeOrderServiceImpl implements ISysMakeOrderService { @Autowired @@ -279,4 +285,43 @@ public class SysMakeOrderServiceImpl implements ISysMakeOrderService List list=sysMakeOrderMapper.selectAllMakeNos(); return list; } + + /* + * 仓库采购入库单进行入库的时候更新生产订单数据 + * */ + @Override + public int updateSysMakeOrderByWarehouseStorageOrder(WarehouseStorageOrder warehouseStorageOrder,List warehouseStorageOrderDetailList) { + + SysMakeOrder sysMakeOrder = new SysMakeOrder(); + sysMakeOrder.setUpdateBy(ShiroUtils.getLoginName()); + sysMakeOrder.setUpdateTime(new Date()); + //暂时假设全部入库 + sysMakeOrder.setEceiptStatus("8"); + //暂时假设全部品质 + sysMakeOrder.setQualityStatus("2"); + //查询生产订单数据 根据 入库单关联单号 + String warehouseStorageCode = warehouseStorageOrder.getWarehouseStorageCode(); + if (StringUtils.isEmpty(warehouseStorageCode)){ + log.warn("更新生产订单相关的入库单号为空:{}",warehouseStorageCode); + } + //合计入库的时候所有物料信息的入库数量 + int makeOrderStorageNum = warehouseStorageOrderDetailList.stream() + .mapToInt(WarehouseStorageOrderDetail::getStorageNum) + .sum(); + + String makeNo = sysMakeOrderMapper.selectMakeByWarehouseStorageCode(warehouseStorageCode); + if (StringUtils.isEmpty(makeNo)) { + log.warn("找不到与仓库存储单号[{}]相关的生产单号", warehouseStorageCode); + } + + sysMakeOrder.setMakeNo(makeNo); + sysMakeOrder.setEceiptNum((long) makeOrderStorageNum); + //更新生产订单的数据 + int updateResult = sysMakeOrderMapper.updateByMakeNo(sysMakeOrder); + if (updateResult <= 0){ + log.warn("更新生产单失败,未影响任何行"); + } + return updateResult; + + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseStorageOrderController.java b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseStorageOrderController.java index 877d4a91..08c893af 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseStorageOrderController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseStorageOrderController.java @@ -318,7 +318,7 @@ public class WarehouseStorageOrderController extends BaseController @ResponseBody public AjaxResult storagePurchaseSave(@RequestBody WarehouseStorageOrder warehouseStorageOrder) { - return toAjax(warehouseStorageOrderService.updateWarehouseStorageOrder(warehouseStorageOrder)); + return toAjax(warehouseStorageOrderService.storagePurchaseWarehouseStorageOrder(warehouseStorageOrder)); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseStorageOrderService.java b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseStorageOrderService.java index 944a0368..ed39e981 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseStorageOrderService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseStorageOrderService.java @@ -88,4 +88,9 @@ public interface IWarehouseStorageOrderService int temporaryPurchaseWarehouseStorageOrder(WarehouseStorageOrder warehouseStorageOrder); int updateWarehouseStorageOrderByQualityOrder(QualityOrder qualityOrder, List qualityOrderDetailList); + + /** + * 入库-采购单(采购入库) + * */ + int storagePurchaseWarehouseStorageOrder(WarehouseStorageOrder warehouseStorageOrder); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseStorageOrderServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseStorageOrderServiceImpl.java index 712a9675..b43423e5 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseStorageOrderServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseStorageOrderServiceImpl.java @@ -17,6 +17,7 @@ import com.ruoyi.quality.mapper.QualityOrderMapper; import com.ruoyi.quality.mapper.QualityOrderReportMapper; import com.ruoyi.quality.mapper.QualityOrderReportUnqualifiedMapper; import com.ruoyi.quality.service.IQualityOrderService; +import com.ruoyi.system.service.ISysMakeOrderService; import com.ruoyi.warehouse.domain.WarehouseStorageOrderDetail; import com.ruoyi.warehouse.mapper.WarehouseStorageOrderDetailMapper; import lombok.extern.slf4j.Slf4j; @@ -50,6 +51,9 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS @Autowired private IQualityOrderService qualityOrderService; + @Autowired + private ISysMakeOrderService sysMakeOrderService; + @Autowired private RedisCache redisCache; @@ -195,6 +199,41 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS return updateResult; } + /** + * 入库-采购单(采购入库) + * */ + @Transactional(rollbackFor = Exception.class) + @Override + public int storagePurchaseWarehouseStorageOrder(WarehouseStorageOrder warehouseStorageOrder) { + + + //假设全部入库 + warehouseStorageOrder.setWarehouseStorageStatus("4"); + warehouseStorageOrder.setUpdateBy(ShiroUtils.getLoginName()); + warehouseStorageOrder.setUpdateTime(new Date()); + //记录一下入库时间 + warehouseStorageOrder.setStorageTime(new Date()); + List warehouseStorageOrderDetailList = warehouseStorageOrder.getWarehouseStorageOrderDetailList(); + if (StringUtils.isEmpty(warehouseStorageOrderDetailList)){ + log.warn("入库单详情数据为空:{}",warehouseStorageOrderDetailList); + } + //更新生产单数据 + sysMakeOrderService.updateSysMakeOrderByWarehouseStorageOrder(warehouseStorageOrder,warehouseStorageOrderDetailList); + + for (WarehouseStorageOrderDetail warehouseStorageOrderDetail : warehouseStorageOrderDetailList) { + //更新入库单详情的数据 + storageOrderDetailMapper.updateWarehouseStorageOrderDetail(warehouseStorageOrderDetail); + } + + //更新入库单的数据 + int updateResult = warehouseStorageOrderMapper.updateWarehouseStorageOrder(warehouseStorageOrder); + + if (updateResult <= 0){ + log.warn("更新入库单失败,未影响任何行"); + } + return updateResult; + } + /* * 更新仓库入库单详情的数据 * */ diff --git a/ruoyi-admin/src/main/resources/mapper/system/SysMakeOrderMapper.xml b/ruoyi-admin/src/main/resources/mapper/system/SysMakeOrderMapper.xml index 47e8e327..03ebffbe 100644 --- a/ruoyi-admin/src/main/resources/mapper/system/SysMakeOrderMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/system/SysMakeOrderMapper.xml @@ -269,4 +269,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where makeNo = #{makeNo} + + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/storagePurchase.html b/ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/storagePurchase.html index 9b5fcbe7..a9b8ac0c 100644 --- a/ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/storagePurchase.html +++ b/ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/storagePurchase.html @@ -362,7 +362,8 @@ // 仓库ID selectElement.append(''); }); - // $('#warehouseCode').val(stockNO); + //如果后端已经有值,回显 + $('#warehouseCode').val(warehouseCode); } else { $.modal.errMsg("数据为空"); }