Browse Source

修改。

master
yibo 8 years ago
parent
commit
652951910b
2 changed files with 15 additions and 7 deletions
  1. +2
    -0
      B3ClientService/Rpcs/BillRpc/OrderDetailRpc.cs
  2. +13
    -7
      B3ClientService/Tasks/UpdateLoad/UploadOrderDetail.cs

+ 2
- 0
B3ClientService/Rpcs/BillRpc/OrderDetailRpc.cs View File

@ -209,6 +209,8 @@ namespace BWP.B3ClientService.Rpcs.BillRpc
{ {
var update = new DQUpdateDom(typeof(OrderDetail)); var update = new DQUpdateDom(typeof(OrderDetail));
update.Columns.Add(new DQUpdateColumn(property, value)); update.Columns.Add(new DQUpdateColumn(property, value));
update.Columns.Add(new DQUpdateColumn("Sync", false));
update.Columns.Add(new DQUpdateColumn("ModifyTime", DateTime.Now));
update.Where.Conditions.Add(DQCondition.EQ("ID", id)); update.Where.Conditions.Add(DQCondition.EQ("ID", id));
session.ExecuteNonQuery(update); session.ExecuteNonQuery(update);
} }


+ 13
- 7
B3ClientService/Tasks/UpdateLoad/UploadOrderDetail.cs View File

@ -21,6 +21,10 @@ namespace BWP.B3ClientService.Tasks.UpdateLoad
public static void Execute(string uri) public static void Execute(string uri)
{ {
var serializer = new JavaScriptSerializer(); var serializer = new JavaScriptSerializer();
#region 删除
DeleteUnSyncDeleteData();
#endregion
//获取所有未上传的数据 //获取所有未上传的数据
var allBill = GetAllNeedSyncBill(); var allBill = GetAllNeedSyncBill();
foreach (var group in allBill.GroupBy(x => new { x.Date, x.AccountingUnit_ID }).OrderBy(x => x.Key.Date)) foreach (var group in allBill.GroupBy(x => new { x.Date, x.AccountingUnit_ID }).OrderBy(x => x.Key.Date))
@ -30,9 +34,6 @@ namespace BWP.B3ClientService.Tasks.UpdateLoad
var bwpClient = new BWPClient(uri, creator); var bwpClient = new BWPClient(uri, creator);
using (var context = new TransactionContext()) using (var context = new TransactionContext())
{ {
#region 删除
DeleteUnSyncDeleteData(context.Session);
#endregion
var entity = new RpcOrderBill(); var entity = new RpcOrderBill();
entity.AccountingUnit_ID = group.Key.AccountingUnit_ID; entity.AccountingUnit_ID = group.Key.AccountingUnit_ID;
entity.Date = group.Key.Date; entity.Date = group.Key.Date;
@ -73,11 +74,16 @@ namespace BWP.B3ClientService.Tasks.UpdateLoad
} }
} }
} }
static void DeleteUnSyncDeleteData(IDmoSession session)
static void DeleteUnSyncDeleteData()
{ {
var delete = new DQDeleteDom(typeof(OrderDetail));
delete.Where.Conditions.Add(DQCondition.And(DQCondition.IsNull(DQExpression.Field("B3ID")), DQCondition.EQ("DeleteState", true)));
session.ExecuteNonQuery(delete);
using (var session = Dmo.NewSession())
{
var delete = new DQDeleteDom(typeof(OrderDetail));
delete.Where.Conditions.Add(DQCondition.And(DQCondition.IsNull(DQExpression.Field("B3ID")), DQCondition.EQ("DeleteState", true)));
session.ExecuteNonQuery(delete);
session.Commit();
}
} }
private static IEnumerable<OrderDetail> GetAllNeedSyncBill() private static IEnumerable<OrderDetail> GetAllNeedSyncBill()


Loading…
Cancel
Save