服务端的TigerApi 框架,基于.NET6 2024 版本
Ben Lin
2024-05-15 93427767c06fbe2437abb4389af649c0a9bb3546
Tiger.Business/MES/Transaction/LoadingMaterial.cs
@@ -34,8 +34,8 @@
        public string UserCode { get; set; }
        public long UserId { get; set; }
        public string OrgCode { get; set; }
        public bool his_isComplete { get; set; }
        public bool isManual { get; set; }
        public string CurrSmtCode { get; set; }
        public string CurrSlotNo { get; set; }
        /// <summary>
        /// 步骤类型
        /// </summary>
@@ -72,9 +72,9 @@
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task<ApiAction<ProdReqOutput>> ScanItem(SmtLoadingInput input)
        public async Task<ApiAction> ScanItem(SmtLoadingInput input)
        {
            var action = new ApiAction<ProdReqOutput>();
            var action = new ApiAction();
            try
            {
                if (input.Code.IsNullOrEmpty())
@@ -84,20 +84,56 @@
                    return action;
                }
                //01根据上料步骤执行相应方法
                switch (EnumHelper.GetEnum<Step_Types>(input.Step))
                {
                    case Step_Types.SmtCode:
                        ExecuteSmtCode();
                        action = ExecuteSmtCode(input);
                        break;
                    case Step_Types.SlotNo:
                        ExecuteSlotNo();
                        action = ExecuteSlotNo(input);
                        break;
                    case Step_Types.Feeder:
                        ExecuteFeeder();
                        action = ExecuteFeeder(input);
                        break;
                    case Step_Types.SN:
                        ExecuteSN();
                        action = ExecuteSN(input);
                        break;
                }
                //02保存上料数据
                //03查看未上料列表
                Biz.SmtTool smtTool = new();
                var actionSmtTool = await smtTool.GetNotLoadingMaterial(input);
                if (actionSmtTool.IsSuccessed)
                {
                    //带入机器编码查询,如果没有未上料的项,说明当前机器所有槽位均已完成上料!
                    if (actionSmtTool.Data.Count == 0)
                    {
                        var _input = input.Clone();
                        _input.machineCode = "";
                        action.LocaleMsg = Biz.L($"当前机器所有槽位均已完成上料!");
                        var _actionSmtTool = await smtTool.GetNotLoadingMaterial(_input);
                        if (_actionSmtTool.IsSuccessed)
                        {
                            //不带入机器编码查询,如果没有未上料的项,说明当前线别所有机器均已完成上料!
                            if (_actionSmtTool.Data.Count == 0)
                            {
                                action.LocaleMsg = Biz.L($"当前线别所有机器均已完成上料");
                            }
                        }
                        else
                        {
                            action.IsSuccessed = false;
                            action.LocaleMsg = Biz.L($"获取未上料列表失败!");
                        }
                    }
                }
                else
                {
                    action.IsSuccessed = false;
                    action.LocaleMsg = Biz.L($"获取未上料列表失败!");
                }
                //action.Data = new ProdReqOutput()
@@ -120,11 +156,21 @@
            return action;
        }
        private ApiAction ExecuteSmtCode() {
        private ApiAction ExecuteSmtCode(SmtLoadingInput input) {
            var action = new ApiAction();
            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())
                {
                    CurrSmtCode = input.Code;
                    action.IsSuccessed = true;
                    action.LocaleMsg = Biz.L($"机器编码验证通过!");
                }
                else
                {
                    action.IsSuccessed = false;
                    action.LocaleMsg = Biz.L($"料站表中不存在此机器编码,请确认料站表是否正确上传!");
                }
            }
            catch (Exception ex)
            {
@@ -133,12 +179,22 @@
            return action;
        }
        private ApiAction ExecuteSlotNo()
        private ApiAction ExecuteSlotNo(SmtLoadingInput input)
        {
            var action = new ApiAction();
            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())
                {
                    CurrSlotNo = input.Code;
                    action.IsSuccessed = true;
                    action.LocaleMsg = Biz.L($"槽位验证通过!");
                }
                else
                {
                    action.IsSuccessed = false;
                    action.LocaleMsg = Biz.L($"此槽位[{input.Code}]不存在或料站表未上传!");
                }
            }
            catch (Exception ex)
            {
@@ -147,7 +203,7 @@
            return action;
        }
        private ApiAction ExecuteFeeder()
        private ApiAction ExecuteFeeder(SmtLoadingInput input)
        {
            var action = new ApiAction();
            try
@@ -161,7 +217,7 @@
            return action;
        }
        private ApiAction ExecuteSN()
        private ApiAction ExecuteSN(SmtLoadingInput input)
        {
            var action = new ApiAction();
            try