diff --git a/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Overlays/StatPayEdit_Ext.cs b/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Overlays/StatPayEdit_Ext.cs index 2ad6c60..1b21e71 100644 --- a/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Overlays/StatPayEdit_Ext.cs +++ b/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Overlays/StatPayEdit_Ext.cs @@ -28,7 +28,9 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Overlays editor.AllowDeletionFunc = () => false; editor.CanDeleteFunc = detail => false; - editor.IsEditableFunc = (field, detail) => false; + editor.IsEditableFunc = (field, detail) => { + return CanSave && field.Name == "Money"; + }; _farmerGrid = panel.EAdd(new DFEditGrid(editor) { Width = Unit.Percentage(100), ShowLineNo = true }); _farmerGrid.Columns.Add(new DFEditGridColumn("Farmer_Name")); @@ -45,6 +47,12 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Overlays panel.SetPageLayoutSetting(mPageLayoutManager, section4.Name); } + public override void GetFromUI() + { + base.GetFromUI(); + _farmerGrid.GetFromUI(); + } + public override void AppToUI() { base.AppToUI(); diff --git a/B3QingDaoWanFu/TypeIOCs/SaleOutStoreBLTypeIoc.cs b/B3QingDaoWanFu/TypeIOCs/SaleOutStoreBLTypeIoc.cs index 85d018f..ef2ba1d 100644 --- a/B3QingDaoWanFu/TypeIOCs/SaleOutStoreBLTypeIoc.cs +++ b/B3QingDaoWanFu/TypeIOCs/SaleOutStoreBLTypeIoc.cs @@ -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 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(context.Session); + var list = query.EExecuteList(session); if (!list.Any()) - return; + return new List(); - 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; } } }