Commit 00ef47b4 by jiawei.su

fixedbug

parent 0960ff7a
...@@ -45,7 +45,7 @@ namespace Siger.ApiACC.Controllers ...@@ -45,7 +45,7 @@ namespace Siger.ApiACC.Controllers
private readonly IAutomationSectionPropertyRepository _automationSectionProperty; private readonly IAutomationSectionPropertyRepository _automationSectionProperty;
private readonly IAutomationProduceHistoryRepository _automationProduceHistory; private readonly IAutomationProduceHistoryRepository _automationProduceHistory;
private readonly ISigerProjectProductReport _sigerProjectProduct; private readonly ISigerProjectProductReport _sigerProjectProduct;
private readonly IProductPlanDetails _planDetails;
public AutomationController(IUnitOfWork unitOfWork, ISigerProjectLevelSectionRepository sigerProjectLevelSection, IAutomationLineMode automationLineMode, IAutomationMachineStatus automationMachineStatus, ISigerDict sigerDict, IAutomationTaskListRepository automationTaskList, public AutomationController(IUnitOfWork unitOfWork, ISigerProjectLevelSectionRepository sigerProjectLevelSection, IAutomationLineMode automationLineMode, IAutomationMachineStatus automationMachineStatus, ISigerDict sigerDict, IAutomationTaskListRepository automationTaskList,
ISigerProjectMachineAttributionRepository sigerProjectMachineAttribution, IAutomationFixtureMonitor automationFixtureMonitor, IAutomationLocationRepository automationLocation, IProductionBeatSetRepository productionBeatSet, IAutomationFixtureToolsProductRepository automationFixtureToolsProduct, ISigerProjectMachineAttributionRepository sigerProjectMachineAttribution, IAutomationFixtureMonitor automationFixtureMonitor, IAutomationLocationRepository automationLocation, IProductionBeatSetRepository productionBeatSet, IAutomationFixtureToolsProductRepository automationFixtureToolsProduct,
...@@ -312,8 +312,7 @@ namespace Siger.ApiACC.Controllers ...@@ -312,8 +312,7 @@ namespace Siger.ApiACC.Controllers
// 业务入口: 上料位-》 入库 如果是上料工装 安装完成 ,绑定 储位与装配 // 业务入口: 上料位-》 入库 如果是上料工装 安装完成 ,绑定 储位与装配
if (sectionProperty.propertytype == 1) if (sectionProperty.propertytype == 1)
{ {
//上下料位状态 为后台控制
var machineStatusObj = _automationMachineStatus.Get(f => f.section == taskObj.extend1.ToInt());
var download = false; var download = false;
if (sectionProperty.down > 2) if (sectionProperty.down > 2)
...@@ -339,6 +338,8 @@ namespace Siger.ApiACC.Controllers ...@@ -339,6 +338,8 @@ namespace Siger.ApiACC.Controllers
sectionProperty.down = 0; sectionProperty.down = 0;
_automationSectionProperty.Update(sectionProperty); _automationSectionProperty.Update(sectionProperty);
//上下料位状态 为后台控制
var machineStatusObj = _automationMachineStatus.Get(f => f.section == taskObj.extend1.ToInt());
if (machineStatusObj != null) if (machineStatusObj != null)
{ {
machineStatusObj.status = (int)Automation.MachineStatus.Waiting; machineStatusObj.status = (int)Automation.MachineStatus.Waiting;
...@@ -358,6 +359,8 @@ namespace Siger.ApiACC.Controllers ...@@ -358,6 +359,8 @@ namespace Siger.ApiACC.Controllers
location.status = (int)LocationStatus.Out; location.status = (int)LocationStatus.Out;
_automationLocation.Update(location); _automationLocation.Update(location);
//上下料位状态 为后台控制
var machineStatusObj = _automationMachineStatus.Get(f => f.section == taskObj.extend1.ToInt());
if (machineStatusObj != null) if (machineStatusObj != null)
{ {
machineStatusObj.status = (int)Automation.MachineStatus.Produce; machineStatusObj.status = (int)Automation.MachineStatus.Produce;
...@@ -367,6 +370,8 @@ namespace Siger.ApiACC.Controllers ...@@ -367,6 +370,8 @@ namespace Siger.ApiACC.Controllers
//需要抽检时(准备下料) ,立库到抽检台 //需要抽检时(准备下料) ,立库到抽检台
if (taskObj.action == TaskAction.Step_LK_CJT) if (taskObj.action == TaskAction.Step_LK_CJT)
{ {
//QC 设备状态 为后台控制
var machineStatusObj = _automationMachineStatus.Get(f => f.section == taskObj.sectionid);
if (machineStatusObj != null) if (machineStatusObj != null)
{ {
machineStatusObj.status = (int)Automation.MachineStatus.Produce; machineStatusObj.status = (int)Automation.MachineStatus.Produce;
...@@ -399,39 +404,39 @@ namespace Siger.ApiACC.Controllers ...@@ -399,39 +404,39 @@ namespace Siger.ApiACC.Controllers
{ {
//插入报工记录 //插入报工记录
var entity = new siger_project_product_report //var entity = new siger_project_product_report
{ //{
draw_number = "", // draw_number = "",
plan_id = 0, // plan_id = 0,
product_name = taskObj.productname, // product_name = taskObj.productname,
code = taskObj.ordercode, // code = taskObj.ordercode,
end_time = UnixTimeHelper.GetNow(), // end_time = UnixTimeHelper.GetNow(),
station = taskObj.sectionid, // station = taskObj.sectionid,
industrial_waste = 0, // industrial_waste = 0,
material_waste = 0, // material_waste = 0,
start_time = UnixTimeHelper.GetNow(), // start_time = UnixTimeHelper.GetNow(),
worker_code = "", // worker_code = "",
worker_name = "", // worker_name = "",
uid = 0, // uid = 0,
projectid = PID, // projectid = PID,
time = UnixTimeHelper.GetNow(), // time = UnixTimeHelper.GetNow(),
processid = 0, // processid = 0,
nok_number = 0, // nok_number = 0,
output = 1, // output = 1,
actual_output = 1, // actual_output = 1,
product_code = taskObj.productcode // product_code = taskObj.productcode
}; //};
if (_sigerProjectProduct.InsertProductReportData(entity) < 0) //if (_sigerProjectProduct.InsertProductReportData(entity) < 0)
{ //{
throw new BadRequestException(AccEnum.SyncSnReportErro); // throw new BadRequestException(AccEnum.SyncSnReportErro);
} //}
} }
} }
//抽检台 //抽检台
if (sectionProperty.propertytype == 3) if (sectionProperty.propertytype == 3)
{ {
var machineStatusObj = _automationMachineStatus.Get(f => f.section == taskObj.sectionid);
if (taskObj.action == TaskAction.Step_LK_CJT) if (taskObj.action == TaskAction.Step_LK_CJT)
{ {
...@@ -440,6 +445,15 @@ namespace Siger.ApiACC.Controllers ...@@ -440,6 +445,15 @@ namespace Siger.ApiACC.Controllers
} }
if (taskObj.action == TaskAction.Step_CJT_SXLW) if (taskObj.action == TaskAction.Step_CJT_SXLW)
{ {
//抽检台 空闲
var qcStatusObj = _automationMachineStatus.Get(f => f.section == taskObj.extend1.ToInt());
if (qcStatusObj != null)
{
qcStatusObj.status = (int)Automation.MachineStatus.Waiting;
_automationMachineStatus.Update(qcStatusObj);
}
//上料位加工中
var machineStatusObj = _automationMachineStatus.Get(f => f.section == taskObj.sectionid);
if (machineStatusObj != null) if (machineStatusObj != null)
{ {
machineStatusObj.status = (int)Automation.MachineStatus.Produce; machineStatusObj.status = (int)Automation.MachineStatus.Produce;
...@@ -452,17 +466,14 @@ namespace Siger.ApiACC.Controllers ...@@ -452,17 +466,14 @@ namespace Siger.ApiACC.Controllers
Logger.WriteLineInfo($"PlCfeeback 未找到该工装储位信息"); Logger.WriteLineInfo($"PlCfeeback 未找到该工装储位信息");
throw new BadRequestException(AccEnum.MachineDisable); throw new BadRequestException(AccEnum.MachineDisable);
} }
//上料中 //下料料
if (_Property.upload != 0)
{
_Property.upload += 1;
_automationSectionProperty.Update(_Property);
}
if (_Property.down != 0) if (_Property.down != 0)
{ {
_Property.down += 1; _Property.down += 1;
_automationSectionProperty.Update(_Property); _automationSectionProperty.Update(_Property);
} }
} }
} }
...@@ -498,7 +509,7 @@ namespace Siger.ApiACC.Controllers ...@@ -498,7 +509,7 @@ namespace Siger.ApiACC.Controllers
if (sectionProperty.propertytype==5) if (sectionProperty.propertytype==5)
{ {
//上下料位状态 为后台控制 //上下料位状态 为后台控制
var machineStatusObj = _automationMachineStatus.Get(f => f.section == taskObj.extend1.ToInt()); var machineStatusObj = _automationMachineStatus.Get(f => f.section == taskObj.sectionid);
//从立库储位拿SN 工件到上料位 //从立库储位拿SN 工件到上料位
if (taskObj.action == TaskAction.Step_LK_SXLW) if (taskObj.action == TaskAction.Step_LK_SXLW)
{ {
......
...@@ -204,7 +204,7 @@ namespace Siger.ApiACC.Controllers ...@@ -204,7 +204,7 @@ namespace Siger.ApiACC.Controllers
} }
var section = taskobj.extend1.ToInt(); var section = taskobj.extend1.ToInt();
//抽检台-》上料位特殊逻辑 //抽检台-》上料位特殊逻辑
if (taskobj.action == Automation.TaskAction.Step_LK_CJT || taskobj.action == Automation.TaskAction.Step_CJT_SXLW) if (taskobj.action == Automation.TaskAction.Step_LK_CJT || taskobj.action == Automation.TaskAction.Step_CJT_SXLW || taskobj.action == TaskAction.Step_LK_JGZX || taskobj.action == TaskAction.Step_LK_SXLW)
{ {
section = taskobj.sectionid; section = taskobj.sectionid;
} }
...@@ -214,6 +214,7 @@ namespace Siger.ApiACC.Controllers ...@@ -214,6 +214,7 @@ namespace Siger.ApiACC.Controllers
{ {
throw new BadRequestException(CommonEnum.RecordNotFound); throw new BadRequestException(CommonEnum.RecordNotFound);
} }
var host = GetHost(); var host = GetHost();
if (string.IsNullOrEmpty(host)) if (string.IsNullOrEmpty(host))
{ {
...@@ -224,6 +225,7 @@ namespace Siger.ApiACC.Controllers ...@@ -224,6 +225,7 @@ namespace Siger.ApiACC.Controllers
{ {
throw new BadRequestException(AccEnum.FixtureToolsIsNone); throw new BadRequestException(AccEnum.FixtureToolsIsNone);
} }
Logger.WriteLineInfo($"自动下发->PLC : {EnumHelper.GetEnumDesc(taskobj.action)}Section:{section} machine:{attr.machine}");
var sendToPLC = new RequestPLC var sendToPLC = new RequestPLC
{ {
ProductCode=taskobj.productcode, ProductCode=taskobj.productcode,
......
...@@ -49,7 +49,7 @@ namespace Siger.ApiACC.Tasks ...@@ -49,7 +49,7 @@ namespace Siger.ApiACC.Tasks
var section = task.extend1.ToInt(); var section = task.extend1.ToInt();
//抽检台-》上料位特殊逻辑 //抽检台-》上料位特殊逻辑
if (task.action==Automation.TaskAction.Step_LK_CJT || task.action == Automation.TaskAction.Step_CJT_SXLW) if (task.action==Automation.TaskAction.Step_LK_CJT || task.action == Automation.TaskAction.Step_CJT_SXLW || task.action==TaskAction.Step_LK_JGZX || task.action==TaskAction.Step_LK_SXLW)
{ {
section = task.sectionid; section = task.sectionid;
} }
...@@ -59,7 +59,7 @@ namespace Siger.ApiACC.Tasks ...@@ -59,7 +59,7 @@ namespace Siger.ApiACC.Tasks
var attr = dbhelper.GetAttribution(section); var attr = dbhelper.GetAttribution(section);
if (attr == null) if (attr == null)
return; return;
Logger.WriteLineInfo($"自动下发->PLC : {EnumHelper.GetEnumDesc(task.action)}Section:{section} machine:{attr.machine}");
var fixtrue = dbhelper.GetFixture(task.fixtureguid); var fixtrue = dbhelper.GetFixture(task.fixtureguid);
if (fixtrue==null) if (fixtrue==null)
{ {
......
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