コード例 #1
0
        public override IEnumerable <AbsSynchroDataInfo> GetK3Datas(Context ctx, List <DynamicObject> objects, ref HttpResponseResult result)
        {
            K3SalOrderInfo        order  = null;
            List <K3SalOrderInfo> orders = null;

            result         = new HttpResponseResult();
            result.Success = true;

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

                foreach (var item in objects)
                {
                    if (item != null)
                    {
                        if (SQLUtils.GetBillTypeNo(this.Context, item, "BillTypeId_Id").CompareTo("XSDD01_SYS") == 0 && SQLUtils.GetSaleOrderSourceNo(this.Context, item, "F_HS_SaleOrderSource_Id").CompareTo("XXBJDD") == 0 &&
                            SQLUtils.GetFieldValue(item, "DocumentStatus").CompareTo("C") == 0 && SQLUtils.GetFieldValue(item, "BillNo").StartsWith("SO") &&
                            !SQLUtils.GetFieldValue(item, "BillNo").Contains("_") && SQLUtils.GetFieldValue(item, "SaleOrgId_Id").CompareTo("100035") == 0)
                        {
                            order = new K3SalOrderInfo();

                            K3SaleOrderFinance finance = GetOrderFinance(item, "SaleOrderFinance");//财务信息

                            order.SrcNo   = SQLUtils.GetFieldValue(item, "BillNo");
                            order.FBillNo = SQLUtils.GetFieldValue(item, "BillNo");                                    //订单号
                            order.F_HS_OriginOnlineOrderNo = SQLUtils.GetFieldValue(item, "F_HS_OriginOnlineOrderNo"); //原线上订单单号
                            order.FDate     = Convert.ToDateTime(SQLUtils.GetFieldValue(item, "Date"));                //订单日期
                            order.PurseDate = TimeHelper.GetTimeStamp(order.FDate);                                    //订单日期(时间戳)
                            order.FNote     = SQLUtils.GetFieldValue(item, "FNote");                                   //备注

                            DynamicObject cust = item["CustId"] as DynamicObject;                                      //客户
                            order.FCustId = SQLUtils.GetFieldValue(cust, "Number");

                            DynamicObject realCust = item["F_HS_B2CCustId"] as DynamicObject;//客户真实ID
                            order.F_HS_B2CCustId = SQLUtils.GetFieldValue(realCust, "Number");

                            DynamicObject saler = item["SalerId"] as DynamicObject;
                            order.FSalerId = SQLUtils.GetFieldValue(saler, "Number");

                            DynamicObject source = item["F_HS_SaleOrderSource"] as DynamicObject;
                            order.OrderSource = SQLUtils.GetFieldValue(source, "FNumber");                          //订单来源

                            order.F_HS_PaymentStatus = SQLUtils.GetFieldValue(item, "F_HS_PaymentStatus");          //付款状态
                            order.FSettleCurrId      = finance.FSettleCurrID;                                       //结算币别

                            order.F_HS_RateToUSA = Convert.ToDecimal(SQLUtils.GetFieldValue(item, "ExchangeRate")); //汇率

                            DynamicObject country = item["F_HS_RecipientCountry"] as DynamicObject;
                            order.F_HS_RecipientCountry = SQLUtils.GetFieldValue(country, "Number");               //国家

                            order.F_HS_DeliveryProvinces = SQLUtils.GetFieldValue(item, "F_HS_DeliveryProvinces"); //省份
                            order.F_HS_DeliveryCity      = SQLUtils.GetFieldValue(item, "F_HS_DeliveryCity");      //城市

                            order.F_HS_DeliveryAddress = SQLUtils.GetFieldValue(item, "F_HS_DeliveryAddress");     //具体地址
                            order.F_HS_PostCode        = SQLUtils.GetFieldValue(item, "F_HS_PostCode");            //邮编

                            order.F_HS_DeliveryName = SQLUtils.GetFieldValue(item, "F_HS_DeliveryName");           //收货人
                            order.F_HS_BillAddress  = SQLUtils.GetFieldValue(item, "F_HS_BillAddress");            //账单地址

                            order.F_HS_MobilePhone    = SQLUtils.GetFieldValue(item, "F_HS_MobilePhone");          //联系人手机
                            order.F_HS_ShippingMethod = SQLUtils.GetFieldValue(item, "F_HS_ShippingMethod");       //发货方式

                            DynamicObject met = item["F_HS_PaymentModeNew"] as DynamicObject;
                            order.F_HS_PaymentModeNew = SQLUtils.GetFieldValue(met, "Number");                              //付款方式

                            order.FCustLevel = SQLUtils.GetCustGroupNo(this.Context, item, "F_HS_FGroup_Id");               //客户分组

                            order.FNote        = SQLUtils.GetFieldValue(item, "Note");                                      //备注
                            order.F_HS_Channel = SQLUtils.GetFieldValue(item, "F_HS_OnlineOrderWay");                       //下单方式

                            order.F_HS_CouponAmount = Convert.ToDecimal(SQLUtils.GetFieldValue(item, "F_HS_CouponAmount")); //优惠券金额
                            //order.F_HS_Shipping = Convert.ToDecimal(SQLUtils.GetFieldValue(item, "F_HS_Shipping"));//运费

                            order.F_HS_Points = Convert.ToDecimal(SQLUtils.GetFieldValue(item, "F_HS_Points"));                                                                           //积分

                            order.OrderEntry          = GetOrderEntry(item, "SaleOrderEntry", order);                                                                                     //订单明细
                            order.F_HS_Total          = order.F_HS_Subtotal - order.F_HS_CouponAmount - order.F_HS_IntegralDeduction - order.F_HS_DiscountedAmount + order.F_HS_Shipping; //优惠后金额
                            order.FApproveDate        = TimeHelper.GetTimeStamp(Convert.ToDateTime(SQLUtils.GetFieldValue(item, "ApproveDate")));
                            order.F_HS_CollectionTime = Convert.ToDateTime(SQLUtils.GetFieldValue(item, "F_HS_CollectionTime"));                                                          //CEO特批已到款时间
                            order.PayedTime           = TimeHelper.GetTimeStamp(order.F_HS_CollectionTime);                                                                               //CEO特批已到款时间(时间戳)
                            orders.Add(order);
                        }
                    }
                }
            }

            return(orders);
        }