Esempio n. 1
0
        public void UpdateDeliveryLogisticsInfo()
        {
            string method   = "qs.deliveryorder.get";
            string start    = DateTime.Now.AddDays(-5).ToString("yyyy-MM-dd HH:mm:ss");
            string end      = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            string shopcode = "005";//店铺代码

            for (int i = 1; i < 20; i++)
            {
                StringBuilder body = new StringBuilder();
                body.Append("{\"shopcode\":").Append("\"" + shopcode + "\"").Append(",");
                body.Append("\"startmodified\":").Append("\"" + start + "\"").Append(",");
                body.Append("\"endmodified\":").Append("\"" + end + "\"").Append(",");
                body.Append("\"pageno\":").Append("\"" + i + "\"").Append(",");
                body.Append("\"pagesize\":").Append("\"200\"").Append("}");

                string url     = GetUrl(method, body.ToString());
                string josnStr = GetResponseData(body.ToString(), url);
                if (josnStr == "error")
                {
                    break;
                }

                Dictionary <string, object> data = JsonToDictionary(josnStr);
                if (data.ContainsKey("total_results") && (int)(data["total_results"]) > 0)
                {
                    ArrayList array = (ArrayList)data["orders"];
                    foreach (Dictionary <string, object> item in array)
                    {
                        ArrayList tids = (ArrayList)item["tids"];
                        foreach (string tid in tids)
                        {
                            var delivery = IoC.Resolve <IXMDeliveryService>().GetXMDeliveryListByLogisticsNumber(tid);
                            if (delivery != null && delivery.Count > 0 && string.IsNullOrEmpty(delivery[0].LogisticsNumber))
                            {
                                delivery[0].LogisticsNumber = item["expressnumber"].ToString();
                                delivery[0].IsDelivery      = true;
                                delivery[0].UpdateId        = HozestERPContext.Current.User.CustomerID;
                                delivery[0].UpdateDate      = DateTime.Now;

                                string CompanyCode   = item["expresscode"].ToString();
                                var    CompanyCustom = IoC.Resolve <IXMCompanyCustomService>().GetXMCompanyCustomListByCompanyCode(CompanyCode);
                                if (CompanyCustom == null && CompanyCustom.Count > 0)
                                {
                                    delivery[0].LogisticsId = int.Parse(CompanyCustom[0].LogisticsId);
                                }
                                IoC.Resolve <IXMDeliveryService>().UpdateXMDelivery(delivery[0]);
                                //更新订单发货时间
                                string      ordercode     = delivery[0].OrderCode;
                                XMOrderInfo myXMOrderInfo = IoC.Resolve <IXMOrderInfoService>().GetXMOrderInfoByOrderCode(ordercode);
                                myXMOrderInfo.PayDate = DateTime.Now;
                                IoC.Resolve <IXMOrderInfoService>().UpdateXMOrderInfo(myXMOrderInfo);
                            }
                        }
                    }
                }
            }
        }
Esempio n. 2
0
        public void UpdateDelivery(XMDelivery One, XMOrderInfo xMOrderInfo, string date)
        {
            xMOrderInfo.DeliveryTime = Convert.ToDateTime(date);//修改出库时间
            xMOrderInfo.OrderStatus  = "WAIT_GOODS_RECEIVE_CONFIRM";
            xMOrderInfo.UpdateID     = HozestERPContext.Current.User.CustomerID;
            xMOrderInfo.UpdateDate   = DateTime.Now;
            IoC.Resolve <IXMOrderInfoService>().UpdateXMOrderInfo(xMOrderInfo);

            //修改发货单 是否发货状态
            One.IsDelivery = true;//已发货
            One.UpdateDate = DateTime.Now;
            One.UpdateId   = HozestERPContext.Current.User.CustomerID;
            IoC.Resolve <IXMDeliveryService>().UpdateXMDelivery(One);
        }
Esempio n. 3
0
        public bool JingDong(XMDelivery One, XMOrderInfoApp xMorderInfoApp, XMOrderInfo xMOrderInfo)
        {
            bool   Succed  = false;
            string Waybill = One.LogisticsNumber;

            if (Waybill == "")
            {
                Waybill = null;
            }
            int paramLogisticsId = int.Parse(One.LogisticsId.ToString());

            if (One.LogisticsId == 1)
            {
                paramLogisticsId = 2170;
            }
            if (One.LogisticsId == 500 || One.LogisticsId == 1499) //中通速递
            {
                paramLogisticsId = 1499;
            }
            if (One.LogisticsId == 3049)   //德邦速递
            {
                paramLogisticsId = 3049;
            }
            var outstorage = IoC.Resolve <IXMOrderInfoAPIService>().GetOutstorage(One.OrderCode, paramLogisticsId.ToString(), Waybill, xMorderInfoApp);

            if (outstorage != null)
            {
                if (!outstorage.IsError)
                {
                    UpdateDelivery(One, xMOrderInfo, DateTime.Now.ToString());
                    Succed = true;
                }
                else
                {
                    //DeleteDelivery(One);
                }
            }
            else
            {
                //DeleteDelivery(One);
            }
            return(Succed);
        }
Esempio n. 4
0
        public bool VPH(XMDelivery One, XMOrderInfoApp xMorderInfoApp, XMOrderInfo xMOrderInfo, string LogisticsName)
        {
            bool   Succed  = false;
            string Waybill = One.LogisticsNumber;

            if (Waybill == "")
            {
                Waybill = null;
            }
            var Success_num = IoC.Resolve <XMDeliveryImportDeliverAPI>().GetVPHAPIDelivery(One.OrderCode, One.LogisticsId.ToString(), Waybill, xMorderInfoApp, LogisticsName);

            if (Success_num != null)
            {
                UpdateDelivery(One, xMOrderInfo, DateTime.Now.ToString());
                Succed = true;
            }
            else
            {
                //DeleteDelivery(One);
            }
            return(Succed);
        }
Esempio n. 5
0
        public bool SuNing(XMDelivery One, XMOrderInfoApp xMorderInfoApp, XMOrderInfo xMOrderInfo)
        {
            bool   Succed  = false;
            string Waybill = One.LogisticsNumber;

            if (Waybill == "")
            {
                Waybill = null;
            }
            var ModifiedDate = IoC.Resolve <XMDeliveryImportDeliverAPI>().GetSuNingAPIDelivery(One.OrderCode, One.LogisticsCode, Waybill, xMorderInfoApp);

            if (ModifiedDate != null)
            {
                UpdateDelivery(One, xMOrderInfo, DateTime.Now.ToString());
                Succed = true;
            }
            else
            {
                //DeleteDelivery(One);
            }
            return(Succed);
        }