<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/AppMaster.Master"
    Inherits="System.Web.Mvc.ViewPage<QMAPP.FJC.Web.Models.FIS.DashBoardPlanModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    仪表板订单生产计划列表
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <%=Html.QPSeach(110,true) %>
    <table id="condiTable">
        <tr>
            <th align="right">
                <%=Html.QV(p => p.PLAN_NO)%>
            </th>
            <td>
                <%=Html.QC(p => p.PLAN_NO)%>
            </td>
            <th align="right">
                <%=Html.QV(p => p.FACTORY_CODE)%>
            </th>
            <td>
                <%=Html.QC(p => p.FACTORY_CODE)%>
            </td>
            
            <th align="right">
                <%=Html.QV(p => p.MATERIAL_CODE)%>
            </th>
            <td>
                <%=Html.QC(p => p.MATERIAL_CODE)%>
            </td>
        </tr>
        <tr>
            <th align="right">
                <%=Html.QV(p => p.PLANTIMESTART)%>
            </th>
            <td>
                <%=Html.QC(p => p.PLANTIMESTART)%>
            </td>
            <th align="right">
                <%=Html.QV(p => p.PLANTIMEEND)%>
            </th>
            <td>
                <%=Html.QC(p => p.PLANTIMEEND)%>
            </td>
            <th align="right">
                <%=Html.QV(p => p.SHIFT_CODE)%>
            </th>
            <td>
                <%=Html.QC(p => p.SHIFT_CODE)%>
            </td>
        </tr>
    </table>
    <%=Html.QPEnd()%>
    <%=Html.QPList() %>
    <%=Html.QDateGrid<QMAPP.FJC.Web.Models.FIS.DashBoardPlanModel>(Model)%>
    <%=Html.QPEnd() %>
    <%=Html.Hidden("selectKey")%>
    <%=Html.Hidden("fileName")%>
    <%=Html.Hidden("ORDER_TYPE")%>
    <script language="javascript" type="text/javascript">
        $(function () {
            var type = document.getElementById("ORDER_TYPE").value;
            //获取物料下拉数据源
           $('#MATERIAL_CODE').combotree({
                panelHeight: '250',
                panelWidth: '500',
                url: "/Dict/GetFisMaterialTree?ordertype=" + type,
            });
            List(1);
        });
        //添加
        function Add() {
            var type = document.getElementById("ORDER_TYPE").value;
            openAppWindow1('信息添加', 'Edit?ORDER_TYPE=' + type, '450', '380');
        }
        //修改
        function Update() {
            var ids = getSelectKey();
            if (ids == "") {
                MSI("提示", "请选择修改记录。");
                return;
            }
            if (ids.indexOf(":") > 0) {
                MSI("提示", "每次只能修改一条记录。");
                return;
            }
            var type = $("#ORDER_TYPE").val();
            document.getElementById("selectKey").value = ids;
            openAppWindow1('修改', 'Edit?PID=' + ids + '&ORDER_TYPE=' + type, '350', '380');
        }
        //删除
        function Delete() {
            var ids = getSelectKey();
            if (ids == "") {
                MSI("错误", "至少选择一条记录");
            }
            else {
                document.getElementById("selectKey").value = ids;
                MSQ("提示", "确定要删除选中的记录吗?", function () {
                    submitByButton("Delete");
                })
            }
        }
        //导入
        function Import() {
            var fileName = window.showModalDialog("/File/UploadFile", "", "dialogHeight: 200px; dialogWidth: 300px; center: Yes; help: Yes;status: Yes;");
            if (fileName == null)
                return;
            document.getElementById("fileName").value = fileName;
            //处理等待
            submitByButton("ImportExcel");
        }
        //导出
        function Export() {
            document.getElementById("selectKey").value = getSelectKey();
            submitByButton("ExportExcel");
        }
        //下载模板
        function getTemplate() {
            submitByButton("GetTemplate");
        }

        //查询
        function Search() {
            var endtime = document.getElementById("PLANTIMEEND").value;
            if (parseDate($("#PLANTIMESTART").val()) > parseDate($("#PLANTIMEEND").val()) && endtime != "") {
                alert("开始时间不能大于结束时间!");
                return;
            }
            List(1)
        }
        //发布
        function Publish() {
            var ids = getSelectKey();
            if (ids == "") {
                MSI("错误", "至少选择一条记录");
            }
            else {
                document.getElementById("selectKey").value = ids;
                MSQ("提示", "确定要发布选中的记录吗?", function () {
                    submitByButton("PutOut");
                })
            }
        }

                //修改计划顺序
        function EditDashBoardPlanSeq() {
          var ids = getSelectKey();
            if (ids == "") {
                MSI("错误", "至少选择一条记录");
                return;
            }
          document.getElementById("selectKey").value = ids;
          var type = document.getElementById("ORDER_TYPE").value;
          openAppWindow1('修改门板计划顺序号', 'DashBoardEditSeq?PIDList=' + ids+ "&ORDER_TYPE=" + type, '690', '400');
        }
        $(function () {

            $('#FACTORY_CODE').combobox({
                panelWidth: '350'

            });

        });

    </script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ToolContent" runat="server">
    <table cellpadding="0" cellspacing="0">
        <tr>
            <td align="center">
                <%=Html.QTButtonSearch("DashBoardPlan", "List", "Search()", QMAPP.Common.Web.SystemLimit.isLimt)%>
                <%=Html.QTButtonAdd("DashBoardPlan", "Add", "Add()", QMAPP.Common.Web.SystemLimit.isLimt)%>
                <%=Html.QTButtonUpdate("DashBoardPlan", "Edit", "Update()", QMAPP.Common.Web.SystemLimit.isLimt)%>
                <%=Html.QTButton("EditSeq", "EditDashBoardPlanSeq", QMFrameWork.WebUI.IconCls.edit, "EditDashBoardPlanSeq()", QMAPP.Common.Web.SystemLimit.isLimt)%> 
                <%=Html.QTButtonDelete("DashBoardPlan", "Delete", "Delete()", QMAPP.Common.Web.SystemLimit.isLimt)%>
                <%=Html.QTButton("publish", "PutOut", "detail", "Publish()", QMAPP.Common.Web.SystemLimit.isLimt)%>
                <%=Html.QTButton("import", "ImportExcel", QMFrameWork.WebUI.IconCls.undo, "Import()", QMAPP.Common.Web.SystemLimit.isLimt)%>
                <%=Html.QTButton("export", "ExportExcel", QMFrameWork.WebUI.IconCls.redo, "Export()", QMAPP.Common.Web.SystemLimit.isLimt)%>
                <%=Html.QTButton("template", "TemplateExcel", QMFrameWork.WebUI.IconCls.template, "getTemplate()", QMAPP.Common.Web.SystemLimit.isLimt)%>
            </td>
        </tr>
    </table>
</asp:Content>