using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using BWP.B3ClientService.BO;
|
|
using Forks.EnterpriseServices.DomainObjects2;
|
|
using Forks.EnterpriseServices.DomainObjects2.DQuery;
|
|
using Forks.EnterpriseServices.JsonRpc;
|
|
using Newtonsoft.Json;
|
|
using TSingSoft.WebPluginFramework;
|
|
|
|
namespace BWP.B3ClientService.Rpcs.BillRpc
|
|
{
|
|
[Rpc]
|
|
public static class SegmentationWeightRecordRpc
|
|
{
|
|
[Rpc]
|
|
public static long Insert(string json)
|
|
{
|
|
var record = JsonConvert.DeserializeObject<SegmentationWeightRecord>(json);
|
|
record.CreateTime=DateTime.Now;
|
|
using (var session=Dmo.NewSession())
|
|
{
|
|
session.Insert(record);
|
|
session.Commit();
|
|
}
|
|
return record.ID;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取为入库的
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[Rpc]
|
|
public static string GetNotInStoreList()
|
|
{
|
|
var query=new DmoQuery(typeof(SegmentationWeightRecord));
|
|
query.Where.Conditions.Add(DQCondition.EQ("IsInStored",false));
|
|
var list = query.EExecuteList().Cast<SegmentationWeightRecord>().ToList();
|
|
return JsonConvert.SerializeObject(list);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取为入库的
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[Rpc]
|
|
public static string GetNotInStoreListByMaxId(long id)
|
|
{
|
|
var query = new DmoQuery(typeof(SegmentationWeightRecord));
|
|
query.Where.Conditions.Add(DQCondition.EQ("IsInStored", false));
|
|
query.Where.Conditions.Add(DQCondition.GreaterThan("ID", id));
|
|
var list = query.EExecuteList().Cast<SegmentationWeightRecord>().ToList();
|
|
return JsonConvert.SerializeObject(list);
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 批量 设置已入库
|
|
/// </summary>
|
|
/// <param name="json"></param>
|
|
/// <returns></returns>
|
|
[Rpc]
|
|
public static bool SetInStored(string json)
|
|
{
|
|
var list = JsonConvert.DeserializeObject<List<int>>(json);
|
|
var whereList = list.Select(x => DQExpression.Value(x)).ToArray();
|
|
var updateDom=new DQUpdateDom(typeof(SegmentationWeightRecord));
|
|
updateDom.Columns.Add(new DQUpdateColumn("IsInStored",true));
|
|
updateDom.Where.Conditions.Add(DQCondition.InList(DQExpression.Field("ID"),whereList));
|
|
updateDom.EExecute();
|
|
return true;
|
|
}
|
|
}
|
|
}
|