湿料计划(修改湿料计划)

master
wws 1 year ago
parent db1391d4fb
commit 5ebd4a5c4a

@ -311,7 +311,7 @@
<!--选择物料 -->
<el-col :span="7">
<el-form-item size="small" label="选择物料:">
<el-input @focus="selectMateriel" readonly v-model="form.productId" placeholder="点击选择物料"/>
<el-input @focus="selectMateriel" readonly v-model="form.productName" placeholder="点击选择物料"/>
<!-- <el-select v-if="false" v-model="form.productId" placeholder="请选择物料">-->
<!-- <el-option v-for="item in selectProductList" :key="item.productId" :label="item.productDesc"-->
<!-- :value="item.productId"-->
@ -354,6 +354,17 @@
<el-table-column prop="shiftDesc" label="班次"></el-table-column>
<el-table-column prop="bucketName" label="料罐"></el-table-column>
<el-table-column prop="materialName" label="物料"></el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="deleteSelectWorkUpdate(scope.row)"
>删除
</el-button>
</template>
</el-table-column>
</el-table>
</el-row>
</el-form>
@ -440,7 +451,8 @@ export default {
dicts: ['sys_yes_no'],
data() {
return {
//
//
checkUpdate: true,
// -list
materiel: [],
materielList: [],
@ -525,7 +537,7 @@ export default {
this.getList()
},
methods: {
//
// -
deleteSelectWork(e) {
//
for (let i =0; i < this.newWorkOrderList.length; i++) {
@ -569,6 +581,50 @@ export default {
}
}
},
// -
deleteSelectWorkUpdate(e) {
//
for (let i =0; i < this.newWorkOrderList.length; i++) {
if (e.workorderCode == this.newWorkOrderList[i].workorderCode) {
this.newWorkOrderList.splice(i,1);
}
}
//
let newMaterialName1 = "";
let newBucketName1 = "";
for (let i =0; i < this.wetMaterialPlanList.length; i++) {
if (e.workorderCode == this.wetMaterialPlanList[i].workorderCode) {
//
let materialNameArray = this.wetMaterialPlanList[i].materialName.split(',');
let materialFlag = true;
for (let j = materialNameArray.length - 2; j >= 0; j--) {
if (e.materialName == materialNameArray[j] && materialFlag) {
materialNameArray.splice(j,1);
materialFlag = false;
}else {
newMaterialName1 += materialNameArray[j]+",";
}
}
//
let bucketArray = this.wetMaterialPlanList[i].bucketName.split(',');
let bucketFlag = true;
for (let j = bucketArray.length - 2; j >= 0; j--) {
if (e.bucketName == bucketArray[j] && bucketFlag) {
bucketArray.splice(j,1);
bucketFlag = false;
}else {
newBucketName1 += bucketArray[j]+",";
}
}
this.wetMaterialPlanList[i].materialName = newMaterialName1;
this.wetMaterialPlanList[i].bucketName = newBucketName1;
}
}
},
// -
handleMaterielQuery() {
this.materielQueryParams.pageNum = 1;
@ -663,7 +719,16 @@ export default {
}
}
}
this.bmsList.push(bms)
// TODO
if (this.checkUpdate) {
for (let i = 0; i < this.wetMaterialPlanList.length; i++){
this.wetMaterialPlanList[i].materialName = null;
this.wetMaterialPlanList[i].bucketName = null;
}
this.checkUpdate = false;
}
//
//
var bucket
@ -680,25 +745,111 @@ export default {
}
}
// newList
// TODO --
for (let i = 0; i < this.selectList.length; i++) {
this.selectList[i].bucketName = bucket.bucketName
this.selectList[i].bucketId = bucket.bucketId
this.selectList[i].bucketCode = bucket.bucketCode
this.selectList[i].materialId = material.productId
this.selectList[i].materialCode = material.productCode
this.selectList[i].materialName = material.productDesc
this.selectList[i].planTime = this.form.planTime
this.newWorkOrderList.push(this.selectList[i])
for (let j = 0; j < this.wetMaterialPlanList.length; j++) {
if (this.selectList[i].workorderCode == this.wetMaterialPlanList[j].workorderCode) {
//
if (this.wetMaterialPlanList[j].materialName != null) {
let materialNameArray = this.wetMaterialPlanList[j].materialName.split(',');
for (let i = materialNameArray.length - 2; i >= 0; i--) {
if (material.productDesc != materialNameArray[i]) {
this.$message({
message: '同一工单只能选一个物料!',
type: 'warning'
})
return
}
}
}
//
const selectedCodes = this.selectList.map(item => item.workorderCode)
this.wetMaterialPlanList = this.wetMaterialPlanList.filter(item => !selectedCodes.includes(item.workorderCode))
//
if (this.wetMaterialPlanList[j].bucketName != null) {
let bucketArray = this.wetMaterialPlanList[j].bucketName.split(',');
for (let i = bucketArray.length - 1; i >= 0; i--) {
if (bucket.bucketName == bucketArray[i]) {
this.$message({
message: '料罐重复!',
type: 'warning'
})
return
}
}
}
}
}
}
this.bmsList.push(bms)
// TODO newList
for (let i = 0; i < this.selectList.length; i++) {
//
var workOrder = {
productName: null,
factoryCode: null,
workorderId: null,
workorderCode: null,
bucketId: null,
bucketCode: null,
bucketName: null,
materialId: null,
materialCode: null,
materialName: null,
shiftId: null,
shiftDesc: null,
planTime: null,
productDate: null,
};
workOrder.bucketCode = bucket.bucketCode;
workOrder.bucketId = bucket.bucketId;
workOrder.bucketName = bucket.bucketName;
workOrder.materialId = material.productId;
workOrder.materialCode = material.productCode;
workOrder.materialName = material.productDesc;
workOrder.shiftId = this.selectList[i].shiftId;
workOrder.shiftDesc = this.selectList[i].shiftDesc;
workOrder.planTime = this.form.planTime;
workOrder.productDate = this.selectList[i].productDate;
workOrder.productName = this.selectList[i].productName;
workOrder.workorderId = this.selectList[i].workorderId;
workOrder.workorderCode = this.selectList[i].workorderCode;
// this.selectList[i].bucketName = bucket.bucketName
// this.selectList[i].bucketId = bucket.bucketId
// this.selectList[i].bucketCode = bucket.bucketCode
// this.selectList[i].materialId = material.productId
// this.selectList[i].materialCode = material.productCode
// this.selectList[i].materialName = material.productDesc
// this.selectList[i].planTime = this.form.planTime
this.newWorkOrderList.push(workOrder)
}
// // TODO
for (let i = 0; i < this.selectList.length; i++) {
for (let j = 0; j < this.wetMaterialPlanList.length; j++) {
if (this.selectList[i].workorderCode == this.wetMaterialPlanList[j].workorderCode) {
if (this.wetMaterialPlanList[j].bucketName == null) {
this.wetMaterialPlanList[j].bucketName = "";
}
this.wetMaterialPlanList[j].bucketName += bucket.bucketName + ",";
if (this.wetMaterialPlanList[j].materialName == null) {
this.wetMaterialPlanList[j].materialName = "";
}
this.wetMaterialPlanList[j].materialName += material.productDesc + ",";
}
}
}
// const selectedCodes = this.selectList.map(item => item.workorderCode)
// this.wetMaterialPlanList = this.wetMaterialPlanList.filter(item => !selectedCodes.includes(item.workorderCode))
//
this.form.bucketId = null
this.form.productId = null
this.form.productName = null
},
/** 新增-确定按钮 */
batchBtn() {
@ -936,6 +1087,7 @@ export default {
//
cancel() {
this.open = false
this.dialogVisible = false
this.reset()
},
//
@ -1049,6 +1201,7 @@ export default {
},
/** 修改按钮操作 */
handleUpdate(row) {
this.checkUpdate = true;
checkChangePlan(row.id).then(response => {
if (response.code == 500) {
@ -1095,14 +1248,16 @@ export default {
},
/** 修改-提交按钮 */
updateForm() {
//
if (this.wetMaterialPlanList.length > 0) {
// TODO
for (let i = 0; i < this.wetMaterialPlanList.length; i++) {
if (this.wetMaterialPlanList[i].bucketName == null) {
this.$message({
message: '计划要全部重新分配完!',
type: 'warning'
})
return
}
}
// newList
if (this.newWorkOrderList == [] || this.newWorkOrderList.length == 0 || this.newWorkOrderList == null) {
this.$message({

Loading…
Cancel
Save