服务端的TigerApi 框架,基于.NET6 2024 版本
Ben Lin
2025-02-19 e8aef02a3b8a6b6c5f0b13798f318aa7dc56e13f
Tiger.Model.Net/Entitys/MES/ParameterEntity/PositionParameter.cs
@@ -38,9 +38,17 @@
        /// </summary>
        public string SN { get; set; }
        /// <summary>
        /// 数量
        /// </summary>
        public string Qty { get; set; }
        /// <summary>
        /// 当前操作提交的不良代码,没有则留空
        /// </summary>
        public string DFT_CODE { get; set; }
        /// <summary>
        /// 当前操作的行为的变量字典,如果是不是行为,否则留空
        /// </summary>
        public Dictionary<string, string> ActionDic { get; set; } = new Dictionary<string, string>();
        /// <summary>
        /// 当前操作需要提交的数据
        /// </summary>
@@ -52,31 +60,51 @@
        /// <summary>
        /// 整个工序操作是否完成
        /// </summary>
        public bool IsFinished { get; set; }
        /// <summary>
        /// 当前操作的工单
        /// </summary>
        public string CurWO { get; set; }
        /// <summary>
        /// 当前操作的工单批次
        /// </summary>
        public string CurBatch { get; set; }
        public bool IsFinished { get; set; } = false;
        /// <summary>
        /// 当前操作的节点名称
        /// </summary>
        public string CurNode { get; set; }
        public string NodeName { get; set; }
        /// <summary>
        /// 如果当前节点为工序行为节点,则行为定义编码,否则留空
        /// 当前操作的行为名称,如果是不是行为,否则留空
        /// </summary>
        public string StepActCode { get; set; }
        public string ActionName { get; set; }
        /// <summary>
        /// 当前操作的行为的类名,如果是不是行为,否则留空
        /// </summary>
        public string ActionType { get; set; }
        /// <summary>
        /// 当前操作的行为的变量字典,如果是不是行为,否则留空
        /// </summary>
        public Dictionary<string, string> ActionDic { get; set; }
        /// <summary>
        /// 下一个操作的工步ID
        /// </summary>
        public string NextStepID { get; set; }
        /// <summary>
        /// 短消息
        /// </summary>
        public ShortMessage ShortMsg { get; set; }
        /// <summary>
        /// Mqtt消息
        /// </summary>
        public MQTT.Message MqttMsg { get; set; }
        /// <summary>
        /// 当前操作返回的数据
        /// </summary>
        public object Data { get; set; }
        /// <summary>
        /// 工序信息
        /// </summary>
        public OperInfo OperInfo { get; set; }
        /// <summary>
        /// 当前操作的工单对象
        /// </summary>
        public BIZ_MES_WO CurWO { get; set; }
        /// <summary>
        /// 当前操作的工单批次对象
        /// </summary>
        public BIZ_MES_WO_BATCH CurBatch { get; set; }
    }
    public class DefectOutput
@@ -87,4 +115,229 @@
        public string DFT_NAME { get; set; }
        public int DFT_LEVEL { get; set; }
    }
    public class PackingActionInput
    {
        /// <summary>
        /// 包装行为当前执行的操作代码,包括:<br/>
        /// Scan:扫码,扫描当前包装层级的条码<br/>
        /// Print:打印,打印当前包装层级的标签<br/>
        /// Complete:完成,完成全部包装<br/>
        /// Weighing:称重,完成包装后对整个包装成称重<br/>
        /// </summary>
        public string ExecCode { get; set; }
        /// <summary>
        /// 客户端是否完成当前操作
        /// </summary>
        public bool IsFinish { get; set; }
        /// <summary>
        /// 当前操作的包装层级
        /// </summary>
        public int PkgLevel { get; set; }
        /// <summary>
        /// 当前操作的包装层级的标签条码
        /// </summary>
        public string PkgSN { get; set; }
        /// <summary>
        /// 当前操作的包装层级的重量信息
        /// </summary>
        public WeightInfo WeightInfo { get; set; }
    }
    public class PackingActionOutput
    {
        public WipPkg PkgInfo { get; set; }
        /// <summary>
        /// 包装行为当前执行的操作代码,包括:<br/>
        /// Scan:扫码,扫描当前包装层级的条码<br/>
        /// Print:打印,打印当前包装层级的标签<br/>
        /// Complete:完成,已保存包装数据<br/>
        /// Weighing:称重,完成包装后对整个包装成称重<br/>
        /// </summary>
        public string ExecCode { get; set; }
        /// <summary>
        /// 当前操作的包装层级
        /// </summary>
        public int PkgLevel { get; set; }
        /// <summary>
        /// 是否需要
        /// </summary>
        public bool RealPrint { get; set; } = true;
        /// <summary>
        /// 当前需要打印的包装层级的标签信息
        /// </summary>
        public BAS_LABEL_TEMP PrintLable { get; set; }
    }
    /// <summary>
    /// 在线包装
    /// </summary>
    public class WipPkg
    {
        public string WorkBatch { get; set; }
        public string RULE_CODE { get; set; }
        public string RULE_NAME { get; set; }
        public string PROD_CODE { get; set; }
        public MES_CUST_SN CustSN { get; set; }
        public WipPkgItem Item { get; set; }
        public bool NeedWeighing { get; set; } = false;
        public bool IsWeighed { get; set; } = false;
        public WeightInfo WeightInfo { get; set; } = new WeightInfo();
        public bool IsFinished => Item.IsFinished;
        public bool IsReachedEndNode { get; set; } = false;
        public string InStoreActID { get; set; }
        public BAS_LABEL_TEMP InStoreLabel { get; set; }
    }
    /// <summary>
    /// 在线包装明细
    /// </summary>
    public class WipPkgItem
    {
        public string PKG_CODE { get; set; }
        public string PKG_NAME { get; set; }
        public string IS_MIN_PKG { get; set; }
        public int PKG_LEVEL { get; set; }
        public int PKG_QTY { get; set; }
        public string LABEL_CODE { get; set; }
        public string SN { get; set; }
        public MES_WIP_PKG Package { get; set; }
        public bool IsFinished { get; set; } = false;
        public bool PkgComplete => PKG_LEVEL == 1 || Items.Count(q => q.IsFinished) == PKG_QTY;
        public List<WipPkgItem> Items { get; set; } = new List<WipPkgItem>();
        public Dictionary<string, string> WipSNs { get; set; } = new Dictionary<string, string>();
        public double TotalQty => Items.Any() ? Items.Sum(q => q.TotalQty) : Package?.QTY ?? 0;
        public List<MES_WIP_PKG> GetMinPackageList()
        {
            var list = new List<MES_WIP_PKG>();
            if (Items.Any())
            {
                foreach (var item in Items)
                {
                    item.Package.PARENT_SN = Package?.SN;
                    list.AddRange(item.GetMinPackageList());
                }
            }
            else
            {
                if (Package != null)
                {
                    list.Add(Package);
                }
            }
            return list;
        }
        public List<KeyValuePair<string, string>> GetWipSnList()
        {
            var list = new List<KeyValuePair<string, string>>();
            if (Items.Any())
            {
                foreach (var item in Items)
                {
                    list.AddRange(item.GetWipSnList());
                }
            }
            else
            {
                list.AddRange(WipSNs.ToList());
            }
            return list;
        }
    }
    /// <summary>
    /// 上料设置
    /// </summary>
    public class AssemblySetting
    {
        public string ITEM_CODE { get; set; }
        public string RULE_CODE { get; set; }
        /// <summary>
        /// 是否批次物料
        /// </summary>
        public bool IsBatchItem { get; set; }
        /// <summary>
        /// 上料数量
        /// </summary>
        public int QTY { get; set; }
    }
    /// <summary>
    /// 上料信息
    /// </summary>
    public class AssemblyInfo
    {
        public MES_WIP_DATA Product { get; set; }
        public bool IsFinished => !Items.Any(q => !q.IsFinished);
        public List<AssemblyItem> Items { get; set; } = new List<AssemblyItem>();
    }
    /// <summary>
    /// 上料信息明细
    /// </summary>
    public class AssemblyItem
    {
        public BAS_ITEM ItemInfo { get; set; }
        public string RuleCode { get; set; }
        public int LoadQty { get; set; }
        /// <summary>
        /// 是否批次物料
        /// </summary>
        public bool IsBatchItem { get; set; }
        public List<BAS_ITEM> SubItems { get; set; } = new List<BAS_ITEM>();
        public List<MES_WIP_ASSY> Records { get; set; } = new List<MES_WIP_ASSY>();
        public bool IsFinished { get; set; } = false;
    }
    /// <summary>
    /// 称重信息
    /// </summary>
    public class WeightInfo
    {
        public double Weight { get; set; }
        public string Unit { get; set; }
    }
    /// <summary>
    /// 工序信息
    /// </summary>
    public class OperInfo
    {
        public string NextNode { get; set; } = "   —   ";
        public string CurNode { get; set; } = "   —   ";
        public bool IsReachedEndNode { get; set; } = false;
        public int InputQty { get; set; } = 0;
        public List<WorkStepInfo> StepsInfo { get; set; } = new List<WorkStepInfo>();
    }
    /// <summary>
    /// 工步信息
    /// </summary>
    public class WorkStepInfo
    {
        public string ID { get; set; }
        public string Name { get; set; }
        public int Sequence { get; set; }
        public string NodeID { get; set; }
        public string NodeType { get; set; }
        public MES_WO_NODE Node { get; set; }
        public MES_WO_OPER OperSetting { get; set; }
        public MES_WO_NODE_ACT NodeAct { get; set; }
        public MES_WO_ACTION ActSetting { get; set; }
        public string Status { get; set; }
        public string Message { get; set; }
    }
    /// <summary>
    /// 出货信息
    /// </summary>
    public class ShipingInfo
    {
        public bool IsPrintCustomerLabel { get; set; }
        public int OldShipQty { get; set; }
        public int ShipQty { get; set; }
    }
}