From c6698303e3668c3e908cbf1e5d42a4bfacff3a5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=99=93=E8=BF=AA?= <2596750866@qq.com> Date: Wed, 9 Oct 2024 17:42:52 +0800 Subject: [PATCH] =?UTF-8?q?[feat]=20=E5=93=81=E8=B4=A8=E7=AE=A1=E7=90=86?= =?UTF-8?q?=20=E5=93=81=E8=B4=A8=E5=8D=95=20=E6=96=B0=E5=A2=9E=E5=93=81?= =?UTF-8?q?=E8=B4=A8=E5=8D=95=E5=88=97=E8=A1=A8=E9=A1=B5=E9=9D=A2=E5=A7=94?= =?UTF-8?q?=E5=A4=96=E5=85=A5=E5=BA=93=E5=8D=95=E5=93=81=E8=B4=A8=E3=80=81?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E6=8C=89=E9=92=AE=EF=BC=9B=20=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=A7=94=E5=A4=96=E5=8A=A0=E5=B7=A5=E5=93=81=E8=B4=A8?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E3=80=81=E5=93=81=E8=B4=A8=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E3=80=81=E5=93=81=E8=B4=A8=E6=8A=A5=E5=91=8A?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=EF=BC=9B=20=E6=96=B0=E5=A2=9E=E5=93=81?= =?UTF-8?q?=E8=B4=A8=E5=8D=95=E5=A7=94=E5=A4=96=E5=8A=A0=E5=B7=A5=E5=93=81?= =?UTF-8?q?=E8=B4=A8controller=E6=8E=A5=E5=8F=A3=E3=80=81service=E6=96=B9?= =?UTF-8?q?=E6=B3=95=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/QualityOrderController.java | 55 ++++ .../quality/service/IQualityOrderService.java | 11 + .../service/impl/QualityOrderServiceImpl.java | 163 +++++++++- .../qualityOrder/makeOutOrderReport.html | 298 ++++++++++++++++++ .../qualityOrder/makeOutStartingQuality.html | 256 +++++++++++++++ .../makeOutStartingQualityDetail.html | 180 +++++++++++ .../quality/qualityOrder/qualityOrder.html | 20 ++ 7 files changed, 977 insertions(+), 6 deletions(-) create mode 100644 ruoyi-admin/src/main/resources/templates/quality/qualityOrder/makeOutOrderReport.html create mode 100644 ruoyi-admin/src/main/resources/templates/quality/qualityOrder/makeOutStartingQuality.html create mode 100644 ruoyi-admin/src/main/resources/templates/quality/qualityOrder/makeOutStartingQualityDetail.html diff --git a/ruoyi-admin/src/main/java/com/ruoyi/quality/controller/QualityOrderController.java b/ruoyi-admin/src/main/java/com/ruoyi/quality/controller/QualityOrderController.java index 49c71e12..671b19df 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/quality/controller/QualityOrderController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/quality/controller/QualityOrderController.java @@ -302,6 +302,61 @@ public class QualityOrderController extends BaseController return toAjax(orderReportService.updateMakeInOrderReport(qualityOrderReport)); } + /** + * 委外加工品质单开始品质 + */ + @GetMapping("/makeOutStartingQuality/{qualityOrderId}") + public String makeOStartingQuality(@PathVariable("qualityOrderId") Long qualityOrderId, ModelMap mmap) + { + QualityOrder qualityOrder = qualityOrderService.selectQualityOrderById(qualityOrderId); + mmap.put("qualityOrder", qualityOrder); + return prefix + "/makeOutStartingQuality"; + } + /** + * 修改保存委外加工品质单开始品质 + */ + @RequiresPermissions("quality:qualityOrder:makeInStartingQuality") + @Log(title = "品质管理品质单", businessType = BusinessType.UPDATE) + @PostMapping("/makeOutStartingQuality") + @ResponseBody + public AjaxResult makeOutStartingQualitySave(@RequestBody QualityOrder qualityOrder) + { + return toAjax(qualityOrderService.updateMakeOutStartingQuality(qualityOrder)); + } + /** + * 委外加工品质单开始品质列表详情接口 + */ + @GetMapping("/makeOutStartingQualityDetail/{qualityOrderId}") + public String makeOutStartingQualityDetail(@PathVariable("qualityOrderId") Long qualityOrderId, ModelMap mmap) + { + QualityOrder qualityOrder = qualityOrderService.selectQualityOrderById(qualityOrderId); + mmap.put("qualityOrder", qualityOrder); + return prefix + "/makeOutStartingQualityDetail"; + } + /** + * 修改委外加工入库单品质报告按钮 + */ + @GetMapping("/makeOutOrderReport") + public String makeOutOrderReport( @RequestParam("materialNo") String materialNo, + @RequestParam("qualityOrderCode") String qualityOrderCode, + ModelMap mmap) + { + QualityOrderReport qualityOrderReport = orderReportService.selectMakeInOrderReportByNoAndCode(materialNo,qualityOrderCode); + mmap.put("qualityOrderReport", qualityOrderReport); + mmap.put("qualityOrderCode",qualityOrderCode); + return prefix + "/makeOutOrderReport"; + } + + /** + * 修改保存委外加工入库单品质报告按钮 + */ + @Log(title = "品质管理品质单", businessType = BusinessType.UPDATE) + @PostMapping("/makeOutOrderReport") + @ResponseBody + public AjaxResult makeOutOrderReportSave(@RequestBody QualityOrderReport qualityOrderReport) + { + return toAjax(orderReportService.updateMakeInOrderReport(qualityOrderReport)); + } /*1111111111*/ /** 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 dfa0fa4f..31040279 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 @@ -6,6 +6,7 @@ import com.ruoyi.quality.domain.QualityOrderDetail; import com.ruoyi.quality.domain.QualityOrderReport; import com.ruoyi.warehouse.domain.WarehouseStorageOrder; import com.ruoyi.warehouse.domain.WarehouseStorageOrderDetail; +import org.springframework.transaction.annotation.Transactional; /** * 品质管理品质单Service接口 @@ -82,11 +83,21 @@ public interface IQualityOrderService * */ void insertQualityOrderByWarehouseStorageOrder(WarehouseStorageOrder warehouseStorageOrder, List warehouseStorageOrderDetailList); + /* + * 委外入库仓库入库后生成品质单 + * */ + void insertQualityOrderByOutsourceStorageOrder(WarehouseStorageOrder warehouseStorageOrder, List storageOrderDetailList); + /* * 修改保存委内加工品质单开始品质 * */ int updateMakeInStartingQuality(QualityOrder qualityOrder); + /* + * 修改保存委外加工品质单开始品质 + * */ + int updateMakeOutStartingQuality(QualityOrder qualityOrder); + /** * 查询委内加工品质单开始品质 物料相关信息 */ 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 c712d14b..5f46bac4 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,6 +1,5 @@ package com.ruoyi.quality.service.impl; -import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -16,7 +15,6 @@ import com.ruoyi.quality.mapper.*; import com.ruoyi.quality.service.IQualityOrderReportService; import com.ruoyi.warehouse.domain.WarehouseStorageOrder; import com.ruoyi.warehouse.domain.WarehouseStorageOrderDetail; -import com.ruoyi.warehouse.mapper.WarehouseOutOrderDetailMapper; import com.ruoyi.warehouse.mapper.WarehouseStorageOrderDetailMapper; import com.ruoyi.warehouse.mapper.WarehouseStorageOrderMapper; import com.ruoyi.warehouse.service.IWarehouseStorageOrderService; @@ -255,6 +253,9 @@ public class QualityOrderServiceImpl implements IQualityOrderService // 根据品质单生成退换货单 @Transactional(rollbackFor = Exception.class) public int generateBeforeRefundsExchanges(QualityOrder qualityOrder){ + if(qualityOrder.getQualityUnqualifiedNum() == 0){ + return 0; + } QualityRefundsExchanges refundsExchanges = new QualityRefundsExchanges(); refundsExchanges.setRefundsExchangesCode(redisCache.generateBillNo("THH")); refundsExchanges.setRelatedOrderCode(qualityOrder.getQualityOrderCode()); @@ -526,6 +527,45 @@ public class QualityOrderServiceImpl implements IQualityOrderService } + /* + * 委外入库仓库暂收生成品质单 + * */ + @Override + public void insertQualityOrderByOutsourceStorageOrder(WarehouseStorageOrder warehouseStorageOrder, List storageOrderDetailList) { + QualityOrder qualityOrder = new QualityOrder(); + qualityOrder.setCreateTime(DateUtils.getNowDate()); + 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("2"); + qualityOrder.setQualityStorageStatus("2"); + // 计算本次到货数合计 + int totalReceivedQuantity = storageOrderDetailList.stream() + .mapToInt(WarehouseStorageOrderDetail::getActualArriveNum) + .sum(); + qualityOrder.setThisArrivedNum(totalReceivedQuantity); + + qualityOrder.setWarehouseCode(warehouseStorageOrder.getWarehouseCode()); + qualityOrder.setWarehouseName(warehouseStorageOrder.getWarehouseName()); + qualityOrder.setDeliveryInspectionTime(warehouseStorageOrder.getDeliveryInspectionTime()); + qualityOrder.setCreateBy(ShiroUtils.getLoginName()); + qualityOrder.setCreateTime(DateUtils.getNowDate()); + qualityOrderMapper.insertQualityOrder(qualityOrder); + + //新增三个子表的数据 + for (WarehouseStorageOrderDetail detail : storageOrderDetailList) { + // 构建QualityOrderDetail,假设其他属性与QualityOrder相同,故不重复设置 + insertQualityOrderDetailByWarehouseStorageOrder(warehouseStorageOrder, detail, qualityOrderCode); + insertQualityOrderReportByWarehouseStorageOrder(detail,qualityOrderCode); + insertQualityOrderUnqualifiedByWarehouseStorageOrder(detail); + // ... + } + } /* * 修改保存委内加工品质单开始品质 * */ @@ -647,6 +687,120 @@ public class QualityOrderServiceImpl implements IQualityOrderService } + + /* + * 修改保存委外加工品质单开始品质 + * */ + @Transactional(rollbackFor = Exception.class) + @Override + public int updateMakeOutStartingQuality(QualityOrder qualityOrder) { + String loginName = ShiroUtils.getLoginName(); + qualityOrder.setUpdateBy(loginName); + qualityOrder.setUpdateTime(DateUtils.getNowDate()); + qualityOrder.setQualityEmployee(loginName); + List qualityOrderDetailList = qualityOrder.getQualityOrderDetailList(); + if (CollectionUtils.isEmpty(qualityOrderDetailList)){ + throw new BusinessException("品质单详情数据为空"); + } + + for (QualityOrderDetail qualityOrderDetail : qualityOrderDetailList) { + qualityOrderDetail.setUpdateBy(loginName); + qualityOrderDetail.setUpdateTime(DateUtils.getNowDate()); + Long qualityOrderDetailId = qualityOrderDetail.getQualityOrderDetailId(); + QualityOrderDetail tempQualityOrderDetail = orderDetailMapper.selectQualityOrderDetailById(qualityOrderDetailId); + Integer qualifiedNum = tempQualityOrderDetail.getQualityQualifiedNum(); + Integer unqualifiedNum = tempQualityOrderDetail.getQualityUnqualifiedNum(); + if (qualifiedNum == null || unqualifiedNum == null){ + throw new BusinessException("请先进行品质报告操作"); + } + qualityOrderDetail.setInStorageCode(qualityOrder.getInStorageCode()); + //更新品质单详情数据 + int updateQualityOrderDetailResult = orderDetailMapper.updateQualityOrderDetail(qualityOrderDetail); + if (updateQualityOrderDetailResult <= 0){ + throw new BusinessException("更新品质单详情数据失败"); + } + } + //根据品质单号从数据库查询 用于更新入库单 + QualityOrder tempQualityOrder = qualityOrderMapper.selectQualityOrderByCode(qualityOrder.getQualityOrderCode()); + String qualityStatus = tempQualityOrder.getQualityStatus(); + String qualityStorageStatus = tempQualityOrder.getQualityStorageStatus(); + + Integer thisArrivedNumSum = 0; + Integer qualityQualifiedNumSum = 0; + Integer qualityUnqualifiedNumSum = 0; + +// 检查thisArrivedNum是否含有null值 + boolean hasThisArrivedNumNull = qualityOrderDetailList.stream() + .anyMatch(item -> item.getThisArrivedNum() == null); + +// 检查qualityQualifiedNum是否含有null值 + boolean hasQualityQualifiedNumNull = qualityOrderDetailList.stream() + .anyMatch(item -> item.getQualityQualifiedNum() == null); + +// 检查qualityUnqualifiedNum是否含有null值 + boolean hasQualityUnqualifiedNumNull = qualityOrderDetailList.stream() + .anyMatch(item -> item.getQualityUnqualifiedNum() == null); + + if (hasThisArrivedNumNull) { + throw new BusinessException("存在本次到货数为空,请检查!"); + } + if (hasQualityQualifiedNumNull) { + throw new BusinessException("存在品质已合格数为空,请检查!"); + } + if (hasQualityUnqualifiedNumNull) { + throw new BusinessException("存在品质不合格数为空,请检查!"); + } +// 计算各个字段的总和 + thisArrivedNumSum = qualityOrderDetailList.stream() + .mapToInt(QualityOrderDetail::getThisArrivedNum) + .sum(); + + qualityQualifiedNumSum = qualityOrderDetailList.stream() + .mapToInt(QualityOrderDetail::getQualityQualifiedNum) + .sum(); + + qualityUnqualifiedNumSum = qualityOrderDetailList.stream() + .mapToInt(QualityOrderDetail::getQualityUnqualifiedNum) + .sum(); + //插入主表中本次到货数 + qualityOrder.setThisArrivedNum(thisArrivedNumSum); + //插入主表中品质合格数 + qualityOrder.setQualityQualifiedNum(qualityQualifiedNumSum); + //插入主表中品质不合格数 + qualityOrder.setQualityUnqualifiedNum(qualityUnqualifiedNumSum); + +// if (thisArrivedNum == qualityQualifiedNum){ + //全部品质 + qualityOrder.setQualityStatus("2"); + tempQualityOrder.setQualityStatus("2"); +// }else { +// //部分品质 +// qualityOrder.setQualityStatus("1"); +// tempQualityOrder.setQualityStatus("1"); +// } + + + //如果品质时修改交检时间 + tempQualityOrder.setDeliveryInspectionTime(qualityOrder.getDeliveryInspectionTime()); + tempQualityOrder.setQualityQualifiedNum(qualityQualifiedNumSum); + tempQualityOrder.setQualityUnqualifiedNum(qualityUnqualifiedNumSum); + tempQualityOrder.setThisArrivedNum(thisArrivedNumSum); + + + //数据生成到入库单中,后续进行入库操作 + int updateStorageOrderResult = warehouseStorageOrderService.updateWarehouseStorageOrderByOutQualityOrder(tempQualityOrder, qualityOrderDetailList); + if (updateStorageOrderResult <= 0){ + throw new BusinessException("更新入库单数据失败"); + } + + int updateResult = qualityOrderMapper.updateQualityOrder(qualityOrder); + if (updateResult <= 0){ + log.warn("更新品质单失败,未影响任何行"); + } + return updateResult; + + } + /** * 查询委内加工品质单开始品质 物料相关信息 */ @@ -686,7 +840,7 @@ public class QualityOrderServiceImpl implements IQualityOrderService String loginName = ShiroUtils.getLoginName(); qualityOrder.setUpdateBy(loginName); - qualityOrder.setUpdateTime(new Date()); + qualityOrder.setUpdateTime(DateUtils.getNowDate()); qualityOrder.setQualityEmployee(loginName); //生成入库单号 String warehouseStorageCode = redisCache.generateBillNo("RK"); @@ -868,8 +1022,5 @@ public class QualityOrderServiceImpl implements IQualityOrderService if (insertResult <= 0){ throw new BusinessException("插入品质单详情失败"); } - - } - } diff --git a/ruoyi-admin/src/main/resources/templates/quality/qualityOrder/makeOutOrderReport.html b/ruoyi-admin/src/main/resources/templates/quality/qualityOrder/makeOutOrderReport.html new file mode 100644 index 00000000..f8b47f23 --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/quality/qualityOrder/makeOutOrderReport.html @@ -0,0 +1,298 @@ + + + + + + + +
+
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +
+ +
+

合格数

+
+
+ + +
+
+ + +
+
+
+
+ + +
+
+ + +
+
+
+ +
+
+
+ 不合格数 + + 添加 + +
+
+
+
+
+
+
+
+ +
+ + +
+ +
+
+ + +
+
+
+
+ +
+ +
+
+
+
+ + + + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/quality/qualityOrder/makeOutStartingQuality.html b/ruoyi-admin/src/main/resources/templates/quality/qualityOrder/makeOutStartingQuality.html new file mode 100644 index 00000000..976e1c50 --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/quality/qualityOrder/makeOutStartingQuality.html @@ -0,0 +1,256 @@ + + + + + + + +
+
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+ + +
+
+
+
+ +
+
+
+
+
+
+
+
+ + + + + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/quality/qualityOrder/makeOutStartingQualityDetail.html b/ruoyi-admin/src/main/resources/templates/quality/qualityOrder/makeOutStartingQualityDetail.html new file mode 100644 index 00000000..c900e877 --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/quality/qualityOrder/makeOutStartingQualityDetail.html @@ -0,0 +1,180 @@ + + + + + + + +
+
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+ + +
+
+
+
+ +
+
+
+
+
+
+
+
+ + + + + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/quality/qualityOrder/qualityOrder.html b/ruoyi-admin/src/main/resources/templates/quality/qualityOrder/qualityOrder.html index 466f2c22..d4aa8399 100644 --- a/ruoyi-admin/src/main/resources/templates/quality/qualityOrder/qualityOrder.html +++ b/ruoyi-admin/src/main/resources/templates/quality/qualityOrder/qualityOrder.html @@ -188,6 +188,14 @@ if (row.qualityStorageStatus == 4 ){ actions.push('详情 '); } + //委外入库品质 + if (row.qualityStatus != 2 && row.qualityStorageStatus == 2 ){ + actions.push('品质 '); + } + //委外入库品质详情 + if (row.qualityStorageStatus == 2 ){ + actions.push('详情 '); + } return actions.join(''); } }] @@ -220,6 +228,18 @@ $.modal.open("进行品质详情",url) } + //委内加工单品质 + function makeOutStartingQuality(qualityOrderId){ + var url = ctx +'quality/qualityOrder/makeOutStartingQuality/' + qualityOrderId; + $.modal.open("进行品质",url) + } + + //委内加工单品质详情 + function makeOutStartingQualityDetail(qualityOrderId){ + var url = ctx +'quality/qualityOrder/makeOutStartingQualityDetail/' + qualityOrderId; + $.modal.open("品质详情",url) + } + //生产入库品质 function makeStartingQuality(qualityOrderId){ var url = ctx +'quality/qualityOrder/makeStartingQuality/' + qualityOrderId;