Commit a3993cc5 by yiyu.li
parents 06281e07 1d7315b5
......@@ -139,7 +139,7 @@
<div>正在上传...</div>
</Spin>
<div class="filter">
<label>父工装类</label>
<label>父工装类</label>
<Cascader
class="searchSelect"
:data="typeTree"
......@@ -172,7 +172,7 @@
<div style="padding-left: 50px">
<div class="filter">
<label>子工装类</label>
<label>子工装类</label>
<Cascader
class="searchSelect"
:data="typeTree"
......@@ -432,35 +432,6 @@ export default {
},
},
{
title: "备注",
key: "remark",
},
{
title: "附件",
key: "filename",
render: (h, params) => {
return h(
"span",
{
style: {
color: "#2b85e4",
cursor: "pointer",
},
on: {
click: () => {
let name = params.row.filename;
let url = params.row.fileurl;
if (url) {
this.downFile(url, name);
}
},
},
},
params.row.filename
);
},
},
{
title: "维护人",
key: "updator",
},
......
......@@ -19,6 +19,7 @@ using Siger.Middlelayer.Share.Enum.ModuleEnum;
using static Siger.Middlelayer.Share.Enum.ModuleEnum.Automation;
using Siger.Middlelayer.Repository.Entities;
using NPOI.SS.Formula.Functions;
using Siger.Middlelayer.AccRepository.Response;
namespace Siger.ApiACC.Controllers
{
......@@ -82,6 +83,7 @@ namespace Siger.ApiACC.Controllers
exitsObj.enable = request.enable;
exitsObj.status = request.status;
exitsObj.updatetime = DateTime.Now;
_automationMachineStatus.Update(exitsObj);
}
......@@ -92,15 +94,23 @@ namespace Siger.ApiACC.Controllers
{
if (request.status == (int)Automation.MachineStatus.Waiting || request.status == (int)Automation.MachineStatus.Complated)
{
var tasklist = _automationTaskList.GetList(f => f.projectId == PID && f.status >= (int)TaskResultStatus.Cancel && f.status < (int)TaskResultStatus.Complated);
if (!tasklist.Any())
{
var stationDicts = _sigerDict.GetDataByCat(AccDictCost.Automation, PID);
if (!stationDicts.Any())
{
Logger.WriteLineInfo($"AutoProcess 未配置设备类型字典");
throw new BadRequestException(AccEnum.AutomationDictNotfound);
}
var uploadStation = stationDicts.Where(f => f.dkey == DictKeyValConst.UploadloadStation);
var uploadStations = uploadStation.Select(f => f.dval.ToInt()).ToList();
if (!uploadStations.Contains(machineAttr.station))
{
var tasklist = _automationTaskList.GetList(f => f.projectId == PID && f.status < (int)TaskResultStatus.Complated);
if (!tasklist.Any())
{
var section = _sigerProjectLevelSection.Get(f => f.id == machineAttr.station);
if (section != null)
{
......@@ -110,6 +120,7 @@ namespace Siger.ApiACC.Controllers
}
}
}
}
return new ObjectResult(CommonEnum.Succefull);
}
else
......@@ -161,7 +172,7 @@ namespace Siger.ApiACC.Controllers
throw new BadRequestException(AccEnum.AutomationDictNotfound);
}
var tasklist = _automationTaskList.GetList(f => f.projectId == PID && f.status >= (int)TaskResultStatus.Cancel && f.status < (int)TaskResultStatus.Complated);
var tasklist = _automationTaskList.GetList(f => f.projectId == PID && f.status < (int)TaskResultStatus.Complated);
if (!tasklist.Any())
{
Logger.WriteLineInfo($"LineMode Mode=1 触发自动任务检查");
......@@ -231,7 +242,7 @@ namespace Siger.ApiACC.Controllers
}
//是否还有未完成任务
var taskDone = _automationTaskList.Get(f => f.projectId == PID && f.status > (int)TaskResultStatus.Cancel && f.status < (int)TaskResultStatus.Complated);
var taskDone = _automationTaskList.Get(f => f.projectId == PID && f.status < (int)TaskResultStatus.Complated);
if(taskDone!=null)
{
//还有未完成任务 退出 等待任务下发
......@@ -248,6 +259,14 @@ namespace Siger.ApiACC.Controllers
var section = _sigerProjectLevelSection.Get(f => f.id == taskObj.sectionid);
if (section != null)
{
var updownDic = stationDicts.Where(s => s.dkey == DictKeyValConst.UploadloadStation);
var uploadStations = updownDic.Select(f => f.dval.ToInt()).ToList();
var uploadPostion = uploadStations.Contains(taskObj.sectionid);
if (uploadPostion)
{
Logger.WriteLineInfo($"AutoProcess 上料料工站 无需自动创建任务 ");
break;
}
AutoProcess(section.parentid, stationDicts);
}
break;
......@@ -292,9 +311,14 @@ namespace Siger.ApiACC.Controllers
var location = _automationLocation.Get(f => f.fixturetools == taskObj.fixtureguid);
if (location == null)
{
Logger.WriteLineInfo($"PlCfeeback 未找到该工装储位信息");
throw new BadRequestException(AccEnum.MachineDisable);
}
location.ordernumber = taskObj.ordercode;
location.productcode = taskObj.productcode;
location.productid = taskObj.productid;
location.sn = taskObj.sn;
}
_automationLocation.Update(location);
}
}
else if (taskObj.action == TaskAction.Step_LK_CJT || taskObj.action == TaskAction.Step_LK_JGZX || taskObj.action == TaskAction.Step_LK_SXLW)
......@@ -304,6 +328,8 @@ namespace Siger.ApiACC.Controllers
if (location == null)
{
location.ordernumber = "";
location.productcode = "";
location.productid =0;
location.sn = "";
}
......@@ -372,7 +398,7 @@ namespace Siger.ApiACC.Controllers
var updownDic= stationDicts.Where(s => s.dkey == DictKeyValConst.UploadloadStation);
var uploadStations = updownDic.Select(f => f.dval).ToList();
var uploadStations = updownDic.Select(f => f.dval.ToInt()).ToList();
/* 自动任务创建只有CNC 设备;排除上料设备(手动任务) */
......@@ -384,8 +410,8 @@ namespace Siger.ApiACC.Controllers
return;
}
// 获取可用 设备状态列表
var machineStatusList = _automationMachineStatus.GetList(f => f.projectId == PID && f.enable == 1);
// 获取可用 设备状态列表 排除上料工位
var machineStatusList = _automationMachineStatus.GetList(f => f.projectId == PID && !uploadStations.Contains(f.section) && f.enable == 1);
if (!machineStatusList.Any())
{
Logger.WriteLineInfo($"AutoProcess 无可用状态的设备");
......@@ -398,19 +424,15 @@ namespace Siger.ApiACC.Controllers
if (cleanMachine.status == (int)Automation.MachineStatus.Complated)
{
Logger.WriteLineInfo($"AutoProcess 有清洗机完成,创建清洗机Task");
var uploadPostion = uploadStations.Exists(f => f.Contains(cleanMachine.section.ToString()));
if (uploadPostion)
{
Logger.WriteLineInfo($"AutoProcess 上料料工站 无需自动创建任务 ");
return;
}
var monitor = _automationFixtureMonitor.Get(f => f.section == cleanMachine.section);
if (monitor==null)
{
Logger.WriteLineInfo($"AutoProcess 找不到CNC监控信息");
return;
}
CreateTask(cleanMachine,TaskActionType.Unload, TaskAction.Step_QXJ_LK,monitor.fixtureguid,monitor.ordernumber,monitor.sn,monitor.productCode,monitor.locationId);
CreateTask(cleanMachine,TaskActionType.Unload, TaskAction.Step_QXJ_LK,monitor.fixtureguid,monitor.ordernumber,monitor.sn,"无程序",monitor.productCode,monitor.locationId);
return; //完成当前任务 退出
}
}
......@@ -421,19 +443,15 @@ namespace Siger.ApiACC.Controllers
if (freeMachine != null)
{
Logger.WriteLineInfo($"AutoProcess 普通空闲,创建普通设备上料Task");
var uploadPostion = uploadStations.Exists(f => f.Contains(freeMachine.section.ToString()));
if (uploadPostion)
{
Logger.WriteLineInfo($"AutoProcess 上料料工站 无需自动创建任务 ");
return;
}
var location = SelectLocation(freeMachine.machineid);
if (location==null)
{
Logger.WriteLineInfo($"AutoProcess 找不到储位信息");
return;
}
CreateTask(freeMachine,TaskActionType.Load ,TaskAction.Step_LK_JGZX,location.guid,location.ordernumber,location.sn,location.productcode,location.locationid);
CreateTask(freeMachine,TaskActionType.Load ,TaskAction.Step_LK_JGZX,location.fixture,location.ordernumber,location.sn,location.pn,location.productCode,location.location);
return; //完成当前任务 退出
}
//优先级3:其他设备下料 (加工中心 ->立库)
......@@ -443,19 +461,15 @@ namespace Siger.ApiACC.Controllers
if (fullMachine != null && cleanMachine.status==(int)Automation.MachineStatus.Waiting)
{
Logger.WriteLineInfo($"AutoProcess 普通空闲,创建普通设备下料Task ");
var uploadPostion = uploadStations.Exists(f => f.Contains(cleanMachine.section.ToString()));
if (uploadPostion)
{
Logger.WriteLineInfo($"AutoProcess 上料料工站 无需自动创建任务 ");
return;
}
var monitor = _automationFixtureMonitor.Get(f => f.section == cleanMachine.section);
if (monitor == null)
{
Logger.WriteLineInfo($"AutoProcess 找不到CNC监控信息");
return;
}
CreateTask(fullMachine,TaskActionType.Unload, TaskAction.Step_JGZX_QXJ, monitor.fixtureguid, monitor.ordernumber, monitor.sn, monitor.productCode, monitor.locationId);
CreateTask(fullMachine,TaskActionType.Unload, TaskAction.Step_JGZX_QXJ, monitor.fixtureguid, monitor.ordernumber, monitor.sn,"无程序", monitor.productCode, monitor.locationId);
return; //完成当前任务 退出
}
......@@ -475,11 +489,12 @@ namespace Siger.ApiACC.Controllers
/// <param name="sn">工件</param>
/// <param name="productCode">产品CODE</param>
/// <param name="locationid">储位ID</param>
void CreateTask(siger_automation_machine_status machineStatus,TaskActionType actionType, TaskAction taskAction,string guid,string orderno,string sn,string productCode,int locationid)
void CreateTask(siger_automation_machine_status machineStatus,TaskActionType actionType, TaskAction taskAction,string guid,string orderno,string sn,string program,string productCode,int locationid)
{
var taskNo = _automationTaskList.CrateTaskNumber(Automation.TaskTrigerType.Auto);
_automationTaskList.Insert(new siger_automation_task_list
{
no= taskNo,
projectId = PID,
sectionid = machineStatus.section,
trigger = TaskTrigerType.Auto,
......@@ -494,6 +509,7 @@ namespace Siger.ApiACC.Controllers
status = 1,
fixtureguid= guid,
productcode= productCode,
programnumber=program,
locationid= locationid,
ordercode= orderno,
sn= sn,
......@@ -510,11 +526,11 @@ namespace Siger.ApiACC.Controllers
/// <summary>
/// 自动匹配储位 储位 ->CNC
/// </summary>
siger_automation_location SelectLocation(int machine)
ResponseAutomationLocationRouteInfo SelectLocation(int machine)
{
// 当前空闲设备能加工的产品
var beats = _productionBeatSet.GetList(f => f.projectID == PID && f.machineID == machine);
var productIds = beats.Select(f => f.product_name.ToInt()).ToList();
var productIds = beats.Select(f => f.product_name.ToInt()).Distinct().ToList();
// 取产品交期最近的订单
var planOrder = _automationFixtureToolsProduct.GetDeliveryOrder(productIds, PID);
......@@ -525,19 +541,41 @@ namespace Siger.ApiACC.Controllers
}
var order = planOrder.FirstOrDefault();
//TODO 20210126
var beatset = beats.Where(f => f.product_name == order.productId.ToString());
//var location = _automationLocation.GetList(f => f.projectId == PID && f.ordernumber == order.ordernumber && productIds.Contains(f.productid));
//if (!location.Any())
//{
// Logger.WriteLineInfo($"SelectLocation 未找到最近交期订单号{order.ordernumber} 对应产品 {order.productName}的储位信息");
// return null;
//var routeIds = beatset.Select(s => s.id).ToList();
//}
//储位有SN 工件
var location = _automationLocation.GetList(f => f.projectId == PID && f.ordernumber== order.ordernumber && productIds.Contains(f.productid));
if (location==null)
{
Logger.WriteLineInfo($"SelectLocation 未找到最近交期订单号{order.ordernumber} 对应产品 {order.productName}的储位信息");
var location = _automationLocation.GetList(f => f.projectId == PID && productIds.Contains(f.productid));
var hasSnloaction = location.Where(f =>!string.IsNullOrEmpty(f.sn));
if (!hasSnloaction.Any())
return null;
var result = location.FirstOrDefault();
var valiateBeat = beatset.FirstOrDefault(f=>f.route_number.ToInt()>result.routenum);
if (valiateBeat==null)
{
Logger.WriteLineInfo($"SelectLocation 未找到产品的工艺顺序");
return null;
}
return location.FirstOrDefault();
return new ResponseAutomationLocationRouteInfo
{
fixture = result.fixturetools,
ordernumber=result.ordernumber,
location=result.locationid,
productCode=result.productcode,
sn=result.sn,
pn= valiateBeat.process_number,
route=valiateBeat.route_name
};
}
......
......@@ -103,7 +103,7 @@ namespace Siger.ApiACC.Controllers
var machintAttr = _sigerProjectMachineAttribution.Get(f => f.station == section.id);
if(machintAttr==null)
{
Logger.WriteLineInfo($"GetloadStation 未配置清洗工站字典");
Logger.WriteLineInfo($"GetloadStation 未配置工站字典");
continue;
}
var loadStatus = (int)Automation.MachineStatus.Waiting;
......@@ -118,8 +118,10 @@ namespace Siger.ApiACC.Controllers
section=section.id,
updatetime=DateTime.Now
});
}else
{
loadStatus = machineStatus.status;
}
data.Add(new ResponseLoadStation {
......@@ -128,6 +130,8 @@ namespace Siger.ApiACC.Controllers
status=loadStatus
});
}
_unitOfWork.Commit();
return new ObjectResult(data);
}
......@@ -145,14 +149,14 @@ namespace Siger.ApiACC.Controllers
var monitor = _automationFixtureMonitor.Get(f => f.section == section);
var result = new ResponsePlanlFixtureInfo
{
OrderNumber = monitor.ordernumber,
FixtureGuid=monitor.fixtureguid,
FixtureName=monitor.fixturename,
ProductCode=monitor.productCode,
ProductName=monitor.productName,
Sn=monitor.sn,
status=monitor.status,
Location=monitor.locationId,
OrderNumber = monitor!=null? monitor.ordernumber:"",
FixtureGuid = monitor != null ? monitor.fixtureguid:"",
FixtureName = monitor != null ? monitor.fixturename:"",
ProductCode = monitor != null ? monitor.productCode:"",
ProductName = monitor != null ? monitor.productName:"",
Sn = monitor != null ? monitor.sn:"",
status = monitor != null ? monitor.status:(int)Automation.MachineStatus.Waiting,
Location = monitor != null ? monitor.locationId:0,
};
return new ObjectResult(result);
}
......@@ -200,7 +204,7 @@ namespace Siger.ApiACC.Controllers
section = loading.section,
machineid = machineAttr.machine,
projectId = ProjectId,
status = (int)Automation.MachineStatus.Produce,
status = (int)Automation.MachineStatus.Waiting,
updatetime = DateTime.Now
});
}
......@@ -281,6 +285,7 @@ namespace Siger.ApiACC.Controllers
createtime=DateTime.Now,
updatetime=DateTime.Now,
status=(int)Automation.MachineStatus.Produce,
productId=plan.product_id,
productCode=plan.product_code,
productName=plan.product_name,
ordernumber=plandts.OrderNumber,
......@@ -293,6 +298,7 @@ namespace Siger.ApiACC.Controllers
monitor.section = loading.section;
monitor.updatetime = DateTime.Now;
monitor.status = (int)Automation.MachineStatus.Produce;
monitor.productId = plan.product_id;
monitor.productName = plan.product_name;
monitor.productCode = plan.product_code;
monitor.ordernumber = plandts.OrderNumber;
......@@ -334,10 +340,10 @@ namespace Siger.ApiACC.Controllers
{
throw new BadRequestException(AccEnum.MachineOnFree);
}
if (machineStatus.status == (int)Automation.MachineStatus.Complated)
{
throw new BadRequestException(AccEnum.MachineProCompalate);
}
//if (machineStatus.status == (int)Automation.MachineStatus.Complated)
//{
// throw new BadRequestException(AccEnum.MachineProCompalate);
//}
if (!_automationTaskList.CanTask(ProjectId, assemble.section))
{
......@@ -349,6 +355,8 @@ namespace Siger.ApiACC.Controllers
{
throw new BadRequestException(AccEnum.MonitorNotfound);
}
//移出 上料位
monitor.status = (int)Automation.MachineStatus.Waiting;
......@@ -368,7 +376,7 @@ namespace Siger.ApiACC.Controllers
completetime = DateTime.MinValue,
trigger = Automation.TaskTrigerType.Manual,
projectId = ProjectId,
productid = 0,
productid = monitor.productId,
sn = monitor.sn,
ordercode = monitor.ordernumber,
fixtureguid = monitor.fixtureguid,
......
......@@ -69,6 +69,7 @@ namespace Siger.ApiACC.Controllers
item.sn = fixture.sn;
item.fixtureCode = fixture.fixtureguid;
item.fixtureName = fixture.fixturename;
item.status = fixture.status;
}
result.Add(item);
......
......@@ -41,7 +41,7 @@ namespace Siger.ApiACC.Controllers
[HttpGet]
public IActionResult GetPageList(string category, string code, string name, string state, int page, int pagesize, string toexcel = "")
{
var data = _toolsAssemblyRepository.GetPagedList(category.ToInt(), code, name,state.ToInt(), ProjectId, page, pagesize, toexcel);
var data = _toolsAssemblyRepository.GetPagedList(category.ToInt(), code, name, state, ProjectId, page, pagesize, toexcel);
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)
......@@ -69,6 +69,9 @@ namespace Siger.ApiACC.Controllers
var parentcateIds1 = parentcates1.Select(q => q.id).ToList();
parentcateIds1.Reverse();
model.parentcategoryids = parentcateIds1;
model.fileurl = item.fileurl;
model.filename = item.filename;
model.remark = item.remark;
models.Add(model);
}
item.childrens = models;
......@@ -101,6 +104,7 @@ namespace Siger.ApiACC.Controllers
ParentPartNumber = item.partnumber,
ParentFixtureTool = item.name,
ParentSpecfication = item.specfication,
ParentCode = item.code,
Category = "",
FixtureTool = "",
PartNumber = "",
......@@ -120,10 +124,12 @@ namespace Siger.ApiACC.Controllers
ParentPartNumber = son.parentpartnumber,
ParentFixtureTool = son.parentname,
ParentSpecfication = son.parentspecfication,
ParentCode = item.parentcode,
Category = son.category,
FixtureTool = son.name,
PartNumber = son.partnumber,
Specfication = son.specfication,
Code = son.code,
Status = son.status == (int)RowState.Valid ? "可用" : "停用",
Remark = son.remark,
Updator = son.updator,
......@@ -204,7 +210,28 @@ namespace Siger.ApiACC.Controllers
throw new BadRequestException(RequestEnum.LevelCountError);
}
if (_toolsAssemblyRepository.Get(q => q.projectId == ProjectId && q.son == parentGuid) == null)
if (parentExsit != null)
{
parentExsit.filename = req.filename;
parentExsit.attachment = req.fileurl;
parentExsit.remark = req.remark;
parentExsit.updator = UserId;
parentExsit.updatetime = DateTime.Now;
//var sons = _toolsAssemblyRepository.GetList(q => q.parent == parentExsit.son && q.projectId == ProjectId).ToList();
//if (req.status.ToInt() == (int)RowState.Invalid && sons.Count(q => q.status == (int)RowState.Invalid) == sons.Count)
//{
// parentExsit.status = (int)RowState.Invalid;
//}
//else
//{
// parentExsit.status = (int)RowState.Valid;
//}
_toolsAssemblyRepository.Update(parentExsit);
}
if (parentExsit == null)
{
var parentEntity = new siger_automation_fixture_tools_assembly
{
......@@ -221,6 +248,7 @@ namespace Siger.ApiACC.Controllers
status = req.status.ToInt() == (int)RowState.Valid ? (int)RowState.Valid : (int)RowState.Invalid,
remark = req.remark
};
_toolsAssemblyRepository.Insert(parentEntity);
}
......@@ -289,7 +317,28 @@ namespace Siger.ApiACC.Controllers
throw new BadRequestException(RequestEnum.LevelCountError);
}
if (_toolsAssemblyRepository.Get(q => q.projectId == ProjectId && q.son == parentGuid) == null)
if (parentExsit != null)
{
parentExsit.filename = req.filename;
parentExsit.attachment = req.fileurl;
parentExsit.remark = req.remark;
parentExsit.updator = UserId;
parentExsit.updatetime = DateTime.Now;
//var sons = _toolsAssemblyRepository.GetList(q => q.parent == parentExsit.son && q.projectId == ProjectId).ToList();
//if (req.status.ToInt() == (int)RowState.Invalid && sons.Count(q => q.status == (int)RowState.Invalid) == sons.Count)
//{
// parentExsit.status = (int)RowState.Invalid;
//}
//else
//{
// parentExsit.status = (int)RowState.Valid;
//}
_toolsAssemblyRepository.Update(parentExsit);
}
if (parentExsit == null)
{
var parentEntity = new siger_automation_fixture_tools_assembly
{
......
......@@ -79,6 +79,9 @@ namespace Siger.Middlelayer.Utility.ImportEntities
public class FixtureToolsProductTemplate : ImportBase
{
[ExcelColumn("工装类型")]
public string Categroy { get; set; }
[ExcelColumn("*工装名称")]
public string FixtureTool { get; set; }
......@@ -121,9 +124,15 @@ namespace Siger.Middlelayer.Utility.ImportEntities
public class FixtureToolsAssmeblyTemplate : ImportBase
{
[ExcelColumn("父工装类型")]
public string ParentCategory { get; set; }
[ExcelColumn("*父工装名称")]
public string ParentFixtureTool { get; set; }
[ExcelColumn("子工装类型")]
public string Category { get; set; }
[ExcelColumn("*子工装名称")]
public string FixtureTool { get; set; }
......@@ -148,6 +157,9 @@ namespace Siger.Middlelayer.Utility.ImportEntities
[ExcelColumn("父工装规格")]
public string ParentSpecfication { get; set; }
[ExcelColumn("父工装编号")]
public string ParentCode { get; set; }
[ExcelColumn("子工装类型")]
public string Category { get; set; }
......@@ -160,6 +172,9 @@ namespace Siger.Middlelayer.Utility.ImportEntities
[ExcelColumn("子工装规格")]
public string Specfication { get; set; }
[ExcelColumn("子工装编号")]
public string Code { get; set; }
[ExcelColumn("状态")]
public string Status { get; set; }
......
......@@ -40,6 +40,10 @@ namespace Siger.Middlelayer.AccRepository.Entities
public DateTime updatetime { get; set; }
public string ordernumber { get; set; }
/// <summary>
/// 产品ID
/// </summary>
public int productId { get; set; }
/// <summary>
///
/// </summary>
public string productCode { get; set; }
......
......@@ -38,6 +38,11 @@ namespace Siger.Middlelayer.AccRepository.Entities
/// 每加工CNC 设备 经过的工序: 标准节拍表
/// </summary>
public string route { get; set; }
/// <summary>
/// 工序顺序
/// </summary>
public int routenum { get; set; }
/// <summary>
/// 附件
/// </summary>
......
......@@ -24,7 +24,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
_context = context;
}
public IPagedCollectionResult<ResponseAumationFixtureToolsAssembly> GetPagedList(int category, string code, string name, int state, int projectid, int page, int pagesize, string toexcel = "")
public IPagedCollectionResult<ResponseAumationFixtureToolsAssembly> GetPagedList(int category, string code, string name, string state, int projectid, int page, int pagesize, string toexcel = "")
{
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
......@@ -61,7 +61,8 @@ namespace Siger.Middlelayer.AccRepository.Repositories
parentcategoryid = c1 == null ? 0 : c1.id,
parentcategory = c1.name ?? "",
parentpartnumber = t1.partnumber ?? "",
parentspecfication = t1.specification ?? ""
parentspecfication = t1.specification ?? "",
parentcode = t1.code ?? ""
};
Expression<Func<ResponseAumationFixtureToolsAssembly, bool>> categoryExpression = f => true;
if (category > 0)
......@@ -79,9 +80,9 @@ namespace Siger.Middlelayer.AccRepository.Repositories
nameExpression = q => q.name.Contains(name);
}
Expression<Func<ResponseAumationFixtureToolsAssembly, bool>> stateExpression = f => true;
if (state > 0)
if (!string.IsNullOrEmpty(state))
{
stateExpression = q => q.status == state;
stateExpression = q => q.status == state.ToInt();
}
var expression = categoryExpression.And(codeExpression).And(nameExpression).And(stateExpression);
if (toexcel.ToInt() == 1)
......
......@@ -33,9 +33,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
join w in _context.siger_wms_storage on l.storageid equals w.id
join u in _context.siger_project_user on q.updator equals u.mid into uu
from u in uu.DefaultIfEmpty()
join m in _context.siger_automation_fixture_tools_moniter on q.fixturetools equals m.fixtureguid into mm
from m in mm.DefaultIfEmpty()
join r in _context.siger_project_beat_set on m.route equals r.id into rr
join r in _context.siger_project_beat_set on q.routeid equals r.id into rr
from r in rr.DefaultIfEmpty()
where q.projectId == projectid && q.status == (int)RowState.Valid
select new ResponseAutomationLocation
......@@ -57,7 +55,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
updator = u.name ?? "",
status = q.status,
updatetime = q.updatetime.HasValue && q.updatetime > DateTime.MinValue ? q.updatetime.Value.ToString(ParameterConstant.DateTimeFormat) : "",
sn = m.sn ?? "",
sn = q.sn ?? "",
route = r.route_name ?? "",
routenumber = r == null ? "" : r.route_number.ToString(),
cate_guid = c.guid ?? "",
......@@ -104,8 +102,6 @@ namespace Siger.Middlelayer.AccRepository.Repositories
join c in _context.siger_automation_fixture_tools_category on t.category equals c.guid
join l in _context.siger_wms_storage_location on q.locationid equals l.locationid
join w in _context.siger_wms_storage on l.storageid equals w.id
join m in _context.siger_automation_fixture_tools_moniter on q.fixturetools equals m.fixtureguid into mm
from m in mm.DefaultIfEmpty()
where q.projectId == projectid && q.status == (int)RowState.Valid
select new ResponseAutomationLocationList
{
......@@ -120,7 +116,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
fixturetoolid = t.id,
code = t.code,
name = t.name,
materialsn = m.sn ?? "",
materialsn = q.sn ?? "",
categoryid = c == null ? 0 : c.id
};
var entities = query.AsNoTracking().ToList();
......
......@@ -27,7 +27,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
public bool CanTask(int projectId,int section)
{
var taskObj = _context.siger_automation_task_list.FirstOrDefault(f => f.projectId == projectId && f.status >= (int)TaskResultStatus.Cancel && f.status < (int)TaskResultStatus.Complated);
var taskObj = _context.siger_automation_task_list.FirstOrDefault(f => f.projectId == projectId && f.status < (int)TaskResultStatus.Complated);
if (taskObj==null)
return true;
......
......@@ -9,7 +9,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface
{
public interface IAutomationFixtureToolsAssemblyRepository : IAccRepositoryBase<siger_automation_fixture_tools_assembly>
{
IPagedCollectionResult<ResponseAumationFixtureToolsAssembly> GetPagedList(int category, string code, string name, int state, int projectid, int page, int pagesize, string toexcel = "");
IPagedCollectionResult<ResponseAumationFixtureToolsAssembly> GetPagedList(int category, string code, string name, string state, int projectid, int page, int pagesize, string toexcel = "");
IEnumerable<ResponseAumationFixtureToolsAssembly> GetDetailList(string parent, int projectid);
......
......@@ -152,5 +152,6 @@ namespace Siger.Middlelayer.AccRepository.Response
public string parentcategory { get; set; }
public string parentpartnumber { get; set; }
public string parentspecfication { get; set; }
public string parentcode { get; set; }
}
}
......@@ -28,4 +28,16 @@ namespace Siger.Middlelayer.AccRepository.Response
/// </summary>
public string fixture { get; set; }
}
public class ResponseAutomationLocationRouteInfo
{
public string fixture { get; set; }
public string ordernumber { get; set; }
public string sn { get; set; }
public int location { get; set; }
public string productCode { get; set; }
public string route { get; set; }
public string pn { get; set; }
}
}
......@@ -267,6 +267,7 @@ CREATE TABLE IF NOT EXISTS `siger_automation_fixture_tools_product` (
-- ----------------------------
CREATE TABLE IF NOT EXISTS `siger_automation_location` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`guid` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`locationid` int(11) NOT NULL DEFAULT 0 COMMENT '储位位置',
`fixturetools` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '工装GUID',
`productid` int(11) NULL DEFAULT 0 COMMENT '产品ID',
......@@ -275,6 +276,7 @@ CREATE TABLE IF NOT EXISTS `siger_automation_location` (
`sn` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '工件',
`routeid` int(11) NULL DEFAULT 0,
`route` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '工序',
`routenum` int(11) NULL DEFAULT 0 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 '附件名称',
`remark` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
......@@ -401,7 +403,7 @@ CREATE TABLE `siger_automation_produce_history` (
`statusid` int(11) NOT NULL DEFAULT 0 COMMENT '设备状态ID',
`section` int(11) NOT NULL DEFAULT 0 COMMENT '产线ID',
`projectid` int(11) NOT NULL DEFAULT 0,
`productid` int(1) NOT NULL DEFAULT 1 COMMENT '产品ID',
`productid` int(11) NULL DEFAULT 0 COMMENT '产品ID',
`productcode` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '产品编号',
`productname` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '产品名称',
`locationid` int(11) NOT NULL DEFAULT 0 COMMENT '储位ID',
......@@ -432,6 +434,7 @@ CREATE TABLE `siger_automation_fixture_tools_moniter` (
`createtime` datetime(0) NULL DEFAULT NULL COMMENT '添加时间',
`updatetime` datetime(0) NULL DEFAULT NULL COMMENT '操作时间',
`ordernumber` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '工令单',
`productid` int(11) NULL DEFAULT 0 COMMENT '产品ID',
`productCode` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '产品CODE',
`productName` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '产品名称',
`locationId` 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