You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
72 lines
2.5 KiB
C#
72 lines
2.5 KiB
C#
using Estsh.Client.Base;
|
|
|
|
|
|
namespace Estsh.Client.StepLibrary
|
|
{
|
|
public class GYInRoom : StepBase
|
|
{
|
|
/// <summary>
|
|
/// 执行工步操作
|
|
/// </summary>
|
|
/// <returns>执行结果</returns>
|
|
public override bool Do()
|
|
{
|
|
try
|
|
{
|
|
StepLibraryAPP _app = new StepLibraryAPP(httpClient);
|
|
|
|
Action(this, new EventArgs());
|
|
|
|
//设定的第多少个进入静音房
|
|
string qty = _app.getBaseParamValue("InRoom");
|
|
//当前已过去多少个
|
|
string currQty = _app.getBaseParamValue("InRoomCurr");
|
|
string _serial_number = Context["serial_number"].ToString();
|
|
if (!string.IsNullOrEmpty(qty))
|
|
{
|
|
if (string.IsNullOrEmpty(currQty))
|
|
{
|
|
_app.updateBaseParamValue(qty, "InRoomCurr");
|
|
}
|
|
else
|
|
{
|
|
if (_app.getSNtoModel(_serial_number))
|
|
{
|
|
if (Convert.ToInt32(currQty) + 1 >= Convert.ToInt32(qty))
|
|
{
|
|
bool value = _app.updateBaseParamValue("0", "InRoomCurr");
|
|
|
|
//发送进入静音房信号
|
|
value = _app.UpdateOPCPointRobot("TRUE", "100007_InRoom");
|
|
//修改条码状态为进入静音房 8
|
|
_app.UpdateSNStatus(_serial_number);
|
|
}
|
|
else
|
|
{
|
|
bool value = _app.updateBaseParamValue((Convert.ToInt32(currQty) + 1).ToString(), "InRoomCurr");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
Complate(this, new EventArgs());
|
|
|
|
return base.Do();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
// 记录日志
|
|
using (StreamWriter sw = new StreamWriter("RoomError_Log_" + DateTime.Now.ToString("yyyyMM") + ".txt", true))
|
|
{
|
|
sw.WriteLine(string.Format("{0} {1}", "["
|
|
+ DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
|
|
+ "] ", ex.ToString()));
|
|
sw.Flush();
|
|
sw.Close();
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
}
|