using Estsh.Client.Base;
namespace Estsh.Client.StepLibrary
{
public class SnOutPdline : StepBase
{
//计数器数量
private string _PrdCount = string.Empty;
///
/// 执行工步操作
///
/// 执行结果
public override bool Do()
{
MESPrintSN _app = new MESPrintSN(httpClient);
Action(this, new EventArgs());
string inputSN = Context["serial_number"].ToString();
bool useJupStep = Context.Contains("useJupStep");
Context.Remove("useJupStep");
string stationType = _app.stationType(Context["terminal_id"].ToString());
if (stationType=="C")
{
//更新条码状态为下线
_app.updateStatus(inputSN);
}
try
{
string tres = _app.ProdTrans(0, Context["serial_number"].ToString(), Convert.ToInt32(Context["terminal_id"].ToString()), 0, stationType);
if (tres.ToUpper() != "OK")
{
ShowMessage(this, "red|" + tres + "");
return false;
}
}
catch (Exception ex)
{
using (StreamWriter sw = new StreamWriter("ProdTrans-" + DateTime.Now.ToString("yyyy-MM-dd") + ".txt", true))
{
sw.WriteLine(string.Format("{0} {1} {2}", "["
+ DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
+ "] ProdTrans", Context["serial_number"].ToString(), ex));
sw.Flush();
sw.Close();
}
}
Complate(this, new EventArgs());
return base.Do();
}
private void InitializeComponent()
{
this.SuspendLayout();
//
// SnOutPdline
//
this.Name = "SnOutPdline";
this.Size = new System.Drawing.Size(635, 150);
this.ResumeLayout(false);
}
}
}