change - 优化工艺路线、工序、工位、生产工单单位时间页面逻辑。生产BOM优化新增安装时长

master
yinq 8 months ago
parent e9a39e25a8
commit 6f6f1ba38f

@ -33,6 +33,12 @@ public class MesBaseRoute extends BaseEntity {
@Excel(name = "工艺路线说明")
private String routeDesc;
/**
*
*/
@Excel(name = "单位时间")
private Long productionTime;
/**
*
*/
@ -44,6 +50,14 @@ public class MesBaseRoute extends BaseEntity {
*/
private List<MesBaseRouteProcess> mesBaseRouteProcessList;
public Long getProductionTime() {
return productionTime;
}
public void setProductionTime(Long productionTime) {
this.productionTime = productionTime;
}
public void setRouteId(Long routeId) {
this.routeId = routeId;
}

@ -80,6 +80,20 @@ public class MesMaterialBom extends TreeEntity {
*/
private String materialNameDesc;
/**
*
*/
@Excel(name = "安装时长")
private Long assembleTime;
public Long getAssembleTime() {
return assembleTime;
}
public void setAssembleTime(Long assembleTime) {
this.assembleTime = assembleTime;
}
public String getMaterialNameDesc() {
return materialNameDesc;
}

@ -185,6 +185,20 @@ public class MesProductOrder extends BaseEntity {
@Excel(name = "物料名称")
private String materialName;
/**
*
*/
@Excel(name = "单位时间")
private Long productionTime;
public Long getProductionTime() {
return productionTime;
}
public void setProductionTime(Long productionTime) {
this.productionTime = productionTime;
}
public String getMaterialBomDesc() {
return materialBomDesc;
}

@ -1,62 +1,94 @@
<?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">
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hw.mes.mapper.MesBaseRouteMapper">
<resultMap type="MesBaseRoute" id="MesBaseRouteResult">
<result property="routeId" column="route_id" />
<result property="routeName" column="route_name" />
<result property="routeDesc" column="route_desc" />
<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" />
<result property="routeId" column="route_id"/>
<result property="routeName" column="route_name"/>
<result property="routeDesc" column="route_desc"/>
<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"/>
<result property="productionTime" column="production_time"/>
</resultMap>
<resultMap id="MesBaseRouteMesBaseRouteProcessResult" type="MesBaseRoute" extends="MesBaseRouteResult">
<collection property="mesBaseRouteProcessList" notNullColumn="sub_route_process_id" javaType="java.util.List" resultMap="MesBaseRouteProcessResult" />
<collection property="mesBaseRouteProcessList" notNullColumn="sub_route_process_id" javaType="java.util.List"
resultMap="MesBaseRouteProcessResult"/>
</resultMap>
<resultMap type="MesBaseRouteProcess" id="MesBaseRouteProcessResult">
<result property="routeProcessId" column="sub_route_process_id" />
<result property="routeId" column="sub_route_id" />
<result property="processId" column="sub_process_id" />
<result property="processOrder" column="sub_process_order" />
<result property="remark" column="sub_remark" />
<result property="createBy" column="sub_create_by" />
<result property="createTime" column="sub_create_time" />
<result property="updateBy" column="sub_update_by" />
<result property="updateTime" column="sub_update_time" />
<result property="routeProcessId" column="sub_route_process_id"/>
<result property="routeId" column="sub_route_id"/>
<result property="processId" column="sub_process_id"/>
<result property="processOrder" column="sub_process_order"/>
<result property="remark" column="sub_remark"/>
<result property="createBy" column="sub_create_by"/>
<result property="createTime" column="sub_create_time"/>
<result property="updateBy" column="sub_update_by"/>
<result property="updateTime" column="sub_update_time"/>
</resultMap>
<sql id="selectMesBaseRouteVo">
select route_id, route_name, route_desc, active_flag, remark, create_by, create_time, update_by, update_time from mes_base_route
select a.route_id,
a.route_name,
a.route_desc,
a.active_flag,
a.remark,
a.create_by,
a.create_time,
a.update_by,
a.update_time,
sum(p.production_time) production_time
from mes_base_route a
left join mes_base_route_process b on b.route_id = a.route_id
left join mes_base_process_info p on p.process_id = b.process_id
</sql>
<select id="selectMesBaseRouteList" parameterType="MesBaseRoute" resultMap="MesBaseRouteResult">
<include refid="selectMesBaseRouteVo"/>
<where>
<if test="routeName != null and routeName != ''"> and route_name like concat('%', #{routeName}, '%')</if>
<if test="routeDesc != null and routeDesc != ''"> and route_desc = #{routeDesc}</if>
<if test="activeFlag != null and activeFlag != ''"> and active_flag = #{activeFlag}</if>
<if test="createBy != null and createBy != ''"> and create_by = #{createBy}</if>
<if test="createTime != null "> and create_time = #{createTime}</if>
<if test="updateBy != null and updateBy != ''"> and update_by = #{updateBy}</if>
<if test="updateTime != null "> and update_time = #{updateTime}</if>
<where>
<if test="routeName != null and routeName != ''">and a.route_name like concat('%', #{routeName}, '%')</if>
<if test="routeDesc != null and routeDesc != ''">and a.route_desc = #{routeDesc}</if>
<if test="activeFlag != null and activeFlag != ''">and a.active_flag = #{activeFlag}</if>
<if test="createBy != null and createBy != ''">and a.create_by = #{createBy}</if>
<if test="createTime != null ">and a.create_time = #{createTime}</if>
<if test="updateBy != null and updateBy != ''">and a.update_by = #{updateBy}</if>
<if test="updateTime != null ">and a.update_time = #{updateTime}</if>
</where>
group by a.route_id, a.route_name, a.route_desc, a.active_flag, a.remark, a.create_by, a.create_time, a.update_by,
a.update_time
</select>
<select id="selectMesBaseRouteByRouteId" parameterType="Long" resultMap="MesBaseRouteMesBaseRouteProcessResult">
select a.route_id, a.route_name, a.route_desc, a.active_flag, a.remark, a.create_by, a.create_time, a.update_by, a.update_time,
b.route_process_id as sub_route_process_id, b.route_id as sub_route_id, b.process_id as sub_process_id, b.process_order as sub_process_order, b.remark as sub_remark, b.create_by as sub_create_by, b.create_time as sub_create_time, b.update_by as sub_update_by, b.update_time as sub_update_time
select a.route_id,
a.route_name,
a.route_desc,
a.active_flag,
a.remark,
a.create_by,
a.create_time,
a.update_by,
a.update_time,
b.route_process_id as sub_route_process_id,
b.route_id as sub_route_id,
b.process_id as sub_process_id,
b.process_order as sub_process_order,
b.remark as sub_remark,
b.create_by as sub_create_by,
b.create_time as sub_create_time,
b.update_by as sub_update_by,
b.update_time as sub_update_time
from mes_base_route a
left join mes_base_route_process b on b.route_id = a.route_id
left join mes_base_route_process b on b.route_id = a.route_id
where a.route_id = #{routeId}
</select>
<insert id="insertMesBaseRoute" parameterType="MesBaseRoute" useGeneratedKeys="true" keyProperty="routeId">
insert into mes_base_route
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -68,7 +100,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="routeName != null and routeName != ''">#{routeName},</if>
<if test="routeDesc != null">#{routeDesc},</if>
@ -78,7 +110,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</trim>
</insert>
<update id="updateMesBaseRoute" parameterType="MesBaseRoute">
@ -97,31 +129,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<delete id="deleteMesBaseRouteByRouteId" parameterType="Long">
delete from mes_base_route where route_id = #{routeId}
delete
from mes_base_route
where route_id = #{routeId}
</delete>
<delete id="deleteMesBaseRouteByRouteIds" parameterType="String">
delete from mes_base_route where route_id in
delete from mes_base_route where route_id in
<foreach item="routeId" collection="array" open="(" separator="," close=")">
#{routeId}
</foreach>
</delete>
<delete id="deleteMesBaseRouteProcessByRouteIds" parameterType="String">
delete from mes_base_route_process where route_id in
delete from mes_base_route_process where route_id in
<foreach item="routeId" collection="array" open="(" separator="," close=")">
#{routeId}
</foreach>
</delete>
<delete id="deleteMesBaseRouteProcessByRouteId" parameterType="Long">
delete from mes_base_route_process where route_id = #{routeId}
delete
from mes_base_route_process
where route_id = #{routeId}
</delete>
<insert id="batchMesBaseRouteProcess">
insert into mes_base_route_process( route_process_id, route_id, process_id, process_order, remark, create_by, create_time, update_by, update_time) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.routeProcessId}, #{item.routeId}, #{item.processId}, #{item.processOrder}, #{item.remark}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime})
insert into mes_base_route_process( route_process_id, route_id, process_id, process_order, remark, create_by,
create_time, update_by, update_time) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.routeProcessId}, #{item.routeId}, #{item.processId}, #{item.processOrder}, #{item.remark},
#{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime})
</foreach>
</insert>

@ -23,6 +23,7 @@
<result property="materialCode" column="material_code"/>
<result property="materialBomDesc" column="material_bom_desc"/>
<result property="materialNameDesc" column="materialNameDesc"/>
<result property="assembleTime" column="assemble_time"/>
</resultMap>
<sql id="selectMesMaterialBomVo">
@ -42,6 +43,7 @@
create_time,
update_by,
update_time,
assemble_time,
CONCAT(material_name, '-', material_bom_desc) materialNameDesc
from mes_material_bom
</sql>
@ -89,6 +91,7 @@
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="assembleTime != null">assemble_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="parentId != null">#{parentId},</if>
@ -106,6 +109,7 @@
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="assembleTime != null">#{assembleTime},</if>
</trim>
</insert>
@ -127,6 +131,7 @@
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="assembleTime != null">assemble_time = #{assembleTime},</if>
</trim>
where material_bom_id = #{materialBomId}
</update>

@ -37,6 +37,7 @@
<result property="materialCode" column="material_code"/>
<result property="materialName" column="material_name"/>
<result property="materialBomDesc" column="material_bom_desc"/>
<result property="productionTime" column="production_time"/>
</resultMap>
<sql id="selectMesProductOrderVo">
@ -71,9 +72,16 @@
mpo.create_by,
mpo.create_time,
mpo.update_by,
mpo.update_time
mpo.update_time,
mbr.production_time
from mes_product_order mpo
left join mes_base_route mbr on mbr.route_id = mpo.dispatch_id
left join (select a.route_id,
a.route_name,
sum(p.production_time) production_time
from mes_base_route a
left join mes_base_route_process b on b.route_id = a.route_id
left join mes_base_process_info p on p.process_id = b.process_id
group by a.route_id, a.route_name) mbr on mbr.route_id = mpo.dispatch_id
left join mes_base_material_info bmi on bmi.material_id = mpo.material_id
left join mes_material_bom mb on mb.material_bom_id = mpo.material_bom_id
</sql>

@ -18,7 +18,15 @@ import './assets/icons' // icon
import './permission' // permission control
import { getDicts } from "@/api/system/dict/data";
import { getConfigKey } from "@/api/system/config";
import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/ruoyi";
import {
parseTime,
resetForm,
addDateRange,
selectDictLabel,
selectDictLabels,
handleTree,
formatDayHourMinutes
} from "@/utils/ruoyi";
// 分页组件
import Pagination from "@/components/Pagination";
// 自定义表格工具组件
@ -48,6 +56,7 @@ Vue.prototype.selectDictLabel = selectDictLabel
Vue.prototype.selectDictLabels = selectDictLabels
Vue.prototype.download = download
Vue.prototype.handleTree = handleTree
Vue.prototype.formatDayHourMinutes = formatDayHourMinutes
// 全局组件挂载
Vue.component('DictTag', DictTag)

@ -231,3 +231,21 @@ export function tansParams(params) {
export function blobValidate(data) {
return data.type !== 'application/json'
}
// 秒转天、小时、分钟
export function formatDayHourMinutes(seconds) {
const days = Math.floor(seconds / (24 * 60 * 60));
const hours = Math.floor((seconds % (24 * 60 * 60)) / 3600);
const minutes = Math.floor((seconds % 3600) / 60);
let result = '';
if (days > 0) {
result += `${days}`;
}
if (hours > 0) {
result += `${hours}小时`;
}
if (minutes > 0) {
result += `${minutes}分钟`;
}
return result;
}

@ -70,6 +70,11 @@
<el-table-column label="工艺路线ID" align="center" prop="routeId" v-if="columns[0].visible"/>
<el-table-column label="工艺路线名称" align="center" prop="routeName" v-if="columns[1].visible"/>
<el-table-column label="工艺路线说明" align="center" prop="routeDesc" v-if="columns[2].visible"/>
<el-table-column label="单位时间" align="center" prop="productionTime" v-if="columns[9].visible">
<template slot-scope="scope">
<span>{{ formatDayHourMinutes(scope.row.productionTime) }}</span>
</template>
</el-table-column>
<el-table-column label="激活标识" align="center" prop="activeFlag" v-if="columns[3].visible">
<template slot-scope="scope">
<dict-tag :options="dict.type.active_flag" :value="scope.row.activeFlag"/>
@ -270,30 +275,31 @@ export default {
],
},
columns: [
{key: 0, label: `工艺路线ID`, visible: true},
{key: 0, label: `工艺路线ID`, 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: true},
{key: 6, label: `创建时间`, visible: true},
{key: 7, label: `更新人`, visible: true},
{key: 8, label: `更新时间`, visible: true},
{key: 7, label: `更新人`, visible: false},
{key: 8, label: `更新时间`, visible: false},
{key: 9, label: `单位时间`, visible: true},
],
//
processList: [],
};
},
created() {
findProcessList(null).then(response => {
this.processList = response.data
})
this.getList();
},
methods: {
/** 查询工艺路线列表 */
getList() {
this.loading = true;
findProcessList(null).then(response => {
this.processList = response.data
})
listBaseRoute(this.queryParams).then(response => {
this.baseRouteList = response.rows;
this.total = response.total;

@ -171,9 +171,9 @@
<el-form-item label="楼层" prop="floor">
<el-input v-model="form.floor" placeholder="请输入楼层"/>
</el-form-item>
<el-form-item label="单位生产时间" prop="productionTime">
<el-input v-model="form.productionTime" placeholder="请输入单位生产时间"/>
</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
@ -262,7 +262,7 @@ export default {
{key: 2, label: `工位名称`, visible: true},
{key: 3, label: `所属工序`, visible: true},
{key: 4, label: `楼层`, visible: true},
{key: 5, label: `单位生产时间`, visible: true},
{key: 5, label: `单位生产时间`, visible: false},
{key: 6, label: `激活标识`, visible: false},
{key: 7, label: `备注`, visible: true},
{key: 8, label: `创建人`, visible: false},

@ -100,6 +100,11 @@
<el-table-column label="物料名称" align="left" prop="materialName" v-if="columns[4].visible"/>
<el-table-column label="BOM说明" align="center" prop="materialBomDesc" v-if="columns[15].visible"/>
<el-table-column label="标准数量" align="center" prop="standardAmount" v-if="columns[5].visible"/>
<el-table-column label="安装时长" align="center" prop="assembleTime" v-if="columns[16].visible">
<template slot-scope="scope">
<span>{{ formatDayHourMinutes(scope.row.assembleTime) }}</span>
</template>
</el-table-column>
<el-table-column label="顶级标识" align="center" prop="topFlag" v-if="columns[6].visible">
<template slot-scope="scope">
<dict-tag :options="dict.type.active_flag" :value="scope.row.topFlag"/>
@ -150,13 +155,13 @@
<!-- 添加或修改物料BOM信息对话框 -->
<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="父级BOM" prop="parentId">
<treeselect v-model="form.parentId" :options="materialBomOptions" :normalizer="normalizer" disabled/>
<el-form-item label="父级BOM" prop="parentId" v-if="topBomVisible">
<treeselect v-model="form.parentId" :options="materialBomOptions" :normalizer="normalizer" v-if="topBomVisible" disabled/>
</el-form-item>
<!-- <el-form-item label="物料ID" prop="materialId">-->
<!-- <el-input v-model="form.materialId" placeholder="请输入物料ID" />-->
<!-- </el-form-item>-->
<el-form-item label="子级BOM" prop="materialName">
<el-form-item :label="childBomName" prop="materialName">
<el-input v-model="form.materialName" placeholder="请点击右侧检索子BOM" readonly>
<el-button slot="append" icon="el-icon-search" @click="handleMaterialAdd"></el-button>
</el-input>
@ -164,8 +169,19 @@
<el-form-item label="BOM说明" prop="materialBomDesc">
<el-input v-model="form.materialBomDesc" placeholder="请输入BOM说明(BOM版本)"/>
</el-form-item>
<el-form-item label="安装时长" prop="assembleTime" v-if="assembleTimeVisible">
<el-input-number v-model="form.productionTimeDays" placeholder="请输入天数" :min="0" :max="10000"
:controls="false" :style="{ width: '50px' }"/>
<el-input-number v-model="form.productionTimeHours" placeholder="请输入小时" :min="0" :max="23"
:controls="false" :style="{ width: '50px' }"/>
小时
<el-input-number v-model="form.productionTimeMinutes" placeholder="请输入分钟" :min="0" :max="59"
:controls="false" :style="{ width: '50px' }"/>
分钟
</el-form-item>
<el-form-item label="标准数量" prop="standardAmount">
<el-input-number v-model="form.standardAmount" :min="1" placeholder="请输入标准数量"/>
<el-input-number v-model="form.standardAmount" :min="1" placeholder="请输入标准数量" :disabled="amountDisabled"/>
</el-form-item>
<!-- <el-form-item label="顶级标识" prop="topFlag">-->
<!-- <el-radio-group v-model="form.topFlag">-->
@ -186,9 +202,6 @@
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="项目ID" prop="projectId">
<el-input v-model="form.projectId" placeholder="请输入项目ID"/>
</el-form-item>
<el-form-item label="激活标识" prop="activeFlag">
<el-radio-group v-model="form.activeFlag">
<el-radio
@ -255,6 +268,14 @@ export default {
title: "",
//
open: false,
// BOM
assembleTimeVisible: true,
// BOM
topBomVisible: true,
// BOM
amountDisabled: false,
// BOM
childBomName: "子级BOM",
//
materialOpen: false,
//
@ -308,9 +329,23 @@ export default {
{key: 13, label: `更新人`, visible: true},
{key: 14, label: `更新时间`, visible: true},
{key: 15, label: `BOM说明`, visible: true},
{key: 16, label: `安装时长`, visible: true},
],
};
},
watch: {
'form.parentId': function(newValue, oldValue) {
if (newValue === 0) {
this.topBomVisible = false;
this.amountDisabled = true;
this.childBomName = "成品BOM";
} else {
this.topBomVisible = true;
this.amountDisabled = false;
this.childBomName = "子级BOM";
}
},
},
created() {
this.getList();
},
@ -343,6 +378,15 @@ export default {
this.materialBomOptions.push(data);
});
},
/** 查询物料BOM信息下拉树结构 */
getBomTreeselect(selectData) {
let dataBom = [];
dataBom.push(selectData)
this.materialBomOptions = [];
const data = {materialBomId: 0, materialName: '顶级节点', children: []};
data.children = this.handleTree(dataBom, "materialBomId", "parentId");
this.materialBomOptions.push(data);
},
//
cancel() {
this.open = false;
@ -358,16 +402,21 @@ export default {
materialName: null,
standardAmount: null,
materialBomDesc: null,
productionTimeDays: 0,
productionTimeHours: 0,
productionTimeMinutes: 0,
topFlag: 1,
checkType: '0',
projectId: null,
activeFlag: '1',
remark: null,
assembleTime: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.assembleTimeVisible = true;
this.resetForm("form");
},
/** 搜索按钮操作 */
@ -382,24 +431,34 @@ export default {
/** 新增按钮操作 */
handleAdd(row) {
this.reset();
this.getTreeselect();
// this.getTreeselect();
if (row != null && row.materialBomId) {
this.form.parentId = row.materialBomId;
verifyBOMIsProduction(row.materialBomId).then(res => {
if (res.data) {
throw Error()
}
//BOMbom
this.rules.materialBomDesc[0].required = this.form.parentId === 0;
getMaterialBom(row.materialBomId).then(e => {
//BOMbom
this.rules.materialBomDesc[0].required = this.form.parentId === 0;
if (row.parentId === 0){
this.assembleTimeVisible = false;
}
this.form.checkType = e.data.checkType;
this.getBomTreeselect(e.data);
this.open = true;
this.title = "添加物料BOM信息";
})
}).catch((e) => {
this.$modal.msgError("该物料BOM已被生产工单选择无法新增");
return;
});
} else {
this.form.parentId = 0;
this.assembleTimeVisible = false;
this.open = true;
this.title = "添加物料BOM信息";
}
this.open = true;
this.title = "添加物料BOM信息";
},
/** 新增按钮操作 */
handleMaterialAdd() {
@ -425,6 +484,10 @@ export default {
} else {
getMaterialBom(row.materialBomId).then(response => {
this.form = response.data;
this.convertToTime();
if (this.form.parentId === 0){
this.assembleTimeVisible = false;
}
//BOMbom
this.rules.materialBomDesc[0].required = this.form.parentId === 0;
this.open = true;
@ -434,10 +497,35 @@ export default {
})
}
},
/** 天小时分钟转换为秒 */
convertToSeconds() {
const daysInSeconds = this.form.productionTimeDays * 24 * 60 * 60;
const hoursInSeconds = this.form.productionTimeHours * 60 * 60;
const minutesInSeconds = this.form.productionTimeMinutes * 60;
this.form.assembleTime = daysInSeconds + hoursInSeconds + minutesInSeconds;
},
/** 秒转换为天小时分钟 */
convertToTime() {
const totalSeconds = this.form.assembleTime;
const days = Math.floor(totalSeconds / (24 * 60 * 60));
const hours = Math.floor((totalSeconds % (24 * 60 * 60)) / 3600);
const minutes = Math.floor((totalSeconds % 3600) / 60);
//
this.form.productionTimeDays = days;
this.form.productionTimeHours = hours;
this.form.productionTimeMinutes = minutes;
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (!/^[0-9]\d*$/.test(this.form.productionTimeDays)
|| !/^[0-9]\d*$/.test(this.form.productionTimeHours)
|| !/^[0-9]\d*$/.test(this.form.productionTimeMinutes)) {
this.$modal.msgError("安装时长天、小时、分钟需为大于等于0的正整数");
return;
}
this.convertToSeconds();
if (this.form.materialBomId != null) {
updateMaterialBom(this.form).then(response => {
this.$modal.msgSuccess("修改成功");

@ -331,12 +331,12 @@ export default {
materialName: [
{required: true, message: "物料名称不能为空", trigger: "blur"}
],
materialCategories: [
{required: true, message: "物料大类不能为空", trigger: "blur"}
],
materialTypeId: [
{required: true, message: "物料类型不能为空", trigger: "blur"}
],
// materialCategories: [
// {required: true, message: "", trigger: "blur"}
// ],
// materialTypeId: [
// {required: true, message: "", trigger: "blur"}
// ],
}
};
},

@ -34,7 +34,8 @@
size="mini"
@click="handleAdd"
v-hasPermi="['mes:processInfo:add']"
>新增</el-button>
>新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
@ -45,7 +46,8 @@
:disabled="single"
@click="handleUpdate"
v-hasPermi="['mes:processInfo:edit']"
>修改</el-button>
>修改
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
@ -56,7 +58,8 @@
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['mes:processInfo:remove']"
>删除</el-button>
>删除
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
@ -66,23 +69,28 @@
size="mini"
@click="handleExport"
v-hasPermi="['mes:processInfo:export']"
>导出</el-button>
>导出
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
<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 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" >
<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" >
<el-table-column label="标准工时" align="center" prop="productionTime" v-if="columns[4].visible">
<template slot-scope="scope">
<span>{{ formatDayHourMinutes(scope.row.productionTime) }}</span>
</template>
</el-table-column>
<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>
@ -91,36 +99,38 @@
<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>
<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>
<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-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>
>关联产线
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-s-check"
@click="handleUserUpdate(scope.row)"
>关联人员</el-button>
>关联人员
</el-button>
</template>
</el-table-column>
@ -138,10 +148,10 @@
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="110px">
<el-form-item label="工序编号" prop="processCode">
<el-input v-model="form.processCode" placeholder="请输入工序编号" />
<el-input v-model="form.processCode" placeholder="请输入工序编号"/>
</el-form-item>
<el-form-item label="工序名称" prop="processName">
<el-input v-model="form.processName" placeholder="请输入工序名称" />
<el-input v-model="form.processName" placeholder="请输入工序名称"/>
</el-form-item>
<el-form-item label="工序类别" prop="processType">
<el-select v-model="form.processType" placeholder="请选择工序类别">
@ -153,8 +163,16 @@
></el-option>
</el-select>
</el-form-item>
<el-form-item label="标准工时(分钟)" prop="productionTime">
<el-input-number v-model="form.productionTime" placeholder="请输入标准工时(分钟)" />
<el-form-item label="标准工时" prop="productionTime">
<el-input-number v-model="form.productionTimeDays" placeholder="请输入天数" :min="0" :max="10000"
:controls="false" :style="{ width: '50px' }"/>
<el-input-number v-model="form.productionTimeHours" placeholder="请输入小时" :min="0" :max="23"
:controls="false" :style="{ width: '50px' }"/>
小时
<el-input-number v-model="form.productionTimeMinutes" placeholder="请输入分钟" :min="0" :max="59"
:controls="false" :style="{ width: '50px' }"/>
分钟
</el-form-item>
<el-form-item label="激活标识" prop="activeFlag">
<el-radio-group v-model="form.activeFlag">
@ -167,7 +185,7 @@
</el-radio-group>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
@ -180,43 +198,46 @@
<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-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-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-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-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-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" >
<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-select v-model="scope.row.prodlineId" placeholder="请选择关联产线" clearable>
<el-option
v-for="item in prodLineList"
:key="item.prodlineId"
@ -252,18 +273,21 @@
<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="handleAddMesBaseProcessUser"></el-button>
<el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAddMesBaseProcessUser">
</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="danger" icon="el-icon-delete" size="mini" @click="handleDeleteMesBaseProcessUser"></el-button>
<el-button type="danger" icon="el-icon-delete" size="mini" @click="handleDeleteMesBaseProcessUser">
</el-button>
</el-col>
</el-row>
<el-table :data="mesBaseProcessUserList" :row-class-name="rowMesBaseProcessUserIndex" @selection-change="handleMesBaseProcessUserSelectionChange" ref="mesBaseProcessUser">
<el-table-column type="selection" width="50" align="center" />
<el-table-column label="序号" align="center" prop="index" />
<el-table-column label="关联人员" align="center" prop="prodlineId" >
<el-table :data="mesBaseProcessUserList" :row-class-name="rowMesBaseProcessUserIndex"
@selection-change="handleMesBaseProcessUserSelectionChange" ref="mesBaseProcessUser">
<el-table-column type="selection" width="50" align="center"/>
<el-table-column label="序号" align="center" prop="index"/>
<el-table-column label="关联人员" align="center" prop="prodlineId">
<template slot-scope="scope">
<el-select v-model="scope.row.userId" filterable placeholder="请选择关联人员" clearable>
<el-select v-model="scope.row.userId" filterable placeholder="请选择关联人员" clearable>
<el-option
v-for="item in userList"
:key="item.userId"
@ -298,7 +322,7 @@ import {findUserList} from "@//api/system/user";
export default {
name: "ProcessInfo",
dicts: ['process_type','active_flag'],
dicts: ['process_type', 'active_flag'],
data() {
return {
//
@ -347,27 +371,27 @@ export default {
//
rules: {
processName: [
{ required: true, message: "工序名称不能为空", trigger: "blur" }
{required: true, message: "工序名称不能为空", trigger: "blur"}
],
processType: [
{ required: true, message: "工序类别不能为空", trigger: "change" }
{required: true, message: "工序类别不能为空", trigger: "change"}
],
activeFlag: [
{ required: true, message: "激活标识不能为空", trigger: "blur" }
{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 },
{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: [],
@ -409,6 +433,9 @@ export default {
processName: null,
processType: null,
productionTime: null,
productionTimeDays: 0,
productionTimeHours: 0,
productionTimeMinutes: 0,
activeFlag: '1',
remark: null,
createBy: null,
@ -429,6 +456,24 @@ export default {
this.resetForm("queryForm");
this.handleQuery();
},
/** 天小时分钟转换为秒 */
convertToSeconds() {
const daysInSeconds = this.form.productionTimeDays * 24 * 60 * 60;
const hoursInSeconds = this.form.productionTimeHours * 60 * 60;
const minutesInSeconds = this.form.productionTimeMinutes * 60;
this.form.productionTime = daysInSeconds + hoursInSeconds + minutesInSeconds;
},
/** 秒转换为天小时分钟 */
convertToTime() {
const totalSeconds = this.form.productionTime;
const days = Math.floor(totalSeconds / (24 * 60 * 60));
const hours = Math.floor((totalSeconds % (24 * 60 * 60)) / 3600);
const minutes = Math.floor((totalSeconds % 3600) / 60);
//
this.form.productionTimeDays = days;
this.form.productionTimeHours = hours;
this.form.productionTimeMinutes = minutes;
},
isProdlineDisabled(prodlineId) {
// true false
return this.mesBaseProcessProdlineList.some(item => item.prodlineId === prodlineId);
@ -441,7 +486,7 @@ export default {
handleSelectionChange(selection) {
this.ids = selection.map(item => item.processId)
this.idNames = selection.map(item => item.processCode)
this.single = selection.length!==1
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */
@ -457,6 +502,7 @@ export default {
getProcessInfo(processId).then(response => {
this.form = response.data;
this.mesBaseProcessProdlineList = response.data.mesBaseProcessProdlineList;
this.convertToTime();
this.open = true;
this.title = "修改工序信息";
});
@ -486,6 +532,13 @@ export default {
this.$refs["form"].validate(valid => {
if (valid) {
this.form.mesBaseProcessProdlineList = this.mesBaseProcessProdlineList;
if (!/^[0-9]\d*$/.test(this.form.productionTimeDays)
|| !/^[0-9]\d*$/.test(this.form.productionTimeHours)
|| !/^[0-9]\d*$/.test(this.form.productionTimeMinutes)) {
this.$modal.msgError("标准工时天、小时、分钟需为大于等于0的正整数");
return;
}
this.convertToSeconds();
if (this.form.processId != null) {
updateProcessInfo(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
@ -522,19 +575,20 @@ export default {
handleDelete(row) {
const processIds = row.processId || this.ids;
const processCodes = row.processCode || this.idNames;
this.$modal.confirm('是否确认删除工序编号为"' + processCodes + '"的数据项?').then(function() {
this.$modal.confirm('是否确认删除工序编号为"' + processCodes + '"的数据项?').then(function () {
return delProcessInfo(processIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
}).catch(() => {
});
},
/** 工序关联产线序号 */
rowMesBaseProcessProdlineIndex({ row, rowIndex }) {
/** 工序关联产线序号 */
rowMesBaseProcessProdlineIndex({row, rowIndex}) {
row.index = rowIndex + 1;
},
/** 工序关联产线序号 */
rowMesBaseProcessUserIndex({ row, rowIndex }) {
rowMesBaseProcessUserIndex({row, rowIndex}) {
row.index = rowIndex + 1;
},
/** 工序关联产线添加按钮操作 */
@ -549,7 +603,7 @@ export default {
} else {
const mesBaseProcessProdlineList = this.mesBaseProcessProdlineList;
const checkedMesBaseProcessProdline = this.checkedMesBaseProcessProdline;
this.mesBaseProcessProdlineList = mesBaseProcessProdlineList.filter(function(item) {
this.mesBaseProcessProdlineList = mesBaseProcessProdlineList.filter(function (item) {
return checkedMesBaseProcessProdline.indexOf(item.index) == -1
});
}
@ -571,7 +625,7 @@ export default {
} else {
const mesBaseProcessUserList = this.mesBaseProcessUserList;
const checkedMesBaseProcessUser = this.checkedMesBaseProcessUser;
this.mesBaseProcessUserList = mesBaseProcessUserList.filter(function(item) {
this.mesBaseProcessUserList = mesBaseProcessUserList.filter(function (item) {
return checkedMesBaseProcessUser.indexOf(item.index) == -1
});
}

@ -125,11 +125,11 @@
<el-table v-loading="loading" :data="productOrderList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center"/>
<el-table-column label="主键标识" align="center" prop="productOrderId" v-if="columns[0].visible"/>
<el-table-column label="工单编号" align="center" prop="orderCode" v-if="columns[1].visible" width="100"/>
<el-table-column label="销售订单ID" align="center" prop="saleOrderId" v-if="columns[2].visible" width="100"/>
<el-table-column label="销售订单编号" align="center" prop="saleorderCode" v-if="columns[3].visible" width="100"/>
<el-table-column label="销售订单行号" align="center" prop="saleorderLinenumber" v-if="columns[4].visible" width="110"/>
<el-table-column label="项目编号" align="center" prop="projectNo" v-if="columns[5].visible"/>
<el-table-column label="工单编号" align="center" prop="orderCode" v-if="columns[1].visible" width="100"/>
<el-table-column label="物料名称" align="center" prop="materialName" v-if="columns[6].visible" width="100"/>
<el-table-column label="物料BOM" align="center" prop="materialBomDesc" v-if="columns[7].visible" width="120"/>
<el-table-column label="派工类型" align="center" prop="dispatchType" v-if="columns[8].visible">
@ -137,7 +137,12 @@
<dict-tag :options="dict.type.dispatch_type" :value="scope.row.dispatchType"/>
</template>
</el-table-column>
<el-table-column label="工艺路线" align="center" prop="dispatchName" v-if="columns[9].visible" width="100"/>
<el-table-column label="工艺路线" align="center" prop="dispatchName" v-if="columns[9].visible" width="120"/>
<el-table-column label="单位时间" align="center" prop="productionTime" v-if="columns[27].visible">
<template slot-scope="scope">
<span>{{formatDayHourMinutes(scope.row.productionTime) }}</span>
</template>
</el-table-column>
<el-table-column label="销售数量" align="center" prop="saleAmount" v-if="columns[10].visible"/>
<el-table-column label="计划数量" align="center" prop="planAmount" v-if="columns[11].visible"/>
<el-table-column label="已派工数量" align="center" prop="dispatchAmount" v-if="columns[12].visible" width="100"/>
@ -586,6 +591,7 @@ export default {
{key: 24, label: `更新人`, visible: false},
{key: 25, label: `更新时间`, visible: false},
{key: 26, label: `计划交货日期`, visible: true},
{key: 27, label: `单位时间`, visible: true},
],
//BOM
materialBomList: [],

Loading…
Cancel
Save