From 33b8cbd1b0419d59ef861ee401dacd1cb2bed410 Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期五, 12 四月 2024 14:44:10 +0800 Subject: [PATCH] 盟祺科技改到api --- Tiger.Api/Controllers/WMS/WMSController.MqCustomer.cs | 47 +++ Tiger.Api/Controllers/WMS/WMSController.MqModelInfo.cs | 55 ++++ Tiger.Model.Net/Entitys/WMS/MengQi/SNData_His.cs | 108 ++++++++ Tiger.Model.Net/Entitys/WMS/MengQi/ModelInfo.cs | 88 ++++++ Tiger.IBusiness/WMS/MengQi/IUser.cs | 1 Tiger.Model.Net/Tiger.Model.Net.csproj | 3 Tiger.IBusiness/WMS/MengQi/ICustomer.cs | 3 Tiger.IBusiness/WMS/MengQi/IModelInfo.cs | 17 + Tiger.Business/WMS/MengQi/Biz.User.cs | 32 ++ Tiger.Model.Net/Entitys/WMS/MengQi/SNData.cs | 241 ++++++++++++++++++ Tiger.Api/Controllers/WMS/WMSController.User.cs | 42 +++ Tiger.Business/DbBase.cs | 2 Tiger.Business/WMS/MengQi/Biz.Mq.Customer.cs | 39 ++ Tiger.Business/WMS/MengQi/Biz.Mq.ModelInfo.cs | 66 +++++ 14 files changed, 739 insertions(+), 5 deletions(-) diff --git a/Tiger.Api/Controllers/WMS/WMSController.MqCustomer.cs b/Tiger.Api/Controllers/WMS/WMSController.MqCustomer.cs index e7f2e6a..2a3d914 100644 --- a/Tiger.Api/Controllers/WMS/WMSController.MqCustomer.cs +++ b/Tiger.Api/Controllers/WMS/WMSController.MqCustomer.cs @@ -1,5 +1,6 @@ 锘縰sing 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); + } } } diff --git a/Tiger.Api/Controllers/WMS/WMSController.MqModelInfo.cs b/Tiger.Api/Controllers/WMS/WMSController.MqModelInfo.cs new file mode 100644 index 0000000..c2d5b6c --- /dev/null +++ b/Tiger.Api/Controllers/WMS/WMSController.MqModelInfo.cs @@ -0,0 +1,55 @@ +锘縰sing 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); + } + } +} diff --git a/Tiger.Api/Controllers/WMS/WMSController.User.cs b/Tiger.Api/Controllers/WMS/WMSController.User.cs index 5fcd689..c104c06 100644 --- a/Tiger.Api/Controllers/WMS/WMSController.User.cs +++ b/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); + } } } diff --git a/Tiger.Business/DbBase.cs b/Tiger.Business/DbBase.cs index 2a6939e..9b07916 100644 --- a/Tiger.Business/DbBase.cs +++ b/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) { diff --git a/Tiger.Business/WMS/MengQi/Biz.Mq.Customer.cs b/Tiger.Business/WMS/MengQi/Biz.Mq.Customer.cs index b842687..3327b8a 100644 --- a/Tiger.Business/WMS/MengQi/Biz.Mq.Customer.cs +++ b/Tiger.Business/WMS/MengQi/Biz.Mq.Customer.cs @@ -1,4 +1,5 @@ 锘縰sing 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; } } } diff --git a/Tiger.Business/WMS/MengQi/Biz.Mq.ModelInfo.cs b/Tiger.Business/WMS/MengQi/Biz.Mq.ModelInfo.cs new file mode 100644 index 0000000..f809379 --- /dev/null +++ b/Tiger.Business/WMS/MengQi/Biz.Mq.ModelInfo.cs @@ -0,0 +1,66 @@ +锘縰sing 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; + } + } + } +} diff --git a/Tiger.Business/WMS/MengQi/Biz.User.cs b/Tiger.Business/WMS/MengQi/Biz.User.cs index 6ecaf37..44b4560 100644 --- a/Tiger.Business/WMS/MengQi/Biz.User.cs +++ b/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; + } } } } diff --git a/Tiger.IBusiness/WMS/MengQi/ICustomer.cs b/Tiger.IBusiness/WMS/MengQi/ICustomer.cs index 13f95fc..b50973c 100644 --- a/Tiger.IBusiness/WMS/MengQi/ICustomer.cs +++ b/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); } } diff --git a/Tiger.IBusiness/WMS/MengQi/IModelInfo.cs b/Tiger.IBusiness/WMS/MengQi/IModelInfo.cs new file mode 100644 index 0000000..c396fce --- /dev/null +++ b/Tiger.IBusiness/WMS/MengQi/IModelInfo.cs @@ -0,0 +1,17 @@ +锘縰sing 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); + } +} diff --git a/Tiger.IBusiness/WMS/MengQi/IUser.cs b/Tiger.IBusiness/WMS/MengQi/IUser.cs index d9e582e..0393ca0 100644 --- a/Tiger.IBusiness/WMS/MengQi/IUser.cs +++ b/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); } } diff --git a/Tiger.Model.Net/Entitys/WMS/MengQi/ModelInfo.cs b/Tiger.Model.Net/Entitys/WMS/MengQi/ModelInfo.cs new file mode 100644 index 0000000..22bd367 --- /dev/null +++ b/Tiger.Model.Net/Entitys/WMS/MengQi/ModelInfo.cs @@ -0,0 +1,88 @@ +锘縰sing 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; + } + } + } +} diff --git a/Tiger.Model.Net/Entitys/WMS/MengQi/SNData.cs b/Tiger.Model.Net/Entitys/WMS/MengQi/SNData.cs new file mode 100644 index 0000000..b40fadc --- /dev/null +++ b/Tiger.Model.Net/Entitys/WMS/MengQi/SNData.cs @@ -0,0 +1,241 @@ +锘縰sing 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; + } + } + } +} diff --git a/Tiger.Model.Net/Entitys/WMS/MengQi/SNData_His.cs b/Tiger.Model.Net/Entitys/WMS/MengQi/SNData_His.cs new file mode 100644 index 0000000..da510f9 --- /dev/null +++ b/Tiger.Model.Net/Entitys/WMS/MengQi/SNData_His.cs @@ -0,0 +1,108 @@ +锘縰sing 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; + } + } + } +} diff --git a/Tiger.Model.Net/Tiger.Model.Net.csproj b/Tiger.Model.Net/Tiger.Model.Net.csproj index d56273e..eda53bf 100644 --- a/Tiger.Model.Net/Tiger.Model.Net.csproj +++ b/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" /> -- Gitblit v1.9.3