4400 changed files with 449036 additions and 785 deletions
@ -0,0 +1,7 @@ |
|||||
|
{ |
||||
|
"ExpandedNodes": [ |
||||
|
"" |
||||
|
], |
||||
|
"SelectedNode": "\\SCP.sln", |
||||
|
"PreviewInSolutionExplorer": false |
||||
|
} |
Binary file not shown.
Binary file not shown.
@ -1,11 +1,11 @@ |
|||||
<?xml version="1.0" encoding="utf-8"?> |
<?xml version="1.0" encoding="utf-8"?> |
||||
<configuration> |
<configuration> |
||||
<runtime> |
<runtime> |
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> |
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> |
||||
<dependentAssembly> |
<dependentAssembly> |
||||
<assemblyIdentity name="EPPlus" publicKeyToken="ea159fdaa78159a1" culture="neutral"/> |
<assemblyIdentity name="EPPlus" publicKeyToken="ea159fdaa78159a1" culture="neutral" /> |
||||
<bindingRedirect oldVersion="0.0.0.0-4.5.2.1" newVersion="4.5.2.1"/> |
<bindingRedirect oldVersion="0.0.0.0-4.5.2.1" newVersion="4.5.2.1" /> |
||||
</dependentAssembly> |
</dependentAssembly> |
||||
</assemblyBinding> |
</assemblyBinding> |
||||
</runtime> |
</runtime> |
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/></startup></configuration> |
</configuration> |
@ -0,0 +1,155 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Data.Entity.Infrastructure; |
||||
|
using System.Data.Entity.Migrations; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using CK.SCP.Models; |
||||
|
using CK.SCP.Models.ScpEntity; |
||||
|
using CK.SCP.Utils; |
||||
|
using System.Data.Entity.Core; |
||||
|
using CK.SCP.Models.Enums; |
||||
|
using CK.SCP.Models.AppBoxEntity; |
||||
|
|
||||
|
namespace CK.SCP.Controller |
||||
|
{ |
||||
|
public class SCP_LOGINNUMBER_CONTROLLER |
||||
|
{ |
||||
|
public static TA_LOGINNUMBER GetlistUserNumber(string username) |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
return db.TA_LOGINNUMBER.Where(p => p.Name == username).FirstOrDefault(); |
||||
|
} |
||||
|
} |
||||
|
public static ResultObject<bool> Save_TA_LOGINNUMBER(string username, LoginNumer p_state,string date) |
||||
|
{ |
||||
|
ResultObject<bool> _ret = new ResultObject<bool>(); |
||||
|
try |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
using (AppBoxContext _appdb = EntitiesFactory.CreateAppBoxInstance()) |
||||
|
{ |
||||
|
var user = _appdb.Users.FirstOrDefault(t => t.Name == username); |
||||
|
|
||||
|
if (user == null) |
||||
|
{ |
||||
|
_ret.MessageList.Add("用户名"+ username+"不存在,请输入正确用户名"); |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
var login = db.TA_LOGINNUMBER.FirstOrDefault(p => p.Name == username); |
||||
|
if (p_state == LoginNumer.Sussess && login != null) |
||||
|
{ |
||||
|
db.TA_LOGINNUMBER.Remove(login); |
||||
|
} |
||||
|
|
||||
|
if (login != null && p_state == LoginNumer.Faile) |
||||
|
{ |
||||
|
if (login.Number == 4&&login.Time==date) |
||||
|
{ |
||||
|
login.Number = 5; |
||||
|
db.TA_LOGINNUMBER.AddOrUpdate(login); |
||||
|
|
||||
|
user.Enabled = false; |
||||
|
_appdb.Users.AddOrUpdate(user); |
||||
|
_appdb.SaveChanges(); |
||||
|
|
||||
|
_ret.MessageList.Add("因您连续五次输入密码错误,该账号已经被设为未启用状态,请联系系统管理员"); |
||||
|
} |
||||
|
else if(login.Number <4 && login.Time == date) |
||||
|
{ |
||||
|
login.Number = login.Number + 1; |
||||
|
db.TA_LOGINNUMBER.AddOrUpdate(login); |
||||
|
}else if(login.Time != date) |
||||
|
{ |
||||
|
login.Time = date; |
||||
|
login.Number = 1; |
||||
|
db.TA_LOGINNUMBER.AddOrUpdate(login); |
||||
|
} |
||||
|
} |
||||
|
else if (login == null && p_state == LoginNumer.Faile) |
||||
|
{ |
||||
|
TA_LOGINNUMBER log = new TA_LOGINNUMBER(); |
||||
|
log.Name = username; |
||||
|
log.Number = 1; |
||||
|
log.Time = DateTime.Now.ToShortDateString(); |
||||
|
db.TA_LOGINNUMBER.AddOrUpdate(log); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
if (db.SaveChanges() != -1) |
||||
|
{ |
||||
|
_ret.State = ReturnStatus.Succeed; |
||||
|
_ret.Result = true; |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
_ret.State = ReturnStatus.Failed; |
||||
|
_ret.Result = false; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//捕获实体验证异常
|
||||
|
{ |
||||
|
var sb = new StringBuilder(); |
||||
|
|
||||
|
foreach (var error in dbEx.EntityValidationErrors.ToList()) |
||||
|
{ |
||||
|
|
||||
|
error.ValidationErrors.ToList().ForEach(i => |
||||
|
{ |
||||
|
sb.AppendFormat("表:{0},字段:{1},信息:{2}\r\n", error.Entry.Entity.GetType().Name, i.PropertyName, i.ErrorMessage); |
||||
|
}); |
||||
|
} |
||||
|
_ret.State = ReturnStatus.Failed; |
||||
|
_ret.Result = false; |
||||
|
_ret.ErrorList.Add(dbEx); |
||||
|
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_LOGINNUMBER_CONTROLLER), "Save_TA_LOGINNUMBER", sb.ToString()); |
||||
|
throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "字段验证失败" + sb.ToString()); |
||||
|
} |
||||
|
catch (OptimisticConcurrencyException ex)//并发冲突异常
|
||||
|
{ |
||||
|
|
||||
|
_ret.State = ReturnStatus.Failed; |
||||
|
_ret.Result = false; |
||||
|
_ret.ErrorList.Add(ex); |
||||
|
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_LOGINNUMBER_CONTROLLER), "Save_TA_LOGINNUMBER", ex.ToString()); |
||||
|
throw new ScpException(ResultCode.Exception, "9999", ex.ToString()); |
||||
|
} |
||||
|
catch (ScpException ex) |
||||
|
{ |
||||
|
|
||||
|
|
||||
|
_ret.State = ReturnStatus.Failed; |
||||
|
_ret.Result = false; |
||||
|
_ret.ErrorList.Add(ex); |
||||
|
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_LOGINNUMBER_CONTROLLER), "Save_TA_LOGINNUMBER", ex.ToString()); |
||||
|
|
||||
|
if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException)) |
||||
|
{ |
||||
|
var inner = (UpdateException)ex.InnerException; |
||||
|
|
||||
|
|
||||
|
throw new ScpException(ResultCode.Exception, "0000", ex.ToString()); |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
if (ex.InnerException != null) throw ex.InnerException; |
||||
|
} |
||||
|
} |
||||
|
catch (Exception e) |
||||
|
{ |
||||
|
_ret.State = ReturnStatus.Failed; |
||||
|
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_LOGINNUMBER_CONTROLLER), "Save_TA_LOGINNUMBER", e.Message); |
||||
|
_ret.Result = false; |
||||
|
_ret.ErrorList.Add(e); |
||||
|
throw e; |
||||
|
} |
||||
|
return _ret; |
||||
|
} |
||||
|
} |
||||
|
} |
@ -1,28 +1,28 @@ |
|||||
<?xml version="1.0" encoding="utf-8"?> |
<?xml version="1.0" encoding="utf-8"?> |
||||
<configuration> |
<configuration> |
||||
<configSections> |
<configSections> |
||||
|
|
||||
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/> |
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> |
||||
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --></configSections> |
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --></configSections> |
||||
<entityFramework> |
<entityFramework> |
||||
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework"> |
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework"> |
||||
<parameters> |
<parameters> |
||||
<parameter value="mssqllocaldb"/> |
<parameter value="mssqllocaldb" /> |
||||
</parameters> |
</parameters> |
||||
</defaultConnectionFactory> |
</defaultConnectionFactory> |
||||
<providers> |
<providers> |
||||
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/> |
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /> |
||||
</providers> |
</providers> |
||||
</entityFramework> |
</entityFramework> |
||||
<connectionStrings> |
<connectionStrings> |
||||
<add name="ScpEntities" connectionString="data source=127.0.0.1;initial catalog=ChangKeTecSCP;persist security info=True;user id=sa;password=Microsoft2008;MultipleActiveResultSets=True;App=EntityFramework" providerName="System.Data.SqlClient"/> |
<add name="ScpEntities" connectionString="data source=127.0.0.1;initial catalog=ChangKeTecSCP;persist security info=True;user id=sa;password=Microsoft2008;MultipleActiveResultSets=True;App=EntityFramework" providerName="System.Data.SqlClient" /> |
||||
</connectionStrings> |
</connectionStrings> |
||||
<runtime> |
<runtime> |
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> |
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> |
||||
<dependentAssembly> |
<dependentAssembly> |
||||
<assemblyIdentity name="EPPlus" publicKeyToken="ea159fdaa78159a1" culture="neutral"/> |
<assemblyIdentity name="EPPlus" publicKeyToken="ea159fdaa78159a1" culture="neutral" /> |
||||
<bindingRedirect oldVersion="0.0.0.0-4.5.2.1" newVersion="4.5.2.1"/> |
<bindingRedirect oldVersion="0.0.0.0-4.5.2.1" newVersion="4.5.2.1" /> |
||||
</dependentAssembly> |
</dependentAssembly> |
||||
</assemblyBinding> |
</assemblyBinding> |
||||
</runtime> |
</runtime> |
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/></startup></configuration> |
</configuration> |
@ -0,0 +1,23 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using System.ComponentModel.DataAnnotations.Schema; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace CK.SCP.Models.ScpEntity |
||||
|
{ |
||||
|
public partial class TA_LOGINNUMBER |
||||
|
{ |
||||
|
|
||||
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)] |
||||
|
public long UID { get; set; } |
||||
|
[Key] |
||||
|
public string Name { get; set; } |
||||
|
|
||||
|
public string Time { get; set; } |
||||
|
public int Number { get; set; } |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,62 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using System.ComponentModel.DataAnnotations.Schema; |
||||
|
using ChangKeTec.Wms.Models; |
||||
|
|
||||
|
|
||||
|
namespace CK.SCP.Models.ScpEntity |
||||
|
{ |
||||
|
public partial class V_TB_PRICE_TemporaryPrice |
||||
|
{ |
||||
|
[Key] |
||||
|
public int UID { get; set; } |
||||
|
public string VendId { get; set; } |
||||
|
public string Site { get; set; } |
||||
|
public string SubSite { get; set; } |
||||
|
public string PartCode { get; set; } |
||||
|
public Nullable<System.DateTime> StartTime { get; set; } |
||||
|
public Nullable<System.DateTime> EndTime { get; set; } |
||||
|
public string Curr { get; set; } |
||||
|
public string Unit { get; set; } |
||||
|
[DecimalPrecision(18, 5)] |
||||
|
public decimal Amt { get; set; } |
||||
|
public string Remarks { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 状态(已用)
|
||||
|
/// </summary>
|
||||
|
public string Extend1 { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 是否是临时价格(0:否 1:是)
|
||||
|
/// </summary>
|
||||
|
public string Extend2 { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 供应商名称
|
||||
|
/// </summary>
|
||||
|
public string Extend3 { get; set; } |
||||
|
[DecimalPrecision(18, 5)] |
||||
|
public decimal SharingPrice { get; set; } |
||||
|
public int TemporaryPrice { get; set; } |
||||
|
public string PartName { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 状态
|
||||
|
/// </summary>
|
||||
|
public int State { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 是否传接口 1是
|
||||
|
/// </summary>
|
||||
|
public int IsPost { get; set; } |
||||
|
public string Creator { get; set; } |
||||
|
[NotMapped] |
||||
|
public List<string> UserInAddress { set; get; } |
||||
|
|
||||
|
[NotMapped] |
||||
|
public List<string> UserInVendIds { set; get; } |
||||
|
[NotMapped] |
||||
|
public List<string> UserInSubSite { set; get; } |
||||
|
public string Flag { get; set; } |
||||
|
} |
||||
|
} |
@ -1 +1,9 @@ |
|||||
|
//------------------------------------------------------------------------------
|
||||
|
// <auto-generated>
|
||||
|
// 此代码已从模板生成。
|
||||
|
//
|
||||
|
// 手动更改此文件可能导致应用程序出现意外的行为。
|
||||
|
// 如果重新生成代码,将覆盖对此文件的手动更改。
|
||||
|
// </auto-generated>
|
||||
|
//------------------------------------------------------------------------------
|
||||
|
|
||||
|
@ -0,0 +1,43 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using CK.SCP.Models; |
||||
|
using CK.SCP.Models.ScpEntity; |
||||
|
|
||||
|
namespace CK.SCP.Controller |
||||
|
{ |
||||
|
public class ASNController |
||||
|
{ |
||||
|
public static TF_ASN GetDetaillistByuid(int uid) |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
return db.TF_ASN.SingleOrDefault(p => p.UID == uid); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public static TF_ASN GetASNlist(string billnum, string vendid) |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
return db.TF_ASN.SingleOrDefault(p => p.PoBillNum == billnum && p.VendId == vendid); |
||||
|
} |
||||
|
} |
||||
|
public static TF_ASN_DETAIL GetASNlistDetail(string billnum) |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
return db.TF_ASN_DETAIL.SingleOrDefault(p => p.PoBillNum == billnum); |
||||
|
} |
||||
|
} |
||||
|
public static TF_ASN_DETAIL GetASNlistDetailByLine(string billnum, int linenum) |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
return db.TF_ASN_DETAIL.SingleOrDefault(p => p.BillNum == billnum && p.PoLineNum == linenum); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,114 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Data.Entity; |
||||
|
using System.Data.Entity.Core.Common.CommandTrees; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
using System.Data.Entity.Migrations; |
||||
|
using System.Linq.Expressions; |
||||
|
using CK.SCP.Models; |
||||
|
|
||||
|
|
||||
|
namespace CK.SCP.Controller |
||||
|
{ |
||||
|
public static class EntitiesHelper |
||||
|
{ |
||||
|
|
||||
|
public static List<dynamic> GetModeList_genaral<T, TKey>(Expression<Func<T, dynamic>> select, |
||||
|
Expression<Func<T, bool>> where, Expression<Func<T, TKey>> order, out int count) |
||||
|
where T : class |
||||
|
{ |
||||
|
List<dynamic> list = null; |
||||
|
count = 0; |
||||
|
using (DbContext db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
count = db.Set<T>().Where(where).Count(); |
||||
|
list = |
||||
|
db.Set<T>() |
||||
|
.Where(where) |
||||
|
.OrderBy(order) |
||||
|
.Select(select).ToList(); |
||||
|
} |
||||
|
return list; |
||||
|
} |
||||
|
|
||||
|
public static List<dynamic> GetPagedModelListAsc<T, TKey>(Expression<Func<T, dynamic>> select, |
||||
|
Expression<Func<T, bool>> where, Expression<Func<T, TKey>> order, int pageIndex, int pageSize, out int total) |
||||
|
where T : class |
||||
|
{ |
||||
|
List<dynamic> list = null; |
||||
|
total = 0; |
||||
|
using (DbContext db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
total = db.Set<T>().Where(where).Count(); |
||||
|
list = |
||||
|
db.Set<T>() |
||||
|
.Where(where) |
||||
|
.OrderBy(order) |
||||
|
.Select(select) |
||||
|
.Skip((pageIndex - 1) * pageSize) |
||||
|
.Take(pageSize).ToList(); |
||||
|
} |
||||
|
return list; |
||||
|
} |
||||
|
|
||||
|
public static List<T> GetPagedDataAsc<T, TKey>(Expression<Func<T, T>> select, |
||||
|
Expression<Func<T, bool>> where, Expression<Func<T, TKey>> order, int pageIndex, int pageSize, out int total) |
||||
|
where T : class |
||||
|
{ |
||||
|
List<T> list = null; |
||||
|
total = 0; |
||||
|
using (DbContext db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
total = db.Set<T>().Where(where.Compile()).AsQueryable().Count(); |
||||
|
list = |
||||
|
db.Set<T>() |
||||
|
.Where(where.Compile()).AsQueryable() |
||||
|
.OrderBy(order) |
||||
|
.Select(select) |
||||
|
.Skip((pageIndex - 1) * pageSize) |
||||
|
.Take(pageSize).ToList(); |
||||
|
} |
||||
|
return list; |
||||
|
} |
||||
|
|
||||
|
//TODO 分页 原来 pageIndex-1
|
||||
|
public static List<dynamic> GetPagedDataDesc<T, TKey>(DbContext db, Expression<Func<T, dynamic>> select, |
||||
|
Expression<Func<T, bool>> where, Expression<Func<T, TKey>> order, int pageIndex, int pageSize, out int total) |
||||
|
where T : class |
||||
|
{ |
||||
|
List<dynamic> list = null; |
||||
|
total = 0; |
||||
|
|
||||
|
total = db.Set<T>().Where(where).Count(); |
||||
|
list = |
||||
|
db.Set<T>() |
||||
|
.Where(where) |
||||
|
.OrderByDescending(order) |
||||
|
.Select(select) |
||||
|
.Skip((pageIndex) * pageSize) |
||||
|
.Take(pageSize).ToList(); |
||||
|
|
||||
|
|
||||
|
return list; |
||||
|
} |
||||
|
public static List<T> GetPagedList<T, TKey>(DbContext db, Expression<Func<T, TKey>> order, int pageIndex, int pageSize, out int total) |
||||
|
where T : class |
||||
|
{ |
||||
|
List<T> list = null; |
||||
|
total = 0; |
||||
|
|
||||
|
total = db.Set<T>().Count(); |
||||
|
list = |
||||
|
db.Set<T>() |
||||
|
.OrderByDescending(order) |
||||
|
.Skip((pageIndex) * pageSize) |
||||
|
.Take(pageSize).ToList(); |
||||
|
|
||||
|
|
||||
|
return list; |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,99 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> |
||||
|
<PropertyGroup> |
||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
||||
|
<ProjectGuid>{0C706E36-C79D-467C-91CA-DDF39BC43113}</ProjectGuid> |
||||
|
<OutputType>Library</OutputType> |
||||
|
<AppDesignerFolder>Properties</AppDesignerFolder> |
||||
|
<RootNamespace>CK.SCP.Controller</RootNamespace> |
||||
|
<AssemblyName>CK.SCP.Controller</AssemblyName> |
||||
|
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> |
||||
|
<FileAlignment>512</FileAlignment> |
||||
|
</PropertyGroup> |
||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
||||
|
<DebugSymbols>true</DebugSymbols> |
||||
|
<DebugType>full</DebugType> |
||||
|
<Optimize>false</Optimize> |
||||
|
<OutputPath>..\DLL\</OutputPath> |
||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants> |
||||
|
<ErrorReport>prompt</ErrorReport> |
||||
|
<WarningLevel>4</WarningLevel> |
||||
|
</PropertyGroup> |
||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
||||
|
<DebugType>pdbonly</DebugType> |
||||
|
<Optimize>true</Optimize> |
||||
|
<OutputPath>bin\Release\</OutputPath> |
||||
|
<DefineConstants>TRACE</DefineConstants> |
||||
|
<ErrorReport>prompt</ErrorReport> |
||||
|
<WarningLevel>4</WarningLevel> |
||||
|
</PropertyGroup> |
||||
|
<ItemGroup> |
||||
|
<Reference Include="EntityFramework"> |
||||
|
<HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll</HintPath> |
||||
|
</Reference> |
||||
|
<Reference Include="EntityFramework.Extensions"> |
||||
|
<HintPath>..\packages\EntityFramework.Extensions.0.0.2\lib\net40\EntityFramework.Extensions.dll</HintPath> |
||||
|
</Reference> |
||||
|
<Reference Include="EntityFramework.SqlServer"> |
||||
|
<HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll</HintPath> |
||||
|
</Reference> |
||||
|
<Reference Include="System" /> |
||||
|
<Reference Include="System.ComponentModel.DataAnnotations" /> |
||||
|
<Reference Include="System.Core" /> |
||||
|
<Reference Include="System.Xml.Linq" /> |
||||
|
<Reference Include="System.Data.DataSetExtensions" /> |
||||
|
<Reference Include="Microsoft.CSharp" /> |
||||
|
<Reference Include="System.Data" /> |
||||
|
<Reference Include="System.Net.Http" /> |
||||
|
<Reference Include="System.Xml" /> |
||||
|
</ItemGroup> |
||||
|
<ItemGroup> |
||||
|
<Compile Include="ASNController.cs" /> |
||||
|
<Compile Include="BaseDocContoller.cs" /> |
||||
|
<Compile Include="Class1.cs" /> |
||||
|
<Compile Include="InfoController.cs" /> |
||||
|
<Compile Include="InvoiceController.cs" /> |
||||
|
<Compile Include="InvoiceDetailController.cs" /> |
||||
|
<Compile Include="OadOrderController.cs" /> |
||||
|
<Compile Include="PartController.cs" /> |
||||
|
<Compile Include="PlanMonthController.cs" /> |
||||
|
<Compile Include="POController.cs" /> |
||||
|
<Compile Include="PODetailController.cs" /> |
||||
|
<Compile Include="Properties\AssemblyInfo.cs" /> |
||||
|
<Compile Include="PublicDataController.cs" /> |
||||
|
<Compile Include="ReceiveController.cs" /> |
||||
|
<Compile Include="ReceiveDetailController.cs" /> |
||||
|
<Compile Include="ResultObject.cs" /> |
||||
|
<Compile Include="ShipController.cs" /> |
||||
|
<Compile Include="ShipDetailController.cs" /> |
||||
|
<Compile Include="SupplierController.cs" /> |
||||
|
<Compile Include="SupplierPartController.cs" /> |
||||
|
<Compile Include="UniApiController.cs" /> |
||||
|
<Compile Include="UserController.cs" /> |
||||
|
<Compile Include="VEND_USERController.cs" /> |
||||
|
</ItemGroup> |
||||
|
<ItemGroup> |
||||
|
<ProjectReference Include="..\CK.SCP.Models\CK.SCP.Models.csproj"> |
||||
|
<Project>{dd7c0def-71e7-443f-b0b7-db2f5b12a506}</Project> |
||||
|
<Name>CK.SCP.Models</Name> |
||||
|
</ProjectReference> |
||||
|
<ProjectReference Include="..\Models\Models.csproj"> |
||||
|
<Project>{74DCE5F2-A501-45F2-B4F9-494AA1867226}</Project> |
||||
|
<Name>Models</Name> |
||||
|
</ProjectReference> |
||||
|
</ItemGroup> |
||||
|
<ItemGroup> |
||||
|
<None Include="app.config" /> |
||||
|
<None Include="packages.config" /> |
||||
|
</ItemGroup> |
||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> |
||||
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. |
||||
|
Other similar extension points exist, see Microsoft.Common.targets. |
||||
|
<Target Name="BeforeBuild"> |
||||
|
</Target> |
||||
|
<Target Name="AfterBuild"> |
||||
|
</Target> |
||||
|
--> |
||||
|
</Project> |
@ -0,0 +1,12 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace CK.SCP.Controller |
||||
|
{ |
||||
|
public class Class1 |
||||
|
{ |
||||
|
} |
||||
|
} |
@ -0,0 +1,59 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Data.Entity.Migrations; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using CK.SCP.Models; |
||||
|
using CK.SCP.Models.ScpEntity; |
||||
|
|
||||
|
|
||||
|
namespace CK.SCP.Controller |
||||
|
{ |
||||
|
public class InfoController |
||||
|
{ |
||||
|
public static bool SaveInfo(TA_Info model) |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
db.TA_Info.AddOrUpdate(model); |
||||
|
db.SaveChanges(); |
||||
|
} |
||||
|
return true; |
||||
|
} |
||||
|
|
||||
|
public static bool UpdateInfo(TA_Info model) |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
db.TA_Info.AddOrUpdate(p => p.ID, model); |
||||
|
db.SaveChanges(); |
||||
|
} |
||||
|
return true; |
||||
|
} |
||||
|
public static TA_Info GetlistByBillNo(int id) |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
return db.TA_Info.SingleOrDefault(p => p.ID == id); |
||||
|
} |
||||
|
} |
||||
|
public static V_Info GetInfoByBillNo(int id) |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
return db.V_Info.SingleOrDefault(p => p.ID == id); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public static void DeleteById(int id) |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
var info = db.TA_Info.SingleOrDefault(p => p.ID == id); |
||||
|
if (info != null) db.TA_Info.Remove(info); |
||||
|
db.SaveChanges(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,85 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Data.Entity.Migrations; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using CK.SCP.Models; |
||||
|
using CK.SCP.Models.ScpEntity; |
||||
|
|
||||
|
|
||||
|
namespace CK.SCP.Controller |
||||
|
{ |
||||
|
public class InvoiceController |
||||
|
{ |
||||
|
public static List<V_BillInvoice> GetDataByBillInvoice( string billnum) |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
return db.V_BillInvoice.Where(p => p.BillNum == billnum).ToList(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public static V_BillInvoice GetDataByBillInvoiceDetailModel(string billnum) |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
return db.V_BillInvoice.SingleOrDefault(p => p.BillNum == billnum); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public static bool UpdateData(int state, TB_INVOICE model) |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
model.State = state; |
||||
|
|
||||
|
db.TB_INVOICE.AddOrUpdate(p => p.UID, model); |
||||
|
EntitiesFactory.SaveDb(db); |
||||
|
} |
||||
|
return true; |
||||
|
} |
||||
|
public static bool UpdateDataRemark(string remark, TB_INVOICE model) |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
|
||||
|
model.Remark = remark; |
||||
|
|
||||
|
db.TB_INVOICE.AddOrUpdate(p => p.UID, model); |
||||
|
EntitiesFactory.SaveDb(db); |
||||
|
} |
||||
|
return true; |
||||
|
} |
||||
|
|
||||
|
public static bool UpdateDataReason(string remark, string billnum) |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
TB_INVOICE model = new TB_INVOICE |
||||
|
{ |
||||
|
Remark = remark, |
||||
|
BillNum = billnum |
||||
|
}; |
||||
|
db.TB_INVOICE.AddOrUpdate(p => p.BillNum, model); |
||||
|
} |
||||
|
return true; |
||||
|
} |
||||
|
public static TB_INVOICE GetDataByBillInvoiceBillNum(string id) |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
return db.TB_INVOICE.SingleOrDefault(p => p.BillNum == id); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public static V_BillInvoice GetBillInvoiceByBillNum(string id) |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
return db.V_BillInvoice.SingleOrDefault(p => p.BillNum == id); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,37 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using CK.SCP.Models; |
||||
|
using CK.SCP.Models.ScpEntity; |
||||
|
|
||||
|
|
||||
|
namespace CK.SCP.Controller |
||||
|
{ |
||||
|
public class InvoiceDetailController |
||||
|
{ |
||||
|
public static List<V_BillInvoiceDetail> GetDataByBillInvoiceDetail(string billnum) |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
return db.V_BillInvoiceDetail.Where(p => p.BillNum == billnum).ToList(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public static V_BillInvoiceDetail GetDataByBillInvoiceDetailModel(string billnum) |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
return db.V_BillInvoiceDetail.SingleOrDefault(p => p.BillNum == billnum); |
||||
|
} |
||||
|
} |
||||
|
public static V_BillInvoiceDetail GetDataByBillInvoiceDetailBillNum(string id) |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
return db.V_BillInvoiceDetail.SingleOrDefault(p => p.BillNum == id); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,33 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using CK.SCP.Models; |
||||
|
using CK.SCP.Models.ScpEntity; |
||||
|
|
||||
|
namespace CK.SCP.Controller |
||||
|
{ |
||||
|
public class OadOrderController |
||||
|
{ |
||||
|
// public List<QadOrder> GetList()
|
||||
|
// {
|
||||
|
// using (ScpEntities db = EntitiesFactory.CreateScpInstance())
|
||||
|
// {
|
||||
|
// // db.TB_QadOrder.Where(p=>p.BillNo==db.)
|
||||
|
// var query = db.TB_QadOrder.Join(db.TB_QadOrderDetail, a => a.BillNo, g => g.BillNo, (a, g) => new
|
||||
|
// {
|
||||
|
// a.BillNo,
|
||||
|
// a.SupplierCode,
|
||||
|
// a.StartDate,
|
||||
|
// a.Address,
|
||||
|
// a.ProductCode,
|
||||
|
// a.Qty,
|
||||
|
// }).ToList();
|
||||
|
//// return query;
|
||||
|
// // return db.V_BillInvoice.Where(p => p.BillNum == billnum).ToList();
|
||||
|
//
|
||||
|
// }
|
||||
|
// }
|
||||
|
} |
||||
|
} |
@ -0,0 +1,115 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Data; |
||||
|
using System.Data.Entity.Migrations; |
||||
|
using System.Data.SqlClient; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using CK.SCP.Models; |
||||
|
using CK.SCP.Models.Enums; |
||||
|
using CK.SCP.Models.ScpEntity; |
||||
|
|
||||
|
|
||||
|
namespace CK.SCP.Controller |
||||
|
{ |
||||
|
public class POController |
||||
|
{ |
||||
|
public static List<V_POAll> Getlist() |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
return db.V_POAll.ToList(); |
||||
|
} |
||||
|
} |
||||
|
public static bool UpdatePOState(TF_PO model) |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
db.TF_PO.AddOrUpdate(p => p.UID, model); |
||||
|
EntitiesFactory.SaveDb(db); |
||||
|
} |
||||
|
return true; |
||||
|
} |
||||
|
|
||||
|
public static TF_PO GetlistByID(int uid) |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
return db.TF_PO.SingleOrDefault(p => p.UID == uid); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public static TF_PO GetlistByBillNum(string billnum) |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
return db.TF_PO.SingleOrDefault(p => p.BillNum == billnum); |
||||
|
} |
||||
|
} |
||||
|
public static V_POAll GetPOAlllistByBillNum(string billnum) |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
return db.V_POAll.SingleOrDefault(p => p.BillNum == billnum); |
||||
|
} |
||||
|
} |
||||
|
public static void UpdateOrderByUID(int state, int uid) |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
TF_PO model = new TF_PO(); |
||||
|
model.State = state; |
||||
|
model.UID = uid; |
||||
|
db.SaveChanges(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public static void UpdatePOOBybillno(TF_PO model) |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
model.State = (int)PlanState.Confirm; |
||||
|
|
||||
|
db.TF_PO.AddOrUpdate(p => p.UID, model); |
||||
|
db.SaveChanges(); |
||||
|
} |
||||
|
} |
||||
|
public static List<V_POAll> GetlistByBillNum(V_POAll model) |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
return db.V_POAll.Where(p => p.BillNum == model.BillNum).ToList(); |
||||
|
} |
||||
|
} |
||||
|
public static TF_PO GetASNlist(string billnum, string vendid) |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
return db.TF_PO.SingleOrDefault(p => p.BillNum == billnum && p.VendId == vendid); |
||||
|
} |
||||
|
} |
||||
|
public static TF_PO GetPOModel(int id) |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
return db.TF_PO.SingleOrDefault(p => p.UID == id); |
||||
|
} |
||||
|
} |
||||
|
public static List<TF_PO> GetASNlist() |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
return db.TF_PO.ToList(); |
||||
|
} |
||||
|
} |
||||
|
public static void DeletePO(TF_PO model) |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
db.TF_PO.Remove(model); |
||||
|
db.SaveChanges(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,68 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using CK.SCP.Models; |
||||
|
using CK.SCP.Models.ScpEntity; |
||||
|
|
||||
|
|
||||
|
namespace CK.SCP.Controller |
||||
|
{ |
||||
|
public class PODetailController |
||||
|
{ |
||||
|
public static V_POAllDetail GetlistByBillNum(string billnum) |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
return db.V_POAllDetail.SingleOrDefault(p => p.BillNum == billnum); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public static TA_VENDER GetlistBySupplierCode(string VendId) |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
return db.TA_VENDER.SingleOrDefault(p => p.VendId == VendId); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public static List<TF_PO_DETAIL> GetDetaillistByBillNum(string billnum) |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
return db.TF_PO_DETAIL.Where(p => p.BillNum == billnum).ToList(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public static TF_PO_DETAIL GetDetaillistByuid(int uid) |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
return db.TF_PO_DETAIL.SingleOrDefault(p => p.UID == uid); |
||||
|
} |
||||
|
} |
||||
|
public static List<TF_PO_DETAIL> GetDetaillistBybillnos(string billno) |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
return db.TF_PO_DETAIL.Where(p => p.BillNum == billno).ToList(); |
||||
|
} |
||||
|
} |
||||
|
public static void Delete(TF_PO_DETAIL model) |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
db.TF_PO_DETAIL.Remove(model); |
||||
|
} |
||||
|
} |
||||
|
public static TF_PO_DETAIL GetDetaillistBybillidandline(string bill, int linenum) |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
return db.TF_PO_DETAIL.SingleOrDefault(p => p.BillNum == bill && p.ErpLineNum == linenum); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
@ -0,0 +1,29 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using CK.SCP.Models; |
||||
|
using CK.SCP.Models.ScpEntity; |
||||
|
|
||||
|
|
||||
|
namespace CK.SCP.Controller |
||||
|
{ |
||||
|
public class PartController |
||||
|
{ |
||||
|
public static List<TA_PART> Getlist() |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
return db.TA_PART.ToList(); |
||||
|
} |
||||
|
} |
||||
|
public static List<TA_PART> GetlistByPartCode(TA_PART model) |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
return db.TA_PART.Where(p=>p.PartCode==model.PartCode).ToList(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,60 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Data.Entity.Migrations; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using CK.SCP.Models; |
||||
|
using CK.SCP.Models.ScpEntity; |
||||
|
|
||||
|
|
||||
|
namespace CK.SCP.Controller |
||||
|
{ |
||||
|
public class PlanMonthController |
||||
|
{ |
||||
|
public static TB_PlanMonth GetPlanMonthById(int id) |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
return db.TB_PlanMonth.SingleOrDefault(p => p.ID == id); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public static bool UpdatePlanMonthById(TB_PlanMonth model) |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
model.IsSend = "是"; |
||||
|
model.SendTime = DateTime.Now; |
||||
|
db.TB_PlanMonth.AddOrUpdate(model); |
||||
|
db.SaveChanges(); |
||||
|
} |
||||
|
return true; |
||||
|
} |
||||
|
public static TA_VENDER GetVend() |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
return db.TA_VENDER.OrderByDescending(p => p.Email).SingleOrDefault(p => p.Email != null); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public static List<TA_VENDER> GetVendList() |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
return db.TA_VENDER.ToList(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public static bool SaveTbPlanMonth(TB_PlanMonth model) |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
db.TB_PlanMonth.AddOrUpdate(model); |
||||
|
db.SaveChanges(); |
||||
|
} |
||||
|
return true; |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,36 @@ |
|||||
|
using System.Reflection; |
||||
|
using System.Runtime.CompilerServices; |
||||
|
using System.Runtime.InteropServices; |
||||
|
|
||||
|
// 有关程序集的一般信息由以下
|
||||
|
// 控制。更改这些特性值可修改
|
||||
|
// 与程序集关联的信息。
|
||||
|
[assembly: AssemblyTitle("CK.SCP.CK.SCP.Controller")] |
||||
|
[assembly: AssemblyDescription("")] |
||||
|
[assembly: AssemblyConfiguration("")] |
||||
|
[assembly: AssemblyCompany("Microsoft")] |
||||
|
[assembly: AssemblyProduct("CK.SCP.CK.SCP.Controller")] |
||||
|
[assembly: AssemblyCopyright("Copyright © Microsoft 2018")] |
||||
|
[assembly: AssemblyTrademark("")] |
||||
|
[assembly: AssemblyCulture("")] |
||||
|
|
||||
|
//将 ComVisible 设置为 false 将使此程序集中的类型
|
||||
|
//对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
|
||||
|
//请将此类型的 ComVisible 特性设置为 true。
|
||||
|
[assembly: ComVisible(false)] |
||||
|
|
||||
|
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
|
||||
|
[assembly: Guid("0c706e36-c79d-467c-91ca-ddf39bc43113")] |
||||
|
|
||||
|
// 程序集的版本信息由下列四个值组成:
|
||||
|
//
|
||||
|
// 主版本
|
||||
|
// 次版本
|
||||
|
// 生成号
|
||||
|
// 修订号
|
||||
|
//
|
||||
|
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
|
||||
|
// 方法是按如下所示使用“*”: :
|
||||
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||
|
[assembly: AssemblyVersion("1.0.0.0")] |
||||
|
[assembly: AssemblyFileVersion("1.0.0.0")] |
@ -0,0 +1,54 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Data.Entity.Migrations; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using CK.SCP.Models; |
||||
|
using CK.SCP.Models.ScpEntity; |
||||
|
|
||||
|
|
||||
|
namespace CK.SCP.Controller |
||||
|
{ |
||||
|
public class PublicDataController |
||||
|
{ |
||||
|
public static TB_PublicData GetlistByBillNo(int id) |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
return db.TB_PublicData.SingleOrDefault(p => p.ID == id); |
||||
|
} |
||||
|
} |
||||
|
public static bool SaveInfo(TB_PublicData model) |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
db.TB_PublicData.AddOrUpdate(model); |
||||
|
db.SaveChanges(); |
||||
|
} |
||||
|
return true; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public static bool UpdateInfo(TB_PublicData model) |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
db.TB_PublicData.AddOrUpdate(p => p.ID, model); |
||||
|
db.SaveChanges(); |
||||
|
} |
||||
|
return true; |
||||
|
} |
||||
|
|
||||
|
public static void DeleteById(int id) |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
var info = db.TB_PublicData.SingleOrDefault(p => p.ID == id); |
||||
|
if (info != null) db.TB_PublicData.Remove(info); |
||||
|
db.SaveChanges(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,22 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using CK.SCP.Models; |
||||
|
using CK.SCP.Models.ScpEntity; |
||||
|
|
||||
|
|
||||
|
namespace CK.SCP.Controller |
||||
|
{ |
||||
|
public class ReceiveController |
||||
|
{ |
||||
|
public static V_Receive GetlistByBillNum(string billnum) |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
return db.V_Receive.SingleOrDefault(p => p.BillNum == billnum); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,33 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Data.Entity.Migrations; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using CK.SCP.Models; |
||||
|
using CK.SCP.Models.ScpEntity; |
||||
|
|
||||
|
|
||||
|
namespace CK.SCP.Controller |
||||
|
{ |
||||
|
public class ReceiveDetailController |
||||
|
{ |
||||
|
public static V_ReceiveDetail GetlistByBillNum(string billnum) |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
return db.V_ReceiveDetail.SingleOrDefault(p => p.BillNum == billnum); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public static bool UpdateReceive(V_ReceiveDetail model) |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
db.V_ReceiveDetail.AddOrUpdate(p => p.UID, model); |
||||
|
EntitiesFactory.SaveDb(db); |
||||
|
} |
||||
|
return true; |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,42 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.ComponentModel; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace CK.SCP.Controller |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
///返回结果类
|
||||
|
/// </summary>
|
||||
|
/// <typeparam name="T"></typeparam>
|
||||
|
public class ResultObject<T> |
||||
|
{ |
||||
|
public ResultObject() |
||||
|
{ |
||||
|
ErrorList = new List<Exception>(); |
||||
|
} |
||||
|
/// <summary>
|
||||
|
/// 返回结果
|
||||
|
/// </summary>
|
||||
|
public T Result { set; get; } |
||||
|
/// <summary>
|
||||
|
/// 错误列表
|
||||
|
/// </summary>
|
||||
|
public List<Exception> ErrorList { set; get; } |
||||
|
/// <summary>
|
||||
|
/// 返回状态
|
||||
|
/// </summary>
|
||||
|
public ReturnStatus State |
||||
|
{private set; get; } |
||||
|
} |
||||
|
public enum ReturnStatus |
||||
|
{ |
||||
|
[Description("失败")] |
||||
|
Failed, |
||||
|
[Description("成功")] |
||||
|
Succeed |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,23 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using CK.SCP.Models; |
||||
|
|
||||
|
|
||||
|
namespace CK.SCP.Controller |
||||
|
{ |
||||
|
public class ShipController |
||||
|
{ |
||||
|
public static void DeleteById(int id) |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
var asn = db.TF_ASN.SingleOrDefault(p => p.UID == id); |
||||
|
if (asn != null) db.TF_ASN.Remove(asn); |
||||
|
db.SaveChanges(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,57 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Data.Entity.Migrations; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using CK.SCP.Models; |
||||
|
using CK.SCP.Models.ScpEntity; |
||||
|
|
||||
|
|
||||
|
namespace CK.SCP.Controller |
||||
|
{ |
||||
|
public class ShipDetailController |
||||
|
{ |
||||
|
public static V_BillShipDetail GetlistByBillNum(string billnum) |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
return db.V_BillShipDetail.SingleOrDefault(p => p.BillNum == billnum); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public static V_BillShip GetBillShiplistByBillNo(string billnum) |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
return db.V_BillShip.SingleOrDefault(p => p.Bill == billnum); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public static TF_ASN GetlistByBillNo(string billnum) |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
return db.TF_ASN.SingleOrDefault(p => p.BillNum == billnum); |
||||
|
} |
||||
|
} |
||||
|
public static TF_ASN_DETAIL GetDeatillistByBillNo(string billnum) |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
return db.TF_ASN_DETAIL.SingleOrDefault(p => p.BillNum == billnum); |
||||
|
} |
||||
|
} |
||||
|
public static bool UpdateShip(TF_ASN model) |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
db.TF_ASN.AddOrUpdate(p => p.UID, model); |
||||
|
|
||||
|
EntitiesFactory.SaveDb(db); |
||||
|
} |
||||
|
return true; |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,32 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Data; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using CK.SCP.Models; |
||||
|
using CK.SCP.Models.ScpEntity; |
||||
|
|
||||
|
|
||||
|
|
||||
|
namespace CK.SCP.Controller |
||||
|
{ |
||||
|
public class SupplierController |
||||
|
{ |
||||
|
public static List<TA_VENDER> GetlistByName(TA_VENDER model) |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
return db.TA_VENDER.Where(p => p.VendName == model.VendName).ToList(); |
||||
|
} |
||||
|
} |
||||
|
public static List<TA_VENDER> Getlist() |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
return db.TA_VENDER.ToList(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,29 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using CK.SCP.Models; |
||||
|
using CK.SCP.Models.ScpEntity; |
||||
|
|
||||
|
|
||||
|
namespace CK.SCP.Controller |
||||
|
{ |
||||
|
public class SupplierPartController |
||||
|
{ |
||||
|
// public static List<V_VenderPart> Getlist()
|
||||
|
// {
|
||||
|
// using (ScpEntities db = EntitiesFactory.CreateScpInstance())
|
||||
|
// {
|
||||
|
// return db.V_VenderPart.ToList();
|
||||
|
// }
|
||||
|
// }
|
||||
|
// public static List<V_VenderPart> GetlistByPartCode(V_VenderPart model)
|
||||
|
// {
|
||||
|
// using (ScpEntities db = EntitiesFactory.CreateScpInstance())
|
||||
|
// {
|
||||
|
// return db.V_VenderPart.Where(p => p.PartCode == model.PartCode).ToList();
|
||||
|
// }
|
||||
|
// }
|
||||
|
} |
||||
|
} |
@ -0,0 +1,253 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using CK.SCP.Models; |
||||
|
using CK.SCP.Models.Enums; |
||||
|
using CK.SCP.Models.ScpEntity; |
||||
|
using CK.SCP.Models.UniApiEntity; |
||||
|
|
||||
|
namespace CK.SCP.Controller |
||||
|
{ |
||||
|
public static class UniApiController |
||||
|
{ |
||||
|
|
||||
|
public static void RemoveList(ScpEntities db, List<TS_UNI_API> uniApiList) |
||||
|
{ |
||||
|
db.TS_UNI_API.RemoveRange(uniApiList); |
||||
|
} |
||||
|
public static void AddHisList(ScpEntities db, List<TS_UNI_API_HIS> uniApiHisList) |
||||
|
{ |
||||
|
|
||||
|
db.TS_UNI_API_HIS.AddRange(uniApiHisList); |
||||
|
} |
||||
|
|
||||
|
public static void AddApiData(ScpEntities wdb, TS_UNI_API apiData) |
||||
|
{ |
||||
|
wdb.TS_UNI_API.Add(apiData); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public static void AddApiDataList(ScpEntities wdb, List<TS_UNI_API> apiDataList) |
||||
|
{ |
||||
|
wdb.TS_UNI_API.AddRange(apiDataList); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public static WmsTableName GetTableName(UniApiType uniApiType) |
||||
|
{ |
||||
|
WmsTableName tableName; |
||||
|
switch (uniApiType) |
||||
|
{ |
||||
|
case UniApiType.PO: |
||||
|
tableName = WmsTableName.TS_UNI_API;//中间表的名字
|
||||
|
break; |
||||
|
case UniApiType.Receive: |
||||
|
tableName = WmsTableName.TS_UNI_API; |
||||
|
break; |
||||
|
case UniApiType.BarCode: |
||||
|
tableName = WmsTableName.TS_UNI_API; |
||||
|
break; |
||||
|
case UniApiType.Invoice: |
||||
|
tableName = WmsTableName.TS_UNI_API; |
||||
|
break; |
||||
|
default: |
||||
|
throw new ArgumentOutOfRangeException(nameof(uniApiType), uniApiType, null); |
||||
|
} |
||||
|
return tableName; |
||||
|
} |
||||
|
|
||||
|
//创建采购订单
|
||||
|
public static TS_UNI_API CreateBy(TF_PO bill, TF_PO_DETAIL detail, UniApiType uniApiType) |
||||
|
{ |
||||
|
var tableName = GetTableName(uniApiType); |
||||
|
var apiData = new TS_UNI_API |
||||
|
{ |
||||
|
InterfaceType = uniApiType.ToString(), |
||||
|
TableName = tableName.ToString(), |
||||
|
BillNum = bill.BillNum, |
||||
|
PartCode = detail.PartCode, |
||||
|
Batch = "", |
||||
|
Qty = detail.BillQty, |
||||
|
PoUnit = detail.PoUnit, |
||||
|
LocUnit = detail.LocUnit, |
||||
|
State = detail.State, |
||||
|
CreateOper = bill.OperName, |
||||
|
CreateTime = bill.BillTime, |
||||
|
PutTime = ScpCache.GetServerTime(), |
||||
|
VendId = bill.VendId, |
||||
|
BillType = (int)BillType.PuchaseOrder, |
||||
|
SubBillType = 0, |
||||
|
ValidDate = detail.DueDate, |
||||
|
ErpBillNum = bill.ErpBillNum, |
||||
|
ErpLineNum = detail.ErpLineNum, |
||||
|
VendBatch = "", |
||||
|
SourceBillNum = "", |
||||
|
Price = detail.Price, |
||||
|
PackQty = detail.PackQty, |
||||
|
Currency = detail.Currency, |
||||
|
Attn = "",//TODO
|
||||
|
Buyer = bill.Buyer, |
||||
|
BuyerPhone = bill.BuyerPhone, |
||||
|
ModType = bill.ModType, |
||||
|
Receiver = "",//TODO
|
||||
|
UmConv = (decimal)detail.UmConv, |
||||
|
}; |
||||
|
return apiData; |
||||
|
} |
||||
|
|
||||
|
private static ScpEntities db = EntitiesFactory.CreateScpInstance(); |
||||
|
public static TS_UNI_API CreateBy(TF_PO bill, List<TF_PO_DETAIL> detail, UniApiType uniApiType) |
||||
|
{ |
||||
|
var tableName = GetTableName(uniApiType); |
||||
|
TS_UNI_API asp = new TS_UNI_API(); |
||||
|
foreach (var item in detail) |
||||
|
{ |
||||
|
asp.InterfaceType = uniApiType.ToString(); |
||||
|
asp.TableName = tableName.ToString(); |
||||
|
|
||||
|
asp.BillNum = bill.BillNum; |
||||
|
asp.Batch = string.Empty; |
||||
|
asp.CreateOper = bill.OperName; |
||||
|
asp.CreateTime = bill.BillTime; |
||||
|
asp.PutTime = ScpCache.GetServerTime(); |
||||
|
asp.VendId = bill.VendId; |
||||
|
asp.BillType = (int)BillType.PO; |
||||
|
asp.SubBillType = 0; |
||||
|
asp.VendBatch = string.Empty; |
||||
|
asp.SourceBillNum = string.Empty; |
||||
|
asp.Attn = "";//TODO
|
||||
|
asp.Buyer = bill.Buyer; |
||||
|
asp.BuyerPhone = bill.BuyerPhone; |
||||
|
asp.ModType = bill.ModType; |
||||
|
asp.Receiver = "";//TODO
|
||||
|
asp.PartCode = item.PartCode; |
||||
|
|
||||
|
asp.Qty = item.BillQty; |
||||
|
asp.PoUnit = item.PoUnit; |
||||
|
asp.LocUnit = item.LocUnit; |
||||
|
asp.State = item.State; |
||||
|
|
||||
|
asp.ValidDate = item.DueDate; |
||||
|
asp.ErpBillNum = bill.BillNum;//暂时跟billnum 一样 后期可能会改 预留
|
||||
|
asp.ErpLineNum = item.ErpLineNum; |
||||
|
|
||||
|
asp.Price = item.Price; |
||||
|
asp.PackQty = item.PackQty; |
||||
|
asp.Currency = item.Currency; |
||||
|
|
||||
|
asp.UmConv = (decimal)item.UmConv; |
||||
|
|
||||
|
db.TS_UNI_API.Add(asp); |
||||
|
db.SaveChanges(); |
||||
|
} |
||||
|
|
||||
|
return asp; |
||||
|
} |
||||
|
|
||||
|
//创建发货单
|
||||
|
public static TS_UNI_API CreateBy(TF_ASN bill, TF_ASN_DETAIL detail, UniApiType uniApiType) |
||||
|
{ |
||||
|
var tableName = GetTableName(uniApiType); |
||||
|
var apiData = new TS_UNI_API |
||||
|
{ |
||||
|
InterfaceType = uniApiType.ToString(), |
||||
|
TableName = tableName.ToString(), |
||||
|
BillNum = bill.BillNum, |
||||
|
PartCode = detail.PartCode, |
||||
|
Batch = detail.Batch, |
||||
|
Qty = detail.BillQty, |
||||
|
PoUnit = detail.PoUnit, |
||||
|
LocUnit = detail.LocUnit, |
||||
|
State = detail.State, |
||||
|
CreateOper = bill.OperName, |
||||
|
CreateTime = bill.BillTime, |
||||
|
PutTime = ScpCache.GetServerTime(), |
||||
|
VendId = bill.VendId, |
||||
|
BillType = (int)BillType.PuchaseOrder, |
||||
|
SubBillType = 0, |
||||
|
ValidDate = detail.ProduceDate, |
||||
|
ErpBillNum = bill.PoBillNum, |
||||
|
ErpLineNum = detail.PoLineNum, |
||||
|
VendBatch = detail.VendBatch, |
||||
|
Price = detail.Price, |
||||
|
PackQty = detail.PackQty, |
||||
|
Currency = detail.Currency, |
||||
|
UmConv = (decimal) detail.UmConv, |
||||
|
}; |
||||
|
return apiData; |
||||
|
} |
||||
|
|
||||
|
//创建条码
|
||||
|
public static TS_UNI_API CreateBy(TF_ASN bill, TS_BARCODE detail, UniApiType uniApiType) |
||||
|
{ |
||||
|
var tableName = GetTableName(uniApiType); |
||||
|
var apiData = new TS_UNI_API |
||||
|
{ |
||||
|
Barcode = detail.BarCode, |
||||
|
InterfaceType = uniApiType.ToString(), |
||||
|
TableName = tableName.ToString(), |
||||
|
BillNum = bill.BillNum, |
||||
|
PartCode = detail.PartCode, |
||||
|
Batch = detail.Batch, |
||||
|
Qty = detail.Qty, |
||||
|
PoUnit = detail.PoUnit, |
||||
|
LocUnit = detail.LocUnit, |
||||
|
State = detail.State, |
||||
|
CreateOper = bill.OperName, |
||||
|
CreateTime = bill.BillTime, |
||||
|
PutTime = ScpCache.GetServerTime(), |
||||
|
VendId = bill.VendId, |
||||
|
BillType = (int)BillType.PuchaseOrder, |
||||
|
SubBillType = 0, |
||||
|
ValidDate = detail.ProduceDate, |
||||
|
ErpBillNum = bill.PoBillNum, |
||||
|
ErpLineNum = detail.PoBillLine, |
||||
|
VendBatch = detail.VendBatch, |
||||
|
SourceBillNum = detail.FullBarCode, |
||||
|
PackQty = detail.PackQty, |
||||
|
}; |
||||
|
return apiData; |
||||
|
} |
||||
|
|
||||
|
//创建发票
|
||||
|
public static TS_UNI_API CreateBy(TB_INVOICE bill, TB_INVOICE_DETAIL detail, UniApiType uniApiType) |
||||
|
{ |
||||
|
var tableName = GetTableName(uniApiType); |
||||
|
var apiData = new TS_UNI_API |
||||
|
{ |
||||
|
InterfaceType = uniApiType.ToString(), |
||||
|
TableName = tableName.ToString(), |
||||
|
BillNum = bill.BillNum, |
||||
|
PartCode = detail.PartCode, |
||||
|
Batch = "", |
||||
|
Qty = detail.Qty, |
||||
|
PoUnit = detail.PoUnit, |
||||
|
LocUnit = detail.LocUnit, |
||||
|
State = detail.State, |
||||
|
CreateOper = bill.OperName, |
||||
|
CreateTime = bill.BillTime, |
||||
|
PutTime = ScpCache.GetServerTime(), |
||||
|
VendId = bill.VendId, |
||||
|
BillType = (int)BillType.PuchaseOrder, |
||||
|
SubBillType = 0, |
||||
|
ValidDate = detail.ProduceDate, |
||||
|
ErpBillNum = detail.PoBillNum, |
||||
|
ErpLineNum = detail.PoLineNum, |
||||
|
VendBatch = "", |
||||
|
SourceBillNum = "", |
||||
|
Price = detail.Price, |
||||
|
PackQty = detail.PackQty, |
||||
|
Currency = detail.Currency, |
||||
|
Invoice = bill.InvoiceNum, |
||||
|
Tax = detail.Tax, |
||||
|
TaxAmt = detail.TaxAmt, |
||||
|
}; |
||||
|
return apiData; |
||||
|
} |
||||
|
|
||||
|
public static List<TS_UNI_API> GetNewInterfaceList(ScpEntities wdb) |
||||
|
{ |
||||
|
return wdb.TS_UNI_API.Where(p => p.State == (int)BillState.New).OrderBy(p => p.UID).ToList(); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,14 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
|
||||
|
namespace CK.SCP.Controller |
||||
|
{ |
||||
|
public class UserController |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,21 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using CK.SCP.Models; |
||||
|
using CK.SCP.Models.ScpEntity; |
||||
|
|
||||
|
namespace CK.SCP.Controller |
||||
|
{ |
||||
|
public class VEND_USERController |
||||
|
{ |
||||
|
public static TA_VEND_USER GetVendUserModel(int id) |
||||
|
{ |
||||
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
||||
|
{ |
||||
|
return db.TA_VEND_USER.SingleOrDefault(p => p.UID == id); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,25 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<configuration> |
||||
|
<configSections> |
||||
|
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> |
||||
|
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> |
||||
|
</configSections> |
||||
|
<runtime> |
||||
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> |
||||
|
<dependentAssembly> |
||||
|
<assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" culture="neutral" /> |
||||
|
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" /> |
||||
|
</dependentAssembly> |
||||
|
</assemblyBinding> |
||||
|
</runtime> |
||||
|
<entityFramework> |
||||
|
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework"> |
||||
|
<parameters> |
||||
|
<parameter value="mssqllocaldb" /> |
||||
|
</parameters> |
||||
|
</defaultConnectionFactory> |
||||
|
<providers> |
||||
|
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /> |
||||
|
</providers> |
||||
|
</entityFramework> |
||||
|
</configuration> |
@ -0,0 +1,5 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<packages> |
||||
|
<package id="EntityFramework" version="6.2.0" targetFramework="net452" /> |
||||
|
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net452" /> |
||||
|
</packages> |
@ -0,0 +1,6 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8" ?> |
||||
|
<configuration> |
||||
|
<startup> |
||||
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" /> |
||||
|
</startup> |
||||
|
</configuration> |
@ -0,0 +1,87 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> |
||||
|
<PropertyGroup> |
||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
||||
|
<ProjectGuid>{1EE718E2-C8BA-4DD5-80EC-A1DE0449A58D}</ProjectGuid> |
||||
|
<OutputType>WinExe</OutputType> |
||||
|
<AppDesignerFolder>Properties</AppDesignerFolder> |
||||
|
<RootNamespace>CK.SCP.DCUNI</RootNamespace> |
||||
|
<AssemblyName>CK.SCP.DCUNI</AssemblyName> |
||||
|
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> |
||||
|
<FileAlignment>512</FileAlignment> |
||||
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> |
||||
|
</PropertyGroup> |
||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
||||
|
<PlatformTarget>AnyCPU</PlatformTarget> |
||||
|
<DebugSymbols>true</DebugSymbols> |
||||
|
<DebugType>full</DebugType> |
||||
|
<Optimize>false</Optimize> |
||||
|
<OutputPath>bin\Debug\</OutputPath> |
||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants> |
||||
|
<ErrorReport>prompt</ErrorReport> |
||||
|
<WarningLevel>4</WarningLevel> |
||||
|
</PropertyGroup> |
||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
||||
|
<PlatformTarget>AnyCPU</PlatformTarget> |
||||
|
<DebugType>pdbonly</DebugType> |
||||
|
<Optimize>true</Optimize> |
||||
|
<OutputPath>bin\Release\</OutputPath> |
||||
|
<DefineConstants>TRACE</DefineConstants> |
||||
|
<ErrorReport>prompt</ErrorReport> |
||||
|
<WarningLevel>4</WarningLevel> |
||||
|
</PropertyGroup> |
||||
|
<ItemGroup> |
||||
|
<Reference Include="System" /> |
||||
|
<Reference Include="System.Core" /> |
||||
|
<Reference Include="System.Xml.Linq" /> |
||||
|
<Reference Include="System.Data.DataSetExtensions" /> |
||||
|
<Reference Include="Microsoft.CSharp" /> |
||||
|
<Reference Include="System.Data" /> |
||||
|
<Reference Include="System.Deployment" /> |
||||
|
<Reference Include="System.Drawing" /> |
||||
|
<Reference Include="System.Net.Http" /> |
||||
|
<Reference Include="System.Windows.Forms" /> |
||||
|
<Reference Include="System.Xml" /> |
||||
|
</ItemGroup> |
||||
|
<ItemGroup> |
||||
|
<Compile Include="Form1.cs"> |
||||
|
<SubType>Form</SubType> |
||||
|
</Compile> |
||||
|
<Compile Include="Form1.Designer.cs"> |
||||
|
<DependentUpon>Form1.cs</DependentUpon> |
||||
|
</Compile> |
||||
|
<Compile Include="Program.cs" /> |
||||
|
<Compile Include="Properties\AssemblyInfo.cs" /> |
||||
|
<EmbeddedResource Include="Properties\Resources.resx"> |
||||
|
<Generator>ResXFileCodeGenerator</Generator> |
||||
|
<LastGenOutput>Resources.Designer.cs</LastGenOutput> |
||||
|
<SubType>Designer</SubType> |
||||
|
</EmbeddedResource> |
||||
|
<Compile Include="Properties\Resources.Designer.cs"> |
||||
|
<AutoGen>True</AutoGen> |
||||
|
<DependentUpon>Resources.resx</DependentUpon> |
||||
|
</Compile> |
||||
|
<None Include="Properties\Settings.settings"> |
||||
|
<Generator>SettingsSingleFileGenerator</Generator> |
||||
|
<LastGenOutput>Settings.Designer.cs</LastGenOutput> |
||||
|
</None> |
||||
|
<Compile Include="Properties\Settings.Designer.cs"> |
||||
|
<AutoGen>True</AutoGen> |
||||
|
<DependentUpon>Settings.settings</DependentUpon> |
||||
|
<DesignTimeSharedInput>True</DesignTimeSharedInput> |
||||
|
</Compile> |
||||
|
</ItemGroup> |
||||
|
<ItemGroup> |
||||
|
<None Include="App.config" /> |
||||
|
</ItemGroup> |
||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> |
||||
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. |
||||
|
Other similar extension points exist, see Microsoft.Common.targets. |
||||
|
<Target Name="BeforeBuild"> |
||||
|
</Target> |
||||
|
<Target Name="AfterBuild"> |
||||
|
</Target> |
||||
|
--> |
||||
|
</Project> |
@ -0,0 +1,39 @@ |
|||||
|
namespace CK.SCP.DCUNI |
||||
|
{ |
||||
|
partial class Form1 |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 必需的设计器变量。
|
||||
|
/// </summary>
|
||||
|
private System.ComponentModel.IContainer components = null; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 清理所有正在使用的资源。
|
||||
|
/// </summary>
|
||||
|
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
|
protected override void Dispose(bool disposing) |
||||
|
{ |
||||
|
if (disposing && (components != null)) |
||||
|
{ |
||||
|
components.Dispose(); |
||||
|
} |
||||
|
base.Dispose(disposing); |
||||
|
} |
||||
|
|
||||
|
#region Windows 窗体设计器生成的代码
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 设计器支持所需的方法 - 不要修改
|
||||
|
/// 使用代码编辑器修改此方法的内容。
|
||||
|
/// </summary>
|
||||
|
private void InitializeComponent() |
||||
|
{ |
||||
|
this.components = new System.ComponentModel.Container(); |
||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; |
||||
|
this.Text = "Form1"; |
||||
|
} |
||||
|
|
||||
|
#endregion
|
||||
|
} |
||||
|
} |
||||
|
|
@ -0,0 +1,20 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.ComponentModel; |
||||
|
using System.Data; |
||||
|
using System.Drawing; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using System.Windows.Forms; |
||||
|
|
||||
|
namespace CK.SCP.DCUNI |
||||
|
{ |
||||
|
public partial class Form1 : Form |
||||
|
{ |
||||
|
public Form1() |
||||
|
{ |
||||
|
InitializeComponent(); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,22 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Threading.Tasks; |
||||
|
using System.Windows.Forms; |
||||
|
|
||||
|
namespace CK.SCP.DCUNI |
||||
|
{ |
||||
|
static class Program |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 应用程序的主入口点。
|
||||
|
/// </summary>
|
||||
|
[STAThread] |
||||
|
static void Main() |
||||
|
{ |
||||
|
Application.EnableVisualStyles(); |
||||
|
Application.SetCompatibleTextRenderingDefault(false); |
||||
|
Application.Run(new Form1()); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,36 @@ |
|||||
|
using System.Reflection; |
||||
|
using System.Runtime.CompilerServices; |
||||
|
using System.Runtime.InteropServices; |
||||
|
|
||||
|
// 有关程序集的一般信息由以下
|
||||
|
// 控制。更改这些特性值可修改
|
||||
|
// 与程序集关联的信息。
|
||||
|
[assembly: AssemblyTitle("CK.SCP.DCUNI")] |
||||
|
[assembly: AssemblyDescription("")] |
||||
|
[assembly: AssemblyConfiguration("")] |
||||
|
[assembly: AssemblyCompany("")] |
||||
|
[assembly: AssemblyProduct("CK.SCP.DCUNI")] |
||||
|
[assembly: AssemblyCopyright("Copyright © 2019")] |
||||
|
[assembly: AssemblyTrademark("")] |
||||
|
[assembly: AssemblyCulture("")] |
||||
|
|
||||
|
//将 ComVisible 设置为 false 将使此程序集中的类型
|
||||
|
//对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
|
||||
|
//请将此类型的 ComVisible 特性设置为 true。
|
||||
|
[assembly: ComVisible(false)] |
||||
|
|
||||
|
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
|
||||
|
[assembly: Guid("1ee718e2-c8ba-4dd5-80ec-a1de0449a58d")] |
||||
|
|
||||
|
// 程序集的版本信息由下列四个值组成:
|
||||
|
//
|
||||
|
// 主版本
|
||||
|
// 次版本
|
||||
|
// 生成号
|
||||
|
// 修订号
|
||||
|
//
|
||||
|
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
|
||||
|
// 方法是按如下所示使用“*”: :
|
||||
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||
|
[assembly: AssemblyVersion("1.0.0.0")] |
||||
|
[assembly: AssemblyFileVersion("1.0.0.0")] |
@ -0,0 +1,71 @@ |
|||||
|
//------------------------------------------------------------------------------
|
||||
|
// <auto-generated>
|
||||
|
// 此代码由工具生成。
|
||||
|
// 运行时版本: 4.0.30319.42000
|
||||
|
//
|
||||
|
// 对此文件的更改可能导致不正确的行为,如果
|
||||
|
// 重新生成代码,则所做更改将丢失。
|
||||
|
// </auto-generated>
|
||||
|
//------------------------------------------------------------------------------
|
||||
|
|
||||
|
namespace CK.SCP.DCUNI.Properties |
||||
|
{ |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 强类型资源类,用于查找本地化字符串等。
|
||||
|
/// </summary>
|
||||
|
// 此类是由 StronglyTypedResourceBuilder
|
||||
|
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
|
||||
|
// 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen
|
||||
|
// (以 /str 作为命令选项),或重新生成 VS 项目。
|
||||
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] |
||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] |
||||
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] |
||||
|
internal class Resources |
||||
|
{ |
||||
|
|
||||
|
private static global::System.Resources.ResourceManager resourceMan; |
||||
|
|
||||
|
private static global::System.Globalization.CultureInfo resourceCulture; |
||||
|
|
||||
|
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] |
||||
|
internal Resources() |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 返回此类使用的缓存 ResourceManager 实例。
|
||||
|
/// </summary>
|
||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] |
||||
|
internal static global::System.Resources.ResourceManager ResourceManager |
||||
|
{ |
||||
|
get |
||||
|
{ |
||||
|
if ((resourceMan == null)) |
||||
|
{ |
||||
|
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CK.SCP.DCUNI.Properties.Resources", typeof(Resources).Assembly); |
||||
|
resourceMan = temp; |
||||
|
} |
||||
|
return resourceMan; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 覆盖当前线程的 CurrentUICulture 属性
|
||||
|
/// 使用此强类型的资源类的资源查找。
|
||||
|
/// </summary>
|
||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] |
||||
|
internal static global::System.Globalization.CultureInfo Culture |
||||
|
{ |
||||
|
get |
||||
|
{ |
||||
|
return resourceCulture; |
||||
|
} |
||||
|
set |
||||
|
{ |
||||
|
resourceCulture = value; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,117 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<root> |
||||
|
<!-- |
||||
|
Microsoft ResX Schema |
||||
|
|
||||
|
Version 2.0 |
||||
|
|
||||
|
The primary goals of this format is to allow a simple XML format |
||||
|
that is mostly human readable. The generation and parsing of the |
||||
|
various data types are done through the TypeConverter classes |
||||
|
associated with the data types. |
||||
|
|
||||
|
Example: |
||||
|
|
||||
|
... ado.net/XML headers & schema ... |
||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader> |
||||
|
<resheader name="version">2.0</resheader> |
||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> |
||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> |
||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> |
||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> |
||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> |
||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value> |
||||
|
</data> |
||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> |
||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> |
||||
|
<comment>This is a comment</comment> |
||||
|
</data> |
||||
|
|
||||
|
There are any number of "resheader" rows that contain simple |
||||
|
name/value pairs. |
||||
|
|
||||
|
Each data row contains a name, and value. The row also contains a |
||||
|
type or mimetype. Type corresponds to a .NET class that support |
||||
|
text/value conversion through the TypeConverter architecture. |
||||
|
Classes that don't support this are serialized and stored with the |
||||
|
mimetype set. |
||||
|
|
||||
|
The mimetype is used for serialized objects, and tells the |
||||
|
ResXResourceReader how to depersist the object. This is currently not |
||||
|
extensible. For a given mimetype the value must be set accordingly: |
||||
|
|
||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format |
||||
|
that the ResXResourceWriter will generate, however the reader can |
||||
|
read any of the formats listed below. |
||||
|
|
||||
|
mimetype: application/x-microsoft.net.object.binary.base64 |
||||
|
value : The object must be serialized with |
||||
|
: System.Serialization.Formatters.Binary.BinaryFormatter |
||||
|
: and then encoded with base64 encoding. |
||||
|
|
||||
|
mimetype: application/x-microsoft.net.object.soap.base64 |
||||
|
value : The object must be serialized with |
||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter |
||||
|
: and then encoded with base64 encoding. |
||||
|
|
||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64 |
||||
|
value : The object must be serialized into a byte array |
||||
|
: using a System.ComponentModel.TypeConverter |
||||
|
: and then encoded with base64 encoding. |
||||
|
--> |
||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> |
||||
|
<xsd:element name="root" msdata:IsDataSet="true"> |
||||
|
<xsd:complexType> |
||||
|
<xsd:choice maxOccurs="unbounded"> |
||||
|
<xsd:element name="metadata"> |
||||
|
<xsd:complexType> |
||||
|
<xsd:sequence> |
||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" /> |
||||
|
</xsd:sequence> |
||||
|
<xsd:attribute name="name" type="xsd:string" /> |
||||
|
<xsd:attribute name="type" type="xsd:string" /> |
||||
|
<xsd:attribute name="mimetype" type="xsd:string" /> |
||||
|
</xsd:complexType> |
||||
|
</xsd:element> |
||||
|
<xsd:element name="assembly"> |
||||
|
<xsd:complexType> |
||||
|
<xsd:attribute name="alias" type="xsd:string" /> |
||||
|
<xsd:attribute name="name" type="xsd:string" /> |
||||
|
</xsd:complexType> |
||||
|
</xsd:element> |
||||
|
<xsd:element name="data"> |
||||
|
<xsd:complexType> |
||||
|
<xsd:sequence> |
||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> |
||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> |
||||
|
</xsd:sequence> |
||||
|
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" /> |
||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> |
||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> |
||||
|
</xsd:complexType> |
||||
|
</xsd:element> |
||||
|
<xsd:element name="resheader"> |
||||
|
<xsd:complexType> |
||||
|
<xsd:sequence> |
||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> |
||||
|
</xsd:sequence> |
||||
|
<xsd:attribute name="name" type="xsd:string" use="required" /> |
||||
|
</xsd:complexType> |
||||
|
</xsd:element> |
||||
|
</xsd:choice> |
||||
|
</xsd:complexType> |
||||
|
</xsd:element> |
||||
|
</xsd:schema> |
||||
|
<resheader name="resmimetype"> |
||||
|
<value>text/microsoft-resx</value> |
||||
|
</resheader> |
||||
|
<resheader name="version"> |
||||
|
<value>2.0</value> |
||||
|
</resheader> |
||||
|
<resheader name="reader"> |
||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
||||
|
</resheader> |
||||
|
<resheader name="writer"> |
||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
||||
|
</resheader> |
||||
|
</root> |
@ -0,0 +1,30 @@ |
|||||
|
//------------------------------------------------------------------------------
|
||||
|
// <auto-generated>
|
||||
|
// This code was generated by a tool.
|
||||
|
// Runtime Version:4.0.30319.42000
|
||||
|
//
|
||||
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
|
// the code is regenerated.
|
||||
|
// </auto-generated>
|
||||
|
//------------------------------------------------------------------------------
|
||||
|
|
||||
|
namespace CK.SCP.DCUNI.Properties |
||||
|
{ |
||||
|
|
||||
|
|
||||
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] |
||||
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] |
||||
|
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase |
||||
|
{ |
||||
|
|
||||
|
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); |
||||
|
|
||||
|
public static Settings Default |
||||
|
{ |
||||
|
get |
||||
|
{ |
||||
|
return defaultInstance; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,7 @@ |
|||||
|
<?xml version='1.0' encoding='utf-8'?> |
||||
|
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)"> |
||||
|
<Profiles> |
||||
|
<Profile Name="(Default)" /> |
||||
|
</Profiles> |
||||
|
<Settings /> |
||||
|
</SettingsFile> |
@ -0,0 +1,20 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<configuration> |
||||
|
<configSections> |
||||
|
|
||||
|
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> |
||||
|
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --></configSections> |
||||
|
<entityFramework> |
||||
|
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework"> |
||||
|
<parameters> |
||||
|
<parameter value="mssqllocaldb" /> |
||||
|
</parameters> |
||||
|
</defaultConnectionFactory> |
||||
|
<providers> |
||||
|
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /> |
||||
|
</providers> |
||||
|
</entityFramework> |
||||
|
<connectionStrings> |
||||
|
<add name="ScpEntities" connectionString="data source=127.0.0.1;initial catalog=ChangKeTecSCP;persist security info=True;user id=sa;password=Microsoft2008;MultipleActiveResultSets=True;App=EntityFramework" providerName="System.Data.SqlClient" /> |
||||
|
</connectionStrings> |
||||
|
</configuration> |
@ -0,0 +1,94 @@ |
|||||
|
using System.Data.Entity; |
||||
|
|
||||
|
namespace CK.SCP.Models.AppBoxEntity |
||||
|
{ |
||||
|
public class AppBoxContext : DbContext |
||||
|
{ |
||||
|
public AppBoxContext() : base(EntitiesFactory.GetEfConnectionString(GlobalConfig.AppBoxDatabase)) |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public AppBoxContext(string strConn) : base(strConn) |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public DbSet<Config> Configs { get; set; } |
||||
|
public DbSet<Dept> Depts { get; set; } |
||||
|
public DbSet<User> Users { get; set; } |
||||
|
public DbSet<Role> Roles { get; set; } |
||||
|
public DbSet<Title> Titles { get; set; } |
||||
|
public DbSet<Online> Onlines { get; set; } |
||||
|
public DbSet<Log> Logs { get; set; } |
||||
|
public DbSet<Power> Powers { get; set; } |
||||
|
public DbSet<Menu> Menus { get; set; } |
||||
|
|
||||
|
protected override void OnModelCreating(DbModelBuilder modelBuilder) |
||||
|
{ |
||||
|
base.OnModelCreating(modelBuilder); |
||||
|
|
||||
|
|
||||
|
modelBuilder.Entity<Role>() |
||||
|
.HasMany(r => r.Users) |
||||
|
.WithMany(u => u.Roles) |
||||
|
.Map(x => x.ToTable("RoleUsers") |
||||
|
.MapLeftKey("RoleID") |
||||
|
.MapRightKey("UserID")); |
||||
|
|
||||
|
modelBuilder.Entity<Title>() |
||||
|
.HasMany(t => t.Users) |
||||
|
.WithMany(u => u.Titles) |
||||
|
.Map(x => x.ToTable("TitleUsers") |
||||
|
.MapLeftKey("TitleID") |
||||
|
.MapRightKey("UserID")); |
||||
|
|
||||
|
modelBuilder.Entity<Dept>() |
||||
|
.HasOptional(d => d.Parent) |
||||
|
.WithMany(d => d.Children) |
||||
|
.Map(x => x.MapKey("ParentID")); |
||||
|
|
||||
|
modelBuilder.Entity<Dept>() |
||||
|
.HasMany(d => d.Users) |
||||
|
.WithOptional(u => u.Dept) |
||||
|
.Map(x => x.MapKey("DeptID")); |
||||
|
|
||||
|
modelBuilder.Entity<Online>() |
||||
|
.HasRequired(o => o.User) |
||||
|
.WithMany() |
||||
|
.Map(x => x.MapKey("UserID")); |
||||
|
|
||||
|
modelBuilder.Entity<Menu>() |
||||
|
.HasOptional(m => m.Parent) |
||||
|
.WithMany(m => m.Children) |
||||
|
.Map(x => x.MapKey("ParentID")); |
||||
|
|
||||
|
//modelBuilder.Entity<Menu>()
|
||||
|
// .HasOptional(m => m.Module)
|
||||
|
// .WithMany()
|
||||
|
// .Map(x => x.MapKey("ModuleID"));
|
||||
|
|
||||
|
//modelBuilder.Entity<Module>()
|
||||
|
// .HasMany(m => m.ModulePowers)
|
||||
|
// .WithRequired(mp => mp.Module);
|
||||
|
|
||||
|
//modelBuilder.Entity<Power>()
|
||||
|
// .HasMany(p => p.ModulePowers)
|
||||
|
// .WithRequired(mp => mp.Power);
|
||||
|
|
||||
|
modelBuilder.Entity<Menu>() |
||||
|
.HasOptional(m => m.ViewPower) |
||||
|
.WithMany() |
||||
|
.Map(x => x.MapKey("ViewPowerID")); |
||||
|
|
||||
|
modelBuilder.Entity<Role>() |
||||
|
.HasMany(r => r.Powers) |
||||
|
.WithMany(p => p.Roles) |
||||
|
.Map(x => x.ToTable("RolePowers") |
||||
|
.MapLeftKey("RoleID") |
||||
|
.MapRightKey("PowerID")); |
||||
|
|
||||
|
|
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,686 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Data.Entity; |
||||
|
using System.Linq; |
||||
|
|
||||
|
namespace CK.SCP.Models.AppBoxEntity |
||||
|
{ |
||||
|
public class AppBoxDatabaseInitializer : DropCreateDatabaseIfModelChanges<AppBoxContext> // DropCreateDatabaseAlways<AppBoxContext> DropCreateDatabaseIfModelChanges<AppBoxContext>
|
||||
|
{ |
||||
|
protected override void Seed(AppBoxContext context) |
||||
|
{ |
||||
|
GetConfigs().ForEach(c => context.Configs.Add(c)); |
||||
|
GetDepts().ForEach(d => context.Depts.Add(d)); |
||||
|
GetUsers().ForEach(u => context.Users.Add(u)); |
||||
|
|
||||
|
GetRoles().ForEach(r => context.Roles.Add(r)); |
||||
|
GetPowers().ForEach(p => context.Powers.Add(p)); |
||||
|
GetTitles().ForEach(t => context.Titles.Add(t)); |
||||
|
|
||||
|
context.SaveChanges(); |
||||
|
// 添加菜单时需要指定ViewPower,所以上面需要先保存到数据库
|
||||
|
GetMenus(context).ForEach(m => context.Menus.Add(m)); |
||||
|
} |
||||
|
|
||||
|
private static List<Menu> GetMenus(AppBoxContext context) |
||||
|
{ |
||||
|
var menus = new List<Menu> { |
||||
|
new Menu |
||||
|
{ |
||||
|
Name = "系统管理", |
||||
|
SortIndex = 1, |
||||
|
Remark = "顶级菜单", |
||||
|
Children = new List<Menu> { |
||||
|
new Menu |
||||
|
{ |
||||
|
Name = "用户管理", |
||||
|
SortIndex = 10, |
||||
|
Remark = "二级菜单", |
||||
|
NavigateUrl = "~/admin/user.aspx", |
||||
|
ImageUrl = "~/res/icon/tag_blue.png", |
||||
|
ViewPower = context.Powers.Where(p => p.Name == "CoreUserView").FirstOrDefault<Power>() |
||||
|
}, |
||||
|
new Menu |
||||
|
{ |
||||
|
Name = "职称管理", |
||||
|
SortIndex = 20, |
||||
|
Remark = "二级菜单", |
||||
|
NavigateUrl = "~/admin/title.aspx", |
||||
|
ImageUrl = "~/res/icon/tag_blue.png", |
||||
|
ViewPower = context.Powers.Where(p => p.Name == "CoreTitleView").FirstOrDefault<Power>() |
||||
|
}, |
||||
|
new Menu |
||||
|
{ |
||||
|
Name = "职称用户管理", |
||||
|
SortIndex = 30, |
||||
|
Remark = "二级菜单", |
||||
|
NavigateUrl = "~/admin/title_user.aspx", |
||||
|
ImageUrl = "~/res/icon/tag_blue.png", |
||||
|
ViewPower = context.Powers.Where(p => p.Name == "CoreTitleUserView").FirstOrDefault<Power>() |
||||
|
}, |
||||
|
new Menu |
||||
|
{ |
||||
|
Name = "部门管理", |
||||
|
SortIndex = 40, |
||||
|
Remark = "二级菜单", |
||||
|
NavigateUrl = "~/admin/dept.aspx", |
||||
|
ImageUrl = "~/res/icon/tag_blue.png", |
||||
|
ViewPower = context.Powers.Where(p => p.Name == "CoreDeptView").FirstOrDefault<Power>() |
||||
|
}, |
||||
|
new Menu |
||||
|
{ |
||||
|
Name = "部门用户管理", |
||||
|
SortIndex = 50, |
||||
|
Remark = "二级菜单", |
||||
|
NavigateUrl = "~/admin/dept_user.aspx", |
||||
|
ImageUrl = "~/res/icon/tag_blue.png", |
||||
|
ViewPower = context.Powers.Where(p => p.Name == "CoreDeptUserView").FirstOrDefault<Power>() |
||||
|
}, |
||||
|
new Menu |
||||
|
{ |
||||
|
Name = "角色管理", |
||||
|
SortIndex = 60, |
||||
|
Remark = "二级菜单", |
||||
|
NavigateUrl = "~/admin/role.aspx", |
||||
|
ImageUrl = "~/res/icon/tag_blue.png", |
||||
|
ViewPower = context.Powers.Where(p => p.Name == "CoreRoleView").FirstOrDefault<Power>() |
||||
|
}, |
||||
|
new Menu |
||||
|
{ |
||||
|
Name = "角色用户管理", |
||||
|
SortIndex = 70, |
||||
|
Remark = "二级菜单", |
||||
|
NavigateUrl = "~/admin/role_user.aspx", |
||||
|
ImageUrl = "~/res/icon/tag_blue.png", |
||||
|
ViewPower = context.Powers.Where(p => p.Name == "CoreRoleUserView").FirstOrDefault<Power>() |
||||
|
}, |
||||
|
new Menu |
||||
|
{ |
||||
|
Name = "权限管理", |
||||
|
SortIndex = 80, |
||||
|
Remark = "二级菜单", |
||||
|
NavigateUrl = "~/admin/power.aspx", |
||||
|
ImageUrl = "~/res/icon/tag_blue.png", |
||||
|
ViewPower = context.Powers.Where(p => p.Name == "CorePowerView").FirstOrDefault<Power>() |
||||
|
}, |
||||
|
new Menu |
||||
|
{ |
||||
|
Name = "角色权限管理", |
||||
|
SortIndex = 90, |
||||
|
Remark = "二级菜单", |
||||
|
NavigateUrl = "~/admin/role_power.aspx", |
||||
|
ImageUrl = "~/res/icon/tag_blue.png", |
||||
|
ViewPower = context.Powers.Where(p => p.Name == "CoreRolePowerView").FirstOrDefault<Power>() |
||||
|
}, |
||||
|
new Menu |
||||
|
{ |
||||
|
Name = "菜单管理", |
||||
|
SortIndex = 100, |
||||
|
Remark = "二级菜单", |
||||
|
NavigateUrl = "~/admin/menu.aspx", |
||||
|
ImageUrl = "~/res/icon/tag_blue.png", |
||||
|
ViewPower = context.Powers.Where(p => p.Name == "CoreMenuView").FirstOrDefault<Power>() |
||||
|
}, |
||||
|
new Menu |
||||
|
{ |
||||
|
Name = "在线统计", |
||||
|
SortIndex = 110, |
||||
|
Remark = "二级菜单", |
||||
|
NavigateUrl = "~/admin/online.aspx", |
||||
|
ImageUrl = "~/res/icon/tag_blue.png", |
||||
|
ViewPower = context.Powers.Where(p => p.Name == "CoreOnlineView").FirstOrDefault<Power>() |
||||
|
}, |
||||
|
new Menu |
||||
|
{ |
||||
|
Name = "系统配置", |
||||
|
SortIndex = 120, |
||||
|
Remark = "二级菜单", |
||||
|
NavigateUrl = "~/admin/config.aspx", |
||||
|
ImageUrl = "~/res/icon/tag_blue.png", |
||||
|
ViewPower = context.Powers.Where(p => p.Name == "CoreConfigView").FirstOrDefault<Power>() |
||||
|
}, |
||||
|
new Menu |
||||
|
{ |
||||
|
Name = "用户设置", |
||||
|
SortIndex = 130, |
||||
|
Remark = "二级菜单", |
||||
|
NavigateUrl = "~/admin/profile.aspx", |
||||
|
ImageUrl = "~/res/icon/tag_blue.png" |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
return menus; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
private static List<Title> GetTitles() |
||||
|
{ |
||||
|
var titles = new List<Title>() |
||||
|
{ |
||||
|
new Title() |
||||
|
{ |
||||
|
Name = "总经理" |
||||
|
}, |
||||
|
new Title() |
||||
|
{ |
||||
|
Name = "部门经理" |
||||
|
}, |
||||
|
new Title() |
||||
|
{ |
||||
|
Name = "高级工程师" |
||||
|
}, |
||||
|
new Title() |
||||
|
{ |
||||
|
Name = "工程师" |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
return titles; |
||||
|
} |
||||
|
|
||||
|
private static List<Power> GetPowers() |
||||
|
{ |
||||
|
var powers = new List<Power> |
||||
|
{ |
||||
|
new Power |
||||
|
{ |
||||
|
Name = "CoreUserView", |
||||
|
Title = "浏览用户列表", |
||||
|
GroupName = "CoreUser" |
||||
|
}, |
||||
|
new Power |
||||
|
{ |
||||
|
Name = "CoreUserNew", |
||||
|
Title = "新增用户", |
||||
|
GroupName = "CoreUser" |
||||
|
}, |
||||
|
new Power |
||||
|
{ |
||||
|
Name = "CoreUserEdit", |
||||
|
Title = "编辑用户", |
||||
|
GroupName = "CoreUser" |
||||
|
}, |
||||
|
new Power |
||||
|
{ |
||||
|
Name = "CoreUserDelete", |
||||
|
Title = "删除用户", |
||||
|
GroupName = "CoreUser" |
||||
|
}, |
||||
|
new Power |
||||
|
{ |
||||
|
Name = "CoreUserChangePassword", |
||||
|
Title = "修改用户登陆密码", |
||||
|
GroupName = "CoreUser" |
||||
|
}, |
||||
|
new Power |
||||
|
{ |
||||
|
Name = "CoreRoleView", |
||||
|
Title = "浏览角色列表", |
||||
|
GroupName = "CoreRole" |
||||
|
}, |
||||
|
new Power |
||||
|
{ |
||||
|
Name = "CoreRoleNew", |
||||
|
Title = "新增角色", |
||||
|
GroupName = "CoreRole" |
||||
|
}, |
||||
|
new Power |
||||
|
{ |
||||
|
Name = "CoreRoleEdit", |
||||
|
Title = "编辑角色", |
||||
|
GroupName = "CoreRole" |
||||
|
}, |
||||
|
new Power |
||||
|
{ |
||||
|
Name = "CoreRoleDelete", |
||||
|
Title = "删除角色", |
||||
|
GroupName = "CoreRole" |
||||
|
}, |
||||
|
new Power |
||||
|
{ |
||||
|
Name = "CoreRoleUserView", |
||||
|
Title = "浏览角色用户列表", |
||||
|
GroupName = "CoreRoleUser" |
||||
|
}, |
||||
|
new Power |
||||
|
{ |
||||
|
Name = "CoreRoleUserNew", |
||||
|
Title = "向角色添加用户", |
||||
|
GroupName = "CoreRoleUser" |
||||
|
}, |
||||
|
new Power |
||||
|
{ |
||||
|
Name = "CoreRoleUserDelete", |
||||
|
Title = "从角色中删除用户", |
||||
|
GroupName = "CoreRoleUser" |
||||
|
}, |
||||
|
new Power |
||||
|
{ |
||||
|
Name = "CoreOnlineView", |
||||
|
Title = "浏览在线用户列表", |
||||
|
GroupName = "CoreOnline" |
||||
|
}, |
||||
|
new Power |
||||
|
{ |
||||
|
Name = "CoreConfigView", |
||||
|
Title = "浏览全局配置参数", |
||||
|
GroupName = "CoreConfig" |
||||
|
}, |
||||
|
new Power |
||||
|
{ |
||||
|
Name = "CoreConfigEdit", |
||||
|
Title = "修改全局配置参数", |
||||
|
GroupName = "CoreConfig" |
||||
|
}, |
||||
|
new Power |
||||
|
{ |
||||
|
Name = "CoreMenuView", |
||||
|
Title = "浏览菜单列表", |
||||
|
GroupName = "CoreMenu" |
||||
|
}, |
||||
|
new Power |
||||
|
{ |
||||
|
Name = "CoreMenuNew", |
||||
|
Title = "新增菜单", |
||||
|
GroupName = "CoreMenu" |
||||
|
}, |
||||
|
new Power |
||||
|
{ |
||||
|
Name = "CoreMenuEdit", |
||||
|
Title = "编辑菜单", |
||||
|
GroupName = "CoreMenu" |
||||
|
}, |
||||
|
new Power |
||||
|
{ |
||||
|
Name = "CoreMenuDelete", |
||||
|
Title = "删除菜单", |
||||
|
GroupName = "CoreMenu" |
||||
|
}, |
||||
|
new Power |
||||
|
{ |
||||
|
Name = "CoreLogView", |
||||
|
Title = "浏览日志列表", |
||||
|
GroupName = "CoreLog" |
||||
|
}, |
||||
|
new Power |
||||
|
{ |
||||
|
Name = "CoreLogDelete", |
||||
|
Title = "删除日志", |
||||
|
GroupName = "CoreLog" |
||||
|
}, |
||||
|
new Power |
||||
|
{ |
||||
|
Name = "CoreTitleView", |
||||
|
Title = "浏览职务列表", |
||||
|
GroupName = "CoreTitle" |
||||
|
}, |
||||
|
new Power |
||||
|
{ |
||||
|
Name = "CoreTitleNew", |
||||
|
Title = "新增职务", |
||||
|
GroupName = "CoreTitle" |
||||
|
}, |
||||
|
new Power |
||||
|
{ |
||||
|
Name = "CoreTitleEdit", |
||||
|
Title = "编辑职务", |
||||
|
GroupName = "CoreTitle" |
||||
|
}, |
||||
|
new Power |
||||
|
{ |
||||
|
Name = "CoreTitleDelete", |
||||
|
Title = "删除职务", |
||||
|
GroupName = "CoreTitle" |
||||
|
}, |
||||
|
new Power |
||||
|
{ |
||||
|
Name = "CoreTitleUserView", |
||||
|
Title = "浏览职务用户列表", |
||||
|
GroupName = "CoreTitleUser" |
||||
|
}, |
||||
|
new Power |
||||
|
{ |
||||
|
Name = "CoreTitleUserNew", |
||||
|
Title = "向职务添加用户", |
||||
|
GroupName = "CoreTitleUser" |
||||
|
}, |
||||
|
new Power |
||||
|
{ |
||||
|
Name = "CoreTitleUserDelete", |
||||
|
Title = "从职务中删除用户", |
||||
|
GroupName = "CoreTitleUser" |
||||
|
}, |
||||
|
new Power |
||||
|
{ |
||||
|
Name = "CoreDeptView", |
||||
|
Title = "浏览部门列表", |
||||
|
GroupName = "CoreDept" |
||||
|
}, |
||||
|
new Power |
||||
|
{ |
||||
|
Name = "CoreDeptNew", |
||||
|
Title = "新增部门", |
||||
|
GroupName = "CoreDept" |
||||
|
}, |
||||
|
new Power |
||||
|
{ |
||||
|
Name = "CoreDeptEdit", |
||||
|
Title = "编辑部门", |
||||
|
GroupName = "CoreDept" |
||||
|
}, |
||||
|
new Power |
||||
|
{ |
||||
|
Name = "CoreDeptDelete", |
||||
|
Title = "删除部门", |
||||
|
GroupName = "CoreDept" |
||||
|
}, |
||||
|
new Power |
||||
|
{ |
||||
|
Name = "CoreDeptUserView", |
||||
|
Title = "浏览部门用户列表", |
||||
|
GroupName = "CoreDeptUser" |
||||
|
}, |
||||
|
new Power |
||||
|
{ |
||||
|
Name = "CoreDeptUserNew", |
||||
|
Title = "向部门添加用户", |
||||
|
GroupName = "CoreDeptUser" |
||||
|
}, |
||||
|
new Power |
||||
|
{ |
||||
|
Name = "CoreDeptUserDelete", |
||||
|
Title = "从部门中删除用户", |
||||
|
GroupName = "CoreDeptUser" |
||||
|
}, |
||||
|
new Power |
||||
|
{ |
||||
|
Name = "CorePowerView", |
||||
|
Title = "浏览权限列表", |
||||
|
GroupName = "CorePower" |
||||
|
}, |
||||
|
new Power |
||||
|
{ |
||||
|
Name = "CorePowerNew", |
||||
|
Title = "新增权限", |
||||
|
GroupName = "CorePower" |
||||
|
}, |
||||
|
new Power |
||||
|
{ |
||||
|
Name = "CorePowerEdit", |
||||
|
Title = "编辑权限", |
||||
|
GroupName = "CorePower" |
||||
|
}, |
||||
|
new Power |
||||
|
{ |
||||
|
Name = "CorePowerDelete", |
||||
|
Title = "删除权限", |
||||
|
GroupName = "CorePower" |
||||
|
}, |
||||
|
new Power |
||||
|
{ |
||||
|
Name = "CoreRolePowerView", |
||||
|
Title = "浏览角色权限列表", |
||||
|
GroupName = "CoreRolePower" |
||||
|
}, |
||||
|
new Power |
||||
|
{ |
||||
|
Name = "CoreRolePowerEdit", |
||||
|
Title = "编辑角色权限", |
||||
|
GroupName = "CoreRolePower" |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
return powers; |
||||
|
} |
||||
|
|
||||
|
private static List<Role> GetRoles() |
||||
|
{ |
||||
|
var roles = new List<Role>() |
||||
|
{ |
||||
|
new Role() |
||||
|
{ |
||||
|
Name = "系统管理员", |
||||
|
Remark = "" |
||||
|
}, |
||||
|
new Role() |
||||
|
{ |
||||
|
Name = "部门管理员", |
||||
|
Remark = "" |
||||
|
}, |
||||
|
new Role() |
||||
|
{ |
||||
|
Name = "项目经理", |
||||
|
Remark = "" |
||||
|
}, |
||||
|
new Role() |
||||
|
{ |
||||
|
Name = "开发经理", |
||||
|
Remark = "" |
||||
|
}, |
||||
|
new Role() |
||||
|
{ |
||||
|
Name = "开发人员", |
||||
|
Remark = "" |
||||
|
}, |
||||
|
new Role() |
||||
|
{ |
||||
|
Name = "后勤人员", |
||||
|
Remark = "" |
||||
|
}, |
||||
|
new Role() |
||||
|
{ |
||||
|
Name = "外包人员", |
||||
|
Remark = "" |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
return roles; |
||||
|
} |
||||
|
|
||||
|
private static List<User> GetUsers() |
||||
|
{ |
||||
|
string[] USER_NAMES = { "男", "童光喜", "男", "方原柏", "女", "祝春亚", "男", "涂辉", "男", "舒兆国", "男", "熊忠文", "男", "徐吉琳", "男", "方金海", "男", "包卫峰", "女", "靖小燕", "男", "杨习斌", "男", "徐长旺", "男", "聂建雄", "男", "周敦友", "男", "陈友庭", "女", "陆静芳", "男", "袁国柱", "女", "骆新桂", "男", "许治国", "男", "马先加", "男", "赵恢川", "男", "柯常胜", "男", "黄国鹏", "男", "柯尊北", "男", "刘海云", "男", "罗清波", "男", "张业权", "女", "丁溯鋆", "男", "吴俊", "男", "郑江", "男", "李亚华", "男", "石光富", "男", "谭志洪", "男", "胡中生", "男", "董龙剑", "男", "陈红", "男", "汪海平", "男", "彭道洲", "女", "尹莉君", "男", "占耀玲", "男", "付杰", "男", "王红艳", "男", "邝兴", "男", "饶玮", "男", "王方胜", "男", "陈劲松", "男", "邓庆华", "男", "王石林", "男", "胡俊明", "男", "索相龙", "男", "陈海军", "男", "吴文涛", "女", "熊望梅", "女", "段丽华", "女", "胡莎莎", "男", "徐友安", "男", "肖诗涛", "男", "王闯", "男", "余兴龙", "男", "芦荫杰", "男", "丁金富", "男", "谭军令", "女", "鄢旭燕", "男", "田坤", "男", "夏德胜", "男", "喻显发", "男", "马兴宝", "男", "孙学涛", "男", "陶云成", "男", "马远健", "男", "田华", "男", "聂子森", "男", "郑永军", "男", "余昌平", "男", "陶俊华", "男", "李小林", "男", "李荣宝", "男", "梅盈凯", "男", "张元群", "男", "郝新华", "男", "刘红涛", "男", "向志强", "男", "伍小峰", "男", "胡勇民", "男", "黄定祥", "女", "高红香", "男", "刘军", "男", "叶松", "男", "易俊林", "男", "张威", "男", "刘卫华", "男", "李浩", "男", "李寿庚", "男", "涂洋", "男", "曹晶", "男", "陈辉", "女", "彭博", "男", "严雪冰", "男", "刘青", "女", "印媛", "男", "吴道雄", "男", "邓旻", "男", "陈骏", "男", "崔波", "男", "韩静颐", "男", "严安勇", "男", "刘攀", "女", "刘艳", "女", "孙昕", "女", "郑新", "女", "徐睿", "女", "李月杰", "男", "吕焱鑫", "女", "刘沈", "男", "朱绍军", "女", "马茜", "女", "唐蕾", "女", "刘姣", "女", "于芳", "男", "吴健", "女", "张丹梅", "女", "王燕", "女", "贾兆梅", "男", "程柏漠", "男", "程辉", "女", "任明慧", "女", "焦莹", "女", "马淑娟", "男", "徐涛", "男", "孙庆国", "男", "刘胜", "女", "傅广凤", "男", "袁弘", "男", "高令旭", "男", "栾树权", "女", "申霞", "女", "韩文萍", "女", "隋艳", "男", "邢海洲", "女", "王宁", "女", "陈晶", "女", "吕翠", "女", "刘少敏", "女", "刘少君", "男", "孔鹏", "女", "张冰", "女", "王芳", "男", "万世忠", "女", "徐凡", "女", "张玉梅", "女", "何莉", "女", "时会云", "女", "王玉杰", "女", "谭素英", "女", "李艳红", "女", "刘素莉", "男", "王旭海", "女", "安丽梅", "女", "姚露", "女", "贾颖", "女", "曹微", "男", "黄经华", "女", "陈玉华", "女", "姜媛", "女", "魏立平", "女", "张萍", "男", "来辉", "女", "陈秀玫", "男", "石岩", "男", "王洪捍", "男", "张树军", "女", "李亚琴", "女", "王凤", "女", "王珊华", "女", "杨丹丹", "女", "教黎明", "女", "修晶", "女", "丁晓霞", "女", "张丽", "女", "郭素兰", "女", "徐艳丽", "女", "任子英", "女", "胡雁", "女", "彭洪亮", "女", "高玉珍", "女", "王玉姝", "男", "郑伟", "女", "姜春玲", "女", "张伟", "女", "王颖", "女", "金萍", "男", "孙望", "男", "闫宝东", "男", "周相永", "女", "杨美娜", "女", "欧立新", "女", "刘宝霞", "女", "刘艳杰", "女", "宋艳平", "男", "李克", "女", "梁翠", "女", "宗宏伟", "女", "刘国伟", "女", "敖志敏", "女", "尹玲" }; |
||||
|
string[] EMAIL_NAMES = { "qq.com", "gmail.com", "163.com", "126.com", "outlook.com", "foxmail.com" }; |
||||
|
|
||||
|
var users = new List<User>(); |
||||
|
var rdm = new Random(); |
||||
|
|
||||
|
for (int i = 0, count = USER_NAMES.Length; i < count; i += 2) |
||||
|
{ |
||||
|
string gender = USER_NAMES[i]; |
||||
|
string chineseName = USER_NAMES[i + 1]; |
||||
|
string userName = "user" + i.ToString(); |
||||
|
|
||||
|
users.Add(new User |
||||
|
{ |
||||
|
Name = userName, |
||||
|
Gender = gender, |
||||
|
Password = PasswordUtil.CreateDbPassword(userName), |
||||
|
ChineseName = chineseName, |
||||
|
Email = userName + "@" + EMAIL_NAMES[rdm.Next(0, EMAIL_NAMES.Length)], |
||||
|
Enabled = true, |
||||
|
CreateTime = DateTime.Now |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
// 添加超级管理员
|
||||
|
users.Add(new User |
||||
|
{ |
||||
|
Name = "admin", |
||||
|
Gender = "男", |
||||
|
Password = PasswordUtil.CreateDbPassword("admin"), |
||||
|
ChineseName = "超级管理员", |
||||
|
Email = "admin@examples.com", |
||||
|
Enabled = true, |
||||
|
CreateTime = DateTime.Now |
||||
|
}); |
||||
|
|
||||
|
return users; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
private static List<Dept> GetDepts() |
||||
|
{ |
||||
|
var depts = new List<Dept> { |
||||
|
new Dept |
||||
|
{ |
||||
|
Name = "研发部", |
||||
|
SortIndex = 1, |
||||
|
Remark = "顶级部门", |
||||
|
Children = new List<Dept> { |
||||
|
new Dept |
||||
|
{ |
||||
|
Name = "开发部", |
||||
|
SortIndex = 1, |
||||
|
Remark = "二级部门" |
||||
|
}, |
||||
|
new Dept |
||||
|
{ |
||||
|
Name = "测试部", |
||||
|
SortIndex = 2, |
||||
|
Remark = "二级部门" |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
new Dept |
||||
|
{ |
||||
|
Name = "销售部", |
||||
|
SortIndex = 2, |
||||
|
Remark = "顶级部门", |
||||
|
Children = new List<Dept> { |
||||
|
new Dept |
||||
|
{ |
||||
|
Name = "直销部", |
||||
|
SortIndex = 1, |
||||
|
Remark = "二级部门" |
||||
|
}, |
||||
|
new Dept |
||||
|
{ |
||||
|
Name = "渠道部", |
||||
|
SortIndex = 2, |
||||
|
Remark = "二级部门" |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
new Dept |
||||
|
{ |
||||
|
Name = "客服部", |
||||
|
SortIndex = 3, |
||||
|
Remark = "顶级部门", |
||||
|
Children = new List<Dept> { |
||||
|
new Dept |
||||
|
{ |
||||
|
Name = "实施部", |
||||
|
SortIndex = 1, |
||||
|
Remark = "二级部门" |
||||
|
}, |
||||
|
new Dept |
||||
|
{ |
||||
|
Name = "售后服务部", |
||||
|
SortIndex = 2, |
||||
|
Remark = "二级部门" |
||||
|
}, |
||||
|
new Dept |
||||
|
{ |
||||
|
Name = "大客户服务部", |
||||
|
SortIndex = 3, |
||||
|
Remark = "二级部门" |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
new Dept |
||||
|
{ |
||||
|
Name = "财务部", |
||||
|
SortIndex = 4, |
||||
|
Remark = "顶级部门" |
||||
|
}, |
||||
|
new Dept |
||||
|
{ |
||||
|
Name = "行政部", |
||||
|
SortIndex = 5, |
||||
|
Remark = "顶级部门", |
||||
|
Children = new List<Dept> { |
||||
|
new Dept |
||||
|
{ |
||||
|
Name = "人事部", |
||||
|
SortIndex = 1, |
||||
|
Remark = "二级部门" |
||||
|
}, |
||||
|
new Dept |
||||
|
{ |
||||
|
Name = "后勤部", |
||||
|
SortIndex = 2, |
||||
|
Remark = "二级部门" |
||||
|
}, |
||||
|
new Dept |
||||
|
{ |
||||
|
Name = "运输部", |
||||
|
SortIndex = 3, |
||||
|
Remark = "二级部门", |
||||
|
Children = new List<Dept>{ |
||||
|
new Dept{ |
||||
|
Name = "省内运输部", |
||||
|
SortIndex = 1, |
||||
|
Remark = "三级部门", |
||||
|
}, |
||||
|
new Dept{ |
||||
|
Name = "国内运输部", |
||||
|
SortIndex = 2, |
||||
|
Remark = "三级部门", |
||||
|
}, |
||||
|
new Dept{ |
||||
|
Name = "国际运输部", |
||||
|
SortIndex = 3, |
||||
|
Remark = "三级部门", |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
return depts; |
||||
|
} |
||||
|
|
||||
|
private static List<Config> GetConfigs() |
||||
|
{ |
||||
|
var configs = new List<Config> { |
||||
|
new Config |
||||
|
{ |
||||
|
ConfigKey = "Title", |
||||
|
ConfigValue = "AppBox - 通用权限管理框架", |
||||
|
Remark = "网站的标题" |
||||
|
}, |
||||
|
new Config |
||||
|
{ |
||||
|
ConfigKey = "PageSize", |
||||
|
ConfigValue = "20", |
||||
|
Remark = "表格每页显示的个数" |
||||
|
}, |
||||
|
new Config |
||||
|
{ |
||||
|
ConfigKey = "MenuType", |
||||
|
ConfigValue = "tree", |
||||
|
Remark = "左侧菜单样式" |
||||
|
}, |
||||
|
new Config |
||||
|
{ |
||||
|
ConfigKey = "Theme", |
||||
|
ConfigValue = "Neptune", |
||||
|
Remark = "网站主题" |
||||
|
}, |
||||
|
new Config |
||||
|
{ |
||||
|
ConfigKey = "HelpList", |
||||
|
ConfigValue = "[{\"Text\":\"万年历\",\"Icon\":\"Calendar\",\"ID\":\"wannianli\",\"URL\":\"~/admin/help/wannianli.htm\"},{\"Text\":\"科学计算器\",\"Icon\":\"Calculator\",\"ID\":\"jisuanqi\",\"URL\":\"~/admin/help/jisuanqi.htm\"},{\"Text\":\"系统帮助\",\"Icon\":\"Help\",\"ID\":\"help\",\"URL\":\"~/admin/help/help.htm\"}]", |
||||
|
Remark = "帮助下拉列表的JSON字符串" |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
return configs; |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,19 @@ |
|||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
|
||||
|
namespace CK.SCP.Models.AppBoxEntity |
||||
|
{ |
||||
|
public class Config : IKeyID |
||||
|
{ |
||||
|
[Key] |
||||
|
public int ID { get; set; } |
||||
|
|
||||
|
[Required, StringLength(50)] |
||||
|
public string ConfigKey { get; set; } |
||||
|
|
||||
|
[Required, StringLength(4000)] |
||||
|
public string ConfigValue { get; set; } |
||||
|
|
||||
|
[StringLength(500)] |
||||
|
public string Remark { get; set; } |
||||
|
} |
||||
|
} |
@ -0,0 +1,67 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using System.ComponentModel.DataAnnotations.Schema; |
||||
|
|
||||
|
namespace CK.SCP.Models.AppBoxEntity |
||||
|
{ |
||||
|
public class Dept : ICustomTree, IKeyID, ICloneable |
||||
|
{ |
||||
|
[Key] |
||||
|
public int ID { get; set; } |
||||
|
|
||||
|
[Required, StringLength(50)] |
||||
|
public string Name { get; set; } |
||||
|
|
||||
|
[Required] |
||||
|
public int SortIndex { get; set; } |
||||
|
|
||||
|
[StringLength(500)] |
||||
|
public string Remark { get; set; } |
||||
|
|
||||
|
|
||||
|
|
||||
|
public virtual Dept Parent { get; set; } |
||||
|
public virtual ICollection<Dept> Children { get; set; } |
||||
|
|
||||
|
|
||||
|
public virtual ICollection<User> Users { get; set; } |
||||
|
|
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 菜单在树形结构中的层级(从0开始)
|
||||
|
/// </summary>
|
||||
|
[NotMapped] |
||||
|
public int TreeLevel { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 是否可用(默认true),在模拟树的下拉列表中使用
|
||||
|
/// </summary>
|
||||
|
[NotMapped] |
||||
|
public bool Enabled { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 是否叶子节点(默认true)
|
||||
|
/// </summary>
|
||||
|
[NotMapped] |
||||
|
public bool IsTreeLeaf { get; set; } |
||||
|
|
||||
|
|
||||
|
public object Clone() |
||||
|
{ |
||||
|
Dept dept = new Dept |
||||
|
{ |
||||
|
ID = ID, |
||||
|
Name = Name, |
||||
|
Remark = Remark, |
||||
|
SortIndex = SortIndex, |
||||
|
TreeLevel = TreeLevel, |
||||
|
Enabled = Enabled, |
||||
|
IsTreeLeaf = IsTreeLeaf |
||||
|
}; |
||||
|
return dept; |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,25 @@ |
|||||
|
namespace CK.SCP.Models.AppBoxEntity |
||||
|
{ |
||||
|
public interface ICustomTree |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 名称
|
||||
|
/// </summary>
|
||||
|
string Name { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 菜单在树形结构中的层级(从0开始)
|
||||
|
/// </summary>
|
||||
|
int TreeLevel { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 是否可用(默认true),在模拟树的下拉列表中使用
|
||||
|
/// </summary>
|
||||
|
bool Enabled { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 是否叶子节点(默认true)
|
||||
|
/// </summary>
|
||||
|
bool IsTreeLeaf { get; set; } |
||||
|
} |
||||
|
} |
@ -0,0 +1,8 @@ |
|||||
|
namespace CK.SCP.Models.AppBoxEntity |
||||
|
{ |
||||
|
public interface IKeyID |
||||
|
{ |
||||
|
int ID { get; set; } |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,26 @@ |
|||||
|
using System; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
|
||||
|
namespace CK.SCP.Models.AppBoxEntity |
||||
|
{ |
||||
|
public class Log : IKeyID |
||||
|
{ |
||||
|
[Key] |
||||
|
public int ID { get; set; } |
||||
|
|
||||
|
[StringLength(20)] |
||||
|
public string Level { get; set; } |
||||
|
|
||||
|
[StringLength(200)] |
||||
|
public string Logger { get; set; } |
||||
|
|
||||
|
[StringLength(4000)] |
||||
|
public string Message { get; set; } |
||||
|
|
||||
|
[StringLength(4000)] |
||||
|
public string Exception { get; set; } |
||||
|
|
||||
|
public DateTime LogTime { get; set; } |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,74 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using System.ComponentModel.DataAnnotations.Schema; |
||||
|
|
||||
|
namespace CK.SCP.Models.AppBoxEntity |
||||
|
{ |
||||
|
public class Menu : ICustomTree, IKeyID, ICloneable |
||||
|
{ |
||||
|
[Key] |
||||
|
public int ID { get; set; } |
||||
|
|
||||
|
[Required, StringLength(50)] |
||||
|
public string Name { get; set; } |
||||
|
|
||||
|
[StringLength(200)] |
||||
|
public string ImageUrl { get; set; } |
||||
|
|
||||
|
[StringLength(200)] |
||||
|
public string NavigateUrl { get; set; } |
||||
|
|
||||
|
[StringLength(500)] |
||||
|
public string Remark { get; set; } |
||||
|
|
||||
|
[Required] |
||||
|
public int SortIndex { get; set; } |
||||
|
|
||||
|
|
||||
|
public virtual Menu Parent { get; set; } |
||||
|
public virtual ICollection<Menu> Children { get; set; } |
||||
|
|
||||
|
|
||||
|
|
||||
|
public virtual Power ViewPower {get; set;} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 菜单在树形结构中的层级(从0开始)
|
||||
|
/// </summary>
|
||||
|
[NotMapped] |
||||
|
public int TreeLevel { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 是否可用(默认true),在模拟树的下拉列表中使用
|
||||
|
/// </summary>
|
||||
|
[NotMapped] |
||||
|
public bool Enabled { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 是否叶子节点(默认true)
|
||||
|
/// </summary>
|
||||
|
[NotMapped] |
||||
|
public bool IsTreeLeaf { get; set; } |
||||
|
|
||||
|
|
||||
|
public object Clone() |
||||
|
{ |
||||
|
Menu menu = new Menu { |
||||
|
ID = ID, |
||||
|
Name = Name, |
||||
|
ImageUrl = ImageUrl, |
||||
|
NavigateUrl = NavigateUrl, |
||||
|
Remark = Remark, |
||||
|
SortIndex = SortIndex, |
||||
|
TreeLevel = TreeLevel, |
||||
|
Enabled = Enabled, |
||||
|
IsTreeLeaf = IsTreeLeaf |
||||
|
}; |
||||
|
return menu; |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,23 @@ |
|||||
|
using System; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
|
||||
|
namespace CK.SCP.Models.AppBoxEntity |
||||
|
{ |
||||
|
public class Online : IKeyID |
||||
|
{ |
||||
|
[Key] |
||||
|
public int ID { get; set; } |
||||
|
|
||||
|
[StringLength(50)] |
||||
|
public string IPAdddress { get; set; } |
||||
|
|
||||
|
public DateTime LoginTime { get; set; } |
||||
|
|
||||
|
public DateTime? UpdateTime { get; set; } |
||||
|
|
||||
|
|
||||
|
public virtual User User { get; set; } |
||||
|
|
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,119 @@ |
|||||
|
using System; |
||||
|
using System.Security.Cryptography; |
||||
|
|
||||
|
namespace CK.SCP.Models.AppBoxEntity |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 单相混淆加密用户密码,并比较密码是否一致的类
|
||||
|
/// </summary>
|
||||
|
public class PasswordUtil |
||||
|
{ |
||||
|
#region field & constructor
|
||||
|
|
||||
|
//private static readonly Log _log = new Log(typeof(PasswordUtil));
|
||||
|
|
||||
|
private const int saltLength = 4; |
||||
|
|
||||
|
public PasswordUtil() { } |
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 对比用户明文密码是否和加密后密码一致
|
||||
|
/// </summary>
|
||||
|
/// <param name="dbPassword">数据库中单向加密后的密码</param>
|
||||
|
/// <param name="userPassword">用户明文密码</param>
|
||||
|
/// <returns></returns>
|
||||
|
public static bool ComparePasswords(string dbPassword,string userPassword) |
||||
|
{ |
||||
|
byte[] dbPwd = Convert.FromBase64String(dbPassword); |
||||
|
|
||||
|
byte[] hashedPwd = HashString(userPassword); |
||||
|
|
||||
|
if(dbPwd.Length ==0 || hashedPwd.Length ==0 || dbPwd.Length !=hashedPwd.Length + saltLength) |
||||
|
{ |
||||
|
return false; |
||||
|
} |
||||
|
|
||||
|
byte[] saltValue = new byte[saltLength]; |
||||
|
// int saltOffset = dbPwd.Length - hashedPwd.Length;
|
||||
|
int saltOffset = hashedPwd.Length; |
||||
|
for (int i = 0; i < saltLength; i++) |
||||
|
saltValue[i] = dbPwd[saltOffset + i]; |
||||
|
|
||||
|
byte[] saltedPassword = CreateSaltedPassword(saltValue, hashedPwd); |
||||
|
|
||||
|
// compare the values
|
||||
|
return CompareByteArray(dbPwd, saltedPassword); |
||||
|
|
||||
|
|
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 创建用户的数据库密码
|
||||
|
/// </summary>
|
||||
|
/// <param name="password"></param>
|
||||
|
/// <returns></returns>
|
||||
|
public static string CreateDbPassword(string userPassword) |
||||
|
{ |
||||
|
byte[] unsaltedPassword = HashString(userPassword); |
||||
|
|
||||
|
//Create a salt value
|
||||
|
byte[] saltValue = new byte[saltLength]; |
||||
|
RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider(); |
||||
|
rng.GetBytes(saltValue); |
||||
|
|
||||
|
byte[] saltedPassword = CreateSaltedPassword(saltValue, unsaltedPassword); |
||||
|
|
||||
|
return Convert.ToBase64String(saltedPassword); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
#region 私有函数
|
||||
|
/// <summary>
|
||||
|
/// 将一个字符串哈希化
|
||||
|
/// </summary>
|
||||
|
/// <param name="str"></param>
|
||||
|
/// <returns></returns>
|
||||
|
private static byte[] HashString(string str) |
||||
|
{ |
||||
|
byte[] pwd = System.Text.Encoding.UTF8.GetBytes(str); |
||||
|
|
||||
|
SHA1 sha1 = SHA1.Create(); |
||||
|
byte[] saltedPassword = sha1.ComputeHash(pwd); |
||||
|
return saltedPassword; |
||||
|
} |
||||
|
private static bool CompareByteArray(byte[] array1, byte[] array2) |
||||
|
{ |
||||
|
if (array1.Length != array2.Length) |
||||
|
return false; |
||||
|
for (int i = 0; i < array1.Length; i++) |
||||
|
{ |
||||
|
if (array1[i] != array2[i]) |
||||
|
return false; |
||||
|
} |
||||
|
return true; |
||||
|
} |
||||
|
// create a salted password given the salt value
|
||||
|
private static byte[] CreateSaltedPassword(byte[] saltValue, byte[] unsaltedPassword) |
||||
|
{ |
||||
|
// add the salt to the hash
|
||||
|
byte[] rawSalted = new byte[unsaltedPassword.Length + saltValue.Length]; |
||||
|
unsaltedPassword.CopyTo(rawSalted,0); |
||||
|
saltValue.CopyTo(rawSalted,unsaltedPassword.Length); |
||||
|
|
||||
|
//Create the salted hash
|
||||
|
SHA1 sha1 = SHA1.Create(); |
||||
|
byte[] saltedPassword = sha1.ComputeHash(rawSalted); |
||||
|
|
||||
|
// add the salt value to the salted hash
|
||||
|
byte[] dbPassword = new byte[saltedPassword.Length + saltValue.Length]; |
||||
|
saltedPassword.CopyTo(dbPassword,0); |
||||
|
saltValue.CopyTo(dbPassword,saltedPassword.Length); |
||||
|
|
||||
|
return dbPassword; |
||||
|
} |
||||
|
#endregion
|
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,27 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
|
||||
|
namespace CK.SCP.Models.AppBoxEntity |
||||
|
{ |
||||
|
public class Power : IKeyID |
||||
|
{ |
||||
|
[Key] |
||||
|
public int ID { get; set; } |
||||
|
|
||||
|
[Required, StringLength(50)] |
||||
|
public string Name { get; set; } |
||||
|
|
||||
|
[StringLength(50)] |
||||
|
public string GroupName { get; set; } |
||||
|
|
||||
|
[StringLength(200)] |
||||
|
public string Title { get; set; } |
||||
|
|
||||
|
[StringLength(500)] |
||||
|
public string Remark { get; set; } |
||||
|
|
||||
|
|
||||
|
public virtual ICollection<Role> Roles { get; set; } |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,24 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
|
||||
|
namespace CK.SCP.Models.AppBoxEntity |
||||
|
{ |
||||
|
public class Role : IKeyID |
||||
|
{ |
||||
|
[Key] |
||||
|
public int ID { get; set; } |
||||
|
|
||||
|
[Required, StringLength(50)] |
||||
|
public string Name { get; set; } |
||||
|
|
||||
|
[StringLength(500)] |
||||
|
public string Remark { get; set; } |
||||
|
|
||||
|
|
||||
|
public virtual ICollection<User> Users { get; set; } |
||||
|
|
||||
|
|
||||
|
public virtual ICollection<Power> Powers { get; set; } |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,23 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
|
||||
|
namespace CK.SCP.Models.AppBoxEntity |
||||
|
{ |
||||
|
public class Title : IKeyID |
||||
|
{ |
||||
|
[Key] |
||||
|
public int ID { get; set; } |
||||
|
|
||||
|
[Required, StringLength(50)] |
||||
|
public string Name { get; set; } |
||||
|
|
||||
|
[StringLength(500)] |
||||
|
public string Remark { get; set; } |
||||
|
|
||||
|
|
||||
|
public virtual ICollection<User> Users { get; set; } |
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,85 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using System.ComponentModel.DataAnnotations.Schema; |
||||
|
|
||||
|
namespace CK.SCP.Models.AppBoxEntity |
||||
|
{ |
||||
|
public class User : IKeyID |
||||
|
{ |
||||
|
[Key] |
||||
|
public int ID { get; set; } |
||||
|
|
||||
|
[Required, StringLength(50)] |
||||
|
public string Name { get; set; } |
||||
|
|
||||
|
[Required, StringLength(100)] |
||||
|
public string Email { get; set; } |
||||
|
|
||||
|
[Required, StringLength(50)] |
||||
|
public string Password { get; set; } |
||||
|
|
||||
|
[Required] |
||||
|
public bool Enabled { get; set; } |
||||
|
|
||||
|
[StringLength(10)] |
||||
|
public string Gender { get; set; } |
||||
|
|
||||
|
[StringLength(100)] |
||||
|
public string ChineseName { get; set; } |
||||
|
|
||||
|
[StringLength(100)] |
||||
|
public string EnglishName { get; set; } |
||||
|
|
||||
|
[StringLength(200)] |
||||
|
public string Photo { get; set; } |
||||
|
|
||||
|
[StringLength(50)] |
||||
|
public string QQ { get; set; } |
||||
|
|
||||
|
[StringLength(100)] |
||||
|
public string CompanyEmail { get; set; } |
||||
|
|
||||
|
[StringLength(50)] |
||||
|
public string OfficePhone { get; set; } |
||||
|
|
||||
|
[StringLength(50)] |
||||
|
public string OfficePhoneExt { get; set; } |
||||
|
|
||||
|
[StringLength(50)] |
||||
|
public string HomePhone { get; set; } |
||||
|
|
||||
|
[StringLength(50)] |
||||
|
public string CellPhone { get; set; } |
||||
|
|
||||
|
[StringLength(500)] |
||||
|
public string Address { get; set; } |
||||
|
|
||||
|
[StringLength(500)] |
||||
|
public string Remark { get; set; } |
||||
|
|
||||
|
[StringLength(500)] |
||||
|
public string SupplierCode { get; set; } |
||||
|
|
||||
|
[NotMapped] |
||||
|
[StringLength(500)] |
||||
|
public string VendName { get; set; } |
||||
|
|
||||
|
[StringLength(50)] |
||||
|
public string IdentityCard { get; set; } |
||||
|
|
||||
|
|
||||
|
public DateTime? Birthday { get; set; } |
||||
|
public DateTime? TakeOfficeTime { get; set; } |
||||
|
public DateTime? LastLoginTime { get; set; } |
||||
|
public DateTime? CreateTime { get; set; } |
||||
|
|
||||
|
|
||||
|
|
||||
|
public virtual ICollection<Role> Roles { get; set; } |
||||
|
public virtual ICollection<Title> Titles { get; set; } |
||||
|
|
||||
|
public virtual Dept Dept { get; set; } |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,252 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> |
||||
|
<PropertyGroup> |
||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
||||
|
<ProjectGuid>{DD7C0DEF-71E7-443F-B0B7-DB2F5B12A506}</ProjectGuid> |
||||
|
<OutputType>Library</OutputType> |
||||
|
<AppDesignerFolder>Properties</AppDesignerFolder> |
||||
|
<RootNamespace>CK.SCP.Models</RootNamespace> |
||||
|
<AssemblyName>CK.SCP.Models</AssemblyName> |
||||
|
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> |
||||
|
<FileAlignment>512</FileAlignment> |
||||
|
</PropertyGroup> |
||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
||||
|
<DebugSymbols>true</DebugSymbols> |
||||
|
<DebugType>full</DebugType> |
||||
|
<Optimize>false</Optimize> |
||||
|
<OutputPath>..\DLL\</OutputPath> |
||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants> |
||||
|
<ErrorReport>prompt</ErrorReport> |
||||
|
<WarningLevel>4</WarningLevel> |
||||
|
</PropertyGroup> |
||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
||||
|
<DebugType>pdbonly</DebugType> |
||||
|
<Optimize>true</Optimize> |
||||
|
<OutputPath>bin\Release\</OutputPath> |
||||
|
<DefineConstants>TRACE</DefineConstants> |
||||
|
<ErrorReport>prompt</ErrorReport> |
||||
|
<WarningLevel>4</WarningLevel> |
||||
|
</PropertyGroup> |
||||
|
<ItemGroup> |
||||
|
<Reference Include="EntityFramework"> |
||||
|
<HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll</HintPath> |
||||
|
</Reference> |
||||
|
<Reference Include="EntityFramework.SqlServer"> |
||||
|
<HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll</HintPath> |
||||
|
</Reference> |
||||
|
<Reference Include="Newtonsoft.Json"> |
||||
|
<HintPath>..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath> |
||||
|
</Reference> |
||||
|
<Reference Include="System" /> |
||||
|
<Reference Include="System.ComponentModel.DataAnnotations" /> |
||||
|
<Reference Include="System.Core" /> |
||||
|
<Reference Include="System.Xml.Linq" /> |
||||
|
<Reference Include="System.Data.DataSetExtensions" /> |
||||
|
<Reference Include="Microsoft.CSharp" /> |
||||
|
<Reference Include="System.Data" /> |
||||
|
<Reference Include="System.Net.Http" /> |
||||
|
<Reference Include="System.Xml" /> |
||||
|
</ItemGroup> |
||||
|
<ItemGroup> |
||||
|
<Compile Include="AppBoxEntity\AppBoxContext.cs" /> |
||||
|
<Compile Include="AppBoxEntity\AppBoxDatabaseInitializer.cs" /> |
||||
|
<Compile Include="AppBoxEntity\Config.cs" /> |
||||
|
<Compile Include="AppBoxEntity\Dept.cs" /> |
||||
|
<Compile Include="AppBoxEntity\ICustomTree.cs" /> |
||||
|
<Compile Include="AppBoxEntity\IKeyID.cs" /> |
||||
|
<Compile Include="AppBoxEntity\Log.cs" /> |
||||
|
<Compile Include="AppBoxEntity\Menu.cs" /> |
||||
|
<Compile Include="AppBoxEntity\Online.cs" /> |
||||
|
<Compile Include="AppBoxEntity\PasswordUtil.cs" /> |
||||
|
<Compile Include="AppBoxEntity\Power.cs" /> |
||||
|
<Compile Include="AppBoxEntity\Role.cs" /> |
||||
|
<Compile Include="AppBoxEntity\Title.cs" /> |
||||
|
<Compile Include="AppBoxEntity\User.cs" /> |
||||
|
<Compile Include="DbSetting.cs" /> |
||||
|
<Compile Include="EntitiesFactory.cs" /> |
||||
|
<Compile Include="EntitiesHelper.cs" /> |
||||
|
<Compile Include="Enums\BillType.cs" /> |
||||
|
<Compile Include="Enums\CollectionStepFinish.cs" /> |
||||
|
<Compile Include="Enums\ControlType.cs" /> |
||||
|
<Compile Include="Enums\DataBaseType.cs" /> |
||||
|
<Compile Include="Enums\DataState.cs" /> |
||||
|
<Compile Include="Enums\EquipmentState.cs" /> |
||||
|
<Compile Include="Enums\ErpInterfaceType.cs" /> |
||||
|
<Compile Include="Enums\GroupType.cs" /> |
||||
|
<Compile Include="Enums\InspectionType.cs" /> |
||||
|
<Compile Include="Enums\InspectType.cs" /> |
||||
|
<Compile Include="Enums\InventoryState.cs" /> |
||||
|
<Compile Include="Enums\InvoiceState.cs" /> |
||||
|
<Compile Include="Enums\LocType.cs" /> |
||||
|
<Compile Include="Enums\LoginState.cs" /> |
||||
|
<Compile Include="Enums\LogType.cs" /> |
||||
|
<Compile Include="Enums\ManageType.cs" /> |
||||
|
<Compile Include="Enums\ManufactureProcedureType.cs" /> |
||||
|
<Compile Include="Enums\NotifyType.cs" /> |
||||
|
<Compile Include="Enums\OperateType.cs" /> |
||||
|
<Compile Include="Enums\PartKind.cs" /> |
||||
|
<Compile Include="Enums\PartState.cs" /> |
||||
|
<Compile Include="Enums\PartType.cs" /> |
||||
|
<Compile Include="Enums\PlanDayState.cs" /> |
||||
|
<Compile Include="Enums\PlanState.cs" /> |
||||
|
<Compile Include="Enums\PortalType.cs" /> |
||||
|
<Compile Include="Enums\PrintType.cs" /> |
||||
|
<Compile Include="Enums\Project.cs" /> |
||||
|
<Compile Include="Enums\ProjectName.cs" /> |
||||
|
<Compile Include="Enums\ReceiveBillType.cs" /> |
||||
|
<Compile Include="Enums\ReceiveState.cs" /> |
||||
|
<Compile Include="Enums\ResultCode.cs" /> |
||||
|
<Compile Include="Enums\ServiceType.cs" /> |
||||
|
<Compile Include="Enums\ShipState.cs" /> |
||||
|
<Compile Include="Enums\StockState.cs" /> |
||||
|
<Compile Include="Enums\StockWhereType.cs" /> |
||||
|
<Compile Include="Enums\StopLineType.cs" /> |
||||
|
<Compile Include="Enums\StoreArea.cs" /> |
||||
|
<Compile Include="Enums\SubBillType.cs" /> |
||||
|
<Compile Include="Enums\UniApiState.cs" /> |
||||
|
<Compile Include="Enums\UniApiType.cs" /> |
||||
|
<Compile Include="Enums\VinState.cs" /> |
||||
|
<Compile Include="Enums\WhseType.cs" /> |
||||
|
<Compile Include="Enums\WorkLineType.cs" /> |
||||
|
<Compile Include="GlobalConfig.cs" /> |
||||
|
<Compile Include="Properties\AssemblyInfo.cs" /> |
||||
|
<Compile Include="ScpCache.cs" /> |
||||
|
<Compile Include="ScpEntities.cs" /> |
||||
|
<Compile Include="ScpEntity\ERP_ORDER.cs" /> |
||||
|
<Compile Include="ScpEntity\ERP_ORDER_DETAIL.cs" /> |
||||
|
<Compile Include="ScpEntity\QadOrder.cs" /> |
||||
|
<Compile Include="ScpEntity\TA_BillNoType.cs" /> |
||||
|
<Compile Include="ScpEntity\TA_BILLTYPE.cs" /> |
||||
|
<Compile Include="ScpEntity\TA_CONFIG.cs" /> |
||||
|
<Compile Include="ScpEntity\TA_FACTORY.cs" /> |
||||
|
<Compile Include="ScpEntity\TA_Info.cs" /> |
||||
|
<Compile Include="ScpEntity\TA_LANGUAGE.cs" /> |
||||
|
<Compile Include="ScpEntity\TA_PART.cs" /> |
||||
|
<Compile Include="ScpEntity\TA_Part_User.cs" /> |
||||
|
<Compile Include="ScpEntity\TA_VENDER.cs" /> |
||||
|
<Compile Include="ScpEntity\TA_VEND_PART.cs" /> |
||||
|
<Compile Include="ScpEntity\TA_VEND_USER.cs" /> |
||||
|
<Compile Include="ScpEntity\TB_ASK.cs" /> |
||||
|
<Compile Include="ScpEntity\TB_ASK_DETAIL.cs" /> |
||||
|
<Compile Include="ScpEntity\TB_ASN.cs" /> |
||||
|
<Compile Include="ScpEntity\TB_ASN_DETAIL.cs" /> |
||||
|
<Compile Include="ScpEntity\TB_INVOICE.cs" /> |
||||
|
<Compile Include="ScpEntity\TB_INVOICE_DETAIL.cs" /> |
||||
|
<Compile Include="ScpEntity\TB_PLAN.cs" /> |
||||
|
<Compile Include="ScpEntity\TB_PlanMonth.cs" /> |
||||
|
<Compile Include="ScpEntity\TB_PLAN_DETAIL.cs" /> |
||||
|
<Compile Include="ScpEntity\TB_PO.cs" /> |
||||
|
<Compile Include="ScpEntity\TB_PO_DETAIL.cs" /> |
||||
|
<Compile Include="ScpEntity\TB_PublicData.cs" /> |
||||
|
<Compile Include="ScpEntity\TB_QadOrder.cs" /> |
||||
|
<Compile Include="ScpEntity\TB_QadOrderDetail.cs" /> |
||||
|
<Compile Include="ScpEntity\TB_RECEIVE.cs" /> |
||||
|
<Compile Include="ScpEntity\TB_RECEIVE_DETAIL.cs" /> |
||||
|
<Compile Include="ScpEntity\TB_REJECT.cs" /> |
||||
|
<Compile Include="ScpEntity\TB_REJECT_DETAIL.cs" /> |
||||
|
<Compile Include="ScpEntity\TB_RETURN.cs" /> |
||||
|
<Compile Include="ScpEntity\TB_RETURN_DETAIL.cs" /> |
||||
|
<Compile Include="ScpEntity\TF_ASN.cs" /> |
||||
|
<Compile Include="ScpEntity\TF_ASN_DETAIL.cs" /> |
||||
|
<Compile Include="ScpEntity\TF_PO.cs" /> |
||||
|
<Compile Include="ScpEntity\TF_PO_DETAIL.cs" /> |
||||
|
<Compile Include="ScpEntity\TL_BASEDATA.cs" /> |
||||
|
<Compile Include="ScpEntity\TL_BILL.cs" /> |
||||
|
<Compile Include="ScpEntity\TL_OPER.cs" /> |
||||
|
<Compile Include="ScpEntity\TL_USER.cs" /> |
||||
|
<Compile Include="ScpEntity\TS_BARCODE.cs" /> |
||||
|
<Compile Include="ScpEntity\TS_INFO.cs" /> |
||||
|
<Compile Include="ScpEntity\TS_STOCK.cs" /> |
||||
|
<Compile Include="ScpEntity\TS_UNI_API.cs" /> |
||||
|
<Compile Include="ScpEntity\TS_UNI_API_HIS.cs" /> |
||||
|
<Compile Include="ScpEntity\TT_CURRENCY.cs" /> |
||||
|
<Compile Include="ScpEntity\TT_PROJECT.cs" /> |
||||
|
<Compile Include="ScpEntity\TT_UNIT.cs" /> |
||||
|
<Compile Include="ScpEntity\V_BillInvoice.cs" /> |
||||
|
<Compile Include="ScpEntity\V_BillInvoiceDetail.cs" /> |
||||
|
<Compile Include="ScpEntity\V_BillShip.cs" /> |
||||
|
<Compile Include="ScpEntity\V_BillShipDetail.cs" /> |
||||
|
<Compile Include="ScpEntity\V_Info.cs" /> |
||||
|
<Compile Include="ScpEntity\V_PlanMonth.cs" /> |
||||
|
<Compile Include="ScpEntity\V_POAll.cs" /> |
||||
|
<Compile Include="ScpEntity\V_POAllDetail.cs" /> |
||||
|
<Compile Include="ScpEntity\V_POReport.cs" /> |
||||
|
<Compile Include="ScpEntity\V_QadOrder.cs" /> |
||||
|
<Compile Include="ScpEntity\V_Receive.cs" /> |
||||
|
<Compile Include="ScpEntity\V_ReceiveDetail.cs" /> |
||||
|
<Compile Include="ScpEntity\V_ReportReceive.cs" /> |
||||
|
<Compile Include="ScpEntity\V_Stock.cs" /> |
||||
|
<Compile Include="SCPException.cs" /> |
||||
|
<Compile Include="UniApiEntity\IControlTable.cs" /> |
||||
|
<Compile Include="UniApiEntity\IDataTable.cs" /> |
||||
|
<Compile Include="UniApiEntity\ITable.cs" /> |
||||
|
<Compile Include="UniApiEntity\QadTableName.cs" /> |
||||
|
<Compile Include="UniApiEntity\UniApiEntities.cs" /> |
||||
|
<Compile Include="UniApiEntity\UniInterfaceExtention.cs" /> |
||||
|
<Compile Include="UniApiEntity\xxbom_code_mstr.cs" /> |
||||
|
<Compile Include="UniApiEntity\xxbom_ctrl.cs" /> |
||||
|
<Compile Include="UniApiEntity\xxbom_ps_mstr.cs" /> |
||||
|
<Compile Include="UniApiEntity\xxbom_pt_mstr.cs" /> |
||||
|
<Compile Include="UniApiEntity\xxbom_ro_mstr.cs" /> |
||||
|
<Compile Include="UniApiEntity\xxmes_ctrl.cs" /> |
||||
|
<Compile Include="UniApiEntity\xxqad_cm_mstr.cs" /> |
||||
|
<Compile Include="UniApiEntity\xxqad_ctrl.cs" /> |
||||
|
<Compile Include="UniApiEntity\xxqad_ld_det.cs" /> |
||||
|
<Compile Include="UniApiEntity\xxqad_line_mstr.cs" /> |
||||
|
<Compile Include="UniApiEntity\xxqad_loc_det.cs" /> |
||||
|
<Compile Include="UniApiEntity\xxqad_pod_det.cs" /> |
||||
|
<Compile Include="UniApiEntity\xxqad_pprice_det.cs" /> |
||||
|
<Compile Include="UniApiEntity\xxqad_prh_det.cs" /> |
||||
|
<Compile Include="UniApiEntity\xxqad_ps_mstr.cs" /> |
||||
|
<Compile Include="UniApiEntity\xxqad_pt_mstr.cs" /> |
||||
|
<Compile Include="UniApiEntity\xxqad_repsch_det.cs" /> |
||||
|
<Compile Include="UniApiEntity\xxqad_ro_mstr.cs" /> |
||||
|
<Compile Include="UniApiEntity\xxqad_sche_mstr.cs" /> |
||||
|
<Compile Include="UniApiEntity\xxqad_sct_det.cs" /> |
||||
|
<Compile Include="UniApiEntity\xxqad_sod_det.cs" /> |
||||
|
<Compile Include="UniApiEntity\xxqad_sprice_det.cs" /> |
||||
|
<Compile Include="UniApiEntity\xxqad_vd_mstr.cs" /> |
||||
|
<Compile Include="UniApiEntity\xxqad_vp_mstr.cs" /> |
||||
|
<Compile Include="UniApiEntity\xxscm_ctrl.cs" /> |
||||
|
<Compile Include="UniApiEntity\xxscm_inv_det.cs" /> |
||||
|
<Compile Include="UniApiEntity\xxscm_pod_det.cs" /> |
||||
|
<Compile Include="UniApiEntity\xxscm_tx_det.cs" /> |
||||
|
<Compile Include="UniApiEntity\xxscm_tx_mstr.cs" /> |
||||
|
<Compile Include="UniApiEntity\xxwms_bk_mstr.cs" /> |
||||
|
<Compile Include="UniApiEntity\xxwms_ctrl.cs" /> |
||||
|
<Compile Include="UniApiEntity\xxwms_iss_det.cs" /> |
||||
|
<Compile Include="UniApiEntity\xxwms_ld_det.cs" /> |
||||
|
<Compile Include="UniApiEntity\xxwms_rct_det.cs" /> |
||||
|
<Compile Include="UniApiEntity\xxwms_rc_det.cs" /> |
||||
|
<Compile Include="UniApiEntity\xxwms_rt_det.cs" /> |
||||
|
<Compile Include="UniApiEntity\xxwms_soiss_det.cs" /> |
||||
|
<Compile Include="UniApiEntity\xxwms_tag_det.cs" /> |
||||
|
<Compile Include="UniApiEntity\xxwms_tr_det.cs" /> |
||||
|
<Compile Include="ScpEntity\V_TB_ASK.cs" /> |
||||
|
<Compile Include="ScpEntity\V_TB_ASK_DETAIL.cs" /> |
||||
|
<Compile Include="ScpEntity\V_TB_ASN.cs" /> |
||||
|
<Compile Include="ScpEntity\V_TB_ASN_DETAIL.cs" /> |
||||
|
<Compile Include="ScpEntity\V_TB_PO.cs" /> |
||||
|
<Compile Include="ScpEntity\V_TB_PO_DETAIL.cs" /> |
||||
|
</ItemGroup> |
||||
|
<ItemGroup> |
||||
|
<ProjectReference Include="..\CK.SCP.Utils\CK.SCP.Utils.csproj"> |
||||
|
<Project>{7118ac83-9dc0-41f5-94ea-e6f405ae0448}</Project> |
||||
|
<Name>CK.SCP.Utils</Name> |
||||
|
</ProjectReference> |
||||
|
</ItemGroup> |
||||
|
<ItemGroup> |
||||
|
<None Include="App.config" /> |
||||
|
<None Include="packages.config" /> |
||||
|
</ItemGroup> |
||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> |
||||
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. |
||||
|
Other similar extension points exist, see Microsoft.Common.targets. |
||||
|
<Target Name="BeforeBuild"> |
||||
|
</Target> |
||||
|
<Target Name="AfterBuild"> |
||||
|
</Target> |
||||
|
--> |
||||
|
</Project> |
@ -0,0 +1,28 @@ |
|||||
|
using CK.SCP.Models.Enums; |
||||
|
|
||||
|
namespace CK.SCP.Models |
||||
|
{ |
||||
|
public class DbSetting |
||||
|
{ |
||||
|
public override string ToString() |
||||
|
{ |
||||
|
return EntitiesHelper.GetPropertiesString(this); |
||||
|
} |
||||
|
|
||||
|
public DbSetting() { } |
||||
|
|
||||
|
public DbSetting(DataBaseType type) |
||||
|
{ |
||||
|
数据库类型 = type.ToString(); |
||||
|
} |
||||
|
|
||||
|
public string 数据库类型 { get; set; } = Enums.DataBaseType.SQLServer.ToString(); |
||||
|
|
||||
|
public string 服务器地址 { get; set; } = "127.0.0.1"; |
||||
|
public string 端口 { get; set; } = "1433"; |
||||
|
public string 数据库名称 { get; set; } = "DB_NAME"; |
||||
|
public string 用户名 { get; set; } = "sa"; |
||||
|
public string 密码 { get; set; } = "5E0AFEB85CA001A3371A9F19E7EC4DFF"; |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,148 @@ |
|||||
|
using System; |
||||
|
using System.Data.Entity; |
||||
|
using System.Data.Entity.Core; |
||||
|
using System.Data.Entity.Core.EntityClient; |
||||
|
using System.Data.SqlClient; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using CK.SCP.Models.AppBoxEntity; |
||||
|
using CK.SCP.Models.Enums; |
||||
|
using CK.SCP.Models.UniApiEntity; |
||||
|
using CK.SCP.Utils; |
||||
|
|
||||
|
namespace CK.SCP.Models |
||||
|
{ |
||||
|
public static class EntitiesFactory |
||||
|
{ |
||||
|
static EntitiesFactory() |
||||
|
{ |
||||
|
Database.SetInitializer<ScpEntities>(null); |
||||
|
Database.SetInitializer<UniApiEntities>(null); |
||||
|
} |
||||
|
|
||||
|
public static ScpEntities CreateScpInstance() |
||||
|
{ |
||||
|
try |
||||
|
{ |
||||
|
// var strConn = setting == null ? GetEfConnectionString("Wms") : GetEfConnectionString(setting);
|
||||
|
|
||||
|
var strConn = GetEfConnectionString(GlobalConfig.ScpDatabase); |
||||
|
var db = new ScpEntities(strConn); |
||||
|
return db; |
||||
|
} |
||||
|
catch (SqlException ex) |
||||
|
{ |
||||
|
throw new Exception($"系统无法连接到数据库:{GlobalConfig.ScpDatabase},请检查配置的服务器,数据库,用户名和密码等信息是否正确。" + Environment.NewLine + ex); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public static UniApiEntities CreateUniApiInstance() |
||||
|
{ |
||||
|
try |
||||
|
{ |
||||
|
// var strConn = setting == null ? GetEfConnectionString("UniApi") : GetEfConnectionString(setting);
|
||||
|
var strConn = GetEfConnectionString(GlobalConfig.UniApiDatabase); |
||||
|
var db = new UniApiEntities(strConn); |
||||
|
return db; |
||||
|
} |
||||
|
catch (SqlException ex) |
||||
|
{ |
||||
|
throw new Exception($"系统无法连接到数据库:{GlobalConfig.UniApiDatabase},请检查配置的服务器,数据库,用户名和密码等信息是否正确。" + Environment.NewLine + ex); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public static AppBoxContext CreateAppBoxInstance() |
||||
|
{ |
||||
|
try |
||||
|
{ |
||||
|
// var strConn = setting == null ? GetEfConnectionString("UniApi") : GetEfConnectionString(setting);
|
||||
|
var strConn = GetEfConnectionString(GlobalConfig.AppBoxDatabase); |
||||
|
var db = new AppBoxContext(strConn); |
||||
|
return db; |
||||
|
} |
||||
|
catch (SqlException ex) |
||||
|
{ |
||||
|
throw new Exception($"系统无法连接到数据库:{GlobalConfig.AppBoxDatabase},请检查配置的服务器,数据库,用户名和密码等信息是否正确。" + Environment.NewLine + ex); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public static string GetEfConnectionString(DbSetting dbSetting) |
||||
|
{ |
||||
|
var sbConn = new StringBuilder(); |
||||
|
|
||||
|
if (string.IsNullOrEmpty(dbSetting.密码)) |
||||
|
{ |
||||
|
throw new Exception("配置文件错误,请检查"); |
||||
|
} |
||||
|
switch (dbSetting.数据库类型) |
||||
|
{ |
||||
|
case "SQLServer": |
||||
|
sbConn.Append($"Data source ={dbSetting.服务器地址}"); |
||||
|
sbConn.Append(dbSetting.端口 == "0" ? ";" : $",{dbSetting.端口};"); |
||||
|
sbConn.Append($"Initial catalog = {dbSetting.数据库名称};"); |
||||
|
sbConn.Append($"User id = {dbSetting.用户名};"); |
||||
|
sbConn.Append($"Password = {EncryptHelper.Decrypt(dbSetting.密码)};"); |
||||
|
sbConn.Append("MultipleActiveResultSets = True;"); |
||||
|
sbConn.Append("persist security info = True;"); |
||||
|
sbConn.Append("App = EntityFramework;"); |
||||
|
break; |
||||
|
case "MySql": |
||||
|
sbConn.Append($"server ={dbSetting.服务器地址};"); |
||||
|
sbConn.Append($"port ={dbSetting.端口};"); |
||||
|
sbConn.Append($"database = {dbSetting.数据库名称};"); |
||||
|
sbConn.Append($"user id = {dbSetting.用户名};"); |
||||
|
sbConn.Append($"password = {EncryptHelper.Decrypt(dbSetting.密码)};"); |
||||
|
sbConn.Append("persistsecurityinfo =True;"); |
||||
|
break; |
||||
|
} |
||||
|
// LogHelper.Write(sbConn.ToString());
|
||||
|
return sbConn.ToString(); |
||||
|
} |
||||
|
|
||||
|
public static void SaveDb(DbContext db) |
||||
|
{ |
||||
|
try |
||||
|
{ |
||||
|
db.SaveChanges(); |
||||
|
} |
||||
|
catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//捕获实体验证异常
|
||||
|
{ |
||||
|
var sb = new StringBuilder(); |
||||
|
|
||||
|
foreach (var error in dbEx.EntityValidationErrors.ToList()) |
||||
|
{ |
||||
|
|
||||
|
error.ValidationErrors.ToList().ForEach(i => |
||||
|
{ |
||||
|
sb.AppendFormat("表:{0},字段:{1},信息:{2}\r\n", error.Entry.Entity.GetType().Name, i.PropertyName, i.ErrorMessage); |
||||
|
}); |
||||
|
} |
||||
|
throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "字段验证失败" + sb.ToString()); |
||||
|
} |
||||
|
catch (OptimisticConcurrencyException ex)//并发冲突异常
|
||||
|
{ |
||||
|
Console.WriteLine(ex.ToString()); |
||||
|
throw new ScpException(ResultCode.Exception, "9999", ex.ToString()); |
||||
|
} |
||||
|
catch (ScpException ex) |
||||
|
{ |
||||
|
Console.WriteLine(ex.ToString()); |
||||
|
|
||||
|
if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException)) |
||||
|
{ |
||||
|
var inner = (UpdateException)ex.InnerException; |
||||
|
|
||||
|
//Console.WriteLine(inner?.StateEntries[0].EntitySet.Name);
|
||||
|
throw new ScpException(ResultCode.Exception, "0000", ex.ToString()); |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
if (ex.InnerException != null) throw ex.InnerException; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,162 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Data.Entity; |
||||
|
using System.Linq; |
||||
|
using System.Linq.Expressions; |
||||
|
using System.Reflection; |
||||
|
using System.Text; |
||||
|
|
||||
|
namespace CK.SCP.Models |
||||
|
{ |
||||
|
public static class EntitiesHelper |
||||
|
{ |
||||
|
|
||||
|
|
||||
|
public static string GetPropertiesString<T>(T t,bool withName = true) |
||||
|
{ |
||||
|
var peroperties = t.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance); |
||||
|
var sb = new StringBuilder(); |
||||
|
foreach (var property in peroperties) |
||||
|
{ |
||||
|
if (withName) |
||||
|
sb.Append($"{property.Name}:"); |
||||
|
sb.Append($"{property.GetValue(t)},"); |
||||
|
} |
||||
|
return sb.ToString(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
public static List<T> GetData<T, TKey>(DbContext db, Expression<Func<T, T>> select, |
||||
|
Expression<Func<T, bool>> where, Expression<Func<T, TKey>> order) |
||||
|
where T : class |
||||
|
{ |
||||
|
var list = db.Set<T>() |
||||
|
.Where(@where) |
||||
|
.OrderBy(order) |
||||
|
.Select(@select).ToList(); |
||||
|
return list; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public static List<dynamic> GetData<T, TKey>(DbContext db, Expression<Func<T, dynamic>> select, |
||||
|
Expression<Func<T, bool>> where, Expression<Func<T, TKey>> order, out int count) |
||||
|
where T : class |
||||
|
{ |
||||
|
count = db.Set<T>().Where(@where).Count(); |
||||
|
var list = db.Set<T>() |
||||
|
.Where(@where) |
||||
|
.OrderBy(order) |
||||
|
.Select(@select).ToList(); |
||||
|
return list; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public static List<dynamic> GetPagedDataAsc<T, TKey>(DbContext db, Expression<Func<T, dynamic>> select, |
||||
|
Expression<Func<T, bool>> where, Expression<Func<T, TKey>> order, int pageIndex, int pageSize, out int total) |
||||
|
where T : class |
||||
|
{ |
||||
|
total = db.Set<T>().Where(@where).Count(); |
||||
|
var list = db.Set<T>() |
||||
|
.Where(@where) |
||||
|
.OrderBy(order) |
||||
|
.Select(@select) |
||||
|
.Skip((pageIndex - 1) * pageSize) |
||||
|
.Take(pageSize).ToList(); |
||||
|
return list; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public static List<T> GetPagedDataAsc<T, TKey>(DbContext db, Expression<Func<T, T>> select, |
||||
|
Expression<Func<T, bool>> where, Expression<Func<T, TKey>> order, int pageIndex, int pageSize, out int total) |
||||
|
where T : class |
||||
|
{ |
||||
|
total = db.Set<T>().Where(@where.Compile()).AsQueryable().Count(); |
||||
|
var list = db.Set<T>() |
||||
|
.Where(@where.Compile()).AsQueryable() |
||||
|
.OrderBy(order) |
||||
|
.Select(@select) |
||||
|
.Skip((pageIndex - 1) * pageSize) |
||||
|
.Take(pageSize).ToList(); |
||||
|
return list; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public static List<T> GetPagedDataAsc<T, TKey>(List<T> sourceList, Expression<Func<T, T>> select, |
||||
|
Expression<Func<T, bool>> where, Expression<Func<T, TKey>> order, int pageIndex, int pageSize, out int total) |
||||
|
where T : class |
||||
|
{ |
||||
|
List<T> list = null; |
||||
|
total = 0; |
||||
|
try |
||||
|
{ |
||||
|
total = sourceList.Where(where.Compile()).AsQueryable().Count(); |
||||
|
|
||||
|
|
||||
|
} |
||||
|
catch (Exception e) |
||||
|
{ |
||||
|
Console.WriteLine(e); |
||||
|
} |
||||
|
try |
||||
|
{ |
||||
|
list = sourceList.Where(@where.Compile()).AsQueryable() |
||||
|
.OrderBy(order) |
||||
|
.Select(@select) |
||||
|
.Skip((pageIndex - 1) * pageSize) |
||||
|
.Take(pageSize).ToList(); |
||||
|
} |
||||
|
catch (Exception e) |
||||
|
{ |
||||
|
Console.WriteLine(e); |
||||
|
} |
||||
|
|
||||
|
return list; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
public static List<dynamic> GetPagedDataDesc<T, TKey>(DbContext db, Expression<Func<T, dynamic>> select, |
||||
|
Expression<Func<T, bool>> where, Expression<Func<T, TKey>> order, int pageIndex, int pageSize, out int total) |
||||
|
where T : class |
||||
|
{ |
||||
|
total = db.Set<T>().Where(@where).Count(); |
||||
|
var list = db.Set<T>() |
||||
|
.Where(@where) |
||||
|
.OrderByDescending(order) |
||||
|
.Select(@select) |
||||
|
.Skip((pageIndex - 1) * pageSize) |
||||
|
.Take(pageSize).ToList(); |
||||
|
return list; |
||||
|
} |
||||
|
|
||||
|
public static List<T> GetPagedDataDesc<T, TKey>(DbContext db, Expression<Func<T, T>> select, |
||||
|
Expression<Func<T, bool>> where, Expression<Func<T, TKey>> order, int pageIndex, int pageSize, out int total) |
||||
|
where T : class |
||||
|
{ |
||||
|
total = db.Set<T>().Where(@where).Count(); |
||||
|
var list = db.Set<T>() |
||||
|
.Where(@where) |
||||
|
.OrderByDescending(order) |
||||
|
.Select(@select) |
||||
|
.Skip((pageIndex - 1) * pageSize) |
||||
|
.Take(pageSize).ToList(); |
||||
|
return list; |
||||
|
} |
||||
|
|
||||
|
public static List<T> GetPagedDataDesc<T, TKey>(List<T> sourceList, Expression<Func<T, T>> select, |
||||
|
Expression<Func<T, bool>> where, Expression<Func<T, TKey>> order, int pageIndex, int pageSize, out int total) |
||||
|
where T : class |
||||
|
{ |
||||
|
total = sourceList.Where(@where.Compile()).AsQueryable().Count(); |
||||
|
var list = sourceList |
||||
|
.Where(@where.Compile()).AsQueryable() |
||||
|
.OrderByDescending(order) |
||||
|
.Select(@select) |
||||
|
.Skip((pageIndex - 1) * pageSize) |
||||
|
.Take(pageSize).ToList(); |
||||
|
return list; |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,158 @@ |
|||||
|
using System.ComponentModel; |
||||
|
|
||||
|
namespace CK.SCP.Models.Enums |
||||
|
{ |
||||
|
public enum BillType |
||||
|
{ |
||||
|
[Description("原料收货")] |
||||
|
MaterialReceive = 101, |
||||
|
[Description("原料入库")] |
||||
|
MaterialIn = 102, |
||||
|
[Description("原料出库")] |
||||
|
MaterialDeliver = 103, |
||||
|
[Description("生产叫料")] |
||||
|
MaterialAsk = 104, |
||||
|
[Description("原料退货")] |
||||
|
MatertialReturn = 105, |
||||
|
[Description("生产退库")] |
||||
|
MaterialBack = 106, |
||||
|
|
||||
|
|
||||
|
[Description("委外出库")] |
||||
|
OutsourceDeliver = 109, |
||||
|
|
||||
|
// [Description("原料退货")]
|
||||
|
// MaterialBack = 105,
|
||||
|
// [Description("生产退库")]
|
||||
|
// MaterialReturn = 106,
|
||||
|
|
||||
|
[Description("成品收货")] |
||||
|
ProductReceive = 201, |
||||
|
[Description("成品入库")] |
||||
|
ProductIn = 202, |
||||
|
[Description("成品发货")] |
||||
|
DeliverPlan = 204, |
||||
|
[Description("客户退货")] |
||||
|
ProductReturn = 205, |
||||
|
[Description("成品顺序发货")] |
||||
|
ProductSortedDeliver = 206, |
||||
|
[Description("成品销售")] |
||||
|
ProductSell = 207, |
||||
|
[Description("成品返修")] |
||||
|
ProductRepair = 208, |
||||
|
|
||||
|
[Description("委外入库")] |
||||
|
OutsourceReceive = 209, |
||||
|
|
||||
|
|
||||
|
[Description("其它入库")] |
||||
|
OtherIn = 300, |
||||
|
[Description("其它出库")] |
||||
|
OtherOut = 301, |
||||
|
[Description("移库")] |
||||
|
StockMove = 302, |
||||
|
[Description("打包")] |
||||
|
StockPack = 303, |
||||
|
[Description("拆包")] |
||||
|
StockUnpack = 304, |
||||
|
[Description("盘点计划")] |
||||
|
InventoryPlan = 305, |
||||
|
[Description("结算比对")] |
||||
|
BalanceCompare = 307, |
||||
|
[Description("盘点库位")] |
||||
|
InventoryLoc = 306, |
||||
|
|
||||
|
[Description("器具初始化")] |
||||
|
EqptRecover = 401, |
||||
|
[Description("器具保养")] |
||||
|
EqptMaintain = 402, |
||||
|
[Description("器具报废")] |
||||
|
EqptScrap = 403, |
||||
|
[Description("码托")] |
||||
|
EqptLoad = 404, |
||||
|
|
||||
|
[Description("JIS收货")] |
||||
|
VinReceive = 501, |
||||
|
[Description("JIS发货")] |
||||
|
VinDeliver = 502, |
||||
|
[Description("JIS销售")] |
||||
|
VinSell = 503, |
||||
|
|
||||
|
[Description("报检")] |
||||
|
Inspect = 601, |
||||
|
[Description("追溯")] |
||||
|
TraceBack = 602, |
||||
|
[Description("备货单")] |
||||
|
PickPlan = 603, |
||||
|
[Description("发料单")] |
||||
|
PickFact = 604, |
||||
|
[Description("生产计划")] |
||||
|
ProducePlan = 605, |
||||
|
[Description("生产订单")] |
||||
|
ManuOrder = 607, |
||||
|
[Description("不合格品单")] |
||||
|
UnqualifiedProd = 608, |
||||
|
[Description("设备点检模板")] |
||||
|
CheckModeEquipment = 609, |
||||
|
[Description("设备点检单")] |
||||
|
CheckBillEquipment = 610, |
||||
|
[Description("产品点检模板")] |
||||
|
CheckModeProduct = 611, |
||||
|
[Description("产品点检单")] |
||||
|
CheckBillProduct = 612, |
||||
|
[Description("首检模板")] |
||||
|
SpotInspectFirstMode = 613, |
||||
|
[Description("首检单")] |
||||
|
SpotInspectionFirst = 615, |
||||
|
[Description("巡检模板")] |
||||
|
SpotInspectMedMode = 616, |
||||
|
[Description("巡检单")] |
||||
|
SpotInspectionMed = 617, |
||||
|
[Description("末检模板")] |
||||
|
SpotInspectLastMode = 618, |
||||
|
[Description("末检单")] |
||||
|
SpotInspectionLast = 619, |
||||
|
[Description("停线单")] |
||||
|
LineStopBill = 620, |
||||
|
[Description("产线识别码")] |
||||
|
WorkLineDoc = 621, |
||||
|
[Description("工位识别码")] |
||||
|
WorkStationDoc = 622, |
||||
|
[Description("路由识别码")] |
||||
|
RouteDoc = 623, |
||||
|
[Description("工位拆解识别码")] |
||||
|
RouteBOMDoc = 624, |
||||
|
[Description("参数识别码")] |
||||
|
RoutePDoc = 625, |
||||
|
[Description("工位部件识别码")] |
||||
|
MachinePart = 626, |
||||
|
[Description("停线发通知编号")] |
||||
|
LineStopNoticeBill = 627, |
||||
|
[Description("停线预计处理编号")] |
||||
|
LineStopPrepareBill = 628, |
||||
|
[Description("措施编号")] |
||||
|
LineStopMeasureBill = 629, |
||||
|
[Description("点检表编号")] |
||||
|
CheckCode = 630, |
||||
|
|
||||
|
ReHandleVin = 701, |
||||
|
[Description("采购订单")] |
||||
|
PuchaseOrder = 702, |
||||
|
[Description("发货单")] |
||||
|
AsnOrder = 703, |
||||
|
[Description("销售订单")] |
||||
|
SaleOrder = 704, |
||||
|
|
||||
|
|
||||
|
[Description("确认订单")] |
||||
|
PO = 704, |
||||
|
[Description("收货")] |
||||
|
Receive = 704, |
||||
|
[Description("条码")] |
||||
|
BarCode = 704, |
||||
|
[Description("发票")] |
||||
|
Invoice = 704, |
||||
|
|
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,11 @@ |
|||||
|
using System.ComponentModel; |
||||
|
|
||||
|
namespace CK.SCP.Models.Enums |
||||
|
{ |
||||
|
public enum CollectionStepFinish |
||||
|
{ |
||||
|
[Description("零件扫条码")] ScanPartBarCode = 1, |
||||
|
[Description("机器复位信号")] ScanMachineReset = 2, |
||||
|
[Description("专用计数设备")] counters = 3 |
||||
|
} |
||||
|
} |
@ -0,0 +1,16 @@ |
|||||
|
using System.ComponentModel; |
||||
|
|
||||
|
namespace CK.SCP.Models.Enums |
||||
|
{ |
||||
|
public enum ControlType |
||||
|
{ |
||||
|
[Description("标签")] |
||||
|
Tab = 0, |
||||
|
[Description("群组")] |
||||
|
Grp = 1, |
||||
|
[Description("容器")] |
||||
|
Ctn = 2, |
||||
|
[Description("菜单项")] |
||||
|
Itm = 3, |
||||
|
} |
||||
|
} |
@ -0,0 +1,10 @@ |
|||||
|
namespace CK.SCP.Models.Enums |
||||
|
{ |
||||
|
public enum DataBaseType |
||||
|
{ |
||||
|
SQLServer, |
||||
|
MySql, |
||||
|
Oracle, |
||||
|
PostgreSQL, |
||||
|
} |
||||
|
} |
@ -0,0 +1,29 @@ |
|||||
|
using System.ComponentModel; |
||||
|
|
||||
|
namespace CK.SCP.Models.Enums |
||||
|
{ |
||||
|
public enum DataState |
||||
|
{ |
||||
|
[Description("无效")] |
||||
|
Disabled = 0, |
||||
|
[Description("有效")] |
||||
|
Enabled = 1, |
||||
|
} |
||||
|
|
||||
|
public enum FormState |
||||
|
{ |
||||
|
[Description("开放")] |
||||
|
开放 = 1, |
||||
|
[Description("关闭")] |
||||
|
关闭 = 0, |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public enum BillState |
||||
|
{ |
||||
|
Cancel = -1, |
||||
|
New = 0, |
||||
|
Process = 1, |
||||
|
Finish = 2, |
||||
|
} |
||||
|
} |
@ -0,0 +1,11 @@ |
|||||
|
namespace CK.SCP.Models.Enums |
||||
|
{ |
||||
|
public enum EquipmentState |
||||
|
{ |
||||
|
Idle, |
||||
|
InUsed, |
||||
|
Sent, |
||||
|
Maintaining, |
||||
|
Scraped |
||||
|
} |
||||
|
} |
@ -0,0 +1,19 @@ |
|||||
|
using System.ComponentModel; |
||||
|
|
||||
|
namespace CK.SCP.Models.Enums |
||||
|
{ |
||||
|
public enum ErpInterfaceType |
||||
|
{ |
||||
|
[Description("移库")] |
||||
|
TR, |
||||
|
[Description("回冲")] |
||||
|
BK, |
||||
|
MaterialIn, |
||||
|
MaterialOut, |
||||
|
ProductIn, |
||||
|
ProductOut, |
||||
|
[Description("销售")] |
||||
|
SH, |
||||
|
RCT |
||||
|
} |
||||
|
} |
@ -0,0 +1,15 @@ |
|||||
|
using System.ComponentModel; |
||||
|
|
||||
|
namespace CK.SCP.Models.Enums |
||||
|
{ |
||||
|
public enum GroupType |
||||
|
{ |
||||
|
[Description("高位货架")] |
||||
|
Shelf = 0, |
||||
|
[Description("地面库位")] |
||||
|
Ground = 1, |
||||
|
[Description("线边货架")] |
||||
|
Wip = 2, |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,14 @@ |
|||||
|
using System.ComponentModel; |
||||
|
|
||||
|
namespace CK.SCP.Models.Enums |
||||
|
{ |
||||
|
public enum InspectType |
||||
|
{ |
||||
|
[Description("免检")] |
||||
|
No = 0, |
||||
|
[Description("全检")] |
||||
|
All = 1, |
||||
|
[Description("抽检")] |
||||
|
Partial = 2 |
||||
|
} |
||||
|
} |
@ -0,0 +1,14 @@ |
|||||
|
using System.ComponentModel; |
||||
|
|
||||
|
namespace CK.SCP.Models.Enums |
||||
|
{ |
||||
|
public enum InspectionType |
||||
|
{ |
||||
|
//[Description("未知")] Unknow = 0,
|
||||
|
[Description("首检")] InspectionFirst = 1, |
||||
|
[Description("巡检")] InspectionMed = 2, |
||||
|
[Description("末检")] InspectionLast = 3, |
||||
|
[Description("设备点检")] CheckEquipment = 4, |
||||
|
[Description("产品点检")] CheckProduction = 5, |
||||
|
} |
||||
|
} |
@ -0,0 +1,19 @@ |
|||||
|
using System.ComponentModel; |
||||
|
|
||||
|
namespace CK.SCP.Models.Enums |
||||
|
{ |
||||
|
public enum InventoryState |
||||
|
{ |
||||
|
//状态 0:新建 1:已初盘 2:已重盘 3:已生成接口 -1:已取消
|
||||
|
[Description("新建")] |
||||
|
New = 0, |
||||
|
[Description("已初盘")] |
||||
|
Checked = 1, |
||||
|
[Description("已重盘")] |
||||
|
ReChecked = 2, |
||||
|
[Description("已生成接口")] |
||||
|
ToErp = 3, |
||||
|
[Description("取消")] |
||||
|
Cancelled = -1 |
||||
|
} |
||||
|
} |
@ -0,0 +1,24 @@ |
|||||
|
using System.ComponentModel; |
||||
|
|
||||
|
namespace CK.SCP.Models.Enums |
||||
|
{ |
||||
|
public enum InvoiceState |
||||
|
{ |
||||
|
[Description("新建")] |
||||
|
New = 0, |
||||
|
[Description("供应商申请")] |
||||
|
Apply = 1, |
||||
|
[Description("采购审核退回")] |
||||
|
CheckFail = 2, |
||||
|
[Description("采购审核通过")] |
||||
|
CheckSuccess = 3, |
||||
|
[Description("发票寄出")] |
||||
|
Mail = 4, |
||||
|
[Description("财务收票")] |
||||
|
FinanceReceive = 5, |
||||
|
[Description("财务退回")] |
||||
|
FinanceFail = 6, |
||||
|
[Description("发票作废")] |
||||
|
Reject = -1, |
||||
|
} |
||||
|
} |
@ -0,0 +1,15 @@ |
|||||
|
using System.ComponentModel; |
||||
|
|
||||
|
namespace CK.SCP.Models.Enums |
||||
|
{ |
||||
|
public enum LocType |
||||
|
{ |
||||
|
[Description("存储库位")] |
||||
|
Store = 0, |
||||
|
[Description("线边库位")] |
||||
|
Wip = 1, |
||||
|
[Description("功能库位")] |
||||
|
Functional = 2, |
||||
|
|
||||
|
} |
||||
|
} |
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue