| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855 |
- using Core.Mes.Client.Comm.Control;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.Judge.Commons;
- 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 QcmZbsQueryFrmYuLan : FrmBase
- {
- /// <summary>
- /// 登入用户的销售组织权限
- /// </summary>
- //private string[] _salgPermissions;
- public QcmZbsQueryFrmYuLan()
- {
- InitializeComponent();
- this.IsLoadUserView = true;
- }
- private void QcmZbsQueryFrmYuLan_Load(object sender, EventArgs e)
- {
- InitDate();
- //_salgPermissions = BaseMethod.InitPermissions(this.ValidDataPurviewIds, ob);
- EntityHelper.ShowGridCaption<YdmZcBillMyEntity>(ultraGridOrder.DisplayLayout.Bands[0]);
- EntityHelper.ShowGridCaption<YdmZcBillCyEntity>(ultraGridJustNo.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 (ChcLadingSeq.Checked)
- {
- TxtLadingSeq.Enabled = true;
- }
- else
- {
- TxtLadingSeq.Enabled = false;
- }
- 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 "UpdateLin":
- DoUpdateLin();
- break;
- case "Close":
- this.Close();
- break;
- }
- }
- private ArrayList ingname = new ArrayList();
- /// <summary>
- /// 质保书打印
- /// </summary>
- private void printData()
- {
- UltraGridRow row = ultraGridOrder.ActiveRow;
- if (row == null) return;
- string billNo = row.Cells["BillNo"].Text.ToString();
- string ordLnDlyPk = row.Cells["OrdLnDlyPk"].Text.ToString();
- DataTable dt = ServerHelper.GetData("com.steering.pss.judge.DAL.QcmZbsQueryFrm.doQuerLanguage", new object[] { billNo, ordLnDlyPk }, ob);
- if (dt.Rows.Count <= 0)
- {
- MessageUtil.ShowTips("请维护质保书!");
- return;
- }
- ArrayList list1 = new ArrayList();
- for (int k = 0; k < dt.Rows.Count; k++)
- {
- string zbsName = dt.Rows[k]["ZBS_PATH"].ToString() + "/" + dt.Rows[k]["ZBS_NAME"].ToString() + ".pdf";
- List<FileBean> list = Core.Mes.Client.Comm.Server.FileHelper.Download(zbsName);
- ShowByListFileBean(list);
- string filePath = Environment.CurrentDirectory + "\\Tmp\\" + ingname[i];
- pdfPrint(filePath);
- list1.Add(dt.Rows[k]["ZBS_NAME"].ToString());
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.judge.DAL.QcmZbsQueryFrm";
- ccp.MethodName = "doUpdatePrintDataAll";
- ccp.ServerParams = new object[] { row.Cells["BillNoSeq"].Text.ToString().Trim(), this.UserInfo.GetUserName(), billNo, ordLnDlyPk, list1 };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode == -1) return;
- MessageUtil.ShowTips(ccp.ReturnInfo);
- if (ccp.ReturnInfo.Equals("打印成功!"))
- {
- DoQuery();
- }
- }
- 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;
- if (row == null) return;
- int countM = 0;
- ArrayList list = new ArrayList();
- foreach (UltraGridRow item in ultraGridOrder.Rows)
- {
- if (Convert.ToBoolean(item.Cells["CHC"].Text) == true)
- {
- countM++;
- ArrayList list1 = new ArrayList();
- list1.Add(item.Cells["ZbsFlag"].Value.ToString().Trim());
- list1.Add(item.Cells["BillNoSeq"].Text.ToString().Trim());
- list.Add(list1);
- }
- }
- if (countM == 0)
- {
- MessageUtil.ShowTips("请勾选需要修改的出库合同信息!");
- return;
- }
- if (MessageUtil.ShowYesNoAndQuestion("是否确认修改打印状态?") ==
- DialogResult.No)
- return;
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.judge.DAL.QcmZbsQueryFrm";
- ccp.MethodName = "doUpdate";
- ccp.ServerParams = new object[] { list, this.UserInfo.GetUserName() };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode == -1) return;
- MessageUtil.ShowTips(ccp.ReturnInfo);
- if (ccp.ReturnInfo.Equals("修改成功!"))
- {
- DoQuery();
- }
- }
- /// <summary>
- /// 修改许可证号
- /// </summary>
- private void DoUpdateLin()
- {
- ultraGridOrder.UpdateData();
- UltraGridRow row = ultraGridOrder.ActiveRow;
- if (row == null) return;
- int countM = 0;
- ArrayList list = new ArrayList();
- foreach (UltraGridRow item in ultraGridOrder.Rows)
- {
- if (Convert.ToBoolean(item.Cells["CHC"].Text) == true)
- {
- countM++;
- ArrayList list1 = new ArrayList();
- list1.Add(item.Cells["LicenseNo"].Value.ToString().Trim());
- list1.Add(item.Cells["CheckNo"].Value.ToString().Trim());
- list1.Add(item.Cells["BillNo"].Value.ToString().Trim());
- list1.Add(item.Cells["BillNoSeq"].Text.ToString().Trim());
- list.Add(list1);
- }
- }
- if (countM == 0)
- {
- MessageUtil.ShowTips("请勾选需要修改的出库合同信息!");
- return;
- }
- if (MessageUtil.ShowYesNoAndQuestion("是否确认修改?") ==
- DialogResult.No)
- return;
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.judge.DAL.QcmZbsQueryFrm";
- ccp.MethodName = "doUpdateLin";
- ccp.ServerParams = new object[] { list, this.UserInfo.GetUserName() };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode == -1) return;
- MessageUtil.ShowTips(ccp.ReturnInfo);
- if (ccp.ReturnInfo.Equals("修改成功!"))
- {
- DoQuery();
- }
- }
- /// <summary>
- /// 查询
- /// </summary>
- private void DoQuery()
- {
- ArrayList param = new ArrayList();
- string billNo = "";
- if (ChcLadingSeq.Checked)
- {
- billNo = TxtLadingSeq.Text.Trim();
- }
- 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();
- }
- string status = "";
- if (ChcStatus.Checked)
- {
- status = ComStatus.Value.ToString();
- }
- //string[] arr = BaseMethod.InitPermissions(this.ValidDataPurviewIds,this.ob);
- //string[] arr = this.ValidDataPurviewIds;
- param.Add(billNo);
- param.Add(orderNo);
- param.Add(strBegin);
- param.Add(strEnd);
- List<YdmZcBillMyEntity> listSource = EntityHelper.GetData<YdmZcBillMyEntity>(
- "com.steering.pss.judge.DAL.QcmZbsQueryFrm.getOrderInfoByBiltNoYuLan", new object[] { param, status,this.UserInfo.GetDeptid() }, this.ob);
- ydmZcBillMyEntityBindingSource.DataSource = listSource;
- //DataTable dt = ServerHelper.GetData("com.steering.pss.judge.DAL.QcmZbsQueryFrm.getBiltNo", new Object[] { param, arr}, this.ob);
- //GridHelper.CopyDataToDatatable(ref dt, ref this.dataTable1, true);
- //if (dt == null || dt.Rows.Count == 0)
- //{
- // QueryJustStoveInfo("");
- //}
- //BaseMethod.SetUltraGridRowColor(ultraGridBillNo, new string[] { "LOADVEHICLE_TYPE" }, new string[] { "虚拟" }, Color.GreenYellow);
- }
- private void QueryJustStoveInfo(string billNo, string ordLnDlyPk)
- {
- ultraGridJustNo.UpdateData();
- List<YdmZcBillCyEntity> listSource = EntityHelper.GetData<YdmZcBillCyEntity>(
- "com.steering.pss.judge.DAL.QcmZbsQueryFrm.getJustStoveNoInfoByBiltNo", new object[] { billNo }, this.ob);
- ydmZcBillCyEntityBindingSource.DataSource = listSource;
- foreach (UltraGridRow row in ultraGridJustNo.Rows)
- {
- //理货在途量
- row.Cells["ActCountKc"].Value = (double.Parse(row.Cells["ActTallCount"].Value.ToString()) - double.Parse(row.Cells["ActCountLoad"].Value.ToString())).ToString();
- if (double.Parse(row.Cells["ActCountKc"].Value.ToString()) != 0.0)
- {
- row.Cells["ActWeightKc"].Value = (double.Parse(row.Cells["ActTallWt"].Value.ToString()) - double.Parse(row.Cells["ActWeightLoad"].Value.ToString())).ToString("f3");
- }
- else
- {
- row.Cells["ActWeightKc"].Value = "0.000";
- }
- //提单在途量
- row.Cells["ActCountZy"].Value = (double.Parse(row.Cells["ActCount"].Value.ToString()) - double.Parse(row.Cells["ActCountLoad"].Value.ToString())).ToString();
- if (double.Parse(row.Cells["ActCountZY"].Value.ToString()) != 0.0)
- {
- row.Cells["ActWeightZy"].Value = (double.Parse(row.Cells["ActWeight"].Value.ToString()) - double.Parse(row.Cells["ActWeightLoad"].Value.ToString())).ToString("f3");
- }
- else
- {
- row.Cells["ActWeightZY"].Value = "0.000";
- }
- if (row.Cells["OrdLnDlyPk"].Text.Equals(ordLnDlyPk))
- {
- row.Appearance.BackColor = Color.Wheat;
- }
- else
- {
- row.Appearance.BackColor = Color.White;
- }
- }
- }
- DataTable dtzbs = new DataTable();
- private void ultraGridOrder_AfterRowActivate(object sender, EventArgs e)
- {
- UltraGridRow ugr = ultraGridOrder.ActiveRow;
- if (ugr == null)
- {
- return;
- }
- QueryJustStoveInfo(ugr.Cells["BillNo"].Text.ToString(), ugr.Cells["OrdLnDlyPk"].Text.ToString());
- //接箍信息
- DataTable dt = ServerHelper.GetData("com.steering.pss.judge.DAL.QcmZbsQueryFrm.QueryCoupling", new object[] { ugr.Cells["BillNo"].Text.ToString() }, this.ob);
- if (dt.Rows.Count > 0 && dt != null)
- {
- GridHelper.CopyDataToDatatable(dt, this.dataTable2, true);
- //GridHelper.RefreshAndAutoSize(this.ultraGrid1);
- }
- string billNo = ugr.Cells["BillNo"].Text.ToString();
- string ordLnDlyPk = ugr.Cells["OrdLnDlyPk"].Text.ToString();
- //查询多语言质保书
- dtzbs.Clear();
- dtzbs = ServerHelper.GetData("com.steering.pss.judge.DAL.QcmZbsQueryFrm.doQuerLanguage1", new object[] { billNo, ordLnDlyPk }, ob);
- ultraComboEditor3.DataSource = dtzbs;
- ultraComboEditor3.DisplayMember = "质保书";
- if (dtzbs.Rows.Count > 0)
- {
- ugr.Cells["ZbsName"].Value = dtzbs.Rows[0]["质保书"].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.54.10.42:8080/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.54.10.42:8080/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 ultraTextEditor1_EditorButtonClick(object sender, EditorButtonEventArgs e)
- {
- UltraGridRow row = ultraGridOrder.ActiveRow;
- if (row == null) return;
- string CraftPath = row.Cells["CraftPath"].Text.ToString();
- FormFileDown askDown = new FormFileDown(this.ob, CraftPath);
- askDown.CtrlFileDown1.Button3.Visible = false;
- askDown.Show();
- }
- private void ultraComboEditor3_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 orderNo = row.Cells["OrderSeqNo"].Text.ToString();
- string ordLnDlyPk = row.Cells["OrdLnDlyPk"].Text.ToString();
- string ordLnPk = row.Cells["OrdLnPk"].Text.ToString();
- string askSubItmeVal = "";
- if (!row.Cells["AskSubItmeVal"].Text.ToString().Equals(""))
- {
- askSubItmeVal = row.Cells["AskSubItmeVal"].Value.ToString();
- }
- string metricSystem = "";
- if (!row.Cells["MetricSystem"].Text.ToString().Equals(""))
- {
- metricSystem = row.Cells["MetricSystem"].Value.ToString();
- }
- if (e.Button.Key.ToLower().Equals("select"))
- {
- string filePath = row.GetValue("ZbsPath");
- FormFileDown askDown = new FormFileDown(this.ob, filePath);
- askDown.CtrlFileDown1.Button3.Visible = false;
- askDown.Show();
- }
- else if (e.Button.Key.ToLower().Equals("add"))
- { //维护
- IQueryable<UltraGridRow> checkMagRows = this.ultraGridJustNo.Rows.AsQueryable().Where(" CHK = 'True'");
- ArrayList parm = new ArrayList();
- if (checkMagRows.Count() > 0)
- {
- foreach (UltraGridRow row2 in checkMagRows)
- { //招标质保书选择的炉批
- row2.Cells["JudgeStoveNo"].Value.ToString();
- row2.Cells["BatchNo"].Value.ToString();
- parm.Add(row2.Cells["JudgeStoveNo"].Value.ToString() + row2.Cells["BatchNo"].Value.ToString());
- }
- }
- QcmZbsLanguageYuLan lan = new QcmZbsLanguageYuLan(billNo, orderNo, ordLnDlyPk, metricSystem, askSubItmeVal, billNoSeq, parm, ob);
- lan.ShowDialog();
- }
- else
- {
- if (row.Cells["ZbsName"].Text.ToString().Equals(""))
- {
- MessageUtil.ShowTips("质保书为空,请选择或维护!");
- return;
- }
- string zbsName = row.Cells["ZbsPath"].Text.ToString() + "/" + row.Cells["ZbsName"].Text.ToString() + ".pdf";
- List<FileBean> list = Core.Mes.Client.Comm.Server.FileHelper.Download(zbsName);
- ShowByListFileBean(list);
- string filePath = Environment.CurrentDirectory + "\\Tmp\\" + ingname[i];
- pdfPrint(filePath);
- //实例化PdfDocument类对象,并加载PDF文档
- //PdfDocument doc = new PdfDocument();
- //加载的打印PDF文件
- //doc.LoadFromFile(filePath);
- ////选择默认打印机打印所有页面
- //doc.PrintDocument.Print();
- //选择打印机并设置打印页面范围
- //PrintDialog dialogPrint = new PrintDialog();
- //dialogPrint.AllowPrintToFile = true;
- //dialogPrint.AllowSomePages = true;
- //dialogPrint.PrinterSettings.MinimumPage = 1;
- //dialogPrint.PrinterSettings.MaximumPage = doc.Pages.Count;
- //dialogPrint.PrinterSettings.FromPage = 1;
- //dialogPrint.PrinterSettings.ToPage = doc.Pages.Count;
- //if (dialogPrint.ShowDialog() == DialogResult.OK)
- //{
- // doc.PrintFromPage = dialogPrint.PrinterSettings.FromPage;
- // doc.PrintToPage = dialogPrint.PrinterSettings.ToPage;
- // doc.PrinterName = dialogPrint.PrinterSettings.PrinterName;
- // PrintDocument printDoc = doc.PrintDocument;
- // dialogPrint.Document = printDoc;
- // printDoc.Print();
- //}
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.judge.DAL.QcmZbsQueryFrm";
- ccp.MethodName = "doUpdatePrintData";
- ccp.ServerParams = new object[] { row.Cells["BillNoSeq"].Text.ToString().Trim(), this.UserInfo.GetUserName(), row.Cells["ZbsName"].Text.ToString(), billNo, ordLnDlyPk };
- 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)
- {
- UltraGridRow row = ultraGridOrder.ActiveRow;
- if (row == null) return;
- if (row.Cells["ZbsName"].Text.Equals("")) return;
- if (dtzbs.Rows.Count > 0)
- {
- DataRow[] dr = dtzbs.Select("质保书='" + row.Cells["ZbsName"].Text.ToString() + "'");
- DataTable dt = ToDataTable(dr);
- if (dt.Rows.Count > 0)
- {
- row.Cells["ZbsPath"].Value = dt.Rows[0]["质保书路径"].ToString();
- }
- }
- }
- 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();
- }
- }
- }
- }
|