北京安通林JIS系统
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.
 
 
 

160 lines
4.6 KiB

using Stone.Common;
using Stone.Entity;
using Stone.WinBiz.Preordering;
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;
namespace Stone.WinModule.Preordering
{
public partial class frmPreordering : Form
{
#region 初始化
private HtmlDocument doc = null;
public frmPreordering()
{
InitializeComponent();
}
private void frmPreordering_Load(object sender, EventArgs e)
{
this.webBrowser1.Navigate(Application.StartupPath + "\\html\\预排序扫描.html");
}
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
try
{
doc = webBrowser1.Document;
}
catch (Exception ex)
{
MyMessageBox.ShowErrorMessage(ex.Message);
}
}
#endregion
#region 事件
private void txtBarCode_KeyDown(object sender, KeyEventArgs e)
{
if(e.KeyCode == Keys.Enter)
{
ScanBarCode();
}
}
private void timer1_Tick(object sender, EventArgs e)
{
if (!this.txtBarCode.Focused)
{
this.txtBarCode.Focus();
this.txtBarCode.SelectAll();
}
}
private void btnExit_Click(object sender, EventArgs e)
{
this.Close();
}
#endregion
#region 自定义方法
private void ScanBarCode()
{
try
{
this.lblMsg.Text = "";
string BarCode = this.txtBarCode.Text.Trim().ToUpper();
if (BarCode == "") throw new Exception("条码不能为空");
ScanBillNo(BarCode);
}
catch (Exception ex)
{
this.lblMsg.Text = ex.Message;
}
finally
{
this.txtBarCode.Focus();
this.txtBarCode.SelectAll();
}
}
private void ScanBillNo(string BillNo)
{
Entity_t_JIS_Assemble t_JIS_Assemble = new Entity_t_JIS_Assemble();
Entity_t_JIS_List t_JIS_List = new Entity_t_JIS_List();
if (t_JIS_Assemble.GetData("[IsScan]=1 and [IsCheck]=0").Tables[0].Rows.Count > 0)
{
throw new Exception("还有订单未校验,不能扫描下一个排序单");
}
DataSet dsPrint = t_JIS_Assemble.GetData($"[BillNo]='{BillNo}'");
if (Convert.ToInt32(dsPrint.Tables[0].Rows[0]["IsScan"]) == 1)
throw new Exception($"{BillNo} 已经扫描过了,请【生产序列】界面中去补打!");
t_JIS_Assemble.Edit("[IsScan]=1, [ScanTime]=getdate()", $"[BillNo]='{BillNo}'");
ClearData();
ShowData(dsPrint);
dsPrint.Tables[0].TableName = "Head";
dsPrint.Tables.Add(t_JIS_List.GetData($"[BillNo]='{BillNo}'").Tables[0].Copy());
dsPrint.Tables[1].TableName = "Detail";
F_Preordering.PrintLabel(dsPrint);
}
private void ClearData()
{
for (int i = 0; i < 4; i++)
{
doc.GetElementById("lbl_sequenceNumber_" + (i + 1)).InnerHtml = "&nbsp;";
doc.GetElementById("lbl_description_" + (i + 1)).InnerHtml = "&nbsp;";
doc.GetElementById("lbl_ColorName_" + (i + 1)).InnerHtml = "&nbsp;";
doc.GetElementById("lbl_assemblyDate_" + (i + 1)).InnerHtml = "&nbsp;";
doc.GetElementById("lbl_productionNumber_" + (i + 1)).InnerHtml = "&nbsp;";
}
}
private void ShowData(DataSet dsData)
{
for (int i = 0; i < dsData.Tables[0].Rows.Count; i++)
{
doc.GetElementById("lbl_sequenceNumber_" + (i + 1)).InnerHtml = dsData.Tables[0].Rows[i]["Sort"].ToString();
doc.GetElementById("lbl_description_" + (i + 1)).InnerHtml = dsData.Tables[0].Rows[i]["description"].ToString();
doc.GetElementById("lbl_ColorName_" + (i + 1)).InnerHtml = dsData.Tables[0].Rows[i]["ColorName"].ToString();
doc.GetElementById("lbl_assemblyDate_" + (i + 1)).InnerHtml = dsData.Tables[0].Rows[i]["assemblyDate"].ToString();
doc.GetElementById("lbl_productionNumber_" + (i + 1)).InnerHtml = dsData.Tables[0].Rows[i]["productionNumber"].ToString();
}
}
#endregion
}
}