| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576 |
- using Core.Mes.Client.Comm.Control;
- using Core.Mes.Client.Comm.Server;
- using CoreFS.CA06;
- using Infragistics.Win.UltraWinGrid;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using Core.Mes.Client.Comm.Tool;
- namespace Core.StlMes.Client.Lims.Data.PipeAndOutdec.数据管理.钢管实验管理
- {
- public partial class FrmLabDate : FrmBase
- {
- private string[] plineCodes = { };
- public FrmLabDate()
- {
- InitializeComponent();
- }
- protected override void OnLoad(EventArgs e)
- {
- base.OnLoad(e);
- InitColumns();
- plineCodes = comm.GetPlineCode(ValidDataPurviewIds, ob);
- }
- private void InitColumns()
- {
- DateTime now = DateTime.Now;
- DateTime date = new DateTime(now.Year, now.Month, 1);
- cmbDate.Value = DateTime.Parse(date.ToString("yyyy-MM-dd 07:00"));
- cmbEndDate.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm"));
- //加载产线
- DataTable dt = PublicServer.GetData("com.steering.lims.data.pipe.FrmCheckConsignAdd.queryPlineCode", new object[] { plineCodes }, ob);
- if (dt != null && dt.Rows.Count > 0)
- {
- ultraPLINE_CODE.DataSource = dt;
- ultraPLINE_CODE.ValueMember = "PLINE_CODE";
- ultraPLINE_CODE.DisplayMember = "PLINE_NAME";
- ucPlineCode.DataSource = dt;
- ucPlineCode.ValueMember = "PLINE_CODE_A";
- ucPlineCode.DisplayMember = "PLINE_NAME";
- }
- }
- /// <summary>
- /// 重写基类方法
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="ToolbarKey"></param>
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "Query":
- doQuery();
- break;
- case "Export":
- ExportData();
- break;
- case "Print":
- doPrint();
- break;
- case "Close":
- this.Close();
- break;
- }
- }
- //打印
- /// <summary>
- /// 打印
- /// </summary>
- private void doPrint()
- {
- UltraGridRow row = ugMain.ActiveRow;
- string CHECK_NO = row.Cells["CHECK_NO"].Text.ToString();
- string CONTRACT_NO = row.Cells["CONTRACT_NO"].Text.ToString();
- string CAILI_PATH = row.Cells["CAILI_PATH"].Text.ToString();
- string JINWU_PATH = row.Cells["JINWU_PATH"].Text.ToString();
- string url = "";
- if (!CAILI_PATH.Equals("") && !JINWU_PATH.Equals(""))
- {
- url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepLimsPipeLxRclJw.cpt&CHECK_NO=" + CHECK_NO + "&CONTRACT_NO=" + CONTRACT_NO;
- }
- if (!CAILI_PATH.Equals("") && JINWU_PATH.Equals(""))
- {
- url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepLimsPipeLxRcl.cpt&CHECK_NO=" + CHECK_NO + "&CONTRACT_NO=" + CONTRACT_NO;
- }
- if (CAILI_PATH.Equals("") && !JINWU_PATH.Equals(""))
- {
- url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepLimsPipeRclJw.cpt&CHECK_NO=" + CHECK_NO + "&CONTRACT_NO=" + CONTRACT_NO;
- }
-
- FrmExcel fre = new FrmExcel(this.ob, url);
- fre.AutoSize = true;
- fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
- fre.WindowState = FormWindowState.Maximized;
- fre.Show();
- }
- /// <summary>
- /// 查询
- /// </summary>
- private void doQuery()
- {
- string date = "";
- string endDate = "";
- string CHECK_NO = "";
- string CONTRACT_NO = "";
- string HEAT_NO = "";
- string PLINE_CODE = "";
- if (chkDate.Checked)
- {
- if (DataTimeUtil.JudgeTime(DateTime.Parse(cmbDate.Value.ToString()), DateTime.Parse(cmbEndDate.Value.ToString())) == 0)
- {
- MessageUtil.ShowTips("您所选择的日期区域不对,请重新选择!");
- return;
- }
- else
- {
- date = cmbDate.Value.ToString();
- endDate = cmbEndDate.Value.ToString();
- }
- }
- if (chkCHECK_NO.Checked)
- {
- if (ultraCHECK_NO.Text.Trim() == "")
- {
- CHECK_NO = "";
- }
- else
- {
- CHECK_NO = ultraCHECK_NO.Value.ToString();
- }
- }
- if (chkCONTRACT_NO.Checked)
- {
- if (ultraCONTRACT_NO.Text.Trim() == "")
- {
- CONTRACT_NO = "";
- }
- else
- {
- CONTRACT_NO = ultraCONTRACT_NO.Value.ToString();
- }
- }
- if (chkHEAT_NO.Checked)
- {
- if (ultraHEAT_NO.Text.Trim() == "")
- {
- HEAT_NO = "";
- }
- else
- {
- HEAT_NO = ultraHEAT_NO.Value.ToString();
- }
- }
- if (chkPLINE_CODE.Checked)
- {
- if (ultraPLINE_CODE.Text.Trim() == "")
- {
- PLINE_CODE = "";
- }
- else
- {
- PLINE_CODE = ultraPLINE_CODE.Value.ToString().Substring(0, 4);
- }
- }
- if (CHECK_NO + CONTRACT_NO + HEAT_NO + PLINE_CODE + date == "")
- {
- MessageBox.Show("请输入查询条件");
- return;
- }
- //WaitingForm2 wf = new WaitingForm2("正在加载,请稍候....");
- DataTable dt = PublicServer.GetData("com.steering.lims.data.pipe.FrmCheckConsignAdd.queryReport", new Object[] { date, endDate, CHECK_NO, CONTRACT_NO, HEAT_NO, PLINE_CODE, plineCodes }, this.ob);
- if (dt == null || dt.Rows.Count == 0)
- {
- MessageBox.Show("没有找到数据,请重新输入查询条件!");
- return;
- }
- GridHelper.CopyDataToDatatable(dt, this.dataTable1, true);
- GridHelper.RefreshAndAutoSize(this.ugMain);
- //wf.Close();
- }
- /// <summary>
- /// 批量下载
- /// </summary>
- private void ExportData()
- {
- if (ugMain.Selected.Rows.Count <= 0)
- {
- MessageUtil.ShowWarning("请拖选您要批量下载的探伤报告!");
- return;
- }
- List<string> pathList = new List<string>();
- foreach (UltraGridRow uRow in ugMain.Selected.Rows)
- {
- if (uRow.GetType() != typeof(Infragistics.Win.UltraWinGrid.UltraGridGroupByRow))
- {
- string CAILI_PATH = uRow.GetValue("CAILI_PATH");
- if (CAILI_PATH != "") { pathList.Add(CAILI_PATH); }
- string FUSHI_PATH = uRow.GetValue("FUSHI_PATH");
- if (FUSHI_PATH != "") { pathList.Add(FUSHI_PATH); }
- string JINWU_PATH = uRow.GetValue("JINWU_PATH");
- if (JINWU_PATH != "") { pathList.Add(JINWU_PATH); }
- string GONGCHENG_PATH = uRow.GetValue("GONGCHENG_PATH");
- if (GONGCHENG_PATH != "") { pathList.Add(GONGCHENG_PATH); }
- string DIBEI_PATH = uRow.GetValue("DIBEI_PATH");
- if (DIBEI_PATH != "") { pathList.Add(DIBEI_PATH); }
- string HUAXUE_PATH = uRow.GetValue("HUAXUE_PATH");
- if (HUAXUE_PATH != "") { pathList.Add(HUAXUE_PATH); }
- }
- }
- dlgOrderAskDown down = new dlgOrderAskDown(this.ob, pathList);
- down.DeleteButton.Visible = false;
- down.ShowDialog();
- //打开下载后的文件夹
- if (down.Pic != "")
- System.Diagnostics.Process.Start("Explorer.exe", down.Pic);
- }
- private void chkDate_CheckedChanged(object sender, EventArgs e)
- {
- if (chkDate.Checked) { cmbDate.Enabled = true; } else { cmbDate.Enabled = false; }
- if (chkDate.Checked) { cmbEndDate.Enabled = true; } else { cmbEndDate.Enabled = false; }
- if (chkCHECK_NO.Checked) { ultraCHECK_NO.Enabled = true; } else { ultraCHECK_NO.Enabled = false; }
- if (chkCONTRACT_NO.Checked) { ultraCONTRACT_NO.Enabled = true; } else { ultraCONTRACT_NO.Enabled = false; }
- if (chkHEAT_NO.Checked) { ultraHEAT_NO.Enabled = true; } else { ultraHEAT_NO.Enabled = false; }
- if (chkPLINE_CODE.Checked) { ultraPLINE_CODE.Enabled = true; } else { ultraPLINE_CODE.Enabled = false; }
- }
- private void ultraTextEditor1_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
- {
- UltraGridRow row = ugMain.ActiveRow;
- if (e.Button.Key.ToLower().Equals("select"))
- {
- if (ugMain.ActiveCell.Column.Key == "CAILI_PATH")
- {
- //材力报告
- string filePath = row.GetValue("CAILI_PATH");
- dlgOrderAskDown down = new dlgOrderAskDown(this.ob, filePath);
- down.DeleteButton.Visible = false;
- down.ShowDialog();
- }
- else if (ugMain.ActiveCell.Column.Key == "CAILI_PATH_FUJIAN")
- {
- //材力报告附件
- string filePath = row.GetValue("CAILI_PATH_FUJIAN");
- dlgOrderAskDown down = new dlgOrderAskDown(this.ob, filePath);
- down.DeleteButton.Visible = false;
- down.ShowDialog();
- }
- else if (ugMain.ActiveCell.Column.Key == "FUSHI_PATH")
- {
- //腐蚀报告
- string filePath = row.GetValue("FUSHI_PATH");
- dlgOrderAskDown down = new dlgOrderAskDown(this.ob, filePath);
- down.DeleteButton.Visible = false;
- down.ShowDialog();
- }
- else if (ugMain.ActiveCell.Column.Key == "JINWU_PATH")
- {
- //金物报告
- string filePath = row.GetValue("JINWU_PATH");
- dlgOrderAskDown down = new dlgOrderAskDown(this.ob, filePath);
- down.DeleteButton.Visible = false;
- down.ShowDialog();
- }
- else if (ugMain.ActiveCell.Column.Key == "GONGCHENG_PATH")
- {
- //工程报告
- string filePath = row.GetValue("GONGCHENG_PATH");
- dlgOrderAskDown down = new dlgOrderAskDown(this.ob, filePath);
- down.DeleteButton.Visible = false;
- down.ShowDialog();
- }
- else if (ugMain.ActiveCell.Column.Key == "DIBEI_PATH")
- {
- //低倍报告
- string filePath = row.GetValue("DIBEI_PATH");
- dlgOrderAskDown down = new dlgOrderAskDown(this.ob, filePath);
- down.DeleteButton.Visible = false;
- down.ShowDialog();
- }
- else if (ugMain.ActiveCell.Column.Key == "HUAXUE_PATH")
- {
- //化学报告
- string filePath = row.GetValue("HUAXUE_PATH");
- dlgOrderAskDown down = new dlgOrderAskDown(this.ob, filePath);
- down.DeleteButton.Visible = false;
- down.ShowDialog();
- }
- }
- if (e.Button.Key.ToLower().Equals("update"))
- {
- if (ugMain.ActiveCell.Column.Key == "CAILI_PATH")
- {
- //材力报告
- string filePath = row.GetValue("CAILI_PATH");
- updateFile(filePath);
- }
-
- else if (ugMain.ActiveCell.Column.Key == "FUSHI_PATH")
- {
- //腐蚀报告
- string filePath = row.GetValue("FUSHI_PATH");
- updateFile(filePath);
- }
- else if (ugMain.ActiveCell.Column.Key == "JINWU_PATH")
- {
- //金物报告
- string filePath = row.GetValue("JINWU_PATH");
- updateFile(filePath);
- }
- else if (ugMain.ActiveCell.Column.Key == "GONGCHENG_PATH")
- {
- //工程报告
- string filePath = row.GetValue("GONGCHENG_PATH");
- updateFile(filePath);
- }
- else if (ugMain.ActiveCell.Column.Key == "DIBEI_PATH")
- {
- //低倍报告
- string filePath = row.GetValue("DIBEI_PATH");
- updateFile(filePath);
- }
- else if (ugMain.ActiveCell.Column.Key == "HUAXUE_PATH")
- {
- //化学报告
- string filePath = row.GetValue("HUAXUE_PATH");
- updateFile(filePath);
- }
- }
- }
- /// <summary>
- /// 替换
- /// </summary>
- /// <param name="path"></param>
- private void updateFile(string path)
- {
- List<FileBean> list = new List<FileBean>();
- FileBean bean = new FileBean();
- OpenFileDialog file = new OpenFileDialog();
- //file.Filter = "图片文件(*.jpg);(*.gif);(*.png);(*.bmp)|*.jpg;*.gif;*.png;*.bmp";
- //file.Title = "选择需要上传的图片";
- file.Multiselect = false;
- DialogResult drStat;
- drStat = file.ShowDialog();
- if (drStat == DialogResult.OK)
- {
- string filePath = file.FileName;
- string fileName = System.IO.Path.GetFileName(filePath);
- bean = new FileBean();
- bean.setFileName(fileName);
- bean.setPathName(path);
- bean.setFile(FileHelper.FileToArray(filePath));
- list.Add(bean);
- bool isSuccess = Core.Mes.Client.Comm.Server.FileHelper.Upload(list);
- if (isSuccess)
- {
- MessageUtil.ShowTips("替换成功!");
- }
- else
- {
- MessageUtil.ShowTips("替换失败,请重试!");
- }
- }
- }
- private void ultraPlineCODE_InitializeRow(object sender, InitializeRowEventArgs e)
- {
- if (e.Row.Cells["CAILI_FLAG"].Value.ToString2() == "1")
- {
- e.Row.Cells["CAILI_PATH"].EditorComponent = ucView;
- e.Row.Cells["CAILI_PATH_FUJIAN"].EditorComponent = ucView;
- if (e.Row.Cells["CAILI_STATUS"].Value.ToString2() == "4" || e.Row.Cells["CAILI_STATUS"].Value.ToString2() == "5")
- {
- e.Row.Cells["CAILI_PATH"].Appearance.BackColor = Color.LightGreen;
- }
- }
- if (e.Row.Cells["FUSHI_FLAG"].Value.ToString2() == "1")
- {
- e.Row.Cells["FUSHI_PATH"].EditorComponent = ucView;
- if (e.Row.Cells["FUSHI_STATUS"].Value.ToString2() == "4" || e.Row.Cells["FUSHI_STATUS"].Value.ToString2() == "5")
- {
- e.Row.Cells["FUSHI_PATH"].Appearance.BackColor = Color.LightGreen;
- }
- }
- if (e.Row.Cells["JINWU_FLAG"].Value.ToString2() == "1")
- {
- e.Row.Cells["JINWU_PATH"].EditorComponent = ucView;
- if (e.Row.Cells["JINWU_STATUS"].Value.ToString2() == "4" || e.Row.Cells["JINWU_STATUS"].Value.ToString2() == "5")
- {
- e.Row.Cells["JINWU_PATH"].Appearance.BackColor = Color.LightGreen;
- }
- }
- if (e.Row.Cells["GONGCHENG_FLAG"].Value.ToString2() == "1")
- {
- e.Row.Cells["GONGCHENG_PATH"].EditorComponent = ucView;
- if (e.Row.Cells["GONGCHENG_STATUS"].Value.ToString2() == "4" || e.Row.Cells["GONGCHENG_STATUS"].Value.ToString2() == "5")
- {
- e.Row.Cells["GONGCHENG_PATH"].Appearance.BackColor = Color.LightGreen;
- }
- }
- if (e.Row.Cells["DIBEI_FLAG"].Value.ToString2() == "1")
- {
- e.Row.Cells["DIBEI_PATH"].EditorComponent = ucView;
- if (e.Row.Cells["DIBEI_STATUS"].Value.ToString2() == "4" || e.Row.Cells["DIBEI_STATUS"].Value.ToString2() == "5")
- {
- e.Row.Cells["DIBEI_PATH"].Appearance.BackColor = Color.LightGreen;
- }
- }
- if (e.Row.Cells["HUAXUE_FLAG"].Value.ToString2() == "1")
- {
- e.Row.Cells["HUAXUE_PATH"].EditorComponent = ucView;
- if (e.Row.Cells["HUAXUE_STATUS"].Value.ToString2() == "4" || e.Row.Cells["HUAXUE_STATUS"].Value.ToString2() == "5")
- {
- e.Row.Cells["HUAXUE_PATH"].Appearance.BackColor = Color.LightGreen;
- }
- }
- }
- private void button1_Click(object sender, EventArgs e)
- {
- foreach (UltraGridRow uRow in ugMain.Rows)
- {
- string checkNo = uRow.Cells["CHECK_NO"].Text.Trim();
- string filePathNew = "";
- #region 上传化学报告
- if (uRow.Cells["HUAXUE_FLAG"].Value.ToString2() == "1" &&
- uRow.Cells["HUAXUE_PATH"].Value.ToString2() == "" &&
- (uRow.Cells["HUAXUE_STATUS"].Value.ToString2() == "4" || uRow.Cells["HUAXUE_STATUS"].Value.ToString2() == "5"))
- {
- if (UpLoadHandle.Upload(checkNo, "RepPipeChemAnalysisReport.cpt", "huaxue", out filePathNew))
- {
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.lims.data.pipe.FrmLabDateParm";
- ccp.MethodName = "updatePipeReport";
- ccp.ServerParams = new object[] { checkNo, "", "", "HUAXUE_PATH", filePathNew };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("上传成功!"))
- {
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- else
- {
- MessageUtil.ShowError("系统生成PDF失败,请稍后再试!");
- }
- }
- #endregion
- #region 上传力学报告
- if (uRow.Cells["CAILI_FLAG"].Value.ToString2() == "1" &&
- uRow.Cells["CAILI_PATH"].Value.ToString2() == "" &&
- (uRow.Cells["CAILI_STATUS"].Value.ToString2() == "4" || uRow.Cells["CAILI_STATUS"].Value.ToString2() == "5"))
- {
- if (UpLoadHandle.Upload(checkNo, "RepLimsPipeMetallographicPG.cpt", "caili", out filePathNew, "PG"))
- {
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.lims.data.pipe.FrmLabDateParm";
- ccp.MethodName = "updatePipeReport";
- ccp.ServerParams = new object[] { checkNo, "", "", "CAILI_PATH", filePathNew };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("上传成功!"))
- {
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- else
- {
- MessageUtil.ShowError("系统生成PDF失败,请稍后再试!");
- }
- }
- #endregion
- #region 上传金物报告
- if (uRow.Cells["JINWU_FLAG"].Value.ToString2() == "1" &&
- uRow.Cells["JINWU_PATH"].Value.ToString2() == "" &&
- (uRow.Cells["JINWU_STATUS"].Value.ToString2() == "4" || uRow.Cells["JINWU_STATUS"].Value.ToString2() == "5"))
- {
- if (UpLoadHandle.Upload(checkNo, "RepPipeMetallographic.cpt", "jinwu", out filePathNew))
- {
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.lims.data.pipe.FrmLabDateParm";
- ccp.MethodName = "updatePipeReport";
- ccp.ServerParams = new object[] { checkNo, "", "", "JINWU_PATH", filePathNew };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("上传成功!"))
- {
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- else
- {
- MessageUtil.ShowError("系统生成PDF失败,请稍后再试!");
- }
- }
- #endregion
- }
- doQuery();
- }
- }
- }
|