change - add工序信息、关联产线、页面优化工序与产线唯一对应

master
yinq 10 months ago
parent 3a8a81be5f
commit f349297028

@ -0,0 +1,105 @@
package com.hw.mes.controller;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
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.hw.common.log.annotation.Log;
import com.hw.common.log.enums.BusinessType;
import com.hw.common.security.annotation.RequiresPermissions;
import com.hw.mes.domain.MesBaseProcessInfo;
import com.hw.mes.service.IMesBaseProcessInfoService;
import com.hw.common.core.web.controller.BaseController;
import com.hw.common.core.web.domain.AjaxResult;
import com.hw.common.core.utils.poi.ExcelUtil;
import com.hw.common.core.web.page.TableDataInfo;
/**
* Controller
*
* @author Yinq
* @date 2024-01-24
*/
@RestController
@RequestMapping("/processInfo")
public class MesBaseProcessInfoController extends BaseController
{
@Autowired
private IMesBaseProcessInfoService mesBaseProcessInfoService;
/**
*
*/
@RequiresPermissions("mes:processInfo:list")
@GetMapping("/list")
public TableDataInfo list(MesBaseProcessInfo mesBaseProcessInfo)
{
startPage();
List<MesBaseProcessInfo> list = mesBaseProcessInfoService.selectMesBaseProcessInfoList(mesBaseProcessInfo);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("mes:processInfo:export")
@Log(title = "工序信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, MesBaseProcessInfo mesBaseProcessInfo)
{
List<MesBaseProcessInfo> list = mesBaseProcessInfoService.selectMesBaseProcessInfoList(mesBaseProcessInfo);
ExcelUtil<MesBaseProcessInfo> util = new ExcelUtil<MesBaseProcessInfo>(MesBaseProcessInfo.class);
util.exportExcel(response, list, "工序信息数据");
}
/**
*
*/
@RequiresPermissions("mes:processInfo:query")
@GetMapping(value = "/{processId}")
public AjaxResult getInfo(@PathVariable("processId") Long processId)
{
return success(mesBaseProcessInfoService.selectMesBaseProcessInfoByProcessId(processId));
}
/**
*
*/
@RequiresPermissions("mes:processInfo:add")
@Log(title = "工序信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody MesBaseProcessInfo mesBaseProcessInfo)
{
return toAjax(mesBaseProcessInfoService.insertMesBaseProcessInfo(mesBaseProcessInfo));
}
/**
*
*/
@RequiresPermissions("mes:processInfo:edit")
@Log(title = "工序信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody MesBaseProcessInfo mesBaseProcessInfo)
{
return toAjax(mesBaseProcessInfoService.updateMesBaseProcessInfo(mesBaseProcessInfo));
}
/**
*
*/
@RequiresPermissions("mes:processInfo:remove")
@Log(title = "工序信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{processIds}")
public AjaxResult remove(@PathVariable Long[] processIds)
{
return toAjax(mesBaseProcessInfoService.deleteMesBaseProcessInfoByProcessIds(processIds));
}
}

@ -47,6 +47,16 @@ public class MesBaseProdlineInfoController extends BaseController
return getDataTable(list);
}
/**
* 线
*/
@GetMapping("/findProdLineList")
public AjaxResult findProdLineList(MesBaseProdlineInfo mesBaseProdlineInfo)
{
List<MesBaseProdlineInfo> list = mesBaseProdlineInfoService.selectMesBaseProdlineInfoList(mesBaseProdlineInfo);
return success(list);
}
/**
* 线
*/

@ -0,0 +1,132 @@
package com.hw.mes.domain;
import java.util.List;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.hw.common.core.annotation.Excel;
import com.hw.common.core.web.domain.BaseEntity;
/**
* mes_base_process_info
*
* @author Yinq
* @date 2024-01-24
*/
public class MesBaseProcessInfo extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
*
*/
private Long processId;
/**
*
*/
@Excel(name = "工序编号")
private String processCode;
/**
*
*/
@Excel(name = "工序名称")
private String processName;
/**
* 1-2-
*/
@Excel(name = "工序类别" , readConverterExp = "1=生产工序,2=质检工序")
private String processType;
/**
*
*/
@Excel(name = "单位生产时间")
private Long productionTime;
/**
*
*/
@Excel(name = "激活标识")
private String activeFlag;
/**
* 线
*/
private List<MesBaseProcessProdline> mesBaseProcessProdlineList;
public void setProcessId(Long processId) {
this.processId = processId;
}
public Long getProcessId() {
return processId;
}
public void setProcessCode(String processCode) {
this.processCode = processCode;
}
public String getProcessCode() {
return processCode;
}
public void setProcessName(String processName) {
this.processName = processName;
}
public String getProcessName() {
return processName;
}
public void setProcessType(String processType) {
this.processType = processType;
}
public String getProcessType() {
return processType;
}
public void setProductionTime(Long productionTime) {
this.productionTime = productionTime;
}
public Long getProductionTime() {
return productionTime;
}
public void setActiveFlag(String activeFlag) {
this.activeFlag = activeFlag;
}
public String getActiveFlag() {
return activeFlag;
}
public List<MesBaseProcessProdline> getMesBaseProcessProdlineList() {
return mesBaseProcessProdlineList;
}
public void setMesBaseProcessProdlineList(List<MesBaseProcessProdline> mesBaseProcessProdlineList) {
this.mesBaseProcessProdlineList = mesBaseProcessProdlineList;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("processId" , getProcessId())
.append("processCode" , getProcessCode())
.append("processName" , getProcessName())
.append("processType" , getProcessType())
.append("productionTime" , getProductionTime())
.append("activeFlag" , getActiveFlag())
.append("remark" , getRemark())
.append("createBy" , getCreateBy())
.append("createTime" , getCreateTime())
.append("updateBy" , getUpdateBy())
.append("updateTime" , getUpdateTime())
.append("mesBaseProcessProdlineList" , getMesBaseProcessProdlineList())
.toString();
}
}

@ -0,0 +1,52 @@
package com.hw.mes.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.hw.common.core.annotation.Excel;
import com.hw.common.core.web.domain.BaseEntity;
/**
* 线 mes_base_process_prodline
*
* @author Yinq
* @date 2024-01-24
*/
public class MesBaseProcessProdline extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 工序ID关联工序信息主键 */
private Long processId;
/** 所属产线ID关联产线主键 */
private Long prodlineId;
public void setProcessId(Long processId)
{
this.processId = processId;
}
public Long getProcessId()
{
return processId;
}
public void setProdlineId(Long prodlineId)
{
this.prodlineId = prodlineId;
}
public Long getProdlineId()
{
return prodlineId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("processId", getProcessId())
.append("prodlineId", getProdlineId())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.toString();
}
}

@ -0,0 +1,87 @@
package com.hw.mes.mapper;
import java.util.List;
import com.hw.mes.domain.MesBaseProcessInfo;
import com.hw.mes.domain.MesBaseProcessProdline;
/**
* Mapper
*
* @author Yinq
* @date 2024-01-24
*/
public interface MesBaseProcessInfoMapper
{
/**
*
*
* @param processId
* @return
*/
public MesBaseProcessInfo selectMesBaseProcessInfoByProcessId(Long processId);
/**
*
*
* @param mesBaseProcessInfo
* @return
*/
public List<MesBaseProcessInfo> selectMesBaseProcessInfoList(MesBaseProcessInfo mesBaseProcessInfo);
/**
*
*
* @param mesBaseProcessInfo
* @return
*/
public int insertMesBaseProcessInfo(MesBaseProcessInfo mesBaseProcessInfo);
/**
*
*
* @param mesBaseProcessInfo
* @return
*/
public int updateMesBaseProcessInfo(MesBaseProcessInfo mesBaseProcessInfo);
/**
*
*
* @param processId
* @return
*/
public int deleteMesBaseProcessInfoByProcessId(Long processId);
/**
*
*
* @param processIds
* @return
*/
public int deleteMesBaseProcessInfoByProcessIds(Long[] processIds);
/**
* 线
*
* @param processIds
* @return
*/
public int deleteMesBaseProcessProdlineByProcessIds(Long[] processIds);
/**
* 线
*
* @param mesBaseProcessProdlineList 线
* @return
*/
public int batchMesBaseProcessProdline(List<MesBaseProcessProdline> mesBaseProcessProdlineList);
/**
* 线
*
* @param processId ID
* @return
*/
public int deleteMesBaseProcessProdlineByProcessId(Long processId);
}

@ -0,0 +1,61 @@
package com.hw.mes.service;
import java.util.List;
import com.hw.mes.domain.MesBaseProcessInfo;
/**
* Service
*
* @author Yinq
* @date 2024-01-24
*/
public interface IMesBaseProcessInfoService
{
/**
*
*
* @param processId
* @return
*/
public MesBaseProcessInfo selectMesBaseProcessInfoByProcessId(Long processId);
/**
*
*
* @param mesBaseProcessInfo
* @return
*/
public List<MesBaseProcessInfo> selectMesBaseProcessInfoList(MesBaseProcessInfo mesBaseProcessInfo);
/**
*
*
* @param mesBaseProcessInfo
* @return
*/
public int insertMesBaseProcessInfo(MesBaseProcessInfo mesBaseProcessInfo);
/**
*
*
* @param mesBaseProcessInfo
* @return
*/
public int updateMesBaseProcessInfo(MesBaseProcessInfo mesBaseProcessInfo);
/**
*
*
* @param processIds
* @return
*/
public int deleteMesBaseProcessInfoByProcessIds(Long[] processIds);
/**
*
*
* @param processId
* @return
*/
public int deleteMesBaseProcessInfoByProcessId(Long processId);
}

@ -0,0 +1,143 @@
package com.hw.mes.service.impl;
import java.util.List;
import com.hw.common.core.exception.ServiceException;
import com.hw.common.core.utils.DateUtils;
import com.hw.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import com.hw.common.core.utils.StringUtils;
import org.springframework.transaction.annotation.Transactional;
import com.hw.mes.domain.MesBaseProcessProdline;
import com.hw.mes.mapper.MesBaseProcessInfoMapper;
import com.hw.mes.domain.MesBaseProcessInfo;
import com.hw.mes.service.IMesBaseProcessInfoService;
/**
* Service
*
* @author Yinq
* @date 2024-01-24
*/
@Service
public class MesBaseProcessInfoServiceImpl implements IMesBaseProcessInfoService
{
@Autowired
private MesBaseProcessInfoMapper mesBaseProcessInfoMapper;
/**
*
*
* @param processId
* @return
*/
@Override
public MesBaseProcessInfo selectMesBaseProcessInfoByProcessId(Long processId)
{
return mesBaseProcessInfoMapper.selectMesBaseProcessInfoByProcessId(processId);
}
/**
*
*
* @param mesBaseProcessInfo
* @return
*/
@Override
public List<MesBaseProcessInfo> selectMesBaseProcessInfoList(MesBaseProcessInfo mesBaseProcessInfo)
{
return mesBaseProcessInfoMapper.selectMesBaseProcessInfoList(mesBaseProcessInfo);
}
/**
*
*
* @param mesBaseProcessInfo
* @return
*/
@Transactional
@Override
public int insertMesBaseProcessInfo(MesBaseProcessInfo mesBaseProcessInfo)
{
mesBaseProcessInfo.setCreateTime(DateUtils.getNowDate());
int rows = mesBaseProcessInfoMapper.insertMesBaseProcessInfo(mesBaseProcessInfo);
//insertMesBaseProcessProdline(mesBaseProcessInfo);
return rows;
}
/**
*
*
* @param mesBaseProcessInfo
* @return
*/
@Transactional
@Override
public int updateMesBaseProcessInfo(MesBaseProcessInfo mesBaseProcessInfo)
{
mesBaseProcessInfo.setUpdateTime(DateUtils.getNowDate());
mesBaseProcessInfoMapper.deleteMesBaseProcessProdlineByProcessId(mesBaseProcessInfo.getProcessId());
try {
insertMesBaseProcessProdline(mesBaseProcessInfo);
} catch (Exception e) {
throw new ServiceException("该工序已关联此产线!");
}
return mesBaseProcessInfoMapper.updateMesBaseProcessInfo(mesBaseProcessInfo);
}
/**
*
*
* @param processIds
* @return
*/
@Transactional
@Override
public int deleteMesBaseProcessInfoByProcessIds(Long[] processIds)
{
mesBaseProcessInfoMapper.deleteMesBaseProcessProdlineByProcessIds(processIds);
return mesBaseProcessInfoMapper.deleteMesBaseProcessInfoByProcessIds(processIds);
}
/**
*
*
* @param processId
* @return
*/
@Transactional
@Override
public int deleteMesBaseProcessInfoByProcessId(Long processId)
{
mesBaseProcessInfoMapper.deleteMesBaseProcessProdlineByProcessId(processId);
return mesBaseProcessInfoMapper.deleteMesBaseProcessInfoByProcessId(processId);
}
/**
* 线
*
* @param mesBaseProcessInfo
*/
public void insertMesBaseProcessProdline(MesBaseProcessInfo mesBaseProcessInfo)
{
List<MesBaseProcessProdline> mesBaseProcessProdlineList = mesBaseProcessInfo.getMesBaseProcessProdlineList();
Long processId = mesBaseProcessInfo.getProcessId();
if (StringUtils.isNotNull(mesBaseProcessProdlineList))
{
List<MesBaseProcessProdline> list = new ArrayList<MesBaseProcessProdline>();
for (MesBaseProcessProdline mesBaseProcessProdline : mesBaseProcessProdlineList)
{
mesBaseProcessProdline.setProcessId(processId);
mesBaseProcessProdline.setCreateBy(SecurityUtils.getUsername());
mesBaseProcessProdline.setCreateTime(DateUtils.getNowDate());
list.add(mesBaseProcessProdline);
}
if (list.size() > 0)
{
mesBaseProcessInfoMapper.batchMesBaseProcessProdline(list);
}
}
}
}

@ -0,0 +1,163 @@
<?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.hw.mes.mapper.MesBaseProcessInfoMapper">
<resultMap type="MesBaseProcessInfo" id="MesBaseProcessInfoResult">
<result property="processId" column="process_id"/>
<result property="processCode" column="process_code"/>
<result property="processName" column="process_name"/>
<result property="processType" column="process_type"/>
<result property="productionTime" column="production_time"/>
<result property="activeFlag" column="active_flag"/>
<result property="remark" column="remark"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<resultMap id="MesBaseProcessInfoMesBaseProcessProdlineResult" type="MesBaseProcessInfo"
extends="MesBaseProcessInfoResult">
<collection property="mesBaseProcessProdlineList" notNullColumn="sub_process_id" javaType="java.util.List"
resultMap="MesBaseProcessProdlineResult"/>
</resultMap>
<resultMap type="MesBaseProcessProdline" id="MesBaseProcessProdlineResult">
<result property="processId" column="sub_process_id"/>
<result property="prodlineId" column="sub_prodline_id"/>
<result property="createBy" column="sub_create_by"/>
<result property="createTime" column="sub_create_time"/>
</resultMap>
<sql id="selectMesBaseProcessInfoVo">
select process_id,
process_code,
process_name,
process_type,
production_time,
active_flag,
remark,
create_by,
create_time,
update_by,
update_time
from mes_base_process_info
</sql>
<select id="selectMesBaseProcessInfoList" parameterType="MesBaseProcessInfo" resultMap="MesBaseProcessInfoResult">
<include refid="selectMesBaseProcessInfoVo"/>
<where>
<if test="processCode != null and processCode != ''">and process_code = #{processCode}</if>
<if test="processName != null and processName != ''">and process_name like concat('%', #{processName},
'%')
</if>
<if test="processType != null and processType != ''">and process_type = #{processType}</if>
<if test="productionTime != null ">and production_time = #{productionTime}</if>
<if test="activeFlag != null and activeFlag != ''">and active_flag = #{activeFlag}</if>
<if test="remark != null and remark != ''">and remark = #{remark}</if>
</where>
</select>
<select id="selectMesBaseProcessInfoByProcessId" parameterType="Long"
resultMap="MesBaseProcessInfoMesBaseProcessProdlineResult">
select a.process_id,
a.process_code,
a.process_name,
a.process_type,
a.production_time,
a.active_flag,
a.remark,
a.create_by,
a.create_time,
a.update_by,
a.update_time,
b.process_id as sub_process_id,
b.prodline_id as sub_prodline_id,
b.create_by as sub_create_by,
b.create_time as sub_create_time
from mes_base_process_info a
left join mes_base_process_prodline b on b.process_id = a.process_id
where a.process_id = #{processId}
</select>
<insert id="insertMesBaseProcessInfo" parameterType="MesBaseProcessInfo" useGeneratedKeys="true"
keyProperty="processId">
insert into mes_base_process_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="processCode != null">process_code,</if>
<if test="processName != null and processName != ''">process_name,</if>
<if test="processType != null and processType != ''">process_type,</if>
<if test="productionTime != null">production_time,</if>
<if test="activeFlag != null and activeFlag != ''">active_flag,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="processCode != null">#{processCode},</if>
<if test="processName != null and processName != ''">#{processName},</if>
<if test="processType != null and processType != ''">#{processType},</if>
<if test="productionTime != null">#{productionTime},</if>
<if test="activeFlag != null and activeFlag != ''">#{activeFlag},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateMesBaseProcessInfo" parameterType="MesBaseProcessInfo">
update mes_base_process_info
<trim prefix="SET" suffixOverrides=",">
<if test="processCode != null">process_code = #{processCode},</if>
<if test="processName != null and processName != ''">process_name = #{processName},</if>
<if test="processType != null and processType != ''">process_type = #{processType},</if>
<if test="productionTime != null">production_time = #{productionTime},</if>
<if test="activeFlag != null and activeFlag != ''">active_flag = #{activeFlag},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where process_id = #{processId}
</update>
<delete id="deleteMesBaseProcessInfoByProcessId" parameterType="Long">
delete
from mes_base_process_info
where process_id = #{processId}
</delete>
<delete id="deleteMesBaseProcessInfoByProcessIds" parameterType="String">
delete from mes_base_process_info where process_id in
<foreach item="processId" collection="array" open="(" separator="," close=")">
#{processId}
</foreach>
</delete>
<delete id="deleteMesBaseProcessProdlineByProcessIds" parameterType="String">
delete from mes_base_process_prodline where process_id in
<foreach item="processId" collection="array" open="(" separator="," close=")">
#{processId}
</foreach>
</delete>
<delete id="deleteMesBaseProcessProdlineByProcessId" parameterType="Long">
delete
from mes_base_process_prodline
where process_id = #{processId}
</delete>
<insert id="batchMesBaseProcessProdline">
insert into mes_base_process_prodline( process_id, prodline_id, create_by, create_time) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.processId}, #{item.prodlineId}, #{item.createBy}, #{item.createTime})
</foreach>
</insert>
</mapper>

@ -9,6 +9,15 @@ export function listBaseProdlineInfo(query) {
})
}
// 查询产线信息列表
export function findProdLineList(query) {
return request({
url: '/mes/baseProdlineInfo/findProdLineList',
method: 'get',
params: query
})
}
// 查询产线信息详细
export function getBaseProdlineInfo(prodlineId) {
return request({

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询工序信息列表
export function listProcessInfo(query) {
return request({
url: '/mes/processInfo/list',
method: 'get',
params: query
})
}
// 查询工序信息详细
export function getProcessInfo(processId) {
return request({
url: '/mes/processInfo/' + processId,
method: 'get'
})
}
// 新增工序信息
export function addProcessInfo(data) {
return request({
url: '/mes/processInfo',
method: 'post',
data: data
})
}
// 修改工序信息
export function updateProcessInfo(data) {
return request({
url: '/mes/processInfo',
method: 'put',
data: data
})
}
// 删除工序信息
export function delProcessInfo(processId) {
return request({
url: '/mes/processInfo/' + processId,
method: 'delete'
})
}

@ -0,0 +1,461 @@
<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="processName">
<el-input
v-model="queryParams.processName"
placeholder="请输入工序名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="工序类别" prop="processType">
<el-select v-model="queryParams.processType" placeholder="请选择工序类别" clearable>
<el-option
v-for="dict in dict.type.process_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</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="['mes:processInfo: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="['mes:processInfo: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="['mes:processInfo: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="['mes:processInfo:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="processInfoList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="主键标识" align="center" prop="processId" v-if="columns[0].visible"/>
<el-table-column label="工序编号" align="center" prop="processCode" v-if="columns[1].visible"/>
<el-table-column label="工序名称" align="center" prop="processName" v-if="columns[2].visible"/>
<el-table-column label="工序类别" align="center" prop="processType" v-if="columns[3].visible" >
<template slot-scope="scope">
<dict-tag :options="dict.type.process_type" :value="scope.row.processType"/>
</template>
</el-table-column>
<el-table-column label="单位生产时间" align="center" prop="productionTime" v-if="columns[4].visible"/>
<el-table-column label="激活标识" align="center" prop="activeFlag" v-if="columns[5].visible" >
<template slot-scope="scope">
<dict-tag :options="dict.type.active_flag" :value="scope.row.activeFlag"/>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" v-if="columns[6].visible"/>
<el-table-column label="创建人" align="center" prop="createBy" v-if="columns[7].visible"/>
<el-table-column label="创建时间" align="center" prop="createTime" width="180" v-if="columns[8].visible">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="更新人" align="center" prop="updateBy" v-if="columns[9].visible"/>
<el-table-column label="更新时间" align="center" prop="updateTime" width="180" v-if="columns[10].visible">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-edit"-->
<!-- @click="handleUpdate(scope.row)"-->
<!-- v-hasPermi="['mes:processInfo:edit']"-->
<!-- >修改</el-button>-->
<el-button
size="mini"
type="text"
icon="el-icon-circle-plus"
@click="handleProdLineUpdate(scope.row)"
>关联产线</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="100px">
<el-form-item label="工序编号" prop="processCode">
<el-input v-model="form.processCode" placeholder="请输入工序编号" />
</el-form-item>
<el-form-item label="工序名称" prop="processName">
<el-input v-model="form.processName" placeholder="请输入工序名称" />
</el-form-item>
<el-form-item label="工序类别" prop="processType">
<el-select v-model="form.processType" placeholder="请选择工序类别">
<el-option
v-for="dict in dict.type.process_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="单位生产时间" prop="productionTime">
<el-input v-model="form.productionTime" placeholder="请输入单位生产时间" />
</el-form-item>
<el-form-item label="激活标识" prop="activeFlag">
<el-radio-group v-model="form.activeFlag">
<el-radio
v-for="dict in dict.type.active_flag"
:key="dict.value"
:label="dict.value"
>{{ dict.label }}
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" 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>
<el-dialog :title="title" :visible.sync="prodLineOpen" width="700px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-form-item label="工序编号" prop="processCode">
<el-input v-model="form.processCode" placeholder="请输入工序编号" :disabled="true"/>
</el-form-item>
</el-col>
<el-col :span="1.5">
<el-form-item label="工序名称" prop="processName">
<el-input v-model="form.processName" placeholder="请输入工序名称" :disabled="true"/>
</el-form-item>
</el-col>
</el-row>
<!-- <el-form-item label="工序类别" prop="processType">-->
<!-- <el-select v-model="form.processType" placeholder="请选择工序类别" :disabled="true">-->
<!-- <el-option-->
<!-- v-for="dict in dict.type.process_type"-->
<!-- :key="dict.value"-->
<!-- :label="dict.label"-->
<!-- :value="dict.value"-->
<!-- ></el-option>-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<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="handleAddMesBaseProcessProdline">线</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="danger" icon="el-icon-delete" size="mini" @click="handleDeleteMesBaseProcessProdline"></el-button>
</el-col>
</el-row>
<el-table :data="mesBaseProcessProdlineList" :row-class-name="rowMesBaseProcessProdlineIndex" @selection-change="handleMesBaseProcessProdlineSelectionChange" ref="mesBaseProcessProdline">
<el-table-column type="selection" width="50" align="center" />
<el-table-column label="序号" align="center" prop="index" />
<!-- <el-table-column label="工序主键" align="center" prop="processId" />-->
<!-- <el-table-column label="工序名称" align="center" prop="processName" />-->
<el-table-column label="关联产线" align="center" prop="prodlineId" >
<template slot-scope="scope">
<el-select v-model="scope.row.prodlineId" placeholder="请选择关联产线" clearable>
<el-option
v-for="item in prodLineList"
:key="item.prodlineId"
:label="item.prodlineName"
:value="item.prodlineId"
:disabled="isProdlineDisabled(item.prodlineId)"
></el-option>
</el-select>
</template>
</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>
<script>
import { listProcessInfo, getProcessInfo, delProcessInfo, addProcessInfo, updateProcessInfo } from "@/api/mes/processInfo";
import {findFactoryList} from "@//api/mes/baseFactoryInfo";
import {findProdLineList} from "@//api/mes/baseProdlineInfo";
export default {
name: "ProcessInfo",
dicts: ['process_type','active_flag'],
data() {
return {
//
loading: true,
//
ids: [],
//
checkedMesBaseProcessProdline: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
processInfoList: [],
// 线
mesBaseProcessProdlineList: [],
//
title: "",
//
open: false,
prodLineOpen: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
processCode: null,
processName: null,
processType: null,
productionTime: null,
activeFlag: null,
remark: null,
},
//
form: {},
//
rules: {
processName: [
{ required: true, message: "工序名称不能为空", trigger: "blur" }
],
processType: [
{ required: true, message: "工序类别不能为空", trigger: "change" }
],
activeFlag: [
{ required: true, message: "激活标识不能为空", trigger: "blur" }
],
},
columns: [
{ key: 0, label: `主键标识`, visible: false },
{ key: 1, label: `工序编号`, visible: true },
{ key: 2, label: `工序名称`, visible: true },
{ key: 3, label: `工序类别`, visible: true },
{ key: 4, label: `单位生产时间`, visible: true },
{ key: 5, label: `激活标识`, visible: false },
{ key: 6, label: `备注`, visible: true },
{ key: 7, label: `创建人`, visible: false },
{ key: 8, label: `创建时间`, visible: true },
{ key: 9, label: `更新人`, visible: false },
{ key: 10, label: `更新时间`, visible: true },
],
//线
prodLineList: []
};
},
created() {
this.getList();
},
methods: {
/** 查询工序信息列表 */
getList() {
this.loading = true;
findProdLineList(null).then(response => {
this.prodLineList = response.data
})
listProcessInfo(this.queryParams).then(response => {
this.processInfoList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.prodLineOpen = false;
this.reset();
},
//
reset() {
this.form = {
processId: null,
processCode: null,
processName: null,
processType: null,
productionTime: null,
activeFlag: '1',
remark: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.mesBaseProcessProdlineList = [];
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
isProdlineDisabled(prodlineId) {
// true false
return this.mesBaseProcessProdlineList.some(item => item.prodlineId === prodlineId);
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.processId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加工序信息";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const processId = row.processId || this.ids
getProcessInfo(processId).then(response => {
this.form = response.data;
this.mesBaseProcessProdlineList = response.data.mesBaseProcessProdlineList;
this.open = true;
this.title = "修改工序信息";
});
},
handleProdLineUpdate(row) {
this.reset();
const processId = row.processId || this.ids
getProcessInfo(processId).then(response => {
this.form = response.data;
this.mesBaseProcessProdlineList = response.data.mesBaseProcessProdlineList;
this.prodLineOpen = true;
this.title = "关联产线";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
this.form.mesBaseProcessProdlineList = this.mesBaseProcessProdlineList;
if (this.form.processId != null) {
updateProcessInfo(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.prodLineOpen = false;
this.getList();
});
} else {
addProcessInfo(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const processIds = row.processId || this.ids;
this.$modal.confirm('是否确认删除工序信息编号为"' + processIds + '"的数据项?').then(function() {
return delProcessInfo(processIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 工序关联产线序号 */
rowMesBaseProcessProdlineIndex({ row, rowIndex }) {
row.index = rowIndex + 1;
},
/** 工序关联产线添加按钮操作 */
handleAddMesBaseProcessProdline() {
let obj = {};
this.mesBaseProcessProdlineList.push(obj);
console.log(this.mesBaseProcessProdlineList)
},
/** 工序关联产线删除按钮操作 */
handleDeleteMesBaseProcessProdline() {
if (this.checkedMesBaseProcessProdline.length == 0) {
this.$modal.msgError("请先选择要删除的工序关联产线数据");
} else {
const mesBaseProcessProdlineList = this.mesBaseProcessProdlineList;
const checkedMesBaseProcessProdline = this.checkedMesBaseProcessProdline;
this.mesBaseProcessProdlineList = mesBaseProcessProdlineList.filter(function(item) {
return checkedMesBaseProcessProdline.indexOf(item.index) == -1
});
}
},
/** 复选框选中数据 */
handleMesBaseProcessProdlineSelectionChange(selection) {
this.checkedMesBaseProcessProdline = selection.map(item => item.index)
},
/** 导出按钮操作 */
handleExport() {
this.download('mes/processInfo/export', {
...this.queryParams
}, `processInfo_${new Date().getTime()}.xlsx`)
}
}
};
</script>
Loading…
Cancel
Save