Browse Source

修改。

master
yibo 8 years ago
parent
commit
03edede999
5 changed files with 114 additions and 11 deletions
  1. +1
    -0
      B3ClientService/B3ClientService.csproj
  2. +3
    -1
      B3ClientService/BO/BaseInfo/BaseInfo.cs
  3. +34
    -0
      B3ClientService/BO/Bill/OrderDetail/OrderDetail.cs
  4. +65
    -0
      B3ClientService/Rpcs/BaseInfoRpc.cs
  5. +11
    -10
      B3ClientService/Tasks/SyncInfoFromServer.cs

+ 1
- 0
B3ClientService/B3ClientService.csproj View File

@ -75,6 +75,7 @@
<Compile Include="BO\BaseInfo\Sanction.cs" />
<Compile Include="BO\BaseInfo\Supplier.cs" />
<Compile Include="BO\BaseInfo\Zone.cs" />
<Compile Include="BO\Bill\OrderDetail\OrderDetail.cs" />
<Compile Include="BO\Bill\WeightBill\WeightBill.cs" />
<Compile Include="BO\Bill\WeightBill\WeightBill_Detail.cs" />
<Compile Include="BO\Bill\WeightBill\WeightBill_FarmerDetail.cs" />


+ 3
- 1
B3ClientService/BO/BaseInfo/BaseInfo.cs View File

@ -1,4 +1,5 @@
using System;
using Forks.EnterpriseServices.DomainObjects2;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -8,6 +9,7 @@ using TSingSoft.WebPluginFramework;
namespace BWP.B3ClientService.BO
{
[Serializable, BOClass]
[KeyField("ID", KeyGenType.assigned)]
public abstract class BaseInfo
{
public long ID { get; set; }


+ 34
- 0
B3ClientService/BO/Bill/OrderDetail/OrderDetail.cs View File

@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BWP.B3ClientService.BO
{
[Serializable]
public class OrderDetail : SyncBill
{
public long? AccountingUnit_ID { get; set; }
public DateTime? Date { get; set; }
public long? B3MainID { get; set; }
public long WeighBill_ID { get; set; }
public int Order { get; set; }
public int PlanNumber { get; set; }
public int? HotFadeNumber { get; set; }
public int? PeelingNumber { get; set; }
public string LiveColonyHouse_Name { get; set; }
public bool IsHurryButcher { get; set; }
public bool SecondarySplit { get; set; }
}
}

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

@ -1,4 +1,5 @@
using BWP.B3ClientService.BO;
using Forks.EnterpriseServices.DataForm;
using Forks.EnterpriseServices.DomainObjects2;
using Forks.EnterpriseServices.DomainObjects2.DQuery;
using Forks.EnterpriseServices.JsonRpc;
@ -138,5 +139,69 @@ namespace BWP.B3ClientService.Rpcs
{
return GetBaseInfoList<LiveVarieties>(input, args, top);
}
[Rpc(RpcFlags.SkipAuth)]
public static int UpdateOrInsertFarmer(Farmer farmer)
{
UpdateBaseInfo(farmer);
return 1;
}
[Rpc(RpcFlags.SkipAuth)]
public static int UpdateOrInsertCar(Car car)
{
UpdateBaseInfo(car);
return 1;
}
[Rpc(RpcFlags.SkipAuth)]
public static int UpdateOrInsertSupplier(Supplier supplier)
{
UpdateBaseInfo(supplier);
return 1;
}
[Rpc(RpcFlags.SkipAuth)]
public static int DeleteFarmer(long id)
{
DeleteBaseInfo<Farmer>(id);
return 1;
}
[Rpc(RpcFlags.SkipAuth)]
public static int DeleteCar(long id)
{
DeleteBaseInfo<Car>(id);
return 1;
}
[Rpc(RpcFlags.SkipAuth)]
public static int DeleteSupplier(long id)
{
DeleteBaseInfo<Supplier>(id);
return 1;
}
static void UpdateBaseInfo<T>(T entity)
where T : BWP.B3ClientService.BO.BaseInfo, new()
{
using (var session = Dmo.NewSession())
{
session.AddUpdateOrInsert(entity);
session.Commit();
}
}
static void DeleteBaseInfo<T>(long id)
where T : BWP.B3ClientService.BO.BaseInfo, new()
{
using (var session = Dmo.NewSession())
{
var delete = new DQDeleteDom(typeof(T));
delete.Where.Conditions.Add(DQCondition.EQ("ID", id));
session.ExecuteNonQuery(delete);
session.Commit();
}
}
}
}

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

@ -153,12 +153,12 @@ namespace BWP.B3ClientService.Tasks
void SyncCar()
{
SyncBaseInfo<Car>("GetCar", "B3ClientService_Car");
SyncBaseInfo<Car>("GetCar");
}
void SyncLivestock()
{
SyncBaseInfo<Livestock>("GetLivestock", "B3ClientService_Livestock");
SyncBaseInfo<Livestock>("GetLivestock");
}
void SyncPurchaseType()
@ -182,27 +182,27 @@ namespace BWP.B3ClientService.Tasks
void SyncSupplier()
{
SyncBaseInfo<Supplier>("GetSupplier", "B3ClientService_Supplier");
SyncBaseInfo<Supplier>("GetSupplier");
}
void SyncZone()
{
SyncBaseInfo<Zone>("GetZone", "B3ClientService_Zone");
SyncBaseInfo<Zone>("GetZone");
}
void SyncFarmer()
{
SyncBaseInfo<Farmer>("GetFarmer", "B3ClientService_Farmer");
SyncBaseInfo<Farmer>("GetFarmer");
}
void SyncHogGrade()
{
SyncBaseInfo<HogGrade>("GetHogGrade", "B3ClientService_HogGrade");
SyncBaseInfo<HogGrade>("GetHogGrade");
}
void SyncLiveColonyHouse()
{
SyncBaseInfo<LiveColonyHouse>("GetLiveColonyHouse", "B3ClientService_LiveColonyHouse");
SyncBaseInfo<LiveColonyHouse>("GetLiveColonyHouse");
}
void SyncSanction()
@ -227,18 +227,19 @@ namespace BWP.B3ClientService.Tasks
void SyncLiveVarieties()
{
SyncBaseInfo<LiveVarieties>("GetLiveVarieties", "B3ClientService_LiveVarieties");
SyncBaseInfo<LiveVarieties>("GetLiveVarieties");
}
void SyncBaseInfo<T>(string rpcMethodName, string tableName, string rpcClassName = null)
void SyncBaseInfo<T>(string rpcMethodName, 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));
var dmoInfo = DmoInfo.Get(typeof(T));
using (var context = new TransactionContext())
{
var sql1 = string.Format(@"truncate table [{0}];", tableName);
var sql1 = string.Format(@"truncate table [{0}];", dmoInfo.MappedDBObject);
context.Session.ExecuteSqlNonQuery(sql1);
foreach (RpcObject o in list)
{


Loading…
Cancel
Save