fix:mlogb中的工艺步骤选择

This commit is contained in:
shijing 2025-07-14 09:01:55 +08:00
parent aca0fd057e
commit 263d7bd706
1 changed files with 136 additions and 124 deletions

View File

@ -18,6 +18,28 @@
style="padding: 0 10px" style="padding: 0 10px"
> >
<el-row> <el-row>
<el-col v-if="!hasRoute&&!is_fix">
<el-form-item label="工艺步骤" prop="route">
<el-select
v-model="form.route"
placeholder="工艺步骤"
clearable
filterable
style="width: 100%"
:disabled="mode == 'edit'"
@change="routeChange"
>
<el-option
v-for="item in routeOptions"
:key="item.id"
:label="item.name"
:value="item.id"
>
<span>[{{ item.routepack_name }}]{{ item.name }}</span>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="12" :xs="24" v-if="!isfix"> <el-col :md="12" :sm="12" :xs="24" v-if="!isfix">
<el-form-item label="关联任务"> <el-form-item label="关联任务">
<el-select <el-select
@ -67,65 +89,6 @@
<el-input-number ref="codeInput" v-model="form.count_use" :min="0" clearable class="width-100"></el-input-number> <el-input-number ref="codeInput" v-model="form.count_use" :min="0" clearable class="width-100"></el-input-number>
</el-form-item> </el-form-item>
</el-col> </el-col>
<!-- <el-col :md="12" :sm="12" :xs="24" v-if="route_code=='niuzhuan'">
<el-form-item label="生产设备">
<el-select
v-model="form.equipment"
placeholder="生产设备"
clearable
filterable
style="width: 100%"
>
<el-option
v-for="item in optionsEq"
:key="item.id"
:label="item.label"
:value="item.id"
>
<span style="float:left">{{item.name}}</span>
<span style="float:right">{{item.number}}</span>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="12" :xs="24" v-if="route_code=='niuzhuan'">
<el-form-item label="操作人">
<ehsSelect
v-model="form.handle_user"
:showName="form.handle_user_name"
:apiObj="this.$API.system.user.list"
:params="{ depts: dept }"
class="width-100"
></ehsSelect>
</el-form-item>
</el-col>
<el-col :md="12" :sm="12" :xs="24" v-if="route_code=='niuzhuan'">
<el-form-item
label="开始时间"
prop="work_start_time"
>
<el-date-picker
:disabled="mode == 'edit'"
v-model="form.work_start_time"
type="datetime"
value-format="YYYY-MM-DD HH:mm:ss"
style="width: 100%;"
popper-append-to-body
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="12" :xs="24" v-if="route_code=='niuzhuan'">
<el-form-item label="结束时间" prop="work_end_time">
<el-date-picker
v-model="form.work_end_time"
type="datetime"
value-format="YYYY-MM-DD HH:mm:ss"
style="width: 100%;"
:disabledDate="disabledDateFn"
popper-append-to-body
/>
</el-form-item>
</el-col> -->
<el-col :md="12" :sm="12" :xs="24"> <el-col :md="12" :sm="12" :xs="24">
<el-form-item label="主要批次" v-if="!isfix"> <el-form-item label="主要批次" v-if="!isfix">
<el-select <el-select
@ -177,20 +140,28 @@ export default {
}, },
tracking:{ tracking:{
type: Number, type: Number,
default: 10, default: null,
}, },
routeId:{ routeId:{
type: String, type: String,
default: "", default: "",
}, },
materialIn: { material_in: {
type: String, type: String,
default: "", default: "",
}, },
hasRoute:{
type: Boolean,
default: false,
},
isfix:{ isfix:{
type: Boolean, type: Boolean,
default: false, default: false,
} },
process:{
type: String,
default: "",
},
}, },
emits: ["success", "closed"], emits: ["success", "closed"],
data() { data() {
@ -220,6 +191,7 @@ export default {
mlogbIns:[], mlogbIns:[],
options: [], options: [],
optionsEq: [], optionsEq: [],
routeOptions: [],
mlogbInOptions:[], mlogbInOptions:[],
materialOptions: [], materialOptions: [],
mgroup_code:'', mgroup_code:'',
@ -243,6 +215,7 @@ export default {
}; };
}, },
mounted() { mounted() {
this.materialIn = this.material_in;
this.route_code = this.$route.path.split("/")[2]; this.route_code = this.$route.path.split("/")[2];
this.form.mlog = this.mlog; this.form.mlog = this.mlog;
this.params.mlog = this.mlog; this.params.mlog = this.mlog;
@ -253,6 +226,9 @@ export default {
this.getMaterial(); this.getMaterial();
this.getParentList(); this.getParentList();
this.getEquipment(); this.getEquipment();
if(!this.hasRoute){
this.getRoute();
}
}, },
methods: { methods: {
open() { open() {
@ -283,6 +259,17 @@ export default {
}); });
}); });
}, },
getRoute() {
let that = this;
that.$API.mtm.route.list
.req({ process: that.process, page: 0, routepack__state: 30 })
.then((res) => {
that.routeOptions = res;
if(res.length==1){
that.form.route = res[0].id;
}
});
},
getParentList(){ getParentList(){
let that = this; let that = this;
that.$API.wpm.mlogb.list.req(that.params).then((res) => { that.$API.wpm.mlogb.list.req(that.params).then((res) => {
@ -313,19 +300,41 @@ export default {
getMaterial() { getMaterial() {
let that = this; let that = this;
let obj = {}; let obj = {};
console.log('that.mgroup',that.mgroup);
obj.mtaskx =that.form.mtask; obj.mtaskx =that.form.mtask;
obj.mgroupx =that.mgroup; obj.mgroup =that.mgroup;
obj.route =that.routeId; if(that.routeId!==null&&that.routeId!==''){
obj.route =that.routeId;
}
obj.page =0; obj.page =0;
if(that.isfix){ if(that.is_fix){//&&
obj.state =30; obj.tag = 'canfix';
}else{ }else{
if(that.materialIn!==null&&that.materialIn!==''){
obj.material =that.materialIn;
}
obj.state =10; obj.state =10;
obj.tag = 'todo';
} }
this.$API.wpm.wmaterial.list.req(obj).then((res) => { this.$API.wpm.wmaterial.list.req(obj).then((res) => {
that.materialOptions = res; let arr = [];
if(res.length>0){
arr = res.filter((item)=>{
return Number(item.count_cando)>0;
})
}
that.materialOptions = arr;
}); });
}, },
routeChange(){
let that = this;
that.routeOptions.forEach(item=>{
if(item.id == that.form.route){
that.materialIn = item.material_in;
that.getMaterial();
}
})
},
changeMaterial(){ changeMaterial(){
let that = this; let that = this;
that.materialOptions.forEach(item=>{ that.materialOptions.forEach(item=>{
@ -338,6 +347,7 @@ export default {
}, },
// //
formWminChange(code){ formWminChange(code){
console.log('code',code);
let that = this,codeId='',arr=[]; let that = this,codeId='',arr=[];
code = code.replace(/(^\s*)|(\s*$)/g, ""); code = code.replace(/(^\s*)|(\s*$)/g, "");
if(code.indexOf("#")>-1){ if(code.indexOf("#")>-1){
@ -367,67 +377,69 @@ export default {
}); });
}else{ }else{
that.scanKyes = ""; that.scanKyes = "";
if(that.tracking==10){// that.$API.wpm.wpr.list.req({number:code,page:0}).then((res) => {
arr = that.materialOptions.filter((item) => { if(res.length>0){
return item.batch == code; let index = res.length-1;//
}) let bwitem = {};
if (arr.length > 0) { bwitem.mlogb="";
that.form.batch = arr[0].batch; bwitem.number=res[index].number;
that.form.wm_in = arr[0].id; bwitem.wpr=res[index].id;
that.form.count_use = arr[0].count; let arr = that.materialOptions.filter((item) => {
that.wm_in = arr[0].batch; return item.id == res[index].wm;
}else{ })
that.wm_in = ''; if(arr.length>0){ //
that.$message.error("批次号不存在"); let batch = arr[0].batch;
} that.wm_in = arr[0].batch;
}else{// that.mlogbInCount = arr[0].count;//
that.$API.wpm.wpr.list.req({number:code,page:0}).then((res) => { //
if(res.length>0){ let arr0= that.mlogbIns.filter((item)=>{
let index = res.length-1;// return item.batch == batch;
let bwitem = {};
bwitem.mlogb="";
bwitem.number=res[index].number;
bwitem.wpr=res[index].id;
let arr = that.materialOptions.filter((item) => {
return item.id == res[index].wm;
}) })
if(arr.length>0){ // let arr1 = that.bwItemForms.filter((item)=>{
let batch = arr[0].batch; return item.number == bwitem.number;
that.wm_in = arr[0].batch; })
that.mlogbInCount = arr[0].count;// if (arr0.length > 0) {
// that.hasMlogbIn = true;
let arr0= that.mlogbIns.filter((item)=>{ that.form.count_use = 1;
return item.batch == batch; that.mlogbId = arr0[0].id;
}) bwitem.mlogb = arr0[0].id;
let arr1 = that.bwItemForms.filter((item)=>{
return item.number == bwitem.number;
})
if (arr0.length > 0) {
that.hasMlogbIn = true;
that.form.count_use = 1;
that.mlogbId = arr0[0].id;
bwitem.mlogb = arr0[0].id;
}else{
if(arr1.length>0){
that.wm_in = '';
that.$message.error("已存在");
}else{
that.form.batch = arr[0].batch;
that.form.wm_in = arr[0].id;
that.form.count_use += 1;
that.wm_in = '';
that.batchs = arr[0].id;
}
}
that.bwItemForms.push(bwitem);
// that.bwItemForm = bwitem;
}else{ }else{
that.wm_in = ''; if(arr1.length>0){
that.$message.error("批次号不存在"); that.wm_in = '';
that.$message.error("已存在");
}else{
that.form.batch = arr[0].batch;
that.form.wm_in = arr[0].id;
that.form.count_use += 1;
that.wm_in = '';
that.batchs = arr[0].id;
}
} }
that.bwItemForms.push(bwitem);
// that.bwItemForm = bwitem;
}else{
that.wm_in = '';
that.$message.error("批次号不存在");
} }
}) }
} })
// if(that.tracking==10||that.tracking==null){//
// arr = that.materialOptions.filter((item) => {
// return item.batch == code;
// })
// if (arr.length > 0) {
// that.form.batch = arr[0].batch;
// that.form.wm_in = arr[0].id;
// that.form.count_use = arr[0].count;
// that.wm_in = arr[0].batch;
// }else{
// that.wm_in = '';
// that.$message.error("");
// }
// }else{//
// console.log('code',code);
// }
} }
}, },
// //