服务端的TigerApi 框架,基于.NET6 2024 版本
Ben Lin
2024-05-20 6738bfc4d55d8948e87cd78a2341cf4f988431f8
Smt上料一些更新
已修改3个文件
已添加2个文件
163 ■■■■ 文件已修改
Tiger.Business/MES/Transaction/LoadingMaterial.cs 111 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tiger.Model.Net/Entitys/MES/ParameterEntity/SmtLoadingInput.cs 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tiger.Model.Net/Entitys/MES/ParameterEntity/SmtLoadingReturn.cs 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tiger.Model.Net/Entitys/WMS/Api/BaseInput.cs 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tiger.Model.Net/Tiger.Model.Net.csproj 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tiger.Business/MES/Transaction/LoadingMaterial.cs
@@ -63,6 +63,43 @@
            SN,
        }
        /// <summary>
        /// å®ŒæˆçŠ¶æ€
        /// </summary>
        public enum Statuss
        {
            /// <summary>
            /// æ‰«ææœºå™¨ç¼–码完成
            /// </summary>
            [Description("机器编码完成")]
            SmtCodeOK,
            /// <summary>
            /// æ‰«ææ§½ä½å®Œæˆ
            /// </summary>
            [Description("槽位完成")]
            SlotNoOK,
            /// <summary>
            /// æ‰«æé£žè¾¾å®Œæˆ
            /// </summary>
            [Description("Feeder完成")]
            FeederOK,
            /// <summary>
            /// æ‰«ææ–™ç›˜SN完成
            /// </summary>
            [Description("料盘码完成")]
            SnOK,
            /// <summary>
            /// å½“前机器完成
            /// </summary>
            [Description("当前机器完成")]
            CurrCompleted,
            /// <summary>
            /// å…¨éƒ¨å®Œæˆ
            /// </summary>
            [Description("全部完成")]
            Completed,
        }
        #endregion Propertys & Variables
        #region Functions
@@ -72,9 +109,9 @@
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task<ApiAction> ScanItem(SmtLoadingInput input)
        public async Task<ApiAction<SmtLoadingReturn>> ScanItem(SmtLoadingInput input)
        {
            var action = new ApiAction();
            var action = new ApiAction<SmtLoadingReturn>();
            try
            {
                if (input.Code.IsNullOrEmpty())
@@ -100,6 +137,7 @@
                        action = ExecuteSN(input);
                        break;
                }
                if (!action.IsSuccessed) { return action; }
                //02保存上料数据
@@ -156,8 +194,14 @@
            return action;
        }
        private ApiAction ExecuteSmtCode(SmtLoadingInput input) {
            var action = new ApiAction();
        /// <summary>
        /// æ‰«ææœºå™¨ç¼–码操作
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        private ApiAction<SmtLoadingReturn> ExecuteSmtCode(SmtLoadingInput input) {
            var action = new ApiAction<SmtLoadingReturn>();
            SmtLoadingReturn loadingReturn = new();
            try
            {
                if (Biz.Db.Queryable<SMT_WO_TABLE>().Where(x => x.WORK_ORDER == input.moCode && x.LINE_CODE == input.lineCode && x.PROD_CODE == input.prodCode && x.SMT_CODE == input.Code).Any())
@@ -165,12 +209,16 @@
                    CurrSmtCode = input.Code;
                    action.IsSuccessed = true;
                    action.LocaleMsg = Biz.L($"机器编码验证通过!");
                    loadingReturn.SmtCode = CurrSmtCode;
                    loadingReturn.Step = (int)Step_Types.SmtCode;
                    loadingReturn.Status = (int)Statuss.SmtCodeOK;
                }
                else
                {
                    action.IsSuccessed = false;
                    action.LocaleMsg = Biz.L($"料站表中不存在此机器编码,请确认料站表是否正确上传!");
                }
                action.Data = loadingReturn;
            }
            catch (Exception ex)
            {
@@ -179,9 +227,15 @@
            return action;
        }
        private ApiAction ExecuteSlotNo(SmtLoadingInput input)
        /// <summary>
        /// æ‰«ææ§½ä½æ“ä½œ
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        private ApiAction<SmtLoadingReturn> ExecuteSlotNo(SmtLoadingInput input)
        {
            var action = new ApiAction();
            var action = new ApiAction<SmtLoadingReturn>();
            SmtLoadingReturn loadingReturn = new();
            try
            {
                if (Biz.Db.Queryable<SMT_WO_TABLE>().Where(x => x.WORK_ORDER == input.moCode && x.LINE_CODE == input.lineCode && x.PROD_CODE == input.prodCode && x.SMT_CODE == CurrSmtCode && x.SLOT_NO == input.Code).Any())
@@ -189,12 +243,18 @@
                    CurrSlotNo = input.Code;
                    action.IsSuccessed = true;
                    action.LocaleMsg = Biz.L($"槽位验证通过!");
                    loadingReturn.SmtCode = CurrSmtCode;
                    loadingReturn.SlotNo = CurrSlotNo;
                    loadingReturn.Step = (int)Step_Types.SlotNo;
                    loadingReturn.Status = (int)Statuss.SlotNoOK;
                    loadingReturn.LoadingCount = Biz.Db.Queryable<SMT_LOADING>().Where(x=> x.WORK_ORDER == input.moCode && x.LINE_CODE == input.lineCode && x.PROD_CODE == input.prodCode && x.SMT_CODE == CurrSmtCode && x.SLOT_NO == input.Code).Count();
                }
                else
                {
                    action.IsSuccessed = false;
                    action.LocaleMsg = Biz.L($"此槽位[{input.Code}]不存在或料站表未上传!");
                }
                action.Data = loadingReturn;
            }
            catch (Exception ex)
            {
@@ -203,12 +263,36 @@
            return action;
        }
        private ApiAction ExecuteFeeder(SmtLoadingInput input)
        /// <summary>
        /// æ‰«æé£žè¾¾æ“ä½œ
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        private ApiAction<SmtLoadingReturn> ExecuteFeeder(SmtLoadingInput input)
        {
            var action = new ApiAction();
            var action = new ApiAction<SmtLoadingReturn>();
            try
            {
                var _feeder = Biz.Db.Queryable<SMT_FEEDER>().Where(x => x.FEEDER_CODE == input.Code).First();
                //检查飞达保养维护情况
                if (_feeder.FEEDER_TYPE.IsNullOrEmpty())
                {
                    action.IsSuccessed = false;
                    action.LocaleMsg = Biz.L($"此飞达[{input.Code}]未维护类型信息!");
                    return action;
                }
                if (_feeder.FEEDER_TYPE != input.feederType)
                {
                    action.IsSuccessed = false;
                    action.LocaleMsg = Biz.L($"此飞达[{input.Code}]Feeder类型不一致!要求的类型:[{_feeder.FEEDER_TYPE}];当前Feeder的类型:[{input.feederType}]");
                    return action;
                }
                if (_feeder.USED_COUNT >= _feeder.MAX_COUNT)
                {
                    action.IsSuccessed = false;
                    action.LocaleMsg = Biz.L($"此飞达[{input.Code}]已达最大使用次数,请保养后再使用!");
                    return action;
                }
            }
            catch (Exception ex)
            {
@@ -217,9 +301,14 @@
            return action;
        }
        private ApiAction ExecuteSN(SmtLoadingInput input)
        /// <summary>
        /// æ‰«æç‰©æ–™æ¡ç æ“ä½œ
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        private ApiAction<SmtLoadingReturn> ExecuteSN(SmtLoadingInput input)
        {
            var action = new ApiAction();
            var action = new ApiAction<SmtLoadingReturn>();
            try
            {
Tiger.Model.Net/Entitys/MES/ParameterEntity/SmtLoadingInput.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Tiger.Model
{
    public class SmtLoadingInput : BaseCodeInput
    {
        public int Step { get; set; }
        public string prodCode { get; set; }
        public string lineCode { get; set; }
        public string pcbSurface { get; set; }
        public string moCode { get; set; }
        public string machineCode { get; set; }
        public string feederType { get; set; }
    }
}
Tiger.Model.Net/Entitys/MES/ParameterEntity/SmtLoadingReturn.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Tiger.Model
{
    public class SmtLoadingReturn
    {
        public int Step { get; set; }
        public string SmtCode { get; set; }
        public string SlotNo { get; set; }
        public List<string> ItemCodes { get; set; }
        public int LoadingCount { get; set; }
        public string FeederType { get; set; }
        public int Status { get; set; }
    }
}
Tiger.Model.Net/Entitys/WMS/Api/BaseInput.cs
@@ -50,14 +50,4 @@
    {
        public bool IsItemCodeList { get; set; }
    }
    public class SmtLoadingInput : BaseCodeInput
    {
        public int Step { get; set; }
        public string prodCode { get; set; }
        public string lineCode { get; set; }
        public string pcbSurface { get; set; }
        public string moCode { get; set; }
        public string machineCode { get; set; }
    }
}
Tiger.Model.Net/Tiger.Model.Net.csproj
@@ -109,6 +109,8 @@
    <Compile Include="Entitys\MES\MES_WIP_DATA.cs" />
    <Compile Include="Entitys\MES\MES_WIP_HIS.cs" />
    <Compile Include="Entitys\MES\node.cs" />
    <Compile Include="Entitys\MES\ParameterEntity\SmtLoadingReturn.cs" />
    <Compile Include="Entitys\MES\ParameterEntity\SmtLoadingInput.cs" />
    <Compile Include="Entitys\MES\R_Wip_Tracking_T.cs" />
    <Compile Include="Entitys\MES\SMT_FEEDER.cs" />
    <Compile Include="Entitys\MES\SMT_FEEDER_TYPE.cs" />