|
|
|
@ -24,7 +24,6 @@
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
<el-form-item label="订单编码" prop="orderCode">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="queryParams.orderCode"
|
|
|
|
@ -103,7 +102,8 @@
|
|
|
|
|
:disabled="multiple"
|
|
|
|
|
@click="handleUpdateDown"
|
|
|
|
|
v-hasPermi="['mes:pro:workorder:edit']"
|
|
|
|
|
>派发工单</el-button>
|
|
|
|
|
>派发工单
|
|
|
|
|
</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
|
|
|
|
|
<el-col :span="1.5">
|
|
|
|
@ -115,7 +115,8 @@
|
|
|
|
|
:disabled="single"
|
|
|
|
|
@click="handleUpdate"
|
|
|
|
|
v-hasPermi="['mes:pro:workorder:edit']"
|
|
|
|
|
>工单变更</el-button>
|
|
|
|
|
>工单变更
|
|
|
|
|
</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="1.5">
|
|
|
|
|
<el-button
|
|
|
|
@ -126,7 +127,8 @@
|
|
|
|
|
:disabled="multiple"
|
|
|
|
|
@click="handleDelete"
|
|
|
|
|
v-hasPermi="['mes:pro:workorder:remove']"
|
|
|
|
|
>删除</el-button>
|
|
|
|
|
>删除
|
|
|
|
|
</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="1.5">
|
|
|
|
|
<el-button
|
|
|
|
@ -136,7 +138,8 @@
|
|
|
|
|
size="mini"
|
|
|
|
|
@click="handleExport"
|
|
|
|
|
v-hasPermi="['mes:pro:workorder:export']"
|
|
|
|
|
>导出</el-button>
|
|
|
|
|
>导出
|
|
|
|
|
</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="1.5">
|
|
|
|
|
<el-button
|
|
|
|
@ -147,7 +150,8 @@
|
|
|
|
|
size="mini"
|
|
|
|
|
@click="showPrint"
|
|
|
|
|
v-hasPermi="['mes:pro:workorder:export']"
|
|
|
|
|
>打印预览</el-button>
|
|
|
|
|
>打印预览
|
|
|
|
|
</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
|
|
</el-row>
|
|
|
|
@ -441,18 +445,16 @@
|
|
|
|
|
import {
|
|
|
|
|
getWorkOrders,
|
|
|
|
|
listWorkorder,
|
|
|
|
|
getWorkorder,
|
|
|
|
|
delWorkorder,
|
|
|
|
|
downWorkorder,
|
|
|
|
|
addWorkorder,
|
|
|
|
|
updateWorkorder,
|
|
|
|
|
getOrderAndWork,
|
|
|
|
|
getWorkBatchList,
|
|
|
|
|
subChangeWorkOrder,
|
|
|
|
|
checkWorkOrder
|
|
|
|
|
} from '@/api/plan/workorder'
|
|
|
|
|
import moment from 'moment';
|
|
|
|
|
import { getprodLineShift, getProEquipment, getProRoutes, getProShifts } from '@/api/plan/order'
|
|
|
|
|
import { getProEquipment, getProRoutes, getProShifts} from '@/api/plan/order'
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
name: "Workorder",
|
|
|
|
|
dicts: ['product_type', 'workorder_type', 'shift_type'],
|
|
|
|
@ -598,7 +600,123 @@ export default {
|
|
|
|
|
this.getList();
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
// 选择线体改变
|
|
|
|
|
// 派发-工单派发按钮操作
|
|
|
|
|
handleUpdateDown(row) {
|
|
|
|
|
var statusesArray = this.statuses;
|
|
|
|
|
for (var i = 0; i < statusesArray.length; i++) {
|
|
|
|
|
if (statusesArray[i] == 'w1') {//已经下达的不允许操作
|
|
|
|
|
this.$modal.msgError("已经下达的订单不允许操作");
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const workorderIds = row.workorderCode || this.codes;
|
|
|
|
|
this.$modal.confirm('是否确认下发生产工单编号为"' + workorderIds + '"的数据项?').then(function () {
|
|
|
|
|
return downWorkorder(workorderIds);
|
|
|
|
|
}).then(() => {
|
|
|
|
|
this.getList();
|
|
|
|
|
this.$modal.msgSuccess("下发成功");
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
// 变更-工单变更按钮操作
|
|
|
|
|
handleUpdate(row) {
|
|
|
|
|
// 校验是否可以修改
|
|
|
|
|
checkWorkOrder(this.selectWork.workorderId).then(response => {
|
|
|
|
|
if (response.code == 500) {
|
|
|
|
|
this.$message({
|
|
|
|
|
message: '工单已生产,不可变更!',
|
|
|
|
|
type: 'warning'
|
|
|
|
|
})
|
|
|
|
|
return;
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
// 数据初始化
|
|
|
|
|
this.reset();
|
|
|
|
|
this.splitData = [];
|
|
|
|
|
this.productData = [];
|
|
|
|
|
this.splitForm = {
|
|
|
|
|
prodLineCodeArray: [],
|
|
|
|
|
splitNum: null,
|
|
|
|
|
productDate: null,
|
|
|
|
|
shiftId: null,
|
|
|
|
|
routeCode: null,
|
|
|
|
|
}
|
|
|
|
|
this.formFields = []
|
|
|
|
|
|
|
|
|
|
//初始化日期为默认今天
|
|
|
|
|
this.splitForm.productDate = new Date()
|
|
|
|
|
// 获取班次信息
|
|
|
|
|
getProShifts().then(response => {
|
|
|
|
|
this.workShift = response.data
|
|
|
|
|
})
|
|
|
|
|
// 获取工艺信息
|
|
|
|
|
getProRoutes(this.selectWork.productCode).then(response => {
|
|
|
|
|
this.routes = response.data
|
|
|
|
|
getProEquipment(this.selectWork.routeCode).then(response => {
|
|
|
|
|
this.proline = response.data
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
// 获取工艺设备信息
|
|
|
|
|
getProEquipment(this.selectWork.routeCode).then(response2 => {
|
|
|
|
|
this.eRouteOptions = response2.data
|
|
|
|
|
})
|
|
|
|
|
// 获取批次信息list
|
|
|
|
|
getWorkBatchList(this.selectWork).then(response => {
|
|
|
|
|
this.formFields = response.data
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// 获取工单和订单信息
|
|
|
|
|
// 在获取到新的数据后执行以下代码
|
|
|
|
|
this.proLoading = true // 设置加载状态为true,表示正在加载
|
|
|
|
|
this.workerLoading = true // 设置加载状态为true,表示正在加载
|
|
|
|
|
getOrderAndWork(this.selectWork).then(response => {
|
|
|
|
|
this.splitData.push(response.data.workOrder)
|
|
|
|
|
this.productData.push(response.data.order)
|
|
|
|
|
|
|
|
|
|
this.refreshProTable = false // 先将refreshProTable设置为false,隐藏表格
|
|
|
|
|
this.refreshWorkerTable = false // 先将refreshProTable设置为false,隐藏表格
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
// 使用$nextTick来等待DOM更新完成
|
|
|
|
|
this.refreshProTable = true // 立即将refreshProTable设置为true,显示表格
|
|
|
|
|
this.proLoading = false // 设置加载状态为false,表示加载完成
|
|
|
|
|
})
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
// 使用$nextTick来等待DOM更新完成
|
|
|
|
|
this.refreshWorkerTable = true // 立即将refreshProTable设置为true,显示表格
|
|
|
|
|
this.workerLoading = false // 设置加载状态为false,表示加载完成
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// 设置拆分数量
|
|
|
|
|
this.splitForm.splitNum = this.splitData[0].quantitySplit
|
|
|
|
|
// 设置选择机型
|
|
|
|
|
this.splitForm.prodLineCodeArray = response.data.workOrder.prodLineCodeArray
|
|
|
|
|
// 设置班次
|
|
|
|
|
this.splitForm.shiftId = this.splitData[0].shiftDesc
|
|
|
|
|
// 设置工艺
|
|
|
|
|
this.splitForm.routeCode = this.splitData[0].routeCode
|
|
|
|
|
|
|
|
|
|
// 递归将拆分数量还原
|
|
|
|
|
function setAtrr1(order, work) {
|
|
|
|
|
order.quantitySplit = Number(order.quantitySplit) - Number(work.quantitySplit);
|
|
|
|
|
order.atrr1 = work.quantitySplit;
|
|
|
|
|
|
|
|
|
|
if (order.children !== undefined && work.children !== undefined) {
|
|
|
|
|
setAtrr1(order.children[0], work.children[0]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setAtrr1(this.productData[0], this.splitData[0]);
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
this.open = true;
|
|
|
|
|
this.title = "修改生产工单";
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
// 变更-选择线体改变
|
|
|
|
|
changeEquipment() {
|
|
|
|
|
if (this.splitForm.routeCode == null) {
|
|
|
|
|
this.$message({
|
|
|
|
@ -608,43 +726,69 @@ export default {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
// 打印
|
|
|
|
|
handlePrint(params) {
|
|
|
|
|
printJS({
|
|
|
|
|
printable: params.printable, // 'printFrom', // 标签元素id
|
|
|
|
|
type: params.type || 'html',
|
|
|
|
|
maxWidth: 1500, // 最大宽度
|
|
|
|
|
font_size: "",// 设置字体大小
|
|
|
|
|
header: params.header, // '表单',
|
|
|
|
|
targetStyles: ['*'],
|
|
|
|
|
style: '@page {margin:0 10mm};', // 可选-打印时去掉眉页眉尾
|
|
|
|
|
ignoreElements: params.ignore || [], // ['no-print']
|
|
|
|
|
properties: params.properties || null
|
|
|
|
|
// 变更-变更工艺
|
|
|
|
|
routeChange(e) {
|
|
|
|
|
getProEquipment(e).then(response => {
|
|
|
|
|
this.eRouteOptions = response.data
|
|
|
|
|
})
|
|
|
|
|
this.workForm.routeCode = e
|
|
|
|
|
},
|
|
|
|
|
// 打印预览
|
|
|
|
|
showPrint() {
|
|
|
|
|
// 清楚缓存
|
|
|
|
|
this.printData.workCenter = "暂无数据";
|
|
|
|
|
this.printData.printDate = null;
|
|
|
|
|
this.printData.workTable = [];
|
|
|
|
|
this.printData.factory = null;
|
|
|
|
|
this.printData.productDate = null;
|
|
|
|
|
// 打开工单信息对话框
|
|
|
|
|
this.printDialogVisible = true;
|
|
|
|
|
this.printData.printDate = moment(new Date()).format('YYYY.MM.DD');
|
|
|
|
|
this.printData.manufacture = this.$store.state.user.name;
|
|
|
|
|
this.newWorkerLoading = true // 设置加载状态为true,表示正在加载
|
|
|
|
|
this.refreshNewWorkerTable = false // 先将refreshProTable设置为false,隐藏表格
|
|
|
|
|
getWorkOrders(this.selectWork.workorderCode).then(response => {
|
|
|
|
|
this.printData.workTable = response.data;
|
|
|
|
|
this.printData.factory = response.data[0].factoryCode;
|
|
|
|
|
this.printData.productDate = response.data[0].productDate;
|
|
|
|
|
this.refreshNewWorkerTable = true // 立即将refreshProTable设置为true,显示表格
|
|
|
|
|
this.newWorkerLoading = false // 设置加载状态为false,表示加载完成
|
|
|
|
|
// 变更-变更班次
|
|
|
|
|
shiftChange(e) {
|
|
|
|
|
this.workForm.shiftId = e
|
|
|
|
|
},
|
|
|
|
|
// 变更-拆分数量变更
|
|
|
|
|
splitNumChange(e) {
|
|
|
|
|
//不能为负数
|
|
|
|
|
if (e <= 0) {
|
|
|
|
|
e = 1
|
|
|
|
|
this.splitForm.splitNum = 1
|
|
|
|
|
} else {
|
|
|
|
|
// 获取最大值,拆分数量不得超过最大值
|
|
|
|
|
let max = Number(this.productData[0].quantity) - Number(this.productData[0].quantitySplit)
|
|
|
|
|
// 超过最大值,给用户提醒
|
|
|
|
|
if (e > max) {
|
|
|
|
|
this.$message({
|
|
|
|
|
message: '最大值不能超过' + max + '!',
|
|
|
|
|
type: 'warning'
|
|
|
|
|
})
|
|
|
|
|
this.splitForm.splitNum = max
|
|
|
|
|
}
|
|
|
|
|
//前端数据同步
|
|
|
|
|
// 在获取到新的数据后执行以下代码
|
|
|
|
|
this.proLoading = true // 设置加载状态为true,表示正在加载
|
|
|
|
|
|
|
|
|
|
var num = this.productData[0].quantity;
|
|
|
|
|
|
|
|
|
|
// 递归操作动态显示拆分数量
|
|
|
|
|
function setAtrr1(data, splitNum) {
|
|
|
|
|
if (data.children !== undefined) {
|
|
|
|
|
for (let i = 0; i < data.children.length; i++) {
|
|
|
|
|
data.children[i].atrr1 = splitNum * (data.children[i].quantity / num)
|
|
|
|
|
setAtrr1(data.children[i], splitNum)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.productData[0].atrr1 = this.splitForm.splitNum
|
|
|
|
|
setAtrr1(this.productData[0], this.splitForm.splitNum)
|
|
|
|
|
|
|
|
|
|
this.refreshProTable = false // 先将refreshProTable设置为false,隐藏表格
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
// 使用$nextTick来等待DOM更新完成
|
|
|
|
|
this.refreshProTable = true // 立即将refreshProTable设置为true,显示表格
|
|
|
|
|
this.proLoading = false // 设置加载状态为false,表示加载完成
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
this.workForm.splitNum = this.splitForm.splitNum
|
|
|
|
|
}
|
|
|
|
|
this.product = this.productData[0]
|
|
|
|
|
},
|
|
|
|
|
// 变更-工单日期变更
|
|
|
|
|
checkDate(e) {
|
|
|
|
|
this.workForm.productDate = e
|
|
|
|
|
},
|
|
|
|
|
/** 动态添加表单 */
|
|
|
|
|
// 变更-动态添加批次
|
|
|
|
|
addField() {
|
|
|
|
|
//如果批次数量大于等于拆分数量则不允许拆分
|
|
|
|
|
let sum = 0
|
|
|
|
@ -664,11 +808,11 @@ export default {
|
|
|
|
|
//自动填充
|
|
|
|
|
this.formFields[this.formFields.length - 1].batchQuantity = Number(this.productData[0].atrr1) - Number(sum)
|
|
|
|
|
},
|
|
|
|
|
/** 动态删除表单 */
|
|
|
|
|
// 变更-动态删除批次
|
|
|
|
|
removeField(index) {
|
|
|
|
|
this.formFields.splice(index, 1)
|
|
|
|
|
},
|
|
|
|
|
/** 填写批次数量 */
|
|
|
|
|
// 变更-填写批次数量
|
|
|
|
|
inBatch(e) {
|
|
|
|
|
//不能为负数
|
|
|
|
|
if (e <= 0) {
|
|
|
|
@ -695,7 +839,7 @@ export default {
|
|
|
|
|
this.formFields[this.formFields.length - 1].batchQuantity = ''
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
/** 检验批次编码是否重复 */
|
|
|
|
|
// 变更-检验批次编码是否重复
|
|
|
|
|
batchCodeChange(e) {
|
|
|
|
|
if (this.formFields.length > 1) {
|
|
|
|
|
for (let i = 0; i < this.formFields.length - 1; i++) {
|
|
|
|
@ -713,69 +857,135 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
/** 更改工艺 */
|
|
|
|
|
routeChange(e){
|
|
|
|
|
getProEquipment(e).then(response => {
|
|
|
|
|
this.eRouteOptions = response.data
|
|
|
|
|
})
|
|
|
|
|
this.workForm.routeCode = e
|
|
|
|
|
},
|
|
|
|
|
/** 更改班次 */
|
|
|
|
|
shiftChange(e){
|
|
|
|
|
this.workForm.shiftId = e
|
|
|
|
|
},
|
|
|
|
|
/** 拆分数量 */
|
|
|
|
|
splitNumChange(e){
|
|
|
|
|
//不能为负数
|
|
|
|
|
if (e <= 0) {
|
|
|
|
|
e = 1
|
|
|
|
|
this.splitForm.splitNum = 1
|
|
|
|
|
} else {
|
|
|
|
|
// 获取最大值,拆分数量不得超过最大值
|
|
|
|
|
let max = Number(this.productData[0].quantity) - Number(this.productData[0].quantitySplit)
|
|
|
|
|
// 超过最大值,给用户提醒
|
|
|
|
|
if (e > max) {
|
|
|
|
|
// 变更-变更提交按钮
|
|
|
|
|
submitForm() {
|
|
|
|
|
// 判断如果拆分数量不等于拆分批次数量之和
|
|
|
|
|
let sum = 0
|
|
|
|
|
for (let i = 0; i < this.formFields.length; i++) {
|
|
|
|
|
sum = Number(sum) + Number(this.formFields[i].batchQuantity)
|
|
|
|
|
if (this.formFields[i].batchQuantity == '' || this.formFields[i].batchQuantity == null || this.formFields[i].batchCode == null || this.formFields[i].batchCode == '') {
|
|
|
|
|
this.$message({
|
|
|
|
|
message: '最大值不能超过' + max + '!',
|
|
|
|
|
message: '批次数据不能为空',
|
|
|
|
|
type: 'warning'
|
|
|
|
|
})
|
|
|
|
|
this.splitForm.splitNum = max
|
|
|
|
|
}
|
|
|
|
|
//前端数据同步
|
|
|
|
|
// 在获取到新的数据后执行以下代码
|
|
|
|
|
this.proLoading = true // 设置加载状态为true,表示正在加载
|
|
|
|
|
|
|
|
|
|
var num = this.productData[0].quantity;
|
|
|
|
|
// 递归操作动态显示拆分数量
|
|
|
|
|
function setAtrr1(data, splitNum) {
|
|
|
|
|
if (data.children !== undefined) {
|
|
|
|
|
for (let i = 0; i < data.children.length; i++) {
|
|
|
|
|
data.children[i].atrr1 = splitNum * (data.children[i].quantity / num)
|
|
|
|
|
setAtrr1(data.children[i], splitNum)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (sum != this.productData[0].atrr1) {
|
|
|
|
|
this.$message({
|
|
|
|
|
message: '批次数量之和不等于拆分数量',
|
|
|
|
|
type: 'warning'
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.productData[0].atrr1 = this.splitForm.splitNum
|
|
|
|
|
setAtrr1(this.productData[0], this.splitForm.splitNum)
|
|
|
|
|
if (this.workForm.prodLineCode === undefined) {
|
|
|
|
|
this.workForm.prodLineCode = this.selectWork.prodLineName
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.refreshProTable = false // 先将refreshProTable设置为false,隐藏表格
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
// 使用$nextTick来等待DOM更新完成
|
|
|
|
|
this.refreshProTable = true // 立即将refreshProTable设置为true,显示表格
|
|
|
|
|
this.proLoading = false // 设置加载状态为false,表示加载完成
|
|
|
|
|
//下面是请求处理
|
|
|
|
|
const data = {
|
|
|
|
|
formFields: this.formFields,
|
|
|
|
|
prodLineCodeArray: this.splitForm.prodLineCodeArray,
|
|
|
|
|
productDate: this.splitForm.productDate,
|
|
|
|
|
shiftId: this.workForm.shiftId,
|
|
|
|
|
splitNum: this.workForm.splitNum,
|
|
|
|
|
product: this.productData[0],
|
|
|
|
|
routeCode: this.workForm.routeCode,
|
|
|
|
|
proOrderWorkorder: this.selectWork
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
subChangeWorkOrder(data).then(response => {
|
|
|
|
|
if (response.code == 500) {
|
|
|
|
|
this.$modal.msgError(response.msg)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
this.getList()
|
|
|
|
|
this.$modal.msgSuccess('提交成功')
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
this.workForm.splitNum = this.splitForm.splitNum
|
|
|
|
|
let id = this.productData[0].id
|
|
|
|
|
// 清除缓存
|
|
|
|
|
this.splitForm = {
|
|
|
|
|
id: null,
|
|
|
|
|
prodLineCodeArray: [],
|
|
|
|
|
splitNum: null,
|
|
|
|
|
productDate: null,
|
|
|
|
|
shiftId: null,
|
|
|
|
|
formFields: []
|
|
|
|
|
}
|
|
|
|
|
this.product = this.productData[0]
|
|
|
|
|
},
|
|
|
|
|
/** 工单日期选择 */
|
|
|
|
|
checkDate(e){
|
|
|
|
|
this.workForm.productDate = e
|
|
|
|
|
this.formFields = [{
|
|
|
|
|
batchCode: '',
|
|
|
|
|
batchQuantity: ''
|
|
|
|
|
}]
|
|
|
|
|
this.open = false
|
|
|
|
|
},
|
|
|
|
|
// 删除-工单删除按钮操作
|
|
|
|
|
handleDelete(row) {
|
|
|
|
|
|
|
|
|
|
/** 查询生产工单列表 */
|
|
|
|
|
var statusesArray = this.statuses;
|
|
|
|
|
for (var i = 0; i < statusesArray.length; i++) {
|
|
|
|
|
if (statusesArray[i] == 'w1') {//已经下达的不允许操作
|
|
|
|
|
this.$modal.msgError("已经下达的订单不允许操作");
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const workorderIds = row.workorderId || this.ids;
|
|
|
|
|
|
|
|
|
|
const workorderCodes = row.workorderCode || this.codes;
|
|
|
|
|
|
|
|
|
|
this.$modal.confirm('是否确认删除生产工单编号为"' + workorderCodes + '"的数据项?').then(function () {
|
|
|
|
|
return delWorkorder(workorderIds);
|
|
|
|
|
}).then(() => {
|
|
|
|
|
this.getList();
|
|
|
|
|
this.$modal.msgSuccess("删除成功");
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
// 导出-工单list导出按钮操作
|
|
|
|
|
handleExport() {
|
|
|
|
|
this.download('plan/pro/workorder/export', {
|
|
|
|
|
...this.queryParams
|
|
|
|
|
}, `workorder_${new Date().getTime()}.xlsx`)
|
|
|
|
|
},
|
|
|
|
|
// 打印预览-浏览器打印
|
|
|
|
|
handlePrint(params) {
|
|
|
|
|
printJS({
|
|
|
|
|
printable: params.printable, // 'printFrom', // 标签元素id
|
|
|
|
|
type: params.type || 'html',
|
|
|
|
|
maxWidth: 1500, // 最大宽度
|
|
|
|
|
font_size: "",// 设置字体大小
|
|
|
|
|
header: params.header, // '表单',
|
|
|
|
|
targetStyles: ['*'],
|
|
|
|
|
style: '@page {margin:0 10mm};', // 可选-打印时去掉眉页眉尾
|
|
|
|
|
ignoreElements: params.ignore || [], // ['no-print']
|
|
|
|
|
properties: params.properties || null
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
// 打印预览-点击打印预览按钮
|
|
|
|
|
showPrint() {
|
|
|
|
|
// 清楚缓存
|
|
|
|
|
this.printData.workCenter = "暂无数据";
|
|
|
|
|
this.printData.printDate = null;
|
|
|
|
|
this.printData.workTable = [];
|
|
|
|
|
this.printData.factory = null;
|
|
|
|
|
this.printData.productDate = null;
|
|
|
|
|
// 打开工单信息对话框
|
|
|
|
|
this.printDialogVisible = true;
|
|
|
|
|
this.printData.printDate = moment(new Date()).format('YYYY.MM.DD');
|
|
|
|
|
this.printData.manufacture = this.$store.state.user.name;
|
|
|
|
|
this.newWorkerLoading = true // 设置加载状态为true,表示正在加载
|
|
|
|
|
this.refreshNewWorkerTable = false // 先将refreshProTable设置为false,隐藏表格
|
|
|
|
|
getWorkOrders(this.selectWork.workorderCode).then(response => {
|
|
|
|
|
this.printData.workTable = response.data;
|
|
|
|
|
this.printData.factory = response.data[0].factoryCode;
|
|
|
|
|
this.printData.productDate = response.data[0].productDate;
|
|
|
|
|
this.refreshNewWorkerTable = true // 立即将refreshProTable设置为true,显示表格
|
|
|
|
|
this.newWorkerLoading = false // 设置加载状态为false,表示加载完成
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
// 首-查询生产工单列表
|
|
|
|
|
getList() {
|
|
|
|
|
this.loading = true;
|
|
|
|
|
this.queryParams.endFlag = '1';//只查子单
|
|
|
|
@ -795,7 +1005,7 @@ export default {
|
|
|
|
|
this.open = false;
|
|
|
|
|
this.reset();
|
|
|
|
|
},
|
|
|
|
|
// 表单重置
|
|
|
|
|
// 首-表单重置
|
|
|
|
|
reset() {
|
|
|
|
|
this.form = {
|
|
|
|
|
workorderId: null,
|
|
|
|
@ -833,17 +1043,17 @@ export default {
|
|
|
|
|
};
|
|
|
|
|
this.resetForm("form");
|
|
|
|
|
},
|
|
|
|
|
/** 搜索按钮操作 */
|
|
|
|
|
// 首-搜索按钮操作
|
|
|
|
|
handleQuery() {
|
|
|
|
|
this.queryParams.pageNum = 1;
|
|
|
|
|
this.getList();
|
|
|
|
|
},
|
|
|
|
|
/** 重置按钮操作 */
|
|
|
|
|
// 首-重置按钮操作
|
|
|
|
|
resetQuery() {
|
|
|
|
|
this.resetForm("queryForm");
|
|
|
|
|
this.handleQuery();
|
|
|
|
|
},
|
|
|
|
|
// 多选框选中数据
|
|
|
|
|
// 首-多选框选中数据
|
|
|
|
|
handleSelectionChange(selection) {
|
|
|
|
|
// 这里设置选中的工单信息--用于工单变更
|
|
|
|
|
this.selectWork = selection[0]
|
|
|
|
@ -854,226 +1064,12 @@ export default {
|
|
|
|
|
this.multiple = !selection.length
|
|
|
|
|
this.statuses = selection.map(item => item.status)
|
|
|
|
|
},
|
|
|
|
|
/** 新增按钮操作 */
|
|
|
|
|
// 首-新增按钮操作
|
|
|
|
|
handleAdd() {
|
|
|
|
|
alert("待建设")
|
|
|
|
|
//this.reset();
|
|
|
|
|
//this.open = true;
|
|
|
|
|
//this.title = "添加生产工单";
|
|
|
|
|
},
|
|
|
|
|
/** 修改按钮操作 */
|
|
|
|
|
handleUpdate(row) {
|
|
|
|
|
// 除了未派发都不允许修改(改为:未生产前都可以修改)
|
|
|
|
|
//if (this.selectWork.status == "w1"){
|
|
|
|
|
// this.$message({
|
|
|
|
|
// message:'工单已派发!不可修改!',
|
|
|
|
|
// type:'warning'
|
|
|
|
|
// })
|
|
|
|
|
// return;
|
|
|
|
|
//}
|
|
|
|
|
// 校验是否可以修改
|
|
|
|
|
checkWorkOrder(this.selectWork.workorderId).then(response => {
|
|
|
|
|
if (response.code == 500){
|
|
|
|
|
this.$message({
|
|
|
|
|
message:'该工单已有湿料计划,不可修改!',
|
|
|
|
|
type:'warning'
|
|
|
|
|
})
|
|
|
|
|
return;
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
|
|
// 数据初始化
|
|
|
|
|
this.reset();
|
|
|
|
|
this.splitData = [];
|
|
|
|
|
this.productData =[];
|
|
|
|
|
this.splitForm={
|
|
|
|
|
prodLineCodeArray: [],
|
|
|
|
|
splitNum: null,
|
|
|
|
|
productDate: null,
|
|
|
|
|
shiftId: null,
|
|
|
|
|
routeCode: null,
|
|
|
|
|
}
|
|
|
|
|
this.formFields=[]
|
|
|
|
|
|
|
|
|
|
//初始化日期为默认今天
|
|
|
|
|
this.splitForm.productDate = new Date()
|
|
|
|
|
// 获取班次信息
|
|
|
|
|
getProShifts().then(response => {
|
|
|
|
|
this.workShift = response.data
|
|
|
|
|
})
|
|
|
|
|
// 获取工艺信息
|
|
|
|
|
getProRoutes(this.selectWork.productCode).then(response => {
|
|
|
|
|
this.routes = response.data
|
|
|
|
|
getProEquipment(this.selectWork.routeCode).then(response => {
|
|
|
|
|
this.proline = response.data
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
// 获取工艺设备信息
|
|
|
|
|
getProEquipment(this.selectWork.routeCode).then(response2 => {
|
|
|
|
|
this.eRouteOptions = response2.data
|
|
|
|
|
})
|
|
|
|
|
// 获取批次信息list
|
|
|
|
|
getWorkBatchList(this.selectWork).then(response => {
|
|
|
|
|
this.formFields = response.data
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// 获取工单和订单信息
|
|
|
|
|
// 在获取到新的数据后执行以下代码
|
|
|
|
|
this.proLoading = true // 设置加载状态为true,表示正在加载
|
|
|
|
|
this.workerLoading = true // 设置加载状态为true,表示正在加载
|
|
|
|
|
getOrderAndWork(this.selectWork).then(response =>{
|
|
|
|
|
this.splitData.push(response.data.workOrder)
|
|
|
|
|
this.productData.push(response.data.order)
|
|
|
|
|
|
|
|
|
|
this.refreshProTable = false // 先将refreshProTable设置为false,隐藏表格
|
|
|
|
|
this.refreshWorkerTable = false // 先将refreshProTable设置为false,隐藏表格
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
// 使用$nextTick来等待DOM更新完成
|
|
|
|
|
this.refreshProTable = true // 立即将refreshProTable设置为true,显示表格
|
|
|
|
|
this.proLoading = false // 设置加载状态为false,表示加载完成
|
|
|
|
|
})
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
// 使用$nextTick来等待DOM更新完成
|
|
|
|
|
this.refreshWorkerTable = true // 立即将refreshProTable设置为true,显示表格
|
|
|
|
|
this.workerLoading = false // 设置加载状态为false,表示加载完成
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// 设置拆分数量
|
|
|
|
|
this.splitForm.splitNum = this.splitData[0].quantitySplit
|
|
|
|
|
// 设置选择机型
|
|
|
|
|
this.splitForm.prodLineCodeArray = response.data.workOrder.prodLineCodeArray
|
|
|
|
|
// 设置班次
|
|
|
|
|
this.splitForm.shiftId = this.splitData[0].shiftDesc
|
|
|
|
|
// 设置工艺
|
|
|
|
|
this.splitForm.routeCode = this.splitData[0].routeCode
|
|
|
|
|
|
|
|
|
|
// 递归将拆分数量还原
|
|
|
|
|
function setAtrr1(order, work) {
|
|
|
|
|
order.quantitySplit = Number(order.quantitySplit) - Number(work.quantitySplit);
|
|
|
|
|
order.atrr1 = work.quantitySplit;
|
|
|
|
|
|
|
|
|
|
if (order.children !== undefined && work.children !== undefined) {
|
|
|
|
|
setAtrr1(order.children[0], work.children[0]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setAtrr1(this.productData[0], this.splitData[0]);
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
this.open = true;
|
|
|
|
|
this.title = "修改生产工单";
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
/**下达工单**/
|
|
|
|
|
handleUpdateDown(row) {
|
|
|
|
|
var statusesArray = this.statuses;
|
|
|
|
|
for(var i=0; i<statusesArray.length; i++) {
|
|
|
|
|
if(statusesArray[i]=='w1'){//已经下达的不允许操作
|
|
|
|
|
this.$modal.msgError("已经下达的订单不允许操作");
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const workorderIds = row.workorderCode || this.codes;
|
|
|
|
|
this.$modal.confirm('是否确认下发生产工单编号为"' + workorderIds + '"的数据项?').then(function() {
|
|
|
|
|
return downWorkorder(workorderIds);
|
|
|
|
|
}).then(() => {
|
|
|
|
|
this.getList();
|
|
|
|
|
this.$modal.msgSuccess("下发成功");
|
|
|
|
|
}).catch(() => {});
|
|
|
|
|
},
|
|
|
|
|
/** 拆分-提交按钮 */
|
|
|
|
|
submitForm() {
|
|
|
|
|
// 判断如果拆分数量不等于拆分批次数量之和
|
|
|
|
|
let sum = 0
|
|
|
|
|
for (let i = 0; i < this.formFields.length; i++) {
|
|
|
|
|
sum = Number(sum) + Number(this.formFields[i].batchQuantity)
|
|
|
|
|
if (this.formFields[i].batchQuantity == '' || this.formFields[i].batchQuantity == null || this.formFields[i].batchCode == null || this.formFields[i].batchCode == '') {
|
|
|
|
|
this.$message({
|
|
|
|
|
message: '批次数据不能为空',
|
|
|
|
|
type: 'warning'
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (sum != this.productData[0].atrr1) {
|
|
|
|
|
this.$message({
|
|
|
|
|
message: '批次数量之和不等于拆分数量',
|
|
|
|
|
type: 'warning'
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this.workForm.prodLineCode === undefined) {
|
|
|
|
|
this.workForm.prodLineCode = this.selectWork.prodLineName
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//下面是请求处理
|
|
|
|
|
const data = {
|
|
|
|
|
formFields: this.formFields,
|
|
|
|
|
prodLineCodeArray: this.splitForm.prodLineCodeArray,
|
|
|
|
|
productDate: this.splitForm.productDate,
|
|
|
|
|
shiftId: this.workForm.shiftId,
|
|
|
|
|
splitNum: this.workForm.splitNum,
|
|
|
|
|
product: this.productData[0],
|
|
|
|
|
routeCode: this.workForm.routeCode,
|
|
|
|
|
proOrderWorkorder: this.selectWork
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
subChangeWorkOrder(data).then(response => {
|
|
|
|
|
if (response.code == 500) {
|
|
|
|
|
this.$modal.msgError(response.msg)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
this.getList()
|
|
|
|
|
this.$modal.msgSuccess('提交成功')
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
let id = this.productData[0].id
|
|
|
|
|
// 清除缓存
|
|
|
|
|
this.splitForm = {
|
|
|
|
|
id: null,
|
|
|
|
|
prodLineCodeArray: [],
|
|
|
|
|
splitNum: null,
|
|
|
|
|
productDate: null,
|
|
|
|
|
shiftId: null,
|
|
|
|
|
formFields: []
|
|
|
|
|
}
|
|
|
|
|
this.formFields = [{
|
|
|
|
|
batchCode: '',
|
|
|
|
|
batchQuantity: ''
|
|
|
|
|
}]
|
|
|
|
|
this.open = false
|
|
|
|
|
},
|
|
|
|
|
/** 删除按钮操作 */
|
|
|
|
|
handleDelete(row) {
|
|
|
|
|
|
|
|
|
|
var statusesArray = this.statuses;
|
|
|
|
|
for(var i=0; i<statusesArray.length; i++) {
|
|
|
|
|
if(statusesArray[i]=='w1'){//已经下达的不允许操作
|
|
|
|
|
this.$modal.msgError("已经下达的订单不允许操作");
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const workorderIds = row.workorderId || this.ids;
|
|
|
|
|
|
|
|
|
|
const workorderCodes = row.workorderCode || this.codes;
|
|
|
|
|
|
|
|
|
|
this.$modal.confirm('是否确认删除生产工单编号为"' + workorderCodes + '"的数据项?').then(function() {
|
|
|
|
|
return delWorkorder(workorderIds);
|
|
|
|
|
}).then(() => {
|
|
|
|
|
this.getList();
|
|
|
|
|
this.$modal.msgSuccess("删除成功");
|
|
|
|
|
}).catch(() => {});
|
|
|
|
|
},
|
|
|
|
|
/** 导出按钮操作 */
|
|
|
|
|
handleExport() {
|
|
|
|
|
this.download('plan/pro/workorder/export', {
|
|
|
|
|
...this.queryParams
|
|
|
|
|
}, `workorder_${new Date().getTime()}.xlsx`)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
@ -1114,17 +1110,21 @@ export default {
|
|
|
|
|
margin-top: 40px;
|
|
|
|
|
margin-bottom: 10px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.my-print-head {
|
|
|
|
|
margin-top: 20px;
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.my-print-nav {
|
|
|
|
|
margin-top: 15px;
|
|
|
|
|
margin-bottom: 15px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.my-print-table {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.my-print-foot {
|
|
|
|
|
margin-top: 20px;
|
|
|
|
|
}
|
|
|
|
|