Commit bf400bbc by jiawei.su

someupate

parent 1bf8eb3f
...@@ -92,20 +92,29 @@ namespace Siger.ApiACC.Controllers ...@@ -92,20 +92,29 @@ namespace Siger.ApiACC.Controllers
{ {
if (request.status == (int)Automation.MachineStatus.Waiting || request.status == (int)Automation.MachineStatus.Complated) if (request.status == (int)Automation.MachineStatus.Waiting || request.status == (int)Automation.MachineStatus.Complated)
{ {
var tasklist = _automationTaskList.GetList(f => f.projectId == PID && f.status >= (int)TaskResultStatus.Cancel && f.status < (int)TaskResultStatus.Complated);
if (!tasklist.Any()) var stationDicts = _sigerDict.GetDataByCat(AccDictCost.Automation, PID);
if (!stationDicts.Any())
{ {
var stationDicts = _sigerDict.GetDataByCat(AccDictCost.Automation, PID); Logger.WriteLineInfo($"AutoProcess 未配置设备类型字典");
if (!stationDicts.Any()) throw new BadRequestException(AccEnum.AutomationDictNotfound);
{ }
Logger.WriteLineInfo($"AutoProcess 未配置设备类型字典");
throw new BadRequestException(AccEnum.AutomationDictNotfound);
} var uploadStation = stationDicts.Where(f => f.dkey == DictKeyValConst.UploadloadStation);
var section = _sigerProjectLevelSection.Get(f => f.id == machineAttr.station); var uploadStations = uploadStation.Select(f => f.dval.ToInt()).ToList();
if (section != null)
if (!uploadStations.Contains(machineAttr.station))
{
var tasklist = _automationTaskList.GetList(f => f.projectId == PID && f.status < (int)TaskResultStatus.Complated);
if (!tasklist.Any())
{ {
Logger.WriteLineInfo($"MachineStatus 设备状态 触发自动任务检查"); var section = _sigerProjectLevelSection.Get(f => f.id == machineAttr.station);
AutoProcess(section.parentid, stationDicts); if (section != null)
{
Logger.WriteLineInfo($"MachineStatus 设备状态 触发自动任务检查");
AutoProcess(section.parentid, stationDicts);
}
} }
} }
} }
...@@ -248,6 +257,14 @@ namespace Siger.ApiACC.Controllers ...@@ -248,6 +257,14 @@ namespace Siger.ApiACC.Controllers
var section = _sigerProjectLevelSection.Get(f => f.id == taskObj.sectionid); var section = _sigerProjectLevelSection.Get(f => f.id == taskObj.sectionid);
if (section != null) if (section != null)
{ {
var updownDic = stationDicts.Where(s => s.dkey == DictKeyValConst.UploadloadStation);
var uploadStations = updownDic.Select(f => f.dval.ToInt()).ToList();
var uploadPostion = uploadStations.Contains(taskObj.sectionid);
if (uploadPostion)
{
Logger.WriteLineInfo($"AutoProcess 上料料工站 无需自动创建任务 ");
break;
}
AutoProcess(section.parentid, stationDicts); AutoProcess(section.parentid, stationDicts);
} }
break; break;
...@@ -292,9 +309,13 @@ namespace Siger.ApiACC.Controllers ...@@ -292,9 +309,13 @@ namespace Siger.ApiACC.Controllers
var location = _automationLocation.Get(f => f.fixturetools == taskObj.fixtureguid); var location = _automationLocation.Get(f => f.fixturetools == taskObj.fixtureguid);
if (location == null) if (location == null)
{ {
location.ordernumber = taskObj.ordercode; Logger.WriteLineInfo($"PlCfeeback 未找到该工装储位信息");
location.sn = taskObj.sn; throw new BadRequestException(AccEnum.MachineDisable);
} }
location.ordernumber = taskObj.ordercode;
location.productcode = taskObj.productcode;
location.productid = taskObj.productid;
location.sn = taskObj.sn;
} }
} }
else if (taskObj.action == TaskAction.Step_LK_CJT || taskObj.action == TaskAction.Step_LK_JGZX || taskObj.action == TaskAction.Step_LK_SXLW) else if (taskObj.action == TaskAction.Step_LK_CJT || taskObj.action == TaskAction.Step_LK_JGZX || taskObj.action == TaskAction.Step_LK_SXLW)
...@@ -304,6 +325,8 @@ namespace Siger.ApiACC.Controllers ...@@ -304,6 +325,8 @@ namespace Siger.ApiACC.Controllers
if (location == null) if (location == null)
{ {
location.ordernumber = ""; location.ordernumber = "";
location.productcode = "";
location.productid =0;
location.sn = ""; location.sn = "";
} }
...@@ -477,9 +500,10 @@ namespace Siger.ApiACC.Controllers ...@@ -477,9 +500,10 @@ namespace Siger.ApiACC.Controllers
/// <param name="locationid">储位ID</param> /// <param name="locationid">储位ID</param>
void CreateTask(siger_automation_machine_status machineStatus,TaskActionType actionType, TaskAction taskAction,string guid,string orderno,string sn,string productCode,int locationid) void CreateTask(siger_automation_machine_status machineStatus,TaskActionType actionType, TaskAction taskAction,string guid,string orderno,string sn,string productCode,int locationid)
{ {
var taskNo = _automationTaskList.CrateTaskNumber(Automation.TaskTrigerType.Auto);
_automationTaskList.Insert(new siger_automation_task_list _automationTaskList.Insert(new siger_automation_task_list
{ {
no= taskNo,
projectId = PID, projectId = PID,
sectionid = machineStatus.section, sectionid = machineStatus.section,
trigger = TaskTrigerType.Auto, trigger = TaskTrigerType.Auto,
...@@ -514,7 +538,7 @@ namespace Siger.ApiACC.Controllers ...@@ -514,7 +538,7 @@ namespace Siger.ApiACC.Controllers
{ {
// 当前空闲设备能加工的产品 // 当前空闲设备能加工的产品
var beats = _productionBeatSet.GetList(f => f.projectID == PID && f.machineID == machine); var beats = _productionBeatSet.GetList(f => f.projectID == PID && f.machineID == machine);
var productIds = beats.Select(f => f.product_name.ToInt()).ToList(); var productIds = beats.Select(f => f.product_name.ToInt()).Distinct().ToList();
// 取产品交期最近的订单 // 取产品交期最近的订单
var planOrder = _automationFixtureToolsProduct.GetDeliveryOrder(productIds, PID); var planOrder = _automationFixtureToolsProduct.GetDeliveryOrder(productIds, PID);
...@@ -525,18 +549,22 @@ namespace Siger.ApiACC.Controllers ...@@ -525,18 +549,22 @@ namespace Siger.ApiACC.Controllers
} }
var order = planOrder.FirstOrDefault(); var order = planOrder.FirstOrDefault();
var beatset = beats.Where(f => f.product_name == order.productId.ToString()); //TODO 20210126
//var beatset = beats.Where(f => f.product_name == order.productId.ToString());
//var location = _automationLocation.GetList(f => f.projectId == PID && f.ordernumber== order.ordernumber && productIds.Contains(f.productid));
//if (!location.Any())
//{
// Logger.WriteLineInfo($"SelectLocation 未找到最近交期订单号{order.ordernumber} 对应产品 {order.productName}的储位信息");
// return null;
//var routeIds = beatset.Select(s => s.id).ToList(); //}
//储位有SN 工件
var location = _automationLocation.GetList(f => f.projectId == PID && f.ordernumber== order.ordernumber && productIds.Contains(f.productid)); var location = _automationLocation.GetList(f => f.projectId == PID && productIds.Contains(f.productid));
var hasSnloaction = location.Where(f =>!string.IsNullOrEmpty(f.sn));
if (!hasSnloaction.Any())
return null;
if (location==null)
{
Logger.WriteLineInfo($"SelectLocation 未找到最近交期订单号{order.ordernumber} 对应产品 {order.productName}的储位信息");
return null;
}
return location.FirstOrDefault(); return location.FirstOrDefault();
} }
......
...@@ -149,14 +149,14 @@ namespace Siger.ApiACC.Controllers ...@@ -149,14 +149,14 @@ namespace Siger.ApiACC.Controllers
var monitor = _automationFixtureMonitor.Get(f => f.section == section); var monitor = _automationFixtureMonitor.Get(f => f.section == section);
var result = new ResponsePlanlFixtureInfo var result = new ResponsePlanlFixtureInfo
{ {
OrderNumber = monitor.ordernumber, OrderNumber = monitor!=null? monitor.ordernumber:"",
FixtureGuid=monitor.fixtureguid, FixtureGuid = monitor != null ? monitor.fixtureguid:"",
FixtureName=monitor.fixturename, FixtureName = monitor != null ? monitor.fixturename:"",
ProductCode=monitor.productCode, ProductCode = monitor != null ? monitor.productCode:"",
ProductName=monitor.productName, ProductName = monitor != null ? monitor.productName:"",
Sn=monitor.sn, Sn = monitor != null ? monitor.sn:"",
status=monitor.status, status = monitor != null ? monitor.status:(int)Automation.MachineStatus.Waiting,
Location=monitor.locationId, Location = monitor != null ? monitor.locationId:0,
}; };
return new ObjectResult(result); return new ObjectResult(result);
} }
...@@ -204,7 +204,7 @@ namespace Siger.ApiACC.Controllers ...@@ -204,7 +204,7 @@ namespace Siger.ApiACC.Controllers
section = loading.section, section = loading.section,
machineid = machineAttr.machine, machineid = machineAttr.machine,
projectId = ProjectId, projectId = ProjectId,
status = (int)Automation.MachineStatus.Produce, status = (int)Automation.MachineStatus.Waiting,
updatetime = DateTime.Now updatetime = DateTime.Now
}); });
} }
...@@ -376,7 +376,7 @@ namespace Siger.ApiACC.Controllers ...@@ -376,7 +376,7 @@ namespace Siger.ApiACC.Controllers
completetime = DateTime.MinValue, completetime = DateTime.MinValue,
trigger = Automation.TaskTrigerType.Manual, trigger = Automation.TaskTrigerType.Manual,
projectId = ProjectId, projectId = ProjectId,
productid = monitor.pr, productid = monitor.productId,
sn = monitor.sn, sn = monitor.sn,
ordercode = monitor.ordernumber, ordercode = monitor.ordernumber,
fixtureguid = monitor.fixtureguid, fixtureguid = monitor.fixtureguid,
......
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