From 40557a235ed834cc2fc41a8a1e8704af58048aab Mon Sep 17 00:00:00 2001 From: jl Date: Tue, 5 Dec 2023 14:35:20 +0800 Subject: [PATCH] --- Epost.BLL/CommandBLL.cs | 262 +++++++--- Epost.BLL/Epost.BLL.csproj | 3 + Epost.BLL/OrderBLL.cs | 111 +---- Epost.BLL/OrderControlBLL.cs | 465 +++++++----------- Epost.DAL/AddressstorageDAL.cs | 2 +- Epost.DAL/OrdersDAL.cs | 35 +- .../Controllers/ServerController.cs | 80 ++- Epost.TestToolsWeb/Epost.DPS.csproj.user | 2 +- .../PublishProfiles/Toolsweb.pubxml | 14 +- .../PublishProfiles/Toolsweb.pubxml.user | 36 +- Epost.TestToolsWeb/Web.config | 2 +- 11 files changed, 501 insertions(+), 511 deletions(-) diff --git a/Epost.BLL/CommandBLL.cs b/Epost.BLL/CommandBLL.cs index d25784d..1fd595d 100644 --- a/Epost.BLL/CommandBLL.cs +++ b/Epost.BLL/CommandBLL.cs @@ -4,6 +4,7 @@ using Epost.DAL; using Epost.DAL.Cache; using Epost.DAL.Enum; using Epost.Model; +using LightContrl; using System; using System.Collections.Generic; using System.Configuration; @@ -11,6 +12,7 @@ using System.Data; using System.Linq; using System.Text; using System.Text.RegularExpressions; +using System.Threading; using System.Threading.Tasks; using static Epost.Common.LogHelper; @@ -23,53 +25,64 @@ namespace Epost.BLL AddressstorageBLL addrBLL = new AddressstorageBLL(); public static DataTable Controls = new DataTable(); public static DataTable Labels = new DataTable(); - JobDownCacheDAL JobCache = new JobDownCacheDAL(); - OrdersDAL orderDal = new OrdersDAL(); + JobDownCacheDAL JobCache = new JobDownCacheDAL(); + OrdersDAL orderDal = new OrdersDAL(); ConfigurationOperator txtbll = new ConfigurationOperator(); string IP = ConfigurationManager.AppSettings["WebAPIUrl"]; + LightControlCacheDAL cachedal = new LightControlCacheDAL(); + MainControl lig = new MainControl(); #region 初始化数据 public ResultModel Initialization_M(bool isback = true) { ResultModel resultModel = new ResultModel(); + resultModel.result = "0"; + resultModel.msg = "成功"; List list = new List(); try { - DataTable dt = addrBLL.getControlList(); - bool result = false; + DataTable dt = addrBLL.QueryControlList(""); + 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); - } - if (list.Any()) - { - resultModel = SendALL_Init(list); + + string ipaddress = item["controlip"].ToString().Trim(); + List conlist = cachedal.GetControlList().FindAll(o => o.controlip == ipaddress); + if (conlist != null && conlist.Count > 0) + { + LogHelper.WriteLogInfo(ipaddress + "已连接!"); + + } + else + { + int port = Convert.ToInt32(item["port"].ToString().Trim()); + int timeout = 2000; + bool bo = lig.Connect(ipaddress, port, timeout);//timeout 毫秒 + if (bo) + { + LightcontrolModel model = new LightcontrolModel(); + model.controlip = ipaddress; + model.maincontrol = lig; + model.port = port; + cachedal.UpdateControlList(new List { model }, EcontrolCommend.Create); + + } + else + { + LogHelper.WriteLogInfo("连接失败" + ipaddress); + resultModel.result = "-1"; + resultModel.msg = "连接失败" + ipaddress; + return resultModel; + } + } } } + + return resultModel; } @@ -127,7 +140,7 @@ namespace Epost.BLL lablemodel.Mode = "10"; list.Add(lablemodel); } - + //result= combll.DISPLAY_JOB(model); } @@ -154,9 +167,9 @@ namespace Epost.BLL #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) + 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"; ; + 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 @@ -246,7 +259,7 @@ namespace Epost.BLL #endregion #region 任务指令(传参地址) - public void DISPLAY_JOB_M(LabelParamModel model, bool clear = false, bool islock = false ) + public void DISPLAY_JOB_M(LabelParamModel model, bool clear = false, bool islock = false) { List list = new List(); if (clear) @@ -259,14 +272,14 @@ namespace Epost.BLL clearModel.Command = "REMOVE_JOB"; clearModel.Timeout = "0.5"; clearModel.Type = model.Type; - // dal.REMOVE_JOB(clearModel); + // 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.Content = model.Content; + DisplayModel.Title = model.Title; DisplayModel.Loc = model.Loc; DisplayModel.Quantity = model.Quantity; DisplayModel.Uid = model.Uid; @@ -362,9 +375,9 @@ namespace Epost.BLL LabelParamModel clearModel = new LabelParamModel(); clearModel.Address = model.Address; clearModel.ControlIP = model.ControlIP; - + clearModel.Command = "LED_OFF"; - clearModel.Timeout = "0.5"; + clearModel.Timeout = "0.5"; sendlist.Add(clearModel); } dal.DISPLAY_JOBALL(sendlist); @@ -401,14 +414,14 @@ namespace Epost.BLL clearModel.Timeout = "0.5"; list.Add(clearModel); } - + } - + dal.SendALL(list); } #endregion - + #region 任务指令(传参地址) public bool DISPLAY_JOB(LabelParamModel model) { @@ -431,7 +444,7 @@ namespace Epost.BLL return dal.SendALL_Init(model); } #endregion - + #region 移除任务指令(传参地址) public bool REMOVE_JOB(LabelParamModel model) { @@ -500,27 +513,128 @@ namespace Epost.BLL #region 清除所有任务并熄灭通道灯 public void CloseALL_M() { - DataTable dt = addrBLL.getControlList(); + //DataTable dt = addrBLL.getControlList(); - if (dt != null && dt.Rows.Count > 0) + //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); + + // } + + //} + List conlist = cachedal.GetControlList(); + if (conlist.Any() && conlist.Count > 0) { - foreach (DataRow item in dt.Rows) + Ledonoff_dengdai("0",""); + Thread.Sleep(500); + foreach (LightcontrolModel con in conlist) { - - LabelParamModel model = new LabelParamModel(); - model.ControlIP = item["ControlIP"].ToString(); - FORMATE_JOB_DATA(model); - + bool b = con.maincontrol.DisConnect(con.controlip, con.port); + LogHelper.WriteLogInfo(b + "断开连接" + con.controlip + "==" + con.port); } - } - + cachedal.ClearControlList(); } #endregion + + #region 亮灭灯带所有格口 + public void Ledonoff_dengdai(string lightType, string lightcolor) + { + DataTable dt = addrBLL.QueryControlList(" "); + if (dt != null && dt.Rows.Count > 0) + { + foreach (DataRow rowitem in dt.Rows) + { + string ipaddress = rowitem["controlip"].ToString().Trim(); + List conlist = cachedal.GetControlList().FindAll(o => o.controlip == ipaddress); + if (conlist != null && conlist.Count > 0) + { + + MainControl control = conlist.FirstOrDefault().maincontrol; + bool bo = false; + string Address = dt.Rows[0]["address"].ToString().Trim(); + string resstr = string.Empty; + if (lightType == "0") + { + + bo = control.LED_OFF(ipaddress, Address, ref resstr); + } + else + { + bo = control.LED_ON(ipaddress, Address, ref resstr, "3", "0", lightcolor); + } + + } + } + } + } + #endregion + + #region 点亮/熄灭灯带格口 + public void display_dengdai(string location,string color) + { + DataTable dt = addrBLL.QueryControlList(""); + if (dt != null && dt.Rows.Count > 0) + { + foreach (DataRow rowitem in dt.Rows) + { + string ipaddress = rowitem["controlip"].ToString().Trim(); + List conlist = cachedal.GetControlList().FindAll(o => o.controlip == ipaddress); + if (conlist != null && conlist.Count > 0) + { + MainControl control = conlist.FirstOrDefault().maincontrol; + DataTable locdt = addrBLL.QueryAddrList(" and location ='" + location + "' and controlip='" + ipaddress + "'"); + if (locdt != null && locdt.Rows.Count > 0) + { + List list = new List(); + string address = locdt.Rows[0]["address"].ToString().Trim(); + foreach (DataRow locitem in locdt.Rows) + { + //根据播种墙号、格口号查询播种墙ip及灯带地址 + + LightParagraph show = new LightParagraph(); + show.WayNu = Convert.ToInt32(locitem["wayno"].ToString().Trim()); + show.LightBeganNu = locitem["beginno"].ToString().Trim(); + show.LightEndNu = locitem["endno"].ToString().Trim(); + show.LightColor = color; //1:蓝色 2:绿色 3:青色 4:红色 5:紫色 6黄色 7白色 + show.Brightness = "9";//亮度 1-9 + list.Add(show); + + } + string resstr = string.Empty; + bool bo = control.LED_By_Paragraph(ipaddress, address, list, ref resstr); + if (bo) + { + LogHelper.WriteLogInfo("成功" + ipaddress + "list:" + JsonHelper.SerializeObject(list)); + + } + else + { + LogHelper.WriteLogInfo("失败" + ipaddress + "list:" + JsonHelper.SerializeObject(list), LogHelper.Log_Type.ERROR); + + } + + } + } + else + { + + LogHelper.WriteLogInfo("请先连接设备!"); + } + } + + } + } + #endregion #region 根据区解锁标签 public void UNLOCK_M(List offList) { @@ -553,7 +667,7 @@ namespace Epost.BLL { // DataTable dt = addrBLL.getAddresslist(block,area,type); - if(offList.Any()) + if (offList.Any()) { List list = new List(); foreach (JobModel item in offList) @@ -570,7 +684,7 @@ namespace Epost.BLL Unlockmodel.ControlIP = item.ControlIP; Unlockmodel.Address = item.Address; Unlockmodel.Command = "UNLOCK"; - + Unlockmodel.Type = "N"; Unlockmodel.Parameter = "11111000"; list.Add(Unlockmodel); @@ -615,25 +729,25 @@ namespace Epost.BLL #region 点亮显示标签 public void ShowBoxMessage_M(ShowMessageModel_M show) { - //获取作业区对应的显示标签地址 - DataTable showaddrDT = addrBLL.GetBoxAddress(show.Block,show.Area,show.Type); + //获取作业区对应的显示标签地址 + 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; + lablemodel.Uid = show.Uid; if (string.IsNullOrEmpty(show.Uid)) { lablemodel.Uid = addritem["address"].ToString(); } - + lablemodel.Mode = show.Color + "0"; if (addritem["addresstype"].ToString() == "2") - { - + { + lablemodel.Type = "C"; lablemodel.Loc = show.Location; lablemodel.Title = show.Title; @@ -646,13 +760,13 @@ namespace Epost.BLL } else - { + { lablemodel.Type = "N"; - lablemodel.Quantity = show.Qty; + lablemodel.Quantity = show.Qty; lablemodel.Loc = show.Location; - - } - + + } + DISPLAY_JOB_M(lablemodel, true, show.Islock); LogHelper.WriteLogInfo("点亮显示标签" + addritem["address"].ToString()); @@ -691,7 +805,7 @@ namespace Epost.BLL 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; + model.Parameter = ConvertHexHelper.ConvertString(item["addresstype"].ToString(), 10, 16).ToString().PadLeft(2, '0') + isoff; list.Add(model); } @@ -711,16 +825,16 @@ namespace Epost.BLL List list = new List(); 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.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); @@ -728,16 +842,16 @@ namespace Epost.BLL } } - } + } + - #endregion #endregion - + } } diff --git a/Epost.BLL/Epost.BLL.csproj b/Epost.BLL/Epost.BLL.csproj index 824acb5..2138944 100644 --- a/Epost.BLL/Epost.BLL.csproj +++ b/Epost.BLL/Epost.BLL.csproj @@ -79,6 +79,9 @@ ..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll True + + ..\DLL\LightContrl.dll + diff --git a/Epost.BLL/OrderBLL.cs b/Epost.BLL/OrderBLL.cs index 8fb93a2..2c79ed4 100644 --- a/Epost.BLL/OrderBLL.cs +++ b/Epost.BLL/OrderBLL.cs @@ -375,42 +375,11 @@ namespace Epost.BLL #endregion #region 修改订单状态 - public void UpdateOrderState_Car(List downlist, JobModel model, int truequantity, int checkquaantity = 0) + public void UpdateOrderState_Car(string matchid,string fromlocation,string oprationstate) { - if (downlist.Count > 1) - { - int nowqty = truequantity; - if (truequantity != downlist.Sum(m => m.Quantity)) - { - foreach (JobModel jobmo in downlist.ToArray()) - { - - if (nowqty > jobmo.Quantity) - { - nowqty = nowqty - jobmo.Quantity; - dal.UpdateWorkState_Car(jobmo.Matchid, jobmo.Quantity, jobmo.Sku, jobmo.ID, checkquaantity, model.UserCode); - } - else - { - dal.UpdateWorkState_Car(jobmo.Matchid, jobmo.Quantity, jobmo.Sku, jobmo.ID, checkquaantity, model.UserCode); - nowqty = 0; - } - } - } - else - { - foreach (JobModel jobmo in downlist.ToArray()) - { - dal.UpdateWorkState_Car(jobmo.Matchid, jobmo.Quantity, jobmo.Sku, jobmo.ID, checkquaantity, model.UserCode); - - } - } - } - else - { - - dal.UpdateWorkState_Car(model.Matchid, truequantity, model.Sku, model.ID, checkquaantity, model.UserCode); - } + + dal.UpdateWorkState_Car(matchid, fromlocation, oprationstate); + } @@ -738,80 +707,30 @@ namespace Epost.BLL List list = new List(); DataTable OrderDt = dal.GetOrderList_Car(matchid, sku, area, block); - bool isecho = false; - if (OrderDt == null || OrderDt.Rows.Count == 0)//回显 - { - OrderDt = dal.GetOrderList_echo(matchid, sku, area, block); - isecho = true; - - } + + if (OrderDt != null && OrderDt.Rows.Count > 0) { - string usercode = string.Empty; - string lightcolor = string.Empty; - DataTable udt = dal.GetOrderUseerXCode(matchid, sku, area, block); - if (udt != null && udt.Rows.Count > 0) - { - usercode = udt.Rows[0]["usercode"].ToString(); - lightcolor = udt.Rows[0]["lightcolor"].ToString(); - } - if (string.IsNullOrEmpty(lightcolor)) - { - lightcolor = EnumHelper.EMToDescriptionString(LightColor.Color.Red); - } + foreach (DataRow item in OrderDt.Rows) { #region 任务缓存信息 JobModel demodel = new JobModel(); - demodel.OrderID = item["orderid"].ToString(); - demodel.BatchId = item["BatchId"].ToString(); - demodel.ID = item["ID"].ToString(); - demodel.GoodsName = item["GoodsName"].ToString(); - demodel.GoodsType = item["GoodsType"].ToString(); - demodel.Quantity = Convert.ToInt32(item["Quantity"].ToString()); - demodel.CheckQuantity = Convert.ToInt32(item["CheckQuantity"].ToString()); - demodel.Sku = item["Sku"].ToString(); - demodel.Tolocation = item["Tolocation"].ToString(); - demodel.Matchid = item["Matchid"].ToString(); - demodel.ShopID = item["shopid"].ToString(); - demodel.BoxCode = item["boxcode"].ToString(); - demodel.LotNo = item["LotNo"].ToString(); - demodel.Discount = item["Discount"].ToString(); - demodel.ProdArea = item["ProdArea"].ToString(); - demodel.ColorCode = item["corlorcode"].ToString(); - demodel.WholeUnit = item["WholeUnit"].ToString(); - demodel.Unit = item["Unit"].ToString(); - demodel.TrayCode = item["bkbarcode"].ToString(); + demodel.Tolocation = item["fromlocation"].ToString(); + demodel.Sku = item["sku"].ToString(); + demodel.Matchid = matchid; #region 获取库位信息 demodel.Block = item["Block"].ToString(); - demodel.Area = item["Area"].ToString(); - demodel.Address = item["address"].ToString(); - demodel.UserCode = usercode; - demodel.ColorCode = lightcolor; - demodel.Bkaddress = "0"; - demodel.Addresstype = "1"; - demodel.ControlID = ""; - demodel.ControlIP = item["ControlIP"].ToString(); - //demodel.Layer = item["Layer"].ToString(); - //demodel.Slist = item["Slist"].ToString(); - //demodel.Zone = item["zone"].ToString(); - //demodel.TaskType =Convert.ToInt32(item["tasktype"].ToString()); - + demodel.Area = item["Area"].ToString(); #endregion demodel.State = 0; demodel.TaskArea = Convert.ToInt32(item["area"].ToString()); - demodel.TaskBlock = Convert.ToInt32(item["block"].ToString()); - demodel.No = "01"; - if (isecho) - { - demodel.No = "04"; - demodel.ColorCode = EnumHelper.EMToDescriptionString(LightColor.Color.Blue); - } + demodel.TaskBlock = Convert.ToInt32(item["block"].ToString()); list.Add(demodel); - if (!isecho) { + //修改数据为已读 - dal.UpOrder_Car(item["Matchid"].ToString(), item["sku"].ToString(), item["id"].ToString()); - } + // dal.UpOrder_Car(item["Matchid"].ToString(), item["sku"].ToString(), item["id"].ToString()); + UpdateOrderState_Car(matchid, demodel.Tolocation, "1"); #endregion } } diff --git a/Epost.BLL/OrderControlBLL.cs b/Epost.BLL/OrderControlBLL.cs index a13d5f6..9808a27 100644 --- a/Epost.BLL/OrderControlBLL.cs +++ b/Epost.BLL/OrderControlBLL.cs @@ -9,11 +9,12 @@ using Epost.Common; using Epost.DAL.Cache; using Epost.DAL.Enum; using Epost.Model; +using Epost.Model.resource; namespace Epost.BLL { - public class OrderControlBLL + public class OrderControlBLL { OrderBLL orderbll = new OrderBLL(); OrdersQueueBLL queueBLL = new OrdersQueueBLL(); @@ -24,13 +25,13 @@ namespace Epost.BLL AddressstorageBLL addrBLL = new AddressstorageBLL(); UserModelCacheDAL UserCacheDAL = new UserModelCacheDAL(); BoxQueueBLL queueboxBLL = new BoxQueueBLL(); - SkuInfoBLL skuBLL = new SkuInfoBLL(); + SkuInfoBLL skuBLL = new SkuInfoBLL(); ShowMesCacheDAL msgCache = new ShowMesCacheDAL(); LocationCacheDAL locCache = new LocationCacheDAL(); BoxCodeCacheDAL boxcache = new BoxCodeCacheDAL(); - - private static object lockobj = new object(); + + private static object lockobj = new object(); private static object lockJobDown = new object(); private static object showmes = new object(); public static bool OrisShow = false; @@ -49,18 +50,18 @@ namespace Epost.BLL downCacheDAL.ClearJobDownList(); locCache.ClearScanList(); queueBLL.UpdateQueueState(); - // queueboxBLL.UpdateQueueState(); + // queueboxBLL.UpdateQueueState(); orderbll.UpOrderstate(); UserCacheDAL.ClearUserCodeList(); boxcache.ClearBoxList(); ResultModel resultModel = comBLL.Initialization_M(); - GetOrderQueue(); //加载任务显示器信息 + // GetOrderQueue(); //加载任务显示器信息 + - LogHelper.WriteLogInfo("初始化@@@@@@@@@@@@!----V20200727-1---"); - - + + return resultModel; @@ -188,7 +189,7 @@ namespace Epost.BLL { LogHelper.WriteLogInfo("结束作业!"); OrisShow = false; - + Thread.Sleep(500); comBLL.CloseALL_M(); @@ -235,7 +236,7 @@ namespace Epost.BLL #region 标签拍下 public ResultModel Job_Down(string tblock) { - + lock (lockJobDown) { string[] nlist = tblock.Split('-'); @@ -305,7 +306,7 @@ namespace Epost.BLL } } //绑箱中 - + #endregion #region 设备拍下处理 @@ -340,7 +341,7 @@ namespace Epost.BLL skulist = queueDT.Rows[0]["sku"].ToString(); LogHelper.WriteLogInfo("=======" + qmodel.UserCode + "=====" + area + "区===sku=" + skulist); } - + if (data.Loc == "check")//任意回显标签拍下 熄灭回显设备 { List rejob = jobList.FindAll(m => m.Block == block && m.Area == area && m.State == 1 && m.Sku == queueDT.Rows[0]["sku"].ToString()); @@ -366,11 +367,11 @@ namespace Epost.BLL #region 清除当前区已做完的sku JobCache.UpdateJobModelList(rejob, EcommendType.Execute); #endregion - } + } else if (data.Result == "4")//■按键拍下 { data.Parameter = "0"; - jobdown_start(data, job, block, area, jobList); + jobdown_start(data, job, block, area, jobList); } else { @@ -387,119 +388,119 @@ namespace Epost.BLL #region 标签拍下 public void jobdown_start(ResultMessageModel data, List job, string block, string area, List jobList) - { - int truequantity = 0; - int checkquantity = 0; - string scanstr = data.Parameter; - if (!string.IsNullOrEmpty(scanstr)) - { - truequantity = Convert.ToInt32(scanstr); - } - if (job.Any()) - { - List downlist = new List(); - JobModel model = job.FirstOrDefault(); + { + //int truequantity = 0; + //int checkquantity = 0; + //string scanstr = data.Parameter; + //if (!string.IsNullOrEmpty(scanstr)) + //{ + // truequantity = Convert.ToInt32(scanstr); + //} + //if (job.Any()) + //{ + // List downlist = new List(); + // JobModel model = job.FirstOrDefault(); - //List manyList = job.FindAll(m => m.ManyState == 1 && m.Tolocation == model.Tolocation); - //if (manyList.Any())//合并显示数据 - //{ + // //List manyList = job.FindAll(m => m.ManyState == 1 && m.Tolocation == model.Tolocation); + // //if (manyList.Any())//合并显示数据 + // //{ - // downlist.AddRange(manyList); - // LogHelper.WriteLogInfo("合并显示数据=========="+ manyList .Count+ "=================="); - //} - //else - //{ - downlist.Add(model); - // } - //修改订单状态 - orderbll.UpdateOrderState_Car(downlist, model, truequantity, checkquantity); - LogHelper.WriteLogInfo(data.Address + "=========------------------" + data.Parameter); - bool skuInish = orderbll.IsFinishWork(1, block, "", area, model.Sku); - model.State = 3; - if (skuInish) - { - LogHelper.WriteLogInfo("区SKU拣选完成--------------"); - //删除sku缓存信息 - List scanlist = downCacheDAL.GetPlanJobDownList().FindAll(p => p.Parameter == model.Sku && p.Command == "QUERY_SPECIAL_STATUS" && p.Area == area); - downCacheDAL.UpdateJobDownModelList(scanlist, EdownCommend.Execute); - //熄灭通道灯 - comBLL.DISPLAY_LIGHT_BLOCK(block, area, "0"); + // // downlist.AddRange(manyList); + // // LogHelper.WriteLogInfo("合并显示数据=========="+ manyList .Count+ "=================="); + // //} + // //else + // //{ + // downlist.Add(model); + // // } + // //修改订单状态 + // orderbll.UpdateOrderState_Car(downlist, model, truequantity, checkquantity); + // LogHelper.WriteLogInfo(data.Address + "=========------------------" + data.Parameter); + // bool skuInish = orderbll.IsFinishWork(1, block, "", area, model.Sku); + // model.State = 3; + // if (skuInish) + // { + // LogHelper.WriteLogInfo("区SKU拣选完成--------------"); + // //删除sku缓存信息 + // List scanlist = downCacheDAL.GetPlanJobDownList().FindAll(p => p.Parameter == model.Sku && p.Command == "QUERY_SPECIAL_STATUS" && p.Area == area); + // downCacheDAL.UpdateJobDownModelList(scanlist, EdownCommend.Execute); + // //熄灭通道灯 + // comBLL.DISPLAY_LIGHT_BLOCK(block, area, "0"); - #region 熄灭当前区显示屏 - List offList = jobList.FindAll(m => m.Block == block && m.Area == area && m.State == 3 && m.Sku == model.Sku); - if (offList.Any()) - { - comBLL.LED_OFF_CLEAR(offList); - } - #endregion + // #region 熄灭当前区显示屏 + // List offList = jobList.FindAll(m => m.Block == block && m.Area == area && m.State == 3 && m.Sku == model.Sku); + // if (offList.Any()) + // { + // comBLL.LED_OFF_CLEAR(offList); + // } + // #endregion - #region 修改任务队列状态 - OrdersQueueModel qumodel = new OrdersQueueModel(); - qumodel.State = 3; - qumodel.Taskblock = block; - qumodel.Taskarea = area; - qumodel.Sku = model.Sku; - qumodel.Matchid = model.Matchid; - qumodel.UserCode = model.UserCode; - queueBLL.UpdateQueueTaskArea_Car(qumodel); - #endregion + // #region 修改任务队列状态 + // OrdersQueueModel qumodel = new OrdersQueueModel(); + // qumodel.State = 3; + // qumodel.Taskblock = block; + // qumodel.Taskarea = area; + // qumodel.Sku = model.Sku; + // qumodel.Matchid = model.Matchid; + // qumodel.UserCode = model.UserCode; + // queueBLL.UpdateQueueTaskArea_Car(qumodel); + // #endregion - #region 刷新波次信息 - showSummaryMes(model.Sku, block, area, Convert.ToInt32(block), null, model.Tolocation, model.Matchid); - #endregion + // #region 刷新波次信息 + // showSummaryMes(model.Sku, block, area, Convert.ToInt32(block), null, model.Tolocation, model.Matchid); + // #endregion - Thread.Sleep(30); - #region 整条通道当前用户所有任务分播结束 - bool blockfinish = orderbll.IsFinishWorkByCar(1, model.Matchid, block); - if (blockfinish) - { - #region 点亮显示器 - ShowMessageModel_M show = new ShowMessageModel_M(); - show.Title = "当前波次分播完成"; - show.Contents = "拍下熄灭所有设备\r请扫描继续作业"; - show.Color = EnumHelper.EMToDescriptionString(LightColor.Color.Green); - show.Qty = "0"; - show.Type = 8; - show.Block = block; - show.Islock = false; - show.IsTwinkle = 1; - show.No = "01"; - comBLL.ShowBoxMessage_M(show); - #endregion + // Thread.Sleep(30); + // #region 整条通道当前用户所有任务分播结束 + // bool blockfinish = orderbll.IsFinishWorkByCar(1, model.Matchid, block); + // if (blockfinish) + // { + // #region 点亮显示器 + // ShowMessageModel_M show = new ShowMessageModel_M(); + // show.Title = "当前波次分播完成"; + // show.Contents = "拍下熄灭所有设备\r请扫描继续作业"; + // show.Color = EnumHelper.EMToDescriptionString(LightColor.Color.Green); + // show.Qty = "0"; + // show.Type = 8; + // show.Block = block; + // show.Islock = false; + // show.IsTwinkle = 1; + // show.No = "01"; + // comBLL.ShowBoxMessage_M(show); + // #endregion - bool allfinish = orderbll.IsFinishWorkByCar(1, model.Matchid); - if (allfinish)//判断整个波次是否已完成 - { //更新state状态为已完成 - orderbll.UpdateStateByCar(model.Matchid); - } - //删除波次信息 - List ulist = UserCacheDAL.GetUserCodeList().FindAll(m => m.Block == block); - UserCacheDAL.UpdateUserCodeList(ulist, EUserCommend.Execute); + // bool allfinish = orderbll.IsFinishWorkByCar(1, model.Matchid); + // if (allfinish)//判断整个波次是否已完成 + // { //更新state状态为已完成 + // orderbll.UpdateStateByCar(model.Matchid); + // } + // //删除波次信息 + // List ulist = UserCacheDAL.GetUserCodeList().FindAll(m => m.Block == block); + // UserCacheDAL.UpdateUserCodeList(ulist, EUserCommend.Execute); - } - #endregion + // } + // #endregion - #region 区内sku播完回传 - // orderbll.UpdateStateByCar(model.Matchid, "", model.Sku); + // #region 区内sku播完回传 + // // orderbll.UpdateStateByCar(model.Matchid, "", model.Sku); - #endregion + // #endregion - #region 清除当前区已做完的sku - JobCache.UpdateJobModelList(offList, EcommendType.Execute); - #endregion + // #region 清除当前区已做完的sku + // JobCache.UpdateJobModelList(offList, EcommendType.Execute); + // #endregion - } + // } + + // } - } - } #endregion - + #region 标签控制M系列 public void DisplayJob_M(string tblock) { - + lock (lockobj) { @@ -561,71 +562,30 @@ namespace Epost.BLL #region 点亮任务标签 foreach (JobModel item in nowJoblist.ToArray()) { - - #region 回显设备锁定 - if (queueDT.Rows[0]["lightcolor"].ToString() == EnumHelper.EMToDescriptionString(LightColor.Color.Blue)) - { - - LabelParamModel locklamodel = new LabelParamModel(); - locklamodel.Address = item.Address.ToString(); - locklamodel.ControlIP = item.ControlIP.ToString(); - locklamodel.Command = "LOCK"; - locklamodel.Parameter = "11111000"; - locklamodel.Type = "N"; - list.Add(locklamodel); - - } - #endregion - // else - //{ - - List manyJoblist = nowJoblist.FindAll(m => m.Tolocation == item.Tolocation); - int quantity = item.Quantity; - - LabelParamModel lamodel = new LabelParamModel(); - - lamodel.Address = item.Address.ToString(); - lamodel.ControlIP = item.ControlIP.ToString(); - lamodel.Command = "DISPLAY_JOB"; - - #region 同一个货位的数据合并显示 - //if (manyJoblist.Count > 1) - //{ - // if (manyJoblist.FindAll(m => m.State == 0).Any()) - // { - // foreach (JobModel mitem in manyJoblist) - // { - // quantity += mitem.Quantity; - // mitem.State = 1; - // mitem.ManyState = 1; - // } - - // } - //} - #endregion - - lamodel.Uid = item.ID; - lamodel.Type = "N"; - lamodel.Quantity = quantity.ToString(); - lamodel.Uid = item.ID; - lamodel.Mode = queueDT.Rows[0]["lightcolor"].ToString() + "0"; - - list.Add(lamodel); - //} - - item.State = 1; - item.ColorCode = queueDT.Rows[0]["lightcolor"].ToString(); + #region 点亮灯带格口 + //先熄灭 + comBLL.Ledonoff_dengdai("0", ""); + Thread.Sleep(100); + comBLL.display_dengdai(item.Tolocation, "2"); + #endregion + item.State = 3; item.DisplayTime = DateTime.Now; + #region 更新订单状态 + orderbll.UpdateOrderState_Car(item.Matchid, item.Tolocation, "3"); + model.State = 3; + bool allfinish = orderbll.IsFinishWorkByCar(1, item.Matchid); + if (allfinish)//判断整个波次是否已完成 + { //更新state状态为已完成 + orderbll.UpdateStateByCar(item.Matchid); + //删除波次信息 + List ulist = UserCacheDAL.GetUserCodeList(); + UserCacheDAL.UpdateUserCodeList(ulist, EUserCommend.Execute); + } + + #endregion } #endregion - #region 点亮通道灯 - comBLL.DISPLAY_LIGHT_BLOCK(model.Taskblock, model.Taskarea, "1"); - #endregion - if (list != null && list.Count > 0) - { - LogHelper.WriteLogInfo("添加到点亮的list————————————————————:" + list.Count); - comBLL.DISPLAY_JOBALL(list); - } + } else {//无任务 @@ -633,22 +593,15 @@ namespace Epost.BLL model.State = 3; } #endregion - if (jobList.Any()) - { - - var finishList = jobList.FindAll(p => p.State == 0); - if (!finishList.Any()) - { - queueBLL.UpdateQueueOrderState(model);//缓存队列状态修改 - } - } + queueBLL.UpdateQueueOrderState(model);//缓存队列状态修改 } - else { - + else + { + LogHelper.WriteLogInfo("还有未完成任务" + isJobList.Count); foreach (JobModel item in isJobList) { - LogHelper.WriteLogInfo("还有未完成任务"+item.Address+item.ID); + LogHelper.WriteLogInfo("还有未完成任务" + item.Address + item.ID); } } } @@ -672,37 +625,38 @@ namespace Epost.BLL if (!ulist.Any()) { - //手动加波次信息 - DataTable matdt = orderbll.GetMatchOrderList(); - if (matdt != null && matdt.Rows.Count > 0) + if (scanStr.Substring(0, 1) == "S") //扫描分播墙号 { UserCodeModel umodel = new UserCodeModel(); - umodel.Matchid = matdt.Rows[0]["matchid"].ToString(); + umodel.Matchid = data.Parameter;//分播墙号 + matchid = data.Parameter; umodel.Block = sblock; umodel.Area = sarea; UserCacheDAL.UpdateUserCodeList(new List { umodel }, EUserCommend.Create); + LogHelper.WriteLogInfo("扫描播种墙号" + data.Parameter); + } + else + { + LogHelper.WriteLogInfo(scanStr + "请扫描正确的播种墙号"); } - } - ulist = UserCacheDAL.GetUserCodeList().FindAll(m => m.Block == sblock && m.Area == sarea); - if (ulist.Any()) - { matchid = ulist.FirstOrDefault().Matchid; } - - #endregion - if (data.Type == "5")//中分扫描枪 - { - - zhongfenBind(ulist, scanStr, data); downCacheDAL.UpdateJobDownModelList(new List { data }, EdownCommend.Execute); } - else if (data.Type == "6")//播种扫描枪 + else { + ulist = UserCacheDAL.GetUserCodeList().FindAll(m => m.Block == sblock && m.Area == sarea); + if (ulist.Any()) + { matchid = ulist.FirstOrDefault().Matchid; } - xifenBind(ulist, scanStr, data, matchid, isnum); + #endregion + if (data.Type == "6")//播种扫描枪 + { + + xifenBind(ulist, scanStr, data, matchid, isnum); + + downCacheDAL.UpdateJobDownModelList(new List { data }, EdownCommend.Execute); + } - downCacheDAL.UpdateJobDownModelList(new List { data }, EdownCommend.Execute); } - - return res; } catch (Exception ex) @@ -780,7 +734,7 @@ namespace Epost.BLL { foreach (AddressstorageModel item in Arealist) { - DataTable skudt = orderbll.GetSumList("", scanStr, item.block,item.area); + DataTable skudt = orderbll.GetSumList("", scanStr, item.block, item.area); if (skudt != null && skudt.Rows.Count > 0) { //规格 @@ -827,7 +781,7 @@ namespace Epost.BLL } } } - + #endregion } @@ -838,26 +792,7 @@ namespace Epost.BLL #region 细分播种 public void xifenBind(List ulist, string scanStr, ResultMessageModel data, string matchid, bool isnum) { - //if (ulist.Any()) - //{ - // UserCodeModel usermodel = ulist.FirstOrDefault(); - //if (string.IsNullOrEmpty(usermodel.UserCode) && scanStr.Substring(0, 1) != "U")// - //{ - // #region 提示先扫描工号 - // ShowMessageModel_M show = new ShowMessageModel_M(); - // show.Title = "请先扫描工号!"; - // show.Contents = ""; - // show.Color = EnumHelper.EMToDescriptionString(LightColor.Color.Red); - // show.Block = sblock; - // show.Area = sarea; - // show.Type = 8; - // show.Islock = true; - // comBLL.ShowBoxMessage_M(show); - // downCacheDAL.UpdateJobDownModelList(new List { data }, EdownCommend.Execute); - // #endregion - //} - //else - //{ + if (scanStr.Substring(0, 1) == "U") { @@ -875,7 +810,7 @@ namespace Epost.BLL show.Area = data.Area; show.Type = 8; show.Islock = true; - + comBLL.ShowBoxMessage_M(show); #endregion } @@ -921,14 +856,14 @@ namespace Epost.BLL #region 扫描SKU //根据扫描商品内码获取商品码 data.ScanCode = data.Parameter; - DataTable sinfodt = skuBLL.GetSkuInfoList(data.Parameter); - string location = string.Empty; - if (sinfodt != null && sinfodt.Rows.Count > 0) - { - scanStr = sinfodt.Rows[0]["sku"].ToString(); - location = data.Parameter;// sinfodt.Rows[0]["tolocation"].ToString(); - } - data.Parameter = scanStr; + //DataTable sinfodt = skuBLL.GetSkuInfoList(data.Parameter); + //string location = string.Empty; + //if (sinfodt != null && sinfodt.Rows.Count > 0) + //{ + // scanStr = sinfodt.Rows[0]["sku"].ToString(); + // location = data.Parameter;// sinfodt.Rows[0]["tolocation"].ToString(); + //} + //data.Parameter = scanStr; DataTable skudt = queueBLL.GetOrderQueue(data.Block, data.Area, "3"); List scanlist = downCacheDAL.GetPlanJobDownList().FindAll(m => m.Address == data.Address && m.Parameter == scanStr && m.Parameter != "888888" && m.Block == data.Block && m.Area == data.Area); @@ -954,18 +889,17 @@ namespace Epost.BLL if (ulist.Any()) { UserCodeModel umodel = ulist.FirstOrDefault(); - data.Port = OrderDt.Rows[0]["matchid"].ToString(); OrdersQueueModel qmodel = new OrdersQueueModel(); qmodel.Sku = scanStr; qmodel.Taskblock = data.Block; qmodel.Taskarea = data.Area; qmodel.UserCode = umodel.UserCode; qmodel.Matchid = umodel.Matchid; - qmodel.Location = location; + qmodel.Location = scanStr; qmodel.Lightcolor = EnumHelper.EMToDescriptionString(LightColor.Color.Red); queueBLL.insertQueueOrders(qmodel); //提示需要拣货总量/商品名称 - showSummaryMes(scanStr, data.Block, data.Area, 1, data, "", OrderDt.Rows[0]["matchid"].ToString()); + //showSummaryMes(scanStr, data.Block, data.Area, 1, data, "", OrderDt.Rows[0]["matchid"].ToString()); } else @@ -976,50 +910,21 @@ namespace Epost.BLL } else { - #region 回显 - DataTable echoDt = orderbll.GetOrderList_echo(matchid, scanStr, data.Area, data.Block); - if (echoDt != null && echoDt.Rows.Count > 0) - { - if (ulist.Any()) - { - UserCodeModel umodel = ulist.FirstOrDefault(); - data.Port = echoDt.Rows[0]["matchid"].ToString(); - OrdersQueueModel qmodel = new OrdersQueueModel(); - qmodel.Sku = scanStr; - qmodel.Taskblock = data.Block; - qmodel.Taskarea = data.Area; - qmodel.UserCode = umodel.UserCode; - qmodel.Matchid = umodel.Matchid; - // qmodel.Location = location; - qmodel.Lightcolor = EnumHelper.EMToDescriptionString(LightColor.Color.Blue); - queueBLL.insertQueueOrders(qmodel); - //提示需要拣货总量/商品名称 - Mes_Echo(scanStr, data.Block, data.Area, 1, data, "", echoDt.Rows[0]["matchid"].ToString(), false); - } - else - { - LogHelper.WriteLogInfo("未扫描波次信息", LogHelper.Log_Type.ERROR); - } + //提示无任务 + ShowMessageModel_M show = new ShowMessageModel_M(); + show.Title = "商品:" + scanStr + "当前区无任务!"; + show.Color = EnumHelper.EMToDescriptionString(LightColor.Color.Red); + show.Block = data.Block; + show.Area = data.Area; + show.Type = 8; + show.Islock = false; + comBLL.ShowBoxMessage_M(show); + downCacheDAL.UpdateJobDownModelList(new List { data }, EdownCommend.Execute); - } - else - { - //提示无任务 - ShowMessageModel_M show = new ShowMessageModel_M(); - show.Title = "商品:" + scanStr + "当前区无任务!"; - show.Color = EnumHelper.EMToDescriptionString(LightColor.Color.Red); - show.Block = data.Block; - show.Area = data.Area; - show.Type = 8; - show.Islock = false; - comBLL.ShowBoxMessage_M(show); - downCacheDAL.UpdateJobDownModelList(new List { data }, EdownCommend.Execute); - } - #endregion } } @@ -1086,8 +991,8 @@ namespace Epost.BLL } if (data != null) { - - show.Contents = data.ScanCode + "(" + scanStr + ")" + "\r"+ mes; + + show.Contents = data.ScanCode + "(" + scanStr + ")" + "\r" + mes; sku = data.Parameter; } show.Color = EnumHelper.EMToDescriptionString(LightColor.Color.Blue); @@ -1244,7 +1149,7 @@ namespace Epost.BLL int discount = Convert.ToInt32(sudt.Rows[0]["discount"].ToString()); //整件总数 int SumCkQuantity = 0; //Convert.ToInt32(sudt.Rows[0]["SumCkQuantity"].ToString()); - //散件总数 + //散件总数 int SumQuantity = Convert.ToInt32(sudt.Rows[0]["SumQuantity"].ToString()); //if (discount != 1) //{ @@ -1261,11 +1166,11 @@ namespace Epost.BLL if (qdt != null && qdt.Rows.Count > 0) { - show.Contents = qdt.Rows[0]["location"].ToString() + "(" + scanStr + ")" + "\r"+ mes;//sudt.Rows[0]["goodscode"].ToString().Replace(';','\r'); + show.Contents = qdt.Rows[0]["location"].ToString() + "(" + scanStr + ")" + "\r" + mes;//sudt.Rows[0]["goodscode"].ToString().Replace(';','\r'); } if (data != null) { - show.Contents = data.ScanCode + "(" + scanStr + ")" + "\r"+ mes;// sudt.Rows[0]["goodscode"].ToString().Replace(';', '\r'); + show.Contents = data.ScanCode + "(" + scanStr + ")" + "\r" + mes;// sudt.Rows[0]["goodscode"].ToString().Replace(';', '\r'); sku = data.Parameter; } show.Color = EnumHelper.EMToDescriptionString(LightColor.Color.Green); diff --git a/Epost.DAL/AddressstorageDAL.cs b/Epost.DAL/AddressstorageDAL.cs index 1a4c8a2..86c9024 100644 --- a/Epost.DAL/AddressstorageDAL.cs +++ b/Epost.DAL/AddressstorageDAL.cs @@ -822,7 +822,7 @@ namespace Epost.DAL #region 查询设备信息 public DataTable QueryControlList(string strwhere) { - string sql = string.Format(" select distinct controlip ,port,waveno,address from v_address where 1=1 " + strwhere); + string sql = string.Format(" select distinct controlip ,port,address from v_address where type<>6 " + strwhere); return db.GetsqlForDT(sql); } diff --git a/Epost.DAL/OrdersDAL.cs b/Epost.DAL/OrdersDAL.cs index c6c365e..5eb7c90 100644 --- a/Epost.DAL/OrdersDAL.cs +++ b/Epost.DAL/OrdersDAL.cs @@ -48,7 +48,7 @@ namespace Epost.DAL string sql = string.Empty; if (!string.IsNullOrEmpty(area)) { - sql = string.Format("select id, ProdArea, LotNo, Matchid, orderid, barcode, BatchId, DownDate, Tolocation, Sku, GoodsName, Discount, Quantity, GoodsType, corlorcode, address, ControlIP,area, block,boxcode,bkbarcode,isnull(checkquantity,0) as checkquantity,wholeunit,unit,shopid,wmsboxcode from v_orders where state = 0 and oprationstate <>3 and sku = '{0}' and block = '{1}' and area='{2}' " + strwhere + "", + sql = string.Format("select distinct fromlocation,sku,block,area from v_orders where state = 0 and oprationstate <>3 and (sku = '{0}' or fromlocation='{0}') and block = '{1}' and area='{2}' " + strwhere + "", sku, block, area); @@ -56,7 +56,7 @@ namespace Epost.DAL } else { - sql = string.Format("select id,ProdArea, LotNo, Matchid, orderid, barcode, BatchId, DownDate, Tolocation, Sku, GoodsName, Discount, Quantity, GoodsType, corlorcode, address, ControlIP, area , block,boxcode,bkbarcode,isnull(checkquantity,0) as checkquantity,wholeunit,unit,shopid,wmsboxcode from v_orders where state = 0 and oprationstate <>3 and sku = '{0}' and block = '{1}' " + strwhere + "", + sql = string.Format("select distinct fromlocation,block,area from v_orders where state = 0 and oprationstate <>3 (and sku = '{0}'or fromlocation='{0}') and block = '{1}' " + strwhere + "", sku, block); @@ -622,38 +622,17 @@ namespace Epost.DAL #endregion #region 修改当前标签拣货状态 - public bool UpdateWorkState_Car(string matchid, int truequantity, string sku, string id, int checkquantity, string usercode = "") + public bool UpdateWorkState_Car(string matchid,string fromlocation,string oprationstate ) { try { lock (uplock) { - int oprationstate = 3; - // string sql = string.Format("select quantity,truequantity from orders where matchid='{0}' and sku = '{1}' and batchid='{2}'", - // matchid, - // sku, - // batchid); - - //DataTable dt= db.GetsqlForDT(sql); - // if (dt!=null&&dt.Rows.Count > 0) - // { - // int trueqty =Convert.ToInt32( dt.Rows[0]["truequantity"].ToString()); - // int quantity =Convert.ToInt32( dt.Rows[0]["quantity"].ToString()); - - // if (trueqty + 1 == quantity) - // { - // oprationstate = 3; - // } - // truequantity = trueqty + 1; - // } - string upsql = string.Format("update orders set oprationstate = '{3}' ,oprationtime='{0}',oprationcode='{5}',truequantity='{1}' where matchid='{2}' and id='{4}' ", - DateTime.Now.ToString(), - truequantity, + string upsql = string.Format("update orders set oprationstate = '{0}' ,oprationtime='{1}' ,truequantity=quantity where matchid='{2}' and fromlocation='{3}' ", + oprationstate, + DateTime.Now.ToString(), matchid, - oprationstate, - id, - // checkquantity, - usercode + fromlocation ); long x = db.UpdateSql(upsql); if (x > 0) diff --git a/Epost.TestToolsWeb/Controllers/ServerController.cs b/Epost.TestToolsWeb/Controllers/ServerController.cs index a40af67..a05da87 100644 --- a/Epost.TestToolsWeb/Controllers/ServerController.cs +++ b/Epost.TestToolsWeb/Controllers/ServerController.cs @@ -15,11 +15,16 @@ using Microsoft.Owin.BuilderProperties; namespace Epost.DPS.Controllers { - [RoutePrefix("api/TaskAPI")] + [RoutePrefix("api/WebAPI")] public class ServerController : ApiController { AddressstorageBLL addrbll = new AddressstorageBLL(); LightControlCacheDAL cachedal = new LightControlCacheDAL(); + private static object lockinit = new object(); + + + OrderControlBLL contrbll = new OrderControlBLL(); + MainControl lig = new MainControl(); #region 连接 [Route("CONNECT")] @@ -36,7 +41,7 @@ namespace Epost.DPS.Controllers { if (item.status == "1")//连接 { - DataTable dt = addrbll.QueryControlList(" and waveno ='" + item.wallNo + "'"); + DataTable dt = addrbll.QueryControlList(" "); if (dt != null && dt.Rows.Count > 0) { foreach (DataRow rowitem in dt.Rows) @@ -131,7 +136,7 @@ namespace Epost.DPS.Controllers { //根据播种墙号查询灯带IP - DataTable dt = addrbll.QueryControlList(" and waveno ='" + item.wallNo + "'"); + DataTable dt = addrbll.QueryControlList(" "); if (dt != null && dt.Rows.Count > 0) { foreach (DataRow rowitem in dt.Rows) @@ -225,7 +230,7 @@ namespace Epost.DPS.Controllers foreach (DisplayjobModelReq item in data) { //根据播种墙号查询灯带IP - DataTable dt = addrbll.QueryControlList(" and waveno ='" + item.wallNo + "'"); + DataTable dt = addrbll.QueryControlList(""); if (dt != null && dt.Rows.Count > 0) { foreach (DataRow rowitem in dt.Rows) @@ -235,7 +240,7 @@ namespace Epost.DPS.Controllers if (conlist != null && conlist.Count > 0) { MainControl control = conlist.FirstOrDefault().maincontrol; - DataTable locdt = addrbll.QueryAddrList(" and waveno ='" + item.wallNo + "' and location ='" + item.location + "' and controlip='" + ipaddress + "'"); + DataTable locdt = addrbll.QueryAddrList(" and location ='" + item.location + "' and controlip='" + ipaddress + "'"); if (locdt != null && locdt.Rows.Count > 0) { List list = new List(); @@ -305,6 +310,71 @@ namespace Epost.DPS.Controllers #endregion + //初始化 + [Route("ClearALL")] + [HttpPost] + public ResultModel ClearALL() + { + lock (lockinit) + { + ResultModel res = new ResultModel(); + try + { + res = contrbll.ClearALL(); + return res; + + } + catch (Exception ex) + { + LogHelper.WriteLogInfo("GetDataList异常:" + ex.Message); + res.msg = "请求异常!"; + res.result = "-1"; + return res; + + } + } + + } + + [Route("StartWork")] + [HttpPost] + public ResultModel StartWork() + { + lock (lockinit) + { + ResultModel res = new ResultModel(); + try + { + contrbll.StartWork(); + res.msg = "成功!"; + res.result = "0"; + } + catch (Exception ex) + { + + LogHelper.WriteLogInfo("启动作业异常" + ex.ToString(), LogHelper.Log_Type.ERROR); + res.msg = "启动作业异常!"; + res.result = "-1"; + } + + return res; + } + } + #region 停止作业 + [Route("EndWork")] + [HttpPost] + public ResultModel EndWork() + { + lock (lockinit) + { + ResultModel res = new ResultModel(); + contrbll.EndWork(); + res.msg = "成功!"; + res.result = "0"; + return res; + } + } + #endregion } } diff --git a/Epost.TestToolsWeb/Epost.DPS.csproj.user b/Epost.TestToolsWeb/Epost.DPS.csproj.user index b1a2138..044be83 100644 --- a/Epost.TestToolsWeb/Epost.DPS.csproj.user +++ b/Epost.TestToolsWeb/Epost.DPS.csproj.user @@ -11,7 +11,7 @@ False 600 E:\WORK\代码管理\T系列\播种\Epost.TestToolsWeb\Properties\PublishProfiles\Toolsweb.pubxml - Release|Any CPU + Debug|Any CPU diff --git a/Epost.TestToolsWeb/Properties/PublishProfiles/Toolsweb.pubxml b/Epost.TestToolsWeb/Properties/PublishProfiles/Toolsweb.pubxml index a23dedd..e011dd5 100644 --- a/Epost.TestToolsWeb/Properties/PublishProfiles/Toolsweb.pubxml +++ b/Epost.TestToolsWeb/Properties/PublishProfiles/Toolsweb.pubxml @@ -9,13 +9,13 @@ Release Any CPU - True - False - D:\驿传\T系列 - True - True - True - False + true + false + D:\驿传\T系列\taitan_songjiang_dengdai + true + true + true + false DonotMerge \ No newline at end of file diff --git a/Epost.TestToolsWeb/Properties/PublishProfiles/Toolsweb.pubxml.user b/Epost.TestToolsWeb/Properties/PublishProfiles/Toolsweb.pubxml.user index ae641fd..88608eb 100644 --- a/Epost.TestToolsWeb/Properties/PublishProfiles/Toolsweb.pubxml.user +++ b/Epost.TestToolsWeb/Properties/PublishProfiles/Toolsweb.pubxml.user @@ -6,8 +6,8 @@ - <_PublishTargetUrl>D:\驿传\T系列 - True|2023-04-23T07:53:28.0062911Z;True|2023-04-22T10:28:09.9896404+08:00;True|2023-04-20T10:35:53.5768979+08:00;True|2022-07-15T16:41:13.9750291+08:00;True|2022-07-14T14:02:20.7983427+08:00;True|2022-07-13T17:40:22.7531000+08:00;True|2022-07-13T17:34:22.9908701+08:00;True|2022-07-13T17:30:06.3588502+08:00;True|2022-07-11T10:32:06.9053981+08:00;True|2021-04-26T10:07:37.4889549+08:00;True|2021-04-09T10:32:51.9130162+08:00;True|2021-04-09T10:31:50.4974012+08:00; + <_PublishTargetUrl>D:\驿传\T系列\taitan_songjiang_dengdai + True|2023-11-30T11:07:23.8812051Z;True|2023-04-23T15:53:28.0062911+08:00;True|2023-04-22T10:28:09.9896404+08:00;True|2023-04-20T10:35:53.5768979+08:00;True|2022-07-15T16:41:13.9750291+08:00;True|2022-07-14T14:02:20.7983427+08:00;True|2022-07-13T17:40:22.7531000+08:00;True|2022-07-13T17:34:22.9908701+08:00;True|2022-07-13T17:30:06.3588502+08:00;True|2022-07-11T10:32:06.9053981+08:00;True|2021-04-26T10:07:37.4889549+08:00;True|2021-04-09T10:32:51.9130162+08:00;True|2021-04-09T10:31:50.4974012+08:00; @@ -33,19 +33,19 @@ 04/04/2018 15:45:12 - 04/23/2023 15:53:24 + 11/30/2023 19:14:26 - 04/23/2023 15:53:24 + 11/30/2023 19:14:26 02/24/2020 15:29:24 - 04/23/2023 15:53:13 + 11/30/2023 19:07:11 - 04/23/2023 15:53:13 + 11/30/2023 19:07:11 04/29/2020 16:50:14 @@ -63,31 +63,31 @@ 10/23/2017 13:15:20 - 04/23/2023 15:53:14 + 11/30/2023 19:07:11 - 04/23/2023 15:53:14 + 11/30/2023 19:07:11 08/26/2020 18:09:48 - 04/23/2023 15:53:14 + 11/30/2023 19:07:11 - 04/23/2023 15:53:14 + 11/30/2023 19:07:11 - 04/23/2023 15:53:16 + 11/30/2023 19:14:06 - 04/23/2023 15:53:16 + 11/30/2023 19:14:06 - 04/22/2023 10:27:45 + 11/30/2023 19:07:11 - 04/22/2023 10:27:45 + 11/30/2023 19:07:11 09/06/2018 11:57:11 @@ -114,10 +114,10 @@ 08/09/2019 08:40:22 - 04/22/2023 10:23:53 + 09/14/2023 16:31:13 - 04/22/2023 10:23:53 + 09/14/2023 16:31:13 03/08/2017 19:26:22 @@ -5658,7 +5658,7 @@ 05/30/2022 16:58:47 - 04/23/2023 15:53:18 + 11/30/2023 19:14:22 04/04/2018 15:45:12 @@ -7578,7 +7578,7 @@ 07/04/2022 14:22:38 - 04/22/2023 10:27:50 + 11/30/2023 19:07:14 \ No newline at end of file diff --git a/Epost.TestToolsWeb/Web.config b/Epost.TestToolsWeb/Web.config index e5369e9..8a73db7 100644 --- a/Epost.TestToolsWeb/Web.config +++ b/Epost.TestToolsWeb/Web.config @@ -11,7 +11,7 @@ - +