服务端的TigerApi 框架,基于.NET6 2024 版本
Ben Lin
2024-04-12 33b8cbd1b0419d59ef861ee401dacd1cb2bed410
盟祺科技改到api
已修改8个文件
已添加6个文件
744 ■■■■■ 文件已修改
Tiger.Api/Controllers/WMS/WMSController.MqCustomer.cs 47 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tiger.Api/Controllers/WMS/WMSController.MqModelInfo.cs 55 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tiger.Api/Controllers/WMS/WMSController.User.cs 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tiger.Business/DbBase.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tiger.Business/WMS/MengQi/Biz.Mq.Customer.cs 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tiger.Business/WMS/MengQi/Biz.Mq.ModelInfo.cs 66 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tiger.Business/WMS/MengQi/Biz.User.cs 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tiger.IBusiness/WMS/MengQi/ICustomer.cs 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tiger.IBusiness/WMS/MengQi/IModelInfo.cs 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tiger.IBusiness/WMS/MengQi/IUser.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tiger.Model.Net/Entitys/WMS/MengQi/ModelInfo.cs 88 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tiger.Model.Net/Entitys/WMS/MengQi/SNData.cs 241 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tiger.Model.Net/Entitys/WMS/MengQi/SNData_His.cs 108 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tiger.Model.Net/Tiger.Model.Net.csproj 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tiger.Api/Controllers/WMS/WMSController.MqCustomer.cs
@@ -1,5 +1,6 @@
using Microsoft.AspNetCore.Mvc;
using Rhea.Common;
using System.Collections.Generic;
using System.Threading.Tasks;
using Tiger.IBusiness;
using Tiger.Model;
@@ -9,9 +10,9 @@
    public partial class WMSController : ControllerBase
    {
        /// <summary>
        /// å®¢æˆ·ç«¯ç”¨æˆ·ç™»å½•
        /// èŽ·å–å®¢æˆ·ä¿¡æ¯
        /// </summary>
        /// <param name="userInfo"></param>
        /// <param name="action"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("api/[controller]/[action]")]
@@ -28,5 +29,47 @@
            }
            return Ok(response);
        }
        /// <summary>
        /// èŽ·å–åˆ†é¡µ
        /// </summary>
        /// <param name="action"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("api/[controller]/[action]")]
        public async Task<IActionResult> GetCustomers([FromBody] ApiAction<PageAble<Customer>> action)
        {
            ApiAction response = new();
            try
            {
                response = response.GetResponse(await DI.Resolve<ICustomer>().GetCustomers(action.Data));
            }
            catch (System.Exception ex)
            {
                response = response.GetResponse().CatchExceptionWithLog(ex);
            }
            return Ok(response);
        }
        /// <summary>
        /// å¯¼å…¥
        /// </summary>
        /// <param name="action"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("api/[controller]/[action]")]
        public async Task<IActionResult> SaveImportCustomerInfo([FromBody] ApiAction<List<Customer>> action)
        {
            ApiAction response = new();
            try
            {
                response = response.GetResponse(await DI.Resolve<ICustomer>().SaveImportCustomerInfo(action.Data));
            }
            catch (System.Exception ex)
            {
                response = response.GetResponse().CatchExceptionWithLog(ex);
            }
            return Ok(response);
        }
    }
}
Tiger.Api/Controllers/WMS/WMSController.MqModelInfo.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,55 @@
using Microsoft.AspNetCore.Mvc;
using Rhea.Common;
using System.Collections.Generic;
using System.Threading.Tasks;
using Tiger.IBusiness;
using Tiger.Model;
namespace Tiger.Api.Controllers.WMS
{
    public partial class WMSController : ControllerBase
    {
        /// <summary>
        /// èŽ·å–åˆ†é¡µ
        /// </summary>
        /// <param name="action"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("api/[controller]/[action]")]
        public async Task<IActionResult> GetModelInfo([FromBody] ApiAction<PageAble<ModelInfo>> action)
        {
            ApiAction response = new();
            try
            {
                response = response.GetResponse(await DI.Resolve<IModelInfo>().GetModelInfo(action.Data));
            }
            catch (System.Exception ex)
            {
                response = response.GetResponse().CatchExceptionWithLog(ex);
            }
            return Ok(response);
        }
        /// <summary>
        /// å¯¼å…¥
        /// </summary>
        /// <param name="action"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("api/[controller]/[action]")]
        public async Task<IActionResult> SaveImportModelInfo([FromBody] ApiAction<List<ModelInfo>> action)
        {
            ApiAction response = new();
            try
            {
                response = response.GetResponse(await DI.Resolve<IModelInfo>().SaveImportModelInfo(action.Data));
            }
            catch (System.Exception ex)
            {
                response = response.GetResponse().CatchExceptionWithLog(ex);
            }
            return Ok(response);
        }
    }
}
Tiger.Api/Controllers/WMS/WMSController.User.cs
@@ -28,5 +28,47 @@
            }
            return Ok(response);
        }
        /// <summary>
        /// èŽ·å–åˆ†é¡µ
        /// </summary>
        /// <param name="action"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("api/[controller]/[action]")]
        public async Task<IActionResult> GetUsers([FromBody] ApiAction<PageAble<User>> action)
        {
            ApiAction response = new();
            try
            {
                response = response.GetResponse(await DI.Resolve<IUser>().GetUserInfo(action.Data));
            }
            catch (System.Exception ex)
            {
                response = response.GetResponse().CatchExceptionWithLog(ex);
            }
            return Ok(response);
        }
        /// <summary>
        /// ä¿å­˜ç”¨æˆ·
        /// </summary>
        /// <param name="action"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("api/[controller]/[action]")]
        public async Task<IActionResult> SaveUser([FromBody] ApiAction<User> action)
        {
            ApiAction response = new();
            try
            {
                response = response.GetResponse(await DI.Resolve<IUser>().SaveUser(action.Data));
            }
            catch (System.Exception ex)
            {
                response = response.GetResponse().CatchExceptionWithLog(ex);
            }
            return Ok(response);
        }
    }
}
Tiger.Business/DbBase.cs
@@ -254,6 +254,7 @@
            {
                var dbres = isAsync ? await Db.Deleteable<T>().In(primaryKeys).ExecuteCommandAsync() : Db.Deleteable<T>().In(primaryKeys).ExecuteCommand();
                action.Message = $"Delete {typeof(T).Name} entity by primary keys from database success";
                action.IsSuccessed = true;
            }
            catch (Exception ex)
            {
@@ -276,6 +277,7 @@
            {
                var dbres = isAsync ? await Db.Deleteable<T>().Where(entity).ExecuteCommandAsync() : Db.Deleteable<T>().Where(entity).ExecuteCommand();
                action.Message = $"Delete {typeof(T).Name} entity from database success";
                action.IsSuccessed = true;
            }
            catch (Exception ex)
            {
Tiger.Business/WMS/MengQi/Biz.Mq.Customer.cs
@@ -1,4 +1,5 @@
using Rhea.Common;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Data;
@@ -18,6 +19,28 @@
        public partial class MqCustomer : ICustomer
        {
            /// <summary>
            /// èŽ·å–åˆ†é¡µ
            /// </summary>
            /// <param name="pageList"></param>
            /// <returns></returns>
            public async Task<ApiAction<PageAble<Customer>>> GetCustomers(PageAble<Customer> pageList)
            {
                var res = new ApiAction<PageAble<Customer>>();
                try
                {
                    RefAsync<int> total = 0;
                    pageList.data = await Db.Queryable<Customer>().WhereIF(!string.IsNullOrEmpty(pageList.sqlcmd), x => x.CustomerCode.Contains(pageList.sqlcmd)).OrderBy(x=>x.CustomerCode).ToPageListAsync(pageList.pageIndex, pageList.pageSize, total);
                    pageList.totals = total;
                }
                catch (Exception ex)
                {
                    res.CatchExceptionWithLog(ex, "获取客户信息异常");
                }
                res.Data = pageList;
                return res;
            }
            /// <summary>
            /// èŽ·å–å®¢æˆ·ä¿¡æ¯
            /// </summary>
            /// <returns></returns>
@@ -36,9 +59,21 @@
                return res;
            }
            public async Task<Result> SaveImportCustomerInfo(DataTable dt)
            public async Task<ApiAction> SaveImportCustomerInfo(List<Customer> list)
            {
                throw new NotImplementedException();
                var res = new ApiAction();
                //更新机型记录
                var db = Db;
                var dbTran = await db.UseTranAsync(async () =>
                {
                    await db.Saveable(list).ExecuteCommandAsync();
                });
                if (!dbTran.IsSuccess)
                {
                    res.IsSuccessed = false;
                    res.Message = $"导入异常";
                }
                return res;
            }
        }
    }
Tiger.Business/WMS/MengQi/Biz.Mq.ModelInfo.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,66 @@
using Rhea.Common;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tiger.IBusiness;
using Tiger.Model;
namespace Tiger.Business
{
    public partial class Biz
    {
        /// <summary>
        /// å®¢æˆ·
        /// </summary>
        public partial class MqModelInfo : IModelInfo
        {
            /// <summary>
            /// èŽ·å–åˆ†é¡µ
            /// </summary>
            /// <param name="pageList"></param>
            /// <returns></returns>
            public async Task<ApiAction<PageAble<ModelInfo>>> GetModelInfo(PageAble<ModelInfo> pageList)
            {
                var res = new ApiAction<PageAble<ModelInfo>>();
                try
                {
                    RefAsync<int> total = 0;
                    pageList.data = await Db.Queryable<ModelInfo>().WhereIF(!string.IsNullOrEmpty(pageList.sqlcmd), x => x.Model.Contains(pageList.sqlcmd)).OrderBy(x=>x.Model).ToPageListAsync(pageList.pageIndex, pageList.pageSize, total);
                    pageList.totals = total;
                }
                catch (Exception ex)
                {
                    res.CatchExceptionWithLog(ex, "获取产品信息异常");
                }
                res.Data = pageList;
                return res;
            }
            /// <summary>
            /// å¯¼å…¥
            /// </summary>
            /// <param name="list"></param>
            /// <returns></returns>
            public async Task<ApiAction> SaveImportModelInfo(List<ModelInfo> list)
            {
                var res = new ApiAction();
                //更新机型记录
                var db = Db;
                var dbTran = await db.UseTranAsync(async () =>
                {
                    await db.Saveable(list).ExecuteCommandAsync();
                });
                if (!dbTran.IsSuccess)
                {
                    res.IsSuccessed = false;
                    res.Message = $"导入异常";
                }
                return res;
            }
        }
    }
}
Tiger.Business/WMS/MengQi/Biz.User.cs
@@ -105,6 +105,38 @@
                }
                return result;
            }
            /// <summary>
            /// ä¿å­˜ç”¨æˆ·
            /// </summary>
            /// <param name="user"></param>
            /// <returns></returns>
            public async Task<ApiAction> SaveUser(User user) {
                var result = new ApiAction();
                try
                {
                    var db = Db;
                    var dbTran = db.UseTran(() =>
                    {
                        var y = db.Storageable(user)
                           .WhereColumns(t => new { t.UserCode })
                           .ToStorage();
                        y.AsInsertable.ExecuteCommand();
                        y.AsUpdateable.ExecuteCommand();
                    });
                    if (!dbTran.IsSuccess)
                    {
                        result.IsSuccessed = false;
                        result.Message = $"导入异常";
                    }
                }
                catch (Exception ex)
                {
                    result.CatchExceptionWithLog(ex, "保存用户异常");
                }
                return result;
            }
        }
    }
}
Tiger.IBusiness/WMS/MengQi/ICustomer.cs
@@ -12,6 +12,7 @@
    public interface ICustomer
    {
        public Task<ApiAction<List<Customer>>> GetCustomerInfo();
        public Task<Result> SaveImportCustomerInfo(DataTable dt);
        public Task<ApiAction> SaveImportCustomerInfo(List<Customer> list);
        public Task<ApiAction<PageAble<Customer>>> GetCustomers(PageAble<Customer> pageList);
    }
}
Tiger.IBusiness/WMS/MengQi/IModelInfo.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,17 @@
using Rhea.Common;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tiger.Model;
namespace Tiger.IBusiness
{
    public interface IModelInfo
    {
        public Task<ApiAction<PageAble<ModelInfo>>> GetModelInfo(PageAble<ModelInfo> pageList);
        public Task<ApiAction> SaveImportModelInfo(List<ModelInfo> list);
    }
}
Tiger.IBusiness/WMS/MengQi/IUser.cs
@@ -14,5 +14,6 @@
        public Task<PageAble<User>> GetUserInfo(PageAble<User> pageList);
        public Task<Result> SaveImportUserInfo(DataTable dt);
        public Task<ApiAction<User>> Login(User userInfo);
        public Task<ApiAction> SaveUser(User user);
    }
}
Tiger.Model.Net/Entitys/WMS/MengQi/ModelInfo.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,88 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Tiger.Model
{
    [Serializable]
    [Description("Primary:")]
    [SugarTable("ModelInfo")]
    public class ModelInfo
    {
        private string _id = null;
        private string _model = null;
        private string _modelname = null;
        private string _prefix = null;
        private string _snlength = null;
        [SugarColumn(IsPrimaryKey = true)]
        public string id
        {
            get
            {
                return _id;
            }
            set
            {
                _id = value;
            }
        }
        public string Model
        {
            get
            {
                return _model;
            }
            set
            {
                _model = value;
            }
        }
        public string ModelName
        {
            get
            {
                return _modelname;
            }
            set
            {
                _modelname = value;
            }
        }
        public string Prefix
        {
            get
            {
                return _prefix;
            }
            set
            {
                _prefix = value;
            }
        }
        public string SnLength
        {
            get
            {
                return _snlength;
            }
            set
            {
                _snlength = value;
            }
        }
    }
}
Tiger.Model.Net/Entitys/WMS/MengQi/SNData.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,241 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Tiger.Model
{
    [Serializable]
    [Description("Primary:")]
    [SugarTable("SNData")]
    public class SNData
    {
        private string _id = null;
        private string _sn = null;
        private string _status = null;
        private string _curroper = null;
        private string _fromoper = null;
        private string _scanner = null;
        private int _order_id = 0;
        private string _vechicle_id = null;
        private int _retesttimes = -1;
        private string _type = null;
        private DateTime _create_time = DateTime.Now;
        private string _create_user = null;
        private DateTime _update_time = DateTime.MinValue;
        private string _update_user = null;
        private string _customercode = null;
        [SugarColumn(IsPrimaryKey = true)]
        public string ID
        {
            get
            {
                return _id;
            }
            set
            {
                _id = value;
            }
        }
        public string SN
        {
            get
            {
                return _sn;
            }
            set
            {
                _sn = value;
            }
        }
        public string Status
        {
            get
            {
                return _status;
            }
            set
            {
                _status = value;
            }
        }
        public string CurrOper
        {
            get
            {
                return _curroper;
            }
            set
            {
                _curroper = value;
            }
        }
        public string FromOper
        {
            get
            {
                return _fromoper;
            }
            set
            {
                _fromoper = value;
            }
        }
        public string Scanner
        {
            get
            {
                return _scanner;
            }
            set
            {
                _scanner = value;
            }
        }
        public int Order_ID
        {
            get
            {
                return _order_id;
            }
            set
            {
                _order_id = value;
            }
        }
        public string Type
        {
            get
            {
                return _type;
            }
            set
            {
                _type = value;
            }
        }
        public int RetestTimes
        {
            get
            {
                return _retesttimes;
            }
            set
            {
                _retesttimes = value;
            }
        }
        public string Vechicle_ID
        {
            get
            {
                return _vechicle_id;
            }
            set
            {
                _vechicle_id = value;
            }
        }
        public DateTime CREATE_TIME
        {
            get
            {
                return _create_time;
            }
            set
            {
                _create_time = value;
            }
        }
        public string CREATE_USER
        {
            get
            {
                return _create_user;
            }
            set
            {
                _create_user = value;
            }
        }
        public DateTime UPDATE_TIME
        {
            get
            {
                return _update_time;
            }
            set
            {
                _update_time = value;
            }
        }
        public string UPDATE_USER
        {
            get
            {
                return _update_user;
            }
            set
            {
                _update_user = value;
            }
        }
        [SugarColumn(IsIgnore = true)]
        public string DisplayValue { get; set; }
        private string _ItemCode = null;
        public string ItemCode
        {
            get
            {
                return _ItemCode;
            }
            set
            {
                _ItemCode = value;
            }
        }
        public string CustomerCode
        {
            get
            {
                return _customercode;
            }
            set
            {
                _customercode = value;
            }
        }
    }
}
Tiger.Model.Net/Entitys/WMS/MengQi/SNData_His.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,108 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Tiger.Model
{
    [Serializable]
    [Description("Primary:")]
    [SugarTable("SNData_His")]
    public class SNData_His
    {
        private string _id = null;
        private string _sn = null;
        [SugarColumn(IsPrimaryKey = true)]
        public string ID
        {
            get
            {
                return _id;
            }
            set
            {
                _id = value;
            }
        }
        public string SN
        {
            get
            {
                return _sn;
            }
            set
            {
                _sn = value;
            }
        }
        private string _OriginalSN = null;
        public string OriginalSN
        {
            get
            {
                return _OriginalSN;
            }
            set
            {
                _OriginalSN = value;
            }
        }
        private DateTime _ScanTime = DateTime.MinValue;
        public DateTime ScanTime
        {
            get
            {
                return _ScanTime;
            }
            set
            {
                _ScanTime = value;
            }
        }
        private string _CREATE_USER = null;
        public string CREATE_USER
        {
            get
            {
                return _CREATE_USER;
            }
            set
            {
                _CREATE_USER = value;
            }
        }
        private string _modelcode = null;
        public string ModelCode
        {
            get
            {
                return _modelcode;
            }
            set
            {
                _modelcode = value;
            }
        }
        private string _customercode = null;
        public string CustomerCode
        {
            get
            {
                return _customercode;
            }
            set
            {
                _customercode = value;
            }
        }
    }
}
Tiger.Model.Net/Tiger.Model.Net.csproj
@@ -102,6 +102,9 @@
    <Compile Include="Entitys\WMS\Api\ProdReqInput.cs" />
    <Compile Include="Entitys\WMS\Api\ReprintEntitys.cs" />
    <Compile Include="Entitys\WMS\BIZ_ERP_CUSTOMS.cs" />
    <Compile Include="Entitys\WMS\MengQi\SNData_His.cs" />
    <Compile Include="Entitys\WMS\MengQi\SNData.cs" />
    <Compile Include="Entitys\WMS\MengQi\ModelInfo.cs" />
    <Compile Include="Entitys\WMS\MengQi\Customer.cs" />
    <Compile Include="Entitys\WMS\MengQi\User.cs" />
    <Compile Include="Entitys\WMS\V_MONTH_IN_SUM.cs" />