From f9ce85d192a3cb7c096569205f9f5b079f71c17b Mon Sep 17 00:00:00 2001 From: zhangsiqi <2825463979@qq.com> Date: Sat, 13 Jul 2024 22:48:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9:=E9=87=87=E8=B4=AD=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E6=B7=BB=E5=8A=A0=E5=AE=A1=E6=A0=B8=E5=AE=9E=E4=BD=93?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=EF=BC=8C=E4=BF=AE=E6=94=B9=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=96=B9=E6=B3=95SQL=E8=BF=94=E5=9B=9E=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E4=B8=BA=E6=96=B0=E5=A2=9ESysSupplierVo=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/PurchaseOrderController.java | 6 +- .../purchase/mapper/PurchaseOrderMapper.java | 6 +- .../service/IPurchaseOrderService.java | 7 +- .../impl/PurchaseOrderServiceImpl.java | 123 ++++++-------- .../mapper/purchase/PurchaseOrderMapper.xml | 100 +++++++++-- .../templates/purchase/purchaseOrder/add.html | 16 -- .../purchase/purchaseOrder/edit.html | 156 +++--------------- .../purchase/purchaseOrder/purchaseOrder.html | 2 + 8 files changed, 177 insertions(+), 239 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseOrderController.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseOrderController.java index 467a16d8..2a094ca6 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseOrderController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseOrderController.java @@ -114,7 +114,7 @@ public class PurchaseOrderController extends BaseController { // 采购角色只能看到自己创建的数据 startPage(); - List list = purchaseOrderService.selectPurchaseOrderList(purchaseOrder); + List list = purchaseOrderService.selectPurchaseOrderList(purchaseOrder); return getDataTable(list); } @@ -128,8 +128,8 @@ public class PurchaseOrderController extends BaseController @ResponseBody public AjaxResult export(PurchaseOrder purchaseOrder) { - List list = purchaseOrderService.selectPurchaseOrderList(purchaseOrder); - ExcelUtil util = new ExcelUtil(PurchaseOrder.class); + List list = purchaseOrderService.selectPurchaseOrderList(purchaseOrder); + ExcelUtil util = new ExcelUtil(PurchaseOrderVo.class); return util.exportExcel(list, "采购订单数据"); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchaseOrderMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchaseOrderMapper.java index 216bd7d1..c157885e 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchaseOrderMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchaseOrderMapper.java @@ -19,7 +19,7 @@ public interface PurchaseOrderMapper * @param purchaseOrderId 采购订单ID * @return 采购订单 */ - public PurchaseOrder selectPurchaseOrderById(Long purchaseOrderId); + public PurchaseOrderVo selectPurchaseOrderById(Long purchaseOrderId); /** * 查询采购订单列表 @@ -27,7 +27,7 @@ public interface PurchaseOrderMapper * @param purchaseOrder 采购订单 * @return 采购订单集合 */ - public List selectPurchaseOrderList(PurchaseOrder purchaseOrder); + public List selectPurchaseOrderList(PurchaseOrder purchaseOrder); /** * 新增采购订单 @@ -62,7 +62,7 @@ public interface PurchaseOrderMapper public int deletePurchaseOrderByIds(String[] purchaseOrderIds); //查询关联类型为生产订单的采购订单列表 - public List selectOrderByIdDesc(); + public List selectOrderByIdDesc(); //根据采购订单编号查询采购订单 PurchaseOrder selectPurchaseOrderByOrderCode(String purchaseOrderCode); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchaseOrderService.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchaseOrderService.java index b25d1d47..27dd340f 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchaseOrderService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchaseOrderService.java @@ -1,6 +1,7 @@ package com.ruoyi.purchase.service; import com.ruoyi.purchase.domain.PurchaseOrder; +import com.ruoyi.purchase.domain.PurchaseOrderVo; import com.ruoyi.warehouse.domain.WarehouseStorageOrder; import org.activiti.engine.runtime.ProcessInstance; import org.springframework.transaction.annotation.Transactional; @@ -29,7 +30,7 @@ public interface IPurchaseOrderService * @param purchaseOrder 采购订单 * @return 采购订单集合 */ - public List selectPurchaseOrderList(PurchaseOrder purchaseOrder); + public List selectPurchaseOrderList(PurchaseOrder purchaseOrder); /** * 新增采购订单 @@ -79,7 +80,7 @@ public interface IPurchaseOrderService ProcessInstance submitApply(PurchaseOrder purchaseOrder); @Transactional(rollbackFor = Exception.class) - ProcessInstance cancelPurchaseOrderById(Long id); + public ProcessInstance cancelPurchaseOrderById(Long id); - ProcessInstance restorePurchaseOrderById(Long id); + public ProcessInstance restorePurchaseOrderById(Long id); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderServiceImpl.java index 734d2c1b..0030d17c 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderServiceImpl.java @@ -3,22 +3,24 @@ package com.ruoyi.purchase.service.impl; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.core.text.Convert; -import com.ruoyi.common.exception.BusinessException; import com.ruoyi.common.service.ICommonService; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.ShiroUtils; +import com.ruoyi.common.utils.bean.BeanUtils; import com.ruoyi.financial.domain.FinancialAccountsPayable; import com.ruoyi.financial.service.IFinancialAccountsPayableService; import com.ruoyi.process.general.service.IProcessService; import com.ruoyi.process.todoitem.mapper.BizTodoItemMapper; import com.ruoyi.purchase.domain.PurchaseOrder; import com.ruoyi.purchase.domain.PurchaseOrderChild; +import com.ruoyi.purchase.domain.PurchaseOrderVo; import com.ruoyi.purchase.domain.PurchasePlan; import com.ruoyi.purchase.mapper.PurchaseOrderChildMapper; import com.ruoyi.purchase.mapper.PurchaseOrderMapper; import com.ruoyi.purchase.mapper.PurchasePlanMapper; import com.ruoyi.purchase.service.IPurchaseOrderService; import com.ruoyi.system.domain.SysSupplier; +import com.ruoyi.system.domain.Vo.SysSupplierVo; import com.ruoyi.system.mapper.SysUserMapper; import com.ruoyi.system.service.ISysAttachFileService; import com.ruoyi.system.service.ISysAttachService; @@ -124,7 +126,7 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService * @return 采购订单 */ @Override - public List selectPurchaseOrderList(PurchaseOrder purchaseOrder) + public List selectPurchaseOrderList(PurchaseOrder purchaseOrder) { return purchaseOrderMapper.selectPurchaseOrderList(purchaseOrder); } @@ -490,7 +492,7 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService //每当当前供应商完成一次循环,生成一条供应商应付账款 SysSupplier sysSupplier = new SysSupplier(); sysSupplier.setSupplierCode(purchaseOrderChild.getSupplierCode()); - List sysSupplierList = sysSupplierService.selectSysSupplierList(sysSupplier); + List sysSupplierList = sysSupplierService.selectSysSupplierList(sysSupplier); int supplierListSize = sysSupplierList.size(); if(supplierListSize == 0){ continue; @@ -525,6 +527,7 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService return 1; // 返回成功标识 } @Transactional(rollbackFor = Exception.class) + @Override public ProcessInstance submitApply(PurchaseOrder purchaseOrder) { SysUser user = ShiroUtils.getSysUser(); purchaseOrder.setApplyUser(user.getLoginName()); @@ -549,69 +552,61 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService return processInstance; } + @Override + @Transactional(rollbackFor = Exception.class) public ProcessInstance cancelPurchaseOrderById(Long id) { - return null; + PurchaseOrderVo purchaseOrderVo = purchaseOrderMapper.selectPurchaseOrderById(id); + // 审核状态-待审核 + purchaseOrderVo.setAuditStatus("0"); + SysUser user = ShiroUtils.getSysUser(); + // 启动流程 + String applyTitle = user.getUserName()+"发起了物料信息作废审批-"+DateUtils.dateTimeNow(); + String instanceType = "cancel"; + PurchaseOrder purchaseOrder = new PurchaseOrder(); + BeanUtils.copyProperties(purchaseOrderVo,purchaseOrder); + ProcessInstance processInstance = startProcessInstance(applyTitle,instanceType,purchaseOrder, user); + String processInstanceId = processInstance.getProcessInstanceId(); + // 作废实例id + purchaseOrder.setCancelInstanceId(processInstanceId); + // 存在提交完就流程结束的情况 + boolean processIsFinish = processService.judgeProcessIsFinish(processInstanceId); + if(processIsFinish){ + // 审核状态-审核通过 + purchaseOrder.setAuditStatus("1"); + // 使用状态-已作废 + purchaseOrder.setUseStatus("2"); + } + purchaseOrderMapper.updatePurchaseOrder(purchaseOrder); + return processInstance; } @Override public ProcessInstance restorePurchaseOrderById(Long id) { - return null; + PurchaseOrderVo purchaseOrderVo = purchaseOrderMapper.selectPurchaseOrderById(id); + // 审核状态-待审核 + purchaseOrderVo.setAuditStatus("0"); + SysUser user = ShiroUtils.getSysUser(); + // 启动流程 + String applyTitle = user.getUserName()+"发起了物料信息恢复审批-"+DateUtils.dateTimeNow(); + String instanceType = "restore"; + PurchaseOrder purchaseOrder = new PurchaseOrder(); + BeanUtils.copyProperties(purchaseOrderVo,purchaseOrder); + ProcessInstance processInstance = startProcessInstance(applyTitle,instanceType,purchaseOrder, user); + String processInstanceId = processInstance.getProcessInstanceId(); + // 恢复实例id + purchaseOrder.setRestoreInstanceId(processInstanceId); + // 存在提交完就流程结束的情况 + boolean processIsFinish = processService.judgeProcessIsFinish(processInstanceId); + if(processIsFinish){ + // 审核状态-审核通过 + purchaseOrder.setAuditStatus("1"); + // 使用状态-是 + purchaseOrder.setUseStatus("1"); + } + purchaseOrderMapper.updatePurchaseOrder(purchaseOrder); + return processInstance; } -// @Override -// @Transactional(rollbackFor = Exception.class) -// public ProcessInstance cancelPurchaseOrderById(Long id) { -// PurchaseOrderVo purchaseOrderVo = purchaseOrderMapper.selectPurchaseOrderById(id); -// // 审核状态-待审核 -// purchaseOrderVo.setAuditStatus("0"); -// SysUser user = ShiroUtils.getSysUser(); -// // 启动流程 -// String applyTitle = user.getUserName()+"发起了物料信息作废审批-"+DateUtils.dateTimeNow(); -// String instanceType = "cancel"; -// PurchaseOrder purchaseOrder = new PurchaseOrder(); -// BeanUtils.copyProperties(purchaseOrderVo,purchaseOrder); -// ProcessInstance processInstance = startProcessInstance(applyTitle,instanceType,purchaseOrder, user); -// String processInstanceId = processInstance.getProcessInstanceId(); -// // 作废实例id -// purchaseOrder.setCancelInstanceId(processInstanceId); -// // 存在提交完就流程结束的情况 -// boolean processIsFinish = processService.judgeProcessIsFinish(processInstanceId); -// if(processIsFinish){ -// // 审核状态-审核通过 -// purchaseOrder.setAuditStatus("1"); -// // 使用状态-已作废 -// purchaseOrder.setUseStatus("2"); -// } -// purchaseOrderMapper.updatePurchaseOrder(purchaseOrder); -// return processInstance; -// } - -// @Override -// public ProcessInstance restorePurchaseOrderById(Long id) { -// PurchaseOrderVo purchaseOrderVo = purchaseOrderMapper.selectPurchaseOrderById(id); -// // 审核状态-待审核 -// purchaseOrderVo.setAuditStatus("0"); -// SysUser user = ShiroUtils.getSysUser(); -// // 启动流程 -// String applyTitle = user.getUserName()+"发起了物料信息恢复审批-"+DateUtils.dateTimeNow(); -// String instanceType = "restore"; -// PurchaseOrder purchaseOrder = new PurchaseOrder(); -// BeanUtils.copyProperties(purchaseOrderVo,purchaseOrder); -// ProcessInstance processInstance = startProcessInstance(applyTitle,instanceType,purchaseOrder, user); -// String processInstanceId = processInstance.getProcessInstanceId(); -// // 恢复实例id -// purchaseOrder.setRestoreInstanceId(processInstanceId); -// // 存在提交完就流程结束的情况 -// boolean processIsFinish = processService.judgeProcessIsFinish(processInstanceId); -// if(processIsFinish){ -// // 审核状态-审核通过 -// purchaseOrder.setAuditStatus("1"); -// // 使用状态-是 -// purchaseOrder.setUseStatus("1"); -// } -// purchaseOrderMapper.updatePurchaseOrder(purchaseOrder); -// return processInstance; -// } private ProcessInstance startProcessInstance(String applyTitle, String instanceType, PurchaseOrder purchaseOrder, SysUser user) { Long materialId = purchaseOrder.getPurchaseOrderId(); String businessKey = materialId.toString(); // 实体类 ID,作为流程的业务 key @@ -632,15 +627,7 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService private void buildAuthority(SysUser user, Map variables) { Set roleKeys = roleService.selectRoleKeys(user.getUserId()); // 角色不同审核人不同 - if(roleKeys.contains("fzjlRole") || roleKeys.contains("admin")){ - variables.put("authority",4); - }else if(roleKeys.contains("cgzgRole")){ - variables.put("authority",3); - }else if(roleKeys.contains("cgjlRole")){ - variables.put("authority",2); - }else if(roleKeys.contains("cgyRole")){ - variables.put("authority",1); - } + } } diff --git a/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderMapper.xml b/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderMapper.xml index cf2bd08e..20c78c11 100644 --- a/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderMapper.xml @@ -3,7 +3,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + @@ -49,6 +49,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + + + + + + + @@ -60,28 +70,55 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" purchase_category, purchase_commander, customer_order_number, remark_content, close_case_no, close_case_name, close_case_time,confirm_no,confirm_time,confirm_name, del_flag, stock_no, stock_name, stock_address, stock_contact, stock_phone, - approve_time, standby_one, standby_two, - create_time, create_by, update_time, update_by from purchase_order + approve_time, standby_one, standby_two,create_time, create_by, update_time, update_by, + instance_id, instance_type, instance_type_name, submit_instance_id, cancel_instance_id, + restore_instance_id, apply_title, apply_user, apply_time + from purchase_order + + update sys_customer_quote set use_status = '1' sys_customer_quote where id in + + #{id} + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/purchase/purchaseOrder/add.html b/ruoyi-admin/src/main/resources/templates/purchase/purchaseOrder/add.html index 238f4ec0..bd65088b 100644 --- a/ruoyi-admin/src/main/resources/templates/purchase/purchaseOrder/add.html +++ b/ruoyi-admin/src/main/resources/templates/purchase/purchaseOrder/add.html @@ -170,22 +170,6 @@ - - diff --git a/ruoyi-admin/src/main/resources/templates/purchase/purchaseOrder/edit.html b/ruoyi-admin/src/main/resources/templates/purchase/purchaseOrder/edit.html index 548cc9a6..db333fe3 100644 --- a/ruoyi-admin/src/main/resources/templates/purchase/purchaseOrder/edit.html +++ b/ruoyi-admin/src/main/resources/templates/purchase/purchaseOrder/edit.html @@ -55,142 +55,37 @@ -
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
-
- - +
+ +
+
-
-
- -
- -
-
-
- -
- - -
-
-
- -
- - -
-
-
- -
- -
-
-
- -
- -
-
-