Commit 0e895cec by xin.yang
parents 987f2924 c2f806aa
......@@ -8,6 +8,7 @@ using Siger.Middlelayer.AccRepository.Entities;
using Siger.Middlelayer.AccRepository.Repositories.Interface;
using Siger.Middlelayer.AccRepository.Request;
using Siger.Middlelayer.Common;
using Siger.ApiCommon.Filters;
using Siger.Middlelayer.Common.Extensions;
using Siger.Middlelayer.Common.Log;
using Siger.Middlelayer.Common.ModuleEnum;
......@@ -19,6 +20,7 @@ using static Siger.Middlelayer.Share.Enum.ModuleEnum.Automation;
namespace Siger.ApiACC.Controllers
{
[NoTokenValidateFilter]
public class AutomationController : LaisiBaseController
{
private readonly IUnitOfWork _unitOfWork;
......@@ -117,7 +119,7 @@ namespace Siger.ApiACC.Controllers
{
section = line,
projectId = PID,
status = 1,
status = 0,
updatetime = DateTime.Now,
mode = mode
});
......@@ -126,10 +128,9 @@ namespace Siger.ApiACC.Controllers
{
exitObj.updatetime = DateTime.Now;
exitObj.mode = mode;
_automationLineMode.Update(exitObj);
}
if (_unitOfWork.Commit() > 0)
{
if (mode == 1)
......@@ -159,7 +160,7 @@ namespace Siger.ApiACC.Controllers
/// <param name="enable"></param>
/// <returns></returns>
[HttpGet]
public IActionResult inspect(int line, int enable)
public IActionResult Inspect(int line, int enable)
{
var exitObj = _automationLineMode.Get(f => f.section == line);
if (exitObj == null)
......@@ -194,6 +195,7 @@ namespace Siger.ApiACC.Controllers
}
//2.更新状态
taskObj.status = request.status;
_automationTaskList.Update(taskObj);
if (_unitOfWork.Commit() <= 0)
{
......
......@@ -9,6 +9,7 @@ using Siger.Middlelayer.AccRepository.Repositories.Interface;
using Siger.Middlelayer.AccRepository.Request;
using Siger.Middlelayer.AccRepository.Response;
using Siger.Middlelayer.Common;
using Siger.ApiCommon.Filters;
using Siger.Middlelayer.Common.Extensions;
using Siger.Middlelayer.Common.ModuleEnum;
using Siger.Middlelayer.Log;
......@@ -20,7 +21,7 @@ using Siger.Middlelayer.Share.Enum.ModuleEnum;
namespace Siger.ApiACC.Controllers
{
[NoTokenValidateFilter]
public class AutomationOperateController : BaseController
{
private readonly IUnitOfWork _unitOfWork;
......@@ -104,7 +105,7 @@ namespace Siger.ApiACC.Controllers
continue;
}
var loadStatus = (int)Automation.MachineStatus.Waiting;
var machineStatus = _automationMachineStatus.Get(f => f.section == station.ToInt() && f.status==(int)RowState.Valid);
var machineStatus = _automationMachineStatus.Get(f => f.section == section.id);
if (machineStatus==null)
{
_automationMachineStatus.Insert(new siger_automation_machine_status
......@@ -137,6 +138,8 @@ namespace Siger.ApiACC.Controllers
[HttpGet]
public IActionResult GetLoadingState(int section)
{
var monitor = _automationFixtureMonitor.Get(f => f.section == section);
var result = new ResponsePlanlFixtureInfo
{
......@@ -255,7 +258,9 @@ namespace Siger.ApiACC.Controllers
ordercode=plandts.OrderNumber,
fixtureguid= fixtureToolsObj.FixtureGuid,
locationid=fixtureToolsObj.Location,
productcode=plan.product_code,
processid=0,
programnumber="",
remark ="手动任务",
});
......@@ -290,6 +295,7 @@ namespace Siger.ApiACC.Controllers
monitor.productCode = plan.product_code;
monitor.ordernumber = plandts.OrderNumber;
monitor.locationId = fixtureToolsObj.Location;
_automationFixtureMonitor.Update(monitor);
}
......@@ -308,6 +314,31 @@ namespace Siger.ApiACC.Controllers
[HttpPost]
public IActionResult CompalateAssemble([FromBody]requestAutoCompalateAssemble assemble)
{
var machineStatus = _automationMachineStatus.Get(f => f.section == assemble.section);
if (machineStatus==null)
{
throw new BadRequestException(CommonEnum.RecordNotFound);
}
if (machineStatus.enable == 0)
{
throw new BadRequestException(AccEnum.MachineDisable);
}
if (machineStatus.status == (int)Automation.MachineStatus.Waiting)
{
throw new BadRequestException(AccEnum.MachineOnFree);
}
if (machineStatus.status == (int)Automation.MachineStatus.Complated)
{
throw new BadRequestException(AccEnum.MachineProCompalate);
}
if (!_automationTaskList.CanTask(ProjectId, assemble.section))
{
throw new BadRequestException(AccEnum.TaskProcessing);
}
//创建 安装完成动作
return new ObjectResult(1);
}
/// <summary>
......
......@@ -9,7 +9,7 @@ namespace Siger.ApiACC.Tasks
/// </summary>
public static void StartUp()
{
// JobManager.Initialize(new AccRegistry());
JobManager.Initialize(new AccRegistry());
}
/// <summary>
......
......@@ -328,7 +328,11 @@ namespace Siger.Middlelayer.Common.ModuleEnum
[Description("产品工装未找到")]
FixtureToolsIsNone,
[Description("未找到工装信息")]
FixtureOrderNulll
FixtureOrderNulll,
[Description("设备正在空闲中")]
MachineOnFree,
[Description("设备已经生产完成")]
MachineProCompalate
}
public enum SeriNumCfg
......
......@@ -328,7 +328,7 @@ CREATE TABLE IF NOT EXISTS `siger_automation_task_list` (
`sectionid` int(11) NOT NULL DEFAULT 0 COMMENT '工位ID',
`trigger` int(1) NOT NULL DEFAULT 0 COMMENT '触发方',
`tasktype` int(1) NOT NULL DEFAULT 0 COMMENT '任务类型',
`sn` int(11) NOT NULL DEFAULT 0 COMMENT '工件ID',
`sn` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '工件编号',
`ordercode` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '工单号',
`productid` int(11) NOT NULL DEFAULT 0 COMMENT '产品ID',
`productcode` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '产品CODE',
......@@ -339,13 +339,13 @@ CREATE TABLE IF NOT EXISTS `siger_automation_task_list` (
`actiontype` int(11) NOT NULL DEFAULT 0 COMMENT '动作类型',
`projectid` int(11) NOT NULL DEFAULT 0,
`send` int(1) NOT NULL DEFAULT 0 COMMENT '0:未下发 1:已下发',
`status` int(11) NOT NULL DEFAULT 1 COMMENT '任务进度状态:0 取消 1待生产 2生产中 3生产完成',
`triggertime` datetime(0) NOT NULL COMMENT '触发时间',
`completetime` datetime(0) NULL DEFAULT NULL COMMENT '完成时间',
`operater` int(11) NOT NULL DEFAULT 0 COMMENT '操作人',
`operatetime` datetime(0) NULL DEFAULT NULL COMMENT '操作时间',
`remark` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
`extend1` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`status` int(11) NOT NULL DEFAULT 1 COMMENT '任务进度状态:0 取消 1待生产 2生产中 3生产完成',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
......@@ -380,6 +380,7 @@ CREATE TABLE `siger_automation_line_mode` (
`mode` int(1) NOT NULL DEFAULT 1 COMMENT '0:手动模式 1:自动模式',
`inspect` int(1) NOT NULL DEFAULT 1 COMMENT '0:不需要检验 1:检验',
`updatetime` datetime(0) NULL DEFAULT NULL COMMENT '操作时间',
`status` int NOT NULL DEFAULT '1' COMMENT '产线模式 0:手动 1:自动 ',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
......@@ -428,6 +429,7 @@ CREATE TABLE `siger_automation_fixture_tools_moniter` (
`productCode` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '产品CODE',
`productName` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '产品名称',
`locationId` int(11) NOT NULL DEFAULT 0,
`status` int(1) NOT NULL DEFAULT 1 COMMENT '',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
......
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