Эх сурвалжийг харах

添加库存明细及趋势功能

liling 6 сар өмнө
parent
commit
6083d2399c
3 өөрчлөгдсөн 1217 нэмэгдсэн , 52 устгасан
  1. 917 0
      data.json
  2. 92 52
      main.html
  3. 208 0
      stock_trend.html

+ 917 - 0
data.json

@@ -0,0 +1,917 @@
+{
+    "ycl": {
+        "d-in": 149988,
+        "d-out": 149541,
+        "in": [
+            {
+                "code": "WH01",
+                "name": "原料仓库",
+                "clas": "DTY类",
+                "type": "加弹报工下线入库",
+                "total": 83520,
+                "flag": true,
+                "date": "2025-01-12",
+                "key": null
+            },
+            {
+                "code": "WH01",
+                "name": "原料仓库",
+                "clas": "POY类",
+                "type": "ERP采购到货入库",
+                "total": 66468,
+                "flag": true,
+                "date": "2025-01-12",
+                "key": null
+            }
+        ],
+        "trend": [
+            {
+                "code": "WH01",
+                "inNum": 25920,
+                "outNum": 13788,
+                "date": "2024-12-19",
+                "key": null
+            },
+            {
+                "code": "WH01",
+                "inNum": 72960,
+                "outNum": 227517,
+                "date": "2024-12-20",
+                "key": null
+            },
+            {
+                "code": "WH01",
+                "inNum": 78720,
+                "outNum": 208740,
+                "date": "2024-12-21",
+                "key": null
+            },
+            {
+                "code": "WH01",
+                "inNum": 82560,
+                "outNum": 192651,
+                "date": "2024-12-22",
+                "key": null
+            },
+            {
+                "code": "WH01",
+                "inNum": 66240,
+                "outNum": 167667,
+                "date": "2024-12-23",
+                "key": null
+            },
+            {
+                "code": "WH01",
+                "inNum": 49920,
+                "outNum": 191475,
+                "date": "2024-12-24",
+                "key": null
+            },
+            {
+                "code": "WH01",
+                "inNum": 62406,
+                "outNum": 188211,
+                "date": "2024-12-25",
+                "key": null
+            },
+            {
+                "code": "WH01",
+                "inNum": 79200,
+                "outNum": 208671,
+                "date": "2024-12-26",
+                "key": null
+            },
+            {
+                "code": "WH01",
+                "inNum": 64800,
+                "outNum": 153302,
+                "date": "2024-12-27",
+                "key": null
+            },
+            {
+                "code": "WH01",
+                "inNum": 72960,
+                "outNum": 187722,
+                "date": "2024-12-28",
+                "key": null
+            },
+            {
+                "code": "WH01",
+                "inNum": 88320,
+                "outNum": 234831,
+                "date": "2024-12-29",
+                "key": null
+            },
+            {
+                "code": "WH01",
+                "inNum": 69120,
+                "outNum": 199343,
+                "date": "2024-12-30",
+                "key": null
+            },
+            {
+                "code": "WH01",
+                "inNum": 72000,
+                "outNum": 199239,
+                "date": "2024-12-31",
+                "key": null
+            },
+            {
+                "code": "WH01",
+                "inNum": 79200,
+                "outNum": 220575,
+                "date": "2025-01-01",
+                "key": null
+            },
+            {
+                "code": "WH01",
+                "inNum": 119592,
+                "outNum": 194784,
+                "date": "2025-01-02",
+                "key": null
+            },
+            {
+                "code": "WH01",
+                "inNum": 186828,
+                "outNum": 202620,
+                "date": "2025-01-03",
+                "key": null
+            },
+            {
+                "code": "WH01",
+                "inNum": 187140,
+                "outNum": 183480,
+                "date": "2025-01-04",
+                "key": null
+            },
+            {
+                "code": "WH01",
+                "inNum": 266592,
+                "outNum": 188805,
+                "date": "2025-01-05",
+                "key": null
+            },
+            {
+                "code": "WH01",
+                "inNum": 233016,
+                "outNum": 206850,
+                "date": "2025-01-06",
+                "key": null
+            },
+            {
+                "code": "WH01",
+                "inNum": 191916,
+                "outNum": 188943,
+                "date": "2025-01-07",
+                "key": null
+            },
+            {
+                "code": "WH01",
+                "inNum": 172992,
+                "outNum": 216315,
+                "date": "2025-01-08",
+                "key": null
+            },
+            {
+                "code": "WH01",
+                "inNum": 151164,
+                "outNum": 198156,
+                "date": "2025-01-09",
+                "key": null
+            },
+            {
+                "code": "WH01",
+                "inNum": 102240,
+                "outNum": 164205,
+                "date": "2025-01-10",
+                "key": null
+            },
+            {
+                "code": "WH01",
+                "inNum": 159252,
+                "outNum": 208083,
+                "date": "2025-01-11",
+                "key": null
+            },
+            {
+                "code": "WH01",
+                "inNum": 149988,
+                "outNum": 149541,
+                "date": "2025-01-12",
+                "key": null
+            }
+        ],
+        "m-in": 1999920,
+        "m-out": 2322357,
+        "curr": 4222642.5,
+        "out": [
+            {
+                "code": "WH01",
+                "name": "原料仓库",
+                "clas": "DTY类",
+                "type": "DTY整经领料出库",
+                "total": 59592,
+                "flag": false,
+                "date": "2025-01-12",
+                "key": null
+            },
+            {
+                "code": "WH01",
+                "name": "原料仓库",
+                "clas": "FDY类",
+                "type": "FDY整经领料出库",
+                "total": 15141,
+                "flag": false,
+                "date": "2025-01-12",
+                "key": null
+            },
+            {
+                "code": "WH01",
+                "name": "原料仓库",
+                "clas": "POY类",
+                "type": "POY生产领料出库",
+                "total": 74808,
+                "flag": false,
+                "date": "2025-01-12",
+                "key": null
+            }
+        ]
+    },
+    "pt": {
+        "d-in": 144,
+        "d-out": 144,
+        "in": [
+            {
+                "code": "WH03",
+                "name": "盘头仓库",
+                "clas": "DTY类",
+                "type": "整经满盘头入库",
+                "total": 52,
+                "flag": true,
+                "date": "2025-01-12",
+                "key": null
+            },
+            {
+                "code": "WH03",
+                "name": "盘头仓库",
+                "clas": "盘头类",
+                "type": "整经满盘头入库",
+                "total": 25,
+                "flag": true,
+                "date": "2025-01-12",
+                "key": null
+            },
+            {
+                "code": "WH03",
+                "name": "盘头仓库",
+                "clas": "容器类",
+                "type": "经编盘头更换入库",
+                "total": 67,
+                "flag": true,
+                "date": "2025-01-12",
+                "key": null
+            }
+        ],
+        "trend": [
+            {
+                "code": "WH03",
+                "inNum": 53,
+                "outNum": 53,
+                "date": "2024-12-19",
+                "key": null
+            },
+            {
+                "code": "WH03",
+                "inNum": 175,
+                "outNum": 174,
+                "date": "2024-12-20",
+                "key": null
+            },
+            {
+                "code": "WH03",
+                "inNum": 183,
+                "outNum": 184,
+                "date": "2024-12-21",
+                "key": null
+            },
+            {
+                "code": "WH03",
+                "inNum": 147,
+                "outNum": 147,
+                "date": "2024-12-22",
+                "key": null
+            },
+            {
+                "code": "WH03",
+                "inNum": 183,
+                "outNum": 182,
+                "date": "2024-12-23",
+                "key": null
+            },
+            {
+                "code": "WH03",
+                "inNum": 196,
+                "outNum": 195,
+                "date": "2024-12-24",
+                "key": null
+            },
+            {
+                "code": "WH03",
+                "inNum": 169,
+                "outNum": 169,
+                "date": "2024-12-25",
+                "key": null
+            },
+            {
+                "code": "WH03",
+                "inNum": 163,
+                "outNum": 162,
+                "date": "2024-12-26",
+                "key": null
+            },
+            {
+                "code": "WH03",
+                "inNum": 275,
+                "outNum": 156,
+                "date": "2024-12-27",
+                "key": null
+            },
+            {
+                "code": "WH03",
+                "inNum": 180,
+                "outNum": 181,
+                "date": "2024-12-28",
+                "key": null
+            },
+            {
+                "code": "WH03",
+                "inNum": 150,
+                "outNum": 150,
+                "date": "2024-12-29",
+                "key": null
+            },
+            {
+                "code": "WH03",
+                "inNum": 198,
+                "outNum": 199,
+                "date": "2024-12-30",
+                "key": null
+            },
+            {
+                "code": "WH03",
+                "inNum": 180,
+                "outNum": 179,
+                "date": "2024-12-31",
+                "key": null
+            },
+            {
+                "code": "WH03",
+                "inNum": 174,
+                "outNum": 174,
+                "date": "2025-01-01",
+                "key": null
+            },
+            {
+                "code": "WH03",
+                "inNum": 164,
+                "outNum": 161,
+                "date": "2025-01-02",
+                "key": null
+            },
+            {
+                "code": "WH03",
+                "inNum": 218,
+                "outNum": 217,
+                "date": "2025-01-03",
+                "key": null
+            },
+            {
+                "code": "WH03",
+                "inNum": 177,
+                "outNum": 178,
+                "date": "2025-01-04",
+                "key": null
+            },
+            {
+                "code": "WH03",
+                "inNum": 166,
+                "outNum": 165,
+                "date": "2025-01-05",
+                "key": null
+            },
+            {
+                "code": "WH03",
+                "inNum": 170,
+                "outNum": 164,
+                "date": "2025-01-06",
+                "key": null
+            },
+            {
+                "code": "WH03",
+                "inNum": 172,
+                "outNum": 177,
+                "date": "2025-01-07",
+                "key": null
+            },
+            {
+                "code": "WH03",
+                "inNum": 187,
+                "outNum": 184,
+                "date": "2025-01-08",
+                "key": null
+            },
+            {
+                "code": "WH03",
+                "inNum": 171,
+                "outNum": 170,
+                "date": "2025-01-09",
+                "key": null
+            },
+            {
+                "code": "WH03",
+                "inNum": 209,
+                "outNum": 211,
+                "date": "2025-01-10",
+                "key": null
+            },
+            {
+                "code": "WH03",
+                "inNum": 186,
+                "outNum": 186,
+                "date": "2025-01-11",
+                "key": null
+            },
+            {
+                "code": "WH03",
+                "inNum": 144,
+                "outNum": 144,
+                "date": "2025-01-12",
+                "key": null
+            }
+        ],
+        "m-in": 2138,
+        "m-out": 2131,
+        "curr": 523.0,
+        "out": [
+            {
+                "code": "WH03",
+                "name": "盘头仓库",
+                "clas": "盘头类",
+                "type": "经编满盘头更换出库",
+                "total": 68,
+                "flag": false,
+                "date": "2025-01-12",
+                "key": null
+            },
+            {
+                "code": "WH03",
+                "name": "盘头仓库",
+                "clas": "容器类",
+                "type": "整经大空盘头出库",
+                "total": 51,
+                "flag": false,
+                "date": "2025-01-12",
+                "key": null
+            },
+            {
+                "code": "WH03",
+                "name": "盘头仓库",
+                "clas": "容器类",
+                "type": "整经小空盘头出库",
+                "total": 25,
+                "flag": false,
+                "date": "2025-01-12",
+                "key": null
+            }
+        ]
+    },
+    "bpb": {
+        "d-in": 78428,
+        "d-out": 72318,
+        "in": [
+            {
+                "code": "WH04",
+                "name": "白坯仓库",
+                "clas": "白坯类",
+                "type": "白坯剖绒生产入库",
+                "total": 78428,
+                "flag": true,
+                "date": "2025-01-12",
+                "key": null
+            }
+        ],
+        "trend": [
+            {
+                "code": "WH04",
+                "inNum": 24724,
+                "outNum": 21958,
+                "date": "2024-12-19",
+                "key": null
+            },
+            {
+                "code": "WH04",
+                "inNum": 77072,
+                "outNum": 85469,
+                "date": "2024-12-20",
+                "key": null
+            },
+            {
+                "code": "WH04",
+                "inNum": 89635,
+                "outNum": 71110,
+                "date": "2024-12-21",
+                "key": null
+            },
+            {
+                "code": "WH04",
+                "inNum": 86293,
+                "outNum": 84516,
+                "date": "2024-12-22",
+                "key": null
+            },
+            {
+                "code": "WH04",
+                "inNum": 81023,
+                "outNum": 71647,
+                "date": "2024-12-23",
+                "key": null
+            },
+            {
+                "code": "WH04",
+                "inNum": 89984,
+                "outNum": 115870,
+                "date": "2024-12-24",
+                "key": null
+            },
+            {
+                "code": "WH04",
+                "inNum": 90307,
+                "outNum": 92326,
+                "date": "2024-12-25",
+                "key": null
+            },
+            {
+                "code": "WH04",
+                "inNum": 89687,
+                "outNum": 96806,
+                "date": "2024-12-26",
+                "key": null
+            },
+            {
+                "code": "WH04",
+                "inNum": 68867,
+                "outNum": 97780,
+                "date": "2024-12-27",
+                "key": null
+            },
+            {
+                "code": "WH04",
+                "inNum": 94297,
+                "outNum": 95441,
+                "date": "2024-12-28",
+                "key": null
+            },
+            {
+                "code": "WH04",
+                "inNum": 81355,
+                "outNum": 103012,
+                "date": "2024-12-29",
+                "key": null
+            },
+            {
+                "code": "WH04",
+                "inNum": 89683,
+                "outNum": 73713,
+                "date": "2024-12-30",
+                "key": null
+            },
+            {
+                "code": "WH04",
+                "inNum": 80811,
+                "outNum": 92756,
+                "date": "2024-12-31",
+                "key": null
+            },
+            {
+                "code": "WH04",
+                "inNum": 78783,
+                "outNum": 110511,
+                "date": "2025-01-01",
+                "key": null
+            },
+            {
+                "code": "WH04",
+                "inNum": 97326,
+                "outNum": 108877,
+                "date": "2025-01-02",
+                "key": null
+            },
+            {
+                "code": "WH04",
+                "inNum": 81807,
+                "outNum": 134273,
+                "date": "2025-01-03",
+                "key": null
+            },
+            {
+                "code": "WH04",
+                "inNum": 107351,
+                "outNum": 91699,
+                "date": "2025-01-04",
+                "key": null
+            },
+            {
+                "code": "WH04",
+                "inNum": 73478,
+                "outNum": 77721,
+                "date": "2025-01-05",
+                "key": null
+            },
+            {
+                "code": "WH04",
+                "inNum": 99091,
+                "outNum": 91292,
+                "date": "2025-01-06",
+                "key": null
+            },
+            {
+                "code": "WH04",
+                "inNum": 91221,
+                "outNum": 71394,
+                "date": "2025-01-07",
+                "key": null
+            },
+            {
+                "code": "WH04",
+                "inNum": 89904,
+                "outNum": 88281,
+                "date": "2025-01-08",
+                "key": null
+            },
+            {
+                "code": "WH04",
+                "inNum": 84702,
+                "outNum": 81798,
+                "date": "2025-01-09",
+                "key": null
+            },
+            {
+                "code": "WH04",
+                "inNum": 84600,
+                "outNum": 86791,
+                "date": "2025-01-10",
+                "key": null
+            },
+            {
+                "code": "WH04",
+                "inNum": 86744,
+                "outNum": 77966,
+                "date": "2025-01-11",
+                "key": null
+            },
+            {
+                "code": "WH04",
+                "inNum": 78428,
+                "outNum": 72318,
+                "date": "2025-01-12",
+                "key": null
+            }
+        ],
+        "m-in": 1053435,
+        "m-out": 1092921,
+        "curr": 1016990.0,
+        "out": [
+            {
+                "code": "WH04",
+                "name": "白坯仓库",
+                "clas": "白坯类",
+                "type": "白坯生产领用出库",
+                "total": 72318,
+                "flag": false,
+                "date": "2025-01-12",
+                "key": null
+            }
+        ]
+    },
+    "cp": {
+        "d-in": 19294,
+        "d-out": 33083,
+        "in": [
+            {
+                "code": "WH08",
+                "name": "成辅仓库",
+                "clas": "成品类",
+                "type": "1楼成品入库",
+                "total": 56,
+                "flag": true,
+                "date": "2025-01-12",
+                "key": null
+            },
+            {
+                "code": "WH08",
+                "name": "成辅仓库",
+                "clas": "成品类",
+                "type": "码垛成品入库",
+                "total": 19234,
+                "flag": true,
+                "date": "2025-01-12",
+                "key": null
+            },
+            {
+                "code": "WH08",
+                "name": "成辅仓库",
+                "clas": "容器类",
+                "type": "1楼成品入库",
+                "total": 4,
+                "flag": true,
+                "date": "2025-01-12",
+                "key": null
+            }
+        ],
+        "trend": [
+            {
+                "code": "WH08",
+                "inNum": 21458,
+                "outNum": 8448,
+                "date": "2024-12-20",
+                "key": null
+            },
+            {
+                "code": "WH08",
+                "inNum": 16131,
+                "outNum": 10922,
+                "date": "2024-12-21",
+                "key": null
+            },
+            {
+                "code": "WH08",
+                "inNum": 11682,
+                "outNum": 12330,
+                "date": "2024-12-22",
+                "key": null
+            },
+            {
+                "code": "WH08",
+                "inNum": 23133,
+                "outNum": 4432,
+                "date": "2024-12-23",
+                "key": null
+            },
+            {
+                "code": "WH08",
+                "inNum": 20972,
+                "outNum": 5366,
+                "date": "2024-12-24",
+                "key": null
+            },
+            {
+                "code": "WH08",
+                "inNum": 19429,
+                "outNum": 12333,
+                "date": "2024-12-25",
+                "key": null
+            },
+            {
+                "code": "WH08",
+                "inNum": 24423,
+                "outNum": 21120,
+                "date": "2024-12-26",
+                "key": null
+            },
+            {
+                "code": "WH08",
+                "inNum": 26154,
+                "outNum": 47120,
+                "date": "2024-12-27",
+                "key": null
+            },
+            {
+                "code": "WH08",
+                "inNum": 20647,
+                "outNum": 31340,
+                "date": "2024-12-28",
+                "key": null
+            },
+            {
+                "code": "WH08",
+                "inNum": 17011,
+                "outNum": 32527,
+                "date": "2024-12-29",
+                "key": null
+            },
+            {
+                "code": "WH08",
+                "inNum": 19046,
+                "outNum": 15869,
+                "date": "2024-12-30",
+                "key": null
+            },
+            {
+                "code": "WH08",
+                "inNum": 21327,
+                "outNum": 1400,
+                "date": "2024-12-31",
+                "key": null
+            },
+            {
+                "code": "WH08",
+                "inNum": 21331,
+                "outNum": 22400,
+                "date": "2025-01-01",
+                "key": null
+            },
+            {
+                "code": "WH08",
+                "inNum": 15786,
+                "outNum": 35815,
+                "date": "2025-01-02",
+                "key": null
+            },
+            {
+                "code": "WH08",
+                "inNum": 12539,
+                "outNum": 8088,
+                "date": "2025-01-03",
+                "key": null
+            },
+            {
+                "code": "WH08",
+                "inNum": 18243,
+                "outNum": 28100,
+                "date": "2025-01-04",
+                "key": null
+            },
+            {
+                "code": "WH08",
+                "inNum": 22174,
+                "outNum": 16990,
+                "date": "2025-01-05",
+                "key": null
+            },
+            {
+                "code": "WH08",
+                "inNum": 26155,
+                "outNum": 4035,
+                "date": "2025-01-06",
+                "key": null
+            },
+            {
+                "code": "WH08",
+                "inNum": 18028,
+                "outNum": 9650,
+                "date": "2025-01-07",
+                "key": null
+            },
+            {
+                "code": "WH08",
+                "inNum": 23623,
+                "outNum": 28260,
+                "date": "2025-01-08",
+                "key": null
+            },
+            {
+                "code": "WH08",
+                "inNum": 24336,
+                "outNum": 7940,
+                "date": "2025-01-09",
+                "key": null
+            },
+            {
+                "code": "WH08",
+                "inNum": 20421,
+                "outNum": 31510,
+                "date": "2025-01-10",
+                "key": null
+            },
+            {
+                "code": "WH08",
+                "inNum": 20520,
+                "outNum": 61332,
+                "date": "2025-01-11",
+                "key": null
+            },
+            {
+                "code": "WH08",
+                "inNum": 19294,
+                "outNum": 33083,
+                "date": "2025-01-12",
+                "key": null
+            }
+        ],
+        "m-in": 242450,
+        "m-out": 287203,
+        "curr": 527036.0,
+        "out": [
+            {
+                "code": "WH08",
+                "name": "成辅仓库",
+                "clas": "成品类",
+                "type": "1楼满垛成品托盘出库",
+                "total": 33083,
+                "flag": false,
+                "date": "2025-01-12",
+                "key": null
+            }
+        ]
+    }
+}

+ 92 - 52
main.html

@@ -60,8 +60,9 @@
     <div itemcode="11"><span>生产绩效月报</span><img src="image/imp2.png" style="float: right;margin-top: 7px;"></div>
     <div itemcode="12"><span>车间能耗日报</span><img src="image/imp2.png" style="float: right;margin-top: 7px;"></div>
     <div itemcode="13"><span>车间能耗月报</span><img src="image/imp2.png" style="float: right;margin-top: 7px;"></div>
-    <div itemcode="14"><span>白布靶向预测</span><img src="image/imp2.png" style="float: right;margin-top: 7px;"></div>
+    <div itemcode="14"><span>白布靶向预测</span><img src="image/imp2.png" style="float: right;margin-top: 7px;"></div>
     <div itemcode="15"><span>毯业加工成本</span><img src="image/imp2.png" style="float: right;margin-top: 7px;"></div>
+    <div itemcode="16"><span>能耗统计报表</span><img src="image/imp2.png" style="float: right;margin-top: 7px;"></div>
     <!--            <div itemcode="1"><span>最近7天</span><img src="image/imp2.png" style="float: right;margin-top: 7px;"></div>-->
     <!--            <div itemcode="2"><span>自定义日期</span><img src="image/imp2.png" style="float: right;margin-top: 7px;"></div>-->
 </div>
@@ -1307,7 +1308,7 @@
                         </thead>
                         <tbody>
                             <tr>
-                                <td colspan="8">正在加载数据中...</td>
+                                <td colspan="8">正在加载数据中...</td>                                
                             </tr>
                         </tbody>
                     </table>
@@ -1394,7 +1395,7 @@
 </div>
 <div id="iframeWin">
     <div class="title"><img src="image/title_icon.png" style="margin: 7px;float: left;"><span class="text">--</span><img src="image/Close.png" style="margin: 7px;float: right;cursor: pointer;" onclick="CloseWin()"></div>
-    <div class="content"><iframe src="" class=""></iframe></div>
+    <div class="content"><iframe src="" class=""></iframe></div>    
 </div>
 </body>
 <script type="text/html" id="maogodetail_tpl">
@@ -2656,7 +2657,9 @@
                     //e.stopPropagation();
                     showTTT();
                     break;
-
+                case 16:
+                    window.open(SERVER_URL + "/export/tmp");
+                    break;
             }
         })
         //自定义导出日期确定
@@ -2772,7 +2775,7 @@
                 })
             })
         })
-        //白布预测分析
+        //白布预测分析
         $("#bpb_fx").on('click',function(e){
             e.stopPropagation();
             var ifm = $("#iframeWin").attr("class","newwin bpbWin").show();
@@ -2875,11 +2878,13 @@
     }
     //获取全厂统计数据
     function GetFacData() {
+        //"/static/3d/data.json"
         $.getJSON(SERVER_URL + "/stock", {}, function (res) {
             setTimeout(function () {
                 //每1分钟主动查询一次数据
                 GetFacData()
             }, 60*1000);
+            FacStockData = res;
             if (res == null) {
                 return
             }
@@ -2899,12 +2904,14 @@
                         var dataText = dataTpl;
                         //将模板中的属性替换成数据值
                         for (var attr in dataMap) {
+                            /*
                             if(attr=="fdy" || attr=="poy"){
                                 for (var yclattr in dataMap[attr]) {
                                     dataText = dataText.replace("{"+attr+"."+yclattr+"}",dataMap[attr][yclattr].toString().padEnd(6," "));
                                 }
                                 continue
                             }
+                            */
                             dataText = dataText.replace("{"+attr+"}",dataMap[attr].toString().padEnd(6," "));
                         }
                         //更新GIS标记内容
@@ -3063,6 +3070,10 @@
     var playerNative = null;
     var playerConnState = false;
     var reconntimer = null;
+    var markerLClickObj=null; //当前点击的标记对象
+    var FacStockData = null;//全厂库存统计数据
+    var StockTypeName={"pt":"盘头","ycl":"原材料","bpb":"白坯布","cp":"成品"};
+    var StockTypeUnit={"pt":"个","ycl":"KG","bpb":"KG","cp":"条"};
     //2.[可选]监听连接成功消息
     player.on("Connected", () => {
         console.log("Has connected to engine")
@@ -3125,21 +3136,21 @@
              var obj02 = await player.Native.ModelTree.findItemByName("Box013",0,true,1);
              var imgid = await player.Native.GisMarker.loadImage("data://icon/qietu/tip2.png");
              var options = {
-                         "text": "白坯布(KG)\r\r当日入库:- 出库:-\r当月入库:- 出库:-\r",
+                         "text": "白柸布("+StockTypeUnit['bpb']+")\r\r当前库存:-\r统计时间:7点至次日7点\r当日入库:- 出库:-\r当月入库:- 出库:-\r",
                          "visible": true,
                          //"maxLod": 130,
                          "minLod": 0,
                          "textFontSize":16,
                          "textColor": parseInt("0xffffffff"),
                          "contentPadding":[5,5,5,5],
-                         "userData":"bpb|白坯布(KG)\r\r当日入库:{d-in} 出库:{d-out}\r当月入库:{m-in} 出库:{m-out}\r"
+                         "userData":"bpb|白柸布("+StockTypeUnit['bpb']+")\r\r当前库存:{curr}\r统计时间:7点至次日7点\r当日入库:{d-in} 出库:{d-out}\r当月入库:{m-in} 出库:{m-out}\r"
              };
 
              var obj02Aabb = await player.Native.ModelTree.getItemShapeInfo(obj02.item);
-             options.pos = [obj02Aabb.aabb[0][0], obj02Aabb.aabb[0][1]-25, obj02Aabb.aabb[0][2]+100];
+             options.pos = [obj02Aabb.aabb[0][0], obj02Aabb.aabb[0][1]-10, obj02Aabb.aabb[0][2]+115];
              //options.parentNode=tmp.item;
              options.imgId = imgid
-             options.imgSize = [0, 110];
+             options.imgSize = [0, 140];
              var markPtr = await player.Native.GisMarker.create(options);
              //await player.Native.GisMarker.update(markPtr, options);
              MarkerMapFac["FAC"]={};
@@ -3148,20 +3159,20 @@
              var pantou = await player.Native.ModelTree.findItemByName("Object023",0,true,1);
              //var imgid = await player.Native.GisMarker.loadImage("rgba:255,0,255,255");
              var options = {
-                         "text": "盘头(个)\r\r当日入库:- 出库:-\r当月入库:- 出库:-",
+                         "text": "盘头("+StockTypeUnit['pt']+")\r\r当前库存:-\r统计时间:7点至次日7点\r当日入库:- 出库:-\r当月入库:- 出库:-",
                          "visible": true,
                          //"maxLod": 130,
                          "minLod": 0,
                          "textFontSize":16,
                          "textColor": parseInt("0xffffffff"),
                          "contentPadding":[5,5,5,5],
-                         "userData":"pt|盘头(个)\r\r当日入库:{d-in} 出库:{d-out}\r当月入库:{m-in} 出库:{m-out}\r"
+                         "userData":"pt|盘头("+StockTypeUnit['pt']+")\r\r当前库存:{curr}\r统计时间:7点至次日7点\r当日入库:{d-in} 出库:{d-out}\r当月入库:{m-in} 出库:{m-out}\r"
              };
              var obj02Aabb = await player.Native.ModelTree.getItemShapeInfo(pantou.item);
              options.pos = [obj02Aabb.aabb[0][0], obj02Aabb.aabb[0][1]-30, obj02Aabb.aabb[0][2]+45];
              //options.parentNode=tmp.item;
              options.imgId = imgid
-             options.imgSize = [240, 110];
+             options.imgSize = [240, 140];
              var markPtr = await player.Native.GisMarker.create(options);
              MarkerMapFac["FAC"][markPtr]=options;
              //await player.Native.GisMarker.update(markPtr, options);
@@ -3169,14 +3180,14 @@
              var pantou = await player.Native.ModelTree.findItemByName("B412",0,true,1);
              //var imgid = await player.Native.GisMarker.loadImage("rgba:255,0,255,255");
              var options = {
-                         "text": "原材料(KG)\r\rfdy当日入库:- 出库:-\rfdy当月入库:- 出库:-\rpoy当日入库:- 出库:-\rpoy当月入库:- 出库:-",
+                         "text": "原材料("+StockTypeUnit['ycl']+")\r\r当前库存:-\r统计时间:7点至次日7点\r当日入库:- 出库:-\r当月入库:- 出库:-\r",
                          "visible": true,
                          //"maxLod": 130,
                          "minLod": 0,
                          "textFontSize":16,
                          "textColor": parseInt("0xffffffff"),
                          "contentPadding":[5,5,5,5],
-                         "userData":"ycl|原材料(KG)\r\rfdy当日入库:{fdy.d-in} 出库:{fdy.d-out}\rfdy当月入库:{fdy.m-in} 出库:{fdy.m-out}\rpoy当日入库:{poy.d-in} 出库:{poy.d-out}\rpoy当月入库:{poy.m-in} 出库:{poy.m-out}"
+                         "userData":"ycl|原材料("+StockTypeUnit['ycl']+")\r\r当前库存:{curr}\r统计时间:7点至次日7点\r当日入库:{d-in} 出库:{d-out}\r当月入库:{m-in} 出库:{m-out}\r"
              };
              var obj02Aabb = await player.Native.ModelTree.getItemShapeInfo(pantou.item);
              options.pos = [obj02Aabb.aabb[0][0], obj02Aabb.aabb[0][1]-30, obj02Aabb.aabb[0][2]+60];
@@ -3188,22 +3199,34 @@
              //await player.Native.GisMarker.update(markPtr, options);
              //var imgid = await player.Native.GisMarker.loadImage("rgba:255,0,255,255");
              var options = {
-                         "text": "成品(条)\r\r当日入库:- 出库:-\r当月入库:- 出库:-",
+                         "text": "成品("+StockTypeUnit['cp']+")\r\r当前库存:-\r统计时间:7点至次日7点\r当日入库:- 出库:-\r当月入库:- 出库:-",
                          "visible": true,
                          //"maxLod": 130,
                          "minLod": 0,
                          "textFontSize":16,
                          "textColor": parseInt("0xffffffff"),
                          "contentPadding":[5,5,5,5],
-                         "userData":"cp|成品(条)\r\r当日入库:{d-in} 出库:{d-out}\r当月入库:{m-in} 出库:{m-out}\r"
+                         "userData":"cp|成品("+StockTypeUnit['cp']+")\r\r当前库存:{curr}\r统计时间:7点至次日7点\r当日入库:{d-in} 出库:{d-out}\r当月入库:{m-in} 出库:{m-out}\r"
             };
-            options.pos = [obj02Aabb.aabb[0][0]+120, obj02Aabb.aabb[0][1]-20, obj02Aabb.aabb[0][2]+50];
+            options.pos = [obj02Aabb.aabb[0][0]+120, obj02Aabb.aabb[0][1]+10, obj02Aabb.aabb[0][2]+65];
             //options.parentNode=tmp.item;
             options.imgId = imgid
-            options.imgSize = [250, 110];
+            options.imgSize = [250, 140];
             var markPtr = await player.Native.GisMarker.create(options);
             MarkerMapFac["FAC"][markPtr]=options;
             //await player.Native.GisMarker.update(markPtr, options);
+            //标记点击
+            Native.GisMarker.EventGisMarkerLClick.connect((event) => {                            
+                markerLClickObj = MarkerMapFac["FAC"][event.markerId];
+                if(markerLClickObj==null || FacStockData==null) return;
+                setTimeout(function(dataType){
+                    if(dataType==null) return;
+                    dataType = dataType.split("|");
+                    //打开库存趋势窗口
+                    showStockTrend(dataType[0]);
+                },300,markerLClickObj["userData"]);   
+            });
+
             GetFacData();
         }else{
             showMarker(currentTargetType);
@@ -3284,7 +3307,7 @@
             var errStr = await PlayerUtils.call(Native.Model.loadModel, currentTargetType, cf);
             modelLoadState[currentTargetType] = true;
         }
-        showMarker(currentTargetType);
+        showMarker(currentTargetType);        
         await player.Native.Model.setModelVisible(currentTargetType,true);
         player.Native.CameraAnimation.clearKeyFrame();
     }
@@ -3428,48 +3451,59 @@
         Native.Tools.setCurrentTool("system.Browse");
         Native.ModelTree.EventBrowseLClick.connect((event) => {
             if(event.object==null) return;
+            
             if(currentTargetType=="FAC"){
-                var inTxt = "";
-                if(inPoints[event.object.name]!=null){
-                    //进入楼层内部
-                     inTxt = txt;
-                }else {
-                    for (var txt in inPoints) {
-                        var item = inPoints[txt];
-                        if(event.pos[1]>= item["x1"] && event.pos[2]<= item["y1"] &&event.pos[1]<= item["x2"] && event.pos[2]>= item["y2"]){
-                            inTxt = txt;
-                            break;
+                //必须延迟处理模型的点击事件,以判断是否是点击的标记,暂时没有找到更好的方法处理标记点击
+                setTimeout(function(event){
+                    if(markerLClickObj!=null){
+                        //标记被点击时,不执行模型点击逻辑
+                        markerLClickObj = null;
+                        return;
+                    }
+                    markerLClickObj = null;
+                    var inTxt = "";
+                    if(inPoints[event.object.name]!=null){
+                        //进入楼层内部
+                         inTxt = txt;
+                    }else {
+                        for (var txt in inPoints) {
+                            var item = inPoints[txt];
+                            if(event.pos[1]>= item["x1"] && event.pos[2]<= item["y1"] &&event.pos[1]<= item["x2"] && event.pos[2]>= item["y2"]){
+                                inTxt = txt;
+                                break;
+                            }
                         }
                     }
-                }
-                if(inTxt!=""){
-                    switch(inTxt){
-                        case "IN02":
-                            loadIn02Model(Native);
-                            break;
-                        case "IN03":
-                            loadIn03Model(Native);
-                            break;
-                        case "IN04":
-                            loadIn04Model(Native);
-                            break;
-                        case "IN05":
-                            loadIn05Model(Native);
-                            break;
-                        default:
-                            break;
+                    if(inTxt!=""){
+                        switch(inTxt){
+                            case "IN02":
+                                loadIn02Model(Native);
+                                break;
+                            case "IN03":
+                                loadIn03Model(Native);
+                                break;
+                            case "IN04":
+                                loadIn04Model(Native);
+                                break;
+                            case "IN05":
+                                loadIn05Model(Native);
+                                break;
+                            default:
+                                break;
+                        }
+                        currentTargetType=inTxt;
+                        backMasterView();
+                    }else{
+                        moveFacAnything("LClick", event);
                     }
-                    currentTargetType=inTxt;
-                    backMasterView();
-                }else{
-                    moveFacAnything("LClick", event);
-                }
+                },200,event);
                 return;
             }
             if(currentTargetType=="IN02") updateInfo("LClick", event);
             if(currentTargetType=="IN03") move03Anything("LClick", event);
         });
         Native.ModelTree.EventBrowseRClick.connect((event) => {
+            if(markerLClickObj!=null) return;
             updateInfo("RClick", event)
         });
     })
@@ -3998,11 +4032,17 @@
             tpls.push('<tr style="font-weight:bold;background:rgb(236 239 243 / 48%)">');
             for (var i1 = 0; i1 < datalist[i].length; i1++) {
                 tpls.push('<td>'+datalist[i][i1]+'</td>');
-            }
+            }            
             tpls.push('</tr>');
         }
         tbody.html(tpls.join(''));
         $("#ttt").show();
     }
 
+    function showStockTrend(type){
+        var ifm = $("#iframeWin").attr("class","newwin bpbWin").show();
+        ifm.find(".title .text").html(StockTypeName[type]+'库存趋势');
+        ifm.find("iframe").attr({"src":"stock_trend.html#"+type});
+    }
+
 </script>

+ 208 - 0
stock_trend.html

@@ -0,0 +1,208 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <meta charset="utf-8">
+    <title></title>
+    <link rel="stylesheet" type="text/css" href="css/main.css">
+    <link rel="stylesheet" type="text/css" href="css/jquery-ui.css">
+    <style type="text/css">
+        .content>div{
+            float: left;
+            width: 100%;
+            color: #fff;
+        }
+        #echartTrend{            
+            height: 40%;
+        }
+        #inlist,#outlist{
+            width: 48%;
+            height: 98%;
+            margin: 1%;
+            float: left;
+        }
+        .trend-title{
+            width: 100%;height:20%;text-align: center;line-height: 40px;font-weight: bold;font-size: 20px;
+        }
+    </style>
+</head>
+<body onclick="clearEle();" style="background-color: rgba(41,85,137,0.7);height: 724px;">
+<div class="content" style="height: 100%;">
+    <div id="echartTrend">
+        <div class="trend-title">出入库趋势-最近1月</div>
+        <div style="width: 100%;height:80%;"></div>
+    </div>
+    <div style="height: 60%;">
+        <div id="inlist">
+            <div class="trend-title" style="height: 15%">当日入库明细</div>
+            <div style="width: 100%;height:85%;overflow-y: auto;"></div>
+        </div>
+        <div id="outlist">
+            <div class="trend-title" style="height: 15%">当日出库明细</div>
+            <div style="width: 100%;height:85%;overflow-y: auto;"></div>
+        </div>
+    </div>
+</div>
+<script type="text/html" id="detail_tpl">
+    <table style="width: 100%;">
+        <thead>
+            <tr style="text-align: center;font-weight: bold;">
+                <td width="30%">物料类型</td>
+                <td width="40%">单据类型</td>
+                <td width="30%">数量 ({{unitname}})</td>
+            </tr>
+        </thead>
+        <tbody>
+            {{each data}}
+            <tr>
+                <td width="30%">{{$value.clas}}</td>
+                <td width="40%">{{$value.type}}</td>
+                <td width="30%">{{$value.total}}</td>
+            </tr>
+            {{/each}}
+        </tbody>
+    </table>
+</script>
+</body>
+</html>
+<!-- 引入qwebchannel.js、Player.js、PlayerUtils.js -->
+<script type="text/javascript" src="jquery-3.4.1.js"></script>
+<script type="text/javascript" src="jquery-ui.min.js"></script>
+<script type="text/javascript" src="echarts.min.js"></script>
+<script src="global.js"></script>
+<script type="text/javascript" src="template.js"></script>
+
+<script>
+    var type = window.location.hash.replace('#','');
+    var unit = parent.StockTypeUnit[type];
+    $(document).ready(function () {
+        var datalist = (parent.FacStockData[type]['trend']);
+        showTrend(datalist);
+        var indatalst = parent.FacStockData[type]['in'];
+        var outdatalst = parent.FacStockData[type]['out'];
+        var inhtml = template('detail_tpl',{data:indatalst,unitname:unit});
+        var outhtml = template('detail_tpl',{data:outdatalst,unitname:unit});
+        $("#inlist>div:last").html(inhtml);
+        $("#outlist>div:last").html(outhtml);
+    });
+    function showTrend(data){
+            var t = $("#echartTrend>div:last");
+            var inNum = [],outNum=[];
+            var times = [];
+            var v_series = [];
+            for (var i = 0; i < data.length; i++) {                
+                var tv = data[i]['date'].split("-")
+                times.push(tv[1] + "-" + tv[2])
+                inNum.push(data[i]['inNum']);
+                outNum.push(data[i]['outNum']);
+            }            
+            if (times.length == 0) {
+                //t.parent().hide();
+            } else {
+                v_series.push({
+                    name: "入库",
+                    type: 'line',
+                    smooth: true,
+                    //symbol: 'none',
+                    data: inNum,
+                    itemStyle: {
+                        normal: {
+                            color: '#F0F275', // 这里设置折线的颜色
+                            lineStyle: {
+                                color: '#F0F27580' // 这里同时设置线头的颜色
+                            }
+                        }
+                    },
+                });
+                v_series.push({
+                    name: "出库",
+                    type: 'line',
+                    smooth: true,
+                    //symbol: 'none',
+                    data: outNum,
+                    itemStyle: {
+                        normal: {
+                            color: '#FFFFFF', // 这里设置折线的颜色
+                            lineStyle: {
+                                color: '#FFFFFF80' // 这里同时设置线头的颜色
+                            }
+                        }
+                    },
+                });
+                var opt = {
+                    title: {
+                        show: false, //不显示标题
+                        text: '',
+                        textStyle: {
+                            color: "rgb(89, 151, 229)",
+                            fontWeight: "bold"
+                        },
+                        top: "0px",
+                        left: "30px"
+                    },
+                    tooltip: {
+                        trigger: 'axis',
+                        backgroundColor:'rgba(41,85,137,0.7)',
+                        textStyle: {
+                            // 设置字体颜色
+                            color: '#fff'
+                        },
+                        formatter: function (params) {
+                            let xv='';
+                            let result = '';
+                            params.forEach(function (item) {
+                                xv=`${item.name}<br/>`;
+                                result += ` ${item.marker} ${item.value}(`+unit+`)<br/>`;
+                            });
+                            return xv+result;
+                        }
+                    },
+                    legend: {
+                        show: true, //不显示图例
+                        inactiveColor: "#04417A",
+                        data: ["入库","出库"],
+                        textStyle: {color: "#fff"},
+                        top: "-5px"
+                    },
+                    grid: {
+                        left: '1%',
+                        right: '1%',
+                        bottom: '5%',
+                        top: '10%',
+                        containLabel: true
+                    },
+                    xAxis: {
+                        type: 'category',
+                        boundaryGap: false,
+                        axisLabel: {
+                            rotate: 45,
+                            color: "#fff"
+                        },
+                        data: times
+                    },
+                    yAxis: {
+                        type: 'value',
+                        nameTextStyle: {
+                            color: "#fff"
+                        },
+                        axisLabel: {
+                            color: "rgb(203,215,235)"
+                        },
+                        splitLine: {
+                            lineStyle: {
+                                color: "#7DA7CD",
+                                type: "dashed",
+                                width: 1
+                            }
+                        }
+                    },
+                    series: v_series
+                };
+                var echartsEle = echarts.init(t[0]);
+                echartsEle.setOption(opt);
+            }
+    }
+    function clearEle(){
+        
+    }
+
+</script>