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

@ -39,20 +39,20 @@ public class SocketUtils {
while ((bytesRead = inFromServer.read(buffer)) != -1) {
// 处理接收到的数据
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;
}
} catch (SocketTimeoutException e) {
System.err.println("Reading from the socket timed out.");
// System.err.println("Reading from the socket timed out.");
}
} catch (IOException e) {
System.err.println("An I/O error occurred: " + e.getMessage());
// System.err.println("An I/O error occurred: " + e.getMessage());
} finally {
if (socket != null) {
try {
socket.close(); // 在异常情况下也尝试关闭
} 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 com.hw.common.security.utils.SecurityUtils;
import com.hw.mes.domain.MesBaseRouteProcess;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
@ -79,7 +80,8 @@ public class MesBaseRouteController extends BaseController
@GetMapping(value = "/{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 displayFlag;
private Long processProductionTime;
public Long getSaleOrderId() {
return saleOrderId;
@ -538,6 +541,22 @@ public class MesProductPlan extends BaseEntity
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
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

@ -333,16 +333,28 @@ public class MesProductPlanDetailServiceImpl implements IMesProductPlanDetailSer
throw new ServiceException("完成数量超出派工数量");
}
mesProductOrder.setCompleteAmount(newOrderCompleteAmount);
//查询同一工序其他派工人的情况
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);
if (newOrderCompleteAmount.compareTo(mesProductOrder.getPlanAmount()) == 0) {
mesProductOrder.setOrderStatus(MesConstants.FINISHED);
mesProductOrder.setRealEndTime(currentDate);
}
if (newOrderCompleteAmount.compareTo(mesProductOrder.getPlanAmount()) == 0) {
mesProductOrder.setOrderStatus(MesConstants.FINISHED);
mesProductOrder.setRealEndTime(currentDate);
mesProductOrder.setUpdateTime(currentDate);
mesProductOrder.setUpdateBy(userName);
mesProductOrderMapper.updateMesProductOrder(mesProductOrder);
}
mesProductOrder.setUpdateTime(currentDate);
mesProductOrder.setUpdateBy(userName);
mesProductOrderMapper.updateMesProductOrder(mesProductOrder);
}
dbProductPlan.setCompleteAmount(newComplementAmount);
@ -528,9 +540,9 @@ public class MesProductPlanDetailServiceImpl implements IMesProductPlanDetailSer
throw new ServiceException("配对条码有误,未找到原材料条码信息");
}
if(StringUtils.isNotEmpty(bindBarcodeInfo.getSafeFlag()) &&
bindBarcodeInfo.getSingleFlag().equals(MesConstants.MES_BARCODE_SINGLE_FLAG_INTERNAL)){//对内生产
if(StringUtils.isEmpty(bindBarcodeInfo.getProductBarcode())){
if (StringUtils.isNotEmpty(bindBarcodeInfo.getSafeFlag()) &&
bindBarcodeInfo.getSingleFlag().equals(MesConstants.MES_BARCODE_SINGLE_FLAG_INTERNAL)) {//对内生产
if (StringUtils.isEmpty(bindBarcodeInfo.getProductBarcode())) {
throw new ServiceException("未按成品条码生成原材料条码");
}
}

@ -229,7 +229,10 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService {
public int orderAddMesProductPlanList(MesProductPlanEditVo mesProductPlanEditVo) {
String userName = SecurityUtils.getUsername();
Date currentDate = new Date();
List<MesProductPlan> mesProductPlanList = mesProductPlanEditVo.getMesProductPlanList();
/**plan
* productplanplan
*/
Long[] toDeletedPlanIds = mesProductPlanEditVo.getToDeletedPlanIds();
if (toDeletedPlanIds != null && toDeletedPlanIds.length > 0) {
for (Long toDeletedPlanId : toDeletedPlanIds) {
@ -242,12 +245,48 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService {
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) {
Long planId = mesProductPlan.getPlanId();
if (planId != null) {
mesProductPlan.setUpdateBy(userName);
mesProductPlan.setUpdateTime(currentDate);
mesProductPlanMapper.updateMesProductPlan(mesProductPlan);
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.setUpdateTime(currentDate);
//不更新以下字段
mesProductPlan.setPlanCode(null);
mesProductPlan.setDispatchCode(null);
mesProductPlan.setPlanStatus(null);
mesProductPlan.setRealBeginTime(null);
mesProductPlan.setRealEndTime(null);
mesProductPlanMapper.updateMesProductPlan(mesProductPlan);
}
} else {
mesProductPlan.setPlanAmount(mesProductPlan.getDispatchAmount());
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.setUpdateTime(currentDate);
mesProductOrder.setUpdateBy(userName);
@ -277,6 +307,21 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService {
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
*

@ -87,6 +87,7 @@
from mes_base_route a
left join mes_base_route_process b on b.route_id = a.route_id
where a.route_id = #{routeId}
order by b.process_order
</select>
<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="updateTime != null ">and mpo.update_time = #{updateTime}</if>
</where>
order by mpo.sale_order_id desc, mpo.product_order_id desc
order by mpo.product_order_id desc
</select>
<select id="selectMesProductOrderByProductOrderId" parameterType="Long" resultMap="MesProductOrderResult">

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

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

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

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

@ -70,7 +70,7 @@
<el-table-column label="工艺路线ID" align="center" prop="routeId" v-if="columns[0].visible"/>
<el-table-column label="工艺路线名称" align="center" prop="routeName" v-if="columns[1].visible"/>
<el-table-column label="工艺路线说明" align="center" prop="routeDesc" v-if="columns[2].visible"/>
<el-table-column label="单位时间" align="center" prop="productionTime" v-if="columns[9].visible">
<el-table-column label="单位时间" align="center" prop="productionTime" v-if="columns[9].visible">
<template slot-scope="scope">
<span>{{ formatDayHourMinutes(scope.row.productionTime) }}</span>
</template>
@ -161,12 +161,12 @@
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAddMesBaseRouteProcess"
>添加
>添加
</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="danger" icon="el-icon-delete" size="mini" @click="handleDeleteMesBaseRouteProcess"
>删除
>删除
</el-button>
</el-col>
<el-col :span="1.5">
@ -421,8 +421,10 @@ export default {
},
/** 工艺路线组成信息序号 */
rowMesBaseRouteProcessIndex({row, rowIndex}) {
row.index = rowIndex + 1;
row.processOrder = (rowIndex + 1) * 10;
if (!row.processOrder) {
row.index = rowIndex + 1;
row.processOrder = (rowIndex + 1) * 10;
}
},
/** 工艺路线组成信息添加按钮操作 */
handleAddMesBaseRouteProcess() {

@ -1,10 +1,10 @@
<template>
<div class="app-container">
<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
v-model="queryParams.orderCode"
placeholder="请输入工单编号"
placeholder="请输入任务编号"
clearable
@keyup.enter.native="handleQuery"
/>
@ -125,7 +125,7 @@
<el-table v-loading="loading" :data="productOrderList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center"/>
<el-table-column label="主键标识" align="center" prop="productOrderId" v-if="columns[0].visible"/>
<el-table-column label="工单编号" align="center" prop="orderCode" v-if="columns[1].visible" 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">
<template slot-scope="scope">
<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="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="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">
<template slot-scope="scope">
<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>
</template>
</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">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.realBeginTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
@ -257,7 +260,6 @@
type="text"
icon="el-icon-right"
@click="handleDispatch(scope.row)"
v-if="(scope.row.orderStatus === MES_ORDER_STATUS.PUBLISHED || scope.row.orderStatus === MES_ORDER_STATUS.STARTED)"
>生产派工
</el-button>
</template>
@ -275,8 +277,8 @@
<!-- 添加或修改生产工单对话框 -->
<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-item label="工单编号" prop="orderCode">
<el-input v-model="form.orderCode" placeholder="请输入工单编号" :disabled="true"/>
<el-form-item label="任务编号" prop="orderCode">
<el-input v-model="form.orderCode" placeholder="请输入任务编号" :disabled="true"/>
</el-form-item>
<el-form-item label="销售类型" prop="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-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-form-item>
<el-form-item label="销售类型" prop="saleType">
@ -417,6 +419,12 @@
></el-option>
</el-select>
</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-select v-model="form.dispatchId" filterable placeholder="请选择工艺路线" clearable>
<el-option
@ -481,7 +489,7 @@
<!-- 添加物料信息对话框 -->
<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">
<el-button type="primary" @click="submitMaterialForm"> </el-button>
<el-button @click="materialOpen = false"> </el-button>
@ -592,7 +600,7 @@ export default {
//
rules: {
orderCode: [
{required: true, message: "工单编号不能为空", trigger: "blur"}
{required: true, message: "任务编号不能为空", trigger: "blur"}
],
saleOrderId: [
{required: true, message: "销售订单ID不能为空", trigger: "blur"}
@ -645,7 +653,7 @@ export default {
},
columns: [
{key: 0, label: `主键标识`, visible: false},
{key: 1, label: `工单编号`, visible: true},
{key: 1, label: `任务编号`, visible: true},
{key: 2, label: `销售订单ID`, visible: false},
{key: 3, label: `销售订单编号`, visible: true},
{key: 4, label: `销售订单行号`, visible: false},
@ -797,14 +805,13 @@ export default {
/** 提交物料信息按钮 */
submitMaterialForm() {
let selectedRow = this.$refs.materialRef.selectedRow;
alert("--"+this.selectType)
if (this.selectType === this.MATERIAL_TYPE.RAW) {
this.form.produceMaterialId = selectedRow.materialId;
this.$set(this.form, 'produceMaterialName', selectedRow.materialName)
// this.form.produceMaterialName = selectedRow.materialName;//
} else {
this.form.materialId = selectedRow.materialId;
this.form.materialName = selectedRow.materialName;
this.$set(this.form, 'materialName', selectedRow.materialName)
getMaterialVisionList(this.form.materialId).then(response => {
this.materialBomList = response.data
if (this.materialBomList.length !== 0) {
@ -902,7 +909,7 @@ export default {
handleMaterialAdd() {
if (!this.materialDisabled) {
this.materialOpen = true;
this.selectType = this.MATERIAL_TYPE.PRODUCT;//
this.selectType = '';
}
},
@ -963,7 +970,7 @@ export default {
handlePublish(row) {
this.form.productOrderId = row.productOrderId;
this.form.orderStatus = row.orderStatus;
this.$modal.confirm('是否确认发布生产工单编号为"' + row.orderCode + '"的数据项?').then(function () {
this.$modal.confirm('是否确认发布生产任务编号为"' + row.orderCode + '"的数据项?').then(function () {
return true;
}).then(() => {
productOrderPublish(this.form).then(response => {
@ -982,7 +989,7 @@ export default {
/** 撤回 */
handleRecall(row) {
this.form.productOrderId = row.productOrderId;
this.$modal.confirm('是否确认撤回生产工单编号为"' + row.orderCode + '"的数据项?').then(function () {
this.$modal.confirm('是否确认撤回生产任务编号为"' + row.orderCode + '"的数据项?').then(function () {
return true;
}).then(() => {
productOrderRecall(this.form).then(response => {
@ -1011,7 +1018,6 @@ export default {
},
/** 销售订单新增提交按钮 */
submitForm() {
console.log(this.form)
this.$refs["form"].validate(valid => {
if (valid) {
//
@ -1042,7 +1048,7 @@ export default {
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);
}).then(() => {
this.getList();
@ -1070,7 +1076,7 @@ export default {
// handlePublish(row) {
// this.form.productOrderId = row.productOrderId;
// this.form.orderStatus = row.orderStatus;
// this.$modal.confirm('"' + row.orderCode + '"').then(function () {
// this.$modal.confirm('"' + row.orderCode + '"').then(function () {
// return true;
// }).then(() => {
// productOrderPublish(this.form).then(response => {

@ -6,7 +6,7 @@
</el-divider>
<el-row :gutter="10">
<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="计划开始时间:">{{ parseTime(form.planBeginTime) }}</el-form-item>
<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.materialName }}</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-row>
@ -29,7 +36,9 @@
<el-row :gutter="10" class="mb8">
<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-col>
</el-row>
@ -48,7 +57,7 @@
>
<template slot-scope="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>
</el-table-column>
@ -56,9 +65,14 @@
width="80"
type=""
>
<template slot-scope="scope">
<template slot-scope="scope" v-if="">
<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>
</el-table-column>
@ -116,13 +130,15 @@
<el-table-column align="center" label="派工标准工时(小时)" prop="productionTime" width="180">
<template slot-scope="scope">
<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>
</el-table-column>
<el-table-column align="center" label="计划开始时间" prop="planBeginTime" width="230">
<template slot-scope="scope">
<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
placeholder="请选择计划开始时间"
type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
@ -132,7 +148,8 @@
<el-table-column align="center" label="计划完成时间" prop="planEndTime" width="230">
<template slot-scope="scope">
<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
placeholder="请选择计划完成时间"
type="datetime" value-format="yyyy-MM-dd HH:mm:ss"/>
@ -141,7 +158,8 @@
<el-table-column align="center" label="状态" prop="planStatus" width="150">
<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
v-for="dict in dict.type.product_status"
:key="dict.value"
@ -172,13 +190,23 @@
>SOP
</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
icon="el-icon-delete"
size="mini"
type="danger"
@click="handleDeleteDispatchUser(scope.row)"
v-if="(scope.row.children == null || scope.row.children == undefined)
&& (scope.row.planStatus === PLAN_STATUS.STARTED || scope.row.planStatus === PLAN_STATUS.DISPATCHED)"
v-if="(scope.row.children == null || false) "
: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>
@ -190,7 +218,10 @@
</el-form>
<el-form label-width="100px">
<el-form-item style="text-align: center;margin-left:-100px;margin-top:10px;">
<el-button type="primary" @click="submitForm()"></el-button>
<el-button 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-form-item>
</el-form>
@ -331,6 +362,12 @@
/>
</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>
</template>
@ -347,7 +384,7 @@ import {
} from "@//api/mes/productplan";
import {deepClone} from "@//utils/index";
import {getToken} from "@//utils/auth";
import applyRawOutstock from '@//views/wms/common/applyRawOutstock.vue';
let id = 0
let deepSearch = (arr, target) => {
@ -372,7 +409,10 @@ let deepSearch = (arr, target) => {
export default {
name: "productPlanEdit",
dicts: ['product_status', 'mes_dispatch_flag'],
dicts: ['plan_status','product_status', 'mes_dispatch_flag'],
components: {
'apply-raw-outstock': applyRawOutstock,
},
props: {
value: [String, Object, Array, Number],
//
@ -421,10 +461,14 @@ export default {
//ID
toDeletedPlanIds: [],
applyRawOutstockOpen: false,
productPlanData: {},
//
info: {},
//
form: {},
//23
autoProcessFlag: false,
//
rules: {
productOrderId: [
@ -478,7 +522,10 @@ export default {
MANUAL: '1',
AUTO: '3',
},
DISPLAY_FLAG: {
YES: '1',
NO: '0',
},
PLAN_STATUS: {
TO_DISPATCH: '0',//
DISPATCHED: '1',//
@ -486,8 +533,17 @@ export default {
FINISHED: '3' //
},
SALE_TYPE:{
INTERNAL:'2',//
ORDER_STATUS: {
TO_PUBLISHED: '0',//
PUBLISHED: '1',//
FINISHED: '2',//
STARTED: '3',//
PAUSE: '4',//
RECALLED: '8',//
DELETED: '9',//
},
SALE_TYPE: {
INTERNAL: '2',//
},
id: 1,
@ -524,10 +580,7 @@ export default {
// this.mesProductPlanList.push(e);
// })
})
});
},
groupProductPlans(productPlans) {
@ -548,6 +601,7 @@ export default {
// console.log(processId + ": " + JSON.stringify(groupedProductPlans[processId]));
let obj = {};
//
let dispatchCode = dispatchCodeProcessId.split("-")[0];
if (!firstDispatch[dispatchCode]) {
firstDispatch[dispatchCode] = "1";
@ -556,24 +610,33 @@ export default {
obj.id = this.id
this.id = this.id + 1;
obj.addFlag = "0";
let i = 0;
let processType;
productPlansByDispatch.forEach(groupedProductPlan => {
if(groupedProductPlan.planStatus !== this.PLAN_STATUS.FINISHED){
obj.addFlag = "1";
}
processType = groupedProductPlan.processType;
groupedProductPlan.id = this.id;
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.attachId = groupedProductPlan.attachId;
obj.productionTime = parseFloat((groupedProductPlan.processProductionTime / 60 / 60).toFixed(1));
if (i === 0 || groupedProductPlan.processType !== this.PROCESS_TYPE.MANUAL) {
obj.dispatchCode = groupedProductPlan.dispatchCode;
obj.planCode = groupedProductPlan.planCode;
obj.dispatchAmount = groupedProductPlan.dispatchAmount;
obj.processId = groupedProductPlan.processId;
obj.processName = groupedProductPlan.processName;
obj.lastProcessId = groupedProductPlan.lastProcessId;
obj.processType = groupedProductPlan.processType;
obj.processOrder = groupedProductPlan.processOrder;
obj.displayFlag = groupedProductPlan.displayFlag;
obj.finalProcessFlag = groupedProductPlan.finalProcessFlag;
obj.planBeginTime = this.form.planBeginTime;
obj.planEndTime = this.form.planEndTime;
@ -592,7 +655,7 @@ export default {
let cloneObj = deepClone(obj);
cloneObj.id = this.id
cloneObj.planId = groupedProductPlan.planId;
cloneObj.productionTime = groupedProductPlan.productionTime / 60 / 60;
cloneObj.productionTime = parseFloat((groupedProductPlan.productionTime / 60 / 60).toFixed(1));
this.id = this.id + 1;
cloneObj.children = [];
this.mesProductPlanList.push(cloneObj);
@ -619,7 +682,19 @@ export default {
}
})
},
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 id = this.id + 1
this.id += 1;
@ -628,6 +703,7 @@ export default {
this.$set(data.children, data.children.length, {
id: id,
processId: scope.row.processId,
productionTime: scope.row.productionTime,
planStatus: this.PLAN_STATUS.DISPATCHED,
userId: ""
})
@ -636,6 +712,7 @@ export default {
{
id: id,
processId: scope.row.processId,
productionTime: scope.row.productionTime,
planStatus: this.PLAN_STATUS.DISPATCHED,
userId: "",
}
@ -680,11 +757,13 @@ export default {
for (let j = 0; j < e.children.length; j++) {
let processUser = e.children[j];
let toUpdatedProductPlan = deepClone(e);
if (processUser.userId && processUser.userId !== '') {
toUpdatedProductPlan.userId = processUser.userId;
toUpdatedProductPlan.planBeginTime = processUser.planBeginTime;
toUpdatedProductPlan.planEndTime = processUser.planEndTime;
toUpdatedProductPlan.planId = processUser.planId;
toUpdatedProductPlan.planStatus = processUser.planStatus;
toUpdatedProductPlan.attachId = e.attachId;
toUpdatedProductPlan.sopId = e.sopId;
toUpdatedProductPlan.children = null;
@ -697,7 +776,7 @@ export default {
dispatchFlag = true;
} else {
this.$modal.msgError(undispathDesc);
return;
}
}
} else {
@ -710,7 +789,6 @@ export default {
}
}
// ( + <= )
// processIdplanAmountplanAmount
let dispatchAmountErrorMsg = "";
@ -780,6 +858,22 @@ export default {
this.$modal.confirm('是否确认删除生产派工单号为"' + dispatchCode + '"的数据项?').then(function () {
return true;
}).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') {
//
this.mesProductPlanList = this.mesProductPlanList.filter(function (item) {
@ -862,16 +956,17 @@ export default {
obj.processType = e.processType;
obj.processOrder = e.processOrder;
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.planEndTime = this.form.planEndTime;
obj.planStatus = '1';
// obj.dispatchAmount = this.form.planAmount - this.form.dispatchAmount;
obj.dispatchFlag = null;
if(this.form.saleType === this.SALE_TYPE.INTERNAL){
if (this.form.saleType === this.SALE_TYPE.INTERNAL) {
obj.materialId = this.form.produceMaterialId;
}else{
} else {
obj.materialId = this.form.materialId;
}
@ -896,7 +991,8 @@ export default {
obj.children = [{
id: this.id,
processId: obj.processId,
planStatus: this.PLAN_STATUS.DISPATCHED
planStatus: this.PLAN_STATUS.DISPATCHED,
productionTime: obj.productionTime
}]
}
@ -1039,7 +1135,7 @@ export default {
(res) => {
//
let groupAttachFile = {};
groupAttachFile.dispatchCode = this.addProductPlanObject.dispatchCode;
groupAttachFile.dispatchCode = this.addProductPlanObject.dispatchCode;
groupAttachFile.processId = this.addProductPlanObject.processId;
groupAttachFile.attachId = res.attachId;
groupAttachFile.attachPath = res.imgUrl;
@ -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() {
}

Loading…
Cancel
Save