Browse Source

Init

master
yibo 8 years ago
commit
fa30dd2ad4
35 changed files with 1492 additions and 0 deletions
  1. +7
    -0
      .gitignore
  2. +95
    -0
      B3ClientService.Web/B3ClientService.Web.csproj
  3. +59
    -0
      B3ClientService.Web/Pages/B3ClientService/ServerHostConfig.cs
  4. +16
    -0
      B3ClientService.Web/PluginClass.cs
  5. +35
    -0
      B3ClientService.Web/Properties/AssemblyInfo.cs
  6. +54
    -0
      B3ClientService.sln
  7. +103
    -0
      B3ClientService/B3ClientService.csproj
  8. +19
    -0
      B3ClientService/BO/BaseInfo/BaseInfo.cs
  9. +13
    -0
      B3ClientService/BO/BaseInfo/Car.cs
  10. +23
    -0
      B3ClientService/BO/BaseInfo/EmpInfoTable.cs
  11. +13
    -0
      B3ClientService/BO/BaseInfo/Farmer.cs
  12. +13
    -0
      B3ClientService/BO/BaseInfo/HogGrade.cs
  13. +13
    -0
      B3ClientService/BO/BaseInfo/LiveColonyHouse.cs
  14. +13
    -0
      B3ClientService/BO/BaseInfo/LiveVarieties.cs
  15. +13
    -0
      B3ClientService/BO/BaseInfo/Livestock.cs
  16. +17
    -0
      B3ClientService/BO/BaseInfo/PurchaseType.cs
  17. +19
    -0
      B3ClientService/BO/BaseInfo/Sanction.cs
  18. +14
    -0
      B3ClientService/BO/BaseInfo/Supplier.cs
  19. +13
    -0
      B3ClientService/BO/BaseInfo/Zone.cs
  20. +66
    -0
      B3ClientService/BO/Bill/WeightBill/WeightBill.cs
  21. +29
    -0
      B3ClientService/BO/ButcherOrder/ButcherOrder.cs
  22. +19
    -0
      B3ClientService/BO/ButcherOrder/ButcherOrder_Detail.cs
  23. +33
    -0
      B3ClientService/BO/ServerHost.cs
  24. +36
    -0
      B3ClientService/BO/SyncBO/MinEmployee.cs
  25. +32
    -0
      B3ClientService/BO/SyncBO/MinWPF_User.cs
  26. +39
    -0
      B3ClientService/Properties/AssemblyInfo.cs
  27. +141
    -0
      B3ClientService/Rpcs/BaseInfoRpc.cs
  28. +26
    -0
      B3ClientService/Rpcs/BillRpc/WeightBillRpc.cs
  29. +74
    -0
      B3ClientService/Rpcs/ButcherOrderRpc.cs
  30. +36
    -0
      B3ClientService/Rpcs/UserInfoRpc.cs
  31. +22
    -0
      B3ClientService/Tasks/DownLoad/LoadButcherOrder.cs
  32. +259
    -0
      B3ClientService/Tasks/SyncInfoFromServer.cs
  33. +72
    -0
      B3ClientService/Tasks/UpdateLoad/UploadTest.cs
  34. +31
    -0
      B3ClientService/WordPair.cs
  35. +25
    -0
      WebFolder/config/plugins/B3ClientService.plugin

+ 7
- 0
.gitignore View File

@ -0,0 +1,7 @@
.*
*.TMP
*.suo
*.user
obj
bin
_ReSharper.B3ClientService

+ 95
- 0
B3ClientService.Web/B3ClientService.Web.csproj View File

@ -0,0 +1,95 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.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>{3E6BA750-6C00-441D-A877-3958DF83A3B2}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BWP.Web</RootNamespace>
<AssemblyName>B3ClientService.Web</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="B3Frameworks, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a04fa581c0f74d43, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\BwpB3Project\tsref\Debug\B3Frameworks.dll</HintPath>
</Reference>
<Reference Include="B3Frameworks.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a04fa581c0f74d43, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\BwpB3Project\tsref\Debug\B3Frameworks.Web.dll</HintPath>
</Reference>
<Reference Include="Forks.EnterpriseServices, Version=3.1.0.0, Culture=neutral, PublicKeyToken=7254430f49d10aae, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\BwpB3Project\tsref\Debug\Forks.EnterpriseServices.dll</HintPath>
</Reference>
<Reference Include="Forks.Utils, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7254430f49d10aae, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\BwpB3Project\tsref\Debug\Forks.Utils.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="TSingSoft.WebControls2, Version=2.1.0.0, Culture=neutral, PublicKeyToken=a04fa581c0f74d43, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\BwpB3Project\tsref\Debug\TSingSoft.WebControls2.dll</HintPath>
</Reference>
<Reference Include="Wpf, Version=1.3.0.0, Culture=neutral, PublicKeyToken=a04fa581c0f74d43, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\BwpB3Project\tsref\Debug\Wpf.dll</HintPath>
</Reference>
<Reference Include="Wpf.System, Version=1.3.0.0, Culture=neutral, PublicKeyToken=a04fa581c0f74d43, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\BwpB3Project\tsref\Debug\Wpf.System.dll</HintPath>
</Reference>
<Reference Include="Wpf.System.Web, Version=1.3.0.0, Culture=neutral, PublicKeyToken=a04fa581c0f74d43, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\BwpB3Project\tsref\Debug\Wpf.System.Web.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Pages\B3ClientService\ServerHostConfig.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="PluginClass.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\B3ClientService\B3ClientService.csproj">
<Project>{08f9760a-17fa-4908-8963-61137c051caf}</Project>
<Name>B3ClientService</Name>
</ProjectReference>
</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>

+ 59
- 0
B3ClientService.Web/Pages/B3ClientService/ServerHostConfig.cs View File

@ -0,0 +1,59 @@
using BWP.B3ClientService.BO;
using System;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using TSingSoft.WebControls2;
using TSingSoft.WebPluginFramework.Controls;
using TSingSoft.WebPluginFramework.Pages;
using Forks.EnterpriseServices.DomainObjects2;
using Forks.EnterpriseServices.DomainObjects2.DQuery;
using TSingSoft.WebPluginFramework;
using BWP.B3ClientService.Tasks;
namespace BWP.Web.Pages.B3ClientService
{
class ServerHostConfig : ServerPage
{
DFTextBox serverUrlInput;
protected override void InitForm(HtmlForm form)
{
form.Controls.Add(new PageTitle("服务器地址配置"));
var hPanel = new HLayoutPanel();
form.Controls.Add(hPanel);
hPanel.Add(new SimpleLabel("地址"));
serverUrlInput = hPanel.Add(new DFTextBox() { Width = Unit.Pixel(300) });
hPanel.Add(new TSButton("保存", delegate
{
if (serverUrlInput.IsEmpty)
throw new Exception("地址不能为空");
using (var session = Dmo.NewSession())
{
var entity = new ServerHost() { ServerUrl = serverUrlInput.Text.Trim() };
if (Exist())
session.Update(entity);
else
session.Insert(entity);
session.Commit();
}
AspUtil.Alert(this, "保存成功!");
}));
}
bool Exist()
{
var query = new DQueryDom(new JoinAlias(typeof(ServerHost)));
return query.EExists();
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
if (!IsPostBack)
{
serverUrlInput.Text = ServerHost.GetServerUrl();
}
}
}
}

+ 16
- 0
B3ClientService.Web/PluginClass.cs View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TSingSoft.WebPluginFramework;
namespace BWP.B3ClientService
{
class PluginClass:IPluginClass
{
public void OnInit()
{
}
}
}

+ 35
- 0
B3ClientService.Web/Properties/AssemblyInfo.cs View File

@ -0,0 +1,35 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的常规信息通过以下
// 特性集控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("B3ClientService.Web")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("B3ClientService.Web")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 使此程序集中的类型
// 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
// 则将该类型上的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("a86fdc64-cf43-4b58-915e-fe86b8b7762b")]
// 程序集的版本信息由下面四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]

+ 54
- 0
B3ClientService.sln View File

@ -0,0 +1,54 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.40629.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "B3ClientService", "B3ClientService\B3ClientService.csproj", "{08F9760A-17FA-4908-8963-61137C051CAF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "B3ClientService.Web", "B3ClientService.Web\B3ClientService.Web.csproj", "{3E6BA750-6C00-441D-A877-3958DF83A3B2}"
EndProject
Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "WebFolder(35)", "http://localhost:3252", "{45C3DB02-7DF0-42FD-B7CB-64F241CA2C71}"
ProjectSection(WebsiteProperties) = preProject
UseIISExpress = "true"
TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.5"
Debug.AspNetCompiler.VirtualPath = "/localhost_3252"
Debug.AspNetCompiler.PhysicalPath = "WebFolder\"
Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\localhost_3252\"
Debug.AspNetCompiler.Updateable = "true"
Debug.AspNetCompiler.ForceOverwrite = "true"
Debug.AspNetCompiler.FixedNames = "false"
Debug.AspNetCompiler.Debug = "True"
Release.AspNetCompiler.VirtualPath = "/localhost_3252"
Release.AspNetCompiler.PhysicalPath = "WebFolder\"
Release.AspNetCompiler.TargetPath = "PrecompiledWeb\localhost_3252\"
Release.AspNetCompiler.Updateable = "true"
Release.AspNetCompiler.ForceOverwrite = "true"
Release.AspNetCompiler.FixedNames = "false"
Release.AspNetCompiler.Debug = "False"
SlnRelativePath = "WebFolder\"
DefaultWebSiteLanguage = "Visual C#"
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{08F9760A-17FA-4908-8963-61137C051CAF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{08F9760A-17FA-4908-8963-61137C051CAF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{08F9760A-17FA-4908-8963-61137C051CAF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{08F9760A-17FA-4908-8963-61137C051CAF}.Release|Any CPU.Build.0 = Release|Any CPU
{3E6BA750-6C00-441D-A877-3958DF83A3B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3E6BA750-6C00-441D-A877-3958DF83A3B2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3E6BA750-6C00-441D-A877-3958DF83A3B2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3E6BA750-6C00-441D-A877-3958DF83A3B2}.Release|Any CPU.Build.0 = Release|Any CPU
{45C3DB02-7DF0-42FD-B7CB-64F241CA2C71}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{45C3DB02-7DF0-42FD-B7CB-64F241CA2C71}.Debug|Any CPU.Build.0 = Debug|Any CPU
{45C3DB02-7DF0-42FD-B7CB-64F241CA2C71}.Release|Any CPU.ActiveCfg = Debug|Any CPU
{45C3DB02-7DF0-42FD-B7CB-64F241CA2C71}.Release|Any CPU.Build.0 = Debug|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

+ 103
- 0
B3ClientService/B3ClientService.csproj View File

@ -0,0 +1,103 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.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>{08F9760A-17FA-4908-8963-61137C051CAF}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BWP.B3ClientService</RootNamespace>
<AssemblyName>B3ClientService</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="B3Frameworks, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a04fa581c0f74d43, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\BwpB3Project\tsref\Debug\B3Frameworks.dll</HintPath>
</Reference>
<Reference Include="Forks.EnterpriseServices, Version=3.1.0.0, Culture=neutral, PublicKeyToken=7254430f49d10aae, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\BwpB3Project\tsref\Debug\Forks.EnterpriseServices.dll</HintPath>
</Reference>
<Reference Include="Forks.JsonRpc.Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7254430f49d10aae, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\BwpB3Project\tsref\Debug\Forks.JsonRpc.Client.dll</HintPath>
</Reference>
<Reference Include="Forks.Utils, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7254430f49d10aae, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\BwpB3Project\tsref\Debug\Forks.Utils.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="TSingSoft.WebControls2, Version=2.1.0.0, Culture=neutral, PublicKeyToken=a04fa581c0f74d43, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\BwpB3Project\tsref\Debug\TSingSoft.WebControls2.dll</HintPath>
</Reference>
<Reference Include="Wpf.System, Version=1.3.0.0, Culture=neutral, PublicKeyToken=a04fa581c0f74d43, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\BwpB3Project\tsref\Debug\Wpf.System.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="BO\BaseInfo\BaseInfo.cs" />
<Compile Include="BO\BaseInfo\Car.cs" />
<Compile Include="BO\BaseInfo\EmpInfoTable.cs" />
<Compile Include="BO\BaseInfo\Farmer.cs" />
<Compile Include="BO\BaseInfo\HogGrade.cs" />
<Compile Include="BO\BaseInfo\LiveColonyHouse.cs" />
<Compile Include="BO\BaseInfo\Livestock.cs" />
<Compile Include="BO\BaseInfo\LiveVarieties.cs" />
<Compile Include="BO\BaseInfo\PurchaseType.cs" />
<Compile Include="BO\BaseInfo\Sanction.cs" />
<Compile Include="BO\BaseInfo\Supplier.cs" />
<Compile Include="BO\BaseInfo\Zone.cs" />
<Compile Include="BO\Bill\WeightBill\WeightBill.cs" />
<Compile Include="BO\ButcherOrder\ButcherOrder.cs" />
<Compile Include="BO\ButcherOrder\ButcherOrder_Detail.cs" />
<Compile Include="BO\SyncBO\MinEmployee.cs" />
<Compile Include="BO\SyncBO\MinWPF_User.cs" />
<Compile Include="BO\ServerHost.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Rpcs\BaseInfoRpc.cs" />
<Compile Include="Rpcs\BillRpc\WeightBillRpc.cs" />
<Compile Include="Rpcs\ButcherOrderRpc.cs" />
<Compile Include="Rpcs\UserInfoRpc.cs" />
<Compile Include="Tasks\DownLoad\LoadButcherOrder.cs" />
<Compile Include="Tasks\SyncInfoFromServer.cs" />
<Compile Include="Tasks\UpdateLoad\UploadTest.cs" />
<Compile Include="WordPair.cs" />
</ItemGroup>
<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>

+ 19
- 0
B3ClientService/BO/BaseInfo/BaseInfo.cs View File

@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TSingSoft.WebPluginFramework;
namespace BWP.B3ClientService.BO
{
[Serializable, BOClass]
public abstract class BaseInfo
{
public long ID { get; set; }
public string Name { get; set; }
public string Spell { get; set; }
}
}

+ 13
- 0
B3ClientService/BO/BaseInfo/Car.cs View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BWP.B3ClientService.BO
{
[Serializable]
public class Car : BaseInfo
{
}
}

+ 23
- 0
B3ClientService/BO/BaseInfo/EmpInfoTable.cs View File

@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TSingSoft.WebPluginFramework;
namespace BWP.B3ClientService.BO
{
[Serializable, BOClass]
public class EmpInfoTable
{
public long User_ID { get; set; }
public string User_Name { get; set; }
public long Domain_ID { get; set; }
public long Employee_ID { get; set; }
public string Employee_Name { get; set; }
public long? AccountingUnit_ID { get; set; }
public string AccountingUnit_Name { get; set; }
public long? Department_ID { get; set; }
public string Department_Name { get; set; }
}
}

+ 13
- 0
B3ClientService/BO/BaseInfo/Farmer.cs View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BWP.B3ClientService.BO
{
[Serializable]
public class Farmer : BaseInfo
{
}
}

+ 13
- 0
B3ClientService/BO/BaseInfo/HogGrade.cs View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BWP.B3ClientService.BO
{
[Serializable]
public class HogGrade : BaseInfo
{
}
}

+ 13
- 0
B3ClientService/BO/BaseInfo/LiveColonyHouse.cs View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BWP.B3ClientService.BO
{
[Serializable]
public class LiveColonyHouse : BaseInfo
{
}
}

+ 13
- 0
B3ClientService/BO/BaseInfo/LiveVarieties.cs View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BWP.B3ClientService.BO
{
[Serializable]
public class LiveVarieties : BaseInfo
{
}
}

+ 13
- 0
B3ClientService/BO/BaseInfo/Livestock.cs View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BWP.B3ClientService.BO
{
[Serializable]
public class Livestock : BaseInfo
{
}
}

+ 17
- 0
B3ClientService/BO/BaseInfo/PurchaseType.cs View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TSingSoft.WebPluginFramework;
namespace BWP.B3ClientService.BO
{
[Serializable,BOClass]
public class PurchaseType
{
public short ID { get; set; }
public string Name { get; set; }
}
}

+ 19
- 0
B3ClientService/BO/BaseInfo/Sanction.cs View File

@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TSingSoft.WebPluginFramework;
namespace BWP.B3ClientService.BO
{
[Serializable, BOClass]
public class Sanction
{
public long ID { get; set; }
public long AbnormalItem_ID { get; set; }
public string AbnormalItem_Name { get; set; }
}
}

+ 14
- 0
B3ClientService/BO/BaseInfo/Supplier.cs View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TSingSoft.WebPluginFramework;
namespace BWP.B3ClientService.BO
{
[Serializable]
public class Supplier : BaseInfo
{
}
}

+ 13
- 0
B3ClientService/BO/BaseInfo/Zone.cs View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BWP.B3ClientService.BO
{
[Serializable]
public class Zone : BaseInfo
{
}
}

+ 66
- 0
B3ClientService/BO/Bill/WeightBill/WeightBill.cs View File

@ -0,0 +1,66 @@
using Forks.EnterpriseServices.DomainObjects2;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TSingSoft.WebPluginFramework;
namespace BWP.B3ClientService.BO
{
[Serializable, BOClass]
public class WeightBill
{
public string CreaterName { get; set; }
public long? Supplier_ID { get; set; }
public string Supplier_Name { get; set; }
public short? PurchaseType_ID { get; set; }
public string PurchaseType_Name { get; set; }
public DateTime? WeightTime { get; set; }
public long? Car_ID { get; set; }
public string Car_Name { get; set; }
public long? Livestock_ID { get; set; }
public string Livestock_Name { get; set; }
public long? Employee_ID { get; set; }
public string Employee_Name { get; set; }
public long? HogGrade_ID { get; set; }
public string HogGrade_Name { get; set; }
public long? Zone_ID { get; set; }
public string Zone_Name { get; set; }
public decimal? PenWeight { get; set; }
public decimal? PenPrice { get; set; }
public decimal? PenMoney { get; set; }
public string AnimalTestNumber { get; set; }
public DateTime? AnimalTestDate { get; set; }
public string AnimalTestMan { get; set; }
public string Remark { get; set; }
public long? Inspector_ID { get; set; }
public long? Inspector_Name { get; set; }
[DbColumn(DefaultValue = 0)]
public bool Sync { get; set; }
}
}

+ 29
- 0
B3ClientService/BO/ButcherOrder/ButcherOrder.cs View File

@ -0,0 +1,29 @@
using BWP.B3Frameworks.BO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BWP.B3ClientService.BO
{
[Serializable]
public class ButcherOrder : Base
{
public long BillID { get; set; }
public long BillDetailID { get; set; }
public int Order { get; set; }
public int PlanNumber { get; set; }
public DateTime Date { get; set; }
public int HotFadeNumber { get; set; }
public bool Sync { get; set; }
public bool UpLoad { get; set; }
}
}

+ 19
- 0
B3ClientService/BO/ButcherOrder/ButcherOrder_Detail.cs View File

@ -0,0 +1,19 @@
using BWP.B3Frameworks.BO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BWP.B3ClientService.BO
{
[Serializable]
public class ButcherOrder_Detail : Base
{
public long ButcherOrder_ID { get; set; }
public DateTime Date { get; set; }
public int Number { get; set; }
}
}

+ 33
- 0
B3ClientService/BO/ServerHost.cs View File

@ -0,0 +1,33 @@
using Forks.EnterpriseServices;
using Forks.EnterpriseServices.DataForm;
using Forks.EnterpriseServices.DomainObjects2;
using Forks.EnterpriseServices.DomainObjects2.DQuery;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TSingSoft.WebPluginFramework;
namespace BWP.B3ClientService.BO
{
[DFClass]
[Serializable]
[BOClass]
public class ServerHost
{
[LogicName("摘要")]
[DbColumn(Length = 1000)]
public string ServerUrl { get; set; }
public static string GetServerUrl()
{
using (var session = Dmo.NewSession())
{
var query = new DQueryDom(new JoinAlias(typeof(ServerHost)));
query.Columns.Add(DQSelectColumn.Field("ServerUrl"));
return query.EExecuteScalar<string>();
}
}
}
}

+ 36
- 0
B3ClientService/BO/SyncBO/MinEmployee.cs View File

@ -0,0 +1,36 @@
using Forks.EnterpriseServices;
using Forks.EnterpriseServices.DomainObjects2;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TSingSoft.WebPluginFramework;
namespace BWP.B3ClientService.BO
{
[BOClass(Exclude = true)]
[Serializable]
[LogicName("")]
[MapToTable("B3Frameworks_Employee")]
public class MinEmployee
{
public long Domain_ID { get; set; }
public long ID { get; set; }
public string Name { get; set; }
public string Spell { get; set; }
public string Code { get; set; }
public bool Stopped { get; set; }
public bool IsLocked { get; set; }
public DateTime CreateTime { get; set; }
public DateTime ModifyTime { get; set; }
}
}

+ 32
- 0
B3ClientService/BO/SyncBO/MinWPF_User.cs View File

@ -0,0 +1,32 @@
using Forks.EnterpriseServices;
using Forks.EnterpriseServices.DomainObjects2;
using System;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TSingSoft.WebPluginFramework;
namespace BWP.B3ClientService.BO
{
[BOClass(Exclude = true)]
[Serializable]
[LogicName("")]
[MapToTable("WPF_User")]
public class MinWPF_User
{
public long ID { get; set; }
public string Name { get; set; }
public bool Stopped { get; set; }
[DbColumn(AllowNull = false, DbType = SqlDbType.Binary, Length = 16)]
[SuppressMessage("Microsoft.Performance", "CA1819")]
public byte[] Password { get; set; }
public string RoleSchema { get; set; }
}
}

+ 39
- 0
B3ClientService/Properties/AssemblyInfo.cs View File

@ -0,0 +1,39 @@
using Forks.EnterpriseServices.DomainObjects2;
using Forks.EnterpriseServices.Ert;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的常规信息通过以下
// 特性集控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("B3ClientService")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("B3ClientService")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 使此程序集中的类型
// 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
// 则将该类型上的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("a45cd80c-4b93-474b-9f35-e4fc8550da4c")]
// 程序集的版本信息由下面四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyMapToTablePrefix("B3ClientService_")]
[assembly: ErtAbbr("B3ClientService", "BWP.B3ClientService")]

+ 141
- 0
B3ClientService/Rpcs/BaseInfoRpc.cs View File

@ -0,0 +1,141 @@
using BWP.B3ClientService.BO;
using Forks.EnterpriseServices.DomainObjects2;
using Forks.EnterpriseServices.DomainObjects2.DQuery;
using Forks.EnterpriseServices.JsonRpc;
using Forks.EnterpriseServices.SqlDoms;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TSingSoft.WebPluginFramework;
namespace BWP.B3ClientService.Rpcs
{
[Rpc]
public static class BaseInfoRpc
{
[Rpc]
public static List<WordPair> GetCarList(string input, string args, int top)
{
return GetBaseInfoList<Car>(input, args, top);
}
[Rpc]
public static List<WordPair> GetLivestockList(string input, string args, int top)
{
return GetBaseInfoList<Livestock>(input, args, top);
}
[Rpc]
public static List<WordPair> GetSupplierList(string input, string args, int top)
{
return GetBaseInfoList<Supplier>(input, args, top);
}
static List<WordPair> GetBaseInfoList<T>(string input, string args, int top)
where T : BaseInfo
{
var query = new DQueryDom(new JoinAlias(typeof(T)));
if (top > 50)
top = 50;
query.Range = SelectRange.Top(top);
query.Columns.Add(DQSelectColumn.Field("ID"));
query.Columns.Add(DQSelectColumn.Field("Name"));
if (!string.IsNullOrEmpty(input))
query.Where.Conditions.Add(DQCondition.Or(DQCondition.Like("Name", input), DQCondition.Like("Spell", input)));
var list = new List<WordPair>();
using (var session = Dmo.NewSession())
{
using (var reader = session.ExecuteReader(query))
{
while (reader.Read())
list.Add(new WordPair(reader[1].ToString(), reader[0].ToString()));
}
}
return list;
}
[Rpc]
public static List<WordPair> GetPurchaseTypeList(string input, string args, int top)
{
var query = new DQueryDom(new JoinAlias(typeof(PurchaseType)));
if (top > 50)
top = 50;
query.Range = SelectRange.Top(top);
query.Columns.Add(DQSelectColumn.Field("ID"));
query.Columns.Add(DQSelectColumn.Field("Name"));
var list = new List<WordPair>();
using (var session = Dmo.NewSession())
{
using (var reader = session.ExecuteReader(query))
{
while (reader.Read())
list.Add(new WordPair(reader[1].ToString(), reader[0].ToString()));
}
}
return list;
}
[Rpc]
public static List<WordPair> GetEmployeeList(string input, string args, int top)
{
var query = new DQueryDom(new JoinAlias(typeof(BWP.B3Frameworks.BO.Employee)));
if (top > 50)
top = 50;
query.Range = SelectRange.Top(top);
query.Columns.Add(DQSelectColumn.Field("ID"));
query.Columns.Add(DQSelectColumn.Field("Name"));
query.Where.Conditions.Add(DQCondition.EQ("Stopped", false));
if (!string.IsNullOrEmpty(input))
query.Where.Conditions.Add(DQCondition.Or(DQCondition.Like("Name", input), DQCondition.Like("Spell", input)));
var list = new List<WordPair>();
using (var session = Dmo.NewSession())
{
using (var reader = session.ExecuteReader(query))
{
while (reader.Read())
list.Add(new WordPair(reader[1].ToString(), reader[0].ToString()));
}
}
return list;
}
[Rpc]
public static List<WordPair> GetZoneList(string input, string args, int top)
{
return GetBaseInfoList<Zone>(input, args, top);
}
[Rpc]
public static List<WordPair> GetFarmerList(string input, string args, int top)
{
return GetBaseInfoList<Farmer>(input, args, top);
}
[Rpc]
public static List<WordPair> GetHogGradeList(string input, string args, int top)
{
return GetBaseInfoList<HogGrade>(input, args, top);
}
[Rpc]
public static List<WordPair> GetLiveColonyHouseList(string input, string args, int top)
{
return GetBaseInfoList<LiveColonyHouse>(input, args, top);
}
[Rpc]
public static List<Sanction> GetSanctionList()
{
var dmo = new DmoQuery(typeof(Sanction));
return dmo.EExecuteList().Cast<Sanction>().ToList();
}
[Rpc]
public static List<WordPair> GetLiveVarietiesList(string input, string args, int top)
{
return GetBaseInfoList<LiveVarieties>(input, args, top);
}
}
}

+ 26
- 0
B3ClientService/Rpcs/BillRpc/WeightBillRpc.cs View File

@ -0,0 +1,26 @@
using BWP.B3ClientService.BO;
using Forks.EnterpriseServices.DomainObjects2;
using Forks.EnterpriseServices.JsonRpc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BWP.B3ClientService.Rpcs.BillRpc
{
[Rpc]
public static class WeightBillRpc
{
[Rpc]
public static bool UploadBill(WeightBill dmo)
{
using (var session = Dmo.NewSession())
{
session.Insert(dmo);
session.Commit();
}
return true;
}
}
}

+ 74
- 0
B3ClientService/Rpcs/ButcherOrderRpc.cs View File

@ -0,0 +1,74 @@
using BWP.B3ClientService.BO;
using BWP.B3Frameworks.Utils;
using Forks.EnterpriseServices.DomainObjects2;
using Forks.EnterpriseServices.DomainObjects2.DQuery;
using Forks.EnterpriseServices.JsonRpc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TSingSoft.WebPluginFramework;
namespace BWP.B3ClientService.Rpcs
{
[Rpc]
public static class ButcherOrderRpc
{
[Rpc]
public static List<ButcherOrder> GetButcherOrder(DateTime date)
{
var query = new DmoQuery(typeof(ButcherOrder));
query.Where.Conditions.Add(DQCondition.EQ("Date", date));
return query.EExecuteList().Cast<ButcherOrder>().ToList();
}
[Rpc]
public static List<ButcherOrder_Detail> GetOrderDetail(long orderID)
{
var query = new DmoQuery(typeof(ButcherOrder_Detail));
query.Where.Conditions.Add(DQCondition.EQ("ButcherOrder_ID", orderID));
query.OrderBy.Expressions.Add(DQOrderByExpression.Create("ID"));
return query.EExecuteList().Cast<ButcherOrder_Detail>().ToList();
}
static void UpdateButcherOrder(IDmoSession session, long id, int hotFadeNumber)
{
var order = InnerBLUtil.GetSingleDmo<ButcherOrder>(session, "ID", id, "HotFadeNumber", "Sync");
order.HotFadeNumber += hotFadeNumber;
if (hotFadeNumber < 0 && order.Sync)
order.Sync = false;
var update = new DQUpdateDom(typeof(ButcherOrder));
update.Where.Conditions.Add(DQCondition.EQ("HotFadeNumber", order.HotFadeNumber));
update.Where.Conditions.Add(DQCondition.EQ("Sync", order.Sync));
update.Where.Conditions.Add(DQCondition.EQ("ID", id));
session.ExecuteNonQuery(update);
}
[Rpc]
public static void InsertOrderDetail(long orderID, int number)
{
using (var session = Dmo.NewSession())
{
var detail = new ButcherOrder_Detail();
detail.Number = number;
detail.Date = DateTime.Now;
detail.ButcherOrder_ID = orderID;
session.Insert(detail);
UpdateButcherOrder(session, orderID, detail.Number);
session.Commit();
}
}
[Rpc]
public static void DeleteOrderDetail(long id)
{
using (var session = Dmo.NewSession())
{
var detail = InnerBLUtil.GetSingleDmo<ButcherOrder_Detail>(session, "ID", id, "ButcherOrder_ID", "Number");
UpdateButcherOrder(session, detail.ButcherOrder_ID, -detail.Number);
session.Commit();
}
}
}
}

+ 36
- 0
B3ClientService/Rpcs/UserInfoRpc.cs View File

@ -0,0 +1,36 @@
using BWP.B3ClientService.BO;
using BWP.B3Frameworks.BO;
using Forks.EnterpriseServices.DomainObjects2;
using Forks.EnterpriseServices.DomainObjects2.DQuery;
using Forks.EnterpriseServices.JsonRpc;
using Forks.EnterpriseServices.SqlDoms;
using TSingSoft.WebPluginFramework;
namespace BWP.B3ClientService.Rpcs
{
[Rpc]
public static class UserInfoRpc
{
[Rpc(RpcFlags.SkipAuth)]
public static string GetUserName(string code)
{
var userEmp = new JoinAlias(typeof(EmpInfoTable));
var employee = new JoinAlias(typeof(Employee));
var query = new DQueryDom(userEmp);
query.From.AddJoin(JoinType.Inner, new DQDmoSource(employee), DQCondition.EQ(userEmp, "Employee_ID", employee, "ID"));
query.Columns.Add(DQSelectColumn.Field("User_Name", userEmp));
query.Where.Conditions.Add(DQCondition.EQ(employee, "Code", code));
query.Range = SelectRange.Top(1);
return query.EExecuteScalar<string>();
}
[Rpc]
public static EmpInfoTable GetUserEmpInfo(string name)
{
var query = new DmoQuery(typeof(EmpInfoTable));
query.Where.Conditions.Add(DQCondition.EQ("User_Name", name));
query.Range = SelectRange.Top(1);
return query.EExecuteScalar<EmpInfoTable>();
}
}
}

+ 22
- 0
B3ClientService/Tasks/DownLoad/LoadButcherOrder.cs View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TSingSoft.WebPluginFramework.TimerTasks;
namespace BWP.B3ClientService.Tasks
{
class LoadButcherOrder : ITimerTask
{
public void Execute()
{
}
public string Name
{
get { return "同步拍宰顺序"; }
}
}
}

+ 259
- 0
B3ClientService/Tasks/SyncInfoFromServer.cs View File

@ -0,0 +1,259 @@
using BWP.B3ClientService.BO;
using BWP.B3Frameworks.BO;
using Forks.EnterpriseServices.BusinessInterfaces;
using Forks.EnterpriseServices.DomainObjects2;
using Forks.EnterpriseServices.DomainObjects2.DQuery;
using Forks.JsonRpc.Client;
using Forks.JsonRpc.Client.Data;
using Forks.Utils.Data;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TSingSoft.WebPluginFramework;
using TSingSoft.WebPluginFramework.TimerTasks;
namespace BWP.B3ClientService.Tasks
{
public class SyncInfoFromServer : ITimerTask
{
public void Execute()
{
var serverUri = ServerHost.GetServerUrl();
if (string.IsNullOrEmpty(serverUri))
throw new Exception("请配置服务器地址");
//try
{
try
{
RpcFacade.Init(serverUri, "B3ClientServer");
}
catch (Exception ex)
{
if (ex.Message != "Can only start once")
throw;
}
SyncWpfUser();
SyncUserEmployee();
SyncEmployee();
SyncEmpInfoTable();
SyncCar();
SyncLivestock();
SyncPurchaseType();
SyncSupplier();
SyncZone();
SyncFarmer();
SyncHogGrade();
SyncLiveColonyHouse();
SyncSanction();
//SyncLiveVarieties();
}
//catch
{ }
}
static void SyncWpfUser()
{
var list = RpcFacade.Call<List<RpcObject>>("/MainSystem/B3ButcherManage/Rpcs/TouchScreenRpcs/GetWpfUser");
using (var context = new TransactionContext())
{
var sql1 = @"truncate table [WPF_User];SET IDENTITY_INSERT [WPF_User] ON;
";
context.Session.ExecuteSqlNonQuery(sql1);
foreach (RpcObject o in list)
{
var entity = new MinWPF_User();
entity.ID = o.Get<long>("ID");
entity.Name = o.Get<string>("Name");
entity.Stopped = o.Get<bool>("Stopped");
entity.Password = o.Get<byte[]>("Password");
entity.RoleSchema = o.Get<string>("RoleSchema");
context.Session.Insert(entity);
}
var sql2 = @"SET IDENTITY_INSERT [WPF_User] OFF;";
context.Session.ExecuteSqlNonQuery(sql2);
context.Commit();
}
}
void SyncUserEmployee()
{
var list = RpcFacade.Call<List<RpcObject>>("/MainSystem/B3ButcherManage/Rpcs/TouchScreenRpcs/GetUserEmployee");
using (var context = new TransactionContext())
{
var sql1 = @"truncate table [B3Frameworks_User_Employee];
";
context.Session.ExecuteSqlNonQuery(sql1);
foreach (RpcObject o in list)
{
var entity = new User_Employee();
entity.Employee_ID = o.Get<long>("Employee_ID");
entity.User_ID = o.Get<long>("User_ID");
context.Session.Insert(entity);
}
context.Commit();
}
}
void SyncEmployee()
{
var list = RpcFacade.Call<List<RpcObject>>("/MainSystem/B3ButcherManage/Rpcs/TouchScreenRpcs/GetEmployee");
using (var context = new TransactionContext())
{
var sql1 = @"truncate table [B3Frameworks_Employee];SET IDENTITY_INSERT [B3Frameworks_Employee] ON;
";
context.Session.ExecuteSqlNonQuery(sql1);
foreach (RpcObject o in list)
{
var entity = new MinEmployee();
entity.ID = o.Get<long>("ID");
entity.Spell = o.Get<string>("Spell");
entity.Name = o.Get<string>("Name");
entity.Code = o.Get<string>("Code");
entity.Stopped = o.Get<bool>("Stopped");
entity.Domain_ID = o.Get<long>("Domain_ID");
entity.IsLocked = false;
entity.CreateTime = DateTime.Today;
entity.ModifyTime = entity.CreateTime;
context.Session.Insert(entity);
}
var sql2 = @"SET IDENTITY_INSERT [B3Frameworks_Employee] OFF;";
context.Session.ExecuteSqlNonQuery(sql2);
context.Commit();
}
}
void SyncEmpInfoTable()
{
var list = RpcFacade.Call<List<RpcObject>>("/MainSystem/B3ButcherManage/Rpcs/TouchScreenRpcs/GetEmpInfo");
using (var context = new TransactionContext())
{
var sql1 = @"truncate table [B3ClientService_EmpInfoTable];";
context.Session.ExecuteSqlNonQuery(sql1);
foreach (RpcObject o in list)
{
var entity = new EmpInfoTable();
entity.User_ID = o.Get<long>("User_ID");
entity.User_Name = o.Get<string>("User_Name");
entity.Domain_ID = o.Get<long>("Domain_ID");
entity.Employee_ID = o.Get<long>("Employee_ID");
entity.Employee_Name = o.Get<string>("Employee_Name");
entity.Department_ID = o.Get<long?>("Department_ID");
entity.Department_Name = o.Get<string>("Department_Name");
entity.AccountingUnit_ID = o.Get<long?>("AccountingUnit_ID");
entity.AccountingUnit_Name = o.Get<string>("AccountingUnit_Name");
context.Session.Insert(entity);
}
context.Commit();
}
}
void SyncCar()
{
SyncBaseInfo<Car>("GetCar", "B3ClientService_Car");
}
void SyncLivestock()
{
SyncBaseInfo<Livestock>("GetLivestock", "B3ClientService_Livestock");
}
void SyncPurchaseType()
{
var list = RpcFacade.Call<List<RpcObject>>("/MainSystem/B3ButcherManage/Rpcs/TouchScreenRpcs/GetPurchaseType");
using (var context = new TransactionContext())
{
var sql1 = @"truncate table [B3ClientService_PurchaseType];
";
context.Session.ExecuteSqlNonQuery(sql1);
foreach (RpcObject o in list)
{
var entity = new PurchaseType();
entity.ID = o.Get<short>("ID");
entity.Name = o.Get<string>("Name");
context.Session.Insert(entity);
}
context.Commit();
}
}
void SyncSupplier()
{
SyncBaseInfo<Supplier>("GetSupplier", "B3ClientService_Supplier");
}
void SyncZone()
{
SyncBaseInfo<Zone>("GetZone", "B3ClientService_Zone");
}
void SyncFarmer()
{
SyncBaseInfo<Farmer>("GetFarmer", "B3ClientService_Farmer");
}
void SyncHogGrade()
{
SyncBaseInfo<HogGrade>("GetHogGrade", "B3ClientService_HogGrade");
}
void SyncLiveColonyHouse()
{
SyncBaseInfo<LiveColonyHouse>("GetLiveColonyHouse", "B3ClientService_LiveColonyHouse");
}
void SyncSanction()
{
var list = RpcFacade.Call<List<RpcObject>>("/MainSystem/B3ButcherManage/Rpcs/TouchScreenRpcs/GetSanctionSetting");
using (var context = new TransactionContext())
{
var sql1 = @"truncate table [B3ClientService_Sanction];
";
context.Session.ExecuteSqlNonQuery(sql1);
foreach (RpcObject o in list)
{
var entity = new Sanction();
entity.ID = o.Get<long>("ID");
entity.AbnormalItem_ID = o.Get<long>("AbnormalItem_ID");
entity.AbnormalItem_Name = o.Get<string>("AbnormalItem_Name");
context.Session.Insert(entity);
}
context.Commit();
}
}
void SyncLiveVarieties()
{
SyncBaseInfo<LiveVarieties>("GetLiveVarieties", "B3ClientService_LiveVarieties");
}
void SyncBaseInfo<T>(string rpcMethodName, string tableName, string rpcClassName = null)
where T : BWP.B3ClientService.BO.BaseInfo, new()
{
if (rpcClassName == null)
rpcClassName = "TouchScreenRpcs";
var list = RpcFacade.Call<List<RpcObject>>(string.Format("/MainSystem/B3ButcherManage/Rpcs/{0}/{1}", rpcClassName, rpcMethodName));
using (var context = new TransactionContext())
{
var sql1 = string.Format(@"truncate table [{0}];", tableName);
context.Session.ExecuteSqlNonQuery(sql1);
foreach (RpcObject o in list)
{
var entity = new T();
entity.ID = o.Get<long>("ID");
entity.Name = o.Get<string>("Name");
entity.Spell = o.Get<string>("Spell");
context.Session.Insert(entity);
}
context.Commit();
}
}
public string Name
{
get { return "从B3同步数据到Server服务器"; }
}
}
}

+ 72
- 0
B3ClientService/Tasks/UpdateLoad/UploadTest.cs View File

@ -0,0 +1,72 @@
using BWP.B3ClientService.BO;
using Forks.EnterpriseServices.DomainObjects2.DQuery;
using Forks.JsonRpc.Client;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TSingSoft.WebPluginFramework.BWPClients;
using TSingSoft.WebPluginFramework.TimerTasks;
using TSingSoft.WebPluginFramework;
using Forks.JsonRpc.Client.Data;
using Forks.EnterpriseServices.DomainObjects2;
namespace BWP.B3ClientService.Tasks
{
public class UploadTest : ITimerTask
{
public void Execute()
{
var serverUri = ServerHost.GetServerUrl();
if (string.IsNullOrEmpty(serverUri))
throw new Exception("请配置服务器地址");
var list = GetWeightBill();
foreach (var bill in list)
{
BWPClient bwpClient = new BWPClient(serverUri, bill.CreaterName);
var obj = ConvertToRpcObject(bill);
var id =bwpClient.Call<long>("/MainSystem/B3ButcherManage/Rpcs/TouchScreenUploadRpc/InsertWeighBill", obj);
using (var dmo = Dmo.NewSession())
{
}
}
}
IEnumerable<WeightBill> GetWeightBill()
{
var query = new DmoQuery(typeof(WeightBill));
query.Where.Conditions.Add(DQCondition.EQ("Sync", false));
return query.EExecuteList().Cast<WeightBill>();
}
Dictionary<string,object> ConvertToRpcObject(WeightBill bill)
{
var dic = new Dictionary<string, object>();
dic.Add("AccountingUnit_ID", 1);
dic.Add("Department_ID", 5);
dic.Add("Domain_ID", 1);
dic.Add("Zone_ID", bill.Zone_ID);
dic.Add("Employee_ID", bill.Employee_ID);
dic.Add("Supplier_ID", bill.Supplier_ID);
dic.Add("WeighTime", bill.WeightTime);
dic.Add("ShackPrice", bill.PenPrice);
dic.Add("ShackWeight", bill.PenWeight);
dic.Add("PurchaseType", bill.PurchaseType_ID);
dic.Add("Inspector_ID", bill.Inspector_ID);
dic.Add("Car_ID", bill.Car_ID);
dic.Add("AnimalTestNumber", bill.AnimalTestNumber);
dic.Add("AnimalTestDate", bill.AnimalTestDate);
dic.Add("AnimalTestMan", bill.AnimalTestMan);
return dic;
}
public string Name
{
get { return "测试上传"; }
}
}
}

+ 31
- 0
B3ClientService/WordPair.cs View File

@ -0,0 +1,31 @@
using Forks.EnterpriseServices.JsonRpc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BWP.B3ClientService
{
[RpcObject]
public class WordPair
{
public WordPair()
{ }
public WordPair(string displayName)
{
DisplayName = displayName;
}
public WordPair(string displayName, string phyName)
{
DisplayName = displayName;
PhyName = phyName;
}
public string DisplayName { get; set; }
public string PhyName { get; set; }
}
}

+ 25
- 0
WebFolder/config/plugins/B3ClientService.plugin View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<Plugin appVersion="$appVersion" displayName="B3客户端服务" name="B3ClientService" pluginClass="BWP.B3ClientService.PluginClass, B3ClientService.Web" schemaVersion="1.0" sortOrder="-1101" version="1.0" xmlns="http://www.TSingSoft.com/Schemas/WPF.xsd">
<Requires>
<Plugin name="B3Frameworks" version="1.0"/>
</Requires>
<Assemblies>
<File name="B3ClientService.dll" type="bo bl"/>
<File name="B3ClientService.Web.dll" type="web"/>
</Assemblies>
<ContentFiles>
</ContentFiles>
<Profiles>
</Profiles>
<Security>
</Security>
<Features>
</Features>
<Menus>
<Menu id="0001" name="B3基本模块/系统管理/服务器地址设置" url="B3ClientService/ServerHostConfig.aspx"/>
</Menus>
<Features>
</Features>
<Hippo>
</Hippo>
</Plugin>

Loading…
Cancel
Save