|
|
@ -2,6 +2,8 @@ |
|
|
using Forks.EnterpriseServices.DomainObjects2; |
|
|
using Forks.EnterpriseServices.DomainObjects2; |
|
|
using Forks.EnterpriseServices.DomainObjects2.DQuery; |
|
|
using Forks.EnterpriseServices.DomainObjects2.DQuery; |
|
|
using Forks.EnterpriseServices.JsonRpc; |
|
|
using Forks.EnterpriseServices.JsonRpc; |
|
|
|
|
|
using Forks.EnterpriseServices.SqlDoms; |
|
|
|
|
|
using Forks.JsonRpc.Client.Data; |
|
|
using System; |
|
|
using System; |
|
|
using System.Collections.Generic; |
|
|
using System.Collections.Generic; |
|
|
using System.Linq; |
|
|
using System.Linq; |
|
|
@ -57,5 +59,70 @@ namespace BWP.B3ClientService.Rpcs.BillRpc |
|
|
query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("DeleteState", false), DQCondition.Between("WeighTime", date.Date, date.Date + new TimeSpan(23, 59, 29)))); |
|
|
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(); |
|
|
return query.EExecuteList().Cast<WeightBill>().ToList(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
[Rpc] |
|
|
|
|
|
public static List<WeightBill> GetNoHouseInfoWeightBills(DateTime date) |
|
|
|
|
|
{ |
|
|
|
|
|
var main = new JoinAlias(typeof(WeightBill)); |
|
|
|
|
|
var detail = new JoinAlias(typeof(WeightBill_HouseDetail)); |
|
|
|
|
|
var query = new DQueryDom(main); |
|
|
|
|
|
query.From.AddJoin(JoinType.Left, new DQDmoSource(detail), DQCondition.And(DQCondition.EQ(main, "ID", detail, "WeightBill_ID"), DQCondition.EQ(detail, "DeleteState", false))); |
|
|
|
|
|
query.Where.Conditions.Add(DQCondition.And(DQCondition.And(DQCondition.EQ("DeleteState", false), DQCondition.Between("WeighTime", date.Date, date.Date + new TimeSpan(23, 59, 29))))); |
|
|
|
|
|
query.Where.Conditions.Add(DQCondition.IsNull(DQExpression.Field(detail, "ID"))); |
|
|
|
|
|
query.Columns.Add(DQSelectColumn.Field("ID")); |
|
|
|
|
|
query.Columns.Add(DQSelectColumn.Field("B3ID")); |
|
|
|
|
|
query.Columns.Add(DQSelectColumn.Field("Supplier_Name")); |
|
|
|
|
|
var result = query.EExecuteList<long, long?, string>(); |
|
|
|
|
|
var list = new List<WeightBill>(); |
|
|
|
|
|
foreach (var item in result) |
|
|
|
|
|
{ |
|
|
|
|
|
var entity = new WeightBill(); |
|
|
|
|
|
list.Add(entity); |
|
|
|
|
|
entity.ID = item.Item1; |
|
|
|
|
|
entity.B3ID = item.Item2; |
|
|
|
|
|
entity.Supplier_Name = item.Item3; |
|
|
|
|
|
} |
|
|
|
|
|
return list; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
[Rpc] |
|
|
|
|
|
public static int InsertWeightBillHouseDetail(WeightBill bo) |
|
|
|
|
|
{ |
|
|
|
|
|
using (var session = Dmo.NewSession()) |
|
|
|
|
|
{ |
|
|
|
|
|
foreach (var item in bo.HouseDetails) |
|
|
|
|
|
session.Insert(item); |
|
|
|
|
|
foreach (var item in bo.SanctionDetails) |
|
|
|
|
|
session.Insert(item); |
|
|
|
|
|
|
|
|
|
|
|
var update = new DQUpdateDom(typeof(WeightBill)); |
|
|
|
|
|
update.Columns.Add(new DQUpdateColumn("HogGrade_ID", bo.HogGrade_ID)); |
|
|
|
|
|
update.Columns.Add(new DQUpdateColumn("HogGrade_Name", bo.HogGrade_Name)); |
|
|
|
|
|
update.Columns.Add(new DQUpdateColumn("Inspector_ID", bo.Inspector_ID)); |
|
|
|
|
|
update.Columns.Add(new DQUpdateColumn("Inspector_Name", bo.Inspector_Name)); |
|
|
|
|
|
update.Columns.Add(new DQUpdateColumn("Sync", false)); |
|
|
|
|
|
update.Columns.Add(new DQUpdateColumn("ModifyTime", DateTime.Now)); |
|
|
|
|
|
update.Where.Conditions.Add(DQCondition.EQ("ID", bo.ID)); |
|
|
|
|
|
session.ExecuteNonQuery(update); |
|
|
|
|
|
session.Commit(); |
|
|
|
|
|
} |
|
|
|
|
|
return 1; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
[Rpc] |
|
|
|
|
|
public static int GetHouseDetailTotalNumber(DateTime date) |
|
|
|
|
|
{ |
|
|
|
|
|
var main = new JoinAlias(typeof(WeightBill)); |
|
|
|
|
|
var detail = new JoinAlias(typeof(WeightBill_HouseDetail)); |
|
|
|
|
|
var query = new DQueryDom(main); |
|
|
|
|
|
query.From.AddJoin(JoinType.Left, new DQDmoSource(detail), DQCondition.And(DQCondition.EQ(main, "ID", detail, "WeightBill_ID"), DQCondition.EQ(detail, "DeleteState", false))); |
|
|
|
|
|
query.Where.Conditions.Add(DQCondition.And(DQCondition.And(DQCondition.EQ("DeleteState", false), DQCondition.Between("WeighTime", date.Date, date.Date + new TimeSpan(23, 59, 29))))); |
|
|
|
|
|
query.Columns.Add(DQSelectColumn.Sum(detail, "Number")); |
|
|
|
|
|
var result = query.EExecuteScalar(); |
|
|
|
|
|
|
|
|
|
|
|
if (result == null) |
|
|
|
|
|
return 0; |
|
|
|
|
|
return Convert.ToInt32(result); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |