793 lines
26 KiB
C#
793 lines
26 KiB
C#
using ComposerSDK;
|
||
using Epost.Common;
|
||
using Epost.DAL;
|
||
using Epost.DAL.Cache;
|
||
using Epost.DAL.Enum;
|
||
using Epost.Model;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Configuration;
|
||
using System.Data;
|
||
using System.Linq;
|
||
using System.Text;
|
||
using System.Text.RegularExpressions;
|
||
using System.Threading.Tasks;
|
||
using static Epost.Common.LogHelper;
|
||
|
||
namespace Epost.BLL
|
||
{
|
||
public class CommandBLL
|
||
{
|
||
CommandDAL dal = new CommandDAL();
|
||
XgateCacheDAL xageDAL = new XgateCacheDAL();
|
||
AddressstorageBLL addrBLL = new AddressstorageBLL();
|
||
public static DataTable Controls = new DataTable();
|
||
public static DataTable Labels = new DataTable();
|
||
JobDownCacheDAL JobCache = new JobDownCacheDAL();
|
||
OrdersDAL orderDal = new OrdersDAL();
|
||
ConfigurationOperator txtbll = new ConfigurationOperator();
|
||
string IP = ConfigurationManager.AppSettings["WebAPIUrl"];
|
||
|
||
#region 初始化数据
|
||
public ResultModel Initialization_M(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);
|
||
LED_OFF_CLEAR(item["ControlIP"].ToString());
|
||
}
|
||
if (list.Any())
|
||
{
|
||
resultModel = SendALL_Init(list);
|
||
}
|
||
|
||
}
|
||
return resultModel;
|
||
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
|
||
resultModel.result = "0";
|
||
resultModel.msg = "初始化失败!";
|
||
LogHelper.WriteLogInfo("初始化异常:" + ex.Message);
|
||
|
||
}
|
||
return resultModel;
|
||
}
|
||
#endregion
|
||
|
||
#region 设备检测 查询所有标签
|
||
public ResultModel GetAllLabelList_M()
|
||
{
|
||
ResultModel model = new ResultModel();
|
||
try
|
||
{
|
||
bool bo = true;
|
||
DataTable dt = addrBLL.getControlList();
|
||
List<LabelParamModel> list = new List<LabelParamModel>();
|
||
if (dt.Rows.Count > 0)
|
||
{
|
||
foreach (DataRow item in dt.Rows)
|
||
{
|
||
DataTable lableDt = addrBLL.getLabelList(item["id"].ToString());
|
||
if (lableDt != null && lableDt.Rows.Count > 0)
|
||
{
|
||
foreach (DataRow labelItem in lableDt.Rows)
|
||
{
|
||
if (labelItem["addresstype"].ToString() == "2")
|
||
{
|
||
LabelParamModel CNlablemodel = new LabelParamModel();
|
||
CNlablemodel.Address = labelItem["address"].ToString();
|
||
CNlablemodel.ControlIP = item["ControlIP"].ToString();
|
||
CNlablemodel.Command = "DISPLAY_JOB";
|
||
CNlablemodel.Uid = labelItem["address"].ToString();
|
||
CNlablemodel.Type = "C";
|
||
CNlablemodel.Mode = "10";
|
||
CNlablemodel.Title = labelItem["address"].ToString();
|
||
list.Add(CNlablemodel);
|
||
}
|
||
else
|
||
{
|
||
LabelParamModel lablemodel = new LabelParamModel();
|
||
lablemodel.Address = labelItem["address"].ToString();
|
||
lablemodel.ControlIP = item["ControlIP"].ToString();
|
||
lablemodel.Command = "DISPLAY_JOB";
|
||
lablemodel.Type = "N";
|
||
lablemodel.Quantity = labelItem["address"].ToString();
|
||
lablemodel.Uid = labelItem["address"].ToString();
|
||
lablemodel.Mode = "10";
|
||
list.Add(lablemodel);
|
||
}
|
||
|
||
//result= combll.DISPLAY_JOB(model);
|
||
|
||
}
|
||
}
|
||
|
||
}
|
||
DISPLAY_JOBALL(list);
|
||
}
|
||
if (bo)
|
||
{
|
||
model.result = "1";
|
||
model.msg = "成功!";
|
||
}
|
||
return model;
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
model.result = "0";
|
||
model.msg = ex.Message;
|
||
return model;
|
||
}
|
||
|
||
}
|
||
#endregion
|
||
|
||
#region 获取参数中文
|
||
public string GETDISPLAYJOBPAR_CN(string no, string Lightcolor, string IsTwinkle, string Title, string BigQuantity, string BigUnit, string Quantity, string Unit, string Content, string Rfcode)
|
||
{
|
||
string parar = no + "00" + Lightcolor + IsTwinkle + "30CQ" + Title + "\n\n" + BigQuantity + "\n" + BigUnit + "\n" + Quantity + "\n" + Unit + "\n" + Content + "\n00\n\n" + Rfcode + "\n"; ;
|
||
return parar;
|
||
}
|
||
#endregion
|
||
|
||
#region 获取参数数字
|
||
public string GETDISPLAYJOBPAR(string no, string Lightcolor, string IsTwinkle, string location, string Quantity, string Rfcode)
|
||
{
|
||
string parar = no + Lightcolor + IsTwinkle + "30NQ" + location + "\n" + Quantity + "\n" + Rfcode + "\n";
|
||
return parar;
|
||
}
|
||
#endregion
|
||
|
||
#region 清除
|
||
public void clearALL_M()
|
||
{
|
||
bool result = false;
|
||
DataTable dt = addrBLL.getControlList();
|
||
if (dt.Rows.Count > 0)
|
||
{
|
||
foreach (DataRow item in dt.Rows)
|
||
{
|
||
LabelParamModel model = new LabelParamModel();
|
||
model.Address = "9999";
|
||
model.ControlIP = item["ControlIP"].ToString();
|
||
result = FORMATE_JOB_DATA(model);
|
||
}
|
||
|
||
}
|
||
|
||
|
||
}
|
||
#endregion
|
||
|
||
|
||
#region M系列
|
||
|
||
#region 格式化任务数据
|
||
public bool FORMATE_JOB_DATA(LabelParamModel model)
|
||
{
|
||
return dal.FORMATE_JOB_DATA(model);
|
||
}
|
||
#endregion
|
||
|
||
#region 连接控制器
|
||
public bool CONNECT(LabelParamModel model)
|
||
{
|
||
return dal.CONNECT(model);
|
||
}
|
||
#endregion
|
||
|
||
#region 开始轮询 (传参 device/job/scan默认job)
|
||
public bool START_POLLING(LabelParamModel model)
|
||
{
|
||
return dal.START_POLLING(model);
|
||
}
|
||
#endregion
|
||
|
||
#region 进入设置模式
|
||
public bool ENTER_CONFIG_MODE(LabelParamModel model)
|
||
{
|
||
|
||
|
||
return dal.ENTER_CONFIG_MODE(model);
|
||
}
|
||
#endregion
|
||
|
||
#region 设置地址 (传参地址 内容)
|
||
public bool SET_ADDRESS(LabelParamModel model)
|
||
{
|
||
return dal.SET_ADDRESS(model);
|
||
}
|
||
#endregion
|
||
|
||
#region 删除地址 (传参地址 内容)
|
||
public bool DELETE_ADDRESS(LabelParamModel model)
|
||
{
|
||
return dal.DELETE_ADDRESS(model);
|
||
}
|
||
#endregion
|
||
|
||
#region 退出设置模式
|
||
public bool EXIT_CONFIG_MODE(LabelParamModel model)
|
||
{
|
||
|
||
return dal.EXIT_CONFIG_MODE(model);
|
||
}
|
||
#endregion
|
||
|
||
#region 任务指令(传参地址)
|
||
public void DISPLAY_JOB_M(LabelParamModel model, bool clear = false, bool islock = false)
|
||
{
|
||
List<LabelParamModel> list = new List<LabelParamModel>();
|
||
if (clear)
|
||
{
|
||
LabelParamModel clearModel = new LabelParamModel();
|
||
clearModel.Address = model.Address;
|
||
clearModel.ControlIP = model.ControlIP;
|
||
clearModel.Parameter = model.Parameter;
|
||
clearModel.Uid = model.Uid;
|
||
clearModel.Command = "REMOVE_JOB";
|
||
clearModel.Timeout = "0.5";
|
||
clearModel.Type = model.Type;
|
||
// dal.REMOVE_JOB(clearModel);
|
||
list.Add(clearModel);
|
||
}
|
||
LabelParamModel DisplayModel = new LabelParamModel();
|
||
DisplayModel.Address = model.Address;
|
||
DisplayModel.ControlIP = model.ControlIP;
|
||
DisplayModel.Content = model.Content;
|
||
DisplayModel.Title = model.Title;
|
||
DisplayModel.Loc = model.Loc;
|
||
DisplayModel.Quantity = model.Quantity;
|
||
DisplayModel.Uid = model.Uid;
|
||
DisplayModel.W_quantity = model.W_quantity;
|
||
DisplayModel.Unit = model.Unit;
|
||
DisplayModel.W_unit = model.W_unit;
|
||
DisplayModel.Command = "DISPLAY_JOB";
|
||
DisplayModel.Timeout = "0.5";
|
||
DisplayModel.Type = model.Type;
|
||
DisplayModel.Mode = model.Mode;
|
||
// dal.UNLOCK(lockModel);
|
||
list.Add(DisplayModel);
|
||
if (islock)
|
||
{
|
||
LabelParamModel lockModel = new LabelParamModel();
|
||
lockModel.Address = model.Address;
|
||
lockModel.ControlIP = model.ControlIP;
|
||
lockModel.Parameter = "11101000";
|
||
lockModel.Command = "LOCK";
|
||
lockModel.Timeout = "0.5";
|
||
lockModel.Type = model.Type;
|
||
// dal.LOCK(lockModel);
|
||
list.Add(lockModel);
|
||
}
|
||
else
|
||
{
|
||
LabelParamModel lockModel = new LabelParamModel();
|
||
lockModel.Address = model.Address;
|
||
lockModel.ControlIP = model.ControlIP;
|
||
lockModel.Parameter = "00011000";
|
||
lockModel.Command = "UNLOCK";
|
||
lockModel.Timeout = "0.5";
|
||
lockModel.Type = model.Type;
|
||
// dal.UNLOCK(lockModel);
|
||
list.Add(lockModel);
|
||
}
|
||
dal.DISPLAY_JOBALL(list);
|
||
}
|
||
#endregion
|
||
|
||
|
||
#region 任务指令(传参地址)
|
||
public void LED_ON_M(LabelParamModel model, bool islock = false)
|
||
{
|
||
List<LabelParamModel> list = new List<LabelParamModel>();
|
||
LabelParamModel clearModel = new LabelParamModel();
|
||
clearModel.Address = model.Address;
|
||
clearModel.ControlIP = model.ControlIP;
|
||
clearModel.Parameter = "";
|
||
clearModel.Command = "LED_OFF";
|
||
clearModel.Timeout = "0.5";
|
||
// dal.REMOVE_JOB(clearModel);
|
||
list.Add(clearModel);
|
||
LabelParamModel DisplayModel = new LabelParamModel();
|
||
DisplayModel.Address = model.Address;
|
||
DisplayModel.ControlIP = model.ControlIP;
|
||
DisplayModel.Parameter = model.Parameter;
|
||
DisplayModel.Command = "LED_ON";
|
||
DisplayModel.Timeout = "0.5";
|
||
// dal.UNLOCK(lockModel);
|
||
list.Add(DisplayModel);
|
||
if (islock)
|
||
{
|
||
LabelParamModel lockModel = new LabelParamModel();
|
||
lockModel.Address = model.Address;
|
||
lockModel.ControlIP = model.ControlIP;
|
||
lockModel.Parameter = "11101000";
|
||
lockModel.Command = "LOCK";
|
||
lockModel.Timeout = "0.5";
|
||
// dal.LOCK(lockModel);
|
||
list.Add(lockModel);
|
||
}
|
||
else
|
||
{
|
||
LabelParamModel lockModel = new LabelParamModel();
|
||
lockModel.Address = model.Address;
|
||
lockModel.ControlIP = model.ControlIP;
|
||
lockModel.Parameter = "00011000";
|
||
lockModel.Command = "UNLOCK";
|
||
lockModel.Timeout = "0.5";
|
||
// dal.UNLOCK(lockModel);
|
||
list.Add(lockModel);
|
||
}
|
||
dal.DISPLAY_JOBALL(list);
|
||
}
|
||
#endregion
|
||
#region LED_OFF(传参地址)
|
||
public void LED_OFF_M(List<JobModel> list)
|
||
{
|
||
List<LabelParamModel> sendlist = new List<LabelParamModel>();
|
||
foreach (JobModel model in list)
|
||
{
|
||
LabelParamModel clearModel = new LabelParamModel();
|
||
clearModel.Address = model.Address;
|
||
clearModel.ControlIP = model.ControlIP;
|
||
|
||
clearModel.Command = "LED_OFF";
|
||
clearModel.Timeout = "0.5";
|
||
sendlist.Add(clearModel);
|
||
}
|
||
dal.DISPLAY_JOBALL(sendlist);
|
||
}
|
||
#endregion
|
||
|
||
|
||
|
||
#region LED_OFF(传参地址)
|
||
public void LED_OFF_CLEAR(string ip)
|
||
{
|
||
LabelParamModel clearModel = new LabelParamModel();
|
||
clearModel.Address = "9999";
|
||
clearModel.ControlIP = ip;
|
||
clearModel.Parameter = "1";
|
||
clearModel.Command = "LED_OFF";
|
||
clearModel.Timeout = "0.5";
|
||
dal.Send(clearModel);
|
||
}
|
||
#endregion
|
||
#region LED_OFF(传参地址)
|
||
public void LED_OFF_CLEAR(List<JobModel> offList)
|
||
{
|
||
List<LabelParamModel> list = new List<LabelParamModel>();
|
||
if (offList.Any())
|
||
{
|
||
foreach (JobModel item in offList)
|
||
{
|
||
LabelParamModel clearModel = new LabelParamModel();
|
||
clearModel.Address = item.Address;
|
||
clearModel.ControlIP = item.ControlIP;
|
||
clearModel.Parameter = "1";
|
||
clearModel.Command = "LED_OFF";
|
||
clearModel.Timeout = "0.5";
|
||
list.Add(clearModel);
|
||
}
|
||
|
||
}
|
||
|
||
dal.SendALL(list);
|
||
}
|
||
#endregion
|
||
|
||
|
||
#region 任务指令(传参地址)
|
||
public bool DISPLAY_JOB(LabelParamModel model)
|
||
{
|
||
|
||
return dal.DISPLAY_JOB(model);
|
||
}
|
||
#endregion
|
||
|
||
#region 任务指令(传参地址)
|
||
public void DISPLAY_JOBALL(List<LabelParamModel> model)
|
||
{
|
||
|
||
dal.DISPLAY_JOBALL(model);
|
||
}
|
||
#endregion
|
||
#region 初始化
|
||
public ResultModel SendALL_Init(List<LabelParamModel> model)
|
||
{
|
||
|
||
return dal.SendALL_Init(model);
|
||
}
|
||
#endregion
|
||
|
||
#region 移除任务指令(传参地址)
|
||
public bool REMOVE_JOB(LabelParamModel model)
|
||
{
|
||
|
||
return dal.REMOVE_JOB(model);
|
||
}
|
||
#endregion
|
||
#region 通道灯命令
|
||
public bool DISPLAY_LIGHT(LabelParamModel model)
|
||
{
|
||
|
||
return dal.DISPLAY_LIGHT(model);
|
||
}
|
||
#endregion
|
||
|
||
#region 终端锁定指令
|
||
public bool LOCK(LabelParamModel model)
|
||
{
|
||
|
||
return dal.LOCK(model);
|
||
}
|
||
#endregion
|
||
|
||
|
||
|
||
#region 终端解锁指令
|
||
public bool UNLOCK(LabelParamModel model)
|
||
{
|
||
|
||
return dal.UNLOCK(model);
|
||
}
|
||
#endregion
|
||
|
||
#region 扫描枪使能
|
||
public bool SET_SCANDEVICE_ON(LabelParamModel model)
|
||
{
|
||
|
||
return dal.SET_SCANDEVICE_ON(model);
|
||
}
|
||
#endregion
|
||
|
||
#region 扫描枪不使能
|
||
public bool SET_SCANDEVICE_OFF(LabelParamModel model)
|
||
{
|
||
|
||
return dal.SET_SCANDEVICE_OFF(model);
|
||
}
|
||
#endregion
|
||
|
||
#region 清除扫描枪
|
||
public bool SET_SCANDEVICE_CLEAR(LabelParamModel model)
|
||
{
|
||
|
||
return dal.SET_SCANDEVICE_CLEAR(model);
|
||
}
|
||
#endregion
|
||
|
||
#region 休眠
|
||
public bool SLEEP(LabelParamModel model)
|
||
{
|
||
|
||
return dal.SLEEP(model);
|
||
}
|
||
#endregion
|
||
|
||
#region 清除所有任务并熄灭通道灯
|
||
public void CloseALL_M()
|
||
{
|
||
DataTable dt = addrBLL.getControlList();
|
||
|
||
if (dt != null && dt.Rows.Count > 0)
|
||
{
|
||
foreach (DataRow item in dt.Rows)
|
||
{
|
||
|
||
LabelParamModel model = new LabelParamModel();
|
||
model.ControlIP = item["ControlIP"].ToString();
|
||
FORMATE_JOB_DATA(model);
|
||
|
||
LED_OFF_CLEAR(item["ControlIP"].ToString());
|
||
}
|
||
|
||
}
|
||
|
||
|
||
|
||
|
||
}
|
||
#endregion
|
||
|
||
#region 根据区解锁标签
|
||
public void UNLOCK_M(List<JobModel> offList)
|
||
{
|
||
// DataTable dt = addrBLL.getAddresslist(block,area,type);
|
||
if (offList.Any())
|
||
{
|
||
List<LabelParamModel> list = new List<LabelParamModel>();
|
||
foreach (JobModel item in offList)
|
||
{
|
||
|
||
LabelParamModel model = new LabelParamModel();
|
||
model.ControlIP = item.ControlIP;
|
||
model.Address = item.Address;
|
||
model.Command = "UNLOCK";
|
||
model.Parameter = "11111000";
|
||
list.Add(model);
|
||
|
||
}
|
||
dal.SendALL(list);
|
||
}
|
||
|
||
|
||
|
||
|
||
}
|
||
#endregion
|
||
|
||
#region 根据区熄灭标签
|
||
public void ClearArea_M(List<JobModel> offList)
|
||
{
|
||
// DataTable dt = addrBLL.getAddresslist(block,area,type);
|
||
|
||
if (offList.Any())
|
||
{
|
||
List<LabelParamModel> list = new List<LabelParamModel>();
|
||
foreach (JobModel item in offList)
|
||
{
|
||
|
||
LabelParamModel model = new LabelParamModel();
|
||
model.ControlIP = item.ControlIP;
|
||
model.Address = item.Address;
|
||
model.Command = "REMOVE_JOB";
|
||
model.Uid = item.ID;
|
||
model.Type = "N";
|
||
list.Add(model);
|
||
LabelParamModel Unlockmodel = new LabelParamModel();
|
||
Unlockmodel.ControlIP = item.ControlIP;
|
||
Unlockmodel.Address = item.Address;
|
||
Unlockmodel.Command = "UNLOCK";
|
||
|
||
Unlockmodel.Type = "N";
|
||
Unlockmodel.Parameter = "11111000";
|
||
list.Add(Unlockmodel);
|
||
|
||
}
|
||
dal.SendALL(list);
|
||
}
|
||
|
||
|
||
|
||
|
||
}
|
||
#endregion
|
||
|
||
#region 根据区熄灭标签
|
||
public void ClearAreaLEDOFF(List<JobModel> offList)
|
||
{
|
||
// DataTable dt = addrBLL.getAddresslist(block,area,type);
|
||
|
||
if (offList.Any())
|
||
{
|
||
List<LabelParamModel> list = new List<LabelParamModel>();
|
||
foreach (JobModel item in offList)
|
||
{
|
||
|
||
LabelParamModel model = new LabelParamModel();
|
||
model.ControlIP = item.ControlIP;
|
||
model.Address = item.Address;
|
||
model.Command = "LED_OFF";
|
||
model.Parameter = "0";
|
||
list.Add(model);
|
||
|
||
}
|
||
dal.SendALL(list);
|
||
}
|
||
|
||
|
||
|
||
|
||
}
|
||
#endregion
|
||
#region 点亮显示标签
|
||
public void ShowBoxMessage_M(ShowMessageModel_M show)
|
||
{
|
||
//获取作业区对应的显示标签地址
|
||
DataTable showaddrDT = addrBLL.GetBoxAddress(show.Block, show.Area, show.Type);
|
||
if (showaddrDT != null && showaddrDT.Rows.Count > 0)
|
||
{
|
||
foreach (DataRow addritem in showaddrDT.Rows)
|
||
{
|
||
|
||
LabelParamModel lablemodel = new LabelParamModel();
|
||
lablemodel.Address = addritem["address"].ToString();
|
||
lablemodel.ControlIP = addritem["controlip"].ToString();
|
||
lablemodel.Command = "DISPLAY_JOB";
|
||
lablemodel.Uid = show.Uid;
|
||
if (string.IsNullOrEmpty(show.Uid))
|
||
{ lablemodel.Uid = show.No + addritem["address"].ToString(); }
|
||
|
||
lablemodel.Mode = show.Color + "0";
|
||
if (addritem["addresstype"].ToString() == "2")
|
||
{
|
||
|
||
lablemodel.Type = "C";
|
||
lablemodel.Loc = show.Location;
|
||
lablemodel.Title = show.Title;
|
||
lablemodel.Content = show.Contents;
|
||
lablemodel.Quantity = show.Qty;
|
||
lablemodel.Unit = show.Unit;
|
||
lablemodel.W_unit = show.Wholeunit;
|
||
lablemodel.W_quantity = show.Wholeqty.ToString();
|
||
|
||
|
||
}
|
||
else
|
||
{
|
||
lablemodel.Type = "N";
|
||
lablemodel.Quantity = show.Qty;
|
||
lablemodel.Loc = show.Location;
|
||
|
||
}
|
||
|
||
DISPLAY_JOB_M(lablemodel, true, show.Islock);
|
||
LogHelper.WriteLogInfo("点亮显示标签" + addritem["address"].ToString());
|
||
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
/// <summary>
|
||
/// 判断输入的字符串是否只包含数字和英文字母
|
||
/// </summary>
|
||
/// <param name="input"></param>
|
||
/// <returns></returns>
|
||
public static bool IsNumAndEnCh(string input)
|
||
{
|
||
string pattern = @"^[A-Za-z0-9]+$";
|
||
Regex regex = new Regex(pattern);
|
||
return regex.IsMatch(input);
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 点亮指定区域通道灯
|
||
public bool DISPLAY_LIGHT_BLOCK(string block, string area, string isoff)
|
||
{
|
||
|
||
DataTable dt = addrBLL.GetBoxAddress(block, area, 4);
|
||
List<LabelParamModel> list = new List<LabelParamModel>();
|
||
if (dt != null && dt.Rows.Count > 0)
|
||
{
|
||
foreach (DataRow item in dt.Rows)
|
||
{
|
||
LabelParamModel model = new LabelParamModel();
|
||
model.Command = "DISPLAY_LIGHT";
|
||
model.Timeout = "0.5";
|
||
model.Type = "T";
|
||
model.Address = item["address"].ToString();
|
||
model.ControlIP = item["ControlIP"].ToString();
|
||
model.Parameter = ConvertHexHelper.ConvertString(item["addresstype"].ToString(), 10, 16).ToString().PadLeft(2, '0') + isoff;
|
||
list.Add(model);
|
||
}
|
||
|
||
}
|
||
dal.SendALL(list);
|
||
return true;
|
||
}
|
||
#endregion
|
||
|
||
#region 熄灭显示标签
|
||
public void RemoveBoxMessage_M(ShowMessageModel_M show)
|
||
{
|
||
//获取作业区对应的显示标签地址
|
||
DataTable showaddrDT = addrBLL.GetBoxAddress(show.Block, show.Area, show.Type);
|
||
if (showaddrDT != null && showaddrDT.Rows.Count > 0)
|
||
{
|
||
List<LabelParamModel> list = new List<LabelParamModel>();
|
||
foreach (DataRow addritem in showaddrDT.Rows)
|
||
{
|
||
|
||
LabelParamModel model = new LabelParamModel();
|
||
model.Address = addritem["address"].ToString();
|
||
model.ControlIP = addritem["controlip"].ToString();
|
||
model.Parameter = show.No;
|
||
model.Command = "REMOVE_JOB";
|
||
model.Timeout = "0.5";
|
||
list.Add(model);
|
||
}
|
||
|
||
if (list != null && list.Count > 0)
|
||
{
|
||
LogHelper.WriteLogInfo("熄灭点亮的list———————:" + list.Count);
|
||
dal.DISPLAY_JOBALL(list);
|
||
}
|
||
|
||
}
|
||
}
|
||
|
||
|
||
|
||
|
||
#endregion
|
||
#endregion
|
||
|
||
|
||
#region 强制结束灭灯
|
||
public ResultModel Forcedend(string orderid)
|
||
{
|
||
ResultModel resultModel = new ResultModel();
|
||
List<LabelParamModel> list = new List<LabelParamModel>();
|
||
try
|
||
{
|
||
DataTable dt = addrBLL.GetForcedendAddress(orderid);
|
||
|
||
if (dt != null && dt.Rows.Count > 0)
|
||
{
|
||
foreach (DataRow item in dt.Rows)
|
||
{
|
||
LabelParamModel model = new LabelParamModel();
|
||
model.ControlIP = item["ControlIP"].ToString();
|
||
model.Address = item["address"].ToString();
|
||
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.Parameter = "11111000";
|
||
model.Command = "UNLOCK";
|
||
model.Timeout = "0.5";
|
||
list.Add(model);
|
||
LED_OFF_CLEAR(item["ControlIP"].ToString());
|
||
}
|
||
if (list.Any())
|
||
{
|
||
resultModel = SendALL_Init(list);
|
||
}
|
||
|
||
}
|
||
return resultModel;
|
||
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
|
||
resultModel.result = "0";
|
||
resultModel.msg = "强制结束熄灭失败!";
|
||
LogHelper.WriteLogInfo("强制结束异常:" + ex.Message);
|
||
|
||
}
|
||
return resultModel;
|
||
}
|
||
#endregion
|
||
|
||
}
|
||
}
|