This commit is contained in:
jl
2025-06-23 18:50:32 +08:00
parent f7a87c41ff
commit 81ef9284b7
6 changed files with 117 additions and 90 deletions

View File

@ -30,61 +30,63 @@ namespace Epost.BLL
public ResultModel Initialization_T(bool isback = true)
{
ResultModel resultModel = new ResultModel();
List<LabelParamModel> list = new List<LabelParamModel>();
try
{
DataTable dt = addrBLL.getControlList();
bool result = false;
if (dt != null && dt.Rows.Count > 0)
{
foreach (DataRow item in dt.Rows)
{
LabelParamModel model = new LabelParamModel();
model.ControlIP = item["ControlIP"].ToString();
model.Address = "9999";
model.Command = "FORMAT_JOB_DATA";
model.Parameter = "50";
model.Timeout = "0.5";
list.Add(model);
model = new LabelParamModel();
model.ControlIP = item["ControlIP"].ToString();
model.Address = "9999";
model.Command = "CONNECT";
model.Parameter = IP;
model.Timeout = "0.5";
list.Add(model);
model = new LabelParamModel();
model.ControlIP = item["ControlIP"].ToString();
model.Address = "9999";
model.Parameter = "11111000";
model.Command = "UNLOCK";
model.Timeout = "0.5";
list.Add(model);
model = new LabelParamModel();
model.ControlIP = item["ControlIP"].ToString();
model.Address = "9999";
model.Command = "LED_OFF";
model.Timeout = "0.5";
list.Add(model);
//List<LabelParamModel> list = new List<LabelParamModel>();
//try
//{
// DataTable dt = addrBLL.getControlList();
// bool result = false;
// if (dt != null && dt.Rows.Count > 0)
// {
// foreach (DataRow item in dt.Rows)
// {
// LabelParamModel model = new LabelParamModel();
// model.ControlIP = item["ControlIP"].ToString();
// model.Address = "9999";
// model.Command = "FORMAT_JOB_DATA";
// model.Parameter = "50";
// model.Timeout = "0.5";
// list.Add(model);
// model = new LabelParamModel();
// model.ControlIP = item["ControlIP"].ToString();
// model.Address = "9999";
// model.Command = "CONNECT";
// model.Parameter = IP;
// model.Timeout = "0.5";
// list.Add(model);
// model = new LabelParamModel();
// model.ControlIP = item["ControlIP"].ToString();
// model.Address = "9999";
// model.Parameter = "11111000";
// model.Command = "UNLOCK";
// model.Timeout = "0.5";
// list.Add(model);
// model = new LabelParamModel();
// model.ControlIP = item["ControlIP"].ToString();
// model.Address = "9999";
// model.Command = "LED_OFF";
// model.Timeout = "0.5";
// list.Add(model);
}
if (list.Any())
{
resultModel = SendALL_Init(list);
}
// }
// if (list.Any())
// {
// resultModel = SendALL_Init(list);
// }
}
return resultModel;
// }
// return resultModel;
}
catch (Exception ex)
{
//}
//catch (Exception ex)
//{
resultModel.result = "0";
resultModel.msg = "初始化失败!";
LogHelper.WriteLogInfo("初始化异常:" + ex.Message);
// resultModel.result = "0";
// resultModel.msg = "初始化失败!";
// LogHelper.WriteLogInfo("初始化异常:" + ex.Message);
}
//}
resultModel.result = "0";
resultModel.msg = "成功";
return resultModel;
}
#endregion