MES:
生产工单完善:修改时判断状态,查询优化
master
xs 3 months ago
parent a2e6f28126
commit 4b477a3e4e

@ -48,7 +48,7 @@ public class MesProductOrderController extends BaseController {
@GetMapping("/list")
public TableDataInfo list(MesProductOrder mesProductOrder) {
startPage();
List<MesProductOrder> list = mesProductOrderService.selectMesProductOrderList(mesProductOrder);
List<MesProductOrder> list = mesProductOrderService.selectMesProductOrderJoinList(mesProductOrder);
return getDataTable(list);
}

@ -74,4 +74,16 @@ public interface MesProductOrderMapper
*/
List<MesProductOrder> selectMesProductOrderListByPreOrderId(Long productOrderId);
/**
* ,join
*
* @param mesProductOrder
* @return
*/
public List<MesProductOrder> selectMesProductOrderJoinList(MesProductOrder mesProductOrder);
}

@ -29,6 +29,14 @@ public interface IMesProductOrderService
*/
public List<MesProductOrder> selectMesProductOrderList(MesProductOrder mesProductOrder);
/**
* ,join
*
* @param mesProductOrder
* @return
*/
public List<MesProductOrder> selectMesProductOrderJoinList(MesProductOrder mesProductOrder);
/**
*
*

@ -66,6 +66,21 @@ public class MesProductOrderServiceImpl implements IMesProductOrderService {
return mesProductOrderMapper.selectMesProductOrderList(mesProductOrder);
}
/**
* ,join
*
* @param mesProductOrder
* @return
*/
@Override
public List<MesProductOrder> selectMesProductOrderJoinList(MesProductOrder mesProductOrder) {
mesProductOrder.setMaterialSpec(StringUtils.isNotEmpty(mesProductOrder.getMaterialSpec())
? mesProductOrder.getMaterialSpec().replaceAll("\\s+", "") : "");
return mesProductOrderMapper.selectMesProductOrderJoinList(mesProductOrder);
}
/**
*
*
@ -75,6 +90,12 @@ public class MesProductOrderServiceImpl implements IMesProductOrderService {
@Override
public int insertMesProductOrder(MesProductOrder mesProductOrder) {
mesProductOrder.setCreateTime(DateUtils.getNowDate());
//校验如果有前置任务,则开始时间不能小于前置任务的结束时间
// if(mesProductOrder.getPreOrderId()!=null){
// checkPreTime(mesProductOrder);
// }
//校验同一工艺路线时间重叠
checkSameProcessTimeClash(mesProductOrder);
//销售订单添加工单:校验是否超出销售数量
@ -105,8 +126,40 @@ public class MesProductOrderServiceImpl implements IMesProductOrderService {
*/
@Override
public int updateMesProductOrder(MesProductOrder mesProductOrder) {
//校验当前数据库生产工单状态
MesProductOrder dbProductOrder = mesProductOrderMapper.selectMesProductOrderByProductOrderId(mesProductOrder.getProductOrderId());
if (!dbProductOrder.getOrderStatus().equals(MesConstants.UN_PUBLISH)) {
String orderStatusPrompt = MesConstants.ORDER_STATUS_PROMPT_MAP.get(dbProductOrder.getOrderStatus());
throw new ServiceException(String.format("此生产任务已经%s,不能修改!", orderStatusPrompt));
}
//如果修改了前置任务,则开始时间不能小于前置任务的结束时间
// if(mesProductOrder.getPreOrderId()!=null && !mesProductOrder.getPreOrderId().equals(dbProductOrder.getPreOrderId())){
// checkPreTime(mesProductOrder);
// }
//如果修改前置任务,导致计划时间变化,则有后置任务的导致不能修改,则需要先修改后置任务,将后置任务的前置任务删除(或者后续优化排查页面,可以统一修改未完成的)
//如果计划开始时间或计划结束时间有变化,则需要校验有没有前置任务是此任务的,如果有则不能修改,需要在排产页面修改
// if (!mesProductOrder.getPlanBeginTime().equals(dbProductOrder.getPlanBeginTime()) ||
// !mesProductOrder.getPlanEndTime().equals(dbProductOrder.getPlanEndTime())) {
// MesProductOrder queryProductOrder = new MesProductOrder();
// queryProductOrder.setPreOrderId(mesProductOrder.getProductOrderId());
// List<MesProductOrder> postProductOrders = mesProductOrderMapper.selectMesProductOrderList(queryProductOrder);
// if (postProductOrders != null && !postProductOrders.isEmpty()) {
// List<MesProductOrder> filterPostProductOrders = postProductOrders.stream().filter(ppo ->
// !ppo.getOrderStatus().equals(MesConstants.RECALL) && !ppo.getOrderStatus().equals(MesConstants.DELETE)
// ).collect(Collectors.toList());
//
// if (filterPostProductOrders != null && !filterPostProductOrders.isEmpty()) {
// throw new ServiceException("已经有生产任务的前置任务是此生产任务,可以在排产页面统一修改时间");
// }
// }
// }
//校验同一工艺路线时间重叠
checkSameProcessTimeClash(mesProductOrder);
//销售订单修改工单:校验是否超出销售数量
if (StringUtils.isNotEmpty(mesProductOrder.getSaleOrderFlag())
&& mesProductOrder.getSaleOrderFlag().equals("1")
@ -117,6 +170,21 @@ public class MesProductOrderServiceImpl implements IMesProductOrderService {
return mesProductOrderMapper.updateMesProductOrder(mesProductOrder);
}
/**
*
* @param mesProductOrder
*/
private void checkPreTime(MesProductOrder mesProductOrder) {
MesProductOrder preProductOrder = mesProductOrderMapper.selectMesProductOrderByProductOrderId(mesProductOrder.getPreOrderId());
Date prePlanEndTime = preProductOrder.getPlanEndTime();
long prePlanEndTimeL = prePlanEndTime.getTime();
Date planBeginTime = mesProductOrder.getPlanBeginTime();
long planBeginTimeL = planBeginTime.getTime();
if(planBeginTimeL < prePlanEndTimeL){
throw new ServiceException("计划开始时间不能小于前置任务的计划结束时间:"+prePlanEndTime);
}
}
/**
*
*
@ -150,6 +218,7 @@ public class MesProductOrderServiceImpl implements IMesProductOrderService {
/**
* 线
*
* @param mesProductOrder
*/
private void checkSameProcessTimeClash(MesProductOrder mesProductOrder) {

@ -60,8 +60,8 @@ export default {
}
::-webkit-scrollbar {
width: 6px;
height: 6px;
width: 16px;
height: 16px;
}
::-webkit-scrollbar-track {

@ -17,26 +17,41 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<!-- <el-form-item label="物料ID" prop="materialId">-->
<!-- <el-input-->
<!-- v-model="queryParams.materialId"-->
<!-- placeholder="请输入物料ID"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="派工类型" prop="dispatchType">-->
<!-- <el-select v-model="queryParams.dispatchType" placeholder="请选择派工类型" clearable>-->
<!-- <el-option-->
<!-- v-for="dict in dict.type.dispatch_type"-->
<!-- :key="dict.value"-->
<!-- :label="dict.label"-->
<!-- :value="dict.value"-->
<!-- />-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<el-form-item label="工单状态" prop="orderStatus">
<el-select v-model="queryParams.orderStatus" placeholder="请选择工单状态" clearable>
<el-form-item label="成品编号" prop="materialCode">
<el-input
v-model="queryParams.materialCode"
placeholder="请输入成品编号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="成品名称" prop="materialName">
<el-input
v-model="queryParams.materialName"
placeholder="请输入成品名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="成品规格" prop="materialSpec">
<el-input
v-model="queryParams.materialSpec"
placeholder="请输入成品规格"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="工艺路线" prop="dispatchId">
<el-select v-model="queryParams.dispatchId" placeholder="请选择工艺路线" clearable>
<el-option v-for="item in routeList" :key="item.routeId" :label="item.routeName"
:value="item.routeId"></el-option>
</el-select>
</el-form-item>
<el-form-item label="任务状态" prop="orderStatus">
<el-select v-model="queryParams.orderStatus" placeholder="请选择任务状态" clearable>
<el-option
v-for="dict in dict.type.plan_status"
:key="dict.value"
@ -119,7 +134,7 @@
<!-- >导出-->
<!-- </el-button>-->
<!-- </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-table v-loading="loading" :data="productOrderList" @selection-change="handleSelectionChange">
@ -134,7 +149,9 @@
<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="projectNo" v-if="columns[5].visible"/>
<el-table-column label="成品编号" align="center" prop="materialCode" v-if="columns[27].visible" width="100"/>
<el-table-column label="成品名称" align="center" prop="materialName" v-if="columns[6].visible" width="100"/>
<el-table-column label="成品规格" align="center" prop="materialSpec" v-if="columns[29].visible" width="100"/>
<el-table-column label="成品BOM" align="center" prop="materialBomDesc" v-if="columns[7].visible" width="120"/>
<el-table-column label="派工类型" align="center" prop="dispatchType" v-if="columns[8].visible">
<template slot-scope="scope">
@ -142,16 +159,18 @@
</template>
</el-table-column>
<el-table-column label="工艺路线" align="center" prop="dispatchName" v-if="columns[9].visible" width="120"/>
<el-table-column label="单位时间" align="center" prop="productionTime" v-if="columns[27].visible">
<!--el-table-column label="单位时间" align="center" prop="productionTime" v-if="columns[27].visible">
<template slot-scope="scope">
<span>{{ formatDayHourMinutes(scope.row.productionTime) }}</span>
</template>
</el-table-column>
</el-table-column-->
<el-table-column label="销售数量" align="center" prop="saleAmount" v-if="columns[10].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="completeAmount" v-if="columns[13].visible"/>
<el-table-column label="前置任务" align="center" prop="preOrderCode"/>
<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>
@ -163,7 +182,9 @@
</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">
<dict-tag :options="dict.type.plan_status" :value="scope.row.orderStatus"/>
</template>
@ -220,7 +241,7 @@
@click="handleUpdate(scope.row)"
v-if="scope.row.orderStatus === MES_ORDER_STATUS.UNPUBLISH"
v-hasPermi="['mes:productOrder:edit']"
>修改工单
>修改
</el-button>
<el-button
size="mini"
@ -287,7 +308,7 @@
@pagination="getList"
/>
<!-- 添加或修改生产工单对话框 -->
<!-- 添加或修改生产任务对话框 -->
<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">
@ -369,8 +390,8 @@
placeholder="请选择计划交货日期">
</el-date-picker>
</el-form-item>
<el-form-item label="前置生产工单" prop="preOrderCode">
<el-input v-model="form.preOrderCode" placeholder="请点击右侧检索生产工单" :disabled="productOrderDisabled"
<el-form-item label="前置生产任务" prop="preOrderCode">
<el-input v-model="form.preOrderCode" placeholder="请点击右侧检索生产任务" :disabled="productOrderDisabled"
readonly>
<el-button slot="append" icon="el-icon-search" @click="handleProductOrderAdd"></el-button>
</el-input>
@ -401,7 +422,7 @@
</div>
</el-dialog>
<!-- 无销售订单添加生产工单对话框 -->
<!-- 无销售订单添加生产任务对话框 -->
<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">
@ -459,8 +480,8 @@
placeholder="请选择计划交货日期">
</el-date-picker>
</el-form-item>
<el-form-item label="前置生产工单" prop="preOrderCode">
<el-input v-model="form.preOrderCode" placeholder="请点击右侧检索生产工单" :disabled="productOrderDisabled"
<el-form-item label="前置生产任务" prop="preOrderCode">
<el-input v-model="form.preOrderCode" placeholder="请点击右侧检索生产任务" :disabled="productOrderDisabled"
readonly>
<el-button slot="append" icon="el-icon-search" @click="handleProductOrderAdd"></el-button>
</el-input>
@ -509,8 +530,8 @@
</div>
</el-dialog>
<!-- 添加生产工单信息对话框 -->
<el-dialog title="选择生产工单信息" :visible.sync="productOrderOpen" width="1000px" append-to-body>
<!-- 添加生产任务信息对话框 -->
<el-dialog title="选择生产任务信息" :visible.sync="productOrderOpen" width="1000px" append-to-body>
<add-product-order @selection="handleSelection" ref="productOrderRef"></add-product-order>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitProductOrderForm"> </el-button>
@ -580,7 +601,7 @@ export default {
showSearch: true,
//
total: 0,
//
//
productOrderList: [],
//
title: "",
@ -610,6 +631,9 @@ export default {
saleorderLinenumber: null,
projectNo: null,
materialId: null,
materialCode: null,
materialName: null,
materialSpec: null,
materialBomId: null,
dispatchType: null,
dispatchId: null,
@ -714,9 +738,9 @@ export default {
{key: 24, label: `更新人`, visible: false},
{key: 25, label: `更新时间`, visible: false},
{key: 26, label: `计划交货日期`, visible: true},
{key: 27, label: `单位时间`, visible: true},
{key: 27, label: `成品编号`, visible: true},
{key: 28, label: `销售类型`, visible: true},
],
{key: 29, label: `成品规格`, visible: true}, ],
//BOM
materialBomList: [],
//线
@ -819,6 +843,35 @@ export default {
},
/** 重置按钮操作 */
resetQuery() {
this.queryParams = {
pageNum: 1,
pageSize: 10,
orderCode: null,
saleOrderId: null,
saleorderCode: null,
saleorderLinenumber: null,
projectNo: null,
materialId: null,
materialBomId: null,
dispatchType: null,
dispatchId: null,
saleAmount: null,
planAmount: null,
dispatchAmount: null,
completeAmount: null,
releaseTime: null,
planDeliveryDate: null,
planBeginTime: null,
planEndTime: null,
realBeginTime: null,
realEndTime: null,
orderStatus: null,
stockLockFlag: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
},
this.resetForm("queryForm");
this.handleQuery();
},
@ -893,10 +946,10 @@ export default {
this.saleOrderOpen = false;
},
/** 提交生产工单信息按钮 */
/** 提交生产任务信息按钮 */
submitProductOrderForm() {
let selectedRow = this.$refs.productOrderRef.selectedRow;
this.form.preOrderId = selectedRow.saleOrderId;
this.form.preOrderId = selectedRow.productOrderId;
this.form.preOrderCode = selectedRow.orderCode;
if (selectedRow.planBeginTime != null && this.form.planBeginTime == null) {
const date = new Date(selectedRow.planBeginTime);
@ -943,7 +996,7 @@ export default {
this.form.orderCode = response.msg;
})
this.open = true;
this.title = "添加生产工单";
this.title = "添加生产任务";
},
/** 新增按钮操作 */
@ -974,7 +1027,7 @@ export default {
})
this.noOrderOpen = true;
this.form.saleOrderFlag = '0';
this.title = "添加生产工单";
this.title = "添加生产任务";
},
/** 修改按钮操作 */
handleUpdate(row) {
@ -993,7 +1046,7 @@ export default {
} else {
this.open = true;
}
this.title = "修改生产工单";
this.title = "修改生产任务";
});
},
@ -1020,8 +1073,8 @@ export default {
const productOrderId = row.productOrderId || this.ids[0];
const orderCode = row.orderCode;
const params = {queryParams: this.queryParams};
this.$tab.closeOpenPage(router.currentRoute);
this.$tab.openPage("工单[" + orderCode + "]生产派工", '/mes/product-plan/index/' + productOrderId, params);
// this.$tab.closeOpenPage(router.currentRoute);
this.$tab.openPage("任务[" + orderCode + "]生产派工", '/mes/product-plan/index/' + productOrderId, params);
});
}).catch(() => {
});
@ -1047,15 +1100,15 @@ export default {
const orderCode = row.orderCode;
const params = {queryParams: this.queryParams};
// this.$tab.closeOpenPage(router.currentRoute);
this.$tab.openPage("工单[" + orderCode + "]生产派工", '/mes/product-plan/index/' + productOrderId, params);
this.$tab.openPage("任务[" + orderCode + "]生产派工", '/mes/product-plan/index/' + productOrderId, params);
},
/** 排产 */
handleProductionScheduling(row) {
const productOrderId = row.productOrderId;
const orderCode = row.orderCode;
const params = {queryParams: this.queryParams};
this.$tab.closeOpenPage(router.currentRoute);
this.$tab.openPage("工单[" + orderCode + "]排产", '/mes/production-scheduling/index/' + productOrderId, params);
// this.$tab.closeOpenPage(router.currentRoute);
this.$tab.openPage("任务[" + orderCode + "]排产", '/mes/production-scheduling/index/' + productOrderId, params);
},
handleMaterialUsage(row) {
@ -1089,7 +1142,7 @@ export default {
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
//
//
if (this.form.saleOrderFlag === '1' && this.form.saleAmount < this.form.planAmount) {
return this.$modal.msgError("计划数量不能大于销售数量!");
}

Loading…
Cancel
Save