This commit is contained in:
zty 2025-01-13 18:03:05 +08:00
commit 5f116bed5f
7 changed files with 222 additions and 215 deletions

View File

@ -240,6 +240,16 @@
<el-dialog v-model="printVisible" width="1200px">
<print :baseData="mioObj" :tableData="tableData" :type="mioObj.type" @closePrint="printVisible=false"/>
</el-dialog>
<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>
</el-form-item>
</el-form>
<el-footer>
<el-button type="primary" @click="savePrinter">保存</el-button>
</el-footer>
</el-dialog>
</template>
<script>
import saveDialog from "./mioitem_form.vue";
@ -297,7 +307,9 @@ export default {
// cate: "",
objitem: {},
mtype:10,
project_code:''
project_code:'',
setNameVisible:false,
printer_name:localStorage.getItem("printer_name")
};
},
mounted() {
@ -311,6 +323,15 @@ export default {
this.getMio();
},
methods: {
printSetting(){
this.setNameVisible = true;
},
savePrinter() {
let that = this;
localStorage.setItem("printer_name", that.printer_name);
that.setNameVisible = false;
that.$message.success("打印机设置成功,请重新进行打印操作。");
},
open() {
this.visible = true;
},
@ -423,25 +444,29 @@ export default {
//
printMaterial(row){
let that = this;
that.apiObj.req({tid:row.id}).then((res) => {
let code = res.code_label;
let str = [
"SIZE 40 mm,70 mm",
"GAP 7 mm,7 mm",
"CLS",
"REFERENCE 0,0",
'QRCODE 30,400,H,5,A,0,"' +code +'"',
"WINTEXT 200,550,28,90,0,0,Simhei," + res.material_name,
"WINTEXT 240,550,28,90,0,0,Simhei," + res.batch,
"PRINT 1",
];
let obj = {};
obj.printer_commands = str;
obj.printer_name = that.printer_name;
that.$API.wpm.prints.req(obj).then((response) => {
that.$message.success("打印成功");
});
})
if(that.printer_name!==''&&that.printer_name!==null&&that.printer_name!==undefined){
that.$API.cm.labelmat.fromWm.req({tid:row.id}).then((res) => {
let code = res.code_label;
let str = [
"SIZE 40 mm,70 mm",
"GAP 7 mm,7 mm",
"CLS",
"REFERENCE 0,0",
'QRCODE 30,400,H,5,A,0,"' +code +'"',
"WINTEXT 200,550,28,90,0,0,Simhei," + res.material_name,
"WINTEXT 240,550,28,90,0,0,Simhei," + res.batch,
"PRINT 1",
];
let obj = {};
obj.printer_commands = str;
obj.printer_name = that.printer_name;
that.$API.wpm.prints.req(obj).then((response) => {
that.$message.success("打印成功");
});
})
}else{
that.printSetting();
}
},
},
};

View File

@ -44,62 +44,12 @@
></el-input>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24" v-if="form.type2==20">
<el-form-item label="检验数量">
<el-input-number
:max="batchCount"
controls-position="right"
v-model="form.count"
style="width: 100%"
precision="0"
@change="handleCountNotokChange"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24" v-if="form.type2==20">
<el-form-item label="合格数量">
<el-input v-model="form.count_ok" disabled></el-input>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24" v-if="form.type2==10">
<el-col :md="12" :sm="24">
<el-form-item label="抽检数量">
<el-input-number
:max="batchCount"
controls-position="right"
v-model="form.count_sampling"
style="width: 100%"
precision="0"
@change="handleCountNotokChange"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24" v-if="form.type2==10">
<el-form-item label="抽检合格数">
<el-input-number
controls-position="right"
v-model="form.count_sampling_ok"
style="width: 100%"
disabled
precision="0"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="不合格数量">
<el-input-number
controls-position="right"
v-model="form.count_notok"
style="width: 100%"
precision="0"
@change="handleCountNotokChange"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="合格率">
<el-input-number
controls-position="right"
v-model="count_ok_rate"
v-model="form.count"
style="width: 100%"
precision="0"
></el-input-number>
@ -134,8 +84,19 @@
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :md="12" :sm="24" v-for="item in qct_defects" :key="item.id">
<el-form-item :label="item.name">
<el-input-number
:precision="0"
style="width: 100%;"
v-model="item.count"
placeholder="请输入数量"
></el-input-number>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-main>
<el-footer>
<el-button type="primary" :loading="isSaveing" @click="submit"
@ -172,16 +133,18 @@ export default {
type2:10,
test_date: "",
batch: "",
count: null,
count_ok: 0,
count_sampling_ok:'',
count_notok: 0,
count: 0,
wm: "",
test_user: "",
qct:"",
need_update_wm:true,
ftestworkdefect:[],
},
count_ok_rate:100,
rules: {
test_date: [{required: true,message: "请选择检验日期",trigger: "blur"}],
batch: [{required: true,message: "请选择物料批次",trigger: "blur"}],
test_user: [{required: true,message: "请选择物料批次",trigger: "blur"}],
test_user: [{required: true,message: "请选择检验人",trigger: "blur"}],
},
options: [],
userList : [],
@ -200,19 +163,14 @@ export default {
};
},
mounted() {
console.log('this.itemObj',this.itemObj);
this.form.count_sampling_ok =
this.form.count_sampling =
this.form.count_ok =
this.form.count =
this.batchCount =
this.itemObj.count;
this.form.count =this.batchCount = this.itemObj.count;
this.form.batch = this.itemObj.batch;
this.form.wm = this.itemObj.id;
this.form.supplier = this.itemObj.supplier;
this.deptID = this.$TOOL.data.get('gx_deptID');
this.deptID = this.$TOOL.data.get('bx_deptID');
this.getUsers();
this.getdefects();
if(this.itemObj.material_.tracking==10){
this.getdefects();
}
},
methods: {
//
@ -224,17 +182,11 @@ export default {
getUsers(){
let that = this;
let userList = [];
that.$API.system.user.list
.req({ page: 0, posts__code__contains: "check" })
.then((res) => {
userList = res;
// that.$API.system.user.list.req({ depts: that.deptID, page: 0 })
// .then((res2) => {
// res2.forEach((item) => {
// userList.push(item);
// });
// that.userList = userList ;
// });
that.$API.system.user.list.req({ depts: that.deptID, page: 0 }).then((res2) => {
res2.forEach((item) => {
userList.push(item);
});
that.userList = userList ;
});
},
//
@ -242,70 +194,55 @@ export default {
let that = this;
that.$API.qm.qct.list.req({ page: 0, qctmat__material: that.itemObj.material }).then((res) => {
if(res.length>0){
that.form.qct = res[0].id;
that.$API.qm.qct.item.req(res[0].id).then((res) => {
that.qct_defects = res.qct_defects;
let qct_defects= [];
res.qct_defects.forEach((item) => {
let obj = {};
obj.name = item.defect_name;
obj.defect = item.defect;
obj.count = 0;
qct_defects.push(obj);
})
that.qct_defects = qct_defects;
console.log('that.qct_defects',that.qct_defects);
})
}
});
},
handleCountChange(type){
this.form.count_notok
this.handleCountNotokChange();
},
handleCountNotokChange(){
if(this.form.type2==10){//
this.form.count_sampling_ok = this.form.count_sampling - this.form.count_notok;
this.count_ok_rate = ((this.form.count_sampling_ok/this.form.count_sampling)*100).toFixed(2);
this.form.count_ok = this.form.count;
}else if(this.form.type2==20){//
this.form.count_ok = this.form.count - this.form.count_notok;
this.count_ok_rate = ((this.form.count_ok/this.form.count)*100).toFixed(2);
this.form.count_ok = this.form.count;
}
},
//
getMaterialBatch() {
let that = this;
let obj = {page: 0, count__gte: 0, count_xtest__gte: 0};
//
obj.mgroupx = that.mgroup;
that.$API.wpm.wmaterial.list.req(obj).then((res) => {
that.options = res;
});
},
//
submit() {
let that = this;
this.$refs.dialogForm.validate(async (valid) => {
if (valid) {
that.isSaveing = true;
let count_notok;
if(count_notok>that.form.count_notok){
that.$notify.error("不合格数量有问题");
that.isSaveing = false;
}else{
if(count_notok<that.form.count_notok){
that.count_notok_json.count_n_qt = that.form.count_notok-count_notok;
}
if(that.supplier!== null&&that.form.type2==10){
that.form.need_update_wm = false;
}
if(that.form.type2==10){//
that.form.count_sampling_ok = that.form.count_sampling - that.form.count_notok;
}else{//
that.form.count_ok = that.form.count - that.form.count_notok;
}
that.$API.qm.ftestwork.create.req(that.form).then((res) => {
that.$API.qm.ftestwork.submit.req(res.id)
.then((res) => {
that.isSaveing = false;
that.visible = false;
that.$emit("success");
that.$message.success("操作成功");
})
}).catch( err=>{
//
that.form.ftestworkdefect = [];
that.qct_defects.forEach((item) => {
let obj = {};
obj.defect = item.defect;
obj.count = item.count;
that.form.ftestworkdefect.push(obj);
})
console.log('that.form',that.form);
that.$API.qm.ftestwork.create.req(that.form).then((res) => {
that.$API.qm.ftestwork.submit.req(res.id)
.then((res) => {
that.isSaveing = false;
})
}
that.visible = false;
that.$emit("success");
that.$message.success("操作成功");
})
}).catch( err=>{
//
that.isSaveing = false;
})
}
});
},

View File

@ -97,13 +97,13 @@
prop="material_name"
min-width="140"
></el-table-column>
<el-table-column label="批次" prop="batch" width="100">
<el-table-column label="批次" prop="batch" min-width="80">
<template #default="scope">
<el-text v-if="scope.row.handoverb.length>0" type="primary">{{scope.row.handoverb.length}}</el-text>
</template>
</el-table-column>
<el-table-column label="数量" prop="count" width="80"></el-table-column>
<el-table-column label="交接类型" prop="type" width="100">
<el-table-column label="数量" prop="count" min-width="80"></el-table-column>
<el-table-column label="交接类型" prop="type" min-width="80">
<template #default="scope" v-if="mgroup_name=='size'||mgroup_name=='facade'">
<el-text v-if="scope.row.send_dept == deptId" type="primary">交送</el-text>
<el-text v-if="scope.row.recive_dept == deptId" type="success">接收</el-text>
@ -113,6 +113,12 @@
<el-text v-if="scope.row.recive_mgroup == mgroupId" type="success">接收</el-text>
</template>
</el-table-column>
<el-table-column label="交接工段" min-width="80">
<template #default="scope">
<el-text v-if="scope.row.send_mgroup == mgroupId">{{scope.row.send_mgroup_name}}</el-text>
<el-text v-if="scope.row.recive_mgroup == mgroupId">{{scope.row.recive_mgroup_name}}</el-text>
</template>
</el-table-column>
<el-table-column label="交接类别" prop="type" width="80">
<template #default="scope">
<el-tag v-if="scope.row.type == 10" type="success"

View File

@ -111,7 +111,7 @@
width="120"
>
<template #default="scope">
<el-link :underline="false" @click="printMaterial(scope.row)" type="primary">物料标签</el-link>
<el-link :underline="false" @click="printMaterial(scope.row,'wm')" type="primary">物料标签</el-link>
<el-link
v-if="scope.row.material_&&scope.row.material_.tracking==10"
:underline="false"
@ -134,8 +134,6 @@
<check-dialog
v-if="dialog.check"
ref="checkDialog"
:mgroup="mgroupId"
:mgroupName="mgroup_name"
:itemObj = "checkItem"
@success="handleSaveSuccess"
@closed="dialog.check = false"
@ -186,6 +184,16 @@
</span>
</template>
</el-table-column>
<el-table-column
label="操作"
fixed="right"
align="center"
width="120"
>
<template #default="scope">
<el-link :underline="false" @click="printMaterial(scope.row,'wpr')" type="primary">物料标签</el-link>
</template>
</el-table-column>
</scTable>
</template>
<template #footer>
@ -194,6 +202,16 @@
</div>
</template>
</el-drawer>
<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>
</el-form-item>
</el-form>
<el-footer>
<el-button type="primary" @click="savePrinter">保存</el-button>
</el-footer>
</el-dialog>
</el-container>
</template>
<script>
@ -261,6 +279,7 @@ export default {
materialsVisible:false,
visibleDrawer: false,
wprVisibleDrawer:false,
setNameVisible:false,
wprApiObj:this.$API.wpm.wpr,
apiObjPrint:this.$API.cm.labelmat.fromWm,
printer_name:localStorage.getItem("printer_name"),
@ -272,31 +291,19 @@ export default {
this.getMgroupInfo();
},
methods: {
printSetting(){
this.setNameVisible = true;
},
savePrinter() {
let that = this;
localStorage.setItem("printer_name", that.printer_name);
that.setNameVisible = false;
that.$message.success("打印机设置成功,请重新进行打印操作。");
},
getMgroupInfo(){
let that = this;
console.log('mgroupName',that.mgroupName);
if(that.mgroupName=="size"){
// that.params.material__process__name = "";
that.$API.system.dept.list.req({name__contains:'尺寸',page:0}).then((res) => {
if(res.length>0){
that.params.mgroupx = null;
that.params.belong_dept=res[0].id;
}
that.apiObj = that.$API.wpm.wmaterial.list;
that.$refs.table.refresh();
})
}else if(that.mgroupName=="facade"){
// that.params.material__process__name = "";
that.$API.system.dept.list.req({name__contains:'外观',page:0}).then((res) => {
if(res.length>0){
that.params.mgroupx = null;
that.params.belong_dept=res[0].id;
}
that.apiObj = that.$API.wpm.wmaterial.list;
that.$refs.table.refresh();
})
}else{
that.$API.mtm.mgroup.list
that.$API.mtm.mgroup.list
.req({ page: 0, name: that.mgroupName })
.then((res) => {
if (res.length < 1) {
@ -311,7 +318,6 @@ export default {
that.apiObj = that.$API.wpm.wmaterial.list;
that.$refs.table.refresh();
});
}
},
add() {
this.dialog.save = true;
@ -383,27 +389,51 @@ export default {
this.$refs.table.refresh();
},
//
printMaterial(row){
printMaterial(row,type){
let that = this;
that.apiObj.req({tid:row.id}).then((res) => {
let code = res.code_label;
let str = [
"SIZE 40 mm,70 mm",
"GAP 7 mm,7 mm",
"CLS",
"REFERENCE 0,0",
'QRCODE 30,400,H,5,A,0,"' +code +'"',
"WINTEXT 200,550,28,90,0,0,Simhei," + res.material_name,
"WINTEXT 240,550,28,90,0,0,Simhei," + res.batch,
"PRINT 1",
];
let obj = {};
obj.printer_commands = str;
obj.printer_name = that.printer_name;
that.$API.wpm.prints.req(obj).then((response) => {
that.$message.success("打印成功");
});
})
if(that.printer_name!==''&&that.printer_name!==null&&that.printer_name!==undefined){
if(type=='wm'){
that.apiObjPrint.req({tid:row.id}).then((res) => {
let code = res.code_label;
let str = [
"SIZE 40 mm,70 mm",
"GAP 7 mm,7 mm",
"CLS",
"REFERENCE 0,0",
'QRCODE 30,400,H,5,A,0,"' +code +'"',
"WINTEXT 200,550,28,90,0,0,Simhei," + res.material_name,
"WINTEXT 240,550,28,90,0,0,Simhei," + res.batch,
"PRINT 1",
];
let obj = {};
obj.printer_commands = str;
obj.printer_name = that.printer_name;
that.$API.wpm.prints.req(obj).then((response) => {
that.$message.success("打印成功");
});
})
}else{
let code = 'wpr#'+row.id;
let str = [
"SIZE 70 mm,100 mm",
"GAP 7 mm,7 mm",
"CLS",
"REFERENCE 0,0",
'QRCODE 30,400,H,5,A,0,"' +code +'"',
"WINTEXT 200,550,28,90,0,0,Simhei," + row.material_name,
"WINTEXT 240,550,28,90,0,0,Simhei," + row.number,
"PRINT 1",
];
let obj = {};
obj.printer_commands = str;
obj.printer_name = that.printer_name;
that.$API.wpm.prints.req(obj).then((response) => {
that.$message.success("打印成功");
});
}
}else{
that.printSetting();
}
},
inmCheck(row){
let that = this;

View File

@ -251,9 +251,8 @@
hidePagination
>
<el-table-column type="index" width="50" />
<el-table-column type="expand">
<!-- <el-table-column type="expand">
<template #default="props">
<!-- 检测项和判断项 -->
<div style="padding-left: 50px">
<el-descriptions :column="4">
<el-descriptions-item label="破损">
@ -262,7 +261,7 @@
</el-descriptions>
</div>
</template>
</el-table-column>
</el-table-column> -->
<el-table-column
label="产出物料"
prop="material_out_name"

View File

@ -181,23 +181,33 @@ export default {
});
},
//
formWminChange(wm_in){
// wm_in:
let that = this;
let arr = that.materialOptions.filter((item) => {
return item.batch == wm_in;
});
if (arr.length > 0) {
that.form.batch = wm_in;
that.form.wm_in = arr[0].id;
that.form.count_use = arr[0].count;
// if(that.tracking==10){}else{
// that.submit();//
// }
}else{
formWminChange(code){
let that = this,codeId='',arr=[];
if(code.indexOf("#")>-1){
let arrs = code.split("#");
codeId = arrs[1];
}
this.$API.cm.labelmat.item.req(codeId).then((res) => {
if(res){
arr = that.materialOptions.filter((item) => {
return item.batch == res.batch&&item.material==res.material&&item.state==res.state;
})
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{
that.wm_in = '';
}
}).catch((err) => {
that.wm_in = '';
that.$message.error("批次号不存在");
}
});
},
//
submit() {

View File

@ -50,7 +50,7 @@
@click="mtask_submit(scope.row)"
>提交
</el-button>
<el-button
<!-- <el-button
link
size="small"
v-auth="'mtask.submit'"
@ -58,7 +58,7 @@
v-if="scope.row.state == 20 "
@click="mtask_deliver(scope.row)"
>分配
</el-button>
</el-button> -->
</template>
</el-table-column>
</scTable>