提交代码
This commit is contained in:
@ -12,6 +12,7 @@ using WCS.DAL;
|
||||
using WCS.DAL.Db;
|
||||
using WCS.DAL.DbModels;
|
||||
using WCS.Model;
|
||||
using static System.Formats.Asn1.AsnWriter;
|
||||
|
||||
namespace WCS.BLL.HardWare
|
||||
{
|
||||
@ -48,7 +49,7 @@ namespace WCS.BLL.HardWare
|
||||
}
|
||||
ModulesStr = string.Join(";", Modules.Select(t => t.ModuleCode));
|
||||
|
||||
ModuleIds = Modules.Select(t => t.ModuleId).ToList();
|
||||
ModuleIds = Modules.Select(t => t.BoardId).ToList();
|
||||
});
|
||||
|
||||
////初始化TCPCleint
|
||||
@ -72,14 +73,14 @@ namespace WCS.BLL.HardWare
|
||||
// }
|
||||
// index += (TcpCleint.PreFixLength + TcpCleint.DataLength - 1);//每次循环index会+1 所以这里-1
|
||||
// //获取板子ID
|
||||
// var boardId = (data[TcpCleint.PreFixLength + 0] << 8) + data[TcpCleint.PreFixLength + 1];
|
||||
// var boardIds = (data[TcpCleint.PreFixLength + 0] << 8) + data[TcpCleint.PreFixLength + 1];
|
||||
// var lightNumber = Convert.ToInt32(data[TcpCleint.PreFixLength + 3]);
|
||||
|
||||
// //协议处理 判断功能位
|
||||
// switch (dataTemp[TcpCleint.PreFixLength + 2])
|
||||
// {
|
||||
// case 0x01://进入入库模式信号
|
||||
// GoInInstoreProcess(dataTemp, boardId, lightNumber);
|
||||
// GoInInstoreProcess(dataTemp, boardIds, lightNumber);
|
||||
// break;
|
||||
// case 0x03://正常入库信号
|
||||
// InStoreReturnProcess(dataTemp);
|
||||
@ -107,12 +108,22 @@ namespace WCS.BLL.HardWare
|
||||
|
||||
public int LightId { get; set; }
|
||||
public WarningLight WarningLight { get; set; }
|
||||
/// <summary>
|
||||
/// 自检异常、未响应对应模式的异常
|
||||
/// </summary>
|
||||
public List<string> ExceptionMessages { get; set; } = new List<string>();
|
||||
|
||||
/// <summary>
|
||||
/// 过程中异常 入库过程中异常/出库过程中异常
|
||||
/// </summary>
|
||||
public List<ProcessingExceptionType> ProcessingExceptions { get; set; } = new List<ProcessingExceptionType>();
|
||||
public string? InstoreIpAddress { get; set; } = string.Empty;
|
||||
|
||||
public MatInfoResponse InStoreData { get; set; }
|
||||
|
||||
public List<string> CurrentOutStoreMatSNs { get; set; } = new List<string>();
|
||||
|
||||
public OutOrder CurrentOutOrder { get; set; }
|
||||
|
||||
public string OrderNumber { get; set; }
|
||||
|
||||
|
||||
@ -122,53 +133,92 @@ namespace WCS.BLL.HardWare
|
||||
#region 协议处理
|
||||
public void GoInInstore(string? IPAddress)
|
||||
{
|
||||
//判断当前模式是否为待机模式
|
||||
if (this.CurentMode != Mode.待机模式)
|
||||
try
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.CurentMode = Mode.入库模式;
|
||||
}
|
||||
//清空错误
|
||||
ExceptionMessages.Clear();
|
||||
//货架所有模组发送指令进入入库模式
|
||||
foreach (var module in Modules.Where(t => t.IsEnable).ToList())
|
||||
{
|
||||
module.GoInInstoreMode(TcpCleint);
|
||||
}
|
||||
//延时获取异常
|
||||
var timeOut = 3000;
|
||||
var timeSpan = TimeSpan.FromMilliseconds(0);
|
||||
var beginTime = DateTime.Now;
|
||||
while (timeSpan <= TimeSpan.FromMilliseconds(timeOut))
|
||||
{
|
||||
timeSpan = DateTime.Now - beginTime;
|
||||
//接收到第一个异常就不继续循环了
|
||||
if (ExceptionMessages.Count() > 0)
|
||||
if (this.CurentMode == Mode.入库模式)
|
||||
{
|
||||
var deficientTime = timeOut - (int)timeSpan.TotalMilliseconds;
|
||||
if (deficientTime > 0)
|
||||
Thread.Sleep(deficientTime);
|
||||
//出现异常的未进入入库模式,有红灯进行指引
|
||||
this.CurentMode = Mode.待机模式;
|
||||
InstoreIpAddress = IPAddress;
|
||||
return;
|
||||
}
|
||||
//延时处理
|
||||
Thread.Sleep(50);
|
||||
//判断当前模式是否为待机模式
|
||||
else if (this.CurentMode != Mode.待机模式)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.CurentMode = Mode.入库模式;
|
||||
}
|
||||
//清空错误
|
||||
ExceptionMessages.Clear();
|
||||
ProcessingExceptions.Clear();
|
||||
//货架所有模组发送指令进入入库模式
|
||||
foreach (var module in Modules.Where(t => t.IsEnable).ToList())
|
||||
{
|
||||
module.GoInInstoreMode(TcpCleint);
|
||||
}
|
||||
//延时获取异常
|
||||
var timeOut = 3000;
|
||||
var timeSpan = TimeSpan.FromMilliseconds(0);
|
||||
var beginTime = DateTime.Now;
|
||||
while (timeSpan <= TimeSpan.FromMilliseconds(timeOut))
|
||||
{
|
||||
timeSpan = DateTime.Now - beginTime;
|
||||
|
||||
//所有板子成功进入入库模式 表示进入入库模式成功,跳出循环
|
||||
var isExistsNotInstore = Modules.Where(t => t.CurrentMode != Mode.入库模式)
|
||||
.Where(t => t.IsEnable)
|
||||
.Any();
|
||||
if (!isExistsNotInstore)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
//接收到第一个异常就不继续循环了
|
||||
if (ExceptionMessages.Count() > 0)
|
||||
{
|
||||
var deficientTime = timeOut - (int)timeSpan.TotalMilliseconds;
|
||||
if (deficientTime > 0)
|
||||
Thread.Sleep(deficientTime);
|
||||
//出现异常的未进入入库模式,有红灯进行指引
|
||||
this.CurentMode = Mode.待机模式;
|
||||
break;
|
||||
}
|
||||
|
||||
//循环延时处理
|
||||
Thread.Sleep(50);
|
||||
}
|
||||
|
||||
//循环结束后判断当前板子状态
|
||||
var notInstoreList = Modules.Where(t => t.CurrentMode != Mode.入库模式)
|
||||
.Where(t => t.IsEnable).ToList();
|
||||
|
||||
if (notInstoreList.Count > 0)
|
||||
{
|
||||
CurentMode = Mode.待机模式;
|
||||
foreach (var item in notInstoreList)
|
||||
{
|
||||
ExceptionMessages.Add($"模组{item.ModuleCode}未进入入库模式!");
|
||||
}
|
||||
}
|
||||
|
||||
//警示灯亮起
|
||||
WarningLight.BlueLight(TcpCleint);
|
||||
//绑定当前进入入库PDA/WCS前端的IP
|
||||
InstoreIpAddress = IPAddress;
|
||||
//返回成功
|
||||
return;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
GoOutInstore();
|
||||
throw ex;
|
||||
}
|
||||
//警示灯亮起
|
||||
WarningLight.BlueLight(TcpCleint);
|
||||
//绑定当前进入入库PDA/WCS前端的IP
|
||||
InstoreIpAddress = IPAddress;
|
||||
//返回成功
|
||||
return;
|
||||
}
|
||||
|
||||
public void GoOutInstore()
|
||||
{
|
||||
//看货架是否为入库模式
|
||||
//当前货架是否为入库模式
|
||||
if (CurentMode != Mode.入库模式)
|
||||
{
|
||||
return;
|
||||
@ -178,20 +228,81 @@ namespace WCS.BLL.HardWare
|
||||
this.CurentMode = Mode.待机模式;
|
||||
}
|
||||
|
||||
//清空错误
|
||||
ExceptionMessages.Clear();
|
||||
//货架所有模组发送指令退出入库模式
|
||||
foreach (var module in Modules.Where(t => t.IsEnable)
|
||||
//.Where(t => t.CurrentMode == Mode.入库模式)
|
||||
.ToList())
|
||||
{
|
||||
module.GoOutInstoreMode(TcpCleint);
|
||||
if (module.CurrentMode == Mode.入库模式)
|
||||
module.GoOutInstoreMode(TcpCleint);
|
||||
}
|
||||
|
||||
var timeOut = 3000;
|
||||
var timeSpan = TimeSpan.FromMilliseconds(0);
|
||||
var beginTime = DateTime.Now;
|
||||
while (timeSpan <= TimeSpan.FromMilliseconds(timeOut))
|
||||
{
|
||||
timeSpan = DateTime.Now - beginTime;
|
||||
//所有板子是否成功退出入库模式
|
||||
var isExistsInstore = Modules.Where(t => t.CurrentMode != Mode.待机模式)
|
||||
.Where(t => t.IsEnable)
|
||||
.Any();
|
||||
if (!isExistsInstore)
|
||||
{
|
||||
break;
|
||||
}
|
||||
//循环延时处理
|
||||
Thread.Sleep(50);
|
||||
}
|
||||
|
||||
//循环结束后判断当前板子状态
|
||||
var list = Modules.Where(t => t.CurrentMode != Mode.待机模式)
|
||||
.Where(t => t.IsEnable)
|
||||
.ToList();
|
||||
if (list.Count > 0)
|
||||
{
|
||||
CurentMode = Mode.待机模式;
|
||||
foreach (var item in list)
|
||||
{
|
||||
ExceptionMessages.Add($"模组{item.ModuleCode}未成功退出入库模式!");
|
||||
}
|
||||
}
|
||||
//报警灯熄灭
|
||||
WarningLight.CloseLight(TcpCleint);
|
||||
}
|
||||
|
||||
public void GoInOutstore()
|
||||
public void GoInOutstore(List<OutOrderMatDetail> MatDetails, OutOrder outOrder)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
//第一步:设置货架当前模式
|
||||
if (CurentMode != Mode.待机模式)
|
||||
{
|
||||
Modules.ForEach(t => { t.Reset(TcpCleint); });
|
||||
}
|
||||
CurentMode = Mode.出库模式;
|
||||
|
||||
//第二步:货架添加需要出的SN 出库的领料单号
|
||||
//移除货架所有现有待出库的MatSN
|
||||
CurrentOutStoreMatSNs.Clear();
|
||||
////添加属于当前货架的物料
|
||||
CurrentOutStoreMatSNs.AddRange(MatDetails.Select(t => t.MatSN).ToList());
|
||||
////记录当前出库的发料单
|
||||
CurrentOutOrder = outOrder;
|
||||
|
||||
////第三步:对应的模组进入出库模式
|
||||
var boardIds = MatDetails.Select(t => t.StoreInfo.BoardId)
|
||||
.Distinct()
|
||||
.ToList();
|
||||
var outModules = Modules.Where(t => boardIds.Contains(t.BoardId)).ToList();
|
||||
outModules.ForEach(t =>
|
||||
{
|
||||
var outMatSns = MatDetails.Where(t => t.StoreInfo.ModuleId == t.Id)
|
||||
.Select(t => t.MatSN)
|
||||
.ToList();
|
||||
t.GoInOutStoreMode(TcpCleint, outMatSns);
|
||||
});
|
||||
//所有板子亮灯后 亮警示灯
|
||||
WarningLight.GreenLight(TcpCleint);
|
||||
}
|
||||
|
||||
public void GoInStocktaking()
|
||||
@ -201,6 +312,15 @@ namespace WCS.BLL.HardWare
|
||||
|
||||
public void GoOutOutstore()
|
||||
{
|
||||
//找到在出库中的模组
|
||||
var outingModules = Modules.Where(t => t.CurrentMode == Mode.出库模式)
|
||||
.ToList();
|
||||
foreach (var module in outingModules)
|
||||
{
|
||||
module.GoOutOutStoreMode(TcpCleint);
|
||||
}
|
||||
CurrentOutOrder = null;
|
||||
CurrentOutStoreMatSNs.Clear();
|
||||
this.CurentMode = Mode.待机模式;
|
||||
}
|
||||
|
||||
@ -236,6 +356,7 @@ namespace WCS.BLL.HardWare
|
||||
#region 协议返回处理
|
||||
public void ProtocolProcess(byte[] data, int boardId, int lightNumber)
|
||||
{
|
||||
Logs.Write("协议处理中的数据" + BitConverter.ToString(data) + $"板子id{boardId}");
|
||||
//协议处理 判断功能位
|
||||
switch (data[TcpCleint.PreFixLength + 2])
|
||||
{
|
||||
@ -248,8 +369,21 @@ namespace WCS.BLL.HardWare
|
||||
case 0x03://正常入库信号
|
||||
InStoreReturnProcess(data);
|
||||
break;
|
||||
case 0x04://入库模式中异常信号
|
||||
InStoreExceptionReturnProcess(data, boardId, lightNumber);
|
||||
break;
|
||||
case 0x05://进入出库模式返回信号
|
||||
|
||||
GoInOutstoreProcess(data, boardId, lightNumber);
|
||||
break;
|
||||
case 0x06://退出出库模式返回信号
|
||||
GoOutOutstoreProcess(data, boardId, lightNumber);
|
||||
break;
|
||||
case 0x07://正常出库返回信号
|
||||
OutstoreReturnProcess(data, boardId, lightNumber);
|
||||
break;
|
||||
case 0x13://复位的返回信号
|
||||
ResetReturnProcess(data, boardId, lightNumber);
|
||||
break;
|
||||
default:
|
||||
;
|
||||
break;
|
||||
@ -376,7 +510,7 @@ namespace WCS.BLL.HardWare
|
||||
//库位未配置、返回数据异常
|
||||
else
|
||||
{
|
||||
//Logs.Write($"[进入入库模式异常]板Id{boardId},库位号{index + 1}找不到对应库位!");
|
||||
//Logs.Write($"[进入入库模式异常]板Id{boardIds},库位号{index + 1}找不到对应库位!");
|
||||
}
|
||||
}
|
||||
else if (dataTemp[2 * index] == '0')
|
||||
@ -451,6 +585,9 @@ namespace WCS.BLL.HardWare
|
||||
}
|
||||
else
|
||||
{
|
||||
var exceptionMessage = storeInfo.StoreCode + "入库过程中存在物料未扫描上架!";
|
||||
WebSoceketManager.TrySendMessage("127.0.0.1", exceptionMessage);
|
||||
|
||||
module.ComfirmErrInstore(TcpCleint);
|
||||
WarningLight.WaringLightBlueEnd(TcpCleint);
|
||||
//WaringLightBlueEnd(shelfStatus.ClientIp, shelfStatus.LightId);
|
||||
@ -463,7 +600,7 @@ namespace WCS.BLL.HardWare
|
||||
{
|
||||
module.ComfirmErrInstore(TcpCleint);
|
||||
WarningLight.WaringLightBlueEnd(TcpCleint);
|
||||
//ComfirmErrInstoreByIp(shelfStatus.ClientIp, boardId);
|
||||
//ComfirmErrInstoreByIp(shelfStatus.ClientIp, boardIds);
|
||||
//WaringLightBlueEnd(shelfStatus.ClientIp, shelfStatus.LightId);
|
||||
//TO DO Logs.Write($"[{guid}]该位置已放置物料!");
|
||||
return;
|
||||
@ -549,6 +686,64 @@ namespace WCS.BLL.HardWare
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 入库模式中异常处理
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <param name="boardId"></param>
|
||||
/// <param name="lightNumber"></param>
|
||||
public void InStoreExceptionReturnProcess(byte[] data, int boardId, int lightNumber)
|
||||
{
|
||||
lightNumber = (int)data[TcpCleint.PreFixLength + 4];
|
||||
var store = DbHelp.db.Queryable<StoreInfo>()
|
||||
.Where(t => t.BoardId == boardId && t.LightNumber == lightNumber)
|
||||
.First();
|
||||
if (store == null)
|
||||
{
|
||||
//TO DO 库位未找到
|
||||
return;
|
||||
}
|
||||
//已放物料丢失了 物料多放了 储位恢复正常
|
||||
switch (data[TcpCleint.PreFixLength + 3])
|
||||
{
|
||||
case 0x00:
|
||||
{
|
||||
var exceptionMessage = store.StoreCode + "恢复正常!";
|
||||
WebSoceketManager.TrySendMessage("127.0.0.1", exceptionMessage);
|
||||
|
||||
ProcessingExceptions.RemoveAll(t => t.BoardId == boardId);
|
||||
}
|
||||
break;
|
||||
case 0x01:
|
||||
{
|
||||
var exceptionMessage = store.StoreCode + "入库过程中存在物料未扫描上架!";
|
||||
WebSoceketManager.TrySendMessage("127.0.0.1", exceptionMessage);
|
||||
|
||||
ProcessingExceptions.Add(new ProcessingExceptionType()
|
||||
{
|
||||
BoardId = boardId,
|
||||
LightNumber = lightNumber,
|
||||
ExceptionMessage = store.StoreCode + "入库过程中存在物料未扫描上架!"
|
||||
});
|
||||
}
|
||||
break;
|
||||
case 0x02:
|
||||
{
|
||||
var exceptionMessage = store.StoreCode + "物料被取出!";
|
||||
WebSoceketManager.TrySendMessage("127.0.0.1", exceptionMessage);
|
||||
|
||||
ProcessingExceptions.Add(new ProcessingExceptionType()
|
||||
{
|
||||
BoardId = boardId,
|
||||
LightNumber = lightNumber,
|
||||
ExceptionMessage = store.StoreCode + "入库过程中物料丢失!"
|
||||
});
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 进入出库模式协议返回
|
||||
@ -570,7 +765,7 @@ namespace WCS.BLL.HardWare
|
||||
}
|
||||
else
|
||||
{
|
||||
module.CurrentMode = Mode.入库模式;
|
||||
module.CurrentMode = Mode.出库模式;
|
||||
}
|
||||
}
|
||||
//库存物料与实际情况不匹配
|
||||
@ -584,7 +779,7 @@ namespace WCS.BLL.HardWare
|
||||
}
|
||||
else
|
||||
{
|
||||
module.CurrentMode = Mode.入库模式;
|
||||
module.CurrentMode = Mode.出库模式;
|
||||
}
|
||||
//获取当前板所有库位
|
||||
var storeInfos = DbHelp.db.Queryable<StoreInfo>()
|
||||
@ -673,7 +868,7 @@ namespace WCS.BLL.HardWare
|
||||
//库位未配置、返回数据异常
|
||||
else
|
||||
{
|
||||
//Logs.Write($"[进入入库模式异常]板Id{boardId},库位号{index + 1}找不到对应库位!");
|
||||
//Logs.Write($"[进入入库模式异常]板Id{boardIds},库位号{index + 1}找不到对应库位!");
|
||||
}
|
||||
}
|
||||
else if (dataTemp[2 * index] == '0')
|
||||
@ -695,6 +890,194 @@ namespace WCS.BLL.HardWare
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void OutstoreReturnProcess(byte[] data, int boardId, int lightNumber)
|
||||
{
|
||||
if (CurentMode != Mode.出库模式)
|
||||
{
|
||||
//TO DO 未在出库模式 要报错
|
||||
//Logs.Write($"[{guid}]出库错误:该货架模式不是出库模式或盘点模式{storeInfo.ShelfCode}!");
|
||||
return;
|
||||
}
|
||||
lightNumber = Convert.ToInt32(data[TcpCleint.PreFixLength + 3]);
|
||||
var storeInfo = DbHelp.db.Queryable<StoreInfo>().Where(t => t.BoardId == boardId
|
||||
&& t.LightNumber == lightNumber)
|
||||
.First();
|
||||
if (storeInfo == null)
|
||||
{
|
||||
//TO DO 报错
|
||||
return;
|
||||
}
|
||||
var module = this.Modules.Where(t => t.BoardId == boardId)
|
||||
.FirstOrDefault();
|
||||
if (module == null)
|
||||
{
|
||||
//TO DO 报错
|
||||
return;
|
||||
}
|
||||
//当前库位未记录MatSn
|
||||
if (string.IsNullOrEmpty(storeInfo.CurrentMatSn))
|
||||
{
|
||||
//该库位是需要出库的库位,物料被多次取出or给了多个正常出库信号
|
||||
Logs.Write($"该库位是需要出库的库位,物料被反复取出or给了多个正常出库信号,库位{storeInfo.StoreCode}");
|
||||
//暂不进行处理
|
||||
return;
|
||||
}
|
||||
|
||||
//不是本次出库需要出的物料
|
||||
if (!CurrentOutStoreMatSNs.Contains(storeInfo.CurrentMatSn))
|
||||
{
|
||||
//Logs.Write($"{storeInfo.CurrentMatSN}不是本次需要出库的物料");
|
||||
//报警灯报警
|
||||
WarningLight.WaringLightAlwaysRed(TcpCleint);
|
||||
return;
|
||||
}
|
||||
|
||||
//获取当前的库存信息
|
||||
var inventoryDetail = DbHelp.db.Queryable<InventoryDetail>().Where(t => t.MatSN == storeInfo.CurrentMatSn).First();
|
||||
if (inventoryDetail == null)
|
||||
{
|
||||
//Logs.Write($"{storeInfo.CurrentMatSN}库存信息不存在");
|
||||
//报警灯报警
|
||||
WarningLight.WaringLightAlwaysRed(TcpCleint);
|
||||
return;
|
||||
}
|
||||
//获取对应的出库单明细
|
||||
var orderOrderDetails = DbHelp.db.Queryable<OutOrderMatDetail>()
|
||||
.Where(t => t.OrderId == CurrentOutOrder.Id)
|
||||
.Where(t => t.MatSN == inventoryDetail.MatSN)
|
||||
.ToList();
|
||||
if (orderOrderDetails == null || orderOrderDetails.Count == 0)
|
||||
{
|
||||
//Logs.Write($"{storeInfo.CurrentMatSN},OrderDetail出库明细信息不存在");
|
||||
//报警灯报警
|
||||
WarningLight.WaringLightAlwaysRed(TcpCleint);
|
||||
return;
|
||||
}
|
||||
|
||||
#region 校验项通过 处理出库逻辑
|
||||
//当前库位的SN
|
||||
var matSN = storeInfo.CurrentMatSn;
|
||||
try
|
||||
{
|
||||
DbHelp.db.BeginTran();
|
||||
//库存明细表 删除
|
||||
;
|
||||
//出入库记录表 新增
|
||||
var inOutRecord = new InOutRecord()
|
||||
{
|
||||
StoreCode = storeInfo.StoreCode,
|
||||
StoreId = storeInfo.Id,
|
||||
StoreInfo = storeInfo,
|
||||
|
||||
MatSN = inventoryDetail.MatSN,
|
||||
MatCode = inventoryDetail.MatCode,
|
||||
MatName = inventoryDetail.MatName,
|
||||
MatBatch = inventoryDetail.MatBatch,
|
||||
MatQty = inventoryDetail.MatQty,
|
||||
MatSpec = inventoryDetail.MatSpec,
|
||||
MatCustomer = inventoryDetail.MatCustomer,
|
||||
MatSupplier = inventoryDetail.MatSupplier,
|
||||
|
||||
Direction = DirectionEnum.出库,
|
||||
};
|
||||
//库位表 修改
|
||||
storeInfo.CurrentMatSn = string.Empty;
|
||||
|
||||
//发料单明细表 更新为已出库
|
||||
orderOrderDetails.ForEach(x =>
|
||||
{
|
||||
x.IsSended = true;
|
||||
});
|
||||
//TO DO 发料需求表增加数量
|
||||
|
||||
//保存数据
|
||||
DbHelp.db.Deleteable(inventoryDetail).ExecuteCommand();
|
||||
DbHelp.db.Insertable(inOutRecord).ExecuteCommand();
|
||||
DbHelp.db.Updateable(storeInfo).ExecuteCommand();
|
||||
DbHelp.db.Updateable(orderOrderDetails).ExecuteCommand();
|
||||
DbHelp.db.CommitTran();
|
||||
|
||||
//报警灯同时亮绿灯并鸣叫一次提示。
|
||||
WarningLight.SuccessLightGreenEnd(TcpCleint);
|
||||
|
||||
//确认本次出库
|
||||
module.ComfirmOutstore(TcpCleint, data[TcpCleint.PreFixLength + 3]);
|
||||
//shelfStatus.SetCurrentModeTime = DateTime.Now;
|
||||
//LocalStatic.IsRefreshOrderDetail = true;
|
||||
|
||||
//当前柜子是否还存在未出库的
|
||||
CurrentOutStoreMatSNs.RemoveAll(t => t == matSN);//删除本次已出的物料SN
|
||||
|
||||
var isExsistOut = CurrentOutStoreMatSNs.Any();
|
||||
if (!isExsistOut)
|
||||
{
|
||||
//Logs.Write($"货架[{shelfStatus.ShelfCode}]:不存在待出物料,退出出库模式");
|
||||
//退出出库模式
|
||||
GoOutOutstore();
|
||||
WarningLight.CloseLight(TcpCleint);
|
||||
|
||||
var currentPickBillNumber = CurrentOutOrder.OrderNumber;
|
||||
CurrentOutOrder = null;
|
||||
Task.Run(() =>
|
||||
{
|
||||
//LocalStatic.UpdatOutOrderStatus(currentPickBillNumber);
|
||||
//给信号通知出库页面更新页面的状态
|
||||
});
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
DbHelp.db.RollbackTran();
|
||||
//报警灯报警
|
||||
WarningLight.WaringLightAlwaysRed(TcpCleint);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 退出出库模式返回信号处理
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
public void GoOutOutstoreProcess(byte[] data, int boardId, int lightNumber)
|
||||
{
|
||||
var module = this.Modules.Where(t => t.BoardId == boardId && t.CurrentMode == Mode.出库模式).FirstOrDefault();
|
||||
if (module == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
module.CurrentMode = Mode.待机模式;
|
||||
}
|
||||
}
|
||||
|
||||
public void ResetReturnProcess(byte[] data, int boardId, int lightNumber)
|
||||
{
|
||||
var module = this.Modules.Where(t => t.BoardId == boardId && t.CurrentMode == Mode.入库模式).FirstOrDefault();
|
||||
if (module == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
module.CurrentMode = Mode.待机模式;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 过程中异常类型
|
||||
/// </summary>
|
||||
public class ProcessingExceptionType
|
||||
{
|
||||
public int BoardId { get; set; }
|
||||
|
||||
public int LightNumber { get; set; }
|
||||
|
||||
public string ExceptionMessage { get; set; }
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user