| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297 |
- using Core.Mes.Client.Comm.Control;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.ZGMil.Entity;
- using CoreFS.CA06;
- using Infragistics.Win.UltraWinGrid;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Drawing.Printing;
- using System.Linq;
- using System.Text;
- using System.Threading;
- using System.Windows.Forms;
- using System.IO;
- namespace Core.StlMes.Client.ZGMil.Report
- {
- public partial class FrmProcessFlowCard : FrmBase
- {
- private string departm = "";
- //private string plineCode = "";
- private string[] plineCode = null;
- public FrmProcessFlowCard()
- {
- InitializeComponent();
- this.IsLoadUserView = true;
- }
- private void FrmProcessFlowCard_Load(object sender, EventArgs e)
- {
- NativeMethodNew na = new NativeMethodNew(this.ob);
- departm = UserInfo.GetDepartment();
- //plineCode = na.GetPCode(departm);//获取 用户 对应的产线
- plineCode = na.GetPCodePline(this.ValidDataPurviewIds);
- /* try
- {
- //20250828 获取本地打印机
- // 清空ComboBox现有项
- comboBox1.Items.Clear();
- // 获取所有已安装的打印机
- foreach (string printer in PrinterSettings.InstalledPrinters)
- {
- comboBox1.Items.Add(printer);
- }
- // 如果有打印机,选择第一项
- if (comboBox1.Items.Count > 0)
- {
- comboBox1.SelectedIndex = 0;
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show($"加载打印机列表时出错: {ex.Message}");
- }*/
- }
- /// <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 "Close":
- this.Close();
- break;
- case "Excel":
- doExcel();
- break;
- }
- }
-
- private void chkDate_CheckedChanged(object sender, EventArgs e)
- {
- if (chkScph.Checked) { txtLotNo.Enabled = true; } else { txtLotNo.Enabled = false; }
- if (chkLh.Checked) { txtJutNo.Enabled = true; } else { txtJutNo.Enabled = false; }
- }
- private void doQuery()
- {
- ArrayList list = new ArrayList();
- string strLotNo = "";
- string strJuNo = "";
- if (chkScph.Checked)
- {
- if (txtLotNo.Text.Trim() == "")
- {
- MessageUtil.ShowTips("请输入生产批号!");
- return;
- }
- else
- {
- strLotNo = txtLotNo.Text.ToString();
- }
- }
- if (chkLh.Checked)
- {
- if (txtJutNo.Text.Trim() == "")
- {
- MessageUtil.ShowTips("请输入炉号!");
- return;
- }
- else
- {
- strJuNo = txtJutNo.Text.ToString();
- }
- }
- System.Data.DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.report.FrmProcessFlowCard.queryMinResult", new Object[] { strLotNo, strJuNo, plineCode }, this.ob);
- GridHelper.CopyDataToDatatable(dt, this.dataTable1, true);
- }
- private void ultraGrid1_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e)
- {
- e.Row.Cells["CARD"].Value = "打印";
- }
- private void ultraGrid1_ClickCellButton(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
- {
- UltraGridRow row = ultraGrid1.ActiveRow;
- if (row == null) return;
- string plineNo = row.Cells["PLINE_CODE"].Value.ToString();//产线
- string plineName = row.Cells["PLINE_NAME"].Value.ToString();//产线
- string juNo = row.Cells["JUDGE_STOVE_NO"].Value.ToString();
- string url = "";
- //if (plineNo == "C009" || plineNo == "C017")
- //{
- // url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilMobileCardSon.cpt&__bypagesize__=false&JudgeStoveNo=" + juNo + "";
- //}
- //else if (plineNo == "C008" || plineNo == "C010")
- //{
- // MessageUtil.ShowTips(plineName+"暂无模板!"); return;
- //}
- //else
- //{
- // MessageUtil.ShowTips("无产线!"); return;
- //}
- if (plineNo.Equals("C072"))
- {
- url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilMobileCardSon.cpt&op=view&JudgeStoveNo=" + juNo + "";
- }
- else
- {
- url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilMobileCardSon.cpt&op=view&JudgeStoveNo=" + juNo + "";
- }
-
- FrmRepExcel fre = new FrmRepExcel(this.ob, url);
- //fre.AutoSize = true;
- fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
- fre.Text = "工艺流动卡";
- fre.ShowDialog();
- }
- private void card_pathT_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
- {
- if (ultraGrid1.ActiveRow == null) return;
- UltraGridRow row = ultraGrid1.ActiveRow;
- if (e.Button.Key.Equals("CK"))
- {
- FormFileDown down = new FormFileDown(this.ob, row.Cells["CARD_PATH"].Text);
- down.ShowDialog();
- }
- else
- {
- string filePath = "MESServer/" + "CARD" + "/" + row.Cells["PLINE_CODE"].Text + "/" + row.Cells["JUDGE_STOVE_NO"].Text + "/";
- FormFileDown down = new FormFileDown(this.ob, filePath);
- down.CtrlFileDown1.FilePath = filePath;
- List<FileBean> list = new List<FileBean>();
- FileBean bean = new FileBean();
- OpenFileDialog file = new OpenFileDialog();
- file.Multiselect = true;
- DialogResult drStat;
- drStat = file.ShowDialog();
- if (drStat == DialogResult.OK)
- {
- foreach (string fileName in file.FileNames)
- {
- bean = new FileBean();
- string filena = System.IO.Path.GetFileName(fileName);
- bean.setFileName(filena);
- bean.setPathName(filePath);
- bean.setFile(FileHelper.FileToArray(fileName));
- list.Add(bean);
- }
- bool isSuccess = Core.Mes.Client.Comm.Server.FileHelper.Upload(list);
- if (isSuccess)
- {
- Thread.Sleep(100); //等待一下下
- DoUpdateFilePath(filePath, true);
- }
- else
- {
- MessageBox.Show("上传失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Question);
- }
- }
- }
- }
- private void DoUpdateFilePath(string filePath, bool showTips)
- {
- var ccp = new CoreClientParam
- {
- ServerName = "com.steering.mes.zgmil.report.FrmProcessFlowCard",
- MethodName = "DoUpdateFilePath",
- ServerParams = new object[]
- {
- ultraGrid1.ActiveRow.Cells["JUDGE_STOVE_NO"].Text,
- filePath
- }
- };
- ccp = ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1 && showTips)
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- if (ccp.ReturnInfo.Contains("成功!"))
- doQuery();
- }
- else if (!showTips)
- {
- doQuery();
- }
- }
- //批量打印
- private void button1_Click(object sender, EventArgs e)
- {
- try
- {
- foreach (UltraGridRow row in ultraGrid1.Rows)
- {
- if (Convert.ToBoolean(row.Cells["CHC"].Text) == true)
- {
-
- string plineNo = row.Cells["PLINE_CODE"].Value.ToString();//产线
- string plineName = row.Cells["PLINE_NAME"].Value.ToString();//产线
- string juNo = row.Cells["JUDGE_STOVE_NO"].Value.ToString();
- string url = "";
-
- if (plineNo.Equals("C072"))
- {
- url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilMobileCardSon.cpt&op=view&JudgeStoveNo=" + juNo + "";
- }
- else
- {
- url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilMobileCardSon.cpt&op=view&JudgeStoveNo=" + juNo + "";
- }
- FrmRepExcel fre = new FrmRepExcel(this.ob, url);
- fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
- fre.Text = "工艺流动卡";
- fre.ShowDialog();
- }
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show($"打印时出错: {ex.Message}");
- }
- }
- private void doExcel()
- {
-
- }
- }
- }
|