fix:光芯交接、日志、出入库时的扫码

This commit is contained in:
shijing 2025-04-01 11:27:57 +08:00
parent 6681b5baba
commit aa850cfcc2
6 changed files with 226 additions and 41 deletions

View File

@ -15,16 +15,23 @@
v-auth="'handover.create'"
v-if="mgroupName!=='切片'"
>返工</el-button>
<el-button
type="primary"
@click="printSetting"
>打印机</el-button>
<scScanner :labeltext="'交接扫码'" @scanResult="codeTextChange10"></scScanner>
<scScanner :labeltext="'返工扫码'" @scanResult="codeTextChange20"></scScanner>
<el-input
ref="codeInput"
v-model="codeText"
clearable
style="width: 150px;margin: 0 4px;"
placeholder="正常交接"
@keyup.enter="codeTextChange(10)"
@keyup.enter="codeTextChange10(codeText)"
></el-input>
<el-input
ref="codeInput"
v-model="codeText2"
clearable
placeholder="返工交接"
style="width: 150px;"
@keyup.enter="codeTextChange20(codeText2)"
></el-input>
</div>
<div class="right-panel">
@ -215,7 +222,7 @@
@closed="dialog.save = false"
>
</save-dialog>
<el-dialog title="打印机设置" v-model="setNameVisible" width="600px">
<!-- <el-dialog title="打印机设置" v-model="setNameVisible" width="600px">
<el-form label-width="100px">
<el-form-item label="打印机名称">
<el-input v-model="printer_name"></el-input>
@ -224,7 +231,7 @@
<el-footer>
<el-button type="primary" @click="savePrinter">保存</el-button>
</el-footer>
</el-dialog>
</el-dialog> -->
<el-dialog v-model="printVisible" width="1200px">
<print :baseData="handoverItem" :tableData="handoverItem.handoverb" :type="'handover'" @closePrint="printVisible=false"/>
</el-dialog>
@ -291,9 +298,10 @@ export default {
mtask: "",
mlogId: "",
codeText:"",
codeText2:"",
printer_name: "",
printVisible:false,
setNameVisible: false,
// setNameVisible: false,
};
},
mounted() {
@ -305,9 +313,7 @@ export default {
that.$refs.table.refresh();
},
methods: {
printSetting(){
this.setNameVisible = true;
},
//
table_add(type) {
this.dialog.save = true;
@ -316,20 +322,22 @@ export default {
this.$refs.saveDialog.open("add",'',10);
});
},
codeTextChange(type){
codeTextChange10(codeText){
let that = this;
this.dialog.save = true;
this.type = type;
this.$nextTick(() => {
this.$refs.saveDialog.open("add",that.codeText,10);
that.type = 10;
that.codeText = codeText;
that.dialog.save = true;
that.$nextTick(() => {
that.$refs.saveDialog.open("add",codeText,10);
});
},
codeTextChange2(type){
codeTextChange20(codeText2){
let that = this;
this.type = 20;
that.codeText2 = codeText2;
this.dialog.save = true;
this.type = type;
this.$nextTick(() => {
this.$refs.saveDialog.open("add",that.codeText);
this.$refs.saveDialog.open("add",codeText2,20);
});
},
//
@ -405,12 +413,12 @@ export default {
that.handoverItem = row;
that.printVisible = true;
},
savePrinter() {
let that = this;
localStorage.setItem("printer_name", that.printer_name);
that.setNameVisible = false;
that.$message.success("打印机设置成功,请重新进行打印操作。");
},
// savePrinter() {
// let that = this;
// localStorage.setItem("printer_name", that.printer_name);
// that.setNameVisible = false;
// that.$message.success("");
// },
//
//
handleSaveSuccess(data, mode) {

View File

@ -16,7 +16,17 @@
<el-row>
<el-form-item label="交接物料">
<el-button type="primary" @click="addMaterial" v-if="mode!=='show'">手动添加</el-button>
<scan-dialog ref="scanDialog" @closed="scanClose"> </scan-dialog>
<scScanner @scanResult="codeTextChange(10)"></scScanner>
</el-form-item>
<el-form-item label-width="0">
<el-input
ref="codeInput"
v-model="codeText"
clearable
placeholder="物料批次"
style="width: 200px;margin-left: 4px;"
@keyup.enter="codeTextChange(codeText)"
></el-input>
</el-form-item>
<el-form-item label="总计:">
{{ totalCount }}
@ -284,6 +294,7 @@ export default {
listParams:{},
totalCount: 0,
deptID:'',
codeText: "",
userList: [],
userList2: [],
mgroupOptions: [],
@ -580,21 +591,29 @@ export default {
let that = this;
that.scanVisible = true;
},
scanClose(data){
codeTextChange(data){
if(data==''||data==undefined||data==null){
return;
}
let that = this;
data = data.replace(' ','');
let id = data.split('#')[1];
console.log('id',id);
this.$API.cm.labelmat.item.req(id).then((res) => {
console.log('res',res);
let arr = that.form.handoverb.filter((item) => {
return item.batch == res.batch;
})
console.log('arr',arr);
if(arr.length>0){
that.$message.error("该批次已存在")
}else{
console.log('that.materialOptions',that.materialOptions);
that.materialOptions.forEach((item) => {
console.log('item',item);
console.log('item.batch',item.batch);
console.log('res.batch',res.batch);
console.log('item.batch == res.batch',item.batch == res.batch);
if(item.batch == res.batch){
let obj = {};
obj.wm = item.id;

View File

@ -6,6 +6,8 @@
<el-button type="primary" v-auth="'handover.create'" @click="table_add(20)">返修</el-button>
<el-button type="primary" v-auth="'handover.create'" @click="table_add(40)">报废</el-button>
<el-button type="primary" v-auth="'handover.create'" @click="batchConcat()">合批</el-button>
<scScanner :labeltext="'返修扫码'" @scanResult="codeTextChange20"></scScanner>
<scScanner :labeltext="'报废扫码'" @scanResult="codeTextChange40"></scScanner>
</div>
<div class="right-panel">
<el-select
@ -269,6 +271,8 @@ export default {
search: "",
material: "",
},
codeText2: "",
codeText4: "",
cate_type:'',
materialType: "wm",
changebatch:false,
@ -381,6 +385,24 @@ export default {
this.$refs.scrapDialog.open("add",handoverb,10);
});
},
codeTextChange20(codeText2){
let that = this;
that.type = 20;
that.codeText2 = codeText2;
that.dialog.scrap = true;
that.$nextTick(() => {
that.$refs.scrapDialog.open("add",codeText2,10);
});
},
codeTextChange40(codeText4){
let that = this;
that.type = 40;
that.codeText4 = codeText4;
that.dialog.scrap = true;
that.$nextTick(() => {
that.$refs.scrapDialog.open("add",codeText4,10);
});
},
handleScrapSuccess(){
this.dialog.scrap = false;
this.$refs.table.refresh();

View File

@ -6,6 +6,8 @@
<el-button type="primary" v-auth="'handover.create'" @click="table_add(20)">返修</el-button>
<el-button type="primary" v-auth="'handover.create'" @click="table_add(40)">报废</el-button>
<el-button type="primary" v-auth="'handover.create'" @click="batchConcat()">合批</el-button>
<scScanner :labeltext="'返修扫码'" @scanResult="codeTextChange20"></scScanner>
<scScanner :labeltext="'报废扫码'" @scanResult="codeTextChange40"></scScanner>
</div>
<div class="right-panel">
<el-select
@ -362,6 +364,24 @@ export default {
this.$refs.scrapDialog.open("add",handoverb,10);
});
},
codeTextChange20(codeText2){
let that = this;
that.type = 20;
that.codeText2 = codeText2;
that.dialog.scrap = true;
that.$nextTick(() => {
that.$refs.scrapDialog.open("add",codeText2,10);
});
},
codeTextChange40(codeText4){
let that = this;
that.type = 40;
that.codeText4 = codeText4;
that.dialog.scrap = true;
that.$nextTick(() => {
that.$refs.scrapDialog.open("add",codeText4,10);
});
},
batchConcat(){
this.changebatch = true;
let handoverb = [];

View File

@ -135,6 +135,15 @@
icon="el-icon-plus"
@click="table_add"
></el-button>
<scScanner @scanResult="codeTextChange"></scScanner>
<el-input
ref="codeInput"
v-model="codeText"
clearable
placeholder="物料扫码"
style="width:150px;margin-left: 4px;"
@keyup.enter="codeTextChange(codeText)"
></el-input>
</div>
</el-header>
<el-main>
@ -339,6 +348,7 @@ export default {
name: [{ required: true, message: "请输入" }],
},
mioId:null,
codeText:"",
routepack: "",
tableData:[],
userOption: [],//
@ -471,6 +481,13 @@ export default {
}
},
codeTextChange(codeText){
this.codeText = codeText;
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("add",codeText);
});
},
table_add() {
this.dialog.save = true;
this.$nextTick(() => {

View File

@ -42,7 +42,7 @@
</el-form-item>
<el-form-item label="物料批次" v-else>
<el-select
v-model="form.batch"
v-model="selectBatch"
filterable
value-key="id"
@change="selectwmChange"
@ -51,7 +51,7 @@
v-for="item in wbatchOptions"
:key="item.id"
:label="item.batch"
:value="item"
:value="item.id"
>
<span style="display:inline-block;float: left;">{{item.material_.name}}|{{ item.batch }}</span>
<span
@ -64,7 +64,16 @@
>
</el-option>
</el-select>
<scan-dialog ref="scanDialog" @closed="scanClose"> </scan-dialog>
<scScanner @scanResult="codeTextChange"></scScanner>
<el-input
ref="codeInput"
v-model="codeText"
clearable
placeholder="物料扫码"
style="width:150px;margin-left: 4px;"
@keyup.enter="codeTextChange(codeText)"
></el-input>
<!-- <scan-dialog ref="scanDialog" @closed="scanClose"> </scan-dialog> -->
</el-form-item>
<el-form-item label="批次" v-if="cate == 'do_out'">
<el-select
@ -78,7 +87,7 @@
v-for="item in batchOptions"
:key="item.id"
:label="item.batch"
:value="item"
:value="item.id"
>
<span style="float: left">{{ item.batch }}</span>
<span
@ -91,9 +100,18 @@
>
</el-option>
</el-select>
<scan-dialog ref="scanDialog" @closed="scanClose"> </scan-dialog>
<scScanner @scanResult="codeTextChange"></scScanner>
<el-input
ref="codeInput"
v-model="codeText"
clearable
placeholder="物料扫码"
style="width:150px;margin-left: 4px;"
@keyup.enter="codeTextChange(codeText)"
></el-input>
<!-- <scan-dialog ref="scanDialog" @closed="scanClose"> </scan-dialog> -->
</el-form-item>
<el-form-item label="仓库">
<el-form-item label="仓库" prop="warehouse">
<el-select
v-model="form.warehouse"
clearable
@ -148,8 +166,10 @@ export default {
},
form: {},
rules: {
material: [{required: true,message: "请选择物料",trigger: "blur",},],
material: [{required: true,message: "请选择物料",trigger: "blur"}],
warehouse: [{required: true,message: "请选择物料入库仓库",trigger: "blur"}],
},
codeText: "",
visible: false,
isSaveing: false,
materialOptions: [],
@ -208,10 +228,22 @@ export default {
obj.page= 0;
obj.mgroupx= that.mgroupId;
obj.material__process= that.process;
if (that.mgroupId != null &&that.mgroupId != undefined &&that.mgroupId != "") {
that.$API.wpm.wmaterial.list.req(obj).then((res) => {
that.wbatchOptions = res;
if(res.length>0&&that.codeText!==''){
that.codeTextChange(that.codeText);
// let arr = [];
// arr = res.filter(item => item.batch == that.codeText);
// if(arr.length>0){
// that.selectBatch = arr[0].id;
// that.form.batch = arr[0].batch;
// that.form.wm = arr[0].id;
// that.form.count = arr[0].count;
// }else{
// this.$message.warning("");
// }
}
});
}
},
@ -223,13 +255,76 @@ export default {
obj.material = that.form.material;
this.$API.inm.warehouse.batch.req(obj).then((res) => {
this.batchOptions = res;
if(res.length>0&&that.codeText!==''){
that.codeTextChange(that.codeText);
// let arr = [];
// arr = res.filter(item => item.batch == that.codeText);
// if(arr.length>0){
// that.form.material = arr[0].material
// that.selectBatch = arr[0].id;
// that.form.batch = arr[0].batch;
// that.form.warehouse = arr[0].warehouse;
// that.form.mb = arr[0].id;
// that.form.count = arr[0].count;
// }else{
// this.$message.warning("");
// }
}
});
},
scanClose(data){
codeTextChange(data){
let that = this;
if(data==''||data==undefined||data==null){
return;
}
data = data.replace(' ','');
let id = data.split('#')[1];
console.log('id',id);
that.form.batch = id;
this.$API.cm.labelmat.item.req(id).then((res) => {
console.log('res',res);
let arr = [];
if(this.cate == 'do_out'){//---
arr = this.batchOptions.filter(item => item.batch == res.batch);
}else{//----
arr = this.wbatchOptions.filter(item => item.batch == res.batch);
}
console.log('arr',arr);
if(arr.length>0){
that.form.material = arr[0].material;
that.selectBatch = arr[0].id;
that.form.batch = arr[0].batch;
that.form.count = arr[0].count;
if(this.cate == 'do_out'){
that.form.mb = arr[0].id;
that.form.warehouse = arr[0].warehouse;
}else{
that.form.wm = arr[0].id;
}
}else{
that.$message.error("该批次不存在")
}
})
// that.form.batch = id;
// let arr = [];
// if(this.cate == 'do_out'){//---
// arr = this.batchOptions.filter(item => item.batch == that.codeText);
// }else{//----
// arr = this.wbatchOptions.filter(item => item.batch == that.codeText);
// }
// console.log('arr',arr);
// if(arr.length>0){
// that.form.material = arr[0].material
// that.selectBatch = arr[0].id;
// that.form.batch = arr[0].batch;
// that.form.count = arr[0].count;
// if(this.cate == 'do_out'){
// that.form.mb = arr[0].id;
// that.form.warehouse = arr[0].warehouse;
// }else{
// that.form.wm = arr[0].id;
// }
// }else{
// this.$message.warning("");
// }
},
selectMaterialChange() {
this.getBatchOptions();
@ -249,6 +344,7 @@ export default {
//
selectwmChange(item){
let that = this;
that.form.batch = item.batch;
that.form.wm = item.id;
},
selectBatchClear() {
@ -256,8 +352,11 @@ export default {
this.form.warehouse = "";
},
//
open(mode = "add") {
open(mode = "add",codeText="") {
this.mode = mode;
if(codeText&&codeText!=''){
this.codeText = codeText;
}
this.visible = true;
return this;
},