예제 #1
0
        /// <summary>
        /// 获取销售订单
        /// </summary>
        /// <param name="coll"></param>
        /// <returns></returns>
        private List <K3SalOrderInfo> GetK3SalOrderInfo(DynamicObjectCollection coll)
        {
            K3SalOrderInfo        order  = null;
            List <K3SalOrderInfo> orders = null;

            if (coll != null && coll.Count > 0)
            {
                orders = new List <K3SalOrderInfo>();

                foreach (var obj in coll)
                {
                    if (obj != null)
                    {
                        if (SQLUtils.GetFieldValue(obj, "FBillNo").StartsWith("SO"))
                        {
                            order = new K3SalOrderInfo();

                            order.SrcNo   = SQLUtils.GetFieldValue(obj, "FBillNo");
                            order.FBillNo = SQLUtils.GetFieldValue(obj, "FBillNo");                                   //订单号
                            order.F_HS_OriginOnlineOrderNo = SQLUtils.GetFieldValue(obj, "F_HS_OriginOnlineOrderNo"); //原线下订单单号
                            order.FDate = Convert.ToDateTime(SQLUtils.GetFieldValue(obj, "FDate"));                   //订单日期

                            order.PurseDate      = TimeHelper.GetTimeStamp(order.FDate);
                            order.FCustId        = SQLUtils.GetFieldValue(obj, "FCUSTID");                                                           //客户编码
                            order.F_HS_B2CCustId = SQLUtils.GetFieldValue(obj, "F_HS_B2CCustId");                                                    //客户真是编码
                            order.FSalerId       = SQLUtils.GetSellerNo(this.K3CloudContext, obj, "FSalerId");                                       //销售员编码

                            order.OrderSource = SQLUtils.GetFieldValue(obj, "F_HS_SaleOrderSource");                                                 //订单来源

                            order.FSettleCurrId  = SQLUtils.GetFieldValue(obj, "FSettleCurrId");                                                     //结算币别
                            order.F_HS_RateToUSA = Convert.ToDecimal(SQLUtils.GetFieldValue(obj, "F_HS_RateToUSA"));                                 //汇率

                            order.F_HS_RecipientCountry  = SQLUtils.GetFieldValue(obj, "F_HS_RecipientCountry");                                     //国家
                            order.F_HS_DeliveryProvinces = SQLUtils.GetFieldValue(obj, "F_HS_DeliveryProvinces");                                    //省份/州

                            order.F_HS_DeliveryCity    = SQLUtils.GetFieldValue(obj, "F_HS_DeliveryCity");                                           //城市
                            order.F_HS_DeliveryAddress = SQLUtils.GetFieldValue(obj, "F_HS_DeliveryAddress");                                        //具体地址

                            order.F_HS_PostCode     = SQLUtils.GetFieldValue(obj, "F_HS_PostCode");                                                  //邮编
                            order.F_HS_DeliveryName = SQLUtils.GetFieldValue(obj, "F_HS_DeliveryName");                                              //收货人姓名

                            order.F_HS_BillAddress = SQLUtils.GetFieldValue(obj, "F_HS_BillAddress");                                                //账单地址
                            order.F_HS_MobilePhone = SQLUtils.GetFieldValue(obj, "F_HS_MobilePhone");                                                //收货人联系电话

                            order.F_HS_ShippingMethod = SQLUtils.GetFieldValue(obj, "F_HS_ShippingMethod");                                          //发货方式
                            order.F_HS_PaymentModeNew = SQLUtils.GetFieldValue(obj, "F_HS_PaymentModeNew");                                          //付款方式

                            order.F_HS_PaymentStatus = SQLUtils.GetFieldValue(obj, "F_HS_PaymentStatus");                                            //付款状态
                            order.F_HS_Shipping      = Convert.ToDecimal(SQLUtils.GetFieldValue(obj, "F_HS_Shipping"));                              //运费

                            order.FCustLevel = SQLUtils.GetFieldValue(obj, "F_HS_FGroup");                                                           //分组
                            order.FNote      = SQLUtils.GetFieldValue(obj, "FNOTE");                                                                 //备注

                            order.F_HS_Channel      = SQLUtils.GetFieldValue(obj, "F_HS_OnlineOrderWay");                                            //订单渠道
                            order.F_HS_CouponAmount = Convert.ToDecimal(SQLUtils.GetFieldValue(obj, "F_HS_CouponAmount"));                           //优惠金额

                            order.F_HS_IntegralDeduction = Convert.ToDecimal(SQLUtils.GetFieldValue(obj, "F_HS_IntegralDeduction"));                 //积分金额
                            order.F_HS_DiscountedAmount  = Convert.ToDecimal(SQLUtils.GetFieldValue(obj, "F_HS_DiscountedAmount"));                  //已优惠金额
                            order.FApproveDate           = TimeHelper.GetTimeStamp(Convert.ToDateTime(SQLUtils.GetFieldValue(obj, "FApproveDate"))); //订单审核时间

                            order.F_HS_CollectionTime = Convert.ToDateTime(SQLUtils.GetFieldValue(obj, "F_HS_CollectionTime"));                      //CEO特批已到款时间
                            order.PayedTime           = TimeHelper.GetTimeStamp(order.F_HS_CollectionTime);                                          //CEO特批已到款时间(时间戳)

                            K3SalOrderEntryInfo entry = new K3SalOrderEntryInfo();

                            entry.FMaterialId         = SQLUtils.GetFieldValue(obj, "FMaterialId");                                            //物料编码
                            entry.FTAXPRICE           = Convert.ToDecimal(SQLUtils.GetFieldValue(obj, "FTAXPRICE"));                           //单价
                            entry.FTAXAmt             = Convert.ToDecimal(SQLUtils.GetFieldValue(obj, "FAmount"));                             //商品总价
                            entry.FQTY                = Convert.ToDecimal(SQLUtils.GetFieldValue(obj, "FQTY"));                                //数量
                            entry.FStockId            = SQLUtils.GetFieldValue(obj, "F_HS_StockID");                                           //仓库地理编码
                            entry.F_HS_IsVirtualEntry = SQLUtils.GetFieldValue(obj, "F_HS_IsVirtualEntry").CompareTo("1") == 1 ? true : false; //是否虚拟
                            entry.F_HS_IsEmptyStock   = SQLUtils.GetFieldValue(obj, "F_HS_IsEmptyStock").CompareTo("1") == 1 ? true : false;   //是否清仓
                            entry.FIsFree             = SQLUtils.GetFieldValue(obj, "FIsFree").CompareTo("1") == 1 ? true : false;             //是否为赠品

                            order.OrderEntry.Add(entry);
                            orders.Add(order);
                        }
                    }
                }
            }
            return(orders);
        }