From d7598225c78942ccdb9ab5e67a95a7a58ddf5d69 Mon Sep 17 00:00:00 2001 From: liuxiaoxu <1793812695@qq.com> Date: Sat, 7 Sep 2024 11:33:07 +0800 Subject: [PATCH] =?UTF-8?q?[feat]=20=E5=B7=A5=E7=A8=8B=E7=AE=A1=E7=90=86?= =?UTF-8?q?=20=E4=BF=AE=E6=94=B9=E7=89=A9=E6=96=99=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E7=9A=84=E4=BD=9C=E5=BA=9F=E5=89=8D=E7=AB=AF=E6=8C=89=E9=92=AE?= =?UTF-8?q?=EF=BC=8C=E6=96=B0=E5=A2=9E=E4=BD=9C=E5=BA=9F=E5=89=8D=E6=8F=90?= =?UTF-8?q?=E9=86=92=E5=92=8C=E7=A1=AE=E8=AE=A4=E5=90=8E=E6=89=93=E5=BC=80?= =?UTF-8?q?=E4=BD=9C=E5=BA=9F=E9=A1=B5=E9=9D=A2=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E7=89=A9=E6=96=99=E4=BF=A1=E6=81=AF=E4=BD=9C=E5=BA=9F=E5=89=8D?= =?UTF-8?q?=E7=AB=AF=E9=A1=B5=E9=9D=A2=20=E6=96=B0=E5=A2=9E=E7=89=A9?= =?UTF-8?q?=E6=96=99=E4=BF=A1=E6=81=AF=E4=BD=9C=E5=BA=9F=E6=9D=83=E9=99=90?= =?UTF-8?q?=E5=AD=97=E7=AC=A6=20=E6=96=B0=E5=A2=9E=20=E6=A0=B9=E6=8D=AE?= =?UTF-8?q?=E7=89=A9=E6=96=99=E4=BF=A1=E6=81=AF=E5=AF=B9=E8=B1=A1=E4=BD=9C?= =?UTF-8?q?=E5=BA=9F=E5=AE=A2=E6=88=B7=E6=8A=A5=E4=BB=B7=E5=90=8E=E7=AB=AF?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=20=E6=96=B0=E5=A2=9E=20=E5=8A=A0=E8=BD=BD?= =?UTF-8?q?=E4=BD=9C=E5=BA=9F=E7=89=A9=E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B9=E6=8E=A5=E5=8F=A3=EF=BC=8C=E5=8A=A0=E4=B8=8A?= =?UTF-8?q?=E4=BD=9C=E5=BA=9F=E7=90=86=E7=94=B1=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../erp/controller/ErpMaterialController.java | 35 ++++++++++++++++--- .../erp/service/IErpMaterialService.java | 4 +++ .../service/impl/ErpMaterialServiceImpl.java | 33 +++++++++++++++++ .../mapper/erp/ErpMaterialMapper.xml | 9 +++-- .../templates/erp/material/cancel.html | 32 +++++++++++++++++ .../templates/erp/material/material.html | 12 ++++++- .../erp/material/taskGcjlVerify.html | 7 ++++ .../erp/material/taskGczgVerify.html | 6 ++++ .../erp/material/taskYfzjVerify.html | 6 ++++ 9 files changed, 136 insertions(+), 8 deletions(-) create mode 100644 ruoyi-admin/src/main/resources/templates/erp/material/cancel.html diff --git a/ruoyi-admin/src/main/java/com/ruoyi/erp/controller/ErpMaterialController.java b/ruoyi-admin/src/main/java/com/ruoyi/erp/controller/ErpMaterialController.java index f1d0fbf4..260bf4ce 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/erp/controller/ErpMaterialController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/erp/controller/ErpMaterialController.java @@ -13,6 +13,7 @@ import com.ruoyi.erp.domain.ErpMaterialVo; import com.ruoyi.erp.mapper.ErpMaterialMapper; import com.ruoyi.erp.service.IErpMaterialService; import com.ruoyi.process.general.service.IProcessService; +import com.ruoyi.system.domain.SysCustomer; import com.ruoyi.system.domain.SysErpMaterialSysTechnicalTeam; import com.ruoyi.system.service.ISysErpMaterialSysTechnicalTeamService; import com.ruoyi.system.service.ISysTechnicalTeamService; @@ -295,14 +296,40 @@ public class ErpMaterialController extends BaseController * 作废物料信息 */ // @RequiresPermissions("erp:material:cancel") +// @Log(title = "物料信息", businessType = BusinessType.CANCEL) +// @GetMapping( "/cancel/{id}") +// @ResponseBody +// public AjaxResult cancel(@PathVariable("id") Long id){ +// erpMaterialService.cancelErpMaterialById(id); +// return AjaxResult.success(); +// } + + + /** + * 加载作废物料信息弹窗 + */ + @GetMapping("/cancel/{id}") + public String cancel(@PathVariable("id") Long id, ModelMap mmap) { + ErpMaterial erpMaterial = erpMaterialService.selectErpMaterialById(id); + mmap.put("erpMaterial", erpMaterial); + return prefix + "/cancel"; + } + + + /** + * 作废物料信息 + */ + //@RequiresPermissions("erp:material:cancel") @Log(title = "物料信息", businessType = BusinessType.CANCEL) - @GetMapping( "/cancel/{id}") + @PostMapping( "/cancel") @ResponseBody - public AjaxResult cancel(@PathVariable("id") Long id){ - erpMaterialService.cancelErpMaterialById(id); - return AjaxResult.success(); + public AjaxResult cancel(ErpMaterial erpMaterial){ + return toAjax(erpMaterialService.cancelErpMaterialByObject(erpMaterial)); + } + + /** * 恢复物料信息 */ diff --git a/ruoyi-admin/src/main/java/com/ruoyi/erp/service/IErpMaterialService.java b/ruoyi-admin/src/main/java/com/ruoyi/erp/service/IErpMaterialService.java index 82dab06e..e1da1c04 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/erp/service/IErpMaterialService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/erp/service/IErpMaterialService.java @@ -135,4 +135,8 @@ public interface IErpMaterialService List selectAllErpMaterialListByMaterialVo(ErpMaterialVo erpMaterialVo); + /** + * 通过物料信息作废物料信息 + * */ + int cancelErpMaterialByObject(ErpMaterial erpMaterial); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpMaterialServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpMaterialServiceImpl.java index fa5d2d62..cacfc25f 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpMaterialServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpMaterialServiceImpl.java @@ -381,6 +381,39 @@ public class ErpMaterialServiceImpl implements IErpMaterialService return processInstance; } + + /** + * 通过物料信息作废物料信息 + * */ + @Transactional(rollbackFor = Exception.class) + @Override + public int cancelErpMaterialByObject(ErpMaterial erpMaterial) { + + ErpMaterialVo erpMaterialVo = erpMaterialMapper.selectErpMaterialById(erpMaterial.getId()); + // 审核状态-待审核 + erpMaterialVo.setAuditStatus("0"); + SysUser user = ShiroUtils.getSysUser(); + // 启动流程 + String applyTitle = user.getUserName()+"发起了物料信息作废审批-"+DateUtils.dateTimeNow(); + String instanceType = "cancel"; + ErpMaterial tempErpMaterial = new ErpMaterial(); + BeanUtils.copyProperties(erpMaterialVo,tempErpMaterial); + ProcessInstance processInstance = startProcessInstance(applyTitle,instanceType,tempErpMaterial, user); + String processInstanceId = processInstance.getProcessInstanceId(); + // 作废实例id + tempErpMaterial.setCancelInstanceId(processInstanceId); + // 存在提交完就流程结束的情况 + boolean processIsFinish = processService.judgeProcessIsFinish(processInstanceId); + if(processIsFinish){ + // 审核状态-审核通过 + tempErpMaterial.setAuditStatus("1"); + // 使用状态-已作废 + tempErpMaterial.setUseStatus("2"); + } + tempErpMaterial.setCancelRemark(erpMaterial.getCancelRemark()); + return erpMaterialMapper.updateErpMaterial(tempErpMaterial); + } + @Override public ProcessInstance restoreErpMaterialById(Long id) { ErpMaterialVo erpMaterialVo = erpMaterialMapper.selectErpMaterialById(id); diff --git a/ruoyi-admin/src/main/resources/mapper/erp/ErpMaterialMapper.xml b/ruoyi-admin/src/main/resources/mapper/erp/ErpMaterialMapper.xml index 778a30d8..0969f395 100644 --- a/ruoyi-admin/src/main/resources/mapper/erp/ErpMaterialMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/erp/ErpMaterialMapper.xml @@ -41,12 +41,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + select id, del_flag, create_by, create_time, update_by, update_time, remark, - bomNo, material_no, material_name, audit_status, use_status, + bomNo, material_no, material_name, audit_status, use_status,cancel_remark, hava_product_tem,product_item,itemName, material_type, process_method, unit, brand, `describe`, warehouse_dept,business_members,instance_id,instance_type,submit_instance_id, cancel_instance_id,restore_instance_id,apply_title,apply_user,apply_time from erp_material @@ -122,7 +122,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" +
+ +
+ +
+
+ + + + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/erp/material/material.html b/ruoyi-admin/src/main/resources/templates/erp/material/material.html index 0234fb61..3383dec2 100644 --- a/ruoyi-admin/src/main/resources/templates/erp/material/material.html +++ b/ruoyi-admin/src/main/resources/templates/erp/material/material.html @@ -201,7 +201,7 @@ // 审核状态-审核通过 使用状态-是 未发起作废流程 if(row.auditStatus=="1" && row.useStatus=="1" && !row.cancelInstanceId){ // 作废 - actions.push(' 作废'); + actions.push(' 作废'); // 编辑 actions.push(' 编辑 '); } @@ -298,6 +298,16 @@ }); }); } + + //作废 + function cancel(id) { + + $.modal.confirm("确定作废该物料信息吗?", function() { + var url = prefix + "/cancel/" + id; + $.modal.open("作废", url); + }) + } + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/erp/material/taskGcjlVerify.html b/ruoyi-admin/src/main/resources/templates/erp/material/taskGcjlVerify.html index c85b75b6..d331c13b 100644 --- a/ruoyi-admin/src/main/resources/templates/erp/material/taskGcjlVerify.html +++ b/ruoyi-admin/src/main/resources/templates/erp/material/taskGcjlVerify.html @@ -125,6 +125,13 @@
+ +
+ +
+ +
+
diff --git a/ruoyi-admin/src/main/resources/templates/erp/material/taskGczgVerify.html b/ruoyi-admin/src/main/resources/templates/erp/material/taskGczgVerify.html index a09b0b01..94ff6b26 100644 --- a/ruoyi-admin/src/main/resources/templates/erp/material/taskGczgVerify.html +++ b/ruoyi-admin/src/main/resources/templates/erp/material/taskGczgVerify.html @@ -125,6 +125,12 @@

+
+ +
+ +
+
diff --git a/ruoyi-admin/src/main/resources/templates/erp/material/taskYfzjVerify.html b/ruoyi-admin/src/main/resources/templates/erp/material/taskYfzjVerify.html index 9e7abe6c..01a7b4f4 100644 --- a/ruoyi-admin/src/main/resources/templates/erp/material/taskYfzjVerify.html +++ b/ruoyi-admin/src/main/resources/templates/erp/material/taskYfzjVerify.html @@ -125,6 +125,12 @@

+
+ +
+ +
+