Пример #1
0
        public MApiModel.recApi24.Rootobject AccessApi24(MApiModel.api24.Rootobject api7)
        {
            string strParam = Helper.getProperties <MApiModel.api24.Rootobject>(api7);
            string result   = Helper.PostData(strParam);

            hn.Common.LogHelper.WriteLog(result);
            return(JsonHelper.ToObject <MApiModel.recApi24.Rootobject>(result));
        }
        public void test()
        {
            Dictionary <int, string> dicEntryID_THDBMDetail = new Dictionary <int, string>();

            try
            {
                MApiModel.api24.Rootobject api24 = new MApiModel.api24.Rootobject();
                api24.action = "getMN_cp_24";
                api24.token  = "";

                DateTime theTime = DateTime.Now.AddDays(-1);
                string   rq1     = theTime.Year + "/" + (theTime.Month < 10 ? "0" + theTime.Month.ToStr() : theTime.Month.ToStr()) + "/" + (theTime.Day < 10 ? "0" + theTime.Day.ToStr() : theTime.Day.ToStr());

                api24.rq1       = rq1;
                api24.rq2       = rq1;
                api24.pageIndex = 1;
                api24.pageSize  = 200;
                api24.pzhm      = "201958944";

                MApiModel.recApi24.Rootobject r24 = new MApiModel.recApi24.Rootobject();
                r24 = _service.Remote_Get24(api24);

                Regex reg = new Regex("(\\d+)");

                foreach (var subb in r24.resultInfo)
                {
                    if (!string.IsNullOrEmpty(subb.khhm1) && reg.IsMatch(subb.khhm1))
                    {
                        int iEndtry = int.Parse(reg.Match(subb.khhm1).Groups[1].Value);
                        if (dicEntryID_THDBMDetail.ContainsKey(iEndtry))
                        {
                            dicEntryID_THDBMDetail.Add(iEndtry, subb.autoid);
                        }
                    }
                }
            }
            catch (Exception ee)
            { Console.WriteLine(ee.Message); }
        }
        public MApiModel.recApi24.Rootobject Remote_Get24(
            MApiModel.api24.Rootobject getapi24)
        {
            MApiAccess.AccessApi Mapi = new MApiAccess.AccessApi();

            if (Global.g_token == null || Global.g_token.tokenInfo == null || string.IsNullOrEmpty(Global.g_token.tokenInfo.endDate) || DateTime.Parse(Global.g_token.tokenInfo.endDate) < DateTime.Now)
            {
                MApiModel.api1.Rootobject tempToken = new MApiModel.api1.Rootobject();
                tempToken.comid   = 100;
                tempToken.action  = "getToken";
                tempToken.khhm    = "300384";
                tempToken.openkey = hn.Common.StringHelper.MD5string("10011630");
                Global.g_token    = Mapi.AccessApi1(tempToken);
            }

            // getapi24.comid = "100";
            getapi24.action = "getMN_cp_24";
            getapi24.token  = Global.g_token.token;

            MApiModel.recApi24.Rootobject rec = Mapi.AccessApi24(getapi24);

            return(rec);
        }
        string optType = "0";//
        private void backgroundWorker2_DoWork(object sender, DoWorkEventArgs e)
        {
            tuMessage = "";


            switch (optType)
            {
            case "0":
                try
                {
                    listSearch = _service.GetOrderList(
                        Global.LoginUser,
                        "", query.brand, int.Parse((query.t_status == null ? "0" : query.t_status)), "", query.P_BillNo,
                        query.startTime.ToString(),
                        query.endTime.ToStr(),
                        !query.bClose);
                }
                catch (Exception ee)
                {
                    tuMessage = ee.ToString();
                }
                break;

            case "1":    //shenhe
                try
                {
                    foreach (var sub111 in fid_sh)
                    {
                        var listEntry = _service.GetOrderEntryList(sub111, null);
                        List <ICPOBILLENTRYMODEL> listICPO = new List <ICPOBILLENTRYMODEL>();
                        foreach (var sub in listEntry)
                        {
                            ICPOBILLENTRYMODEL t = new ICPOBILLENTRYMODEL();
                            t.FENTRYID    = sub.FENTRYID;
                            t.FICPOBILLID = sub.FICPOBILLID;
                            t.FID         = sub.FID;

                            listICPO.Add(t);
                        }

                        if (_service.AuditSave_ICPO(listICPO.ToArray(), Global.LoginUser, ""))
                        {
                            // MsgHelper.ShowInformation("审核成功!");
                            try
                            {
                                listSearch = _service.GetOrderList(
                                    Global.LoginUser,
                                    "", query.brand, int.Parse((query.t_status == null ? "0" : query.t_status)), "", query.P_BillNo,
                                    query.startTime.ToString(),
                                    query.endTime.ToStr(),
                                    !query.bClose);
                            }
                            catch (Exception ee)
                            {
                                tuMessage = ee.ToString();
                            }
                        }
                        else
                        {
                            //MsgHelper.ShowInformation("审核失败!");
                        }
                    }
                }
                catch (Exception ee)
                {
                    tuMessage = ee.ToStr();
                }
                break;

            case "2":
                try
                {
                    foreach (var sub11 in fid_fs)
                    {
                        var listEntry1 = _service.GetOrderEntryList(sub11, null);
                        List <ICPOBILLENTRYMODEL> listICPO1 = new List <ICPOBILLENTRYMODEL>();
                        foreach (var sub in listEntry1)
                        {
                            ICPOBILLENTRYMODEL t = new ICPOBILLENTRYMODEL();
                            t.FENTRYID    = sub.FENTRYID;
                            t.FICPOBILLID = sub.FICPOBILLID;
                            t.FID         = sub.FID;
                            listICPO1.Add(t);
                        }

                        if (_service.UnAuditSave_ICPO(listICPO1.ToArray(), Global.LoginUser, ""))
                        {
                            //  MsgHelper.ShowInformation("反审成功!");
                            try
                            {
                                listSearch = _service.GetOrderList(
                                    Global.LoginUser,
                                    "", query.brand, int.Parse((query.t_status == null ? "0" : query.t_status)), "", query.P_BillNo,
                                    query.startTime.ToString(),
                                    query.endTime.ToStr(),
                                    !query.bClose);
                            }
                            catch (Exception ee)
                            {
                                tuMessage = ee.ToString();
                            }
                        }
                        else
                        {
                            MsgHelper.ShowInformation("反审失败!");
                        }
                    }
                }
                catch (Exception ee)
                {
                    tuMessage = ee.ToStr();
                }
                break;

            case "3":
                try
                {
                    ApiService.APIServiceClient mapi = new ApiService.APIServiceClient();
                    foreach (var sub22 in fid_tb)
                    {
                        string s = mapi.Remote_InsertICPOEntry(sub22.Value);

                        if (!s.Contains("error"))
                        {
                            Dictionary <int, string> dicEntryID_THDBMDetail = new Dictionary <int, string>();
                            try
                            {
                                MApiModel.api24.Rootobject api24 = new MApiModel.api24.Rootobject();
                                api24.action = "getMN_cp_24";
                                api24.token  = "";

                                DateTime theTime = DateTime.Now;
                                string   rq1     = theTime.Year + "/" + (theTime.Month < 10 ? "0" + theTime.Month.ToStr() : theTime.Month.ToStr()) + "/" + (theTime.Day < 10 ? "0" + theTime.Day.ToStr() : theTime.Day.ToStr());

                                api24.rq1       = rq1;
                                api24.rq2       = rq1;
                                api24.pageIndex = 1;
                                api24.pageSize  = 200;
                                api24.pzhm      = s;

                                MApiModel.recApi24.Rootobject r24 = new MApiModel.recApi24.Rootobject();
                                r24 = _service.Remote_Get24(api24);

                                Regex reg = new Regex("(\\d+)");

                                foreach (var subb in r24.resultInfo)
                                {
                                    if (!string.IsNullOrEmpty(subb.khhm1) && reg.IsMatch(subb.khhm1))
                                    {
                                        int iEndtry = int.Parse(reg.Match(subb.khhm1).Groups[1].Value);
                                        if (dicEntryID_THDBMDetail.ContainsKey(iEndtry))
                                        {
                                            dicEntryID_THDBMDetail.Add(iEndtry, subb.autoid);
                                        }
                                    }
                                }
                            }
                            catch (Exception ee)
                            {
                                Console.WriteLine(ee.Message);
                            }


                            _service.Update_FSYN_Remote_Status(sub22.Key, 4, s, dicEntryID_THDBMDetail);

                            MsgHelper.ShowInformation("同步完毕!");
                            try
                            {
                                listSearch = _service.GetOrderList(
                                    Global.LoginUser,
                                    "", query.brand, int.Parse((query.t_status == null ? "0" : query.t_status)), "", query.P_BillNo,
                                    query.startTime.ToString(),
                                    query.endTime.ToStr(),
                                    !query.bClose);
                            }
                            catch (Exception ee)
                            {
                                tuMessage = ee.ToString();
                            }
                        }
                        else
                        {
                            MsgHelper.ShowError(s);
                        }
                    }
                }
                catch (Exception ee)
                {
                    tuMessage = ee.ToStr();
                }

                break;

            case "4":
                var listEntry5 = _service.GetOrderEntryList(fid_close, null);
                List <ICPOBILLENTRYMODEL> listICPO5 = new List <ICPOBILLENTRYMODEL>();
                foreach (var sub in listEntry5)
                {
                    ICPOBILLENTRYMODEL t = new ICPOBILLENTRYMODEL();
                    t.FENTRYID    = sub.FENTRYID;
                    t.FICPOBILLID = sub.FICPOBILLID;
                    t.FID         = sub.FID;
                    listICPO5.Add(t);
                }

                if (_service.CloseSave_ICPO(listICPO5.ToArray(), Global.LoginUser, ""))
                {
                    MsgHelper.ShowInformation("关闭成功!");
                    try
                    {
                        listSearch = _service.GetOrderList(
                            Global.LoginUser,
                            "", query.brand, int.Parse((query.t_status == null ? "0" : query.t_status)), "", query.P_BillNo,
                            query.startTime.ToString(),
                            query.endTime.ToStr(),
                            !query.bClose);
                    }
                    catch (Exception ee)
                    {
                        tuMessage = ee.ToString();
                    }
                }
                else
                {
                    MsgHelper.ShowInformation("关闭失败!");
                }

                break;

            case "5":
                if (_service.Delete_ICPO(fid_delete))
                {
                    MsgHelper.ShowInformation("删除成功!");
                    try
                    {
                        listSearch = _service.GetOrderList(
                            Global.LoginUser,
                            "", query.brand, int.Parse((query.t_status == null ? "0" : query.t_status)), "", query.P_BillNo,
                            query.startTime.ToString(),
                            query.endTime.ToStr(),
                            !query.bClose);
                    }
                    catch (Exception ee)
                    {
                        tuMessage = ee.ToString();
                    }
                }
                else
                {
                    MsgHelper.ShowInformation("删除失败!");
                }
                break;

            case "6":
                try
                {
                    listDetail = _service.GetOrderEntryList(fid_detail, null);
                }
                catch (Exception ee)
                {
                    tuMessage = ee.ToString();
                }
                break;
            }
        }
Пример #5
0
 public MApiModel.recApi24.Rootobject Remote_Get24(MApiModel.api24.Rootobject getapi24)
 {
     return(base.Channel.Remote_Get24(getapi24));
 }