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<SaleOutStore> SyncList(DateTime date, string customerName,string sendLineName,string billstate,bool updateLocalDb)
|
|
{
|
|
var resList=new BindingList<SaleOutStore>();
|
|
if (LoginRpcUtil.TestConnection(100))
|
|
{
|
|
var json = RpcFacade.Call<string>("/MainSystem/B3ClientService/Rpcs/BillRpc/SaleOutStoreRpc/SyncList", date,customerName,sendLineName,billstate);
|
|
var list = JsonConvert.DeserializeObject<List<SaleOutStore>>(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<SaleOutStore>();
|
|
using (var session=LocalDmoSession.New())
|
|
{
|
|
list =session.ExecuteList(dmoquery).Cast<SaleOutStore>().ToList();
|
|
}
|
|
foreach (SaleOutStore store in list)
|
|
{
|
|
resList.Add(store);
|
|
}
|
|
}
|
|
return resList;
|
|
}
|
|
}
|
|
}
|