Browse Source

修改。

master
yibo 8 years ago
parent
commit
8c5cf03426
4 changed files with 92 additions and 4 deletions
  1. +10
    -0
      B3ClientService/BO/Bill/WeightBill/WeightBill.cs
  2. +8
    -2
      B3ClientService/BO/Bill/WeightBill/WeightBill_HouseDetail.cs
  3. +7
    -2
      B3ClientService/BO/Bill/WeightBill/WeightBill_SanctionDetail.cs
  4. +67
    -0
      B3ClientService/Rpcs/BillRpc/WeightBillRpc.cs

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

@ -82,5 +82,15 @@ namespace BWP.B3ClientService.BO
[OneToMany(typeof(WeightBill_FarmerDetail), "ID")]
[Join("ID", "WeightBill_ID")]
public WeightBill_FarmerDetailCollection FarmerDetails { get { return mFarmerDetails; } }
private readonly WeightBill_HouseDetailCollection mHouseDetails = new WeightBill_HouseDetailCollection();
[OneToMany(typeof(WeightBill_HouseDetail), "ID")]
[Join("ID", "WeightBill_ID")]
public WeightBill_HouseDetailCollection HouseDetails { get { return mHouseDetails; } }
private readonly WeightBill_SanctionDetailCollection mSanctionDetails = new WeightBill_SanctionDetailCollection();
[OneToMany(typeof(WeightBill_SanctionDetail), "ID")]
[Join("ID", "WeightBill_ID")]
public WeightBill_SanctionDetailCollection SanctionDetails { get { return mSanctionDetails; } }
}
}

+ 8
- 2
B3ClientService/BO/Bill/WeightBill/WeightBill_HouseDetail.cs View File

@ -1,4 +1,5 @@
using System;
using Forks.EnterpriseServices.DomainObjects2;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -15,8 +16,13 @@ namespace BWP.B3ClientService.BO
public long? LiveColonyHouse_ID { get; set; }
public long? LiveColonyHouse_Name { get; set; }
public string LiveColonyHouse_Name { get; set; }
public int? Number { get; set; }
}
[Serializable]
public class WeightBill_HouseDetailCollection : DmoCollection<WeightBill_HouseDetail>
{ }
}

+ 7
- 2
B3ClientService/BO/Bill/WeightBill/WeightBill_SanctionDetail.cs View File

@ -1,4 +1,5 @@
using System;
using Forks.EnterpriseServices.DomainObjects2;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -26,8 +27,12 @@ namespace BWP.B3ClientService.BO
/// <summary>
/// 异常项目名称
/// </summary>
public long? AbnormalItem_Name { get; set; }
public string AbnormalItem_Name { get; set; }
public int? Number { get; set; }
}
[Serializable]
public class WeightBill_SanctionDetailCollection : DmoCollection<WeightBill_SanctionDetail>
{ }
}

+ 67
- 0
B3ClientService/Rpcs/BillRpc/WeightBillRpc.cs View File

@ -2,6 +2,8 @@
using Forks.EnterpriseServices.DomainObjects2;
using Forks.EnterpriseServices.DomainObjects2.DQuery;
using Forks.EnterpriseServices.JsonRpc;
using Forks.EnterpriseServices.SqlDoms;
using Forks.JsonRpc.Client.Data;
using System;
using System.Collections.Generic;
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))));
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);
}
}
}

Loading…
Cancel
Save