예제 #1
0
        private DataTable getDGSupplier()
        {
            DataTable dt      = new DataTable();
            DateTime  newDate = new DateTime();

            try
            {
                String tgbSearchText = "";
                if (!String.IsNullOrWhiteSpace(tgbSearch.Text))
                {
                    tgbSearchText = tgbSearch.Text;
                }
                JObject result = ApiClientService.query("DOC_SUPPLIER_DG", newDate.ToString("yyyy/MM/dd HH:mm:ss"), tgbSearchText);
                if ("success".Equals(result.Value <String>("result")))
                {
                    JArray ja    = result.Value <JArray>("data");
                    String serJa = JsonConvert.SerializeObject(ja);
                    dt = JsonConvert.DeserializeObject <DataTable>(serJa);
                    hfdGridSupplier.Text = serJa;
                }
                else
                {
                    String    reason = result.Value <String>("reason");
                    Exception ex     = new Exception(reason);
                    throw ex;
                }
            }
            catch (Exception ex)
            {
                Alert.Show(ex.Message, "获取供应商信息时报错", MessageBoxIcon.Error);
            }
            return(dt);
        }
예제 #2
0
        private DataTable getDGSupplier1()
        {
            DataTable dt = new DataTable();

            try
            {
                //String[] paramSup = new String[7] { tbxSEQNO.Text, lstLICENSEID.Text, llstFLAG.SelectedValue, lstLICENSETYPE.SelectedValue, "", lstLRRQ1.SelectedDate.ToString(), lstLRRQ2.SelectedDate.ToString() };
                //String[] paramSup1 = new String[2] { docSearch.Text, docFLAG.SelectedValue };
                JObject result = ApiClientService.query("SUP_LICENSE_SUPD", docSearch.Text);
                if ("success".Equals(result.Value <String>("result")))
                {
                    JArray ja    = result.Value <JArray>("data");
                    String serJa = JsonConvert.SerializeObject(ja);
                    dt = JsonConvert.DeserializeObject <DataTable>(serJa);
                }
                else
                {
                    String    reason = result.Value <String>("reason");
                    Exception ex     = new Exception(reason);
                    throw ex;
                }
            }
            catch (Exception ex)
            {
                Alert.Show(ex.Message, "获取供应商信息时报错", MessageBoxIcon.Error);
            }
            return(dt);
        }
예제 #3
0
        private DataTable gridPic_path1(string lsno)
        {
            DataTable picpathDT = new DataTable();

            try
            {
                String[] paramSup1 = new String[1] {
                    lsno
                };
                JObject result = ApiClientService.query("LICENSE_TPICTURE", paramSup1);
                if ("success".Equals(result.Value <String>("result")))
                {
                    JArray ja    = result.Value <JArray>("data");
                    String serJa = JsonConvert.SerializeObject(ja);
                    picpathDT = JsonConvert.DeserializeObject <DataTable>(serJa);
                }
                else
                {
                    String    reason = result.Value <String>("reason");
                    Exception ex     = new Exception(reason);
                    throw ex;
                }
            }
            catch (Exception ex)
            {
                Alert.Show(ex.Message, "获取图片路径时报错", MessageBoxIcon.Error);
            }
            return(picpathDT);
        }
        private static async Task <TResult?> GetAsync <TResult>(ApiClientService apiClient, string uri)
        {
            var response = await apiClient.GetAsync <TResult>(uri);

            if (!response.IsSuccess)
            {
                ApiResponseHelper.HandleNotSuccessApiResponse(response);
                return(default);
예제 #5
0
        private void InitializeApiClientService()
        {
            var apiApp = new Api.App();

            _apiClientService            = apiApp.GetApiClientService();
            apiApp.ShouldReuseRestClient = true;

            SetCertificates();
        }
예제 #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //if (!IsPostBack)
            //{
            //    String picPath = Request["picPath"];
            //    if (!string.IsNullOrWhiteSpace(picPath))
            //    {
            //        String[] paramSup = new String[1] { picPath };
            //        byte[] img = ApiClientService.getUploadgoodsPic("getGoodsPicUpload", paramSup);
            //        Response.Clear();
            //        Response.ContentType = "application/binary;";
            //        Response.BinaryWrite(img);
            //        Response.Flush();
            //        Response.End();
            //    }
            //}

            String picPath = Request["picPath"];

            if (!string.IsNullOrWhiteSpace(picPath))
            {
                String[] paramSup = new String[1] {
                    picPath
                };
                DbHelperOra.ExecuteSql("INSERT INTO A_TEST(ROWNO,BEGIN,MEMO) SELECT 1,SYSDATE,'" + picPath + "' FROM DUAL");
                byte[] b_logoImg = ApiClientService.getUploadgoodsPic("getGoodsPicUpload", paramSup);
                DbHelperOra.ExecuteSql("INSERT INTO A_TEST(ROWNO,BEGIN,MEMO) SELECT 2,SYSDATE,'" + picPath + "' FROM DUAL");
                if (b_logoImg == null)
                {
                    for (int i = 0; i < 10; i++)
                    {
                        DbHelperOra.ExecuteSql("INSERT INTO A_TEST(ROWNO,BEGIN,MEMO) SELECT " + 3 + i + ",SYSDATE,'" + picPath + "' FROM DUAL");
                        b_logoImg = ApiClientService.getUploadgoodsPic("getGoodsPicUpload", paramSup);
                        DbHelperOra.ExecuteSql("INSERT INTO A_TEST(ROWNO,BEGIN,MEMO) SELECT " + 4 + i + ",SYSDATE,'" + picPath + "' FROM DUAL");
                        if (b_logoImg != null)
                        {
                            break;
                        }
                    }
                }
                if (b_logoImg != null)
                {
                    if (b_logoImg.Length > 0)
                    {
                        MemoryStream ms = new MemoryStream(b_logoImg);
                        Response.Clear();
                        Response.ContentType = "image/gif";
                        Response.OutputStream.Write(b_logoImg, 0, b_logoImg.Length);
                        Response.End();
                    }
                }
            }
        }
예제 #7
0
파일: ImageHelper.cs 프로젝트: cjllove/ERP
        /// <summary>
        /// 得到图片KEY
        /// </summary>
        /// <param name="gdseqs">商品编码“;”隔开</param>
        /// <param name="isList">是否是列表页面,默认true,true时有缓存(15分钟)</param>
        /// <param name="isSmall">是否缩略图,默认true</param>
        /// <returns></returns>
        public static List <String> GetImgs(String[] gdseqs, bool isList = true, bool isSmall = true)
        {
            String [] para = new String[gdseqs.Length + 1];
            if (isSmall)
            {
                para[0] = "Y";
            }
            else
            {
                para[0] = "N";
            }
            List <String> keys       = new List <string>();
            int           countToGet = 0;

            for (int i = 0; i < gdseqs.Length; i++)
            {
                para[i + 1] = gdseqs[i];
                String key = "img_" + gdseqs[i];
                keys.Add(key);
                if (!isList)
                {
                    key = "img_" + getGUID();
                }
                if (!ApiUtil.isCacheExist(key) && key != "img_")
                {
                    countToGet++;
                }
            }

            //如果有图片在本次缓存里没有,就调webservice 待优化
            if (countToGet > 0)
            {
                byte[][] lb = ApiClientService.getGoodsPics("DOC_GOODSPICTURE", para);
                int      j  = 0;
                foreach (byte[] b in lb)
                {
                    String key = keys[j];
                    if (!ApiUtil.isCacheExist(key) && key != "img_")
                    {
                        try
                        {
                            XTBase.Utilities.CacheHelper.SetCache(key, b, TimeSpan.FromMinutes(15));
                        }
                        catch { }
                    }
                    j++;
                }
            }

            return(keys);
        }
예제 #8
0
        private async void LoginExecute(object obj)
        {
            if (SelectedUser != null)
            {
                DataContext.Instance.Iam.Nickname = SelectedUser.Nickname;
                DataContext.Instance.Iam.UserGuid = SelectedUser.UserGuid;
            }
            else
            {
                ApiClientService apiClientService = new ApiClientService();
                await apiClientService.RegisterMe(UserName);
            }

            CloseAction();
        }
예제 #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            String seqno = Request["seqno"];
            String rowno = Request["rowno"];

            if (!string.IsNullOrWhiteSpace(seqno) && !string.IsNullOrWhiteSpace(rowno))
            {
                String[] paramSup = new String[2] {
                    seqno, rowno
                };
                byte[] img = ApiClientService.getUploadPic("SUP_LICENSE_PICTURE", paramSup);
                Response.ContentType = "application/binary;";
                Response.BinaryWrite(img);
                Response.Flush();
                Response.End();
            }
        }
예제 #10
0
        public async void Connect()
        {
            await chatHubService.ConnectAsync();

            if (chatHubService.Connection.State == Microsoft.AspNet.SignalR.Client.ConnectionState.Connected)
            {
                ApiClientService apiClientService = new ApiClientService();
                await apiClientService.PostMe();

                Conversations = new ObservableCollection <Conversation>(DataContext.Instance.Conversations);
                OnPropertyChanged(nameof(Conversations));
            }
            else
            {
                MessageBox.Show("Es konnte keine Verbindung zum ChatHub aufgebaut werden.");
            }
        }
예제 #11
0
        private async Task CallKeywordSearch()
        {
            var settings = ApiClientSettings.CreateFromConfigFile();

            _log.DebugFormat(settings.ToString());
            Console.WriteLine(settings.ToString());
            try
            {
                if (settings.ExpirationDateTime < DateTime.Now)
                {
                    // Let's refresh the token
                    var oAuth2Service     = new OAuth2Service(settings);
                    var oAuth2AccessToken = await oAuth2Service.RefreshTokenAsync();

                    if (oAuth2AccessToken.IsError)
                    {
                        // Current Refresh token is invalid or expired
                        _log.DebugFormat("Current Refresh token is invalid or expired ");
                        Console.WriteLine("Current Refresh token is invalid or expired ");
                        return;
                    }

                    settings.UpdateAndSave(oAuth2AccessToken);

                    _log.DebugFormat("After call to refresh");
                    _log.DebugFormat(settings.ToString());

                    Console.WriteLine("After call to refresh");
                    Console.WriteLine(settings.ToString());
                }

                var client   = new ApiClientService(settings);
                var response = await client.KeywordSearch("P5555-ND");

                // In order to pretty print the json object we need to do the following
                var jsonFormatted = JToken.Parse(response).ToString(Formatting.Indented);

                Console.WriteLine($"Reponse is {jsonFormatted} ");
            }
            catch (System.Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }
예제 #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //String gdseq = Request["gdseq"];
            //String rowno = Request["rowno"];
            String picpath = Request["picpath"];

            if (!string.IsNullOrWhiteSpace(picpath))
            {
                String[] paramSup = new String[1] {
                    picpath
                };
                byte[] img = ApiClientService.getUploadgoodsPic("DOC_GOODSPICTURE", paramSup);
                Response.ContentType = "application/binary;";
                Response.BinaryWrite(img);
                Response.Flush();
                Response.End();
            }
        }
예제 #13
0
        private void SearchTwo()
        {
            //从数据平台取得数据
            DataTable dt = new DataTable();

            try
            {
                JObject result = ApiClientService.query("DOC_GOODS_All", (GridGoods.PageIndex * GridGoods.PageSize).ToString(), ((GridGoods.PageIndex + 1) * GridGoods.PageSize).ToString(), ddlGoodsState.SelectedValue.Trim(), trbSearch.Text.Trim());
                if ("success".Equals(result.Value <String>("result")))
                {
                    String serJa = JsonConvert.SerializeObject(result.Value <JArray>("data"));
                    dt = JsonConvert.DeserializeObject <DataTable>(serJa);
                    GridGoods.RecordCount = Convert.ToInt32((dt.Rows[0]["TOTAL"] ?? "0"));
                    GridGoods.DataSource  = dt;
                    GridGoods.DataBind();
                }
                else
                {
                    String    reason = result.Value <String>("reason");
                    Exception ex     = new Exception(reason);
                    throw ex;
                }
            }
            catch (Exception ex)
            {
                Alert.Show(ex.Message + ex.StackTrace, "获取商品信息时超时,请重新再试!", MessageBoxIcon.Error);
            }
            //            string Stearch = "";
            //            if (!PubFunc.StrIsEmpty(trbSearch.Text))
            //            {
            //                Stearch += string.Format(" AND (A.GDSEQ LIKE '%{0}%' OR A.GDNAME LIKE '%{0}%' OR A.BAR3 LIKE '%{0}%')", trbSearch.Text);
            //            }
            //            Stearch += " ORDER BY GDSEQ";
            //            int total = 0;
            //            string mysql = @"SELECT A.*,DECODE(A.FLAG,'Y','正常','未下传') FLAGNAME,C.NAME UNITNAME,B.name PRODUCERNAME
            //                    FROM DOC_GOODS A,DOC_PRODUCER B,DOC_GOODSUNIT C
            //                    WHERE A.UNIT = C.CODE(+) AND A.PRODUCER = B.code(+) ";
            //            DataTable dtData = PubFunc.DbGetPage(GridGoods.PageIndex, GridGoods.PageSize, mysql + Stearch, ref total);
            //            GridGoods.RecordCount = total;
            //            GridGoods.DataSource = dtData;
            //            GridGoods.DataBind();
        }
예제 #14
0
        private void downloadInventory()
        {
            String warehouse = ApiUtil.GetConfigCont("QUERYINVENTORY_WAREHOUSE");

            try
            {
                //先查询EAS库存的行数
                JObject joCli    = ApiClientService.queryInventoryByPage(warehouse, 0, 1);
                int     countRow = 0;
                if ("success".Equals(joCli.Value <String>("result")))
                {
                    try
                    {
                        countRow = Convert.ToInt32(joCli.Value <String>("data"));
                    }
                    catch
                    { }
                }
                //清除库存临时表
                DbHelperOra.ExecuteSql("delete from EAS_STOCK_COMPARE ");

                int pageNum = 100;
                int sumPage = countRow % pageNum > 0 ? countRow / pageNum + 1 : countRow / pageNum;
                for (int i = 1; i <= sumPage; i++)
                {
                    joCli = ApiClientService.queryInventoryByPage(warehouse, pageNum, i);
                    JObject jo = new JObject();
                    if ("success".Equals(joCli.Value <String>("result")))
                    {
                        foreach (JToken jt in joCli.Value <JArray>("data"))
                        {
                            insertInventory(jt);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Alert.Show("下载EAS库存失败!");
            }
        }
        /// <summary>
        /// Load dictionary (key=albumId,value=photos).
        /// </summary>
        /// <param name="apiClient"></param>
        /// <param name="albums">Albums for which photos will be uploaded.</param>
        /// <returns>Loaded album photos.</returns>
        public static async Task <IDictionary <int, IEnumerable <Photo> > > GetPhotosForPreviewByAlmubsAsync(
            this ApiClientService apiClient,
            IEnumerable <Album> albums)
        {
            var result = new Dictionary <int, IEnumerable <Photo> >();

            var tasks = albums.Select(async album =>
            {
                var photos = await apiClient.GetPhotosByAlbumIdAsync(album.Id);

                if (photos is null)
                {
                    return;
                }

                result.Add(album.Id, photos.Take(6));
            });

            await Task.WhenAll(tasks);

            return(result);
        }
예제 #16
0
        protected void btnSearch2_Click(object sender, EventArgs e)
        {
            if (lstLRRQ11.SelectedDate == null || lstLRRQ22.SelectedDate == null)
            {
                Alert.Show("请输入条件【录入日期】!");
                return;
            }
            else if (lstLRRQ11.SelectedDate > lstLRRQ22.SelectedDate)
            {
                Alert.Show("开始日期大于结束日期,请重新输入!");
                return;
            }

            DateTime lrrq1Value = (DateTime)lstLRRQ11.SelectedDate;
            DateTime lrrq2Value = (DateTime)lstLRRQ22.SelectedDate;

            string custId = DbHelperOra.GetSingle("select value from sys_para where code='USERCODE'").ToString();
            string dno    = txtBillNo2.Text.Trim();

            string strBeginDate = lrrq1Value.ToString("yyyy-MM-dd");
            string strEndDate   = lrrq2Value.ToString("yyyy-MM-dd");

            String[] paramArray = { strBeginDate, strEndDate, dno, custId };

            //查询eas上调拨入库单
            string result = ApiClientService.QueryEASBill("DRK", paramArray);

            if (String.IsNullOrWhiteSpace(result) || "-1".Equals(result))
            {
                Alert.Show("与数据中心通讯失败,请稍后再试!", "消息提示", MessageBoxIcon.Warning);
                return;
            }

            string strBillNos = "";
            JArray jaResult   = JArray.Parse(result);//多单据数组

            foreach (JToken jt in jaResult)
            {
                JObject jResult = (JObject)jt;//单单据对象
                if ("success".Equals(jResult.Value <String>("result")))
                {
                    JArray ja = jResult.Value <JArray>("data");
                    if (ja.Count > 0)
                    {
                        strBillNos = strBillNos +   "'" + saveRKDocCom(ja) + "',";//把下传的单据保存到用于比较的临时表DAT_RK_DOC_COMPARE,DAT_RK_COM_COMPARE
                    }
                }
            }
            if (!String.IsNullOrWhiteSpace(strBillNos))
            {
                strBillNos = strBillNos.TrimEnd(',');
                string strSql = @"SELECT SEQNO,DDBH,NULL DHRQ,DHRQ DHRQ_EAS,NULL SUBNUM,SUBNUM SUBNUM_EAS,NULL SUBSUM,SUBSUM SUBSUM_EAS,(select VALUE from sys_para where code='USERCODE') CUSTID
                                from DAT_RK_DOC_COMPARE  where BILLNO IN (" + strBillNos + ") order by seqno";
                GridList2.DataSource = DbHelperOra.Query(strSql).Tables[0];
            }
            else
            {
                Alert.Show("没有查询到订单!", "消息提示", MessageBoxIcon.Warning);
                return;
            }

            GridList2.DataBind();
            GridDetail2.DataSource = null;
            GridDetail2.DataBind();
        }
예제 #17
0
 // 3. This is one of the ways you can use TestsArrange and TestsAct.
 // You can find create all elements in the TestsArrange and create all necessary data for the tests.
 // Then in the TestsAct execute the actual tests logic but without asserting anything.
 // Then in each separate test execute single assert or Validate method. Following the best testing practices- having a single assertion in a test.
 // If you execute multiple assertions and if one of them fails, the next ones are not executed which may lead to missing some major clue about
 // a bug in your product. Anyhow, BELLATRIX allows you to write your tests the standard way of executing the primary logic in the tests or reuse
 // some of it through the usage of TestInit and TestCleanup methods.
 public override void TestsArrange()
 {
     _apiClientService = App.GetApiClientService();
     _getRequest       = new RestRequest("api/Genres/11");
     _putRequest       = new RestRequest("api/Genres/11");
 }
예제 #18
0
 public App()
 {
     _apiClientService = GetNewApiClientService();
 }
예제 #19
0
 public TestScenarioExecutor(List <LoadTestAssertionHandler> loadTestAssertionHandlers, ApiClientService apiClientService)
 {
     _loadTestAssertionHandlers = loadTestAssertionHandlers;
     _apiClientService          = apiClientService;
     _scenarioCookies           = new Dictionary <string, string>();
 }
 /// <summary>
 /// Load <see cref="Album"/> by path '/albums/{id}'.
 /// </summary>
 /// <param name="apiClient"></param>
 /// <param name="id">Album id.</param>
 /// <returns>Loaded album.</returns>
 public static Task <Album?> GetAlbumByIdAsync(
     this ApiClientService apiClient,
     int id)
 {
     return(GetAsync <Album>(apiClient, $"/albums/{id}"));
 }
 /// <summary>
 /// Load <see cref="IEnumerable{Album}"/> by path '/albums'.
 /// </summary>
 /// <param name="apiClient"></param>
 /// <returns>Loaded albums.</returns>
 public static Task <IEnumerable <Album>?> GetAlbumsAsync(this ApiClientService apiClient)
 {
     return(GetAsync <IEnumerable <Album> >(apiClient, "/albums"));
 }
예제 #22
0
        public async Task <string> Get([FromQuery] string partId, [FromQuery] string quantity, [FromQuery] string currency)
        {
            // string apiToken = "41c44903-fdc0-417c-abb9-6c79bbad03f1";
            //partId =string.IsNullOrEmpty(partId)? "GRM21BR71C225KA12L" : partId;
            // string mouserUrl = "https://api.mouser.com/api/v1/search/partnumber";
            // MouserRoot restResponse = new MouserRoot();
            // HttpClient client = new HttpClient();
            // Models.ValueRow pResponse = new Models.ValueRow();
            //// client.DefaultRequestHeaders.Add("Content-Type", "application/json");
            // try
            // {
            //     pResponse.PartNumber = partId;
            //     pResponse.Quantity =Convert.ToInt32( string.IsNullOrEmpty(quantity) ? "1" : quantity);
            //     Models.Rootobject bodyParam = new Models.Rootobject() { SearchByPartRequest = new Models.Searchbypartrequest() { mouserPartNumber = partId } };
            //     string json = JsonConvert.SerializeObject(bodyParam);
            //     mouserUrl += "?apiKey=";
            //     mouserUrl += apiToken;
            //     HttpRequestMessage mouserRequest = new HttpRequestMessage()
            //     {
            //         Method = HttpMethod.Post,
            //         RequestUri = new Uri(mouserUrl),
            //         Content = new StringContent(json, Encoding.UTF8, "application/json")

            //     };

            //     HttpResponseMessage response = await client.SendAsync(mouserRequest).ConfigureAwait(false);
            //     response.EnsureSuccessStatusCode();
            //     string responseBody = await response.Content.ReadAsStringAsync();

            //     restResponse = JsonConvert.DeserializeObject<MouserRoot>(responseBody);
            //     if (restResponse.SearchResults.Parts.Count() > 0)
            //     {

            //         pResponse.Manufacturer = restResponse.SearchResults.Parts[0].Manufacturer;
            //         pResponse.Mouser = new Models.Mouser() { LeadTime = restResponse.SearchResults.Parts[0].LeadTime, AvailableQuantity = restResponse.SearchResults.Parts[0].Availability ,PriceBreakups = new List<Models.PriceBreakUp>()};
            //         if (restResponse.SearchResults.Parts[0].PriceBreaks.Count() > 0)
            //         {
            //             for (int i = 0; i < restResponse.SearchResults.Parts[0].PriceBreaks.Count(); i++)
            //             {
            //                 pResponse.Mouser.PriceBreakups.Add(new Models.PriceBreakUp() { Price = restResponse.SearchResults.Parts[0].PriceBreaks[i].Price, Quantity = restResponse.SearchResults.Parts[0].PriceBreaks[i].Quantity.ToString() });
            //             }
            //         }
            //     }
            // }
            // catch (HttpRequestException e)
            // {
            //     throw;
            // }

            // return pResponse;



            var    settings      = ApiClientSettings.CreateFromConfigFile();
            string jsonFormatted = "";

            try
            {
                if (settings.ExpirationDateTime < DateTime.Now)
                {
                    // Let's refresh the token
                    var oAuth2Service     = new OAuth2Service(settings);
                    var oAuth2AccessToken = oAuth2Service.RefreshTokenAsync().Result;
                    if (oAuth2AccessToken.IsError)
                    {
                        // Current Refresh token is invalid or expired

                        return(null);
                    }

                    settings.UpdateAndSave(oAuth2AccessToken);


                    Console.WriteLine("After call to refresh");
                    Console.WriteLine(settings.ToString());
                }

                var client   = new ApiClientService(settings);
                var response = client.KeywordSearch("LM2904M").Result;

                // In order to pretty print the json object we need to do the following
                jsonFormatted = JToken.Parse(response).ToString(Formatting.Indented);
            }
            catch (System.Exception e)
            {
                Console.WriteLine(e);
                throw;
            }

            return(jsonFormatted);
        }
 public HomeController(ApiClientService apiClientService)
 {
     ApiClientService = apiClientService;
 }
 /// <summary>
 /// Load <see cref="IEnumerable{Photo}"/> by path '/albums/{id}/photos'.
 /// </summary>
 /// <param name="apiClient"></param>
 /// <param name="albumId">Album id.</param>
 /// <returns>Loaded photos.</returns>
 public static Task <IEnumerable <Photo>?> GetPhotosByAlbumIdAsync(
     this ApiClientService apiClient,
     int albumId)
 {
     return(GetAsync <IEnumerable <Photo> >(apiClient, $"/albums/{albumId}/photos"));
 }
예제 #25
0
 public override void TestInit()
 {
     _fixture          = FixtureFactory.Create();
     _apiClientService = App.GetApiClientService();
 }
예제 #26
0
 public override void TestInit()
 {
     _apiClientService = App.GetApiClientService();
 }
예제 #27
0
        protected void btnCompare_Click(object sender, EventArgs e)
        {
            string custId = DbHelperOra.GetSingle("select value from sys_para where code='USERCODE'").ToString();
            string dno    = "";

            if (ViewState["dhd_billno"] != null && !"".Equals(ViewState["dhd_billno"].ToString()))
            {
                dno = ViewState["dhd_billno"].ToString();
            }
            string strBeginDate = "";

            if (ViewState["beginDate1"] != null && !"".Equals(ViewState["beginDate1"].ToString()))
            {
                strBeginDate = ViewState["beginDate1"].ToString();
            }
            string strEndDate = "";

            if (ViewState["endDate1"] != null && !"".Equals(ViewState["endDate1"].ToString()))
            {
                strEndDate = ViewState["endDate1"].ToString();
            }
            String[] paramArray = { strBeginDate, strEndDate, dno, custId };
            //组合要查询的单据号
            string strDDBHs = "";

            if (GridList.Rows.Count > 0)
            {
                for (int i = 0; i < GridList.Rows.Count; i++)
                {
                    if (i == GridList.Rows.Count - 1)
                    {
                        strDDBHs = strDDBHs + "'" + GridList.Rows[i].Values[1].ToString() + "'";
                    }
                    else
                    {
                        strDDBHs = strDDBHs + "'" + GridList.Rows[i].Values[1].ToString() + "',";
                    }
                }
            }
            else
            {
                Alert.Show("没有查询到订单,请先查询订单!", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            //根据条件查询eas上调拨单
            string result = ApiClientService.QueryEASBill("DHD", paramArray);

            if (String.IsNullOrWhiteSpace(result) || "-1".Equals(result))
            {
                Alert.Show("与数据中心通讯失败,请稍后再试!", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            JArray jaResult = JArray.Parse(result);//多单据数组

            foreach (JToken jt in jaResult)
            {
                JObject jResult = (JObject)jt;//单单据对象
                if ("success".Equals(jResult.Value <String>("result")))
                {
                    JArray ja = jResult.Value <JArray>("data");
                    if (ja.Count > 0)
                    {
                        saveDDDocCom(ja);//把下传的单据保存到用于比较的临时表DAT_DD_DOC_COMPARE,DAT_DD_COM_COMPARE
                    }
                }
            }
            //关联DAT_DD_DOC表和DAT_DD_DOC_COMPARE表,重新绑定GridList
            #region
            string strSql = @"SELECT NULL MEMO,A.*,B.XDRQ XDRQ_EAS,B.SUBNUM SUBNUM_EAS,B.SUBSUM SUBSUM_EAS 
                              FROM (SELECT BILLNO,XDRQ,SUBNUM,SUBSUM,(select VALUE from sys_para where code='USERCODE') CUSTID,SHR,SHRQ 
                              FROM DAT_DD_DOC WHERE SEQNO in ({0})) A LEFT JOIN DAT_DD_DOC_COMPARE B
                              ON A.BILLNO=B.SEQNO ORDER BY A.BILLNO";
            strSql = string.Format(strSql, strDDBHs);
            DataTable dt            = DbHelperOra.Query(strSql).Tables[0];
            string    GreenRowsList = "";
            string    RedRowsList   = "";
            foreach (DataRow dr in dt.Rows)
            {
                Decimal SUBNUM = 0;
                try
                {
                    SUBNUM = Convert.ToDecimal(dr["SUBNUM"]);
                }
                catch
                {
                    SUBNUM = 0;
                }
                Decimal SUBNUM_EAS = 0;
                if (dr["SUBNUM_EAS"] != null && !"".Equals(dr["SUBNUM_EAS"].ToString()))
                {
                    try
                    {
                        SUBNUM_EAS = Convert.ToDecimal(dr["SUBNUM_EAS"]);
                    }
                    catch
                    {
                        SUBNUM_EAS = 0;
                    }
                }
                else
                {
                    dr["MEMO"] = "ERP有EAS没有";
                    continue;
                }

                if (SUBNUM == SUBNUM_EAS)
                {
                    dr["MEMO"]     = "完全匹配";
                    GreenRowsList += dt.Rows.IndexOf(dr).ToString() + ",";
                }
                else
                {
                    dr["MEMO"]   = "条目数不匹配";
                    RedRowsList += dt.Rows.IndexOf(dr).ToString() + ",";
                }
            }
            GridList.DataSource = dt;
            GridList.DataBind();
            PageContext.RegisterStartupScript("onGridDataLoad('" + RedRowsList + "','" + GreenRowsList + "','" + GridList.ClientID + "');");
            #endregion
        }
 /// <summary>
 /// Load <see cref="IEnumerable{User}"/> by path '/users'.
 /// </summary>
 /// <param name="apiClient"></param>
 /// <returns>Loaded users.</returns>
 public static Task <IEnumerable <User>?> GetUsersAsync(this ApiClientService apiClient)
 {
     return(GetAsync <IEnumerable <User> >(apiClient, "/users"));
 }