计划管理优化

master
wws 2 years ago
parent a9c306be5a
commit ce081cb573

@ -24,7 +24,6 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="订单编码" prop="orderCode"> <el-form-item label="订单编码" prop="orderCode">
<el-input <el-input
v-model="queryParams.orderCode" v-model="queryParams.orderCode"
@ -103,7 +102,8 @@
:disabled="multiple" :disabled="multiple"
@click="handleUpdateDown" @click="handleUpdateDown"
v-hasPermi="['mes:pro:workorder:edit']" v-hasPermi="['mes:pro:workorder:edit']"
>派发工单</el-button> >派发工单
</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
@ -115,7 +115,8 @@
:disabled="single" :disabled="single"
@click="handleUpdate" @click="handleUpdate"
v-hasPermi="['mes:pro:workorder:edit']" v-hasPermi="['mes:pro:workorder:edit']"
>工单变更</el-button> >工单变更
</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -126,7 +127,8 @@
:disabled="multiple" :disabled="multiple"
@click="handleDelete" @click="handleDelete"
v-hasPermi="['mes:pro:workorder:remove']" v-hasPermi="['mes:pro:workorder:remove']"
>删除</el-button> >删除
</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -136,7 +138,8 @@
size="mini" size="mini"
@click="handleExport" @click="handleExport"
v-hasPermi="['mes:pro:workorder:export']" v-hasPermi="['mes:pro:workorder:export']"
>导出</el-button> >导出
</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -147,13 +150,14 @@
size="mini" size="mini"
@click="showPrint" @click="showPrint"
v-hasPermi="['mes:pro:workorder:export']" v-hasPermi="['mes:pro:workorder:export']"
>打印预览</el-button> >打印预览
</el-button>
</el-col> </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
<el-table v-loading="loading" :data="workorderList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="workorderList" @selection-change="handleSelectionChange">
<el-table-column type="selection" align="center" > <el-table-column type="selection" align="center">
</el-table-column> </el-table-column>
<el-table-column label="工单ID" align="center" prop="workorderId" v-if="false"/> <el-table-column label="工单ID" align="center" prop="workorderId" v-if="false"/>
@ -165,12 +169,12 @@
<el-table-column width="180" label="产品编码" align="center" prop="productCode"/> <el-table-column width="180" label="产品编码" align="center" prop="productCode"/>
<el-table-column width="300" label="产品名称" align="center" prop="productName"/> <el-table-column width="300" label="产品名称" align="center" prop="productName"/>
<el-table-column label="规格型号" align="center" prop="productSpc" v-if="false"/> <el-table-column label="规格型号" align="center" prop="productSpc" v-if="false"/>
<el-table-column width="50" label="单位" align="center" prop="unit" /> <el-table-column width="50" label="单位" align="center" prop="unit"/>
<el-table-column width="120" label="已生产数量" align="center" prop="quantityProduced"/> <el-table-column width="120" label="已生产数量" align="center" prop="quantityProduced"/>
<el-table-column width="120" label="派工数量" align="center" prop="quantitySplit"/> <el-table-column width="120" label="派工数量" align="center" prop="quantitySplit"/>
<el-table-column width="150" label="工艺编码" align="center" prop="routeCode" /> <el-table-column width="150" label="工艺编码" align="center" prop="routeCode"/>
<el-table-column width="150" label="工艺名称" align="center" prop="routeName" /> <el-table-column width="150" label="工艺名称" align="center" prop="routeName"/>
<el-table-column width="130" label="产线设备" align="center" prop="prodLineName" /> <el-table-column width="130" label="产线设备" align="center" prop="prodLineName"/>
<el-table-column width="130" label="产线设备编码" align="center" prop="prodLineCode" v-if="false"/> <el-table-column width="130" label="产线设备编码" align="center" prop="prodLineCode" v-if="false"/>
<el-table-column width="120" label="工单生产日期" align="center" prop="productDate"> <el-table-column width="120" label="工单生产日期" align="center" prop="productDate">
<template slot-scope="scope"> <template slot-scope="scope">
@ -182,13 +186,13 @@
<dict-tag :options="dict.type.shift_type" :value="scope.row.shiftId"/> <dict-tag :options="dict.type.shift_type" :value="scope.row.shiftId"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="工单状态" align="center" prop="status" > <el-table-column label="工单状态" align="center" prop="status">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="dict.type.workorder_type" :value="scope.row.status"/> <dict-tag :options="dict.type.workorder_type" :value="scope.row.status"/>
</template> </template>
</el-table-column> </el-table-column>
<!-- <el-table-column label="备注" align="center" prop="remark" />--> <!-- <el-table-column label="备注" align="center" prop="remark" />-->
<el-table-column label="产品类型" align="center" prop="prodType" > <el-table-column label="产品类型" align="center" prop="prodType">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="dict.type.product_type" :value="scope.row.prodType"/> <dict-tag :options="dict.type.product_type" :value="scope.row.prodType"/>
</template> </template>
@ -211,10 +215,10 @@
</el-row> </el-row>
<!-- 导航栏 --> <!-- 导航栏 -->
<el-row class="my-print-nav"> <el-row class="my-print-nav">
<el-col :span="4">工厂:{{printData.factory}}</el-col> <el-col :span="4">工厂:{{ printData.factory }}</el-col>
<el-col :span="4">工作中心:{{printData.workCenter}}</el-col> <el-col :span="4">工作中心:{{ printData.workCenter }}</el-col>
<el-col :span="4">生产日期:{{printData.productDate}}</el-col> <el-col :span="4">生产日期:{{ printData.productDate }}</el-col>
<el-col :span="4">打印日期:{{printData.printDate}}</el-col> <el-col :span="4">打印日期:{{ printData.printDate }}</el-col>
<el-col :span="4">页次: 1/ 1</el-col> <el-col :span="4">页次: 1/ 1</el-col>
</el-row> </el-row>
<!-- 主数据 --> <!-- 主数据 -->
@ -269,12 +273,12 @@
<dict-tag :options="dict.type.shift_type" :value="scope.row.shiftId"/> <dict-tag :options="dict.type.shift_type" :value="scope.row.shiftId"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="工单状态" align="center" prop="status" > <el-table-column label="工单状态" align="center" prop="status">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="dict.type.workorder_type" :value="scope.row.status"/> <dict-tag :options="dict.type.workorder_type" :value="scope.row.status"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="产品类型" align="center" prop="prodType" > <el-table-column label="产品类型" align="center" prop="prodType">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="dict.type.product_type" :value="scope.row.prodType"/> <dict-tag :options="dict.type.product_type" :value="scope.row.prodType"/>
</template> </template>
@ -284,12 +288,12 @@
<br/> <br/>
<!-- 底部 --> <!-- 底部 -->
<el-row class="my-print-foot"> <el-row class="my-print-foot">
<el-col :offset="1" :span="3">SAP-No:{{printData.SAPNo}}</el-col> <el-col :offset="1" :span="3">SAP-No:{{ printData.SAPNo }}</el-col>
<el-col :offset="1" :span="3">Z-PM-F-030-A.1</el-col> <el-col :offset="1" :span="3">Z-PM-F-030-A.1</el-col>
</el-row> </el-row>
<el-row class="my-print-foot"> <el-row class="my-print-foot">
<el-col :offset="1" :span="3">制单人:{{printData.manufacture}}</el-col> <el-col :offset="1" :span="3">制单人:{{ printData.manufacture }}</el-col>
<el-col :offset="1" :span="3">审核人{{printData.auditor}}</el-col> <el-col :offset="1" :span="3">审核人{{ printData.auditor }}</el-col>
</el-row> </el-row>
</el-form> </el-form>
@ -441,25 +445,23 @@
import { import {
getWorkOrders, getWorkOrders,
listWorkorder, listWorkorder,
getWorkorder,
delWorkorder, delWorkorder,
downWorkorder, downWorkorder,
addWorkorder,
updateWorkorder,
getOrderAndWork, getOrderAndWork,
getWorkBatchList, getWorkBatchList,
subChangeWorkOrder, subChangeWorkOrder,
checkWorkOrder checkWorkOrder
} from '@/api/plan/workorder' } from '@/api/plan/workorder'
import moment from 'moment'; import moment from 'moment';
import { getprodLineShift, getProEquipment, getProRoutes, getProShifts } from '@/api/plan/order' import { getProEquipment, getProRoutes, getProShifts} from '@/api/plan/order'
export default { export default {
name: "Workorder", name: "Workorder",
dicts: ['product_type','workorder_type','shift_type'], dicts: ['product_type', 'workorder_type', 'shift_type'],
data() { data() {
return { return {
// 线code // 线code
proLineCode:null, proLineCode: null,
// //
formRef: 'form', formRef: 'form',
validateRules: [], validateRules: [],
@ -506,7 +508,7 @@ export default {
// //
refreshProTable: true, refreshProTable: true,
// form // form
splitForm:{ splitForm: {
prodLineCodeArray: [], prodLineCodeArray: [],
splitNum: null, splitNum: null,
productDate: null, productDate: null,
@ -517,7 +519,7 @@ export default {
loading: true, loading: true,
// //
ids: [], ids: [],
cods:[], cods: [],
// //
single: true, single: true,
// //
@ -536,7 +538,7 @@ export default {
open: false, open: false,
// //
queryParams: { queryParams: {
productDateArray: [new Date(),new Date()], productDateArray: [new Date(), new Date()],
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
workorderCode: null, workorderCode: null,
@ -570,26 +572,26 @@ export default {
// //
rules: { rules: {
workorderCode: [ workorderCode: [
{ required: true, message: "工单编码不能为空", trigger: "blur" } {required: true, message: "工单编码不能为空", trigger: "blur"}
], ],
workorderName: [ workorderName: [
{ required: true, message: "工单名称不能为空", trigger: "blur" } {required: true, message: "工单名称不能为空", trigger: "blur"}
], ],
orderId: [ orderId: [
{ required: true, message: "订单id不能为空", trigger: "blur" } {required: true, message: "订单id不能为空", trigger: "blur"}
], ],
productCode: [ productCode: [
{ required: true, message: "产品编号不能为空", trigger: "blur" } {required: true, message: "产品编号不能为空", trigger: "blur"}
], ],
productName: [ productName: [
{ required: true, message: "产品名称不能为空", trigger: "blur" } {required: true, message: "产品名称不能为空", trigger: "blur"}
], ],
unit: [ unit: [
{ required: true, message: "单位不能为空", trigger: "blur" } {required: true, message: "单位不能为空", trigger: "blur"}
], ],
}, },
/**********************************/ /**********************************/
eRouteProps: { multiple: true }, eRouteProps: {multiple: true},
eRouteOptions: [] eRouteOptions: []
}; };
@ -598,301 +600,49 @@ export default {
this.getList(); this.getList();
}, },
methods: { methods: {
// 线 // -
changeEquipment(){ handleUpdateDown(row) {
if (this.splitForm.routeCode == null) { var statusesArray = this.statuses;
this.$message({ for (var i = 0; i < statusesArray.length; i++) {
message: '请先选择工艺!', if (statusesArray[i] == 'w1') {//
type: 'warning' this.$modal.msgError("已经下达的订单不允许操作");
})
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
})
},
//
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 // refreshProTablefalse
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 // refreshProTabletrue
this.newWorkerLoading = false // false
})
},
/** 动态添加表单 */
addField() {
//
let sum = 0
for (let i = 0; i < this.formFields.length; i++) {
sum += Number(this.formFields[i].batchQuantity)
}
if (sum >= this.productData[0].atrr1) {
this.$message({
message: '无法添加!您的批次数量已满!',
type: 'warning'
})
return
}
this.formFields.push({ batchCode: '', batchQuantity: '' })
//
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) {
this.formFields[this.formFields.length - 1].batchQuantity = 1
}
//
let sum = 0
for (let i = 0; i < this.formFields.length; i++) {
sum += Number(this.formFields[i].batchQuantity)
}
//
if (sum > this.productData[0].atrr1) {
this.$message({
message: '你的批次数量总和不能超过拆分数量!',
type: 'warning'
})
this.formFields[this.formFields.length - 1].batchQuantity = Number(this.productData[0].atrr1) - Number(Number(sum) - Number(e))
if (this.formFields[this.formFields.length - 1].batchQuantity <= 0) {
this.formFields[this.formFields.length - 1].batchQuantity = 1
}
}
//
if (this.productData[0].atrr1 == '' || this.productData[0].atrr1 == null) {
this.formFields[this.formFields.length - 1].batchQuantity = ''
}
},
/** 检验批次编码是否重复 */
batchCodeChange(e) {
if (this.formFields.length > 1) {
for (let i = 0; i < this.formFields.length - 1; i++) {
if (this.formFields[this.formFields.length - 1].batchCode == this.formFields[i].batchCode) {
this.$message({
message: '批次号不能重复!',
type: 'warning'
})
this.formFields = [{
batchCode: '',
batchQuantity: ''
}]
return return
} }
} }
}
},
/** 更改工艺 */
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) {
this.$message({
message: '最大值不能超过' + max + '!',
type: 'warning'
})
this.splitForm.splitNum = max
}
//
//
this.proLoading = true // true
var num = this.productData[0].quantity; const workorderIds = row.workorderCode || this.codes;
// this.$modal.confirm('是否确认下发生产工单编号为"' + workorderIds + '"的数据项?').then(function () {
function setAtrr1(data, splitNum) { return downWorkorder(workorderIds);
if (data.children !== undefined) { }).then(() => {
for (let i = 0; i < data.children.length; i++) { this.getList();
data.children[i].atrr1 = splitNum * (data.children[i].quantity / num) this.$modal.msgSuccess("下发成功");
setAtrr1(data.children[i], splitNum) }).catch(() => {
}
}
}
this.productData[0].atrr1 = this.splitForm.splitNum
setAtrr1(this.productData[0], this.splitForm.splitNum)
this.refreshProTable = false // refreshProTablefalse
this.$nextTick(() => {
// 使$nextTickDOM
this.refreshProTable = true // refreshProTabletrue
this.proLoading = false // false
})
this.workForm.splitNum = this.splitForm.splitNum
}
this.product = this.productData[0]
},
/** 工单日期选择 */
checkDate(e){
this.workForm.productDate = e
},
/** 查询生产工单列表 */
getList() {
this.loading = true;
this.queryParams.endFlag = '1';//
if(this.queryParams.productDateArray!=null){
this.queryParams.productDateStart = moment(this.queryParams.productDateArray[0]).format('YYYY-MM-DD');
this.queryParams.productDateEnd = moment(this.queryParams.productDateArray[1]).format('YYYY-MM-DD');
}
listWorkorder(this.queryParams).then(response => {
this.workorderList = response.rows;
this.total = response.total;
this.loading = false;
}); });
}, },
// // -
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
workorderId: null,
workorderCode: null,
workorderName: null,
orderId: null,
orderCode: null,
productId: null,
productCode: null,
productName: null,
productSpc: null,
unit: null,
quantityProduced: null,
quantitySplit: null,
routeCode: null,
prodLineCode: null,
prodLineCodeArray:[],
productDate: null,
shiftId: null,
parentOrder: null,
ancestors: null,
status: null,
remark: null,
attr1: null,
attr2: null,
attr3: null,
attr4: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
prodType: null,
factoryCode: null,
endFlag: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
// --
this.selectWork = selection[0]
this.ids = selection.map(item => item.workorderId)
this.codes = selection.map(item => item.workorderCode)
this.single = selection.length!==1
this.multiple = !selection.length
this.statuses = selection.map(item => item.status)
},
/** 新增按钮操作 */
handleAdd() {
alert("待建设")
//this.reset();
//this.open = true;
//this.title = "";
},
/** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
// ()
//if (this.selectWork.status == "w1"){
// this.$message({
// message:'',
// type:'warning'
// })
// return;
//}
// //
checkWorkOrder(this.selectWork.workorderId).then(response => { checkWorkOrder(this.selectWork.workorderId).then(response => {
if (response.code == 500){ if (response.code == 500) {
this.$message({ this.$message({
message:'该工单已有湿料计划,不可修改', message: '工单已生产,不可变更!',
type:'warning' type: 'warning'
}) })
return; return;
}else { } else {
// //
this.reset(); this.reset();
this.splitData = []; this.splitData = [];
this.productData =[]; this.productData = [];
this.splitForm={ this.splitForm = {
prodLineCodeArray: [], prodLineCodeArray: [],
splitNum: null, splitNum: null,
productDate: null, productDate: null,
shiftId: null, shiftId: null,
routeCode: null, routeCode: null,
} }
this.formFields=[] this.formFields = []
// //
this.splitForm.productDate = new Date() this.splitForm.productDate = new Date()
@ -920,7 +670,7 @@ export default {
// //
this.proLoading = true // true this.proLoading = true // true
this.workerLoading = true // true this.workerLoading = true // true
getOrderAndWork(this.selectWork).then(response =>{ getOrderAndWork(this.selectWork).then(response => {
this.splitData.push(response.data.workOrder) this.splitData.push(response.data.workOrder)
this.productData.push(response.data.order) this.productData.push(response.data.order)
@ -966,25 +716,148 @@ export default {
}) })
}, },
/**下达工单**/ // -线
handleUpdateDown(row) { changeEquipment() {
var statusesArray = this.statuses; if (this.splitForm.routeCode == null) {
for(var i=0; i<statusesArray.length; i++) { this.$message({
if(statusesArray[i]=='w1'){// message: '请先选择工艺!',
this.$modal.msgError("已经下达的订单不允许操作"); type: 'warning'
})
return return
} }
},
// -
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) {
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)
}
}
} }
const workorderIds = row.workorderCode || this.codes; this.productData[0].atrr1 = this.splitForm.splitNum
this.$modal.confirm('是否确认下发生产工单编号为"' + workorderIds + '"的数据项?').then(function() { setAtrr1(this.productData[0], this.splitForm.splitNum)
return downWorkorder(workorderIds);
}).then(() => { this.refreshProTable = false // refreshProTablefalse
this.getList(); this.$nextTick(() => {
this.$modal.msgSuccess("下发成功"); // 使$nextTickDOM
}).catch(() => {}); this.refreshProTable = true // refreshProTabletrue
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
for (let i = 0; i < this.formFields.length; i++) {
sum += Number(this.formFields[i].batchQuantity)
}
if (sum >= this.productData[0].atrr1) {
this.$message({
message: '无法添加!您的批次数量已满!',
type: 'warning'
})
return
}
this.formFields.push({batchCode: '', batchQuantity: ''})
//
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) {
this.formFields[this.formFields.length - 1].batchQuantity = 1
}
//
let sum = 0
for (let i = 0; i < this.formFields.length; i++) {
sum += Number(this.formFields[i].batchQuantity)
}
//
if (sum > this.productData[0].atrr1) {
this.$message({
message: '你的批次数量总和不能超过拆分数量!',
type: 'warning'
})
this.formFields[this.formFields.length - 1].batchQuantity = Number(this.productData[0].atrr1) - Number(Number(sum) - Number(e))
if (this.formFields[this.formFields.length - 1].batchQuantity <= 0) {
this.formFields[this.formFields.length - 1].batchQuantity = 1
}
}
//
if (this.productData[0].atrr1 == '' || this.productData[0].atrr1 == null) {
this.formFields[this.formFields.length - 1].batchQuantity = ''
}
},
// -
batchCodeChange(e) {
if (this.formFields.length > 1) {
for (let i = 0; i < this.formFields.length - 1; i++) {
if (this.formFields[this.formFields.length - 1].batchCode == this.formFields[i].batchCode) {
this.$message({
message: '批次号不能重复!',
type: 'warning'
})
this.formFields = [{
batchCode: '',
batchQuantity: ''
}]
return
}
}
}
},
// -
submitForm() { submitForm() {
// //
let sum = 0 let sum = 0
@ -1047,12 +920,12 @@ export default {
}] }]
this.open = false this.open = false
}, },
/** 删除按钮操作 */ // -
handleDelete(row) { handleDelete(row) {
var statusesArray = this.statuses; var statusesArray = this.statuses;
for(var i=0; i<statusesArray.length; i++) { for (var i = 0; i < statusesArray.length; i++) {
if(statusesArray[i]=='w1'){// if (statusesArray[i] == 'w1') {//
this.$modal.msgError("已经下达的订单不允许操作"); this.$modal.msgError("已经下达的订单不允许操作");
return return
} }
@ -1062,18 +935,141 @@ export default {
const workorderCodes = row.workorderCode || this.codes; const workorderCodes = row.workorderCode || this.codes;
this.$modal.confirm('是否确认删除生产工单编号为"' + workorderCodes + '"的数据项?').then(function() { this.$modal.confirm('是否确认删除生产工单编号为"' + workorderCodes + '"的数据项?').then(function () {
return delWorkorder(workorderIds); return delWorkorder(workorderIds);
}).then(() => { }).then(() => {
this.getList(); this.getList();
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功");
}).catch(() => {}); }).catch(() => {
});
}, },
/** 导出按钮操作 */ // -list
handleExport() { handleExport() {
this.download('plan/pro/workorder/export', { this.download('plan/pro/workorder/export', {
...this.queryParams ...this.queryParams
}, `workorder_${new Date().getTime()}.xlsx`) }, `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 // refreshProTablefalse
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 // refreshProTabletrue
this.newWorkerLoading = false // false
})
},
// -
getList() {
this.loading = true;
this.queryParams.endFlag = '1';//
if (this.queryParams.productDateArray != null) {
this.queryParams.productDateStart = moment(this.queryParams.productDateArray[0]).format('YYYY-MM-DD');
this.queryParams.productDateEnd = moment(this.queryParams.productDateArray[1]).format('YYYY-MM-DD');
}
listWorkorder(this.queryParams).then(response => {
this.workorderList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
// -
reset() {
this.form = {
workorderId: null,
workorderCode: null,
workorderName: null,
orderId: null,
orderCode: null,
productId: null,
productCode: null,
productName: null,
productSpc: null,
unit: null,
quantityProduced: null,
quantitySplit: null,
routeCode: null,
prodLineCode: null,
prodLineCodeArray: [],
productDate: null,
shiftId: null,
parentOrder: null,
ancestors: null,
status: null,
remark: null,
attr1: null,
attr2: null,
attr3: null,
attr4: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
prodType: null,
factoryCode: null,
endFlag: null
};
this.resetForm("form");
},
// -
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
// -
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// -
handleSelectionChange(selection) {
// --
this.selectWork = selection[0]
this.ids = selection.map(item => item.workorderId)
this.codes = selection.map(item => item.workorderCode)
this.single = selection.length !== 1
this.multiple = !selection.length
this.statuses = selection.map(item => item.status)
},
// -
handleAdd() {
alert("待建设")
//this.reset();
//this.open = true;
//this.title = "";
} }
} }
}; };
@ -1114,17 +1110,21 @@ export default {
margin-top: 40px; margin-top: 40px;
margin-bottom: 10px; margin-bottom: 10px;
} }
.my-print-head { .my-print-head {
margin-top: 20px; margin-top: 20px;
font-weight: bold; font-weight: bold;
} }
.my-print-nav { .my-print-nav {
margin-top: 15px; margin-top: 15px;
margin-bottom: 15px; margin-bottom: 15px;
} }
.my-print-table { .my-print-table {
} }
.my-print-foot { .my-print-foot {
margin-top: 20px; margin-top: 20px;
} }

Loading…
Cancel
Save