Browse Source

修改。

master
yibo 8 years ago
parent
commit
9348a7c953
11 changed files with 240 additions and 135 deletions
  1. +3
    -3
      B3ClientService/B3ClientService.csproj
  2. +13
    -3
      B3ClientService/BO/BaseInfo/Livestock.cs
  3. +32
    -0
      B3ClientService/BO/Bill/GradeAndWeight/GradeAndWeight_Detail.cs
  4. +0
    -29
      B3ClientService/BO/ButcherOrder/ButcherOrder.cs
  5. +0
    -19
      B3ClientService/BO/ButcherOrder/ButcherOrder_Detail.cs
  6. +20
    -0
      B3ClientService/CTuple.cs
  7. +20
    -0
      B3ClientService/RpcBO/Bill/GradeAndWeight/GradeAndWeight.cs
  8. +15
    -6
      B3ClientService/Rpcs/BaseInfoRpc.cs
  9. +117
    -0
      B3ClientService/Rpcs/BillRpc/GradeAndWeightRpc.cs
  10. +0
    -74
      B3ClientService/Rpcs/ButcherOrderRpc.cs
  11. +20
    -1
      B3ClientService/Tasks/SyncInfoFromServer.cs

+ 3
- 3
B3ClientService/B3ClientService.csproj View File

@ -77,6 +77,7 @@
<Compile Include="BO\BaseInfo\Sanction.cs" /> <Compile Include="BO\BaseInfo\Sanction.cs" />
<Compile Include="BO\BaseInfo\Supplier.cs" /> <Compile Include="BO\BaseInfo\Supplier.cs" />
<Compile Include="BO\BaseInfo\Zone.cs" /> <Compile Include="BO\BaseInfo\Zone.cs" />
<Compile Include="BO\Bill\GradeAndWeight\GradeAndWeight_Detail.cs" />
<Compile Include="BO\Bill\OrderDetail\OrderDetail.cs" /> <Compile Include="BO\Bill\OrderDetail\OrderDetail.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" />
@ -85,8 +86,6 @@
<Compile Include="BO\Bill\WeightBill\WeightBill_FarmerDetail.cs" /> <Compile Include="BO\Bill\WeightBill\WeightBill_FarmerDetail.cs" />
<Compile Include="BO\Bill\WeightBill\WeightBill_HouseDetail.cs" /> <Compile Include="BO\Bill\WeightBill\WeightBill_HouseDetail.cs" />
<Compile Include="BO\Bill\WeightBill\WeightBill_SanctionDetail.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\SyncBase.cs" />
<Compile Include="BO\SyncBill.cs" /> <Compile Include="BO\SyncBill.cs" />
<Compile Include="BO\SyncBO\MinEmployee.cs" /> <Compile Include="BO\SyncBO\MinEmployee.cs" />
@ -94,6 +93,7 @@
<Compile Include="BO\ServerHost.cs" /> <Compile Include="BO\ServerHost.cs" />
<Compile Include="ConvertUtil.cs" /> <Compile Include="ConvertUtil.cs" />
<Compile Include="CTuple.cs" /> <Compile Include="CTuple.cs" />
<Compile Include="RpcBO\Bill\GradeAndWeight\GradeAndWeight.cs" />
<Compile Include="RpcBO\Bill\OrderDetail\NeedOrderEntity.cs" /> <Compile Include="RpcBO\Bill\OrderDetail\NeedOrderEntity.cs" />
<Compile Include="RpcBO\Bill\OrderDetail\RpcOrderBill.cs" /> <Compile Include="RpcBO\Bill\OrderDetail\RpcOrderBill.cs" />
<Compile Include="RpcBO\Bill\OrderDetail\SOrderDetail.cs" /> <Compile Include="RpcBO\Bill\OrderDetail\SOrderDetail.cs" />
@ -107,8 +107,8 @@
<Compile Include="Rpcs\BaseInfoRpc.cs" /> <Compile Include="Rpcs\BaseInfoRpc.cs" />
<Compile Include="Rpcs\BillRpc\OrderDetailRpc.cs" /> <Compile Include="Rpcs\BillRpc\OrderDetailRpc.cs" />
<Compile Include="Rpcs\BillRpc\SecondOrderRpc.cs" /> <Compile Include="Rpcs\BillRpc\SecondOrderRpc.cs" />
<Compile Include="Rpcs\BillRpc\GradeAndWeightRpc.cs" />
<Compile Include="Rpcs\BillRpc\WeightBillRpc.cs" /> <Compile Include="Rpcs\BillRpc\WeightBillRpc.cs" />
<Compile Include="Rpcs\ButcherOrderRpc.cs" />
<Compile Include="Rpcs\UserInfoRpc.cs" /> <Compile Include="Rpcs\UserInfoRpc.cs" />
<Compile Include="Tasks\SyncInfoFromServer.cs" /> <Compile Include="Tasks\SyncInfoFromServer.cs" />
<Compile Include="Tasks\UpdateLoad\UploadOrderDetail.cs" /> <Compile Include="Tasks\UpdateLoad\UploadOrderDetail.cs" />


+ 13
- 3
B3ClientService/BO/BaseInfo/Livestock.cs View File

@ -1,13 +1,23 @@
using System;
using Forks.EnterpriseServices.DomainObjects2;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using TSingSoft.WebPluginFramework;
namespace BWP.B3ClientService.BO namespace BWP.B3ClientService.BO
{ {
[Serializable]
public class Livestock : BaseInfo
[Serializable, BOClass]
[KeyField("ID", KeyGenType.assigned)]
public class Livestock
{ {
public long ID { get; set; }
public string Name { get; set; }
public short Technics { get; set; }
public int? SortNum { get; set; }
} }
} }

+ 32
- 0
B3ClientService/BO/Bill/GradeAndWeight/GradeAndWeight_Detail.cs View File

@ -0,0 +1,32 @@
using BWP.B3Frameworks.BO;
using Forks.EnterpriseServices.DomainObjects2;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BWP.B3ClientService.BO
{
public class GradeAndWeight_Detail : Base
{
public int Index { get; set; }
public long OrderDetail_ID { get; set; }
[ReferenceTo(typeof(OrderDetail), "Order")]
[Join("OrderDetail_ID", "ID")]
public int? Order { get; set; }
public short Technics { get; set; }
public string Technics_Name { get; set; }
public long Livestock_ID { get; set; }
public string Livestock_Name { get; set; }
public decimal? Weight { get; set; }
public DateTime Time { get; set; }
}
}

+ 0
- 29
B3ClientService/BO/ButcherOrder/ButcherOrder.cs View File

@ -1,29 +0,0 @@
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 class ButcherOrder : Base
{
public long BillID { get; set; }
public long BillDetailID { get; set; }
public int Order { get; set; }
public int PlanNumber { get; set; }
public DateTime Date { get; set; }
public int HotFadeNumber { get; set; }
public bool Sync { get; set; }
public bool UpLoad { get; set; }
}
}

+ 0
- 19
B3ClientService/BO/ButcherOrder/ButcherOrder_Detail.cs View File

@ -1,19 +0,0 @@
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 class ButcherOrder_Detail : Base
{
public long ButcherOrder_ID { get; set; }
public DateTime Date { get; set; }
public int Number { get; set; }
}
}

+ 20
- 0
B3ClientService/CTuple.cs View File

@ -39,4 +39,24 @@ namespace BWP.B3ClientService
Item3 = t3; Item3 = t3;
} }
} }
public class CTuple<T1, T2, T3, T4>
{
public T1 Item1 { get; set; }
public T2 Item2 { get; set; }
public T3 Item3 { get; set; }
public T4 Item4 { get; set; }
public CTuple()
{ }
public CTuple(T1 t1, T2 t2, T3 t3, T4 t4)
{
Item1 = t1;
Item2 = t2;
Item3 = t3;
Item4 = t4;
}
}
} }

+ 20
- 0
B3ClientService/RpcBO/Bill/GradeAndWeight/GradeAndWeight.cs View File

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BWP.B3ClientService.RpcBO
{
public class GradeAndWeight
{
public long OrderDetail_ID { get; set; }
public int Order { get; set; }
public string Technics_Name { get; set; }
public int Number { get; set; }
public int Already { get; set; }
}
}

+ 15
- 6
B3ClientService/Rpcs/BaseInfoRpc.cs View File

@ -9,6 +9,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Web.Script.Serialization;
using TSingSoft.WebPluginFramework; using TSingSoft.WebPluginFramework;
namespace BWP.B3ClientService.Rpcs namespace BWP.B3ClientService.Rpcs
@ -16,18 +17,14 @@ namespace BWP.B3ClientService.Rpcs
[Rpc] [Rpc]
public static class BaseInfoRpc public static class BaseInfoRpc
{ {
static JavaScriptSerializer serializer = new JavaScriptSerializer();
[Rpc] [Rpc]
public static List<WordPair> GetCarList(string input, string args, int top) public static List<WordPair> GetCarList(string input, string args, int top)
{ {
return GetBaseInfoList<Car>(input, args, top); return GetBaseInfoList<Car>(input, args, top);
} }
[Rpc]
public static List<WordPair> GetLivestockList(string input, string args, int top)
{
return GetBaseInfoList<Livestock>(input, args, top);
}
[Rpc] [Rpc]
public static List<WordPair> GetSupplierList(string input, string args, int top) public static List<WordPair> GetSupplierList(string input, string args, int top)
{ {
@ -134,6 +131,18 @@ namespace BWP.B3ClientService.Rpcs
return dmo.EExecuteList().Cast<Sanction>().ToList(); return dmo.EExecuteList().Cast<Sanction>().ToList();
} }
[Rpc]
public static string GetLivestock()
{
var query = new DQueryDom(new JoinAlias(typeof(Livestock)));
query.Columns.Add(DQSelectColumn.Field("ID"));
query.Columns.Add(DQSelectColumn.Field("Name"));
query.Columns.Add(DQSelectColumn.Field("Technics"));
query.OrderBy.Expressions.Add(DQOrderByExpression.Create("SortNum", false));
var list = query.EExecuteList<long, string, short>().Select(x => new CTuple<long, string, short>(x.Item1, x.Item2, x.Item3)).ToList();
return serializer.Serialize(list);
}
[Rpc] [Rpc]
public static List<WordPair> GetLiveVarietiesList(string input, string args, int top) public static List<WordPair> GetLiveVarietiesList(string input, string args, int top)
{ {


+ 117
- 0
B3ClientService/Rpcs/BillRpc/GradeAndWeightRpc.cs View File

@ -0,0 +1,117 @@
using BWP.B3ClientService.BO;
using BWP.B3ClientService.RpcBO;
using Forks.EnterpriseServices.DomainObjects2;
using Forks.EnterpriseServices.DomainObjects2.DQuery;
using Forks.EnterpriseServices.JsonRpc;
using Forks.EnterpriseServices.SqlDoms;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Script.Serialization;
using TSingSoft.WebPluginFramework;
namespace BWP.B3ClientService.Rpcs.BillRpc
{
[Rpc]
public static class GradeAndWeightRpc
{
static JavaScriptSerializer serializer = new JavaScriptSerializer();
[Rpc]
public static string GetGradeAndWeightList(DateTime date)
{
var main = new JoinAlias(typeof(SecondOrder));
var order = new JoinAlias(typeof(OrderDetail));
var detail = new JoinAlias(typeof(GradeAndWeight_Detail));
var query = new DQueryDom(main);
query.From.AddJoin(JoinType.Left, new DQDmoSource(order), DQCondition.EQ(main, "OrderDetail_ID", order, "ID"));
query.From.AddJoin(JoinType.Left, new DQDmoSource(detail), DQCondition.EQ(main, "OrderDetail_ID", detail, "OrderDetail_ID"));
query.Columns.Add(DQSelectColumn.Field("OrderDetail_ID"));
query.Columns.Add(DQSelectColumn.Field("Order", order));
query.Columns.Add(DQSelectColumn.Field("PlanNumber", order));
query.Columns.Add(DQSelectColumn.Field("HotFadeNumber"));
query.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.LogicCase(DQCondition.EQ(detail, "Technics", 0), DQExpression.Value(1), DQExpression.Value(0))), "Tang"));
query.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.LogicCase(DQCondition.EQ(detail, "Technics", 1), DQExpression.Value(1), DQExpression.Value(0))), "Mao"));
query.GroupBy.Expressions.Add(DQExpression.Field("OrderDetail_ID"));
query.GroupBy.Expressions.Add(DQExpression.Field(order, "Order"));
query.GroupBy.Expressions.Add(DQExpression.Field(order, "PlanNumber"));
query.GroupBy.Expressions.Add(DQExpression.Field("HotFadeNumber"));
query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("IsOk", true), DQCondition.Between(DQExpression.Field(order, "Date"), date, date + new TimeSpan(23, 59, 29))));
var list = new List<GradeAndWeight>();
using (var session = Dmo.NewSession())
{
using (var reader = session.ExecuteReader(query))
{
while (reader.Read())
{
var tang = new GradeAndWeight();
tang.OrderDetail_ID = (long)reader[0];
tang.Order = (int)reader[1];
tang.Number = (int)reader[3];
if (tang.Number != 0)
{
tang.Technics_Name = "烫褪";
tang.Already = Convert.ToInt32(reader[4]);
list.Add(tang);
}
var lastNumber = (int)reader[2] - tang.Number;
if (lastNumber == 0)
continue;
var mb = new GradeAndWeight();
list.Add(mb);
mb.OrderDetail_ID = tang.OrderDetail_ID;
mb.Order = tang.Order;
mb.Number = lastNumber;
mb.Technics_Name = "毛剥";
mb.Already = Convert.ToInt32(reader[5]);
}
}
}
return serializer.Serialize(list);
}
[Rpc]
public static string GetDetailsList(DateTime start, DateTime end, int? order, int type)
{
var query = new DmoQuery(typeof(GradeAndWeight_Detail));
query.Where.Conditions.Add(DQCondition.Between("Time", start, end + new TimeSpan(23, 59, 29)));
if (type != -1)
query.Where.Conditions.Add(DQCondition.EQ("Technics", type));
if (order.HasValue)
query.Where.Conditions.Add(DQCondition.EQ("Order", order));
query.OrderBy.Expressions.Add(DQOrderByExpression.Create("Time"));
return serializer.Serialize(query.EExecuteList());
}
[Rpc]
public static long InsertDetail(string json)
{
json = json.ESerializeDateTime();
var entity = serializer.Deserialize<GradeAndWeight_Detail>(json);
using (var session = Dmo.NewSession())
{
session.Insert(entity);
session.Commit();
return entity.ID;
}
}
[Rpc]
public static int FillWeight(long id, decimal weight)
{
using (var session = Dmo.NewSession())
{
var update = new DQUpdateDom(typeof(GradeAndWeight_Detail));
update.Where.Conditions.Add(DQCondition.EQ("ID", id));
update.Columns.Add(new DQUpdateColumn("Weight", weight));
session.ExecuteNonQuery(update);
session.Commit();
}
return 1;
}
}
}

+ 0
- 74
B3ClientService/Rpcs/ButcherOrderRpc.cs View File

@ -1,74 +0,0 @@
using BWP.B3ClientService.BO;
using BWP.B3Frameworks.Utils;
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
{
[Rpc]
public static class ButcherOrderRpc
{
[Rpc]
public static List<ButcherOrder> GetButcherOrder(DateTime date)
{
var query = new DmoQuery(typeof(ButcherOrder));
query.Where.Conditions.Add(DQCondition.EQ("Date", date));
return query.EExecuteList().Cast<ButcherOrder>().ToList();
}
[Rpc]
public static List<ButcherOrder_Detail> GetOrderDetail(long orderID)
{
var query = new DmoQuery(typeof(ButcherOrder_Detail));
query.Where.Conditions.Add(DQCondition.EQ("ButcherOrder_ID", orderID));
query.OrderBy.Expressions.Add(DQOrderByExpression.Create("ID"));
return query.EExecuteList().Cast<ButcherOrder_Detail>().ToList();
}
static void UpdateButcherOrder(IDmoSession session, long id, int hotFadeNumber)
{
var order = InnerBLUtil.GetSingleDmo<ButcherOrder>(session, "ID", id, "HotFadeNumber", "Sync");
order.HotFadeNumber += hotFadeNumber;
if (hotFadeNumber < 0 && order.Sync)
order.Sync = false;
var update = new DQUpdateDom(typeof(ButcherOrder));
update.Where.Conditions.Add(DQCondition.EQ("HotFadeNumber", order.HotFadeNumber));
update.Where.Conditions.Add(DQCondition.EQ("Sync", order.Sync));
update.Where.Conditions.Add(DQCondition.EQ("ID", id));
session.ExecuteNonQuery(update);
}
[Rpc]
public static void InsertOrderDetail(long orderID, int number)
{
using (var session = Dmo.NewSession())
{
var detail = new ButcherOrder_Detail();
detail.Number = number;
detail.Date = DateTime.Now;
detail.ButcherOrder_ID = orderID;
session.Insert(detail);
UpdateButcherOrder(session, orderID, detail.Number);
session.Commit();
}
}
[Rpc]
public static void DeleteOrderDetail(long id)
{
using (var session = Dmo.NewSession())
{
var detail = InnerBLUtil.GetSingleDmo<ButcherOrder_Detail>(session, "ID", id, "ButcherOrder_ID", "Number");
UpdateButcherOrder(session, detail.ButcherOrder_ID, -detail.Number);
session.Commit();
}
}
}
}

+ 20
- 1
B3ClientService/Tasks/SyncInfoFromServer.cs View File

@ -12,6 +12,7 @@ using System.Data.SqlClient;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Web.Script.Serialization;
using TSingSoft.WebPluginFramework; using TSingSoft.WebPluginFramework;
using TSingSoft.WebPluginFramework.TimerTasks; using TSingSoft.WebPluginFramework.TimerTasks;
@ -19,6 +20,8 @@ namespace BWP.B3ClientService.Tasks
{ {
public class SyncInfoFromServer : ITimerTask public class SyncInfoFromServer : ITimerTask
{ {
static JavaScriptSerializer serializer = new JavaScriptSerializer();
public void Execute() public void Execute()
{ {
var serverUri = ServerHost.GetServerUrl(); var serverUri = ServerHost.GetServerUrl();
@ -158,7 +161,23 @@ namespace BWP.B3ClientService.Tasks
void SyncLivestock() void SyncLivestock()
{ {
SyncBaseInfo<Livestock>("GetLivestock");
var result = RpcFacade.Call<string>("/MainSystem/B3ButcherManage/Rpcs/TouchScreenRpcs/GetLivestock");
var list = serializer.Deserialize<List<CTuple<long, string, short, int?>>>(result);
using (var context = new TransactionContext())
{
var sql1 = @"truncate table [B3ClientService_Livestock];";
context.Session.ExecuteSqlNonQuery(sql1);
foreach (var item in list)
{
var entity = new Livestock();
entity.ID = item.Item1;
entity.Name = item.Item2;
entity.Technics = item.Item3;
entity.SortNum = item.Item4;
context.Session.Insert(entity);
}
context.Commit();
}
} }
void SyncPurchaseType() void SyncPurchaseType()


Loading…
Cancel
Save