From 1b1488d1a4909327115385fdbeaf792146955245 Mon Sep 17 00:00:00 2001 From: liuxiaoxu <1793812695@qq.com> Date: Mon, 1 Jul 2024 19:32:26 +0800 Subject: [PATCH] =?UTF-8?q?[fix]=20=E5=93=81=E8=B4=A8=E7=AE=A1=E7=90=86=20?= =?UTF-8?q?=20=E4=BB=93=E5=BA=93=E7=AE=A1=E7=90=86=20=E5=93=81=E8=B4=A8?= =?UTF-8?q?=E5=8D=95=E8=AF=A6=E6=83=85=E6=96=B0=E5=A2=9E=E7=89=A9=E6=96=99?= =?UTF-8?q?=E5=85=A5=E5=BA=93=E9=83=A8=E9=97=A8=E5=AD=97=E6=AE=B5=20?= =?UTF-8?q?=E6=9A=82=E6=94=B6=E7=9A=84=E6=97=B6=E5=80=99=E7=89=A9=E6=96=99?= =?UTF-8?q?=E5=85=A5=E5=BA=93=E9=83=A8=E9=97=A8=E8=BD=AC=E5=85=A5=E5=93=81?= =?UTF-8?q?=E8=B4=A8=E5=8D=95=E8=AF=A6=E6=83=85=E4=B8=AD=20=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=E4=B8=BB=E8=A1=A8=E7=9A=84=E6=9C=AC=E6=AC=A1=E5=88=B0?= =?UTF-8?q?=E8=B4=A7=E6=95=B0=20=E8=AE=A1=E7=AE=97=E4=B8=BB=E8=A1=A8?= =?UTF-8?q?=E7=9A=84=E6=9C=AC=E6=AC=A1=E5=88=B0=E8=B4=A7=E6=95=B0=20?= =?UTF-8?q?=E8=AE=A1=E7=AE=97=E4=B8=BB=E8=A1=A8=E7=9A=84=E5=93=81=E8=B4=A8?= =?UTF-8?q?=E4=B8=8D=E5=90=88=E6=A0=BC=E6=95=B0=20=E5=AF=B9=E5=93=81?= =?UTF-8?q?=E8=B4=A8=E5=8D=95=E8=AF=A6=E6=83=85=E8=A1=A8=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=E8=BF=9B=E8=A1=8C=E6=A0=A1=E9=AA=8C=EF=BC=9A?= =?UTF-8?q?=E5=A6=82=E6=9E=9C=E5=93=81=E8=B4=A8=E5=90=88=E6=A0=BC=E6=95=B0?= =?UTF-8?q?=E4=B8=BA=E7=A9=BA=E6=88=96=E8=80=85=E5=93=81=E8=B4=A8=E4=B8=8D?= =?UTF-8?q?=E5=90=88=E6=A0=BC=E6=95=B0=E4=B8=BA=E7=A9=BA=EF=BC=8C=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E5=85=88=E8=BF=9B=E8=A1=8C=E5=93=81=E8=B4=A8=E6=8A=A5?= =?UTF-8?q?=E5=91=8A=E6=93=8D=E4=BD=9C=20=E5=AF=B9=E6=9C=AC=E6=AC=A1?= =?UTF-8?q?=E5=88=B0=E8=B4=A7=E6=95=B0=E8=BF=9B=E8=A1=8C=E6=A0=A1=E9=AA=8C?= =?UTF-8?q?=EF=BC=8C=E5=A6=82=E6=9E=9C=E6=9C=AC=E6=AC=A1=E5=88=B0=E8=B4=A7?= =?UTF-8?q?=E6=95=B0=E4=B8=BA=E7=A9=BA=EF=BC=8C=E5=88=99=E4=B8=8D=E8=83=BD?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E5=93=81=E8=B4=A8=E6=93=8D=E4=BD=9C=20?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=A0=B9=E6=8D=AE=20=E5=85=A5=E5=BA=93?= =?UTF-8?q?=E5=8D=95=E5=8F=B7=E6=9B=B4=E6=96=B0=E4=BB=93=E5=BA=93=E5=85=A5?= =?UTF-8?q?=E5=BA=93=E5=8D=95=E8=AF=A6=E6=83=85=E6=95=B0=E6=8D=AE=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=BC=80=E5=A7=8B=E5=93=81=E8=B4=A8=20?= =?UTF-8?q?=E5=93=81=E8=B4=A8=E8=AF=A6=E6=83=85=E4=B8=8D=E8=83=BD=E4=BC=A0?= =?UTF-8?q?=E5=80=BC=E9=97=AE=E9=A2=98=20=E5=93=81=E8=B4=A8=E6=8A=A5?= =?UTF-8?q?=E5=91=8A=E8=AF=A6=E6=83=85=E6=96=B0=E5=A2=9E=E7=89=A9=E6=96=99?= =?UTF-8?q?=E5=85=A5=E5=BA=93=E9=83=A8=E9=97=A8=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/QualityOrderController.java | 2 +- .../quality/domain/QualityOrderDetail.java | 13 ++ .../impl/QualityOrderReportServiceImpl.java | 101 +++++---- .../service/impl/QualityOrderServiceImpl.java | 110 +++++++++- .../WarehouseStorageOrderController.java | 2 +- .../WarehouseStorageOrderDetailMapper.java | 5 + .../IWarehouseStorageOrderService.java | 5 + .../WarehouseStorageOrderServiceImpl.java | 56 ++++- .../quality/QualityOrderDetailMapper.xml | 6 +- .../WarehouseStorageOrderDetailMapper.xml | 67 ++++++ .../quality/qualityOrder/startingQuality.html | 207 ++++++++++-------- 11 files changed, 415 insertions(+), 159 deletions(-) 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 d35eaf5c..4d6e69b2 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 @@ -173,7 +173,7 @@ public class QualityOrderController extends BaseController /** - * 开始品质显示品质单详情列表 + * 开始品质显示品质单供应商物料信息列表 */ @ResponseBody @RequestMapping("/detailListGroupedBySupplier") diff --git a/ruoyi-admin/src/main/java/com/ruoyi/quality/domain/QualityOrderDetail.java b/ruoyi-admin/src/main/java/com/ruoyi/quality/domain/QualityOrderDetail.java index ccd903e2..2e8ae9d4 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/quality/domain/QualityOrderDetail.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/quality/domain/QualityOrderDetail.java @@ -109,6 +109,10 @@ public class QualityOrderDetail extends BaseEntity @Excel(name = "物料加工方式") private String materialProcessMethod; + /** 物料入库部门 */ + @Excel(name = "物料入库部门") + private String materialDeptType; + /** 生产订单数 */ @Excel(name = "生产订单数") private Integer makeTotal; @@ -376,6 +380,14 @@ public class QualityOrderDetail extends BaseEntity this.qualityUnqualifiedNum = qualityUnqualifiedNum; } + public String getMaterialDeptType() { + return materialDeptType; + } + + public void setMaterialDeptType(String materialDeptType) { + this.materialDeptType = materialDeptType; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) @@ -402,6 +414,7 @@ public class QualityOrderDetail extends BaseEntity .append("materialUnit", getMaterialUnit()) .append("materialDescribe", getMaterialDescribe()) .append("materialProcessMethod", getMaterialProcessMethod()) + .append("materialDeptType",getMaterialDeptType()) .append("makeTotal", getMakeTotal()) .append("thisArrivedNum", getThisArrivedNum()) .append("qualityHasqualifiedNum", getQualityHasqualifiedNum()) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityOrderReportServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityOrderReportServiceImpl.java index d0672bd0..c83603fb 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityOrderReportServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityOrderReportServiceImpl.java @@ -91,7 +91,7 @@ public class QualityOrderReportServiceImpl implements IQualityOrderReportService * @param qualityOrderReport 品质管理品质单报告 * @return 结果 */ - @Transactional + @Transactional(rollbackFor = Exception.class) @Override public int updateQualityOrderReport(QualityOrderReport qualityOrderReport) { @@ -115,97 +115,102 @@ public class QualityOrderReportServiceImpl implements IQualityOrderReportService Integer specialConcessionsNum = qualityOrderReport.getSpecialConcessionsNum(); //品质合格数 Integer qualityQualifiedNum = okAcceptedNum + specialConcessionsNum; + //后续要处理这个本次到货数 //本次到货数 Integer thisArrivedNum = qualityOrderDetail.getThisArrivedNum(); - if (qualityQualifiedNum>thisArrivedNum){ - throw new BusinessException("OK允收数和特采/让步数总和小于等于本次到货数"); + if (thisArrivedNum != null){ + if (qualityQualifiedNum>thisArrivedNum){ + throw new BusinessException("OK允收数和特采/让步数总和小于等于本次到货数"); + } } //更新品质报告详情中的品质合格数的数据 qualityOrderDetail.setQualityQualifiedNum(qualityQualifiedNum); - + //获得品质报告中的不合格数模块数据 List unqualifiedDataList = qualityOrderReport.getUnqualifiedDataList(); /*如果进行品质的订单类型是采购或者委外*/ - if (qualityOrderDetail.getQualityOrderType().equals("0") || qualityOrderDetail.getQualityOrderType().equals("2")){ - /*有品质不合格,需要在退换货入库前退货进行记录*/ - //更改日期格式,以提高可读性 -// SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); -// String dataPart = df.format(new Date()); +// if (qualityOrderDetail.getQualityOrderType().equals("0") || qualityOrderDetail.getQualityOrderType().equals("2")){ +// /*有品质不合格,需要在退换货入库前退货进行记录*/ // -// //移除日期中的分隔符以便于后续处理 -// String prefix = "ZCGX"+dataPart.replace("-",""); +// String refundsExchangesCode = redisCache.generateBillNo("ZCGX"); +// QualityRefundsExchanges qualityRefundsExchanges = new QualityRefundsExchanges(); +// qualityRefundsExchanges.setRefundsExchangesCode(refundsExchangesCode); +// qualityRefundsExchanges.setRefundsExchangesStatus("0"); // -// //查询数据库中退换货单号最大的编号 -// String maxCode = refundsExchangesOrderMapper.findMaxRoundCode(prefix); -// String newCode = generateNewCode(prefix,maxCode); - String refundsExchangesCode = redisCache.generateBillNo("ZCGX"); - QualityRefundsExchanges qualityRefundsExchanges = new QualityRefundsExchanges(); - qualityRefundsExchanges.setRefundsExchangesCode(refundsExchangesCode); - qualityRefundsExchanges.setRefundsExchangesStatus("0"); - - for (QualityOrderReportUnqualified tempQualityOrderReportUnqualified : unqualifiedDataList) { - QualityRefundsExchangesOrder qualityRefundsExchangesOrder = new QualityRefundsExchangesOrder(); - qualityRefundsExchangesOrder.setRefundsExchangesCode(refundsExchangesCode); - qualityRefundsExchangesOrder.setOkReportUrl(qualityOrderReport.getOkReportUrl()); - qualityRefundsExchangesOrder.setOkAcceptedNum(qualityOrderReport.getOkAcceptedNum()); - qualityRefundsExchangesOrder.setSpecialReportUrl(qualityOrderReport.getSpecialReportUrl()); - qualityRefundsExchangesOrder.setSpecialConcessionsNum(qualityOrderReport.getSpecialConcessionsNum()); - qualityRefundsExchangesOrder.setMaterialNo(materialNo); - qualityRefundsExchangesOrder.setMaterialName(qualityOrderReport.getMaterialName()); - qualityRefundsExchangesOrder.setMakeTotal(qualityOrderReport.getMakeTotal()); - qualityRefundsExchangesOrder.setQualityHasqualifiedNum(qualityOrderReport.getQualityHasqualifiedNum()); - qualityRefundsExchangesOrder.setProcessBadNum(tempQualityOrderReportUnqualified.getProcessBadNum()); - qualityRefundsExchangesOrder.setProcessBadClassification(tempQualityOrderReportUnqualified.getProcessBadClassification()); - qualityRefundsExchangesOrder.setProcessBadGrade(tempQualityOrderReportUnqualified.getProcessBadGrade()); - qualityRefundsExchangesOrder.setUpdateBy(loginName); - qualityRefundsExchangesOrder.setUpdateTime(new Date()); - refundsExchangesOrderMapper.insertQualityRefundsExchangesOrder(qualityRefundsExchangesOrder); - } - } +// for (QualityOrderReportUnqualified tempQualityOrderReportUnqualified : unqualifiedDataList) { +// QualityRefundsExchangesOrder qualityRefundsExchangesOrder = new QualityRefundsExchangesOrder(); +// qualityRefundsExchangesOrder.setRefundsExchangesCode(refundsExchangesCode); +// qualityRefundsExchangesOrder.setOkReportUrl(qualityOrderReport.getOkReportUrl()); +// qualityRefundsExchangesOrder.setOkAcceptedNum(qualityOrderReport.getOkAcceptedNum()); +// qualityRefundsExchangesOrder.setSpecialReportUrl(qualityOrderReport.getSpecialReportUrl()); +// qualityRefundsExchangesOrder.setSpecialConcessionsNum(qualityOrderReport.getSpecialConcessionsNum()); +// qualityRefundsExchangesOrder.setMaterialNo(materialNo); +// qualityRefundsExchangesOrder.setMaterialName(qualityOrderReport.getMaterialName()); +// qualityRefundsExchangesOrder.setMakeTotal(qualityOrderReport.getMakeTotal()); +// qualityRefundsExchangesOrder.setQualityHasqualifiedNum(qualityOrderReport.getQualityHasqualifiedNum()); +// qualityRefundsExchangesOrder.setProcessBadNum(tempQualityOrderReportUnqualified.getProcessBadNum()); +// qualityRefundsExchangesOrder.setProcessBadClassification(tempQualityOrderReportUnqualified.getProcessBadClassification()); +// qualityRefundsExchangesOrder.setProcessBadGrade(tempQualityOrderReportUnqualified.getProcessBadGrade()); +// qualityRefundsExchangesOrder.setUpdateBy(loginName); +// qualityRefundsExchangesOrder.setUpdateTime(new Date()); +// refundsExchangesOrderMapper.insertQualityRefundsExchangesOrder(qualityRefundsExchangesOrder); +// } +// } //计算不良数量的合计值 int processBadNumTotal = unqualifiedDataList.stream().mapToInt(QualityOrderReportUnqualified::getProcessBadNum).sum(); - if (processBadNumTotal>thisArrivedNum){ - throw new BusinessException("不良数量的总和小于等于本次到货数"); - } + //后续处理本次到货数 +// if (processBadNumTotal>thisArrivedNum){ +// throw new BusinessException("不良数量的总和小于等于本次到货数"); +// } + //更新品质报告详情品质不合格数 qualityOrderDetail.setQualityUnqualifiedNum(processBadNumTotal); - orderDetailMapper.updateQualityOrderDetail(qualityOrderDetail); + qualityOrderDetail.setUpdateBy(loginName); + qualityOrderDetail.setUpdateTime(new Date()); + //更新品质报告详情数据表 + int updateQualityOrderDetailResult = orderDetailMapper.updateQualityOrderDetail(qualityOrderDetail); + if (updateQualityOrderDetailResult <= 0){ + throw new BusinessException("更新品质单详情数据失败"); + } List qualityOrderReportUnqualifieds = unqualifiedMapper.selectQualityOrderReportUnqualifiedByCodeAndNo(tempOrderReportUnqualified); if (StringUtils.isEmpty(qualityOrderReportUnqualifieds)){ //如果后端不合格数列表值为空,就新增一个 for (QualityOrderReportUnqualified tempQualityOrderReportUnqualified : unqualifiedDataList) { - QualityOrderReportUnqualified qualityOrderReportUnqualified = getQualityOrderReportUnqualified(loginName, materialNo, supplierCode, tempQualityOrderReportUnqualified); + QualityOrderReportUnqualified qualityOrderReportUnqualified = getQualityOrderReportUnqualified(materialNo, supplierCode, tempQualityOrderReportUnqualified); + qualityOrderReportUnqualified.setCreateBy(loginName); + qualityOrderReportUnqualified.setCreateTime(new Date()); unqualifiedMapper.insertQualityOrderReportUnqualified(qualityOrderReportUnqualified); } }else { //如果后端不合格数列表值为不空,就更新 for (QualityOrderReportUnqualified tempQualityOrderReportUnqualified : unqualifiedDataList) { - QualityOrderReportUnqualified qualityOrderReportUnqualified = getQualityOrderReportUnqualified(loginName, materialNo, supplierCode, tempQualityOrderReportUnqualified); + QualityOrderReportUnqualified qualityOrderReportUnqualified = getQualityOrderReportUnqualified(materialNo, supplierCode, tempQualityOrderReportUnqualified); + qualityOrderReportUnqualified.setUpdateBy(loginName); + qualityOrderReportUnqualified.setUpdateTime(new Date()); unqualifiedMapper.updateQualityOrderReportUnqualified(qualityOrderReportUnqualified); } } qualityOrderReport.setUpdateBy(loginName); - qualityOrderReport.setUpdateTime(DateUtils.getNowDate()); + qualityOrderReport.setUpdateTime(new Date()); return qualityOrderReportMapper.updateQualityOrderReport(qualityOrderReport); } - private static QualityOrderReportUnqualified getQualityOrderReportUnqualified(String loginName, String materialNo, String supplierCode, QualityOrderReportUnqualified tempQualityOrderReportUnqualified) { + //更新品质报告不合格数量模块的数据 + private static QualityOrderReportUnqualified getQualityOrderReportUnqualified(String materialNo, String supplierCode, QualityOrderReportUnqualified tempQualityOrderReportUnqualified) { QualityOrderReportUnqualified qualityOrderReportUnqualified = new QualityOrderReportUnqualified(); qualityOrderReportUnqualified.setSupplierCode(supplierCode); qualityOrderReportUnqualified.setMaterialNo(materialNo); qualityOrderReportUnqualified.setProcessBadNum(tempQualityOrderReportUnqualified.getProcessBadNum()); qualityOrderReportUnqualified.setProcessBadClassification(tempQualityOrderReportUnqualified.getProcessBadClassification()); qualityOrderReportUnqualified.setProcessBadGrade(tempQualityOrderReportUnqualified.getProcessBadGrade()); - qualityOrderReportUnqualified.setUpdateBy(loginName); - qualityOrderReportUnqualified.setUpdateTime(new Date()); return qualityOrderReportUnqualified; } 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 c63bacec..d161541f 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 @@ -5,6 +5,7 @@ import java.util.Date; import java.util.List; import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.common.exception.BusinessException; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.quality.domain.QualityOrderDetail; @@ -24,6 +25,7 @@ import com.ruoyi.quality.domain.QualityOrder; import com.ruoyi.quality.service.IQualityOrderService; import com.ruoyi.common.core.text.Convert; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; /** * 品质管理品质单Service业务层处理 @@ -94,7 +96,7 @@ public class QualityOrderServiceImpl implements IQualityOrderService } /** - * 修改品质管理品质单 + * 修改保存品质单开始品质 * * @param qualityOrder 品质管理品质单 * @return 结果 @@ -103,21 +105,113 @@ public class QualityOrderServiceImpl implements IQualityOrderService @Override public int updateQualityOrder(QualityOrder qualityOrder) { + String loginName = ShiroUtils.getLoginName(); qualityOrder.setUpdateBy(loginName); qualityOrder.setUpdateTime(new Date()); List qualityOrderDetailList = qualityOrder.getQualityOrderDetailList(); - //根据品质单号从数据库查询 + + if (CollectionUtils.isEmpty(qualityOrderDetailList)){ + throw new BusinessException("品质单详情数据为空"); + } + + for (QualityOrderDetail qualityOrderDetail : qualityOrderDetailList) { + qualityOrderDetail.setUpdateBy(loginName); + qualityOrderDetail.setUpdateTime(new Date()); + 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("请先进行品质报告操作"); + } + //更新品质单详情数据 + 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(); - //采购订单,采购入库单品质完成后,数据生成到入库单中,后续进行入库操作 - if ("0".equals(qualityStatus) && "0".equals(qualityStorageStatus) ){ - warehouseStorageOrderService.updateWarehouseStorageOrderByQualityOrder(qualityOrder,qualityOrderDetailList); + + 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("存在品质已合格数为空,请检查!"); } - //目前假设全部品质 - qualityOrder.setQualityStatus("2"); + 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(); + //计算主表的本次到货数 +// Integer thisArrivedNum = qualityOrderDetailList.stream().mapToInt(QualityOrderDetail::getThisArrivedNum).sum(); + //计算主表的品质合格数 +// Integer qualityQualifiedNum = qualityOrderDetailList.stream().mapToInt(QualityOrderDetail::getQualityQualifiedNum).sum(); + //计算主表的品质不合格数 +// Integer qualityUnqualifiedNum = 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(thisArrivedNumSum); + tempQualityOrder.setQualityUnqualifiedNum(qualityQualifiedNumSum); + tempQualityOrder.setThisArrivedNum(qualityUnqualifiedNumSum); + + //采购订单,采购入库单品质完成后,数据生成到入库单中,后续进行入库操作 + int updateStorageOrderResult = warehouseStorageOrderService.updateWarehouseStorageOrderByQualityOrder(tempQualityOrder, qualityOrderDetailList); + if (updateStorageOrderResult <= 0){ + throw new BusinessException("更新入库单数据失败"); + } + int updateResult = qualityOrderMapper.updateQualityOrder(qualityOrder); if (updateResult <= 0){ log.warn("更新品质单失败,未影响任何行"); @@ -258,7 +352,7 @@ public class QualityOrderServiceImpl implements IQualityOrderService qualityOrderDetail.setMaterialDescribe(warehouseStorageOrderDetail.getMaterialDescribe()); qualityOrderDetail.setMaterialName(warehouseStorageOrderDetail.getMaterialName()); qualityOrderDetail.setMaterialProcessMethod(warehouseStorageOrderDetail.getMaterialProcessMethod()); - //To do 缺少入库部门 ,如果后续需要从这里添加 + qualityOrderDetail.setMaterialDeptType(warehouseStorageOrderDetail.getMaterialDeptType()); qualityOrderDetail.setMaterialPhotourl(warehouseStorageOrderDetail.getMaterialPhotourl()); qualityOrderDetail.setMaterialUnit(warehouseStorageOrderDetail.getMaterialUnit()); qualityOrderDetail.setMaterialType(warehouseStorageOrderDetail.getMaterialType()); 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 8f0f9db3..494e9e7e 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 @@ -320,7 +320,7 @@ public class WarehouseStorageOrderController extends BaseController @ResponseBody public AjaxResult storagePurchaseSave(@RequestBody WarehouseStorageOrder warehouseStorageOrder) { - return toAjax(warehouseStorageOrderService.storagePurchaseWarehouseStorageOrder(warehouseStorageOrder)); + return toAjax(warehouseStorageOrderService.updateStoragePurchaseSave(warehouseStorageOrder)); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/mapper/WarehouseStorageOrderDetailMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/mapper/WarehouseStorageOrderDetailMapper.java index a95ebfb8..f2736601 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/mapper/WarehouseStorageOrderDetailMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/mapper/WarehouseStorageOrderDetailMapper.java @@ -108,4 +108,9 @@ public interface WarehouseStorageOrderDetailMapper * 根据入库单号、供应商id、物料号更新对应的物料单详情 * */ WarehouseStorageOrderDetail selectWarehouseStorageOrderDetailListByRelatedOrderCode(WarehouseStorageOrderDetail warehouseStorageOrderDetail); + + /* + * 根据入库单号更新入库单数据 + * */ + int updateWarehouseStorageOrderDetailByCode(WarehouseStorageOrderDetail storageOrderDetail); } 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 b5a58bda..d2a118cd 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 @@ -98,4 +98,9 @@ public interface IWarehouseStorageOrderService * 修改保存暂收-采购单(采购入库) * */ int temporaryPurchaseSave(WarehouseStorageOrder warehouseStorageOrder); + + /** + * 入库-采购单(采购入库) + * */ + int updateStoragePurchaseSave(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 c28f9ac2..1be82ca8 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 @@ -196,28 +196,37 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS WarehouseStorageOrder warehouseStorageOrder = new WarehouseStorageOrder(); - warehouseStorageOrder.setWarehouseStorageCode(qualityOrder.getInStorageCode()); + //入库状态 为待入库 warehouseStorageOrder.setWarehouseStorageStatus("2"); - //目前假设全部品质 - warehouseStorageOrder.setWarehouseQualityStatus("2"); //设置品质时间 - warehouseStorageOrder.setQualityTime(new Date()); + warehouseStorageOrder.setQualityTime(qualityOrder.getDeliveryInspectionTime()); + //设置品质合格数 + warehouseStorageOrder.setQualityQualifiedNum(qualityOrder.getQualityQualifiedNum()); + //设置品质不合格数 + warehouseStorageOrder.setQualityUnqualifiedNum(qualityOrder.getQualityUnqualifiedNum()); + //设置交检时间 + warehouseStorageOrder.setDeliveryInspectionTime(qualityOrder.getDeliveryInspectionTime()); + for (QualityOrderDetail qualityOrderDetail : qualityOrderDetailList) { WarehouseStorageOrderDetail storageOrderDetail = new WarehouseStorageOrderDetail(); storageOrderDetail.setWarehouseStorageCode(qualityOrder.getInStorageCode()); storageOrderDetail.setQualityQualifiedNum(qualityOrderDetail.getQualityQualifiedNum()); + int updateStorageOrderDetailResult = storageOrderDetailMapper.updateWarehouseStorageOrderDetailByCode(storageOrderDetail); + if (updateStorageOrderDetailResult <= 0){ + throw new BusinessException("更新仓库入库单详情失败,未影响任何行"); + } } int updateResult = warehouseStorageOrderMapper.updateWarehouseStorageOrderByCode(warehouseStorageOrder); if (updateResult <= 0){ - log.warn("更新仓库入库单失败,未影响任何行"); + throw new BusinessException("更新仓库入库单失败,未影响任何行"); } return updateResult; } /** - * 入库-采购单(采购入库) + * 入库-采购单(采购入库) 旧版弃用 * */ @Transactional(rollbackFor = Exception.class) @Override @@ -303,6 +312,41 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS return updateResult; } + + /** + * 修改保存 入库-采购单(采购入库) + * */ + @Transactional(rollbackFor = Exception.class) + @Override + public int updateStoragePurchaseSave(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/quality/QualityOrderDetailMapper.xml b/ruoyi-admin/src/main/resources/mapper/quality/QualityOrderDetailMapper.xml index 75cd8ba0..b8e5bc2c 100644 --- a/ruoyi-admin/src/main/resources/mapper/quality/QualityOrderDetailMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/quality/QualityOrderDetailMapper.xml @@ -28,6 +28,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -41,7 +42,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select quality_order_detail_id, quality_order_code, in_storage_code, related_order_code, quality_status, quality_order_type, quality_storage_status, delivery_inspection_time, warehouse_code, warehouse_name, supplier_code, supplier_name, customer_contact, contact_number, supplier_address, material_no, material_name, material_type, material_photoUrl, material_brand, material_unit, material_describe, material_process_method, make_total, this_arrived_num, quality_hasqualified_num, quality_qualified_num, quality_unqualified_num, remark, create_by, create_time, update_by, update_time from quality_order_detail + select quality_order_detail_id, quality_order_code, in_storage_code, related_order_code, quality_status, quality_order_type, quality_storage_status, delivery_inspection_time, warehouse_code, warehouse_name, supplier_code, supplier_name, customer_contact, contact_number, supplier_address, material_no, material_name, material_type, material_photoUrl, material_brand, material_unit, material_describe, material_process_method, material_dept_type ,make_total, this_arrived_num, quality_hasqualified_num, quality_qualified_num, quality_unqualified_num, remark, create_by, create_time, update_by, update_time from quality_order_detail