| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Collections;
- using System.Windows.Forms;
- using CoreFS.CA06;
- namespace Core.LZMes.Client.UIK
- {
- public partial class UIK020060 : FrmBase
- {
- private string UPDATE_FLAG = "";
- public UIK020060()
- {
- InitializeComponent();
- }
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "Query":
- this.DoQuery();
- break;
- case "Save":
- this.DoSave();
- break;
- case "Exit":
- this.Close();
- break;
- }
- }
- private void DoQuery()
- {
- try
- {
- string c_coilCold = this.ultraComboEditor1.Text.Trim();
- this.dataSet1.Tables[0].Clear();
- this.dataSet2.Tables[0].Clear();
- this.dataSet3.Tables[0].Clear();
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "UIK.UIK02.UIK020020";
- ccp.MethodName = "queryAcidRollingResult";
- ccp.ServerParams = new Object[] { c_coilCold,textBox2.Text };
- ccp = this.ExecuteQuery(ccp, CoreInvokeType.Internal);
- ArrayList list = (ArrayList)ccp.ReturnObject;
- if (list != null && 0 < list.Count)
- {
- Hashtable ht = (Hashtable)list[0];
- DataRow dr = dataSet1.Tables[0].NewRow();
- for (int i = 0; i < dataSet1.Tables[0].Columns.Count; i++)
- {
- object obj = ht[dataSet1.Tables[0].Columns[i].ColumnName];
- if (null == obj)
- {
- continue;
- }
- if (obj.GetType().Equals(typeof(Hashtable)))
- {
- dr[i] = ((Hashtable)obj)["value"];
- }
- else
- {
- dr[i] = obj;
- }
- }
- dataSet1.Tables[0].Rows.Add(dr);
- ultraGrid1.Rows[0].Cells["L_COIL_NO"].Activation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
- //ultraGrid1.Rows[0].Cells["MILL_DTIME"].Activation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
- //ultraGrid1.Rows[0].Cells["SLEEVE"].Activation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
- //ultraGrid1.Rows[0].Cells["NO_DEFECT"].Activation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
- //ultraGrid1.Rows[0].Cells["NO_STRIP"].Activation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
- //带钢数
- int noStrip = int.Parse(((Hashtable)ht["NO_STRIP"])["value"].ToString());
- for (int i = 0; i < 3; i++)
- {
- dr = dataSet2.Tables[0].NewRow();
- for (int j = 0; j < dataSet2.Tables[0].Columns.Count; j++)
- {
- object obj = ht[dataSet2.Tables[0].Columns[j].ColumnName + (i + 1)];
- if (null == obj)
- {
- obj = ht[dataSet2.Tables[0].Columns[j].ColumnName + "_" + (i + 1)];
- }
- if (null == obj)
- {
- continue;
- }
- if (obj.GetType().Equals(typeof(Hashtable)))
- {
- dr[j] = ((Hashtable)obj)["value"];
- }
- else
- {
- dr[j] = obj;
- }
- }
- dataSet2.Tables[0].Rows.Add(dr);
- }
- //缺陷数
- int noDefect = int.Parse(((Hashtable)ht["NO_DEFECT"])["value"].ToString());
- for (int i = 0; i < 20; i++)
- {
- dr = dataSet3.Tables[0].NewRow();
- for (int j = 0; j < dataSet3.Tables[0].Columns.Count; j++)
- {
- object obj = ht[dataSet3.Tables[0].Columns[j].ColumnName + (i + 1)];
- if (null == obj)
- {
- obj = ht[dataSet3.Tables[0].Columns[j].ColumnName + "_" + (i + 1)];
- }
- if (null == obj)
- {
- continue;
- }
- if (obj.GetType().Equals(typeof(Hashtable)))
- {
- dr[j] = ((Hashtable)obj)["value"];
- }
- else
- {
- dr[j] = obj;
- }
- }
- dataSet3.Tables[0].Rows.Add(dr);
- }
- UPDATE_FLAG = "U";
- }
- else
- {
- dataTable1.Rows.Add(dataTable1.NewRow());
- ultraGrid1.Rows[0].Cells["L_COIL_NO"].Activation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit;
- //ultraGrid1.Rows[0].Cells["MILL_DTIME"].Activation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit;
- //ultraGrid1.Rows[0].Cells["SLEEVE"].Activation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit;
- //ultraGrid1.Rows[0].Cells["NO_DEFECT"].Activation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit;
- //ultraGrid1.Rows[0].Cells["NO_STRIP"].Activation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit;
- for (int i = 0; i < 3; i++)
- {
- dataTable2.Rows.Add(dataTable2.NewRow());
- }
- for (int i = 0; i < 20; i++)
- {
- dataTable3.Rows.Add(dataTable3.NewRow());
- }
- UPDATE_FLAG = "A";
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
- /// <summary>
- /// 修改酸轧实绩
- /// </summary>
- private void DoSave()
- {
- try
- {
- ultraGrid1.Update();
- ultraGrid2.Update();
- ultraGrid3.Update();
- Infragistics.Win.UltraWinGrid.RowsCollection rs = this.ultraGrid1.Rows;
- if (rs.Count > 0)
- {
- string coilNo = rs[0].Cells["L_COIL_NO"].Text.Trim();
- string actWgt = rs[0].Cells["ACT_WGT"].Text.Trim();
- string coilLen = rs[0].Cells["COIL_LEN"].Text.Trim();
- string coilWth = rs[0].Cells["COIL_WTH"].Text.Trim();
- string coilThk = rs[0].Cells["COIL_THK"].Text.Trim();
- string coilIndia = rs[0].Cells["COIL_INDIA"].Text.Trim();
- string coilOutdia = rs[0].Cells["COIL_OUTDIA"].Text.Trim();
- string regId = this.UserInfo.GetUserID();
- if (coilNo.Equals(""))
- {
- MessageBox.Show("卷号不能为空!");
- return;
- }
- if (actWgt.Equals(""))
- {
- MessageBox.Show("重量不能为空!");
- return;
- }
- if (coilWth.Equals(""))
- {
- MessageBox.Show("宽度不能为空!");
- return;
- }
- if (coilThk.Equals(""))
- {
- MessageBox.Show("厚度不能为空!");
- return;
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "UIK.UIK02.UIK020020";
- if (UPDATE_FLAG.Equals("U"))
- {
- ccp.MethodName = "updateAcidRollingResult";
- ccp.ServerParams = new Object[] { coilNo, actWgt, coilLen, coilWth, coilThk, coilIndia, coilOutdia, regId };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- }
- else if (UPDATE_FLAG.Equals("A"))
- {
- //查询冷卷号是否存在
- CoreClientParam ccp1 = new CoreClientParam();
- ccp1.ServerName = "UIK.UIK02.UIK020020";
- ccp1.MethodName = "queryCoilExist";
- ccp1.ServerParams = new Object[] { coilNo };//需要考虑分卷情况判断父卷号是否存在,如果新增的冷卷号与系统将在生成的冷卷号冲突怎么处理
- ccp1 = this.ExecuteQuery(ccp1, CoreInvokeType.Internal);
- int count = 0;
- if (ccp1.ReturnObject != null)
- {
- count = int.Parse(ccp1.ReturnObject.ToString());
- if (count > 0)
- {
- MessageBox.Show("冷卷号在系统中已存在,请确认后再进行操作!");
- return;
- }
- string millDtime = DateTime.Now.ToString("yyyyMMddHHmmss");
- string sleeve = rs[0].Cells["SLEEVE"].Text.Trim();
- string noDefect = rs[0].Cells["NO_DEFECT"].Text.Trim();
- string nostrip = rs[0].Cells["NO_STRIP"].Text.Trim();
- //if (millDtime.Equals(""))
- //{
- // MessageBox.Show("轧制时间不能为空!");
- // return;
- //}
- if (sleeve.Equals(""))
- {
- MessageBox.Show("是否带套筒不能为空!");
- return;
- }
- if (noDefect.Equals(""))
- {
- MessageBox.Show("缺陷数量不能为空!");
- return;
- }
- if (nostrip.Equals(""))
- {
- MessageBox.Show("热卷数量不能为空!");
- return;
- }
-
- //冷卷信息
- string[] lCoilInfo = new string[] { coilNo,millDtime,actWgt,coilLen,coilWth,coilThk,coilIndia,coilOutdia,sleeve,nostrip,noDefect};
-
- //热卷信息
- Infragistics.Win.UltraWinGrid.RowsCollection rs2 = this.ultraGrid2.Rows;
- if (rs2[0].Cells["H_COIL_NO"].Text.Trim().Equals(""))
- {
- MessageBox.Show("热卷号不能为空!");
- return;
- }
- ArrayList hCoilInfo = new ArrayList();
- for (int i = 0; i < rs2.Count; i++)
- {
- string ordNo = rs2[i].Cells["ORDER_NO"].Text.Trim();//订单号
- string alloy = rs2[i].Cells["ALLOY"].Text.Trim();//牌号
- string length = rs2[i].Cells["LENGTH"].Text.Trim();//长度
- string tcmWidth = rs2[i].Cells["TCM_WIDTH"].Text.Trim();//宽度
- string plWidth = rs2[i].Cells["PL_WIDTH"].Text.Trim();//酸洗宽度
- string thickEx = rs2[i].Cells["THICK_EX"].Text.Trim();//出口厚度
- string cplBegin = rs2[i].Cells["CPL_BEGIN"].Text.Trim();//酸洗开始时间
- string cplEnd = rs2[i].Cells["CPL_END"].Text.Trim();//酸洗结束时间
- string plSpeedMax = rs2[i].Cells["PL_SPEED_MAX"].Text.Trim();//最大速度
- string plSpeedMin = rs2[i].Cells["PL_SPEED_MIN"].Text.Trim();//最小速度
- string plSpeedAvg = rs2[i].Cells["PL_SPEED_AVE"].Text.Trim();//平均速度
- string rollingBegin = rs2[i].Cells["ROLLING_BEGIN"].Text.Trim();//轧制开始时间
- string rollingEnd = rs2[i].Cells["ROLLING_END"].Text.Trim();//轧制结束时间
- string thickStep = rs2[i].Cells["THICK_SETP"].Text.Trim();//厚度设置值
- string thickMin = rs2[i].Cells["THICK_MIN"].Text.Trim();//厚度最小值
- string thickMax = rs2[i].Cells["THICK_MAX"].Text.Trim();//厚度最大值
- string thickLmin = rs2[i].Cells["THICK_LMIN"].Text.Trim();//厚度限制最小值
- string thickLmax = rs2[i].Cells["THICK_LMAX"].Text.Trim();//厚度限制最大值
- string tcmSpeed = rs2[i].Cells["TCM_SPEED"].Text.Trim();//轧制平均速度
- string thinkClass1 = rs2[i].Cells["THINK_CLASS1"].Text.Trim();//种类1
- string thinkClass2 = rs2[i].Cells["THINK_CLASS2"].Text.Trim();//种类2
- string thinkClass3 = rs2[i].Cells["THINK_CLASS3"].Text.Trim();//种类3
- string thinkClass4 = rs2[i].Cells["THINK_CLASS4"].Text.Trim();//种类4
- string thinkClass5 = rs2[i].Cells["THINK_CLASS5"].Text.Trim();//种类5
- string flatenessClass1 = rs2[i].Cells["FLATENESS_CLASS1"].Text.Trim();//表面1
- string flatenessClass2 = rs2[i].Cells["FLATENESS_CLASS2"].Text.Trim();//表面2
- string flatenessClass3 = rs2[i].Cells["FLATENESS_CLASS3"].Text.Trim();//表面3
- string flatenessClass4 = rs2[i].Cells["FLATENESS_CLASS4"].Text.Trim();//表面4
- string flatenessClass5 = rs2[i].Cells["FLATENESS_CLASS5"].Text.Trim();//表面5
- string hCoilNo = rs2[i].Cells["H_COIL_NO"].Text.Trim();//热轧卷号
- hCoilInfo.Add( new string[] {ordNo,alloy,length,cplBegin,cplEnd,plWidth,plSpeedMax
- ,plSpeedMin,plSpeedAvg,rollingBegin,rollingEnd,tcmWidth,thickEx,thickStep,thickMin,thickMax
- ,thickLmax,thickLmin,tcmSpeed,thinkClass1,thinkClass2,thinkClass3,thinkClass4
- ,thinkClass5,flatenessClass1,flatenessClass2,flatenessClass3,flatenessClass4
- ,flatenessClass5,hCoilNo });
- }
- //缺陷信息
- Infragistics.Win.UltraWinGrid.RowsCollection rs3 = this.ultraGrid3.Rows;
- ArrayList defectInfo = new ArrayList();
- for (int i = 0; i < rs3.Count; i++)
- {
- string area = rs3[i].Cells["AREA"].Text.Trim();//区域标识
- string defectType = rs3[i].Cells["DEFECT_TYPE"].Text.Trim();//缺陷代码
- string defectPosition = rs3[i].Cells["DEFECT_POSITION"].Text.Trim();//缺陷边 T/B
- string intensity = rs3[i].Cells["INTENSITY"].Text.Trim();//缺陷等级
- string startPos = rs3[i].Cells["START_POS"].Text.Trim();//开始位置
- string endPos = rs3[i].Cells["END_POS"].Text.Trim();//结束位置
- defectInfo.Add(new string[] {area,defectType,defectPosition,intensity,startPos,endPos });
- }
- //新增实绩信息
- ccp.MethodName = "addAcidResultSaunXi";
- ArrayList listParam = new ArrayList();
- listParam.Add(lCoilInfo);
- listParam.Add(hCoilInfo);
- listParam.Add(defectInfo);
- ccp.ServerParams = new Object[] { listParam,regId };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != 0)
- {
- MessageBox.Show("酸轧实绩新增失败,请确认数据是否输入正确后再点击保存!");
- return;
- }
- this.ultraComboEditor1.Text = coilNo;
- }
- }
- this.DoQuery();
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
- private void UIK020060_Load(object sender, EventArgs e)
- {
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "UIK.UIK02.UIK020020";
- ccp.MethodName = "queryLastCoilNos";
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- ArrayList list = (ArrayList)(ccp.ReturnObject);
- if (list != null)
- {
- int listSize = list.Count;
- Infragistics.Win.ValueListItem[] valueListItems = new Infragistics.Win.ValueListItem[listSize];
- for (int i = 0; i < listSize; i++)
- {
- Infragistics.Win.ValueListItem item = new Infragistics.Win.ValueListItem();
- string param = list[i].ToString();
- item.DataValue = param;
- item.DisplayText = param; ;
- valueListItems[i] = item;
- }
- this.ultraComboEditor1.Items.AddRange(valueListItems);
- }
- }
- }
- }
|