Example #1
0
        public void sendLSXH_OffPay(DataRow[] drs, List <long> list)
        {
            string     app_key    = ConfigUtil.App_key;
            string     app_secret = ConfigUtil.App_secret;
            string     iposApiUrl = ConfigUtil.IposApiUrl;
            ITopClient topClient  = new DefaultTopClient(iposApiUrl, app_key, app_secret);
            RetailIfashionOrderCreateRequest retailIfashionOrderCreateRequest = new RetailIfashionOrderCreateRequest();

            for (int i = 0; i < drs.Length; i++)
            {
                DataRow dataRow        = drs[i];
                string  accessToken_QT = InvoicesManage.GetAccessToken_QT(dataRow["DM1"].ToString());
                RetailIfashionOrderCreateRequest.OrderInfoRequestDomain orderInfoRequestDomain = new RetailIfashionOrderCreateRequest.OrderInfoRequestDomain();
                DataTable billInfoByIwms_ForQT = InvoicesManage.GetBillInfoByIwms_XP_ForQT(dataRow["djbh"].ToString());
                string    skuList = "";
                if (billInfoByIwms_ForQT != null && billInfoByIwms_ForQT.Rows.Count > 0)
                {
                    skuList = JsonParser.ToJson(billInfoByIwms_ForQT);
                }
                orderInfoRequestDomain.SkuList  = skuList;
                orderInfoRequestDomain.OrderId  = dataRow["DJBH"].ToString();
                orderInfoRequestDomain.TotalFee = Math.Ceiling(decimal.Parse(dataRow["JE"].ToString())).ToString();
                //orderInfoRequestDomain.TotalFee = "9800";
                orderInfoRequestDomain.Source           = "baison";
                orderInfoRequestDomain.Type             = "erp-sale";
                retailIfashionOrderCreateRequest.Param_ = orderInfoRequestDomain;
                try
                {
                    RetailIfashionOrderCreateResponse retailIfashionOrderCreateResponse = topClient.Execute <RetailIfashionOrderCreateResponse>(retailIfashionOrderCreateRequest, accessToken_QT);
                    if (retailIfashionOrderCreateResponse != null && retailIfashionOrderCreateResponse.Result != null && retailIfashionOrderCreateResponse.Result.Success)
                    {
                        string sql = "update SG_Gathering set is_move='1' where vMBillID ='" + dataRow["DJBH"].ToString() + "'";
                        BusinessDbUtil.ExecuteNonQuery(sql);
                        LogUtil.WriteInfo(this, retailIfashionOrderCreateResponse.Body, "中台小票上传成功:DJBH" + dataRow["DJBH"].ToString());
                        if (Convert.ToInt64(dataRow["LastChanged"]) > list[0])
                        {
                            this.UpdateStatusPostDate(dataRow["LastChanged"].ToString());
                            list[0] = Convert.ToInt64(dataRow["LastChanged"]);
                        }
                    }
                    else
                    {
                        LogUtil.WriteInfo(this, retailIfashionOrderCreateResponse.Body, string.Format("返回的状态:flag:{0},code:{1},message:{2}", "失败", "失败", retailIfashionOrderCreateResponse.Body));
                    }
                }
                catch (Exception ex)
                {
                    LogUtil.WriteError(this, ex.Message, ex.Message);
                }
            }
        }
Example #2
0
        public void sendSPTHD_FromERP(DataRow[] drs, List <long> list)
        {
            string     app_key    = ConfigUtil.App_key;
            string     app_secret = ConfigUtil.App_secret;
            string     iposApiUrl = ConfigUtil.IposApiUrl;
            ITopClient topClient  = new DefaultTopClient(iposApiUrl, app_key, app_secret);
            RetailIfashionOrderCreateRequest retailIfashionOrderCreateRequest = new RetailIfashionOrderCreateRequest();

            for (int i = 0; i < drs.Length; i++)
            {
                #region
                DataRow dataRow = drs[i];
                try
                {
                    string accessToken_QT = InvoicesManage.GetAccessToken_QT(dataRow["DM1"].ToString(), "SDTHD");
                    RetailIfashionOrderCreateRequest.OrderInfoRequestDomain orderInfoRequestDomain = new RetailIfashionOrderCreateRequest.OrderInfoRequestDomain();
                    DataTable billInfoByIwms_ForQT = InvoicesManage.GetBillInfoByIwms_ForQT("SPTHDMX", dataRow["djbh"].ToString());
                    DataRow   drList = billInfoByIwms_ForQT.AsEnumerable().Where(item => item["sku_id"].ToString() == "").FirstOrDefault();
                    if (drList != null)
                    {
                        LogUtil.WriteError(this, "条码不存在", JsonParser.ToJson(billInfoByIwms_ForQT));
                        continue;
                    }
                    string skuList = "";
                    if (billInfoByIwms_ForQT != null && billInfoByIwms_ForQT.Rows.Count > 0)
                    {
                        skuList = JsonParser.ToJson(billInfoByIwms_ForQT);
                    }

                    orderInfoRequestDomain.SkuList          = skuList;
                    orderInfoRequestDomain.OrderId          = dataRow["DJBH"].ToString();
                    orderInfoRequestDomain.TotalFee         = Math.Ceiling(decimal.Parse(dataRow["JE"].ToString()) * 100).ToString();
                    orderInfoRequestDomain.Source           = "baison";
                    orderInfoRequestDomain.Type             = "erp-stock-back";
                    retailIfashionOrderCreateRequest.Param_ = orderInfoRequestDomain;
                    try
                    {
                        RetailIfashionOrderCreateResponse retailIfashionOrderCreateResponse = topClient.Execute <RetailIfashionOrderCreateResponse>(retailIfashionOrderCreateRequest, accessToken_QT);
                        if (retailIfashionOrderCreateResponse != null && retailIfashionOrderCreateResponse.Result != null && retailIfashionOrderCreateResponse.Result.Success)
                        {
                            string sql = "update SPTHD set is_move='1' where djbh='" + dataRow["DJBH"].ToString() + "'";
                            BusinessDbUtil.ExecuteNonQuery(sql);
                            LogUtil.WriteInfo(this, retailIfashionOrderCreateResponse.Body, "中台商品退货单单据上传成功:DJBH" + dataRow["DJBH"].ToString());
                            if (Convert.ToInt64(dataRow["LastChanged"]) > list[0])
                            {
                                this.UpdateStatusPostDate(dataRow["LastChanged"].ToString());
                                list[0] = Convert.ToInt64(dataRow["LastChanged"]);
                            }
                        }
                        else
                        {
                            LogUtil.WriteInfo(this, retailIfashionOrderCreateResponse.Body, string.Format("返回的状态:flag:{0},code:{1},message:{2}", retailIfashionOrderCreateResponse.Body, retailIfashionOrderCreateResponse.Body, retailIfashionOrderCreateResponse.Body));
                        }
                    }
                    catch (Exception ex)
                    {
                        LogUtil.WriteError(this, ex.Message, ex.Message);
                    }
                    #endregion
                }
                catch (System.Exception ex)
                {
                    LogUtil.WriteError(this, "其他错误", ex.Message);
                }
            }
        }