Browse Source

[fix]物料类型改为必选项不能为空,关联料号改为不可修改。物料信息添加了工程员字段,BOM物料信息提交,业务流程创建,业Bom添加审批流程过程

dev
zhangsiqi 9 months ago
parent
commit
ad33ac7dd6
  1. 176
      ruoyi-admin/src/main/java/com/ruoyi/erp/controller/ErpBomController.java
  2. 179
      ruoyi-admin/src/main/java/com/ruoyi/erp/domain/ErpBom.java
  3. 123
      ruoyi-admin/src/main/java/com/ruoyi/erp/domain/ErpBomVo.java
  4. 56
      ruoyi-admin/src/main/java/com/ruoyi/erp/domain/ErpMaterial.java
  5. 12
      ruoyi-admin/src/main/java/com/ruoyi/erp/mapper/ErpBomMapper.java
  6. 23
      ruoyi-admin/src/main/java/com/ruoyi/erp/service/IErpBomService.java
  7. 274
      ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpBomServiceImpl.java
  8. 7
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
  9. 177
      ruoyi-admin/src/main/resources/mapper/erp/ErpBomMapper.xml
  10. 3
      ruoyi-admin/src/main/resources/mapper/erp/ErpMaterialMapper.xml
  11. 138
      ruoyi-admin/src/main/resources/templates/erp/bom/add.html
  12. 130
      ruoyi-admin/src/main/resources/templates/erp/bom/bom.html
  13. 258
      ruoyi-admin/src/main/resources/templates/erp/bom/taskGcjlVerify.html
  14. 266
      ruoyi-admin/src/main/resources/templates/erp/bom/taskGczgVerify.html
  15. 277
      ruoyi-admin/src/main/resources/templates/erp/bom/taskModifyApply.html
  16. 258
      ruoyi-admin/src/main/resources/templates/erp/bom/taskYfzjVerify.html
  17. 5
      ruoyi-admin/src/main/resources/templates/erp/material/material.html
  18. 2
      ruoyi-admin/src/main/resources/templates/system/makeorder/makeorder.html
  19. 2
      ruoyi-admin/src/main/resources/templates/system/model/model.html

176
ruoyi-admin/src/main/java/com/ruoyi/erp/controller/ErpBomController.java

@ -1,17 +1,27 @@
package com.ruoyi.erp.controller;
import com.ruoyi.ck.domain.Bom;
import com.ruoyi.ck.domain.ItemInfo;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.erp.domain.ErpBom;
import com.ruoyi.erp.domain.ErpBomImportVo;
import com.ruoyi.erp.domain.*;
import com.ruoyi.erp.service.IErpBomService;
import com.ruoyi.process.general.service.IProcessService;
import com.ruoyi.system.domain.SysOutGood;
import com.ruoyi.system.service.ISysRoleService;
import com.ruoyi.web.controller.demo.domain.UserOperateModel;
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;
@ -19,8 +29,12 @@ import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Set;
/**
* bomController
@ -33,14 +47,28 @@ import java.util.List;
public class ErpBomController extends BaseController
{
private String prefix = "erp/bom";
@Autowired
private ISysRoleService roleService;
@Autowired
private TaskService taskService;
@Autowired
private RuntimeService runtimeService;
@Autowired
private IProcessService processService;
@Autowired
private IErpBomService erpBomService;
private ErpBomVo erpBomVo;
@RequiresPermissions("erp:bom:view")
@GetMapping()
public String bom()
public String bom(ModelMap mmap)
{
mmap.put("currentUser", ShiroUtils.getSysUser());
return prefix + "/bom";
}
@ -50,10 +78,17 @@ public class ErpBomController extends BaseController
@RequiresPermissions("erp:bom:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(ErpBom erpBom)
public TableDataInfo list(ErpBomVo erpBomVo)
{
SysUser curUser = ShiroUtils.getSysUser();
Long userId = curUser.getUserId();
Set<String> roleKeys = roleService.selectRoleKeys(userId);
// 工程文员角色只能看到自己创建的数据
if(roleKeys.contains("gcwyRole")){
erpBomVo.setCreateBy(curUser.getLoginName());
}
startPage();
List<ErpBom> list = erpBomService.selectErpBomList(erpBom);
List<ErpBomVo> list = erpBomService.selectErpBomList(erpBomVo);
return getDataTable(list);
}
@ -67,6 +102,7 @@ public class ErpBomController extends BaseController
startPage();
List<ErpBom> list = erpBomService.selectErpBomSubList(erpBom);
return getDataTable(list);
}
/**
@ -85,7 +121,7 @@ public class ErpBomController extends BaseController
* 导出bom列表
*/
@RequiresPermissions("erp:bom:export")
@Log(title = "bom", businessType = BusinessType.EXPORT)
@Log(title = "ErpBom", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(ErpBom erpBom)
@ -105,16 +141,99 @@ public class ErpBomController extends BaseController
return prefix + "/add";
}
/**
* 新增保存bom
* 新增并提交物料BOM信息
*/
@RequiresPermissions("erp:bom:add")
@Log(title = "bom", businessType = BusinessType.INSERT)
@Log(title = "erpBom", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(@RequestBody ErpBom erpBom)
{
return toAjax(erpBomService.insertErpBom(erpBom));
// 使用状态-否
erpBom.setUseStatus("0");
// 审核状态-待审核
erpBom.setAuditStatus("0");
erpBomService.submitApply(erpBom);
return AjaxResult.success();
}
/**
* 加载审批弹窗
* @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();
ErpBom erpBom = erpBomService.selectErpBomById(new Long(processInstance.getBusinessKey()));
mmap.put("formData", erpBom);
mmap.put("taskId", taskId);
String verifyName = task.getTaskDefinitionKey().substring(0, 1).toUpperCase() + task.getTaskDefinitionKey().substring(1);
return prefix + "/task" + verifyName;
}
/**
* 自动绑定页面字段
*/
@ModelAttribute("preloadObj")
public ErpBomVo getObj(@RequestParam(value = "id", required = false) Long id, HttpSession session) {
if (id != null) {
return erpBomService.selectErpBomById(id);
}
return new ErpBomVo();
}
/**
* 完成任务
*
* @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,
@ModelAttribute("preloadObj") ErpBomVo erpBomVo, HttpServletRequest request) {
boolean saveEntityBoolean = BooleanUtils.toBoolean(saveEntity);
//获取实例id
String instanceId = erpBomVo.getInstanceId();
//获取实例类型
String instanceType = erpBomVo.getInstanceType();
boolean approvedFlag = processService.complete(taskId, instanceId, erpBomVo.getApplyTitle(), erpBomVo.getMaterialNo(), "erpBom", new HashMap<String, Object>(), request);
if(!approvedFlag){
// 审核状态-审核拒绝
erpBomVo.setAuditStatus("2");
}
// 如果任务已结束更新业务表状态
boolean processIsFinish = processService.judgeProcessIsFinish(instanceId);
if (processIsFinish) {
// 审核通过
erpBomVo.setAuditStatus("1");
// 提交
if("submit".equals(instanceType)){
// 使用状态-是
erpBomVo.setUseStatus("1");
}
// 作废
else if("cancel".equals(instanceType)){
// 使用状态-已作废
erpBomVo.setUseStatus("2");
}
// 恢复
else if("restore".equals(instanceType)){
// 使用状态-是
erpBomVo.setUseStatus("1");
}
}
erpBomService.updateErpBom(erpBomVo);
// 驳回申请后继续申请,可能修改表单
if (saveEntityBoolean) {
erpBomService.updateErpBom(erpBomVo);
}
return success("任务已完成");
}
/**
@ -135,9 +254,9 @@ public class ErpBomController extends BaseController
@Log(title = "bom", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(@RequestBody ErpBom erpBom)
public AjaxResult editSave(@RequestBody ErpBomVo erpBomVo)
{
return toAjax(erpBomService.updateErpBom(erpBom));
return toAjax(erpBomService.updateErpBom(erpBomVo));
}
/**
@ -199,10 +318,17 @@ public class ErpBomController extends BaseController
public TableDataInfo bomEqulasList()
{
startPage();
ErpBom erpBom = new ErpBom();
List<ErpBom> list = erpBomService.selectErpBomList(erpBom);
ErpBomVo erpBomVo = new ErpBomVo();
List<ErpBomVo> list = erpBomService.selectErpBomList(erpBomVo);
return getDataTable(list);
}
/**
* BOM信息一阶对比
* @param bomNo1
* @param bomNo2
* @return
*/
@RequiresPermissions("erp:bom:equals")
@PostMapping("/equalsBom")
@ResponseBody
@ -264,28 +390,4 @@ public class ErpBomController extends BaseController
return erpBomService.checkMaterialNoUnique(materialNo);
}
/**
* 导出模板
*/
@GetMapping("/importTemplate")
@ResponseBody
public AjaxResult importTemplate()
{
ExcelUtil<ErpBomImportVo> util = new ExcelUtil<ErpBomImportVo>(ErpBomImportVo.class);
return util.importTemplateExcel("物料模板");
}
/**
* 导入数据
*/
@PostMapping("/importData")
@ResponseBody
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
{
ExcelUtil<ErpBomImportVo> util = new ExcelUtil<ErpBomImportVo>(ErpBomImportVo.class);
List<ErpBomImportVo> bomImportVos = util.importExcel(file.getInputStream());
String message = erpBomService.importData(bomImportVos, updateSupport);
return AjaxResult.success(message);
}
}

179
ruoyi-admin/src/main/java/com/ruoyi/erp/domain/ErpBom.java

@ -2,10 +2,12 @@ package com.ruoyi.erp.domain;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.system.domain.SysProductItem;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
@ -77,6 +79,36 @@ public class ErpBom extends BaseEntity
/** 使用状态 */
private String useStatus;
/** 流程实例ID */
private String instanceId;
/** 流程实例类型 */
private String instanceType;
/** 提交流程实例ID */
private String submitInstanceId;
/** 作废流程实例ID */
private String cancelInstanceId;
/** 恢复流程实例ID */
private String restoreInstanceId;
/** 申请人 */
private String applyTitle;
/** 申请人 */
private String applyUser;
/** 申请时间 */
private Date applyTime;
private Long photoAttachId;
private String fileIdStr;
private String removeFileIdStr;
/** bom信息 */
private List<ErpBom> erpBomList;
@ -253,33 +285,128 @@ public class ErpBom extends BaseEntity
this.erpBomList = erpBomList;
}
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 getCancelInstanceId() {
return cancelInstanceId;
}
public void setCancelInstanceId(String cancelInstanceId) {
this.cancelInstanceId = cancelInstanceId;
}
public String getRestoreInstanceId() {
return restoreInstanceId;
}
public void setRestoreInstanceId(String restoreInstanceId) {
this.restoreInstanceId = restoreInstanceId;
}
public String getApplyTitle() {
return applyTitle;
}
public void setApplyTitle(String applyTitle) {
this.applyTitle = applyTitle;
}
public String getApplyUser() {
return applyUser;
}
public void setApplyUser(String applyUser) {
this.applyUser = applyUser;
}
public Date getApplyTime() {
return applyTime;
}
public void setApplyTime(Date applyTime) {
this.applyTime = applyTime;
}
public Long getPhotoAttachId() {
return photoAttachId;
}
public void setPhotoAttachId(Long photoAttachId) {
this.photoAttachId = photoAttachId;
}
public String getFileIdStr() {
return fileIdStr;
}
public void setFileIdStr(String fileIdStr) {
this.fileIdStr = fileIdStr;
}
public String getRemoveFileIdStr() {
return removeFileIdStr;
}
public void setRemoveFileIdStr(String removeFileIdStr) {
this.removeFileIdStr = removeFileIdStr;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("delFlag", getDelFlag())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("bomNo", getBomNo())
.append("materialNo", getMaterialNo())
.append("photoUrl", getPhotoUrl())
.append("materialName", getMaterialName())
.append("materialType", getMaterialType())
.append("processMethod", getProcessMethod())
.append("unit", getUnit())
.append("brand", getBrand())
.append("describe", getDescribe())
.append("useNum", getUseNum())
.append("lossRate", getLossRate())
.append("parentId", getParentId())
.append("level", getLevel())
.append("sortNo", getSortNo())
.append("auditStatus", getAuditStatus())
.append("useStatus", getUseStatus())
.append("erpBomList", getErpBomList())
.toString();
return "ErpBom{" +
"id=" + id +
", delFlag='" + delFlag + '\'' +
", bomNo='" + bomNo + '\'' +
", materialNo='" + materialNo + '\'' +
", photoUrl='" + photoUrl + '\'' +
", materialName='" + materialName + '\'' +
", materialType='" + materialType + '\'' +
", processMethod='" + processMethod + '\'' +
", unit='" + unit + '\'' +
", brand='" + brand + '\'' +
", describe='" + describe + '\'' +
", useNum=" + useNum +
", lossRate=" + lossRate +
", parentId=" + parentId +
", level=" + level +
", sortNo=" + sortNo +
", auditStatus='" + auditStatus + '\'' +
", useStatus='" + useStatus + '\'' +
", instanceId='" + instanceId + '\'' +
", instanceType='" + instanceType + '\'' +
", submitInstanceId='" + submitInstanceId + '\'' +
", cancelInstanceId='" + cancelInstanceId + '\'' +
", restoreInstanceId='" + restoreInstanceId + '\'' +
", applyTitle='" + applyTitle + '\'' +
", applyUser='" + applyUser + '\'' +
", applyTime=" + applyTime +
", photoAttachId=" + photoAttachId +
", fileIdStr='" + fileIdStr + '\'' +
", removeFileIdStr='" + removeFileIdStr + '\'' +
", erpBomList=" + erpBomList +
'}';
}
}

123
ruoyi-admin/src/main/java/com/ruoyi/erp/domain/ErpBomVo.java

@ -0,0 +1,123 @@
package com.ruoyi.erp.domain;
import com.ruoyi.common.core.domain.BaseEntity;
import java.util.Date;
/**
*
* @Description BOM信息Vo
*/
public class ErpBomVo extends ErpBom{
private static final long serialVersionUID = 1L;
/** 申请人姓名 */
private String applyUserName;
/** 任务ID */
private String taskId;
/** 任务名称 */
private String taskName;
/** 办理时间 */
private Date doneTime;
/** 创建人 */
private String createUserName;
/** 流程实例状态 1 激活 2 挂起 */
private String suspendState;
/** 待办用户id */
private String todoUserId;
/** 流程实例类型名称 */
private String instanceTypeName;
/**
* 关键词
*/
private String keyword;
public String getApplyUserName() {
return applyUserName;
}
public void setApplyUserName(String applyUserName) {
this.applyUserName = applyUserName;
}
public String getTaskId() {
return taskId;
}
public void setTaskId(String taskId) {
this.taskId = taskId;
}
public String getTaskName() {
return taskName;
}
public void setTaskName(String taskName) {
this.taskName = taskName;
}
public Date getDoneTime() {
return doneTime;
}
public void setDoneTime(Date doneTime) {
this.doneTime = doneTime;
}
public String getCreateUserName() {
return createUserName;
}
public void setCreateUserName(String createUserName) {
this.createUserName = createUserName;
}
public String getSuspendState() {
return suspendState;
}
public void setSuspendState(String suspendState) {
this.suspendState = suspendState;
}
public String getTodoUserId() {
return todoUserId;
}
public void setTodoUserId(String todoUserId) {
this.todoUserId = todoUserId;
}
public String getInstanceTypeName() {
return instanceTypeName;
}
public void setInstanceTypeName(String instanceTypeName) {
this.instanceTypeName = instanceTypeName;
}
public String getKeyword() {
return keyword;
}
public void setKeyword(String keyword) {
this.keyword = keyword;
}
@Override
public String toString() {
return "ErpMaterialVo{" +
"applyUserName='" + applyUserName + '\'' +
", taskId='" + taskId + '\'' +
", taskName='" + taskName + '\'' +
", doneTime=" + doneTime +
", createUserName='" + createUserName + '\'' +
", suspendState='" + suspendState + '\'' +
", todoUserId='" + todoUserId + '\'' +
", instanceTypeName='" + instanceTypeName + '\'' +
", keyword='" + keyword + '\'' +
"} " + super.toString();
}
}

56
ruoyi-admin/src/main/java/com/ruoyi/erp/domain/ErpMaterial.java

@ -3,7 +3,7 @@ package com.ruoyi.erp.domain;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.system.domain.SysProductItem;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.Date;
@ -362,29 +362,35 @@ public class ErpMaterial extends BaseEntity
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("delFlag", getDelFlag())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("materialNo", getMaterialNo())
.append("materialName", getMaterialName())
.append("auditStatus", getAuditStatus())
.append("useStatus", getUseStatus())
.append("havaProductTem", getHavaProductTem())
.append("productItem", getProductItem())
.append("materialType", getMaterialType())
.append("processMethod", getProcessMethod())
.append("unit", getUnit())
.append("brand", getBrand())
.append("describe", getDescribe())
.append("warehouseDept", getWarehouseDept())
.append("sysProductItems", getSysProductItems().stream().toArray())
.append("bomNo",getBomNo())
.append("itemName",getItemName())
.toString();
return new ToStringBuilder(this)
.append("id", getId())
.append("delFlag", getDelFlag())
.append("materialNo", getMaterialNo())
.append("materialName", getMaterialName())
.append("bomNo", getBomNo())
.append("auditStatus", getAuditStatus())
.append("useStatus", getUseStatus())
.append("havaProductTem", getHavaProductTem())
.append("materialType", getMaterialType())
.append("processMethod", getProcessMethod())
.append("unit", getUnit())
.append("brand", getBrand())
.append("describe", getDescribe())
.append("warehouseDept", getWarehouseDept())
.append("instanceId", getInstanceId())
.append("instanceType", getInstanceType())
.append("submitInstanceId", getSubmitInstanceId())
.append("cancelInstanceId", getCancelInstanceId())
.append("restoreInstanceId", getRestoreInstanceId())
.append("applyTitle", getApplyTitle())
.append("applyUser", getApplyUser())
.append("applyTime", getApplyTime())
.append("photoAttachId", getPhotoAttachId())
.append("photoUrl", getPhotoUrl())
.append("fileIdStr", getFileIdStr())
.append("removeFileIdStr", getRemoveFileIdStr())
.append("sysProductItems", getSysProductItems())
.append("itemName", getItemName())
.toString();
}
}

12
ruoyi-admin/src/main/java/com/ruoyi/erp/mapper/ErpBomMapper.java

@ -1,6 +1,8 @@
package com.ruoyi.erp.mapper;
import com.ruoyi.erp.domain.ErpBom;
import com.ruoyi.erp.domain.ErpBomVo;
import com.ruoyi.erp.domain.ErpMaterialVo;
import java.util.List;
@ -18,11 +20,13 @@ public interface ErpBomMapper
* @param id bomID
* @return bom
*/
public ErpBom selectErpBomById(Long id);
public ErpBomVo selectErpBomById(Long id);
public ErpBom selectErpBomByOneMaterialNo(String materialNo);
public List<ErpBomVo> selectErpBomList(ErpBomVo erpBomVo);
/**
* 查询bom列表
*
@ -84,7 +88,7 @@ public interface ErpBomMapper
/**
* 批量删除bom
*
* @param customerIds 需要删除的数据ID
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteErpBomByParentIds(String[] ids);
@ -100,7 +104,7 @@ public interface ErpBomMapper
/**
* 通过bomID删除bom信息
*
* @param roleId 角色ID
* @param id 角色ID
* @return 结果
*/
public int deleteErpBomByParentId(Long id);
@ -128,4 +132,6 @@ public interface ErpBomMapper
public List<ErpBom> selectErpBomList1();
ErpBomVo selectErpBomByMaterialNo(String materialNo);
}

23
ruoyi-admin/src/main/java/com/ruoyi/erp/service/IErpBomService.java

@ -2,6 +2,8 @@ package com.ruoyi.erp.service;
import com.ruoyi.erp.domain.ErpBom;
import com.ruoyi.erp.domain.ErpBomImportVo;
import com.ruoyi.erp.domain.ErpBomVo;
import org.activiti.engine.runtime.ProcessInstance;
import java.util.List;
@ -14,20 +16,20 @@ import java.util.List;
public interface IErpBomService
{
/**
* 查询bom
*
* 查询物料bom信息
*
* @param id bomID
* @return bom
*/
public ErpBom selectErpBomById(Long id);
public ErpBomVo selectErpBomById(Long id);
/**
* 查询bom列表
* 查询物料bom信息列表
*
* @param erpBom bom
* @param erpBomVo bom
* @return bom集合
*/
public List<ErpBom> selectErpBomList(ErpBom erpBom);
public List<ErpBomVo> selectErpBomList(ErpBomVo erpBomVo);
List<ErpBom> selectErpBomSubList(ErpBom erpBom);
@ -44,10 +46,10 @@ public interface IErpBomService
/**
* 修改bom
*
* @param erpBom bom
* @param erpBomVo bom
* @return 结果
*/
public int updateErpBom(ErpBom erpBom);
public int updateErpBom(ErpBomVo erpBomVo);
/**
* 批量删除bom
@ -70,14 +72,14 @@ public interface IErpBomService
* @param id bomID
* @return
*/
int cancelErpBomById(Long id);
public int cancelErpBomById(Long id);
/**
* 恢复bom
* @param id bomID
* @return
*/
int restoreErpBomById(Long id);
public int restoreErpBomById(Long id);
/**
* 审批信息
@ -106,4 +108,5 @@ public interface IErpBomService
String importData(List<ErpBomImportVo> bomImportVos,boolean updateSupport);
public ProcessInstance submitApply(ErpBom erpBom);
}

274
ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpBomServiceImpl.java

@ -1,33 +1,37 @@
package com.ruoyi.erp.service.impl;
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.core.redis.RedisCache;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.service.ICommonService;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.erp.domain.ErpBom;
import com.ruoyi.erp.domain.ErpBomImportVo;
import com.ruoyi.erp.domain.ErpMaterial;
import com.ruoyi.erp.domain.ErpMaterialVo;
import com.ruoyi.erp.domain.*;
import com.ruoyi.erp.mapper.ErpBomMapper;
import com.ruoyi.erp.mapper.ErpMaterialMapper;
import com.ruoyi.erp.service.IErpBomService;
import com.ruoyi.erp.service.IErpMaterialService;
import com.ruoyi.web.controller.demo.domain.UserOperateModel;
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.ISysAttachFileService;
import com.ruoyi.system.service.ISysAttachService;
import com.ruoyi.system.service.ISysRoleService;
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.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.stream.Collectors;
import static org.apache.shiro.web.filter.mgt.DefaultFilter.user;
import java.util.*;
/**
* bomService业务层处理
@ -37,7 +41,30 @@ import static org.apache.shiro.web.filter.mgt.DefaultFilter.user;
*/
@Service("erpBomL")
public class ErpBomServiceImpl implements IErpBomService
{
{ @Autowired
private ISysAttachService attachService;
@Autowired
private ISysAttachFileService attachFileService;
@Autowired
private ICommonService commonService;
@Autowired
private SysUserMapper userMapper;
@Autowired
private TaskService taskService;
@Autowired
private BizTodoItemMapper todoItemMapper;
@Autowired
private IProcessService processService;
@Autowired
private ISysRoleService roleService;
@Autowired
private ErpBomMapper erpBomMapper;
@ -52,26 +79,82 @@ public class ErpBomServiceImpl implements IErpBomService
/**
* 查询bom
*
*
* @param id bomID
* @return bom
*/
@Override
public ErpBom selectErpBomById(Long id)
public ErpBomVo selectErpBomById(Long id)
{
return erpBomMapper.selectErpBomById(id);
ErpBomVo erpBomVo = erpBomMapper.selectErpBomById(id);
SysUser sysUser = userMapper.selectUserByLoginName(erpBomVo.getCreateBy());
if (sysUser != null) {
erpBomVo.setCreateUserName(sysUser.getUserName());
}
return erpBomVo;
}
/**
* 查询bom列表
*
* @param erpBom bom
* @param erpBomVo bom
* @return bom
*/
@Override
public List<ErpBom> selectErpBomList(ErpBom erpBom)
public List<ErpBomVo> selectErpBomList(ErpBomVo erpBomVo)
{
return erpBomMapper.selectErpBomList(erpBom);
PageDomain pageDomain = TableSupport.buildPageRequest();
Integer pageNum = pageDomain.getPageNum();
Integer pageSize = pageDomain.getPageSize();
// PageHelper 仅对第一个 List 分页
Page<ErpBomVo> list = (Page<ErpBomVo>) erpBomMapper.selectErpBomList(erpBomVo);
Page<ErpBomVo> returnList = new Page<>();
for (ErpBomVo bomVo: list) {
SysUser sysUser = userMapper.selectUserByLoginName(bomVo.getCreateBy());
if (sysUser != null) {
bomVo.setCreateUserName(sysUser.getUserName());
}
SysUser sysUser2 = userMapper.selectUserByLoginName(bomVo.getApplyUser());
if (sysUser2 != null) {
bomVo.setApplyUserName(sysUser2.getUserName());
}
String instanceId = bomVo.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();
bomVo.setTaskId(taskId);
// 设置待办用户
List<String> todoUserList = todoItemMapper.selectUndealTodoUserList(taskId);
if(!org.springframework.util.CollectionUtils.isEmpty(taskList)){
bomVo.setTodoUserId(String.join(",",todoUserList));
}
if (task.getSuspensionState() == 2) {
bomVo.setTaskName("已挂起");
bomVo.setSuspendState("2");
} else {
bomVo.setTaskName(task.getName());
bomVo.setSuspendState("1");
}
} else {
// 已办结或者已撤销
bomVo.setTaskName("已结束");
}
} else {
bomVo.setTaskName("未启动");
}
returnList.add(bomVo);
}
returnList.setTotal(org.springframework.util.CollectionUtils.isEmpty(list) ? 0 : list.getTotal());
returnList.setPageNum(pageNum);
returnList.setPageSize(pageSize);
return returnList;
}
@Override
@ -121,57 +204,76 @@ public class ErpBomServiceImpl implements IErpBomService
* @param erpBom bom
* @return 结果
*/
@Transactional
@Override
public int insertErpBom(ErpBom erpBom)
{
//插入审核信息
String loginName = ShiroUtils.getLoginName();
//获取创建人
erpBom.setCreateBy(loginName);
//创建时间
erpBom.setCreateTime(DateUtils.getNowDate());
//初始化BOM编号父类
erpBom.setParentId(0L);
//初始化Bom编号层级
erpBom.setLevel(0L);
//生成BOM编号,年月日规则
String billNo = redisCache.generateBillNo("BOM");
erpBom.setBomNo(billNo);
int rows = erpBomMapper.insertErpBom(erpBom);
int result = erpBomMapper.insertErpBom(erpBom);
//todo 使用useGeneratedKeys="true" keyProperty="id"关键子,插入后完成后需要获取新的id就需要重新getId()
Long id = erpBom.getId();
insertErpBomSub(erpBom);
ErpMaterial erpMaterial = new ErpMaterial();
erpMaterial.setMaterialNo(erpBom.getMaterialNo());
erpMaterial.setBomNo(erpBom.getBomNo());
ErpMaterial erpMaterial = materialMapper.selectErpMaterialByMaterialNo(erpBom.getMaterialNo());
if (!Objects.isNull(erpMaterial)) {
ErpMaterial erpMaterial1 = new ErpMaterial();
erpMaterial1.setMaterialNo(erpBom.getMaterialNo());
erpMaterial1.setBomNo(erpBom.getBomNo());
materialMapper.updateMaterialBomNo(erpMaterial1);
}
//添加物料关联的bom信息
iErpMaterialService.updateMaterialBomNo(erpMaterial);
return rows;
return result;
}
/**
* 修改bom
*
* @param erpBom bom
* @param erpBomVo bom
* @return 结果
*/
@Transactional
@Override
public int updateErpBom(ErpBom erpBom)
public int updateErpBom(ErpBomVo erpBomVo)
{
String loginName = ShiroUtils.getLoginName();
erpBom.setUpdateBy(loginName);
erpBom.setUpdateTime(DateUtils.getNowDate());
int editFlag = erpBomMapper.updateErpBom(erpBom);
Long id = erpBom.getId();
erpBomMapper.deleteErpBomByParentId(id);
List<ErpBom> erpBomSubList = erpBom.getErpBomList();
if(CollectionUtils.isNotEmpty(erpBomSubList)){
for (int i=0;i<erpBomSubList.size();i++)
{
ErpBom erpBom1 = erpBomSubList.get(i);
erpBom1.setId(null);
erpBom1.setSortNo((i+1L));
erpBom1.setParentId(id);
erpBom1.setCreateBy(ShiroUtils.getLoginName());
erpBom1.setCreateTime(DateUtils.getNowDate());
erpBomMapper.insertErpBom(erpBom1);
erpBomVo.setUpdateBy(loginName);
erpBomVo.setUpdateTime(DateUtils.getNowDate());
int editFlag = erpBomMapper.updateErpBom(erpBomVo);
Long id = erpBomVo.getId();
try {
//todo 清除原来的数据
erpBomMapper.deleteErpBomByParentId(id);
//todo 添加bom信息子组件列表
List<ErpBom> erpBomSubList = erpBomVo.getErpBomList();
if(CollectionUtils.isNotEmpty(erpBomSubList)){
for (int i=0;i<erpBomSubList.size();i++)
{
ErpBom erpBom1 = erpBomSubList.get(i);
erpBom1.setId(null);
erpBom1.setSortNo((i+1L));
erpBom1.setParentId(id);
erpBom1.setCreateBy(ShiroUtils.getLoginName());
erpBom1.setCreateTime(DateUtils.getNowDate());
erpBomMapper.insertErpBom(erpBom1);
}
}
}catch (Exception e){
e.printStackTrace();
}
return editFlag;
}
@ -423,7 +525,7 @@ public class ErpBomServiceImpl implements IErpBomService
}
/**
* 新增bom信息
* 新增bom组件信息
*
* @param erpBom bom对象
*/
@ -433,7 +535,6 @@ public class ErpBomServiceImpl implements IErpBomService
Long id = erpBom.getId();
if (StringUtils.isNotNull(erpBomList))
{
// List<ErpBom> list = new ArrayList<ErpBom>();
for (int i=0;i<erpBomList.size();i++)
{
ErpBom erpBom1 = erpBomList.get(i);
@ -443,16 +544,83 @@ public class ErpBomServiceImpl implements IErpBomService
erpBom1.setCreateBy(ShiroUtils.getLoginName());
erpBom1.setCreateTime(DateUtils.getNowDate());
erpBomMapper.insertErpBom(erpBom1);
// list.add(erpBom1);
}
// if (list.size() > 0)
// {
// erpBomMapper.batchErpBom(list);
// }
}
}
public List<ErpBom> selectErpBomList1(){
List<ErpBom> bomList = erpBomMapper.selectErpBomList1();
return bomList;
}
/**
* 提交申请
* @param erpBom
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public ProcessInstance submitApply(ErpBom erpBom) {
SysUser user = ShiroUtils.getSysUser();
erpBom.setApplyUser(user.getLoginName());
erpBom.setApplyTime(DateUtils.getNowDate());
//获取插入的Bom列表的id
insertErpBom(erpBom);
// 启动流程
String applyTitle = user.getUserName()+"发起了物料BOM信息提交审批-"+DateUtils.dateTimeNow();
String instanceType = "submit";
ProcessInstance processInstance = startProcessInstance(applyTitle,instanceType,erpBom, user);
String processInstanceId = processInstance.getProcessInstanceId();
// 提交实例id
erpBom.setSubmitInstanceId(processInstanceId);
// 存在提交完就流程结束的情况
boolean processIsFinish = processService.judgeProcessIsFinish(processInstanceId);
if(processIsFinish){
// 审核状态-审核通过
erpBom.setAuditStatus("1");
// 使用状态-是
erpBom.setUseStatus("1");
}
erpBomMapper.updateErpBom(erpBom);
return processInstance;
}
/**
* 创建erpBom审核流程
* @param applyTitle
* @param instanceType
* @param erpBom
* @param user
* @return
*/
private ProcessInstance startProcessInstance(String applyTitle,String instanceType,ErpBom erpBom, SysUser user) {
Long erpBomId = erpBom.getId();
String businessKey = erpBomId.toString(); // 实体类 ID,作为流程的业务 key
String key = "erpBom";
Map<String,Object> variables = new HashMap<>();
// 构造authority传参
buildAuthority(user, variables);
erpBom.setApplyTitle(applyTitle);
// 启动流程
ProcessInstance processInstance = processService.submitApply(user.getLoginName(), businessKey, applyTitle, erpBom.getBomNo(), key, variables);
String processInstanceId = processInstance.getId();
erpBom.setInstanceId(processInstanceId); // 建立双向关系
erpBom.setInstanceType(instanceType);
return processInstance;
}
private void buildAuthority(SysUser user, Map<String, Object> variables) {
Set<String> roleKeys = roleService.selectRoleKeys(user.getUserId());
// 角色不同审核人不同
if(roleKeys.contains("yfzjRole")){
variables.put("authority",4);
}else if(roleKeys.contains("gczgRole")){
variables.put("authority",3);
}else if(roleKeys.contains("gcjlRole")){
variables.put("authority",2);
}else if(roleKeys.contains("gcwyRole")){
variables.put("authority",1);
}
}
}

7
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java

@ -298,7 +298,14 @@ public class SysUserController extends BaseController
@ResponseBody
public AjaxResult selectUserSelList(@RequestParam(required = false,value = "userName")String userName)
{
//获取用户的下拉列表
List<Map<String, String>> userSelList = userService.selectUserSelList(userName);
//过滤为获取工程部成员信息
//过滤为工程文员时获取个人用户信息
//过滤为工程主管时获取工程文员的信息
//过滤为工程经理时获取工程主管的信息,工程文员的信息
userSelList = userSelList.stream().filter(map -> map.get("userType").equals("1")).collect(Collectors.toList());
return success(userSelList);
}
}

177
ruoyi-admin/src/main/resources/mapper/erp/ErpBomMapper.xml

@ -3,8 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.erp.mapper.ErpBomMapper">
<resultMap type="ErpBom" id="ErpBomResult">
<resultMap type="ErpBomVo" id="ErpBomResult">
<result property="id" column="id" />
<result property="delFlag" column="del_flag" />
<result property="createBy" column="create_by" />
@ -27,6 +26,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="sortNo" column="sort_no" />
<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="instanceTypeName" column="instance_type_name" />
<result property="submitInstanceId" column="submit_instance_id" />
<result property="cancelInstanceId" column="cancel_instance_id" />
<result property="restoreInstanceId" column="restore_instance_id" />
<result property="applyTitle" column="apply_title" />
<result property="applyUser" column="apply_user" />
<result property="applyTime" column="apply_time" />
</resultMap>
<resultMap id="ErpBomErpBomSubResult" type="ErpBom" extends="ErpBomResult">
@ -59,47 +67,95 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectErpBomVo">
select id, del_flag, create_by, create_time, update_by, update_time, remark, bom_no, material_no, material_name, material_type, process_method, unit, brand, `describe`, use_num, loss_rate, parent_id, `level`, sort_no, audit_status, use_status from erp_bom
select id, del_flag, create_by, create_time, update_by, update_time, remark, bom_no, material_no, material_name, material_type, process_method, unit, brand, `describe`, use_num, loss_rate, parent_id, `level`, sort_no, audit_status, use_status,instance_id,instance_type,submit_instance_id,cancel_instance_id,restore_instance_id,apply_title,apply_user,apply_time from erp_bom
</sql>
<select id="selectErpBomList" parameterType="ErpBom" resultMap="ErpBomResult">
<include refid="selectErpBomVo"/>
<select id="selectErpBomList" parameterType="ErpBomVo" resultMap="ErpBomResult">
select erp.id, erp.del_flag, erp.create_by, erp.create_time, erp.update_by, erp.update_time
, erp.remark,erp.bom_no,erp.material_no,erp.material_name, erp.audit_status, erp.use_status
, erp.material_type, erp.process_method,erp.unit, erp.brand, erp.`describe`,erp.use_num
, erp.loss_rate, erp.parent_id, erp.`level`, erp.sort_no, erp.instance_id,erp.instance_type
, processDict.dict_label as instance_type_name, erp.submit_instance_id,erp.cancel_instance_id
, erp.restore_instance_id,erp.apply_title,erp.apply_user,erp.apply_time
, file.url as photo_url,cate.name as material_type_name
from erp_bom as erp
left join (
select id,material_no,material_name from erp_material
) erp_material
on erp.material_no = erp_material.material_no
left join(
select dict_value,dict_label from sys_dict_data
where dict_type = 'processType'
) processDict
on erp.instance_type = processDict.dict_value
left join (
select code,name from sys_category
where parent_id in(
select id from sys_category
where parent_id = (select id from sys_category where code = 'materialType') )
) cate
on erp.material_type = cate.code
left join (
select att.rel_id,file.url,min(file.create_time) as create_time from sys_attach as att
left join sys_attach_file as file
on att.id = file.attach_id
where att.source_type = 'erpMaterial' and att.source_sub_type = 'photo'
group by att.rel_id
) file
on erp_material.id = file.rel_id
<where>
<if test="id != null "> and id = #{id}</if>
<if test="delFlag != null and delFlag != ''"> and del_flag = #{delFlag}</if>
<if test="createBy != null and createBy != ''"> and erp.create_by = #{createBy}</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and erp.create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if>
<if test="createBy != null and createBy != ''"> and create_by = #{createBy}</if>
<if test="createTime != null "> and create_time = #{createTime}</if>
<if test="updateBy != null and updateBy != ''"> and update_by = #{updateBy}</if>
<if test="updateTime != null "> and update_time = #{updateTime}</if>
<if test="remark != null and remark != ''"> and remark = #{remark}</if>
<if test="bomNo != null and bomNo != ''"> and bom_no = #{bomNo}</if>
<if test="materialNo != null and materialNo != ''"> and material_no = #{materialNo}</if>
<if test="materialName != null and materialName != ''"> and material_name like concat('%', #{materialName}, '%')</if>
<if test="materialType != null and materialType != ''"> and material_type = #{materialType}</if>
<if test="processMethod != null and processMethod != ''"> and process_method = #{processMethod}</if>
<if test="unit != null and unit != ''"> and unit = #{unit}</if>
<if test="brand != null and brand != ''"> and brand = #{brand}</if>
<if test="describe != null and describe != ''"> and `describe` = #{describe}</if>
<if test="useNum != null "> and use_num = #{useNum}</if>
<if test="lossRate != null "> and loss_rate = #{lossRate}</if>
<if test="parentId != null "> and parent_id = #{parentId}</if>
<if test="level != null "> and level = #{level}</if>
<if test="sortNo != null "> and sort_no = #{sortNo}</if>
<if test="auditStatus != null and auditStatus != ''"> and audit_status = #{auditStatus}</if>
<if test="useStatus != null and useStatus != ''"> and use_status = #{useStatus}</if>
<if test="params.materialNo != null and params.materialNo != ''"> and erp.material_no like concat('%', #{params.materialNo}, '%')</if>
<if test="materialNo != null and materialNo != ''"> and erp.material_no = #{materialNo}</if>
<if test="bomNo != null and bomNo != ''"> and erp.bomNo = #{bomNo}</if>
<if test="materialName != null and materialName != ''"> and erp.material_name like concat('%', #{materialName}, '%')</if>
<if test="auditStatus != null and auditStatus != ''"> and erp.audit_status = #{auditStatus}</if>
<if test="useStatus != null and useStatus != ''"> and erp.use_status = #{useStatus}</if>
<if test="materialType != null and materialType != ''"> and erp.material_type = #{materialType}</if>
<if test="processMethod != null and processMethod != ''"> and erp.process_method = #{processMethod}</if>
<if test="unit != null and unit != ''"> and erp.unit = #{unit}</if>
<if test="brand != null and brand != ''"> and erp.brand = #{brand}</if>
<if test="describe != null and describe != ''"> and erp.`describe` = #{describe}</if>
<if test="useNum != null "> and erp.use_num = #{useNum}</if>
<if test="lossRate != null "> and erp.loss_rate = #{lossRate}</if>
<if test="parentId != null "> and erp.parent_id = #{parentId}</if>
<if test="level != null "> and erp.level = #{level}</if>
<if test="sortNo != null "> and erp.sort_no = #{sortNo}</if>
<if test="instanceId != null and instanceId != ''"> and erp.instance_id = #{instanceId}</if>
<if test="instanceType != null and instanceType != ''"> and erp.instance_type = #{instanceType}</if>
<if test="submitInstanceId != null and submitInstanceId != ''"> and erp.submit_instance_id = #{submitInstanceId}</if>
<if test="cancelInstanceId != null and cancelInstanceId != ''"> and erp.cancel_instance_id = #{cancelInstanceId}</if>
<if test="restoreInstanceId != null and restoreInstanceId != ''"> and erp.restore_instance_id = #{restoreInstanceId}</if>
<if test="applyTitle != null and applyTitle != ''"> and erp.apply_title = #{applyTitle}</if>
<if test="applyUser != null and applyUser != ''"> and erp.apply_user = #{applyUser}</if>
<if test="applyTime != null "> and erp.apply_time = #{applyTime}</if>
<if test="keyword != null and keyword != ''"> and (erp.material_no like concat('%',#{keyword},'%') or erp.material_name like concat('%',#{keyword},'%'))</if>
and erp.bom_no != ''
</where>
order by erp.update_time desc
</select>
<select id="selectErpBomList1" resultMap="ErpBomResult">
select distinct bom_no, id, create_by, create_time, update_by, update_time, remark,
select bom_no, id, create_by, create_time, update_by, update_time, remark,
material_no, material_name, material_type, process_method, unit,
brand, `describe`, use_num, loss_rate, parent_id, `level`,
sort_no, audit_status, use_status from erp_bom
where bom_no != "" and del_flag = '0' ORDER BY id DESC;
where bom_no != "" ORDER BY id DESC;
</select>
<select id="selectErpBomById" parameterType="Long" resultMap="ErpBomResult">
<include refid="selectErpBomVo"/>
where id = #{id}
select erp.id, erp.del_flag, erp.create_by, erp.create_time, erp.update_by, erp.update_time, erp.remark,erp.bom_no, erp.material_no
, erp.material_name, erp.audit_status, erp.use_status, erp.material_type
, erp.process_method, erp.unit, erp.brand, erp.describe, erp.use_num, erp.loss_rate, erp.parent_id, erp.level, erp.sort_no
,erp.instance_id,erp.instance_type,erp.submit_instance_id,erp.cancel_instance_id,erp.restore_instance_id,erp.apply_title,erp.apply_user,erp.apply_time
,att.id as photo_attach_id
from erp_bom erp
left join (
select id,material_no,material_name from erp_material
) erp_material
on erp.material_no = erp_material.material_no
left join sys_attach att
on erp_material.id = att.rel_id and att.source_type = 'erpMaterial' and att.source_sub_type = 'photo'
where erp.id = #{id}
</select>
<select id="selectErpBomSubList" parameterType="ErpBom" resultMap="ErpBomResult">
@ -134,11 +190,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="insertErpBom" parameterType="ErpBom" useGeneratedKeys="true" keyProperty="id">
insert into erp_bom
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="delFlag != null and delFlag!= ''">del_flag,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null and updateBy != ''">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="bomNo != null and bomNo != '' ">bom_no,</if>
<if test="materialNo != null and materialNo != '' ">material_no,</if>
@ -153,15 +206,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="parentId != null">parent_id,</if>
<if test="level != null">`level`,</if>
<if test="sortNo != null">sort_no,</if>
audit_status,
use_status
<if test="auditStatus != null">audit_status,</if>
<if test="useStatus != null">use_status,</if>
<if test="instanceId != null and instanceId != ''">instance_id,</if>
<if test="instanceType != null and instanceType != ''">instance_type,</if>
<if test="submitInstanceId != null and submitInstanceId != ''">submit_instance_id,</if>
<if test="cancelInstanceId != null and cancelInstanceId != ''">cancel_instance_id,</if>
<if test="restoreInstanceId != null and restoreInstanceId != ''">restore_instance_id,</if>
<if test="applyTitle != null and applyTitle != '' ">apply_title,</if>
<if test="applyUser != null">apply_user,</if>
<if test="applyTime != null">apply_time,</if>
del_flag,
create_time,
update_time,
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="delFlag != null and delFlag!= ''">#{delFlag},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null and remark != '' ">#{remark},</if>
<if test="bomNo != null and bomNo != '' ">#{bomNo},</if>
<if test="materialNo != null and materialNo != '' ">#{materialNo},</if>
@ -176,8 +237,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="parentId != null">#{parentId},</if>
<if test="level != null">#{level},</if>
<if test="sortNo != null">#{sortNo},</if>
0,
0
<if test="auditStatus != null">#{auditStatus},</if>
<if test="useStatus != null">#{useStatus},</if>
<if test="instanceId != null and instanceId != ''">#{instanceId},</if>
<if test="instanceType != null and instanceType !=''">#{instanceType},</if>
<if test="submitInstanceId != null and submitInstanceId != ''">#{submitInstanceId},</if>
<if test="cancelInstanceId != null and cancelInstanceId != ''">#{cancelInstanceId},</if>
<if test="restoreInstanceId != null and restoreInstanceId != ''">#{restoreInstanceId},</if>
<if test="applyTitle != null and applyTitle != '' ">#{applyTitle},</if>
<if test="applyUser != null">#{applyUser},</if>
<if test="applyTime != null">#{applyTime},</if>
0,
now(),
now(),
</trim>
</insert>
@ -188,7 +260,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null and remark != '' ">remark = #{remark},</if>
<if test="bomNo != null and bomNo != '' ">bom_no = #{bomNo},</if>
<if test="materialNo != null and materialNo != '' ">material_no = #{materialNo},</if>
@ -203,8 +274,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="parentId != null">parent_id = #{parentId},</if>
<if test="level != null">`level` = #{level},</if>
<if test="sortNo != null">sort_no = #{sortNo},</if>
<if test="auditStatus != null and auditStatus != '' ">audit_status = #{auditStatus},</if>
<if test="useStatus != null and useStatus != '' ">use_status = #{useStatus},</if>
<if test="instanceId != null and instanceId != ''">instance_id = #{instanceId},</if>
<if test="instanceType != null and instanceType!=''">instance_type = #{instanceType},</if>
<if test="submitInstanceId != null and submitInstanceId != ''">submit_instance_id = #{submitInstanceId},</if>
<if test="cancelInstanceId != null and cancelInstanceId != ''">cancel_instance_id = #{cancelInstanceId},</if>
<if test="restoreInstanceId != null and restoreInstanceId != ''">restore_instance_id = #{restoreInstanceId},</if>
<if test="applyTitle != null and applyTitle != '' ">apply_title = #{applyTitle},</if>
<if test="applyUser != null">apply_user = #{applyUser},</if>
<if test="applyTime != null">apply_time = #{applyTime},</if>
update_time = now()
</trim>
where id = #{id}
</update>
@ -276,4 +354,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and material_no = #{materialNo}
</select>
<select id="selectErpBomByMaterialNo" resultMap="ErpBomResult">
select erp.id, erp.del_flag, erp.create_by, erp.create_time, erp.update_by, erp.update_time, erp.remark,erp.bomNo, erp.material_no
,erp.material_name, erp.audit_status, erp.use_status, erp.material_type
,erp.process_method, erp.unit, erp.brand, erp.describe, erp.use_num, erp.loss_rate, erp.parent_id, erp.`level`, erp.sort_no, erp.audit_status, erp.use_status
,erp.instance_id,erp.instance_type,erp.submit_instance_id,erp.cancel_instance_id,erp.restore_instance_id,erp.apply_title,erp.apply_user,erp.apply_time
,att.id as photo_attach_id
from erp_material erp
left join sys_attach att
on erp.id = att.rel_id and att.source_type = 'erpMaterial' and att.source_sub_type = 'photo'
where erp.material_no = #{materialNo}
</select>
</mapper>

3
ruoyi-admin/src/main/resources/mapper/erp/ErpMaterialMapper.xml

@ -47,7 +47,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select erp.id, erp.del_flag, erp.create_by, erp.create_time, erp.update_by, erp.update_time, erp.remark,erp.bomNo, erp.material_no
, erp.material_name, erp.audit_status, erp.use_status, erp.hava_product_tem, erp.product_item,erp.`itemName`, erp.material_type, erp.process_method
, erp.unit, erp.brand, erp.`describe`, erp.warehouse_dept
,erp.instance_id,erp.instance_type,process_type_dict.dict_label as instance_type_name,erp.submit_instance_id,erp.cancel_instance_id,erp.restore_instance_id,erp.apply_title,erp.apply_user,erp.apply_time
,erp.instance_id,erp.instance_type,process_type_dict.dict_label as instance_type_name,
erp.submit_instance_id,erp.cancel_instance_id,erp.restore_instance_id,erp.apply_title,erp.apply_user,erp.apply_time
,file.url as photo_url,cate.name as material_type_name
from erp_material erp
left join(

138
ruoyi-admin/src/main/resources/templates/erp/bom/add.html

@ -22,10 +22,10 @@
<div class="form-group">
<label class="col-sm-3 control-label">物料名称:</label>
<div class="col-sm-8">
<select class="form-control" id="materialName" name="materialName" required>
<!-- <select class="form-control" id="materialName" name="materialName" required>-->
</select>
<!-- <input name="materialName" class="form-control" type="text" readonly>-->
<!-- </select>-->
<input name="materialName" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
@ -35,11 +35,12 @@
<optgroup>
<option value=""></option>
</optgroup>
<optgroup th:each="child: ${childList}" th:label="${child.name}" readonly>
<optgroup th:each="child: ${childList}" th:label="${child.name}">
<option th:each="childSon: ${child.children}" th:value="${childSon.code}" th:text="${#strings.concat(child.name,'-',childSon.name)}"></option>
</optgroup>
</select>
</div>
<input type="text" id="materialType" name="materialType" readonly hidden />
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">加工方式:</label>
@ -133,8 +134,8 @@
focusCleanup: true
});
$(function() {
//todo 物料编号下拉框
$("#materialNo").select2({
theme: "bootstrap",
allowClear: true,
@ -172,69 +173,59 @@
minimumInputLength: 1
}
});
$('#materialNo').on('select2:select', function (e) {
// debugger
var data = e.params.data;
$("#materialName").val(data.materialName).select2("trigger", "select", {
data: { id: data.materialName, text: data.materialName }
})
$("input[name='brand']").val(data.brand);
$("textarea[name='describe']").val(data.describe);
$("#selectMaterialType").val([data.materialType]).trigger("change");
$("#selectProcessMethod").val([data.processMethod]).trigger("change");
$("#selectUnit").val([data.unit]).trigger("change");
});
//todo 物料名称下拉框
$("#materialName").select2({
theme: "bootstrap",
allowClear: true,
placeholder: "请选择一个料号名称",
ajax:{
type: "get",
url:ctx + "erp/material/getMaterialSelList",
dataType:"json",
delay:250,
data:function(params){
var searchVal = params.term;
var obj = {
keyword: searchVal
};
return obj;
},
cache:true,
processResults: function (res, params) {
var options = [];
if(res.code==0){
var resultList = res.data;
console.log(resultList);
for(var i= 0, len=resultList.length;i<len;i++){
var option = resultList[i];
option.id = resultList[i]["materialNo"];
option.text = resultList[i]["materialName"];
options.push(option);
}
}
return {
results: options
};
},
escapeMarkup: function (markup) { return markup; },
minimumInputLength: 1
}
});
$('#materialName').on('select2:select', function (e) {
// debugger
// $("#materialName").select2({
// theme: "bootstrap",
// allowClear: true,
// placeholder: "请选择一个料号名称",
// ajax:{
// type: "get",
// url:ctx + "erp/material/getMaterialSelList",
// dataType:"json",
// delay:250,
// data:function(params){
// var searchVal = params.term;
// var obj = {
// keyword: searchVal
// };
// return obj;
// },
// cache:true,
// processResults: function (res, params) {
// var options = [];
// if(res.code==0){
// var resultList = res.data;
// console.log(resultList);
// for(var i= 0, len=resultList.length;i<len;i++){
// var option = resultList[i];
// option.id = resultList[i]["materialNo"];
// option.text = resultList[i]["materialName"];
// options.push(option);
// }
// }
// return {
// results: options
// };
// },
// escapeMarkup: function (markup) { return markup; },
// minimumInputLength: 1
// }
// });
$('#materialNo').on('select2:select', function (e) {
var data = e.params.data;
$("#materialNo").val(data.materialNo).select2("trigger", "select", {
data: { id: data.materialNo, text: data.materialNo }
});
$("input[name='materialName']").val(data.materialName);
$("input[name='brand']").val(data.brand);
$("textarea[name='describe']").val(data.describe);
$("#selectMaterialType").val([data.materialType]).trigger("change");
$("#selectProcessMethod").val([data.processMethod]).trigger("change");
$("#selectUnit").val([data.unit]).trigger("change");
materilalSelect(data);
});
// $('#materialName').on('select2:select', function (e) {
// // debugger
// var data = e.params.data;
// if(($("#material").select2("val"))!=data.materialNo){
// $("#materialNo").val(data.materialNo);
// materilalSelect(data);
// }else{
// return;
// }
// });
var options = {
id: 'bootstrap-sub-table-1',
showSearch: false,
@ -385,8 +376,21 @@
actions.push('<a class="btn btn-search btn-xs optRow" href="javascript:void(0)"><i class="fa fa-search"></i>选择</a> ');
return actions.join('');
}*/
});
function materilalSelect(data) {
var materialType1 = data.materialType.indexOf('yl');
if(materialType1 != -1){
$.modal.msgError("原料不能作为BOM主体");
$("#materialNo").val('');
$("input[materialName]").val('');
return;
};
$("input[name='brand']").val(data.brand);
$("textarea[name='describe']").val(data.describe);
$("#selectMaterialType").val([data.materialType]).trigger("change");
$("#selectProcessMethod").val([data.processMethod]).trigger("change");
$("#selectUnit").val([data.unit]).trigger("change");
}
/** window.optEvent = {
'click .optRow': function(e, value, row, index) {
console.log("optRow");
@ -429,6 +433,10 @@
console.log(uniqueId);
var iframeWin = window[layero.find('iframe')[0]['name']];
var rowData = iframeWin.$('#bootstrap-select-table').bootstrapTable('getSelections')[0];
if($("#materialNo").val()==rowData.materialNo){
$.modal.alertError("不能选择与主体bom相同的料号");
return;
}
var totalNum = $("#bootstrap-sub-table-1").bootstrapTable('getData').length;
console.log("rowData: "+rowData);
$("#bootstrap-sub-table-1").bootstrapTable('insertRow',{

130
ruoyi-admin/src/main/resources/templates/erp/bom/bom.html

@ -26,11 +26,11 @@
</li>
<li>
<label>物料类型:</label>
<select id="selectMaterialType" class="form-control m-b select2-multiple" th:with="childList=${@category.getChildByCode('materialType')}">
<select readonly id="selectMaterialType" name="materialType" class="form-control m-b select2-multiple" th:with="childList=${@category.getChildByCode('materialType')}" required>
<optgroup>
<option value=""></option>
</optgroup>
<optgroup th:each="child: ${childList}" th:label="${child.name}">
<optgroup th:each="child: ${childList}" th:label="${child.name}">
<option th:each="childSon: ${child.children}" th:value="${childSon.code}" th:text="${#strings.concat(child.name,'-',childSon.name)}"></option>
</optgroup>
</select>
@ -99,7 +99,9 @@
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: select2-js" />
<th:block th:include="include :: bootstrap-table-fixed-columns-js" />
<script th:src="@{/js/activiti.js}"></script>
<script th:src="@{/ajax/libs/vue/vue.js}"></script>
<script th:src="@{/ajax/libs/element-ui/element-ui.js}"></script>
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('erp:bom:edit')}]];
var removeFlag = [[${@permission.hasPermi('erp:bom:remove')}]];
@ -112,10 +114,10 @@
var useStatusDatas = [[${@dict.getType('useStatus')}]];
var prefix = ctx + "erp/bom";
$(function() {
$('#selectMaterialType').on('select2:select', function (e) {
var data = e.params.data;
$("#materialType").val(data.id);
});
// $('#selectMaterialType').on('select2:select', function (e) {
// var data = e.params.data;
// $("#materialType").val(data.id);
// });
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
@ -126,12 +128,11 @@
exportUrl: prefix + "/export",
importUrl: prefix + "/importData",
importTemplateUrl: prefix + "/importTemplate",
fixedColumns:true,
fixedRightNumber:1,
fixedNumber:1,
modalName: "bom",
detailView: true,
//指定父id列
rightFixedColumns: true, // 是否启用冻结列(右侧)
fixedRightNumber: 1,
//指定父id列
onExpandRow : function(index, row, $detail) {
$detail.html('<h4>一阶</h4><table class="table-container" id="one_level_table_'+row.id+'"></table>' +
'<h4>多阶</h4><table class="table-container" id="all_level_table_'+row.id+'"></table>'
@ -148,6 +149,65 @@
field: 'id',
title: '主键ID'
},
{
field: 'instanceId',
title: '流程实例ID',
visible: false
},
{
field: 'submitInstanceId',
title: '流程提交实例ID',
visible: false
},
{
field: 'cancelInstanceId',
title: '流程作废实例ID',
visible: false
},
{
field: 'restoreInstanceId',
title: '流程恢复实例ID',
visible: false
},
{
field: 'instanceTypeName',
title: '流程实例类型',
visible: false
},
{
field: 'applyUser',
title: '申请人ID',
visible: false
},
{
field: 'applyUserName',
title: '<span style="color: red;">申请人</span>',
formatter: function(value, row, index) {
return '<span style="color: red;">' + (value ? value : "-") + '</span>';
}
},
{
field: 'applyTime',
title: '申请时间'
},
{
field: 'taskId',
title: '当前任务ID',
visible: false
},
{
field: 'todoUserId',
title: '待办用户ID',
visible: false
},
{
field: 'taskName',
title: '当前任务名称',
align: 'center',
formatter: function(value, row, index) {
return '<span class="badge badge-primary">' + value + '</span>';
}
},
{
field: 'auditStatus',
title: '审核状态',
@ -305,7 +365,51 @@
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.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
// 审核状态-审核通过 使用状态-是 未发起作废流程
if(row.auditStatus=="1" && row.useStatus=="1" && !row.cancelInstanceId){
// 作废
actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="$.operate.cancel(\'' + row.id + '\')"><i class="fa fa-remove"></i> 作废</a>');
// 编辑
actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i> 编辑</a> ');
}
// 已作废
if(row.useStatus=="2" && !row.restoreInstanceId){
// 恢复
actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="$.operate.restore(\'' + row.id + '\')"><i class="fa fa-window-restore"></i> 恢复</a> ');
}
// 有流程实例id
if (row.instanceId) {
// 有待办人展示审批按钮,
if (row.todoUserId) {
var todoUserIdList = row.todoUserId.split(",");
if(todoUserIdList.includes(loginName) || loginName == 'admin'){
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-primary btn-xs" href="javascript:void(0)" onclick="$.operate.detail(\'' + row.id + '\')"><i class="fa fa-eye"></i> 详情</a> ');
/*actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-primary btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="showdetails(\'' + index + '\')"><i class="fa fa-eye"></i>详情</a> ');
actions.push('<a class="btn btn-success btn-xs ' + auditFlag + '" href="javascript:void(0)" onclick="showMaterial(\'' + index + '\')"><i class="fa fa-file-o"></i>审核</a> ');
if(row.delFlag == '0'){
actions.push('<a class="btn btn-danger btn-xs ' + cancelFlag + '" href="javascript:void(0)" onclick="$.operate.cancel(\'' + row.id + '\')"><i class="fa fa-remove"></i>作废</a>');
}else{
actions.push('<a class="btn btn-success btn-xs ' + restoreFlag + '" href="javascript:void(0)" onclick="$.operate.restore(\'' + row.id + '\')"><i class="fa fa-window-restore"></i>恢复</a>');
}*/
return actions.join('');
}
/** formatter: function(value, row, index) {
var actions = [];
if(row.auditStatus == '0' && row.useStatus == '0'){
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>审核</a> ');
}
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a> ');
if(row.delFlag == '0'){
actions.push('<a class="btn btn-danger btn-xs ' + cancelFlag + '" href="javascript:void(0)" onclick="$.operate.cancel(\'' + row.id + '\')"><i class="fa fa-remove"></i>作废</a> ');
@ -313,7 +417,7 @@
actions.push('<a class="btn btn-success btn-xs ' + restoreFlag + '" href="javascript:void(0)" onclick="$.operate.restore(\'' + row.id + '\')"><i class="fa fa-window-restore"></i>恢复</a> ');
}
return actions.join('');
}
}**/
}]
};
$.table.init(options);

258
ruoyi-admin/src/main/resources/templates/erp/bom/taskGcjlVerify.html

@ -0,0 +1,258 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('工程经理审核')" />
<th:block th:include="include :: select2-css" />
<link th:href="@{/ajax/libs/element-ui/element-ui.css}" rel="stylesheet"/>
</head>
<body class="white-bg">
<div id="app" class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-edit" th:object="${formData}">
<input name="id" th:field="*{id}" type="hidden">
<input name="taskId" th:field="*{taskId}" 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 id="materialNo" name="materialNo" th:field="*{materialNo}" 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="materialName" th:field="*{materialName}" 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">
<select id="selectMaterialType" class="form-control m-b select2-multiple" th:with="childList=${@category.getChildByCode('materialType')}" disabled>
<optgroup>
<option value="">请选择</option>
</optgroup>
<optgroup th:each="child: ${childList}" th:label="${child.name}">
<option th:each="childSon: ${child.children}" th:value="${childSon.code}" th:text="${#strings.concat(child.name,'-',childSon.name)}"></option>
</optgroup>
</select>
</div>
<input type="text" id="materialType" name="materialType" th:field="*{materialType}" readonly hidden />
</div>
<div class="form-group">
<label class="col-sm-3 control-label">加工方式:</label>
<div class="col-sm-8">
<select name="processMethod" class="form-control m-b" th:with="type=${@dict.getType('processMethod')}" disabled>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{processMethod}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">单位:</label>
<div class="col-sm-8">
<select name="unit" class="form-control m-b" th:with="type=${@dict.getType('sys_unit_class')}" disabled>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{unit}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">品牌:</label>
<div class="col-sm-8">
<input name="brand" th:field="*{brand}" 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">
<textarea name="describe" class="form-control" readonly>[[*{describe}]]</textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">照片:</label>
<div class="col-sm-8">
<el-upload
:disabled="true"
:action="fileUploadUrl"
:on-success="uploadSuccess"
:on-remove="uploadRemove"
:file-list="fileList"
list-type="picture"
accept=".jpg,.png"
multiple>
<el-button size="small" type="primary">点击上传</el-button>
<div slot="tip" class="el-upload__tip">只能上传jpg/png文件,第一张图片为主图</div>
</el-upload>
</div>
<input id="photoAttachId" name = "photoAttachId" th:field="*{photoAttachId}" hidden readonly>
<input id="fileIdStr" type="text" name="fileIdStr" th:field="*{fileIdStr}" hidden readonly>
<input id="removeFileIdStr" type="text" name="removeFileIdStr" hidden readonly>
</div>
<hr />
<div class="form-group">
<label class="col-sm-3 control-label" for="gcjlVerifyApproved"><span style="color: red; ">*</span>审批意见:</label>
<div class="col-sm-8">
<select name="p_B_gcjlVerifyApproved" id="gcjlVerifyApproved" 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>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: select2-js" />
<script th:src="@{/js/activiti.js}"></script>
<script th:src="@{/ajax/libs/vue/vue.js}"></script>
<script th:src="@{/ajax/libs/element-ui/element-ui.js}"></script>
<script type="text/javascript">
new Vue({
el: '#app',
data: function() {
return {
fileList: [],
fileUploadUrl: ctx + "common/uploadSingleFile",
fileDeleteUrl: ctx + "common/deleteFile",
getListByAttachIdUrl: ctx + "system/attach/file/getListByAttachId",
fileIdList:[],
removeFileIdList:[],
}
},
mounted() {
// 控制下拉框选中
var materialType = $("#materialType").val();
$("#selectMaterialType").val(materialType).trigger("change");
var that = this;
// 页面渲染完成,可以执行需要的操作
console.log('页面已渲染完成');
console.log($("#id").val());
console.log($("#photoAttachId").val());
var attachId = $("#photoAttachId").val();
if(attachId){
$.ajax({
type: "get",
url: that.getListByAttachIdUrl,
data: {attachId:attachId},
cache: false,
async: false, // 设置成同步
dataType: 'json',
success: function(result) {
if (result.code == web_status.SUCCESS) {
result.data.forEach((item) => {
that.fileIdList.push(item.id);
that.fileList.push({name: item.name, url: item.url, attachFileId: item.id,isBind:true});
});
} else {
$.modal.msgError(result.msg);
}
},
error: function(error) {
$.modal.msgError("获取附件失败。");
}
});
}
},
methods: {
uploadSuccess(response, file, fileList) {
console.log(response);
if(response.code == web_status.SUCCESS){
var attachFileId = response.data.id;
file.attachFileId = attachFileId;
file.isBind = false;
this.fileIdList.push(attachFileId);
$("#fileIdStr").val(this.fileIdList.join(";"));
$.modal.msgSuccess("上传成功");
}else{
$.modal.alertError(response.msg);
}
},
uploadRemove(file, fileList) {
console.log(file, fileList);
var attachFileId = file.attachFileId;
var isBind = file.isBind;
if(isBind==false){
$.ajax({
type: "get",
url: this.fileDeleteUrl,
data: {id:attachFileId},
cache: false,
async: false, // 设置成同步
dataType: 'json',
success: function(result) {
if (result.code == web_status.SUCCESS) {
var index = this.fileIdList.indexOf(attachFileId);
if(index!=-1){
this.fileIdList.splice(index,1);
$("#fileIdStr").val(this.fileIdList.join(";"));
}
$.modal.msgSuccess("删除附件成功。");
} else {
$.modal.alertError(result.msg);
}
},
error: function(error) {
$.modal.alertError("删除附件失败。");
}
});
}else{
var index = this.fileIdList.indexOf(attachFileId);
if(index!=-1){
this.fileIdList.splice(index,1);
$("#fileIdStr").val(this.fileIdList.join(";"));
// 保存的时候才删除
this.removeFileIdList.push(attachFileId);
$("#removeFileIdStr").val(this.removeFileIdList.join(";"));
}
}
},
}
})
var prefix = ctx + "erp/material";
$("#form-edit").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
var materialType = $('#selectMaterialType').select2('val');
$('#materialType').val(materialType);
if ($('textarea[name="comment"]').val()) {
$('input[name="p_COM_comment"]').val($('textarea[name="comment"]').val());
}
var taskId = [[${taskId}]];
$.operate.save(prefix + "/complete/" + taskId, $('#form-edit').serialize());
}
}
</script>
</body>
</html>

266
ruoyi-admin/src/main/resources/templates/erp/bom/taskGczgVerify.html

@ -0,0 +1,266 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('工程主管审核')" />
<th:block th:include="include :: select2-css" />
<link th:href="@{/ajax/libs/element-ui/element-ui.css}" rel="stylesheet"/>
</head>
<body class="white-bg">
<div id="app" class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-edit" th:object="${formData}">
<input name="id" th:field="*{id}" type="hidden">
<input name="taskId" th:field="*{taskId}" 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 id="materialNo" name="materialNo" th:field="*{materialNo}" 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="materialName" th:field="*{materialName}" 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">
<select id="selectMaterialType" class="form-control m-b select2-multiple" th:with="childList=${@category.getChildByCode('materialType')}" disabled>
<optgroup>
<option value="">请选择</option>
</optgroup>
<optgroup th:each="child: ${childList}" th:label="${child.name}">
<option th:each="childSon: ${child.children}" th:value="${childSon.code}" th:text="${#strings.concat(child.name,'-',childSon.name)}"></option>
</optgroup>
</select>
</div>
<input type="text" id="materialType" name="materialType" th:field="*{materialType}" readonly hidden />
</div>
<div class="form-group">
<label class="col-sm-3 control-label">加工方式:</label>
<div class="col-sm-8">
<select name="processMethod" class="form-control m-b" th:with="type=${@dict.getType('processMethod')}" disabled>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{processMethod}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">单位:</label>
<div class="col-sm-8">
<select name="unit" class="form-control m-b" th:with="type=${@dict.getType('sys_unit_class')}" disabled>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{unit}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">品牌:</label>
<div class="col-sm-8">
<input name="brand" th:field="*{brand}" 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">
<textarea name="describe" class="form-control" readonly>[[*{describe}]]</textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">入库部门:</label>
<div class="col-sm-8">
<select name="warehouseDept" class="form-control m-b" th:with="type=${@dict.getType('warehouseDept')}" disabled>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{warehouseDept}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">照片:</label>
<div class="col-sm-8">
<el-upload
v-if="!isReadOnly"
:action="fileUploadUrl"
:on-success="uploadSuccess"
:on-remove="uploadRemove"
:file-list="fileList"
list-type="picture"
accept=".jpg,.png"
multiple>
<el-button size="small" type="primary">点击上传</el-button>
<div slot="tip" class="el-upload__tip">只能上传jpg/png文件,第一张图片为主图</div>
</el-upload>
</div>
<input id="photoAttachId" name = "photoAttachId" th:field="*{photoAttachId}" hidden readonly>
<input id="fileIdStr" type="text" name="fileIdStr" th:field="*{fileIdStr}" hidden readonly>
<input id="removeFileIdStr" type="text" name="removeFileIdStr" hidden readonly>
</div>
<hr />
<div class="form-group">
<label class="col-sm-3 control-label" for="gczgVerifyApproved"><span style="color: red; ">*</span>审批意见:</label>
<div class="col-sm-8">
<select name="p_B_gczgVerifyApproved" id="gczgVerifyApproved" 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>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: select2-js" />
<script th:src="@{/js/activiti.js}"></script>
<script th:src="@{/ajax/libs/vue/vue.js}"></script>
<script th:src="@{/ajax/libs/element-ui/element-ui.js}"></script>
<script type="text/javascript">
new Vue({
el: '#app',
data: function() {
return {
fileList: [],
fileUploadUrl: ctx + "common/uploadSingleFile",
fileDeleteUrl: ctx + "common/deleteFile",
getListByAttachIdUrl: ctx + "system/attach/file/getListByAttachId",
fileIdList:[],
removeFileIdList:[],
isReadOnly: true // 设置为 true 则隐藏 el-upload
}
},
mounted() {
// 控制下拉框选中
var materialType = $("#materialType").val();
$("#selectMaterialType").val(materialType).trigger("change");
var that = this;
// 页面渲染完成,可以执行需要的操作
console.log('页面已渲染完成');
console.log($("#id").val());
console.log($("#photoAttachId").val());
var attachId = $("#photoAttachId").val();
if(attachId){
$.ajax({
type: "get",
url: that.getListByAttachIdUrl,
data: {attachId:attachId},
cache: false,
async: false, // 设置成同步
dataType: 'json',
success: function(result) {
if (result.code == web_status.SUCCESS) {
result.data.forEach((item) => {
that.fileIdList.push(item.id);
that.fileList.push({name: item.name, url: item.url, attachFileId: item.id,isBind:true});
});
} else {
$.modal.msgError(result.msg);
}
},
error: function(error) {
$.modal.msgError("获取附件失败。");
}
});
}
},
methods: {
uploadSuccess(response, file, fileList) {
console.log(response);
if(response.code == web_status.SUCCESS){
var attachFileId = response.data.id;
file.attachFileId = attachFileId;
file.isBind = false;
this.fileIdList.push(attachFileId);
$("#fileIdStr").val(this.fileIdList.join(";"));
$.modal.msgSuccess("上传成功");
}else{
$.modal.alertError(response.msg);
}
},
uploadRemove(file, fileList) {
console.log(file, fileList);
var attachFileId = file.attachFileId;
var isBind = file.isBind;
if(isBind==false){
$.ajax({
type: "get",
url: this.fileDeleteUrl,
data: {id:attachFileId},
cache: false,
async: false, // 设置成同步
dataType: 'json',
success: function(result) {
if (result.code == web_status.SUCCESS) {
var index = this.fileIdList.indexOf(attachFileId);
if(index!=-1){
this.fileIdList.splice(index,1);
$("#fileIdStr").val(this.fileIdList.join(";"));
}
$.modal.msgSuccess("删除附件成功。");
} else {
$.modal.alertError(result.msg);
}
},
error: function(error) {
$.modal.alertError("删除附件失败。");
}
});
}else{
var index = this.fileIdList.indexOf(attachFileId);
if(index!=-1){
this.fileIdList.splice(index,1);
$("#fileIdStr").val(this.fileIdList.join(";"));
// 保存的时候才删除
this.removeFileIdList.push(attachFileId);
$("#removeFileIdStr").val(this.removeFileIdList.join(";"));
}
}
},
}
})
var prefix = ctx + "erp/material";
$("#form-edit").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
var materialType = $('#selectMaterialType').select2('val');
$('#materialType').val(materialType);
if ($('textarea[name="comment"]').val()) {
$('input[name="p_COM_comment"]').val($('textarea[name="comment"]').val());
}
var taskId = [[${taskId}]];
$.operate.save(prefix + "/complete/" + taskId, $('#form-edit').serialize());
}
}
</script>
</body>
</html>

277
ruoyi-admin/src/main/resources/templates/erp/bom/taskModifyApply.html

@ -0,0 +1,277 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('驳回调整')" />
<th:block th:include="include :: select2-css" />
<link th:href="@{/ajax/libs/element-ui/element-ui.css}" rel="stylesheet"/>
</head>
<body class="white-bg">
<div id="app" class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-edit" th:object="${formData}">
<input name="id" th:field="*{id}" type="hidden">
<input name="taskId" th:field="*{taskId}" 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 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 id="materialNo" name="materialNo" th:field="*{materialNo}" class="form-control" type="text" >
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">物料名称:</label>
<div class="col-sm-8">
<input name="materialName" th:field="*{materialName}" 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="selectMaterialType" class="form-control m-b select2-multiple" th:with="childList=${@category.getChildByCode('materialType')}" >
<optgroup>
<option value="">请选择</option>
</optgroup>
<optgroup th:each="child: ${childList}" th:label="${child.name}">
<option th:each="childSon: ${child.children}" th:value="${childSon.code}" th:text="${#strings.concat(child.name,'-',childSon.name)}"></option>
</optgroup>
</select>
</div>
<input type="text" id="materialType" name="materialType" th:field="*{materialType}" hidden />
</div>
<div class="form-group">
<label class="col-sm-3 control-label">加工方式:</label>
<div class="col-sm-8">
<select name="processMethod" class="form-control m-b" th:with="type=${@dict.getType('processMethod')}" >
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{processMethod}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">单位:</label>
<div class="col-sm-8">
<select name="unit" class="form-control m-b" th:with="type=${@dict.getType('sys_unit_class')}" >
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{unit}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">品牌:</label>
<div class="col-sm-8">
<input name="brand" th:field="*{brand}" class="form-control" type="text" >
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">描述:</label>
<div class="col-sm-8">
<textarea name="describe" class="form-control" >[[*{describe}]]</textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">照片:</label>
<div class="col-sm-8">
<el-upload
:action="fileUploadUrl"
:on-success="uploadSuccess"
:on-remove="uploadRemove"
:file-list="fileList"
list-type="picture"
accept=".jpg,.png"
multiple>
<el-button size="small" type="primary">点击上传</el-button>
<div slot="tip" class="el-upload__tip">只能上传jpg/png文件,第一张图片为主图</div>
</el-upload>
</div>
<input id="photoAttachId" name = "photoAttachId" th:field="*{photoAttachId}" hidden >
<input id="fileIdStr" type="text" name="fileIdStr" th:field="*{fileIdStr}" hidden >
<input id="removeFileIdStr" type="text" name="removeFileIdStr" hidden >
</div>
<hr />
<div class="form-group">
<label class="col-sm-3 control-label" for="reApply">是否继续申请:</label>
<div class="col-sm-8">
<select id="reApply" name="p_B_reApply" class="form-control m-b">
<option value="true">重新申请</option>
<option value="false">结束流程</option>
</select>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: select2-js" />
<script th:src="@{/js/activiti.js}"></script>
<script th:src="@{/ajax/libs/vue/vue.js}"></script>
<script th:src="@{/ajax/libs/element-ui/element-ui.js}"></script>
<script type="text/javascript">
new Vue({
el: '#app',
data: function() {
return {
fileList: [],
fileUploadUrl: ctx + "common/uploadSingleFile",
fileDeleteUrl: ctx + "common/deleteFile",
getListByAttachIdUrl: ctx + "system/attach/file/getListByAttachId",
fileIdList:[],
removeFileIdList:[],
}
},
mounted() {
// 控制下拉框选中
var materialType = $("#materialType").val();
$("#selectMaterialType").val(materialType).trigger("change");
var that = this;
// 页面渲染完成,可以执行需要的操作
console.log('页面已渲染完成');
console.log($("#id").val());
console.log($("#photoAttachId").val());
var attachId = $("#photoAttachId").val();
if(attachId){
$.ajax({
type: "get",
url: that.getListByAttachIdUrl,
data: {attachId:attachId},
cache: false,
async: false, // 设置成同步
dataType: 'json',
success: function(result) {
if (result.code == web_status.SUCCESS) {
result.data.forEach((item) => {
that.fileIdList.push(item.id);
that.fileList.push({name: item.name, url: item.url, attachFileId: item.id,isBind:true});
});
} else {
$.modal.msgError(result.msg);
}
},
error: function(error) {
$.modal.msgError("获取附件失败。");
}
});
}
},
methods: {
uploadSuccess(response, file, fileList) {
console.log(response);
if(response.code == web_status.SUCCESS){
var attachFileId = response.data.id;
file.attachFileId = attachFileId;
file.isBind = false;
this.fileIdList.push(attachFileId);
$("#fileIdStr").val(this.fileIdList.join(";"));
$.modal.msgSuccess("上传成功");
}else{
$.modal.alertError(response.msg);
}
},
uploadRemove(file, fileList) {
console.log(file, fileList);
var attachFileId = file.attachFileId;
var isBind = file.isBind;
if(isBind==false){
$.ajax({
type: "get",
url: this.fileDeleteUrl,
data: {id:attachFileId},
cache: false,
async: false, // 设置成同步
dataType: 'json',
success: function(result) {
if (result.code == web_status.SUCCESS) {
var index = this.fileIdList.indexOf(attachFileId);
if(index!=-1){
this.fileIdList.splice(index,1);
$("#fileIdStr").val(this.fileIdList.join(";"));
}
$.modal.msgSuccess("删除附件成功。");
} else {
$.modal.alertError(result.msg);
}
},
error: function(error) {
$.modal.alertError("删除附件失败。");
}
});
}else{
var index = this.fileIdList.indexOf(attachFileId);
if(index!=-1){
this.fileIdList.splice(index,1);
$("#fileIdStr").val(this.fileIdList.join(";"));
// 保存的时候才删除
this.removeFileIdList.push(attachFileId);
$("#removeFileIdStr").val(this.removeFileIdList.join(";"));
}
}
},
}
})
var prefix = ctx + "erp/material";
$("#form-edit").validate({
onkeyup: false,
rules:{
materialNo:{
isInteger: true,
minlength: 10,
maxlength: 10,
// remote: {
// url: prefix + "/checkMaterialNoUnique",
// type: "post",
// dataType: "json",
// data: {
// "materialNo": function() {
// console.log($("#materialNo").val())
// return $.common.trim($("#materialNo").val());
// }
// },
// dataFilter: function(data, type) {
// return $.validate.unique(data);
// }
// }
},
},
messages: {
"materialNo": {
// remote: "料号已经存在",
minlength: "请输入10位整数",
maxlength: "请输入10位整数",
},
},
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
var materialType = $('#selectMaterialType').select2('val');
$('#materialType').val(materialType);
var taskId = [[${taskId}]];
$.operate.save(prefix + "/complete/" + taskId, $('#form-edit').serialize());
}
}
</script>
</body>
</html>

258
ruoyi-admin/src/main/resources/templates/erp/bom/taskYfzjVerify.html

@ -0,0 +1,258 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('研发总监审核')" />
<th:block th:include="include :: select2-css" />
<link th:href="@{/ajax/libs/element-ui/element-ui.css}" rel="stylesheet"/>
</head>
<body class="white-bg">
<div id="app" class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-edit" th:object="${formData}">
<input name="id" th:field="*{id}" type="hidden">
<input name="taskId" th:field="*{taskId}" 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 id="materialNo" name="materialNo" th:field="*{materialNo}" 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="materialName" th:field="*{materialName}" 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">
<select id="selectMaterialType" class="form-control m-b select2-multiple" th:with="childList=${@category.getChildByCode('materialType')}" disabled>
<optgroup>
<option value="">请选择</option>
</optgroup>
<optgroup th:each="child: ${childList}" th:label="${child.name}">
<option th:each="childSon: ${child.children}" th:value="${childSon.code}" th:text="${#strings.concat(child.name,'-',childSon.name)}"></option>
</optgroup>
</select>
</div>
<input type="text" id="materialType" name="materialType" th:field="*{materialType}" readonly hidden />
</div>
<div class="form-group">
<label class="col-sm-3 control-label">加工方式:</label>
<div class="col-sm-8">
<select name="processMethod" class="form-control m-b" th:with="type=${@dict.getType('processMethod')}" disabled>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{processMethod}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">单位:</label>
<div class="col-sm-8">
<select name="unit" class="form-control m-b" th:with="type=${@dict.getType('sys_unit_class')}" disabled>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{unit}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">品牌:</label>
<div class="col-sm-8">
<input name="brand" th:field="*{brand}" 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">
<textarea name="describe" class="form-control" readonly>[[*{describe}]]</textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">照片:</label>
<div class="col-sm-8">
<el-upload
:disabled="true"
:action="fileUploadUrl"
:on-success="uploadSuccess"
:on-remove="uploadRemove"
:file-list="fileList"
list-type="picture"
accept=".jpg,.png"
multiple>
<el-button size="small" type="primary">点击上传</el-button>
<div slot="tip" class="el-upload__tip">只能上传jpg/png文件,第一张图片为主图</div>
</el-upload>
</div>
<input id="photoAttachId" name = "photoAttachId" th:field="*{photoAttachId}" hidden readonly>
<input id="fileIdStr" type="text" name="fileIdStr" th:field="*{fileIdStr}" hidden readonly>
<input id="removeFileIdStr" type="text" name="removeFileIdStr" hidden readonly>
</div>
<hr />
<div class="form-group">
<label class="col-sm-3 control-label" for="yfzjVerifyApproved"><span style="color: red; ">*</span>审批意见:</label>
<div class="col-sm-8">
<select name="p_B_yfzjVerifyApproved" id="yfzjVerifyApproved" 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>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: select2-js" />
<script th:src="@{/js/activiti.js}"></script>
<script th:src="@{/ajax/libs/vue/vue.js}"></script>
<script th:src="@{/ajax/libs/element-ui/element-ui.js}"></script>
<script type="text/javascript">
new Vue({
el: '#app',
data: function() {
return {
fileList: [],
fileUploadUrl: ctx + "common/uploadSingleFile",
fileDeleteUrl: ctx + "common/deleteFile",
getListByAttachIdUrl: ctx + "system/attach/file/getListByAttachId",
fileIdList:[],
removeFileIdList:[],
}
},
mounted() {
// 控制下拉框选中
var materialType = $("#materialType").val();
$("#selectMaterialType").val(materialType).trigger("change");
var that = this;
// 页面渲染完成,可以执行需要的操作
console.log('页面已渲染完成');
console.log($("#id").val());
console.log($("#photoAttachId").val());
var attachId = $("#photoAttachId").val();
if(attachId){
$.ajax({
type: "get",
url: that.getListByAttachIdUrl,
data: {attachId:attachId},
cache: false,
async: false, // 设置成同步
dataType: 'json',
success: function(result) {
if (result.code == web_status.SUCCESS) {
result.data.forEach((item) => {
that.fileIdList.push(item.id);
that.fileList.push({name: item.name, url: item.url, attachFileId: item.id,isBind:true});
});
} else {
$.modal.msgError(result.msg);
}
},
error: function(error) {
$.modal.msgError("获取附件失败。");
}
});
}
},
methods: {
uploadSuccess(response, file, fileList) {
console.log(response);
if(response.code == web_status.SUCCESS){
var attachFileId = response.data.id;
file.attachFileId = attachFileId;
file.isBind = false;
this.fileIdList.push(attachFileId);
$("#fileIdStr").val(this.fileIdList.join(";"));
$.modal.msgSuccess("上传成功");
}else{
$.modal.alertError(response.msg);
}
},
uploadRemove(file, fileList) {
console.log(file, fileList);
var attachFileId = file.attachFileId;
var isBind = file.isBind;
if(isBind==false){
$.ajax({
type: "get",
url: this.fileDeleteUrl,
data: {id:attachFileId},
cache: false,
async: false, // 设置成同步
dataType: 'json',
success: function(result) {
if (result.code == web_status.SUCCESS) {
var index = this.fileIdList.indexOf(attachFileId);
if(index!=-1){
this.fileIdList.splice(index,1);
$("#fileIdStr").val(this.fileIdList.join(";"));
}
$.modal.msgSuccess("删除附件成功。");
} else {
$.modal.alertError(result.msg);
}
},
error: function(error) {
$.modal.alertError("删除附件失败。");
}
});
}else{
var index = this.fileIdList.indexOf(attachFileId);
if(index!=-1){
this.fileIdList.splice(index,1);
$("#fileIdStr").val(this.fileIdList.join(";"));
// 保存的时候才删除
this.removeFileIdList.push(attachFileId);
$("#removeFileIdStr").val(this.removeFileIdList.join(";"));
}
}
},
}
})
var prefix = ctx + "erp/material";
$("#form-edit").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
var materialType = $('#selectMaterialType').select2('val');
$('#materialType').val(materialType);
if ($('textarea[name="comment"]').val()) {
$('input[name="p_COM_comment"]').val($('textarea[name="comment"]').val());
}
var taskId = [[${taskId}]];
$.operate.save(prefix + "/complete/" + taskId, $('#form-edit').serialize());
}
}
</script>
</body>
</html>

5
ruoyi-admin/src/main/resources/templates/erp/material/material.html

@ -49,6 +49,9 @@
<li>
<label>物料类型:</label>
<select name="materialType" id="selectMaterialType" th:with="childList=${@category.getChildByCode('materialType')}">
<optgroup>
<option value="">所有</option>
</optgroup>
<optgroup th:each="child: ${childList}" th:label="${child.name}">
<option th:each="childSon: ${child.children}" th:value="${childSon.code}" th:text="${#strings.concat(child.name,'-',childSon.name)}"></option>
</optgroup>
@ -676,7 +679,7 @@
// 有待办人展示审批按钮,
if (row.todoUserId) {
var todoUserIdList = row.todoUserId.split(",");
if(todoUserIdList.includes(loginName)){
if(todoUserIdList.includes(loginName) || loginName == 'admin'){
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> ');
}

2
ruoyi-admin/src/main/resources/templates/system/makeorder/makeorder.html

@ -118,6 +118,8 @@
restoreUrl: prefix + "/restore/{id}",
exportUrl: prefix + "/export",
modalName: "生产订单",
fixedColumns: true, // 启用冻结列
fixedRightNumber: 1, // 冻结右列个数
columns: [{
checkbox: true
},

2
ruoyi-admin/src/main/resources/templates/system/model/model.html

@ -94,6 +94,8 @@
restoreUrl: prefix + "/restore/{id}",
exportUrl: prefix + "/export",
modalName: "产品型号管理",
fixedColumns: true, // 启用冻结列
fixedRightNumber: 1, // 冻结右列个数
columns: [{
checkbox: true
},

Loading…
Cancel
Save