|
|
@ -97,7 +97,7 @@ namespace Aucma.Scada.Business
|
|
|
|
public delegate void RefreshLogMessage(string message);
|
|
|
|
public delegate void RefreshLogMessage(string message);
|
|
|
|
public event RefreshLogMessage RefreshLogMessageEvent;
|
|
|
|
public event RefreshLogMessage RefreshLogMessageEvent;
|
|
|
|
|
|
|
|
|
|
|
|
public delegate void RefreshAssemblyPlanInit();
|
|
|
|
public delegate void RefreshAssemblyPlanInit(int isFlag = 0);
|
|
|
|
public event RefreshAssemblyPlanInit RefreshAssemblyPlanInitEvent;
|
|
|
|
public event RefreshAssemblyPlanInit RefreshAssemblyPlanInitEvent;
|
|
|
|
|
|
|
|
|
|
|
|
public delegate void RefreshStoreStock();
|
|
|
|
public delegate void RefreshStoreStock();
|
|
|
@ -122,7 +122,8 @@ namespace Aucma.Scada.Business
|
|
|
|
taskHandleBusiness.OutStoreFinsihEvent += OutStoreFinish;
|
|
|
|
taskHandleBusiness.OutStoreFinsihEvent += OutStoreFinish;
|
|
|
|
taskHandleBusiness.UpdateMesPlanCompleteEvent += UpdatePlanInfo;
|
|
|
|
taskHandleBusiness.UpdateMesPlanCompleteEvent += UpdatePlanInfo;
|
|
|
|
StartPassDown();
|
|
|
|
StartPassDown();
|
|
|
|
}catch (Exception ex)
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Console.WriteLine($"OutStoreBusiness异常:{ex.Message}");
|
|
|
|
Console.WriteLine($"OutStoreBusiness异常:{ex.Message}");
|
|
|
|
PrintLogErrorMessage($"OutStoreBusiness异常:{ex.Message}");
|
|
|
|
PrintLogErrorMessage($"OutStoreBusiness异常:{ex.Message}");
|
|
|
@ -151,13 +152,58 @@ namespace Aucma.Scada.Business
|
|
|
|
for (int i = 0; i < planInfo.planAmount - planInfo.completeAmount; i++)
|
|
|
|
for (int i = 0; i < planInfo.planAmount - planInfo.completeAmount; i++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
string taskCode = System.Guid.NewGuid().ToString("N").Substring(0, 10);
|
|
|
|
string taskCode = System.Guid.NewGuid().ToString("N").Substring(0, 10);
|
|
|
|
RealTaskInfo shellTask = OutStore(appConfig.shellStoreCode, shellBomInfo, planInfo.executePlanCode, taskCode);
|
|
|
|
|
|
|
|
Thread.Sleep(500);
|
|
|
|
|
|
|
|
RealTaskInfo linerTask = OutStore(appConfig.linerStoreCode, linerBomInfo, planInfo.executePlanCode, taskCode);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Thread.Sleep(500);
|
|
|
|
//RealTaskInfo shellTask = OutStore(appConfig.shellStoreCode, shellBomInfo, planInfo.executePlanCode, taskCode);
|
|
|
|
|
|
|
|
//Thread.Sleep(500);
|
|
|
|
|
|
|
|
//RealTaskInfo linerTask = OutStore(appConfig.linerStoreCode, linerBomInfo, planInfo.executePlanCode, taskCode);
|
|
|
|
|
|
|
|
//Thread.Sleep(500);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var shellSpaceInfo = GetSpaceInfoByMaterialType(appConfig.shellStoreCode, shellBomInfo.materialCode);
|
|
|
|
|
|
|
|
Thread.Sleep(100);
|
|
|
|
|
|
|
|
var linerSpaceInfo = GetSpaceInfoByMaterialType(appConfig.linerStoreCode, linerBomInfo.materialCode);
|
|
|
|
|
|
|
|
Thread.Sleep(100);
|
|
|
|
|
|
|
|
//判断库存
|
|
|
|
|
|
|
|
if (shellSpaceInfo != null && linerSpaceInfo != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
RealTaskInfo shell_task = CreateOutStoreTask(shellSpaceInfo, planInfo.executePlanCode, taskCode); //创建出库任务
|
|
|
|
|
|
|
|
if (shell_task != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
PrintLogInfoMessage("箱壳出库计划创建成功");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
PrintLogInfoMessage("箱壳出库计划创建失败");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assemblyPlanBusiness.autoFlag = false;
|
|
|
|
|
|
|
|
RefreshAssemblyPlanInitEvent?.Invoke(2);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Thread.Sleep(100);
|
|
|
|
|
|
|
|
RealTaskInfo liner_task = CreateOutStoreTask(shellSpaceInfo, planInfo.executePlanCode, taskCode); //创建出库任务
|
|
|
|
|
|
|
|
if (shell_task != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
PrintLogInfoMessage("箱壳出库计划创建成功");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
PrintLogInfoMessage("箱壳出库计划创建失败");
|
|
|
|
|
|
|
|
assemblyPlanBusiness.autoFlag = false;
|
|
|
|
|
|
|
|
RefreshAssemblyPlanInitEvent?.Invoke(2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
PrintLogInfoMessage($"组装计划:{planInfo.executePlanCode};出库失败,货道不匹配,未匹配到相同型号物料");
|
|
|
|
|
|
|
|
assemblyPlanBusiness.autoFlag = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Thread.Sleep(1000 * 2);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -387,7 +433,8 @@ namespace Aucma.Scada.Business
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// PrintLogInfoMessage("未获取到需要下发的箱壳出库任务");
|
|
|
|
// PrintLogInfoMessage("未获取到需要下发的箱壳出库任务");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}catch(Exception ex)
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
PrintLogErrorMessage("下传箱壳出库任务逻辑处理异常", ex);
|
|
|
|
PrintLogErrorMessage("下传箱壳出库任务逻辑处理异常", ex);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -760,11 +807,11 @@ namespace Aucma.Scada.Business
|
|
|
|
PrintLogInfoMessage($"通过PLC读取货道信息,货道:{spaceInfo.spaceName};在库数量:{item.spaceStock};货道状态:{item.spaceStatus}");
|
|
|
|
PrintLogInfoMessage($"通过PLC读取货道信息,货道:{spaceInfo.spaceName};在库数量:{item.spaceStock};货道状态:{item.spaceStatus}");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var list = info.Where(x=>x.spaceStatus == 1 && x.spaceStock > 0 && (x.spaceStock - x.outRouteAmount) > 0).ToList();
|
|
|
|
var list = info.Where(x => x.spaceStatus == 1 && x.spaceStock > 0).ToList(); // && (x.spaceStock - x.outRouteAmount) > 0
|
|
|
|
|
|
|
|
|
|
|
|
if (list.Count > 0)
|
|
|
|
if (list.Count > 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
result = info.OrderBy(x => x.spaceStock - x.outRouteAmount).First();
|
|
|
|
result = info.OrderBy(x => x.spaceStock).First();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|