Browse Source

[feat]

仓库管理 库存盘点
修改库存盘点列表页面表格定义,添加审批相关字段,设置列居中,设置行样式;
新增作废恢复等审批相关按钮,合并操作列按钮;
新增库存盘点实体类审批相关属性;
新增库存盘点controller加载审批弹窗、绑定页面字段、完成任务方法;
新增库存盘点修改审批信息、启动审批流程、创建提交、作废、恢复流程,设置发起人变量service方法;
新增库存盘点mapper审批相关字段;
新增库存盘点仓库主管、副总经理审批页面,新增驳回调整、作废页面;
新增库存盘点vo实体类;
dev
王晓迪 1 month ago
parent
commit
6f0f60e997
  1. 151
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseInventoryCheckController.java
  2. 34
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/domain/VO/WarehouseInventoryCheckVO.java
  3. 126
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/domain/WarehouseInventoryCheck.java
  4. 6
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/mapper/WarehouseInventoryCheckMapper.java
  5. 20
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseInventoryCheckService.java
  6. 254
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseInventoryCheckServiceImpl.java
  7. 55
      ruoyi-admin/src/main/resources/mapper/warehouse/WarehouseInventoryCheckMapper.xml
  8. 32
      ruoyi-admin/src/main/resources/templates/warehouse/inventoryCheck/cancel.html
  9. 117
      ruoyi-admin/src/main/resources/templates/warehouse/inventoryCheck/inventoryCheck.html
  10. 178
      ruoyi-admin/src/main/resources/templates/warehouse/inventoryCheck/taskCkzgVerify.html
  11. 178
      ruoyi-admin/src/main/resources/templates/warehouse/inventoryCheck/taskFzjlVerify.html
  12. 263
      ruoyi-admin/src/main/resources/templates/warehouse/inventoryCheck/taskModifyApply.html

151
ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseInventoryCheckController.java

@ -1,12 +1,25 @@
package com.ruoyi.warehouse.controller;
import java.util.HashMap;
import java.util.List;
import com.alibaba.fastjson.JSON;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.process.general.service.IProcessService;
import com.ruoyi.system.domain.BaseEvectionForm;
import com.ruoyi.system.domain.SysSalesOrderChild;
import com.ruoyi.system.domain.Vo.OutsourceQuoteVO;
import com.ruoyi.warehouse.domain.VO.WarehouseInventoryCheckVO;
import com.ruoyi.warehouse.domain.VO.WarehouseMaterialVO;
import com.ruoyi.warehouse.domain.WarehouseInventoryCheckDetail;
import com.ruoyi.warehouse.domain.WarehouseInventoryReportDamageChild;
import com.ruoyi.warehouse.mapper.WarehouseInventoryCheckDetailMapper;
import com.ruoyi.warehouse.service.IWarehouseInventoryCheckDetailService;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.TaskService;
import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.task.Task;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
@ -22,6 +35,9 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
/**
* 仓库库存盘点Controller
*
@ -43,6 +59,15 @@ public class WarehouseInventoryCheckController extends BaseController
@Autowired
private WarehouseInventoryCheckDetailMapper checkDetailMapper;
@Autowired
private TaskService taskService;
@Autowired
private RuntimeService runtimeService;
@Autowired
private IProcessService processService;
@RequiresPermissions("warehouse:inventoryCheck:view")
@GetMapping()
public String inventoryCheck()
@ -59,7 +84,7 @@ public class WarehouseInventoryCheckController extends BaseController
public TableDataInfo list(WarehouseInventoryCheck warehouseInventoryCheck)
{
startPage();
List<WarehouseInventoryCheck> list = warehouseInventoryCheckService.selectWarehouseInventoryCheckList(warehouseInventoryCheck);
List<WarehouseInventoryCheckVO> list = warehouseInventoryCheckService.selectWarehouseInventoryCheckList(warehouseInventoryCheck);
return getDataTable(list);
}
@ -76,7 +101,7 @@ public class WarehouseInventoryCheckController extends BaseController
WarehouseInventoryCheckDetail checkDetail = new WarehouseInventoryCheckDetail();
List<WarehouseInventoryCheckDetail> list = checkDetailService.selectWarehouseInventoryCheckDetailList(checkDetail);
ExcelUtil<WarehouseInventoryCheckDetail> util = new ExcelUtil<WarehouseInventoryCheckDetail>(WarehouseInventoryCheckDetail.class);
return util.exportExcel(list, "仓库库存报损数据");
return util.exportExcel(list, "仓库库存盘点数据");
}else {
String[] checkCodes = ids.split(",");
List<WarehouseInventoryCheckDetail> list = checkDetailMapper.selectWarehouseInventoryCheckDetailByCodes(checkCodes);
@ -101,11 +126,98 @@ public class WarehouseInventoryCheckController extends BaseController
@Log(title = "仓库库存盘点", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(@RequestBody WarehouseInventoryCheck warehouseInventoryCheck)
public AjaxResult addSave(@RequestBody WarehouseInventoryCheckVO warehouseInventoryCheckVO)
{
return toAjax(warehouseInventoryCheckService.insertWarehouseInventoryCheck(warehouseInventoryCheck));
warehouseInventoryCheckVO.setAuditStatus("0");
warehouseInventoryCheckService.submitApply(warehouseInventoryCheckVO);
return AjaxResult.success();
// return toAjax(warehouseInventoryCheckService.insertWarehouseInventoryCheck(warehouseInventoryCheck));
}
/**
* 加载审批弹窗
* @param taskId
* @param mmap
* @return
*/
@GetMapping("/showVerifyDialog/{taskId}")
public String showVerifyDialog(@PathVariable("taskId") String taskId, ModelMap mmap) {
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
String processInstanceId = task.getProcessInstanceId();
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
WarehouseInventoryCheckVO warehouseInventoryCheckVO = warehouseInventoryCheckService.selectWarehouseInventoryCheckById(new Long(processInstance.getBusinessKey()));
mmap.put("formData", warehouseInventoryCheckVO);
mmap.put("taskId", taskId);
String verifyName = task.getTaskDefinitionKey().substring(0, 1).toUpperCase() + task.getTaskDefinitionKey().substring(1);
return prefix + "/task" + verifyName;
}
/**
* 自动绑定页面字段
*/
@ModelAttribute("preloadObj")
public WarehouseInventoryCheckVO getObj(@RequestParam(value = "inventoryCheckId", required = false) Long inventoryCheckId, HttpSession session) {
if (inventoryCheckId != null) {
return warehouseInventoryCheckService.selectWarehouseInventoryCheckById(inventoryCheckId);
}
return new WarehouseInventoryCheckVO();
}
/**
* 完成任务
*
* @return
*/
@RequestMapping(value = "/complete/{taskId}", method = {RequestMethod.POST, RequestMethod.GET})
@ResponseBody
public AjaxResult complete(@PathVariable("taskId") String taskId, @RequestParam(value = "saveEntity", required = false) String saveEntity,
@RequestParam(value = "inventoryCheckDetailList", required = false) String inventoryCheckDetailList,
@ModelAttribute("preloadObj") WarehouseInventoryCheckVO inventoryCheckVO, HttpServletRequest request) {
inventoryCheckVO.setInventoryCheckDetails(JSON.parseArray(inventoryCheckDetailList,WarehouseInventoryCheckDetail.class));
boolean saveEntityBoolean = BooleanUtils.toBoolean(saveEntity);
//获取实例id
String instanceId = inventoryCheckVO.getInstanceId();
//获取实例类型
String instanceType = inventoryCheckVO.getInstanceType();
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
String verifyName = task.getTaskDefinitionKey().substring(0, 1).toUpperCase() + task.getTaskDefinitionKey().substring(1);
if(verifyName.equals("ModifyApply")){
//驳回调整,设置为待审核
inventoryCheckVO.setAuditStatus("0");
inventoryCheckVO.setApplyTime(DateUtils.getNowDate());
}
boolean approvedFlag = processService.complete(taskId, instanceId, inventoryCheckVO.getApplyTitle(), inventoryCheckVO.getInventoryCheckCode(),
"inventoryCheck", new HashMap<String, Object>(), request);
if(!approvedFlag){
// 审核状态-审核拒绝
inventoryCheckVO.setAuditStatus("2");
}
// 如果任务已结束更新业务表状态
boolean processIsFinish = processService.judgeProcessIsFinish(instanceId);
if (processIsFinish) {
// 审核通过
inventoryCheckVO.setAuditStatus("1");
// 提交
if("submit".equals(instanceType)){
// 使用状态-是
inventoryCheckVO.setUseStatus("1");
}
// 作废
else if("cancel".equals(instanceType)){
// 使用状态-已作废
inventoryCheckVO.setUseStatus("2");
}
// 恢复
else if("restore".equals(instanceType)){
// 使用状态-是
inventoryCheckVO.setUseStatus("1");
}
}
warehouseInventoryCheckService.updateVerify(inventoryCheckVO);
// 驳回申请后继续申请,可能修改表单
if (saveEntityBoolean) {
warehouseInventoryCheckService.updateWarehouseInventoryCheck(inventoryCheckVO);
}
return success("任务已完成");
}
/**
* 修改仓库库存盘点
*/
@ -190,5 +302,36 @@ public class WarehouseInventoryCheckController extends BaseController
return getDataTable(list);
}
/**
* 加载作废库存盘点信息弹窗
*/
@GetMapping("/cancel/{id}")
public String cancel(@PathVariable("id") Long id, ModelMap mmap) {
WarehouseInventoryCheckVO warehouseInventoryCheckVO = warehouseInventoryCheckService.selectWarehouseInventoryCheckById(id);
mmap.put("inventoryCheck", warehouseInventoryCheckVO);
return prefix + "/cancel";
}
/**
* 作废库存盘点
*/
@RequiresPermissions("warehouse:inventoryCheck:cancel")
@Log(title = "库存盘点", businessType = BusinessType.CANCEL)
@PostMapping( "/cancel")
@ResponseBody
public AjaxResult cancel(WarehouseInventoryCheckVO inventoryCheckVO){
return toAjax(warehouseInventoryCheckService.cancelWarehouseInventoryCheckVOByObject(inventoryCheckVO));
}
/**
* 恢复库存盘点
*/
@RequiresPermissions("warehouse:inventoryCheck:restore")
@Log(title = "库存盘点", businessType = BusinessType.RESTORE)
@GetMapping( "/restore/{id}")
@ResponseBody
public AjaxResult restore(@PathVariable("id")Long id)
{
return toAjax(warehouseInventoryCheckService.restoreWarehouseInventoryCheckVOById(id));
}
}

34
ruoyi-admin/src/main/java/com/ruoyi/warehouse/domain/VO/WarehouseInventoryCheckVO.java

@ -0,0 +1,34 @@
package com.ruoyi.warehouse.domain.VO;
import com.ruoyi.warehouse.domain.WarehouseInventoryCheck;
import lombok.Data;
import java.util.Date;
@Data
public class WarehouseInventoryCheckVO extends WarehouseInventoryCheck {
/** 申请人姓名 */
private String applyUserName;
/** 任务ID */
private String taskId;
/** 任务名称 */
private String taskName;
/** 当前状态 */
private String taskStatus;
/** 办理时间 */
private Date doneTime;
/** 创建人 */
private String createUserName;
/** 流程实例状态 1 激活 2 挂起 */
private String suspendState;
/** 待办用户id */
private String todoUserId;
/** 流程实例类型名称 */
private String instanceTypeName;
/**
* 关键词
*/
private String keyword;
}

126
ruoyi-admin/src/main/java/com/ruoyi/warehouse/domain/WarehouseInventoryCheck.java

@ -61,6 +61,43 @@ public class WarehouseInventoryCheck extends BaseEntity
private List<WarehouseInventoryCheckDetail> inventoryCheckDetails;
/** 审核状态 */
@Excel(name = "审核状态",dictType = "auditStatus")
private String auditStatus;
/** 使用状态 */
private String useStatus;
/** 流程实例ID */
private String instanceId;
/** 流程实例类型 */
private String instanceType;
/** 流程提交实例ID */
private String submitInstanceId;
/** 申请标题 */
private String applyTitle;
/** 申请时间 */
// @Excel(name = "申请时间",dateFormat = "yyyy-MM-dd HH:mm:ss",sort = 7)
// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date applyTime;
/** 申请人 */
// @Excel(name = "申请人",sort = 6)
private String applyUser;
/** 流程作废实例ID */
private String cancelInstanceId;
/** 流程恢复实例ID */
private String restoreInstanceId;
//作废理由
private String cancelRemark;
public void setInventoryCheckId(Long inventoryCheckId)
{
this.inventoryCheckId = inventoryCheckId;
@ -152,6 +189,95 @@ public class WarehouseInventoryCheck extends BaseEntity
return numTotal;
}
public String getAuditStatus() {
return auditStatus;
}
public void setAuditStatus(String auditStatus) {
this.auditStatus = auditStatus;
}
public String getUseStatus() {
return useStatus;
}
public void setUseStatus(String useStatus) {
this.useStatus = useStatus;
}
public String getInstanceId() {
return instanceId;
}
public void setInstanceId(String instanceId) {
this.instanceId = instanceId;
}
public String getInstanceType() {
return instanceType;
}
public void setInstanceType(String instanceType) {
this.instanceType = instanceType;
}
public String getSubmitInstanceId() {
return submitInstanceId;
}
public void setSubmitInstanceId(String submitInstanceId) {
this.submitInstanceId = submitInstanceId;
}
public String getApplyTitle() {
return applyTitle;
}
public void setApplyTitle(String applyTitle) {
this.applyTitle = applyTitle;
}
public Date getApplyTime() {
return applyTime;
}
public void setApplyTime(Date applyTime) {
this.applyTime = applyTime;
}
public String getApplyUser() {
return applyUser;
}
public void setApplyUser(String applyUser) {
this.applyUser = applyUser;
}
public String getCancelInstanceId() {
return cancelInstanceId;
}
public void setCancelInstanceId(String cancelInstanceId) {
this.cancelInstanceId = cancelInstanceId;
}
public String getRestoreInstanceId() {
return restoreInstanceId;
}
public void setRestoreInstanceId(String restoreInstanceId) {
this.restoreInstanceId = restoreInstanceId;
}
@Override
public String getCancelRemark() {
return cancelRemark;
}
@Override
public void setCancelRemark(String cancelRemark) {
this.cancelRemark = cancelRemark;
}
public List<WarehouseInventoryCheckDetail> getInventoryCheckDetails() {
return inventoryCheckDetails;

6
ruoyi-admin/src/main/java/com/ruoyi/warehouse/mapper/WarehouseInventoryCheckMapper.java

@ -1,6 +1,8 @@
package com.ruoyi.warehouse.mapper;
import java.util.List;
import com.ruoyi.warehouse.domain.VO.WarehouseInventoryCheckVO;
import com.ruoyi.warehouse.domain.WarehouseInventoryCheck;
import org.apache.ibatis.annotations.Param;
@ -18,7 +20,7 @@ public interface WarehouseInventoryCheckMapper
* @param inventoryCheckId 仓库库存盘点ID
* @return 仓库库存盘点
*/
public WarehouseInventoryCheck selectWarehouseInventoryCheckById(Long inventoryCheckId);
public WarehouseInventoryCheckVO selectWarehouseInventoryCheckById(Long inventoryCheckId);
/**
* 查询仓库库存盘点列表
@ -26,7 +28,7 @@ public interface WarehouseInventoryCheckMapper
* @param warehouseInventoryCheck 仓库库存盘点
* @return 仓库库存盘点集合
*/
public List<WarehouseInventoryCheck> selectWarehouseInventoryCheckList(WarehouseInventoryCheck warehouseInventoryCheck);
public List<WarehouseInventoryCheckVO> selectWarehouseInventoryCheckList(WarehouseInventoryCheck warehouseInventoryCheck);
/**
* 新增仓库库存盘点

20
ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseInventoryCheckService.java

@ -1,9 +1,13 @@
package com.ruoyi.warehouse.service;
import java.util.List;
import com.ruoyi.warehouse.domain.VO.WarehouseInventoryCheckVO;
import com.ruoyi.warehouse.domain.WarehouseInventoryCheck;
import com.ruoyi.warehouse.domain.VO.WarehouseMaterialVO;
import com.ruoyi.warehouse.domain.WarehouseInventoryCheckDetail;
import org.activiti.engine.runtime.ProcessInstance;
import org.springframework.transaction.annotation.Transactional;
/**
* 仓库库存盘点Service接口
@ -19,7 +23,7 @@ public interface IWarehouseInventoryCheckService
* @param inventoryCheckId 仓库库存盘点ID
* @return 仓库库存盘点
*/
public WarehouseInventoryCheck selectWarehouseInventoryCheckById(Long inventoryCheckId);
public WarehouseInventoryCheckVO selectWarehouseInventoryCheckById(Long inventoryCheckId);
/**
* 查询仓库库存盘点列表
@ -27,7 +31,7 @@ public interface IWarehouseInventoryCheckService
* @param warehouseInventoryCheck 仓库库存盘点
* @return 仓库库存盘点集合
*/
public List<WarehouseInventoryCheck> selectWarehouseInventoryCheckList(WarehouseInventoryCheck warehouseInventoryCheck);
public List<WarehouseInventoryCheckVO> selectWarehouseInventoryCheckList(WarehouseInventoryCheck warehouseInventoryCheck);
/**
* 新增仓库库存盘点
@ -46,6 +50,18 @@ public interface IWarehouseInventoryCheckService
public int updateWarehouseInventoryCheck(WarehouseInventoryCheck warehouseInventoryCheck);
//修改审批后信息
@Transactional
int updateVerify(WarehouseInventoryCheckVO inventoryCheckVO);
@Transactional(rollbackFor = Exception.class)
ProcessInstance submitApply(WarehouseInventoryCheckVO inventoryCheckVO);
int cancelWarehouseInventoryCheckVOByObject(WarehouseInventoryCheckVO warehouseInventoryCheckVO);
@Transactional(rollbackFor = Exception.class)
int restoreWarehouseInventoryCheckVOById(Long inventoryCheckId);
/**
* 查找与库存查询有关的物料信息
* */

254
ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseInventoryCheckServiceImpl.java

@ -2,21 +2,32 @@ package com.ruoyi.warehouse.service.impl;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.*;
import com.github.pagehelper.Page;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.page.PageDomain;
import com.ruoyi.common.core.page.TableSupport;
import com.ruoyi.common.exception.BusinessException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.erp.domain.ErpMaterialVo;
import com.ruoyi.erp.mapper.ErpMaterialMapper;
import com.ruoyi.process.general.service.IProcessService;
import com.ruoyi.process.todoitem.mapper.BizTodoItemMapper;
import com.ruoyi.system.mapper.SysUserMapper;
import com.ruoyi.system.service.impl.SysRoleServiceImpl;
import com.ruoyi.warehouse.domain.VO.WarehouseInventoryCheckVO;
import com.ruoyi.warehouse.domain.VO.WarehouseMaterialVO;
import com.ruoyi.warehouse.domain.WarehouseInventoryCheckDetail;
import com.ruoyi.warehouse.mapper.WarehouseInventoryCheckDetailMapper;
import lombok.extern.slf4j.Slf4j;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.TaskService;
import org.activiti.engine.impl.persistence.entity.TaskEntityImpl;
import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.task.Task;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.warehouse.mapper.WarehouseInventoryCheckMapper;
@ -43,6 +54,23 @@ public class WarehouseInventoryCheckServiceImpl implements IWarehouseInventoryCh
@Autowired
private WarehouseInventoryCheckDetailMapper inventoryCheckDetailMapper;
@Autowired
private SysRoleServiceImpl roleService;
@Autowired
private TaskService taskService;
@Autowired
private RuntimeService runtimeService;
@Autowired
private BizTodoItemMapper todoItemMapper;
@Autowired
private SysUserMapper userMapper;
@Autowired
private IProcessService processService;
/**
* 查询仓库库存盘点
*
@ -50,9 +78,14 @@ public class WarehouseInventoryCheckServiceImpl implements IWarehouseInventoryCh
* @return 仓库库存盘点
*/
@Override
public WarehouseInventoryCheck selectWarehouseInventoryCheckById(Long inventoryCheckId)
public WarehouseInventoryCheckVO selectWarehouseInventoryCheckById(Long inventoryCheckId)
{
return warehouseInventoryCheckMapper.selectWarehouseInventoryCheckById(inventoryCheckId);
WarehouseInventoryCheckVO inventoryCheckVO = warehouseInventoryCheckMapper.selectWarehouseInventoryCheckById(inventoryCheckId);
SysUser sysUser = userMapper.selectUserByLoginName(inventoryCheckVO.getApplyUser());
if (sysUser != null) {
inventoryCheckVO.setApplyUserName(sysUser.getUserName());
}
return inventoryCheckVO;
}
/**
@ -62,9 +95,68 @@ public class WarehouseInventoryCheckServiceImpl implements IWarehouseInventoryCh
* @return 仓库库存盘点
*/
@Override
public List<WarehouseInventoryCheck> selectWarehouseInventoryCheckList(WarehouseInventoryCheck warehouseInventoryCheck)
public List<WarehouseInventoryCheckVO> selectWarehouseInventoryCheckList(WarehouseInventoryCheck warehouseInventoryCheck)
{
return warehouseInventoryCheckMapper.selectWarehouseInventoryCheckList(warehouseInventoryCheck);
PageDomain pageDomain = TableSupport.buildPageRequest();
Integer pageNum = pageDomain.getPageNum();
Integer pageSize = pageDomain.getPageSize();
// PageHelper 仅对第一个 List 分页
Page<WarehouseInventoryCheckVO> list = (Page<WarehouseInventoryCheckVO>) warehouseInventoryCheckMapper.selectWarehouseInventoryCheckList(warehouseInventoryCheck);
Page<WarehouseInventoryCheckVO> returnList = new Page<>();
for (WarehouseInventoryCheckVO inventoryCheckVO: list) {
SysUser sysUser = userMapper.selectUserByLoginName(inventoryCheckVO.getCreateBy());
if (sysUser != null) {
inventoryCheckVO.setCreateUserName(sysUser.getUserName());
}
SysUser sysUser2 = userMapper.selectUserByLoginName(inventoryCheckVO.getApplyUser());
if (sysUser2 != null) {
inventoryCheckVO.setApplyUserName(sysUser2.getUserName());
}
String instanceId = inventoryCheckVO.getInstanceId();
// 当前环节
if (StringUtils.isNotBlank(instanceId)) {
List<Task> taskList = taskService.createTaskQuery()
.processInstanceId(instanceId)
// .singleResult();
.list(); // 例如请假会签,会同时拥有多个任务
if (!org.springframework.util.CollectionUtils.isEmpty(taskList)) {
TaskEntityImpl task = (TaskEntityImpl) taskList.get(0);
String taskId = task.getId();
inventoryCheckVO.setTaskId(taskId);
// 设置待办用户
List<String> todoUserList = todoItemMapper.selectUndealTodoUserList(taskId);
if(!org.springframework.util.CollectionUtils.isEmpty(taskList)){
inventoryCheckVO.setTodoUserId(String.join(",",todoUserList));
}
if (task.getSuspensionState() == 2) {
inventoryCheckVO.setTaskName("已挂起");
inventoryCheckVO.setSuspendState("2");
} else {
inventoryCheckVO.setTaskName(task.getName());
inventoryCheckVO.setSuspendState("1");
}
} else {
// 已办结或者已撤销
inventoryCheckVO.setTaskName("已结束");
}
} else {
inventoryCheckVO.setTaskName("未启动");
}
inventoryCheckVO.setTaskStatus(inventoryCheckVO.getTaskName());
if(inventoryCheckVO.getAuditStatus()==null){
inventoryCheckVO.setTaskStatus("未启动");
}else if(inventoryCheckVO.getAuditStatus().equals("1")){
inventoryCheckVO.setTaskStatus("审核通过");
}else if(inventoryCheckVO.getAuditStatus().equals("2")){
inventoryCheckVO.setTaskStatus("审核拒绝");
}
returnList.add(inventoryCheckVO);
}
returnList.setTotal(org.springframework.util.CollectionUtils.isEmpty(list) ? 0 : list.getTotal());
returnList.setPageNum(pageNum);
returnList.setPageSize(pageSize);
return returnList;
}
/**
@ -126,7 +218,7 @@ public class WarehouseInventoryCheckServiceImpl implements IWarehouseInventoryCh
* @param warehouseInventoryCheck 仓库库存盘点
* @return 结果
*/
@Transactional
@Transactional(rollbackFor = Exception.class)
@Override
public int updateWarehouseInventoryCheck(WarehouseInventoryCheck warehouseInventoryCheck)
{
@ -138,7 +230,7 @@ public class WarehouseInventoryCheckServiceImpl implements IWarehouseInventoryCh
List<WarehouseInventoryCheckDetail> inventoryCheckDetails = warehouseInventoryCheck.getInventoryCheckDetails();
if (StringUtils.isEmpty(inventoryCheckDetails)){
log.warn("仓库盘点物料相关信息为空:{}",inventoryCheckDetails);
throw new BusinessException("仓库盘点物料相关信息为空!");
}else{
inventoryCheckDetailMapper.deleteWarehouseInventoryCheckDetailByCode(warehouseInventoryCheck.getInventoryCheckCode());
warehouseInventoryCheck.setMaterialTotal(inventoryCheckDetails.size());
@ -167,7 +259,149 @@ public class WarehouseInventoryCheckServiceImpl implements IWarehouseInventoryCh
warehouseInventoryCheck.setNumTotal(numTotal);
return warehouseInventoryCheckMapper.updateWarehouseInventoryCheck(warehouseInventoryCheck);
}
//修改审批后信息
@Transactional
@Override
public int updateVerify(WarehouseInventoryCheckVO inventoryCheckVO){
inventoryCheckVO.setUpdateBy(ShiroUtils.getLoginName());
inventoryCheckVO.setUpdateTime(DateUtils.getNowDate());
return warehouseInventoryCheckMapper.updateWarehouseInventoryCheck(inventoryCheckVO);
}
/**
* 审批流程启动
* */
@Transactional(rollbackFor = Exception.class)
@Override
public ProcessInstance submitApply(WarehouseInventoryCheckVO inventoryCheckVO) {
SysUser user = ShiroUtils.getSysUser();
inventoryCheckVO.setApplyUser(user.getLoginName());
inventoryCheckVO.setApplyTime(DateUtils.getNowDate());
// 保存
insertWarehouseInventoryCheck(inventoryCheckVO);
// 启动流程
String applyTitle = user.getUserName()+"发起了库存盘点提交审批-"+DateUtils.dateTimeNow();
String instanceType = "submit";
ProcessInstance processInstance = startProcessInstance(applyTitle,instanceType,inventoryCheckVO, user);
String processInstanceId = processInstance.getProcessInstanceId();
// 提交实例id
inventoryCheckVO.setSubmitInstanceId(processInstanceId);
// 存在提交完就流程结束的情况
boolean processIsFinish = processService.judgeProcessIsFinish(processInstanceId);
if(processIsFinish){
// 审核状态-审核通过
inventoryCheckVO.setAuditStatus("1");
inventoryCheckVO.setUseStatus("1");
}
warehouseInventoryCheckMapper.updateWarehouseInventoryCheck(inventoryCheckVO);
return processInstance;
}
/**
* 创建库存盘点审核流程
* @param applyTitle
* @param instanceType
* @param user
* @return
*/
private ProcessInstance startProcessInstance(String applyTitle, String instanceType, WarehouseInventoryCheckVO inventoryCheckVO, SysUser user) {
Long inventoryCheckId = inventoryCheckVO.getInventoryCheckId();
String businessKey = inventoryCheckId.toString(); // 实体类 ID,作为流程的业务 key
String key = "inventoryCheck";
Map<String,Object> variables = new HashMap<>();
// 构造authority传参
buildAuthority(user, variables);
inventoryCheckVO.setApplyTitle(applyTitle);
// 启动流程
ProcessInstance processInstance = processService.submitApply(user.getLoginName(), businessKey, applyTitle, inventoryCheckVO.getInventoryCheckCode(), key, variables);
String processInstanceId = processInstance.getId();
inventoryCheckVO.setInstanceId(processInstanceId); // 建立双向关系
inventoryCheckVO.setInstanceType(instanceType);
return processInstance;
}
/**
* 发起人节点判断
* */
private void buildAuthority(SysUser user, Map<String, Object> variables) {
Set<String> roleKeys = roleService.selectRoleKeys(user.getUserId());
// 角色不同审核人不同
if(roleKeys.contains("cgyyRole")){
variables.put("authority",1);
}else if(roleKeys.contains("ckzgRole")){
variables.put("authority",2);
}else if(roleKeys.contains("fzjlRole")||roleKeys.contains("admin")||roleKeys.contains("zjlRole")){
variables.put("authority",3);
}
}
/**
* 作废库存盘点
*
* @param warehouseInventoryCheckVO 库存盘点
* @return 结果
*/
@Transactional(rollbackFor = Exception.class)
@Override
public int cancelWarehouseInventoryCheckVOByObject(WarehouseInventoryCheckVO warehouseInventoryCheckVO)
{
WarehouseInventoryCheckVO inventoryCheckVO = warehouseInventoryCheckMapper.selectWarehouseInventoryCheckById(warehouseInventoryCheckVO.getInventoryCheckId());
// 审核状态-待审核
inventoryCheckVO.setAuditStatus("0");
SysUser user = ShiroUtils.getSysUser();
// 启动流程
String applyTitle = user.getUserName()+"发起了库存盘点作废审批-"+DateUtils.dateTimeNow();
String instanceType = "cancel";
ProcessInstance processInstance = startProcessInstance(applyTitle,instanceType,inventoryCheckVO, user);
String processInstanceId = processInstance.getProcessInstanceId();
// 作废实例id
inventoryCheckVO.setCancelInstanceId(processInstanceId);
// 存在提交完就流程结束的情况
boolean processIsFinish = processService.judgeProcessIsFinish(processInstanceId);
if(processIsFinish){
// 审核状态-审核通过
inventoryCheckVO.setAuditStatus("1");
// 使用状态-已作废
inventoryCheckVO.setUseStatus("2");
}
inventoryCheckVO.setCancelRemark(warehouseInventoryCheckVO.getCancelRemark());
return warehouseInventoryCheckMapper.updateWarehouseInventoryCheck(inventoryCheckVO);
}
/**
* 恢复库存盘点信息
*
* @param inventoryCheckId 库存盘点ID
* @return 结果
*/
@Transactional(rollbackFor = Exception.class)
@Override
public int restoreWarehouseInventoryCheckVOById(Long inventoryCheckId)
{
WarehouseInventoryCheckVO inventoryCheckVO = warehouseInventoryCheckMapper.selectWarehouseInventoryCheckById(inventoryCheckId);
// 审核状态-待审核
inventoryCheckVO.setAuditStatus("0");
SysUser user = ShiroUtils.getSysUser();
// 启动流程
String applyTitle = user.getUserName()+"发起了库存盘点恢复审批-"+DateUtils.dateTimeNow();
String instanceType = "restore";
ProcessInstance processInstance = startProcessInstance(applyTitle,instanceType,inventoryCheckVO, user);
String processInstanceId = processInstance.getProcessInstanceId();
// 恢复实例id
inventoryCheckVO.setRestoreInstanceId(processInstanceId);
// 存在提交完就流程结束的情况
boolean processIsFinish = processService.judgeProcessIsFinish(processInstanceId);
if(processIsFinish){
// 审核状态-审核通过
inventoryCheckVO.setAuditStatus("1");
// 使用状态-是
inventoryCheckVO.setUseStatus("1");
}
return warehouseInventoryCheckMapper.updateWarehouseInventoryCheck(inventoryCheckVO);
}
/**
* 查找与库存查询有关的物料信息
* */

55
ruoyi-admin/src/main/resources/mapper/warehouse/WarehouseInventoryCheckMapper.xml

@ -4,7 +4,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.warehouse.mapper.WarehouseInventoryCheckMapper">
<resultMap type="WarehouseInventoryCheck" id="WarehouseInventoryCheckResult">
<resultMap type="WarehouseInventoryCheckVO" id="WarehouseInventoryCheckResult">
<result property="inventoryCheckId" column="inventory_check_id" />
<result property="inventoryCheckCode" column="inventory_check_code" />
<result property="inventoryCheckName" column="inventory_check_name" />
@ -20,10 +20,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="createBy" column="create_by" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="auditStatus" column="audit_status" />
<result property="useStatus" column="use_status" />
<result property="instanceId" column="instance_id" />
<result property="instanceType" column="instance_type" />
<result property="submitInstanceId" column="submit_instance_id" />
<result property="applyTitle" column="apply_title" />
<result property="applyTime" column="apply_time" />
<result property="applyUser" column="apply_user" />
<result property="cancelInstanceId" column="cancel_instance_id" />
<result property="restoreInstanceId" column="restore_instance_id" />
<result property="cancelRemark" column="cancel_remark" />
</resultMap>
<sql id="selectWarehouseInventoryCheckVo">
select inventory_check_id, inventory_check_code, inventory_check_name, material_no, material_name, warehouse_code, warehouse_name, inventory_check_date, material_total, num_total, remark, create_time, create_by, update_by, update_time from warehouse_inventory_check
select inventory_check_id, inventory_check_code, inventory_check_name,
material_no, material_name, warehouse_code, warehouse_name,
inventory_check_date, material_total, num_total, remark,
create_time, create_by, update_by, update_time,audit_status,
use_status,instance_id,instance_type,submit_instance_id,
apply_title,apply_time,apply_user,cancel_instance_id,
restore_instance_id,cancel_remark from warehouse_inventory_check
</sql>
<select id="selectWarehouseInventoryCheckList" parameterType="WarehouseInventoryCheck" resultMap="WarehouseInventoryCheckResult">
@ -42,6 +59,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="warehouseName != null and warehouseName != ''"> and warehouse_name like concat('%', #{warehouseName}, '%')</if>
<if test="params.beginInventoryCheckDate != null and params.beginInventoryCheckDate != '' and params.endInventoryCheckDate != null and params.endInventoryCheckDate != ''"> and inventory_check_date between #{params.beginInventoryCheckDate} and #{params.endInventoryCheckDate}</if>
</where>
order by audit_status asc, create_time desc
</select>
<select id="selectWarehouseInventoryCheckById" parameterType="Long" resultMap="WarehouseInventoryCheckResult">
@ -66,6 +84,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createBy != null">create_by,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="auditStatus != null">audit_status,</if>
<if test="useStatus != null">use_status,</if>
<if test="instanceId != null">instance_id,</if>
<if test="instanceType != null">instance_type,</if>
<if test="submitInstanceId != null">submit_instance_id,</if>
<if test="applyTitle != null">apply_title,</if>
<if test="applyTime != null">apply_time,</if>
<if test="applyUser != null">apply_user,</if>
<if test="cancelInstanceId != null">cancel_instance_id,</if>
<if test="restoreInstanceId != null">restore_instance_id,</if>
<if test="cancelRemark != null">cancel_remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="inventoryCheckCode != null">#{inventoryCheckCode},</if>
@ -82,6 +111,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createBy != null">#{createBy},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="auditStatus != null">#{auditStatus},</if>
<if test="useStatus != null">#{useStatus},</if>
<if test="instanceId != null">#{instanceId},</if>
<if test="instanceType != null">#{instanceType},</if>
<if test="submitInstanceId != null">#{submitInstanceId},</if>
<if test="applyTitle != null">#{applyTitle},</if>
<if test="applyTime != null">#{applyTime},</if>
<if test="applyUser != null">#{applyUser},</if>
<if test="cancelInstanceId != null">#{cancelInstanceId},</if>
<if test="restoreInstanceId != null">#{restoreInstanceId},</if>
<if test="cancelRemark != null">#{cancelRemark},</if>
</trim>
</insert>
@ -102,6 +142,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="auditStatus != null">audit_status = #{auditStatus},</if>
<if test="useStatus != null">use_status = #{useStatus},</if>
<if test="instanceId != null">instance_id = #{instanceId},</if>
<if test="instanceType != null">instance_type = #{instanceType},</if>
<if test="submitInstanceId != null">submit_instance_id = #{submitInstanceId},</if>
<if test="applyTitle != null">apply_title = #{applyTitle},</if>
<if test="applyTime != null">apply_time = #{applyTime},</if>
<if test="applyUser != null">apply_user = #{applyUser},</if>
<if test="cancelInstanceId != null">cancel_instance_id = #{cancelInstanceId},</if>
<if test="restoreInstanceId != null">restore_instance_id = #{restoreInstanceId},</if>
<if test="cancelRemark != null">cancel_remark = #{cancelRemark},</if>
</trim>
where inventory_check_id = #{inventoryCheckId}
</update>

32
ruoyi-admin/src/main/resources/templates/warehouse/inventoryCheck/cancel.html

@ -0,0 +1,32 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('作废')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal" id="form-inventoryCheck-cancel" th:object="${inventoryCheck}">
<input name="id" th:field="*{inventoryCheckId}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label is-required">作废理由:</label>
<div class="col-sm-8">
<textarea name="cancelRemark" th:field="*{cancelRemark}" class="form-control" required></textarea>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var prefix = ctx + "warehouse/inventoryCheck";
$("#form-inventoryCheck-cancel").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/cancel", $('#form-inventoryCheck-cancel').serialize());
}
}
</script>
</body>
</html>

117
ruoyi-admin/src/main/resources/templates/warehouse/inventoryCheck/inventoryCheck.html

@ -49,7 +49,7 @@
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="warehouse:inventoryCheck:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-warning" onclick="exportExcel()" shiro:hasPermission="warehouse:inventoryCheck:export">
<a class="btn btn-success" onclick="exportExcel()" shiro:hasPermission="warehouse:inventoryCheck:export">
<i class="fa fa-download"></i> 导出
</a>
</div>
@ -59,10 +59,15 @@
</div>
</div>
<th:block th:include="include :: footer" />
<script th:src="@{/js/activiti.js}"></script>
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('warehouse:inventoryCheck:edit')}]];
var detailFlag = [[${@permission.hasPermi('warehouse:inventoryCheck:detail')}]];
var cancelFlag = [[${@permission.hasPermi('warehouse:inventoryCheck:cancel')}]];
var restoreFlag = [[${@permission.hasPermi('warehouse:inventoryCheck:restore')}]];
var loginName = [[${@permission.getPrincipalProperty('loginName')}]];
var auditStatusData = [[${@dict.getType('auditStatus')}]];
var useStatusDatas = [[${@dict.getType('useStatus')}]];
var prefix = ctx + "warehouse/inventoryCheck";
@ -72,6 +77,7 @@
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
exportUrl: prefix + "/export",
restoreUrl: prefix + "/restore/{id}",
modalName: "仓库库存盘点",
columns: [{
checkbox: true
@ -81,66 +87,156 @@
field: 'inventoryCheckId',
visible: false
},
{title: '当前状态',field: 'taskStatus',
align: 'center',
formatter: function(value, row, index) {
if(value == "未启动"|| value == "审核拒绝"){
return '<span class="badge badge-danger">' + value + '</span>';
}
return '<span class="badge badge-primary">' + value + '</span>';
}
},
{title: '流程实例ID',field: 'instanceId',visible: false,align: 'center',},
{title: '流程提交实例ID',field: 'submitInstanceId',visible: false,align: 'center',},
{title: '流程作废实例ID',field: 'cancelInstanceId',visible: false,align: 'center',},
{title: '流程恢复实例ID',field: 'restoreInstanceId', visible: false,align: 'center',},
{title: '流程实例类型', field: 'instanceTypeName',visible: false,align: 'center',},
{title: '申请人',field: 'applyUserName', align: 'center',
// formatter: function(value, row, index) {return '<span style="color: red;">' + (value ? value : "-") + '</span>';}
},
{title: '申请时间',field: 'applyTime',width: 150,align: 'center',},
{title: '当前任务ID',field: 'taskId',visible: false,align: 'center',},
{title: '待办用户ID',field: 'todoUserId', visible: false,align: 'center',},
{title: '当前任务名称',field: 'taskName',
align: 'center',visible: false,
formatter: function(value, row, index) {
return '<span class="badge badge-primary">' + value + '</span>';
}
},
{
title: '使用状态',
field: 'useStatus',
align: 'center',
formatter: function(value, row, index) {
return $.table.selectDictLabel(useStatusDatas, value);
}
},
{
title: '审核状态',
field: 'auditStatus',
align: 'center',
visible: false,
formatter: function(value, row, index) {
return $.table.selectDictLabel(auditStatusData, value);
}
},
{
title: '库存盘点单号',
field: 'inventoryCheckCode',
align: 'center',
},
{
title: '库存盘点人名',
field: 'inventoryCheckName',
align: 'center',
visible: false,
},
{
title: '仓库号',
field: 'warehouseCode',
align: 'center',
},
{
title: '仓库名称',
field: 'warehouseName',
align: 'center',
},
{
title: '库存盘点日期',
field: 'inventoryCheckDate',
align: 'center',
},
{
title: '物料数合计',
field: 'materialTotal',
align: 'center',
},
{
title: '数量合计',
field: 'numTotal',
align: 'center',
},
{
title: '备注内容',
field: 'remark',
align: 'center',
},
{
title: '录入人',
field: 'createBy',
align: 'center',
visible: false,
},
{
title: '录入时间',
field: 'createTime',
width: 120,
align: 'center',
},
{
title: '更新人',
field: 'updateBy',
align: 'center',
},
{
title: '上次更新时间',
field: 'updateTime',
align: 'center',
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.inventoryCheckId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-success btn-xs ' + detailFlag + '" href="javascript:void(0)" onclick="detail(\'' + row.inventoryCheckId + '\')"><i class="fa fa-edit"></i>详情</a> ');
// actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.inventoryCheckId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
if(row.auditStatus == "1"&& row.useStatus == "1"){
// 作废
actions.push('<a class="' + cancelFlag + '" href="javascript:void(0)" onclick="cancel(\'' + row.inventoryCheckId + '\')"><i class="fa fa-remove"></i> 作废</a>');
}
// 已作废
if(row.useStatus=="2" && !row.restoreInstanceId){
// 恢复
actions.push('<a class="btn ' + restoreFlag + '" href="javascript:void(0)" onclick="$.operate.restore(\'' + row.inventoryCheckId + '\')"><i class="fa fa-window-restore"></i> 恢复</a> ');
}
return actions.join('');
// 有流程实例id
if (row.instanceId) {
// 有待办人展示审批按钮,
if (row.todoUserId) {
var todoUserIdList = row.todoUserId.split(",");
if(todoUserIdList.includes(loginName)){
var nodeName = row.taskName=='驳回调整'?' 调整申请':' 审批';
actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="showVerifyDialog(\'' + prefix + '\',\'' + row.taskId + '\', \'' + row.taskName+"-"+ row.instanceTypeName +"申请" + '\')"><i class="fa fa-edit"></i> '+nodeName+'</a> ');
}
}
actions.push('<a class="btn btn-warning btn-xs" href="javascript:void(0)" onclick="showHistoryDialog(\'' + row.instanceId + '\')"><i class="fa fa-list"></i> 审批历史</a> ');
actions.push('<a class="btn btn-info btn-xs" href="javascript:void(0)" onclick="showProcessImgDialog(\'' + row.instanceId + '\')"><i class="fa fa-image"></i> 进度查看</a> ');
}
actions.push('<a class="btn btn-success btn-xs ' + detailFlag + '" href="javascript:void(0)" onclick="detail(\'' + row.inventoryCheckId + '\')"><i class="fa fa-edit"></i>详情</a> ');
var actionLinks = actions.join('');
return $.table.dropdownToggle(actionLinks);
// return actions.join('');
}
}]
}],
rowStyle: function (row, index) {
if (row.auditStatus=="0") {
// 如果审核状态为待审核,则设置为红色
return {css:{"color":"red"}};
}
// 否则使用默认样式
return {};
}
};
$.table.init(options);
});
@ -149,7 +245,6 @@
/*详情*/
function detail(inventoryCheckId) {
var url = ctx + 'warehouse/inventoryCheck/detail/'+inventoryCheckId;
console.log(url);
$.modal.open("库存盘点详情",url);
}
@ -175,6 +270,12 @@
});
});
}
function cancel(id) {
$.modal.confirm("确定作废该库存盘点信息吗?", function() {
var url = prefix + "/cancel/" + id;
$.modal.open("作废", url);
})
}
</script>
</body>
</html>

178
ruoyi-admin/src/main/resources/templates/warehouse/inventoryCheck/taskCkzgVerify.html

@ -0,0 +1,178 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('仓库主管审核')" />
<th:block th:include="include :: datetimepicker-css" />
<th:block th:include="include :: select2-css" />
</head>
<body class="white-bg">
<div id="app" class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-inventoryCheck-ckzg" th:object="${formData}">
<input name="inventoryCheckId" th:field="*{inventoryCheckId}" type="hidden">
<input name="taskId" th:field="*{taskId}" type="hidden">
<input name="taskName" th:field="*{taskName}" type="hidden">
<input name="instanceId" th:field="*{instanceId}" type="hidden">
<input name="instanceType" th:field="*{instanceType}" type="hidden">
<input type="hidden" name="p_COM_comment" />
<div class="form-group">
<label class="col-sm-3 control-label">申请人:</label>
<div class="col-sm-8">
<input name="applyUserName" th:field="*{applyUserName}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">申请时间:</label>
<div class="col-sm-8">
<div class="input-group date">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
<input name="applyTime" th:value="${#dates.format(formData.applyTime, 'yyyy-MM-dd HH:mm')}" class="form-control" type="text" disabled>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">标题:</label>
<div class="col-sm-8">
<input name="title" th:field="*{applyTitle}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">盘点单号:</label>
<div class="col-sm-8">
<input name="inventoryCheckCode" th:field="*{inventoryCheckCode}" class="form-control" type="text" disabled>
</div>
</div>
<div class="form-group" hidden>
<label class="col-sm-3 control-label">盘点人名:</label>
<div class="col-sm-8">
<input name="inventoryCheckName" th:field="*{inventoryCheckName}" class="form-control" type="text" disabled>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">仓库名称:</label>
<div class="col-sm-8">
<input id="stockName" name="warehouseName" class="form-control" th:field="*{warehouseName}" disabled />
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">仓库号:</label>
<div class="col-sm-8">
<input name="warehouseCode" th:field="*{warehouseCode}" class="form-control" type="text" disabled/>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">盘点日期:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="inventoryCheckDate" th:value="${#dates.format(formData.inventoryCheckDate, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text" disabled>
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">备注内容:</label>
<div class="col-sm-8">
<textarea name="remark" class="form-control" disabled>[[*{remark}]]</textarea>
</div>
</div>
<div class="form-group" id="cancelRemark" hidden>
<label class="col-sm-3 control-label">作废理由:</label>
<div class="col-sm-8">
<textarea name="cancelRemark" th:text="*{cancelRemark}" class="form-control" readonly></textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label" for="ckzgVerifyApproved"><span style="color: red; ">*</span>审批意见:</label>
<div class="col-sm-8">
<select name="p_B_ckzgVerifyApproved" id="ckzgVerifyApproved" class="form-control m-b" required>
<option value=""></option>
<option value="true">同意</option>
<option value="false">拒绝</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">批注:</label>
<div class="col-sm-8">
<textarea name="comment" class="form-control"></textarea>
</div>
</div>
<!-- 物料信息 -->
<div class="container">
<div class="row">
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: select2-js" />
<th:block th:include="include :: datetimepicker-js" />
<script th:src="@{/js/activiti.js}"></script>
<script th:inline="javascript">
var prefix = ctx + "warehouse/inventoryCheck";
$("#form-inventoryCheck-ckzg").validate({focusCleanup: true});
var warehouseInventoryCheck = [[${formData}]];
$("input[name='inventoryCheckDate']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
//库存物料table列表
$(function() {
var instanceType = [[${formData.instanceType}]];
if(instanceType === "cancel"){
$("#cancelRemark").show();
}
var options = {
modalName: "库存物料",
url: prefix + '/getInventoryCheckDetailList',
queryParams: queryParams,
showColumns: false,
pagination: false,
showToggle: false,
showRefresh:false,
showSearch:false,
singleSelect:true,
columns: [
{title: '库存盘点详情ID', field: 'inventoryCheckDetailId', visible: false},
{title: '料号', field: 'materialNo',},
{title: '物料名称', field: 'materialName',},
{title: '物料单位', field: 'materialUnit',},
{title: '物料描述', field: 'materialDescribe',},
{title: '盘点数量', field: 'inventoryCheckNum',},
{title: '当时库存账上数量', field: 'inventoryAccountNum',},
{title: '存放地址', field: 'warehouseStoreAddress',},
{title: '批号', field: 'batchNumber',},
{title: '说明', field: 'remark',},
]
};
$.table.init(options);
})
function queryParams(params) {
var curParams = {
// 传递参数查询参数
inventoryCheckCode: warehouseInventoryCheck.inventoryCheckCode
};
return curParams;
}
function submitHandler() {
if ($.validate.form()) {
if ($('textarea[name="comment"]').val()) {
$('input[name="p_COM_comment"]').val($('textarea[name="comment"]').val());
}
var taskId = [[${taskId}]];
$.operate.save(prefix + "/complete/" + taskId, $('#form-inventoryCheck-ckzg').serialize());
}
}
</script>
</body>
</html>

178
ruoyi-admin/src/main/resources/templates/warehouse/inventoryCheck/taskFzjlVerify.html

@ -0,0 +1,178 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('副总经理审核')" />
<th:block th:include="include :: datetimepicker-css" />
<th:block th:include="include :: select2-css" />
</head>
<body class="white-bg">
<div id="app" class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-inventoryCheck-fzjl" th:object="${formData}">
<input name="inventoryCheckId" th:field="*{inventoryCheckId}" type="hidden">
<input name="taskId" th:field="*{taskId}" type="hidden">
<input name="taskName" th:field="*{taskName}" type="hidden">
<input name="instanceId" th:field="*{instanceId}" type="hidden">
<input name="instanceType" th:field="*{instanceType}" type="hidden">
<input type="hidden" name="p_COM_comment" />
<div class="form-group">
<label class="col-sm-3 control-label">申请人:</label>
<div class="col-sm-8">
<input name="applyUserName" th:field="*{applyUserName}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">申请时间:</label>
<div class="col-sm-8">
<div class="input-group date">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
<input name="applyTime" th:value="${#dates.format(formData.applyTime, 'yyyy-MM-dd HH:mm')}" class="form-control" type="text" disabled>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">标题:</label>
<div class="col-sm-8">
<input name="title" th:field="*{applyTitle}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">盘点单号:</label>
<div class="col-sm-8">
<input name="inventoryCheckCode" th:field="*{inventoryCheckCode}" class="form-control" type="text" disabled>
</div>
</div>
<div class="form-group" hidden>
<label class="col-sm-3 control-label">盘点人名:</label>
<div class="col-sm-8">
<input name="inventoryCheckName" th:field="*{inventoryCheckName}" class="form-control" type="text" disabled>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">仓库名称:</label>
<div class="col-sm-8">
<input id="stockName" name="warehouseName" class="form-control" th:field="*{warehouseName}" disabled />
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">仓库号:</label>
<div class="col-sm-8">
<input name="warehouseCode" th:field="*{warehouseCode}" class="form-control" type="text" disabled/>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">盘点日期:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="inventoryCheckDate" th:value="${#dates.format(formData.inventoryCheckDate, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text" disabled>
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">备注内容:</label>
<div class="col-sm-8">
<textarea name="remark" class="form-control" disabled>[[*{remark}]]</textarea>
</div>
</div>
<div class="form-group" id="cancelRemark" hidden>
<label class="col-sm-3 control-label">作废理由:</label>
<div class="col-sm-8">
<textarea name="cancelRemark" th:text="*{cancelRemark}" class="form-control" readonly></textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label" for="fzjlVerifyApproved"><span style="color: red; ">*</span>审批意见:</label>
<div class="col-sm-8">
<select name="p_B_fzjlVerifyApproved" id="fzjlVerifyApproved" class="form-control m-b" required>
<option value=""></option>
<option value="true">同意</option>
<option value="false">拒绝</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">批注:</label>
<div class="col-sm-8">
<textarea name="comment" class="form-control"></textarea>
</div>
</div>
<!-- 物料信息 -->
<div class="container">
<div class="row">
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: select2-js" />
<th:block th:include="include :: datetimepicker-js" />
<script th:src="@{/js/activiti.js}"></script>
<script th:inline="javascript">
var prefix = ctx + "warehouse/inventoryCheck";
$("#form-inventoryCheck-fzjl").validate({focusCleanup: true});
var warehouseInventoryCheck = [[${formData}]];
$("input[name='inventoryCheckDate']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
//库存物料table列表
$(function() {
var instanceType = [[${formData.instanceType}]];
if(instanceType === "cancel"){
$("#cancelRemark").show();
}
var options = {
modalName: "库存物料",
url: prefix + '/getInventoryCheckDetailList',
queryParams: queryParams,
showColumns: false,
pagination: false,
showToggle: false,
showRefresh:false,
showSearch:false,
singleSelect:true,
columns: [
{title: '库存盘点详情ID', field: 'inventoryCheckDetailId', visible: false},
{title: '料号', field: 'materialNo',},
{title: '物料名称', field: 'materialName',},
{title: '物料单位', field: 'materialUnit',},
{title: '物料描述', field: 'materialDescribe',},
{title: '盘点数量', field: 'inventoryCheckNum',},
{title: '当时库存账上数量', field: 'inventoryAccountNum',},
{title: '存放地址', field: 'warehouseStoreAddress',},
{title: '批号', field: 'batchNumber',},
{title: '说明', field: 'remark',},
]
};
$.table.init(options);
})
function queryParams(params) {
var curParams = {
// 传递参数查询参数
inventoryCheckCode: warehouseInventoryCheck.inventoryCheckCode
};
return curParams;
}
function submitHandler() {
if ($.validate.form()) {
if ($('textarea[name="comment"]').val()) {
$('input[name="p_COM_comment"]').val($('textarea[name="comment"]').val());
}
var taskId = [[${taskId}]];
$.operate.save(prefix + "/complete/" + taskId, $('#form-inventoryCheck-fzjl').serialize());
}
}
</script>
</body>
</html>

263
ruoyi-admin/src/main/resources/templates/warehouse/inventoryCheck/taskModifyApply.html

@ -0,0 +1,263 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('库存盘点调整申请')" />
<th:block th:include="include :: datetimepicker-css" />
<th:block th:include="include :: select2-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-inventoryCheck-edit" th:object="${formData}">
<input name="inventoryCheckId" th:field="*{inventoryCheckId}" type="hidden">
<input name="taskId" th:field="*{taskId}" type="hidden">
<input name="taskName" th:field="*{taskName}" type="hidden">
<input name="instanceId" th:field="*{instanceId}" type="hidden">
<input name="instanceType" th:field="*{instanceType}" type="hidden">
<!--驳回调整允许更新内容-->
<input type="hidden" name="saveEntity" value="true" />
<div class="form-group">
<label class="col-sm-3 control-label">盘点单号:</label>
<div class="col-sm-8">
<input readonly name="inventoryCheckCode" th:field="*{inventoryCheckCode}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">仓库名称:</label>
<div class="col-sm-8">
<select id="stockName" name="warehouseNameSelect" class="form-control" />
<option value="">请选择仓库名称</option>
</select>
<input name="warehouseName" class="form-control" th:field="*{warehouseName}" type="hidden">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">仓库号:</label>
<div class="col-sm-8">
<input name="warehouseCode" th:field="*{warehouseCode}" class="form-control" type="text" />
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">盘点日期:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="inventoryCheckDate" th:value="${#dates.format(formData.inventoryCheckDate, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required" for="reApply">是否继续申请:</label>
<div class="col-sm-8">
<select required id="reApply" name="p_B_reApply" class="form-control m-b">
<option value="true">重新申请</option>
<option value="false">结束流程</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">备注内容:</label>
<div class="col-sm-8">
<textarea name="remark" class="form-control">[[*{remark}]]</textarea>
</div>
</div>
<div class="form-group" hidden>
<div class="col-sm-8">
<input id="inventoryCheckDetailList" name="inventoryCheckDetailList" class="form-control">
</div>
</div>
<!-- 物料信息 -->
<div class="container">
<div class="form-row">
<div class="btn-group-sm" id="toolbar" role="group">
<span>选择物料</span>
<a class="btn btn-success" onclick="insertRow()">
<i class="fa fa-plus"></i> 选择物料
</a>
</div>
</div>
<div class="form-row">
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<!--用于可以修改列表字段的插件-->
<th:block th:include="include :: bootstrap-table-editable-js" />
<th:block th:include="include :: select2-js" />
<script th:src="@{/js/activiti.js}"></script>
<script th:inline="javascript">
var loginName = [[${@permission.getPrincipalProperty('loginName')}]];
var prefix = ctx + "warehouse/inventoryCheck";
var warehouseInventoryCheck = [[${formData}]];
var taskId = [[${taskId}]];
$("#form-inventoryCheck-edit").validate({focusCleanup: true});
$("input[name='inventoryCheckDate']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
// 新增提交
function submitHandler() {
if ($.validate.form()) {
var tableData = $("#bootstrap-table").bootstrapTable('getData');
if (tableData.length === 0) {
$.modal.alertWarning("子表数据不能为空!");
} else {
// 将子表数据添加到FormData中
$("#inventoryCheckDetailList").val(JSON.stringify(tableData));
}
$.operate.save(prefix + "/complete/"+taskId, $("#form-inventoryCheck-edit").serialize());
}
}
//添加物料信息
function insertRow() {
var url = ctx + "erp/material/select";
var options = {
title: '选择物料',
url: url,
callBack: doSubmit
};
$.modal.openOptions(options);
}
//收款凭证table列表
$(function() {
var options = {
modalName: "库存盘点",
url: prefix + '/getInventoryCheckDetailList',
queryParams: queryParams,
showColumns: false,
pagination: false,
showToggle: false,
showRefresh:false,
showSearch:false,
singleSelect:true,
columns: [
{title: '库存盘点详情ID', field: 'inventoryCheckDetailId', visible: false},
{title: '料号', field: 'materialNo',},
{title: '物料名称', field: 'materialName',},
{title: '物料单位', field: 'materialUnit',},
{title: '物料描述', field: 'materialDescribe',},
{title: '盘点数量', field: 'inventoryCheckNum', editable:true},
{title: '当时库存账上数量', field: 'inventoryAccountNum', editable:true},
{title: '存放地址', field: 'warehouseStoreAddress', editable:true},
{title: '批号', field: 'batchNumber', editable:true},
{title: '说明', field: 'remark', editable:true},
{title: '操作', align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="removeRow(\'' + row.materialNo + '\')"><i class="fa fa-remove"></i>删除</a> ');
return actions.join('');
}
}
]
};
$.table.init(options);
var stockName = warehouseInventoryCheck.warehouseName;
loadWarehouseCodes(stockName);
})
function queryParams(params) {
var curParams = {
// 传递参数查询参数
inventoryCheckCode: warehouseInventoryCheck.inventoryCheckCode
};
return curParams;
}
function doSubmit(index, layero,uniqueId){
var iframeWin = window[layero.find('iframe')[0]['name']];
var rowData = iframeWin.$('#bootstrap-select-table').bootstrapTable('getSelections');
//判断是否重复
var data = $("#bootstrap-table").bootstrapTable('getData');
var rows = data.length;
if(rows > 0){
for(var i=0;i<rows;i++){
for(var j=0;j<rowData.length;j++){
if(data[i].materialNo===rowData[j].materialNo){
$.modal.alertError("不能选择已添加过的相同物料");
rowData.split(j,1);
break;
}
}
};
}
for(i=0;i<rowData.length;i++){
insertTable(rowData[i]);
}
layer.close(index);
}
function insertTable(rowData){
var newRow = {
materialNo:rowData.materialNo,
materialName: rowData.materialName,
materialDescribe: rowData.describe,
materialUnit: rowData.unit,
inventoryCheckNum : "",
inventoryAccountNum : "",
warehouseStoreAddress : "",
batchNumber : "",
remark : ""
}
$("#bootstrap-table").bootstrapTable('append',newRow);
}
// 逻辑删除前端的一行数据
function removeRow(materialNo){
$("#bootstrap-table").bootstrapTable('remove', {
field: 'materialNo',
values: materialNo
})
}
// 加载仓库Id列表函数
function loadWarehouseCodes(defaultStockName) {
var url = ctx + 'stock/stockInfo/getAllWarehouseCode';
$.ajax({
url: url,
type: 'GET',
dataType: 'json',
success: function(data) {
var select = $('#stockName');
$.each(data, function(i, option) {
var optionElement = $('<option>', {
value: option.stockNO,
text : option.stockName
});
select.append(optionElement);
if (option.stockName === defaultStockName) {
optionElement.prop('selected', true);
}
$("input[name='warehouseName']").val(defaultStockName);
});
// 给下拉框添加 change 事件监听器
select.on('change', function() {
// 获取选中的 stockNo
var selectedStockNo = $(this).val();
var selectedOption = $('#stockName option:selected');
var text = selectedOption.text();
// 将选中的 stockNo 赋值给指定的输入框
$("input[name='warehouseCode']").val(selectedStockNo);
$("input[name='warehouseName']").val();
$("input[name='warehouseName']").val(text);
});
},
error: function(error) {
console.log('Error: ', error);
}
});
}
</script>
</body>
</html>
Loading…
Cancel
Save