2024-09-02 16:42:28 +08:00
|
|
|
|
using Epost.Common;
|
|
|
|
|
using Epost.DAL.Cache;
|
|
|
|
|
using Epost.DAL.Enum;
|
|
|
|
|
using Epost.Model;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
2024-11-27 15:44:15 +08:00
|
|
|
|
using System.Text.RegularExpressions;
|
2024-09-02 16:42:28 +08:00
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace Epost.BLL
|
|
|
|
|
{
|
|
|
|
|
public class Work_ScanThread
|
|
|
|
|
{
|
|
|
|
|
public string tblock, id;
|
|
|
|
|
public bool OrisShow = false;
|
|
|
|
|
OrderBLL orderbll = new OrderBLL();
|
|
|
|
|
OrdersQueueBLL queueBLL = new OrdersQueueBLL();
|
|
|
|
|
CommandBLL comBLL = new CommandBLL();
|
|
|
|
|
JobDownCacheDAL downCacheDAL = new JobDownCacheDAL();
|
|
|
|
|
JobModelCacheDAL JobCache = new JobModelCacheDAL();
|
|
|
|
|
AddressstorageBLL addrBLL = new AddressstorageBLL();
|
|
|
|
|
private static object lockscanList = new object();
|
|
|
|
|
public static bool OrcheckisShow = false;
|
|
|
|
|
WorkIngCacheDAL workbll = new WorkIngCacheDAL();
|
|
|
|
|
SkuInfoBLL skuBLL = new SkuInfoBLL();
|
|
|
|
|
UserModelCacheDAL UserCacheDAL = new UserModelCacheDAL();
|
|
|
|
|
public void ScanList()
|
|
|
|
|
{
|
|
|
|
|
GetScanList(tblock);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 获取扫描信息
|
|
|
|
|
private void GetScanList(object block)
|
|
|
|
|
{
|
|
|
|
|
string job = "";
|
|
|
|
|
job = "lockScan" + block;
|
|
|
|
|
object cJob = (object)job;
|
|
|
|
|
lock (cJob)
|
|
|
|
|
{
|
|
|
|
|
while (OrisShow)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
string workstate = workbll.GetWorkState();
|
|
|
|
|
if (!string.IsNullOrEmpty(workstate))
|
|
|
|
|
{
|
|
|
|
|
OrisShow = true;
|
|
|
|
|
JobScanList(block.ToString());
|
|
|
|
|
Thread.Sleep(50);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
OrisShow = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
LogHelper.WriteLogInfo(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + ":ScanList异常!\r\n" + ex.Message);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 扫描处理
|
|
|
|
|
public ResultModel JobScanList(string tblock)
|
|
|
|
|
{
|
|
|
|
|
lock (lockscanList)
|
|
|
|
|
{
|
|
|
|
|
string[] nlist = tblock.Split('|');
|
|
|
|
|
string nblock = nlist[0];
|
|
|
|
|
string shelfid = nlist[1];
|
|
|
|
|
|
|
|
|
|
ResultModel resmodel = new ResultModel();
|
|
|
|
|
resmodel.result = "0";
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
List<AddressstorageModel> Arealist = addrBLL.GetAreaList(nblock, shelfid);
|
|
|
|
|
foreach (AddressstorageModel item in Arealist)
|
|
|
|
|
{
|
|
|
|
|
List<ResultMessageModel> sacnList = downCacheDAL.GetPlanJobDownList().FindAll(m => m.Status == "0" && m.Block == item.block && m.Area == item.area && m.Command == "QUERY_SPECIAL_STATUS");
|
|
|
|
|
if (sacnList != null && sacnList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
foreach (ResultMessageModel data in sacnList.ToArray())
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
switch (data.Command)
|
|
|
|
|
{
|
|
|
|
|
case "QUERY_SPECIAL_STATUS":
|
|
|
|
|
BindJobList(data);
|
2024-11-25 11:00:16 +08:00
|
|
|
|
break;
|
2024-09-02 16:42:28 +08:00
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return resmodel;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
resmodel.result = "-1";
|
|
|
|
|
resmodel.msg = "扫描异常";
|
|
|
|
|
LogHelper.WriteLogInfo("扫描异常:" + ex.Message);
|
|
|
|
|
return resmodel;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 扫描处理
|
|
|
|
|
|
|
|
|
|
public ResultModel BindJobList(ResultMessageModel data)
|
|
|
|
|
{
|
|
|
|
|
ResultModel res = new ResultModel();
|
|
|
|
|
res.result = "0";
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
string sblock = data.Block;
|
|
|
|
|
string scanStr = data.Parameter.Trim();
|
|
|
|
|
string sarea = data.Area;
|
|
|
|
|
string name = string.Empty;
|
|
|
|
|
string matchid = string.Empty;
|
|
|
|
|
#region 提示请扫描波次号
|
|
|
|
|
List<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")//中分扫描枪
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
zhongfenBind(ulist, scanStr, data);
|
|
|
|
|
downCacheDAL.UpdateJobDownModelList(new List<ResultMessageModel> { data }, EdownCommend.Execute);
|
|
|
|
|
}
|
|
|
|
|
else if (data.Type == "6")//播种扫描枪
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
xifenBind(ulist, scanStr, data, matchid, isnum);
|
|
|
|
|
|
|
|
|
|
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 {
|
|
|
|
|
|
2024-11-25 11:00:16 +08:00
|
|
|
|
if (scanStr.Substring(0, 1) == "Y")
|
2024-09-02 16:42:28 +08:00
|
|
|
|
{
|
|
|
|
|
#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();
|
|
|
|
|
}
|
2024-11-27 15:44:15 +08:00
|
|
|
|
string matchid = string.Empty;
|
|
|
|
|
if (ulist.Any())
|
|
|
|
|
{ matchid = ulist.FirstOrDefault().Matchid; }
|
2024-09-02 16:42:28 +08:00
|
|
|
|
LogHelper.WriteLogInfo("中分" + data.Parameter + "===SKU" + scanStr);
|
2024-11-27 15:44:15 +08:00
|
|
|
|
DataTable skudt = orderbll.GetSumList(matchid, scanStr, data.Block);
|
2024-09-02 16:42:28 +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());
|
2024-11-27 15:44:15 +08:00
|
|
|
|
int zcount = Convert.ToInt32(skudt.Rows[0]["SumQuantity"].ToString());
|
2024-09-02 16:42:28 +08:00
|
|
|
|
if (discount != 1)
|
|
|
|
|
{
|
|
|
|
|
if (SumQuantity >= discount)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
SumCkQuantity = SumQuantity / discount;
|
|
|
|
|
SumQuantity = SumQuantity % discount;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ShowMessageModel_M show = new ShowMessageModel_M();
|
2024-11-08 11:54:40 +08:00
|
|
|
|
show.Title = skudt.Rows[0]["goodsname"].ToString();
|
2024-09-02 16:42:28 +08:00
|
|
|
|
show.Color = EnumHelper.EMToDescriptionString(LightColor.Color.Red);
|
|
|
|
|
show.Block = data.Block;
|
|
|
|
|
show.Islock = true;
|
2024-11-27 15:44:15 +08:00
|
|
|
|
show.Contents = data.Parameter + "(" + scanStr + ")\r" + "规格:" + discount + "\r总数量:" + zcount;
|
2024-09-02 16:42:28 +08:00
|
|
|
|
show.Qty = SumQuantity.ToString();
|
|
|
|
|
show.Wholeqty = SumCkQuantity;
|
|
|
|
|
show.Unit = "件";
|
|
|
|
|
show.Wholeunit = "箱";
|
|
|
|
|
show.Type = 2;
|
|
|
|
|
comBLL.ShowBoxMessage_M(show);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ShowMessageModel_M show = new ShowMessageModel_M();
|
|
|
|
|
show.Title = "SKU" + scanStr + "无任务!";
|
|
|
|
|
show.Color = EnumHelper.EMToDescriptionString(LightColor.Color.Red);
|
|
|
|
|
show.Block = data.Block;
|
|
|
|
|
show.Islock = true;
|
|
|
|
|
show.Contents = "请扫描其他商品!";
|
|
|
|
|
show.Type = 2;
|
|
|
|
|
comBLL.ShowBoxMessage_M(show);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 细分播种
|
|
|
|
|
public void xifenBind(List<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
|
|
|
|
|
//{
|
|
|
|
|
|
2024-11-25 11:00:16 +08:00
|
|
|
|
if (scanStr.Substring(0, 1) == "Y")
|
2024-09-02 16:42:28 +08:00
|
|
|
|
{
|
|
|
|
|
#region 扫描工号
|
|
|
|
|
if (ulist.Any())
|
|
|
|
|
{
|
|
|
|
|
UserCodeModel umodel = ulist.FirstOrDefault();
|
|
|
|
|
umodel.UserCode = scanStr;
|
|
|
|
|
#region 扫描工号
|
|
|
|
|
ShowMessageModel_M show = new ShowMessageModel_M();
|
|
|
|
|
show.Title = "请扫描sku开始作业!";
|
|
|
|
|
show.Contents = "";
|
|
|
|
|
show.Color = EnumHelper.EMToDescriptionString(LightColor.Color.Red);
|
|
|
|
|
show.Block = data.Block;
|
|
|
|
|
show.Area = data.Area;
|
|
|
|
|
show.Type = 8;
|
|
|
|
|
show.Islock = true;
|
|
|
|
|
comBLL.ShowBoxMessage_M(show);
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
downCacheDAL.UpdateJobDownModelList(new List<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();
|
|
|
|
|
ShowMessageModel_M show = new ShowMessageModel_M();
|
|
|
|
|
show.Block = data.Block;
|
|
|
|
|
show.Area = data.Area;
|
|
|
|
|
show.Type = 8;
|
|
|
|
|
|
|
|
|
|
comBLL.RemoveBoxMessage_M(show);
|
|
|
|
|
// data.Parameter = scanStr;
|
|
|
|
|
Hangup_SKU(scanStr, data.Block, data.Area);
|
|
|
|
|
//删除sku对应缓存
|
|
|
|
|
List<ResultMessageModel> sdown = downCacheDAL.GetPlanJobDownList().FindAll(p => p.Parameter == scanStr && p.Parameter == qdt.Rows[0]["sku"].ToString()&&p.Block == data.Block);
|
|
|
|
|
downCacheDAL.UpdateJobDownModelList(sdown, EdownCommend.Execute);
|
|
|
|
|
}
|
|
|
|
|
downCacheDAL.UpdateJobDownModelList(hangList, EdownCommend.Execute);
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else if (isnum)//sku
|
|
|
|
|
{
|
|
|
|
|
#region 扫描SKU
|
|
|
|
|
//根据扫描商品内码获取商品码
|
|
|
|
|
data.ScanCode = data.Parameter;
|
|
|
|
|
DataTable sinfodt = skuBLL.GetSkuInfoList(data.Parameter);
|
|
|
|
|
string location = string.Empty;
|
|
|
|
|
if (sinfodt != null && sinfodt.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
scanStr = sinfodt.Rows[0]["sku"].ToString();
|
|
|
|
|
location = data.Parameter;// sinfodt.Rows[0]["tolocation"].ToString();
|
|
|
|
|
}
|
|
|
|
|
data.Parameter = scanStr;
|
|
|
|
|
DataTable skudt = queueBLL.GetOrderQueue(data.Block, data.Area, "3");
|
|
|
|
|
List<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.Shopid = OrderDt.Rows[0]["GoodsName"].ToString();
|
|
|
|
|
qmodel.Location = location;
|
|
|
|
|
qmodel.Lightcolor = EnumHelper.EMToDescriptionString(LightColor.Color.Red);
|
|
|
|
|
queueBLL.insertQueueOrders(qmodel);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
LogHelper.WriteLogInfo("未扫描波次信息", LogHelper.Log_Type.ERROR);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
#region 回显
|
|
|
|
|
DataTable echoDt = orderbll.GetOrderList_echo(matchid, scanStr, data.Area, data.Block);
|
|
|
|
|
if (echoDt != null && echoDt.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (ulist.Any())
|
|
|
|
|
{
|
|
|
|
|
UserCodeModel umodel = ulist.FirstOrDefault();
|
|
|
|
|
data.Port = echoDt.Rows[0]["matchid"].ToString();
|
|
|
|
|
OrdersQueueModel qmodel = new OrdersQueueModel();
|
|
|
|
|
qmodel.Sku = scanStr;
|
|
|
|
|
qmodel.Taskblock = data.Block;
|
|
|
|
|
qmodel.Taskarea = data.Area;
|
|
|
|
|
qmodel.UserCode = umodel.UserCode;
|
|
|
|
|
qmodel.Matchid = umodel.Matchid;
|
|
|
|
|
// qmodel.Location = location;
|
|
|
|
|
qmodel.Shopid = echoDt.Rows[0]["GoodsName"].ToString();
|
|
|
|
|
|
2024-11-27 15:44:15 +08:00
|
|
|
|
qmodel.Lightcolor = EnumHelper.EMToDescriptionString(LightColor.Color.Blue);
|
2024-09-02 16:42:28 +08:00
|
|
|
|
queueBLL.insertQueueOrders(qmodel);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
LogHelper.WriteLogInfo("未扫描波次信息", LogHelper.Log_Type.ERROR);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
//提示无任务
|
|
|
|
|
ShowMessageModel_M show = new ShowMessageModel_M();
|
|
|
|
|
show.Title = "商品:" + scanStr + "当前区无任务!";
|
|
|
|
|
show.Color = EnumHelper.EMToDescriptionString(LightColor.Color.Red);
|
|
|
|
|
show.Block = data.Block;
|
|
|
|
|
show.Area = data.Area;
|
|
|
|
|
show.Type = 8;
|
|
|
|
|
show.Islock = false;
|
|
|
|
|
comBLL.ShowBoxMessage_M(show);
|
|
|
|
|
downCacheDAL.UpdateJobDownModelList(new List<ResultMessageModel> { data }, EdownCommend.Execute);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#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)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
LabelParamModel lamodel = new LabelParamModel();
|
|
|
|
|
lamodel.Address = item["address"].ToString(); ;
|
|
|
|
|
lamodel.ControlIP = item["ControlIP"].ToString();
|
|
|
|
|
lamodel.Command = "REMOVE_JOB";
|
|
|
|
|
lamodel.Parameter = "";
|
|
|
|
|
lamodel.Uid = "U" + item["id"].ToString();
|
|
|
|
|
lamodel.Type = "N";
|
|
|
|
|
list.Add(lamodel);
|
|
|
|
|
if (item["oprationstate"].ToString() == "1")
|
|
|
|
|
{
|
|
|
|
|
orderbll.UpOrderStateBybat(item["id"].ToString());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (list != null && list.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
LogHelper.WriteLogInfo("挂起list——" + sku + "——————————————————:" + list.Count);
|
|
|
|
|
comBLL.DISPLAY_JOBALL(list);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//删除缓存中sku记录
|
|
|
|
|
List<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
|
|
|
|
|
}
|
|
|
|
|
}
|