From 9a62fbe233ff80ba397c9a3c4d8b0e843bc8bde8 Mon Sep 17 00:00:00 2001 From: zhaoxiaolin Date: Mon, 24 Jul 2023 17:37:24 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E7=AE=A1=E7=90=86=E7=9A=84?= =?UTF-8?q?=E9=83=A8=E9=97=A8sql=E4=BF=AE=E6=94=B9=EF=BC=9B=E5=B7=A5?= =?UTF-8?q?=E8=89=BA=E5=8A=A0=E6=98=AF=E5=90=A6=E9=9C=80=E8=A6=81=E9=A6=96?= =?UTF-8?q?=E6=A3=80=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datascope/aspect/DataScopeAspect.java | 2 +- .../op-job/src/main/resources/bootstrap.yml | 6 +- .../op/mes/controller/ProRouteController.java | 32 +-- .../java/com/op/mes/domain/ProRecipe.java | 222 ++++++++++++++++++ .../com/op/mes/domain/ProRecipeContent.java | 178 ++++++++++++++ .../main/java/com/op/mes/domain/ProRoute.java | 12 + .../service/impl/ProProcessServiceImpl.java | 39 ++- .../resources/mapper/mes/ProRouteMapper.xml | 12 +- .../mapper/mes/ProRouteProcessMapper.xml | 2 - .../resources/mapper/system/SysDeptMapper.xml | 5 +- .../resources/mapper/system/SysUserMapper.xml | 4 +- .../resources/mapper/wms/SysUserMapper.xml | 3 +- 12 files changed, 463 insertions(+), 54 deletions(-) create mode 100644 op-modules/op-mes/src/main/java/com/op/mes/domain/ProRecipe.java create mode 100644 op-modules/op-mes/src/main/java/com/op/mes/domain/ProRecipeContent.java diff --git a/op-common/op-common-datascope/src/main/java/com/op/common/datascope/aspect/DataScopeAspect.java b/op-common/op-common-datascope/src/main/java/com/op/common/datascope/aspect/DataScopeAspect.java index abde8aa0..6e22cfcc 100644 --- a/op-common/op-common-datascope/src/main/java/com/op/common/datascope/aspect/DataScopeAspect.java +++ b/op-common/op-common-datascope/src/main/java/com/op/common/datascope/aspect/DataScopeAspect.java @@ -177,7 +177,7 @@ public class DataScopeAspect { sqlString.append(StringUtils.format(" OR {}.dept_id = {} ", deptAlias, user.getDeptId())); } else if (DATA_SCOPE_DEPT_AND_CHILD.equals(dataScope)) { sqlString.append(StringUtils.format( - " OR {}.dept_id IN ( SELECT dept_id FROM sys_dept WHERE dept_id = {} or find_in_set( {} , ancestors ) )", + " OR {}.dept_id IN ( SELECT dept_id FROM sys_dept WHERE dept_id = {} or CHARINDEX(CONVERT (VARCHAR, {}), ancestors) > 0 )", deptAlias, user.getDeptId(), user.getDeptId())); } else if (DATA_SCOPE_SELF.equals(dataScope)) { if (StringUtils.isNotBlank(userAlias)) { diff --git a/op-modules/op-job/src/main/resources/bootstrap.yml b/op-modules/op-job/src/main/resources/bootstrap.yml index 108a2081..efda0fba 100644 --- a/op-modules/op-job/src/main/resources/bootstrap.yml +++ b/op-modules/op-job/src/main/resources/bootstrap.yml @@ -13,11 +13,13 @@ spring: cloud: nacos: discovery: - namespace: zxl + namespace: lanju-op + group: zxl # 服务注册地址 server-addr: 140.249.53.142:8848 config: - namespace: zxl + namespace: lanju-op + group: zxl #命名空间 #group: local # 配置中心地址 diff --git a/op-modules/op-mes/src/main/java/com/op/mes/controller/ProRouteController.java b/op-modules/op-mes/src/main/java/com/op/mes/controller/ProRouteController.java index 95d568d3..d886594a 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/controller/ProRouteController.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/controller/ProRouteController.java @@ -35,8 +35,7 @@ import org.springframework.web.bind.annotation.RestController; */ @RestController @RequestMapping("/pro/proroute") -public class ProRouteController extends BaseController -{ +public class ProRouteController extends BaseController { @Autowired private IProRouteService proRouteService; @@ -49,8 +48,7 @@ public class ProRouteController extends BaseController */ @RequiresPermissions("mes:pro:process:add") @GetMapping("/list") - public TableDataInfo list(ProRoute proRoute) - { + public TableDataInfo list(ProRoute proRoute) { startPage(); List list = proRouteService.selectProRouteList(proRoute); return getDataTable(list); @@ -62,8 +60,7 @@ public class ProRouteController extends BaseController @RequiresPermissions("mes:pro:proroute:export") @Log(title = "工艺路线", businessType = BusinessType.EXPORT) @PostMapping("/export") - public void export(HttpServletResponse response, ProRoute proRoute) - { + public void export(HttpServletResponse response, ProRoute proRoute) { List list = proRouteService.selectProRouteList(proRoute); ExcelUtil util = new ExcelUtil(ProRoute.class); util.exportExcel(response, list, "工艺路线数据"); @@ -74,8 +71,7 @@ public class ProRouteController extends BaseController */ @RequiresPermissions("mes:pro:proroute:query") @GetMapping(value = "/{routeId}") - public AjaxResult getInfo(@PathVariable("routeId") String routeId) - { + public AjaxResult getInfo(@PathVariable("routeId") String routeId) { return AjaxResult.success(proRouteService.selectProRouteByRouteId(routeId)); } @@ -85,10 +81,9 @@ public class ProRouteController extends BaseController @RequiresPermissions("mes:pro:proroute:add") @Log(title = "工艺路线", businessType = BusinessType.INSERT) @PostMapping - public AjaxResult add(@RequestBody ProRoute proRoute) - { + public AjaxResult add(@RequestBody ProRoute proRoute) { proRoute.setRouteId(IdUtils.fastSimpleUUID()); - if(!proRouteService.checkRouteCodeUnique(proRoute)){ + if (!proRouteService.checkRouteCodeUnique(proRoute)) { return AjaxResult.error("工艺路线编号已存在!"); } return toAjax(proRouteService.insertProRoute(proRoute)); @@ -100,9 +95,8 @@ public class ProRouteController extends BaseController @RequiresPermissions("mes:pro:proroute:edit") @Log(title = "工艺路线", businessType = BusinessType.UPDATE) @PutMapping - public AjaxResult edit(@RequestBody ProRoute proRoute) - { - if(!proRouteService.checkRouteCodeUnique(proRoute)){ + public AjaxResult edit(@RequestBody ProRoute proRoute) { + if (!proRouteService.checkRouteCodeUnique(proRoute)) { return AjaxResult.error("工艺路线编号已存在!"); } return toAjax(proRouteService.updateProRoute(proRoute)); @@ -113,12 +107,10 @@ public class ProRouteController extends BaseController */ @RequiresPermissions("mes:pro:proroute:remove") @Log(title = "工艺路线", businessType = BusinessType.DELETE) - @Transactional - @DeleteMapping("/{routeIds}") - public AjaxResult remove(@PathVariable String[] routeIds) - { - for (String routeId:routeIds - ) { + //@Transactional + @DeleteMapping("/{routeIds}") + public AjaxResult remove(@PathVariable String[] routeIds) { + for (String routeId : routeIds) { proRouteProcessService.deleteByRouteId(routeId); //proRouteProductService.deleteByRouteId(routeId); //proRouteProductBomService.deleteByRouteId(routeId); diff --git a/op-modules/op-mes/src/main/java/com/op/mes/domain/ProRecipe.java b/op-modules/op-mes/src/main/java/com/op/mes/domain/ProRecipe.java new file mode 100644 index 00000000..3ba8ebda --- /dev/null +++ b/op-modules/op-mes/src/main/java/com/op/mes/domain/ProRecipe.java @@ -0,0 +1,222 @@ +package com.op.mes.domain; + +import com.op.common.core.annotation.Excel; +import com.op.common.core.web.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +import java.util.List; + + +/** + * 配药配方对象 pro_process + * + * @author yinjinlu + * @date 2022-05-12 + */ +public class ProRecipe extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 工序ID */ + private String processId; + + /** 工序编码 */ + @Excel(name = "工序编码") + private String processCode; + + /** 工序名称 */ + @Excel(name = "工序名称") + private String processName; + + /** 工艺要求 */ + @Excel(name = "工艺要求") + private String attention; + + /** 是否启用 */ + @Excel(name = "是否启用") + private String enableFlag; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + private String fileList; + private List files; + //s:拆分 m合并 + private String splitMerge; + //拆分合并数量 + private int splitMergNum; + //1允许多单并行 + private String sync; + //工作中心 + private String workCenter; + //工作时长 + private Double workTime; + + public List getFiles() { + return files; + } + + public void setFiles(List files) { + this.files = files; + } + + public String getWorkCenter() { + return workCenter; + } + + public void setWorkCenter(String workCenter) { + this.workCenter = workCenter; + } + + public Double getWorkTime() { + return workTime; + } + + public void setWorkTime(Double workTime) { + this.workTime = workTime; + } + + public String getSplitMerge() { + return splitMerge; + } + + public void setSplitMerge(String splitMerge) { + this.splitMerge = splitMerge; + } + + public int getSplitMergNum() { + return splitMergNum; + } + + public void setSplitMergNum(int splitMergNum) { + this.splitMergNum = splitMergNum; + } + + public String getSync() { + return sync; + } + + public void setSync(String sync) { + this.sync = sync; + } + + public String getFileList() { + return fileList; + } + + public void setFileList(String fileList) { + this.fileList = fileList; + } + + public void setProcessId(String processId) + { + this.processId = processId; + } + + public String getProcessId() + { + return processId; + } + public void setProcessCode(String processCode) + { + this.processCode = processCode; + } + + public String getProcessCode() + { + return processCode; + } + public void setProcessName(String processName) + { + this.processName = processName; + } + + public String getProcessName() + { + return processName; + } + public void setAttention(String attention) + { + this.attention = attention; + } + + public String getAttention() + { + return attention; + } + public void setEnableFlag(String enableFlag) + { + this.enableFlag = enableFlag; + } + + public String getEnableFlag() + { + return enableFlag; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("processId", getProcessId()) + .append("processCode", getProcessCode()) + .append("processName", getProcessName()) + .append("attention", getAttention()) + .append("enableFlag", getEnableFlag()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/op-modules/op-mes/src/main/java/com/op/mes/domain/ProRecipeContent.java b/op-modules/op-mes/src/main/java/com/op/mes/domain/ProRecipeContent.java new file mode 100644 index 00000000..522f7437 --- /dev/null +++ b/op-modules/op-mes/src/main/java/com/op/mes/domain/ProRecipeContent.java @@ -0,0 +1,178 @@ +package com.op.mes.domain; + +import com.op.common.core.annotation.Excel; +import com.op.common.core.web.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 配药配方内容对象 pro_process_content + * + * @author yinjinlu + * @date 2022-05-12 + */ +public class ProRecipeContent extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 内容ID */ + private String contentId; + + /** 工序ID */ + @Excel(name = "工序ID") + private String processId; + + /** 顺序编号 */ + @Excel(name = "顺序编号") + private Integer orderNum; + + /** 内容说明 */ + @Excel(name = "内容说明") + private String contentText; + + /** 辅助设备 */ + @Excel(name = "辅助设备") + private String device; + + /** 辅助材料 */ + @Excel(name = "辅助材料") + private String material; + + /** 材料URL */ + @Excel(name = "材料URL") + private String docUrl; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setContentId(String contentId) + { + this.contentId = contentId; + } + + public String getContentId() + { + return contentId; + } + public void setProcessId(String processId) + { + this.processId = processId; + } + + public String getProcessId() + { + return processId; + } + public void setOrderNum(Integer orderNum) + { + this.orderNum = orderNum; + } + + public Integer getOrderNum() + { + return orderNum; + } + public void setContentText(String contentText) + { + this.contentText = contentText; + } + + public String getContentText() + { + return contentText; + } + public void setDevice(String device) + { + this.device = device; + } + + public String getDevice() + { + return device; + } + public void setMaterial(String material) + { + this.material = material; + } + + public String getMaterial() + { + return material; + } + public void setDocUrl(String docUrl) + { + this.docUrl = docUrl; + } + + public String getDocUrl() + { + return docUrl; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("contentId", getContentId()) + .append("processId", getProcessId()) + .append("orderNum", getOrderNum()) + .append("contentText", getContentText()) + .append("device", getDevice()) + .append("material", getMaterial()) + .append("docUrl", getDocUrl()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/op-modules/op-mes/src/main/java/com/op/mes/domain/ProRoute.java b/op-modules/op-mes/src/main/java/com/op/mes/domain/ProRoute.java index ed09190f..aebfccac 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/domain/ProRoute.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/domain/ProRoute.java @@ -37,6 +37,10 @@ public class ProRoute extends BaseEntity @Excel(name = "是否启用") private String enableFlag; + /** 是否需要首检 */ + @Excel(name = "是否需要首检") + private String needCheck; + /** 预留字段1 */ private String attr1; @@ -160,6 +164,14 @@ public class ProRoute extends BaseEntity return attr4; } + public String getNeedCheck() { + return needCheck; + } + + public void setNeedCheck(String needCheck) { + this.needCheck = needCheck; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) diff --git a/op-modules/op-mes/src/main/java/com/op/mes/service/impl/ProProcessServiceImpl.java b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/ProProcessServiceImpl.java index 79e903e7..25ee1620 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/service/impl/ProProcessServiceImpl.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/ProProcessServiceImpl.java @@ -29,8 +29,7 @@ import java.util.List; * @date 2022-05-11 */ @Service -public class ProProcessServiceImpl implements IProProcessService -{ +public class ProProcessServiceImpl implements IProProcessService { @Autowired private ProProcessMapper proProcessMapper; @@ -45,11 +44,10 @@ public class ProProcessServiceImpl implements IProProcessService */ @Override @DS("#header.poolName") - public ProProcess selectProProcessByProcessId(String processId) - { + public ProProcess selectProProcessByProcessId(String processId) { ProProcess p = proProcessMapper.selectProProcessByProcessId(processId); - List files = baseFileMapper.getBaseFileBatch(processId); - if(!CollectionUtils.isEmpty(files)){ + List files = baseFileMapper.getBaseFileBatch(processId); + if (!CollectionUtils.isEmpty(files)) { p.setFiles(files); } return p; @@ -63,13 +61,13 @@ public class ProProcessServiceImpl implements IProProcessService */ @Override @DS("#header.poolName") - public List selectProProcessList(ProProcess proProcess) - { + public List selectProProcessList(ProProcess proProcess) { return proProcessMapper.selectProProcessList(proProcess); } /** * 检查工序编码是否唯一 + * * @param proProcess * @return */ @@ -77,7 +75,7 @@ public class ProProcessServiceImpl implements IProProcessService @DS("#header.poolName") public Boolean checkProcessCodeUnique(ProProcess proProcess) { ProProcess process = proProcessMapper.checkProcessCodeUnique(proProcess); - if(StringUtils.isNotNull(process) && !process.getProcessId().equals(proProcess.getProcessId())){ + if (StringUtils.isNotNull(process) && !process.getProcessId().equals(proProcess.getProcessId())) { return UserConstants.NOT_UNIQUE; } return UserConstants.UNIQUE; @@ -86,6 +84,7 @@ public class ProProcessServiceImpl implements IProProcessService /** * 检查工序名称是否唯一 + * * @param proProcess * @return */ @@ -94,7 +93,7 @@ public class ProProcessServiceImpl implements IProProcessService public Boolean checkProcessNameUnique(ProProcess proProcess) { ProProcess process = proProcessMapper.checkProcessNameUnique(proProcess); - if(StringUtils.isNotNull(process) && !process.getProcessId().equals(proProcess.getProcessId())){ + if (StringUtils.isNotNull(process) && !process.getProcessId().equals(proProcess.getProcessId())) { return UserConstants.NOT_UNIQUE; } return UserConstants.UNIQUE; @@ -108,17 +107,16 @@ public class ProProcessServiceImpl implements IProProcessService */ @Override @DS("#header.poolName") - public int insertProProcess(ProProcess proProcess) - { + public int insertProProcess(ProProcess proProcess) { proProcess.setProcessId(IdUtils.fastSimpleUUID()); proProcess.setCreateTime(DateUtils.getNowDate()); //上传附件 - if(StringUtils.isNotEmpty(proProcess.getFileList())){ + if (StringUtils.isNotEmpty(proProcess.getFileList())) { String[] ids = proProcess.getFileList().split(","); List files = new ArrayList<>(); BaseFileData file = null; - for(String id:ids){ + for (String id : ids) { file = new BaseFileData(); file.setFileId(IdUtils.fastSimpleUUID()); file.setFileName(id.split("&fileName=")[1]); @@ -142,16 +140,15 @@ public class ProProcessServiceImpl implements IProProcessService */ @Override @DS("#header.poolName") - public int updateProProcess(ProProcess proProcess) - { + public int updateProProcess(ProProcess proProcess) { //上传附件 - if(StringUtils.isNotEmpty(proProcess.getFileList())){ + if (StringUtils.isNotEmpty(proProcess.getFileList())) { baseFileMapper.deleteBaseFileBySourceId(proProcess.getProcessId()); String[] ids = proProcess.getFileList().split(","); List files = new ArrayList<>(); BaseFileData file = null; - for(String id:ids){ + for (String id : ids) { file = new BaseFileData(); file.setFileId(IdUtils.fastSimpleUUID()); file.setFileAddress(id); @@ -176,8 +173,7 @@ public class ProProcessServiceImpl implements IProProcessService */ @Override @DS("#header.poolName") - public int deleteProProcessByProcessIds(String[] processIds) - { + public int deleteProProcessByProcessIds(String[] processIds) { return proProcessMapper.deleteProProcessByProcessIds(processIds); } @@ -189,8 +185,7 @@ public class ProProcessServiceImpl implements IProProcessService */ @Override @DS("#header.poolName") - public int deleteProProcessByProcessId(String processId) - { + public int deleteProProcessByProcessId(String processId) { return proProcessMapper.deleteProProcessByProcessId(processId); } } diff --git a/op-modules/op-mes/src/main/resources/mapper/mes/ProRouteMapper.xml b/op-modules/op-mes/src/main/resources/mapper/mes/ProRouteMapper.xml index 0aed06d7..1025750a 100644 --- a/op-modules/op-mes/src/main/resources/mapper/mes/ProRouteMapper.xml +++ b/op-modules/op-mes/src/main/resources/mapper/mes/ProRouteMapper.xml @@ -20,12 +20,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + select route_id, route_code, route_name, route_desc, enable_flag, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time, - route_version + route_version,need_check from pro_route @@ -57,7 +59,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -80,6 +82,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update_by, update_time, route_version, + need_check, + #{routeId}, @@ -96,7 +100,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{createTime}, #{updateBy}, #{updateTime}, - #{updateTime}, + #{routeVersion}, + #{needCheck}, @@ -117,6 +122,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update_by = #{updateBy}, update_time = #{updateTime}, route_version = #{routeVersion}, + #{needCheck}, where route_id = #{routeId} diff --git a/op-modules/op-mes/src/main/resources/mapper/mes/ProRouteProcessMapper.xml b/op-modules/op-mes/src/main/resources/mapper/mes/ProRouteProcessMapper.xml index 243c819a..3e435856 100644 --- a/op-modules/op-mes/src/main/resources/mapper/mes/ProRouteProcessMapper.xml +++ b/op-modules/op-mes/src/main/resources/mapper/mes/ProRouteProcessMapper.xml @@ -223,9 +223,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{recordId} - delete from pro_route_process where route_id = #{routeId} - diff --git a/op-modules/op-system/src/main/resources/mapper/system/SysDeptMapper.xml b/op-modules/op-system/src/main/resources/mapper/system/SysDeptMapper.xml index 45583075..530f5955 100644 --- a/op-modules/op-system/src/main/resources/mapper/system/SysDeptMapper.xml +++ b/op-modules/op-system/src/main/resources/mapper/system/SysDeptMapper.xml @@ -73,11 +73,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"