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

master
yinq 9 months ago
parent 9c81a45837
commit 9159849178

@ -1,9 +1,9 @@
package com.hw.mes.controller; package com.hw.mes.controller;
import java.util.List; import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.hw.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
@ -74,6 +74,7 @@ public class MesProductOrderController extends BaseController {
@Log(title = "生产工单", businessType = BusinessType.INSERT) @Log(title = "生产工单", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@RequestBody MesProductOrder mesProductOrder) { public AjaxResult add(@RequestBody MesProductOrder mesProductOrder) {
mesProductOrder.setCreateBy(SecurityUtils.getLoginUser().getUsername());
return toAjax(mesProductOrderService.insertMesProductOrder(mesProductOrder)); return toAjax(mesProductOrderService.insertMesProductOrder(mesProductOrder));
} }
@ -84,6 +85,7 @@ public class MesProductOrderController extends BaseController {
@Log(title = "生产工单", businessType = BusinessType.UPDATE) @Log(title = "生产工单", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody MesProductOrder mesProductOrder) { public AjaxResult edit(@RequestBody MesProductOrder mesProductOrder) {
mesProductOrder.setUpdateBy(SecurityUtils.getLoginUser().getUsername());
return toAjax(mesProductOrderService.updateMesProductOrder(mesProductOrder)); return toAjax(mesProductOrderService.updateMesProductOrder(mesProductOrder));
} }
@ -115,15 +117,6 @@ public class MesProductOrderController extends BaseController {
return toAjax(mesProductOrderService.productOrderPublish(mesProductOrder)); 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()); 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 java.io.IOException;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.hw.mes.domain.MesProductOrder;
import com.hw.mes.service.IMesProductOrderService; import com.hw.mes.service.IMesProductOrderService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@ -149,4 +150,13 @@ public class MesProductPlanController extends BaseController
return success(mesProductPlanService.getDispatchDrawingList(planId)); 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") @Excel(name = "物料bomID")
private Long materialBomId; private Long materialBomId;
/**
* BOM
*/
@Excel(name = "BOM说明")
private String materialBomDesc;
/** /**
* (1线 2线) * (1线 2线)
*/ */
@ -179,6 +185,13 @@ public class MesProductOrder extends BaseEntity {
@Excel(name = "物料名称") @Excel(name = "物料名称")
private String materialName; private String materialName;
public String getMaterialBomDesc() {
return materialBomDesc;
}
public void setMaterialBomDesc(String materialBomDesc) {
this.materialBomDesc = materialBomDesc;
}
public String getDispatchName() { public String getDispatchName() {
return dispatchName; return dispatchName;

@ -81,12 +81,12 @@ public interface IMesProductOrderService
*/ */
public int productOrderPublish(MesProductOrder mesProductOrder); public int productOrderPublish(MesProductOrder mesProductOrder);
/** /**
* * BOM
* * @param materialBomId
* @param mesProductOrder * @return
* @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 java.util.List;
import com.hw.mes.domain.MesBaseAttachInfo; import com.hw.mes.domain.MesBaseAttachInfo;
import com.hw.mes.domain.MesProductOrder;
import com.hw.mes.domain.MesProductPlan; import com.hw.mes.domain.MesProductPlan;
/** /**
@ -92,4 +93,12 @@ public interface IMesProductPlanService
*/ */
public List<MesBaseAttachInfo> getDispatchDrawingList(Long planId); public List<MesBaseAttachInfo> getDispatchDrawingList(Long planId);
/**
*
*
* @param mesProductOrder
* @return
*/
public int productOrderRecall(MesProductOrder mesProductOrder);
} }

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

@ -3,6 +3,8 @@ package com.hw.mes.service.impl;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; 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.DateUtils;
import com.hw.common.core.utils.uuid.Seq; import com.hw.common.core.utils.uuid.Seq;
import com.hw.common.security.utils.SecurityUtils; 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 * Join product_orderbase_material
* *

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

@ -43,7 +43,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<resultMap id="MesProductPlanMesProductPlanDetailResult" type="MesProductPlan" extends="MesProductPlanResult"> <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>
<resultMap type="MesProductPlanDetail" id="MesProductPlanDetailResult"> <resultMap type="MesProductPlanDetail" id="MesProductPlanDetailResult">
@ -65,32 +66,70 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectMesProductPlanVo"> <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> </sql>
<select id="selectMesProductPlanList" parameterType="MesProductPlan" resultMap="MesProductPlanResult"> <select id="selectMesProductPlanList" parameterType="MesProductPlan" resultMap="MesProductPlanResult">
<include refid="selectMesProductPlanVo"/> <include refid="selectMesProductPlanVo"/>
<where> <where>
<if test="productOrderId != null "> and product_order_id = #{productOrderId}</if> <if test="productOrderId != null ">and mpp.product_order_id = #{productOrderId}</if>
<if test="planCode != null and planCode != ''"> and plan_code = #{planCode}</if> <if test="planCode != null and planCode != ''">and mpp.plan_code = #{planCode}</if>
<if test="dispatchCode != null and dispatchCode != ''"> and dispatch_code = #{dispatchCode}</if> <if test="dispatchCode != null and dispatchCode != ''">and mpp.dispatch_code = #{dispatchCode}</if>
<if test="materialId != null "> and material_id = #{materialId}</if> <if test="materialId != null ">and mpp.material_id = #{materialId}</if>
<if test="materialBomId != null "> and material_bom_id = #{materialBomId}</if> <if test="materialBomId != null ">and mpp.material_bom_id = #{materialBomId}</if>
<if test="processId != null "> and process_id = #{processId}</if> <if test="processId != null ">and mpp.process_id = #{processId}</if>
<if test="processOrder != null "> and process_order = #{processOrder}</if> <if test="processOrder != null ">and mpp.process_order = #{processOrder}</if>
<if test="lastProcessId != null "> and last_process_id = #{lastProcessId}</if> <if test="lastProcessId != null ">and mpp.last_process_id = #{lastProcessId}</if>
<if test="stationId != null "> and station_id = #{stationId}</if> <if test="stationId != null ">and mpp.station_id = #{stationId}</if>
<if test="userId != null "> and user_id = #{userId}</if> <if test="userId != null ">and mpp.user_id = #{userId}</if>
<if test="productionTime != null "> and production_time = #{productionTime}</if> <if test="productionTime != null ">and mpp.production_time = #{productionTime}</if>
<if test="planAmount != null "> and plan_amount = #{planAmount}</if> <if test="planAmount != null ">and mpp.plan_amount = #{planAmount}</if>
<if test="completeAmount != null "> and complete_amount = #{completeAmount}</if> <if test="completeAmount != null ">and mpp.complete_amount = #{completeAmount}</if>
<if test="planBeginTime != null "> and plan_begin_time = #{planBeginTime}</if> <if test="planBeginTime != null ">and mpp.plan_begin_time = #{planBeginTime}</if>
<if test="planEndTime != null "> and plan_end_time = #{planEndTime}</if> <if test="planEndTime != null ">and mpp.plan_end_time = #{planEndTime}</if>
<if test="realBeginTime != null "> and real_begin_time = #{realBeginTime}</if> <if test="realBeginTime != null ">and mpp.real_begin_time = #{realBeginTime}</if>
<if test="realEndTime != null "> and real_end_time = #{realEndTime}</if> <if test="realEndTime != null ">and mpp.real_end_time = #{realEndTime}</if>
<if test="attachId != null and attachId != ''"> and attach_id = #{attachId}</if> <if test="attachId != null and attachId != ''">and mpp.attach_id = #{attachId}</if>
<if test="planStatus != null and planStatus != ''"> and plan_status = #{planStatus}</if> <if test="planStatus != null and planStatus != ''">and mpp.plan_status = #{planStatus}</if>
<if test="isFlag != null and isFlag != ''"> and is_flag = #{isFlag}</if> <if test="isFlag != null and isFlag != ''">and mpp.is_flag = #{isFlag}</if>
</where> </where>
</select> </select>
@ -258,27 +297,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete> </delete>
<insert id="batchMesProductPlanDetail"> <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 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=","> <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}) ( #{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> </foreach>
</insert> </insert>
<select id="selectMesProductPlanJoinList" parameterType="MesProductPlan" resultMap="MesProductPlanResult"> <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, select mpp.plan_id, mpp.product_order_id, mpp.plan_code, mpp.dispatch_code, mpp.material_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.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 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 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 left join mes_base_material_info mbmi on mpp.material_id=mbmi.material_id

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

@ -49,7 +49,7 @@
@row-click="handleRowClick" @row-click="handleRowClick"
highlight-current-row 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="materialCode" />
<el-table-column label="物料名称" align="center" prop="materialName" /> <el-table-column label="物料名称" align="center" prop="materialName" />
<el-table-column label="物料大类" align="center" prop="materialCategories" /> <el-table-column label="物料大类" align="center" prop="materialCategories" />

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

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

@ -26,15 +26,16 @@
<el-button icon="el-icon-plus" size="mini" type="primary" @click="handleAddMesProductPlan"> <el-button icon="el-icon-plus" size="mini" type="primary" @click="handleAddMesProductPlan">
</el-button> </el-button>
</el-col> </el-col>
<!-- <el-col :span="1.5">--> <el-col :span="1.5">
<!-- <el-button type="danger" icon="el-icon-delete" size="mini" @click="handleDeleteMesProductPlan">--> <el-button type="danger" icon="el-icon-delete" size="mini" @click="handleDeleteMesProductPlan"
<!-- </el-button>--> :disabled="single">删除
<!-- </el-col>--> </el-button>
</el-col>
</el-row> </el-row>
<el-table ref="mesProductPlan" :data="mesProductPlanList" <el-table ref="mesProductPlan" :data="mesProductPlanList"
:row-class-name="rowMesProductPlanIndex" @selection-change="handleMesProductPlanSelectionChange"> :row-class-name="rowMesProductPlanIndex" @selection-change="handleMesProductPlanSelectionChange">
<el-table-column align="center" type="selection" width="50"/> <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"> <el-table-column align="center" label="派工单号" prop="dispatchCode" width="190">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.dispatchCode" :disabled="true"/> <el-input v-model="scope.row.dispatchCode" :disabled="true"/>
@ -191,6 +192,7 @@
<script> <script>
import {getProductOrder} from "@//api/mes/productOrder"; import {getProductOrder} from "@//api/mes/productOrder";
import { import {
delProductplan,
getDispatchCode, getDispatchDrawingList, getDispatchCode, getDispatchDrawingList,
getProductPlan, getProductPlan,
orderAddMesProductPlanList, orderAddMesProductPlanList,
@ -232,6 +234,9 @@ export default {
pictureDetailModel: false, pictureDetailModel: false,
// //
dialogImageUrl: '', dialogImageUrl: '',
//
single: true,
checkedMesProductPlanList: [],
// //
uploadImgUrl: process.env.VUE_APP_BASE_API, uploadImgUrl: process.env.VUE_APP_BASE_API,
// name // name
@ -320,7 +325,7 @@ export default {
const sumList = dataList.reduce((result, {processId, planAmount}) => { const sumList = dataList.reduce((result, {processId, planAmount}) => {
const numericAmount = parseInt(planAmount, 10); const numericAmount = parseInt(planAmount, 10);
if (!this.isPositiveInteger(numericAmount)) { if (!this.isPositiveInteger(numericAmount)) {
this.$modal.msgError("派工数量须为大于0的正整数"); this.$modal.msgError("派工数量须为大于等于0的正整数");
return; return;
} }
result[processId] = (result[processId] || 0) + numericAmount; result[processId] = (result[processId] || 0) + numericAmount;
@ -349,13 +354,38 @@ export default {
this.close(); 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}) { rowMesProductPlanIndex({row, rowIndex}) {
row.index = rowIndex + 1; row.index = rowIndex + 1;
}, },
/** 复选框选中数据 */ /** 复选框选中数据 */
handleMesProductPlanSelectionChange(selection) { handleMesProductPlanSelectionChange(selection) {
this.checkedMesProductPlan = selection.map(item => item.index) this.checkedMesProductPlanList = selection
this.single = selection.length !== 1
}, },
/** 关闭按钮 */ /** 关闭按钮 */
close() { close() {
@ -428,7 +458,7 @@ export default {
}, },
isPositiveInteger(value) { isPositiveInteger(value) {
// 使 // 使
return /^[1-9]\d*$/.test(value); return /^[0-9]\d*$/.test(value);
}, },
// //
handlePictureCardPreview(file) { handlePictureCardPreview(file) {

Loading…
Cancel
Save