Commit 54b81565 by jiawei.su

someupdate AutoMes

parent dbfc3567
......@@ -30,10 +30,11 @@ namespace Siger.ApiACC.Controllers
private readonly IAutomationLocationRepository _autoLocationRepository;
private readonly IAutomationFixtureMonitor _fixtureMonitor;
private readonly IProductRouteRepository _routeRepository;
private readonly IAutomationFixtureToolsProductRepository _automationFixtureToolsProduct;
public AutomationLocationController(IUnitOfWork unitOfWork, IAutomationFixtureToolsCategoryRepository toolsCategoryRepository,
IAutomationFixtureToolsRepository toolsRepository, IAutomationLocationRepository autoLocationRepository,
IAutomationFixtureMonitor fixtureMonitor, IProductRouteRepository routeRepository)
IAutomationFixtureMonitor fixtureMonitor, IProductRouteRepository routeRepository,IAutomationFixtureToolsProductRepository automationFixtureToolsProduct)
{
_unitOfWork = unitOfWork;
_toolsCategoryRepository = toolsCategoryRepository;
......@@ -41,6 +42,7 @@ namespace Siger.ApiACC.Controllers
_autoLocationRepository = autoLocationRepository;
_fixtureMonitor = fixtureMonitor;
_routeRepository = routeRepository;
_automationFixtureToolsProduct = automationFixtureToolsProduct;
}
[HttpGet]
......@@ -192,6 +194,8 @@ namespace Siger.ApiACC.Controllers
{
throw new BadRequestException(RequestEnum.FixtureToolNotFound);
}
var fixturetoolProduct = _automationFixtureToolsProduct.Get(f => f.fixturetools == fixturetool.guid);
var location = _autoLocationRepository.GetLocation(req.locationid.ToInt(), ProjectId);
if (location == null)
{
......@@ -209,6 +213,8 @@ namespace Siger.ApiACC.Controllers
guid = Guid.NewGuid().ToString(),
locationid = location.locationid,
fixturetools = fixturetool.guid,
productid= fixturetoolProduct != null ? fixturetoolProduct.productid : 0,
productcode = fixturetoolProduct!=null? fixturetoolProduct.productcode:"",
attachment = req.fileurl,
filename = req.filename,
remark = req.remark,
......@@ -244,6 +250,7 @@ namespace Siger.ApiACC.Controllers
{
throw new BadRequestException(RequestEnum.FixtureToolNotFound);
}
var fixturetoolProduct = _automationFixtureToolsProduct.Get(f => f.fixturetools == fixturetool.guid);
var location = _autoLocationRepository.GetLocation(req.locationid.ToInt(), ProjectId);
if (location == null)
{
......@@ -263,6 +270,9 @@ namespace Siger.ApiACC.Controllers
entity.remark = req.remark;
entity.updatetime = DateTime.Now;
entity.updator = UserId;
entity.productid = fixturetoolProduct != null ? fixturetoolProduct.productid : 0;
entity.productcode = fixturetoolProduct != null ? fixturetoolProduct.productcode : "";
_autoLocationRepository.Update(entity);
if (_unitOfWork.Commit() > 0)
{
......
......@@ -35,9 +35,10 @@ namespace Siger.ApiACC.Controllers
private readonly IAutomationFixtureMonitor _automationFixtureMonitor;
private readonly IAutomationFixtureToolsProductRepository _automationFixtureToolsProduct;
private readonly IAutomationFixtureToolsRepository _automationFixtureTools;
private readonly IAutomationLocationRepository _automationLocation;
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;
_sigerProjectLevelSection = sigerProjectLevelSection;
......@@ -50,6 +51,7 @@ namespace Siger.ApiACC.Controllers
_automationFixtureMonitor = automationFixtureMonitor;
_automationFixtureToolsProduct = automationFixtureToolsProduct;
_automationFixtureTools = automationFixtureTools;
_automationLocation = automationLocation;
}
/// <summary>
......@@ -173,7 +175,7 @@ namespace Siger.ApiACC.Controllers
return new ObjectResult(result);
}
/// <summary>
/// 准备上料 -生成指令 load
/// 准备上料 -生成指令 load (立库->上料位)
/// </summary>
/// <param name="loading"></param>
/// <returns></returns>
......@@ -348,6 +350,8 @@ namespace Siger.ApiACC.Controllers
throw new BadRequestException(AccEnum.MonitorNotfound);
}
var taskNo = _automationTaskList.CrateTaskNumber(Automation.TaskTrigerType.Manual);
_automationTaskList.Insert(new siger_automation_task_list
{
......@@ -376,7 +380,6 @@ namespace Siger.ApiACC.Controllers
});
if (_unitOfWork.Commit() > 0)
{
Logger.WriteLineError($"手动任务创建成功-{Siger.Middlelayer.Common.Helpers.EnumHelper.GetEnumDesc(Automation.TaskAction.Step_SXLW_LK)}");
......
......@@ -38,5 +38,10 @@ namespace Siger.Middlelayer.Share.Constant
/// </summary>
public const string UploadloadStation = "LoadStation";
/// <summary>
/// 立库
/// </summary>
public const string WarehouseStation = "WarehouseStation";
}
}
......@@ -334,7 +334,9 @@ namespace Siger.Middlelayer.Common.ModuleEnum
[Description("设备已经生产完成")]
MachineProCompalate,
[Description("该设备当前无工装状态")]
MonitorNotfound
MonitorNotfound,
[Description("未配置字典信息")]
AutomationDictNotfound
}
public enum SeriNumCfg
......
......@@ -18,6 +18,26 @@ namespace Siger.Middlelayer.AccRepository.Entities
/// 工装GUID
/// </summary>
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>
......
......@@ -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)
{
......
......@@ -23,5 +23,13 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface
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
public int Location { 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