Commit ad0b828a by yiyu.li
parents 38f5f173 9f261137
......@@ -255,12 +255,6 @@ export default {
filename: '',//文件名称
fileurl:'',//文件路径
UploadAction: this.axios.publicPath + "config/upload/UploadImage",
headers: {
token: localStorage.getItem("token"),
timestamp: localStorage.getItem("timestamp"),
nonce: localStorage.getItem("nonce"),
sign: localStorage.getItem("sign"),
},
spinShow:false,
}
},
......
......@@ -289,12 +289,6 @@ export default {
filename: '',//文件名称
fileurl:'',//文件路径
UploadAction: this.axios.publicPath + "config/upload/UploadImage",
headers: {
token: localStorage.getItem("token"),
timestamp: localStorage.getItem("timestamp"),
nonce: localStorage.getItem("nonce"),
sign: localStorage.getItem("sign"),
},
spinShow:false,
}
},
......
......@@ -44,7 +44,8 @@ namespace Siger.ApiACC.Controllers
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)
var categorys = _toolsCategoryRepository.GetList(q => q.projectId == ProjectId && q.status == (int)RowState.Valid).ToList();
foreach (var item in data.Data)
{
if(item.fixturetoolid > 0 && string.IsNullOrEmpty(item.sn))
{
......@@ -68,11 +69,26 @@ namespace Siger.ApiACC.Controllers
{
var locas = GetParentLocations(loca.id, locations);
var locationIds = locas.Select(q => q.id).ToList();
locationIds.Distinct().Reverse();
locationIds = locationIds.Distinct().ToList();
locationIds.Reverse();
item.locationIds = locationIds;
}
}
var cates = GetParentCategoryList(item.cate_guid, categorys);
var cateIds = cates.Select(q => q.id).ToList();
cateIds.Reverse();
item.categoryIds = cateIds;
list.Add(item);
}
return new PagedObjectResult(data.Data, data.Total, page, pagesize);
return new PagedObjectResult(list, 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)));
}
private IEnumerable<siger_wms_storage_location> GetParentLocations(int pid, IEnumerable<siger_wms_storage_location> types)
......
......@@ -183,18 +183,32 @@ namespace Siger.ApiACC.Controllers
{
throw new BadRequestException(CommonEnum.RecordNotFound);
}
var machineStatus = _automationMachineStatus.Get(f => f.machineid==machineAttr.machine);
if (machineStatus==null)
var machineStatus = _automationMachineStatus.Get(f => f.machineid == machineAttr.machine);
if (machineStatus == null)
{
throw new BadRequestException(CommonEnum.RecordNotFound);
}
if (machineStatus.enable==0)
{
throw new BadRequestException(AccEnum.MachineDisable);
// throw new BadRequestException(CommonEnum.RecordNotFound);
//上料设备状态与PLC 无关,
//需要手动插入
_automationMachineStatus.Insert(new siger_automation_machine_status
{
enable = 1,
section = loading.section,
machineid = machineAttr.machine,
projectId = ProjectId,
status = (int)Automation.MachineStatus.Produce,
updatetime = DateTime.Now
});
}
if(machineStatus.status!=(int)Automation.MachineStatus.Waiting)
else
{
throw new BadRequestException(AccEnum.MachineBusy);
if (machineStatus.enable == 0)
{
throw new BadRequestException(AccEnum.MachineDisable);
}
if (machineStatus.status != (int)Automation.MachineStatus.Waiting)
{
throw new BadRequestException(AccEnum.MachineBusy);
}
}
if (!_automationTaskList.CanTask(ProjectId,loading.section))
{
......
......@@ -53,7 +53,7 @@ namespace Siger.ApiACC.Controllers
list.Add(item);
}
return new PagedObjectResult(data.Data, data.Total, page, pagesize);
return new PagedObjectResult(list, data.Total, page, pagesize);
}
private IEnumerable<siger_automation_fixture_tools_category> GetParentCategoryList(string parentId, List<siger_automation_fixture_tools_category> sections)
......@@ -78,31 +78,50 @@ namespace Siger.ApiACC.Controllers
{
throw new BadRequestException(RequestEnum.ParameterMiss);
}
if(!string.IsNullOrEmpty(req.parentid) && !string.IsNullOrEmpty(req.fixturetoolid) &&
req.parentid == req.fixturetoolid)
if(req.parentid == req.fixturetoolid)
{
throw new BadRequestException(RequestEnum.ParentSonSame);
}
var parent = _toolsRepository.Get(q => q.id == req.parentid.ToInt() && q.projectId == ProjectId);
if (parent == null)
{
throw new BadRequestException(RequestEnum.FixtureToolNotFound);
}
var son = _toolsRepository.Get(q => q.id == req.fixturetoolid.ToInt() && q.projectId == ProjectId);
if (son == null)
{
throw new BadRequestException(RequestEnum.FixtureToolNotFound);
}
var parentGuid = parent?.guid ?? "";
var parentGuid = parent.guid;
var exsit = _toolsAssemblyRepository.Get(q => q.projectId == ProjectId && q.son == son.guid && q.parent == parentGuid);
if (exsit != null)
{
throw new BadRequestException(RequestEnum.DataExist);
}
if (!string.IsNullOrEmpty(parentGuid))
var parentExsit = _toolsAssemblyRepository.Get(q => q.projectId == ProjectId && q.son == parentGuid);
if(parentExsit != null)
{
var parentExsit = _toolsAssemblyRepository.Get(q => q.projectId == ProjectId && q.son == parentGuid);
if(parentExsit != null)
throw new BadRequestException(RequestEnum.LevelCountError);
}
if (_toolsAssemblyRepository.Get(q => q.projectId == ProjectId && q.son == parentGuid) == null)
{
var parentEntity = new siger_automation_fixture_tools_assembly
{
throw new BadRequestException(RequestEnum.LevelCountError);
}
}
guid = Guid.NewGuid().ToString(),
parent = "",
son = parent.guid,
creator = UserId,
createtime = DateTime.Now,
attachment = req.fileurl,
filename = req.filename,
projectId = ProjectId,
updatetime = DateTime.Now,
updator = UserId,
status = req.status.ToInt() == (int)RowState.Valid ? (int)RowState.Valid : (int)RowState.Invalid,
};
_toolsAssemblyRepository.Insert(parentEntity);
}
var entity = new siger_automation_fixture_tools_assembly
{
......@@ -147,25 +166,45 @@ namespace Siger.ApiACC.Controllers
throw new BadRequestException(CommonEnum.RecordNotFound);
}
var parent = _toolsRepository.Get(q => q.id == req.parentid.ToInt() && q.projectId == ProjectId);
if (parent == null)
{
throw new BadRequestException(RequestEnum.FixtureToolNotFound);
}
var son = _toolsRepository.Get(q => q.id == req.fixturetoolid.ToInt() && q.projectId == ProjectId);
if (son == null)
{
throw new BadRequestException(RequestEnum.FixtureToolNotFound);
}
var parentGuid = parent?.guid ?? "";
var parentGuid = parent.guid;
var exsit = _toolsAssemblyRepository.Get(q => q.projectId == ProjectId && q.son == son.guid && q.parent == parentGuid &&
q.id != req.id);
if (exsit != null)
{
throw new BadRequestException(RequestEnum.DataExist);
}
if (!string.IsNullOrEmpty(parentGuid))
var parentExsit = _toolsAssemblyRepository.Get(q => q.projectId == ProjectId && q.son == parentGuid);
if (parentExsit != null)
{
throw new BadRequestException(RequestEnum.LevelCountError);
}
if (_toolsAssemblyRepository.Get(q => q.projectId == ProjectId && q.son == parentGuid) == null)
{
var parentExsit = _toolsAssemblyRepository.Get(q => q.projectId == ProjectId && q.son == parentGuid);
if (parentExsit != null)
var parentEntity = new siger_automation_fixture_tools_assembly
{
throw new BadRequestException(RequestEnum.LevelCountError);
}
guid = Guid.NewGuid().ToString(),
parent = "",
son = parent.guid,
creator = UserId,
createtime = DateTime.Now,
attachment = req.fileurl,
filename = req.filename,
projectId = ProjectId,
updatetime = DateTime.Now,
updator = UserId,
status = req.status.ToInt() == (int)RowState.Valid ? (int)RowState.Valid : (int)RowState.Invalid,
};
_toolsAssemblyRepository.Insert(parentEntity);
}
entity.parent = parent?.guid ?? "";
......
......@@ -36,10 +36,28 @@ namespace Siger.ApiACC.Controllers
_productRepository = productRepository;
}
[HttpGet]
public IActionResult GetPageList(string category, string tool, string product, int page, int pagesize)
{
var data = _toolsProductRepository.GetPagedList(category.ToInt(), tool.ToInt(), product.ToInt(), ProjectId, page, pagesize);
return new PagedObjectResult(data.Data, data.Total, page, pagesize);
var categorys = _toolsCategoryRepository.GetList(q => q.projectId == ProjectId && q.status == (int)RowState.Valid).ToList();
var list = new List<ResponseAumationFixtureToolsProduct>();
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;
list.Add(item);
}
return new PagedObjectResult(list, 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)));
}
[HttpPost]
......
......@@ -22,7 +22,6 @@ namespace Siger.Middlelayer.AccRepository.Entities
/// 附件
/// </summary>
public string attachment { get; set; }
public string fileurl { get; set; }
/// <summary>
/// 附件名称
/// </summary>
......
......@@ -16,6 +16,10 @@ namespace Siger.Middlelayer.AccRepository.Entities
public string no { get; set; }
/// <summary>
/// 工装GUID
/// </summary>
public string fixtureguid { get; set; }
/// <summary>
/// 工位ID
/// </summary>
public int sectionid { get; set; }
......@@ -55,10 +59,7 @@ namespace Siger.Middlelayer.AccRepository.Entities
/// 储位位置
/// </summary>
public int locationid { get; set; }
/// <summary>
/// 工装GUID
/// </summary>
public string fixtureguid { get; set; }
/// <summary>
/// Task 执行动作类型 1 手动 2 自动
......
......@@ -26,7 +26,8 @@ namespace Siger.Middlelayer.AccRepository.Repositories
var query = from q in _context.siger_automation_fixture_tools_assembly
join t1 in _context.siger_automation_fixture_tools on q.parent equals t1.guid into tt1
from t1 in tt1.DefaultIfEmpty()
join c1 in _context.siger_automation_fixture_tools_category on t1.category equals c1.guid
join c1 in _context.siger_automation_fixture_tools_category on t1.category equals c1.guid into cc1
from c1 in cc1.DefaultIfEmpty()
join t2 in _context.siger_automation_fixture_tools on q.son equals t2.guid
join c2 in _context.siger_automation_fixture_tools_category on t2.category equals c2.guid
join u in _context.siger_project_user on q.updator equals u.mid into uu
......
......@@ -61,7 +61,8 @@ namespace Siger.Middlelayer.AccRepository.Repositories
filename = q.filename,
partnumber = t.partnumber,
specfication = t.specification,
productcode = p.code
productcode = p.code,
cate_guid = c.guid ?? ""
};
Expression<Func<ResponseAumationFixtureToolsProduct, bool>> categoryExpression = f => true;
if (category > 0)
......
......@@ -56,7 +56,8 @@ namespace Siger.Middlelayer.AccRepository.Repositories
updatetime = q.updatetime.HasValue && q.updatetime > DateTime.MinValue ? q.updatetime.Value.ToString(ParameterConstant.DateTimeFormat) : "",
sn = m.sn ?? "",
route = r.name ?? "",
routenumber = r == null ? "" : r.serialNumber.ToString()
routenumber = r == null ? "" : r.serialNumber.ToString(),
cate_guid = c.guid ?? ""
};
Expression<Func<ResponseAutomationLocation, bool>> wavehouseidExpression = f => true;
if (wavehouseid > 0)
......@@ -97,6 +98,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
select new ResponseAutomationLocationList
{
id = q.id,
fixtureguid = t.guid,
locationid = l.locationid,
location = l.realname,
locationcode = l.serial_number,
......
......@@ -111,6 +111,10 @@ namespace Siger.Middlelayer.AccRepository.Response
public string updatetime { get; set; }
public string fileurl { get; set; }
public string filename { get; set; }
public string cate_guid { get; set; }
public List<int> categoryids { get; set; } = new List<int>();
}
public class ResponseAumationFixtureToolsAssembly
......
......@@ -50,6 +50,8 @@ namespace Siger.Middlelayer.AccRepository.Response
public int status { get; set; }
public List<int> locationIds { get; set; } = new List<int>();
public List<int> categoryIds { get; set; } = new List<int>();
public string cate_guid { get; set; }
}
public class ResponseAutomationLocationList
......@@ -74,6 +76,7 @@ namespace Siger.Middlelayer.AccRepository.Response
/// 工装ID
/// </summary>
public int fixturetoolid { get; set; }
public string fixtureguid { get; set; }
public string code { get; set; }
public string name { get; set; }
public string materialsn { get; set; }
......
......@@ -324,17 +324,17 @@ CREATE TABLE IF NOT EXISTS `siger_automation_section_route` (
CREATE TABLE IF NOT EXISTS `siger_automation_task_list` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`no` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`fixtureguid` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`fixtureguid` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '工装GUID',
`sectionid` int(11) NOT NULL DEFAULT 0 COMMENT '工位ID',
`trigger` int(1) NOT NULL DEFAULT 0 COMMENT '触发方',
`tasktype` int(1) NOT NULL DEFAULT 0 COMMENT '任务类型',
`materialid` int(11) NOT NULL DEFAULT 0 COMMENT '工件ID',
`sn` int(11) NOT NULL DEFAULT 0 COMMENT '工件ID',
`ordercode` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '工单号',
`productid` int(11) NOT NULL DEFAULT 0 COMMENT '产品ID',
`productcode` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '产品CODE',
`processid` int(11) NOT NULL DEFAULT 0 COMMENT '工序ID',
`programnumber` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '程序号',
`locationid` int(11) NOT NULL COMMENT '储位位置',
`fixturetools` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '工装GUID',
`action` int(1) NOT NULL DEFAULT 0 COMMENT '动作',
`actiontype` int(11) NOT NULL DEFAULT 0 COMMENT '动作类型',
`projectid` int(11) NOT NULL DEFAULT 0,
......
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