diff --git a/ruoyi-admin/src/main/java/com/ruoyi/erp/controller/ErpBomController.java b/ruoyi-admin/src/main/java/com/ruoyi/erp/controller/ErpBomController.java new file mode 100644 index 00000000..6f8611ea --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/erp/controller/ErpBomController.java @@ -0,0 +1,151 @@ +package com.ruoyi.erp.controller; + +import java.util.List; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +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.erp.domain.ErpBom; +import com.ruoyi.erp.service.IErpBomService; +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; + +/** + * bomController + * + * @author ruoyi + * @date 2023-11-19 + */ +@Controller +@RequestMapping("/erp/bom") +public class ErpBomController extends BaseController +{ + private String prefix = "erp/bom"; + + @Autowired + private IErpBomService erpBomService; + + @RequiresPermissions("erp:bom:view") + @GetMapping() + public String bom() + { + return prefix + "/bom"; + } + + /** + * 查询bom列表 + */ + @RequiresPermissions("erp:bom:list") + @PostMapping("/list") + @ResponseBody + public TableDataInfo list(ErpBom erpBom) + { + startPage(); + List list = erpBomService.selectErpBomList(erpBom); + return getDataTable(list); + } + + /** + * 导出bom列表 + */ + @RequiresPermissions("erp:bom:export") + @Log(title = "bom", businessType = BusinessType.EXPORT) + @PostMapping("/export") + @ResponseBody + public AjaxResult export(ErpBom erpBom) + { + List list = erpBomService.selectErpBomList(erpBom); + ExcelUtil util = new ExcelUtil(ErpBom.class); + return util.exportExcel(list, "bom数据"); + } + + /** + * 新增bom + */ + @GetMapping("/add") + public String add() + { + return prefix + "/add"; + } + + /** + * 新增保存bom + */ + @RequiresPermissions("erp:bom:add") + @Log(title = "bom", businessType = BusinessType.INSERT) + @PostMapping("/add") + @ResponseBody + public AjaxResult addSave(ErpBom erpBom) + { + return toAjax(erpBomService.insertErpBom(erpBom)); + } + + /** + * 修改bom + */ + @GetMapping("/edit/{id}") + public String edit(@PathVariable("id") Long id, ModelMap mmap) + { + ErpBom erpBom = erpBomService.selectErpBomById(id); + mmap.put("erpBom", erpBom); + return prefix + "/edit"; + } + + /** + * 修改保存bom + */ + @RequiresPermissions("erp:bom:edit") + @Log(title = "bom", businessType = BusinessType.UPDATE) + @PostMapping("/edit") + @ResponseBody + public AjaxResult editSave(ErpBom erpBom) + { + return toAjax(erpBomService.updateErpBom(erpBom)); + } + + /** + * 删除bom + */ + @RequiresPermissions("erp:bom:remove") + @Log(title = "bom", businessType = BusinessType.DELETE) + @PostMapping( "/remove") + @ResponseBody + public AjaxResult remove(String ids) + { + return toAjax(erpBomService.deleteErpBomByIds(ids)); + } + + /** + * 作废bom + */ + @RequiresPermissions("erp:bom:cancel") + @Log(title = "bom", businessType = BusinessType.CANCEL) + @GetMapping( "/cancel/{id}") + @ResponseBody + public AjaxResult cancel(@PathVariable("id") Long id){ + return toAjax(erpBomService.cancelErpBomById(id)); + } + + /** + * 恢复bom + */ + @RequiresPermissions("erp:bom:restore") + @Log(title = "bom", businessType = BusinessType.RESTORE) + @GetMapping( "/restore/{id}") + @ResponseBody + public AjaxResult restore(@PathVariable("id")Long id) + { + return toAjax(erpBomService.restoreErpBomById(id)); + } + + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/erp/domain/ErpBom.java b/ruoyi-admin/src/main/java/com/ruoyi/erp/domain/ErpBom.java new file mode 100644 index 00000000..67210d4f --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/erp/domain/ErpBom.java @@ -0,0 +1,111 @@ +package com.ruoyi.erp.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * bom对象 erp_bom + * + * @author ruoyi + * @date 2023-11-19 + */ +public class ErpBom extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 主键ID */ + private Long id; + + /** 删除标志(0代表存在 1代表删除) */ + private String delFlag; + + /** bom号 */ + @Excel(name = "bom号") + private String bomNo; + + /** 料号 */ + @Excel(name = "料号") + private String materialNo; + + /** 审核状态 */ + @Excel(name = "审核状态") + private String auditStatus; + + /** 使用状态 */ + @Excel(name = "使用状态") + private String useStatus; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + public void setDelFlag(String delFlag) + { + this.delFlag = delFlag; + } + + public String getDelFlag() + { + return delFlag; + } + public void setBomNo(String bomNo) + { + this.bomNo = bomNo; + } + + public String getBomNo() + { + return bomNo; + } + public void setMaterialNo(String materialNo) + { + this.materialNo = materialNo; + } + + public String getMaterialNo() + { + return materialNo; + } + public void setAuditStatus(String auditStatus) + { + this.auditStatus = auditStatus; + } + + public String getAuditStatus() + { + return auditStatus; + } + public void setUseStatus(String useStatus) + { + this.useStatus = useStatus; + } + + public String getUseStatus() + { + return useStatus; + } + + @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("auditStatus", getAuditStatus()) + .append("useStatus", getUseStatus()) + .toString(); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/erp/mapper/ErpBomMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/erp/mapper/ErpBomMapper.java new file mode 100644 index 00000000..0e148901 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/erp/mapper/ErpBomMapper.java @@ -0,0 +1,77 @@ +package com.ruoyi.erp.mapper; + +import java.util.List; +import com.ruoyi.erp.domain.ErpBom; + +/** + * bomMapper接口 + * + * @author ruoyi + * @date 2023-11-19 + */ +public interface ErpBomMapper +{ + /** + * 查询bom + * + * @param id bomID + * @return bom + */ + public ErpBom selectErpBomById(Long id); + + /** + * 查询bom列表 + * + * @param erpBom bom + * @return bom集合 + */ + public List selectErpBomList(ErpBom erpBom); + + /** + * 新增bom + * + * @param erpBom bom + * @return 结果 + */ + public int insertErpBom(ErpBom erpBom); + + /** + * 修改bom + * + * @param erpBom bom + * @return 结果 + */ + public int updateErpBom(ErpBom erpBom); + + /** + * 删除bom + * + * @param id bomID + * @return 结果 + */ + public int deleteErpBomById(Long id); + + /** + * 批量删除bom + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + public int deleteErpBomByIds(String[] ids); + + /** + * 作废bom + * + * @param id bomID + * @return 结果 + */ + public int cancelErpBomById(Long id); + + /** + * 恢复bom + * + * @param id bomID + * @return 结果 + */ + public int restoreErpBomById(Long id); +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/erp/service/IErpBomService.java b/ruoyi-admin/src/main/java/com/ruoyi/erp/service/IErpBomService.java new file mode 100644 index 00000000..f2a48553 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/erp/service/IErpBomService.java @@ -0,0 +1,75 @@ +package com.ruoyi.erp.service; + +import java.util.List; +import com.ruoyi.erp.domain.ErpBom; + +/** + * bomService接口 + * + * @author ruoyi + * @date 2023-11-19 + */ +public interface IErpBomService +{ + /** + * 查询bom + * + * @param id bomID + * @return bom + */ + public ErpBom selectErpBomById(Long id); + + /** + * 查询bom列表 + * + * @param erpBom bom + * @return bom集合 + */ + public List selectErpBomList(ErpBom erpBom); + + /** + * 新增bom + * + * @param erpBom bom + * @return 结果 + */ + public int insertErpBom(ErpBom erpBom); + + /** + * 修改bom + * + * @param erpBom bom + * @return 结果 + */ + public int updateErpBom(ErpBom erpBom); + + /** + * 批量删除bom + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + public int deleteErpBomByIds(String ids); + + /** + * 删除bom信息 + * + * @param id bomID + * @return 结果 + */ + public int deleteErpBomById(Long id); + + /** + * 作废bom + * @param id bomID + * @return + */ + int cancelErpBomById(Long id); + + /** + * 恢复bom + * @param id bomID + * @return + */ + int restoreErpBomById(Long id); +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpBomServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpBomServiceImpl.java new file mode 100644 index 00000000..fc6c058c --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpBomServiceImpl.java @@ -0,0 +1,133 @@ +package com.ruoyi.erp.service.impl; + +import java.util.List; + +import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.ShiroUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.erp.mapper.ErpBomMapper; +import com.ruoyi.erp.domain.ErpBom; +import com.ruoyi.erp.service.IErpBomService; +import com.ruoyi.common.core.text.Convert; + +/** + * bomService业务层处理 + * + * @author ruoyi + * @date 2023-11-19 + */ +@Service +public class ErpBomServiceImpl implements IErpBomService +{ + @Autowired + private ErpBomMapper erpBomMapper; + + @Autowired + private RedisCache redisCache; + + /** + * 查询bom + * + * @param id bomID + * @return bom + */ + @Override + public ErpBom selectErpBomById(Long id) + { + return erpBomMapper.selectErpBomById(id); + } + + /** + * 查询bom列表 + * + * @param erpBom bom + * @return bom + */ + @Override + public List selectErpBomList(ErpBom erpBom) + { + return erpBomMapper.selectErpBomList(erpBom); + } + + /** + * 新增bom + * + * @param erpBom bom + * @return 结果 + */ + @Override + public int insertErpBom(ErpBom erpBom) + { + String billNo = redisCache.generateBillNo("BOM"); + erpBom.setBomNo(billNo); + String loginName = ShiroUtils.getLoginName(); + erpBom.setCreateBy(loginName); + erpBom.setCreateTime(DateUtils.getNowDate()); + return erpBomMapper.insertErpBom(erpBom); + } + + /** + * 修改bom + * + * @param erpBom bom + * @return 结果 + */ + @Override + public int updateErpBom(ErpBom erpBom) + { + String loginName = ShiroUtils.getLoginName(); + erpBom.setUpdateBy(loginName); + erpBom.setUpdateTime(DateUtils.getNowDate()); + return erpBomMapper.updateErpBom(erpBom); + } + + /** + * 删除bom对象 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + @Override + public int deleteErpBomByIds(String ids) + { + return erpBomMapper.deleteErpBomByIds(Convert.toStrArray(ids)); + } + + /** + * 删除bom信息 + * + * @param id bomID + * @return 结果 + */ + @Override + public int deleteErpBomById(Long id) + { + return erpBomMapper.deleteErpBomById(id); + } + + /** + * 作废bom + * + * @param id bomID + * @return 结果 + */ + @Override + public int cancelErpBomById(Long id) + { + return erpBomMapper.cancelErpBomById(id); + } + + /** + * 恢复bom信息 + * + * @param id bomID + * @return 结果 + */ + @Override + public int restoreErpBomById(Long id) + { + return erpBomMapper.restoreErpBomById(id); + } +} diff --git a/ruoyi-admin/src/main/resources/mapper/erp/ErpBomMapper.xml b/ruoyi-admin/src/main/resources/mapper/erp/ErpBomMapper.xml new file mode 100644 index 00000000..afa91de4 --- /dev/null +++ b/ruoyi-admin/src/main/resources/mapper/erp/ErpBomMapper.xml @@ -0,0 +1,104 @@ + + + + + + + + + + + + + + + + + + + + select id, del_flag, create_by, create_time, update_by, update_time, remark, bom_no, material_no, audit_status, use_status from erp_bom + + + + + + + + insert into erp_bom + + del_flag, + create_by, + create_time, + update_by, + update_time, + remark, + bom_no, + material_no, + audit_status, + use_status, + + + #{delFlag}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{remark}, + #{bomNo}, + #{materialNo}, + #{auditStatus}, + #{useStatus}, + + + + + update erp_bom + + del_flag = #{delFlag}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + remark = #{remark}, + bom_no = #{bomNo}, + material_no = #{materialNo}, + audit_status = #{auditStatus}, + use_status = #{useStatus}, + + where id = #{id} + + + + delete from erp_bom where id = #{id} + + + + delete from erp_bom where id in + + #{id} + + + + + update erp_bom set del_flag = '1' where id = #{id} + + + + update erp_bom set del_flag = '0' where id = #{id} + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/mapper/erp/ErpMaterialMapper.xml b/ruoyi-admin/src/main/resources/mapper/erp/ErpMaterialMapper.xml index fdcad135..788d92da 100644 --- a/ruoyi-admin/src/main/resources/mapper/erp/ErpMaterialMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/erp/ErpMaterialMapper.xml @@ -52,6 +52,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and erp.create_by = #{createBy} and erp.create_time between #{params.beginCreateTime} and #{params.endCreateTime} + and erp.material_no like concat('%', #{params.materialNo}, '%') and erp.material_no = #{materialNo} and erp.material_name like concat('%', #{materialName}, '%') and erp.audit_status = #{auditStatus} diff --git a/ruoyi-admin/src/main/resources/templates/erp/bom/add.html b/ruoyi-admin/src/main/resources/templates/erp/bom/add.html new file mode 100644 index 00000000..73060b42 --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/erp/bom/add.html @@ -0,0 +1,170 @@ + + + + + + + +
+
+ +
+ +
+ + +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+ +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ + + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/erp/bom/bom.html b/ruoyi-admin/src/main/resources/templates/erp/bom/bom.html new file mode 100644 index 00000000..5efd95f1 --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/erp/bom/bom.html @@ -0,0 +1,137 @@ + + + + + + +
+
+
+
+
+
    +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
  • +  搜索 +  重置 +
  • +
+
+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/erp/bom/edit.html b/ruoyi-admin/src/main/resources/templates/erp/bom/edit.html new file mode 100644 index 00000000..76bb6d69 --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/erp/bom/edit.html @@ -0,0 +1,62 @@ + + + + + + +
+
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+ + +
+
+
+
+ +
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file