'20240301'
This commit is contained in:
parent
159ad624b1
commit
3d7f734baf
|
@ -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<CFactory> 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<CFactory> list = cFactoryService.selectCFactoryList(cFactory);
|
||||
ExcelUtil<CFactory> util = new ExcelUtil<CFactory>(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));
|
||||
}
|
||||
}
|
|
@ -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<CMaterial> 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询材料管理列表
|
||||
*/
|
||||
|
|
|
@ -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<CMaterialType> 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<CMaterialType> list = cMaterialTypeService.selectCMaterialTypeList(cMaterialType);
|
||||
ExcelUtil<CMaterialType> util = new ExcelUtil<CMaterialType>(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));
|
||||
}
|
||||
}
|
|
@ -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<CMaterialType> 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<CMaterialType> getCMaterialTypeList()
|
||||
{
|
||||
return cMaterialTypeList;
|
||||
}
|
||||
|
||||
public void setCMaterialTypeList(List<CMaterialType> 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();
|
||||
}
|
||||
}
|
|
@ -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();
|
||||
}
|
||||
}
|
|
@ -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<CFactory> 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<CMaterialType> cMaterialTypeList);
|
||||
|
||||
|
||||
/**
|
||||
* 通过车间管理主键删除物料类别信息
|
||||
*
|
||||
* @param factoryId 车间管理ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteCMaterialTypeByFactoryId(Long factoryId);
|
||||
|
||||
/*物料类别列表*/
|
||||
List<CMaterialType> selectCTypelist();
|
||||
}
|
|
@ -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<CFactory> 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();
|
||||
}
|
|
@ -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<CFactory> selectCFactoryList(CFactory cFactory)
|
||||
{
|
||||
return cFactoryMapper.selectCFactoryList(cFactory);
|
||||
}
|
||||
|
||||
/*物料类别列表*/
|
||||
@Override
|
||||
public List<CMaterialType> 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<CMaterialType> cMaterialTypeList = cFactory.getCMaterialTypeList();
|
||||
Long factoryId = cFactory.getFactoryId();
|
||||
if (StringUtils.isNotNull(cMaterialTypeList))
|
||||
{
|
||||
List<CMaterialType> list = new ArrayList<CMaterialType>();
|
||||
for (CMaterialType cMaterialType : cMaterialTypeList)
|
||||
{
|
||||
cMaterialType.setFactoryId(factoryId);
|
||||
list.add(cMaterialType);
|
||||
}
|
||||
if (list.size() > 0)
|
||||
{
|
||||
cFactoryMapper.batchCMaterialType(list);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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<CMaterialCost> 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<CMaterialCost> getCMaterialCostList()
|
||||
{
|
||||
return cMaterialCostList;
|
||||
}
|
||||
|
||||
public void setCMaterialCostList(List<CMaterialCost> 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();
|
||||
}
|
||||
}
|
|
@ -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 结果
|
||||
*/
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
|
@ -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<CMaterialType> 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);
|
||||
}
|
|
@ -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<CMaterialType> 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);
|
||||
}
|
|
@ -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<CMaterialType> 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);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,131 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.factory.mapper.CFactoryMapper">
|
||||
|
||||
<resultMap type="CFactory" id="CFactoryResult">
|
||||
<result property="factoryId" column="factory_id" />
|
||||
<result property="factoryNo" column="factory_no" />
|
||||
<result property="factoryName" column="factory_name" />
|
||||
<result property="factoryRgRatio" column="factory_rg_ratio" />
|
||||
<result property="factoryWjRatio" column="factory_wj_ratio" />
|
||||
<result property="factoryFlRatio" column="factory_fl_ratio" />
|
||||
<result property="factoryDfRatio" column="factory_df_ratio" />
|
||||
<result property="factoryTrqRatio" column="factory_trq_ratio" />
|
||||
<result property="factoryYsRatio" column="factory_ys_ratio" />
|
||||
<result property="factoryPjRatio" column="factory_pj_ratio" />
|
||||
<result property="factoryTotalRatio" column="factory_total_ratio" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="CFactoryCMaterialTypeResult" type="CFactory" extends="CFactoryResult">
|
||||
<collection property="cMaterialTypeList" notNullColumn="sub_type_id" javaType="java.util.List" resultMap="CMaterialTypeResult" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="CMaterialType" id="CMaterialTypeResult">
|
||||
<result property="typeId" column="sub_type_id" />
|
||||
<result property="typeNo" column="sub_type_no" />
|
||||
<result property="typeName" column="sub_type_name" />
|
||||
<result property="factoryId" column="sub_factory_id" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectCFactoryVo">
|
||||
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
|
||||
</sql>
|
||||
|
||||
<select id="selectCFactoryList" parameterType="CFactory" resultMap="CFactoryResult">
|
||||
<include refid="selectCFactoryVo"/>
|
||||
<where>
|
||||
<if test="factoryNo != null and factoryNo != ''"> and factory_no = #{factoryNo}</if>
|
||||
<if test="factoryName != null and factoryName != ''"> and factory_name like concat('%', #{factoryName}, '%')</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectCTypelist" resultType="CMaterialType">
|
||||
select type_no as typeNo,type_name as typeName from c_material_type
|
||||
</select>
|
||||
|
||||
<select id="selectCFactoryByFactoryId" parameterType="Long" resultMap="CFactoryCMaterialTypeResult">
|
||||
select a.factory_id, a.factory_no, a.factory_name, a.factory_rg_ratio, a.factory_wj_ratio, a.factory_fl_ratio, a.factory_df_ratio, a.factory_trq_ratio, a.factory_ys_ratio, a.factory_pj_ratio, a.factory_total_ratio,
|
||||
b.type_id as sub_type_id, b.type_no as sub_type_no, b.type_name as sub_type_name, b.factory_id as sub_factory_id
|
||||
from c_factory a
|
||||
left join c_material_type b on b.factory_id = a.factory_id
|
||||
where a.factory_id = #{factoryId}
|
||||
</select>
|
||||
|
||||
<insert id="insertCFactory" parameterType="CFactory">
|
||||
insert into c_factory
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="factoryId != null">factory_id,</if>
|
||||
<if test="factoryNo != null">factory_no,</if>
|
||||
<if test="factoryName != null">factory_name,</if>
|
||||
<if test="factoryRgRatio != null">factory_rg_ratio,</if>
|
||||
<if test="factoryWjRatio != null">factory_wj_ratio,</if>
|
||||
<if test="factoryFlRatio != null">factory_fl_ratio,</if>
|
||||
<if test="factoryDfRatio != null">factory_df_ratio,</if>
|
||||
<if test="factoryTrqRatio != null">factory_trq_ratio,</if>
|
||||
<if test="factoryYsRatio != null">factory_ys_ratio,</if>
|
||||
<if test="factoryPjRatio != null">factory_pj_ratio,</if>
|
||||
<if test="factoryTotalRatio != null">factory_total_ratio,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="factoryId != null">#{factoryId},</if>
|
||||
<if test="factoryNo != null">#{factoryNo},</if>
|
||||
<if test="factoryName != null">#{factoryName},</if>
|
||||
<if test="factoryRgRatio != null">#{factoryRgRatio},</if>
|
||||
<if test="factoryWjRatio != null">#{factoryWjRatio},</if>
|
||||
<if test="factoryFlRatio != null">#{factoryFlRatio},</if>
|
||||
<if test="factoryDfRatio != null">#{factoryDfRatio},</if>
|
||||
<if test="factoryTrqRatio != null">#{factoryTrqRatio},</if>
|
||||
<if test="factoryYsRatio != null">#{factoryYsRatio},</if>
|
||||
<if test="factoryPjRatio != null">#{factoryPjRatio},</if>
|
||||
<if test="factoryTotalRatio != null">#{factoryTotalRatio},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateCFactory" parameterType="CFactory">
|
||||
update c_factory
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="factoryNo != null">factory_no = #{factoryNo},</if>
|
||||
<if test="factoryName != null">factory_name = #{factoryName},</if>
|
||||
<if test="factoryRgRatio != null">factory_rg_ratio = #{factoryRgRatio},</if>
|
||||
<if test="factoryWjRatio != null">factory_wj_ratio = #{factoryWjRatio},</if>
|
||||
<if test="factoryFlRatio != null">factory_fl_ratio = #{factoryFlRatio},</if>
|
||||
<if test="factoryDfRatio != null">factory_df_ratio = #{factoryDfRatio},</if>
|
||||
<if test="factoryTrqRatio != null">factory_trq_ratio = #{factoryTrqRatio},</if>
|
||||
<if test="factoryYsRatio != null">factory_ys_ratio = #{factoryYsRatio},</if>
|
||||
<if test="factoryPjRatio != null">factory_pj_ratio = #{factoryPjRatio},</if>
|
||||
<if test="factoryTotalRatio != null">factory_total_ratio = #{factoryTotalRatio},</if>
|
||||
</trim>
|
||||
where factory_id = #{factoryId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteCFactoryByFactoryId" parameterType="Long">
|
||||
delete from c_factory where factory_id = #{factoryId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteCFactoryByFactoryIds" parameterType="String">
|
||||
delete from c_factory where factory_id in
|
||||
<foreach item="factoryId" collection="array" open="(" separator="," close=")">
|
||||
#{factoryId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteCMaterialTypeByFactoryIds" parameterType="String">
|
||||
delete from c_material_type where factory_id in
|
||||
<foreach item="factoryId" collection="array" open="(" separator="," close=")">
|
||||
#{factoryId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteCMaterialTypeByFactoryId" parameterType="Long">
|
||||
delete from c_material_type where factory_id = #{factoryId}
|
||||
</delete>
|
||||
|
||||
<insert id="batchCMaterialType">
|
||||
insert into c_material_type(type_no, type_name, factory_id) values
|
||||
<foreach item="item" index="index" collection="list" separator=",">
|
||||
(#{item.typeNo}, #{item.typeName}, #{item.factoryId})
|
||||
</foreach>
|
||||
</insert>
|
||||
</mapper>
|
|
@ -6,6 +6,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<resultMap type="CMaterial" id="CMaterialResult">
|
||||
<result property="materialId" column="material_id" />
|
||||
<result property="materialTypeId" column="material_type_id" />
|
||||
<result property="materialXingh" column="material_xingh" />
|
||||
<result property="materialGuig" column="material_guig" />
|
||||
<result property="materialDiany" column="material_diany" />
|
||||
|
@ -28,7 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</resultMap>
|
||||
|
||||
<sql id="selectCMaterialVo">
|
||||
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
|
||||
</sql>
|
||||
|
||||
<select id="selectCMaterialList" parameterType="CMaterial" resultMap="CMaterialResult">
|
||||
|
@ -41,7 +42,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</select>
|
||||
|
||||
<select id="selectCMaterialByMaterialId" parameterType="Long" resultMap="CMaterialCMaterialCostResult">
|
||||
select a.material_id, a.material_xingh, a.material_guig, a.material_diany, a.material_dw,
|
||||
select a.material_id, a.material_type_id, a.material_xingh, a.material_guig, a.material_diany, a.material_dw,
|
||||
b.cost_id as sub_cost_id, b.cost_material_id as sub_cost_material_id, b.cost_cl_id as sub_cost_cl_id,
|
||||
b.cost_cl_qty as sub_cost_cl_qty, b.cost_cl_qty_2 as sub_cost_cl_qty_2,
|
||||
c.material_price as sub_material_price,c.material_name as sub_material_name
|
||||
|
@ -55,12 +56,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<insert id="insertCMaterial" parameterType="CMaterial">
|
||||
insert into c_material
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="materialTypeId != null and materialTypeId != ''">material_type_id,</if>
|
||||
<if test="materialXingh != null and materialXingh != ''">material_xingh,</if>
|
||||
<if test="materialGuig != null and materialGuig != ''">material_guig,</if>
|
||||
<if test="materialDiany != null">material_diany,</if>
|
||||
<if test="materialDw != null">material_dw,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="materialTypeId != null and materialTypeId != ''">#{materialTypeId},</if>
|
||||
<if test="materialXingh != null and materialXingh != ''">#{materialXingh},</if>
|
||||
<if test="materialGuig != null and materialGuig != ''">#{materialGuig},</if>
|
||||
<if test="materialDiany != null">#{materialDiany},</if>
|
||||
|
@ -71,6 +74,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<update id="updateCMaterial" parameterType="CMaterial">
|
||||
update c_material
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="materialTypeId != null and materialTypeId != ''">material_type_id = #{materialTypeId},</if>
|
||||
<if test="materialXingh != null and materialXingh != ''">material_xingh = #{materialXingh},</if>
|
||||
<if test="materialGuig != null and materialGuig != ''">material_guig = #{materialGuig},</if>
|
||||
<if test="materialDiany != null">material_diany = #{materialDiany},</if>
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.materialType.mapper.CMaterialTypeMapper">
|
||||
|
||||
<resultMap type="c_mtype" id="CMaterialTypeResult">
|
||||
<result property="typeId" column="type_id" />
|
||||
<result property="typeNo" column="type_no" />
|
||||
<result property="typeName" column="type_name" />
|
||||
<result property="factoryId" column="factory_id" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectCMaterialTypeVo">
|
||||
select type_id, type_no, type_name, factory_id from c_material_type
|
||||
</sql>
|
||||
|
||||
<select id="selectCMaterialTypeList" parameterType="CMaterialType" resultMap="CMaterialTypeResult">
|
||||
<include refid="selectCMaterialTypeVo"/>
|
||||
<where>
|
||||
<if test="typeNo != null and typeNo != ''"> and type_no = #{typeNo}</if>
|
||||
<if test="typeName != null and typeName != ''"> and type_name like concat('%', #{typeName}, '%')</if>
|
||||
</where>
|
||||
order by type_no asc
|
||||
</select>
|
||||
|
||||
<select id="selectCMaterialTypeByTypeId" parameterType="Long" resultMap="CMaterialTypeResult">
|
||||
<include refid="selectCMaterialTypeVo"/>
|
||||
where type_id = #{typeId}
|
||||
</select>
|
||||
|
||||
<insert id="insertCMaterialType" parameterType="CMaterialType" useGeneratedKeys="true" keyProperty="typeId">
|
||||
insert into c_material_type
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="typeNo != null and typeNo != ''">type_no,</if>
|
||||
<if test="typeName != null and typeName != ''">type_name,</if>
|
||||
<if test="factoryId != null">factory_id,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="typeNo != null and typeNo != ''">#{typeNo},</if>
|
||||
<if test="typeName != null and typeName != ''">#{typeName},</if>
|
||||
<if test="factoryId != null">#{factoryId},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateCMaterialType" parameterType="CMaterialType">
|
||||
update c_material_type
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="typeNo != null and typeNo != ''">type_no = #{typeNo},</if>
|
||||
<if test="typeName != null and typeName != ''">type_name = #{typeName},</if>
|
||||
<if test="factoryId != null">factory_id = #{factoryId},</if>
|
||||
</trim>
|
||||
where type_id = #{typeId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteCMaterialTypeByTypeId" parameterType="Long">
|
||||
delete from c_material_type where type_id = #{typeId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteCMaterialTypeByTypeIds" parameterType="String">
|
||||
delete from c_material_type where type_id in
|
||||
<foreach item="typeId" collection="array" open="(" separator="," close=")">
|
||||
#{typeId}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
|
@ -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'
|
||||
})
|
||||
}
|
|
@ -51,3 +51,12 @@ export function listClMaterial(query) {
|
|||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询物料类型管理列表
|
||||
export function listMaterialType(query) {
|
||||
return request({
|
||||
url: '/material/material/cTypelist',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
|
|
@ -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'
|
||||
})
|
||||
}
|
|
@ -76,7 +76,7 @@
|
|||
<el-table-column label="编码" align="center" prop="materialNo" />
|
||||
<el-table-column label="名称" align="center" prop="materialName" />
|
||||
<el-table-column label="单价" align="center" prop="materialPrice" />
|
||||
<el-table-column label="操作" width="250" align="center" class-name="small-padding fixed-width">
|
||||
<el-table-column label="操作" width="250" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
|
|
|
@ -0,0 +1,421 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="编码" prop="factoryNo">
|
||||
<el-input
|
||||
v-model="queryParams.factoryNo"
|
||||
placeholder="请输入编码"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="名称" prop="factoryName">
|
||||
<el-input
|
||||
v-model="queryParams.factoryName"
|
||||
placeholder="请输入名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['factory:factory:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['factory:factory:edit']"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['factory:factory:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['factory:factory:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table width="1000" v-loading="loading" :data="factoryList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="id" align="center" prop="factoryId" v-if="false"/>
|
||||
<el-table-column label="编码" align="center" prop="factoryNo" />
|
||||
<el-table-column label="名称" align="center" prop="factoryName" />
|
||||
<el-table-column label="人工成本占比" align="center" prop="factoryRgRatio" />
|
||||
<el-table-column label="五金费用占比" align="center" prop="factoryWjRatio" />
|
||||
<el-table-column label="辅料费用占比" align="center" prop="factoryFlRatio" />
|
||||
<el-table-column label="电费占比" align="center" prop="factoryDfRatio" />
|
||||
<el-table-column label="天然气费用占比" width="120" align="center" prop="factoryTrqRatio" />
|
||||
<el-table-column label="运输费用占比" align="center" prop="factoryYsRatio" />
|
||||
<el-table-column label="盘具费用占比" align="center" prop="factoryPjRatio" />
|
||||
<el-table-column label="总占比" align="center" prop="factoryTotalRatio" />
|
||||
<el-table-column fixed="right" label="操作" align="center" width="150" >
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['factory:factory:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['factory:factory:remove']"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改车间管理对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="编码" prop="factoryNo" label-width="120px">
|
||||
<el-input v-model="form.factoryNo" placeholder="请输入编码" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="名称" prop="factoryName" label-width="120px">
|
||||
<el-input v-model="form.factoryName" placeholder="请输入名称" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="人工成本占比" prop="factoryRgRatio" label-width="120px">
|
||||
<el-input v-model="form.factoryRgRatio" placeholder="请输入人工成本占比" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="五金费用占比" prop="factoryWjRatio" label-width="120px">
|
||||
<el-input v-model="form.factoryWjRatio" placeholder="请输入五金费用占比" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="辅料费用占比" prop="factoryFlRatio" label-width="120px">
|
||||
<el-input v-model="form.factoryFlRatio" placeholder="请输入辅料费用占比" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="电费占比" prop="factoryDfRatio" label-width="120px">
|
||||
<el-input v-model="form.factoryDfRatio" placeholder="请输入电费占比" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="天然气费用占比" prop="factoryTrqRatio" label-width="120px">
|
||||
<el-input v-model="form.factoryTrqRatio" placeholder="请输入天然气费用占比" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="运输费用占比" prop="factoryYsRatio" label-width="120px">
|
||||
<el-input v-model="form.factoryYsRatio" placeholder="请输入运输费用占比" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="盘踞费用占比" prop="factoryPjRatio" label-width="120px">
|
||||
<el-input v-model="form.factoryPjRatio" placeholder="请输入盘踞费用占比" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="总占比" prop="factoryYsRatio" label-width="120px">
|
||||
<el-input v-model="form.factoryTotalRatio" :disabled="true"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-divider content-position="center">物料类别信息</el-divider>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAddCMaterialType">添加</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" icon="el-icon-delete" size="mini" @click="handleDeleteCMaterialType">删除</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-table :data="cMaterialTypeList" width="100%" :row-class-name="rowCMaterialTypeIndex" @selection-change="handleCMaterialTypeSelectionChange" ref="cMaterialType">
|
||||
<el-table-column type="selection" width="50" align="center" />
|
||||
<el-table-column label="序号" width="50" align="center" prop="index"/>
|
||||
<el-table-column label="编码" prop="typeNo">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.typeNo" placeholder="请输入编码" />
|
||||
</template>
|
||||
<template slot-scope="scope">
|
||||
<el-select v-model="scope.row.typeNo" placeholder="请选择" @change="selectTypeChange(scope.row)">
|
||||
<el-option
|
||||
v-for="item in cTypeList"
|
||||
:key="item.typeNo"
|
||||
:label="item.typeNo"
|
||||
:value="item.typeNo"
|
||||
/>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="名称" prop="typeName"></el-table-column>
|
||||
</el-table>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
<style scoped>
|
||||
/* 根据需求设置位置上下偏移 */
|
||||
.offset {
|
||||
margin-top: 0px; /* 向上偏移5像素 */
|
||||
margin-bottom: 0px; /* 向下偏移5像素 */
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
import { listFactory, getFactory, delFactory, addFactory, updateFactory,listMaterialType } from "@/api/factory/factory";
|
||||
|
||||
export default {
|
||||
name: "Factory",
|
||||
dicts: ['material_type'],
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 子表选中数据
|
||||
checkedCMaterialType: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 车间管理表格数据
|
||||
factoryList: [],
|
||||
// 物料类别表格数据
|
||||
cMaterialTypeList: [],
|
||||
cTypeList: [],
|
||||
cTypeMap: {},
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
factoryNo: null,
|
||||
factoryName: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
this.getMaterialType();
|
||||
},
|
||||
methods: {
|
||||
/** 查询车间管理列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listFactory(this.queryParams).then(response => {
|
||||
this.factoryList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
|
||||
//物料类别列表
|
||||
getMaterialType(){
|
||||
listMaterialType(this.queryParams).then(response => {
|
||||
this.cTypeList = response.cTypeList;
|
||||
|
||||
let obj = {};
|
||||
this.cTypeList.forEach(item => {
|
||||
let key = item.typeNo;
|
||||
obj[key] = item.typeName;
|
||||
})
|
||||
this.cTypeMap = obj;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
factoryId: null,
|
||||
factoryNo: null,
|
||||
factoryName: null,
|
||||
factoryRgRatio: null,
|
||||
factoryWjRatio: null,
|
||||
factoryFlRatio: null,
|
||||
factoryDfRatio: null,
|
||||
factoryTrqRatio: null,
|
||||
factoryYsRatio: null,
|
||||
factoryPjRatio: null,
|
||||
factoryTotalRatio: null
|
||||
};
|
||||
this.cMaterialTypeList = [];
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.factoryId)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加车间管理";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const factoryId = row.factoryId || this.ids
|
||||
getFactory(factoryId).then(response => {
|
||||
this.form = response.data;
|
||||
this.cMaterialTypeList = response.data.cmaterialTypeList;
|
||||
this.open = true;
|
||||
this.title = "修改车间管理";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
this.form.cMaterialTypeList = this.cMaterialTypeList;
|
||||
if (this.form.factoryId != null) {
|
||||
updateFactory(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addFactory(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const factoryIds = row.factoryId || this.ids;
|
||||
this.$modal.confirm('是否确认删除车间管理编号为"' + factoryIds + '"的数据项?').then(function() {
|
||||
return delFactory(factoryIds);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 物料类别序号 */
|
||||
rowCMaterialTypeIndex({ row, rowIndex }) {
|
||||
row.index = rowIndex + 1;
|
||||
},
|
||||
/** 物料类别添加按钮操作 */
|
||||
handleAddCMaterialType() {
|
||||
let obj = {};
|
||||
obj.typeNo = "";
|
||||
obj.typeName = "";
|
||||
this.cMaterialTypeList.push(obj);
|
||||
},
|
||||
/** 物料类别删除按钮操作 */
|
||||
handleDeleteCMaterialType() {
|
||||
if (this.checkedCMaterialType.length == 0) {
|
||||
this.$modal.msgError("请先选择要删除的物料类别数据");
|
||||
} else {
|
||||
const cMaterialTypeList = this.cMaterialTypeList;
|
||||
const checkedCMaterialType = this.checkedCMaterialType;
|
||||
this.cMaterialTypeList = cMaterialTypeList.filter(function(item) {
|
||||
return checkedCMaterialType.indexOf(item.index) == -1
|
||||
});
|
||||
}
|
||||
},
|
||||
/** 复选框选中数据 */
|
||||
handleCMaterialTypeSelectionChange(selection) {
|
||||
this.checkedCMaterialType = selection.map(item => item.index)
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('factory/factory/export', {
|
||||
...this.queryParams
|
||||
}, `factory_${new Date().getTime()}.xlsx`)
|
||||
},
|
||||
/*更改物料类型事件*/
|
||||
selectTypeChange(row){
|
||||
console.log(row.typeNo)
|
||||
row.typeName = this.cTypeMap[row.typeNo];
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
|
@ -85,7 +85,7 @@
|
|||
<el-table-column label="规格" align="center" prop="materialGuig" />
|
||||
<el-table-column label="电压" align="center" prop="materialDiany" />
|
||||
<el-table-column label="单位" align="center" prop="materialDw" />
|
||||
<el-table-column label="操作" width="250" align="center" class-name="small-padding fixed-width">
|
||||
<el-table-column label="操作" width="250" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
|
@ -116,6 +116,20 @@
|
|||
<!-- 添加或修改物料管理对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="1200px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="类别" prop="materialTypeId">
|
||||
<el-select v-model="form.materialTypeId" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in cTypeList"
|
||||
:key="item.typeNo"
|
||||
:label="item.typeNo"
|
||||
:value="item.typeNo"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="型号" prop="materialXingh">
|
||||
|
@ -194,7 +208,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { listMaterial, getMaterial, delMaterial, addMaterial, updateMaterial, listClMaterial } from "@/api/material/material";
|
||||
import { listMaterial, getMaterial, delMaterial, addMaterial, updateMaterial, listClMaterial, listMaterialType } from "@/api/material/material";
|
||||
import log from "../../monitor/job/log";
|
||||
import { numAdd,numSub,numMulti,numDiv } from "@/utils/operation";
|
||||
|
||||
|
@ -222,7 +236,9 @@ export default {
|
|||
materialList: [],
|
||||
// 物料成本表格数据
|
||||
cMaterialCostList: [],
|
||||
//材料选择
|
||||
//物料类型选项
|
||||
cTypeList: [],
|
||||
//材料选项
|
||||
cmaterials: [],
|
||||
cmaterialsmap: {},
|
||||
// 弹出层标题
|
||||
|
@ -253,6 +269,7 @@ export default {
|
|||
created() {
|
||||
this.getList();
|
||||
this.getClMaterials();
|
||||
this.getMaterialType();
|
||||
},
|
||||
computed:{
|
||||
|
||||
|
@ -269,6 +286,7 @@ export default {
|
|||
});
|
||||
},
|
||||
|
||||
//材料选项
|
||||
getClMaterials(){
|
||||
listClMaterial(this.queryParams).then(response => {
|
||||
this.cmaterials = response.cmaterials;
|
||||
|
@ -282,6 +300,20 @@ export default {
|
|||
});
|
||||
},
|
||||
|
||||
//物料类别列表
|
||||
getMaterialType(){
|
||||
listMaterialType(this.queryParams).then(response => {
|
||||
this.cTypeList = response.cTypeList;
|
||||
|
||||
let obj = {};
|
||||
this.cTypeList.forEach(item => {
|
||||
let key = item.typeNo;
|
||||
obj[key] = item.typeName;
|
||||
})
|
||||
this.cTypeMap = obj;
|
||||
});
|
||||
},
|
||||
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
|
|
|
@ -0,0 +1,270 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="编码" prop="typeNo">
|
||||
<el-input
|
||||
v-model="queryParams.typeNo"
|
||||
placeholder="请输入编码"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="名称" prop="typeName">
|
||||
<el-input
|
||||
v-model="queryParams.typeName"
|
||||
placeholder="请输入名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['materialType:materialType:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['materialType:materialType:edit']"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['materialType:materialType:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['materialType:materialType:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="materialTypeList" :row-class-name="rowCMaterialTypeIndex" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="id" align="center" prop="typeId" v-if="false"/>
|
||||
<el-table-column label="编码" align="center" prop="typeNo" />
|
||||
<el-table-column label="名称" align="center" prop="typeName" />
|
||||
<el-table-column label="操作" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['materialType:materialType:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['materialType:materialType:remove']"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改物料类别对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="编码" prop="typeNo">
|
||||
<el-input v-model="form.typeNo" placeholder="请输入编码" />
|
||||
</el-form-item>
|
||||
<el-form-item label="名称" prop="typeName">
|
||||
<el-input v-model="form.typeName" placeholder="请输入名称" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listMaterialType, getMaterialType, delMaterialType, addMaterialType, updateMaterialType } from "@/api/materialType/materialType";
|
||||
|
||||
export default {
|
||||
name: "MaterialType",
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 物料类别表格数据
|
||||
materialTypeList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
typeNo: null,
|
||||
typeName: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
typeNo: [
|
||||
{ required: true, message: "编码不能为空", trigger: "blur" }
|
||||
],
|
||||
typeName: [
|
||||
{ required: true, message: "名称不能为空", trigger: "blur" }
|
||||
],
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询物料类别列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listMaterialType(this.queryParams).then(response => {
|
||||
this.materialTypeList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
typeId: null,
|
||||
typeNo: null,
|
||||
typeName: null,
|
||||
factoryId: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.typeId)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加物料类别";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const typeId = row.typeId || this.ids
|
||||
getMaterialType(typeId).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改物料类别";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.typeId != null) {
|
||||
updateMaterialType(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addMaterialType(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const typeIds = row.typeId || this.ids;
|
||||
this.$modal.confirm('是否确认删除物料类别编号为"' + typeIds + '"的数据项?').then(function() {
|
||||
return delMaterialType(typeIds);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('materialType/materialType/export', {
|
||||
...this.queryParams
|
||||
}, `materialType_${new Date().getTime()}.xlsx`)
|
||||
},
|
||||
/** 序号 */
|
||||
rowCMaterialTypeIndex({ row, rowIndex }) {
|
||||
row.index = rowIndex + 1;
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
Loading…
Reference in New Issue