From 37adc87d3ca42242424ac8e1b83cc86ab00a666c Mon Sep 17 00:00:00 2001
From: hwh <332078369@qq.com>
Date: 星期三, 05 三月 2025 08:04:28 +0800
Subject: [PATCH] 储位图例
---
Wms/WMS.IBLL/ISysServer/IStorageLocatServer.cs | 1
Wms/Model/ModelVm/SysVm/BordModel.cs | 36 +++
Wms/Utility/Extension/ApplicationBuilderExtensions.cs | 22 +
Wms/Wms/Controllers/BordController.cs | 34 +++
Wms/WMS.BLL/SysServer/StorageLocatServer.cs | 59 +++++
HTML/views/WareHouseSetting/DenseLegend.html | 361 ++++++++++++++++++++++++++++++++++++
HTML/views/WareHouseSetting/test.json | 59 +++++
7 files changed, 566 insertions(+), 6 deletions(-)
diff --git a/HTML/views/WareHouseSetting/DenseLegend.html b/HTML/views/WareHouseSetting/DenseLegend.html
new file mode 100644
index 0000000..7785fea
--- /dev/null
+++ b/HTML/views/WareHouseSetting/DenseLegend.html
@@ -0,0 +1,361 @@
+<!DOCTYPE html>
+<html>
+
+<head>
+ <meta charset="utf-8">
+ <title>鍌ㄤ綅鍥句緥</title>
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+ <meta name="viewport"
+ content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
+ <link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all">
+ <link rel="stylesheet" href="../../layuiadmin/style/admin.css" media="all">
+ <style type="text/css">
+ .layouts {
+ display: flex;
+ }
+ .layui-card-header {
+ border-bottom: 1px solid #C9C5C5;
+ }
+ /* ******************************************** */
+
+ #tab{
+ border: 1px solid black ;
+ border-collapse: separate;
+ border-spacing: 2;
+ padding: 3px;
+ }
+ table td{
+ border: 3px solid white;
+ /* width: 35px;
+ height: 45px;
+
+ background-color: red;
+ text-align: center; */
+
+ }
+ .btncls{
+ width: 30px;
+ height: 40px;
+ line-height: 20px;
+ }
+ .divcls{
+ box-shadow: 2px 2px 1px #888888;
+ border-radius: 2px;
+ }
+ .textSty{
+ color: black;
+ text-align: center;
+ word-break: break-all; word-wrap:break-word;
+ }
+ .zero{
+ background-color:#5470c6;
+ Opacity:.8;
+ }
+ .one{
+ background-color:#91cc75;
+ Opacity:.8;
+ }
+ .two{
+ background-color:#ffdc60;
+ }
+ .three{
+ background-color:#ee6666;
+ Opacity:.8;
+ }
+ .four{
+ background-color:#ffff7f;/*#ffff7f*/
+ Opacity:.8;
+ }
+ .five{
+ background-color:#ee23ee;
+ /* background-color:#9dee77; */
+ Opacity:.8;
+ }
+ /* .six{
+ background-color:#ee23ee;
+ Opacity:.8;
+ }
+ .seven{
+ background-color:#eea6c0;
+ Opacity:.8;
+ } */
+ .eight{
+ background-color:#adacac;
+ }
+ .btnShow{
+ width: 20px;
+ height: 15px;
+ }
+ </style>
+</head>
+
+<body>
+ <div class="layui-fluid" style="padding-bottom: 0;">
+ <div class="layui-card">
+ <div class="layui-form layui-card-header layuiadmin-card-header-auto">
+ <div class="layui-form-item">
+ <div class="layui-inline">
+ <label class="layui-form-label">灞�</label>
+ <div class="layui-input-inline">
+ <select name="SlotLayer" id="SlotLayer" lay-filter="SelectLayer">
+ <option value="1">涓�灞�</option>
+ <option value="2">浜屽眰</option>
+
+ </select>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div class="layui-card-body">
+
+ <div class="layouts">
+ <!-- 宸﹁竟鍥� -->
+ <div id="chartMap1" style="width:66%;height:86vh; display: flex; justify-content: space-around;">
+ <div>
+ <table id="tab"></table>
+ </div>
+ <div>
+ <table>
+ <tr>
+ <td><button class="btnShow" disabled></button></td>
+ <td>璺戦亾</td>
+ </tr>
+ <tr>
+ <td><button class="btnShow eight" disabled></button></td>
+ <td>宸插睆钄�</td>
+ </tr>
+ <!-- <tr>
+ <td><button class="btnShow six" disabled></button></td>
+ <td>绌烘墭璺�</td>
+ </tr> -->
+ <tr>
+ <td><button class="btnShow five" disabled></button></td>
+ <td>绉诲嚭涓�</td>
+ </tr>
+ <tr>
+ <td><button class="btnShow four" disabled></button></td>
+ <td>绉诲叆涓�</td>
+ </tr>
+ <tr>
+ <td><button class="btnShow three" disabled></button></td>
+ <td>鍑哄簱涓�</td>
+ </tr>
+ <tr>
+ <td><button class="btnShow two" disabled></button></td>
+ <td>鍏ュ簱涓�</td>
+ </tr>
+ <tr>
+ <td><button class="btnShow one" disabled></button></td>
+ <td>鏈夌墿鍝�</td>
+ </tr>
+ <tr>
+ <td><button class="btnShow zero" disabled></button></td>
+ <td>绌哄簱浣�</td>
+ </tr>
+ </table>
+ </div>
+
+ </div>
+ <!-- 鍙宠竟鍥� -->
+ <div id="chartMap2" style="width:34%;height:87vh; border-left: 1px solid #C9C5C5;"></div>
+ </div>
+
+ </div>
+ </div>
+ </div>
+ <script src="../../layuiadmin/layui/layui.js"></script>
+ <script src="../../js/public.js"></script>
+ <script src="../../js/jquery-3.5.1.min.js"></script>
+ <script src="../../js/jquery.cookie.js"></script>
+ <script src="../../js/echarts.min.js"></script>
+ <script>
+ var uid = $.cookie('userId');
+ if (uid == null) {
+ alert('璇风櫥褰曞悗鎿嶄綔');
+ window.parent.location.href = '../Login.html'
+ }
+ layui.config({
+ base: '../../layuiadmin/' //闈欐�佽祫婧愭墍鍦ㄨ矾寰�
+ }).extend({
+ index: 'lib/index' //涓诲叆鍙fā鍧�
+ }).use(['index', 'table', 'laypage', 'layer'], function () {
+ var table = layui.table,
+ form = layui.form,
+ laypage = layui.laypage,
+ layer = layui.layer,
+ $ = layui.$;
+
+ var cengShu = "1";
+ var dom = $('#LAY_app_tabsheader', parent.document).children()//.find(s=>s.s.nodeType == 1 && className == "layui-this")
+
+ setInterval(() => {
+ for (let i = 0; i < dom.length; i++) {
+ const e = dom[i];
+ if (e.getAttribute("class") == "layui-this" && e.getAttribute("lay-id") == "EquipmentManage/Roadway.html") {
+ GetSlotVm(cengShu);
+ // GetSlotChart(cengShu);
+ }
+ }
+ }, 5000);
+
+
+
+ // 鏌ヨ浜嬩欢
+ GetSlotVm(cengShu);
+ // GetSlotChart(cengShu);
+ form.on('select(SelectLayer)', function(data){
+ // console.log(data.elem); //寰楀埌select鍘熷DOM瀵硅薄
+ // console.log(data.value); //寰楀埌琚�変腑鐨勫��
+ // console.log(data.othis); //寰楀埌缇庡寲鍚庣殑DOM瀵硅薄
+ cengShu = data.value;
+ GetSlotVm(data.value);
+ // GetSlotChart(data.value);
+ });
+ //鑾峰彇鏁版嵁娓叉煋搴撲綅鍥�
+ function GetSlotVm(ceng) {
+ console.log(ceng);
+ var item = {
+ layer:ceng
+ };
+ sendData(IP + "/Bord/GetSlotVm", item, 'get', function (res) {
+
+ if (res.code == 0) {
+ $("#tab").html("");
+ var html = '';
+ var list = res.data;
+ var slots = list.SlotsVm;
+ for (let i = list.Col; i > 0; i--) {
+ html += '<tr >';
+ for (let k = 1; k <= list.Row; k++) {
+ var statu = slots.find(r=> r.SlotColumn==i && r.SlotRow == k);
+
+ var d = "";
+ var s ="eight";
+ if (statu != undefined) {
+ s= statu.SlotStatusCls;
+ d = statu.SlotCode;
+ if (statu.Make =="02") {
+ html +='<td><button val='+d+' class="btncls " disabled></button></td>'
+ } else {
+ var lie=d.substr(2,2);
+ var hang=d.substr(0,2);
+ console.log(lie);
+ console.log(hang);
+ html +='<td><div val='+d+' class="btncls divcls textSty '+ s +'" >'+lie+'<br/>'+hang+'</div></td>'
+ }
+
+
+ }else{
+ html +='<td></td>'
+ }
+ }
+ html +='</tr>';
+
+ }
+ $("#tab").append(html);
+ $(".btncls").mouseover(function () {
+ var codes = $(this).attr("val")
+ console.log(codes);
+ var params={
+ code:codes
+ }
+ var ss = this;
+ // sendData(IP + "/Bord/GetStockMsgBySlot", params, 'post', function (res) {
+ // if (res.code == 1) {
+ // console.log(res.data);
+ // if (res.data != "") {
+ // // layer.tips(res.data, ss);
+ // layer.msg(res.data, {
+ // // icon: 1,
+ // time: 3000
+ // })
+ // }
+
+ // }
+ // });
+
+ });
+ } else {
+ layer.msg(res.msg, {
+ icon: 2,
+ time: 2000
+ }, function () { })
+ }
+ });
+ }
+
+ // 鍔犺浇浠撳簱鍥句緥
+ function GetSlotChart(warehouseId) {
+ var items = {
+ slotLayer: warehouseId,
+ };
+ var index = document.getElementById("SlotLayer").selectedIndex;//鑾峰彇褰撳墠閫夋嫨椤圭殑绱㈠紩.
+ var LayerName = document.getElementById("SlotLayer").options[index].text;
+ sendData(IP + "/Bord/GetSlotList", items, 'post', function (res) {
+
+ if (res.code == 1) {
+ var list = res.data;
+ var key = [];
+ var value = [];
+ for (var i in list) {
+ key.push(i)
+ value.push(list[i])
+ }
+ this.chartLine2 = echarts.init(document.getElementById("chartMap2"));
+ var option2 = {
+ title: {
+ text: LayerName,
+ left: 'center',
+ // top: '15.5%'
+ },
+ tooltip: {
+ trigger: 'item',
+ formatter: '{a} <br/>{b} : {c} ({d}%)'
+ //formatter: '{a} <br/>{b} ({d}%)'
+ },
+ legend: {
+ orient: 'vertical',
+ left: 'left'
+ },
+ series: [{
+ name: '鍌ㄤ綅鏁伴噺鍙婂崰姣�',
+ type: 'pie',
+ radius: '85%',
+ data: [{ value: value[0], name: key[0] },
+ { value: value[1], name: key[1] },
+ { value: value[2], name: key[2] },
+ { value: value[3], name: key[3] },
+ { value: value[4], name: key[4] },
+ { value: value[5], name: key[5] },
+ { value: value[6], name: key[6] },
+ { value: value[7], name: key[7] },
+ { value: value[8], name: key[8] },
+ ],
+ emphasis: {
+ itemStyle: {
+ shadowBlur: 10,
+ shadowOffsetX: 0,
+ shadowColor: 'rgba(255, 0, 0, 0.5)'
+ }
+ }
+ }],
+
+
+ };
+ this.chartLine2.setOption(option2);
+
+ } else {
+ layer.msg(res.msg, {
+ icon: 2,
+ time: 2000
+ }, function () { })
+ }
+ });
+
+ };
+
+ });
+ </script>
+</body>
+
+</html>
\ No newline at end of file
diff --git a/HTML/views/WareHouseSetting/test.json b/HTML/views/WareHouseSetting/test.json
new file mode 100644
index 0000000..5502a66
--- /dev/null
+++ b/HTML/views/WareHouseSetting/test.json
@@ -0,0 +1,59 @@
+{
+ "code": 1,
+ "msg": "鎴愬姛",
+ "data": {
+ "Col": 15,
+ "Row": 18,
+ "SlotsVm": [
+ {
+ "SlotColumn": 1,
+ "SlotRow": 1,
+ "SlotCode": "010101",
+ "SlotStatusCls": "zero",
+ "Make": "01"
+ },
+ {
+ "SlotColumn": 2,
+ "SlotRow": 1,
+ "SlotCode": "010201",
+ "SlotStatusCls": "zero",
+ "Make": "01"
+ },
+ {
+ "SlotColumn": 3,
+ "SlotRow": 1,
+ "SlotCode": "010301",
+ "SlotStatusCls": "zero",
+ "Make": "01"
+ },
+ {
+ "SlotColumn": 4,
+ "SlotRow": 1,
+ "SlotCode": "010401",
+ "SlotStatusCls": "zero",
+ "Make": "01"
+ },
+ {
+ "SlotColumn": 1,
+ "SlotRow": 5,
+ "SlotCode": "A0105",
+ "SlotStatusCls": "zero",
+ "Make": "02"
+ },
+ {
+ "SlotColumn": 4,
+ "SlotRow": 1,
+ "SlotCode": "A0401",
+ "SlotStatusCls": "zero",
+ "Make": "03"
+ },
+ {
+ "SlotColumn": 3,
+ "SlotRow": 3,
+ "SlotCode": "A0303",
+ "SlotStatusCls": "zero",
+ "Make": "04"
+ }
+ ]
+ }
+ }
\ No newline at end of file
diff --git a/Wms/Model/ModelVm/SysVm/BordModel.cs b/Wms/Model/ModelVm/SysVm/BordModel.cs
new file mode 100644
index 0000000..8ff2e63
--- /dev/null
+++ b/Wms/Model/ModelVm/SysVm/BordModel.cs
@@ -0,0 +1,36 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Model.ModelVm.SysVm
+{
+ public class SlotsVm
+ {
+ /// <summary>
+ ///
+ /// </summary>
+ public int SlotColumn { get; set; }
+ /// <summary>
+ ///
+ /// </summary>
+ public int SlotRow { get; set; }
+ /// <summary>
+ ///
+ /// </summary>
+ public string SlotCode { get; set; }
+ /// <summary>
+ ///
+ /// </summary>
+ public string SlotStatusCls { get; set; }
+ /// <summary>
+ ///
+ /// </summary>
+ public string Make { get; set; }
+ }
+ public class BordModelVM
+ {
+ public int Col { get; set; }
+ public int Row { get; set; }
+ public List<SlotsVm> SlotsVm { get; set; } = new List<SlotsVm>();
+ }
+}
diff --git a/Wms/Utility/Extension/ApplicationBuilderExtensions.cs b/Wms/Utility/Extension/ApplicationBuilderExtensions.cs
index 3ea0774..148a483 100644
--- a/Wms/Utility/Extension/ApplicationBuilderExtensions.cs
+++ b/Wms/Utility/Extension/ApplicationBuilderExtensions.cs
@@ -85,16 +85,26 @@
if (requestReader.BaseStream.Length != 0)
requestContent = requestReader.ReadToEnd();
}
- if (httpContext.Request.RouteValues["controller"].ToString().ToLower() == "upapi"|| httpContext.Request.RouteValues["controller"].ToString().ToLower() == "downapi")
+ try
{
- diagnosticContext.Set("ExternalSystems", true);
+ if (httpContext.Request.RouteValues["controller"] != null)
+ {
+ if (httpContext.Request.RouteValues["controller"].ToString().ToLower() == "upapi" || httpContext.Request.RouteValues["controller"].ToString().ToLower() == "downapi")
+ {
+ diagnosticContext.Set("ExternalSystems", true);
+ }
+ else
+ {
+ diagnosticContext.Set("ExternalSystems", false);
+ }
+ }
+ diagnosticContext.Set("_RequestBody", requestContent);
+ diagnosticContext.Set("_Service", AppDomain.CurrentDomain.FriendlyName);
}
- else
+ catch (Exception)
{
- diagnosticContext.Set("ExternalSystems", false);
+
}
- diagnosticContext.Set("_RequestBody", requestContent);
- diagnosticContext.Set("_Service", AppDomain.CurrentDomain.FriendlyName);
};
});
diff --git a/Wms/WMS.BLL/SysServer/StorageLocatServer.cs b/Wms/WMS.BLL/SysServer/StorageLocatServer.cs
index 2f45fce..67ca384 100644
--- a/Wms/WMS.BLL/SysServer/StorageLocatServer.cs
+++ b/Wms/WMS.BLL/SysServer/StorageLocatServer.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
+using System.Reflection.Metadata;
using System.Text;
using System.Threading.Tasks;
using Model.ModelDto.SysDto;
@@ -974,5 +975,63 @@
}
#endregion
+
+ /// <summary>
+ /// 鑾峰彇鍌ㄤ綅淇℃伅(瀵嗛泦搴�)
+ /// </summary>
+ /// <param name="wareHouseNo">浠撳簱</param>
+ /// <param name="row">鎺�</param>
+ /// <returns></returns>
+ public async Task<BordModelVM> GetFlatLegend(string wareHouseNo, int layer)
+ {
+ var list = await Db.Queryable<SysStorageLocat>().Where(s => s.WareHouseNo == wareHouseNo && s.Layer == layer && s.IsDel == "0").ToListAsync();
+ BordModelVM listBord = new BordModelVM()
+ {
+ Col = 15,
+ Row = 18
+ };
+
+ foreach (var modLocat in list)
+ {
+ SlotsVm mod = new SlotsVm()
+ {
+ SlotColumn = modLocat.Column,
+ SlotRow = modLocat.Row,
+ SlotCode = modLocat.LocatNo,
+ //SlotStatusCls = modLocat.Flag!="0"? "eight": modLocat.Status == "0"? "zero":,
+ Make = modLocat.Make
+ };
+ if (modLocat.Flag != "0")
+ mod.SlotStatusCls = "eight";
+ switch (modLocat.Status)
+ {
+ case "0":
+ mod.SlotStatusCls = "zero";
+ break;
+ case "1":
+ mod.SlotStatusCls = "one";
+ break;
+ case "2":
+ mod.SlotStatusCls = "two";
+ break;
+ case "3":
+ mod.SlotStatusCls = "three";
+ break;
+ case "4":
+ mod.SlotStatusCls = "four";
+ break;
+ case "5":
+ mod.SlotStatusCls = "five";
+ break;
+ default:
+ break;
+ }
+ listBord.SlotsVm.Add(mod);
+ }
+
+ return listBord;
+
+ }
+
}
}
diff --git a/Wms/WMS.IBLL/ISysServer/IStorageLocatServer.cs b/Wms/WMS.IBLL/ISysServer/IStorageLocatServer.cs
index 832d69d..0665015 100644
--- a/Wms/WMS.IBLL/ISysServer/IStorageLocatServer.cs
+++ b/Wms/WMS.IBLL/ISysServer/IStorageLocatServer.cs
@@ -193,5 +193,6 @@
#endregion
+ Task<BordModelVM> GetFlatLegend(string wareHouseNo, int layer);
}
}
diff --git a/Wms/Wms/Controllers/BordController.cs b/Wms/Wms/Controllers/BordController.cs
new file mode 100644
index 0000000..b25c173
--- /dev/null
+++ b/Wms/Wms/Controllers/BordController.cs
@@ -0,0 +1,34 @@
+锘縰sing Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Mvc;
+using Model.ModelDto.SysDto;
+using Model.ModelVm.SysVm;
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using Utility;
+using WMS.IBLL.ISysServer;
+
+namespace Wms.Controllers
+{
+ [Route("api/[controller]/[action]")]
+ [ApiController]
+ [Authorize]
+ [ServiceFilter(typeof(ApiResponseActionFilter))]
+ public class BordController : ControllerBase
+ {
+
+ private readonly IStorageLocatServer _locatSvc; //鍌ㄤ綅
+
+ public BordController(IStorageLocatServer locatSvc)
+ {
+ _locatSvc = locatSvc; //鍌ㄤ綅
+ }
+
+ [HttpGet]
+ public async Task<BordModelVM> GetSlotVm(string layer)
+ {
+ return await _locatSvc.GetFlatLegend("W01",Convert.ToInt32(layer));
+ }
+
+ }
+}
--
Gitblit v1.8.0