diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/factory/CFactoryController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/factory/CFactoryController.java new file mode 100644 index 0000000..7e29153 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/factory/CFactoryController.java @@ -0,0 +1,129 @@ +package com.ruoyi.web.controller.factory; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ruoyi.clMaterial.domain.CYlMaterial; +import com.ruoyi.common.annotation.DataSource; +import com.ruoyi.common.enums.DataSourceType; +import com.ruoyi.materialType.domain.CMaterialType; +import com.ruoyi.materialType.service.ICMaterialTypeService; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.factory.domain.CFactory; +import com.ruoyi.factory.service.ICFactoryService; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 车间管理Controller + * + * @author ruoyi + * @date 2024-02-29 + */ +@RestController +@RequestMapping("/factory/factory") +@DataSource(DataSourceType.QUOT) +public class CFactoryController extends BaseController +{ + @Autowired + private ICFactoryService cFactoryService; + + @Autowired + private ICMaterialTypeService cMaterialTypeService; + + /** + * 查询车间管理列表 + */ + @PreAuthorize("@ss.hasPermi('factory:factory:list')") + @GetMapping("/list") + public TableDataInfo list(CFactory cFactory) + { + startPage(); + List list = cFactoryService.selectCFactoryList(cFactory); + return getDataTable(list); + } + + /** + * 物料类别列表 + */ + @PreAuthorize("@ss.hasPermi('factory:factory:list')") + @GetMapping("/cTypelist") + public AjaxResult cTypelist(CMaterialType cMaterialType) + { + AjaxResult ajax = AjaxResult.success(); +/* + ajax.put("cTypeList", cFactoryService.selectCTypelist()); +*/ + ajax.put("cTypeList", cMaterialTypeService.selectCMaterialTypeList(cMaterialType)); + return ajax; + } + + /** + * 导出车间管理列表 + */ + @PreAuthorize("@ss.hasPermi('factory:factory:export')") + @Log(title = "车间管理", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, CFactory cFactory) + { + List list = cFactoryService.selectCFactoryList(cFactory); + ExcelUtil util = new ExcelUtil(CFactory.class); + util.exportExcel(response, list, "车间管理数据"); + } + + /** + * 获取车间管理详细信息 + */ + @PreAuthorize("@ss.hasPermi('factory:factory:query')") + @GetMapping(value = "/{factoryId}") + public AjaxResult getInfo(@PathVariable("factoryId") Long factoryId) + { + return success(cFactoryService.selectCFactoryByFactoryId(factoryId)); + } + + /** + * 新增车间管理 + */ + @PreAuthorize("@ss.hasPermi('factory:factory:add')") + @Log(title = "车间管理", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody CFactory cFactory) + { + return toAjax(cFactoryService.insertCFactory(cFactory)); + } + + /** + * 修改车间管理 + */ + @PreAuthorize("@ss.hasPermi('factory:factory:edit')") + @Log(title = "车间管理", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody CFactory cFactory) + { + return toAjax(cFactoryService.updateCFactory(cFactory)); + } + + /** + * 删除车间管理 + */ + @PreAuthorize("@ss.hasPermi('factory:factory:remove')") + @Log(title = "车间管理", businessType = BusinessType.DELETE) + @DeleteMapping("/{factoryIds}") + public AjaxResult remove(@PathVariable Long[] factoryIds) + { + return toAjax(cFactoryService.deleteCFactoryByFactoryIds(factoryIds)); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/material/CMaterialController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/material/CMaterialController.java index 104af6c..b2284a0 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/material/CMaterialController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/material/CMaterialController.java @@ -7,6 +7,9 @@ import com.ruoyi.clMaterial.domain.CYlMaterial; import com.ruoyi.clMaterial.service.ICYlMaterialService; import com.ruoyi.common.annotation.DataSource; import com.ruoyi.common.enums.DataSourceType; +import com.ruoyi.material.domain.CMaterial; +import com.ruoyi.materialType.domain.CMaterialType; +import com.ruoyi.materialType.service.ICMaterialTypeService; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -21,7 +24,6 @@ import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.material.domain.CMaterial; import com.ruoyi.material.service.ICMaterialService; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.core.page.TableDataInfo; @@ -43,6 +45,10 @@ public class CMaterialController extends BaseController @Autowired private ICYlMaterialService cYlMaterialService; + @Autowired + private ICMaterialTypeService cMaterialTypeService; + + /** * 查询物料管理列表 */ @@ -50,11 +56,28 @@ public class CMaterialController extends BaseController @GetMapping("/list") public TableDataInfo list(CMaterial cMaterial) { + + CMaterial A = new CMaterial(); startPage(); List list = cMaterialService.selectCMaterialList(cMaterial); return getDataTable(list); } + /** + * 物料类别列表 + */ + @PreAuthorize("@ss.hasPermi('material:material:list')") + @GetMapping("/cTypelist") + public AjaxResult cTypelist(CMaterialType cMaterialType) + { + AjaxResult ajax = AjaxResult.success(); +/* + ajax.put("cTypeList", cFactoryService.selectCTypelist()); +*/ + ajax.put("cTypeList", cMaterialTypeService.selectCMaterialTypeList(cMaterialType)); + return ajax; + } + /** * 查询材料管理列表 */ diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/materialType/CMaterialTypeController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/materialType/CMaterialTypeController.java new file mode 100644 index 0000000..79389bd --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/materialType/CMaterialTypeController.java @@ -0,0 +1,108 @@ +package com.ruoyi.web.controller.materialType; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ruoyi.common.annotation.DataSource; +import com.ruoyi.common.enums.DataSourceType; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.materialType.domain.CMaterialType; +import com.ruoyi.materialType.service.ICMaterialTypeService; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 物料类别Controller + * + * @author ruoyi + * @date 2024-03-01 + */ +@RestController +@RequestMapping("/materialType/materialType") +@DataSource(DataSourceType.QUOT) +public class CMaterialTypeController extends BaseController +{ + @Autowired + private ICMaterialTypeService cMaterialTypeService; + + /** + * 查询物料类别列表 + */ + @PreAuthorize("@ss.hasPermi('materialType:materialType:list')") + @GetMapping("/list") + public TableDataInfo list(CMaterialType cMaterialType) + { + startPage(); + List list = cMaterialTypeService.selectCMaterialTypeList(cMaterialType); + return getDataTable(list); + } + + /** + * 导出物料类别列表 + */ + @PreAuthorize("@ss.hasPermi('materialType:materialType:export')") + @Log(title = "物料类别", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, CMaterialType cMaterialType) + { + List list = cMaterialTypeService.selectCMaterialTypeList(cMaterialType); + ExcelUtil util = new ExcelUtil(CMaterialType.class); + util.exportExcel(response, list, "物料类别数据"); + } + + /** + * 获取物料类别详细信息 + */ + @PreAuthorize("@ss.hasPermi('materialType:materialType:query')") + @GetMapping(value = "/{typeId}") + public AjaxResult getInfo(@PathVariable("typeId") Long typeId) + { + return success(cMaterialTypeService.selectCMaterialTypeByTypeId(typeId)); + } + + /** + * 新增物料类别 + */ + @PreAuthorize("@ss.hasPermi('materialType:materialType:add')") + @Log(title = "物料类别", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody CMaterialType cMaterialType) + { + return toAjax(cMaterialTypeService.insertCMaterialType(cMaterialType)); + } + + /** + * 修改物料类别 + */ + @PreAuthorize("@ss.hasPermi('materialType:materialType:edit')") + @Log(title = "物料类别", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody CMaterialType cMaterialType) + { + return toAjax(cMaterialTypeService.updateCMaterialType(cMaterialType)); + } + + /** + * 删除物料类别 + */ + @PreAuthorize("@ss.hasPermi('materialType:materialType:remove')") + @Log(title = "物料类别", businessType = BusinessType.DELETE) + @DeleteMapping("/{typeIds}") + public AjaxResult remove(@PathVariable Long[] typeIds) + { + return toAjax(cMaterialTypeService.deleteCMaterialTypeByTypeIds(typeIds)); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/factory/domain/CFactory.java b/ruoyi-system/src/main/java/com/ruoyi/factory/domain/CFactory.java new file mode 100644 index 0000000..f1db242 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/factory/domain/CFactory.java @@ -0,0 +1,184 @@ +package com.ruoyi.factory.domain; + +import java.math.BigDecimal; +import java.util.List; +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; + +/** + * 车间管理对象 c_factory + * + * @author ruoyi + * @date 2024-02-29 + */ +public class CFactory extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** id */ + private Long factoryId; + + /** 编码 */ + @Excel(name = "编码") + private String factoryNo; + + /** 名称 */ + @Excel(name = "名称") + private String factoryName; + + /** 人工成本占比 */ + @Excel(name = "人工成本占比") + private BigDecimal factoryRgRatio; + + /** 五金费用占比 */ + @Excel(name = "五金费用占比") + private BigDecimal factoryWjRatio; + + /** 辅料费用占比 */ + @Excel(name = "辅料费用占比") + private BigDecimal factoryFlRatio; + + /** 电费占比 */ + @Excel(name = "电费占比") + private BigDecimal factoryDfRatio; + + /** 天然气费用占比 */ + @Excel(name = "天然气费用占比") + private BigDecimal factoryTrqRatio; + + /** 运输费用占比 */ + @Excel(name = "运输费用占比") + private BigDecimal factoryYsRatio; + + /** 盘具费用占比 */ + @Excel(name = "盘具费用占比") + private BigDecimal factoryPjRatio; + + /** 总占比 */ + @Excel(name = "总占比") + private BigDecimal factoryTotalRatio; + + /** 物料类别信息 */ + private List cMaterialTypeList; + + public void setFactoryId(Long factoryId) + { + this.factoryId = factoryId; + } + + public Long getFactoryId() + { + return factoryId; + } + public void setFactoryNo(String factoryNo) + { + this.factoryNo = factoryNo; + } + + public String getFactoryNo() + { + return factoryNo; + } + public void setFactoryName(String factoryName) + { + this.factoryName = factoryName; + } + + public String getFactoryName() + { + return factoryName; + } + public void setFactoryRgRatio(BigDecimal factoryRgRatio) + { + this.factoryRgRatio = factoryRgRatio; + } + + public BigDecimal getFactoryRgRatio() + { + return factoryRgRatio; + } + public void setFactoryWjRatio(BigDecimal factoryWjRatio) + { + this.factoryWjRatio = factoryWjRatio; + } + + public BigDecimal getFactoryWjRatio() + { + return factoryWjRatio; + } + public void setFactoryFlRatio(BigDecimal factoryFlRatio) + { + this.factoryFlRatio = factoryFlRatio; + } + + public BigDecimal getFactoryFlRatio() + { + return factoryFlRatio; + } + public void setFactoryDfRatio(BigDecimal factoryDfRatio) + { + this.factoryDfRatio = factoryDfRatio; + } + + public BigDecimal getFactoryDfRatio() + { + return factoryDfRatio; + } + public void setFactoryTrqRatio(BigDecimal factoryTrqRatio) + { + this.factoryTrqRatio = factoryTrqRatio; + } + + public BigDecimal getFactoryTrqRatio() + { + return factoryTrqRatio; + } + public void setFactoryYsRatio(BigDecimal factoryYsRatio) + { + this.factoryYsRatio = factoryYsRatio; + } + + public BigDecimal getFactoryYsRatio() + { + return factoryYsRatio; + } + public void setFactoryTotalRatio(BigDecimal factoryTotalRatio) + { + this.factoryTotalRatio = factoryTotalRatio; + } + + public BigDecimal getFactoryTotalRatio() + { + return factoryTotalRatio; + } + + public BigDecimal getFactoryPjRatio() {return factoryPjRatio;} + + public void setFactoryPjRatio(BigDecimal factoryPjRatio) {this.factoryPjRatio = factoryPjRatio;} + + public List getCMaterialTypeList() + { + return cMaterialTypeList; + } + + public void setCMaterialTypeList(List cMaterialTypeList){this.cMaterialTypeList = cMaterialTypeList;} + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("factoryId", getFactoryId()) + .append("factoryNo", getFactoryNo()) + .append("factoryName", getFactoryName()) + .append("factoryRgRatio", getFactoryRgRatio()) + .append("factoryWjRatio", getFactoryWjRatio()) + .append("factoryFlRatio", getFactoryFlRatio()) + .append("factoryDfRatio", getFactoryDfRatio()) + .append("factoryTrqRatio", getFactoryTrqRatio()) + .append("factoryYsRatio", getFactoryYsRatio()) + .append("factoryTotalRatio", getFactoryTotalRatio()) + .append("cMaterialTypeList", getCMaterialTypeList()) + .toString(); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/factory/domain/CMaterialType.java b/ruoyi-system/src/main/java/com/ruoyi/factory/domain/CMaterialType.java new file mode 100644 index 0000000..5f92437 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/factory/domain/CMaterialType.java @@ -0,0 +1,78 @@ +package com.ruoyi.factory.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; + +/** + * 物料类别对象 c_material_type + * + * @author ruoyi + * @date 2024-02-29 + */ +public class CMaterialType extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** id */ + private Long typeId; + + /** 编码 */ + @Excel(name = "编码") + private String typeNo; + + /** 名称 */ + @Excel(name = "名称") + private String typeName; + + /** 关联车间id */ + private Long factoryId; + + public void setTypeId(Long typeId) + { + this.typeId = typeId; + } + + public Long getTypeId() + { + return typeId; + } + public void setTypeNo(String typeNo) + { + this.typeNo = typeNo; + } + + public String getTypeNo() + { + return typeNo; + } + public void setTypeName(String typeName) + { + this.typeName = typeName; + } + + public String getTypeName() + { + return typeName; + } + public void setFactoryId(Long factoryId) + { + this.factoryId = factoryId; + } + + public Long getFactoryId() + { + return factoryId; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("typeId", getTypeId()) + .append("typeNo", getTypeNo()) + .append("typeName", getTypeName()) + .append("factoryId", getFactoryId()) + .toString(); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/factory/mapper/CFactoryMapper.java b/ruoyi-system/src/main/java/com/ruoyi/factory/mapper/CFactoryMapper.java new file mode 100644 index 0000000..803cd09 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/factory/mapper/CFactoryMapper.java @@ -0,0 +1,90 @@ +package com.ruoyi.factory.mapper; + +import java.util.List; +import com.ruoyi.factory.domain.CFactory; +import com.ruoyi.factory.domain.CMaterialType; + +/** + * 车间管理Mapper接口 + * + * @author ruoyi + * @date 2024-02-29 + */ +public interface CFactoryMapper +{ + /** + * 查询车间管理 + * + * @param factoryId 车间管理主键 + * @return 车间管理 + */ + public CFactory selectCFactoryByFactoryId(Long factoryId); + + /** + * 查询车间管理列表 + * + * @param cFactory 车间管理 + * @return 车间管理集合 + */ + public List selectCFactoryList(CFactory cFactory); + + /** + * 新增车间管理 + * + * @param cFactory 车间管理 + * @return 结果 + */ + public int insertCFactory(CFactory cFactory); + + /** + * 修改车间管理 + * + * @param cFactory 车间管理 + * @return 结果 + */ + public int updateCFactory(CFactory cFactory); + + /** + * 删除车间管理 + * + * @param factoryId 车间管理主键 + * @return 结果 + */ + public int deleteCFactoryByFactoryId(Long factoryId); + + /** + * 批量删除车间管理 + * + * @param factoryIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteCFactoryByFactoryIds(Long[] factoryIds); + + /** + * 批量删除物料类别 + * + * @param factoryIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteCMaterialTypeByFactoryIds(Long[] factoryIds); + + /** + * 批量新增物料类别 + * + * @param cMaterialTypeList 物料类别列表 + * @return 结果 + */ + public int batchCMaterialType(List cMaterialTypeList); + + + /** + * 通过车间管理主键删除物料类别信息 + * + * @param factoryId 车间管理ID + * @return 结果 + */ + public int deleteCMaterialTypeByFactoryId(Long factoryId); + + /*物料类别列表*/ + List selectCTypelist(); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/factory/service/ICFactoryService.java b/ruoyi-system/src/main/java/com/ruoyi/factory/service/ICFactoryService.java new file mode 100644 index 0000000..f883163 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/factory/service/ICFactoryService.java @@ -0,0 +1,63 @@ +package com.ruoyi.factory.service; + +import java.util.List; +import com.ruoyi.factory.domain.CFactory; + +/** + * 车间管理Service接口 + * + * @author ruoyi + * @date 2024-02-29 + */ +public interface ICFactoryService +{ + /** + * 查询车间管理 + * + * @param factoryId 车间管理主键 + * @return 车间管理 + */ + public CFactory selectCFactoryByFactoryId(Long factoryId); + + /** + * 查询车间管理列表 + * + * @param cFactory 车间管理 + * @return 车间管理集合 + */ + public List selectCFactoryList(CFactory cFactory); + + /** + * 新增车间管理 + * + * @param cFactory 车间管理 + * @return 结果 + */ + public int insertCFactory(CFactory cFactory); + + /** + * 修改车间管理 + * + * @param cFactory 车间管理 + * @return 结果 + */ + public int updateCFactory(CFactory cFactory); + + /** + * 批量删除车间管理 + * + * @param factoryIds 需要删除的车间管理主键集合 + * @return 结果 + */ + public int deleteCFactoryByFactoryIds(Long[] factoryIds); + + /** + * 删除车间管理信息 + * + * @param factoryId 车间管理主键 + * @return 结果 + */ + public int deleteCFactoryByFactoryId(Long factoryId); + + Object selectCTypelist(); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/factory/service/impl/CFactoryServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/factory/service/impl/CFactoryServiceImpl.java new file mode 100644 index 0000000..4de1df8 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/factory/service/impl/CFactoryServiceImpl.java @@ -0,0 +1,137 @@ +package com.ruoyi.factory.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import java.util.ArrayList; +import com.ruoyi.common.utils.StringUtils; +import org.springframework.transaction.annotation.Transactional; +import com.ruoyi.factory.domain.CMaterialType; +import com.ruoyi.factory.mapper.CFactoryMapper; +import com.ruoyi.factory.domain.CFactory; +import com.ruoyi.factory.service.ICFactoryService; + +/** + * 车间管理Service业务层处理 + * + * @author ruoyi + * @date 2024-02-29 + */ +@Service +public class CFactoryServiceImpl implements ICFactoryService +{ + @Autowired + private CFactoryMapper cFactoryMapper; + + /** + * 查询车间管理 + * + * @param factoryId 车间管理主键 + * @return 车间管理 + */ + @Override + public CFactory selectCFactoryByFactoryId(Long factoryId) + { + return cFactoryMapper.selectCFactoryByFactoryId(factoryId); + } + + /** + * 查询车间管理列表 + * + * @param cFactory 车间管理 + * @return 车间管理 + */ + @Override + public List selectCFactoryList(CFactory cFactory) + { + return cFactoryMapper.selectCFactoryList(cFactory); + } + + /*物料类别列表*/ + @Override + public List selectCTypelist() { + return cFactoryMapper.selectCTypelist(); + } + + /** + * 新增车间管理 + * + * @param cFactory 车间管理 + * @return 结果 + */ + @Transactional + @Override + public int insertCFactory(CFactory cFactory) + { + int rows = cFactoryMapper.insertCFactory(cFactory); + insertCMaterialType(cFactory); + return rows; + } + + /** + * 修改车间管理 + * + * @param cFactory 车间管理 + * @return 结果 + */ + @Transactional + @Override + public int updateCFactory(CFactory cFactory) + { + cFactoryMapper.deleteCMaterialTypeByFactoryId(cFactory.getFactoryId()); + insertCMaterialType(cFactory); + return cFactoryMapper.updateCFactory(cFactory); + } + + /** + * 批量删除车间管理 + * + * @param factoryIds 需要删除的车间管理主键 + * @return 结果 + */ + @Transactional + @Override + public int deleteCFactoryByFactoryIds(Long[] factoryIds) + { + cFactoryMapper.deleteCMaterialTypeByFactoryIds(factoryIds); + return cFactoryMapper.deleteCFactoryByFactoryIds(factoryIds); + } + + /** + * 删除车间管理信息 + * + * @param factoryId 车间管理主键 + * @return 结果 + */ + @Transactional + @Override + public int deleteCFactoryByFactoryId(Long factoryId) + { + cFactoryMapper.deleteCMaterialTypeByFactoryId(factoryId); + return cFactoryMapper.deleteCFactoryByFactoryId(factoryId); + } + + /** + * 新增物料类别信息 + * + * @param cFactory 车间管理对象 + */ + public void insertCMaterialType(CFactory cFactory) + { + List cMaterialTypeList = cFactory.getCMaterialTypeList(); + Long factoryId = cFactory.getFactoryId(); + if (StringUtils.isNotNull(cMaterialTypeList)) + { + List list = new ArrayList(); + for (CMaterialType cMaterialType : cMaterialTypeList) + { + cMaterialType.setFactoryId(factoryId); + list.add(cMaterialType); + } + if (list.size() > 0) + { + cFactoryMapper.batchCMaterialType(list); + } + } + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/material/domain/CMaterial.java b/ruoyi-system/src/main/java/com/ruoyi/material/domain/CMaterial.java new file mode 100644 index 0000000..ba47f5f --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/material/domain/CMaterial.java @@ -0,0 +1,121 @@ +package com.ruoyi.material.domain; + +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +import java.util.List; + +/** + * 物料管理对象 c_material + * + * @author ruoyi + * @date 2024-02-28 + */ +public class CMaterial extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** id */ + private Long materialId; + + /** 关联物料类型id */ + private Long materialTypeId; + + /** 型号 */ + @Excel(name = "型号") + private String materialXingh; + + /** 规格 */ + @Excel(name = "规格") + private String materialGuig; + + /** 电压 */ + @Excel(name = "电压") + private String materialDiany; + + /** 单位 */ + @Excel(name = "单位") + private String materialDw; + + /** 物料成本信息 */ + private List cMaterialCostList; + + public void setMaterialId(Long materialId) + { + this.materialId = materialId; + } + + public Long getMaterialId() + { + return materialId; + } + + public Long getMaterialTypeId() { + return materialTypeId; + } + + public void setMaterialTypeId(Long materialTypeId) { + this.materialTypeId = materialTypeId; + } + + public void setMaterialXingh(String materialXingh) + { + this.materialXingh = materialXingh; + } + + public String getMaterialXingh() + { + return materialXingh; + } + public void setMaterialGuig(String materialGuig) + { + this.materialGuig = materialGuig; + } + + public String getMaterialGuig() + { + return materialGuig; + } + public void setMaterialDiany(String materialDiany) + { + this.materialDiany = materialDiany; + } + + public String getMaterialDiany() + { + return materialDiany; + } + public void setMaterialDw(String materialDw) + { + this.materialDw = materialDw; + } + + public String getMaterialDw() + { + return materialDw; + } + + public List getCMaterialCostList() + { + return cMaterialCostList; + } + + public void setCMaterialCostList(List cMaterialCostList) + { + this.cMaterialCostList = cMaterialCostList; + } + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("materialId", getMaterialId()) + .append("materialXingh", getMaterialXingh()) + .append("materialGuig", getMaterialGuig()) + .append("materialDiany", getMaterialDiany()) + .append("materialDw", getMaterialDw()) + .append("cMaterialCostList", getCMaterialCostList()) + .toString(); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/material/service/ICMaterialService.java b/ruoyi-system/src/main/java/com/ruoyi/material/service/ICMaterialService.java index 9319eb8..764fe46 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/material/service/ICMaterialService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/material/service/ICMaterialService.java @@ -1,19 +1,20 @@ package com.ruoyi.material.service; -import java.util.List; import com.ruoyi.material.domain.CMaterial; +import java.util.List; + /** * 物料管理Service接口 - * + * * @author ruoyi * @date 2024-02-28 */ -public interface ICMaterialService +public interface ICMaterialService { /** * 查询物料管理 - * + * * @param materialId 物料管理主键 * @return 物料管理 */ @@ -21,7 +22,7 @@ public interface ICMaterialService /** * 查询物料管理列表 - * + * * @param cMaterial 物料管理 * @return 物料管理集合 */ @@ -29,7 +30,7 @@ public interface ICMaterialService /** * 新增物料管理 - * + * * @param cMaterial 物料管理 * @return 结果 */ @@ -37,7 +38,7 @@ public interface ICMaterialService /** * 修改物料管理 - * + * * @param cMaterial 物料管理 * @return 结果 */ @@ -45,7 +46,7 @@ public interface ICMaterialService /** * 批量删除物料管理 - * + * * @param materialIds 需要删除的物料管理主键集合 * @return 结果 */ @@ -53,7 +54,7 @@ public interface ICMaterialService /** * 删除物料管理信息 - * + * * @param materialId 物料管理主键 * @return 结果 */ diff --git a/ruoyi-system/src/main/java/com/ruoyi/material/service/impl/CMaterialServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/material/service/impl/CMaterialServiceImpl.java index f46133d..9c0ee54 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/material/service/impl/CMaterialServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/material/service/impl/CMaterialServiceImpl.java @@ -1,6 +1,8 @@ package com.ruoyi.material.service.impl; import java.util.List; + +import com.ruoyi.material.domain.CMaterial; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.ArrayList; @@ -8,24 +10,23 @@ import com.ruoyi.common.utils.StringUtils; import org.springframework.transaction.annotation.Transactional; import com.ruoyi.material.domain.CMaterialCost; import com.ruoyi.material.mapper.CMaterialMapper; -import com.ruoyi.material.domain.CMaterial; import com.ruoyi.material.service.ICMaterialService; /** * 物料管理Service业务层处理 - * + * * @author ruoyi * @date 2024-02-28 */ @Service -public class CMaterialServiceImpl implements ICMaterialService +public class CMaterialServiceImpl implements ICMaterialService { @Autowired private CMaterialMapper cMaterialMapper; /** * 查询物料管理 - * + * * @param materialId 物料管理主键 * @return 物料管理 */ @@ -37,7 +38,7 @@ public class CMaterialServiceImpl implements ICMaterialService /** * 查询物料管理列表 - * + * * @param cMaterial 物料管理 * @return 物料管理 */ @@ -49,7 +50,7 @@ public class CMaterialServiceImpl implements ICMaterialService /** * 新增物料管理 - * + * * @param cMaterial 物料管理 * @return 结果 */ @@ -64,7 +65,7 @@ public class CMaterialServiceImpl implements ICMaterialService /** * 修改物料管理 - * + * * @param cMaterial 物料管理 * @return 结果 */ @@ -79,7 +80,7 @@ public class CMaterialServiceImpl implements ICMaterialService /** * 批量删除物料管理 - * + * * @param materialIds 需要删除的物料管理主键 * @return 结果 */ @@ -93,7 +94,7 @@ public class CMaterialServiceImpl implements ICMaterialService /** * 删除物料管理信息 - * + * * @param materialId 物料管理主键 * @return 结果 */ @@ -107,7 +108,7 @@ public class CMaterialServiceImpl implements ICMaterialService /** * 新增物料成本信息 - * + * * @param cMaterial 物料管理对象 */ public void insertCMaterialCost(CMaterial cMaterial) diff --git a/ruoyi-system/src/main/java/com/ruoyi/materialType/domain/CMaterialType.java b/ruoyi-system/src/main/java/com/ruoyi/materialType/domain/CMaterialType.java new file mode 100644 index 0000000..506cd92 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/materialType/domain/CMaterialType.java @@ -0,0 +1,80 @@ +package com.ruoyi.materialType.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; +import org.apache.ibatis.type.Alias; + +/** + * 物料类别对象 c_material_type + * + * @author ruoyi + * @date 2024-03-01 + */ +@Alias("c_mtype") +public class CMaterialType extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** id */ + private Long typeId; + + /** 编码 */ + @Excel(name = "编码") + private String typeNo; + + /** 名称 */ + @Excel(name = "名称") + private String typeName; + + /** 关联车间id */ + private Long factoryId; + + public void setTypeId(Long typeId) + { + this.typeId = typeId; + } + + public Long getTypeId() + { + return typeId; + } + public void setTypeNo(String typeNo) + { + this.typeNo = typeNo; + } + + public String getTypeNo() + { + return typeNo; + } + public void setTypeName(String typeName) + { + this.typeName = typeName; + } + + public String getTypeName() + { + return typeName; + } + public void setFactoryId(Long factoryId) + { + this.factoryId = factoryId; + } + + public Long getFactoryId() + { + return factoryId; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("typeId", getTypeId()) + .append("typeNo", getTypeNo()) + .append("typeName", getTypeName()) + .append("factoryId", getFactoryId()) + .toString(); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/materialType/mapper/CMaterialTypeMapper.java b/ruoyi-system/src/main/java/com/ruoyi/materialType/mapper/CMaterialTypeMapper.java new file mode 100644 index 0000000..7f5f140 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/materialType/mapper/CMaterialTypeMapper.java @@ -0,0 +1,61 @@ +package com.ruoyi.materialType.mapper; + +import java.util.List; +import com.ruoyi.materialType.domain.CMaterialType; + +/** + * 物料类别Mapper接口 + * + * @author ruoyi + * @date 2024-03-01 + */ +public interface CMaterialTypeMapper +{ + /** + * 查询物料类别 + * + * @param typeId 物料类别主键 + * @return 物料类别 + */ + public CMaterialType selectCMaterialTypeByTypeId(Long typeId); + + /** + * 查询物料类别列表 + * + * @param cMaterialType 物料类别 + * @return 物料类别集合 + */ + public List selectCMaterialTypeList(CMaterialType cMaterialType); + + /** + * 新增物料类别 + * + * @param cMaterialType 物料类别 + * @return 结果 + */ + public int insertCMaterialType(CMaterialType cMaterialType); + + /** + * 修改物料类别 + * + * @param cMaterialType 物料类别 + * @return 结果 + */ + public int updateCMaterialType(CMaterialType cMaterialType); + + /** + * 删除物料类别 + * + * @param typeId 物料类别主键 + * @return 结果 + */ + public int deleteCMaterialTypeByTypeId(Long typeId); + + /** + * 批量删除物料类别 + * + * @param typeIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteCMaterialTypeByTypeIds(Long[] typeIds); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/materialType/service/ICMaterialTypeService.java b/ruoyi-system/src/main/java/com/ruoyi/materialType/service/ICMaterialTypeService.java new file mode 100644 index 0000000..66587c4 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/materialType/service/ICMaterialTypeService.java @@ -0,0 +1,61 @@ +package com.ruoyi.materialType.service; + +import java.util.List; +import com.ruoyi.materialType.domain.CMaterialType; + +/** + * 物料类别Service接口 + * + * @author ruoyi + * @date 2024-03-01 + */ +public interface ICMaterialTypeService +{ + /** + * 查询物料类别 + * + * @param typeId 物料类别主键 + * @return 物料类别 + */ + public CMaterialType selectCMaterialTypeByTypeId(Long typeId); + + /** + * 查询物料类别列表 + * + * @param cMaterialType 物料类别 + * @return 物料类别集合 + */ + public List selectCMaterialTypeList(CMaterialType cMaterialType); + + /** + * 新增物料类别 + * + * @param cMaterialType 物料类别 + * @return 结果 + */ + public int insertCMaterialType(CMaterialType cMaterialType); + + /** + * 修改物料类别 + * + * @param cMaterialType 物料类别 + * @return 结果 + */ + public int updateCMaterialType(CMaterialType cMaterialType); + + /** + * 批量删除物料类别 + * + * @param typeIds 需要删除的物料类别主键集合 + * @return 结果 + */ + public int deleteCMaterialTypeByTypeIds(Long[] typeIds); + + /** + * 删除物料类别信息 + * + * @param typeId 物料类别主键 + * @return 结果 + */ + public int deleteCMaterialTypeByTypeId(Long typeId); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/materialType/service/impl/CMaterialTypeServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/materialType/service/impl/CMaterialTypeServiceImpl.java new file mode 100644 index 0000000..c5ebdd1 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/materialType/service/impl/CMaterialTypeServiceImpl.java @@ -0,0 +1,93 @@ +package com.ruoyi.materialType.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.materialType.mapper.CMaterialTypeMapper; +import com.ruoyi.materialType.domain.CMaterialType; +import com.ruoyi.materialType.service.ICMaterialTypeService; + +/** + * 物料类别Service业务层处理 + * + * @author ruoyi + * @date 2024-03-01 + */ +@Service +public class CMaterialTypeServiceImpl implements ICMaterialTypeService +{ + @Autowired + private CMaterialTypeMapper cMaterialTypeMapper; + + /** + * 查询物料类别 + * + * @param typeId 物料类别主键 + * @return 物料类别 + */ + @Override + public CMaterialType selectCMaterialTypeByTypeId(Long typeId) + { + return cMaterialTypeMapper.selectCMaterialTypeByTypeId(typeId); + } + + /** + * 查询物料类别列表 + * + * @param cMaterialType 物料类别 + * @return 物料类别 + */ + @Override + public List selectCMaterialTypeList(CMaterialType cMaterialType) + { + return cMaterialTypeMapper.selectCMaterialTypeList(cMaterialType); + } + + /** + * 新增物料类别 + * + * @param cMaterialType 物料类别 + * @return 结果 + */ + @Override + public int insertCMaterialType(CMaterialType cMaterialType) + { + return cMaterialTypeMapper.insertCMaterialType(cMaterialType); + } + + /** + * 修改物料类别 + * + * @param cMaterialType 物料类别 + * @return 结果 + */ + @Override + public int updateCMaterialType(CMaterialType cMaterialType) + { + return cMaterialTypeMapper.updateCMaterialType(cMaterialType); + } + + /** + * 批量删除物料类别 + * + * @param typeIds 需要删除的物料类别主键 + * @return 结果 + */ + @Override + public int deleteCMaterialTypeByTypeIds(Long[] typeIds) + { + return cMaterialTypeMapper.deleteCMaterialTypeByTypeIds(typeIds); + } + + /** + * 删除物料类别信息 + * + * @param typeId 物料类别主键 + * @return 结果 + */ + @Override + public int deleteCMaterialTypeByTypeId(Long typeId) + { + return cMaterialTypeMapper.deleteCMaterialTypeByTypeId(typeId); + } +} diff --git a/ruoyi-system/src/main/resources/mapper/factory/CFactoryMapper.xml b/ruoyi-system/src/main/resources/mapper/factory/CFactoryMapper.xml new file mode 100644 index 0000000..f8814af --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/factory/CFactoryMapper.xml @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select factory_id, factory_no, factory_name, factory_rg_ratio, factory_wj_ratio, factory_fl_ratio, factory_df_ratio, factory_trq_ratio, factory_ys_ratio, factory_pj_ratio, factory_total_ratio from c_factory + + + + + + + + + + insert into c_factory + + factory_id, + factory_no, + factory_name, + factory_rg_ratio, + factory_wj_ratio, + factory_fl_ratio, + factory_df_ratio, + factory_trq_ratio, + factory_ys_ratio, + factory_pj_ratio, + factory_total_ratio, + + + #{factoryId}, + #{factoryNo}, + #{factoryName}, + #{factoryRgRatio}, + #{factoryWjRatio}, + #{factoryFlRatio}, + #{factoryDfRatio}, + #{factoryTrqRatio}, + #{factoryYsRatio}, + #{factoryPjRatio}, + #{factoryTotalRatio}, + + + + + update c_factory + + factory_no = #{factoryNo}, + factory_name = #{factoryName}, + factory_rg_ratio = #{factoryRgRatio}, + factory_wj_ratio = #{factoryWjRatio}, + factory_fl_ratio = #{factoryFlRatio}, + factory_df_ratio = #{factoryDfRatio}, + factory_trq_ratio = #{factoryTrqRatio}, + factory_ys_ratio = #{factoryYsRatio}, + factory_pj_ratio = #{factoryPjRatio}, + factory_total_ratio = #{factoryTotalRatio}, + + where factory_id = #{factoryId} + + + + delete from c_factory where factory_id = #{factoryId} + + + + delete from c_factory where factory_id in + + #{factoryId} + + + + + delete from c_material_type where factory_id in + + #{factoryId} + + + + + delete from c_material_type where factory_id = #{factoryId} + + + + insert into c_material_type(type_no, type_name, factory_id) values + + (#{item.typeNo}, #{item.typeName}, #{item.factoryId}) + + + diff --git a/ruoyi-system/src/main/resources/mapper/material/CMaterialMapper.xml b/ruoyi-system/src/main/resources/mapper/material/CMaterialMapper.xml index 59102d3..406c42d 100644 --- a/ruoyi-system/src/main/resources/mapper/material/CMaterialMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/material/CMaterialMapper.xml @@ -6,6 +6,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -28,7 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select material_id, material_xingh, material_guig, material_diany, material_dw from c_material + select material_id,material_type_id, material_xingh, material_guig, material_diany, material_dw from c_material + + + and type_no = #{typeNo} + and type_name like concat('%', #{typeName}, '%') + + order by type_no asc + + + + + + insert into c_material_type + + type_no, + type_name, + factory_id, + + + #{typeNo}, + #{typeName}, + #{factoryId}, + + + + + update c_material_type + + type_no = #{typeNo}, + type_name = #{typeName}, + factory_id = #{factoryId}, + + where type_id = #{typeId} + + + + delete from c_material_type where type_id = #{typeId} + + + + delete from c_material_type where type_id in + + #{typeId} + + + diff --git a/ruoyi-ui/src/api/factory/factory.js b/ruoyi-ui/src/api/factory/factory.js new file mode 100644 index 0000000..156c32b --- /dev/null +++ b/ruoyi-ui/src/api/factory/factory.js @@ -0,0 +1,53 @@ +import request from '@/utils/request' + +// 查询车间管理列表 +export function listFactory(query) { + return request({ + url: '/factory/factory/list', + method: 'get', + params: query + }) +} + +//物料类别列表 +export function listMaterialType(query) { + return request({ + url: '/factory/factory/cTypelist', + method: 'get', + params: query + }) +} + +// 查询车间管理详细 +export function getFactory(factoryId) { + return request({ + url: '/factory/factory/' + factoryId, + method: 'get' + }) +} + +// 新增车间管理 +export function addFactory(data) { + return request({ + url: '/factory/factory', + method: 'post', + data: data + }) +} + +// 修改车间管理 +export function updateFactory(data) { + return request({ + url: '/factory/factory', + method: 'put', + data: data + }) +} + +// 删除车间管理 +export function delFactory(factoryId) { + return request({ + url: '/factory/factory/' + factoryId, + method: 'delete' + }) +} diff --git a/ruoyi-ui/src/api/material/material.js b/ruoyi-ui/src/api/material/material.js index a915b2e..6667287 100644 --- a/ruoyi-ui/src/api/material/material.js +++ b/ruoyi-ui/src/api/material/material.js @@ -51,3 +51,12 @@ export function listClMaterial(query) { params: query }) } + +// 查询物料类型管理列表 +export function listMaterialType(query) { + return request({ + url: '/material/material/cTypelist', + method: 'get', + params: query + }) +} diff --git a/ruoyi-ui/src/api/materialType/materialType.js b/ruoyi-ui/src/api/materialType/materialType.js new file mode 100644 index 0000000..e09ab37 --- /dev/null +++ b/ruoyi-ui/src/api/materialType/materialType.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 查询物料类别列表 +export function listMaterialType(query) { + return request({ + url: '/materialType/materialType/list', + method: 'get', + params: query + }) +} + +// 查询物料类别详细 +export function getMaterialType(typeId) { + return request({ + url: '/materialType/materialType/' + typeId, + method: 'get' + }) +} + +// 新增物料类别 +export function addMaterialType(data) { + return request({ + url: '/materialType/materialType', + method: 'post', + data: data + }) +} + +// 修改物料类别 +export function updateMaterialType(data) { + return request({ + url: '/materialType/materialType', + method: 'put', + data: data + }) +} + +// 删除物料类别 +export function delMaterialType(typeId) { + return request({ + url: '/materialType/materialType/' + typeId, + method: 'delete' + }) +} diff --git a/ruoyi-ui/src/views/clMaterial/clMaterial/index.vue b/ruoyi-ui/src/views/clMaterial/clMaterial/index.vue index f02a6be..ad38d0d 100644 --- a/ruoyi-ui/src/views/clMaterial/clMaterial/index.vue +++ b/ruoyi-ui/src/views/clMaterial/clMaterial/index.vue @@ -76,7 +76,7 @@ - + + + diff --git a/ruoyi-ui/src/views/material/material/index.vue b/ruoyi-ui/src/views/material/material/index.vue index dd2bea4..55b6810 100644 --- a/ruoyi-ui/src/views/material/material/index.vue +++ b/ruoyi-ui/src/views/material/material/index.vue @@ -85,7 +85,7 @@ - +