Example #1
0
        /// <summary>
        /// 獲取記錄頁數
        /// </summary>
        /// <param name="viewMode">視圖模式</param>
        /// <returns></returns>
        private int GetTotalPageQty(EnmViewMode viewMode)
        {
            int iRecQty = 0;
            List<MachineRealtimeSummary> listSummary = GetMachineRealtimeSummaryList();
            if (listSummary != null)
            {
                iRecQty = listSummary.Count;
            }

            int iMaxQtyPerPage = GetMaxQtyPerPage(viewMode);

            int iTotalPageQty = iRecQty / iMaxQtyPerPage;

            if (iRecQty % iMaxQtyPerPage != 0)
            {
                iTotalPageQty++;
            }

            return iTotalPageQty;
        }
Example #2
0
        /// <summary>
        /// 獲取指定的實時生產數據的HTML內容
        /// </summary>
        /// <param name="MacSummary">機台實時生產數據記錄</param>
        /// <param name="viewMode">顯示模式</param>
        /// <param name="iTableWidth">信息表格寬度</param>
        /// <param name="iTableHeight">信息表格高度</param>
        /// <returns></returns>
        private string GetSummaryViewHtmlStr(MachineRealtimeSummary MacSummary, EnmViewMode viewMode, out int iTableWidth, out int iTableHeight)
        {
            iTableWidth = 0;
            iTableHeight = 0;

            if (MacSummary == null)
            {
                return string.Empty;
            }
            if (string.IsNullOrEmpty(MacSummary.MachineNO))
            {
                return string.Empty;
            }

            string strMacStatus = MacSummary.MachineStatus;//機台狀態
            string strMacNo = MacSummary.MachineNO.Trim();//機台編號
            string strMacName = MacSummary.MachineName;//機台名稱
            string strCssType = GetSummaryViewCss(MacSummary.MachineStatusCode);//樣式名稱
            string strItemName = "無任務";//生產內容
            string strBeginTime = string.Empty;//工程開始時間
            string strBeginTimeSpan = string.Empty;//工程開始持續時間
            string strLastTimeSpan = string.Empty;//當前狀態持續時間

            int iSubFormWidth = 0;
            int iSubFormHeight = 0;

            if (!string.IsNullOrEmpty(MacSummary.ItemName))
            {
                strItemName = MacSummary.ItemName.Trim();
            }

            if (MacSummary.ProjBeginTime != null)
            {
                strBeginTime = MacSummary.ProjBeginTimeDesc;
                strBeginTimeSpan = Common.Util.DateUtil.Convert((DateTime.Now - MacSummary.ProjBeginTime.Value).TotalSeconds);
            }
            else
            {
                strBeginTimeSpan = "未知";
            }

            if (MacSummary.StatusChangeTime != null)
            {
                strLastTimeSpan = Common.Util.DateUtil.Convert((DateTime.Now - MacSummary.StatusChangeTime.Value).TotalSeconds);
            }
            else
            {
                strLastTimeSpan = "未知";
            }

            string strTbHTML = string.Empty;
            strTbHTML = "<table class='tbMainProfile'  ' cellpadding='0' cellspacing='0' ";

            if (viewMode == EnmViewMode.SmallView)
            {
                iSubFormWidth = 600;
                iSubFormHeight = 480;

                iTableWidth = DataConverter.GetSmallViewTableWidth();
                iTableHeight = DataConverter.GetSmallViewTableHeight();

                string strJS = GetJSScript_OpenPage(strMacName, "MacInfoDetail.aspx?MacNo=" + strMacNo, iSubFormWidth, iSubFormHeight);

                strTbHTML += " width='" + iTableWidth.ToString() + "px' >";
                strTbHTML += "<tr><td align='center' class='tdMacNo' onclick='" + strJS + "'>" + strMacNo + "</td></tr>";
                strTbHTML += "<tr><td align='center'>";
                strTbHTML += "<table cellpadding='0' cellspacing='0' class='" + strCssType + "' ";
                strTbHTML += " height='" + iTableHeight.ToString() + "px'";
                strTbHTML += " style='font-size: 14.25px;color:blue;'' width='100%'>";
                strTbHTML += "<tr align='center'><td>" + strMacStatus + "</td></tr>";
                strTbHTML += "<tr align='center'><td>" + strLastTimeSpan + "</td></tr>";
                strTbHTML += "</table></td></tr>";
            }
            else if (viewMode == EnmViewMode.LargeView)
            {
                iSubFormWidth = 600;
                iSubFormHeight = 620;

                iTableWidth = DataConverter.GetLargeViewTableWidth();
                iTableHeight = DataConverter.GetLargeViewTableHeight();

                string strJS = GetJSScript_OpenPage(strMacName, "MacSummaryView.aspx?MacNo=" + strMacNo, iSubFormWidth, iSubFormHeight);

                strTbHTML += " width='" + iTableWidth.ToString() + "px' >";
                strTbHTML += "<tr align='center'><td class='tdMacNo' onclick='" + strJS + "'>" + MacSummary.MachineName.Trim() + "(" + strMacNo + ")</td></tr>";
                strTbHTML += "<tr align='center'><td><table cellpadding='0' cellspacing='0' class='" + strCssType + "' ";
                strTbHTML += " height='" + iTableHeight.ToString() + "px'";
                strTbHTML += " style='font-size: 14.25px;color:blue;'' width='100%'>";
                strTbHTML += "<tr><td align='right' style='width:25%;'>工程開始&nbsp;&nbsp;</td><td align='left'>" + strBeginTime + "</td></tr>";
                strTbHTML += "<tr><td align='right'>工程單編號&nbsp;&nbsp;</td><td align='left'>" + MacSummary.SONo + "</td></tr>";
                strTbHTML += "<tr><td align='right'>印張編號&nbsp;&nbsp;</td><td align='left'>" + MacSummary.ItemNo + "</td></tr>";
                strTbHTML += "<tr><td align='right'>生產數量&nbsp;&nbsp;</td><td align='left'>" + MacSummary.ProdActualQty.ToString() + "/" + MacSummary.PlanProdQty.ToString() + "</td></tr>";//現時數量/要求生產數量
                strTbHTML += "<tr><td align='right'>狀態時間&nbsp;&nbsp;</td><td align='left'>" + strMacStatus + "/" + strBeginTimeSpan + "</td></tr>";//現時狀態/該狀態從工程開始至目前為止累計的分鐘數
                strTbHTML += "<tr><td align='right'>產品名稱&nbsp;&nbsp;</td><td align='left'>" + MacSummary.ProdName + "</td></tr>";
                strTbHTML += "<tr><td align='right'>產品內容&nbsp;&nbsp;</td><td align='left'>" + strItemName + "</td></tr>";
                strTbHTML += "<tr><td align='right'>持續時間&nbsp;&nbsp;</td><td align='left'>" + strLastTimeSpan + "</td></tr>";//例如停機發生多次,只顯示今次發生的狀態到今刻的時間
                strTbHTML += "</table></td></tr>";
            }
            strTbHTML += "</table>";

            return strTbHTML;
        }
Example #3
0
 /// <summary>
 /// 獲取單條記錄的信息表格高度
 /// </summary>
 /// <param name="viewMode">視圖模式</param>
 /// <returns></returns>
 private int GetPerTableHeight(EnmViewMode viewMode)
 {
     int iPerTableHeght = 0;
     switch (viewMode)
     {
         case EnmViewMode.SmallView:
             iPerTableHeght = DataConverter.GetSmallViewTableHeight();
             break;
         case EnmViewMode.LargeView:
             iPerTableHeght = DataConverter.GetLargeViewTableHeight();
             break;
         default:
             break;
     }
     if (iPerTableHeght == 0)//防止除數為零
     {
         iPerTableHeght = 50;
     }
     return iPerTableHeght;
 }
Example #4
0
 /// <summary>
 /// 獲取單條記錄的信息表格寬度
 /// </summary>
 /// <param name="viewMode">視圖模式</param>
 /// <returns></returns>
 private int GetPerTableWidth(EnmViewMode viewMode)
 {
     int iPerTableWidth = 0;
     switch (viewMode)
     {
         case EnmViewMode.SmallView:
             iPerTableWidth = DataConverter.GetSmallViewTableWidth();
             break;
         case EnmViewMode.LargeView:
             iPerTableWidth = DataConverter.GetLargeViewTableWidth();
             break;
         default:
             break;
     }
     if (iPerTableWidth == 0)//防止除數為零
     {
         iPerTableWidth = 150;
     }
     return iPerTableWidth;
 }
Example #5
0
        /// <summary>
        /// 獲取每頁可顯示的記錄最大數量
        /// </summary>
        /// <param name="viewMode">視圖模式</param>
        /// <returns></returns>
        private int GetMaxQtyPerPage(EnmViewMode viewMode)
        {
            int iMaxQtyPerPage = 0;

            switch (viewMode)
            {
                case EnmViewMode.SmallView:
                    iMaxQtyPerPage = DataConverter.GetSmallViewQtyPerPage();
                    break;
                case EnmViewMode.LargeView:
                    iMaxQtyPerPage = DataConverter.GetLargeViewQtyPerPage();
                    break;
                default:
                    break;
            }

            return iMaxQtyPerPage;
        }