学 赵
4 years ago
commit
f2ddc4e945
6275 changed files with 558560 additions and 0 deletions
@ -0,0 +1,63 @@ |
|||||
|
############################################################################### |
||||
|
# Set default behavior to automatically normalize line endings. |
||||
|
############################################################################### |
||||
|
* text=auto |
||||
|
|
||||
|
############################################################################### |
||||
|
# Set default behavior for command prompt diff. |
||||
|
# |
||||
|
# This is need for earlier builds of msysgit that does not have it on by |
||||
|
# default for csharp files. |
||||
|
# Note: This is only used by command line |
||||
|
############################################################################### |
||||
|
#*.cs diff=csharp |
||||
|
|
||||
|
############################################################################### |
||||
|
# Set the merge driver for project and solution files |
||||
|
# |
||||
|
# Merging from the command prompt will add diff markers to the files if there |
||||
|
# are conflicts (Merging from VS is not affected by the settings below, in VS |
||||
|
# the diff markers are never inserted). Diff markers may cause the following |
||||
|
# file extensions to fail to load in VS. An alternative would be to treat |
||||
|
# these files as binary and thus will always conflict and require user |
||||
|
# intervention with every merge. To do so, just uncomment the entries below |
||||
|
############################################################################### |
||||
|
#*.sln merge=binary |
||||
|
#*.csproj merge=binary |
||||
|
#*.vbproj merge=binary |
||||
|
#*.vcxproj merge=binary |
||||
|
#*.vcproj merge=binary |
||||
|
#*.dbproj merge=binary |
||||
|
#*.fsproj merge=binary |
||||
|
#*.lsproj merge=binary |
||||
|
#*.wixproj merge=binary |
||||
|
#*.modelproj merge=binary |
||||
|
#*.sqlproj merge=binary |
||||
|
#*.wwaproj merge=binary |
||||
|
|
||||
|
############################################################################### |
||||
|
# behavior for image files |
||||
|
# |
||||
|
# image files are treated as binary by default. |
||||
|
############################################################################### |
||||
|
#*.jpg binary |
||||
|
#*.png binary |
||||
|
#*.gif binary |
||||
|
|
||||
|
############################################################################### |
||||
|
# diff behavior for common document formats |
||||
|
# |
||||
|
# Convert binary document formats to text before diffing them. This feature |
||||
|
# is only available from the command line. Turn it on by uncommenting the |
||||
|
# entries below. |
||||
|
############################################################################### |
||||
|
#*.doc diff=astextplain |
||||
|
#*.DOC diff=astextplain |
||||
|
#*.docx diff=astextplain |
||||
|
#*.DOCX diff=astextplain |
||||
|
#*.dot diff=astextplain |
||||
|
#*.DOT diff=astextplain |
||||
|
#*.pdf diff=astextplain |
||||
|
#*.PDF diff=astextplain |
||||
|
#*.rtf diff=astextplain |
||||
|
#*.RTF diff=astextplain |
@ -0,0 +1,266 @@ |
|||||
|
## Ignore Visual Studio temporary files, build results, and |
||||
|
## files generated by popular Visual Studio add-ons. |
||||
|
|
||||
|
# User-specific files |
||||
|
*.suo |
||||
|
*.user |
||||
|
*.userosscache |
||||
|
*.sln.docstates |
||||
|
|
||||
|
# User-specific files (MonoDevelop/Xamarin Studio) |
||||
|
*.userprefs |
||||
|
|
||||
|
# Build results |
||||
|
[Dd]ebug/ |
||||
|
[Dd]ebugPublic/ |
||||
|
[Rr]elease/ |
||||
|
[Rr]eleases/ |
||||
|
x64/ |
||||
|
x86/ |
||||
|
bld/ |
||||
|
[Bb]in/ |
||||
|
[Oo]bj/ |
||||
|
[Ll]og/ |
||||
|
|
||||
|
# Visual Studio 2015 cache/options directory |
||||
|
.vs/ |
||||
|
# Uncomment if you have tasks that create the project's static files in wwwroot |
||||
|
#wwwroot/ |
||||
|
|
||||
|
# MSTest test Results |
||||
|
[Tt]est[Rr]esult*/ |
||||
|
[Bb]uild[Ll]og.* |
||||
|
|
||||
|
# NUNIT |
||||
|
*.VisualState.xml |
||||
|
TestResult.xml |
||||
|
|
||||
|
# Build Results of an ATL Project |
||||
|
[Dd]ebugPS/ |
||||
|
[Rr]eleasePS/ |
||||
|
dlldata.c |
||||
|
|
||||
|
# DNX |
||||
|
project.lock.json |
||||
|
project.fragment.lock.json |
||||
|
artifacts/ |
||||
|
|
||||
|
*_i.c |
||||
|
*_p.c |
||||
|
*_i.h |
||||
|
*.ilk |
||||
|
*.meta |
||||
|
*.obj |
||||
|
*.pch |
||||
|
*.pdb |
||||
|
*.pgc |
||||
|
*.pgd |
||||
|
*.rsp |
||||
|
*.sbr |
||||
|
*.tlb |
||||
|
*.tli |
||||
|
*.tlh |
||||
|
*.tmp |
||||
|
*.tmp_proj |
||||
|
*.log |
||||
|
*.vspscc |
||||
|
*.vssscc |
||||
|
.builds |
||||
|
*.pidb |
||||
|
*.svclog |
||||
|
*.scc |
||||
|
|
||||
|
# Chutzpah Test files |
||||
|
_Chutzpah* |
||||
|
|
||||
|
# Visual C++ cache files |
||||
|
ipch/ |
||||
|
*.aps |
||||
|
*.ncb |
||||
|
*.opendb |
||||
|
*.opensdf |
||||
|
*.sdf |
||||
|
*.cachefile |
||||
|
*.VC.db |
||||
|
*.VC.VC.opendb |
||||
|
|
||||
|
# Visual Studio profiler |
||||
|
*.psess |
||||
|
*.vsp |
||||
|
*.vspx |
||||
|
*.sap |
||||
|
|
||||
|
# TFS 2012 Local Workspace |
||||
|
$tf/ |
||||
|
|
||||
|
# Guidance Automation Toolkit |
||||
|
*.gpState |
||||
|
|
||||
|
# ReSharper is a .NET coding add-in |
||||
|
_ReSharper*/ |
||||
|
*.[Rr]e[Ss]harper |
||||
|
*.DotSettings.user |
||||
|
|
||||
|
# JustCode is a .NET coding add-in |
||||
|
.JustCode |
||||
|
|
||||
|
# TeamCity is a build add-in |
||||
|
_TeamCity* |
||||
|
|
||||
|
# DotCover is a Code Coverage Tool |
||||
|
*.dotCover |
||||
|
|
||||
|
# NCrunch |
||||
|
_NCrunch_* |
||||
|
.*crunch*.local.xml |
||||
|
nCrunchTemp_* |
||||
|
|
||||
|
# MightyMoose |
||||
|
*.mm.* |
||||
|
AutoTest.Net/ |
||||
|
|
||||
|
# Web workbench (sass) |
||||
|
.sass-cache/ |
||||
|
|
||||
|
# Installshield output folder |
||||
|
[Ee]xpress/ |
||||
|
|
||||
|
# DocProject is a documentation generator add-in |
||||
|
DocProject/buildhelp/ |
||||
|
DocProject/Help/*.HxT |
||||
|
DocProject/Help/*.HxC |
||||
|
DocProject/Help/*.hhc |
||||
|
DocProject/Help/*.hhk |
||||
|
DocProject/Help/*.hhp |
||||
|
DocProject/Help/Html2 |
||||
|
DocProject/Help/html |
||||
|
|
||||
|
# Click-Once directory |
||||
|
publish/ |
||||
|
|
||||
|
# Publish Web Output |
||||
|
*.[Pp]ublish.xml |
||||
|
*.azurePubxml |
||||
|
# TODO: Comment the next line if you want to checkin your web deploy settings |
||||
|
# but database connection strings (with potential passwords) will be unencrypted |
||||
|
#*.pubxml |
||||
|
*.publishproj |
||||
|
|
||||
|
# Microsoft Azure Web App publish settings. Comment the next line if you want to |
||||
|
# checkin your Azure Web App publish settings, but sensitive information contained |
||||
|
# in these scripts will be unencrypted |
||||
|
PublishScripts/ |
||||
|
|
||||
|
# NuGet Packages |
||||
|
*.nupkg |
||||
|
# The packages folder can be ignored because of Package Restore |
||||
|
**/packages/* |
||||
|
# except build/, which is used as an MSBuild target. |
||||
|
!**/packages/build/ |
||||
|
# Uncomment if necessary however generally it will be regenerated when needed |
||||
|
#!**/packages/repositories.config |
||||
|
# NuGet v3's project.json files produces more ignoreable files |
||||
|
*.nuget.props |
||||
|
*.nuget.targets |
||||
|
|
||||
|
# Microsoft Azure Build Output |
||||
|
csx/ |
||||
|
*.build.csdef |
||||
|
|
||||
|
# Microsoft Azure Emulator |
||||
|
ecf/ |
||||
|
rcf/ |
||||
|
|
||||
|
# Windows Store app package directories and files |
||||
|
AppPackages/ |
||||
|
BundleArtifacts/ |
||||
|
Package.StoreAssociation.xml |
||||
|
_pkginfo.txt |
||||
|
|
||||
|
# Visual Studio cache files |
||||
|
# files ending in .cache can be ignored |
||||
|
*.[Cc]ache |
||||
|
# but keep track of directories ending in .cache |
||||
|
!*.[Cc]ache/ |
||||
|
|
||||
|
# Others |
||||
|
ClientBin/ |
||||
|
~$* |
||||
|
*~ |
||||
|
*.dbmdl |
||||
|
*.dbproj.schemaview |
||||
|
*.jfm |
||||
|
*.pfx |
||||
|
*.publishsettings |
||||
|
node_modules/ |
||||
|
orleans.codegen.cs |
||||
|
|
||||
|
# Since there are multiple workflows, uncomment next line to ignore bower_components |
||||
|
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) |
||||
|
#bower_components/ |
||||
|
|
||||
|
# RIA/Silverlight projects |
||||
|
Generated_Code/ |
||||
|
|
||||
|
# Backup & report files from converting an old project file |
||||
|
# to a newer Visual Studio version. Backup files are not needed, |
||||
|
# because we have git ;-) |
||||
|
_UpgradeReport_Files/ |
||||
|
Backup*/ |
||||
|
UpgradeLog*.XML |
||||
|
UpgradeLog*.htm |
||||
|
|
||||
|
# SQL Server files |
||||
|
*.mdf |
||||
|
*.ldf |
||||
|
|
||||
|
# Business Intelligence projects |
||||
|
*.rdl.data |
||||
|
*.bim.layout |
||||
|
*.bim_*.settings |
||||
|
|
||||
|
# Microsoft Fakes |
||||
|
FakesAssemblies/ |
||||
|
|
||||
|
# GhostDoc plugin setting file |
||||
|
*.GhostDoc.xml |
||||
|
|
||||
|
# Node.js Tools for Visual Studio |
||||
|
.ntvs_analysis.dat |
||||
|
|
||||
|
# Visual Studio 6 build log |
||||
|
*.plg |
||||
|
|
||||
|
# Visual Studio 6 workspace options file |
||||
|
*.opt |
||||
|
|
||||
|
# Visual Studio LightSwitch build output |
||||
|
**/*.HTMLClient/GeneratedArtifacts |
||||
|
**/*.DesktopClient/GeneratedArtifacts |
||||
|
**/*.DesktopClient/ModelManifest.xml |
||||
|
**/*.Server/GeneratedArtifacts |
||||
|
**/*.Server/ModelManifest.xml |
||||
|
_Pvt_Extensions |
||||
|
|
||||
|
# Paket dependency manager |
||||
|
.paket/paket.exe |
||||
|
paket-files/ |
||||
|
|
||||
|
# FAKE - F# Make |
||||
|
.fake/ |
||||
|
|
||||
|
# JetBrains Rider |
||||
|
.idea/ |
||||
|
*.sln.iml |
||||
|
|
||||
|
# CodeRush |
||||
|
.cr/ |
||||
|
|
||||
|
# Python Tools for Visual Studio (PTVS) |
||||
|
__pycache__/ |
||||
|
*.pyc |
||||
|
/SCP/exportfiles/收货审核明细-20180530135736242.xls |
||||
|
/SCP/exportfiles/收货审核明细-20180530150636394.xls |
||||
|
/SCP/exportfiles/收货审核明细-20180530142739101.xls |
||||
|
/SCP/exportfiles/收货审核明细-20180530142542391.xls |
||||
|
/SCP/exportfiles |
@ -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,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, |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,17 @@ |
|||||
|
namespace CK.SCP.Models.Enums |
||||
|
{ |
||||
|
public enum LogType |
||||
|
{ |
||||
|
Login, |
||||
|
Logout, |
||||
|
BillCreate, |
||||
|
BillModify, |
||||
|
BillDelete, |
||||
|
BillCancel, |
||||
|
BaseDataCreate, |
||||
|
BaseDataModify, |
||||
|
BaseDataDisable, |
||||
|
BaseDataDelete, |
||||
|
StockMove |
||||
|
} |
||||
|
} |
@ -0,0 +1,16 @@ |
|||||
|
using System.ComponentModel; |
||||
|
|
||||
|
namespace CK.SCP.Models.Enums |
||||
|
{ |
||||
|
public enum LoginState |
||||
|
{ |
||||
|
[Description("登录失败,未知原因")] |
||||
|
Fault = 0, |
||||
|
[Description("登录成功")] |
||||
|
OK = 1, |
||||
|
[Description("错误的用户名或密码,登录失败!")] |
||||
|
BadCode = 2, |
||||
|
[Description("登录失败,尝试次数太多。稍后再试。")] |
||||
|
Itm = 3, |
||||
|
} |
||||
|
} |
@ -0,0 +1,12 @@ |
|||||
|
using System.ComponentModel; |
||||
|
|
||||
|
namespace CK.SCP.Models.Enums |
||||
|
{ |
||||
|
public enum ManageType |
||||
|
{ |
||||
|
[Description("批量")] |
||||
|
Batch =0, |
||||
|
[Description("单包装")] |
||||
|
SinglePack =1 |
||||
|
} |
||||
|
} |
@ -0,0 +1,18 @@ |
|||||
|
using System.ComponentModel; |
||||
|
|
||||
|
namespace CK.SCP.Models.Enums |
||||
|
{ |
||||
|
|
||||
|
public enum ManufactureProcedureType |
||||
|
{ |
||||
|
[Description("批量生产")] |
||||
|
Ordinary = 1, |
||||
|
[Description("试制")] |
||||
|
TrialManufacture = 2, |
||||
|
[Description("拆解返修")] |
||||
|
Disassembly = 3, |
||||
|
[Description("小修理")] |
||||
|
Replace = 4 |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,24 @@ |
|||||
|
using System.ComponentModel; |
||||
|
|
||||
|
namespace CK.SCP.Models.Enums |
||||
|
{ |
||||
|
public enum NotifyType |
||||
|
{ |
||||
|
[Description("新增备料单")] |
||||
|
MaterialAsk=0, |
||||
|
[Description("未知客户物料号")] |
||||
|
UnknowCustPart=1, |
||||
|
[Description("新增检验单")] |
||||
|
Inspect=2, |
||||
|
[Description("新增生产计划单")] |
||||
|
ProducePlan=3, |
||||
|
[Description("新增发货计划单")] |
||||
|
DeliverPlan=4, |
||||
|
[Description("新增盘点计划单")] |
||||
|
InventoryPlan=5, |
||||
|
[Description("新增委外计划单")] |
||||
|
OmPlan=6, |
||||
|
[Description("VIN处理错误")] |
||||
|
VinError=7, |
||||
|
} |
||||
|
} |
@ -0,0 +1,11 @@ |
|||||
|
namespace CK.SCP.Models.Enums |
||||
|
{ |
||||
|
public enum OperateType |
||||
|
{ |
||||
|
Add, |
||||
|
Update, |
||||
|
Delete, |
||||
|
Cancel, |
||||
|
Finish |
||||
|
} |
||||
|
} |
@ -0,0 +1,14 @@ |
|||||
|
using System.ComponentModel; |
||||
|
|
||||
|
namespace CK.SCP.Models.Enums |
||||
|
{ |
||||
|
public enum PartKind |
||||
|
{ |
||||
|
[Description("总成")] |
||||
|
FG, |
||||
|
[Description("原料")] |
||||
|
RAW, |
||||
|
[Description("半成品")] |
||||
|
SUB |
||||
|
} |
||||
|
} |
@ -0,0 +1,17 @@ |
|||||
|
using System.ComponentModel; |
||||
|
|
||||
|
namespace CK.SCP.Models.Enums |
||||
|
{ |
||||
|
public enum PartState |
||||
|
{ |
||||
|
[Description("Actived")] |
||||
|
A, |
||||
|
[Description("Designing")] |
||||
|
D, |
||||
|
[Description("Hold")] |
||||
|
H, |
||||
|
[Description("Noneactived")] |
||||
|
N |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,24 @@ |
|||||
|
using System.ComponentModel; |
||||
|
|
||||
|
namespace CK.SCP.Models.Enums |
||||
|
{ |
||||
|
|
||||
|
|
||||
|
public enum PartType |
||||
|
{ |
||||
|
[Description("采购件")] |
||||
|
B = 0, |
||||
|
[Description("自制件")] |
||||
|
M = 1, |
||||
|
[Description("客户指定")] |
||||
|
D = 2, |
||||
|
[Description("客户指定国外")] |
||||
|
DN = 21, |
||||
|
[Description("客户指定国内")] |
||||
|
DY = 22, |
||||
|
[Description("委外件")] |
||||
|
S = 3, |
||||
|
[Description("管理公司采购件")] |
||||
|
Y = 4 |
||||
|
} |
||||
|
} |
@ -0,0 +1,23 @@ |
|||||
|
using System.ComponentModel; |
||||
|
|
||||
|
namespace CK.SCP.Models.Enums |
||||
|
{ |
||||
|
|
||||
|
public enum PlanDayState |
||||
|
{ |
||||
|
[Description("取消")] |
||||
|
Cancelled = -1, |
||||
|
[Description("新建")] |
||||
|
New = 0, |
||||
|
[Description("提交")] |
||||
|
Handling = 1, |
||||
|
[Description("已分配工单")] |
||||
|
Assigned = 2, |
||||
|
[Description("禁止自动分配工单")] |
||||
|
AssignDisable = 3, |
||||
|
[Description("完成")] |
||||
|
Finished = 4, |
||||
|
[Description("失败")] |
||||
|
Failed = 5, |
||||
|
} |
||||
|
} |
@ -0,0 +1,144 @@ |
|||||
|
using System; |
||||
|
using System.ComponentModel; |
||||
|
|
||||
|
namespace CK.SCP.Models.Enums |
||||
|
{ |
||||
|
public enum PlanState |
||||
|
{ |
||||
|
[Description("新建")] |
||||
|
New = 0, |
||||
|
[Description("发布")] |
||||
|
Release = 1, |
||||
|
[Description("已确认")] |
||||
|
Confirm = 2, |
||||
|
[Description("已发货")] |
||||
|
Ship = 3, |
||||
|
[Description("已收货")] |
||||
|
Receive = 4, |
||||
|
[Description("已完成")] |
||||
|
Complete = 5, |
||||
|
[Description("强制完结")] |
||||
|
CompleteForce = 6, |
||||
|
[Description("已作废")] |
||||
|
Reject = -1, |
||||
|
} |
||||
|
|
||||
|
/* public class F_StatePlan |
||||
|
{ |
||||
|
public static int New = 0; |
||||
|
public static int Release = 1; |
||||
|
public static int Confirm = 2; |
||||
|
public static int Ship = 3; |
||||
|
public static int Receive = 4; |
||||
|
public static int Complete = 5; |
||||
|
public static int CompleteForce = 6; |
||||
|
public static int Reject = -1; |
||||
|
|
||||
|
public static string GetName(object State) |
||||
|
{ |
||||
|
string ret = ""; |
||||
|
|
||||
|
if (Convert.ToInt32(State) == New) ret = "新建"; |
||||
|
if (Convert.ToInt32(State) == Release) ret = "发布"; |
||||
|
if (Convert.ToInt32(State) == Confirm) ret = "已确认"; |
||||
|
if (Convert.ToInt32(State) == Ship) ret = "已发货"; |
||||
|
if (Convert.ToInt32(State) == Receive) ret = "已收货"; |
||||
|
if (Convert.ToInt32(State) == Complete) ret = "已完成"; |
||||
|
if (Convert.ToInt32(State) == CompleteForce) ret = "强制完结"; |
||||
|
if (Convert.ToInt32(State) == Reject) ret = "已作废"; |
||||
|
|
||||
|
|
||||
|
return ret; |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
public class F_StateShip |
||||
|
{ |
||||
|
public static int New = 0; |
||||
|
public static int Ship = 1; |
||||
|
public static int Receive = 2; |
||||
|
public static int Reject = -1; |
||||
|
|
||||
|
public static string GetName(object State) |
||||
|
{ |
||||
|
string ret = ""; |
||||
|
|
||||
|
if (Convert.ToInt32(State) == New) ret = "新建"; |
||||
|
if (Convert.ToInt32(State) == Ship) ret = "已发货"; |
||||
|
if (Convert.ToInt32(State) == Receive) ret = "已收货"; |
||||
|
if (Convert.ToInt32(State) == Reject) ret = "已作废"; |
||||
|
|
||||
|
|
||||
|
return ret; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
||||
|
public class F_StateReceive |
||||
|
{ |
||||
|
public static int Receive = 0; |
||||
|
public static int Check = 1; |
||||
|
public static int Invoice = 2; |
||||
|
|
||||
|
public static string GetName(object State) |
||||
|
{ |
||||
|
string ret = ""; |
||||
|
|
||||
|
if (Convert.ToInt32(State) == Receive) ret = "已收货"; |
||||
|
if (Convert.ToInt32(State) == Check) ret = "审核通过"; |
||||
|
if (Convert.ToInt32(State) == Invoice) ret = "已开票"; |
||||
|
|
||||
|
return ret; |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public class F_StateReceiveType |
||||
|
{ |
||||
|
public static int Receive = 1; |
||||
|
public static int Return = 2; |
||||
|
|
||||
|
public static string GetName(object State) |
||||
|
{ |
||||
|
string ret = ""; |
||||
|
|
||||
|
if (Convert.ToInt32(State) == Receive) ret = "收货单"; |
||||
|
if (Convert.ToInt32(State) == Return) ret = "退货单"; |
||||
|
|
||||
|
return ret; |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public class F_StateInvoice |
||||
|
{ |
||||
|
public static int New = 0; |
||||
|
public static int Apply = 1; |
||||
|
public static int CheckFail = 2; |
||||
|
public static int CheckSuccess = 3; |
||||
|
public static int Mail = 4; |
||||
|
public static int FinanceReceive = 5; |
||||
|
public static int FinanceFail = 6; |
||||
|
public static int Reject = -1; |
||||
|
|
||||
|
public static string GetName(object State) |
||||
|
{ |
||||
|
string ret = ""; |
||||
|
|
||||
|
if (Convert.ToInt32(State) == New) ret = "新建"; |
||||
|
if (Convert.ToInt32(State) == Apply) ret = "供应商申请"; |
||||
|
if (Convert.ToInt32(State) == CheckFail) ret = "采购审核退回"; |
||||
|
if (Convert.ToInt32(State) == CheckSuccess) ret = "采购审核通过"; |
||||
|
if (Convert.ToInt32(State) == Mail) ret = "发票寄出"; |
||||
|
if (Convert.ToInt32(State) == FinanceFail) ret = "财务退回"; |
||||
|
if (Convert.ToInt32(State) == FinanceReceive) ret = "财务收票"; |
||||
|
if (Convert.ToInt32(State) == Reject) ret = "发票作废"; |
||||
|
|
||||
|
return ret; |
||||
|
} |
||||
|
|
||||
|
}*/ |
||||
|
} |
@ -0,0 +1,16 @@ |
|||||
|
using System.ComponentModel; |
||||
|
|
||||
|
namespace CK.SCP.Models.Enums |
||||
|
{ |
||||
|
public enum PortalType |
||||
|
{ |
||||
|
[Description("客户端")] |
||||
|
WinForm = 0, |
||||
|
[Description("网站")] |
||||
|
Web = 1, |
||||
|
[Description("手持")] |
||||
|
Pda = 2, |
||||
|
[Description("其它")] |
||||
|
Other = 3, |
||||
|
} |
||||
|
} |
@ -0,0 +1,12 @@ |
|||||
|
using System.ComponentModel; |
||||
|
|
||||
|
namespace CK.SCP.Models.Enums |
||||
|
{ |
||||
|
public enum PrintType |
||||
|
{ |
||||
|
[Description("直接打印")] |
||||
|
Print=0, |
||||
|
[Description("打印预览")] |
||||
|
PrintPreview=1 |
||||
|
} |
||||
|
} |
@ -0,0 +1,15 @@ |
|||||
|
using System.ComponentModel; |
||||
|
|
||||
|
namespace CK.SCP.Models.Enums |
||||
|
{ |
||||
|
public enum Project |
||||
|
{ |
||||
|
[Description("CKPT")] |
||||
|
X261CC = 0, |
||||
|
[Description("DP")] |
||||
|
X261CDC = 1, |
||||
|
[Description("CNSL")] |
||||
|
X261CCC = 2, |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,16 @@ |
|||||
|
namespace CK.SCP.Models.Enums |
||||
|
{ |
||||
|
public enum ProjectName |
||||
|
{ |
||||
|
锦州锦恒, |
||||
|
常熟安通林, |
||||
|
常熟安通林海虞专用, |
||||
|
天津安通林, |
||||
|
成都安通林, |
||||
|
|
||||
|
天津迪安, |
||||
|
长春繁荣, |
||||
|
重庆北汽模塑, |
||||
|
江苏锦恒, |
||||
|
} |
||||
|
} |
@ -0,0 +1,12 @@ |
|||||
|
using System.ComponentModel; |
||||
|
|
||||
|
namespace CK.SCP.Models.Enums |
||||
|
{ |
||||
|
public enum ReceiveBillType |
||||
|
{ |
||||
|
[Description("收货单")] |
||||
|
Receive = 1, |
||||
|
[Description("退货单")] |
||||
|
Reject = 2, |
||||
|
} |
||||
|
} |
@ -0,0 +1,14 @@ |
|||||
|
using System.ComponentModel; |
||||
|
|
||||
|
namespace CK.SCP.Models.Enums |
||||
|
{ |
||||
|
public enum ReceiveState |
||||
|
{ |
||||
|
[Description("已收货")] |
||||
|
Receive = 0, |
||||
|
[Description("审核通过")] |
||||
|
Check = 1, |
||||
|
[Description("待开票")] |
||||
|
Invoice = 2, |
||||
|
} |
||||
|
} |
@ -0,0 +1,32 @@ |
|||||
|
using System.ComponentModel; |
||||
|
|
||||
|
namespace CK.SCP.Models.Enums |
||||
|
{ |
||||
|
public enum ResultCode |
||||
|
{ |
||||
|
[Description("成功")] |
||||
|
Success = 0, |
||||
|
[Description("警告")] |
||||
|
Warning = 1, |
||||
|
[Description("连接错误")] |
||||
|
ErrorConnection = 1001, |
||||
|
[Description("未找到数据")] |
||||
|
DataNotFound = 2001, |
||||
|
[Description("数据已存在")] |
||||
|
DataAlreadyExist = 2002, |
||||
|
[Description("数据状态错误")] |
||||
|
DataStateError = 2003, |
||||
|
[Description("数量错误")] |
||||
|
DataQtyError=2004, |
||||
|
|
||||
|
[Description("发现新零件")] |
||||
|
NewCustPart = 4001, |
||||
|
[Description("系统错误")] |
||||
|
Exception=-1, |
||||
|
[Description("数据校验失败")] |
||||
|
DbEntityValidationException=-2, |
||||
|
|
||||
|
[Description("库存不足")] |
||||
|
StockNotEnough, |
||||
|
} |
||||
|
} |
@ -0,0 +1,52 @@ |
|||||
|
namespace CK.SCP.Models.Enums |
||||
|
{ |
||||
|
public enum ServiceType |
||||
|
{ |
||||
|
GetConfigList, |
||||
|
GetWhseList, |
||||
|
GetAreaList, |
||||
|
GetGroupList, |
||||
|
GetLocList, |
||||
|
GetPartList, |
||||
|
GetVendPartList, |
||||
|
GetCustPartList, |
||||
|
GetSupplierList, |
||||
|
GetCustomerList, |
||||
|
GetShiftList, |
||||
|
GetTeamList, |
||||
|
GetWorklineList, |
||||
|
GetBomList, |
||||
|
|
||||
|
GetBarcode, |
||||
|
|
||||
|
GetLocByLocCode, |
||||
|
GetPartByPartCode, |
||||
|
GetPartByErpPartCode, |
||||
|
GetCustPartByCustPartCode, |
||||
|
GetPoByCode, |
||||
|
GetAsnByCode, |
||||
|
GetProducePlanByCode, |
||||
|
GetSoByCode, |
||||
|
GetEqptByCode, |
||||
|
|
||||
|
GetStock, |
||||
|
GetStockList, |
||||
|
|
||||
|
GetBill, |
||||
|
GetBillList, |
||||
|
GetSourceBill, |
||||
|
|
||||
|
AddBill, |
||||
|
StartBill, |
||||
|
|
||||
|
InventoryLoc, |
||||
|
FinishBill, |
||||
|
GetInventoryLoc, |
||||
|
GetStockDetailList, |
||||
|
CancelBill, |
||||
|
GetOtscById, |
||||
|
GetPdaPowerMenu, |
||||
|
GetSubBillTypeList, |
||||
|
UnlockLoc |
||||
|
} |
||||
|
} |
@ -0,0 +1,16 @@ |
|||||
|
using System.ComponentModel; |
||||
|
|
||||
|
namespace CK.SCP.Models.Enums |
||||
|
{ |
||||
|
public enum ShipState |
||||
|
{ |
||||
|
[Description("新建")] |
||||
|
New = 0, |
||||
|
[Description("已发货")] |
||||
|
Ship =1, |
||||
|
[Description("已收货")] |
||||
|
Receive = 2, |
||||
|
[Description("已作废")] |
||||
|
Reject = -1, |
||||
|
} |
||||
|
} |
@ -0,0 +1,18 @@ |
|||||
|
using System.ComponentModel; |
||||
|
|
||||
|
namespace CK.SCP.Models.Enums |
||||
|
{ |
||||
|
public enum StockState |
||||
|
{ |
||||
|
[Description("待检")] |
||||
|
Inspect=0, |
||||
|
[Description("合格")] |
||||
|
Valid = 1, |
||||
|
[Description("不合格")] |
||||
|
InValid = 2, |
||||
|
[Description("过期")] |
||||
|
Overdue = 3, |
||||
|
[Description("待判定")] |
||||
|
Hold = 4, |
||||
|
} |
||||
|
} |
@ -0,0 +1,11 @@ |
|||||
|
namespace CK.SCP.Models.Enums |
||||
|
{ |
||||
|
public enum StockWhereType |
||||
|
{ |
||||
|
BarCode, |
||||
|
LocCode, |
||||
|
BarCodeAndLocCode, |
||||
|
EqptCode, |
||||
|
PartCode |
||||
|
} |
||||
|
} |
@ -0,0 +1,26 @@ |
|||||
|
using System.ComponentModel; |
||||
|
|
||||
|
namespace CK.SCP.Models.Enums |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 停线类型。也就是停线原因。
|
||||
|
/// </summary>
|
||||
|
public enum StopLineType |
||||
|
{ |
||||
|
[Description("质量问题")] QA = 1, |
||||
|
[Description("设备问题")] EQ = 2, |
||||
|
[Description("缺料")] Mat = 3, |
||||
|
[Description("工艺设计问题")] ProcessDesign = 4, |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 停线事故等级。枚举值必须从小到大排列.以后要改的话,必须注意。要逐级触发系统动作的。
|
||||
|
/// </summary>
|
||||
|
public enum StopLineLevel |
||||
|
{ |
||||
|
[Description("轻度")] Minimum = 100, |
||||
|
[Description("一般")] Commonly = 200, |
||||
|
[Description("严重")] Serious = 300, |
||||
|
[Description("重大")] Weighty = 400, |
||||
|
} |
||||
|
} |
@ -0,0 +1,32 @@ |
|||||
|
using System.ComponentModel; |
||||
|
|
||||
|
namespace CK.SCP.Models.Enums |
||||
|
{ |
||||
|
public enum StoreArea |
||||
|
{ |
||||
|
[Description("原料库")] |
||||
|
RAW=11, |
||||
|
[Description("线边库")] |
||||
|
WIP=21, |
||||
|
[Description("成品库")] |
||||
|
FG=12, |
||||
|
[Description("销售库")] |
||||
|
SALE=13, |
||||
|
[Description("隔离库")] |
||||
|
HOLD=22, |
||||
|
[Description("在途库")] |
||||
|
ROAD=14, |
||||
|
[Description("其它库")] |
||||
|
OTHER=15, |
||||
|
[Description("废品库")] |
||||
|
SCRAP=23, |
||||
|
[Description("半成品库")] |
||||
|
HF=16, |
||||
|
[Description("待检库")] |
||||
|
INSPECT=0, |
||||
|
[Description("委外库")] |
||||
|
OS = 17, |
||||
|
[Description("备品库")] |
||||
|
AST |
||||
|
} |
||||
|
} |
@ -0,0 +1,56 @@ |
|||||
|
using System.ComponentModel; |
||||
|
|
||||
|
namespace CK.SCP.Models.Enums |
||||
|
{ |
||||
|
public enum SubBillType |
||||
|
{ |
||||
|
//其它出入库-出库
|
||||
|
[Description("其它出库")] |
||||
|
OtherOut = 30101, |
||||
|
//[Description("原料退货")]
|
||||
|
//ReturnToSupplier=30102,
|
||||
|
[Description("盘盈单")] |
||||
|
InventoryProfit = 30103, |
||||
|
[Description("报废销毁")] |
||||
|
ScrapDestroy=30104, |
||||
|
|
||||
|
//其它出入库-入库
|
||||
|
[Description("其它入库")] |
||||
|
OtherIn = 30111, |
||||
|
//[Description("销售退货")]
|
||||
|
//ProductReturn=30112,
|
||||
|
[Description("盘亏单")] |
||||
|
InventoryLoss=30113, |
||||
|
|
||||
|
//其它出入库-移库
|
||||
|
[Description("成品隔离")] |
||||
|
ProductUndecide = 30131, |
||||
|
//[Description("成品返修")]
|
||||
|
//ProductRepair = 30132,
|
||||
|
[Description("成品报废")] |
||||
|
ProductScrap = 30133, |
||||
|
//[Description("生产退库")]
|
||||
|
//BackToStore = 30134,
|
||||
|
|
||||
|
|
||||
|
//移库
|
||||
|
[Description("移库单")] |
||||
|
StockMove = 30201, |
||||
|
[Description("原料入库单")] |
||||
|
MaterialStockIn = 30202, |
||||
|
[Description("成品入库单")] |
||||
|
ProductStockIn = 30203, |
||||
|
[Description("成品出库单")] |
||||
|
ProductStockOut = 30204, |
||||
|
[Description("原料出库单")] |
||||
|
PartPickFact = 30205, |
||||
|
|
||||
|
|
||||
|
//采购收货
|
||||
|
[Description("订单收货单")] |
||||
|
PoReceive = 10101, |
||||
|
[Description("ASN收货单")] |
||||
|
AsnReceive = 10102, |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,10 @@ |
|||||
|
namespace CK.SCP.Models.Enums |
||||
|
{ |
||||
|
public enum UniApiState |
||||
|
{ |
||||
|
待执行 = 0, |
||||
|
成功 = 1, |
||||
|
失败 = 2, |
||||
|
其它 = 9, |
||||
|
} |
||||
|
} |
@ -0,0 +1,17 @@ |
|||||
|
using System.ComponentModel; |
||||
|
|
||||
|
namespace CK.SCP.Models.Enums |
||||
|
{ |
||||
|
public enum UniApiType |
||||
|
{ |
||||
|
[Description("订单")] |
||||
|
PO, |
||||
|
[Description("收货")] |
||||
|
Receive, |
||||
|
[Description("条码")] |
||||
|
BarCode, |
||||
|
[Description("发票")] |
||||
|
Invoice, |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,22 @@ |
|||||
|
using System.ComponentModel; |
||||
|
|
||||
|
namespace CK.SCP.Models.Enums |
||||
|
{ |
||||
|
public enum VinState |
||||
|
{ |
||||
|
[Description("已收货")] |
||||
|
Received = 0, |
||||
|
[Description("部分收货")] |
||||
|
Partial = 111, |
||||
|
[Description("已发货")] |
||||
|
Delivered = 222, |
||||
|
[Description("销售中")] |
||||
|
Selling = 300, |
||||
|
[Description("已销售")] |
||||
|
Sold = 333, |
||||
|
[Description("已比对")] |
||||
|
Balanced = 999, |
||||
|
[Description("不存在数据")] |
||||
|
DataNotFound = -1, |
||||
|
} |
||||
|
} |
@ -0,0 +1,12 @@ |
|||||
|
using System.ComponentModel; |
||||
|
|
||||
|
namespace CK.SCP.Models.Enums |
||||
|
{ |
||||
|
public enum WhseType |
||||
|
{ |
||||
|
[Description("生产仓库")] |
||||
|
ProduceWhse = 0, |
||||
|
[Description("第三方仓库")] |
||||
|
ThirdWhse = 1, |
||||
|
} |
||||
|
} |
@ -0,0 +1,11 @@ |
|||||
|
using System.ComponentModel; |
||||
|
|
||||
|
namespace CK.SCP.Models.Enums |
||||
|
{ |
||||
|
public enum WorkLineType |
||||
|
{ |
||||
|
[Description("×é×°Ïß")] |
||||
|
Assemble = 0, |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,62 @@ |
|||||
|
using System; |
||||
|
using CK.SCP.Utils; |
||||
|
namespace CK.SCP.Models |
||||
|
{ |
||||
|
|
||||
|
public static class GlobalConfig |
||||
|
{ |
||||
|
public const string ScpDbFileName = "Scp数据库设置.ini"; |
||||
|
public const string AppBoxDbFileName = "AppBox数据库设置.ini"; |
||||
|
public const string UniApiDbFileName = "接口数据库设置.ini"; |
||||
|
public const string UniApiConfigFileName = "ERP接口设置.ini"; |
||||
|
public const string DurationFileName = "执行周期设置.ini"; |
||||
|
public const string UpdateFileName = "自动更新设置.ini"; |
||||
|
|
||||
|
|
||||
|
|
||||
|
private static DbSetting _scpDatabase; |
||||
|
private static DbSetting _appboxDatabase; |
||||
|
private static DbSetting _uniApiDatabase; |
||||
|
|
||||
|
|
||||
|
public static DbSetting ScpDatabase |
||||
|
{ |
||||
|
get { return _scpDatabase ?? (_scpDatabase = GetConfigValues<DbSetting>(ScpDbFileName)); } |
||||
|
|
||||
|
set { _scpDatabase = value; } |
||||
|
} |
||||
|
|
||||
|
public static DbSetting AppBoxDatabase |
||||
|
{ |
||||
|
get { return _appboxDatabase ?? (_appboxDatabase = GetConfigValues<DbSetting>(AppBoxDbFileName)); } |
||||
|
|
||||
|
set { _appboxDatabase = value; } |
||||
|
} |
||||
|
|
||||
|
public static DbSetting UniApiDatabase |
||||
|
{ |
||||
|
get { return _uniApiDatabase ?? (_uniApiDatabase = GetConfigValues<DbSetting>(UniApiDbFileName)); } |
||||
|
|
||||
|
set { _uniApiDatabase = value; } |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
public static T GetConfigValues<T>(string filename) where T : new() |
||||
|
{ |
||||
|
T t = new T(); |
||||
|
if (FileHelper.Exists(filename)) |
||||
|
{ |
||||
|
t = JsonHelper.ReadConfigFromFile<T>(filename); |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
throw new Exception($"配置文件{filename}丢失,请重新配置"); |
||||
|
} |
||||
|
|
||||
|
return t; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,36 @@ |
|||||
|
using System.Reflection; |
||||
|
using System.Runtime.CompilerServices; |
||||
|
using System.Runtime.InteropServices; |
||||
|
|
||||
|
// 有关程序集的一般信息由以下
|
||||
|
// 控制。更改这些特性值可修改
|
||||
|
// 与程序集关联的信息。
|
||||
|
[assembly: AssemblyTitle("CK.SCP.Models")] |
||||
|
[assembly: AssemblyDescription("")] |
||||
|
[assembly: AssemblyConfiguration("")] |
||||
|
[assembly: AssemblyCompany("Microsoft")] |
||||
|
[assembly: AssemblyProduct("CK.SCP.Models")] |
||||
|
[assembly: AssemblyCopyright("Copyright © Microsoft 2018")] |
||||
|
[assembly: AssemblyTrademark("")] |
||||
|
[assembly: AssemblyCulture("")] |
||||
|
|
||||
|
//将 ComVisible 设置为 false 将使此程序集中的类型
|
||||
|
//对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
|
||||
|
//请将此类型的 ComVisible 特性设置为 true。
|
||||
|
[assembly: ComVisible(false)] |
||||
|
|
||||
|
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
|
||||
|
[assembly: Guid("dd7c0def-71e7-443f-b0b7-db2f5b12a506")] |
||||
|
|
||||
|
// 程序集的版本信息由下列四个值组成:
|
||||
|
//
|
||||
|
// 主版本
|
||||
|
// 次版本
|
||||
|
// 生成号
|
||||
|
// 修订号
|
||||
|
//
|
||||
|
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
|
||||
|
// 方法是按如下所示使用“*”: :
|
||||
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||
|
[assembly: AssemblyVersion("1.0.0.0")] |
||||
|
[assembly: AssemblyFileVersion("1.0.0.0")] |
@ -0,0 +1,50 @@ |
|||||
|
using System; |
||||
|
using System.Text; |
||||
|
using CK.SCP.Models.Enums; |
||||
|
using CK.SCP.Utils; |
||||
|
|
||||
|
namespace CK.SCP.Models |
||||
|
{ |
||||
|
[Serializable] //声明为可序列化的 因为要写入文件中
|
||||
|
public class ScpException : ApplicationException //由用户程序引发,用于派生自定义的异常类型
|
||||
|
{ |
||||
|
private const string SP = ";"; |
||||
|
// private ResultCode _code;
|
||||
|
// private string _indexString;
|
||||
|
public ResultCode Code { get; set; } |
||||
|
public string IndexString { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 默认构造函数
|
||||
|
/// </summary>
|
||||
|
public ScpException() |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
public ScpException(ResultCode code, string indexString = null, string message = null, ScpException inner = null) |
||||
|
: base(message, inner) |
||||
|
{ |
||||
|
Code = code; |
||||
|
IndexString = indexString; |
||||
|
} |
||||
|
|
||||
|
public ScpException(string message) |
||||
|
{ |
||||
|
// throw new NotImplementedException();
|
||||
|
} |
||||
|
|
||||
|
// public WmsException(System.Runtime.Serialization.SerializationInfo info,
|
||||
|
// System.Runtime.Serialization.StreamingContext context) : base(info, context)
|
||||
|
// {
|
||||
|
// _indexString = info.GetString(IndexString);
|
||||
|
// }
|
||||
|
public override string ToString() |
||||
|
{ |
||||
|
StringBuilder sb = new StringBuilder(); |
||||
|
sb.Append(EnumHelper.GetDescription(Code) + SP); |
||||
|
sb.Append(IndexString + SP); |
||||
|
sb.Append(Message + SP); |
||||
|
return sb.ToString(); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,193 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Reflection; |
||||
|
using CK.SCP.Models.AppBoxEntity; |
||||
|
using CK.SCP.Models.Enums; |
||||
|
using CK.SCP.Models.ScpEntity; |
||||
|
using CK.SCP.Utils; |
||||
|
|
||||
|
namespace CK.SCP.Models |
||||
|
{ |
||||
|
public static class ScpCache |
||||
|
{ |
||||
|
private static readonly ScpEntities ScpDb = EntitiesFactory.CreateScpInstance(); |
||||
|
private static readonly AppBoxContext Db = EntitiesFactory.CreateAppBoxInstance(); |
||||
|
|
||||
|
private static List<TA_VENDER> _vendList; |
||||
|
private static List<TA_PART> _PartList; |
||||
|
private static List<User> _usersList; |
||||
|
private static List<TB_RECEIVE> _ReceiveList; |
||||
|
|
||||
|
|
||||
|
|
||||
|
private static ScpConfig _config; |
||||
|
public static ScpConfig Config |
||||
|
|
||||
|
{ |
||||
|
get { return _config ?? (_config = GetConfig(ScpDb)); } |
||||
|
set { _config = value; } |
||||
|
} |
||||
|
|
||||
|
private static ScpConfig GetConfig(ScpEntities db) |
||||
|
{ |
||||
|
var config = new ScpConfig(); |
||||
|
var peroperties = config.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance); |
||||
|
var configList = GetDbConfigList(db); |
||||
|
foreach (var pi in peroperties) |
||||
|
{ |
||||
|
var piName = pi.Name.ToUpper(); |
||||
|
foreach (var cfg in configList) |
||||
|
{ |
||||
|
if (cfg.ParamName != piName) continue; |
||||
|
var value = ListHelper.ConvertToType(cfg.ParamValue, pi.PropertyType); |
||||
|
if (!pi.CanWrite) continue; |
||||
|
try |
||||
|
{ |
||||
|
pi.SetValue(config, value, null); |
||||
|
break; |
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
MessageHelper.ShowError(ex); |
||||
|
throw; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
return config; |
||||
|
} |
||||
|
|
||||
|
private static void SetConfig(ScpEntities db, ScpConfig config) |
||||
|
{ |
||||
|
|
||||
|
var peroperties = config.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance); |
||||
|
var configList = GetDbConfigList(db); |
||||
|
foreach (var pi in peroperties) |
||||
|
{ |
||||
|
var piName = pi.Name.ToUpper(); |
||||
|
if (configList.Any(p => p.ParamName.ToUpper() == piName)) continue; |
||||
|
var cfg = new TA_CONFIG |
||||
|
{ |
||||
|
ParamName = piName, |
||||
|
ParamValue = pi.GetValue(Config, null).ToString(), |
||||
|
State = 1, |
||||
|
Remark = piName, |
||||
|
}; |
||||
|
db.TA_CONFIG.Add(cfg); |
||||
|
} |
||||
|
EntitiesFactory.SaveDb(db); |
||||
|
} |
||||
|
|
||||
|
public static List<TA_CONFIG> GetDbConfigList(ScpEntities db) |
||||
|
{ |
||||
|
return db.TA_CONFIG.OrderByDescending(p => p.UID).ToList(); |
||||
|
} |
||||
|
public static void Refresh(ScpEntities db) |
||||
|
{ |
||||
|
try |
||||
|
{ |
||||
|
Config = GetConfig(db); |
||||
|
SetConfig(db, Config); |
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
|
||||
|
throw new Exception( |
||||
|
$"系统无法连接到{GlobalConfig.ScpDatabase.数据库类型}数据库:{GlobalConfig.ScpDatabase.服务器地址},请检查配置的服务器,数据库,用户名和密码等信息是否正确。"); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public static string GetVendName(string vendId) |
||||
|
{ |
||||
|
return VenderList.SingleOrDefault(p => p.VendId == vendId)?.VendName ?? string.Empty; |
||||
|
} |
||||
|
public static string GetVendIDByUser(string name) |
||||
|
{ |
||||
|
return UsersList.SingleOrDefault(p => p.Name == name)?.SupplierCode ?? string.Empty; |
||||
|
} |
||||
|
public static string GetPartDesc(string wmsDataPartCode) |
||||
|
{ |
||||
|
return ""; |
||||
|
} |
||||
|
|
||||
|
public static DateTime GetServerTime() |
||||
|
{ |
||||
|
return DateTime.Now; |
||||
|
} |
||||
|
public static List<TA_VENDER> VenderList |
||||
|
{ |
||||
|
get |
||||
|
{ |
||||
|
if (_vendList == null || _vendList.Count == 0) |
||||
|
{ |
||||
|
_vendList = ScpDb.TA_VENDER.ToList(); |
||||
|
} |
||||
|
return _vendList; |
||||
|
} |
||||
|
set { _vendList = value; } |
||||
|
} |
||||
|
public static List<User> UsersList |
||||
|
{ |
||||
|
get |
||||
|
{ |
||||
|
if (_usersList == null || _usersList.Count == 0) |
||||
|
{ |
||||
|
_usersList = Db.Users.ToList(); |
||||
|
} |
||||
|
return _usersList; |
||||
|
} |
||||
|
set { _usersList = value; } |
||||
|
} |
||||
|
public static List<TA_PART> PartList |
||||
|
{ |
||||
|
get |
||||
|
{ |
||||
|
if (_PartList == null || _PartList.Count == 0) |
||||
|
{ |
||||
|
_PartList = ScpDb.TA_PART.ToList(); |
||||
|
} |
||||
|
return _PartList; |
||||
|
} |
||||
|
set { _PartList = value; } |
||||
|
} |
||||
|
public static string GetPartDesc1(string partCode) |
||||
|
{ |
||||
|
return PartList.SingleOrDefault(p => p.PartCode == partCode)?.PartDesc1 ?? string.Empty; |
||||
|
} |
||||
|
public static List<TB_RECEIVE> ReceiveList |
||||
|
{ |
||||
|
get |
||||
|
{ |
||||
|
if (_ReceiveList == null || _ReceiveList.Count == 0) |
||||
|
{ |
||||
|
_ReceiveList = ScpDb.TB_RECEIVE.ToList(); |
||||
|
} |
||||
|
return _ReceiveList; |
||||
|
} |
||||
|
set { _ReceiveList = value; } |
||||
|
} |
||||
|
public static string GetReceivePoBillNum(string billnum) |
||||
|
{ |
||||
|
return ReceiveList.SingleOrDefault(p => p.BillNum == billnum)?.PoBillNum ?? string.Empty; |
||||
|
} |
||||
|
public static string GetReceiveAsnBillNum(string billnum) |
||||
|
{ |
||||
|
return ReceiveList.SingleOrDefault(p => p.BillNum == billnum)?.AsnBillNum ?? string.Empty; |
||||
|
} |
||||
|
} |
||||
|
public class ScpConfig |
||||
|
{ |
||||
|
public string QAD域 { get; set; } = "JZ1"; |
||||
|
public string QAD地点 { get; set; } = "0100"; |
||||
|
public string WMS接口数据流水号格式 { get; set; } = "yyMMdd_HHmmssffff"; |
||||
|
|
||||
|
public string 项目名称 { get; set; } = "锦恒项目"; |
||||
|
public string WMS用户名 { get; set; } = "W"; |
||||
|
|
||||
|
public string SCP用户名 { get; set; } = "SCP"; |
||||
|
public string SCP接口数据流水号格式 { get; set; } = "yyMMdd_HHmmssffff"; |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,258 @@ |
|||||
|
using System.Data.Entity; |
||||
|
using CK.SCP.Models.ScpEntity; |
||||
|
|
||||
|
namespace CK.SCP.Models |
||||
|
{ |
||||
|
|
||||
|
|
||||
|
public class SqlDbConfiguration : DbConfiguration |
||||
|
{ |
||||
|
public SqlDbConfiguration() |
||||
|
{ |
||||
|
this.SetManifestTokenResolver(new Sql2008ManifestTokenResolver()); |
||||
|
} |
||||
|
} |
||||
|
public class Sql2008ManifestTokenResolver : System.Data.Entity.Infrastructure.IManifestTokenResolver |
||||
|
{ |
||||
|
public string ResolveManifestToken(System.Data.Common.DbConnection connection) |
||||
|
{ |
||||
|
return "2008"; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public partial class ScpEntities : DbContext |
||||
|
{ |
||||
|
public ScpEntities() |
||||
|
: base("name=ScpEntities") |
||||
|
{ |
||||
|
} |
||||
|
public ScpEntities(string strConn) |
||||
|
: base(strConn) |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
public virtual DbSet<TA_BILLTYPE> TA_BILLTYPE { get; set; } |
||||
|
public virtual DbSet<TA_CONFIG> TA_CONFIG { get; set; } |
||||
|
public virtual DbSet<TA_PART> TA_PART { get; set; } |
||||
|
public virtual DbSet<TA_VEND_PART> TA_VEND_PART { get; set; } |
||||
|
public virtual DbSet<TA_VENDER> TA_VENDER { get; set; } |
||||
|
public virtual DbSet<TB_INVOICE> TB_INVOICE { get; set; } |
||||
|
public virtual DbSet<TB_INVOICE_DETAIL> TB_INVOICE_DETAIL { get; set; } |
||||
|
public virtual DbSet<TB_RECEIVE> TB_RECEIVE { get; set; } |
||||
|
public virtual DbSet<TB_RECEIVE_DETAIL> TB_RECEIVE_DETAIL { get; set; } |
||||
|
public virtual DbSet<TB_RETURN> TB_RETURN { get; set; } |
||||
|
public virtual DbSet<TB_RETURN_DETAIL> TB_RETURN_DETAIL { get; set; } |
||||
|
public virtual DbSet<TF_ASN> TF_ASN { get; set; } |
||||
|
public virtual DbSet<TF_ASN_DETAIL> TF_ASN_DETAIL { get; set; } |
||||
|
public virtual DbSet<TF_PO> TF_PO { get; set; } |
||||
|
public virtual DbSet<TF_PO_DETAIL> TF_PO_DETAIL { get; set; } |
||||
|
public virtual DbSet<TL_BASEDATA> TL_BASEDATA { get; set; } |
||||
|
public virtual DbSet<TL_BILL> TL_BILL { get; set; } |
||||
|
public virtual DbSet<TL_OPER> TL_OPER { get; set; } |
||||
|
public virtual DbSet<TS_BARCODE> TS_BARCODE { get; set; } |
||||
|
public virtual DbSet<TS_STOCK> TS_STOCK { get; set; } |
||||
|
public virtual DbSet<TS_UNI_API> TS_UNI_API { get; set; } |
||||
|
public virtual DbSet<TS_UNI_API_HIS> TS_UNI_API_HIS { get; set; } |
||||
|
public virtual DbSet<TT_CURRENCY> TT_CURRENCY { get; set; } |
||||
|
public virtual DbSet<TT_PROJECT> TT_PROJECT { get; set; } |
||||
|
|
||||
|
public virtual DbSet<TT_UNIT> TT_UNIT { get; set; } |
||||
|
public virtual DbSet<V_POAll> V_POAll { get; set; } |
||||
|
public virtual DbSet<V_POAllDetail> V_POAllDetail { get; set; } |
||||
|
|
||||
|
public virtual DbSet<V_BillShip> V_BillShip { get; set; } |
||||
|
public virtual DbSet<V_Receive> V_Receive { get; set; } |
||||
|
|
||||
|
public virtual DbSet<V_BillShipDetail> V_BillShipDetail { get; set; } |
||||
|
public virtual DbSet<V_ReceiveDetail> V_ReceiveDetail { get; set; } |
||||
|
public virtual DbSet<V_BillInvoice> V_BillInvoice { get; set; } |
||||
|
|
||||
|
public virtual DbSet<V_BillInvoiceDetail> V_BillInvoiceDetail { get; set; } |
||||
|
|
||||
|
public virtual DbSet<V_POReport> V_POReport { get; set; } |
||||
|
public virtual DbSet<V_ReceiveReport> V_ReceiveReport { get; set; } |
||||
|
public virtual DbSet<V_QadOrder> V_QadOrder { get; set; } |
||||
|
public virtual DbSet<TB_QadOrder> TB_QadOrder { get; set; } |
||||
|
public virtual DbSet<TB_QadOrderDetail> TB_QadOrderDetail { get; set; } |
||||
|
|
||||
|
|
||||
|
public virtual DbSet<V_PlanMonth> V_PlanMonth { get; set; } |
||||
|
public virtual DbSet<TB_PlanMonth> TB_PlanMonth { get; set; } |
||||
|
public virtual DbSet<V_Stock> V_Stock { get; set; } |
||||
|
public virtual DbSet<V_Info> V_Info { get; set; } |
||||
|
public virtual DbSet<TA_Info> TA_Info { get; set; } |
||||
|
public virtual DbSet<TB_PublicData> TB_PublicData { get; set; } |
||||
|
public virtual DbSet<TA_BillNoType> TA_BillNoType { get; set; } |
||||
|
public virtual DbSet<TA_VEND_USER> TA_VEND_USER { get; set; } |
||||
|
public virtual DbSet<TA_Part_User> TA_Part_User { get; set; } |
||||
|
// public virtual DbSet<V_ReceiveList> V_ReceiveList { get; set; }
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
protected override void OnModelCreating(DbModelBuilder modelBuilder) |
||||
|
{ |
||||
|
modelBuilder.Entity<TA_BILLTYPE>() |
||||
|
.Property(e => e.Sep) |
||||
|
.IsUnicode(false); |
||||
|
|
||||
|
modelBuilder.Entity<TA_PART>() |
||||
|
.Property(e => e.State) |
||||
|
.IsUnicode(false); |
||||
|
|
||||
|
modelBuilder.Entity<TA_VEND_PART>() |
||||
|
.Property(e => e.VendPackQty) |
||||
|
.HasPrecision(18, 5); |
||||
|
|
||||
|
modelBuilder.Entity<TA_VENDER>() |
||||
|
.Property(e => e.VendAbbCode) |
||||
|
.IsUnicode(false); |
||||
|
|
||||
|
modelBuilder.Entity<TB_INVOICE_DETAIL>() |
||||
|
.Property(e => e.Qty) |
||||
|
.HasPrecision(19, 4); |
||||
|
|
||||
|
modelBuilder.Entity<TB_INVOICE_DETAIL>() |
||||
|
.Property(e => e.Price) |
||||
|
.HasPrecision(19, 4); |
||||
|
|
||||
|
modelBuilder.Entity<TB_INVOICE_DETAIL>() |
||||
|
.Property(e => e.PackQty) |
||||
|
.HasPrecision(19, 4); |
||||
|
|
||||
|
modelBuilder.Entity<TB_RECEIVE_DETAIL>() |
||||
|
.Property(e => e.BillQty) |
||||
|
.HasPrecision(19, 4); |
||||
|
|
||||
|
modelBuilder.Entity<TB_RECEIVE_DETAIL>() |
||||
|
.Property(e => e.ReceivedQty) |
||||
|
.HasPrecision(19, 4); |
||||
|
|
||||
|
modelBuilder.Entity<TB_RECEIVE_DETAIL>() |
||||
|
.Property(e => e.Price) |
||||
|
.HasPrecision(19, 4); |
||||
|
|
||||
|
|
||||
|
|
||||
|
modelBuilder.Entity<TB_RETURN_DETAIL>() |
||||
|
.Property(e => e.BillQty) |
||||
|
.HasPrecision(19, 4); |
||||
|
|
||||
|
modelBuilder.Entity<TB_RETURN_DETAIL>() |
||||
|
.Property(e => e.ReceivedQty) |
||||
|
.HasPrecision(19, 4); |
||||
|
|
||||
|
modelBuilder.Entity<TB_RETURN_DETAIL>() |
||||
|
.Property(e => e.Price) |
||||
|
.HasPrecision(19, 4); |
||||
|
|
||||
|
modelBuilder.Entity<TB_RETURN_DETAIL>() |
||||
|
.Property(e => e.PackQty) |
||||
|
.HasPrecision(19, 4); |
||||
|
|
||||
|
modelBuilder.Entity<TF_ASN_DETAIL>() |
||||
|
.Property(e => e.BillQty) |
||||
|
.HasPrecision(19, 4); |
||||
|
|
||||
|
modelBuilder.Entity<TF_ASN_DETAIL>() |
||||
|
.Property(e => e.Price) |
||||
|
.HasPrecision(19, 4); |
||||
|
|
||||
|
modelBuilder.Entity<TF_ASN_DETAIL>() |
||||
|
.Property(e => e.PackQty) |
||||
|
.HasPrecision(19, 4); |
||||
|
|
||||
|
modelBuilder.Entity<TF_PO_DETAIL>() |
||||
|
.Property(e => e.BillQty) |
||||
|
.HasPrecision(19, 4); |
||||
|
|
||||
|
modelBuilder.Entity<TF_PO_DETAIL>() |
||||
|
.Property(e => e.ShippedQty) |
||||
|
.HasPrecision(19, 4); |
||||
|
|
||||
|
modelBuilder.Entity<TF_PO_DETAIL>() |
||||
|
.Property(e => e.ReceivedQty) |
||||
|
.HasPrecision(19, 4); |
||||
|
|
||||
|
modelBuilder.Entity<TF_PO_DETAIL>() |
||||
|
.Property(e => e.Price) |
||||
|
.HasPrecision(19, 4); |
||||
|
|
||||
|
modelBuilder.Entity<TF_PO_DETAIL>() |
||||
|
.Property(e => e.PackQty) |
||||
|
.HasPrecision(19, 4); |
||||
|
|
||||
|
modelBuilder.Entity<TL_BASEDATA>() |
||||
|
.Property(e => e.LogType) |
||||
|
.IsUnicode(false); |
||||
|
|
||||
|
modelBuilder.Entity<TL_BASEDATA>() |
||||
|
.Property(e => e.DataType) |
||||
|
.IsUnicode(false); |
||||
|
|
||||
|
modelBuilder.Entity<TL_OPER>() |
||||
|
.Property(e => e.LogType) |
||||
|
.IsUnicode(false); |
||||
|
|
||||
|
modelBuilder.Entity<TS_BARCODE>() |
||||
|
.Property(e => e.BarCode) |
||||
|
.IsUnicode(false); |
||||
|
|
||||
|
modelBuilder.Entity<TS_BARCODE>() |
||||
|
.Property(e => e.FullBarCode) |
||||
|
.IsUnicode(false); |
||||
|
|
||||
|
modelBuilder.Entity<TS_BARCODE>() |
||||
|
.Property(e => e.PartCode) |
||||
|
.IsUnicode(false); |
||||
|
|
||||
|
modelBuilder.Entity<TS_BARCODE>() |
||||
|
.Property(e => e.VendPartCode) |
||||
|
.IsUnicode(false); |
||||
|
|
||||
|
modelBuilder.Entity<TS_BARCODE>() |
||||
|
.Property(e => e.Batch) |
||||
|
.IsUnicode(false); |
||||
|
|
||||
|
modelBuilder.Entity<TS_BARCODE>() |
||||
|
.Property(e => e.ProduceDate) |
||||
|
.HasPrecision(3); |
||||
|
|
||||
|
modelBuilder.Entity<TS_BARCODE>() |
||||
|
.Property(e => e.SerialNum) |
||||
|
.IsUnicode(false); |
||||
|
|
||||
|
modelBuilder.Entity<TS_BARCODE>() |
||||
|
.Property(e => e.Qty) |
||||
|
.HasPrecision(19, 4); |
||||
|
|
||||
|
modelBuilder.Entity<TS_BARCODE>() |
||||
|
.Property(e => e.BillNum) |
||||
|
.IsUnicode(false); |
||||
|
|
||||
|
modelBuilder.Entity<TS_BARCODE>() |
||||
|
.Property(e => e.VendId) |
||||
|
.IsUnicode(false); |
||||
|
|
||||
|
modelBuilder.Entity<TS_BARCODE>() |
||||
|
.Property(e => e.PackQty) |
||||
|
.HasPrecision(19, 4); |
||||
|
|
||||
|
modelBuilder.Entity<TS_STOCK>() |
||||
|
.Property(e => e.Qty) |
||||
|
.HasPrecision(19, 4); |
||||
|
|
||||
|
modelBuilder.Entity<TS_UNI_API>() |
||||
|
.Property(e => e.Qty) |
||||
|
.HasPrecision(18, 5); |
||||
|
|
||||
|
modelBuilder.Entity<TS_UNI_API_HIS>() |
||||
|
.Property(e => e.Qty) |
||||
|
.HasPrecision(18, 5); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,36 @@ |
|||||
|
//------------------------------------------------------------------------------
|
||||
|
// <auto-generated>
|
||||
|
// 此代码已从模板生成。
|
||||
|
//
|
||||
|
// 手动更改此文件可能导致应用程序出现意外的行为。
|
||||
|
// 如果重新生成代码,将覆盖对此文件的手动更改。
|
||||
|
// </auto-generated>
|
||||
|
//------------------------------------------------------------------------------
|
||||
|
|
||||
|
namespace CK.SCP.Models.ScpEntity |
||||
|
{ |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
|
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using System.ComponentModel.DataAnnotations.Schema; |
||||
|
|
||||
|
|
||||
|
public partial class ERP_ORDER |
||||
|
{ |
||||
|
public int UID { get; set; } |
||||
|
public string ErpBillNum { get; set; } |
||||
|
public string VendId { get; set; } |
||||
|
public string ModType { get; set; } |
||||
|
public string Contacter { get; set; } |
||||
|
public string Site { get; set; } |
||||
|
public string Buyer { get; set; } |
||||
|
public string BuyerPhone { get; set; } |
||||
|
public string Address { get; set; } |
||||
|
public int State { get; set; } |
||||
|
public string Remark { get; set; } |
||||
|
public System.DateTime CreateTime { get; set; } |
||||
|
public string CreateUser { get; set; } |
||||
|
public System.Guid GUID { get; set; } |
||||
|
} |
||||
|
} |
@ -0,0 +1,33 @@ |
|||||
|
//------------------------------------------------------------------------------
|
||||
|
// <auto-generated>
|
||||
|
// 此代码已从模板生成。
|
||||
|
//
|
||||
|
// 手动更改此文件可能导致应用程序出现意外的行为。
|
||||
|
// 如果重新生成代码,将覆盖对此文件的手动更改。
|
||||
|
// </auto-generated>
|
||||
|
//------------------------------------------------------------------------------
|
||||
|
|
||||
|
namespace CK.SCP.Models.ScpEntity |
||||
|
{ |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
|
||||
|
public partial class ERP_ORDER_DETAIL |
||||
|
{ |
||||
|
public int UID { get; set; } |
||||
|
public string ErpBillNum { get; set; } |
||||
|
public int PoLine { get; set; } |
||||
|
public string PartCode { get; set; } |
||||
|
public decimal PartPrice { get; set; } |
||||
|
public Nullable<System.DateTime> BeginTime { get; set; } |
||||
|
public Nullable<System.DateTime> EndTime { get; set; } |
||||
|
public decimal PlanQty { get; set; } |
||||
|
public decimal ClosedQty { get; set; } |
||||
|
public string DockCode { get; set; } |
||||
|
public int State { get; set; } |
||||
|
public string Remark { get; set; } |
||||
|
public System.DateTime CreateTime { get; set; } |
||||
|
public string CreateUser { get; set; } |
||||
|
public System.Guid GUID { get; set; } |
||||
|
} |
||||
|
} |
@ -0,0 +1,45 @@ |
|||||
|
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 class QadOrder |
||||
|
{ |
||||
|
[Key] |
||||
|
public decimal ID { get; set; } |
||||
|
|
||||
|
[StringLength(50)] |
||||
|
public string BillNo { get; set; } |
||||
|
|
||||
|
[StringLength(50)] |
||||
|
public string SupplierCode { get; set; } |
||||
|
|
||||
|
public DateTime StartDate { get; set; } |
||||
|
|
||||
|
public DateTime EndDate { get; set; } |
||||
|
|
||||
|
|
||||
|
[StringLength(50)] |
||||
|
public string Address { get; set; } |
||||
|
|
||||
|
|
||||
|
[StringLength(50)] |
||||
|
public string ProductCode { get; set; } |
||||
|
|
||||
|
|
||||
|
public decimal Qty { get; set; } |
||||
|
|
||||
|
|
||||
|
[StringLength(50)] |
||||
|
public string PartName { get; set; } |
||||
|
|
||||
|
|
||||
|
[StringLength(50)] |
||||
|
public string VendName { get; set; } |
||||
|
} |
||||
|
} |
@ -0,0 +1,52 @@ |
|||||
|
using System; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using System.ComponentModel.DataAnnotations.Schema; |
||||
|
|
||||
|
namespace CK.SCP.Models.ScpEntity |
||||
|
{ |
||||
|
public partial class TA_BILLTYPE |
||||
|
{ |
||||
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)] |
||||
|
public int UID { get; set; } |
||||
|
|
||||
|
[Key] |
||||
|
[DatabaseGenerated(DatabaseGeneratedOption.None)] |
||||
|
public int BillType { get; set; } |
||||
|
|
||||
|
[Required] |
||||
|
[StringLength(50)] |
||||
|
public string TypeName { get; set; } |
||||
|
|
||||
|
[Required] |
||||
|
[StringLength(50)] |
||||
|
public string TypeDesc { get; set; } |
||||
|
|
||||
|
public int State { get; set; } |
||||
|
|
||||
|
[Required] |
||||
|
[StringLength(50)] |
||||
|
public string Prefix { get; set; } |
||||
|
|
||||
|
[Required] |
||||
|
[StringLength(500)] |
||||
|
public string BillNumRule { get; set; } |
||||
|
|
||||
|
public int LastNumber { get; set; } |
||||
|
|
||||
|
[StringLength(50)] |
||||
|
public string LastBillNum { get; set; } |
||||
|
|
||||
|
public DateTime LastBillTime { get; set; } |
||||
|
|
||||
|
[StringLength(500)] |
||||
|
public string PrintTemplateFileName { get; set; } |
||||
|
|
||||
|
[StringLength(500)] |
||||
|
public string ImportTemplateFileName { get; set; } |
||||
|
|
||||
|
[StringLength(50)] |
||||
|
public string Sep { get; set; } |
||||
|
|
||||
|
public int PaperOrientation { get; set; } |
||||
|
} |
||||
|
} |
@ -0,0 +1,25 @@ |
|||||
|
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 class TA_BillNoType |
||||
|
{ |
||||
|
[Key] |
||||
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)] |
||||
|
public int ID { get; set; } |
||||
|
|
||||
|
public int? sYear { get; set; } |
||||
|
public int? sMonth { get; set; } |
||||
|
public int? sDay { get; set; } |
||||
|
public int? sValue { get; set; } |
||||
|
|
||||
|
[StringLength(50)] |
||||
|
public string Prefix { get; set; } |
||||
|
} |
||||
|
} |
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue