You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
234 lines
9.1 KiB
234 lines
9.1 KiB
3 years ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.ComponentModel;
|
||
|
using System.Data;
|
||
|
using System.Drawing;
|
||
|
using System.Linq;
|
||
|
using System.Text;
|
||
|
using System.Windows.Forms;
|
||
|
using Stone.Common;
|
||
|
using System.IO;
|
||
|
using Stone.Entity;
|
||
|
using mshtml;
|
||
|
|
||
|
namespace Stone.WinModule.AssembleAdmin
|
||
|
{
|
||
|
public partial class frmSortView : Form
|
||
|
{
|
||
|
private int UpdateTime = Convert.ToInt32(MyAppconfig.ReadValue("看板刷新时间"));
|
||
|
private int RowsCount = Convert.ToInt32(MyAppconfig.ReadValue("装配零件信息显示行数"));
|
||
|
private string PackageGroupName = MyAppconfig.ReadValue("JIS扫描打印类型");
|
||
|
private int PackageQty = Convert.ToInt32(MyAppconfig.ReadValue("JIS扫描打印装箱数"));
|
||
|
|
||
|
private IHTMLDocument3 doc3 = null;
|
||
|
|
||
|
public frmSortView()
|
||
|
{
|
||
|
InitializeComponent();
|
||
|
}
|
||
|
|
||
|
private void frmSortView_Load(object sender, EventArgs e)
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
InitHtml();
|
||
|
|
||
|
Control.CheckForIllegalCrossThreadCalls = false;
|
||
|
|
||
|
string filename = Application.StartupPath + "\\html\\01.html";
|
||
|
|
||
|
this.webBrowser1.Navigate(filename);
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
MyMessageBox.ShowMessagePop(ex.Message);
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
private void timer1_Tick(object sender, EventArgs e)
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
|
||
|
doc3.getElementById("lblTB1").innerHTML = UpdateTB1();
|
||
|
doc3.getElementById("lblTB2").innerHTML = UpdateTB2();
|
||
|
doc3.getElementById("lblTB3").innerHTML = UpdateTB3();
|
||
|
|
||
|
|
||
|
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
MyMessageBox.ShowMessagePop(ex.Message);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
#region 初始化html模块
|
||
|
|
||
|
private string html_tb1 = "";
|
||
|
private string html_tb2 = "";
|
||
|
private string html_tb3 = "";
|
||
|
|
||
|
private void InitHtml()
|
||
|
{
|
||
|
string path = Application.StartupPath + "\\html";
|
||
|
html_tb1 = ReadFile(path + "\\01_tb1.html");
|
||
|
html_tb2 = ReadFile(path + "\\01_tb2.html");
|
||
|
html_tb3 = ReadFile(path + "\\01_tb3.html");
|
||
|
|
||
|
}
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
private string ReadFile(string filename)
|
||
|
{
|
||
|
string ret = "";
|
||
|
|
||
|
StreamReader sr = new StreamReader(filename, Encoding.UTF8);
|
||
|
ret = sr.ReadToEnd();
|
||
|
sr.Close();
|
||
|
|
||
|
return ret;
|
||
|
}
|
||
|
|
||
|
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
IHTMLDocument2 doc2 = (IHTMLDocument2)this.webBrowser1.Document.DomDocument;
|
||
|
doc3 = (IHTMLDocument3)doc2;
|
||
|
|
||
|
this.timer1.Interval = UpdateTime;
|
||
|
this.timer1.Enabled = true;
|
||
|
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
MyMessageBox.ShowMessagePop(ex.Message);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private string UpdateTB1()
|
||
|
{
|
||
|
string ret = html_tb1;
|
||
|
|
||
|
Entity_t_JIS_Seq5000 t_JIS_Seq5000 = new Entity_t_JIS_Seq5000();
|
||
|
|
||
|
DataSet dsData = t_JIS_Seq5000.GetData("top " + PackageQty + " ID, [SequenceNumber], CheckSequence, OrderNumber, partNumber, PartName, SwetTime, IsPrintAssemble, IsTransport, PartsFamily, supplyGroup", "IsPrintPackingList=0 and PackageGroupName='" + PackageGroupName + "'", "[SequenceNumber] asc, [SwetTime] asc");
|
||
|
|
||
|
DataRow[] drs = dsData.Tables[0].Select("1=1", "[SequenceNumber] desc, [SwetTime] desc");
|
||
|
|
||
|
if (drs.Length > 0)
|
||
|
{
|
||
|
for (int i = 1; i <= RowsCount; i++)
|
||
|
{
|
||
|
ret = (i - 1) < drs.Length ? ret.Replace("{tb1_rows" + i + "_col1}", drs[i - 1]["CheckSequence"].ToString()) : ret.Replace("{tb1_rows" + i + "_col1}", " ");
|
||
|
ret = (i - 1) < drs.Length ? ret.Replace("{tb1_rows" + i + "_col2}", drs[i - 1]["OrderNumber"].ToString()) : ret.Replace("{tb1_rows" + i + "_col2}", " ");
|
||
|
ret = (i - 1) < drs.Length ? ret.Replace("{tb1_rows" + i + "_col3}", drs[i - 1]["partNumber"].ToString()) : ret.Replace("{tb1_rows" + i + "_col3}", " ");
|
||
|
ret = (i - 1) < drs.Length ? ret.Replace("{tb1_rows" + i + "_col4}", drs[i - 1]["PartName"].ToString()) : ret.Replace("{tb1_rows" + i + "_col4}", " ");
|
||
|
ret = (i - 1) < drs.Length ? ret.Replace("{tb1_rows" + i + "_col5}", drs[i - 1]["SwetTime"].ToString()) : ret.Replace("{tb1_rows" + i + "_col5}", " ");
|
||
|
ret = (i - 1) < drs.Length ? ret.Replace("{tb1_rows" + i + "_col6}", Convert.ToBoolean(drs[i - 1]["IsPrintAssemble"]) ? "是" : "") : ret.Replace("{tb1_rows" + i + "_col6}", " ");
|
||
|
ret = (i - 1) < drs.Length ? ret.Replace("{tb1_rows" + i + "_col7}", Convert.ToBoolean(drs[i - 1]["IsTransport"]) ? "是" : "") : ret.Replace("{tb1_rows" + i + "_col7}", " ");
|
||
|
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
for (int i = 1; i <= RowsCount; i++)
|
||
|
{
|
||
|
ret = ret.Replace("{tb1_rows" + i + "_col1}", " ");
|
||
|
ret = ret.Replace("{tb1_rows" + i + "_col2}", " ");
|
||
|
ret = ret.Replace("{tb1_rows" + i + "_col3}", " ");
|
||
|
ret = ret.Replace("{tb1_rows" + i + "_col4}", " ");
|
||
|
ret = ret.Replace("{tb1_rows" + i + "_col5}", " ");
|
||
|
ret = ret.Replace("{tb1_rows" + i + "_col6}", " ");
|
||
|
ret = ret.Replace("{tb1_rows" + i + "_col7}", " ");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return ret;
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
private string UpdateTB2()
|
||
|
{
|
||
|
string ret = html_tb2;
|
||
|
|
||
|
Entity_t_JIS_Seq5000_ReOrder t_JIS_Seq5000_ReOrder = new Entity_t_JIS_Seq5000_ReOrder();
|
||
|
DataSet dsReOrder = t_JIS_Seq5000_ReOrder.GetData("ID, OrderNumber, partNumber, PartName, SwetTime", "IsPrintAssemble=0 and PackageGroupName='" + PackageGroupName + "'", "[SwetTime] asc");
|
||
|
|
||
|
DataRow[] drs = dsReOrder.Tables[0].Select("1=1");
|
||
|
|
||
|
if (drs.Length > 0)
|
||
|
{
|
||
|
for (int i = 1; i <= 2; i++)
|
||
|
{
|
||
|
ret = (i - 1) < drs.Length ? ret.Replace("{tb2_rows" + i + "_col1}", drs[i - 1]["OrderNumber"].ToString()) : ret.Replace("{tb2_rows" + i + "_col1}", " ");
|
||
|
ret = (i - 1) < drs.Length ? ret.Replace("{tb2_rows" + i + "_col2}", drs[i - 1]["partNumber"].ToString()) : ret.Replace("{tb2_rows" + i + "_col2}", " ");
|
||
|
ret = (i - 1) < drs.Length ? ret.Replace("{tb2_rows" + i + "_col3}", drs[i - 1]["PartName"].ToString()) : ret.Replace("{tb2_rows" + i + "_col3}", " ");
|
||
|
ret = (i - 1) < drs.Length ? ret.Replace("{tb2_rows" + i + "_col4}", drs[i - 1]["SwetTime"].ToString()) : ret.Replace("{tb2_rows" + i + "_col4}", " ");
|
||
|
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
for (int i = 1; i <= 2; i++)
|
||
|
{
|
||
|
ret = ret.Replace("{tb2_rows" + i + "_col1}", " ");
|
||
|
ret = ret.Replace("{tb2_rows" + i + "_col2}", " ");
|
||
|
ret = ret.Replace("{tb2_rows" + i + "_col3}", " ");
|
||
|
ret = ret.Replace("{tb2_rows" + i + "_col4}", " ");
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return ret;
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
private string UpdateTB3()
|
||
|
{
|
||
|
string ret = html_tb3;
|
||
|
|
||
|
Entity_t_JIS_Seq5000 t_JIS_Seq5000 = new Entity_t_JIS_Seq5000();
|
||
|
DataSet dsInsert = t_JIS_Seq5000.GetData("ID, OrderNumber, partNumber, PartName, SwetTime", "IsPrintAssemble=0 and [IsInsert]=1 and PackageGroupName='" + PackageGroupName + "'", "[SwetTime] asc");
|
||
|
|
||
|
DataRow[] drs = dsInsert.Tables[0].Select("1=1");
|
||
|
|
||
|
if (drs.Length > 0)
|
||
|
{
|
||
|
for (int i = 1; i <= 2; i++)
|
||
|
{
|
||
|
ret = (i - 1) < drs.Length ? ret.Replace("{tb3_rows" + i + "_col1}", drs[i - 1]["OrderNumber"].ToString()) : ret.Replace("{tb3_rows" + i + "_col1}", " ");
|
||
|
ret = (i - 1) < drs.Length ? ret.Replace("{tb3_rows" + i + "_col2}", drs[i - 1]["partNumber"].ToString()) : ret.Replace("{tb3_rows" + i + "_col2}", " ");
|
||
|
ret = (i - 1) < drs.Length ? ret.Replace("{tb3_rows" + i + "_col3}", drs[i - 1]["PartName"].ToString()) : ret.Replace("{tb3_rows" + i + "_col3}", " ");
|
||
|
ret = (i - 1) < drs.Length ? ret.Replace("{tb3_rows" + i + "_col4}", drs[i - 1]["SwetTime"].ToString()) : ret.Replace("{tb3_rows" + i + "_col4}", " ");
|
||
|
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
for (int i = 1; i <= 2; i++)
|
||
|
{
|
||
|
ret = ret.Replace("{tb3_rows" + i + "_col1}", " ");
|
||
|
ret = ret.Replace("{tb3_rows" + i + "_col2}", " ");
|
||
|
ret = ret.Replace("{tb3_rows" + i + "_col3}", " ");
|
||
|
ret = ret.Replace("{tb3_rows" + i + "_col4}", " ");
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return ret;
|
||
|
|
||
|
|
||
|
}
|
||
|
}
|
||
|
}
|