已删除18个文件
已修改55个文件
已添加23个文件
已重命名2个文件
¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace WIDESEAWCS_Common.Attributes |
| | | { |
| | | public class BoolIndexAttribute : Attribute |
| | | { |
| | | public int Index { get; set; } |
| | | public BoolIndexAttribute(int index) |
| | | { |
| | | Index = index; |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Reflection; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEAWCS_Common.Attributes; |
| | | |
| | | namespace WIDESEAWCS_Common.Helper |
| | | { |
| | | public class ConvertHelper |
| | | { |
| | | public static bool[] ByteToBoolArray(byte data) |
| | | { |
| | | bool[] result = new bool[8]; |
| | | for (int i = 0; i < 8; i++) |
| | | { |
| | | result[i] = (data & (1 << i)) != 0; |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | public static T ByteToBoolObject<T>(byte data) |
| | | { |
| | | bool[] boolArray = ByteToBoolArray(data); |
| | | |
| | | Type type = typeof(T); |
| | | object? obj = Activator.CreateInstance(type); |
| | | if (obj == null) |
| | | { |
| | | throw new Exception($"ç±»åå®ä¾åé误"); |
| | | } |
| | | T result = (T)obj; |
| | | |
| | | PropertyInfo[] propertyInfos = type.GetProperties(); |
| | | foreach (PropertyInfo propertyInfo in propertyInfos) |
| | | { |
| | | BoolIndexAttribute? boolIndexAttribute = propertyInfo.GetCustomAttribute<BoolIndexAttribute>(); |
| | | if (boolIndexAttribute != null) |
| | | { |
| | | if (boolIndexAttribute.Index >= 0 && boolIndexAttribute.Index < 8) |
| | | { |
| | | propertyInfo.SetValue(result, boolArray[boolIndexAttribute.Index]); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | namespace WIDESEAWCS_Common.TaskEnum |
| | | { |
| | | /// <summary> |
| | | /// å
¥åºä»»å¡ç¶æ |
| | | /// </summary> |
| | | public enum TaskInStatusEnum |
| | | { |
| | | /// <summary> |
| | | /// æ°å»ºå
¥åºä»»å¡ |
| | | /// </summary> |
| | | [Description("æ°å»ºå
¥åºä»»å¡")] |
| | | [Description("æ°å»º")] |
| | | InNew = 200, |
| | | |
| | | ///// <summary> |
| | | ///// AGVå
¥åºæ§è¡ä¸ |
| | | ///// </summary> |
| | | //[Description("AGVå
¥åºæ§è¡ä¸")] |
| | | //AGV_InExecuting = 210, |
| | | |
| | | ///// <summary> |
| | | ///// AGVå
¥åºå®æ |
| | | ///// </summary> |
| | | //[Description("AGVæ¬è¿å®æ")] |
| | | //AGV_InFinish = 215, |
| | | |
| | | /// <summary> |
| | | /// è¾é线å
¥åºæ§è¡ä¸ |
| | | /// å åæºå¾
æ§è¡ |
| | | /// </summary> |
| | | [Description("è¾é线å
¥åºæ§è¡ä¸")] |
| | | Line_InExecuting = 220, |
| | | |
| | | /// <summary> |
| | | /// è¾é线å
¥åºå®æ |
| | | /// </summary> |
| | | [Description("è¾é线è¾é宿")] |
| | | Line_InFinish = 225, |
| | | [Description("å åæºå¾
æ§è¡")] |
| | | SC_InExecute = 225, |
| | | |
| | | /// <summary> |
| | | /// å åæºå
¥åºæ§è¡ä¸ |
| | |
| | | InFinish = 290, |
| | | |
| | | /// <summary> |
| | | /// å
¥åºä»»å¡æèµ· |
| | | /// </summary> |
| | | [Description("å
¥åºä»»å¡æèµ·")] |
| | | InPending = 297, |
| | | |
| | | /// <summary> |
| | | /// å
¥åºä»»å¡åæ¶ |
| | | /// </summary> |
| | | [Description("å
¥åºä»»å¡åæ¶")] |
| | |
| | | InException = 299, |
| | | } |
| | | |
| | | /// <summary> |
| | | /// åºåºä»»å¡ç¶æ |
| | | /// </summary> |
| | | public enum TaskOutStatusEnum |
| | | { |
| | | /// <summary> |
| | | /// æ°å»ºåºåºä»»å¡ |
| | | /// æ°å»ºä»»å¡ |
| | | /// </summary> |
| | | [Description("æ°å»ºåºåºä»»å¡")] |
| | | [Description("æ°å»º")] |
| | | OutNew = 100, |
| | | |
| | | /// <summary> |
| | | /// å åæºåºåºå¾
æ§è¡ |
| | | /// </summary> |
| | | [Description("å åæºåºåºå¾
æ§è¡")] |
| | | SC_OutExecute = 125, |
| | | |
| | | /// <summary> |
| | | /// å åæºåºåºæ§è¡ä¸ |
| | | /// </summary> |
| | | [Description("å åæºåºåºæ§è¡ä¸")] |
| | | SC_OutExecuting = 110, |
| | | SC_OutExecuting = 130, |
| | | |
| | | /// <summary> |
| | | /// å åæºåºåºå®æ |
| | | /// </summary> |
| | | [Description("å åæºåºåºå®æ")] |
| | | SC_OutFinish = 115, |
| | | |
| | | /// <summary> |
| | | /// è¾é线åºåºæ§è¡ä¸ |
| | | /// </summary> |
| | | [Description("è¾é线åºåºæ§è¡ä¸")] |
| | | Line_OutExecuting = 120, |
| | | |
| | | /// <summary> |
| | | /// è¾é线åºåºå®æ |
| | | /// </summary> |
| | | [Description("è¾é线è¾é宿")] |
| | | Line_OutFinish = 125, |
| | | |
| | | ///// <summary> |
| | | ///// AGVåºåºæ§è¡ä¸ |
| | | ///// </summary> |
| | | //[Description("AGVåºåºæ§è¡ä¸")] |
| | | //AGV_OutExecuting = 130, |
| | | |
| | | ///// <summary> |
| | | ///// AGVåºåºå®æ |
| | | ///// </summary> |
| | | //[Description("AGVæ¬è¿å®æ")] |
| | | //AGV_OutFinish = 135, |
| | | SC_OutFinish = 135, |
| | | |
| | | /// <summary> |
| | | /// åºåºä»»å¡å®æ |
| | | /// </summary> |
| | | [Description("åºåºä»»å¡å®æ")] |
| | | OutFinish = 190, |
| | | |
| | | /// <summary> |
| | | /// åºåºä»»å¡æèµ· |
| | | /// </summary> |
| | | [Description("åºåºä»»å¡æèµ·")] |
| | | OutPending = 197, |
| | | |
| | | /// <summary> |
| | | /// åºåºä»»å¡åæ¶ |
| | |
| | | /// åºåºä»»å¡å¼å¸¸ |
| | | /// </summary> |
| | | [Description("åºåºä»»å¡å¼å¸¸")] |
| | | OutException = 199, |
| | | OutException = 199 |
| | | } |
| | | } |
| | |
| | | /// <summary> |
| | | /// ä»»å¡ç¶æ |
| | | /// </summary> |
| | | public int TaskState { get; set; } |
| | | public int TaskStatus { get; set; } |
| | | |
| | | /// <summary> |
| | | /// èµ·ç¹ |
| | |
| | | public string StationName { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç«å°ç±»å <br/> |
| | | /// 1ï¼åªå
¥ <br/> |
| | | /// 2ï¼åªåº <br/> |
| | | /// 3ï¼å¯å
¥å¯åº |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "ç«å°ç±»å")] |
| | | public int StationType { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 对åºå åæºæ-å-å± |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "对åºå åæºæ-å-å±")] |
| | |
| | | /// AGVç«å°ç¼å· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "AGVç«å°ç¼å·")] |
| | | public string AGVStationCode { get; set; } |
| | | public string? AGVStationCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 夿³¨ |
| | |
| | | task.Creater = "WMS"; |
| | | if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | { |
| | | List<Dt_Router> routers = _routerService.QueryNextRoutes(item.RoadWay, item.TargetAddress); |
| | | //æä¸èèå¤è·¯å¾ |
| | | if (routers.Count > 0) |
| | | { |
| | | task.TaskState = (int)TaskOutStatusEnum.OutNew; |
| | | task.CurrentAddress = item.SourceAddress; |
| | | task.NextAddress = routers.FirstOrDefault().ChildPosi; |
| | | } |
| | | task.NextAddress = item.TargetAddress; |
| | | |
| | | } |
| | | else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup) |
| | | { |
| | | List<Dt_Router> routers = _routerService.QueryNextRoutes(item.SourceAddress, item.TargetAddress); |
| | | //æä¸èèå¤è·¯å¾ |
| | | if (routers.Count > 0) |
| | | { |
| | | task.TaskState = (int)TaskInStatusEnum.InNew; |
| | | task.CurrentAddress = item.SourceAddress; |
| | | task.NextAddress = routers.FirstOrDefault().ChildPosi; |
| | | } |
| | | task.TaskState = (int)TaskInStatusEnum.InNew; task.CurrentAddress = item.SourceAddress; |
| | | task.NextAddress = item.TargetAddress; |
| | | } |
| | | tasks.Add(task); |
| | | } |
| | |
| | | RoadWay = "SC01", |
| | | SourceAddress = sourceAddress, |
| | | TargetAddress = "SC01", |
| | | TaskState = (int)TaskInStatusEnum.InNew, |
| | | TaskStatus = (int)TaskInStatusEnum.InNew, |
| | | Id = 0, |
| | | TaskType = (int)TaskInboundTypeEnum.Inbound |
| | | }; |
| | |
| | | namespace WIDESEAWCS_Tasks |
| | | { |
| | | [DisallowConcurrentExecution] |
| | | public class CommonConveyorLineJob : IJob |
| | | public class CommonConveyorLineJob : JobBase, IJob |
| | | { |
| | | private readonly ITaskService _taskService; |
| | | private readonly ITaskExecuteDetailService _taskExecuteDetailService; |
| | |
| | | CommonConveyorLine conveyorLine = (CommonConveyorLine)context.JobDetail.JobDataMap.Get("JobParams"); |
| | | if (conveyorLine != null) |
| | | { |
| | | List<string> childDeviceCodes = _routerService.QueryAllPositions(conveyorLine.DeviceCode); |
| | | List<Task> tasks = new List<Task>(); |
| | | List<string> childDeviceCodes = new List<string>(); |
| | | |
| | | foreach (string childDeviceCode in childDeviceCodes) |
| | | { |
| | | //Task task = Task.Run(() => |
| | | //{ |
| | | ConveyorLineTaskCommand command = conveyorLine.ReadCustomer<ConveyorLineTaskCommand>(childDeviceCode); |
| | | R_ConveyorLineInfo command = conveyorLine.ReadCustomer<R_ConveyorLineInfo>(childDeviceCode); |
| | | if (command != null) |
| | | { |
| | | DeviceProtocolDetailDTO? deviceProtocolDetail = conveyorLine.DeviceProtocolDetailDTOs.FirstOrDefault(x => x.ProtocalDetailValue == command.InteractiveSignal.ToString() && x.DeviceProParamName == nameof(ConveyorLineTaskCommand.InteractiveSignal)); |
| | | if (deviceProtocolDetail != null) |
| | | { |
| | | MethodInfo? method = GetType().GetMethod(deviceProtocolDetail.ProtocolDetailType); |
| | | if (method != null) |
| | | { |
| | | method.Invoke(this, new object[] { conveyorLine, command, childDeviceCode }); |
| | | } |
| | | else |
| | | { |
| | | //todo æªæ¾å°æ¹æ³æ¶ |
| | | } |
| | | } |
| | | } |
| | | //}); |
| | | //tasks.Add(task); |
| | | } |
| | | |
| | | Task.WaitAll(tasks.ToArray()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode); |
| | | if (task != null) |
| | | { |
| | | conveyorLine.SetValue(ConveyorLineDBName.WriteInteractiveSignal, 0, childDeviceCode); |
| | | //conveyorLine.SetValue(R_ConveyorLineDBName.WriteInteractiveSignal, 0, childDeviceCode); |
| | | WebResponseContent content = _taskService.UpdateTaskStatusToNext(task); |
| | | Console.Out.WriteLine(content.Serialize()); |
| | | } |
| | |
| | | Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode); |
| | | if (task != null) |
| | | { |
| | | conveyorLine.SetValue(ConveyorLineDBName.WriteInteractiveSignal, 0, childDeviceCode); |
| | | //conveyorLine.SetValue(R_ConveyorLineDBName.WriteInteractiveSignal, 0, childDeviceCode); |
| | | WebResponseContent content = _taskService.UpdateTaskStatusToNext(task); |
| | | Console.Out.WriteLine(content.Serialize()); |
| | | } |
| | |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEAWCS_Common.Attributes; |
| | | using WIDESEAWCS_QuartzJob.DeviceBase; |
| | | |
| | | namespace WIDESEAWCS_Tasks.ConveyorLineJob |
| | |
| | | |
| | | public int TaskNum { get; set; } |
| | | } |
| | | |
| | | |
| | | public class R_ConveyorLineInfo : DeviceCommand |
| | | { |
| | | /// <summary> |
| | | /// ç«å°ç¼å· |
| | | /// </summary> |
| | | public short ConveyorNo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç¶æ |
| | | /// </summary> |
| | | public byte Status { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä»»å¡å· |
| | | /// </summary> |
| | | public int TaskNum { get; set; } |
| | | |
| | | /// <summary> |
| | | /// èµ·å§å°å |
| | | /// </summary> |
| | | public short StartPos { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç®æ å°å |
| | | /// </summary> |
| | | public short EndPos { get; set; } |
| | | |
| | | /// <summary> |
| | | /// éé |
| | | /// </summary> |
| | | public short GoodsWeight { get; set; } |
| | | |
| | | /// <summary> |
| | | /// è´§ç©ç±»å |
| | | /// </summary> |
| | | public short GoodsType { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 0鿢1åè¿2åé3ä¸å/顺æ¶éæè½¬4ä¸é/éæ¶éæè½¬ |
| | | /// </summary> |
| | | public short RunStatus { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ¡ç |
| | | /// </summary> |
| | | [DataLength(20)] |
| | | public string Barcode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// é¢ç |
| | | /// </summary> |
| | | public short Sapre1 { get; set; } |
| | | |
| | | /// <summary> |
| | | /// é¢ç |
| | | /// </summary> |
| | | public short Sapre2 { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 交äºä¿¡å· |
| | | /// </summary> |
| | | public byte Signal { get; set; } |
| | | } |
| | | |
| | | public class R_ConveyorLineStatus |
| | | { |
| | | /// <summary> |
| | | /// æ¡æä¿¡å· |
| | | /// </summary> |
| | | [BoolIndex(0)] |
| | | public bool HandShake { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 1èæº 0è±æº |
| | | /// </summary> |
| | | [BoolIndex(1)] |
| | | public bool Online { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 1ç©ºé² 0ç¹å¿ |
| | | /// </summary> |
| | | [BoolIndex(2)] |
| | | public bool Free { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 1æè´§ 0æ è´§ |
| | | /// </summary> |
| | | [BoolIndex(3)] |
| | | public bool Goods { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 1æ
é 0æ£å¸¸ |
| | | /// </summary> |
| | | [BoolIndex(4)] |
| | | public bool Alarm { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 1请æ±è¡¥ç 0æ |
| | | /// </summary> |
| | | [BoolIndex(5)] |
| | | public bool RequestPakcPallet { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 1è¯·æ±æç 0æ |
| | | /// </summary> |
| | | [BoolIndex(6)] |
| | | public bool RequestUnpackPellet { get; set; } |
| | | } |
| | | |
| | | public class R_ConveyorLineSignal |
| | | { |
| | | /// <summary> |
| | | /// 请æ±ä¿¡å· |
| | | /// </summary> |
| | | public bool STB { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ååºä¿¡å· |
| | | /// </summary> |
| | | public bool ACK { get; set; } |
| | | } |
| | | |
| | | public class W_ConveyorLineInfo |
| | | { |
| | | |
| | | /// <summary> |
| | | /// ç«å°ç¼å· |
| | | /// </summary> |
| | | public short ConveyorNo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ¡æä¿¡å· |
| | | /// </summary> |
| | | public bool HandShake { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å¤ä½æ¥è¦ |
| | | /// </summary> |
| | | public bool ClearAlarm { get; set; } |
| | | |
| | | /// <summary> |
| | | /// éå |
| | | /// </summary> |
| | | public bool Return { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä»»å¡å· |
| | | /// </summary> |
| | | public int TaskNum { get; set; } |
| | | |
| | | /// <summary> |
| | | /// èµ·å§å°å |
| | | /// </summary> |
| | | public short StartPos { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç®æ å°å |
| | | /// </summary> |
| | | public short EndPos { get; set; } |
| | | |
| | | /// <summary> |
| | | /// è´§ç©ç±»å |
| | | /// </summary> |
| | | public short GoodsType { get; set; } |
| | | |
| | | /// <summary> |
| | | /// é¢ç |
| | | /// </summary> |
| | | public short Sapre1 { get; set; } |
| | | |
| | | /// <summary> |
| | | /// é¢ç |
| | | /// </summary> |
| | | public short Sapre2 { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 请æ±ä¿¡å· |
| | | /// </summary> |
| | | public bool STB { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ååºä¿¡å· |
| | | /// </summary> |
| | | public bool ACK { get; set; } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | #region << ç æ¬ 注 é >> |
| | | /*---------------------------------------------------------------- |
| | | * å½å空é´ï¼WIDESEAWCS_Tasks.ConveyorLineJob |
| | | * å建è
ï¼è¡ç«¥åº |
| | | * å建æ¶é´ï¼2024/8/2 16:13:36 |
| | | * çæ¬ï¼V1.0.0 |
| | | * æè¿°ï¼ |
| | | * |
| | | * ---------------------------------------------------------------- |
| | | * ä¿®æ¹äººï¼ |
| | | * ä¿®æ¹æ¶é´ï¼ |
| | | * çæ¬ï¼V1.0.1 |
| | | * ä¿®æ¹è¯´æï¼ |
| | | * |
| | | *----------------------------------------------------------------*/ |
| | | #endregion << ç æ¬ 注 é >> |
| | | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace WIDESEAWCS_Tasks.ConveyorLineJob |
| | | { |
| | | public enum R_ConveyorLineDBName |
| | | { |
| | | /// <summary> |
| | | /// ç«å°ç¼å· |
| | | /// </summary> |
| | | ConveyorNo, |
| | | |
| | | /// <summary> |
| | | /// æ¡æä¿¡å· |
| | | /// </summary> |
| | | HandShake, |
| | | |
| | | /// <summary> |
| | | /// 1èæº 0è±æº |
| | | /// </summary> |
| | | Online, |
| | | |
| | | /// <summary> |
| | | /// 1ç©ºé² 0ç¹å¿ |
| | | /// </summary> |
| | | Free, |
| | | |
| | | /// <summary> |
| | | /// 1æè´§ 0æ è´§ |
| | | /// </summary> |
| | | Goods, |
| | | |
| | | /// <summary> |
| | | /// 1æ
é 0æ£å¸¸ |
| | | /// </summary> |
| | | Alarm, |
| | | |
| | | /// <summary> |
| | | /// 1请æ±è¡¥ç 0æ |
| | | /// </summary> |
| | | RequestPakcPallet, |
| | | |
| | | /// <summary> |
| | | /// 1è¯·æ±æç 0æ |
| | | /// </summary> |
| | | RequestUnpackPellet, |
| | | |
| | | /// <summary> |
| | | /// ä»»å¡å· |
| | | /// </summary> |
| | | TaskNum, |
| | | |
| | | /// <summary> |
| | | /// èµ·å§å°å |
| | | /// </summary> |
| | | StartPos, |
| | | |
| | | /// <summary> |
| | | /// ç®æ å°å |
| | | /// </summary> |
| | | EndPos, |
| | | |
| | | /// <summary> |
| | | /// éé |
| | | /// </summary> |
| | | GoodsWeight, |
| | | |
| | | /// <summary> |
| | | /// è´§ç©ç±»å |
| | | /// </summary> |
| | | GoodsType, |
| | | |
| | | /// <summary> |
| | | /// 0鿢1åè¿2åé3ä¸å/顺æ¶éæè½¬4ä¸é/éæ¶éæè½¬ |
| | | /// </summary> |
| | | RunStatus, |
| | | |
| | | /// <summary> |
| | | /// æ¡ç |
| | | /// </summary> |
| | | Barcode, |
| | | |
| | | /// <summary> |
| | | /// é¢ç |
| | | /// </summary> |
| | | Sapre1, |
| | | |
| | | /// <summary> |
| | | /// é¢ç |
| | | /// </summary> |
| | | Sapre2, |
| | | |
| | | /// <summary> |
| | | /// 请æ±ä¿¡å· |
| | | /// </summary> |
| | | STB, |
| | | |
| | | /// <summary> |
| | | /// ååºä¿¡å· |
| | | /// </summary> |
| | | ACK |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace WIDESEAWCS_Tasks.ConveyorLineJob |
| | | { |
| | | public enum W_ConveyorLineDBName |
| | | { |
| | | /// <summary> |
| | | /// ç«å°ç¼å· |
| | | /// </summary> |
| | | ConveyorNo, |
| | | |
| | | /// <summary> |
| | | /// æ¡æä¿¡å· |
| | | /// </summary> |
| | | HandShake, |
| | | |
| | | /// <summary> |
| | | /// å¤ä½æ¥è¦ |
| | | /// </summary> |
| | | ClearAlarm, |
| | | |
| | | /// <summary> |
| | | /// éå |
| | | /// </summary> |
| | | Return, |
| | | |
| | | /// <summary> |
| | | /// ä»»å¡å· |
| | | /// </summary> |
| | | TaskNum, |
| | | |
| | | /// <summary> |
| | | /// èµ·å§å°å |
| | | /// </summary> |
| | | StartPos, |
| | | |
| | | /// <summary> |
| | | /// ç®æ å°å |
| | | /// </summary> |
| | | EndPos, |
| | | |
| | | /// <summary> |
| | | /// è´§ç©ç±»å |
| | | /// </summary> |
| | | GoodsType, |
| | | |
| | | /// <summary> |
| | | /// é¢ç1 |
| | | /// </summary> |
| | | Sapre1, |
| | | |
| | | /// <summary> |
| | | /// é¢ç2 |
| | | /// </summary> |
| | | Sapre2, |
| | | |
| | | /// <summary> |
| | | /// 请æ±ä¿¡å· |
| | | /// </summary> |
| | | STB, |
| | | |
| | | /// <summary> |
| | | /// ååºä¿¡å· |
| | | /// </summary> |
| | | ACK |
| | | |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using Microsoft.AspNetCore.Components.Routing; |
| | | using Quartz; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Diagnostics.CodeAnalysis; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_Core.Enums; |
| | | using WIDESEAWCS_IBasicInfoRepository; |
| | | using WIDESEAWCS_ITaskInfoRepository; |
| | | using WIDESEAWCS_ITaskInfoService; |
| | | using WIDESEAWCS_Model.Models; |
| | | using WIDESEAWCS_QuartzJob; |
| | | using WIDESEAWCS_QuartzJob.DeviceBase; |
| | | using WIDESEAWCS_QuartzJob.Models; |
| | | using WIDESEAWCS_QuartzJob.Service; |
| | | using WIDESEAWCS_QuartzJob.StackerCrane.Enum; |
| | | using WIDESEAWCS_Tasks.HoisterJob; |
| | | using WIDESEAWCS_Tasks.StackerCraneJob; |
| | | using WIDESEAWCS_Tasks.é»çä»; |
| | | |
| | | namespace WIDESEAWCS_Tasks |
| | | { |
| | | [DisallowConcurrentExecution] |
| | | public class StackerCraneJob_PP : JobBase, IJob |
| | | { |
| | | private readonly ITaskService _taskService; |
| | | private readonly ITaskExecuteDetailService _taskExecuteDetailService; |
| | | private readonly ITaskRepository _taskRepository; |
| | | private readonly IRouterService _routerService; |
| | | private readonly IStationMangerRepository _stationMangerRepository; |
| | | |
| | | public StackerCraneJob_PP(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IRouterService routerService, IStationMangerRepository stationMangerRepository) |
| | | { |
| | | _taskService = taskService; |
| | | _taskExecuteDetailService = taskExecuteDetailService; |
| | | _taskRepository = taskRepository; |
| | | _routerService = routerService; |
| | | _stationMangerRepository = stationMangerRepository; |
| | | } |
| | | |
| | | public Task Execute(IJobExecutionContext context) |
| | | { |
| | | try |
| | | { |
| | | CommonStackerCrane commonStackerCrane = (CommonStackerCrane)context.JobDetail.JobDataMap.Get("JobParams"); |
| | | if (commonStackerCrane != null) |
| | | { |
| | | if (!commonStackerCrane.IsEventSubscribed) |
| | | { |
| | | commonStackerCrane.StackerCraneTaskCompletedEventHandler += CommonStackerCrane_StackerCraneTaskCompletedEventHandler;//订é
ä»»å¡å®æäºä»¶ |
| | | } |
| | | |
| | | if (commonStackerCrane.StackerCraneAutoStatusValue == StackerCraneAutoStatus.Automatic && commonStackerCrane.StackerCraneStatusValue == StackerCraneStatus.Normal) |
| | | { |
| | | commonStackerCrane.CheckStackerCraneTaskCompleted();//鲿¢ä»»å¡å®æäºä»¶çæµè¶
æ¶ï¼åæå¨è§¦å䏿¬¡ |
| | | |
| | | if (commonStackerCrane.StackerCraneWorkStatusValue == StackerCraneWorkStatus.Standby) |
| | | { |
| | | Dt_Task? task = GetTask(commonStackerCrane); |
| | | if (task != null) |
| | | { |
| | | StackerCraneTaskCommand? stackerCraneTaskCommand = ConvertToStackerCraneTaskCommand(task); |
| | | if (stackerCraneTaskCommand != null) |
| | | { |
| | | bool sendFlag = commonStackerCrane.SendCommand(stackerCraneTaskCommand); |
| | | if (sendFlag) |
| | | { |
| | | commonStackerCrane.LastTaskType = task.TaskType; |
| | | _taskService.UpdateTaskStatusToNext(task.TaskNum); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | WriteError(nameof(CommonStackerCraneJob), ex.Message, ex); |
| | | } |
| | | return Task.CompletedTask; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ä»»å¡å®æäºä»¶è®¢é
çæ¹æ³ |
| | | /// </summary> |
| | | /// <param name="sender"></param> |
| | | /// <param name="e"></param> |
| | | private void CommonStackerCrane_StackerCraneTaskCompletedEventHandler(object? sender, WIDESEAWCS_QuartzJob.StackerCrane.StackerCraneTaskCompletedEventArgs e) |
| | | { |
| | | CommonStackerCrane? commonStackerCrane = sender as CommonStackerCrane; |
| | | if (commonStackerCrane != null) |
| | | { |
| | | if (commonStackerCrane.GetValue<StackerCraneDBName, short>(StackerCraneDBName.WorkType) != 5) |
| | | { |
| | | Console.Out.WriteLine("TaskCompleted" + e.TaskNum); |
| | | _taskService.StackCraneTaskCompleted(e.TaskNum); |
| | | commonStackerCrane.SetValue(StackerCraneDBName.WorkType, 5); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// è·åä»»å¡ |
| | | /// </summary> |
| | | /// <param name="commonStackerCrane">å åæºå¯¹è±¡</param> |
| | | /// <returns></returns> |
| | | private Dt_Task? GetTask(CommonStackerCrane commonStackerCrane) |
| | | { |
| | | Dt_Task task; |
| | | if (commonStackerCrane.LastTaskType == null) |
| | | { |
| | | task = _taskService.QueryStackerCraneTask(commonStackerCrane.DeviceCode); |
| | | } |
| | | else |
| | | { |
| | | if (commonStackerCrane.LastTaskType.GetValueOrDefault().GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | { |
| | | task = _taskService.QueryStackerCraneInTask(commonStackerCrane.DeviceCode); |
| | | if (task == null) |
| | | { |
| | | task = _taskService.QueryStackerCraneOutTask(commonStackerCrane.DeviceCode); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | task = _taskService.QueryStackerCraneOutTask(commonStackerCrane.DeviceCode); |
| | | if (task == null) |
| | | { |
| | | task = _taskService.QueryStackerCraneInTask(commonStackerCrane.DeviceCode); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | { |
| | | if (OutTaskStationIsOccupied(task) != null || true) |
| | | { |
| | | return task; |
| | | } |
| | | else |
| | | { |
| | | List<string> otherOutStaionCodes = _routerService.QueryNextRoutes(commonStackerCrane.DeviceCode, task.NextAddress).Select(x => x.ChildPosi).ToList(); |
| | | List<Dt_Task> tasks = _taskService.QueryStackerCraneOutTasks(commonStackerCrane.DeviceCode, otherOutStaionCodes); |
| | | foreach (var item in tasks) |
| | | { |
| | | if (OutTaskStationIsOccupied(task) != null) |
| | | { |
| | | return task; |
| | | } |
| | | } |
| | | task = _taskService.QueryStackerCraneInTask(commonStackerCrane.DeviceCode); |
| | | } |
| | | } |
| | | |
| | | return task; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// åºåºä»»å¡å¤æåºåºç«å°æ¯å¦è¢«å ç¨ |
| | | /// </summary> |
| | | /// <param name="task">ä»»å¡å®ä½</param> |
| | | /// <returns>妿æªè¢«å ç¨ï¼è¿åä¼ å
¥çä»»å¡ä¿¡æ¯ï¼å¦åï¼è¿ånull</returns> |
| | | private Dt_Task? OutTaskStationIsOccupied([NotNull] Dt_Task task) |
| | | { |
| | | Dt_StationManger? stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == task.TargetAddress && x.StackerCraneCode == task.Roadway); |
| | | if (stationManger != null) |
| | | { |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode); |
| | | if (device != null) |
| | | { |
| | | OtherDevice client = (OtherDevice)device; |
| | | if (client.GetValue<GroundStationDBName, bool>(GroundStationDBName.R_IsCanPut, stationManger.StationCode))//åºåºç«å°æªè¢«å ç¨ |
| | | { |
| | | task.TargetAddress = stationManger.StackerCraneStationCode; |
| | | _taskRepository.UpdateData(task); |
| | | return task; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"æªæ¾å°åºåºç«å°ã{stationManger.StationDeviceCode}ã对åºçéè®¯å¯¹è±¡ï¼æ æ³å¤æåºåºç«å°æ¯å¦è¢«å ç¨"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"æªæ¾å°ç«å°ã{task.NextAddress}ãä¿¡æ¯ï¼æ æ³æ ¡éªç«å°"); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ä»»å¡å®ä½è½¬æ¢æå½ä»¤Model |
| | | /// </summary> |
| | | /// <param name="task">ä»»å¡å®ä½</param> |
| | | /// <returns></returns> |
| | | /// <exception cref="Exception"></exception> |
| | | public StackerCraneTaskCommand? ConvertToStackerCraneTaskCommand([NotNull] Dt_Task task) |
| | | { |
| | | StackerCraneTaskCommand stackerCraneTaskCommand = new StackerCraneTaskCommand(); |
| | | |
| | | stackerCraneTaskCommand.Barcode = task.PalletCode; |
| | | stackerCraneTaskCommand.TaskNum = task.TaskNum; |
| | | stackerCraneTaskCommand.WorkType = 1; |
| | | stackerCraneTaskCommand.TrayType = 1; |
| | | if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)//夿æ¯å¦æ¯å
¥åºä»»å¡ |
| | | { |
| | | //List<Dt_Router> routers = _routerService.QueryNextRoutes(task.CurrentAddress, task.Roadway); |
| | | //if (routers.Count > 0) |
| | | //{ |
| | | string[] startCodes = task.CurrentAddress.Split("-"); |
| | | |
| | | stackerCraneTaskCommand.StartRow = Convert.ToInt16(startCodes[0]); |
| | | stackerCraneTaskCommand.StartColumn = Convert.ToInt16(startCodes[1]); |
| | | stackerCraneTaskCommand.StartLayer = Convert.ToInt16(startCodes[2]); |
| | | |
| | | string[] targetCodes = task.NextAddress.Split("-"); |
| | | if (targetCodes.Length == 3) |
| | | { |
| | | stackerCraneTaskCommand.EndRow = Convert.ToInt16(targetCodes[0]); |
| | | stackerCraneTaskCommand.EndColumn = Convert.ToInt16(targetCodes[1]); |
| | | stackerCraneTaskCommand.EndLayer = Convert.ToInt16(targetCodes[2]); |
| | | } |
| | | else |
| | | { |
| | | //æ°æ®é
ç½®é误 |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"å
¥åºä»»å¡ç»ç¹é误ï¼èµ·ç¹ï¼ã{task.NextAddress}ã"); |
| | | return null; |
| | | } |
| | | //} |
| | | //else |
| | | //{ |
| | | // _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"æªæ¾å°ç«å°ã{task.NextAddress}ãä¿¡æ¯ï¼æ æ³è·å对åºçå åæºåè´§ç«å°ä¿¡æ¯"); |
| | | // return null; |
| | | //} |
| | | } |
| | | else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | { |
| | | //List<Dt_Router> routers = _routerService.QueryNextRoutes(task.Roadway, task.TargetAddress); |
| | | //if (routers.Count > 0) |
| | | { |
| | | string[] targetCodes = task.NextAddress.Split("-"); |
| | | |
| | | stackerCraneTaskCommand.EndRow = Convert.ToInt16(targetCodes[0]); |
| | | stackerCraneTaskCommand.EndColumn = Convert.ToInt16(targetCodes[1]); |
| | | stackerCraneTaskCommand.EndLayer = Convert.ToInt16(targetCodes[2]); |
| | | |
| | | string[] sourceCodes = task.CurrentAddress.Split("-"); |
| | | if (sourceCodes.Length == 3) |
| | | { |
| | | stackerCraneTaskCommand.StartRow = Convert.ToInt16(sourceCodes[0]); |
| | | stackerCraneTaskCommand.StartColumn = Convert.ToInt16(sourceCodes[1]); |
| | | stackerCraneTaskCommand.StartLayer = Convert.ToInt16(sourceCodes[2]); |
| | | } |
| | | else |
| | | { |
| | | //æ°æ®é
ç½®é误 |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"åºåºä»»å¡èµ·ç¹é误ï¼èµ·ç¹ï¼ã{task.CurrentAddress}ã"); |
| | | return null; |
| | | } |
| | | } |
| | | //else |
| | | //{ |
| | | // _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"æªæ¾å°ç«å°ã{task.NextAddress}ãä¿¡æ¯ï¼æ æ³è·å对åºçå åæºæ¾è´§ç«å°ä¿¡æ¯"); |
| | | // return null; |
| | | //} |
| | | } |
| | | else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.RelocationGroup) |
| | | { |
| | | string[] targetCodes = task.NextAddress.Split("-"); |
| | | if (targetCodes.Length == 3) |
| | | { |
| | | stackerCraneTaskCommand.EndRow = Convert.ToInt16(targetCodes[0]); |
| | | stackerCraneTaskCommand.EndColumn = Convert.ToInt16(targetCodes[1]); |
| | | stackerCraneTaskCommand.EndLayer = Convert.ToInt16(targetCodes[2]); |
| | | } |
| | | else |
| | | { |
| | | //æ°æ®é
ç½®é误 |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"ç§»åºä»»å¡ç»ç¹é误ï¼èµ·ç¹ï¼ã{task.NextAddress}ã"); |
| | | return null; |
| | | } |
| | | string[] sourceCodes = task.CurrentAddress.Split("-"); |
| | | if (sourceCodes.Length == 3) |
| | | { |
| | | stackerCraneTaskCommand.StartRow = Convert.ToInt16(sourceCodes[0]); |
| | | stackerCraneTaskCommand.StartColumn = Convert.ToInt16(sourceCodes[1]); |
| | | stackerCraneTaskCommand.StartLayer = Convert.ToInt16(sourceCodes[2]); |
| | | } |
| | | else |
| | | { |
| | | //æ°æ®é
ç½®é误 |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"ç§»åºä»»å¡èµ·ç¹é误ï¼èµ·ç¹ï¼ã{task.CurrentAddress}ã"); |
| | | return null; |
| | | } |
| | | } |
| | | return stackerCraneTaskCommand; |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using Microsoft.AspNetCore.Components.Routing; |
| | | using Quartz; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Diagnostics.CodeAnalysis; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_Core.Enums; |
| | | using WIDESEAWCS_IBasicInfoRepository; |
| | | using WIDESEAWCS_ITaskInfoRepository; |
| | | using WIDESEAWCS_ITaskInfoService; |
| | | using WIDESEAWCS_Model.Models; |
| | | using WIDESEAWCS_QuartzJob; |
| | | using WIDESEAWCS_QuartzJob.DeviceBase; |
| | | using WIDESEAWCS_QuartzJob.Models; |
| | | using WIDESEAWCS_QuartzJob.Service; |
| | | using WIDESEAWCS_QuartzJob.StackerCrane.Enum; |
| | | using WIDESEAWCS_Tasks.HoisterJob; |
| | | using WIDESEAWCS_Tasks.StackerCraneJob; |
| | | using WIDESEAWCS_Tasks.é»çä»; |
| | | |
| | | namespace WIDESEAWCS_Tasks |
| | | { |
| | | [DisallowConcurrentExecution] |
| | | public class StackerCraneJob_GM : JobBase, IJob |
| | | { |
| | | private readonly ITaskService _taskService; |
| | | private readonly ITaskExecuteDetailService _taskExecuteDetailService; |
| | | private readonly ITaskRepository _taskRepository; |
| | | private readonly IRouterService _routerService; |
| | | private readonly IStationMangerRepository _stationMangerRepository; |
| | | |
| | | public StackerCraneJob_GM(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IRouterService routerService, IStationMangerRepository stationMangerRepository) |
| | | { |
| | | _taskService = taskService; |
| | | _taskExecuteDetailService = taskExecuteDetailService; |
| | | _taskRepository = taskRepository; |
| | | _routerService = routerService; |
| | | _stationMangerRepository = stationMangerRepository; |
| | | } |
| | | |
| | | public Task Execute(IJobExecutionContext context) |
| | | { |
| | | try |
| | | { |
| | | CommonStackerCrane commonStackerCrane = (CommonStackerCrane)context.JobDetail.JobDataMap.Get("JobParams"); |
| | | if (commonStackerCrane != null) |
| | | { |
| | | if (!commonStackerCrane.IsEventSubscribed) |
| | | { |
| | | commonStackerCrane.StackerCraneTaskCompletedEventHandler += CommonStackerCrane_StackerCraneTaskCompletedEventHandler;//订é
ä»»å¡å®æäºä»¶ |
| | | } |
| | | |
| | | if (commonStackerCrane.StackerCraneAutoStatusValue == StackerCraneAutoStatus.Automatic && commonStackerCrane.StackerCraneStatusValue == StackerCraneStatus.Normal) |
| | | { |
| | | commonStackerCrane.CheckStackerCraneTaskCompleted();//鲿¢ä»»å¡å®æäºä»¶çæµè¶
æ¶ï¼åæå¨è§¦å䏿¬¡ |
| | | |
| | | if (commonStackerCrane.StackerCraneWorkStatusValue == StackerCraneWorkStatus.Standby) |
| | | { |
| | | Dt_Task? task = GetTask(commonStackerCrane); |
| | | if (task != null) |
| | | { |
| | | StackerCraneTaskCommand? stackerCraneTaskCommand = ConvertToStackerCraneTaskCommand(task); |
| | | if (stackerCraneTaskCommand != null) |
| | | { |
| | | bool sendFlag = commonStackerCrane.SendCommand(stackerCraneTaskCommand); |
| | | if (sendFlag) |
| | | { |
| | | commonStackerCrane.LastTaskType = task.TaskType; |
| | | _taskService.UpdateTaskStatusToNext(task.TaskNum); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | WriteError(nameof(CommonStackerCraneJob), ex.Message, ex); |
| | | } |
| | | return Task.CompletedTask; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ä»»å¡å®æäºä»¶è®¢é
çæ¹æ³ |
| | | /// </summary> |
| | | /// <param name="sender"></param> |
| | | /// <param name="e"></param> |
| | | private void CommonStackerCrane_StackerCraneTaskCompletedEventHandler(object? sender, WIDESEAWCS_QuartzJob.StackerCrane.StackerCraneTaskCompletedEventArgs e) |
| | | { |
| | | CommonStackerCrane? commonStackerCrane = sender as CommonStackerCrane; |
| | | if (commonStackerCrane != null) |
| | | { |
| | | if (commonStackerCrane.GetValue<StackerCraneDBName, short>(StackerCraneDBName.WorkType) != 5) |
| | | { |
| | | Console.Out.WriteLine("TaskCompleted" + e.TaskNum); |
| | | _taskService.StackCraneTaskCompleted(e.TaskNum); |
| | | commonStackerCrane.SetValue(StackerCraneDBName.WorkType, 5); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// è·åä»»å¡ |
| | | /// </summary> |
| | | /// <param name="commonStackerCrane">å åæºå¯¹è±¡</param> |
| | | /// <returns></returns> |
| | | private Dt_Task? GetTask(CommonStackerCrane commonStackerCrane) |
| | | { |
| | | Dt_Task task; |
| | | if (commonStackerCrane.LastTaskType == null) |
| | | { |
| | | task = _taskService.QueryStackerCraneTask(commonStackerCrane.DeviceCode); |
| | | } |
| | | else |
| | | { |
| | | if (commonStackerCrane.LastTaskType.GetValueOrDefault().GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | { |
| | | task = _taskService.QueryStackerCraneInTask(commonStackerCrane.DeviceCode); |
| | | if (task == null) |
| | | { |
| | | task = _taskService.QueryStackerCraneOutTask(commonStackerCrane.DeviceCode); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | task = _taskService.QueryStackerCraneOutTask(commonStackerCrane.DeviceCode); |
| | | if (task == null) |
| | | { |
| | | task = _taskService.QueryStackerCraneInTask(commonStackerCrane.DeviceCode); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | { |
| | | if (OutTaskStationIsOccupied(task) != null || true) |
| | | { |
| | | return task; |
| | | } |
| | | else |
| | | { |
| | | List<string> otherOutStaionCodes = _routerService.QueryNextRoutes(commonStackerCrane.DeviceCode, task.NextAddress).Select(x => x.ChildPosi).ToList(); |
| | | List<Dt_Task> tasks = _taskService.QueryStackerCraneOutTasks(commonStackerCrane.DeviceCode, otherOutStaionCodes); |
| | | foreach (var item in tasks) |
| | | { |
| | | if (OutTaskStationIsOccupied(task) != null) |
| | | { |
| | | return task; |
| | | } |
| | | } |
| | | task = _taskService.QueryStackerCraneInTask(commonStackerCrane.DeviceCode); |
| | | } |
| | | } |
| | | |
| | | return task; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// åºåºä»»å¡å¤æåºåºç«å°æ¯å¦è¢«å ç¨ |
| | | /// </summary> |
| | | /// <param name="task">ä»»å¡å®ä½</param> |
| | | /// <returns>妿æªè¢«å ç¨ï¼è¿åä¼ å
¥çä»»å¡ä¿¡æ¯ï¼å¦åï¼è¿ånull</returns> |
| | | private Dt_Task? OutTaskStationIsOccupied([NotNull] Dt_Task task) |
| | | { |
| | | Dt_StationManger? stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == task.TargetAddress && x.StackerCraneCode == task.Roadway); |
| | | if (stationManger != null) |
| | | { |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode); |
| | | if (device != null) |
| | | { |
| | | OtherDevice client = (OtherDevice)device; |
| | | if (client.GetValue<GroundStationDBName, bool>(GroundStationDBName.R_IsCanPut, stationManger.StationCode))//åºåºç«å°æªè¢«å ç¨ |
| | | { |
| | | task.TargetAddress = stationManger.StackerCraneStationCode; |
| | | _taskRepository.UpdateData(task); |
| | | return task; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"æªæ¾å°åºåºç«å°ã{stationManger.StationDeviceCode}ã对åºçéè®¯å¯¹è±¡ï¼æ æ³å¤æåºåºç«å°æ¯å¦è¢«å ç¨"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"æªæ¾å°ç«å°ã{task.NextAddress}ãä¿¡æ¯ï¼æ æ³æ ¡éªç«å°"); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ä»»å¡å®ä½è½¬æ¢æå½ä»¤Model |
| | | /// </summary> |
| | | /// <param name="task">ä»»å¡å®ä½</param> |
| | | /// <returns></returns> |
| | | /// <exception cref="Exception"></exception> |
| | | public StackerCraneTaskCommand? ConvertToStackerCraneTaskCommand([NotNull] Dt_Task task) |
| | | { |
| | | StackerCraneTaskCommand stackerCraneTaskCommand = new StackerCraneTaskCommand(); |
| | | |
| | | stackerCraneTaskCommand.Barcode = task.PalletCode; |
| | | stackerCraneTaskCommand.TaskNum = task.TaskNum; |
| | | stackerCraneTaskCommand.WorkType = 1; |
| | | stackerCraneTaskCommand.TrayType = 1; |
| | | if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)//夿æ¯å¦æ¯å
¥åºä»»å¡ |
| | | { |
| | | //List<Dt_Router> routers = _routerService.QueryNextRoutes(task.CurrentAddress, task.Roadway); |
| | | //if (routers.Count > 0) |
| | | //{ |
| | | string[] startCodes = task.CurrentAddress.Split("-"); |
| | | |
| | | stackerCraneTaskCommand.StartRow = Convert.ToInt16(startCodes[0]); |
| | | stackerCraneTaskCommand.StartColumn = Convert.ToInt16(startCodes[1]); |
| | | stackerCraneTaskCommand.StartLayer = Convert.ToInt16(startCodes[2]); |
| | | |
| | | string[] targetCodes = task.NextAddress.Split("-"); |
| | | if (targetCodes.Length == 3) |
| | | { |
| | | stackerCraneTaskCommand.EndRow = Convert.ToInt16(targetCodes[0]); |
| | | stackerCraneTaskCommand.EndColumn = Convert.ToInt16(targetCodes[1]); |
| | | stackerCraneTaskCommand.EndLayer = Convert.ToInt16(targetCodes[2]); |
| | | } |
| | | else |
| | | { |
| | | //æ°æ®é
ç½®é误 |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"å
¥åºä»»å¡ç»ç¹é误ï¼èµ·ç¹ï¼ã{task.NextAddress}ã"); |
| | | return null; |
| | | } |
| | | //} |
| | | //else |
| | | //{ |
| | | // _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"æªæ¾å°ç«å°ã{task.NextAddress}ãä¿¡æ¯ï¼æ æ³è·å对åºçå åæºåè´§ç«å°ä¿¡æ¯"); |
| | | // return null; |
| | | //} |
| | | } |
| | | else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | { |
| | | //List<Dt_Router> routers = _routerService.QueryNextRoutes(task.Roadway, task.TargetAddress); |
| | | //if (routers.Count > 0) |
| | | { |
| | | string[] targetCodes = task.NextAddress.Split("-"); |
| | | |
| | | stackerCraneTaskCommand.EndRow = Convert.ToInt16(targetCodes[0]); |
| | | stackerCraneTaskCommand.EndColumn = Convert.ToInt16(targetCodes[1]); |
| | | stackerCraneTaskCommand.EndLayer = Convert.ToInt16(targetCodes[2]); |
| | | |
| | | string[] sourceCodes = task.CurrentAddress.Split("-"); |
| | | if (sourceCodes.Length == 3) |
| | | { |
| | | stackerCraneTaskCommand.StartRow = Convert.ToInt16(sourceCodes[0]); |
| | | stackerCraneTaskCommand.StartColumn = Convert.ToInt16(sourceCodes[1]); |
| | | stackerCraneTaskCommand.StartLayer = Convert.ToInt16(sourceCodes[2]); |
| | | } |
| | | else |
| | | { |
| | | //æ°æ®é
ç½®é误 |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"åºåºä»»å¡èµ·ç¹é误ï¼èµ·ç¹ï¼ã{task.CurrentAddress}ã"); |
| | | return null; |
| | | } |
| | | } |
| | | //else |
| | | //{ |
| | | // _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"æªæ¾å°ç«å°ã{task.NextAddress}ãä¿¡æ¯ï¼æ æ³è·å对åºçå åæºæ¾è´§ç«å°ä¿¡æ¯"); |
| | | // return null; |
| | | //} |
| | | } |
| | | else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.RelocationGroup) |
| | | { |
| | | string[] targetCodes = task.NextAddress.Split("-"); |
| | | if (targetCodes.Length == 3) |
| | | { |
| | | stackerCraneTaskCommand.EndRow = Convert.ToInt16(targetCodes[0]); |
| | | stackerCraneTaskCommand.EndColumn = Convert.ToInt16(targetCodes[1]); |
| | | stackerCraneTaskCommand.EndLayer = Convert.ToInt16(targetCodes[2]); |
| | | } |
| | | else |
| | | { |
| | | //æ°æ®é
ç½®é误 |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"ç§»åºä»»å¡ç»ç¹é误ï¼èµ·ç¹ï¼ã{task.NextAddress}ã"); |
| | | return null; |
| | | } |
| | | string[] sourceCodes = task.CurrentAddress.Split("-"); |
| | | if (sourceCodes.Length == 3) |
| | | { |
| | | stackerCraneTaskCommand.StartRow = Convert.ToInt16(sourceCodes[0]); |
| | | stackerCraneTaskCommand.StartColumn = Convert.ToInt16(sourceCodes[1]); |
| | | stackerCraneTaskCommand.StartLayer = Convert.ToInt16(sourceCodes[2]); |
| | | } |
| | | else |
| | | { |
| | | //æ°æ®é
ç½®é误 |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"ç§»åºä»»å¡èµ·ç¹é误ï¼èµ·ç¹ï¼ã{task.CurrentAddress}ã"); |
| | | return null; |
| | | } |
| | | } |
| | | return stackerCraneTaskCommand; |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using Microsoft.AspNetCore.Components.Routing; |
| | | using Quartz; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Diagnostics.CodeAnalysis; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_Core.Enums; |
| | | using WIDESEAWCS_IBasicInfoRepository; |
| | | using WIDESEAWCS_ITaskInfoRepository; |
| | | using WIDESEAWCS_ITaskInfoService; |
| | | using WIDESEAWCS_Model.Models; |
| | | using WIDESEAWCS_QuartzJob; |
| | | using WIDESEAWCS_QuartzJob.DeviceBase; |
| | | using WIDESEAWCS_QuartzJob.Models; |
| | | using WIDESEAWCS_QuartzJob.Service; |
| | | using WIDESEAWCS_QuartzJob.StackerCrane.Enum; |
| | | using WIDESEAWCS_Tasks.HoisterJob; |
| | | using WIDESEAWCS_Tasks.StackerCraneJob; |
| | | using WIDESEAWCS_Tasks.é»çä»; |
| | | |
| | | namespace WIDESEAWCS_Tasks |
| | | { |
| | | [DisallowConcurrentExecution] |
| | | public class StackerCraneJob_BC : JobBase, IJob |
| | | { |
| | | private readonly ITaskService _taskService; |
| | | private readonly ITaskExecuteDetailService _taskExecuteDetailService; |
| | | private readonly ITaskRepository _taskRepository; |
| | | private readonly IRouterService _routerService; |
| | | private readonly IStationMangerRepository _stationMangerRepository; |
| | | |
| | | public StackerCraneJob_BC(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IRouterService routerService, IStationMangerRepository stationMangerRepository) |
| | | { |
| | | _taskService = taskService; |
| | | _taskExecuteDetailService = taskExecuteDetailService; |
| | | _taskRepository = taskRepository; |
| | | _routerService = routerService; |
| | | _stationMangerRepository = stationMangerRepository; |
| | | } |
| | | |
| | | public Task Execute(IJobExecutionContext context) |
| | | { |
| | | try |
| | | { |
| | | CommonStackerCrane commonStackerCrane = (CommonStackerCrane)context.JobDetail.JobDataMap.Get("JobParams"); |
| | | if (commonStackerCrane != null) |
| | | { |
| | | if (!commonStackerCrane.IsEventSubscribed) |
| | | { |
| | | commonStackerCrane.StackerCraneTaskCompletedEventHandler += CommonStackerCrane_StackerCraneTaskCompletedEventHandler;//订é
ä»»å¡å®æäºä»¶ |
| | | } |
| | | |
| | | if (commonStackerCrane.StackerCraneAutoStatusValue == StackerCraneAutoStatus.Automatic && commonStackerCrane.StackerCraneStatusValue == StackerCraneStatus.Normal) |
| | | { |
| | | commonStackerCrane.CheckStackerCraneTaskCompleted();//鲿¢ä»»å¡å®æäºä»¶çæµè¶
æ¶ï¼åæå¨è§¦å䏿¬¡ |
| | | |
| | | if (commonStackerCrane.StackerCraneWorkStatusValue == StackerCraneWorkStatus.Standby) |
| | | { |
| | | Dt_Task? task = GetTask(commonStackerCrane); |
| | | if (task != null) |
| | | { |
| | | StackerCraneTaskCommand? stackerCraneTaskCommand = ConvertToStackerCraneTaskCommand(task); |
| | | if (stackerCraneTaskCommand != null) |
| | | { |
| | | bool sendFlag = commonStackerCrane.SendCommand(stackerCraneTaskCommand); |
| | | if (sendFlag) |
| | | { |
| | | commonStackerCrane.LastTaskType = task.TaskType; |
| | | _taskService.UpdateTaskStatusToNext(task.TaskNum); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | WriteError(nameof(CommonStackerCraneJob), ex.Message, ex); |
| | | } |
| | | return Task.CompletedTask; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ä»»å¡å®æäºä»¶è®¢é
çæ¹æ³ |
| | | /// </summary> |
| | | /// <param name="sender"></param> |
| | | /// <param name="e"></param> |
| | | private void CommonStackerCrane_StackerCraneTaskCompletedEventHandler(object? sender, WIDESEAWCS_QuartzJob.StackerCrane.StackerCraneTaskCompletedEventArgs e) |
| | | { |
| | | CommonStackerCrane? commonStackerCrane = sender as CommonStackerCrane; |
| | | if (commonStackerCrane != null) |
| | | { |
| | | if (commonStackerCrane.GetValue<StackerCraneDBName, short>(StackerCraneDBName.WorkType) != 5) |
| | | { |
| | | Console.Out.WriteLine("TaskCompleted" + e.TaskNum); |
| | | _taskService.StackCraneTaskCompleted(e.TaskNum); |
| | | commonStackerCrane.SetValue(StackerCraneDBName.WorkType, 5); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// è·åä»»å¡ |
| | | /// </summary> |
| | | /// <param name="commonStackerCrane">å åæºå¯¹è±¡</param> |
| | | /// <returns></returns> |
| | | private Dt_Task? GetTask(CommonStackerCrane commonStackerCrane) |
| | | { |
| | | Dt_Task task; |
| | | if (commonStackerCrane.LastTaskType == null) |
| | | { |
| | | task = _taskService.QueryStackerCraneTask(commonStackerCrane.DeviceCode); |
| | | } |
| | | else |
| | | { |
| | | if (commonStackerCrane.LastTaskType.GetValueOrDefault().GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | { |
| | | task = _taskService.QueryStackerCraneInTask(commonStackerCrane.DeviceCode); |
| | | if (task == null) |
| | | { |
| | | task = _taskService.QueryStackerCraneOutTask(commonStackerCrane.DeviceCode); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | task = _taskService.QueryStackerCraneOutTask(commonStackerCrane.DeviceCode); |
| | | if (task == null) |
| | | { |
| | | task = _taskService.QueryStackerCraneInTask(commonStackerCrane.DeviceCode); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | { |
| | | if (OutTaskStationIsOccupied(task) != null || true) |
| | | { |
| | | return task; |
| | | } |
| | | else |
| | | { |
| | | List<string> otherOutStaionCodes = _routerService.QueryNextRoutes(commonStackerCrane.DeviceCode, task.NextAddress).Select(x => x.ChildPosi).ToList(); |
| | | List<Dt_Task> tasks = _taskService.QueryStackerCraneOutTasks(commonStackerCrane.DeviceCode, otherOutStaionCodes); |
| | | foreach (var item in tasks) |
| | | { |
| | | if (OutTaskStationIsOccupied(task) != null) |
| | | { |
| | | return task; |
| | | } |
| | | } |
| | | task = _taskService.QueryStackerCraneInTask(commonStackerCrane.DeviceCode); |
| | | } |
| | | } |
| | | |
| | | return task; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// åºåºä»»å¡å¤æåºåºç«å°æ¯å¦è¢«å ç¨ |
| | | /// </summary> |
| | | /// <param name="task">ä»»å¡å®ä½</param> |
| | | /// <returns>妿æªè¢«å ç¨ï¼è¿åä¼ å
¥çä»»å¡ä¿¡æ¯ï¼å¦åï¼è¿ånull</returns> |
| | | private Dt_Task? OutTaskStationIsOccupied([NotNull] Dt_Task task) |
| | | { |
| | | Dt_StationManger? stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == task.TargetAddress && x.StackerCraneCode == task.Roadway); |
| | | if (stationManger != null) |
| | | { |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode); |
| | | if (device != null) |
| | | { |
| | | OtherDevice client = (OtherDevice)device; |
| | | if (client.GetValue<GroundStationDBName, bool>(GroundStationDBName.R_IsCanPut, stationManger.StationCode))//åºåºç«å°æªè¢«å ç¨ |
| | | { |
| | | task.TargetAddress = stationManger.StackerCraneStationCode; |
| | | _taskRepository.UpdateData(task); |
| | | return task; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"æªæ¾å°åºåºç«å°ã{stationManger.StationDeviceCode}ã对åºçéè®¯å¯¹è±¡ï¼æ æ³å¤æåºåºç«å°æ¯å¦è¢«å ç¨"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"æªæ¾å°ç«å°ã{task.NextAddress}ãä¿¡æ¯ï¼æ æ³æ ¡éªç«å°"); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ä»»å¡å®ä½è½¬æ¢æå½ä»¤Model |
| | | /// </summary> |
| | | /// <param name="task">ä»»å¡å®ä½</param> |
| | | /// <returns></returns> |
| | | /// <exception cref="Exception"></exception> |
| | | public StackerCraneTaskCommand? ConvertToStackerCraneTaskCommand([NotNull] Dt_Task task) |
| | | { |
| | | StackerCraneTaskCommand stackerCraneTaskCommand = new StackerCraneTaskCommand(); |
| | | |
| | | stackerCraneTaskCommand.Barcode = task.PalletCode; |
| | | stackerCraneTaskCommand.TaskNum = task.TaskNum; |
| | | stackerCraneTaskCommand.WorkType = 1; |
| | | stackerCraneTaskCommand.TrayType = 1; |
| | | if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)//夿æ¯å¦æ¯å
¥åºä»»å¡ |
| | | { |
| | | //List<Dt_Router> routers = _routerService.QueryNextRoutes(task.CurrentAddress, task.Roadway); |
| | | //if (routers.Count > 0) |
| | | //{ |
| | | string[] startCodes = task.CurrentAddress.Split("-"); |
| | | |
| | | stackerCraneTaskCommand.StartRow = Convert.ToInt16(startCodes[0]); |
| | | stackerCraneTaskCommand.StartColumn = Convert.ToInt16(startCodes[1]); |
| | | stackerCraneTaskCommand.StartLayer = Convert.ToInt16(startCodes[2]); |
| | | |
| | | string[] targetCodes = task.NextAddress.Split("-"); |
| | | if (targetCodes.Length == 3) |
| | | { |
| | | stackerCraneTaskCommand.EndRow = Convert.ToInt16(targetCodes[0]); |
| | | stackerCraneTaskCommand.EndColumn = Convert.ToInt16(targetCodes[1]); |
| | | stackerCraneTaskCommand.EndLayer = Convert.ToInt16(targetCodes[2]); |
| | | } |
| | | else |
| | | { |
| | | //æ°æ®é
ç½®é误 |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"å
¥åºä»»å¡ç»ç¹é误ï¼èµ·ç¹ï¼ã{task.NextAddress}ã"); |
| | | return null; |
| | | } |
| | | //} |
| | | //else |
| | | //{ |
| | | // _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"æªæ¾å°ç«å°ã{task.NextAddress}ãä¿¡æ¯ï¼æ æ³è·å对åºçå åæºåè´§ç«å°ä¿¡æ¯"); |
| | | // return null; |
| | | //} |
| | | } |
| | | else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | { |
| | | //List<Dt_Router> routers = _routerService.QueryNextRoutes(task.Roadway, task.TargetAddress); |
| | | //if (routers.Count > 0) |
| | | { |
| | | string[] targetCodes = task.NextAddress.Split("-"); |
| | | |
| | | stackerCraneTaskCommand.EndRow = Convert.ToInt16(targetCodes[0]); |
| | | stackerCraneTaskCommand.EndColumn = Convert.ToInt16(targetCodes[1]); |
| | | stackerCraneTaskCommand.EndLayer = Convert.ToInt16(targetCodes[2]); |
| | | |
| | | string[] sourceCodes = task.CurrentAddress.Split("-"); |
| | | if (sourceCodes.Length == 3) |
| | | { |
| | | stackerCraneTaskCommand.StartRow = Convert.ToInt16(sourceCodes[0]); |
| | | stackerCraneTaskCommand.StartColumn = Convert.ToInt16(sourceCodes[1]); |
| | | stackerCraneTaskCommand.StartLayer = Convert.ToInt16(sourceCodes[2]); |
| | | } |
| | | else |
| | | { |
| | | //æ°æ®é
ç½®é误 |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"åºåºä»»å¡èµ·ç¹é误ï¼èµ·ç¹ï¼ã{task.CurrentAddress}ã"); |
| | | return null; |
| | | } |
| | | } |
| | | //else |
| | | //{ |
| | | // _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"æªæ¾å°ç«å°ã{task.NextAddress}ãä¿¡æ¯ï¼æ æ³è·å对åºçå åæºæ¾è´§ç«å°ä¿¡æ¯"); |
| | | // return null; |
| | | //} |
| | | } |
| | | else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.RelocationGroup) |
| | | { |
| | | string[] targetCodes = task.NextAddress.Split("-"); |
| | | if (targetCodes.Length == 3) |
| | | { |
| | | stackerCraneTaskCommand.EndRow = Convert.ToInt16(targetCodes[0]); |
| | | stackerCraneTaskCommand.EndColumn = Convert.ToInt16(targetCodes[1]); |
| | | stackerCraneTaskCommand.EndLayer = Convert.ToInt16(targetCodes[2]); |
| | | } |
| | | else |
| | | { |
| | | //æ°æ®é
ç½®é误 |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"ç§»åºä»»å¡ç»ç¹é误ï¼èµ·ç¹ï¼ã{task.NextAddress}ã"); |
| | | return null; |
| | | } |
| | | string[] sourceCodes = task.CurrentAddress.Split("-"); |
| | | if (sourceCodes.Length == 3) |
| | | { |
| | | stackerCraneTaskCommand.StartRow = Convert.ToInt16(sourceCodes[0]); |
| | | stackerCraneTaskCommand.StartColumn = Convert.ToInt16(sourceCodes[1]); |
| | | stackerCraneTaskCommand.StartLayer = Convert.ToInt16(sourceCodes[2]); |
| | | } |
| | | else |
| | | { |
| | | //æ°æ®é
ç½®é误 |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"ç§»åºä»»å¡èµ·ç¹é误ï¼èµ·ç¹ï¼ã{task.CurrentAddress}ã"); |
| | | return null; |
| | | } |
| | | } |
| | | return stackerCraneTaskCommand; |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using Microsoft.AspNetCore.Components.Routing; |
| | | using Quartz; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Diagnostics.CodeAnalysis; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_Core.Enums; |
| | | using WIDESEAWCS_IBasicInfoRepository; |
| | | using WIDESEAWCS_ITaskInfoRepository; |
| | | using WIDESEAWCS_ITaskInfoService; |
| | | using WIDESEAWCS_Model.Models; |
| | | using WIDESEAWCS_QuartzJob; |
| | | using WIDESEAWCS_QuartzJob.DeviceBase; |
| | | using WIDESEAWCS_QuartzJob.Models; |
| | | using WIDESEAWCS_QuartzJob.Service; |
| | | using WIDESEAWCS_QuartzJob.StackerCrane.Enum; |
| | | using WIDESEAWCS_Tasks.HoisterJob; |
| | | using WIDESEAWCS_Tasks.StackerCraneJob; |
| | | using WIDESEAWCS_Tasks.é»çä»; |
| | | |
| | | namespace WIDESEAWCS_Tasks |
| | | { |
| | | [DisallowConcurrentExecution] |
| | | public class StackerCraneJob_YM : JobBase, IJob |
| | | { |
| | | private readonly ITaskService _taskService; |
| | | private readonly ITaskExecuteDetailService _taskExecuteDetailService; |
| | | private readonly ITaskRepository _taskRepository; |
| | | private readonly IRouterService _routerService; |
| | | private readonly IStationMangerRepository _stationMangerRepository; |
| | | |
| | | public StackerCraneJob_YM(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IRouterService routerService, IStationMangerRepository stationMangerRepository) |
| | | { |
| | | _taskService = taskService; |
| | | _taskExecuteDetailService = taskExecuteDetailService; |
| | | _taskRepository = taskRepository; |
| | | _routerService = routerService; |
| | | _stationMangerRepository = stationMangerRepository; |
| | | } |
| | | |
| | | public Task Execute(IJobExecutionContext context) |
| | | { |
| | | try |
| | | { |
| | | CommonStackerCrane commonStackerCrane = (CommonStackerCrane)context.JobDetail.JobDataMap.Get("JobParams"); |
| | | if (commonStackerCrane != null) |
| | | { |
| | | if (!commonStackerCrane.IsEventSubscribed) |
| | | { |
| | | commonStackerCrane.StackerCraneTaskCompletedEventHandler += CommonStackerCrane_StackerCraneTaskCompletedEventHandler;//订é
ä»»å¡å®æäºä»¶ |
| | | } |
| | | |
| | | if (commonStackerCrane.StackerCraneAutoStatusValue == StackerCraneAutoStatus.Automatic && commonStackerCrane.StackerCraneStatusValue == StackerCraneStatus.Normal) |
| | | { |
| | | commonStackerCrane.CheckStackerCraneTaskCompleted();//鲿¢ä»»å¡å®æäºä»¶çæµè¶
æ¶ï¼åæå¨è§¦å䏿¬¡ |
| | | |
| | | if (commonStackerCrane.StackerCraneWorkStatusValue == StackerCraneWorkStatus.Standby) |
| | | { |
| | | Dt_Task? task = GetTask(commonStackerCrane); |
| | | if (task != null) |
| | | { |
| | | StackerCraneTaskCommand? stackerCraneTaskCommand = ConvertToStackerCraneTaskCommand(task); |
| | | if (stackerCraneTaskCommand != null) |
| | | { |
| | | bool sendFlag = commonStackerCrane.SendCommand(stackerCraneTaskCommand); |
| | | if (sendFlag) |
| | | { |
| | | commonStackerCrane.LastTaskType = task.TaskType; |
| | | _taskService.UpdateTaskStatusToNext(task.TaskNum); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | WriteError(nameof(CommonStackerCraneJob), ex.Message, ex); |
| | | } |
| | | return Task.CompletedTask; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ä»»å¡å®æäºä»¶è®¢é
çæ¹æ³ |
| | | /// </summary> |
| | | /// <param name="sender"></param> |
| | | /// <param name="e"></param> |
| | | private void CommonStackerCrane_StackerCraneTaskCompletedEventHandler(object? sender, WIDESEAWCS_QuartzJob.StackerCrane.StackerCraneTaskCompletedEventArgs e) |
| | | { |
| | | CommonStackerCrane? commonStackerCrane = sender as CommonStackerCrane; |
| | | if (commonStackerCrane != null) |
| | | { |
| | | if (commonStackerCrane.GetValue<StackerCraneDBName, short>(StackerCraneDBName.WorkType) != 5) |
| | | { |
| | | Console.Out.WriteLine("TaskCompleted" + e.TaskNum); |
| | | _taskService.StackCraneTaskCompleted(e.TaskNum); |
| | | commonStackerCrane.SetValue(StackerCraneDBName.WorkType, 5); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// è·åä»»å¡ |
| | | /// </summary> |
| | | /// <param name="commonStackerCrane">å åæºå¯¹è±¡</param> |
| | | /// <returns></returns> |
| | | private Dt_Task? GetTask(CommonStackerCrane commonStackerCrane) |
| | | { |
| | | Dt_Task task; |
| | | if (commonStackerCrane.LastTaskType == null) |
| | | { |
| | | task = _taskService.QueryStackerCraneTask(commonStackerCrane.DeviceCode); |
| | | } |
| | | else |
| | | { |
| | | if (commonStackerCrane.LastTaskType.GetValueOrDefault().GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | { |
| | | task = _taskService.QueryStackerCraneInTask(commonStackerCrane.DeviceCode); |
| | | if (task == null) |
| | | { |
| | | task = _taskService.QueryStackerCraneOutTask(commonStackerCrane.DeviceCode); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | task = _taskService.QueryStackerCraneOutTask(commonStackerCrane.DeviceCode); |
| | | if (task == null) |
| | | { |
| | | task = _taskService.QueryStackerCraneInTask(commonStackerCrane.DeviceCode); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | { |
| | | if (OutTaskStationIsOccupied(task) != null || true) |
| | | { |
| | | return task; |
| | | } |
| | | else |
| | | { |
| | | List<string> otherOutStaionCodes = _routerService.QueryNextRoutes(commonStackerCrane.DeviceCode, task.NextAddress).Select(x => x.ChildPosi).ToList(); |
| | | List<Dt_Task> tasks = _taskService.QueryStackerCraneOutTasks(commonStackerCrane.DeviceCode, otherOutStaionCodes); |
| | | foreach (var item in tasks) |
| | | { |
| | | if (OutTaskStationIsOccupied(task) != null) |
| | | { |
| | | return task; |
| | | } |
| | | } |
| | | task = _taskService.QueryStackerCraneInTask(commonStackerCrane.DeviceCode); |
| | | } |
| | | } |
| | | |
| | | return task; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// åºåºä»»å¡å¤æåºåºç«å°æ¯å¦è¢«å ç¨ |
| | | /// </summary> |
| | | /// <param name="task">ä»»å¡å®ä½</param> |
| | | /// <returns>妿æªè¢«å ç¨ï¼è¿åä¼ å
¥çä»»å¡ä¿¡æ¯ï¼å¦åï¼è¿ånull</returns> |
| | | private Dt_Task? OutTaskStationIsOccupied([NotNull] Dt_Task task) |
| | | { |
| | | Dt_StationManger? stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == task.TargetAddress && x.StackerCraneCode == task.Roadway); |
| | | if (stationManger != null) |
| | | { |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode); |
| | | if (device != null) |
| | | { |
| | | OtherDevice client = (OtherDevice)device; |
| | | if (client.GetValue<GroundStationDBName, bool>(GroundStationDBName.R_IsCanPut, stationManger.StationCode))//åºåºç«å°æªè¢«å ç¨ |
| | | { |
| | | task.TargetAddress = stationManger.StackerCraneStationCode; |
| | | _taskRepository.UpdateData(task); |
| | | return task; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"æªæ¾å°åºåºç«å°ã{stationManger.StationDeviceCode}ã对åºçéè®¯å¯¹è±¡ï¼æ æ³å¤æåºåºç«å°æ¯å¦è¢«å ç¨"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"æªæ¾å°ç«å°ã{task.NextAddress}ãä¿¡æ¯ï¼æ æ³æ ¡éªç«å°"); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ä»»å¡å®ä½è½¬æ¢æå½ä»¤Model |
| | | /// </summary> |
| | | /// <param name="task">ä»»å¡å®ä½</param> |
| | | /// <returns></returns> |
| | | /// <exception cref="Exception"></exception> |
| | | public StackerCraneTaskCommand? ConvertToStackerCraneTaskCommand([NotNull] Dt_Task task) |
| | | { |
| | | StackerCraneTaskCommand stackerCraneTaskCommand = new StackerCraneTaskCommand(); |
| | | |
| | | stackerCraneTaskCommand.Barcode = task.PalletCode; |
| | | stackerCraneTaskCommand.TaskNum = task.TaskNum; |
| | | stackerCraneTaskCommand.WorkType = 1; |
| | | stackerCraneTaskCommand.TrayType = 1; |
| | | if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)//夿æ¯å¦æ¯å
¥åºä»»å¡ |
| | | { |
| | | //List<Dt_Router> routers = _routerService.QueryNextRoutes(task.CurrentAddress, task.Roadway); |
| | | //if (routers.Count > 0) |
| | | //{ |
| | | string[] startCodes = task.CurrentAddress.Split("-"); |
| | | |
| | | stackerCraneTaskCommand.StartRow = Convert.ToInt16(startCodes[0]); |
| | | stackerCraneTaskCommand.StartColumn = Convert.ToInt16(startCodes[1]); |
| | | stackerCraneTaskCommand.StartLayer = Convert.ToInt16(startCodes[2]); |
| | | |
| | | string[] targetCodes = task.NextAddress.Split("-"); |
| | | if (targetCodes.Length == 3) |
| | | { |
| | | stackerCraneTaskCommand.EndRow = Convert.ToInt16(targetCodes[0]); |
| | | stackerCraneTaskCommand.EndColumn = Convert.ToInt16(targetCodes[1]); |
| | | stackerCraneTaskCommand.EndLayer = Convert.ToInt16(targetCodes[2]); |
| | | } |
| | | else |
| | | { |
| | | //æ°æ®é
ç½®é误 |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"å
¥åºä»»å¡ç»ç¹é误ï¼èµ·ç¹ï¼ã{task.NextAddress}ã"); |
| | | return null; |
| | | } |
| | | //} |
| | | //else |
| | | //{ |
| | | // _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"æªæ¾å°ç«å°ã{task.NextAddress}ãä¿¡æ¯ï¼æ æ³è·å对åºçå åæºåè´§ç«å°ä¿¡æ¯"); |
| | | // return null; |
| | | //} |
| | | } |
| | | else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | { |
| | | //List<Dt_Router> routers = _routerService.QueryNextRoutes(task.Roadway, task.TargetAddress); |
| | | //if (routers.Count > 0) |
| | | { |
| | | string[] targetCodes = task.NextAddress.Split("-"); |
| | | |
| | | stackerCraneTaskCommand.EndRow = Convert.ToInt16(targetCodes[0]); |
| | | stackerCraneTaskCommand.EndColumn = Convert.ToInt16(targetCodes[1]); |
| | | stackerCraneTaskCommand.EndLayer = Convert.ToInt16(targetCodes[2]); |
| | | |
| | | string[] sourceCodes = task.CurrentAddress.Split("-"); |
| | | if (sourceCodes.Length == 3) |
| | | { |
| | | stackerCraneTaskCommand.StartRow = Convert.ToInt16(sourceCodes[0]); |
| | | stackerCraneTaskCommand.StartColumn = Convert.ToInt16(sourceCodes[1]); |
| | | stackerCraneTaskCommand.StartLayer = Convert.ToInt16(sourceCodes[2]); |
| | | } |
| | | else |
| | | { |
| | | //æ°æ®é
ç½®é误 |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"åºåºä»»å¡èµ·ç¹é误ï¼èµ·ç¹ï¼ã{task.CurrentAddress}ã"); |
| | | return null; |
| | | } |
| | | } |
| | | //else |
| | | //{ |
| | | // _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"æªæ¾å°ç«å°ã{task.NextAddress}ãä¿¡æ¯ï¼æ æ³è·å对åºçå åæºæ¾è´§ç«å°ä¿¡æ¯"); |
| | | // return null; |
| | | //} |
| | | } |
| | | else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.RelocationGroup) |
| | | { |
| | | string[] targetCodes = task.NextAddress.Split("-"); |
| | | if (targetCodes.Length == 3) |
| | | { |
| | | stackerCraneTaskCommand.EndRow = Convert.ToInt16(targetCodes[0]); |
| | | stackerCraneTaskCommand.EndColumn = Convert.ToInt16(targetCodes[1]); |
| | | stackerCraneTaskCommand.EndLayer = Convert.ToInt16(targetCodes[2]); |
| | | } |
| | | else |
| | | { |
| | | //æ°æ®é
ç½®é误 |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"ç§»åºä»»å¡ç»ç¹é误ï¼èµ·ç¹ï¼ã{task.NextAddress}ã"); |
| | | return null; |
| | | } |
| | | string[] sourceCodes = task.CurrentAddress.Split("-"); |
| | | if (sourceCodes.Length == 3) |
| | | { |
| | | stackerCraneTaskCommand.StartRow = Convert.ToInt16(sourceCodes[0]); |
| | | stackerCraneTaskCommand.StartColumn = Convert.ToInt16(sourceCodes[1]); |
| | | stackerCraneTaskCommand.StartLayer = Convert.ToInt16(sourceCodes[2]); |
| | | } |
| | | else |
| | | { |
| | | //æ°æ®é
ç½®é误 |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"ç§»åºä»»å¡èµ·ç¹é误ï¼èµ·ç¹ï¼ã{task.CurrentAddress}ã"); |
| | | return null; |
| | | } |
| | | } |
| | | return stackerCraneTaskCommand; |
| | | } |
| | | } |
| | | } |
| | |
| | | stackerCraneTaskCommand.TrayType = 1; |
| | | if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)//夿æ¯å¦æ¯å
¥åºä»»å¡ |
| | | { |
| | | //List<Dt_Router> routers = _routerService.QueryNextRoutes(task.CurrentAddress, task.Roadway); |
| | | //if (routers.Count > 0) |
| | | //{ |
| | | string[] startCodes = task.CurrentAddress.Split("-"); |
| | | |
| | | stackerCraneTaskCommand.StartRow = Convert.ToInt16(startCodes[0]); |
| | |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"å
¥åºä»»å¡ç»ç¹é误ï¼èµ·ç¹ï¼ã{task.NextAddress}ã"); |
| | | return null; |
| | | } |
| | | //} |
| | | //else |
| | | //{ |
| | | // _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"æªæ¾å°ç«å°ã{task.NextAddress}ãä¿¡æ¯ï¼æ æ³è·å对åºçå åæºåè´§ç«å°ä¿¡æ¯"); |
| | | // return null; |
| | | //} |
| | | } |
| | | else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | { |
| | | //List<Dt_Router> routers = _routerService.QueryNextRoutes(task.Roadway, task.TargetAddress); |
| | | //if (routers.Count > 0) |
| | | { |
| | | string[] targetCodes = task.NextAddress.Split("-"); |
| | | |
| | |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"åºåºä»»å¡èµ·ç¹é误ï¼èµ·ç¹ï¼ã{task.CurrentAddress}ã"); |
| | | return null; |
| | | } |
| | | } |
| | | //else |
| | | //{ |
| | | // _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"æªæ¾å°ç«å°ã{task.NextAddress}ãä¿¡æ¯ï¼æ æ³è·å对åºçå åæºæ¾è´§ç«å°ä¿¡æ¯"); |
| | | // return null; |
| | | //} |
| | | } |
| | | else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.RelocationGroup) |
| | | { |
| | |
| | | public partial class LocationInfoService : ServiceBase<Dt_LocationInfo, ILocationInfoRepository>, ILocationInfoService |
| | | { |
| | | private readonly IUnitOfWorkManage _unitOfWorkManage; |
| | | private readonly IBasicRepository _basicRepository; |
| | | |
| | | public ILocationInfoRepository Repository => BaseDal; |
| | | |
| | | public LocationInfoService(ILocationInfoRepository BaseDal, IUnitOfWorkManage unitOfWorkManage) : base(BaseDal) |
| | | public LocationInfoService(ILocationInfoRepository BaseDal, IUnitOfWorkManage unitOfWorkManage, IBasicRepository basicRepository) : base(BaseDal) |
| | | { |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | | _basicRepository = basicRepository; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | Layer = k + 1, |
| | | LocationStatus = LocationStatusEnum.Free.ObjToInt(), |
| | | LocationType = LocationTypeEnum.Undefined.ObjToInt(), |
| | | RoadwayNo = $"R{initializationLocationDTO.Roadway.ToString()}", |
| | | RoadwayNo = $"{initializationLocationDTO.Roadway.ToString()}", |
| | | Row = i + 1, |
| | | Depth = depth, |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Common.CommonEnum; |
| | | using WIDESEA_Common.LocationEnum; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_IBasicRepository; |
| | | using WIDESEA_IBasicService; |
| | | using WIDESEA_Model.Models; |
| | | |
| | | namespace WIDESEA_BasicService |
| | | { |
| | | public partial class LocationInfoService |
| | | { |
| | | |
| | | double weightValue_BC = 0.25; |
| | | |
| | | private readonly static object _locker_BC = new object(); |
| | | static List<LocationCache> locationCaches_BC = new List<LocationCache>(); |
| | | |
| | | /// <summary> |
| | | /// æ¿æä»è´§ä½åé
|
| | | /// </summary> |
| | | /// <param name="roadwayNo">å··éå·</param> |
| | | /// <param name="palletType"> |
| | | /// æçç±»å |
| | | /// </param> |
| | | /// <returns></returns> |
| | | public Dt_LocationInfo? AssignLocation_BC(string roadwayNo, PalletTypeEnum palletType, string beRelocationCode = "") |
| | | { |
| | | lock (_locker_BC) |
| | | { |
| | | List<LocationCache> removeItems = locationCaches_BC.Where(x => (DateTime.Now - x.DateTime).TotalMinutes > 5).ToList(); |
| | | int count = removeItems.Count; |
| | | for (int i = 0; i < count; i++) |
| | | { |
| | | locationCaches_BC.Remove(removeItems[i]); |
| | | } |
| | | |
| | | List<string> lockLocationCodes = locationCaches_BC.Select(x => x.LocationCode).ToList(); |
| | | |
| | | List<Dt_LocationInfo> locationInfos = Repository.QueryData(x => x.RoadwayNo == roadwayNo); |
| | | if (locationInfos == null || locationInfos.Count == 0) |
| | | { |
| | | throw new Exception($"æªæ¾å°è¯¥å··éçè´§ä½ä¿¡æ¯,å··éå·:{roadwayNo}"); |
| | | } |
| | | |
| | | if (!string.IsNullOrEmpty(beRelocationCode)) |
| | | { |
| | | Dt_LocationInfo? beRelocation = locationInfos.FirstOrDefault(x => x.LocationCode == beRelocationCode); |
| | | if (beRelocation == null) |
| | | { |
| | | throw new Exception($"æªæ¾å°è´§ä½ä¿¡æ¯"); |
| | | } |
| | | int maxDepth = locationInfos.Max(x => x.Depth); |
| | | int mathCurrentRow = beRelocation.Row - Convert.ToInt32(Math.Ceiling(beRelocation.Row / maxDepth / 2.0)) * maxDepth * 2; |
| | | if (mathCurrentRow <= maxDepth) |
| | | { |
| | | locationInfos = locationInfos.Where(x => x.Row - Convert.ToInt32(Math.Ceiling(x.Row / maxDepth / 2.0)) * maxDepth * 2 <= maxDepth).ToList(); |
| | | } |
| | | else |
| | | { |
| | | locationInfos = locationInfos.Where(x => x.Row - Convert.ToInt32(Math.Ceiling(x.Row / maxDepth / 2.0)) * maxDepth * 2 > maxDepth).ToList(); |
| | | } |
| | | } |
| | | |
| | | //å·²å®ä¹è´§ä½ç±»åçè´§ä½ |
| | | List<Dt_LocationInfo> definedTypeLocations = locationInfos.Where(x => x.LocationType == palletType.ObjToInt()).ToList(); |
| | | |
| | | //æªå®ä¹ç±»åçç©ºè´§ä½ |
| | | List<Dt_LocationInfo> undefinedTypeEmptyLocations = locationInfos.Where(x => (x.EnableStatus == EnableStatusEnum.Normal.ObjToInt() || x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt()) && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && x.LocationType == LocationTypeEnum.Undefined.ObjToInt() && !lockLocationCodes.Contains(x.LocationCode)).OrderByDescending(x => x.Depth).ThenBy(x => x.Layer).ThenBy(x => x.Row).ThenBy(x => x.Column).ToList(); |
| | | |
| | | List<Dt_LocationInfo> definedTypeEmptyLocations = locationInfos.Where(x => (x.EnableStatus == EnableStatusEnum.Normal.ObjToInt() || x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt()) && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && x.LocationType == palletType.ObjToInt() && !lockLocationCodes.Contains(x.LocationCode)).OrderByDescending(x => x.Depth).ThenBy(x => x.Layer).ThenBy(x => x.Row).ThenBy(x => x.Column).ToList(); |
| | | |
| | | if ((locationInfos.Count * weightValue_BC >= definedTypeLocations.Count && undefinedTypeEmptyLocations.Any()) || !definedTypeEmptyLocations.Any())//妿已å®ä¹ç±»åè´§ä½æªè¶
è¿æ¯ä¾ï¼ä¸ææªå®ä¹ç±»åçè´§ä½ |
| | | { |
| | | if (palletType == PalletTypeEnum.LargePallet || palletType == PalletTypeEnum.LargestPallet) |
| | | { |
| | | undefinedTypeEmptyLocations = undefinedTypeEmptyLocations.Where(x => x.Depth % 2 == 1).ToList(); |
| | | } |
| | | for (int i = 0; i < undefinedTypeEmptyLocations.Count; i++) |
| | | { |
| | | Dt_LocationInfo undefinedTypeEmptyLocation = undefinedTypeEmptyLocations[i]; |
| | | Dt_LocationInfo? locationInfo = GetUsableLocation_BC(locationInfos, undefinedTypeEmptyLocation, palletType); |
| | | if (locationInfo != null) |
| | | { |
| | | UpdateLocationStatus(locationInfo, palletType, LocationStatusEnum.Lock, 3); |
| | | locationCaches_BC.Add(new LocationCache { LocationCode = locationInfo.LocationCode, DateTime = DateTime.Now }); |
| | | return locationInfo; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | for (int i = 0; i < definedTypeEmptyLocations.Count; i++) |
| | | { |
| | | Dt_LocationInfo definedTypeEmptyLocation = definedTypeEmptyLocations[i]; |
| | | Dt_LocationInfo? locationInfo = GetUsableLocation_BC(locationInfos, definedTypeEmptyLocation, palletType); |
| | | if (locationInfo != null) |
| | | { |
| | | UpdateLocationStatus(locationInfo, palletType, LocationStatusEnum.Lock, 3); |
| | | locationCaches_BC.Add(new LocationCache { LocationCode = locationInfo.LocationCode, DateTime = DateTime.Now }); |
| | | return locationInfo; |
| | | } |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// è·åå¯ç¨è´§ä½(æµè¯æ¶ä») |
| | | /// </summary> |
| | | /// <param name="locationInfos"></param> |
| | | /// <param name="emptyLocation"></param> |
| | | /// <param name="palletType"></param> |
| | | /// <returns></returns> |
| | | private Dt_LocationInfo? GetUsableLocation_BC(List<Dt_LocationInfo> locationInfos, Dt_LocationInfo emptyLocation, PalletTypeEnum palletType) |
| | | { |
| | | switch (palletType) |
| | | { |
| | | case PalletTypeEnum.LargestPallet: |
| | | case PalletTypeEnum.LargePallet: |
| | | if (emptyLocation.Depth % 2 == 0) |
| | | { |
| | | return null; |
| | | } |
| | | break; |
| | | } |
| | | Dt_LocationInfo? locationInfo = DepthLocationIsEmpty_BC(locationInfos, emptyLocation, palletType); |
| | | if (locationInfo != null) |
| | | { |
| | | return locationInfo; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 夿ä¸å深度çåç»è´§ä½ç¶ææ¯å¦ä¸ºç©ºé²ç©ºä½(æµè¯æ¶ä») |
| | | /// </summary> |
| | | /// <param name="locationInfos"></param> |
| | | /// <param name="emptyLocation"></param> |
| | | /// <returns></returns> |
| | | private Dt_LocationInfo? DepthLocationIsEmpty_BC(List<Dt_LocationInfo> locationInfos, Dt_LocationInfo emptyLocation, PalletTypeEnum palletType) |
| | | { |
| | | List<Dt_LocationInfo> locations = GetGroupLocations(locationInfos, emptyLocation); |
| | | |
| | | bool moreDepthFlag = false; |
| | | bool littleDepthFlag = false; |
| | | |
| | | switch (palletType) |
| | | { |
| | | case PalletTypeEnum.LargestPallet: |
| | | case PalletTypeEnum.LargePallet: |
| | | List<Dt_LocationInfo> moreDepth = locations.Where(x => x.Depth > emptyLocation.Depth).ToList(); |
| | | moreDepthFlag = moreDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.InStock.ObjToInt() && x.LocationStatus != LocationStatusEnum.PalletLock.ObjToInt()) == null;//æ¥è¯¢å¤§äºå½åè´§ä½æ·±åº¦çéåéæ¯å¦æç¶æä¸ä¸ºæè´§çè´§ä½ï¼å¦ææ¯trueï¼åè¡¨ç¤ºæ·±è´§ä½ææªè¢«ä½¿ç¨çæ
åµ |
| | | |
| | | List<Dt_LocationInfo> littleDepth = locations.Where(x => x.Depth <= emptyLocation.Depth).ToList(); |
| | | littleDepthFlag = littleDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.Free.ObjToInt() && x.EnableStatus != EnableStatusEnum.OnlyIn.ObjToInt() && x.EnableStatus != EnableStatusEnum.Normal.ObjToInt()) == null; //æ¥è¯¢å°äºå½åè´§ä½æ·±åº¦çéåéæ¯å¦æç¶æä¸ä¸ºç©ºï¼ä¸ç¦ç¨ç¶æä¸ä¸ºç¦ç¨ä»¥ååªå
¥çè´§ä½ï¼å¦ææ¯trueï¼å表示æµ
è´§ä½è¢«ä½¿ç¨æè
被ç¦ç¨çæ
åµ |
| | | break; |
| | | } |
| | | |
| | | if (moreDepthFlag && littleDepthFlag) |
| | | { |
| | | return emptyLocation; |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Common.CommonEnum; |
| | | using WIDESEA_Common.LocationEnum; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_IBasicRepository; |
| | | using WIDESEA_IBasicService; |
| | | using WIDESEA_Model.Models; |
| | | |
| | | namespace WIDESEA_BasicService |
| | | { |
| | | public partial class LocationInfoService |
| | | { |
| | | |
| | | double weightValue_CSJ = 0.25; |
| | | |
| | | private readonly static object _locker_CSJ = new object(); |
| | | static List<LocationCache> locationCaches_CSJ = new List<LocationCache>(); |
| | | |
| | | /// <summary> |
| | | /// æµè¯æ¶ä»è´§ä½åé
<br/> |
| | | /// æçç±»åï¼ <br/> |
| | | /// 1ï¼æé¿ <br/> |
| | | /// 2ï¼é¿ <br/> |
| | | /// 3ï¼ä¸ç <br/> |
| | | /// 4ï¼ç <br/> |
| | | /// 3å4齿¯3æ·±ï¼ä¸å¯ä»¥æ··æ¾ã <br/> |
| | | /// 1å2齿¯2æ·±ï¼ä¸å¯ä»¥æ··æ¾ã <br/> |
| | | /// ç§»åºæ¶åªè½æ¯åä¾§è´§ä½ã |
| | | /// </summary> |
| | | /// <param name="roadwayNo">å··éå·</param> |
| | | /// <param name="palletType"> |
| | | /// æçç±»å <br/> |
| | | /// 1ï¼æé¿ <br/> |
| | | /// 2ï¼é¿ <br/> |
| | | /// 3ï¼ä¸ç <br/> |
| | | /// 4ï¼ç |
| | | /// </param> |
| | | /// <returns></returns> |
| | | public Dt_LocationInfo? AssignLocation_CSJ(string roadwayNo, PalletTypeEnum palletType, string beRelocationCode = "") |
| | | { |
| | | lock (_locker_CSJ) |
| | | { |
| | | List<LocationCache> removeItems = locationCaches_CSJ.Where(x => (DateTime.Now - x.DateTime).TotalMinutes > 5).ToList(); |
| | | int count = removeItems.Count; |
| | | for (int i = 0; i < count; i++) |
| | | { |
| | | locationCaches_CSJ.Remove(removeItems[i]); |
| | | } |
| | | |
| | | List<string> lockLocationCodes = locationCaches_CSJ.Select(x => x.LocationCode).ToList(); |
| | | |
| | | List<Dt_LocationInfo> locationInfos = Repository.QueryData(x => x.RoadwayNo == roadwayNo); |
| | | if (locationInfos == null || locationInfos.Count == 0) |
| | | { |
| | | throw new Exception($"æªæ¾å°è¯¥å··éçè´§ä½ä¿¡æ¯,å··éå·:{roadwayNo}"); |
| | | } |
| | | |
| | | if (!string.IsNullOrEmpty(beRelocationCode)) |
| | | { |
| | | Dt_LocationInfo? beRelocation = locationInfos.FirstOrDefault(x => x.LocationCode == beRelocationCode); |
| | | if (beRelocation == null) |
| | | { |
| | | throw new Exception($"æªæ¾å°è´§ä½ä¿¡æ¯"); |
| | | } |
| | | int maxDepth = locationInfos.Max(x => x.Depth); |
| | | int mathCurrentRow = beRelocation.Row - Convert.ToInt32(Math.Ceiling(beRelocation.Row / maxDepth / 2.0)) * maxDepth * 2; |
| | | if (mathCurrentRow <= maxDepth) |
| | | { |
| | | locationInfos = locationInfos.Where(x => x.Row - Convert.ToInt32(Math.Ceiling(x.Row / maxDepth / 2.0)) * maxDepth * 2 <= maxDepth).ToList(); |
| | | } |
| | | else |
| | | { |
| | | locationInfos = locationInfos.Where(x => x.Row - Convert.ToInt32(Math.Ceiling(x.Row / maxDepth / 2.0)) * maxDepth * 2 > maxDepth).ToList(); |
| | | } |
| | | } |
| | | |
| | | //å·²å®ä¹è´§ä½ç±»åçè´§ä½ |
| | | List<Dt_LocationInfo> definedTypeLocations = locationInfos.Where(x => x.LocationType == palletType.ObjToInt()).ToList(); |
| | | |
| | | //æªå®ä¹ç±»åçç©ºè´§ä½ |
| | | List<Dt_LocationInfo> undefinedTypeEmptyLocations = locationInfos.Where(x => (x.EnableStatus == EnableStatusEnum.Normal.ObjToInt() || x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt()) && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && x.LocationType == LocationTypeEnum.Undefined.ObjToInt() && !lockLocationCodes.Contains(x.LocationCode)).OrderByDescending(x => x.Depth).ThenBy(x => x.Layer).ThenBy(x => x.Row).ThenBy(x => x.Column).ToList(); |
| | | |
| | | List<Dt_LocationInfo> definedTypeEmptyLocations = locationInfos.Where(x => (x.EnableStatus == EnableStatusEnum.Normal.ObjToInt() || x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt()) && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && x.LocationType == palletType.ObjToInt() && !lockLocationCodes.Contains(x.LocationCode)).OrderByDescending(x => x.Depth).ThenBy(x => x.Layer).ThenBy(x => x.Row).ThenBy(x => x.Column).ToList(); |
| | | |
| | | if ((locationInfos.Count * weightValue_CSJ >= definedTypeLocations.Count && undefinedTypeEmptyLocations.Any()) || !definedTypeEmptyLocations.Any())//妿已å®ä¹ç±»åè´§ä½æªè¶
è¿æ¯ä¾ï¼ä¸ææªå®ä¹ç±»åçè´§ä½ |
| | | { |
| | | if (palletType == PalletTypeEnum.LargePallet || palletType == PalletTypeEnum.LargestPallet) |
| | | { |
| | | undefinedTypeEmptyLocations = undefinedTypeEmptyLocations.Where(x => x.Depth % 2 == 1).ToList(); |
| | | } |
| | | for (int i = 0; i < undefinedTypeEmptyLocations.Count; i++) |
| | | { |
| | | Dt_LocationInfo undefinedTypeEmptyLocation = undefinedTypeEmptyLocations[i]; |
| | | Dt_LocationInfo? locationInfo = GetUsableLocation_CSJ(locationInfos, undefinedTypeEmptyLocation, palletType); |
| | | if (locationInfo != null) |
| | | { |
| | | UpdateLocationStatus(locationInfo, palletType, LocationStatusEnum.Lock, 3); |
| | | locationCaches_CSJ.Add(new LocationCache { LocationCode = locationInfo.LocationCode, DateTime = DateTime.Now }); |
| | | return locationInfo; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | for (int i = 0; i < definedTypeEmptyLocations.Count; i++) |
| | | { |
| | | Dt_LocationInfo definedTypeEmptyLocation = definedTypeEmptyLocations[i]; |
| | | Dt_LocationInfo? locationInfo = GetUsableLocation_CSJ(locationInfos, definedTypeEmptyLocation, palletType); |
| | | if (locationInfo != null) |
| | | { |
| | | UpdateLocationStatus(locationInfo, palletType, LocationStatusEnum.Lock, 3); |
| | | locationCaches_CSJ.Add(new LocationCache { LocationCode = locationInfo.LocationCode, DateTime = DateTime.Now }); |
| | | return locationInfo; |
| | | } |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// è·åå¯ç¨è´§ä½(æµè¯æ¶ä») |
| | | /// </summary> |
| | | /// <param name="locationInfos"></param> |
| | | /// <param name="emptyLocation"></param> |
| | | /// <param name="palletType"></param> |
| | | /// <returns></returns> |
| | | private Dt_LocationInfo? GetUsableLocation_CSJ(List<Dt_LocationInfo> locationInfos, Dt_LocationInfo emptyLocation, PalletTypeEnum palletType) |
| | | { |
| | | switch (palletType) |
| | | { |
| | | case PalletTypeEnum.LargestPallet: |
| | | case PalletTypeEnum.LargePallet: |
| | | if (emptyLocation.Depth % 2 == 0) |
| | | { |
| | | return null; |
| | | } |
| | | break; |
| | | } |
| | | Dt_LocationInfo? locationInfo = DepthLocationIsEmpty_CSJ(locationInfos, emptyLocation, palletType); |
| | | if (locationInfo != null) |
| | | { |
| | | return locationInfo; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 夿ä¸å深度çåç»è´§ä½ç¶ææ¯å¦ä¸ºç©ºé²ç©ºä½(æµè¯æ¶ä») |
| | | /// </summary> |
| | | /// <param name="locationInfos"></param> |
| | | /// <param name="emptyLocation"></param> |
| | | /// <returns></returns> |
| | | private Dt_LocationInfo? DepthLocationIsEmpty_CSJ(List<Dt_LocationInfo> locationInfos, Dt_LocationInfo emptyLocation, PalletTypeEnum palletType) |
| | | { |
| | | List<Dt_LocationInfo> locations = GetGroupLocations(locationInfos, emptyLocation); |
| | | |
| | | bool moreDepthFlag = false; |
| | | bool littleDepthFlag = false; |
| | | |
| | | switch (palletType) |
| | | { |
| | | case PalletTypeEnum.LargestPallet: |
| | | case PalletTypeEnum.LargePallet: |
| | | { |
| | | List<Dt_LocationInfo> moreDepth = locations.Where(x => x.Depth > emptyLocation.Depth).ToList(); |
| | | moreDepthFlag = moreDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.InStock.ObjToInt() && x.LocationStatus != LocationStatusEnum.PalletLock.ObjToInt()) == null;//æ¥è¯¢å¤§äºå½åè´§ä½æ·±åº¦çéåéæ¯å¦æç¶æä¸ä¸ºæè´§çè´§ä½ï¼å¦ææ¯trueï¼åè¡¨ç¤ºæ·±è´§ä½ææªè¢«ä½¿ç¨çæ
åµ |
| | | |
| | | List<Dt_LocationInfo> littleDepth = locations.Where(x => x.Depth <= emptyLocation.Depth).ToList(); |
| | | littleDepthFlag = littleDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.Free.ObjToInt() && x.EnableStatus != EnableStatusEnum.OnlyIn.ObjToInt() && x.EnableStatus != EnableStatusEnum.Normal.ObjToInt()) == null; //æ¥è¯¢å°äºå½åè´§ä½æ·±åº¦çéåéæ¯å¦æç¶æä¸ä¸ºç©ºï¼ä¸ç¦ç¨ç¶æä¸ä¸ºç¦ç¨ä»¥ååªå
¥çè´§ä½ï¼å¦ææ¯trueï¼å表示æµ
è´§ä½è¢«ä½¿ç¨æè
被ç¦ç¨çæ
åµ |
| | | } |
| | | break; |
| | | case PalletTypeEnum.MediumPallet: |
| | | case PalletTypeEnum.SmallPallet: |
| | | { |
| | | List<Dt_LocationInfo> moreDepth = locations.Where(x => x.Depth > emptyLocation.Depth).ToList(); |
| | | moreDepthFlag = moreDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.InStock.ObjToInt()) == null;//æ¥è¯¢å¤§äºå½åè´§ä½æ·±åº¦çéåéæ¯å¦æç¶æä¸ä¸ºæè´§çè´§ä½ï¼å¦ææ¯trueï¼åè¡¨ç¤ºæ·±è´§ä½ææªè¢«ä½¿ç¨çæ
åµ |
| | | |
| | | List<Dt_LocationInfo> littleDepth = locations.Where(x => x.Depth <= emptyLocation.Depth).ToList(); |
| | | littleDepthFlag = littleDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.Free.ObjToInt() && x.EnableStatus != EnableStatusEnum.OnlyIn.ObjToInt() && x.EnableStatus != EnableStatusEnum.Normal.ObjToInt()) == null; //æ¥è¯¢å°äºå½åè´§ä½æ·±åº¦çéåéæ¯å¦æç¶æä¸ä¸ºç©ºï¼ä¸ç¦ç¨ç¶æä¸ä¸ºç¦ç¨ä»¥ååªå
¥çè´§ä½ï¼å¦ææ¯trueï¼å表示æµ
è´§ä½è¢«ä½¿ç¨æè
被ç¦ç¨çæ
åµ |
| | | } |
| | | |
| | | break; |
| | | } |
| | | |
| | | if (moreDepthFlag && littleDepthFlag) |
| | | { |
| | | return emptyLocation; |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Common.CommonEnum; |
| | | using WIDESEA_Common.LocationEnum; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_IBasicRepository; |
| | | using WIDESEA_IBasicService; |
| | | using WIDESEA_Model.Models; |
| | | |
| | | namespace WIDESEA_BasicService |
| | | { |
| | | public partial class LocationInfoService |
| | | { |
| | | |
| | | double weightValue_GM = 0.25; |
| | | |
| | | private readonly static object _locker_GM = new object(); |
| | | static List<LocationCache> locationCaches_GM = new List<LocationCache>(); |
| | | |
| | | /// <summary> |
| | | /// å¹²èä»è´§ä½åé
|
| | | /// </summary> |
| | | /// <param name="roadwayNo">å··éå·</param> |
| | | /// <param name="palletType"> |
| | | /// æçç±»å |
| | | /// </param> |
| | | /// <returns></returns> |
| | | public Dt_LocationInfo? AssignLocation_GM(string roadwayNo, PalletTypeEnum palletType, string beRelocationCode = "") |
| | | { |
| | | lock (_locker_GM) |
| | | { |
| | | List<LocationCache> removeItems = locationCaches_GM.Where(x => (DateTime.Now - x.DateTime).TotalMinutes > 5).ToList(); |
| | | int count = removeItems.Count; |
| | | for (int i = 0; i < count; i++) |
| | | { |
| | | locationCaches_GM.Remove(removeItems[i]); |
| | | } |
| | | |
| | | List<string> lockLocationCodes = locationCaches_GM.Select(x => x.LocationCode).ToList(); |
| | | |
| | | List<Dt_LocationInfo> locationInfos = Repository.QueryData(x => x.RoadwayNo == roadwayNo); |
| | | if (locationInfos == null || locationInfos.Count == 0) |
| | | { |
| | | throw new Exception($"æªæ¾å°è¯¥å··éçè´§ä½ä¿¡æ¯,å··éå·:{roadwayNo}"); |
| | | } |
| | | |
| | | if (!string.IsNullOrEmpty(beRelocationCode)) |
| | | { |
| | | Dt_LocationInfo? beRelocation = locationInfos.FirstOrDefault(x => x.LocationCode == beRelocationCode); |
| | | if (beRelocation == null) |
| | | { |
| | | throw new Exception($"æªæ¾å°è´§ä½ä¿¡æ¯"); |
| | | } |
| | | int maxDepth = locationInfos.Max(x => x.Depth); |
| | | int mathCurrentRow = beRelocation.Row - Convert.ToInt32(Math.Ceiling(beRelocation.Row / maxDepth / 2.0)) * maxDepth * 2; |
| | | if (mathCurrentRow <= maxDepth) |
| | | { |
| | | locationInfos = locationInfos.Where(x => x.Row - Convert.ToInt32(Math.Ceiling(x.Row / maxDepth / 2.0)) * maxDepth * 2 <= maxDepth).ToList(); |
| | | } |
| | | else |
| | | { |
| | | locationInfos = locationInfos.Where(x => x.Row - Convert.ToInt32(Math.Ceiling(x.Row / maxDepth / 2.0)) * maxDepth * 2 > maxDepth).ToList(); |
| | | } |
| | | } |
| | | |
| | | //å·²å®ä¹è´§ä½ç±»åçè´§ä½ |
| | | List<Dt_LocationInfo> definedTypeLocations = locationInfos.Where(x => x.LocationType == palletType.ObjToInt()).ToList(); |
| | | |
| | | //æªå®ä¹ç±»åçç©ºè´§ä½ |
| | | List<Dt_LocationInfo> undefinedTypeEmptyLocations = locationInfos.Where(x => (x.EnableStatus == EnableStatusEnum.Normal.ObjToInt() || x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt()) && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && x.LocationType == LocationTypeEnum.Undefined.ObjToInt() && !lockLocationCodes.Contains(x.LocationCode)).OrderByDescending(x => x.Depth).ThenBy(x => x.Layer).ThenBy(x => x.Row).ThenBy(x => x.Column).ToList(); |
| | | |
| | | List<Dt_LocationInfo> definedTypeEmptyLocations = locationInfos.Where(x => (x.EnableStatus == EnableStatusEnum.Normal.ObjToInt() || x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt()) && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && x.LocationType == palletType.ObjToInt() && !lockLocationCodes.Contains(x.LocationCode)).OrderByDescending(x => x.Depth).ThenBy(x => x.Layer).ThenBy(x => x.Row).ThenBy(x => x.Column).ToList(); |
| | | |
| | | if ((locationInfos.Count * weightValue_GM >= definedTypeLocations.Count && undefinedTypeEmptyLocations.Any()) || !definedTypeEmptyLocations.Any())//妿已å®ä¹ç±»åè´§ä½æªè¶
è¿æ¯ä¾ï¼ä¸ææªå®ä¹ç±»åçè´§ä½ |
| | | { |
| | | if (palletType == PalletTypeEnum.LargePallet || palletType == PalletTypeEnum.LargestPallet) |
| | | { |
| | | undefinedTypeEmptyLocations = undefinedTypeEmptyLocations.Where(x => x.Depth % 2 == 1).ToList(); |
| | | } |
| | | for (int i = 0; i < undefinedTypeEmptyLocations.Count; i++) |
| | | { |
| | | Dt_LocationInfo undefinedTypeEmptyLocation = undefinedTypeEmptyLocations[i]; |
| | | Dt_LocationInfo? locationInfo = GetUsableLocation_GM(locationInfos, undefinedTypeEmptyLocation, palletType); |
| | | if (locationInfo != null) |
| | | { |
| | | UpdateLocationStatus(locationInfo, palletType, LocationStatusEnum.Lock, 3); |
| | | locationCaches_GM.Add(new LocationCache { LocationCode = locationInfo.LocationCode, DateTime = DateTime.Now }); |
| | | return locationInfo; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | for (int i = 0; i < definedTypeEmptyLocations.Count; i++) |
| | | { |
| | | Dt_LocationInfo definedTypeEmptyLocation = definedTypeEmptyLocations[i]; |
| | | Dt_LocationInfo? locationInfo = GetUsableLocation_GM(locationInfos, definedTypeEmptyLocation, palletType); |
| | | if (locationInfo != null) |
| | | { |
| | | UpdateLocationStatus(locationInfo, palletType, LocationStatusEnum.Lock, 3); |
| | | locationCaches_GM.Add(new LocationCache { LocationCode = locationInfo.LocationCode, DateTime = DateTime.Now }); |
| | | return locationInfo; |
| | | } |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// è·åå¯ç¨è´§ä½(æµè¯æ¶ä») |
| | | /// </summary> |
| | | /// <param name="locationInfos"></param> |
| | | /// <param name="emptyLocation"></param> |
| | | /// <param name="palletType"></param> |
| | | /// <returns></returns> |
| | | private Dt_LocationInfo? GetUsableLocation_GM(List<Dt_LocationInfo> locationInfos, Dt_LocationInfo emptyLocation, PalletTypeEnum palletType) |
| | | { |
| | | switch (palletType) |
| | | { |
| | | case PalletTypeEnum.LargestPallet: |
| | | case PalletTypeEnum.LargePallet: |
| | | if (emptyLocation.Depth % 2 == 0) |
| | | { |
| | | return null; |
| | | } |
| | | break; |
| | | } |
| | | Dt_LocationInfo? locationInfo = DepthLocationIsEmpty_GM(locationInfos, emptyLocation, palletType); |
| | | if (locationInfo != null) |
| | | { |
| | | return locationInfo; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 夿ä¸å深度çåç»è´§ä½ç¶ææ¯å¦ä¸ºç©ºé²ç©ºä½(æµè¯æ¶ä») |
| | | /// </summary> |
| | | /// <param name="locationInfos"></param> |
| | | /// <param name="emptyLocation"></param> |
| | | /// <returns></returns> |
| | | private Dt_LocationInfo? DepthLocationIsEmpty_GM(List<Dt_LocationInfo> locationInfos, Dt_LocationInfo emptyLocation, PalletTypeEnum palletType) |
| | | { |
| | | List<Dt_LocationInfo> locations = GetGroupLocations(locationInfos, emptyLocation); |
| | | |
| | | bool moreDepthFlag = false; |
| | | bool littleDepthFlag = false; |
| | | |
| | | switch (palletType) |
| | | { |
| | | case PalletTypeEnum.LargestPallet: |
| | | case PalletTypeEnum.LargePallet: |
| | | List<Dt_LocationInfo> moreDepth = locations.Where(x => x.Depth > emptyLocation.Depth).ToList(); |
| | | moreDepthFlag = moreDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.InStock.ObjToInt() && x.LocationStatus != LocationStatusEnum.PalletLock.ObjToInt()) == null;//æ¥è¯¢å¤§äºå½åè´§ä½æ·±åº¦çéåéæ¯å¦æç¶æä¸ä¸ºæè´§çè´§ä½ï¼å¦ææ¯trueï¼åè¡¨ç¤ºæ·±è´§ä½ææªè¢«ä½¿ç¨çæ
åµ |
| | | |
| | | List<Dt_LocationInfo> littleDepth = locations.Where(x => x.Depth <= emptyLocation.Depth).ToList(); |
| | | littleDepthFlag = littleDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.Free.ObjToInt() && x.EnableStatus != EnableStatusEnum.OnlyIn.ObjToInt() && x.EnableStatus != EnableStatusEnum.Normal.ObjToInt()) == null; //æ¥è¯¢å°äºå½åè´§ä½æ·±åº¦çéåéæ¯å¦æç¶æä¸ä¸ºç©ºï¼ä¸ç¦ç¨ç¶æä¸ä¸ºç¦ç¨ä»¥ååªå
¥çè´§ä½ï¼å¦ææ¯trueï¼å表示æµ
è´§ä½è¢«ä½¿ç¨æè
被ç¦ç¨çæ
åµ |
| | | break; |
| | | } |
| | | |
| | | if (moreDepthFlag && littleDepthFlag) |
| | | { |
| | | return emptyLocation; |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Common.CommonEnum; |
| | | using WIDESEA_Common.LocationEnum; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_IBasicRepository; |
| | | using WIDESEA_IBasicService; |
| | | using WIDESEA_Model.Models; |
| | | |
| | | namespace WIDESEA_BasicService |
| | | { |
| | | public partial class LocationInfoService |
| | | { |
| | | |
| | | double weightValue_PP = 0.25; |
| | | |
| | | private readonly static object _locker_PP = new object(); |
| | | static List<LocationCache> locationCaches_PP = new List<LocationCache>(); |
| | | |
| | | /// <summary> |
| | | /// PPä»è´§ä½åé
|
| | | /// </summary> |
| | | /// <param name="roadwayNo">å··éå·</param> |
| | | /// <param name="palletType"> |
| | | /// æçç±»å |
| | | /// </param> |
| | | /// <returns></returns> |
| | | public Dt_LocationInfo? AssignLocation_PP(string roadwayNo, PalletTypeEnum palletType, string beRelocationCode = "") |
| | | { |
| | | lock (_locker_PP) |
| | | { |
| | | List<LocationCache> removeItems = locationCaches_PP.Where(x => (DateTime.Now - x.DateTime).TotalMinutes > 5).ToList(); |
| | | int count = removeItems.Count; |
| | | for (int i = 0; i < count; i++) |
| | | { |
| | | locationCaches_PP.Remove(removeItems[i]); |
| | | } |
| | | |
| | | List<string> lockLocationCodes = locationCaches_PP.Select(x => x.LocationCode).ToList(); |
| | | |
| | | List<Dt_LocationInfo> locationInfos = Repository.QueryData(x => x.RoadwayNo == roadwayNo); |
| | | if (locationInfos == null || locationInfos.Count == 0) |
| | | { |
| | | throw new Exception($"æªæ¾å°è¯¥å··éçè´§ä½ä¿¡æ¯,å··éå·:{roadwayNo}"); |
| | | } |
| | | |
| | | if (!string.IsNullOrEmpty(beRelocationCode)) |
| | | { |
| | | Dt_LocationInfo? beRelocation = locationInfos.FirstOrDefault(x => x.LocationCode == beRelocationCode); |
| | | if (beRelocation == null) |
| | | { |
| | | throw new Exception($"æªæ¾å°è´§ä½ä¿¡æ¯"); |
| | | } |
| | | int maxDepth = locationInfos.Max(x => x.Depth); |
| | | int mathCurrentRow = beRelocation.Row - Convert.ToInt32(Math.Ceiling(beRelocation.Row / maxDepth / 2.0)) * maxDepth * 2; |
| | | if (mathCurrentRow <= maxDepth) |
| | | { |
| | | locationInfos = locationInfos.Where(x => x.Row - Convert.ToInt32(Math.Ceiling(x.Row / maxDepth / 2.0)) * maxDepth * 2 <= maxDepth).ToList(); |
| | | } |
| | | else |
| | | { |
| | | locationInfos = locationInfos.Where(x => x.Row - Convert.ToInt32(Math.Ceiling(x.Row / maxDepth / 2.0)) * maxDepth * 2 > maxDepth).ToList(); |
| | | } |
| | | } |
| | | |
| | | //å·²å®ä¹è´§ä½ç±»åçè´§ä½ |
| | | List<Dt_LocationInfo> definedTypeLocations = locationInfos.Where(x => x.LocationType == palletType.ObjToInt()).ToList(); |
| | | |
| | | //æªå®ä¹ç±»åçç©ºè´§ä½ |
| | | List<Dt_LocationInfo> undefinedTypeEmptyLocations = locationInfos.Where(x => (x.EnableStatus == EnableStatusEnum.Normal.ObjToInt() || x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt()) && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && x.LocationType == LocationTypeEnum.Undefined.ObjToInt() && !lockLocationCodes.Contains(x.LocationCode)).OrderByDescending(x => x.Depth).ThenBy(x => x.Layer).ThenBy(x => x.Row).ThenBy(x => x.Column).ToList(); |
| | | |
| | | List<Dt_LocationInfo> definedTypeEmptyLocations = locationInfos.Where(x => (x.EnableStatus == EnableStatusEnum.Normal.ObjToInt() || x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt()) && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && x.LocationType == palletType.ObjToInt() && !lockLocationCodes.Contains(x.LocationCode)).OrderByDescending(x => x.Depth).ThenBy(x => x.Layer).ThenBy(x => x.Row).ThenBy(x => x.Column).ToList(); |
| | | |
| | | if ((locationInfos.Count * weightValue_PP >= definedTypeLocations.Count && undefinedTypeEmptyLocations.Any()) || !definedTypeEmptyLocations.Any())//妿已å®ä¹ç±»åè´§ä½æªè¶
è¿æ¯ä¾ï¼ä¸ææªå®ä¹ç±»åçè´§ä½ |
| | | { |
| | | if (palletType == PalletTypeEnum.LargePallet || palletType == PalletTypeEnum.LargestPallet) |
| | | { |
| | | undefinedTypeEmptyLocations = undefinedTypeEmptyLocations.Where(x => x.Depth % 2 == 1).ToList(); |
| | | } |
| | | for (int i = 0; i < undefinedTypeEmptyLocations.Count; i++) |
| | | { |
| | | Dt_LocationInfo undefinedTypeEmptyLocation = undefinedTypeEmptyLocations[i]; |
| | | Dt_LocationInfo? locationInfo = GetUsableLocation_PP(locationInfos, undefinedTypeEmptyLocation, palletType); |
| | | if (locationInfo != null) |
| | | { |
| | | UpdateLocationStatus(locationInfo, palletType, LocationStatusEnum.Lock, 3); |
| | | locationCaches_PP.Add(new LocationCache { LocationCode = locationInfo.LocationCode, DateTime = DateTime.Now }); |
| | | return locationInfo; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | for (int i = 0; i < definedTypeEmptyLocations.Count; i++) |
| | | { |
| | | Dt_LocationInfo definedTypeEmptyLocation = definedTypeEmptyLocations[i]; |
| | | Dt_LocationInfo? locationInfo = GetUsableLocation_PP(locationInfos, definedTypeEmptyLocation, palletType); |
| | | if (locationInfo != null) |
| | | { |
| | | UpdateLocationStatus(locationInfo, palletType, LocationStatusEnum.Lock, 3); |
| | | locationCaches_PP.Add(new LocationCache { LocationCode = locationInfo.LocationCode, DateTime = DateTime.Now }); |
| | | return locationInfo; |
| | | } |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// è·åå¯ç¨è´§ä½(æµè¯æ¶ä») |
| | | /// </summary> |
| | | /// <param name="locationInfos"></param> |
| | | /// <param name="emptyLocation"></param> |
| | | /// <param name="palletType"></param> |
| | | /// <returns></returns> |
| | | private Dt_LocationInfo? GetUsableLocation_PP(List<Dt_LocationInfo> locationInfos, Dt_LocationInfo emptyLocation, PalletTypeEnum palletType) |
| | | { |
| | | switch (palletType) |
| | | { |
| | | case PalletTypeEnum.LargestPallet: |
| | | case PalletTypeEnum.LargePallet: |
| | | if (emptyLocation.Depth % 2 == 0) |
| | | { |
| | | return null; |
| | | } |
| | | break; |
| | | } |
| | | Dt_LocationInfo? locationInfo = DepthLocationIsEmpty_PP(locationInfos, emptyLocation, palletType); |
| | | if (locationInfo != null) |
| | | { |
| | | return locationInfo; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 夿ä¸å深度çåç»è´§ä½ç¶ææ¯å¦ä¸ºç©ºé²ç©ºä½(æµè¯æ¶ä») |
| | | /// </summary> |
| | | /// <param name="locationInfos"></param> |
| | | /// <param name="emptyLocation"></param> |
| | | /// <returns></returns> |
| | | private Dt_LocationInfo? DepthLocationIsEmpty_PP(List<Dt_LocationInfo> locationInfos, Dt_LocationInfo emptyLocation, PalletTypeEnum palletType) |
| | | { |
| | | List<Dt_LocationInfo> locations = GetGroupLocations(locationInfos, emptyLocation); |
| | | |
| | | bool moreDepthFlag = false; |
| | | bool littleDepthFlag = false; |
| | | |
| | | switch (palletType) |
| | | { |
| | | case PalletTypeEnum.LargestPallet: |
| | | case PalletTypeEnum.LargePallet: |
| | | List<Dt_LocationInfo> moreDepth = locations.Where(x => x.Depth > emptyLocation.Depth).ToList(); |
| | | moreDepthFlag = moreDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.InStock.ObjToInt() && x.LocationStatus != LocationStatusEnum.PalletLock.ObjToInt()) == null;//æ¥è¯¢å¤§äºå½åè´§ä½æ·±åº¦çéåéæ¯å¦æç¶æä¸ä¸ºæè´§çè´§ä½ï¼å¦ææ¯trueï¼åè¡¨ç¤ºæ·±è´§ä½ææªè¢«ä½¿ç¨çæ
åµ |
| | | |
| | | List<Dt_LocationInfo> littleDepth = locations.Where(x => x.Depth <= emptyLocation.Depth).ToList(); |
| | | littleDepthFlag = littleDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.Free.ObjToInt() && x.EnableStatus != EnableStatusEnum.OnlyIn.ObjToInt() && x.EnableStatus != EnableStatusEnum.Normal.ObjToInt()) == null; //æ¥è¯¢å°äºå½åè´§ä½æ·±åº¦çéåéæ¯å¦æç¶æä¸ä¸ºç©ºï¼ä¸ç¦ç¨ç¶æä¸ä¸ºç¦ç¨ä»¥ååªå
¥çè´§ä½ï¼å¦ææ¯trueï¼å表示æµ
è´§ä½è¢«ä½¿ç¨æè
被ç¦ç¨çæ
åµ |
| | | break; |
| | | } |
| | | |
| | | if (moreDepthFlag && littleDepthFlag) |
| | | { |
| | | return emptyLocation; |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Common.CommonEnum; |
| | | using WIDESEA_Common.LocationEnum; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_IBasicRepository; |
| | | using WIDESEA_IBasicService; |
| | | using WIDESEA_Model.Models; |
| | | |
| | | namespace WIDESEA_BasicService |
| | | { |
| | | public partial class LocationInfoService |
| | | { |
| | | |
| | | double weightValue_ZH = 0.25; |
| | | |
| | | private readonly static object _locker_ZH = new object(); |
| | | static List<LocationCache> locationCaches_ZH = new List<LocationCache>(); |
| | | |
| | | /// <summary> |
| | | /// é»çä»è´§ä½åé
|
| | | /// </summary> |
| | | /// <param name="roadwayNo">å··éå·</param> |
| | | /// <param name="palletType"> |
| | | /// æçç±»å |
| | | /// </param> |
| | | /// <returns></returns> |
| | | public Dt_LocationInfo? AssignLocation_ZH(string roadwayNo, PalletTypeEnum palletType, string beRelocationCode = "") |
| | | { |
| | | lock (_locker_ZH) |
| | | { |
| | | List<LocationCache> removeItems = locationCaches_ZH.Where(x => (DateTime.Now - x.DateTime).TotalMinutes > 5).ToList(); |
| | | int count = removeItems.Count; |
| | | for (int i = 0; i < count; i++) |
| | | { |
| | | locationCaches_ZH.Remove(removeItems[i]); |
| | | } |
| | | |
| | | List<string> lockLocationCodes = locationCaches_ZH.Select(x => x.LocationCode).ToList(); |
| | | |
| | | List<Dt_LocationInfo> locationInfos = Repository.QueryData(x => x.RoadwayNo == roadwayNo); |
| | | if (locationInfos == null || locationInfos.Count == 0) |
| | | { |
| | | throw new Exception($"æªæ¾å°è¯¥å··éçè´§ä½ä¿¡æ¯,å··éå·:{roadwayNo}"); |
| | | } |
| | | |
| | | if (!string.IsNullOrEmpty(beRelocationCode)) |
| | | { |
| | | Dt_LocationInfo? beRelocation = locationInfos.FirstOrDefault(x => x.LocationCode == beRelocationCode); |
| | | if (beRelocation == null) |
| | | { |
| | | throw new Exception($"æªæ¾å°è´§ä½ä¿¡æ¯"); |
| | | } |
| | | int maxDepth = locationInfos.Max(x => x.Depth); |
| | | int mathCurrentRow = beRelocation.Row - Convert.ToInt32(Math.Ceiling(beRelocation.Row / maxDepth / 2.0)) * maxDepth * 2; |
| | | if (mathCurrentRow <= maxDepth) |
| | | { |
| | | locationInfos = locationInfos.Where(x => x.Row - Convert.ToInt32(Math.Ceiling(x.Row / maxDepth / 2.0)) * maxDepth * 2 <= maxDepth).ToList(); |
| | | } |
| | | else |
| | | { |
| | | locationInfos = locationInfos.Where(x => x.Row - Convert.ToInt32(Math.Ceiling(x.Row / maxDepth / 2.0)) * maxDepth * 2 > maxDepth).ToList(); |
| | | } |
| | | } |
| | | |
| | | //å·²å®ä¹è´§ä½ç±»åçè´§ä½ |
| | | List<Dt_LocationInfo> definedTypeLocations = locationInfos.Where(x => x.LocationType == palletType.ObjToInt()).ToList(); |
| | | |
| | | //æªå®ä¹ç±»åçç©ºè´§ä½ |
| | | List<Dt_LocationInfo> undefinedTypeEmptyLocations = locationInfos.Where(x => (x.EnableStatus == EnableStatusEnum.Normal.ObjToInt() || x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt()) && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && x.LocationType == LocationTypeEnum.Undefined.ObjToInt() && !lockLocationCodes.Contains(x.LocationCode)).OrderByDescending(x => x.Depth).ThenBy(x => x.Layer).ThenBy(x => x.Row).ThenBy(x => x.Column).ToList(); |
| | | |
| | | List<Dt_LocationInfo> definedTypeEmptyLocations = locationInfos.Where(x => (x.EnableStatus == EnableStatusEnum.Normal.ObjToInt() || x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt()) && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && x.LocationType == palletType.ObjToInt() && !lockLocationCodes.Contains(x.LocationCode)).OrderByDescending(x => x.Depth).ThenBy(x => x.Layer).ThenBy(x => x.Row).ThenBy(x => x.Column).ToList(); |
| | | |
| | | if ((locationInfos.Count * weightValue_ZH >= definedTypeLocations.Count && undefinedTypeEmptyLocations.Any()) || !definedTypeEmptyLocations.Any())//妿已å®ä¹ç±»åè´§ä½æªè¶
è¿æ¯ä¾ï¼ä¸ææªå®ä¹ç±»åçè´§ä½ |
| | | { |
| | | if (palletType == PalletTypeEnum.LargePallet || palletType == PalletTypeEnum.LargestPallet) |
| | | { |
| | | undefinedTypeEmptyLocations = undefinedTypeEmptyLocations.Where(x => x.Depth % 2 == 1).ToList(); |
| | | } |
| | | for (int i = 0; i < undefinedTypeEmptyLocations.Count; i++) |
| | | { |
| | | Dt_LocationInfo undefinedTypeEmptyLocation = undefinedTypeEmptyLocations[i]; |
| | | Dt_LocationInfo? locationInfo = GetUsableLocation_ZH(locationInfos, undefinedTypeEmptyLocation, palletType); |
| | | if (locationInfo != null) |
| | | { |
| | | UpdateLocationStatus(locationInfo, palletType, LocationStatusEnum.Lock, 3); |
| | | locationCaches_ZH.Add(new LocationCache { LocationCode = locationInfo.LocationCode, DateTime = DateTime.Now }); |
| | | return locationInfo; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | for (int i = 0; i < definedTypeEmptyLocations.Count; i++) |
| | | { |
| | | Dt_LocationInfo definedTypeEmptyLocation = definedTypeEmptyLocations[i]; |
| | | Dt_LocationInfo? locationInfo = GetUsableLocation_ZH(locationInfos, definedTypeEmptyLocation, palletType); |
| | | if (locationInfo != null) |
| | | { |
| | | UpdateLocationStatus(locationInfo, palletType, LocationStatusEnum.Lock, 3); |
| | | locationCaches_ZH.Add(new LocationCache { LocationCode = locationInfo.LocationCode, DateTime = DateTime.Now }); |
| | | return locationInfo; |
| | | } |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// è·åå¯ç¨è´§ä½(æµè¯æ¶ä») |
| | | /// </summary> |
| | | /// <param name="locationInfos"></param> |
| | | /// <param name="emptyLocation"></param> |
| | | /// <param name="palletType"></param> |
| | | /// <returns></returns> |
| | | private Dt_LocationInfo? GetUsableLocation_ZH(List<Dt_LocationInfo> locationInfos, Dt_LocationInfo emptyLocation, PalletTypeEnum palletType) |
| | | { |
| | | switch (palletType) |
| | | { |
| | | case PalletTypeEnum.LargestPallet: |
| | | case PalletTypeEnum.LargePallet: |
| | | if (emptyLocation.Depth % 2 == 0) |
| | | { |
| | | return null; |
| | | } |
| | | break; |
| | | } |
| | | Dt_LocationInfo? locationInfo = DepthLocationIsEmpty_ZH(locationInfos, emptyLocation, palletType); |
| | | if (locationInfo != null) |
| | | { |
| | | return locationInfo; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 夿ä¸å深度çåç»è´§ä½ç¶ææ¯å¦ä¸ºç©ºé²ç©ºä½(æµè¯æ¶ä») |
| | | /// </summary> |
| | | /// <param name="locationInfos"></param> |
| | | /// <param name="emptyLocation"></param> |
| | | /// <returns></returns> |
| | | private Dt_LocationInfo? DepthLocationIsEmpty_ZH(List<Dt_LocationInfo> locationInfos, Dt_LocationInfo emptyLocation, PalletTypeEnum palletType) |
| | | { |
| | | List<Dt_LocationInfo> locations = GetGroupLocations(locationInfos, emptyLocation); |
| | | |
| | | bool moreDepthFlag = false; |
| | | bool littleDepthFlag = false; |
| | | |
| | | switch (palletType) |
| | | { |
| | | case PalletTypeEnum.LargestPallet: |
| | | case PalletTypeEnum.LargePallet: |
| | | List<Dt_LocationInfo> moreDepth = locations.Where(x => x.Depth > emptyLocation.Depth).ToList(); |
| | | moreDepthFlag = moreDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.InStock.ObjToInt() && x.LocationStatus != LocationStatusEnum.PalletLock.ObjToInt()) == null;//æ¥è¯¢å¤§äºå½åè´§ä½æ·±åº¦çéåéæ¯å¦æç¶æä¸ä¸ºæè´§çè´§ä½ï¼å¦ææ¯trueï¼åè¡¨ç¤ºæ·±è´§ä½ææªè¢«ä½¿ç¨çæ
åµ |
| | | |
| | | List<Dt_LocationInfo> littleDepth = locations.Where(x => x.Depth <= emptyLocation.Depth).ToList(); |
| | | littleDepthFlag = littleDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.Free.ObjToInt() && x.EnableStatus != EnableStatusEnum.OnlyIn.ObjToInt() && x.EnableStatus != EnableStatusEnum.Normal.ObjToInt()) == null; //æ¥è¯¢å°äºå½åè´§ä½æ·±åº¦çéåéæ¯å¦æç¶æä¸ä¸ºç©ºï¼ä¸ç¦ç¨ç¶æä¸ä¸ºç¦ç¨ä»¥ååªå
¥çè´§ä½ï¼å¦ææ¯trueï¼å表示æµ
è´§ä½è¢«ä½¿ç¨æè
被ç¦ç¨çæ
åµ |
| | | break; |
| | | } |
| | | |
| | | if (moreDepthFlag && littleDepthFlag) |
| | | { |
| | | return emptyLocation; |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | namespace WIDESEA_BasicService |
| | | { |
| | | public partial class LocationInfoService : ServiceBase<Dt_LocationInfo, ILocationInfoRepository>, ILocationInfoService |
| | | public class LocationInfoService_Old |
| | | { |
| | | private readonly ILocationInfoRepository Repository; |
| | | |
| | | public LocationInfoService_Old(ILocationInfoRepository repository) |
| | | { |
| | | Repository = repository; |
| | | } |
| | | |
| | | double weightValue = 0.5; |
| | | |
| | | private readonly static object _locker = new object(); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using AutoMapper; |
| | | using SqlSugar; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.BaseRepository; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_Core.Enums; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_Core.Utilities; |
| | | using WIDESEA_DTO.Basic; |
| | | using WIDESEA_IBasicRepository; |
| | | using WIDESEA_IRecordService; |
| | | using WIDESEA_IBasicService; |
| | | using WIDESEA_Model.Models; |
| | | using WIDESEA_Common.CommonEnum; |
| | | using WIDESEA_Common.LocationEnum; |
| | | |
| | | namespace WIDESEA_BasicService |
| | | { |
| | | public partial class LocationInfoService |
| | | { |
| | | public Dt_LocationInfo? AssignLocation(string roadwayNo, PalletTypeEnum palletType, int warehouseId) |
| | | { |
| | | Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseId == warehouseId); |
| | | if (warehouse == null) |
| | | { |
| | | throw new Exception($"æªæ¾å°ä»åºä¿¡æ¯"); |
| | | } |
| | | |
| | | return warehouse.WarehouseName switch |
| | | { |
| | | "æ¿æä»" => AssignLocation_BC(roadwayNo, palletType), |
| | | "PPä»" => AssignLocation_PP(roadwayNo, palletType), |
| | | "å¹²èä»" => AssignLocation_GM(roadwayNo, palletType), |
| | | "æµè¯æ¶ä»" => AssignLocation_CSJ(roadwayNo, palletType), |
| | | "é»çä»" => AssignLocation_ZH(roadwayNo, palletType), |
| | | "油墨ä»" => AssignLocation(roadwayNo), |
| | | "æåä»" => AssignLocation(roadwayNo), |
| | | "è¾
æä»" => AssignLocation(roadwayNo), |
| | | _ => throw new Exception($"æªæ¾å°ä»åºè´§ä½åé
æ¹æ³") |
| | | }; |
| | | } |
| | | |
| | | private readonly static object _locker = new object(); |
| | | private static List<LocationCache> locationCaches = new List<LocationCache>(); |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="roadwayNo"></param> |
| | | /// <returns></returns> |
| | | public Dt_LocationInfo? AssignLocation(string roadwayNo) |
| | | { |
| | | lock (_locker) |
| | | { |
| | | List<LocationCache> removeItems = locationCaches.Where(x => (DateTime.Now - x.DateTime).TotalMinutes > 5).ToList();//æ¥è¯¢æ·»å éæåéè¶
è¿5åéçè´§ä½ |
| | | int count = removeItems.Count; |
| | | for (int i = 0; i < count; i++) |
| | | { |
| | | locationCaches.Remove(removeItems[i]);//ç§»é¤æ¥è¯¢æ·»å éæåéè¶
è¿5åéçè´§ä½ |
| | | } |
| | | |
| | | List<string> lockLocations = locationCaches.Select(x => x.LocationCode).ToList(); |
| | | |
| | | List<Dt_LocationInfo> locationInfos = BaseDal.QueryData(x => x.RoadwayNo == roadwayNo);//æ¥è¯¢å··éææè´§ä½ä¿¡æ¯ |
| | | |
| | | Dictionary<string, OrderByType> orderBy = new Dictionary<string, OrderByType>() |
| | | { |
| | | { nameof(Dt_LocationInfo.Layer),OrderByType.Asc }, |
| | | { nameof(Dt_LocationInfo.Column),OrderByType.Asc }, |
| | | { nameof(Dt_LocationInfo.Depth),OrderByType.Desc }, |
| | | { nameof(Dt_LocationInfo.Row),OrderByType.Asc } |
| | | }; |
| | | |
| | | return BaseDal.QueryFirst(x => x.RoadwayNo == roadwayNo && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && !lockLocations.Contains(x.LocationCode), orderBy);//æ¥è¯¢ç©ºè´§ä½ä¿¡æ¯å¹¶æé¤5åéå
åé
çè´§ä½,æ ¹æ®å±ãåãæ·±åº¦ãè¡æåº |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ä¿®æ¹è´§ä½ç¶æåç±»å |
| | | /// </summary> |
| | | /// <param name="locationCode">è´§ä½ç¼å·</param> |
| | | /// <param name="palletType">æçç±»å</param> |
| | | /// <param name="locationStatus">è´§ä½ç¶æ</param> |
| | | public void UpdateLocationStatus(string locationCode, PalletTypeEnum palletType, LocationStatusEnum locationStatus, int warehousId) |
| | | { |
| | | Dt_LocationInfo location = Repository.QueryFirst(x => x.LocationCode == locationCode); |
| | | if (location == null) |
| | | { |
| | | throw new Exception($"æªæ¾å°è´§ä½ä¿¡æ¯,{locationCode}"); |
| | | } |
| | | UpdateLocationStatus(location, palletType, locationStatus, warehousId); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ä¿®æ¹è´§ä½ç¶æåç±»å |
| | | /// </summary> |
| | | /// <param name="location">è´§ä½å¯¹è±¡</param> |
| | | /// <param name="palletType">æçç±»å</param> |
| | | /// <param name="locationStatus">è´§ä½ç¶æ</param> |
| | | public void UpdateLocationStatus(Dt_LocationInfo location, PalletTypeEnum palletType, LocationStatusEnum locationStatus, int warehousId) |
| | | { |
| | | List<Dt_LocationInfo> locationInfos = Repository.QueryData(x => x.RoadwayNo == location.RoadwayNo); |
| | | |
| | | List<Dt_LocationInfo> locations = GetGroupLocations(locationInfos, location); |
| | | if (locationInfos.Max(x => x.Depth) < 3) |
| | | { |
| | | for (int i = 0; i < locations.Count; i++) |
| | | { |
| | | locations[i].LocationStatus = locationStatus.ObjToInt(); |
| | | locations[i].LocationType = palletType.ObjToInt(); |
| | | } |
| | | |
| | | Dt_LocationInfo? nearLocation = locationInfos.FirstOrDefault(x => x.Row == location.Row && x.Layer == location.Layer && x.Depth == location.Depth && x.Column == location.Column + 1); |
| | | if (nearLocation != null) |
| | | { |
| | | List<Dt_LocationInfo> nearLocations = GetGroupLocations(locationInfos, nearLocation); |
| | | for (int i = 0; i < nearLocations.Count; i++) |
| | | { |
| | | nearLocations[i].LocationType = palletType.ObjToInt(); |
| | | if (palletType == PalletTypeEnum.LargePallet) |
| | | { |
| | | nearLocations[i].LocationStatus = locationStatus.ObjToInt(); |
| | | } |
| | | } |
| | | locations.AddRange(nearLocations); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | for (int i = 0; i < locations.Count; i++) |
| | | { |
| | | locations[i].LocationStatus = locationStatus.ObjToInt(); |
| | | locations[i].LocationType = palletType.ObjToInt(); |
| | | } |
| | | } |
| | | Repository.UpdateData(locations); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// è·åä¸å深度çåç»è´§ä½ä¿¡æ¯ |
| | | /// </summary> |
| | | /// <param name="locationInfos"></param> |
| | | /// <param name="location"></param> |
| | | /// <returns></returns> |
| | | private List<Dt_LocationInfo> GetGroupLocations(List<Dt_LocationInfo> locationInfos, Dt_LocationInfo location) |
| | | { |
| | | List<Dt_LocationInfo> groupLocations = new List<Dt_LocationInfo>() { location }; |
| | | int maxDepth = locationInfos.Max(x => x.Depth); |
| | | for (int j = location.Depth + 1; j <= maxDepth; j++) |
| | | { |
| | | Dt_LocationInfo? locationInfo = locationInfos.FirstOrDefault(x => x.Depth == j && x.Column == location.Column && x.Layer == location.Layer); |
| | | if (locationInfo != null) |
| | | { |
| | | groupLocations.Add(locationInfo); |
| | | } |
| | | } |
| | | |
| | | for (int j = location.Depth - 1; j >= 1; j--) |
| | | { |
| | | Dt_LocationInfo? locationInfo = locationInfos.FirstOrDefault(x => x.Depth == j && x.Column == location.Column && x.Layer == location.Layer); |
| | | if (locationInfo != null) |
| | | { |
| | | groupLocations.Add(locationInfo); |
| | | } |
| | | } |
| | | return groupLocations; |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | <Project Sdk="Microsoft.NET.Sdk"> |
| | | <Project Sdk="Microsoft.NET.Sdk"> |
| | | |
| | | <PropertyGroup> |
| | | <TargetFramework>net6.0</TargetFramework> |
| | |
| | | /// 大æç |
| | | /// </summary> |
| | | LargePallet = 3, |
| | | |
| | | /// <summary> |
| | | /// æå¤§æç |
| | | /// </summary> |
| | | LargestPallet = 4 |
| | | } |
| | | } |
| | |
| | | /// æè´§ |
| | | /// </summary> |
| | | [Description("æè´§")] |
| | | InStock = 2, |
| | | InStock = 100, |
| | | |
| | | /// <summary> |
| | | /// 空æéå® |
| | | /// 大æçéå® |
| | | /// </summary> |
| | | [Description("空æéå®")] |
| | | PalletLock = 98, |
| | | |
| | | /// <summary> |
| | | /// 空æç |
| | | /// </summary> |
| | | [Description("空æç")] |
| | | Pallet = 99 |
| | | [Description("大æçéå®")] |
| | | PalletLock = 99 |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace WIDESEA_Common.TaskEnum |
| | | { |
| | | public static class TaskEnumHelper |
| | | { |
| | | public static List<int> GetEnumIndexList(this Type type) |
| | | { |
| | | if (type is null) throw new ArgumentNullException("type"); |
| | | if (!type.IsEnum) return new List<int>(); |
| | | return Enum.GetValues(type).Cast<int>().ToList(); |
| | | } |
| | | } |
| | | } |
ÎļþÃû´Ó ´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_Common/TaskEnum/InTaskStatusEnum.cs ÐÞ¸Ä |
| | |
| | | /// <summary> |
| | | /// å
¥åºä»»å¡ç¶æ |
| | | /// </summary> |
| | | public enum InTaskStatusEnum |
| | | public enum TaskInStatusEnum |
| | | { |
| | | /// <summary> |
| | | /// æ°å»ºå
¥åºä»»å¡ |
| | | /// </summary> |
| | | [Description("æ°å»º")] |
| | | InNew = 200, |
| | | |
| | | /// <summary> |
| | | /// å åæºå¾
æ§è¡ |
| | | /// </summary> |
| | | [Description("å åæºå¾
æ§è¡")] |
| | | SC_InExecute = 225, |
| | | |
| | | /// <summary> |
| | | /// å åæºå
¥åºæ§è¡ä¸ |
| | |
| | | /// </summary> |
| | | [Description("å
¥åºä»»å¡å¼å¸¸")] |
| | | InException = 299, |
| | | |
| | | /// <summary> |
| | | /// æ°å»ºç§»åºä»»å¡ |
| | | /// </summary> |
| | | [Description("æ°å»ºç§»åºä»»å¡")] |
| | | RelocationNew = 300, |
| | | |
| | | /// <summary> |
| | | /// ç§»åºä»»å¡å®æ |
| | | /// </summary> |
| | | [Description("ç§»åºä»»å¡å®æ")] |
| | | RelocationFinish = 310, |
| | | |
| | | /// <summary> |
| | | /// ç§»åºä»»å¡æ§è¡ä¸ |
| | | /// </summary> |
| | | [Description("ç§»åºä»»å¡æ§è¡ä¸")] |
| | | RelocationExecuting = 320, |
| | | |
| | | /// <summary> |
| | | /// ç§»åºä»»å¡åæ¶ |
| | | /// </summary> |
| | | [Description("ç§»åºä»»å¡åæ¶")] |
| | | RelocationCancel = 330, |
| | | |
| | | /// <summary> |
| | | /// ç§»åºä»»å¡å¼å¸¸ |
| | | /// </summary> |
| | | [Description("ç§»åºä»»å¡å¼å¸¸")] |
| | | RelocationException = 340, |
| | | } |
| | | } |
ÎļþÃû´Ó ´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_Common/TaskEnum/OutTaskStatusEnum.cs ÐÞ¸Ä |
| | |
| | | /// <summary> |
| | | /// åºåºä»»å¡ç¶æ |
| | | /// </summary> |
| | | public enum OutTaskStatusEnum |
| | | public enum TaskOutStatusEnum |
| | | { |
| | | /// <summary> |
| | | /// æ°å»ºä»»å¡ |
| | |
| | | |
| | | namespace WIDESEA_Common.TaskEnum |
| | | { |
| | | /// <summary> |
| | | /// ä»»å¡ç±»å |
| | | /// </summary> |
| | | public enum TaskTypeEnum |
| | | public enum TaskInboundTypeEnum |
| | | { |
| | | /// <summary> |
| | | /// åºåº =100 |
| | | /// </summary> |
| | | [Description("åºåº")] |
| | | Outbound = 100, |
| | | |
| | | /// <summary> |
| | | /// çç¹åºåº |
| | | /// </summary> |
| | | [Description("çç¹åºåº")] |
| | | OutInventory = 101, |
| | | |
| | | /// <summary> |
| | | /// 忣åºåº |
| | | /// </summary> |
| | | [Description("忣åºåº")] |
| | | OutPick = 102, |
| | | |
| | | /// <summary> |
| | | /// è´¨æ£åºåº |
| | | /// </summary> |
| | | [Description("è´¨æ£åºåº")] |
| | | OutQuality = 103, |
| | | |
| | | /// <summary> |
| | | /// åºç©º |
| | | /// </summary> |
| | | [Description("åºç©º")] |
| | | PalletOutbound = 104, |
| | | |
| | | /// <summary> |
| | | /// 补空 |
| | | /// </summary> |
| | | [Description("补空")] |
| | | PalletFillOutbound = 105, |
| | | |
| | | /// <summary> |
| | | /// å
¥åº |
| | | /// </summary> |
| | | [Description("å
¥åº")] |
| | | Inbound = 200, |
| | | |
| | | /// <summary> |
| | | /// çç¹å
¥åº |
| | | /// </summary> |
| | | [Description("çç¹å
¥åº")] |
| | | InInventory = 201, |
| | | |
| | | /// <summary> |
| | | /// 忣å
¥åº |
| | | /// </summary> |
| | | [Description("忣å
¥åº")] |
| | | InPick = 202, |
| | | |
| | | /// <summary> |
| | | /// è´¨æ£å
¥åº |
| | | /// </summary> |
| | | [Description("è´¨æ£å
¥åº")] |
| | | InQuality = 203, |
| | | InQuality = 203 |
| | | } |
| | | |
| | | public enum TaskOutboundTypeEnum |
| | | { |
| | | /// <summary> |
| | | /// å
¥ç©º |
| | | /// åºåº |
| | | /// </summary> |
| | | [Description("å
¥ç©º")] |
| | | PalletInbound = 204, |
| | | |
| | | [Description("åºåº")] |
| | | Outbound = 100, |
| | | /// <summary> |
| | | /// å空 |
| | | /// çç¹åºåº |
| | | /// </summary> |
| | | [Description("å空")] |
| | | PalletReturnInbound = 205, |
| | | |
| | | [Description("çç¹åºåº")] |
| | | OutInventory = 101, |
| | | /// <summary> |
| | | /// ç§»åº |
| | | /// 忣åºåº |
| | | /// </summary> |
| | | [Description("ç§»åº")] |
| | | Relocation = 300, |
| | | [Description("忣åºåº")] |
| | | OutPick = 102, |
| | | /// <summary> |
| | | /// è´¨æ£åºåº |
| | | /// </summary> |
| | | [Description("è´¨æ£åºåº")] |
| | | OutQuality = 103, |
| | | } |
| | | |
| | | public enum TaskRelocationTypeEnum |
| | | { |
| | | /// <summary> |
| | | /// åºå
ç§»åº |
| | | /// </summary> |
| | | [Description("åºå
ç§»åº")] |
| | | RelocationIn = 301, |
| | | |
| | | Relocation = 300, |
| | | /// <summary> |
| | | /// åºå¤ç§»åº |
| | | /// </summary> |
| | | [Description("åºå¤ç§»åº")] |
| | | RelocationOut = 302, |
| | | RelocationIn = 301 |
| | | } |
| | | |
| | | [Description("AGVæ¬è¿")] |
| | | AGVCarry = 500, |
| | | public enum TaskOtherTypeEnum |
| | | { |
| | | |
| | | } |
| | | } |
| | |
| | | string result = string.Empty; |
| | | using HttpClient httpClient = new HttpClient(); |
| | | httpClient.Timeout = new TimeSpan(0, 0, 60); |
| | | |
| | | if (headers != null) |
| | | { |
| | | foreach (var header in headers) |
| | | httpClient.DefaultRequestHeaders.Add(header.Key, header.Value); |
| | | } |
| | | |
| | | result = await httpClient.GetAsync(serviceAddress).Result.Content.ReadAsStringAsync(); |
| | | return result; |
| | |
| | | httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/json"); |
| | | using HttpClient httpClient = new HttpClient(); |
| | | httpClient.Timeout = new TimeSpan(0, 0, 60); |
| | | |
| | | if (headers != null) |
| | | { |
| | | foreach (var header in headers) |
| | | httpClient.DefaultRequestHeaders.Add(header.Key, header.Value); |
| | | } |
| | | |
| | | result = await httpClient.PostAsync(serviceAddress, httpContent).Result.Content.ReadAsStringAsync(); |
| | | } |
| | |
| | | string result = string.Empty; |
| | | using HttpClient httpClient = new HttpClient(); |
| | | httpClient.Timeout = new TimeSpan(0, 0, 60); |
| | | |
| | | if (headers != null) |
| | | { |
| | | foreach (var header in headers) |
| | | httpClient.DefaultRequestHeaders.Add(header.Key, header.Value); |
| | | } |
| | | |
| | | result = httpClient.GetStringAsync(serviceAddress).Result; |
| | | return result; |
| | |
| | | using HttpClient httpClient = new HttpClient(); |
| | | httpClient.Timeout = new TimeSpan(0, 0, 60); |
| | | |
| | | if (headers != null) |
| | | { |
| | | foreach (var header in headers) |
| | | httpClient.DefaultRequestHeaders.Add(header.Key, header.Value); |
| | | } |
| | | |
| | | |
| | | result = httpClient.PostAsync(serviceAddress, httpContent).Result.Content.ReadAsStringAsync().Result; |
| | | } |
| | |
| | | |
| | | namespace WIDESEA_DTO |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | [ModelValidate] |
| | | public class ErpResponseContent |
| | | { |
| | | public class content |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public string Code { get; set; } |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public string Name { get; set; } |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public string ShortName { get; set; } |
| | | } |
| | | |
| | | |
| | | //public class Root |
| | | //{ |
| | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public content Content { get; set; } |
| | | public Content Content { get; set; } |
| | | //} |
| | | public static ErpResponseContent Instance |
| | | { |
| | |
| | | return this; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public class Content |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public string Code { get; set; } |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public string Name { get; set; } |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public string ShortName { get; set; } |
| | | } |
| | | } |
| | |
| | | |
| | | namespace WIDESEA_DTO |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | [ModelValidate] |
| | | public class MesResponseContent |
| | | { |
| | |
| | | /// |
| | | /// </summary> |
| | | public DateTime DataTime { get; set; } |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public content Content { get; set; } |
| | | |
| | | public class content |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public string Code { get; set; } |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public string Name { get; set; } |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public string ShortName { get; set; } |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public string Contacts { get; set; } |
| | | } |
| | | |
| | | public static MesResponseContent Instance |
| | | { |
| | |
| | | StrMsg = message == null ? "æ§è¡å¤±è´¥" : message; |
| | | return this; |
| | | } |
| | | public Content Content { get; set; } |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace WIDESEA_DTO.Task |
| | | { |
| | | public class WMSTaskDTO |
| | | { |
| | | /// <summary> |
| | | /// WMSä»»å¡ä¸»é® |
| | | /// </summary> |
| | | public int Id { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä»»å¡å· |
| | | /// </summary> |
| | | public int TaskNum { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æçå· |
| | | /// </summary> |
| | | public string PalletCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å··éå· |
| | | /// </summary> |
| | | public string RoadWay { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä»»å¡ç±»å |
| | | /// </summary> |
| | | public int TaskType { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä»»å¡ç¶æ |
| | | /// </summary> |
| | | public int TaskStatus { get; set; } |
| | | |
| | | /// <summary> |
| | | /// èµ·ç¹ |
| | | /// </summary> |
| | | public string SourceAddress { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç»ç¹ |
| | | /// </summary> |
| | | public string TargetAddress { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä¼å
级 |
| | | /// </summary> |
| | | public int Grade { get; set; } |
| | | } |
| | | } |
| | |
| | | /// <param name="roadwayNo">å··éå·</param> |
| | | /// <param name="palletType">æçç±»å</param> |
| | | /// <returns></returns> |
| | | Dt_LocationInfo? AssignLocation(string roadwayNo, PalletTypeEnum palletType); |
| | | Dt_LocationInfo? AssignLocation(string roadwayNo, PalletTypeEnum palletType, int warehouseId); |
| | | |
| | | /// <summary> |
| | | /// ä¿®æ¹è´§ä½ç¶æåç±»å |
| | |
| | | /// <param name="locationCode">è´§ä½ç¼å·</param> |
| | | /// <param name="palletType">æçç±»å</param> |
| | | /// <param name="locationStatus">è´§ä½ç¶æ</param> |
| | | void UpdateLocationStatus(string locationCode, PalletTypeEnum palletType, LocationStatusEnum locationStatus); |
| | | void UpdateLocationStatus(string locationCode, PalletTypeEnum palletType, LocationStatusEnum locationStatus, int warehousId); |
| | | |
| | | /// <summary> |
| | | /// ä¿®æ¹è´§ä½ç¶æåç±»å |
| | |
| | | /// <param name="location">è´§ä½å¯¹è±¡</param> |
| | | /// <param name="palletType">æçç±»å</param> |
| | | /// <param name="locationStatus">è´§ä½ç¶æ</param> |
| | | void UpdateLocationStatus(Dt_LocationInfo location, PalletTypeEnum palletType, LocationStatusEnum locationStatus); |
| | | void UpdateLocationStatus(Dt_LocationInfo location, PalletTypeEnum palletType, LocationStatusEnum locationStatus, int warehousId); |
| | | } |
| | | } |
| | |
| | | List<Dt_StockInfo> GetStockInfosExclude(string materielCode, List<string> palletCodes); |
| | | |
| | | bool UpdateDataWithDetail(Dt_StockInfo stockInfo); |
| | | |
| | | Dt_StockInfo GetPalletStockInfo(string roadwayNo); |
| | | } |
| | | } |
| | |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Common.CommonEnum; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_Core.Enums; |
| | |
| | | { |
| | | ITaskRepository Repository { get; } |
| | | |
| | | WebResponseContent PushTasksToWCS(); |
| | | |
| | | /// <summary> |
| | | /// ç³è¯·å
¥åºä»»å¡(PDA使ç¨ï¼ä»
æçç»å®å
¥åºç«å°ï¼ä¸åé
è´§ä½) |
| | | /// </summary> |
| | | /// <param name="palletCode">æçå·</param> |
| | | /// <param name="stationCode">ç«å°å·</param> |
| | | /// <returns></returns> |
| | | WebResponseContent RequestInboundTask(string palletCode, string stationCode); |
| | | |
| | | /// <summary> |
| | | /// å
¥åºä»»å¡ç³è¯·åé
è´§ä½ |
| | | /// </summary> |
| | | /// <param name="taskNum">ä»»å¡å·</param> |
| | | /// <param name="roadwayNo">å··éå·</param> |
| | | /// <param name="palletType">æçç±»å</param> |
| | | /// <returns></returns> |
| | | WebResponseContent AssignInboundTaskLocation(int taskNum, string roadwayNo); |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="taskNum"></param> |
| | | /// <returns></returns> |
| | | WebResponseContent InboundTaskCompleted(int taskNum); |
| | | /// <summary> |
| | | /// æµè¯æ¶åºä» |
| | |
| | | |
| | | namespace WIDESEA_Model.Models |
| | | { |
| | | /// <summary> |
| | | /// å®¡æ¹æµç¨è¡¨ |
| | | /// </summary> |
| | | [SugarTable(nameof(Dt_ApprovalFlow), "å®¡æ¹æµç¨è¡¨")] |
| | | public class Dt_ApprovalFlow : BaseEntity |
| | | { |
| | | [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "å®¡æ¹æµç¨ç¼å·ï¼ä¸»é®")] |
| | | /// <summary> |
| | | /// ä¸»é® |
| | | /// </summary> |
| | | [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "主é®")] |
| | | public int Id { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å®¡æ¹æµç¨ç¼å· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "å®¡æ¹æµç¨ç¼å·")] |
| | | public string FlowCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å®¡æ¹æµç¨åç§° |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "å®¡æ¹æµç¨åç§°")] |
| | | public string FlowName { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å®¡æ¹æµç¨æè¿° |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 200, ColumnDescription = "å®¡æ¹æµç¨æè¿°")] |
| | | public string FlowDes { get; set; } |
| | | } |
| | |
| | | |
| | | namespace WIDESEA_Model.Models |
| | | { |
| | | /// <summary> |
| | | /// 审æ¹èç¹è¡¨ |
| | | /// </summary> |
| | | [SugarTable(nameof(Dt_ApprovalNode), "审æ¹èç¹è¡¨")] |
| | | public class Dt_ApprovalNode : BaseEntity |
| | | { |
| | | [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "审æ¹èç¹ç¼å·ï¼ä¸»é®")] |
| | | /// <summary> |
| | | /// ä¸»é® |
| | | /// </summary> |
| | | [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "主é®")] |
| | | public int Id { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å®¡æ¹æµç¨ç¼å· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "å®¡æ¹æµç¨ç¼å·ï¼å¤é®")] |
| | | public int FlowId { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 审æ¹èç¹åç§° |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "审æ¹èç¹åç§°")] |
| | | public string NodeName { get; set; } |
| | | |
| | | /// <summary> |
| | | /// èç¹ç±»åï¼å¦å人审æ¹ãå¤äººå®¡æ¹ãä¼ç¾çï¼ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "èç¹ç±»åï¼å¦å人审æ¹ãå¤äººå®¡æ¹ãä¼ç¾çï¼")] |
| | | public int NodeType { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 审æ¹äººè§è²ï¼å¦é¨é¨ç»çãæ»ç»ççï¼ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "审æ¹äººè§è²ï¼å¦é¨é¨ç»çãæ»ç»ççï¼")] |
| | | public int ApproverRole { get; set; } |
| | | |
| | | /// <summary> |
| | | /// èç¹é¡ºåº |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "èç¹é¡ºåº")] |
| | | public int NodeSequence { get; set; } |
| | | } |
| | |
| | | |
| | | namespace WIDESEA_Model.Models |
| | | { |
| | | /// <summary> |
| | | /// 审æ¹ä»»å¡è¡¨ |
| | | /// </summary> |
| | | [SugarTable(nameof(Dt_ApprovalTask), "审æ¹ä»»å¡è¡¨")] |
| | | public class Dt_ApprovalTask : BaseEntity |
| | | { |
| | |
| | | public string AuditUser { get; set; } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// æ¥æºä¸»é® |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "")] |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "æ¥æºä¸»é®")] |
| | | public int SourceKey { get; set; } |
| | | } |
| | | } |
| | |
| | | |
| | | namespace WIDESEA_Model.Models |
| | | { |
| | | /// <summary> |
| | | /// èç¹è·³è½¬è¡¨ |
| | | /// </summary> |
| | | [SugarTable(nameof(Dt_NodeTransition), "èç¹è·³è½¬è¡¨")] |
| | | public class Dt_NodeTransition : BaseEntity |
| | | { |
| | | /// <summary> |
| | | /// 跳转ç¼å· |
| | | /// </summary> |
| | | [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "跳转ç¼å·ï¼ä¸»é®")] |
| | | public int Id { get; set; } |
| | | |
| | | /// <summary> |
| | | /// èµ·å§èç¹ç¼å· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "èµ·å§èç¹ç¼å·ï¼å¤é®")] |
| | | public int FromNodeId { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç®æ èç¹ç¼å· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "ç®æ èç¹ç¼å·ï¼å¤é®")] |
| | | public int ToNodeId { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 跳转æ¡ä»¶ï¼å¦âåæå跳转å°ä¸ä¸èç¹âï¼âæç»åç»ææµç¨âçï¼ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 200, ColumnDescription = "跳转æ¡ä»¶ï¼å¦âåæå跳转å°ä¸ä¸èç¹âï¼âæç»åç»ææµç¨âçï¼")] |
| | | public string Condition { get; set; } |
| | | } |
| | |
| | | |
| | | namespace WIDESEA_Model.Models |
| | | { |
| | | /// <summary> |
| | | /// 客æ·ä¿¡æ¯ |
| | | /// </summary> |
| | | [SugarTable(nameof(Dt_CustomerInfo),"客æ·ä¿¡æ¯")] |
| | | public class Dt_CustomerInfo : BaseEntity |
| | | { |
| | | /// <summary> |
| | | /// ä¸»é® |
| | | /// </summary> |
| | | [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "主é®")] |
| | | public int Id { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 客æ·ç¼ç |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "客æ·ç¼ç ")] |
| | | public string Code { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 客æ·åç§° |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "客æ·åç§°")] |
| | | public string Name { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 客æ·å
¨ç§° |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 100, ColumnDescription = "客æ·å
¨ç§°")] |
| | | public string NickName { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 客æ·ç¶æ 0:ç¦ç¨ 1:å¯ç¨ |
| | | /// </summary> |
| | |
| | | |
| | | namespace WIDESEA_Model.Models |
| | | { |
| | | /// <summary> |
| | | /// è´§ä½ä¿¡æ¯ |
| | | /// </summary> |
| | | [SugarTable(nameof(Dt_LocationInfo), "è´§ä½ä¿¡æ¯")] |
| | | public class Dt_LocationInfo : BaseEntity, BaseWarehouseEntity |
| | | { |
| | | /// <summary> |
| | | /// ä¸»é® |
| | | /// </summary> |
| | | [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "主é®")] |
| | | public int Id { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä»åºç¼å· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "ä»åºç¼å·")] |
| | | public int WarehouseId { get; set; } |
| | | |
| | | /// <summary> |
| | | /// è´§ä½ç¼å· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 20, ColumnDescription = "è´§ä½ç¼å·")] |
| | | public string LocationCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// è´§ä½åç§° |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "è´§ä½åç§°")] |
| | | public string LocationName { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å··éç¼å· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 20, ColumnDescription = "å··éç¼å·")] |
| | | public string RoadwayNo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// è´§ä½è¡ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, ColumnDescription = "è´§ä½è¡")] |
| | | public int Row { get; set; } |
| | | |
| | | /// <summary> |
| | | /// è´§ä½å |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, ColumnDescription = "è´§ä½å")] |
| | | public int Column { get; set; } |
| | | |
| | | /// <summary> |
| | | /// è´§ä½å± |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, ColumnDescription = "è´§ä½å±")] |
| | | public int Layer { get; set; } |
| | | |
| | | /// <summary> |
| | | /// è´§ä½æ·±åº¦ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, ColumnDescription = "è´§ä½æ·±åº¦")] |
| | | public int Depth { get; set; } |
| | | |
| | | //[SugarColumn(IsNullable = false, ColumnDescription = "左侧/å³ä¾§")] |
| | | //public int LocationSide { get; set; } |
| | | |
| | | /// <summary> |
| | | /// è´§ä½ç±»å |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, ColumnDescription = "è´§ä½ç±»å")] |
| | | public int LocationType { get; set; } |
| | | |
| | | /// <summary> |
| | | /// è´§ä½ç¶æ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, DefaultValue = "0", ColumnDescription = "è´§ä½ç¶æ")] |
| | | public int LocationStatus { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç¦ç¨ç¶æ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, DefaultValue = "0", ColumnDescription = "ç¦ç¨ç¶æ")] |
| | | public int EnableStatus { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 夿³¨ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 200, ColumnDescription = "夿³¨")] |
| | | public string Remark { get; set; } |
| | | |
| | | |
| | | public int WarehouseId { get ; set ; } |
| | | } |
| | | } |
| | |
| | | |
| | | namespace WIDESEA_Model.Models |
| | | { |
| | | /// <summary> |
| | | /// ç©æä¿¡æ¯ |
| | | /// </summary> |
| | | [SugarTable(nameof(Dt_MaterielInfo), "ç©æä¿¡æ¯")] |
| | | [SugarIndex("unique_materielinfo_materielcode", nameof(MaterielCode), OrderByType.Asc, true)] |
| | | public class Dt_MaterielInfo : BaseEntity//, BaseWarehouseEntity |
| | |
| | | /// </summary> |
| | | [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "主é®")] |
| | | public int Id { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä»åºç¼å· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "ä»åºç¼å·")] |
| | | public int WarehouseId { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç©æç¼å· |
| | |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 200, ColumnDescription = "夿³¨")] |
| | | public string Remark { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä»åºç¼å· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "ä»åºç¼å·")] |
| | | public int WarehouseId { get; set; } |
| | | } |
| | | } |
| | |
| | | |
| | | namespace WIDESEA_Model.Models |
| | | { |
| | | /// <summary> |
| | | /// ä¾åºåä¿¡æ¯ |
| | | /// </summary> |
| | | [SugarTable(nameof(Dt_SupplierInfo), "ä¾åºåä¿¡æ¯")] |
| | | public class Dt_SupplierInfo : BaseEntity |
| | | { |
| | | /// <summary> |
| | | /// ä¸»é® |
| | | /// </summary> |
| | | [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "主é®")] |
| | | public int Id { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä¾åºåç¼ç |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "ä¾åºåç¼ç ")] |
| | | public string SupplierCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä¾åºååç§° |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 200, ColumnDescription = "ä¾åºååç§°")] |
| | | public string SupplierName { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä¾åºåç®ç§° |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "ä¾åºåç®ç§°")] |
| | | public string SupplierShortName { get; set; } |
| | | |
| | | /// <summary> |
| | | /// è系人 |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "è系人")] |
| | | public string Contacts { get; set; } |
| | | |
| | | /// <summary> |
| | | /// èç³»çµè¯ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "èç³»çµè¯")] |
| | | public string ContactNumber { get; set; } |
| | | |
| | | /// <summary> |
| | | /// èç³»å°å |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 200, ColumnDescription = "èç³»å°å")] |
| | | public string ContactAddress { get; set; } |
| | | |
| | | /// <summary> |
| | | /// çµåé®ç®± |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "çµåé®ç®±")] |
| | | public string Email { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æè¿° |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 200, ColumnDescription = "æè¿°")] |
| | | public string Description { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åºåç»ç» |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "åºåç»ç»")] |
| | | public string InvOrgId { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç¶æ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "ç¶æ")] |
| | | public int Status { get; set; } |
| | | } |
| | |
| | | |
| | | namespace WIDESEA_Model.Models |
| | | { |
| | | /// <summary> |
| | | /// ä»åºä¿¡æ¯ |
| | | /// </summary> |
| | | [SugarTable(nameof(Dt_Warehouse), "ä»åºä¿¡æ¯")] |
| | | public class Dt_Warehouse : BaseEntity |
| | | { |
| | | /// <summary> |
| | | /// ä¸»é® |
| | | /// </summary> |
| | | [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "主é®")] |
| | | public int WarehouseId { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä»åºç¼å· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 20, ColumnDescription = "ä»åºç¼å·")] |
| | | public string WarehouseCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä»åºåç§° |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 20, ColumnDescription = "ä»åºåç§°")] |
| | | public string WarehouseName { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä»åºç±»å |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 20, ColumnDescription = "ä»åºç±»å")] |
| | | public string WarehouseType { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä»åºç¶æ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, DefaultValue = "0", ColumnDescription = "ä»åºç¶æ")] |
| | | public int WarehouseStatus { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä»åºæè¿° |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, ColumnDescription = "ä»åºæè¿°")] |
| | | public string WarehouseDes { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 夿³¨ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 200, ColumnDescription = "夿³¨")] |
| | | public string Remark { get; set; } |
| | | } |
| | |
| | | |
| | | namespace WIDESEA_Model.Models |
| | | { |
| | | [SugarTable] |
| | | /// <summary> |
| | | /// è´¨æ£å |
| | | /// </summary> |
| | | [SugarTable(nameof(Dt_CheckOrder), "è´¨æ£å")] |
| | | public class Dt_CheckOrder : BaseEntity |
| | | { |
| | | /// <summary> |
| | |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "æ¶è´§åå·")] |
| | | public string ReceiveOrderNo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// è´¨æ£åç¶æ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "è´¨æ£åç¶æ")] |
| | | public int CheckOrderStatus { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 审æ¹ç¶æ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "审æ¹ç¶æ")] |
| | | public int AuditStatus { get; set; } |
| | | |
| | |
| | | [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "ç¹é说æ")] |
| | | public string DefectedNote { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ£éªäºº |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "æ£éªäºº")] |
| | | public string CheckUserName { get; set; } |
| | | |
| | | /// <summary> |
| | | /// è´¨æ£ç»æ |
| | | /// </summary> |
| | | [Navigate(NavigateType.OneToMany, nameof(Dt_CheckOrderResult.CheckOrderId), nameof(CheckOrderId))] |
| | | public List<Dt_CheckOrderResult> Details { get; set; } |
| | | } |
| | |
| | | |
| | | namespace WIDESEA_Model.Models |
| | | { |
| | | /// <summary> |
| | | /// æ£éªç»æ |
| | | /// </summary> |
| | | [SugarTable(nameof(Dt_CheckOrderResult), "æ£éªç»æ")] |
| | | public class Dt_CheckOrderResult : BaseEntity |
| | | { |
| | |
| | | |
| | | namespace WIDESEA_Model.Models |
| | | { |
| | | [SugarTable(nameof(Dt_AnalysisRuleConfig))] |
| | | /// <summary> |
| | | /// ç¼ç è§£æè§åé
ç½® |
| | | /// </summary> |
| | | [SugarTable(nameof(Dt_AnalysisRuleConfig),"ç¼ç è§£æè§åé
ç½®")] |
| | | public class Dt_AnalysisRuleConfig : BaseEntity |
| | | { |
| | | /// <summary> |
| | | /// ä¸»é® |
| | | /// </summary> |
| | | [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "主é®")] |
| | | public int Id { get; set; } |
| | | |
| | | /// <summary> |
| | | /// è§åç¼å· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 20, ColumnDescription = "è§åç¼å·")] |
| | | public string AnalysisCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// è§ååç§° |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 20, ColumnDescription = "è§ååç§°")] |
| | | public string AnalysisName { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åç¼å符串 |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 20, ColumnDescription = "åç¼å符串")] |
| | | public string StartStr { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç»æå符串 |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 20, ColumnDescription = "ç»æå符串")] |
| | | public string EndStr { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åå²å符串 |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 20, ColumnDescription = "åå²å符串")] |
| | | public string SplitStr { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç¼ç è§å |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 100, ColumnDescription = "ç¼ç è§å")] |
| | | public string Format { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 夿³¨ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 200, ColumnDescription = "夿³¨")] |
| | | public string Remark { get; set; } |
| | | } |
| | |
| | | |
| | | namespace WIDESEA_Model.Models |
| | | { |
| | | [SugarTable(nameof(Dt_CodeRuleConfig))] |
| | | /// <summary> |
| | | /// ç¼ç çæè§åé
ç½® |
| | | /// </summary> |
| | | [SugarTable(nameof(Dt_CodeRuleConfig), "ç¼ç çæè§åé
ç½®")] |
| | | public class Dt_CodeRuleConfig : BaseEntity |
| | | { |
| | | /// <summary> |
| | | /// ä¸»é® |
| | | /// </summary> |
| | | [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "主é®")] |
| | | public int Id { get; set; } |
| | | |
| | | /// <summary> |
| | | /// è§åç¼å· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 20, ColumnDescription = "è§åç¼å·")] |
| | | public string RuleCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// è§ååç§° |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 20, ColumnDescription = "è§ååç§°")] |
| | | public string RuleName { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æµæ°´å·èµ·å§å¼ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false,ColumnDescription ="æµæ°´å·èµ·å§å¼")] |
| | | public int StartVal { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åç¼å符串 |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 2, ColumnDescription = "åç¼å符串")] |
| | | public string StartStr { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç¼ç è§å |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "ç¼ç è§å")] |
| | | public string Format { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æµæ°´å·é¿åº¦ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "æµæ°´å·é¿åº¦")] |
| | | public int Length { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æµæ°´å·å½åå¼ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "æµæ°´å·å½åå¼")] |
| | | public int CurrentVal { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 夿³¨ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 500, ColumnDescription = "夿³¨")] |
| | | public string Remark { get; set; } |
| | | } |
| | |
| | | |
| | | namespace WIDESEA_Model.Models |
| | | { |
| | | /// <summary> |
| | | /// å
¥åºå |
| | | /// </summary> |
| | | [SugarTable(nameof(Dt_InboundOrder), "å
¥åºå")] |
| | | public class Dt_InboundOrder : BaseEntity |
| | | { |
| | | /// <summary> |
| | | /// ä¸»é® |
| | | /// </summary> |
| | | [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "主é®")] |
| | | public int Id { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä»åºä¸»é® |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "ä»åºä¸»é®")] |
| | | public int WarehouseId { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åæ®ç¼å· |
| | | /// </summary> |
| | | [CodeRule(RuleCodeEnum.InboundOrderRule)] |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "åæ®ç¼å·")] |
| | | public string InboundOrderNo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 䏿¸¸åæ®ç¼å· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "䏿¸¸åæ®ç¼å·")] |
| | | public string UpperOrderNo { get; set; } |
| | | |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "")] |
| | | public int WarehouseId { get; set; } |
| | | |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "")] |
| | | /// <summary> |
| | | /// ä¾åºåç¼å· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "ä¾åºåç¼å·")] |
| | | public string SupplierId { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åæ®ç±»å |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "åæ®ç±»å")] |
| | | public int OrderType { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åæ®ç¶æ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "åæ®ç¶æ")] |
| | | public int OrderStatus { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å建æ¹å¼ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "å建æ¹å¼")] |
| | | public int CreateType { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 夿³¨ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 200, ColumnDescription = "夿³¨")] |
| | | public string Remark { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å
¥åºåæç» |
| | | /// </summary> |
| | | [Navigate(NavigateType.OneToMany, nameof(Dt_InboundOrderDetail.OrderId), nameof(Id))] |
| | | public List<Dt_InboundOrderDetail> Details { get; set; } |
| | | } |
| | |
| | | |
| | | namespace WIDESEA_Model.Models |
| | | { |
| | | /// <summary> |
| | | /// å
¥åºåæç» |
| | | /// </summary> |
| | | [SugarTable(nameof(Dt_InboundOrderDetail), "å
¥åºåæç»")] |
| | | public class Dt_InboundOrderDetail : BaseEntity |
| | | { |
| | | /// <summary> |
| | | /// ä¸»é® |
| | | /// </summary> |
| | | [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "主é®")] |
| | | public int Id { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å
¥åºåä¸»é® |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "å
¥åºå主é®")] |
| | | public int OrderId { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç©æç¼å· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "ç©æç¼å·")] |
| | | public string MaterielCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ¹æ¬¡å· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "æ¹æ¬¡å·")] |
| | | public string BatchNo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åæ®æ°é |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "åæ®æ°é")] |
| | | public float OrderQuantity { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç»çæ°é |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "ç»çæ°é", DefaultValue = "0")] |
| | | public float ReceiptQuantity { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 䏿¶æ°é |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "䏿¶æ°é", DefaultValue = "0")] |
| | | public float OverInQuantity { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 订åæç»ç¶æ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "订åæç»ç¶æ")] |
| | | public int OrderDetailStatus { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åä½ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 20, ColumnDescription = "åä½")] |
| | | public string Unit { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ¶è´§åæç»è¡å· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "è¡å·")] |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "æ¶è´§åæç»è¡å·")] |
| | | public int RowNo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 夿³¨ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, ColumnDescription = "夿³¨")] |
| | | public string Remark { get; set; } |
| | | } |
| | |
| | | |
| | | namespace WIDESEA_Model.Models |
| | | { |
| | | [SugarTable(nameof(Dt_InboundOrder_Hty), "å
¥åºå")] |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | [SugarTable(nameof(Dt_InboundOrder_Hty), "å
¥åºååå²")] |
| | | public class Dt_InboundOrder_Hty |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "主é®")] |
| | | public int Id { get; set; } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "åæ®ç¼å·")] |
| | | public string OrderNo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "䏿¸¸åæ®ç¼å·")] |
| | | public string UpperOrderNo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "åæ®ç±»å")] |
| | | public int OrderType { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åæ®ç¶æ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "åæ®ç¶æ")] |
| | | public int OrderStatus { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å建æ¹å¼ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "å建æ¹å¼")] |
| | | public int CreateType { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 夿³¨ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 200, ColumnDescription = "夿³¨")] |
| | | public string Remark { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æºä¸»é® |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, DefaultValue = "0", ColumnDescription = "æºä¸»é®")] |
| | | public int SourceId { get; set; } |
| | | |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "夿³¨")] |
| | | /// <summary> |
| | | /// æä½ç±»å |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "æä½ç±»å")] |
| | | public string OperateType { get; set; } |
| | | |
| | | /// <summary> |
| | |
| | | |
| | | namespace WIDESEA_Model.Models |
| | | { |
| | | [SugarTable(nameof(Dt_PurchaseOrder), "éè´è®¢å"), ModelValidate] |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | [SugarTable(nameof(Dt_PurchaseOrder), "éè´å"), ModelValidate] |
| | | public class Dt_PurchaseOrder : BaseEntity |
| | | { |
| | | /// <summary> |
| | | /// ä¸»é® |
| | | /// </summary> |
| | | [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "")] |
| | | [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "主é®")] |
| | | public int Id { get; set; } |
| | | |
| | | /// <summary> |
| | | /// éè´åå· |
| | | /// </summary> |
| | | [PropertyValidate("éè´åå·", NotNullAndEmpty = true)] |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "")] |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "éè´åå·")] |
| | | public string PurchaseOrderNo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åæ®ç±»å(S:æ åå
¥åºãV:å¯å®è¡¥ç»å
¥åº) |
| | | /// </summary> |
| | | [PropertyValidate("åæ®ç±»å", NotNullAndEmpty = true, Check = new[] { "S", "V" })] |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "")] |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "åæ®ç±»å")] |
| | | public string PurchaseOrderType { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä¾åºåç¼å· |
| | | /// </summary> |
| | | [PropertyValidate("ä¾åºåç¼å·", NotNullAndEmpty = true)] |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "")] |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "ä¾åºåç¼å·")] |
| | | public string SupplierCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// éè´æ°é |
| | | /// </summary> |
| | | [PropertyValidate("éè´æ°é", MinValue = 0, IsContainMinValue = false)] |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "")] |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "éè´æ°é")] |
| | | public float OrderQuantity { get; set; } |
| | | |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "")] |
| | | /// <summary> |
| | | /// éè´åç¶æ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "éè´åç¶æ")] |
| | | public int PurchaseOrderStatus { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä¸åæ¥æ |
| | | /// </summary> |
| | | [PropertyValidate("ä¸åæ¥æ", NotNullAndEmpty = true)] |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "")] |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "ä¸åæ¥æ")] |
| | | public string OrderDate { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 夿³¨ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 200, ColumnDescription = "")] |
| | | [SugarColumn(IsNullable = true, Length = 200, ColumnDescription = "夿³¨")] |
| | | public string Remark { get; set; } |
| | | |
| | | /// <summary> |
| | |
| | | |
| | | namespace WIDESEA_Model.Models |
| | | { |
| | | /// <summary> |
| | | /// éè´åæç» |
| | | /// </summary> |
| | | [SugarTable(nameof(Dt_PurchaseOrderDetail), "éè´åæç»"), ModelValidate] |
| | | public class Dt_PurchaseOrderDetail : BaseEntity |
| | | { |
| | |
| | | /// <summary> |
| | | /// ä»åºç¼å· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnName = "WarehouseId", ColumnDescription = "")] |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnName = "WarehouseId", ColumnDescription = "ä»åºç¼å·")] |
| | | public int WarehouseId { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ°é |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "")] |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "æ°é")] |
| | | public float PurchaseDetailQuantity { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åä½ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 20, ColumnDescription = "")] |
| | | [SugarColumn(IsNullable = false, Length = 20, ColumnDescription = "åä½")] |
| | | public string Unit { get; set; } |
| | | } |
| | | } |
| | |
| | | |
| | | namespace WIDESEA_Model.Models |
| | | { |
| | | /// <summary> |
| | | /// æ¶è´§å |
| | | /// </summary> |
| | | [SugarTable(nameof(Dt_ReceiveOrder), "æ¶è´§å")] |
| | | public class Dt_ReceiveOrder : BaseEntity |
| | | { |
| | |
| | | [SugarColumn(IsNullable = true, Length = 500, ColumnDescription = "夿³¨")] |
| | | public string Remark { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ¶è´§åæç» |
| | | /// </summary> |
| | | [Navigate(NavigateType.OneToMany, nameof(Dt_ReceiveOrderDetail.ReceiveOrderId), nameof(ReceiveOrderId))] |
| | | public List<Dt_ReceiveOrderDetail> Details { get; set; } |
| | | } |
| | |
| | | |
| | | namespace WIDESEA_Model.Models |
| | | { |
| | | /// <summary> |
| | | /// æ¶è´§åæç» |
| | | /// </summary> |
| | | [SugarTable(nameof(Dt_ReceiveOrderDetail), "æ¶è´§åæç»")] |
| | | public class Dt_ReceiveOrderDetail : BaseEntity |
| | | { |
| | |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "éè´åå·")] |
| | | public string PurchaseOrderNo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// éè´åæç»è¡å· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "éè´åæç»è¡å·")] |
| | | public int PurchaseOrderDetailRowNo { get; set; } |
| | | |
| | |
| | | |
| | | namespace WIDESEA_Model.Models |
| | | { |
| | | /// <summary> |
| | | /// åºåºè¯¦æ
|
| | | /// </summary> |
| | | [SugarTable(nameof(Dt_OutStockLockInfo), "åºåºè¯¦æ
")] |
| | | public class Dt_OutStockLockInfo : BaseEntity |
| | | { |
| | | /// <summary> |
| | | /// ä¸»é® |
| | | /// </summary> |
| | | [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "主é®")] |
| | | public int Id { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åæ®ç¼å· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "åæ®ç¼å·")] |
| | | public string OrderNo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åæ®æç»ä¸»é® |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "åæ®æç»ä¸»é®")] |
| | | public int OrderDetailId { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åæ®ç±»å |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "åæ®ç±»å")] |
| | | public int OrderType { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ¹æ¬¡å· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 20, ColumnDescription = "æ¹æ¬¡å·")] |
| | | public string BatchNo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç©æç¼å· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "ç©æç¼å·")] |
| | | public string MaterielCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç©æåç§° |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 200, ColumnDescription = "ç©æåç§°")] |
| | | public string MaterielName { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åºåä¸»é® |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "åºå主é®")] |
| | | public int StockId { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åæ®æ°é |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "åæ®æ°é")] |
| | | public float OrderQuantity { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åå§åºåé |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "åå§åºåé")] |
| | | public float OriginalQuantity { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åé
åºåºé |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "åé
åºåºé")] |
| | | public float AssignQuantity { get; set; } |
| | | |
| | | /// <summary> |
| | | /// è´§ä½ç¼å· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 20, ColumnDescription = "è´§ä½ç¼å·")] |
| | | public string LocationCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æçç¼å· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "æçç¼å·")] |
| | | public string PalletCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä»»å¡å· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, ColumnDescription = "ä»»å¡å·")] |
| | | public int? TaskNum { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç¶æ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "ç¶æ")] |
| | | public int Status { get; set; } |
| | | } |
| | |
| | | |
| | | namespace WIDESEA_Model.Models |
| | | { |
| | | /// <summary> |
| | | /// åºåºå |
| | | /// </summary> |
| | | [SugarTable(nameof(Dt_OutboundOrder), "åºåºå")] |
| | | public class Dt_OutboundOrder : BaseEntity |
| | | { |
| | | /// <summary> |
| | | /// ä¸»é® |
| | | /// </summary> |
| | | [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "主é®")] |
| | | public int Id { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä»åºä¸»é® |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "ä»åºä¸»é®")] |
| | | public int WarehouseId { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åæ®ç¼å· |
| | | /// </summary> |
| | | [CodeRule(RuleCodeEnum.OutboundOrderRule)] |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "åæ®ç¼å·", IsOnlyIgnoreUpdate = true)] |
| | | public string OrderNo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 䏿¸¸åæ®ç¼å· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "䏿¸¸åæ®ç¼å·", IsOnlyIgnoreUpdate = true)] |
| | | public string UpperOrderNo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åæ®ç±»å |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "åæ®ç±»å", IsOnlyIgnoreUpdate = true)] |
| | | public int OrderType { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åæ®ç¶æ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "åæ®ç¶æ")] |
| | | public int OrderStatus { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å建æ¹å¼ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "å建æ¹å¼", IsOnlyIgnoreUpdate = true)] |
| | | public int CreateType { get; set; } |
| | | |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "ä»åºä¸»é®")] |
| | | public int WarehouseId { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 夿³¨ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 200, ColumnDescription = "夿³¨")] |
| | | public string Remark { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åºåºåæç» |
| | | /// </summary> |
| | | [Navigate(NavigateType.OneToMany, nameof(Dt_OutboundOrderDetail.OrderId), nameof(Id))] |
| | | public List<Dt_OutboundOrderDetail> Details { get; set; } |
| | | } |
| | |
| | | |
| | | namespace WIDESEA_Model.Models |
| | | { |
| | | /// <summary> |
| | | /// åºåºåæç» |
| | | /// </summary> |
| | | [SugarTable(nameof(Dt_OutboundOrderDetail), "åºåºåæç»")] |
| | | public class Dt_OutboundOrderDetail : BaseEntity |
| | | { |
| | | /// <summary> |
| | | /// ä¸»é® |
| | | /// </summary> |
| | | [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "主é®")] |
| | | public int Id { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åºåºåä¸»é® |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "åºåºå主é®")] |
| | | public int OrderId { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç©æç¼å· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "ç©æç¼å·")] |
| | | public string MaterielCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç©æåç§° |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 200, ColumnDescription = "ç©æåç§°")] |
| | | public string MaterielName { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ¹æ¬¡å· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 20, ColumnDescription = "æ¹æ¬¡å·")] |
| | | public string BatchNo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// è¡å· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "è¡å·")] |
| | | public int RowNo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åæ®æ°é |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "åæ®æ°é")] |
| | | public float OrderQuantity { get; set; } |
| | | |
| | | /// <summary> |
| | | /// é宿°é |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "é宿°é", DefaultValue = "0")] |
| | | public float LockQuantity { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å·²åºæ°é |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "å·²åºæ°é", DefaultValue = "0")] |
| | | public float OverOutQuantity { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 订åæç»ç¶æ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "订åæç»ç¶æ")] |
| | | public int OrderDetailStatus { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 夿³¨ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, ColumnDescription = "夿³¨")] |
| | | public string Remark { get; set; } |
| | | } |
| | |
| | | |
| | | namespace WIDESEA_Model.Models |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | [SugarTable(nameof(Dt_OutboundOrderDetail_Hty), "åºåºåæç»")] |
| | | public class Dt_OutboundOrderDetail_Hty |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "主é®")] |
| | | public int Id { get; set; } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "åºåºå主é®")] |
| | | public int OrderId { get; set; } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "ç©æç¼å·")] |
| | | public string MaterielCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 200, ColumnDescription = "ç©æåç§°")] |
| | | public string MaterielName { get; set; } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 20, ColumnDescription = "æ¹æ¬¡å·")] |
| | | public string BatchNo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, DecimalDigits = 2, ColumnDescription = "åæ®æ°é")] |
| | | public decimal OrderQuantity { get; set; } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, DecimalDigits = 2, ColumnDescription = "é宿°é", DefaultValue = "0")] |
| | | public decimal LockQuantity { get; set; } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, DecimalDigits = 2, ColumnDescription = "å·²åºæ°é", DefaultValue = "0")] |
| | | public decimal OverOutQuantity { get; set; } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "订åæç»ç¶æ")] |
| | | public int OrderDetailStatus { get; set; } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, ColumnDescription = "夿³¨")] |
| | | public string Remark { get; set; } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, DefaultValue = "0", ColumnDescription = "æºä¸»é®")] |
| | | public int SourceId { get; set; } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "夿³¨")] |
| | | public string OperateType { get; set; } |
| | | /// <summary> |
| | |
| | | |
| | | namespace WIDESEA_Model.Models |
| | | { |
| | | /// <summary> |
| | | /// è´§ä½ç¶æåå¨è®°å½ |
| | | /// </summary> |
| | | [SugarTable(nameof(Dt_LocationStatusChangeRecord),"è´§ä½ç¶æåå¨è®°å½")] |
| | | public class Dt_LocationStatusChangeRecord : BaseEntity |
| | | { |
| | | /// <summary> |
| | | /// ä¸»é® |
| | | /// </summary> |
| | | [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "主é®")] |
| | | public int Id { get; set; } |
| | | |
| | | /// <summary> |
| | | /// è´§ä½ä¸»é® |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "è´§ä½ä¸»é®")] |
| | | public int LocationId { get; set; } |
| | | |
| | | /// <summary> |
| | | /// è´§ä½ç¼å· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 20, ColumnDescription = "è´§ä½ç¼å·")] |
| | | public string LocationCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åå¨åè´§ä½ç¶æ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "åå¨åè´§ä½ç¶æ")] |
| | | public int BeforeStatus { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åå¨åè´§ä½ç¶æ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "åå¨åè´§ä½ç¶æ")] |
| | | public int AfterStatus { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åå¨ç±»åï¼åºåºãå
¥åºãæå¨è°æ´...ï¼ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "åå¨ç±»åï¼åºåºãå
¥åºãæå¨è°æ´...ï¼")] |
| | | public int ChangeType { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åæ®ä¸»é® |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, ColumnDescription = "忮䏻é®")] |
| | | public int? OrderId { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åæ®ç¼å· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "åæ®ç¼å·")] |
| | | public string OrderNo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä»»å¡å· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, ColumnDescription = "ä»»å¡å·")] |
| | | public int? TaskNum { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 夿³¨ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, ColumnDescription = "夿³¨")] |
| | | public string Remark { get; set; } |
| | | } |
| | |
| | | |
| | | namespace WIDESEA_Model.Models |
| | | { |
| | | /// <summary> |
| | | /// åºååå¨ä¿¡æ¯è®°å½ |
| | | /// </summary> |
| | | [SugarTable(nameof(Dt_StockQuantityChangeRecord), "åºååå¨ä¿¡æ¯è®°å½")] |
| | | public class Dt_StockQuantityChangeRecord : BaseEntity |
| | | { |
| | | /// <summary> |
| | | /// ä¸»é® |
| | | /// </summary> |
| | | [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "主é®")] |
| | | public int Id { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åºåæç»ä¸»é® |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "åºåæç»ä¸»é®")] |
| | | public int StockDetailId { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æçç¼å· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "æçç¼å·")] |
| | | public string PalleCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç©æç¼å· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "ç©æç¼å·")] |
| | | public string MaterielCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç©æåç§° |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 200, ColumnDescription = "ç©æåç§°")] |
| | | public string MaterielName { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ¹æ¬¡å· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 20, ColumnDescription = "æ¹æ¬¡å·")] |
| | | public string BatchNo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åºåå· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 100, ColumnDescription = "åºåå·")] |
| | | public string SerilNumber { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åæ®ç¼å· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "åæ®ç¼å·")] |
| | | public string OrderNo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä»»å¡å· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, ColumnDescription = "ä»»å¡å·")] |
| | | public int? TaskNum { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åå¨ç±»åï¼åºåºãå
¥åºãæå¨è°æ´...ï¼ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "åå¨ç±»åï¼åºåºãå
¥åºãæå¨è°æ´...ï¼")] |
| | | public int ChangeType { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å卿°éï¼æ£æ°è¡¨ç¤ºå¢å ï¼è´æ°è¡¨ç¤ºåå°ï¼ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "å卿°éï¼æ£æ°è¡¨ç¤ºå¢å ï¼è´æ°è¡¨ç¤ºåå°ï¼")] |
| | | public float ChangeQuantity { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åå¨ååºåé |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "åå¨ååºåé", DefaultValue = "0")] |
| | | public float BeforeQuantity { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åå¨ååºåé |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "åå¨ååºåé", DefaultValue = "0")] |
| | | public float AfterQuantity { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 夿³¨ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, ColumnDescription = "夿³¨")] |
| | | public string Remark { get; set; } |
| | | } |
| | |
| | | |
| | | namespace WIDESEA_Model.Models |
| | | { |
| | | /// <summary> |
| | | /// åºåä¿¡æ¯ |
| | | /// </summary> |
| | | [SugarTable(nameof(Dt_StockInfo), "åºåä¿¡æ¯")] |
| | | public class Dt_StockInfo : BaseEntity |
| | | { |
| | | /// <summary> |
| | | /// ä¸»é® |
| | | /// </summary> |
| | | [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "主é®")] |
| | | public int Id { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æçç¼å· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "æçç¼å·")] |
| | | public string PalletCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æçç±»å |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "æçç±»å")] |
| | | public int PalletType { get; set; } |
| | | |
| | | /// <summary> |
| | | /// è´§ä½ç¼å· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 20, ColumnDescription = "è´§ä½ç¼å·")] |
| | | public string LocationCode { get; set; } |
| | | |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "")] |
| | | /// <summary> |
| | | /// ä»åºä¸»é® |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "ä»åºä¸»é®")] |
| | | public int WarehouseId { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åºåç¶æ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "åºåç¶æ")] |
| | | public int StockStatus { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 夿³¨ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, ColumnDescription = "夿³¨")] |
| | | public string Remark { get; set; } |
| | | |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "")] |
| | | public int PalletType { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åºåæç» |
| | | /// </summary> |
| | | [Navigate(NavigateType.OneToMany, nameof(Dt_StockInfoDetail.StockId), nameof(Id))] |
| | | public List<Dt_StockInfoDetail> Details { get; set; } |
| | | } |
| | |
| | | |
| | | namespace WIDESEA_Model.Models |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | [SugarTable(nameof(Dt_StockInfoDetail), "åºåä¿¡æ¯æç»")] |
| | | public class Dt_StockInfoDetail : BaseEntity |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "主é®")] |
| | | public int Id { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åºåä¿¡æ¯ä¸»é® |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "åºåä¿¡æ¯ä¸»é®")] |
| | | public int StockId { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç©æç¼å· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "ç©æç¼å·")] |
| | | public string MaterielCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç©æåç§° |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 200, ColumnDescription = "ç©æåç§°")] |
| | | public string MaterielName { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åæ®ç¼å· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "åæ®ç¼å·")] |
| | | public string OrderNo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ¹æ¬¡å· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 20, ColumnDescription = "æ¹æ¬¡å·")] |
| | | public string BatchNo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// çäº§æ¥æ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 20, ColumnDescription = "çäº§æ¥æ")] |
| | | public string ProductionDate { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æææ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 20, ColumnDescription = "æææ")] |
| | | public string EffectiveDate { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åºåå· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 100, ColumnDescription = "åºåå·")] |
| | | public string SerialNumber { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åºåæ°é |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "åºåæ°é")] |
| | | public float StockQuantity { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åºåºæ°é |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "åºåºæ°é", DefaultValue = "0")] |
| | | public float OutboundQuantity { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åºåæç»ç¶æ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "åºåæç»ç¶æ")] |
| | | public int Status { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å
¥åºåæç»è¡å· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "å
¥åºåæç»è¡å·")] |
| | | public int InboundOrderRowNo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 夿³¨ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, ColumnDescription = "夿³¨")] |
| | | public string Remark { get; set; } |
| | | } |
| | |
| | | |
| | | namespace WIDESEA_Model.Models |
| | | { |
| | | /// <summary> |
| | | /// ä»»å¡ä¿¡æ¯ |
| | | /// </summary> |
| | | [SugarTable(nameof(Dt_Task), "ä»»å¡ä¿¡æ¯"), SugarIndex("unique_task_taskNum", nameof(TaskNum), OrderByType.Asc, true)] |
| | | public class Dt_Task : BaseEntity |
| | | { |
| | |
| | | public string PalletCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æçç±»å |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "æçç±»å")] |
| | | public int PalletType { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å··éå· |
| | | /// </summary> |
| | | [ImporterHeader(Name = "å··éå·")] |
| | |
| | | _recordService = recordService; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éå®åºåï¼ç±ç³»ç»åé
(ä»
é»è¾è¿ç®ï¼ä¸çæä»»å¡ï¼ä¸ä¿®æ¹æ°æ®åºæ°æ®) |
| | | /// </summary> |
| | | /// <param name="orderDetailId"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent LockOutboundStock(int orderDetailId) |
| | | { |
| | | Dt_OutboundOrderDetail outboundOrderDetail = BaseDal.QueryFirst(x => x.Id == orderDetailId); |
| | | (bool, string) result = CheckDeital(outboundOrderDetail); |
| | | if (!result.Item1) return WebResponseContent.Instance.Error(result.Item2); |
| | | if (outboundOrderDetail == null) |
| | | { |
| | | return WebResponseContent.Instance.Error("æªæ¾å°åºåºåæç»ä¿¡æ¯"); |
| | | } |
| | | if (outboundOrderDetail.OrderDetailStatus != OrderDetailStatusEnum.New.ObjToInt()) |
| | | { |
| | | return WebResponseContent.Instance.Error("该æç»ä¸å¯æä½"); |
| | | } |
| | | Dt_OutboundOrder outboundOrder = _outboundRepository.OutboundOrderRepository.QueryFirst(x => x.Id == outboundOrderDetail.OrderId); |
| | | |
| | | float needQuantity = outboundOrderDetail.OrderQuantity - outboundOrderDetail.LockQuantity; |
| | |
| | | } |
| | | } |
| | | |
| | | private (bool, string) CheckDeital(Dt_OutboundOrderDetail outboundOrderDetail) |
| | | { |
| | | if (outboundOrderDetail == null) |
| | | { |
| | | return (false, "æªæ¾å°åºåºåæç»ä¿¡æ¯"); |
| | | } |
| | | if (outboundOrderDetail.OrderDetailStatus != OrderDetailStatusEnum.New.ObjToInt()) |
| | | { |
| | | return (false, "该æç»ä¸å¯æä½"); |
| | | } |
| | | return (true, "æå"); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="outboundOrderDetail"></param> |
| | | /// <param name="stockSelectViews"></param> |
| | | /// <returns></returns> |
| | | /// <exception cref="Exception"></exception> |
| | | public (List<Dt_StockInfo>, Dt_OutboundOrderDetail, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) AssignStockOutbound(Dt_OutboundOrderDetail outboundOrderDetail, List<StockSelectViewDTO> stockSelectViews) |
| | | { |
| | | (bool, string) checkResult = CheckSelectStockDeital(outboundOrderDetail, stockSelectViews); |
| | |
| | | return (outStocks, outboundOrderDetail, outStockLockInfos, locationInfos); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éå®åºåï¼ç±äººå·¥æå®ï¼æå ä¸ç³»ç»åé
(å
å«é»è¾è¿ç®ï¼ä¸ä¿®æ¹æ°æ®åºæ°æ®) |
| | | /// </summary> |
| | | /// <param name="orderDetailId"></param> |
| | | /// <param name="stockSelectViews"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent LockOutboundStock(int orderDetailId, List<StockSelectViewDTO> stockSelectViews) |
| | | { |
| | | try |
| | |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éå®åºåï¼ç±ç³»ç»åé
(å
å«é»è¾è¿ç®ï¼ä¸ä¿®æ¹æ°æ®åºæ°æ®) |
| | | /// </summary> |
| | | /// <param name="orderDetailId"></param> |
| | | /// <param name="stockSelectViews"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent LockOutboundStock(int[] keys) |
| | | { |
| | | try |
| | |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// åºåºåºååé
åï¼æ´æ°æ°æ®åºæ°æ® |
| | | /// </summary> |
| | | /// <param name="stockInfos"></param> |
| | | /// <param name="outboundOrderDetails"></param> |
| | | /// <param name="outStockLockInfos"></param> |
| | | /// <param name="locationInfos"></param> |
| | | /// <param name="locationStatus"></param> |
| | | /// <param name="tasks"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent LockOutboundStockDataUpdate(List<Dt_StockInfo> stockInfos, List<Dt_OutboundOrderDetail> outboundOrderDetails, List<Dt_OutStockLockInfo> outStockLockInfos, List<Dt_LocationInfo> locationInfos, LocationStatusEnum locationStatus = LocationStatusEnum.Lock, List<Dt_Task>? tasks = null) |
| | | { |
| | | try |
| | |
| | | return (true, "æå"); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ¤ééå®åºå |
| | | /// </summary> |
| | | /// <param name="orderDetailId"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent RevokeLockOutboundStock(int orderDetailId) |
| | | { |
| | | Dt_OutboundOrderDetail outboundOrderDetail = BaseDal.QueryFirst(x => x.Id == orderDetailId); |
| | |
| | | { |
| | | return Db.UpdateNav(stockInfo).Include(x => x.Details).ExecuteCommand(); |
| | | } |
| | | |
| | | public Dt_StockInfo GetPalletStockInfo(string roadwayNo) |
| | | { |
| | | //ISugarQueryable<string> locationCodes = Db.Queryable<Dt_LocationInfo>().Where(x => x.RoadwayNo == roadwayNo && x.LocationStatus == LocationStatusEnum.Pallet.ObjToInt() && (x.EnalbeStatus == LocationEnalbeStatusEnum.OnlyOut.ObjToInt() || LocationEnalbeStatusEnum.Normal.ObjToInt() == x.EnalbeStatus)).Select(x => x.LocationCode); |
| | | |
| | | return Db.Queryable<Dt_StockInfo>().Where(x => x.StockStatus == StockStatusEmun.å·²å
¥åº.ObjToInt() && SqlFunc.Subqueryable<Dt_LocationInfo>().Where(v => v.LocationCode == x.LocationCode && v.RoadwayNo == roadwayNo && v.LocationStatus == LocationStatusEnum.Pallet.ObjToInt() && (v.EnableStatus == EnableStatusEnum.OnlyOut.ObjToInt() || EnableStatusEnum.Normal.ObjToInt() == v.EnableStatus)).Any()).OrderBy(x => x.ModifyDate).First(); |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | List<object> data = new List<object>(); |
| | | |
| | | { |
| | | Type type = typeof(TaskTypeEnum); |
| | | List<int> enums = Enum.GetValues(typeof(TaskTypeEnum)).Cast<int>().ToList(); |
| | | int index = 0; |
| | | foreach (var item in enums) |
| | | { |
| | | FieldInfo? fieldInfo = typeof(TaskTypeEnum).GetField(((TaskTypeEnum)item).ToString()); |
| | | DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>(); |
| | | if (description != null) |
| | | { |
| | | data.Add(new { key = item.ToString(), value = description.Description }); |
| | | } |
| | | else |
| | | { |
| | | data.Add(new { key = item.ToString(), value = item.ToString() }); |
| | | } |
| | | index++; |
| | | } |
| | | } |
| | | //{ |
| | | // Type type = typeof(TaskTypeEnum); |
| | | // List<int> enums = Enum.GetValues(typeof(TaskTypeEnum)).Cast<int>().ToList(); |
| | | // int index = 0; |
| | | // foreach (var item in enums) |
| | | // { |
| | | // FieldInfo? fieldInfo = typeof(TaskTypeEnum).GetField(((TaskTypeEnum)item).ToString()); |
| | | // DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>(); |
| | | // if (description != null) |
| | | // { |
| | | // data.Add(new { key = item.ToString(), value = description.Description }); |
| | | // } |
| | | // else |
| | | // { |
| | | // data.Add(new { key = item.ToString(), value = item.ToString() }); |
| | | // } |
| | | // index++; |
| | | // } |
| | | //} |
| | | |
| | | result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data }; |
| | | } |
| | |
| | | List<object> data = new List<object>(); |
| | | |
| | | { |
| | | Type type = typeof(InTaskStatusEnum); |
| | | List<int> enums = Enum.GetValues(typeof(InTaskStatusEnum)).Cast<int>().ToList(); |
| | | Type type = typeof(TaskInStatusEnum); |
| | | List<int> enums = Enum.GetValues(typeof(TaskInStatusEnum)).Cast<int>().ToList(); |
| | | int index = 0; |
| | | foreach (var item in enums) |
| | | { |
| | | FieldInfo? fieldInfo = typeof(InTaskStatusEnum).GetField(((InTaskStatusEnum)item).ToString()); |
| | | FieldInfo? fieldInfo = typeof(TaskInStatusEnum).GetField(((TaskInStatusEnum)item).ToString()); |
| | | DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>(); |
| | | if (description != null) |
| | | { |
| | |
| | | } |
| | | |
| | | { |
| | | Type type = typeof(OutTaskStatusEnum); |
| | | List<int> enums = Enum.GetValues(typeof(OutTaskStatusEnum)).Cast<int>().ToList(); |
| | | Type type = typeof(TaskOutStatusEnum); |
| | | List<int> enums = Enum.GetValues(typeof(TaskOutStatusEnum)).Cast<int>().ToList(); |
| | | int index = 0; |
| | | foreach (var item in enums) |
| | | { |
| | | FieldInfo? fieldInfo = typeof(OutTaskStatusEnum).GetField(((OutTaskStatusEnum)item).ToString()); |
| | | FieldInfo? fieldInfo = typeof(TaskOutStatusEnum).GetField(((TaskOutStatusEnum)item).ToString()); |
| | | DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>(); |
| | | if (description != null) |
| | | { |
| | |
| | | #endregion << ç æ¬ 注 é >> |
| | | |
| | | using AutoMapper; |
| | | using HslCommunication.WebSocket; |
| | | using MailKit.Search; |
| | | using Newtonsoft.Json; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.Text; |
| | | using SqlSugar; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.ComponentModel; |
| | | using System.Diagnostics.CodeAnalysis; |
| | | using System.Linq; |
| | | using System.Linq.Expressions; |
| | | using System.Net.Http.Headers; |
| | | using System.Reflection; |
| | | using System.Reflection.Metadata; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Common.CommonEnum; |
| | | using WIDESEA_Common.LocationEnum; |
| | |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_DTO.Inbound; |
| | | using WIDESEA_DTO.Stock; |
| | | using WIDESEA_DTO.Task; |
| | | using WIDESEA_IBasicRepository; |
| | | using WIDESEA_IBasicService; |
| | | using WIDESEA_IInboundService; |
| | |
| | | private readonly IStockRepository _stockRepository; |
| | | private readonly IBasicService _basicService; |
| | | private readonly IRecordService _recordService; |
| | | private readonly IOutboundService _outboundService; |
| | | private readonly IStockService _stockService; |
| | | |
| | | public ITaskRepository Repository => BaseDal; |
| | | |
| | | public TaskService(ITaskRepository BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IStockRepository stockRepository, IBasicService basicService, IRecordService recordService) : base(BaseDal) |
| | | private Dictionary<string, OrderByType> _taskOrderBy = new() |
| | | { |
| | | {nameof(Dt_Task.Grade),OrderByType.Desc }, |
| | | {nameof(Dt_Task.CreateDate),OrderByType.Asc}, |
| | | }; |
| | | |
| | | public List<int> TaskInboundTypes => typeof(TaskInboundTypeEnum).GetEnumIndexList(); |
| | | |
| | | public List<int> TaskOutboundTypes => typeof(TaskOutboundTypeEnum).GetEnumIndexList(); |
| | | |
| | | public TaskService(ITaskRepository BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IStockRepository stockRepository, IBasicService basicService, IRecordService recordService, IOutboundService outboundService, IStockService stockService) : base(BaseDal) |
| | | { |
| | | _mapper = mapper; |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | | _stockRepository = stockRepository; |
| | | _basicService = basicService; |
| | | _recordService = recordService; |
| | | _outboundService = outboundService; |
| | | _stockService = stockService; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ä»»å¡ä¿¡æ¯æ¨éè³WCS |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public WebResponseContent PushTasksToWCS() |
| | | { |
| | | try |
| | | { |
| | | List<Dt_Task> tasks = BaseDal.QueryData(x => (TaskInboundTypes.Contains(x.TaskType) && x.TaskStatus == (int)TaskInStatusEnum.InNew || TaskOutboundTypes.Contains(x.TaskType) && x.TaskStatus == (int)TaskOutStatusEnum.OutNew)); |
| | | |
| | | List<WMSTaskDTO> taskDTOs = _mapper.Map<List<WMSTaskDTO>>(tasks); |
| | | |
| | | string response = HttpHelper.Post("http://127.0.0.1:9291/api/Task/ReceiveTask", taskDTOs.Serialize()); |
| | | |
| | | return JsonConvert.DeserializeObject<WebResponseContent>(response) ?? WebResponseContent.Instance.Error("è¿åé误"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ç³è¯·å
¥åºä»»å¡(PDA使ç¨ï¼ä»
æçç»å®å
¥åºç«å°ï¼ä¸åé
è´§ä½) |
| | | /// </summary> |
| | | /// <param name="palletCode">æçå·</param> |
| | | /// <param name="stationCode">ç«å°å·</param> |
| | | /// <returns></returns> |
| | | public WebResponseContent RequestInboundTask(string palletCode, string stationCode) |
| | | { |
| | | try |
| | |
| | | if (task != null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"该æçå·²çæä»»å¡"); |
| | | } |
| | | |
| | | if (Repository.QueryFirst(x => x.SourceAddress == stationCode && x.TaskStatus == TaskInStatusEnum.InNew.ObjToInt()) != null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"该ç«ç¹å·²ææªæ§è¡çä»»å¡"); |
| | | } |
| | | |
| | | Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.QueryFirst(x => x.PalletCode == palletCode); |
| | |
| | | return WebResponseContent.Instance.Error($"该æçå·²ç»å®è´§ä½"); |
| | | } |
| | | |
| | | //todo éè¿ç«å°å·æ¾å··éå· |
| | | string roadwayNo = "RSC01"; |
| | | |
| | | PalletTypeEnum palletType = PalletTypeEnum.SmallPallet; |
| | | |
| | | Dt_LocationInfo? locationInfo = _basicService.LocationInfoService.AssignLocation(roadwayNo, palletType); |
| | | if (locationInfo == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"è´§ä½åé
失败,æªæ¾å°å¯åé
è´§ä½"); |
| | | } |
| | | Dt_Task newTask = new Dt_Task() |
| | | { |
| | | CurrentAddress = stationCode, |
| | | Grade = 0, |
| | | NextAddress = "", |
| | | PalletCode = palletCode, |
| | | Roadway = roadwayNo, |
| | | Roadway = "", |
| | | SourceAddress = stationCode, |
| | | TargetAddress = locationInfo.LocationCode, |
| | | TaskType = TaskTypeEnum.Inbound.ObjToInt(), |
| | | TaskStatus = InTaskStatusEnum.InNew.ObjToInt(), |
| | | TargetAddress = "", |
| | | TaskType = TaskInboundTypeEnum.Inbound.ObjToInt(), |
| | | TaskStatus = TaskInStatusEnum.SC_InExecute.ObjToInt(), |
| | | }; |
| | | |
| | | LocationStatusEnum lastStatus = (LocationStatusEnum)locationInfo.LocationStatus; |
| | | |
| | | stockInfo.StockStatus = StockStatusEmun.å
¥åºç¡®è®¤.ObjToInt(); |
| | | |
| | | _unitOfWorkManage.BeginTran(); |
| | | int taskId = BaseDal.AddData(newTask); |
| | | newTask.TaskId = taskId; |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, lastStatus, LocationChangeType.InboundAssignLocation); |
| | | _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, palletType, LocationStatusEnum.Lock); |
| | | _stockRepository.StockInfoRepository.UpdateData(stockInfo); |
| | | _unitOfWorkManage.CommitTran(); |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// å
¥åºä»»å¡ç³è¯·åé
è´§ä½ |
| | | /// </summary> |
| | | /// <param name="taskNum">ä»»å¡å·</param> |
| | | /// <param name="roadwayNo">å··éå·</param> |
| | | /// <param name="palletType">æçç±»å</param> |
| | | /// <returns></returns> |
| | | public WebResponseContent AssignInboundTaskLocation(int taskNum, string roadwayNo) |
| | | { |
| | | try |
| | | { |
| | | Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum); |
| | | if (task == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°è¯¥å
¥åºä»»å¡"); |
| | | } |
| | | |
| | | Dt_LocationInfo? locationInfo = _basicService.LocationInfoService.AssignLocation(roadwayNo, (PalletTypeEnum)task.PalletType, task.WarehouseId); |
| | | if (locationInfo == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"è´§ä½åé
失败,æªæ¾å°å¯åé
è´§ä½"); |
| | | } |
| | | |
| | | task.Roadway = roadwayNo; |
| | | task.TargetAddress = locationInfo.LocationCode; |
| | | task.TaskStatus = TaskInStatusEnum.SC_InExecute.ObjToInt(); |
| | | |
| | | LocationStatusEnum lastStatus = (LocationStatusEnum)locationInfo.LocationStatus; |
| | | |
| | | _unitOfWorkManage.BeginTran(); |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, lastStatus, LocationChangeType.InboundAssignLocation); |
| | | _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, (PalletTypeEnum)task.PalletType, LocationStatusEnum.Lock, task.WarehouseId); |
| | | BaseDal.UpdateData(task); |
| | | _unitOfWorkManage.CommitTran(); |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// å
¥åºä»»å¡å®æ |
| | | /// </summary> |
| | | /// <param name="taskNum">ä»»å¡å·</param> |
| | | /// <returns></returns> |
| | | public WebResponseContent InboundTaskCompleted(int taskNum) |
| | | { |
| | | try |
| | |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°è¯¥ä»»å¡ä¿¡æ¯"); |
| | | } |
| | | |
| | | if (task.TaskType != TaskTypeEnum.Inbound.ObjToInt()) |
| | | if (task.TaskType != TaskInboundTypeEnum.Inbound.ObjToInt()) |
| | | { |
| | | return WebResponseContent.Instance.Error($"ä»»å¡ç±»åé误"); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | |  |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core.Enums; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_DTO.Stock; |
| | | using WIDESEA_Model.Models; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_Common.OtherEnum; |
| | | using WIDESEA_Common.TaskEnum; |
| | | using WIDESEA_Common.OrderEnum; |
| | | using WIDESEA_Common.StockEnum; |
| | | |
| | | namespace WIDESEA_TaskInfoService |
| | | { |
| | | public partial class TaskService |
| | | { |
| | | |
| | | /// <summary> |
| | | /// åºåæ°æ®è½¬åºåºä»»å¡ |
| | | /// </summary> |
| | | /// <param name="stockInfos"></param> |
| | | /// <returns></returns> |
| | | public List<Dt_Task> GetTasks(List<Dt_StockInfo> stockInfos) |
| | | { |
| | | List<Dt_Task> tasks = new List<Dt_Task>(); |
| | | for (int i = 0; i < stockInfos.Count; i++) |
| | | { |
| | | Dt_StockInfo stockInfo = stockInfos[i]; |
| | | |
| | | if (stockInfo != null) |
| | | { |
| | | Dt_LocationInfo locationInfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == stockInfo.LocationCode); |
| | | Dt_Task task = new() |
| | | { |
| | | CurrentAddress = stockInfo.LocationCode, |
| | | Grade = 0, |
| | | PalletCode = stockInfo.PalletCode, |
| | | NextAddress = "", |
| | | Roadway = locationInfo.RoadwayNo, |
| | | SourceAddress = stockInfo.LocationCode, |
| | | TargetAddress = "", |
| | | TaskStatus = TaskOutStatusEnum.OutNew.ObjToInt(), |
| | | TaskType = TaskOutboundTypeEnum.Outbound.ObjToInt(), |
| | | TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)) |
| | | }; |
| | | tasks.Add(task); |
| | | } |
| | | } |
| | | return tasks; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// åºåºä»»å¡æ°æ®å¤ç |
| | | /// </summary> |
| | | /// <param name="orderDetailId"></param> |
| | | /// <param name="stockSelectViews"></param> |
| | | /// <returns></returns> |
| | | /// <exception cref="Exception"></exception> |
| | | public (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutboundOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?) OutboundTaskDataHandle(int orderDetailId, List<StockSelectViewDTO> stockSelectViews) |
| | | { |
| | | List<Dt_Task> tasks = new List<Dt_Task>(); |
| | | Dt_OutboundOrderDetail outboundOrderDetail = _outboundService.OutboundOrderDetailService.Repository.QueryFirst(x => x.Id == orderDetailId); |
| | | |
| | | if (outboundOrderDetail == null) |
| | | { |
| | | throw new Exception("æªæ¾å°åºåºåæç»ä¿¡æ¯"); |
| | | } |
| | | |
| | | if (stockSelectViews.Sum(x => x.UseableQuantity) > outboundOrderDetail.OrderQuantity - outboundOrderDetail.LockQuantity) |
| | | { |
| | | throw new Exception("éæ©æ°éè¶
åºåæ®æ°é"); |
| | | } |
| | | List<Dt_StockInfo>? stockInfos = null; |
| | | Dt_OutboundOrderDetail? orderDetail = null; |
| | | List<Dt_OutStockLockInfo>? outStockLockInfos = null; |
| | | List<Dt_LocationInfo>? locationInfos = null; |
| | | if (outboundOrderDetail.OrderDetailStatus == OrderDetailStatusEnum.New.ObjToInt()) |
| | | { |
| | | (List<Dt_StockInfo>, Dt_OutboundOrderDetail, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) result = _outboundService.OutboundOrderDetailService.AssignStockOutbound(outboundOrderDetail, stockSelectViews); |
| | | if (result.Item1 != null && result.Item1.Count > 0) |
| | | { |
| | | tasks = GetTasks(result.Item1); |
| | | result.Item2.OrderDetailStatus = OrderDetailStatusEnum.Outbound.ObjToInt(); |
| | | result.Item3.ForEach(x => |
| | | { |
| | | x.Status = OutLockStockStatusEnum.åºåºä¸.ObjToInt(); |
| | | }); |
| | | |
| | | stockInfos = result.Item1; |
| | | orderDetail = result.Item2; |
| | | outStockLockInfos = result.Item3; |
| | | locationInfos = result.Item4; |
| | | } |
| | | else |
| | | { |
| | | throw new Exception("æ åºå"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | List<Dt_OutStockLockInfo> stockLockInfos = _outboundService.OutboundStockLockInfoService.GetByOrderDetailId(outboundOrderDetail.OrderId, OutLockStockStatusEnum.å·²åé
); |
| | | if (stockLockInfos != null && stockLockInfos.Count > 0) |
| | | { |
| | | List<Dt_StockInfo> stocks = _stockService.StockInfoService.Repository.GetStockInfosByPalletCodes(stockLockInfos.Select(x => x.PalletCode).Distinct().ToList()); |
| | | tasks = GetTasks(stocks); |
| | | } |
| | | } |
| | | |
| | | return (tasks, stockInfos, orderDetail == null ? null : new List<Dt_OutboundOrderDetail> { orderDetail }, outStockLockInfos, locationInfos); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// çæåºåºä»»å¡ |
| | | /// </summary> |
| | | /// <param name="orderDetailId"></param> |
| | | /// <param name="stockSelectViews"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent GenerateOutboundTask(int orderDetailId, List<StockSelectViewDTO> stockSelectViews) |
| | | { |
| | | try |
| | | { |
| | | (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutboundOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?) result = OutboundTaskDataHandle(orderDetailId, stockSelectViews); |
| | | |
| | | WebResponseContent content = GenerateOutboundTaskDataUpdate(result.Item1, result.Item2, result.Item3, result.Item4, result.Item5); |
| | | |
| | | return content; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// çæåºåºä»»å¡åæ°æ®æ´æ°å°æ°æ®åº |
| | | /// </summary> |
| | | /// <param name="tasks"></param> |
| | | /// <param name="stockInfos"></param> |
| | | /// <param name="outboundOrderDetails"></param> |
| | | /// <param name="outStockLockInfos"></param> |
| | | /// <param name="locationInfos"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent GenerateOutboundTaskDataUpdate(List<Dt_Task> tasks, List<Dt_StockInfo>? stockInfos = null, List<Dt_OutboundOrderDetail>? outboundOrderDetails = null, List<Dt_OutStockLockInfo>? outStockLockInfos = null, List<Dt_LocationInfo>? locationInfos = null) |
| | | { |
| | | try |
| | | { |
| | | _unitOfWorkManage.BeginTran(); |
| | | |
| | | BaseDal.AddData(tasks); |
| | | if (stockInfos != null && outboundOrderDetails != null && outStockLockInfos != null && locationInfos != null) |
| | | { |
| | | WebResponseContent content = _outboundService.OutboundOrderDetailService.LockOutboundStockDataUpdate(stockInfos, outboundOrderDetails, outStockLockInfos, locationInfos, tasks: tasks); |
| | | |
| | | if (content.Status) |
| | | { |
| | | _unitOfWorkManage.CommitTran(); |
| | | } |
| | | else |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | } |
| | | return content; |
| | | } |
| | | else if (outboundOrderDetails != null && outboundOrderDetails.Count > 0) |
| | | { |
| | | outboundOrderDetails.ForEach(x => |
| | | { |
| | | x.OrderDetailStatus = OrderDetailStatusEnum.Outbound.ObjToInt(); |
| | | }); |
| | | |
| | | _outboundService.OutboundOrderDetailService.Repository.UpdateData(outboundOrderDetails); |
| | | } |
| | | _unitOfWorkManage.CommitTran(); |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// çæåºåºä»»å¡ |
| | | /// </summary> |
| | | /// <param name="keys"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent GenerateOutboundTask(int[] keys) |
| | | { |
| | | try |
| | | { |
| | | List<Dt_Task> tasks = new List<Dt_Task>(); |
| | | List<StockSelectViewDTO> stockSelectViews = new List<StockSelectViewDTO>(); |
| | | List<Dt_StockInfo> stockInfos = new List<Dt_StockInfo>(); |
| | | List<Dt_OutboundOrderDetail> outboundOrderDetails = new List<Dt_OutboundOrderDetail>(); |
| | | List<Dt_OutStockLockInfo> outStockLockInfos = new List<Dt_OutStockLockInfo>(); |
| | | List<Dt_LocationInfo> locationInfos = new List<Dt_LocationInfo>(); |
| | | foreach (int key in keys) |
| | | { |
| | | (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutboundOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?) result = OutboundTaskDataHandle(key, stockSelectViews); |
| | | if (result.Item2 != null && result.Item2.Count > 0) |
| | | { |
| | | stockInfos.AddRange(result.Item2); |
| | | } |
| | | if (result.Item3 != null && result.Item3.Count > 0) |
| | | { |
| | | outboundOrderDetails.AddRange(result.Item3); |
| | | } |
| | | if (result.Item4 != null && result.Item4.Count > 0) |
| | | { |
| | | outStockLockInfos.AddRange(result.Item4); |
| | | } |
| | | if (result.Item5 != null && result.Item5.Count > 0) |
| | | { |
| | | locationInfos.AddRange(result.Item5); |
| | | } |
| | | if (result.Item1 != null && result.Item1.Count > 0) |
| | | { |
| | | tasks.AddRange(result.Item1); |
| | | } |
| | | } |
| | | |
| | | WebResponseContent content = GenerateOutboundTaskDataUpdate(tasks, stockInfos, outboundOrderDetails, outStockLockInfos, locationInfos); |
| | | return content; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | /// <param name="palletType"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, HttpGet, Route("AssignLocation"), AllowAnonymous] |
| | | public Dt_LocationInfo? AssignLocation(string roadwayNo, PalletTypeEnum palletType) |
| | | public Dt_LocationInfo? AssignLocation(string roadwayNo, PalletTypeEnum palletType, int warehouseId) |
| | | { |
| | | return Service.AssignLocation(roadwayNo, palletType); |
| | | return Service.AssignLocation(roadwayNo, palletType, warehouseId); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | using Microsoft.AspNetCore.Authorization; |
| | | using Microsoft.AspNetCore.Http; |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using WIDESEA_Common.CommonEnum; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.BaseController; |
| | | using WIDESEA_DTO.Stock; |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// å°WMS任塿¨éè³WCS |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpPost, HttpGet, Route("PushTasksToWCS"), AllowAnonymous] |
| | | public WebResponseContent PushTasksToWCS() |
| | | { |
| | | return Service.PushTasksToWCS(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ç³è¯·å
¥åºä»»å¡ |
| | | /// </summary> |
| | | /// <param name="palletCode"></param> |
| | | /// <param name="stationCode"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, HttpGet, Route("RequestInboundTask")] |
| | | [HttpPost, HttpGet, Route("RequestInboundTask"), AllowAnonymous] |
| | | public WebResponseContent RequestInboundTask(string palletCode, string stationCode) |
| | | { |
| | | return Service.RequestInboundTask(palletCode, stationCode); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// å
¥åºä»»å¡ç³è¯·åé
è´§ä½ |
| | | /// </summary> |
| | | /// <param name="taskNum">ä»»å¡å·</param> |
| | | /// <param name="roadwayNo">å··éå·</param> |
| | | /// <param name="palletType">æçç±»å</param> |
| | | /// <returns></returns> |
| | | [HttpPost, HttpGet, Route("AssignInboundTaskLocation"), AllowAnonymous] |
| | | public WebResponseContent AssignInboundTaskLocation(int taskNum, string roadwayNo) |
| | | { |
| | | return Service.AssignInboundTaskLocation(taskNum, roadwayNo); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | /// <param name="taskNum"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, HttpGet, Route("InboundTaskCompleted")] |
| | | [HttpPost, HttpGet, Route("InboundTaskCompleted"), AllowAnonymous] |
| | | public WebResponseContent InboundTaskCompleted(int taskNum) |
| | | { |
| | | return Service.InboundTaskCompleted(taskNum); |
| | |
| | | using WIDESEA_DTO.Inbound; |
| | | using WIDESEA_DTO.Outbound; |
| | | using WIDESEA_DTO.System; |
| | | using WIDESEA_DTO.Task; |
| | | using WIDESEA_Model.Models; |
| | | |
| | | namespace WIDESEA_WMSServer.Filter |
| | |
| | | CreateMap<OutboundOrderDetailAddDTO, Dt_OutboundOrderDetail>().ForMember(x => x.OrderDetailStatus, b => b.MapFrom(b => 0)); |
| | | CreateMap<OutboundOrderAddDTO, Dt_OutboundOrder>(); |
| | | CreateMap<Dt_ReceiveOrderDetail, Dt_CheckOrder>().ForMember(a => a.ReceivedQuantity, b => b.MapFrom(x => x.ReceivedQuantity)).ForMember(a => a.MaterielCode, b => b.MapFrom(x => x.MaterielCode)).ForMember(a => a.CheckOrderStatus, b => b.MapFrom(x => CheckOrderStatusEnum.NotCheck.ObjToInt())); |
| | | |
| | | CreateMap<Dt_Task, WMSTaskDTO>(); |
| | | } |
| | | } |
| | | } |