From 8c1493f76e925d6c0ba1f6e75832c14f8f7a56b6 Mon Sep 17 00:00:00 2001 From: jl Date: Thu, 5 Jun 2025 15:11:19 +0800 Subject: [PATCH] --- Epost.BLL/Epost.BLL.csproj | 1 + Epost.BLL/OrderBLL.cs | 103 +++++--------- Epost.BLL/OrdersQueueBLL.cs | 9 ++ Epost.BLL/Print_BoxBLL.cs | 37 +++++ Epost.BLL/Work_DisplayJobThread.cs | 94 +++--------- Epost.BLL/Work_JobDownThread.cs | 134 ++++++------------ Epost.BLL/Work_ScanThread.cs | 35 +++-- Epost.DAL/CommandDAL.cs | 14 +- Epost.DAL/Epost.DAL.csproj | 1 + Epost.DAL/OrdersDAL.cs | 55 ++++++- Epost.DAL/OrdersQueueDAL.cs | 17 ++- Epost.DAL/Print_BoxDAL.cs | 76 ++++++++++ Epost.Model/JobModel.cs | 4 + Epost.TestToolsWeb/Epost.DPS.csproj.user | 4 +- .../PublishProfiles/Toolsweb.pubxml | 2 +- .../PublishProfiles/Toolsweb.pubxml.user | 32 ++--- Epost.TestToolsWeb/Web.config | 6 +- 17 files changed, 351 insertions(+), 273 deletions(-) create mode 100644 Epost.BLL/Print_BoxBLL.cs create mode 100644 Epost.DAL/Print_BoxDAL.cs diff --git a/Epost.BLL/Epost.BLL.csproj b/Epost.BLL/Epost.BLL.csproj index 1876439..3b7af4d 100644 --- a/Epost.BLL/Epost.BLL.csproj +++ b/Epost.BLL/Epost.BLL.csproj @@ -105,6 +105,7 @@ + diff --git a/Epost.BLL/OrderBLL.cs b/Epost.BLL/OrderBLL.cs index 53563c3..1ca1f22 100644 --- a/Epost.BLL/OrderBLL.cs +++ b/Epost.BLL/OrderBLL.cs @@ -27,7 +27,8 @@ namespace Epost.BLL JobModelCacheDAL JobCache = new JobModelCacheDAL(); JobDownCacheDAL downCacheDAL = new JobDownCacheDAL(); LocationCacheDAL LocCacheDAL = new LocationCacheDAL(); - UserModelCacheDAL UserCacheDAL = new UserModelCacheDAL(); + UserModelCacheDAL UserCacheDAL = new UserModelCacheDAL(); + Print_BoxDAL boxdal = new Print_BoxDAL(); private static object lockbox = new object(); @@ -159,65 +160,37 @@ namespace Epost.BLL } #endregion - #region 绑箱\换箱 type:1绑箱 2 换箱 - public bool ChangeBox(ResultMessageModel data, int type, string block = "", string area = "") + #region 换箱 type:1换箱 2 最后一箱 + public bool ChangeBox(JobModel model,int type=1) { - bool bo = false; - DataTable dt = queueboxBLL.getOrderqueueByAddr(data.Address, data.IP, "3"); - if (type == 1) + int boxcount = dal.GetStoreInfo(model.ShopID); + + int newno = boxcount + 1; + //更新订单表这个门店的箱号信息 + //生成箱号 + DateTimeOffset now = DateTimeOffset.UtcNow; + long millisecondsTimestamp = now.ToUnixTimeMilliseconds(); + string boxcode = model.ShopID + "-" + millisecondsTimestamp +"-"+ newno.ToString(); + int totalcount = 0; + if (type == 2) { - dt = queueboxBLL.getOrderqueueByAddr(data.Address, data.IP); + totalcount = newno; } - - if (dt != null && dt.Rows.Count > 0) - { - string shopcode = dt.Rows[0]["shopid"].ToString(); - List dnList = downCacheDAL.GetPlanJobDownList().FindAll(m => m.Status == "2" && m.Command == "QUERY_SPECIAL_STATUS" && m.Parameter.Contains(shopcode)); - string boxcode = string.Empty;//箱号 - string traycode = string.Empty;//托盘号 - if (dnList.Any()) + model.BoxCode = boxcode; + bool bo = dal.ChangeBox(model.ShopID, boxcode, newno, totalcount); + if (bo) + { bool boxbo = boxdal.InsertPrint(model, newno, totalcount); + if (!boxbo) { - foreach (ResultMessageModel item in dnList) - { - if (item.Parameter.Contains("C")) - { - boxcode = item.Parameter; - } - else if (item.Parameter.Contains("P")) - { - traycode = item.Parameter; - } - } - - if (type == 1) - { - bo = queueboxBLL.UpdateBoxCode(dt.Rows[0]["id"].ToString(), boxcode, traycode); - } - - - string matchid = dt.Rows[0]["matchid"].ToString(); - bo = dal.bindBox(boxcode, matchid, shopcode, traycode); - if (bo) - { - if (type == 2) - { - //当前区恢复作业,设备灯亮起 - queueBLL.updateOrderQueue(block, area); - } - } - else - { - LogHelper.WriteLogInfo("绑定箱号执行失败!"); - - } - downCacheDAL.UpdateJobDownModelList(dnList, EdownCommend.Execute); + LogHelper.WriteLogInfo("添加箱号打印失败"+ boxcode, LogHelper.Log_Type.ERROR); } - return bo; } - else - { - return false; + else { + + LogHelper.WriteLogInfo("换箱失败" + boxcode, LogHelper.Log_Type.ERROR); } + return bo; + } #endregion @@ -677,14 +650,14 @@ namespace Epost.BLL { List list = new List(); - DataTable OrderDt = dal.GetOrderList_Car(matchid, sku, area, block); + DataTable OrderDt = dal.GetOrderList_Car(matchid, sku, area, block, UserCode); 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)//回显 + //{ + // OrderDt = dal.GetOrderList_echo(matchid, sku, area, block, UserCode); + // isecho = true; - } + //} if (OrderDt != null && OrderDt.Rows.Count > 0) { string usercode = string.Empty; @@ -740,11 +713,11 @@ namespace Epost.BLL 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); - } + //if (isecho) + //{ + // demodel.No = "04"; + // demodel.ColorCode = EnumHelper.EMToDescriptionString(LightColor.Color.Blue); + //} list.Add(demodel); if (!isecho) { //修改数据为已读 @@ -963,7 +936,7 @@ namespace Epost.BLL #region 获取订单信息 public DataTable GetOrderList_Car(string matchid, string sku, string sarea, string sblock) { - return dal.GetOrderList_Car(matchid, sku, sarea, sblock); + return dal.GetOrderList_Car(matchid, sku, sarea, sblock,""); } #endregion #region 获取订单信息 diff --git a/Epost.BLL/OrdersQueueBLL.cs b/Epost.BLL/OrdersQueueBLL.cs index 72c13a5..28ff4b0 100644 --- a/Epost.BLL/OrdersQueueBLL.cs +++ b/Epost.BLL/OrdersQueueBLL.cs @@ -246,5 +246,14 @@ namespace Epost.BLL } #endregion + + + #region 扫描工号启动任务 + public bool UpdateQueueByUser(string usercode,string color) + { + return dal.UpdateQueueByUser(usercode,color); + + } + #endregion } } diff --git a/Epost.BLL/Print_BoxBLL.cs b/Epost.BLL/Print_BoxBLL.cs new file mode 100644 index 0000000..e52efe3 --- /dev/null +++ b/Epost.BLL/Print_BoxBLL.cs @@ -0,0 +1,37 @@ +using Epost.DAL; +using Epost.Model; +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Epost.BLL +{ + public class Print_BoxBLL + { + Print_BoxDAL dal = new Print_BoxDAL(); + #region 获取打印列表 + public DataTable GetPrintList(string block) + { + return dal.GetPrintList(block); + } + + #endregion + #region 修改打印状态 + public bool UpPrintList(string id) + { + return dal.UpPrintList(id); + } + #endregion + + #region 添加箱号打印 + public bool InsertPrint(JobModel model, int boxno, int totalcount) + { + return dal.InsertPrint(model, boxno,totalcount); + } + #endregion + + } +} diff --git a/Epost.BLL/Work_DisplayJobThread.cs b/Epost.BLL/Work_DisplayJobThread.cs index 96e8181..aff86a5 100644 --- a/Epost.BLL/Work_DisplayJobThread.cs +++ b/Epost.BLL/Work_DisplayJobThread.cs @@ -95,55 +95,7 @@ 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.Title = queueDT.Rows[0]["Shopid"].ToString(); - showmodel.Islock = true; - showmodel.IsTwinkle = 0; - showmodel.Type = 8; - DataTable skudt = orderbll.GetSumList(queueDT.Rows[0]["matchid"].ToString(), queueDT.Rows[0]["sku"].ToString(), nblock, shelfid); - - if (queueDT.Rows[0]["lightcolor"].ToString() == "1") - { - showmodel.Islock = false; - } - else if (queueDT.Rows[0]["lightcolor"].ToString() == EnumHelper.EMToDescriptionString(LightColor.Color.Blue)) - { - //复核显示 - skudt = orderbll.GetSumList_Echo(queueDT.Rows[0]["matchid"].ToString(), queueDT.Rows[0]["sku"].ToString(), nblock, shelfid); - showmodel.Title = "回显:"+queueDT.Rows[0]["Shopid"].ToString(); - } - - if (skudt != null && skudt.Rows.Count > 0) - { - showmodel.Qty = skudt.Rows[0]["SumQuantity"].ToString(); - 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()); - int zcount = Convert.ToInt32(skudt.Rows[0]["SumQuantity"].ToString()); - if (discount != 1) - { - if (SumQuantity >= discount) - { - - SumCkQuantity = SumQuantity / discount; - SumQuantity = SumQuantity % discount; - } - } - showmodel.Qty = SumQuantity.ToString(); - showmodel.Wholeqty = SumCkQuantity; - showmodel.Unit = "件"; - showmodel.Wholeunit = "箱"; - showmodel.Contents = queueDT.Rows[0]["sku"].ToString() + "\r规格: " + discount + " \r总数量:" + zcount; ; - } - comBLL.ShowBoxMessage_M(showmodel);//点亮显示标签 - #endregion displayOrder(queueDT, nblock, item.area, model); } } @@ -173,8 +125,8 @@ namespace Epost.BLL List isJobList = jobList.FindAll(p => p.Block == nblock && p.Area == narea && p.State != 3); ShowMessageModel showmodel = new ShowMessageModel(); //获取当前区任务并加入缓存 - if (!isJobList.Any()) - { + //if (!isJobList.Any()) + //{ model.State = 1; orderbll.GetOrderList(queueDT.Rows[0]["matchid"].ToString(), nblock, queueDT.Rows[0]["sku"].ToString(), narea, queueDT.Rows[0]["usercode"].ToString()); List nowJoblist = jobList.FindAll(p => p.State == 0 && p.Block == model.Taskblock && p.Area == model.Taskarea); @@ -187,20 +139,20 @@ namespace Epost.BLL foreach (JobModel item in nowJoblist.ToArray()) { - #region 回显设备锁定 - if (queueDT.Rows[0]["lightcolor"].ToString() == EnumHelper.EMToDescriptionString(LightColor.Color.Blue)) - { + //#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); + // 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 + //} + //#endregion // else //{ @@ -260,16 +212,16 @@ namespace Epost.BLL queueBLL.UpdateQueueOrderState(model);//缓存队列状态修改 } } - } - else - { + //} + //else + //{ - LogHelper.WriteLogInfo("还有未完成任务" + isJobList.Count); - foreach (JobModel item in isJobList) - { - LogHelper.WriteLogInfo("还有未完成任务" + item.Address + item.ID); - } - } + // LogHelper.WriteLogInfo("还有未完成任务" + isJobList.Count); + // foreach (JobModel item in isJobList) + // { + // LogHelper.WriteLogInfo("还有未完成任务" + item.Address + item.ID); + // } + //} } #endregion } diff --git a/Epost.BLL/Work_JobDownThread.cs b/Epost.BLL/Work_JobDownThread.cs index 8eb7581..78f9467 100644 --- a/Epost.BLL/Work_JobDownThread.cs +++ b/Epost.BLL/Work_JobDownThread.cs @@ -9,6 +9,7 @@ using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; +using static Epost.DAL.Enum.LightColor; namespace Epost.BLL { @@ -154,7 +155,7 @@ namespace Epost.BLL qmodel.Taskarea = area; qmodel.Taskblock = block; List endjoblist = jobList.FindAll(m => m.Block == block && m.Area == area && (m.State == 1 || m.State == 0)); - List job = jobList.FindAll(m => m.Block == block && m.Area == area && (m.State == 1 || m.State == 0) && m.Address == data.Address && m.ControlIP == data.IP); + List job = jobList.FindAll(m => m.Block == block && m.Area == area && m.State == 1 && m.Address == data.Address && m.ControlIP == data.IP); List finjob = jobList.FindAll(m => m.Block == block && m.Area == area && (m.State == 3) && m.Address == data.Address && m.ControlIP == data.IP); if (finjob.Any()) @@ -165,46 +166,26 @@ namespace Epost.BLL qmodel.Matchid = finmodel.Matchid; } - DataTable queueDT = queueBLL.getQueueOrderState(qmodel); - if (queueDT != null && queueDT.Rows.Count > 0) - { - skulist = queueDT.Rows[0]["sku"].ToString(); - LogHelper.WriteLogInfo("=======" + qmodel.UserCode + "=====" + area + "区===sku=" + skulist); - } + //DataTable queueDT = queueBLL.getQueueOrderState(qmodel); + //if (queueDT != null && queueDT.Rows.Count > 0) + //{ + // skulist = queueDT.Rows[0]["sku"].ToString(); + // LogHelper.WriteLogInfo("=======" + qmodel.UserCode + "=====" + area + "区===sku=" + skulist); + //} if (type == "8")// 订单显示器熄灭回显设备 { LogHelper.WriteLogInfo("显示器拍下"); - List rejob = jobList.FindAll(m => m.Block == block && m.Area == area && m.State == 1 && m.Sku == queueDT.Rows[0]["sku"].ToString()&&m.ColorCode=="1"); - - if (rejob.Any()) - { - LogHelper.WriteLogInfo("显示器拍下=="+rejob.Count); - JobModel model = rejob.FirstOrDefault(); - comBLL.ClearArea_M(rejob); - //熄灭通道灯 - comBLL.DISPLAY_LIGHT_BLOCK(block, area, "0"); - // comBLL.UNLOCK_M(rejob); - #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 清除当前区已做完的sku - JobCache.UpdateJobModelList(rejob, EcommendType.Execute); - #endregion + } + else if (data.Uid == "09" + "-" + data.Address)//完成灯拍下 + { + LogHelper.WriteLogInfo(data.Address+"end拍下"); } else if (data.Result == "4")//■按键拍下 { - data.Parameter = "0"; - jobdown_start(data, job, block, area, jobList); + + jobdown_start(data, job, block, area, jobList, 2); + } else { @@ -220,7 +201,7 @@ namespace Epost.BLL #region 标签拍下 - public void jobdown_start(ResultMessageModel data, List job, string block, string area, List jobList) + public void jobdown_start(ResultMessageModel data, List job, string block, string area, List jobList,int type=1) { int truequantity = 0; int checkquantity = 0; @@ -248,8 +229,9 @@ namespace Epost.BLL //修改订单状态 orderbll.UpdateOrderState_Car(downlist, model, truequantity, checkquantity); LogHelper.WriteLogInfo(data.Address + "=========------------------" + data.Parameter); - bool skuInish = orderbll.IsFinishWork(1, block, "", area, model.Sku,"", model.Matchid); + bool skuInish = orderbll.IsSkuFinishWork(model.Sku,model.Matchid); model.State = 3; + if (skuInish) { LogHelper.WriteLogInfo("区SKU拣选完成--------------"); @@ -265,17 +247,15 @@ 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.Area = area; - show.Islock = false; - show.IsTwinkle = 1; - comBLL.ShowBoxMessage_M(show); + LabelParamModel lamodel = new LabelParamModel(); + lamodel.Address = data.Address; + lamodel.ControlIP = data.IP.ToString(); + lamodel.Command = "DISPLAY_JOB"; + lamodel.Type = "N"; + lamodel.Uid = "09" + "-" + data.Address; + lamodel.Mode =model.ColorCode + "3"; + lamodel.Quantity = " end"; + comBLL.DISPLAY_JOB(lamodel); #endregion #region 修改任务队列状态 @@ -287,49 +267,8 @@ namespace Epost.BLL qumodel.Matchid = model.Matchid; qumodel.UserCode = model.UserCode; queueBLL.UpdateQueueTaskArea_Car(qumodel); - #endregion - - - - Thread.Sleep(30); - #region 整条通道当前用户所有任务分播结束 - //bool blockfinish = orderbll.IsFinishWorkByCar(1, model.Matchid, block); - //if (blockfinish) - //{ - // #region 点亮显示器 - - // 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; - - // 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); - - //} - #endregion - - #region sku播完回传 - bool skubo = orderbll.IsSkuFinishWork(model.Sku, model.Matchid); - if (skubo) - { - LogHelper.WriteLogInfo(model.Sku + "Sku播种完成" + model.Matchid); - orderbll.UpdateStateByCar(model.Matchid, model.Sku); - } - #endregion + #endregion + Thread.Sleep(30); #region 清除当前区已做完的sku JobCache.UpdateJobModelList(offList, EcommendType.Execute); @@ -337,6 +276,21 @@ namespace Epost.BLL } + bool shopfinish = orderbll.IsFinishWork(1, block, "", area,"", model.ShopID, model.Matchid); + if (shopfinish) + { + LogHelper.WriteLogInfo("门店拣选完成换箱" + model.ShopID); + orderbll.ChangeBox(model, 2); + } + else { + #region 换箱 + if (type == 2) + { + LogHelper.WriteLogInfo("开始换箱" + model.ShopID); + orderbll.ChangeBox(model); + } + #endregion + } } diff --git a/Epost.BLL/Work_ScanThread.cs b/Epost.BLL/Work_ScanThread.cs index 42b94b9..cb35a1a 100644 --- a/Epost.BLL/Work_ScanThread.cs +++ b/Epost.BLL/Work_ScanThread.cs @@ -336,17 +336,25 @@ namespace Epost.BLL { 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 + //根据工号查询对应灯色 + UserBLL userbll = new UserBLL(); + DataTable userdt= userbll.getUserColor(scanStr); + if (userdt != null && userdt.Rows.Count > 0) + { + bool bo= queueBLL.UpdateQueueByUser(scanStr, userdt.Rows[0]["lightcolor"].ToString()); + if (!bo) + { + //无待启动的商品 + LogHelper.WriteLogInfo("无待启动的商品,请先扫描商品"+scanStr,LogHelper.Log_Type.ERROR); + } + } + else { + //无此工号 + LogHelper.WriteLogInfo("扫描工号不存在"+scanStr, LogHelper.Log_Type.ERROR); + + } + + } downCacheDAL.UpdateJobDownModelList(new List { data }, EdownCommend.Execute); #endregion @@ -402,7 +410,7 @@ namespace Epost.BLL location = data.Parameter;// sinfodt.Rows[0]["tolocation"].ToString(); } data.Parameter = scanStr; - DataTable skudt = queueBLL.GetOrderQueue(data.Block, data.Area, "3"); + DataTable skudt = queueBLL.GetOrderQueue(data.Block, data.Area, "2"); 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)) @@ -432,10 +440,11 @@ namespace Epost.BLL qmodel.Sku = scanStr; qmodel.Taskblock = data.Block; qmodel.Taskarea = data.Area; - qmodel.UserCode = umodel.UserCode; + //qmodel.UserCode = umodel.UserCode; qmodel.Matchid = umodel.Matchid; qmodel.Shopid = OrderDt.Rows[0]["GoodsName"].ToString(); qmodel.Location = location; + qmodel.State = 2; qmodel.Lightcolor = EnumHelper.EMToDescriptionString(LightColor.Color.Red); queueBLL.insertQueueOrders(qmodel); diff --git a/Epost.DAL/CommandDAL.cs b/Epost.DAL/CommandDAL.cs index 2ad02de..2369700 100644 --- a/Epost.DAL/CommandDAL.cs +++ b/Epost.DAL/CommandDAL.cs @@ -572,29 +572,33 @@ namespace Epost.DAL { ResultsModel resultModel = new ResultsModel(); HttpHelper http = new HttpHelper(); - string ControlIP = "http://" + model.ControlIP + ":8000/param/"; + string ControlIP = "http://" + model.ControlIP + ":8000/param/"; string result = ""; SendParamModel sendModel = new SendParamModel(); sendModel.Address = model.Address; sendModel.Command = model.Command; sendModel.Parameter = model.Parameter; + sendModel.Type = model.Type; + sendModel.Uid = model.Uid; + sendModel.Quantity = model.Quantity; sendModel.Timeout = model.Timeout; + sendModel.Mode = model.Mode; try { string postStr = JsonHelper.SerializeObject(sendModel); result = http.HttpPost_Old(ControlIP, postStr); resultModel = JsonHelper.DeserializeObject(result); - LogHelper.WriteLogInfo("---------------------------------------" + ControlIP+"-----------"+ postStr); + LogHelper.WriteLogInfo("---------------------------------------" + ControlIP + "-----------" + postStr); if (!resultModel.Status.Equals("OK")) { - LogHelper.WriteLogInfo("发送指令失败-发送指令:" + postStr); - LogHelper.WriteLogInfo("发送指令失败-返回信息:" + result); + LogHelper.WriteLogInfo("发送指令失败-发送指令:" + postStr, Log_Type.ERROR); + LogHelper.WriteLogInfo("发送指令失败-返回信息:" + result, Log_Type.ERROR); } } catch (Exception e) { - LogHelper.WriteLogInfo("发送指令异常:" + e.Message); + LogHelper.WriteLogInfo("发送指令异常:" + e.Message, Log_Type.ERROR); // throw; } if (resultModel != null && resultModel.Status.Equals("OK")) diff --git a/Epost.DAL/Epost.DAL.csproj b/Epost.DAL/Epost.DAL.csproj index fba6c4e..adadada 100644 --- a/Epost.DAL/Epost.DAL.csproj +++ b/Epost.DAL/Epost.DAL.csproj @@ -131,6 +131,7 @@ + diff --git a/Epost.DAL/OrdersDAL.cs b/Epost.DAL/OrdersDAL.cs index bd85f14..27ef1ef 100644 --- a/Epost.DAL/OrdersDAL.cs +++ b/Epost.DAL/OrdersDAL.cs @@ -36,7 +36,7 @@ namespace Epost.DAL #region 获取订单信息 - public DataTable GetOrderList_Car(string matchid, string sku, string area, string block) + public DataTable GetOrderList_Car(string matchid, string sku, string area, string block,string usercode) { try { @@ -45,10 +45,15 @@ namespace Epost.DAL { strwhere = "and matchid= '" + matchid + "'"; } + if (!string.IsNullOrEmpty(usercode)) + { + strwhere += "and info= '" + usercode + "'"; + } + string sql = string.Empty; if (!string.IsNullOrEmpty(area)) { - sql = string.Format("select id, Matchid, orderid, barcode, BatchId, DownDate, Tolocation, Sku, GoodsName, Discount, Quantity, corlorcode, address, ControlIP,area, block,boxcode,isnull(checkquantity,0) as checkquantity,wholeunit,unit,shopid,wmsboxcode,shopname from v_orders where state = 0 and oprationstate <>3 and sku = '{0}' and block = '{1}' and area='{2}' " + strwhere + " order by layer,slist ", + sql = string.Format("select id, Matchid, orderid, barcode, BatchId, DownDate, Tolocation, Sku, GoodsName, Discount, Quantity, corlorcode, address, ControlIP,area, block,boxcode,isnull(checkquantity,0) as checkquantity,wholeunit,unit,shopid,wmsboxcode,shopname 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); @@ -1068,17 +1073,17 @@ namespace Epost.DAL } string sql = "select matchid, sku from V_orders where oprationstate <> 3 and state<>99 and block ='" + block + "' " + strwheres; - LogHelper.WriteLogInfo("判断当前sku是否为已完成" + sql); + LogHelper.WriteLogInfo("判断当前门店是否为已完成" + sql); DataTable dt = db.GetsqlForDT(sql); if (dt == null || dt.Rows.Count == 0) { - LogHelper.WriteLogInfo("判断当前sku是否为已完成true"); + LogHelper.WriteLogInfo("判断当前门店是否为已完成true"); return true; } else { - LogHelper.WriteLogInfo("判断订单状态为已完成false"); + LogHelper.WriteLogInfo("判断当前门店是否为已完成false"); return false; } } @@ -2539,6 +2544,46 @@ namespace Epost.DAL } #endregion + #region 换箱 + public bool ChangeBox(string shopid, string boxcode,int boxno,int totalcount) + { + string upstr = string.Empty; + if (totalcount != 0) + { + upstr = ",totalcount='"+totalcount+"'"; + } + string sql = string.Format("update orders set boxcode='{0}',state =3 where shopid = '{1}' and oprationstate=3 and (boxcode is null or boxcode='') ", + boxcode, shopid); + long x = db.UpdateSql(sql); + LogHelper.WriteLogInfo(x+"换箱" +sql); + if (x > 0) + { + string newsql = string.Format("update orders set boxno='{0}'" + upstr + " where shopid = '{1}' ", + boxno, shopid); + long l = db.UpdateSql(newsql); + LogHelper.WriteLogInfo(l + "更新箱数" + newsql); + return true; + } + else { return false; } + + + } + #endregion + + #region 查询箱信息 + public int GetStoreInfo(string shopid) + { + string sql = string.Format("select top 1 isnull(max(boxno),0) as boxno from orders where shopid = '{0}' and state = 0 ", + shopid); + DataTable dt= db.GetsqlForDT(sql); + if (dt != null && dt.Rows.Count > 0) + { + return Convert.ToInt32(dt.Rows[0]["boxno"].ToString()) ; + } + else { return 0; } + + } + #endregion } } diff --git a/Epost.DAL/OrdersQueueDAL.cs b/Epost.DAL/OrdersQueueDAL.cs index f9e2748..72b6430 100644 --- a/Epost.DAL/OrdersQueueDAL.cs +++ b/Epost.DAL/OrdersQueueDAL.cs @@ -89,7 +89,7 @@ namespace Epost.DAL #region 获取当前区的作业状态 public DataTable getQueueOrderState(OrdersQueueModel model) { - string sql = string.Format("select * from OrdersQueue where taskblock='{0}' and taskarea='{1}' and state<>2 and state<>3 order by sort", + string sql = string.Format("select * from OrdersQueue where taskblock='{0}' and taskarea='{1}' and state=0 order by sort", model.Taskblock, model.Taskarea); return db.GetsqlForDT(sql); @@ -213,7 +213,7 @@ namespace Epost.DAL #region 获取sku是否正在作业 public DataTable GetOrderQueue(string block,string area,string state) { - string sql = string.Format("select * from OrdersQueue where state <>'{0}' and taskblock='{1}' and taskarea='{2}'", + string sql = string.Format("select * from OrdersQueue where state ='{0}' and taskblock='{1}' and taskarea='{2}'", state, block,area); LogHelper.WriteLogInfo("获取sku是否正在作业" + sql); @@ -408,5 +408,18 @@ namespace Epost.DAL } #endregion + #region 扫描工号启动任务 + public bool UpdateQueueByUser(string usercode,string color) + { + string sql = string.Format("update OrdersQueue set state = 0,usercode ='{0}',lightcolor='{1}' where state=2 ", + usercode,color); + long x= db.UpdateSql(sql); + if (x > 0) + return true; + return false; + + } + #endregion + } } diff --git a/Epost.DAL/Print_BoxDAL.cs b/Epost.DAL/Print_BoxDAL.cs new file mode 100644 index 0000000..3c20e76 --- /dev/null +++ b/Epost.DAL/Print_BoxDAL.cs @@ -0,0 +1,76 @@ +using Epost.Common; +using Epost.Model; +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Epost.DAL +{ + public class Print_BoxDAL + { + DataBaseOpration.OprationSqlDAL db = DB_DLL.GetInstance(); + #region 获取打印列表 + public DataTable GetPrintList(string block) + { + try + { + string strwhere = string.Empty; + if (!string.IsNullOrEmpty(block)) + { + strwhere = strwhere + " and block='" + block + "'"; + } + string sql = string.Format("select id, orderid, city , fdate , boxcode, shopname, shopid, orderway, boxno,isnull(totalcount,0) as totalcount , warehouseid, state,block,printstate,senddate,loc from print_box where state=0 " + strwhere + " order by id"); + return db.GetsqlForDT(sql); + } + catch (Exception ex) + { + LogHelper.WriteLogInfo("Box获取打印列表异常:" + ex.Message, LogHelper.Log_Type.ERROR); + return null; + } + } + #endregion + + #region 修改打印状态 + public bool UpPrintList(string id) + { + try + { + string sql = string.Format("update print_box set state=1 where id='{0}'", + id); + long x = db.UpdateSql(sql); + if (x > 0) + return true; + return false; + } + catch (Exception ex) + { + LogHelper.WriteLogInfo("Box修改打印状态异常:" + ex.Message, LogHelper.Log_Type.ERROR); + return false; + } + } + #endregion + + #region 添加箱号打印 + public bool InsertPrint(JobModel model, int boxno, int totalcount) + { + try + { + string sql = string.Format("insert into print_box(orderid ,city,fdate,boxcode,shopname,shopid,orderway,boxno,warehouseid,state,block,senddate,totalcount,matchid,loc) values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}') ", + model.OrderID, model.ProdArea,DateTime.Now.ToString(), model.BoxCode, model.Shopname, model.ShopID, model.Orderway, boxno, "", "0", "", "", totalcount, model.Matchid, ""); + long x = db.UpdateSql(sql); + if (x > 0) + return true; + return false; + } + catch (Exception ex) + { + LogHelper.WriteLogInfo("Box修改打印状态异常:" + ex.Message, LogHelper.Log_Type.ERROR); + return false; + } + } + #endregion + } +} diff --git a/Epost.Model/JobModel.cs b/Epost.Model/JobModel.cs index 0a323ea..e74f59c 100644 --- a/Epost.Model/JobModel.cs +++ b/Epost.Model/JobModel.cs @@ -48,6 +48,8 @@ namespace Epost.Model private string _Unit = string.Empty;//小单位 private string _UserCode = string.Empty;//工号 private string _no = string.Empty;//任务序号 + private string _shopname = string.Empty; + private string _orderway = string.Empty; public string BatchId { get @@ -389,6 +391,8 @@ namespace Epost.Model public string UserCode { get => _UserCode; set => _UserCode = value; } public string No { get => _no; set => _no = value; } public string ID { get => _ID; set => _ID = value; } + public string Shopname { get => _shopname; set => _shopname = value; } + public string Orderway { get => _orderway; set => _orderway = value; } } } diff --git a/Epost.TestToolsWeb/Epost.DPS.csproj.user b/Epost.TestToolsWeb/Epost.DPS.csproj.user index 2eaafac..e42c801 100644 --- a/Epost.TestToolsWeb/Epost.DPS.csproj.user +++ b/Epost.TestToolsWeb/Epost.DPS.csproj.user @@ -1,4 +1,4 @@ - + true @@ -11,7 +11,7 @@ False 600 E:\WORK\代码管理\T系列\播种\Epost.TestToolsWeb\Properties\PublishProfiles\Toolsweb.pubxml - Debug|Any CPU + Release|Any CPU diff --git a/Epost.TestToolsWeb/Properties/PublishProfiles/Toolsweb.pubxml b/Epost.TestToolsWeb/Properties/PublishProfiles/Toolsweb.pubxml index 597e2b9..1c24ce3 100644 --- a/Epost.TestToolsWeb/Properties/PublishProfiles/Toolsweb.pubxml +++ b/Epost.TestToolsWeb/Properties/PublishProfiles/Toolsweb.pubxml @@ -11,7 +11,7 @@ true false - D:\驿传\Wuxidingshi_DAS + D:\驿传\GuangzhouHuiFeng_DAS true true true diff --git a/Epost.TestToolsWeb/Properties/PublishProfiles/Toolsweb.pubxml.user b/Epost.TestToolsWeb/Properties/PublishProfiles/Toolsweb.pubxml.user index ef98cf8..7424d3c 100644 --- a/Epost.TestToolsWeb/Properties/PublishProfiles/Toolsweb.pubxml.user +++ b/Epost.TestToolsWeb/Properties/PublishProfiles/Toolsweb.pubxml.user @@ -6,8 +6,8 @@ - <_PublishTargetUrl>D:\驿传\Wuxidingshi_DAS - True|2025-01-16T07:37:40.8814043Z;True|2024-12-19T15:11:44.2536385+08:00;True|2024-12-10T19:10:26.6514077+08:00;True|2024-12-10T18:30:34.7211512+08:00;True|2024-12-09T14:06:46.4112259+08:00;True|2024-12-03T14:23:26.2134334+08:00;True|2024-11-27T18:53:48.7373661+08:00;True|2024-11-27T14:27:33.0840789+08:00;True|2024-11-27T14:08:15.6442660+08:00;True|2024-11-27T12:10:03.9412549+08:00;True|2024-11-27T11:45:31.3775097+08:00;True|2024-11-27T11:32:00.8297320+08:00;True|2024-11-23T20:50:04.5476409+08:00;False|2024-11-04T17:48:25.2781696+08:00;True|2024-11-01T16:04:56.3535724+08:00;True|2024-09-01T10:13:37.1598955+08:00;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; + <_PublishTargetUrl>D:\驿传\GuangzhouHuiFeng_DAS + True|2025-06-04T07:01:49.8008687Z||;True|2025-01-16T15:37:40.8814043+08:00||;True|2024-12-19T15:11:44.2536385+08:00||;True|2024-12-10T19:10:26.6514077+08:00||;True|2024-12-10T18:30:34.7211512+08:00||;True|2024-12-09T14:06:46.4112259+08:00||;True|2024-12-03T14:23:26.2134334+08:00||;True|2024-11-27T18:53:48.7373661+08:00||;True|2024-11-27T14:27:33.0840789+08:00||;True|2024-11-27T14:08:15.6442660+08:00||;True|2024-11-27T12:10:03.9412549+08:00||;True|2024-11-27T11:45:31.3775097+08:00||;True|2024-11-27T11:32:00.8297320+08:00||;True|2024-11-23T20:50:04.5476409+08:00||;False|2024-11-04T17:48:25.2781696+08:00||;True|2024-11-01T16:04:56.3535724+08:00||;True|2024-09-01T10:13:37.1598955+08:00||;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||; @@ -33,19 +33,19 @@ 04/04/2018 15:45:12 - 01/16/2025 15:49:24 + 06/05/2025 15:04:03 - 01/16/2025 15:49:24 + 06/05/2025 15:04:03 02/24/2020 15:29:24 - 01/16/2025 15:37:17 + 06/04/2025 18:11:41 - 01/16/2025 15:37:17 + 06/04/2025 18:11:41 04/29/2020 16:50:14 @@ -63,31 +63,31 @@ 10/23/2017 13:15:20 - 01/16/2025 15:37:18 + 06/05/2025 15:03:46 - 01/16/2025 15:37:18 + 06/05/2025 15:03:46 08/26/2020 18:09:48 - 01/16/2025 15:37:17 + 06/05/2025 15:03:45 - 01/16/2025 15:37:17 + 06/05/2025 15:03:45 - 01/16/2025 15:37:21 + 06/05/2025 15:03:50 - 01/16/2025 15:37:21 + 06/05/2025 15:03:50 - 01/16/2025 15:37:16 + 06/04/2025 18:11:40 - 01/16/2025 15:37:16 + 06/04/2025 18:11:40 09/06/2018 11:57:11 @@ -5652,7 +5652,7 @@ 05/30/2022 16:58:47 - 01/16/2025 15:49:18 + 06/05/2025 15:03:52 04/04/2018 15:45:12 @@ -7572,7 +7572,7 @@ 07/04/2022 14:22:38 - 01/16/2025 15:37:22 + 06/04/2025 15:01:24 \ No newline at end of file diff --git a/Epost.TestToolsWeb/Web.config b/Epost.TestToolsWeb/Web.config index 0322702..a1dd13b 100644 --- a/Epost.TestToolsWeb/Web.config +++ b/Epost.TestToolsWeb/Web.config @@ -11,7 +11,7 @@ - + @@ -27,11 +27,11 @@ - + - +