|
|
|
@ -356,6 +356,13 @@
|
|
|
|
|
clearable></el-cascader>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :offset="1" :span="7">
|
|
|
|
|
<!-- 工单日期 -->
|
|
|
|
|
<el-form-item size="small" label="工单日期: ">
|
|
|
|
|
<el-date-picker @change="checkDate" v-model="splitForm.productDate" type="date" placeholder="选择日期"
|
|
|
|
|
></el-date-picker>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
<!-- 第二行 -->
|
|
|
|
|
<el-row>
|
|
|
|
@ -378,11 +385,10 @@
|
|
|
|
|
<el-input required type="number" @input="splitNumChange" v-model="splitForm.splitNum"></el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :offset="1" :span="5">
|
|
|
|
|
<!-- 工单日期 -->
|
|
|
|
|
<el-form-item size="small" label="工单日期: ">
|
|
|
|
|
<el-date-picker @change="checkDate" v-model="splitForm.productDate" type="date" placeholder="选择日期"
|
|
|
|
|
></el-date-picker>
|
|
|
|
|
<el-col :offset="1" :span="7">
|
|
|
|
|
<!-- 车数 -->
|
|
|
|
|
<el-form-item v-if="this.splitForm.carNum != null" size="small" label="分配车数:">
|
|
|
|
|
<el-input required type="number" @input="changeCarNum" v-model="splitForm.carNum"></el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
@ -454,6 +460,7 @@ import {
|
|
|
|
|
} from '@/api/plan/workorder'
|
|
|
|
|
import moment from 'moment';
|
|
|
|
|
import { getProEquipment, getProRoutes, getProShifts} from '@/api/plan/order'
|
|
|
|
|
import {prototype} from "clipboard";
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
name: "Workorder",
|
|
|
|
@ -514,6 +521,7 @@ export default {
|
|
|
|
|
productDate: null,
|
|
|
|
|
shiftId: null,
|
|
|
|
|
routeCode: null,
|
|
|
|
|
carNum: null,
|
|
|
|
|
},
|
|
|
|
|
// 遮罩层
|
|
|
|
|
loading: true,
|
|
|
|
@ -600,6 +608,38 @@ export default {
|
|
|
|
|
this.getList();
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
// 变更-车数数量校验
|
|
|
|
|
changeCarNum(num) {
|
|
|
|
|
console.log("车数数量改变")
|
|
|
|
|
console.log(num)
|
|
|
|
|
|
|
|
|
|
// 请先输入订单数量
|
|
|
|
|
if (this.splitForm.splitNum == null) {
|
|
|
|
|
this.$message({
|
|
|
|
|
message: '请先输入拆分数量!',
|
|
|
|
|
type: 'warning'
|
|
|
|
|
})
|
|
|
|
|
this.splitForm.carNum = null;
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
// 车数不能超过拆分数量
|
|
|
|
|
if (Number(this.splitForm.splitNum) - Number(num) < 0) {
|
|
|
|
|
this.$message({
|
|
|
|
|
message: '车数不能超过拆分数量!',
|
|
|
|
|
type: 'warning'
|
|
|
|
|
})
|
|
|
|
|
this.splitForm.carNum = this.splitForm.splitNum;
|
|
|
|
|
}
|
|
|
|
|
// 不能为负数
|
|
|
|
|
if (num <= 0) {
|
|
|
|
|
this.$message({
|
|
|
|
|
message: '车数数量不能小于0!',
|
|
|
|
|
type: 'warning'
|
|
|
|
|
})
|
|
|
|
|
this.splitForm.carNum = 1;
|
|
|
|
|
}
|
|
|
|
|
this.splitForm.carNum = num;
|
|
|
|
|
},
|
|
|
|
|
// 派发-工单派发按钮操作
|
|
|
|
|
handleUpdateDown(row) {
|
|
|
|
|
var statusesArray = this.statuses;
|
|
|
|
@ -695,18 +735,37 @@ export default {
|
|
|
|
|
this.splitForm.shiftId = this.splitData[0].shiftDesc
|
|
|
|
|
// 设置工艺
|
|
|
|
|
this.splitForm.routeCode = this.splitData[0].routeCode
|
|
|
|
|
// 设置车数
|
|
|
|
|
this.splitForm.carNum = this.splitData[0].carNum
|
|
|
|
|
|
|
|
|
|
// 递归将拆分数量还原
|
|
|
|
|
function setAtrr1(order, work) {
|
|
|
|
|
order.quantitySplit = Number(order.quantitySplit) - Number(work.quantitySplit);
|
|
|
|
|
order.atrr1 = work.quantitySplit;
|
|
|
|
|
// 订单为白坯
|
|
|
|
|
if (this.productData[0].prodType == 'white'){
|
|
|
|
|
// 递归将拆分数量还原
|
|
|
|
|
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]);
|
|
|
|
|
if (order.children !== undefined && work.children !== undefined) {
|
|
|
|
|
setAtrr1(order.children[0], work);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setAtrr1(this.productData[0], this.splitData[0]);
|
|
|
|
|
}
|
|
|
|
|
// 订单为成品
|
|
|
|
|
if (this.productData[0],prototype != 'white'){
|
|
|
|
|
// 递归将拆分数量还原
|
|
|
|
|
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]);
|
|
|
|
|
setAtrr1(this.productData[0], this.splitData[0]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
@ -739,11 +798,15 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
// 变更-拆分数量变更
|
|
|
|
|
splitNumChange(e) {
|
|
|
|
|
//不能为负数
|
|
|
|
|
console.log(this.productData)
|
|
|
|
|
//不能为负数
|
|
|
|
|
if (e <= 0) {
|
|
|
|
|
e = 1
|
|
|
|
|
this.splitForm.splitNum = 1
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
// 订单为成品
|
|
|
|
|
if (this.productData[0].prodType != 'white') {
|
|
|
|
|
console.log("成品逻辑")
|
|
|
|
|
// 获取最大值,拆分数量不得超过最大值
|
|
|
|
|
let max = Number(this.productData[0].quantity) - Number(this.productData[0].quantitySplit)
|
|
|
|
|
// 超过最大值,给用户提醒
|
|
|
|
@ -782,6 +845,45 @@ export default {
|
|
|
|
|
|
|
|
|
|
this.workForm.splitNum = this.splitForm.splitNum
|
|
|
|
|
}
|
|
|
|
|
// 订单为白坯
|
|
|
|
|
if (this.productData[0].prodType == 'white') {
|
|
|
|
|
console.log("白坯逻辑")
|
|
|
|
|
// 获取最大值,拆分数量不得超过最大值
|
|
|
|
|
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,表示正在加载
|
|
|
|
|
|
|
|
|
|
// 递归操作动态显示拆分数量
|
|
|
|
|
function setAtrr1(data, splitNum) {
|
|
|
|
|
if (data.children !== undefined) {
|
|
|
|
|
for (let i = 0; i < data.children.length; i++) {
|
|
|
|
|
data.children[i].atrr1 = splitNum
|
|
|
|
|
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]
|
|
|
|
|
},
|
|
|
|
|
// 变更-工单日期变更
|
|
|
|
|