using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; using BWP.B3ClientService.BO; using Forks.EnterpriseServices.DomainObjects2.DQuery; using Forks.JsonRpc.Client; using Newtonsoft.Json; using Customer = BO.BO.BaseInfo.Customer; namespace BO.Utils.BillRpc { public class SaleOutStoreRpc { public static BindingList SyncList(DateTime date, string customerName,string sendLineName,string billstate,bool updateLocalDb) { var resList=new BindingList(); if (LoginRpcUtil.TestConnection(100)) { var json = RpcFacade.Call("/MainSystem/B3ClientService/Rpcs/BillRpc/SaleOutStoreRpc/SyncList", date,customerName,sendLineName,billstate); var list = JsonConvert.DeserializeObject>(json); if (updateLocalDb) { // AddLocalSaleOutStore(list); } foreach (SaleOutStore store in list) { resList.Add(store); } } else { var dmoquery = new DmoQuery(typeof(SaleOutStore)); dmoquery.Where.Conditions.Add(DQCondition.GreaterThanOrEqual("LoadTime", date)); dmoquery.Where.Conditions.Add(DQCondition.LessThan("LoadTime", date.AddDays(1))); if (!string.IsNullOrWhiteSpace(customerName)) { dmoquery.Where.Conditions.Add(DQCondition.EQ("Customer_Name", customerName)); } if (!string.IsNullOrWhiteSpace(sendLineName)) { dmoquery.Where.Conditions.Add(DQCondition.EQ("DeliverGoodsLine_Name", sendLineName)); } if (!string.IsNullOrWhiteSpace(sendLineName)) { dmoquery.Where.Conditions.Add(DQCondition.EQ("BillState", billstate)); } var list = new List(); using (var session=LocalDmoSession.New()) { list =session.ExecuteList(dmoquery).Cast().ToList(); } foreach (SaleOutStore store in list) { resList.Add(store); } } return resList; } } }