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.Control;
using Core.Mes.Client.Comm.Tool;
using CoreFS.CA06;
using com.steering.mes.zgmil.entity;
using Core.Mes.Client.Comm.Server;
using Infragistics.Win.UltraWinGrid;
using Infragistics.Win.UltraWinEditors;
using Core.Mes.Client.Comm.Format;
using System.Collections;
using Core.StlMes.Client.ZGMil.Entity;
using Core.StlMes.Client.ZGMil.Popup;
using Core.StlMes.Client.ZGMil.Common;
using Core.StlMes.Client.ZGMil.ResultConrtrol;
using CoreFS.SA06;
using Core.StlMes.Client.ZGMil.NodeResultQuery;
using System.Net;
namespace Core.StlMes.Client.ZGMil.Result
{
public partial class FrmSurfaceInspectionResult : FrmBase
{
//TODO:...内容...
private Infragistics.Win.UltraWinGrid.UltraGrid _grid = null;
private bool bl_Upddefect_chk = false;//是否修改之前的抽检项
private bool bl_Upddefect_UpDown = false;//是否修改之前的抽检率
private decimal Nud_val = 0;
string _ScrapNum = "";
string _OffLineNum = "";
string _LotNo = "";
double _MatHeight = 0;
string Shift = "";
string Group = "";
private string Departm = "";//部门
private string PlineCode = "";//产线
private int Qa_Flag = 0; //抽检类型 一次抽检 二次抽检
private string actJudgeStoveNo = "";
private string proPlanId = null;//轧管订单编号
private string gxPlanNo = null;//工序排产序号
private string lotNo = null;//生产批号
private string actResultNo = "";
private string TestMethod = "";
string PlanStatusQuery = "95";
string PlanStartStatusQuery = "00"; //查询结炉实绩起始状态
private string _UserName = ""; //签名 姓名
private string _UserID = ""; //签名 签名ID
public Infragistics.Win.UltraWinGrid.UltraGrid Grid
{
get { return _grid; }
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
//ultraGrid1.DisplayLayout.Bands[0].Columns["JUDGE_STOVE_NO"].SortIndicator = SortIndicator.Disabled;
ultraGrid_Plan.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
rollingInfomation1.UltraGrid4.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
rollingCard1.UltraGrid4.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
ultraGridMatSeq.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
//ultraGrid2.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
//ultraGrid1.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
ultraGrid3.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
//ultraGridPlan.DisplayLayout.Bands[0].PerformAutoResizeColumns(true, PerformAutoSizeType.AllRowsInBand);//自适应列宽
//ultraGridMatSeq.DisplayLayout.Bands[0].PerformAutoResizeColumns(true, PerformAutoSizeType.AllRowsInBand);
//ultraGrid1.DisplayLayout.Bands[0].PerformAutoResizeColumns(true, PerformAutoSizeType.AllRowsInBand);
//e.Layout.ViewStyleBand = Infragistics.Win.UltraWinGrid.ViewStyleBand.Vertical;
//e.Layout.Override.HeaderClickAction = Infragistics.Win.UltraWinGrid.HeaderClickAction.Select;
Shift = UserInfo.GetUserOrder();
Group = UserInfo.GetUserGroup();
}
///
/// 判断是否能开始当前炉次
///
///
private void IsStart()
{
foreach (UltraGridRow ugr in ultraGridPlan.Rows)
{
if (ugr.Cells["IS_START"].Value.ToString() == "已开始质检")
{
MessageBox.Show("炉号【" + ugr.Cells["JUDGE_STOVE_NO"].Value.ToString() + "】正在质检,不能两炉同时开始质检");
return;
}
}
}
///
/// 页面开启事件
///
///
protected override void OnShown(EventArgs e)
{
base.OnShown(e);
//string hostname = Dns.GetHostName();
//IPAddress ip = Dns.GetHostByName(hostname).AddressList[0];
NativeMethodNew na = new NativeMethodNew(this.ob);
//TestMethod = na.GetOperateResult(ip.ToString(), "1");
//if (TestMethod == "无匹配数据")
//{
// MessageBox.Show("提示:该电脑不是探伤操作台电脑,不允许操作改界面", "提示", MessageBoxButtons.OK);
// this.Dispose();
// this.Close();
//}
Departm = UserInfo.GetDepartment();
PlineCode = na.GetPCode(Departm);//获取 用户 对应的产线
SurfaceQuery();
foreach (UltraGridRow ugr in ultraGrid_Plan.Rows)
{
ugr.Cells["JUDGE_NO"].Value = BaseMethod.getJudgeStoveNo(ugr.Cells["JUDGE_STOVE_NO"].Value.ToString());
}
Departm = UserInfo.GetDepartment();
PlineCode = na.GetPCode(Departm);//获取 用户 对应的产线
if (PlineCode.Equals("C009") || PlineCode.Equals("C012") || PlineCode.Equals("C017") || PlineCode.Equals("C072"))
{
this.rollingCard1.ChangCard();
}
Sign();
ShowShift();
}
private void ShowShift()
{
colShowShiftGroup1.Ob = this.ob;
colShowShiftGroup1.Group = this.UserInfo.GetUserGroup();
colShowShiftGroup1.Shift = this.UserInfo.GetUserOrder();
colShowShiftGroup1.ShowShift();
colShowShiftGroup1.Timer1.Enabled = true;
}
///
/// 签名
///
private void Sign()
{
ColUserName col = new ColUserName();
col.StationId = "9";
col.PlineCode = PlineCode;
col.ColGroup = Group;
col.Ob = this.ob;
col.ShowDialog();
_UserID = col.getUserId();
_UserName = col.getUserName();
}
///
/// 控件加载构造函数
///
public FrmSurfaceInspectionResult()
{
InitializeComponent();
GridHelper.InitCardGrid(SurfaceDataSource, ultraGrid4);//显示人工质检主信息界面
_grid = this.ultraGrid4;
}
///
/// checkbox点击事件
///
///
///
private void chk_CheckedChanged(object sender, EventArgs e)
{
u_TxtEditor_ProNo.Enabled = u_ChkEditor_ProNo.Checked;//生产批号查询
u_TxtEditor_StrvoNo.Enabled = u_ChkEditor_StoveNo.Checked;//炉号查询
}
///
/// ToolBar按钮
///
///
///
public override void ToolBar_Click(object sender, string ToolbarKey)
{
switch (ToolbarKey)
{
case "Query":
SurfaceQuery();
break;
case "Save":
SurfaceSave();
break;
case "Node":
FeedSawResultNode();
break;
case "DoNodeBack":
NodeBack();
break;
case "NodeQuery":
NodeQuery();
break;
case "geeDefect":
Popup.frmDefectManage frmdm = new Core.StlMes.Client.ZGMil.Popup.frmDefectManage(this.ob);
frmdm.ShowDialog();
break;
case "InSpectorMana":
Popup.frmInspector frmdm1 = new Core.StlMes.Client.ZGMil.Popup.frmInspector(this.ob);
frmdm1.ShowDialog();
break;
case "DoSizeCheck":
DoSizeCheck();
break;
case "DoStart":
DoStart();
break;
case "DoStartBack":
DoStartBack();
break;
case "DoCheck":
DoCheck();
break;
case "DoCheckS":
//DoCheck(2);
break;
case "DoCheckSCancel":
DoCheckSCancel();
break;
case "DoPrint":
doPrint();
break;
case "DoPrint1":
doPrint1();
break;
case "DoPrintTest":
doPrintTest();
break;
case "UpFile":
UpFile();
break;
case "UpFileAgain":
UpFileAgain();
break;
case "DoChangeCancel":
DoChangeCancel();
break;
case "sign":
Sign();
break;
case "Close":
this.Close();
break;
}
}
///
/// 查询上传的PDF文件
///
private void SelectFile(string filePathNew)
{
dlgOrderAskDown down = new dlgOrderAskDown(this.ob, filePathNew);
down.DeleteButton.Visible = false;
down.ShowDialog();
}
///
/// 上传跟队表检报告
///
private void UpFileAgain()
{
WebClient webClient = new WebClient();
List listPdf = new List();
string date = DateTime.Now.ToString("yyyyMMdd");
string judge = BaseMethod.getJudgeStoveNo(this.actJudgeStoveNo);
string heatno = this.actJudgeStoveNo;
string Shift = UserInfo.GetUserOrder();
string Group = UserInfo.GetUserGroup();
string url = "";
string filePathNew = ""; //探伤报告目录
string reportNo = ""; //报告编号
DataTable dt = new DataTable();
dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FileUpdate.getReportNo2", new object[] { judge, PlineCode, Shift, Group,"1" }, this.ob);
if (dt.Rows.Count > 0)
{
reportNo = dt.Rows[0][0].ToString();
}
//craftOrdDesign.CraftPath = filePathNew + craftOrdDesign.CraftNo + ".pdf";
switch (PlineCode)
{
case "C008": //250
url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilQualityEvaluationAgain250.cpt&format=pdf&JUDGE_STOVE_NO=" + judge + "&COL_GROUP=" + Group + "&COL_SHIFT=" + Shift+ "&USER_ID=" + _UserID;
filePathNew = "SurReport/250/" + judge + "/";
break;
case "C009": //258
url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilQualityEvaluationAgain258.cpt&format=pdf&JUDGE_STOVE_NO=" + judge + "&COL_GROUP=" + Group + "&COL_SHIFT=" + Shift + "&USER_ID=" + _UserID;
filePathNew = "SurReport/258/" + judge + "/";
break;
case "C010": //168
url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilQualityEvaluationAgain168.cpt&format=pdf&JUDGE_STOVE_NO=" + judge + "&COL_GROUP=" + Group + "&COL_SHIFT=" + Shift + "&USER_ID=" + _UserID;
filePathNew = "SurReport/168/" + judge + "/";
break;
case "C012": //Arssel
break;
case "C017": //460
url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilQualityEvaluationAgain460.cpt&format=pdf&JUDGE_STOVE_NO=" + judge + "&COL_GROUP=" + Group + "&COL_SHIFT=" + Shift + "&USER_ID=" + _UserID;
filePathNew = "SurReport/460/" + judge + "/";
break;
case "C072": //508
url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilQualityEvaluationAgain508.cpt&format=pdf&JUDGE_STOVE_NO=" + this.actJudgeStoveNo + "&COL_GROUP=" + Group + "&COL_SHIFT=" + Shift + "&USER_ID=" + _UserID;
filePathNew = "SurReport/508/" + judge + "/";
break;
}
byte[] pdf = webClient.DownloadData(url);
FileBean fileBean = new FileBean();
fileBean.setFile(pdf);
fileBean.setFileName(reportNo + ".pdf");
fileBean.setPathName(filePathNew);
listPdf.Add(fileBean);
webClient.Dispose();
bool a = FileHelper.Upload(listPdf);
if (a)
{
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.steering.mes.zgmil.coup.FileUpdate";
ccp.MethodName = "updateSurfaceReport";
ccp.ServerParams = new object[] { judge, Shift, Group, PlineCode, _UserName, filePathNew, "1", proPlanId, gxPlanNo };
ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
if (ccp.ReturnCode != -1)
{
if (ccp.ReturnInfo.Equals("上传成功!"))
{
MessageUtil.ShowTips(ccp.ReturnInfo);
SelectFile(filePathNew + reportNo + ".pdf");
}
else
{
MessageUtil.ShowTips(ccp.ReturnInfo);
}
}
}
else
{
MessageUtil.ShowError("系统生成PDF失败,请稍后再试!");
return;
}
}
///
/// 上传表检报告
///
private void UpFile()
{
WebClient webClient = new WebClient();
List listPdf = new List();
string date = DateTime.Now.ToString("yyyyMMdd");
string judge = BaseMethod.getJudgeStoveNo(this.actJudgeStoveNo);
string heatno = this.actJudgeStoveNo;
string Shift = UserInfo.GetUserOrder();
string Group = UserInfo.GetUserGroup();
string url = "";
string filePathNew = ""; //探伤报告目录
string reportNo = ""; //报告编号
DataTable dt = new DataTable();
dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FileUpdate.getReportNo2", new object[] { judge, PlineCode, Shift, Group ,"0"}, this.ob);
if (dt.Rows.Count > 0)
{
reportNo = dt.Rows[0][0].ToString();
}
//craftOrdDesign.CraftPath = filePathNew + craftOrdDesign.CraftNo + ".pdf";
switch (PlineCode)
{
case "C008": //250
url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilQualityEvaluation250.cpt&format=pdf&JUDGE_STOVE_NO=" + heatno + "&COL_GROUP=" + Group + "&COL_SHIFT=" + Shift;
filePathNew = "SurReport/250/" + judge + "/";
break;
case "C009": //258
url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilQualityEvaluation258.cpt&format=pdf&JUDGE_STOVE_NO=" + heatno + "&COL_GROUP=" + Group + "&COL_SHIFT=" + Shift;
filePathNew = "SurReport/258/" + judge + "/";
break;
case "C010": //168
url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilQualityEvaluation168.cpt&format=pdf&JUDGE_STOVE_NO=" + heatno + "&COL_GROUP=" + Group + "&COL_SHIFT=" + Shift;
filePathNew = "SurReport/168/" + judge + "/";
break;
case "C012": //Arssel
break;
case "C017": //460
url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilQualityEvaluation460.cpt&format=pdf&JUDGE_STOVE_NO=" + heatno + "&COL_GROUP=" + Group + "&COL_SHIFT=" + Shift;
filePathNew = "SurReport/460/" + judge + "/";
break;
case "C072": //508
url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilQualityEvaluation508.cpt&format=pdf&JUDGE_STOVE_NO=" + heatno + "&COL_GROUP=" + Group + "&COL_SHIFT=" + Shift;
filePathNew = "SurReport/508/" + judge + "/";
break;
}
byte[] pdf = webClient.DownloadData(url);
FileBean fileBean = new FileBean();
fileBean.setFile(pdf);
fileBean.setFileName(reportNo + ".pdf");
fileBean.setPathName(filePathNew);
listPdf.Add(fileBean);
webClient.Dispose();
bool a = FileHelper.Upload(listPdf);
if (a)
{
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.steering.mes.zgmil.coup.FileUpdate";
ccp.MethodName = "updateSurfaceReport";
ccp.ServerParams = new object[] { judge, Shift, Group, PlineCode, _UserName, filePathNew, "0", proPlanId, gxPlanNo };
ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
if (ccp.ReturnCode != -1)
{
if (ccp.ReturnInfo.Equals("上传成功!"))
{
MessageUtil.ShowTips(ccp.ReturnInfo);
SelectFile(filePathNew + reportNo + ".pdf");
}
else
{
MessageUtil.ShowTips(ccp.ReturnInfo);
}
}
}
else
{
MessageUtil.ShowError("系统生成PDF失败,请稍后再试!");
return;
}
}
///
/// 自动上传报告
///
private void AutoUpFile()
{
WebClient webClient = new WebClient();
List listPdf = new List();
string date = DateTime.Now.ToString("yyyyMMdd");
string judge = BaseMethod.getJudgeStoveNo(this.actJudgeStoveNo);
string heatno = this.actJudgeStoveNo;
string Shift = UserInfo.GetUserOrder();
string Group = UserInfo.GetUserGroup();
string url = "";
string filePathNew = ""; //探伤报告目录
string reportNo = ""; //报告编号
int num = 0;
DataTable dt = new DataTable();
dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FileUpdate.getReportNo2", new object[] { judge, PlineCode, Shift, Group, "0" }, this.ob);
if (dt.Rows.Count > 0)
{
reportNo = dt.Rows[0][0].ToString();
}
DataTable dt2 = new DataTable();
dt2 = ServerHelper.GetData("com.steering.mes.zgmil.coup.SurfaceInspectionResult.getIsAgain", new object[] { judge, PlineCode }, this.ob);
if (dt2.Rows.Count > 0)
{
num = int.Parse(dt2.Rows[0][0].ToString3());
}
switch (PlineCode)
{
case "C008": //250
url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilQualityEvaluation250.cpt&format=pdf&JUDGE_STOVE_NO=" + heatno + "&COL_GROUP=" + Group + "&COL_SHIFT=" + Shift + "&USER_ID=" + _UserID;
filePathNew = "SurReport/250/" + judge + "/";
break;
case "C009": //258
url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilQualityEvaluation258.cpt&format=pdf&JUDGE_STOVE_NO=" + heatno + "&COL_GROUP=" + Group + "&COL_SHIFT=" + Shift + "&USER_ID=" + _UserID;
filePathNew = "SurReport/258/" + judge + "/";
break;
case "C010": //168
url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilQualityEvaluation168.cpt&format=pdf&JUDGE_STOVE_NO=" + heatno + "&COL_GROUP=" + Group + "&COL_SHIFT=" + Shift + "&USER_ID=" + _UserID;
filePathNew = "SurReport/168/" + judge + "/";
break;
case "C012": //Arssel
break;
case "C017": //460
url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilQualityEvaluation460.cpt&format=pdf&JUDGE_STOVE_NO=" + heatno + "&COL_GROUP=" + Group + "&COL_SHIFT=" + Shift + "&USER_ID=" + _UserID;
filePathNew = "SurReport/460/" + judge + "/";
break;
case "C072": //508
if (num > 1)
{
url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilQualityEvaluationAgain508.cpt&format=pdf&JUDGE_STOVE_NO=" + heatno + "&COL_GROUP=" + Group + "&COL_SHIFT=" + Shift + "&USER_ID=" + _UserID;
}
else
{
url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilQualityEvaluation508.cp&format=pdf&JUDGE_STOVE_NO=" + heatno + "&COL_GROUP=" + Group + "&COL_SHIFT=" + Shift + "&USER_ID=" + _UserID;
}
filePathNew = "SurReport/508/" + judge + "/";
break;
}
byte[] pdf = webClient.DownloadData(url);
FileBean fileBean = new FileBean();
fileBean.setFile(pdf);
fileBean.setFileName(reportNo + ".pdf");
fileBean.setPathName(filePathNew);
listPdf.Add(fileBean);
webClient.Dispose();
bool a = FileHelper.Upload(listPdf);
if (a)
{
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.steering.mes.zgmil.coup.FileUpdate";
ccp.MethodName = "updateSurfaceReport";
ccp.ServerParams = new object[] { judge, Shift, Group, PlineCode, _UserName, filePathNew, "0", proPlanId, gxPlanNo };
ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
if (ccp.ReturnCode != -1)
{
if (ccp.ReturnInfo.Equals("上传成功!"))
{
}
else
{
MessageUtil.ShowTips(ccp.ReturnInfo);
}
}
}
else
{
MessageUtil.ShowError("系统生成PDF失败,请手动上传报告!");
return;
}
}
private String doQueryJugeNoStaus(string resultNo, string jugeNo, string plineCode)
{
string staus = "3";
DataTable ds = ServerHelper.GetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.doQueryResultStaus", new object[] { resultNo, jugeNo, plineCode, "8", proPlanId, gxPlanNo }, ob);
if (ds.Rows.Count > 0)
{
staus = ds.Rows[0]["NODE_FUR_FLAG"].ToString();
}
return staus;
}
///
/// 取消交班
///
public void DoChangeCancel()
{
UltraGridRow ugr_plan = this.ultraGrid_Plan.ActiveRow;
if (ugr_plan == null) return;
string Status = ugr_plan.Cells["IS_START"].Value.ToString();
string ActiveJUDGE_STOVE_NO = ugr_plan.Cells["JUDGE_STOVE_NO"].Value.ToString();
string ActiveResultNo = ugr_plan.Cells["ID"].Value.ToString();
if (Status == "已完成质检")
{
MessageBox.Show("炉号:【" + ActiveJUDGE_STOVE_NO + "】已完成质检操作,不允许进行交班取消!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
if (Status == "未开始质检")
{
MessageBox.Show("炉号:【" + ActiveJUDGE_STOVE_NO + "】未开始质检操作,不允许进行交班取消!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
string Shift = UserInfo.GetUserOrder();
string Group = UserInfo.GetUserGroup();
NativeMethodNew na = new NativeMethodNew(this.ob);
na.ChangeShiftBack(ActiveJUDGE_STOVE_NO, ActiveResultNo, proPlanId, gxPlanNo, PlineCode, Shift, Group, 9);
SurfaceQuery();
ChangeGridColor();
}
///
/// 打印
///
private void doPrint()
{
DateTime SeverTime = NativeMethod.GetSeverTime(this.ob);
string Time = SeverTime.ToLongTimeString();
UltraGridRow uRow = this.ultraGrid_Plan.ActiveRow;
string jugeNo =uRow.Cells["JUDGE_NO"].Value.ToString()+"-01";
if (uRow == null) return;
string strurl = "";
switch (PlineCode)
{
case "C008": //250
strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilQualityEvaluation250.cpt&format=pdf&SHIFT=" + Shift + "&GROUP=" + Group + "&JUDGE_STOVE_NO=" + jugeNo + "&USER_ID=" + _UserID;
break;
case "C009": //258
strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilQualityEvaluation258.cpt&format=pdf&SHIFT=" + Shift + "&GROUP=" + Group + "&JUDGE_STOVE_NO=" + jugeNo + "&USER_ID=" + _UserID;
break;
case "C010": //168
strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilQualityEvaluation168.cpt&format=pdf&SHIFT=" + Shift + "&GROUP=" + Group + "&JUDGE_STOVE_NO=" + jugeNo + "&USER_ID=" + _UserID;
break;
case "C012": //Arssel
break;
case "C017": //460
strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilQualityEvaluation460.cpt&format=pdf&SHIFT=" + Shift + "&GROUP=" + Group + "&JUDGE_STOVE_NO=" + jugeNo + "&USER_ID=" + _UserID;
break;
case "C072": //508
strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilQualityEvaluation508.cpt&SHIFT=" + Shift + "&GROUP=" + Group + "&JUDGE_STOVE_NO=" + jugeNo + "&USER_ID=" + _UserID;
break;
}
FrmExcel fre = new FrmExcel(this.ob, strurl);
fre.AutoSize = true;
fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
fre.WindowState = FormWindowState.Maximized;
fre.Show();
}
///
/// 打印
///
private void doPrint1()
{
DateTime SeverTime = NativeMethod.GetSeverTime(this.ob);
string Time = SeverTime.ToLongTimeString();
UltraGridRow uRow = this.ultraGrid_Plan.ActiveRow;
if (uRow == null) return;
string strurl = "";
switch (PlineCode)
{
case "C008": //250
strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilQualityEvaluationAgain250.cpt&format=pdf&SHIFT=" + Shift + "&GROUP=" + Group + "&JUDGE_STOVE_NO=" + uRow.Cells["JUDGE_NO"].Value.ToString().Substring(0, 6) + "&USER_ID=" + _UserID;
break;
case "C009": //258
strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilQualityEvaluationAgain258.cpt&format=pdf&SHIFT=" + Shift + "&GROUP=" + Group + "&JUDGE_STOVE_NO=" + BaseMethod.getJudgeStoveNo(uRow.Cells["JUDGE_NO"].Value.ToString()) + "&USER_ID=" + _UserID;
break;
case "C010": //168
strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilQualityEvaluationAgain168.cpt&format=pdf&SHIFT=" + Shift + "&GROUP=" + Group + "&JUDGE_STOVE_NO=" + BaseMethod.getJudgeStoveNo(uRow.Cells["JUDGE_NO"].Value.ToString()) + "&USER_ID=" + _UserID;
break;
case "C012": //Arssel
break;
case "C017": //460
strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilQualityEvaluationAgain460.cpt&format=pdf&SHIFT=" + Shift + "&GROUP=" + Group + "&JUDGE_STOVE_NO=" + BaseMethod.getJudgeStoveNo(uRow.Cells["JUDGE_NO"].Value.ToString()) + "&USER_ID=" + _UserID;
break;
case "C072": //508
strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilQualityEvaluationAgain508.cpt&SHIFT=" + Shift + "&GROUP=" + Group + "&JUDGE_STOVE_NO=" + uRow.Cells["JUDGE_STOVE_NO"].Value.ToString() + "&USER_ID=" + _UserID;
break;
}
FrmExcel fre = new FrmExcel(this.ob, strurl);
fre.AutoSize = true;
fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
fre.WindowState = FormWindowState.Maximized;
fre.Show();
}
///
/// 检验要点
///
private void doPrintTest()
{
UltraGridRow uRow = this.ultraGrid_Plan.ActiveRow;
if (uRow == null) return;
string strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilTestKey.cpt&format=pdf&PLINE_CODE=" + PlineCode + "&LOT_NO=" + uRow.Cells["LOT_NO"].Value.ToString() + "&JUDGE_STOVE_NO=" + uRow.Cells["JUDGE_STOVE_NO"].Value.ToString();
FrmExcel fre = new FrmExcel(this.ob, strurl);
fre.AutoSize = true;
fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
fre.WindowState = FormWindowState.Maximized;
fre.Show();
}
///
/// 查询按钮
///
public void SurfaceQuery()
{
string str_Pro_NO = "";//轧制批号
string str_STOVE_NO = "";//炉号
milplan_ReFresh(_LotNo, actJudgeStoveNo);
}
///
/// 人工质检信息保存
///
public void SurfaceSave()
{
MilSurfaceResultEntity En_Mil_Sur = new MilSurfaceResultEntity();
UltraGridRow ugr_acr = this.ultraGrid_Plan.ActiveRow;//获取激活行
if (ugr_acr == null)
{
return;
}
string str_Pro_NO = ugr_acr.Cells["LOT_NO"].Value.ToString();//轧制批号
string str_STOVE_NO = ugr_acr.Cells["JUDGE_STOVE_NO"].Value.ToString();//炉号
string resultNo = ugr_acr.Cells["ID"].Value.ToString();
//string IsStart = ugr_acr.Cells["IS_START"].Value.ToString();
string IsStart = doQueryJugeNoStaus(resultNo, str_STOVE_NO,PlineCode);
if (IsStart == "3")
{
MessageBox.Show("还未开始质检或者质检已完成,不能保存信息!");
return;
}
ultraGrid4.UpdateData();
En_Mil_Sur.RollLotNo = str_Pro_NO;
En_Mil_Sur.HeatNo = str_STOVE_NO;
En_Mil_Sur.Remark = SurfaceDataSource.Rows[0]["REMARK"].ToString();
En_Mil_Sur.DirectorQuantity = SurfaceDataSource.Rows[0]["DIRECTOR_QUANTITY"].ToString();
En_Mil_Sur.QualifiedTons = SurfaceDataSource.Rows[0]["QUALIFIED_TONS"].ToString();
En_Mil_Sur.WasteQuantity = SurfaceDataSource.Rows[0]["WASTE_QUANTITY"].ToString();
En_Mil_Sur.OfflineQuantity = SurfaceDataSource.Rows[0]["OFFLINE_QUANTITY"].ToString();
En_Mil_Sur.ExecutiveProducer = SurfaceDataSource.Rows[0]["EXECUTIVE_PRODUCER"].ToString();
En_Mil_Sur.UnevenDegree = SurfaceDataSource.Rows[0]["UNEVEN_DEGREE"].ToString();
En_Mil_Sur.NonRoundness = SurfaceDataSource.Rows[0]["NON_ROUNDNESS"].ToString();
En_Mil_Sur.PipeDiamMax = SurfaceDataSource.Rows[0]["PIPE_DIAM_MAX"].ToString();
En_Mil_Sur.PipeDiamMin = SurfaceDataSource.Rows[0]["PIPE_DIAM_MIN"].ToString();
En_Mil_Sur.PipeThicknessMax = SurfaceDataSource.Rows[0]["PIPE_THICKNESS_MAX"].ToString();
En_Mil_Sur.PipeThicknessMin = SurfaceDataSource.Rows[0]["PIPE_THICKNESS_MIN"].ToString();
En_Mil_Sur.HeadStraight = SurfaceDataSource.Rows[0]["HEAD_STRAIGHT"].ToString();
En_Mil_Sur.BodyStraight = SurfaceDataSource.Rows[0]["BODY_STRAIGHT"].ToString();
En_Mil_Sur.Length = SurfaceDataSource.Rows[0]["LENGTH"].ToString();
En_Mil_Sur.QualifiedBranch = SurfaceDataSource.Rows[0]["QUALIFIED_BRANCH"].ToString();
En_Mil_Sur.Weight = SurfaceDataSource.Rows[0]["WEIGHT"].ToString();
En_Mil_Sur.ProPlanId = proPlanId;
En_Mil_Sur.GxPlanNo = gxPlanNo;
int num = ServerHelper.SetData("com.steering.mes.zgmil.coup.SurfaceInspectionResult.Save_SurFace", new object[] { En_Mil_Sur }, this.ob);
if (num > 0)
{
MessageBox.Show("保存成功!");
milplan_ReFresh(str_Pro_NO, str_STOVE_NO);
}
}
///
/// 结炉操作
///
public void FeedSawResultNode()
{
UltraGridRow ugr_acr = this.ultraGrid_Plan.ActiveRow;//获取激活行
if (ugr_acr == null)
{
return;
}
string str_Pro_NO = ugr_acr.Cells["LOT_NO"].Value.ToString();//轧制批号
string str_STOVE_NO = ugr_acr.Cells["JUDGE_STOVE_NO"].Value.ToString();//炉号
string resultNo = ugr_acr.Cells["ID"].Value.ToString();
string target = ugr_acr.Cells["TARGET"].Value.ToString();//去向
string orderPk = ugr_acr.Cells["ORD_LN_DLY_PK"].Value.ToString();
Core.StlMes.Client.ZGMil.Entity.NativeMethodNew NaMethod = new Core.StlMes.Client.ZGMil.Entity.NativeMethodNew(this.ob);
if (!NaMethod.isBegineNode(str_STOVE_NO, 11))
{
MessageBox.Show("炉号【" + str_STOVE_NO + "】未开始质检,不能结炉!!!");
return;
}
string IsStart = doQueryJugeNoStaus(resultNo, str_STOVE_NO, PlineCode);
if (IsStart == "1")
{
MessageBox.Show("质检已完成,不能进行结炉!");
return;
}
SurfaceSave();
DataTable ds = ServerHelper.GetData("com.steering.mes.zgmil.coup.SurfaceInspectionResult.getTestingResult", new object[] { str_Pro_NO, str_STOVE_NO, proPlanId, gxPlanNo }, ob);
DataTable dsurface = ServerHelper.GetData("com.steering.mes.zgmil.coup.SurfaceInspectionResult.getSurfaceResult", new object[] { str_Pro_NO, str_STOVE_NO, proPlanId, gxPlanNo }, ob);
DataTable dsMilPlan = ServerHelper.GetData("com.steering.mes.zgmil.coup.SurfaceInspectionResult.getMilPlan", new object[] { str_STOVE_NO, this.ultraGrid_Plan.ActiveRow.Cells["ID"].Value.ToString2(), proPlanId, gxPlanNo }, ob);
if (this.ultraGrid_Plan.ActiveRow.Cells["BACK_PLAN_FLAG"].Text.Trim().ToString2() == "9")
{
if (!dsurface.Rows[0]["SURFACENUM"].ToString().Equals(dsMilPlan.Rows[0]["BRANCH"].ToString()))
{
MessageUtil.ShowTips("表检实绩支数与返线计划支数不一致,不允许结炉!");
return;
}
}
else
{
if (ds.Rows.Count > 0)
{
if (ds.Rows[0]["NODE_FUR_FLAG"].ToString() == "0")
{
MessageUtil.ShowTips("探伤未结炉,质检不允许结炉!");
return;
}
if (!ds.Rows[0]["QUALIFIED_NUM"].ToString().Equals(dsurface.Rows[0]["SURFACENUM"].ToString()))
{
MessageUtil.ShowTips("探伤合格支数与表检支数不一致,不允许结炉!");
return;
}
}
else
{
MessageUtil.ShowTips("无探伤实绩,不允许结炉!");
return;
}
}
//if (!isStartSurface(str_Pro_NO, str_STOVE_NO))
//{
// MessageBox.Show("还没开始质检,不能结炉!");
// return;
//}
//else
//{
// }
//查询是否完成抽检 是否完成尺寸检验
//DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.SurfaceInspectionResult.GetQAResult", new object[] { actJudgeStoveNo, actResultNo }, this.ob);
DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.doQuerySize", new object[] { BaseMethod.getJudgeStoveNo(actJudgeStoveNo), proPlanId, gxPlanNo }, this.ob);
if (dt.Rows.Count > 0)
{
//string SizeCheck = dt.Rows[0]["SIZE_CHECK"].ToString();
////string DefectCheck = dt.Rows[0]["DEFECT_CHECK"].ToString();
//int OfflineNum = int.Parse(dt.Rows[0]["OFFLINE_QUANTITY"].ToString());
//if (SizeCheck == "0")
//{
// MessageBox.Show("未完成几何尺寸抽检,不能结炉。");
// return;
//}
////if (SizeCheck == "0")
////{
//// MessageBox.Show("未完成缺陷项抽检,不能结炉。");
//// return;
////}
////if (OfflineNum > 0)
////{
//// if (MessageUtil.ShowYesNoAndQuestion("炉号【" + str_STOVE_NO + "】存在【" + OfflineNum + "】支下线管,是否需要生成二次委托") == DialogResult.No)
//// {
//// return;
//// }
//// //生成二次委托
////}
}
else
{
MessageUtil.ShowTips("未完成尺寸抽检,不允许结炉!");
return;
}
if (MessageUtil.ShowYesNoAndQuestion("确认炉号【" + str_STOVE_NO + "】结炉?") == DialogResult.No)
{
return;
}
MilSurfaceResultEntity En_Mil_Sur = new MilSurfaceResultEntity();//质检实体
MilPlan milplanEntity = new MilPlan();
En_Mil_Sur.RollLotNo = str_Pro_NO;
En_Mil_Sur.HeatNo = str_STOVE_NO;
En_Mil_Sur.NodeFlag = "1";
En_Mil_Sur.ColUser = _UserName;
En_Mil_Sur.ColGroup = UserInfo.GetUserGroup();
En_Mil_Sur.ColShift = UserInfo.GetUserOrder();
En_Mil_Sur.QualifiedBranch = SurfaceDataSource.Rows[0]["QUALIFIED_BRANCH"].ToString();
En_Mil_Sur.ResultNo = resultNo;
En_Mil_Sur.UserId = _UserID;
En_Mil_Sur.ProPlanId = proPlanId;
En_Mil_Sur.GxPlanNo = gxPlanNo;
//En_Mil_Sur.Status = "96";//修改mil_plan的node_status
milplanEntity.JudgeStoveNo = str_STOVE_NO;
milplanEntity.LotNo = str_Pro_NO;
milplanEntity.NodeStatus = "96";
milplanEntity.ProPlanId = proPlanId;
milplanEntity.GxPlanNo = gxPlanNo;
milplanEntity.PlineCode = PlineCode;
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.steering.mes.zgmil.coup.FrmStraighteningResult";
ccp.MethodName = "updateMilSlab";
ccp.ServerParams = new object[] { str_STOVE_NO, "11", proPlanId, gxPlanNo };
ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
if (ccp.ReturnCode != -1)
{
if (ccp.ReturnInfo.Equals("修改成功!"))
{
//更新进程表,废品入库存
ccp.ServerName = "com.steering.mes.zgmil.coup.FrmStraighteningResult";
ccp.MethodName = "updateProcessL";
ccp.ServerParams = new object[] { str_STOVE_NO, "11", "11", proPlanId, gxPlanNo, lotNo, PlineCode };
ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
if (ccp.ReturnCode != -1)
{
if (ccp.ReturnInfo.Equals("修改成功!"))
{
//if(target.Equals("A"))
//{
// if (doQueryPk(orderPk))
// {
// }
//}
int num = ServerHelper.SetData("com.steering.mes.zgmil.coup.SurfaceInspectionResult.FeedSawResultNode", new object[] { milplanEntity, En_Mil_Sur }, this.ob);//参数96为计划表状态,参数1为结炉标识
if (num > 0)
{
MessageBox.Show("操作成功!");
try
{
Entity.NativeMethodNew en_NativeMethodNew = new Core.StlMes.Client.ZGMil.Entity.NativeMethodNew(this.ob);
en_NativeMethodNew.InsertSTAferDoubleClick(str_STOVE_NO, 9, "1", proPlanId, gxPlanNo);
}
catch (Exception)
{
}
AutoUpFile();
//清空实绩信息
//DataTable dt = new DataTable();
//utr_SURFACE_EditGrid(dt);
//刷新计划表
milplan_ReFresh("", "");
this.dataSet3.Clear();
}
}
else
{
MessageUtil.ShowTips(ccp.ReturnInfo);
}
}
else
{
MessageUtil.ShowTips(ccp.ReturnInfo);
}
}
}
}
///
/// 查询是否需双探
///
///
private bool doQueryPk(string orderPk)
{
DataTable ds = ServerHelper.GetData("com.steering.mes.zgmil.coup.SurfaceInspectionResult.doQueryProcessSeq", new object[] { orderPk }, ob);
if (ds.Rows.Count > 0)
{
if (ds.Rows[0]["PROCESS_SEQ"].ToString().Equals("F"))
{
return true;
}
}
return false;
}
///
/// 查询结炉实绩
///
public void NodeQuery()
{
string Shift = UserInfo.GetUserOrder();
string Group = UserInfo.GetUserGroup();
string PliceCode = PlineCode;
string StartTime = DateTime.Now.ToString("yyyy-MM-dd");
string EndTime = DateTime.Now.AddDays(1).ToString("yyyy-MM-dd");
string Date = StartTime;
StartTime = StartTime + " 00:00:00";
EndTime = EndTime + " 00:00:00";
DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.SurfaceInspectionResult.SurfaceResult_query", new object[] { PliceCode, Shift, Group, StartTime, EndTime }, this.ob);
NodeResultQuery.FrmNodeResultQuery frm = new NodeResultQuery.FrmNodeResultQuery(dt, 8, Date, Shift, Group, this.ob);
frm.ShowDialog();
}
///
/// 上料表行激活事件AfterRowActivate
///
///
///
private void ultraGrid_Plan_AfterRowActivate(object sender, EventArgs e)
{
bl_Upddefect_chk = false;
bl_Upddefect_UpDown = false;
UltraGridRow ugr_acr = this.ultraGrid_Plan.ActiveRow;//获取激活行
MilPlan en_MPlan = new MilPlan();
string str_Pro_NO = ugr_acr.Cells["LOT_NO"].Value.ToString();//轧制批号
string str_STOVE_NO = ugr_acr.Cells["JUDGE_STOVE_NO"].Value.ToString();//炉号
proPlanId = ugr_acr.Cells["PRO_PLAN_ID"].Value.ToString();
gxPlanNo = ugr_acr.Cells["GX_PLAN_NO"].Value.ToString();
lotNo = ugr_acr.Cells["LOT_NO"].Value.ToString();
string ResultNo = ugr_acr.Cells["ID"].Value.ToString();
actJudgeStoveNo = str_STOVE_NO;
actResultNo = ResultNo;
_LotNo = str_Pro_NO;
en_MPlan.LotNo = str_Pro_NO;
en_MPlan.JudgeStoveNo = str_STOVE_NO;
en_MPlan.ProPlanId = proPlanId;
en_MPlan.GxPlanNo = gxPlanNo;
DataTable dt_RF = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getSingleMainPlanForHeatNo", new object[] { en_MPlan }, this.ob);
if (dt_RF.Rows.Count > 0)
{
GridEdit(dt_RF); //轧制计划信息-1
}
DataTable dt_RCard = new DataTable();
NativeMethodNew na = new NativeMethodNew(this.ob);
string plinCode = na.GetPCode(this.UserInfo.GetDepartment());
if (plinCode.Equals("C009") || plinCode.Equals("C008") || plinCode.Equals("C017") || plinCode.Equals("C072"))
{
if (this.ultraGrid_Plan.ActiveRow.Cells["BACK_PLAN_FLAG"].Text.Trim().ToString2() == "9")
{
dt_RCard = ServerHelper.GetData("com.steering.mes.zgmil.coup.SurfaceInspectionResult.doQueryRollCard", new object[] { str_STOVE_NO, proPlanId, gxPlanNo }, this.ob);
}
else if (this.ultraGrid_Plan.ActiveRow.Cells["BACK_PLAN_FLAG"].Text.Trim().ToString2() == "8" || this.ultraGrid_Plan.ActiveRow.Cells["BACK_PLAN_FLAG"].Text.Trim().ToString2() == "7")
{
dt_RCard = ServerHelper.GetData("com.steering.mes.zgmil.coup.SurfaceInspectionResult.doQueryRollCardTest", new object[] { str_STOVE_NO, proPlanId, gxPlanNo }, this.ob);
}
else
{
dt_RCard = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getRollingCard1", new object[] { str_STOVE_NO, proPlanId, gxPlanNo }, this.ob);
}
}
else if (plinCode.Equals("C010"))
{
if (this.ultraGrid_Plan.ActiveRow.Cells["BACK_PLAN_FLAG"].Text.Trim().ToString2() == "9")
{
dt_RCard = ServerHelper.GetData("com.steering.mes.zgmil.coup.SurfaceInspectionResult.doQueryRollCard", new object[] { str_STOVE_NO, proPlanId, gxPlanNo }, ob);
}
else if (this.ultraGrid_Plan.ActiveRow.Cells["BACK_PLAN_FLAG"].Text.Trim().ToString2() == "8" || this.ultraGrid_Plan.ActiveRow.Cells["BACK_PLAN_FLAG"].Text.Trim().ToString2() == "7")
{
dt_RCard = ServerHelper.GetData("com.steering.mes.zgmil.coup.SurfaceInspectionResult.getRollCard168Test", new object[] { str_STOVE_NO, proPlanId, gxPlanNo }, this.ob);
}
else
{
dt_RCard = ServerHelper.GetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.getRollCard168", new object[] { str_STOVE_NO, proPlanId, gxPlanNo }, this.ob);
}
}
else
{
if (this.ultraGrid_Plan.ActiveRow.Cells["BACK_PLAN_FLAG"].Text.Trim().ToString2() == "9")
{
dt_RCard = ServerHelper.GetData("com.steering.mes.zgmil.coup.SurfaceInspectionResult.doQueryRollCard", new object[] { str_STOVE_NO, proPlanId, gxPlanNo }, ob);
}
else if (this.ultraGrid_Plan.ActiveRow.Cells["BACK_PLAN_FLAG"].Text.Trim().ToString2() == "8" || this.ultraGrid_Plan.ActiveRow.Cells["BACK_PLAN_FLAG"].Text.Trim().ToString2() == "7")
{
dt_RCard = ServerHelper.GetData("com.steering.mes.zgmil.coup.SurfaceInspectionResult.getRollingCardTest", new object[] { str_STOVE_NO, proPlanId, gxPlanNo }, this.ob);
}
else
{
dt_RCard = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getRollingCard", new object[] { str_STOVE_NO, proPlanId, gxPlanNo }, this.ob);
}
}
//if (dt_RCard.Rows.Count > 0)
RollingCardEditGrid(dt_RCard);//流通卡信息-2
MilSurfaceResultEntity En_Mil_Sur = new MilSurfaceResultEntity();
En_Mil_Sur.RollLotNo = str_Pro_NO;
En_Mil_Sur.HeatNo = str_STOVE_NO;
//string str = JSONFormat.Format(En_Mil_Sur);//实体类转换为JSON格式
DataTable dt = new DataTable();
dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.SurfaceInspectionResult.GetQAResult", new object[] { str_STOVE_NO, ResultNo, proPlanId, gxPlanNo }, this.ob);
//if (dt.Rows.Count < 1)
//{
// if (this.ultraGrid_Plan.ActiveRow.Cells["BACK_PLAN_FLAG"].Value.ToString2() == "9")
// {
// dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.SurfaceInspectionResult.getMilPlan", new object[] { str_STOVE_NO, ResultNo }, this.ob);
// }
//}
utr_SURFACE_EditGrid(dt);//人工质检实绩信息显示-3
//if (dt.Rows.Count > 0)
//{
// if (!string.IsNullOrEmpty(dt.Rows[0]["QA_TYPE"].ToString()))
// {
// Qa_Flag = int.Parse(dt.Rows[0]["QA_TYPE"].ToString());
// }
//}
//get_Chk_Active(str_STOVE_NO);//获取上料表中选中的抽检项
dtMatSeq_3.Clear();
dtDefectS.Clear();
if (isStartSurface(ResultNo, str_STOVE_NO))
{
GetFeedRack();//查询上料管号队列
getDefectData();
//SimpleQuery();//性能批显示
//ShowMatTabPage();//管号队列Tab显示
}
//绑定缺陷项到下拉列表
//dt_Defect.Rows.Clear();
//getdtDefectComb();
//getdtCombGenerel();
}
///
/// 管号队列Tab显示
///
public void ShowMatTabPage()
{
switch (Qa_Flag)
{
//未开始抽检 显示一检管号队列TAB2 TAB2更名管号队列
case 0:
ultraTabControl2.Tabs[0].Visible = true;
// ultraTabControl2.Tabs[0].Text = "管号队列";
ultraTabControl2.Tabs[1].Visible = false;
//ultraTabControl3.Tabs[0].Visible = true;
//ultraTabControl3.Tabs[1].Visible = false;
break;
//一检完成 显示一检管号队列TAB2 TAB2更名管号队列
case 1:
ultraTabControl2.Tabs[0].Visible = true;
// ultraTabControl2.Tabs[0].Text = "管号队列";
ultraTabControl2.Tabs[1].Visible = false;
//ultraTabControl3.Tabs[0].Visible = true;
//ultraTabControl3.Tabs[1].Visible = false;
break;
//二检完成 显示终检管号队列TAB1 一检管号队列TAB2 TAB2更名一检管号队列
case 2:
ultraTabControl2.Tabs[0].Visible = true;
ultraTabControl2.Tabs[1].Text = "一检管号队列";
ultraTabControl2.Tabs[1].Visible = true;
//ultraTabControl3.Tabs[0].Visible = false;
//ultraTabControl3.Tabs[1].Visible = true;
break;
}
}
///
/// 双击组件开始质检操作
///
///
///
//private void ultraGrid_Plan_DoubleClickRow(object sender, DoubleClickRowEventArgs e)
private void DoStart()
{
if (ultraGrid_Plan.Rows.Count > 0)
{
// IsStart();
UltraGridRow ugr_acr = this.ultraGrid_Plan.ActiveRow;//获取激活行
string str_Pro_NO = ugr_acr.Cells["LOT_NO"].Value.ToString();//轧制批号
string str_STOVE_NO = ugr_acr.Cells["JUDGE_STOVE_NO"].Value.ToString();//炉号
string ResultNo = ugr_acr.Cells["ID"].Value.ToString();//炉号
proPlanId = ugr_acr.Cells["PRO_PLAN_ID"].Value.ToString();
gxPlanNo = ugr_acr.Cells["GX_PLAN_NO"].Value.ToString();
string staus = doQueryJugeNoStaus(ResultNo, str_STOVE_NO,PlineCode);
if (isStartSurface(ResultNo, str_STOVE_NO))
{
MessageBox.Show("炉号【" + str_STOVE_NO + "】已经开始质检");
return;
}
//增加人工质检信息
MilSurfaceResultEntity En_Mil_Sur = new MilSurfaceResultEntity();
En_Mil_Sur.RollLotNo = str_Pro_NO;
En_Mil_Sur.ResultNo = ResultNo;
En_Mil_Sur.HeatNo = str_STOVE_NO;
En_Mil_Sur.PlineCode = ugr_acr.Cells["PLINE_CODE"].Value.ToString();//获取产线代码
En_Mil_Sur.ProPlanId = proPlanId;
En_Mil_Sur.GxPlanNo = gxPlanNo;
//更新上料表Mil_Plan状态
MilPlan QueryMainPlan = new MilPlan();//上料表实体
QueryMainPlan.JudgeStoveNo = str_STOVE_NO;
QueryMainPlan.LotNo = str_Pro_NO;
QueryMainPlan.Status = "95";
QueryMainPlan.ProPlanId = proPlanId;
QueryMainPlan.GxPlanNo = gxPlanNo;
string sizeFlag = "";
DataTable ds = ServerHelper.GetData("com.steering.mes.zgmil.coup.SurfaceInspectionResult.doQueryChcekSize", new object[] { BaseMethod.getJudgeStoveNo(str_STOVE_NO), proPlanId, gxPlanNo }, ob);
if (ds.Rows.Count > 0)
{
sizeFlag = "1";
}
else
{
sizeFlag = "0";
}
int num = ServerHelper.SetData("com.steering.mes.zgmil.coup.SurfaceInspectionResult.startInSurFace", new object[] { En_Mil_Sur, QueryMainPlan, sizeFlag }, this.ob);
if (num > 0)
{
try
{
//更新质检跟踪表时间
Entity.NativeMethodNew en_NativeMethodNew = new Core.StlMes.Client.ZGMil.Entity.NativeMethodNew(this.ob);
en_NativeMethodNew.InsertSTAferDoubleClick(str_STOVE_NO, 9, "0", proPlanId, gxPlanNo);
}
catch (Exception)
{
}
milplan_ReFresh(str_Pro_NO, str_STOVE_NO);
}
}
}
///
/// 开始回退
///
private void DoStartBack()
{
if (ultraGrid_Plan.Rows.Count > 0)
{
if (this.ultraGrid_Plan.ActiveRow == null)
{
MessageBox.Show("请选择需要回退的炉号!!!");
return;
}
UltraGridRow ugr = ultraGrid_Plan.ActiveRow;
string JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
string ResultNo = ugr.Cells["ID"].Value.ToString();
string StartStatus = doQueryJugeNoStaus(ResultNo, JudgeStoveNo,PlineCode);
//string StartStatus = ugr.Cells["IS_START"].Value.ToString();
if (StartStatus == "1")
{
MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】已结炉,不能开始回退!!!!");
return;
}
if (StartStatus == "3")
{
MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】未开始质检,不能开始回退!!!!");
return;
}
DataTable ds = ServerHelper.GetData("com.steering.mes.zgmil.coup.SurfaceInspectionResult.doQueryOffline", new object[] { JudgeStoveNo, proPlanId, gxPlanNo }, ob);
if (ds.Rows.Count > 0)
{
if (int.Parse(ds.Rows[0]["OFFLINE_NUM"].ToString()) > 0)
{
MessageUtil.ShowTips("此炉有下线支数,请先撤销下线支数的操作!");
return;
}
}
int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.SurfaceInspectionResult.startBack", new object[] { JudgeStoveNo, ResultNo, 9, PlineCode, proPlanId, gxPlanNo }, this.ob);
ChangeGridColor();
SurfaceQuery();
GetFeedRack();
}
}
///
/// 结炉回退
///
private void NodeBack()
{
if (this.ultraGrid_Plan.ActiveRow == null)
{
MessageBox.Show("请选择需要回退的炉号!!!");
return;
}
UltraGridRow ugr = ultraGrid_Plan.ActiveRow;
string JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
string ResultNo = ugr.Cells["ID"].Value.ToString();
string NodeFlag = doQueryJugeNoStaus(ResultNo, JudgeStoveNo,PlineCode);
//string NodeFlag = ugr.Cells["IS_START"].Value.ToString();
if (NodeFlag != "1")
{
MessageBox.Show("炉号【" + JudgeStoveNo + "】未结炉,不能结炉回退!!!!");
return;
}
DataTable dtMat = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmOffLine.doQueryMatScrap", new object[] { JudgeStoveNo, PlineCode, proPlanId, gxPlanNo }, this.ob);
if (dtMat.Rows.Count > 0)
{
if (int.Parse(dtMat.Rows[0][0].ToString()) > 0)
{
MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】的废品已发运,不能结炉回退!!!!");
return;
}
}
DataTable dW = ServerHelper.GetData("com.steering.mes.signature.FrmDownlineManage.doQueryEntust", new object[] { JudgeStoveNo, proPlanId, gxPlanNo }, ob);
if (dW.Rows.Count > 0)
{
MessageUtil.ShowTips("已进行外委加工,不允许结炉回退!");
return;
}
DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.doNodeBackCheck", new object[] { JudgeStoveNo, ResultNo, proPlanId, gxPlanNo }, this.ob);
if (dt.Rows.Count > 0)
{
string NodeStatus = dt.Rows[0][0].ToString();
if (int.Parse(NodeStatus) >= 99)
{
MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】后序工序已结炉,当前工序不能结炉回退");
return;
}
}
//查询结炉班次班组
DataTable dtNodeGroup = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.doNodeBackCheck", new object[] { JudgeStoveNo, ResultNo, 11, proPlanId, gxPlanNo }, this.ob);
if (dtNodeGroup.Rows.Count > 0)
{
string NodeShift = dtNodeGroup.Rows[0][0].ToString();
string NodeGroup = dtNodeGroup.Rows[0][1].ToString();
if (Shift == NodeShift && Group == NodeGroup)
{
}
else
{
switch (NodeShift)
{
case "0":
NodeShift = "白班";
break;
case "1":
NodeShift = "早班";
break;
case "2":
NodeShift = "中班";
break;
case "3":
NodeShift = "夜班";
break;
}
switch (NodeGroup)
{
case "1":
NodeGroup = "甲班";
break;
case "2":
NodeGroup = "乙班";
break;
case "3":
NodeGroup = "丙班";
break;
case "4":
NodeGroup = "丁班";
break;
}
switch (this.UserInfo.GetUserOrder())
{
case "0":
Shift = "白班";
break;
case "1":
Shift = "早班";
break;
case "2":
Shift = "中班";
break;
case "3":
Shift = "夜班";
break;
}
switch (this.UserInfo.GetUserGroup())
{
case "1":
Group = "甲班";
break;
case "2":
Group = "乙班";
break;
case "3":
Group = "丙班";
break;
case "4":
Group = "丁班";
break;
}
if (!NodeShift.Equals(Shift) || !NodeGroup.Equals(Group))
{
MessageBox.Show("炉号【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】已由" + NodeShift + "," + NodeGroup + "结炉,当班不能结炉回退");
return;
}
}
}
DataTable ds = ServerHelper.GetData("com.steering.mes.zgmil.coup.SurfaceInspectionResult.selectBackLineNum", new object[] { ResultNo, JudgeStoveNo, proPlanId, gxPlanNo }, ob);
if (ds.Rows.Count > 0)
{
MessageUtil.ShowTips("存在已返线的支数,不允许结炉回退!");
return;
}
//查询当前炉次是否有交班点
int Seq = 0;
DataTable dt1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.changeFlagQuery", new object[] { JudgeStoveNo, ResultNo, 9, proPlanId, gxPlanNo }, this.ob);
if (dt1.Rows.Count > 0)
{
Seq = int.Parse(dt1.Rows[0][0].ToString());
}
int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.nodeBack", new object[] { JudgeStoveNo, ResultNo, 9, PlineCode, Seq, 0, 11, proPlanId, gxPlanNo, lotNo }, this.ob);
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.steering.mes.zgmil.coup.FrmOffLine";
ccp.MethodName = "insertMatScrapBack";
ccp.ServerParams = new object[] { JudgeStoveNo, proPlanId, gxPlanNo, PlineCode, "11" };
ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
if (ccp.ReturnCode != -1)
{ MessageUtil.ShowTips(ccp.ReturnInfo); }
ChangeGridColor();
SurfaceQuery();
GetFeedRack();
}
///
/// 刷新计划表信息,如果参数为空字符串,选中行为控件默认的第一行
///
/// 轧制号
/// 炉号
public void milplan_ReFresh(string strPro_No, string strStove)
{
MilPlan milplanEntity = new MilPlan();
if (u_ChkEditor_ProNo.Checked == true)
{
if (this.u_TxtEditor_ProNo.Text == "")
{
MessageBox.Show("请输入要查询的扎批号", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
milplanEntity.LotNo = this.u_TxtEditor_ProNo.Text;//获取查询区生产批号
}
if (u_ChkEditor_StoveNo.Checked)
{
if (this.u_TxtEditor_StrvoNo.Text == "")
{
MessageBox.Show("请输入要查询的炉号", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
milplanEntity.JudgeStoveNo = this.u_TxtEditor_StrvoNo.Text;//获取查询区炉号
}
milplanEntity.Status = PlanStatusQuery;
milplanEntity.StartStatus = PlanStartStatusQuery;
milplanEntity.PlineCode = this.PlineCode;
milplanEntity.ProPlanId = proPlanId;
milplanEntity.GxPlanNo = gxPlanNo;
DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getSingleMainPlan", new object[] { milplanEntity, 10 }, this.ob);//
dtPlan.Clear();
GridHelper.CopyDataToDatatable(ref dt, ref dtPlan, true);//绑定计划表
foreach (UltraGridRow ugr in ultraGrid_Plan.Rows)
{
if (ugr.Cells["IS_START"].Value.ToString() == "1")
{
ugr.Appearance.BackColor = Color.YellowGreen;
}
}
if (ultraGrid_Plan.Rows.Count > 0)
{
foreach (UltraGridRow ugr in ultraGrid_Plan.Rows)
{
if (ugr.Cells["IS_START"].Value.ToString() != "未开始质检" && ugr.Cells["IS_START"].Value.ToString() != "已开始质检" && ugr.Cells["IS_START"].Value.ToString() != "已完成质检")
{
ugr.Cells["JUDGE_NO"].Value = BaseMethod.getJudgeStoveNo(ugr.Cells["JUDGE_STOVE_NO"].Value.ToString());
switch (Convert.ToInt32(ugr.Cells["IS_START"].Value))
{
case 3:
ugr.Cells["IS_START"].Value = "未开始质检";
break;
case 0:
ugr.Cells["IS_START"].Value = "已开始质检";
break;
case 1:
ugr.Cells["IS_START"].Value = "已完成质检";
break;
}
}
}
}
else
{
MessageBox.Show("没有查询到相关数据", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
//选中活动行
if (strPro_No == "" && strStove == "")//默认的第一行选中
{
return;
}
//for (int i = 0; i < dt.Rows.Count; i++)
//{
// if (ultraGrid_Plan.Rows[i].Cells["JUDGE_STOVE_NO"].Value.ToString() == strStove && ultraGrid_Plan.Rows[i].Cells["LOT_NO"].Value.ToString() == strPro_No)
// {
// this.ultraGrid_Plan.Rows[i].Activated = true;
// return;
// }
//}
foreach (UltraGridRow ugr in ultraGrid_Plan.Rows)
{
if (ugr.Cells["JUDGE_STOVE_NO"].Value.ToString() == strStove && ugr.Cells["LOT_NO"].Value.ToString() == strPro_No)
{
ugr.Activated = true;
return;
}
}
}
///
/// 是否开始质检
///
///
///
public bool isStartSurface(string ResultNo, string strStove)
{
MilSurfaceResultEntity enMilSurfaceResultEntity = new MilSurfaceResultEntity();
//enMilSurfaceResultEntity.RollLotNo = strPro_No; //获取查询区炉号
//enMilSurfaceResultEntity.HeatNo = strStove; //获取查询区生产批号
DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.SurfaceInspectionResult.GetQAResult", new object[] { strStove, ResultNo, proPlanId, gxPlanNo }, this.ob);//
if (dt.Rows.Count > 0)
{ return true; }
else
{
return false;
}
}
///
/// 离线缺陷登记
///
private void DoCheck()
{
int MatNum = 0; //探伤合格支数
double Diameter = 0; //外径
double Thickness = 0; //控制壁厚
double Length = 0; //长度
double ZLXS = 1.0; //重量系数
MilSurfaceResultEntity QaResultEntity = new MilSurfaceResultEntity();
if (ultraGrid_Plan.Rows.Count > 0)
{
UltraGridRow ugr = ultraGrid_Plan.ActiveRow;
string JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
string LotNo = ugr.Cells["LOT_NO"].Value.ToString();
string ResultNo = ugr.Cells["ID"].Value.ToString();
string IsStart = doQueryJugeNoStaus(ResultNo, JudgeStoveNo, PlineCode);
//string IsStart = ugr.Cells["IS_START"].Value.ToString();
int OffLineFlag = int.Parse(JudgeStoveNo.Substring(JudgeStoveNo.Length - 2, 2).ToString());
if (OffLineFlag > 1)
{
OffLineFlag = 2;
}
if (IsStart == "3")
{
MessageBox.Show("炉号【" + JudgeStoveNo + "】未开始质检,不能抽检!");
return;
}
if (IsStart == "1")
{
MessageBox.Show("炉号【" + JudgeStoveNo + "】已完成质检,不能抽检!");
return;
}
string Varieties = this.rollingInfomation1.UltraGrid4.Rows[0].Cells["Varieties"].Value.ToString();
if (Varieties == "")
{
MessageUtil.ShowTips("无轧制信息,请联系系统管理员!");
return;
}
string[] temp = Varieties.Split(',');
string[] WJBH = temp[2].Split('*');
if (!string.IsNullOrEmpty(WJBH[0]))
{
Diameter = double.Parse(WJBH[0]);
}
//if (!string.IsNullOrEmpty(WJBH[1]))
//{
// Thickness = double.Parse(WJBH[1]);
//}
if (!string.IsNullOrEmpty(this.rollingInfomation1.UltraGrid4.Rows[0].Cells["ContractLength"].Value.ToString()))
{
Length = double.Parse(this.rollingInfomation1.UltraGrid4.Rows[0].Cells["ContractLength"].Value.ToString());
}
//查询控制壁厚
DataTable dtColThick = ServerHelper.GetData("com.steering.mes.zgmil.coup.PipeSawResult.GetSawResult", new object[] { JudgeStoveNo, proPlanId, gxPlanNo }, this.ob);
if (dtColThick.Rows.Count > 0)
{
if (!string.IsNullOrEmpty(dtColThick.Rows[0]["COL_THICK"].ToString()))
{
Thickness = double.Parse(dtColThick.Rows[0]["COL_THICK"].ToString());
}
}
////一次抽检
//if (QaFlag == 1)
//{
//探伤结炉后才能开始抽检 查询探伤结炉标识 探伤合格支数
if (PlineCode == "C010" || PlineCode == "C012") //涡流探伤
{
if (this.ultraGrid_Plan.ActiveRow.Cells["BACK_PLAN_FLAG"].Text.Trim().ToString2() != "9")
{
DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.GetETResult", new object[] { JudgeStoveNo, proPlanId, gxPlanNo }, this.ob);
if (dt.Rows.Count > 0)
{
if (dt.Rows[0]["NODE_FUR_FLAG"].ToString() == "1")
{
MatNum = int.Parse(dt.Rows[0]["QUALIFIED_NUM"].ToString()); //涡流探伤合格支数
}
//else
//{
// MessageUtil.ShowWarning("炉号【" + JudgeStoveNo + "】探伤未完成, 不能开始抽检!!!");
// return;
//}
}
//else
//{
// MessageUtil.ShowWarning("炉号【" + JudgeStoveNo + "】探伤未完成, 不能开始抽检!!!");
// return;
//}
}
}
else
{
if (this.ultraGrid_Plan.ActiveRow.Cells["BACK_PLAN_FLAG"].Text.Trim().ToString2() != "9")
{
DataTable ds = ServerHelper.GetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.GetMTResult", new object[] { JudgeStoveNo, proPlanId, gxPlanNo }, this.ob);
if (ds.Rows.Count > 0)
{
if (ds.Rows[0]["NODE_FUR_FLAG"].ToString() == "1")
{
MatNum = int.Parse(ds.Rows[0]["QUALIFIED_NUM"].ToString()); //漏磁探伤合格支数
}
//else
//{
// MessageUtil.ShowWarning("炉号【" + JudgeStoveNo + "】探伤未完成, 不能开始抽检!!!");
// return;
//}
}
//else
//{
// MessageUtil.ShowWarning("炉号【" + JudgeStoveNo + "】探伤未完成, 不能开始抽检!!!");
// return;
//}
}
}
//查询是否进行分批
DataTable dt1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.SurfaceInspectionResult.GetIsSimple", new object[] { JudgeStoveNo, ResultNo, proPlanId, gxPlanNo }, this.ob);
int Flag = int.Parse(dt1.Rows[0]["IS_BATCH"].ToString());
DataTable dd = ServerHelper.GetData("com.steering.mes.zgmil.coup.SurfaceInspectionResult.doQueryBackFlag", new object[] { ResultNo, JudgeStoveNo, proPlanId, gxPlanNo }, ob);
FrmQADefect QADefect = new FrmQADefect(JudgeStoveNo, ResultNo, proPlanId, gxPlanNo, LotNo, MatNum, Diameter, Thickness, Length, 1, OffLineFlag,PlineCode,dd.Rows[0][0].ToString(), this.ob);
QADefect.ShowDialog();
if (QADefect.DialogResult == DialogResult.OK)
{
ZLXS = double.Parse(QADefect._ZLXS); //重量系数
_ScrapNum = QADefect._ScrapNum; //废品量
_OffLineNum = QADefect._OffLineNumF; //下线量
//_MatHeight = QADefect._MatHeight; //单支重
double QAHeight = double.Parse((MatNum - int.Parse(_ScrapNum) - int.Parse(_OffLineNum)).ToString()) * _MatHeight; //合格吨 = (总检量-废品支-下线支) * 单支重
int QANum = MatNum - int.Parse(_ScrapNum) - int.Parse(_OffLineNum); //合格支
QaResultEntity.HeatNo = JudgeStoveNo;
QaResultEntity.ResultNo = ResultNo;
QaResultEntity.DirectorQuantity = MatNum.ToString();
QaResultEntity.OfflineQuantity = _OffLineNum;
QaResultEntity.WasteQuantity = _ScrapNum;
QaResultEntity.QualifiedTons = QAHeight.ToString();
QaResultEntity.QualifiedBranch = QANum.ToString();
QaResultEntity.HeightRate = ZLXS.ToString();
QaResultEntity.DirectorQuantityF = MatNum.ToString();
QaResultEntity.OfflineQuantityF = _OffLineNum;
QaResultEntity.WasteQuantityF = _ScrapNum;
QaResultEntity.QualifiedTonsF = QAHeight.ToString();
QaResultEntity.QualifiedBranchF = QANum.ToString();
QaResultEntity.ProPlanId = proPlanId;
QaResultEntity.GxPlanNo = gxPlanNo;
//更新质检实绩信息
int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.SurfaceInspectionResult.updateSurfaceResultNumF", new object[] { QaResultEntity, 1 }, this.ob);
DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.SurfaceInspectionResult.doQueryPortWgt", new object[] { this.ultraGrid_Plan.ActiveRow.Cells["ID"].Value.ToString(), (int.Parse(SurfaceDataSource.Rows[0]["QUALIFIED_BRANCH"].ToString()) - int.Parse(_ScrapNum) - int.Parse(_OffLineNum)).ToString(), proPlanId, gxPlanNo }, ob);
//抽检后质检主信息界面显示支数信息
//SurfaceDataSource.Rows[0]["DIRECTOR_QUANTITY"] = MatNum;
//SurfaceDataSource.Rows[0]["QUALIFIED_BRANCH"] = QANum;
SurfaceDataSource.Rows[0]["QUALIFIED_BRANCH"] = (int.Parse(SurfaceDataSource.Rows[0]["QUALIFIED_BRANCH"].ToString()) - int.Parse(_ScrapNum) - int.Parse(_OffLineNum)).ToString();
//SurfaceDataSource.Rows[0]["QUALIFIED_TONS"] = QAHeight;
SurfaceDataSource.Rows[0]["QUALIFIED_TONS"] = dt.Rows[0][0].ToString();
SurfaceDataSource.Rows[0]["WASTE_QUANTITY"] = _ScrapNum;
SurfaceDataSource.Rows[0]["OFFLINE_QUANTITY"] = _OffLineNum;
uDSFirstQa.Rows.Add();
//抽检后质检详细信息界面显示一次抽检支数信息
//uDSFirstQa.Rows[0]["DIRECTOR_QUANTITY_F"] = MatNum;
//uDSFirstQa.Rows[0]["QUALIFIED_BRANCH_F"] = QANum;
//uDSFirstQa.Rows[0]["QUALIFIED_TONS_F"] = QAHeight;
//uDSFirstQa.Rows[0]["WASTE_QUANTITY_F"] = _ScrapNum;
//uDSFirstQa.Rows[0]["OFFLINE_QUANTITY_F"] = _OffLineNum;
QADefect.Close();
GetFeedRack();
getDefectData();
SurfaceQuery();
}
//SurfaceQuery();
}
}
///
/// 作废二次抽检
///
private void DoCheckSCancel()
{
if (Qa_Flag != 2)
{
MessageBox.Show("炉号【" + actJudgeStoveNo + "】未开始二次抽检,不能作为二次抽检");
return;
}
int dt = ServerHelper.SetData("com.steering.mes.zgmil.coup.SurfaceInspectionResult.CheckSCancel", new object[] { actJudgeStoveNo, actResultNo }, this.ob);
MessageBox.Show("炉号【" + actJudgeStoveNo + "】二次抽检已作废。");
}
///
/// 几何尺寸抽检
///
private void DoSizeCheck()
{
if (ultraGrid_Plan.Rows.Count > 0)
{
UltraGridRow ugr = ultraGrid_Plan.ActiveRow;
string JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
string LotNo = ugr.Cells["LOT_NO"].Value.ToString();
string ResultNo = ugr.Cells["ID"].Value.ToString();
string staus = doQueryJugeNoStaus(ResultNo, JudgeStoveNo,PlineCode);
if (staus == "3")
{
MessageUtil.ShowTips("炉号【" + JudgeStoveNo + "】未开始质检,不能进行几何尺寸抽检!");
return;
}
//if (staus == "1")
//{
// MessageUtil.ShowTips("炉号【" + JudgeStoveNo + "】已完成质检,不能进行几何尺寸抽检!");
// return;
//}
FrmQASizeDetail frmQaSize = new FrmQASizeDetail(JudgeStoveNo, LotNo, ResultNo, proPlanId, gxPlanNo, PlineCode, this.ob);
if (frmQaSize.ShowDialog() == DialogResult.OK)
{
SurfaceQuery();
}
}
}
///
/// 管号队列激活事件
///
///
///
private void ultraGridMatSeq_AfterRowActivate(object sender, EventArgs e)
{
if (Qa_Flag == 0)
{
return;
}
UltraGridRow ugr = ultraGridMatSeq.ActiveRow;
string JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
string Seq = ugr.Cells["SEQ"].Value.ToString();
//string ResultNo = ugr.Cells["RESULT_NO"].Value.ToString();
string Status = ugr.Cells["STATUS"].Value.ToString();
dtDefect.Clear();
if (Status == "一检剔除")
{
DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.SurfaceInspectionResult.pipeDefectQuery", new object[] { JudgeStoveNo, actResultNo, Seq, "1" }, this.ob);
GridHelper.CopyDataToDatatable(ref dt, ref dtDefect, true);
}
else if (Status == "二检剔除")
{
DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.SurfaceInspectionResult.pipeDefectQuery", new object[] { JudgeStoveNo, actResultNo, Seq, "2" }, this.ob);
GridHelper.CopyDataToDatatable(ref dt, ref dtDefect, true);
}
else
{
//查询成品管缺陷项并显示在缺陷列表中
DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.SurfaceInspectionResult.pipeDefectQuery", new object[] { JudgeStoveNo, actResultNo, Seq, Qa_Flag.ToString() }, this.ob);
GridHelper.CopyDataToDatatable(ref dt, ref dtDefect, true);
}
}
///
/// 性能批激活事件
///
///
///
private void ultraGrid2_AfterRowActivate(object sender, EventArgs e)
{
if (Qa_Flag == 0)
{
return;
}
//UltraGridRow ugr = ultraGrid2.ActiveRow;
//string SimpleLotNo = ugr.Cells["SIMPLE_LOT_NO"].Value.ToString();
dtDefectS.Clear();
//查询性能批缺陷项并显示在缺陷列表中
//DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.SurfaceInspectionResult.GetSimpleCheckInfo", new object[] { actJudgeStoveNo, actResultNo, SimpleLotNo }, this.ob);
//GridHelper.CopyDataToDatatable(ref dt, ref dtDefectS, true);
}
///
/// 更改上料管队列girdRow颜色
///
public void ChangeGridColor()
{
foreach (UltraGridRow ugr in ultraGridMatSeq.Rows)
{
if (ugr.Cells["STATUS"].Value.ToString() == "剔除")
{
ugr.Appearance.BackColor = Color.Yellow;
}
if (ugr.Cells["STATUS"].Value.ToString() == "二检剔除")
{
ugr.Appearance.BackColor = Color.Yellow;
}
if (ugr.Cells["STATUS"].Value.ToString() == "最终下线")
{
ugr.Appearance.BackColor = Color.YellowGreen;
}
if (ugr.Cells["STATUS"].Value.ToString() == "下线")
{
ugr.Appearance.BackColor = Color.YellowGreen;
}
if (ugr.Cells["CHANGE_FLAG"].Value.ToString() == "待接班确认")
{
ugr.Appearance.BackColor = Color.LightGreen;
}
}
}
//性能批查询
public void SimpleQuery()
{
//查询是否进行分批
DataTable dt1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.SurfaceInspectionResult.GetIsSimple", new object[] { actJudgeStoveNo, actResultNo, proPlanId, gxPlanNo }, this.ob);
int Flag = int.Parse(dt1.Rows[0]["IS_BATCH"].ToString());
if (Flag == 0) //未分批
{
return;
}
DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.SurfaceInspectionResult.GetSimpleInfo", new object[] { actJudgeStoveNo, actResultNo }, this.ob);
GridHelper.CopyDataToDatatable(ref dt, ref dtSimple, true);
}
#region 卡片赋值: 轧制信息Grid赋值,流通卡赋值
///
/// 轧制信息Grid赋值
///
/// 轧制计划信息datatable
public void GridEdit(DataTable dt)
{
DataRow row1 = dt.Rows[0];
//熔炼炉号
this.rollingInfomation1.Value.StoveNo = row1["stove_no"].ToString();
//炉号
this.rollingInfomation1.Value.JudgeStoveNo = BaseMethod.getJudgeStoveNo(row1["judge_stove_no"].ToString());
//生产批号
this.rollingInfomation1.Value.LotNo = row1["lot_no"].ToString();
//工序合同号
this.rollingInfomation1.Value.ContractNo = row1["contract_no"].ToString();
//执行工艺号
this.rollingInfomation1.Value.ImpProcess = row1["imp_process"].ToString();
//执行工艺号路径
this.rollingInfomation1.Value.ImpProcessPath = row1["imp_process_path"].ToString();
//产线代码
this.rollingInfomation1.Value.PlineCode = row1["pline_code"].ToString();
//状态
this.rollingInfomation1.Value.Status = row1["STATUS"].ToString();
//监制
this.rollingInfomation1.Value.Producer = row1["producer"].ToString();
//工艺状态
this.rollingInfomation1.Value.ProcessStatus = row1["process_status"].ToString();
//单倍长
this.rollingInfomation1.Value.DbLength = row1["db_length"].ToString();
//单倍重
this.rollingInfomation1.Value.DbHeight = row1["db_height"].ToString();
//轧制长度
this.rollingInfomation1.Value.RollLength = row1["roll_length"].ToString();
//分切数
this.rollingInfomation1.Value.SawNum = row1["saw_num"].ToString();
//目标长度
this.rollingInfomation1.Value.TargetLength = row1["target_length"].ToString();
//最终用户
this.rollingInfomation1.Value.FinishUser = row1["finish_user"].ToString();
//目标库
this.rollingInfomation1.Value.TargetLiabrary = row1["target_liabrary"].ToString();
//品种
this.rollingInfomation1.Value.Varieties = row1["varieties"].ToString();
//成品规格
this.rollingInfomation1.Value.PipeSize = row1["pipe_size"].ToString();
//扣型
this.rollingInfomation1.Value.BuckleType = row1["buckle_type"].ToString();
//长度范围
this.rollingInfomation1.Value.LengthRange = row1["length_range"].ToString();
//轧管判定标准
this.rollingInfomation1.Value.RollStandrad = row1["roll_standrad"].ToString();
//断面
this.rollingInfomation1.Value.PipeSection = row1["pipe_section"].ToString();
//钢种代码
this.rollingInfomation1.Value.SteelCode = row1["steelcode"].ToString();
//钢种名称
this.rollingInfomation1.Value.SteelName = row1["steelname"].ToString();
//钢级代码
this.rollingInfomation1.Value.GradeCode = row1["gradecode"].ToString();
//钢级名称
this.rollingInfomation1.Value.GradeName = row1["gradename"].ToString();
//炼钢判定标准
this.rollingInfomation1.Value.SteelStandrad = row1["steel_standrad"].ToString();
//去向
this.rollingInfomation1.Value.Target = row1["target"].ToString();
//支
this.rollingInfomation1.Value.PlanNum = row1["BRANCH"].ToString();
//吨
this.rollingInfomation1.Value.PlanTon = row1["TON"].ToString();
//切损去向
this.rollingInfomation1.Value.CutTarget = row1["cut_target"].ToString();
//切损长度
this.rollingInfomation1.Value.CutLength = row1["cut_length"].ToString();
//切损重量
this.rollingInfomation1.Value.CutHeight = row1["CUT_WEIGHT"].ToString();
//倍尺数
this.rollingInfomation1.Value.DbNum = row1["DB_NUM"].ToString();
//标准类别代码
this.rollingInfomation1.Value.StdStyle = row1["STD_STYLE"].ToString();
//标准类别描述
this.rollingInfomation1.Value.StdStyleDesc = row1["STD_STYLE_DESC"].ToString();
//成品备注
this.rollingInfomation1.Value.ReMark = row1["ReMark"].ToString();
this.rollingInfomation1.UpdateData();
}
///
/// 流通卡赋值
///
///
public void RollingCardEditGrid(DataTable dt)
{
clearRollCard();
if (dt.Rows.Count > 0)
{
if (this.ultraGrid_Plan.ActiveRow.Cells["BACK_PLAN_FLAG"].Text.Trim().ToString2() == "9")
{
//上料切前剔除支数
this.rollingCard1.Value.FeedScrapNum = "0";
//上料切前合格支数
this.rollingCard1.Value.FeedQualifiedNum = "0";
//据切剔除支数
this.rollingCard1.Value.FeedScrapDBNum = "0";
//锯切合格支数
this.rollingCard1.Value.FeedQualifiedDBNum = "0";
//加热炉剔除支数
this.rollingCard1.Value.FurScrapNum = "0";
//加热炉合格支数
this.rollingCard1.Value.FurQualifiedNum = "0";
//穿孔剔除支数
this.rollingCard1.Value.PerScrapNum = "0";
//穿孔合格支数
this.rollingCard1.Value.PerQualifiedNum = "0";
//连轧剔除支数
this.rollingCard1.Value.RollingScrapNum = "0";
//连轧合格支数
this.rollingCard1.Value.RollingQualifiedNum = "0";
//再加热炉剔除支数
this.rollingCard1.Value.RefurScrapNum = "0";
//再加热炉合格支数
this.rollingCard1.Value.RefurQualifiedNum = "0";
//定径剔除支数
this.rollingCard1.Value.SizingScrapNum = "0";
//定径合格支数
this.rollingCard1.Value.SizingQualifiedNum = "0";
//分切前剔除支数
this.rollingCard1.Value.SawScrapNumBE = "0";
//分切前合格支数
this.rollingCard1.Value.SawQualifiedNumBE = "0";
//分切剔除支数
this.rollingCard1.Value.SawScrapNum = "0";
//分切合格支数
this.rollingCard1.Value.SawQualifiedNum = "0";
//矫直剔除支数
this.rollingCard1.Value.StraightScrapNum = "0";
//矫直合格支数
this.rollingCard1.Value.StraightQualifiedNum = "0";
//探伤剔除支数
this.rollingCard1.Value.TestingScrapNum = "0";
//探伤合格支数
this.rollingCard1.Value.TestingQualifiedNum = "0";
//探伤下线支数
this.rollingCard1.Value.OfflineTesting = "0";
//表检剔除支数
this.rollingCard1.Value.SurfaceScrapNum = dt.Rows[0]["WASTE_QUANTITY"].ToString();
//表检合格支数
this.rollingCard1.Value.SurfaceQualifiedNum = dt.Rows[0]["QUALIFIED_BRANCH"].ToString();
//表检下线支数
this.rollingCard1.Value.OfflineSurface = dt.Rows[0]["OFFLINE_QUANTITY"].ToString();
}
else if (this.ultraGrid_Plan.ActiveRow.Cells["BACK_PLAN_FLAG"].Text.Trim().ToString2() == "8" || this.ultraGrid_Plan.ActiveRow.Cells["BACK_PLAN_FLAG"].Text.Trim().ToString2() == "7")
{
//上料切前剔除支数
this.rollingCard1.Value.FeedScrapNum = "0";
//上料切前合格支数
this.rollingCard1.Value.FeedQualifiedNum = "0";
//据切剔除支数
this.rollingCard1.Value.FeedScrapDBNum = "0";
//锯切合格支数
this.rollingCard1.Value.FeedQualifiedDBNum = "0";
//加热炉剔除支数
this.rollingCard1.Value.FurScrapNum = "0";
//加热炉合格支数
this.rollingCard1.Value.FurQualifiedNum = "0";
//穿孔剔除支数
this.rollingCard1.Value.PerScrapNum = "0";
//穿孔合格支数
this.rollingCard1.Value.PerQualifiedNum = "0";
//连轧剔除支数
this.rollingCard1.Value.RollingScrapNum = "0";
//连轧合格支数
this.rollingCard1.Value.RollingQualifiedNum = "0";
//再加热炉剔除支数
this.rollingCard1.Value.RefurScrapNum = "0";
//再加热炉合格支数
this.rollingCard1.Value.RefurQualifiedNum = "0";
//定径剔除支数
this.rollingCard1.Value.SizingScrapNum = "0";
//定径合格支数
this.rollingCard1.Value.SizingQualifiedNum = "0";
//分切前剔除支数
this.rollingCard1.Value.SawScrapNumBE = "0";
//分切前合格支数
this.rollingCard1.Value.SawQualifiedNumBE = "0";
//分切剔除支数
this.rollingCard1.Value.SawScrapNum = "0";
//分切合格支数
this.rollingCard1.Value.SawQualifiedNum = "0";
//矫直剔除支数
this.rollingCard1.Value.StraightScrapNum = dt.Rows[0]["SCRAP_STRAIGHT"].ToString();
//矫直合格支数
this.rollingCard1.Value.StraightQualifiedNum = dt.Rows[0]["QUALIFIED_STRAIGHT"].ToString();
//探伤剔除支数
this.rollingCard1.Value.TestingScrapNum = dt.Rows[0]["SCRAP_TESTING"].ToString();
//探伤合格支数
this.rollingCard1.Value.TestingQualifiedNum = dt.Rows[0]["QUALIFIED_TESTING"].ToString();
//探伤下线支数
this.rollingCard1.Value.OfflineTesting = dt.Rows[0]["OFFLINE_TESTING"].ToString();
//表检剔除支数
this.rollingCard1.Value.SurfaceScrapNum = dt.Rows[0]["WASTE_QUANTITY"].ToString();
//表检合格支数
this.rollingCard1.Value.SurfaceQualifiedNum = dt.Rows[0]["QUALIFIED_BRANCH"].ToString();
//表检下线支数
this.rollingCard1.Value.OfflineSurface = dt.Rows[0]["OFFLINE_QUANTITY"].ToString();
}
else
{
//上料切前剔除支数
this.rollingCard1.Value.FeedScrapNum = dt.Rows[0]["SCRAP_FEED"].ToString();
//上料切前合格支数
this.rollingCard1.Value.FeedQualifiedNum = dt.Rows[0]["QUALIFIED_FEED"].ToString();
//据切剔除支数
this.rollingCard1.Value.FeedScrapDBNum = dt.Rows[0]["SCRAP_DBFEED"].ToString();
//锯切合格支数
this.rollingCard1.Value.FeedQualifiedDBNum = dt.Rows[0]["QUALIFIED_DBFEED"].ToString();
//加热炉剔除支数
this.rollingCard1.Value.FurScrapNum = dt.Rows[0]["SCRAP_FUR"].ToString();
//加热炉合格支数
this.rollingCard1.Value.FurQualifiedNum = dt.Rows[0]["QUALIFIED_FUR"].ToString();
//穿孔剔除支数
this.rollingCard1.Value.PerScrapNum = dt.Rows[0]["SCRAP_PER"].ToString();
//穿孔合格支数
this.rollingCard1.Value.PerQualifiedNum = dt.Rows[0]["QUALIFIED_PER"].ToString();
//连轧剔除支数
this.rollingCard1.Value.RollingScrapNum = dt.Rows[0]["SCRAP_ROLLING"].ToString();
//连轧合格支数
this.rollingCard1.Value.RollingQualifiedNum = dt.Rows[0]["QUALIFIED_ROLLING"].ToString();
//再加热炉剔除支数
this.rollingCard1.Value.RefurScrapNum = dt.Rows[0]["SCRAP_REFUR"].ToString();
//再加热炉合格支数
this.rollingCard1.Value.RefurQualifiedNum = dt.Rows[0]["QUALIFIED_REFUR"].ToString();
//定径剔除支数
this.rollingCard1.Value.SizingScrapNum = dt.Rows[0]["SCRAP_SIZING"].ToString();
//定径合格支数
this.rollingCard1.Value.SizingQualifiedNum = dt.Rows[0]["QUALIFIED_SIZING"].ToString();
//分切前剔除支数
this.rollingCard1.Value.SawScrapNumBE = dt.Rows[0]["SCRAP_SAW_BE"].ToString();
//分切前合格支数
this.rollingCard1.Value.SawQualifiedNumBE = dt.Rows[0]["QUALIFIED_SAW_BE"].ToString();
//分切剔除支数
this.rollingCard1.Value.SawScrapNum = dt.Rows[0]["SCRAP_SAW"].ToString();
//分切合格支数
this.rollingCard1.Value.SawQualifiedNum = dt.Rows[0]["QUALIFIED_SAW"].ToString();
//矫直剔除支数
this.rollingCard1.Value.StraightScrapNum = dt.Rows[0]["SCRAP_STRAIGHT"].ToString();
//矫直合格支数
this.rollingCard1.Value.StraightQualifiedNum = dt.Rows[0]["QUALIFIED_STRAIGHT"].ToString();
//探伤剔除支数
this.rollingCard1.Value.TestingScrapNum = dt.Rows[0]["SCRAP_TESTING"].ToString();
//探伤合格支数
this.rollingCard1.Value.TestingQualifiedNum = dt.Rows[0]["QUALIFIED_TESTING"].ToString();
//探伤下线支数
this.rollingCard1.Value.OfflineTesting = dt.Rows[0]["OFFLINE_TESTING"].ToString();
//表检剔除支数
this.rollingCard1.Value.SurfaceScrapNum = dt.Rows[0]["WASTE_QUANTITY"].ToString();
//表检合格支数
this.rollingCard1.Value.SurfaceQualifiedNum = dt.Rows[0]["QUALIFIED_BRANCH"].ToString();
//表检下线支数
this.rollingCard1.Value.OfflineSurface = dt.Rows[0]["OFFLINE_QUANTITY"].ToString();
}
this.rollingCard1.UpdateData();
}
else
{
this.rollingCard1.ClearData();
}
}
public void clearRollCard()
{
//上料切前判废支数
this.rollingCard1.Value.FeedScrapNum = "0";
//上料切前合格支数
this.rollingCard1.Value.FeedQualifiedNum = "0";
//上料判废支数
this.rollingCard1.Value.FeedScrapDBNum = "0";
//上料合格支数
this.rollingCard1.Value.FeedQualifiedDBNum = "0";
//加热炉判废支数
this.rollingCard1.Value.FurScrapNum = "0";
//加热炉合格支数
this.rollingCard1.Value.FurQualifiedNum = "0";
//穿孔判废支数
this.rollingCard1.Value.PerScrapNum = "0";
//穿孔合格支数
this.rollingCard1.Value.PerQualifiedNum = "0";
//连轧判废支数
this.rollingCard1.Value.RollingScrapNum = "0";
//连轧合格支数
this.rollingCard1.Value.RollingQualifiedNum = "0";
//再加热炉判废支数
this.rollingCard1.Value.RefurScrapNum = "0";
//再加热炉合格支数
this.rollingCard1.Value.RefurQualifiedNum = "0";
//定径判废支数
this.rollingCard1.Value.SizingScrapNum = "0";
//定径合格支数
this.rollingCard1.Value.SizingQualifiedNum = "0";
//分切前判废支数
this.rollingCard1.Value.SawScrapNumBE = "0";
//分切前合格支数
this.rollingCard1.Value.SawQualifiedNumBE = "0";
//分切判废支数
this.rollingCard1.Value.SawScrapNum = "0";
//分切合格支数
this.rollingCard1.Value.SawQualifiedNum = "0";
//矫直判废支数
this.rollingCard1.Value.StraightScrapNum = "0";
//矫直合格支数
this.rollingCard1.Value.StraightQualifiedNum = "0";
//矫直下线支数
this.rollingCard1.Value.OfflineStraight = "0";
//矫直返线支数
this.rollingCard1.Value.BacklineStraight = "0";
//探伤判废支数
this.rollingCard1.Value.TestingScrapNum = "0";
//探伤合格支数
this.rollingCard1.Value.TestingQualifiedNum = "0";
//探伤下线支数
this.rollingCard1.Value.OfflineTesting = "0";
this.rollingCard1.Value.BacklineTesting = "0";
//表检剔除支数
this.rollingCard1.Value.SurfaceScrapNum = "0";
//表检合格支数
this.rollingCard1.Value.SurfaceQualifiedNum = "0";
//表检下线支数
this.rollingCard1.Value.OfflineSurface = "0";
this.rollingCard1.UpdateData();
}
///
/// 获取人工质检实绩信息显示
///
///
public void utr_SURFACE_EditGrid(DataTable dt)
{
//清空质检实绩
if (SurfaceDataSource.Rows.Count > 0)
{
for (int i = 0; i < SurfaceDataSource.Rows[0].Band.Columns.Count; i++)
{
SurfaceDataSource.Rows[0][i] = "";
}
}
//清空抽检项和抽检率
//Nud_val = 0;
//foreach (Control ctr in this.ultraGroupBox1.Controls)
//{
// if (ctr is UltraCheckEditor)
// {
// UltraCheckEditor ul_chk = ctr as UltraCheckEditor;
// if (ul_chk.Checked)
// {
// ul_chk.Checked = false;
// }
// }
//}
//赋值质检信息和抽检率
if (dt.Rows.Count > 0)
{
DataTable dt_mt = null;
if (PlineCode == "C008" || PlineCode == "C009" || PlineCode == "C017" || PlineCode == "C072")
{
dt_mt = ServerHelper.GetData("com.steering.mes.zgmil.coup.SurfaceInspectionResult.getMIL_MT_RESULT", new object[] { dt.Rows[0]["JUDGE_STOVE_NO"].ToString() }, this.ob);
}
else
{
dt_mt = ServerHelper.GetData("com.steering.mes.zgmil.coup.SurfaceInspectionResult.getMIL_ET_RESULT", new object[] { dt.Rows[0]["JUDGE_STOVE_NO"].ToString() }, this.ob);
}
if (dt_mt.Rows.Count > 0 && dt_mt.Rows[0]["QUALIFIED_NUM"].ToString() != "0" && dt_mt.Rows[0]["QUALIFIED_NUM"].ToString() != "")
{
SurfaceDataSource.Rows[0]["DIRECTOR_QUANTITY"] = dt_mt.Rows[0]["QUALIFIED_NUM"];
DataTable dtStatictis = ServerHelper.GetData("com.steering.mes.zgmil.coup.SurfaceInspectionResult.GetQAResult", new object[] { dt.Rows[0]["JUDGE_STOVE_NO"].ToString(), actResultNo, proPlanId, gxPlanNo }, this.ob);
SurfaceDataSource.Rows[0]["WASTE_QUANTITY"] = dtStatictis.Rows[0]["WASTE_QUANTITY"];
//SurfaceDataSource.Rows[0]["QUALIFIED_BRANCH"] = (int.Parse(SurfaceDataSource.Rows[0]["DIRECTOR_QUANTITY"].ToString()) - int.Parse(SurfaceDataSource.Rows[0]["WASTE_QUANTITY"].ToString())).ToString();
SurfaceDataSource.Rows[0]["QUALIFIED_BRANCH"] = int.Parse(SurfaceDataSource.Rows[0]["DIRECTOR_QUANTITY"].ToString2()) - int.Parse(dtStatictis.Rows[0]["WASTE_QUANTITY"].ToString3()) - int.Parse(dtStatictis.Rows[0]["OFFLINE_QUANTITY"].ToString3());
double[] db_chkargs = new double[4];
double db_args = 0;
double.TryParse(this.rollingInfomation1.Value.PipeSize.Substring(0, this.rollingInfomation1.Value.PipeSize.IndexOf('*') - 1), out db_args);//外径
db_chkargs[0] = db_args;
double.TryParse(this.rollingInfomation1.Value.PipeSize.Substring(this.rollingInfomation1.Value.PipeSize.IndexOf('*') + 1), out db_args);//壁厚
db_chkargs[1] = db_args;
double.TryParse(this.rollingInfomation1.Value.TargetLength, out db_args);//长度
db_chkargs[2] = db_args;
int i_ultraCheckEditor1 = 0;
//int.TryParse(ultraCheckEditor1.Text, out i_ultraCheckEditor1);
//db_chkargs[3] = i_ultraCheckEditor1;//系数
SurfaceDataSource.Rows[0]["QUALIFIED_TONS"] = Math.Round(double.Parse(SurfaceDataSource.Rows[0]["QUALIFIED_BRANCH"].ToString()) * ((db_chkargs[0] - db_chkargs[1]) * db_chkargs[1] * 0.02466 * db_chkargs[2] / 1000), 3);
SurfaceDataSource.Rows[0]["OFFLINE_QUANTITY"] = dtStatictis.Rows[0]["OFFLINE_QUANTITY"];
}
else
{
if (this.ultraGrid_Plan.ActiveRow.Cells["BACK_PLAN_FLAG"].Text.Trim().ToString2() == "9")
{
dt_mt = ServerHelper.GetData("com.steering.mes.zgmil.coup.SurfaceInspectionResult.getMilPlan", new object[] { this.ultraGrid_Plan.ActiveRow.Cells["JUDGE_STOVE_NO"].Value.ToString2(), actResultNo, proPlanId, gxPlanNo }, this.ob);
SurfaceDataSource.Rows[0]["DIRECTOR_QUANTITY"] = dt_mt.Rows[0]["BRANCH"];
DataTable dtStatictis = ServerHelper.GetData("com.steering.mes.zgmil.coup.SurfaceInspectionResult.GetQAResult", new object[] { dt.Rows[0]["JUDGE_STOVE_NO"].ToString(), actResultNo, proPlanId, gxPlanNo }, this.ob);
SurfaceDataSource.Rows[0]["WASTE_QUANTITY"] = dtStatictis.Rows[0]["WASTE_QUANTITY"];
SurfaceDataSource.Rows[0]["QUALIFIED_BRANCH"] = int.Parse(dt_mt.Rows[0]["BRANCH"].ToString3()) - int.Parse(dtStatictis.Rows[0]["WASTE_QUANTITY"].ToString3()) - int.Parse(dtStatictis.Rows[0]["OFFLINE_QUANTITY"].ToString3());
double[] db_chkargs = new double[4];
double db_args = 0;
double.TryParse(this.rollingInfomation1.Value.PipeSize.Substring(0, this.rollingInfomation1.Value.PipeSize.IndexOf('*') - 1), out db_args);//外径
db_chkargs[0] = db_args;
double.TryParse(this.rollingInfomation1.Value.PipeSize.Substring(this.rollingInfomation1.Value.PipeSize.IndexOf('*') + 1), out db_args);//壁厚
db_chkargs[1] = db_args;
double.TryParse(this.rollingInfomation1.Value.TargetLength, out db_args);//长度
db_chkargs[2] = db_args;
int i_ultraCheckEditor1 = 0;
//int.TryParse(ultraCheckEditor1.Text, out i_ultraCheckEditor1);
//db_chkargs[3] = i_ultraCheckEditor1;//系数
SurfaceDataSource.Rows[0]["QUALIFIED_TONS"] = Math.Round(double.Parse(SurfaceDataSource.Rows[0]["QUALIFIED_BRANCH"].ToString()) * ((db_chkargs[0] - db_chkargs[1]) * db_chkargs[1] * 0.02466 * db_chkargs[2] / 1000), 3);
SurfaceDataSource.Rows[0]["OFFLINE_QUANTITY"] = dtStatictis.Rows[0]["OFFLINE_QUANTITY"];
}
else
{
SurfaceDataSource.Rows[0]["DIRECTOR_QUANTITY"] = dt.Rows[0]["DIRECTOR_QUANTITY"].ToString();
SurfaceDataSource.Rows[0]["WASTE_QUANTITY"] = dt.Rows[0]["WASTE_QUANTITY"].ToString();
SurfaceDataSource.Rows[0]["QUALIFIED_BRANCH"] = dt.Rows[0]["QUALIFIED_BRANCH"].ToString();
SurfaceDataSource.Rows[0]["QUALIFIED_TONS"] = dt.Rows[0]["QUALIFIED_TONS"].ToString();
SurfaceDataSource.Rows[0]["OFFLINE_QUANTITY"] = dt.Rows[0]["OFFLINE_QUANTITY"].ToString();
}
}
SurfaceDataSource.Rows[0]["REMARK"] = dt.Rows[0]["REMARK"];
//DataTable dtMIL_BASE_INSPECTOR = ServerHelper.GetData("com.steering.mes.zgmil.coup.SurfaceInspectionResult.getMIL_BASE_INSPECTOR", new object[] { }, this.ob);
//Infragistics.Win.UltraWinEditors.UltraComboEditor ultCbE = new UltraComboEditor();
//ultCbE.Visible = false;
//ultCbE.DataSource = dtMIL_BASE_INSPECTOR;
//ultCbE.DisplayMember = "INSPECTOR_NAME";
//ultCbE.ValueMember = "INSPECTOR_CODE";
//ultraGrid4.DisplayLayout.Bands[0].Columns["COL_USER"].EditorComponent = ultCbE;
//SurfaceDataSource.Rows[0]["COL_USER"] = dt.Rows[0]["COL_USER"];//设置绑定dt的下拉框
DataTable dd = ServerHelper.GetData("com.steering.mes.zgmil.coup.SurfaceInspectionResult.doQuerySufaceD", new object[] { dt.Rows[0]["JUDGE_STOVE_NO"].ToString().Substring(0,6) }, ob);//获取D1\D2最大最小值
if (dd.Rows.Count > 0)
{
SurfaceDataSource.Rows[0]["PIPE_DIAM_MAX"] = dd.Rows[0]["M1"].ToString();
SurfaceDataSource.Rows[0]["PIPE_DIAM_MIN"] = dd.Rows[0]["M2"].ToString();
}
else
{
SurfaceDataSource.Rows[0]["PIPE_DIAM_MAX"] = dt.Rows[0]["PIPE_DIAM_MAX"];
SurfaceDataSource.Rows[0]["PIPE_DIAM_MIN"] = dt.Rows[0]["PIPE_DIAM_MIN"];
}
DataTable smaxM = ServerHelper.GetData("com.steering.mes.zgmil.coup.SurfaceInspectionResult.doQuerySufaceS", new object[] { dt.Rows[0]["JUDGE_STOVE_NO"].ToString().Substring(0,6) }, ob);
SurfaceDataSource.Rows[0]["EXECUTIVE_PRODUCER"] = _UserName;
SurfaceDataSource.Rows[0]["UNEVEN_DEGREE"] = dt.Rows[0]["UNEVEN_DEGREE"];
SurfaceDataSource.Rows[0]["NON_ROUNDNESS"] = dt.Rows[0]["NON_ROUNDNESS"];
SurfaceDataSource.Rows[0]["PIPE_THICKNESS_MAX"] = smaxM.Rows[0]["S1"];
SurfaceDataSource.Rows[0]["PIPE_THICKNESS_MIN"] = smaxM.Rows[0]["S2"];
SurfaceDataSource.Rows[0]["HEAD_STRAIGHT"] = dt.Rows[0]["HEAD_STRAIGHT"];
SurfaceDataSource.Rows[0]["BODY_STRAIGHT"] = dt.Rows[0]["BODY_STRAIGHT"];
SurfaceDataSource.Rows[0]["LENGTH"] = dt.Rows[0]["LENGTH"];
DataTable ds = ServerHelper.GetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.doQuerySize", new object[] { BaseMethod.getJudgeStoveNo(dt.Rows[0]["JUDGE_STOVE_NO"].ToString()), proPlanId, gxPlanNo }, ob);
if (ds.Rows.Count > 0)
{
SurfaceDataSource.Rows[0]["QA_TYPE"] = "尺寸已抽检";
}
else
{
SurfaceDataSource.Rows[0]["QA_TYPE"] = "尺寸未抽检";
}
SurfaceDataSource.Rows[0]["WEIGHT"] = dt.Rows[0]["WEIGHT"];
SurfaceDataSource.Rows[0]["START_TIME"] = dt.Rows[0]["START_TIME"];
SurfaceDataSource.Rows[0]["END_TIME"] = dt.Rows[0]["END_TIME"];
//int num = 0;
//int.TryParse(dt.Rows[0]["SIMPLE_RATE"].ToString(), out num);
//numericUpDown1.Value = num;
//Nud_val = numericUpDown1.Value;
}
}
///
/// 获取指定炉号的缺陷项
///
private void getDefectData()
{
UltraGridRow ugr = ultraGrid_Plan.ActiveRow;
if (ugr != null)
{
string jugeNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
DataTable ds = ServerHelper.GetData("com.steering.mes.zgmil.coup.SurfaceInspectionResult.getDefectData", new object[] { jugeNo }, this.ob);
dtDefectS.Clear();
GridHelper.CopyDataToDatatable(ref ds, ref dtDefectS, true);
}
}
///
/// 查询上料管号队列
///
public void GetFeedRack()
{
UltraGridRow ugr = ultraGrid_Plan.ActiveRow;
if (ugr != null)
{
string OffFlag = "0";
string JudgeStoveNo = "";
JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
DataTable dt1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.SurfaceInspectionResult.getSurfaceRackSeq", new object[] { JudgeStoveNo, "1" }, this.ob);
DataTable dt2 = ServerHelper.GetData("com.steering.mes.zgmil.coup.SurfaceInspectionResult.getSurfaceRackSeq", new object[] { JudgeStoveNo, "2" }, this.ob);
dtMatSeq_3.Clear();
dtMatSeqS.Clear();
GridHelper.CopyDataToDatatable(ref dt1, ref dtMatSeq_3, true);
GridHelper.CopyDataToDatatable(ref dt2, ref dtMatSeqS, true);
}
ChangeGridColor();
}
#endregion
#region 报表
///
/// 打印报表
///
private void PrintResult()
{
Group = UserInfo.GetUserGroup();
Shift = UserInfo.GetUserOrder();
DateTime SeverTime = NativeMethod.GetSeverTime(this.ob);
string Time = SeverTime.ToLongTimeString();
string StartTime = ""; // 开始时间 用于报表查询
string EndTime = ""; // 结束时间 用于报表查询
string strurl = "";
switch (PlineCode)
{
case "C008": //250
break;
case "C072": //508
break;
case "C009": //258
//晚班
Time = Time.Replace(":", "");
if (Shift == "3")
{
//查询晚班前一天20点40后到当天07点20前所有记录
if (int.Parse(Time) < 072000)
{
StartTime = SeverTime.AddDays(-1).ToShortDateString() + " 20:40:00";
EndTime = SeverTime.ToShortDateString() + " 07:20:00";
//string Date2 = SeverTime.ToString("yyyy-MM-dd");
strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilSizingResult.cpt&SHIFT=" + Shift + "&GROUP=" + Group + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + _UserID;
}
//查询当天晚班的所有数据
else if (int.Parse(Time) > 204000)
{
StartTime = SeverTime.ToShortDateString() + " 20:40:00";
EndTime = SeverTime.AddDays(1).ToShortDateString() + " 07:20:00";
strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilSizingResult.cpt&SHIFT=" + Shift + "&GROUP=" + Group + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + _UserID;
}
}
//白班 中班
else
{
StartTime = SeverTime.ToShortDateString() + " 00:00:00";
EndTime = SeverTime.AddDays(1).ToShortDateString() + " 00:00:00";
strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilSizingResult.cpt&SHIFT=" + Shift + "&GROUP=" + Group + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + _UserID;
}
//Time = Time.Replace(":", "");
//if (int.Parse(Time) < 070000)
//{
// StartTime = SeverTime.AddDays(-1).ToShortDateString() + " 07:00:00";
// EndTime = SeverTime.ToShortDateString() + " 07:00:00";
// string Date2 = SeverTime.ToString("yyyy-MM-dd");
// strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilSizingResult.cpt&SHIFT=" + Shift + "&GROUP=" + Group + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + _UserID;
//}
//else
//{
// StartTime = SeverTime.ToShortDateString() + " 07:00:00";
// EndTime = SeverTime.AddDays(1).ToShortDateString() + " 07:00:00";
// strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilSizingResult.cpt&SHIFT=" + Shift + "&GROUP=" + Group + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + _UserID;
//}
break;
case "C010": //168
break;
case "C012": //Arssel
break;
case "C017": //460
//晚班
Time = Time.Replace(":", "");
if (Shift == "3")
{
//查询晚班前一天20点40后到当天07点20前所有记录
if (int.Parse(Time) < 072000)
{
StartTime = SeverTime.AddDays(-1).ToShortDateString() + " 20:40:00";
EndTime = SeverTime.ToShortDateString() + " 07:20:00";
//string Date2 = SeverTime.ToString("yyyy-MM-dd");
strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilSizingResult460.cpt&SHIFT=" + Shift + "&GROUP=" + Group + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + _UserID;
}
//查询当天晚班的所有数据
else if (int.Parse(Time) > 204000)
{
StartTime = SeverTime.ToShortDateString() + " 20:40:00";
EndTime = SeverTime.AddDays(1).ToShortDateString() + " 07:20:00";
strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilSizingResult460.cpt&SHIFT=" + Shift + "&GROUP=" + Group + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + _UserID;
}
}
//白班 中班
else
{
StartTime = SeverTime.ToShortDateString() + " 00:00:00";
EndTime = SeverTime.AddDays(1).ToShortDateString() + " 00:00:00";
strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilSizingResult460.cpt&SHIFT=" + Shift + "&GROUP=" + Group + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + _UserID;
}
break;
}
FrmRepExcel fre = new FrmRepExcel(ob, strurl);
fre.AutoSize = true;
fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
fre.WindowState = FormWindowState.Maximized;
fre.Show();
}
///
/// 查询上个班原始记录
///
private void QueryBefore()
{
HOTMethod hm = new HOTMethod(this.ob);
DateTime SeverTime = NativeMethod.GetSeverTime(this.ob);
string Time = SeverTime.ToLongTimeString();
string Date = SeverTime.ToString("yyyyMMdd");
string StartTime = ""; // 开始时间 用于报表查询
string EndTime = ""; // 结束时间 用于报表查询
string StartTimeU = ""; // 开始时间 用于得到上班UserID
string EndTimeU = ""; // 结束时间 用于得到上班UserID
string strurl = "";
string ShitGroupBefore = HOTMethod.GetShiftBefore(Shift, Group, Date, PlineCode);
//if (PlineCode.Equals("C072"))
//{
// ShitGroupBefore = HOTMethod.GetShiftBefore(Shift, Group, Date);
//}
//else
//{
// ShitGroupBefore = HOTMethod.GetShiftBefore(Shift, Group);
//}
string UserIDBefore = "";
switch (PlineCode)
{
case "C008": //250
break;
case "C072": //508
break;
case "C009": //258
//晚班
Time = Time.Replace(":", "");
if (Shift == "3")
{
//查询晚班前一天20点40后到当天07点20前所有记录
if (int.Parse(Time) < 072000)
{
StartTime = SeverTime.AddDays(-1).ToShortDateString() + " 20:40:00";
EndTime = SeverTime.ToShortDateString() + " 07:20:00";
StartTimeU = SeverTime.AddDays(-1).ToShortDateString() + " 13:40:00";
EndTimeU = SeverTime.ToShortDateString() + " 00:00:00";
UserIDBefore = hm.GetUserIDBefore(StartTimeU, EndTimeU, ShitGroupBefore.Substring(0, 1), ShitGroupBefore.Substring(1, 1), 0, PlineCode);
strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilSizingResult.cpt&SHIFT=" + ShitGroupBefore.Substring(0, 1) + "&GROUP=" + ShitGroupBefore.Substring(1, 1) + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + UserIDBefore;
}
//查询当天晚班的所有数据
else if (int.Parse(Time) > 204000)
{
StartTime = SeverTime.ToShortDateString() + " 20:40:00";
EndTime = SeverTime.AddDays(1).ToShortDateString() + " 07:20:00";
StartTimeU = SeverTime.ToShortDateString() + " 13:40:00";
EndTimeU = SeverTime.AddDays(1).ToShortDateString() + " 00:00:00";
UserIDBefore = hm.GetUserIDBefore(StartTimeU, EndTimeU, ShitGroupBefore.Substring(0, 1), ShitGroupBefore.Substring(1, 1), 0, PlineCode);
strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilSizingResult.cpt&SHIFT=" + ShitGroupBefore.Substring(0, 1) + "&GROUP=" + ShitGroupBefore.Substring(1, 1) + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + UserIDBefore;
}
}
//白班 中班
else
{
StartTime = SeverTime.ToShortDateString() + " 00:00:00";
EndTime = SeverTime.AddDays(1).ToShortDateString() + " 00:00:00";
StartTimeU = SeverTime.ToShortDateString() + " 00:00:00";
EndTimeU = SeverTime.AddDays(1).ToShortDateString() + " 00:00:00";
UserIDBefore = hm.GetUserIDBefore(StartTimeU, EndTimeU, ShitGroupBefore.Substring(0, 1), ShitGroupBefore.Substring(1, 1), 0, PlineCode);
strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilSizingResult.cpt&SHIFT=" + ShitGroupBefore.Substring(0, 1) + "&GROUP=" + ShitGroupBefore.Substring(1, 1) + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + UserIDBefore;
}
//Time = Time.Replace(":", "");
//if (int.Parse(Time) < 072000)
//{
// StartTime = SeverTime.AddDays(-1).ToShortDateString() + " 06:40:00";
// EndTime = SeverTime.ToShortDateString() + " 07:20:00";
// string Date2 = SeverTime.ToString("yyyy-MM-dd");
// strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilSizingResult.cpt&SHIFT=" + ShitGroupBefore.Substring(0, 1) + "&GROUP=" + ShitGroupBefore.Substring(1, 1) + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + _UserID;
//}
//else
//{
// StartTime = SeverTime.ToShortDateString() + " 06:40:00";
// EndTime = SeverTime.AddDays(1).ToShortDateString() + " 07:20:00";
// strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilSizingResult.cpt&SHIFT=" + ShitGroupBefore.Substring(0, 1) + "&GROUP=" + ShitGroupBefore.Substring(1, 1) + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + _UserID;
//}
break;
case "C010": //168
break;
case "C012": //Arssel
break;
case "C017": //460
//晚班
Time = Time.Replace(":", "");
if (Shift == "3")
{
//查询晚班前一天20点40后到当天07点20前所有记录
if (int.Parse(Time) < 072000)
{
StartTime = SeverTime.AddDays(-1).ToShortDateString() + " 20:40:00";
EndTime = SeverTime.ToShortDateString() + " 07:20:00";
StartTimeU = SeverTime.AddDays(-1).ToShortDateString() + " 13:40:00";
EndTimeU = SeverTime.ToShortDateString() + " 00:00:00";
UserIDBefore = hm.GetUserIDBefore(StartTimeU, EndTimeU, ShitGroupBefore.Substring(0, 1), ShitGroupBefore.Substring(1, 1), 0, PlineCode);
strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilSizingResult460.cpt&SHIFT=" + ShitGroupBefore.Substring(0, 1) + "&GROUP=" + ShitGroupBefore.Substring(1, 1) + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + UserIDBefore;
}
//查询当天晚班的所有数据
else if (int.Parse(Time) > 204000)
{
StartTime = SeverTime.ToShortDateString() + " 20:40:00";
EndTime = SeverTime.AddDays(1).ToShortDateString() + " 07:20:00";
StartTimeU = SeverTime.ToShortDateString() + " 13:40:00";
EndTimeU = SeverTime.AddDays(1).ToShortDateString() + " 00:00:00";
UserIDBefore = hm.GetUserIDBefore(StartTimeU, EndTimeU, ShitGroupBefore.Substring(0, 1), ShitGroupBefore.Substring(1, 1), 0, PlineCode);
strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilSizingResult460.cpt&SHIFT=" + ShitGroupBefore.Substring(0, 1) + "&GROUP=" + ShitGroupBefore.Substring(1, 1) + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + UserIDBefore;
}
}
//白班 中班
else
{
StartTime = SeverTime.ToShortDateString() + " 00:00:00";
EndTime = SeverTime.AddDays(1).ToShortDateString() + " 00:00:00";
StartTimeU = SeverTime.ToShortDateString() + " 00:00:00";
EndTimeU = SeverTime.AddDays(1).ToShortDateString() + " 00:00:00";
UserIDBefore = hm.GetUserIDBefore(StartTimeU, EndTimeU, ShitGroupBefore.Substring(0, 1), ShitGroupBefore.Substring(1, 1), 0, PlineCode);
strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilSizingResult460.cpt&SHIFT=" + ShitGroupBefore.Substring(0, 1) + "&GROUP=" + ShitGroupBefore.Substring(1, 1) + "&DATE=" + StartTime + "&PLINECODE=" + PlineCode + "&DATE2=" + EndTime + "&USERID=" + UserIDBefore;
}
break;
}
FrmRepExcel fre = new FrmRepExcel(ob, strurl);
fre.AutoSize = true;
fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
fre.WindowState = FormWindowState.Maximized;
fre.Show();
}
private void u_ChkEditor_ProNo_CheckedChanged(object sender, EventArgs e)
{
u_TxtEditor_ProNo.Enabled = this.u_ChkEditor_ProNo.Checked;
}
private void u_ChkEditor_StoveNo_CheckedChanged(object sender, EventArgs e)
{
u_TxtEditor_StrvoNo.Enabled = this.u_ChkEditor_StoveNo.Checked;
}
private void chkStatusQuery_CheckedChanged(object sender, EventArgs e)
{
if (this.chkHeatNo.Checked)
{
this.txtJudgeStoveNo.Enabled = true;
}
else
{
this.txtJudgeStoveNo.Enabled = false;
}
if (chkStatusQuery.Checked)
{
PlanStatusQuery = "99";
PlanStartStatusQuery = "96";
}
else
{
PlanStatusQuery = "95";
PlanStartStatusQuery = "00";
}
}
private int ChangeFlag = 0; //交班结炉提示 0弹出 1不弹出
private void ultraGridMatSeq_ClickCellButton(object sender, CellEventArgs e)
{
UltraGridRow ugr = this.ultraGridMatSeq.ActiveRow;
UltraGridRow uRow = this.ultraGrid_Plan.ActiveRow;
if (uRow == null) return;
HOTMethod hm = new HOTMethod(this.ob);
NativeMethodNew na = new NativeMethodNew(this.ob);
string plinCode = na.GetPCode(this.UserInfo.GetDepartment());
int Seq = int.Parse(ugr.Cells["SEQ"].Value.ToString());
string JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
string ResultNo = uRow.Cells["ID"].Value.ToString();
string shif = ugr.Cells["COL_SHIFT"].Value.ToString2();
string group = ugr.Cells["COL_GROUP"].Value.ToString2();
if (uRow.Cells["IS_START"].Text.Trim() == "已完成质检")
{
MessageBox.Show("炉号:【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】已完成质检操作,不允许进行交班操作!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
//交班
if (e.Cell.Column.Key == "CHANGE_GROUP")
{
string Shift = UserInfo.GetUserOrder();
string Group = UserInfo.GetUserGroup();
string User = UserInfo.GetUserName();
int BeforeChangeNum = 0;
DataTable ds = ServerHelper.GetData("com.steering.mes.zgmil.coup.SurfaceInspectionResult.doQueryProcessNum", new object[] { ResultNo, JudgeStoveNo }, ob);
if (Seq > int.Parse(ds.Rows[0][0].ToString()))
{
MessageUtil.ShowTips("该序号支数在前工序已被剔除,不允许进行交接班!");
return;
}
//查询上个班交班支数
DataTable dtChangeNum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getChangeSeq", new object[] { JudgeStoveNo, ResultNo, 9, plinCode, Shift, Group, proPlanId, gxPlanNo }, this.ob);
if (dtChangeNum.Rows.Count > 0)
{
if (!string.IsNullOrEmpty(dtChangeNum.Rows[0][0].ToString()))
{
BeforeChangeNum = int.Parse(dtChangeNum.Rows[0][0].ToString());
}
}
int Seq2 = Seq;
if (Seq2 <= BeforeChangeNum)
{
MessageBox.Show("前道班次已交班,该支不能再次交班。");
return;
}
hm.UpdateChangeFlag(JudgeStoveNo, ResultNo, "", 9, Seq, 0);
}
//接班
if (e.Cell.Column.Key == "TAKE_OVER")
{
string Shift = UserInfo.GetUserOrder();
string Group = UserInfo.GetUserGroup();
string User = UserInfo.GetUserName();
int BeforeChangeNum = 0;
//查询上个班交班支数
DataTable dtChangeNum = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.getChangeSeq", new object[] { JudgeStoveNo, ResultNo, 9, plinCode, Shift, Group, proPlanId, gxPlanNo }, this.ob);
if (dtChangeNum.Rows.Count > 0)
{
if (!string.IsNullOrEmpty(dtChangeNum.Rows[0][0].ToString()))
{
BeforeChangeNum = int.Parse(dtChangeNum.Rows[0][0].ToString());
}
}
int WaitChangeSeq = hm.GetWaitChangeSeq(JudgeStoveNo, ResultNo, "", 9, 0, proPlanId, gxPlanNo);
if (WaitChangeSeq == 0)
{
MessageBox.Show("没有待交班确认的管号。");
return;
}
if (WaitChangeSeq != Seq)
{
MessageBox.Show("交班管序号与接班管序号不符,请确认后接班。");
return;
}
if (MessageUtil.ShowYesNoAndQuestion("确认炉号:【" + BaseMethod.getJudgeStoveNo(JudgeStoveNo) + "】序号:【" + Seq + "】交班?") == DialogResult.No)
{
return;
}
//查询是否有该班接班记录
DateTime SeverTime = NativeMethod.GetSeverTime(this.ob);
string Time = SeverTime.ToLongTimeString();
string StartTime = SeverTime.ToShortDateString() + " 00:00:00";
string EndTime = SeverTime.AddDays(1).ToShortDateString() + " 00:00:00";
if (this.DoRelogin(DoCheck))
{
//插入接班确认履历表
hm.InsertChangeRemuse(Shift, Group, _UserName, "9", plinCode);
int Seq2 = Seq;
int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.changeNum", new object[] { JudgeStoveNo, ResultNo, Seq2, BeforeChangeNum, 0, plinCode, Shift, Group, _UserName, 9, 0, proPlanId, gxPlanNo }, this.ob);
ChangeFlag = 1;
}
}
if (ultraGrid_Plan.Rows == null)
{
return;
}
GetFeedRack();
ChangeGridColor();
}
public string DoCheck(CoreUserInfo User)
{
return "";
}
private void ultraGrid4_CellChange(object sender, CellEventArgs e)
{
this.ultraGrid4.UpdateData();
UltraGridRow uRow = this.ultraGrid4.ActiveRow;
DataTable dt = new DataTable();
if (e.Cell.Column.Key == "DIRECTOR_QUANTITY")
{
DataTable ds = ServerHelper.GetData("com.steering.mes.zgmil.coup.SurfaceInspectionResult.doQueryNodeS", new object[] { this.ultraGrid_Plan.ActiveRow.Cells["ID"].Value.ToString(), PlineCode }, ob);
if (ds.Rows.Count > 0)
{
if (ds.Rows[0]["NODE_FUR_FLAG"].ToString() == "0")
{
SurfaceDataSource.Rows[0]["QUALIFIED_BRANCH"] = (int.Parse(uRow.Cells["DIRECTOR_QUANTITY"].Value.ToString3()) - int.Parse(uRow.Cells["OFFLINE_QUANTITY"].Value.ToString3()) - int.Parse(uRow.Cells["WASTE_QUANTITY"].Value.ToString3())).ToString();
dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.SurfaceInspectionResult.doQueryPortWgt", new object[] { this.ultraGrid_Plan.ActiveRow.Cells["ID"].Value.ToString(), SurfaceDataSource.Rows[0]["QUALIFIED_num"].ToString(), proPlanId, gxPlanNo }, ob);
SurfaceDataSource.Rows[0]["QUALIFIED_TONS"] = dt.Rows[0][0].ToString();
}
}
else
{
SurfaceDataSource.Rows[0]["QUALIFIED_BRANCH"] = (int.Parse(uRow.Cells["DIRECTOR_QUANTITY"].Value.ToString3()) - int.Parse(uRow.Cells["OFFLINE_QUANTITY"].Value.ToString3()) - int.Parse(uRow.Cells["WASTE_QUANTITY"].Value.ToString3())).ToString();
//uRow.Cells["QUALIFIED_BRANCH"].Value = "1";
dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.SurfaceInspectionResult.doQueryPortWgt", new object[] { this.ultraGrid_Plan.ActiveRow.Cells["ID"].Value.ToString(), SurfaceDataSource.Rows[0]["QUALIFIED_BRANCH"].ToString(), proPlanId, gxPlanNo }, ob);
SurfaceDataSource.Rows[0]["QUALIFIED_TONS"] = dt.Rows[0][0].ToString();
}
}
if (e.Cell.Column.Key == "WASTE_QUANTITY" || e.Cell.Column.Key == "OFFLINE_QUANTITY")
{
if (uRow.Cells["DIRECTOR_QUANTITY"].Value.ToString3() == "0")
{
SurfaceDataSource.Rows[0]["QUALIFIED_num"] = "0";
SurfaceDataSource.Rows[0]["QUALIFIED_TONS"] = "0";
}
}
}
}
#endregion
}