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 CoreFS.CA06; using System.Collections; using Core.Mes.Client.Comm.Tool; using Core.Mes.Client.Comm.Server; using Core.Mes.Client.Comm.Control; namespace Core.StlMes.Client.Lims.Data.PipeAndOutdec { public partial class FrmMakeCheck : FrmBase { private string arrId;//数据权限 public FrmMakeCheck() { InitializeComponent(); this.IsLoadUserView = true; } private void FrmMakeCheck_Load(object sender, EventArgs e) { RegStartTime.Value = DateTime.Parse(DateTime.Today.ToString("yyyy-MM-dd")); arrId = UserInfo.GetDeptid(); } /// /// 重写基类方法 /// /// /// public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": doQueryData(); break; case "Check": autoCheck(); break; case "HandCheck": handCheck(); break; case "Export": ExportData(); break; case "Print": DoPrint(); break; case "Close": this.Close(); break; } } /// /// 手动抽查 /// private void handCheck() { string strRegStart = this.RegStartTime.Value.ToString("yyyy-MM-dd"); string userName = this.UserInfo.GetUserName(); string checkNo = this.ultraGrid2.ActiveRow.Cells["CHECK_NO"].Value.ToString(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.lims.data.pipe.FrmMakeCheck"; ccp.MethodName = "handCheck"; ccp.ServerParams = new object[] { strRegStart, arrId, userName ,checkNo}; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("手动抽查成功!")) { doQueryData(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } /// /// 打印 /// private void DoPrint() { string url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepPipeMakeCheck.cpt&op=view&DEPT_ID=" + arrId; 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(); } /// /// 自动抽查 /// private void autoCheck() { string strRegStart = this.RegStartTime.Value.ToString("yyyy-MM-dd"); string userName = this.UserInfo.GetUserName(); string checkCount = ""; //需要抽查的报告份数 DataTable dt2 = Core.Mes.Client.Comm.Server.ServerHelper.GetData("com.steering.lims.data.pipe.FrmMakeCheck.doQueryCheckCount", new Object[] { strRegStart, arrId }, this.ob); checkCount = dt2.Rows[0]["checkCount"].ToString3(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.lims.data.pipe.FrmMakeCheck"; ccp.MethodName = "autoCheck"; ccp.ServerParams = new object[] { strRegStart, arrId, userName, checkCount }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("自动抽查成功!")) { doQueryData(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } /// /// 查询 /// private void doQueryData() { this.dataTable1.Clear(); string strRegStart = this.RegStartTime.Value.ToString("yyyy-MM-dd"); string sumCount = ""; //发出的报告份数 string checkCount = ""; //需要抽查的报告份数 DataTable dt = ServerHelper.GetData("com.steering.lims.data.pipe.FrmMakeCheck.doQueryData", new Object[] { strRegStart,arrId }, this.ob); GridHelper.CopyDataToDatatable(dt, this.dataTable1, true); GridHelper.RefreshAndAutoSize(this.ultraGrid1); DataTable dt2 = ServerHelper.GetData("com.steering.lims.data.pipe.FrmMakeCheck.doQueryAuditData", new Object[] { strRegStart, arrId }, this.ob); GridHelper.CopyDataToDatatable(dt2, this.dataTable2, true); GridHelper.RefreshAndAutoSize(this.ultraGrid2); DataTable dt3 = ServerHelper.GetData("com.steering.lims.data.pipe.FrmMakeCheck.doQueryCheckCount", new Object[] { strRegStart, arrId }, this.ob); sumCount = dt3.Rows[0]["sumCount"].ToString3(); checkCount = dt3.Rows[0]["checkCount"].ToString3(); this.ultraLabel1.Text = strRegStart + "共发出报告" + sumCount + "份,共需抽检报告:" + checkCount + "份."; ultraLabel1.ForeColor = Color.Red; } /// /// 导出 /// private void ExportData() { GridHelper.ulGridToExcel(ultraGrid1, "检验周期抽查"); } } }