<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="List.aspx.cs" Inherits="M_Main.CarparkNew.BangDao.LogPush.List" %>


<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1">
    <title></title>
    <script type="text/javascript" src="/HM/M_Main/Jscript-Ui/jquery-easyui-1.4.4/jquery.min.js"></script>
    <script src="/HM/M_Main/jscript/JSClient.js" type="text/javascript"></script>
    <script src="/HM/M_Main/jscript/jquery.tool.new.js" type="text/javascript"></script>
    <link href="/HM/M_Main/css/framesearch_old.css" type="text/css" rel="stylesheet" />
    <link rel="stylesheet" type="text/css" href="/HM/M_Main/Jscript-Ui/jquery-easyui-1.4.4/themes/default/easyui.css" />
    <link rel="stylesheet" type="text/css" href="/HM/M_Main/Jscript-Ui/jquery-easyui-1.4.4/themes/icon.css" />
    <script type="text/javascript" src="/HM/M_Main/Jscript-Ui/jquery-easyui-1.4.4/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="/HM/M_Main/Jscript-Ui/jquery-easyui-1.4.4/locale/easyui-lang-zh_CN.js"></script>
    <link href="/HM/M_Main/css/framesearch.css" type="text/css" rel="stylesheet" />
    <script type="text/javascript" src="/HM/M_Main/Jscript-Ui/JQForm/JQForm.js"></script>
    <script src="/HM/M_Main/jscript/Dialog.js" type="text/javascript"></script>

    <link href="/HM/M_Main/css/framesearch.css" type="text/css" rel="stylesheet" />
    <link href="/HM/M_Main/css/button.css" rel="stylesheet" />
    <script src="/HM/M_Main/jscript/DateFormat.js" type="text/javascript"></script>
    <script src="/HM/M_Main/jscript/format.js" type="text/javascript"></script>
    <script type="text/javascript" src="/HM/M_Main/jscript/DatePicker/WdatePicker.js"></script>
    <script src="/HM/M_Main/jscript/pagewalkthrough/jquery.pagewalkthrough.min.js"></script>

</head>
<body>
    <form id="FrmForm">
        <input type="hidden" id="SelAll" name="SelAll" runat="server" />
        <input type="hidden" class="easyui-validatebox" id="CostGeneType" name="CostGeneType" runat="server" />
        <input type="hidden" class="easyui-validatebox" id="IsHis" name="IsHis" runat="server" />
        <input type="hidden" class="easyui-validatebox" id="IncidentID" name="IncidentID" runat="server" />

        <input type="hidden" class="easyui-validatebox" id="SelParkID" name="SelParkID" runat="server" />
        <input type="hidden" class="easyui-validatebox" id="SelTaskCode" name="SelTaskCode" runat="server" />

        <input type="hidden" class="easyui-validatebox" id="IsParking" name="IsParking" value="ispark" runat="server" />
        <input type="hidden" class="easyui-validatebox" id="MeterTypes" name="MeterTypes" runat="server" />
        <input type="hidden" id="SelRoomID" name="SelRoomID" value="" runat="server" />
        <div id="SearchDlg" class="easyui-dialog" title="筛选条件" data-options="iconCls:'icon-search',closed: true,modal:true"
            style="width: 300px; height: 100px;">
            <table style="width: 100%;">
                <tr>
                    <td class="TdTitle">车牌号
                    </td>
                    <td class="TdContent">
                        <input type="text" class="easyui-validatebox" id="CarSign" name="CarSign"
                            runat="server" />
                    </td>
                    <td class="TdTitle">电话号
                    </td>
                    <td class="TdContent">
                        <input type="text" class="easyui-validatebox" id="Phone" name="CarSign"
                            runat="server" />
                    </td>
                </tr>
                <tr>
                    <td style="text-align: center" colspan="2">
                        <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="LoadList();">确定筛选</a>
                    </td>
                </tr>
            </table>
        </div>

        <div id="ChargeMealDlg" class="easyui-dialog" title="手动添加推送任务" data-options="iconCls:'icon-search',closed: true,modal:true"
            style="width: 400px; height: 100px;">
            <table style="width: 100%;">
                <tr>
                    <td class="TdTitle">套餐
                    </td>
                    <td class="TdContent">
                        <%--// 1 拉取区域，2 拉取套餐， 3 车位同步, 4 车位编辑,5 车位充值 ,6 车位退费，7 车位强制退费删除--%>
                        <select id="SourceType" name="SourceType" class="easyui-combobox" data-options="editable:false,panelHeight: 'auto'" runat="server">
                            <%--     <option value="拉取区域">拉取区域</option>
                            <option value="拉取套餐">拉取套餐</option>--%>
                            <option value="GetBangDao_ParkAsyncHand">车位同步</option>
                            <%--<option value="车位编辑">车位编辑</option>--%>
                            <option value="GetBangDao_ParkRenewHand">车位充值</option>
                            <%--   <option value="车位退费">车位退费</option>
                            <option value="车位强制退费删除">车位强制退费删除</option>--%>
                        </select>
                        <input name="ParkCode" type="hidden" id="ParkCode" runat="server" />
                        <input name="selCommID" type="hidden" id="selCommID" runat="server" />
                        <input name="ParkID" type="hidden" id="ParkID" runat="server" />
                        <input name="FeesID" type="hidden" id="FeesID" runat="server" />
                        &nbsp;
                        &nbsp;
                        <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-save'" onclick="SaveMeals25944()">添加</a>
                    </td>

                </tr>

            </table>
        </div>

        <div class="easyui-layout" id="dig" style="width: 100%; height: 100%;">
            <div data-options="region:'center',title:'车位信息'" style="width: 100%; height: 100%;">
                <div class="datagrid-toolbar" id="divtt">
                    <table cellspacing="0" cellpadding="0">
                        <tr>
                            <td>
                                <div id="divhj">
                                    <table cellspacing="0" cellpadding="0">
                                        <tr style="padding-left: 40px;color:red;">
                                            <td class="TdTitle">车位编号</td>
                                            <td class="TdContent">
                                                <input type="text" class="easyui-validatebox" id="ParkName" name="ParkName" runat="server" />
                                            </td>
                                        </tr>
                                    </table>
                                </div>
                            </td>
                            <td>
                                <a href="javascript:void(0)" onclick="LoadList();" class="l-btn l-btn-small l-btn-plain" group="" id=""><span class="l-btn-left l-btn-icon-left"><span class="l-btn-text">查询</span><span class="l-btn-icon icon-search">&nbsp;</span></span></a>
                                <a href="javascript:void(0)" onclick="sdtjyew();" class="l-btn l-btn-small l-btn-plain" group="" id=""><span class="l-btn-left l-btn-icon-left"><span class="l-btn-text">手动添加推送任务</span><span class="l-btn-icon icon-save">&nbsp;</span></span></a>
                            </td>
                            <td>
                                <div class="datagrid-btn-separator"></div>
                            </td>
                        </tr>
                    </table>
                </div>
                <div style="width: 100%;" id="TableContainer"></div>
            </div>
            <div data-options="region:'east',split:true" style="width: 50%; height: 100%;">
                <div id="cc" class="easyui-layout" style="width: 100%; height: 100%;">
                    <div data-options="region:'north',title:'任务信息（单击任务查看详细日志记录，单个任务最多推送3次，添加新任务时如存在相同类型任务还在推送中则不会重复添加！）',split:true" style="height: 50%;">
                        <div style="width: 100%;" id="Task_TableContainer"></div>
                    </div>
                    <div data-options="region:'south',title:'任务日志',split:true" style="height: 50%;">
                        <div style="width: 100%;" id="TaskLog_TableContainer"></div>
                    </div>
                </div>
            </div>
        </div>

        <script src="../jscript/CloseAjaxCache.js" type="text/javascript"></script>
        <script type="text/javascript">
            $(function () {
                LoadList();
                $("#SelParkID").val("-1");
                $("#SelTaskCode").val("-1");
                LoadTaskList();
                LoadTaskLogList();
            });

            function InitTableHeight() {
                var h = $(window).height();
                $("#dig").css("height", h + "px");
                $("#TableContainer").css("height", h - 70 + "px");

                $("#Task_TableContainer").css("height", (h / 2) - 40 + "px");
                $("#TaskLog_TableContainer").css("height", (h / 2) - 40 + "px");
            }
            InitTableHeight();
            var Column = [[
                { field: 'CarparkName', title: '车位区域', width: 120, align: 'left', sortable: true },
                { field: 'ParkCategoryName', title: '车位类别', width: 100, align: 'left', sortable: true },
                {
                    field: 'ParkName', title: '车位编号', width: 130, align: 'left', sortable: true,
                    formatter: function (value, row, index) {
                        return row.ParkName;
                    }
                },
                { field: 'StanAmount', title: '收费标准', width: 100, align: 'left', sortable: true },
                { field: 'UseState', title: '当前状态', width: 100, align: 'left', sortable: true },
                {
                    field: 'CustName', title: '客户名称', width: 100, align: 'left', sortable: true,
                    formatter: function (value, row, index) {
                        return row.CustName;
                    }
                },
                { field: 'CarSign', title: '车牌号码', width: 100, align: 'left', sortable: true },
                {
                    field: 'ParkStartDate', title: '开始时间', width: 120, align: 'left', sortable: true,
                    formatter: function (value, row, index) {
                        var str = formatDate(row.ParkStartDate, "yyyy-MM-dd");
                        return str;
                    }
                },
                {
                    field: 'ParkEndDate', title: '结束时间', width: 120, align: 'left', sortable: true,
                    formatter: function (value, row, index) {
                        var str = formatDate(row.ParkEndDate, "yyyy-MM-dd");
                        return str;
                    }
                }, { field: 'ChargeCycleName', title: '计费周期', width: 100, align: 'left', sortable: true },
            ]];
            var IsCollapseAll = false;
            var toolbar = [

                {
                    text: '筛选',
                    iconCls: 'icon-search',
                    handler: function () {
                        $('#SearchDlg').parent().appendTo($("form:first"));
                        $('#SearchDlg').dialog('open');
                    }
                }, '-', {
                    text: '手动推送业务',
                    iconCls: 'icon-save',
                    handler: function () {
                        sdtjyew();
                    }
                }
            ];

            function sdtjyew() {
                var row = $('#TableContainer').datagrid("getSelected");
                if (row) {
                    if (row.BangDao_ParkCode == "") {
                        HDialog.Info("当前所选车位未绑定车场信息，无法进行操作！");
                        return;
                    }
                    else {
                        $('#ParkCode').val(row.BangDao_ParkCode);
                        $('#ParkID').val(row.ParkID);
                        $('#selCommID').val(row.CommID);
                        $('#ChargeMealDlg').parent().appendTo($("form:first"));
                        $('#ChargeMealDlg').dialog('open');
                    }
                } else {
                    HDialog.Info("请选择车位信息!");
                }
            }

            //添加
            function SaveMeals() {
                $("#ChargeMealDlg").dialog("close");
                var SourceType = $('#SourceType').combobox('getValue');
                if (SourceType == "") {
                    HDialog.Info("请选择所加类型!");
                    return;
                }
                var param = {};
                var Contter = "";
                param = { SourceType: SourceType, ParkID: $("#ParkID").val(), ParkCode: $("#ParkCode").val(), CommID: $("#selCommID").val() }
                $.tool.DataPost('BangDao_Park', "BangDao_ParkTaskAdd", $.param(param),
                    function Init() {
                    },
                    function callback(_Data) {
                        var data = JSON.parse(_Data);
                        if (data.result) {
                            parent.layer.alert('保存成功');
                            $("#ChargeMealDlg").dialog("close");
                            LoadList();
                        }
                    },
                    function completeCallback() {
                    },
                    function errorCallback() {

                    });
            }
            //添加_25944
            function SaveMeals25944() {
                var row = $('#TableContainer').datagrid("getSelected");
                var SourceType = $('#SourceType').combobox('getValue');
                if (SourceType == 'GetBangDao_ParkRenewHand' && row.HandID == "") {
                    HDialog.Info("该条数据的办理信息为空无法推送!");
                    return;
                }
                $("#ChargeMealDlg").dialog("close");
             
                if (SourceType == "") {
                    HDialog.Info("请选择所加类型!");
                    return;
                }
                var param = {};
                var Contter = "";
                param = { SourceType: SourceType, HandID: row.HandID, ParkID: row.ParkID, CommID: row.CommID }
                $.tool.DataPost('BangDao_Park', SourceType, $.param(param),
                    function Init() {
                    },
                    function callback(_Data) {
                        var data = JSON.parse(_Data);
                        if (data.result) {
                            parent.layer.alert('保存成功');
                            $("#ChargeMealDlg").dialog("close");
                            LoadList();
                        }
                    },
                    function completeCallback() {
                    },
                    function errorCallback() {

                    });
            }

            function LoadList() {
                $("#TableContainer").datagrid({
                    url: '/HM/M_Main/HC/DataGetControl.aspx?Method=DataGet&Class=BangDao_Park&Command=GetBangDao_ParkList&' + $('#FrmForm').serialize(),
                    method: "get",
                    loadMsg: '数据加载中,请稍候...',
                    nowrap: false,
                    pageSize: top.ListPageSize,
                    pageList: top.ListPageList,
                    columns: Column,
                    fitColumns: false,
                    singleSelect: true,
                    border: false,
                    pagination: true,
                    rownumbers: true,
                    width: "100%",
                    //toolbar: toolbar,
                    sortOrder: "asc",
                    onClickRow: function (rowIndex, rowData) {
                        $("#SelParkID").val(rowData.ParkID);
                        $("#SelTaskCode").val("-1");
                        LoadTaskList();
                        LoadTaskLogList();
                    },
                    onLoadSuccess: function (data) {

                    }
                });
            }

            //任务单信息
            var Column_Task = [[

                { field: 'ParkCode', title: '车场编码', width: 120, align: 'left', sortable: true },
                { field: 'ServiceType', title: '业务类型', width: 120, align: 'left', sortable: true },
                {
                    field: 'SourceType', title: '推送方式', width: 120, align: 'left', sortable: true,
                    formatter: function (value, row, index) {
                        var tye = "自动";
                        if (row.SourceType == "1") { tye = "手动"; }
                        return tye;
                    }
                },
                {
                    field: 'IsPush', title: '是否开启推送', width: 120, align: 'left', sortable: true,
                    formatter: function (value, row, index) {
                        var tye = "否";
                        if (row.IsPush == "1") { tye = "是"; }
                        return tye;
                    }
                },
                {
                    field: 'IsSuccess', title: '是否成功', width: 80, align: 'left', sortable: true,
                    formatter: function (value, row, index) {
                        var tye = "否";
                        if (row.IsSuccess == "1") { tye = "是"; }
                        return tye;
                    }
                },
                { field: 'PushCount', title: '推送次数', width: 120, align: 'left', sortable: true },
                { field: 'AddTime', title: '添加时间', width: 120, align: 'left', sortable: true },
                { field: 'LastLogTime', title: '上次推送时间', width: 120, align: 'left', sortable: true },
                { field: 'Remarks', title: '备注', width: 200, align: 'left', sortable: true },

               // { field: 'OperateUserName', title: '操作人', width: 120, align: 'left', sortable: true },
                { field: 'TaskID', title: '唯一请求码', width: 300, align: 'left', sortable: true },
            ]];
            //任务列表
            function LoadTaskList() {
                var parkId = $("#SelParkID").val();
                $("#Task_TableContainer").datagrid({
                    url: '/HM/M_Main/HC/DataGetControl.aspx?Method=DataGet&Class=BangDao_Park&Command=GetBangDao_ParkTaskList&SelParkID=' + parkId,
                    method: "get",
                    loadMsg: '数据加载中,请稍候...',
                    nowrap: false,
                    pageSize: top.ListPageSize,
                    pageList: top.ListPageList,
                    columns: Column_Task,
                    fitColumns: false,
                    singleSelect: true,
                    border: false,
                    pagination: true,
                    rownumbers: true,
                    width: "100%",
                    sortOrder: "asc",
                    onClickRow: function (rowIndex, rowData) {
                        $("#SelTaskCode").val(rowData.TaskID);
                        LoadTaskLogList();
                    },
                    onLoadSuccess: function (data) {

                    }
                });
            }


            //任务单日志
            var Column_Task_Log = [[
                { field: 'RequestDescribe', title: '请求描述', width: 200, align: 'left', sortable: true },
                {
                    field: 'IsSuccess', title: '是否成功', width: 80, align: 'left', sortable: true,
                    formatter: function (value, row, index) {
                        var tye = "否";
                        if (row.IsSuccess == "1") { tye = "是"; }
                        return tye;
                    }
                },
                { field: 'ResultDescribe', title: '反参描述', width: 300, align: 'left', sortable: true },
                { field: 'ResultExample', title: '返回参数', width: 300, align: 'left', sortable: true },
                { field: 'CarryTime', title: '执行时间', width: 120, align: 'left', sortable: true },
                { field: 'RequestTime', title: '添加时间', width: 120, align: 'left', sortable: true },
                { field: 'ResultTime', title: '响应时间', width: 120, align: 'left', sortable: true },
                //{ field: 'ResultSecond', title: '耗时', width: 120, align: 'left', sortable: true }
            ]];

            //任务列表
            function LoadTaskLogList() {
                var TaskCode = $("#SelTaskCode").val();
                $("#TaskLog_TableContainer").datagrid({
                    url: '/HM/M_Main/HC/DataGetControl.aspx?Method=DataGet&Class=BangDao_Park&Command=GetBangDao_ParkTaskLogList&SelTaskCode=' + TaskCode,
                    method: "get",
                    loadMsg: '数据加载中,请稍候...',
                    nowrap: false,
                    pageSize: top.ListPageSize,
                    pageList: top.ListPageList,
                    columns: Column_Task_Log,
                    fitColumns: false,
                    singleSelect: true,
                    border: false,
                    pagination: true,
                    rownumbers: true,
                    width: "100%",
                    sortOrder: "asc",
                    onClickRow: function (rowIndex, rowData) {
                    },
                    onLoadSuccess: function (data) {

                    }
                });
            }
        </script>
    </form>
</body>
</html>
