Commit 8c5d4f65 by yiyu.li
parents f5fa1526 ee54ef29
......@@ -2101,6 +2101,14 @@ export default {
'3000166': '未配置字典信息',
'3000167': '产线当前为自动模式',
'3000168': '该任务已经下发',
'3000169': '该储位无工件',
'3000170': '工站属性为空',
'3000171': '该储位已存在工件',
'3000172': '该工站正在上料中',
'3000173': '该工站正在下料中',
'3000174': '储位不存在',
'3000175': '工序加工未完成',
'3000176': '工序未开始加工',
'400000': '设备状态',
'400002': '更改状态',
......
......@@ -361,10 +361,10 @@ namespace Siger.ApiACC.Controllers
[HttpGet]
public IActionResult GetLocationList(string productcode, int fillsn=0)
{
var productFix = _automationFixtureToolsProduct.Get(f => f.productcode == productcode);
// var productFix = _automationFixtureToolsProduct.Get(f => f.productcode == productcode);
var locations = _autoLocationRepository.GetFulllocation(ProjectId, fillsn);
var locations = _autoLocationRepository.GetFulllocation(ProjectId, fillsn,productcode);
return new ObjectResult(locations);
//if (fillsn == 1)
//{
......
......@@ -45,10 +45,11 @@ namespace Siger.ApiACC.Controllers
private readonly IAutomationLineMode _automationLine;
private readonly IProductRouteRepository _productRoute;
private readonly IAutomationSectionPropertyRepository _sectionPropertyRepository;
private readonly IAutomationProduceHistoryRepository _automationProduceHistory;
public AutomationOperateController(IUnitOfWork unitOfWork,ISigerProjectLevelSectionRepository sigerProjectLevelSection , ISigerDict sigerDict,IAutomationMachineStatus automationMachineStatus,ISigerProjectMachineAttributionRepository sigerProjectMachineAttribution,IAutomationTaskListRepository automationTaskList,
IProductPlanDetails planDetails,IProductPlanRepository productPlan,IAutomationFixtureMonitor automationFixtureMonitor ,IAutomationFixtureToolsProductRepository automationFixtureToolsProduct,IAutomationFixtureToolsRepository automationFixtureTools, IAutomationLocationRepository automationLocation,
IAutomationLineMode automationLine, IProductRouteRepository productRoute, IAutomationSectionPropertyRepository sectionPropertyRepository)
IAutomationLineMode automationLine, IProductRouteRepository productRoute, IAutomationSectionPropertyRepository sectionPropertyRepository,IAutomationProduceHistoryRepository automationProduceHistory)
{
_unitOfWork = unitOfWork;
_sigerProjectLevelSection = sigerProjectLevelSection;
......@@ -65,6 +66,7 @@ namespace Siger.ApiACC.Controllers
_automationLine = automationLine;
_productRoute = productRoute;
_sectionPropertyRepository = sectionPropertyRepository;
_automationProduceHistory = automationProduceHistory;
}
/// <summary>
......@@ -320,7 +322,15 @@ namespace Siger.ApiACC.Controllers
{
throw new BadRequestException(AccEnum.TaskProcessing);
}
var location = _automationLocation.Get(f => f.locationid == loading.locationid);
if (location==null)
{
throw new BadRequestException(AccEnum.LocationNoExits);
}
if (!string.IsNullOrEmpty(location.sn))
{
throw new BadRequestException(AccEnum.LocationSnExits);
}
var plandts = _planDetails.Get(f => f.projectId == ProjectId && f.OrderNumber == loading.code);
if (plandts==null)
{
......@@ -543,6 +553,17 @@ namespace Siger.ApiACC.Controllers
{
throw new BadRequestException(AccEnum.LocationNoSn);
}
if (location.routeid!=0)
{
throw new BadRequestException(AccEnum.RouteProcessing);
}else
{
var historys = _automationProduceHistory.GetList(f => f.sn == location.sn);
if (!historys.Any())
{
throw new BadRequestException(AccEnum.RouteNotStart);
}
}
var levelSection = _sigerProjectLevelSection.Get(f => f.id == unloading.section);
var lineMode = _automationLine.Get(f => f.section ==levelSection.parentid);
if (lineMode==null)
......
......@@ -351,7 +351,13 @@ namespace Siger.Middlelayer.Common.ModuleEnum
[Description("该工站正在上料中")]
Uploading,
[Description("该工站正在下料中")]
Downloading
Downloading,
[Description("储位不存在")]
LocationNoExits,
[Description("工序加工未完成")]
RouteProcessing,
[Description("工序未开始加工")]
RouteNotStart
}
public enum SeriNumCfg
......
......@@ -130,6 +130,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
join pd in _context.siger_project_product on p.product_id equals pd.id
where q.projectId == projectId && d.OrderNumber == ordernumber
&& q.status == (int)RowState.Valid && t.status == (int)RowState.Valid && l.status==(int)RowState.Valid
&& string.IsNullOrEmpty(l.sn)
select new ResponsePlanlFixtureInfo
{
OrderNumber = ordernumber,
......
......@@ -101,8 +101,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
var query = from q in _context.siger_automation_location
join t in _context.siger_automation_fixture_tools on q.fixturetools equals t.guid
join c in _context.siger_automation_fixture_tools_category on t.category equals c.guid
join tp in _context.siger_automation_fixture_tools_product on t.guid equals tp.fixturetools into tptemp
from tp in tptemp.DefaultIfEmpty()
join tp in _context.siger_automation_fixture_tools_product on t.guid equals tp.fixturetools
join l in _context.siger_wms_storage_location on q.location_cid equals l.id
join w in _context.siger_wms_storage on l.storageid equals w.id
where q.projectId == projectid && q.status == (int)RowState.Valid
......@@ -122,7 +121,9 @@ namespace Siger.Middlelayer.AccRepository.Repositories
name = t.name,
materialsn = q.sn ?? "",
categoryid = c == null ? 0 : c.id,
productcode=tp!=null?tp.productcode:""
productcode=tp.productcode,
routeid=q.routeid,
route=q.route
};
Expression<Func<ResponseAutomationLocationList, bool>> locationidExpression = f => true;
if (hasMaterial != 0)
......@@ -238,67 +239,57 @@ namespace Siger.Middlelayer.AccRepository.Repositories
}
}
public IEnumerable<ResponseAutomationLocationList> GetFulllocation(int projectId,int full)
public IEnumerable<ResponseAutomationLocationList> GetFulllocation(int projectId, int full, string productCode)
{
//获取有SN 的储位
if (full==1)
var query = from q in _context.siger_automation_location
join t in _context.siger_automation_fixture_tools on q.fixturetools equals t.guid
join tp in _context.siger_automation_fixture_tools_product on t.guid equals tp.fixturetools
join l in _context.siger_wms_storage_location on q.location_cid equals l.id
join w in _context.siger_wms_storage on l.storageid equals w.id
join r in _context.siger_project_product_route on q.routeid equals r.id into rtemp
from r in rtemp.DefaultIfEmpty()
where q.projectId == projectId
&& q.status == (int)RowState.Valid && t.status == (int)RowState.Valid
&& l.status == (int)RowState.Valid && w.status == (int)RowState.Valid
select new ResponseAutomationLocationList
{
id = q.id,
typeid = t.id,
fixtureguid = t.guid,
locationid = l.locationid,
location = l.realname,
locationcode = l.serial_number,
wavehouseid = w.id,
wavehouse = w.name,
wavehousecode = w.serial_number,
fixturetoolid = t.id,
code = t.code,
name = t.name,
materialsn = q.sn,
productcode = tp.productcode,
routeid = q.routeid,
route = r!=null?r.name:""
};
Expression<Func<ResponseAutomationLocationList, bool>> locationidFullExpression = f => true;
if (full == 1)
{
var query = from q in _context.siger_automation_location
join t in _context.siger_automation_fixture_tools on q.fixturetools equals t.guid
join l in _context.siger_wms_storage_location on q.location_cid equals l.id
join w in _context.siger_wms_storage on l.storageid equals w.id
where q.projectId == projectId && !string.IsNullOrEmpty(q.sn)
&& q.status == (int)RowState.Valid&& t.status == (int)RowState.Valid
&& l.status == (int)RowState.Valid && w.status == (int)RowState.Valid
&& q.routeid==0
select new ResponseAutomationLocationList
{
id = q.id,
typeid = t.id,
fixtureguid = t.guid,
locationid = l.locationid,
location = l.realname,
locationcode = l.serial_number,
wavehouseid = w.id,
wavehouse = w.name,
wavehousecode = w.serial_number,
fixturetoolid = t.id,
code = t.code,
name = t.name,
materialsn = q.sn
};
Expression<Func<ResponseAutomationLocationList, bool>> locationidExpression = f => true;
return query.Where(locationidExpression);
locationidFullExpression = f => !string.IsNullOrEmpty(f.materialsn);
}else
{
//选择SN为空的储位
var query = from q in _context.siger_automation_location
join t in _context.siger_automation_fixture_tools on q.fixturetools equals t.guid
join l in _context.siger_wms_storage_location on q.location_cid equals l.id
join w in _context.siger_wms_storage on l.storageid equals w.id
where q.projectId == projectId && string.IsNullOrEmpty(q.sn)
&& q.status == (int)RowState.Valid && t.status == (int)RowState.Valid
&& l.status == (int)RowState.Valid&& w.status == (int)RowState.Valid
select new ResponseAutomationLocationList
{
id = q.id,
typeid = t.id,
fixtureguid = t.guid,
locationid = l.locationid,
location = l.realname,
locationcode = l.serial_number,
wavehouseid = w.id,
wavehouse = w.name,
wavehousecode = w.serial_number,
fixturetoolid = t.id,
code = t.code,
name = t.name,
materialsn = q.sn
};
Expression<Func<ResponseAutomationLocationList, bool>> locationidExpression = f => true;
return query.Where(locationidExpression);
locationidFullExpression = f => string.IsNullOrEmpty(f.materialsn);
}
Expression<Func<ResponseAutomationLocationList, bool>> productExpression = f => true;
if (!string.IsNullOrEmpty(productCode))
{
productExpression = f => f.productcode.Contains(productCode);
}
var expression = locationidFullExpression.And(productExpression);
return query.Where(expression);
}
}
}
......@@ -26,6 +26,6 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface
CommonImportResult ImportData(IEnumerable<AutomationLocationTemplate> list, int projectid, int userid);
IEnumerable<ResponseAutomationLocationList> GetFulllocation(int projectId, int full);
IEnumerable<ResponseAutomationLocationList> GetFulllocation(int projectId, int full,string productcode);
}
}
......@@ -105,5 +105,7 @@ namespace Siger.Middlelayer.AccRepository.Response
public int categoryid { get; set; }
//产品CODE
public string productcode { get; set; }
public int routeid { get; set; }
public string route { 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