public ReturnType Update_TradeOrder(Alading.Entity.Trade trade, List <TradeOrder> orderList, List <Trade> tradeList) { try { using (AladingEntities alading = new AladingEntities(AppSettings.GetConnectionString())) { Alading.Entity.Trade TradeDest = new Alading.Entity.Trade(); //交易赋值 TradeCopydata(TradeDest, trade); /*添加合并后的交易*/ alading.AddToTrade(TradeDest); /*修改子交易*/ foreach (Alading.Entity.Trade tradeObj in tradeList) { Alading.Entity.Trade tradeObject = alading.Trade.Where(q => q.CustomTid == tradeObj.CustomTid).FirstOrDefault(); TradeCopydata(tradeObject, tradeObj); } /*订单副本添加到数据库*/ foreach (TradeOrder order in orderList) { Alading.Entity.TradeOrder TradeOrderDes = new Alading.Entity.TradeOrder(); copyTradeOrder(TradeOrderDes, order); alading.AddToTradeOrder(TradeOrderDes); } alading.SaveChanges(); return(ReturnType.Success); } } catch (System.Exception ex) { return(ReturnType.OthersError); } }
private bool UpdateTaobaoTradeAddressMessage(Alading.Entity.Trade trade) { string sessionKey = Alading.Utils.SystemHelper.GetSessionKey(trade.seller_nick); Alading.Taobao.Entity.Trade taobaoTrade = new Alading.Taobao.Entity.Trade(); //传入输入级数据参数 taobaoTrade.Tid = trade.tid; taobaoTrade.ReceiverName = trade.receiver_name; taobaoTrade.ReceiverPhone = trade.receiver_phone; taobaoTrade.ReceiverMobile = trade.receiver_mobile; taobaoTrade.ReceiverState = trade.receiver_state; taobaoTrade.ReceiverCity = trade.receiver_city; taobaoTrade.ReceiverDistrict = trade.receiver_district; taobaoTrade.ReceiverAddress = trade.receiver_address; taobaoTrade.ReceiverZip = trade.receiver_zip; try { Alading.Taobao.API.TopService.TradeShippingAddressUpdate(sessionKey, taobaoTrade); } catch (System.Exception ex) { throw ex; } return(true); }
//主选项卡切换事件 private void tabsMain_SelectedPageChanged(object sender, DevExpress.XtraTab.TabPageChangedEventArgs e) { InitSelectMainTab(); //调用界面辅助函数绑定数据 //默认绑定第一行数据 _focusedTrade = GetCurrentGC().DefaultView.GetRow(0) as Alading.Entity.Trade; SetTradeDetailMessage(_focusedTrade); }
//绑定数据到下方界面 根据选中选中选项卡取得数据 private void SetTradeDetailMessage(Alading.Entity.Trade trade) { if (trade == null) { return; } switch (tabsDetailMessage.SelectedTabPageIndex) { case 0: LoadPrintPreview(trade); break; case 1: break; case 2: //调用存储过程获得数据 gcOrdersDetail.DataSource = TradeOrderService.GetView_TradeDetailItemsDataSet(trade.CustomTid).Tables[0]; break; case 3: detailGCFlowMessage.DataSource = TradeInfoService.GetTradeInfo(p => p.CustomTid == trade.CustomTid); break; } }
// 绑定Trade的货物信息数据到送货信息Tab private void ReceiverGoodsDetail(string customTid) { try { Alading.Entity.Trade tradeInRow = TradeService.GetTrade(customTid); txtBuyerName.Text = tradeInRow.receiver_name; txtMobile.Text = tradeInRow.receiver_mobile; txtPhone.Text = tradeInRow.receiver_phone; txtReceiverAddress.Text = tradeInRow.receiver_address; txtZip.Text = tradeInRow.receiver_zip; memoBuyerMemo.Text = tradeInRow.buyer_memo; memoBuyerMessage.Text = tradeInRow.buyer_message; /* 初始化买家省市区的信息并绑定数据*/ cmbReceiverState.Properties.Items.Clear(); cmbReceiverCity.Properties.Items.Clear(); cmbReceiverDistrict.Properties.Items.Clear(); cmbReceiverState.Text = tradeInRow.receiver_state.ToString(); cmbReceiverCity.Text = tradeInRow.receiver_city; cmbReceiverDistrict.Text = tradeInRow.receiver_district; //绑定物流订单数据 BoundCompanyMessage(tradeInRow.LastShippingType); BoundTemplateMessage(tradeInRow.LogisticCompanyCode); cmbShippingCompany.EditValue = tradeInRow.LogisticCompanyCode; cmbShippingTemplate.EditValue = tradeInRow.TemplateCode; } catch (Exception e) { throw e; } }
/// 订单锁定 private void Lock_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { DataRow row = null; /*用于判断点击锁定按钮前是否选定*/ int flag = 0; List <Alading.Entity.Trade> tradeList = new List <Alading.Entity.Trade>(); /*存放处理的行号*/ List <int> rowHandle = new List <int>(); for (int handle = 0; handle < GetCurrentTradeGV().RowCount; handle++) { row = gvTradeWaitConfirm.GetDataRow(handle); if (Convert.ToBoolean(row["IsSelected"])) { if (row["LockedUserName"].ToString() == null || row["LockedUserName"].ToString() == string.Empty || row["LockedUserName"].ToString() == "未锁定") { Alading.Entity.Trade trade = TradeService.GetTrade(row["CustomTid"].ToString()); trade.LockedUserName = SystemHelper.User.nick; trade.LockedUserCode = SystemHelper.User.UserCode; trade.LockedTime = System.DateTime.Now; tradeList.Add(trade); rowHandle.Add(handle); } else { DevExpress.XtraEditors.XtraMessageBox.Show("'" + row["receiver_name"] + "' 等收货人的交易" + SystemHelper.User.nick + "锁定,不能再锁定!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } else { flag++; } } /*判断是否点击锁定前有无交易选中*/ if (flag >= gvTradeWaitConfirm.RowCount) { DevExpress.XtraEditors.XtraMessageBox.Show("没有选择需要锁定的交易,请检查!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } /*修改数据成功则修改界面上的值*/ if (DialogResult.OK == DevExpress.XtraEditors.XtraMessageBox.Show("确定要锁定所选交易?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information)) { if (TradeService.UpdateTrade(tradeList) == ReturnType.Success) { foreach (int handle in rowHandle) { row = gvTradeWaitConfirm.GetDataRow(handle); row["IsSelected"] = false; row["LockedUserName"] = SystemHelper.User.nick; } } // 添加一条添加赠品流程信息到交易流程 Alading.Utils.SystemHelper.CreateFlowMessage(row["CustomTid"].ToString(), "交易锁定", "交易锁定:" + row["title"].ToString() + "锁单时间:" + row["LockedTime"].ToString(), "交易锁定"); } }
private void LoadPrintPreview(Alading.Entity.Trade trade) { if (trade != null && !string.IsNullOrEmpty(trade.TemplateCode)) { LogisticCompanyTemplate template = LogisticCompanyService.GetLogisticCompanyTemplate(t => t.TemplateCode == trade.TemplateCode).FirstOrDefault(); if (template != null) { byte[] decommpressBytes = CompressHelper.Decompress(template.TemplateData); MemoryStream memStream = new MemoryStream(decommpressBytes); XtraReport xtraReport = new XtraReport(); xtraReport.PrintingSystem = expressPreview.PrintingSystem; xtraReport.LoadLayout(memStream); xtraReport.CreateDocument(true); memStream.Close(); SetValue(xtraReport, "收件人", trade.receiver_name); SetValue(xtraReport, "收件人电话", trade.receiver_phone); SetValue(xtraReport, "收件人手机", trade.receiver_mobile); SetValue(xtraReport, "收件人地址", trade.receiver_address); SetValue(xtraReport, "收件人邮编", trade.receiver_zip); SetValue(xtraReport, "寄件人", trade.seller_name); SetValue(xtraReport, "寄件人手机", trade.seller_mobile); SetValue(xtraReport, "寄件人电话", trade.seller_phone); } } //PrintingSystem printingSystem = new PrintingSystem(); ////非常关键,设置打印页面大小 ////自定义的纸张,注意单位是:百分之一英寸 0.01英寸 //PaperSize customPaperSize = new PaperSize("Custom Paper Size", 500, 550); //Margins customMargins = new Margins(0, 0, 0, 0); //PageSettings customPageSettings = new PageSettings(); //customPageSettings.PaperSize = customPaperSize; //customPageSettings.Margins = customMargins; //printingSystem.PageSettings.Assign(customPageSettings); //this.printCtrlExpress.PrintingSystem = printingSystem; //XtraReport xtraReport = new XtraReport(); //xtraReport.LoadLayout(@"d:\XtraReport.repx"); //xtraReport.PrintingSystem = printingSystem; //xtraReport.CreateDocument(true); ////预览配货单 //PrintingSystem printingProductSystem = new PrintingSystem(); //this.printCtrlProduct.PrintingSystem = printingProductSystem; //PreviewReport productReport = new PreviewReport(); //Parameter parameter = productReport.Parameters["TradeCode"]; //parameter.Value = "20100345789531"; //productReport.PrintingSystem = printingProductSystem; //productReport.CreateDocument(true); //printingProductSystem.ExecCommand(DevExpress.XtraPrinting.PrintingSystemCommand.Parameters, new object[] { true }); }
//待打印界面填入物流单号 private void gridViewPrinted_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e) { GridView senderIn = sender as GridView; Alading.Entity.Trade trade = senderIn.GetRow(e.RowHandle) as Alading.Entity.Trade; if (e.Column == ShippingCode) { senderIn.BeginDataUpdate(); trade.ShippingCode = e.Value.ToString(); senderIn.EndDataUpdate(); } }
/// 根据界面内容来提交交易,订单数据 private void SummitTradeAndOrders() { Alading.Entity.Trade createTrade = new Alading.Entity.Trade(); TradeCreateData(createTrade); foreach (DataRow row in _dTbRecord.Rows) { Alading.Entity.TradeOrder createOrder = new Alading.Entity.TradeOrder(); OrderCreateData(createOrder, row, createTrade.CustomTid); TradeOrderService.AddTradeOrder(createOrder); } TradeService.AddTrade(createTrade); }
//待打印界面行值改变时的响应 主要是选中和单号填写 private void gvWaitSendGood_CellValueChanging(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e) { GridView senderIn = sender as GridView; Alading.Entity.Trade trade = senderIn.GetRow(e.RowHandle) as Alading.Entity.Trade; if (e.Column == WaitAssortIsSelected) { senderIn.BeginDataUpdate(); trade.IsSelected = bool.Parse(e.Value.ToString()); senderIn.EndDataUpdate(); } }
private void gvTradeWaitConfirm_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e) { /*修改邮费*/ GridView senderIn = sender as GridView; DataRow row = senderIn.GetDataRow(e.RowHandle); if (e.Column == RealPostFee) { Alading.Entity.Trade trade = TradeService.GetTrade(row["CustomTid"].ToString()); trade.RealPostFee = float.Parse(row["RealPostFee"].ToString()); TradeService.UpdateTrade(trade); } }
//选中交易的焦点改变时事件 private void gvPublic_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { GridView currntGV = sender as GridView; _focusedTrade = currntGV.GetRow(e.FocusedRowHandle) as Alading.Entity.Trade; SetTradeDetailMessage(_focusedTrade); //默认绑定第一条的商品属性数据 DataRow currentRow = gvSaleInfo.GetFocusedDataRow(); if (currentRow != null) { ShowItemPropValue(currentRow["iid"].ToString(), currentRow["SkuProps_Str"].ToString()); } }
/// <summary> /// textEdit 赋值 /// </summary> private void LoadTextEdit(Alading.Entity.Trade trade) { txtBuyerName.Text = trade.receiver_name; textNick.Text = trade.buyer_nick; textPostFee.Text = trade.post_fee.ToString(); textTotalFee.Text = trade.total_fee.ToString(); textPayment.Text = trade.payment.ToString(); txtPhone.Text = trade.receiver_phone ?? "未填写"; txtMobile.Text = trade.receiver_mobile ?? "未填写"; txtZip.Text = trade.receiver_zip; textReceiverState.Text = trade.receiver_state; textReceiverCity.Text = trade.receiver_city; textReceiverDistrict.Text = trade.receiver_district; txtReceiverAddress.Text = trade.receiver_address; }
/// <summary> /// 用于还原合并但 /// </summary> /// <param name="combineCode">副交易的CustomTid</param> /// <returns></returns> public ReturnType Update_TradeOrder(string combineCode) { try { using (AladingEntities alading = new AladingEntities(AppSettings.GetConnectionString())) { /*删除订单副本*/ List <Alading.Entity.TradeOrder> tradeOrderList = alading.TradeOrder.Where(q => q.CustomTid == combineCode).ToList(); foreach (Alading.Entity.TradeOrder tradeOrder in tradeOrderList) { TradeOrder order = alading.TradeOrder.Where(q => q.TradeOrderCode == tradeOrder.TradeOrderCode).FirstOrDefault(); alading.DeleteObject(order); }/*foreach*/ /*修改子交易LocalStatus*/ List <Alading.Entity.Trade> tradeList = alading.Trade.Where(q => q.CombineCode == combineCode).ToList(); foreach (Alading.Entity.Trade trade in tradeList) { if (alading.Trade.Where(q => q.CustomTid == trade.CustomTid).FirstOrDefault() != null) { Trade tradeDb = alading.Trade.Where(q => q.CustomTid == trade.CustomTid).FirstOrDefault(); tradeDb.LocalStatus = LocalTradeStatus.HasNotSummit; tradeDb.CombineCode = string.Empty; } }/*foreach*/ //删除父交易 if (alading.Trade.Where(q => q.CustomTid == combineCode).FirstOrDefault() != null) { Alading.Entity.Trade fatherTrade = alading.Trade.Where(q => q.CustomTid == combineCode).FirstOrDefault(); alading.DeleteObject(fatherTrade); } alading.SaveChanges(); return(ReturnType.Success); } } catch (System.Exception ex) { throw ex; } }
/// <summary> /// 撤消合并 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Rollback_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { /*合并还原成一个交易*/ if (CombineFlag == combineStyle.ConbineTradeFlg) { parentTradeOrderList.Clear(); Alading.Entity.Trade trade = new Alading.Entity.Trade(); LoadTextEdit(trade); // 取消合并不可用 Rollback.Enabled = false; //下载按钮可用 combine.Enabled = true; } /*合并成一个交易*/ if (CombineFlag == combineStyle.ConbinePrintFlg) { //父交易清空 FatherTrade = null; //副本订单清空 tradeOrderList.Clear(); tradeList.Clear(); Alading.Entity.Trade trade = new Alading.Entity.Trade(); LoadTextEdit(trade); parentTradeOrderList.Clear(); /*显示数据*/ LoadTradeOrder(gcCombineTrade, gvCombineOrder, tradeOrderList, null); //下载按钮可用 combine.Enabled = true; // 取消合并不可用 Rollback.Enabled = false; } }
//绑定数据到下方界面 根据选中选中选项卡取得数据 private void SetTradeDetailMessage(Alading.Entity.Trade trade) { if (trade == null) { gcOrdersDetail.DataSource = null; detailGCFlowMessage.DataSource = null; return; } switch (tabsDetail.SelectedTabPageIndex) { case 0: gcOrdersDetail.DataSource = TradeOrderService.GetView_TradeDetailItemsDataSet(_focusedTrade.CustomTid).Tables[0]; break; case 1: detailGCFlowMessage.DataSource = TradeInfoService.GetTradeInfo(p => p.CustomTid == trade.CustomTid); break; } }
/// <summary> /// /// </summary> /// <param name="customtid">子交易的customtid</param> /// <param name="trade">父交易</param> /// <param name="trade_order_list">父交易的列表</param> /// <returns></returns> public ReturnType Update_TradeOrder(string customtid, Alading.Entity.Trade trade, List <Alading.Entity.TradeOrder> trade_order_list) { try { using (AladingEntities alading = new AladingEntities(AppSettings.GetConnectionString())) { /*删除数据库中原子订单*/ List <Alading.Entity.TradeOrder> order_list = alading.TradeOrder.Where(q => q.CustomTid == customtid).ToList(); foreach (TradeOrder order in order_list) { alading.DeleteObject(order); } /*修改订单*/ foreach (TradeOrder orderObj in trade_order_list) { TradeOrder orderDes = alading.TradeOrder.Where(q => q.TradeOrderCode == orderObj.TradeOrderCode).FirstOrDefault(); copyTradeOrder(orderDes, orderObj); } /*修改交易*/ Trade tradeDes = alading.Trade.Where(q => q.CustomTid == trade.CustomTid).FirstOrDefault(); TradeCopydata(tradeDes, trade); /*删除无用的子交易*/ Trade tradeDest = alading.Trade.Where(q => q.CustomTid == "child" + trade.CustomTid).FirstOrDefault(); alading.DeleteObject(tradeDest); alading.SaveChanges(); return(ReturnType.Success); } } catch (System.Exception ex) { return(ReturnType.OthersError); } }
/// <summary> /// 合并还原成一个交易 /// </summary> private void ConbineTradeFlg() { #region 交易合并 还原成一个交易 if (DialogResult.Cancel == XtraMessageBox.Show(Alading.Properties.Resources.TidNotSame, Alading.Properties.Resources.Imformation, MessageBoxButtons.OKCancel, MessageBoxIcon.Information)) { return; } int OrdeFlg = 0; string customStr = customTidList[0]; string customParent = null; string customChild = null; List <Alading.Entity.TradeOrder> childTradeOrderList = new List <Alading.Entity.TradeOrder>(); Alading.Entity.TradeOrder order = new Alading.Entity.TradeOrder(); /*找出父交易的customtid 与 子交易的customtid*/ foreach (string str in customTidList) { if (str.Length > customStr.Length) { customParent = customStr; customChild = str; }/*if*/ else { customParent = str; customChild = customStr; } /*else*/ } /*foreach*/ /*将父交易的订单列表找出*/ parentTradeOrderList = TradeOrderService.GetTradeOrder(q => q.CustomTid == customParent); childTradeOrderList = TradeOrderService.GetTradeOrder(q => q.CustomTid == customChild); for (int i = 0; i < parentTradeOrderList.Count; i++) { /*找到相应的子订单*/ order = childTradeOrderList.Where(q => q.oid == parentTradeOrderList[i].oid).FirstOrDefault(); if (order != null) { /*数量合并*/ parentTradeOrderList[i].num += order.num; /*总费合并*/ parentTradeOrderList[i].total_fee = parentTradeOrderList[i].price * parentTradeOrderList[i].num; /*应付金额合并*/ parentTradeOrderList[i].payment = parentTradeOrderList[i].total_fee + parentTradeOrderList[i].adjust_fee + parentTradeOrderList[i].discount_fee; }//if childTradeOrderList.Remove(order); }//fro /*子订单列表中剩余的订单 全部加到父订单列表中*/ if (childTradeOrderList.Count > 0) { parentTradeOrderList.AddRange(childTradeOrderList); } /*修改customtid*/ for (int i = 0; i < parentTradeOrderList.Count; i++) { parentTradeOrderList[i].CustomTid = customParent; } trade = TradeService.GetTrade(q => q.CustomTid == customParent).FirstOrDefault(); if (trade == null) { return; } /*trade的总费*/ trade.total_fee = parentTradeOrderList.Sum(q => q.total_fee); /*得到trade总的应付金额*/ trade.payment = parentTradeOrderList.Sum(q => q.payment) + trade.post_fee; /*修改状态*/ trade.IsSplited = false; /*显示数据*/ LoadTradeOrder(gcCombineTrade, gvCombineOrder, null, parentTradeOrderList); LoadTextEdit(trade); XtraMessageBox.Show(Alading.Properties.Resources.ConbineSuccess, Alading.Properties.Resources.Imformation); #endregion }
private void gvParentGV_CellValueChanging(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e) { /*获得DataRow,并且更新数据*/ GridView senderIn = sender as GridView; DataRow row = senderIn.GetDataRow(e.RowHandle); if (e.Column.AbsoluteIndex == 1) { senderIn.BeginDataUpdate(); row["IsSelected"] = e.Value; senderIn.EndDataUpdate(); #region 未锁定 解锁按钮不能用 若为锁定 锁定按钮不能用 if (row["LockedUserName"].ToString() == UNLOCKED.VALUE) { unlock.Enabled = false; Lock.Enabled = true; } else { Lock.Enabled = false; unlock.Enabled = true; } #endregion } /*是否开发票处理代码*/ if (e.Column == HasInvoice) { Alading.Entity.Trade trade = TradeService.GetTrade(row["CustomTid"].ToString()); if (row != null) { if (Convert.ToBoolean(row["HasInvoice"].ToString()) == false) { trade.HasInvoice = true; if (TradeService.UpdateTrade(trade) == ReturnType.Success) { detailTicketMessage.PageVisible = true; tabsTradeDetail.SelectedPageChanged -= new TabPageChangedEventHandler(tabCtrlTradeDetail_SelectedPageChanged); tabsTradeDetail.SelectedTabPageIndex = 3; tabsTradeDetail.SelectedPageChanged += new TabPageChangedEventHandler(tabCtrlTradeDetail_SelectedPageChanged); } else { /*数据库没有更新不能该界面*/ row["HasInvoice"] = "否"; } } else { trade.HasInvoice = false; if (TradeService.UpdateTrade(trade) == ReturnType.Success) { detailTicketMessage.PageVisible = false; } else { row["HasInvoice"] = "是"; } } } } }
public static ReturnType Update_TradeOrder(string customtid, Alading.Entity.Trade trade, List <Alading.Entity.TradeOrder> trade_order_list) { return(DataProviderClass.Instance().Update_TradeOrder(customtid, trade, trade_order_list)); }
/// 保存交易信息 private void btnStoreReceiverMsg_Click(object sender, EventArgs e) { if (_currentTradeRow == null) { XtraMessageBox.Show("请选中一条交易!"); return; } Alading.Entity.Trade focusedTrade = TradeService.GetTrade(_currentTradeRow["CustomTid"].ToString()); //算法辅助量 默认Yes。如果时间戳不相等,弹出YesNoDialog,由此可决定是否更新 DialogResult result = DialogResult.Yes; #region 利用时间戳来防止并发 //调用辅助函数来比较时间戳是否相等 if (!Alading.Utils.SystemHelper.CompareTimeStamp(_currentTradeRow["TradeTimeStamp"] as byte[], focusedTrade.TradeTimeStamp)) { //如果时间戳不相等,则执行此代码段 result = XtraMessageBox.Show("该交易的已被修改,是否继续修改(YES)/查看流程信息(NO)", "确认修改", MessageBoxButtons.YesNo); } #endregion #region 根据result的值更新数据库 if (result == DialogResult.Yes) { #region 构造一条交易数据修改信息 StringBuilder builder = new StringBuilder(); try { if (focusedTrade.receiver_name != txtBuyerName.Text) { builder.Append(" 收获人姓名:" + focusedTrade.receiver_name + "->" + txtBuyerName.Text); } if (focusedTrade.receiver_mobile != txtMobile.Text) { builder.Append(" 收货人电话:" + focusedTrade.receiver_mobile + "->" + txtMobile.Text); } if (focusedTrade.receiver_zip != txtZip.Text) { builder.Append(" 收货人邮编:" + txtZip.Text + "->" + focusedTrade.receiver_zip); } if (focusedTrade.receiver_phone != txtPhone.Text) { builder.Append(" 收货人座机:" + focusedTrade.receiver_phone + "->" + txtPhone.Text); } if (focusedTrade.LogisticCompanyCode != cmbShippingCompany.EditValue.ToString()) { builder.Append(" 收货人物流公司:" + LogisticCompanyService.GetLogisticCompany(p => p.code == focusedTrade.LogisticCompanyCode).FirstOrDefault().name + "->" + cmbShippingCompany.Text); } if (focusedTrade.receiver_address != txtReceiverAddress.Text) { builder.Append(" 收货人地址:" + focusedTrade.receiver_address + "->" + txtReceiverAddress.Text); } if (focusedTrade.receiver_state != cmbReceiverState.SelectedItem.ToString()) { builder.Append(" 收货人省:" + focusedTrade.receiver_state + "->" + cmbReceiverState.SelectedItem.ToString()); } if (focusedTrade.receiver_city != cmbReceiverCity.SelectedItem.ToString()) { builder.Append(" 收货人市:" + focusedTrade.receiver_city + "->" + cmbReceiverCity.SelectedItem.ToString()); } if (focusedTrade.receiver_district != cmbReceiverDistrict.SelectedItem.ToString()) { builder.Append(" 收货人地区:" + focusedTrade.receiver_district + "->" + cmbReceiverDistrict.SelectedItem.ToString()); } if ((focusedTrade.buyer_memo == null ? string.Empty : focusedTrade.buyer_memo) != memoBuyerMemo.Text) { builder.Append(" 收货人备注:" + focusedTrade.buyer_memo + "->" + memoBuyerMemo.Text); } if ((focusedTrade.buyer_message == null ? string.Empty : focusedTrade.buyer_message) != memoBuyerMessage.Text) { builder.Append(" 收货人信息:" + focusedTrade.buyer_message + "->" + memoBuyerMessage.Text); } } catch (System.Exception ex) { } #endregion #region 从界面读取修改信息 focusedTrade.receiver_name = txtBuyerName.Text; focusedTrade.receiver_mobile = txtMobile.Text; focusedTrade.receiver_zip = txtZip.Text; focusedTrade.receiver_phone = txtPhone.Text; focusedTrade.LogisticCompanyCode = cmbShippingCompany.EditValue.ToString(); focusedTrade.TemplateCode = cmbShippingTemplate.EditValue.ToString(); focusedTrade.receiver_address = txtReceiverAddress.Text; focusedTrade.receiver_state = cmbReceiverState.SelectedItem.ToString(); focusedTrade.receiver_city = cmbReceiverCity.SelectedItem.ToString(); focusedTrade.receiver_district = cmbReceiverDistrict.SelectedItem.ToString(); focusedTrade.buyer_memo = memoBuyerMemo.Text; focusedTrade.buyer_message = memoBuyerMessage.Text; focusedTrade.HasInvoice = false; #endregion WaitDialogForm wdf = new WaitDialogForm(Constants.OPERATE_TBDB_DATA); try { //将修改数据更新到淘宝 UpdateTaobaoTradeAddressMessage(focusedTrade); //更新修改数据到数据库 TradeService.UpdateTrade(focusedTrade); //创建一条流水信息到数据库 Alading.Utils.SystemHelper.CreateFlowMessage(focusedTrade.CustomTid, "收货信息修改", builder.ToString(), "订单管理"); wdf.Close(); XtraMessageBox.Show("修改收货信息成功!"); } catch (Exception ex) { wdf.Close(); XtraMessageBox.Show("修改收货保存到淘宝失败,修改无效!原因:" + ex.Message); } //将更新信息同步到界面 _currentTradeRow["receiver_name"] = txtBuyerName.Text; //时间由系统自动生成,需将本地时间戳与数据库最新同步 _currentTradeRow["TradeTimeStamp"] = TradeService.GetTrade(focusedTrade.CustomTid).TradeTimeStamp; } else { tabsTradeDetail.SelectedTabPage = detailTabFlowMsg; } #endregion }
/// 解锁 private void unlock_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { int flag = 0; DataRow row = null; List <int> rowHandleList = new List <int>(); Alading.Entity.Trade tradeObj = new Alading.Entity.Trade(); List <Alading.Entity.Trade> tradeList = new List <Alading.Entity.Trade>(); for (int i = 0; i < gvTradeWaitConfirm.RowCount; i++) { row = gvTradeWaitConfirm.GetDataRow(i); if (row == null) { return; } if (Convert.ToBoolean(row["IsSelected"]) == true) { /*对没有被锁定的交易而进行解锁(此类错误)的处理*/ if (row["LockedUserName"].ToString() == UNLOCKED.VALUE) { DevExpress.XtraEditors.XtraMessageBox.Show("有订单没有被锁定,不能解锁,请检查!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } /*判断所勾选的是不是由系统客户锁定*/ if (row["LockedUserName"].ToString() != SystemHelper.User.nick) { DevExpress.XtraEditors.XtraMessageBox.Show("'" + row["receiver_name"] + "' 等收货人的交易" + " 不是被您锁定,不能解锁!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { /*记录被处理的行*/ rowHandleList.Add(i); } } else { /*用于判定是否有被选择的交易*/ flag++; } } /* 没有勾选交易 对其进行解锁 错误处理代码*/ if (flag >= gvTradeWaitConfirm.RowCount) { DevExpress.XtraEditors.XtraMessageBox.Show("没有选择需要解锁的交易,请检查!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } /*对勾选的交易进行解锁处理代码*/ foreach (int rowHandle in rowHandleList) { row = gvTradeWaitConfirm.GetDataRow(rowHandle); tradeObj = TradeService.GetTrade(row["CustomTid"].ToString()); tradeObj.LockedUserName = UNLOCKED.VALUE; tradeList.Add(tradeObj); tradeObj = null; } if (DialogResult.OK == DevExpress.XtraEditors.XtraMessageBox.Show("确定要将所选交易解锁?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information)) { if (TradeService.UpdateTrade(tradeList) == ReturnType.Success) { foreach (int rowhandle in rowHandleList) { row = gvTradeWaitConfirm.GetDataRow(rowhandle); row["LockedUserName"] = UNLOCKED.VALUE; row["IsSelected"] = false; } } // 添加一条添加赠品流程信息到交易流程 Alading.Utils.SystemHelper.CreateFlowMessage(row["CustomTid"].ToString(), "交易解锁", "交易解锁:" + row["title"].ToString(), "交易解锁"); } }
public static ReturnType Update_TradeOrder(Alading.Entity.Trade trade, List <TradeOrder> orderList, List <Trade> tradeList) { return(DataProviderClass.Instance().Update_TradeOrder(trade, orderList, tradeList)); }
/// <summary> /// 拆分函数 /// </summary> /// <param name="gc"></param> /// <param name="view"></param> private void FunSplit(GridControl gc, GridView view) { #region 订单拆分修改 List <int> rowList = new List <int>(); //接收从数据库视图表中传出来的值,此值不能修改 Alading.Entity.View_TradeStock ParentOrder = new Alading.Entity.View_TradeStock(); Alading.Entity.View_TradeStock ChildOrder = new Alading.Entity.View_TradeStock(); //所勾选要被拆分的交易 ,用于修改数据库 List <ViewTradeStock> tradeParentOrderList = new List <ViewTradeStock>(); DataRow row = null; int NullRecord = 0; for (int rowHandle = 0; rowHandle < view.RowCount; rowHandle++) { //将从数据库视图表中传出来的值转换 ViewTradeStock ParentOrderExtent = new ViewTradeStock(); ViewTradeStock ChildOrderExtent = new ViewTradeStock(); row = view.GetDataRow(rowHandle); if (row == null) { return; } if (Convert.ToBoolean(row["IsSelected"].ToString())) { ParentOrder = View_TradeStockService.GetView_TradeStock(q => q.oid == row["oid"].ToString()).FirstOrDefault(); if (ParentOrder == null) { return; } /*数据转换*/ viewCopy(ParentOrderExtent, ParentOrder); /*购买量的修改*/ if (row["numSplit"].ToString() == null || row["numSplit"].ToString() == string.Empty) { return; } ParentOrderExtent.num = int.Parse(row["num"].ToString()) - int.Parse(row["numSplit"].ToString()); /*total_fee的修改*/ ParentOrderExtent.total_fee = float.Parse(row["price"].ToString()) * ParentOrderExtent.num; /*修改payment*/ ParentOrderExtent.payment = (ParentOrderExtent.total_fee + ParentOrderExtent.adjust_fee); tradeParentOrderList.Add(ParentOrderExtent); ChildOrder = ParentOrder; if (ChildOrder == null) { return; } /*数据转换*/ viewCopy(ChildOrderExtent, ChildOrder); /*购买量修改*/ ChildOrderExtent.num = int.Parse(row["numSplit"].ToString()); ChildOrderExtent.TradeOrderCode = Guid.NewGuid().ToString(); /*total_fee的修改*/ ChildOrderExtent.total_fee = float.Parse(row["price"].ToString()) * ChildOrderExtent.num; /*修改payment*/ ChildOrderExtent.payment = (ChildOrderExtent.total_fee); /*修改customTid 子交易后面加1*/ ChildOrderExtent.CustomTid = "child" + ChildOrderExtent.CustomTid; #region 如果新拆分后订单在子订单列表中存在,则累加相应的量 int count = 0; for (count = 0; count < _childOrderList.Count; count++) { if (ChildOrderExtent.oid == _childOrderList[count].oid) { ChildOrderExtent.num += _childOrderList[count].num; ChildOrderExtent.total_fee = (ChildOrderExtent.price) * ChildOrderExtent.num; ChildOrderExtent.payment = (ChildOrderExtent.total_fee); /*修改相关量*/ _childOrderList[count].num = ChildOrderExtent.num; _childOrderList[count].total_fee = ChildOrderExtent.total_fee; _childOrderList[count].payment = ChildOrderExtent.payment; break; } //if } //for /*子订单列表中没有新添加的订单*/ if (count >= _childOrderList.Count) { _childOrderList.Add(ChildOrderExtent); } }/*if (Convert.ToBoolean(row["IsSelected"].ToString()))*/ else { /*记载没被勾选的行数*/ NullRecord++; } }/*for (int rowHandle = 0; rowHandle < view.RowCount; rowHandle++)*/ if (NullRecord >= view.RowCount) { XtraMessageBox.Show(Alading.Properties.Resources.NotSelctCanNOtSplit, Alading.Properties.Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } #endregion #endregion #region 修改显示的订单列表 List <ViewTradeStock> removeTradeList = new List <ViewTradeStock>(); for (int i = 0; i < tradeParentOrderList.Count; i++) { for (int j = 0; j < _parentOrderList.Count; j++) { if (tradeParentOrderList[i].oid == _parentOrderList[j].oid) { if (tradeParentOrderList[i].num == 0) { removeTradeList.Add(_parentOrderList[j]); } _parentOrderList[j].num = tradeParentOrderList[i].num; _parentOrderList[j].total_fee = tradeParentOrderList[i].total_fee; _parentOrderList[j].payment = tradeParentOrderList[i].payment; } } } /*删除_parentOrderList.num 为零的交易*/ foreach (ViewTradeStock tradeStock in removeTradeList) { _parentOrderList.Remove(tradeStock); } #endregion #region 所对应交易的修改 /*获取父交易*/ ParentTrade = TradeService.GetTrade(_customTid); if (ParentTrade == null) { return; } /*修改父交易*/ ParentTrade.IsSplited = true; ParentTrade.ParentCustomTid = "0"; /*修改应付金额,总费*/ ParentTrade.payment = 0; float total_fee = 0; foreach (ViewTradeStock order in _parentOrderList) { ParentTrade.payment += (double)order.payment; total_fee += (float)order.total_fee; } ParentTrade.total_fee = total_fee; /*修改子交易*/ ChildTrade = TradeService.GetTrade(_customTid); if (ChildTrade == null) { return; } /*CustomTid 随机产生一个*/ ChildTrade.CustomTid = "child" + _customTid; ChildTrade.ParentCustomTid = _customTid; ChildTrade.IsSplited = true; /*邮费*/ ChildTrade.post_fee = ChildTrade.post_fee; /*修改应付金额,总费*/ ChildTrade.payment = 0; ChildTrade.total_fee = 0.0; float ChildTotalFee = 0; foreach (ViewTradeStock order in _childOrderList) { ChildTrade.payment += order.payment; ChildTotalFee += (float)(order.total_fee); } ChildTrade.total_fee = ChildTotalFee; /*子交易加上邮费*/ ChildTrade.post_fee = ParentTradeList[0].post_fee; #endregion #region 数据展示 //拆分不合理 if (_parentOrderList.Count == 0) { XtraMessageBox.Show("拆分不合理!", "出错", MessageBoxButtons.OK, MessageBoxIcon.Error); _parentOrderList.Clear(); //数据转换 _parentOrderList = ViewTradeStockCopyData(ParentTradeList); LoadSpiltTrade(gcParentTrade, _parentOrderList); _childOrderList.Clear(); } LoadSpiltTrade(gcParentTrade, _parentOrderList); gcParentTrade.RefreshDataSource(); LoadSpiltTrade(gcChildTrade, _childOrderList); gcChildTrade.RefreshDataSource(); #endregion }
/// <summary> /// 自动拆分 /// </summary> private void AutoSplit() { #region 自动拆分 /*子列表清空*/ _childOrderList.Clear(); /*父列表清空*/ _parentOrderList.Clear(); /*获取值*/ List <View_TradeStock> ParentTradeList = View_TradeStockService.GetView_TradeStock(p => p.CustomTid == _customTid); /*数据转换*/ _parentOrderList = ViewTradeStockCopyData(ParentTradeList); /*删除列表*/ List <ViewTradeStock> removeTradeList = new List <ViewTradeStock>(); for (int i = 0; i < _parentOrderList.Count; i++) { int LeftQuantity = 0; /*剩余量*/ LeftQuantity = _parentOrderList[i].SkuQuantity.Value - _parentOrderList[i].OccupiedQuantity.Value; /*自动拆分缺货的订单*/ if (LeftQuantity < _parentOrderList[i].num) { View_TradeStock viewTrade = View_TradeStockService.GetView_TradeStock(q => q.TradeOrderCode == _parentOrderList[i].TradeOrderCode).FirstOrDefault(); ViewTradeStock viewChildTrade = new ViewTradeStock(); if (viewTrade == null) { return; } /*数据转换*/ viewCopy(viewChildTrade, viewTrade); /*订单量改变*/ viewChildTrade.num = _parentOrderList[i].num - LeftQuantity; /*订单量改变*/ viewChildTrade.total_fee = (viewChildTrade.price) * viewChildTrade.num; /*修改customtid*/ viewChildTrade.CustomTid = "child" + viewChildTrade.CustomTid; /*tradeordercode*/ viewChildTrade.TradeOrderCode = Guid.NewGuid().ToString(); /*向子列表中填值*/ _childOrderList.Add(viewChildTrade); /*订单量改变*/ _parentOrderList[i].num = LeftQuantity; if (_parentOrderList[i].num == 0) { removeTradeList.Add(_parentOrderList[i]); } /*订单量改变*/ _parentOrderList[i].total_fee = (_parentOrderList[i].price) * _parentOrderList[i].num; } //if } //for /*将全部缺货的订单分离出去*/ foreach (ViewTradeStock tradeStock in removeTradeList) { _parentOrderList.Remove(tradeStock); } #endregion #region 子交易修改 ChildTrade = TradeService.GetTrade(_customTid); if (ChildTrade == null) { return; } /*CustomTid 随机产生一个*/ ChildTrade.CustomTid = "child" + _customTid; ChildTrade.ParentCustomTid = _customTid; ChildTrade.IsSplited = true; /*邮费*/ ChildTrade.post_fee = ChildTrade.post_fee; /*修改应付金额,总费*/ ChildTrade.payment = 0; ChildTrade.total_fee = 0.0; float ChildTotalFee = 0; foreach (ViewTradeStock order in _childOrderList) { ChildTrade.payment += order.payment; ChildTotalFee += (float)(order.total_fee); } ChildTrade.total_fee = ChildTotalFee; ChildTrade.post_fee = ParentTradeList[0].post_fee; #endregion #region 父交易修改 /*获取父交易*/ ParentTrade = TradeService.GetTrade(_customTid); /*修改父交易*/ ParentTrade.IsSplited = true; ParentTrade.ParentCustomTid = "0"; /*修改应付金额,总费*/ ParentTrade.payment = 0; float total_fee = 0; foreach (ViewTradeStock order in _parentOrderList) { ParentTrade.payment += order.payment; total_fee += (float)(order.total_fee); } ParentTrade.total_fee = total_fee; #endregion #region 数据展示 LoadSpiltTrade(gcParentTrade, _parentOrderList); gcParentTrade.RefreshDataSource(); LoadSpiltTrade(gcChildTrade, _childOrderList); gcChildTrade.RefreshDataSource(); #endregion }
public void TradeCreateData(Alading.Entity.Trade createTrade) { createTrade.CustomTid = Guid.NewGuid().ToString(); createTrade.tid = createTrade.CustomTid; createTrade.iid = string.Empty; createTrade.ParentCustomTid = "0"; createTrade.seller_nick = cmbOwnerShop.SelectedText; createTrade.buyer_nick = cmbConsumerName.SelectedText; createTrade.title = "本底新建订单"; createTrade.type = Alading.Core.Enum.emumOrderType.SellGoods; createTrade.created = DateTime.Now; createTrade.price = 0.0; createTrade.pic_path = string.Empty; createTrade.num = 1; createTrade.buyer_message = txtMemo.Text; createTrade.buyer_rate = false; createTrade.buyer_memo = txtMemo.Text; createTrade.seller_rate = false; createTrade.seller_memo = txtMemo.Text; createTrade.shipping_type = cmbShippingType.EditValue.ToString(); createTrade.alipay_no = string.Empty; createTrade.payment = double.Parse(txtDicountOutFee.Text.ToString()) + double.Parse(txtPostFee.Text.ToString()); //总费用等于邮费加货物费用 createTrade.discount_fee = 0.0; //取负值 createTrade.adjust_fee = 0 - double.Parse(txtDiscountFee.Text.ToString()); //取负值 createTrade.snapshot_url = string.Empty; createTrade.snapshot = string.Empty; createTrade.status = TradeEnum.WAIT_SELLER_SEND_GOODS; createTrade.pay_time = DateTime.MinValue; createTrade.end_time = DateTime.MinValue; createTrade.modified = DateTime.MinValue; createTrade.buyer_obtain_point_fee = string.Empty; createTrade.point_fee = string.Empty; createTrade.real_point_fee = string.Empty; createTrade.total_fee = GetOrdersTotalFee(); createTrade.post_fee = double.Parse(txtPostFee.Text); createTrade.buyer_alipay_no = string.Empty; createTrade.receiver_name = txtReceiverName.Text ?? string.Empty; createTrade.receiver_state = string.Empty; createTrade.receiver_city = string.Empty; createTrade.receiver_district = string.Empty; createTrade.receiver_address = txtReceiverAddr.Text; createTrade.receiver_zip = txtZipCode.Text; createTrade.receiver_mobile = txtMobileNum.Text; createTrade.receiver_phone = txtMobileNum.Text; createTrade.consign_time = DateTime.MinValue; createTrade.buyer_email = string.Empty; createTrade.commission_fee = string.Empty; createTrade.seller_alipay_no = string.Empty; createTrade.seller_mobile = string.Empty; createTrade.seller_phone = string.Empty; createTrade.seller_name = cmbSeller.SelectedText ?? string.Empty; createTrade.seller_email = string.Empty; createTrade.available_confirm_fee = string.Empty; createTrade.has_post_fee = true; createTrade.received_payment = 0.0; createTrade.cod_fee = 0.0; createTrade.cod_status = string.Empty; createTrade.timeout_action_time = dateEndTrade.DateTime; createTrade.is_3D = false; createTrade.LastShippingType = cmbShippingType.EditValue.ToString(); createTrade.LogisticCompanyCode = cmbShipCompany.EditValue.ToString(); createTrade.TemplateCode = cmbShippingTemplate.EditValue.ToString();//物流公司信息 createTrade.receiver_name = txtReceiverName.Text; createTrade.receiver_state = string.Empty; createTrade.receiver_city = string.Empty; createTrade.receiver_district = string.Empty; createTrade.receiver_address = txtReceiverAddr.Text; createTrade.receiver_zip = txtZipCode.Text; createTrade.receiver_mobile = txtMobileNum.Text; createTrade.receiver_phone = txtMobileNum.Text; createTrade.buyer_message = txtMemo.Text; createTrade.buyer_memo = txtMemo.Text; createTrade.ShippingCode = string.Empty; createTrade.LocalStatus = LocalTradeStatus.HasNotSummit; createTrade.CombineCode = string.Empty; createTrade.BuyerType = 1; createTrade.IsCombined = false; createTrade.IsSplited = false; createTrade.type = "fixed"; createTrade.HasInvoice = bool.Parse(radioHasTicket.EditValue.ToString()); createTrade.BuyerType = 1; createTrade.SellerType = 1;//TODO 卖家类型B C? createTrade.TradeSourceType = TradeSourceType.NEWCREATE; createTrade.ParentCustomTid = string.Empty; createTrade.CombineCode = string.Empty; createTrade.LockedUserCode = string.Empty; createTrade.LockedUserName = string.Empty; createTrade.LockedTime = DateTime.MinValue; createTrade.ConsignStatus = 1; createTrade.TradeTimeStamp = new byte[1]; }
/// <summary> /// 交易合并成一个交易 /// </summary> private void ConbinePrintFlg() { /*再次确认收货人姓名、地址,省市区是否一直等信息*/ if (DialogResult.Cancel == XtraMessageBox.Show(Alading.Properties.Resources.CheckTidData, Alading.Properties.Resources.Imformation, MessageBoxButtons.OKCancel, MessageBoxIcon.Information)) { combine.Enabled = true; return; } foreach (string custom in customTidList) { tradeList.AddRange(TradeService.GetTrade(q => q.CustomTid == custom)); parentTradeOrderList.AddRange(TradeOrderService.GetTradeOrder(q => q.CustomTid == custom)); }/*foreach*/ //通过outer_id GroupBy List <IGrouping <string, Alading.Entity.TradeOrder> > groupOrderList = new List <IGrouping <string, Alading.Entity.TradeOrder> >(); groupOrderList = parentTradeOrderList.GroupBy(q => q.iid).ToList(); //生成combine_code string combine_code = Guid.NewGuid().ToString(); #region /*查找相同的订单 并把相同的订单合单*/ foreach (IGrouping <string, Alading.Entity.TradeOrder> orderList in groupOrderList) { //在对sku_properties_name分类 List <IGrouping <string, Alading.Entity.TradeOrder> > groupList = orderList.GroupBy(q => q.sku_properties_name).ToList(); /*存在至少有两个相同的订单*/ if (groupList.Count() < orderList.Count()) { foreach (IGrouping <string, Alading.Entity.TradeOrder> listOrder in groupList) { /*找到了相同的订单*/ if (listOrder.Count() > 1) { /*订单合并处理*/ TradeOrderStock tradeOrderStock = new TradeOrderStock(); int num = 0; foreach (Alading.Entity.TradeOrder order in listOrder) { tradeOrderStock.order = order; //购买量汇总 num += order.num; //adjust_fee汇总 tradeOrderStock.order.adjust_fee += order.adjust_fee; //discount_fee汇总 tradeOrderStock.order.discount_fee += order.discount_fee; }/*if*/ AddDetail(listOrder.First().TradeOrderCode, tradeOrderStock); //num 汇总 tradeOrderStock.order.num = num; //total_fee汇总 tradeOrderStock.order.total_fee = tradeOrderStock.order.num * tradeOrderStock.order.price + tradeOrderStock.order.adjust_fee; //payment汇总 tradeOrderStock.order.payment = tradeOrderStock.order.discount_fee + tradeOrderStock.order.total_fee; //customtid赋值 tradeOrderStock.order.CustomTid = combine_code; //添加订单 tradeOrderList.Add(tradeOrderStock); } /*if*/ else /*没有和其他订单相同属性的单个订单*/ { TradeOrderStock tradeOrderStock = new TradeOrderStock(); tradeOrderStock.order = listOrder.First(); //添加宝贝名等信息 AddDetail(listOrder.First().TradeOrderCode, tradeOrderStock); //CustomTid tradeOrderStock.order.CustomTid = combine_code; tradeOrderList.Add(tradeOrderStock); } } /*foreach*/ } /*if*/ else { //单个订单 foreach (Alading.Entity.TradeOrder order in orderList) { TradeOrderStock tradeOrderStock = new TradeOrderStock(); tradeOrderStock.order = order; //添加宝贝名等信息 AddDetail(order.TradeOrderCode, tradeOrderStock); //CustomTid tradeOrderStock.order.CustomTid = combine_code; //total_fee汇总 tradeOrderStock.order.total_fee = tradeOrderStock.order.num * tradeOrderStock.order.price + tradeOrderStock.order.adjust_fee; //payment汇总 tradeOrderStock.order.payment = tradeOrderStock.order.discount_fee + tradeOrderStock.order.total_fee; tradeOrderList.Add(tradeOrderStock); } } }/*foreach*/ #endregion //邮费 double realPostFee = 0.0; double payment = 0.0; double total_fee = 0.0; /*修改子交易信息*/ for (int i = 0; i < tradeList.Count; i++) { if (realPostFee < tradeList[i].post_fee) { realPostFee = tradeList[i].post_fee; } //修改本地状态 tradeList[i].LocalStatus = LocalTradeStatus.CombineTrade; //添加combinecode tradeList[i].CombineCode = combine_code; }/*foreach*/ /*父交易*/ FatherTrade = TradeService.GetTrade(q => q.CustomTid == customTidList[0]).FirstOrDefault(); /*父订单(虚拟订单)*/ /*修改父交易相关信息*/ foreach (TradeOrderStock tradeOrderStock in tradeOrderList) { payment += tradeOrderStock.order.payment; total_fee += tradeOrderStock.order.total_fee; } FatherTrade.payment = payment + realPostFee; FatherTrade.total_fee = total_fee; FatherTrade.post_fee = realPostFee; FatherTrade.CombineCode = combine_code; FatherTrade.tid = Guid.NewGuid().ToString(); FatherTrade.IsCombined = true; FatherTrade.IsSelected = false; /*将combine_code赋给父交易的 CustomTid*/ FatherTrade.CustomTid = combine_code; FatherTrade.LocalStatus = LocalTradeStatus.HasNotSummit; /*显示数据*/ LoadTradeOrder(gcCombineTrade, gvCombineOrder, tradeOrderList, null); LoadTextEdit(FatherTrade); XtraMessageBox.Show(Alading.Properties.Resources.ConbineSuccess, Alading.Properties.Resources.Imformation); //合并不能用 combine.Enabled = false; }