MES:
-生产派工:在修改和删除时判断每一个工序的状态和判断生产任务的状态
-工艺路线:添加步骤时顺序的问题
master
xs 11 months ago
parent f03596da0d
commit 7b525deeeb

@ -39,20 +39,20 @@ public class SocketUtils {
while ((bytesRead = inFromServer.read(buffer)) != -1) { while ((bytesRead = inFromServer.read(buffer)) != -1) {
// 处理接收到的数据 // 处理接收到的数据
String receivedMessage = new String(buffer, 0, bytesRead, StandardCharsets.UTF_8); String receivedMessage = new String(buffer, 0, bytesRead, StandardCharsets.UTF_8);
System.out.println("Received feedback from server: " + receivedMessage); // System.out.println("Received feedback from server: " + receivedMessage);
return receivedMessage; return receivedMessage;
} }
} catch (SocketTimeoutException e) { } catch (SocketTimeoutException e) {
System.err.println("Reading from the socket timed out."); // System.err.println("Reading from the socket timed out.");
} }
} catch (IOException e) { } catch (IOException e) {
System.err.println("An I/O error occurred: " + e.getMessage()); // System.err.println("An I/O error occurred: " + e.getMessage());
} finally { } finally {
if (socket != null) { if (socket != null) {
try { try {
socket.close(); // 在异常情况下也尝试关闭 socket.close(); // 在异常情况下也尝试关闭
} catch (IOException e) { } catch (IOException e) {
System.err.println("Failed to close the socket: " + e.getMessage()); // System.err.println("Failed to close the socket: " + e.getMessage());
} }
} }
} }

@ -5,6 +5,7 @@ import java.io.IOException;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.hw.common.security.utils.SecurityUtils; import com.hw.common.security.utils.SecurityUtils;
import com.hw.mes.domain.MesBaseRouteProcess;
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;
@ -79,7 +80,8 @@ public class MesBaseRouteController extends BaseController
@GetMapping(value = "/{routeId}") @GetMapping(value = "/{routeId}")
public AjaxResult getInfo(@PathVariable("routeId") Long routeId) public AjaxResult getInfo(@PathVariable("routeId") Long routeId)
{ {
return success(mesBaseRouteService.selectMesBaseRouteByRouteId(routeId)); MesBaseRoute mesBaseRoute = mesBaseRouteService.selectMesBaseRouteByRouteId(routeId);
return success(mesBaseRoute);
} }
/** /**

@ -188,6 +188,9 @@ public class MesProductPlan extends BaseEntity
private String saleType; private String saleType;
private String displayFlag;
private Long processProductionTime;
public Long getSaleOrderId() { public Long getSaleOrderId() {
return saleOrderId; return saleOrderId;
@ -538,6 +541,22 @@ public class MesProductPlan extends BaseEntity
this.saleType = saleType; this.saleType = saleType;
} }
public String getDisplayFlag() {
return displayFlag;
}
public void setDisplayFlag(String displayFlag) {
this.displayFlag = displayFlag;
}
public Long getProcessProductionTime() {
return processProductionTime;
}
public void setProcessProductionTime(Long processProductionTime) {
this.processProductionTime = processProductionTime;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

@ -333,6 +333,17 @@ public class MesProductPlanDetailServiceImpl implements IMesProductPlanDetailSer
throw new ServiceException("完成数量超出派工数量"); throw new ServiceException("完成数量超出派工数量");
} }
//查询同一工序其他派工人的情况
MesProductPlan querySameProcessPersonProductPlan = new MesProductPlan();
querySameProcessPersonProductPlan.setProcessId(dbProductPlan.getProcessId());
querySameProcessPersonProductPlan.setDispatchCode(dbProductPlan.getDispatchCode());
List<MesProductPlan> sameProcessPersonProductPlans = mesProductPlanMapper.selectOnlyMesProductPlans(querySameProcessPersonProductPlan);
List<MesProductPlan> allCompletedPersonProductPlans = sameProcessPersonProductPlans.stream().filter(sameProcessPersonProductPlan ->
!sameProcessPersonProductPlan.getPlanId().equals(dbProductPlan.getPlanId()) &&
!sameProcessPersonProductPlan.getPlanStatus().equals(MesConstants.MES_PRODUCT_PLAN_STATUS_FINISH)
).collect(Collectors.toList());
//如果同工序其他人都已经完成则生产任务数量才能加1
if (allCompletedPersonProductPlans.isEmpty()) {
mesProductOrder.setCompleteAmount(newOrderCompleteAmount); mesProductOrder.setCompleteAmount(newOrderCompleteAmount);
if (newOrderCompleteAmount.compareTo(mesProductOrder.getPlanAmount()) == 0) { if (newOrderCompleteAmount.compareTo(mesProductOrder.getPlanAmount()) == 0) {
@ -344,6 +355,7 @@ public class MesProductPlanDetailServiceImpl implements IMesProductPlanDetailSer
mesProductOrder.setUpdateBy(userName); mesProductOrder.setUpdateBy(userName);
mesProductOrderMapper.updateMesProductOrder(mesProductOrder); mesProductOrderMapper.updateMesProductOrder(mesProductOrder);
} }
}
dbProductPlan.setCompleteAmount(newComplementAmount); dbProductPlan.setCompleteAmount(newComplementAmount);
dbProductPlan.setUpdateTime(currentDate); dbProductPlan.setUpdateTime(currentDate);
@ -528,9 +540,9 @@ public class MesProductPlanDetailServiceImpl implements IMesProductPlanDetailSer
throw new ServiceException("配对条码有误,未找到原材料条码信息"); throw new ServiceException("配对条码有误,未找到原材料条码信息");
} }
if(StringUtils.isNotEmpty(bindBarcodeInfo.getSafeFlag()) && if (StringUtils.isNotEmpty(bindBarcodeInfo.getSafeFlag()) &&
bindBarcodeInfo.getSingleFlag().equals(MesConstants.MES_BARCODE_SINGLE_FLAG_INTERNAL)){//对内生产 bindBarcodeInfo.getSingleFlag().equals(MesConstants.MES_BARCODE_SINGLE_FLAG_INTERNAL)) {//对内生产
if(StringUtils.isEmpty(bindBarcodeInfo.getProductBarcode())){ if (StringUtils.isEmpty(bindBarcodeInfo.getProductBarcode())) {
throw new ServiceException("未按成品条码生成原材料条码"); throw new ServiceException("未按成品条码生成原材料条码");
} }
} }

@ -229,7 +229,10 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService {
public int orderAddMesProductPlanList(MesProductPlanEditVo mesProductPlanEditVo) { public int orderAddMesProductPlanList(MesProductPlanEditVo mesProductPlanEditVo) {
String userName = SecurityUtils.getUsername(); String userName = SecurityUtils.getUsername();
Date currentDate = new Date(); Date currentDate = new Date();
List<MesProductPlan> mesProductPlanList = mesProductPlanEditVo.getMesProductPlanList();
/**plan
* productplanplan
*/
Long[] toDeletedPlanIds = mesProductPlanEditVo.getToDeletedPlanIds(); Long[] toDeletedPlanIds = mesProductPlanEditVo.getToDeletedPlanIds();
if (toDeletedPlanIds != null && toDeletedPlanIds.length > 0) { if (toDeletedPlanIds != null && toDeletedPlanIds.length > 0) {
for (Long toDeletedPlanId : toDeletedPlanIds) { for (Long toDeletedPlanId : toDeletedPlanIds) {
@ -242,12 +245,48 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService {
mesProductPlanMapper.deleteMesProductPlanByPlanIds(toDeletedPlanIds); mesProductPlanMapper.deleteMesProductPlanByPlanIds(toDeletedPlanIds);
} }
//更新工单已派工数量
MesProductOrder mesProductOrder = mesProductOrderMapper.selectMesProductOrderByProductOrderId(mesProductPlanEditVo.getProductOrderId());
String orderStatus = mesProductOrder.getOrderStatus();
if (!orderStatus.equals(MesConstants.BEGIN) && !orderStatus.equals(MesConstants.PUBLISHED) && !orderStatus.equals(MesConstants.PAUSE)) {
String orderStatusPrompt = MesConstants.ORDER_STATUS_PROMPT_MAP.get(orderStatus);
throw new ServiceException(String.format("此生产任务已经%s,不能派工!", orderStatusPrompt));
}
BigDecimal dispatchedAmount = mesProductOrder.getDispatchAmount() == null ? BigDecimal.ZERO : mesProductOrder.getDispatchAmount();
BigDecimal planAmount = mesProductOrder.getPlanAmount();
BigDecimal updateDispatchAmount = dispatchedAmount.add(mesProductPlanEditVo.getDispatchAmount());
if (updateDispatchAmount.compareTo(planAmount) > 0) {
throw new ServiceException("派工数量大于计划数量,请重新派工");
}
/**productplanproductplan
* productorder,
*/
MesProductPlan queryProductPlan = new MesProductPlan();
queryProductPlan.setProductOrderId(mesProductPlanEditVo.getProductOrderId());
List<MesProductPlan> orderProductPlans = mesProductPlanMapper.selectOnlyMesProductPlans(queryProductPlan);
List<MesProductPlan> mesProductPlanList = mesProductPlanEditVo.getMesProductPlanList();
for (MesProductPlan mesProductPlan : mesProductPlanList) { for (MesProductPlan mesProductPlan : mesProductPlanList) {
Long planId = mesProductPlan.getPlanId(); Long planId = mesProductPlan.getPlanId();
if (planId != null) { if (planId != null) {
MesProductPlan dbProductPlan = orderProductPlans.stream().filter(orderProductPlan -> orderProductPlan.getPlanId().equals(planId)).findFirst().get();
if (dbProductPlan == null) {
throw new ServiceException("没找到派工信息");
}
if (!dbProductPlan.getPlanStatus().equals(MesConstants.MES_PRODUCT_PLAN_STATUS_FINISH)) {
mesProductPlan.setUpdateBy(userName); mesProductPlan.setUpdateBy(userName);
mesProductPlan.setUpdateTime(currentDate); mesProductPlan.setUpdateTime(currentDate);
//不更新以下字段
mesProductPlan.setPlanCode(null);
mesProductPlan.setDispatchCode(null);
mesProductPlan.setPlanStatus(null);
mesProductPlan.setRealBeginTime(null);
mesProductPlan.setRealEndTime(null);
mesProductPlanMapper.updateMesProductPlan(mesProductPlan); mesProductPlanMapper.updateMesProductPlan(mesProductPlan);
}
} else { } else {
mesProductPlan.setPlanAmount(mesProductPlan.getDispatchAmount()); mesProductPlan.setPlanAmount(mesProductPlan.getDispatchAmount());
mesProductPlan.setCreateBy(SecurityUtils.getUsername()); mesProductPlan.setCreateBy(SecurityUtils.getUsername());
@ -261,15 +300,6 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService {
} }
} }
//更新工单已派工数量
MesProductOrder mesProductOrder = mesProductOrderMapper.selectMesProductOrderByProductOrderId(mesProductPlanEditVo.getProductOrderId());
BigDecimal dispatchedAmount = mesProductOrder.getDispatchAmount() == null ? BigDecimal.ZERO : mesProductOrder.getDispatchAmount();
BigDecimal planAmount = mesProductOrder.getPlanAmount();
BigDecimal updateDispatchAmount = dispatchedAmount.add(mesProductPlanEditVo.getDispatchAmount());
if (updateDispatchAmount.compareTo(planAmount) > 0) {
throw new ServiceException("派工数量大于计划数量,请重新派工");
}
mesProductOrder.setDispatchAmount(updateDispatchAmount); mesProductOrder.setDispatchAmount(updateDispatchAmount);
mesProductOrder.setUpdateTime(currentDate); mesProductOrder.setUpdateTime(currentDate);
mesProductOrder.setUpdateBy(userName); mesProductOrder.setUpdateBy(userName);
@ -277,6 +307,21 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService {
return 1; return 1;
} }
private void getUpdatedProductPlans(MesProductPlanEditVo mesProductPlanEditVo) {
List<MesProductPlan> mesProductPlanList = mesProductPlanEditVo.getMesProductPlanList();
MesProductPlan queryProductPlan = new MesProductPlan();
queryProductPlan.setProductOrderId(mesProductPlanEditVo.getProductOrderId());
List<MesProductPlan> orderProductPlans = mesProductPlanMapper.selectOnlyMesProductPlans(queryProductPlan);
if (orderProductPlans != null && !orderProductPlans.isEmpty()) {
Map<String, List<MesProductPlan>> dispatchProductPlansMap = orderProductPlans.stream()
.collect(Collectors.groupingBy(MesProductPlan::getDispatchCode));
}
}
/** /**
* List * List
* *

@ -87,6 +87,7 @@
from mes_base_route a from mes_base_route a
left join mes_base_route_process b on b.route_id = a.route_id left join mes_base_route_process b on b.route_id = a.route_id
where a.route_id = #{routeId} where a.route_id = #{routeId}
order by b.process_order
</select> </select>
<insert id="insertMesBaseRoute" parameterType="MesBaseRoute" useGeneratedKeys="true" keyProperty="routeId"> <insert id="insertMesBaseRoute" parameterType="MesBaseRoute" useGeneratedKeys="true" keyProperty="routeId">

@ -134,7 +134,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 order by mpo.product_order_id desc
</select> </select>
<select id="selectMesProductOrderByProductOrderId" parameterType="Long" resultMap="MesProductOrderResult"> <select id="selectMesProductOrderByProductOrderId" parameterType="Long" resultMap="MesProductOrderResult">

@ -49,6 +49,9 @@
<result property="sopId" column="sop_id"/> <result property="sopId" column="sop_id"/>
<result property="orderCode" column="order_code"/> <result property="orderCode" column="order_code"/>
<result property="saleType" column="sale_type"/> <result property="saleType" column="sale_type"/>
<result property="displayFlag" column="display_flag"/>
<result property="processProductionTime" column="process_production_time"/>
</resultMap> </resultMap>
<resultMap id="MesProductPlanMesProductPlanDetailResult" type="MesProductPlan" extends="MesProductPlanResult"> <resultMap id="MesProductPlanMesProductPlanDetailResult" type="MesProductPlan" extends="MesProductPlanResult">
@ -407,6 +410,7 @@
mpp.process_id, mpp.process_id,
bpi.process_name, bpi.process_name,
bpi.process_type, bpi.process_type,
bpi.display_flag,
mpp.process_order, mpp.process_order,
mpp.last_process_id, mpp.last_process_id,
mpp.final_process_flag, mpp.final_process_flag,
@ -414,6 +418,7 @@
mpp.user_id, mpp.user_id,
mpp.user_name, mpp.user_name,
mpp.production_time, mpp.production_time,
bpi.production_time as process_production_time,
mpp.dispatch_amount, mpp.dispatch_amount,
mpp.plan_amount, mpp.plan_amount,
mpp.complete_amount, mpp.complete_amount,
@ -454,6 +459,7 @@
<if test="planStatus != null and planStatus != ''">and mpp.plan_status = #{planStatus}</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> <if test="isFlag != null and isFlag != ''">and mpp.is_flag = #{isFlag}</if>
</where> </where>
order by mpp.dispatch_code,mpp.process_order
</select> </select>
@ -496,6 +502,7 @@
<if test="dispatchCode != null and dispatchCode != ''">and a.dispatch_code = #{dispatchCode}</if> <if test="dispatchCode != null and dispatchCode != ''">and a.dispatch_code = #{dispatchCode}</if>
<if test="processId != null ">and a.process_id = #{processId}</if> <if test="processId != null ">and a.process_id = #{processId}</if>
<if test="finalProcessFlag != null and finalProcessFlag != ''">and a.final_process_flag = #{finalProcessFlag}</if> <if test="finalProcessFlag != null and finalProcessFlag != ''">and a.final_process_flag = #{finalProcessFlag}</if>
<if test="productOrderId != null ">and a.product_order_id = #{productOrderId}</if>
</where> </where>
</select> </select>

@ -21,7 +21,7 @@ export default {
}, },
created() { created() {
let floorData = JSON.parse(sessionStorage.getItem('FLOORDATA') || '{}') let floorData = JSON.parse(sessionStorage.getItem('FLOORDATA') || '{}')
this.data = floorData.query?.a this.data = floorData.query?.processName
const getDate = () => { const getDate = () => {
let date = new Date() let date = new Date()
let YYYY = date.getFullYear() let YYYY = date.getFullYear()

@ -320,7 +320,7 @@ export const dynamicRoutes = [
path: 'index/:productOrderId(\\d+)', path: 'index/:productOrderId(\\d+)',
component: () => import('@/views/mes/productplan/editProductPlan'), component: () => import('@/views/mes/productplan/editProductPlan'),
name: 'productPlanEdit', name: 'productPlanEdit',
meta: { title: '工单生产派工', activeMenu: '/mes/productplan' } meta: { title: '生产派工', activeMenu: '/mes/productplan' }
} }
] ]
}, },

@ -81,11 +81,12 @@ export default {
return { return {
codeUrl: "", codeUrl: "",
loginForm: { loginForm: {
username: "admin", username: "xin",
password: "admin123", password: "123456",
rememberMe: false, rememberMe: false,
processId: '', processId: '',
processFloor: '', processFloor:'',
processName:'',
code: "", code: "",
uuid: "" uuid: ""
}, },
@ -208,7 +209,7 @@ export default {
this.$store.dispatch("Login", this.loginForm).then(() => { this.$store.dispatch("Login", this.loginForm).then(() => {
let data = this.options.find(v => v.processId === this.loginForm.processId) || {} let data = this.options.find(v => v.processId === this.loginForm.processId) || {}
let routeData = this.floorData.find(v => v.floor === data.processFloor && v.processId === data.processId) || {} let routeData = this.floorData.find(v => v.floor === data.processFloor && v.processId === data.processId) || {}
let query = {a:1} let query = {processName:this.loginForm.processName}
routeData.query = query routeData.query = query
if (routeData.route) { if (routeData.route) {
sessionStorage.setItem("FLOORDATA", JSON.stringify(routeData)) sessionStorage.setItem("FLOORDATA", JSON.stringify(routeData))
@ -231,6 +232,7 @@ export default {
changeProcess(processId) { changeProcess(processId) {
let process = this.options.find(v => v.processId === processId) let process = this.options.find(v => v.processId === processId)
this.loginForm.processFloor = process.processFloor; this.loginForm.processFloor = process.processFloor;
this.loginForm.processName = process.processName;
} }
} }
}; };

@ -421,8 +421,10 @@ export default {
}, },
/** 工艺路线组成信息序号 */ /** 工艺路线组成信息序号 */
rowMesBaseRouteProcessIndex({row, rowIndex}) { rowMesBaseRouteProcessIndex({row, rowIndex}) {
if (!row.processOrder) {
row.index = rowIndex + 1; row.index = rowIndex + 1;
row.processOrder = (rowIndex + 1) * 10; row.processOrder = (rowIndex + 1) * 10;
}
}, },
/** 工艺路线组成信息添加按钮操作 */ /** 工艺路线组成信息添加按钮操作 */
handleAddMesBaseRouteProcess() { handleAddMesBaseRouteProcess() {

@ -1,10 +1,10 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px"> <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item label="工单编号" prop="orderCode"> <el-form-item label="任务编号" prop="orderCode">
<el-input <el-input
v-model="queryParams.orderCode" v-model="queryParams.orderCode"
placeholder="请输入工单编号" placeholder="请输入任务编号"
clearable clearable
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
@ -125,7 +125,7 @@
<el-table v-loading="loading" :data="productOrderList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="productOrderList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center"/> <el-table-column type="selection" width="55" align="center"/>
<el-table-column label="主键标识" align="center" prop="productOrderId" v-if="columns[0].visible"/> <el-table-column label="主键标识" align="center" prop="productOrderId" v-if="columns[0].visible"/>
<el-table-column label="工单编号" align="center" prop="orderCode" v-if="columns[1].visible" width="100"/> <el-table-column label="任务编号" align="center" prop="orderCode" v-if="columns[1].visible" width="100"/>
<el-table-column label="销售类型" align="center" prop="saleType" v-if="columns[28].visible" width="100"> <el-table-column label="销售类型" align="center" prop="saleType" v-if="columns[28].visible" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="dict.type.mes_sale_type" :value="scope.row.saleType"/> <dict-tag :options="dict.type.mes_sale_type" :value="scope.row.saleType"/>
@ -151,6 +151,18 @@
<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="planBeginTime" width="180" v-if="columns[15].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[16].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="orderStatus" v-if="columns[19].visible"> <el-table-column label="工单状态" align="center" prop="orderStatus" v-if="columns[19].visible">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="dict.type.plan_status" :value="scope.row.orderStatus"/> <dict-tag :options="dict.type.plan_status" :value="scope.row.orderStatus"/>
@ -167,16 +179,7 @@
<span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span> <span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="计划开始时间" align="center" prop="planBeginTime" width="180" v-if="columns[15].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[16].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[17].visible"> <el-table-column label="开始时间" align="center" prop="realBeginTime" width="180" v-if="columns[17].visible">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.realBeginTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span> <span>{{ parseTime(scope.row.realBeginTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
@ -257,7 +260,6 @@
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 === MES_ORDER_STATUS.PUBLISHED || scope.row.orderStatus === MES_ORDER_STATUS.STARTED)"
>生产派工 >生产派工
</el-button> </el-button>
</template> </template>
@ -275,8 +277,8 @@
<!-- 添加或修改生产工单对话框 --> <!-- 添加或修改生产工单对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="110px"> <el-form ref="form" :model="form" :rules="rules" label-width="110px">
<el-form-item label="工单编号" prop="orderCode"> <el-form-item label="任务编号" prop="orderCode">
<el-input v-model="form.orderCode" placeholder="请输入工单编号" :disabled="true"/> <el-input v-model="form.orderCode" placeholder="请输入任务编号" :disabled="true"/>
</el-form-item> </el-form-item>
<el-form-item label="销售类型" prop="saleType"> <el-form-item label="销售类型" prop="saleType">
<el-radio-group v-model="form.saleType"> <el-radio-group v-model="form.saleType">
@ -389,7 +391,7 @@
<!-- 无销售订单添加生产工单对话框 --> <!-- 无销售订单添加生产工单对话框 -->
<el-dialog :title="title" :visible.sync="noOrderOpen" width="500px" append-to-body> <el-dialog :title="title" :visible.sync="noOrderOpen" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="110px"> <el-form ref="form" :model="form" :rules="rules" label-width="110px">
<el-form-item label="工单编号" prop="orderCode"> <el-form-item label="任务编号" prop="orderCode">
<el-input v-model="form.orderCode" :disabled="true"/> <el-input v-model="form.orderCode" :disabled="true"/>
</el-form-item> </el-form-item>
<el-form-item label="销售类型" prop="saleType"> <el-form-item label="销售类型" prop="saleType">
@ -417,6 +419,12 @@
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="生产物料" prop="produceMaterialName"
v-if="form.saleType===this.MES_SALE_TYPE.MES_SALE_TYPE_INTERNAL">
<el-input v-model="form.produceMaterialName" placeholder="请点击右侧检索物料" :disabled="true">
<el-button slot="append" icon="el-icon-search" @click="handleProduceMaterialAdd"></el-button>
</el-input>
</el-form-item>
<el-form-item label="工艺路线" prop="dispatchId"> <el-form-item label="工艺路线" prop="dispatchId">
<el-select v-model="form.dispatchId" filterable placeholder="请选择工艺路线" clearable> <el-select v-model="form.dispatchId" filterable placeholder="请选择工艺路线" clearable>
<el-option <el-option
@ -481,7 +489,7 @@
<!-- 添加物料信息对话框 --> <!-- 添加物料信息对话框 -->
<el-dialog title="选择物料信息" :visible.sync="materialOpen" append-to-body> <el-dialog title="选择物料信息" :visible.sync="materialOpen" append-to-body>
<add-bom @selection="handleSelection" ref="materialRef" :select-type="selectType"></add-bom> <add-bom @selection="handleSelection" ref="materialRef" :select-type="selectType" v-if="materialOpen"></add-bom>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitMaterialForm"> </el-button> <el-button type="primary" @click="submitMaterialForm"> </el-button>
<el-button @click="materialOpen = false"> </el-button> <el-button @click="materialOpen = false"> </el-button>
@ -592,7 +600,7 @@ export default {
// //
rules: { rules: {
orderCode: [ orderCode: [
{required: true, message: "工单编号不能为空", trigger: "blur"} {required: true, message: "任务编号不能为空", trigger: "blur"}
], ],
saleOrderId: [ saleOrderId: [
{required: true, message: "销售订单ID不能为空", trigger: "blur"} {required: true, message: "销售订单ID不能为空", trigger: "blur"}
@ -645,7 +653,7 @@ export default {
}, },
columns: [ columns: [
{key: 0, label: `主键标识`, visible: false}, {key: 0, label: `主键标识`, visible: false},
{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: false}, {key: 4, label: `销售订单行号`, visible: false},
@ -797,14 +805,13 @@ export default {
/** 提交物料信息按钮 */ /** 提交物料信息按钮 */
submitMaterialForm() { submitMaterialForm() {
let selectedRow = this.$refs.materialRef.selectedRow; let selectedRow = this.$refs.materialRef.selectedRow;
alert("--"+this.selectType)
if (this.selectType === this.MATERIAL_TYPE.RAW) { if (this.selectType === this.MATERIAL_TYPE.RAW) {
this.form.produceMaterialId = selectedRow.materialId; this.form.produceMaterialId = selectedRow.materialId;
this.$set(this.form, 'produceMaterialName', selectedRow.materialName) this.$set(this.form, 'produceMaterialName', selectedRow.materialName)
// this.form.produceMaterialName = selectedRow.materialName;// // this.form.produceMaterialName = selectedRow.materialName;//
} else { } else {
this.form.materialId = selectedRow.materialId; this.form.materialId = selectedRow.materialId;
this.form.materialName = selectedRow.materialName; this.$set(this.form, 'materialName', selectedRow.materialName)
getMaterialVisionList(this.form.materialId).then(response => { getMaterialVisionList(this.form.materialId).then(response => {
this.materialBomList = response.data this.materialBomList = response.data
if (this.materialBomList.length !== 0) { if (this.materialBomList.length !== 0) {
@ -902,7 +909,7 @@ export default {
handleMaterialAdd() { handleMaterialAdd() {
if (!this.materialDisabled) { if (!this.materialDisabled) {
this.materialOpen = true; this.materialOpen = true;
this.selectType = this.MATERIAL_TYPE.PRODUCT;// this.selectType = '';
} }
}, },
@ -963,7 +970,7 @@ 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 () { this.$modal.confirm('是否确认发布生产任务编号为"' + row.orderCode + '"的数据项?').then(function () {
return true; return true;
}).then(() => { }).then(() => {
productOrderPublish(this.form).then(response => { productOrderPublish(this.form).then(response => {
@ -982,7 +989,7 @@ export default {
/** 撤回 */ /** 撤回 */
handleRecall(row) { handleRecall(row) {
this.form.productOrderId = row.productOrderId; this.form.productOrderId = row.productOrderId;
this.$modal.confirm('是否确认撤回生产工单编号为"' + row.orderCode + '"的数据项?').then(function () { this.$modal.confirm('是否确认撤回生产任务编号为"' + row.orderCode + '"的数据项?').then(function () {
return true; return true;
}).then(() => { }).then(() => {
productOrderRecall(this.form).then(response => { productOrderRecall(this.form).then(response => {
@ -1011,7 +1018,6 @@ export default {
}, },
/** 销售订单新增提交按钮 */ /** 销售订单新增提交按钮 */
submitForm() { submitForm() {
console.log(this.form)
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
// //
@ -1042,7 +1048,7 @@ export default {
if (row.orderStatus !== '0' && row.orderStatus !== '8') { if (row.orderStatus !== '0' && row.orderStatus !== '8') {
return this.$modal.msgError("该订单状态无法删除!"); return this.$modal.msgError("该订单状态无法删除!");
} }
this.$modal.confirm('是否确认删除生产工单编号为"' + productOrderIds + '"的数据项?').then(function () { this.$modal.confirm('是否确认删除生产任务编号为"' + productOrderIds + '"的数据项?').then(function () {
return delProductOrder(productOrderIds); return delProductOrder(productOrderIds);
}).then(() => { }).then(() => {
this.getList(); this.getList();
@ -1070,7 +1076,7 @@ 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 () { // this.$modal.confirm('"' + row.orderCode + '"').then(function () {
// return true; // return true;
// }).then(() => { // }).then(() => {
// productOrderPublish(this.form).then(response => { // productOrderPublish(this.form).then(response => {

@ -6,7 +6,7 @@
</el-divider> </el-divider>
<el-row :gutter="10"> <el-row :gutter="10">
<el-col :span="12"> <el-col :span="12">
<el-form-item label="工单号:">{{ form.orderCode }}</el-form-item> <el-form-item label="任务编号:">{{ form.orderCode }}</el-form-item>
<el-form-item label="成品编码:">{{ form.materialCode }}</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="计划开始时间:">{{ parseTime(form.planBeginTime) }}</el-form-item>
<el-form-item label="计划数量/已派工数量/完成数量:" label-width="220px"> <el-form-item label="计划数量/已派工数量/完成数量:" label-width="220px">
@ -21,6 +21,13 @@
<el-form-item label="工艺路线:">{{ form.dispatchName }}</el-form-item> <el-form-item label="工艺路线:">{{ form.dispatchName }}</el-form-item>
<el-form-item label="成品名称:">{{ form.materialName }}</el-form-item> <el-form-item label="成品名称:">{{ form.materialName }}</el-form-item>
<el-form-item label="计划结束时间:">{{ parseTime(form.planEndTime) }}</el-form-item> <el-form-item label="计划结束时间:">{{ parseTime(form.planEndTime) }}</el-form-item>
<el-form-item label="任务状态:">
<template slot-scope="scope">
<dict-tag :options="dict.type.plan_status" :value="form.orderStatus"/>
</template>
</el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -29,7 +36,9 @@
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button icon="el-icon-plus" size="mini" type="primary" @click="handleAddMesProductPlan"> <el-button icon="el-icon-plus" size="mini" type="primary" @click="handleAddMesProductPlan"
v-if="form.orderStatus!==ORDER_STATUS.FINISHED && form.orderStatus!=ORDER_STATUS.RECALLED && form.orderStatus!=ORDER_STATUS.DELETED">
新增
</el-button> </el-button>
</el-col> </el-col>
</el-row> </el-row>
@ -48,7 +57,7 @@
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="danger" icon="el-icon-delete" @click="handleDeleteMesProductPlan(scope)" <el-button type="danger" icon="el-icon-delete" @click="handleDeleteMesProductPlan(scope)"
v-if="scope.row.deleteFlag != null && scope.row.deleteFlag == '1'"></el-button> v-if="scope.row.deleteFlag != null && scope.row.deleteFlag === '1'"></el-button>
</template> </template>
</el-table-column> </el-table-column>
@ -56,9 +65,14 @@
width="80" width="80"
type="" type=""
> >
<template slot-scope="scope"> <template slot-scope="scope" v-if="">
<el-button type="primary" icon="el-icon-plus" @click="addProcessUser(scope)" <el-button type="primary" icon="el-icon-plus" @click="addProcessUser(scope)"
v-if="scope.row.children != null && scope.row.children !== undefined"></el-button> v-if="(scope.row.children != null && scope.row.children !== undefined)
&& scope.row.processType!== PROCESS_TYPE.AUTO && scope.row.displayFlag !== DISPLAY_FLAG.NO"
:disabled="scope.row.addFlag !=='1'
|| form.orderStatus===ORDER_STATUS.FINISHED || form.orderStatus===ORDER_STATUS.RECALLED || form.orderStatus===ORDER_STATUS.DELETED" >
</el-button>
</template> </template>
</el-table-column> </el-table-column>
@ -116,13 +130,15 @@
<el-table-column align="center" label="派工标准工时(小时)" prop="productionTime" width="180"> <el-table-column align="center" label="派工标准工时(小时)" prop="productionTime" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input-number style="width:150px;" :min="0" v-model="scope.row.productionTime" <el-input-number style="width:150px;" :min="0" v-model="scope.row.productionTime"
:disabled="scope.row.processType === PROCESS_TYPE.MANUAL && scope.row.children != null && scope.row.children !== undefined"/> :disabled="(scope.row.processType === PROCESS_TYPE.MANUAL && scope.row.children != null && scope.row.children !== undefined)
|| scope.row.planStatus=== PLAN_STATUS.FINISHED"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="计划开始时间" prop="planBeginTime" width="230"> <el-table-column align="center" label="计划开始时间" prop="planBeginTime" width="230">
<template slot-scope="scope"> <template slot-scope="scope">
<el-date-picker v-model="scope.row.planBeginTime" style="width:200px;" <el-date-picker v-model="scope.row.planBeginTime" style="width:200px;"
:disabled="scope.row.processType === PROCESS_TYPE.MANUAL && scope.row.children != null && scope.row.children !== undefined" :disabled="(scope.row.processType === PROCESS_TYPE.MANUAL && scope.row.children != null && scope.row.children !== undefined)
|| scope.row.planStatus=== PLAN_STATUS.FINISHED"
clearable clearable
placeholder="请选择计划开始时间" placeholder="请选择计划开始时间"
type="datetime" value-format="yyyy-MM-dd HH:mm:ss" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
@ -132,7 +148,8 @@
<el-table-column align="center" label="计划完成时间" prop="planEndTime" width="230"> <el-table-column align="center" label="计划完成时间" prop="planEndTime" width="230">
<template slot-scope="scope"> <template slot-scope="scope">
<el-date-picker v-model="scope.row.planEndTime" style="width:200px;" <el-date-picker v-model="scope.row.planEndTime" style="width:200px;"
:disabled="scope.row.processType === PROCESS_TYPE.MANUAL && scope.row.children != null && scope.row.children !== undefined" :disabled="(scope.row.processType === PROCESS_TYPE.MANUAL && scope.row.children != null && scope.row.children !== undefined)
|| scope.row.planStatus=== PLAN_STATUS.FINISHED"
clearable clearable
placeholder="请选择计划完成时间" placeholder="请选择计划完成时间"
type="datetime" value-format="yyyy-MM-dd HH:mm:ss"/> type="datetime" value-format="yyyy-MM-dd HH:mm:ss"/>
@ -141,7 +158,8 @@
<el-table-column align="center" label="状态" prop="planStatus" width="150"> <el-table-column align="center" label="状态" prop="planStatus" width="150">
<template slot-scope="scope"> <template slot-scope="scope">
<el-select v-model="scope.row.planStatus" :disabled="true" placeholder="请选择状态"> <el-select v-model="scope.row.planStatus" :disabled="true" placeholder="请选择状态"
v-if="scope.row.children == null || scope.row.children === undefined">
<el-option <el-option
v-for="dict in dict.type.product_status" v-for="dict in dict.type.product_status"
:key="dict.value" :key="dict.value"
@ -172,13 +190,23 @@
>SOP >SOP
</el-button> </el-button>
<el-button
icon="el-icon-lock"
size="mini"
type="primary"
@click="handleApplyRawOutstock(scope.row)"
v-if="scope.row.processType === PROCESS_TYPE.AUTO && scope.row.planId!=null && scope.row.planId!==''"
>投料
</el-button>
<el-button <el-button
icon="el-icon-delete" icon="el-icon-delete"
size="mini" size="mini"
type="danger" type="danger"
@click="handleDeleteDispatchUser(scope.row)" @click="handleDeleteDispatchUser(scope.row)"
v-if="(scope.row.children == null || scope.row.children == undefined) v-if="(scope.row.children == null || false) "
&& (scope.row.planStatus === PLAN_STATUS.STARTED || scope.row.planStatus === PLAN_STATUS.DISPATCHED)" :disabled = "(scope.row.planStatus !== PLAN_STATUS.TO_DISPATCH && scope.row.planStatus !== PLAN_STATUS.DISPATCHED) || form.orderStatus===ORDER_STATUS.FINISHED || form.orderStatus===ORDER_STATUS.RECALLED || form.orderStatus===ORDER_STATUS.DELETED"
>删除 >删除
</el-button> </el-button>
@ -190,7 +218,10 @@
</el-form> </el-form>
<el-form label-width="100px"> <el-form label-width="100px">
<el-form-item style="text-align: center;margin-left:-100px;margin-top:10px;"> <el-form-item style="text-align: center;margin-left:-100px;margin-top:10px;">
<el-button type="primary" @click="submitForm()"></el-button> <el-button type="primary" @click="submitForm()"
v-if="form.orderStatus!==ORDER_STATUS.FINISHED && form.orderStatus!==ORDER_STATUS.RECALLED && form.orderStatus!==ORDER_STATUS.DELETED">
提交
</el-button>
<el-button @click="close()"></el-button> <el-button @click="close()"></el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -331,6 +362,12 @@
/> />
</el-dialog> </el-dialog>
<!-- 投料信息对话框 -->
<el-dialog title="投料" :visible.sync="applyRawOutstockOpen" append-to-body>
<apply-raw-outstock ref="applyRawOutstockRef" :defineData="productPlanData"
v-if="applyRawOutstockOpen"></apply-raw-outstock>
</el-dialog>
</div> </div>
</template> </template>
@ -347,7 +384,7 @@ import {
} from "@//api/mes/productplan"; } from "@//api/mes/productplan";
import {deepClone} from "@//utils/index"; import {deepClone} from "@//utils/index";
import {getToken} from "@//utils/auth"; import {getToken} from "@//utils/auth";
import applyRawOutstock from '@//views/wms/common/applyRawOutstock.vue';
let id = 0 let id = 0
let deepSearch = (arr, target) => { let deepSearch = (arr, target) => {
@ -372,7 +409,10 @@ let deepSearch = (arr, target) => {
export default { export default {
name: "productPlanEdit", name: "productPlanEdit",
dicts: ['product_status', 'mes_dispatch_flag'], dicts: ['plan_status','product_status', 'mes_dispatch_flag'],
components: {
'apply-raw-outstock': applyRawOutstock,
},
props: { props: {
value: [String, Object, Array, Number], value: [String, Object, Array, Number],
// //
@ -421,10 +461,14 @@ export default {
//ID //ID
toDeletedPlanIds: [], toDeletedPlanIds: [],
applyRawOutstockOpen: false,
productPlanData: {},
// //
info: {}, info: {},
// //
form: {}, form: {},
//23
autoProcessFlag: false,
// //
rules: { rules: {
productOrderId: [ productOrderId: [
@ -478,7 +522,10 @@ export default {
MANUAL: '1', MANUAL: '1',
AUTO: '3', AUTO: '3',
}, },
DISPLAY_FLAG: {
YES: '1',
NO: '0',
},
PLAN_STATUS: { PLAN_STATUS: {
TO_DISPATCH: '0',// TO_DISPATCH: '0',//
DISPATCHED: '1',// DISPATCHED: '1',//
@ -486,8 +533,17 @@ export default {
FINISHED: '3' // FINISHED: '3' //
}, },
SALE_TYPE:{ ORDER_STATUS: {
INTERNAL:'2',// TO_PUBLISHED: '0',//
PUBLISHED: '1',//
FINISHED: '2',//
STARTED: '3',//
PAUSE: '4',//
RECALLED: '8',//
DELETED: '9',//
},
SALE_TYPE: {
INTERNAL: '2',//
}, },
id: 1, id: 1,
@ -524,10 +580,7 @@ export default {
// this.mesProductPlanList.push(e); // this.mesProductPlanList.push(e);
// }) // })
}) })
}); });
}, },
groupProductPlans(productPlans) { groupProductPlans(productPlans) {
@ -548,6 +601,7 @@ export default {
// console.log(processId + ": " + JSON.stringify(groupedProductPlans[processId])); // console.log(processId + ": " + JSON.stringify(groupedProductPlans[processId]));
let obj = {}; let obj = {};
//
let dispatchCode = dispatchCodeProcessId.split("-")[0]; let dispatchCode = dispatchCodeProcessId.split("-")[0];
if (!firstDispatch[dispatchCode]) { if (!firstDispatch[dispatchCode]) {
firstDispatch[dispatchCode] = "1"; firstDispatch[dispatchCode] = "1";
@ -556,24 +610,33 @@ export default {
obj.id = this.id obj.id = this.id
this.id = this.id + 1; this.id = this.id + 1;
obj.addFlag = "0";
let i = 0; let i = 0;
let processType; let processType;
productPlansByDispatch.forEach(groupedProductPlan => { productPlansByDispatch.forEach(groupedProductPlan => {
if(groupedProductPlan.planStatus !== this.PLAN_STATUS.FINISHED){
obj.addFlag = "1";
}
processType = groupedProductPlan.processType; processType = groupedProductPlan.processType;
groupedProductPlan.id = this.id; groupedProductPlan.id = this.id;
this.id = this.id + 1; this.id = this.id + 1;
groupedProductPlan.productionTime = groupedProductPlan.productionTime / 60 / 60; groupedProductPlan.productionTime = parseFloat((groupedProductPlan.productionTime / 60 / 60).toFixed(1));
obj.sopId = groupedProductPlan.sopId; obj.sopId = groupedProductPlan.sopId;
obj.attachId = groupedProductPlan.attachId; obj.attachId = groupedProductPlan.attachId;
obj.productionTime = parseFloat((groupedProductPlan.processProductionTime / 60 / 60).toFixed(1));
if (i === 0 || groupedProductPlan.processType !== this.PROCESS_TYPE.MANUAL) { if (i === 0 || groupedProductPlan.processType !== this.PROCESS_TYPE.MANUAL) {
obj.dispatchCode = groupedProductPlan.dispatchCode; obj.dispatchCode = groupedProductPlan.dispatchCode;
obj.planCode = groupedProductPlan.planCode;
obj.dispatchAmount = groupedProductPlan.dispatchAmount; obj.dispatchAmount = groupedProductPlan.dispatchAmount;
obj.processId = groupedProductPlan.processId; obj.processId = groupedProductPlan.processId;
obj.processName = groupedProductPlan.processName; obj.processName = groupedProductPlan.processName;
obj.lastProcessId = groupedProductPlan.lastProcessId; obj.lastProcessId = groupedProductPlan.lastProcessId;
obj.processType = groupedProductPlan.processType; obj.processType = groupedProductPlan.processType;
obj.processOrder = groupedProductPlan.processOrder; obj.processOrder = groupedProductPlan.processOrder;
obj.displayFlag = groupedProductPlan.displayFlag;
obj.finalProcessFlag = groupedProductPlan.finalProcessFlag;
obj.planBeginTime = this.form.planBeginTime; obj.planBeginTime = this.form.planBeginTime;
obj.planEndTime = this.form.planEndTime; obj.planEndTime = this.form.planEndTime;
@ -592,7 +655,7 @@ export default {
let cloneObj = deepClone(obj); let cloneObj = deepClone(obj);
cloneObj.id = this.id cloneObj.id = this.id
cloneObj.planId = groupedProductPlan.planId; cloneObj.planId = groupedProductPlan.planId;
cloneObj.productionTime = groupedProductPlan.productionTime / 60 / 60; cloneObj.productionTime = parseFloat((groupedProductPlan.productionTime / 60 / 60).toFixed(1));
this.id = this.id + 1; this.id = this.id + 1;
cloneObj.children = []; cloneObj.children = [];
this.mesProductPlanList.push(cloneObj); this.mesProductPlanList.push(cloneObj);
@ -619,7 +682,19 @@ export default {
} }
}) })
}, },
addProcessUser(scope) { addProcessUser(scope) {
let finishStatus = this.PLAN_STATUS.FINISHED
const filterPlanList = this.mesProductPlanList.filter(function (item) {
return scope.row.dispatchCode + "-" + scope.row.processId === item.dispatchCode + "-" + item.processId
&& item.planStatus !== finishStatus;
})
if (filterPlanList.length <= 0) {
this.$modal.msgError("此工序已经完成,不能添加");
return;
}
let data = deepSearch(this.mesProductPlanList, scope.row.id)?.[0] let data = deepSearch(this.mesProductPlanList, scope.row.id)?.[0]
let id = this.id + 1 let id = this.id + 1
this.id += 1; this.id += 1;
@ -628,6 +703,7 @@ export default {
this.$set(data.children, data.children.length, { this.$set(data.children, data.children.length, {
id: id, id: id,
processId: scope.row.processId, processId: scope.row.processId,
productionTime: scope.row.productionTime,
planStatus: this.PLAN_STATUS.DISPATCHED, planStatus: this.PLAN_STATUS.DISPATCHED,
userId: "" userId: ""
}) })
@ -636,6 +712,7 @@ export default {
{ {
id: id, id: id,
processId: scope.row.processId, processId: scope.row.processId,
productionTime: scope.row.productionTime,
planStatus: this.PLAN_STATUS.DISPATCHED, planStatus: this.PLAN_STATUS.DISPATCHED,
userId: "", userId: "",
} }
@ -680,11 +757,13 @@ export default {
for (let j = 0; j < e.children.length; j++) { for (let j = 0; j < e.children.length; j++) {
let processUser = e.children[j]; let processUser = e.children[j];
let toUpdatedProductPlan = deepClone(e); let toUpdatedProductPlan = deepClone(e);
if (processUser.userId && processUser.userId !== '') { if (processUser.userId && processUser.userId !== '') {
toUpdatedProductPlan.userId = processUser.userId; toUpdatedProductPlan.userId = processUser.userId;
toUpdatedProductPlan.planBeginTime = processUser.planBeginTime; toUpdatedProductPlan.planBeginTime = processUser.planBeginTime;
toUpdatedProductPlan.planEndTime = processUser.planEndTime; toUpdatedProductPlan.planEndTime = processUser.planEndTime;
toUpdatedProductPlan.planId = processUser.planId; toUpdatedProductPlan.planId = processUser.planId;
toUpdatedProductPlan.planStatus = processUser.planStatus;
toUpdatedProductPlan.attachId = e.attachId; toUpdatedProductPlan.attachId = e.attachId;
toUpdatedProductPlan.sopId = e.sopId; toUpdatedProductPlan.sopId = e.sopId;
toUpdatedProductPlan.children = null; toUpdatedProductPlan.children = null;
@ -697,7 +776,7 @@ export default {
dispatchFlag = true; dispatchFlag = true;
} else { } else {
this.$modal.msgError(undispathDesc); this.$modal.msgError(undispathDesc);
return;
} }
} }
} else { } else {
@ -710,7 +789,6 @@ export default {
} }
} }
// ( + <= ) // ( + <= )
// processIdplanAmountplanAmount // processIdplanAmountplanAmount
let dispatchAmountErrorMsg = ""; let dispatchAmountErrorMsg = "";
@ -780,6 +858,22 @@ export default {
this.$modal.confirm('是否确认删除生产派工单号为"' + dispatchCode + '"的数据项?').then(function () { this.$modal.confirm('是否确认删除生产派工单号为"' + dispatchCode + '"的数据项?').then(function () {
return true; return true;
}).then(() => { }).then(() => {
if(this.form.orderStatus === this.ORDER_STATUS.RECALLED){
this.$modal.msgError("此生产任务已经撤回,不能删除") ;
return;
}
if(this.form.orderStatus === this.ORDER_STATUS.FINISHED){
this.$modal.msgError("此生产任务已经完成,不能删除") ;
return;
}
if(this.form.orderStatus === this.ORDER_STATUS.DELETED){
this.$modal.msgError("此生产任务已经删除,不能删除") ;
return;
}
if (scope.row.newFlag != null || scope.row.newFlag === '1') { if (scope.row.newFlag != null || scope.row.newFlag === '1') {
// //
this.mesProductPlanList = this.mesProductPlanList.filter(function (item) { this.mesProductPlanList = this.mesProductPlanList.filter(function (item) {
@ -862,16 +956,17 @@ export default {
obj.processType = e.processType; obj.processType = e.processType;
obj.processOrder = e.processOrder; obj.processOrder = e.processOrder;
obj.finalProcessFlag = e.finalProcessFlag; obj.finalProcessFlag = e.finalProcessFlag;
obj.productionTime = 0; obj.productionTime = e.productionTime ? parseFloat((e.productionTime / 60 / 60).toFixed(1)) : 0;
obj.planBeginTime = this.form.planBeginTime; obj.planBeginTime = this.form.planBeginTime;
obj.planEndTime = this.form.planEndTime; obj.planEndTime = this.form.planEndTime;
obj.planStatus = '1'; obj.planStatus = '1';
// obj.dispatchAmount = this.form.planAmount - this.form.dispatchAmount; // obj.dispatchAmount = this.form.planAmount - this.form.dispatchAmount;
obj.dispatchFlag = null; obj.dispatchFlag = null;
if(this.form.saleType === this.SALE_TYPE.INTERNAL){ if (this.form.saleType === this.SALE_TYPE.INTERNAL) {
obj.materialId = this.form.produceMaterialId; obj.materialId = this.form.produceMaterialId;
}else{ } else {
obj.materialId = this.form.materialId; obj.materialId = this.form.materialId;
} }
@ -896,7 +991,8 @@ export default {
obj.children = [{ obj.children = [{
id: this.id, id: this.id,
processId: obj.processId, processId: obj.processId,
planStatus: this.PLAN_STATUS.DISPATCHED planStatus: this.PLAN_STATUS.DISPATCHED,
productionTime: obj.productionTime
}] }]
} }
@ -1149,8 +1245,16 @@ export default {
}, },
handleApplyRawOutstock(row) {
if (row.processType === this.PROCESS_TYPE.AUTO) {
this.applyRawOutstockOpen = true;
this.productPlanData.planCode = row.planCode;
this.productPlanData.planId = row.planId;
this.productPlanData.dispatchAmount = row.dispatchAmount;
this.productPlanData.saleOrderId = this.form.saleOrderId;
} }
, }
},
mounted() { mounted() {
} }

Loading…
Cancel
Save