Пример #1
0
        private void btnexport_Click(object sender, EventArgs e)
        {
            string xmlData   = "";
            string resultXMl = "";
            string sql       = "";

            this.Cursor = Cursors.WaitCursor;
            if (dgv2.Rows.Count > 0)
            {
                for (int i = 0; i < dgv2.Rows.Count; i++)
                {
                    xmlData = "";
                    xmlData = xmlData + @"<?xml version=""1.0""  encoding=""utf-8""?>";
                    xmlData = xmlData + "<XMLDATA>";
                    xmlData = xmlData + "<HEAD>";
                    xmlData = xmlData + "<IP>" + SendMessage.GetIP() + "</IP> ";
                    xmlData = xmlData + "<MAC>" + SendMessage.GetMAC() + "</MAC> ";
                    xmlData = xmlData + "<BZXX></BZXX> ";
                    xmlData = xmlData + "</HEAD> ";
                    xmlData = xmlData + "<MAIN>";
                    xmlData = xmlData + "<CZLX>1</CZLX> ";
                    xmlData = xmlData + "<SPLX>1</SPLX> ";
                    xmlData = xmlData + "<YPLX>1</YPLX> ";
                    xmlData = xmlData + "<TYM>" + ClsSystem.gnvl(dgv2.Rows[i].Cells["cCurrencyName"].Value, "") + "</TYM> ";
                    xmlData = xmlData + "<CPM>" + ClsSystem.gnvl(dgv2.Rows[i].Cells["cInvName"].Value, "") + "</CPM> ";
                    xmlData = xmlData + "<YWM>" + ClsSystem.gnvl(dgv2.Rows[i].Cells["cEnglishName"].Value, "") + "</YWM> ";
                    xmlData = xmlData + "<SPM>" + ClsSystem.gnvl(dgv2.Rows[i].Cells["cInvName"].Value, "") + "</SPM> ";
                    xmlData = xmlData + "<YPSPTXM>" + ClsSystem.gnvl(dgv2.Rows[i].Cells["cidefine8"].Value, "") + "</YPSPTXM> ";
                    xmlData = xmlData + "<YPJX>1</YPJX> ";
                    xmlData = xmlData + "<GG>" + ClsSystem.gnvl(dgv2.Rows[i].Cells["cInvStd"].Value, "") + "</GG> ";
                    xmlData = xmlData + "<SCQYMC>" + ClsSystem.gnvl(dgv2.Rows[i].Cells["cEnterprise"].Value, "") + "</SCQYMC> ";
                    xmlData = xmlData + "<CPLB>" + ClsSystem.gnvl(dgv2.Rows[i].Cells["cInvStd"].Value, "") + "</CPLB> ";
                    xmlData = xmlData + "<YPBWM>" + ClsSystem.gnvl(dgv2.Rows[i].Cells["cidefine2"].Value, "") + "</YPBWM> ";
                    xmlData = xmlData + "<YPPZWH>" + ClsSystem.gnvl(dgv2.Rows[i].Cells["cFile"].Value, "") + "</YPPZWH> ";
                    xmlData = xmlData + "<BZCZ>" + ClsSystem.gnvl(dgv2.Rows[i].Cells["cidefine3"].Value, "") + "</BZCZ> ";
                    xmlData = xmlData + "<BZDW>" + ClsSystem.gnvl(dgv2.Rows[i].Cells["cComUnitName"].Value, "") + "</BZDW> ";
                    xmlData = xmlData + "<CGYYDW>" + ClsSystem.gnvl(dgv2.Rows[i].Cells["cComUnitName"].Value, "") + "</CGYYDW> ";
                    xmlData = xmlData + "<BZSL>1</BZSL> ";
                    xmlData = xmlData + "<BZFS>" + ClsSystem.gnvl(dgv2.Rows[i].Cells["cidefine4"].Value, "") + "</BZFS> ";
                    xmlData = xmlData + "<TZMS>" + ClsSystem.gnvl(dgv2.Rows[i].Cells["cComUnitName"].Value, "") + "</TZMS> ";
                    xmlData = xmlData + "</MAIN>";
                    xmlData = xmlData + "</XMLDATA>";

                    resultXMl = SendMessage.SetMessage("YQ001", xmlData);


                    string result = SendMessage.ReadXMl(resultXMl, "HEAD", "ZTCLJG");

                    if (result == "00000")
                    {
                        sql = @" update inventory set cInvDefine10='00000' where cinvcode='" + ClsSystem.gnvl(dgv2.Rows[i].Cells["cinvcode"].Value, "") + "'";
                        SqlAccess.ExecuteSql(sql, Program.ConnectionString);
                    }
                    dgv2.Rows[i].Cells["resultXMl"].Value = ClsSystem.gnvl(result, "");
                }
            }

            this.Cursor = Cursors.Default;
        }
Пример #2
0
        public static bool GetPass(string caccid, string ddate)
        {
            string   sql     = "";
            DateTime dt1     = DateTime.Now;
            DateTime dt2     = Convert.ToDateTime(ddate);
            TimeSpan span    = dt1.Subtract(dt2);
            int      dayDiff = span.Days + 1;

            if (dayDiff >= 30)
            {
                sql = @" update UA_Account_Ex set cFinKind='2' where cAcc_Id='" + caccid + "'";
                SqlAccess.ExecuteSql(sql, Program.ConnectionString);
            }

            sql = @" select cFinKind from UA_Account_Ex where cAcc_Id='" + caccid + "'";
            string result = ClsSystem.gnvl(SqlAccess.ExecuteScalar(sql, Program.ConnectionString), "");

            if (result == "2")
            {
                return(true);
            }
            return(false);
        }
Пример #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            string xmlData = "";
            string sql     = "";
            string sbvid   = "";;
            //  int y = 0;
            DataTable dts = null;

            this.Cursor = Cursors.WaitCursor;
            if (dgv1.Rows.Count > 0)
            {
                for (int i = 0; i < dgv1.Rows.Count; i++)
                {
                    if (ClsSystem.gnvl(this.dgv1.Rows[i].Cells["check"].Value, "").ToUpper() == "TRUE" && ClsSystem.gnvl(this.dgv1.Rows[i].Cells["cdefine25"].Value, "").ToUpper() != "00000")
                    {
                        //yybm= ClsSystem.gnvl(dgv1.Rows[i].Cells["cdefine11"].Value, "");
                        //PSDBM = ClsSystem.gnvl(dgv1.Rows[i].Cells["cDefine32"].Value, "");
                        //if (yybm_O != yybm&&y>0)
                        //{
                        //    MessageBox.Show("请选择同一客户上传", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        //    return;
                        //}
                        //if (PSDBM_O != PSDBM && y > 0)
                        //{
                        //    MessageBox.Show("请选择同一医院配送点编码", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        //    return;
                        //}
                        if (ClsSystem.gnvl(ClsSystem.gnvl(dgv1.Rows[i].Cells["cDefine34"].Value, ""), "") == "")
                        {
                            MessageBox.Show("配送箱数未填入", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return;
                        }
                        if (ClsSystem.gnvl(dgv1.Rows[i].Cells["zxlx"].Value, "") == "")
                        {
                            MessageBox.Show("装箱类型未填入", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return;
                        }
                        //yybm_O = yybm;
                        //PSDBM_O = PSDBM;
                        //y++;
                    }
                }

                //if (count < 1)
                //{
                //    MessageBox.Show("请选择配送数据", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                //    return;
                //}
                for (int j = 0; j < dgv1.Rows.Count; j++)
                {
                    if (ClsSystem.gnvl(this.dgv1.Rows[j].Cells["check"].Value, "").ToUpper() == "TRUE" && ClsSystem.gnvl(this.dgv1.Rows[j].Cells["cdefine25"].Value, "").ToUpper() != "00000")
                    {
                        xmlData = "";
                        xmlData = xmlData + @"<?xml version=""1.0""  encoding=""utf-8""?>";
                        xmlData = xmlData + "<XMLDATA>";
                        xmlData = xmlData + "<HEAD>";
                        xmlData = xmlData + "<IP>" + SendMessage.GetIP() + "</IP> ";
                        xmlData = xmlData + "<MAC>" + SendMessage.GetMAC() + "</MAC> ";
                        xmlData = xmlData + "<BZXX></BZXX> ";
                        xmlData = xmlData + "</HEAD> ";
                        xmlData = xmlData + "<MAIN>";
                        xmlData = xmlData + "<CZLX>1</CZLX> ";
                        xmlData = xmlData + "<PSDH>" + ClsSystem.gnvl(dgv1.Rows[j].Cells["PSDTM"].Value, "") + "</PSDH> ";
                        xmlData = xmlData + "<YQBM>ZDYC0001</YQBM> ";
                        xmlData = xmlData + "<YYBM>" + ClsSystem.gnvl(dgv1.Rows[j].Cells["cdefine11"].Value, "") + "</YYBM> ";
                        xmlData = xmlData + "<PSDBM>" + ClsSystem.gnvl(dgv1.Rows[j].Cells["cDefine32"].Value, "") + "</PSDBM> ";
                        xmlData = xmlData + "<CJRQ>" + DateTime.Today.Year.ToString("0000") + DateTime.Today.Month.ToString("00") + DateTime.Today.Day.ToString("00") + "</CJRQ> ";
                        xmlData = xmlData + "<SDRQ></SDRQ> ";
                        xmlData = xmlData + "<ZXS>" + ClsSystem.gnvl(dgv1.Rows[j].Cells["cdefine34"].Value, "") + "</ZXS> ";
                        xmlData = xmlData + "<JLS>1</JLS> ";
                        xmlData = xmlData + "</MAIN>";
                        xmlData = xmlData + "<DETAIL>";


                        sbvid = ClsSystem.gnvl(this.dgv1.Rows[j].Cells["sbvid"].Value, "");
                        //                        sql = @" select cinvcode,cinvname,cDefine28,iQuantity,cInvDefine3,cDefine29,cDefine30,cBatch ,dMDate ,cExpirationdate ,cSoCode
                        //                     from  Sales_FHD_w  where dlid=" + DLID;

                        //                        dts = SqlAccess.ExecuteSqlDataTable(sql, Program.ConnectionString);

                        //for (int k = 0; k < dts.Rows.Count; k++)
                        //{

                        xmlData = xmlData + "<STRUCT>";

                        xmlData = xmlData + "<PSDTM>" + ClsSystem.gnvl(dgv1.Rows[j].Cells["PSDTM"].Value, "") + "</PSDTM> ";
                        if (ClsSystem.gnvl(dgv1.Rows[j].Cells["zxlx"].Value, "") == "整箱")
                        {
                            xmlData = xmlData + "<ZXLX>1</ZXLX> ";
                        }
                        else
                        {
                            xmlData = xmlData + "<ZXLX>2</ZXLX> ";
                        }
                        xmlData = xmlData + "<SPLX>1</SPLX> ";
                        xmlData = xmlData + "<ZXSPBM>" + ClsSystem.gnvl(dgv1.Rows[j].Cells["cDefine28"].Value, "") + "</ZXSPBM> ";
                        xmlData = xmlData + "<SCPH>" + ClsSystem.gnvl(dgv1.Rows[j].Cells["cBatch"].Value, "") + "</SCPH> ";
                        xmlData = xmlData + "<SCRQ>" + Convert.ToDateTime(dgv1.Rows[j].Cells["dMDate"].Value).Year.ToString("0000") + Convert.ToDateTime(dgv1.Rows[j].Cells["dMDate"].Value).Month.ToString("00") + Convert.ToDateTime(dgv1.Rows[j].Cells["dMDate"].Value).Day.ToString("00") + "</SCRQ> ";
                        xmlData = xmlData + "<YXRQ>" + Convert.ToDateTime(dgv1.Rows[j].Cells["cExpirationdate"].Value).Year.ToString("0000") + Convert.ToDateTime(dgv1.Rows[j].Cells["cExpirationdate"].Value).Month.ToString("00") + Convert.ToDateTime(dgv1.Rows[j].Cells["cExpirationdate"].Value).Day.ToString("00") + "</YXRQ> ";
                        xmlData = xmlData + "<XSDDH>" + ClsSystem.gnvl(dgv1.Rows[j].Cells["iDLsID"].Value, "") + "</XSDDH> ";
                        xmlData = xmlData + "<WLPTDDH></WLPTDDH> ";
                        xmlData = xmlData + "<DDMXBH>" + ClsSystem.gnvl(dgv1.Rows[j].Cells["cDefine29"].Value, "") + "</DDMXBH> ";
                        xmlData = xmlData + "<PSL>" + ClsSystem.gnvl(Public.ChinaRound(Public.GetNum(dgv1.Rows[j].Cells["iNum"].Value), 2), "") + "</PSL> ";
                        xmlData = xmlData + "<CGJLDW>" + ClsSystem.gnvl(dgv1.Rows[j].Cells["cDefine30"].Value, "") + "</CGJLDW> ";

                        xmlData = xmlData + "</STRUCT>";

                        xmlData = xmlData + "</DETAIL>";
                        xmlData = xmlData + "</XMLDATA>";

                        string    iDLsID    = "";
                        string    CLJG      = "";
                        DataSet   ds        = new DataSet();
                        DataTable db        = new DataTable();
                        string    resultXml = SendMessage.SetMessage("YQ003", xmlData);

                        string result = SendMessage.ReadXMl(resultXml, "HEAD", "ZTCLJG");



                        if (result == "00000")
                        {
                            TextReader tdr = new StringReader(resultXml);
                            ds.ReadXml(tdr);
                            //result = "";
                            //result = SendMessage.ReadXMl(resultXml, "MAIN", "JLS");
                            //if (Public.GetNum(result) > 0)
                            //{
                            if (ds.Tables.Count >= 4)
                            {
                                db = ds.Tables[3];

                                for (int k = 0; k < db.Rows.Count; k++)
                                {
                                    // PSDH = ClsSystem.gnvl(db.Rows[j]["PSDH"], "");
                                    iDLsID = ClsSystem.gnvl(db.Rows[k]["XSDDH"], "");
                                    CLJG   = ClsSystem.gnvl(db.Rows[k]["CLJG"], "");
                                    sql    = " update SaleBillVouchs set cdefine25='" + CLJG + "',cDefine23 ='" + ClsSystem.gnvl(dgv1.Rows[j].Cells["zxlx"].Value, "") + "', cDefine34=" + ClsSystem.gnvl(dgv1.Rows[j].Cells["cdefine34"].Value, "") + " where iDLsID =" + iDLsID + "\n";
                                    dgv1.Rows[j].Cells["cdefine25"].Value = CLJG;
                                }
                                SqlAccess.ExecuteSql(sql, Program.ConnectionString);
                            }
                            else
                            {
                                dgv1.Rows[j].Cells["cdefine25"].Value = "错误:未返回明细";
                            }
                        }
                        else
                        {
                            TextReader tdr = new StringReader(resultXml);
                            ds.ReadXml(tdr);

                            if (ds.Tables.Count >= 4)
                            {
                                db = ds.Tables[3];
                            }
                            CLJG = ClsSystem.gnvl(db.Rows[0]["CLJG"], "");
                            string CLQKMS = ClsSystem.gnvl(db.Rows[0]["CLQKMS"], "");
                            dgv1.Rows[j].Cells["cdefine25"].Value = "错误编码:" + CLJG + "错误信息:" + CLQKMS;
                            MessageBox.Show("错误编码:" + CLJG + "错误信息:" + CLQKMS, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return;
                        }
                    }
                }
            }


            this.Cursor = Cursors.Default;
        }
Пример #4
0
        /// <summary>
        /// 上传发票
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            string    xmlData   = "";
            string    resultXMl = "";
            string    sql       = "";
            string    SBVID     = "";
            string    SBVID_o   = "";
            string    yybm      = "";
            string    yybm_O    = "";
            string    PSDBM     = "";
            string    PSDBM_O   = "";
            int       y         = 0;
            int       count     = 0;
            DataTable dts       = null;

            this.Cursor = Cursors.WaitCursor;
            decimal hsje         = 0;
            decimal iInvExchRate = 0;

            if (dgv1.Rows.Count > 0)
            {
                for (int i = 0; i < dgv1.Rows.Count; i++)
                {
                    if (ClsSystem.gnvl(this.dgv1.Rows[i].Cells["cdefine24"].Value, "").ToUpper() == "00000")
                    {
                        continue;
                    }
                    if (ClsSystem.gnvl(this.dgv1.Rows[i].Cells["check"].Value, "").ToUpper() == "TRUE" &&
                        ClsSystem.gnvl(this.dgv1.Rows[i].Cells["cdefine24"].Value, "").ToUpper() != "00000")
                    {
                        yybm  = ClsSystem.gnvl(dgv1.Rows[i].Cells["cdefine11"].Value, "");
                        SBVID = ClsSystem.gnvl(this.dgv1.Rows[i].Cells["SBVID"].Value, "");
                        //PSDBM = ClsSystem.gnvl(this.dgv1.Rows[i].Cells["cDefine32"].Value, "");
                        if (yybm_O != yybm && y > 0)
                        {
                            MessageBox.Show("请选择同一客户上传", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return;
                        }
                        //if (SBVID != SBVID_o && y > 0)
                        //{

                        //    MessageBox.Show("请选择同一发票", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        //    return;
                        //}
                        if (PSDBM_O != PSDBM && y > 0)
                        {
                            MessageBox.Show("请选择同一医院配送点编码", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return;
                        }

                        hsje = hsje + Public.ChinaRound(Public.GetNum(dgv1.Rows[i].Cells["iSum"].Value), 4);

                        yybm_O  = yybm;
                        SBVID_o = SBVID;
                        PSDBM_O = PSDBM;
                        y++;
                        count = i;
                    }
                }
                if (dgv1.Rows.Count > 0)
                {
                    xmlData = "";
                    xmlData = xmlData + @"<?xml version=""1.0""  encoding=""utf-8""?>";
                    xmlData = xmlData + "<XMLDATA>";
                    xmlData = xmlData + "<HEAD>";
                    xmlData = xmlData + "<IP>" + SendMessage.GetIP() + "</IP> ";
                    xmlData = xmlData + "<MAC>" + SendMessage.GetMAC() + "</MAC> ";
                    xmlData = xmlData + "<BZXX></BZXX> ";
                    xmlData = xmlData + "</HEAD> ";
                    xmlData = xmlData + "<MAIN>";
                    xmlData = xmlData + "<CZLX>1</CZLX> ";

                    xmlData = xmlData + "<YQBM>ZDYC0001</YQBM> ";
                    xmlData = xmlData + "<YYBM>" + ClsSystem.gnvl(dgv1.Rows[count].Cells["cdefine11"].Value, "") + "</YYBM> ";
                    xmlData = xmlData + "<PSDBM>" + ClsSystem.gnvl(dgv1.Rows[count].Cells["cDefine32"].Value, "") + "</PSDBM> ";

                    xmlData = xmlData + "<JLS>" + y.ToString() + "</JLS> ";
                    xmlData = xmlData + "</MAIN>";
                    xmlData = xmlData + "<DETAIL>";

                    for (int i = 0; i < dgv1.Rows.Count; i++)
                    {
                        WriteU8BVCode(i);
                        if (ClsSystem.gnvl(this.dgv1.Rows[i].Cells["check"].Value, "").ToUpper() == "TRUE" && ClsSystem.gnvl(this.dgv1.Rows[i].Cells["cDefine24"].Value, "").ToUpper() != "00000")
                        {
                            SBVID        = ClsSystem.gnvl(this.dgv1.Rows[i].Cells["SBVID"].Value, "");
                            iInvExchRate = Public.GetNum(dgv1.Rows[i].Cells["iInvExchRate"].Value);

                            //   dts = SqlAccess.ExecuteSqlDataTable(sql, Program.ConnectionString);

                            xmlData = xmlData + "<STRUCT>";

                            xmlData = xmlData + "<FPH>" + ClsSystem.gnvl(this.dgv1.Rows[i].Cells["cSBVCode"].Value, "") + "</FPH> ";


                            xmlData = xmlData + "<FPRQ>" + Convert.ToDateTime(dgv1.Rows[i].Cells["dDate"].Value).Year.ToString("0000") + Convert.ToDateTime(dgv1.Rows[i].Cells["dDate"].Value).Month.ToString("00") + Convert.ToDateTime(dgv1.Rows[i].Cells["dDate"].Value).Day.ToString("00") + "</FPRQ> ";
                            xmlData = xmlData + "<FPHSZJE>" + ClsSystem.gnvl(hsje, "0") + "</FPHSZJE>";
                            xmlData = xmlData + "<DLCGBZ>0</DLCGBZ> ";
                            xmlData = xmlData + "<FPBZ>" + ClsSystem.gnvl(this.dgv1.Rows[i].Cells["cMemo"].Value, "") + "</FPBZ> ";
                            xmlData = xmlData + "<GLMXBH>" + ClsSystem.gnvl(dgv1.Rows[i].Cells["cDefine29"].Value, "") + "</GLMXBH> ";
                            xmlData = xmlData + "<XSDDH>" + ClsSystem.gnvl(dgv1.Rows[i].Cells["iDLsID"].Value, "") + "</XSDDH> ";
                            xmlData = xmlData + "<SPLX>1</SPLX> ";

                            xmlData = xmlData + "<SFCH>" + ClsSystem.gnvl(dgv1.Rows[i].Cells["bReturnFlag"].Value, "") + "</SFCH> ";

                            if (ClsSystem.gnvl(dgv1.Rows[i].Cells["bReturnFlag"].Value, "") == "1")
                            {
                                xmlData = xmlData + "<GLBZ>0</GLBZ> ";
                            }
                            else
                            {
                                xmlData = xmlData + "<GLBZ>1</GLBZ> ";
                            }
                            xmlData = xmlData + "<WFGLSM></WFGLSM> ";
                            xmlData = xmlData + "<ZXSPBM>" + ClsSystem.gnvl(dgv1.Rows[i].Cells["cDefine28"].Value, "") + "</ZXSPBM> ";
                            xmlData = xmlData + "<SCPH>" + ClsSystem.gnvl(dgv1.Rows[i].Cells["cBatch"].Value, "") + "</SCPH> ";
                            xmlData = xmlData + "<PZWH>" + ClsSystem.gnvl(dgv1.Rows[i].Cells["cFile"].Value, "") + "</PZWH> ";
                            xmlData = xmlData + "<SPSL>" + ClsSystem.gnvl(dgv1.Rows[i].Cells["iNum"].Value, "") + "</SPSL> ";
                            xmlData = xmlData + "<CGJLDW>" + ClsSystem.gnvl(dgv1.Rows[i].Cells["cDefine30"].Value, "") + "</CGJLDW> ";
                            xmlData = xmlData + "<SCRQ>" + Convert.ToDateTime(dgv1.Rows[i].Cells["dMDate"].Value).Year.ToString("0000") + Convert.ToDateTime(dgv1.Rows[i].Cells["dMDate"].Value).Month.ToString("00") + Convert.ToDateTime(dgv1.Rows[i].Cells["dMDate"].Value).Day.ToString("00") + "</SCRQ> ";
                            xmlData = xmlData + "<YXRQ>" + Convert.ToDateTime(dgv1.Rows[i].Cells["cExpirationdate"].Value).Year.ToString("0000") + Convert.ToDateTime(dgv1.Rows[i].Cells["cExpirationdate"].Value).Month.ToString("00") + Convert.ToDateTime(dgv1.Rows[i].Cells["cExpirationdate"].Value).Day.ToString("00") + "</YXRQ> ";
                            xmlData = xmlData + "<WSDJ>" + ClsSystem.gnvl(Public.ChinaRound(Public.GetNum(dgv1.Rows[i].Cells["iUnitPrice"].Value), 4), "") + "</WSDJ> ";
                            xmlData = xmlData + "<HSDJ>" + ClsSystem.gnvl(Public.ChinaRound(Public.GetNum(dgv1.Rows[i].Cells["iTaxUnitPrice"].Value), 4), "") + "</HSDJ> ";
                            xmlData = xmlData + "<SL>" + ClsSystem.gnvl(Public.ChinaRound(Public.GetNum(dgv1.Rows[i].Cells["iTaxRate"].Value), 4), "") + "</SL> ";
                            xmlData = xmlData + "<SE>" + ClsSystem.gnvl(Public.ChinaRound(Public.GetNum(dgv1.Rows[i].Cells["iTax"].Value), 4), "") + "</SE> ";
                            xmlData = xmlData + "<WSJE>" + ClsSystem.gnvl(Public.ChinaRound(Public.GetNum(dgv1.Rows[i].Cells["iMoney"].Value), 4), "") + "</WSJE> ";
                            xmlData = xmlData + "<HSJE>" + ClsSystem.gnvl(Public.ChinaRound(Public.GetNum(dgv1.Rows[i].Cells["iSum"].Value), 4), "") + "</HSJE> ";

                            xmlData = xmlData + "<PFJ>" + ClsSystem.gnvl(Public.ChinaRound(Public.GetNum(dgv1.Rows[i].Cells["iQuotedPrice"].Value), 4), "") + "</PFJ> ";
                            xmlData = xmlData + "<LSJ>" + ClsSystem.gnvl(Public.ChinaRound(Public.GetNum(dgv1.Rows[i].Cells["fRetailPrice"].Value), 4), "") + "</LSJ> ";

                            xmlData = xmlData + "</STRUCT>";
                        }
                    }
                    xmlData = xmlData + "</DETAIL>";
                    xmlData = xmlData + "</XMLDATA>";
                }
                DataSet   ds        = new DataSet();
                DataTable db        = null;
                string    iDLsID    = "";
                string    CLJG      = "";
                string    resultXml = SendMessage.SetMessage("YQ004", xmlData);
                string    result    = SendMessage.ReadXMl(resultXml, "HEAD", "ZTCLJG");
                if (result == "00000")
                {
                    try
                    {
                        TextReader tdr = new StringReader(resultXml);
                        ds.ReadXml(tdr);
                        if (ds.Tables.Count == 3)
                        {
                            db = ds.Tables[2];
                            for (int j = 0; j < db.Rows.Count; j++)
                            {
                                iDLsID = ClsSystem.gnvl(db.Rows[j]["XSDDH"], "");
                                CLJG   = ClsSystem.gnvl(db.Rows[j]["CLJG"], "");

                                sql = sql + " update SaleBillVouchs set cdefine24='" + CLJG + "' where iDLsID=" + iDLsID + "\n";
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                    }
                }
                else
                {
                    TextReader tdr = new StringReader(resultXml);
                    ds.ReadXml(tdr);
                    string CLQKMS = "";
                    if (ds.Tables.Count == 3)
                    {
                        db     = ds.Tables[2];
                        CLJG   = ClsSystem.gnvl(db.Rows[0]["CLJG"], "");
                        CLQKMS = ClsSystem.gnvl(db.Rows[0]["CLQKMS"], "");
                    }
                    //dgv1.Rows[i].Cells["cdefine24"].Value = "错误编码:" + CLJG + "错误信息:" + CLQKMS;

                    string CWXX = SendMessage.ReadXMl(resultXml, "HEAD", "CWXX");
                    MessageBox.Show("错误编码:" + result + "错误信息:" + CWXX + "\n\r" + CLQKMS, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                    //MessageBox.Show("错误编码:" + ClsSystem.gnvl(ds.Tables[0].Rows[0]["ZTCLJG"], "") + "错误信息:" + ClsSystem.gnvl(ds.Tables[0].Rows[0]["CWXX"], ""), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    //return;
                }
                try
                {
                    SqlAccess.ExecuteSql(sql, Program.ConnectionString);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                this.Cursor = Cursors.Default;
            }
        }
Пример #5
0
        private void button1_Click(object sender, EventArgs e)
        {
            string    xmlData   = "";
            string    resultXMl = "";
            string    sql       = "";
            string    SBVID     = "";
            string    SBVID_o   = "";
            string    yybm      = "";
            string    yybm_O    = "";
            string    PSDBM     = "";
            string    PSDBM_O   = "";
            int       y         = 0;
            int       count     = 0;
            DataTable dts       = null;

            this.Cursor = Cursors.WaitCursor;
            decimal hsje = 0;

            if (dgv1.Rows.Count > 0)
            {
                if (dgv1.Rows.Count > 0)
                {
                    xmlData = "";
                    xmlData = xmlData + @"<?xml version=""1.0""  encoding=""utf-8""?>";
                    xmlData = xmlData + "<XMLDATA>";
                    xmlData = xmlData + "<HEAD>";
                    xmlData = xmlData + "<IP>" + SendMessage.GetIP() + "</IP> ";
                    xmlData = xmlData + "<MAC>" + SendMessage.GetMAC() + "</MAC> ";
                    xmlData = xmlData + "<BZXX></BZXX> ";
                    xmlData = xmlData + "</HEAD> ";
                    xmlData = xmlData + "<MAIN>";
                    xmlData = xmlData + "<YQBM>ZDYC0001</YQBM> ";
                    xmlData = xmlData + "<YYBM>" + ClsSystem.gnvl(dgv1.Rows[count].Cells["cdefine11"].Value, "") + "</YYBM> ";
                    xmlData = xmlData + "<FPH>" + ClsSystem.gnvl(dgv1.Rows[count].Cells["cSBVCode"].Value, "") + "</FPH> ";

                    xmlData = xmlData + "<FPHSZJE>" + ClsSystem.gnvl(SqlAccess.ExecuteScalar(" select isnull(sum(iSum),0) from SaleBillVouchs where  sbvid=" + ClsSystem.gnvl(dgv1.Rows[count].Cells["sbvid"].Value, ""), Program.ConnectionString), "") + "</FPHSZJE> ";
                    xmlData = xmlData + "</MAIN>";

                    xmlData = xmlData + "</XMLDATA>";
                }
                DataSet   ds        = new DataSet();
                DataTable db        = null;
                string    iDLsID    = "";
                string    CLJG      = "";
                string    resultXml = SendMessage.SetMessage("YQ016", xmlData);
                string    result    = SendMessage.ReadXMl(resultXml, "HEAD", "ZTCLJG");
                if (result == "00000")
                {
                    sql = " update SaleBillVouch set cdefine9='" + result + "' where cSBVCode='" + ClsSystem.gnvl(dgv1.Rows[count].Cells["cSBVCode"].Value, "") + "'\n";
                }
                else
                {
                    //TextReader tdr = new StringReader(resultXml);
                    //ds.ReadXml(tdr);

                    //if (ds.Tables.Count >= 4)
                    //{
                    //    db = ds.Tables[2];
                    //}
                    //CLJG = ClsSystem.gnvl(db.Rows[0]["CLJG"], "");
                    //string CLQKMS = ClsSystem.gnvl(db.Rows[0]["CLQKMS"], "");
                    //    dgv1.Rows[i].Cells["cdefine24"].Value = "错误编码:" + CLJG + "错误信息:" + CLQKMS;

                    string CWXX = SendMessage.ReadXMl(resultXml, "HEAD", "CWXX");
                    MessageBox.Show("错误编码:" + result + "错误信息:" + CWXX, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                    //MessageBox.Show("错误编码:" + ClsSystem.gnvl(ds.Tables[0].Rows[0]["ZTCLJG"], "") + "错误信息:" + ClsSystem.gnvl(ds.Tables[0].Rows[0]["CWXX"], ""), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    //return;
                }
                SqlAccess.ExecuteSql(sql, Program.ConnectionString);

                this.Cursor = Cursors.Default;
            }
        }