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

View File

@ -16,7 +16,17 @@
<el-row> <el-row>
<el-form-item label="交接物料"> <el-form-item label="交接物料">
<el-button type="primary" @click="addMaterial" v-if="mode!=='show'">手动添加</el-button> <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>
<el-form-item label="总计:"> <el-form-item label="总计:">
{{ totalCount }} {{ totalCount }}
@ -284,6 +294,7 @@ export default {
listParams:{}, listParams:{},
totalCount: 0, totalCount: 0,
deptID:'', deptID:'',
codeText: "",
userList: [], userList: [],
userList2: [], userList2: [],
mgroupOptions: [], mgroupOptions: [],
@ -580,21 +591,29 @@ export default {
let that = this; let that = this;
that.scanVisible = true; that.scanVisible = true;
}, },
scanClose(data){ codeTextChange(data){
if(data==''||data==undefined||data==null){ if(data==''||data==undefined||data==null){
return; return;
} }
let that = this; let that = this;
data = data.replace(' ','');
let id = data.split('#')[1]; let id = data.split('#')[1];
console.log('id',id); console.log('id',id);
this.$API.cm.labelmat.item.req(id).then((res) => { this.$API.cm.labelmat.item.req(id).then((res) => {
console.log('res',res);
let arr = that.form.handoverb.filter((item) => { let arr = that.form.handoverb.filter((item) => {
return item.batch == res.batch; return item.batch == res.batch;
}) })
console.log('arr',arr);
if(arr.length>0){ if(arr.length>0){
that.$message.error("该批次已存在") that.$message.error("该批次已存在")
}else{ }else{
console.log('that.materialOptions',that.materialOptions);
that.materialOptions.forEach((item) => { 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){ if(item.batch == res.batch){
let obj = {}; let obj = {};
obj.wm = item.id; 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(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="table_add(40)">报废</el-button>
<el-button type="primary" v-auth="'handover.create'" @click="batchConcat()">合批</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>
<div class="right-panel"> <div class="right-panel">
<el-select <el-select
@ -269,6 +271,8 @@ export default {
search: "", search: "",
material: "", material: "",
}, },
codeText2: "",
codeText4: "",
cate_type:'', cate_type:'',
materialType: "wm", materialType: "wm",
changebatch:false, changebatch:false,
@ -381,6 +385,24 @@ export default {
this.$refs.scrapDialog.open("add",handoverb,10); 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(){ handleScrapSuccess(){
this.dialog.scrap = false; this.dialog.scrap = false;
this.$refs.table.refresh(); 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(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="table_add(40)">报废</el-button>
<el-button type="primary" v-auth="'handover.create'" @click="batchConcat()">合批</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>
<div class="right-panel"> <div class="right-panel">
<el-select <el-select
@ -362,6 +364,24 @@ export default {
this.$refs.scrapDialog.open("add",handoverb,10); 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(){ batchConcat(){
this.changebatch = true; this.changebatch = true;
let handoverb = []; let handoverb = [];

View File

@ -135,6 +135,15 @@
icon="el-icon-plus" icon="el-icon-plus"
@click="table_add" @click="table_add"
></el-button> ></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> </div>
</el-header> </el-header>
<el-main> <el-main>
@ -339,6 +348,7 @@ export default {
name: [{ required: true, message: "请输入" }], name: [{ required: true, message: "请输入" }],
}, },
mioId:null, mioId:null,
codeText:"",
routepack: "", routepack: "",
tableData:[], tableData:[],
userOption: [],// 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() { table_add() {
this.dialog.save = true; this.dialog.save = true;
this.$nextTick(() => { this.$nextTick(() => {

View File

@ -42,7 +42,7 @@
</el-form-item> </el-form-item>
<el-form-item label="物料批次" v-else> <el-form-item label="物料批次" v-else>
<el-select <el-select
v-model="form.batch" v-model="selectBatch"
filterable filterable
value-key="id" value-key="id"
@change="selectwmChange" @change="selectwmChange"
@ -51,7 +51,7 @@
v-for="item in wbatchOptions" v-for="item in wbatchOptions"
:key="item.id" :key="item.id"
:label="item.batch" :label="item.batch"
:value="item" :value="item.id"
> >
<span style="display:inline-block;float: left;">{{item.material_.name}}|{{ item.batch }}</span> <span style="display:inline-block;float: left;">{{item.material_.name}}|{{ item.batch }}</span>
<span <span
@ -64,7 +64,16 @@
> >
</el-option> </el-option>
</el-select> </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>
<el-form-item label="批次" v-if="cate == 'do_out'"> <el-form-item label="批次" v-if="cate == 'do_out'">
<el-select <el-select
@ -78,7 +87,7 @@
v-for="item in batchOptions" v-for="item in batchOptions"
:key="item.id" :key="item.id"
:label="item.batch" :label="item.batch"
:value="item" :value="item.id"
> >
<span style="float: left">{{ item.batch }}</span> <span style="float: left">{{ item.batch }}</span>
<span <span
@ -91,9 +100,18 @@
> >
</el-option> </el-option>
</el-select> </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>
<el-form-item label="仓库"> <el-form-item label="仓库" prop="warehouse">
<el-select <el-select
v-model="form.warehouse" v-model="form.warehouse"
clearable clearable
@ -148,8 +166,10 @@ export default {
}, },
form: {}, form: {},
rules: { rules: {
material: [{required: true,message: "请选择物料",trigger: "blur",},], material: [{required: true,message: "请选择物料",trigger: "blur"}],
warehouse: [{required: true,message: "请选择物料入库仓库",trigger: "blur"}],
}, },
codeText: "",
visible: false, visible: false,
isSaveing: false, isSaveing: false,
materialOptions: [], materialOptions: [],
@ -208,10 +228,22 @@ export default {
obj.page= 0; obj.page= 0;
obj.mgroupx= that.mgroupId; obj.mgroupx= that.mgroupId;
obj.material__process= that.process; obj.material__process= that.process;
if (that.mgroupId != null &&that.mgroupId != undefined &&that.mgroupId != "") { if (that.mgroupId != null &&that.mgroupId != undefined &&that.mgroupId != "") {
that.$API.wpm.wmaterial.list.req(obj).then((res) => { that.$API.wpm.wmaterial.list.req(obj).then((res) => {
that.wbatchOptions = 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; obj.material = that.form.material;
this.$API.inm.warehouse.batch.req(obj).then((res) => { this.$API.inm.warehouse.batch.req(obj).then((res) => {
this.batchOptions = 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; let that = this;
if(data==''||data==undefined||data==null){
return;
}
data = data.replace(' ','');
let id = data.split('#')[1]; let id = data.split('#')[1];
console.log('id',id); this.$API.cm.labelmat.item.req(id).then((res) => {
that.form.batch = id; 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() { selectMaterialChange() {
this.getBatchOptions(); this.getBatchOptions();
@ -249,6 +344,7 @@ export default {
// //
selectwmChange(item){ selectwmChange(item){
let that = this; let that = this;
that.form.batch = item.batch;
that.form.wm = item.id; that.form.wm = item.id;
}, },
selectBatchClear() { selectBatchClear() {
@ -256,8 +352,11 @@ export default {
this.form.warehouse = ""; this.form.warehouse = "";
}, },
// //
open(mode = "add") { open(mode = "add",codeText="") {
this.mode = mode; this.mode = mode;
if(codeText&&codeText!=''){
this.codeText = codeText;
}
this.visible = true; this.visible = true;
return this; return this;
}, },