| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754 |
- using Core.Mes.Client.Comm.Control;
- using Core.Mes.Client.Comm.Format;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.Judge.Commons;
- using Core.StlMes.Client.Judge.Models;
- using Core.StlMes.Client.Judge.ViewModels;
- using CoreFS.CA06;
- using Infragistics.Win;
- using Infragistics.Win.UltraWinEditors;
- using Infragistics.Win.UltraWinGrid;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Data;
- using System.Diagnostics;
- using System.Drawing;
- using System.Drawing.Printing;
- //using Spire.Pdf;
- using System.IO;
- using System.Linq;
- using System.Net;
- using System.Windows.Forms;
- namespace Core.StlMes.Client.Judge.Forms
- {
- public partial class QcmJyQueryFrmXD : FrmBase
- {
- /// <summary>
- /// 登入用户的销售组织权限
- /// </summary>
- //private string[] _salgPermissions;
- public QcmJyQueryFrmXD()
- {
- InitializeComponent();
- this.IsLoadUserView = true;
- }
- private void QcmJyQueryFrmXD_Load(object sender, EventArgs e)
- {
- InitDate();
- //_salgPermissions = BaseMethod.InitPermissions(this.ValidDataPurviewIds, ob);
- EntityHelper.ShowGridCaption<YdmZcOutlistEntity>(ultraGridOrder.DisplayLayout.Bands[0]);
- EntityHelper.ShowGridCaption<YdmZcOutlistEntity>(ultraGridJustNo.DisplayLayout.Bands[0]);
- EntityHelper.ShowGridCaption<QcmJyPathEntity>(ultraGrid1.DisplayLayout.Bands[0]);
- //BaseMethod.setOtherColumnReadOnly(ultraGridOrder, new string[] { "CHC", "ZbsFlag", "AskSubItmeVal", "MetricSystem", "LicenseNo", "CraftNo", "CheckNo", "ZbsName" });
- //BaseMethod.InitCellPosition(ultraGridOrder, new string[] { "PlanWt", "PlanNum", "ActWt", "ActNum", "DelvryQty", "WgtEstmt" });
- //BaseMethod.InitCellPosition(ultraGridJustNo, new string[] { "ActLenMin", "ActLenMax", "ActCount", "ActWeight", "ActCountLoad", "ActWeightLoad", "ActCountKc", "ActWeightKc", "SendNum" });
- //UltraComboEditor uceAbc = new UltraComboEditor();
- //ultraGridOrder.DisplayLayout.Bands[0].Columns["ZbsFlag"].EditorComponent = uceAbc;
- //ultraGridOrder.DisplayLayout.Bands[0].Columns["ZbsFlag"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
- //ValueList vlistSteel = new ValueList();
- //vlistSteel.ValueListItems.Insert(0, "2", "老系统打印");
- //vlistSteel.ValueListItems.Insert(1, "0", "未打印");
- //vlistSteel.ValueListItems.Insert(2, "1", "已打印");
- //ultraGridOrder.DisplayLayout.Bands[0].Columns["ZbsFlag"].ValueList = vlistSteel;
- //查询语言要求
- //DataTable dt1 = ServerHelper.GetData("com.steering.pss.judge.DAL.QcmZbsQueryFrm.getOrderAskSub", new object[] { "12100704" }, ob);
- //comAsk.DataSource = dt1;
- //comAsk.DisplayMember = "ASK_ITEM_DESC";
- //comAsk.ValueMember = "ASK_ITEM_NO";
- //查询许可证号
- //DataTable dt2 = ServerHelper.GetData("com.steering.pss.judge.DAL.QcmZbsQueryFrm.querySendPlan", new object[] { "4102" }, ob);
- //ultraComboEditor2.DataSource = dt2;
- //ultraComboEditor2.DisplayMember = "BASENAME";
- //ultraComboEditor2.ValueMember = "BASECODE";
- ////查询检验号
- //DataTable dt3 = ServerHelper.GetData("com.steering.pss.judge.DAL.QcmZbsQueryFrm.querySendPlan", new object[] { "4103" }, ob);
- //ultraComboEditor4.DataSource = dt3;
- //ultraComboEditor4.DisplayMember = "BASENAME";
- //ultraComboEditor4.ValueMember = "BASECODE";
- }
- private void ChcCheckedChanged(object sender, EventArgs e)
- {
-
- if (ChcOrderNo.Checked)
- {
- TxtOrderNo.Enabled = true;
- }
- else
- {
- TxtOrderNo.Enabled = false;
- }
- if (ChcTime.Checked)
- {
- TimeBegin.Enabled = true;
- TimeEnd.Enabled = true;
- }
- else
- {
- TimeEnd.Enabled = false;
- TimeBegin.Enabled = false;
- }
- if (ChcStatus.Checked) { ComStatus.Enabled = true; } else { ComStatus.Enabled = false; }
- }
- /// <summary>
- /// 初始时间
- /// </summary>
- private void InitDate()
- {
- DateTime now = DateTime.Now;
- DateTime dt1 = new DateTime(now.Year, now.Month, 1);//当月第一天
- DateTime dt2 = dt1.AddMonths(1).AddDays(-1);//当月最后一天
- TimeBegin.Value = DateTime.Parse(dt1.ToString("yyyy-MM-dd") + " 00:00:00");
- TimeEnd.Value = DateTime.Parse(dt2.ToString("yyyy-MM-dd") + " 23:59:59");
- }
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "Query":
- DoQuery();
- break;
- case "Update":
- DoUpdate();
- break;
- case "Print":
- printData();
- break;
-
- case "Close":
- this.Close();
- break;
- }
- }
- private ArrayList ingname = new ArrayList();
-
- /// <summary>
- /// 检验报告打印预览
- /// </summary>
- private void printData()
- {
- ultraGridOrder.UpdateData();
- ultraGridJustNo.UpdateData();
- UltraGridRow row = ultraGridOrder.ActiveRow;
- string orderNo = row.Cells["OrderNo"].Text.ToString();
- string year = DateTime.Now.Year.ToString();
- string seq = "";
- if (row == null) return;
- DataTable ds = ServerHelper.GetData("com.steering.pss.judge.DAL.QcmJyQueryFrm.doQueryJyYearSeq", new object[] { year }, ob);
- seq = ds.Rows[0]["SEQ"].ToString();
- //保存
- ArrayList list = new ArrayList();
- list.Add(year);
- list.Add(seq);
- list.Add(orderNo);
- ArrayList parm = new ArrayList();
- IQueryable<UltraGridRow> checkMagRows = this.ultraGridJustNo.Rows.AsQueryable().Where(" CHK = 'True'");
- foreach (UltraGridRow uRow in checkMagRows)
- {
- YdmZcOutlistEntity matZcEntity = (YdmZcOutlistEntity)uRow.ListObject;
- string matZcTity = JSONFormat.Format(matZcEntity);
- parm.Add(matZcTity);
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.judge.DAL.QcmJyQueryFrm";
- ccp.MethodName = "doAddJyReportXD";
- ccp.ServerParams = new object[] { list, parm,"1" };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- //if (ccp.ReturnCode == -1) return;
- if (ccp.ReturnInfo.Equals("保存成功!"))
- {
- string strurl = "http://172.16.2.137:8081/webroot/decision/view/report?viewlet=RepCertificateOfProductQualityJYXD.cpt"
- + "&ORDER_NO=" + orderNo + "&YEAR_SEQ=" + year + seq;
- FrmRepExcel down = new FrmRepExcel(ob, strurl,"Post");
- down.Text = "检验报告";
- down.Visible = false;
- down.Size = new Size(740, this.Height);
- down.WindowState = FormWindowState.Maximized;
- down.ShowDialog();
- }
-
- }
- private void pdfPrint(string filePath)
- {
- PrintDocument pd = new PrintDocument();
- Process p = new Process();
- //ProcessStartInfo startInfo = new ProcessStartInfo();
- //startInfo.CreateNoWindow = true;
- //startInfo.WindowStyle = ProcessWindowStyle.Hidden;
- //startInfo.UseShellExecute = true;
- //startInfo.FileName = filePath;
- //startInfo.Verb = "print";
- //startInfo.Arguments = @"/p /h \" + filePath + "\"\"" + pd.PrinterSettings.PrinterName + "\"";
- //p.StartInfo = startInfo;
- //p.Start();
- //p.WaitForExit();
- //不现实调用程序窗口,但是对于某些应用无效
- p.StartInfo.CreateNoWindow = true;
- p.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
- //采用操作系统自动识别的模式
- p.StartInfo.UseShellExecute = true;
- //要打印的文件路径,可以是WORD,EXCEL,PDF,TXT等等
- p.StartInfo.FileName = filePath;
- //指定执行的动作,是打印,即print,打开是 open
- p.StartInfo.Verb = "print";
- //pd.Print();
- p.StartInfo.Arguments = @"/p /h \" + filePath + "\"\"" + pd.PrinterSettings.PrinterName + "\"";
- //开始
- p.Start();
- p.WaitForExit(10000);
- }
- int i = 0;
- int j = 0;
- bool fal = false;
- public string spathName = "";
- private List<Image> ing = new List<Image>();
- private List<FileBean> list = new List<FileBean>();
- private string currentFileName = "";
- public event FileChange FileChangeEvent;
- /// <summary>
- /// 通过文件集合(图片)显示出来。
- /// </summary>
- /// <param name="list"></param>
- public void ShowByListFileBean(List<FileBean> list)
- {
- if (list == null) return;
- j = 0;
- i = 0;
- ing.Clear();
- ingname.Clear();
- this.list = list;
- ClearTmp();
- foreach (FileBean bean in list)
- {
- Image image;
- try
- {
- image = FileHelper.BytesToBitmap(bean.getFile());
- }
- catch
- {
- image = null;
- WriteBytesToTmp(bean.getFile(), bean.getFileName());
- }
- ing.Add(image);
- ingname.Add(bean.getFileName());
- //if (ing[0] != null)
- //{
- // PictureBoxHelper.LoadThumbnailImage((Bitmap)ing[0], pictureBox1);
- //}
- this.currentFileName = list[0].getFileName();
- if (FileChangeEvent != null)
- {
- FileChangeEvent(currentFileName);
- }
- //PictureBoxHelper.LoadThumbnailImage(pictureBox1);
- j = j + 1;
- }
- if (ing.Count == 0)
- {
- fal = false;
- this.currentFileName = "";
- if (FileChangeEvent != null)
- {
- FileChangeEvent(currentFileName);
- }
- }
- else
- {
- fal = true;
- }
- }
- private void ClearTmp()
- {
- string tmpPath = Environment.CurrentDirectory + "\\Tmp\\";
- DirectoryInfo di = new DirectoryInfo(tmpPath);
- if (di.Exists == fal)
- {
- di.Create();
- return;
- }
- foreach (FileInfo fi in di.GetFiles())
- {
- try
- {
- fi.Delete();
- }
- catch { continue; }
- }
- }
- private void WriteBytesToTmp(byte[] Bytes, string fileName)
- {
- try
- {
- string tmpPath = Environment.CurrentDirectory + "\\Tmp\\";
- FileStream fs = new FileStream(tmpPath + fileName, FileMode.Create);
- fs.Write(Bytes, 0, Bytes.Length);
- fs.Flush();
- fs.Close();
- }
- catch { }
- }
- /// <summary>
- /// 生成检验报告(虚单)
- /// </summary>
- private void DoUpdate()
- {
- ultraGridOrder.UpdateData();
- UltraGridRow row = ultraGridOrder.ActiveRow;
- string orderNo = row.Cells["OrderNo"].Text.ToString();
- string orderNo2 = orderNo.Replace("/","");
- string year = DateTime.Now.Year.ToString();
- string seq = "";
- if (row == null) return;
- DataTable ds = ServerHelper.GetData("com.steering.pss.judge.DAL.QcmJyQueryFrm.doQueryJyYearSeq", new object[] { year }, ob);
- seq = ds.Rows[0]["SEQ"].ToString();
- string pdfName = year + seq + orderNo2;
- string filePathNew = "Qcm/JyPdf/" + year + "/" + seq + "/";
- string craftPath = filePathNew + pdfName + ".pdf";
-
- //保存
- ArrayList list = new ArrayList();
- list.Add(year);
- list.Add(seq);
- list.Add(orderNo);
- list.Add(pdfName);
- list.Add(craftPath);
- list.Add(this.UserInfo.GetUserName());
- ArrayList parm = new ArrayList();
- IQueryable<UltraGridRow> checkMagRows = this.ultraGridJustNo.Rows.AsQueryable().Where(" CHK = 'True'");
- foreach (UltraGridRow uRow in checkMagRows)
- {
- YdmZcOutlistEntity matZcEntity = (YdmZcOutlistEntity)uRow.ListObject;
- string matZcTity = JSONFormat.Format(matZcEntity);
- parm.Add(matZcTity);
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.judge.DAL.QcmJyQueryFrm";
- ccp.MethodName = "doAddJyReportXD";
- ccp.ServerParams = new object[] { list, parm, "2" };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode == -1) return;
- MessageUtil.ShowTips(ccp.ReturnInfo);
- if (ccp.ReturnInfo.Equals("保存成功!"))
- {
- WebClient webClient = new WebClient();
- List<FileBean> listPdf = new List<FileBean>();
- string strurl = "http://172.16.2.137:8081/webroot/decision/view/report?viewlet=RepCertificateOfProductQualityJYXD.cpt&format=pdf"
- + "&ORDER_NO=" + orderNo + "&YEAR_SEQ=" + year + seq;
-
- byte[] pdf = webClient.DownloadData(strurl);
- if (pdf.Length <= 10000)
- {
- MessageUtil.ShowError("生成PDF ,请重新生成!");
- return;
- }
- FileBean fileBean = new FileBean();
- fileBean.setFile(pdf);
- fileBean.setFileName(pdfName + ".pdf");
- fileBean.setPathName(filePathNew);
- listPdf.Add(fileBean);
- webClient.Dispose();
- var a = FileHelper.Upload(listPdf);
- if (a)
- {
- DoQuery();
- }
- }
- }
-
- /// <summary>
- /// 查询
- /// </summary>
- private void DoQuery()
- {
-
- ArrayList param = new ArrayList();
- string orderNo = "";
- if (ChcOrderNo.Checked)
- {
- orderNo = TxtOrderNo.Text.Trim();
- }
- string strBegin = "1900-01-01 00:00:00";
- string strEnd = "9900-01-01 00:00:00";
- if (ChcTime.Checked)
- {
- if (TimeBegin.Value == null || TimeEnd.Value == null)
- {
- MessageUtil.ShowWarning("请选择正确的时间");
- return;
- }
- strBegin = TimeBegin.Value.ToString();
- strEnd = TimeEnd.Value.ToString();
- }
- param.Add(orderNo);
- param.Add(strBegin);
- param.Add(strEnd);
- if (ultraTabControl2.SelectedTab.Index == 0)
- {
- List<YdmZcOutlistEntity> listSource = EntityHelper.GetData<YdmZcOutlistEntity>(
- "com.steering.pss.judge.DAL.QcmJyQueryFrm.getOrderInfoXD", new object[] { param }, this.ob);
- ydmZcOutlistEntityBindingSource1.DataSource = listSource;
- }
- else if (ultraTabControl2.SelectedTab.Index == 1)
- {
- List<QcmJyPathEntity> listSource = EntityHelper.GetData<QcmJyPathEntity>(
- "com.steering.pss.judge.DAL.QcmJyQueryFrm.getQcmJyPath", new object[] { param }, this.ob);
- qcmJyPathEntityBindingSource1.DataSource = listSource;
- }
-
- }
- private void QueryJustStoveInfoXD(string orderNo)
- {
- ultraGridJustNo.UpdateData();
- string beginTime = "";
- string endTime = "";
- ArrayList param = new ArrayList();
- param.Add(orderNo);
- if (ChcTime.Checked)
- {
- beginTime = TimeBegin.Value.ToString();
- endTime = TimeEnd.Value.ToString();
- }
- else
- {
- beginTime = "2010/8/1 0:00:00";
- endTime = DateTime.Now.ToString("yyyy/MM/dd") + " 23:59:59";
- }
- param.Add(beginTime);
- param.Add(endTime);
- List<YdmZcOutlistEntity> listSource = EntityHelper.GetData<YdmZcOutlistEntity>(
- "com.steering.pss.judge.DAL.QcmJyQueryFrm.getJustStoveNoXD", new object[] { param }, this.ob);
- ydmZcOutlistEntityBindingSource2.DataSource = listSource;
- }
-
- DataTable dtzbs = new DataTable();
- private void ultraGridOrder_AfterRowActivate(object sender, EventArgs e)
- {
- UltraGridRow ugr = ultraGridOrder.ActiveRow;
- if (ugr == null)
- {
- return;
- }
- QueryJustStoveInfoXD(ugr.Cells["OrderNo"].Text.ToString());
- }
- /// <summary>
- /// 按回车键触发查询按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void ContPublic_KeyDown(object sender, KeyEventArgs e)
- {
- if (e.KeyCode == Keys.Enter)
- {
- DoQuery();
- }
- }
- private int splitterDistance = 0;
- private void ultraExpandableGroupBox1_ExpandedStateChanged(object sender, EventArgs e)
- {
- if (ultraExpandableGroupBox1.Expanded == false)
- {
- this.splitContainer2.SplitterDistance = splitContainer2.Size.Height - 26;
- }
- else
- {
- this.splitContainer2.SplitterDistance = splitterDistance == 0 ? splitContainer2.Size.Height / 2 : splitterDistance;
- }
- }
- private void ultraGridOrder_AfterSelectChange(object sender, AfterSelectChangeEventArgs e)
- {
- foreach (UltraGridRow uRow in ultraGridOrder.Selected.Rows)
- {
- if (uRow.GetType() != typeof(Infragistics.Win.UltraWinGrid.UltraGridGroupByRow))
- {
- uRow.Cells["CHC"].Value = true;
- }
- }
- }
- /// <summary>
- /// 质保书查看,上传,删除
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void craftImg1_EditorButtonClick(object sender, EditorButtonEventArgs e)
- {
- UltraGridRow row = ultraGridOrder.ActiveRow;
- if (row == null) return;
- string billNo = row.Cells["BillNo"].Text.ToString();
- string billNoSeq = row.Cells["BillNoSeq"].Text.ToString();
- string orderNoSeq = row.Cells["OrderSeqNo"].Text.ToString();
- string ordLnDlyPk = row.Cells["OrdLnDlyPk"].Text.ToString();
- string ordLnPk = row.Cells["OrdLnPk"].Text.ToString();
- string askSubItmeVal = row.Cells["AskSubItmeVal"].Text.ToString();
- string filePath = row.GetValue("ZbsPath");
- string metricSystem = row.Cells["MetricSystem"].Text.ToString();
- if (e.Button.Key.ToLower().Equals("select"))
- {
- if (filePath.Equals(""))
- {
- if (askSubItmeVal.Equals(""))
- {
- MessageUtil.ShowTips("请选择语言要求!");
- return;
- }
- string askSubItmeValNo = row.Cells["AskSubItmeVal"].Value.ToString();
- if (metricSystem.Equals(""))
- {
- MessageUtil.ShowTips("请选择公英制!");
- return;
- }
- string metricSystemNo = row.Cells["MetricSystem"].Value.ToString();
- string strurl = "http://172.16.2.137:8081/webroot/decision/view/report?viewlet=RepCertificateOfProductQuality.cpt"
- + "&BILL_NO=" + billNo + "&ORD_LN_PK=" + ordLnPk + "&ASK_ITEM_NO=" + askSubItmeValNo + "&METRIC_SYSTEM=" + metricSystemNo + "&USER=" + this.UserInfo.GetUserID() + "&ORD_LN_DLY_PK=" + ordLnDlyPk;
- FrmRepExcel down = new FrmRepExcel(ob, strurl);
- down.Text = "质保书";
- down.Visible = false;
- down.Size = new Size(740, this.Height);
- down.WindowState = FormWindowState.Maximized;
- down.ShowDialog();
- }
- else
- {
- FormFileDown askDown = new FormFileDown(this.ob, filePath);
- askDown.CtrlFileDown1.Button3.Visible = false;
- askDown.Show();
- }
- //dlgOrderAskDown askDown = new dlgOrderAskDown(ob, filePath);
- //askDown.Show();
- }
- else if (e.Button.Key.ToLower().Equals("add"))
- {
- string pdfName = billNoSeq;
- string filePathNew = "Qcm/ZbsPdf/" + orderNoSeq + "/";
- var serverFileList = FileHelper.Download(filePathNew);
- if (serverFileList.Count > 0)
- {
- MessageUtil.ShowWarning("该记录已存在一份文件,请删除后再重新上传!");
- return;
- }
- if (askSubItmeVal.Equals(""))
- {
- MessageUtil.ShowTips("请选择语言要求!");
- return;
- }
- string askSubItmeValNo = row.Cells["AskSubItmeVal"].Value.ToString();
- if (metricSystem.Equals(""))
- {
- MessageUtil.ShowTips("请选择公英制!");
- return;
- }
- string metricSystemNo = row.Cells["MetricSystem"].Value.ToString();
- //保存
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.judge.DAL.QcmZbsQueryFrm";
- ccp.MethodName = "doAdd";
- ccp.ServerParams = new object[] { pdfName, filePathNew, billNoSeq, billNo, ordLnDlyPk, this.UserInfo.GetUserName(), askSubItmeValNo, metricSystemNo };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode == -1) return;
- MessageUtil.ShowTips(ccp.ReturnInfo);
- if (ccp.ReturnInfo.Equals("保存成功!"))
- {
- WebClient webClient = new WebClient();
- List<FileBean> listPdf = new List<FileBean>();
- string craftPath = filePathNew + pdfName + ".pdf";
- string strurl = "http://172.16.2.137:8081/webroot/decision/view/report?viewlet=RepCertificateOfProductQuality.cpt&format=pdf"
- + "&BILL_NO=" + billNo + "&ORD_LN_PK=" + ordLnPk + "&ASK_ITEM_NO=" + askSubItmeValNo + "&METRIC_SYSTEM=" + metricSystemNo + "&USER=" + this.UserInfo.GetUserID() + "&ORD_LN_DLY_PK=" + ordLnDlyPk;
- byte[] pdf = webClient.DownloadData(strurl);
- if (pdf.Length <= 10000)
- {
- MessageUtil.ShowError("生成PDF ,请重新生成!");
- return;
- }
- FileBean fileBean = new FileBean();
- fileBean.setFile(pdf);
- fileBean.setFileName(pdfName + ".pdf");
- fileBean.setPathName(filePathNew);
- listPdf.Add(fileBean);
- webClient.Dispose();
- var a = FileHelper.Upload(listPdf);
- if (a)
- {
- //MessageUtil.ShowTips("上传成功!");
- row.Cells["ZbsName"].Value = pdfName + ".pdf";
- row.Cells["ZbsPath"].Value = filePathNew;
- DoQuery();
- }
- }
- }
- else
- {
- //删除
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.judge.DAL.QcmZbsQueryFrm";
- ccp.MethodName = "doDelete";
- ccp.ServerParams = new object[] { row.Cells["ZbsName"].Text.ToString(), billNoSeq, billNo, ordLnDlyPk };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode == -1) return;
- MessageUtil.ShowTips(ccp.ReturnInfo);
- if (ccp.ReturnInfo.Equals("删除成功!"))
- {
- var a = FileHelper.Delete(filePath);
- if (a)
- {
- DoQuery();
- }
- }
- }
- }
-
- private void ultraComboEditor3_EditorButtonClick(object sender, EditorButtonEventArgs e)
- {
- UltraGridRow row = ultraGrid1.ActiveRow;
- if (row == null) return;
- string orderNo = row.Cells["OrderNo"].Text.ToString();
- string year = row.Cells["Year"].Text.ToString();
- string seq = row.Cells["Seq"].Text.ToString();
-
-
- if (e.Button.Key.ToLower().Equals("select"))
- { //查看
- string filePath = row.GetValue("JyPath");
- FormFileDown askDown = new FormFileDown(this.ob, filePath);
- askDown.CtrlFileDown1.Button3.Visible = false;
- askDown.Show();
- }
-
- else
- { //打印
-
- string zbsName = row.Cells["JyPath"].Text.ToString();
- List<FileBean> list = Core.Mes.Client.Comm.Server.FileHelper.Download(zbsName);
- ShowByListFileBean(list);
- string filePath = Environment.CurrentDirectory + "\\Tmp\\" + ingname[i];
- pdfPrint(filePath);
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.judge.DAL.QcmJyQueryFrm";
- ccp.MethodName = "doUpdatePrintData";
- ccp.ServerParams = new object[] { year, seq, this.UserInfo.GetUserName()};
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode == -1) return;
- MessageUtil.ShowTips(ccp.ReturnInfo);
- if (ccp.ReturnInfo.Equals("打印成功!"))
- {
- DoQuery();
- }
- }
- }
- private void ultraComboEditor3_ValueChanged(object sender, EventArgs e)
- {
- }
- public DataTable ToDataTable(DataRow[] rows)
- {
- if (rows == null || rows.Length == 0) return null;
- DataTable tmp = rows[0].Table.Clone(); // 复制DataRow的表结构
- foreach (DataRow row in rows)
- tmp.Rows.Add(row.ItemArray); // 将DataRow添加到DataTable中
- return tmp;
- }
- private void ultraGridJustNo_ClickCellButton(object sender, CellEventArgs e)
- {
- this.ultraGridJustNo.UpdateData();
- if (e.Cell.Column.Key == "JudgeStoveNo")
- {
- string batchNo = ultraGridJustNo.ActiveRow.Cells["BatchNo"].Value.ToString();
- string judgeStoveNo = ultraGridJustNo.ActiveRow.Cells["JudgeStoveNo"].Value.ToString();
- FrmCoupling orderZg = new FrmCoupling(judgeStoveNo, batchNo, this.ob);
- orderZg.ShowDialog();
- }
- }
- private void RefreshSpotZbs()
- {
- if (ultraGridOrder.ActiveRow == null) return;
- var pRow = ultraGridOrder.ActiveRow;
- Dal d = new Dal(ob);
- DataRow drOrdHead = d.GetRowByXmlId("JdgSlmOrderHead.getByDlyPk", pRow.GetValue("OrdLnDlyPk"));
- if (drOrdHead != null && drOrdHead["orderTyp"].ToString() != "120102")
- {
- MessageUtil.ShowWarning("只能刷新现货提单!");
- return;
- }
- string process = d.GetRowByXmlId("JdgComBasePline.getProcessByPline", pRow.GetValue("PlineCode"))["processCode"].ToString();
- foreach (var row in ultraGridJustNo.Rows)
- {
- d.Set("com.steering.pss.judge.Bll.BllCreateZbsInfo.saveSpotInfo", row.GetValue("JudgeStoveNo"),
- row.GetValue("BatchNo"), row.GetValue("GroupNo"), process, pRow.GetValue("OrdLnDlyPk"));
- }
- //DataTable dt = d.GetTableByXmlId("JdgQcmZbsInfo.getxh");
- //foreach (DataRow dr in dt.Rows)
- //{
- // d.Set("com.steering.pss.judge.Bll.BllCreateZbsInfo.saveSpotInfo", dr["judgeStoveNo"].ToString(),
- // dr["batchNo"], "001", dr["processCode"].ToString(), dr["ordLnDlyPk"].ToString());
- //}
- MessageUtil.ShowTips("刷新成功");
- }
- }
- }
|