Commit f997f0e1 by yiyu.li
parents 89a6f874 3f0e0000
......@@ -123,6 +123,10 @@
<Input class="searchInput" type="text" id="input1" v-model="editobj.checktype_value" disabled="disabled" />
</div>
<div class="filter">
<label >{{$t('950232')}}:</label>
<Input class="searchInput" type="text" id="input1" v-model="editobj.routename" disabled="disabled" />
</div>
<div class="filter">
<label >{{$t('800008')}}:</label>
<Input class="searchInput" type="text" id="input1" v-model="editobj.sn" disabled="disabled" />
</div>
......@@ -330,10 +334,6 @@ export default{
title: this.$t('100089'),
key: 'productcode'
},
// {
// title: this.$t('500006'),
// key: 'routename'
// },
{
title: this.$t('100088'),
key: 'productname'
......@@ -347,6 +347,10 @@ export default{
key: 'workorder'
},
{
title: this.$t('950232'),
key: 'routename'
},
{
title: this.$t('800008'),
key: 'sn'
},
......
......@@ -678,6 +678,7 @@ export default {
this.stationList = res.data.data;
this.station = this.stationList[0];
this.initproduct(this.station.id);
this.initSn(this.station.id);
});
}
},
......@@ -719,7 +720,7 @@ export default {
axios
.request({
url:
"/acc/SectionProperty/GetSn?productId=" + productid + "&sectionId=" + sectionid,
"/acc/SectionProperty/GetSn?sectionId=" + sectionid,
method: "get",
})
.then((res) => {
......
......@@ -17,6 +17,8 @@ using Siger.Middlelayer.Repository.Repositories.Interface;
using Siger.Middlelayer.Share.Constant;
using Siger.Middlelayer.Share.Enum.ModuleEnum;
using static Siger.Middlelayer.Share.Enum.ModuleEnum.Automation;
using Siger.Middlelayer.Repository.Entities;
using NPOI.SS.Formula.Functions;
namespace Siger.ApiACC.Controllers
{
......@@ -31,9 +33,12 @@ namespace Siger.ApiACC.Controllers
private readonly IAutomationTaskListRepository _automationTaskList;
private readonly ISigerProjectMachineAttributionRepository _sigerProjectMachineAttribution;
private readonly IAutomationFixtureMonitor _automationFixtureMonitor;
private readonly IAutomationLocationRepository _automationLocation;
private readonly IProductionBeatSetRepository _productionBeatSet;
private readonly IAutomationFixtureToolsProductRepository _automationFixtureToolsProduct;
public AutomationController(IUnitOfWork unitOfWork,ISigerProjectLevelSectionRepository sigerProjectLevelSection,IAutomationLineMode automationLineMode,IAutomationMachineStatus automationMachineStatus,ISigerDict sigerDict,IAutomationTaskListRepository automationTaskList,
ISigerProjectMachineAttributionRepository sigerProjectMachineAttribution, IAutomationFixtureMonitor automationFixtureMonitor)
ISigerProjectMachineAttributionRepository sigerProjectMachineAttribution, IAutomationFixtureMonitor automationFixtureMonitor, IAutomationLocationRepository automationLocation, IProductionBeatSetRepository productionBeatSet, IAutomationFixtureToolsProductRepository automationFixtureToolsProduct )
{
_unitOfWork = unitOfWork;
_sigerProjectLevelSection = sigerProjectLevelSection;
......@@ -43,8 +48,11 @@ namespace Siger.ApiACC.Controllers
_automationTaskList = automationTaskList;
_sigerProjectMachineAttribution = sigerProjectMachineAttribution;
_automationFixtureMonitor = automationFixtureMonitor;
_automationLocation = automationLocation;
_productionBeatSet = productionBeatSet;
_automationFixtureToolsProduct = automationFixtureToolsProduct;
}
/// <summary>
/// 设备状态接口 用于 保存 设备当前可用状态
/// </summary>
......@@ -76,6 +84,7 @@ namespace Siger.ApiACC.Controllers
exitsObj.updatetime = DateTime.Now;
}
if (_unitOfWork.Commit() > 0)
{
// 设备空闲,或者完成时触发 自动任务
......@@ -86,11 +95,17 @@ namespace Siger.ApiACC.Controllers
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 section = _sigerProjectLevelSection.Get(f => f.id == machineAttr.station);
if (section != null)
{
Logger.WriteLineInfo($"MachineStatus 设备状态 触发自动任务检查");
AutoProcess(section.parentid);
AutoProcess(section.parentid, stationDicts);
}
}
}
......@@ -138,11 +153,19 @@ namespace Siger.ApiACC.Controllers
//TODO
//手动-》自动 时
//task 无任务时候 ,根据设备状态创建任务
var stationDicts = _sigerDict.GetDataByCat(AccDictCost.Automation, PID);
if (!stationDicts.Any())
{
Logger.WriteLineInfo($"AutoProcess 未配置设备类型字典");
throw new BadRequestException(AccEnum.AutomationDictNotfound);
}
var tasklist = _automationTaskList.GetList(f => f.projectId == PID && f.status >= (int)TaskResultStatus.Cancel && f.status < (int)TaskResultStatus.Complated);
if (!tasklist.Any())
{
Logger.WriteLineInfo($"LineMode Mode=1 触发自动任务检查");
AutoProcess(line);
AutoProcess(line, stationDicts);
}
}
return new ObjectResult(CommonEnum.Succefull);
......@@ -193,18 +216,14 @@ namespace Siger.ApiACC.Controllers
{
throw new BadRequestException(AccEnum.AutoTaskDone);
}
//2.更新状态
taskObj.status = request.status;
_automationTaskList.Update(taskObj);
var machineStatus = _automationMachineStatus.Get(f => f.section == taskObj.sectionid);
if (machineStatus==null)
var stationDicts = _sigerDict.GetDataByCat(AccDictCost.Automation, PID);
if (!stationDicts.Any())
{
throw new BadRequestException(AccEnum.MachineDisable);
Logger.WriteLineInfo($"AutoProcess 未配置设备类型字典");
throw new BadRequestException(AccEnum.AutomationDictNotfound);
}
machineStatus.status = request.status;
_automationMachineStatus.Update(machineStatus);
//更新Tasklist
PlCfeeback(taskObj, request.status, stationDicts);
if (_unitOfWork.Commit() <= 0)
{
......@@ -229,7 +248,7 @@ namespace Siger.ApiACC.Controllers
var section = _sigerProjectLevelSection.Get(f => f.id == taskObj.sectionid);
if (section != null)
{
AutoProcess(section.parentid);
AutoProcess(section.parentid, stationDicts);
}
break;
}
......@@ -243,11 +262,93 @@ namespace Siger.ApiACC.Controllers
return new ObjectResult(CommonEnum.Succefull);
}
void PlCfeeback(siger_automation_task_list taskObj,int status, IEnumerable<SigerTrDict> stationDicts)
{
//2.更新状态
taskObj.status = status;
_automationTaskList.Update(taskObj);
var machineStatus = _automationMachineStatus.Get(f => f.section == taskObj.sectionid);
if (machineStatus == null)
{
throw new BadRequestException(AccEnum.MachineDisable);
}
machineStatus.status = status;
_automationMachineStatus.Update(machineStatus);
//PLC 反馈结束. 工装监控 解除设备绑定
if (status == (int)TaskResultStatus.Complated)
{
var uploadStation = stationDicts.Where(f => f.dkey == DictKeyValConst.UploadloadStation);
var uploadStations = uploadStation.Select(f => f.dval).ToList();
if (taskObj.action == TaskAction.Step_SXLW_LK)
{
// 业务入口: 上料位-》 入库 如果是上料工装 安装完成 ,绑定 储位与装配
if (uploadStations.Exists(f => f.Contains(taskObj.sectionid.ToString())))
{
var location = _automationLocation.Get(f => f.fixturetools == taskObj.fixtureguid);
if (location == null)
{
location.ordernumber = taskObj.ordercode;
location.sn = taskObj.sn;
}
}
}
else if (taskObj.action == TaskAction.Step_LK_CJT || taskObj.action == TaskAction.Step_LK_JGZX || taskObj.action == TaskAction.Step_LK_SXLW)
{
//出库
var location = _automationLocation.Get(f => f.fixturetools == taskObj.fixtureguid);
if (location == null)
{
location.ordernumber = "";
location.sn = "";
}
//更新 CNC 状态
var monitor = _automationFixtureMonitor.Get(f => f.section==taskObj.sectionid);
if(monitor==null)
{
_automationFixtureMonitor.Insert(new siger_automation_fixture_tools_monitor
{
ordernumber=taskObj.ordercode,
productCode=taskObj.productcode,
//productNam
section=taskObj.sectionid,
status=status,
sn=taskObj.sn,
fixtureguid=taskObj.fixtureguid,
//fixturename=,
locationId=taskObj.locationid,
createtime=DateTime.Now,
projectId=PID,
route=0,
updatetime=DateTime.Now,
});
}else
{
monitor.ordernumber = taskObj.ordercode;
monitor.productCode = taskObj.productcode;
monitor.status = taskObj.status;
monitor.sn = taskObj.sn;
monitor.locationId = taskObj.locationid;
monitor.updatetime = DateTime.Now;
_automationFixtureMonitor.Update(monitor);
}
}
}
}
/// <summary>
/// 创建自动 Task任务
/// </summary>
/// <param name="line"></param>
void AutoProcess(int line)
/// <param name="stationDicts"></param>
void AutoProcess(int line,IEnumerable<SigerTrDict> stationDicts)
{
var lineMode = _automationLineMode.Get(f => f.projectId == PID && f.section == line);
if (lineMode==null)
......@@ -268,12 +369,7 @@ namespace Siger.ApiACC.Controllers
//2.其他设备上料
//3.其他设备下料
*/
var stationDicts = _sigerDict.GetDataByCat(AccDictCost.Automation, PID);
if (!stationDicts.Any())
{
Logger.WriteLineInfo($"AutoProcess 未配置设备类型字典");
return;
}
var updownDic= stationDicts.Where(s => s.dkey == DictKeyValConst.UploadloadStation);
var uploadStations = updownDic.Select(f => f.dval).ToList();
......@@ -301,8 +397,20 @@ namespace Siger.ApiACC.Controllers
{
if (cleanMachine.status == (int)Automation.MachineStatus.Complated)
{
Logger.WriteLineInfo($"AutoProcess 有清洗机完成,创建清洗剂Task");
CreateTask(cleanMachine,TaskActionType.Unload, TaskAction.Step_QXJ_LK, uploadStations);
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);
return; //完成当前任务 退出
}
}
......@@ -313,7 +421,19 @@ namespace Siger.ApiACC.Controllers
if (freeMachine != null)
{
Logger.WriteLineInfo($"AutoProcess 普通空闲,创建普通设备上料Task");
CreateTask(freeMachine,TaskActionType.Load ,TaskAction.Step_LK_JGZX, uploadStations);
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);
return; //完成当前任务 退出
}
//优先级3:其他设备下料 (加工中心 ->立库)
......@@ -323,7 +443,19 @@ namespace Siger.ApiACC.Controllers
if (fullMachine != null && cleanMachine.status==(int)Automation.MachineStatus.Waiting)
{
Logger.WriteLineInfo($"AutoProcess 普通空闲,创建普通设备下料Task ");
CreateTask(fullMachine,TaskActionType.Unload, TaskAction.Step_JGZX_QXJ, uploadStations);
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);
return; //完成当前任务 退出
}
......@@ -338,28 +470,14 @@ namespace Siger.ApiACC.Controllers
/// <param name="actionType"></param>
/// <param name="taskAction"></param>
/// <param name="uploadStations"></param>
void CreateTask(siger_automation_machine_status machineStatus,TaskActionType actionType, TaskAction taskAction,List<string>uploadStations)
/// <param name="guid">工装GUID</param>
/// <param name="orderno">订单</param>
/// <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)
{
var uploadPostion= uploadStations.Exists(f => f.Contains(machineStatus.section.ToString()));
if (uploadPostion)
{
Logger.WriteLineInfo($"CreateTask 上料料工站 无需自动创建任务 ");
return;
}
//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
{
projectId = PID,
......@@ -374,11 +492,11 @@ namespace Siger.ApiACC.Controllers
send = 0,
operater = 0,
status = 1,
fixtureguid=monitor.fixtureguid,
productcode=monitor.productCode,
locationid=monitor.locationId,
ordercode=monitor.ordernumber,
sn=monitor.sn,
fixtureguid= guid,
productcode= productCode,
locationid= locationid,
ordercode= orderno,
sn= sn,
remark="自动任务"
});
......@@ -389,6 +507,38 @@ namespace Siger.ApiACC.Controllers
else
Logger.WriteLineInfo($"CreateTask 工站 失败");
}
/// <summary>
/// 自动匹配储位 储位 ->CNC
/// </summary>
siger_automation_location 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 planOrder = _automationFixtureToolsProduct.GetDeliveryOrder(productIds, PID);
if (!planOrder.Any())
{
Logger.WriteLineInfo($"SelectLocation 未找到最近订单号信息");
return null;
}
var order = planOrder.FirstOrDefault();
var beatset = beats.Where(f => f.product_name == order.productId.ToString());
//var routeIds = beatset.Select(s => s.id).ToList();
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}的储位信息");
return null;
}
return location.FirstOrDefault();
}
......
......@@ -30,10 +30,11 @@ namespace Siger.ApiACC.Controllers
private readonly IAutomationLocationRepository _autoLocationRepository;
private readonly IAutomationFixtureMonitor _fixtureMonitor;
private readonly IProductRouteRepository _routeRepository;
private readonly IAutomationFixtureToolsProductRepository _automationFixtureToolsProduct;
public AutomationLocationController(IUnitOfWork unitOfWork, IAutomationFixtureToolsCategoryRepository toolsCategoryRepository,
IAutomationFixtureToolsRepository toolsRepository, IAutomationLocationRepository autoLocationRepository,
IAutomationFixtureMonitor fixtureMonitor, IProductRouteRepository routeRepository)
IAutomationFixtureMonitor fixtureMonitor, IProductRouteRepository routeRepository,IAutomationFixtureToolsProductRepository automationFixtureToolsProduct)
{
_unitOfWork = unitOfWork;
_toolsCategoryRepository = toolsCategoryRepository;
......@@ -41,6 +42,7 @@ namespace Siger.ApiACC.Controllers
_autoLocationRepository = autoLocationRepository;
_fixtureMonitor = fixtureMonitor;
_routeRepository = routeRepository;
_automationFixtureToolsProduct = automationFixtureToolsProduct;
}
[HttpGet]
......@@ -192,6 +194,8 @@ namespace Siger.ApiACC.Controllers
{
throw new BadRequestException(RequestEnum.FixtureToolNotFound);
}
var fixturetoolProduct = _automationFixtureToolsProduct.Get(f => f.fixturetools == fixturetool.guid);
var location = _autoLocationRepository.GetLocation(req.locationid.ToInt(), ProjectId);
if (location == null)
{
......@@ -209,6 +213,8 @@ namespace Siger.ApiACC.Controllers
guid = Guid.NewGuid().ToString(),
locationid = location.locationid,
fixturetools = fixturetool.guid,
productid= fixturetoolProduct != null ? fixturetoolProduct.productid : 0,
productcode = fixturetoolProduct!=null? fixturetoolProduct.productcode:"",
attachment = req.fileurl,
filename = req.filename,
remark = req.remark,
......@@ -244,6 +250,7 @@ namespace Siger.ApiACC.Controllers
{
throw new BadRequestException(RequestEnum.FixtureToolNotFound);
}
var fixturetoolProduct = _automationFixtureToolsProduct.Get(f => f.fixturetools == fixturetool.guid);
var location = _autoLocationRepository.GetLocation(req.locationid.ToInt(), ProjectId);
if (location == null)
{
......@@ -263,6 +270,9 @@ namespace Siger.ApiACC.Controllers
entity.remark = req.remark;
entity.updatetime = DateTime.Now;
entity.updator = UserId;
entity.productid = fixturetoolProduct != null ? fixturetoolProduct.productid : 0;
entity.productcode = fixturetoolProduct != null ? fixturetoolProduct.productcode : "";
_autoLocationRepository.Update(entity);
if (_unitOfWork.Commit() > 0)
{
......
......@@ -35,9 +35,10 @@ namespace Siger.ApiACC.Controllers
private readonly IAutomationFixtureMonitor _automationFixtureMonitor;
private readonly IAutomationFixtureToolsProductRepository _automationFixtureToolsProduct;
private readonly IAutomationFixtureToolsRepository _automationFixtureTools;
private readonly IAutomationLocationRepository _automationLocation;
public AutomationOperateController(IUnitOfWork unitOfWork,ISigerProjectLevelSectionRepository sigerProjectLevelSection , ISigerDict sigerDict,IAutomationMachineStatus automationMachineStatus,ISigerProjectMachineAttributionRepository sigerProjectMachineAttribution,IAutomationTaskListRepository automationTaskList,
IProductPlanDetails planDetails,IProductPlanRepository productPlan,IAutomationFixtureMonitor automationFixtureMonitor ,IAutomationFixtureToolsProductRepository automationFixtureToolsProduct,IAutomationFixtureToolsRepository automationFixtureTools)
IProductPlanDetails planDetails,IProductPlanRepository productPlan,IAutomationFixtureMonitor automationFixtureMonitor ,IAutomationFixtureToolsProductRepository automationFixtureToolsProduct,IAutomationFixtureToolsRepository automationFixtureTools, IAutomationLocationRepository automationLocation)
{
_unitOfWork = unitOfWork;
_sigerProjectLevelSection = sigerProjectLevelSection;
......@@ -50,6 +51,7 @@ namespace Siger.ApiACC.Controllers
_automationFixtureMonitor = automationFixtureMonitor;
_automationFixtureToolsProduct = automationFixtureToolsProduct;
_automationFixtureTools = automationFixtureTools;
_automationLocation = automationLocation;
}
/// <summary>
......@@ -173,7 +175,7 @@ namespace Siger.ApiACC.Controllers
return new ObjectResult(result);
}
/// <summary>
/// 准备上料 -生成指令 load
/// 准备上料 -生成指令 load (立库->上料位)
/// </summary>
/// <param name="loading"></param>
/// <returns></returns>
......@@ -348,6 +350,8 @@ namespace Siger.ApiACC.Controllers
throw new BadRequestException(AccEnum.MonitorNotfound);
}
var taskNo = _automationTaskList.CrateTaskNumber(Automation.TaskTrigerType.Manual);
_automationTaskList.Insert(new siger_automation_task_list
{
......@@ -376,7 +380,6 @@ namespace Siger.ApiACC.Controllers
});
if (_unitOfWork.Commit() > 0)
{
Logger.WriteLineError($"手动任务创建成功-{Siger.Middlelayer.Common.Helpers.EnumHelper.GetEnumDesc(Automation.TaskAction.Step_SXLW_LK)}");
......
......@@ -40,9 +40,17 @@ namespace Siger.ApiACC.Controllers
public IActionResult GetPageList(string category, string code, string name, string state, int page, int pagesize, string toexcel)
{
var data = _toolsRepository.GetPagedList(category.ToInt(), code, name, string.IsNullOrEmpty(state) ? -1 : state.ToInt(), ProjectId, page, pagesize, toexcel);
var list = new List<ResponseFixtureTools>();
var categorys = _toolsCategoryRepository.GetList(q => q.projectId == ProjectId && q.status == (int)RowState.Valid).ToList();
var categoryIds = new List<int>();
if(category.ToInt() > 0)
{
var cate = categorys.FirstOrDefault(q => q.id == category.ToInt());
var sonCates = GetSonCategoryList(cate.guid, categorys);
categoryIds = sonCates.Select(q => q.id).ToList();
categoryIds.Add(category.ToInt());
}
var data = _toolsRepository.GetPagedList(categoryIds, code, name, string.IsNullOrEmpty(state) ? -1 : state.ToInt(), ProjectId, page, pagesize, toexcel);
var list = new List<ResponseFixtureTools>();
foreach(var item in data.Data)
{
var cates = GetParentCategoryList(item.cate_guid, categorys);
......@@ -258,7 +266,16 @@ namespace Siger.ApiACC.Controllers
[HttpGet]
public IActionResult GetCategoryPageList(string id, int page, int pagesize, string toexcel = "")
{
var data = _toolsCategoryRepository.GetPagedList(id.ToInt(), ProjectId, page, pagesize, toexcel);
var categorys = _toolsCategoryRepository.GetList(q => q.projectId == ProjectId && q.status == (int)RowState.Valid).ToList();
var categoryIds = new List<int>();
if (id.ToInt() > 0)
{
var cate = categorys.FirstOrDefault(q => q.id == id.ToInt());
var sonCates = GetSonCategoryList(cate.guid, categorys);
categoryIds = sonCates.Select(q => q.id).ToList();
categoryIds.Add(id.ToInt());
}
var data = _toolsCategoryRepository.GetPagedList(categoryIds, ProjectId, page, pagesize, toexcel);
if(toexcel.ToInt() == 1)
{
return ExportCategoryExcel(data.Data);
......
......@@ -38,5 +38,10 @@ namespace Siger.Middlelayer.Share.Constant
/// </summary>
public const string UploadloadStation = "LoadStation";
/// <summary>
/// 立库
/// </summary>
public const string WarehouseStation = "WarehouseStation";
}
}
......@@ -334,7 +334,9 @@ namespace Siger.Middlelayer.Common.ModuleEnum
[Description("设备已经生产完成")]
MachineProCompalate,
[Description("该设备当前无工装状态")]
MonitorNotfound
MonitorNotfound,
[Description("未配置字典信息")]
AutomationDictNotfound
}
public enum SeriNumCfg
......
......@@ -14,14 +14,13 @@ namespace Siger.Middlelayer.Utility.ImportEntities
[ExcelColumn("产品名称")]
public string ProductName { get; set; }
[ExcelColumn("工序")]
public string RouteName { get; set; }
[ExcelColumn("位置")]
public string Section { get; set; }
[ExcelColumn("工单")]
public string WorkOrder { get; set; }
[ExcelColumn("工艺")]
public string RouteName { get; set; }
[ExcelColumn("二维码")]
public string SN { get; set; }
[ExcelColumn("偏差放行数量")]
......
......@@ -18,6 +18,26 @@ namespace Siger.Middlelayer.AccRepository.Entities
/// 工装GUID
/// </summary>
public string fixturetools { get; set; }
public int productid { get; set; }
public string productcode { get; set; }
/// <summary>
/// 工件对应的工单号
/// </summary>
public string ordernumber { get; set; }
/// <summary>
/// 工装工件
/// </summary>
public string sn { get; set; }
/// <summary>
/// 每加工CNC 设备 经过的工序: 标准节拍表
/// </summary>
public int routeid { get; set; }
/// <summary>
/// 每加工CNC 设备 经过的工序: 标准节拍表
/// </summary>
public string route { get; set; }
/// <summary>
/// 附件
/// </summary>
......
......@@ -23,7 +23,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
_context = context;
}
public IPagedCollectionResult<ResponseFixtureToolsCategory> GetPagedList(int id, int projectid, int page, int pagesize, string toexcel = "")
public IPagedCollectionResult<ResponseFixtureToolsCategory> GetPagedList(List<int> id, int projectid, int page, int pagesize, string toexcel = "")
{
Expression<Func<ResponseFixtureToolsCategory, bool>> FunNum = f => true;
var query = from q in _context.siger_automation_fixture_tools_category
......@@ -41,9 +41,9 @@ namespace Siger.Middlelayer.AccRepository.Repositories
createtime = q.createtime.ToString(ParameterConstant.DateTimeFormat),
time = q.createtime
};
if (id > 0)
if (id.Any())
{
FunNum = q => q.id == id;
FunNum = q => id.Contains(q.id);
}
if(toexcel.ToInt() == 1)
{
......
......@@ -97,6 +97,28 @@ namespace Siger.Middlelayer.AccRepository.Repositories
}
}
/// <summary>
/// 获取 交期最早的订单
/// </summary>
/// <param name="productIds"></param>
/// <param name="projectId"></param>
/// <returns></returns>
public IEnumerable<ResponseAutomationPlanOrder> GetDeliveryOrder(List<int>productIds,int projectId)
{
var query = from d in _context.siger_project_product_plan_detail
join p in _context.siger_project_product_plan on d.PlanId equals p.id
where d.projectId == projectId && productIds.Contains(p.product_id) && d.status != (int)RowState.Invalid && p.status != (int)RowState.Invalid
select new ResponseAutomationPlanOrder
{
productId=p.product_id,
ordernumber=d.OrderNumber,
productCode=p.product_code,
productName=p.product_name,
delvery=p.delivery_time,
};
return query.OrderBy(f => f.delvery);
}
public ResponsePlanlFixtureInfo GetPlanFixtureInfo(int projectId, string ordernumber)
{
......
......@@ -24,7 +24,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
_context = context;
}
public IPagedCollectionResult<ResponseFixtureTools> GetPagedList(int category, string code, string name, int state,
public IPagedCollectionResult<ResponseFixtureTools> GetPagedList(List<int> category, string code, string name, int state,
int projectid, int page, int pagesize, string toexcel = "")
{
var query = from q in _context.siger_automation_fixture_tools
......@@ -53,9 +53,9 @@ namespace Siger.Middlelayer.AccRepository.Repositories
updatetime = q.updatetime.HasValue && q.updatetime > DateTime.MinValue ? q.updatetime.Value.ToString(ParameterConstant.DateTimeFormat) : ""
};
Expression<Func<ResponseFixtureTools, bool>> categoryExpression = f => true;
if (category > 0)
if (category.Any())
{
categoryExpression = q => q.categoryid == category;
categoryExpression = q => category.Contains(q.categoryid);
}
Expression<Func<ResponseFixtureTools, bool>> codeExpression = f => true;
if (!string.IsNullOrEmpty(code))
......
......@@ -35,7 +35,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
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_product_route on m.route equals r.id into rr
join r in _context.siger_project_beat_set on m.route equals r.id into rr
from r in rr.DefaultIfEmpty()
where q.projectId == projectid && q.status == (int)RowState.Valid
select new ResponseAutomationLocation
......@@ -58,8 +58,8 @@ namespace Siger.Middlelayer.AccRepository.Repositories
status = q.status,
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(),
route = r.route_name ?? "",
routenumber = r == null ? "" : r.route_number.ToString(),
cate_guid = c.guid ?? "",
categoryId = c == null ? 0 : c.id
};
......
......@@ -9,7 +9,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface
{
public interface IAutomationFixtureToolsCategoryRepository : IAccRepositoryBase<siger_automation_fixture_tools_category>
{
IPagedCollectionResult<ResponseFixtureToolsCategory> GetPagedList(int id, int projectid, int page, int pagesize, string toexcel = "");
IPagedCollectionResult<ResponseFixtureToolsCategory> GetPagedList(List<int> id, int projectid, int page, int pagesize, string toexcel = "");
CommonImportResult ImportData(IEnumerable<FixtureToolsCategoryTemplate> list, int projectid);
}
......
......@@ -23,5 +23,13 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface
CommonImportResult ImportData(IEnumerable<FixtureToolsProductTemplate> list, int projectid, int userid);
/// <summary>
/// 获取交期最近的订单
/// </summary>
/// <param name="productIds"></param>
/// <param name="projectId"></param>
/// <returns></returns>
IEnumerable<ResponseAutomationPlanOrder> GetDeliveryOrder(List<int> productIds, int projectId);
}
}
......@@ -9,7 +9,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface
{
public interface IAutomationFixtureToolsRepository : IAccRepositoryBase<siger_automation_fixture_tools>
{
IPagedCollectionResult<ResponseFixtureTools> GetPagedList(int category, string code, string name, int state,
IPagedCollectionResult<ResponseFixtureTools> GetPagedList(List<int> category, string code, string name, int state,
int projectid, int page, int pagesize, string toexcel = "");
IEnumerable<ResponseFixtureTools> GetDataList(int categoryid, int projectid);
......
......@@ -40,4 +40,15 @@ namespace Siger.Middlelayer.AccRepository.Response
public int Location { get; set; }
public string Sn { get; set; }
}
public class ResponseAutomationPlanOrder
{
public string ordernumber { get; set; }
public int productId { get; set; }
public string productCode { get; set; }
public string productName { get; set; }
public int delvery { get; set; }
}
}
......@@ -157,5 +157,7 @@ namespace Siger.Middlelayer.QmsRepository
public DbSet<siger_tr_sn_trace_detail> siger_tr_sn_trace_detail { get; set; }
public DbSet<siger_project_beat_set> siger_project_beat_set { get; set; }
}
}
using System;
using System.ComponentModel.DataAnnotations.Schema;
namespace Siger.Middlelayer.QmsRepository.Entities
{
/// <summary>
/// siger_project_beat_set Entity Model
/// </summary>
public class siger_project_beat_set: QmsEntityBase
{
/// <summary>
/// 产线id
/// </summary>
public int section_id { get; set; }
/// <summary>
/// 设备id
/// </summary>
public int machineID { get; set; }
/// <summary>
/// 加工程序号
/// </summary>
public string process_number { get; set; }
/// <summary>
/// 产品名称 编号
/// </summary>
public string product_name { get; set; }
/// <summary>
/// 产品图纸号
/// </summary>
public string drawing_number { get; set; }
/// <summary>
/// 标准节拍(单位/ 秒 S )
/// </summary>
public int standard_besat { get; set; }
/// <summary>
/// 日标准产量(单位/pcs个)
/// </summary>
public int daily_standard_output { get; set; }
/// <summary>
/// 添加时间
/// </summary>
public DateTime add_time { get; set; }
/// <summary>
/// 修改时间
/// </summary>
public DateTime? edit_time { get; set; }
/// <summary>
/// 产品名称
/// </summary>
public string product_name_text { get; set; }
/// <summary>
/// 换型时间
/// </summary>
public int changemodeltime { get; set; }
/// <summary>
/// 工序顺序
/// </summary>
public string route_number { get; set; } = "";
/// <summary>
/// 工序名称
/// </summary>
public string route_name { get; set; }
/// <summary>
/// 上下料时间
/// </summary>
public double updown_besat { get; set; }
/// <summary>
/// 产量比率
/// </summary>
public int yieldrate { get; set; }
/// <summary>
/// 有效开始时间
/// </summary>
public DateTime start_time { get; set; }
/// <summary>
/// 有效结束时间
/// </summary>
public DateTime end_time { get; set; }
}
}
......@@ -38,7 +38,7 @@ namespace Siger.Middlelayer.QmsRepository.Repositories
from m in mm.DefaultIfEmpty()
join s in _context.siger_project_level_section on q.sectionid equals s.id into ss
from s in ss.DefaultIfEmpty()
join r in _context.siger_project_product_route on q.routeid 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()
join u1 in _context.siger_project_user on q.send_mid equals u1.mid into uu1
from u1 in uu1.DefaultIfEmpty()
......@@ -60,7 +60,7 @@ namespace Siger.Middlelayer.QmsRepository.Repositories
check_time = (q.check_time.HasValue && q.check_time != DateTime.Now) ?
q.check_time.Value.ToString(ParameterConstant.DateTimeFormat) : "",
routeid = q.routeid,
routename = r.name ?? "",
routename = r.route_name ?? "",
materialid = q.materialid,
materialname = m.name ?? "",
materialpn = m.pn ?? "",
......
......@@ -34,7 +34,7 @@ namespace Siger.Middlelayer.QmsRepository.Repositories
join s in _context.siger_project_level_section on q.sectionid equals s.id
join m in _context.siger_tr_materials on q.materialid equals m.id into mm
from m in mm.DefaultIfEmpty()
join r in _context.siger_project_product_route on q.routeid 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()
join u1 in _context.siger_user on q.send_mid equals u1.id into uu1
from u1 in uu1.DefaultIfEmpty()
......@@ -58,7 +58,7 @@ namespace Siger.Middlelayer.QmsRepository.Repositories
sectionid = q.sectionid,
sectionname = s.title ?? "",
routeid = q.routeid,
routename = r.name ?? "",
routename = r.route_name ?? "",
testroom = q.testroom,
sn = q.sn,
checktype = q.check_type,
......
......@@ -269,6 +269,12 @@ CREATE TABLE IF NOT EXISTS `siger_automation_location` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`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',
`productcode` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '产品CODE',
`ordernumber` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '工件对应工单号',
`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 '工序',
`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 '备注',
......
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