You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
296 lines
6.7 KiB
296 lines
6.7 KiB
using System;
|
|
using System.Text.Json.Serialization;
|
|
|
|
namespace Mirle.Component.API.WarehouseExecutionSystem.Models
|
|
{
|
|
/// <summary>
|
|
/// 回應代碼
|
|
/// </summary>
|
|
public enum ReplyCode
|
|
{
|
|
/// <summary>
|
|
/// 成功
|
|
/// </summary>
|
|
OK,
|
|
/// <summary>
|
|
/// 失敗
|
|
/// </summary>
|
|
NG
|
|
}
|
|
|
|
#region === [Mode] ===
|
|
|
|
/// <summary>
|
|
/// 搬運命令模式
|
|
/// </summary>
|
|
public enum CommandMode
|
|
{
|
|
/// <summary>
|
|
/// 入庫
|
|
/// </summary>
|
|
StoreIn,
|
|
/// <summary>
|
|
/// 出庫
|
|
/// </summary>
|
|
StoreOut,
|
|
/// <summary>
|
|
/// 撿料/盤點
|
|
/// </summary>
|
|
TaskInventory,
|
|
/// <summary>
|
|
/// 站對站
|
|
/// </summary>
|
|
StationToStaion,
|
|
/// <summary>
|
|
/// 庫對庫
|
|
/// </summary>
|
|
StorageToStorage,
|
|
/// <summary>
|
|
/// 盤點作業
|
|
/// </summary>
|
|
TakeInventoryOperation,
|
|
/// <summary>
|
|
/// 盤點調帳
|
|
/// </summary>
|
|
TaskInventoryAdjust,
|
|
/// <summary>
|
|
/// 儲位維護
|
|
/// </summary>
|
|
MaintenanceLoc
|
|
}
|
|
/// <summary>
|
|
/// 取消命令模式
|
|
/// </summary>
|
|
public enum CancelMode
|
|
{
|
|
/// <summary>
|
|
/// 取消
|
|
/// </summary>
|
|
Cancel,
|
|
/// <summary>
|
|
/// 強制取消
|
|
/// </summary>
|
|
ForceCancel,
|
|
/// <summary>
|
|
/// 強制完成
|
|
/// </summary>
|
|
ForceComplete
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region === [Status] ===
|
|
|
|
/// <summary>
|
|
/// 命令完成狀態
|
|
/// </summary>
|
|
public enum CommandCompleteStatus
|
|
{
|
|
/// <summary>
|
|
/// 成功
|
|
/// </summary>
|
|
Complete,
|
|
/// <summary>
|
|
/// 強制完成
|
|
/// </summary>
|
|
ForceComplete,
|
|
/// <summary>
|
|
/// 強制取消
|
|
/// </summary>
|
|
ForceCancel,
|
|
/// <summary>
|
|
/// 失敗
|
|
/// </summary>
|
|
Failed
|
|
}
|
|
/// <summary>
|
|
/// 棧板供應狀態
|
|
/// </summary>
|
|
public enum PalletSupplyStatus
|
|
{
|
|
/// <summary>
|
|
/// 滿載
|
|
/// </summary>
|
|
Full,
|
|
/// <summary>
|
|
/// 空載
|
|
/// </summary>
|
|
Empty
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region === [Event] ===
|
|
|
|
/// <summary>
|
|
/// 緊急事件類別
|
|
/// </summary>
|
|
public enum EmergencyEvent
|
|
{
|
|
/// <summary>
|
|
/// 地震
|
|
/// </summary>
|
|
Earthquake,
|
|
/// <summary>
|
|
/// 消防
|
|
/// </summary>
|
|
Fire
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region === [Result Code] ===
|
|
|
|
/// <summary>
|
|
/// 建立命令結果
|
|
/// </summary>
|
|
public enum CreateCommandResultCode
|
|
{
|
|
/// <summary>
|
|
/// 成功
|
|
/// </summary>
|
|
Success,
|
|
/// <summary>
|
|
/// 拒絕
|
|
/// </summary>
|
|
Reject,
|
|
/// <summary>
|
|
/// 拆解命令錯誤
|
|
/// </summary>
|
|
DismantleCommandError
|
|
}
|
|
/// <summary>
|
|
/// 取消結果代碼
|
|
/// </summary>
|
|
public enum CancelCommandResultCode
|
|
{
|
|
/// <summary>
|
|
/// 成功
|
|
/// </summary>
|
|
Success,
|
|
/// <summary>
|
|
/// 搬運命令已經執行
|
|
/// </summary>
|
|
AlreadyExecute,
|
|
/// <summary>
|
|
/// 取消命令錯誤
|
|
/// </summary>
|
|
CancelCommandError,
|
|
/// <summary>
|
|
/// PLC-C 拒絕取消命令
|
|
/// </summary>
|
|
PLCCRejectCancel,
|
|
/// <summary>
|
|
/// AGV-C 拒絕取消命令
|
|
/// </summary>
|
|
AGVCRejectCancel,
|
|
/// <summary>
|
|
/// SH-C 拒絕取消命令
|
|
/// </summary>
|
|
SHTCRejectCancel,
|
|
/// <summary>
|
|
/// 搬運命令序號不存在
|
|
/// </summary>
|
|
CommandSequenceNumberIsNotExist
|
|
}
|
|
/// <summary>
|
|
/// 檢查載具編號及物料編號結果
|
|
/// </summary>
|
|
public enum CarrierIDInsepectResultCode
|
|
{
|
|
/// <summary>
|
|
/// 成功
|
|
/// </summary>
|
|
Success,
|
|
/// <summary>
|
|
/// 載具編號錯誤
|
|
/// </summary>
|
|
CarrierIDError,
|
|
/// <summary>
|
|
/// 物料編號錯誤
|
|
/// </summary>
|
|
MaterialIDError
|
|
}
|
|
/// <summary>
|
|
/// 物料檢測結果
|
|
/// </summary>
|
|
public enum MaterialInspectResultCode
|
|
{
|
|
/// <summary>
|
|
/// 成功
|
|
/// </summary>
|
|
Success,
|
|
/// <summary>
|
|
/// 過輕
|
|
/// </summary>
|
|
TooLight,
|
|
/// <summary>
|
|
/// 過重
|
|
/// </summary>
|
|
TooHeavy,
|
|
/// <summary>
|
|
/// 沒有重量
|
|
/// </summary>
|
|
NoWeight
|
|
}
|
|
/// <summary>
|
|
/// 緊急事件結果
|
|
/// </summary>
|
|
public enum EmergencyEventResultCode
|
|
{
|
|
/// <summary>
|
|
/// 成功
|
|
/// </summary>
|
|
Success,
|
|
/// <summary>
|
|
/// 失敗
|
|
/// </summary>
|
|
Failed
|
|
}
|
|
|
|
#endregion
|
|
|
|
/// <summary>
|
|
/// 訊息擴充方法類別
|
|
/// </summary>
|
|
public static class MessageExtension
|
|
{
|
|
/// <summary>
|
|
/// 轉換成任務模式
|
|
/// </summary>
|
|
/// <param name="commandMode">搬運命令模式</param>
|
|
/// <returns>任務模式</returns>
|
|
/// <exception cref="ArgumentException">未定義列舉項目</exception>
|
|
public static int ToTaskMode(this CommandMode commandMode)
|
|
{
|
|
return (commandMode) switch
|
|
{
|
|
CommandMode.StoreIn => 1,
|
|
CommandMode.StoreOut => 2,
|
|
CommandMode.TaskInventory => 3,
|
|
CommandMode.StationToStaion => 4,
|
|
CommandMode.StorageToStorage => 5,
|
|
CommandMode.TakeInventoryOperation => 6,
|
|
CommandMode.TaskInventoryAdjust => 7,
|
|
CommandMode.MaintenanceLoc => 8,
|
|
_ => throw new ArgumentException($"Unknown command mode {commandMode}")
|
|
};
|
|
}
|
|
/// <summary>
|
|
/// 轉換成任務狀態
|
|
/// </summary>
|
|
/// <param name="cancelMode">取消模式列舉</param>
|
|
/// <returns>任務狀態</returns>
|
|
/// <exception cref="ArgumentException">未定義列舉項目</exception>
|
|
public static int ToTaskStatus(this CancelMode cancelMode)
|
|
{
|
|
return (cancelMode) switch
|
|
{
|
|
CancelMode.ForceComplete => 5,
|
|
CancelMode.Cancel => 7,
|
|
CancelMode.ForceCancel => 8,
|
|
_ => throw new ArgumentException($"Unknown cancel mode {cancelMode}")
|
|
};
|
|
}
|
|
}
|
|
}
|