aa
ahai
2023-05-17 62e492a478ff8ac322795289f190b897800916be
aa
2个文件已添加
5个文件已修改
273 ■■■■■ 已修改文件
src/DIXWeb.Business/GlobalM/StatementBusiness.cs 69 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/DIXWeb.Util/Helper/DataHelper.cs 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/DIXWeb.Web/Areas/GlobalM/Controllers/StatementController.cs 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/DIXWeb.Web/Areas/GlobalM/Views/Statement/ObjectInspectDetail.cshtml 47 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/DIXWeb.Web/Config/database.config 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/DIXWeb.Web/DIXWeb.Web.csproj 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/DIXWeb.Web/Scripts/Statement/ObjectInspectDetail.js 112 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/DIXWeb.Business/GlobalM/StatementBusiness.cs
@@ -1,6 +1,7 @@
using DIXWeb.DAL;
using DIXWeb.Entity.Statement;
using DIXWeb.Entity.Workflow;
using DIXWeb.Util.Helper;
using System;
using System.Collections.Generic;
using System.Data;
@@ -174,8 +175,8 @@
                    List<int> xAxisList = objArr[0] as List<int>;
                    List<string> lineNameList = objArr[1] as List<string>;
                    List<string> xAxisStrList = objArr[2] as List<string>;
                    receive.Extend = GetEChartsTemperature(list, xAxisList, lineNameList, xAxisStrList, yMinTemperature,yMaxTemperature);//转换
                    receive.Extend1 = GetEChartsHumidity(list, xAxisList, lineNameList, xAxisStrList,yMinHumidity,yMaxHumidity);//转换
                    receive.Extend = GetEChartsTemperature(list, xAxisList, lineNameList, xAxisStrList, yMinTemperature, yMaxTemperature);//转换
                    receive.Extend1 = GetEChartsHumidity(list, xAxisList, lineNameList, xAxisStrList, yMinHumidity, yMaxHumidity);//转换
                    receive.Code = 200;
                    receive.Message = "SUCCESS";
@@ -221,7 +222,7 @@
            return receive;
        }
        private ECharts GetEChartsTemperature(List<TransitionDiagram> list, List<int> xAxisList, List<string> lineNameList, List<string> xAxisStrList,string yMin,string yMax)
        private ECharts GetEChartsTemperature(List<TransitionDiagram> list, List<int> xAxisList, List<string> lineNameList, List<string> xAxisStrList, string yMin, string yMax)
        {
            ECharts record = new ECharts();
            record.yMin = yMin;
@@ -250,7 +251,7 @@
                record.EChartsSeriesArr[index].data = TemperatureArr;
                record.EChartsSeriesArr[index].ShowDesc = 0;
                index++;
            }
            }
            record.EChartsSeriesArr[index] = new EChartsSeries();
            record.EChartsSeriesArr[index].InspectObjectName = "温度上限";
            string[] TemperatureMaxArr = list.Select(x => x.TemperatureMax).ToArray<string>();
@@ -341,6 +342,66 @@
            return new object[] { xAxisList, lineNameList, xAxisStrList };
        }
        public Receive GetItemNameByObjectCode(string InspectObjectCode)
        {
            Receive receive = new Receive();
            try
            {
                Dictionary<string, object> dictIn = new Dictionary<string, object>();
                dictIn.Add("@InspectObjectCode", InspectObjectCode);
                DataTable table = new DBHelper().GetDataTable("dbo.zp_GetItemNameByObjectCode", dictIn);
                receive.Code = 200;
                receive.Message = table.Rows[0][0].ToString();
            }
            catch (Exception ex)
            {
                receive.Code = 500;
                receive.Message = ex.Message;
            }
            return receive;
        }
        public Receive GetObjectInspectDetail(string InspectObjectCode, DateTime TimeBegin, DateTime TimeEnd, int page = 1, int rows = 200)
        {
            Receive receive = new Receive();
            try
            {
                Dictionary<string, object> dictIn = new Dictionary<string, object>();
                List<string> dictOutAttr = new List<string>();
                dictIn.Add("@InspectObjectCode", InspectObjectCode);
                dictIn.Add("@TimeBegin", TimeBegin);
                dictIn.Add("@TimeEnd", TimeEnd);
                dictIn.Add("@PageIndex", page);
                dictIn.Add("@PageSize", rows);
                dictOutAttr.Add("@Total");
                dictOutAttr.Add("@colNameArrStr");
                object[] result = new DBHelper("DIX").GetDataTableWithOutPut("dbo.zp_GetObjectInspectDetail", dictIn, dictOutAttr);
                Dictionary<string, object> dictOut = result[1] as Dictionary<string, object>;
                string totalStr = dictOut["@Total"].ToString();
                if (string.IsNullOrEmpty(totalStr))
                {
                    receive.Code = 404;
                    receive.Message = "未查询到数据";
                    return receive;
                }
                receive.total = int.Parse(totalStr);
                if (receive.total <= 0)
                {
                    receive.Code = 404;
                    receive.Message = "未查询到数据";
                    return receive;
                }
                receive.Code = 200;
                receive.rows = new DataHelper().ToDataList(result[0] as DataTable);
                receive.Extend = dictOut["@colNameArrStr"].ToString();
            }
            catch (Exception ex)
            {
                receive.Code = 500;
                receive.Message = ex.Message;
            }
            return receive;
        }
    }
}
src/DIXWeb.Util/Helper/DataHelper.cs
@@ -63,5 +63,29 @@
            }
            return list;
        }
        public List<Dictionary<string, string>> ToDataList(DataTable dt)
        {
            List<Dictionary<string, string>> resultList = new List<Dictionary<string, string>>();
            List<string> titleList = new List<string>();
            Dictionary<string, string> titleDict = new Dictionary<string, string>();
            for (int i = 0; i < dt.Columns.Count; i++)
            {
                titleList.Add(dt.Columns[i].ToString());
                if (!titleDict.ContainsKey(dt.Columns[i].ToString())) titleDict.Add(dt.Columns[i].ToString(), "");
            }
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                DataRow row = dt.Rows[i];
                for (int j = 0; j < titleList.Count; j++)
                {
                    titleDict[titleList[j]] = row[titleList[j]].ToString();
                }
                resultList.Add(titleDict.Copy(0, titleList.Count).ToDictionary(x => x.Key.ToString(), x => x.Value.ToString()));
            }
            titleDict.Clear();
            titleDict = null;
            return resultList;
        }
    }
}
src/DIXWeb.Web/Areas/GlobalM/Controllers/StatementController.cs
@@ -31,6 +31,10 @@
            return View();
        }
        public ActionResult ObjectInspectDetail()
        {
            return View();
        }
        public ActionResult GetInspectObjectType()
        {
@@ -84,5 +88,18 @@
            Receive receive = this._statementBusiness.GetNeedCheckDetail(InspectTypeId, InspectObjectTypeId, Attention, page, rows);
            return Json(receive);
        }
        public ActionResult GetItemNameByObjectCode(string InspectObjectCode)
        {
            Receive receive = this._statementBusiness.GetItemNameByObjectCode(InspectObjectCode);
            return Json(receive);
        }
        public ActionResult GetObjectInspectDetail(string InspectObjectCode,DateTime TimeBegin, DateTime TimeEnd, int page = 1, int rows = 200)
        {
            Receive receive = this._statementBusiness.GetObjectInspectDetail(InspectObjectCode, TimeBegin, TimeEnd, page, rows);
            return Json(receive);
        }
    }
}
src/DIXWeb.Web/Areas/GlobalM/Views/Statement/ObjectInspectDetail.cshtml
New file
@@ -0,0 +1,47 @@

@{
    ViewBag.Title = "ObjectInspectDetail";
    Layout = "~/Views/Shared/_Layout_List.cshtml";
}
<script src="~/Scripts/Statement/ObjectInspectDetail.js"></script>
<table id="tabOIDSearch">
    <tr>
        <td class="tabTitle">设备编码:</td>
        <td class="tabCBB">
            <input id="searchOIDInspectObjectCode" type="text" style="width:120px;" />
            &nbsp;&nbsp;&nbsp;&nbsp;
        </td>
        <td class="tabTitle">时间区间:</td>
        <td class="tabTime" colspan="2">
            <input id="searchOIDtimeBegin" style="width:120px;" type="date" />
            &nbsp;&nbsp;至&nbsp;&nbsp;
            <input id="searchOIDtimeEnd" style="width:120px;" type="date" />
            &nbsp;&nbsp;&nbsp;&nbsp;
        </td>
        <td class="tabButton">
            &nbsp;&nbsp;&nbsp;&nbsp;
            <a id="btnOIDSearch" class="easyui-linkbutton" href="#" data-options="iconCls:'icon-search'">搜索</a>
            &nbsp;&nbsp;&nbsp;&nbsp;
        </td>
        <td></td>
        <td></td>
    </tr>
</table>
<table id="tabOIDTable" class="easyui-datagrid"></table>
<style type="text/css">
    #tabOIDSearch td {
        padding: 5px 0px 5px 0px;
    }
    select {
        width: 115px;
        background-color: white;
        text-align: center;
    }
</style>
src/DIXWeb.Web/Config/database.config
@@ -2,6 +2,6 @@
<connectionStrings>
  <!--SqlServer  172.22.9.171\SPCM001,1433    121.37.232.241 43.98.48.159 --> 
  <!--<add name="DIX" connectionString="data source=121.37.232.241;initial catalog=DIX;Pooling=true;Max Pool Size=100;Min Pool Size=0;integrated security=false;persist security info=True;User ID=developer;Password=p@d2010"  providerName="System.Data.EntityClient"/>-->
  <add name="DIX" connectionString="data source=121.37.232.241;initial catalog=DIX;Pooling=true;Max Pool Size=100;Min Pool Size=0;integrated security=false;persist security info=True;User ID=developer;Password=p@d2010"  providerName="System.Data.EntityClient"/>
  <add name="DIX" connectionString="data source=43.98.48.159;initial catalog=DIX;Pooling=true;Max Pool Size=100;Min Pool Size=0;integrated security=false;persist security info=True;User ID=developer;Password=p@d201908"  providerName="System.Data.EntityClient"/>
  <add name="MySQLDIX" connectionString="Host=localhost;Port=3306;Database=MYSQLDIX;Direct=true;Protocol=TCP;Compress=false;Pooling=true;Min PoolSize=0;Max PoolSize=100;ConnectionLifetime=0;UserID=developer;Password=p@d2010;"/>
</connectionStrings>
src/DIXWeb.Web/DIXWeb.Web.csproj
@@ -805,6 +805,7 @@
    <Content Include="Areas\GlobalM\Views\Bill\ReckUpdateHistory.cshtml" />
    <Content Include="Areas\GlobalM\Views\Bill\StartDIXFireControl.cshtml" />
    <Content Include="Areas\GlobalM\Views\Bill\InspectFalseDetail.cshtml" />
    <Content Include="Areas\GlobalM\Views\Statement\ObjectInspectDetail.cshtml" />
    <None Include="Scripts\jquery-1.10.2.intellisense.js" />
    <Content Include="Scripts\Download\TwoDCodeView.js" />
    <Content Include="Scripts\echarts.common.min.js" />
@@ -818,6 +819,7 @@
    <Content Include="Scripts\Organize\User\Search.js" />
    <Content Include="Scripts\resize.js" />
    <Content Include="Scripts\Statement\InspectCheckedSelect.js" />
    <Content Include="Scripts\Statement\ObjectInspectDetail.js" />
    <Content Include="Scripts\Statement\TransitionDiagram.js" />
    <Content Include="Scripts\TimePluggable\jquery.datetimepicker.css" />
    <Content Include="Scripts\TimePluggable\jquery.datetimepicker.full.min.js" />
src/DIXWeb.Web/Scripts/Statement/ObjectInspectDetail.js
New file
@@ -0,0 +1,112 @@
var dataOIDECharts = [];
$(function () {
    initOIDHeight()
    initOIDTime();
    initOIDClick();
});
function initOIDHeight(){
    var pageHeight = $('#page', window.parent.document).height();
    var whereHeight = $('#tabOIDSearch').height();
    var showHeight = parseInt(pageHeight) - parseInt(whereHeight);
    debugger;
    $('#tabOIDTable').css({ "width": "100%", "height": showHeight + "px" });
}
function initOIDTime() {
    var date = new Date();
    var year = date.getFullYear();
    var month = date.getMonth() + 1;
    var day = date.getDate();
    var dateBeginStr = year + '-' + (month >= 10 ? '' : '0') + month + '-01';
    var dateEndStr = year + '-' + (month >= 10 ? '' : '0') + month + '-' + (day >= 10 ? '' : '0') + day;
    $('#searchOIDtimeBegin').val(dateBeginStr);
    $('#searchOIDtimeEnd').val(dateEndStr);
}
function initOIDTable() {
    initOIDHeight();
    $('#tabOIDTable').empty();
    var param = getOIDSearchParam();
    console.info(param);
    var data = ajaxSame('../../GlobalM/Statement/GetItemNameByObjectCode', param, 'POST', 'JSON');
    if (data.Code != 200) {
        alert(data.Message);
        return;
    }
    var columns = getColumnsOID(data.Message);
    debugger;
    $('#tabOIDTable').datagrid({
        singleSelect: true,
        url: '../../GlobalM/Statement/GetObjectInspectDetail',
        singleSelect: true,
        queryParams: param,
        idField: 'InspectBookId',
        animate: true,
        pagination: true,
        rownumbers: true,
        pagePosition: 'bottom',
        pageSize: 100,
        pageNumber: 1,
        fitColumns: true,
        columns: columns,
        pageList: [20, 50, 100, 200, 500, 1000, 10000],
        //toolbar: '#tabOIDSearch',
        loadFilter: function (data) {
            if (data.Code == 200) {
                return data;
            } else {
                alert(data.Message);
                return null;
            }
        },
    });
}
function getColumnsOID(colArr) {
    var title = [
        { field: "InspectBookId", title: "InspectBookId", hidden: true, },
        { field: "InspectObjectCode", title: "编号",},
        { field: "InspectTime", title: "点检时间", },
        {
            field: "Judge", title: "点检结果", formatter: function (value, row, index) {
                if (value == 'OK') {
                    return '<span style="color:green;">OK</span>';
                } else if (value == 'NG') {
                    return '<span style="color:red;">NG</span>';
                }
            }  },
    ];
    var arr = colArr.split(',');
    for (var i = 0; i < arr.length; i++) {
        title.push({ field: arr[i] + '_Value', title: arr[i], });
        title.push({ field: arr[i] + '_CheckType', title: '基准', });
        title.push({
            field: arr[i] + '_Judge', title: '判定', formatter: function (value, row, index) {
                if (value == 'OK') {
                    return '<span style="color:green;">OK</span>';
                } else if (value == 'NG') {
                    return '<span style="color:red;">NG</span>';
                }
            } });
    }
    return [title];
}
function initOIDClick() {
    //点击查询按钮
    $('#btnOIDSearch').click(function () {
        initOIDTable();
    });
}
function getOIDSearchParam() {
    var timeBegin = $('#searchOIDtimeBegin').val();
    var timeEnd = $('#searchOIDtimeEnd').val();
    var InspectObjectCode = $('#searchOIDInspectObjectCode').val();
    var param = { InspectObjectCode: InspectObjectCode, TimeBegin: timeBegin, TimeEnd: timeEnd }
    return param;
}