Browse Source

白条鲜品客户端 客户,线路,出库

master
luanhui 8 years ago
parent
commit
4497de9d3d
8 changed files with 270 additions and 2 deletions
  1. +6
    -0
      B3ClientService/B3ClientService.csproj
  2. +12
    -0
      B3ClientService/BO/BaseInfo/Customer.cs
  3. +13
    -0
      B3ClientService/BO/BaseInfo/DeliverGoodsLine.cs
  4. +55
    -0
      B3ClientService/BO/Bill/GoodsDetail.cs
  5. +47
    -0
      B3ClientService/BO/Bill/SaleOutStore_/SaleOutStore.cs
  6. +39
    -0
      B3ClientService/Rpcs/BillRpc/BaseInfoRpc.cs
  7. +59
    -0
      B3ClientService/Tasks/SyncBillFromServer.cs
  8. +39
    -2
      B3ClientService/Tasks/SyncInfoFromServer.cs

+ 6
- 0
B3ClientService/B3ClientService.csproj View File

@ -74,6 +74,8 @@
<Compile Include="BO\BaseInfo\BodyDiscontItem.cs" /> <Compile Include="BO\BaseInfo\BodyDiscontItem.cs" />
<Compile Include="BO\BaseInfo\BodyDiscontRelate.cs" /> <Compile Include="BO\BaseInfo\BodyDiscontRelate.cs" />
<Compile Include="BO\BaseInfo\Car.cs" /> <Compile Include="BO\BaseInfo\Car.cs" />
<Compile Include="BO\BaseInfo\Customer.cs" />
<Compile Include="BO\BaseInfo\DeliverGoodsLine.cs" />
<Compile Include="BO\BaseInfo\EmpInfoTable.cs" /> <Compile Include="BO\BaseInfo\EmpInfoTable.cs" />
<Compile Include="BO\BaseInfo\Farmer.cs" /> <Compile Include="BO\BaseInfo\Farmer.cs" />
<Compile Include="BO\BaseInfo\HogGrade.cs" /> <Compile Include="BO\BaseInfo\HogGrade.cs" />
@ -88,10 +90,12 @@
<Compile Include="BO\Bill\CarcassStateWeight\CarcassStateWeight.cs" /> <Compile Include="BO\Bill\CarcassStateWeight\CarcassStateWeight.cs" />
<Compile Include="BO\Bill\CarcassStateWeight\CarcassStateWeightByCode.cs" /> <Compile Include="BO\Bill\CarcassStateWeight\CarcassStateWeightByCode.cs" />
<Compile Include="BO\Bill\CarcassStateWeight\CarcassStateWeightInStore.cs" /> <Compile Include="BO\Bill\CarcassStateWeight\CarcassStateWeightInStore.cs" />
<Compile Include="BO\Bill\GoodsDetail.cs" />
<Compile Include="BO\Bill\GradeAndWeight\GradeAndWeight_Detail.cs" /> <Compile Include="BO\Bill\GradeAndWeight\GradeAndWeight_Detail.cs" />
<Compile Include="BO\Bill\GradeAndWeight\OrderGradeFinishRelate.cs" /> <Compile Include="BO\Bill\GradeAndWeight\OrderGradeFinishRelate.cs" />
<Compile Include="BO\Bill\OrderDetail\HurryRecord.cs" /> <Compile Include="BO\Bill\OrderDetail\HurryRecord.cs" />
<Compile Include="BO\Bill\OrderDetail\OrderDetail.cs" /> <Compile Include="BO\Bill\OrderDetail\OrderDetail.cs" />
<Compile Include="BO\Bill\SaleOutStore_\SaleOutStore.cs" />
<Compile Include="BO\Bill\SecondOrder\SecondOrder.cs" /> <Compile Include="BO\Bill\SecondOrder\SecondOrder.cs" />
<Compile Include="BO\Bill\SecondOrder\SecondOrder_Detail.cs" /> <Compile Include="BO\Bill\SecondOrder\SecondOrder_Detail.cs" />
<Compile Include="BO\Bill\WeightBill\WeightBill.cs" /> <Compile Include="BO\Bill\WeightBill\WeightBill.cs" />
@ -123,6 +127,7 @@
<Compile Include="ConvertUtil.cs" /> <Compile Include="ConvertUtil.cs" />
<Compile Include="CTuple.cs" /> <Compile Include="CTuple.cs" />
<Compile Include="NamedValueTemplate.cs" /> <Compile Include="NamedValueTemplate.cs" />
<Compile Include="Rpcs\BillRpc\BaseInfoRpc.cs" />
<Compile Include="Rpcs\BillRpc\ByProductWeightRecordRpc.cs" /> <Compile Include="Rpcs\BillRpc\ByProductWeightRecordRpc.cs" />
<Compile Include="Rpcs\BillRpc\ClientGoodsSetRpc.cs" /> <Compile Include="Rpcs\BillRpc\ClientGoodsSetRpc.cs" />
<Compile Include="Rpcs\BillRpc\DropPigRpc.cs" /> <Compile Include="Rpcs\BillRpc\DropPigRpc.cs" />
@ -153,6 +158,7 @@
<Compile Include="Rpcs\BillRpc\WeightBillRpc.cs" /> <Compile Include="Rpcs\BillRpc\WeightBillRpc.cs" />
<Compile Include="Rpcs\UserInfoRpc.cs" /> <Compile Include="Rpcs\UserInfoRpc.cs" />
<Compile Include="Tasks\SyncInfoFromServer.cs" /> <Compile Include="Tasks\SyncInfoFromServer.cs" />
<Compile Include="Tasks\SyncBillFromServer.cs" />
<Compile Include="Tasks\UpdateLoad\DoCheckBills.cs" /> <Compile Include="Tasks\UpdateLoad\DoCheckBills.cs" />
<Compile Include="Tasks\UpdateLoad\UploadOrderDetail.cs" /> <Compile Include="Tasks\UpdateLoad\UploadOrderDetail.cs" />
<Compile Include="Tasks\UpdateLoad\UploadSecondOrder.cs" /> <Compile Include="Tasks\UpdateLoad\UploadSecondOrder.cs" />


+ 12
- 0
B3ClientService/BO/BaseInfo/Customer.cs View File

@ -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
{
}
}

+ 13
- 0
B3ClientService/BO/BaseInfo/DeliverGoodsLine.cs View File

@ -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
{
}
}

+ 55
- 0
B3ClientService/BO/Bill/GoodsDetail.cs View File

@ -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; }
}
}

+ 47
- 0
B3ClientService/BO/Bill/SaleOutStore_/SaleOutStore.cs View File

@ -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; }
}
}

+ 39
- 0
B3ClientService/Rpcs/BillRpc/BaseInfoRpc.cs View File

@ -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);
}
}
}

+ 59
- 0
B3ClientService/Tasks/SyncBillFromServer.cs View File

@ -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服务器"; }}
}
}

+ 39
- 2
B3ClientService/Tasks/SyncInfoFromServer.cs View File

@ -55,15 +55,52 @@ namespace BWP.B3ClientService.Tasks
SyncLiveVarieties(); SyncLiveVarieties();
SyncBodyDiscontItem(); SyncBodyDiscontItem();
SyncClientGoodsSet(); SyncClientGoodsSet();
SyncCustomer();
SyncDeliverGoodsLine();
} }
//catch //catch
{ } { }
} }
private void SyncDeliverGoodsLine()
{
var json = RpcFacade.Call<string>("/MainSystem/B3Sale/Rpcs/OffLineRpc/OffLineBaseInfo/OffLineBaseInfoRpc/SyncDeliverGoodsLineList");
var list = JsonConvert.DeserializeObject<List<DeliverGoodsLine>>(json);
using (var context = new TransactionContext())
{
var sql1 = @"truncate table [B3ClientService_DeliverGoodsLine];";
context.Session.ExecuteSqlNonQuery(sql1);
foreach (DeliverGoodsLine dmo in list)
{
context.Session.Insert(dmo);
}
context.Commit();
}
}
private void SyncCustomer()
{
var json = RpcFacade.Call<string>("/MainSystem/B3Sale/Rpcs/OffLineRpc/OffLineBaseInfo/OffLineBaseInfoRpc/SyncCustomerList");
var list = JsonConvert.DeserializeObject<List<Customer>>(json);
using (var context = new TransactionContext())
{
var sql1 = @"truncate table [B3ClientService_Customer];";
context.Session.ExecuteSqlNonQuery(sql1);
foreach (Customer dmo in list)
{
context.Session.Insert(dmo);
}
context.Commit();
}
}
private void SyncClientGoodsSet() private void SyncClientGoodsSet()
{ {
var jsonStr = RpcFacade.Call<string>("/MainSystem/B3ButcherManageForClient/Rpcs/ClientGoodsSetRpc/GetList"); var jsonStr = RpcFacade.Call<string>("/MainSystem/B3ButcherManageForClient/Rpcs/ClientGoodsSetRpc/GetList");
var list =JsonConvert.DeserializeObject<List<ClientGoodsSet>>(jsonStr);
var list = JsonConvert.DeserializeObject<List<ClientGoodsSet>>(jsonStr);
using (var context = new TransactionContext()) using (var context = new TransactionContext())
{ {
var sql1 = @"truncate table [B3ClientService_ClientGoodsSet];truncate table [B3ClientService_ClientGoodsSet_Detail];"; var sql1 = @"truncate table [B3ClientService_ClientGoodsSet];truncate table [B3ClientService_ClientGoodsSet_Detail];";
@ -178,7 +215,7 @@ namespace BWP.B3ClientService.Tasks
void SyncLivestock() void SyncLivestock()
{ {
var result = RpcFacade.Call<string>("/MainSystem/B3ButcherManage/Rpcs/TouchScreenRpcs/GetLivestock"); var result = RpcFacade.Call<string>("/MainSystem/B3ButcherManage/Rpcs/TouchScreenRpcs/GetLivestock");
var list = serializer.Deserialize<List<CTuple<long, string, short, int?,string>>>(result);
var list = serializer.Deserialize<List<CTuple<long, string, short, int?, string>>>(result);
using (var context = new TransactionContext()) using (var context = new TransactionContext())
{ {
var sql1 = @"truncate table [B3ClientService_Livestock];"; var sql1 = @"truncate table [B3ClientService_Livestock];";


Loading…
Cancel
Save