2023-01-13 15:30:20 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Data;
|
2023-04-17 10:59:39 +08:00
|
|
|
|
using System.Data.Entity.Infrastructure;
|
2023-01-13 15:30:20 +08:00
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Epost.Common;
|
2023-04-17 10:59:39 +08:00
|
|
|
|
using Epost.DAL;
|
2023-01-13 15:30:20 +08:00
|
|
|
|
using Epost.DAL.Cache;
|
|
|
|
|
using Epost.DAL.Enum;
|
|
|
|
|
using Epost.Model;
|
|
|
|
|
|
|
|
|
|
namespace Epost.BLL
|
|
|
|
|
{
|
|
|
|
|
|
2023-04-17 10:59:39 +08:00
|
|
|
|
public class OrderControlBLL
|
2023-01-13 15:30:20 +08:00
|
|
|
|
{
|
2023-04-17 10:59:39 +08:00
|
|
|
|
OrdersDAL dal = new OrdersDAL();
|
2023-01-13 15:30:20 +08:00
|
|
|
|
OrderBLL orderbll = new OrderBLL();
|
|
|
|
|
OrdersQueueBLL queueBLL = new OrdersQueueBLL();
|
|
|
|
|
CommandBLL comBLL = new CommandBLL();
|
|
|
|
|
JobModelCacheDAL JobCache = new JobModelCacheDAL();
|
|
|
|
|
ScanModelCacheDAL scanCacheDAL = new ScanModelCacheDAL();
|
|
|
|
|
JobDownCacheDAL downCacheDAL = new JobDownCacheDAL();
|
|
|
|
|
AddressstorageBLL addrBLL = new AddressstorageBLL();
|
|
|
|
|
UserModelCacheDAL UserCacheDAL = new UserModelCacheDAL();
|
|
|
|
|
BoxQueueBLL queueboxBLL = new BoxQueueBLL();
|
2023-04-17 10:59:39 +08:00
|
|
|
|
SkuInfoBLL skuBLL = new SkuInfoBLL();
|
2023-01-13 15:30:20 +08:00
|
|
|
|
ShowMesCacheDAL msgCache = new ShowMesCacheDAL();
|
|
|
|
|
LocationCacheDAL locCache = new LocationCacheDAL();
|
|
|
|
|
BoxCodeCacheDAL boxcache = new BoxCodeCacheDAL();
|
|
|
|
|
|
2023-04-17 10:59:39 +08:00
|
|
|
|
|
|
|
|
|
private static object lockobj = new object();
|
2023-01-13 15:30:20 +08:00
|
|
|
|
private static object lockJobDown = new object();
|
|
|
|
|
private static object showmes = new object();
|
|
|
|
|
public static bool OrisShow = false;
|
|
|
|
|
|
|
|
|
|
#region 设备控制
|
|
|
|
|
|
|
|
|
|
#region 初始化
|
|
|
|
|
public ResultModel ClearALL()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
bool t = addrBLL.UpdateState();
|
2023-04-19 14:42:48 +08:00
|
|
|
|
LogHelper.WriteLogInfo("初始化@@@@@@@@@@@@!----V20230418-1---");
|
2023-01-13 15:30:20 +08:00
|
|
|
|
JobCache.ClearJobList();
|
|
|
|
|
downCacheDAL.ClearJobDownList();
|
|
|
|
|
locCache.ClearScanList();
|
2023-04-18 15:36:13 +08:00
|
|
|
|
queueBLL.UpdateQueueState();
|
|
|
|
|
//queueboxBLL.UpdateQueueState();
|
2023-01-13 15:30:20 +08:00
|
|
|
|
orderbll.UpOrderstate();
|
|
|
|
|
UserCacheDAL.ClearUserCodeList();
|
|
|
|
|
boxcache.ClearBoxList();
|
|
|
|
|
ResultModel resultModel = comBLL.Initialization_M();
|
2023-04-18 15:36:13 +08:00
|
|
|
|
//GetOrderQueue(); //加载任务显示器信息
|
2023-01-13 15:30:20 +08:00
|
|
|
|
|
|
|
|
|
|
2023-04-17 10:59:39 +08:00
|
|
|
|
|
2023-01-13 15:30:20 +08:00
|
|
|
|
return resultModel;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
LogHelper.WriteLogInfo("初始化异常" + ex.ToString());
|
|
|
|
|
ResultModel resultModel = new ResultModel();
|
|
|
|
|
resultModel.result = "-1";
|
|
|
|
|
resultModel.msg = "初始化异常";
|
|
|
|
|
return resultModel;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 开始作业
|
|
|
|
|
public void StartWork()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (!OrisShow)
|
|
|
|
|
{
|
|
|
|
|
OrisShow = true;
|
|
|
|
|
//【多少个大区多少个线程】
|
|
|
|
|
List<AddressstorageModel> Arealist = addrBLL.GetAreaList();
|
|
|
|
|
if (Arealist.Any())
|
|
|
|
|
{
|
|
|
|
|
foreach (AddressstorageModel item in Arealist)
|
|
|
|
|
{
|
|
|
|
|
string block = item.block + "-" + item.area;
|
|
|
|
|
Thread timerThread = new Thread(new ParameterizedThreadStart(GetWorkList));
|
|
|
|
|
timerThread.Start(block);
|
|
|
|
|
|
|
|
|
|
Thread timerThreadBack = new Thread(new ParameterizedThreadStart(BackWorkList));
|
|
|
|
|
timerThreadBack.Start(block);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 获取订单信息
|
|
|
|
|
private void GetWorkList(object block)
|
|
|
|
|
{
|
|
|
|
|
string job = "";
|
|
|
|
|
job = "lockDisplayJob" + block;
|
|
|
|
|
object cJob = (object)job;
|
|
|
|
|
lock (cJob)
|
|
|
|
|
{
|
|
|
|
|
while (OrisShow)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
DisplayJob_M(block.ToString());
|
|
|
|
|
Thread.Sleep(120);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
LogHelper.WriteLogInfo(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + ":程序异常!\r\n" + ex.Message);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 获取订单信息
|
|
|
|
|
private void BackWorkList(object block)
|
|
|
|
|
{
|
|
|
|
|
string cm = "";
|
|
|
|
|
cm = "lockJobDown" + block;
|
|
|
|
|
object c = (Object)cm;
|
|
|
|
|
lock (c)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
while (OrisShow)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
Job_Down(block.ToString());
|
|
|
|
|
Thread.Sleep(120);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
LogHelper.WriteLogInfo(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + ":程序异常!\r\n" + ex.Message);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 设备检测
|
|
|
|
|
public ResultModel TestStart()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
ResultModel result = comBLL.GetAllLabelList_M();
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 停止检测
|
|
|
|
|
public void TestEnd()
|
|
|
|
|
{
|
|
|
|
|
comBLL.clearALL_M();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 结束作业
|
|
|
|
|
public void EndWork()
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
LogHelper.WriteLogInfo("结束作业!");
|
|
|
|
|
OrisShow = false;
|
2023-04-17 10:59:39 +08:00
|
|
|
|
|
2023-01-13 15:30:20 +08:00
|
|
|
|
Thread.Sleep(500);
|
|
|
|
|
comBLL.CloseALL_M();
|
|
|
|
|
|
|
|
|
|
JobCache.ClearJobList();
|
|
|
|
|
downCacheDAL.ClearJobDownList();
|
|
|
|
|
scanCacheDAL.ClearScanList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
LogHelper.WriteLogInfo("结束作业异常" + ex.Message);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 查询波次通道列表
|
|
|
|
|
public void GetOrderQueue()
|
|
|
|
|
{
|
|
|
|
|
DataTable dt = queueBLL.getQueueOrderStateList();
|
|
|
|
|
if (dt != null && dt.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
foreach (DataRow item in dt.Rows)
|
|
|
|
|
{
|
|
|
|
|
if (item["lightcolor"].ToString() == EnumHelper.EMToDescriptionString(LightColor.Color.Blue))
|
|
|
|
|
{
|
|
|
|
|
Mes_Echo(item["sku"].ToString(), item["taskblock"].ToString(), item["taskarea"].ToString(), 1, null, "", item["matchid"].ToString());
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
showSummaryMes(item["sku"].ToString(), item["taskblock"].ToString(), item["taskarea"].ToString(), 1, null, "", item["matchid"].ToString());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 标签拍下
|
|
|
|
|
public ResultModel Job_Down(string tblock)
|
|
|
|
|
{
|
2023-04-17 10:59:39 +08:00
|
|
|
|
|
2023-01-13 15:30:20 +08:00
|
|
|
|
lock (lockJobDown)
|
|
|
|
|
{
|
|
|
|
|
string[] nlist = tblock.Split('-');
|
|
|
|
|
string nblock = nlist[0];
|
|
|
|
|
string narea = nlist[1];
|
|
|
|
|
ResultModel resmodel = new ResultModel();
|
|
|
|
|
resmodel.result = "0";
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
List<ResultMessageModel> downList = downCacheDAL.GetPlanJobDownList().FindAll(m => m.Status == "0" && m.Block == nblock && m.Area == narea);
|
|
|
|
|
List<JobModel> jobList = JobCache.GetPlanJobList().FindAll(p => p.Block == nblock && p.Area == narea);
|
|
|
|
|
// LogHelper.WriteLogInfo("****************************"+ downList.Count);
|
|
|
|
|
if (downList != null && downList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
foreach (ResultMessageModel data in downList.ToArray())
|
|
|
|
|
{
|
|
|
|
|
LogHelper.WriteLogInfo("完成绑定箱号开始作业==============");
|
|
|
|
|
Work_JobDown(data, jobList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return resmodel;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
resmodel.result = "-1";
|
|
|
|
|
resmodel.msg = "标签拍下异常";
|
|
|
|
|
LogHelper.WriteLogInfo("标签拍下异常:" + ex.Message);
|
|
|
|
|
return resmodel;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//作业中
|
|
|
|
|
public void Work_JobDown(ResultMessageModel data, List<JobModel> jobList)
|
|
|
|
|
{
|
|
|
|
|
lock (lockJobDown)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
switch (data.Command)
|
|
|
|
|
{
|
|
|
|
|
case "QUERY_SPECIAL_STATUS":
|
|
|
|
|
BindJobList(data);
|
|
|
|
|
// BindJobByLocation(data);
|
|
|
|
|
break;
|
|
|
|
|
case "JOB_DONE":
|
|
|
|
|
JobDown_M(data, jobList);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
LogHelper.WriteLogInfo("Work_JobDown标签拍下异常:" + ex.Message);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//绑箱中
|
2023-04-17 10:59:39 +08:00
|
|
|
|
|
2023-01-13 15:30:20 +08:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 设备拍下处理
|
|
|
|
|
public void JobDown_M(ResultMessageModel data, List<JobModel> jobList)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
//获取标签所在区
|
|
|
|
|
OrdersQueueModel qmodel = new OrdersQueueModel();
|
|
|
|
|
string area = data.Area;
|
|
|
|
|
string block = data.Block;
|
|
|
|
|
string way = data.Way;
|
|
|
|
|
string type = data.Type;
|
|
|
|
|
string orderid = string.Empty;
|
|
|
|
|
string skulist = string.Empty;
|
|
|
|
|
qmodel.Taskarea = area;
|
|
|
|
|
qmodel.Taskblock = block;
|
|
|
|
|
List<JobModel> endjoblist = jobList.FindAll(m => m.Block == block && m.Area == area && (m.State == 1 || m.State == 0));
|
|
|
|
|
List<JobModel> 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<JobModel> finjob = jobList.FindAll(m => m.Block == block && m.Area == area && (m.State == 3) && m.Address == data.Address && m.ControlIP == data.IP);
|
|
|
|
|
|
|
|
|
|
if (finjob.Any())
|
|
|
|
|
{
|
|
|
|
|
JobModel finmodel = finjob.FirstOrDefault();
|
|
|
|
|
qmodel.UserCode = finmodel.UserCode;
|
|
|
|
|
qmodel.Sku = finmodel.Sku;
|
|
|
|
|
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);
|
|
|
|
|
}
|
2023-04-17 10:59:39 +08:00
|
|
|
|
#region 任意回显标签拍下 熄灭回显设备
|
|
|
|
|
//if (data.Loc == "check")//任意回显标签拍下 熄灭回显设备
|
|
|
|
|
//{
|
|
|
|
|
// List<JobModel> rejob = jobList.FindAll(m => m.Block == block && m.Area == area && m.State == 1 && m.Sku == queueDT.Rows[0]["sku"].ToString());
|
|
|
|
|
// if (rejob.Any())
|
|
|
|
|
// {
|
|
|
|
|
// 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
|
|
|
|
|
//}
|
|
|
|
|
#endregion
|
|
|
|
|
if (data.Result == "4")//■按键拍下
|
2023-01-13 15:30:20 +08:00
|
|
|
|
{
|
2023-04-17 10:59:39 +08:00
|
|
|
|
data.Parameter = "0";
|
|
|
|
|
jobdown_start(data, job, block, area, jobList);
|
|
|
|
|
}
|
|
|
|
|
else if (type == "8")//波次完成拍下
|
|
|
|
|
{
|
|
|
|
|
List<UserCodeModel> ulist = UserCacheDAL.GetUserCodeList().FindAll(m => m.Block == data.Block);
|
|
|
|
|
if (ulist.Any())
|
2023-01-13 15:30:20 +08:00
|
|
|
|
{
|
2023-04-17 10:59:39 +08:00
|
|
|
|
UserCodeModel umodel = ulist.FirstOrDefault();
|
|
|
|
|
bool allfinish = dal.IsFinishWorkByCar(1, umodel.Matchid, data.Block);
|
|
|
|
|
if (allfinish)
|
|
|
|
|
{
|
|
|
|
|
//判断整个波次是否已完成
|
|
|
|
|
dal.UpdateStateByCar(umodel.Matchid);
|
|
|
|
|
List<JobModel> rejob = job.FindAll(m => m.Block == data.Block && m.State == 3);
|
|
|
|
|
if (rejob.Any()) { JobCache.UpdateJobModelList(rejob, EcommendType.Execute); }
|
|
|
|
|
UserCacheDAL.UpdateUserCodeList(ulist, EUserCommend.Execute);//删除波次信息
|
|
|
|
|
}
|
2023-01-13 15:30:20 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
LogHelper.WriteLogInfo("JOB_DOWN开始~~~~~~~~~~~~~~~~");
|
|
|
|
|
if (type != "2" && type != "8")//非显示器拍下
|
|
|
|
|
{
|
|
|
|
|
jobdown_start(data, job, block, area, jobList);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
downCacheDAL.UpdateJobDownModelList(new List<ResultMessageModel> { data }, EdownCommend.Execute);
|
2023-04-17 10:59:39 +08:00
|
|
|
|
List<JobModel> rjob = job.FindAll(m => m.Block == data.Block && m.State == 3);
|
|
|
|
|
JobCache.UpdateJobModelList(rjob, EcommendType.Execute);
|
2023-01-13 15:30:20 +08:00
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 标签拍下
|
|
|
|
|
|
|
|
|
|
public void jobdown_start(ResultMessageModel data, List<JobModel> job, string block, string area, List<JobModel> jobList)
|
2023-04-17 10:59:39 +08:00
|
|
|
|
{
|
|
|
|
|
var content = string.Empty;
|
|
|
|
|
var color = EnumHelper.EMToDescriptionString(LightColor.Color.Green);
|
2023-01-13 15:30:20 +08:00
|
|
|
|
int truequantity = 0;
|
|
|
|
|
int checkquantity = 0;
|
2023-04-17 10:59:39 +08:00
|
|
|
|
string scanstr = data.Parameter;
|
2023-01-13 15:30:20 +08:00
|
|
|
|
if (!string.IsNullOrEmpty(scanstr))
|
|
|
|
|
{
|
|
|
|
|
truequantity = Convert.ToInt32(scanstr);
|
|
|
|
|
}
|
2023-04-17 10:59:39 +08:00
|
|
|
|
|
2023-01-13 15:30:20 +08:00
|
|
|
|
if (job.Any())
|
|
|
|
|
{
|
|
|
|
|
List<JobModel> downlist = new List<JobModel>();
|
|
|
|
|
JobModel model = job.FirstOrDefault();
|
|
|
|
|
downlist.Add(model);
|
2023-04-17 10:59:39 +08:00
|
|
|
|
int endcount = 1;
|
|
|
|
|
List<JobModel> manyList = job.FindAll(m => m.ManyState == 1 && m.Tolocation == model.Tolocation && m.Sku == model.Sku);
|
|
|
|
|
if (manyList.Any())//合并显示数据
|
|
|
|
|
{
|
|
|
|
|
endcount = manyList.Count;
|
|
|
|
|
downlist.AddRange(manyList);
|
|
|
|
|
LogHelper.WriteLogInfo("合并显示数据" + endcount + "============================");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
downlist.Add(model);
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-13 15:30:20 +08:00
|
|
|
|
orderbll.UpdateOrderState_Car(downlist, model, truequantity, checkquantity);
|
2023-04-17 10:59:39 +08:00
|
|
|
|
LogHelper.WriteLogInfo("6------" + data.Address + "------" + model.Sku + "----" + model.State + "");
|
|
|
|
|
bool skuInish = dal.IsFinishWork(1, block, "", area, model.Sku, "", model.Matchid);
|
2023-01-13 15:30:20 +08:00
|
|
|
|
if (skuInish)
|
|
|
|
|
{
|
2023-04-17 10:59:39 +08:00
|
|
|
|
LogHelper.WriteLogInfo(data.Address + "=========------------------" + data.Parameter);
|
2023-01-13 15:30:20 +08:00
|
|
|
|
#region 修改任务队列状态
|
|
|
|
|
OrdersQueueModel qumodel = new OrdersQueueModel();
|
|
|
|
|
qumodel.State = 3;
|
|
|
|
|
qumodel.Taskblock = block;
|
|
|
|
|
qumodel.Taskarea = area;
|
|
|
|
|
qumodel.Sku = model.Sku;
|
|
|
|
|
qumodel.Matchid = model.Matchid;
|
|
|
|
|
queueBLL.UpdateQueueTaskArea_Car(qumodel);
|
|
|
|
|
#endregion
|
|
|
|
|
Thread.Sleep(30);
|
2023-04-17 10:59:39 +08:00
|
|
|
|
LogHelper.WriteLogInfo("区SKU拣选完成--------------");
|
|
|
|
|
//删除sku缓存信息
|
|
|
|
|
List<ResultMessageModel> scanlist = downCacheDAL.GetPlanJobDownList().FindAll(p => p.Parameter == model.Sku && p.Command == "QUERY_SCAN_STATUS" && p.Area == area);
|
|
|
|
|
downCacheDAL.UpdateJobDownModelList(scanlist, EdownCommend.Execute);
|
|
|
|
|
List<JobModel> rjob = jobList.FindAll(m => m.Block == data.Block && m.Sku == model.Sku);
|
|
|
|
|
JobCache.UpdateJobModelList(rjob, EcommendType.Execute);
|
2023-01-13 15:30:20 +08:00
|
|
|
|
|
2023-04-17 10:59:39 +08:00
|
|
|
|
bool allfinish = dal.IsFinishWork_box("", 0, model.Matchid);
|
|
|
|
|
if (allfinish)
|
|
|
|
|
{
|
|
|
|
|
//修改订单状态
|
|
|
|
|
orderbll.UpdateOrderState_Car(downlist, model, 1, checkquantity);
|
|
|
|
|
bool lbo = dal.UpdateLocation(block, area);
|
|
|
|
|
dal.UpdateStateByCar(model.Matchid);
|
|
|
|
|
content = "此运单号作业已完成\r\r";
|
|
|
|
|
|
|
|
|
|
ShowMessageModel_M showmodel = new ShowMessageModel_M();
|
|
|
|
|
showmodel.Area = area;
|
|
|
|
|
showmodel.Block = block;
|
|
|
|
|
showmodel.Color = color;
|
|
|
|
|
showmodel.Islock = true;
|
|
|
|
|
showmodel.Title = model.Matchid;
|
2023-04-28 14:56:19 +08:00
|
|
|
|
showmodel.No = "01";
|
2023-04-17 10:59:39 +08:00
|
|
|
|
showmodel.IsTwinkle = 0;
|
|
|
|
|
showmodel.Contents = content;
|
|
|
|
|
showmodel.Type = 2;
|
|
|
|
|
comBLL.ShowBoxMessage_M(showmodel);//点亮显示标签
|
2023-01-13 15:30:20 +08:00
|
|
|
|
}
|
2023-04-17 10:59:39 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2023-01-13 15:30:20 +08:00
|
|
|
|
|
2023-04-17 10:59:39 +08:00
|
|
|
|
//删除已完成的拣选缓存信息
|
|
|
|
|
List<JobModel> finjob = JobCache.GetPlanJobList().FindAll(m => m.Block == data.Block && m.Area == data.Area && m.State == 3);
|
|
|
|
|
JobCache.UpdateJobModelList(finjob, EcommendType.Execute);
|
2023-01-13 15:30:20 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
2023-04-17 10:59:39 +08:00
|
|
|
|
|
2023-01-13 15:30:20 +08:00
|
|
|
|
#region 标签控制M系列
|
|
|
|
|
public void DisplayJob_M(string tblock)
|
|
|
|
|
{
|
2023-04-17 10:59:39 +08:00
|
|
|
|
|
2023-01-13 15:30:20 +08:00
|
|
|
|
|
|
|
|
|
lock (lockobj)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
string[] nlist = tblock.Split('-');
|
|
|
|
|
string nblock = nlist[0];
|
|
|
|
|
string narea = nlist[1];
|
|
|
|
|
List<LabelParamModel> list = new List<LabelParamModel>();
|
|
|
|
|
OrdersQueueModel model = new OrdersQueueModel(); ;
|
|
|
|
|
model.Taskarea = narea;
|
|
|
|
|
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, narea, list, model);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
LogHelper.WriteLogInfo("标签控制异常:" + ex.Message);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 点亮设备
|
|
|
|
|
public void displayOrder(DataTable queueDT, string nblock, string narea, List<LabelParamModel> list, OrdersQueueModel model)
|
|
|
|
|
{
|
|
|
|
|
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())
|
|
|
|
|
{
|
2023-04-19 14:42:48 +08:00
|
|
|
|
if (item.State == 0)
|
2023-04-17 10:59:39 +08:00
|
|
|
|
{
|
2023-04-19 14:42:48 +08:00
|
|
|
|
List<JobModel> manyJoblist = nowJoblist.FindAll(m => m.Tolocation == item.Tolocation);
|
|
|
|
|
int quantity = item.Quantity;
|
|
|
|
|
|
|
|
|
|
#region 判断同一订单、同一货位多条数据 合并显示
|
|
|
|
|
if (manyJoblist.Count > 1)//同一个货位的数据合并显示
|
2023-04-17 10:59:39 +08:00
|
|
|
|
{
|
2023-04-19 14:42:48 +08:00
|
|
|
|
quantity = 0;
|
|
|
|
|
if (manyJoblist.FindAll(m => m.State == 0).Any())
|
2023-04-17 10:59:39 +08:00
|
|
|
|
{
|
2023-04-19 14:42:48 +08:00
|
|
|
|
foreach (JobModel mitem in manyJoblist)
|
|
|
|
|
{
|
|
|
|
|
quantity += mitem.Quantity;
|
|
|
|
|
mitem.State = 1;
|
|
|
|
|
mitem.ManyState = 1;
|
|
|
|
|
}
|
2023-04-17 10:59:39 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2023-04-19 14:42:48 +08:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
LabelParamModel lamodel = new LabelParamModel();
|
|
|
|
|
string address = item.Address.ToString();
|
|
|
|
|
lamodel.Address = address;
|
|
|
|
|
lamodel.ControlIP = item.ControlIP.ToString();
|
|
|
|
|
lamodel.Command = "DISPLAY_JOB";
|
|
|
|
|
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();
|
|
|
|
|
item.DisplayTime = DateTime.Now;
|
2023-04-17 10:59:39 +08:00
|
|
|
|
}
|
|
|
|
|
#endregion
|
2023-04-19 14:42:48 +08:00
|
|
|
|
#region 点亮通道灯
|
|
|
|
|
//comBLL.DISPLAY_LIGHT_BLOCK(model.Taskblock, model.Taskarea, "1");
|
|
|
|
|
#endregion
|
2023-04-20 18:05:08 +08:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (list != null && list.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
LogHelper.WriteLogInfo("添加到点亮的list————————————————————:" + list.Count);
|
|
|
|
|
comBLL.DISPLAY_JOBALL(list);
|
2023-01-13 15:30:20 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{//无任务
|
|
|
|
|
LogHelper.WriteLogInfo("点亮====无任务=======================");
|
|
|
|
|
model.State = 3;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
if (jobList.Any())
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var finishList = jobList.FindAll(p => p.State == 0);
|
|
|
|
|
if (!finishList.Any())
|
|
|
|
|
{
|
|
|
|
|
queueBLL.UpdateQueueOrderState(model);//缓存队列状态修改
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-04-17 10:59:39 +08:00
|
|
|
|
//else
|
|
|
|
|
//{
|
|
|
|
|
|
|
|
|
|
// LogHelper.WriteLogInfo("还有未完成任务" + isJobList.Count);
|
|
|
|
|
// foreach (JobModel item in isJobList)
|
|
|
|
|
// {
|
|
|
|
|
// LogHelper.WriteLogInfo("还有未完成任务" + item.Address + item.ID);
|
|
|
|
|
// }
|
|
|
|
|
//}
|
2023-01-13 15:30:20 +08:00
|
|
|
|
}
|
|
|
|
|
#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<UserCodeModel> 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<UserCodeModel> { 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")//中分扫描枪
|
|
|
|
|
{
|
|
|
|
|
|
2023-04-18 15:36:13 +08:00
|
|
|
|
//zhongfenBind(ulist, scanStr, data);
|
2023-01-13 15:30:20 +08:00
|
|
|
|
downCacheDAL.UpdateJobDownModelList(new List<ResultMessageModel> { data }, EdownCommend.Execute);
|
|
|
|
|
}
|
|
|
|
|
else if (data.Type == "6")//播种扫描枪
|
|
|
|
|
{
|
|
|
|
|
|
2023-04-17 10:59:39 +08:00
|
|
|
|
var color = EnumHelper.EMToDescriptionString(LightColor.Color.Black);
|
|
|
|
|
var i = 0;
|
|
|
|
|
var content = string.Empty;
|
|
|
|
|
var d = false;
|
|
|
|
|
if (scanStr == "Finish")
|
|
|
|
|
{
|
2023-07-14 14:05:22 +08:00
|
|
|
|
dal.UpBkAddresss(data.Block, data.Area);
|
2023-04-17 10:59:39 +08:00
|
|
|
|
DataTable Mdt = dal.GetOrderMatchidInfo(data.Block, data.Area);
|
|
|
|
|
if (Mdt != null && Mdt.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
LogHelper.WriteLogInfo("----开始强制结束----运单号:" + Mdt.Rows[0]["matchid"].ToString() + "");
|
|
|
|
|
dal.UpOrdersMatchid(data.Block, data.Area, Mdt.Rows[0]["matchid"].ToString());
|
2023-07-14 14:05:22 +08:00
|
|
|
|
|
2023-04-17 10:59:39 +08:00
|
|
|
|
dal.UpOrdersqueue(data.Block, data.Area, Mdt.Rows[0]["matchid"].ToString());
|
|
|
|
|
LabelParamModel model = new LabelParamModel();
|
|
|
|
|
model.Address = "9999";
|
|
|
|
|
model.ControlIP = Mdt.Rows[0]["ControlIP"].ToString();
|
|
|
|
|
model.Parameter = "01";
|
|
|
|
|
comBLL.REMOVE_JOB(model);
|
|
|
|
|
comBLL.LED_OFF_CLEAR(Mdt.Rows[0]["ControlIP"].ToString());
|
|
|
|
|
|
|
|
|
|
color = EnumHelper.EMToDescriptionString(LightColor.Color.Green);
|
|
|
|
|
scanStr = "强制结束成功";
|
|
|
|
|
content = "运单号:" + Mdt.Rows[0]["matchid"].ToString() + "\r\r";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
LogHelper.WriteLogInfo("----开始强制结束----无任务");
|
|
|
|
|
scanStr = "当前无任务";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
DataTable ifdt = dal.GetOrdersMatchidIf(scanStr);//判断扫描的是否为运单号
|
|
|
|
|
if (ifdt != null && ifdt.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
DataTable bindt = dal.GetOrderMatchidBin(scanStr);
|
|
|
|
|
if (bindt == null || bindt.Rows.Count <= 0)
|
|
|
|
|
{
|
|
|
|
|
DataTable IFmatchid = dal.GetOrderMatchidLocation(data.Block, data.Area);
|
|
|
|
|
if (IFmatchid != null && IFmatchid.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
LogHelper.WriteLogInfo("----------该运单号正在作业:" + IFmatchid.Rows[0]["matchid"].ToString() + "");
|
|
|
|
|
scanStr = "当前运单:" + scanStr + "";
|
|
|
|
|
content = "当前线路正在作业请勿扫描\r\r";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//循环为运单号分配货位
|
|
|
|
|
DataTable noadddt = dal.GetAddressNolocation(data.Block, data.Area);
|
|
|
|
|
foreach (DataRow item in ifdt.Rows)
|
|
|
|
|
{
|
2023-04-19 17:01:53 +08:00
|
|
|
|
if (noadddt.Rows.Count > i)
|
|
|
|
|
{
|
|
|
|
|
d = dal.UpOrderstolocation(item["shopid"].ToString(), noadddt.Rows[i]["location"].ToString(), scanStr);
|
|
|
|
|
}
|
2023-04-17 10:59:39 +08:00
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
if (d == true)
|
|
|
|
|
{
|
|
|
|
|
DataTable dtmt = dal.GetOrderinfoNumber(scanStr);
|
|
|
|
|
|
|
|
|
|
content = "车牌:" + dtmt.Rows[0]["clientname"].ToString() + "\r门店数:" + dtmt.Rows[0]["shopcount"].ToString() + "\r商品总数:" + dtmt.Rows[0]["qty"].ToString() + "";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
LogHelper.WriteLogInfo("----------该运单号已绑定:" + scanStr + "");
|
|
|
|
|
scanStr = "当前运单:" + scanStr + "";
|
|
|
|
|
content = "该运单已绑定请勿重复扫描\r\r";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
DataTable skutb = dal.GetSku(scanStr);
|
|
|
|
|
DataTable OrderDt = dal.GetOrderList_Car("", scanStr, data.Area, data.Block);
|
|
|
|
|
if (OrderDt != null && OrderDt.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
DataTable dd = dal.getQueueState(data.Block, data.Area, "3");
|
|
|
|
|
|
|
|
|
|
if (dd != null && dd.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
content = "商品条码:" + skutb.Rows[0]["sku"].ToString() + "\r名称:" + skutb.Rows[0]["name"].ToString() + "\r";
|
|
|
|
|
scanStr = "该商品正在作业" + dd.Rows[0]["Sku"].ToString() + ",请勿扫描";
|
|
|
|
|
LogHelper.WriteLogInfo("该商品正在作业---sku:" + dd.Rows[0]["Sku"].ToString() + "");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
comBLL.LED_OFF_CLEAR(OrderDt.Rows[0]["controlip"].ToString());
|
|
|
|
|
|
|
|
|
|
OrdersQueueModel qmodel = new OrdersQueueModel();
|
|
|
|
|
qmodel.Taskblock = data.Block;
|
|
|
|
|
qmodel.Taskarea = data.Area;
|
|
|
|
|
qmodel.Matchid = OrderDt.Rows[0]["Matchid"].ToString();
|
|
|
|
|
qmodel.Sku = scanStr;
|
|
|
|
|
qmodel.Lightcolor = EnumHelper.EMToDescriptionString(LightColor.Color.Green);
|
|
|
|
|
queueBLL.insertQueueOrders(qmodel);
|
|
|
|
|
|
|
|
|
|
#region 扫描sku点亮显示标签
|
|
|
|
|
DataTable dt = dal.GetSkuQuantity(scanStr, OrderDt.Rows[0]["Matchid"].ToString());
|
|
|
|
|
var sumqty = dt.Rows[0]["sumqty"].ToString();
|
|
|
|
|
|
|
|
|
|
string sizeinfo = string.Empty;
|
|
|
|
|
if (skutb != null)
|
|
|
|
|
{
|
|
|
|
|
double bigqty = 0, midqty = 0, lastqty = 0;
|
|
|
|
|
double bigsize = 0, midsize = 0;
|
|
|
|
|
if (skutb.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
bigsize = Convert.ToDouble(skutb.Rows[0]["plumn"].ToString());// 6
|
|
|
|
|
midsize = Convert.ToDouble(skutb.Rows[0]["spec"].ToString());// 1
|
|
|
|
|
if (bigsize != 0)
|
|
|
|
|
{
|
|
|
|
|
bigqty = (int)Math.Floor(Convert.ToDouble(sumqty) / bigsize);
|
|
|
|
|
sumqty = (Convert.ToDouble(sumqty) - (bigqty * bigsize)).ToString();
|
|
|
|
|
}
|
|
|
|
|
if (midsize != 0)
|
|
|
|
|
{
|
|
|
|
|
midqty = (int)Math.Floor(Convert.ToDouble(sumqty) / midsize);
|
|
|
|
|
sumqty = (Convert.ToDouble(sumqty) - (midqty * midsize)).ToString();
|
|
|
|
|
}
|
|
|
|
|
sizeinfo = "筐数:" + bigqty + "包数:" + midqty;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
sizeinfo = "总数:" + sumqty;
|
|
|
|
|
}
|
|
|
|
|
content = "名称:" + skutb.Rows[0]["name"].ToString() + "\r " + sizeinfo + " \r";
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
scanStr = "当前商品:" + scanStr + "";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (skutb != null && skutb.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
content = "名称:" + skutb.Rows[0]["name"].ToString() + "\r\r";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
scanStr = "条码:" + scanStr + ",无任务";
|
|
|
|
|
LogHelper.WriteLogInfo("该条码无任务---条码:" + scanStr + "");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
ShowMessageModel_M showmodel = new ShowMessageModel_M();
|
|
|
|
|
showmodel.Area = data.Area;
|
|
|
|
|
showmodel.Block = data.Block;
|
|
|
|
|
showmodel.Color = color;
|
|
|
|
|
showmodel.Islock = true;
|
|
|
|
|
showmodel.Title = scanStr;
|
|
|
|
|
showmodel.IsTwinkle = 0;
|
|
|
|
|
showmodel.Contents = content;
|
|
|
|
|
showmodel.Type = 2;
|
|
|
|
|
comBLL.ShowBoxMessage_M(showmodel);//点亮显示标签
|
2023-01-13 15:30:20 +08:00
|
|
|
|
|
|
|
|
|
downCacheDAL.UpdateJobDownModelList(new List<ResultMessageModel> { 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<UserCodeModel> 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<ResultMessageModel> { 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<ResultMessageModel> { 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);
|
|
|
|
|
List<AddressstorageModel> Arealist = addrBLL.GetAreaList();
|
|
|
|
|
if (Arealist.Any())
|
|
|
|
|
{
|
|
|
|
|
foreach (AddressstorageModel item in Arealist)
|
|
|
|
|
{
|
2023-04-17 10:59:39 +08:00
|
|
|
|
DataTable skudt = orderbll.GetSumList("", scanStr, item.block, item.area);
|
2023-01-13 15:30:20 +08:00
|
|
|
|
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]["goodsname"].ToString();
|
|
|
|
|
show.Color = EnumHelper.EMToDescriptionString(LightColor.Color.Red);
|
|
|
|
|
show.Block = item.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 = item.block;
|
|
|
|
|
show.Islock = true;
|
|
|
|
|
show.Contents = "请扫描其他商品!";
|
|
|
|
|
show.Type = 2;
|
|
|
|
|
comBLL.ShowBoxMessage_M(show);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-04-17 10:59:39 +08:00
|
|
|
|
|
2023-01-13 15:30:20 +08:00
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 细分播种
|
|
|
|
|
public void xifenBind(List<UserCodeModel> 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<ResultMessageModel> { 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;
|
2023-04-17 10:59:39 +08:00
|
|
|
|
|
2023-01-13 15:30:20 +08:00
|
|
|
|
comBLL.ShowBoxMessage_M(show);
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
downCacheDAL.UpdateJobDownModelList(new List<ResultMessageModel> { data }, EdownCommend.Execute);
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
#region 扫描商品
|
|
|
|
|
|
|
|
|
|
List<ResultMessageModel> 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();
|
|
|
|
|
|
|
|
|
|
// data.Parameter = scanStr;
|
|
|
|
|
Hangup_SKU(scanStr, data.Block, data.Area);
|
|
|
|
|
//删除sku对应缓存
|
|
|
|
|
List<ResultMessageModel> sdown = downCacheDAL.GetPlanJobDownList().FindAll(p => p.Parameter == scanStr || p.Parameter == qdt.Rows[0]["location"].ToString());
|
|
|
|
|
downCacheDAL.UpdateJobDownModelList(sdown, EdownCommend.Execute);
|
|
|
|
|
}
|
|
|
|
|
downCacheDAL.UpdateJobDownModelList(hangList, EdownCommend.Execute);
|
|
|
|
|
//刷新波次
|
|
|
|
|
GetMatchOrder();
|
|
|
|
|
#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<ResultMessageModel> 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<ResultMessageModel> { 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.Location = location;
|
|
|
|
|
qmodel.Lightcolor = EnumHelper.EMToDescriptionString(LightColor.Color.Red);
|
|
|
|
|
queueBLL.insertQueueOrders(qmodel);
|
|
|
|
|
//提示需要拣货总量/商品名称
|
|
|
|
|
showSummaryMes(scanStr, data.Block, data.Area, 1, data, "", OrderDt.Rows[0]["matchid"].ToString());
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
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.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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
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<ResultMessageModel> { data }, EdownCommend.Execute);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 复核显示
|
|
|
|
|
public void Mes_Echo(string scanStr, string sblock, string sarea, int type, ResultMessageModel data = null, string location = "", string matchid = "", bool islock = true)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
DataTable sudt = orderbll.GetSumList_Echo("", scanStr, sblock);
|
|
|
|
|
if (type == 2)
|
|
|
|
|
{
|
|
|
|
|
sudt = orderbll.GetSumList_Echo("", scanStr, sblock, sarea);
|
|
|
|
|
}
|
|
|
|
|
//查询当前区任务队列
|
|
|
|
|
DataTable qdt = queueBLL.getQueuesOrderbyState(sblock, sarea, "1");
|
|
|
|
|
if (sudt != null && sudt.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
matchid = sudt.Rows[0]["matchid"].ToString();
|
|
|
|
|
string sku = string.Empty;
|
|
|
|
|
string qty = string.Empty;
|
|
|
|
|
string color = string.Empty;
|
|
|
|
|
if (qdt != null && qdt.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
sku = qdt.Rows[0]["sku"].ToString();
|
|
|
|
|
qty = sudt.Rows[0]["SumQuantity"].ToString();
|
|
|
|
|
color = qdt.Rows[0]["LightColor"].ToString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//规格
|
|
|
|
|
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)
|
|
|
|
|
//{
|
|
|
|
|
// if (SumQuantity >= discount)
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
|
|
// SumCkQuantity = SumQuantity / discount;
|
|
|
|
|
// SumQuantity = SumQuantity % discount;
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ShowMessageModel_M show = new ShowMessageModel_M();
|
|
|
|
|
show.Title = sudt.Rows[0]["goodsname"].ToString();
|
|
|
|
|
string mes = "复核显示";
|
|
|
|
|
islock = false;
|
|
|
|
|
|
|
|
|
|
if (qdt != null && qdt.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
show.Contents = qdt.Rows[0]["location"].ToString() + "(" + scanStr + ")" + "\r" + mes;//sudt.Rows[0]["goodscode"].ToString().Replace(';','\r');
|
|
|
|
|
}
|
|
|
|
|
if (data != null)
|
|
|
|
|
{
|
2023-04-17 10:59:39 +08:00
|
|
|
|
|
|
|
|
|
show.Contents = data.ScanCode + "(" + scanStr + ")" + "\r" + mes;
|
2023-01-13 15:30:20 +08:00
|
|
|
|
sku = data.Parameter;
|
|
|
|
|
}
|
|
|
|
|
show.Color = EnumHelper.EMToDescriptionString(LightColor.Color.Blue);
|
|
|
|
|
show.Qty = SumQuantity.ToString();
|
|
|
|
|
show.Wholeqty = SumCkQuantity;
|
|
|
|
|
show.Unit = "件";
|
|
|
|
|
show.Type = 8;
|
|
|
|
|
show.Wholeunit = "箱";
|
|
|
|
|
show.Block = sblock;
|
|
|
|
|
show.Area = sarea;
|
|
|
|
|
show.Islock = islock;
|
|
|
|
|
show.Location = "check";
|
|
|
|
|
//ShowMesModel megmodel = new ShowMesModel();
|
|
|
|
|
//megmodel.Qty = sudt.Rows[0]["SumQuantity"].ToString();
|
|
|
|
|
//megmodel.Sku = sku;
|
|
|
|
|
//megmodel.Area = sarea;
|
|
|
|
|
//megmodel.Block = sblock;
|
|
|
|
|
//megmodel.Matchid = matchid;
|
|
|
|
|
|
|
|
|
|
// msgCache.UpdateMsgModelList(new List<ShowMesModel> { megmodel }, EmsgCommend.Create);
|
|
|
|
|
comBLL.ShowBoxMessage_M(show);
|
|
|
|
|
|
|
|
|
|
if (data != null)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
data.Status = "1";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
//查询当前区任务队列
|
|
|
|
|
DataTable finshqdt = queueBLL.getQueuesOrderbyState(sblock, sarea, "3");
|
|
|
|
|
ShowMessageModel_M show = new ShowMessageModel_M();
|
|
|
|
|
//根据sku获取商品名称
|
|
|
|
|
string goodsname = orderbll.GetGoodsname(location);
|
|
|
|
|
show.Title = goodsname + "分播完成";
|
|
|
|
|
show.Contents = scanStr + "\r请扫描继续作业";
|
|
|
|
|
show.Color = EnumHelper.EMToDescriptionString(LightColor.Color.Red);
|
|
|
|
|
show.Qty = "0";
|
|
|
|
|
show.Type = 8;
|
|
|
|
|
show.Block = sblock;
|
|
|
|
|
show.Area = sarea;
|
|
|
|
|
show.Islock = true;
|
|
|
|
|
comBLL.ShowBoxMessage_M(show);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 显示波次信息
|
|
|
|
|
public void ShowMatchMessage(string scanStr, string sblock)
|
|
|
|
|
{
|
|
|
|
|
DataTable areadt = orderbll.GetAreaByMatch(scanStr, sblock);
|
|
|
|
|
if (areadt != null && areadt.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
foreach (DataRow item in areadt.Rows)
|
|
|
|
|
{
|
|
|
|
|
UserCodeModel umodel = new UserCodeModel();
|
|
|
|
|
umodel.Matchid = scanStr;
|
|
|
|
|
umodel.Block = item["block"].ToString();
|
|
|
|
|
umodel.Area = item["area"].ToString();
|
|
|
|
|
UserCacheDAL.UpdateUserCodeList(new List<UserCodeModel> { umodel }, EUserCommend.Create);
|
|
|
|
|
|
|
|
|
|
//提示扫工号
|
|
|
|
|
ShowMessageModel_M xshow = new ShowMessageModel_M();
|
|
|
|
|
xshow.Title = "请扫描工号/SKU开始作业";
|
|
|
|
|
xshow.Color = EnumHelper.EMToDescriptionString(LightColor.Color.Red);
|
|
|
|
|
xshow.Block = item["block"].ToString();
|
|
|
|
|
xshow.Area = item["area"].ToString();
|
|
|
|
|
// xshow.Area = sarea;
|
|
|
|
|
xshow.Type = 8;
|
|
|
|
|
xshow.Islock = true;
|
|
|
|
|
comBLL.ShowBoxMessage_M(xshow);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
DataTable sumlist = orderbll.GetMatchSumList(scanStr, sblock);
|
|
|
|
|
if (sumlist != null && sumlist.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
ShowMessageModel_M show = new ShowMessageModel_M();
|
|
|
|
|
show.Title = "波次号:" + scanStr;
|
|
|
|
|
show.Color = EnumHelper.EMToDescriptionString(LightColor.Color.Red);
|
|
|
|
|
show.Block = sblock;
|
|
|
|
|
show.Type = 2;
|
|
|
|
|
show.Islock = true;
|
|
|
|
|
// string qty = ConvertHexHelper.ConvertString(sumlist.Rows[0]["incompleteCount"].ToString(), 10, 16); //拣货数量
|
|
|
|
|
show.Qty = sumlist.Rows[0]["incompleteCount"].ToString();
|
|
|
|
|
show.Location = sumlist.Rows[0]["completeCount"].ToString();
|
|
|
|
|
show.Contents = "SKU总数:" + sumlist.Rows[0]["completeCount"].ToString() + "\rSKU待播数:" + sumlist.Rows[0]["incompleteCount"].ToString();
|
|
|
|
|
comBLL.ShowBoxMessage_M(show);
|
|
|
|
|
|
|
|
|
|
// downCacheDAL.UpdateJobDownModelList(new List<ResultMessageModel> { data }, EdownCommend.Execute);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 订单显示器中分提示
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 订单显示器中分提示
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="scanStr"></param>
|
|
|
|
|
/// <param name="sblock"></param>
|
|
|
|
|
/// <param name="sarea"></param>
|
|
|
|
|
/// <param name="type">type=1查询整个通道block的汇总数量,type=2查询当前通道下某 一区area的汇总数量</param>
|
|
|
|
|
/// <param name="data"></param>
|
|
|
|
|
public void showSummaryMes(string scanStr, string sblock, string sarea, int type, ResultMessageModel data = null, string location = "", string matchid = "", bool islock = true)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
lock (showmes)
|
|
|
|
|
{
|
|
|
|
|
bool bo = orderbll.isTask(sblock, sarea);
|
|
|
|
|
string msg = string.Empty;
|
|
|
|
|
if (!bo)
|
|
|
|
|
{
|
|
|
|
|
msg = "当前商品无任务\r请送至下一区";
|
|
|
|
|
}
|
|
|
|
|
DataTable sudt = orderbll.GetSumList("", scanStr, sblock);
|
|
|
|
|
if (type == 2)
|
|
|
|
|
{
|
|
|
|
|
sudt = orderbll.GetSumList("", scanStr, sblock, sarea);
|
|
|
|
|
}
|
|
|
|
|
//查询当前区任务队列
|
|
|
|
|
DataTable qdt = queueBLL.getQueuesOrderbyState(sblock, sarea, "1");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (sudt != null && sudt.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
matchid = sudt.Rows[0]["matchid"].ToString();
|
|
|
|
|
string showqty = string.Empty;
|
|
|
|
|
string showsku = string.Empty;
|
|
|
|
|
List<ShowMesModel> msglist = msgCache.GetMsgList().FindAll(p => p.Block == sblock && p.Area == sarea && p.Matchid == matchid && p.Sku == scanStr);
|
|
|
|
|
if (msglist.Any())
|
|
|
|
|
{
|
|
|
|
|
ShowMesModel showmodel = msglist.FirstOrDefault();
|
|
|
|
|
showqty = showmodel.Qty;
|
|
|
|
|
showsku = showmodel.Sku;
|
|
|
|
|
}
|
|
|
|
|
//////qdt.Rows[0]["sku"].ToString() 为null data.ScanCode
|
|
|
|
|
|
|
|
|
|
string sku = string.Empty;
|
|
|
|
|
string qty = string.Empty;
|
|
|
|
|
string color = string.Empty;
|
|
|
|
|
if (qdt != null && qdt.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
sku = qdt.Rows[0]["sku"].ToString();
|
|
|
|
|
qty = sudt.Rows[0]["SumQuantity"].ToString();
|
|
|
|
|
color = qdt.Rows[0]["LightColor"].ToString();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//规格
|
|
|
|
|
int discount = Convert.ToInt32(sudt.Rows[0]["discount"].ToString());
|
|
|
|
|
//整件总数
|
|
|
|
|
int SumCkQuantity = 0; //Convert.ToInt32(sudt.Rows[0]["SumCkQuantity"].ToString());
|
2023-04-17 10:59:39 +08:00
|
|
|
|
//散件总数
|
2023-01-13 15:30:20 +08:00
|
|
|
|
int SumQuantity = Convert.ToInt32(sudt.Rows[0]["SumQuantity"].ToString());
|
|
|
|
|
//if (discount != 1)
|
|
|
|
|
//{
|
|
|
|
|
// if (SumQuantity >= discount)
|
|
|
|
|
// {
|
|
|
|
|
// SumCkQuantity = SumQuantity / discount;
|
|
|
|
|
// SumQuantity = SumQuantity % discount;
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
ShowMessageModel_M show = new ShowMessageModel_M();
|
|
|
|
|
show.Title = sudt.Rows[0]["goodsname"].ToString();
|
|
|
|
|
string mes = "拣货任务";
|
|
|
|
|
|
|
|
|
|
if (qdt != null && qdt.Rows.Count > 0)
|
|
|
|
|
{
|
2023-04-17 10:59:39 +08:00
|
|
|
|
show.Contents = qdt.Rows[0]["location"].ToString() + "(" + scanStr + ")" + "\r" + mes;//sudt.Rows[0]["goodscode"].ToString().Replace(';','\r');
|
2023-01-13 15:30:20 +08:00
|
|
|
|
}
|
|
|
|
|
if (data != null)
|
|
|
|
|
{
|
2023-04-17 10:59:39 +08:00
|
|
|
|
show.Contents = data.ScanCode + "(" + scanStr + ")" + "\r" + mes;// sudt.Rows[0]["goodscode"].ToString().Replace(';', '\r');
|
2023-01-13 15:30:20 +08:00
|
|
|
|
sku = data.Parameter;
|
|
|
|
|
}
|
|
|
|
|
show.Color = EnumHelper.EMToDescriptionString(LightColor.Color.Green);
|
|
|
|
|
show.Qty = SumQuantity.ToString();
|
|
|
|
|
|
|
|
|
|
show.Wholeqty = SumCkQuantity;
|
|
|
|
|
show.Unit = "件";
|
|
|
|
|
show.Type = 8;
|
|
|
|
|
show.Wholeunit = "箱";
|
|
|
|
|
show.Block = sblock;
|
|
|
|
|
show.Area = sarea;
|
|
|
|
|
show.Islock = islock;
|
|
|
|
|
ShowMesModel megmodel = new ShowMesModel();
|
|
|
|
|
megmodel.Qty = sudt.Rows[0]["SumQuantity"].ToString();
|
|
|
|
|
megmodel.Sku = sku;
|
|
|
|
|
megmodel.Area = sarea;
|
|
|
|
|
megmodel.Block = sblock;
|
|
|
|
|
megmodel.Matchid = matchid;
|
|
|
|
|
|
|
|
|
|
msgCache.UpdateMsgModelList(new List<ShowMesModel> { megmodel }, EmsgCommend.Create);
|
|
|
|
|
comBLL.ShowBoxMessage_M(show);
|
|
|
|
|
|
|
|
|
|
if (data != null)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
data.Status = "1";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
//查询当前区任务队列
|
|
|
|
|
DataTable finshqdt = queueBLL.getQueuesOrderbyState(sblock, sarea, "3");
|
|
|
|
|
ShowMessageModel_M show = new ShowMessageModel_M();
|
|
|
|
|
//根据sku获取商品名称
|
|
|
|
|
string goodsname = orderbll.GetGoodsname(location);
|
|
|
|
|
show.Title = goodsname + "分播完成";
|
|
|
|
|
show.Contents = scanStr + "\r请扫描继续作业";
|
|
|
|
|
show.Color = EnumHelper.EMToDescriptionString(LightColor.Color.Green);
|
|
|
|
|
show.Qty = "0";
|
|
|
|
|
show.Type = 8;
|
|
|
|
|
show.Block = sblock;
|
|
|
|
|
show.Area = sarea;
|
|
|
|
|
show.Islock = true;
|
|
|
|
|
comBLL.ShowBoxMessage_M(show);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
LogHelper.WriteLogInfo("刷新显示器异常:" + ex.Message);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 刷新波次信息
|
|
|
|
|
public void ShowMatchMes(string scanStr, string sblock)
|
|
|
|
|
{
|
|
|
|
|
DataTable sumlist = orderbll.GetMatchSumList(scanStr, sblock);
|
|
|
|
|
if (sumlist != null && sumlist.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
ShowMessageModel_M show = new ShowMessageModel_M();
|
|
|
|
|
show.Title = "波次号:" + scanStr;
|
|
|
|
|
show.Color = EnumHelper.EMToDescriptionString(LightColor.Color.Red);
|
|
|
|
|
show.Block = sblock;
|
|
|
|
|
show.Islock = true;
|
|
|
|
|
// string qty = ConvertHexHelper.ConvertString(sumlist.Rows[0]["incompleteCount"].ToString(), 10, 16); //拣货数量
|
|
|
|
|
show.Qty = sumlist.Rows[0]["incompleteCount"].ToString();
|
|
|
|
|
show.Location = sumlist.Rows[0]["completeCount"].ToString();
|
|
|
|
|
show.Contents = "SKU总数:" + sumlist.Rows[0]["completeCount"].ToString() + "\rSKU待播数:" + sumlist.Rows[0]["incompleteCount"].ToString();
|
|
|
|
|
comBLL.ShowBoxMessage_M(show);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region SKU挂起/缺货
|
|
|
|
|
public void Hangup_SKU(string sku, string block, string area, ResultMessageModel data = null)
|
|
|
|
|
{
|
|
|
|
|
List<LabelParamModel> list = new List<LabelParamModel>();
|
|
|
|
|
//查询当前通道sku是否有任务
|
|
|
|
|
DataTable dt = orderbll.getOrderListBysku(block, sku);
|
|
|
|
|
if (dt != null && dt.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
// 将当前通道所有sku正在亮的设备熄灭
|
|
|
|
|
foreach (DataRow item in dt.Rows)
|
|
|
|
|
{
|
|
|
|
|
if (item["oprationstate"].ToString() == "1")
|
|
|
|
|
{
|
|
|
|
|
LabelParamModel lamodel = new LabelParamModel();
|
|
|
|
|
lamodel.Address = item["address"].ToString(); ;
|
|
|
|
|
lamodel.ControlIP = item["ControlIP"].ToString();
|
|
|
|
|
lamodel.Command = "REMOVE_JOB";
|
|
|
|
|
lamodel.Parameter = "01";
|
|
|
|
|
list.Add(lamodel);
|
|
|
|
|
orderbll.UpOrderStateBybat(item["batchid"].ToString());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (list != null && list.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
LogHelper.WriteLogInfo("挂起list——" + sku + "——————————————————:" + list.Count);
|
|
|
|
|
comBLL.DISPLAY_JOBALL(list);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//删除缓存中sku记录
|
|
|
|
|
List<JobModel> jobList = JobCache.GetPlanJobList();
|
|
|
|
|
List<JobModel> 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
|
|
|
|
|
|
|
|
|
|
#region 查询波次通道列表
|
|
|
|
|
public void GetMatchOrder()
|
|
|
|
|
{
|
|
|
|
|
DataTable dt = orderbll.GetMatchOrder();
|
|
|
|
|
if (dt != null && dt.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
foreach (DataRow item in dt.Rows)
|
|
|
|
|
{
|
|
|
|
|
ShowMatchMessage(item["matchid"].ToString(), item["workblock"].ToString());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|