Ver código fonte

染整线加板板

liling 3 semanas atrás
pai
commit
bcc9534023
1 arquivos alterados com 147 adições e 56 exclusões
  1. 147 56
      src/pages/components/In03.vue

+ 147 - 56
src/pages/components/In03.vue

@@ -291,6 +291,8 @@ export default {
         let lineArrow001=null;
         let lineArrow002=null;
         let getDataTimer = null;
+        let lineCurr = null;
+        let lineMarkerLoaded = false;
         //产线列表
         const cxList=ref([
             {"name":1,active:false,index:1},
@@ -314,6 +316,28 @@ export default {
                     [[-87, 22, 13],[-130, 22, 11],[-80, 22, 11]],
                     [[-80, 11, 13],[-130, 11, 11],[-80, 11, 11]]
         ];
+        //温度速度提示框位置,元素顺序为默认位置,左位置和右位置
+        const tmpMarkerPos=[
+                    [-260, 250, 13],
+                    [-260, 227, 13],
+                    [-260, 210, 13],
+                    [-260, 190, 13],
+                    [-260, 174, 13],
+                    [-260, 155, 13],
+                    [-260, 138, 13],
+                    [-260, 123, 13],
+        ];
+        //订单花色提示框位置,元素顺序为默认位置,左位置和右位置
+        const orderMarkerPos=[
+                    [-30, 89, 13],
+                    [-30, 77, 13],
+                    [-30, 66, 13],
+                    [-30, 55, 13],
+                    [-30, 44, 13],
+                    [-30, 33, 13],
+                    [-30, 22, 13],
+                    [-30, 11, 13],
+        ];
         const btnFrontBg = require('@/assets/image/nav_btn_front.png');
         watch(() => props.clickEvent, newVal=> {
             if(newVal==null){
@@ -327,7 +351,7 @@ export default {
                 clearTimeout(getDataTimer);
                 setTimeout(() => {
                     DataFull.GetData();
-                }, 10);
+                }, 100);
                 init();
             }
         },{deep:true,immediate:true})
@@ -360,6 +384,8 @@ export default {
                     effInfo.value = res.data.eff[currentCXNo.value]; //产线信息
                     LoadSCLine(buttonCode1.value=='' ? 'Length':buttonCode1.value);
                     LoadUsedLine(buttonCode2.value==''?'price':buttonCode2.value);
+                    lineCurr = res.data.curr||[];
+                    showLineInfo();
                 });
             }
         }
@@ -458,65 +484,130 @@ export default {
         async function drawLineNo(rootObj){
             if(player!=null && player.Native!=null){
                 (async()=>{
-                            let marklst = await player.Native.GisMarker.getMarkerList();
-                            if(marklst!=null){
-                                for(var i=0;i<marklst.length;i++){
-                                    if(player!=null && player.Native!=null)player.Native.GisMarker.destroy(marklst[i].id)
-                                }
+                    let marklst = await player.Native.GisMarker.getMarkerList();
+                    if(marklst!=null){
+                        for(var i=0;i<marklst.length;i++){
+                            if(player!=null && player.Native!=null)player.Native.GisMarker.destroy(marklst[i].id)
+                        }
+                    }
+                    //隐藏模型产线编号
+                    let imgId = await player.Native.GisMarker.loadImage("data://icon/rz-new/pp.png");
+                    window.IN03Markers = {};
+                    for(let i=0;i<8;i++){
+                        player.Native.ModelTree.findItemByName("Text00"+(i+1), rootObj.item,true,3).then(res=>{ 
+                            player.Native.ModelTree.setItemVisible([res.item],false);
+                        });
+                        player.Native.ModelTree.findItemByName("Plane0"+(11+i+1), rootObj.item,true,3).then(res=>{ 
+                            player.Native.ModelTree.setItemVisible([res.item],false);
+                        });
+                        
+                        let line = i+1;
+                        //产线编号标记
+                        var options = {
+                            "text": line,
+                            // "parentNode": parentObj.item,
+                            "visible": true,
+                            //"maxLod": 350,
+                            //"minLod": 0,
+                            "textFontSize": 18,
+                            // "size": [48, 48],
+                            "textColor": parseInt("0xFFFFFFFF"),
+                            "backgroundColor": parseInt("0x00000050"),
+                            "contentPadding": [5, 5, 5, 5],
+                            "nodeOffset": [0, -24],
+                            "userData": "line|"+line
+                        };
+                        options.pos = markerPos[i][0];
+                        //options.parentNode=tmp.item;
+                        options.imgId = imgId
+                        options.imgSize = [16, 24];
+                        player.Native.GisMarker.create(options).then(markPtr=>{
+                            window.IN03Markers[markPtr] = options;
+                        });                    
+                        //产线温度、速度标记    
+                        let optTmp = JSON.parse(JSON.stringify(options));
+                        optTmp.pos = tmpMarkerPos[i];
+                        optTmp.userData = "tmp|"+line;
+                        optTmp.textFontSize = "14";
+                        optTmp.imgSize = [316, 18];
+                        optTmp.textColor = parseInt("0xe5cd10FF");
+                        player.Native.GisMarker.create(optTmp).then(markPtr=>{ 
+                            window.IN03Markers[markPtr] = optTmp;
+                        });
+                        
+                        //产线订单花色标记.1\2号产线没有
+                        if(line>2){
+                            let optOrder = JSON.parse(JSON.stringify(options));
+                            optOrder.pos = orderMarkerPos[i];
+                            optOrder.userData = "order|"+line;
+                            optOrder.textFontSize = "14";
+                            optOrder.imgSize = [300, 18];
+                            optOrder.textColor = parseInt("0xe5cd10FF");
+                            player.Native.GisMarker.create(optOrder).then(markPtr=>{ 
+                                window.IN03Markers[markPtr] = optOrder;
+                            });
+                        }
+                    }                
+                    //标记点击
+                    player.Native.GisMarker.EventGisMarkerLClick.connect((event) => {
+                        let markerLClickObj = window.IN03Markers[event.markerId];
+                        if(markerLClickObj==null){
+                            //emit('markerLClick',{});
+                            markerLClickObj = compMarkerts[event.markerId];
+                            if(markerLClickObj!=null){                            
+                                var params = JSON.stringify(compProctList.value);
+                                emit('OpenIframeWin',{class:'newwin in03AiCompWin',src:'/in03-ai-comp#'+params,title:'AI工艺比对详情'});
                             }
+                            return;
+                        }
+                        setTimeout(function(dataType){
+                            if(dataType==null) return;
+                            dataType = dataType.split("|");
+                            if(dataType[0]=='line') switchCX(dataType[1]);
+                        },100,markerLClickObj["userData"]);
+                        //emit('markerLClick',markerLClickObj);
+                        return;
+                    });
+                    //加载产线数据 
+                    showLineInfo();                           
                 })();
             }
-                //隐藏模型产线编号
-				let imgId = await player.Native.GisMarker.loadImage("data://icon/rz-new/pp.png");
-                window.IN03Markers = {};
-                for(let i=0;i<8;i++){
-                    let objectTxt = "Text00"+(i+1);
-                    let object = await player.Native.ModelTree.findItemByName(objectTxt, rootObj.item,true,3);
-                    player.Native.ModelTree.setItemVisible([object.item],false);
-                    objectTxt = "Plane0"+(11+i+1);
-                    object = await player.Native.ModelTree.findItemByName(objectTxt, rootObj.item,true,3);
-                    player.Native.ModelTree.setItemVisible([object.item],false);
-                    let line = i+1;
-                    var options = {
-						"text": line,
-						// "parentNode": parentObj.item,
-						"visible": true,
-						"maxLod": 350,
-						//"minLod": 0,
-						"textFontSize": 18,
-						// "size": [48, 48],
-						// "textColor": parseInt("0xFFFFFFFF"),
-						"contentPadding": [5, 5, 5, 5],
-						"nodeOffset": [0, -24],
-						"userData": "line|"+line
-					};
-                    options.pos = markerPos[i][0];
-					//options.parentNode=tmp.item;
-					options.imgId = imgId
-					options.imgSize = [16, 24];
-					var markPtr = await player.Native.GisMarker.create(options);
-                    window.IN03Markers[markPtr] = options;
+
+        }
+        //显示产线生产信息
+        //4楼左边显示产线的定型温度dxTmp、烫光温度tgTmp以及速度speed
+        //4楼楼右边显示产线的订单号order和花色color
+        async function showLineInfo(){
+            if(player==null || player.Native==null || lineCurr==null) return;  
+            let lineDataInfo = {};
+            lineCurr.forEach(function(item){ 
+                lineDataInfo[item.line] = item;
+            });               
+            let getCnt = 0;
+            for(let markerPtr in window.IN03Markers){ 
+                let markerOpt = window.IN03Markers[markerPtr];
+                if(markerOpt["userData"]==null) continue;
+                let datatype = markerOpt["userData"].split("|")[0];
+                if(datatype=='line'){
+                    continue;
                 }
-                //标记点击
-                player.Native.GisMarker.EventGisMarkerLClick.connect((event) => {
-                    let markerLClickObj = window.IN03Markers[event.markerId];
-                    if(markerLClickObj==null){
-                        //emit('markerLClick',{});
-                        markerLClickObj = compMarkerts[event.markerId];
-                        if(markerLClickObj!=null){                            
-                            var params = JSON.stringify(compProctList.value);
-                            emit('OpenIframeWin',{class:'newwin in03AiCompWin',src:'/in03-ai-comp#'+params,title:'AI工艺比对详情'});
-                        }
-                        return;
-                    }
-                    setTimeout(function(dataType){
-                        if(dataType==null) return;
-                        dataType = dataType.split("|");
-                        if(dataType[0]=='line') switchCX(dataType[1]);
-                    },100,markerLClickObj["userData"]);
-                    //emit('markerLClick',markerLClickObj);
-                    return;
-                });
+                let line = markerOpt["userData"].split("|")[1];
+                if(lineDataInfo[line]==null) continue;
+                if(datatype=="tmp") {
+                    markerOpt["text"] = line+"# 定型温度:"+ (lineDataInfo[line].dxTmp||"--")+"   烫光温度:"+ (lineDataInfo[line].tgTmp||"--")+"  速度:"+ (lineDataInfo[line].speed||"--");
+                }
+                if(datatype=="order") {
+                    markerOpt["text"] = line+"# 订单号:"+ (lineDataInfo[line].order||"--")+"  花色:"+ (lineDataInfo[line].color||"--");
+                }
+                player.Native.GisMarker.update(markerPtr, markerOpt);
+                getCnt++;
+            }
+            if(getCnt<14){
+                setTimeout(() => {
+                    //未完全加载板板,重新加载
+                    showLineInfo()
+                }, 200);
+            }
         }
         //更新产线状态颜色
         async function updateLineState(){