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

yangwl
wws 1 year ago
parent db1391d4fb
commit 5ebd4a5c4a

@ -311,7 +311,7 @@
<!--选择物料 --> <!--选择物料 -->
<el-col :span="7"> <el-col :span="7">
<el-form-item size="small" label="选择物料:"> <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-select v-if="false" v-model="form.productId" placeholder="请选择物料">-->
<!-- <el-option v-for="item in selectProductList" :key="item.productId" :label="item.productDesc"--> <!-- <el-option v-for="item in selectProductList" :key="item.productId" :label="item.productDesc"-->
<!-- :value="item.productId"--> <!-- :value="item.productId"-->
@ -354,6 +354,17 @@
<el-table-column prop="shiftDesc" label="班次"></el-table-column> <el-table-column prop="shiftDesc" label="班次"></el-table-column>
<el-table-column prop="bucketName" 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 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-table>
</el-row> </el-row>
</el-form> </el-form>
@ -440,7 +451,8 @@ export default {
dicts: ['sys_yes_no'], dicts: ['sys_yes_no'],
data() { data() {
return { return {
// //
checkUpdate: true,
// -list // -list
materiel: [], materiel: [],
materielList: [], materielList: [],
@ -525,7 +537,7 @@ export default {
this.getList() this.getList()
}, },
methods: { methods: {
// // -
deleteSelectWork(e) { deleteSelectWork(e) {
// //
for (let i =0; i < this.newWorkOrderList.length; i++) { 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() { handleMaterielQuery() {
this.materielQueryParams.pageNum = 1; 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 var bucket
@ -680,25 +745,111 @@ export default {
} }
} }
// newList // TODO --
for (let i = 0; i < this.selectList.length; i++) { for (let i = 0; i < this.selectList.length; i++) {
this.selectList[i].bucketName = bucket.bucketName for (let j = 0; j < this.wetMaterialPlanList.length; j++) {
this.selectList[i].bucketId = bucket.bucketId if (this.selectList[i].workorderCode == this.wetMaterialPlanList[j].workorderCode) {
this.selectList[i].bucketCode = bucket.bucketCode //
this.selectList[i].materialId = material.productId if (this.wetMaterialPlanList[j].materialName != null) {
this.selectList[i].materialCode = material.productCode let materialNameArray = this.wetMaterialPlanList[j].materialName.split(',');
this.selectList[i].materialName = material.productDesc for (let i = materialNameArray.length - 2; i >= 0; i--) {
this.selectList[i].planTime = this.form.planTime if (material.productDesc != materialNameArray[i]) {
this.newWorkOrderList.push(this.selectList[i]) this.$message({
message: '同一工单只能选一个物料!',
type: 'warning'
})
return
}
}
}
//
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)
const selectedCodes = this.selectList.map(item => item.workorderCode)
this.wetMaterialPlanList = this.wetMaterialPlanList.filter(item => !selectedCodes.includes(item.workorderCode))
// 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.bucketId = null
this.form.productId = null this.form.productId = null
this.form.productName = null
}, },
/** 新增-确定按钮 */ /** 新增-确定按钮 */
batchBtn() { batchBtn() {
@ -936,6 +1087,7 @@ export default {
// //
cancel() { cancel() {
this.open = false this.open = false
this.dialogVisible = false
this.reset() this.reset()
}, },
// //
@ -1049,6 +1201,7 @@ export default {
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.checkUpdate = true;
checkChangePlan(row.id).then(response => { checkChangePlan(row.id).then(response => {
if (response.code == 500) { if (response.code == 500) {
@ -1095,13 +1248,15 @@ export default {
}, },
/** 修改-提交按钮 */ /** 修改-提交按钮 */
updateForm() { updateForm() {
// // TODO
if (this.wetMaterialPlanList.length > 0) { for (let i = 0; i < this.wetMaterialPlanList.length; i++) {
this.$message({ if (this.wetMaterialPlanList[i].bucketName == null) {
message: '计划要全部重新分配完!', this.$message({
type: 'warning' message: '计划要全部重新分配完!',
}) type: 'warning'
return })
return
}
} }
// newList // newList
if (this.newWorkOrderList == [] || this.newWorkOrderList.length == 0 || this.newWorkOrderList == null) { if (this.newWorkOrderList == [] || this.newWorkOrderList.length == 0 || this.newWorkOrderList == null) {

Loading…
Cancel
Save