Commit 6a16043d by jiawei.su

someupdate

parent 0dff8f18
...@@ -241,6 +241,7 @@ namespace Siger.ApiACC.Controllers ...@@ -241,6 +241,7 @@ namespace Siger.ApiACC.Controllers
{ {
//2.更新状态 //2.更新状态
taskObj.status = status; taskObj.status = status;
taskObj.operatetime = DateTime.Now;
taskObj.completetime = DateTime.Now; taskObj.completetime = DateTime.Now;
...@@ -480,6 +481,13 @@ namespace Siger.ApiACC.Controllers ...@@ -480,6 +481,13 @@ namespace Siger.ApiACC.Controllers
Logger.WriteLineInfo($"AutoProcess 设备属性未配置"); Logger.WriteLineInfo($"AutoProcess 设备属性未配置");
return; return;
} }
var invenSection = _automationSectionProperty.Get(f => f.propertytype == 5);
if (invenSection == null)
{
Logger.WriteLineInfo($"AutoProcess 工站立库未找到");
return;
}
var cncStations = sectionPropertys.Where(s => s.propertytype == 2).Select(s => s.sectionid).ToList(); var cncStations = sectionPropertys.Where(s => s.propertytype == 2).Select(s => s.sectionid).ToList();
// 获取可用 设备状态列表 排除上料工位 // 获取可用 设备状态列表 排除上料工位
var machineStatusList = _automationMachineStatus.GetList(f => f.projectId == PID && cncStations.Contains(f.section) && f.enable == 1); var machineStatusList = _automationMachineStatus.GetList(f => f.projectId == PID && cncStations.Contains(f.section) && f.enable == 1);
...@@ -502,19 +510,23 @@ namespace Siger.ApiACC.Controllers ...@@ -502,19 +510,23 @@ namespace Siger.ApiACC.Controllers
} }
else else
{ {
//优先级1 :清洗机完成 。待下料 //优先级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() && f.status == (int)Automation.TaskResultStatus.Complated, "id", true).FirstOrDefault(); var lastTask = _automationTaskList.GetList(f => f.sectionid == cleanMachine.section, "id", true).FirstOrDefault();
if (lastTask != null) if (lastTask != null)
{ {
lastTask.extend1 = string.Empty; if (lastTask.status == (int)TaskResultStatus.Complated)
_automationTaskList.Update(lastTask); {
Logger.WriteLineInfo($"自动化业务流转--AutoProcess section{cleanMachine.section} task:{TaskAction.Step_QXJ_LK.ToStr()} sn {lastTask.sn}"); lastTask.extend1 = string.Empty;
CreateTask(cleanMachine.section, TaskActionType.Unload, TaskAction.Step_QXJ_LK, lastTask.fixtureguid, lastTask.ordercode, lastTask.sn, "无程序", lastTask.productid, lastTask.productcode, lastTask.locationid, lastTask.route); _automationTaskList.Update(lastTask);
return; //完成当前任务 退出 Logger.WriteLineInfo($"自动化业务流转--AutoProcess section{cleanMachine.section} task:{TaskAction.Step_QXJ_LK.ToStr()} sn {lastTask.sn}");
CreateTask(invenSection.sectionid, 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; //完成当前任务 退出
}
} }
} }
} }
...@@ -527,7 +539,7 @@ namespace Siger.ApiACC.Controllers ...@@ -527,7 +539,7 @@ namespace Siger.ApiACC.Controllers
if (location != null) if (location != null)
{ {
Logger.WriteLineInfo($"自动化业务流转--AutoProcess section{location.section} task:{TaskAction.Step_LK_JGZX.ToStr()} sn {location.sn}"); Logger.WriteLineInfo($"自动化业务流转--AutoProcess section{location.section} task:{TaskAction.Step_LK_JGZX.ToStr()} sn {location.sn}");
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); CreateTask(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);
} }
} }
...@@ -552,7 +564,7 @@ namespace Siger.ApiACC.Controllers ...@@ -552,7 +564,7 @@ namespace Siger.ApiACC.Controllers
return; return;
} }
//创建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(cleanMachine.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; //完成当前任务 退出 return; //完成当前任务 退出
} }
else else
...@@ -565,7 +577,7 @@ namespace Siger.ApiACC.Controllers ...@@ -565,7 +577,7 @@ namespace Siger.ApiACC.Controllers
if (lastTask != null) if (lastTask != null)
{ {
Logger.WriteLineInfo($"自动化业务流转--AutoProcess section{fullMachine.section} task:{TaskAction.Step_JGZX_QXJ.ToStr()} sn {lastTask.sn}"); Logger.WriteLineInfo($"自动化业务流转--AutoProcess section{fullMachine.section} task:{TaskAction.Step_JGZX_QXJ.ToStr()} sn {lastTask.sn}");
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); CreateTask(cleanMachine.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);
} }
} }
} }
...@@ -585,7 +597,7 @@ namespace Siger.ApiACC.Controllers ...@@ -585,7 +597,7 @@ namespace Siger.ApiACC.Controllers
/// <param name="sn">工件</param> /// <param name="sn">工件</param>
/// <param name="productCode">产品CODE</param> /// <param name="productCode">产品CODE</param>
/// <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 fixtruename, string orderno, string sn, string program, int productId, string productCode,string productName, int locationid, int route)
{ {
var taskNo = _automationTaskList.CrateTaskNumber(Automation.TaskTrigerType.Auto); var taskNo = _automationTaskList.CrateTaskNumber(Automation.TaskTrigerType.Auto);
...@@ -605,7 +617,9 @@ namespace Siger.ApiACC.Controllers ...@@ -605,7 +617,9 @@ namespace Siger.ApiACC.Controllers
operater = 0, operater = 0,
status = 1, status = 1,
fixtureguid = guid, fixtureguid = guid,
fixturename=fixtruename,
productid = productId, productid = productId,
productname=productName,
productcode = productCode, productcode = productCode,
programnumber = program, programnumber = program,
locationid = locationid, locationid = locationid,
......
...@@ -381,7 +381,7 @@ namespace Siger.ApiACC.Controllers ...@@ -381,7 +381,7 @@ namespace Siger.ApiACC.Controllers
programnumber="", programnumber="",
remark ="手动任务-准备上料", remark ="手动任务-准备上料",
route=route.id, route=route.id,
extend1= unixtime.ToString() extend1=""
}); });
...@@ -454,9 +454,11 @@ namespace Siger.ApiACC.Controllers ...@@ -454,9 +454,11 @@ namespace Siger.ApiACC.Controllers
trigger = Automation.TaskTrigerType.Manual, trigger = Automation.TaskTrigerType.Manual,
projectId = ProjectId, projectId = ProjectId,
productid = monitor.productId, productid = monitor.productId,
productname=monitor.productName,
sn = monitor.sn, sn = monitor.sn,
ordercode = monitor.ordernumber, ordercode = monitor.ordernumber,
fixtureguid = monitor.fixtureguid, fixtureguid = monitor.fixtureguid,
fixturename=monitor.fixturename,
locationid = monitor.locationId, locationid = monitor.locationId,
productcode = monitor.productCode, productcode = monitor.productCode,
processid = 0, processid = 0,
......
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