diff --git a/ruoyi-admin/src/main/java/com/ruoyi/quality/controller/QualityReturnInspectionController.java b/ruoyi-admin/src/main/java/com/ruoyi/quality/controller/QualityReturnInspectionController.java index f3d4c61a..87308f3d 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/quality/controller/QualityReturnInspectionController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/quality/controller/QualityReturnInspectionController.java @@ -126,7 +126,7 @@ public class QualityReturnInspectionController extends BaseController } /** - * 修改保存退检管理单 + * 修改保存退检管理单详情 */ @RequiresPermissions("quality:returnInspection:detail") @Log(title = "物料退检单", businessType = BusinessType.UPDATE) @@ -137,6 +137,27 @@ public class QualityReturnInspectionController extends BaseController return toAjax(qualityReturnInspectionService.detailQualityReturnInspection(erpMaterialReturnInspection)); } + /** + * 修改物料退检单 + */ + @GetMapping("/processing/{id}") + public String processing(@PathVariable("id") Long id, ModelMap mmap) + { + ErpMaterialReturnInspection erpMaterialReturnInspection = qualityReturnInspectionService.selectQualityReturnInspectionById(id); + mmap.put("erpMaterialReturnInspection", erpMaterialReturnInspection); + return prefix + "/returnInspectionProcessing"; + } + /** + * 修改保存物料退检单 + */ + @RequiresPermissions("quality:returnInspection:processing") + @Log(title = "物料退检单", businessType = BusinessType.UPDATE) + @PostMapping("/processing") + @ResponseBody + public AjaxResult processingSave(ErpMaterialReturnInspection erpMaterialReturnInspection) + { + return toAjax(qualityReturnInspectionService.processingQualityReturnInspection(erpMaterialReturnInspection)); + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/quality/service/IQualityReturnInspectionService.java b/ruoyi-admin/src/main/java/com/ruoyi/quality/service/IQualityReturnInspectionService.java index 83c50ce1..90676fe7 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/quality/service/IQualityReturnInspectionService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/quality/service/IQualityReturnInspectionService.java @@ -55,4 +55,9 @@ public interface IQualityReturnInspectionService * 退检管理详情 * */ int detailQualityReturnInspection(ErpMaterialReturnInspection erpMaterialReturnInspection); + + /* + * 退检处理 + * */ + int processingQualityReturnInspection(ErpMaterialReturnInspection erpMaterialReturnInspection); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityReturnInspectionServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityReturnInspectionServiceImpl.java index f7c77a47..0c3343ee 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityReturnInspectionServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityReturnInspectionServiceImpl.java @@ -6,6 +6,7 @@ import java.util.stream.Collectors; import cn.hutool.core.collection.CollectionUtil; 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.erp.domain.ErpMaterialReturnInspection; @@ -145,4 +146,45 @@ public class QualityReturnInspectionServiceImpl implements IQualityReturnInspect public int detailQualityReturnInspection(ErpMaterialReturnInspection erpMaterialReturnInspection) { return 1; } + + /* + * 退检处理 + * */ + @Override + public int processingQualityReturnInspection(ErpMaterialReturnInspection erpMaterialReturnInspection) { + String returnInspectionNo = erpMaterialReturnInspection.getReturnInspectionNo(); + ErpMaterialReturnInspectionDetail detailQueryObj = new ErpMaterialReturnInspectionDetail(); + detailQueryObj.setReturnInspectionNo(returnInspectionNo); + List oldDetails = materialReturnInspectionDetailService.selectErpMaterialReturnInspectionDetailList(detailQueryObj); + List oldDetailIds = new ArrayList<>(); + if(CollectionUtil.isNotEmpty(oldDetails)){ + oldDetailIds = oldDetails.stream().map(t->t.getId()).collect(Collectors.toList()); + }else{ + materialReturnInspectionDetailService.deleteByReturnInspectionNo(returnInspectionNo); + } + List inspectionDetails = erpMaterialReturnInspection.getInspectionDetails(); + List finalOldDetailIds = oldDetailIds; + inspectionDetails.forEach(detail->{ + Long id = detail.getId(); + if(finalOldDetailIds.contains(id)){ + materialReturnInspectionDetailService.updateErpMaterialReturnInspectionDetail(detail); + finalOldDetailIds.remove(id); + }else{ + detail.setReturnInspectionNo(returnInspectionNo); + materialReturnInspectionDetailService.insertErpMaterialReturnInspectionDetail(detail); + } + }); + if(CollectionUtil.isNotEmpty(finalOldDetailIds)){ + materialReturnInspectionDetailService.deleteErpMaterialReturnInspectionDetailByIdList(finalOldDetailIds); + } + + String loginName = ShiroUtils.getLoginName(); + erpMaterialReturnInspection.setUpdateBy(loginName); + erpMaterialReturnInspection.setUpdateTime(DateUtils.getNowDate()); + if (erpMaterialReturnInspection.getIsClosed().equals("1")){ + throw new BusinessException("已经结案,不可以再上传复检"); + } + int updateFlag = erpMaterialReturnInspectionMapper.updateErpMaterialReturnInspection(erpMaterialReturnInspection); + return updateFlag; + } } diff --git a/ruoyi-admin/src/main/resources/templates/quality/returnInspection/detail.html b/ruoyi-admin/src/main/resources/templates/quality/returnInspection/detail.html index 783b2be5..8f9310d2 100644 --- a/ruoyi-admin/src/main/resources/templates/quality/returnInspection/detail.html +++ b/ruoyi-admin/src/main/resources/templates/quality/returnInspection/detail.html @@ -90,6 +90,7 @@ \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/quality/returnInspection/returnInspectionProcessing.html b/ruoyi-admin/src/main/resources/templates/quality/returnInspection/returnInspectionProcessing.html new file mode 100644 index 00000000..a33ae8ee --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/quality/returnInspection/returnInspectionProcessing.html @@ -0,0 +1,426 @@ + + + + + + + +
+
+
+
+ +
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+
+
+ +
+
+ + +
+
+
+
+
+
+ +
+ + +
+
+
+
+
+
+
+ +
+
+ + +
+
+
+
+
+
+
+ + + + + + +
+
+
+
+
+
+
+ + + + + + + + + + + + \ No newline at end of file