From 824fdbd64afc3914c413e7d6f7d55cdb4d52bb11 Mon Sep 17 00:00:00 2001 From: liuxiaoxu <1793812695@qq.com> Date: Mon, 8 Jul 2024 10:24:13 +0800 Subject: [PATCH] =?UTF-8?q?[fix]=20=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=E6=94=B9=20?= =?UTF-8?q?=E7=94=9F=E4=BA=A7=E3=80=81=E5=A7=94=E5=86=85=E5=85=A5=E5=BA=93?= =?UTF-8?q?=E5=8D=95=E9=A1=B5=E9=9D=A2=20=E6=96=B0=E5=A2=9E=E5=85=A5?= =?UTF-8?q?=E5=BA=93=E6=95=B0=E5=AD=97=E6=AE=B5=20=E4=BF=AE=E6=94=B9=20?= =?UTF-8?q?=E5=93=81=E8=B4=A8=E5=8D=95=E5=AE=9E=E4=BD=93=E7=B1=BB=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=20=E5=85=A5=E5=BA=93=E6=95=B0=E5=AD=97=E6=AE=B5=20?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=93=81=E8=B4=A8mapper=E5=B1=82=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E6=96=B9=E6=B3=95=20=E4=BF=AE=E6=94=B9=E4=BB=93?= =?UTF-8?q?=E5=BA=93=E5=85=A5=E5=BA=93=E6=9A=82=E6=94=B6=20=E7=89=A9?= =?UTF-8?q?=E6=96=99=E5=85=A5=E5=BA=93=E9=83=A8=E9=97=A8=E4=B8=BA=E4=BB=93?= =?UTF-8?q?=E5=BA=93=E7=9A=84=E5=90=8E=E7=AB=AF=E6=8E=A5=E5=8F=A3=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruoyi/quality/domain/QualityOrder.java | 12 +++++ .../WarehouseStorageOrderController.java | 2 +- .../IWarehouseStorageOrderService.java | 5 ++ .../WarehouseStorageOrderServiceImpl.java | 52 +++++++++++++++++++ .../mapper/quality/QualityOrderMapper.xml | 6 ++- .../erp/inboundOrder/inboundOrder.html | 2 +- 6 files changed, 76 insertions(+), 3 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/quality/domain/QualityOrder.java b/ruoyi-admin/src/main/java/com/ruoyi/quality/domain/QualityOrder.java index 1f2e4166..755250f3 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/quality/domain/QualityOrder.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/quality/domain/QualityOrder.java @@ -59,6 +59,9 @@ public class QualityOrder extends BaseEntity @Excel(name = "品质不合格数") private Integer qualityUnqualifiedNum; + /** 入库数 */ + private Integer storageNum; + /** 委内加工费总价 */ private BigDecimal makeInTotalPrice; @@ -224,6 +227,14 @@ public class QualityOrder extends BaseEntity this.qualityOrderDetailList = qualityOrderDetailList; } + public Integer getStorageNum() { + return storageNum; + } + + public void setStorageNum(Integer storageNum) { + this.storageNum = storageNum; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) @@ -248,6 +259,7 @@ public class QualityOrder extends BaseEntity .append("createTime", getCreateTime()) .append("updateBy", getUpdateBy()) .append("updateTime", getUpdateTime()) + .append("storageNum",getStorageNum()) .toString(); } } 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 871d0a8a..4a0941fa 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 @@ -139,7 +139,7 @@ public class WarehouseStorageOrderController extends BaseController @ResponseBody public AjaxResult temporaryPurchaseWarehouseSave(@RequestBody WarehouseStorageOrder warehouseStorageOrder) { - return toAjax(warehouseStorageOrderService.updateWarehouseStorageOrder(warehouseStorageOrder)); + return toAjax(warehouseStorageOrderService.updateTemporaryPurchaseWarehouse(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 506ecf85..5f78b31d 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 @@ -118,4 +118,9 @@ public interface IWarehouseStorageOrderService * 修改保存入库-生产订单(委内入库) * */ int updateStorageMakeIn(WarehouseStorageOrder warehouseStorageOrder); + + /** + * 修改保存暂收-采购单(仓库入库) + */ + int updateTemporaryPurchaseWarehouse(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 e2352fc5..26aeb414 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 @@ -523,6 +523,58 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS } + /** + * 修改保存暂收-采购单(仓库入库) + */ + @Transactional(rollbackFor = Exception.class) + @Override + public int updateTemporaryPurchaseWarehouse(WarehouseStorageOrder warehouseStorageOrder) { + String loginName = ShiroUtils.getLoginName(); + warehouseStorageOrder.setUpdateBy(loginName); + warehouseStorageOrder.setUpdateTime(DateUtils.getNowDate()); + //改变状态为已暂收 + warehouseStorageOrder.setWarehouseStorageStatus("1"); + //设置品质状态,为待品质 + warehouseStorageOrder.setWarehouseQualityStatus("0"); + warehouseStorageOrder.setWarehouseEmployee(loginName); + List warehouseStorageOrderDetailList = warehouseStorageOrder.getWarehouseStorageOrderDetailList(); + //入库单主表的实际到货数为子表的合计 + int actualArriveNum = warehouseStorageOrderDetailList.stream().mapToInt(WarehouseStorageOrderDetail::getActualArriveNum).sum(); + //入库单主表的暂收合格数为子表的合计 + int temporaryQualifiedNum = warehouseStorageOrderDetailList.stream().mapToInt(WarehouseStorageOrderDetail::getTemporaryQualifiedNum).sum(); + if (actualArriveNum < temporaryQualifiedNum) { + throw new BusinessException("暂收合格数不能大于实际到货数"); + } + + //插入实际到货数 + warehouseStorageOrder.setActualArrivedNum(actualArriveNum); + //插入暂收合格数 + warehouseStorageOrder.setTemporaryQualifiedNum(temporaryQualifiedNum); + //插入暂收不合格数 + warehouseStorageOrder.setTemporaryUnqualifiedNum(Math.max(0, actualArriveNum - temporaryQualifiedNum)); + //设置暂存时间 + warehouseStorageOrder.setTemporaryTime(new Date()); + int updateDetailResult = updateTemporaryPurchaseDetails(warehouseStorageOrder); + if (updateDetailResult != warehouseStorageOrder.getWarehouseStorageOrderDetailList().size()) { + throw new BusinessException("更新入库单明细记录失败"); + } + int updateResult = warehouseStorageOrderMapper.updateWarehouseStorageOrder(warehouseStorageOrder); + if (updateResult <= 0) { + throw new BusinessException("更新入库单主记录失败"); + } + + try { + qualityOrderService.insertQualityOrderByWarehouseStorageOrder(warehouseStorageOrder, warehouseStorageOrder.getWarehouseStorageOrderDetailList()); + } catch (Exception e) { + TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); + log.error("生成品质单时发生错误", e); + throw new BusinessException("生成品质单时发生错误"); + } + + return updateResult; + + } + /** * 修改保存暂收-采购单(采购入库) 子表数据 * */ diff --git a/ruoyi-admin/src/main/resources/mapper/quality/QualityOrderMapper.xml b/ruoyi-admin/src/main/resources/mapper/quality/QualityOrderMapper.xml index b69ad95c..33ec0f68 100644 --- a/ruoyi-admin/src/main/resources/mapper/quality/QualityOrderMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/quality/QualityOrderMapper.xml @@ -15,6 +15,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -98,8 +99,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" qo.create_time, qo.update_by, qo.update_time, - qo.make_in_total_price + qo.make_in_total_price, + wso.storage_num from quality_order qo + left join warehouse_storage_order wso on wso.related_order_code = qo.related_order_code + and qo.quality_order_code = #{qualityOrderCode} and qo.in_storage_code = #{inStorageCode} diff --git a/ruoyi-admin/src/main/resources/templates/erp/inboundOrder/inboundOrder.html b/ruoyi-admin/src/main/resources/templates/erp/inboundOrder/inboundOrder.html index c272a366..0124655d 100644 --- a/ruoyi-admin/src/main/resources/templates/erp/inboundOrder/inboundOrder.html +++ b/ruoyi-admin/src/main/resources/templates/erp/inboundOrder/inboundOrder.html @@ -165,7 +165,7 @@ { title: '入库数', - field: 'storage_num', + field: 'storageNum', }, // {