Commit b7db37a4 by yiyu.li
parents 4e299047 9d78ae09
...@@ -654,7 +654,6 @@ export default { ...@@ -654,7 +654,6 @@ export default {
}); });
}, },
linechange(i) { linechange(i) {
console.log(1111111111);
this.a = i; this.a = i;
this.line = this.lineList[i]; this.line = this.lineList[i];
this.initstations(this.line.id); this.initstations(this.line.id);
...@@ -672,7 +671,7 @@ export default { ...@@ -672,7 +671,7 @@ export default {
axios axios
.request({ .request({
url: url:
"http://localhost:8105/acc/SectionProperty/GetSections" "/acc/SectionProperty/GetSections"
, ,
params, params,
method: "get", method: "get",
...@@ -715,6 +714,22 @@ export default { ...@@ -715,6 +714,22 @@ export default {
this.b = i; this.b = i;
this.station = this.stationList[i]; this.station = this.stationList[i];
this.initproduct(this.station.id); this.initproduct(this.station.id);
this.initSn(this.station.id)
},
initSn(sectionid){
if (sectionid > 0) {
axios
.request({
url:
"/acc/SectionProperty/GetSn?productId=" + productid + "&sectionId=" + sectionid,
method: "get",
})
.then((res) => {
if (res.data.ret === 1) {
this.qrcode = res.data.data;
}
});
}
}, },
productchange(i) { productchange(i) {
this.c = i; this.c = i;
...@@ -730,7 +745,7 @@ export default { ...@@ -730,7 +745,7 @@ export default {
axios axios
.request({ .request({
url: url:
"/acc/SectionProperty/GetRouteByProduct?productId=" + productid, "/acc/SectionProperty/GetRouteByProduct?productId=" + productid + "&sectionId=" + sectionid,
method: "get", method: "get",
}) })
.then((res) => { .then((res) => {
......
...@@ -231,7 +231,7 @@ export default { ...@@ -231,7 +231,7 @@ export default {
page: this.page, page: this.page,
pageSize: this.pagesize, pageSize: this.pagesize,
id: this.whid, // 仓库id id: this.whid, // 仓库id
isWarehouse: 1, isWavehouse: 1,
}; };
this.detailobj = {}; this.detailobj = {};
this.request("/wms/Location/GetLocationList", data, "get").then( this.request("/wms/Location/GetLocationList", data, "get").then(
......
...@@ -309,7 +309,7 @@ export default { ...@@ -309,7 +309,7 @@ export default {
this.storageList1 = []; this.storageList1 = [];
this.addstorageid = ""; this.addstorageid = "";
if(value != undefined){ if(value != undefined){
this.warehouseid = value.value; this.addwarehouseid = value.value;
this.addinitStorage(); this.addinitStorage();
} }
}, },
...@@ -460,6 +460,14 @@ export default { ...@@ -460,6 +460,14 @@ export default {
}, },
add(){ add(){
this.type = 1; this.type = 1;
this.initFrockType();//工装类型
this.addstorageid = '';//仓库id
this.parentType = [];//工装类型
this.parentTypeid = '';//工装类型id
this.addfrockid = '';//工装id
this.addremark = '';//备注
this.filename = '';
this.fileurl = '';
this.addmodal = true; this.addmodal = true;
}, },
/*********文件上传 start******** */ /*********文件上传 start******** */
......
...@@ -28,9 +28,10 @@ namespace Siger.ApiACC.Controllers ...@@ -28,9 +28,10 @@ namespace Siger.ApiACC.Controllers
private readonly ISigerDict _sigerDict; private readonly ISigerDict _sigerDict;
private readonly IAutomationTaskListRepository _automationTaskList; private readonly IAutomationTaskListRepository _automationTaskList;
private readonly ISigerProjectMachineAttributionRepository _sigerProjectMachineAttribution; private readonly ISigerProjectMachineAttributionRepository _sigerProjectMachineAttribution;
private readonly IAutomationFixtureMonitor _automationFixtureMonitor;
public AutomationController(IUnitOfWork unitOfWork,ISigerProjectLevelSectionRepository sigerProjectLevelSection,IAutomationLineMode automationLineMode,IAutomationMachineStatus automationMachineStatus,ISigerDict sigerDict,IAutomationTaskListRepository automationTaskList, public AutomationController(IUnitOfWork unitOfWork,ISigerProjectLevelSectionRepository sigerProjectLevelSection,IAutomationLineMode automationLineMode,IAutomationMachineStatus automationMachineStatus,ISigerDict sigerDict,IAutomationTaskListRepository automationTaskList,
ISigerProjectMachineAttributionRepository sigerProjectMachineAttribution) ISigerProjectMachineAttributionRepository sigerProjectMachineAttribution, IAutomationFixtureMonitor automationFixtureMonitor)
{ {
_unitOfWork = unitOfWork; _unitOfWork = unitOfWork;
_sigerProjectLevelSection = sigerProjectLevelSection; _sigerProjectLevelSection = sigerProjectLevelSection;
...@@ -39,6 +40,7 @@ namespace Siger.ApiACC.Controllers ...@@ -39,6 +40,7 @@ namespace Siger.ApiACC.Controllers
_sigerDict = sigerDict; _sigerDict = sigerDict;
_automationTaskList = automationTaskList; _automationTaskList = automationTaskList;
_sigerProjectMachineAttribution = sigerProjectMachineAttribution; _sigerProjectMachineAttribution = sigerProjectMachineAttribution;
_automationFixtureMonitor = automationFixtureMonitor;
} }
/// <summary> /// <summary>
...@@ -181,7 +183,7 @@ namespace Siger.ApiACC.Controllers ...@@ -181,7 +183,7 @@ namespace Siger.ApiACC.Controllers
public IActionResult TaskResult([FromBody]RequestAutomationTaskResult request) public IActionResult TaskResult([FromBody]RequestAutomationTaskResult request)
{ {
//1.检查Tasklist //1.检查Tasklist
var taskObj = _automationTaskList.Get(f => f.guid == request.guid); var taskObj = _automationTaskList.Get(f => f.no== request.guid);
if (taskObj == null) if (taskObj == null)
{ {
throw new BadRequestException(CommonEnum.RecordNotFound); throw new BadRequestException(CommonEnum.RecordNotFound);
...@@ -311,8 +313,28 @@ namespace Siger.ApiACC.Controllers ...@@ -311,8 +313,28 @@ namespace Siger.ApiACC.Controllers
} }
} }
/// <summary>
/// 创建自动任务
/// </summary>
/// <param name="machineStatus"></param>
/// <param name="actionType"></param>
/// <param name="taskAction"></param>
void CreateTask(siger_automation_machine_status machineStatus,TaskActionType actionType, TaskAction taskAction) void CreateTask(siger_automation_machine_status machineStatus,TaskActionType actionType, TaskAction taskAction)
{ {
//j检查工装监控状态
var monitor = _automationFixtureMonitor.Get(f => f.section == machineStatus.section);
if (monitor==null)
{
Logger.WriteLineInfo($"CreateTask 工装监控状态无数据,请确认业务链正确 ");
return;
}
if (monitor.section==0)
{
Logger.WriteLineInfo($"CreateTask 工装监控状态无当前工站信息,请确认业务链正确 ");
return;
}
_automationTaskList.Insert(new siger_automation_task_list _automationTaskList.Insert(new siger_automation_task_list
{ {
...@@ -328,9 +350,16 @@ namespace Siger.ApiACC.Controllers ...@@ -328,9 +350,16 @@ namespace Siger.ApiACC.Controllers
send = 0, send = 0,
operater = 0, operater = 0,
status = 1, status = 1,
fixtureguid=monitor.fixtureguid,
productcode=monitor.productCode,
locationid=monitor.locationId,
ordercode=monitor.ordernumber,
sn=monitor.sn,
remark="自动任务" remark="自动任务"
}); });
if (_unitOfWork.Commit() > 0) if (_unitOfWork.Commit() > 0)
Logger.WriteLineInfo($"CreateTask 工站 完成"); Logger.WriteLineInfo($"CreateTask 工站 完成");
else else
......
...@@ -23,22 +23,76 @@ namespace Siger.ApiACC.Controllers ...@@ -23,22 +23,76 @@ namespace Siger.ApiACC.Controllers
private readonly IAutomationFixtureToolsCategoryRepository _toolsCategoryRepository; private readonly IAutomationFixtureToolsCategoryRepository _toolsCategoryRepository;
private readonly IAutomationFixtureToolsRepository _toolsRepository; private readonly IAutomationFixtureToolsRepository _toolsRepository;
private readonly IAutomationLocationRepository _autoLocationRepository; private readonly IAutomationLocationRepository _autoLocationRepository;
private readonly IAutomationFixtureMonitor _fixtureMonitor;
private readonly IProductRouteRepository _routeRepository;
public AutomationLocationController(IUnitOfWork unitOfWork, IAutomationFixtureToolsCategoryRepository toolsCategoryRepository, public AutomationLocationController(IUnitOfWork unitOfWork, IAutomationFixtureToolsCategoryRepository toolsCategoryRepository,
IAutomationFixtureToolsRepository toolsRepository, IAutomationLocationRepository autoLocationRepository) IAutomationFixtureToolsRepository toolsRepository, IAutomationLocationRepository autoLocationRepository,
IAutomationFixtureMonitor fixtureMonitor, IProductRouteRepository routeRepository)
{ {
_unitOfWork = unitOfWork; _unitOfWork = unitOfWork;
_toolsCategoryRepository = toolsCategoryRepository; _toolsCategoryRepository = toolsCategoryRepository;
_toolsRepository = toolsRepository; _toolsRepository = toolsRepository;
_autoLocationRepository = autoLocationRepository; _autoLocationRepository = autoLocationRepository;
_fixtureMonitor = fixtureMonitor;
_routeRepository = routeRepository;
} }
public IActionResult GetPageList(string wavehouseid, string locationid, int page, int pagesize) public IActionResult GetPageList(string wavehouseid, string locationid, int page, int pagesize)
{ {
var data = _autoLocationRepository.GetPagedList(wavehouseid.ToInt(), locationid.ToInt(), ProjectId, page, pagesize); var data = _autoLocationRepository.GetPagedList(wavehouseid.ToInt(), locationid.ToInt(), ProjectId, page, pagesize);
var list = new List<ResponseAutomationLocation>();
var locations = _autoLocationRepository.GetLocationList(ProjectId);
foreach(var item in data.Data)
{
if(item.fixturetoolid > 0 && string.IsNullOrEmpty(item.sn))
{
item.materialstate = 1;//有工装无工件
}
else if(item.fixturetoolid > 0 && !string.IsNullOrEmpty(item.sn))
{
item.materialstate = 2;//有工装有工件
}
else if (item.fixturetoolid <= 0 && string.IsNullOrEmpty(item.sn))
{
item.materialstate = 3;//无工装无工件
}
else if (item.fixturetoolid <= 0 && string.IsNullOrEmpty(item.sn))
{
item.materialstate = 4;//无工装有工件
}
var monitor = _fixtureMonitor.GetList(q => q.projectId == ProjectId && q.status == (int)RowState.Valid && q.locationId == item.locationid).
OrderByDescending(q => q.updatetime).FirstOrDefault();
if(monitor != null)
{
item.sn = monitor.sn;
var route = _routeRepository.Get(q => q.id == monitor.route && q.projectId == ProjectId && q.status == (int)RowState.Valid);
if(route != null)
{
item.route = route.name;
item.routenumber = route.serialNumber.ToString();
}
}
var loca = locations.FirstOrDefault(q => q.locationid == item.locaid);
if(loca != null)
{
var locas = GetParentLocations(loca.id, locations);
var locationIds = locas.Select(q => q.id).ToList();
locationIds.Distinct().Reverse();
item.locationIds = locationIds;
}
}
return new PagedObjectResult(data.Data, data.Total, page, pagesize); return new PagedObjectResult(data.Data, data.Total, page, pagesize);
} }
private IEnumerable<siger_wms_storage_location> GetParentLocations(int pid, IEnumerable<siger_wms_storage_location> types)
{
var query = from c in types where c.id == pid select c;
return query.ToList().Concat(query.ToList().SelectMany(t => GetParentLocations(t.parentid, types)));
}
[HttpPost] [HttpPost]
public IActionResult Add([FromBody]RequestAddAutomationLocation req) public IActionResult Add([FromBody]RequestAddAutomationLocation req)
{ {
...@@ -66,7 +120,7 @@ namespace Siger.ApiACC.Controllers ...@@ -66,7 +120,7 @@ namespace Siger.ApiACC.Controllers
var entity = new siger_automation_location var entity = new siger_automation_location
{ {
guid = Guid.NewGuid().ToString(), guid = Guid.NewGuid().ToString(),
locationid = req.locationid.ToInt(), locationid = location.locationid,
fixturetools = fixturetool.guid, fixturetools = fixturetool.guid,
attachment = req.fileurl, attachment = req.fileurl,
filename = req.filename, filename = req.filename,
...@@ -115,7 +169,7 @@ namespace Siger.ApiACC.Controllers ...@@ -115,7 +169,7 @@ namespace Siger.ApiACC.Controllers
throw new BadRequestException(RequestEnum.DataExist); throw new BadRequestException(RequestEnum.DataExist);
} }
entity.locationid = req.locationid.ToInt(); entity.locationid = location.locationid;
entity.fixturetools = fixturetool.guid; entity.fixturetools = fixturetool.guid;
entity.attachment = req.fileurl; entity.attachment = req.fileurl;
entity.filename = req.filename; entity.filename = req.filename;
......
...@@ -33,9 +33,10 @@ namespace Siger.ApiACC.Controllers ...@@ -33,9 +33,10 @@ namespace Siger.ApiACC.Controllers
private readonly IProductPlanRepository _productPlan; private readonly IProductPlanRepository _productPlan;
private readonly IAutomationFixtureMonitor _automationFixtureMonitor; private readonly IAutomationFixtureMonitor _automationFixtureMonitor;
private readonly IAutomationFixtureToolsProductRepository _automationFixtureToolsProduct; private readonly IAutomationFixtureToolsProductRepository _automationFixtureToolsProduct;
private readonly IAutomationFixtureToolsRepository _automationFixtureTools;
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) IProductPlanDetails planDetails,IProductPlanRepository productPlan,IAutomationFixtureMonitor automationFixtureMonitor ,IAutomationFixtureToolsProductRepository automationFixtureToolsProduct,IAutomationFixtureToolsRepository automationFixtureTools)
{ {
_unitOfWork = unitOfWork; _unitOfWork = unitOfWork;
_sigerProjectLevelSection = sigerProjectLevelSection; _sigerProjectLevelSection = sigerProjectLevelSection;
...@@ -47,6 +48,7 @@ namespace Siger.ApiACC.Controllers ...@@ -47,6 +48,7 @@ namespace Siger.ApiACC.Controllers
_productPlan = productPlan; _productPlan = productPlan;
_automationFixtureMonitor = automationFixtureMonitor; _automationFixtureMonitor = automationFixtureMonitor;
_automationFixtureToolsProduct = automationFixtureToolsProduct; _automationFixtureToolsProduct = automationFixtureToolsProduct;
_automationFixtureTools = automationFixtureTools;
} }
/// <summary> /// <summary>
...@@ -159,7 +161,7 @@ namespace Siger.ApiACC.Controllers ...@@ -159,7 +161,7 @@ namespace Siger.ApiACC.Controllers
var result = _automationFixtureToolsProduct.GetPlanFixtureInfo(ProjectId, code); var result = _automationFixtureToolsProduct.GetPlanFixtureInfo(ProjectId, code);
if (result==null) if (result==null)
{ {
throw new BadRequestException(CncEnum.PlanHasExist); throw new BadRequestException(AccEnum.FixtureOrderNulll);
} }
var sn = _automationTaskList.CreateRandonSn(result.ProductCode); var sn = _automationTaskList.CreateRandonSn(result.ProductCode);
result.Sn = sn; result.Sn = sn;
...@@ -208,7 +210,8 @@ namespace Siger.ApiACC.Controllers ...@@ -208,7 +210,8 @@ namespace Siger.ApiACC.Controllers
throw new BadRequestException(CncEnum.PlanHasExist); throw new BadRequestException(CncEnum.PlanHasExist);
} }
//检查工装 //检查工装
var fixtureToolsObj = _automationFixtureToolsProduct.GetFixtureInfoByProductCode(ProjectId, plan.product_code); var fixtureToolsObj = _automationFixtureTools.GetProductFixtureLocation(ProjectId,loading.guid);
//var fixtureToolsObj = _automationFixtureToolsProduct.GetFixtureInfoByProductCode(ProjectId, plan.product_code);
if (fixtureToolsObj == null) if (fixtureToolsObj == null)
{ {
throw new BadRequestException(AccEnum.FixtureToolsIsNone); throw new BadRequestException(AccEnum.FixtureToolsIsNone);
......
...@@ -37,9 +37,32 @@ namespace Siger.ApiACC.Controllers ...@@ -37,9 +37,32 @@ namespace Siger.ApiACC.Controllers
public IActionResult GetPageList(string category, string code, string name, int page, int pagesize) public IActionResult GetPageList(string category, string code, string name, int page, int pagesize)
{ {
var data = _toolsAssemblyRepository.GetPagedList(category.ToInt(), code, name, ProjectId, page, pagesize); var data = _toolsAssemblyRepository.GetPagedList(category.ToInt(), code, name, ProjectId, page, pagesize);
var categorys = _toolsCategoryRepository.GetList(q => q.projectId == ProjectId && q.status == (int)RowState.Valid).ToList();
var list = new List<ResponseAumationFixtureToolsAssembly>();
foreach(var item in data.Data)
{
var cates = GetParentCategoryList(item.cate_guid, categorys);
var cateIds = cates.Select(q => q.id).ToList();
cateIds.Reverse();
item.categoryids = cateIds;
var parentcates = GetParentCategoryList(item.parentcate_guid, categorys);
var parentcateIds = parentcates.Select(q => q.id).ToList();
parentcateIds.Reverse();
item.parentcategoryids = parentcateIds;
list.Add(item);
}
return new PagedObjectResult(data.Data, data.Total, page, pagesize); return new PagedObjectResult(data.Data, data.Total, page, pagesize);
} }
private IEnumerable<siger_automation_fixture_tools_category> GetParentCategoryList(string parentId, List<siger_automation_fixture_tools_category> sections)
{
var query = from c in sections where c.guid == parentId select c;
return query.ToList().Concat(query.ToList().SelectMany(t => GetParentCategoryList(t.parent, sections)));
}
[HttpGet] [HttpGet]
public IActionResult GetDetail(string id) public IActionResult GetDetail(string id)
{ {
......
...@@ -191,23 +191,6 @@ namespace Siger.ApiACC.Controllers ...@@ -191,23 +191,6 @@ namespace Siger.ApiACC.Controllers
throw new BadRequestException(CommonEnum.Fail); throw new BadRequestException(CommonEnum.Fail);
} }
[HttpGet]
public IActionResult GetFxitureTooolList()
{
var list = _toolsRepository.GetList(q => q.projectId == ProjectId && q.status == (int)RowState.Valid).Select(
q => new
{
q.id,
q.code,
q.partnumber,
q.name,
q.specification,
q.number
}).ToList();
return new ObjectResult(list);
}
[HttpGet] [HttpGet]
...@@ -370,5 +353,13 @@ namespace Siger.ApiACC.Controllers ...@@ -370,5 +353,13 @@ namespace Siger.ApiACC.Controllers
} }
return resp; return resp;
} }
[HttpGet]
public IActionResult GetFixtureToolList()
{
var list = _toolsRepository.GetDataList(ProjectId);
return new ObjectResult(list);
}
} }
} }
...@@ -72,6 +72,7 @@ namespace Siger.ApiACC.Controllers ...@@ -72,6 +72,7 @@ namespace Siger.ApiACC.Controllers
fixturetools = fixtureTool.guid, fixturetools = fixtureTool.guid,
remark = req.remark, remark = req.remark,
productid = req.productid.ToInt(), productid = req.productid.ToInt(),
productcode = product.code,
projectId = ProjectId, projectId = ProjectId,
createtime = DateTime.Now, createtime = DateTime.Now,
updatetime = DateTime.Now, updatetime = DateTime.Now,
...@@ -123,6 +124,7 @@ namespace Siger.ApiACC.Controllers ...@@ -123,6 +124,7 @@ namespace Siger.ApiACC.Controllers
entity.fixturetools = fixtureTool.guid; entity.fixturetools = fixtureTool.guid;
entity.remark = req.remark; entity.remark = req.remark;
entity.productid = req.productid.ToInt(); entity.productid = req.productid.ToInt();
entity.productcode = product.code;
entity.updatetime = DateTime.Now; entity.updatetime = DateTime.Now;
entity.updator = UserId; entity.updator = UserId;
entity.filename = req.filename; entity.filename = req.filename;
......
...@@ -23,14 +23,17 @@ namespace Siger.ApiACC.Controllers ...@@ -23,14 +23,17 @@ namespace Siger.ApiACC.Controllers
private readonly IAutomationSectionPropertyRepository _sectionPropertyRepository; private readonly IAutomationSectionPropertyRepository _sectionPropertyRepository;
private readonly ISigerProjectLevelSectionRepository _levelSectionRepository; private readonly ISigerProjectLevelSectionRepository _levelSectionRepository;
private readonly IProductionBeatSetRepository _beatSetRepository; private readonly IProductionBeatSetRepository _beatSetRepository;
private readonly IAutomationFixtureMonitor _fixtureMonitor;
public SectionPropertyController(IUnitOfWork unitOfWork, IAutomationSectionPropertyRepository sectionPropertyRepository, public SectionPropertyController(IUnitOfWork unitOfWork, IAutomationSectionPropertyRepository sectionPropertyRepository,
ISigerProjectLevelSectionRepository levelSectionRepository, IProductionBeatSetRepository beatSetRepository) ISigerProjectLevelSectionRepository levelSectionRepository, IProductionBeatSetRepository beatSetRepository,
IAutomationFixtureMonitor fixtureMonitor)
{ {
_unitOfWork = unitOfWork; _unitOfWork = unitOfWork;
_sectionPropertyRepository = sectionPropertyRepository; _sectionPropertyRepository = sectionPropertyRepository;
_levelSectionRepository = levelSectionRepository; _levelSectionRepository = levelSectionRepository;
_beatSetRepository = beatSetRepository; _beatSetRepository = beatSetRepository;
_fixtureMonitor = fixtureMonitor;
} }
[HttpGet] [HttpGet]
...@@ -44,10 +47,11 @@ namespace Siger.ApiACC.Controllers ...@@ -44,10 +47,11 @@ namespace Siger.ApiACC.Controllers
return new ObjectResult(sections); return new ObjectResult(sections);
} }
public IActionResult GetRouteByProduct(string productId) [HttpGet]
public IActionResult GetRouteByProduct(string productId, int sectionId)
{ {
var list = _beatSetRepository.GetList(q => q.projectID == ProjectId && q.status == (int)RowState.Valid && q.product_name.ToInt() == productId.ToInt()). var list = _beatSetRepository.GetList(q => q.projectID == ProjectId && q.status == (int)RowState.Valid && q.product_name.ToInt() == productId.ToInt() &&
Select(q => new q.section_id == sectionId).Select(q => new
{ {
q.id, q.id,
name = q.route_name, name = q.route_name,
...@@ -56,5 +60,13 @@ namespace Siger.ApiACC.Controllers ...@@ -56,5 +60,13 @@ namespace Siger.ApiACC.Controllers
return new ObjectResult(list); return new ObjectResult(list);
} }
[HttpGet]
public IActionResult GetSn(int sectionid)
{
var monitor = _fixtureMonitor.GetList(q => q.projectId == ProjectId && q.status == (int)RowState.Valid && q.section == sectionid).OrderByDescending(q => q.updatetime).
FirstOrDefault();
return new ObjectResult(monitor?.sn ?? "");
}
} }
} }
...@@ -1127,5 +1127,67 @@ namespace Siger.ApiWMS.Controllers ...@@ -1127,5 +1127,67 @@ namespace Siger.ApiWMS.Controllers
return query.ToList().Concat(query.ToList().SelectMany(t => GetSonTypes(t.id, types))); return query.ToList().Concat(query.ToList().SelectMany(t => GetSonTypes(t.id, types)));
} }
[HttpGet]
public IActionResult GetLocationTree(int warehouseid)
{
var locationTypes = locationtype.GetList(q => q.projectid == ProjectId && q.status == (int)RowState.Valid).ToList();
var sonLocationTypes = GetSonTypes(0, locationTypes).ToList();
var lastLocationId = sonLocationTypes.LastOrDefault()?.id ?? 0;
var allLocas = location.GetList(q => q.projectid == ProjectId && q.status == (int)RowState.Valid).ToList();
var locations = allLocas.Where(q => q.typeid == lastLocationId);
if(warehouseid > 0)
{
locations = locations.Where(q => q.storageid == warehouseid);
}
var locationTreeList = new List<LevelSectionTree>();
foreach(var loca in locations)
{
var locas = GetParentLocations(loca.id, allLocas.Select(q => new LevelSectionTree
{
id = q.id,
pid = q.parentid,
title = q.realname,
name = q.realname
}));
locationTreeList.AddRange(locas);
}
var locationTree = locationTreeList.GroupBy(q => q.id).Select(q => q.FirstOrDefault()).ToList();
return new ObjectResult(ConvertToTree(locationTree));
}
private IEnumerable<LevelSectionTree> GetParentLocations(int pid, IEnumerable<LevelSectionTree> types)
{
var query = from c in types where c.id == pid select c;
return query.ToList().Concat(query.ToList().SelectMany(t => GetParentLocations(t.pid, types)));
}
private IList<LevelSectionTree> ConvertToTree(IEnumerable<LevelSectionTree> models)
{
var section = new Dictionary<int, LevelSectionTree>();
foreach (var item in models)
{
section.Add(item.id, item);
}
var result = new List<LevelSectionTree>();
foreach (var item in section.Values)
{
if (item.pid == 0)
{
result.Add(item);
}
else
{
if (section.ContainsKey(item.pid))
{
section[item.pid].AddChilrden(item);
}
}
}
return result;
}
} }
} }
\ No newline at end of file
...@@ -327,6 +327,8 @@ namespace Siger.Middlelayer.Common.ModuleEnum ...@@ -327,6 +327,8 @@ namespace Siger.Middlelayer.Common.ModuleEnum
TaskProcessing, TaskProcessing,
[Description("产品工装未找到")] [Description("产品工装未找到")]
FixtureToolsIsNone, FixtureToolsIsNone,
[Description("未找到工装信息")]
FixtureOrderNulll
} }
public enum SeriNumCfg public enum SeriNumCfg
......
...@@ -25,6 +25,10 @@ namespace Siger.Middlelayer.AccRepository.Entities ...@@ -25,6 +25,10 @@ namespace Siger.Middlelayer.AccRepository.Entities
/// 更新时间 /// 更新时间
/// </summary> /// </summary>
public DateTime updatetime { get; set; } public DateTime updatetime { get; set; }
/// <summary>
/// 程序号
/// </summary>
public string program { get; set; }
} }
} }
...@@ -40,6 +40,10 @@ namespace Siger.Middlelayer.AccRepository.Entities ...@@ -40,6 +40,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>
/// 工序ID /// 工序ID
/// </summary> /// </summary>
public int processid { get; set; } public int processid { get; set; }
......
...@@ -48,7 +48,9 @@ namespace Siger.Middlelayer.AccRepository.Repositories ...@@ -48,7 +48,9 @@ namespace Siger.Middlelayer.AccRepository.Repositories
filename = q.filename, filename = q.filename,
categoryid = c2.id, categoryid = c2.id,
category = c2.name, category = c2.name,
updatetime = q.updatetime.HasValue && q.updatetime > DateTime.MinValue ? q.updatetime.Value.ToString(ParameterConstant.DateTimeFormat) : "" updatetime = q.updatetime.HasValue && q.updatetime > DateTime.MinValue ? q.updatetime.Value.ToString(ParameterConstant.DateTimeFormat) : "",
cate_guid = t2.guid,
parentcate_guid = t1.guid
}; };
Expression<Func<ResponseAumationFixtureToolsAssembly, bool>> categoryExpression = f => true; Expression<Func<ResponseAumationFixtureToolsAssembly, bool>> categoryExpression = f => true;
if (category > 0) if (category > 0)
......
...@@ -97,9 +97,10 @@ namespace Siger.Middlelayer.AccRepository.Repositories ...@@ -97,9 +97,10 @@ namespace Siger.Middlelayer.AccRepository.Repositories
{ {
OrderNumber = ordernumber, OrderNumber = ordernumber,
ProductName = p.product_name, ProductName = p.product_name,
FixtureName=t.name,
ProductCode = q.productcode, FixtureGuid=t.guid,
Location = l.locationid, ProductCode =q!=null? q.productcode:"",
Location =l!=null? l.locationid:0,
}; };
return query.FirstOrDefault(); return query.FirstOrDefault();
} }
......
using System; using System;
using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Linq.Expressions; using System.Linq.Expressions;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
...@@ -73,5 +74,45 @@ namespace Siger.Middlelayer.AccRepository.Repositories ...@@ -73,5 +74,45 @@ namespace Siger.Middlelayer.AccRepository.Repositories
var totalCount = query.Where(expression).Count(); var totalCount = query.Where(expression).Count();
return new PagedCollectionResult<ResponseFixtureTools>(entities, totalCount); return new PagedCollectionResult<ResponseFixtureTools>(entities, totalCount);
} }
public IEnumerable<ResponseFixtureTools> GetDataList(int projectid)
{
var query = from q in _context.siger_automation_fixture_tools
join p in _context.siger_automation_fixture_tools_category on q.category equals p.guid
where q.projectId == projectid && q.status == (int)RowState.Valid
select new ResponseFixtureTools
{
id = q.id,
name = q.name,
guid = q.guid,
cate_guid = p.guid,
categoryid = p.id,
category = p.name,
managetype = q.managetype,
partnumber = q.partnumber,
specification = q.specification,
number = q.number,
remark = q.remark,
code = q.code,
status = q.status,
updatetime = q.updatetime.HasValue && q.updatetime > DateTime.MinValue ? q.updatetime.Value.ToString(ParameterConstant.DateTimeFormat) : ""
};
var entities = query.OrderByDescending(q => q.id).AsNoTracking().ToList();
return entities;
}
public ResponseProductFixtureInfo GetProductFixtureLocation(int projectId, string guid)
{
var query = from q in _context.siger_automation_fixture_tools
join l in _context.siger_automation_location on q.guid equals l.guid
select new ResponseProductFixtureInfo
{
FixtureGuid=q.guid,
FixtureId=q.id,
Location=l.locationid
};
return query.FirstOrDefault();
}
} }
} }
...@@ -35,6 +35,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories ...@@ -35,6 +35,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
{ {
id = q.id, id = q.id,
locationid = l.id, locationid = l.id,
locaid = q.locationid,
location = l.name, location = l.name,
wavehouseid = w.id, wavehouseid = w.id,
wavehouse = w.name, wavehouse = w.name,
...@@ -68,7 +69,12 @@ namespace Siger.Middlelayer.AccRepository.Repositories ...@@ -68,7 +69,12 @@ namespace Siger.Middlelayer.AccRepository.Repositories
public siger_wms_storage_location GetLocation(int id, int projectid) public siger_wms_storage_location GetLocation(int id, int projectid)
{ {
return _context.siger_wms_storage_location.FirstOrDefault(q => q.locationid == id && q.projectId == projectid && q.status == (int)RowState.Valid); return _context.siger_wms_storage_location.FirstOrDefault(q => q.id == id && q.projectId == projectid && q.status == (int)RowState.Valid);
}
public IEnumerable<siger_wms_storage_location> GetLocationList(int projectid)
{
return _context.siger_wms_storage_location.Where(q => q.projectId == projectid && q.status == (int)RowState.Valid);
} }
public IEnumerable<ResponseAutomationLocationList> GetDataList(int projectid) public IEnumerable<ResponseAutomationLocationList> GetDataList(int projectid)
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
using Siger.Middlelayer.AccRepository.Response; using Siger.Middlelayer.AccRepository.Response;
using Siger.Middlelayer.Repository.Data.Acc; using Siger.Middlelayer.Repository.Data.Acc;
using Siger.Middlelayer.Repository.Paged; using Siger.Middlelayer.Repository.Paged;
using System.Collections.Generic;
namespace Siger.Middlelayer.AccRepository.Repositories.Interface namespace Siger.Middlelayer.AccRepository.Repositories.Interface
{ {
...@@ -9,5 +10,9 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface ...@@ -9,5 +10,9 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface
{ {
IPagedCollectionResult<ResponseFixtureTools> GetPagedList(int category, string code, string name, int state, IPagedCollectionResult<ResponseFixtureTools> GetPagedList(int category, string code, string name, int state,
int projectid, int page, int pagesize); int projectid, int page, int pagesize);
IEnumerable<ResponseFixtureTools> GetDataList(int projectid);
ResponseProductFixtureInfo GetProductFixtureLocation(int projectId, string guid);
} }
} }
...@@ -14,5 +14,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface ...@@ -14,5 +14,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface
siger_wms_storage_location GetLocation(int id, int projectid); siger_wms_storage_location GetLocation(int id, int projectid);
IEnumerable<ResponseAutomationLocationList> GetDataList(int projectid); IEnumerable<ResponseAutomationLocationList> GetDataList(int projectid);
IEnumerable<siger_wms_storage_location> GetLocationList(int projectid);
} }
} }
...@@ -19,5 +19,6 @@ namespace Siger.Middlelayer.AccRepository.Request ...@@ -19,5 +19,6 @@ namespace Siger.Middlelayer.AccRepository.Request
/// 完成状态 /// 完成状态
/// </summary> /// </summary>
public int status { get; set; } public int status { get; set; }
} }
} }
...@@ -11,6 +11,11 @@ namespace Siger.Middlelayer.AccRepository.Request ...@@ -11,6 +11,11 @@ namespace Siger.Middlelayer.AccRepository.Request
{ {
public int section { get; set; } public int section { get; set; }
public string code { get; set; } public string code { get; set; }
/// <summary>
/// 工装GUID
/// </summary>
public string guid { get; set; }
} }
/// <summary> /// <summary>
/// 安装完成 /// 安装完成
......
...@@ -130,5 +130,10 @@ namespace Siger.Middlelayer.AccRepository.Response ...@@ -130,5 +130,10 @@ namespace Siger.Middlelayer.AccRepository.Response
public int status { get; set; } public int status { get; set; }
public string fileurl { get; set; } public string fileurl { get; set; }
public string filename { get; set; } public string filename { get; set; }
public string parentcate_guid { get; set; }
public List<int> parentcategoryids { get; set; } = new List<int>();
public string cate_guid { get; set; }
public List<int> categoryids { get; set; } = new List<int>();
} }
} }
...@@ -11,6 +11,7 @@ namespace Siger.Middlelayer.AccRepository.Response ...@@ -11,6 +11,7 @@ namespace Siger.Middlelayer.AccRepository.Response
/// 储位位置 /// 储位位置
/// </summary> /// </summary>
public int locationid { get; set; } public int locationid { get; set; }
public int locaid { get; set; }
public string location { get; set; } public string location { get; set; }
public int wavehouseid { get; set; } public int wavehouseid { get; set; }
public string wavehouse { get; set; } public string wavehouse { get; set; }
...@@ -47,6 +48,8 @@ namespace Siger.Middlelayer.AccRepository.Response ...@@ -47,6 +48,8 @@ namespace Siger.Middlelayer.AccRepository.Response
public string updatetime { get; set; } public string updatetime { get; set; }
public int status { get; set; } public int status { get; set; }
public List<int> locationIds { get; set; } = new List<int>();
} }
public class ResponseAutomationLocationList public class ResponseAutomationLocationList
......
...@@ -34,6 +34,8 @@ namespace Siger.Middlelayer.AccRepository.Response ...@@ -34,6 +34,8 @@ namespace Siger.Middlelayer.AccRepository.Response
public string ProductCode { get; set; } public string ProductCode { get; set; }
public string ProductName { get; set; } public string ProductName { get; set; }
public int status { get; set; } public int status { get; set; }
public string FixtureName { get; set; }
public string FixtureGuid { get; set; }
public int Location { get; set; } public int Location { get; set; }
public string Sn { get; set; } public string Sn { get; set; }
} }
......
...@@ -269,9 +269,6 @@ CREATE TABLE IF NOT EXISTS `siger_automation_location` ( ...@@ -269,9 +269,6 @@ CREATE TABLE IF NOT EXISTS `siger_automation_location` (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL AUTO_INCREMENT,
`locationid` int(11) NOT NULL DEFAULT 0 COMMENT '储位位置', `locationid` int(11) NOT NULL DEFAULT 0 COMMENT '储位位置',
`fixturetools` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '工装GUID', `fixturetools` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '工装GUID',
`materialid` int(11) NOT NULL DEFAULT 0 COMMENT '物料ID',
`processid` int(11) NOT NULL DEFAULT 0 COMMENT '工序ID',
`materialstate` int(11) NOT NULL DEFAULT 0 COMMENT '物料状态',
`attachment` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '附件', `attachment` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '附件',
`filename` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '附件名称', `filename` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '附件名称',
`remark` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注', `remark` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
...@@ -430,4 +427,19 @@ CREATE TABLE `siger_automation_fixture_tools_moniter` ( ...@@ -430,4 +427,19 @@ CREATE TABLE `siger_automation_fixture_tools_moniter` (
PRIMARY KEY (`id`) USING BTREE PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
DROP TABLE IF EXISTS `siger_automation_machine_status`;
CREATE TABLE `siger_automation_machine_status` (
`id` int NOT NULL AUTO_INCREMENT,
`section` int NOT NULL DEFAULT '0' COMMENT '工位ID',
`machineid` int NOT NULL DEFAULT '0' COMMENT '工位对应设备ID',
`projectid` int NOT NULL DEFAULT '0',
`enable` int NOT NULL DEFAULT '1' COMMENT '设备可用状态 0:不可用 1:可用',
`status` int NOT NULL DEFAULT '1' COMMENT '完工状态 0:取消 1:待生产 2:生产中 3:生产完成 ',
`updatetime` datetime DEFAULT NULL COMMENT '操作时间',
`program` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '程序号',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
SET FOREIGN_KEY_CHECKS=1;
SET FOREIGN_KEY_CHECKS = 1; SET FOREIGN_KEY_CHECKS = 1;
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