diff --git a/src/api/model/cm.js b/src/api/model/cm.js
index 55e3d55c..cf9940e3 100644
--- a/src/api/model/cm.js
+++ b/src/api/model/cm.js
@@ -95,7 +95,7 @@ export default {
}
},
sendToCoder:{
- name: "下发到打码器",
+ name: "下发到喷码",
req: async function(id, data){
return await http.post(
`${config.API_URL}/cm/labeltemplate/${id}/send_to_coder/`,
diff --git a/src/layout/components/userbar.vue b/src/layout/components/userbar.vue
index 36040479..25213f3e 100644
--- a/src/layout/components/userbar.vue
+++ b/src/layout/components/userbar.vue
@@ -5,6 +5,11 @@
+
+
+
+
+
@@ -104,6 +109,25 @@
保存
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 保存
+
+
+
-
-
+
+
-
+
-
+
-
+
+
+
+
+ {{ ((scope.row.合格数/scope.row.生产数)*100).toFixed(2) + '%' }}
+
@@ -68,6 +80,7 @@ export default {
data() {
return {
query:{
+ batch:'',
end_date:'',
material_name:'',
start_date:'2025-11-01',
@@ -112,6 +125,38 @@ export default {
handleQuery(){
this.getData();
},
+ getSummaries({ columns, data }) {
+ const sums = [];
+ let total = columns.length;
+ columns.forEach((column, index) => {
+ if (index === 0) {
+ sums[index] = "合计";
+ return;
+ }
+ if (index
+ Number(item[column.property])
+ );
+ if (!values.every((value) => Number.isNaN(value))) {
+ sums[index] = values.reduce((prev, curr) => {
+ const value = Number(curr);
+ let sum = Number(
+ Number(prev) + Number(curr)
+ ).toFixed(1);
+ if (!isNaN(value)) {
+ return sum;
+ } else {
+ return prev;
+ }
+ }, 0);
+ }
+ }
+ if(index==5){
+ sums[index] = ((sums[3]/sums[2])*100).toFixed(2) + '%';
+ }
+ });
+ return sums;
+ },
},
};
diff --git a/src/views/statistics/bxerp/workHoursPB.vue b/src/views/statistics/bxerp/workHoursPB.vue
index c854a793..ad77f320 100644
--- a/src/views/statistics/bxerp/workHoursPB.vue
+++ b/src/views/statistics/bxerp/workHoursPB.vue
@@ -41,7 +41,7 @@
stripe
>
-
+
@@ -108,9 +108,9 @@
stripe
>
-
+
-
+
@@ -346,12 +346,17 @@ export default {
methods: {
getData1(){
let that = this;
+ let userList = [],users = [];
let nameList = [],names = [];
let params = {};
params.query = that.query;
that.$API.bi.dataset.exec.req('product_defect_pb_m', params).then((res) => {
let data = res.data2.ds0;
data.forEach(item=>{
+ if(users.indexOf(item.员工)>-1){}else{
+ users.push(item.员工);
+ userList.push({text:item.员工,value:item.员工})
+ }
if(names.indexOf(item.物料名)>-1){}else{
names.push(item.物料名);
nameList.push({text:item.物料名,value:item.物料名})
@@ -366,7 +371,7 @@ export default {
item.剪切合格 = item['剪切¢18.3mm不合格']?item['剪切¢18.3mm可加工']?item.总切片数 - item['剪切¢18.3mm可加工'].含- item['剪切¢18.3mm不合格'].含:item.总切片数 - item['剪切¢18.3mm不合格'].含:item['剪切¢18.3mm可加工']?item.总切片数 - item['剪切¢18.3mm可加工'].含:item.总切片数;
let count_hgls = item.暗点合格?item.暗点合格.含:0;
let count1 = item['剪切¢18.3mm不合格']?item.总切片数 - item.长点数 - item['剪切¢18.3mm不合格'].含:item.总切片数 - item.长点数;
- if(item['剪切¢18.3mm不合格']&&item['剪切¢18.3mm不合格'].组!==null){
+ if(item['剪切¢18.3mm不合格']&&item['剪切¢18.3mm不合格'].组){
if(item['剪切¢18.3mm不合格'].组['剪切¢18.3mm不合格+暗点不合格']){
count1 = count1 + item['剪切¢18.3mm不合格+暗点不合格'];
}
@@ -384,6 +389,7 @@ export default {
item.合格率数 = count_hgls;//:在暗点合格含里刨除剪切可加工和剪切不合格
})
that.$nextTick(() => {
+ that.userFilters = userList;
that.nameFilters = nameList;
that.tableData = data;
})
@@ -392,10 +398,20 @@ export default {
getData2(){
let that = this;
let params = {};
+ let userList = [],users = [];
+ let nameList = [],names = [];
params.query = that.query;
that.$API.bi.dataset.exec.req('product_defect_pb_user_mname', params).then((res) => {
let data = res.data2.ds0;
data.forEach(item=>{
+ if(users.indexOf(item.员工)>-1){}else{
+ users.push(item.员工);
+ userList.push({text:item.员工,value:item.员工})
+ }
+ if(names.indexOf(item.物料名)>-1){}else{
+ names.push(item.物料名);
+ nameList.push({text:item.物料名,value:item.物料名})
+ }
if(item.缺陷分布!==null){
let defect = JSON.parse(item.缺陷分布);
for(let key in defect){
@@ -406,7 +422,7 @@ export default {
item.剪切合格 = item['剪切¢18.3mm不合格']?item['剪切¢18.3mm可加工']?item.总切片数 - item['剪切¢18.3mm可加工'].含- item['剪切¢18.3mm不合格'].含:item.总切片数 - item['剪切¢18.3mm不合格'].含:item['剪切¢18.3mm可加工']?item.总切片数 - item['剪切¢18.3mm可加工'].含:item.总切片数;
let count_hgls = item.暗点合格?item.暗点合格.含:0;
let count1 = item['剪切¢18.3mm不合格']?item.总切片数 - item.长点数 - item['剪切¢18.3mm不合格'].含:item.总切片数 - item.长点数;
- if(item['剪切¢18.3mm不合格']&&item['剪切¢18.3mm不合格'].组!==null){
+ if(item['剪切¢18.3mm不合格']&&item['剪切¢18.3mm不合格'].组){
if(item['剪切¢18.3mm不合格'].组['剪切¢18.3mm不合格+暗点不合格']){
count1 = count1 + item['剪切¢18.3mm不合格+暗点不合格'];
}
@@ -424,6 +440,8 @@ export default {
item.合格率数 = count_hgls;
})
that.$nextTick(() => {
+ that.userFilters = userList;
+ that.nameFilters = nameList;
that.tableData = data;
})
});
@@ -460,7 +478,7 @@ export default {
item.剪切合格 = item['剪切¢18.3mm不合格']?item['剪切¢18.3mm可加工']?item.总切片数 - item['剪切¢18.3mm可加工'].含- item['剪切¢18.3mm不合格'].含:item.总切片数 - item['剪切¢18.3mm不合格'].含:item['剪切¢18.3mm可加工']?item.总切片数 - item['剪切¢18.3mm可加工'].含:item.总切片数;
let count_hgls = item.暗点合格?item.暗点合格.含:0;
let count1 = item['剪切¢18.3mm不合格']?item.总切片数 - item.长点数 - item['剪切¢18.3mm不合格'].含:item.总切片数 - item.长点数;
- if(item['剪切¢18.3mm不合格']&&item['剪切¢18.3mm不合格'].组!==null){
+ if(item['剪切¢18.3mm不合格']&&item['剪切¢18.3mm不合格'].组){
if(item['剪切¢18.3mm不合格'].组['剪切¢18.3mm不合格+暗点不合格']){
count1 = count1 + item['剪切¢18.3mm不合格+暗点不合格'];
}
@@ -512,7 +530,7 @@ export default {
item.剪切合格 = item['剪切¢18.3mm不合格']?item['剪切¢18.3mm可加工']?item.总切片数 - item['剪切¢18.3mm可加工'].含- item['剪切¢18.3mm不合格'].含:item.总切片数 - item['剪切¢18.3mm不合格'].含:item['剪切¢18.3mm可加工']?item.总切片数 - item['剪切¢18.3mm可加工'].含:item.总切片数;
let count_hgls = item.暗点合格?item.暗点合格.含:0;
let count1 = item['剪切¢18.3mm不合格']?item.总切片数 - item.长点数 - item['剪切¢18.3mm不合格'].含:item.总切片数 - item.长点数;
- if(item['剪切¢18.3mm不合格']&&item['剪切¢18.3mm不合格'].组!==null){
+ if(item['剪切¢18.3mm不合格']&&item['剪切¢18.3mm不合格'].组){
if(item['剪切¢18.3mm不合格'].组['剪切¢18.3mm不合格+暗点不合格']){
count1 = count1 + item['剪切¢18.3mm不合格+暗点不合格'];
}
diff --git a/src/views/sys/labeltemplate.vue b/src/views/sys/labeltemplate.vue
index c9aa249b..d8b6e113 100644
--- a/src/views/sys/labeltemplate.vue
+++ b/src/views/sys/labeltemplate.vue
@@ -13,11 +13,6 @@
-
-
- {{ scope.row.coder_ip }}:{{ scope.row.coder_port }}
-
-
@@ -47,15 +42,6 @@
:key="item.id">
-
-
-
-
-
-
-
-
-
@@ -71,9 +57,6 @@
id:"",
name: "",
commands: "",
- coder_ip: "",
- coder_port: 3100,
- coder_field: "1",
};
export default {
name: 'labeltemplate',
@@ -132,7 +115,6 @@
let arr = [];
arr = that.addForm.commands.split("\n");
that.addForm.commands = arr;
- if (!that.addForm.coder_ip) that.addForm.coder_ip = null;
if(this.type==='add'){
this.$API.cm.labeltemplate.create.req(that.addForm).then(res=>{
this.isSaveing = false;
@@ -156,9 +138,6 @@
this.addForm.id=row.id;
this.addForm.name=row.name;
this.addForm.commands=row.commands.join("\n");
- this.addForm.coder_ip=row.coder_ip;
- this.addForm.coder_port=row.coder_port;
- this.addForm.coder_field=row.coder_field || "1";
this.limitedVisible = true;
},
diff --git a/src/views/wpm_bx/wprList.vue b/src/views/wpm_bx/wprList.vue
index de0e49a8..a43fd34f 100644
--- a/src/views/wpm_bx/wprList.vue
+++ b/src/views/wpm_bx/wprList.vue
@@ -12,6 +12,7 @@
批量喷码
{
that.$message.warning("请先设置打印机");
}
},
- //喷码: 通过名为'喷码模板'的标签模板向打码器下发产品编号
+ //把 wpr 行转成模板渲染数据
+ rowToTdata(row){
+ return {
+ number: row.number,
+ name: (row.material_name||'').split('|')[0],
+ ofrom_name: this.ofromName,
+ ofrom_batch: this.ofromBatch,
+ };
+ },
+ //下发喷码: 单行入队 1 条
sendToCoder(row){
let that = this;
if (that.coderLoadingIds[row.id]) return;
- that.coderLoadingIds = { ...that.coderLoadingIds, [row.id]: true };
- let templateName = '喷码模板';
- let tdata = {
- number: row.number,
- name: (row.material_name||'').split('|')[0],
- ofrom_name: that.ofromName,
- ofrom_batch: that.ofromBatch,
- };
let release = () => {
let map = { ...that.coderLoadingIds };
delete map[row.id];
that.coderLoadingIds = map;
};
- that.$API.cm.labeltemplate.list.req({name: templateName, page: 0}).then((res) => {
- let list = Array.isArray(res) ? res : (res && res.results) || [];
- let template = list.find(t => t.name === templateName);
- if (!template) {
- that.$message.error(`未找到标签模板: ${templateName}`);
- release();
- return;
- }
- if (!template.coder_ip) {
- that.$message.error(`模板 ${templateName} 未配置打码器IP`);
- release();
- return;
- }
- that.$API.cm.labeltemplate.sendToCoder.req(template.id, {tdata}).then(() => {
- that.$message.success("喷码下发成功");
- }).finally(release);
- }).catch(release);
+ that.coderLoadingIds = { ...that.coderLoadingIds, [row.id]: true };
+ that._postCoder([that.rowToTdata(row)])
+ .then(() => that.$message.success("喷码下发成功"))
+ .finally(release);
},
handleSelectionChange(rows){
this.selectedRows = rows;
},
+ //批量喷码: 一次请求入队 N 条
batchSendToCoder(){
let that = this;
- that.selectedRows.forEach(row => {
- that.sendToCoder(row);
+ if (!that.selectedRows.length || that.batchCoderLoading) return;
+ let tdataList = that.selectedRows.map(r => that.rowToTdata(r));
+ that.batchCoderLoading = true;
+ that._postCoder(tdataList)
+ .then(() => that.$message.success(`已入队 ${tdataList.length} 条`))
+ .finally(() => { that.batchCoderLoading = false; });
+ },
+ //公共: 查模板 + 拼 body + 调接口
+ _postCoder(tdataList){
+ let that = this;
+ let coder_ip = localStorage.getItem('coder_ip') || '';
+ let coder_port = localStorage.getItem('coder_port') || '';
+ let coder_field = localStorage.getItem('coder_field') || '';
+ if (!coder_ip) {
+ that.$message.error('请先在右上角"喷码设置"配置喷码IP');
+ return Promise.reject(new Error('no coder_ip'));
+ }
+ let templateName = '喷码模板';
+ return that.$API.cm.labeltemplate.list.req({name: templateName, page: 0}).then((res) => {
+ let list = Array.isArray(res) ? res : (res && res.results) || [];
+ let template = list.find(t => t.name === templateName);
+ if (!template) {
+ that.$message.error(`未找到标签模板: ${templateName}`);
+ return Promise.reject(new Error('no template'));
+ }
+ let body = {tdata_list: tdataList, coder_ip};
+ if (coder_port) body.coder_port = Number(coder_port);
+ if (coder_field) body.coder_field = coder_field;
+ return that.$API.cm.labeltemplate.sendToCoder.req(template.id, body);
});
},
//本地更新数据