Ejemplo n.º 1
0
        /// <summary>
        /// 根据库中查询数据,更改ocr传来列表的状态过滤掉别的用户同步的数据
        /// </summary>
        /// <param name="list"></param>
        public static void ChangeStatus(List <OCRHddzEntity> list, string zbr)
        {
            HddzService serv = new HddzService();

            List <yw_hddzEntity> listID    = serv.GetOcrIDList();
            List <int>           delIndexs = new List <int>();
            int i = 0;

            foreach (var model in list)
            {
                yw_hddzEntity ocrID = listID.Find(p => p.OcrID == model.ocrmainid);

                if (ocrID != null)
                {
                    if (ocrID.zbr != zbr)
                    {
                        delIndexs.Add(i);
                    }
                    else
                    {
                        model.IsSync = true;
                        model.ywbh   = ocrID.ywbh;
                    }
                }
                i++;
            }

            foreach (int j in delIndexs)
            {
                list.RemoveAt(j);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 把ocr返回的xml数据 解析成对象
        /// </summary>
        /// <param name="xml"></param>
        private void OcrXmlToHddz(string xml, out yw_hddzEntity model, out List <yw_hddz_spxxEntity> list)
        {
            model = new yw_hddzEntity();
            list  = new List <yw_hddz_spxxEntity>();
            string      strError = "";
            XmlDocument doc      = new XmlDocument();

            doc.LoadXml(xml);
            XmlNodeList xnl = doc.GetElementsByTagName("yw_hddz");

            if (xnl.Count == 0)
            {
                throw new Exception("返回的xml中不包含yw_hddz");
            }
            XmlNode mainxn = xnl.Item(0);

            //string jsonText = JsonConvert.SerializeXmlNode(mainxn);
            //JObject obj = JsonConvert.DeserializeObject(jsonText) as JObject;
            //if (obj["yw_hddz"]["invoice_date"] != null)//发票日期格式判定
            //{
            //    string str = obj["yw_hddz"]["invoice_date"].ToString().Replace("\"", "");
            //    DateTime d = new DateTime();
            //    if (!DateTime.TryParse(str, out d))
            //    {
            //        throw new Exception("OCR返回的发票日期为" + str + "格式错误,日期格式为yyyy.MM.dd!");
            //    }
            //}

            // yw_hddzXmlData data = JsonConvert.DeserializeObject<yw_hddzXmlData>(jsonText);
            model = ModelTools.ConvertXmlToModel <yw_hddzEntity>(mainxn.OuterXml, out strError);
            if (!string.IsNullOrEmpty(strError))
            {
                throw new Exception("返回的xml主表yw_hddz解析错误!详细:" + strError);
            }
            XmlNodeList detailsxnl = mainxn.SelectNodes("details/yw_hddz_spxx");
            var         i          = 1;

            foreach (XmlNode spxn in detailsxnl)
            {
                //string jsonText1 = JsonConvert.SerializeXmlNode(spxn);
                yw_hddz_spxxEntity spitem = ModelTools.ConvertXmlToModel <yw_hddz_spxxEntity>(spxn.OuterXml, out strError);
                //yw_hddz_spxxXmlData data1 = JsonConvert.DeserializeObject<yw_hddz_spxxXmlData>(jsonText1);
                if (string.IsNullOrEmpty(strError))
                {
                    //spitem = data1.yw_hddz_spxx;
                    //spitem.ywbh = ywbh;
                    spitem.cxh  = i++;
                    spitem.sppp = spitem.sppp_yw;
                    spitem.sppz = spitem.sppz_yw;
                    spitem.spdj = spitem.spdj_yw;
                    spitem.spgg = spitem.spgg_yw;

                    list.Add(spitem);
                }
                else
                {
                    throw new Exception("返回的xml从表yw_hddz_spxx解析错误!详细:" + strError);
                }
            }
        }
Ejemplo n.º 3
0
 public void updateKgsjByCmHc(yw_hddzEntity hddz)
 {
     using (var conn = ConnectionFactory.CreateConnection())
     {
         if (conn.State == System.Data.ConnectionState.Closed)
         {
             conn.Open();
         }
         StringBuilder sql = new StringBuilder();
         sql.Append("update yw_hddz set ");
         if (hddz.yjkgsj != null)
         {
             sql.Append("yjkgsj=@yjkgsj");
         }
         else if (hddz.sjkgsj != null)
         {
             sql.Append("sjkgsj =@sjkgsj");
         }
         else
         {
             throw new Exception("没有要修改的时间");
         }
         sql.Append(" where cm=@cm and hcorhbh=@hcorhbh and hgfxsj is null ");
         conn.Execute(sql.ToString(), hddz);
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// 把ocr返回的xml数据 解析成对象
        /// </summary>
        /// <param name="xml"></param>
        private void OcrXmlToHddz(string xml, out yw_hddzEntity model, out List <yw_hddz_spxxEntity> list)
        {
            model = new yw_hddzEntity();
            list  = new List <yw_hddz_spxxEntity>();

            XmlDocument doc = new XmlDocument();

            doc.LoadXml(xml);
            XmlNodeList xnl = doc.GetElementsByTagName("yw_hddz");

            if (xnl.Count == 0)
            {
                throw new Exception("返回的xml中不包含yw_hddz");
            }
            XmlNode mainxn   = xnl.Item(0);
            string  jsonText = JsonConvert.SerializeXmlNode(mainxn);
            JObject obj      = JsonConvert.DeserializeObject(jsonText) as JObject;

            if (obj["yw_hddz"]["invoice_date"] != null)//发票日期格式判定
            {
                string   str = obj["yw_hddz"]["invoice_date"].ToString().Replace("\"", "");
                DateTime d   = new DateTime();
                if (!DateTime.TryParse(str, out d))
                {
                    throw new Exception("OCR返回的发票日期为" + str + "格式错误,日期格式为yyyy.MM.dd!");
                }
            }

            yw_hddzXmlData data = JsonConvert.DeserializeObject <yw_hddzXmlData>(jsonText);

            if (data != null && data.yw_hddz != null)
            {
                model = data.yw_hddz;
                //if (string.IsNullOrEmpty(ywbh))//如果是添加 则构建ywbh
                //    ywbh = new Interfaces.Service.HddzService().GetNewYwbh(DateTime.Now.ToString("yy") + "OC");
                //model.ywbh = ywbh;
            }
            else
            {
                throw new Exception("返回的xml解析错误!");
            }
            XmlNodeList detailsxnl = mainxn.SelectNodes("details/yw_hddz_spxx");
            var         i          = 1;

            foreach (XmlNode spxn in detailsxnl)
            {
                string              jsonText1 = JsonConvert.SerializeXmlNode(spxn);
                yw_hddz_spxxEntity  spitem    = new yw_hddz_spxxEntity();
                yw_hddz_spxxXmlData data1     = JsonConvert.DeserializeObject <yw_hddz_spxxXmlData>(jsonText1);
                if (data1 != null && data1.yw_hddz_spxx != null)
                {
                    spitem = data1.yw_hddz_spxx;
                    //spitem.ywbh = ywbh;
                    spitem.cxh = i++;
                    list.Add(spitem);
                }
            }
        }
Ejemplo n.º 5
0
 /// <summary>
 /// 获取所有货币信息
 /// </summary>
 /// <returns></returns>
 public static List <yw_wldwEntity> GetWldwListByHddz(yw_hddzEntity model)
 {
     using (var con = ConnectionFactory.CreateConnection())
     {
         if (con.State == System.Data.ConnectionState.Closed)
         {
             con.Open();
         }
         string sql = SqlFactory.GetSelectListSql(new yw_wldwEntity());
         sql += " where yw_khbm in(@khbm,@gwgysbm,@jydwbm,@cyrbm)";
         return(con.Query <yw_wldwEntity>(sql, model).ToList());
     }
 }
Ejemplo n.º 6
0
        /// <summary>
        /// 添加货代单证,包含主表和商品信息表
        /// </summary>
        /// <param name="model"></param>
        /// <param name="list"></param>
        /// <returns></returns>
        public bool SaveHddz(yw_hddzEntity model, List <yw_hddz_spxxEntity> list)
        {
            using (conn = ConnectionFactory.CreateConnection())
            {
                if (conn.State == System.Data.ConnectionState.Closed)
                {
                    conn.Open();
                }
                IDbTransaction _transaction = conn.BeginTransaction();
                try
                {
                    #region 数据补全
                    if (model.ysfs.Trim() == "海运")
                    {
                        model.ywbh = new Interfaces.Service.HddzService().GetNewYwbh(DateTime.Now.ToString("yy") + model.dqdm);
                    }
                    else
                    {
                        model.ywbh = new Interfaces.Service.HddzService().GetNewYwbh(DateTime.Now.ToString("yy") + "OC");
                    }

                    model.zbrq  = DateTime.Now;
                    model.state = "新制";

                    model.zydl = model.zjsbm == model.khbm ? "自营" : "代理";
                    list.ForEach(p => p.ywbh = model.ywbh);
                    #endregion

                    //插入货代主表
                    string sql = SqlFactory.GetInsertSql(model);
                    conn.Execute(sql, model, _transaction);
                    //插入商品信息分录表
                    string spxxsql = SqlFactory.GetInsertSql(new yw_hddz_spxxEntity());
                    conn.Execute(spxxsql, list, _transaction);

                    AddHddzJzxxx(model, _transaction);
                    _transaction.Commit();
                    return(true);
                }
                catch (Exception ex)
                {
                    _transaction.Rollback();
                    throw ex;
                }
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 修改货代单证,包含主表和商品信息表
        /// </summary>
        /// <param name="model"></param>
        /// <param name="list"></param>
        /// <returns></returns>
        public bool ModifyHddz(yw_hddzEntity model, List <yw_hddz_spxxEntity> list)
        {
            using (conn = ConnectionFactory.CreateConnection())
            {
                if (conn.State == System.Data.ConnectionState.Closed)
                {
                    conn.Open();
                }
                IDbTransaction _transaction = conn.BeginTransaction();;
                try
                {
                    #region 数据补全
                    model.zydl = model.zjsbm == model.khbm ? "自营" : "代理";
                    #endregion
                    //插入货代主表
                    //string sql = SqlFactory.GetUpdateSql(model, "yw_hddz", "ywbh");
                    string sql = @"update yw_hddz set gwgysbm=@gwgysbm,gwgysmc=@gwgysmc,gwgysjc=@gwgysjc,
khbm=@khbm,khmc=@khmc,khjc=@khjc,khpym=@khpym,zjsmc=@zjsmc,zjsbm=@zjsbm,zjsjc=@zjsjc,zjspym=@zjspym,shdwbm=@shdwbm,shdwmc=@shdwmc,
jydwbm=@jydwbm,jydwdm=@jydwdm,jydwmc=@jydwmc,jydwjc=@jydwjc,jydwpym=@jydwpym,jydwsjjgdm=@jydwsjjgdm,
hth=@hth,wbbb=@wbbb,zje=@zje,ycddm=@ycddm,ycd=@ycd,dqdm=@dqdm,yzbh=@yzbh,ctr_area2=@ctr_area2,qygdm=@qygdm,qiyunguodm=@qiyunguodm,qyg=@qyg,mdg=@mdg,
jgfs=@jgfs,invoiceno=@invoiceno,zjz=@zjz,zmz=@zmz,ysfs=@ysfs,zydl=@zydl,
ztdh=@ztdh,hz_spmc=@hz_spmc,cyr=@cyr,cyrbm=@cyrbm,cyrjc=@cyrjc,cyrpym=@cyrpym,ejycd=@ejycd,sfyyf=@sfyyf,tzrbm=@tzrbm,tzrmc=@tzrmc,tzrjc=@tzrjc,tzrpym=@tzrpym,
cm=@cm,hcorhbh=@hcorhbh,zz_hcorhbh=@zz_hcorhbh,zcrq=@zcrq,fh=@fh,hz_jzxh=@hz_jzxh,hz_xx=@hz_xx,hz_zhlx=@hz_zhlx,invoice_date=@invoice_date,
state=@state,mygb=@mygb,clfs=@clfs where ywbh=@ywbh";
                    conn.Execute(sql, model, _transaction);
                    //删除现有的商品,重新添加
                    string delsql = "delete from yw_hddz_spxx where ywbh=@ywbh";
                    conn.Execute(delsql, new { ywbh = model.ywbh }, _transaction);
                    //删除集装箱信息
                    string deljzxsql = "delete from yw_hddz_jzxxx where ywbh=@ywbh";
                    conn.Execute(deljzxsql, new { ywbh = model.ywbh }, _transaction);

                    //插入商品信息分录表
                    string spxxsql = SqlFactory.GetInsertSql(new yw_hddz_spxxEntity());
                    conn.Execute(spxxsql, list, _transaction);
                    AddHddzJzxxx(model, _transaction);
                    _transaction.Commit();
                    return(true);
                }
                catch (Exception ex)
                {
                    _transaction.Rollback();
                    throw ex;
                }
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 更新靠港时间
        /// </summary>
        /// <param name="context"></param>
        public void updatePortTime(HttpContext context)
        {
            string cm   = request.Params["shipName"];
            string hc   = request.Params["voyage"];
            string sj   = request.Params["expectedStopTime"];
            string type = request.Params["type"];

            try
            {
                writeLog(string.Format("updatePortTime收到参数,shipName={0}&voyage={1}&expectedStopTime={2}&type={3}", cm, hc, sj, type));
                authorityCheck(context);
                if (string.IsNullOrEmpty(cm) || string.IsNullOrEmpty(hc) || string.IsNullOrEmpty(sj) || string.IsNullOrEmpty(type))
                {
                    throw new Exception("参数shipName,voyage,expectedStopTime,type都不能为空");
                }

                DateTime d = new DateTime();
                if (!DateTime.TryParse(sj, out d))
                {
                    throw new Exception("expectedStopTime格式不正确");
                }
                yw_hddzEntity hddz = new yw_hddzEntity();
                hddz.cm      = cm;
                hddz.hcorhbh = hc;
                if (type == "0")
                {
                    hddz.yjkgsj = d;
                }
                else if (type == "1")
                {
                    hddz.sjkgsj = d;
                }
                else
                {
                    throw new Exception("参数type不正确");
                }

                new Interfaces.Service.HddzService().updateKgsjByCmHc(hddz);
                res.code = "000";
            }
            catch (Exception ex)
            {
                writeLog("updatePortTime出现异常" + ex.Message);
                res.des = ex.Message;
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 添加集装箱信息表
        /// </summary>
        public bool AddHddzJzxxx(yw_hddzEntity model, IDbTransaction _transaction)
        {
            List <yw_hddz_jzxxxEntity> list = new List <yw_hddz_jzxxxEntity>();

            if (string.IsNullOrEmpty(model.hz_jzxh))
            {
                return(true);
            }

            string[] strjzxh = model.hz_jzxh.Replace("、", ",").Split(',');
            int      i       = 1;

            foreach (string jzxh in strjzxh)
            {
                if (jzxh.Trim() == "")
                {
                    continue;
                }
                yw_hddz_jzxxxEntity jzx = new yw_hddz_jzxxxEntity();
                jzx.ywbh = model.ywbh;
                jzx.jzxh = jzxh;
                jzx.ysfs = model.ysfs;
                jzx.xx   = "40尺高柜";
                jzx.xl   = "冷藏集装箱";
                jzx.cxh  = i++;
                list.Add(jzx);
            }

            if (conn.State == System.Data.ConnectionState.Closed)
            {
                conn.Open();
            }
            string sql = SqlFactory.GetInsertSql(new yw_hddz_jzxxxEntity());

            return(conn.Execute(sql, list, _transaction) != 0);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// ocr同步到水果通
        /// </summary>
        /// <param name="modelXml"></param>
        /// <returns></returns>
        public void OCRToFruit(HttpContext context)
        {
            SysLogEntity log = new SysLogEntity();

            try
            {
                bool isadd = false;
                //接受
                string id = context.Request.Params["id"];
                Interfaces.OCRWebServ.OcrInvokeServiceImpl serv = new OcrInvokeServiceImpl();
                //判断id是否已经同步
                //serv.Timeout = 20000;//20秒的超时时间
                string xmlData = serv.queryInfo("<?xml version=\"1.0\" encoding=\"utf-8\"?><ROOT><ocrmainid>" + id + "</ocrmainid><token>ocr</token></ROOT>");

                #region xml
                //                string xmlData = @"<freshport>
                //  <flag>true</flag>
                //  <msg/>
                //  <data>
                //    <yw_hddz>
                //      <ocrid>432ce7f1-3012-4e8b-ab81-d6f588afe2bb</ocrid>
                //      <gwgysbm>NEW ZEALAND APPLE LTD</gwgysbm>
                //      <zjsmc>NEW ZEALAND APPLE LTD</zjsmc>
                //      <khbm>Fuhuida Fareast (Xiamen) Corporation.</khbm>
                //      <jydwbm>Fuhuida Fareast (Xiamen) Corporation.</jydwbm>
                //      <hz_spmc>鲜苹果</hz_spmc>
                //      <ysfs>海运</ysfs>
                //      <cyr>中国远洋</cyr>
                //      <cyrbm>中国远洋</cyrbm>
                //      <invoiceno>fp-20160506-1</invoiceno>
                //      <ztdh>td-20160506-1</ztdh>
                //      <ycddm>New zealand1</ycddm>
                //      <ejycd>New zealand</ejycd>
                //      <sfyyf>FREIGHT PREPAID</sfyyf>
                //      <cm>MOL DESTINY</cm>
                //      <hcorhbh>009</hcorhbh>
                //      <zcrq>2015.05.13</zcrq>
                //      <qyg>NAPIER</qyg>
                //      <mdg>SHANGHAI</mdg>
                //      <fh>F3304!7</fh>
                //      <zjz>20916.00</zjz>
                //      <zmz>23240.00</zmz>
                //      <hz_jzxh>TGHU9995270</hz_jzxh>
                //      <hz_xx>40RQ</hz_xx>
                //      <hz_zhlx>40RQ</hz_zhlx>
                //      <jgfs>C&amp;amp;F</jgfs>
                //      <wbbb>USD</wbbb>
                //      <zje>45259.90</zje>
                //      <invoice_date>2015.05.15</invoice_date>
                //      <mygb>New zealand</mygb>
                //      <tzrmc>SHANGHAI YUHUA FRUIT CO. , LTD</tzrmc>
                //      <jldw>CARTONS</jldw>
                //      <details>
                //        <yw_hddz_spxx>
                //          <spmc_yw>Apples</spmc_yw>
                //          <jldw>CARTONS</jldw>
                //          <jlsl>224</jlsl>
                //          <fpje>8724.80</fpje>
                //          <hgbm></hgbm>
                //          <djjg>38.95</djjg>
                //          <spgg_yw>90</spgg_yw>
                //          <sppz_yw>Rose</sppz_yw>
                //          <spdj_yw>HG</spdj_yw>
                //          <sppp_yw></sppp_yw>
                //          <spms></spms>
                //          <zjz>3920.00</zjz>
                //          <zmz>4256.00</zmz>
                //        </yw_hddz_spxx>
                //        <yw_hddz_spxx>
                //          <spmc_yw>Apples</spmc_yw>
                //          <jldw>CARTONS</jldw>
                //          <jlsl>98</jlsl>
                //          <fpje>3817.10</fpje>
                //          <hgbm></hgbm>
                //          <djjg>38.95</djjg>
                //          <spgg_yw>60</spgg_yw>
                //          <sppz_yw>Rose</sppz_yw>
                //          <spdj_yw>HG</spdj_yw>
                //          <sppp_yw></sppp_yw>
                //          <spms></spms>
                //          <zjz></zjz>
                //          <zmz></zmz>
                //        </yw_hddz_spxx>
                //        <yw_hddz_spxx>
                //          <spmc_yw>Apples</spmc_yw>
                //          <jldw>CARTONS</jldw>
                //          <jlsl>392</jlsl>
                //          <fpje>15268.40</fpje>
                //          <hgbm></hgbm>
                //          <djjg>38.95</djjg>
                //          <spgg_yw>80</spgg_yw>
                //          <sppz_yw>Rose</sppz_yw>
                //          <spdj_yw>HG</spdj_yw>
                //          <sppp_yw></sppp_yw>
                //          <spms></spms>
                //          <zjz></zjz>
                //          <zmz></zmz>
                //        </yw_hddz_spxx>
                //        <yw_hddz_spxx>
                //          <spmc_yw>Apples</spmc_yw>
                //          <jldw>CARTONS</jldw>
                //          <jlsl>448</jlsl>
                //          <fpje>17449.60</fpje>
                //          <hgbm></hgbm>
                //          <djjg>38.95</djjg>
                //          <spgg_yw>70</spgg_yw>
                //          <sppz_yw>Rose</sppz_yw>
                //          <spdj_yw>HG</spdj_yw>
                //          <sppp_yw></sppp_yw>
                //          <spms></spms>
                //          <zjz></zjz>
                //          <zmz></zmz>
                //        </yw_hddz_spxx>
                //      </details>
                //    </yw_hddz>
                //  </data>
                //</freshport>";
                #endregion

                List <yw_hddz_spxxEntity>      list     = new List <yw_hddz_spxxEntity>();
                Interfaces.Service.HddzService dbServ   = new Interfaces.Service.HddzService();
                Interfaces.Service.BaseService baseServ = new Interfaces.Service.BaseService();
                yw_hddzEntity editmodel = dbServ.GetHddzModel(id);//主表对象
                yw_hddzEntity model     = new yw_hddzEntity();
                if (editmodel == null)
                {
                    editmodel = new yw_hddzEntity();
                    isadd     = true;
                }
                else
                {
                    isadd = false;
                }

                //解析xml文件
                #region xml测试文件
                //string xmlData = @"<freshport>
                //  <flag>true</flag>
                //  <msg/>
                //  <data><yw_hddz>  <ocrid>432ce7f1-3012-4e8b-ab81-d6f588afe2bb</ocrid>  <gwgysbm>yangliutao</gwgysbm>  <zjsmc>NEW ZEALAND APPLE LTD</zjsmc>  <khbm>yangtao</khbm>  <jydwbm>same</jydwbm>  <ysfs>海运</ysfs>  <cyr>003</cyr>  <invoiceno>fp-20160506-1</invoiceno>  <ztdh>td-20160506-1</ztdh>  <ycddm>4</ycddm>  <ejycd>New zealand</ejycd>  <sfyyf>FREIGHT PREPAID</sfyyf>  <cm>MOL DESTINY</cm>  <hcorhbh>009</hcorhbh>  <czrq/>  <qyg>NAPIER</qyg>  <mdg/>  <fh>F3304!7</fh>  <zjz>20916.00</zjz>  <zmz>23240.00</zmz>  <hz_jzxh>TGHU9995270</hz_jzxh>  <hz_xx>40RQ</hz_xx>  <hz_zhlx>40RQ</hz_zhlx>  <jgfs>C&amp;amp;F</jgfs>  <wbbb>USD</wbbb>  <zje>45259.90</zje>  <invoice_date>13-05-2015</invoice_date>  <details>    <yw_hddz_spxx>      <spmc_yw>Apples</spmc_yw>      <jlsl>224</jlsl>      <fpje>8724.80</fpje>      <or_hscode/>    </yw_hddz_spxx>    <yw_hddz_spxx>      <spmc_yw>Apples</spmc_yw>      <jlsl>98</jlsl>      <fpje>3817.10</fpje>      <or_hscode/>    </yw_hddz_spxx>    <yw_hddz_spxx>      <spmc_yw>Apples</spmc_yw>      <jlsl>392</jlsl>      <fpje>15268.40</fpje>      <or_hscode/>    </yw_hddz_spxx>    <yw_hddz_spxx>      <spmc_yw>Apples</spmc_yw>      <jlsl>448</jlsl>      <fpje>17449.60</fpje>      <or_hscode/>    </yw_hddz_spxx>  </details></yw_hddz></data>
                //</freshport>";
                #endregion

                Interfaces.MasterDataResponse mdr = new Interfaces.MasterDataResponse(xmlData);
                log.otherID = id;
                #region 返回数据异常处理
                if (!mdr.flag)//执行失败
                {
                    log.msg    = mdr.GetMsgStr <yw_hddzEntity>();
                    res.msg    = log.msg;
                    res.result = false;
                    //strrep = "{\"result\":false,\"message\":\"" + log.msg + "\"}";
                }
                else
                {
                    //把xml转化成对象
                    OcrXmlToHddz(mdr.data, out model, out list);


                    #region 基础表名称对应代码
                    List <yw_hddz_ocrvalmapEntity> errordatelist = new List <yw_hddz_ocrvalmapEntity>();

                    #region 国外供应商
                    if (!string.IsNullOrEmpty(model.gwgysbm))
                    {
                        yw_wldwEntity gwgys = Interfaces.Service.BaseService.GetWldwModel(model.gwgysbm);
                        if (gwgys != null)
                        {
                            model.gwgysbm = gwgys.yw_khbm;
                            model.gwgysjc = gwgys.khjc;
                            model.gwgysmc = gwgys.khmc_yw;
                        }
                        else
                        {
                            yw_hddz_ocrvalmapEntity errData = new yw_hddz_ocrvalmapEntity();
                            errData.field     = "gwgys";
                            errData.fieldname = "国外供应商";
                            errData.ocrvalue  = model.gwgysbm;
                            errData.tablename = "yw_wldw";
                            errordatelist.Add(errData);
                        }
                    }
                    #endregion

                    #region 客户
                    if (!string.IsNullOrEmpty(model.khbm))
                    {
                        yw_wldwEntity kh = Interfaces.Service.BaseService.GetWldwModel(model.khbm);
                        if (kh != null)
                        {
                            model.khbm  = kh.yw_khbm;
                            model.khjc  = kh.khjc;
                            model.khmc  = kh.khmc;
                            model.khpym = kh.pym;
                        }
                        else
                        {
                            yw_hddz_ocrvalmapEntity errData = new yw_hddz_ocrvalmapEntity();
                            errData.field     = "kh";
                            errData.fieldname = "委托客户";
                            errData.ocrvalue  = model.khbm;
                            errData.tablename = "yw_wldw";
                            errordatelist.Add(errData);
                        }
                    }
                    #endregion

                    #region 经营单位
                    if (!string.IsNullOrEmpty(model.jydwbm))
                    {
                        yw_wldwEntity jydw = Interfaces.Service.BaseService.GetWldwModel(model.jydwbm);
                        if (jydw != null)
                        {
                            model.jydwbm  = jydw.yw_khbm;
                            model.jydwjc  = jydw.khjc;
                            model.jydwmc  = jydw.khmc;
                            model.jydwpym = jydw.pym;
                        }
                        else
                        {
                            yw_hddz_ocrvalmapEntity errData = new yw_hddz_ocrvalmapEntity();
                            errData.field     = "jydw";
                            errData.fieldname = "经营单位";
                            errData.ocrvalue  = model.jydwbm;
                            errData.tablename = "yw_wldw";
                            errordatelist.Add(errData);
                        }
                    }
                    #endregion

                    #region 承运人
                    if (!string.IsNullOrEmpty(model.cyr))
                    {
                        yw_wldwEntity cyr = Interfaces.Service.BaseService.GetWldwModel(model.cyr);
                        if (cyr != null)
                        {
                            model.cyrbm  = cyr.yw_khbm;
                            model.cyrjc  = cyr.khjc;
                            model.cyr    = cyr.khmc;
                            model.cyrpym = cyr.pym;
                        }
                        else
                        {
                            yw_hddz_ocrvalmapEntity errData = new yw_hddz_ocrvalmapEntity();
                            errData.field     = "cyr";
                            errData.fieldname = "承运人";
                            errData.ocrvalue  = model.cyrbm;
                            errData.tablename = "yw_wldw";
                            errordatelist.Add(errData);
                        }
                    }
                    #endregion

                    #region 中间商
                    if (!string.IsNullOrEmpty(model.zjsmc))
                    {
                        yw_wldwEntity zjs = Interfaces.Service.BaseService.GetWldwModel(model.zjsmc);
                        if (zjs != null)
                        {
                            model.zjsbm  = zjs.yw_khbm;
                            model.zjsjc  = zjs.khjc;
                            model.zjsmc  = zjs.khmc_yw;
                            model.zjspym = zjs.pym;
                        }
                        else
                        {
                            yw_hddz_ocrvalmapEntity errData = new yw_hddz_ocrvalmapEntity();
                            errData.field     = "zjs";
                            errData.fieldname = "中间商";
                            errData.ocrvalue  = model.zjsmc;
                            errData.tablename = "yw_wldw";
                            errordatelist.Add(errData);
                        }
                    }
                    #endregion

                    #region 通知人
                    if (!string.IsNullOrEmpty(model.tzrmc))
                    {
                        yw_wldwEntity tzr = Interfaces.Service.BaseService.GetWldwModel(model.tzrmc);
                        if (tzr != null)
                        {
                            model.tzrbm  = tzr.yw_khbm;
                            model.tzrjc  = tzr.khjc;
                            model.tzrmc  = tzr.khmc;
                            model.tzrpym = tzr.pym;
                        }
                        else
                        {
                            yw_hddz_ocrvalmapEntity errData = new yw_hddz_ocrvalmapEntity();
                            errData.field     = "tzr";
                            errData.fieldname = "通知人";
                            errData.ocrvalue  = model.tzrmc;
                            errData.tablename = "yw_wldw";
                            errordatelist.Add(errData);
                        }
                    }
                    #endregion

                    #region 原产地
                    if (!string.IsNullOrEmpty(model.ycddm))
                    {
                        t_countryEntity ycd = Interfaces.Service.BaseService.GetCountryModel(model.ycddm);
                        if (ycd != null)
                        {
                            model.ycd   = ycd.ctr_ename;
                            model.ycddm = ycd.ctr_hgcode;
                            model.dqdm  = ycd.dqdm;
                        }
                        else
                        {
                            yw_hddz_ocrvalmapEntity errData = new yw_hddz_ocrvalmapEntity();
                            errData.field     = "ycd";
                            errData.fieldname = "原产地";
                            errData.ocrvalue  = model.ycddm;
                            errData.tablename = "t_country";
                            errordatelist.Add(errData);
                        }
                    }
                    #endregion

                    #endregion
                    //完善对象字段
                    #region 根据代码完善数据
                    model.sfyyf = model.sfyyf == "FREIGHT PREPAID" ? "N" : "Y";
                    model.jgfs  = model.jgfs.Replace("&amp;", "&");
                    #endregion


                    #region 数据保存
                    if (errordatelist.Count == 0)//没有错误才能保存
                    {
                        if (isadd)
                        {
                            model.zbr = QsWebSoft.AppService.GetUserID();
                            if (model.ysfs.Trim() == "海运")
                            {
                                model.ywbh = new Interfaces.Service.HddzService().GetNewYwbh(DateTime.Now.ToString("yy") + model.dqdm);
                            }
                            else
                            {
                                model.ywbh = new Interfaces.Service.HddzService().GetNewYwbh(DateTime.Now.ToString("yy") + "OC");
                            }

                            model.zbrq  = DateTime.Now;
                            model.state = "新制";
                            //分录商品表 赋值ywbh
                        }
                        else
                        {
                            model.ywbh           = editmodel.ywbh;
                            model.zbrq           = editmodel.zbrq;
                            model.zbr            = editmodel.zbr;
                            model.state          = editmodel.state;
                            model.SupplierSellID = editmodel.SupplierSellID;
                            model.shdwbm         = editmodel.shdwbm;
                        }
                        list.ForEach(p => p.ywbh = model.ywbh);
                        log.ywbh = model.ywbh;
                        //保存数据
                        if (isadd)
                        {
                            dbServ.SaveHddz(model, list);
                        }
                        else
                        {
                            dbServ.ModifyHddz(model, list);
                        }
                        res.result = true;
                        log.msg    = "编号为" + model.ywbh + "的数据保存成功";
                    }
                    else//把错误和数据抛到前端
                    {
                        res.id        = id;
                        res.data      = model;
                        res.data1     = list;
                        res.errordata = errordatelist;
                        res.errortype = 1;
                        res.msg       = log.msg = "有未匹配的值。";
                        res.result    = false;
                    }

                    #endregion
                }

                #endregion
            }
            catch (Exception ex)
            {
                log.msg       = ex.Message.Replace(Environment.NewLine, "");
                res.msg       = log.msg;
                res.result    = false;
                res.errortype = 2;
            }
            strrep = JsonConvert.SerializeObject(res);
            context.Response.Write(strrep);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// 错误处理后提交
        /// </summary>
        /// <param name="context"></param>
        public void JsonToFruit(HttpContext context)
        {
            SysLogEntity log = new SysLogEntity();

            try
            {
                #region 接受数据、声明变量

                bool isadd = false;
                Interfaces.Service.HddzService dbServ = new Interfaces.Service.HddzService();
                string        strData = context.Request.Params["data"];
                yw_hddzEntity model   = JsonConvert.DeserializeObject <yw_hddzEntity>(strData);

                string strErrorData = context.Request.Params["errdata"];
                List <yw_hddz_ocrvalmapEntity> maplist = JsonConvert.DeserializeObject <List <yw_hddz_ocrvalmapEntity> >(strErrorData);

                string strspxx = context.Request.Params["data1"];
                List <yw_hddz_spxxEntity> spxxlist = JsonConvert.DeserializeObject <List <yw_hddz_spxxEntity> >(strspxx);
                #endregion

                #region 判断是否已经有对应数据
                yw_hddzEntity editmodel = dbServ.GetHddzModel(model.OcrID);//主表对象

                if (editmodel == null)
                {
                    editmodel = new yw_hddzEntity();
                    isadd     = true;
                }
                else
                {
                    isadd = false;
                }
                #endregion

                #region 关系映射
                //保存值对应关系
                maplist.ForEach(p => p.ID = Guid.NewGuid().ToString());

                List <yw_hddz_ocrvalmapEntity> addmaplist = new List <yw_hddz_ocrvalmapEntity>();
                foreach (var mapinfo in maplist)
                {
                    if (string.IsNullOrEmpty(mapinfo.value))//如果没有选择对应值 则需要快速创建
                    {
                        #region 往来单位
                        if (mapinfo.tablename == "yw_wldw")
                        {
                            Interfaces.Service.BaseService.AddWldw(mapinfo.ocrvalue);
                            switch (mapinfo.field)
                            {
                            case "gwgys":
                                #region 国外供应商
                                if (!string.IsNullOrEmpty(model.gwgysbm))
                                {
                                    yw_wldwEntity gwgys = Interfaces.Service.BaseService.GetWldwModel(model.gwgysbm);
                                    if (gwgys != null)
                                    {
                                        model.gwgysbm = gwgys.khbm;
                                        model.gwgysjc = gwgys.khjc;
                                        model.gwgysmc = gwgys.khmc_yw;
                                    }
                                }
                                #endregion
                                break;

                            case "kh":
                                #region 客户
                                if (!string.IsNullOrEmpty(model.khbm))
                                {
                                    yw_wldwEntity kh = Interfaces.Service.BaseService.GetWldwModel(model.khbm);
                                    if (kh != null)
                                    {
                                        model.khbm  = kh.khbm;
                                        model.khjc  = kh.khjc;
                                        model.khmc  = kh.khmc;
                                        model.khpym = kh.pym;
                                    }
                                }
                                #endregion
                                break;

                            case "jydw":
                                #region 经营单位
                                if (!string.IsNullOrEmpty(model.jydwbm))
                                {
                                    yw_wldwEntity jydw = Interfaces.Service.BaseService.GetWldwModel(model.jydwbm);
                                    if (jydw != null)
                                    {
                                        model.jydwbm  = jydw.khbm;
                                        model.jydwjc  = jydw.khjc;
                                        model.jydwmc  = jydw.khmc;
                                        model.jydwpym = jydw.pym;
                                    }
                                }
                                #endregion
                                break;

                            case "cyr":
                                #region 承运人
                                if (!string.IsNullOrEmpty(model.cyrbm))
                                {
                                    yw_wldwEntity cyr = Interfaces.Service.BaseService.GetWldwModel(model.cyrbm);
                                    if (cyr != null)
                                    {
                                        model.cyrbm  = cyr.khbm;
                                        model.cyrjc  = cyr.khjc;
                                        model.cyr    = cyr.khmc;
                                        model.cyrpym = cyr.pym;
                                    }
                                }
                                #endregion
                                break;

                            case "zjs":
                                #region 中间商
                                if (!string.IsNullOrEmpty(model.zjsmc))
                                {
                                    yw_wldwEntity zjs = Interfaces.Service.BaseService.GetWldwModel(model.zjsmc);
                                    if (zjs != null)
                                    {
                                        model.zjsbm  = zjs.khbm;
                                        model.zjsjc  = zjs.khjc;
                                        model.zjsmc  = zjs.khmc;
                                        model.zjspym = zjs.pym;
                                    }
                                }
                                #endregion
                                break;

                            case "tzr":
                                #region 通知人
                                if (!string.IsNullOrEmpty(model.tzrmc))
                                {
                                    yw_wldwEntity tzr = Interfaces.Service.BaseService.GetWldwModel(model.tzrmc);
                                    if (tzr != null)
                                    {
                                        model.tzrbm  = tzr.khbm;
                                        model.tzrjc  = tzr.khjc;
                                        model.tzrmc  = tzr.khmc;
                                        model.tzrpym = tzr.pym;
                                    }
                                }
                                #endregion
                                break;
                            }
                        }
                        #endregion
                        else if (mapinfo.tablename == "t_country")
                        {
                            throw new Exception("原产地没有选择对应值!");
                            //model.ycd = model.ycd;
                        }
                    }
                    else
                    {
                        mapinfo.ID = Guid.NewGuid().ToString();
                        addmaplist.Add(mapinfo);
                    }
                }

                Interfaces.Service.BaseService.AddMapList(addmaplist);
                #endregion

                #region 保存数据
                if (isadd)
                {
                    model.zbr = QsWebSoft.AppService.GetUserID();
                    if (model.ysfs.Trim() == "海运")
                    {
                        model.ywbh = new Interfaces.Service.HddzService().GetNewYwbh(DateTime.Now.ToString("yy") + model.dqdm);
                    }
                    else
                    {
                        model.ywbh = new Interfaces.Service.HddzService().GetNewYwbh(DateTime.Now.ToString("yy") + "OC");
                    }

                    model.zbrq  = DateTime.Now;
                    model.state = "新制";
                    //分录商品表 赋值ywbh
                }
                else
                {
                    model.ywbh           = editmodel.ywbh;
                    model.zbrq           = editmodel.zbrq;
                    model.zbr            = editmodel.zbr;
                    model.state          = editmodel.state;
                    model.SupplierSellID = editmodel.SupplierSellID;
                    model.shdwbm         = editmodel.shdwbm;
                }
                spxxlist.ForEach(p => p.ywbh = model.ywbh);
                //保存数据
                if (isadd)
                {
                    dbServ.SaveHddz(model, spxxlist);
                }
                else
                {
                    dbServ.ModifyHddz(model, spxxlist);
                }


                res.result = true;
                log.msg    = "编号为" + model.ywbh + "的数据保存成功";

                #endregion
            }
            catch (Exception ex)
            {
                log.msg       = ex.Message.Replace(Environment.NewLine, "");
                res.msg       = log.msg;
                res.result    = false;
                res.errortype = 2;
            }
            strrep = JsonConvert.SerializeObject(res);
            context.Response.Write(strrep);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// 货单单证相关接口
        /// </summary>
        /// <returns></returns>
        private static bool HddzInterface(List <interfieldEntity> colslist, string tableName, yw_hddzEntity model, string cxh, HddzIF serv)
        {
            List <string> interNames = new List <string>();

            //changeCols
            if (string.IsNullOrEmpty(model.SupplierSellID))//添加模式
            {
                colslist  = Service.BaseService.GetFieldByTbName("yw_hddz");
                serv.cols = null;
            }
            else
            {
                if (colslist.Count == 0)
                {
                    colslist  = Service.BaseService.GetFieldByTbName(tableName);
                    serv.cols = null;
                }
                else
                {
                    serv.cols = colslist;
                }
            }
            interNames = GetIFlist(colslist);
            #region 调用接口
            bool flag = true;

            #region 代卖信息同步
            if (flag && (interNames.Contains("SynSupplierSell")))//代卖
            {
                if (serv.cols != null)
                {
                    serv.cols = colslist.Where(p => p.interid == "SynSupplierSell").ToList();
                }
                flag = serv.SynSupplierSell(model);
            }
            #endregion

            #region 国际物流
            if (flag && interNames.Contains("SynInternational"))//国际物流
            {
                if (serv.cols != null)
                {
                    serv.cols = colslist.Where(p => p.interid == "SynInternational").ToList();
                }
                flag = serv.SynInternational(model);
            }
            #endregion

            #region 国内报关
            if (flag && interNames.Contains("SynDomestic"))//国内报关
            {
                if (serv.cols != null)
                {
                    serv.cols = colslist.Where(p => p.interid == "SynDomestic").ToList();
                }
                flag = serv.SynDomesticCustoms(model);
            }

            if (flag && interNames.Contains("SynDomesticCustomsDoc"))//国内报关单证
            {
                flag = serv.SynDomesticCustomsDoc(model, cxh);
            }
            #endregion

            #region 集装箱信息
            if (flag && interNames.Contains("SynContainerInfo"))//集装箱信息
            {
                flag = serv.SynContainerInfo(model);
            }
            #endregion

            #region 空运提货

            if (flag && interNames.Contains("SynAirBL") && model.ysfs == "空运")//主表
            {
                if (serv.cols != null)
                {
                    serv.cols = colslist.Where(p => p.interid == "SynAirBL").ToList();
                }

                flag = serv.SynAirBL(model);
            }

            if (flag && interNames.Contains("SynAirBLConsignee") && model.ysfs == "空运")//主表
            {
                if (serv.cols != null)
                {
                    serv.cols = colslist.Where(p => p.interid == "SynAirBLConsignee").ToList();
                }
                flag = serv.SynAirBLConsignee(model);
            }
            #endregion

            #region 海运提货

            if (flag && interNames.Contains("SynSeaBL") && model.ysfs == "海运")//主表
            {
                if (serv.cols != null)
                {
                    serv.cols = colslist.Where(p => p.interid == "SynSeaBL").ToList();
                }
                flag = serv.SynSeaBL(model, cxh);
            }

            if (flag && interNames.Contains("SynSeaBLConsignee") && model.ysfs == "海运")//主表
            {
                //flag = serv.SynSeaBLConsignee(model, cxh);
            }
            #endregion

            #region 业务保证金
            if (flag && interNames.Contains("SynBusinessMargin"))//业务保证金
            {
                if (serv.cols != null)
                {
                    serv.cols = colslist.Where(p => p.interid == "SynBusinessMargin").ToList();
                }
                flag = serv.SynBusinessMargin(model);
            }

            #endregion

            #region 还箱超期费用
            if (flag && interNames.Contains("SynGaveBackContainer") && model.ysfs == "海运")//主表
            {
                flag = serv.SynGaveBackContainer(model, cxh);
            }
            #endregion

            #endregion
            //保存日志
            //serv.LogInfo.SaveLog();
            //strErr = serv.LogInfo.Log;

            return(flag);
        }
Ejemplo n.º 13
0
        /// <summary>
        /// 错误处理后提交
        /// </summary>
        /// <param name="context"></param>
        public void JsonToFruit(HttpContext context)
        {
            SysLogEntity log = new SysLogEntity();

            try
            {
                #region 接受数据、声明变量

                bool isadd = false;
                Interfaces.Service.HddzService dbServ = new Interfaces.Service.HddzService();
                string        strData = context.Request.Params["data"];
                yw_hddzEntity model   = JsonConvert.DeserializeObject <yw_hddzEntity>(strData);

                string strErrorData = context.Request.Params["errdata"];
                List <yw_hddz_ocrvalmapEntity> maplist = JsonConvert.DeserializeObject <List <yw_hddz_ocrvalmapEntity> >(strErrorData);

                string strspxx = context.Request.Params["data1"];
                List <yw_hddz_spxxEntity> spxxlist = JsonConvert.DeserializeObject <List <yw_hddz_spxxEntity> >(strspxx);
                #endregion

                #region 判断是否已经有对应数据
                yw_hddzEntity editmodel = dbServ.GetHddzModel(model.OcrID);//主表对象

                if (editmodel == null)
                {
                    editmodel = new yw_hddzEntity();
                    isadd     = true;
                }
                else
                {
                    if (editmodel.zbr != userid)
                    {
                        throw new Exception("该数据已被其他账号同步!");
                    }
                    isadd = false;
                }
                #endregion

                #region 关系映射
                //保存值对应关系
                maplist.ForEach(p => p.ID = Guid.NewGuid().ToString());

                List <yw_hddz_ocrvalmapEntity> addmaplist = new List <yw_hddz_ocrvalmapEntity>();
                foreach (var mapinfo in maplist)
                {
                    string val = null;
                    if (string.IsNullOrEmpty(mapinfo.value))//如果没有选择对应值 则需要快速创建
                    {
                        val = mapinfo.ocrvalue;
                        #region 往来单位
                        if (mapinfo.tablename == "yw_wldw")
                        {
                            Interfaces.Service.BaseService.AddWldw(mapinfo.ocrvalue);
                        }
                        #endregion
                        else if (mapinfo.tablename == "t_country")
                        {
                            throw new Exception("原产地没有选择对应值!");
                            //model.ycd = model.ycd;
                        }
                    }
                    else
                    {
                        val        = mapinfo.value;
                        mapinfo.ID = Guid.NewGuid().ToString();
                        addmaplist.Add(mapinfo);
                    }

                    #region 往来单位匹配
                    if (mapinfo.tablename == "yw_wldw")
                    {
                        yw_wldwEntity wldw = Interfaces.Service.BaseService.GetWldwModel(val);
                        switch (mapinfo.field)
                        {
                        case "gwgys":
                            #region 国外供应商
                            model.gwgysbm = wldw.yw_khbm;
                            model.gwgysjc = wldw.khjc;
                            model.gwgysmc = wldw.khmc_yw;
                            #endregion
                            break;

                        case "kh":
                            #region 客户
                            model.khbm  = wldw.khbm;
                            model.khjc  = wldw.khjc;
                            model.khmc  = wldw.khmc;
                            model.khpym = wldw.pym;

                            #endregion
                            break;

                        case "jydw":
                            #region 经营单位
                            model.jydwbm     = wldw.yw_khbm;
                            model.jydwjc     = wldw.khjc;
                            model.jydwmc     = wldw.khmc;
                            model.jydwpym    = wldw.pym;
                            model.jydwdm     = wldw.qyhgbm;
                            model.jydwsjjgdm = wldw.sjjgdm;
                            #endregion
                            break;

                        case "cyr":
                            #region 承运人
                            model.cyrbm  = wldw.yw_khbm;
                            model.cyrjc  = wldw.khjc;
                            model.cyr    = wldw.khmc;
                            model.cyrpym = wldw.pym;
                            #endregion
                            break;

                        case "zjs":
                            #region 中间商
                            model.zjsbm  = wldw.yw_khbm;
                            model.zjsjc  = wldw.khjc;
                            model.zjsmc  = wldw.khmc;
                            model.zjspym = wldw.pym;
                            #endregion
                            break;

                        case "tzr":
                            #region 通知人
                            model.tzrbm  = wldw.yw_khbm;
                            model.tzrjc  = wldw.khjc;
                            model.tzrmc  = wldw.khmc;
                            model.tzrpym = wldw.pym;
                            #endregion
                            break;
                        }
                    }
                    #endregion
                    #region 原产地
                    else if (mapinfo.field == "ycd")
                    {
                        t_countryEntity ycd = Interfaces.Service.BaseService.GetCountryModel(val);
                        if (ycd != null)
                        {
                            model.ycd        = ycd.ctr_ename;
                            model.ycddm      = ycd.ctr_hgcode;
                            model.dqdm       = ycd.dqdm;
                            model.qiyunguodm = ycd.ctr_hgcode;
                            model.ctr_area2  = ycd.ctr_area2;
                            model.yzbh       = ycd.yzbh;
                        }
                        else
                        {
                            throw new Exception("没有查询到相应的原产地");
                        }
                    }
                    #endregion
                }

                Interfaces.Service.BaseService.AddMapList(addmaplist);
                #endregion

                #region 保存数据
                if (!isadd)
                {
                    model.ywbh           = editmodel.ywbh;
                    model.zbrq           = editmodel.zbrq;
                    model.zbr            = editmodel.zbr;
                    model.state          = editmodel.state;
                    model.SupplierSellID = editmodel.SupplierSellID;
                    model.shdwbm         = editmodel.shdwbm;
                }
                spxxlist.ForEach(p => p.ywbh = model.ywbh);
                //保存数据
                if (isadd)
                {
                    dbServ.SaveHddz(model, spxxlist);
                }
                else
                {
                    dbServ.ModifyHddz(model, spxxlist);
                }

                res.result = true;
                log.msg    = "编号为" + model.ywbh + "的数据保存成功";

                #endregion
            }
            catch (Exception ex)
            {
                log.msg       = ex.Message.Replace(Environment.NewLine, "");
                res.msg       = log.msg;
                res.result    = false;
                res.errortype = 2;
            }
            strrep = JsonConvert.SerializeObject(res);
            context.Response.Write(strrep);
        }