Commit 24c5b8ad by xin.yang
parents 2933aeb5 bf400bbc
......@@ -199,6 +199,7 @@ export default {
{
title: "任务编号",
key: "taskno",
width:300
},
{
title: "产线层级",
......@@ -304,6 +305,7 @@ export default {
this.columns1 = this.$time.initTableTitle(this.columns1);
this.initlevel();
this.iniproducts();
this.search(1,10);
},
methods: {
search(page, pagesize) {
......
......@@ -92,20 +92,29 @@ 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())
{
var stationDicts = _sigerDict.GetDataByCat(AccDictCost.Automation, PID);
if (!stationDicts.Any())
{
Logger.WriteLineInfo($"AutoProcess 未配置设备类型字典");
throw new BadRequestException(AccEnum.AutomationDictNotfound);
}
var section = _sigerProjectLevelSection.Get(f => f.id == machineAttr.station);
if (section != null)
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())
{
Logger.WriteLineInfo($"MachineStatus 设备状态 触发自动任务检查");
AutoProcess(section.parentid, stationDicts);
var section = _sigerProjectLevelSection.Get(f => f.id == machineAttr.station);
if (section != null)
{
Logger.WriteLineInfo($"MachineStatus 设备状态 触发自动任务检查");
AutoProcess(section.parentid, stationDicts);
}
}
}
}
......@@ -161,7 +170,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 +240,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 +257,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 +309,13 @@ namespace Siger.ApiACC.Controllers
var location = _automationLocation.Get(f => f.fixturetools == taskObj.fixtureguid);
if (location == null)
{
location.ordernumber = taskObj.ordercode;
location.sn = taskObj.sn;
Logger.WriteLineInfo($"PlCfeeback 未找到该工装储位信息");
throw new BadRequestException(AccEnum.MachineDisable);
}
location.ordernumber = taskObj.ordercode;
location.productcode = taskObj.productcode;
location.productid = taskObj.productid;
location.sn = taskObj.sn;
}
}
else if (taskObj.action == TaskAction.Step_LK_CJT || taskObj.action == TaskAction.Step_LK_JGZX || taskObj.action == TaskAction.Step_LK_SXLW)
......@@ -304,6 +325,8 @@ namespace Siger.ApiACC.Controllers
if (location == null)
{
location.ordernumber = "";
location.productcode = "";
location.productid =0;
location.sn = "";
}
......@@ -477,9 +500,10 @@ namespace Siger.ApiACC.Controllers
/// <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)
{
var taskNo = _automationTaskList.CrateTaskNumber(Automation.TaskTrigerType.Auto);
_automationTaskList.Insert(new siger_automation_task_list
{
no= taskNo,
projectId = PID,
sectionid = machineStatus.section,
trigger = TaskTrigerType.Auto,
......@@ -514,7 +538,7 @@ namespace Siger.ApiACC.Controllers
{
// 当前空闲设备能加工的产品
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,18 +549,22 @@ namespace Siger.ApiACC.Controllers
}
var order = planOrder.FirstOrDefault();
var beatset = beats.Where(f => f.product_name == order.productId.ToString());
//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));
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;
if (location==null)
{
Logger.WriteLineInfo($"SelectLocation 未找到最近交期订单号{order.ordernumber} 对应产品 {order.productName}的储位信息");
return null;
}
return location.FirstOrDefault();
}
......
......@@ -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);
......
......@@ -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; }
......
......@@ -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;
......
......@@ -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',
......@@ -401,7 +402,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 +433,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