Commit cab92103 by jiawei.su

someupdate

parent 897c6dff
...@@ -274,6 +274,10 @@ namespace Siger.ApiACC.Controllers ...@@ -274,6 +274,10 @@ namespace Siger.ApiACC.Controllers
location.sn = taskObj.sn; location.sn = taskObj.sn;
location.status = (int)LocationStatus.In; location.status = (int)LocationStatus.In;
_automationLocation.Update(location); _automationLocation.Update(location);
sectionProperty.upload = 0;
sectionProperty.down = 0;
_automationSectionProperty.Update(sectionProperty);
} }
//从立库储位拿SN 工件到上料位 //从立库储位拿SN 工件到上料位
if (taskObj.action == TaskAction.Step_LK_SXLW) if (taskObj.action == TaskAction.Step_LK_SXLW)
...@@ -286,7 +290,26 @@ namespace Siger.ApiACC.Controllers ...@@ -286,7 +290,26 @@ namespace Siger.ApiACC.Controllers
location.routeid = taskObj.route; location.routeid = taskObj.route;
location.status = (int)LocationStatus.Out; location.status = (int)LocationStatus.Out;
_automationLocation.Update(location); _automationLocation.Update(location);
}
if (taskObj.action== TaskAction.Step_LK_CJT )
{
}
//上料中
if (sectionProperty.upload != 0)
{
sectionProperty.upload += 1;
_automationSectionProperty.Update(sectionProperty);
} }
if (sectionProperty.down != 0)
{
sectionProperty.down += 1;
_automationSectionProperty.Update(sectionProperty);
}
} }
// CNC 设备 // CNC 设备
if (sectionProperty.propertytype == 2) if (sectionProperty.propertytype == 2)
......
...@@ -76,13 +76,7 @@ namespace Siger.ApiACC.Controllers ...@@ -76,13 +76,7 @@ namespace Siger.ApiACC.Controllers
[HttpGet] [HttpGet]
public IActionResult GetloadStation(int line,int type) public IActionResult GetloadStation(int line,int type)
{ {
var stationDicts = _sigerDict.GetDataByCat(AccDictCost.Automation, ProjectId);
if (!stationDicts.Any())
{
Logger.WriteLineInfo($"GetloadStation 未配置设备类型字典");
throw new BadRequestException(CommonEnum.RecordNotFound);
}
var loadStation=new List<string>();
//上下料 //上下料
if (type==0) if (type==0)
{ {
...@@ -309,31 +303,17 @@ namespace Siger.ApiACC.Controllers ...@@ -309,31 +303,17 @@ namespace Siger.ApiACC.Controllers
public IActionResult Loading([FromBody]requestAutomationLoading loading) public IActionResult Loading([FromBody]requestAutomationLoading loading)
{ {
var machineAttr = _sigerProjectMachineAttribution.Get(f => f.station == loading.section && f.status == (int)RowState.Valid); var upload = _sectionPropertyRepository.Get(f => f.sectionid == loading.section);
if (machineAttr==null) if (upload==null)
{
throw new BadRequestException(CommonEnum.RecordNotFound);
}
var machineStatus = _automationMachineStatus.Get(f => f.machineid == machineAttr.machine);
if (machineStatus == null)
{ {
//上料设备状态与PLC 无关, throw new BadRequestException(AccEnum.Station_Null);
//需要手动插入
_automationMachineStatus.Insert(new siger_automation_machine_status
{
enable = 1,
section = loading.section,
machineid = machineAttr.machine,
auto=0,
projectId = ProjectId,
status = (int)Automation.MachineStatus.Waiting,
updatetime = DateTime.Now
});
} }
if (machineStatus.status!=(int)Automation.MachineStatus.Waiting) if (upload.upload!=0)
{ {
throw new BadRequestException(AccEnum.MachineDisable); throw new BadRequestException(AccEnum.TaskProcessing);
} }
upload.upload = 1;
_sectionPropertyRepository.Update(upload);
var plandts = _planDetails.Get(f => f.projectId == ProjectId && f.OrderNumber == loading.code); var plandts = _planDetails.Get(f => f.projectId == ProjectId && f.OrderNumber == loading.code);
if (plandts==null) if (plandts==null)
{ {
...@@ -420,15 +400,18 @@ namespace Siger.ApiACC.Controllers ...@@ -420,15 +400,18 @@ namespace Siger.ApiACC.Controllers
[HttpPost] [HttpPost]
public IActionResult CompalateAssemble([FromBody]requestAutoCompalateAssemble assemble) public IActionResult CompalateAssemble([FromBody]requestAutoCompalateAssemble assemble)
{ {
var machineStatus = _automationMachineStatus.Get(f => f.section == assemble.section);
if (machineStatus==null) var upload = _sectionPropertyRepository.Get(f => f.sectionid == assemble.section);
if (upload == null)
{ {
throw new BadRequestException(CommonEnum.RecordNotFound); throw new BadRequestException(AccEnum.Station_Null);
} }
if (machineStatus.enable == 0) if (upload.upload <=2 )
{ {
throw new BadRequestException(AccEnum.MachineDisable); throw new BadRequestException(AccEnum.TaskProcessing);
} }
upload.upload += 1;
_sectionPropertyRepository.Update(upload);
var monitor = _automationFixtureMonitor.Get(f => f.projectId == ProjectId && f.section == assemble.section); var monitor = _automationFixtureMonitor.Get(f => f.projectId == ProjectId && f.section == assemble.section);
if (monitor==null) if (monitor==null)
...@@ -497,6 +480,18 @@ namespace Siger.ApiACC.Controllers ...@@ -497,6 +480,18 @@ namespace Siger.ApiACC.Controllers
public IActionResult Unloading([FromBody]requestAutomationUnloading unloading) public IActionResult Unloading([FromBody]requestAutomationUnloading unloading)
{ {
var upload = _sectionPropertyRepository.Get(f => f.sectionid == unloading.section);
if (upload == null)
{
throw new BadRequestException(AccEnum.Station_Null);
}
if (upload.down != 0)
{
throw new BadRequestException(AccEnum.TaskProcessing);
}
upload.down += 1;
_sectionPropertyRepository.Update(upload);
var location = _automationLocation.Get(f => f.id == unloading.id); var location = _automationLocation.Get(f => f.id == unloading.id);
if (location==null) if (location==null)
{ {
...@@ -608,31 +603,19 @@ namespace Siger.ApiACC.Controllers ...@@ -608,31 +603,19 @@ namespace Siger.ApiACC.Controllers
{ {
throw new BadRequestException(AccEnum.MonitorNotfound); throw new BadRequestException(AccEnum.MonitorNotfound);
} }
var tasklist = _automationTaskList.Get(f => f.no == monitor.taskno);
if (tasklist==null) var upload = _sectionPropertyRepository.Get(f => f.sectionid == disassemble.section);
{ if (upload == null)
throw new BadRequestException(AccEnum.MachineDisable);
}
if (tasklist.status==(int)TaskResultStatus.Complated)
{ {
throw new BadRequestException(AccEnum.AutoTaskDone); throw new BadRequestException(AccEnum.Station_Null);
} }
var location = _automationLocation.Get(f => f.locationid == monitor.locationId); if (upload.down < 2)
if (location==null)
{ {
throw new BadRequestException(AccEnum.LocationNoSn); throw new BadRequestException(AccEnum.TaskProcessing);
}
if (location.status!=1)
{
throw new BadRequestException(AccEnum.LocationNoSn);
}
//TODO 任务完成时做
if (location!=null)
{
location.sn = "";
location.status= (int)LocationStatus.Out;
_automationLocation.Update(location);
} }
upload.down += 1;
_sectionPropertyRepository.Update(upload);
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
{ {
......
...@@ -19,11 +19,11 @@ namespace Siger.Middlelayer.AccRepository.Entities ...@@ -19,11 +19,11 @@ namespace Siger.Middlelayer.AccRepository.Entities
/// </summary> /// </summary>
public int propertytype { get; set; } public int propertytype { get; set; }
/// <summary> /// <summary>
/// 0:不是上料1:是上料 /// 上料状态 1 当前是上料 2 上料中 3 安装完成
/// </summary> /// </summary>
public int upload { get; set; } public int upload { get; set; }
/// <summary> /// <summary>
/// 0:不是下料1:是下料 /// 下料状态 1 当前是下料 2 下料中 3 拆卸完成
/// </summary> /// </summary>
public int down { get; set; } public int down { get; set; }
......
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