diff --git a/MDM/Attribute/RIZOFlowAttribute.cs b/MDM/Attribute/RIZOFlowAttribute.cs
new file mode 100644
index 0000000..16832ba
--- /dev/null
+++ b/MDM/Attribute/RIZOFlowAttribute.cs
@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MDM.Attribute
+{
+ [AttributeUsage(AttributeTargets.Method, Inherited = false)]
+ public class RIZOFlowAttribute : System.Attribute
+ {
+ ///
+ /// 流程类型
+ ///
+ public string FlowType { get; set; }
+
+ ///
+ /// 流程码
+ ///
+ public string FlowCode { get; set; }
+
+ }
+}
diff --git a/MDM/Controllers/Session/SessionManagerController.cs b/MDM/Controllers/Session/SessionManagerController.cs
new file mode 100644
index 0000000..57fc9ca
--- /dev/null
+++ b/MDM/Controllers/Session/SessionManagerController.cs
@@ -0,0 +1,90 @@
+using DOAN.Model.MES.recipe;
+using DOAN.Model.MES.recipe.Dto;
+using DOAN.Service.MES.recipe.IService;
+using DOAN.ServiceCore.Middleware;
+using Infrastructure;
+using Infrastructure.Attribute;
+using Infrastructure.Controllers;
+using Infrastructure.Enums;
+using Mapster;
+using MDM.Models.Flow;
+using MDM.Models.Session;
+using MDM.Services.Session.IService;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Mvc;
+
+namespace MDM.Controllers.Session
+{
+
+ ///
+ /// 回会管理
+ ///
+ [Route("mes/session_managemer")]
+ [AllowAnonymous]
+ public class SessionManagerController : BaseController
+ {
+
+ ///
+ /// 会话管理接口
+ ///
+ private readonly ISessionManagerService _ISessionManagerService;
+ public SessionManagerController(ISessionManagerService ISessionManagerService)
+ {
+ _ISessionManagerService = ISessionManagerService;
+ }
+
+
+ //TODO 开工申请
+ ///
+ /// 开工申请
+ ///
+ /// 过程码
+ /// 当前工单号
+ /// 当前产线码
+ /// 当前组码
+ /// 1:开工成功 0:异常 -1:重复开工 -2 参数异常
+ [HttpGet("start_work_apply")]
+ public IActionResult StartWorkApply(string ProcessCode,string WorkOrder,string LineCode,string GroupCode)
+ {
+ if(string.IsNullOrEmpty(ProcessCode)||string.IsNullOrEmpty(WorkOrder)||string.IsNullOrEmpty(GroupCode))
+ {
+ return SUCCESS(-2);
+ }
+
+ int result= _ISessionManagerService.StartWorkApply(ProcessCode, WorkOrder, LineCode, GroupCode);
+
+ return SUCCESS(result);
+ }
+
+ //TODO 入站申请
+
+ ///
+ /// 入站申请
+ ///
+ ///
+ [HttpGet("in_station_apply")]
+ public IActionResult InStationApply(string OperationCode, string ProcessCode)
+ {
+
+ InStationApplyResult result = _ISessionManagerService.InStationApply(OperationCode, ProcessCode);
+ return SUCCESS(result);
+ }
+
+
+
+ //TODO 出站申请
+ [HttpGet("out_station_apply")]
+ public IActionResult OutStationApply(string OperationCode, string ProcessCode)
+ {
+
+ InStationApplyResult result = _ISessionManagerService.OutStationApply(OperationCode, ProcessCode);
+ return SUCCESS(result);
+ }
+
+
+
+
+
+ }
+
+}
diff --git a/MDM/Flows/CommonFlowfunction.cs b/MDM/Flows/CommonFlowfunction.cs
deleted file mode 100644
index 479cfe9..0000000
--- a/MDM/Flows/CommonFlowfunction.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-using Infrastructure.Attribute;
-using NPOI.SS.Formula.Functions;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace MDM.Flows
-{
- ///
- /// 普通流程功能函数
- ///
- [AppService(ServiceType = typeof(CommonFlowfunction), ServiceLifetime = LifeTime.Singleton)]
- public class CommonFlowfunction
- {
- ///
- /// 开工
- ///
- /// 工单号
- /// 过程码
- ///
- public static int CommenceWork(string workorder,string processcode)
- {
- return 1;
-
- }
- ///
- /// 普通入站站流程
- ///
- ///
- public static int CommonInboundStationFlow()
- {
- return 42;
- }
- }
-}
diff --git a/MDM/Flows/FlowEnums.cs b/MDM/Models/Flow/FlowEnums.cs
similarity index 57%
rename from MDM/Flows/FlowEnums.cs
rename to MDM/Models/Flow/FlowEnums.cs
index 88539e5..7933c63 100644
--- a/MDM/Flows/FlowEnums.cs
+++ b/MDM/Models/Flow/FlowEnums.cs
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace MDM.Flows
+namespace MDM.Models.Flow
{
///
/// 普通入站站流程结果枚举
@@ -68,4 +68,69 @@ namespace MDM.Flows
Reset = 0,
}
+
+ ///
+ /// 进站申请结果状态
+ ///
+ public enum InStationApplyResult
+ {
+ ///
+ /// 成功 准许进站
+ ///
+ Success = 1,
+
+ ///
+ /// 传入 参数无效,禁止入站
+ ///
+ InvalidParameters = -7,
+
+ ///
+ /// 产品未开工,禁止入站
+ ///
+ ProductNotStartWork = -2,
+
+ ///
+ /// 产品已完工,,禁止入站
+ ///
+ ProductCompleted = -3,
+
+
+
+ ///
+ /// 重复进站,,禁止入站
+ ///
+ RepeatInStation = -5,
+
+
+
+ ///
+ /// 本工序不存在,禁止入站
+ ///
+ OperationNotFound = -8,
+
+ ///
+ /// 找不到上一工序,禁止入站
+ ///
+ PreviousOperationNotFound = -9,
+
+ ///
+ /// 未知状态,,禁止入站
+ ///
+ UnknownStatus = -10,
+
+ ///
+ /// 上一工序未进站,,禁止入站
+ ///
+ PreviousOperationNotStarted = -1,
+
+ ///
+ /// 上一工序进站但未出站,,禁止入站
+ ///
+ PreviousOperationInProgress = -2,
+
+ ///
+ /// 上一工序有异常,,禁止入站
+ ///
+ PreviousOperationHasException = -3
+ }
}
diff --git a/MDM/Models/Process/ProcessOperation.cs b/MDM/Models/Process/ProcessOperation.cs
index 608f89a..75f379f 100644
--- a/MDM/Models/Process/ProcessOperation.cs
+++ b/MDM/Models/Process/ProcessOperation.cs
@@ -64,19 +64,19 @@ namespace MDM.Model.Process
/// 是否允许跳过该工序(跳站)
///
[SugarColumn(ColumnName = "is_skippable")]
- public string IsSkippable { get; set; }
+ public int IsSkippable { get; set; }
///
/// 是否允许返工
///
[SugarColumn(ColumnName = "is_reworkable")]
- public string IsReworkable { get; set; }
+ public int IsReworkable { get; set; }
///
/// 是否准许并行
///
[SugarColumn(ColumnName = "is_parallel")]
- public string IsParallel { get; set; }
+ public int IsParallel { get; set; }
///
/// 并行组编号(如有)
diff --git a/MDM/Models/Session/ProductLifecycle.cs b/MDM/Models/Session/ProductLifecycle.cs
new file mode 100644
index 0000000..226facd
--- /dev/null
+++ b/MDM/Models/Session/ProductLifecycle.cs
@@ -0,0 +1,104 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MDM.Models.Session
+{
+ ///
+ /// 产品生命周期表
+ ///
+ [SugarTable("product_lifecycle")]
+ public class ProductLifecycle
+ {
+ ///
+ /// 主键ID
+ ///
+ [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
+ public int Id { get; set; }
+
+ ///
+ /// 工单
+ ///
+ [SugarColumn(ColumnName = "workorder")]
+ public string Workorder { get; set; }
+
+
+
+ ///
+ /// 当前生产状态
+ ///
+ [SugarColumn(ColumnName = "product_status")]
+ public int ProductStatus { get; set; }
+
+
+
+
+ ///
+ /// 过程码
+ ///
+ [SugarColumn(ColumnName = "product_SN")]
+ public string ProductSN { get; set; }
+
+
+ ///
+ /// 产线码
+ ///
+ [SugarColumn(ColumnName = "line_code")]
+ public string LineCode { get; set; }
+
+
+ ///
+ /// 组码
+ ///
+ [SugarColumn(ColumnName = "group_code")]
+ public string GroupCode { get; set; }
+
+ ///
+ /// 工艺路线
+ ///
+ [SugarColumn(ColumnName = "routing_code")]
+ public string RoutingCode { get; set; }
+
+
+ ///
+ /// 产品开工时间
+ ///
+ [SugarColumn(ColumnName = "product_start_time")]
+ public DateTime? ProductStartTime { get; set; }
+
+ ///
+ /// 产品返工时间
+ ///
+ [SugarColumn(ColumnName = "product_rework_time")]
+ public DateTime? ProductReworkTime { get; set; }
+
+ ///
+ /// 产品结束时间
+ ///
+ [SugarColumn(ColumnName = "product_finish_time")]
+ public DateTime? ProductFinishTime { get; set; }
+
+ ///
+ /// 产品报废时间
+ ///
+ [SugarColumn(ColumnName = "product_scrap_time")]
+ public DateTime? ProductScrapTime { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ [SugarColumn(ColumnName = "created_time")]
+ public DateTime? CreatedTime { get; set; }
+
+ ///
+ /// 更新时间
+ ///
+ [SugarColumn(ColumnName = "updated_time")]
+ public DateTime? UpdatedTime { get; set; }
+
+
+
+ }
+}
diff --git a/MDM/Models/Session/ProductPassstationRecord.cs b/MDM/Models/Session/ProductPassstationRecord.cs
new file mode 100644
index 0000000..afa7541
--- /dev/null
+++ b/MDM/Models/Session/ProductPassstationRecord.cs
@@ -0,0 +1,114 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MDM.Models.Session
+{
+
+ ///
+ /// 过站记录表
+ ///
+ [SugarTable("product_passstation_record")]
+ public class ProductPassstationRecord
+ {
+ ///
+ /// 主键ID
+ ///
+ [SugarColumn(IsPrimaryKey = true, IsIdentity = false)] // 注意:这里没有自增标识
+ public long Id { get; set; }
+
+ ///
+ /// 工单号
+ ///
+ [SugarColumn(ColumnName = "workorder", Length = 50)]
+ public string Workorder { get; set; }
+
+ ///
+ /// 过程码
+ ///
+ [SugarColumn(ColumnName = "product_SN", Length = 100)]
+ public string ProductSN { get; set; }
+
+ ///
+ /// 工位号
+ ///
+ [SugarColumn(ColumnName = "workstationCode", Length = 50)]
+ public string WorkstationCode { get; set; }
+
+ ///
+ /// 工艺路线code
+ ///
+ [SugarColumn(ColumnName = "routingcode", Length = 50)]
+ public string Routingcode { get; set; }
+
+ ///
+ /// 工序号
+ ///
+ [SugarColumn(ColumnName = "operationCode", Length = 50)]
+ public string OperationCode { get; set; }
+
+ ///
+ /// 进站时间
+ ///
+ [SugarColumn(ColumnName = "InStationTime")]
+ public DateTime? InStationTime { get; set; }
+
+ ///
+ /// 出站时间
+ ///
+ [SugarColumn(ColumnName = "OutStationTime")]
+ public DateTime? OutStationTime { get; set; }
+
+
+ ///
+ /// 产品状态
+ ///
+ [SugarColumn(ColumnName = "prouduct_status", Length = 50)]
+ public int? ProuductStatus { get; set; }
+
+
+ ///
+ /// 停留时间,秒
+ ///
+ [SugarColumn(ColumnName = "DurationSeconds")]
+ public int? DurationSeconds { get; set; }
+
+ ///
+ /// 处理结果
+ ///
+ [SugarColumn(ColumnName = "ProcessResult")]
+ public int? ProcessResult { get; set; }
+
+ ///
+ /// 操作人员
+ ///
+ [SugarColumn(ColumnName = "operator", Length = 50)]
+ public string Operator { get; set; }
+
+ ///
+ /// 不良代码
+ ///
+ [SugarColumn(ColumnName = "NgCode", Length = 50)]
+ public string NgCode { get; set; }
+
+ ///
+ /// 不良描述
+ ///
+ [SugarColumn(ColumnName = "NgDescription", Length = 255)]
+ public string NgDescription { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ [SugarColumn(ColumnName = "created_time")]
+ public DateTime? CreatedTime { get; set; }
+
+ ///
+ /// 更新时间
+ ///
+ [SugarColumn(ColumnName = "updated_time")]
+ public DateTime? UpdatedTime { get; set; }
+ }
+}
diff --git a/MDM/Models/Session/ProductProcessData.cs b/MDM/Models/Session/ProductProcessData.cs
new file mode 100644
index 0000000..18eb3c0
--- /dev/null
+++ b/MDM/Models/Session/ProductProcessData.cs
@@ -0,0 +1,141 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MDM.Models.Session
+{
+ ///
+ /// 工艺数据采集
+ ///
+ [SugarTable("product_process_data")]
+ public class ProductProcessData
+ {
+ ///
+ /// 主键
+ ///
+ [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
+ public int Id { get; set; }
+
+ ///
+ /// 工单号
+ ///
+ [SugarColumn(ColumnName = "fk_workorder", Length = 50)]
+ public string FkWorkorder { get; set; }
+
+ ///
+ /// 产线编码(U01)
+ ///
+ [SugarColumn(ColumnName = "lineCode", Length = 50)]
+ public string LineCode { get; set; }
+
+ ///
+ /// 工位编码
+ ///
+ [SugarColumn(ColumnName = "workstationCode", Length = 50)]
+ public string WorkstationCode { get; set; }
+
+ ///
+ /// 工艺路线编码
+ ///
+ [SugarColumn(ColumnName = "routingCode", Length = 50)]
+ public string RoutingCode { get; set; }
+
+ ///
+ /// 工序编码
+ ///
+ [SugarColumn(ColumnName = "operationCode", Length = 50)]
+ public string OperationCode { get; set; }
+
+ ///
+ /// 产品编码
+ ///
+ [SugarColumn(ColumnName = "productCode", Length = 50)]
+ public string ProductCode { get; set; }
+
+ ///
+ /// 产品名称
+ ///
+ [SugarColumn(ColumnName = "productname", Length = 50)]
+ public string Productname { get; set; }
+
+ ///
+ /// SN码
+ ///
+ [SugarColumn(ColumnName = "SNnumber", Length = 50)]
+ public string SNnumber { get; set; }
+
+ ///
+ /// 参数名
+ ///
+ [SugarColumn(ColumnName = "paramter_name", Length = 50)]
+ public string ParamterName { get; set; }
+
+ ///
+ /// 标准值
+ ///
+ [SugarColumn(ColumnName = "standard_paramter_value", DecimalDigits = 2)]
+ public decimal? StandardParamterValue { get; set; }
+
+ ///
+ /// 参数值
+ ///
+ [SugarColumn(ColumnName = "real_paramter_value", DecimalDigits = 2)]
+ public decimal? RealParamterValue { get; set; }
+
+ ///
+ /// 上限
+ ///
+ [SugarColumn(ColumnName = "up_range_limit", DecimalDigits = 2)]
+ public decimal? UpRangeLimit { get; set; }
+
+ ///
+ /// 下限
+ ///
+ [SugarColumn(ColumnName = "low_range_limit", DecimalDigits = 2)]
+ public decimal? LowRangeLimit { get; set; }
+
+ ///
+ /// 单位
+ ///
+ [SugarColumn(ColumnName = "unit", Length = 50)]
+ public string Unit { get; set; }
+
+ ///
+ /// 检测结果
+ ///
+ [SugarColumn(ColumnName = "checkResult")]
+ public int? CheckResult { get; set; }
+
+ ///
+ /// 参数时间
+ ///
+ [SugarColumn(ColumnName = "paramTime")]
+ public DateTime? ParamTime { get; set; }
+
+ ///
+ /// 创建人
+ ///
+ [SugarColumn(ColumnName = "createdby", Length = 50)]
+ public string Createdby { get; set; }
+
+ ///
+ /// 更新人
+ ///
+ [SugarColumn(ColumnName = "updatedby", Length = 50)]
+ public string Updatedby { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ [SugarColumn(ColumnName = "created_time")]
+ public DateTime? CreatedTime { get; set; }
+
+ ///
+ /// 更新时间
+ ///
+ [SugarColumn(ColumnName = "updated_time")]
+ public DateTime? UpdatedTime { get; set; }
+ }
+}
diff --git a/MDM/Models/Session/ProductRunning.cs b/MDM/Models/Session/ProductRunning.cs
new file mode 100644
index 0000000..5daad0b
--- /dev/null
+++ b/MDM/Models/Session/ProductRunning.cs
@@ -0,0 +1,10 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MDM.Models.Session
+{
+
+}
diff --git a/MDM/Models/Session/ProductScanRecord.cs b/MDM/Models/Session/ProductScanRecord.cs
new file mode 100644
index 0000000..39e3b8c
--- /dev/null
+++ b/MDM/Models/Session/ProductScanRecord.cs
@@ -0,0 +1,54 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MDM.Models.Session
+{
+ [SugarTable("product_scan_record")]
+ public class ProductScanRecord
+ {
+ ///
+ /// 主键ID
+ ///
+ [SugarColumn(IsPrimaryKey = true, IsIdentity = false)] // bigint类型,非自增
+ public long Id { get; set; }
+
+ ///
+ /// 实际扫到码
+ ///
+ [SugarColumn(ColumnName = "actual_scan_code", Length = 100)]
+ public string ActualScanCode { get; set; }
+
+ ///
+ /// 期望扫到的码
+ ///
+ [SugarColumn(ColumnName = "expected_code", Length = 100)]
+ public string ExpectedCode { get; set; }
+
+ ///
+ /// 扫码结果 (建议:0-失败,1-成功)
+ ///
+ [SugarColumn(ColumnName = "scan_result")]
+ public int? ScanResult { get; set; }
+
+ ///
+ /// 错误码代号
+ ///
+ [SugarColumn(ColumnName = "error_code", Length = 50)]
+ public string ErrorCode { get; set; }
+
+ ///
+ /// 错误信息
+ ///
+ [SugarColumn(ColumnName = "error_message", Length = 255)]
+ public string ErrorMessage { get; set; }
+
+ ///
+ /// 扫码时间
+ ///
+ [SugarColumn(ColumnName = "scan_time")]
+ public DateTime? ScanTime { get; set; }
+ }
+}
diff --git a/MDM/Services/Flows/CommonFlowService.cs b/MDM/Services/Flows/CommonFlowService.cs
new file mode 100644
index 0000000..68e52bf
--- /dev/null
+++ b/MDM/Services/Flows/CommonFlowService.cs
@@ -0,0 +1,154 @@
+
+using Infrastructure.Attribute;
+using JinianNet.JNTemplate;
+using MDM.Attribute;
+using MDM.Model.Material;
+using MDM.Model.Process;
+using MDM.Models.Flow;
+using MDM.Models.Session;
+using MDM.Service;
+using NPOI.SS.Formula.Functions;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MDM.Services.Flows
+{
+ ///
+ /// 普通流程功能函数
+ ///
+ // [AppService(ServiceType = typeof(CommonFlowService), ServiceLifetime = LifeTime.Singleton)]
+ public class CommonFlowService : BaseService