change - 生产工单新增生产派工页面与后台逻辑

master
yinq 9 months ago
parent 9b341cb0b0
commit 176e6ed927

@ -53,6 +53,23 @@ public class Seq {
// 工单编号记录标识
public static final String orderCodeCode = "OC";
// 派工编号序列类型
public static final String dispatchCodeSeqType = "DISPATCH_CODE";
// 派工编号序列数
private static AtomicInteger dispatchCodeSeq = new AtomicInteger(1);
// 派工编号记录标识
public static final String dispatchCodeCode = "PG";
// 派工计划编号序列类型
public static final String planCodeSeqType = "PLAN_CODE";
// 派工计划编号序列数
private static AtomicInteger planCodeSeq = new AtomicInteger(1);
// 派工计划编号记录标识
public static final String planCodeCode = "JL";
/**
*
@ -122,6 +139,10 @@ public class Seq {
atomicInt = rawReturnSeq;
}else if (orderCodeSeqType.equals(type)) {
atomicInt = orderCodeSeq;
}else if (dispatchCodeSeqType.equals(type)) {
atomicInt = dispatchCodeSeq;
}else if (planCodeSeqType.equals(type)) {
atomicInt = planCodeSeq;
}
return getId(atomicInt, 3, code);
}

@ -116,4 +116,15 @@ public class MesBaseRouteController extends BaseController
{
return toAjax(mesBaseRouteService.deleteMesBaseRouteByRouteIds(routeIds));
}
/**
* 线ID
* @param routeId
* @return
*/
@GetMapping(value = "/getStationByRouteId/{routeId}")
public AjaxResult getStationByRouteId(@PathVariable("routeId") Long routeId)
{
return success(mesBaseRouteService.getStationByRouteId(routeId));
}
}

@ -102,4 +102,26 @@ public class MesProductPlanController extends BaseController
{
return toAjax(mesProductPlanService.deleteMesProductPlanByPlanIds(planIds));
}
/**
*
*
* @return orderCode
*/
@GetMapping(value = "/getDispatchCode")
public AjaxResult getDispatchCode() {
return success(mesProductPlanService.getDispatchCode());
}
/**
* List
*/
@RequiresPermissions("mes:productplan:add")
@Log(title = "生产派工", businessType = BusinessType.INSERT)
@PostMapping("/orderAddMesProductPlanList")
public AjaxResult orderAddMesProductPlanList(@RequestBody List<MesProductPlan> mesProductPlanList)
{
return toAjax(mesProductPlanService.orderAddMesProductPlanList(mesProductPlanList));
}
}

@ -77,6 +77,7 @@ public class MesProductOrder extends BaseEntity {
@Excel(name = "派工ID")
private Long dispatchId;
/**
* ;
*/
@ -160,6 +161,48 @@ public class MesProductOrder extends BaseEntity {
*/
private String saleOrderFlag;
/**
* 线
*/
@Excel(name = "工艺路线名称")
private String dispatchName;
/**
*
*/
@Excel(name = "物料编号")
private String materialCode;
/**
*
*/
@Excel(name = "物料名称")
private String materialName;
public String getMaterialCode() {
return materialCode;
}
public void setMaterialCode(String materialCode) {
this.materialCode = materialCode;
}
public String getMaterialName() {
return materialName;
}
public void setMaterialName(String materialName) {
this.materialName = materialName;
}
public String getDispatchName() {
return dispatchName;
}
public void setDispatchName(String dispatchName) {
this.dispatchName = dispatchName;
}
public Date getPlanDeliveryDate() {
return planDeliveryDate;
}

@ -26,12 +26,12 @@ public class MesProductPlan extends BaseEntity
@Excel(name = "生产工单ID")
private Long productOrderId;
/** 计划编号 */
@Excel(name = "计划编号")
/** 工单编号 */
@Excel(name = "工单编号")
private String planCode;
/** 派工单号;主要为顺序生产时,获取上一工序的派工单是否完成,每次派工生成的派工单号相同,不同次派工的派工单号不能相同 */
@Excel(name = "派工单号;主要为顺序生产时,获取上一工序的派工单是否完成,每次派工生成的派工单号相同,不同次派工的派工单号不能相同")
@Excel(name = "派工单号")
private String dispatchCode;
/** 物料ID */
@ -39,7 +39,7 @@ public class MesProductPlan extends BaseEntity
private Long materialId;
/** 物料bomID关联mes_material_bom的material_bom_id */
@Excel(name = "物料bomID关联mes_material_bom的material_bom_id")
@Excel(name = "物料bomID")
private Long materialBomId;
/** 工序ID */
@ -47,7 +47,7 @@ public class MesProductPlan extends BaseEntity
private Long processId;
/** 顺序;派工类型是工艺路线的需要有顺序 */
@Excel(name = "顺序;派工类型是工艺路线的需要有顺序")
@Excel(name = "顺序")
private Long processOrder;
/** 上一工序ID */
@ -55,11 +55,11 @@ public class MesProductPlan extends BaseEntity
private Long lastProcessId;
/** 工位ID关联工位信息主键;根据选择的工序或者工艺路线拆分到工位上会拆分1到多条生产计划 */
@Excel(name = "工位ID,关联工位信息主键;根据选择的工序或者工艺路线拆分到工位上会拆分1到多条生产计划")
@Excel(name = "工位ID")
private Long stationId;
/** 用户ID关联sys_user主键;预留,暂时不用 */
@Excel(name = "用户ID关联sys_user主键;预留,暂时不用")
/** 用户ID*/
@Excel(name = "用户ID")
private Long userId;
/** 单位生产时间(单位s) */
@ -95,15 +95,15 @@ public class MesProductPlan extends BaseEntity
private Date realEndTime;
/** 附件信息,关联附件信息主键;多个用,隔开;页面可选择附件信息,也可直接上传 */
@Excel(name = "附件信息,关联附件信息主键;多个用,隔开;页面可选择附件信息,也可直接上传")
@Excel(name = "附件信息")
private String attachId;
/** 计划状态0-未派工1-已派工2-已开始 */
@Excel(name = "计划状态0-未派工1-已派工2-已开始3-已完成")
@Excel(name = "计划状态")
private String planStatus;
/** 是否标识1-是0-否 */
@Excel(name = "是否标识1-是0-否")
@Excel(name = "是否标识")
private String isFlag;
/**

@ -1,5 +1,6 @@
package com.hw.mes.mapper;
import java.util.HashMap;
import java.util.List;
import com.hw.mes.domain.MesBaseRoute;
import com.hw.mes.domain.MesBaseRouteProcess;
@ -84,4 +85,11 @@ public interface MesBaseRouteMapper
* @return
*/
public int deleteMesBaseRouteProcessByRouteId(Long routeId);
/**
* 线ID
* @param routeId
* @return
*/
List<HashMap<String, Object>> getStationByRouteId(Long routeId);
}

@ -1,5 +1,6 @@
package com.hw.mes.service;
import java.util.HashMap;
import java.util.List;
import com.hw.mes.domain.MesBaseRoute;
@ -58,4 +59,12 @@ public interface IMesBaseRouteService
* @return
*/
public int deleteMesBaseRouteByRouteId(Long routeId);
/**
* 线ID
* @param routeId
* @return
*/
List<HashMap<String, Object>> getStationByRouteId(Long routeId);
}

@ -67,4 +67,19 @@ public interface IMesProductPlanService
* @return
*/
public List<MesProductPlan> selectMesProductPlanJoinList(MesProductPlan mesProductPlan);
/**
*
*
* @return
*/
public String getDispatchCode();
/**
* List
*
* @param mesProductPlanList
* @return
*/
public int orderAddMesProductPlanList(List<MesProductPlan> mesProductPlanList);
}

@ -1,5 +1,6 @@
package com.hw.mes.service.impl;
import java.util.HashMap;
import java.util.List;
import com.hw.common.core.utils.DateUtils;
import com.hw.common.security.utils.SecurityUtils;
@ -136,4 +137,14 @@ public class MesBaseRouteServiceImpl implements IMesBaseRouteService
}
}
}
/**
* 线ID
* @param routeId
* @return
*/
@Override
public List<HashMap<String, Object>> getStationByRouteId(Long routeId) {
return mesBaseRouteMapper.getStationByRouteId(routeId);
}
}

@ -2,6 +2,7 @@ package com.hw.mes.service.impl;
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 org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -59,7 +60,9 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService
@Override
public int insertMesProductPlan(MesProductPlan mesProductPlan)
{
mesProductPlan.setCreateBy(SecurityUtils.getUsername());
mesProductPlan.setCreateTime(DateUtils.getNowDate());
mesProductPlan.setPlanCode(Seq.getId(Seq.planCodeSeqType, Seq.planCodeCode));
int rows = mesProductPlanMapper.insertMesProductPlan(mesProductPlan);
insertMesProductPlanDetail(mesProductPlan);
return rows;
@ -75,6 +78,7 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService
@Override
public int updateMesProductPlan(MesProductPlan mesProductPlan)
{
mesProductPlan.setUpdateBy(SecurityUtils.getUsername());
mesProductPlan.setUpdateTime(DateUtils.getNowDate());
mesProductPlanMapper.deleteMesProductPlanDetailByPlanId(mesProductPlan.getPlanId());
insertMesProductPlanDetail(mesProductPlan);
@ -133,11 +137,27 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService
}
}
/**
*
* @return
*/
@Override
public String getDispatchCode() {
return Seq.getId(Seq.dispatchCodeSeqType, Seq.dispatchCodeCode);
}
/**
* List
* @param mesProductPlanList
* @return
*/
@Override
public int orderAddMesProductPlanList(List<MesProductPlan> mesProductPlanList) {
for (MesProductPlan mesProductPlan : mesProductPlanList) {
this.insertMesProductPlan(mesProductPlan);
}
return 1;
}
/**
* Join product_orderbase_material

@ -124,4 +124,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
( #{item.routeProcessId}, #{item.routeId}, #{item.processId}, #{item.processOrder}, #{item.remark}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime})
</foreach>
</insert>
<select id="getStationByRouteId" parameterType="Long" resultType="java.util.HashMap">
select brp.process_id processId,
bpi.process_name processName,
brp.process_order processOrder,
bsi.station_id stationId,
bsi.station_name stationName,
bsi.production_time productionTime,
mf.multiStationFlag
from mes_base_route_process brp
left join mes_base_process_info bpi on bpi.process_id = brp.process_id
left join mes_base_station_info bsi on bsi.process_id = bpi.process_id
left join (select brp.process_id, count(*) multiStationFlag
from mes_base_route_process brp
left join mes_base_station_info bsi on bsi.process_id = brp.process_id
where brp.route_id = #{routeId}
group by brp.process_id) mf on mf.process_id = bsi.process_id
where brp.route_id = #{routeId}
order by brp.process_order
</select>
</mapper>

@ -33,77 +33,85 @@
<result property="updateTime" column="update_time"/>
<result property="saleOrderFlag" column="sale_order_flag"/>
<result property="planDeliveryDate" column="plan_delivery_date"/>
<result property="dispatchName" column="dispatchName"/>
<result property="materialCode" column="material_code"/>
<result property="materialName" column="material_name"/>
</resultMap>
<sql id="selectMesProductOrderVo">
select product_order_id,
order_code,
sale_order_id,
saleorder_code,
saleorder_linenumber,
project_no,
material_id,
material_bom_id,
dispatch_type,
dispatch_id,
sale_amount,
plan_amount,
dispatch_amount,
complete_amount,
release_time,
plan_begin_time,
plan_end_time,
real_begin_time,
real_end_time,
order_status,
stock_lock_flag,
sale_order_flag,
plan_delivery_date,
remark,
create_by,
create_time,
update_by,
update_time
from mes_product_order
select mpo.product_order_id,
mpo.order_code,
mpo.sale_order_id,
mpo.saleorder_code,
mpo.saleorder_linenumber,
mpo.project_no,
mpo.material_id,
mpo.material_bom_id,
mpo.dispatch_type,
mpo.dispatch_id,
mbr.route_name dispatchName,
bmi.material_code,
bmi.material_name,
mpo.sale_amount,
mpo.plan_amount,
mpo.dispatch_amount,
mpo.complete_amount,
mpo.release_time,
mpo.plan_begin_time,
mpo.plan_end_time,
mpo.real_begin_time,
mpo.real_end_time,
mpo.order_status,
mpo.stock_lock_flag,
mpo.sale_order_flag,
mpo.plan_delivery_date,
mpo.remark,
mpo.create_by,
mpo.create_time,
mpo.update_by,
mpo.update_time
from mes_product_order mpo
left join mes_base_route mbr on mbr.route_id = mpo.dispatch_id
left join mes_base_material_info bmi on bmi.material_id = mpo.material_id
</sql>
<select id="selectMesProductOrderList" parameterType="MesProductOrder" resultMap="MesProductOrderResult">
<include refid="selectMesProductOrderVo"/>
<where>
order_status not in ('9')
<if test="orderCode != null and orderCode != ''">and order_code = #{orderCode}</if>
<if test="saleOrderId != null ">and sale_order_id = #{saleOrderId}</if>
<if test="saleorderCode != null and saleorderCode != ''">and saleorder_code = #{saleorderCode}</if>
<if test="saleorderLinenumber != null and saleorderLinenumber != ''">and saleorder_linenumber =
mpo.order_status not in ('9')
<if test="orderCode != null and orderCode != ''">and mpo.order_code = #{orderCode}</if>
<if test="saleOrderId != null ">and mpo.sale_order_id = #{saleOrderId}</if>
<if test="saleorderCode != null and saleorderCode != ''">and mpo.saleorder_code = #{saleorderCode}</if>
<if test="saleorderLinenumber != null and saleorderLinenumber != ''">and mpo.saleorder_linenumber =
#{saleorderLinenumber}
</if>
<if test="projectNo != null and projectNo != ''">and project_no = #{projectNo}</if>
<if test="materialId != null ">and material_id = #{materialId}</if>
<if test="materialBomId != null ">and material_bom_id = #{materialBomId}</if>
<if test="dispatchType != null and dispatchType != ''">and dispatch_type = #{dispatchType}</if>
<if test="dispatchId != null ">and dispatch_id = #{dispatchId}</if>
<if test="saleAmount != null ">and sale_amount = #{saleAmount}</if>
<if test="planAmount != null ">and plan_amount = #{planAmount}</if>
<if test="dispatchAmount != null ">and dispatch_amount = #{dispatchAmount}</if>
<if test="completeAmount != null ">and complete_amount = #{completeAmount}</if>
<if test="releaseTime != null ">and release_time = #{releaseTime}</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="orderStatus != null and orderStatus != ''">and order_status = #{orderStatus}</if>
<if test="stockLockFlag != null and stockLockFlag != ''">and stock_lock_flag = #{stockLockFlag}</if>
<if test="saleOrderFlag != null and saleOrderFlag != ''">and sale_order_flag = #{saleOrderFlag}</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>
<if test="projectNo != null and projectNo != ''">and mpo.project_no = #{projectNo}</if>
<if test="materialId != null ">and mpo.material_id = #{materialId}</if>
<if test="materialBomId != null ">and mpo.material_bom_id = #{materialBomId}</if>
<if test="dispatchType != null and dispatchType != ''">and mpo.dispatch_type = #{dispatchType}</if>
<if test="dispatchId != null ">and mpo.dispatch_id = #{dispatchId}</if>
<if test="saleAmount != null ">and mpo.sale_amount = #{saleAmount}</if>
<if test="planAmount != null ">and mpo.plan_amount = #{planAmount}</if>
<if test="dispatchAmount != null ">and mpo.dispatch_amount = #{dispatchAmount}</if>
<if test="completeAmount != null ">and mpo.complete_amount = #{completeAmount}</if>
<if test="releaseTime != null ">and mpo.release_time = #{releaseTime}</if>
<if test="planBeginTime != null ">and mpo.plan_begin_time = #{planBeginTime}</if>
<if test="planEndTime != null ">and mpo.plan_end_time = #{planEndTime}</if>
<if test="realBeginTime != null ">and mpo.real_begin_time = #{realBeginTime}</if>
<if test="realEndTime != null ">and mpo.real_end_time = #{realEndTime}</if>
<if test="orderStatus != null and orderStatus != ''">and mpo.order_status = #{orderStatus}</if>
<if test="stockLockFlag != null and stockLockFlag != ''">and mpo.stock_lock_flag = #{stockLockFlag}</if>
<if test="saleOrderFlag != null and saleOrderFlag != ''">and mpo.sale_order_flag = #{saleOrderFlag}</if>
<if test="createBy != null and createBy != ''">and mpo.create_by = #{createBy}</if>
<if test="createTime != null ">and mpo.create_time = #{createTime}</if>
<if test="updateBy != null and updateBy != ''">and mpo.update_by = #{updateBy}</if>
<if test="updateTime != null ">and mpo.update_time = #{updateTime}</if>
</where>
</select>
<select id="selectMesProductOrderByProductOrderId" parameterType="Long" resultMap="MesProductOrderResult">
<include refid="selectMesProductOrderVo"/>
where product_order_id = #{productOrderId}
where mpo.product_order_id = #{productOrderId}
</select>
<insert id="insertMesProductOrder" parameterType="MesProductOrder" useGeneratedKeys="true"

@ -51,3 +51,11 @@ export function delBaseRoute(routeId) {
method: 'delete'
})
}
// 根据工艺路线ID查询工位信息
export function getStationByRouteId(routeId) {
return request({
url: '/mes/baseRoute/getStationByRouteId/' + routeId,
method: 'get'
})
}

@ -0,0 +1,61 @@
import request from '@/utils/request'
// 查询生产派工列表
export function listProductplan(query) {
return request({
url: '/mes/productplan/list',
method: 'get',
params: query
})
}
// 查询生产派工详细
export function getProductplan(planId) {
return request({
url: '/mes/productplan/' + planId,
method: 'get'
})
}
// 新增生产派工
export function addProductplan(data) {
return request({
url: '/mes/productplan',
method: 'post',
data: data
})
}
// 修改生产派工
export function updateProductplan(data) {
return request({
url: '/mes/productplan',
method: 'put',
data: data
})
}
// 删除生产派工
export function delProductplan(planId) {
return request({
url: '/mes/productplan/' + planId,
method: 'delete'
})
}
// 获取派工编号
export function getDispatchCode() {
return request({
url: '/mes/productplan/getDispatchCode',
method: 'get'
})
}
// 生产工单新增生产派工List
export function orderAddMesProductPlanList(data) {
return request({
url: '/mes/productplan/orderAddMesProductPlanList',
method: 'post',
data: data
})
}

@ -267,6 +267,20 @@ export const dynamicRoutes = [
},
],
},
{
path: '/mes/product-plan',
component: Layout,
hidden: true,
permissions: ['mes:productplan:edit'],
children: [
{
path: 'index/:productOrderId(\\d+)',
component: () => import('@/views/mes/productplan/editProductPlan'),
name: 'productPlanEdit',
meta: { title: '工单生产派工', activeMenu: '/mes/productplan' }
}
]
},
//查看工单路由,不可审批
{
path: "/dms/repairInstanceActivitySelect",

@ -774,9 +774,13 @@ export default {
/** 生产派工 */
handleDispatch(row) {
this.form.productOrderId = row.productOrderId;
const productOrderId = row.productOrderId || this.ids[0];
const orderCode = row.orderCode;
const params = { pageNum: this.queryParams.pageNum };
this.$tab.openPage("工单[" + orderCode + "]生产派工", '/mes/product-plan/index/' + productOrderId, params);
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {

@ -0,0 +1,278 @@
<template>
<el-card>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-divider content-position="left"><span style="font-weight: bold; font-size: larger;">工单信息</span></el-divider>
<el-row :gutter="10">
<el-col :span="12">
<el-form-item label="工单号:">{{ form.orderCode }}</el-form-item>
<el-form-item label="成品编码:">{{ form.materialCode }}</el-form-item>
<el-form-item label="计划开始时间:">{{ parseTime(form.planBeginTime) }}</el-form-item>
<el-form-item label="计划数量/已派工数量/完成数量:" label-width="220px">
{{ form.planAmount }}/{{ form.dispatchAmount }}/{{ form.completeAmount }}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="工艺路线:">{{ form.dispatchName }}</el-form-item>
<el-form-item label="成品名称:">{{ form.materialName }}</el-form-item>
<el-form-item label="计划结束时间:">{{ parseTime(form.planEndTime) }}</el-form-item>
</el-col>
</el-row>
<el-divider content-position="left"><span style="font-weight: bold; font-size: larger;">派工信息</span></el-divider>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAddMesProductPlan">
</el-button>
</el-col>
<!-- <el-col :span="1.5">-->
<!-- <el-button type="danger" icon="el-icon-delete" size="mini" @click="handleDeleteMesProductPlan">-->
<!-- </el-button>-->
<!-- </el-col>-->
</el-row>
<el-table :data="mesProductPlanlList" :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"/>
<el-table-column label="派工单号" align="center" prop="dispatchCode" width="190">
<template slot-scope="scope">
<el-input v-model="scope.row.dispatchCode" :disabled="true"/>
</template>
</el-table-column>
<el-table-column label="工序" align="center" prop="processName" width="140">
<template slot-scope="scope">
<el-input v-model="scope.row.processName" :disabled="true"/>
</template>
</el-table-column>
<el-table-column label="步骤" align="center" prop="processOrder" :disabled="true">
<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">
<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">
<template slot-scope="scope">
<el-input-number v-model="scope.row.planAmount"/>
</template>
</el-table-column>
<el-table-column label="派工标准工时" align="center" prop="productionTime" width="140">
<template slot-scope="scope">
<el-input-number v-model="scope.row.productionTime"/>
</template>
</el-table-column>
<el-table-column label="计划开始时间" align="center" prop="planBeginTime" width="240">
<template slot-scope="scope">
<el-date-picker clearable v-model="scope.row.planBeginTime" type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择计划开始时间"/>
</template>
</el-table-column>
<el-table-column label="计划完成时间" align="center" prop="planEndTime" width="240">
<template slot-scope="scope">
<el-date-picker clearable v-model="scope.row.planEndTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择计划完成时间"/>
</template>
</el-table-column>
<el-table-column label="状态" align="center" prop="planStatus" width="150">
<template slot-scope="scope">
<el-select v-model="scope.row.planStatus" placeholder="请选择状态" :disabled="true">
<el-option
v-for="dict in dict.type.product_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="50">
<template slot-scope="scope">
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="handleDrawing(scope.row)"
>图纸
</el-button>
</template>
</el-table-column>
</el-table>
</el-form>
<el-form label-width="100px">
<el-form-item style="text-align: center;margin-left:-100px;margin-top:10px;">
<el-button type="primary" @click="submitForm()"></el-button>
<el-button @click="close()"></el-button>
</el-form-item>
</el-form>
</el-card>
</template>
<script>
import {getProductOrder} from "@//api/mes/productOrder";
import {addProductplan, getDispatchCode, orderAddMesProductPlanList} from "@//api/mes/productplan";
import {getStationByRouteId} from "@//api/mes/baseRoute";
export default {
name: "productPlanEdit",
dicts: ['active_flag', 'product_status'],
data() {
return {
// name
activeName: "columnInfo",
//
tableHeight: document.documentElement.scrollHeight - 245 + "px",
//
tables: [],
//
columns: [],
//
productplanList: [],
//
mesProductPlanlList: [],
//
info: {},
//
form: {},
//
rules: {
productOrderId: [
{required: true, message: "生产工单ID不能为空", trigger: "blur"}
],
planCode: [
{required: true, message: "计划编号不能为空", trigger: "blur"}
],
dispatchCode: [
{required: true, message: "派工单号不能为空", trigger: "blur"}
],
materialId: [
{required: true, message: "物料ID不能为空", trigger: "blur"}
],
materialBomId: [
{required: true, message: "物料bomID不能为空", trigger: "blur"}
],
stationId: [
{required: true, message: "工位ID不能为空", trigger: "blur"}
],
planStatus: [
{required: true, message: "计划状态不能为空", trigger: "change"}
],
isFlag: [
{required: true, message: "是否标识不能为空", trigger: "change"}
],
},
};
},
created() {
const productOrderId = this.$route.params && this.$route.params.productOrderId;
if (productOrderId) {
//
getProductOrder(productOrderId).then(res => {
this.form = res.data;
});
}
},
methods: {
/** 提交按钮 */
submitForm() {
//
orderAddMesProductPlanList(this.mesProductPlanlList).then(res => {
this.$modal.msgSuccess(res.msg);
this.close();
});
},
/** 生产计划明细序号 */
rowMesProductPlanIndex({row, rowIndex}) {
row.index = rowIndex + 1;
},
/** 复选框选中数据 */
handleMesProductPlanSelectionChange(selection) {
this.checkedMesProductPlan = selection.map(item => item.index)
},
/** 关闭按钮 */
close() {
const obj = {path: "/mes/plan/productOrder", query: {t: Date.now(), pageNum: this.$route.query.pageNum}};
this.$tab.closeOpenPage(obj);
},
/** 查看图纸 */
handleDrawing(row) {
console.log(row)
},
/** 生产计划添加按钮操作 */
handleAddMesProductPlan() {
let dispatchCode = "";
getDispatchCode().then(res => {
dispatchCode = res.msg;
getStationByRouteId(this.form.dispatchId).then(res => {
if (res.data.length === 0) {
this.$modal.msgError("工艺路线未维护工位信息!");
}
let lastProcessId = null;
res.data.forEach(e => {
let obj = {};
obj.dispatchCode = dispatchCode;
obj.processId = e.processId;
obj.processName = e.processName;
obj.processOrder = e.processOrder;
obj.stationId = e.stationId;
obj.stationName = e.stationName;
obj.productionTime = 0;
obj.planBeginTime = this.form.planBeginTime;
obj.planEndTime = this.form.planEndTime;
obj.planStatus = '0';
// multiStationFlag
if (e.multiStationFlag > 1) {
obj.planAmount = 0;
} else {
obj.planAmount = this.form.planAmount;
}
obj.materialId = this.form.materialId;
obj.materialBomId = this.form.materialBomId;
obj.productOrderId = this.form.productOrderId;
// ID
if (lastProcessId == null || lastProcessId === obj.lastProcessId) {
obj.lastProcessId = 0;
} else {
obj.lastProcessId = lastProcessId;
}
lastProcessId = e.processId;
this.mesProductPlanlList.push(obj);
})
})
})
},
/** 生产计划明细删除按钮操作 */
handleDeleteMesProductPlan() {
if (this.checkedMesProductPlan.length == 0) {
this.$modal.msgError("请先选择要删除的生产计划明细数据");
} else {
const mesProductPlanlList = this.mesProductPlanlList;
const checkedMesProductPlan = this.checkedMesProductPlan;
this.mesProductPlanlList = mesProductPlanlList.filter(function (item) {
return checkedMesProductPlan.indexOf(item.index) == -1
});
}
},
},
mounted() {
const el = this.$refs.dragTable.$el.querySelectorAll(".el-table__body-wrapper > table > tbody")[0];
// const sortable = Sortable.create(el, {
// handle: ".allowDrag",
// onEnd: evt => {
// const targetRow = this.columns.splice(evt.oldIndex, 1)[0];
// this.columns.splice(evt.newIndex, 0, targetRow);
// for (let index in this.columns) {
// this.columns[index].sort = parseInt(index) + 1;
// }
// }
// });
}
};
</script>

@ -0,0 +1,625 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="计划编号" prop="planCode">
<el-input
v-model="queryParams.planCode"
placeholder="请输入计划编号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="派工单号" prop="dispatchCode">
<el-input
v-model="queryParams.dispatchCode"
placeholder="请输入派工单号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="工位ID" prop="stationId">
<el-input
v-model="queryParams.stationId"
placeholder="请输入工位ID"
clearable
@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="planStatus">
<el-select v-model="queryParams.planStatus" placeholder="请选择计划状态" clearable>
<el-option
v-for="dict in dict.type.product_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['mes: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"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['mes:productplan:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
</el-row>
<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="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="用户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"/>
<el-table-column label="完成数量" align="center" prop="completeAmount" v-if="columns[13].visible"/>
<el-table-column label="计划开始时间" align="center" prop="planBeginTime" width="180" v-if="columns[14].visible">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.planBeginTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="计划结束时间" align="center" prop="planEndTime" width="180" v-if="columns[15].visible">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.planEndTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="实际开始时间" align="center" prop="realBeginTime" width="180" v-if="columns[16].visible">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.realBeginTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="实际完成时间" align="center" prop="realEndTime" width="180" v-if="columns[17].visible">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.realEndTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="附件信息" align="center" prop="attachId" v-if="columns[18].visible"/>
<el-table-column label="计划状态" align="center" prop="planStatus" v-if="columns[19].visible" >
<template slot-scope="scope">
<dict-tag :options="dict.type.product_status" :value="scope.row.planStatus"/>
</template>
</el-table-column>
<el-table-column label="是否标识" align="center" prop="isFlag" v-if="columns[20].visible" >
<template slot-scope="scope">
<dict-tag :options="dict.type.active_flag" :value="scope.row.isFlag"/>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" v-if="columns[21].visible"/>
<el-table-column label="创建人" align="center" prop="createBy" v-if="columns[22].visible"/>
<el-table-column label="创建时间" align="center" prop="createTime" width="180" v-if="columns[23].visible">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="更新人" align="center" prop="updateBy" v-if="columns[24].visible"/>
<el-table-column label="更新时间" align="center" prop="updateTime" width="180" v-if="columns[25].visible">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['mes:productplan:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['mes:productplan:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改生产派工对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="生产工单ID" prop="productOrderId">
<el-input v-model="form.productOrderId" placeholder="请输入生产工单ID" />
</el-form-item>
<el-form-item label="计划编号" prop="planCode">
<el-input v-model="form.planCode" placeholder="请输入计划编号" />
</el-form-item>
<el-form-item label="派工单号" prop="dispatchCode">
<el-input v-model="form.dispatchCode" placeholder="请输入派工单号" />
</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="物料bomID" prop="materialBomId">
<el-input v-model="form.materialBomId" placeholder="请输入物料bomID" />
</el-form-item>
<el-form-item label="工序ID" prop="processId">
<el-input v-model="form.processId" placeholder="请输入工序ID" />
</el-form-item>
<el-form-item label="顺序" prop="processOrder">
<el-input v-model="form.processOrder" placeholder="请输入顺序" />
</el-form-item>
<el-form-item label="上一工序ID" prop="lastProcessId">
<el-input v-model="form.lastProcessId" placeholder="请输入上一工序ID" />
</el-form-item>
<el-form-item label="工位ID" prop="stationId">
<el-input v-model="form.stationId" placeholder="请输入工位ID" />
</el-form-item>
<el-form-item label="用户ID" prop="userId">
<el-input v-model="form.userId" placeholder="请输入用户ID" />
</el-form-item>
<el-form-item label="标准工时" prop="productionTime">
<el-input v-model="form.productionTime" placeholder="请输入标准工时" />
</el-form-item>
<el-form-item label="计划数量" prop="planAmount">
<el-input v-model="form.planAmount" placeholder="请输入计划数量" />
</el-form-item>
<el-form-item label="完成数量" prop="completeAmount">
<el-input v-model="form.completeAmount" placeholder="请输入完成数量" />
</el-form-item>
<el-form-item label="计划开始时间" prop="planBeginTime">
<el-date-picker clearable
v-model="form.planBeginTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择计划开始时间">
</el-date-picker>
</el-form-item>
<el-form-item label="计划结束时间" prop="planEndTime">
<el-date-picker clearable
v-model="form.planEndTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择计划结束时间">
</el-date-picker>
</el-form-item>
<el-form-item label="实际开始时间" prop="realBeginTime">
<el-date-picker clearable
v-model="form.realBeginTime"
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="form.realEndTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择实际完成时间">
</el-date-picker>
</el-form-item>
<el-form-item label="附件信息" prop="attachId">
<el-input v-model="form.attachId" placeholder="请输入附件信息" />
</el-form-item>
<el-form-item label="计划状态" prop="planStatus">
<el-select v-model="form.planStatus" placeholder="请选择计划状态">
<el-option
v-for="dict in dict.type.product_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="是否标识" prop="isFlag">
<el-radio-group v-model="form.isFlag">
<el-radio
v-for="dict in dict.type.active_flag"
:key="dict.value"
:label="dict.value"
>{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</el-form-item>
<!-- <el-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="handleAddMesProductPlanDetail"></el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<!-- <el-button type="danger" icon="el-icon-delete" size="mini" @click="handleDeleteMesProductPlanDetail"></el-button>-->
<!-- </el-col>-->
<!-- </el-row>-->
<!-- <el-table :data="mesProductPlanDetailList" :row-class-name="rowMesProductPlanDetailIndex" @selection-change="handleMesProductPlanDetailSelectionChange" ref="mesProductPlanDetail">-->
<!-- <el-table-column type="selection" width="50" align="center" />-->
<!-- <el-table-column label="序号" align="center" prop="index" width="50"/>-->
<!-- <el-table-column label="明细编号" prop="planDetailCode" width="150">-->
<!-- <template slot-scope="scope">-->
<!-- <el-input v-model="scope.row.planDetailCode" placeholder="请输入明细编号" />-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column label="计划编号,关联mes_product_plan_info的plan_code" prop="planCode" width="150">-->
<!-- <template slot-scope="scope">-->
<!-- <el-input v-model="scope.row.planCode" placeholder="请输入计划编号,关联mes_product_plan_info的plan_code" />-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column label="操作人员ID关联sys_user的user_id;如果后续一个工位有多个人,则一个明细有多个人执行,则可以保存执行记录信息,需要新增表" prop="userId" width="150">-->
<!-- <template slot-scope="scope">-->
<!-- <el-input v-model="scope.row.userId" placeholder="请输入操作人员ID关联sys_user的user_id;如果后续一个工位有多个人,则一个明细有多个人执行,则可以保存执行记录信息,需要新增表" />-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column label="操作人员名称关联sys_user的user_name" prop="userName" width="150">-->
<!-- <template slot-scope="scope">-->
<!-- <el-input v-model="scope.row.userName" placeholder="请输入操作人员名称关联sys_user的user_name" />-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column label="开始时间" prop="realBeginTime" width="240">-->
<!-- <template slot-scope="scope">-->
<!-- <el-date-picker clearable v-model="scope.row.realBeginTime" type="date" value-format="yyyy-MM-dd" placeholder="请选择开始时间" />-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column label="完成时间" prop="realEndTime" width="240">-->
<!-- <template slot-scope="scope">-->
<!-- <el-date-picker clearable v-model="scope.row.realEndTime" type="date" value-format="yyyy-MM-dd" placeholder="请选择完成时间" />-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column label="明细状态1-未开始2-已开始3-已完成" prop="planDetailStatus" width="150">-->
<!-- <template slot-scope="scope">-->
<!-- <el-select v-model="scope.row.planDetailStatus" placeholder="请选择明细状态1-未开始2-已开始3-已完成">-->
<!-- <el-option label="请选择字典生成" value="" />-->
<!-- </el-select>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column label="是否标识1-是0-否" prop="isFlag" width="150">-->
<!-- <template slot-scope="scope">-->
<!-- <el-input v-model="scope.row.isFlag" placeholder="请输入是否标识1-是0-否" />-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- </el-table>-->
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listProductplan, getProductplan, delProductplan, addProductplan, updateProductplan } from "@/api/mes/productplan";
export default {
name: "Productplan",
dicts: ['active_flag', 'product_status', 'plan_status', 'dispatch_type'],
data() {
return {
//
loading: true,
//
ids: [],
//
checkedMesProductPlanDetail: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
productplanList: [],
//
mesProductPlanDetailList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
productOrderId: null,
planCode: null,
dispatchCode: null,
materialId: null,
materialBomId: null,
processId: null,
processOrder: null,
lastProcessId: null,
stationId: null,
userId: null,
productionTime: null,
planAmount: null,
completeAmount: null,
planBeginTime: null,
planEndTime: null,
realBeginTime: null,
realEndTime: null,
attachId: null,
planStatus: null,
isFlag: null,
remark: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
},
//
form: {},
//
rules: {
productOrderId: [
{ required: true, message: "生产工单ID不能为空", trigger: "blur" }
],
planCode: [
{ required: true, message: "计划编号不能为空", trigger: "blur" }
],
dispatchCode: [
{ required: true, message: "派工单号不能为空", trigger: "blur" }
],
materialId: [
{ required: true, message: "物料ID不能为空", trigger: "blur" }
],
materialBomId: [
{ required: true, message: "物料bomID不能为空", trigger: "blur" }
],
stationId: [
{ required: true, message: "工位ID不能为空", trigger: "blur" }
],
planStatus: [
{ required: true, message: "计划状态不能为空", trigger: "change" }
],
isFlag: [
{ required: true, message: "是否标识不能为空", trigger: "change" }
],
},
columns: [
{ key: 0, label: `主键标识`, visible: true },
{ key: 1, label: `生产工单ID`, 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: 7, label: `顺序`, visible: true },
{ key: 8, label: `上一工序ID`, visible: true },
{ key: 9, label: `工位ID`, visible: true },
{ key: 10, label: `用户ID`, visible: true },
{ key: 11, label: `标准工时`, visible: true },
{ key: 12, label: `计划数量`, visible: true },
{ key: 13, label: `完成数量`, visible: true },
{ key: 14, label: `计划开始时间`, visible: true },
{ key: 15, label: `计划结束时间`, visible: true },
{ key: 16, label: `实际开始时间`, visible: true },
{ 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: 23, label: `创建时间`, visible: true },
{ key: 24, label: `更新人`, visible: true },
{ key: 25, label: `更新时间`, visible: true },
],
};
},
created() {
this.getList();
},
methods: {
/** 查询生产派工列表 */
getList() {
this.loading = true;
listProductplan(this.queryParams).then(response => {
this.productplanList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
planId: null,
productOrderId: null,
planCode: null,
dispatchCode: null,
materialId: null,
materialBomId: null,
processId: null,
processOrder: null,
lastProcessId: null,
stationId: null,
userId: null,
productionTime: null,
planAmount: null,
completeAmount: null,
planBeginTime: null,
planEndTime: null,
realBeginTime: null,
realEndTime: null,
attachId: null,
planStatus: null,
isFlag: null,
remark: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.mesProductPlanDetailList = [];
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.planId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加生产派工";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const planId = row.planId || this.ids
getProductplan(planId).then(response => {
this.form = response.data;
this.mesProductPlanDetailList = response.data.mesProductPlanDetailList;
this.open = true;
this.title = "修改生产派工";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
this.form.mesProductPlanDetailList = this.mesProductPlanDetailList;
if (this.form.planId != null) {
updateProductplan(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addProductplan(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const planIds = row.planId || this.ids;
this.$modal.confirm('是否确认删除生产派工编号为"' + planIds + '"的数据项?').then(function() {
return delProductplan(planIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 生产计划明细序号 */
rowMesProductPlanDetailIndex({ row, rowIndex }) {
row.index = rowIndex + 1;
},
/** 生产计划明细添加按钮操作 */
handleAddMesProductPlanDetail() {
let obj = {};
obj.planDetailCode = "";
obj.planCode = "";
obj.userId = "";
obj.userName = "";
obj.realBeginTime = "";
obj.realEndTime = "";
obj.planDetailStatus = "";
obj.isFlag = "";
obj.remark = "";
this.mesProductPlanDetailList.push(obj);
},
/** 生产计划明细删除按钮操作 */
handleDeleteMesProductPlanDetail() {
if (this.checkedMesProductPlanDetail.length == 0) {
this.$modal.msgError("请先选择要删除的生产计划明细数据");
} else {
const mesProductPlanDetailList = this.mesProductPlanDetailList;
const checkedMesProductPlanDetail = this.checkedMesProductPlanDetail;
this.mesProductPlanDetailList = mesProductPlanDetailList.filter(function(item) {
return checkedMesProductPlanDetail.indexOf(item.index) == -1
});
}
},
/** 复选框选中数据 */
handleMesProductPlanDetailSelectionChange(selection) {
this.checkedMesProductPlanDetail = selection.map(item => item.index)
},
/** 导出按钮操作 */
handleExport() {
this.download('mes/productplan/export', {
...this.queryParams
}, `productplan_${new Date().getTime()}.xlsx`)
}
}
};
</script>
Loading…
Cancel
Save