This commit is contained in:
jl
2023-04-21 17:29:50 +08:00
parent ba8edecb11
commit 406c7a9733
10 changed files with 1484 additions and 1166 deletions

View File

@ -182,10 +182,18 @@ namespace Epost.BLL
return dal.GetAreaList();
}
#endregion
#region
public List<AddressstorageModel> GetAreaList(string block = "")
public List<AddressstorageModel> GetAreaList(string block = "", string shelfid = "")
{
return dal.GetAreaList(block);
return dal.GetAreaList(block, shelfid);
}
#endregion
#region
public List<AddressstorageModel> GetshelfidList(string block = "")
{
return dal.GetshelfidList(block);
}
#endregion
#region

View File

@ -19,13 +19,11 @@ namespace Epost.BLL
public class CommandBLL
{
CommandDAL dal = new CommandDAL();
XgateCacheDAL xageDAL = new XgateCacheDAL();
AddressstorageBLL addrBLL = new AddressstorageBLL();
public static DataTable Controls = new DataTable();
public static DataTable Labels = new DataTable();
JobDownCacheDAL JobCache = new JobDownCacheDAL();
OrdersDAL orderDal = new OrdersDAL();
ConfigurationOperator txtbll = new ConfigurationOperator();
string IP = ConfigurationManager.AppSettings["WebAPIUrl"];
#region
@ -151,23 +149,7 @@ 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)
{
string parar = no+"00" + Lightcolor + IsTwinkle+"30CQ" + Title + "\n\n" + BigQuantity + "\n" + BigUnit + "\n" + Quantity + "\n" + Unit + "\n" + Content + "\n00\n\n" + Rfcode + "\n"; ;
return parar;
}
#endregion
#region
public string GETDISPLAYJOBPAR(string no, string Lightcolor, string IsTwinkle, string location, string Quantity, string Rfcode)
{
string parar = no + Lightcolor + IsTwinkle + "30NQ" + location + "\n" + Quantity + "\n" + Rfcode + "\n";
return parar;
}
#endregion
#endregion
#region
public void clearALL_M()
@ -188,10 +170,7 @@ namespace Epost.BLL
}
#endregion
#region M系列
#endregion
#region
public bool FORMATE_JOB_DATA(LabelParamModel model)
@ -214,37 +193,6 @@ namespace Epost.BLL
}
#endregion
#region
public bool ENTER_CONFIG_MODE(LabelParamModel model)
{
return dal.ENTER_CONFIG_MODE(model);
}
#endregion
#region
public bool SET_ADDRESS(LabelParamModel model)
{
return dal.SET_ADDRESS(model);
}
#endregion
#region
public bool DELETE_ADDRESS(LabelParamModel model)
{
return dal.DELETE_ADDRESS(model);
}
#endregion
#region 退
public bool EXIT_CONFIG_MODE(LabelParamModel model)
{
return dal.EXIT_CONFIG_MODE(model);
}
#endregion
#region ()
public void DISPLAY_JOB_M(LabelParamModel model, bool clear = false, bool islock = false )
{
@ -307,7 +255,6 @@ namespace Epost.BLL
}
#endregion
#region ()
public void LED_ON_M(LabelParamModel model, bool islock = false)
{
@ -353,6 +300,7 @@ namespace Epost.BLL
dal.DISPLAY_JOBALL(list);
}
#endregion
#region LED_OFF()
public void LED_OFF_M(List<JobModel> list)
{
@ -371,8 +319,6 @@ namespace Epost.BLL
}
#endregion
#region LED_OFF()
public void LED_OFF_CLEAR(string ip)
{
@ -385,6 +331,7 @@ namespace Epost.BLL
dal.Send(clearModel);
}
#endregion
#region LED_OFF()
public void LED_OFF_CLEAR(List<JobModel> offList)
{
@ -407,7 +354,6 @@ namespace Epost.BLL
dal.SendALL(list);
}
#endregion
#region ()
public bool DISPLAY_JOB(LabelParamModel model)
@ -424,6 +370,7 @@ namespace Epost.BLL
dal.DISPLAY_JOBALL(model);
}
#endregion
#region
public ResultModel SendALL_Init(List<LabelParamModel> model)
{
@ -439,6 +386,7 @@ namespace Epost.BLL
return dal.REMOVE_JOB(model);
}
#endregion
#region
public bool DISPLAY_LIGHT(LabelParamModel model)
{
@ -455,8 +403,6 @@ namespace Epost.BLL
}
#endregion
#region
public bool UNLOCK(LabelParamModel model)
{
@ -465,30 +411,6 @@ namespace Epost.BLL
}
#endregion
#region 使
public bool SET_SCANDEVICE_ON(LabelParamModel model)
{
return dal.SET_SCANDEVICE_ON(model);
}
#endregion
#region 使
public bool SET_SCANDEVICE_OFF(LabelParamModel model)
{
return dal.SET_SCANDEVICE_OFF(model);
}
#endregion
#region
public bool SET_SCANDEVICE_CLEAR(LabelParamModel model)
{
return dal.SET_SCANDEVICE_CLEAR(model);
}
#endregion
#region
public bool SLEEP(LabelParamModel model)
{
@ -612,6 +534,7 @@ namespace Epost.BLL
}
#endregion
#region
public void ShowBoxMessage_M(ShowMessageModel_M show)
{
@ -734,7 +657,7 @@ namespace Epost.BLL
#endregion
#endregion

View File

@ -115,6 +115,8 @@
<Compile Include="UserBLL.cs" />
<Compile Include="WmsBLL.cs" />
<Compile Include="WmsTaskBLL.cs" />
<Compile Include="Work_DisplayJobThread.cs" />
<Compile Include="Work_JobDownThread.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Common\Epost.Common.csproj">

View File

@ -30,44 +30,7 @@ namespace Epost.BLL
UserModelCacheDAL UserCacheDAL = new UserModelCacheDAL();
private static object lockbox = new object();
#region
public void BindBoxCode()
{
lock (lockbox)
{
try
{
//查询待绑定的订单/设备
DataTable qudt = queueboxBLL.getQueuesbyState();
if (qudt != null && qudt.Rows.Count > 0)
{
foreach (DataRow item in qudt.Rows)
{
LabelParamModel model = new LabelParamModel();
string address = item["address"].ToString();
model.Address = address;
model.ControlIP = item["controlip"].ToString();
// model.Parameter = "0100000100030CQ请扫描箱号/托盘号\n\n\n\n\n\n门店编号" + item["shopid"].ToString() + "\n\n\n\n";
model.Parameter = comBLL.GETDISPLAYJOBPAR_CN("01", "001000", "0", "请扫描箱号/托盘号", "", "", "", "", "门店编号:" + item["shopid"].ToString(), "");
comBLL.DISPLAY_JOB_M(model, true, true);
queueboxBLL.UpdateQueueState(item["id"].ToString(), "1");
}
}
//点亮设备
}
catch (Exception ex)
{
LogHelper.WriteLogInfo("绑定箱号异常:" + ex.Message);
}
}
}
#endregion
#region
public DataTable getControlList(int type = 0)
@ -499,27 +462,14 @@ namespace Epost.BLL
//点亮当前货位对应设备提示扫箱号
LabelParamModel model = new LabelParamModel();
model.Address = address;
model.ControlIP = controlip;
// model.Parameter = "0700000100330CQ请扫描箱号!\n\n\n\n\n\n\n\n\n\n";
model.Parameter = comBLL.GETDISPLAYJOBPAR_CN("07", "000100", "3", "请扫描箱号!", "", "", "", "", "门店号:" + shopid + "\r箱 号:" + boxcode + "\r托盘号:" + traycode, "");
model.ControlIP = controlip;
// model.Parameter = comBLL.GETDISPLAYJOBPAR_CN("07", "000100", "3", "请扫描箱号!", "", "", "", "", "门店号:" + shopid + "\r箱 号:" + boxcode + "\r托盘号:" + traycode, "");
comBLL.DISPLAY_JOB_M(model, true, true);
}
#endregion
#region
public void changeNumErr(string address, string controlip)
{
//点亮当前货位对应设备提示扫箱号
LabelParamModel model = new LabelParamModel();
model.Address = address;
model.ControlIP = controlip;
model.Parameter = comBLL.GETDISPLAYJOBPAR_CN("05", "000100", "3", "修改数量超出需求数量!", "", "", "", "", "", "");
comBLL.DISPLAY_JOB_M(model, true, false);
}
#endregion
#region
public void displayJob_err(string address, string controlip, JobModel job)
@ -530,15 +480,9 @@ namespace Epost.BLL
lamodel.ControlIP = controlip;
lamodel.Command = "DISPLAY_JOB";
string qty = ConvertHexHelper.ConvertString(job.Quantity.ToString(), 10, 16); //拣货数量
string CheckQuantity = ConvertHexHelper.ConvertString(job.CheckQuantity.ToString(), 10, 16); //拣货数量
// lamodel.Parameter = "01" + EnumHelper.EMToDescriptionString(LightColor.Color.Green) + "030NQ" +item.Zone +"\n" + qty;
//lamodel.Parameter = "0100" + queueDT.Rows[0]["lightcolor"].ToString() + "030CQ" + item.GoodsName + "\n\n" + CheckQuantity + "\n" + item.WholeUnit + "\n" + qty + "\n" + item.Unit + "\n" + item.Sku + "\n\n\n\n";
lamodel.Parameter = comBLL.GETDISPLAYJOBPAR_CN("01", job.ColorCode, "0", job.GoodsName, CheckQuantity, job.WholeUnit, qty, job.Unit, job.Sku, job.UserCode);//item.UserCode
string CheckQuantity = ConvertHexHelper.ConvertString(job.CheckQuantity.ToString(), 10, 16); //拣货数量
// lamodel.Parameter = comBLL.GETDISPLAYJOBPAR_CN("01", job.ColorCode, "0", job.GoodsName, CheckQuantity, job.WholeUnit, qty, job.Unit, job.Sku, job.UserCode);//item.UserCode
comBLL.DISPLAY_JOB_M(lamodel, true, false);
}
#endregion
public void BindJobListBySku(string sku)
@ -556,13 +500,11 @@ namespace Epost.BLL
LocCacheDAL.UpdateLocModelList(new List<OrderListModel> { data }, ELCommend.Update);
}
}
}
catch (Exception ex)
{
LogHelper.WriteLogInfo("绑定任务异常:" + ex.Message);
}
}
public bool bindOrder(string sku, string block, string matchid = "", string usercode = "", string area = "", int sort = 0, string lightColor = "010000")
{
@ -581,8 +523,6 @@ namespace Epost.BLL
bool qubo = queueBLL.insertQueueOrders(unmodel);
return qubo;
}
public void bindShop(string shopcode, string usercode, List<ResultMessageModel> list, ResultMessageModel data)
{

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,229 @@
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.Threading;
namespace Epost.BLL
{
public class Work_DisplayJobThread
{
public string tblock, id;
public bool OrisShow = false;
OrderBLL orderbll = new OrderBLL();
OrdersQueueBLL queueBLL = new OrdersQueueBLL();
CommandBLL comBLL = new CommandBLL();
JobModelCacheDAL JobCache = new JobModelCacheDAL();
private static object lockobj = new object();
AddressstorageBLL addrBLL = new AddressstorageBLL();
WorkIngCacheDAL workbll = new WorkIngCacheDAL();
public void Displayjob()
{
GetWorkList(tblock);
}
#region
private void GetWorkList(object block)
{
lock (lockobj)
{
while (OrisShow)
{
try
{
string workstate = workbll.GetWorkState();
if (!string.IsNullOrEmpty(workstate))
{
OrisShow = true;
DisplayJob_M(block.ToString());
Thread.Sleep(50);
}
else
{
OrisShow = false;
}
}
catch (Exception ex)
{
LogHelper.WriteLogInfo(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + ":程序异常!\r\n" + ex.Message);
}
}
}
}
#endregion
#region M系列
public void DisplayJob_M(string tblock)
{
try
{
string[] nlist = tblock.Split('|');
string nblock = nlist[0];
string shelfid = nlist[1];
List<AddressstorageModel> Arealist = addrBLL.GetAreaList(nblock, shelfid);
foreach (AddressstorageModel item in Arealist)
{
OrdersQueueModel model = new OrdersQueueModel(); ;
model.Taskarea = item.area;
model.Taskblock = nblock;
#region
DataTable queueDT = queueBLL.getQueueOrderState(model);
if (queueDT != null && queueDT.Rows.Count > 0)
{
//当前区没有作业
if (queueDT.Rows[0]["state"].ToString() == "0")
{
displayOrder(queueDT, nblock, item.area, model);
}
}
#endregion
}
}
catch (Exception ex)
{
LogHelper.WriteLogInfo("标签控制异常:" + ex.Message);
}
}
#endregion
#region
public void displayOrder(DataTable queueDT, string nblock, string narea, OrdersQueueModel model)
{
List<LabelParamModel> list = new List<LabelParamModel>();
model.Id = Convert.ToInt32(queueDT.Rows[0]["id"].ToString());
#region
List<JobModel> jobList = JobCache.GetPlanJobList();
List<JobModel> isJobList = jobList.FindAll(p => p.Block == nblock && p.Area == narea && p.State != 3);
ShowMessageModel showmodel = new ShowMessageModel();
//获取当前区任务并加入缓存
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<JobModel> nowJoblist = jobList.FindAll(p => p.State == 0 && p.Block == model.Taskblock && p.Area == model.Taskarea);
if (nowJoblist.Any())
{
var nowmodel = nowJoblist.FirstOrDefault();
LogHelper.WriteLogInfo("进入任务点亮=====matchid=" + nowmodel.Matchid + "===orderid===" + nowmodel.OrderID + "=====sku==" + nowmodel.Sku + "========");
#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<JobModel> 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.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;
}
#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
{//无任务
LogHelper.WriteLogInfo("点亮====无任务=======================");
model.State = 3;
}
#endregion
if (jobList.Any())
{
var finishList = jobList.FindAll(p => p.State == 0);
if (!finishList.Any())
{
queueBLL.UpdateQueueOrderState(model);//缓存队列状态修改
}
}
}
else
{
LogHelper.WriteLogInfo("还有未完成任务" + isJobList.Count);
foreach (JobModel item in isJobList)
{
LogHelper.WriteLogInfo("还有未完成任务" + item.Address + item.ID);
}
}
}
#endregion
}
}

File diff suppressed because it is too large Load Diff

View File

@ -257,13 +257,19 @@ namespace Epost.DAL
return db.GetsqlForDT(sql);
}
#endregion
#region
public List<AddressstorageModel> GetAreaList(string block = "")
public List<AddressstorageModel> GetAreaList(string block, string shelfid)
{
string strwhere = string.Empty;
if (!string.IsNullOrEmpty(block))
{
strwhere = "and block ='" + block + "'";
strwhere += "and block ='" + block + "'";
}
if (!string.IsNullOrEmpty(shelfid))
{
strwhere += "and shelfid ='" + shelfid + "'";
}
string sql = string.Format("select area,block from Addressstorage where type=1 " + strwhere + " group by area,block");
DataTable dt = db.GetsqlForDT(sql);
@ -271,6 +277,22 @@ namespace Epost.DAL
return ModelConvertHelper<AddressstorageModel>.ConvertToList(dt);
}
#endregion
#region
public List<AddressstorageModel> GetshelfidList(string block)
{
string strwhere = string.Empty;
if (!string.IsNullOrEmpty(block))
{
strwhere += "and block ='" + block + "'";
}
string sql = string.Format("select shelfid,block from Addressstorage where type=1 " + strwhere + " group by shelfid,block");
DataTable dt = db.GetsqlForDT(sql);
return ModelConvertHelper<AddressstorageModel>.ConvertToList(dt);
}
#endregion
#region
public DataTable GetWayList()
{

View File

@ -0,0 +1,94 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Epost.DAL.Cache
{
public class WorkIngCacheDAL
{
private static object lockobj = new object();
public static string workingstate = string.Empty;
#region
public string GetWorkState()
{
//读取数据库 处理异常断电等情况------待开发
return workingstate;
}
#endregion
#region
public void ClearWork()
{
workingstate = "";
}
#endregion
#region Job缓存处理方法
/// <summary>
/// Job缓存处理方法
/// </summary>
/// <param name="JobParam"></param>
/// <param name="CommendType"></param>
/// <returns></returns>
public bool UpdateWorkModel(WorkEcommendType CommendType)
{
lock (lockobj)
{
if (CommendType.Equals(WorkEcommendType.Create))
{
workingstate = "Start";
}
else if (CommendType.Equals(WorkEcommendType.Complete))
{
workingstate = "";
}
return true;
}
}
#endregion
}
public enum WorkEcommendType
{
/// <summary>
/// 开始作业
/// </summary>
[Description("开始作业")]
Create,
/// <summary>
/// 结束作业
/// </summary>
[Description("结束作业")]
Complete
}
}

View File

@ -111,6 +111,7 @@
<Compile Include="Cache\ShowMesCacheDAL.cs" />
<Compile Include="Cache\UserLoginCacheDAL.cs" />
<Compile Include="Cache\UserModelCacheDAL.cs" />
<Compile Include="Cache\WorkIngCacheDAL.cs" />
<Compile Include="Cache\XgateCacheDAL.cs" />
<Compile Include="CommandDAL.cs" />
<Compile Include="DB.cs" />