From d92c02bf884a93742eb322ef50f8395cb7f2fa3a Mon Sep 17 00:00:00 2001 From: liuxiaoxu <1793812695@qq.com> Date: Fri, 21 Jun 2024 19:11:03 +0800 Subject: [PATCH 1/4] =?UTF-8?q?[fix]=E7=94=9F=E4=BA=A7=E7=AE=A1=E7=90=86?= =?UTF-8?q?=20=E7=94=9F=E4=BA=A7=E8=AE=A2=E5=8D=95=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E7=94=9F=E4=BA=A7=E8=AE=A2=E5=8D=95=E9=A2=86=E6=96=99500?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ruoyi/system/controller/SysMakeOrderController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeOrderController.java b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeOrderController.java index f09fcdab..a536b003 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeOrderController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeOrderController.java @@ -146,7 +146,7 @@ public class SysMakeOrderController extends BaseController sysMakeOrder.setCustomerOderCode(sysSalesOrder.getSalesOrderNumber()); } mmap.put("sysMakeOrder", sysMakeOrder); - return prefix + "/addPick"; + return prefix + "/addpick"; } /** From e7b3ae034d659925c2015d85fe780fa54dd0e709 Mon Sep 17 00:00:00 2001 From: liuxiaoxu <1793812695@qq.com> Date: Fri, 21 Jun 2024 19:23:30 +0800 Subject: [PATCH 2/4] =?UTF-8?q?[fix]=E9=87=87=E8=B4=AD=E7=AE=A1=E7=90=86?= =?UTF-8?q?=20=E9=87=87=E8=B4=AD=E8=AE=A2=E5=8D=95=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E9=87=87=E8=B4=AD=E8=AE=A2=E5=8D=95=E6=8C=89=E9=92=AE=E7=9A=84?= =?UTF-8?q?=E9=87=87=E8=B4=AD=E8=AE=A2=E5=8D=95=E6=B7=BB=E5=8A=A0=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2addPurchaseStorage.html?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../purchaseOrder/addPurchaseStorage.html | 290 ++++++++++++++++++ 1 file changed, 290 insertions(+) create mode 100644 ruoyi-admin/src/main/resources/templates/purchase/purchaseOrder/addPurchaseStorage.html diff --git a/ruoyi-admin/src/main/resources/templates/purchase/purchaseOrder/addPurchaseStorage.html b/ruoyi-admin/src/main/resources/templates/purchase/purchaseOrder/addPurchaseStorage.html new file mode 100644 index 00000000..85306ef0 --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/purchase/purchaseOrder/addPurchaseStorage.html @@ -0,0 +1,290 @@ + + + + + + + + +
+
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+ + +
+
+
+
+ +
+
+ +
+
+
+
+
+ + + + + + \ No newline at end of file From 990b694dc6c26f3e57d938a6f121e7fedbb13afd Mon Sep 17 00:00:00 2001 From: liuxiaoxu <1793812695@qq.com> Date: Mon, 24 Jun 2024 13:43:08 +0800 Subject: [PATCH 3/4] =?UTF-8?q?[fix]=E9=87=87=E8=B4=AD=E7=AE=A1=E7=90=86?= =?UTF-8?q?=20=E9=87=87=E8=B4=AD=E5=85=A5=E5=BA=93=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E5=8D=95=20=E4=BF=AE=E5=A4=8D=E9=87=87=E8=B4=AD=E5=85=A5?= =?UTF-8?q?=E5=BA=93=E9=80=9A=E7=9F=A5=E5=8D=95=E5=89=8D=E7=AB=AF=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E4=B8=A2=E5=A4=B1=E9=97=AE=E9=A2=98,=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E9=87=87=E8=B4=AD=E5=85=A5=E5=BA=93=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E5=8D=95=E7=9A=84=E6=9F=A5=E8=AF=A2=E8=AF=AD=E5=8F=A5=20?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=87=87=E8=B4=AD=E5=85=A5=E5=BA=93=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E5=8D=95=E5=89=8D=E7=AB=AF=E9=A1=B5=E9=9D=A2=E7=9A=84?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6=E6=9F=A5=E8=AF=A2=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E9=87=87=E8=B4=AD=E5=85=A5=E5=BA=93=E9=80=9A=E7=9F=A5=E5=8D=95?= =?UTF-8?q?=E4=B8=BA=E5=88=9B=E5=BB=BA=E6=97=B6=E9=97=B4=E5=80=92=E5=8F=99?= =?UTF-8?q?=20=E6=96=B0=E5=A2=9E=E4=BB=93=E5=BA=93=E5=85=A5=E5=BA=93?= =?UTF-8?q?=E5=8D=95=E4=B8=BA=E5=88=9B=E5=BB=BA=E6=97=B6=E9=97=B4=E5=80=92?= =?UTF-8?q?=E5=8F=99=20=E5=8E=BB=E6=8E=89=E7=94=9F=E4=BA=A7=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E9=A1=B5=E9=9D=A2=E7=9A=84=E6=96=B0=E5=A2=9E,?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E5=92=8C=E5=88=A0=E9=99=A4=E6=8C=89?= =?UTF-8?q?=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/PurchaseStorageServiceImpl.java | 24 ++++++++-------- .../mapper/WarehouseStorageOrderMapper.java | 10 +++++++ .../warehouse/WarehouseStorageOrderMapper.xml | 20 ++++++++++++- .../purchaseStorage/purchaseStorage.html | 28 +++++++++---------- .../templates/system/makeorder/makeorder.html | 18 ++++++------ 5 files changed, 65 insertions(+), 35 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseStorageServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseStorageServiceImpl.java index 88d653c4..7aec9541 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseStorageServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseStorageServiceImpl.java @@ -52,14 +52,15 @@ public class PurchaseStorageServiceImpl implements IPurchaseStorageService @Override public List selectPurchaseStorageList(WarehouseStorageOrder warehouseStorageOrder) { - List allWarehouseStorageOrders = warehouseStorageOrderMapper.selectWarehouseStorageOrderList(warehouseStorageOrder); +// List allWarehouseStorageOrders = warehouseStorageOrderMapper.selectWarehouseStorageOrderList(warehouseStorageOrder); List purchaseStorages = new ArrayList<>(); // 使用流过滤出warehouseOrderType为"0"的记录 也就是采购订单 - List filteredWarehouseStorageOrders = allWarehouseStorageOrders.stream() - .filter(s -> "0".equals(s.getWarehouseOrderType())) - .collect(Collectors.toList()); +// List filteredWarehouseStorageOrders = allWarehouseStorageOrders.stream() +// .filter(s -> "0".equals(s.getWarehouseOrderType())) +// .collect(Collectors.toList()); + List allWarehouseStorageOrders = warehouseStorageOrderMapper.selectPurchaseStorageList(warehouseStorageOrder); - for (WarehouseStorageOrder wso : filteredWarehouseStorageOrders) { + for (WarehouseStorageOrder wso : allWarehouseStorageOrders) { PurchaseStorage ps = new PurchaseStorage(); BeanUtils.copyProperties(wso, ps); purchaseStorages.add(ps); @@ -70,13 +71,14 @@ public class PurchaseStorageServiceImpl implements IPurchaseStorageService @Override public List selectWarehouseStorageList(WarehouseStorageOrder warehouseStorageOrder) { // 先获取所有仓储订单列表 - List allWarehouseStorageOrders = warehouseStorageOrderMapper.selectWarehouseStorageOrderList(warehouseStorageOrder); + List allWarehouseStorageOrders = warehouseStorageOrderMapper.selectPurchaseStorageList(warehouseStorageOrder); - // 使用流过滤出warehouseOrderType为"0"的记录 也就是采购订单 - List filteredWarehouseStorageOrders = allWarehouseStorageOrders.stream() - .filter(s -> "0".equals(s.getWarehouseOrderType())) - .collect(Collectors.toList()); - return filteredWarehouseStorageOrders; +// // 使用流过滤出warehouseOrderType为"0"的记录 也就是采购订单 +// List filteredWarehouseStorageOrders = allWarehouseStorageOrders.stream() +// .filter(s -> "0".equals(s.getWarehouseOrderType())) +// .collect(Collectors.toList()); +// return filteredWarehouseStorageOrders; + return allWarehouseStorageOrders; } /** diff --git a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/mapper/WarehouseStorageOrderMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/mapper/WarehouseStorageOrderMapper.java index 760b974a..8c576ef1 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/mapper/WarehouseStorageOrderMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/mapper/WarehouseStorageOrderMapper.java @@ -28,6 +28,16 @@ public interface WarehouseStorageOrderMapper */ public List selectWarehouseStorageOrderList(WarehouseStorageOrder warehouseStorageOrder); + + + /** + * 采购入库通知单查询仓库入库单列表 + * + * @param warehouseStorageOrder 仓库入库单 + * @return 仓库入库单集合 + */ + public List selectPurchaseStorageList(WarehouseStorageOrder warehouseStorageOrder); + /** * 新增仓库入库单 * diff --git a/ruoyi-admin/src/main/resources/mapper/warehouse/WarehouseStorageOrderMapper.xml b/ruoyi-admin/src/main/resources/mapper/warehouse/WarehouseStorageOrderMapper.xml index 4b98771e..262bc0f0 100644 --- a/ruoyi-admin/src/main/resources/mapper/warehouse/WarehouseStorageOrderMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/warehouse/WarehouseStorageOrderMapper.xml @@ -50,8 +50,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and warehouse_employee = #{warehouseEmployee} and create_time between #{params.beginCreateTime} and #{params.endCreateTime} + order by create_time desc - + + + + + - -
  • - - -
  • -
  • - - +
  • -
  • -
  • +
  • + + +
  • + +
  • + + +
  • - @@ -97,8 +98,7 @@ restoreUrl: prefix + "/restore/{id}", exportUrl: prefix + "/export", modalName: "采购入库通知单", - fixedColumns: true, // 启用冻结列 - fixedRightNumber: 1, // 冻结右列个数 + columns: [ {checkbox: true}, {title: '入库单id',field: 'warehouseStorageId',visible: false}, diff --git a/ruoyi-admin/src/main/resources/templates/system/makeorder/makeorder.html b/ruoyi-admin/src/main/resources/templates/system/makeorder/makeorder.html index 1c0c1582..ef301b71 100644 --- a/ruoyi-admin/src/main/resources/templates/system/makeorder/makeorder.html +++ b/ruoyi-admin/src/main/resources/templates/system/makeorder/makeorder.html @@ -78,15 +78,15 @@
    - - 添加 - - - 修改 - - - 删除 - + + + + + + + + + 导出 From 14603033735b607ce54b5a1b8fb334a29a6d22ce Mon Sep 17 00:00:00 2001 From: liuxiaoxu <1793812695@qq.com> Date: Mon, 24 Jun 2024 17:28:59 +0800 Subject: [PATCH 4/4] =?UTF-8?q?[fix]=E4=BB=93=E5=BA=93=E7=AE=A1=E7=90=86?= =?UTF-8?q?=20=E4=BB=93=E5=BA=93=E5=85=A5=E5=BA=93=E5=8D=95=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E4=BB=93=E5=BA=93=E5=85=A5=E5=BA=93=20=E9=87=87?= =?UTF-8?q?=E8=B4=AD=E8=AE=A2=E5=8D=95=E6=9A=82=E6=94=B6=E5=90=8E=E7=AB=AF?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3,=E6=96=B0=E5=A2=9E=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E6=9A=82=E6=94=B6=E5=90=8E,=E4=BB=93=E5=BA=93=E5=85=A5?= =?UTF-8?q?=E5=BA=93=E7=8A=B6=E6=80=81=E6=94=B9=E4=B8=BA=E5=B7=B2=E6=9A=82?= =?UTF-8?q?=E6=94=B6,=E9=87=87=E8=B4=AD=E8=AE=A2=E5=8D=95=E6=9A=82?= =?UTF-8?q?=E6=94=B6=E8=BD=AC=E4=B8=BA=E5=93=81=E8=B4=A8=E5=8D=95=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BB=93=E5=BA=93=E5=85=A5=E5=BA=93=E5=8D=95?= =?UTF-8?q?=E6=9A=82=E6=94=B6=E6=8C=89=E9=92=AE=E7=9A=84=E4=BB=93=E5=BA=93?= =?UTF-8?q?ID=E5=9B=9E=E6=98=BE=E9=97=AE=E9=A2=98=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=93=81=E8=B4=A8=E5=8D=95,=E5=93=81=E8=B4=A8=E5=8D=95?= =?UTF-8?q?=E8=AF=A6=E6=83=85,=E5=93=81=E8=B4=A8=E5=8D=95=E6=8A=A5?= =?UTF-8?q?=E5=91=8A,=E5=93=81=E8=B4=A8=E5=8D=95=E4=B8=8D=E5=90=88?= =?UTF-8?q?=E6=A0=BC=E5=88=86=E7=B1=BB=E6=96=B0=E5=A2=9E=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../quality/service/IQualityOrderService.java | 7 + .../service/impl/QualityOrderServiceImpl.java | 180 ++++++++++++++++++ .../WarehouseStorageOrderController.java | 2 +- .../IWarehouseStorageOrderService.java | 6 + .../WarehouseStorageOrderServiceImpl.java | 119 +++++++++++- .../storageOrder/temporaryPurchase.html | 6 +- 6 files changed, 314 insertions(+), 6 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/quality/service/IQualityOrderService.java b/ruoyi-admin/src/main/java/com/ruoyi/quality/service/IQualityOrderService.java index 3d681473..f6a4e709 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/quality/service/IQualityOrderService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/quality/service/IQualityOrderService.java @@ -2,6 +2,8 @@ package com.ruoyi.quality.service; import java.util.List; import com.ruoyi.quality.domain.QualityOrder; +import com.ruoyi.warehouse.domain.WarehouseStorageOrder; +import com.ruoyi.warehouse.domain.WarehouseStorageOrderDetail; /** * 品质管理品质单Service接口 @@ -72,4 +74,9 @@ public interface IQualityOrderService * @return */ int restoreQualityOrderById(Long qualityOrderId); + + /* + * + * */ + void insertQualityOrderByWarehouseStorageOrder(WarehouseStorageOrder warehouseStorageOrder, List warehouseStorageOrderDetailList); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityOrderServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityOrderServiceImpl.java index 0beb2176..5dc8bda7 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityOrderServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityOrderServiceImpl.java @@ -1,8 +1,20 @@ package com.ruoyi.quality.service.impl; +import java.util.ArrayList; +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.quality.domain.QualityOrderDetail; +import com.ruoyi.quality.domain.QualityOrderReport; +import com.ruoyi.quality.domain.QualityOrderReportUnqualified; +import com.ruoyi.quality.mapper.QualityOrderDetailMapper; +import com.ruoyi.quality.mapper.QualityOrderReportMapper; +import com.ruoyi.quality.mapper.QualityOrderReportUnqualifiedMapper; +import com.ruoyi.warehouse.domain.WarehouseStorageOrder; +import com.ruoyi.warehouse.domain.WarehouseStorageOrderDetail; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.quality.mapper.QualityOrderMapper; @@ -22,6 +34,19 @@ public class QualityOrderServiceImpl implements IQualityOrderService @Autowired private QualityOrderMapper qualityOrderMapper; + + @Autowired + private QualityOrderDetailMapper orderDetailMapper; + + @Autowired + private QualityOrderReportMapper orderReportMapper; + + @Autowired + private QualityOrderReportUnqualifiedMapper orderReportUnqualifiedMapper; + + @Autowired + private RedisCache redisCache; + /** * 查询品质管理品质单 * @@ -123,4 +148,159 @@ public class QualityOrderServiceImpl implements IQualityOrderService { return qualityOrderMapper.restoreQualityOrderById(qualityOrderId); } + + + + /* + * 采购入库仓库入库后生成品质单 + * */ + @Override + public void insertQualityOrderByWarehouseStorageOrder(WarehouseStorageOrder warehouseStorageOrder, List storageOrderDetailList) { + + QualityOrder qualityOrder = new QualityOrder(); + qualityOrder.setCreateTime(new Date()); + qualityOrder.setCreateBy(warehouseStorageOrder.getCreateBy()); + //使用redis自动生成品质单号 + String qualityOrderCode = redisCache.generateBillNo("PZ"); + + qualityOrder.setQualityOrderCode(qualityOrderCode); + qualityOrder.setInStorageCode(warehouseStorageOrder.getWarehouseStorageCode()); + qualityOrder.setRelatedOrderCode(warehouseStorageOrder.getRelatedOrderCode()); + qualityOrder.setQualityStatus("0"); + qualityOrder.setQualityOrderType("0"); + qualityOrder.setQualityStorageStatus("0"); + qualityOrder.setThisArrivedNum(warehouseStorageOrder.getActualArrivedNum()); + qualityOrder.setWarehouseCode(warehouseStorageOrder.getWarehouseCode()); + qualityOrder.setWarehouseName(warehouseStorageOrder.getWarehouseName()); + qualityOrder.setDeliveryInspectionTime(warehouseStorageOrder.getDeliveryInspectionTime()); + qualityOrderMapper.insertQualityOrder(qualityOrder); + + + //新增三个子表的数据 + for (WarehouseStorageOrderDetail detail : storageOrderDetailList) { + // 构建QualityOrderDetail,假设其他属性与QualityOrder相同,故不重复设置 + insertQualityOrderDetailByWarehouseStorageOrder(warehouseStorageOrder, detail, qualityOrderCode); + insertQualityOrderReportByWarehouseStorageOrder(detail); + insertQualityOrderUnqualifiedByWarehouseStorageOrder(detail); + // ... + } + + } + + private void insertQualityOrderUnqualifiedByWarehouseStorageOrder( WarehouseStorageOrderDetail warehouseStorageOrderDetail) { + QualityOrderReportUnqualified qualityOrderReportUnqualified = new QualityOrderReportUnqualified(); + //插入品质报告不合格数 + qualityOrderReportUnqualified.setSupplierCode(warehouseStorageOrderDetail.getSupplierCode()); + qualityOrderReportUnqualified.setSupplierName(warehouseStorageOrderDetail.getSupplierName()); + qualityOrderReportUnqualified.setMaterialNo(warehouseStorageOrderDetail.getMaterialNo()); + qualityOrderReportUnqualified.setMaterialName(warehouseStorageOrderDetail.getMaterialName()); + qualityOrderReportUnqualified.setCreateTime(new Date()); + qualityOrderReportUnqualified.setCreateBy(warehouseStorageOrderDetail.getCreateBy()); + orderReportUnqualifiedMapper.insertQualityOrderReportUnqualified(qualityOrderReportUnqualified); + + } + + private void insertQualityOrderReportByWarehouseStorageOrder(WarehouseStorageOrderDetail warehouseStorageOrderDetail) { + QualityOrderReport qualityOrderReport = new QualityOrderReport(); + //插入品质单报告开始品质单 + qualityOrderReport.setSupplierCode(qualityOrderReport.getSupplierCode()); + qualityOrderReport.setSupplierName(warehouseStorageOrderDetail.getSupplierName()); + qualityOrderReport.setMaterialNo(warehouseStorageOrderDetail.getMaterialNo()); + qualityOrderReport.setMaterialName(warehouseStorageOrderDetail.getMaterialName()); + qualityOrderReport.setQualityHasqualifiedNum(warehouseStorageOrderDetail.getQualityHasQualifiedNum()); + qualityOrderReport.setCreateTime(new Date()); + qualityOrderReport.setCreateBy(warehouseStorageOrderDetail.getCreateBy()); + orderReportMapper.insertQualityOrderReport(qualityOrderReport); + } + + private void insertQualityOrderDetailByWarehouseStorageOrder(WarehouseStorageOrder warehouseStorageOrder, WarehouseStorageOrderDetail warehouseStorageOrderDetail, String qualityOrderCode) { + + QualityOrderDetail qualityOrderDetail = new QualityOrderDetail(); + + //插入数据到品质报告详情和 品质报告 + qualityOrderDetail.setQualityOrderCode(qualityOrderCode); + qualityOrderDetail.setInStorageCode(warehouseStorageOrder.getWarehouseStorageCode()); + qualityOrderDetail.setRelatedOrderCode(warehouseStorageOrder.getRelatedOrderCode()); + qualityOrderDetail.setQualityStatus("0"); + qualityOrderDetail.setQualityOrderType("0"); + qualityOrderDetail.setQualityStorageStatus("0"); + qualityOrderDetail.setMaterialNo(warehouseStorageOrderDetail.getMaterialNo()); + qualityOrderDetail.setMaterialBrand(warehouseStorageOrderDetail.getMaterialBrand()); + qualityOrderDetail.setMaterialDescribe(warehouseStorageOrderDetail.getMaterialDescribe()); + qualityOrderDetail.setMaterialName(warehouseStorageOrderDetail.getMaterialName()); + qualityOrderDetail.setMaterialProcessMethod(warehouseStorageOrderDetail.getMaterialProcessMethod()); + qualityOrderDetail.setMaterialPhotourl(warehouseStorageOrderDetail.getMaterialPhotourl()); + qualityOrderDetail.setMaterialUnit(warehouseStorageOrderDetail.getMaterialUnit()); + qualityOrderDetail.setMaterialType(warehouseStorageOrderDetail.getMaterialType()); + qualityOrderDetail.setMakeTotal(warehouseStorageOrderDetail.getMakeTotal()); + qualityOrderDetail.setSupplierCode(warehouseStorageOrderDetail.getSupplierCode()); + qualityOrderDetail.setSupplierName(warehouseStorageOrderDetail.getSupplierName()); + qualityOrderDetail.setSupplierAddress(warehouseStorageOrderDetail.getSupplierAddress()); + qualityOrderDetail.setCustomerContact(warehouseStorageOrderDetail.getCustomerContact()); + qualityOrderDetail.setContactNumber(warehouseStorageOrderDetail.getContactNumber()); + qualityOrderDetail.setQualityHasqualifiedNum(warehouseStorageOrderDetail.getQualityHasQualifiedNum()); + qualityOrderDetail.setCreateTime(new Date()); + qualityOrderDetail.setCreateBy(warehouseStorageOrderDetail.getCreateBy()); + orderDetailMapper.insertQualityOrderDetail(qualityOrderDetail); + + + } + + +// /* +// * 根据仓库入库单采购入库 生成品质单 +// * */ +// private void insertQualityOrderByWarehouseStorageOrder(WarehouseStorageOrder warehouseStorageOrder, List storageOrderDetailList) { +// +// +// +// +// //插入数据到品质报告详情和 品质报告 +// for (WarehouseStorageOrderDetail warehouseStorageOrderDetail : storageOrderDetailList) { +// QualityOrderDetail qualityOrderDetail = new QualityOrderDetail(); +// QualityOrderReport qualityOrderReport = new QualityOrderReport(); +// QualityOrderReportUnqualified qualityOrderReportUnqualified = new QualityOrderReportUnqualified(); +// qualityOrderDetail.setQualityOrderCode(qualityOrderCode); +// qualityOrderDetail.setInStorageCode(warehouseStorageOrder.getWarehouseStorageCode()); +// qualityOrderDetail.setRelatedOrderCode(warehouseStorageOrder.getRelatedOrderCode()); +// qualityOrderDetail.setQualityStatus("0"); +// qualityOrderDetail.setQualityOrderType("0"); +// qualityOrderDetail.setQualityStorageStatus("0"); +// qualityOrderDetail.setMaterialNo(warehouseStorageOrderDetail.getMaterialNo()); +// qualityOrderDetail.setMaterialBrand(warehouseStorageOrderDetail.getMaterialBrand()); +// qualityOrderDetail.setMaterialDescribe(warehouseStorageOrderDetail.getMaterialDescribe()); +// qualityOrderDetail.setMaterialName(warehouseStorageOrderDetail.getMaterialName()); +// qualityOrderDetail.setMaterialProcessMethod(warehouseStorageOrderDetail.getMaterialProcessMethod()); +// qualityOrderDetail.setMaterialPhotourl(warehouseStorageOrderDetail.getMaterialPhotourl()); +// qualityOrderDetail.setMaterialUnit(warehouseStorageOrderDetail.getMaterialUnit()); +// qualityOrderDetail.setMaterialType(warehouseStorageOrderDetail.getMaterialType()); +// qualityOrderDetail.setMakeTotal(warehouseStorageOrderDetail.getMakeTotal()); +// qualityOrderDetail.setSupplierCode(warehouseStorageOrderDetail.getSupplierCode()); +// qualityOrderDetail.setSupplierName(warehouseStorageOrderDetail.getSupplierName()); +// qualityOrderDetail.setSupplierAddress(warehouseStorageOrderDetail.getSupplierAddress()); +// qualityOrderDetail.setCustomerContact(warehouseStorageOrderDetail.getCustomerContact()); +// qualityOrderDetail.setContactNumber(warehouseStorageOrderDetail.getContactNumber()); +// qualityOrderDetail.setQualityHasqualifiedNum(warehouseStorageOrderDetail.getQualityHasQualifiedNum()); +// qualityOrderDetail.setCreateTime(new Date()); +// qualityOrderDetail.setCreateBy(warehouseStorageOrderDetail.getCreateBy()); +// orderDetailMapper.insertQualityOrderDetail(qualityOrderDetail); +// //插入品质单报告开始品质单 +// qualityOrderReport.setSupplierCode(warehouseStorageOrderDetail.getSupplierCode()); +// qualityOrderReport.setSupplierName(warehouseStorageOrderDetail.getSupplierName()); +// qualityOrderReport.setMaterialNo(warehouseStorageOrderDetail.getMaterialNo()); +// qualityOrderReport.setMaterialName(warehouseStorageOrderDetail.getMaterialName()); +// qualityOrderReport.setQualityHasqualifiedNum(warehouseStorageOrderDetail.getQualityHasQualifiedNum()); +// qualityOrderDetail.setCreateTime(new Date()); +// qualityOrderDetail.setCreateBy(warehouseStorageOrderDetail.getCreateBy()); +// orderReportMapper.insertQualityOrderReport(qualityOrderReport); +// //插入品质报告不合格数 +// qualityOrderReportUnqualified.setSupplierCode(warehouseStorageOrderDetail.getSupplierCode()); +// qualityOrderReportUnqualified.setSupplierName(warehouseStorageOrderDetail.getSupplierName()); +// qualityOrderReportUnqualified.setMaterialNo(warehouseStorageOrderDetail.getMaterialNo()); +// qualityOrderReportUnqualified.setMaterialName(warehouseStorageOrderDetail.getMaterialName()); +// qualityOrderReportUnqualified.setCreateTime(new Date()); +// qualityOrderReportUnqualified.setCreateBy(warehouseStorageOrderDetail.getCreateBy()); +// orderReportUnqualifiedMapper.insertQualityOrderReportUnqualified(qualityOrderReportUnqualified); +// } +// } } 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 f8cd11c0..877d4a91 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 @@ -197,7 +197,7 @@ public class WarehouseStorageOrderController extends BaseController @ResponseBody public AjaxResult temporaryPurchaseSave(@RequestBody WarehouseStorageOrder warehouseStorageOrder) { - return toAjax(warehouseStorageOrderService.updateWarehouseStorageOrder(warehouseStorageOrder)); + return toAjax(warehouseStorageOrderService.temporaryPurchaseWarehouseStorageOrder(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 3c8399da..bf2f3cab 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 @@ -77,4 +77,10 @@ public interface IWarehouseStorageOrderService * 入库-生产订单 * */ int updateStorageMake(WarehouseStorageOrder warehouseStorageOrder); + + + /** + * 修改保存暂收-采购单(采购入库) + */ + int temporaryPurchaseWarehouseStorageOrder(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 865d6386..ecbc1261 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 @@ -1,12 +1,27 @@ package com.ruoyi.warehouse.service.impl; +import java.util.ArrayList; +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.quality.domain.QualityOrder; +import com.ruoyi.quality.domain.QualityOrderDetail; +import com.ruoyi.quality.domain.QualityOrderReport; +import com.ruoyi.quality.domain.QualityOrderReportUnqualified; +import com.ruoyi.quality.mapper.QualityOrderDetailMapper; +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.warehouse.domain.WarehouseStorageOrderDetail; import com.ruoyi.warehouse.mapper.WarehouseStorageOrderDetailMapper; import lombok.extern.slf4j.Slf4j; +import org.activiti.editor.language.json.converter.util.CollectionUtils; +import org.apache.avalon.framework.service.ServiceException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.warehouse.mapper.WarehouseStorageOrderMapper; @@ -14,6 +29,7 @@ import com.ruoyi.warehouse.domain.WarehouseStorageOrder; import com.ruoyi.warehouse.service.IWarehouseStorageOrderService; import com.ruoyi.common.core.text.Convert; import org.springframework.transaction.annotation.Transactional; +import org.springframework.transaction.interceptor.TransactionAspectSupport; /** * 仓库入库单Service业务层处理 @@ -30,6 +46,13 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS @Autowired private WarehouseStorageOrderDetailMapper storageOrderDetailMapper; + + @Autowired + private IQualityOrderService qualityOrderService; + + @Autowired + private RedisCache redisCache; + /** * 查询仓库入库单 * @@ -71,7 +94,7 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS /** * 修改仓库入库单 - * + * * @param warehouseStorageOrder 仓库入库单 * @return 结果 */ @@ -102,11 +125,103 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS } } } - + warehouseStorageOrder.setWarehouseStorageStatus("1"); return warehouseStorageOrderMapper.updateWarehouseStorageOrder(warehouseStorageOrder); } + + + /** + * 修改保存暂收-采购单(采购入库) + * + * @param warehouseStorageOrder 仓库入库单 + * @return 结果 + */ + @Transactional + @Override + public int temporaryPurchaseWarehouseStorageOrder(WarehouseStorageOrder warehouseStorageOrder) { + String loginName = ShiroUtils.getLoginName(); + warehouseStorageOrder.setUpdateBy(loginName); + warehouseStorageOrder.setUpdateTime(DateUtils.getNowDate()); + warehouseStorageOrder.setWarehouseStorageStatus("1"); + updateWarehouseStorageOrderDetails(warehouseStorageOrder); + + int updateResult = warehouseStorageOrderMapper.updateWarehouseStorageOrder(warehouseStorageOrder); + if (updateResult <= 0) { + throw new RuntimeException("更新入库单主记录失败"); + } + + try { + qualityOrderService.insertQualityOrderByWarehouseStorageOrder(warehouseStorageOrder, warehouseStorageOrder.getWarehouseStorageOrderDetailList()); + } catch (Exception e) { + TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); + log.error("生成品质单时发生错误", e); + throw new RuntimeException("生成品质单时发生错误"); + } + + return updateResult; + } + + /* + * 更新仓库入库单详情的数据 + * */ + private void updateWarehouseStorageOrderDetails(WarehouseStorageOrder warehouseStorageOrder) { + List details = warehouseStorageOrder.getWarehouseStorageOrderDetailList(); + if (!CollectionUtils.isEmpty(details)) { + for (WarehouseStorageOrderDetail detail : details) { + detail.setWarehouseStorageCode(warehouseStorageOrder.getWarehouseStorageCode()); + WarehouseStorageOrderDetail tempStorageOrderDetail = new WarehouseStorageOrderDetail(); + tempStorageOrderDetail.setMaterialNo(detail.getMaterialNo()); + tempStorageOrderDetail.setSupplierCode(detail.getSupplierCode()); + tempStorageOrderDetail.setWarehouseStorageCode(warehouseStorageOrder.getWarehouseStorageCode()); + WarehouseStorageOrderDetail storageOrderDetailFromData = storageOrderDetailMapper.selectWarehouseStorageOrderByObject(tempStorageOrderDetail); + if (storageOrderDetailFromData == null){ + log.warn("数据库中入库单详情为空:{}",tempStorageOrderDetail); + }else { + storageOrderDetailMapper.updateWarehouseStorageOrderDetailByObject(detail); + } + } + } + } + + + /* + * 原仓库入库单暂收 + * + */ +// @Transactional +// @Override +// public int updateWarehouseStorageOrder(WarehouseStorageOrder warehouseStorageOrder) +// { +// String loginName = ShiroUtils.getLoginName(); +// warehouseStorageOrder.setUpdateBy(loginName); +// warehouseStorageOrder.setUpdateTime(DateUtils.getNowDate()); +// +// List storageOrderDetailList = warehouseStorageOrder.getWarehouseStorageOrderDetailList(); +// +// if (StringUtils.isEmpty(storageOrderDetailList)){ +// log.warn("入库单详情为空:{}",storageOrderDetailList); +// }else { +// for (WarehouseStorageOrderDetail warehouseStorageOrderDetail : storageOrderDetailList) { +// warehouseStorageOrderDetail.setWarehouseStorageCode(warehouseStorageOrder.getWarehouseStorageCode()); +// WarehouseStorageOrderDetail tempStorageOrderDetail = new WarehouseStorageOrderDetail(); +// tempStorageOrderDetail.setMaterialNo(warehouseStorageOrderDetail.getMaterialNo()); +// tempStorageOrderDetail.setSupplierCode(warehouseStorageOrderDetail.getSupplierCode()); +// tempStorageOrderDetail.setWarehouseStorageCode(warehouseStorageOrder.getWarehouseStorageCode()); +// WarehouseStorageOrderDetail storageOrderDetailFromData = storageOrderDetailMapper.selectWarehouseStorageOrderByObject(tempStorageOrderDetail); +// if (storageOrderDetailFromData == null){ +// log.warn("数据库中入库单详情为空:{}",tempStorageOrderDetail); +// }else { +// storageOrderDetailMapper.updateWarehouseStorageOrderDetailByObject(warehouseStorageOrderDetail); +// } +// } +// } +// warehouseStorageOrder.setWarehouseStorageStatus("1"); +// return warehouseStorageOrderMapper.updateWarehouseStorageOrder(warehouseStorageOrder); +// } + + /* * 入库-生产订单 * */ diff --git a/ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/temporaryPurchase.html b/ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/temporaryPurchase.html index b34a95ea..6c67a6cf 100644 --- a/ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/temporaryPurchase.html +++ b/ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/temporaryPurchase.html @@ -148,7 +148,7 @@ // 使用 JSON.stringify() 序列化数据 const jsonData = JSON.stringify(combinedData); // 发送 AJAX 请求到后端接口 - $.operate.saveJson(prefix + "/temporaryPurchaseWarehouse", jsonData); + $.operate.saveJson(prefix + "/temporaryPurchase", jsonData); } $("input[name='arrivedTime']").datetimepicker({ @@ -351,7 +351,7 @@ // 清空下拉框现有选项 selectElement.empty(); - // 添加默认选项(如果需要)编辑时不需要添加默认选项 + // // 添加默认选项(如果需要)编辑时不需要添加默认选项 selectElement.append(''); // 遍历返回的数据,添加为下拉框的选项 @@ -359,7 +359,7 @@ // 仓库ID selectElement.append(''); }); - // $('#warehouseCode').val(stockNO); + $('#warehouseCode').val(warehouseCode); } else { $.modal.errMsg("数据为空"); }