Browse Source

修改

master
yibo 8 years ago
parent
commit
1dd40e5ec2
5 changed files with 112 additions and 10 deletions
  1. +2
    -0
      B3ClientService/B3ClientService.csproj
  2. +16
    -0
      B3ClientService/BO/BaseInfo/BodyDiscontItem.cs
  3. +19
    -0
      B3ClientService/BO/BaseInfo/BodyDiscontRelate.cs
  4. +40
    -0
      B3ClientService/Rpcs/BillRpc/GradeAndWeightRpc.cs
  5. +35
    -10
      B3ClientService/Tasks/SyncInfoFromServer.cs

+ 2
- 0
B3ClientService/B3ClientService.csproj View File

@ -66,6 +66,8 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="BO\BaseInfo\BaseInfo.cs" /> <Compile Include="BO\BaseInfo\BaseInfo.cs" />
<Compile Include="BO\BaseInfo\BodyDiscontItem.cs" />
<Compile Include="BO\BaseInfo\BodyDiscontRelate.cs" />
<Compile Include="BO\BaseInfo\Car.cs" /> <Compile Include="BO\BaseInfo\Car.cs" />
<Compile Include="BO\BaseInfo\EmpInfoTable.cs" /> <Compile Include="BO\BaseInfo\EmpInfoTable.cs" />
<Compile Include="BO\BaseInfo\Farmer.cs" /> <Compile Include="BO\BaseInfo\Farmer.cs" />


+ 16
- 0
B3ClientService/BO/BaseInfo/BodyDiscontItem.cs View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Forks.EnterpriseServices.DomainObjects2;
namespace BWP.B3ClientService.BO
{
[Serializable]
public class BodyDiscontItem : BaseInfo
{
[ReferenceTo(typeof(BodyDiscontRelate), "Discont")]
[Join("ID", "BodyDiscontItem_ID")]
public decimal? Discont { get; set; }
}
}

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

@ -0,0 +1,19 @@
using Forks.EnterpriseServices.DomainObjects2;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TSingSoft.WebPluginFramework;
namespace BWP.B3ClientService.BO
{
[BOClass]
[Serializable]
[KeyField("BodyDiscontItem_ID", KeyGenType.assigned)]
public class BodyDiscontRelate
{
public long BodyDiscontItem_ID { get; set; }
public decimal? Discont { get; set; }
}
}

+ 40
- 0
B3ClientService/Rpcs/BillRpc/GradeAndWeightRpc.cs View File

@ -205,5 +205,45 @@ namespace BWP.B3ClientService.Rpcs.BillRpc
query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("OrderDetail_ID", orderDetailID), DQCondition.EQ("Technics", technics))); query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("OrderDetail_ID", orderDetailID), DQCondition.EQ("Technics", technics)));
return query.EExecuteScalar<OrderGradeFinishRelate>(); return query.EExecuteScalar<OrderGradeFinishRelate>();
} }
[Rpc]
public static string GetBodyDiscontItemSetting()
{
var query = new DmoQuery(typeof(BodyDiscontItem));
var list = query.EExecuteList().Cast<BodyDiscontItem>().ToList();
return serializer.Serialize(list);
}
[Rpc]
public static int SaveBodyDiscontItemSetting(string json)
{
var list = serializer.Deserialize<List<CTuple<long, decimal?>>>(json);
using (var session = Dmo.NewSession())
{
foreach (var item in list)
{
var entity = new BodyDiscontRelate();
entity.BodyDiscontItem_ID = item.Item1;
entity.Discont = item.Item2;
session.AddUpdateOrInsert(entity);
}
session.Commit();
}
return 1;
}
[Rpc]
public static int UpdateWeight(long id, decimal? weight)
{
using (var session = Dmo.NewSession())
{
var update = new DQUpdateDom(typeof(GradeAndWeight_Detail));
update.Where.Conditions.Add(DQCondition.EQ("ID", id));
update.Columns.Add(new DQUpdateColumn("Weight", weight));
session.ExecuteNonQuery(update);
session.Commit();
}
return 1;
}
} }
} }

+ 35
- 10
B3ClientService/Tasks/SyncInfoFromServer.cs View File

@ -52,6 +52,7 @@ namespace BWP.B3ClientService.Tasks
SyncLiveColonyHouse(); SyncLiveColonyHouse();
SyncSanction(); SyncSanction();
SyncLiveVarieties(); SyncLiveVarieties();
SyncBodyDiscontItem();
} }
//catch //catch
{ } { }
@ -62,8 +63,7 @@ namespace BWP.B3ClientService.Tasks
var list = RpcFacade.Call<List<RpcObject>>("/MainSystem/B3ButcherManage/Rpcs/TouchScreenRpcs/GetWpfUser"); var list = RpcFacade.Call<List<RpcObject>>("/MainSystem/B3ButcherManage/Rpcs/TouchScreenRpcs/GetWpfUser");
using (var context = new TransactionContext()) using (var context = new TransactionContext())
{ {
var sql1 = @"truncate table [WPF_User];SET IDENTITY_INSERT [WPF_User] ON;
";
var sql1 = @"truncate table [WPF_User];SET IDENTITY_INSERT [WPF_User] ON;";
context.Session.ExecuteSqlNonQuery(sql1); context.Session.ExecuteSqlNonQuery(sql1);
foreach (RpcObject o in list) foreach (RpcObject o in list)
{ {
@ -86,8 +86,7 @@ namespace BWP.B3ClientService.Tasks
var list = RpcFacade.Call<List<RpcObject>>("/MainSystem/B3ButcherManage/Rpcs/TouchScreenRpcs/GetUserEmployee"); var list = RpcFacade.Call<List<RpcObject>>("/MainSystem/B3ButcherManage/Rpcs/TouchScreenRpcs/GetUserEmployee");
using (var context = new TransactionContext()) using (var context = new TransactionContext())
{ {
var sql1 = @"truncate table [B3Frameworks_User_Employee];
";
var sql1 = @"truncate table [B3Frameworks_User_Employee];";
context.Session.ExecuteSqlNonQuery(sql1); context.Session.ExecuteSqlNonQuery(sql1);
foreach (RpcObject o in list) foreach (RpcObject o in list)
{ {
@ -105,8 +104,7 @@ namespace BWP.B3ClientService.Tasks
var list = RpcFacade.Call<List<RpcObject>>("/MainSystem/B3ButcherManage/Rpcs/TouchScreenRpcs/GetEmployee"); var list = RpcFacade.Call<List<RpcObject>>("/MainSystem/B3ButcherManage/Rpcs/TouchScreenRpcs/GetEmployee");
using (var context = new TransactionContext()) using (var context = new TransactionContext())
{ {
var sql1 = @"truncate table [B3Frameworks_Employee];SET IDENTITY_INSERT [B3Frameworks_Employee] ON;
";
var sql1 = @"truncate table [B3Frameworks_Employee];SET IDENTITY_INSERT [B3Frameworks_Employee] ON;";
context.Session.ExecuteSqlNonQuery(sql1); context.Session.ExecuteSqlNonQuery(sql1);
foreach (RpcObject o in list) foreach (RpcObject o in list)
{ {
@ -180,13 +178,41 @@ namespace BWP.B3ClientService.Tasks
} }
} }
void SyncBodyDiscontItem()
{
SyncBaseInfoFromString<BodyDiscontItem>("GetBodyDiscontItem");
}
void SyncBaseInfoFromString<T>(string rpcMethodName, string rpcClassName = null)
where T : BWP.B3ClientService.BO.BaseInfo, new()
{
if (rpcClassName == null)
rpcClassName = "TouchScreenRpcs";
var result = RpcFacade.Call<string>(string.Format("/MainSystem/B3ButcherManage/Rpcs/{0}/{1}", rpcClassName, rpcMethodName));
var list = serializer.Deserialize<List<CTuple<long, string, string>>>(result);
var dmoInfo = DmoInfo.Get(typeof(T));
using (var context = new TransactionContext())
{
var sql1 = string.Format(@"truncate table [{0}];", dmoInfo.MappedDBObject);
context.Session.ExecuteSqlNonQuery(sql1);
foreach (var item in list)
{
var entity = new T();
entity.ID = item.Item1;
entity.Name = item.Item2;
entity.Spell = item.Item3;
context.Session.Insert(entity);
}
context.Commit();
}
}
void SyncPurchaseType() void SyncPurchaseType()
{ {
var list = RpcFacade.Call<List<RpcObject>>("/MainSystem/B3ButcherManage/Rpcs/TouchScreenRpcs/GetPurchaseType"); var list = RpcFacade.Call<List<RpcObject>>("/MainSystem/B3ButcherManage/Rpcs/TouchScreenRpcs/GetPurchaseType");
using (var context = new TransactionContext()) using (var context = new TransactionContext())
{ {
var sql1 = @"truncate table [B3ClientService_PurchaseType];
";
var sql1 = @"truncate table [B3ClientService_PurchaseType];";
context.Session.ExecuteSqlNonQuery(sql1); context.Session.ExecuteSqlNonQuery(sql1);
foreach (RpcObject o in list) foreach (RpcObject o in list)
{ {
@ -229,8 +255,7 @@ namespace BWP.B3ClientService.Tasks
var list = RpcFacade.Call<List<RpcObject>>("/MainSystem/B3ButcherManage/Rpcs/TouchScreenRpcs/GetSanctionSetting"); var list = RpcFacade.Call<List<RpcObject>>("/MainSystem/B3ButcherManage/Rpcs/TouchScreenRpcs/GetSanctionSetting");
using (var context = new TransactionContext()) using (var context = new TransactionContext())
{ {
var sql1 = @"truncate table [B3ClientService_Sanction];
";
var sql1 = @"truncate table [B3ClientService_Sanction];";
context.Session.ExecuteSqlNonQuery(sql1); context.Session.ExecuteSqlNonQuery(sql1);
foreach (RpcObject o in list) foreach (RpcObject o in list)
{ {


Loading…
Cancel
Save