Commit 1000243c by jiawei.su

someupdate

parent b96d84c0
...@@ -30,9 +30,11 @@ namespace Siger.ApiACC.Controllers ...@@ -30,9 +30,11 @@ namespace Siger.ApiACC.Controllers
private readonly IAutomationTaskListRepository _automationTaskList; private readonly IAutomationTaskListRepository _automationTaskList;
private readonly IProductPlanDetails _planDetails; private readonly IProductPlanDetails _planDetails;
private readonly IProductPlanRepository _productPlan; private readonly IProductPlanRepository _productPlan;
private readonly IAutomationFixtureMonitor _automationFixtureMonitor;
private readonly IAutomationFixtureToolsProductRepository _automationFixtureToolsProduct;
public AutomationOperateController(IUnitOfWork unitOfWork,ISigerProjectLevelSectionRepository sigerProjectLevelSection , ISigerDict sigerDict,IAutomationMachineStatus automationMachineStatus,ISigerProjectMachineAttributionRepository sigerProjectMachineAttribution,IAutomationTaskListRepository automationTaskList, public AutomationOperateController(IUnitOfWork unitOfWork,ISigerProjectLevelSectionRepository sigerProjectLevelSection , ISigerDict sigerDict,IAutomationMachineStatus automationMachineStatus,ISigerProjectMachineAttributionRepository sigerProjectMachineAttribution,IAutomationTaskListRepository automationTaskList,
IProductPlanDetails planDetails,IProductPlanRepository productPlan) IProductPlanDetails planDetails,IProductPlanRepository productPlan,IAutomationFixtureMonitor automationFixtureMonitor ,IAutomationFixtureToolsProductRepository automationFixtureToolsProduct)
{ {
_unitOfWork = unitOfWork; _unitOfWork = unitOfWork;
_sigerProjectLevelSection = sigerProjectLevelSection; _sigerProjectLevelSection = sigerProjectLevelSection;
...@@ -42,6 +44,8 @@ namespace Siger.ApiACC.Controllers ...@@ -42,6 +44,8 @@ namespace Siger.ApiACC.Controllers
_automationTaskList = automationTaskList; _automationTaskList = automationTaskList;
_planDetails = planDetails; _planDetails = planDetails;
_productPlan = productPlan; _productPlan = productPlan;
_automationFixtureMonitor = automationFixtureMonitor;
_automationFixtureToolsProduct = automationFixtureToolsProduct;
} }
/// <summary> /// <summary>
...@@ -179,13 +183,18 @@ namespace Siger.ApiACC.Controllers ...@@ -179,13 +183,18 @@ namespace Siger.ApiACC.Controllers
{ {
throw new BadRequestException(CncEnum.PlanHasExist); throw new BadRequestException(CncEnum.PlanHasExist);
} }
//检查工装
var fixtureToolsObj = _automationFixtureToolsProduct.GetFixtureInfoByProductCode(ProjectId, plan.product_code);
if (fixtureToolsObj == null)
{
throw new BadRequestException(AccEnum.FixtureToolsIsNone);
}
var taskNo = _automationTaskList.CrateTaskNumber(Automation.TaskTrigerType.Manual); var taskNo = _automationTaskList.CrateTaskNumber(Automation.TaskTrigerType.Manual);
var sn = _automationTaskList.CreateRandonSn(plan.product_code); var sn = _automationTaskList.CreateRandonSn(plan.product_code);
_automationTaskList.Insert(new siger_automation_task_list _automationTaskList.Insert(new siger_automation_task_list
{ {
guid=taskNo, no=taskNo,
action= Automation.TaskAction.Step_LK_SXLW, action= Automation.TaskAction.Step_LK_SXLW,
actiontype= Automation.ExcueType.None, actiontype= Automation.ExcueType.None,
triggertime=DateTime.MinValue, triggertime=DateTime.MinValue,
...@@ -201,10 +210,16 @@ namespace Siger.ApiACC.Controllers ...@@ -201,10 +210,16 @@ namespace Siger.ApiACC.Controllers
productid=plan.product_id, productid=plan.product_id,
sn=sn, sn=sn,
ordercode=plandts.OrderNumber, ordercode=plandts.OrderNumber,
remark="手动任务", fixtureguid= fixtureToolsObj.FixtureGuid,
locationid=fixtureToolsObj.Location,
remark ="手动任务",
}); });
// var monitor= _automationFixtureMonitor.Get()
if (_unitOfWork.Commit() > 0) if (_unitOfWork.Commit() > 0)
return new ObjectResult(CommonEnum.Succefull); return new ObjectResult(CommonEnum.Succefull);
else else
......
...@@ -324,7 +324,9 @@ namespace Siger.Middlelayer.Common.ModuleEnum ...@@ -324,7 +324,9 @@ namespace Siger.Middlelayer.Common.ModuleEnum
[Description("设备正在使用中")] [Description("设备正在使用中")]
MachineBusy, MachineBusy,
[Description("任务进行中")] [Description("任务进行中")]
TaskProcessing TaskProcessing,
[Description("产品工装未找到")]
FixtureToolsIsNone,
} }
public enum SeriNumCfg public enum SeriNumCfg
......
...@@ -19,6 +19,10 @@ namespace Siger.Middlelayer.AccRepository.Entities ...@@ -19,6 +19,10 @@ namespace Siger.Middlelayer.AccRepository.Entities
/// </summary> /// </summary>
public int productid { get; set; } public int productid { get; set; }
/// <summary> /// <summary>
/// 产品CODE
/// </summary>
public string productcode { get; set; }
/// <summary>
/// 备注 /// 备注
/// </summary> /// </summary>
public string remark { get; set; } public string remark { get; set; }
......
...@@ -10,7 +10,11 @@ namespace Siger.Middlelayer.AccRepository.Entities ...@@ -10,7 +10,11 @@ namespace Siger.Middlelayer.AccRepository.Entities
/// </summary> /// </summary>
public class siger_automation_task_list : AccEntityBase public class siger_automation_task_list : AccEntityBase
{ {
public string guid { get; set; } /// <summary>
/// 任务编号
/// </summary>
public string no { get; set; }
/// <summary> /// <summary>
/// 工位ID /// 工位ID
/// </summary> /// </summary>
...@@ -50,7 +54,7 @@ namespace Siger.Middlelayer.AccRepository.Entities ...@@ -50,7 +54,7 @@ namespace Siger.Middlelayer.AccRepository.Entities
/// <summary> /// <summary>
/// 工装GUID /// 工装GUID
/// </summary> /// </summary>
public int fixturetools { get; set; } public string fixtureguid { get; set; }
/// <summary> /// <summary>
/// Task 执行动作类型 1 手动 2 自动 /// Task 执行动作类型 1 手动 2 自动
......
...@@ -20,6 +20,22 @@ namespace Siger.Middlelayer.AccRepository.Repositories ...@@ -20,6 +20,22 @@ namespace Siger.Middlelayer.AccRepository.Repositories
_context = context; _context = context;
} }
public ResponseProductFixtureInfo GetFixtureInfoByProductCode(int projectId, string productCode)
{
var query = from q in _context.siger_automation_fixture_tools_product
join t in _context.siger_automation_fixture_tools on q.fixturetools equals t.guid
join l in _context.siger_automation_location on t.guid equals l.fixturetools
where q.projectId == projectId && q.productcode==productCode && q.status == (int)RowState.Valid && t.status == (int)RowState.Valid
select new ResponseProductFixtureInfo
{
FixtureId=t.id,
FixtureGuid=t.guid,
ProductCode=q.productcode,
Location=l.locationid.ToString(),
};
return query.FirstOrDefault();
}
public IPagedCollectionResult<ResponseAumationFixtureToolsProduct> GetPagedList(int category, int tool, int product, int projectid, int page, int pagesize) public IPagedCollectionResult<ResponseAumationFixtureToolsProduct> GetPagedList(int category, int tool, int product, int projectid, int page, int pagesize)
{ {
var query = from q in _context.siger_automation_fixture_tools_product var query = from q in _context.siger_automation_fixture_tools_product
......
...@@ -8,5 +8,8 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface ...@@ -8,5 +8,8 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface
public interface IAutomationFixtureToolsProductRepository : IAccRepositoryBase<siger_automation_fixture_tools_product> public interface IAutomationFixtureToolsProductRepository : IAccRepositoryBase<siger_automation_fixture_tools_product>
{ {
IPagedCollectionResult<ResponseAumationFixtureToolsProduct> GetPagedList(int category, int tool, int product, int projectid, int page, int pagesize); IPagedCollectionResult<ResponseAumationFixtureToolsProduct> GetPagedList(int category, int tool, int product, int projectid, int page, int pagesize);
ResponseProductFixtureInfo GetFixtureInfoByProductCode(int projectId, string productCode);
} }
} }
using System;
using System.Collections.Generic;
using System.Text;
namespace Siger.Middlelayer.AccRepository.Response
{
public class ResponseProductFixtureInfo
{
/// <summary>
/// 工装ID
/// </summary>
public int FixtureId { get; set; }
/// <summary>
/// GUID
/// </summary>
public string FixtureGuid { get; set; }
/// <summary>
/// 产品名称
/// </summary>
public string ProductCode { get; set; }
/// <summary>
/// 储位
/// </summary>
public int Location { 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