From e08a2e8a24be0996dec3b681f3c4ab45333f331c Mon Sep 17 00:00:00 2001 From: 啊鑫 <t2856754968@163.com> Date: 星期二, 22 十月 2024 17:54:29 +0800 Subject: [PATCH] 初始化 --- MES.Service/Modes/SalesReturnNoticeDetail.cs | 155 MESApplication/Controllers/BasicData/MesSupplierController.cs | 255 + MES.Service/Modes/MesRohInData.cs | 361 ++ MESApplication/Controllers/BasicData/ShipmentDetailController.cs | 162 MESApplication/Controllers/BasicData/MesDepotsController.cs | 255 + MES.Service/Modes/MesRohIn.cs | 190 + MES.Service/Modes/SysUser.cs | 347 + MES.Service/Modes/MessageCenter.cs | 142 MES.Service/service/BasicData/MesRohInDataManager.cs | 78 MESApplication/Controllers/BasicData/MesPositionController.cs | 256 + MES.Service/Modes/MesStaff.cs | 162 MESApplication/Controllers/BasicData/MesRohInController.cs | 257 + MES.Service/service/BasicData/MesDepotsManager.cs | 228 + MES.Service/Dto/webApi/ErpCustomer.cs | 2 MES.Service/Modes/MesItemType.cs | 99 MESApplication/Controllers/BasicData/MesStaffController.cs | 257 + MES.Service/Modes/SysDepartment.cs | 113 MESApplication/Controllers/BasicData/SysDepartmentController.cs | 255 + MES.Service/Modes/SalesOrderDetail.cs | 113 MESApplication/Controllers/BasicData/SalesOrderController.cs | 162 MES.Service/service/BasicData/MesPositionManager.cs | 220 + MES.Service/DB/RepositoryNoEntity.cs | 4 MES.Service/service/BasicData/ShipmentNoticeManager.cs | 70 MES.Service/service/BasicData/SysDepartmentManager.cs | 233 + MESApplication/Controllers/BasicData/MesRohInDataController.cs | 162 MESApplication/Controllers/BasicData/MesCustomerController.cs | 257 + MES.Service/service/MessageCenterManager.cs | 77 MESApplication/Controllers/BasicData/SalesReturnNoticeController.cs | 163 MESApplication/Controllers/BasicData/OrganizeController.cs | 266 + MESApplication/Controllers/BasicData/MesItemTypeController.cs | 259 + MES.Service/service/BasicData/MesItemsManager.cs | 206 + MES.Service/service/BasicData/SalesReturnNoticeManager.cs | 8 MES.Service/Modes/Organize.cs | 74 MES.Service/service/BasicData/SalesOrderManager.cs | 78 MES.Service/Modes/SalesReturnNotice.cs | 83 MES.Service/service/BasicData/MesStaffManager.cs | 281 + MESApplication/MESApplication.csproj | 8 MES.Service/service/BasicData/MesRohInManager.cs | 278 + MESApplication/Controllers/BasicData/SalesReturnNoticeDetailController.cs | 163 MES.Service/service/BasicData/ShipmentDetailManager.cs | 78 MES.Service/Modes/MesUnit.cs | 142 MESApplication/Controllers/BasicData/SalesOrderDetailController.cs | 162 MES.Service/Modes/SalesOrder.cs | 113 MES.Service/service/BasicData/SalesOrderDetailManager.cs | 78 MES.Service/Modes/MesPosition.cs | 77 MES.Service/service/BasicData/MesCustomerManager.cs | 203 + MES.Service/service/BasicData/OrganizeManager.cs | 267 + MESApplication/Controllers/BasicData/MesUnitController.cs | 255 + MES.Service/service/BasicData/MesSupplierManager.cs | 197 + MESApplication/Controllers/BasicData/MesItemsController.cs | 256 + MES.Service/Modes/MesSupplier.cs | 184 + MES.Service/Modes/MesCustomer.cs | 201 + MESApplication/Controllers/BasicData/ShipmentNoticeController.cs | 162 MES.Service/Modes/MesDepots.cs | 108 MES.Service/Modes/ShipmentDetail.cs | 155 MES.Service/DB/Repository.cs | 63 MES.Service/service/BasicData/MesUnitManager.cs | 198 + MES.Service/Dto/webApi/ErpItems.cs | 20 MES.Service/Modes/MesItems.cs | 336 + MES.Service/MES.Service.csproj | 6 /dev/null | 49 MES.Service/service/BasicData/SalesReturnNoticeDetailManager.cs | 79 MES.Service/Modes/ShipmentNotice.cs | 125 MES.Service/service/BasicData/MesItemTypeManager.cs | 132 MESApplication/appsettings.json | 2 65 files changed, 10,250 insertions(+), 137 deletions(-) diff --git a/MES.Service/DB/DbContext.cs b/MES.Service/DB/DbContext.cs deleted file mode 100644 index a2650e2..0000000 --- a/MES.Service/DB/DbContext.cs +++ /dev/null @@ -1,90 +0,0 @@ -锘縰sing MES.Service.util; -using SqlSugar; - -namespace MES.Service.DB; - -/// <summary> -/// 鏁版嵁浠撳偍宸ュ巶 -/// </summary> -/// <typeparam name="T"></typeparam> -public class DbContext<T> where T : class, new() -{ - //DbContext<MesQaItemXj02> mesQaItemXj02Context = new DbContext<MesQaItemXj02>(); - //mesQaItemXj02Context.Db.Queryable<MesQaItemXj02>().ToList(); - - private static readonly string connectionString = - AppsettingsUtility.Settings.DataBaseConn; // 杩欓噷鏇挎崲鎴愪綘鐨勫疄闄呰繛鎺ュ瓧绗︿覆; - - /// <summary> - /// 娉ㄦ剰锛氫笉鑳藉啓鎴愰潤鎬佺殑 //鐢ㄦ潵澶勭悊浜嬪姟澶氳〃鏌ヨ鍜屽鏉傜殑鎿嶄綔 - /// </summary> - public SqlSugarClient Db; - - /// <summary> - /// 鍏ュ彛 - /// </summary> - public DbContext() - { - Db = new SqlSugarClient(new ConnectionConfig - { - ConnectionString = connectionString, - DbType = DbType.SqlServer, - InitKeyType = InitKeyType.Attribute, //浠庣壒鎬ц鍙栦富閿拰鑷鍒椾俊鎭� - IsAutoCloseConnection = true //寮�鍚嚜鍔ㄩ噴鏀炬ā寮忓拰EF鍘熺悊涓�鏍锋垜灏变笉澶氳В閲婁簡 - }); - - //璋冨紡浠g爜 鐢ㄦ潵鎵撳嵃SQL - Db.Aop.OnLogExecuting = (sql, pars) => - { - Console.WriteLine(sql + "\r\n" + - Db.Utilities.SerializeObject( - pars.ToDictionary(it => it.ParameterName, - it => it.Value))); - // LogHelper.LogWrite(sql + "\r\n" +Db.Utilities.SerializeObject(pars.ToDictionary(it => it.ParameterName, it => it.Value))); - }; - } - - /// <summary> - /// 鐢ㄦ潵澶勭悊T琛ㄧ殑甯哥敤鎿嶄綔 - /// </summary> - public SimpleClient<T> CurrentDb => new(Db); - - /// <summary> - /// 鑾峰彇鎵�鏈� - /// </summary> - /// <returns></returns> - public virtual List<T> GetList() - { - return CurrentDb.GetList(); - } - - /// <summary> - /// 娣诲姞 - /// </summary> - /// <param name="obj"></param> - /// <returns></returns> - public virtual bool Add(T obj) - { - return CurrentDb.Insert(obj); - } - - /// <summary> - /// 鏍规嵁涓婚敭鍒犻櫎 - /// </summary> - /// <param name="id"></param> - /// <returns></returns> - public virtual bool Delete(dynamic id) - { - return CurrentDb.Delete(id); - } - - /// <summary> - /// 鏇存柊 - /// </summary> - /// <param name="obj"></param> - /// <returns></returns> - public virtual bool Update(T obj) - { - return CurrentDb.Update(obj); - } -} \ No newline at end of file diff --git a/MES.Service/DB/OracleSQLHelper.cs b/MES.Service/DB/OracleSQLHelper.cs deleted file mode 100644 index b8cbc5b..0000000 --- a/MES.Service/DB/OracleSQLHelper.cs +++ /dev/null @@ -1,234 +0,0 @@ -锘縰sing System.Data; -using MES.Service.util; -using Oracle.ManagedDataAccess.Client; - -namespace MES.Service.DB; - -/// <summary> -/// 鐢ㄤ簬Oracle鏁版嵁搴撹闂殑甯姪绫� -/// </summary> -public class OracleSQLHelper -{ - private readonly string _connectionString; - - public readonly string ConnectionString = - AppsettingsUtility.Settings.DataBaseConn; - - //public static string connectionString = "Data Source = 192.168.1.19; Persist Security Info=True;User ID = abtdev; Password=abt_dev"; - public string connectionString = AppsettingsUtility.Settings.DataBaseConn; // 杩欓噷鏇挎崲鎴愪綘鐨勫疄闄呰繛鎺ュ瓧绗︿覆 - - public OracleSQLHelper() - { - _connectionString = connectionString; - } - - public OracleSQLHelper(string connectionString) - { - _connectionString = connectionString; - } - - public DataTable ExecuteQuery(string query) - { - using (var connection = new OracleConnection(_connectionString)) - { - using (var command = new OracleCommand(query, connection)) - { - connection.Open(); - var dataTable = new DataTable(); - using (var reader = command.ExecuteReader()) - { - dataTable.Load(reader); - } - - return dataTable; - } - } - } - - // 鎵ц闈炴煡璇㈡搷浣� 瀵规暟鎹簱杩涜 澧炪�佸垹銆佹敼 鎿嶄綔(1锛� - public int ExecuteNonQuery(string query) - { - using (var connection = new OracleConnection(_connectionString)) - { - using (var command = new OracleCommand(query, connection)) - { - connection.Open(); - return command.ExecuteNonQuery(); - } - } - } - - public int ExecuteNonQueryWithTransaction(OracleConnection connection, - OracleTransaction transaction, string query) - { - using (var command = connection.CreateCommand()) - { - command.Transaction = transaction; - command.CommandText = query; - return command.ExecuteNonQuery(); - } - } - - public int ExecuteTransaction(string query1) - { - using (var connection = new OracleConnection(_connectionString)) - { - connection.Open(); - - var transaction = connection.BeginTransaction(); - var totalRowsAffected = 0; - - try - { - totalRowsAffected = - ExecuteNonQueryWithTransaction(connection, transaction, - query1); - - transaction.Commit(); - } - catch (Exception ex) - { - transaction.Rollback(); - throw new Exception(ex.Message); - } - - return totalRowsAffected; - } - } - - - // 鎵ц鏌ヨ骞惰繑鍥炲崟涓�� - public object ExecuteScalar(string query) - { - using (var connection = new OracleConnection(_connectionString)) - { - using (var command = new OracleCommand(query, connection)) - { - connection.Open(); - return command.ExecuteScalar(); - } - } - } - - - // 鎵ц瀛樺偍杩囩▼ - //OracleParameter[] parameters = new OracleParameter[] - //{ - // new OracleParameter("param1", value1), - // new OracleParameter("param2", value2) - //}; - // sqlHelper.ExecuteStoredProcedure("瀛樺偍杩囩▼鍚嶇О", parameters); - public void ExecuteStoredProcedure(string procedureName, - OracleParameter[] parameters) - { - using (var connection = new OracleConnection(_connectionString)) - { - using (var command = - new OracleCommand(procedureName, connection)) - { - command.CommandType = CommandType.StoredProcedure; - command.Parameters.AddRange(parameters); - connection.Open(); - command.ExecuteNonQuery(); - } - } - } - - public DataTable ExecuteDataTable(string sql) - { - return ExecuteDataTable(sql, CommandType.Text, null); - } - - public DataTable ExecuteDataTable(string sql, CommandType commandType) - { - return ExecuteDataTable(sql, commandType, null); - } - - public DataTable ExecuteDataTable(string sql, CommandType commandType, - OracleParameter[] parameters) - { - var data = new DataTable(); - using (var connection = new OracleConnection(_connectionString)) - { - using (var command = new OracleCommand(sql, connection)) - { - command.CommandType = commandType; - if (parameters != null) - command.Parameters.AddRange(parameters); - - using (var adapter = new OracleDataAdapter(command)) - { - adapter.Fill(data); - } - } - } - - return data; - } - - - // public int ExecuteStoredProcedure(string procedureName, params OracleParameter[] parameters) - // { - // int result = 0; // 瀛樺偍杩囩▼杩斿洖鍊� - // - // // 鍒涘缓鏁版嵁搴撹繛鎺ュ璞″苟鎸囧畾杩炴帴瀛楃涓� - // using (OracleConnection connection = - // new OracleConnection(connectionString)) - // { - // // 鍒涘缓鍛戒护瀵硅薄骞舵寚瀹氳鎵ц鐨勫瓨鍌ㄨ繃绋嬪悕绉� - // using (OracleCommand command = - // new OracleCommand(procedureName, connection)) - // { - // command.CommandType = CommandType.StoredProcedure; - // - // // 娣诲姞瀛樺偍杩囩▼鍙傛暟 - // foreach (OracleParameter parameter in parameters) - // { - // command.Parameters.Add(parameter); - // } - // - // // 娣诲姞杈撳嚭鍙傛暟 - // OracleParameter outputParameter = - // new OracleParameter("C_Result", OracleDbType.Int32); - // outputParameter.Direction = ParameterDirection.Output; - // command.Parameters.Add(outputParameter); - // - // OracleParameter messageParameter = - // new OracleParameter("C_Msg", OracleDbType.Varchar2, - // 1000); - // messageParameter.Direction = ParameterDirection.Output; - // command.Parameters.Add(messageParameter); - // - // try - // { - // // 鎵撳紑鏁版嵁搴撹繛鎺ュ苟鎵ц瀛樺偍杩囩▼ - // connection.Open(); - // command.ExecuteNonQuery(); - // - // // 鑾峰彇杈撳嚭鍙傛暟鐨勫�� - // OracleDecimal oracleDecimalValue = - // (OracleDecimal)outputParameter.Value; - // decimal decimalValue = 0; - // - // if (oracleDecimalValue != OracleDecimal.Null) - // { - // decimalValue = oracleDecimalValue.Value; - // } - // - // result = Convert.ToInt32(decimalValue); - // string message = messageParameter.Value.ToString(); - // if (result == 1) - // { - // throw new Exception(message); - // } - // } - // catch (Exception ex) - // { - // // 澶勭悊寮傚父 - // throw new Exception(ex.Message); - // } - // } - // } - // return result; - // } -} \ No newline at end of file diff --git a/MES.Service/DB/Repository.cs b/MES.Service/DB/Repository.cs index 9906f8f..c9a8bba 100644 --- a/MES.Service/DB/Repository.cs +++ b/MES.Service/DB/Repository.cs @@ -7,7 +7,7 @@ { protected static SqlSugarScope Db = new(new ConnectionConfig { - DbType = DbType.Oracle, + DbType = DbType.SqlServer, ConnectionString = AppsettingsUtility.Settings.DataBaseConn, IsAutoCloseConnection = true }, @@ -16,7 +16,7 @@ db.Aop.OnLogExecuting = (sql, pars) => { Console.WriteLine( - UtilMethods.GetSqlString(DbType.Oracle, sql, pars)); + UtilMethods.GetSqlString(DbType.SqlServer, sql, pars)); }; }); @@ -40,63 +40,4 @@ throw; // 閲嶆柊鎶涘嚭寮傚父 } } - - public object CommonPage(QueryParameters pars, int pageIndex, int pagesize) - { - var tolCount = 0; - var sugarParamters = pars.Parameters.Select(it => - (IConditionalModel)new ConditionalModel - { - ConditionalType = it.ConditionalType, - FieldName = it.FieldName, - FieldValue = it.FieldValue - }).ToList(); - var query = Db.Queryable<T>(); - if (pars.OrderBys != null) - foreach (var item in pars.OrderBys) - query.OrderBy(item.ToSqlFilter()); - var result = query.Where(sugarParamters) - .ToPageList(pageIndex, pagesize, ref tolCount); - return new - { - count = tolCount, - data = result - }; - } - - public object CommonPage<ViewModel>(ISugarQueryable<ViewModel> query, - QueryParameters pars, int pageIndex, int pagesize) - { - var tolCount = 0; - var sugarParamters = pars.Parameters.Select(it => - (IConditionalModel)new ConditionalModel - { - ConditionalType = it.ConditionalType, - FieldName = it.FieldName, - FieldValue = it.FieldValue - }).ToList(); - if (pars.OrderBys != null) - foreach (var item in pars.OrderBys) - query.OrderBy(item.ToSqlFilter()); - var result = query.Where(sugarParamters) - .ToPageList(pageIndex, pagesize, ref tolCount); - return new - { - count = tolCount, - data = result - }; - } -} - -public class QueryParameters -{ - public List<QueryParameter> Parameters { get; set; } - public List<string> OrderBys { get; set; } -} - -public class QueryParameter -{ - public string FieldName { get; set; } - public string FieldValue { get; set; } - public ConditionalType ConditionalType { get; set; } } \ No newline at end of file diff --git a/MES.Service/DB/RepositoryNoEntity.cs b/MES.Service/DB/RepositoryNoEntity.cs index c2d5dc1..18b665d 100644 --- a/MES.Service/DB/RepositoryNoEntity.cs +++ b/MES.Service/DB/RepositoryNoEntity.cs @@ -7,7 +7,7 @@ { protected static SqlSugarScope Db = new(new ConnectionConfig { - DbType = DbType.Oracle, + DbType = DbType.SqlServer, ConnectionString = AppsettingsUtility.Settings.DataBaseConn, IsAutoCloseConnection = true }, @@ -16,7 +16,7 @@ db.Aop.OnLogExecuting = (sql, pars) => { Console.WriteLine( - UtilMethods.GetSqlString(DbType.Oracle, sql, pars)); + UtilMethods.GetSqlString(DbType.SqlServer, sql, pars)); }; }); diff --git a/MES.Service/DB/SqlSugarHelper.cs b/MES.Service/DB/SqlSugarHelper.cs deleted file mode 100644 index 4852aea..0000000 --- a/MES.Service/DB/SqlSugarHelper.cs +++ /dev/null @@ -1,49 +0,0 @@ -锘縰sing MES.Service.util; -using SqlSugar; - -namespace MES.Service.DB; - -public class SqlSugarHelper -{ - private static readonly string _connectionString = - AppsettingsUtility.Settings.DataBaseConn; // 杩欓噷鏇挎崲鎴愪綘鐨勫疄闄呰繛鎺ュ瓧绗︿覆 - - public static SqlSugarClient GetInstance() - { - var db = new SqlSugarClient(new ConnectionConfig - { - ConnectionString = _connectionString, - DbType = DbType.Oracle, - IsAutoCloseConnection = true, //寮�鍚嚜鍔ㄩ噴鏀炬ā寮忓拰EF鍘熺悊涓�鏍锋垜灏变笉澶氳В閲婁簡 - InitKeyType = InitKeyType.Attribute - }); - - - //璋冨紡浠g爜 鐢ㄦ潵鎵撳嵃SQL - db.Aop.OnLogExecuting = (sql, pars) => - { - Console.WriteLine( - UtilMethods.GetSqlString(DbType.Oracle, sql, pars)); - }; - return db; - } - - public static int UseTransactionWithOracle(Func<SqlSugarClient, int> action) - { - using (var db = GetInstance()) - { - try - { - db.Ado.BeginTran(); // 寮�濮嬩簨鍔� - var affectedRows = action.Invoke(db); // 鎵ц浼犲叆鐨勬搷浣滃苟鑾峰彇鍙楀奖鍝嶇殑琛屾暟 - db.Ado.CommitTran(); // 鎻愪氦浜嬪姟 - return affectedRows; // 杩斿洖鍙楀奖鍝嶇殑琛屾暟 - } - catch (Exception ex) - { - db.Ado.RollbackTran(); // 鍥炴粴浜嬪姟 - throw ex; - } - } - } -} \ No newline at end of file diff --git a/MES.Service/Dto/webApi/ErpCustomer.cs b/MES.Service/Dto/webApi/ErpCustomer.cs index 4f1c38c..56cc2e3 100644 --- a/MES.Service/Dto/webApi/ErpCustomer.cs +++ b/MES.Service/Dto/webApi/ErpCustomer.cs @@ -10,7 +10,7 @@ public string? FNumber { get; set; } public string? FShortName { get; set; } public string? FName { get; set; } - public string? Fcontact { get; set; } + public string? FTContact { get; set; } public string? Fmobilephone { get; set; } public string? Fseller { get; set; } public string? FForbidStatus { get; set; } diff --git a/MES.Service/Dto/webApi/ErpItems.cs b/MES.Service/Dto/webApi/ErpItems.cs index 08fdb69..dc669cc 100644 --- a/MES.Service/Dto/webApi/ErpItems.cs +++ b/MES.Service/Dto/webApi/ErpItems.cs @@ -3,21 +3,20 @@ public class ErpItems { public string Id { get; set; } - public string? Type { get; set; } public string? FNumber { get; set; } public string? FName { get; set; } public string? FSpecification { get; set; } public string? FBaseUnitId { get; set; } - public double? FSafeStock { get; set; } - public double? FMaxStock { get; set; } - public double? FMinPackCount { get; set; } + public string? FSafeStock { get; set; } + public string? FMaxStock { get; set; } + public string? FMinPackCount { get; set; } public string? FStockId { get; set; } - + public string? FTypeID { get; set; } public string? FMaterialGroup { get; set; } public string? FDescription { get; set; } - public decimal? FFinishReceiptOverRate { get; set; } + public string? FFinishReceiptOverRate { get; set; } public string? FIssueType { get; set; } - public int? FIsBatchManage { get; set; } + public string? FIsBatchManage { get; set; } public string? FPurchaserId { get; set; } public string? FPurchaseUnitId { get; set; } public string? FStoreUnitID { get; set; } @@ -25,13 +24,10 @@ public string? FForbidStatus { get; set; } public string? FErpClsID { get; set; } public string? FWorkShopId { get; set; } - public string? FPRODUCEUNITID { get; set; } public string? FSUBCONUNITID { get; set; } + + public string? Type { get; set; } public string? FCreateOrgId { get; set; } public string? FUseOrgId { get; set; } - public string? FLOSSPERCENT { get; set; } - public string? FMnemonicCode { get; set; } - public string? FExpPeriod { get; set; } - public string? FColor { get; set; } } \ No newline at end of file diff --git a/MES.Service/MES.Service.csproj b/MES.Service/MES.Service.csproj index 679c452..afa3980 100644 --- a/MES.Service/MES.Service.csproj +++ b/MES.Service/MES.Service.csproj @@ -8,13 +8,11 @@ <ItemGroup> <PackageReference Include="Masuit.Tools.Core" Version="2024.3.4"/> - <PackageReference Include="SqlSugarCore" Version="5.1.4.158"/> + <PackageReference Include="SqlSugarCore" Version="5.1.4.169"/> </ItemGroup> <ItemGroup> - <Folder Include="Dto\service\" /> - <Folder Include="Modes\" /> - <Folder Include="service\BasicData\" /> + <Folder Include="Dto\service\"/> </ItemGroup> </Project> diff --git a/MES.Service/Modes/MesCustomer.cs b/MES.Service/Modes/MesCustomer.cs new file mode 100644 index 0000000..d171993 --- /dev/null +++ b/MES.Service/Modes/MesCustomer.cs @@ -0,0 +1,201 @@ +锘縰sing SqlSugar; + +namespace MES.Service.Modes; + +/// <summary> +/// </summary> +[SugarTable("MES_CUSTOMER")] +public class MesCustomer +{ + /// <summary> + /// 榛樿鍊�: (newid()) + /// </summary> + [SugarColumn(ColumnName = "guid", IsPrimaryKey = true)] + public Guid Guid { get; set; } + + /// <summary> + /// ID + /// </summary> + [SugarColumn(ColumnName = "id")] + public decimal Id { get; set; } + + /// <summary> + /// 瀹㈡埛缂栫爜 + /// </summary> + [SugarColumn(ColumnName = "cust_no")] + public string? CustNo { get; set; } + + /// <summary> + /// 鍦板尯 + /// </summary> + [SugarColumn(ColumnName = "land")] + public string? Land { get; set; } + + /// <summary> + /// 瀹㈡埛鍚嶇О + /// </summary> + [SugarColumn(ColumnName = "cust_name")] + public string? CustName { get; set; } + + /// <summary> + /// 瀹㈡埛绠�绉� + /// </summary> + [SugarColumn(ColumnName = "cust_sname")] + public string? CustSname { get; set; } + + /// <summary> + /// 鍦板潃 + /// </summary> + [SugarColumn(ColumnName = "stras")] + public string? Stras { get; set; } + + /// <summary> + /// 鐢佃瘽 + /// </summary> + [SugarColumn(ColumnName = "telf1")] + public string? Telf1 { get; set; } + + /// <summary> + /// 浼犵湡 + /// </summary> + [SugarColumn(ColumnName = "telfx")] + public string? Telfx { get; set; } + + /// <summary> + /// 鑱旂郴浜� + /// </summary> + [SugarColumn(ColumnName = "anred")] + public string? Anred { get; set; } + + /// <summary> + /// 鍒涘缓鏃堕棿 + /// </summary> + [SugarColumn(ColumnName = "create_date")] + public DateTime? CreateDate { get; set; } + + /// <summary> + /// 鍒涘缓浜� + /// </summary> + [SugarColumn(ColumnName = "create_by")] + public string? CreateBy { get; set; } + + /// <summary> + /// 鏈�鍚庝慨鏀规椂闂� + /// </summary> + [SugarColumn(ColumnName = "lastupdate_date")] + public DateTime? LastupdateDate { get; set; } + + /// <summary> + /// 鏈�鍚庝慨鏀逛汉 + /// </summary> + [SugarColumn(ColumnName = "lastupdate_by")] + public string? LastupdateBy { get; set; } + + /// <summary> + /// 澶囨敞 + /// </summary> + [SugarColumn(ColumnName = "remark")] + public string? Remark { get; set; } + + /// <summary> + /// 鍏徃 + /// </summary> + [SugarColumn(ColumnName = "company")] + public string? Company { get; set; } + + /// <summary> + /// 鍒嗗巶缂栫爜 + /// </summary> + [SugarColumn(ColumnName = "factory")] + public string? Factory { get; set; } + + /// <summary> + /// 鐗╂枡鏄惁鍏辩(鏄紝鍚�) + /// 榛樿鍊�: ((0)) + /// </summary> + [SugarColumn(ColumnName = "item_c")] + public int? ItemC { get; set; } + + /// <summary> + /// 鐗╂枡鏄惁鍥炲啓SAP鎺ュ彛(鏄紝鍚�) + /// 榛樿鍊�: ((0)) + /// </summary> + [SugarColumn(ColumnName = "item_sap")] + public int? ItemSap { get; set; } + + /// <summary> + /// 鏄惁鎵规绠$悊(鏄紝鍚�) + /// 榛樿鍊�: ((0)) + /// </summary> + [SugarColumn(ColumnName = "lot_flag")] + public int? LotFlag { get; set; } + + /// <summary> + /// WMS鏄惁鍙戦�佹暟鎹細1宸插彂閫侊紝鍏朵粬鍧囨湭鍙戦�� + /// 榛樿鍊�: ((0)) + /// </summary> + [SugarColumn(ColumnName = "iscommit")] + public int? Iscommit { get; set; } + + /// <summary> + /// 绂佺敤鐘舵�� + /// </summary> + [SugarColumn(ColumnName = "fforbidstatus")] + public string? Fforbidstatus { get; set; } + + /// <summary> + /// 閿�鍞憳 + /// </summary> + [SugarColumn(ColumnName = "fseller")] + public string? Fseller { get; set; } + + /// <summary> + /// 鍒涘缓缁勭粐 + /// </summary> + [SugarColumn(ColumnName = "create_org")] + public int? CreateOrg { get; set; } + + /// <summary> + /// 浣跨敤缁勭粐 + /// </summary> + [SugarColumn(ColumnName = "use_org")] + public int? UseOrg { get; set; } + + /// <summary> + /// 鑷畾涔夊瓧娈�3 + /// </summary> + [SugarColumn(ColumnName = "remark3")] + public string? Remark3 { get; set; } + + /// <summary> + /// 鑷畾涔夊瓧娈�4 + /// </summary> + [SugarColumn(ColumnName = "remark4")] + public string? Remark4 { get; set; } + + /// <summary> + /// 鑷畾涔夊瓧娈�5 + /// </summary> + [SugarColumn(ColumnName = "remark5")] + public string? Remark5 { get; set; } + + /// <summary> + /// 鍒涘缓缁勭粐 + /// </summary> + [SugarColumn(ColumnName = "Fumbrella")] + public string? Fumbrella { get; set; } + + /// <summary> + /// 浣跨敤缁勭粐 + /// </summary> + [SugarColumn(ColumnName = "FSubsidiary")] + public string? FSubsidiary { get; set; } + + /// <summary> + /// 鍗曟嵁鐘舵�� + /// </summary> + [SugarColumn(ColumnName = "DATA_TYPE")] + public string? DataType { get; set; } + + [SugarColumn(IsIgnore = true)] public string? Type { get; set; } +} \ No newline at end of file diff --git a/MES.Service/Modes/MesDepots.cs b/MES.Service/Modes/MesDepots.cs new file mode 100644 index 0000000..fae92cb --- /dev/null +++ b/MES.Service/Modes/MesDepots.cs @@ -0,0 +1,108 @@ +锘縰sing SqlSugar; + +namespace MES.Service.Modes; + +/// <summary> +/// 浠撳簱淇℃伅 +/// </summary> +[SugarTable("MES_DEPOTS")] +public class MesDepots +{ + /// <summary> + /// ID(SEQ_INV_ID) + /// </summary> + [SugarColumn(ColumnName = "DEPOT_ID", IsPrimaryKey = true)] + public decimal DepotId { get; set; } + + /// <summary> + /// 浠撳簱绫诲埆缂栫爜 + /// </summary> + [SugarColumn(ColumnName = "DEPOT_CODE")] + public string? DepotCode { get; set; } + + /// <summary> + /// 浠撳簱绫诲埆鍚嶇О + /// </summary> + [SugarColumn(ColumnName = "DEPOT_NAME")] + public string? DepotName { get; set; } + + + /// <summary> + /// 浠撳簱璐熻矗浜� + /// </summary> + [SugarColumn(ColumnName = "CREATE_BY")] + public string? CreateBy { get; set; } + + /// <summary> + /// 鍒涘缓鏃堕棿 + /// </summary> + [SugarColumn(ColumnName = "CREATE_DATE")] + public DateTime? CreateDate { get; set; } + + /// <summary> + /// 鏈�鍚庢洿鏂颁汉 + /// </summary> + [SugarColumn(ColumnName = "LASTUPDATE_BY")] + public string? LastupdateBy { get; set; } + + /// <summary> + /// 鏈�鍚庢洿鏂版椂闂� + /// </summary> + [SugarColumn(ColumnName = "LASTUPDATE_DATE")] + public DateTime? LastupdateDate { get; set; } + + /// <summary> + /// 浠撳簱绫诲瀷 + /// </summary> + [SugarColumn(ColumnName = "DEPOTTYPE")] + public string? Depottype { get; set; } + + /// <summary> + /// 鍒嗗巶缂栫爜 + /// </summary> + [SugarColumn(ColumnName = "FACTORY")] + public string? Factory { get; set; } + + + /// <summary> + /// 鍏徃浠g爜 + /// </summary> + [SugarColumn(ColumnName = "COMPANY")] + public string? Company { get; set; } + + + /// <summary> + /// 鏄惁涓嶈壇鍝佷粨 + /// </summary> + [SugarColumn(ColumnName = "IS_NG")] + public string? IsNg { get; set; } + + + /// <summary> + /// 浠撲綅缁処D + /// </summary> + [SugarColumn(ColumnName = "ZUID")] + public string? Zuid { get; set; } + + /// <summary> + /// 鍏佽鍗虫椂搴撳瓨璐熷簱瀛� + /// </summary> + [SugarColumn(ColumnName = "IS_FKC")] + public string? IsFkc { get; set; } + + + /// <summary> + /// 浣跨敤绲勭箶 + /// </summary> + [SugarColumn(ColumnName = "FSubsidiary")] + public string? FSubsidiary { get; set; } + + /// <summary> + /// 鍓靛缓绲勭箶 + /// </summary> + [SugarColumn(ColumnName = "Fumbrella")] + public string? Fumbrella { get; set; } + + + [SugarColumn(IsIgnore = true)] public string? Type { get; set; } +} \ No newline at end of file diff --git a/MES.Service/Modes/MesItemType.cs b/MES.Service/Modes/MesItemType.cs new file mode 100644 index 0000000..36eafa7 --- /dev/null +++ b/MES.Service/Modes/MesItemType.cs @@ -0,0 +1,99 @@ +锘縰sing SqlSugar; + +namespace MES.Service.Modes; + +/// <summary> +/// 鐗╂枡绫诲瀷 +/// </summary> +[SugarTable("MES_ITEM_TYPE")] +public class MesItemType +{ + /// <summary> + /// </summary> + [SugarColumn(ColumnName = "guid", IsPrimaryKey = true)] + public Guid Guid { get; set; } + + /// <summary> + /// ID + /// </summary> + [SugarColumn(ColumnName = "id")] + public decimal Id { get; set; } + + /// <summary> + /// 绫诲瀷缂栫爜 + /// </summary> + [SugarColumn(ColumnName = "tcode")] + public string? Tcode { get; set; } + + /// <summary> + /// 绫诲瀷鍚嶇О + /// </summary> + [SugarColumn(ColumnName = "tname")] + public string? Tname { get; set; } + + /// <summary> + /// 澶囨敞 + /// </summary> + [SugarColumn(ColumnName = "remark")] + public string? Remark { get; set; } + + /// <summary> + /// 鍒涘缓浜� + /// </summary> + [SugarColumn(ColumnName = "create_by")] + public string? CreateBy { get; set; } + + /// <summary> + /// 鍒涘缓鏃堕棿 + /// </summary> + [SugarColumn(ColumnName = "create_date")] + public DateTime? CreateDate { get; set; } + + /// <summary> + /// 鏈�鍚庢洿鏂颁汉 + /// </summary> + [SugarColumn(ColumnName = "lastupdate_by")] + public string? LastupdateBy { get; set; } + + /// <summary> + /// 鏈�鍚庢洿鏂版椂闂� + /// </summary> + [SugarColumn(ColumnName = "lastupdate_date")] + public DateTime? LastupdateDate { get; set; } + + /// <summary> + /// </summary> + [SugarColumn(ColumnName = "company")] + public string? Company { get; set; } + + /// <summary> + /// </summary> + [SugarColumn(ColumnName = "factory")] + public string? Factory { get; set; } + + /// <summary> + /// IQC鍒嗙被 + /// </summary> + [SugarColumn(ColumnName = "iqc_type")] + public string? IqcType { get; set; } + + /// <summary> + /// IQC鍒嗙被鍚嶇О + /// </summary> + [SugarColumn(ColumnName = "iqc_type_name")] + public string? IqcTypeName { get; set; } + + /// <summary> + /// 涓婄骇鍒嗙粍 + /// </summary> + [SugarColumn(ColumnName = "pgroup")] + public string? Pgroup { get; set; } + + /// <summary> + /// 鎻忚堪 + /// </summary> + [SugarColumn(ColumnName = "description")] + public string? Description { get; set; } + + [SugarColumn(IsIgnore = true)] public string? Type { get; set; } +} \ No newline at end of file diff --git a/MES.Service/Modes/MesItems.cs b/MES.Service/Modes/MesItems.cs new file mode 100644 index 0000000..2d4b248 --- /dev/null +++ b/MES.Service/Modes/MesItems.cs @@ -0,0 +1,336 @@ +锘縰sing SqlSugar; + +namespace MES.Service.Modes; + +/// <summary> +/// 鐗╂枡淇℃伅 +/// </summary> +[SugarTable("MES_ITEMS")] +public class MesItems +{ + /// <summary> + /// </summary> + [SugarColumn(ColumnName = "guid", IsPrimaryKey = true)] + public Guid Guid { get; set; } + + /// <summary> + /// 鐗╂枡ID + /// </summary> + [SugarColumn(ColumnName = "id")] + public decimal Id { get; set; } + + /// <summary> + /// 宸ュ巶 + /// </summary> + [SugarColumn(ColumnName = "factory")] + public string? Factory { get; set; } + + /// <summary> + /// 鍏徃缂栧彿 + /// </summary> + [SugarColumn(ColumnName = "company")] + public string? Company { get; set; } + + /// <summary> + /// 鐗╂枡缂栫爜 = ERP鐗╂枡缂栧彿||棰滆壊缂栧彿 + /// </summary> + [SugarColumn(ColumnName = "item_no")] + public string? ItemNo { get; set; } + + /// <summary> + /// 鐗╂枡鍚嶇О + /// </summary> + [SugarColumn(ColumnName = "item_name")] + public string? ItemName { get; set; } + + /// <summary> + /// 鐗╂枡绠�绉� + /// </summary> + [SugarColumn(ColumnName = "item_sname")] + public string? ItemSname { get; set; } + + /// <summary> + /// 瑙勬牸鍨嬪彿 + /// </summary> + [SugarColumn(ColumnName = "item_model")] + public string? ItemModel { get; set; } + + /// <summary> + /// 鐗╂枡鎻忚堪 + /// </summary> + [SugarColumn(ColumnName = "item_description")] + public string? ItemDescription { get; set; } + + /// <summary> + /// 鐗╂枡鍗曚綅 + /// </summary> + [SugarColumn(ColumnName = "item_unit")] + public string? ItemUnit { get; set; } + + /// <summary> + /// 鐗╂枡绫诲瀷 + /// </summary> + [SugarColumn(ColumnName = "item_type")] + public string? ItemType { get; set; } + + /// <summary> + /// 浜у搧鐗堟湰 + /// </summary> + [SugarColumn(ColumnName = "item_version")] + public string? ItemVersion { get; set; } + + /// <summary> + /// 瀹㈡埛缂栧彿 + /// </summary> + [SugarColumn(ColumnName = "cust_no")] + public string? CustNo { get; set; } + + /// <summary> + /// 鍒涘缓浜� + /// </summary> + [SugarColumn(ColumnName = "create_by")] + public string? CreateBy { get; set; } + + /// <summary> + /// 鍒涘缓鏃堕棿 + /// </summary> + [SugarColumn(ColumnName = "create_date")] + public DateTime? CreateDate { get; set; } + + /// <summary> + /// 鏈�鍚庢洿鏂颁汉 + /// </summary> + [SugarColumn(ColumnName = "lastupdate_by")] + public string? LastupdateBy { get; set; } + + /// <summary> + /// 鏈�鍚庢洿鏂版椂闂� + /// </summary> + [SugarColumn(ColumnName = "lastupdate_date")] + public DateTime? LastupdateDate { get; set; } + + /// <summary> + /// 鏈�浣庡簱瀛� + /// </summary> + [SugarColumn(ColumnName = "lowlimit")] + public double? Lowlimit { get; set; } + + /// <summary> + /// 鏈�澶у簱瀛� + /// </summary> + [SugarColumn(ColumnName = "highlimit")] + public double? Highlimit { get; set; } + + /// <summary> + /// 鏈�灏忓寘瑁呮暟 + /// </summary> + [SugarColumn(ColumnName = "prd_pack")] + public double? PrdPack { get; set; } + + /// <summary> + /// 璁㈠崟鍗曚綅 + /// </summary> + [SugarColumn(ColumnName = "orderunit")] + public string? Orderunit { get; set; } + + /// <summary> + /// 閿�鍞崟浣� + /// </summary> + [SugarColumn(ColumnName = "saleunit")] + public string? Saleunit { get; set; } + + /// <summary> + /// 搴撴埧鍗曚綅 + /// </summary> + [SugarColumn(ColumnName = "storeunit")] + public string? Storeunit { get; set; } + + /// <summary> + /// 鐗╂枡ID + /// </summary> + [SugarColumn(ColumnName = "e_item_id")] + public long? EItemId { get; set; } + + /// <summary> + /// ERP鏂欏彿 + /// </summary> + [SugarColumn(ColumnName = "erp_item_no")] + public string? ErpItemNo { get; set; } + + /// <summary> + /// 榛樿浠撳簱 + /// </summary> + [SugarColumn(ColumnName = "depot_code")] + public string? DepotCode { get; set; } + + /// <summary> + /// 鐗╂枡鍒嗙被缂栧彿 + /// </summary> + [SugarColumn(ColumnName = "ppbom00019124")] + public string? Ppbom00019124 { get; set; } + + /// <summary> + /// 鐗╂枡鍒嗙粍 + /// </summary> + [SugarColumn(ColumnName = "remarks")] + public string? Remarks { get; set; } + + /// <summary> + /// 閲囪喘鍛� + /// </summary> + [SugarColumn(ColumnName = "fpurchaserid")] + public string? Fpurchaserid { get; set; } + + /// <summary> + /// 绂佺敤鐘舵�� + /// </summary> + [SugarColumn(ColumnName = "fforbidstatus")] + public string? Fforbidstatus { get; set; } + + /// <summary> + /// 鐗╂枡鍒嗙粍 + /// </summary> + [SugarColumn(ColumnName = "fmaterialgroup")] + public string? Fmaterialgroup { get; set; } + + /// <summary> + /// 瀹屽伐瓒呮敹姣斾緥 + /// </summary> + [SugarColumn(ColumnName = "ffinishreceiptoverrate")] + public decimal? Ffinishreceiptoverrate { get; set; } + + /// <summary> + /// 鍙戞枡鏂瑰紡 + /// </summary> + [SugarColumn(ColumnName = "fissuetype")] + public string? Fissuetype { get; set; } + + /// <summary> + /// 鍚敤鎵瑰彿绠$悊 + /// </summary> + [SugarColumn(ColumnName = "fisbatchmanage")] + public int? Fisbatchmanage { get; set; } + + /// <summary> + /// 閲囪喘鍗曚綅 + /// </summary> + [SugarColumn(ColumnName = "fpurchaseunitid")] + public decimal Fpurchaseunitid { get; set; } + + /// <summary> + /// 鍒涘缓缁勭粐 + /// </summary> + [SugarColumn(ColumnName = "create_org")] + public int? CreateOrg { get; set; } + + /// <summary> + /// 浣跨敤缁勭粐 + /// </summary> + [SugarColumn(ColumnName = "use_org")] + public int? UseOrg { get; set; } + + /// <summary> + /// 鎹熻�楃巼 + /// </summary> + [SugarColumn(ColumnName = "loss_percent")] + public string? LossPercent { get; set; } + + /// <summary> + /// 鍔╄鐮� + /// </summary> + [SugarColumn(ColumnName = "mnemonic_code")] + public string? MnemonicCode { get; set; } + + /// <summary> + /// 淇濊川鏈� + /// </summary> + [SugarColumn(ColumnName = "exp_period")] + public string? ExpPeriod { get; set; } + + /// <summary> + /// 鐢熶骇杞﹂棿 + /// </summary> + [SugarColumn(ColumnName = "production_workshop")] + public string? ProductionWorkshop { get; set; } + + /// <summary> + /// 鐗╂枡灞炴�� + /// </summary> + [SugarColumn(ColumnName = "material_properti")] + public string? MaterialProperti { get; set; } + + /// <summary> + /// 鐢熶骇鍗曚綅 + /// </summary> + [SugarColumn(ColumnName = "produce_unit")] + public string? ProduceUnit { get; set; } + + /// <summary> + /// 濮斿鍗曚綅 + /// </summary> + [SugarColumn(ColumnName = "subcon_unit")] + public string? SubconUnit { get; set; } + + /// <summary> + /// 鍥剧墖1 + /// </summary> + [SugarColumn(ColumnName = "bz06")] + public string? Bz06 { get; set; } + + /// <summary> + /// 鍥剧墖2 + /// </summary> + [SugarColumn(ColumnName = "bz07")] + public string? Bz07 { get; set; } + + /// <summary> + /// 鍥剧墖3 + /// </summary> + [SugarColumn(ColumnName = "bz08")] + public string? Bz08 { get; set; } + + /// <summary> + /// 鍥剧墖4 + /// </summary> + [SugarColumn(ColumnName = "bz09")] + public string? Bz09 { get; set; } + + /// <summary> + /// 鍥剧墖5 + /// </summary> + [SugarColumn(ColumnName = "bz10")] + public string? Bz10 { get; set; } + + /// <summary> + /// QC鍒嗙粍ID + /// </summary> + [SugarColumn(ColumnName = "qc_teamid")] + public string? QcTeamid { get; set; } + + /// <summary> + /// 鐗╂枡ID + /// </summary> + [SugarColumn(ColumnName = "item_id")] + public int? ItemId { get; set; } + + /// <summary> + /// 棰滆壊 + /// </summary> + [SugarColumn(ColumnName = "color_name")] + public string? ColorName { get; set; } + + /// <summary> + /// 浣跨敤绲勭箶 + /// </summary> + [SugarColumn(ColumnName = "FSubsidiary")] + public string? FSubsidiary { get; set; } + + /// <summary> + /// 鍓靛缓绲勭箶 + /// </summary> + [SugarColumn(ColumnName = "Fumbrella")] + public string? Fumbrella { get; set; } + + + [SugarColumn(IsIgnore = true)] public string? Type { get; set; } +} \ No newline at end of file diff --git a/MES.Service/Modes/MesPosition.cs b/MES.Service/Modes/MesPosition.cs new file mode 100644 index 0000000..5086bb0 --- /dev/null +++ b/MES.Service/Modes/MesPosition.cs @@ -0,0 +1,77 @@ +锘縰sing SqlSugar; + +namespace MES.Service.Modes; + +/// <summary> +/// 宀椾綅淇℃伅 +/// </summary> +[SugarTable("MES_POSITION")] +public class MesPosition +{ + /// <summary> + /// </summary> + [SugarColumn(ColumnName = "ID", IsPrimaryKey = true)] + public decimal Id { get; set; } + + /// <summary> + /// 宀椾綅缂栧彿 + /// </summary> + [SugarColumn(ColumnName = "POSITION_ID")] + public string? PositionId { get; set; } + + /// <summary> + /// 宀椾綅鍚嶇О + /// </summary> + [SugarColumn(ColumnName = "POSITION_NAME")] + public string? PositionName { get; set; } + + /// <summary> + /// 宀椾綅鎻忚堪 + /// </summary> + [SugarColumn(ColumnName = "POSITION_DESCRIPTION")] + public string? PositionDescription { get; set; } + + /// <summary> + /// 鎵�灞為儴闂� + /// </summary> + [SugarColumn(ColumnName = "DEPARTMENT")] + public string? Department { get; set; } + + /// <summary> + /// 寤虹珛鏃ユ湡 + /// </summary> + [SugarColumn(ColumnName = "CREATION_DATE")] + public DateTime? CreationDate { get; set; } + + /// <summary> + /// 绂佺敤浜� + /// </summary> + [SugarColumn(ColumnName = "DISABLED_BY")] + public string? DisabledBy { get; set; } + + /// <summary> + /// 绂佺敤鏃ユ湡 + /// </summary> + [SugarColumn(ColumnName = "DISABLED_DATE")] + public DateTime? DisabledDate { get; set; } + + /// <summary> + /// 绂佺敤鐘舵�� A 鍚敤 B绂佺敤 + /// </summary> + [SugarColumn(ColumnName = "FFORBIDSTATUS")] + public string? Fforbidstatus { get; set; } + + /// <summary> + /// 浣跨敤绲勭箶 + /// </summary> + [SugarColumn(ColumnName = "FSUBSIDIARY")] + public string? FUseOrgId { get; set; } + + /// <summary> + /// 鍓靛缓绲勭箶 + /// </summary> + [SugarColumn(ColumnName = "FUMBRELLA")] + public string? FCreateOrgId { get; set; } + + [SugarColumn(IsIgnore = true)] public string? Type { get; set; } +} \ No newline at end of file diff --git a/MES.Service/Modes/MesRohIn.cs b/MES.Service/Modes/MesRohIn.cs new file mode 100644 index 0000000..20615ec --- /dev/null +++ b/MES.Service/Modes/MesRohIn.cs @@ -0,0 +1,190 @@ +锘縰sing SqlSugar; + +namespace MES.Service.Modes; + +/// <summary> +/// 閲囪喘璁㈠崟琛� +/// </summary> +[SugarTable("MES_ROH_IN")] +public class MesRohIn +{ + /// <summary> + /// SEQ_BASEINFO_ID + /// </summary> + [SugarColumn(ColumnName = "ID", OracleSequenceName = "SEQ_BASEINFO_ID", + IsPrimaryKey = true)] + public decimal Id { get; set; } + + /// <summary> + /// 閲囪喘鍗曞彿 + /// </summary> + [SugarColumn(ColumnName = "BILL_NO")] + public string? BillNo { get; set; } + + /// <summary> + /// 鍗曟嵁鐘舵�� + /// </summary> + [SugarColumn(ColumnName = "DOCUMENT_STATUS")] + public string? DocumentStatus { get; set; } + + /// <summary> + /// 鍗曟嵁绫诲瀷 + /// </summary> + [SugarColumn(ColumnName = "DOCUMENT_TYPE")] + public string? DocumentType { get; set; } + + /// <summary> + /// 涓氬姟绫诲瀷 + /// </summary> + [SugarColumn(ColumnName = "BUSINESS_TYPE")] + public string? BusinessType { get; set; } + + /// <summary> + /// 閲囪喘鏃ユ湡 + /// </summary> + [SugarColumn(ColumnName = "PURCHASE_DATE")] + public DateTime? PurchaseDate { get; set; } + + /// <summary> + /// 渚涘簲鍟� + /// </summary> + [SugarColumn(ColumnName = "SUPPLIER")] + public string? Supplier { get; set; } + + /// <summary> + /// 鍏抽棴鐘舵�� + /// </summary> + [SugarColumn(ColumnName = "CLOSE_STATUS")] + public string? CloseStatus { get; set; } + + /// <summary> + /// 閲囪喘缁勭粐 + /// </summary> + [SugarColumn(ColumnName = "PURCHASE_ORG")] + public string? PurchaseOrg { get; set; } + + /// <summary> + /// 閲囪喘閮ㄩ棬 + /// </summary> + [SugarColumn(ColumnName = "PURCHASE_DEPT")] + public string? PurchaseDept { get; set; } + + /// <summary> + /// 閲囪喘缁� + /// </summary> + [SugarColumn(ColumnName = "PURCHASE_GROUP")] + public string? PurchaseGroup { get; set; } + + /// <summary> + /// 鏁伴噺楠屾敹 + /// </summary> + [SugarColumn(ColumnName = "QTY_ACCEPTANCE")] + public string? QtyAcceptance { get; set; } + + /// <summary> + /// 閲囪喘鍛� + /// </summary> + [SugarColumn(ColumnName = "PURCHASER")] + public string? Purchaser { get; set; } + + + /// <summary> + /// 缁撶畻鏂� + /// </summary> + [SugarColumn(ColumnName = "SETTLEMENT_PARTY")] + public string? SettlementParty { get; set; } + + /// <summary> + /// 鏀舵鏂� + /// </summary> + [SugarColumn(ColumnName = "PAYMENT_PARTY")] + public string? PaymentParty { get; set; } + + + /// <summary> + /// 澶囨敞 + /// </summary> + [SugarColumn(ColumnName = "REMARKS")] + public string? Remarks { get; set; } + + + /// <summary> + /// 浣滃簾鐘舵�� + /// </summary> + [SugarColumn(ColumnName = "CANCELLATION_STATUS")] + public string? CancellationStatus { get; set; } + + /// <summary> + /// 浣滃簾浜� + /// </summary> + [SugarColumn(ColumnName = "CANCELLATION_PERSON")] + public string? CancellationPerson { get; set; } + + /// <summary> + /// 浣滃簾鏃ユ湡 + /// </summary> + [SugarColumn(ColumnName = "CANCELLATION_DATE")] + public DateTime? CancellationDate { get; set; } + + /// <summary> + /// </summary> + [SugarColumn(ColumnName = "CREATE_BY")] + public string? CreateBy { get; set; } + + /// <summary> + /// </summary> + [SugarColumn(ColumnName = "CREATE_DATE")] + public DateTime? CreateDate { get; set; } + + /// <summary> + /// </summary> + [SugarColumn(ColumnName = "LASTUPDATE_DATE")] + public DateTime? LastupdateDate { get; set; } + + /// <summary> + /// </summary> + [SugarColumn(ColumnName = "LASTUPDATE_BY")] + public string? LastupdateBy { get; set; } + + /// <summary> + /// ERP瀹℃牳浜� + /// </summary> + [SugarColumn(ColumnName = "ERP_CHECK_BY")] + public string? ErpCheckBy { get; set; } + + /// <summary> + /// ERP瀹℃牳鏃ユ湡 + /// </summary> + [SugarColumn(ColumnName = "ERP_CHECK_DATE")] + public string? ErpCheckDate { get; set; } + + /// <summary> + /// ERP鐨処D鍙� + /// </summary> + [SugarColumn(ColumnName = "EBELN_K3ID")] + public decimal? EbelnK3id { get; set; } + + /// <summary> + /// 鍙樻洿鍘熷洜 + /// </summary> + [SugarColumn(ColumnName = "changereason")] + public string? Changereason { get; set; } + + /// <summary> + /// 鍒拌揣鏃ユ湡 + /// </summary> + [SugarColumn(ColumnName = "FPREARRIVALDATE")] + public DateTime? FPREARRIVALDATE { get; set; } + + /// <summary> + /// 鏀舵枡缁勭粐 + /// </summary> + [SugarColumn(ColumnName = "FRECEIVEORGID")] + public string? FRECEIVEORGID { get; set; } + + /// <summary> + /// 鎵撳嵃娆℃暟 + /// </summary> + [SugarColumn(ColumnName = "remark1")] + public string? remark1 { get; set; } +} \ No newline at end of file diff --git a/MES.Service/Modes/MesRohInData.cs b/MES.Service/Modes/MesRohInData.cs new file mode 100644 index 0000000..61ae226 --- /dev/null +++ b/MES.Service/Modes/MesRohInData.cs @@ -0,0 +1,361 @@ +锘縰sing SqlSugar; + +namespace MES.Service.Modes; + +/// <summary> +/// 閲囪喘璁㈠崟鏄庣粏琛� +/// </summary> +[SugarTable("MES_ROH_IN_DATA")] +public class MesRohInData +{ + /// <summary> + /// 閲囪喘鍗曞彿 + /// </summary> + [SugarColumn(ColumnName = "BILL_NO")] + public string? BillNo { get; set; } + + /// <summary> + /// 閿�鍞鍗曞彿 + /// </summary> + [SugarColumn(ColumnName = "SALES_ORDER_ID")] + public string? SalesOrderId { get; set; } + + /// <summary> + /// 閲囪喘璁㈠崟琛屽彿 + /// </summary> + [SugarColumn(ColumnName = "ORDER_LINE_ID")] + public string? OrderLineId { get; set; } + + /// <summary> + /// 鐗╂枡缂栫爜 + /// </summary> + [SugarColumn(ColumnName = "ITEM_ID")] + public string? ItemId { get; set; } + + + /// <summary> + /// 閲囪喘鍗曚綅 + /// </summary> + [SugarColumn(ColumnName = "PURCHASE_UNIT")] + public string? PurchaseUnit { get; set; } + + /// <summary> + /// 閲囪喘鏁伴噺 + /// </summary> + [SugarColumn(ColumnName = "PURCHASE_QTY")] + public decimal? PurchaseQty { get; set; } + + /// <summary> + /// 搴撳瓨鍗曚綅 + /// </summary> + [SugarColumn(ColumnName = "INVENTORY_UNIT")] + public string? InventoryUnit { get; set; } + + + /// <summary> + /// 浜よ揣鏃ユ湡 + /// </summary> + [SugarColumn(ColumnName = "DELIVERY_DATE")] + public DateTime? DeliveryDate { get; set; } + + /// <summary> + /// 鏈�鏃╀氦璐ф棩鏈� + /// </summary> + [SugarColumn(ColumnName = "EARLIEST_DELIVERY_DATE")] + public DateTime? EarliestDeliveryDate { get; set; } + + /// <summary> + /// 鏈�鏅氫氦璐ф棩鏈� + /// </summary> + [SugarColumn(ColumnName = "LATEST_DELIVERY_DATE")] + public DateTime? LatestDeliveryDate { get; set; } + + /// <summary> + /// 闇�姹傜粍缁� + /// </summary> + [SugarColumn(ColumnName = "DEMAND_ORG")] + public string? DemandOrg { get; set; } + + /// <summary> + /// 鏀舵枡缁勭粐 + /// </summary> + [SugarColumn(ColumnName = "RECEIVING_ORG")] + public string? ReceivingOrg { get; set; } + + /// <summary> + /// 缁撶畻缁勭粐 + /// </summary> + [SugarColumn(ColumnName = "SETTLEMENT_ORG")] + public string? SettlementOrg { get; set; } + + /// <summary> + /// 鏄惁璧犲搧 + /// </summary> + [SugarColumn(ColumnName = "IS_GIFT")] + public string? IsGift { get; set; } + + /// <summary> + /// 澶囨敞 + /// </summary> + [SugarColumn(ColumnName = "REMARKS")] + public string? Remarks { get; set; } + + /// <summary> + /// 渚涘簲鍟嗙墿鏂欑紪鐮� + /// </summary> + [SugarColumn(ColumnName = "SUPPLIER_ITEM_CODE")] + public string? SupplierItemCode { get; set; } + + /// <summary> + /// 渚涘簲鍟嗙墿鏂欏悕绉� + /// </summary> + [SugarColumn(ColumnName = "SUPPLIER_ITEM_NAME")] + public string? SupplierItemName { get; set; } + + /// <summary> + /// 濮斿璁㈠崟缂栧彿 + /// </summary> + [SugarColumn(ColumnName = "OUTSOURCING_ORDER_ID")] + public string? OutsourcingOrderId { get; set; } + + /// <summary> + /// 鎵瑰彿 + /// </summary> + [SugarColumn(ColumnName = "BATCH_NUMBER")] + public string? BatchNumber { get; set; } + + /// <summary> + /// 涓氬姟鍏抽棴 A:姝e父锛孊:涓氬姟缁堟 + /// </summary> + [SugarColumn(ColumnName = "BUSINESS_CLOSE")] + public string? BusinessClose { get; set; } + + /// <summary> + /// 涓氬姟鍐荤粨 A:姝e父锛孊:涓氬姟缁堟 + /// </summary> + [SugarColumn(ColumnName = "BUSINESS_FREEZE")] + public string? BusinessFreeze { get; set; } + + /// <summary> + /// 鍐荤粨浜� + /// </summary> + [SugarColumn(ColumnName = "FREEZER")] + public string? Freezer { get; set; } + + /// <summary> + /// 鍐荤粨鏃堕棿 + /// </summary> + [SugarColumn(ColumnName = "FREEZE_TIME")] + public DateTime? FreezeTime { get; set; } + + /// <summary> + /// 涓氬姟缁堟 + /// </summary> + [SugarColumn(ColumnName = "BUSINESS_TERMINATE")] + public string? BusinessTerminate { get; set; } + + /// <summary> + /// 缁堟浜� + /// </summary> + [SugarColumn(ColumnName = "TERMINATOR")] + public string? Terminator { get; set; } + + /// <summary> + /// 缁堟鏃堕棿 + /// </summary> + [SugarColumn(ColumnName = "TERMINATE_TIME")] + public DateTime? TerminateTime { get; set; } + + /// <summary> + /// 绱鏀舵枡鏁伴噺 + /// </summary> + [SugarColumn(ColumnName = "TOTAL_RECEIVED_QTY")] + public decimal? TotalReceivedQty { get; set; } + + /// <summary> + /// 鍓╀綑鏀舵枡鏁伴噺 + /// </summary> + [SugarColumn(ColumnName = "REMAINING_RECEIVED_QTY")] + public decimal? RemainingReceivedQty { get; set; } + + /// <summary> + /// 绱鍏ュ簱鏁伴噺 + /// </summary> + [SugarColumn(ColumnName = "TOTAL_STORED_QTY")] + public decimal? TotalStoredQty { get; set; } + + /// <summary> + /// 鍓╀綑鍏ュ簱鏁伴噺 + /// </summary> + [SugarColumn(ColumnName = "REMAINING_STORED_QTY")] + public decimal? RemainingStoredQty { get; set; } + + /// <summary> + /// 绱閫�鏂欐暟閲� + /// </summary> + [SugarColumn(ColumnName = "TOTAL_RETURNED_QTY")] + public decimal? TotalReturnedQty { get; set; } + + /// <summary> + /// 鏀舵枡鍙��鏁伴噺 + /// </summary> + [SugarColumn(ColumnName = "RETURNABLE_RECEIVED_QTY")] + public decimal? ReturnableReceivedQty { get; set; } + + /// <summary> + /// 搴撳瓨鍙��鏁伴噺 + /// </summary> + [SugarColumn(ColumnName = "RETURNABLE_STORED_QTY")] + public decimal? ReturnableStoredQty { get; set; } + + /// <summary> + /// 婧愬崟绫诲瀷 + /// </summary> + [SugarColumn(ColumnName = "SOURCE_DOCUMENT_TYPE")] + public string? SourceDocumentType { get; set; } + + /// <summary> + /// 婧愬崟鍗曞彿 + /// </summary> + [SugarColumn(ColumnName = "SOURCE_DOCUMENT_ID")] + public string? SourceDocumentId { get; set; } + + /// <summary> + /// 闇�姹傝窡韪彿 + /// </summary> + [SugarColumn(ColumnName = "DEMAND_TRACKING_ID")] + public string? DemandTrackingId { get; set; } + + /// <summary> + /// 璁″垝璺熻釜鍙� + /// </summary> + [SugarColumn(ColumnName = "PLAN_TRACKING_ID")] + public string? PlanTrackingId { get; set; } + + /// <summary> + /// 鍙樻洿鏍囧織 + /// </summary> + [SugarColumn(ColumnName = "CHANGE_FLAG")] + public string? ChangeFlag { get; set; } + + /// <summary> + /// 闇�姹傛潵婧� + /// </summary> + [SugarColumn(ColumnName = "DEMAND_SOURCE")] + public string? DemandSource { get; set; } + + /// <summary> + /// 闇�姹傚崟鎹紪鍙� + /// </summary> + [SugarColumn(ColumnName = "DEMAND_DOCUMENT_ID")] + public string? DemandDocumentId { get; set; } + + /// <summary> + /// 闇�姹傚崟鎹鍙� + /// </summary> + [SugarColumn(ColumnName = "DEMAND_DOCUMENT_LINE_ID")] + public string? DemandDocumentLineId { get; set; } + + /// <summary> + /// ERP鐨処D鍙� + /// </summary> + [SugarColumn(ColumnName = "EBELN_K3ID")] + public decimal? EbelnK3id { get; set; } + + /// <summary> + /// SEQ_BASEINFO_ID + /// </summary> + [SugarColumn(ColumnName = "ID", OracleSequenceName = "SEQ_BASEINFO_ID", + IsPrimaryKey = true)] + public decimal Id { get; set; } + + /// <summary> + /// ERP澶碔D + /// </summary> + [SugarColumn(ColumnName = "ERP_ID")] + public decimal? ErpId { get; set; } + + /// <summary> + /// 閲囪喘璁㈠崟琛屽彿 + /// </summary> + [SugarColumn(ColumnName = "purchase_order_line_number")] + public string? PurchaseOrderLineNumber { get; set; } + + /// <summary> + /// 闇�姹傜粍缁� + /// </summary> + [SugarColumn(ColumnName = "DEMAND")] + public string? Demand { get; set; } + + /// <summary> + /// 鏀舵枡缁勭粐 + /// </summary> + [SugarColumn(ColumnName = "RECEIVING")] + public string? Receiving { get; set; } + + /// <summary> + /// 缁撶畻缁勭粐 + /// </summary> + [SugarColumn(ColumnName = "SETTLEMENT")] + public string? Settlement { get; set; } + + /// <summary> + /// 闇�姹傞儴闂� + /// </summary> + [SugarColumn(ColumnName = "DEMAND_DEPARTMENT")] + public string? DemandDepartment { get; set; } + + /// <summary> + /// 鏀舵枡閮ㄩ棬 + /// </summary> + [SugarColumn(ColumnName = "RECEIVING_DEPARTMENT")] + public string? ReceivingDepartment { get; set; } + + /// <summary> + /// 棰勮鍒拌揣鏃堕棿 + /// </summary> + [SugarColumn(ColumnName = "FPREARRIVALDATE")] + public DateTime? FPREARRIVALDATE { get; set; } + + /// <summary> + /// 瀹㈡埛璐у彿 + /// </summary> + [SugarColumn(ColumnName = "REMARK1")] + public string? Remark1 { get; set; } + + /// <summary> + /// 鍖呰鍗曞彿 + /// </summary> + [SugarColumn(ColumnName = "REMARK2")] + public string? Remark2 { get; set; } + + /// <summary> + /// 涓讳骇鍝� + /// </summary> + [SugarColumn(ColumnName = "REMARK3")] + public string? Remark3 { get; set; } + + /// <summary> + /// SMT澶囨敞 + /// </summary> + [SugarColumn(ColumnName = "REMARK4")] + public string? Remark4 { get; set; } + + /// <summary> + /// 閿�鍞鍗曡鍙� + /// </summary> + [SugarColumn(ColumnName = "FDEMANDBILLNO_LINE")] + public string? FdemandbillnoLine { get; set; } + + /// <summary> + /// 鐢垫皵鎴愬搧鍨嬪彿 + /// </summary> + [SugarColumn(ColumnName = "ELECTRICAL_PRODUCT_MODEL")] + public string? ElectricalProductModel { get; set; } + + /// <summary> + /// 鐢垫皵鎴愬搧鍚嶇О + /// </summary> + [SugarColumn(ColumnName = "ELECTRICAL_PRODUCT_NAME")] + public string? ElectricalProductName { get; set; } +} \ No newline at end of file diff --git a/MES.Service/Modes/MesStaff.cs b/MES.Service/Modes/MesStaff.cs new file mode 100644 index 0000000..4de05cc --- /dev/null +++ b/MES.Service/Modes/MesStaff.cs @@ -0,0 +1,162 @@ +锘縰sing SqlSugar; + +namespace MES.Service.Modes; + +/// <summary> +/// 鍛樺伐淇℃伅琛� +/// </summary> +[SugarTable("MES_STAFF")] +public class MesStaff +{ + /// <summary> + /// ID + /// </summary> + [SugarColumn(ColumnName = "ID", IsPrimaryKey = true)] + public decimal Id { get; set; } + + /// <summary> + /// 鍛樺伐缂栫爜 + /// </summary> + [SugarColumn(ColumnName = "STAFF_NO")] + public string StaffNo { get; set; } + + /// <summary> + /// 鍛樺伐濮撳悕 + /// </summary> + [SugarColumn(ColumnName = "STAFF_NAME")] + public string StaffName { get; set; } + + /// <summary> + /// 閮ㄩ棬缂栫爜 + /// </summary> + [SugarColumn(ColumnName = "DEPARTMENT_NO")] + public string DepartmentNo { get; set; } + + /// <summary> + /// 閮ㄩ棬鍚嶇О + /// </summary> + [SugarColumn(ColumnName = "DEPARTMENT_NAME")] + public string DepartmentName { get; set; } + + /// <summary> + /// 宀椾綅缂栫爜 + /// </summary> + [SugarColumn(ColumnName = "POSITION_CODE")] + public string PositionCode { get; set; } + + /// <summary> + /// 宀椾綅鍚嶇О + /// </summary> + [SugarColumn(ColumnName = "POSITION_NAME")] + public string PositionName { get; set; } + + /// <summary> + /// 鎵嬫満鍙� + /// </summary> + [SugarColumn(ColumnName = "PHONE_NUMBER")] + public string PhoneNumber { get; set; } + + /// <summary> + /// 浠诲矖寮�濮嬫棩鏈� + /// </summary> + [SugarColumn(ColumnName = "START_DATE")] + public DateTime? StartDate { get; set; } + + /// <summary> + /// 澶囨敞 + /// </summary> + [SugarColumn(ColumnName = "REMARK")] + public string Remark { get; set; } + + /// <summary> + /// 鑷畾涔夊瓧娈�1 + /// </summary> + [SugarColumn(ColumnName = "REMARK1")] + public string Remark1 { get; set; } + + /// <summary> + /// 鑷畾涔夊瓧娈�2 + /// </summary> + [SugarColumn(ColumnName = "REMARK2")] + public string Remark2 { get; set; } + + /// <summary> + /// 鑷畾涔夊瓧娈�3 + /// </summary> + [SugarColumn(ColumnName = "REMARK3")] + public string Remark3 { get; set; } + + /// <summary> + /// 鑷畾涔夊瓧娈�4 + /// </summary> + [SugarColumn(ColumnName = "REMARK4")] + public string Remark4 { get; set; } + + /// <summary> + /// 鑷畾涔夊瓧娈�5 + /// </summary> + [SugarColumn(ColumnName = "REMARK5")] + public string Remark5 { get; set; } + + /// <summary> + /// 鍒涘缓浜� + /// </summary> + [SugarColumn(ColumnName = "CREATE_BY")] + public string CreateBy { get; set; } + + /// <summary> + /// 鍒涘缓鏃堕棿 + /// </summary> + [SugarColumn(ColumnName = "CREATE_DATE")] + public DateTime? CreateDate { get; set; } + + /// <summary> + /// 鏇存柊浜� + /// </summary> + [SugarColumn(ColumnName = "LASTUPDATE_BY")] + public string LastupdateBy { get; set; } + + /// <summary> + /// 鏇存柊鏃堕棿 + /// </summary> + [SugarColumn(ColumnName = "LASTUPDATE_DATE")] + public DateTime? LastupdateDate { get; set; } + + /// <summary> + /// 澶囨敞 + /// </summary> + [SugarColumn(ColumnName = "MEMO")] + public string Memo { get; set; } + + /// <summary> + /// 鐢熶骇绾� + /// </summary> + [SugarColumn(ColumnName = "LINE_NO")] + public string LineNo { get; set; } + + /// <summary> + /// 鐢熶骇鍛樺伐鏍囪瘑 + /// </summary> + [SugarColumn(ColumnName = "WORK_MK")] + public decimal? WorkMk { get; set; } + + /// <summary> + /// 鏄惁绂佺敤 + /// </summary> + [SugarColumn(ColumnName = "FFORBID_STATUS")] + public string FforbidStatus { get; set; } + + [SugarColumn(IsIgnore = true)] public string? Type { get; set; } + + /// <summary> + /// 浣跨敤绲勭箶 + /// </summary> + [SugarColumn(ColumnName = "FSubsidiary")] + public string? FSubsidiary { get; set; } + + /// <summary> + /// 鍓靛缓绲勭箶 + /// </summary> + [SugarColumn(ColumnName = "Fumbrella")] + public string? Fumbrella { get; set; } +} \ No newline at end of file diff --git a/MES.Service/Modes/MesSupplier.cs b/MES.Service/Modes/MesSupplier.cs new file mode 100644 index 0000000..9721680 --- /dev/null +++ b/MES.Service/Modes/MesSupplier.cs @@ -0,0 +1,184 @@ +锘縰sing SqlSugar; + +namespace MES.Service.Modes; + +/// <summary> +/// 渚涘簲鍟嗕俊鎭� +/// </summary> +[SugarTable("MES_SUPPLIER")] +public class MesSupplier +{ + /// <summary> + /// 榛樿鍊�: (newid()) + /// </summary> + [SugarColumn(ColumnName = "guid", IsPrimaryKey = true)] + public Guid Guid { get; set; } + + /// <summary> + /// ID + /// </summary> + [SugarColumn(ColumnName = "id")] + public decimal Id { get; set; } + + /// <summary> + /// 渚涘簲鍟嗙紪鐮� + /// </summary> + [SugarColumn(ColumnName = "supp_no")] + public string? SuppNo { get; set; } + + /// <summary> + /// 渚涘簲鍟嗗悕绉� + /// </summary> + [SugarColumn(ColumnName = "supp_name")] + public string? SuppName { get; set; } + + /// <summary> + /// 渚涘簲鍟嗙畝绉� + /// </summary> + [SugarColumn(ColumnName = "supp_sname")] + public string? SuppSname { get; set; } + + /// <summary> + /// 鍦板尯 + /// </summary> + [SugarColumn(ColumnName = "land1")] + public string? Land1 { get; set; } + + /// <summary> + /// 鍦板潃 + /// </summary> + [SugarColumn(ColumnName = "stras")] + public string? Stras { get; set; } + + /// <summary> + /// 鐢佃瘽 + /// </summary> + [SugarColumn(ColumnName = "telf1")] + public string? Telf1 { get; set; } + + /// <summary> + /// 浼犵湡 + /// </summary> + [SugarColumn(ColumnName = "telfx")] + public string? Telfx { get; set; } + + /// <summary> + /// 璁板綍鍒涘缓浜� + /// </summary> + [SugarColumn(ColumnName = "create_by")] + public string? CreateBy { get; set; } + + /// <summary> + /// 鍒涘缓鏃堕棿 + /// </summary> + [SugarColumn(ColumnName = "create_date")] + public DateTime? CreateDate { get; set; } + + /// <summary> + /// 鏈�杩戞洿鏂颁汉 + /// </summary> + [SugarColumn(ColumnName = "lastupdate_by")] + public string? LastupdateBy { get; set; } + + /// <summary> + /// 鏈�杩戞洿鏂版椂闂� + /// </summary> + [SugarColumn(ColumnName = "lastupdate_date")] + public DateTime? LastupdateDate { get; set; } + + /// <summary> + /// 澶囨敞 + /// </summary> + [SugarColumn(ColumnName = "remark")] + public string? Remark { get; set; } + + /// <summary> + /// 绠�鐮�(鎵撳嵃鏉$爜鐢�) + /// </summary> + [SugarColumn(ColumnName = "fscode")] + public string? Fscode { get; set; } + + /// <summary> + /// 鍏徃浠g爜 + /// </summary> + [SugarColumn(ColumnName = "company")] + public string? Company { get; set; } + + /// <summary> + /// 鍒嗗巶缂栫爜 + /// </summary> + [SugarColumn(ColumnName = "factory")] + public string? Factory { get; set; } + + /// <summary> + /// 鐗╂枡鏄惁鍏辩(鏄紝鍚�) + /// 榛樿鍊�: ((0)) + /// </summary> + [SugarColumn(ColumnName = "item_c")] + public int? ItemC { get; set; } + + /// <summary> + /// 鐗╂枡鏄惁鍥炲啓SAP鎺ュ彛(鏄紝鍚�) + /// 榛樿鍊�: ((0)) + /// </summary> + [SugarColumn(ColumnName = "item_sap")] + public int? ItemSap { get; set; } + + /// <summary> + /// 鏄惁鎵规绠$悊(鏄紝鍚�) + /// 榛樿鍊�: ((0)) + /// </summary> + [SugarColumn(ColumnName = "lot_flag")] + public int? LotFlag { get; set; } + + /// <summary> + /// 鑱旂郴浜� + /// </summary> + [SugarColumn(ColumnName = "lxr")] + public string? Lxr { get; set; } + + /// <summary> + /// 璐熻矗浜� + /// </summary> + [SugarColumn(ColumnName = "fstaffid")] + public string? Fstaffid { get; set; } + + /// <summary> + /// 绂佺敤鐘舵�� + /// </summary> + [SugarColumn(ColumnName = "fforbidstatus")] + public string? Fforbidstatus { get; set; } + + /// <summary> + /// 鑷畾涔夊瓧娈�3 + /// </summary> + [SugarColumn(ColumnName = "remark3")] + public string? Remark3 { get; set; } + + /// <summary> + /// 鑷畾涔夊瓧娈�4 + /// </summary> + [SugarColumn(ColumnName = "remark4")] + public string? Remark4 { get; set; } + + /// <summary> + /// 鑷畾涔夊瓧娈�5 + /// </summary> + [SugarColumn(ColumnName = "remark5")] + public string? Remark5 { get; set; } + + /// <summary> + /// 浣跨敤缁勭粐 + /// </summary> + [SugarColumn(ColumnName = "FSubsidiary")] + public string? FSubsidiary { get; set; } + + /// <summary> + /// 鍒涘缓缁勭粐 + /// </summary> + [SugarColumn(ColumnName = "Fumbrella")] + public string? Fumbrella { get; set; } + + + [SugarColumn(IsIgnore = true)] public string? Type { get; set; } +} \ No newline at end of file diff --git a/MES.Service/Modes/MesUnit.cs b/MES.Service/Modes/MesUnit.cs new file mode 100644 index 0000000..8169661 --- /dev/null +++ b/MES.Service/Modes/MesUnit.cs @@ -0,0 +1,142 @@ +锘縰sing SqlSugar; + +namespace MES.Service.Modes; + +/// <summary> +/// 閫氱敤鍗曚綅杞崲琛� +/// </summary> +[SugarTable("MES_UNIT")] +public class MesUnit +{ + /// <summary> + /// BASEINFO + /// </summary> + [SugarColumn(ColumnName = "ID", IsPrimaryKey = true)] + public decimal Id { get; set; } + + /// <summary> + /// 鍘熷崟浣� + /// </summary> + [SugarColumn(ColumnName = "OLDUNIT")] + public string? Oldunit { get; set; } + + /// <summary> + /// 鐩殑鍗曚綅 + /// </summary> + [SugarColumn(ColumnName = "NEWUNIT")] + public string? Newunit { get; set; } + + /// <summary> + /// 鍘熷崟浣嶆暟閲� + /// </summary> + [SugarColumn(ColumnName = "OLDQTY")] + public decimal? Oldqty { get; set; } + + /// <summary> + /// 鐩殑鍗曚綅鏁伴噺 + /// </summary> + [SugarColumn(ColumnName = "NEWQTY")] + public decimal? Newqty { get; set; } + + /// <summary> + /// 鍒涘缓鏃堕棿 + /// </summary> + [SugarColumn(ColumnName = "CREATE_DATE")] + public DateTime? CreateDate { get; set; } + + /// <summary> + /// 鍒涘缓浜� + /// </summary> + [SugarColumn(ColumnName = "CREATE_BY")] + public string? CreateBy { get; set; } + + /// <summary> + /// 鏈�鍚庢洿鏂版椂闂� + /// </summary> + [SugarColumn(ColumnName = "LASTUPDATE_DATE")] + public DateTime? LastupdateDate { get; set; } + + /// <summary> + /// 鏈�鍚庢洿鏂颁汉 + /// </summary> + [SugarColumn(ColumnName = "LASTUPDATE_BY")] + public string? LastupdateBy { get; set; } + + /// <summary> + /// </summary> + [SugarColumn(ColumnName = "COMPANY")] + public string? Company { get; set; } + + /// <summary> + /// </summary> + [SugarColumn(ColumnName = "FACTORY")] + public string? Factory { get; set; } + + /// <summary> + /// 缂栫爜 + /// </summary> + [SugarColumn(ColumnName = "FNUMBER")] + public string? Fnumber { get; set; } + + /// <summary> + /// 鍚嶇О + /// </summary> + [SugarColumn(ColumnName = "FNAME")] + public string? Fname { get; set; } + + /// <summary> + /// 鎵�灞炵粍鍒� + /// </summary> + [SugarColumn(ColumnName = "FUNITGROUPID")] + public string? Funitgroupid { get; set; } + + /// <summary> + /// 鎹㈢畻鍒嗘瘝 + /// </summary> + [SugarColumn(ColumnName = "FCONVERTDENOMINATOR")] + public double? Fconvertdenominator { get; set; } + + /// <summary> + /// 褰撳墠鍗曚綅 + /// </summary> + [SugarColumn(ColumnName = "FCURRENTUNITID")] + public string? Fcurrentunitid { get; set; } + + /// <summary> + /// 鎹㈢畻鍒嗗瓙 + /// </summary> + [SugarColumn(ColumnName = "FCONVERTNUMERATOR")] + public double? Fconvertnumerator { get; set; } + + /// <summary> + /// 鍩哄噯鍗曚綅 + /// </summary> + [SugarColumn(ColumnName = "FBASEUNIT")] + public string? Fbaseunit { get; set; } + + /// <summary> + /// 鑸嶅叆绫诲瀷 + /// </summary> + [SugarColumn(ColumnName = "FROUNDTYPE")] + public string? Froundtype { get; set; } + + /// <summary> + /// 绮惧害 + /// </summary> + [SugarColumn(ColumnName = "FPRECISION")] + public decimal? Fprecision { get; set; } + + /// <summary> + /// 鎻忚堪 + /// </summary> + [SugarColumn(ColumnName = "FDESCRIPTION")] + public string? Fdescription { get; set; } + + /// <summary> + /// 绂佺敤鐘舵�� + /// </summary> + [SugarColumn(ColumnName = "FFORBIDSTATUS")] + public string? Fforbidstatus { get; set; } + + [SugarColumn(IsIgnore = true)] public string? Type { get; set; } +} \ No newline at end of file diff --git a/MES.Service/Modes/MessageCenter.cs b/MES.Service/Modes/MessageCenter.cs new file mode 100644 index 0000000..fd37713 --- /dev/null +++ b/MES.Service/Modes/MessageCenter.cs @@ -0,0 +1,142 @@ +锘縰sing SqlSugar; + +namespace MES.Service.Modes; + +/// <summary> +/// </summary> +[SugarTable("MESSAGE_CENTER")] +public class MessageCenter +{ + /// <summary> + /// 涓婚敭 + /// 榛樿鍊�: (newid()) + /// </summary> + [SugarColumn(ColumnName = "guid", IsPrimaryKey = true)] + public Guid Guid { get; set; } + + /// <summary> + /// 琛ㄥ悕/瑙嗗浘鍚� + /// </summary> + [SugarColumn(ColumnName = "table_name")] + public string? TableName { get; set; } + + /// <summary> + /// 璇锋眰鍦板潃 + /// </summary> + [SugarColumn(ColumnName = "url")] + public string? Url { get; set; } + + /// <summary> + /// 璇锋眰鏂瑰紡 + /// </summary> + [SugarColumn(ColumnName = "method")] + public string? Method { get; set; } + + /// <summary> + /// 鏄惁鎴愬姛 0琛ㄧず澶辫触 1 琛ㄧず鎴愬姛 + /// </summary> + [SugarColumn(ColumnName = "result")] + public int? Result { get; set; } + + /// <summary> + /// 杩斿洖鐨凧SON + /// </summary> + [SugarColumn(ColumnName = "result_data")] + public string? ResultData { get; set; } + + /// <summary> + /// 鐘舵�� 0琛ㄧず鏈帹閫� 1 琛ㄧず宸叉帹閫� + /// </summary> + [SugarColumn(ColumnName = "status")] + public int? Status { get; set; } + + /// <summary> + /// 鍒涘缓浜� + /// </summary> + [SugarColumn(ColumnName = "create_by")] + public string? CreateBy { get; set; } + + /// <summary> + /// 鍒涘缓鏃堕棿 + /// </summary> + [SugarColumn(ColumnName = "create_date")] + public string? CreateDate { get; set; } + + /// <summary> + /// 涓氬姟鏍囬 + /// </summary> + [SugarColumn(ColumnName = "title")] + public string? Title { get; set; } + + /// <summary> + /// 椤甸潰鍚嶇О + /// </summary> + [SugarColumn(ColumnName = "page_name")] + public string? PageName { get; set; } + + /// <summary> + /// 鏄惁澶勭悊锛�0琛ㄧず鏈鐞� 1琛ㄧず宸插鐞� + /// 榛樿鍊�: ((0)) + /// </summary> + [SugarColumn(ColumnName = "deal_with")] + public int? DealWith { get; set; } + + /// <summary> + /// 鎵规id + /// </summary> + [SugarColumn(ColumnName = "pid")] + public int? Pid { get; set; } + + /// <summary> + /// 鎵ц椤哄簭 + /// 榛樿鍊�: ((1)) + /// </summary> + [SugarColumn(ColumnName = "seq")] + public int? Seq { get; set; } + + /// <summary> + /// 椤甸潰璺緞 + /// </summary> + [SugarColumn(ColumnName = "route")] + public string? Route { get; set; } + + /// <summary> + /// </summary> + [SugarColumn(ColumnName = "data")] + public string? Data { get; set; } + + /// <summary> + /// 鍙傛暟绫诲瀷 + /// </summary> + [SugarColumn(ColumnName = "content_type")] + public string? ContentType { get; set; } + + /// <summary> + /// 鏄惁鏄秷鎭� 0涓烘帹閫佸け璐� 1涓烘秷鎭� + /// </summary> + [SugarColumn(ColumnName = "is_message")] + public int? IsMessage { get; set; } + + /// <summary> + /// 淇敼鏃堕棿 + /// </summary> + [SugarColumn(ColumnName = "update_date")] + public string? UpdateDate { get; set; } + + /// <summary> + /// 淇敼浜� + /// </summary> + [SugarColumn(ColumnName = "update_by")] + public string? UpdateBy { get; set; } + + /// <summary> + /// MES瀛樺偍杩囩▼ + /// </summary> + [SugarColumn(ColumnName = "prc_mame")] + public string? PrcMame { get; set; } + + + [SugarColumn(IsIgnore = true)] public int? isShow { get; set; } + + [SugarColumn(IsIgnore = true)] public decimal? Count { get; set; } +} \ No newline at end of file diff --git a/MES.Service/Modes/Organize.cs b/MES.Service/Modes/Organize.cs new file mode 100644 index 0000000..0188209 --- /dev/null +++ b/MES.Service/Modes/Organize.cs @@ -0,0 +1,74 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using SqlSugar; + +namespace MES.Service.Modes; + +/// <summary> +/// 缁勭粐 +///</summary> +[SugarTable("ORGANIZE")] +public class Organize +{ + /// <summary> + /// 缂栫爜 + ///</summary> + [SugarColumn(ColumnName = "FNUMBER")] + public string Fnumber { get; set; } + + /// <summary> + /// 鍚嶇О + ///</summary> + [SugarColumn(ColumnName = "FNAME")] + public string Fname { get; set; } + + /// <summary> + /// + ///</summary> + // [SugarColumn(ColumnName="ID" )] + [SugarColumn(IsPrimaryKey = true)] + public string Id { get; set; } + + /// <summary> + /// 绂佺敤鐘舵�� A 鍚敤 B绂佺敤 + ///</summary> + [SugarColumn(ColumnName = "Fforbidstatus")] + public string Fforbidstatus { get; set; } + + /// <summary> + /// 鎿嶄綔绫诲瀷 + ///</summary> + [SugarColumn(ColumnName = "TYPE")] + public string Type { get; set; } + + /// <summary> + /// 缁勭粐鎻忚堪 + ///</summary> + [SugarColumn(ColumnName = "FDESCRIPTION")] + public string FDescription { get; set; } + + /// <summary> + /// 涓婄骇缁勭粐 + ///</summary> + [SugarColumn(ColumnName = "FPARENTID")] + public string? FParentID { get; set; } + + /// <summary> + /// 寤虹珛鏃ユ湡 + ///</summary> + [SugarColumn(ColumnName = "FCREATEDATE")] + public DateTime? FCreateDate { get; set; } + + /// <summary> + /// 绂佺敤浜� + ///</summary> + [SugarColumn(ColumnName = "FFORBIDORID")] + public string? FFORBIDORID { get; set; } + + /// <summary> + /// 绂佺敤鏃堕棿 + ///</summary> + [SugarColumn(ColumnName = "FFORBIDDATE")] + public DateTime? FFORBIDDATE { get; set; } +} \ No newline at end of file diff --git a/MES.Service/Modes/SalesOrder.cs b/MES.Service/Modes/SalesOrder.cs new file mode 100644 index 0000000..304b4ec --- /dev/null +++ b/MES.Service/Modes/SalesOrder.cs @@ -0,0 +1,113 @@ +锘縰sing SqlSugar; + +namespace MES.Service.Modes; + +/// <summary> +/// 閿�鍞鍗曡〃 +/// </summary> +[SugarTable("SALES_ORDER")] +public class SalesOrder +{ + /// <summary> + /// SEQ_sales搴忓垪 + /// </summary> + [SugarColumn(ColumnName = "ID", OracleSequenceName = "SEQ_sales", + IsPrimaryKey = true)] + public decimal Id { get; set; } + + /// <summary> + /// 璁㈠崟鍗曞彿 + /// </summary> + [SugarColumn(ColumnName = "ORDER_ID")] + public string OrderId { get; set; } + + /// <summary> + /// 璁㈠崟鍗曞埆 + /// </summary> + [SugarColumn(ColumnName = "ORDER_TYPE")] + public string OrderType { get; set; } + + /// <summary> + /// 鍙楄鏃ユ湡 + /// </summary> + [SugarColumn(ColumnName = "ORDER_DATE")] + public DateTime? OrderDate { get; set; } + + /// <summary> + /// 鍗曟嵁鐗堟湰 + /// </summary> + [SugarColumn(ColumnName = "DOCUMENT_VERSION")] + public long? DocumentVersion { get; set; } + + /// <summary> + /// 鍗曟嵁鏃ユ湡 + /// </summary> + [SugarColumn(ColumnName = "DOCUMENT_DATE")] + public DateTime? DocumentDate { get; set; } + + /// <summary> + /// 宸ュ巶缂栧彿 + /// </summary> + [SugarColumn(ColumnName = "FACTORY_ID")] + public string FactoryId { get; set; } + + /// <summary> + /// 宸ュ巶绠�绉� + /// </summary> + [SugarColumn(ColumnName = "FACTORY_NAME")] + public string FactoryName { get; set; } + + /// <summary> + /// 瀹㈡埛缂栧彿 + /// </summary> + [SugarColumn(ColumnName = "CUSTOMER_ID")] + public string CustomerId { get; set; } + + /// <summary> + /// 瀹㈡埛绠�绉� + /// </summary> + [SugarColumn(ColumnName = "CUSTOMER_NAME")] + public string CustomerName { get; set; } + + /// <summary> + /// 瀹㈡埛鍗曞彿 + /// </summary> + [SugarColumn(ColumnName = "CUSTOMER_ORDER_ID")] + public string CustomerOrderId { get; set; } + + /// <summary> + /// 閮ㄩ棬缂栧彿 + /// </summary> + [SugarColumn(ColumnName = "DEPARTMENT_ID")] + public string DepartmentId { get; set; } + + /// <summary> + /// 鎬绘暟閲� + /// </summary> + [SugarColumn(ColumnName = "TOTAL_QUANTITY")] + public decimal? TotalQuantity { get; set; } + + /// <summary> + /// 澶囨敞 + /// </summary> + [SugarColumn(ColumnName = "REMARKS")] + public string Remarks { get; set; } + + /// <summary> + /// erp瀹℃牳鏃ユ湡 + /// </summary> + [SugarColumn(ColumnName = "APPROVAL_DATE")] + public DateTime? ApprovalDate { get; set; } + + /// <summary> + /// erp瀹℃牳鑰� + /// </summary> + [SugarColumn(ColumnName = "APPROVER")] + public string Approver { get; set; } + + /// <summary> + /// ERPID + /// </summary> + [SugarColumn(ColumnName = "ERP_ID")] + public string ErpId { get; set; } +} \ No newline at end of file diff --git a/MES.Service/Modes/SalesOrderDetail.cs b/MES.Service/Modes/SalesOrderDetail.cs new file mode 100644 index 0000000..0dd800e --- /dev/null +++ b/MES.Service/Modes/SalesOrderDetail.cs @@ -0,0 +1,113 @@ +锘縰sing SqlSugar; + +namespace MES.Service.Modes; + +/// <summary> +/// 閿�鍞鍗曟槑缁嗚〃 +/// </summary> +[SugarTable("SALES_ORDER_DETAIL")] +public class SalesOrderDetail +{ + /// <summary> + /// SEQ_sales搴忓垪 + /// </summary> + [SugarColumn(ColumnName = "ID", OracleSequenceName = "SEQ_sales", + IsPrimaryKey = true)] + public decimal Id { get; set; } + + /// <summary> + /// 璁㈠崟鍗曞彿 + /// </summary> + [SugarColumn(ColumnName = "ORDER_ID")] + public string OrderId { get; set; } + + /// <summary> + /// 搴忓彿 + /// </summary> + [SugarColumn(ColumnName = "LINE_NUMBER")] + public long? LineNumber { get; set; } + + /// <summary> + /// 浜у搧缂栫爜 + /// </summary> + [SugarColumn(ColumnName = "PRODUCT_CODE")] + public string ProductCode { get; set; } + + /// <summary> + /// 浜у搧鍚嶇О + /// </summary> + [SugarColumn(ColumnName = "PRODUCT_NAME")] + public string ProductName { get; set; } + + /// <summary> + /// 浜у搧瑙勬牸 + /// </summary> + [SugarColumn(ColumnName = "PRODUCT_SPEC")] + public string ProductSpec { get; set; } + + /// <summary> + /// 棰勪氦璐ф棩鏈� + /// </summary> + [SugarColumn(ColumnName = "SCHEDULED_DELIVERY_DATE")] + public DateTime? ScheduledDeliveryDate { get; set; } + + /// <summary> + /// 璁㈠崟鏁伴噺 + /// </summary> + [SugarColumn(ColumnName = "ORDER_QUANTITY")] + public decimal? OrderQuantity { get; set; } + + /// <summary> + /// 鍗曚綅 + /// </summary> + [SugarColumn(ColumnName = "UNIT")] + public string Unit { get; set; } + + /// <summary> + /// 鍗曚环 + /// </summary> + [SugarColumn(ColumnName = "UNIT_PRICE")] + public decimal? UnitPrice { get; set; } + + /// <summary> + /// 閲戦 + /// </summary> + [SugarColumn(ColumnName = "AMOUNT")] + public decimal? Amount { get; set; } + + /// <summary> + /// 瀹㈡埛浜у搧缂栫爜 + /// </summary> + [SugarColumn(ColumnName = "CUSTOMER_PRODUCT_CODE")] + public string CustomerProductCode { get; set; } + + /// <summary> + /// 宸蹭氦璐ф暟 + /// </summary> + [SugarColumn(ColumnName = "DELIVERED_QUANTITY")] + public decimal? DeliveredQuantity { get; set; } + + /// <summary> + /// 缁撴潫 + /// </summary> + [SugarColumn(ColumnName = "IS_CLOSED")] + public string IsClosed { get; set; } + + /// <summary> + /// 澶囨敞 + /// </summary> + [SugarColumn(ColumnName = "REMARKS")] + public string Remarks { get; set; } + + /// <summary> + /// ERPID + /// </summary> + [SugarColumn(ColumnName = "ERP_ID")] + public string ErpId { get; set; } + + /// <summary> + /// ERP澶碔D + /// </summary> + [SugarColumn(ColumnName = "ERP_HEAD_ID")] + public string ErpHeadId { get; set; } +} \ No newline at end of file diff --git a/MES.Service/Modes/SalesReturnNotice.cs b/MES.Service/Modes/SalesReturnNotice.cs new file mode 100644 index 0000000..f3c462d --- /dev/null +++ b/MES.Service/Modes/SalesReturnNotice.cs @@ -0,0 +1,83 @@ +锘縰sing SqlSugar; + +namespace MES.Service.Modes; + +/// <summary> +/// 閿�鍞��璐ч�氱煡鍗曡〃 +/// </summary> +[SugarTable("SALES_RETURN_NOTICE")] +public class SalesReturnNotice +{ + /// <summary> + /// SEQ_sales + /// </summary> + [SugarColumn(ColumnName = "ID", OracleSequenceName = "SEQ_sales", + IsPrimaryKey = true)] + public decimal Id { get; set; } + + /// <summary> + /// 鍒跺崟浜� + /// </summary> + [SugarColumn(ColumnName = "CREATED_BY")] + public string CreatedBy { get; set; } + + /// <summary> + /// 鍗曟嵁缂栧彿 + /// </summary> + [SugarColumn(ColumnName = "DOCUMENT_ID")] + public string DocumentId { get; set; } + + /// <summary> + /// 瀹℃牳浜哄悕绉� + /// </summary> + [SugarColumn(ColumnName = "APPROVED_BY")] + public string ApprovedBy { get; set; } + + /// <summary> + /// 鍒跺崟/瀹℃牳鏃ユ湡 + /// </summary> + [SugarColumn(ColumnName = "CREATED_OR_APPROVED_DATE")] + public DateTime? CreatedOrApprovedDate { get; set; } + + /// <summary> + /// 閮ㄩ棬浠g爜 + /// </summary> + [SugarColumn(ColumnName = "DEPARTMENT_CODE")] + public string DepartmentCode { get; set; } + + /// <summary> + /// 閮ㄩ棬鍚嶇О + /// </summary> + [SugarColumn(ColumnName = "DEPARTMENT_NAME")] + public string DepartmentName { get; set; } + + /// <summary> + /// 璐揣鍗曚綅浠g爜 + /// </summary> + [SugarColumn(ColumnName = "PURCHASER_CODE")] + public string PurchaserCode { get; set; } + + /// <summary> + /// 璐揣鍗曚綅鍚嶇О + /// </summary> + [SugarColumn(ColumnName = "PURCHASER_NAME")] + public string PurchaserName { get; set; } + + /// <summary> + /// 涓氬姟鍛樹唬鐮� + /// </summary> + [SugarColumn(ColumnName = "SALESPERSON_CODE")] + public string SalespersonCode { get; set; } + + /// <summary> + /// 涓氬姟鍛樺悕绉� + /// </summary> + [SugarColumn(ColumnName = "SALESPERSON_NAME")] + public string SalespersonName { get; set; } + + /// <summary> + /// ERPID + /// </summary> + [SugarColumn(ColumnName = "ERP_ID")] + public string ErpId { get; set; } +} \ No newline at end of file diff --git a/MES.Service/Modes/SalesReturnNoticeDetail.cs b/MES.Service/Modes/SalesReturnNoticeDetail.cs new file mode 100644 index 0000000..3d64ef4 --- /dev/null +++ b/MES.Service/Modes/SalesReturnNoticeDetail.cs @@ -0,0 +1,155 @@ +锘縰sing SqlSugar; + +namespace MES.Service.Modes; + +/// <summary> +/// 閿�鍞��璐ч�氱煡鍗曟槑缁嗚〃 +/// </summary> +[SugarTable("SALES_RETURN_NOTICE_DETAIL")] +public class SalesReturnNoticeDetail +{ + /// <summary> + /// SEQ_sales + /// </summary> + [SugarColumn(ColumnName = "ID", OracleSequenceName = "SEQ_sales", + IsPrimaryKey = true)] + public decimal Id { get; set; } + + /// <summary> + /// 鍗曟嵁琛屽彿 + /// </summary> + [SugarColumn(ColumnName = "LINE_NUMBER")] + public long? LineNumber { get; set; } + + /// <summary> + /// 浜у搧浠g爜 + /// </summary> + [SugarColumn(ColumnName = "PRODUCT_CODE")] + public string ProductCode { get; set; } + + /// <summary> + /// 浜у搧鍚嶇О + /// </summary> + [SugarColumn(ColumnName = "PRODUCT_NAME")] + public string ProductName { get; set; } + + /// <summary> + /// 浜у搧瑙勬牸 + /// </summary> + [SugarColumn(ColumnName = "PRODUCT_SPEC")] + public string ProductSpec { get; set; } + + /// <summary> + /// 閲戦 + /// </summary> + [SugarColumn(ColumnName = "AMOUNT")] + public decimal? Amount { get; set; } + + /// <summary> + /// 鍗曚环 + /// </summary> + [SugarColumn(ColumnName = "UNIT_PRICE")] + public decimal? UnitPrice { get; set; } + + /// <summary> + /// 鏁伴噺 + /// </summary> + [SugarColumn(ColumnName = "QUANTITY")] + public decimal? Quantity { get; set; } + + /// <summary> + /// 鍑哄簱鏁伴噺 + /// </summary> + [SugarColumn(ColumnName = "OUT_QUANTITY")] + public decimal? OutQuantity { get; set; } + + /// <summary> + /// 鎵瑰彿 + /// </summary> + [SugarColumn(ColumnName = "BATCH_NUMBER")] + public string BatchNumber { get; set; } + + /// <summary> + /// 閫�璐ф暟閲� + /// </summary> + [SugarColumn(ColumnName = "RETURN_QUANTITY")] + public decimal? ReturnQuantity { get; set; } + + /// <summary> + /// 鍙戣揣鏁伴噺 + /// </summary> + [SugarColumn(ColumnName = "DELIVERY_QUANTITY")] + public decimal? DeliveryQuantity { get; set; } + + /// <summary> + /// 澶囨敞 + /// </summary> + [SugarColumn(ColumnName = "REMARKS")] + public string Remarks { get; set; } + + /// <summary> + /// 閿�鍞鍗曞崟鍙� + /// </summary> + [SugarColumn(ColumnName = "SALES_ORDER_ID")] + public string SalesOrderId { get; set; } + + /// <summary> + /// 閿�鍞鍗曞垎褰� + /// </summary> + [SugarColumn(ColumnName = "SALES_ORDER_ENTRY")] + public string SalesOrderEntry { get; set; } + + /// <summary> + /// 閿�鍞鍗旾D + /// </summary> + [SugarColumn(ColumnName = "SALES_ORDER_DETAIL_ID")] + public string SalesOrderDetailId { get; set; } + + /// <summary> + /// 鍩烘湰鍗曚环 + /// </summary> + [SugarColumn(ColumnName = "BASE_UNIT_PRICE")] + public decimal? BaseUnitPrice { get; set; } + + /// <summary> + /// 鍩烘湰鍗曚綅鏁伴噺 + /// </summary> + [SugarColumn(ColumnName = "BASE_UNIT_QUANTITY")] + public decimal? BaseUnitQuantity { get; set; } + + /// <summary> + /// 浠撳簱浠g爜 + /// </summary> + [SugarColumn(ColumnName = "WAREHOUSE_CODE")] + public string WarehouseCode { get; set; } + + /// <summary> + /// 浠撳簱鍚嶇О + /// </summary> + [SugarColumn(ColumnName = "WAREHOUSE_NAME")] + public string WarehouseName { get; set; } + + /// <summary> + /// 鍩烘湰鍗曚綅鍑哄簱鏁伴噺 + /// </summary> + [SugarColumn(ColumnName = "BASE_UNIT_OUT_QUANTITY")] + public decimal? BaseUnitOutQuantity { get; set; } + + /// <summary> + /// 鍗曚綅 + /// </summary> + [SugarColumn(ColumnName = "UNIT")] + public string Unit { get; set; } + + /// <summary> + /// ERPID + /// </summary> + [SugarColumn(ColumnName = "ERP_ID")] + public string ErpId { get; set; } + + /// <summary> + /// ERP澶碔D + /// </summary> + [SugarColumn(ColumnName = "ERP_HEAD_ID")] + public string ErpHeadId { get; set; } +} \ No newline at end of file diff --git a/MES.Service/Modes/ShipmentDetail.cs b/MES.Service/Modes/ShipmentDetail.cs new file mode 100644 index 0000000..7462202 --- /dev/null +++ b/MES.Service/Modes/ShipmentDetail.cs @@ -0,0 +1,155 @@ +锘縰sing SqlSugar; + +namespace MES.Service.Modes; + +/// <summary> +/// 閿�鍞彂璐ч�氱煡鍗曟槑缁嗚〃 +/// </summary> +[SugarTable("SHIPMENT_DETAIL")] +public class ShipmentDetail +{ + /// <summary> + /// SEQ_sales + /// </summary> + [SugarColumn(ColumnName = "ID", OracleSequenceName = "SEQ_sales", + IsPrimaryKey = true)] + public decimal Id { get; set; } + + /// <summary> + /// ERPID + /// </summary> + [SugarColumn(ColumnName = "ERP_ID")] + public string ErpId { get; set; } + + /// <summary> + /// ERP澶碔D + /// </summary> + [SugarColumn(ColumnName = "ERP_HEAD_ID")] + public string ErpHeadId { get; set; } + + /// <summary> + /// 鍗曟嵁琛屽彿 + /// </summary> + [SugarColumn(ColumnName = "LINE_NO")] + public long? LineNo { get; set; } + + /// <summary> + /// 浜у搧浠g爜 + /// </summary> + [SugarColumn(ColumnName = "PROD_CODE")] + public string ProdCode { get; set; } + + /// <summary> + /// 浜у搧鍚嶇О + /// </summary> + [SugarColumn(ColumnName = "PROD_NAME")] + public string ProdName { get; set; } + + /// <summary> + /// 浜у搧瑙勬牸 + /// </summary> + [SugarColumn(ColumnName = "PROD_SPEC")] + public string ProdSpec { get; set; } + + /// <summary> + /// 閲戦 + /// </summary> + [SugarColumn(ColumnName = "AMOUNT")] + public double? Amount { get; set; } + + /// <summary> + /// 鍗曚环 + /// </summary> + [SugarColumn(ColumnName = "UNIT_PRICE")] + public double? UnitPrice { get; set; } + + /// <summary> + /// 鏁伴噺 + /// </summary> + [SugarColumn(ColumnName = "QUANTITY")] + public double? Quantity { get; set; } + + /// <summary> + /// 鍑哄簱鏁伴噺 + /// </summary> + [SugarColumn(ColumnName = "OUT_QTY")] + public double? OutQty { get; set; } + + /// <summary> + /// 鎵瑰彿 + /// </summary> + [SugarColumn(ColumnName = "BATCH_NO")] + public string BatchNo { get; set; } + + /// <summary> + /// 閫�璐ф暟閲� + /// </summary> + [SugarColumn(ColumnName = "RETURN_QTY")] + public double? ReturnQty { get; set; } + + /// <summary> + /// 鍙戣揣鏁伴噺 + /// </summary> + [SugarColumn(ColumnName = "SHIP_QTY")] + public double? ShipQty { get; set; } + + /// <summary> + /// 澶囨敞 + /// </summary> + [SugarColumn(ColumnName = "REMARKS")] + public string Remarks { get; set; } + + /// <summary> + /// 閿�鍞鍗曞崟鍙� + /// </summary> + [SugarColumn(ColumnName = "ORDER_NO")] + public string OrderNo { get; set; } + + /// <summary> + /// 閿�鍞鍗曞垎褰� + /// </summary> + [SugarColumn(ColumnName = "ORDER_ENTRY")] + public string OrderEntry { get; set; } + + /// <summary> + /// 閿�鍞鍗旾D + /// </summary> + [SugarColumn(ColumnName = "ORDER_ID")] + public string OrderId { get; set; } + + /// <summary> + /// 鍩烘湰鍗曚环 + /// </summary> + [SugarColumn(ColumnName = "BASE_PRICE")] + public double? BasePrice { get; set; } + + /// <summary> + /// 鍩烘湰鍗曚綅鏁伴噺 + /// </summary> + [SugarColumn(ColumnName = "BASE_QTY")] + public double? BaseQty { get; set; } + + /// <summary> + /// 浠撳簱浠g爜 + /// </summary> + [SugarColumn(ColumnName = "WAREHOUSE_CODE")] + public string WarehouseCode { get; set; } + + /// <summary> + /// 浠撳簱鍚嶇О + /// </summary> + [SugarColumn(ColumnName = "WAREHOUSE_NAME")] + public string WarehouseName { get; set; } + + /// <summary> + /// 鍩烘湰鍗曚綅鍑哄簱鏁伴噺 + /// </summary> + [SugarColumn(ColumnName = "BASE_OUT_QTY")] + public double? BaseOutQty { get; set; } + + /// <summary> + /// 鍗曚綅 + /// </summary> + [SugarColumn(ColumnName = "UNIT")] + public string Unit { get; set; } +} \ No newline at end of file diff --git a/MES.Service/Modes/ShipmentNotice.cs b/MES.Service/Modes/ShipmentNotice.cs new file mode 100644 index 0000000..642a9ab --- /dev/null +++ b/MES.Service/Modes/ShipmentNotice.cs @@ -0,0 +1,125 @@ +锘縰sing SqlSugar; + +namespace MES.Service.Modes; + +/// <summary> +/// 閿�鍞彂璐ч�氱煡鍗曡〃 +/// </summary> +[SugarTable("SHIPMENT_NOTICE")] +public class ShipmentNotice +{ + /// <summary> + /// SEQ_sales + /// </summary> + [SugarColumn(ColumnName = "ID", OracleSequenceName = "SEQ_sales", + IsPrimaryKey = true)] + public decimal Id { get; set; } + + /// <summary> + /// 鍒跺崟浜� + /// </summary> + [SugarColumn(ColumnName = "CREATOR")] + public string Creator { get; set; } + + /// <summary> + /// 鍗曟嵁缂栧彿 + /// </summary> + [SugarColumn(ColumnName = "DOC_ID")] + public string DocId { get; set; } + + /// <summary> + /// 瀹℃牳浜哄悕绉� + /// </summary> + [SugarColumn(ColumnName = "APPROVER")] + public string Approver { get; set; } + + /// <summary> + /// 鍒跺崟鏃ユ湡 + /// </summary> + [SugarColumn(ColumnName = "CREATE_DATE")] + public DateTime? CreateDate { get; set; } + + /// <summary> + /// 瀹℃牳鏃ユ湡 + /// </summary> + [SugarColumn(ColumnName = "APPROVE_DATE")] + public DateTime? ApproveDate { get; set; } + + /// <summary> + /// 閮ㄩ棬浠g爜 + /// </summary> + [SugarColumn(ColumnName = "DEPT_CODE")] + public string DeptCode { get; set; } + + /// <summary> + /// 閮ㄩ棬鍚嶇О + /// </summary> + [SugarColumn(ColumnName = "DEPT_NAME")] + public string DeptName { get; set; } + + /// <summary> + /// 璐揣鍗曚綅浠g爜 + /// </summary> + [SugarColumn(ColumnName = "BUYER_CODE")] + public string BuyerCode { get; set; } + + /// <summary> + /// 璐揣鍗曚綅鍚嶇О + /// </summary> + [SugarColumn(ColumnName = "BUYER_NAME")] + public string BuyerName { get; set; } + + /// <summary> + /// 涓氬姟鍛樹唬鐮� + /// </summary> + [SugarColumn(ColumnName = "SALES_CODE")] + public string SalesCode { get; set; } + + /// <summary> + /// 涓氬姟鍛樺悕绉� + /// </summary> + [SugarColumn(ColumnName = "SALES_NAME")] + public string SalesName { get; set; } + + /// <summary> + /// 鍗曟嵁ID + /// </summary> + [SugarColumn(ColumnName = "UNIQUE_ID")] + public string UniqueId { get; set; } + + /// <summary> + /// 瀹㈡埛浠g爜 + /// </summary> + [SugarColumn(ColumnName = "CUST_CODE")] + public string CustCode { get; set; } + + /// <summary> + /// 瀹㈡埛鍚嶇О + /// </summary> + [SugarColumn(ColumnName = "CUST_NAME")] + public string CustName { get; set; } + + /// <summary> + /// 鍒楄〃澶囨敞 + /// </summary> + [SugarColumn(ColumnName = "LIST_NOTE")] + public string ListNote { get; set; } + + /// <summary> + /// 閿�鍞憳浠g爜 + /// </summary> + [SugarColumn(ColumnName = "REP_CODE")] + public string RepCode { get; set; } + + /// <summary> + /// 閿�鍞憳鍚嶇О + /// </summary> + [SugarColumn(ColumnName = "REP_NAME")] + public string RepName { get; set; } + + /// <summary> + /// ERPID + /// </summary> + [SugarColumn(ColumnName = "ERP_ID")] + public string ErpId { get; set; } +} \ No newline at end of file diff --git a/MES.Service/Modes/SysDepartment.cs b/MES.Service/Modes/SysDepartment.cs new file mode 100644 index 0000000..b43a1ff --- /dev/null +++ b/MES.Service/Modes/SysDepartment.cs @@ -0,0 +1,113 @@ +锘縰sing SqlSugar; + +namespace MES.Service.Modes; + +/// <summary> +/// 閮ㄩ棬 +/// </summary> +[SugarTable("SYS_DEPARTMENT")] +public class SysDepartment +{ + /// <summary> + /// 鍏徃 + /// </summary> + [SugarColumn(ColumnName = "COMPANY")] + public string? Company { get; set; } + + /// <summary> + /// 宸ュ巶 + /// </summary> + [SugarColumn(ColumnName = "FACTORY")] + public string? Factory { get; set; } + + /// <summary> + /// 閮ㄩ棬ID + /// </summary> + [SugarColumn(ColumnName = "DEPARTMENTID")] + public decimal? Departmentid { get; set; } + + /// <summary> + /// 閮ㄩ棬缂栧彿 + /// </summary> + [SugarColumn(ColumnName = "DEPARTMENTCODE")] + public string? Departmentcode { get; set; } + + /// <summary> + /// 閮ㄩ棬鍚嶇О + /// </summary> + [SugarColumn(ColumnName = "DEPARTMENTNAME")] + public string? Departmentname { get; set; } + + /// <summary> + /// 閮ㄩ棬灞炴�� + /// </summary> + [SugarColumn(ColumnName = "DEPEXTR1")] + public string? Depextr1 { get; set; } + + /// <summary> + /// 閮ㄩ棬鍒嗙粍 + /// </summary> + [SugarColumn(ColumnName = "DEPEXTR2")] + public string? Depextr2 { get; set; } + + /// <summary> + /// WIP浠撳簱 + /// </summary> + [SugarColumn(ColumnName = "DEPEXTR3")] + public string? Depextr3 { get; set; } + + /// <summary> + /// 鏄惁绂佺敤 + /// </summary> + [SugarColumn(ColumnName = "DEPEXTR4")] + public string? Depextr4 { get; set; } + + /// <summary> + /// 鍒涘缓浜� + /// </summary> + [SugarColumn(ColumnName = "CREATE_BY")] + public string? CreateBy { get; set; } + + /// <summary> + /// 鍒涘缓鏃ユ湡 + /// </summary> + [SugarColumn(ColumnName = "CREATE_DATE")] + public DateTime? CreateDate { get; set; } + + /// <summary> + /// 鏈�鍚庝慨鏀逛汉 + /// </summary> + [SugarColumn(ColumnName = "LASTUPDATE_BY")] + public string? LastupdateBy { get; set; } + + /// <summary> + /// 鏈�鍚庝慨鏀规棩鏈� + /// </summary> + [SugarColumn(ColumnName = "LASTUPDATE_DATE")] + public DateTime? LastupdateDate { get; set; } + + /// <summary> + /// 涓婄骇閮ㄩ棬 + /// </summary> + [SugarColumn(ColumnName = "FParentID")] + public string? FParentID { get; set; } + + /// <summary> + /// 浣跨敤绲勭箶 + /// </summary> + [SugarColumn(ColumnName = "FSubsidiary")] + public string? FSubsidiary { get; set; } + + /// <summary> + /// 鍓靛缓绲勭箶 + /// </summary> + [SugarColumn(ColumnName = "Fumbrella")] + public string? Fumbrella { get; set; } + + /// <summary> + /// </summary> + [SugarColumn(ColumnName = "ID", IsPrimaryKey = true)] + public decimal Id { get; set; } + + [SugarColumn(IsIgnore = true)] public string? Type { get; set; } +} \ No newline at end of file diff --git a/MES.Service/Modes/SysUser.cs b/MES.Service/Modes/SysUser.cs new file mode 100644 index 0000000..a318f0d --- /dev/null +++ b/MES.Service/Modes/SysUser.cs @@ -0,0 +1,347 @@ +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using SqlSugar; + +namespace MES.Service.Modes; + +/// <summary> +/// </summary> +[Table("SYS_USER")] +[SugarTable("SYS_USER")] //鐢ㄤ簬SqlSugar +public class SysUser +{ + /// <summary> + /// BASEINFO + /// </summary> + [Key] + [Column("FID")] + [StringLength(20, ErrorMessage = "Fid闀垮害涓嶈兘瓒呭嚭20")] + [SugarColumn(IsPrimaryKey = true, OracleSequenceName = "BASEINFO", + ColumnName = "FID")] //鐢ㄤ簬SqlSugar + public string Fid { get; set; } + + + [StringLength(20, ErrorMessage = "Sid闀垮害涓嶈兘瓒呭嚭20")] + [SugarColumn(ColumnName = "SID")] //鐢ㄤ簬SqlSugar + public decimal Sid { get; set; } + + /// <summary> + /// 鎺ユ敹鐗╂枡鏄惁杩涜妫�鏌� + /// </summary> + [Column("CHECK_FLAG")] + [SugarColumn(ColumnName = "CHECK_FLAG")] //鐢ㄤ簬SqlSugar + public decimal? CheckFlag { get; set; } + + /// <summary> + /// </summary> + [Column("COMPANY")] + [SugarColumn(ColumnName = "COMPANY")] //鐢ㄤ簬SqlSugar + [StringLength(20, ErrorMessage = "Company闀垮害涓嶈兘瓒呭嚭20")] + public string Company { get; set; } + + /// <summary> + /// </summary> + [Column("CREATE_BY")] + [SugarColumn(ColumnName = "CREATE_BY")] //鐢ㄤ簬SqlSugar + [StringLength(20, ErrorMessage = "CreateBy闀垮害涓嶈兘瓒呭嚭20")] + public string CreateBy { get; set; } + + /// <summary> + /// </summary> + [Column("CREATE_DATE")] + [SugarColumn(ColumnName = "CREATE_DATE")] //鐢ㄤ簬SqlSugar + public DateTime? CreateDate { get; set; } + + /// <summary> + /// 鏄惁鏈夊垹闄ょ壒鏉� + /// </summary> + [Column("DEL_FLAG")] + [SugarColumn(ColumnName = "DEL_FLAG")] //鐢ㄤ簬SqlSugar + public decimal? DelFlag { get; set; } + + /// <summary> + /// 閮ㄩ棬 + /// </summary> + [Column("DEPARTMENTID")] + [SugarColumn(ColumnName = "DEPARTMENTID")] //鐢ㄤ簬SqlSugar + [StringLength(20, ErrorMessage = "閮ㄩ棬闀垮害涓嶈兘瓒呭嚭20")] + public string Departmentid { get; set; } + + /// <summary> + /// </summary> + [Column("DEV")] + [SugarColumn(ColumnName = "DEV")] //鐢ㄤ簬SqlSugar + public decimal? Dev { get; set; } + + /// <summary> + /// </summary> + [Column("EXP_FIEL10")] + [SugarColumn(ColumnName = "EXP_FIEL10")] //鐢ㄤ簬SqlSugar + [StringLength(50, ErrorMessage = "ExpFiel10闀垮害涓嶈兘瓒呭嚭50")] + public string ExpFiel10 { get; set; } + + /// <summary> + /// </summary> + [Column("EXP_FIEL11")] + [SugarColumn(ColumnName = "EXP_FIEL11")] //鐢ㄤ簬SqlSugar + [StringLength(50, ErrorMessage = "ExpFiel11闀垮害涓嶈兘瓒呭嚭50")] + public string ExpFiel11 { get; set; } + + /// <summary> + /// </summary> + [Column("EXP_FIEL12")] + [SugarColumn(ColumnName = "EXP_FIEL12")] //鐢ㄤ簬SqlSugar + public decimal? ExpFiel12 { get; set; } + + /// <summary> + /// 鐝 + /// </summary> + [Column("EXP_FIELD1")] + [SugarColumn(ColumnName = "EXP_FIELD1")] //鐢ㄤ簬SqlSugar + [StringLength(20, ErrorMessage = "鐝闀垮害涓嶈兘瓒呭嚭20")] + public string ExpField1 { get; set; } + + /// <summary> + /// 绾夸綋 + /// </summary> + [Column("EXP_FIELD2")] + [SugarColumn(ColumnName = "EXP_FIELD2")] //鐢ㄤ簬SqlSugar + [StringLength(20, ErrorMessage = "绾夸綋闀垮害涓嶈兘瓒呭嚭20")] + public string ExpField2 { get; set; } + + /// <summary> + /// 鐓х墖 + /// </summary> + [Column("EXP_FIELD3")] + [SugarColumn(ColumnName = "EXP_FIELD3")] //鐢ㄤ簬SqlSugar + public byte[] ExpField3 { get; set; } + + /// <summary> + /// 鑱旂郴鏂瑰紡 + /// </summary> + [Column("EXP_FIELD4")] + [SugarColumn(ColumnName = "EXP_FIELD4")] //鐢ㄤ簬SqlSugar + [StringLength(20, ErrorMessage = "鑱旂郴鏂瑰紡闀垮害涓嶈兘瓒呭嚭20")] + public string ExpField4 { get; set; } + + /// <summary> + /// 鍥剧墖鍚� + /// </summary> + [Column("EXP_FIELD5")] + [SugarColumn(ColumnName = "EXP_FIELD5")] //鐢ㄤ簬SqlSugar + [StringLength(200, ErrorMessage = "鍥剧墖鍚嶉暱搴︿笉鑳借秴鍑�200")] + public string ExpField5 { get; set; } + + /// <summary> + /// </summary> + [Column("EXP_FIELD6")] + [SugarColumn(ColumnName = "EXP_FIELD6")] //鐢ㄤ簬SqlSugar + [StringLength(20, ErrorMessage = "ExpField6闀垮害涓嶈兘瓒呭嚭20")] + public string ExpField6 { get; set; } + + /// <summary> + /// 杞﹂棿缂栫爜 + /// </summary> + [Column("EXP_FIELD7")] + [SugarColumn(ColumnName = "EXP_FIELD7")] //鐢ㄤ簬SqlSugar + [StringLength(50, ErrorMessage = "杞﹂棿缂栫爜闀垮害涓嶈兘瓒呭嚭50")] + public string ExpField7 { get; set; } + + /// <summary> + /// </summary> + [Column("EXP_FIELD8")] + [SugarColumn(ColumnName = "EXP_FIELD8")] //鐢ㄤ簬SqlSugar + [StringLength(50, ErrorMessage = "ExpField8闀垮害涓嶈兘瓒呭嚭50")] + public string ExpField8 { get; set; } + + /// <summary> + /// </summary> + [Column("EXP_FIELD9")] + [SugarColumn(ColumnName = "EXP_FIELD9")] //鐢ㄤ簬SqlSugar + [StringLength(50, ErrorMessage = "ExpField9闀垮害涓嶈兘瓒呭嚭50")] + public string ExpField9 { get; set; } + + /// <summary> + /// 宸ュ巶 + /// </summary> + [Column("FACTORY")] + [SugarColumn(ColumnName = "FACTORY")] //鐢ㄤ簬SqlSugar + [StringLength(1000, ErrorMessage = "宸ュ巶闀垮害涓嶈兘瓒呭嚭1000")] + public string Factory { get; set; } + + /// <summary> + /// </summary> + [Column("FBRANCH")] + [SugarColumn(ColumnName = "FBRANCH")] //鐢ㄤ簬SqlSugar + [StringLength(20, ErrorMessage = "Fbranch闀垮害涓嶈兘瓒呭嚭20")] + public string Fbranch { get; set; } + + /// <summary> + /// </summary> + [Column("FCODE")] + [SugarColumn(ColumnName = "FCODE")] //鐢ㄤ簬SqlSugar + [StringLength(20, ErrorMessage = "Fcode闀垮害涓嶈兘瓒呭嚭20")] + public string Fcode { get; set; } + + /// <summary> + /// 鍏徃 + /// </summary> + [Column("FCOMPANY")] + [SugarColumn(ColumnName = "FCOMPANY")] //鐢ㄤ簬SqlSugar + [StringLength(1000, ErrorMessage = "鍏徃闀垮害涓嶈兘瓒呭嚭1000")] + public string Fcompany { get; set; } + + /// <summary> + /// 宸ュ巶 + /// </summary> + [Column("FFACTORY")] + [SugarColumn(ColumnName = "FFACTORY")] //鐢ㄤ簬SqlSugar + [StringLength(1000, ErrorMessage = "宸ュ巶闀垮害涓嶈兘瓒呭嚭1000")] + public string Ffactory { get; set; } + + /// <summary> + /// 棣栨鐧婚檰 + /// </summary> + [Column("FIRST_LOGIN")] + [SugarColumn(ColumnName = "FIRST_LOGIN")] //鐢ㄤ簬SqlSugar + public decimal? FirstLogin { get; set; } + + /// <summary> + /// </summary> + [Column("FLOGIN_NAME")] + [SugarColumn(ColumnName = "FLOGIN_NAME")] //鐢ㄤ簬SqlSugar + [StringLength(20, ErrorMessage = "FloginName闀垮害涓嶈兘瓒呭嚭20")] + public string FloginName { get; set; } + + /// <summary> + /// </summary> + [Column("FNAME")] + [SugarColumn(ColumnName = "FNAME")] //鐢ㄤ簬SqlSugar + [StringLength(40, ErrorMessage = "Fname闀垮害涓嶈兘瓒呭嚭40")] + public string Fname { get; set; } + + /// <summary> + /// </summary> + [Column("FPASSWORD")] + [SugarColumn(ColumnName = "FPASSWORD")] //鐢ㄤ簬SqlSugar + [StringLength(100, ErrorMessage = "Fpassword闀垮害涓嶈兘瓒呭嚭100")] + public string Fpassword { get; set; } + + /// <summary> + /// </summary> + [Column("FPLANT")] + [SugarColumn(ColumnName = "FPLANT")] //鐢ㄤ簬SqlSugar + [StringLength(20, ErrorMessage = "Fplant闀垮害涓嶈兘瓒呭嚭20")] + public string Fplant { get; set; } + + /// <summary> + /// </summary> + [Column("FREADONLY")] + [SugarColumn(ColumnName = "FREADONLY")] //鐢ㄤ簬SqlSugar + [StringLength(20, ErrorMessage = "Freadonly闀垮害涓嶈兘瓒呭嚭20")] + public string Freadonly { get; set; } + + /// <summary> + /// </summary> + [Column("FSYSTEM")] + [SugarColumn(ColumnName = "FSYSTEM")] //鐢ㄤ簬SqlSugar + [StringLength(10, ErrorMessage = "Fsystem闀垮害涓嶈兘瓒呭嚭10")] + public string Fsystem { get; set; } + + /// <summary> + /// 鏄惁涓洪噰闆嗕汉鍛� + /// </summary> + [Column("ISACQ")] + [SugarColumn(ColumnName = "ISACQ")] //鐢ㄤ簬SqlSugar + public decimal? Isacq { get; set; } + + /// <summary> + /// 1涓虹鑱岋紝0涓烘甯稿憳宸� + /// </summary> + [Column("ISDEPARTURE")] + [SugarColumn(ColumnName = "ISDEPARTURE")] //鐢ㄤ簬SqlSugar + public decimal? Isdeparture { get; set; } + + /// <summary> + /// 鏄惁涓虹鐞嗕汉鍛� + /// </summary> + [Column("ISMANAGER")] + [SugarColumn(ColumnName = "ISMANAGER")] //鐢ㄤ簬SqlSugar + public decimal? Ismanager { get; set; } + + /// <summary> + /// </summary> + [Column("LASTLOGIN")] + [SugarColumn(ColumnName = "LASTLOGIN")] //鐢ㄤ簬SqlSugar + public DateTime? Lastlogin { get; set; } + + /// <summary> + /// 鏈�鍚庢洿鏂颁汉 + /// </summary> + [Column("LASTUPDATE_BY")] + [SugarColumn(ColumnName = "LASTUPDATE_BY")] //鐢ㄤ簬SqlSugar + [StringLength(30, ErrorMessage = "鏈�鍚庢洿鏂颁汉闀垮害涓嶈兘瓒呭嚭30")] + public string LastupdateBy { get; set; } + + /// <summary> + /// 鏈�鍚庢洿鏂版棩鏈� + /// </summary> + [Column("LASTUPDATE_DATE")] + [SugarColumn(ColumnName = "LASTUPDATE_DATE")] //鐢ㄤ簬SqlSugar + public DateTime? LastupdateDate { get; set; } + + /// <summary> + /// 1涓哄紑鍙戠敤鎴凤紝0涓轰竴鑸搷浣滅敤鎴� + /// </summary> + [Column("LEVER")] + [SugarColumn(ColumnName = "LEVER")] //鐢ㄤ簬SqlSugar + public decimal? Lever { get; set; } + + /// <summary> + /// 鏈夋晥鏈� + /// </summary> + [Column("PERIOD_VALIDITY")] + [SugarColumn(ColumnName = "PERIOD_VALIDITY")] //鐢ㄤ簬SqlSugar + public DateTime? PeriodValidity { get; set; } + + /// <summary> + /// </summary> + [Column("PRD")] + [SugarColumn(ColumnName = "PRD")] //鐢ㄤ簬SqlSugar + public decimal? Prd { get; set; } + + /// <summary> + /// </summary> + [Column("PSW_EDIT_TIME")] + [SugarColumn(ColumnName = "PSW_EDIT_TIME")] //鐢ㄤ簬SqlSugar + public DateTime? PswEditTime { get; set; } + + /// <summary> + /// 璐ㄩ噺妯″潡棣栦欢纭-鍘熷洜鍒嗘瀽璐d换浜� + /// </summary> + [Column("QM_USER")] + [SugarColumn(ColumnName = "QM_USER")] //鐢ㄤ簬SqlSugar + public decimal? QmUser { get; set; } + + /// <summary> + /// 瑙掕壊 + /// </summary> + [Column("ROLEID")] + [SugarColumn(ColumnName = "ROLEID")] //鐢ㄤ簬SqlSugar + public decimal? Roleid { get; set; } + + /// <summary> + /// 鏄惁涓轰复鏃剁敤鎴� + /// </summary> + [Column("STATUS")] + [SugarColumn(ColumnName = "STATUS")] //鐢ㄤ簬SqlSugar + public decimal? Status { get; set; } + + /// <summary> + /// </summary> + [Column("TET")] + [SugarColumn(ColumnName = "TET")] //鐢ㄤ簬SqlSugar + public decimal? Tet { get; set; } + + [SugarColumn(IsIgnore = true)] public string? Type { get; set; } +} \ No newline at end of file diff --git a/MES.Service/service/BasicData/MesCustomerManager.cs b/MES.Service/service/BasicData/MesCustomerManager.cs new file mode 100644 index 0000000..2965234 --- /dev/null +++ b/MES.Service/service/BasicData/MesCustomerManager.cs @@ -0,0 +1,203 @@ +锘縰sing MES.Service.DB; +using MES.Service.Dto.webApi; +using MES.Service.Modes; +using SqlSugar; + +namespace MES.Service.service.BasicData; + +public class MesCustomerManager : Repository<MesCustomer> +{ + public bool Save(ErpCustomer customer) + { + var entity = GetSysDepartment(customer); + + return UseTransaction(db => + { + switch (customer.Type) + { + case "0": + if (UpdateCustomerStatus(db, entity.Id, "A")) + return 1; + break; + case "1": + if (UpdateCustomerStatus(db, entity.Id, "B")) + return 1; + break; + case "2": + if (InsertCustomer(db, entity)) + return 1; + break; + case "3": + if (DeleteCustomer(db, entity.Id)) + return 1; + break; + case "4": + if (InsertOrUpdate(db, entity)) + return 1; + break; + default: + throw new ArgumentNullException( + $"type娌℃湁{customer.Type}杩欎釜绫诲瀷鐨勫弬鏁�"); + } + + throw new NotImplementedException("鎿嶄綔澶辫触"); + }) > 0; + } + + public bool SaveList(List<ErpCustomer> customers) + { + var list = customers.Select(GetSysDepartment).ToList(); + var groupBy = list.GroupBy(s => s.Type) + .ToDictionary(g => g.Key, g => g.ToList()); + + return UseTransaction(db => + { + foreach (var customerGroup in groupBy) + switch (customerGroup.Key) + { + case "0": + if (!UpdateCustomerStatusBatch(db, customerGroup.Value, + "A")) + throw new NotImplementedException("鍚敤澶辫触"); + break; + case "1": + if (!UpdateCustomerStatusBatch(db, customerGroup.Value, + "B")) + throw new NotImplementedException("绂佺敤澶辫触"); + break; + case "2": + if (!InsertCustomerBatch(db, customerGroup.Value)) + throw new NotImplementedException("鎻掑叆澶辫触"); + break; + case "3": + if (!DeleteCustomerBatch(db, customerGroup.Value)) + throw new NotImplementedException("鍒犻櫎澶辫触"); + break; + case "4": + if (!InsertOrUpdateBatch(db, customerGroup.Value)) + throw new NotImplementedException("鍚屾澶辫触"); + break; + default: + throw new ArgumentNullException( + $"type娌℃湁{customerGroup.Key}杩欎釜绫诲瀷鐨勫弬鏁�"); + } + + return 1; + }) > 0; + } + + private bool UpdateCustomerStatus(SqlSugarScope db, decimal customerId, + string status) + { + var result = db.Updateable<MesCustomer>() + .SetColumns(s => s.Fforbidstatus == status) + .Where(s => s.Id == customerId).ExecuteCommand(); + + if (result > 0) + return true; + + throw new NotImplementedException(status == "A" ? "鍚敤澶辫触" : "绂佺敤澶辫触"); + } + + private bool InsertCustomer(SqlSugarScope db, MesCustomer entity) + { + var insert = db.Insertable(entity).ExecuteCommand(); + if (insert > 0) + return true; + + throw new NotImplementedException("鎻掑叆澶辫触"); + } + + private bool DeleteCustomer(SqlSugarScope db, decimal customerId) + { + var deleteById = db.Deleteable<MesCustomer>().In(customerId) + .ExecuteCommand(); + if (deleteById > 0) + return true; + + throw new NotImplementedException("鍒犻櫎澶辫触"); + } + + private MesCustomer GetSysDepartment(ErpCustomer customer) + { + //ERP鍌宠几鐨勬帴鍙f暩鎿氳綁鎻涚偤MES鏁告摎搴瓧娈� + + return new MesCustomer + { + Id = Convert.ToDecimal(customer.Id), + CustNo = customer.FNumber, + CustSname = customer.FShortName, + CustName = customer.FName, + Anred = customer.FTContact, + Telf1 = customer.Fmobilephone, + Fseller = customer.Fseller, + Fforbidstatus = customer.FForbidStatus, + Remark = customer.FDescription, + FSubsidiary = customer.FUseOrgId, + Fumbrella = customer.FCreateOrgId, + CreateDate = DateTime.Now, + LastupdateDate = DateTime.Now, + Company = "1000", + Factory = "1000", + DataType = customer.FDocumentStatus + }; + } + + private bool UpdateCustomerStatusBatch(SqlSugarScope db, + List<MesCustomer> customerList, string status) + { + var ids = customerList.Select(it => it.Id).ToArray(); + var result = db.Updateable<MesCustomer>() + .SetColumns(s => s.Fforbidstatus == status) + .Where(s => ids.Contains(s.Id)).ExecuteCommand(); + + if (result > 0) + return true; + + throw new NotImplementedException(status == "A" ? "鍚敤澶辫触" : "绂佺敤澶辫触"); + } + + private bool InsertCustomerBatch(SqlSugarScope db, + List<MesCustomer> customerList) + { + var insertRange = db.Insertable(customerList).ExecuteCommand(); + if (insertRange > 0) + return true; + + throw new NotImplementedException("鎻掑叆澶辫触"); + } + + private bool DeleteCustomerBatch(SqlSugarScope db, + List<MesCustomer> customerList) + { + var ids = customerList.Select(it => it.Id).ToArray(); + var deleteByIds = db.Deleteable<MesCustomer>().In(ids).ExecuteCommand(); + if (deleteByIds > 0) + return true; + + throw new NotImplementedException("鍒犻櫎澶辫触"); + } + + private bool InsertOrUpdate(SqlSugarScope db, MesCustomer entity) + { + db.Deleteable<MesCustomer>().Where(s => s.Id == entity.Id) + .ExecuteCommand(); + + var insert = db.Insertable(entity).ExecuteCommand(); + + if (insert > 0) + return true; + + return false; + } + + private bool InsertOrUpdateBatch(SqlSugarScope db, + List<MesCustomer> customerList) + { + foreach (var entity in customerList) + if (!InsertOrUpdate(db, entity)) + return false; + + return true; + } +} \ No newline at end of file diff --git a/MES.Service/service/BasicData/MesDepotsManager.cs b/MES.Service/service/BasicData/MesDepotsManager.cs new file mode 100644 index 0000000..f495080 --- /dev/null +++ b/MES.Service/service/BasicData/MesDepotsManager.cs @@ -0,0 +1,228 @@ +锘縰sing Castle.Core.Resource; +using MES.Service.DB; +using MES.Service.Dto.webApi; +using MES.Service.Modes; +using SqlSugar; + +namespace MES.Service.service.BasicData; + +public class MesDepotsManager : Repository<MesDepots> +{ + // Save 鏂规硶鐢ㄤ簬淇濆瓨鍗曚釜浠撳簱璁板綍锛屾牴鎹被鍨嬫墽琛屼笉鍚岀殑鎿嶄綔 + public bool Save(ErpDepots depots) + { + var entity = GetMesDepots(depots); // 灏� ErpDepots 杞崲涓� MesDepots + return UseTransaction(db => + { + switch (depots.Type) + { + case "0": + if (UpdateDepotStatus(db, entity.DepotId, "A")) return 1; + + break; + case "1": + if (UpdateDepotStatus(db, entity.DepotId, "B")) return 1; + + break; + case "2": + if (InsertDepot(db, entity)) return 1; + + break; + case "3": + if (DeleteDepot(db, entity.DepotId)) return 1; + + break; + case "4": + if (InsertOrUpdate(db, entity)) return 1; + + break; + default: + throw new ArgumentNullException( + $"type娌℃湁{depots.Type}杩欎釜绫诲瀷鐨勫弬鏁�"); + } + + throw new NotImplementedException("鎿嶄綔澶辫触"); + }) > 0; + } + + // 鏇存柊浠撳簱鐘舵�佺殑鏂规硶 + private bool UpdateDepotStatus(SqlSugarScope db, decimal depotId, + string status) + { + var result = db.Updateable<MesDepots>() + .SetColumns(s => s.IsNg == status) + .Where(s => s.DepotId == depotId).ExecuteCommand(); + + if (result > 0) + return true; + + throw new NotImplementedException(status == "A" ? "鍚敤澶辫触" : "绂佺敤澶辫触"); + } + + // 鎻掑叆鏂颁粨搴撶殑鏂规硶 + private bool InsertDepot(SqlSugarScope db, MesDepots entity) + { + var insert = db.Insertable(entity).ExecuteCommand(); + if (insert > 0) + return true; + + throw new NotImplementedException("瀹℃牳澶辫触"); + } + + // 鍒犻櫎浠撳簱鐨勬柟娉� + private bool DeleteDepot(SqlSugarScope db, decimal depotId) + { + var deleteById = db.Deleteable<MesDepots>().In(depotId) + .ExecuteCommand(); + if (deleteById > 0) + return true; + + throw new NotImplementedException("鍙嶅鏍稿け璐�"); + } + + // 鎻掑叆鎴栨洿鏂颁粨搴撶殑鏂规硶 + private bool InsertOrUpdate(SqlSugarScope db, MesDepots entity) + { + var exists = db.Queryable<MesDepots>() + .Any(e => e.DepotId == entity.DepotId); + if (exists) + { + var update = db.Updateable(entity).ExecuteCommand(); + if (update > 0) + return true; + } + else + { + var insert = db.Insertable(entity).ExecuteCommand(); + if (insert > 0) + return true; + } + + return false; + } + + // 灏� ErpDepots 瀵硅薄杞崲涓� MesDepots 瀵硅薄鐨勬柟娉� + private MesDepots GetMesDepots(ErpDepots depots) + { + return new MesDepots + { + DepotCode = depots.FNumber, + DepotName = depots.FName, + DepotId = Convert.ToDecimal(depots.Id), + IsFkc = depots.FAllowMinusQty, + CreateBy = depots.FPrincipal, + Depottype = depots.FStockProperty, + IsNg = depots.FForbidStatus, + Zuid = depots.FGroup, + FSubsidiary = depots.FUseOrgId, + Fumbrella = depots.FCreateOrgId, + + CreateDate = DateTime.Now, + LastupdateDate = DateTime.Now, + Company = "1000", + Factory = "1000" + }; + } + + // SaveList 鏂规硶鐢ㄤ簬淇濆瓨澶氫釜浠撳簱璁板綍锛屾牴鎹被鍨嬫壒閲忔墽琛屼笉鍚岀殑鎿嶄綔 + public bool SaveList(List<ErpDepots> erpDepots) + { + var list = new List<MesDepots>(); + erpDepots.ForEach(s => + { + var entity = GetMesDepots(s); // 灏� ErpDepots 杞崲涓� MesDepots + entity.Type = s.Type; + list.Add(entity); + }); + + var groupBy = list.GroupBy(s => s.Type) + .ToDictionary(g => g.Key, g => g.ToList()); + return UseTransaction(db => + { + foreach (var depotsGroup in groupBy) + switch (depotsGroup.Key) + { + case "0": + if (!UpdateDepotStatusBatch(db, depotsGroup.Value, + "A")) // 鎵归噺鍚敤浠撳簱 + throw new NotImplementedException("鍚敤澶辫触"); + break; + case "1": + if (!UpdateDepotStatusBatch(db, depotsGroup.Value, + "B")) // 鎵归噺绂佺敤浠撳簱 + throw new NotImplementedException("绂佺敤澶辫触"); + break; + case "2": + if (!InsertDepotBatch(db, + depotsGroup.Value)) // 鎵归噺鎻掑叆浠撳簱 + throw new NotImplementedException("鎻掑叆澶辫触"); + break; + case "3": + if (!DeleteDepotBatch(db, + depotsGroup.Value)) // 鎵归噺鍒犻櫎浠撳簱 + throw new NotImplementedException("鍒犻櫎澶辫触"); + break; + case "4": + if (!InsertOrUpdateBatch(db, + depotsGroup.Value)) // 鎵归噺鎻掑叆鎴栨洿鏂颁粨搴� + throw new NotImplementedException("鍚屾澶辫触"); + break; + default: + throw new ArgumentNullException( + $"type娌℃湁{depotsGroup.Key}杩欎釜绫诲瀷鐨勫弬鏁�"); + } + + return 1; + }) > 0; + } + + // 鎵归噺鏇存柊浠撳簱鐘舵�佺殑鏂规硶 + private bool UpdateDepotStatusBatch(SqlSugarScope db, + List<MesDepots> depotList, string status) + { + var ids = depotList.Select(it => it.DepotId).ToArray(); + var result = db.Updateable<MesDepots>() + .SetColumns(s => s.IsNg == status) + .Where(s => ids.Contains(s.DepotId)).ExecuteCommand(); + + if (result > 0) + return true; + + throw new NotImplementedException(status == "A" ? "鍚敤澶辫触" : "绂佺敤澶辫触"); + } + + // 鎵归噺鎻掑叆浠撳簱鐨勬柟娉� + private bool InsertDepotBatch(SqlSugarScope db, + List<MesDepots> depotList) + { + var insertRange = db.Insertable(depotList).ExecuteCommand(); + if (insertRange > 0) + return true; + + throw new NotImplementedException("瀹℃牳澶辫触"); + } + + // 鎵归噺鍒犻櫎浠撳簱鐨勬柟娉� + private bool DeleteDepotBatch(SqlSugarScope db, + List<MesDepots> depotList) + { + var ids = depotList.Select(it => it.DepotId).ToArray(); + var deleteByIds = + db.Deleteable<MesDepots>().In(ids).ExecuteCommand(); + if (deleteByIds > 0) + return true; + + throw new NotImplementedException("鍙嶅鏍稿け璐�"); + } + + // 鎵归噺鎻掑叆鎴栨洿鏂颁粨搴撶殑鏂规硶 + private bool InsertOrUpdateBatch(SqlSugarScope db, + List<MesDepots> depotList) + { + foreach (var entity in depotList) + if (!InsertOrUpdate(db, entity)) + return false; + + return true; + } +} \ No newline at end of file diff --git a/MES.Service/service/BasicData/MesItemTypeManager.cs b/MES.Service/service/BasicData/MesItemTypeManager.cs new file mode 100644 index 0000000..5059669 --- /dev/null +++ b/MES.Service/service/BasicData/MesItemTypeManager.cs @@ -0,0 +1,132 @@ +锘縰sing Castle.Core.Resource; +using MES.Service.DB; +using MES.Service.Dto.webApi; +using MES.Service.Modes; + +namespace MES.Service.service.BasicData; + +public class MesItemTypeManager : Repository<MesItemType> +{ + //褰撳墠绫诲凡缁忕户鎵夸簡 Repository 澧炪�佸垹銆佹煡銆佹敼鐨勬柟娉� + public bool Save(ErpItemType customer) + { + var entity = GetMesItemType(customer); + + try + { + switch (customer.Type) + { + case "0": + return InsertItemType(entity); + case "1": + return DeleteItemType(entity.Id); + default: + throw new ArgumentNullException( + $"type娌℃湁{customer.Type}杩欎釜绫诲瀷鐨勫弬鏁�"); + } + } + catch (Exception ex) + { + throw new ApplicationException($"鎿嶄綔澶辫触: {ex.Message}", ex); + } + } + + private bool InsertItemType(MesItemType entity) + { + var insert = base.Insert(entity); + if (insert) + return true; + + throw new NotImplementedException("鎻掑叆澶辫触"); + } + + private bool DeleteItemType(decimal id) + { + var deleteById = base.DeleteById(id); + if (deleteById) + return true; + + throw new NotImplementedException("鍒犻櫎澶辫触"); + } + + private MesItemType GetMesItemType(ErpItemType department) + { + return new MesItemType + { + Id = Convert.ToDecimal(department.Id), + Pgroup = department.FPARENTID, + Tcode = department.FNumber, + Tname = department.FName, + Description = department.FDescription, + //FSubsidiary = department.FSubsidiary, + //Fumbrella = department.Fumbrella, + CreateDate = DateTime.Now, + LastupdateDate = DateTime.Now, + Company = "1000", + Factory = "1000" + }; + } + + public bool SaveList(List<ErpItemType> departments) + { + var list = new List<MesItemType>(); + departments.ForEach(s => + { + var entity = GetMesItemType(s); + entity.Type = s.Type; + list.Add(entity); + }); + + var groupBy = list.GroupBy(s => s.Type) + .ToDictionary(g => g.Key, g => g.ToList()); + var result = new List<bool>(); + + foreach (var itemTypeGroup in groupBy) + try + { + switch (itemTypeGroup.Key) + { + case "0": + result.Add(InsertItemTypeBatch(itemTypeGroup.Value)); + break; + case "1": + result.Add(DeleteItemTypeBatch(itemTypeGroup.Value)); + break; + default: + throw new ArgumentNullException( + $"type娌℃湁{itemTypeGroup.Key}杩欎釜绫诲瀷鐨勫弬鏁�"); + } + } + catch (Exception ex) + { + throw new ApplicationException($"鎵归噺鎿嶄綔澶辫触: {ex.Message}", ex); + } + + if (result.All(b => b)) + return true; + + throw new NotImplementedException("鎺ュ彛鎵ц澶辫触"); + } + + private bool InsertItemTypeBatch(List<MesItemType> itemTypeList) + { + var insertRange = base.InsertRange(itemTypeList); + if (insertRange) + return true; + + throw new NotImplementedException("鎻掑叆澶辫触"); + } + + private bool DeleteItemTypeBatch(List<MesItemType> itemTypeList) + { + var ids = itemTypeList.Select(it => it.Id).ToArray(); + + var deleteByIds = Db.Deleteable<MesItemType>() + .Where(s => ids.Contains(s.Id)).ExecuteCommand(); + + if (deleteByIds > 0) + return true; + + throw new NotImplementedException("鍒犻櫎澶辫触"); + } +} \ No newline at end of file diff --git a/MES.Service/service/BasicData/MesItemsManager.cs b/MES.Service/service/BasicData/MesItemsManager.cs new file mode 100644 index 0000000..933b47e --- /dev/null +++ b/MES.Service/service/BasicData/MesItemsManager.cs @@ -0,0 +1,206 @@ +锘縰sing MES.Service.DB; +using MES.Service.Dto.webApi; +using MES.Service.Modes; +using SqlSugar; + +namespace MES.Service.service.BasicData; + +public class MesItemsManager : Repository<MesItems> +{ + public bool Save(ErpItems item) + { + var entity = GetMesItems(item); + + return UseTransaction(db => + { + switch (item.Type) + { + case "0": + if (UpdateItemStatus(db, entity.Id, "A")) + return 1; + break; + case "1": + if (UpdateItemStatus(db, entity.Id, "B")) + return 1; + break; + case "2": + if (InsertItem(db, entity)) + return 1; + break; + case "3": + if (DeleteItem(db, entity.Id)) + return 1; + break; + case "4": + if (InsertOrUpdate(db, entity)) + return 1; + break; + default: + throw new ArgumentNullException( + $"type娌℃湁{item.Type}杩欎釜绫诲瀷鐨勫弬鏁�"); + } + + throw new NotImplementedException("鎿嶄綔澶辫触"); + }) > 0; + } + + public bool SaveList(List<ErpItems> items) + { + var list = items.Select(GetMesItems).ToList(); + var groupBy = list.GroupBy(s => s.Type) + .ToDictionary(g => g.Key, g => g.ToList()); + + return UseTransaction(db => + { + foreach (var itemGroup in groupBy) + switch (itemGroup.Key) + { + case "0": + if (!UpdateItemStatusBatch(db, itemGroup.Value, "A")) + throw new NotImplementedException("鍚敤澶辫触"); + break; + case "1": + if (!UpdateItemStatusBatch(db, itemGroup.Value, "B")) + throw new NotImplementedException("绂佺敤澶辫触"); + break; + case "2": + if (!InsertItemBatch(db, itemGroup.Value)) + throw new NotImplementedException("鎻掑叆澶辫触"); + break; + case "3": + if (!DeleteItemBatch(db, itemGroup.Value)) + throw new NotImplementedException("鍒犻櫎澶辫触"); + break; + case "4": + if (!InsertOrUpdateBatch(db, itemGroup.Value)) + throw new NotImplementedException("鍚屾澶辫触"); + break; + default: + throw new ArgumentNullException( + $"type娌℃湁{itemGroup.Key}杩欎釜绫诲瀷鐨勫弬鏁�"); + } + + return 1; + }) > 0; + } + + private bool UpdateItemStatus(SqlSugarScope db, decimal itemId, + string status) + { + var result = db.Updateable<MesItems>() + .SetColumns(s => s.Fforbidstatus == status) + .Where(s => s.Id == itemId).ExecuteCommand(); + + if (result > 0) + return true; + + throw new NotImplementedException(status == "A" ? "鍚敤澶辫触" : "绂佺敤澶辫触"); + } + + private bool InsertItem(SqlSugarScope db, MesItems entity) + { + var insert = db.Insertable(entity).ExecuteCommand(); + if (insert > 0) + return true; + + throw new NotImplementedException("鎻掑叆澶辫触"); + } + + private bool DeleteItem(SqlSugarScope db, decimal itemId) + { + var deleteById = db.Deleteable<MesItems>().In(itemId).ExecuteCommand(); + if (deleteById > 0) + return true; + + throw new NotImplementedException("鍒犻櫎澶辫触"); + } + + private MesItems GetMesItems(ErpItems item) + { + return new MesItems + { + Id = Convert.ToDecimal(item.Id), + Type = item.Type, + ItemNo = item.FNumber, + ItemName = item.FName, + ItemModel = item.FSpecification, + ItemUnit = item.FBaseUnitId, + Lowlimit = Convert.ToDouble(item.FSafeStock), + Highlimit = Convert.ToDouble(item.FMaxStock), + PrdPack = Convert.ToDouble(item.FMinPackCount), + DepotCode = item.FStockId, + Fmaterialgroup = item.FMaterialGroup, + Remarks = item.FDescription, + Ffinishreceiptoverrate = + Convert.ToDecimal(item.FFinishReceiptOverRate), + Fissuetype = item.FIssueType, + Fisbatchmanage = Convert.ToInt32(item.FIsBatchManage), + Fpurchaserid = item.FPurchaserId, + Fpurchaseunitid = Convert.ToDecimal(item.FPurchaseUnitId), + Storeunit = item.FStoreUnitID, + Saleunit = item.FSaleUnitId, + Fforbidstatus = item.FForbidStatus, + MaterialProperti = item.FErpClsID, + ProductionWorkshop = item.FWorkShopId, + ProduceUnit = item.FPRODUCEUNITID, + SubconUnit = item.FSUBCONUNITID, + FSubsidiary = item.FUseOrgId, + Fumbrella = item.FCreateOrgId, + LastupdateDate = DateTime.Now, + CreateDate = DateTime.Now, + Company = "1000", + Factory = "1000" + }; + } + + private bool UpdateItemStatusBatch(SqlSugarScope db, + List<MesItems> itemList, string status) + { + var ids = itemList.Select(it => it.Id).ToArray(); + var result = db.Updateable<MesItems>() + .SetColumns(s => s.Fforbidstatus == status) + .Where(s => ids.Contains(s.Id)).ExecuteCommand(); + + if (result > 0) + return true; + + throw new NotImplementedException(status == "A" ? "鍚敤澶辫触" : "绂佺敤澶辫触"); + } + + private bool InsertItemBatch(SqlSugarScope db, List<MesItems> itemList) + { + var insertRange = db.Insertable(itemList).ExecuteCommand(); + if (insertRange > 0) + return true; + + throw new NotImplementedException("鎻掑叆澶辫触"); + } + + private bool DeleteItemBatch(SqlSugarScope db, List<MesItems> itemList) + { + var ids = itemList.Select(it => it.Id).ToArray(); + var deleteByIds = db.Deleteable<MesItems>().In(ids).ExecuteCommand(); + if (deleteByIds > 0) + return true; + + throw new NotImplementedException("鍒犻櫎澶辫触"); + } + + private bool InsertOrUpdate(SqlSugarScope db, MesItems entity) + { + db.Deleteable<MesItems>().Where(s => s.Id == entity.Id) + .ExecuteCommand(); + + var insert = db.Insertable(entity).ExecuteCommand(); + return insert > 0; + } + + private bool InsertOrUpdateBatch(SqlSugarScope db, List<MesItems> itemList) + { + foreach (var entity in itemList) + if (!InsertOrUpdate(db, entity)) + return false; + + return true; + } +} \ No newline at end of file diff --git a/MES.Service/service/BasicData/MesPositionManager.cs b/MES.Service/service/BasicData/MesPositionManager.cs new file mode 100644 index 0000000..5cd83e4 --- /dev/null +++ b/MES.Service/service/BasicData/MesPositionManager.cs @@ -0,0 +1,220 @@ +锘縰sing Castle.Core.Resource; +using MES.Service.DB; +using MES.Service.Dto.webApi; +using MES.Service.Modes; +using SqlSugar; + +namespace MES.Service.service.BasicData; + +public class MesPositionManager : Repository<MesPosition> +{ + // 褰撳墠绫诲凡缁忕户鎵夸簡 Repository 澧炪�佸垹銆佹煡銆佹敼鐨勬柟娉� + + // Save 鏂规硶鐢ㄤ簬淇濆瓨鍗曚釜宀椾綅璁板綍锛屾牴鎹被鍨嬫墽琛屼笉鍚岀殑鎿嶄綔 + public bool Save(ErpPosition unit) + { + var entity = GetMesPosition(unit); // 灏� ErpPosition 杞崲涓� MesPosition + return UseTransaction(db => + { + switch (unit.Type) + { + case "0": + if (UpdatePositionStatus(db, entity.Id, "A")) // 鍚敤宀椾綅 + return 1; + break; + case "1": + if (UpdatePositionStatus(db, entity.Id, "B")) // 绂佺敤宀椾綅 + return 1; + break; + case "2": + if (InsertOrUpdatePosition(db, entity)) // 鎻掑叆鎴栨洿鏂板矖浣� + return 1; + break; + case "3": + if (DeletePosition(db, entity.Id)) // 鍒犻櫎宀椾綅 + return 1; + break; + case "4": + if (InsertOrUpdatePosition(db, entity)) // 鎻掑叆鎴栨洿鏂板矖浣� + return 1; + break; + default: + throw new ArgumentNullException( + $"type娌℃湁{unit.Type}杩欎釜绫诲瀷鐨勫弬鏁�"); + } + + throw new NotImplementedException("鎿嶄綔澶辫触"); + }) > 0; + } + + // 鏇存柊宀椾綅鐘舵�佺殑鏂规硶 + private bool UpdatePositionStatus(SqlSugarScope db, decimal positionId, + string status) + { + var result = db.Updateable<MesPosition>() + .SetColumns(s => s.Fforbidstatus == status) + .Where(s => s.Id == positionId).ExecuteCommand(); + + if (result > 0) + return true; + + throw new NotImplementedException(status == "A" ? "鍚敤澶辫触" : "绂佺敤澶辫触"); + } + + // 鎻掑叆鎴栨洿鏂板矖浣嶇殑鏂规硶 + private bool InsertOrUpdatePosition(SqlSugarScope db, MesPosition entity) + { + var exists = db.Queryable<MesPosition>().Any(e => e.Id == entity.Id); + if (exists) + { + var update = db.Updateable(entity).ExecuteCommand(); + if (update > 0) + return true; + } + else + { + var insert = db.Insertable(entity).ExecuteCommand(); + if (insert > 0) + return true; + } + + return false; + } + + // 鍒犻櫎宀椾綅鐨勬柟娉� + private bool DeletePosition(SqlSugarScope db, decimal positionId) + { + var deleteById = db.Deleteable<MesPosition>().In(positionId) + .ExecuteCommand(); + if (deleteById > 0) + return true; + + throw new NotImplementedException("鍒犻櫎澶辫触"); + } + + // 灏� ErpPosition 瀵硅薄杞崲涓� MesPosition 瀵硅薄鐨勬柟娉� + private MesPosition GetMesPosition(ErpPosition position) + { + return new MesPosition + { + Id = Convert.ToDecimal(position.Id), + PositionId = position.FNumber, + PositionName = position.FName, + PositionDescription = position.FDESCRIPTIONS, + Department = position.FDept, + Fforbidstatus = position.FForbidStatus, + FUseOrgId = position.FUseOrgId, + FCreateOrgId = position.FCreateOrgId, + CreationDate = position.FCreateDate != null + ? DateTime.ParseExact(position.FCreateDate, + "yyyy-MM-dd HH:mm:ss", null) + : null, + DisabledBy = position.FForbidderId, + DisabledDate = position.FForbidDate != null + ? DateTime.ParseExact(position.FForbidDate, + "yyyy-MM-dd HH:mm:ss", null) + : null + }; + } + + // SaveList 鏂规硶鐢ㄤ簬淇濆瓨澶氫釜宀椾綅璁板綍锛屾牴鎹被鍨嬫壒閲忔墽琛屼笉鍚岀殑鎿嶄綔 + public bool SaveList(List<ErpPosition> positions) + { + var list = new List<MesPosition>(); + positions.ForEach(s => + { + var entity = GetMesPosition(s); // 灏� ErpPosition 杞崲涓� MesPosition + entity.Type = s.Type; + list.Add(entity); + }); + + var groupBy = list.GroupBy(s => s.Type) + .ToDictionary(g => g.Key, g => g.ToList()); + return UseTransaction(db => + { + foreach (var positionGroup in groupBy) + switch (positionGroup.Key) + { + case "0": + if (!UpdatePositionStatusBatch(db, positionGroup.Value, + "A")) // 鎵归噺鍚敤宀椾綅 + throw new NotImplementedException("鍚敤澶辫触"); + break; + case "1": + if (!UpdatePositionStatusBatch(db, positionGroup.Value, + "B")) // 鎵归噺绂佺敤宀椾綅 + throw new NotImplementedException("绂佺敤澶辫触"); + break; + case "2": + if (!InsertPositionBatch(db, + positionGroup.Value)) // 鎵归噺鎻掑叆宀椾綅 + throw new NotImplementedException("鎻掑叆澶辫触"); + break; + case "3": + if (!DeletePositionBatch(db, + positionGroup.Value)) // 鎵归噺鍒犻櫎宀椾綅 + throw new NotImplementedException("鍒犻櫎澶辫触"); + break; + case "4": + if (!InsertOrUpdatePositionBatch(db, + positionGroup.Value)) // 鎵归噺鎻掑叆鎴栨洿鏂板矖浣� + throw new NotImplementedException("鍚屾澶辫触"); + break; + default: + throw new ArgumentNullException( + $"type娌℃湁{positionGroup.Key}杩欎釜绫诲瀷鐨勫弬鏁�"); + } + + return 1; + }) > 0; + } + + // 鎵归噺鏇存柊宀椾綅鐘舵�佺殑鏂规硶 + private bool UpdatePositionStatusBatch(SqlSugarScope db, + List<MesPosition> positionList, string status) + { + var ids = positionList.Select(it => it.Id).ToArray(); + var result = db.Updateable<MesPosition>() + .SetColumns(s => s.Fforbidstatus == status) + .Where(s => ids.Contains(s.Id)).ExecuteCommand(); + + if (result > 0) + return true; + + throw new NotImplementedException(status == "A" ? "鍚敤澶辫触" : "绂佺敤澶辫触"); + } + + // 鎵归噺鎻掑叆宀椾綅鐨勬柟娉� + private bool InsertPositionBatch(SqlSugarScope db, + List<MesPosition> positionList) + { + var insertRange = db.Insertable(positionList).ExecuteCommand(); + if (insertRange > 0) + return true; + + throw new NotImplementedException("鎻掑叆澶辫触"); + } + + // 鎵归噺鍒犻櫎宀椾綅鐨勬柟娉� + private bool DeletePositionBatch(SqlSugarScope db, + List<MesPosition> positionList) + { + var ids = positionList.Select(it => it.Id).ToArray(); + var deleteByIds = db.Deleteable<MesPosition>().In(ids).ExecuteCommand(); + if (deleteByIds > 0) + return true; + + throw new NotImplementedException("鍒犻櫎澶辫触"); + } + + // 鎵归噺鎻掑叆鎴栨洿鏂板矖浣嶇殑鏂规硶 + private bool InsertOrUpdatePositionBatch(SqlSugarScope db, + List<MesPosition> positionList) + { + foreach (var entity in positionList) + if (!InsertOrUpdatePosition(db, entity)) + return false; + + return true; + } +} \ No newline at end of file diff --git a/MES.Service/service/BasicData/MesRohInDataManager.cs b/MES.Service/service/BasicData/MesRohInDataManager.cs new file mode 100644 index 0000000..7385023 --- /dev/null +++ b/MES.Service/service/BasicData/MesRohInDataManager.cs @@ -0,0 +1,78 @@ +锘縰sing MES.Service.DB; +using MES.Service.Modes; +using SqlSugar; + +namespace MES.Service.service.BasicData; + +public class MesRohInDataManager : Repository<MesRohInData> +{ + //褰撳墠绫诲凡缁忕户鎵夸簡 Repository 澧炪�佸垹銆佹煡銆佹敼鐨勬柟娉� + + //杩欓噷闈㈠啓鐨勪唬鐮佷笉浼氱粰瑕嗙洊,濡傛灉瑕侀噸鏂扮敓鎴愯鍒犻櫎 MesRohInDataManager.cs + + + #region 鏁欏鏂规硶 + + /// <summary> + /// 浠撳偍鏂规硶婊¤冻涓嶄簡澶嶆潅涓氬姟闇�姹傦紝涓氬姟浠g爜璇峰湪杩欓噷闈㈠畾涔夋柟娉� + /// </summary> + public void Study() + { + /*********鏌ヨ*********/ + + var data1 = base.GetById(1); //鏍规嵁ID鏌ヨ + var data2 = base.GetList(); //鏌ヨ鎵�鏈� + var data3 = base.GetList(it => 1 == 1); //鏍规嵁鏉′欢鏌ヨ + //var data4 = base.GetSingle(it => 1 == 1);//鏍规嵁鏉′欢鏌ヨ涓�鏉�,濡傛灉瓒呰繃涓�鏉′細鎶ラ敊 + + var p = new PageModel { PageIndex = 1, PageSize = 2 }; // 鍒嗛〉鏌ヨ + var data5 = base.GetPageList(it => 1 == 1, p); + Console.Write(p.TotalCount); //杩斿洖鎬绘暟 + + var data6 = + base.GetPageList(it => 1 == 1, p, + it => SqlFunc.GetRandom()); // 鍒嗛〉鏌ヨ鍔犳帓搴� + Console.Write(p.TotalCount); //杩斿洖鎬绘暟 + + var conModels = new List<IConditionalModel>(); //缁勮鏉′欢鏌ヨ浣滀负鏉′欢瀹炵幇 鍒嗛〉鏌ヨ鍔犳帓搴� + conModels.Add(new ConditionalModel + { + FieldName = typeof(MesRohInData).GetProperties()[0].Name, + ConditionalType = ConditionalType.Equal, FieldValue = "1" + }); //id=1 + var data7 = base.GetPageList(conModels, p, it => SqlFunc.GetRandom()); + + AsQueryable().Where(x => 1 == 1) + .ToList(); //鏀寔浜嗚浆鎹㈡垚queryable,鎴戜滑鍙互鐢╭ueryable瀹炵幇澶嶆潅鍔熻兘 + + + /*********鎻掑叆*********/ + var insertData = new MesRohInData(); //娴嬭瘯鍙傛暟 + var insertArray = new[] { insertData }; + base.Insert(insertData); //鎻掑叆 + base.InsertRange(insertArray); //鎵归噺鎻掑叆 + var id = base.InsertReturnIdentity(insertData); //鎻掑叆杩斿洖鑷鍒� + AsInsertable(insertData).ExecuteCommand(); //鎴戜滑鍙互杞垚 Insertable瀹炵幇澶嶆潅鎻掑叆 + + + /*********鏇存柊*********/ + var updateData = new MesRohInData(); //娴嬭瘯鍙傛暟 + var updateArray = new[] { updateData }; //娴嬭瘯鍙傛暟 + base.Update(updateData); //鏍规嵁瀹炰綋鏇存柊 + base.UpdateRange(updateArray); //鎵归噺鏇存柊 + //base.Update(it => new MesRohInData() { ClassName = "a", CreateTime = DateTime.Now }, it => it.id==1);// 鍙洿鏂癈lassName鍒楀拰CreateTime鍒楋紝鍏跺畠鍒椾笉鏇存柊锛屾潯浠秈d=1 + AsUpdateable(updateData).ExecuteCommand(); //杞垚Updateable鍙互瀹炵幇澶嶆潅鐨勬彃鍏� + + + /*********鍒犻櫎*********/ + var deldata = new MesRohInData(); //娴嬭瘯鍙傛暟 + base.Delete(deldata); //鏍规嵁瀹炰綋鍒犻櫎 + base.DeleteById(1); //鏍规嵁涓婚敭鍒犻櫎 + base.DeleteById(new[] { 1, 2 }); //鏍规嵁涓婚敭鏁扮粍鍒犻櫎 + base.Delete(it => 1 == 2); //鏍规嵁鏉′欢鍒犻櫎 + AsDeleteable().Where(it => 1 == 2) + .ExecuteCommand(); //杞垚Deleteable瀹炵幇澶嶆潅鐨勬搷浣� + } + + #endregion +} \ No newline at end of file diff --git a/MES.Service/service/BasicData/MesRohInManager.cs b/MES.Service/service/BasicData/MesRohInManager.cs new file mode 100644 index 0000000..c6a5935 --- /dev/null +++ b/MES.Service/service/BasicData/MesRohInManager.cs @@ -0,0 +1,278 @@ +锘縰sing MES.Service.DB; +using MES.Service.Dto.webApi; +using MES.Service.Modes; +using SqlSugar; + +namespace MES.Service.service.BasicData; + +public class MesRohInManager : Repository<MesRohIn> +{ + private readonly MesRohInDataManager rohInDataManager = new(); + + // Save 鏂规硶鐢ㄤ簬淇濆瓨鍗曚釜 RohIn 璁板綍锛屾牴鎹被鍨嬫墽琛屼笉鍚岀殑鎿嶄綔 + public bool Save(RohIn rohIn) + { + var rohInErpRohIn = rohIn.ErpRohIn; + var mesRohIn = GetMesRohIn(rohInErpRohIn); + var mesRohInDatas = GetMesRohInDatas(rohIn.ErpRohinDatas, rohInErpRohIn.Type); + + return UseTransaction(db => + { + switch (rohInErpRohIn.Type) + { + case "2": + case "4": + case "5": + return SaveOrUpdateData(db, mesRohIn, mesRohInDatas) ? 1 : 0; + case "3": + return UpdateData(db, mesRohIn, mesRohInDatas) ? 1 : 0; + default: + throw new NotImplementedException( + $"type娌℃湁{rohInErpRohIn.Type}杩欎釜绫诲瀷"); + } + }) > 0; + } + + // 鎻掑叆鏁版嵁鐨勬柟娉� + private bool InsertData(SqlSugarScope db, MesRohIn mesRohIn, + List<MesRohInData> mesRohInDatas, string FBILLTYPE) + { + switch (FBILLTYPE) + { + case "A": + { + var decimals = mesRohInDatas.Select(s => s.Id).ToArray(); + + if (mesRohIn.Id != null) base.DeleteById(mesRohIn.Id); + + if (decimals.Length > 0) + db.Deleteable<MesRohInData>().In(decimals).ExecuteCommand(); + + var insert = base.Insert(mesRohIn); + var insertRange = + rohInDataManager.InsertRange(mesRohInDatas); + + if (insert && insertRange) return true; + throw new NotImplementedException("鎻掑叆澶辫触"); + } + case "B": + { + var decimals = mesRohInDatas.Select(s => s.Id).ToArray(); + if (base.DeleteById(mesRohIn.Id) && db + .Deleteable<MesRohInData>().In(decimals) + .ExecuteCommand() > 0) + { + var insert = base.Insert(mesRohIn); + var insertRange = + rohInDataManager.InsertRange(mesRohInDatas); + + if (insert && insertRange) return true; + throw new NotImplementedException("鎻掑叆澶辫触"); + } + + break; + } + } + + throw new NotImplementedException("閲囪喘璁㈠崟绫诲瀷閿欒"); + } + + // 鏇存柊鏁版嵁鐨勬柟娉� + private bool UpdateData(SqlSugarScope db, MesRohIn mesRohIn, + List<MesRohInData> mesRohInDatas) + { + var decimals = mesRohInDatas.Select(s => s.Id).ToArray(); + var update = base.DeleteById(mesRohIn.Id); + var insertOrUpdate = db + .Deleteable<MesRohInData>().In(decimals) + .ExecuteCommand() > 0; + + if (update && insertOrUpdate) return true; + throw new NotImplementedException("鏇存柊澶辫触"); + } + + // 鎻掑叆鎴栨洿鏂版暟鎹殑鏂规硶 + private bool SaveOrUpdateData(SqlSugarScope db, MesRohIn mesRohIn, + List<MesRohInData> mesRohInDatas) + { + if (mesRohIn.Id != null) base.DeleteById(mesRohIn.Id); + + if (mesRohInDatas.Count > 0) + db.Deleteable<MesRohInData>() + .Where(s => s.ErpId == mesRohIn.EbelnK3id).ExecuteCommand(); + + var orUpdate = base.Insert(mesRohIn); + var baOrUpdate = rohInDataManager.InsertRange(mesRohInDatas); + if (orUpdate && baOrUpdate) return true; + throw new NotImplementedException("鎻掑叆鎴栨洿鏂板け璐�"); + } + + // 鎵归噺淇濆瓨璁板綍鐨勬柟娉� + public bool SaveList(List<RohIn> rohIns) + { + var result = rohIns.Select(Save).ToList(); + return result.All(b => b); + } + + // 灏� ErpRohIn 瀵硅薄杞崲涓� MesRohIn 瀵硅薄鐨勬柟娉� + public MesRohIn GetMesRohIn(ErpRohIn rohIn) + { + var eid = Convert.ToDecimal(rohIn.id); + var mesRohIn = new MesRohIn(); + + var single = base.GetSingle(it => it.EbelnK3id == eid); + if (single != null) mesRohIn.Id = single.Id; + + mesRohIn.EbelnK3id = eid; + mesRohIn.BillNo = rohIn.FBillNo; + mesRohIn.DocumentStatus = rohIn.FDocumentStatus; + mesRohIn.DocumentType = rohIn.FBillTypeID; + mesRohIn.BusinessType = rohIn.FBusinessType; + + if (rohIn.FDate != null) + mesRohIn.PurchaseDate = DateTime.ParseExact(rohIn.FDate, + "yyyy-MM-dd HH:mm:ss", null); + + mesRohIn.Supplier = rohIn.FSupplierId; + mesRohIn.CloseStatus = rohIn.FCloseStatus; + mesRohIn.PurchaseOrg = rohIn.FPurchaseOrgId; + mesRohIn.PurchaseDept = rohIn.FPurchaseDeptId; + mesRohIn.PurchaseGroup = rohIn.FPurchaserGroupId; + mesRohIn.QtyAcceptance = rohIn.Facctype; + mesRohIn.Purchaser = rohIn.FPurchaserId; + //mesRohIn.QualityReq = rohIn.F_UNW_Remarks_zlyq; + mesRohIn.SettlementParty = rohIn.FSettleId; + mesRohIn.PaymentParty = rohIn.FChargeId; + // mesRohIn.Email = rohIn.FProviderEMail; + // mesRohIn.TransportMethod = rohIn.F_UNW_Text_ysfs; + mesRohIn.Remarks = rohIn.F_XIFG_Text_qtr1; + // mesRohIn.FixtureMoldProcurement = rohIn.F_UNW_Combo_zjmj; + mesRohIn.CancellationStatus = rohIn.FCancelStatus; + mesRohIn.CancellationPerson = rohIn.FCancellerId; + + if (rohIn.FCancelDate != null) + mesRohIn.CancellationDate = + DateTime.ParseExact(rohIn.FCancelDate, + "yyyy-MM-dd HH:mm:ss", null); + + mesRohIn.CreateBy = rohIn.FCreatorId; + + if (rohIn.FCreateDate != null) + mesRohIn.CreateDate = DateTime.ParseExact(rohIn.FCreateDate, + "yyyy-MM-dd HH:mm:ss", null); + + mesRohIn.LastupdateBy = rohIn.FModifierId; + + if (rohIn.FModifyDate != null) + mesRohIn.LastupdateDate = DateTime.ParseExact(rohIn.FModifyDate, + "yyyy-MM-dd HH:mm:ss", null); + + mesRohIn.ErpCheckBy = rohIn.FApproverId; + mesRohIn.ErpCheckDate = rohIn.FApproveDate; + mesRohIn.Changereason = rohIn.FCHANGEREASON; + mesRohIn.FPREARRIVALDATE = rohIn.FPREARRIVALDATE != null + ? DateTime.ParseExact(rohIn.FPREARRIVALDATE, + "yyyy-MM-dd HH:mm:ss", null) + : null; + + mesRohIn.FRECEIVEORGID = rohIn.FRECEIVEORGID; + + mesRohIn.remark1 = rohIn.F_XIFG_PrintTimes_qtr; + + return mesRohIn; + } + + // 灏� ErpRohinData 瀵硅薄杞崲涓� MesRohInData 瀵硅薄鐨勬柟娉� + public List<MesRohInData> GetMesRohInDatas( + List<ErpRohinData> erpRohinDatas, string type) + { + return erpRohinDatas.Select(s => + { + var entity = new MesRohInData + { + EbelnK3id = Convert.ToDecimal(s.id), + ErpId = Convert.ToDecimal(s.Eid), + BillNo = s.FBillNo, + SalesOrderId = s.F_XIFG_Text_k79, + OrderLineId = s.FSEQ, + ItemId = s.FMaterialId, + PurchaseUnit = s.FUnitId, + PurchaseQty = Convert.ToDecimal(s.FQty), + InventoryUnit = s.FStockUnitID, + DeliveryDate = s.FDeliveryDate != null + ? DateTime.ParseExact(s.FDeliveryDate, + "yyyy-MM-dd HH:mm:ss", null) + : null, + EarliestDeliveryDate = s.FDeliveryEarlyDate != null + ? DateTime.ParseExact(s.FDeliveryEarlyDate, + "yyyy-MM-dd HH:mm:ss", null) + : null, + LatestDeliveryDate = s.FDeliveryLastDate != null + ? DateTime.ParseExact(s.FDeliveryLastDate, + "yyyy-MM-dd HH:mm:ss", null) + : null, + IsGift = s.FGiveAway, + Remarks = s.Fnote, + SupplierItemCode = s.FSupMatId, + SupplierItemName = s.FSupMatName, + OutsourcingOrderId = s.FSUBREQBILLNO, + BatchNumber = s.FLot, + BusinessClose = s.FMRPCloseStatus, + BusinessFreeze = s.FMRPFreezeStatus, + Freezer = s.FFreezerId, + FreezeTime = s.FFreezeDate != null + ? DateTime.ParseExact(s.FFreezeDate, + "yyyy-MM-dd HH:mm:ss", null) + : null, + BusinessTerminate = s.FMRPTerminateStatus, + Terminator = s.FTerminaterId, + TerminateTime = s.FTerminateDate != null + ? DateTime.ParseExact(s.FTerminateDate, + "yyyy-MM-dd HH:mm:ss", null) + : null, + TotalReceivedQty = Convert.ToDecimal(s.FReceiveQty), //绱鏀舵枡鏁� + RemainingReceivedQty = + Convert.ToDecimal(s.FRemainReceiveQty), + TotalStoredQty = Convert.ToDecimal(s.FStockInQty), //绱鍏ュ簱鏁� + RemainingStoredQty = Convert.ToDecimal(s.FRemainStockINQty), + TotalReturnedQty = Convert.ToDecimal(s.FMrbQty), + ReturnableReceivedQty = Convert.ToDecimal(s.FCHECKRETQTY), //鏀舵枡鍙��鏁� + ReturnableStoredQty = Convert.ToDecimal(s.FSTOCKRETQTY), //搴撳瓨鍙��鏁� + SourceDocumentType = s.FSrcBillTypeId, + SourceDocumentId = s.FSrcBillNo, + DemandTrackingId = s.FReqTraceNo, + PlanTrackingId = s.FMtoNo, + ChangeFlag = s.FChangeFlag, + DemandSource = s.FDEMANDTYPE, + DemandDocumentId = s.FDEMANDBILLNO, + DemandDocumentLineId = s.FDEMANDBILLENTRYSEQ, + DemandOrg = s.FRequireOrgId, + ReceivingOrg = s.FReceiveOrgId, + SettlementOrg = s.FEntrySettleOrgId, + PurchaseOrderLineNumber = s.FSEQ, + Demand = s.FRequireOrgId, + Receiving = s.FReceiveOrgId, + Settlement = s.FSETTLEORGID, + DemandDepartment = s.FRequireDeptId, + ReceivingDepartment = s.FReceiveDeptId, + FPREARRIVALDATE = s.FPREARRIVALDATE != null + ? DateTime.ParseExact(s.FPREARRIVALDATE, + "yyyy-MM-dd HH:mm:ss", null) + : null, + Remark1 = s.F_XIFG_Text_ne1, + Remark2 = s.F_XIFG_Text_6oq, + Remark3 = s.F_XIFG_Base_c1c, + Remark4 = s.F_XIFG_Text_qtr4, + FdemandbillnoLine = s.FdemandbillnoLine, + ElectricalProductModel = s.ElectricalProductModel, + ElectricalProductName = s.ElectricalProductName + }; + + var single = rohInDataManager.GetSingle(it => + it.EbelnK3id == entity.EbelnK3id); + if (single != null) entity.Id = single.Id; + + return entity; + }).ToList(); + } +} \ No newline at end of file diff --git a/MES.Service/service/BasicData/MesStaffManager.cs b/MES.Service/service/BasicData/MesStaffManager.cs new file mode 100644 index 0000000..42269b8 --- /dev/null +++ b/MES.Service/service/BasicData/MesStaffManager.cs @@ -0,0 +1,281 @@ +锘縰sing Castle.Core.Resource; +using MES.Service.DB; +using MES.Service.Dto.webApi; +using MES.Service.Modes; +using SqlSugar; + +namespace MES.Service.service.BasicData; + +public class MesStaffManager : Repository<MesStaff> +{ + // Save 鏂规硶鐢ㄤ簬淇濆瓨鍗曚釜鍛樺伐璁板綍锛屾牴鎹被鍨嬫墽琛屼笉鍚岀殑鎿嶄綔 + public bool Save(ErpStaff unit) + { + var entity = GetMesStaff(unit); // 灏� ErpStaff 杞崲涓� MesStaff + var sysUser = GetUser(unit); // 鑾峰彇 SysUser 瀹炰緥 + + return UseTransaction(db => + { + switch (unit.Type) + { + case "0": + if (UpdateStaffStatus(db, entity.Id, "A")) // 鍚敤鍛樺伐 + return 1; + break; + case "1": + if (UpdateStaffStatus(db, entity.Id, "B")) // 绂佺敤鍛樺伐 + return 1; + break; + case "2": + case "4": + if (InsertOrUpdateStaff(db, sysUser, entity)) // 鎻掑叆鎴栨洿鏂板憳宸� + return 1; + break; + case "3": + if (DeleteStaff(db, sysUser, entity.Id)) // 鍒犻櫎鍛樺伐 + return 1; + break; + default: + throw new ArgumentNullException( + $"type娌℃湁{unit.Type}杩欎釜绫诲瀷鐨勫弬鏁�"); + } + + throw new NotImplementedException("鎿嶄綔澶辫触"); + }) > 0; + } + + // 鏇存柊鍛樺伐鐘舵�佺殑鏂规硶 + private bool UpdateStaffStatus(SqlSugarScope db, decimal staffId, + string status) + { + var result = db.Updateable<MesStaff>() + .SetColumns(s => s.FforbidStatus == status) + .Where(s => s.Id == staffId).ExecuteCommand(); + + if (result > 0) + return true; + + throw new NotImplementedException(status == "A" ? "鍚敤澶辫触" : "绂佺敤澶辫触"); + } + + // 鎻掑叆鎴栨洿鏂板憳宸ョ殑鏂规硶 + private bool InsertOrUpdateStaff(SqlSugarScope db, SysUser sysUser, + MesStaff entity) + { + var exists = db.Queryable<SysUser>().Any(u => u.Sid == sysUser.Sid); + if (exists) + { + var updateUser = db.Updateable<SysUser>() + .SetColumns(s => s.Fcode == sysUser.Fcode) + .SetColumns(s => s.Fname == sysUser.Fname) + .Where(s => s.Sid == sysUser.Sid) + .ExecuteCommand(); + if (updateUser > 0) + { + var updateStaff = db.Updateable(entity).ExecuteCommand(); + if (updateStaff > 0) + return true; + } + } + else + { + var insertUser = db.Insertable(sysUser).ExecuteCommand(); + if (insertUser > 0) + { + var insertStaff = db.Insertable(entity).ExecuteCommand(); + if (insertStaff > 0) + return true; + } + } + + return false; + } + + // 鍒犻櫎鍛樺伐鐨勬柟娉� + private bool DeleteStaff(SqlSugarScope db, SysUser sysUser, decimal staffId) + { + var deleteUser = db.Deleteable<SysUser>() + .Where(s => s.Sid == sysUser.Sid).ExecuteCommand(); + if (deleteUser > 0) + { + var deleteStaff = + db.Deleteable<MesStaff>().In(staffId).ExecuteCommand(); + if (deleteStaff > 0) + return true; + } + + throw new NotImplementedException("鍙嶅鏍稿け璐�"); + } + + // 灏� ErpStaff 瀵硅薄杞崲涓� MesStaff 瀵硅薄鐨勬柟娉� + private MesStaff GetMesStaff(ErpStaff staff) + { + var entity = new MesStaff + { + Id = Convert.ToDecimal(staff.Id), + StaffNo = staff.FStaffNumber, + StaffName = staff.FName, + DepartmentName = staff.FPostDept, + PositionName = staff.FPost, + PhoneNumber = staff.FMobile, + Remark = staff.FDescription, + FforbidStatus = staff.FForbidStatus, + FSubsidiary = staff.FUSEORGID, + Fumbrella = staff.FCREATEORGID, + CreateDate = DateTime.Now, + LastupdateDate = DateTime.Now + }; + + if (staff.FStaffStartDate != null) + entity.StartDate = DateTime.ParseExact(staff.FStaffStartDate, + "yyyy-MM-dd HH:mm:ss", null); + + return entity; + } + + // 灏� ErpStaff 瀵硅薄杞崲涓� SysUser 瀵硅薄鐨勬柟娉� + private SysUser GetUser(ErpStaff staff) + { + return new SysUser + { + Sid = Convert.ToDecimal(staff.Id), + Fcode = staff.FStaffNumber, + Fname = staff.FName, + Fpassword = "8+()./,", // 鍒濆瀵嗙爜 + Fsystem = "瀹佹尝鍒╃壒鑸�", + Lever = 0, + Fcompany = "1000", + Ffactory = "1000", + DelFlag = 0, + Ismanager = 0, + Isacq = 0, + ExpField9 = "1020", + QmUser = 0, + Status = 0, + Isdeparture = 0, + CheckFlag = 0, + ExpFiel12 = 0, + Dev = 0, + Tet = 0, + Prd = 1 + }; + } + + // SaveList 鏂规硶鐢ㄤ簬淇濆瓨澶氫釜鍛樺伐璁板綍锛屾牴鎹被鍨嬫壒閲忔墽琛屼笉鍚岀殑鎿嶄綔 + public bool SaveList(List<ErpStaff> departments) + { + var list = new List<MesStaff>(); + var userList = new List<SysUser>(); + + departments.ForEach(s => + { + var entity = GetMesStaff(s); + entity.Type = s.Type; + list.Add(entity); + + var sysUser = GetUser(s); + sysUser.Type = s.Type; + userList.Add(sysUser); + }); + + var groupBy = list.GroupBy(s => s.Type) + .ToDictionary(g => g.Key, g => g.ToList()); + return UseTransaction(db => + { + foreach (var staffGroup in groupBy) + switch (staffGroup.Key) + { + case "0": + if (!UpdateStaffStatusBatch(db, staffGroup.Value, + "A")) // 鎵归噺鍚敤鍛樺伐 + throw new NotImplementedException("鍚敤澶辫触"); + break; + case "1": + if (!UpdateStaffStatusBatch(db, staffGroup.Value, + "B")) // 鎵归噺绂佺敤鍛樺伐 + throw new NotImplementedException("绂佺敤澶辫触"); + break; + case "2": + if (!InsertStaffBatch(db, userList, + staffGroup.Value)) // 鎵归噺鎻掑叆鍛樺伐 + throw new NotImplementedException("鎻掑叆澶辫触"); + break; + case "3": + if (!DeleteStaffBatch(db, userList, + staffGroup.Value)) // 鎵归噺鍒犻櫎鍛樺伐 + throw new NotImplementedException("鍒犻櫎澶辫触"); + break; + case "4": + if (!InsertOrUpdateBatch(db, userList, + staffGroup.Value)) // 鎵归噺鎻掑叆鎴栨洿鏂板憳宸� + throw new NotImplementedException("鍚屾澶辫触"); + break; + default: + throw new ArgumentNullException( + $"type娌℃湁{staffGroup.Key}杩欎釜绫诲瀷鐨勫弬鏁�"); + } + + return 1; + }) > 0; + } + + // 鎵归噺鏇存柊鍛樺伐鐘舵�佺殑鏂规硶 + private bool UpdateStaffStatusBatch(SqlSugarScope db, + List<MesStaff> staffList, string status) + { + var ids = staffList.Select(it => it.Id).ToArray(); + var result = db.Updateable<MesStaff>() + .SetColumns(s => s.FforbidStatus == status) + .Where(s => ids.Contains(s.Id)).ExecuteCommand(); + + if (result > 0) + return true; + + throw new NotImplementedException(status == "A" ? "鍚敤澶辫触" : "绂佺敤澶辫触"); + } + + // 鎵归噺鎻掑叆鍛樺伐鐨勬柟娉� + private bool InsertStaffBatch(SqlSugarScope db, List<SysUser> userList, + List<MesStaff> staffList) + { + var userInsert = userList.FindAll(s => s.Type == "INSERT"); + var executeCommand = db.Insertable(userInsert).ExecuteCommand(); + if (executeCommand > 0) + if (db.Insertable(staffList).ExecuteCommand() > 0) + return true; + + throw new ArgumentNullException("瀹℃牳澶辫触"); + } + + // 鎵归噺鍒犻櫎鍛樺伐鐨勬柟娉� + private bool DeleteStaffBatch(SqlSugarScope db, List<SysUser> userList, + List<MesStaff> staffList) + { + var sid = userList.FindAll(s => s.Type == "DELETE").Select(s => s.Sid) + .ToArray(); + var result = db.Deleteable<SysUser>() + .Where(s => sid.Contains(s.Sid)).ExecuteCommand(); + + if (result > 0) + { + var ids = staffList.Select(it => it.Id).ToArray(); + if (db.Deleteable<MesStaff>().In(ids).ExecuteCommand() > 0) + return true; + } + + throw new ArgumentNullException("鍙嶅鏍稿け璐�"); + } + + // 鎵归噺鎻掑叆鎴栨洿鏂板憳宸ョ殑鏂规硶 + private bool InsertOrUpdateBatch(SqlSugarScope db, List<SysUser> userList, + List<MesStaff> staffList) + { + foreach (var sysUser in userList) + { + var entity = staffList.First(s => s.Id == sysUser.Sid); + if (!InsertOrUpdateStaff(db, sysUser, entity)) return false; + } + + return true; + } +} \ No newline at end of file diff --git a/MES.Service/service/BasicData/MesSupplierManager.cs b/MES.Service/service/BasicData/MesSupplierManager.cs new file mode 100644 index 0000000..2cac024 --- /dev/null +++ b/MES.Service/service/BasicData/MesSupplierManager.cs @@ -0,0 +1,197 @@ +锘縰sing MES.Service.DB; +using MES.Service.Dto.webApi; +using MES.Service.Modes; +using SqlSugar; + +namespace MES.Service.service.BasicData; + +public class MesSupplierManager : Repository<MesSupplier> +{ + public bool Save(ErpSupplier unit) + { + var entity = GetMesSupplier(unit); + + return UseTransaction(db => + { + switch (unit.Type) + { + case "0": + if (UpdateSupplierStatus(db, entity.Id, "A")) + return 1; + break; + case "1": + if (UpdateSupplierStatus(db, entity.Id, "B")) + return 1; + break; + case "2": + if (InsertSupplier(db, entity)) + return 1; + break; + case "3": + if (DeleteSupplier(entity.Id)) + return 1; + break; + case "4": + if (InsertOrUpdate(db, entity)) + return 1; + break; + default: + throw new ArgumentNullException( + $"type娌℃湁{unit.Type}杩欎釜绫诲瀷鐨勫弬鏁�"); + } + + throw new NotImplementedException("鎿嶄綔澶辫触"); + }) > 0; + } + + public bool SaveList(List<ErpSupplier> suppliers) + { + var list = suppliers.Select(GetMesSupplier).ToList(); + var groupBy = list.GroupBy(s => s.Type) + .ToDictionary(g => g.Key, g => g.ToList()); + + return UseTransaction(db => + { + foreach (var supplierGroup in groupBy) + switch (supplierGroup.Key) + { + case "0": + if (!UpdateSupplierStatusBatch(db, supplierGroup.Value, + "A")) + throw new NotImplementedException("鍚敤澶辫触"); + break; + case "1": + if (!UpdateSupplierStatusBatch(db, supplierGroup.Value, + "B")) + throw new NotImplementedException("绂佺敤澶辫触"); + break; + case "2": + if (!InsertSupplierBatch(db, supplierGroup.Value)) + throw new NotImplementedException("鎻掑叆澶辫触"); + break; + case "3": + if (!DeleteSupplierBatch(db, supplierGroup.Value)) + throw new NotImplementedException("鍒犻櫎澶辫触"); + break; + case "4": + if (!InsertOrUpdateBatch(db, supplierGroup.Value)) + throw new NotImplementedException("鍚屾澶辫触"); + break; + default: + throw new ArgumentNullException( + $"type娌℃湁{supplierGroup.Key}杩欎釜绫诲瀷鐨勫弬鏁�"); + } + + return 1; + }) > 0; + } + + private bool UpdateSupplierStatus(SqlSugarScope db, decimal supplierId, + string status) + { + var result = db.Updateable<MesSupplier>() + .SetColumns(s => s.Fforbidstatus == status) + .Where(s => s.Id == supplierId).ExecuteCommand(); + + if (result > 0) + return true; + + throw new NotImplementedException(status == "A" ? "鍚敤澶辫触" : "绂佺敤澶辫触"); + } + + private bool InsertSupplier(SqlSugarScope db, MesSupplier entity) + { + var insert = db.Insertable(entity).ExecuteCommand(); + if (insert > 0) + return true; + + throw new NotImplementedException("鎻掑叆澶辫触"); + } + + private bool DeleteSupplier(decimal supplierId) + { + if (base.DeleteById(supplierId)) return true; + + throw new NotImplementedException("鍒犻櫎澶辫触"); + } + + private MesSupplier GetMesSupplier(ErpSupplier supplier) + { + return new MesSupplier + { + Id = Convert.ToDecimal(supplier.Id), + SuppNo = supplier.FNumber, + SuppSname = supplier.FShortName, + SuppName = supplier.FName, + Lxr = supplier.FContact, + Telf1 = supplier.FTel, + Fstaffid = supplier.FStaffId, + Fforbidstatus = supplier.FForbidStatus, + Type = supplier.Type, + Remark = supplier.FDescription, + FSubsidiary = supplier.FUseOrgId, + Fumbrella = supplier.FCreateOrgId, + CreateDate = DateTime.Now, + LastupdateDate = DateTime.Now, + Company = "1000", + Factory = "1000" + }; + } + + private bool UpdateSupplierStatusBatch(SqlSugarScope db, + List<MesSupplier> supplierList, string status) + { + var ids = supplierList.Select(it => it.Id).ToArray(); + var result = db.Updateable<MesSupplier>() + .SetColumns(s => s.Fforbidstatus == status) + .Where(s => ids.Contains(s.Id)).ExecuteCommand(); + + if (result > 0) + return true; + + throw new NotImplementedException(status == "A" ? "鍚敤澶辫触" : "绂佺敤澶辫触"); + } + + private bool InsertSupplierBatch(SqlSugarScope db, + List<MesSupplier> supplierList) + { + var insertRange = db.Insertable(supplierList).ExecuteCommand(); + if (insertRange > 0) + return true; + + throw new NotImplementedException("鎻掑叆澶辫触"); + } + + private bool DeleteSupplierBatch(SqlSugarScope db, + List<MesSupplier> supplierList) + { + var ids = supplierList.Select(it => it.Id).ToArray(); + var deleteByIds = db.Deleteable<MesSupplier>().In(ids).ExecuteCommand(); + if (deleteByIds > 0) + return true; + + throw new NotImplementedException("鍒犻櫎澶辫触"); + } + + private bool InsertOrUpdate(SqlSugarScope db, MesSupplier entity) + { + db.Deleteable<MesSupplier>().Where(s => s.Id == entity.Id) + .ExecuteCommand(); + + var insert = db.Insertable(entity).ExecuteCommand(); + if (insert > 0) + return true; + + return false; + } + + private bool InsertOrUpdateBatch(SqlSugarScope db, + List<MesSupplier> supplierList) + { + foreach (var entity in supplierList) + if (!InsertOrUpdate(db, entity)) + return false; + + return true; + } +} \ No newline at end of file diff --git a/MES.Service/service/BasicData/MesUnitManager.cs b/MES.Service/service/BasicData/MesUnitManager.cs new file mode 100644 index 0000000..5e71919 --- /dev/null +++ b/MES.Service/service/BasicData/MesUnitManager.cs @@ -0,0 +1,198 @@ +锘縰sing MES.Service.DB; +using MES.Service.Dto.webApi; +using MES.Service.Modes; +using SqlSugar; + +namespace MES.Service.service.BasicData; + +public class MesUnitManager : Repository<MesUnit> +{ + public bool Save(ErpUnit unit) + { + var entity = GetMesUnit(unit); + + return UseTransaction(db => + { + switch (unit.Type) + { + case "0": + if (UpdateUnitStatus(db, entity.Id, "A")) + return 1; + break; + case "1": + if (UpdateUnitStatus(db, entity.Id, "B")) + return 1; + break; + case "2": + if (InsertUnit(db, entity)) + return 1; + break; + case "3": + if (DeleteUnit(db, entity.Id)) + return 1; + break; + case "4": + if (InsertOrUpdate(db, entity)) + return 1; + break; + default: + throw new ArgumentNullException( + $"type娌℃湁{unit.Type}杩欎釜绫诲瀷鐨勫弬鏁�"); + } + + throw new NotImplementedException("鎿嶄綔澶辫触"); + }) > 0; + } + + public bool SaveList(List<ErpUnit> units) + { + var list = units.Select(GetMesUnit).ToList(); + var groupBy = list.GroupBy(s => s.Type) + .ToDictionary(g => g.Key, g => g.ToList()); + + return UseTransaction(db => + { + foreach (var unitGroup in groupBy) + switch (unitGroup.Key) + { + case "0": + if (!UpdateUnitStatusBatch(db, unitGroup.Value, "A")) + throw new NotImplementedException("鍚敤澶辫触"); + break; + case "1": + if (!UpdateUnitStatusBatch(db, unitGroup.Value, "B")) + throw new NotImplementedException("绂佺敤澶辫触"); + break; + case "2": + if (!InsertUnitBatch(db, unitGroup.Value)) + throw new NotImplementedException("鎻掑叆澶辫触"); + break; + case "3": + if (!DeleteUnitBatch(db, unitGroup.Value)) + throw new NotImplementedException("鍒犻櫎澶辫触"); + break; + case "4": + if (!InsertOrUpdateBatch(db, unitGroup.Value)) + throw new NotImplementedException("鍚屾澶辫触"); + break; + default: + throw new ArgumentNullException( + $"type娌℃湁{unitGroup.Key}杩欎釜绫诲瀷鐨勫弬鏁�"); + } + + return 1; + }) > 0; + } + + private bool UpdateUnitStatus(SqlSugarScope db, decimal unitId, + string status) + { + var result = db.Updateable<MesUnit>() + .SetColumns(s => s.Fforbidstatus == status) + .Where(s => s.Id == unitId).ExecuteCommand(); + + if (result > 0) + return true; + + throw new NotImplementedException(status == "A" ? "鍚敤澶辫触" : "绂佺敤澶辫触"); + } + + private bool InsertUnit(SqlSugarScope db, MesUnit entity) + { + var insert = db.Insertable(entity).ExecuteCommand(); + if (insert > 0) + return true; + + throw new NotImplementedException("鎻掑叆澶辫触"); + } + + private bool DeleteUnit(SqlSugarScope db, decimal unitId) + { + var deleteById = db.Deleteable<MesUnit>().In(unitId).ExecuteCommand(); + if (deleteById > 0) + return true; + + throw new NotImplementedException("鍒犻櫎澶辫触"); + } + + private MesUnit GetMesUnit(ErpUnit unit) + { + return new MesUnit + { + Id = Convert.ToDecimal(unit.Id), + Fnumber = unit.FNumber, + Fname = unit.FName, + Funitgroupid = unit.FUnitGroupId, + Fconvertdenominator = unit.FConvertDenominator, + Fcurrentunitid = unit.FCurrentUnitId, + Fconvertnumerator = unit.FConvertNumerator, + Fbaseunit = unit.FBaseUnit, + Froundtype = unit.FRoundType, + Fprecision = unit.FPrecision, + Fdescription = unit.FDescription, + Fforbidstatus = unit.FForbidStatus, + CreateDate = DateTime.Now, + LastupdateDate = DateTime.Now, + Company = "1000", + Factory = "1000" + }; + } + + private bool UpdateUnitStatusBatch(SqlSugarScope db, List<MesUnit> unitList, + string status) + { + var ids = unitList.Select(it => it.Id).ToArray(); + var result = db.Updateable<MesUnit>() + .SetColumns(s => s.Fforbidstatus == status) + .Where(s => ids.Contains(s.Id)).ExecuteCommand(); + + if (result > 0) + return true; + + throw new NotImplementedException(status == "A" ? "鍚敤澶辫触" : "绂佺敤澶辫触"); + } + + private bool InsertUnitBatch(SqlSugarScope db, List<MesUnit> unitList) + { + var insertRange = db.Insertable(unitList).ExecuteCommand(); + if (insertRange > 0) + return true; + + throw new NotImplementedException("鎻掑叆澶辫触"); + } + + private bool DeleteUnitBatch(SqlSugarScope db, List<MesUnit> unitList) + { + var ids = unitList.Select(it => it.Id).ToArray(); + var deleteByIds = db.Deleteable<MesUnit>().In(ids).ExecuteCommand(); + return deleteByIds > 0; + } + + private bool InsertOrUpdate(SqlSugarScope db, MesUnit entity) + { + var exists = db.Queryable<MesUnit>().Any(e => e.Id == entity.Id); + if (exists) + { + var update = db.Updateable(entity).ExecuteCommand(); + if (update > 0) + return true; + } + else + { + var insert = db.Insertable(entity).ExecuteCommand(); + if (insert > 0) + return true; + } + + return false; + } + + private bool InsertOrUpdateBatch(SqlSugarScope db, List<MesUnit> unitList) + { + foreach (var entity in unitList) + if (!InsertOrUpdate(db, entity)) + return false; + + return true; + } +} \ No newline at end of file diff --git a/MES.Service/service/BasicData/OrganizeManager.cs b/MES.Service/service/BasicData/OrganizeManager.cs new file mode 100644 index 0000000..94ad07e --- /dev/null +++ b/MES.Service/service/BasicData/OrganizeManager.cs @@ -0,0 +1,267 @@ +锘縰sing SqlSugar; +using System; +using System.Collections.Generic; +using MES.Service.DB; +using MES.Service.Modes; +using MES.Service.Dto.webApi; +using System.Xml.Linq; + +namespace MES.Service.service; + +public class OrganizeManager : Repository<Organize> +{ + //褰撳墠绫诲凡缁忕户鎵夸簡 Repository 澧炪�佸垹銆佹煡銆佹敼鐨勬柟娉� + //Mesorganization + //杩欓噷闈㈠啓鐨勪唬鐮佷笉浼氱粰瑕嗙洊,濡傛灉瑕侀噸鏂扮敓鎴愯鍒犻櫎 OrganizeManager.cs + public bool Save(ErpOrganize item) + { + var entity = GetOrganize(item); + + return UseTransaction(db => + { + switch (item.Type) + { + case "0": + if (UpdateOrganizetatus(db, entity.Id, "A")) + return 1; + break; + case "1": + if (UpdateOrganizetatus(db, entity.Id, "B")) + return 1; + break; + case "2": + if (InsertItem(db, entity)) + return 1; + break; + case "3": + if (DeleteItem(db, Convert.ToDecimal(entity.Id))) + return 1; + break; + case "4": + if (InsertOrUpdate(db, entity)) + return 1; + break; + default: + throw new ArgumentNullException( + $"type娌℃湁{item.Type}杩欎釜绫诲瀷鐨勫弬鏁�"); + } + + throw new NotImplementedException("鎿嶄綔澶辫触"); + }) > 0; + } + + public bool SaveList(List<ErpOrganize> Organize) + { + var list = Organize.Select(GetOrganize).ToList(); + var groupBy = list.GroupBy(s => s.Type) + .ToDictionary(g => g.Key, g => g.ToList()); + + return UseTransaction(db => + { + foreach (var itemGroup in groupBy) + switch (itemGroup.Key) + { + case "0": + if (!UpdateOrganizetatusBatch(db, itemGroup.Value, "A")) + throw new NotImplementedException("鍚敤澶辫触"); + break; + case "1": + if (!UpdateOrganizetatusBatch(db, itemGroup.Value, "B")) + throw new NotImplementedException("绂佺敤澶辫触"); + break; + case "2": + if (!InsertItemBatch(db, itemGroup.Value)) + throw new NotImplementedException("鎻掑叆澶辫触"); + break; + case "3": + if (!DeleteItemBatch(db, itemGroup.Value)) + throw new NotImplementedException("鍒犻櫎澶辫触"); + break; + case "4": + if (!InsertOrUpdateBatch(db, itemGroup.Value)) + throw new NotImplementedException("鍚屾澶辫触"); + break; + default: + throw new ArgumentNullException( + $"type娌℃湁{itemGroup.Key}杩欎釜绫诲瀷鐨勫弬鏁�"); + } + + return 1; + }) > 0; + } + + private bool UpdateOrganizetatus(SqlSugarScope db, string itemId, + string status) + { + var result = db.Updateable<Organize>() + .SetColumns(s => s.Fforbidstatus == status) + .Where(s => s.Id == itemId).ExecuteCommand(); + + if (result > 0) + return true; + + throw new NotImplementedException(status == "A" ? "鍚敤澶辫触" : "绂佺敤澶辫触"); + } + + private bool InsertItem(SqlSugarScope db, Organize entity) + { + var insert = db.Insertable(entity).ExecuteCommand(); + if (insert > 0) + return true; + + throw new NotImplementedException("鎻掑叆澶辫触"); + } + + private bool DeleteItem(SqlSugarScope db, decimal itemId) + { + var deleteById = db.Deleteable<Organize>().In(itemId).ExecuteCommand(); + if (deleteById > 0) + return true; + + throw new NotImplementedException("鍒犻櫎澶辫触"); + } + + private Organize GetOrganize(ErpOrganize Organize) + { + return new Organize + { + Id = Organize.Id, + Fnumber = Organize.FNumber, + Fname = Organize.FName, + Type = Organize.Type, + FDescription = Organize.FDescription, + FParentID = Organize.FParentID, + FCreateDate = Organize.FCreateDate != null + ? DateTime.ParseExact(Organize.FCreateDate, + "yyyy-MM-dd HH:mm:ss", null) + : null, + FFORBIDORID = Organize.FFORBIDORID, + FFORBIDDATE = Organize.FFORBIDDATE != null + ? DateTime.ParseExact(Organize.FFORBIDDATE, + "yyyy-MM-dd HH:mm:ss", null) + : null + }; + } + + private bool UpdateOrganizetatusBatch(SqlSugarScope db, + List<Organize> itemList, string status) + { + var ids = itemList.Select(it => it.Id).ToArray(); + var result = db.Updateable<Organize>() + .SetColumns(s => s.Fforbidstatus == status) + .Where(s => ids.Contains(s.Id)).ExecuteCommand(); + + if (result > 0) + return true; + + throw new NotImplementedException(status == "A" ? "鍚敤澶辫触" : "绂佺敤澶辫触"); + } + + private bool InsertItemBatch(SqlSugarScope db, List<Organize> itemList) + { + var insertRange = db.Insertable(itemList).ExecuteCommand(); + if (insertRange > 0) + return true; + + throw new NotImplementedException("鎻掑叆澶辫触"); + } + + private bool DeleteItemBatch(SqlSugarScope db, List<Organize> itemList) + { + var ids = itemList.Select(it => it.Id).ToArray(); + var deleteByIds = db.Deleteable<Organize>().In(ids).ExecuteCommand(); + if (deleteByIds > 0) + return true; + + throw new NotImplementedException("鍒犻櫎澶辫触"); + } + + private bool InsertOrUpdate(SqlSugarScope db, Organize entity) + { + var exists = db.Queryable<Organize>().Any(e => e.Id == entity.Id); + if (exists) + { + var update = db.Updateable(entity).ExecuteCommand(); + if (update > 0) + return true; + } + else + { + var insert = db.Insertable(entity).ExecuteCommand(); + if (insert > 0) + return true; + } + + return false; + } + + private bool InsertOrUpdateBatch(SqlSugarScope db, List<Organize> itemList) + { + foreach (var entity in itemList) + if (!InsertOrUpdate(db, entity)) + return false; + + return true; + } + + #region 鏁欏鏂规硶 + + /// <summary> + /// 浠撳偍鏂规硶婊¤冻涓嶄簡澶嶆潅涓氬姟闇�姹傦紝涓氬姟浠g爜璇峰湪杩欓噷闈㈠畾涔夋柟娉� + /// </summary> + public void Study() + { + /*********鏌ヨ*********/ + + var data1 = base.GetById(1); //鏍规嵁ID鏌ヨ + var data2 = base.GetList(); //鏌ヨ鎵�鏈� + var data3 = base.GetList(it => 1 == 1); //鏍规嵁鏉′欢鏌ヨ + //var data4 = base.GetSingle(it => 1 == 1);//鏍规嵁鏉′欢鏌ヨ涓�鏉�,濡傛灉瓒呰繃涓�鏉′細鎶ラ敊 + + var p = new PageModel() { PageIndex = 1, PageSize = 2 }; // 鍒嗛〉鏌ヨ + var data5 = base.GetPageList(it => 1 == 1, p); + Console.Write(p.TotalCount); //杩斿洖鎬绘暟 + + var data6 = base.GetPageList(it => 1 == 1, p, it => SqlFunc.GetRandom(), OrderByType.Asc); // 鍒嗛〉鏌ヨ鍔犳帓搴� + Console.Write(p.TotalCount); //杩斿洖鎬绘暟 + + List<IConditionalModel> conModels = new(); //缁勮鏉′欢鏌ヨ浣滀负鏉′欢瀹炵幇 鍒嗛〉鏌ヨ鍔犳帓搴� + conModels.Add(new ConditionalModel() + { + FieldName = typeof(Organize).GetProperties()[0].Name, ConditionalType = ConditionalType.Equal, + FieldValue = "1" + }); //id=1 + var data7 = base.GetPageList(conModels, p, it => SqlFunc.GetRandom(), OrderByType.Asc); + + AsQueryable().Where(x => 1 == 1).ToList(); //鏀寔浜嗚浆鎹㈡垚queryable,鎴戜滑鍙互鐢╭ueryable瀹炵幇澶嶆潅鍔熻兘 + + + /*********鎻掑叆*********/ + var insertData = new Organize() { }; //娴嬭瘯鍙傛暟 + var insertArray = new Organize[] { insertData }; + base.Insert(insertData); //鎻掑叆 + base.InsertRange(insertArray); //鎵归噺鎻掑叆 + var id = base.InsertReturnIdentity(insertData); //鎻掑叆杩斿洖鑷鍒� + AsInsertable(insertData).ExecuteCommand(); //鎴戜滑鍙互杞垚 Insertable瀹炵幇澶嶆潅鎻掑叆 + + + /*********鏇存柊*********/ + var updateData = new Organize() { }; //娴嬭瘯鍙傛暟 + var updateArray = new Organize[] { updateData }; //娴嬭瘯鍙傛暟 + base.Update(updateData); //鏍规嵁瀹炰綋鏇存柊 + base.UpdateRange(updateArray); //鎵归噺鏇存柊 + //base.Update(it => new Organize() { ClassName = "a", CreateTime = DateTime.Now }, it => it.id==1);// 鍙洿鏂癈lassName鍒楀拰CreateTime鍒楋紝鍏跺畠鍒椾笉鏇存柊锛屾潯浠秈d=1 + AsUpdateable(updateData).ExecuteCommand(); //杞垚Updateable鍙互瀹炵幇澶嶆潅鐨勬彃鍏� + + + /*********鍒犻櫎*********/ + var deldata = new Organize() { }; //娴嬭瘯鍙傛暟 + base.Delete(deldata); //鏍规嵁瀹炰綋鍒犻櫎 + base.DeleteById(1); //鏍规嵁涓婚敭鍒犻櫎 + base.DeleteById(new int[] { 1, 2 }); //鏍规嵁涓婚敭鏁扮粍鍒犻櫎 + base.Delete(it => 1 == 2); //鏍规嵁鏉′欢鍒犻櫎 + AsDeleteable().Where(it => 1 == 2).ExecuteCommand(); //杞垚Deleteable瀹炵幇澶嶆潅鐨勬搷浣� + } + + #endregion +} \ No newline at end of file diff --git a/MES.Service/service/BasicData/SalesOrderDetailManager.cs b/MES.Service/service/BasicData/SalesOrderDetailManager.cs new file mode 100644 index 0000000..d80f479 --- /dev/null +++ b/MES.Service/service/BasicData/SalesOrderDetailManager.cs @@ -0,0 +1,78 @@ +锘縰sing MES.Service.DB; +using MES.Service.Modes; +using SqlSugar; + +namespace MES.Service.service.BasicData; + +public class SalesOrderDetailManager : Repository<SalesOrderDetail> +{ + //褰撳墠绫诲凡缁忕户鎵夸簡 Repository 澧炪�佸垹銆佹煡銆佹敼鐨勬柟娉� + + //杩欓噷闈㈠啓鐨勪唬鐮佷笉浼氱粰瑕嗙洊,濡傛灉瑕侀噸鏂扮敓鎴愯鍒犻櫎 SalesOrderDetailManager.cs + + + #region 鏁欏鏂规硶 + + /// <summary> + /// 浠撳偍鏂规硶婊¤冻涓嶄簡澶嶆潅涓氬姟闇�姹傦紝涓氬姟浠g爜璇峰湪杩欓噷闈㈠畾涔夋柟娉� + /// </summary> + public void Study() + { + /*********鏌ヨ*********/ + + var data1 = base.GetById(1); //鏍规嵁ID鏌ヨ + var data2 = base.GetList(); //鏌ヨ鎵�鏈� + var data3 = base.GetList(it => 1 == 1); //鏍规嵁鏉′欢鏌ヨ + //var data4 = base.GetSingle(it => 1 == 1);//鏍规嵁鏉′欢鏌ヨ涓�鏉�,濡傛灉瓒呰繃涓�鏉′細鎶ラ敊 + + var p = new PageModel { PageIndex = 1, PageSize = 2 }; // 鍒嗛〉鏌ヨ + var data5 = base.GetPageList(it => 1 == 1, p); + Console.Write(p.TotalCount); //杩斿洖鎬绘暟 + + var data6 = + base.GetPageList(it => 1 == 1, p, + it => SqlFunc.GetRandom()); // 鍒嗛〉鏌ヨ鍔犳帓搴� + Console.Write(p.TotalCount); //杩斿洖鎬绘暟 + + var conModels = new List<IConditionalModel>(); //缁勮鏉′欢鏌ヨ浣滀负鏉′欢瀹炵幇 鍒嗛〉鏌ヨ鍔犳帓搴� + conModels.Add(new ConditionalModel + { + FieldName = typeof(SalesOrderDetail).GetProperties()[0].Name, + ConditionalType = ConditionalType.Equal, FieldValue = "1" + }); //id=1 + var data7 = base.GetPageList(conModels, p, it => SqlFunc.GetRandom()); + + AsQueryable().Where(x => 1 == 1) + .ToList(); //鏀寔浜嗚浆鎹㈡垚queryable,鎴戜滑鍙互鐢╭ueryable瀹炵幇澶嶆潅鍔熻兘 + + + /*********鎻掑叆*********/ + var insertData = new SalesOrderDetail(); //娴嬭瘯鍙傛暟 + var insertArray = new[] { insertData }; + base.Insert(insertData); //鎻掑叆 + base.InsertRange(insertArray); //鎵归噺鎻掑叆 + var id = base.InsertReturnIdentity(insertData); //鎻掑叆杩斿洖鑷鍒� + AsInsertable(insertData).ExecuteCommand(); //鎴戜滑鍙互杞垚 Insertable瀹炵幇澶嶆潅鎻掑叆 + + + /*********鏇存柊*********/ + var updateData = new SalesOrderDetail(); //娴嬭瘯鍙傛暟 + var updateArray = new[] { updateData }; //娴嬭瘯鍙傛暟 + base.Update(updateData); //鏍规嵁瀹炰綋鏇存柊 + base.UpdateRange(updateArray); //鎵归噺鏇存柊 + //base.Update(it => new SalesOrderDetail() { ClassName = "a", CreateTime = DateTime.Now }, it => it.id==1);// 鍙洿鏂癈lassName鍒楀拰CreateTime鍒楋紝鍏跺畠鍒椾笉鏇存柊锛屾潯浠秈d=1 + AsUpdateable(updateData).ExecuteCommand(); //杞垚Updateable鍙互瀹炵幇澶嶆潅鐨勬彃鍏� + + + /*********鍒犻櫎*********/ + var deldata = new SalesOrderDetail(); //娴嬭瘯鍙傛暟 + base.Delete(deldata); //鏍规嵁瀹炰綋鍒犻櫎 + base.DeleteById(1); //鏍规嵁涓婚敭鍒犻櫎 + base.DeleteById(new[] { 1, 2 }); //鏍规嵁涓婚敭鏁扮粍鍒犻櫎 + base.Delete(it => 1 == 2); //鏍规嵁鏉′欢鍒犻櫎 + AsDeleteable().Where(it => 1 == 2) + .ExecuteCommand(); //杞垚Deleteable瀹炵幇澶嶆潅鐨勬搷浣� + } + + #endregion +} \ No newline at end of file diff --git a/MES.Service/service/BasicData/SalesOrderManager.cs b/MES.Service/service/BasicData/SalesOrderManager.cs new file mode 100644 index 0000000..b466f00 --- /dev/null +++ b/MES.Service/service/BasicData/SalesOrderManager.cs @@ -0,0 +1,78 @@ +锘縰sing MES.Service.DB; +using MES.Service.Modes; +using SqlSugar; + +namespace MES.Service.service.BasicData; + +public class SalesOrderManager : Repository<SalesOrder> +{ + //褰撳墠绫诲凡缁忕户鎵夸簡 Repository 澧炪�佸垹銆佹煡銆佹敼鐨勬柟娉� + + //杩欓噷闈㈠啓鐨勪唬鐮佷笉浼氱粰瑕嗙洊,濡傛灉瑕侀噸鏂扮敓鎴愯鍒犻櫎 SalesOrderManager.cs + + + #region 鏁欏鏂规硶 + + /// <summary> + /// 浠撳偍鏂规硶婊¤冻涓嶄簡澶嶆潅涓氬姟闇�姹傦紝涓氬姟浠g爜璇峰湪杩欓噷闈㈠畾涔夋柟娉� + /// </summary> + public void Study() + { + /*********鏌ヨ*********/ + + var data1 = base.GetById(1); //鏍规嵁ID鏌ヨ + var data2 = base.GetList(); //鏌ヨ鎵�鏈� + var data3 = base.GetList(it => 1 == 1); //鏍规嵁鏉′欢鏌ヨ + //var data4 = base.GetSingle(it => 1 == 1);//鏍规嵁鏉′欢鏌ヨ涓�鏉�,濡傛灉瓒呰繃涓�鏉′細鎶ラ敊 + + var p = new PageModel { PageIndex = 1, PageSize = 2 }; // 鍒嗛〉鏌ヨ + var data5 = base.GetPageList(it => 1 == 1, p); + Console.Write(p.TotalCount); //杩斿洖鎬绘暟 + + var data6 = + base.GetPageList(it => 1 == 1, p, + it => SqlFunc.GetRandom()); // 鍒嗛〉鏌ヨ鍔犳帓搴� + Console.Write(p.TotalCount); //杩斿洖鎬绘暟 + + var conModels = new List<IConditionalModel>(); //缁勮鏉′欢鏌ヨ浣滀负鏉′欢瀹炵幇 鍒嗛〉鏌ヨ鍔犳帓搴� + conModels.Add(new ConditionalModel + { + FieldName = typeof(SalesOrder).GetProperties()[0].Name, + ConditionalType = ConditionalType.Equal, FieldValue = "1" + }); //id=1 + var data7 = base.GetPageList(conModels, p, it => SqlFunc.GetRandom()); + + AsQueryable().Where(x => 1 == 1) + .ToList(); //鏀寔浜嗚浆鎹㈡垚queryable,鎴戜滑鍙互鐢╭ueryable瀹炵幇澶嶆潅鍔熻兘 + + + /*********鎻掑叆*********/ + var insertData = new SalesOrder(); //娴嬭瘯鍙傛暟 + var insertArray = new[] { insertData }; + base.Insert(insertData); //鎻掑叆 + base.InsertRange(insertArray); //鎵归噺鎻掑叆 + var id = base.InsertReturnIdentity(insertData); //鎻掑叆杩斿洖鑷鍒� + AsInsertable(insertData).ExecuteCommand(); //鎴戜滑鍙互杞垚 Insertable瀹炵幇澶嶆潅鎻掑叆 + + + /*********鏇存柊*********/ + var updateData = new SalesOrder(); //娴嬭瘯鍙傛暟 + var updateArray = new[] { updateData }; //娴嬭瘯鍙傛暟 + base.Update(updateData); //鏍规嵁瀹炰綋鏇存柊 + base.UpdateRange(updateArray); //鎵归噺鏇存柊 + //base.Update(it => new SalesOrder() { ClassName = "a", CreateTime = DateTime.Now }, it => it.id==1);// 鍙洿鏂癈lassName鍒楀拰CreateTime鍒楋紝鍏跺畠鍒椾笉鏇存柊锛屾潯浠秈d=1 + AsUpdateable(updateData).ExecuteCommand(); //杞垚Updateable鍙互瀹炵幇澶嶆潅鐨勬彃鍏� + + + /*********鍒犻櫎*********/ + var deldata = new SalesOrder(); //娴嬭瘯鍙傛暟 + base.Delete(deldata); //鏍规嵁瀹炰綋鍒犻櫎 + base.DeleteById(1); //鏍规嵁涓婚敭鍒犻櫎 + base.DeleteById(new[] { 1, 2 }); //鏍规嵁涓婚敭鏁扮粍鍒犻櫎 + base.Delete(it => 1 == 2); //鏍规嵁鏉′欢鍒犻櫎 + AsDeleteable().Where(it => 1 == 2) + .ExecuteCommand(); //杞垚Deleteable瀹炵幇澶嶆潅鐨勬搷浣� + } + + #endregion +} \ No newline at end of file diff --git a/MES.Service/service/BasicData/SalesReturnNoticeDetailManager.cs b/MES.Service/service/BasicData/SalesReturnNoticeDetailManager.cs new file mode 100644 index 0000000..78d4c7b --- /dev/null +++ b/MES.Service/service/BasicData/SalesReturnNoticeDetailManager.cs @@ -0,0 +1,79 @@ +锘縰sing MES.Service.DB; +using MES.Service.Modes; +using SqlSugar; + +namespace MES.Service.service.BasicData; + +public class + SalesReturnNoticeDetailManager : Repository<SalesReturnNoticeDetail> +{ + //褰撳墠绫诲凡缁忕户鎵夸簡 Repository 澧炪�佸垹銆佹煡銆佹敼鐨勬柟娉� + + //杩欓噷闈㈠啓鐨勪唬鐮佷笉浼氱粰瑕嗙洊,濡傛灉瑕侀噸鏂扮敓鎴愯鍒犻櫎 SalesReturnNoticeDetailManager.cs + + + #region 鏁欏鏂规硶 + + /// <summary> + /// 浠撳偍鏂规硶婊¤冻涓嶄簡澶嶆潅涓氬姟闇�姹傦紝涓氬姟浠g爜璇峰湪杩欓噷闈㈠畾涔夋柟娉� + /// </summary> + public void Study() + { + /*********鏌ヨ*********/ + + var data1 = base.GetById(1); //鏍规嵁ID鏌ヨ + var data2 = base.GetList(); //鏌ヨ鎵�鏈� + var data3 = base.GetList(it => 1 == 1); //鏍规嵁鏉′欢鏌ヨ + //var data4 = base.GetSingle(it => 1 == 1);//鏍规嵁鏉′欢鏌ヨ涓�鏉�,濡傛灉瓒呰繃涓�鏉′細鎶ラ敊 + + var p = new PageModel { PageIndex = 1, PageSize = 2 }; // 鍒嗛〉鏌ヨ + var data5 = base.GetPageList(it => 1 == 1, p); + Console.Write(p.TotalCount); //杩斿洖鎬绘暟 + + var data6 = + base.GetPageList(it => 1 == 1, p, + it => SqlFunc.GetRandom()); // 鍒嗛〉鏌ヨ鍔犳帓搴� + Console.Write(p.TotalCount); //杩斿洖鎬绘暟 + + var conModels = new List<IConditionalModel>(); //缁勮鏉′欢鏌ヨ浣滀负鏉′欢瀹炵幇 鍒嗛〉鏌ヨ鍔犳帓搴� + conModels.Add(new ConditionalModel + { + FieldName = typeof(SalesReturnNoticeDetail).GetProperties()[0].Name, + ConditionalType = ConditionalType.Equal, FieldValue = "1" + }); //id=1 + var data7 = base.GetPageList(conModels, p, it => SqlFunc.GetRandom()); + + AsQueryable().Where(x => 1 == 1) + .ToList(); //鏀寔浜嗚浆鎹㈡垚queryable,鎴戜滑鍙互鐢╭ueryable瀹炵幇澶嶆潅鍔熻兘 + + + /*********鎻掑叆*********/ + var insertData = new SalesReturnNoticeDetail(); //娴嬭瘯鍙傛暟 + var insertArray = new[] { insertData }; + base.Insert(insertData); //鎻掑叆 + base.InsertRange(insertArray); //鎵归噺鎻掑叆 + var id = base.InsertReturnIdentity(insertData); //鎻掑叆杩斿洖鑷鍒� + AsInsertable(insertData).ExecuteCommand(); //鎴戜滑鍙互杞垚 Insertable瀹炵幇澶嶆潅鎻掑叆 + + + /*********鏇存柊*********/ + var updateData = new SalesReturnNoticeDetail(); //娴嬭瘯鍙傛暟 + var updateArray = new[] { updateData }; //娴嬭瘯鍙傛暟 + base.Update(updateData); //鏍规嵁瀹炰綋鏇存柊 + base.UpdateRange(updateArray); //鎵归噺鏇存柊 + //base.Update(it => new SalesReturnNoticeDetail() { ClassName = "a", CreateTime = DateTime.Now }, it => it.id==1);// 鍙洿鏂癈lassName鍒楀拰CreateTime鍒楋紝鍏跺畠鍒椾笉鏇存柊锛屾潯浠秈d=1 + AsUpdateable(updateData).ExecuteCommand(); //杞垚Updateable鍙互瀹炵幇澶嶆潅鐨勬彃鍏� + + + /*********鍒犻櫎*********/ + var deldata = new SalesReturnNoticeDetail(); //娴嬭瘯鍙傛暟 + base.Delete(deldata); //鏍规嵁瀹炰綋鍒犻櫎 + base.DeleteById(1); //鏍规嵁涓婚敭鍒犻櫎 + base.DeleteById(new[] { 1, 2 }); //鏍规嵁涓婚敭鏁扮粍鍒犻櫎 + base.Delete(it => 1 == 2); //鏍规嵁鏉′欢鍒犻櫎 + AsDeleteable().Where(it => 1 == 2) + .ExecuteCommand(); //杞垚Deleteable瀹炵幇澶嶆潅鐨勬搷浣� + } + + #endregion +} \ No newline at end of file diff --git a/MES.Service/service/BasicData/SalesReturnNoticeManager.cs b/MES.Service/service/BasicData/SalesReturnNoticeManager.cs new file mode 100644 index 0000000..e51ca26 --- /dev/null +++ b/MES.Service/service/BasicData/SalesReturnNoticeManager.cs @@ -0,0 +1,8 @@ +锘縰sing MES.Service.DB; +using MES.Service.Modes; + +namespace MES.Service.service.BasicData; + +public class SalesReturnNoticeManager : Repository<SalesReturnNotice> +{ +} \ No newline at end of file diff --git a/MES.Service/service/BasicData/ShipmentDetailManager.cs b/MES.Service/service/BasicData/ShipmentDetailManager.cs new file mode 100644 index 0000000..67c9435 --- /dev/null +++ b/MES.Service/service/BasicData/ShipmentDetailManager.cs @@ -0,0 +1,78 @@ +锘縰sing MES.Service.DB; +using MES.Service.Modes; +using SqlSugar; + +namespace MES.Service.service.BasicData; + +public class ShipmentDetailManager : Repository<ShipmentDetail> +{ + //褰撳墠绫诲凡缁忕户鎵夸簡 Repository 澧炪�佸垹銆佹煡銆佹敼鐨勬柟娉� + + //杩欓噷闈㈠啓鐨勪唬鐮佷笉浼氱粰瑕嗙洊,濡傛灉瑕侀噸鏂扮敓鎴愯鍒犻櫎 ShipmentDetailManager.cs + + + #region 鏁欏鏂规硶 + + /// <summary> + /// 浠撳偍鏂规硶婊¤冻涓嶄簡澶嶆潅涓氬姟闇�姹傦紝涓氬姟浠g爜璇峰湪杩欓噷闈㈠畾涔夋柟娉� + /// </summary> + public void Study() + { + /*********鏌ヨ*********/ + + var data1 = base.GetById(1); //鏍规嵁ID鏌ヨ + var data2 = base.GetList(); //鏌ヨ鎵�鏈� + var data3 = base.GetList(it => 1 == 1); //鏍规嵁鏉′欢鏌ヨ + //var data4 = base.GetSingle(it => 1 == 1);//鏍规嵁鏉′欢鏌ヨ涓�鏉�,濡傛灉瓒呰繃涓�鏉′細鎶ラ敊 + + var p = new PageModel { PageIndex = 1, PageSize = 2 }; // 鍒嗛〉鏌ヨ + var data5 = base.GetPageList(it => 1 == 1, p); + Console.Write(p.TotalCount); //杩斿洖鎬绘暟 + + var data6 = + base.GetPageList(it => 1 == 1, p, + it => SqlFunc.GetRandom()); // 鍒嗛〉鏌ヨ鍔犳帓搴� + Console.Write(p.TotalCount); //杩斿洖鎬绘暟 + + var conModels = new List<IConditionalModel>(); //缁勮鏉′欢鏌ヨ浣滀负鏉′欢瀹炵幇 鍒嗛〉鏌ヨ鍔犳帓搴� + conModels.Add(new ConditionalModel + { + FieldName = typeof(ShipmentDetail).GetProperties()[0].Name, + ConditionalType = ConditionalType.Equal, FieldValue = "1" + }); //id=1 + var data7 = base.GetPageList(conModels, p, it => SqlFunc.GetRandom()); + + AsQueryable().Where(x => 1 == 1) + .ToList(); //鏀寔浜嗚浆鎹㈡垚queryable,鎴戜滑鍙互鐢╭ueryable瀹炵幇澶嶆潅鍔熻兘 + + + /*********鎻掑叆*********/ + var insertData = new ShipmentDetail(); //娴嬭瘯鍙傛暟 + var insertArray = new[] { insertData }; + base.Insert(insertData); //鎻掑叆 + base.InsertRange(insertArray); //鎵归噺鎻掑叆 + var id = base.InsertReturnIdentity(insertData); //鎻掑叆杩斿洖鑷鍒� + AsInsertable(insertData).ExecuteCommand(); //鎴戜滑鍙互杞垚 Insertable瀹炵幇澶嶆潅鎻掑叆 + + + /*********鏇存柊*********/ + var updateData = new ShipmentDetail(); //娴嬭瘯鍙傛暟 + var updateArray = new[] { updateData }; //娴嬭瘯鍙傛暟 + base.Update(updateData); //鏍规嵁瀹炰綋鏇存柊 + base.UpdateRange(updateArray); //鎵归噺鏇存柊 + //base.Update(it => new ShipmentDetail() { ClassName = "a", CreateTime = DateTime.Now }, it => it.id==1);// 鍙洿鏂癈lassName鍒楀拰CreateTime鍒楋紝鍏跺畠鍒椾笉鏇存柊锛屾潯浠秈d=1 + AsUpdateable(updateData).ExecuteCommand(); //杞垚Updateable鍙互瀹炵幇澶嶆潅鐨勬彃鍏� + + + /*********鍒犻櫎*********/ + var deldata = new ShipmentDetail(); //娴嬭瘯鍙傛暟 + base.Delete(deldata); //鏍规嵁瀹炰綋鍒犻櫎 + base.DeleteById(1); //鏍规嵁涓婚敭鍒犻櫎 + base.DeleteById(new[] { 1, 2 }); //鏍规嵁涓婚敭鏁扮粍鍒犻櫎 + base.Delete(it => 1 == 2); //鏍规嵁鏉′欢鍒犻櫎 + AsDeleteable().Where(it => 1 == 2) + .ExecuteCommand(); //杞垚Deleteable瀹炵幇澶嶆潅鐨勬搷浣� + } + + #endregion +} \ No newline at end of file diff --git a/MES.Service/service/BasicData/ShipmentNoticeManager.cs b/MES.Service/service/BasicData/ShipmentNoticeManager.cs new file mode 100644 index 0000000..26380a5 --- /dev/null +++ b/MES.Service/service/BasicData/ShipmentNoticeManager.cs @@ -0,0 +1,70 @@ +锘縰sing MES.Service.DB; +using MES.Service.Dto.webApi; +using MES.Service.Modes; + +namespace MES.Service.service.BasicData; + +public class ShipmentNoticeManager : Repository<ShipmentNotice> +{ + private readonly ShipmentDetailManager shipmentDetailManager = new(); + + //褰撳墠绫诲凡缁忕户鎵夸簡 Repository 澧炪�佸垹銆佹煡銆佹敼鐨勬柟娉� + public bool Save(ErpShipment shipment) + { + var shipmentNotice = GetShipmentNotice(shipment.ShipmentNotice); + + var shipmentDetails = GetShipmentDetails(shipment.ShipmentDetails); + + return false; + } + + private ShipmentNotice GetShipmentNotice(ErpShipmentNotice notice) + { + var entity = new ShipmentNotice(); + + entity.Creator = notice.FCreatorId; + entity.DocId = notice.FBillNo; + entity.Approver = notice.FApproverID; + + if (notice.FCreateDate != null) + entity.CreateDate = DateTime.ParseExact(notice.FCreateDate, + "yyyy-MM-dd HH:mm:ss", null); + + if (notice.FApproveDate != null) + entity.ApproveDate = DateTime.ParseExact(notice.FApproveDate, + "yyyy-MM-dd HH:mm:ss", null); + + entity.DeptCode = notice.FSaleDeptId; + entity.CustCode = notice.FCustomerID; + entity.ListNote = notice.FNote; + entity.RepCode = notice.FSalesManID; + + return entity; + } + + private List<ShipmentDetail> GetShipmentDetails( + List<ErpShipmentDetail> shipmentDetails) + { + return shipmentDetails.Select(s => + { + var entity = new ShipmentDetail + { + ErpId = s.ErpId, + ErpHeadId = s.ErpHeadId, + ProdCode = s.FMaterialID, + ProdName = s.FMaterialName, + Amount = Convert.ToDouble(s.FAmount), + UnitPrice = Convert.ToDouble(s.FPrice), + Quantity = Convert.ToDouble(s.FQty), + BatchNo = s.FLot, + Remarks = s.FNoteEntry, + OrderNo = s.F_UNW_Text_xsddh, + OrderId = s.FSOEntryId, + BasePrice = Convert.ToDouble(s.FPrice), + WarehouseCode = s.FStockID, + Unit = s.FBaseUnitID + }; + return entity; + }).ToList(); + } +} \ No newline at end of file diff --git a/MES.Service/service/BasicData/SysDepartmentManager.cs b/MES.Service/service/BasicData/SysDepartmentManager.cs new file mode 100644 index 0000000..764532e --- /dev/null +++ b/MES.Service/service/BasicData/SysDepartmentManager.cs @@ -0,0 +1,233 @@ +锘縰sing Castle.Core.Resource; +using MES.Service.DB; +using MES.Service.Dto.webApi; +using MES.Service.Modes; +using SqlSugar; + +namespace MES.Service.service.BasicData; + +public class SysDepartmentManager : Repository<SysDepartment> +{ + // 褰撳墠绫诲凡缁忕户鎵夸簡 Repository 澧炪�佸垹銆佹煡銆佹敼鐨勬柟娉� + + // Save 鏂规硶鐢ㄤ簬淇濆瓨鍗曚釜閮ㄩ棬璁板綍锛屾牴鎹被鍨嬫墽琛屼笉鍚岀殑鎿嶄綔 + public bool Save(ErpDepartment department) + { + var entity = + GetSysDepartment(department); // 灏� ErpDepartment 杞崲涓� SysDepartment + + return UseTransaction(db => + { + switch (department.Type) + { + case "0": + if (UpdateDepartmentStatus(db, entity.Id, "A")) // 鍚敤閮ㄩ棬 + return 1; + break; + case "1": + if (UpdateDepartmentStatus(db, entity.Id, "B")) // 绂佺敤閮ㄩ棬 + return 1; + break; + case "2": + if (InsertDepartment(db, entity)) // 鎻掑叆鏂伴儴闂� + return 1; + break; + case "3": + if (DeleteDepartment(db, entity.Id)) // 鍒犻櫎閮ㄩ棬 + return 1; + break; + case "4": + if (InsertOrUpdateDepartment(db, entity)) // 鎻掑叆鎴栨洿鏂伴儴闂� + return 1; + break; + default: + throw new ArgumentNullException( + $"type娌℃湁{department.Type}杩欎釜绫诲瀷鐨勫弬鏁�"); + } + + throw new NotImplementedException("鎿嶄綔澶辫触"); + }) > 0; + } + + // 鏇存柊閮ㄩ棬鐘舵�佺殑鏂规硶 + private bool UpdateDepartmentStatus(SqlSugarScope db, decimal departmentId, + string status) + { + var result = db.Updateable<SysDepartment>() + .SetColumns(s => s.Depextr4 == status) + .Where(s => s.Id == departmentId).ExecuteCommand(); + + if (result > 0) + return true; + + throw new NotImplementedException(status == "A" ? "鍚敤澶辫触" : "绂佺敤澶辫触"); + } + + // 鎻掑叆鏂伴儴闂ㄧ殑鏂规硶 + private bool InsertDepartment(SqlSugarScope db, SysDepartment entity) + { + var insert = db.Insertable(entity).ExecuteCommand(); + if (insert > 0) + return true; + + throw new NotImplementedException("鎻掑叆澶辫触"); + } + + // 鍒犻櫎閮ㄩ棬鐨勬柟娉� + private bool DeleteDepartment(SqlSugarScope db, decimal departmentId) + { + var deleteById = db.Deleteable<SysDepartment>().In(departmentId) + .ExecuteCommand(); + if (deleteById > 0) + return true; + + throw new NotImplementedException("鍒犻櫎澶辫触"); + } + + // 鎻掑叆鎴栨洿鏂伴儴闂ㄧ殑鏂规硶 + private bool InsertOrUpdateDepartment(SqlSugarScope db, + SysDepartment entity) + { + var exists = db.Queryable<SysDepartment>().Any(e => e.Id == entity.Id); + if (exists) + { + var update = db.Updateable(entity).ExecuteCommand(); + if (update > 0) + return true; + } + else + { + var insert = db.Insertable(entity).ExecuteCommand(); + if (insert > 0) + return true; + } + + return false; + } + + // 灏� ErpDepartment 瀵硅薄杞崲涓� SysDepartment 瀵硅薄鐨勬柟娉� + private SysDepartment GetSysDepartment(ErpDepartment department) + { + return new SysDepartment + { + Departmentcode = department.FNumber, + Departmentname = department.FName, + Departmentid = Convert.ToDecimal(department.Id), + Id = Convert.ToDecimal(department.Id), + Depextr1 = department.FDeptProperty, + Depextr2 = department.FGroup, + Depextr3 = department.FWIPStockID, + Depextr4 = department.FForbidStatus, + FParentID = department.FParentID, + FSubsidiary = department.FUseOrgId, + Fumbrella = department.FCreateOrgId, + CreateDate = DateTime.Now, + LastupdateDate = DateTime.Now, + Company = "1000", + Factory = "1000" + }; + } + + // SaveList 鏂规硶鐢ㄤ簬淇濆瓨澶氫釜閮ㄩ棬璁板綍锛屾牴鎹被鍨嬫壒閲忔墽琛屼笉鍚岀殑鎿嶄綔 + public bool SaveList(List<ErpDepartment> departments) + { + var list = new List<SysDepartment>(); + departments.ForEach(s => + { + var entity = + GetSysDepartment(s); // 灏� ErpDepartment 杞崲涓� SysDepartment + entity.Type = s.Type; + list.Add(entity); + }); + + var groupBy = list.GroupBy(s => s.Type) + .ToDictionary(g => g.Key, g => g.ToList()); + return UseTransaction(db => + { + foreach (var departmentGroup in groupBy) + switch (departmentGroup.Key) + { + case "0": + if (!UpdateDepartmentStatusBatch(db, + departmentGroup.Value, "A")) // 鎵归噺鍚敤閮ㄩ棬 + throw new NotImplementedException("鍚敤澶辫触"); + break; + case "1": + if (!UpdateDepartmentStatusBatch(db, + departmentGroup.Value, "B")) // 鎵归噺绂佺敤閮ㄩ棬 + throw new NotImplementedException("绂佺敤澶辫触"); + break; + case "2": + if (!InsertDepartmentBatch(db, + departmentGroup.Value)) // 鎵归噺鎻掑叆閮ㄩ棬 + throw new NotImplementedException("鎻掑叆澶辫触"); + break; + case "3": + if (!DeleteDepartmentBatch(db, + departmentGroup.Value)) // 鎵归噺鍒犻櫎閮ㄩ棬 + throw new NotImplementedException("鍒犻櫎澶辫触"); + break; + case "4": + if (!InsertOrUpdateDepartmentBatch(db, + departmentGroup.Value)) // 鎵归噺鎻掑叆鎴栨洿鏂伴儴闂� + throw new NotImplementedException("鍚屾澶辫触"); + break; + default: + throw new ArgumentNullException( + $"type娌℃湁{departmentGroup.Key}杩欎釜绫诲瀷鐨勫弬鏁�"); + } + + return 1; + }) > 0; + } + + // 鎵归噺鏇存柊閮ㄩ棬鐘舵�佺殑鏂规硶 + private bool UpdateDepartmentStatusBatch(SqlSugarScope db, + List<SysDepartment> departmentList, string status) + { + var ids = departmentList.Select(it => it.Id).ToArray(); + var result = db.Updateable<SysDepartment>() + .SetColumns(s => s.Depextr4 == status) + .Where(s => ids.Contains(s.Id)).ExecuteCommand(); + + if (result > 0) + return true; + + throw new NotImplementedException(status == "A" ? "鍚敤澶辫触" : "绂佺敤澶辫触"); + } + + // 鎵归噺鎻掑叆閮ㄩ棬鐨勬柟娉� + private bool InsertDepartmentBatch(SqlSugarScope db, + List<SysDepartment> departmentList) + { + var insertRange = db.Insertable(departmentList).ExecuteCommand(); + if (insertRange > 0) + return true; + + throw new NotImplementedException("鎻掑叆澶辫触"); + } + + // 鎵归噺鍒犻櫎閮ㄩ棬鐨勬柟娉� + private bool DeleteDepartmentBatch(SqlSugarScope db, + List<SysDepartment> departmentList) + { + var ids = departmentList.Select(it => it.Id).ToArray(); + var deleteByIds = + db.Deleteable<SysDepartment>().In(ids).ExecuteCommand(); + if (deleteByIds > 0) + return true; + + throw new NotImplementedException("鍒犻櫎澶辫触"); + } + + // 鎵归噺鎻掑叆鎴栨洿鏂伴儴闂ㄧ殑鏂规硶 + private bool InsertOrUpdateDepartmentBatch(SqlSugarScope db, + List<SysDepartment> departmentList) + { + foreach (var entity in departmentList) + if (!InsertOrUpdateDepartment(db, entity)) + return false; + + return true; + } +} \ No newline at end of file diff --git a/MES.Service/service/MessageCenterManager.cs b/MES.Service/service/MessageCenterManager.cs new file mode 100644 index 0000000..5163aff --- /dev/null +++ b/MES.Service/service/MessageCenterManager.cs @@ -0,0 +1,77 @@ +锘縰sing MES.Service.DB; +using MES.Service.Modes; +using SqlSugar; + +namespace MES.Service.service; + +public class MessageCenterManager : Repository<MessageCenter> +{ + //褰撳墠绫诲凡缁忕户鎵夸簡 Repository 澧炪�佸垹銆佹煡銆佹敼鐨勬柟娉� + + public List<MessageCenter> GetPushFailedPage(MessageCenter query) + { + return Context.Queryable<MessageCenter>() + .Where(it => + it.Result == 0 && it.Status == 1 && + it.Seq == 1 && it.Title != null) + .WhereIF(query.isShow == 1, it => it.DealWith == 0) + .OrderByDescending(it => it.CreateDate) + .ToPageList(1, 20); + } + + public int save(MessageCenter entity) + { + entity.CreateDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + entity.Method = "POST"; + return Db.Insertable(entity).ExecuteReturnIdentity(); + } + + public bool SetError(MessageCenter entity) + { + entity.CreateDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + entity.Method = "POST"; + entity.Result = 0; + entity.DealWith = 0; + entity.Status = 1; + return base.Insert(entity); + } + + //鑾峰彇鎵�鏈夋病鏈夋垚鍔熺殑璇锋眰 + public List<MessageCenter> ErrorMsg() + { + return Context.Queryable<MessageCenter>() + .GroupBy(a => new + { + a.TableName, a.Pid, a.Title, a.PageName + }) + .Where(a => + a.DealWith == 0 && a.Status == 0 && a.Result == 0 && + a.Title == null) + .Select<MessageCenter>(a => new MessageCenter + { + TableName = a.TableName, + Pid = a.Pid, + Title = a.Title, + PageName = a.PageName, + Count = SqlFunc.AggregateCount(a.Guid) + }).ToList(); + } + //鏍规嵁鍑犵鎯呭喌鏇存柊 淇濇寔椤甸潰id鏄浐瀹氱殑 + + + //鍓嶅彴閲嶆柊鍙戦�� + public int ResetUpdate(MessageCenter entity) + { + return UseTransaction(db => + { + return db.Updateable<MessageCenter>() + .SetColumns(a => a.Data == entity.Data) + .SetColumns(a => a.Result == entity.Result) + .SetColumns(a => a.ResultData == entity.ResultData) + .SetColumns(a => a.Status == entity.Status) + .SetColumns(a => a.DealWith == entity.DealWith) + .Where(a => a.Guid == entity.Guid) + .ExecuteCommand(); + }); + } +} \ No newline at end of file diff --git a/MESApplication/Controllers/BasicData/MesCustomerController.cs b/MESApplication/Controllers/BasicData/MesCustomerController.cs new file mode 100644 index 0000000..6d08d50 --- /dev/null +++ b/MESApplication/Controllers/BasicData/MesCustomerController.cs @@ -0,0 +1,257 @@ +锘縰sing System.Dynamic; +using MES.Service.Dto.webApi; +using MES.Service.Modes; +using MES.Service.service; +using MES.Service.service.BasicData; +using MES.Service.util; +using Microsoft.AspNetCore.Mvc; +using Newtonsoft.Json; + +namespace MESApplication.Controllers.BasicData; + +[ApiController] +[Route("api/[controller]")] +public class MesCustomerController : ControllerBase +{ + private readonly MessageCenterManager _manager = new(); + private readonly MesCustomerManager m = new(); + + private readonly string METHOD = "POST"; + + private readonly string TableName = "MES_CUSTOMER"; + + private readonly string URL = "http://localhost:10054/api/MesCustomer/"; + + [HttpPost("Save")] + public ResponseResult Save(ErpCustomer unit) + { + var entity = new MessageCenter(); + entity.TableName = TableName; + entity.Url = URL + "Save"; + entity.Method = METHOD; + entity.Data = JsonConvert.SerializeObject(unit); + entity.Status = 1; + entity.CreateBy = "PL017"; + try + { + dynamic resultInfos = new ExpandoObject(); + var save = m.Save(unit); + resultInfos.tbBillList = save; + + entity.Result = 0; + if (save) entity.Result = 1; + + entity.DealWith = 1; + _manager.save(entity); + + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + entity.Result = 0; + + entity.DealWith = 0; + + entity.ResultData = ex.Message; + + _manager.save(entity); + + return ResponseResult.ResponseError(ex); + } + } + + [HttpPost("SaveList")] + public ResponseResult SaveList(List<ErpCustomer> units) + { + var entity = new MessageCenter(); + entity.TableName = TableName; + entity.Url = URL + "SaveList"; + entity.Method = METHOD; + entity.Data = JsonConvert.SerializeObject(units); + entity.Status = 1; + entity.CreateBy = "PL017"; + try + { + dynamic resultInfos = new ExpandoObject(); + var save = m.SaveList(units); + resultInfos.tbBillList = save; + + entity.Result = 0; + if (save) entity.Result = 1; + + entity.DealWith = 1; + _manager.save(entity); + + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + entity.Result = 0; + + entity.DealWith = 0; + + entity.ResultData = ex.Message; + + _manager.save(entity); + + return ResponseResult.ResponseError(ex); + } + } + + /***杩涘叆妯$増绠$悊鍙互淇敼妯$増***/ + + /// <summary> + /// 鑾峰彇鎵�鏈� + /// </summary> + /// <returns></returns> + [HttpPost("GetList")] + public ResponseResult GetList() + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.GetList(); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + + /// <summary> + /// 鏍规嵁涓婚敭鑾峰彇 + /// </summary> + /// <returns></returns> + [HttpPost("GetById")] + public ResponseResult GetById(int id) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.GetById(id); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 鏍规嵁涓婚敭鍒犻櫎 + /// </summary> + /// <returns></returns> + [HttpPost("DeleteByIds")] + public ResponseResult DeleteByIds([FromBody] object[] ids) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.DeleteByIds(ids); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 娣诲姞 + /// </summary> + /// <returns></returns> + [HttpPost("Insert")] + public ResponseResult Add([FromBody] MesCustomer data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.Insert(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 娣诲姞杩斿洖鑷 + /// </summary> + /// <returns></returns> + [HttpPost("InsertReturnIdentity")] + public ResponseResult InsertReturnIdentity([FromBody] MesCustomer data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.InsertReturnIdentity(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 淇敼 + /// </summary> + /// <returns></returns> + [HttpPost("Update")] + public ResponseResult Update([FromBody] MesCustomer data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.Update(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } +} \ No newline at end of file diff --git a/MESApplication/Controllers/BasicData/MesDepotsController.cs b/MESApplication/Controllers/BasicData/MesDepotsController.cs new file mode 100644 index 0000000..3a20310 --- /dev/null +++ b/MESApplication/Controllers/BasicData/MesDepotsController.cs @@ -0,0 +1,255 @@ +锘縰sing System.Dynamic; +using MES.Service.Dto.webApi; +using MES.Service.Modes; +using MES.Service.service; +using MES.Service.service.BasicData; +using MES.Service.util; +using Microsoft.AspNetCore.Mvc; +using Newtonsoft.Json; + +namespace MESApplication.Controllers.BasicData; + +[ApiController] +[Route("api/[controller]")] +public class MesDepotsController : ControllerBase +{ + private readonly MessageCenterManager _manager = new(); + private readonly MesDepotsManager m = new(); + + private readonly string METHOD = "POST"; + + private readonly string TableName = "MES_DEPOTS"; + + private readonly string URL = "http://localhost:10054/api/MesDepots/"; + + [HttpPost("Save")] + public ResponseResult Save(ErpDepots unit) + { + var entity = new MessageCenter(); + entity.TableName = TableName; + entity.Url = URL + "Save"; + entity.Method = METHOD; + entity.Data = JsonConvert.SerializeObject(unit); + entity.Status = 1; + entity.CreateBy = "PL017"; + try + { + dynamic resultInfos = new ExpandoObject(); + var save = m.Save(unit); + resultInfos.tbBillList = save; + + entity.Result = 0; + if (save) entity.Result = 1; + + entity.DealWith = 1; + _manager.save(entity); + + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + entity.Result = 0; + + entity.DealWith = 0; + + entity.ResultData = ex.Message; + + _manager.save(entity); + + return ResponseResult.ResponseError(ex); + } + } + + [HttpPost("SaveList")] + public ResponseResult SaveList(List<ErpDepots> units) + { + var entity = new MessageCenter(); + entity.TableName = TableName; + entity.Url = URL + "SaveList"; + entity.Method = METHOD; + entity.Data = JsonConvert.SerializeObject(units); + entity.Status = 1; + entity.CreateBy = "PL017"; + try + { + dynamic resultInfos = new ExpandoObject(); + var save = m.SaveList(units); + resultInfos.tbBillList = save; + + entity.Result = 0; + if (save) entity.Result = 1; + + entity.DealWith = 1; + _manager.save(entity); + + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + entity.Result = 0; + + entity.DealWith = 0; + + entity.ResultData = ex.Message; + + _manager.save(entity); + + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 鑾峰彇鎵�鏈� + /// </summary> + /// <returns></returns> + [HttpPost("GetList")] + public ResponseResult GetList() + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.GetList(); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + + /// <summary> + /// 鏍规嵁涓婚敭鑾峰彇 + /// </summary> + /// <returns></returns> + [HttpPost("GetById")] + public ResponseResult GetById(int id) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.GetById(id); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 鏍规嵁涓婚敭鍒犻櫎 + /// </summary> + /// <returns></returns> + [HttpPost("DeleteByIds")] + public ResponseResult DeleteByIds([FromBody] object[] ids) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.DeleteByIds(ids); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 娣诲姞 + /// </summary> + /// <returns></returns> + [HttpPost("Insert")] + public ResponseResult Add([FromBody] MesDepots data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.Insert(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 娣诲姞杩斿洖鑷 + /// </summary> + /// <returns></returns> + [HttpPost("InsertReturnIdentity")] + public ResponseResult InsertReturnIdentity([FromBody] MesDepots data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.InsertReturnIdentity(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 淇敼 + /// </summary> + /// <returns></returns> + [HttpPost("Update")] + public ResponseResult Update([FromBody] MesDepots data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.Update(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } +} \ No newline at end of file diff --git a/MESApplication/Controllers/BasicData/MesItemTypeController.cs b/MESApplication/Controllers/BasicData/MesItemTypeController.cs new file mode 100644 index 0000000..a71b56f --- /dev/null +++ b/MESApplication/Controllers/BasicData/MesItemTypeController.cs @@ -0,0 +1,259 @@ +锘縰sing System.Dynamic; +using MES.Service.Dto.webApi; +using MES.Service.Modes; +using MES.Service.service; +using MES.Service.service.BasicData; +using MES.Service.util; +using Microsoft.AspNetCore.Mvc; +using Newtonsoft.Json; + +namespace MESApplication.Controllers.BasicData; + +[ApiController] +[Route("api/[controller]")] +public class MesItemTypeController : ControllerBase +{ + private readonly MessageCenterManager _manager = new(); + + private readonly MesItemTypeManager m = new(); + + private readonly string METHOD = "POST"; + + private readonly string TableName = "MES_ITEM_TYPE"; + + private readonly string URL = "http://localhost:10054/api/MesItemType/"; + + [HttpPost("Save")] + public ResponseResult Save(ErpItemType unit) + { + var entity = new MessageCenter(); + entity.TableName = TableName; + entity.Url = URL + "Save"; + entity.Method = METHOD; + entity.Data = JsonConvert.SerializeObject(unit); + entity.Status = 1; + entity.CreateBy = "PL017"; + try + { + dynamic resultInfos = new ExpandoObject(); + var save = m.Save(unit); + resultInfos.tbBillList = save; + + entity.Result = 0; + if (save) entity.Result = 1; + + entity.DealWith = 1; + _manager.save(entity); + + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + entity.Result = 0; + + entity.DealWith = 0; + + entity.ResultData = ex.Message; + + _manager.save(entity); + + return ResponseResult.ResponseError(ex); + } + } + + [HttpPost("SaveList")] + public ResponseResult SaveList(List<ErpItemType> units) + { + var entity = new MessageCenter(); + entity.TableName = TableName; + entity.Url = URL + "SaveList"; + entity.Method = METHOD; + entity.Data = JsonConvert.SerializeObject(units); + entity.Status = 1; + entity.CreateBy = "PL017"; + try + { + dynamic resultInfos = new ExpandoObject(); + var save = m.SaveList(units); + resultInfos.tbBillList = save; + + entity.Result = 0; + if (save) entity.Result = 1; + + entity.DealWith = 1; + _manager.save(entity); + + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + entity.Result = 0; + + entity.DealWith = 0; + + entity.ResultData = ex.Message; + + _manager.save(entity); + + return ResponseResult.ResponseError(ex); + } + } + + + /***杩涘叆妯$増绠$悊鍙互淇敼妯$増***/ + + /// <summary> + /// 鑾峰彇鎵�鏈� + /// </summary> + /// <returns></returns> + [HttpPost("GetList")] + public ResponseResult GetList() + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.GetList(); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + + /// <summary> + /// 鏍规嵁涓婚敭鑾峰彇 + /// </summary> + /// <returns></returns> + [HttpPost("GetById")] + public ResponseResult GetById(int id) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.GetById(id); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 鏍规嵁涓婚敭鍒犻櫎 + /// </summary> + /// <returns></returns> + [HttpPost("DeleteByIds")] + public ResponseResult DeleteByIds([FromBody] object[] ids) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.DeleteByIds(ids); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 娣诲姞 + /// </summary> + /// <returns></returns> + [HttpPost("Insert")] + public ResponseResult Add([FromBody] MesItemType data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.Insert(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 娣诲姞杩斿洖鑷 + /// </summary> + /// <returns></returns> + [HttpPost("InsertReturnIdentity")] + public ResponseResult InsertReturnIdentity([FromBody] MesItemType data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.InsertReturnIdentity(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 淇敼 + /// </summary> + /// <returns></returns> + [HttpPost("Update")] + public ResponseResult Update([FromBody] MesItemType data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.Update(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } +} \ No newline at end of file diff --git a/MESApplication/Controllers/BasicData/MesItemsController.cs b/MESApplication/Controllers/BasicData/MesItemsController.cs new file mode 100644 index 0000000..c095307 --- /dev/null +++ b/MESApplication/Controllers/BasicData/MesItemsController.cs @@ -0,0 +1,256 @@ +锘縰sing System.Dynamic; +using MES.Service.Dto.webApi; +using MES.Service.Modes; +using MES.Service.service; +using MES.Service.service.BasicData; +using MES.Service.util; +using Microsoft.AspNetCore.Mvc; +using Newtonsoft.Json; + +namespace MESApplication.Controllers.BasicData; + +[ApiController] +[Route("api/[controller]")] +public class MesItemsController : ControllerBase +{ + private readonly MessageCenterManager _manager = new(); + private readonly MesItemsManager m = new(); + + private readonly string METHOD = "POST"; + + private readonly string TableName = "MES_ITEMS"; + + private readonly string URL = "http://localhost:10054/api/MesItems/"; + + [HttpPost("Save")] + public ResponseResult Save(ErpItems unit) + { + var entity = new MessageCenter(); + entity.TableName = TableName; + entity.Url = URL + "Save"; + entity.Method = METHOD; + entity.Data = JsonConvert.SerializeObject(unit); + entity.Status = 1; + entity.CreateBy = "PL017"; + + try + { + dynamic resultInfos = new ExpandoObject(); + var save = m.Save(unit); + resultInfos.tbBillList = save; + + entity.Result = 0; + if (save) entity.Result = 1; + + entity.DealWith = 1; + _manager.save(entity); + + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + entity.Result = 0; + + entity.DealWith = 0; + + entity.ResultData = ex.Message; + + _manager.save(entity); + + return ResponseResult.ResponseError(ex); + } + } + + [HttpPost("SaveList")] + public ResponseResult SaveList(List<ErpItems> units) + { + var entity = new MessageCenter(); + entity.TableName = TableName; + entity.Url = URL + "SaveList"; + entity.Method = METHOD; + entity.Data = JsonConvert.SerializeObject(units); + entity.Status = 1; + entity.CreateBy = "PL017"; + try + { + dynamic resultInfos = new ExpandoObject(); + var save = m.SaveList(units); + resultInfos.tbBillList = save; + + entity.Result = 0; + if (save) entity.Result = 1; + + entity.DealWith = 1; + _manager.save(entity); + + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + entity.Result = 0; + + entity.DealWith = 0; + + entity.ResultData = ex.Message; + + _manager.save(entity); + + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 鑾峰彇鎵�鏈� + /// </summary> + /// <returns></returns> + [HttpPost("GetList")] + public ResponseResult GetList() + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.GetList(); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + + /// <summary> + /// 鏍规嵁涓婚敭鑾峰彇 + /// </summary> + /// <returns></returns> + [HttpPost("GetById")] + public ResponseResult GetById(int id) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.GetById(id); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 鏍规嵁涓婚敭鍒犻櫎 + /// </summary> + /// <returns></returns> + [HttpPost("DeleteByIds")] + public ResponseResult DeleteByIds([FromBody] object[] ids) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.DeleteByIds(ids); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 娣诲姞 + /// </summary> + /// <returns></returns> + [HttpPost("Insert")] + public ResponseResult Add([FromBody] MesItems data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.Insert(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 娣诲姞杩斿洖鑷 + /// </summary> + /// <returns></returns> + [HttpPost("InsertReturnIdentity")] + public ResponseResult InsertReturnIdentity([FromBody] MesItems data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.InsertReturnIdentity(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 淇敼 + /// </summary> + /// <returns></returns> + [HttpPost("Update")] + public ResponseResult Update([FromBody] MesItems data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.Update(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } +} \ No newline at end of file diff --git a/MESApplication/Controllers/BasicData/MesPositionController.cs b/MESApplication/Controllers/BasicData/MesPositionController.cs new file mode 100644 index 0000000..655941c --- /dev/null +++ b/MESApplication/Controllers/BasicData/MesPositionController.cs @@ -0,0 +1,256 @@ +锘縰sing System.Dynamic; +using MES.Service.Dto.webApi; +using MES.Service.Modes; +using MES.Service.service; +using MES.Service.service.BasicData; +using MES.Service.util; +using Microsoft.AspNetCore.Mvc; +using Newtonsoft.Json; + +namespace MESApplication.Controllers.BasicData; + +[ApiController] +[Route("api/[controller]")] +public class MesPositionController : ControllerBase +{ + private readonly MessageCenterManager _manager = new(); + + private readonly MesPositionManager m = new(); + + private readonly string METHOD = "POST"; + private readonly string TableName = "MES_POSITION"; + + private readonly string URL = "http://localhost:10054/api/MesPosition/"; + + + [HttpPost("Save")] + public ResponseResult Save(ErpPosition unit) + { + var entity = new MessageCenter(); + entity.TableName = TableName; + entity.Url = URL + "Save"; + entity.Method = METHOD; + entity.Data = JsonConvert.SerializeObject(unit); + entity.Status = 1; + entity.CreateBy = "PL017"; + try + { + dynamic resultInfos = new ExpandoObject(); + var save = m.Save(unit); + resultInfos.tbBillList = save; + + entity.Result = 0; + if (save) entity.Result = 1; + + entity.DealWith = 1; + _manager.save(entity); + + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + entity.Result = 0; + + entity.DealWith = 0; + + entity.ResultData = ex.Message; + + _manager.save(entity); + + return ResponseResult.ResponseError(ex); + } + } + + [HttpPost("SaveList")] + public ResponseResult SaveList(List<ErpPosition> units) + { + var entity = new MessageCenter(); + entity.TableName = TableName; + entity.Url = URL + "SaveList"; + entity.Method = METHOD; + entity.Data = JsonConvert.SerializeObject(units); + entity.Status = 1; + entity.CreateBy = "PL017"; + try + { + dynamic resultInfos = new ExpandoObject(); + var save = m.SaveList(units); + resultInfos.tbBillList = save; + + entity.Result = 0; + if (save) entity.Result = 1; + + entity.DealWith = 1; + _manager.save(entity); + + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + entity.Result = 0; + + entity.DealWith = 0; + + entity.ResultData = ex.Message; + + _manager.save(entity); + + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 鑾峰彇鎵�鏈� + /// </summary> + /// <returns></returns> + [HttpPost("GetList")] + public ResponseResult GetList() + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.GetList(); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + + /// <summary> + /// 鏍规嵁涓婚敭鑾峰彇 + /// </summary> + /// <returns></returns> + [HttpPost("GetById")] + public ResponseResult GetById(int id) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.GetById(id); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 鏍规嵁涓婚敭鍒犻櫎 + /// </summary> + /// <returns></returns> + [HttpPost("DeleteByIds")] + public ResponseResult DeleteByIds([FromBody] object[] ids) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.DeleteByIds(ids); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 娣诲姞 + /// </summary> + /// <returns></returns> + [HttpPost("Insert")] + public ResponseResult Add([FromBody] MesPosition data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.Insert(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 娣诲姞杩斿洖鑷 + /// </summary> + /// <returns></returns> + [HttpPost("InsertReturnIdentity")] + public ResponseResult InsertReturnIdentity([FromBody] MesPosition data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.InsertReturnIdentity(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 淇敼 + /// </summary> + /// <returns></returns> + [HttpPost("Update")] + public ResponseResult Update([FromBody] MesPosition data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.Update(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } +} \ No newline at end of file diff --git a/MESApplication/Controllers/BasicData/MesRohInController.cs b/MESApplication/Controllers/BasicData/MesRohInController.cs new file mode 100644 index 0000000..6e5c8d1 --- /dev/null +++ b/MESApplication/Controllers/BasicData/MesRohInController.cs @@ -0,0 +1,257 @@ +锘縰sing System.Dynamic; +using MES.Service.Dto.webApi; +using MES.Service.Modes; +using MES.Service.service; +using MES.Service.service.BasicData; +using MES.Service.util; +using Microsoft.AspNetCore.Mvc; +using Newtonsoft.Json; + +namespace MESApplication.Controllers.BasicData; + +[ApiController] +[Route("api/[controller]")] +public class MesRohInController : ControllerBase +{ + private readonly MessageCenterManager _manager = new(); + private readonly MesRohInManager m = new(); + + private readonly string METHOD = "POST"; + + private readonly string TableName = "MES_ROHIN"; + + private readonly string URL = "http://localhost:10054/api/MesRohIn/"; + + // + [HttpPost("Save")] + public ResponseResult Save(RohIn rohIn) + { + var entity = new MessageCenter(); + entity.TableName = TableName; + entity.Url = URL + "Save"; + entity.Method = METHOD; + entity.Data = JsonConvert.SerializeObject(rohIn); + entity.Status = 1; + entity.CreateBy = "PL017"; + try + { + dynamic resultInfos = new ExpandoObject(); + var save = m.Save(rohIn); + + resultInfos.tbBillList = save; + + entity.Result = 0; + if (save) entity.Result = 1; + + entity.DealWith = 1; + _manager.save(entity); + + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + entity.Result = 0; + + entity.DealWith = 0; + + entity.ResultData = ex.Message; + + _manager.save(entity); + + return ResponseResult.ResponseError(ex); + } + } + + [HttpPost("SaveList")] + public ResponseResult SaveList(List<RohIn> units) + { + var entity = new MessageCenter(); + entity.TableName = TableName; + entity.Url = URL + "SaveList"; + entity.Method = METHOD; + entity.Data = JsonConvert.SerializeObject(units); + entity.Status = 1; + entity.CreateBy = "PL017"; + try + { + dynamic resultInfos = new ExpandoObject(); + var save = m.SaveList(units); + resultInfos.tbBillList = save; + + entity.Result = 0; + if (save) entity.Result = 1; + + entity.DealWith = 1; + _manager.save(entity); + + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + entity.Result = 0; + + entity.DealWith = 0; + + entity.ResultData = ex.Message; + + _manager.save(entity); + + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 鑾峰彇鎵�鏈� + /// </summary> + /// <returns></returns> + [HttpPost("GetList")] + public ResponseResult GetList() + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.GetList(); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + + /// <summary> + /// 鏍规嵁涓婚敭鑾峰彇 + /// </summary> + /// <returns></returns> + [HttpPost("GetById")] + public ResponseResult GetById(int id) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.GetById(id); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 鏍规嵁涓婚敭鍒犻櫎 + /// </summary> + /// <returns></returns> + [HttpPost("DeleteByIds")] + public ResponseResult DeleteByIds([FromBody] object[] ids) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.DeleteByIds(ids); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 娣诲姞 + /// </summary> + /// <returns></returns> + [HttpPost("Insert")] + public ResponseResult Add([FromBody] MesRohIn data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.Insert(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 娣诲姞杩斿洖鑷 + /// </summary> + /// <returns></returns> + [HttpPost("InsertReturnIdentity")] + public ResponseResult InsertReturnIdentity([FromBody] MesRohIn data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.InsertReturnIdentity(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 淇敼 + /// </summary> + /// <returns></returns> + [HttpPost("Update")] + public ResponseResult Update([FromBody] MesRohIn data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.Update(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } +} \ No newline at end of file diff --git a/MESApplication/Controllers/BasicData/MesRohInDataController.cs b/MESApplication/Controllers/BasicData/MesRohInDataController.cs new file mode 100644 index 0000000..aff8ba6 --- /dev/null +++ b/MESApplication/Controllers/BasicData/MesRohInDataController.cs @@ -0,0 +1,162 @@ +锘縰sing System.Dynamic; +using MES.Service.Modes; +using MES.Service.service.BasicData; +using MES.Service.util; +using Microsoft.AspNetCore.Mvc; + +namespace MESApplication.Controllers.BasicData; + +[ApiController] +[Route("api/[controller]")] +public class MesRohInDataController : ControllerBase +{ + private readonly MesRohInDataManager m = new(); + + + /***杩涘叆妯$増绠$悊鍙互淇敼妯$増***/ + + /// <summary> + /// 鑾峰彇鎵�鏈� + /// </summary> + /// <returns></returns> + [HttpPost("GetList")] + public ResponseResult GetList() + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.GetList(); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + + /// <summary> + /// 鏍规嵁涓婚敭鑾峰彇 + /// </summary> + /// <returns></returns> + [HttpPost("GetById")] + public ResponseResult GetById(int id) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.GetById(id); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 鏍规嵁涓婚敭鍒犻櫎 + /// </summary> + /// <returns></returns> + [HttpPost("DeleteByIds")] + public ResponseResult DeleteByIds([FromBody] object[] ids) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.DeleteByIds(ids); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 娣诲姞 + /// </summary> + /// <returns></returns> + [HttpPost("Insert")] + public ResponseResult Add([FromBody] MesRohInData data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.Insert(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 娣诲姞杩斿洖鑷 + /// </summary> + /// <returns></returns> + [HttpPost("InsertReturnIdentity")] + public ResponseResult InsertReturnIdentity([FromBody] MesRohInData data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.InsertReturnIdentity(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 淇敼 + /// </summary> + /// <returns></returns> + [HttpPost("Update")] + public ResponseResult Update([FromBody] MesRohInData data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.Update(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } +} \ No newline at end of file diff --git a/MESApplication/Controllers/BasicData/MesStaffController.cs b/MESApplication/Controllers/BasicData/MesStaffController.cs new file mode 100644 index 0000000..9a11979 --- /dev/null +++ b/MESApplication/Controllers/BasicData/MesStaffController.cs @@ -0,0 +1,257 @@ +锘縰sing System.Dynamic; +using MES.Service.Dto.webApi; +using MES.Service.Modes; +using MES.Service.service; +using MES.Service.service.BasicData; +using MES.Service.util; +using Microsoft.AspNetCore.Mvc; +using Newtonsoft.Json; + +namespace MESApplication.Controllers.BasicData; + +[ApiController] +[Route("api/[controller]")] +public class MesStaffController : ControllerBase +{ + private readonly MessageCenterManager _manager = new(); + + private readonly MesStaffManager m = new(); + + private readonly string METHOD = "POST"; + private readonly string TableName = "MES_STAFF"; + + private readonly string URL = "http://localhost:10054/api/MesStaff/"; + + [HttpPost("SaveStaff")] + public ResponseResult SaveStaff(ErpStaff staff) + { + var entity = new MessageCenter(); + entity.TableName = TableName; + entity.Url = URL + "SaveStaff"; + entity.Method = METHOD; + entity.Data = JsonConvert.SerializeObject(staff); + entity.Status = 1; + entity.CreateBy = "PL017"; + try + { + dynamic resultInfos = new ExpandoObject(); + var save = m.Save(staff); + resultInfos.tbBillList = save; + + entity.Result = 0; + if (save) entity.Result = 1; + + entity.DealWith = 1; + _manager.save(entity); + + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + entity.Result = 0; + + entity.DealWith = 0; + + entity.ResultData = ex.Message; + + _manager.save(entity); + + return ResponseResult.ResponseError(ex); + } + } + + [HttpPost("SaveStaffList")] + public ResponseResult SaveStaffList(List<ErpStaff> staffs) + { + var entity = new MessageCenter(); + entity.TableName = TableName; + entity.Url = URL + "SaveStaffList"; + entity.Method = METHOD; + entity.Data = JsonConvert.SerializeObject(staffs); + entity.Status = 1; + entity.CreateBy = "PL017"; + try + { + dynamic resultInfos = new ExpandoObject(); + var saveList = m.SaveList(staffs); + resultInfos.tbBillList = saveList; + + + entity.Result = 0; + if (saveList) entity.Result = 1; + + entity.DealWith = 1; + _manager.save(entity); + + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + entity.Result = 0; + + entity.DealWith = 0; + + entity.ResultData = ex.Message; + + _manager.save(entity); + + return ResponseResult.ResponseError(ex); + } + } + + + /// <summary> + /// 鑾峰彇鎵�鏈� + /// </summary> + /// <returns></returns> + [HttpPost("GetList")] + public ResponseResult GetList() + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.GetList(); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + + /// <summary> + /// 鏍规嵁涓婚敭鑾峰彇 + /// </summary> + /// <returns></returns> + [HttpPost("GetById")] + public ResponseResult GetById(int id) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.GetById(id); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 鏍规嵁涓婚敭鍒犻櫎 + /// </summary> + /// <returns></returns> + [HttpPost("DeleteByIds")] + public ResponseResult DeleteByIds([FromBody] object[] ids) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.DeleteByIds(ids); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 娣诲姞 + /// </summary> + /// <returns></returns> + [HttpPost("Insert")] + public ResponseResult Add([FromBody] MesStaff data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.Insert(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 娣诲姞杩斿洖鑷 + /// </summary> + /// <returns></returns> + [HttpPost("InsertReturnIdentity")] + public ResponseResult InsertReturnIdentity([FromBody] MesStaff data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.InsertReturnIdentity(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 淇敼 + /// </summary> + /// <returns></returns> + [HttpPost("Update")] + public ResponseResult Update([FromBody] MesStaff data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.Update(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } +} \ No newline at end of file diff --git a/MESApplication/Controllers/BasicData/MesSupplierController.cs b/MESApplication/Controllers/BasicData/MesSupplierController.cs new file mode 100644 index 0000000..8782e2d --- /dev/null +++ b/MESApplication/Controllers/BasicData/MesSupplierController.cs @@ -0,0 +1,255 @@ +锘縰sing System.Dynamic; +using MES.Service.Dto.webApi; +using MES.Service.Modes; +using MES.Service.service; +using MES.Service.service.BasicData; +using MES.Service.util; +using Microsoft.AspNetCore.Mvc; +using Newtonsoft.Json; + +namespace MESApplication.Controllers.BasicData; + +[ApiController] +[Route("api/[controller]")] +public class MesSupplierController : ControllerBase +{ + private readonly MessageCenterManager _manager = new(); + private readonly MesSupplierManager m = new(); + + private readonly string METHOD = "POST"; + + private readonly string TableName = "MES_SUPPLIER"; + + private readonly string URL = "http://localhost:10054/api/MesSupplier/"; + + [HttpPost("Save")] + public ResponseResult Save(ErpSupplier unit) + { + var entity = new MessageCenter(); + entity.TableName = TableName; + entity.Url = URL + "Save"; + entity.Method = METHOD; + entity.Data = JsonConvert.SerializeObject(unit); + entity.Status = 1; + entity.CreateBy = "PL017"; + try + { + dynamic resultInfos = new ExpandoObject(); + var save = m.Save(unit); + resultInfos.tbBillList = save; + + entity.Result = 0; + if (save) entity.Result = 1; + + entity.DealWith = 1; + _manager.save(entity); + + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + entity.Result = 0; + + entity.DealWith = 0; + + entity.ResultData = ex.Message; + + _manager.save(entity); + + return ResponseResult.ResponseError(ex); + } + } + + [HttpPost("SaveList")] + public ResponseResult SaveList(List<ErpSupplier> units) + { + var entity = new MessageCenter(); + entity.TableName = TableName; + entity.Url = URL + "SaveList"; + entity.Method = METHOD; + entity.Data = JsonConvert.SerializeObject(units); + entity.Status = 1; + entity.CreateBy = "PL017"; + try + { + dynamic resultInfos = new ExpandoObject(); + var save = m.SaveList(units); + resultInfos.tbBillList = save; + + entity.Result = 0; + if (save) entity.Result = 1; + + entity.DealWith = 1; + _manager.save(entity); + + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + entity.Result = 0; + + entity.DealWith = 0; + + entity.ResultData = ex.Message; + + _manager.save(entity); + + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 鑾峰彇鎵�鏈� + /// </summary> + /// <returns></returns> + [HttpPost("GetList")] + public ResponseResult GetList() + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.GetList(); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + + /// <summary> + /// 鏍规嵁涓婚敭鑾峰彇 + /// </summary> + /// <returns></returns> + [HttpPost("GetById")] + public ResponseResult GetById(int id) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.GetById(id); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 鏍规嵁涓婚敭鍒犻櫎 + /// </summary> + /// <returns></returns> + [HttpPost("DeleteByIds")] + public ResponseResult DeleteByIds([FromBody] object[] ids) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.DeleteByIds(ids); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 娣诲姞 + /// </summary> + /// <returns></returns> + [HttpPost("Insert")] + public ResponseResult Add([FromBody] MesSupplier data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.Insert(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 娣诲姞杩斿洖鑷 + /// </summary> + /// <returns></returns> + [HttpPost("InsertReturnIdentity")] + public ResponseResult InsertReturnIdentity([FromBody] MesSupplier data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.InsertReturnIdentity(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 淇敼 + /// </summary> + /// <returns></returns> + [HttpPost("Update")] + public ResponseResult Update([FromBody] MesSupplier data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.Update(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } +} \ No newline at end of file diff --git a/MESApplication/Controllers/BasicData/MesUnitController.cs b/MESApplication/Controllers/BasicData/MesUnitController.cs new file mode 100644 index 0000000..3d20342 --- /dev/null +++ b/MESApplication/Controllers/BasicData/MesUnitController.cs @@ -0,0 +1,255 @@ +锘縰sing System.Dynamic; +using MES.Service.Dto.webApi; +using MES.Service.Modes; +using MES.Service.service; +using MES.Service.service.BasicData; +using MES.Service.util; +using Microsoft.AspNetCore.Mvc; +using Newtonsoft.Json; + +namespace MESApplication.Controllers.BasicData; + +[ApiController] +[Route("api/[controller]")] +public class MesUnitController : ControllerBase +{ + private readonly MessageCenterManager _manager = new(); + private readonly MesUnitManager m = new(); + + private readonly string METHOD = "POST"; + + private readonly string TableName = "MES_UNIT"; + + private readonly string URL = "http://localhost:10054/api/MesUnit/"; + + [HttpPost("Save")] + public ResponseResult Save(ErpUnit unit) + { + var entity = new MessageCenter(); + entity.TableName = TableName; + entity.Url = URL + "Save"; + entity.Method = METHOD; + entity.Data = JsonConvert.SerializeObject(unit); + entity.Status = 1; + entity.CreateBy = "PL017"; + try + { + dynamic resultInfos = new ExpandoObject(); + var save = m.Save(unit); + resultInfos.tbBillList = save; + + entity.Result = 0; + if (save) entity.Result = 1; + + entity.DealWith = 1; + _manager.save(entity); + + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + entity.Result = 0; + + entity.DealWith = 0; + + entity.ResultData = ex.Message; + + _manager.save(entity); + + return ResponseResult.ResponseError(ex); + } + } + + [HttpPost("SaveList")] + public ResponseResult SaveList(List<ErpUnit> units) + { + var entity = new MessageCenter(); + entity.TableName = TableName; + entity.Url = URL + "SaveList"; + entity.Method = METHOD; + entity.Data = JsonConvert.SerializeObject(units); + entity.Status = 1; + entity.CreateBy = "PL017"; + try + { + dynamic resultInfos = new ExpandoObject(); + var save = m.SaveList(units); + resultInfos.tbBillList = save; + + entity.Result = 0; + if (save) entity.Result = 1; + + entity.DealWith = 1; + _manager.save(entity); + + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + entity.Result = 0; + + entity.DealWith = 0; + + entity.ResultData = ex.Message; + + _manager.save(entity); + + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 鑾峰彇鎵�鏈� + /// </summary> + /// <returns></returns> + [HttpPost("GetList")] + public ResponseResult GetList() + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.GetList(); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + + /// <summary> + /// 鏍规嵁涓婚敭鑾峰彇 + /// </summary> + /// <returns></returns> + [HttpPost("GetById")] + public ResponseResult GetById(int id) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.GetById(id); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 鏍规嵁涓婚敭鍒犻櫎 + /// </summary> + /// <returns></returns> + [HttpPost("DeleteByIds")] + public ResponseResult DeleteByIds([FromBody] object[] ids) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.DeleteByIds(ids); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 娣诲姞 + /// </summary> + /// <returns></returns> + [HttpPost("Insert")] + public ResponseResult Add([FromBody] MesUnit data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.Insert(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 娣诲姞杩斿洖鑷 + /// </summary> + /// <returns></returns> + [HttpPost("InsertReturnIdentity")] + public ResponseResult InsertReturnIdentity([FromBody] MesUnit data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.InsertReturnIdentity(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 淇敼 + /// </summary> + /// <returns></returns> + [HttpPost("Update")] + public ResponseResult Update([FromBody] MesUnit data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.Update(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } +} \ No newline at end of file diff --git a/MESApplication/Controllers/BasicData/OrganizeController.cs b/MESApplication/Controllers/BasicData/OrganizeController.cs new file mode 100644 index 0000000..fd37705 --- /dev/null +++ b/MESApplication/Controllers/BasicData/OrganizeController.cs @@ -0,0 +1,266 @@ +锘縰sing Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Dynamic; +using MES.Service.Modes; +using MES.Service.service; +using MES.Service.util; +using MES.Service.Dto.webApi; +using MES.Service.service.BasicData; +using Newtonsoft.Json; + +namespace MESApplication.Controllers; + +[ApiController] +[Route("api/[controller]")] +public class OrganizeController : ControllerBase +{ + private readonly MessageCenterManager _manager = new(); + + private readonly OrganizeManager m = new(); + + private readonly string METHOD = "POST"; + + private readonly string TableName = "Organize"; + + private readonly string URL = "http://localhost:10054/api/Organize/"; + + [HttpPost("Save")] + public ResponseResult Save(ErpOrganize unit) + { + var entity = new MessageCenter(); + entity.TableName = TableName; + entity.Url = URL + "Save"; + entity.Method = METHOD; + entity.Data = JsonConvert.SerializeObject(unit); + entity.Status = 1; + entity.CreateBy = "PL017"; + try + { + dynamic resultInfos = new ExpandoObject(); + var save = m.Save(unit); + resultInfos.tbBillList = save; + + entity.Result = 0; + if (save) entity.Result = 1; + + entity.DealWith = 1; + _manager.save(entity); + + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + entity.Result = 0; + + entity.DealWith = 0; + + entity.ResultData = ex.Message; + + _manager.save(entity); + + return ResponseResult.ResponseError(ex); + } + } + + [HttpPost("SaveList")] + public ResponseResult SaveList(List<ErpOrganize> units) + { + var entity = new MessageCenter(); + entity.TableName = TableName; + entity.Url = URL + "SaveList"; + entity.Method = METHOD; + entity.Data = JsonConvert.SerializeObject(units); + entity.Status = 1; + entity.CreateBy = "PL017"; + try + { + dynamic resultInfos = new ExpandoObject(); + var save = m.SaveList(units); + resultInfos.tbBillList = save; + + entity.Result = 0; + if (save) entity.Result = 1; + + entity.DealWith = 1; + _manager.save(entity); + + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + entity.Result = 0; + + entity.DealWith = 0; + + entity.ResultData = ex.Message; + + _manager.save(entity); + + return ResponseResult.ResponseError(ex); + } + } + // private OrganizeManager m = new OrganizeManager(); + + + /***杩涘叆妯$増绠$悊鍙互淇敼妯$増***/ + + /// <summary> + /// 鑾峰彇鎵�鏈� + /// </summary> + /// <returns></returns> + [HttpPost("GetList")] + public ResponseResult GetList() + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.GetList(); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + + /// <summary> + /// 鏍规嵁涓婚敭鑾峰彇 + /// </summary> + /// <returns></returns> + [HttpPost("GetById")] + public ResponseResult GetById(int id) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.GetById(id); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 鏍规嵁涓婚敭鍒犻櫎 + /// </summary> + /// <returns></returns> + [HttpPost("DeleteByIds")] + public ResponseResult DeleteByIds([FromBody] object[] ids) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.DeleteByIds(ids); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 娣诲姞 + /// </summary> + /// <returns></returns> + [HttpPost("Insert")] + public ResponseResult Add([FromBody] Organize data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.Insert(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 娣诲姞杩斿洖鑷 + /// </summary> + /// <returns></returns> + [HttpPost("InsertReturnIdentity")] + public ResponseResult InsertReturnIdentity([FromBody] Organize data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.InsertReturnIdentity(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 淇敼 + /// </summary> + /// <returns></returns> + [HttpPost("Update")] + public ResponseResult Update([FromBody] Organize data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.Update(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } +} \ No newline at end of file diff --git a/MESApplication/Controllers/BasicData/SalesOrderController.cs b/MESApplication/Controllers/BasicData/SalesOrderController.cs new file mode 100644 index 0000000..74cc41f --- /dev/null +++ b/MESApplication/Controllers/BasicData/SalesOrderController.cs @@ -0,0 +1,162 @@ +锘縰sing System.Dynamic; +using MES.Service.Modes; +using MES.Service.service.BasicData; +using MES.Service.util; +using Microsoft.AspNetCore.Mvc; + +namespace MESApplication.Controllers.BasicData; + +[ApiController] +[Route("api/[controller]")] +public class SalesOrderController : ControllerBase +{ + private readonly SalesOrderManager m = new(); + + + /***杩涘叆妯$増绠$悊鍙互淇敼妯$増***/ + + /// <summary> + /// 鑾峰彇鎵�鏈� + /// </summary> + /// <returns></returns> + [HttpPost("GetList")] + public ResponseResult GetList() + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.GetList(); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + + /// <summary> + /// 鏍规嵁涓婚敭鑾峰彇 + /// </summary> + /// <returns></returns> + [HttpPost("GetById")] + public ResponseResult GetById(int id) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.GetById(id); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 鏍规嵁涓婚敭鍒犻櫎 + /// </summary> + /// <returns></returns> + [HttpPost("DeleteByIds")] + public ResponseResult DeleteByIds([FromBody] object[] ids) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.DeleteByIds(ids); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 娣诲姞 + /// </summary> + /// <returns></returns> + [HttpPost("Insert")] + public ResponseResult Add([FromBody] SalesOrder data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.Insert(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 娣诲姞杩斿洖鑷 + /// </summary> + /// <returns></returns> + [HttpPost("InsertReturnIdentity")] + public ResponseResult InsertReturnIdentity([FromBody] SalesOrder data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.InsertReturnIdentity(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 淇敼 + /// </summary> + /// <returns></returns> + [HttpPost("Update")] + public ResponseResult Update([FromBody] SalesOrder data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.Update(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } +} \ No newline at end of file diff --git a/MESApplication/Controllers/BasicData/SalesOrderDetailController.cs b/MESApplication/Controllers/BasicData/SalesOrderDetailController.cs new file mode 100644 index 0000000..1a5a9b0 --- /dev/null +++ b/MESApplication/Controllers/BasicData/SalesOrderDetailController.cs @@ -0,0 +1,162 @@ +锘縰sing System.Dynamic; +using MES.Service.Modes; +using MES.Service.service.BasicData; +using MES.Service.util; +using Microsoft.AspNetCore.Mvc; + +namespace MESApplication.Controllers.BasicData; + +[ApiController] +[Route("api/[controller]")] +public class SalesOrderDetailController : ControllerBase +{ + private readonly SalesOrderDetailManager m = new(); + + + /***杩涘叆妯$増绠$悊鍙互淇敼妯$増***/ + + /// <summary> + /// 鑾峰彇鎵�鏈� + /// </summary> + /// <returns></returns> + [HttpPost("GetList")] + public ResponseResult GetList() + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.GetList(); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + + /// <summary> + /// 鏍规嵁涓婚敭鑾峰彇 + /// </summary> + /// <returns></returns> + [HttpPost("GetById")] + public ResponseResult GetById(int id) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.GetById(id); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 鏍规嵁涓婚敭鍒犻櫎 + /// </summary> + /// <returns></returns> + [HttpPost("DeleteByIds")] + public ResponseResult DeleteByIds([FromBody] object[] ids) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.DeleteByIds(ids); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 娣诲姞 + /// </summary> + /// <returns></returns> + [HttpPost("Insert")] + public ResponseResult Add([FromBody] SalesOrderDetail data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.Insert(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 娣诲姞杩斿洖鑷 + /// </summary> + /// <returns></returns> + [HttpPost("InsertReturnIdentity")] + public ResponseResult InsertReturnIdentity([FromBody] SalesOrderDetail data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.InsertReturnIdentity(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 淇敼 + /// </summary> + /// <returns></returns> + [HttpPost("Update")] + public ResponseResult Update([FromBody] SalesOrderDetail data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.Update(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } +} \ No newline at end of file diff --git a/MESApplication/Controllers/BasicData/SalesReturnNoticeController.cs b/MESApplication/Controllers/BasicData/SalesReturnNoticeController.cs new file mode 100644 index 0000000..8df7421 --- /dev/null +++ b/MESApplication/Controllers/BasicData/SalesReturnNoticeController.cs @@ -0,0 +1,163 @@ +锘縰sing System.Dynamic; +using MES.Service.Modes; +using MES.Service.service.BasicData; +using MES.Service.util; +using Microsoft.AspNetCore.Mvc; + +namespace MESApplication.Controllers.BasicData; + +[ApiController] +[Route("api/[controller]")] +public class SalesReturnNoticeController : ControllerBase +{ + private readonly SalesReturnNoticeManager m = new(); + + + /***杩涘叆妯$増绠$悊鍙互淇敼妯$増***/ + + /// <summary> + /// 鑾峰彇鎵�鏈� + /// </summary> + /// <returns></returns> + [HttpPost("GetList")] + public ResponseResult GetList() + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.GetList(); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + + /// <summary> + /// 鏍规嵁涓婚敭鑾峰彇 + /// </summary> + /// <returns></returns> + [HttpPost("GetById")] + public ResponseResult GetById(int id) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.GetById(id); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 鏍规嵁涓婚敭鍒犻櫎 + /// </summary> + /// <returns></returns> + [HttpPost("DeleteByIds")] + public ResponseResult DeleteByIds([FromBody] object[] ids) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.DeleteByIds(ids); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 娣诲姞 + /// </summary> + /// <returns></returns> + [HttpPost("Insert")] + public ResponseResult Add([FromBody] SalesReturnNotice data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.Insert(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 娣诲姞杩斿洖鑷 + /// </summary> + /// <returns></returns> + [HttpPost("InsertReturnIdentity")] + public ResponseResult InsertReturnIdentity( + [FromBody] SalesReturnNotice data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.InsertReturnIdentity(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 淇敼 + /// </summary> + /// <returns></returns> + [HttpPost("Update")] + public ResponseResult Update([FromBody] SalesReturnNotice data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.Update(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } +} \ No newline at end of file diff --git a/MESApplication/Controllers/BasicData/SalesReturnNoticeDetailController.cs b/MESApplication/Controllers/BasicData/SalesReturnNoticeDetailController.cs new file mode 100644 index 0000000..3ed35a0 --- /dev/null +++ b/MESApplication/Controllers/BasicData/SalesReturnNoticeDetailController.cs @@ -0,0 +1,163 @@ +锘縰sing System.Dynamic; +using MES.Service.Modes; +using MES.Service.service.BasicData; +using MES.Service.util; +using Microsoft.AspNetCore.Mvc; + +namespace MESApplication.Controllers.BasicData; + +[ApiController] +[Route("api/[controller]")] +public class SalesReturnNoticeDetailController : ControllerBase +{ + private readonly SalesReturnNoticeDetailManager m = new(); + + + /***杩涘叆妯$増绠$悊鍙互淇敼妯$増***/ + + /// <summary> + /// 鑾峰彇鎵�鏈� + /// </summary> + /// <returns></returns> + [HttpPost("GetList")] + public ResponseResult GetList() + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.GetList(); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + + /// <summary> + /// 鏍规嵁涓婚敭鑾峰彇 + /// </summary> + /// <returns></returns> + [HttpPost("GetById")] + public ResponseResult GetById(int id) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.GetById(id); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 鏍规嵁涓婚敭鍒犻櫎 + /// </summary> + /// <returns></returns> + [HttpPost("DeleteByIds")] + public ResponseResult DeleteByIds([FromBody] object[] ids) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.DeleteByIds(ids); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 娣诲姞 + /// </summary> + /// <returns></returns> + [HttpPost("Insert")] + public ResponseResult Add([FromBody] SalesReturnNoticeDetail data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.Insert(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 娣诲姞杩斿洖鑷 + /// </summary> + /// <returns></returns> + [HttpPost("InsertReturnIdentity")] + public ResponseResult InsertReturnIdentity( + [FromBody] SalesReturnNoticeDetail data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.InsertReturnIdentity(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 淇敼 + /// </summary> + /// <returns></returns> + [HttpPost("Update")] + public ResponseResult Update([FromBody] SalesReturnNoticeDetail data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.Update(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } +} \ No newline at end of file diff --git a/MESApplication/Controllers/BasicData/ShipmentDetailController.cs b/MESApplication/Controllers/BasicData/ShipmentDetailController.cs new file mode 100644 index 0000000..a2a764f --- /dev/null +++ b/MESApplication/Controllers/BasicData/ShipmentDetailController.cs @@ -0,0 +1,162 @@ +锘縰sing System.Dynamic; +using MES.Service.Modes; +using MES.Service.service.BasicData; +using MES.Service.util; +using Microsoft.AspNetCore.Mvc; + +namespace MESApplication.Controllers.BasicData; + +[ApiController] +[Route("api/[controller]")] +public class ShipmentDetailController : ControllerBase +{ + private readonly ShipmentDetailManager m = new(); + + + /***杩涘叆妯$増绠$悊鍙互淇敼妯$増***/ + + /// <summary> + /// 鑾峰彇鎵�鏈� + /// </summary> + /// <returns></returns> + [HttpPost("GetList")] + public ResponseResult GetList() + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.GetList(); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + + /// <summary> + /// 鏍规嵁涓婚敭鑾峰彇 + /// </summary> + /// <returns></returns> + [HttpPost("GetById")] + public ResponseResult GetById(int id) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.GetById(id); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 鏍规嵁涓婚敭鍒犻櫎 + /// </summary> + /// <returns></returns> + [HttpPost("DeleteByIds")] + public ResponseResult DeleteByIds([FromBody] object[] ids) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.DeleteByIds(ids); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 娣诲姞 + /// </summary> + /// <returns></returns> + [HttpPost("Insert")] + public ResponseResult Add([FromBody] ShipmentDetail data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.Insert(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 娣诲姞杩斿洖鑷 + /// </summary> + /// <returns></returns> + [HttpPost("InsertReturnIdentity")] + public ResponseResult InsertReturnIdentity([FromBody] ShipmentDetail data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.InsertReturnIdentity(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 淇敼 + /// </summary> + /// <returns></returns> + [HttpPost("Update")] + public ResponseResult Update([FromBody] ShipmentDetail data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.Update(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } +} \ No newline at end of file diff --git a/MESApplication/Controllers/BasicData/ShipmentNoticeController.cs b/MESApplication/Controllers/BasicData/ShipmentNoticeController.cs new file mode 100644 index 0000000..67f6e27 --- /dev/null +++ b/MESApplication/Controllers/BasicData/ShipmentNoticeController.cs @@ -0,0 +1,162 @@ +锘縰sing System.Dynamic; +using MES.Service.Modes; +using MES.Service.service.BasicData; +using MES.Service.util; +using Microsoft.AspNetCore.Mvc; + +namespace MESApplication.Controllers.BasicData; + +[ApiController] +[Route("api/[controller]")] +public class ShipmentNoticeController : ControllerBase +{ + private readonly ShipmentNoticeManager m = new(); + + + /***杩涘叆妯$増绠$悊鍙互淇敼妯$増***/ + + /// <summary> + /// 鑾峰彇鎵�鏈� + /// </summary> + /// <returns></returns> + [HttpPost("GetList")] + public ResponseResult GetList() + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.GetList(); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + + /// <summary> + /// 鏍规嵁涓婚敭鑾峰彇 + /// </summary> + /// <returns></returns> + [HttpPost("GetById")] + public ResponseResult GetById(int id) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.GetById(id); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 鏍规嵁涓婚敭鍒犻櫎 + /// </summary> + /// <returns></returns> + [HttpPost("DeleteByIds")] + public ResponseResult DeleteByIds([FromBody] object[] ids) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.DeleteByIds(ids); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 娣诲姞 + /// </summary> + /// <returns></returns> + [HttpPost("Insert")] + public ResponseResult Add([FromBody] ShipmentNotice data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.Insert(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 娣诲姞杩斿洖鑷 + /// </summary> + /// <returns></returns> + [HttpPost("InsertReturnIdentity")] + public ResponseResult InsertReturnIdentity([FromBody] ShipmentNotice data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.InsertReturnIdentity(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 淇敼 + /// </summary> + /// <returns></returns> + [HttpPost("Update")] + public ResponseResult Update([FromBody] ShipmentNotice data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.Update(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } +} \ No newline at end of file diff --git a/MESApplication/Controllers/BasicData/SysDepartmentController.cs b/MESApplication/Controllers/BasicData/SysDepartmentController.cs new file mode 100644 index 0000000..7fff07b --- /dev/null +++ b/MESApplication/Controllers/BasicData/SysDepartmentController.cs @@ -0,0 +1,255 @@ +锘縰sing System.Dynamic; +using MES.Service.Dto.webApi; +using MES.Service.Modes; +using MES.Service.service; +using MES.Service.service.BasicData; +using MES.Service.util; +using Microsoft.AspNetCore.Mvc; +using Newtonsoft.Json; + +namespace MESApplication.Controllers.BasicData; + +[ApiController] +[Route("api/[controller]")] +public class SysDepartmentController : ControllerBase +{ + private readonly MessageCenterManager _manager = new(); + + private readonly SysDepartmentManager m = new(); + + private readonly string METHOD = "POST"; + private readonly string TableName = "SYS_DEPARTMENT"; + + private readonly string URL = "http://localhost:10054/api/SysDepartment/"; + + [HttpPost("Save")] + public ResponseResult Save(ErpDepartment unit) + { + var entity = new MessageCenter(); + entity.TableName = TableName; + entity.Url = URL + "Save"; + entity.Method = METHOD; + entity.Data = JsonConvert.SerializeObject(unit); + entity.Status = 1; + entity.CreateBy = "PL017"; + try + { + dynamic resultInfos = new ExpandoObject(); + var save = m.Save(unit); + resultInfos.tbBillList = save; + + entity.Result = 0; + if (save) entity.Result = 1; + + entity.DealWith = 1; + _manager.save(entity); + + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + entity.Result = 0; + + entity.DealWith = 0; + + entity.ResultData = ex.Message; + + _manager.save(entity); + + return ResponseResult.ResponseError(ex); + } + } + + [HttpPost("SaveList")] + public ResponseResult SaveList(List<ErpDepartment> units) + { + var entity = new MessageCenter(); + entity.TableName = TableName; + entity.Url = URL + "SaveList"; + entity.Method = METHOD; + entity.Data = JsonConvert.SerializeObject(units); + entity.Status = 1; + entity.CreateBy = "PL017"; + try + { + dynamic resultInfos = new ExpandoObject(); + var save = m.SaveList(units); + resultInfos.tbBillList = save; + + entity.Result = 0; + if (save) entity.Result = 1; + + entity.DealWith = 1; + _manager.save(entity); + + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + entity.Result = 0; + + entity.DealWith = 0; + + entity.ResultData = ex.Message; + + _manager.save(entity); + + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 鑾峰彇鎵�鏈� + /// </summary> + /// <returns></returns> + [HttpPost("GetList")] + public ResponseResult GetList() + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.GetList(); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + + /// <summary> + /// 鏍规嵁涓婚敭鑾峰彇 + /// </summary> + /// <returns></returns> + [HttpPost("GetById")] + public ResponseResult GetById(int id) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.GetById(id); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 鏍规嵁涓婚敭鍒犻櫎 + /// </summary> + /// <returns></returns> + [HttpPost("DeleteByIds")] + public ResponseResult DeleteByIds([FromBody] object[] ids) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.DeleteByIds(ids); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 娣诲姞 + /// </summary> + /// <returns></returns> + [HttpPost("Insert")] + public ResponseResult Add([FromBody] SysDepartment data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.Insert(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 娣诲姞杩斿洖鑷 + /// </summary> + /// <returns></returns> + [HttpPost("InsertReturnIdentity")] + public ResponseResult InsertReturnIdentity([FromBody] SysDepartment data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.InsertReturnIdentity(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 淇敼 + /// </summary> + /// <returns></returns> + [HttpPost("Update")] + public ResponseResult Update([FromBody] SysDepartment data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.Update(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } +} \ No newline at end of file diff --git a/MESApplication/MESApplication.csproj b/MESApplication/MESApplication.csproj index 7509085..ba5faaa 100644 --- a/MESApplication/MESApplication.csproj +++ b/MESApplication/MESApplication.csproj @@ -1,10 +1,9 @@ -<Project Sdk="Microsoft.NET.Sdk.Web"> +锘�<Project Sdk="Microsoft.NET.Sdk.Web"> <PropertyGroup> <TargetFramework>net8.0</TargetFramework> <Nullable>enable</Nullable> <ImplicitUsings>enable</ImplicitUsings> - <InvariantGlobalization>true</InvariantGlobalization> <GenerateDocumentationFile>True</GenerateDocumentationFile> </PropertyGroup> @@ -18,16 +17,11 @@ <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> </PackageReference> - <PackageReference Include="Oracle.EntityFrameworkCore" Version="8.21.121"/> <PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0"/> </ItemGroup> <ItemGroup> <ProjectReference Include="..\MES.Service\MES.Service.csproj"/> - </ItemGroup> - - <ItemGroup> - <Folder Include="Controllers\BasicData\" /> </ItemGroup> </Project> diff --git a/MESApplication/appsettings.json b/MESApplication/appsettings.json index f56e17a..60ded5e 100644 --- a/MESApplication/appsettings.json +++ b/MESApplication/appsettings.json @@ -10,6 +10,6 @@ "AppSettings": { "TestErpUrl": "http://192.168.0.208:8066/WebService1.asmx/MesToErpinfoTest", "ProductionErpUrl": "http://192.168.0.208:8066/WebService1.asmx/MesToErpinfoTest", - "DataBaseConn": "Data Source=192.168.1.146;Initial Catalog=GS_MES;User ID=sa;Password =qixi123" + "DataBaseConn": "Data Source=192.168.1.146;Initial Catalog=GS_MES;User ID=sa;Password =qixi123;Encrypt=True;TrustServerCertificate=True;" } } -- Gitblit v1.9.3