This commit is contained in:
@ -27,7 +27,8 @@ namespace Epost.BLL
|
||||
JobModelCacheDAL JobCache = new JobModelCacheDAL();
|
||||
JobDownCacheDAL downCacheDAL = new JobDownCacheDAL();
|
||||
LocationCacheDAL LocCacheDAL = new LocationCacheDAL();
|
||||
UserModelCacheDAL UserCacheDAL = new UserModelCacheDAL();
|
||||
UserModelCacheDAL UserCacheDAL = new UserModelCacheDAL();
|
||||
Print_BoxDAL boxdal = new Print_BoxDAL();
|
||||
private static object lockbox = new object();
|
||||
|
||||
|
||||
@ -159,65 +160,37 @@ namespace Epost.BLL
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 绑箱\换箱 type:1绑箱 2 换箱
|
||||
public bool ChangeBox(ResultMessageModel data, int type, string block = "", string area = "")
|
||||
#region 换箱 type:1换箱 2 最后一箱
|
||||
public bool ChangeBox(JobModel model,int type=1)
|
||||
{
|
||||
bool bo = false;
|
||||
DataTable dt = queueboxBLL.getOrderqueueByAddr(data.Address, data.IP, "3");
|
||||
if (type == 1)
|
||||
int boxcount = dal.GetStoreInfo(model.ShopID);
|
||||
|
||||
int newno = boxcount + 1;
|
||||
//更新订单表这个门店的箱号信息
|
||||
//生成箱号
|
||||
DateTimeOffset now = DateTimeOffset.UtcNow;
|
||||
long millisecondsTimestamp = now.ToUnixTimeMilliseconds();
|
||||
string boxcode = model.ShopID + "-" + millisecondsTimestamp +"-"+ newno.ToString();
|
||||
int totalcount = 0;
|
||||
if (type == 2)
|
||||
{
|
||||
dt = queueboxBLL.getOrderqueueByAddr(data.Address, data.IP);
|
||||
totalcount = newno;
|
||||
}
|
||||
|
||||
if (dt != null && dt.Rows.Count > 0)
|
||||
{
|
||||
string shopcode = dt.Rows[0]["shopid"].ToString();
|
||||
List<ResultMessageModel> dnList = downCacheDAL.GetPlanJobDownList().FindAll(m => m.Status == "2" && m.Command == "QUERY_SPECIAL_STATUS" && m.Parameter.Contains(shopcode));
|
||||
string boxcode = string.Empty;//箱号
|
||||
string traycode = string.Empty;//托盘号
|
||||
if (dnList.Any())
|
||||
model.BoxCode = boxcode;
|
||||
bool bo = dal.ChangeBox(model.ShopID, boxcode, newno, totalcount);
|
||||
if (bo)
|
||||
{ bool boxbo = boxdal.InsertPrint(model, newno, totalcount);
|
||||
if (!boxbo)
|
||||
{
|
||||
foreach (ResultMessageModel item in dnList)
|
||||
{
|
||||
if (item.Parameter.Contains("C"))
|
||||
{
|
||||
boxcode = item.Parameter;
|
||||
}
|
||||
else if (item.Parameter.Contains("P"))
|
||||
{
|
||||
traycode = item.Parameter;
|
||||
}
|
||||
}
|
||||
|
||||
if (type == 1)
|
||||
{
|
||||
bo = queueboxBLL.UpdateBoxCode(dt.Rows[0]["id"].ToString(), boxcode, traycode);
|
||||
}
|
||||
|
||||
|
||||
string matchid = dt.Rows[0]["matchid"].ToString();
|
||||
bo = dal.bindBox(boxcode, matchid, shopcode, traycode);
|
||||
if (bo)
|
||||
{
|
||||
if (type == 2)
|
||||
{
|
||||
//当前区恢复作业,设备灯亮起
|
||||
queueBLL.updateOrderQueue(block, area);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LogHelper.WriteLogInfo("绑定箱号执行失败!");
|
||||
|
||||
}
|
||||
downCacheDAL.UpdateJobDownModelList(dnList, EdownCommend.Execute);
|
||||
LogHelper.WriteLogInfo("添加箱号打印失败"+ boxcode, LogHelper.Log_Type.ERROR);
|
||||
}
|
||||
return bo;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
else {
|
||||
|
||||
LogHelper.WriteLogInfo("换箱失败" + boxcode, LogHelper.Log_Type.ERROR);
|
||||
}
|
||||
return bo;
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
@ -677,14 +650,14 @@ namespace Epost.BLL
|
||||
{
|
||||
|
||||
List<JobModel> list = new List<JobModel>();
|
||||
DataTable OrderDt = dal.GetOrderList_Car(matchid, sku, area, block);
|
||||
DataTable OrderDt = dal.GetOrderList_Car(matchid, sku, area, block, UserCode);
|
||||
bool isecho = false;
|
||||
if (OrderDt == null || OrderDt.Rows.Count == 0)//回显
|
||||
{
|
||||
OrderDt = dal.GetOrderList_echo(matchid, sku, area, block);
|
||||
isecho = true;
|
||||
//if (OrderDt == null || OrderDt.Rows.Count == 0)//回显
|
||||
//{
|
||||
// OrderDt = dal.GetOrderList_echo(matchid, sku, area, block, UserCode);
|
||||
// isecho = true;
|
||||
|
||||
}
|
||||
//}
|
||||
if (OrderDt != null && OrderDt.Rows.Count > 0)
|
||||
{
|
||||
string usercode = string.Empty;
|
||||
@ -740,11 +713,11 @@ namespace Epost.BLL
|
||||
demodel.TaskArea = Convert.ToInt32(item["area"].ToString());
|
||||
demodel.TaskBlock = Convert.ToInt32(item["block"].ToString());
|
||||
demodel.No = "01";
|
||||
if (isecho)
|
||||
{
|
||||
demodel.No = "04";
|
||||
demodel.ColorCode = EnumHelper.EMToDescriptionString(LightColor.Color.Blue);
|
||||
}
|
||||
//if (isecho)
|
||||
//{
|
||||
// demodel.No = "04";
|
||||
// demodel.ColorCode = EnumHelper.EMToDescriptionString(LightColor.Color.Blue);
|
||||
//}
|
||||
list.Add(demodel);
|
||||
if (!isecho) {
|
||||
//修改数据为已读
|
||||
@ -963,7 +936,7 @@ namespace Epost.BLL
|
||||
#region 获取订单信息
|
||||
public DataTable GetOrderList_Car(string matchid, string sku, string sarea, string sblock)
|
||||
{
|
||||
return dal.GetOrderList_Car(matchid, sku, sarea, sblock);
|
||||
return dal.GetOrderList_Car(matchid, sku, sarea, sblock,"");
|
||||
}
|
||||
#endregion
|
||||
#region 获取订单信息
|
||||
|
Reference in New Issue
Block a user