|
|
|
@ -35,7 +35,7 @@ namespace Aucma.Core.PalletizCX1.Business
|
|
|
|
|
private readonly AppConfig _appConfig;
|
|
|
|
|
|
|
|
|
|
private AppConfig appConfig = new AppConfig();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public string storeCode = Appsettings.app("StoreInfo", "PalletizStoreCodeA");
|
|
|
|
|
// 过点数据表,物料完成记录MaterialCompletion
|
|
|
|
|
private readonly IMaterialCompletionServices? _iMaterialCompletionServices = App.ServiceProvider.GetService<IMaterialCompletionServices>();
|
|
|
|
@ -137,12 +137,12 @@ namespace Aucma.Core.PalletizCX1.Business
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrEmpty(asciiStr))
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentException($"条码信息为空");
|
|
|
|
|
throw new ArgumentException($"{spaceArea}条码信息为空");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(spaceArea))
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentException($"货道区域为空");
|
|
|
|
|
throw new ArgumentException($"{spaceArea}货道区域为空");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_offlineService.GetProductInfosBySnCode(asciiStr, out ProductOffline prodInfo);
|
|
|
|
@ -151,7 +151,8 @@ namespace Aucma.Core.PalletizCX1.Business
|
|
|
|
|
|
|
|
|
|
if (prodInfo == null)
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentException($"根据成品码获取成品信息为空");
|
|
|
|
|
log.Error($"区域:{spaceArea}根据成品码获取成品信息为空");
|
|
|
|
|
throw new ArgumentException($"区域:{spaceArea}根据成品码获取成品信息为空");
|
|
|
|
|
}
|
|
|
|
|
RefreshProductInfoEvent?.Invoke(asciiStr, prodInfo.ProductModel, prodInfo.ProductOrderNo);
|
|
|
|
|
|
|
|
|
@ -160,7 +161,7 @@ namespace Aucma.Core.PalletizCX1.Business
|
|
|
|
|
out BaseSpaceInfo spaceinfo);
|
|
|
|
|
if (!getSpaceResult)
|
|
|
|
|
{
|
|
|
|
|
msg = $"{prodInfo.ProductName}未找到货道,请检查该型号是否有货道或者货道已满";
|
|
|
|
|
msg = $"区域:{spaceArea}:{prodInfo.ProductName}未找到货道,请检查该型号是否有货道或者货道已满";
|
|
|
|
|
RefreshMsgEvent?.Invoke(msg);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -198,14 +199,14 @@ namespace Aucma.Core.PalletizCX1.Business
|
|
|
|
|
|
|
|
|
|
if (!result)
|
|
|
|
|
{
|
|
|
|
|
msg = msg + "放行失败";
|
|
|
|
|
msg = msg + $"区域:{spaceArea}放行失败";
|
|
|
|
|
RefreshMsgEvent?.Invoke(msg);
|
|
|
|
|
throw new ArgumentException($"入库任务下发至PLC失败,等待plc响应超时");
|
|
|
|
|
throw new ArgumentException($"区域{spaceArea}: 入库任务下发至PLC失败,等待plc响应超时");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
msg = msg + "放行成功";
|
|
|
|
|
msg = msg + $"区域{spaceArea}放行成功";
|
|
|
|
|
RefreshMsgEvent?.Invoke(msg);
|
|
|
|
|
List<BaseSpaceInfo> spaceinfos = new List<BaseSpaceInfo>();
|
|
|
|
|
if (laseSpaceinfo != null)
|
|
|
|
@ -291,7 +292,7 @@ namespace Aucma.Core.PalletizCX1.Business
|
|
|
|
|
|
|
|
|
|
if (spaceinfos == null || spaceinfos.Count==0)
|
|
|
|
|
{
|
|
|
|
|
log.Info($"通过物料型号获取货道信息异常:根据成品信息获取货道信息为空");
|
|
|
|
|
log.Info($"区域{spaceArea},{prodInfo.ProductSncode}通过物料型号获取货道信息异常:根据成品信息获取货道信息为空");
|
|
|
|
|
laseSpaceinfo = null;
|
|
|
|
|
spaceinfo = null;
|
|
|
|
|
return false;
|
|
|
|
@ -303,7 +304,7 @@ namespace Aucma.Core.PalletizCX1.Business
|
|
|
|
|
|
|
|
|
|
if (spaceinfos == null || spaceinfos.Count==0)
|
|
|
|
|
{
|
|
|
|
|
log.Info($"通过物料型号获取货道信息异常:根据成品信息获取货道信息为空");
|
|
|
|
|
log.Info($"区域{spaceArea},{prodInfo.ProductSncode}通过物料型号获取货道信息异常:根据成品信息获取货道信息为空");
|
|
|
|
|
laseSpaceinfo = null;
|
|
|
|
|
spaceinfo = null;
|
|
|
|
|
return false;
|
|
|
|
@ -313,7 +314,7 @@ namespace Aucma.Core.PalletizCX1.Business
|
|
|
|
|
|
|
|
|
|
if (spaceinfo == null || spaceinfos.Count==0)
|
|
|
|
|
{
|
|
|
|
|
log.Info($"通过物料型号获取货道信息异常:根据成品信息获取货道信息为空");
|
|
|
|
|
log.Info($"区域{spaceArea},{prodInfo.ProductSncode}通过物料型号获取货道信息异常:根据成品信息获取货道信息为空");
|
|
|
|
|
laseSpaceinfo = null;
|
|
|
|
|
spaceinfo = null;
|
|
|
|
|
return false;
|
|
|
|
@ -397,7 +398,7 @@ namespace Aucma.Core.PalletizCX1.Business
|
|
|
|
|
rangeResult = 0;
|
|
|
|
|
if (plcCon == null)
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentException($"下发入库任务至PLC逻辑异常:Plc连接为空");
|
|
|
|
|
throw new ArgumentException($"成品码:{asciiStr},仓库区域:{spaceinfo.SpaceArea},匹配货道:{spaceinfo.SpaceCode}下发入库任务至PLC逻辑异常:Plc连接为空");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var _plc = plcCon.plc;
|
|
|
|
@ -423,26 +424,38 @@ namespace Aucma.Core.PalletizCX1.Business
|
|
|
|
|
result = false;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
bool answerFlag = _plc.ReadBool("B1000");
|
|
|
|
|
|
|
|
|
|
bool answerFlag = false;
|
|
|
|
|
if(spaceinfo.SpaceArea == "A")
|
|
|
|
|
{
|
|
|
|
|
answerFlag = _plc.ReadBool("B1000");
|
|
|
|
|
}
|
|
|
|
|
else if(spaceinfo.SpaceArea == "B")
|
|
|
|
|
{
|
|
|
|
|
answerFlag = _plc.ReadBool("B1001");
|
|
|
|
|
}
|
|
|
|
|
else if(spaceinfo.SpaceArea =="C")
|
|
|
|
|
{
|
|
|
|
|
answerFlag = _plc.ReadBool("B1000");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (answerFlag)
|
|
|
|
|
{
|
|
|
|
|
isFlag = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Task.Delay(500).Wait();
|
|
|
|
|
Task.Delay(500).Wait();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (spaceinfo.SpaceArea == "A")
|
|
|
|
|
{
|
|
|
|
|
if (!_plc.WriteInt16("D2", spinFlag.ToString()))
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentException($"旋转角度下发至PLC失败");
|
|
|
|
|
throw new ArgumentException($"A区域旋转角度下发至PLC失败");
|
|
|
|
|
}
|
|
|
|
|
if (!_plc.WriteInt16("D29", spaceCode.ToString()))
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentException($"货道号下发至PLC失败");
|
|
|
|
|
throw new ArgumentException($"A区域货道号下发至PLC失败");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_plc.WriteInt16("B1001", "1");//发送完成信号
|
|
|
|
@ -452,7 +465,33 @@ namespace Aucma.Core.PalletizCX1.Business
|
|
|
|
|
else if (spaceinfo.SpaceArea == "B")
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
result = false;
|
|
|
|
|
if (!_plc.WriteInt16("D2", spinFlag.ToString()))
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentException($"B区域旋转角度下发至PLC失败");
|
|
|
|
|
}
|
|
|
|
|
if (!_plc.WriteInt16("D29", spaceCode.ToString()))
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentException($"B区域货道号下发至PLC失败");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_plc.WriteInt16("B1001", "1");//发送完成信号
|
|
|
|
|
|
|
|
|
|
result = true;
|
|
|
|
|
}
|
|
|
|
|
else if (spaceinfo.SpaceArea == "C")
|
|
|
|
|
{
|
|
|
|
|
if (!_plc.WriteInt16("D2", spinFlag.ToString()))
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentException($"C区域旋转角度下发至PLC失败");
|
|
|
|
|
}
|
|
|
|
|
if (!_plc.WriteInt16("D29", spaceCode.ToString()))
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentException($"C区域货道号下发至PLC失败");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_plc.WriteInt16("B1001", "1");//发送完成信号
|
|
|
|
|
|
|
|
|
|
result = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|