Browse Source

修改。

master
yibo 8 years ago
parent
commit
94c4fc0915
11 changed files with 337 additions and 90 deletions
  1. +7
    -0
      B3ClientService/B3ClientService.csproj
  2. +43
    -23
      B3ClientService/BO/Bill/WeightBill/WeightBill.cs
  3. +29
    -0
      B3ClientService/BO/Bill/WeightBill/WeightBill_Detail.cs
  4. +27
    -0
      B3ClientService/BO/Bill/WeightBill/WeightBill_FarmerDetail.cs
  5. +22
    -0
      B3ClientService/BO/Bill/WeightBill/WeightBill_HouseDetail.cs
  6. +33
    -0
      B3ClientService/BO/Bill/WeightBill/WeightBill_SanctionDetail.cs
  7. +23
    -0
      B3ClientService/BO/SyncBase.cs
  8. +30
    -0
      B3ClientService/BO/SyncBill.cs
  9. +21
    -0
      B3ClientService/Rpcs/BackRpcObj.cs
  10. +37
    -2
      B3ClientService/Rpcs/BillRpc/WeightBillRpc.cs
  11. +65
    -65
      B3ClientService/Tasks/UpdateLoad/UploadTest.cs

+ 7
- 0
B3ClientService/B3ClientService.csproj View File

@ -76,12 +76,19 @@
<Compile Include="BO\BaseInfo\Supplier.cs" />
<Compile Include="BO\BaseInfo\Zone.cs" />
<Compile Include="BO\Bill\WeightBill\WeightBill.cs" />
<Compile Include="BO\Bill\WeightBill\WeightBill_Detail.cs" />
<Compile Include="BO\Bill\WeightBill\WeightBill_FarmerDetail.cs" />
<Compile Include="BO\Bill\WeightBill\WeightBill_HouseDetail.cs" />
<Compile Include="BO\Bill\WeightBill\WeightBill_SanctionDetail.cs" />
<Compile Include="BO\ButcherOrder\ButcherOrder.cs" />
<Compile Include="BO\ButcherOrder\ButcherOrder_Detail.cs" />
<Compile Include="BO\SyncBase.cs" />
<Compile Include="BO\SyncBill.cs" />
<Compile Include="BO\SyncBO\MinEmployee.cs" />
<Compile Include="BO\SyncBO\MinWPF_User.cs" />
<Compile Include="BO\ServerHost.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Rpcs\BackRpcObj.cs" />
<Compile Include="Rpcs\BaseInfoRpc.cs" />
<Compile Include="Rpcs\BillRpc\WeightBillRpc.cs" />
<Compile Include="Rpcs\ButcherOrderRpc.cs" />


+ 43
- 23
B3ClientService/BO/Bill/WeightBill/WeightBill.cs View File

@ -8,45 +8,58 @@ using TSingSoft.WebPluginFramework;
namespace BWP.B3ClientService.BO
{
[Serializable, BOClass]
public class WeightBill
[Serializable]
public class WeightBill : SyncBill
{
public string CreaterName { get; set; }
public long? AccountingUnit_ID { get; set; }
public long? Department_ID { get; set; }
public long? Employee_ID { get; set; }
public string Employee_Name { get; set; }
public DateTime? WeighTime { get; set; }
public long? Supplier_ID { get; set; }
public string Supplier_Name { get; set; }
public long? Zone_ID { get; set; }
public string Zone_Name { get; set; }
public short? PurchaseType_ID { get; set; }
public string PurchaseType_Name { get; set; }
public DateTime? WeightTime { get; set; }
public long? Car_ID { get; set; }
public string Car_Name { get; set; }
public long? Livestock_ID { get; set; }
public long? LiveVarieties_ID { get; set; }
public string Livestock_Name { get; set; }
public long? Employee_ID { get; set; }
public string Employee_Name { get; set; }
public string LiveVarieties_Name { get; set; }
public long? HogGrade_ID { get; set; }
public string HogGrade_Name { get; set; }
public long? Zone_ID { get; set; }
public string Zone_Name { get; set; }
public decimal? PenWeight { get; set; }
public decimal? ShackWeight { get; set; }
public decimal? PenPrice { get; set; }
public decimal? ShackPrice { get; set; }
public decimal? PenMoney { get; set; }
[NonDmoProperty]
public decimal? ShackMoney
{
get
{
var v = ShackPrice * ShackWeight;
if (v.HasValue)
return decimal.Round(v.Value, 2);
return null;
}
}
public string AnimalTestNumber { get; set; }
@ -54,13 +67,20 @@ namespace BWP.B3ClientService.BO
public string AnimalTestMan { get; set; }
public string Remark { get; set; }
public long? Inspector_ID { get; set; }
public long? Inspector_Name { get; set; }
public string Inspector_Name { get; set; }
public string Remark { get; set; }
private readonly WeightBill_DetailCollection mDetails = new WeightBill_DetailCollection();
[OneToMany(typeof(WeightBill_Detail), "ID")]
[Join("ID", "WeightBill_ID")]
public WeightBill_DetailCollection Details { get { return mDetails; } }
[DbColumn(DefaultValue = 0)]
public bool Sync { get; set; }
private readonly WeightBill_FarmerDetailCollection mFarmerDetails = new WeightBill_FarmerDetailCollection();
[OneToMany(typeof(WeightBill_FarmerDetail), "ID")]
[Join("ID", "WeightBill_ID")]
public WeightBill_FarmerDetailCollection FarmerDetails { get { return mFarmerDetails; } }
}
}

+ 29
- 0
B3ClientService/BO/Bill/WeightBill/WeightBill_Detail.cs View File

@ -0,0 +1,29 @@
using Forks.EnterpriseServices.DomainObjects2;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BWP.B3ClientService.BO
{
[Serializable]
public class WeightBill_Detail : SyncBase
{
public long WeightBill_ID { get; set; }
public int Index { get; set; }
public int? Number { get; set; }
public decimal? PiWeight { get; set; }
public decimal? MaoWeight { get; set; }
public decimal? Weight { get; set; }
}
[Serializable]
public class WeightBill_DetailCollection : DmoCollection<WeightBill_Detail>
{ }
}

+ 27
- 0
B3ClientService/BO/Bill/WeightBill/WeightBill_FarmerDetail.cs View File

@ -0,0 +1,27 @@
using Forks.EnterpriseServices.DomainObjects2;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BWP.B3ClientService.BO
{
[Serializable]
public class WeightBill_FarmerDetail : SyncBase
{
public long WeightBill_ID { get; set; }
public int Index { get; set; }
public long? Farmer_ID { get; set; }
public string Farmer_Name { get; set; }
public int? Number { get; set; }
}
[Serializable]
public class WeightBill_FarmerDetailCollection : DmoCollection<WeightBill_FarmerDetail>
{ }
}

+ 22
- 0
B3ClientService/BO/Bill/WeightBill/WeightBill_HouseDetail.cs View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BWP.B3ClientService.BO
{
[Serializable]
public class WeightBill_HouseDetail : SyncBase
{
public long WeightBill_ID { get; set; }
public int Index { get; set; }
public long? LiveColonyHouse_ID { get; set; }
public long? LiveColonyHouse_Name { get; set; }
public int? Number { get; set; }
}
}

+ 33
- 0
B3ClientService/BO/Bill/WeightBill/WeightBill_SanctionDetail.cs View File

@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BWP.B3ClientService.BO
{
[Serializable]
public class WeightBill_SanctionDetail : SyncBase
{
public long WeightBill_ID { get; set; }
public int Index { get; set; }
/// <summary>
/// 异常奖罚配置
/// </summary>
public long? Sanction_ID { get; set; }
/// <summary>
/// 异常项目ID
/// </summary>
public long? AbnormalItem_ID { get; set; }
/// <summary>
/// 异常项目名称
/// </summary>
public long? AbnormalItem_Name { get; set; }
public int? Number { get; set; }
}
}

+ 23
- 0
B3ClientService/BO/SyncBase.cs View File

@ -0,0 +1,23 @@
using BWP.B3Frameworks.BO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BWP.B3ClientService.BO
{
[Serializable]
public abstract class SyncBase : Base
{
/// <summary>
/// 对应B3ID
/// </summary>
public long? B3ID { get; set; }
/// <summary>
/// 删除状态
/// </summary>
public bool DeleteState { get; set; }
}
}

+ 30
- 0
B3ClientService/BO/SyncBill.cs View File

@ -0,0 +1,30 @@
using Forks.EnterpriseServices.DomainObjects2;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BWP.B3ClientService.BO
{
[Serializable]
public class SyncBill : SyncBase
{
/// <summary>
/// 单据创建人用户名
/// </summary>
public string Creator { get; set; }
/// <summary>
/// 单据是否完整可以上传
/// </summary>
public bool FinishCreate { get; set; }
/// <summary>
/// 同步状态
/// </summary>
public bool Sync { get; set; }
public DateTime ModifyTime { get; set; }
}
}

+ 21
- 0
B3ClientService/Rpcs/BackRpcObj.cs View File

@ -0,0 +1,21 @@
using Forks.EnterpriseServices.JsonRpc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BWP.B3ClientService.Rpcs
{
[RpcObject]
public class BackRpcObj
{
public long ID { get; set; }
public string Flag { get; set; }
private List<BackRpcObj> _detailBack = new List<BackRpcObj>();
public List<BackRpcObj> DetailBack { get { return _detailBack; } }
}
}

+ 37
- 2
B3ClientService/Rpcs/BillRpc/WeightBillRpc.cs View File

@ -1,11 +1,13 @@
using BWP.B3ClientService.BO;
using Forks.EnterpriseServices.DomainObjects2;
using Forks.EnterpriseServices.DomainObjects2.DQuery;
using Forks.EnterpriseServices.JsonRpc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TSingSoft.WebPluginFramework;
namespace BWP.B3ClientService.Rpcs.BillRpc
{
@ -13,14 +15,47 @@ namespace BWP.B3ClientService.Rpcs.BillRpc
public static class WeightBillRpc
{
[Rpc]
public static bool UploadBill(WeightBill dmo)
public static BackRpcObj UploadBill(WeightBill dmo)
{
using (var session = Dmo.NewSession())
{
session.Insert(dmo);
if (dmo.ID == 0)
session.Insert(dmo);
else
session.Update(dmo);
session.Commit();
}
var result = new BackRpcObj();
result.ID = dmo.ID;
var details = new BackRpcObj() { Flag = "Details" };
foreach (var d in dmo.Details)
details.DetailBack.Add(new BackRpcObj() { Flag = d.Index.ToString(), ID = d.ID });
result.DetailBack.Add(details);
var farmerDetails = new BackRpcObj() { Flag = "Details" };
foreach (var d in dmo.FarmerDetails)
farmerDetails.DetailBack.Add(new BackRpcObj() { Flag = d.Index.ToString(), ID = d.ID });
result.DetailBack.Add(farmerDetails);
return result;
}
[Rpc]
public static bool DeleteBill(long id)
{
using (var session = Dmo.NewSession())
{
var update = new DQUpdateDom(typeof(WeightBill));
update.Columns.Add(new DQUpdateColumn("DeleteState", true));
update.Where.Conditions.Add(DQCondition.EQ("ID", id));
}
return true;
}
[Rpc]
public static List<WeightBill> GetWeightBillList(DateTime date)
{
var query = new DmoQuery(typeof(WeightBill));
query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("DeleteState", false), DQCondition.Between("WeighTime", date.Date, date.Date + new TimeSpan(23, 59, 29))));
return query.EExecuteList().Cast<WeightBill>().ToList();
}
}
}

+ 65
- 65
B3ClientService/Tasks/UpdateLoad/UploadTest.cs View File

@ -1,72 +1,72 @@
using BWP.B3ClientService.BO;
using Forks.EnterpriseServices.DomainObjects2.DQuery;
using Forks.JsonRpc.Client;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TSingSoft.WebPluginFramework.BWPClients;
using TSingSoft.WebPluginFramework.TimerTasks;
using TSingSoft.WebPluginFramework;
using Forks.JsonRpc.Client.Data;
using Forks.EnterpriseServices.DomainObjects2;
//using BWP.B3ClientService.BO;
//using Forks.EnterpriseServices.DomainObjects2.DQuery;
//using Forks.JsonRpc.Client;
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using System.Threading.Tasks;
//using TSingSoft.WebPluginFramework.BWPClients;
//using TSingSoft.WebPluginFramework.TimerTasks;
//using TSingSoft.WebPluginFramework;
//using Forks.JsonRpc.Client.Data;
//using Forks.EnterpriseServices.DomainObjects2;
namespace BWP.B3ClientService.Tasks
{
public class UploadTest : ITimerTask
{
public void Execute()
{
var serverUri = ServerHost.GetServerUrl();
if (string.IsNullOrEmpty(serverUri))
throw new Exception("请配置服务器地址");
//namespace BWP.B3ClientService.Tasks
//{
// public class UploadTest : ITimerTask
// {
// public void Execute()
// {
// var serverUri = ServerHost.GetServerUrl();
// if (string.IsNullOrEmpty(serverUri))
// throw new Exception("请配置服务器地址");
var list = GetWeightBill();
foreach (var bill in list)
{
BWPClient bwpClient = new BWPClient(serverUri, bill.CreaterName);
var obj = ConvertToRpcObject(bill);
var id =bwpClient.Call<long>("/MainSystem/B3ButcherManage/Rpcs/TouchScreenUploadRpc/InsertWeighBill", obj);
using (var dmo = Dmo.NewSession())
{
// var list = GetWeightBill();
// foreach (var bill in list)
// {
// BWPClient bwpClient = new BWPClient(serverUri, bill.CreaterName);
// var obj = ConvertToRpcObject(bill);
// var id =bwpClient.Call<long>("/MainSystem/B3ButcherManage/Rpcs/TouchScreenUploadRpc/InsertWeighBill", obj);
// using (var dmo = Dmo.NewSession())
// {
}
// }
}
}
// }
// }
IEnumerable<WeightBill> GetWeightBill()
{
var query = new DmoQuery(typeof(WeightBill));
query.Where.Conditions.Add(DQCondition.EQ("Sync", false));
return query.EExecuteList().Cast<WeightBill>();
}
// IEnumerable<WeightBill> GetWeightBill()
// {
// var query = new DmoQuery(typeof(WeightBill));
// query.Where.Conditions.Add(DQCondition.EQ("Sync", false));
// return query.EExecuteList().Cast<WeightBill>();
// }
Dictionary<string,object> ConvertToRpcObject(WeightBill bill)
{
var dic = new Dictionary<string, object>();
dic.Add("AccountingUnit_ID", 1);
dic.Add("Department_ID", 5);
dic.Add("Domain_ID", 1);
dic.Add("Zone_ID", bill.Zone_ID);
dic.Add("Employee_ID", bill.Employee_ID);
dic.Add("Supplier_ID", bill.Supplier_ID);
dic.Add("WeighTime", bill.WeightTime);
dic.Add("ShackPrice", bill.PenPrice);
dic.Add("ShackWeight", bill.PenWeight);
dic.Add("PurchaseType", bill.PurchaseType_ID);
dic.Add("Inspector_ID", bill.Inspector_ID);
dic.Add("Car_ID", bill.Car_ID);
dic.Add("AnimalTestNumber", bill.AnimalTestNumber);
dic.Add("AnimalTestDate", bill.AnimalTestDate);
dic.Add("AnimalTestMan", bill.AnimalTestMan);
return dic;
}
// Dictionary<string,object> ConvertToRpcObject(WeightBill bill)
// {
// var dic = new Dictionary<string, object>();
// dic.Add("AccountingUnit_ID", 1);
// dic.Add("Department_ID", 5);
// dic.Add("Domain_ID", 1);
// dic.Add("Zone_ID", bill.Zone_ID);
// dic.Add("Employee_ID", bill.Employee_ID);
// dic.Add("Supplier_ID", bill.Supplier_ID);
// dic.Add("WeighTime", bill.WeightTime);
// dic.Add("ShackPrice", bill.ShackPrice);
// dic.Add("ShackWeight", bill.ShackWeight);
// dic.Add("PurchaseType", bill.PurchaseType_ID);
// dic.Add("Inspector_ID", bill.Inspector_ID);
// dic.Add("Car_ID", bill.Car_ID);
// dic.Add("AnimalTestNumber", bill.AnimalTestNumber);
// dic.Add("AnimalTestDate", bill.AnimalTestDate);
// dic.Add("AnimalTestMan", bill.AnimalTestMan);
// return dic;
// }
public string Name
{
get { return "测试上传"; }
}
}
}
// public string Name
// {
// get { return "测试上传"; }
// }
// }
//}

Loading…
Cancel
Save