Commit 7b1993d6 by jiawei.su

someupdate

parent aa1df8d2
...@@ -246,7 +246,6 @@ namespace Siger.ApiACC.Controllers ...@@ -246,7 +246,6 @@ namespace Siger.ApiACC.Controllers
taskObj.operatetime = DateTime.Now; taskObj.operatetime = DateTime.Now;
taskObj.completetime = DateTime.Now; taskObj.completetime = DateTime.Now;
var monitor = _automationFixtureMonitor.Get(f => f.section == taskObj.sectionid); var monitor = _automationFixtureMonitor.Get(f => f.section == taskObj.sectionid);
var sectionProperty = _automationSectionProperty.Get(f => f.sectionid == taskObj.extend1.ToInt()); var sectionProperty = _automationSectionProperty.Get(f => f.sectionid == taskObj.extend1.ToInt());
if (sectionProperty == null) if (sectionProperty == null)
...@@ -264,7 +263,8 @@ namespace Siger.ApiACC.Controllers ...@@ -264,7 +263,8 @@ namespace Siger.ApiACC.Controllers
throw new BadRequestException(AccEnum.MachineDisable); throw new BadRequestException(AccEnum.MachineDisable);
} }
// 业务入口: 上料位-》 入库 如果是上料工装 安装完成 ,绑定 储位与装配 // 业务入口: 上料位-》 入库 如果是上料工装 安装完成 ,绑定 储位与装配
if (sectionProperty.propertytype == 1)
{
var download = false; var download = false;
if (sectionProperty.down > 2) if (sectionProperty.down > 2)
{ {
...@@ -295,6 +295,7 @@ namespace Siger.ApiACC.Controllers ...@@ -295,6 +295,7 @@ namespace Siger.ApiACC.Controllers
if (taskObj.action == TaskAction.Step_LK_SXLW) if (taskObj.action == TaskAction.Step_LK_SXLW)
{ {
location.sn = taskObj.sn; location.sn = taskObj.sn;
location.ordernumber = taskObj.ordercode;
location.productcode = taskObj.productcode; location.productcode = taskObj.productcode;
location.productid = taskObj.productid; location.productid = taskObj.productid;
location.productname = taskObj.productname; location.productname = taskObj.productname;
...@@ -305,11 +306,6 @@ namespace Siger.ApiACC.Controllers ...@@ -305,11 +306,6 @@ namespace Siger.ApiACC.Controllers
} }
if (taskObj.action == TaskAction.Step_LK_CJT)
{
}
//上料中 //上料中
if (sectionProperty.upload != 0) if (sectionProperty.upload != 0)
{ {
...@@ -322,32 +318,20 @@ namespace Siger.ApiACC.Controllers ...@@ -322,32 +318,20 @@ namespace Siger.ApiACC.Controllers
_automationSectionProperty.Update(sectionProperty); _automationSectionProperty.Update(sectionProperty);
} }
}
// CNC 设备 // CNC 设备
if (sectionProperty.propertytype == 2)
if (taskObj.action == TaskAction.Step_LK_JGZX)
{ {
var route = _productRoute.GetList(f => f.productId == taskObj.productid && f.id != taskObj.route && f.status == (int)RowState.Valid, "serialNumber", false).FirstOrDefault(); if (taskObj.action == TaskAction.Step_LK_JGZX)
if (route == null)
{ {
throw new BadRequestException(AccEnum.ProductRouteMissing);
}
location.routeid = route.id;
location.route = route.id.ToString();
location.status = (int)LocationStatus.Out; location.status = (int)LocationStatus.Out;
_automationLocation.Update(location); _automationLocation.Update(location);
//加工中心做完 下一站清洗机
var cleanMachine = _automationSectionProperty.Get(f => f.propertytype == 4);
if (cleanMachine != null)
{
taskObj.extend1 = cleanMachine.sectionid.ToString();
} }
} }
//抽检台 //抽检台
if (sectionProperty.propertytype == 3)
{
if (taskObj.action == TaskAction.Step_LK_CJT) if (taskObj.action == TaskAction.Step_LK_CJT)
{ {
location.status = (int)LocationStatus.Out; location.status = (int)LocationStatus.Out;
...@@ -358,9 +342,10 @@ namespace Siger.ApiACC.Controllers ...@@ -358,9 +342,10 @@ namespace Siger.ApiACC.Controllers
} }
}
//清洗机 //清洗机
if (sectionProperty.propertytype == 4)
{
if (taskObj.action == TaskAction.Step_QXJ_LK) if (taskObj.action == TaskAction.Step_QXJ_LK)
{ {
...@@ -370,38 +355,19 @@ namespace Siger.ApiACC.Controllers ...@@ -370,38 +355,19 @@ namespace Siger.ApiACC.Controllers
throw new BadRequestException(AccEnum.ProductRouteMissing); throw new BadRequestException(AccEnum.ProductRouteMissing);
} }
var nextRoute = _productRoute.GetList(f => f.productId == taskObj.productid && f.serialNumber > currenRute.serialNumber && f.status == (int)RowState.Valid, "serialNumber", false).FirstOrDefault(); var nextRoute = _productRoute.GetList(f => f.productId == taskObj.productid && f.serialNumber > currenRute.serialNumber && f.status == (int)RowState.Valid, "serialNumber", false).FirstOrDefault();
var route = 0; var route = 0;
if (nextRoute != null) if (nextRoute != null)
{ {
route = nextRoute.id; route = nextRoute.id;
} }
//更新下一到工序 //更新下一到工序
location.routeid = route; location.routeid = route;
location.route = route.ToString(); location.route = route.ToString();
location.status = (int)LocationStatus.In; location.status = (int)LocationStatus.In;
_automationLocation.Update(location); _automationLocation.Update(location);
Logger.WriteLineInfo($"PlCfeeback 工装储位{taskObj.locationid} 工序{location.routeid} 下一工序{route}更新完成");
Logger.WriteLineInfo($"PlCfeeback 工装储位{taskObj.locationid} 工序{location.routeid}-{location.routenum}完成"); }
Logger.WriteLineInfo($"PlCfeeback 工装储位{taskObj.locationid} 下一工序{route}更新完成");
//if (route.id == location.routeid)
//{
// Logger.WriteLineInfo($"PlCfeeback 工装储位{taskObj.locationid} 工序{location.routeid}-{location.routenum}完成");
// //最后一道工序
// location.routeid = 0;
// location.route = "0";
// location.status = (int)LocationStatus.In;
// _automationLocation.Update(location);
//}
//else
//{
// Logger.WriteLineInfo($"PlCfeeback 工装储位{taskObj.locationid} 工序{location.routeid}-{location.routenum}为完成");
//}
} }
if (monitor == null) if (monitor == null)
{ {
...@@ -531,6 +497,7 @@ namespace Siger.ApiACC.Controllers ...@@ -531,6 +497,7 @@ namespace Siger.ApiACC.Controllers
{ {
//优先级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");
...@@ -540,8 +507,6 @@ namespace Siger.ApiACC.Controllers ...@@ -540,8 +507,6 @@ namespace Siger.ApiACC.Controllers
{ {
if (lastTask.status == (int)TaskResultStatus.Complated) if (lastTask.status == (int)TaskResultStatus.Complated)
{ {
lastTask.extend1 = string.Empty;
_automationTaskList.Update(lastTask);
Logger.WriteLineInfo($"自动化业务流转--AutoProcess section{cleanMachine.section} task:{TaskAction.Step_QXJ_LK.ToStr()} sn {lastTask.sn}"); Logger.WriteLineInfo($"自动化业务流转--AutoProcess section{cleanMachine.section} task:{TaskAction.Step_QXJ_LK.ToStr()} sn {lastTask.sn}");
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); 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; //完成当前任务 退出 return; //完成当前任务 退出
...@@ -673,20 +638,17 @@ namespace Siger.ApiACC.Controllers ...@@ -673,20 +638,17 @@ namespace Siger.ApiACC.Controllers
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()); 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} 没有匹配到当前储位");
continue; continue;
} }
foreach (var autoLocation in autoLocationIds) foreach (var autoLocation in autoLocationIds)
{ {
if (string.IsNullOrEmpty(autoLocation.sn)) if (string.IsNullOrEmpty(autoLocation.sn))
{ {
Logger.WriteLineError($"SelectLocation 设备{b.machineID} routeid:{b.route_number}-{b.route_name}productId:{b.product_name} 储位{autoLocation.locationid}没有SN工件");
continue; continue;
} }
if (autoLocation.status == 2) if (autoLocation.status == 2)
{ {
//SN不在立库内 //SN不在立库内
Logger.WriteLineError($"SelectLocation 设备{b.machineID} routeid:{b.route_number}-{b.route_name}productId:{b.product_name} 储位{autoLocation.locationid}工件Sn:{autoLocation.sn}不在储位上");
continue; continue;
} }
if (autoLocation.routeid == 0) if (autoLocation.routeid == 0)
...@@ -712,8 +674,6 @@ namespace Siger.ApiACC.Controllers ...@@ -712,8 +674,6 @@ namespace Siger.ApiACC.Controllers
Sn = autoLocation.sn, Sn = autoLocation.sn,
LId = autoLocation.id LId = autoLocation.id
}); });
Logger.WriteLineError($"SelectLocation 有效订单号{autoLocation.ordernumber}");
} }
} }
if (!TempList.Any()) if (!TempList.Any())
......
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