| @ -0,0 +1,12 @@ | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| namespace BWP.B3ClientService.BO | |||
| { | |||
| [Serializable] | |||
| public class Customer : BaseInfo | |||
| { | |||
| } | |||
| } | |||
| @ -0,0 +1,13 @@ | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| namespace BWP.B3ClientService.BO | |||
| { | |||
| [Serializable] | |||
| public class DeliverGoodsLine: BaseInfo | |||
| { | |||
| } | |||
| } | |||
| @ -0,0 +1,55 @@ | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| using BWP.B3Frameworks.BO; | |||
| using Forks.EnterpriseServices; | |||
| using Forks.EnterpriseServices.DomainObjects2; | |||
| namespace BWP.B3ClientService.BO | |||
| { | |||
| public abstract class GoodsDetail:Base | |||
| { | |||
| [LogicName("存货编码")] | |||
| public string Goods_Code { get; set; } | |||
| [LogicName("存货")] | |||
| public string Goods_Name { get; set; } | |||
| [LogicName("主数量")] | |||
| public decimal? Number { get; set; } | |||
| [LogicName("辅数量")] | |||
| public decimal? SecondNumber { get; set; } | |||
| [LogicName("报价单位")] | |||
| public string Unit { get; set; } | |||
| [LogicName("报价数量")] | |||
| public decimal? UnitNum { get; set; } | |||
| [LogicName("主单位比率")] | |||
| [DbColumn(DefaultValue = 1)] | |||
| public decimal LeftRatio { get; set; } | |||
| [LogicName("辅单位比率")] | |||
| [DbColumn(DefaultValue = 1)] | |||
| public decimal RightRatio { get; set; } | |||
| [LogicName("主单位")] | |||
| public string Goods_MainUnit { get; set; } | |||
| [LogicName("辅单位")] | |||
| public string Goods_SecondUnit { get; set; } | |||
| [LogicName("主辅转换方向")] | |||
| public string Goods_UnitConvertDirection { get; set; } | |||
| [LogicName("主辅换算主单位比例")] | |||
| public decimal? Goods_MainUnitRatio { get; set; } | |||
| [LogicName("主辅换算辅单位比例")] | |||
| public decimal? Goods_SecondUnitRatio { get; set; } | |||
| } | |||
| } | |||
| @ -0,0 +1,47 @@ | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| using BWP.B3Frameworks.BO; | |||
| using Forks.EnterpriseServices; | |||
| using Forks.EnterpriseServices.DataForm; | |||
| using Forks.EnterpriseServices.DomainObjects2; | |||
| namespace BWP.B3ClientService.BO | |||
| { | |||
| [DFClass,Serializable] | |||
| public class SaleOutStore: GoodsDetail | |||
| { | |||
| [LogicName("出库单号")] | |||
| public long SaleOutStore_ID { get; set; } | |||
| [LogicName("购货客户")] | |||
| public string Customer_Name { get; set; } | |||
| [LogicName("送货地址")] | |||
| [DbColumn(Length = 100)] | |||
| public string DeliverAddress { get; set; } | |||
| [LogicName("仓库")] | |||
| public string Store_Name { get; set; } | |||
| [LogicName("运输车辆")] | |||
| public string Car { get; set; } | |||
| [LogicName("发货时间")] | |||
| public DateTime? LoadTime { get; set; } | |||
| [LogicName("单据状态")] | |||
| public string BillState { get; set; } | |||
| [LogicName("销售出库明细ID")] | |||
| public long SaleOutStoreDetail_ID { get; set; } | |||
| } | |||
| } | |||
| @ -0,0 +1,39 @@ | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| using BWP.B3ClientService.BO; | |||
| using Forks.EnterpriseServices.DomainObjects2.DQuery; | |||
| using Forks.EnterpriseServices.JsonRpc; | |||
| using Newtonsoft.Json; | |||
| using TSingSoft.WebPluginFramework; | |||
| namespace BWP.B3ClientService.Rpcs.BillRpc | |||
| { | |||
| [Rpc] | |||
| public static class BaseInfoRpc | |||
| { | |||
| [Rpc] | |||
| public static string SyncCustomer(string input) | |||
| { | |||
| var dmoquery = new DmoQuery(typeof(Customer)); | |||
| if (!string.IsNullOrWhiteSpace(input)) | |||
| { | |||
| dmoquery.Where.Conditions.Add(DQCondition.Or(DQCondition.Like("Name", input), DQCondition.Like("Spell", input))); | |||
| } | |||
| var list = dmoquery.EExecuteList().Cast<Customer>().ToList(); | |||
| return JsonConvert.SerializeObject(list); | |||
| } | |||
| [Rpc] | |||
| public static string SyncDeliverGoodsLine(string input) | |||
| { | |||
| var dmoquery = new DmoQuery(typeof(DeliverGoodsLine)); | |||
| if (!string.IsNullOrWhiteSpace(input)) | |||
| { | |||
| dmoquery.Where.Conditions.Add(DQCondition.Or(DQCondition.Like("Name",input),DQCondition.Like("Spell",input))); | |||
| } | |||
| var list = dmoquery.EExecuteList().Cast<DeliverGoodsLine>().ToList(); | |||
| return JsonConvert.SerializeObject(list); | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,59 @@ | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| using BWP.B3ClientService.BO; | |||
| using Forks.EnterpriseServices.BusinessInterfaces; | |||
| using Forks.JsonRpc.Client; | |||
| using Forks.JsonRpc.Client.Data; | |||
| using Newtonsoft.Json; | |||
| using TSingSoft.WebPluginFramework.TimerTasks; | |||
| namespace BWP.B3ClientService.Tasks | |||
| { | |||
| public class SyncBillFromServer : ITimerTask | |||
| { | |||
| public void Execute() | |||
| { | |||
| var serverUri = ServerHost.GetServerUrl(); | |||
| if (string.IsNullOrEmpty(serverUri)) | |||
| throw new Exception("请配置服务器地址"); | |||
| //try | |||
| { | |||
| try | |||
| { | |||
| RpcFacade.Init(serverUri, "B3ClientServer"); | |||
| } | |||
| catch (Exception ex) | |||
| { | |||
| if (ex.Message != "Can only start once") | |||
| throw; | |||
| } | |||
| SyncSaleOutStore(); | |||
| } | |||
| } | |||
| private void SyncSaleOutStore() | |||
| { | |||
| //只更新一个星期的 | |||
| var minDate = DateTime.Today.AddDays(-7); | |||
| var json = RpcFacade.Call<string>("/MainSystem/B3Sale/Rpcs/OffLineRpc/OffLineSaleOutStore/OffLineSaleOutStoreRpc/GetSaleOutStoreList", minDate); | |||
| var list = JsonConvert.DeserializeObject<List<SaleOutStore>>(json); | |||
| using (var context = new TransactionContext()) | |||
| { | |||
| var sql1 = @"truncate table [B3ClientService_SaleOutStore];"; | |||
| context.Session.ExecuteSqlNonQuery(sql1); | |||
| foreach (SaleOutStore dmo in list) | |||
| { | |||
| context.Session.Insert(dmo); | |||
| } | |||
| context.Commit(); | |||
| } | |||
| } | |||
| public string Name { get { return "从B3同步单据到Server服务器"; }} | |||
| } | |||
| } | |||