fix:玻纤快速创建日志

This commit is contained in:
shijing 2025-08-20 11:28:34 +08:00
parent 583cecd238
commit a94c30deff
1 changed files with 79 additions and 40 deletions

View File

@ -19,7 +19,7 @@
> >
<el-row> <el-row>
<el-col> <el-col>
<el-form-item> <el-form-item label="扫码:">
<el-input <el-input
ref="codeInput" ref="codeInput"
v-model="wm_in" v-model="wm_in"
@ -33,12 +33,11 @@
<el-row> <el-row>
<el-col :md="12" :sm="12" :xs="24"> <el-col :md="12" :sm="12" :xs="24">
<el-form-item label="处理人:"> <el-form-item label="处理人:">
<el-input v-model="form.handle_user_name" clearable ></el-input> {{ form.handle_user_name }}
<!-- {{ form.handle_user_name }} -->
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :md="12" :sm="12" :xs="24"> <el-col :md="12" :sm="12" :xs="24">
<el-form-item label="开始时间:"> <el-form-item label="处理时间:">
<el-date-picker <el-date-picker
v-model="form.work_start_time" v-model="form.work_start_time"
type="datetime" type="datetime"
@ -51,20 +50,33 @@
</el-col> </el-col>
<el-col :md="12" :sm="12" :xs="24"> <el-col :md="12" :sm="12" :xs="24">
<el-form-item label="物料批号:"> <el-form-item label="物料批号:">
<el-input v-model="form.batch" clearable ></el-input> {{ form.batch }}
<!-- {{ form.handle_user_name }} -->
</el-form-item>
</el-col>
<el-col :md="12" :sm="12" :xs="24">
<el-form-item label="处理日期:">
<el-input v-model="form.handle_date" disabled></el-input>
<!-- {{ form.handle_user_name }} -->
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :md="12" :sm="12" :xs="24"> <el-col :md="12" :sm="12" :xs="24">
<el-form-item label="领用数量:"> <el-form-item label="领用数量:">
<el-input v-model="form.count_use" clearable ></el-input> <el-input-number v-model="form.count_use" clearable style="width: 100%;"></el-input-number>
<!-- {{ form.handle_user_name }} --> </el-form-item>
</el-col>
<el-col :md="12" :sm="12" :xs="24" v-if="route_code=='ladansi'||route_code=='yicifusi'||route_code=='ercifusi'||route_code=='zlybcl'">
<el-form-item label="生产设备" prop="equipment">
<el-select
v-model="form.equipment"
placeholder="生产设备"
clearable
filterable
style="width: 100%"
>
<el-option
v-for="item in options"
: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-form-item>
</el-col> </el-col>
<el-col :md="12" :sm="12" :xs="24"> <el-col :md="12" :sm="12" :xs="24">
@ -82,7 +94,6 @@
:value="item.id" :value="item.id"
></el-option> ></el-option>
</el-select> </el-select>
<!-- {{ form.handle_user_name }} -->
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -98,6 +109,7 @@
<script> <script>
const defaultForm = { const defaultForm = {
batch: "",
wm_in: "", wm_in: "",
mgroup:'', mgroup:'',
count_use: "", count_use: "",
@ -153,6 +165,8 @@ export default {
route_code:"", route_code:"",
visible: false, visible: false,
isSaveing: false, isSaveing: false,
options: [],
bwItemForms: [],
routeOptions: [], routeOptions: [],
materialOptions: [], materialOptions: [],
routeOriginOptions: [], routeOriginOptions: [],
@ -165,15 +179,28 @@ export default {
this.form.mgroup = this.mgroup; this.form.mgroup = this.mgroup;
this.getMaterial(); this.getMaterial();
this.getRoute(); this.getRoute();
this.getEquipment();
}, },
methods: { methods: {
// //
getRoute() { getRoute() {
let that = this; let that = this;
this.$API.mtm.route.list.req({ process: that.process, page: 0, routepack__state: 30 }).then((res) => { this.$API.mtm.route.list.req({ process: that.process, page: 0, routepack__state: 30 }).then((res) => {
this.routeOriginOptions = res; this.routeOriginOptions = res;
}); });
}, },
//
getEquipment() {
let that = this;
this.$API.em.equipment.list.req({ page: 0, type: 10,mgroup:that.mgroup}).then((res) => {
res.forEach((item) => {
let obj = {};
Object.assign(obj, item);
obj.label = item.name+'-'+item.number;
that.options.push(obj);
});
});
},
// //
open(mode = "add") { open(mode = "add") {
let that = this; let that = this;
@ -222,6 +249,9 @@ export default {
that.$API.system.user.item.req(codeId).then((res) => { that.$API.system.user.item.req(codeId).then((res) => {
that.form.handle_user = res.id; that.form.handle_user = res.id;
that.form.handle_user_name = res.name; that.form.handle_user_name = res.name;
that.wm_in = '';
}).catch((err) => {
that.wm_in = '';
}) })
}else if(that.scanKyes=="mat"){ }else if(that.scanKyes=="mat"){
// //
@ -230,10 +260,12 @@ export default {
arr = that.materialOptions.filter((item) => { arr = that.materialOptions.filter((item) => {
return item.batch == res.batch&&item.state==res.state; return item.batch == res.batch&&item.state==res.state;
}) })
that.wm_in = '';
if (arr.length > 0) { if (arr.length > 0) {
that.routeOptions = [];
that.form.batch = arr[0].batch; that.form.batch = arr[0].batch;
that.form.wm_in = arr[0].id; that.form.wm_in = arr[0].id;
that.form.count_use = arr[0].count; that.form.count_use = arr[0].count_cando;
that.wm_in = arr[0].batch; that.wm_in = arr[0].batch;
that.routeOriginOptions.forEach((item)=>{ that.routeOriginOptions.forEach((item)=>{
if(item.material_in==arr[0].material){ if(item.material_in==arr[0].material){
@ -244,11 +276,11 @@ export default {
that.form.route = that.routeOptions[0].id; that.form.route = that.routeOptions[0].id;
} }
}else{ }else{
that.wm_in = ''; that.$message.error("批次号不存在,或没有可操作数量");
that.$message.error("批次号不存在");
} }
}else{ }else{
that.wm_in = ''; that.wm_in = '';
that.$message.error("批次号不存在");
} }
}).catch((err) => { }).catch((err) => {
that.wm_in = ''; that.wm_in = '';
@ -256,6 +288,7 @@ export default {
}); });
} }
}else{ }else{
//
that.scanKyes = ""; that.scanKyes = "";
that.$API.wpm.wpr.list.req({number:code,page:0}).then((res) => { that.$API.wpm.wpr.list.req({number:code,page:0}).then((res) => {
if(res.length>0){ if(res.length>0){
@ -264,42 +297,48 @@ export default {
bwitem.mlogb=""; bwitem.mlogb="";
bwitem.number=res[index].number; bwitem.number=res[index].number;
bwitem.wpr=res[index].id; bwitem.wpr=res[index].id;
if(that.routeOptions.length==0){
console.log('that.routeOriginOptions',that.routeOriginOptions);
console.log('res[index].material',res[index].material);
that.routeOriginOptions.forEach((item)=>{
if(item.material_in==res[index].material){
that.routeOptions.push(item);
}
})
console.log('that.routeOptions',that.routeOptions);
if(that.routeOptions.length==1){
that.form.route = that.routeOptions[0].id;
}
}
let arr = that.materialOptions.filter((item) => { let arr = that.materialOptions.filter((item) => {
return item.id == res[index].wm; return item.id == res[index].wm;
}) })
if(arr.length>0){ // if(arr.length>0){ //
let batch = arr[0].batch; let batch = arr[0].batch;
that.wm_in = arr[0].batch; if(that.form.batch==''||that.form.batch==batch){
that.mlogbInCount = arr[0].count;// that.form.batch = batch;
// that.form.wm_in = arr[0].id;
let arr0= that.mlogbIns.filter((item)=>{ let arr1 = that.bwItemForms.filter((item)=>{
return item.batch == batch; return item.number == bwitem.number;
}) })
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){ if(arr1.length>0){
that.wm_in = ''; that.wm_in = '';
that.$message.error("已存在"); that.$message.warning("该物料已存在");
}else{ }else{
that.form.batch = arr[0].batch; that.bwItemForms.push(bwitem);
that.form.wm_in = arr[0].id;
that.form.count_use += 1; that.form.count_use += 1;
that.wm_in = ''; that.wm_in = '';
that.batchs = arr[0].id;
} }
}else{
that.$message.error("请扫同一批次物料");
} }
that.bwItemForms.push(bwitem);
}else{ }else{
that.wm_in = ''; that.wm_in = '';
that.$message.error("批次号不存在"); that.$message.error("批次号不存在");
} }
}else{
that.wm_in = '';
that.$message.error("该物料不存在");
} }
}) })
} }