226 lines
9.5 KiB
C#
226 lines
9.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using System.Data;
|
|
using System.Data.SqlClient;
|
|
using DataLinkMesWork;
|
|
using System.Security.Cryptography;
|
|
//using SystemFramework;
|
|
|
|
namespace bizFacade
|
|
{
|
|
public class Buttons
|
|
{
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="dt"></param>
|
|
/// <returns></returns>
|
|
public static string Createbuttons(DataTable dt)//相当于在该DIV内动态画table
|
|
{
|
|
StringBuilder sb = new StringBuilder();//动态分配长度
|
|
if (dt != null)
|
|
{
|
|
if (dt.Rows.Count > 0)
|
|
{
|
|
sb.Append("<table style=\"width:100%;height:100%\"><tr>");
|
|
for (int i = 0; i < dt.Rows.Count; i++)
|
|
{
|
|
//标签id
|
|
string id = "button_OPs" + dt.Rows[i]["工位号"].ToString();
|
|
|
|
//标签类型
|
|
string type = "button";
|
|
|
|
//标签样式
|
|
string style = "height:98%;width:98%;font-family:微软雅黑;font-size:15px;border-color: #99CCFF";
|
|
|
|
string style_td = "width:20%; height:35px";
|
|
|
|
//标签值
|
|
string value = dt.Rows[i]["工位号"].ToString();
|
|
|
|
//标签点击事件
|
|
string onclick = "QualityDataSelect(value)";
|
|
|
|
string bgc = "background-color: #CCCCCC";//默认按钮背景色
|
|
if (dt.Rows[i]["合格标志"].ToString() == "NOK")
|
|
{
|
|
bgc = "background-color: red";
|
|
}
|
|
else if (dt.Rows[i]["合格标志"].ToString() == "OK")
|
|
{
|
|
bgc = "background-color: green";
|
|
}
|
|
else
|
|
{
|
|
bgc = "background-color: #CCCCCC";
|
|
}
|
|
//对行按钮数进行处理,保证五个换行
|
|
if (i % 4 == 3)
|
|
{
|
|
|
|
sb.Append("<td style=\"" + style_td + "\"><input id=\"" + id + "\" type=\"" + type + "\" style=\"" + style + ";" + bgc + "\" value=\"" + value + "\" onclick=\"" + onclick + "\" /></td>");
|
|
sb.Append("</tr>\r\n<tr>");
|
|
}
|
|
else
|
|
{
|
|
sb.Append("<td style=\"" + style_td + "\"><input id=\"" + id + "\" type=\"" + type + "\" style=\"" + style + ";" + bgc + "\" value=\"" + value + "\" onclick=\"" + onclick + "\" /></td>");
|
|
}
|
|
}
|
|
sb.Append("</tr></table>");
|
|
}
|
|
}
|
|
return sb.ToString();
|
|
}
|
|
|
|
public static string CreateNewbuttons(DataTable dt)//相当于在该DIV内动态画table
|
|
{
|
|
StringBuilder sb = new StringBuilder();//动态分配长度
|
|
if (dt != null)
|
|
{
|
|
if (dt.Rows.Count > 0)
|
|
{
|
|
sb.Append("<table style=\"width:100%;height:100%\"><tr>");
|
|
for (int i = 0; i < dt.Rows.Count; i++)
|
|
{
|
|
//标签id
|
|
string id = "button_OPs" + dt.Rows[i]["工位号"].ToString();
|
|
|
|
//标签类型
|
|
string type = "button";
|
|
|
|
//标签样式
|
|
string style = "height:98%;width:98%;font-family:微软雅黑;font-size:15px;border-color: #99CCFF";
|
|
|
|
string style_td = "width:15%; height:30px";
|
|
|
|
//标签值
|
|
string value = dt.Rows[i]["工位号"].ToString();
|
|
|
|
//标签点击事件
|
|
string onclick = "QualityDataSelect(value)";
|
|
|
|
string bgc = "background-color: #CCCCCC";//默认按钮背景色
|
|
if (dt.Rows[i]["合格标志"].ToString() == "NOK")
|
|
{
|
|
bgc = "background-color: red";
|
|
}
|
|
else if (dt.Rows[i]["合格标志"].ToString() == "OK")
|
|
{
|
|
bgc = "background-color: green";
|
|
}
|
|
else
|
|
{
|
|
bgc = "background-color: #CCCCCC";
|
|
}
|
|
//对行按钮数进行处理,保证五个换行
|
|
if (i % 5 == 4)
|
|
{
|
|
|
|
sb.Append("<td style=\"" + style_td + "\"><input id=\"" + id + "\" type=\"" + type + "\" style=\"" + style + ";" + bgc + "\" value=\"" + value + "\" onclick=\"" + onclick + "\" /></td>");
|
|
sb.Append("</tr>\r\n<tr>");
|
|
}
|
|
else
|
|
{
|
|
sb.Append("<td style=\"" + style_td + "\"><input id=\"" + id + "\" type=\"" + type + "\" style=\"" + style + ";" + bgc + "\" value=\"" + value + "\" onclick=\"" + onclick + "\" /></td>");
|
|
}
|
|
}
|
|
sb.Append("</tr></table>");
|
|
}
|
|
}
|
|
return sb.ToString();
|
|
}
|
|
/// <summary>
|
|
/// 物料原因模块按钮创建
|
|
/// </summary>
|
|
/// <param name="dt"></param>
|
|
/// <returns></returns>
|
|
public static string CreateMaterialsButtons(DataTable dt)
|
|
{
|
|
StringBuilder sb = new StringBuilder();
|
|
if (dt != null)
|
|
{
|
|
if (dt.Rows.Count > 0)
|
|
{
|
|
sb.Append("<table style=\"width: 1000px\" ><tr style=\"height: 150px\">");
|
|
for (int i = 0; i < dt.Rows.Count; i++)
|
|
{
|
|
string id = (string)dt.Rows[i]["id"];
|
|
string type = (string)dt.Rows[i]["type"];
|
|
string style = (string)dt.Rows[i]["style"];
|
|
string value = (string)dt.Rows[i]["零件名称"];
|
|
string onclick = (string)dt.Rows[i]["onclick"];
|
|
string bgc = "";//默认按钮背景色
|
|
sb.Append("<td><button id=\"" + id + "\" onclick=\"" + onclick + "\" value=\"" + value + "\" style=\"" + style + ";" + bgc + "\"><font size=\"5px\"> " + value + " </font></button></td>");
|
|
}
|
|
sb.Append("</tr></table>");
|
|
}
|
|
}
|
|
return sb.ToString();
|
|
}
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="dt"></param>
|
|
/// <returns></returns>
|
|
public static string Createbuttons_alert(DataTable dt)//相当于在该DIV内动态画table
|
|
{
|
|
StringBuilder sb = new StringBuilder();//动态分配长度
|
|
if (dt != null)
|
|
{
|
|
if (dt.Rows.Count > 0)
|
|
{
|
|
sb.Append("<table style=\"width:100%;\" cellpadding='0' cellspacing='0'><tr>");
|
|
for (int i = 0; i < dt.Rows.Count; i++)
|
|
{
|
|
//标签id
|
|
string id = "button_OPs" + dt.Rows[i]["工位号"].ToString();
|
|
|
|
//标签类型
|
|
string type = "button";
|
|
|
|
//标签样式
|
|
string style = "height:40px;line-height:35px;width:98%;font-family:'微软雅黑';font-size:15px;border-color:#99CCFF";
|
|
|
|
string style_td = "width:20%; height:35px";
|
|
|
|
//标签值
|
|
string value = dt.Rows[i]["工位号"].ToString();
|
|
|
|
//标签点击事件
|
|
string onclick = "QualityDataSelect_alert(value)";
|
|
|
|
string bgc = "background-color: #CCCCCC";//默认按钮背景色
|
|
if (dt.Rows[i]["合格标志"].ToString() == "NOK")
|
|
{
|
|
bgc = "background-color: red";
|
|
}
|
|
else if (dt.Rows[i]["合格标志"].ToString() == "OK")
|
|
{
|
|
bgc = "background-color: green";
|
|
}
|
|
else
|
|
{
|
|
bgc = "background-color: #CCCCCC";
|
|
}
|
|
//对行按钮数进行处理,保证五个换行
|
|
if (i % 4 == 3)
|
|
{
|
|
|
|
sb.Append("<td style=\"" + style_td + "\"><input id=\"" + id + "\" type=\"" + type + "\" style=\"" + style + ";" + bgc + "\" value=\"" + value + "\" onclick=\"" + onclick + "\" /></td>");
|
|
sb.Append("</tr>\r\n<tr>");
|
|
}
|
|
else
|
|
{
|
|
sb.Append("<td style=\"" + style_td + "\"><input id=\"" + id + "\" type=\"" + type + "\" style=\"" + style + ";" + bgc + "\" value=\"" + value + "\" onclick=\"" + onclick + "\" /></td>");
|
|
}
|
|
}
|
|
sb.Append("</tr></table>");
|
|
}
|
|
}
|
|
return sb.ToString();
|
|
}
|
|
}
|
|
}
|