|
|
|
@ -99,7 +99,7 @@ namespace Aucma.Scada.Business
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 接收下达的组装计划,根据BOM获取需要出库的箱壳、内胆物料信息
|
|
|
|
|
/// 接收下达的组装计划,根据BOM获取需要出库的泡后、内胆物料信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="planInfo"></param>
|
|
|
|
|
private void PlanHandle(ExecutePlanInfo planInfo)
|
|
|
|
@ -111,15 +111,11 @@ namespace Aucma.Scada.Business
|
|
|
|
|
if (planInfo != null)
|
|
|
|
|
{
|
|
|
|
|
string taskCode = DateTime.Now.ToString("HH:mm:ss");
|
|
|
|
|
var shellBomInfo = _bomInfoService.GetChildenBomInfoByMaterialCode(planInfo.materialCode, appConfig.shellMaterialType);
|
|
|
|
|
var linerBomInfo = _bomInfoService.GetChildenBomInfoByMaterialCode(planInfo.materialCode, appConfig.linerMaterialType);
|
|
|
|
|
var bomInfo = _bomInfoService.GetChildenBomInfoByMaterialCode(planInfo.materialCode, appConfig.shellMaterialType);
|
|
|
|
|
for (int i = 0; i < planInfo.planAmount - planInfo.completeAmount; i++)
|
|
|
|
|
{
|
|
|
|
|
OutStore(appConfig.shellStoreCode, shellBomInfo, planInfo.executePlanCode, taskCode);
|
|
|
|
|
OutStore(appConfig.foamStoreCode, bomInfo, planInfo.executePlanCode, taskCode);
|
|
|
|
|
Thread.Sleep(500);
|
|
|
|
|
OutStore(appConfig.linerStoreCode, linerBomInfo, planInfo.executePlanCode, taskCode);
|
|
|
|
|
Thread.Sleep(500);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
@ -296,41 +292,23 @@ namespace Aucma.Scada.Business
|
|
|
|
|
|
|
|
|
|
if (taskInfoList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
taskAmount = taskInfoList.Count; //下发的任务数量,默认2(箱壳、内胆),箱壳、内胆均执行完成后才会释放信号量
|
|
|
|
|
taskAmount = taskInfoList.Count; //下发的任务数量,默认2(泡后、内胆),泡后、内胆均执行完成后才会释放信号量
|
|
|
|
|
|
|
|
|
|
foreach (var item in taskInfoList)
|
|
|
|
|
{
|
|
|
|
|
taskCode = item.taskCode;
|
|
|
|
|
if (item.storeCode == appConfig.shellStoreCode)
|
|
|
|
|
{
|
|
|
|
|
if (taskHandleBusiness.SendShellTask_OutStore(item))
|
|
|
|
|
{
|
|
|
|
|
PrintLogInfoMessage($"下发箱壳出库任务:{item.taskCode};仓库{item.storeCode};货道:{item.spaceCode};等待PLC执行反馈");
|
|
|
|
|
PrintLogInfoMessage($"下发泡后出库任务:{item.taskCode};仓库{item.storeCode};货道:{item.spaceCode};等待PLC执行反馈");
|
|
|
|
|
item.taskStatus = 2;
|
|
|
|
|
iFlag++;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
PrintLogInfoMessage($"箱壳出库任务:{item.taskCode};下发失败,请排除PLC连接");
|
|
|
|
|
PrintLogInfoMessage($"泡后出库任务:{item.taskCode};下发失败,请排除PLC连接");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
shellCode = item.materialCode;
|
|
|
|
|
}
|
|
|
|
|
else if (item.storeCode == appConfig.linerStoreCode)
|
|
|
|
|
{
|
|
|
|
|
if (taskHandleBusiness.SendLinerTask_OutStore(item))
|
|
|
|
|
{
|
|
|
|
|
PrintLogInfoMessage($"下发内胆出库任务:{item.taskCode};仓库{item.storeCode};货道:{item.spaceCode};等待PLC执行反馈");
|
|
|
|
|
item.taskStatus = 2;
|
|
|
|
|
iFlag++;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
PrintLogInfoMessage($"内胆出库任务:{item.taskCode};下发失败,请排除PLC连接");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
linerCode = item.materialCode;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RefreshScanMateriaCodeEvent?.Invoke(item.materialCode, item.materialType, item.spaceName, item.storeCode);
|
|
|
|
|
}
|
|
|
|
@ -352,7 +330,7 @@ namespace Aucma.Scada.Business
|
|
|
|
|
|
|
|
|
|
semaphore.Wait(); //一直堵塞直到信号量释放
|
|
|
|
|
|
|
|
|
|
PrintLogInfoMessage($"出库任务:{taskCode};执行完成,绑定箱壳条码:{shellCode};内胆条码:{linerCode}");
|
|
|
|
|
PrintLogInfoMessage($"出库任务:{taskCode};执行完成,绑定泡后条码:{shellCode};内胆条码:{linerCode}");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -374,13 +352,13 @@ namespace Aucma.Scada.Business
|
|
|
|
|
List<RealTaskInfo> taskInfos = new List<RealTaskInfo>();
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
RealTaskInfo shellTaskInfo = _taskInfoService.GetTaskInfoByStoreCode(appConfig.shellStoreCode, 2);
|
|
|
|
|
RealTaskInfo foamTaskInfo = _taskInfoService.GetTaskInfoByStoreCode(appConfig.foamStoreCode, 2);
|
|
|
|
|
|
|
|
|
|
if (shellTaskInfo != null)
|
|
|
|
|
if (foamTaskInfo != null)
|
|
|
|
|
{
|
|
|
|
|
taskInfos.Add(shellTaskInfo);
|
|
|
|
|
//获取与箱壳任务匹配的内胆任务
|
|
|
|
|
RealTaskInfo linerTaskInfo = _taskInfoService.GetTaskInfoByTaskCode(shellTaskInfo.taskCode, appConfig.linerStoreCode);
|
|
|
|
|
taskInfos.Add(foamTaskInfo);
|
|
|
|
|
//获取与泡后任务匹配的内胆任务
|
|
|
|
|
RealTaskInfo linerTaskInfo = _taskInfoService.GetTaskInfoByTaskCode(foamTaskInfo.taskCode, appConfig.linerStoreCode);
|
|
|
|
|
if (linerTaskInfo != null) taskInfos.Add(linerTaskInfo);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
@ -409,42 +387,21 @@ namespace Aucma.Scada.Business
|
|
|
|
|
/// <param name="taskCode"></param>
|
|
|
|
|
private void TaskFeedback(string storeCode, string taskCode)
|
|
|
|
|
{
|
|
|
|
|
if (storeCode == appConfig.shellStoreCode)
|
|
|
|
|
{
|
|
|
|
|
ShellTaskFeedback(taskCode);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
LinerTaskFeedback(taskCode);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 箱壳执行反馈
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void ShellTaskFeedback(string taskCode)
|
|
|
|
|
{
|
|
|
|
|
Interlocked.Increment(ref completedTasks);
|
|
|
|
|
|
|
|
|
|
CheckCompletedTasks();
|
|
|
|
|
|
|
|
|
|
PrintLogInfoMessage("箱壳执行完成,自动释放信号量");
|
|
|
|
|
|
|
|
|
|
OutStoreFinish(taskCode, appConfig.shellStoreCode);
|
|
|
|
|
FoamTaskFeedback(taskCode);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 内胆执行反馈
|
|
|
|
|
/// 泡后执行反馈
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void LinerTaskFeedback(string taskCode)
|
|
|
|
|
private void FoamTaskFeedback(string taskCode)
|
|
|
|
|
{
|
|
|
|
|
Interlocked.Increment(ref completedTasks);
|
|
|
|
|
|
|
|
|
|
CheckCompletedTasks();
|
|
|
|
|
|
|
|
|
|
PrintLogInfoMessage("内胆执行完成,自动释放信号量");
|
|
|
|
|
PrintLogInfoMessage("泡后执行完成,自动释放信号量");
|
|
|
|
|
|
|
|
|
|
OutStoreFinish(taskCode, appConfig.linerStoreCode);
|
|
|
|
|
OutStoreFinish(taskCode, appConfig.foamStoreCode);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -505,7 +462,7 @@ namespace Aucma.Scada.Business
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public List<RealTaskInfo> GetOutStoreTask()
|
|
|
|
|
{
|
|
|
|
|
var taskInfos = _taskInfoService.GetTaskInfosByStoreCode(new string[] { appConfig.shellStoreCode, appConfig.linerStoreCode }, appConfig.outstoreTaskType);
|
|
|
|
|
var taskInfos = _taskInfoService.GetTaskInfosByStoreCode(new string[] { appConfig.foamStoreCode, appConfig.linerStoreCode }, appConfig.outstoreTaskType);
|
|
|
|
|
return taskInfos;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|