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 QcmZbsQueryFrm : FrmBase { /// /// 登入用户的销售组织权限 /// //private string[] _salgPermissions; public QcmZbsQueryFrm() { InitializeComponent(); this.IsLoadUserView = true; } private void FrmPipeBillOfLadingClose_Load(object sender, EventArgs e) { InitDate(); //_salgPermissions = BaseMethod.InitPermissions(this.ValidDataPurviewIds, ob); EntityHelper.ShowGridCaption(ultraGridOrder.DisplayLayout.Bands[0]); EntityHelper.ShowGridCaption(ultraGridJustNo.DisplayLayout.Bands[0]); BaseMethod.setOtherColumnReadOnly(ultraGridOrder, new string[] { "CHC", "ZbsFlag", "AskSubItmeVal", "MetricSystem", "LicenseNo", "CraftNo", "CheckNo", "ZbsName", "ZbsOrderNo", "LanguageName", "ZbsTypeDesc" }); 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"; ultraLanguage.DataSource = dt1; ultraLanguage.DisplayMember = "ASK_ITEM_DESC"; ultraLanguage.ValueMember = "ASK_ITEM_NO"; ultraGridOrder.DisplayLayout.Bands[0].Columns["LanguageName"].EditorComponent = comAsk; ultraGridOrder.DisplayLayout.Bands[0].Columns["LanguageName"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList; //查询许可证号 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"; //查询质保书类型 DataTable dt4 = ServerHelper.GetData("com.steering.pss.judge.DAL.QcmZbsQueryFrm.getBaseInfo", new object[] { "4108", "" }, ob); comZbsType.DataSource = dt4; comZbsType.DisplayMember = "BASENAME"; comZbsType.ValueMember = "BASECODE"; ultraZbsType.DataSource = dt4; ultraZbsType.DisplayMember = "BASENAME"; ultraZbsType.ValueMember = "BASECODE"; ultraZbsTyp.DataSource = dt4; ultraZbsTyp.DisplayMember = "BASENAME"; ultraZbsTyp.ValueMember = "BASECODE"; ultraGridOrder.DisplayLayout.Bands[0].Columns["ZbsTypeDesc"].EditorComponent = comZbsType; ultraGridOrder.DisplayLayout.Bands[0].Columns["ZbsTypeDesc"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList; } 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; } if (Checzbs.Checked) { ultraZbsType.Enabled = true; } else { ultraZbsType.Enabled = false; } } /// /// 初始时间 /// 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 "batchPrint": batchPrint(); break; case "batchView": batchView(); break; case "UpdateLin": DoUpdateLin(); break; case "RefreshSpotZbs": RefreshSpotZbs(); break; case "UnLock": DoUnLock(); break; case "UpdateOrderNno": DoUpdateOrderNno(); break; case "Export": GridHelper.ulGridToExcel(ultraGridOrder, "出库合同信息"); break; case "UpdateLanguageAndType": UpdateLanguageAndType(); break; case "Close": this.Close(); break; } } private ArrayList ingname = new ArrayList(); /// /// 修改质保书语言类型 /// private void UpdateLanguageAndType() { 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) { if (!string.IsNullOrWhiteSpace(ultraLanguage.Value.ToString2())) { item.Cells["LanguageName"].Value = ultraLanguage.Value; } if (!string.IsNullOrWhiteSpace(ultraZbsTyp.Value.ToString2())) { item.Cells["ZbsTypeDesc"].Value = ultraZbsTyp.Value; } countM++; comAsk.Text = item.Cells["LanguageName"].Text.ToString2(); comZbsType.Text = item.Cells["ZbsTypeDesc"].Text.ToString2(); ArrayList list1 = new ArrayList(); list1.Add(item.Cells["LanguageName"].Text.ToString().Trim()); list1.Add(comAsk.Value.ToString().Trim()); list1.Add(item.Cells["ZbsTypeDesc"].Text.ToString().Trim()); list1.Add(comZbsType.Value.ToString().Trim()); list1.Add(item.Cells["BillNoSeq"].Value.ToString().Trim()); list.Add(list1); string billNo = item.Cells["BillNo"].Text.ToString(); string billNoSeq = item.Cells["BillNoSeq"].Text.ToString(); string orderNo = item.Cells["OrderSeqNo"].Text.ToString(); string ordLnDlyPk = item.Cells["OrdLnDlyPk"].Text.ToString(); string ordLnPk = item.Cells["OrdLnPk"].Text.ToString(); string billName = item.Cells["ZbsName"].Text.ToString(); string tsMemo = this.ultraOptionSet1.CheckedItem.DataValue.ToString(); string address = this.ultraOptionSet2.CheckedItem.DataValue.ToString(); string laguageName = item.Cells["LanguageName"].Text.ToString(); string laguageCode = comAsk.Value.ToString(); string zbsTypeDesc = item.Cells["ZbsTypeDesc"].Text.ToString(); string zbsTypeCode = comZbsType.Value.ToString(); string askSubItmeValNo = comAsk.Value.ToString(); string askSubItmeVal = item.Cells["LanguageName"].Text.ToString(); string metricSystemNo = item.Cells["MetricSystem"].Value.ToString(); string zbsEdition = ""; string acountCE = "0"; string acountEAC = "0"; string isVehicleNo = ""; DataTable dt = ServerHelper.GetData("com.steering.pss.judge.DAL.QcmZbsQueryFrm.getZbsEdition", new object[] { billNo, ordLnDlyPk }, ob); if (dt.Rows.Count > 0) { zbsEdition = dt.Rows[0]["zbsEdition"].ToString(); } string pdfName = billNoSeq + askSubItmeValNo + zbsEdition; string filePathNew = "Qcm/ZbsPdf/" + billNoSeq + "/" + orderNo + "/" + askSubItmeValNo + "/"; string craftPath = filePathNew + pdfName + ".pdf"; //var serverFileList = FileHelper.Download(filePathNew); //if (serverFileList.Count > 0) //{ // MessageUtil.ShowWarning("该记录已存在一份文件,请删除后再重新上传!"); // return; //} //保存 ArrayList list2 = new ArrayList(); list2.Add(billNo); list2.Add(askSubItmeValNo); list2.Add(askSubItmeVal); list2.Add(craftPath); list2.Add(ordLnDlyPk); list2.Add(pdfName); list2.Add(metricSystemNo); list2.Add(this.UserInfo.GetUserName()); list2.Add(zbsTypeCode); list2.Add(zbsTypeDesc); list2.Add(zbsEdition); DataTable dtCE = ServerHelper.GetData("com.steering.pss.judge.DAL.QcmZbsQueryFrm.getOrderCE", new object[] { ordLnPk }, ob); if (dtCE.Rows.Count > 0) { acountCE = dtCE.Rows[0]["ACOUNT"].ToString(); } DataTable dtEAC = ServerHelper.GetData("com.steering.pss.judge.DAL.QcmZbsQueryFrm.getOrderEAC", new object[] { ordLnPk }, ob); if (dtEAC.Rows.Count > 0) { acountEAC = dtEAC.Rows[0]["ACOUNT"].ToString(); } IQueryable checkMagRows = this.ultraGridJustNo.Rows.AsQueryable().Where(" CHK = 'True'"); ArrayList JudgeStoveNoBatchNo = new ArrayList(); if (checkMagRows.Count() > 0) { foreach (UltraGridRow row2 in checkMagRows) { //招标质保书选择的炉批 row2.Cells["JudgeStoveNo"].Value.ToString(); row2.Cells["BatchNo"].Value.ToString(); JudgeStoveNoBatchNo.Add(row2.Cells["JudgeStoveNo"].Value.ToString() + row2.Cells["BatchNo"].Value.ToString()); } } CoreClientParam ccp1 = new CoreClientParam(); ccp1.ServerName = "com.steering.pss.judge.DAL.QcmZbsQueryFrm"; ccp1.MethodName = "doAddNew"; ccp1.ServerParams = new object[] { list2 }; ccp1 = ob.ExecuteNonQuery(ccp1, CoreInvokeType.Internal); if (ccp1.ReturnCode == -1) return; if (ccp1.ReturnInfo.Equals("保存成功!")) { WebClient webClient = new WebClient(); List listPdf = new List(); string strurl = ""; if (zbsTypeCode.Equals("410801")) { 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() + "&ZBS_EDITION=" + zbsEdition + "&ORD_LN_DLY_PK=" + ordLnDlyPk + "&IS_VEHICLE_NO=" + isVehicleNo + "&TS_MEMO=" + tsMemo + "&ADDRESS=" + address; if (int.Parse(acountCE) > 0) { strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepCertificateOfProductQualityCE.cpt&format=pdf" + "&BILL_NO=" + billNo + "&ORD_LN_PK=" + ordLnPk + "&ASK_ITEM_NO=" + askSubItmeValNo + "&METRIC_SYSTEM=" + metricSystemNo + "&USER=" + this.UserInfo.GetUserID() + "&ZBS_EDITION=" + zbsEdition + "&ORD_LN_DLY_PK=" + ordLnDlyPk + "&IS_VEHICLE_NO=" + isVehicleNo + "&TS_MEMO=" + tsMemo + "&ADDRESS=" + address; } if (int.Parse(acountEAC) > 0) { strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepCertificateOfProductQualityEAC.cpt&format=pdf" + "&BILL_NO=" + billNo + "&ORD_LN_PK=" + ordLnPk + "&ASK_ITEM_NO=" + askSubItmeValNo + "&METRIC_SYSTEM=" + metricSystemNo + "&USER=" + this.UserInfo.GetUserID() + "&ZBS_EDITION=" + zbsEdition + "&ORD_LN_DLY_PK=" + ordLnDlyPk + "&IS_VEHICLE_NO=" + isVehicleNo + "&TS_MEMO=" + tsMemo + "&ADDRESS=" + address; } if ("xiaoshou".Equals(this.CustomInfo)) { strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepCertificateOfProductQualityXS.cpt&format=pdf" + "&BILL_NO=" + billNo + "&ORD_LN_PK=" + ordLnPk + "&ASK_ITEM_NO=" + askSubItmeValNo + "&METRIC_SYSTEM=" + metricSystemNo + "&USER=" + this.UserInfo.GetUserID() + "&ZBS_EDITION=" + zbsEdition + "&ORD_LN_DLY_PK=" + ordLnDlyPk + "&IS_VEHICLE_NO=" + isVehicleNo + "&TS_MEMO=" + tsMemo + "&ADDRESS=" + address; } } else if (zbsTypeCode.Equals("410802")) { strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepCertificateOfProductQualityJG.cpt&format=pdf" + "&BILL_NO=" + billNo + "&ORD_LN_PK=" + ordLnPk + "&ASK_ITEM_NO=" + askSubItmeValNo + "&METRIC_SYSTEM=" + metricSystemNo + "&USER=" + this.UserInfo.GetUserID() + "&ZBS_EDITION=" + zbsEdition + "&TYPE=JG&ORD_LN_DLY_PK=" + ordLnDlyPk + "&IS_VEHICLE_NO=" + isVehicleNo + "&TS_MEMO=" + tsMemo + "&ADDRESS=" + address; if ("xiaoshou".Equals(this.CustomInfo)) { strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepCertificateOfProductQualityJGXS.cpt&format=pdf" + "&BILL_NO=" + billNo + "&ORD_LN_PK=" + ordLnPk + "&ASK_ITEM_NO=" + askSubItmeValNo + "&METRIC_SYSTEM=" + metricSystemNo + "&USER=" + this.UserInfo.GetUserID() + "&ZBS_EDITION=" + zbsEdition + "&TYPE=JG&ORD_LN_DLY_PK=" + ordLnDlyPk + "&IS_VEHICLE_NO=" + isVehicleNo + "&TS_MEMO=" + tsMemo + "&ADDRESS=" + address; } } else if (zbsTypeCode.Equals("410803")) { strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepCertificateOfProductQualityZB.cpt&format=pdf" + "&BILL_NO=" + billNo + "&ORD_LN_PK=" + ordLnPk + "&ASK_ITEM_NO=" + askSubItmeValNo + "&METRIC_SYSTEM=" + metricSystemNo + "&USER=" + this.UserInfo.GetUserID() + "&ZBS_EDITION=" + zbsEdition + "&TYPE=ZB&ORD_LN_DLY_PK=" + ordLnDlyPk + "&JUDGE_STOVE_NO_BATCH_NO=" + JudgeStoveNoBatchNo + "&IS_VEHICLE_NO=" + isVehicleNo + "&TS_MEMO=" + tsMemo + "&ADDRESS=" + address; } else if (zbsTypeCode.Equals("410804")) { strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepCertificateOfProductQualityGP.cpt&format=pdf" + "&BILL_NO=" + billNo + "&ORD_LN_PK=" + ordLnPk + "&ASK_ITEM_NO=" + askSubItmeValNo + "&METRIC_SYSTEM=" + metricSystemNo + "&USER=" + this.UserInfo.GetUserID() + "&ZBS_EDITION=" + zbsEdition + "&TYPE=ZB&ORD_LN_DLY_PK=" + ordLnDlyPk + "&IS_VEHICLE_NO=" + isVehicleNo + "&TS_MEMO=" + tsMemo + "&ADDRESS=" + address; } else if (zbsTypeCode.Equals("410805")) { 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() + "&ZBS_EDITION=" + zbsEdition + "&TYPE=ZB&ORD_LN_DLY_PK=" + ordLnDlyPk + "&IS_VEHICLE_NO=" + isVehicleNo + "&WUCB=1" + "&TS_MEMO=" + tsMemo + "&ADDRESS=" + address; } else if (zbsTypeCode.Equals("410806")) { strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepCertificateOfProductQualityTH.cpt&format=pdf" + "&BILL_NO=" + billNo + "&ORD_LN_PK=" + ordLnPk + "&ASK_ITEM_NO=" + askSubItmeValNo + "&METRIC_SYSTEM=" + metricSystemNo + "&USER=" + this.UserInfo.GetUserID() + "&ZBS_EDITION=" + zbsEdition + "&TYPE=ZB&ORD_LN_DLY_PK=" + ordLnDlyPk + "&IS_VEHICLE_NO=" + isVehicleNo + "&TS_MEMO=" + tsMemo + "&ADDRESS=" + address; } 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 (countM == 0) { MessageUtil.ShowTips("请勾选需要修改的出库合同信息!"); return; } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.pss.judge.DAL.QcmZbsQueryFrm"; ccp.MethodName = "UpdateLaguageAndType"; ccp.ServerParams = new object[] { list }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode == -1) return; MessageUtil.ShowTips(ccp.ReturnInfo); if (ccp.ReturnInfo.Equals("修改成功!")) { DoQuery(); } } /// /// 解锁 /// private void DoUnLock() { UltraGridRow row = ultraGridOrder.ActiveRow; if (row == null) return; CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.pss.judge.DAL.QcmZbsQueryFrm"; ccp.MethodName = "doUnLock"; ccp.ServerParams = new object[] { row.Cells["BillNoSeq"].Text.ToString().Trim() }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode == -1) return; MessageUtil.ShowTips(ccp.ReturnInfo); if (ccp.ReturnInfo.Equals("解锁成功!")) { DoQuery(); } } /// /// 质保书打印 /// 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, "1" }, 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(); List list = Core.Mes.Client.Comm.Server.FileHelper.Download(zbsName); if (list.Count < 1) { MessageUtil.ShowTips("存在无效的质保书版本,请确认后打印!"); return; } 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 batchPrint() { foreach (UltraGridRow row in ultraGridOrder.Rows) { if (Convert.ToBoolean(row.Cells["CHC"].Text) != true) { continue; } string billNo = row.Cells["BillNo"].Text.ToString(); string ordLnDlyPk = row.Cells["OrdLnDlyPk"].Text.ToString(); DataTable dt = ServerHelper.GetData("com.steering.pss.judge.DAL.QcmZbsQueryFrm.doQuerLanguage3", 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(); List list = Core.Mes.Client.Comm.Server.FileHelper.Download(zbsName); if (list.Count < 1) { MessageUtil.ShowTips("存在无效的质保书版本,请确认后打印!"); return; } 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("打印成功!"); DoQuery(); } private void batchView() { foreach (UltraGridRow row in ultraGridOrder.Rows) { if (Convert.ToBoolean(row.Cells["CHC"].Text) != true) { continue; } string billNo = row.Cells["BillNo"].Text.ToString(); string ordLnDlyPk = row.Cells["OrdLnDlyPk"].Text.ToString(); DataTable dt = ServerHelper.GetData("com.steering.pss.judge.DAL.QcmZbsQueryFrm.doQuerLanguage3", 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(); List list = Core.Mes.Client.Comm.Server.FileHelper.Download(zbsName); if (list.Count < 1) { MessageUtil.ShowTips("存在无效的质保书版本,请确认后打印!"); return; } ShowByListFileBean(list); string filePath = Environment.CurrentDirectory + "\\Tmp\\" + ingname[i]; pdfPrint(filePath, "open"); } } } private void pdfPrint(string filePath) { pdfPrint(filePath,"print"); } private void pdfPrint(string filePath, string startInfo) { 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 = startInfo; //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 ing = new List(); private List list = new List(); private string currentFileName = ""; public event FileChange FileChangeEvent; /// /// 通过文件集合(图片)显示出来。 /// /// public void ShowByListFileBean(List 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 { } } /// /// 质保书状态修改 /// 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(); } } /// /// 修改质保书合同 /// private void DoUpdateOrderNno() { 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["ZbsOrderNo"].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 = "doUpdateOrderNno"; 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(); } } /// /// 修改许可证号 /// 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(); } } /// /// 查询 /// 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 strZbs = ""; if (Checzbs.Checked) { strZbs = ultraZbsType.Text.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 listSource = null; if (this.CustomInfo.Equals("xiaoshou")) { listSource = EntityHelper.GetData( "com.steering.pss.judge.DAL.QcmZbsQueryFrm.getOrderInfoByBiltNo", new object[] { param, status, this.UserInfo.GetDeptid(), this.UserInfo.GetUserName(), strZbs }, this.ob); } else { listSource = EntityHelper.GetData( "com.steering.pss.judge.DAL.QcmZbsQueryFrm.getOrderInfoByBiltNo", new object[] { param, status, this.UserInfo.GetDeptid(), strZbs }, 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 listSource = EntityHelper.GetData( "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(); } } /// /// 按回车键触发查询按钮 /// /// /// 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; } } } /// /// 质保书查看,上传,删除 /// /// /// 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 listPdf = new List(); 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 billName = row.Cells["ZbsName"].Text.ToString(); string tsMemo = this.ultraOptionSet1.CheckedItem.DataValue.ToString(); string address = this.ultraOptionSet2.CheckedItem.DataValue.ToString(); string laguageName = row.Cells["LanguageName"].Text.ToString(); string laguageCode = row.Cells["LanguageCode"].Text.ToString(); string zbsTypeDesc = row.Cells["ZbsTypeDesc"].Text.ToString(); string zbsTypeCode = row.Cells["ZbsTypeCode"].Text.ToString(); string askSubItmeVal = ""; //if (laguageName.Equals("") || laguageName == null || laguageCode.Equals("") || laguageCode == null ) //{ // MessageUtil.ShowTips("请先维护质保书语言!"); // return; //} //if (zbsTypeDesc.Equals("") || zbsTypeDesc == null || zbsTypeCode.Equals("") || zbsTypeCode == null) //{ // MessageUtil.ShowTips("请先维护质保书类型!"); // return; //} 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")) { //查看 //if (!this.CustomInfo.Equals("xiaoshou")) //{ string filePath = row.GetValue("ZbsPath"); FormFileDown askDown = new FormFileDown(this.ob, filePath); askDown.CtrlFileDown1.Button3.Visible = false; askDown.Show(); //} //销售的查看没有下载 //if (this.CustomInfo.Equals("xiaoshou")) //{ // askDown.CtrlFileDown1.Button5.Visible = false; //} } else if (e.Button.Key.ToLower().Equals("add")) { //维护 IQueryable 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()); } } //laguageName,laguageCode,zbsTypeDesc,zbsTypeCode, QcmZbsLanguage lan = new QcmZbsLanguage(laguageName, laguageCode, zbsTypeDesc, zbsTypeCode, billNo, orderNo, ordLnDlyPk, metricSystem, askSubItmeVal, billNoSeq, parm, tsMemo, address, billName, this.CustomInfo, ob); lan.ShowDialog(); } else { //打印 if (row.Cells["ZbsName"].Text.ToString().Equals("")) { MessageUtil.ShowTips("质保书为空,请选择或维护!"); return; } string zbsName = row.Cells["ZbsPath"].Text.ToString(); List 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.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(); } } 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("刷新成功"); } } }