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

master
yinq 1 year ago
parent e9a39e25a8
commit 6f6f1ba38f

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

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

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

@ -14,10 +14,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="createTime" column="create_time"/> <result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/> <result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/> <result property="updateTime" column="update_time"/>
<result property="productionTime" column="production_time"/>
</resultMap> </resultMap>
<resultMap id="MesBaseRouteMesBaseRouteProcessResult" type="MesBaseRoute" extends="MesBaseRouteResult"> <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>
<resultMap type="MesBaseRouteProcess" id="MesBaseRouteProcessResult"> <resultMap type="MesBaseRouteProcess" id="MesBaseRouteProcessResult">
@ -33,25 +35,55 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectMesBaseRouteVo"> <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> </sql>
<select id="selectMesBaseRouteList" parameterType="MesBaseRoute" resultMap="MesBaseRouteResult"> <select id="selectMesBaseRouteList" parameterType="MesBaseRoute" resultMap="MesBaseRouteResult">
<include refid="selectMesBaseRouteVo"/> <include refid="selectMesBaseRouteVo"/>
<where> <where>
<if test="routeName != null and routeName != ''"> and route_name like concat('%', #{routeName}, '%')</if> <if test="routeName != null and routeName != ''">and a.route_name like concat('%', #{routeName}, '%')</if>
<if test="routeDesc != null and routeDesc != ''"> and route_desc = #{routeDesc}</if> <if test="routeDesc != null and routeDesc != ''">and a.route_desc = #{routeDesc}</if>
<if test="activeFlag != null and activeFlag != ''"> and active_flag = #{activeFlag}</if> <if test="activeFlag != null and activeFlag != ''">and a.active_flag = #{activeFlag}</if>
<if test="createBy != null and createBy != ''"> and create_by = #{createBy}</if> <if test="createBy != null and createBy != ''">and a.create_by = #{createBy}</if>
<if test="createTime != null "> and create_time = #{createTime}</if> <if test="createTime != null ">and a.create_time = #{createTime}</if>
<if test="updateBy != null and updateBy != ''"> and update_by = #{updateBy}</if> <if test="updateBy != null and updateBy != ''">and a.update_by = #{updateBy}</if>
<if test="updateTime != null "> and update_time = #{updateTime}</if> <if test="updateTime != null ">and a.update_time = #{updateTime}</if>
</where> </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>
<select id="selectMesBaseRouteByRouteId" parameterType="Long" resultMap="MesBaseRouteMesBaseRouteProcessResult"> <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, select a.route_id,
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 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 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} where a.route_id = #{routeId}
@ -97,7 +129,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update> </update>
<delete id="deleteMesBaseRouteByRouteId" parameterType="Long"> <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>
<delete id="deleteMesBaseRouteByRouteIds" parameterType="String"> <delete id="deleteMesBaseRouteByRouteIds" parameterType="String">
@ -115,13 +149,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete> </delete>
<delete id="deleteMesBaseRouteProcessByRouteId" parameterType="Long"> <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> </delete>
<insert id="batchMesBaseRouteProcess"> <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 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=","> <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}) ( #{item.routeProcessId}, #{item.routeId}, #{item.processId}, #{item.processOrder}, #{item.remark},
#{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime})
</foreach> </foreach>
</insert> </insert>

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

@ -37,6 +37,7 @@
<result property="materialCode" column="material_code"/> <result property="materialCode" column="material_code"/>
<result property="materialName" column="material_name"/> <result property="materialName" column="material_name"/>
<result property="materialBomDesc" column="material_bom_desc"/> <result property="materialBomDesc" column="material_bom_desc"/>
<result property="productionTime" column="production_time"/>
</resultMap> </resultMap>
<sql id="selectMesProductOrderVo"> <sql id="selectMesProductOrderVo">
@ -71,9 +72,16 @@
mpo.create_by, mpo.create_by,
mpo.create_time, mpo.create_time,
mpo.update_by, mpo.update_by,
mpo.update_time mpo.update_time,
mbr.production_time
from mes_product_order mpo 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_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 left join mes_material_bom mb on mb.material_bom_id = mpo.material_bom_id
</sql> </sql>

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

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

@ -171,9 +171,9 @@
<el-form-item label="楼层" prop="floor"> <el-form-item label="楼层" prop="floor">
<el-input v-model="form.floor" placeholder="请输入楼层"/> <el-input v-model="form.floor" placeholder="请输入楼层"/>
</el-form-item> </el-form-item>
<el-form-item label="单位生产时间" prop="productionTime"> <!-- <el-form-item label="单位生产时间" prop="productionTime">-->
<el-input v-model="form.productionTime" placeholder="请输入单位生产时间"/> <!-- <el-input v-model="form.productionTime" placeholder="请输入单位生产时间"/>-->
</el-form-item> <!-- </el-form-item>-->
<el-form-item label="激活标识" prop="activeFlag"> <el-form-item label="激活标识" prop="activeFlag">
<el-radio-group v-model="form.activeFlag"> <el-radio-group v-model="form.activeFlag">
<el-radio <el-radio
@ -262,7 +262,7 @@ export default {
{key: 2, label: `工位名称`, visible: true}, {key: 2, label: `工位名称`, visible: true},
{key: 3, label: `所属工序`, visible: true}, {key: 3, label: `所属工序`, visible: true},
{key: 4, label: `楼层`, visible: true}, {key: 4, label: `楼层`, visible: true},
{key: 5, label: `单位生产时间`, visible: true}, {key: 5, label: `单位生产时间`, visible: false},
{key: 6, label: `激活标识`, visible: false}, {key: 6, label: `激活标识`, visible: false},
{key: 7, label: `备注`, visible: true}, {key: 7, label: `备注`, visible: true},
{key: 8, label: `创建人`, visible: false}, {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="物料名称" 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="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="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"> <el-table-column label="顶级标识" align="center" prop="topFlag" v-if="columns[6].visible">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="dict.type.active_flag" :value="scope.row.topFlag"/> <dict-tag :options="dict.type.active_flag" :value="scope.row.topFlag"/>
@ -150,13 +155,13 @@
<!-- 添加或修改物料BOM信息对话框 --> <!-- 添加或修改物料BOM信息对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> <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 ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item label="父级BOM" prop="parentId"> <el-form-item label="父级BOM" prop="parentId" v-if="topBomVisible">
<treeselect v-model="form.parentId" :options="materialBomOptions" :normalizer="normalizer" disabled/> <treeselect v-model="form.parentId" :options="materialBomOptions" :normalizer="normalizer" v-if="topBomVisible" disabled/>
</el-form-item> </el-form-item>
<!-- <el-form-item label="物料ID" prop="materialId">--> <!-- <el-form-item label="物料ID" prop="materialId">-->
<!-- <el-input v-model="form.materialId" placeholder="请输入物料ID" />--> <!-- <el-input v-model="form.materialId" placeholder="请输入物料ID" />-->
<!-- </el-form-item>--> <!-- </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-input v-model="form.materialName" placeholder="请点击右侧检索子BOM" readonly>
<el-button slot="append" icon="el-icon-search" @click="handleMaterialAdd"></el-button> <el-button slot="append" icon="el-icon-search" @click="handleMaterialAdd"></el-button>
</el-input> </el-input>
@ -164,8 +169,19 @@
<el-form-item label="BOM说明" prop="materialBomDesc"> <el-form-item label="BOM说明" prop="materialBomDesc">
<el-input v-model="form.materialBomDesc" placeholder="请输入BOM说明(BOM版本)"/> <el-input v-model="form.materialBomDesc" placeholder="请输入BOM说明(BOM版本)"/>
</el-form-item> </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-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>
<!-- <el-form-item label="顶级标识" prop="topFlag">--> <!-- <el-form-item label="顶级标识" prop="topFlag">-->
<!-- <el-radio-group v-model="form.topFlag">--> <!-- <el-radio-group v-model="form.topFlag">-->
@ -186,9 +202,6 @@
</el-radio> </el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </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-form-item label="激活标识" prop="activeFlag">
<el-radio-group v-model="form.activeFlag"> <el-radio-group v-model="form.activeFlag">
<el-radio <el-radio
@ -255,6 +268,14 @@ export default {
title: "", title: "",
// //
open: false, open: false,
// BOM
assembleTimeVisible: true,
// BOM
topBomVisible: true,
// BOM
amountDisabled: false,
// BOM
childBomName: "子级BOM",
// //
materialOpen: false, materialOpen: false,
// //
@ -308,9 +329,23 @@ export default {
{key: 13, label: `更新人`, visible: true}, {key: 13, label: `更新人`, visible: true},
{key: 14, label: `更新时间`, visible: true}, {key: 14, label: `更新时间`, visible: true},
{key: 15, label: `BOM说明`, 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() { created() {
this.getList(); this.getList();
}, },
@ -343,6 +378,15 @@ export default {
this.materialBomOptions.push(data); 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() { cancel() {
this.open = false; this.open = false;
@ -358,16 +402,21 @@ export default {
materialName: null, materialName: null,
standardAmount: null, standardAmount: null,
materialBomDesc: null, materialBomDesc: null,
productionTimeDays: 0,
productionTimeHours: 0,
productionTimeMinutes: 0,
topFlag: 1, topFlag: 1,
checkType: '0', checkType: '0',
projectId: null, projectId: null,
activeFlag: '1', activeFlag: '1',
remark: null, remark: null,
assembleTime: null,
createBy: null, createBy: null,
createTime: null, createTime: null,
updateBy: null, updateBy: null,
updateTime: null updateTime: null
}; };
this.assembleTimeVisible = true;
this.resetForm("form"); this.resetForm("form");
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
@ -382,24 +431,34 @@ export default {
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd(row) { handleAdd(row) {
this.reset(); this.reset();
this.getTreeselect(); // this.getTreeselect();
if (row != null && row.materialBomId) { if (row != null && row.materialBomId) {
this.form.parentId = row.materialBomId; this.form.parentId = row.materialBomId;
verifyBOMIsProduction(row.materialBomId).then(res => { verifyBOMIsProduction(row.materialBomId).then(res => {
if (res.data) { if (res.data) {
throw Error() throw Error()
} }
getMaterialBom(row.materialBomId).then(e => {
//BOMbom //BOMbom
this.rules.materialBomDesc[0].required = this.form.parentId === 0; 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) => { }).catch((e) => {
this.$modal.msgError("该物料BOM已被生产工单选择无法新增"); this.$modal.msgError("该物料BOM已被生产工单选择无法新增");
return;
}); });
} else { } else {
this.form.parentId = 0; this.form.parentId = 0;
} this.assembleTimeVisible = false;
this.open = true; this.open = true;
this.title = "添加物料BOM信息"; this.title = "添加物料BOM信息";
}
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleMaterialAdd() { handleMaterialAdd() {
@ -425,6 +484,10 @@ export default {
} else { } else {
getMaterialBom(row.materialBomId).then(response => { getMaterialBom(row.materialBomId).then(response => {
this.form = response.data; this.form = response.data;
this.convertToTime();
if (this.form.parentId === 0){
this.assembleTimeVisible = false;
}
//BOMbom //BOMbom
this.rules.materialBomDesc[0].required = this.form.parentId === 0; this.rules.materialBomDesc[0].required = this.form.parentId === 0;
this.open = true; 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() { submitForm() {
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
if (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) { if (this.form.materialBomId != null) {
updateMaterialBom(this.form).then(response => { updateMaterialBom(this.form).then(response => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");

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

@ -34,7 +34,8 @@
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
v-hasPermi="['mes:processInfo:add']" v-hasPermi="['mes:processInfo:add']"
>新增</el-button> >新增
</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -45,7 +46,8 @@
:disabled="single" :disabled="single"
@click="handleUpdate" @click="handleUpdate"
v-hasPermi="['mes:processInfo:edit']" v-hasPermi="['mes:processInfo:edit']"
>修改</el-button> >修改
</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -56,7 +58,8 @@
:disabled="multiple" :disabled="multiple"
@click="handleDelete" @click="handleDelete"
v-hasPermi="['mes:processInfo:remove']" v-hasPermi="['mes:processInfo:remove']"
>删除</el-button> >删除
</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -66,7 +69,8 @@
size="mini" size="mini"
@click="handleExport" @click="handleExport"
v-hasPermi="['mes:processInfo:export']" v-hasPermi="['mes:processInfo:export']"
>导出</el-button> >导出
</el-button>
</el-col> </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-row>
@ -81,7 +85,11 @@
<dict-tag :options="dict.type.process_type" :value="scope.row.processType"/> <dict-tag :options="dict.type.process_type" :value="scope.row.processType"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="标准工时(分钟)" align="center" prop="productionTime" v-if="columns[4].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"> <el-table-column label="激活标识" align="center" prop="activeFlag" v-if="columns[5].visible">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="dict.type.active_flag" :value="scope.row.activeFlag"/> <dict-tag :options="dict.type.active_flag" :value="scope.row.activeFlag"/>
@ -114,13 +122,15 @@
type="text" type="text"
icon="el-icon-circle-plus" icon="el-icon-circle-plus"
@click="handleProdLineUpdate(scope.row)" @click="handleProdLineUpdate(scope.row)"
>关联产线</el-button> >关联产线
</el-button>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-s-check" icon="el-icon-s-check"
@click="handleUserUpdate(scope.row)" @click="handleUserUpdate(scope.row)"
>关联人员</el-button> >关联人员
</el-button>
</template> </template>
</el-table-column> </el-table-column>
@ -153,8 +163,16 @@
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="标准工时(分钟)" prop="productionTime"> <el-form-item label="标准工时" prop="productionTime">
<el-input-number v-model="form.productionTime" placeholder="请输入标准工时(分钟)" /> <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>
<el-form-item label="激活标识" prop="activeFlag"> <el-form-item label="激活标识" prop="activeFlag">
<el-radio-group v-model="form.activeFlag"> <el-radio-group v-model="form.activeFlag">
@ -203,13 +221,16 @@
<el-divider content-position="center">工序关联产线信息</el-divider> <el-divider content-position="center">工序关联产线信息</el-divider>
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <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>
<el-col :span="1.5"> <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-col>
</el-row> </el-row>
<el-table :data="mesBaseProcessProdlineList" :row-class-name="rowMesBaseProcessProdlineIndex" @selection-change="handleMesBaseProcessProdlineSelectionChange" ref="mesBaseProcessProdline"> <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 type="selection" width="50" align="center"/>
<el-table-column label="序号" align="center" prop="index"/> <el-table-column label="序号" align="center" prop="index"/>
<!-- <el-table-column label="工序主键" align="center" prop="processId" />--> <!-- <el-table-column label="工序主键" align="center" prop="processId" />-->
@ -252,13 +273,16 @@
<el-divider content-position="center">工序关联人员信息</el-divider> <el-divider content-position="center">工序关联人员信息</el-divider>
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <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>
<el-col :span="1.5"> <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-col>
</el-row> </el-row>
<el-table :data="mesBaseProcessUserList" :row-class-name="rowMesBaseProcessUserIndex" @selection-change="handleMesBaseProcessUserSelectionChange" ref="mesBaseProcessUser"> <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 type="selection" width="50" align="center"/>
<el-table-column label="序号" align="center" prop="index"/> <el-table-column label="序号" align="center" prop="index"/>
<el-table-column label="关联人员" align="center" prop="prodlineId"> <el-table-column label="关联人员" align="center" prop="prodlineId">
@ -361,7 +385,7 @@ export default {
{key: 1, label: `工序编号`, visible: true}, {key: 1, label: `工序编号`, visible: true},
{key: 2, label: `工序名称`, visible: true}, {key: 2, label: `工序名称`, visible: true},
{key: 3, label: `工序类别`, visible: true}, {key: 3, label: `工序类别`, visible: true},
{ key: 4, label: `标准工时(分钟)`, visible: true }, {key: 4, label: `标准工时`, visible: true},
{key: 5, label: `激活标识`, visible: false}, {key: 5, label: `激活标识`, visible: false},
{key: 6, label: `备注`, visible: true}, {key: 6, label: `备注`, visible: true},
{key: 7, label: `创建人`, visible: false}, {key: 7, label: `创建人`, visible: false},
@ -409,6 +433,9 @@ export default {
processName: null, processName: null,
processType: null, processType: null,
productionTime: null, productionTime: null,
productionTimeDays: 0,
productionTimeHours: 0,
productionTimeMinutes: 0,
activeFlag: '1', activeFlag: '1',
remark: null, remark: null,
createBy: null, createBy: null,
@ -429,6 +456,24 @@ export default {
this.resetForm("queryForm"); this.resetForm("queryForm");
this.handleQuery(); 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) { isProdlineDisabled(prodlineId) {
// true false // true false
return this.mesBaseProcessProdlineList.some(item => item.prodlineId === prodlineId); return this.mesBaseProcessProdlineList.some(item => item.prodlineId === prodlineId);
@ -457,6 +502,7 @@ export default {
getProcessInfo(processId).then(response => { getProcessInfo(processId).then(response => {
this.form = response.data; this.form = response.data;
this.mesBaseProcessProdlineList = response.data.mesBaseProcessProdlineList; this.mesBaseProcessProdlineList = response.data.mesBaseProcessProdlineList;
this.convertToTime();
this.open = true; this.open = true;
this.title = "修改工序信息"; this.title = "修改工序信息";
}); });
@ -486,6 +532,13 @@ export default {
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
this.form.mesBaseProcessProdlineList = this.mesBaseProcessProdlineList; 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) { if (this.form.processId != null) {
updateProcessInfo(this.form).then(response => { updateProcessInfo(this.form).then(response => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
@ -527,7 +580,8 @@ export default {
}).then(() => { }).then(() => {
this.getList(); this.getList();
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功");
}).catch(() => {}); }).catch(() => {
});
}, },
/** 工序关联产线序号 */ /** 工序关联产线序号 */
rowMesBaseProcessProdlineIndex({row, rowIndex}) { rowMesBaseProcessProdlineIndex({row, rowIndex}) {

@ -125,11 +125,11 @@
<el-table v-loading="loading" :data="productOrderList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="productOrderList" @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="productOrderId" v-if="columns[0].visible"/> <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="销售订单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="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="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="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="物料名称" 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="物料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"> <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"/> <dict-tag :options="dict.type.dispatch_type" :value="scope.row.dispatchType"/>
</template> </template>
</el-table-column> </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="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="planAmount" v-if="columns[11].visible"/>
<el-table-column label="已派工数量" align="center" prop="dispatchAmount" v-if="columns[12].visible" width="100"/> <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: 24, label: `更新人`, visible: false},
{key: 25, label: `更新时间`, visible: false}, {key: 25, label: `更新时间`, visible: false},
{key: 26, label: `计划交货日期`, visible: true}, {key: 26, label: `计划交货日期`, visible: true},
{key: 27, label: `单位时间`, visible: true},
], ],
//BOM //BOM
materialBomList: [], materialBomList: [],

Loading…
Cancel
Save