change - 生产派工页面校验与后台逻辑优化

master
yinq 9 months ago
parent 176e6ed927
commit 160b0f05c4

@ -3,6 +3,8 @@ package com.hw.mes.controller;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import com.hw.mes.service.IMesProductOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
@ -47,6 +49,18 @@ public class MesProductPlanController extends BaseController
return getDataTable(list);
}
/**
* List
* @param mesProductPlan
* @return
*/
@GetMapping("/getProductPlan")
public AjaxResult getProductPlan(MesProductPlan mesProductPlan)
{
List<MesProductPlan> list = mesProductPlanService.selectMesProductPlanList(mesProductPlan);
return success(list);
}
/**
*
*/

@ -26,6 +26,12 @@ public class MesProductPlan extends BaseEntity
@Excel(name = "生产工单ID")
private Long productOrderId;
/**
*
*/
@Excel(name = "生产工单编号")
private String orderCode;
/** 工单编号 */
@Excel(name = "工单编号")
private String planCode;
@ -42,10 +48,18 @@ public class MesProductPlan extends BaseEntity
@Excel(name = "物料bomID")
private Long materialBomId;
/** 物料bom名称 */
@Excel(name = "物料bom名称")
private String materialBomName;
/** 工序ID */
@Excel(name = "工序ID")
private Long processId;
/** 工序名称 */
@Excel(name = "工序名称")
private String processName;
/** 顺序;派工类型是工艺路线的需要有顺序 */
@Excel(name = "顺序")
private Long processOrder;
@ -54,10 +68,18 @@ public class MesProductPlan extends BaseEntity
@Excel(name = "上一工序ID")
private Long lastProcessId;
/** 上工序名称 */
@Excel(name = "上工序名称")
private String lastProcessName;
/** 工位ID关联工位信息主键;根据选择的工序或者工艺路线拆分到工位上会拆分1到多条生产计划 */
@Excel(name = "工位ID")
private Long stationId;
/** 工位名称 */
@Excel(name = "工位名称")
private String stationName;
/** 用户ID*/
@Excel(name = "用户ID")
private Long userId;
@ -116,9 +138,62 @@ public class MesProductPlan extends BaseEntity
*/
private String materialName;
/** 生产计划明细信息 */
private List<MesProductPlanDetail> mesProductPlanDetailList;
/** 工单已派工数量 */
private BigDecimal dispatchedAmount;
public String getOrderCode() {
return orderCode;
}
public void setOrderCode(String orderCode) {
this.orderCode = orderCode;
}
public String getMaterialBomName() {
return materialBomName;
}
public void setMaterialBomName(String materialBomName) {
this.materialBomName = materialBomName;
}
public String getLastProcessName() {
return lastProcessName;
}
public void setLastProcessName(String lastProcessName) {
this.lastProcessName = lastProcessName;
}
public String getProcessName() {
return processName;
}
public void setProcessName(String processName) {
this.processName = processName;
}
public String getStationName() {
return stationName;
}
public void setStationName(String stationName) {
this.stationName = stationName;
}
public BigDecimal getDispatchedAmount() {
return dispatchedAmount;
}
public void setDispatchedAmount(BigDecimal dispatchedAmount) {
this.dispatchedAmount = dispatchedAmount;
}
public void setPlanId(Long planId)
{
this.planId = planId;

@ -173,7 +173,8 @@ public class MesProductOrderServiceImpl implements IMesProductOrderService {
throw new ServiceException("该生产工单不是未发布状态!");
}
mesProductOrder.setOrderStatus(MesConstants.PUBLISHED);
return mesProductOrderMapper.updateMesProductOrder(mesProductOrder);
mesProductOrder.setReleaseTime(DateUtils.getNowDate());
return this.updateMesProductOrder(mesProductOrder);
}
/**

@ -4,6 +4,8 @@ import java.util.List;
import com.hw.common.core.utils.DateUtils;
import com.hw.common.core.utils.uuid.Seq;
import com.hw.common.security.utils.SecurityUtils;
import com.hw.mes.domain.MesProductOrder;
import com.hw.mes.service.IMesProductOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
@ -26,6 +28,9 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService
@Autowired
private MesProductPlanMapper mesProductPlanMapper;
@Autowired
private IMesProductOrderService mesProductOrderService;
/**
*
*
@ -64,6 +69,11 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService
mesProductPlan.setCreateTime(DateUtils.getNowDate());
mesProductPlan.setPlanCode(Seq.getId(Seq.planCodeSeqType, Seq.planCodeCode));
int rows = mesProductPlanMapper.insertMesProductPlan(mesProductPlan);
//更新工单已派工数量
MesProductOrder mesProductOrder = new MesProductOrder();
mesProductOrder.setProductOrderId(mesProductPlan.getProductOrderId());
mesProductOrder.setDispatchAmount(mesProductPlan.getDispatchedAmount());
mesProductOrderService.updateMesProductOrder(mesProductOrder);
insertMesProductPlanDetail(mesProductPlan);
return rows;
}
@ -124,7 +134,7 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService
Long planId = mesProductPlan.getPlanId();
if (StringUtils.isNotNull(mesProductPlanDetailList))
{
List<MesProductPlanDetail> list = new ArrayList<MesProductPlanDetail>();
List<MesProductPlanDetail> list = new ArrayList<>();
for (MesProductPlanDetail mesProductPlanDetail : mesProductPlanDetailList)
{
mesProductPlanDetail.setPlanId(planId);

@ -1,97 +1,182 @@
<?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.MesProductPlanMapper">
<resultMap type="MesProductPlan" id="MesProductPlanResult">
<result property="planId" column="plan_id" />
<result property="productOrderId" column="product_order_id" />
<result property="planCode" column="plan_code" />
<result property="dispatchCode" column="dispatch_code" />
<result property="materialId" column="material_id" />
<result property="materialBomId" column="material_bom_id" />
<result property="processId" column="process_id" />
<result property="processOrder" column="process_order" />
<result property="lastProcessId" column="last_process_id" />
<result property="stationId" column="station_id" />
<result property="userId" column="user_id" />
<result property="productionTime" column="production_time" />
<result property="planAmount" column="plan_amount" />
<result property="completeAmount" column="complete_amount" />
<result property="planBeginTime" column="plan_begin_time" />
<result property="planEndTime" column="plan_end_time" />
<result property="realBeginTime" column="real_begin_time" />
<result property="realEndTime" column="real_end_time" />
<result property="attachId" column="attach_id" />
<result property="planStatus" column="plan_status" />
<result property="isFlag" column="is_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="planDeliveryDate" column="plan_delivery_date" />
<result property="materialName" column="material_name" />
<result property="planId" column="plan_id"/>
<result property="productOrderId" column="product_order_id"/>
<result property="orderCode" column="order_code"/>
<result property="planCode" column="plan_code"/>
<result property="dispatchCode" column="dispatch_code"/>
<result property="materialId" column="material_id"/>
<result property="materialName" column="material_name"/>
<result property="materialBomId" column="material_bom_id"/>
<result property="materialBomName" column="materialBomName"/>
<result property="processId" column="process_id"/>
<result property="processOrder" column="process_order"/>
<result property="lastProcessId" column="last_process_id"/>
<result property="lastProcessName" column="lastProcessName"/>
<result property="stationId" column="station_id"/>
<result property="userId" column="user_id"/>
<result property="productionTime" column="production_time"/>
<result property="planAmount" column="plan_amount"/>
<result property="completeAmount" column="complete_amount"/>
<result property="planBeginTime" column="plan_begin_time"/>
<result property="planEndTime" column="plan_end_time"/>
<result property="realBeginTime" column="real_begin_time"/>
<result property="realEndTime" column="real_end_time"/>
<result property="attachId" column="attach_id"/>
<result property="planStatus" column="plan_status"/>
<result property="isFlag" column="is_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="planDeliveryDate" column="plan_delivery_date"/>
<result property="materialName" column="material_name"/>
<result property="processName" column="process_name"/>
<result property="stationName" column="station_name"/>
</resultMap>
<resultMap id="MesProductPlanMesProductPlanDetailResult" type="MesProductPlan" extends="MesProductPlanResult">
<collection property="mesProductPlanDetailList" notNullColumn="sub_plan_detail_id" javaType="java.util.List" resultMap="MesProductPlanDetailResult" />
<collection property="mesProductPlanDetailList" notNullColumn="sub_plan_detail_id" javaType="java.util.List"
resultMap="MesProductPlanDetailResult"/>
</resultMap>
<resultMap type="MesProductPlanDetail" id="MesProductPlanDetailResult">
<result property="planDetailId" column="sub_plan_detail_id" />
<result property="planDetailCode" column="sub_plan_detail_code" />
<result property="planId" column="sub_plan_id" />
<result property="planCode" column="sub_plan_code" />
<result property="userId" column="sub_user_id" />
<result property="userName" column="sub_user_name" />
<result property="realBeginTime" column="sub_real_begin_time" />
<result property="realEndTime" column="sub_real_end_time" />
<result property="planDetailStatus" column="sub_plan_detail_status" />
<result property="isFlag" column="sub_is_flag" />
<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="planDetailId" column="sub_plan_detail_id"/>
<result property="planDetailCode" column="sub_plan_detail_code"/>
<result property="planId" column="sub_plan_id"/>
<result property="planCode" column="sub_plan_code"/>
<result property="userId" column="sub_user_id"/>
<result property="userName" column="sub_user_name"/>
<result property="realBeginTime" column="sub_real_begin_time"/>
<result property="realEndTime" column="sub_real_end_time"/>
<result property="planDetailStatus" column="sub_plan_detail_status"/>
<result property="isFlag" column="sub_is_flag"/>
<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="selectMesProductPlanVo">
select plan_id, product_order_id, plan_code, dispatch_code, material_id, material_bom_id, process_id, process_order, last_process_id, station_id, user_id, production_time, plan_amount, complete_amount, plan_begin_time, plan_end_time, real_begin_time, real_end_time, attach_id, plan_status, is_flag, remark, create_by, create_time, update_by, update_time from mes_product_plan
select mpp.plan_id,
mpp.product_order_id,
po.order_code,
mpp.plan_code,
mpp.dispatch_code,
mpp.material_id,
mi.material_name,
mpp.material_bom_id,
concat(mb.material_name, '-', mb.material_bom_desc) materialBomName,
mpp.process_id,
bpi.process_name,
mpp.process_order,
mpp.last_process_id,
bp2.process_name lastProcessName,
mpp.station_id,
bsi.station_name,
mpp.user_id,
mpp.production_time,
mpp.plan_amount,
mpp.complete_amount,
mpp.plan_begin_time,
mpp.plan_end_time,
mpp.real_begin_time,
mpp.real_end_time,
mpp.attach_id,
mpp.plan_status,
mpp.is_flag,
mpp.remark,
mpp.create_by,
mpp.create_time,
mpp.update_by,
mpp.update_time
from mes_product_plan mpp
left join mes_base_process_info bpi on bpi.process_id = mpp.process_id
left join mes_base_station_info bsi on bsi.station_id = mpp.station_id
left join mes_base_material_info mi on mi.material_id = mpp.material_id
left join mes_material_bom mb on mb.material_bom_id = mpp.material_bom_id
left join mes_base_process_info bp2 on bp2.process_id = mpp.last_process_id
left join mes_product_order po on po.product_order_id = mpp.product_order_id
</sql>
<select id="selectMesProductPlanList" parameterType="MesProductPlan" resultMap="MesProductPlanResult">
<include refid="selectMesProductPlanVo"/>
<where>
<if test="productOrderId != null "> and product_order_id = #{productOrderId}</if>
<if test="planCode != null and planCode != ''"> and plan_code = #{planCode}</if>
<if test="dispatchCode != null and dispatchCode != ''"> and dispatch_code = #{dispatchCode}</if>
<if test="materialId != null "> and material_id = #{materialId}</if>
<if test="materialBomId != null "> and material_bom_id = #{materialBomId}</if>
<if test="processId != null "> and process_id = #{processId}</if>
<if test="processOrder != null "> and process_order = #{processOrder}</if>
<if test="lastProcessId != null "> and last_process_id = #{lastProcessId}</if>
<if test="stationId != null "> and station_id = #{stationId}</if>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="productionTime != null "> and production_time = #{productionTime}</if>
<if test="planAmount != null "> and plan_amount = #{planAmount}</if>
<if test="completeAmount != null "> and complete_amount = #{completeAmount}</if>
<if test="planBeginTime != null "> and plan_begin_time = #{planBeginTime}</if>
<if test="planEndTime != null "> and plan_end_time = #{planEndTime}</if>
<if test="realBeginTime != null "> and real_begin_time = #{realBeginTime}</if>
<if test="realEndTime != null "> and real_end_time = #{realEndTime}</if>
<if test="attachId != null and attachId != ''"> and attach_id = #{attachId}</if>
<if test="planStatus != null and planStatus != ''"> and plan_status = #{planStatus}</if>
<if test="isFlag != null and isFlag != ''"> and is_flag = #{isFlag}</if>
<if test="productOrderId != null ">and mpp.product_order_id = #{productOrderId}</if>
<if test="planCode != null and planCode != ''">and mpp.plan_code = #{planCode}</if>
<if test="dispatchCode != null and dispatchCode != ''">and mpp.dispatch_code = #{dispatchCode}</if>
<if test="materialId != null ">and mpp.material_id = #{materialId}</if>
<if test="materialBomId != null ">and mpp.material_bom_id = #{materialBomId}</if>
<if test="processId != null ">and mpp.process_id = #{processId}</if>
<if test="processOrder != null ">and mpp.process_order = #{processOrder}</if>
<if test="lastProcessId != null ">and mpp.last_process_id = #{lastProcessId}</if>
<if test="stationId != null ">and mpp.station_id = #{stationId}</if>
<if test="userId != null ">and mpp.user_id = #{userId}</if>
<if test="productionTime != null ">and mpp.production_time = #{productionTime}</if>
<if test="planAmount != null ">and mpp.plan_amount = #{planAmount}</if>
<if test="completeAmount != null ">and mpp.complete_amount = #{completeAmount}</if>
<if test="planBeginTime != null ">and mpp.plan_begin_time = #{planBeginTime}</if>
<if test="planEndTime != null ">and mpp.plan_end_time = #{planEndTime}</if>
<if test="realBeginTime != null ">and mpp.real_begin_time = #{realBeginTime}</if>
<if test="realEndTime != null ">and mpp.real_end_time = #{realEndTime}</if>
<if test="attachId != null and attachId != ''">and mpp.attach_id = #{attachId}</if>
<if test="planStatus != null and planStatus != ''">and mpp.plan_status = #{planStatus}</if>
<if test="isFlag != null and isFlag != ''">and mpp.is_flag = #{isFlag}</if>
</where>
order by mpp.dispatch_code
</select>
<select id="selectMesProductPlanByPlanId" parameterType="Long" resultMap="MesProductPlanMesProductPlanDetailResult">
select a.plan_id, a.product_order_id, a.plan_code, a.dispatch_code, a.material_id, a.material_bom_id, a.process_id, a.process_order, a.last_process_id, a.station_id, a.user_id, a.production_time, a.plan_amount, a.complete_amount, a.plan_begin_time, a.plan_end_time, a.real_begin_time, a.real_end_time, a.attach_id, a.plan_status, a.is_flag, a.remark, a.create_by, a.create_time, a.update_by, a.update_time,
b.plan_detail_id as sub_plan_detail_id, b.plan_detail_code as sub_plan_detail_code, b.plan_id as sub_plan_id, b.plan_code as sub_plan_code, b.user_id as sub_user_id, b.user_name as sub_user_name, b.real_begin_time as sub_real_begin_time, b.real_end_time as sub_real_end_time, b.plan_detail_status as sub_plan_detail_status, b.is_flag as sub_is_flag, 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.plan_id,
a.product_order_id,
a.plan_code,
a.dispatch_code,
a.material_id,
a.material_bom_id,
a.process_id,
a.process_order,
a.last_process_id,
a.station_id,
a.user_id,
a.production_time,
a.plan_amount,
a.complete_amount,
a.plan_begin_time,
a.plan_end_time,
a.real_begin_time,
a.real_end_time,
a.attach_id,
a.plan_status,
a.is_flag,
a.remark,
a.create_by,
a.create_time,
a.update_by,
a.update_time,
b.plan_detail_id as sub_plan_detail_id,
b.plan_detail_code as sub_plan_detail_code,
b.plan_id as sub_plan_id,
b.plan_code as sub_plan_code,
b.user_id as sub_user_id,
b.user_name as sub_user_name,
b.real_begin_time as sub_real_begin_time,
b.real_end_time as sub_real_end_time,
b.plan_detail_status as sub_plan_detail_status,
b.is_flag as sub_is_flag,
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_product_plan a
left join mes_product_plan_detail b on b.plan_id = a.plan_id
left join mes_product_plan_detail b on b.plan_id = a.plan_id
where a.plan_id = #{planId}
</select>
@ -123,7 +208,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="productOrderId != null">#{productOrderId},</if>
<if test="planCode != null and planCode != ''">#{planCode},</if>
@ -150,7 +235,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="updateMesProductPlan" parameterType="MesProductPlan">
@ -186,7 +271,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<delete id="deleteMesProductPlanByPlanId" parameterType="Long">
delete from mes_product_plan where plan_id = #{planId}
delete
from mes_product_plan
where plan_id = #{planId}
</delete>
<delete id="deleteMesProductPlanByPlanIds" parameterType="String">
@ -204,37 +291,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<delete id="deleteMesProductPlanDetailByPlanId" parameterType="Long">
delete from mes_product_plan_detail where plan_id = #{planId}
delete
from mes_product_plan_detail
where plan_id = #{planId}
</delete>
<insert id="batchMesProductPlanDetail">
insert into mes_product_plan_detail( plan_detail_id, plan_detail_code, plan_id, plan_code, user_id, user_name, real_begin_time, real_end_time, plan_detail_status, is_flag, remark, create_by, create_time, update_by, update_time) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.planDetailId}, #{item.planDetailCode}, #{item.planId}, #{item.planCode}, #{item.userId}, #{item.userName}, #{item.realBeginTime}, #{item.realEndTime}, #{item.planDetailStatus}, #{item.isFlag}, #{item.remark}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime})
insert into mes_product_plan_detail( plan_detail_id, plan_detail_code, plan_id, plan_code, user_id, user_name,
real_begin_time, real_end_time, plan_detail_status, is_flag, remark, create_by, create_time, update_by,
update_time) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.planDetailId}, #{item.planDetailCode}, #{item.planId}, #{item.planCode}, #{item.userId},
#{item.userName}, #{item.realBeginTime}, #{item.realEndTime}, #{item.planDetailStatus}, #{item.isFlag},
#{item.remark}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime})
</foreach>
</insert>
<select id="selectMesProductPlanJoinList" parameterType="MesProductPlan" resultMap="MesProductPlanResult">
select mpp.plan_id, mpp.product_order_id, mpp.plan_code, mpp.dispatch_code, mpp.material_id, mpp.material_bom_id, mpp.process_id, mpp.process_order, mpp.last_process_id,
mpp.station_id, mpp.plan_amount, mpp.complete_amount, mpp.plan_begin_time, mpp.plan_end_time, mpp.real_begin_time, mpp.real_end_time,
select mpp.plan_id, mpp.product_order_id, mpp.plan_code, mpp.dispatch_code, mpp.material_id,
mpp.material_bom_id, mpp.process_id, mpp.process_order, mpp.last_process_id,
mpp.station_id, mpp.plan_amount, mpp.complete_amount, mpp.plan_begin_time, mpp.plan_end_time,
mpp.real_begin_time, mpp.real_end_time,
mpp.attach_id, mpp.plan_status, mpo.plan_delivery_date,mbmi.material_name
from mes_product_plan mpp left join mes_product_order mpo on mpp.product_order_id = mpo.product_order_id
left join mes_base_material_info mbmi on mpp.material_id=mbmi.material_id
from mes_product_plan mpp left join mes_product_order mpo on mpp.product_order_id = mpo.product_order_id
left join mes_base_material_info mbmi on mpp.material_id=mbmi.material_id
<where>
<if test="stationId != null "> and mpp.station_id = #{stationId}</if>
<if test="planStatus != null and planStatus != ''"> and mpp.plan_status = #{planStatus}</if>
<if test="stationId != null ">and mpp.station_id = #{stationId}</if>
<if test="planStatus != null and planStatus != ''">and mpp.plan_status = #{planStatus}</if>
</where>
</select>

@ -59,3 +59,12 @@ export function orderAddMesProductPlanList(data) {
data: data
})
}
// 查询生产派工列表
export function getProductPlan(query) {
return request({
url: '/mes/productplan/getProductPlan',
method: 'get',
params: query
})
}

@ -1,6 +1,6 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item label="工单编号" prop="orderCode">
<el-input
v-model="queryParams.orderCode"
@ -17,24 +17,24 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="物料ID" prop="materialId">
<el-input
v-model="queryParams.materialId"
placeholder="请输入物料ID"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="派工类型" prop="dispatchType">
<el-select v-model="queryParams.dispatchType" placeholder="请选择派工类型" clearable>
<el-option
v-for="dict in dict.type.dispatch_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<!-- <el-form-item label="物料ID" prop="materialId">-->
<!-- <el-input-->
<!-- v-model="queryParams.materialId"-->
<!-- placeholder="请输入物料ID"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="派工类型" prop="dispatchType">-->
<!-- <el-select v-model="queryParams.dispatchType" placeholder="请选择派工类型" clearable>-->
<!-- <el-option-->
<!-- v-for="dict in dict.type.dispatch_type"-->
<!-- :key="dict.value"-->
<!-- :label="dict.label"-->
<!-- :value="dict.value"-->
<!-- />-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<el-form-item label="工单状态" prop="orderStatus">
<el-select v-model="queryParams.orderStatus" placeholder="请选择工单状态" clearable>
<el-option
@ -125,22 +125,22 @@
<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"/>
<el-table-column label="销售订单ID" align="center" prop="saleOrderId" v-if="columns[2].visible"/>
<el-table-column label="销售订单编号" align="center" prop="saleorderCode" v-if="columns[3].visible"/>
<el-table-column label="销售订单行号" align="center" prop="saleorderLinenumber" v-if="columns[4].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="100"/>
<el-table-column label="项目编号" align="center" prop="projectNo" v-if="columns[5].visible"/>
<el-table-column label="物料ID" align="center" prop="materialId" v-if="columns[6].visible"/>
<el-table-column label="物料bomID" align="center" prop="materialBomId" v-if="columns[7].visible"/>
<el-table-column label="物料名称" align="center" prop="materialName" v-if="columns[6].visible"/>
<el-table-column label="物料bomID" align="center" prop="materialBomId" v-if="columns[7].visible" width="100"/>
<el-table-column label="派工类型" align="center" prop="dispatchType" v-if="columns[8].visible">
<template slot-scope="scope">
<dict-tag :options="dict.type.dispatch_type" :value="scope.row.dispatchType"/>
</template>
</el-table-column>
<el-table-column label="派工ID" align="center" prop="dispatchId" v-if="columns[9].visible"/>
<el-table-column label="工艺路线" align="center" prop="dispatchName" v-if="columns[9].visible" width="100"/>
<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"/>
<el-table-column label="已派工数量" align="center" prop="dispatchAmount" v-if="columns[12].visible" width="100"/>
<el-table-column label="完成数量" align="center" prop="completeAmount" v-if="columns[13].visible"/>
<el-table-column label="发布时间" align="center" prop="releaseTime" width="180" v-if="columns[14].visible">
<template slot-scope="scope">
@ -177,7 +177,7 @@
<dict-tag :options="dict.type.plan_status" :value="scope.row.orderStatus"/>
</template>
</el-table-column>
<el-table-column label="库存锁定标识" align="center" prop="stockLockFlag" v-if="columns[20].visible">
<el-table-column label="库存锁定标识" align="center" prop="stockLockFlag" v-if="columns[20].visible" width="100">
<template slot-scope="scope">
<dict-tag :options="dict.type.active_flag" :value="scope.row.stockLockFlag"/>
</template>
@ -195,7 +195,7 @@
<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" width="220">
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="150" fixed="right">
<template slot-scope="scope">
<!-- <el-button-->
<!-- size="mini"-->
@ -532,7 +532,7 @@ export default {
{required: true, message: "派工类型不能为空", trigger: "change"}
],
dispatchId: [
{required: true, message: "派工ID不能为空", trigger: "blur"}
{required: true, message: "工艺路线不能为空", trigger: "blur"}
],
saleAmount: [
{required: true, message: "销售数量不能为空", trigger: "blur"},
@ -552,14 +552,14 @@ export default {
columns: [
{key: 0, label: `主键标识`, visible: false},
{key: 1, label: `工单编号`, visible: true},
{key: 2, label: `销售订单ID`, visible: true},
{key: 2, label: `销售订单ID`, visible: false},
{key: 3, label: `销售订单编号`, visible: true},
{key: 4, label: `销售订单行号`, visible: true},
{key: 5, label: `项目编号`, visible: true},
{key: 6, label: `物料ID`, visible: true},
{key: 6, label: `物料名称`, visible: true},
{key: 7, label: `物料bomID`, visible: true},
{key: 8, label: `派工类型`, visible: true},
{key: 9, label: `派工ID`, visible: true},
{key: 9, label: `工艺路线`, visible: true},
{key: 10, label: `销售数量`, visible: true},
{key: 11, label: `计划数量`, visible: true},
{key: 12, label: `已派工数量`, visible: true},

@ -30,7 +30,7 @@
<!-- </el-button>-->
<!-- </el-col>-->
</el-row>
<el-table :data="mesProductPlanlList" :row-class-name="rowMesProductPlanIndex"
<el-table :data="mesProductPlanList" :row-class-name="rowMesProductPlanIndex"
@selection-change="handleMesProductPlanSelectionChange" ref="mesProductPlan">
<el-table-column type="selection" width="50" align="center"/>
<el-table-column label="序号" align="center" prop="index" width="50" v-if="false"/>
@ -44,37 +44,37 @@
<el-input v-model="scope.row.processName" :disabled="true"/>
</template>
</el-table-column>
<el-table-column label="步骤" align="center" prop="processOrder" :disabled="true">
<el-table-column label="步骤" align="center" prop="processOrder" >
<template slot-scope="scope">
<el-input v-model="scope.row.processOrder" :disabled="true"/>
</template>
</el-table-column>
<el-table-column label="工位" align="center" prop="stationName" width="140" :disabled="true">
<el-table-column label="工位" align="center" prop="stationName" width="140" >
<template slot-scope="scope">
<el-input v-model="scope.row.stationName" :disabled="true"/>
</template>
</el-table-column>
<el-table-column label="派工数量" align="center" prop="planAmount" width="140">
<el-table-column label="派工数量" align="center" prop="planAmount" width="100">
<template slot-scope="scope">
<el-input-number v-model="scope.row.planAmount"/>
<el-input v-model="scope.row.planAmount" :disabled="scope.row.oldRowFlag"/>
</template>
</el-table-column>
<el-table-column label="派工标准工时" align="center" prop="productionTime" width="140">
<el-table-column label="派工标准工时" align="center" prop="productionTime" width="100">
<template slot-scope="scope">
<el-input-number v-model="scope.row.productionTime"/>
<el-input v-model="scope.row.productionTime" :disabled="scope.row.oldRowFlag"/>
</template>
</el-table-column>
<el-table-column label="计划开始时间" align="center" prop="planBeginTime" width="240">
<el-table-column label="计划开始时间" align="center" prop="planBeginTime" width="230">
<template slot-scope="scope">
<el-date-picker clearable v-model="scope.row.planBeginTime" type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择计划开始时间"/>
placeholder="请选择计划开始时间" :disabled="scope.row.oldRowFlag"/>
</template>
</el-table-column>
<el-table-column label="计划完成时间" align="center" prop="planEndTime" width="240">
<el-table-column label="计划完成时间" align="center" prop="planEndTime" width="230">
<template slot-scope="scope">
<el-date-picker clearable v-model="scope.row.planEndTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择计划完成时间"/>
placeholder="请选择计划完成时间" :disabled="scope.row.oldRowFlag"/>
</template>
</el-table-column>
<el-table-column label="状态" align="center" prop="planStatus" width="150">
@ -113,7 +113,7 @@
<script>
import {getProductOrder} from "@//api/mes/productOrder";
import {addProductplan, getDispatchCode, orderAddMesProductPlanList} from "@//api/mes/productplan";
import {getDispatchCode, getProductPlan, orderAddMesProductPlanList} from "@//api/mes/productplan";
import {getStationByRouteId} from "@//api/mes/baseRoute";
export default {
@ -131,8 +131,8 @@ export default {
columns: [],
//
productplanList: [],
//
mesProductPlanlList: [],
//
mesProductPlanList: [],
//
info: {},
//
@ -173,14 +173,53 @@ export default {
getProductOrder(productOrderId).then(res => {
this.form = res.data;
});
getProductPlan({productOrderId: productOrderId}).then(res => {
res.data.forEach(e => {
// false=true=
e.oldRowFlag = true;
this.mesProductPlanList.push(e);
})
})
}
},
methods: {
/** 提交按钮 */
submitForm() {
//
let dataList = this.mesProductPlanList.filter(plan => !plan.oldRowFlag);
if (dataList.length === 0){
this.close();
return;
}
// ( + <= )
// processIdplanAmountplanAmount
const sumList = dataList.reduce((result, {processId, planAmount}) => {
const numericAmount = parseInt(planAmount, 10);
if (!this.isPositiveInteger(numericAmount)) {
this.$modal.msgError("派工数量须为大于0的正整数");
return;
}
result[processId] = (result[processId] || 0) + numericAmount;
return result;
}, {});
orderAddMesProductPlanList(this.mesProductPlanlList).then(res => {
const uniqueSum = new Set(Object.values(sumList));
if (uniqueSum.size === 1) {
const finalSum = Array.from(uniqueSum)[0];
let dispatchedAmount = this.form.dispatchAmount + finalSum;
if (dispatchedAmount > this.form.planAmount) {
this.$modal.msgError("每个工序的派工数量之和需小于等于该工单计划数量!");
return;
}
dataList.forEach(e => {
e.dispatchedAmount = dispatchedAmount;
}
)
} else {
this.$modal.msgError("每个工序的派工数量之和需相等!");
return;
}
orderAddMesProductPlanList(dataList).then(res => {
this.$modal.msgSuccess(res.msg);
this.close();
});
@ -200,7 +239,7 @@ export default {
},
/** 查看图纸 */
handleDrawing(row) {
console.log(row)
console.log(row);
},
/** 生产计划添加按钮操作 */
handleAddMesProductPlan() {
@ -223,38 +262,42 @@ export default {
obj.productionTime = 0;
obj.planBeginTime = this.form.planBeginTime;
obj.planEndTime = this.form.planEndTime;
obj.planStatus = '0';
obj.planStatus = '1';
// multiStationFlag
if (e.multiStationFlag > 1) {
obj.planAmount = 0;
} else {
obj.planAmount = this.form.planAmount;
obj.planAmount = this.form.planAmount - this.form.dispatchAmount;
}
obj.materialId = this.form.materialId;
obj.materialBomId = this.form.materialBomId;
obj.productOrderId = this.form.productOrderId;
// ID
if (lastProcessId == null || lastProcessId === obj.lastProcessId) {
if (lastProcessId == null || lastProcessId === obj.processId) {
obj.lastProcessId = 0;
} else {
obj.lastProcessId = lastProcessId;
}
lastProcessId = e.processId;
this.mesProductPlanlList.push(obj);
// false=true=
obj.oldRowFlag = false;
this.mesProductPlanList.push(obj);
})
})
})
},
isPositiveInteger(value) {
// 使
return /^[1-9]\d*$/.test(value);
},
/** 生产计划明细删除按钮操作 */
handleDeleteMesProductPlan() {
if (this.checkedMesProductPlan.length == 0) {
this.$modal.msgError("请先选择要删除的生产计划明细数据");
} else {
const mesProductPlanlList = this.mesProductPlanlList;
const mesProductPlanList = this.mesProductPlanList;
const checkedMesProductPlan = this.checkedMesProductPlan;
this.mesProductPlanlList = mesProductPlanlList.filter(function (item) {
this.mesProductPlanList = mesProductPlanList.filter(function (item) {
return checkedMesProductPlan.indexOf(item.index) == -1
});
}

@ -1,6 +1,14 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item label="生产工单编号" prop="orderCode">
<el-input
v-model="queryParams.orderCode"
placeholder="请输入生产工单编号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="计划编号" prop="planCode">
<el-input
v-model="queryParams.planCode"
@ -25,14 +33,14 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="实际完成时间" prop="realEndTime">
<el-date-picker clearable
v-model="queryParams.realEndTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择实际完成时间">
</el-date-picker>
</el-form-item>
<!-- <el-form-item label="实际完成时间" prop="realEndTime">-->
<!-- <el-date-picker clearable-->
<!-- v-model="queryParams.realEndTime"-->
<!-- type="date"-->
<!-- value-format="yyyy-MM-dd"-->
<!-- placeholder="请选择实际完成时间">-->
<!-- </el-date-picker>-->
<!-- </el-form-item>-->
<el-form-item label="计划状态" prop="planStatus">
<el-select v-model="queryParams.planStatus" placeholder="请选择计划状态" clearable>
<el-option
@ -50,38 +58,38 @@
</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:productplan: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:productplan: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:productplan:remove']"
>删除</el-button>
</el-col>
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="primary"-->
<!-- plain-->
<!-- icon="el-icon-plus"-->
<!-- size="mini"-->
<!-- @click="handleAdd"-->
<!-- v-hasPermi="['mes:productplan: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:productplan: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:productplan:remove']"-->
<!-- >删除</el-button>-->
<!-- </el-col>-->
<el-col :span="1.5">
<el-button
type="warning"
@ -98,15 +106,15 @@
<el-table v-loading="loading" :data="productplanList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="主键标识" align="center" prop="planId" v-if="columns[0].visible"/>
<el-table-column label="生产工单ID" align="center" prop="productOrderId" v-if="columns[1].visible"/>
<el-table-column label="计划编号" align="center" prop="planCode" v-if="columns[2].visible"/>
<el-table-column label="派工单号" align="center" prop="dispatchCode" v-if="columns[3].visible"/>
<el-table-column label="物料ID" align="center" prop="materialId" v-if="columns[4].visible"/>
<el-table-column label="物料bomID" align="center" prop="materialBomId" v-if="columns[5].visible"/>
<el-table-column label="工序ID" align="center" prop="processId" v-if="columns[6].visible"/>
<el-table-column label="生产工单编号" align="center" prop="orderCode" v-if="columns[1].visible" width="100"/>
<el-table-column label="计划编号" align="center" prop="planCode" v-if="columns[2].visible" width="110"/>
<el-table-column label="派工单号" align="center" prop="dispatchCode" v-if="columns[3].visible" width="110"/>
<el-table-column label="物料名称" align="center" prop="materialName" v-if="columns[4].visible"/>
<el-table-column label="物料BOM名称" align="center" prop="materialBomName" v-if="columns[5].visible" width="110"/>
<el-table-column label="工序名称" align="center" prop="processName" v-if="columns[6].visible"/>
<el-table-column label="顺序" align="center" prop="processOrder" v-if="columns[7].visible"/>
<el-table-column label="上一工序ID" align="center" prop="lastProcessId" v-if="columns[8].visible"/>
<el-table-column label="工位ID" align="center" prop="stationId" v-if="columns[9].visible"/>
<el-table-column label="上一工序名称" align="center" prop="lastProcessName" v-if="columns[8].visible" width="100"/>
<el-table-column label="工位名称" align="center" prop="stationName" v-if="columns[9].visible"/>
<el-table-column label="用户ID" align="center" prop="userId" v-if="columns[10].visible"/>
<el-table-column label="标准工时" align="center" prop="productionTime" v-if="columns[11].visible"/>
<el-table-column label="计划数量" align="center" prop="planAmount" v-if="columns[12].visible"/>
@ -187,7 +195,7 @@
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="生产工单ID" prop="productOrderId">
<el-input v-model="form.productOrderId" placeholder="请输入生产工单ID" />
<el-input v-model="form.productOrderId" placeholder="请输入生产工单ID"/>
</el-form-item>
<el-form-item label="计划编号" prop="planCode">
<el-input v-model="form.planCode" placeholder="请输入计划编号" />
@ -436,16 +444,16 @@ export default {
],
},
columns: [
{ key: 0, label: `主键标识`, visible: true },
{ key: 1, label: `生产工单ID`, 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: `物料ID`, visible: true },
{ key: 5, label: `物料bomID`, visible: true },
{ key: 6, label: `工序ID`, visible: true },
{ key: 4, label: `物料名称`, visible: true },
{ key: 5, label: `物料BOM名称`, visible: true },
{ key: 6, label: `工序名称`, visible: true },
{ key: 7, label: `顺序`, visible: true },
{ key: 8, label: `上一工序ID`, visible: true },
{ key: 9, label: `工位ID`, visible: true },
{ key: 8, label: `上一工序名称`, visible: true },
{ key: 9, label: `工位名称`, visible: true },
{ key: 10, label: `用户ID`, visible: true },
{ key: 11, label: `标准工时`, visible: true },
{ key: 12, label: `计划数量`, visible: true },
@ -456,12 +464,12 @@ export default {
{ key: 17, label: `实际完成时间`, visible: true },
{ key: 18, label: `附件信息`, visible: true },
{ key: 19, label: `计划状态`, visible: true },
{ key: 20, label: `是否标识`, visible: true },
{ key: 21, label: `备注`, visible: true },
{ key: 22, label: `创建人`, visible: true },
{ key: 20, label: `是否标识`, visible: false },
{ key: 21, label: `备注`, visible: false },
{ key: 22, label: `创建人`, visible: false },
{ key: 23, label: `创建时间`, visible: true },
{ key: 24, label: `更新人`, visible: true },
{ key: 25, label: `更新时间`, visible: true },
{ key: 24, label: `更新人`, visible: false },
{ key: 25, label: `更新时间`, visible: false },
],
};
},

Loading…
Cancel
Save