|
|
@ -51,15 +51,12 @@ namespace BO.Utils.BillRpc |
|
|
{ |
|
|
{ |
|
|
static JavaScriptSerializer serializer = new JavaScriptSerializer(); |
|
|
static JavaScriptSerializer serializer = new JavaScriptSerializer(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void ClearWeightBySID(long sid) |
|
|
public static void ClearWeightBySID(long sid) |
|
|
{ |
|
|
{ |
|
|
var updateDom = new DQUpdateDom(typeof(GradeAndWeight_Detail)); |
|
|
var updateDom = new DQUpdateDom(typeof(GradeAndWeight_Detail)); |
|
|
updateDom.Where.Conditions.Add(DQCondition.EQ("SID", sid)); |
|
|
updateDom.Where.Conditions.Add(DQCondition.EQ("SID", sid)); |
|
|
updateDom.Columns.Add(new DQUpdateColumn("Weight", DQExpression.NULL)); |
|
|
updateDom.Columns.Add(new DQUpdateColumn("Weight", DQExpression.NULL)); |
|
|
|
|
|
updateDom.Columns.Add(new DQUpdateColumn("Sync", false)); |
|
|
using (var session = LocalDmoSession.New()) |
|
|
using (var session = LocalDmoSession.New()) |
|
|
{ |
|
|
{ |
|
|
session.ExecuteNonQuery(updateDom); |
|
|
session.ExecuteNonQuery(updateDom); |
|
|
@ -69,11 +66,13 @@ namespace BO.Utils.BillRpc |
|
|
|
|
|
|
|
|
public static void DeleteBySID(long sid) |
|
|
public static void DeleteBySID(long sid) |
|
|
{ |
|
|
{ |
|
|
var delDom = new DQDeleteDom(typeof(GradeAndWeight_Detail)); |
|
|
|
|
|
delDom.Where.Conditions.Add(DQCondition.EQ("SID", sid)); |
|
|
|
|
|
|
|
|
var updateDom = new DQUpdateDom(typeof(GradeAndWeight_Detail)); |
|
|
|
|
|
updateDom.Where.Conditions.Add(DQCondition.EQ("SID", sid)); |
|
|
|
|
|
updateDom.Columns.Add(new DQUpdateColumn("IsDeleted", true)); |
|
|
|
|
|
updateDom.Columns.Add(new DQUpdateColumn("Sync", false)); |
|
|
using (var session = LocalDmoSession.New()) |
|
|
using (var session = LocalDmoSession.New()) |
|
|
{ |
|
|
{ |
|
|
session.ExecuteNonQuery(delDom); |
|
|
|
|
|
|
|
|
session.ExecuteNonQuery(updateDom); |
|
|
session.Commit(); |
|
|
session.Commit(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
@ -98,7 +97,7 @@ namespace BO.Utils.BillRpc |
|
|
var list = new List<GradeAndWeight_Detail>(); |
|
|
var list = new List<GradeAndWeight_Detail>(); |
|
|
|
|
|
|
|
|
var query = new DmoQuery(typeof(GradeAndWeight_Detail)); |
|
|
var query = new DmoQuery(typeof(GradeAndWeight_Detail)); |
|
|
query.Where.Conditions.Add(DQCondition.EQ("Date", date)); |
|
|
|
|
|
|
|
|
query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("IsDeleted", false), DQCondition.EQ("Date", date))); |
|
|
query.OrderBy.Expressions.Add(DQOrderByExpression.Create("Index", true)); |
|
|
query.OrderBy.Expressions.Add(DQOrderByExpression.Create("Index", true)); |
|
|
query.Range = SelectRange.Top(top); |
|
|
query.Range = SelectRange.Top(top); |
|
|
using (var session = LocalDmoSession.New()) |
|
|
using (var session = LocalDmoSession.New()) |
|
|
@ -112,11 +111,10 @@ namespace BO.Utils.BillRpc |
|
|
return bindList; |
|
|
return bindList; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public static int GetTangTuiSumNumber(DateTime date) |
|
|
|
|
|
|
|
|
public static int GetSumNumber(DateTime date, short type) |
|
|
{ |
|
|
{ |
|
|
var query = new DQueryDom(new JoinAlias(typeof(GradeAndWeight_Detail))); |
|
|
var query = new DQueryDom(new JoinAlias(typeof(GradeAndWeight_Detail))); |
|
|
query.Where.Conditions.Add(DQCondition.EQ("Date", date)); |
|
|
|
|
|
query.Where.Conditions.Add(DQCondition.EQ("Technics_Name", "烫褪")); |
|
|
|
|
|
|
|
|
query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("IsDeleted", false), DQCondition.EQ("Technics", type), DQCondition.EQ("Date", date))); |
|
|
query.Columns.Add(DQSelectColumn.Count()); |
|
|
query.Columns.Add(DQSelectColumn.Count()); |
|
|
using (var session = LocalDmoSession.New()) |
|
|
using (var session = LocalDmoSession.New()) |
|
|
{ |
|
|
{ |
|
|
@ -124,21 +122,39 @@ namespace BO.Utils.BillRpc |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public static int GetMaoBoSumNumber(DateTime date) |
|
|
|
|
|
{ |
|
|
|
|
|
var query = new DQueryDom(new JoinAlias(typeof(GradeAndWeight_Detail))); |
|
|
|
|
|
query.Where.Conditions.Add(DQCondition.EQ("Date", date)); |
|
|
|
|
|
query.Where.Conditions.Add(DQCondition.EQ("Technics_Name", "毛剥")); |
|
|
|
|
|
query.Columns.Add(DQSelectColumn.Count()); |
|
|
|
|
|
using (var session = LocalDmoSession.New()) |
|
|
|
|
|
{ |
|
|
|
|
|
return Convert.ToInt32(session.ExecuteScalar(query)); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
//public static int GetSumNumber(long orderID, short type)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// var query = new DQueryDom(new JoinAlias(typeof(GradeAndWeight_Detail)));
|
|
|
|
|
|
// query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("IsDeleted", false), DQCondition.EQ("Technics", type), DQCondition.EQ("OrderDetail_ID", orderID)));
|
|
|
|
|
|
// query.Columns.Add(DQSelectColumn.Count());
|
|
|
|
|
|
// using (var session = LocalDmoSession.New())
|
|
|
|
|
|
// {
|
|
|
|
|
|
// return Convert.ToInt32(session.ExecuteScalar(query));
|
|
|
|
|
|
// }
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
//public static List<Tuple<short, int>> GetSumNumber(long orderID)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// var query = new DQueryDom(new JoinAlias(typeof(GradeAndWeight_Detail)));
|
|
|
|
|
|
// query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("IsDeleted", false), DQCondition.EQ("OrderDetail_ID", orderID)));
|
|
|
|
|
|
// query.Columns.Add(DQSelectColumn.Field("Technics"));
|
|
|
|
|
|
// query.Columns.Add(DQSelectColumn.Count());
|
|
|
|
|
|
// query.GroupBy.Expressions.Add(DQExpression.Field("Technics"));
|
|
|
|
|
|
// var list = new List<Tuple<short, int>>();
|
|
|
|
|
|
// using (var session = LocalDmoSession.New())
|
|
|
|
|
|
// {
|
|
|
|
|
|
// using (var reader = session.ExecuteReader(query))
|
|
|
|
|
|
// {
|
|
|
|
|
|
// list.Add(new Tuple<short, int>((short)reader[0], Convert.ToInt32(reader[1])));
|
|
|
|
|
|
// }
|
|
|
|
|
|
// return list;
|
|
|
|
|
|
// }
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
public static decimal GetSumWeight(DateTime date) |
|
|
public static decimal GetSumWeight(DateTime date) |
|
|
{ |
|
|
{ |
|
|
var query = new DQueryDom(new JoinAlias(typeof(GradeAndWeight_Detail))); |
|
|
var query = new DQueryDom(new JoinAlias(typeof(GradeAndWeight_Detail))); |
|
|
query.Where.Conditions.Add(DQCondition.EQ("Date", date)); |
|
|
|
|
|
|
|
|
query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("IsDeleted", false), DQCondition.EQ("Date", date))); |
|
|
|
|
|
|
|
|
query.Columns.Add(DQSelectColumn.Sum("Weight")); |
|
|
query.Columns.Add(DQSelectColumn.Sum("Weight")); |
|
|
using (var session = LocalDmoSession.New()) |
|
|
using (var session = LocalDmoSession.New()) |
|
|
@ -151,8 +167,7 @@ namespace BO.Utils.BillRpc |
|
|
public static List<GradeAndWeight_Detail> GetLostWeightDetails(DateTime date) |
|
|
public static List<GradeAndWeight_Detail> GetLostWeightDetails(DateTime date) |
|
|
{ |
|
|
{ |
|
|
var query = new DmoQuery(typeof(GradeAndWeight_Detail)); |
|
|
var query = new DmoQuery(typeof(GradeAndWeight_Detail)); |
|
|
query.Where.Conditions.Add(DQCondition.EQ("IsLostWeight", true)); |
|
|
|
|
|
query.Where.Conditions.Add(DQCondition.EQ("Date", date)); |
|
|
|
|
|
|
|
|
query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("IsDeleted", false), DQCondition.EQ("IsLostWeight", true), DQCondition.EQ("Date", date))); |
|
|
query.OrderBy.Expressions.Add(DQOrderByExpression.Create("Index", true)); |
|
|
query.OrderBy.Expressions.Add(DQOrderByExpression.Create("Index", true)); |
|
|
|
|
|
|
|
|
using (var session = LocalDmoSession.New()) |
|
|
using (var session = LocalDmoSession.New()) |
|
|
@ -202,13 +217,36 @@ namespace BO.Utils.BillRpc |
|
|
|
|
|
|
|
|
public static void Sync() |
|
|
public static void Sync() |
|
|
{ |
|
|
{ |
|
|
|
|
|
ClearUnSyncDelete(); |
|
|
var syncs = GetAllNeedSyncDetails(); |
|
|
var syncs = GetAllNeedSyncDetails(); |
|
|
foreach (var detail in syncs) |
|
|
foreach (var detail in syncs) |
|
|
{ |
|
|
{ |
|
|
const string method = "/MainSystem/B3ClientService/Rpcs/BillRpc/GradeAndWeightRpc/UpdateOrInsertDetailOrDelete"; |
|
|
const string method = "/MainSystem/B3ClientService/Rpcs/BillRpc/GradeAndWeightRpc/UpdateOrInsertDetailOrDelete"; |
|
|
var id = RpcFacade.Call<long>(method, serializer.Serialize(detail)); |
|
|
var id = RpcFacade.Call<long>(method, serializer.Serialize(detail)); |
|
|
|
|
|
if (detail.IsDeleted) |
|
|
|
|
|
Delete(detail.SID); |
|
|
|
|
|
else |
|
|
|
|
|
SetDetailSynced(detail, id); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
SetDetailSynced(detail, id); |
|
|
|
|
|
|
|
|
static void ClearUnSyncDelete() |
|
|
|
|
|
{ |
|
|
|
|
|
using (var session = LocalDmoSession.New()) |
|
|
|
|
|
{ |
|
|
|
|
|
var delete = new DQDeleteDom(typeof(GradeAndWeight_Detail)); |
|
|
|
|
|
delete.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("IsDeleted", true), DQCondition.EQ("ID", 0))); |
|
|
|
|
|
session.ExecuteNonQuery(delete); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void Delete(long sid) |
|
|
|
|
|
{ |
|
|
|
|
|
using (var session = LocalDmoSession.New()) |
|
|
|
|
|
{ |
|
|
|
|
|
var delete = new DQDeleteDom(typeof(GradeAndWeight_Detail)); |
|
|
|
|
|
delete.Where.Conditions.Add(DQCondition.EQ("SID", sid)); |
|
|
|
|
|
session.ExecuteNonQuery(delete); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -256,7 +294,7 @@ namespace BO.Utils.BillRpc |
|
|
{ |
|
|
{ |
|
|
var query = new DQueryDom(new JoinAlias(typeof(GradeAndWeight_Detail))); |
|
|
var query = new DQueryDom(new JoinAlias(typeof(GradeAndWeight_Detail))); |
|
|
query.Columns.Add(DQSelectColumn.Count()); |
|
|
query.Columns.Add(DQSelectColumn.Count()); |
|
|
query.Where.Conditions.Add(DQCondition.EQ("Date", date)); |
|
|
|
|
|
|
|
|
query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("IsDeleted", false), DQCondition.EQ("Date", date))); |
|
|
using (var session = LocalDmoSession.New()) |
|
|
using (var session = LocalDmoSession.New()) |
|
|
{ |
|
|
{ |
|
|
return Convert.ToInt32(session.ExecuteScalar(query)); |
|
|
return Convert.ToInt32(session.ExecuteScalar(query)); |
|
|
|