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 @@

+
+ +
+ +
+