diff --git a/B3ClientService/B3ClientService.csproj b/B3ClientService/B3ClientService.csproj
index c53de64..67d86ab 100644
--- a/B3ClientService/B3ClientService.csproj
+++ b/B3ClientService/B3ClientService.csproj
@@ -76,12 +76,19 @@
+
+
+
+
+
+
+
diff --git a/B3ClientService/BO/Bill/WeightBill/WeightBill.cs b/B3ClientService/BO/Bill/WeightBill/WeightBill.cs
index 8a9a412..b8b94a5 100644
--- a/B3ClientService/BO/Bill/WeightBill/WeightBill.cs
+++ b/B3ClientService/BO/Bill/WeightBill/WeightBill.cs
@@ -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; } }
}
}
diff --git a/B3ClientService/BO/Bill/WeightBill/WeightBill_Detail.cs b/B3ClientService/BO/Bill/WeightBill/WeightBill_Detail.cs
new file mode 100644
index 0000000..61c88d6
--- /dev/null
+++ b/B3ClientService/BO/Bill/WeightBill/WeightBill_Detail.cs
@@ -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
+ { }
+}
diff --git a/B3ClientService/BO/Bill/WeightBill/WeightBill_FarmerDetail.cs b/B3ClientService/BO/Bill/WeightBill/WeightBill_FarmerDetail.cs
new file mode 100644
index 0000000..eb6415e
--- /dev/null
+++ b/B3ClientService/BO/Bill/WeightBill/WeightBill_FarmerDetail.cs
@@ -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
+ { }
+}
diff --git a/B3ClientService/BO/Bill/WeightBill/WeightBill_HouseDetail.cs b/B3ClientService/BO/Bill/WeightBill/WeightBill_HouseDetail.cs
new file mode 100644
index 0000000..d1311f8
--- /dev/null
+++ b/B3ClientService/BO/Bill/WeightBill/WeightBill_HouseDetail.cs
@@ -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; }
+ }
+}
diff --git a/B3ClientService/BO/Bill/WeightBill/WeightBill_SanctionDetail.cs b/B3ClientService/BO/Bill/WeightBill/WeightBill_SanctionDetail.cs
new file mode 100644
index 0000000..8b47dd2
--- /dev/null
+++ b/B3ClientService/BO/Bill/WeightBill/WeightBill_SanctionDetail.cs
@@ -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; }
+
+ ///
+ /// 异常奖罚配置
+ ///
+ public long? Sanction_ID { get; set; }
+
+ ///
+ /// 异常项目ID
+ ///
+ public long? AbnormalItem_ID { get; set; }
+
+ ///
+ /// 异常项目名称
+ ///
+ public long? AbnormalItem_Name { get; set; }
+
+ public int? Number { get; set; }
+ }
+}
diff --git a/B3ClientService/BO/SyncBase.cs b/B3ClientService/BO/SyncBase.cs
new file mode 100644
index 0000000..22a24c1
--- /dev/null
+++ b/B3ClientService/BO/SyncBase.cs
@@ -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
+ {
+ ///
+ /// 对应B3ID
+ ///
+ public long? B3ID { get; set; }
+
+ ///
+ /// 删除状态
+ ///
+ public bool DeleteState { get; set; }
+ }
+}
diff --git a/B3ClientService/BO/SyncBill.cs b/B3ClientService/BO/SyncBill.cs
new file mode 100644
index 0000000..5a16bfb
--- /dev/null
+++ b/B3ClientService/BO/SyncBill.cs
@@ -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
+ {
+ ///
+ /// 单据创建人用户名
+ ///
+ public string Creator { get; set; }
+
+ ///
+ /// 单据是否完整可以上传
+ ///
+ public bool FinishCreate { get; set; }
+
+ ///
+ /// 同步状态
+ ///
+ public bool Sync { get; set; }
+
+ public DateTime ModifyTime { get; set; }
+ }
+}
diff --git a/B3ClientService/Rpcs/BackRpcObj.cs b/B3ClientService/Rpcs/BackRpcObj.cs
new file mode 100644
index 0000000..36e487b
--- /dev/null
+++ b/B3ClientService/Rpcs/BackRpcObj.cs
@@ -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 _detailBack = new List();
+
+ public List DetailBack { get { return _detailBack; } }
+ }
+}
diff --git a/B3ClientService/Rpcs/BillRpc/WeightBillRpc.cs b/B3ClientService/Rpcs/BillRpc/WeightBillRpc.cs
index 8c57327..19db263 100644
--- a/B3ClientService/Rpcs/BillRpc/WeightBillRpc.cs
+++ b/B3ClientService/Rpcs/BillRpc/WeightBillRpc.cs
@@ -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 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().ToList();
+ }
}
}
diff --git a/B3ClientService/Tasks/UpdateLoad/UploadTest.cs b/B3ClientService/Tasks/UpdateLoad/UploadTest.cs
index d57793d..294b71a 100644
--- a/B3ClientService/Tasks/UpdateLoad/UploadTest.cs
+++ b/B3ClientService/Tasks/UpdateLoad/UploadTest.cs
@@ -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("/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("/MainSystem/B3ButcherManage/Rpcs/TouchScreenUploadRpc/InsertWeighBill", obj);
+// using (var dmo = Dmo.NewSession())
+// {
- }
+// }
- }
- }
+// }
+// }
- IEnumerable GetWeightBill()
- {
- var query = new DmoQuery(typeof(WeightBill));
- query.Where.Conditions.Add(DQCondition.EQ("Sync", false));
- return query.EExecuteList().Cast();
- }
+// IEnumerable GetWeightBill()
+// {
+// var query = new DmoQuery(typeof(WeightBill));
+// query.Where.Conditions.Add(DQCondition.EQ("Sync", false));
+// return query.EExecuteList().Cast();
+// }
- Dictionary ConvertToRpcObject(WeightBill bill)
- {
- var dic = new Dictionary();
- 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 ConvertToRpcObject(WeightBill bill)
+// {
+// var dic = new Dictionary();
+// 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 "测试上传"; }
+// }
+// }
+//}