|
|
|
@ -14,6 +14,10 @@ using Forks.Utils; |
|
|
|
using TSingSoft.WebPluginFramework; |
|
|
|
using BWP.B3ButcherManage.BO; |
|
|
|
using BWP.B3QingDaoWanFu.Utils; |
|
|
|
using Newtonsoft.Json; |
|
|
|
using System.Net; |
|
|
|
using System.IO; |
|
|
|
using TSingSoft.WebPluginFramework.QueueTasks; |
|
|
|
|
|
|
|
namespace BWP.B3QingDaoWanFu.TypeIOCs |
|
|
|
{ |
|
|
|
@ -27,17 +31,17 @@ namespace BWP.B3QingDaoWanFu.TypeIOCs |
|
|
|
detail.FactoryPrice = GetFactoryPrice(context, dmo, detail.SaleGoods_ID); |
|
|
|
} |
|
|
|
|
|
|
|
CheckStoreGoodsConsistent(context,dmo); |
|
|
|
CheckStoreGoodsConsistent(context, dmo); |
|
|
|
} |
|
|
|
|
|
|
|
void CheckStoreGoodsConsistent(IDmoContext context, SaleOutStore dmo) |
|
|
|
{ |
|
|
|
var notchntrolstoreids= new WanFuOnlineConfig().SaleoutstoreSaveNotCheckStoreGoodsConsistent.Value.ToList(); |
|
|
|
var notchntrolstoreids = new WanFuOnlineConfig().SaleoutstoreSaveNotCheckStoreGoodsConsistent.Value.ToList(); |
|
|
|
if (notchntrolstoreids.Count == 0) |
|
|
|
{ |
|
|
|
return; |
|
|
|
} |
|
|
|
if (notchntrolstoreids.Contains(Convert.ToInt32((dmo.Store_ID ?? 0)) )) |
|
|
|
if (notchntrolstoreids.Contains(Convert.ToInt32((dmo.Store_ID ?? 0)))) |
|
|
|
{ |
|
|
|
return; |
|
|
|
} |
|
|
|
@ -88,26 +92,101 @@ namespace BWP.B3QingDaoWanFu.TypeIOCs |
|
|
|
{ |
|
|
|
public void Invoke(IDmoContext context, SaleOutStore dmo) |
|
|
|
{ |
|
|
|
var config = new B3ButcherManageOnlineConfiguration(); |
|
|
|
if (string.IsNullOrEmpty(config.TraceBackServerUrl)) |
|
|
|
return; |
|
|
|
var task = new SaleInfoTractBackTask(dmo.ID); |
|
|
|
task.AddTaskUser_ID = BLContext.User.ID; |
|
|
|
task.DomainUser_ID = DomainContext.Current.DomainUser.ID; |
|
|
|
QueueTaskService.Add(task); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
[Serializable] |
|
|
|
class SaleInfoTractBackTask : QueueTaskBase |
|
|
|
{ |
|
|
|
public long BillID { get; set; } |
|
|
|
public long DomainUser_ID { get; set; } |
|
|
|
|
|
|
|
public SaleInfoTractBackTask(long id) |
|
|
|
{ |
|
|
|
BillID = id; |
|
|
|
} |
|
|
|
|
|
|
|
public override bool PersistTask |
|
|
|
{ |
|
|
|
get |
|
|
|
{ |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
protected override bool SingleTaskInQueue |
|
|
|
{ |
|
|
|
get |
|
|
|
{ |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public override void Execute(QueueTaskContext context) |
|
|
|
{ |
|
|
|
using (var scope = new SpecialDomainUserBLScope(DomainUser_ID)) |
|
|
|
{ |
|
|
|
var config = new B3ButcherManageOnlineConfiguration(); |
|
|
|
if (string.IsNullOrEmpty(config.TraceBackServerUrl)) |
|
|
|
return; |
|
|
|
var url = config.TraceBackServerUrl + "InsertSaleOutStore"; |
|
|
|
using (var session = Dmo.NewSession()) |
|
|
|
{ |
|
|
|
var infos = GetTraceBackInfos(session, BillID); |
|
|
|
var list = TraceBackInfoUtil.SplitList(infos, 1000); |
|
|
|
foreach (var letList in list) |
|
|
|
{ |
|
|
|
var arr = JsonConvert.SerializeObject(letList); |
|
|
|
TraceBackInfoUtil.Insert(url, arr); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
List<TractBillSaleInfo> GetTraceBackInfos(IDmoSession session, long id) |
|
|
|
{ |
|
|
|
var detail = new JoinAlias(typeof(SaleOutStore_Detail)); |
|
|
|
var bill = new JoinAlias(typeof(SaleOutStore)); |
|
|
|
var weight = new JoinAlias(typeof(WeightingInfor)); |
|
|
|
var scan = new JoinAlias(typeof(WeightingInfo_ScanDetail)); |
|
|
|
var query = new DQueryDom(detail); |
|
|
|
query.From.AddJoin(JoinType.Left, new DQDmoSource(weight), DQCondition.And(DQCondition.EQ(detail, "ID", weight, "DetailID"), DQCondition.EQ("BillType", DmoTypeIDAttribute.GetID(typeof(SaleOutStore))))); |
|
|
|
query.From.AddJoin(JoinType.Left, new DQDmoSource(bill), DQCondition.EQ(detail, "SaleOutStore_ID", bill, "ID")); |
|
|
|
query.From.AddJoin(JoinType.Left, new DQDmoSource(weight), DQCondition.And(DQCondition.EQ(detail, "ID", weight, "DetailID"), DQCondition.EQ(weight, "BillType", DmoTypeIDAttribute.GetID(typeof(SaleOutStore))))); |
|
|
|
query.From.AddJoin(JoinType.Left, new DQDmoSource(scan), DQCondition.And(DQCondition.EQ(detail, "ID", scan, "Detail_ID"), DQCondition.EQ(weight, "ID", scan, "WeightingInfo_ID"))); |
|
|
|
|
|
|
|
query.Columns.Add(DQSelectColumn.Field("Customer_Name", bill)); |
|
|
|
query.Columns.Add(DQSelectColumn.Field("Car_Name", bill)); |
|
|
|
query.Columns.Add(DQSelectColumn.Field("LoadTime", bill)); |
|
|
|
query.Columns.Add(DQSelectColumn.Field("BarCode", scan)); |
|
|
|
|
|
|
|
query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ(detail, "SaleOutStore_ID", dmo.ID), DQCondition.IsNotNull(DQExpression.Field(scan, "ID")))); |
|
|
|
query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ(detail, "SaleOutStore_ID", id), DQCondition.IsNotNull(DQExpression.Field(scan, "ID")))); |
|
|
|
|
|
|
|
var list = query.EExecuteList<string>(context.Session); |
|
|
|
var list = query.EExecuteList<string, string, DateTime, string>(session); |
|
|
|
if (!list.Any()) |
|
|
|
return; |
|
|
|
return new List<TractBillSaleInfo>(); |
|
|
|
|
|
|
|
var letList = list.Select(x => new TraceBackInfo { Code = x, SendCustomer = dmo.Customer_Name, CarNo = dmo.Car_Name, SendDate = dmo.LoadTime.Value.ToString("yyyyMMdd") }); |
|
|
|
TraceBackInfoUtil.Insert(config.TraceBackServerUrl, letList.ToList()); |
|
|
|
var letList = list.Select(x => new TractBillSaleInfo { Code = x.Item4, SendCustomer = x.Item1, CarNo = x.Item2, SendDate = x.Item3.ToString("yyyyMMdd") }).ToList(); |
|
|
|
return letList; |
|
|
|
} |
|
|
|
|
|
|
|
public override string Name |
|
|
|
{ |
|
|
|
get { return string.Format("抽取销售出库单No.{0}到追溯信息到服务器", BillID); } |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
class TractBillSaleInfo |
|
|
|
{ |
|
|
|
//[LogicName("条码")]
|
|
|
|
public string Code { get; set; } |
|
|
|
|
|
|
|
public string SendCustomer { get; set; } |
|
|
|
|
|
|
|
public string CarNo { get; set; } |
|
|
|
|
|
|
|
public string SendDate { get; set; } |
|
|
|
} |
|
|
|
} |