Commit 32ab390d by yiyu.li
parents 6780ffcc 0e895cec
......@@ -444,7 +444,7 @@ export default {
return false;
}
this.type = 2;
this.parentType = [];//工装类型 清空
this.parentType = this.detailobj.categoryids;//工装类型 清空
this.parentTypeid = this.detailobj.categoryid;
this.addfrockid = this.detailobj.fixturetoolid;//工装id
this.addproductid = this.detailobj.productid;//产品
......
......@@ -569,8 +569,8 @@ export default {
this.initFrockType();//工装类型
this.parentType = this.detailobj.categoryIds;//工装类型
let categoryIds = this.detailobj.categoryIds;
this.parentTypeid = this.detailobj.categoryId;
if(Array.isArray(categoryIds)&& categoryIds.length){
this.parentTypeid = categoryIds[categoryIds.length -1];
this.getFrocksChange();
}
this.addfrockid = this.detailobj.fixturetoolid;//工装id
......
......@@ -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>
......
......@@ -66,7 +66,7 @@ namespace Siger.ApiACC.Controllers
model.parentcategoryids = parentcateIds1;
models.Add(model);
}
item.children = models;
item.childrens = models;
list.Add(item);
}
......@@ -136,6 +136,7 @@ namespace Siger.ApiACC.Controllers
updatetime = DateTime.Now,
updator = UserId,
status = req.status.ToInt() == (int)RowState.Valid ? (int)RowState.Valid : (int)RowState.Invalid,
remark = req.remark
};
_toolsAssemblyRepository.Insert(parentEntity);
}
......@@ -219,6 +220,7 @@ namespace Siger.ApiACC.Controllers
projectId = ProjectId,
updatetime = DateTime.Now,
updator = UserId,
remark = req.remark,
status = req.status.ToInt() == (int)RowState.Valid ? (int)RowState.Valid : (int)RowState.Invalid,
};
_toolsAssemblyRepository.Insert(parentEntity);
......@@ -231,6 +233,7 @@ namespace Siger.ApiACC.Controllers
entity.updatetime = DateTime.Now;
entity.updator = UserId;
entity.status = req.status.ToInt() == (int)RowState.Valid ? (int)RowState.Valid : (int)RowState.Invalid;
entity.remark = req.remark;
_toolsAssemblyRepository.Update(entity);
if (_unitOfWork.Commit() > 0)
{
......
......@@ -27,13 +27,15 @@ namespace Siger.ApiACC.Controllers
private readonly IUnitOfWork _unitOfWork;
private readonly IAutomationFixtureToolsCategoryRepository _toolsCategoryRepository;
private readonly IAutomationFixtureToolsRepository _toolsRepository;
private readonly IAutomationLocationRepository _automationLocationRepository;
public FixtureToolsController(IUnitOfWork unitOfWork, IAutomationFixtureToolsCategoryRepository toolsCategoryRepository,
IAutomationFixtureToolsRepository toolsRepository)
IAutomationFixtureToolsRepository toolsRepository, IAutomationLocationRepository automationLocationRepository)
{
_unitOfWork = unitOfWork;
_toolsCategoryRepository = toolsCategoryRepository;
_toolsRepository = toolsRepository;
_automationLocationRepository = automationLocationRepository;
}
public IActionResult GetPageList(string category, string code, string name, string state, int page, int pagesize, string toexcel)
......@@ -387,12 +389,22 @@ namespace Siger.ApiACC.Controllers
[HttpGet]
public IActionResult DeleteCategory(int id)
{
var entity = _toolsCategoryRepository.Get(q => q.projectId == ProjectId && q.status == (int)RowState.Valid && q.id == id);
var categorys = _toolsCategoryRepository.GetList(q => q.projectId == ProjectId && q.status == (int)RowState.Valid).ToList();
var entity = categorys.FirstOrDefault(q => q.id == id);
if (entity == null)
{
throw new BadRequestException(CommonEnum.RecordNotFound);
}
var details = GetSonCategoryList(entity.guid, categorys);
var detailIds = details.Select(q => q.id).Distinct().ToList();
var delDetails = _toolsCategoryRepository.GetList(q => q.projectId == ProjectId && q.status == (int)RowState.Valid &&
detailIds.Contains(q.id)).ToList();
foreach (var detail in delDetails)
{
detail.status = (int)RowState.Invalid;
_toolsCategoryRepository.Update(detail);
}
entity.status = (int)RowState.Invalid;
_toolsCategoryRepository.Update(entity);
if(_unitOfWork.Commit() > 0)
......@@ -405,28 +417,11 @@ namespace Siger.ApiACC.Controllers
}
}
[HttpPost]
public IActionResult DeleteCategorys([FromBody]RequestDeleteRange req)
{
if (req.ids == null || !req.ids.Any())
{
throw new BadRequestException(RequestEnum.ParameterMiss);
}
var entities = _toolsCategoryRepository.GetList(t =>
req.ids.Contains(t.id) && t.projectId == ProjectId && t.status == (int)RowState.Valid).ToList();
if (!entities.Any())
private IEnumerable<siger_automation_fixture_tools_category> GetSonCategoryList(string parentId, List<siger_automation_fixture_tools_category> sections)
{
throw new BadRequestException(CommonEnum.RecordNotFound);
}
foreach (var entity in entities)
{
entity.status = (int)RowState.Invalid;
_toolsCategoryRepository.Update(entity);
}
var query = from c in sections where c.parent == parentId select c;
if (_unitOfWork.Commit() > 0)
return new ObjectResult(CommonEnum.Succefull);
throw new BadRequestException(CommonEnum.Fail);
return query.ToList().Concat(query.ToList().SelectMany(t => GetSonCategoryList(t.parent, sections)));
}
[HttpGet]
......
......@@ -9,7 +9,7 @@ namespace Siger.ApiACC.Tasks
/// </summary>
public static void StartUp()
{
// JobManager.Initialize(new AccRegistry());
JobManager.Initialize(new AccRegistry());
}
/// <summary>
......
......@@ -287,6 +287,19 @@ namespace Siger.ApiConfig.Controller
case TemplateNameEnums.TechMouldList:
type = typeof(TechMouldList);
break;
//自动化加工
case TemplateNameEnums.FixtureToolsCategoryTemplate:
type = typeof(FixtureToolsCategoryTemplate);
break;
case TemplateNameEnums.FixtureToolsTemplate:
type = typeof(FixtureToolsTemplate);
break;
case TemplateNameEnums.FixtureToolsProductTemplate:
type = typeof(FixtureToolsProductTemplate);
break;
case TemplateNameEnums.FixtureToolsAssmeblyTemplate:
type = typeof(FixtureToolsAssmeblyTemplate);
break;
}
return type;
......
......@@ -231,7 +231,11 @@ namespace Siger.Middlelayer.Common
MouldDetection,//模具测试项导入
MouldCoreDetection,//模芯测试项导入
TechMouldList, //模具清单
//自动化加工
FixtureToolsCategoryTemplate,
FixtureToolsTemplate,
FixtureToolsProductTemplate,
FixtureToolsAssmeblyTemplate,
}
public enum LogLevel
......
......@@ -328,7 +328,11 @@ namespace Siger.Middlelayer.Common.ModuleEnum
[Description("产品工装未找到")]
FixtureToolsIsNone,
[Description("未找到工装信息")]
FixtureOrderNulll
FixtureOrderNulll,
[Description("设备正在空闲中")]
MachineOnFree,
[Description("设备已经生产完成")]
MachineProCompalate
}
public enum SeriNumCfg
......
......@@ -39,6 +39,12 @@ namespace Siger.Middlelayer.Utility.ImportEntities
[ExcelColumn("备注")]
public string Remark { get; set; }
[ExcelColumn("维护人")]
public string Updator { get; set; }
[ExcelColumn("维护时间")]
public string UpdateTime { get; set; }
}
public class FixtureToolsProductTemplate : ImportBase
......
......@@ -26,6 +26,8 @@ namespace Siger.Middlelayer.AccRepository.Entities
/// 附件名称
/// </summary>
public string filename { get; set; }
public string remark { get; set; }
public int creator { get; set; }
public DateTime createtime { get; set; }
public int updator { get; set; }
......
......@@ -53,7 +53,9 @@ namespace Siger.Middlelayer.AccRepository.Repositories
cate_guid = t2.guid,
parentcate_guid = t1.guid,
parentguid = q.parent,
fixtureguid = q.son
fixtureguid = q.son,
remark = q.remark,
parentcategoryid = c1 == null ? 0 : c1.id
};
Expression<Func<ResponseAumationFixtureToolsAssembly, bool>> categoryExpression = f => true;
if (category > 0)
......@@ -107,7 +109,8 @@ namespace Siger.Middlelayer.AccRepository.Repositories
cate_guid = t2.guid,
parentcate_guid = t1.guid,
parentguid = q.parent,
fixtureguid = q.son
fixtureguid = q.son,
remark = q.remark
};
var entities = query.OrderByDescending(q => q.id).AsNoTracking().ToList();
return entities;
......
......@@ -57,7 +57,8 @@ namespace Siger.Middlelayer.AccRepository.Repositories
sn = m.sn ?? "",
route = r.name ?? "",
routenumber = r == null ? "" : r.serialNumber.ToString(),
cate_guid = c.guid ?? ""
cate_guid = c.guid ?? "",
categoryId = c == null ? 0 : c.id
};
Expression<Func<ResponseAutomationLocation, bool>> wavehouseidExpression = f => true;
if (wavehouseid > 0)
......@@ -108,7 +109,8 @@ namespace Siger.Middlelayer.AccRepository.Repositories
fixturetoolid = t.id,
code = t.code,
name = t.name,
materialsn = m.sn ?? ""
materialsn = m.sn ?? "",
categoryid = c == null ? 0 : c.id
};
var entities = query.AsNoTracking().ToList();
return entities;
......
......@@ -132,6 +132,8 @@ namespace Siger.Middlelayer.AccRepository.Request
public string filename { get; set; }
public string status { get; set; }
public string remark { get; set; }
}
public class RequestUpdateFixtureToolAssembly : RequestAddFixtureToolAssembly
......
......@@ -139,11 +139,14 @@ namespace Siger.Middlelayer.AccRepository.Response
public List<int> parentcategoryids { get; set; } = new List<int>();
public string cate_guid { get; set; }
public List<int> categoryids { get; set; } = new List<int>();
public int parentcategoryid { get; set; }
public string parentguid { get; set; }
public string fixtureguid { get; set; }
public List<ResponseAumationFixtureToolsAssembly> children { get; set; }
public List<ResponseAumationFixtureToolsAssembly> childrens { get; set; }
public string remark { get; set; }
}
}
......@@ -20,6 +20,7 @@ namespace Siger.Middlelayer.AccRepository.Response
/// </summary>
public int fixturetoolid { get; set; }
public string fixturetool { get; set; }
public int categoryId { get; set; }
public string category { get; set; }
public string code { get; set; }
public string specfication { get; set; }
......@@ -80,5 +81,7 @@ namespace Siger.Middlelayer.AccRepository.Response
public string code { get; set; }
public string name { get; set; }
public string materialsn { get; set; }
public int categoryid { get; set; }
}
}
......@@ -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