Ejemplo n.º 1
0
 public static void PrintByPrinterName(TfrxReportClass report, string printerName)
 {
     report.ShowProgress             = false;
     report.PrintOptions.ShowDialog  = false;
     report.PrintOptions.PageNumbers = "";
     report.PrintOptions.Printer     = printerName;
     report.PrepareReport(true);
     report.PrintReport();
     report.ClearDatasets();
     report.ClearReport();
 }
Ejemplo n.º 2
0
        private void printpq(string ph, string gg, string pch, string jz, string rq, string bb, string gh, string bz, string xlh, string tm, string sx, string pcxx, bool ckflg, string itype, string wlh, string heatid, string liaohao)
        {
            string  scriptstr = "";
            DataSet ds        = null;
            string  sqlstr    = "";
            Boolean nocheck   = false;
            string  printmodual;
            string  stpath;
            string  bzstr;
            string  tct;
            string  SX = cmbsx.Text;

            //if (SX == "") return;
            printmodual = Public.GetXmlValue("PrintModuleName");
            if (printmodual == "")
            {
                printmodual = "标准模板";
            }
            stpath = Application.StartupPath + "\\report\\" + printmodual + "\\";
            if (!Directory.Exists(stpath))
            {
                MessageBox.Show("标签模板不存在!", "系统提示");
                return;
            }
            if ((SX == "B2") || (SX == "C2"))
            {
                nocheck = false;
            }
            else
            {
                nocheck = true;
            }
            scriptstr = "begin" + "\r\n";
            if (SX == "CK")
            {
                Report.LoadReportFromFile(stpath + "ckcz.fr3");
                scriptstr += "memspec.Text:='" + pcxx + "';";
                if (PrintPCInfoCheckBox.Checked)
                {
                    scriptstr += "memspec.visible:=true;";
                }
                else
                {
                    scriptstr += "memspec.visible:=false;";
                }
            }
            else
            {
                switch (itype)
                {
                case "1":
                    Report.LoadReportFromFile(stpath + "ptcz1.fr3");
                    break;

                case "2":
                    Report.LoadReportFromFile(stpath + "ptcz2.fr3");
                    scriptstr += "memosx.text:='" + sx.Substring(0, 3) + "';";
                    if (!nocheck)
                    {
                        scriptstr += "memosx.visible:=false;";
                        scriptstr += "Shape1.visible:=false;";
                    }
                    else
                    {
                        scriptstr += "memosx.visible:=true;";
                        scriptstr += "Shape1.visible:=true;";
                    }
                    break;

                case "3":
                    Report.LoadReportFromFile(stpath + "ptcz3.fr3");
                    scriptstr += "memopcinfo.text:='" + pcxx + "';";
                    if (!nocheck)
                    {
                        scriptstr += "memopcinfo.visible:=false;";
                    }
                    else
                    {
                        scriptstr += "memopcinfo.visible:=true;";
                    }
                    break;

                case "4":
                    Report.LoadReportFromFile(stpath + "ptcz4.fr3");
                    scriptstr += "memopcinfo.text:='" + pcxx + "';";
                    if (!nocheck)
                    {
                        scriptstr += "memopcinfo.visible:=false;";
                        scriptstr += "Shape1.visible:=false;";
                    }
                    else
                    {
                        scriptstr += "memopcinfo.visible:=true;";
                        scriptstr += "Shape1.visible:=true;";
                    }
                    break;
                }
            }
            scriptstr += "Barcode1.text:='" + tm + "';";
            scriptstr += "memoph.text:='" + ph + "';";
            scriptstr += "memogg.text:='" + gg + "';";
            scriptstr += "memopch.text:='" + pch + "';";
            //scriptstr += "memojhzt.text:='" + getjhzt(wlh) + "';";
            double fjz = Math.Round(float.Parse(jz) * 1000, 1);

            scriptstr += "memojz.text:='" + fjz.ToString() + " kg';";
            scriptstr += "memorq.text:='" + rq + "';";
            scriptstr += "memogh.text:='" + gh + "';";
            //string bbtemp = "";
            //if (bb == "甲班") bbtemp = "A";
            //if (bb == "乙班") bbtemp = "B";
            //if (bb == "丙班") bbtemp = "C";
            //if (bb == "丁班") bbtemp = "D";
            //scriptstr += "memobb.text:='" + bbtemp + "';";

            if (liaohao != "")
            {
                string sql = " SELECT invinfo.WGDH FROM WMS_Bms_Inv_Info AS invinfo LEFT OUTER JOIN WMS_Bms_Rec_WGD AS wgd ON invinfo.PCH = wgd.PCH WHERE (invinfo.WLH = wgd.YWLH) AND (invinfo.vfree1 = wgd.vfree1) AND ";

                sql += "  (wgd.yvfree1 = wgd.vfree1) AND (invinfo.vfree2 = wgd.vfree2) AND  (wgd.yvfree2 = wgd.vfree2) AND (invinfo.vfree3 = wgd.vfree3) AND (wgd.yvfree3 = wgd.vfree3) AND (invinfo.SX IN ('AAA', 'AA', 'A', 'CK')) AND ";
                sql += " invinfo.barcode='" + lbbarcode.Text.Trim() + "'";
                DataSet dstable = DbEntry.Context.ExecuteDataset(sql);
                if ((dstable == null) || (dstable.Tables.Count == 0) || dstable.Tables[0].Rows.Count == 0)
                {
                    liaohao = "";
                }
            }

            if (liaohao != "")
            {
                scriptstr += "Memliao.text:='" + liaohao + "';";
                scriptstr += "Memliao.visible:=true;";
                scriptstr += "memliao1.visible:=true;";
                scriptstr += "Lineliao.visible:=true;";
            }

            //修改添加 炉次 删除班别
            scriptstr += "memobb.text:='" + heatid + "';";


            if (SX != "CK")
            {
                string bzstrf = "";
                bzstrf     = bz.Substring(bz.IndexOf('~') + 1);
                scriptstr += "memobz.text:='" + bzstrf + "';";
            }
            else
            {
                scriptstr += "memoxlh.text:='" + xlh + "';";
            }
            scriptstr        += "memowlh.text:='" + wlh.Substring(0, 3) + "';";
            scriptstr        += "end.";
            Report.ScriptText = scriptstr;

            Report.PrepareReport(true);



            int con = 2;

            Report.PrintOptions.ShowDialog = false;
            Report.PrintOptions.Copies     = con;

            try
            {
                Report.PrintReport();
            }
            catch (System.Exception ex)
            {
                MessageBox.Show("打印错误:" + ex.Message + ".请补打!");
            }
        }
Ejemplo n.º 3
0
        private void printpq(string barcode, string strJz)
        {
            string scriptstr = "";
            string ph, gg, pch, jz, rq, bb, gh, bz, xlh, tm, ckcxh, sx, pcxx, bzstr, bbtemp, printmodual, stpath, tct, wlh;
            bool   ckflg, nocheck;
            int    iType;

            if (chkTSXX.Checked)
            {
                if (chkCPDJ.Checked)
                {
                    iType = 4;
                }
                else
                {
                    iType = 3;
                }
            }
            else
            {
                if (chkCPDJ.Checked)
                {
                    iType = 2;
                }
                else
                {
                    iType = 1;
                }
            }
            printmodual = Public.GetXmlValue("PrintModuleName");
            if (printmodual == "")
            {
                printmodual = "标准模板";
            }
            stpath = Application.StartupPath + "\\report\\" + printmodual + "\\";
            if (!Directory.Exists(stpath))
            {
                MessageBox.Show("标签模板不存在!", "系统提示");
                return;
            }



            string  strSql = "select * from " + tablename + " where barcode='" + barcode.Trim() + "'";
            DataSet ds     = DbEntry.Context.ExecuteDataset(strSql);

            ph   = ds.Tables[0].Rows[0]["PH"].ToString();
            gg   = ds.Tables[0].Rows[0]["GG"].ToString();
            pch  = ds.Tables[0].Rows[0]["PCH"].ToString();
            jz   = strJz;
            rq   = ds.Tables[0].Rows[0]["ProduceData"].ToString();
            bb   = ds.Tables[0].Rows[0]["bb"].ToString();
            pcxx = ds.Tables[0].Rows[0]["pcinfo"].ToString();
            gh   = Convert.ToInt32(ds.Tables[0].Rows[0]["gh"]).ToString().PadLeft(2, '0');
            sx   = ds.Tables[0].Rows[0]["SX"].ToString();
            if (sx.ToUpper() == "CK")
            {
                bz = ds.Tables[0].Rows[0]["GH"].ToString().PadLeft(2, '0');
            }
            else
            {
                bz = ds.Tables[0].Rows[0]["bz"].ToString();
            }
            xlh   = this.txtLSH.Text;
            tm    = barcode;
            wlh   = ds.Tables[0].Rows[0]["wlh"].ToString();
            ckcxh = ds.Tables[0].Rows[0]["ckcxh"].ToString();

            if ((sx == "B2") || (sx == "C2"))
            {
                nocheck = false;
            }
            else
            {
                nocheck = true;
            }

            TfrxReportClass Report = new TfrxReportClass();

            scriptstr = "begin" + "\r\n";
            if (sx == "CK")
            {
                Report.LoadReportFromFile(stpath + "ckcz.fr3");
                scriptstr += "memspec.Text:='" + pcxx + "';";
                if (this.chkTSXX.Checked)
                {
                    scriptstr += "memspec.visible:=true;";
                }
                else
                {
                    scriptstr += "memspec.visible:=false;";
                }
            }
            else
            {
                switch (iType)
                {
                case 1:
                    Report.LoadReportFromFile(stpath + "ptcz1.fr3");
                    break;

                case 2:
                    Report.LoadReportFromFile(stpath + "ptcz2.fr3");
                    scriptstr += "memosx.text:='" + sx + "';";
                    if (!nocheck)
                    {
                        scriptstr += "memosx.visible:=false;";
                        scriptstr += "Shape1.visible:=false;";
                    }
                    else
                    {
                        scriptstr += "memosx.visible:=true;";
                        scriptstr += "Shape1.visible:=true;";
                    }
                    break;

                case 3:
                    Report.LoadReportFromFile(stpath + "ptcz3.fr3");
                    scriptstr += "memopcinfo.text:='" + pcxx + "';";
                    if (!nocheck)
                    {
                        scriptstr += "memopcinfo.visible:=false;";
                    }
                    else
                    {
                        scriptstr += "memopcinfo.visible:=true;";
                    }
                    break;

                case 4:
                    Report.LoadReportFromFile(stpath + "ptcz4.fr3");
                    scriptstr += "memopcinfo.text:='" + pcxx + "';";
                    if (!nocheck)
                    {
                        scriptstr += "memopcinfo.visible:=false;";
                        scriptstr += "Shape1.visible:=false;";
                    }
                    else
                    {
                        scriptstr += "memopcinfo.visible:=true;";
                        scriptstr += "Shape1.visible:=true;";
                    }
                    break;
                }
            }

            scriptstr += "Barcode1.text:='" + tm + "';";
            scriptstr += "memoph.text:='" + ph + "';";
            scriptstr += "memogg.text:='" + gg + "';";
            scriptstr += "memopch.text:='" + pch + "';";
            double fjz = Convert.ToDouble(jz);;

            scriptstr += "memojz.text:='" + fjz.ToString() + " kg';";
            scriptstr += "memorq.text:='" + rq + "';";
            scriptstr += "memogh.text:='" + gh + "';";
            //bbtemp = "";
            //if (bb == "甲班") bbtemp = "A";
            //if (bb == "乙班") bbtemp = "B";
            //if (bb == "丙班") bbtemp = "C";
            //if (bb == "丁班") bbtemp = "D";
            //scriptstr += "memobb.text:='" + bbtemp + "';";

            //如果炉号为空,则再次查询nc
            if (txtheatid.Text.Trim() == "")
            {
                string loadSql = "";
                loadSql += "select mm_wr_b.pch,getbilletbatchcode(mm_wr_b.pch) billet_heat_number,";
                loadSql += " mm_po.xsddh customer_material_number";
                loadSql += " from mm_wr_b mm_wr_b, mm_mo mm_mo, mm_mosource mm_mosource, mm_po mm_po";
                loadSql += "  where mm_wr_b.scddid = mm_mo.pk_moid and mm_mo.pk_moid = mm_mosource.scddid";
                loadSql += "  and mm_mosource.lyid = mm_po.pk_poid  and mm_po.pk_corp = '1001'";
                loadSql += " and mm_po.dr = 0  and mm_mosource.pk_corp = '1001' and mm_mosource.dr = 0 ";
                loadSql += "  and mm_mo.pk_corp = '1001' and mm_mo.dr = 0 and mm_wr_b.pk_corp = '1001'";
                loadSql += "  and mm_wr_b.dr = 0  and mm_wr_b.pch = '" + pch + "'";
                //OracleConnection conn = new OracleConnection("Data Source=192.168.2.221/orcl;User ID=nctest;Password=nctest;");

                //OracleConnection conn = new OracleConnection("Data Source=nctest;User ID=nctest;Password=nctest;");
                OracleConnection conn = new OracleConnection("Data Source=ncv5;User ID=xgerp50;Password=xgerp204212350;");
                conn.Open();
                OracleCommand selectCmd = conn.CreateCommand();
                selectCmd.CommandText = loadSql;
                // selectCmd.BindByName = true;

                OracleDataAdapter oradap = new OracleDataAdapter(selectCmd);
                DataSet           ds1    = new DataSet();
                oradap.Fill(ds1);
                conn.Close();
                if (ds1 == null || ds1.Tables.Count == 0 || ds1.Tables[0].Rows.Count == 0)
                {
                }
                else
                {
                    txtheatid.Text   = ds1.Tables[0].Rows[0]["billet_heat_number"].ToString();
                    txtGgHeatid.Text = ds1.Tables[0].Rows[0]["billet_heat_number"].ToString();
                    txtliaohao.Text  = ds1.Tables[0].Rows[0]["customer_material_number"].ToString();
                }
            }


            //库内补打 料号判断  异常情况料号置空
            if ((txtliaohao.Text.ToString().Trim() != "") && (tablename == "WMS_Bms_Inv_Info"))
            {
                string sql = " SELECT invinfo.WGDH FROM WMS_Bms_Inv_Info AS invinfo LEFT OUTER JOIN WMS_Bms_Rec_WGD AS wgd ON invinfo.PCH = wgd.PCH WHERE (invinfo.WLH = wgd.YWLH) AND (invinfo.vfree1 = wgd.vfree1) AND ";

                sql += "  (wgd.yvfree1 = wgd.vfree1) AND (invinfo.vfree2 = wgd.vfree2) AND  (wgd.yvfree2 = wgd.vfree2) AND (invinfo.vfree3 = wgd.vfree3) AND (wgd.yvfree3 = wgd.vfree3) AND (invinfo.SX IN ('AAA', 'AA', 'A', 'CK')) AND ";
                sql += " invinfo.barcode='" + barcode.Trim() + "'";
                DataSet dstable = DbEntry.Context.ExecuteDataset(sql);
                if ((dstable == null) || (dstable.Tables.Count == 0) || dstable.Tables[0].Rows.Count == 0)
                {
                    txtliaohao.Text = "";
                }
            }

            if (txtliaohao.Text.ToString().Trim() != "")
            {
                scriptstr += "Memliao.text:='" + txtliaohao.Text.ToString().Trim() + "';";
                scriptstr += "Memliao.visible:=true;";
                scriptstr += "memliao1.visible:=true;";
                scriptstr += "Lineliao.visible:=true;";
            }

            //修改添加 炉次 删除班别
            scriptstr += "memobb.text:='" + txtheatid.Text.ToString().Trim() + "';";


            if (sx != "CK")
            {
                string bzstrf = "";
                bzstrf     = bz.Substring(bz.IndexOf('~') + 1);
                scriptstr += "memobz.text:='" + bzstrf + "';";
            }
            else
            {
                scriptstr += "memoxlh.text:='" + xlh + "';";
            }
            scriptstr        += "memowlh.text:='" + wlh.Substring(0, 3) + "';";
            scriptstr        += "end.";
            Report.ScriptText = scriptstr;
            Report.PrepareReport(true);
            int con = 2;

            if (this.numTxt.Value > 0)
            {
                con = int.Parse(numTxt.Value.ToString());
            }
            Report.PrintOptions.ShowDialog = false;
            Report.PrintOptions.Copies     = con;
            try
            {
                if (this.chkBowse.Checked)
                {
                    Report.ShowReport();
                }
                else
                {
                    Report.PrintReport();
                }
            }
            catch (System.Exception ex)
            {
                MessageBox.Show("打印错误:" + ex.Message + ".请补打!");
            }
        }
Ejemplo n.º 4
0
 public static void Design(TfrxReportClass report)
 {
     report.PrepareReport(true);
     report.DesignReport();
 }
Ejemplo n.º 5
0
 public static void Preview(TfrxReportClass report)
 {
     report.PrepareReport(true);
     report.ShowReport();
 }