change - 生产工单:查询、撤回、发布、销售订单新增、无销售订单新增、修改

master
yinq 9 months ago
parent 9c81a45837
commit 9159849178

@ -1,9 +1,9 @@
package com.hw.mes.controller;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import com.hw.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
@ -74,6 +74,7 @@ public class MesProductOrderController extends BaseController {
@Log(title = "生产工单", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody MesProductOrder mesProductOrder) {
mesProductOrder.setCreateBy(SecurityUtils.getLoginUser().getUsername());
return toAjax(mesProductOrderService.insertMesProductOrder(mesProductOrder));
}
@ -84,6 +85,7 @@ public class MesProductOrderController extends BaseController {
@Log(title = "生产工单", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody MesProductOrder mesProductOrder) {
mesProductOrder.setUpdateBy(SecurityUtils.getLoginUser().getUsername());
return toAjax(mesProductOrderService.updateMesProductOrder(mesProductOrder));
}
@ -115,15 +117,6 @@ public class MesProductOrderController extends BaseController {
return toAjax(mesProductOrderService.productOrderPublish(mesProductOrder));
}
/**
*
*/
@Log(title = "生产工单", businessType = BusinessType.UPDATE)
@PostMapping("/productOrderRecall")
public AjaxResult productOrderRecall(@RequestBody MesProductOrder mesProductOrder) {
return toAjax(mesProductOrderService.productOrderRecall(mesProductOrder));
}
/**
*
*
@ -134,4 +127,14 @@ public class MesProductOrderController extends BaseController {
return success(mesProductOrderService.getOrderCode());
}
/**
* BOM
*
* @return materialBomId
*/
@GetMapping(value = "/VerifyBOMIsProduction/{materialBomId}")
public AjaxResult verifyBOMIsProduction(@PathVariable Long materialBomId) {
return success(mesProductOrderService.verifyBOMIsProduction(materialBomId));
}
}

@ -4,6 +4,7 @@ import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import com.hw.mes.domain.MesProductOrder;
import com.hw.mes.service.IMesProductOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@ -149,4 +150,13 @@ public class MesProductPlanController extends BaseController
return success(mesProductPlanService.getDispatchDrawingList(planId));
}
/**
*
*/
@Log(title = "生产工单", businessType = BusinessType.UPDATE)
@PostMapping("/productOrderRecall")
public AjaxResult productOrderRecall(@RequestBody MesProductOrder mesProductOrder) {
return toAjax(mesProductPlanService.productOrderRecall(mesProductOrder));
}
}

@ -65,6 +65,12 @@ public class MesProductOrder extends BaseEntity {
@Excel(name = "物料bomID")
private Long materialBomId;
/**
* BOM
*/
@Excel(name = "BOM说明")
private String materialBomDesc;
/**
* (1线 2线)
*/
@ -179,6 +185,13 @@ public class MesProductOrder extends BaseEntity {
@Excel(name = "物料名称")
private String materialName;
public String getMaterialBomDesc() {
return materialBomDesc;
}
public void setMaterialBomDesc(String materialBomDesc) {
this.materialBomDesc = materialBomDesc;
}
public String getDispatchName() {
return dispatchName;

@ -81,12 +81,12 @@ public interface IMesProductOrderService
*/
public int productOrderPublish(MesProductOrder mesProductOrder);
/**
*
*
* @param mesProductOrder
* @return
* BOM
* @param materialBomId
* @return
*/
public int productOrderRecall(MesProductOrder mesProductOrder);
public Boolean verifyBOMIsProduction(Long materialBomId);
}

@ -3,6 +3,7 @@ package com.hw.mes.service;
import java.util.List;
import com.hw.mes.domain.MesBaseAttachInfo;
import com.hw.mes.domain.MesProductOrder;
import com.hw.mes.domain.MesProductPlan;
/**
@ -92,4 +93,12 @@ public interface IMesProductPlanService
*/
public List<MesBaseAttachInfo> getDispatchDrawingList(Long planId);
/**
*
*
* @param mesProductOrder
* @return
*/
public int productOrderRecall(MesProductOrder mesProductOrder);
}

@ -71,6 +71,10 @@ public class MesProductOrderServiceImpl implements IMesProductOrderService {
*/
@Override
public int updateMesProductOrder(MesProductOrder mesProductOrder) {
//销售订单修改工单:校验是否超出销售数量
if (mesProductOrder.getSaleOrderFlag().equals("1") && StringUtils.isNotNull(mesProductOrder.getSaleOrderId())) {
checkSalesQuantity(mesProductOrder);
}
mesProductOrder.setUpdateTime(DateUtils.getNowDate());
return mesProductOrderMapper.updateMesProductOrder(mesProductOrder);
}
@ -131,14 +135,14 @@ public class MesProductOrderServiceImpl implements IMesProductOrderService {
BigDecimal sumDecimal = new BigDecimal(0);
if (StringUtils.isNotNull(mesProductOrders)) {
for (MesProductOrder order : mesProductOrders) {
if (!order.getOrderStatus().equals(MesConstants.RECALL)){
if (!order.getOrderStatus().equals(MesConstants.RECALL) && !order.getProductOrderId().equals(mesProductOrder.getProductOrderId())) {
sumDecimal = sumDecimal.add(order.getPlanAmount());
}
}
}
sumDecimal = sumDecimal.add(mesProductOrder.getPlanAmount());
if (mesProductOrder.getSaleAmount().compareTo(sumDecimal) < 0) {
throw new ServiceException("当前工单计划数量为:" + sumDecimal.longValue() + ",超出该订单销售数量!");
throw new ServiceException("当前生产工单计划数量为:" + sumDecimal.longValue() + ",超出该销售订单销售数量!");
}
}
@ -154,7 +158,7 @@ public class MesProductOrderServiceImpl implements IMesProductOrderService {
if (productOrder.getStockLockFlag().equals("1")) {
throw new ServiceException("该工单库存已锁定!");
}
if (!mesProductOrder.getOrderStatus().equals(MesConstants.UN_PUBLISH)){
if (!mesProductOrder.getOrderStatus().equals(MesConstants.UN_PUBLISH)) {
throw new ServiceException("该生产工单不是未发布状态!");
}
// 调用仓库接口锁定库存
@ -164,31 +168,33 @@ public class MesProductOrderServiceImpl implements IMesProductOrderService {
/**
*
*
* @param mesProductOrder
* @return
*/
@Override
public int productOrderPublish(MesProductOrder mesProductOrder) {
if (!mesProductOrder.getOrderStatus().equals(MesConstants.UN_PUBLISH)){
if (!mesProductOrder.getOrderStatus().equals(MesConstants.UN_PUBLISH)) {
throw new ServiceException("该生产工单不是未发布状态!");
}
mesProductOrder.setOrderStatus(MesConstants.PUBLISHED);
mesProductOrder.setReleaseTime(DateUtils.getNowDate());
return this.updateMesProductOrder(mesProductOrder);
MesProductOrder productOrder = new MesProductOrder();
productOrder.setProductOrderId(mesProductOrder.getProductOrderId());
productOrder.setOrderStatus(MesConstants.PUBLISHED);
productOrder.setReleaseTime(DateUtils.getNowDate());
return this.updateMesProductOrder(productOrder);
}
/**
*
* @param mesProductOrder
* BOM
*
* @param materialBomId BOM
* @return
*/
@Override
public int productOrderRecall(MesProductOrder mesProductOrder) {
// 检验生产派工未下达状态的可进行工单撤回
mesProductOrder.setOrderStatus(MesConstants.RECALL);
// 调用仓库接口取消锁定库存
mesProductOrder.setStockLockFlag("0");
return mesProductOrderMapper.updateMesProductOrder(mesProductOrder);
public Boolean verifyBOMIsProduction(Long materialBomId) {
//查询顶级BOM
//通过顶级BOM主键查询生产工单
return null;
}
}

@ -3,6 +3,8 @@ package com.hw.mes.service.impl;
import java.util.Arrays;
import java.util.List;
import com.hw.common.core.constant.MesConstants;
import com.hw.common.core.exception.ServiceException;
import com.hw.common.core.utils.DateUtils;
import com.hw.common.core.utils.uuid.Seq;
import com.hw.common.security.utils.SecurityUtils;
@ -192,6 +194,30 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService {
}
}
/**
*
*
* @param mesProductOrder
* @return
*/
@Override
public int productOrderRecall(MesProductOrder mesProductOrder) {
// 检验生产派工未下达状态的可进行工单撤回
MesProductPlan mesProductPlan = new MesProductPlan();
mesProductPlan.setProductOrderId(mesProductOrder.getProductOrderId());
List<MesProductPlan> mesProductPlans = mesProductPlanMapper.selectMesProductPlanList(mesProductPlan);
for (MesProductPlan productPlan : mesProductPlans) {
if (!productPlan.getPlanStatus().equals(MesConstants.MES_PRODUCT_PLAN_STATUS_TO_DISPATCH)
|| !productPlan.getPlanStatus().equals(MesConstants.MES_PRODUCT_PLAN_STATUS_FINISH)) {
throw new ServiceException("此工单已派工,无法撤回!");
}
}
mesProductOrder.setOrderStatus(MesConstants.RECALL);
// 调用仓库接口取消锁定库存
mesProductOrder.setStockLockFlag("0");
return mesProductOrderService.updateMesProductOrder(mesProductOrder);
}
/**
* Join product_orderbase_material
*

@ -36,6 +36,7 @@
<result property="dispatchName" column="dispatchName"/>
<result property="materialCode" column="material_code"/>
<result property="materialName" column="material_name"/>
<result property="materialBomDesc" column="material_bom_desc"/>
</resultMap>
<sql id="selectMesProductOrderVo">
@ -47,9 +48,10 @@
mpo.project_no,
mpo.material_id,
mpo.material_bom_id,
concat(mb.material_name, '-', mb.material_bom_desc) material_bom_desc,
mpo.dispatch_type,
mpo.dispatch_id,
mbr.route_name dispatchName,
mbr.route_name dispatchName,
bmi.material_code,
bmi.material_name,
mpo.sale_amount,
@ -73,6 +75,7 @@
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
left join mes_material_bom mb on mb.material_bom_id = mpo.material_bom_id
</sql>
<select id="selectMesProductOrderList" parameterType="MesProductOrder" resultMap="MesProductOrderResult">
@ -107,6 +110,7 @@
<if test="updateBy != null and updateBy != ''">and mpo.update_by = #{updateBy}</if>
<if test="updateTime != null ">and mpo.update_time = #{updateTime}</if>
</where>
order by mpo.sale_order_id desc, mpo.product_order_id desc
</select>
<select id="selectMesProductOrderByProductOrderId" parameterType="Long" resultMap="MesProductOrderResult">

@ -1,7 +1,7 @@
<?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">
@ -36,61 +36,100 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="planDeliveryDate" column="plan_delivery_date"/>
<result property="materialCode" column="material_code" />
<result property="materialCode" column="material_code"/>
<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>
</select>
@ -258,33 +297,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</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_code,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>

@ -64,7 +64,7 @@ export function productOrderPublish(data) {
//撤回
export function productOrderRecall(data) {
return request({
url: '/mes/productOrder/productOrderRecall',
url: '/mes/productplan/productOrderRecall',
method: 'post',
data: data
})

@ -49,7 +49,7 @@
@row-click="handleRowClick"
highlight-current-row
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column type="selection" width="55" align="center" v-if="false" />
<el-table-column label="物料编码" align="center" prop="materialCode" />
<el-table-column label="物料名称" align="center" prop="materialName" />
<el-table-column label="物料大类" align="center" prop="materialCategories" />

@ -108,7 +108,7 @@
@row-click="handleRowClick"
highlight-current-row
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column type="selection" width="55" align="center" v-if="false"/>
<el-table-column label="主键标识" align="center" prop="saleOrderId" v-if="columns[0].visible"/>
<el-table-column label="ERP主键" align="center" prop="erpId" v-if="columns[1].visible"/>
<el-table-column label="ERP订单明细ID" align="center" prop="fentryId" v-if="columns[2].visible"/>

@ -85,16 +85,16 @@
</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:productOrder:edit']"
>修改
</el-button>
<!-- <el-button-->
<!-- type="success"-->
<!-- plain-->
<!-- icon="el-icon-edit"-->
<!-- size="mini"-->
<!-- :disabled="single"-->
<!-- @click="handleUpdate"-->
<!-- v-hasPermi="['mes:productOrder:edit']"-->
<!-- >修改工单-->
<!-- </el-button>-->
</el-col>
<el-col :span="1.5">
<el-button
@ -108,17 +108,17 @@
>删除
</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:productOrder:export']"
>导出
</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:productOrder:export']"-->
<!-- >导出-->
<!-- </el-button>-->
<!-- </el-col>-->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
</el-row>
@ -128,10 +128,10 @@
<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="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="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="materialName" v-if="columns[6].visible" width="100"/>
<el-table-column label="物料BOM" align="center" prop="materialBomDesc" v-if="columns[7].visible" width="120"/>
<el-table-column label="派工类型" align="center" prop="dispatchType" v-if="columns[8].visible">
<template slot-scope="scope">
<dict-tag :options="dict.type.dispatch_type" :value="scope.row.dispatchType"/>
@ -142,6 +142,11 @@
<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="completeAmount" v-if="columns[13].visible"/>
<el-table-column label="工单状态" align="center" prop="orderStatus" v-if="columns[19].visible">
<template slot-scope="scope">
<dict-tag :options="dict.type.plan_status" :value="scope.row.orderStatus"/>
</template>
</el-table-column>
<el-table-column label="发布时间" align="center" prop="releaseTime" width="180" v-if="columns[14].visible">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.releaseTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
@ -172,11 +177,6 @@
<span>{{ parseTime(scope.row.realEndTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="工单状态" align="center" prop="orderStatus" v-if="columns[19].visible">
<template slot-scope="scope">
<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" width="100">
<template slot-scope="scope">
<dict-tag :options="dict.type.active_flag" :value="scope.row.stockLockFlag"/>
@ -197,13 +197,15 @@
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="150" fixed="right">
<template slot-scope="scope">
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-edit"-->
<!-- @click="handleUpdate(scope.row)"-->
<!-- v-hasPermi="['mes:productOrder:edit']"-->
<!-- >修改</el-button>-->
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-if="scope.row.orderStatus === '0'"
v-hasPermi="['mes:productOrder:edit']"
>修改工单
</el-button>
<el-button
size="mini"
type="text"
@ -216,6 +218,7 @@
type="text"
icon="el-icon-success"
@click="handlePublish(scope.row)"
v-if="scope.row.orderStatus === '0'"
>发布
</el-button>
<el-button
@ -223,6 +226,7 @@
type="text"
icon="el-icon-d-arrow-left"
@click="handleRecall(scope.row)"
v-if="scope.row.orderStatus === '1'"
>撤回
</el-button>
<el-button
@ -230,15 +234,9 @@
type="text"
icon="el-icon-right"
@click="handleDispatch(scope.row)"
v-if="scope.row.orderStatus === '1' || scope.row.orderStatus === '3'"
>生产派工
</el-button>
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-delete"-->
<!-- @click="handleDelete(scope.row)"-->
<!-- v-hasPermi="['mes:productOrder:remove']"-->
<!-- >删除</el-button>-->
</template>
</el-table-column>
</el-table>
@ -459,6 +457,8 @@ export default {
loading: true,
//
ids: [],
// orderCode
orderCodes: [],
//
single: true,
//
@ -526,7 +526,7 @@ export default {
{required: true, message: "物料ID不能为空", trigger: "blur"}
],
materialBomId: [
{required: true, message: "物料bomID不能为空", trigger: "blur"}
{required: true, message: "物料BOM不能为空", trigger: "blur"}
],
dispatchType: [
{required: true, message: "派工类型不能为空", trigger: "change"}
@ -546,7 +546,7 @@ export default {
saleAmount: [
{required: true, message: "销售数量不能为空", trigger: "blur"},
{
validator: (rule, value, callback) => callback(Number.isInteger(Number(value)) && Number(value) >= 1 ? undefined : new Error("销售数量需要是大于等于1的整数")),
validator: (rule, value, callback) => callback(Number.isInteger(Number(value)) && Number(value) >= 0 ? undefined : new Error("销售数量需要是大于等于0的整数")),
trigger: "blur"
}
],
@ -563,11 +563,11 @@ export default {
{key: 1, label: `工单编号`, visible: true},
{key: 2, label: `销售订单ID`, visible: false},
{key: 3, label: `销售订单编号`, visible: true},
{key: 4, label: `销售订单行号`, visible: true},
{key: 5, label: `项目编号`, visible: true},
{key: 4, label: `销售订单行号`, visible: false},
{key: 5, label: `项目编号`, visible: false},
{key: 6, label: `物料名称`, visible: true},
{key: 7, label: `物料bomID`, visible: true},
{key: 8, label: `派工类型`, visible: true},
{key: 8, label: `派工类型`, visible: false},
{key: 9, label: `工艺路线`, visible: true},
{key: 10, label: `销售数量`, visible: true},
{key: 11, label: `计划数量`, visible: true},
@ -580,7 +580,7 @@ export default {
{key: 18, label: `完成时间`, visible: true},
{key: 19, label: `工单状态`, visible: true},
{key: 20, label: `库存锁定标识`, visible: true},
{key: 21, label: `备注`, visible: true},
{key: 21, label: `备注`, visible: false},
{key: 22, label: `创建人`, visible: false},
{key: 23, label: `创建时间`, visible: false},
{key: 24, label: `更新人`, visible: false},
@ -666,6 +666,7 @@ export default {
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.productOrderId)
this.orderCodes = selection.map(item => item.orderCode)
this.single = selection.length !== 1
this.multiple = !selection.length
},
@ -745,11 +746,22 @@ export default {
},
/** 修改按钮操作 */
handleUpdate(row) {
console.log(row)
if (row.orderStatus !== '0') {
return this.$modal.msgError("该订单状态无法修改!");
}
this.reset();
const productOrderId = row.productOrderId || this.ids
getProductOrder(productOrderId).then(response => {
this.form = response.data;
this.open = true;
getMaterialVisionList(response.data.materialId).then(response => {
this.materialBomList = response.data
})
if (response.data.saleOrderId === null) {
this.noOrderOpen = true;
} else {
this.open = true;
}
this.title = "修改生产工单";
});
},
@ -768,18 +780,29 @@ export default {
handlePublish(row) {
this.form.productOrderId = row.productOrderId;
this.form.orderStatus = row.orderStatus;
productOrderPublish(this.form).then(response => {
this.$modal.msgSuccess("发布成功");
this.getList();
this.$modal.confirm('是否确认发布生产工单编号为"' + row.orderCode + '"的数据项?').then(function () {
return true;
}).then(() => {
productOrderPublish(this.form).then(response => {
this.$modal.msgSuccess("发布成功");
this.getList();
this.$router.push("/mes/plan/productplan");
});
}).catch(() => {
});
},
/** 撤回 */
handleRecall(row) {
this.form.productOrderId = row.productOrderId;
productOrderRecall(this.form).then(response => {
this.$modal.msgSuccess("撤回成功");
this.getList();
this.$modal.confirm('是否确认撤回生产工单编号为"' + row.orderCode + '"的数据项?').then(function () {
return true;
}).then(() => {
productOrderRecall(this.form).then(response => {
this.getList();
this.$modal.msgSuccess("撤回成功");
});
}).catch(() => {
});
},
@ -791,11 +814,13 @@ export default {
this.$tab.openPage("工单[" + orderCode + "]生产派工", '/mes/product-plan/index/' + productOrderId, params);
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.saleAmount < this.form.planAmount) {
return this.$modal.msgError("计划数量不能大于销售数量!");
}
if (this.form.productOrderId != null) {
updateProductOrder(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
@ -816,7 +841,10 @@ export default {
},
/** 删除按钮操作 */
handleDelete(row) {
const productOrderIds = row.productOrderId || this.ids;
const productOrderIds = row.orderCode || this.orderCodes;
if (row.orderStatus !== '0' && row.orderStatus !== '8') {
return this.$modal.msgError("该订单状态无法删除!");
}
this.$modal.confirm('是否确认删除生产工单编号为"' + productOrderIds + '"的数据项?').then(function () {
return delProductOrder(productOrderIds);
}).then(() => {

@ -26,15 +26,16 @@
<el-button icon="el-icon-plus" size="mini" type="primary" @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-col :span="1.5">
<el-button type="danger" icon="el-icon-delete" size="mini" @click="handleDeleteMesProductPlan"
:disabled="single">删除
</el-button>
</el-col>
</el-row>
<el-table ref="mesProductPlan" :data="mesProductPlanList"
:row-class-name="rowMesProductPlanIndex" @selection-change="handleMesProductPlanSelectionChange">
<el-table-column align="center" type="selection" width="50"/>
<el-table-column v-if="false" align="center" label="序号" prop="index" width="50"/>
<el-table-column align="center" label="序号" prop="index" width="50" v-if="false"/>
<el-table-column align="center" label="派工单号" prop="dispatchCode" width="190">
<template slot-scope="scope">
<el-input v-model="scope.row.dispatchCode" :disabled="true"/>
@ -191,6 +192,7 @@
<script>
import {getProductOrder} from "@//api/mes/productOrder";
import {
delProductplan,
getDispatchCode, getDispatchDrawingList,
getProductPlan,
orderAddMesProductPlanList,
@ -232,6 +234,9 @@ export default {
pictureDetailModel: false,
//
dialogImageUrl: '',
//
single: true,
checkedMesProductPlanList: [],
//
uploadImgUrl: process.env.VUE_APP_BASE_API,
// name
@ -320,7 +325,7 @@ export default {
const sumList = dataList.reduce((result, {processId, planAmount}) => {
const numericAmount = parseInt(planAmount, 10);
if (!this.isPositiveInteger(numericAmount)) {
this.$modal.msgError("派工数量须为大于0的正整数");
this.$modal.msgError("派工数量须为大于等于0的正整数");
return;
}
result[processId] = (result[processId] || 0) + numericAmount;
@ -349,13 +354,38 @@ export default {
this.close();
});
},
/** 删除按钮操作 */
handleDeleteMesProductPlan() {
let productPlan = this.checkedMesProductPlanList[0];
this.$modal.confirm('是否确认删除生产派工编号为"' + productPlan.dispatchCode + '"的数据项?').then(function () {
return true;
}).then(() => {
if (productPlan.planId === undefined || productPlan.planId === null) {
//
const mesProductPlanDetailList = this.mesProductPlanList;
this.mesProductPlanList = mesProductPlanDetailList.filter(function (item) {
return productPlan.dispatchCode !== item.dispatchCode
});
} else {
//
const mesProductPlanDetailList = this.mesProductPlanList;
this.mesProductPlanList = mesProductPlanDetailList.filter(function (item) {
return productPlan.dispatchCode !== item.dispatchCode
});
}
// delProductplan(planIds);
this.$modal.msgSuccess("删除成功");
}).catch(() => {
});
},
/** 生产计划明细序号 */
rowMesProductPlanIndex({row, rowIndex}) {
row.index = rowIndex + 1;
},
/** 复选框选中数据 */
handleMesProductPlanSelectionChange(selection) {
this.checkedMesProductPlan = selection.map(item => item.index)
this.checkedMesProductPlanList = selection
this.single = selection.length !== 1
},
/** 关闭按钮 */
close() {
@ -366,10 +396,10 @@ export default {
handleDrawing(row) {
this.fileList = [];
this.uploadList = [];
if (row.planId != null){
getDispatchDrawingList(row.planId).then(res =>{
if (row.planId != null) {
getDispatchDrawingList(row.planId).then(res => {
let attachList = res.data;
attachList.forEach(e =>{
attachList.forEach(e => {
let previewFile = {};
previewFile.url = e.attachPath;
previewFile.name = e.attachName;
@ -428,7 +458,7 @@ export default {
},
isPositiveInteger(value) {
// 使
return /^[1-9]\d*$/.test(value);
return /^[0-9]\d*$/.test(value);
},
//
handlePictureCardPreview(file) {

Loading…
Cancel
Save