From 1d0638a298a1f3e2eed8d782a05c0b4ab63d1a16 Mon Sep 17 00:00:00 2001 From: liuxiaoxu <1793812695@qq.com> Date: Mon, 15 Jul 2024 10:16:02 +0800 Subject: [PATCH] =?UTF-8?q?[feat]=20=E5=A7=94=E5=A4=96=E5=8A=A0=E5=B7=A5?= =?UTF-8?q?=20=E6=95=B4=E5=90=88=E6=96=B0=E5=A2=9E=E5=A7=94=E5=A4=96?= =?UTF-8?q?=E5=B7=A5=E5=BA=8F=E8=A1=A8=E5=AE=9E=E4=BD=93=E7=B1=BB=20?= =?UTF-8?q?=E6=95=B4=E5=90=88=E6=96=B0=E5=A2=9E=E5=A7=94=E5=A4=96=E5=B7=A5?= =?UTF-8?q?=E5=BA=8FController=20=E6=95=B4=E5=90=88=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=A7=94=E5=A4=96=E5=B7=A5=E5=BA=8FMapper=20=E6=95=B4=E5=90=88?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=A7=94=E5=A4=96=E5=B7=A5=E5=BA=8FMapper.XM?= =?UTF-8?q?L=20=E6=95=B4=E5=90=88=E6=96=B0=E5=A2=9E=E5=A7=94=E5=A4=96?= =?UTF-8?q?=E5=B7=A5=E5=BA=8FService=E6=8E=A5=E5=8F=A3=20=E6=95=B4?= =?UTF-8?q?=E5=90=88=E6=96=B0=E5=A2=9E=E5=A7=94=E5=A4=96=E5=B7=A5=E5=BA=8F?= =?UTF-8?q?ServiceImpl=E5=AE=9E=E7=8E=B0=E7=B1=BB=20=E6=95=B4=E5=90=88?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=A7=94=E5=A4=96=E5=B7=A5=E5=BA=8FVO?= =?UTF-8?q?=E7=B1=BB=20=E6=95=B4=E5=90=88=E6=96=B0=E5=A2=9E=E5=A7=94?= =?UTF-8?q?=E5=A4=96=E5=B7=A5=E5=BA=8F=E5=89=8D=E7=AB=AF=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../OutsourceProcessController.java | 121 +++++++------ .../domain/OutsourceProcess.java | 46 +++-- .../system/domain/Vo/OutsourceProcessVo.java | 110 ++++++++++++ .../com/ruoyi/system/domain/Vo/Supplier.java | 50 ++++++ .../system/mapper/OutsourceProcessMapper.java | 95 +++++++++++ .../service/IOutsourceProcessService.java | 77 +++++++++ .../impl/OutsourceProcessServiceImpl.java | 160 ++++++++++++++++++ .../mapper/system/OutsourceProcessMapper.xml | 117 +++++++++++++ .../system/outsource_process/add.html | 69 ++++++++ .../system/outsource_process/detail.html | 65 +++++++ .../system/outsource_process/edit.html | 51 ++++++ .../outsource_process/outsource_process.html | 122 +++++++++++++ 12 files changed, 1004 insertions(+), 79 deletions(-) rename ruoyi-admin/src/main/java/com/ruoyi/{outsource => system}/controller/OutsourceProcessController.java (51%) rename ruoyi-admin/src/main/java/com/ruoyi/{outsource => system}/domain/OutsourceProcess.java (70%) create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/system/domain/Vo/OutsourceProcessVo.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/system/domain/Vo/Supplier.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/system/mapper/OutsourceProcessMapper.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/system/service/IOutsourceProcessService.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/OutsourceProcessServiceImpl.java create mode 100644 ruoyi-admin/src/main/resources/mapper/system/OutsourceProcessMapper.xml create mode 100644 ruoyi-admin/src/main/resources/templates/system/outsource_process/add.html create mode 100644 ruoyi-admin/src/main/resources/templates/system/outsource_process/detail.html create mode 100644 ruoyi-admin/src/main/resources/templates/system/outsource_process/edit.html create mode 100644 ruoyi-admin/src/main/resources/templates/system/outsource_process/outsource_process.html diff --git a/ruoyi-admin/src/main/java/com/ruoyi/outsource/controller/OutsourceProcessController.java b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/OutsourceProcessController.java similarity index 51% rename from ruoyi-admin/src/main/java/com/ruoyi/outsource/controller/OutsourceProcessController.java rename to ruoyi-admin/src/main/java/com/ruoyi/system/controller/OutsourceProcessController.java index 55423100..be7c0f1e 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/outsource/controller/OutsourceProcessController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/OutsourceProcessController.java @@ -1,10 +1,11 @@ -package com.ruoyi.outsource.controller; +package com.ruoyi.system.controller; -import java.text.SimpleDateFormat; import java.util.List; -import com.ruoyi.ck.utils.Result; -import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.DateUtils; + +import com.ruoyi.system.domain.OutsourceProcess; +import com.ruoyi.system.service.IOutsourceProcessService; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -16,39 +17,37 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.outsource.domain.OutsourceProcess; -import com.ruoyi.outsource.service.IOutsourceProcessService; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.core.page.TableDataInfo; /** - * 委外工序列表Controller + * 委外工序Controller * - * @author zhang - * @date 2024-03-08 + * @author ruoyi + * @date 2024-06-30 */ @Controller -@RequestMapping("/outsource/process") +@RequestMapping("/system/outsource_process") public class OutsourceProcessController extends BaseController { - private String prefix = "outsource/process"; + private String prefix = "system/outsource_process"; @Autowired private IOutsourceProcessService outsourceProcessService; - @RequiresPermissions("outsource:process:view") + @RequiresPermissions("system:outsource_process:view") @GetMapping() - public String process() + public String outsource_process() { - return prefix + "/process"; + return prefix + "/outsource_process"; } /** - * 查询委外工序列表列表 + * 查询委外工序列表 */ - @RequiresPermissions("outsource:process:list") + @RequiresPermissions("system:outsource_process:list") @PostMapping("/list") @ResponseBody public TableDataInfo list(OutsourceProcess outsourceProcess) @@ -59,21 +58,30 @@ public class OutsourceProcessController extends BaseController } /** - * 导出委外工序列表列表 + * 导出委外工序列表 */ - @RequiresPermissions("outsource:process:export") - @Log(title = "委外工序列表", businessType = BusinessType.EXPORT) + @RequiresPermissions("system:outsource_process:export") + @Log(title = "委外工序", businessType = BusinessType.EXPORT) @PostMapping("/export") @ResponseBody public AjaxResult export(OutsourceProcess outsourceProcess) { List list = outsourceProcessService.selectOutsourceProcessList(outsourceProcess); ExcelUtil util = new ExcelUtil(OutsourceProcess.class); - return util.exportExcel(list, "委外工序列表数据"); + return util.exportExcel(list, "委外工序数据"); + } + /** + * 表格细节视图 + */ + @RequiresPermissions("system:outsource_process:detail") + @GetMapping("/detail/{outsourceProcessId}") + public String detail(@PathVariable("outsourceProcessId") long outsourceProcessId, ModelMap mmap) + { + mmap.put("outsourceProcess", outsourceProcessService.selectOutsourceProcessByOutsourceProcessId(outsourceProcessId)); + return prefix + "/detail"; } - /** - * 新增委外工序列表 + * 新增委外工序 */ @GetMapping("/add") public String add() @@ -82,77 +90,64 @@ public class OutsourceProcessController extends BaseController } /** - * 新增保存委外工序列表 + * 新增保存委外工序 */ - @RequiresPermissions("outsource:process:add") - @Log(title = "委外工序列表", businessType = BusinessType.INSERT) + @RequiresPermissions("system:outsource_process:add") + @Log(title = "委外工序", businessType = BusinessType.INSERT) @PostMapping("/add") @ResponseBody public AjaxResult addSave(OutsourceProcess outsourceProcess) { + if(!outsourceProcessService.checkoutsourceProcessNoUnique(outsourceProcess)){ + return error("添加委外工序'" + outsourceProcess.getOutsourceProcessNo() + "'失败,工序编号已存在"); + }; + outsourceProcess.setCreateTime(DateUtils.getNowDate()); return toAjax(outsourceProcessService.insertOutsourceProcess(outsourceProcess)); } + /** + * 校验委外工序编号 + */ + @PostMapping("/checkoutsourceProcessNoUnique") + @ResponseBody + public boolean checkoutsourceProcessNoUnique(OutsourceProcess outsourceProcess) + { + return outsourceProcessService.checkoutsourceProcessNoUnique(outsourceProcess); + } /** - * 修改委外工序列表 + * 修改委外工序 */ + @RequiresPermissions("system:outsource_process:edit") @GetMapping("/edit/{outsourceProcessId}") - public String edit(@PathVariable("outsourceProcessId") String outsourceProcessId, ModelMap mmap) + public String edit(@PathVariable("outsourceProcessId") Long outsourceProcessId, ModelMap mmap) { - OutsourceProcess outsourceProcess = outsourceProcessService.selectOutsourceProcessById(outsourceProcessId); + OutsourceProcess outsourceProcess = outsourceProcessService.selectOutsourceProcessByOutsourceProcessId(outsourceProcessId); mmap.put("outsourceProcess", outsourceProcess); return prefix + "/edit"; } /** - * 修改保存委外工序列表 + * 修改保存委外工序 */ - @RequiresPermissions("outsource:process:edit") - @Log(title = "委外工序列表", businessType = BusinessType.UPDATE) + @RequiresPermissions("system:outsource_process:edit") + @Log(title = "委外工序", businessType = BusinessType.UPDATE) @PostMapping("/edit") @ResponseBody public AjaxResult editSave(OutsourceProcess outsourceProcess) { + outsourceProcess.setUpdateTime(DateUtils.getNowDate()); return toAjax(outsourceProcessService.updateOutsourceProcess(outsourceProcess)); } /** - * 删除委外工序列表 + * 删除委外工序 */ - @RequiresPermissions("outsource:process:remove") - @Log(title = "委外工序列表", businessType = BusinessType.DELETE) + @RequiresPermissions("system:outsource_process:remove") + @Log(title = "委外工序", businessType = BusinessType.DELETE) @PostMapping( "/remove") @ResponseBody public AjaxResult remove(String ids) { - return toAjax(outsourceProcessService.deleteOutsourceProcessByIds(ids)); - } - - /** - * 作废委外工序列表 - */ - @RequiresPermissions("outsource:process:cancel") - @Log(title = "委外工序列表", businessType = BusinessType.CANCEL) - @GetMapping( "/cancel/{id}") - @ResponseBody - public AjaxResult cancel(@PathVariable("id") String id){ - return toAjax(outsourceProcessService.cancelOutsourceProcessById(id)); - } - - /** - * 恢复委外工序列表 - */ - @RequiresPermissions("outsource:process:restore") - @Log(title = "委外工序列表", businessType = BusinessType.RESTORE) - @GetMapping( "/restore/{id}") - @ResponseBody - public AjaxResult restore(@PathVariable("id")String id) - { - return toAjax(outsourceProcessService.restoreOutsourceProcessById(id)); - } - @PostMapping("/getId") - @ResponseBody - public Result getId() throws Exception { - return Result.getSuccessResult(outsourceProcessService.getId()); + return toAjax(outsourceProcessService.deleteOutsourceProcessByOutsourceProcessIds(ids)); } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/outsource/domain/OutsourceProcess.java b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/OutsourceProcess.java similarity index 70% rename from ruoyi-admin/src/main/java/com/ruoyi/outsource/domain/OutsourceProcess.java rename to ruoyi-admin/src/main/java/com/ruoyi/system/domain/OutsourceProcess.java index ae879e18..5a674b60 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/outsource/domain/OutsourceProcess.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/OutsourceProcess.java @@ -1,4 +1,4 @@ -package com.ruoyi.outsource.domain; +package com.ruoyi.system.domain; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; @@ -6,45 +6,59 @@ import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.core.domain.BaseEntity; /** - * 委外工序列表对象 outsource_process + * 委外工序对象 outsource_process * - * @author zhang - * @date 2024-03-08 + * @author ruoyi + * @date 2024-06-30 */ public class OutsourceProcess extends BaseEntity { private static final long serialVersionUID = 1L; + /** 委外工序id */ +// @Excel(name = "委外工序id") + private Long outsourceProcessId; + /** 委外工序ID */ @Excel(name = "委外工序ID") - private String outsourceProcessId; + private String outsourceProcessCode; /** 委外工序编号 */ @Excel(name = "委外工序编号") - private String outsourceProcessCode; + private String outsourceProcessNo; /** 委外工序名称 */ @Excel(name = "委外工序名称") private String outsourceProcessName; - public void setOutsourceProcessId(String outsourceProcessId) - { + private String remark; + + public Long getOutsourceProcessId() { + return outsourceProcessId; + } + + public void setOutsourceProcessId(Long outsourceProcessId) { this.outsourceProcessId = outsourceProcessId; } - public String getOutsourceProcessId() - { - return outsourceProcessId; + public String getOutsourceProcessCode() { + return outsourceProcessCode; } - public void setOutsourceProcessCode(String outsourceProcessCode) - { + + public void setOutsourceProcessCode(String outsourceProcessCode) { this.outsourceProcessCode = outsourceProcessCode; } - public String getOutsourceProcessCode() + public void setOutsourceProcessNo(String outsourceProcessNo) { - return outsourceProcessCode; + this.outsourceProcessNo = outsourceProcessNo; } + + public String getOutsourceProcessNo() + { + return outsourceProcessNo; + } + public void setOutsourceProcessName(String outsourceProcessName) { this.outsourceProcessName = outsourceProcessName; @@ -58,7 +72,7 @@ public class OutsourceProcess extends BaseEntity @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("outsourceProcessId", getOutsourceProcessId()) + .append("outsourceProcessId", getOutsourceProcessId()).append("outsourceProcessId", getOutsourceProcessId()) .append("outsourceProcessCode", getOutsourceProcessCode()) .append("outsourceProcessName", getOutsourceProcessName()) .append("remark", getRemark()) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/domain/Vo/OutsourceProcessVo.java b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/Vo/OutsourceProcessVo.java new file mode 100644 index 00000000..de8b202d --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/Vo/OutsourceProcessVo.java @@ -0,0 +1,110 @@ +package com.ruoyi.system.domain.Vo; + +import com.ruoyi.common.core.domain.BaseEntity; +import com.ruoyi.system.domain.OutsourceProcess; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +import java.util.List; + +public class OutsourceProcessVo extends OutsourceProcess { + private static final long serialVersionUID = 1L; + + /** 委外工序id */ +// @Excel(name = "委外工序id") + private Long outsourceProcessId; + + /** 委外工序ID */ + private String outsourceProcessCode; + + /** 委外工序编号 */ + private String outsourceProcessNo; + + /** 委外工序名称 */ + private String outsourceProcessName; + + private String remark; + + private List weightSupplier; + + private List quantitySupplier; + + private List areaSupplier; + + public List getWeightSupplier() { + return weightSupplier; + } + + public void setWeightSupplier(List weightSupplier) { + this.weightSupplier = weightSupplier; + } + + public List getQuantitySupplier() { + return quantitySupplier; + } + + public void setQuantitySupplier(List quantitySupplier) { + this.quantitySupplier = quantitySupplier; + } + + public List getAreaSupplier() { + return areaSupplier; + } + + public void setAreaSupplier(List areaSupplier) { + this.areaSupplier = areaSupplier; + } + + + @Override + public Long getOutsourceProcessId() { + return outsourceProcessId; + } + + @Override + public void setOutsourceProcessId(Long outsourceProcessId) { + this.outsourceProcessId = outsourceProcessId; + } + + public String getOutsourceProcessCode() { + return outsourceProcessCode; + } + + public void setOutsourceProcessCode(String outsourceProcessCode) { + this.outsourceProcessCode = outsourceProcessCode; + } + + public void setOutsourceProcessNo(String outsourceProcessNo) + { + this.outsourceProcessNo = outsourceProcessNo; + } + + public String getOutsourceProcessNo() + { + return outsourceProcessNo; + } + + public void setOutsourceProcessName(String outsourceProcessName) + { + this.outsourceProcessName = outsourceProcessName; + } + + public String getOutsourceProcessName() + { + return outsourceProcessName; + } + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("outsourceProcessId", getOutsourceProcessId()).append("outsourceProcessId", getOutsourceProcessId()) + .append("outsourceProcessCode", getOutsourceProcessCode()) + .append("outsourceProcessName", getOutsourceProcessName()) + .append("remark", getRemark()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/domain/Vo/Supplier.java b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/Vo/Supplier.java new file mode 100644 index 00000000..cc22200f --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/Vo/Supplier.java @@ -0,0 +1,50 @@ +package com.ruoyi.system.domain.Vo; + +import java.math.BigDecimal; + +public class Supplier { + + /** 供应商编号 */ + private String supplierCode; + + /** 供应商名称 */ + private String supplierName; + + /** 工序的不含税单价(RMB) */ + private BigDecimal materialRmb; + + /** 工序的含税单价(RMB) */ + private BigDecimal materialNormb; + + public String getSupplierCode() { + return supplierCode; + } + + public void setSupplierCode(String supplierCode) { + this.supplierCode = supplierCode; + } + + public String getSupplierName() { + return supplierName; + } + + public void setSupplierName(String supplierName) { + this.supplierName = supplierName; + } + + public BigDecimal getMaterialRmb() { + return materialRmb; + } + + public void setMaterialRmb(BigDecimal materialRmb) { + this.materialRmb = materialRmb; + } + + public BigDecimal getMaterialNormb() { + return materialNormb; + } + + public void setMaterialNormb(BigDecimal materialNormb) { + this.materialNormb = materialNormb; + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/OutsourceProcessMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/OutsourceProcessMapper.java new file mode 100644 index 00000000..7335f620 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/OutsourceProcessMapper.java @@ -0,0 +1,95 @@ +package com.ruoyi.system.mapper; + +import java.util.List; + +import com.ruoyi.system.domain.OutsourceProcess; +import com.ruoyi.system.domain.Vo.OutsourceProcessVo; +import org.apache.ibatis.annotations.Param; + +/** + * 委外工序Mapper接口 + * + * @author ruoyi + * @date 2024-06-30 + */ +public interface OutsourceProcessMapper +{ + /** + * 查询委外工序 + * + * @param outsourceProcessId 委外工序主键 + * @return 委外工序 + */ + public OutsourceProcess selectOutsourceProcessByOutsourceProcessId(long outsourceProcessId); + /** + * 查询委外工序 + * + * @param outsourceProcessIds 委外工序主键串 + * @return 委外工序 + */ + public List selectOutsourceProcessByOutsourceProcessIds(Long[] outsourceProcessIds); + /** + * 查询委外工序 + * + * @param outsourceProcessNo 委外工序编号 + * @return 委外工序 + */ + public OutsourceProcess selectOutsourceProcessByOutsourceProcessNo(String outsourceProcessNo); + + /** + * 查询委外工序列表 + * + * @param outsourceProcess 委外工序 + * @return 委外工序集合 + */ + public List selectOutsourceProcessList(OutsourceProcess outsourceProcess); + + /** + * 按编号查询委外工序列表 + * + * @param outsourceProcessNos 委外工序编号 + * @return 委外工序集合 + */ + public List selectOutsourceProcessListByNos(List outsourceProcessNos); + + + /** + * 新增委外工序 + * + * @param outsourceProcess 委外工序 + * @return 结果 + */ + public int insertOutsourceProcess(OutsourceProcess outsourceProcess); + + /** + * 修改委外工序 + * + * @param outsourceProcess 委外工序 + * @return 结果 + */ + public int updateOutsourceProcess(OutsourceProcess outsourceProcess); + + /** + * 删除委外工序 + * + * @param outsourceProcessId 委外工序主键 + * @return 结果 + */ + public int deleteOutsourceProcessByOutsourceProcessId(Integer outsourceProcessId); + + /** + * 批量删除委外工序 + * + * @param outsourceProcessIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteOutsourceProcessByOutsourceProcessIds(String[] outsourceProcessIds); + + + /** + * 查询数据库中今天已经生产的最大序号 + * + * @param prefix 前面的:ZCGX年月日 + */ + public String findMaxRoundCode(@Param("prefix") String prefix); +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/service/IOutsourceProcessService.java b/ruoyi-admin/src/main/java/com/ruoyi/system/service/IOutsourceProcessService.java new file mode 100644 index 00000000..cd9daa3a --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/service/IOutsourceProcessService.java @@ -0,0 +1,77 @@ +package com.ruoyi.system.service; + +import com.ruoyi.system.domain.OutsourceProcess; + +import java.util.List; + + +/** + * 委外工序Service接口 + * + * @author ruoyi + * @date 2024-06-30 + */ +public interface IOutsourceProcessService +{ + /** + * 查询委外工序 + * + * @param outsourceProcessId 委外工序主键 + * @return 委外工序 + */ + public OutsourceProcess selectOutsourceProcessByOutsourceProcessId(Long outsourceProcessId); + /** + * 查询委外工序列表 + * + * @param outsourceProcessIds 委外工序主键列表 + * @return 委外工序 + */ + public List selectOutsourceProcessByOutsourceProcessIds(String outsourceProcessIds); + + /** + * 查询委外工序列表 + * + * @param outsourceProcess 委外工序 + * @return 委外工序集合 + */ + public List selectOutsourceProcessList(OutsourceProcess outsourceProcess); + + /** + * 新增委外工序 + * + * @param outsourceProcess 委外工序 + * @return 结果 + */ + public int insertOutsourceProcess(OutsourceProcess outsourceProcess); + /** + * 校验委外工序编号是否唯一 + * + * @param outsourceProcess 菜单信息 + * @return 结果 + */ + public boolean checkoutsourceProcessNoUnique(OutsourceProcess outsourceProcess); + /** + * 修改委外工序 + * + * @param outsourceProcess 委外工序 + * @return 结果 + */ + public int updateOutsourceProcess(OutsourceProcess outsourceProcess); + + + /** + * 批量删除委外工序 + * + * @param outsourceProcessIds 需要删除的委外工序主键集合 + * @return 结果 + */ + public int deleteOutsourceProcessByOutsourceProcessIds(String outsourceProcessIds); + + /** + * 删除委外工序信息 + * + * @param outsourceProcessId 委外工序主键 + * @return 结果 + */ + public int deleteOutsourceProcessByOutsourceProcessId(Integer outsourceProcessId); +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/OutsourceProcessServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/OutsourceProcessServiceImpl.java new file mode 100644 index 00000000..70414f83 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/OutsourceProcessServiceImpl.java @@ -0,0 +1,160 @@ +package com.ruoyi.system.service.impl; + +import java.text.DecimalFormat; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.system.domain.OutsourceProcess; +import com.ruoyi.system.mapper.OutsourceProcessMapper; +import com.ruoyi.system.service.IOutsourceProcessService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.common.core.text.Convert; + +/** + * 委外工序Service业务层处理 + * + * @author ruoyi + * @date 2024-06-30 + */ +@Service +public class OutsourceProcessServiceImpl implements IOutsourceProcessService +{ + @Autowired + private OutsourceProcessMapper outsourceProcessMapper; + + /** + * 查询委外工序 + * + * @param outsourceProcessId 委外工序主键 + * @return 委外工序 + */ + @Override + public OutsourceProcess selectOutsourceProcessByOutsourceProcessId(Long outsourceProcessId) + { + return outsourceProcessMapper.selectOutsourceProcessByOutsourceProcessId(outsourceProcessId); + } + + @Override + public List selectOutsourceProcessByOutsourceProcessIds(String outsourceProcessIds) { + Long[] ids = Convert.toLongArray(outsourceProcessIds); + return outsourceProcessMapper.selectOutsourceProcessByOutsourceProcessIds(ids); + } + + /** + * 查询委外工序列表 + * + * @param outsourceProcess 委外工序 + * @return 委外工序 + */ + @Override + public List selectOutsourceProcessList(OutsourceProcess outsourceProcess) + { + return outsourceProcessMapper.selectOutsourceProcessList(outsourceProcess); + } + + /** + * 新增委外工序 + * + * @param outsourceProcess 委外工序 + * @return 结果 + */ + @Override + public int insertOutsourceProcess(OutsourceProcess outsourceProcess) + { + + //更改日期格式,以提高可读性 + SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); + String dataPart = df.format(new Date()); + + //移除日期中的分隔符以便于后续处理 + String prefix = "WWGX"+dataPart.replace("-",""); + + //查询数据库中最大的编号 + String maxCode = outsourceProcessMapper.findMaxRoundCode(prefix); + String newCode = generateNewCode(prefix,maxCode); + +// outsourceProcess.setOutsourceProcessId(); + outsourceProcess.setOutsourceProcessCode(newCode); + System.out.println(outsourceProcess.toString()); + + outsourceProcess.setCreateTime(DateUtils.getNowDate()); + return outsourceProcessMapper.insertOutsourceProcess(outsourceProcess); + } + + /** + *委外工序ID生产规则 + *系统自动生成,按照特定编码,编码暂用【ZCGX+年月日+001】, + *自增长,如:ZCGX20231111001,ZCGX20231111002 + * + */ + private String generateNewCode(String prefix, String maxCode) { + if (StringUtils.isEmpty(maxCode)){ + return prefix+"001"; + } + //解析并递增编号 + int sequence = Integer.parseInt(maxCode.substring(4)) + 1 ; +// //检查序列号是否溢出 +// if (sequence > 999){ +// throw new BusinessException("当日编号已达到最大值999,请检查或调整策略"); +// } + //格式化序列号,自动补零至三位 + DecimalFormat df = new DecimalFormat("000"); + return prefix + df.format(sequence); + } + /** + * 校验委外工序编号是否唯一 + * + * @param outsourceProcess 委外工序 + * @return 结果 + */ + @Override + public boolean checkoutsourceProcessNoUnique(OutsourceProcess outsourceProcess) { + + + if(outsourceProcessMapper.selectOutsourceProcessByOutsourceProcessNo(outsourceProcess.getOutsourceProcessNo())!=null){ + return false; + } + return true; + } + + /** + * 修改委外工序 + * + * @param outsourceProcess 委外工序 + * @return 结果 + */ + @Override + public int updateOutsourceProcess(OutsourceProcess outsourceProcess) + { + outsourceProcess.setUpdateTime(DateUtils.getNowDate()); + return outsourceProcessMapper.updateOutsourceProcess(outsourceProcess); + } + /** + + /** + * 批量删除委外工序 + * + * @param outsourceProcessIds 需要删除的委外工序主键 + * @return 结果 + */ + @Override + public int deleteOutsourceProcessByOutsourceProcessIds(String outsourceProcessIds) + { + return outsourceProcessMapper.deleteOutsourceProcessByOutsourceProcessIds(Convert.toStrArray(outsourceProcessIds)); + } + + /** + * 删除委外工序信息 + * + * @param outsourceProcessId 委外工序主键 + * @return 结果 + */ + @Override + public int deleteOutsourceProcessByOutsourceProcessId(Integer outsourceProcessId) + { + return outsourceProcessMapper.deleteOutsourceProcessByOutsourceProcessId(outsourceProcessId); + } +} diff --git a/ruoyi-admin/src/main/resources/mapper/system/OutsourceProcessMapper.xml b/ruoyi-admin/src/main/resources/mapper/system/OutsourceProcessMapper.xml new file mode 100644 index 00000000..8decac4e --- /dev/null +++ b/ruoyi-admin/src/main/resources/mapper/system/OutsourceProcessMapper.xml @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + select outsource_process_id,outsource_process_code,outsource_process_no, outsource_process_name, remark, create_by, create_time, update_by, update_time from outsource_process + + + + + + + + + + + + + + + + insert into outsource_process + + outsource_process_code, + outsource_process_no, + outsource_process_name, + remark, + create_by, + create_time, + update_by, + update_time, + + + outsource_process_code, + #{outsourceProcessNo}, + #{outsourceProcessName}, + #{remark}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update outsource_process + + outsource_process_no = #{outsourceProcessNo}, + outsource_process_code = #{outsourceProcessCode}, + outsource_process_name = #{outsourceProcessName}, + remark = #{remark}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where outsource_process_id = #{outsourceProcessId} + + + + delete from outsource_process where outsource_process_id = #{outsourceProcessId} + + + + delete from outsource_process where outsource_process_id in + + #{outsourceProcessId} + + + + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/system/outsource_process/add.html b/ruoyi-admin/src/main/resources/templates/system/outsource_process/add.html new file mode 100644 index 00000000..a8ef480d --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/system/outsource_process/add.html @@ -0,0 +1,69 @@ + + + + + + +
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/system/outsource_process/detail.html b/ruoyi-admin/src/main/resources/templates/system/outsource_process/detail.html new file mode 100644 index 00000000..7e92f68d --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/system/outsource_process/detail.html @@ -0,0 +1,65 @@ + + + + + + +
+
+
+ +
+
+
+
+
+ +
+
+
+
+
+ +
+
+
+
+
+ +
+
+
+
+
+ +
+
+
+
+
+ +
+
+
+
+
+ +
+
+
+
+
+
+ + + + diff --git a/ruoyi-admin/src/main/resources/templates/system/outsource_process/edit.html b/ruoyi-admin/src/main/resources/templates/system/outsource_process/edit.html new file mode 100644 index 00000000..2192a65e --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/system/outsource_process/edit.html @@ -0,0 +1,51 @@ + + + + + + +
+
+ +
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/system/outsource_process/outsource_process.html b/ruoyi-admin/src/main/resources/templates/system/outsource_process/outsource_process.html new file mode 100644 index 00000000..e337135f --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/system/outsource_process/outsource_process.html @@ -0,0 +1,122 @@ + + + + + + +
+
+
+
+
+
    +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
  • + + + - + +
  • +
  • +  搜索 +  重置 +
  • +
+
+
+
+ + +
+
+
+
+
+ + + + + \ No newline at end of file