diff --git a/.env.development b/.env.development index 88d1f4fa..bf2585f4 100644 --- a/.env.development +++ b/.env.development @@ -21,8 +21,11 @@ VUE_APP_PJ = 'gx' # VUE_APP_BASEURL = http://10.50.211.228:2250/ -VUE_APP_API_BASEURL = http://127.0.0.1:2226/api -VUE_APP_BASEURL = http://127.0.0.1:2226 +# VUE_APP_API_BASEURL = http://127.0.0.1:2226/api +# VUE_APP_BASEURL = http://127.0.0.1:2226 + +VUE_APP_API_BASEURL = http://10.0.11.51:2250/api +VUE_APP_BASEURL = http://10.0.11.51:2250 # 托克逊 # VUE_APP_API_BASEURL = http://10.50.211.228:2250/api diff --git a/.gitignore b/.gitignore index 47ac71d9..a8692201 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,8 @@ node_modules /public/glb/ /dist .VSCodeCounter/ +.claude/ +.codex/ # local env files .env.local @@ -14,6 +16,7 @@ node_modules .env.production .env.development + # Log files npm-debug.log* yarn-debug.log* @@ -28,5 +31,7 @@ pnpm-debug.log* *.njsproj *.sln *.sw? +*.bat /package-lock.json +/vue.config.js diff --git a/src/api/model/cm.js b/src/api/model/cm.js index cf9940e3..f50827e6 100644 --- a/src/api/model/cm.js +++ b/src/api/model/cm.js @@ -101,6 +101,14 @@ export default { `${config.API_URL}/cm/labeltemplate/${id}/send_to_coder/`, data); } + }, + sendToHanslaser:{ + name: "下发到激光", + req: async function(id, data){ + return await http.post( + `${config.API_URL}/cm/labeltemplate/${id}/send_to_hanslaser/`, + data); + } } } } diff --git a/src/api/model/em.js b/src/api/model/em.js index 405c35e0..17fc615b 100644 --- a/src/api/model/em.js +++ b/src/api/model/em.js @@ -126,6 +126,14 @@ export default { data); } }, + get_svs_char: { + name: "获取数据识别", + req: async function(data){ + return await http.get( + `${config.API_URL}/em/equipment/get_svs_char/`, + data); + } + } }, //巡检记录 einspect: { diff --git a/src/api/model/hfnf.js b/src/api/model/hfnf.js index 1e12772b..2343af9e 100644 --- a/src/api/model/hfnf.js +++ b/src/api/model/hfnf.js @@ -6,11 +6,24 @@ export default { name: "列表", req: async function(data){ return await http.post( - `${config.HOST_URL}/hfnf_api/mplogx/`, + // 同源路径,由 nginx(/factory_api/) 反向代理到统计服务 10.0.11.52:5800 + `${config.HOST_URL}/factory_api/mplogx/`, // "http://10.0.11.52:5800/mplogx/", data ); } }, + }, + stats: { + list: { + name: "数据统计", + req: async function(params){ + return await http.get( + // 同源路径,由 nginx(/factory_api/) 反向代理到统计服务 10.0.11.52:5800 + `${config.HOST_URL}/factory_api/stats`, + params + ); + } + }, } } \ No newline at end of file diff --git a/src/config/route.js b/src/config/route.js index 5e652bc8..02e6b26a 100644 --- a/src/config/route.js +++ b/src/config/route.js @@ -127,6 +127,7 @@ const routes = [ name: "cement_data_template", path: "/cement_data_template", meta: { + hidden: true, title: "数据模板", }, component: "home/cement_data_template", @@ -3528,6 +3529,7 @@ const routes = [ path: "/statistic/task_rate", meta: { title: "任务进度", + hidden: true, // icon: "el-icon-DataAnalysis", perms: ["statistic_wpm"], }, @@ -3595,6 +3597,7 @@ const routes = [ name: "user_statistics", meta: { title: "绩效统计", + hidden: true, icon: "el-icon-trend-charts", perms: ["statistic_kpi"], }, diff --git a/src/layout/components/userbar.vue b/src/layout/components/userbar.vue index 5993f14d..16902e1a 100644 --- a/src/layout/components/userbar.vue +++ b/src/layout/components/userbar.vue @@ -1,13 +1,39 @@ + + diff --git a/src/views/bigScreen/index_photon.vue b/src/views/bigScreen/index_photon.vue index 7eceb216..28274167 100644 --- a/src/views/bigScreen/index_photon.vue +++ b/src/views/bigScreen/index_photon.vue @@ -132,7 +132,7 @@ id="dashbordProcess" > {{ dialogData.percentage }}%{{ dialogData.percentage }} 完成进度 @@ -216,7 +216,7 @@ id="dashbordProcess" > {{ currentData.percentage }}%{{ currentData.percentage }}

完成进度

@@ -444,29 +444,40 @@ export default { yesterday: "", dept6Obj: { deptName: "光学精密加工车间", - percentage: 100, + percentage: "100%", count_bang: 0, count_guan: 0, }, dept7Obj: { deptName: "光纤预制棒生产车间", - percentage: 100, + percentage: "100%", count_bang: 0, }, dept8Obj: { deptName: "玻璃配合料制备车间", - percentage: 100, + percentage: "100%", count: 0, }, dept10Obj: { deptName: "光纤预制管生产车间", - percentage: 100, + percentage: "100%", count_guan: 0, }, + isUnmounted: false, + pieChart: null, + line1Chart: null, + line2Chart: null, + line3Chart: null, + bar1Chart: null, + onResize: null, + onCanvasMouseMove: null, + onCanvasClick: null, + canvasEl: null, }; }, mounted() { loadBabylon().then(() => { + if (this.isUnmounted) return; this.initView(); }) }, @@ -536,27 +547,22 @@ export default { that.showTime(); }, 1000); that.notokTimer = setInterval(() => { + if (that.isUnmounted) return; let pieDom = document.getElementById("pie"); - if (pieDom) { - if (that.deptName == "10车间") { - that.deptName = "7车间"; - } else { - that.deptName = "10车间"; - } - let deptData = []; - if (that.deptName == "7车间") { - deptData = that.dept7Data; - } else { - deptData = that.dept10Data; - } - that.pieoption.series.data = deptData; - let pieoption = that.pieoption; - - let pieChart = echarts.init(pieDom); - pieChart.clear(); - pieChart.setOption(pieoption, true); + if (!pieDom) return; + if (that.deptName == "10车间") { + that.deptName = "7车间"; + } else { + that.deptName = "10车间"; } - }, 5000); + let deptData = + that.deptName == "7车间" ? that.dept7Data : that.dept10Data; + that.pieoption.series.data = deptData; + if (!that.pieChart || that.pieChart.isDisposed()) { + that.pieChart = echarts.init(pieDom); + } + that.pieChart.setOption(that.pieoption, true); + }, 60000); that.timerData = setInterval(() => { that.getDeptDetail(); }, 60000); @@ -592,8 +598,12 @@ export default { that.getCountDept7(); //左1---本周交付数 let chartDom = document.getElementById("line1"); + if (!chartDom) return; chartDom.style.height = this.blockHeight; - let myChart = echarts.init(chartDom); + if (!that.line1Chart || that.line1Chart.isDisposed()) { + that.line1Chart = echarts.init(chartDom); + } + let myChart = that.line1Chart; let option = { tooltip: { trigger: "axis", @@ -862,8 +872,12 @@ export default { } //柱状图折线 let line3Dom = document.getElementById("line3"); + if (!line3Dom) return; line3Dom.style.height = this.blockHeight; - let line3Chart = echarts.init(line3Dom); + if (!that.line3Chart || that.line3Chart.isDisposed()) { + that.line3Chart = echarts.init(line3Dom); + } + let line3Chart = that.line3Chart; let line3option = { tooltip: { trigger: "axis", @@ -980,12 +994,19 @@ export default { that.$API.bi.dataset.exec.req("materialCount", obj).then((res) => { let data = []; let list = res.data2.ds0; + let names = []; if (list.length > 0) { list.forEach((item) => { - let arr = []; - arr[0] = item.material_name ; - arr[1] = item.count; - data.push(arr); + let indexes = names.indexOf(item.material_name); + if(indexes === -1){ + names.push(item.material_name); + let arr = []; + arr[0] = item.material_name ; + arr[1] = item.count; + data.push(arr); + }else{ + data[indexes][1] = data[indexes][1] + item.count; + } }); } that.taskBoard.data = data; @@ -1217,7 +1238,7 @@ export default { // 添加抓取事件 const hl1 = new BABYLON.HighlightLayer("hl1", scene); const hl1Click = new BABYLON.HighlightLayer("hl1Click", scene); - canvas.addEventListener("mousemove", (event) => { + that.onCanvasMouseMove = (event) => { // 使用 scene.pick 检测鼠标拾取 const pickResult = scene.pick( scene.pointerX, @@ -1292,8 +1313,9 @@ export default { } else { that.infoVisibel = false; } - }); - canvas.addEventListener("click", (event) => { + }; + canvas.addEventListener("mousemove", that.onCanvasMouseMove); + that.onCanvasClick = (event) => { // 使用 scene.pick 检测鼠标拾取 const pickResult = scene.pick( scene.pointerX, @@ -1364,7 +1386,8 @@ export default { } } } - }); + }; + canvas.addEventListener("click", that.onCanvasClick); return scene; }; const scene = createScene(); //Call the createScene function @@ -1374,9 +1397,9 @@ export default { }); this.engine = engine; this.scene = scene; - window.addEventListener("resize", function () { - engine.resize(); - }); + this.canvasEl = canvas; + this.onResize = () => engine.resize(); + window.addEventListener("resize", this.onResize); }, getDeptData(name) { this.infoVisibel = true; @@ -1505,8 +1528,12 @@ export default { let that = this; //左边2 let bar1 = document.getElementById("bar1"); + if (!bar1) return; bar1.style.height = this.blockHeight; - let bar1Chart = echarts.init(bar1); + if (!that.bar1Chart || that.bar1Chart.isDisposed()) { + that.bar1Chart = echarts.init(bar1); + } + let bar1Chart = that.bar1Chart; let bar1option = { tooltip: { trigger: "axis", @@ -1655,8 +1682,12 @@ export default { bar1Chart.setOption(bar1option); //左3 let line2Dom = document.getElementById("line2"); + if (!line2Dom) return; line2Dom.style.height = this.blockHeight; - let line2Chart = echarts.init(line2Dom); + if (!that.line2Chart || that.line2Chart.isDisposed()) { + that.line2Chart = echarts.init(line2Dom); + } + let line2Chart = that.line2Chart; let line2option = { tooltip: { trigger: "axis", @@ -1845,8 +1876,12 @@ export default { line2Chart.setOption(line2option); //饼状图 let pieDom = document.getElementById("pie"); + if (!pieDom) return; pieDom.style.height = this.blockHeight; - let pieChart = echarts.init(pieDom); + if (!that.pieChart || that.pieChart.isDisposed()) { + that.pieChart = echarts.init(pieDom); + } + let pieChart = that.pieChart; let pieoption = { color: [ "rgb(237,224,45)", @@ -1914,22 +1949,53 @@ export default { }, }, beforeUnmount() { - let that = this; - clearInterval(that.timerTime); - clearInterval(that.timerData); - clearInterval(that.notokTimer); - that.timerTime = null; - that.timerData = null; - that.notokTimer = null; - }, - beforeDestoryed() { - let that = this; - clearInterval(that.timerTime); - clearInterval(that.timerData); - clearInterval(that.notokTimer); - that.timerTime = null; - that.timerData = null; - that.notokTimer = null; + this.isUnmounted = true; + // 定时器 + clearInterval(this.timerTime); + clearInterval(this.timerData); + clearInterval(this.notokTimer); + clearInterval(this.heightTimer); + this.timerTime = null; + this.timerData = null; + this.notokTimer = null; + this.heightTimer = null; + // echarts 实例 + [ + this.pieChart, + this.line1Chart, + this.line2Chart, + this.line3Chart, + this.bar1Chart, + ].forEach((c) => { + if (c && !c.isDisposed()) c.dispose(); + }); + this.pieChart = this.line1Chart = this.line2Chart = this.line3Chart = this.bar1Chart = null; + // 事件监听器 + if (this.onResize) { + window.removeEventListener("resize", this.onResize); + this.onResize = null; + } + if (this.canvasEl) { + if (this.onCanvasMouseMove) { + this.canvasEl.removeEventListener("mousemove", this.onCanvasMouseMove); + } + if (this.onCanvasClick) { + this.canvasEl.removeEventListener("click", this.onCanvasClick); + } + this.canvasEl = null; + } + this.onCanvasMouseMove = null; + this.onCanvasClick = null; + // babylon 引擎 + if (this.scene) { + try { this.scene.dispose(); } catch (e) {} + this.scene = null; + } + if (this.engine) { + try { this.engine.stopRenderLoop(); } catch (e) {} + try { this.engine.dispose(); } catch (e) {} + this.engine = null; + } }, }; diff --git a/src/views/em/equipment.vue b/src/views/em/equipment.vue index c96e9958..05337b33 100644 --- a/src/views/em/equipment.vue +++ b/src/views/em/equipment.vue @@ -7,8 +7,11 @@
+ :show-all-levels="false" @change="handleQuery" style="width:180px"> + + +
@@ -38,7 +41,7 @@ - + @@ -195,6 +198,7 @@ export default { data() { return { runningStateEnum, + cateOptions:[], deptOptions: [], dialog: { save: false, @@ -247,9 +251,16 @@ export default { }; }, mounted() { - this.getDept() + this.getDept(); + this.getCateOptions(); }, methods: { + getCateOptions() { + let that = this; + that.$API.em.ecate.list.req({page:0,type:10}).then(res => { + that.cateOptions = res; + }) + }, //表格选择后回调事件 selectionChange(selection) { this.selectiones = selection; diff --git a/src/views/fac_cal/hfnf_index.vue b/src/views/fac_cal/hfnf_index.vue index 7f08dc23..2e051bce 100644 --- a/src/views/fac_cal/hfnf_index.vue +++ b/src/views/fac_cal/hfnf_index.vue @@ -23,7 +23,7 @@ -
+
@@ -193,30 +193,32 @@ let pieChart = null const colors = ['#409eff', '#67c23a', '#e6a23c', '#f56c6c'] const bgColors = ['#ecf5ff', '#f0f9eb', '#fdf6ec', '#fef0f0'] -// 各工厂基础比例 -const baseFactories = [ - { name: '合肥南方', ratio: 0.4382 }, - { name: '中联万吨', ratio: 0.3081 }, - { name: '铜梁水泥', ratio: 0.1424 }, - { name: '槐坎南方水泥', ratio: 0.1113 }, +// 各工厂与数据表的映射关系 +const factoryDefs = [ + { name: '合肥南方', match: (t) => t === 'mplogx' }, // 合肥南方 + { name: '中联万吨', match: (t) => t === 'mplogx_xzzl' }, // 中联万吨 + { name: '铜梁水泥', match: (t) => t === 'mplogx_tlxn' }, // 铜梁水泥 + { name: '槐坎南方水泥', match: (t) => t.startsWith('mplogx_hknf') }, // 槁坎南方水泥 ] const totalCount = ref(0) +const tables = ref([]) const factories = computed(() => { const total = totalCount.value - // 前3个按比例取整,最后一个用总量减去前3个保证总和精确 - const counts = baseFactories.map(f => Math.round(total * f.ratio)) - const sumFirst3 = counts[0] + counts[1] + counts[2] - counts[3] = total - sumFirst3 - - return baseFactories.map((f, i) => ({ - name: f.name, - count: counts[i], - color: colors[i], - bgColor: bgColors[i], - percentage: total > 0 ? (counts[i] / total) * 100 : 0, - })) + return factoryDefs.map((f, i) => { + // 同一工厂可能对应多张数据表,按表名匹配后累加行数 + const count = tables.value + .filter((t) => f.match(t.table_name)) + .reduce((sum, t) => sum + (t.approximate_row_count || 0), 0) + return { + name: f.name, + count, + color: colors[i], + bgColor: bgColors[i], + percentage: total > 0 ? (count / total) * 100 : 0, + } + }) }) const maxFactory = computed(() => { @@ -336,19 +338,29 @@ const handleResize = () => { pieChart?.resize() } +// 拦截浏览器后退:在大屏页按“返回”时跳转到数据模板页 +const handlePopState = () => { + router.push('/cement_data_template') +} + onMounted(() => { - API.hfnf.mplogx.list.req({ page: 1, page_size: 1 }).then(res => { - totalCount.value = res.count + API.hfnf.stats.list.req().then(res => { + tables.value = res.tables || [] + totalCount.value = res.summary?.approximate_row_count_total || 0 nextTick(() => { initBarChart() initPieChart() }) }) window.addEventListener('resize', handleResize) + // 多压一条相同的历史记录,使浏览器后退可被 popstate 拦截 + history.pushState(null, '', location.href) + window.addEventListener('popstate', handlePopState) }) onBeforeUnmount(() => { window.removeEventListener('resize', handleResize) + window.removeEventListener('popstate', handlePopState) barChart?.dispose() pieChart?.dispose() }) diff --git a/src/views/home/widgets/index_photon.vue b/src/views/home/widgets/index_photon.vue index e247081f..a4135c95 100644 --- a/src/views/home/widgets/index_photon.vue +++ b/src/views/home/widgets/index_photon.vue @@ -183,7 +183,7 @@ > sum + Number(it.count_canmio || 0), 0); + that.form.batch = items.map(it => it.batch).join(','); + that.form.mb = items.map(it => it.id).join(','); + that.form.count = totalCount; + that.batchcount = totalCount; + that.form.warehouse = items[0].warehouse; + that.inputBatchDisable = true; + return; + } if(items){ if(that.form.type == 'sale_out'&&that.project_code=='bxerp'){ let count = 0; @@ -876,7 +904,21 @@ export default { try { let res; if (that.mode == "add") { - res = await that.$API.inm.mioitem.create.req(that.form); + if(that.form.type == 'sale_out' && that.project_code == 'gz' && Array.isArray(that.selectBatch) && that.selectBatch.length > 0){ + let payload = that.selectBatch.map(b => ({ + mio: that.mioId, + material: that.form.material, + batch: b.batch, + mb: b.id, + count: Number(b.count_canmio), + warehouse: b.warehouse, + unit_price: that.form.unit_price, + note: that.form.note || '' + })); + res = await that.$API.inm.mioitem.create.req(payload); + } else { + res = await that.$API.inm.mioitem.create.req(that.form); + } } else if (that.mode == "edit") { res = await that.$API.inm.mioitem.update.req(that.form.id,that.form); } diff --git a/src/views/statistics/bxerp/fenjian.vue b/src/views/statistics/bxerp/fenjian.vue index b30df3f0..c58051d0 100644 --- a/src/views/statistics/bxerp/fenjian.vue +++ b/src/views/statistics/bxerp/fenjian.vue @@ -31,6 +31,11 @@ clearable style="width: 200px;" > + {{scope.row.data.分检_缺陷项_扭转角不合格?scope.row.data.分检_缺陷项_扭转角不合格:0}} - + + + + - + + + + @@ -141,17 +157,30 @@ export default { batch__contains:'', last_time__gte:'', last_time__lte:'', + handler:'' }, apiObj: this.$API.wpm.wpr.query, options:[], tableData:[], + toolList:{}, }; }, + mounted() { + this.getToolings(); + }, methods: { + getToolings(){ + let that = this; + that.$API.em.equipment.list.req({ page: 0,type:10,cate__code:'7'}).then((res) => { + res.forEach((item) => { + that.toolList[item.id] = item.number; + }); + }); + }, handleQuery(){ let that = this; let querys = [[{field:"wm",value:false,compare:"isnull"},{field:"data__分检_日期",compare:"isnull",value:false},{field:"data__has_key",compare:"",value:"分检_批次号"}]]; - let obj = {},obj1 = {},obj2 = {},obj3 = {},obj4 = {}; + let obj = {},obj1 = {},obj2 = {},obj3 = {},obj4 = {},obj5 = {}; obj.field = 'data__分检_批次号'; obj.value = that.query.batch__contains; obj.compare = ''; @@ -172,6 +201,10 @@ export default { obj4.value = that.query.number__contains; obj4.compare = 'contains'; + obj5.field = 'data__分检_操作人'; + obj5.value = that.query.handler; + obj5.compare = ''; + if(that.query.batch__contains!==''&&that.query.batch__contains!==null){ querys[0].push(obj); } @@ -187,6 +220,9 @@ export default { if(that.query.number__contains!==''&&that.query.number__contains!==null){ querys[0].push(obj4); } + if(that.query.handler!==''&&that.query.handler!==null){ + querys[0].push(obj5); + } that.params.querys = querys; this.$refs.table.queryData(that.params); }, diff --git a/src/views/statistics/bxerp/intoDefect_bdgy.vue b/src/views/statistics/bxerp/intoDefect_bdgy.vue index 4e67f584..06a9e60d 100644 --- a/src/views/statistics/bxerp/intoDefect_bdgy.vue +++ b/src/views/statistics/bxerp/intoDefect_bdgy.vue @@ -51,7 +51,11 @@ stripe > - + + + + + @@ -133,7 +137,7 @@ export default { sums[index] = "合计"; return; } - if (index Number(item[column.property]) ); @@ -151,8 +155,8 @@ export default { }, 0); } } - if(index==5){ - sums[index] = ((sums[3]/sums[2])*100).toFixed(2) + '%'; + if(index==7){ + sums[index] = ((sums[5]/sums[4])*100).toFixed(2) + '%'; } }); return sums; diff --git a/src/views/statistics/bxerp/workHoursNZ.vue b/src/views/statistics/bxerp/workHoursNZ.vue index b367ffa8..f6b14023 100644 --- a/src/views/statistics/bxerp/workHoursNZ.vue +++ b/src/views/statistics/bxerp/workHoursNZ.vue @@ -17,6 +17,16 @@ placeholder="结束时间" style="margin-left: 2px; width: 150px" /> + + + {{ scope.row.data.装炉压板出炉_装炉_日期?scope.row.data.装炉压板出炉_装炉_日期:'' }} + + @@ -201,6 +209,8 @@ + + diff --git a/src/views/wpm_bx/mlogbw_check.vue b/src/views/wpm_bx/mlogbw_check.vue index 3fdff9fd..0a80f1c1 100644 --- a/src/views/wpm_bx/mlogbw_check.vue +++ b/src/views/wpm_bx/mlogbw_check.vue @@ -620,6 +620,13 @@ export default { that.testitems.push(obj) } }) + res.qct_defects.forEach((item) => { + that.addTemplate[item.defect_name] = false; + let obj = Object.assign({}, item); + obj.canEdit = that.processType=='20'?false:true; + that.qct_defects.push(obj); + }) + that.qct_defects_origin = that.qct_defects; that.getList(); }); }, diff --git a/src/views/wpm_bx/mlogbw_check_table.vue b/src/views/wpm_bx/mlogbw_check_table.vue index 9c2d8116..7a189570 100644 --- a/src/views/wpm_bx/mlogbw_check_table.vue +++ b/src/views/wpm_bx/mlogbw_check_table.vue @@ -22,8 +22,9 @@ 检验 批量操作 -
-
+ 数字识别 +
+
{{ test_file_name }}
+
+
+ {{ col.label }} +
+
@@ -45,11 +54,15 @@ - - - - - + + + + + + @@ -70,7 +83,7 @@ {{ row.number }}——{{ row.wpr_number_out }} - - - + - - @@ -394,10 +415,15 @@ export default { wprInputText:"", project_code:"", test_file_name:"", + ocr_ip:"", + ocr_port:"", + ocr_unit:"", canMultiple:false, selectedAll:false, checkAll: false, hideAdd: false, + hiddenColumns: [], + columnSettingVisible: false, visible: false, isSaveing:false, setVisible:false, @@ -432,6 +458,7 @@ export default { }, optionsEq:[], + optionsTooling:[], defectlists:[], testitemlists:[], selectWprList:[], @@ -445,6 +472,26 @@ export default { }; }, watch: {}, + computed: { + allColumnOptions() { + const cols = []; + if (this.route_code === 'niuzhuan') { + cols.push({ key: 'equip', label: '生产设备' }); + cols.push({ key: 'time', label: '扭转日期' }); + } + if (this.mgroupName === '喷码') { + cols.push({ key: 'tooling', label: '工装' }); + } + this.qct_testitems.forEach(item => { + cols.push({ key: 'testitem_' + item.id, label: item.testitem_name }); + }); + this.qct_defects.forEach(item => { + cols.push({ key: 'defect_' + item.id, label: item.defect_name }); + }); + cols.push({ key: 'note', label: '备注' }); + return cols; + }, + }, mounted() { let that = this; if(that.test_file!==''&&that.test_file!==null){ @@ -460,6 +507,9 @@ export default { if(that.route_code=='niuzhuan'){ that.getEquipment4(); } + if(that.mgroupName=='喷码'){ + that.getToolings(); + } if(that.qct!==''&&that.qct!==null){//输出 that.getdefects(); }else{ @@ -486,6 +536,8 @@ export default { }).catch(()=>{ that.getList(); }) + }else{ + that.getList(); } } that.visible = true; @@ -494,6 +546,9 @@ export default { },500) that.actionMenuClickHandler = (event) => that.handleDocumentClick(event); document.addEventListener("click", that.actionMenuClickHandler, true); + that.ocr_ip = localStorage.getItem("ocr_ip") || ""; + that.ocr_port = localStorage.getItem("ocr_port") || ""; + that.ocr_unit = localStorage.getItem("ocr_unit") || ""; }, beforeUnmount() { @@ -502,6 +557,17 @@ export default { } }, methods: { + isColVisible(key) { + return !this.hiddenColumns.includes(key); + }, + toggleColumn(key) { + const idx = this.hiddenColumns.indexOf(key); + if (idx > -1) { + this.hiddenColumns.splice(idx, 1); + } else { + this.hiddenColumns.push(key); + } + }, refreshfun(){ this.getList(); }, @@ -515,7 +581,14 @@ export default { if (event.target && event.target.closest(".action-more")) { return; } + if (event.target && event.target.closest(".col-setting-float-panel")) { + return; + } this.openedActionMenu = null; + this.columnSettingVisible = false; + }, + openColumnSetting() { + this.columnSettingVisible = !this.columnSettingVisible; }, check_add(){ let that = this; @@ -551,6 +624,31 @@ export default { that.optionsEq = res.reverse(); }) }, + getToolings() { + let that = this; + that.$API.em.equipment.list.req({page:0,type:10,cate__code:"7",query:"{id,name,number}"}).then((res) => { + that.optionsTooling = Array.isArray(res) ? res : (res.results || []); + }) + }, + getToolingName(id) { + if (!id) return ''; + const item = this.optionsTooling.find(t => t.id == id); + return item ? item.name : id; + }, + autoSyncTooling() { + const that = this; + if (that.mgroupName !== '喷码') return; + that.mlogbwlist.forEach((row) => { + const wprTooling = row.wpr_pre_info?.tooling; + if (wprTooling && row.tooling != wprTooling && row.id) { + that.$API.wpm.mlogbw.update.req(row.id, { tooling: wprTooling,number:row.number,mlogb:row.mlogb }).then((res) => { + row.tooling = res.tooling; + row.tooling_name = res.tooling_name; + row.tooling_number = res.tooling_number; + }).catch(() => {}); + } + }); + }, getEquipments(){ let that = this; that.$API.em.equipment.list.req({page:0,cate__code:"6"}).then((res) => { @@ -608,7 +706,6 @@ export default { }, timeChange(row){ let that = this; - console.log('row',row) let index = that.mlogbwlist.indexOf(row); if(row.work_start_time!==''&&row.work_start_time!==null&&row.work_start_time!==undefined){ let waveNum = 1; @@ -690,6 +787,9 @@ export default { that.mlogbwlist.push(obj); }) } + that.$nextTick(() => { + that.autoSyncTooling(); + }); }) }, widthFun(item){ @@ -719,6 +819,9 @@ export default { if(row.equip){ obj.equip = row.equip; } + if(row.tooling){ + obj.tooling = row.tooling; + } //qct不为空,有检验表 if((that.qct!==''&&that.qct!==null)||(that.qctId!==''&&that.qctId!==null)){ obj.ftest = {}; @@ -762,6 +865,8 @@ export default { that.mlogbwlist[editIndex].isEdit = false; that.mlogbwlist[editIndex].equip_name = res.equip_name; that.mlogbwlist[editIndex].equip_number = res.equip_number; + that.mlogbwlist[editIndex].tooling_name = res.tooling_name; + that.mlogbwlist[editIndex].tooling_number = res.tooling_number; that.mlogbwlist[editIndex].work_start_time = res.work_start_time; // that.getList(); return res; @@ -778,6 +883,8 @@ export default { that.mlogbwlist[editIndex].isEdit = false; that.mlogbwlist[editIndex].equip_name = res.equip_name; that.mlogbwlist[editIndex].equip_number = res.equip_number; + that.mlogbwlist[editIndex].tooling_name = res.tooling_name; + that.mlogbwlist[editIndex].tooling_number = res.tooling_number; that.mlogbwlist[editIndex].work_start_time = res.work_start_time; // that.getList(); return res; @@ -796,6 +903,12 @@ export default { formTableEdit(index) { let that = this; that.mlogbwlist[index].isEdit = true; + if(that.mgroupName=='喷码'){ + const wprTooling = that.mlogbwlist[index].wpr_pre_info?.tooling; + if(wprTooling && that.mlogbwlist[index].tooling != wprTooling){ + that.mlogbwlist[index].tooling = wprTooling; + } + } let date = new Date(); if(that.mlogbwlist[index].work_start_time==''||that.mlogbwlist[index].work_start_time==null){ that.mlogbwlist[index].work_start_time = that.$TOOL.dateFormat(date, 'yyyy-MM-dd hh:mm:ss'); @@ -1013,6 +1126,93 @@ that.$API.wpm.prints.req(printer_ip, obj).then((response) => { that.wprNumber = ""; that.setVisible=true; }, + + + //扫描这里更新:添加数字化识别,调用一个接口,并且返回number和设备数据,然后根据number将这一行放到第一行并编辑这一行,并且把设备数据放到对应位置 + digital(){ + let that = this; + //第一步:调用接口获取数字识别设备返回的number + if(!that.ocr_ip || !that.ocr_port || !that.ocr_unit){ + that.$message.warning('请先在右上角"数字识别设置"配置IP、端口号和位号'); + return; + } + that.$API.em.equipment.get_svs_char.req({ + host: that.ocr_ip, + port: that.ocr_port, + flow_unit: that.ocr_unit + }).then((res) => { + if(res.char){ + that.mlogbwlist.forEach((item,index) => { + if(item.number==res.char){ + let obj = Object.assign({},item);S + obj.isEdit = true; + that.mlogbwlist.splice(index,1); + that.wprInputText = ""; + that.mlogbwlist.unshift(obj); + that.$nextTick(() => { + that.selectedindexes.push(obj.id); + that.selectWprList.push(item); + }) + //第二步:获取投影仪设备的监测数据 + //先判断是否有需要检测设备的检测项,若有,赋值,若无,跳过 + if(that.qct_testitems.length>0 && !!that.setForm.cd_req_addr){ + that.$API.em.cd.req({method:that.setForm.cd_req_addr}).then((res) => { + that.qct_testitems.forEach(item0 => { + if(item0.testitem_cd_expr!=null){ + that.mlogbwlist[0][item0.testitem_name]= eval(item0.testitem_cd_expr); + item0.cd_expr = true; + that.qct_defects.forEach(item => { + if(item.rule_expression!==''&&item.rule_expression!==undefined&&item.rule_expression!==null){ + let str = item.rule_expression.replace(/`/g, ''); + str = str.replace(/\${(.*?)}/g, 'row.\$1'); + let judge = false; + try { + judge = eval(str); + that.mlogbwlist[0][item.defect_name] = judge; + }catch (error) { + console.error(error); + } + }else{ + that.mlogbwlist[0][item.defect_name] = false; + } + }); + } + }) + let arrs= that.qct_testitems.filter(item => item.testitem_cd_expr!=null) + if(arrs.length>0){ + that.seveAuto(0); + } + }).catch((err) => { + this.$notify.error({ + title: '获取数据失败', + message: err.data + }) + return err; + }); + } + } + }) + } + }).catch((err) => { + that.$notify.error({ + title: '数字识别获取失败', + message: err.data + }) + return err; + }); + }, + seveAuto(index){ + let that= this; + let arr2 = that.mlogbwlist.filter(item => item.cd_expr==true); + if(arr2.length>0){ + that.formTableSave(that.mlogbwlist[index],index); + }else{ + setTimeout(() => { + that.seveAuto(index); + }, 500); + } + }, + //扫描物料将这一行放到第一行并编辑这一行 wprinputChange(){ let that = this; @@ -1050,6 +1250,7 @@ that.$API.wpm.prints.req(printer_ip, obj).then((response) => { that.qct_testitems.forEach(item0 => { if(item0.testitem_cd_expr!=null){ that.mlogbwlist[index][item0.testitem_name]= eval(item0.testitem_cd_expr); + that.mlogbwlist[index].cd_expr = true; that.qct_defects.forEach(item => { if(item.rule_expression!==''&&item.rule_expression!==undefined&&item.rule_expression!==null){ let str = item.rule_expression.replace(/`/g, ''); @@ -1067,6 +1268,10 @@ that.$API.wpm.prints.req(printer_ip, obj).then((response) => { }); } }) + let arrs= that.qct_testitems.filter(item => {return item.testitem_cd_expr!=null;}) + if(arrs.length>0){ + that.seveAuto(index); + } }).catch((err) => { this.$notify.error({ title: '获取数据失败', @@ -1149,7 +1354,6 @@ that.$API.wpm.prints.req(printer_ip, obj).then((response) => { fullscreen: true, text: "解析中...请稍等", }); - console.log(res); this.$API.wpm.mlog.change.req(that.mlogId,{ test_file: res.path }).then((res) => { loading.close(); this.$message.success("导入成功"); @@ -1159,6 +1363,15 @@ that.$API.wpm.prints.req(printer_ip, obj).then((response) => { this.$message.error("导入失败,请重新尝试"); }); }, + getDefectCount(defectName){ + let count = 0; + this.mlogbwlist.forEach(row => { + if(row[defectName]){ + count++; + } + }); + return count; + }, hasNull(){ let that = this; let canSubmit = true; @@ -1363,6 +1576,24 @@ tbody tr:nth-child(odd) .sticky-cell{ .more-menu-btn:hover{ background: #fef0f0; } +.col-setting-float-panel{ + position: absolute; + right: 0; + top: 35px; + z-index: 100; + background: #fff; + border: 1px solid #ebeef5; + border-radius: 4px; + box-shadow: 0 2px 12px rgba(0,0,0,0.12); + padding: 8px 12px; + min-width: 150px; + max-height: 300px; + overflow-y: auto; +} +.col-setting-item{ + padding: 4px 0; + line-height: 1.6; +} .btn{ margin:0 5px; border: none; diff --git a/src/views/wpm_bx/wprList.vue b/src/views/wpm_bx/wprList.vue index b22e1774..0803b913 100644 --- a/src/views/wpm_bx/wprList.vue +++ b/src/views/wpm_bx/wprList.vue @@ -15,14 +15,14 @@ 批量喷数字码批量喷二维码 @@ -49,6 +49,26 @@ + + + - - - + @@ -179,6 +183,7 @@ export default { printer_name:localStorage.getItem("printer_name"), apiObjPrint:this.$API.cm.labelmat.fromWm, coderLoadingIds:{}, + markerLoadingIds:{}, }; }, mounted() { @@ -195,7 +200,7 @@ export default { this.params.wm = this.wm; this.visible = true; this.getRowWpr(); - // this.getToolingOptions(); + this.getToolingOptions(); that.$nextTick(() => { let heights = document.getElementsByClassName("el-drawer__body")[0].clientHeight; that.wprTableHeight = heights-20; @@ -205,18 +210,21 @@ export default { getRowWpr(){ let that = this; that.$API.wpm.wpr.list.req(that.params).then((res) => { - that.wprList = res; + that.wprList = (Array.isArray(res) ? res : []).map(row => ({ + ...row, + pre_info: row.pre_info || {}, + })); }) }, getToolingOptions(){ let that = this; - that.$API.mtm.tooling.list.req({ page: 0}).then((res) => { + that.$API.em.equipment.list.req({ page: 0,type:10,cate__code:'7'}).then((res) => { that.toolingOptions = Array.isArray(res) ? res : (res.results || []); }); }, handleToolingChange(row){ let that = this; - that.$API.wpm.wpr.update.req(row.id,{tooling:row.tooling}).then(() => { + that.$API.wpm.wpr.update.req(row.id,{pre_info:{tooling:row.pre_info.tooling}}).then(() => { that.$message.success("工装更新成功"); }); }, @@ -346,7 +354,7 @@ export default { obj.printer_commands = res.commands; obj.printer_name = that.printer_name; let printer_ip=localStorage.getItem("printer_ip")||'127.0.0.1'; -that.$API.wpm.prints.req(printer_ip, obj).then((response) => { + that.$API.wpm.prints.req(printer_ip, obj).then((response) => { that.$message.success("打印成功"); }); }); @@ -386,14 +394,14 @@ that.$API.wpm.prints.req(printer_ip, obj).then((response) => { params.data = data; }else{ params.label_template_name = '单件打印模板'; - params.data = {number:row.number,name:name}; + params.data = {number:row.number,name:name,oname:that.ofromName}; } that.$API.cm.labeltemplate.commands.req(params).then((res) => { let obj = {}; obj.printer_commands = res.commands; obj.printer_name = that.printer_name; let printer_ip=localStorage.getItem("printer_ip")||'127.0.0.1'; -that.$API.wpm.prints.req(printer_ip, obj).then((response) => { + that.$API.wpm.prints.req(printer_ip, obj).then((response) => { that.$message.success("打印成功"); }); }); @@ -474,6 +482,41 @@ that.$API.wpm.prints.req(printer_ip, obj).then((response) => { return that.$API.cm.labeltemplate.sendToCoder.req(template.id, body); }); }, + //下发打码: 单行入队 1 条 + sendToMarker(row){ + let that = this; + if (that.markerLoadingIds[row.id]) return; + let marker_ip = localStorage.getItem('marker_ip') || ''; + if (!marker_ip) { + that.$message.error('请先在右上角"打码设置"配置打码IP'); + return; + } + let release = () => { + let map = { ...that.markerLoadingIds }; + delete map[row.id]; + that.markerLoadingIds = map; + }; + that.markerLoadingIds = { ...that.markerLoadingIds, [row.id]: true }; + let templateName = '打码模板'; + 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: [{number: row.number}], coder_ip: marker_ip,coder_port:null }; + let marker_port = localStorage.getItem('marker_port') || ''; + let marker_jobname = localStorage.getItem('marker_jobname') || ''; + if (marker_port) body.coder_port = Number(marker_port); + if (marker_jobname) body.coder_jobname = marker_jobname; + return that.$API.cm.labeltemplate.sendToHanslaser.req(template.id, body); + }).then(() => { + that.$message.success('打码下发成功'); + }).catch(e => { + if (e && e.message !== 'no template') that.$message.error('打码下发失败'); + }).finally(release); + }, openSplit() { let that = this; let data = { diff --git a/src/views/wpm_gx/f_mlogs_form.vue b/src/views/wpm_gx/f_mlogs_form.vue index d3bd5717..56c9444f 100644 --- a/src/views/wpm_gx/f_mlogs_form.vue +++ b/src/views/wpm_gx/f_mlogs_form.vue @@ -6,282 +6,312 @@ style="width: 90%;" @closed="$emit('closed')" > - - - - - - - - - [{{ item.routepack_name }}]{{ item.name }} - - - - - - - - - - - - - - - - - - - - - - - - - - - {{item.name}} - {{item.number}} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + - - - - - + [{{ item.routepack_name }}]{{ item.name }} + + + + + + + + + + + + + + + + + + + + + + + + + + + {{item.name}} + {{item.number}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 不良记录 + + + + + + + + + 加工前不良 + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - 不良记录 - + + + 本工段不良 + + - - - 加工前不良 - - - - - - - - - - 本工段不良 - - - - - - - - - - - - - 保存 - 取消 - - + + + + + 保存 + 取消 + diff --git a/src/views/wpm_gx/mlog_form.vue b/src/views/wpm_gx/mlog_form.vue index ba0fede9..3cebe28e 100644 --- a/src/views/wpm_gx/mlog_form.vue +++ b/src/views/wpm_gx/mlog_form.vue @@ -6,265 +6,261 @@ style="width: 80%;" @closed="$emit('closed')" > - - - - - - + + + + + + + + + + + + - - - - - - - - - - [{{ item.routepack_name }}]{{ item.name }} - - - - - - - - - - - - - - - - - - - [{{ item.routepack_name }}]{{ item.name }} + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - {{item.name}} - {{item.number}} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 保存 - 取消 - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{item.name}} + {{item.number}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 保存 + 取消 + diff --git a/src/views/wpm_gx/mlogb_form.vue b/src/views/wpm_gx/mlogb_form.vue index d3bf8cba..8f98c24a 100644 --- a/src/views/wpm_gx/mlogb_form.vue +++ b/src/views/wpm_gx/mlogb_form.vue @@ -6,185 +6,181 @@ destroy-on-close @closed="$emit('closed')" > - - - - - - - - - [{{ item.routepack_name }}]{{ item.name }} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 保存 - 取消 - - + + + + + + + [{{ item.routepack_name }}]{{ item.name }} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 保存 + 取消 +
序号 物料批次 物料编号生产设备扭转日期{{ item.testitem_name }}{{ item.defect_name }}备注生产设备扭转日期工装{{ item.testitem_name }} + {{ item.defect_name }} + {{ getDefectCount(item.defect_name) }} + 备注 操作
+ {{ row.equip_name }}{{ row.equip_number }} +
{{ row.work_start_time}}
+ + + {{ getToolingName(row.wpr_pre_info?.tooling) || row.tooling_name }} + {{ row[item.testitem_name] }} @@ -101,10 +122,10 @@ + + {{ row.note }}