Commit 073d2815 by xin.yang
parents 64d233a9 42d0244f
...@@ -254,15 +254,17 @@ namespace Siger.ApiACC.Controllers ...@@ -254,15 +254,17 @@ namespace Siger.ApiACC.Controllers
//PLC 反馈结束. //PLC 反馈结束.
if (status == (int)TaskResultStatus.Complated) if (status == (int)TaskResultStatus.Complated)
{ {
var location = _automationLocation.Get(f => f.fixturetools == taskObj.fixtureguid && f.locationid == taskObj.locationid);
if (location == null)
{
Logger.WriteLineInfo($"PlCfeeback 未找到该工装储位信息");
throw new BadRequestException(AccEnum.MachineDisable);
}
// 业务入口: 上料位-》 入库 如果是上料工装 安装完成 ,绑定 储位与装配 // 业务入口: 上料位-》 入库 如果是上料工装 安装完成 ,绑定 储位与装配
if (sectionProperty.propertytype == 1) if (sectionProperty.propertytype == 1)
{ {
var location = _automationLocation.Get(f => f.fixturetools == taskObj.fixtureguid && f.locationid == taskObj.locationid);
if (location == null)
{
Logger.WriteLineInfo($"PlCfeeback 未找到该工装储位信息");
throw new BadRequestException(AccEnum.MachineDisable);
}
//绑定SN 工件到立库储位 //绑定SN 工件到立库储位
if (taskObj.action == TaskAction.Step_SXLW_LK) if (taskObj.action == TaskAction.Step_SXLW_LK)
{ {
...@@ -281,40 +283,55 @@ namespace Siger.ApiACC.Controllers ...@@ -281,40 +283,55 @@ namespace Siger.ApiACC.Controllers
{ {
//location.sn = ""; //location.sn = "";
location.status = (int)LocationStatus.Out; location.status = (int)LocationStatus.Out;
_automationLocation.Update(location);
} }
} }
// CNC 设备
if (sectionProperty.propertytype == 2) if (sectionProperty.propertytype == 2)
{ {
if (taskObj.action== TaskAction.Step_LK_JGZX ) if (taskObj.action== TaskAction.Step_LK_JGZX )
{ {
location.status = (int)LocationStatus.Out;
_automationLocation.Update(location);
} }
} }
if (sectionProperty.propertytype==4) //抽检台
if (sectionProperty.propertytype == 3)
{ {
if (taskObj.action == TaskAction.Step_LK_CJT) if (taskObj.action == TaskAction.Step_LK_CJT)
{ {
location.status = (int)LocationStatus.Out;
_automationLocation.Update(location);
} }
//清洗即 完成
}
//清洗机
if (sectionProperty.propertytype==4)
{
if(taskObj.action==TaskAction.Step_QXJ_LK) if(taskObj.action==TaskAction.Step_QXJ_LK)
{ {
var location = _automationLocation.Get(f => f.fixturetools == taskObj.fixtureguid && f.locationid == taskObj.locationid); //上料 指定的第一道工序
if (location == null) var route = _productRoute.GetList(f => f.productId == taskObj.productid && f.status == (int)RowState.Valid, "serialNumber", true).FirstOrDefault();
if (route == null)
{ {
Logger.WriteLineInfo($"PlCfeeback 未找到该工装储位信息"); throw new BadRequestException(AccEnum.ProductRouteMissing);
throw new BadRequestException(AccEnum.MachineDisable); }
if (route.id == location.routeid)
{
Logger.WriteLineInfo($"PlCfeeback 工装储位{taskObj.locationid} 工序{location.routeid}-{location.routenum}完成");
//最后一道工序
location.routeid = 0;
location.status = (int)LocationStatus.In;
_automationLocation.Update(location);
}
else
{
Logger.WriteLineInfo($"PlCfeeback 工装储位{taskObj.locationid} 工序{location.routeid}-{location.routenum}为完成");
} }
//location.sn = "";
location.status = (int)LocationStatus.In;
_automationLocation.Update(location);
} }
} }
if (monitor != null && taskObj.action == TaskAction.Step_SXLW_LK)
{
monitor.section = 0;
}
} }
if (monitor != null) if (monitor != null)
...@@ -397,24 +414,25 @@ namespace Siger.ApiACC.Controllers ...@@ -397,24 +414,25 @@ namespace Siger.ApiACC.Controllers
Logger.WriteLineError($"AutoProcess 清洗机{cleanMachine.section}machineMonitor 为空"); Logger.WriteLineError($"AutoProcess 清洗机{cleanMachine.section}machineMonitor 为空");
return; return;
} }
CreateTask(cleanMachine.section, TaskActionType.Unload, TaskAction.Step_JGZX_QXJ, machineMonitor.fixtureguid, machineMonitor.ordernumber, machineMonitor.sn, "", machineMonitor.productId, machineMonitor.productCode, machineMonitor.locationId, machineMonitor.route); CreateTask(cleanMachine.section, TaskActionType.Unload, TaskAction.Step_QXJ_LK, machineMonitor.fixtureguid, machineMonitor.ordernumber, machineMonitor.sn, "", machineMonitor.productId, machineMonitor.productCode, machineMonitor.locationId, machineMonitor.route);
}
else
{
var locationObj = _automationLocation.Get(f => f.projectId == PID && f.locationid == tasklist.locationid);
if (locationObj == null)
{
Logger.WriteLineError($"AutoProcess 立库 为空");
return;
}
//工件回到立库
locationObj.status = (int)LocationStatus.In;
_automationLocation.Update(locationObj);
CreateTask(cleanMachine.section, TaskActionType.Unload, TaskAction.Step_QXJ_LK, tasklist.fixtureguid, tasklist.ordercode, tasklist.sn, "无程序", tasklist.productid, tasklist.productcode, tasklist.locationid, tasklist.route);
return; //完成当前任务 退出
} }
//else }
//{ else
// var locationObj = _automationLocation.Get(f => f.projectId == PID && f.locationid == tasklist.locationid);
// if (locationObj == null)
// {
// Logger.WriteLineError($"AutoProcess 立库 为空");
// return;
// }
// //工件回到立库
// locationObj.status = (int)LocationStatus.In;
// _automationLocation.Update(locationObj);
// CreateTask(cleanMachine.section, TaskActionType.Unload, TaskAction.Step_QXJ_LK, tasklist.fixtureguid, tasklist.ordercode, tasklist.sn, "无程序", tasklist.productid, tasklist.productcode, tasklist.locationid, tasklist.route);
// return; //完成当前任务 退出
//}
}else
{ {
Logger.WriteLineInfo($"AutoProcess 清洗机未完成"); Logger.WriteLineInfo($"AutoProcess 清洗机未完成");
} }
......
...@@ -187,7 +187,14 @@ namespace Siger.ApiACC.Controllers ...@@ -187,7 +187,14 @@ namespace Siger.ApiACC.Controllers
{ {
throw new BadRequestException(AccEnum.LineIsAutoMode); throw new BadRequestException(AccEnum.LineIsAutoMode);
} }
var attr = _sigerProjectMachineAttribution.Get(f => f.station == taskobj.sectionid && f.status == 1); var section = taskobj.sectionid;
//抽检台-》上料位特殊逻辑
if (taskobj.action == Automation.TaskAction.Step_CJT_SXLW)
{
section = taskobj.extend1.ToInt();
}
var attr = _sigerProjectMachineAttribution.Get(f => f.station == section && f.status == 1);
if (attr==null) if (attr==null)
{ {
throw new BadRequestException(CommonEnum.RecordNotFound); throw new BadRequestException(CommonEnum.RecordNotFound);
...@@ -599,7 +606,7 @@ namespace Siger.ApiACC.Controllers ...@@ -599,7 +606,7 @@ namespace Siger.ApiACC.Controllers
productcode = location.productcode, productcode = location.productcode,
processid = 0, processid = 0,
programnumber = "", programnumber = "",
remark = "手动任务-准备下料", remark =lineMode.inspect==1? "准备下料-》抽检台":"准备下料",
extend1= unixtime.ToStr() extend1= unixtime.ToStr()
}); });
......
...@@ -266,6 +266,7 @@ namespace Siger.ApiACC.Controllers ...@@ -266,6 +266,7 @@ namespace Siger.ApiACC.Controllers
{ {
try try
{ {
CreateTaskList(req.sectionid, req.productid, product.code, req.sn, req.routeid.ToInt()); CreateTaskList(req.sectionid, req.productid, product.code, req.sn, req.routeid.ToInt());
AddSnList(req.materialid.ToInt(), inspection, product.code, section.parentid);//把二维码插入到 sn_list表 AddSnList(req.materialid.ToInt(), inspection, product.code, section.parentid);//把二维码插入到 sn_list表
} }
...@@ -328,9 +329,16 @@ namespace Siger.ApiACC.Controllers ...@@ -328,9 +329,16 @@ namespace Siger.ApiACC.Controllers
if (monitor==null) if (monitor==null)
{ {
Logger.WriteLineInfo($"检验工站{section} monitor 为空"); Logger.WriteLineInfo($"检验工站{section} monitor 为空");
throw new BadRequestException(CommonEnum.RecordNotFound);
}
//找到上下料位
var tasklst = _automationTaskList.Get(f => f.no == monitor.taskno);
if (tasklst==null)
{
Logger.WriteLineInfo($"检验工站{section} tasklst 为空");
throw new BadRequestException(CommonEnum.RecordNotFound);
} }
var taskNo = _automationTaskList.CrateTaskNumber(Automation.TaskTrigerType.Manual); var taskNo = _automationTaskList.CrateTaskNumber(Automation.TaskTrigerType.Manual);
_automationTaskList.Insert(new siger_automation_task_list _automationTaskList.Insert(new siger_automation_task_list
{ {
no = taskNo, no = taskNo,
...@@ -354,7 +362,8 @@ namespace Siger.ApiACC.Controllers ...@@ -354,7 +362,8 @@ namespace Siger.ApiACC.Controllers
productcode = productcode, productcode = productcode,
processid = routeid, processid = routeid,
programnumber = "", programnumber = "",
remark = "质量检验", remark = "质量检验->上下料位置",
extend1=tasklst.sectionid.ToString(),//上下料位发起到检验的工站
}); });
monitor.taskno = taskNo; monitor.taskno = taskNo;
......
...@@ -3,8 +3,10 @@ using Newtonsoft.Json; ...@@ -3,8 +3,10 @@ using Newtonsoft.Json;
using Siger.Middlelayer.AccRepository.Request; using Siger.Middlelayer.AccRepository.Request;
using Siger.Middlelayer.Common; using Siger.Middlelayer.Common;
using Siger.Middlelayer.Common.Configuration; using Siger.Middlelayer.Common.Configuration;
using Siger.Middlelayer.Common.Extensions;
using Siger.Middlelayer.Common.Helpers; using Siger.Middlelayer.Common.Helpers;
using Siger.Middlelayer.Common.Log; using Siger.Middlelayer.Common.Log;
using Siger.Middlelayer.Share.Enum.ModuleEnum;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
...@@ -43,10 +45,17 @@ namespace Siger.ApiACC.Tasks ...@@ -43,10 +45,17 @@ namespace Siger.ApiACC.Tasks
var task = tasks.FirstOrDefault(); var task = tasks.FirstOrDefault();
if (task.send == 1) if (task.send == 1)
return; return;
var levelsction = dbhelper.GetLevelsection(task.sectionid);
var section = task.sectionid;
//抽检台-》上料位特殊逻辑
if (task.action== Automation.TaskAction.Step_CJT_SXLW)
{
section = task.extend1.ToInt();
}
var levelsction = dbhelper.GetLevelsection(section);
if (levelsction == null) if (levelsction == null)
return; return;
var attr = dbhelper.GetAttribution(task.sectionid); var attr = dbhelper.GetAttribution(section);
if (attr == null) if (attr == null)
return; return;
......
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