Commit 63d10f49 by jiawei.su

someupdate

parent af347f97
......@@ -253,6 +253,10 @@ namespace Siger.ApiACC.Controllers
Logger.WriteLineInfo($"PlCfeeback 设备属性为维护");
throw new BadRequestException(AccEnum.SectionPropertyNull);
}
//清空 监控Monitor
//PLC 反馈执行中
if(status==(int)TaskResultStatus.Produce)
{
......@@ -287,6 +291,13 @@ namespace Siger.ApiACC.Controllers
//PLC 反馈结束.
if (status == (int)TaskResultStatus.Complated)
{
//清空历史监控
var monitors = _automationFixtureMonitor.GetList(f => f.section != taskObj.sectionid && f.sn == taskObj.sn);
foreach(var obj in monitors)
{
_automationFixtureMonitor.Delete(obj);
}
var location = _automationLocation.Get(f => f.fixturetools == taskObj.fixtureguid && f.locationid == taskObj.locationid);
if (location == null)
{
......@@ -379,7 +390,10 @@ namespace Siger.ApiACC.Controllers
{
if (taskObj.action == TaskAction.Step_QXJ_LK)
{
if (location.status==(int)LocationStatus.In)
{
throw new BadRequestException(AccEnum.LocationSnExits);
}
var currenRute = _productRoute.Get(f => f.id == taskObj.route);
if (currenRute == null)
{
......@@ -400,6 +414,8 @@ namespace Siger.ApiACC.Controllers
}
}
//添加当前监控
if (monitor == null)
{
_automationFixtureMonitor.Insert(new siger_automation_fixture_tools_monitor
......@@ -553,8 +569,11 @@ namespace Siger.ApiACC.Controllers
if (lastTask.status == (int)TaskResultStatus.Complated)
{
Logger.WriteLineInfo($"自动化业务流转--AutoProcess section{cleanMachine.section} task:{TaskAction.Step_QXJ_LK.ToStr()} sn {lastTask.sn}");
//if (TargetFree(invenSection.sectionid, cleanMachine.section, TaskAction.Step_QXJ_LK))
//{
CreateTask(invenSection.sectionid, cleanMachine.section, TaskActionType.Unload, TaskAction.Step_QXJ_LK, lastTask.fixtureguid, lastTask.fixturename, lastTask.ordercode, lastTask.sn, "无程序", lastTask.productid, lastTask.productcode, lastTask.productname, lastTask.locationid, lastTask.route);
return; //完成当前任务 退出
//}
}
}
}
......@@ -573,7 +592,10 @@ namespace Siger.ApiACC.Controllers
return; //任务已经创建
}
Logger.WriteLineInfo($"自动化业务流转--AutoProcess section{location.section} task:{TaskAction.Step_LK_JGZX.ToStr()} sn {location.sn}");
if (TargetFree(location.section, location.section, TaskAction.Step_LK_JGZX))
{
CreateTask(location.section, location.section, TaskActionType.Load, TaskAction.Step_LK_JGZX, location.fixture, location.fixturename, location.ordernumber, location.sn, location.pn, location.productId, location.productCode, location.productName, location.location, location.route);
}
}
}
......@@ -600,10 +622,13 @@ namespace Siger.ApiACC.Controllers
Logger.WriteLineError($"AutoProcess 清洗机空闲,上一个任务与本次任务指令重复");
return;
}
if (TargetFree(cleanMachine.section, fullMachine.section, TaskAction.Step_JGZX_QXJ))
{
//创建CNC 下料到清洗机
CreateTask(cleanMachine.section, fullMachine.section, TaskActionType.Unload, TaskAction.Step_JGZX_QXJ, tasklist.fixtureguid, tasklist.fixturename, tasklist.ordercode, tasklist.sn, tasklist.programnumber, tasklist.productid, tasklist.productcode, tasklist.productname, tasklist.locationid, tasklist.route);
return; //完成当前任务 退出
}
}
else
{
......@@ -618,6 +643,8 @@ namespace Siger.ApiACC.Controllers
if (lastTask != null)
{
Logger.WriteLineInfo($"自动化业务流转--AutoProcess section{fullMachine.section} task:{TaskAction.Step_JGZX_QXJ.ToStr()} sn {lastTask.sn}");
if (TargetFree(cleanMachine.section, fullMachine.section, TaskAction.Step_JGZX_QXJ))
{
CreateTask(cleanMachine.section, fullMachine.section, TaskActionType.Unload, TaskAction.Step_JGZX_QXJ, lastTask.fixtureguid, lastTask.fixturename, lastTask.ordercode, lastTask.sn, lastTask.programnumber, lastTask.productid, lastTask.productcode, lastTask.productname, lastTask.locationid, lastTask.route);
}
}
......@@ -626,6 +653,7 @@ namespace Siger.ApiACC.Controllers
}
}
}
}
/// <summary>
......@@ -647,7 +675,6 @@ namespace Siger.ApiACC.Controllers
/// <param name="route"></param>
void CreateTask(int toSection, int fromSection, TaskActionType actionType, TaskAction taskAction, string guid, string fixtruename, string orderno, string sn, string program, int productId, string productCode, string productName, int locationid, int route)
{
var taskNo = _automationTaskList.CrateTaskNumber(Automation.TaskTrigerType.Auto);
_automationTaskList.Insert(new siger_automation_task_list
{
......@@ -787,5 +814,19 @@ namespace Siger.ApiACC.Controllers
}
return true;
}
bool TargetFree( int toSection, int fromSection, TaskAction taskAction)
{
var moniter = _automationFixtureMonitor.Get(f => f.section == toSection);
if (moniter != null)
{
if (!string.IsNullOrEmpty(moniter.sn))
{
Logger.WriteLineInfo($"CreateTask sectionId:{fromSection}工站->{toSection}工站 {EnumHelper.GetEnumDesc(taskAction)} 无法创建任务,{toSection} 工站上有SN在加工");
return false;
}
}
return true;
}
}
}
......@@ -312,16 +312,19 @@ namespace Siger.ApiACC.Controllers
{
throw new BadRequestException(AccEnum.Station_Null);
}
if (upload.down != 0)
{
throw new BadRequestException(AccEnum.Downloading);
}
if (upload.upload!=0)
{
throw new BadRequestException(AccEnum.TaskProcessing);
}
upload.upload = 1;
_sectionPropertyRepository.Update(upload);
var plandts = _planDetails.Get(f => f.projectId == ProjectId && f.OrderNumber == loading.code);
if (plandts==null)
{
throw new BadRequestException(CncEnum.PlanHasExist);
throw new BadRequestException(CncEnum.WorkOrderNotExist);
}
var plan = _productPlan.Get(f => f.id == plandts.PlanId);
if (plan == null)
......@@ -330,11 +333,13 @@ namespace Siger.ApiACC.Controllers
}
//检查工装
var fixtureToolsObj = _automationFixtureTools.GetProductFixtureLocation(ProjectId,loading.guid,loading.locationid);
//var fixtureToolsObj = _automationFixtureToolsProduct.GetFixtureInfoByProductCode(ProjectId, plan.product_code);
if (fixtureToolsObj == null)
{
throw new BadRequestException(AccEnum.FixtureToolsIsNone);
}
upload.upload = 1;
_sectionPropertyRepository.Update(upload);
var monitor = _automationFixtureMonitor.Get(f => f.section == loading.section);
if (monitor != null)
{
......@@ -420,6 +425,10 @@ namespace Siger.ApiACC.Controllers
{
throw new BadRequestException(AccEnum.Station_Null);
}
if (upload.down != 0)
{
throw new BadRequestException(AccEnum.Downloading);
}
if (upload.upload==0)
{
throw new BadRequestException(AccEnum.MachineOnFree);
......@@ -510,6 +519,10 @@ namespace Siger.ApiACC.Controllers
{
throw new BadRequestException(AccEnum.Station_Null);
}
if (upload.upload!=0)
{
throw new BadRequestException(AccEnum.Uploading);
}
if (upload.down != 0)
{
throw new BadRequestException(AccEnum.TaskProcessing);
......@@ -635,7 +648,11 @@ namespace Siger.ApiACC.Controllers
{
throw new BadRequestException(AccEnum.Station_Null);
}
if(upload.down==0)
if (upload.upload != 0)
{
throw new BadRequestException(AccEnum.Uploading);
}
if (upload.down==0)
{
throw new BadRequestException(AccEnum.MachineOnFree);
}
......
......@@ -345,7 +345,13 @@ namespace Siger.Middlelayer.Common.ModuleEnum
[Description("该储位无工件")]
LocationNoSn,
[Description("工站属性为空")]
SectionPropertyNull
SectionPropertyNull,
[Description("该储位已存在工件")]
LocationSnExits,
[Description("该工站正在上料中")]
Uploading,
[Description("该工站正在下料中")]
Downloading
}
public enum SeriNumCfg
......
......@@ -250,6 +250,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
where q.projectId == projectId && !string.IsNullOrEmpty(q.sn)
&& q.status == (int)RowState.Valid&& t.status == (int)RowState.Valid
&& l.status == (int)RowState.Valid && w.status == (int)RowState.Valid
&& q.routeid==0
select new ResponseAutomationLocationList
{
id = q.id,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment