Commit 54b81565 by jiawei.su

someupdate AutoMes

parent dbfc3567
...@@ -30,10 +30,11 @@ namespace Siger.ApiACC.Controllers ...@@ -30,10 +30,11 @@ namespace Siger.ApiACC.Controllers
private readonly IAutomationLocationRepository _autoLocationRepository; private readonly IAutomationLocationRepository _autoLocationRepository;
private readonly IAutomationFixtureMonitor _fixtureMonitor; private readonly IAutomationFixtureMonitor _fixtureMonitor;
private readonly IProductRouteRepository _routeRepository; private readonly IProductRouteRepository _routeRepository;
private readonly IAutomationFixtureToolsProductRepository _automationFixtureToolsProduct;
public AutomationLocationController(IUnitOfWork unitOfWork, IAutomationFixtureToolsCategoryRepository toolsCategoryRepository, public AutomationLocationController(IUnitOfWork unitOfWork, IAutomationFixtureToolsCategoryRepository toolsCategoryRepository,
IAutomationFixtureToolsRepository toolsRepository, IAutomationLocationRepository autoLocationRepository, IAutomationFixtureToolsRepository toolsRepository, IAutomationLocationRepository autoLocationRepository,
IAutomationFixtureMonitor fixtureMonitor, IProductRouteRepository routeRepository) IAutomationFixtureMonitor fixtureMonitor, IProductRouteRepository routeRepository,IAutomationFixtureToolsProductRepository automationFixtureToolsProduct)
{ {
_unitOfWork = unitOfWork; _unitOfWork = unitOfWork;
_toolsCategoryRepository = toolsCategoryRepository; _toolsCategoryRepository = toolsCategoryRepository;
...@@ -41,6 +42,7 @@ namespace Siger.ApiACC.Controllers ...@@ -41,6 +42,7 @@ namespace Siger.ApiACC.Controllers
_autoLocationRepository = autoLocationRepository; _autoLocationRepository = autoLocationRepository;
_fixtureMonitor = fixtureMonitor; _fixtureMonitor = fixtureMonitor;
_routeRepository = routeRepository; _routeRepository = routeRepository;
_automationFixtureToolsProduct = automationFixtureToolsProduct;
} }
[HttpGet] [HttpGet]
...@@ -192,6 +194,8 @@ namespace Siger.ApiACC.Controllers ...@@ -192,6 +194,8 @@ namespace Siger.ApiACC.Controllers
{ {
throw new BadRequestException(RequestEnum.FixtureToolNotFound); throw new BadRequestException(RequestEnum.FixtureToolNotFound);
} }
var fixturetoolProduct = _automationFixtureToolsProduct.Get(f => f.fixturetools == fixturetool.guid);
var location = _autoLocationRepository.GetLocation(req.locationid.ToInt(), ProjectId); var location = _autoLocationRepository.GetLocation(req.locationid.ToInt(), ProjectId);
if (location == null) if (location == null)
{ {
...@@ -209,6 +213,8 @@ namespace Siger.ApiACC.Controllers ...@@ -209,6 +213,8 @@ namespace Siger.ApiACC.Controllers
guid = Guid.NewGuid().ToString(), guid = Guid.NewGuid().ToString(),
locationid = location.locationid, locationid = location.locationid,
fixturetools = fixturetool.guid, fixturetools = fixturetool.guid,
productid= fixturetoolProduct != null ? fixturetoolProduct.productid : 0,
productcode = fixturetoolProduct!=null? fixturetoolProduct.productcode:"",
attachment = req.fileurl, attachment = req.fileurl,
filename = req.filename, filename = req.filename,
remark = req.remark, remark = req.remark,
...@@ -244,6 +250,7 @@ namespace Siger.ApiACC.Controllers ...@@ -244,6 +250,7 @@ namespace Siger.ApiACC.Controllers
{ {
throw new BadRequestException(RequestEnum.FixtureToolNotFound); throw new BadRequestException(RequestEnum.FixtureToolNotFound);
} }
var fixturetoolProduct = _automationFixtureToolsProduct.Get(f => f.fixturetools == fixturetool.guid);
var location = _autoLocationRepository.GetLocation(req.locationid.ToInt(), ProjectId); var location = _autoLocationRepository.GetLocation(req.locationid.ToInt(), ProjectId);
if (location == null) if (location == null)
{ {
...@@ -263,6 +270,9 @@ namespace Siger.ApiACC.Controllers ...@@ -263,6 +270,9 @@ namespace Siger.ApiACC.Controllers
entity.remark = req.remark; entity.remark = req.remark;
entity.updatetime = DateTime.Now; entity.updatetime = DateTime.Now;
entity.updator = UserId; entity.updator = UserId;
entity.productid = fixturetoolProduct != null ? fixturetoolProduct.productid : 0;
entity.productcode = fixturetoolProduct != null ? fixturetoolProduct.productcode : "";
_autoLocationRepository.Update(entity); _autoLocationRepository.Update(entity);
if (_unitOfWork.Commit() > 0) if (_unitOfWork.Commit() > 0)
{ {
......
...@@ -35,9 +35,10 @@ namespace Siger.ApiACC.Controllers ...@@ -35,9 +35,10 @@ namespace Siger.ApiACC.Controllers
private readonly IAutomationFixtureMonitor _automationFixtureMonitor; private readonly IAutomationFixtureMonitor _automationFixtureMonitor;
private readonly IAutomationFixtureToolsProductRepository _automationFixtureToolsProduct; private readonly IAutomationFixtureToolsProductRepository _automationFixtureToolsProduct;
private readonly IAutomationFixtureToolsRepository _automationFixtureTools; private readonly IAutomationFixtureToolsRepository _automationFixtureTools;
private readonly IAutomationLocationRepository _automationLocation;
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,IAutomationFixtureMonitor automationFixtureMonitor ,IAutomationFixtureToolsProductRepository automationFixtureToolsProduct,IAutomationFixtureToolsRepository automationFixtureTools) IProductPlanDetails planDetails,IProductPlanRepository productPlan,IAutomationFixtureMonitor automationFixtureMonitor ,IAutomationFixtureToolsProductRepository automationFixtureToolsProduct,IAutomationFixtureToolsRepository automationFixtureTools, IAutomationLocationRepository automationLocation)
{ {
_unitOfWork = unitOfWork; _unitOfWork = unitOfWork;
_sigerProjectLevelSection = sigerProjectLevelSection; _sigerProjectLevelSection = sigerProjectLevelSection;
...@@ -50,6 +51,7 @@ namespace Siger.ApiACC.Controllers ...@@ -50,6 +51,7 @@ namespace Siger.ApiACC.Controllers
_automationFixtureMonitor = automationFixtureMonitor; _automationFixtureMonitor = automationFixtureMonitor;
_automationFixtureToolsProduct = automationFixtureToolsProduct; _automationFixtureToolsProduct = automationFixtureToolsProduct;
_automationFixtureTools = automationFixtureTools; _automationFixtureTools = automationFixtureTools;
_automationLocation = automationLocation;
} }
/// <summary> /// <summary>
...@@ -173,7 +175,7 @@ namespace Siger.ApiACC.Controllers ...@@ -173,7 +175,7 @@ namespace Siger.ApiACC.Controllers
return new ObjectResult(result); return new ObjectResult(result);
} }
/// <summary> /// <summary>
/// 准备上料 -生成指令 load /// 准备上料 -生成指令 load (立库->上料位)
/// </summary> /// </summary>
/// <param name="loading"></param> /// <param name="loading"></param>
/// <returns></returns> /// <returns></returns>
...@@ -348,6 +350,8 @@ namespace Siger.ApiACC.Controllers ...@@ -348,6 +350,8 @@ namespace Siger.ApiACC.Controllers
throw new BadRequestException(AccEnum.MonitorNotfound); throw new BadRequestException(AccEnum.MonitorNotfound);
} }
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
{ {
...@@ -376,7 +380,6 @@ namespace Siger.ApiACC.Controllers ...@@ -376,7 +380,6 @@ namespace Siger.ApiACC.Controllers
}); });
if (_unitOfWork.Commit() > 0) if (_unitOfWork.Commit() > 0)
{ {
Logger.WriteLineError($"手动任务创建成功-{Siger.Middlelayer.Common.Helpers.EnumHelper.GetEnumDesc(Automation.TaskAction.Step_SXLW_LK)}"); Logger.WriteLineError($"手动任务创建成功-{Siger.Middlelayer.Common.Helpers.EnumHelper.GetEnumDesc(Automation.TaskAction.Step_SXLW_LK)}");
......
...@@ -38,5 +38,10 @@ namespace Siger.Middlelayer.Share.Constant ...@@ -38,5 +38,10 @@ namespace Siger.Middlelayer.Share.Constant
/// </summary> /// </summary>
public const string UploadloadStation = "LoadStation"; public const string UploadloadStation = "LoadStation";
/// <summary>
/// 立库
/// </summary>
public const string WarehouseStation = "WarehouseStation";
} }
} }
...@@ -334,7 +334,9 @@ namespace Siger.Middlelayer.Common.ModuleEnum ...@@ -334,7 +334,9 @@ namespace Siger.Middlelayer.Common.ModuleEnum
[Description("设备已经生产完成")] [Description("设备已经生产完成")]
MachineProCompalate, MachineProCompalate,
[Description("该设备当前无工装状态")] [Description("该设备当前无工装状态")]
MonitorNotfound MonitorNotfound,
[Description("未配置字典信息")]
AutomationDictNotfound
} }
public enum SeriNumCfg public enum SeriNumCfg
......
...@@ -18,6 +18,26 @@ namespace Siger.Middlelayer.AccRepository.Entities ...@@ -18,6 +18,26 @@ namespace Siger.Middlelayer.AccRepository.Entities
/// 工装GUID /// 工装GUID
/// </summary> /// </summary>
public string fixturetools { get; set; } public string fixturetools { get; set; }
public int productid { get; set; }
public string productcode { get; set; }
/// <summary>
/// 工件对应的工单号
/// </summary>
public string ordernumber { get; set; }
/// <summary>
/// 工装工件
/// </summary>
public string sn { get; set; }
/// <summary>
/// 每加工CNC 设备 经过的工序: 标准节拍表
/// </summary>
public int routeid { get; set; }
/// <summary>
/// 每加工CNC 设备 经过的工序: 标准节拍表
/// </summary>
public string route { get; set; }
/// <summary> /// <summary>
/// 附件 /// 附件
/// </summary> /// </summary>
......
...@@ -97,6 +97,27 @@ namespace Siger.Middlelayer.AccRepository.Repositories ...@@ -97,6 +97,27 @@ namespace Siger.Middlelayer.AccRepository.Repositories
} }
} }
/// <summary>
/// 获取 交期最早的订单
/// </summary>
/// <param name="productIds"></param>
/// <param name="projectId"></param>
/// <returns></returns>
public IEnumerable<ResponseAutomationPlanOrder> GetDeliveryOrder(List<int>productIds,int projectId)
{
var query = from d in _context.siger_project_product_plan_detail
join p in _context.siger_project_product_plan on d.PlanId equals p.id
where d.projectId == projectId && productIds.Contains(p.product_id) && d.status != (int)RowState.Invalid && p.status != (int)RowState.Invalid
select new ResponseAutomationPlanOrder
{
ordernumber=d.OrderNumber,
productCode=p.product_code,
productName=p.product_name,
delvery=p.delivery_time,
};
return query.OrderBy(f => f.delvery);
}
public ResponsePlanlFixtureInfo GetPlanFixtureInfo(int projectId, string ordernumber) public ResponsePlanlFixtureInfo GetPlanFixtureInfo(int projectId, string ordernumber)
{ {
......
...@@ -23,5 +23,13 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface ...@@ -23,5 +23,13 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface
CommonImportResult ImportData(IEnumerable<FixtureToolsProductTemplate> list, int projectid, int userid); CommonImportResult ImportData(IEnumerable<FixtureToolsProductTemplate> list, int projectid, int userid);
/// <summary>
/// 获取交期最近的订单
/// </summary>
/// <param name="productIds"></param>
/// <param name="projectId"></param>
/// <returns></returns>
IEnumerable<ResponseAutomationPlanOrder> GetDeliveryOrder(List<int> productIds, int projectId);
} }
} }
...@@ -40,4 +40,13 @@ namespace Siger.Middlelayer.AccRepository.Response ...@@ -40,4 +40,13 @@ namespace Siger.Middlelayer.AccRepository.Response
public int Location { get; set; } public int Location { get; set; }
public string Sn { get; set; } public string Sn { get; set; }
} }
public class ResponseAutomationPlanOrder
{
public string ordernumber { get; set; }
public string productCode { get; set; }
public string productName { get; set; }
public int delvery { 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