예제 #1
0
        public ModifyOrder(View_TradeStock tradeStock, byte[] orderTimeStamp)
        {
            InitializeComponent();
            WaitDialogForm wdf = new WaitDialogForm(Alading.Taobao.Constants.OPERATE_DB_DATA);

            _orderTimeStamp = orderTimeStamp;
            _tradeStock     = tradeStock;
            InitCmbDetails();
            InitForm();
            wdf.Close();
        }
예제 #2
0
        /// <summary>
        /// order数据复制
        /// </summary>
        /// <param name="result"></param>
        /// <param name="tradeorder"></param>
        private void TradeOrderCopyData(TradeOrder result, View_TradeStock tradeorder)
        {
            #region    Using All Items Replace To Update ,Default UnUse

            result.CustomTid = tradeorder.CustomTid;

            result.iid = tradeorder.iid;

            result.sku_id = tradeorder.sku_id;

            result.oid = tradeorder.oid;

            result.outer_sku_id = tradeorder.outer_sku_id;

            result.outer_iid = tradeorder.outer_iid;

            result.sku_properties_name = tradeorder.sku_properties_name;

            result.price = (double)tradeorder.price;

            result.total_fee = (double)tradeorder.total_fee;

            result.discount_fee = (double)tradeorder.discount_fee;

            result.adjust_fee = (double)tradeorder.adjust_fee;

            result.payment = (double)tradeorder.payment;

            result.item_meal_name = tradeorder.item_meal_name;

            result.num = (int)tradeorder.num;

            result.title = tradeorder.title;

            result.pic_path = tradeorder.pic_path;

            result.seller_nick = tradeorder.seller_nick;

            result.buyer_nick = tradeorder.buyer_nick;

            result.type = tradeorder.type;

            result.created = (DateTime)tradeorder.created;

            result.status         = tradeorder.status;
            result.OrderType      = tradeorder.OrderType;
            result.OrderTimeStamp = tradeorder.TradeTimeStamp;

            #endregion
        }
예제 #3
0
        /// <summary>
        /// 获取宝贝属性,商品名等
        /// </summary>
        /// <param name="TradeOrderCode"></param>
        /// <param name="tradeOrderStock"></param>
        private void AddDetail(string TradeOrderCode, TradeOrderStock tradeOrderStock)
        {
            View_TradeStock tradeStock = View_TradeStockService.GetView_TradeStock(q => q.TradeOrderCode == TradeOrderCode).FirstOrDefault();

            if (tradeStock != null)
            {
                //宝贝性质
                tradeOrderStock.itemType = tradeStock.ItemType;
                //商品类别
                tradeOrderStock.orderType = tradeStock.OrderType;
                //商品名
                tradeOrderStock.itemName = tradeStock.ItemName;
            }
        }
예제 #4
0
        private List <View_TradeStock> viewTradeStockConvert(List <ViewTradeStock> viewSrc)
        {
            if (viewSrc == null || viewSrc.Count == 0)
            {
                return(null);
            }
            List <View_TradeStock> viewDes = new List <View_TradeStock>();

            foreach (ViewTradeStock Tradestock in viewSrc)
            {
                View_TradeStock TradestockObj = new View_TradeStock();
                viewCopyData(TradestockObj, Tradestock);
                viewDes.Add(TradestockObj);
            }
            return(viewDes);
        }
예제 #5
0
 /// <summary>
 /// 将一条View_TradeStock的信息赋值到TradeRow
 /// </summary>
 /// <param name="orderRow"></param>
 /// <param name="orderCur"></param>
 /// <param name="orderAccount"></param>
 private void InitOrderRow(DataRow orderRow, View_TradeStock orderCur)
 {
     orderRow["tid"]                 = orderCur.tid;
     orderRow["iid"]                 = orderCur.iid;
     orderRow["oid"]                 = orderCur.oid;
     orderRow["CustomTid"]           = orderCur.CustomTid;
     orderRow["orderTotalFee"]       = orderCur.total_fee;
     orderRow["ItemName"]            = orderCur.ItemName;
     orderRow["sku_properties_name"] = orderCur.sku_properties_name;
     orderRow["num"]                 = orderCur.num;
     orderRow["price"]               = orderCur.price;
     orderRow["payment"]             = orderCur.payment;
     orderRow["OrderType"]           = orderCur.OrderType;
     orderRow["adjust_fee"]          = orderCur.adjust_fee;
     orderRow["ItemType"]            = orderCur.ItemType;
 }
예제 #6
0
 /// <summary>
 /// 将一条View_TradeStock的信息赋值到TradeRow
 /// </summary>
 /// <param name="orderRow"></param>
 /// <param name="orderCur"></param>
 /// <param name="orderAccount"></param>
 private void InitOrderRow(DataRow orderRow, View_TradeStock orderCur)
 {
     orderRow["tid"]                 = orderCur.tid;
     orderRow["iid"]                 = orderCur.iid;
     orderRow["OuterID"]             = orderCur.OuterID;
     orderRow["TradeOrderCode"]      = orderCur.TradeOrderCode;
     orderRow["oid"]                 = orderCur.oid;
     orderRow["CustomTid"]           = orderCur.CustomTid;
     orderRow["ItemName"]            = orderCur.ItemName;
     orderRow["sku_properties_name"] = orderCur.sku_properties_name;
     orderRow["LeftQuantity"]        = orderCur.SkuQuantity - orderCur.OccupiedQuantity;
     orderRow["num"]                 = orderCur.num;
     orderRow["price"]               = orderCur.price;
     orderRow["payment"]             = orderCur.payment;
     orderRow["OrderType"]           = orderCur.OrderType;
     //查询货物库存量
 }
예제 #7
0
        /// <summary>
        /// 根据订单号来确定一笔交易是否缺货
        /// </summary>
        /// <param name="tradeOrderCode">本地唯一订单号</param>
        /// <returns></returns>
        private string GetOrderLackMessage(string tradeOrderCode)
        {
            View_TradeStock order = View_TradeStockService.GetView_TradeStock(p => p.TradeOrderCode == tradeOrderCode).FirstOrDefault();

            if (order != null)
            {
                if ((order.SkuQuantity - order.OccupiedQuantity - order.num) >= 0)
                {
                    return(LackProductOrNot.Normal);
                }
                else
                {
                    return(LackProductOrNot.Lack);
                }
            }
            else
            {
                return(LackProductOrNot.NotExist);
            }
        }
예제 #8
0
        /// <summary>
        /// 将一条View_TradeStock的信息赋值到TradeRow
        /// </summary>
        /// <param name="tradeRow"></param>
        /// <param name="tradeCur"></param>
        private void InitTradeRow(DataRow tradeRow, IGrouping <string, View_TradeStock> tradeCurList)
        {
            View_TradeStock tradeCur = tradeCurList.FirstOrDefault();

            tradeRow["CustomTid"]         = tradeCur.CustomTid;
            tradeRow["IsSelected"]        = false;
            tradeRow["type"]              = tradeCur.type;
            tradeRow["TradePayment"]      = tradeCur.TradePayment;
            tradeRow["tid"]               = tradeCur.tid;
            tradeRow["created"]           = tradeCur.created;
            tradeRow["buyer_nick"]        = tradeCur.buyer_nick;
            tradeRow["seller_nick"]       = tradeCur.seller_nick;
            tradeRow["post_fee"]          = tradeCur.post_fee;
            tradeRow["tradeTotalFee"]     = tradeCur.TradeTotalFee;
            tradeRow["HasInvoice"]        = tradeCur.HasInvoice == false ? "否" : "是";
            tradeRow["post_fee"]          = tradeCur.post_fee;
            tradeRow["receiver_state"]    = tradeCur.receiver_state;
            tradeRow["receiver_city"]     = tradeCur.receiver_city;
            tradeRow["receiver_name"]     = tradeCur.receiver_name;
            tradeRow["receiver_zip"]      = tradeCur.receiver_zip;
            tradeRow["receiver_district"] = tradeCur.receiver_district;
            tradeRow["receiver_address"]  = tradeCur.receiver_address;
        }
예제 #9
0
        private void gvChildGV_RowCellClick(object sender, RowCellClickEventArgs e)
        {
            GridView gv = (sender as GridView).GridControl.GetViewAt(e.Location) as GridView;

            if (gv != null)
            {
                GridHitInfo hi = gv.CalcHitInfo(e.Location);
                if (hi.Column != null && hi.InRowCell)
                {
                    //记录当前焦点所在的OrderRow
                    DataRow currentMatch = gv.GetDataRow(hi.RowHandle);

                    #region 点击种类 如果是组合商品 下面显示
                    if (currentMatch["ItemType"].ToString() == ItemType.ConbineProduct.ToString())
                    {
                        detailAessemble.PageVisible     = true;
                        tabsTradeDetail.SelectedTabPage = detailAessemble;
                    }
                    else
                    {
                        detailAessemble.PageVisible = false;
                    }
                    #endregion

                    #region 如果不是连续点击 则绑定数据

                    //防止同一重复事件多次加载
                    if (_currentOrderRow != currentMatch)
                    {
                        //记录当前焦点所在的OrderRow
                        _currentOrderRow = currentMatch;

                        //记录当前订单的父Trade行
                        _currentTradeRow = currentMatch.GetParentRow(Alading.Taobao.Constants.TRADE_ORDER_RELATION);

                        //绑定TradeDetail信息
                        SetTradeDetailMessages(_currentTradeRow);

                        //绑定商品信息到面板
                        ShowItemPropValue(currentMatch["iid"].ToString(), currentMatch["sku_properties_name"].ToString());
                    }
                    #endregion

                    #region  如果选中列为’修改订单‘,则执行处理代码
                    if (hi.Column.ColumnHandle == 0)//
                    {
                        //如果是未建立库存 则不作处理
                        if (_currentOrderRow[1].ToString() == LackProductOrNot.NotBuildStock)
                        {
                            XtraMessageBox.Show("当前订单未关联库存,不能修改订单信息");
                            return;
                        }
                        //取得当前选中订单的数据库真实值
                        View_TradeStock focusedOrder =
                            View_TradeStockService.GetView_TradeStock(p => p.TradeOrderCode == _currentOrderRow["TradeOrderCode"].ToString()).FirstOrDefault();
                        if (focusedOrder == null)
                        {
                            return;
                        }
                        if (focusedOrder.LocalStatus != LocalTradeStatus.HasNotSummit)
                        {
                            XtraMessageBox.Show("该订单的交易状态已经改变,不能换货!");
                            return;
                        }
                        #region 利用时间戳来防止并发
                        DialogResult result = DialogResult.Yes;
                        if (!SystemHelper.CompareTimeStamp(_currentOrderRow["OrderTimeStamp"] as byte[], focusedOrder.OrderTimeStamp))
                        {
                            //如果订单信息已经被改,询问是否继续修改
                            result = XtraMessageBox.Show("订单信息已被修改,继续修改(YES)/查看流程信息(NO)", "订单修改",
                                                         MessageBoxButtons.YesNo);
                            if (result == DialogResult.No)//如果选择为NO,则查看流程信息,并返回
                            {
                                tabsTradeDetail.SelectedTabPage = detailTabFlowMsg;
                                return;
                            }
                        }
                        if (result == DialogResult.Yes)//如果result=YES,则继续修改
                        {
                            //传入时间戳,只有在最后修改提交前验证才能保证不并发
                            ModifyOrder modifyOrder = new ModifyOrder(focusedOrder, _currentOrderRow["OrderTimeStamp"] as byte[]);//转入修改订单页面
                            modifyOrder.ShowDialog();

                            switch (modifyOrder.DialogResult)
                            {
                            case DialogResult.Ignore:
                                return;

                            case DialogResult.OK:
                                InitSelectTab();
                                break;

                            case DialogResult.Cancel:
                                tabsTradeDetail.SelectedTabPage = detailTabFlowMsg;
                                break;
                            }
                        }
                        else//否则,直接返回
                        {
                            return;
                        }
                        #endregion
                    }
                    #endregion
                }
            }
        }
예제 #10
0
 private void viewCopyData(View_TradeStock viewDes, ViewTradeStock viewSrc)
 {
     viewDes.TradeOrderID           = viewSrc.TradeOrderID;
     viewDes.TradeOrderCode         = viewSrc.TradeOrderCode;
     viewDes.iid                    = viewSrc.iid;
     viewDes.sku_id                 = viewSrc.sku_id;
     viewDes.oid                    = viewSrc.oid;
     viewDes.outer_sku_id           = viewSrc.outer_sku_id;
     viewDes.outer_iid              = viewSrc.outer_iid;
     viewDes.sku_properties_name    = viewSrc.sku_properties_name;
     viewDes.price                  = viewSrc.price;
     viewDes.total_fee              = viewSrc.total_fee;
     viewDes.discount_fee           = viewSrc.discount_fee;
     viewDes.adjust_fee             = viewSrc.adjust_fee;
     viewDes.payment                = viewSrc.payment;
     viewDes.item_meal_name         = viewSrc.item_meal_name;
     viewDes.num                    = viewSrc.num;
     viewDes.title                  = viewSrc.title;
     viewDes.pic_path               = viewSrc.pic_path;
     viewDes.seller_nick            = viewSrc.seller_nick;
     viewDes.buyer_nick             = viewSrc.buyer_nick;
     viewDes.type                   = viewSrc.type;
     viewDes.created                = viewSrc.created;
     viewDes.refund_status          = viewSrc.refund_status;
     viewDes.seller_type            = viewSrc.seller_type;
     viewDes.snapshot_url           = viewSrc.snapshot_url;
     viewDes.snapshot               = viewSrc.snapshot;
     viewDes.timeout_action_time    = viewSrc.timeout_action_time;
     viewDes.OrderType              = viewSrc.OrderType;
     viewDes.OrderTimeStamp         = viewSrc.OrderTimeStamp;
     viewDes.HouseCode              = viewSrc.HouseCode;
     viewDes.LayoutCode             = viewSrc.LayoutCode;
     viewDes.ShopTypeName           = viewSrc.ShopTypeName;
     viewDes.LogisticCompanyName    = viewSrc.LogisticCompanyName;
     viewDes.TemplateName           = viewSrc.TemplateName;
     viewDes.CustomTid              = viewSrc.CustomTid;
     viewDes.LogisticCompanyCode    = viewSrc.LogisticCompanyCode;
     viewDes.TemplateCode           = viewSrc.TemplateCode;
     viewDes.tid                    = viewSrc.tid;
     viewDes.TradeCreated           = viewSrc.TradeCreated;
     viewDes.buyer_message          = viewSrc.buyer_message;
     viewDes.buyer_memo             = viewSrc.buyer_memo;
     viewDes.alipay_no              = viewSrc.alipay_no;
     viewDes.TradePayment           = viewSrc.TradePayment;
     viewDes.status                 = viewSrc.status;
     viewDes.TradeAdjustFee         = viewSrc.TradeAdjustFee;
     viewDes.TradeDiscountFee       = viewSrc.TradeDiscountFee;
     viewDes.pay_time               = viewSrc.pay_time;
     viewDes.end_time               = viewSrc.end_time;
     viewDes.post_fee               = viewSrc.post_fee;
     viewDes.receiver_name          = viewSrc.receiver_name;
     viewDes.receiver_city          = viewSrc.receiver_city;
     viewDes.receiver_district      = viewSrc.receiver_district;
     viewDes.receiver_address       = viewSrc.receiver_address;
     viewDes.receiver_zip           = viewSrc.receiver_zip;
     viewDes.receiver_mobile        = viewSrc.receiver_mobile;
     viewDes.receiver_phone         = viewSrc.receiver_phone;
     viewDes.receiver_state         = viewSrc.receiver_state;
     viewDes.TradeTimeStamp         = viewSrc.TradeTimeStamp;
     viewDes.HasInvoice             = viewSrc.HasInvoice;
     viewDes.TradeSourceType        = viewSrc.TradeSourceType;
     viewDes.IsSplited              = viewSrc.IsSplited;
     viewDes.IsCombined             = viewSrc.IsCombined;
     viewDes.LockedUserName         = viewSrc.LockedUserName;
     viewDes.LockedUserCode         = viewSrc.LockedUserCode;
     viewDes.LockedTime             = viewSrc.LockedTime;
     viewDes.ShippingCode           = viewSrc.ShippingCode;
     viewDes.LastShippingType       = viewSrc.LastShippingType;
     viewDes.LocalStatus            = viewSrc.LocalStatus;
     viewDes.CombineCode            = viewSrc.CombineCode;
     viewDes.ParentCustomTid        = viewSrc.ParentCustomTid;
     viewDes.SkuProps_Str           = viewSrc.SkuProps_Str;
     viewDes.SkuQuantity            = viewSrc.SkuQuantity;
     viewDes.SkuPrice               = viewSrc.SkuPrice;
     viewDes.OccupiedQuantity       = viewSrc.OccupiedQuantity;
     viewDes.OuterID                = viewSrc.OuterID;
     viewDes.ItemName               = viewSrc.ItemName;
     viewDes.CatName                = viewSrc.CatName;
     viewDes.Cid                    = viewSrc.Cid;
     viewDes.seller_name            = viewSrc.seller_name;
     viewDes.seller_phone           = viewSrc.seller_phone;
     viewDes.seller_mobile          = viewSrc.seller_mobile;
     viewDes.seller_alipay_no       = viewSrc.seller_alipay_no;
     viewDes.commission_fee         = viewSrc.commission_fee;
     viewDes.buyer_email            = viewSrc.buyer_email;
     viewDes.consign_time           = viewSrc.consign_time;
     viewDes.buyer_alipay_no        = viewSrc.buyer_alipay_no;
     viewDes.TradeTotalFee          = viewSrc.TradeTotalFee;
     viewDes.buyer_obtain_point_fee = viewSrc.buyer_obtain_point_fee;
     viewDes.modified               = viewSrc.modified;
     viewDes.point_fee              = viewSrc.point_fee;
     viewDes.real_point_fee         = viewSrc.real_point_fee;
     viewDes.seller_memo            = viewSrc.seller_memo;
     viewDes.seller_rate            = viewSrc.seller_rate;
     viewDes.buyer_rate             = viewSrc.buyer_rate;
     viewDes.TradeType              = viewSrc.TradeType;
     viewDes.shipping_type          = viewSrc.shipping_type;
     viewDes.has_post_fee           = viewSrc.has_post_fee;
     viewDes.seller_email           = viewSrc.seller_email;
     viewDes.available_confirm_fee  = viewSrc.available_confirm_fee;
     viewDes.received_payment       = viewSrc.received_payment;
     viewDes.cod_fee                = viewSrc.cod_fee;
     viewDes.cod_status             = viewSrc.cod_status;
     viewDes.TradeTimeOutActionTime = viewSrc.TradeTimeOutActionTime;
     viewDes.is_3D                  = viewSrc.is_3D;
     viewDes.BuyerType              = viewSrc.BuyerType;
     viewDes.SellerType             = viewSrc.SellerType;
 }
예제 #11
0
        /// <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
        }