Commit f9c1da95 by jiawei.su

fixedbug

parent 3a6bfe74
...@@ -297,7 +297,7 @@ namespace Siger.ApiACC.Controllers ...@@ -297,7 +297,7 @@ namespace Siger.ApiACC.Controllers
{ {
throw new BadRequestException(AccEnum.ProductRouteMissing); throw new BadRequestException(AccEnum.ProductRouteMissing);
} }
location.route = route.id.ToString(); location.routeid = route.id;
location.status = (int)LocationStatus.Out; location.status = (int)LocationStatus.Out;
_automationLocation.Update(location); _automationLocation.Update(location);
...@@ -429,7 +429,7 @@ namespace Siger.ApiACC.Controllers ...@@ -429,7 +429,7 @@ namespace Siger.ApiACC.Controllers
Logger.WriteLineInfo($"AutoProcess 无可用状态的设备"); Logger.WriteLineInfo($"AutoProcess 无可用状态的设备");
return; return;
} }
//优先级1 :清洗机完成 。待下料
var cleanProperty = sectionPropertys.FirstOrDefault(f=>f.propertytype == 4); var cleanProperty = sectionPropertys.FirstOrDefault(f=>f.propertytype == 4);
if (cleanProperty==null) if (cleanProperty==null)
{ {
...@@ -443,11 +443,12 @@ namespace Siger.ApiACC.Controllers ...@@ -443,11 +443,12 @@ namespace Siger.ApiACC.Controllers
} }
else else
{ {
//优先级1 :清洗机完成 。待下料
if (cleanMachine.status == (int)Automation.MachineStatus.Complated) if (cleanMachine.status == (int)Automation.MachineStatus.Complated)
{ {
Logger.WriteLineError($"AutoProcess 有清洗机{ cleanMachine.section}完成,创建清洗机Task"); Logger.WriteLineError($"AutoProcess 有清洗机{ cleanMachine.section}完成,创建清洗机Task");
//取最近完成的 Task //取最近完成的 Task
var lastTask = _automationTaskList.GetList(f => f.extend1 == cleanMachine.section.ToString(),"id",true).FirstOrDefault(); var lastTask = _automationTaskList.GetList(f => f.extend1 == cleanMachine.section.ToString() && f.status== (int)Automation.TaskResultStatus.Complated, "id",true).FirstOrDefault();
if (lastTask != null) if (lastTask != null)
{ {
lastTask.extend1 = string.Empty; lastTask.extend1 = string.Empty;
...@@ -465,33 +466,9 @@ namespace Siger.ApiACC.Controllers ...@@ -465,33 +466,9 @@ namespace Siger.ApiACC.Controllers
var location = SelectLocation(freeMachine.Select(s=>s.machineid).ToList()); var location = SelectLocation(freeMachine.Select(s=>s.machineid).ToList());
if (location != null) if (location != null)
{ {
// * 更新下一个工序到储位
//var locationObj = _automationLocation.Get(f => f.id == location.lid);
//if (locationObj != null)
//{
//var doneRoute = _productRoute.Get(f => f.id == location.route);
//if (doneRoute == null)
// return;
//var productRoutes = _productRoute.GetList(f => f.projectId == PID && f.productId == location.productId && f.status == (int)RowState.Valid && f.serialNumber > doneRoute.serialNumber); CreateTask(location.section, TaskActionType.Load, TaskAction.Step_LK_JGZX, location.fixture, location.ordernumber, location.sn, location.pn, location.productId, location.productCode, location.location, location.route);
//if (!productRoutes.Any())
//{
// locationObj.route = string.Empty;
//}
//else
//{
// var nextRoute = productRoutes.OrderBy(d => d.serialNumber).FirstOrDefault();
// locationObj.routeid = nextRoute != null ? nextRoute.id : 0;
// locationObj.route = nextRoute != null ? nextRoute.name : "";
//}
////工件已出立库
//locationObj.status = (int)LocationStatus.Out;
//_automationLocation.Update(locationObj);
CreateTask(location.section, TaskActionType.Load, TaskAction.Step_LK_JGZX, location.fixture, location.ordernumber, location.sn, location.pn, location.productId, location.productCode, location.location,location.route);
return; //完成当前任务 退出
//}
} }
} }
//优先级3:其他设备下料 (加工中心 ->清洗机) //优先级3:其他设备下料 (加工中心 ->清洗机)
...@@ -504,9 +481,18 @@ namespace Siger.ApiACC.Controllers ...@@ -504,9 +481,18 @@ namespace Siger.ApiACC.Controllers
//清洗机上料 为 任务触发 触发 //清洗机上料 为 任务触发 触发
if (tasklist != null) if (tasklist != null)
{ {
Logger.WriteLineError($"AutoProcess 清洗机空闲,TaskResult触发 ");
//创建CNC 下料到清洗机 //创建CNC 下料到清洗机
CreateTask(fullMachine.section, TaskActionType.Unload, TaskAction.Step_JGZX_QXJ, tasklist.fixtureguid, tasklist.ordercode, tasklist.sn, tasklist.programnumber, tasklist.productid, tasklist.productcode, tasklist.locationid, tasklist.route); CreateTask(fullMachine.section, TaskActionType.Unload, TaskAction.Step_JGZX_QXJ, tasklist.fixtureguid, tasklist.ordercode, tasklist.sn, tasklist.programnumber, tasklist.productid, tasklist.productcode, tasklist.locationid, tasklist.route);
return; //完成当前任务 退出 return; //完成当前任务 退出
}else
{
Logger.WriteLineError($"AutoProcess 清洗机空闲,MachineStatus触发 ");
var lastTask = _automationTaskList.GetList(f => f.sectionid == fullMachine.section && f.status==(int)Automation.TaskResultStatus.Complated, "id", true).FirstOrDefault();
if (lastTask!=null)
{
CreateTask(fullMachine.section, TaskActionType.Unload, TaskAction.Step_JGZX_QXJ, lastTask.fixtureguid, lastTask.ordercode, lastTask.sn, lastTask.programnumber, lastTask.productid, lastTask.productcode, lastTask.locationid, lastTask.route);
}
} }
} }
} }
...@@ -526,6 +512,11 @@ namespace Siger.ApiACC.Controllers ...@@ -526,6 +512,11 @@ namespace Siger.ApiACC.Controllers
/// <param name="locationid">储位ID</param> /// <param name="locationid">储位ID</param>
void CreateTask(int section,TaskActionType actionType, TaskAction taskAction,string guid,string orderno,string sn,string program,int productId,string productCode,int locationid,int route) void CreateTask(int section,TaskActionType actionType, TaskAction taskAction,string guid,string orderno,string sn,string program,int productId,string productCode,int locationid,int route)
{ {
if (_automationTaskList.CanTask(PID, section))
{
Logger.WriteLineInfo($"CreateTask sectionId:{section}工站 {EnumHelper.GetEnumDesc(taskAction)} 触发条件不满足");
return;
}
var taskNo = _automationTaskList.CrateTaskNumber(Automation.TaskTrigerType.Auto); var taskNo = _automationTaskList.CrateTaskNumber(Automation.TaskTrigerType.Auto);
_automationTaskList.Insert(new siger_automation_task_list _automationTaskList.Insert(new siger_automation_task_list
{ {
...@@ -568,7 +559,7 @@ namespace Siger.ApiACC.Controllers ...@@ -568,7 +559,7 @@ namespace Siger.ApiACC.Controllers
foreach (var b in beats) foreach (var b in beats)
{ {
Logger.WriteLineError($"SelectLocation 设备{b.machineID}标准节拍{b.route_number}{b.route_name}"); Logger.WriteLineError($"SelectLocation 设备{b.machineID}标准节拍{b.route_number}{b.route_name}");
var autoLocationIds = _automationLocation.GetList(f => f.projectId == b.projectID && f.routeid == b.route_number.ToInt() && f.productid == b.product_name.ToInt()); var autoLocationIds = _automationLocation.GetList(f =>f.status==(int)RowState.Valid&& f.projectId == b.projectID && f.routeid == b.route_number.ToInt() && f.productid == b.product_name.ToInt());
if (!autoLocationIds.Any()) if (!autoLocationIds.Any())
{ {
Logger.WriteLineError($"SelectLocation 设备{b.machineID} routeid:{b.route_number}-{b.route_name}productId:{b.product_name} 没有匹配到当前储位"); Logger.WriteLineError($"SelectLocation 设备{b.machineID} routeid:{b.route_number}-{b.route_name}productId:{b.product_name} 没有匹配到当前储位");
......
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