From d5e45f63b4d5c3c1e235692e44ea487b11a25318 Mon Sep 17 00:00:00 2001 From: jl Date: Mon, 2 Sep 2024 16:42:28 +0800 Subject: [PATCH] --- Epost.BLL/CommandBLL.cs | 10 +- Epost.BLL/Epost.BLL.csproj | 1 + Epost.BLL/OrderBLL.cs | 4 +- Epost.BLL/OrderControlBLL.cs | 21 +- Epost.BLL/Work_DisplayJobThread.cs | 33 +- Epost.BLL/Work_JobDownThread.cs | 32 +- Epost.BLL/Work_ScanThread.cs | 564 ++++++++++++++++++ Epost.DAL/OrdersDAL.cs | 18 +- Epost.TestToolsWeb/Epost.DPS.csproj.user | 2 +- .../PublishProfiles/Toolsweb.pubxml.user | 31 +- Epost.TestToolsWeb/Web.config | 2 +- 11 files changed, 663 insertions(+), 55 deletions(-) create mode 100644 Epost.BLL/Work_ScanThread.cs diff --git a/Epost.BLL/CommandBLL.cs b/Epost.BLL/CommandBLL.cs index 7d6971d..e5432b5 100644 --- a/Epost.BLL/CommandBLL.cs +++ b/Epost.BLL/CommandBLL.cs @@ -638,7 +638,15 @@ namespace Epost.BLL LabelParamModel model = new LabelParamModel(); model.Address = addritem["address"].ToString(); model.ControlIP = addritem["controlip"].ToString(); - model.Parameter =show.No; + model.Parameter =show.No; + model.Uid = show.Uid; + if (string.IsNullOrEmpty(show.Uid)) + { model.Uid = addritem["address"].ToString(); } + model.Type = "N"; + if (addritem["addresstype"].ToString() == "2") + { + model.Type = "C"; + } model.Command = "REMOVE_JOB"; model.Timeout = "0.5"; list.Add(model); diff --git a/Epost.BLL/Epost.BLL.csproj b/Epost.BLL/Epost.BLL.csproj index 5406060..1876439 100644 --- a/Epost.BLL/Epost.BLL.csproj +++ b/Epost.BLL/Epost.BLL.csproj @@ -117,6 +117,7 @@ + diff --git a/Epost.BLL/OrderBLL.cs b/Epost.BLL/OrderBLL.cs index fd941c7..c6c0ed2 100644 --- a/Epost.BLL/OrderBLL.cs +++ b/Epost.BLL/OrderBLL.cs @@ -924,9 +924,9 @@ namespace Epost.BLL return dal.getOrderListBysku(block, sku); } - public bool UpOrderStateBybat(string batchid) + public bool UpOrderStateBybat(string id) { - return dal.UpOrderStateBybat(batchid); + return dal.UpOrderStateBybat(id); } diff --git a/Epost.BLL/OrderControlBLL.cs b/Epost.BLL/OrderControlBLL.cs index e875097..f054fbb 100644 --- a/Epost.BLL/OrderControlBLL.cs +++ b/Epost.BLL/OrderControlBLL.cs @@ -49,7 +49,7 @@ namespace Epost.BLL UserCacheDAL.ClearUserCodeList(); boxcache.ClearBoxList(); ResultModel resultModel = comBLL.Initialization_M(); - GetOrderQueue(); //加载任务显示器信息 + // GetOrderQueue(); //加载任务显示器信息 return resultModel; } @@ -81,6 +81,8 @@ namespace Epost.BLL downthread.tblock = "01|01"; Work_DisplayJobThread jobthread = new Work_DisplayJobThread(); jobthread.tblock = "01|01"; + Work_ScanThread scantherad = new Work_ScanThread(); + scantherad.tblock = "01|01"; foreach (AddressstorageModel item in Arealist) { string block = item.block + "|" + item.shelfid; @@ -98,6 +100,13 @@ namespace Epost.BLL downthread.OrisShow = OrisShow; Thread thread = new Thread(new ThreadStart(downthread.Work)); thread.Start(); + + scantherad = new Work_ScanThread(); + scantherad.id = block; + scantherad.tblock = block; + scantherad.OrisShow = OrisShow; + Thread scanthread = new Thread(new ThreadStart(scantherad.ScanList)); + scanthread.Start(); } } } @@ -293,12 +302,12 @@ namespace Epost.BLL lock (showmes) { - bool bo = orderbll.isTask(sblock, sarea); + // bool bo = orderbll.isTask(sblock, sarea); string msg = string.Empty; - if (!bo) - { - msg = "当前商品无任务\r请送至下一区"; - } + //if (!bo) + //{ + // msg = "当前商品无任务\r请送至下一区"; + //} DataTable sudt = orderbll.GetSumList("", scanStr, sblock); if (type == 2) { diff --git a/Epost.BLL/Work_DisplayJobThread.cs b/Epost.BLL/Work_DisplayJobThread.cs index 313eb0b..324f930 100644 --- a/Epost.BLL/Work_DisplayJobThread.cs +++ b/Epost.BLL/Work_DisplayJobThread.cs @@ -2,6 +2,7 @@ using Epost.DAL.Cache; using Epost.DAL.Enum; using Epost.Model; +using Epost.Model.resource; using System; using System.Collections.Generic; using System.Data; @@ -31,8 +32,10 @@ namespace Epost.BLL #region 获取订单信息 private void GetWorkList(object block) { - - lock (lockobj) + string cm = ""; + cm = "lockdisJob" + block; + object c = (Object)cm; + lock (c) { while (OrisShow) { @@ -91,6 +94,24 @@ namespace Epost.BLL //当前区没有作业 if (queueDT.Rows[0]["state"].ToString() == "0") { + #region 点亮显示器 + ShowMessageModel_M showmodel = new ShowMessageModel_M(); + showmodel.Area = shelfid; + showmodel.Block = nblock; + showmodel.Color = queueDT.Rows[0]["lightcolor"].ToString();//EnumHelper.EMToDescriptionString(LightColor.Color.Red); + showmodel.Contents = queueDT.Rows[0]["sku"].ToString(); + showmodel.Title = queueDT.Rows[0]["Shopid"].ToString(); + showmodel.Islock = true; + + showmodel.IsTwinkle = 0; + showmodel.Type = 8; + DataTable sudt = orderbll.GetSumList("", queueDT.Rows[0]["sku"].ToString(), nblock); + if (sudt != null && sudt.Rows.Count > 0) + { + showmodel.Qty = sudt.Rows[0]["SumQuantity"].ToString(); + } + comBLL.ShowBoxMessage_M(showmodel);//点亮显示标签 + #endregion displayOrder(queueDT, nblock, item.area, model); } } @@ -153,13 +174,10 @@ namespace Epost.BLL 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) //{ @@ -175,15 +193,12 @@ namespace Epost.BLL // } //} #endregion - lamodel.Type = "N"; lamodel.Quantity = quantity.ToString(); lamodel.Uid = "U" + item.ID; lamodel.Mode = queueDT.Rows[0]["lightcolor"].ToString() + "0"; - list.Add(lamodel); //} - item.State = 1; item.ColorCode = queueDT.Rows[0]["lightcolor"].ToString(); item.DisplayTime = DateTime.Now; @@ -194,7 +209,7 @@ namespace Epost.BLL #endregion if (list != null && list.Count > 0) { - LogHelper.WriteLogInfo("添加到点亮的list————————————————————:" + list.Count); + LogHelper.WriteLogInfo("添加到点亮的list————————:" + list.Count); comBLL.DISPLAY_JOBALL(list); } } diff --git a/Epost.BLL/Work_JobDownThread.cs b/Epost.BLL/Work_JobDownThread.cs index 3c7a6d3..b0c9831 100644 --- a/Epost.BLL/Work_JobDownThread.cs +++ b/Epost.BLL/Work_JobDownThread.cs @@ -37,10 +37,12 @@ namespace Epost.BLL #region 获取订单信息 private void BackWorkList(object block) { - - lock (lockJobDown) - { + string cm = ""; + cm = "lockJobDown" + block; + object c = (Object)cm; + lock (c) + { while (OrisShow) { try @@ -75,13 +77,13 @@ namespace Epost.BLL { try { - string[] nlist = tblock.Split('-'); + string[] nlist = tblock.Split('|'); string nblock = nlist[0]; string shelfid = nlist[1]; List Arealist = addrBLL.GetAreaList(nblock, shelfid); foreach (AddressstorageModel item in Arealist) { - List downList = downCacheDAL.GetPlanJobDownList().FindAll(m => m.Status == "0" && m.Block == nblock && m.Area == item.area); + List downList = downCacheDAL.GetPlanJobDownList().FindAll(m => m.Status == "0" && m.Block == nblock && m.Area == item.area&&m.Command== "JOB_DONE"); List jobList = JobCache.GetPlanJobList().FindAll(p => p.Block == nblock && p.Area == item.area); if (downList != null && downList.Count > 0) @@ -115,9 +117,7 @@ namespace Epost.BLL switch (data.Command) { - case "QUERY_SPECIAL_STATUS": - BindJobList(data); - break; + case "JOB_DONE": JobDown_M(data, jobList); break; @@ -262,6 +262,16 @@ namespace Epost.BLL { comBLL.LED_OFF_CLEAR(offList); } + + ShowMessageModel_M show = new ShowMessageModel_M(); + show.Title = "分播完成"; + show.Contents = "请扫描继续作业"; + show.Color = EnumHelper.EMToDescriptionString(LightColor.Color.Green); + show.Type = 8; + show.Block = block; + show.Islock = false; + show.IsTwinkle = 1; + comBLL.ShowBoxMessage_M(show); #endregion #region 修改任务队列状态 @@ -285,7 +295,7 @@ namespace Epost.BLL if (blockfinish) { #region 点亮显示器 - ShowMessageModel_M show = new ShowMessageModel_M(); + show.Title = "当前波次分播完成"; show.Contents = "拍下熄灭所有设备\r请扫描继续作业"; show.Color = EnumHelper.EMToDescriptionString(LightColor.Color.Green); @@ -294,7 +304,7 @@ namespace Epost.BLL show.Block = block; show.Islock = false; show.IsTwinkle = 1; - show.No = "01"; + comBLL.ShowBoxMessage_M(show); #endregion @@ -971,7 +981,7 @@ namespace Epost.BLL lamodel.Command = "REMOVE_JOB"; lamodel.Parameter = "01"; list.Add(lamodel); - orderbll.UpOrderStateBybat(item["batchid"].ToString()); + orderbll.UpOrderStateBybat(item["id"].ToString()); } } if (list != null && list.Count > 0) diff --git a/Epost.BLL/Work_ScanThread.cs b/Epost.BLL/Work_ScanThread.cs new file mode 100644 index 0000000..f1f6728 --- /dev/null +++ b/Epost.BLL/Work_ScanThread.cs @@ -0,0 +1,564 @@ +using Epost.Common; +using Epost.DAL.Cache; +using Epost.DAL.Enum; +using Epost.Model; +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; + +namespace Epost.BLL +{ + public class Work_ScanThread + { + public string tblock, id; + public bool OrisShow = false; + OrderBLL orderbll = new OrderBLL(); + OrdersQueueBLL queueBLL = new OrdersQueueBLL(); + CommandBLL comBLL = new CommandBLL(); + JobDownCacheDAL downCacheDAL = new JobDownCacheDAL(); + JobModelCacheDAL JobCache = new JobModelCacheDAL(); + AddressstorageBLL addrBLL = new AddressstorageBLL(); + private static object lockscanList = new object(); + public static bool OrcheckisShow = false; + WorkIngCacheDAL workbll = new WorkIngCacheDAL(); + SkuInfoBLL skuBLL = new SkuInfoBLL(); + UserModelCacheDAL UserCacheDAL = new UserModelCacheDAL(); + public void ScanList() + { + GetScanList(tblock); + } + + #region 获取扫描信息 + private void GetScanList(object block) + { + string job = ""; + job = "lockScan" + block; + object cJob = (object)job; + lock (cJob) + { + while (OrisShow) + { + try + { + string workstate = workbll.GetWorkState(); + if (!string.IsNullOrEmpty(workstate)) + { + OrisShow = true; + JobScanList(block.ToString()); + Thread.Sleep(50); + } + else + { + OrisShow = false; + } + + + } + + catch (Exception ex) + { + LogHelper.WriteLogInfo(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + ":ScanList异常!\r\n" + ex.Message); + + } + } + + } + } + + #endregion + + + #region 扫描处理 + public ResultModel JobScanList(string tblock) + { + lock (lockscanList) + { + string[] nlist = tblock.Split('|'); + string nblock = nlist[0]; + string shelfid = nlist[1]; + + ResultModel resmodel = new ResultModel(); + resmodel.result = "0"; + try + { + List Arealist = addrBLL.GetAreaList(nblock, shelfid); + foreach (AddressstorageModel item in Arealist) + { + List sacnList = downCacheDAL.GetPlanJobDownList().FindAll(m => m.Status == "0" && m.Block == item.block && m.Area == item.area && m.Command == "QUERY_SPECIAL_STATUS"); + if (sacnList != null && sacnList.Count > 0) + { + foreach (ResultMessageModel data in sacnList.ToArray()) + { + + switch (data.Command) + { + case "QUERY_SPECIAL_STATUS": + BindJobList(data); + break; + + default: + break; + } + + } + } + } + return resmodel; + } + catch (Exception ex) + { + resmodel.result = "-1"; + resmodel.msg = "扫描异常"; + LogHelper.WriteLogInfo("扫描异常:" + ex.Message); + return resmodel; + + } + } + } + #endregion + + #region 扫描处理 + + public ResultModel BindJobList(ResultMessageModel data) + { + ResultModel res = new ResultModel(); + res.result = "0"; + try + { + string sblock = data.Block; + string scanStr = data.Parameter.Trim(); + string sarea = data.Area; + string name = string.Empty; + string matchid = string.Empty; + #region 提示请扫描波次号 + List ulist = UserCacheDAL.GetUserCodeList().FindAll(m => m.Block == sblock && m.Area == sarea);// + bool isnum = ConvertHexHelper.IsNum(scanStr.Substring(0, 1));//判断扫描首字母是否是数字 + + if (!ulist.Any()) + { + //手动加波次信息 + DataTable matdt = orderbll.GetMatchOrderList(); + if (matdt != null && matdt.Rows.Count > 0) + { + UserCodeModel umodel = new UserCodeModel(); + umodel.Matchid = matdt.Rows[0]["matchid"].ToString(); + umodel.Block = sblock; + umodel.Area = sarea; + UserCacheDAL.UpdateUserCodeList(new List { umodel }, EUserCommend.Create); + } + } + 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")//播种扫描枪 + { + + xifenBind(ulist, scanStr, data, matchid, isnum); + + downCacheDAL.UpdateJobDownModelList(new List { data }, EdownCommend.Execute); + } + + + return res; + + + + } + catch (Exception ex) + { + res.result = "-1"; + res.msg = "绑定任务异常"; + LogHelper.WriteLogInfo("绑定任务异常:" + ex.Message); + return res; + } + } + #endregion + + #region 中分 + + public void zhongfenBind(List ulist, string scanStr, ResultMessageModel data) + { + + //if (ulist.Any()) + //{ + // UserCodeModel usermodel = ulist.FirstOrDefault(); + //if (string.IsNullOrEmpty(usermodel.ZfCode) && 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.Type =2; + // show.Area = sarea; + // show.Islock = true; + // comBLL.ShowBoxMessage_M(show); + // downCacheDAL.UpdateJobDownModelList(new List { data }, EdownCommend.Execute); + // #endregion + //} + //else { + + if (scanStr.Substring(0, 1) == "U") + { + #region 扫描工号 + if (ulist.Any()) + { + UserCodeModel umodel = ulist.FirstOrDefault(); + umodel.ZfCode = scanStr; + #region 扫描工号 + ShowMessageModel_M show = new ShowMessageModel_M(); + show.Title = "请扫描sku开始作业!"; + show.Contents = ""; + show.Color = EnumHelper.EMToDescriptionString(LightColor.Color.Red); + show.Block = data.Block; + show.Area = data.Area; + show.Type = 2; + show.Islock = true; + comBLL.ShowBoxMessage_M(show); + #endregion + } + downCacheDAL.UpdateJobDownModelList(new List { data }, EdownCommend.Execute); + #endregion + } + else + { + #region 中分扫描sku + + 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(); + } + LogHelper.WriteLogInfo("中分" + data.Parameter + "===SKU" + scanStr); + DataTable skudt = orderbll.GetSumList("", scanStr, data.Block); + if (skudt != null && skudt.Rows.Count > 0) + { + //规格 + int discount = Convert.ToInt32(skudt.Rows[0]["discount"].ToString()); + //整件总数 + int SumCkQuantity = 0;//= Convert.ToInt32(skudt.Rows[0]["SumCkQuantity"].ToString()); + //散件总数 + int SumQuantity = Convert.ToInt32(skudt.Rows[0]["SumQuantity"].ToString()); + if (discount != 1) + { + if (SumQuantity >= discount) + { + + SumCkQuantity = SumQuantity / discount; + SumQuantity = SumQuantity % discount; + } + } + + + + ShowMessageModel_M show = new ShowMessageModel_M(); + show.Title = skudt.Rows[0]["sku_goodsname"].ToString(); + show.Color = EnumHelper.EMToDescriptionString(LightColor.Color.Red); + show.Block = data.Block; + show.Islock = true; + show.Contents = data.Parameter + "(" + scanStr + ")\r" + "规格:" + discount; + show.Qty = SumQuantity.ToString(); + show.Wholeqty = SumCkQuantity; + show.Unit = "件"; + show.Wholeunit = "箱"; + show.Type = 2; + comBLL.ShowBoxMessage_M(show); + } + else + { + ShowMessageModel_M show = new ShowMessageModel_M(); + show.Title = "SKU" + scanStr + "无任务!"; + show.Color = EnumHelper.EMToDescriptionString(LightColor.Color.Red); + show.Block = data.Block; + show.Islock = true; + show.Contents = "请扫描其他商品!"; + show.Type = 2; + comBLL.ShowBoxMessage_M(show); + } + #endregion + } + + + } + #endregion + + #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") + { + #region 扫描工号 + if (ulist.Any()) + { + UserCodeModel umodel = ulist.FirstOrDefault(); + umodel.UserCode = scanStr; + #region 扫描工号 + ShowMessageModel_M show = new ShowMessageModel_M(); + show.Title = "请扫描sku开始作业!"; + show.Contents = ""; + show.Color = EnumHelper.EMToDescriptionString(LightColor.Color.Red); + show.Block = data.Block; + show.Area = data.Area; + show.Type = 8; + show.Islock = true; + comBLL.ShowBoxMessage_M(show); + #endregion + } + downCacheDAL.UpdateJobDownModelList(new List { data }, EdownCommend.Execute); + #endregion + } + else + { + + #region 扫描商品 + + List hangList = downCacheDAL.GetPlanJobDownList().FindAll(m => m.Parameter == "888888"); + + if (hangList.Any()) + { + + #region 挂起 + LogHelper.WriteLogInfo("挂起" + data.Parameter + "-------通道" + data.Block); + // LabelParamModel FORMATEModel = new LabelParamModel(); + // FORMATEModel.ControlIP = data.IP; + // comBLL.FORMATE_JOB_DATA(FORMATEModel); + + + DataTable qdt = queueBLL.getQueuesOrderbyState(data.Block, data.Area, "1"); + if (qdt != null && qdt.Rows.Count > 0) + { + scanStr = qdt.Rows[0]["sku"].ToString(); + ShowMessageModel_M show = new ShowMessageModel_M(); + show.Block = data.Block; + show.Area = data.Area; + show.Type = 8; + + comBLL.RemoveBoxMessage_M(show); + // data.Parameter = scanStr; + Hangup_SKU(scanStr, data.Block, data.Area); + //删除sku对应缓存 + List sdown = downCacheDAL.GetPlanJobDownList().FindAll(p => p.Parameter == scanStr && p.Parameter == qdt.Rows[0]["sku"].ToString()&&p.Block == data.Block); + downCacheDAL.UpdateJobDownModelList(sdown, EdownCommend.Execute); + } + downCacheDAL.UpdateJobDownModelList(hangList, EdownCommend.Execute); + + #endregion + + } + else if (isnum)//sku + { + #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 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); + + if (scanlist.Count > 1 || (skudt != null && skudt.Rows.Count > 0)) + { //重复扫描 + //ShowMessageModel_M show = new ShowMessageModel_M(); + //show.Title = scanStr + "重复扫描/已拣配!"; + //show.Color = EnumHelper.EMToDescriptionString(LightColor.Color.Red); + //show.Block = sblock; + //show.Area = sarea; + //show.Type = 8; + //comBLL.ShowBoxMessage_M(show); + downCacheDAL.UpdateJobDownModelList(new List { data }, EdownCommend.Execute); + + } + else + { + + DataTable OrderDt = orderbll.GetOrderList_Car(matchid, scanStr, data.Area, data.Block); + if (OrderDt != null && OrderDt.Rows.Count > 0) + { + + 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.Shopid = OrderDt.Rows[0]["GoodsName"].ToString(); + qmodel.Location = location; + qmodel.Lightcolor = EnumHelper.EMToDescriptionString(LightColor.Color.Red); + queueBLL.insertQueueOrders(qmodel); + + + } + else + { + LogHelper.WriteLogInfo("未扫描波次信息", LogHelper.Log_Type.ERROR); + } + + } + 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.Shopid = echoDt.Rows[0]["GoodsName"].ToString(); + + qmodel.Lightcolor = EnumHelper.EMToDescriptionString(LightColor.Color.Green); + queueBLL.insertQueueOrders(qmodel); + + + } + else + { + LogHelper.WriteLogInfo("未扫描波次信息", LogHelper.Log_Type.ERROR); + } + + } + 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 + } + + } + + + #endregion + + } + #endregion + } + + } + #endregion + + #region SKU挂起/缺货 + public void Hangup_SKU(string sku, string block, string area, ResultMessageModel data = null) + { + List list = new List(); + //查询当前通道sku是否有任务 + DataTable dt = orderbll.getOrderListBysku(block, sku); + if (dt != null && dt.Rows.Count > 0) + { + // 将当前通道所有sku正在亮的设备熄灭 + foreach (DataRow item in dt.Rows) + { + + LabelParamModel lamodel = new LabelParamModel(); + lamodel.Address = item["address"].ToString(); ; + lamodel.ControlIP = item["ControlIP"].ToString(); + lamodel.Command = "REMOVE_JOB"; + lamodel.Parameter = ""; + lamodel.Uid = "U" + item["id"].ToString(); + lamodel.Type = "N"; + list.Add(lamodel); + if (item["oprationstate"].ToString() == "1") + { + orderbll.UpOrderStateBybat(item["id"].ToString()); + } + } + if (list != null && list.Count > 0) + { + LogHelper.WriteLogInfo("挂起list——" + sku + "——————————————————:" + list.Count); + comBLL.DISPLAY_JOBALL(list); + } + } + + + //删除缓存中sku记录 + List jobList = JobCache.GetPlanJobList(); + List relist = jobList.FindAll(m => m.Sku == sku && m.Block == block); + JobModel model = new JobModel(); + if (relist.Any()) + { + model = relist.FirstOrDefault(); + JobCache.UpdateJobModelList(relist, EcommendType.Complete); + //删除Orderqueue中sku的记录 + bool bo = queueBLL.DelQueueOrder(sku, block); + LogHelper.WriteLogInfo("删除queue返回" + bo); + } + else + { + ShowMessageModel_M show = new ShowMessageModel_M(); + show.Title = "挂起商品:" + sku + "错误!"; + show.Color = EnumHelper.EMToDescriptionString(LightColor.Color.Red); + show.Block = block; + show.Area = area; + show.Type = 8; + show.Islock = true; + comBLL.ShowBoxMessage_M(show); + } + //downCacheDAL.GetPlanJobDownList().FindAll(p => p.Parameter == sku && p.Block == block); + } + + #endregion + } +} diff --git a/Epost.DAL/OrdersDAL.cs b/Epost.DAL/OrdersDAL.cs index c6c365e..54dd1df 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 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 + " order by layer,slist ", 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 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 + " order by layer,slist ", sku, block); @@ -90,7 +90,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 sku = '{0}' and block = '{1}' and area='{2}' " + strwhere + "", + 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 sku = '{0}' and block = '{1}' and area='{2}' " + strwhere + " order by layer,slist ", sku, block, area); @@ -98,7 +98,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 sku = '{0}' and block = '{1}' " + strwhere + "", + 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 sku = '{0}' and block = '{1}' " + strwhere + " order by layer,slist ", sku, block); @@ -158,7 +158,7 @@ namespace Epost.DAL strwhere += " and matchid = '" + matchid + "'"; } - string sql = string.Format("select sum(Quantity) as SumQuantity, Sum(checkquantity) as SumCkQuantity,boxweight, Discount,unit,wholeunit,matchid ,goodscode,goodsname from v_orders where readtime= (select top 1 readtime from orders where state=0) and (oprationstate = 0 or oprationstate=1) and sku='{0}' and block='{1}' " + strwhere + " group by sku,boxweight, Discount,goodsname,unit,wholeunit,matchid ,goodscode", + string sql = string.Format("select sum(Quantity) as SumQuantity, Sum(checkquantity) as SumCkQuantity,boxweight, Discount,unit,wholeunit,matchid ,goodscode,goodsname from v_orders where sku='{0}' and block='{1}' " + strwhere + " group by sku,boxweight, Discount,goodsname,unit,wholeunit,matchid ,goodscode", sku, block); LogHelper.WriteLogInfo("获取订单信息-中分" + sql); @@ -529,12 +529,12 @@ namespace Epost.DAL #endregion #region 修改订单为未拣货订单--挂起使用 - public bool UpOrderStateBybat(string batchid) + public bool UpOrderStateBybat(string id) { try { - string sql = string.Format(" update orders set oprationstate=0,oprationtime='' where batchid='{0}' and state<>3", - batchid); + string sql = string.Format(" update orders set oprationstate=0,oprationtime='' where id='{0}' and state<>3", + id); long x = db.UpdateSql(sql); if (x > 0) return true; @@ -1247,7 +1247,7 @@ namespace Epost.DAL #region 查询sku对应的所有任务 public DataTable getOrderListBysku(string block, string sku) { - string sql = string.Format("select * from v_orders where block = '{0}' and sku ='{1}' ", + string sql = string.Format("select * from v_orders where block = '{0}' and sku ='{1}' order by layer,slist ", block, sku); LogHelper.WriteLogInfo("查询sku对应的所有任务:" + sql); diff --git a/Epost.TestToolsWeb/Epost.DPS.csproj.user b/Epost.TestToolsWeb/Epost.DPS.csproj.user index b229933..044be83 100644 --- a/Epost.TestToolsWeb/Epost.DPS.csproj.user +++ b/Epost.TestToolsWeb/Epost.DPS.csproj.user @@ -10,7 +10,7 @@ ~/Views/Shared/_EpostLayoutPage.cshtml False 600 - E:\WORK\代码管理\播种\T系列分支\Epost.TestToolsWeb\Properties\PublishProfiles\Toolsweb.pubxml + E:\WORK\代码管理\T系列\播种\Epost.TestToolsWeb\Properties\PublishProfiles\Toolsweb.pubxml Debug|Any CPU diff --git a/Epost.TestToolsWeb/Properties/PublishProfiles/Toolsweb.pubxml.user b/Epost.TestToolsWeb/Properties/PublishProfiles/Toolsweb.pubxml.user index 529e766..f2234de 100644 --- a/Epost.TestToolsWeb/Properties/PublishProfiles/Toolsweb.pubxml.user +++ b/Epost.TestToolsWeb/Properties/PublishProfiles/Toolsweb.pubxml.user @@ -7,7 +7,8 @@ <_PublishTargetUrl>D:\驿传\T系列 - True|2022-07-15T08:41:13.9750291Z;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; + True|2024-09-01T02:13:37.1598955Z;True|2024-08-31T17:27:57.5375469+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; + @@ -32,19 +33,19 @@ 04/04/2018 15:45:12 - 07/15/2022 16:57:09 + 09/01/2024 13:28:03 - 07/15/2022 16:57:09 + 09/01/2024 13:28:02 02/24/2020 15:29:24 - 07/15/2022 16:40:17 + 09/01/2024 10:13:03 - 07/15/2022 16:40:17 + 09/01/2024 10:13:03 04/29/2020 16:50:14 @@ -62,31 +63,31 @@ 10/23/2017 13:15:20 - 07/15/2022 16:56:59 + 09/01/2024 13:27:54 - 07/15/2022 16:56:59 + 09/01/2024 13:27:54 08/26/2020 18:09:48 - 07/15/2022 16:40:18 + 09/01/2024 11:27:24 - 07/15/2022 16:40:18 + 09/01/2024 11:27:24 - 07/15/2022 16:57:02 + 09/01/2024 13:27:56 - 07/15/2022 16:57:02 + 09/01/2024 13:27:56 - 07/14/2022 16:43:42 + 08/31/2024 17:27:44 - 07/14/2022 16:43:42 + 08/31/2024 17:27:44 09/06/2018 11:57:11 @@ -5651,7 +5652,7 @@ 05/30/2022 16:58:47 - 07/15/2022 16:57:03 + 09/01/2024 13:27:58 04/04/2018 15:45:12 @@ -7571,7 +7572,7 @@ 07/04/2022 14:22:38 - 07/12/2022 15:10:39 + 08/31/2024 19:13:15 \ No newline at end of file diff --git a/Epost.TestToolsWeb/Web.config b/Epost.TestToolsWeb/Web.config index d59abdf..8f73974 100644 --- a/Epost.TestToolsWeb/Web.config +++ b/Epost.TestToolsWeb/Web.config @@ -11,7 +11,7 @@ - +