| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using CoreFS.CA06;
- using System.Collections;
- using System.Text.RegularExpressions;
- namespace Core.LZMes.Client.UIM
- {
- public partial class UIM010250 : FrmBase
- {
- public UIM010250()
- {
- InitializeComponent();
- }
- //垛位分析用字符掩码
- private const string _numPattern = @"^\d+$";
- private const string _layerPattern = @"^[ABCabc]?$";
- private const string _yardPattern = @"^[3-5]?$";
- //当前输入垛位是否有效
- private bool bolYard1 = false;
- private bool bolYard2 = false;
- private Infragistics.Win.ValueListItem[] areaList3
- {
- get
- {
- return new Infragistics.Win.ValueListItem[]
- {
- new Infragistics.Win.ValueListItem("1-10","一区(1-10)"),
- new Infragistics.Win.ValueListItem("11-20","二区(11-20)"),
- new Infragistics.Win.ValueListItem("21-30","三区(21-30)"),
- new Infragistics.Win.ValueListItem("31-40","四区(31-40)"),
- new Infragistics.Win.ValueListItem("41-57","五区(41-57)"),
- new Infragistics.Win.ValueListItem("58-74","六区(58-74)"),
- new Infragistics.Win.ValueListItem("75-91","七区(75-91)"),
- new Infragistics.Win.ValueListItem("92-108","八区(92-108)")
- };
- }
-
- }
- private Infragistics.Win.ValueListItem[] areaList5
- {
- get
- {
- return new Infragistics.Win.ValueListItem[]
- {
- new Infragistics.Win.ValueListItem("1-15","一区(1-15)"),
- new Infragistics.Win.ValueListItem("16-35","二区(16-35)"),
- new Infragistics.Win.ValueListItem("36-50","三区(36-50)"),
- new Infragistics.Win.ValueListItem("51-65","四区(51-65)"),
- new Infragistics.Win.ValueListItem("66-80","五区(66-80)"),
- new Infragistics.Win.ValueListItem("81-102","六区(81-102)")
- };
- }
- }
- private Infragistics.Win.ValueListItem[] areaList4
- {
- get
- {
- return new Infragistics.Win.ValueListItem[]
- {
- new Infragistics.Win.ValueListItem("1-10","一区(1-10)"),
- new Infragistics.Win.ValueListItem("11-21","二区(11-21)"),
- new Infragistics.Win.ValueListItem("22-32","三区(22-32)"),
- new Infragistics.Win.ValueListItem("33-43","四区(33-43)"),
- new Infragistics.Win.ValueListItem("44-54","五区(44-54)"),
- new Infragistics.Win.ValueListItem("55-65","六区(55-65)"),
- new Infragistics.Win.ValueListItem("66-76","七区(66-76)"),
- new Infragistics.Win.ValueListItem("77-87","八区(77-87)"),
- new Infragistics.Win.ValueListItem("88-100","九区(88-100)"),
- };
- }
- }
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "Query":
- this.DoQuerryLoad(0);
- break;
- case "Save":
- this.DoSave();
- break;
- case "Exit":
- this.Close();
- break;
- }
- }
- /// <summary>
- /// 等待移垛卷列表
- /// </summary>
- List<MoveYardListNode> moveYardList = new List<MoveYardListNode>();
- /// <summary>
- /// 查询垛位状态
- /// </summary>
- private void DoQuerryLoad(int status)
- {
- this.moveYardList.Clear();
- if (status != 2)
- {
- string[] area = this.ddlKUarea1.Value.ToString().Split('-');
- string ku = this.ddlKU1.Value.ToString();
- dataSet1.Tables[0].Clear();
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "UIM.UIM010250";
- ccp.MethodName = "queryLoad";
- ccp.ServerParams = new object[] { ku, area[0], area[1] };
- ccp.SourceDataTable = dataSet1.Tables[0];
- this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
- }
- if (status != 1)
- {
- string[] area2 = this.ddlKUarea2.Value.ToString().Split('-');
- string ku2 = this.ddlKU2.Value.ToString();
- dataSet2.Tables[0].Clear();
- CoreClientParam ccp2 = new CoreClientParam();
- ccp2.ServerName = "UIM.UIM010250";
- ccp2.MethodName = "queryLoad";
- ccp2.ServerParams = new object[] { ku2, area2[0], area2[1] };
- ccp2.SourceDataTable = dataSet2.Tables[0];
- this.ExecuteQueryToDataTable(ccp2, CoreInvokeType.Internal);
- }
- this.ShowMoveList();
- }
- /// <summary>
- /// 保存
- /// </summary>
- private void DoSave()
- {
- foreach (MoveYardListNode item in moveYardList)
- {
- this.DoMove(new List<string>() { item.coilNo }, item.yardNow, item.yardTo);
- }
- this.moveYardList.Clear();
- this.DoQuerryLoad(0);
- }
- /// <summary>
- /// 通过钢卷号查询垛位
- /// </summary>
- private void DoLoadLocQuerry()
- {
- try
- {
- string strLoadLoc = "";
- string strStat = "";
- string coilNo = this.txtCoilNoQuerry.Text.Trim();
- //如果未输入,一切还原,并不做查询
- if (coilNo == "")
- {
- this.txtCoilNoOUT.Text = "";
- this.txtCoilNoStat.Text = "";
- return;
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "UIM.UIM010250";
- ccp.MethodName = "queryLoadLoc";
- ccp.ServerParams = new object[] { coilNo };
- this.ExecuteQuery(ccp, CoreInvokeType.Internal);
- Hashtable temp = HashTableReadTest.GetHastabinArrayNoEx(ccp.ReturnObject, 0);
- //如果temp为null 说明没有查询到这个钢卷号
- if (temp == null)
- {
- this.txtCoilNoOUT.Text = "此钢卷无记录";
- this.txtCoilNoStat.Text = "";
- return;
- }
- strLoadLoc = HashTableReadTest.GetValueinHasTab(temp, "CUR_LOAD_LOC").ToString();
- strStat = HashTableReadTest.GetValueinHasTab(temp, "COIL_STAT").ToString();
- this.txtCoilNoOUT.Text = strLoadLoc;
- this.txtCoilNoStat.Text = strStat;
- }
- catch
- {
- MessageBox.Show("如果你看到了这个警告窗,请联系开发人员.\n 错误于DoLoadLocQuerry()");
- }
- }
- /// <summary>
- /// 通过钢卷号查询垛位 for LOG
- /// </summary>
- private void DoLoadLocLOGQuerry()
- {
- try
- {
- string strLoadLoc = "";
- string strStat = "";
- string coilNo = this.ddlCoilNoQuerry_LOG.Text.Trim();
- //如果未输入,一切还原,并不做查询
- if (coilNo == "")
- {
- this.txtCoilNoOUT_LOG.Text = "";
- this.txtCoilNoStat_LOG.Text = "";
- return;
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "UIM.UIM010250";
- ccp.MethodName = "queryLoadLoc";
- ccp.ServerParams = new object[] { coilNo };
- this.ExecuteQuery(ccp, CoreInvokeType.Internal);
- Hashtable temp = HashTableReadTest.GetHastabinArrayNoEx(ccp.ReturnObject, 0);
- //如果temp为null 说明没有查询到这个钢卷号
- if (temp == null)
- {
- this.txtCoilNoOUT_LOG.Text = "此钢卷无记录";
- this.txtCoilNoStat_LOG.Text = "";
- return;
- }
- strLoadLoc = HashTableReadTest.GetValueinHasTab(temp, "CUR_LOAD_LOC").ToString();
- strStat = HashTableReadTest.GetValueinHasTab(temp, "COIL_STAT").ToString();
- this.txtCoilNoOUT_LOG.Text = strLoadLoc;
- this.txtCoilNoStat_LOG.Text = strStat;
- }
- catch
- {
- MessageBox.Show("如果你看到了这个警告窗,请联系开发人员.\n 错误于DoLoadLocLOGQuerry()");
- }
- }
- /// <summary>
- /// 查询移垛记录
- /// </summary>
- private void DoCoilNoLOGQuerry()
- {
- string coilNo = this.ddlCoilNoQuerry_LOG.Text.Trim();
- dataSet3.Tables[0].Clear();
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "UIM.UIM010250";
- ccp.MethodName = "queryCoilNoLOG";
- ccp.ServerParams = new object[] { coilNo };
- ccp.SourceDataTable = dataSet3.Tables[0];
- this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
- }
- /// <summary>
- /// 移垛
- /// </summary>
- /// <param name="coilNosList">要移动的钢卷清单</param>
- /// <param name="yardNOW">目前垛位</param>
- /// <param name="yardTO">目标垛位</param>
- private void DoMove(List<string> coilNosList,string yardNOW,string yardTO)
- {
- try
- {
- string[] coilNo = new string[coilNosList.Count];
- for (int i = 0; i < coilNosList.Count; i++)
- {
- coilNo[i] = coilNosList[i];
- }
- string regID = this.UserInfo.GetUserID();
- string regShift = this.UserInfo.GetUserOrder();
- string regGroup = this.UserInfo.GetUserGroup();
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "UIM.UIM010250";
- ccp.MethodName = "moveYard";//moveYard(String[], String, String, String, String, String)
- ccp.ServerParams = new object[] { coilNo, yardNOW, yardTO, regID, regShift, regGroup };
- this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- }
- catch(Exception ex)
- {
- MessageBox.Show(ex.ToString());
- }
- for (int i = 0; i < coilNosList.Count; i++)
- {
- Infragistics.Win.ValueListItem temp = new Infragistics.Win.ValueListItem(coilNosList[i]);
- if(this.ddlCoilNoQuerry_LOG.FindString(coilNosList[i]) < 0)
- this.ddlCoilNoQuerry_LOG.Items.Add(temp);
- }
- return;
- }
- /// <summary>
- /// 把钢卷加入等待移动表中
- /// </summary>
- /// <param name="coilNo"></param>
- /// <param name="yardNow"></param>
- /// <param name="moveTo"></param>
- private void AddMoveList(string coilNo, string yardNow, string moveTo)
- {
- bool itInList = false;
- int listIndex = -1;
- for (int i = 0; i < moveYardList.Count; i++)
- {
- if (coilNo == moveYardList[i].coilNo)
- {
- itInList = true;//在表里
- listIndex = i;
- break;
- }
- }
- if (itInList == false)
- {
- //新节点
- this.moveYardList.Add(new MoveYardListNode(coilNo, yardNow, moveTo));
- return;
- }
- else
- {
- if (moveTo == moveYardList[listIndex].yardNow)
- {
- //不用移动
- moveYardList.RemoveAt(listIndex);
- }
- else
- {
- //改写目标
- moveYardList[listIndex].yardTo = moveTo;
- }
- return;
- }
-
- }
- private void ShowMoveList()
- {
- this.richTextBox1.Clear();
- foreach (MoveYardListNode item in moveYardList)
- {
- this.richTextBox1.AppendText(item.coilNo + "\n");
- }
- }
- private void btnCoilNoQuerry_Click(object sender, EventArgs e)
- {
- this.DoLoadLocQuerry();
- }
- private void txtCoilNoQuerry_TextChanged(object sender, EventArgs e)
- {
- this.txtCoilNoOUT.Text = "";
- this.txtCoilNoStat.Text = "";
- }
- private void button1_Click(object sender, EventArgs e)
- {
- }
- private void btnCoilNo_LOGQuerry_Click(object sender, EventArgs e)
- {
- this.DoLoadLocLOGQuerry();
- this.DoCoilNoLOGQuerry();
- }
- private void ddlCoilNoQuerry_LOG_ValueChanged(object sender, EventArgs e)
- {
- this.txtCoilNoOUT_LOG.Text = "";
- this.txtCoilNoStat_LOG.Text = "";
- this.dataSet3.Tables[0].Clear();
- }
- private void btnAtoB_Click(object sender, EventArgs e)
- {
- Infragistics.Win.UltraWinGrid.UltraGridRow rowA = null;
- Infragistics.Win.UltraWinGrid.UltraGridRow rowB = null;
- //取被选行
- for (int i = 0; i < this.ultraGrid1.Rows.Count; i++)
- {
- if (((bool)this.ultraGrid1.Rows[i].Cells["BESELECT"].Value) == true)
- {
- rowA = this.ultraGrid1.Rows[i];
- }
- }
- for (int i = 0; i < this.ultraGrid2.Rows.Count; i++)
- {
- if (((bool)this.ultraGrid2.Rows[i].Cells["BESELECT"].Value) == true)
- {
- rowB = this.ultraGrid2.Rows[i];
- }
- }
- //数据不全 都不做处理
- if (rowA == null || rowB == null)
- {
- return;
- }
- if (rowA.Cells["COIL_NO"].Text == "")
- {
- return;
- }
- if (rowA.Cells["CUR_LOAD_LOC"].Text == rowB.Cells["CUR_LOAD_LOC"].Text)
- {
- return;
- }
- //加入等待移垛列表
- this.AddMoveList(rowA.Cells["COIL_NO"].Text, rowA.Cells["CUR_LOAD_LOC"].Text, rowB.Cells["CUR_LOAD_LOC"].Text);
- //显示
- //开启可写
- dataSet1.Tables[0].Columns["COIL_NO"].ReadOnly = false;
- dataSet1.Tables[0].Columns["CUR_LOAD_LOC"].ReadOnly = false;
- dataSet2.Tables[0].Columns["COIL_NO"].ReadOnly = false;
- dataSet2.Tables[0].Columns["CUR_LOAD_LOC"].ReadOnly = false;
- //如果表A=表B
- bool sameView = false;
- if (this.ddlKU1.Value == this.ddlKU2.Value && this.ddlKUarea1.Value == this.ddlKUarea2.Value)
- {
- sameView = true;
- }
- //表B的操作
- //如果是同表 把对应的行找出来 并清除
- if (sameView == true)
- {
- Infragistics.Win.UltraWinGrid.UltraGridRow rowBs = null;
- for (int i = 0; i < this.ultraGrid2.Rows.Count; i++)
- {
- if (this.ultraGrid2.Rows[i].Cells["COIL_NO"].Text == rowA.Cells["COIL_NO"].Text)
- {
- rowBs = this.ultraGrid2.Rows[i];
- break;
- }
- }
- string temp = rowBs.Cells["CUR_LOAD_LOC"].Text;
- if (rowBs.Index < this.ultraGrid2.Rows.Count - 1 && this.ultraGrid2.Rows[rowBs.Index + 1].Cells["CUR_LOAD_LOC"].Text == temp)
- {
- rowBs.Delete(false);
- }
- else if (rowBs.Index > 0 && this.ultraGrid2.Rows[rowBs.Index - 1].Cells["CUR_LOAD_LOC"].Text == temp)
- {
- rowBs.Delete(false);
- }
- else
- {
- rowBs.Cells["COIL_NO"].Value = "";
- }
- }
- //插入新记录
- if (rowB.Cells["COIL_NO"].Text == "")
- {
- rowB.Cells["COIL_NO"].Value = rowA.Cells["COIL_NO"].Text;
- }
- else
- {
- Infragistics.Win.UltraWinGrid.UltraGridRow temp = this.ultraGrid2.Rows.Band.AddNew();
- temp.Cells["CUR_LOAD_LOC"].Value = rowB.Cells["CUR_LOAD_LOC"].Value;
- temp.Cells["COIL_NO"].Value = rowA.Cells["COIL_NO"].Value;
- temp.Cells["BESELECT"].Value = false;
- this.ultraGrid2.Rows.Move(temp, rowB.Index + 1);
- this.ultraGrid2.ActiveRow = rowB;
- }
-
- //表A的操作
- //如果同表 添加对应位置记录
- if (sameView == true)
- {
- Infragistics.Win.UltraWinGrid.UltraGridRow rowAs = null;
- for (int i = 0; i < this.ultraGrid1.Rows.Count; i++)
- {
- if (this.ultraGrid1.Rows[i].Cells["CUR_LOAD_LOC"].Text == rowB.Cells["CUR_LOAD_LOC"].Text)
- {
- rowAs = this.ultraGrid1.Rows[i];
- break;
- }
- }
- if (rowAs.Cells["COIL_NO"].Text == "")
- {
- rowAs.Cells["COIL_NO"].Value = rowA.Cells["COIL_NO"].Value;
- }
- else
- {
- Infragistics.Win.UltraWinGrid.UltraGridRow temp = this.ultraGrid1.Rows.Band.AddNew();
- temp.Cells["CUR_LOAD_LOC"].Value = rowB.Cells["CUR_LOAD_LOC"].Value;
- temp.Cells["COIL_NO"].Value = rowA.Cells["COIL_NO"].Value;
- temp.Cells["BESELECT"].Value = false;
- this.ultraGrid1.Rows.Move(temp, rowAs.Index + 1);
- this.ultraGrid1.ActiveRow = rowA;
- }
- }
- //清记录
- string tempYard = rowA.Cells["CUR_LOAD_LOC"].Text;
- if (rowA.Index < this.ultraGrid1.Rows.Count -1 && this.ultraGrid1.Rows[rowA.Index + 1].Cells["CUR_LOAD_LOC"].Text == tempYard)
- {
- rowA.Delete(false);
- }
- else if (rowA.Index > 0 && this.ultraGrid1.Rows[rowA.Index - 1].Cells["CUR_LOAD_LOC"].Text == tempYard)
- {
- rowA.Delete(false);
- }
- else
- {
- rowA.Cells["COIL_NO"].Value = "";
- }
- //重设只读
- dataSet1.Tables[0].Columns["COIL_NO"].ReadOnly = true;
- dataSet1.Tables[0].Columns["CUR_LOAD_LOC"].ReadOnly = true ;
- dataSet2.Tables[0].Columns["COIL_NO"].ReadOnly = true ;
- dataSet2.Tables[0].Columns["CUR_LOAD_LOC"].ReadOnly = true ;
- this.ShowMoveList();
- }
- private void btnBtoA_Click(object sender, EventArgs e)
- {
- Infragistics.Win.UltraWinGrid.UltraGridRow rowA = null;
- Infragistics.Win.UltraWinGrid.UltraGridRow rowB = null;
- //取被选行
- for (int i = 0; i < this.ultraGrid1.Rows.Count; i++)
- {
- if (((bool)this.ultraGrid1.Rows[i].Cells["BESELECT"].Value) == true)
- {
- rowA = this.ultraGrid1.Rows[i];
- }
- }
- for (int i = 0; i < this.ultraGrid2.Rows.Count; i++)
- {
- if (((bool)this.ultraGrid2.Rows[i].Cells["BESELECT"].Value) == true)
- {
- rowB = this.ultraGrid2.Rows[i];
- }
- }
- //数据不全 都不做处理
- if (rowA == null || rowB == null)
- {
- return;
- }
- if (rowB.Cells["COIL_NO"].Text == "")
- {
- return;
- }
- if (rowA.Cells["CUR_LOAD_LOC"].Text == rowB.Cells["CUR_LOAD_LOC"].Text)
- {
- return;
- }
- //加入等待移垛列表
- this.AddMoveList(rowB.Cells["COIL_NO"].Text, rowB.Cells["CUR_LOAD_LOC"].Text, rowA.Cells["CUR_LOAD_LOC"].Text);
- //显示
- //开启可写
- dataSet1.Tables[0].Columns["COIL_NO"].ReadOnly = false;
- dataSet1.Tables[0].Columns["CUR_LOAD_LOC"].ReadOnly = false;
- dataSet2.Tables[0].Columns["COIL_NO"].ReadOnly = false;
- dataSet2.Tables[0].Columns["CUR_LOAD_LOC"].ReadOnly = false;
- //如果表A=表B
- bool sameView = false;
- if (this.ddlKU1.Value == this.ddlKU2.Value && this.ddlKUarea1.Value == this.ddlKUarea2.Value)
- {
- sameView = true;
- }
- //表A的操作
- //如果是同表 把对应的行找出来 并清除
- if (sameView == true)
- {
- Infragistics.Win.UltraWinGrid.UltraGridRow rowAs = null;
- for (int i = 0; i < this.ultraGrid1.Rows.Count; i++)
- {
- if (this.ultraGrid1.Rows[i].Cells["COIL_NO"].Text == rowB.Cells["COIL_NO"].Text)
- {
- rowAs = this.ultraGrid1.Rows[i];
- break;
- }
- }
- string temp = rowAs.Cells["CUR_LOAD_LOC"].Text;
- if (rowAs.Index < this.ultraGrid1.Rows.Count - 1 && this.ultraGrid1.Rows[rowAs.Index + 1].Cells["CUR_LOAD_LOC"].Text == temp)
- {
- rowAs.Delete(false);
- }
- else if (rowAs.Index > 0 && this.ultraGrid1.Rows[rowAs.Index - 1].Cells["CUR_LOAD_LOC"].Text == temp)
- {
- rowAs.Delete(false);
- }
- else
- {
- rowAs.Cells["COIL_NO"].Value = "";
- }
- }
- if (rowA.Cells["COIL_NO"].Text == "")
- {
- rowA.Cells["COIL_NO"].Value = rowB.Cells["COIL_NO"].Text;
- }
- else
- {
- Infragistics.Win.UltraWinGrid.UltraGridRow temp = this.ultraGrid1.Rows.Band.AddNew();
- temp.Cells["CUR_LOAD_LOC"].Value = rowA.Cells["CUR_LOAD_LOC"].Value;
- temp.Cells["COIL_NO"].Value = rowB.Cells["COIL_NO"].Value;
- temp.Cells["BESELECT"].Value = false;
- this.ultraGrid1.Rows.Move(temp, rowA.Index + 1);
- this.ultraGrid1.ActiveRow = rowA;
- }
- //表B的操作
- //如果同表 添加对应位置记录
- if (sameView == true)
- {
- Infragistics.Win.UltraWinGrid.UltraGridRow rowBs = null;
- for (int i = 0; i < this.ultraGrid2.Rows.Count; i++)
- {
- if (this.ultraGrid2.Rows[i].Cells["CUR_LOAD_LOC"].Text == rowA.Cells["CUR_LOAD_LOC"].Text)
- {
- rowBs = this.ultraGrid2.Rows[i];
- break;
- }
- }
- if (rowBs.Cells["COIL_NO"].Text == "")
- {
- rowBs.Cells["COIL_NO"].Value = rowB.Cells["COIL_NO"].Value;
- }
- else
- {
- Infragistics.Win.UltraWinGrid.UltraGridRow temp = this.ultraGrid2.Rows.Band.AddNew();
- temp.Cells["CUR_LOAD_LOC"].Value = rowA.Cells["CUR_LOAD_LOC"].Value;
- temp.Cells["COIL_NO"].Value = rowB.Cells["COIL_NO"].Value;
- temp.Cells["BESELECT"].Value = false;
- this.ultraGrid2.Rows.Move(temp, rowBs.Index + 1);
- this.ultraGrid2.ActiveRow = rowB;
- }
- }
- string tempYard = rowB.Cells["CUR_LOAD_LOC"].Text;
- if (rowB.Index < this.ultraGrid2.Rows.Count - 1 && this.ultraGrid2.Rows[rowB.Index + 1].Cells["CUR_LOAD_LOC"].Text == tempYard)
- {
- rowB.Delete(false);
- }
- else if (rowB.Index > 0 && this.ultraGrid2.Rows[rowB.Index - 1].Cells["CUR_LOAD_LOC"].Text == tempYard)
- {
- rowB.Delete(false);
- }
- else
- {
- rowB.Cells["COIL_NO"].Value = "";
- }
- //重设只读
- dataSet1.Tables[0].Columns["COIL_NO"].ReadOnly = true;
- dataSet1.Tables[0].Columns["CUR_LOAD_LOC"].ReadOnly = true;
- dataSet2.Tables[0].Columns["COIL_NO"].ReadOnly = true;
- dataSet2.Tables[0].Columns["CUR_LOAD_LOC"].ReadOnly = true;
- this.ShowMoveList();
- }
- private void ddlKU1_ValueChanged(object sender, EventArgs e)
- {
- this.ddlKUarea1.Items.Clear();
- if (this.ddlKU1.SelectedIndex == 0)
- {
- ddlKUarea1.Items.AddRange(this.areaList3);
- ddlKUarea1.SelectedIndex = 0;
- }
- else if (this.ddlKU1.SelectedIndex == 1)
- {
- ddlKUarea1.Items.AddRange(this.areaList4);
- ddlKUarea1.SelectedIndex = 0;
- }
- else if (this.ddlKU1.SelectedIndex == 2)
- {
- ddlKUarea1.Items.AddRange(this.areaList5);
- ddlKUarea1.SelectedIndex = 0;
- }
- }
- private void ddlKU2_ValueChanged(object sender, EventArgs e)
- {
- this.ddlKUarea2.Items.Clear();
- if (this.ddlKU2.SelectedIndex == 0)
- {
- ddlKUarea2.Items.AddRange(this.areaList3);
- ddlKUarea2.SelectedIndex = 0;
- }
- else if (this.ddlKU2.SelectedIndex == 1)
- {
- ddlKUarea2.Items.AddRange(this.areaList4);
- ddlKUarea2.SelectedIndex = 0;
- }
- else if (this.ddlKU2.SelectedIndex == 2)
- {
- ddlKUarea2.Items.AddRange(this.areaList5);
- ddlKUarea2.SelectedIndex = 0;
- }
- }
- private void UIM010250_Load(object sender, EventArgs e)
- {
- this.ddlKU1.SelectedIndex = 0;
- this.ddlKU2.SelectedIndex = 0;
- }
- private void ultraGrid1_ClickCell(object sender, Infragistics.Win.UltraWinGrid.ClickCellEventArgs e)
- {
- if (e.Cell != e.Cell.Row.Cells["BESELECT"])
- {
- return;
- }
- bool temp = (bool)e.Cell.Value;
- for (int i = 0; i < this.ultraGrid1.Rows.Count; i++)
- {
- this.ultraGrid1.Rows[i].Cells["BESELECT"].Value = false;
- }
- e.Cell.Value = temp;
- return;
- }
- private void ultraGrid2_ClickCell(object sender, Infragistics.Win.UltraWinGrid.ClickCellEventArgs e)
- {
- if (e.Cell != e.Cell.Row.Cells["BESELECT"])
- {
- return;
- }
- bool temp = (bool)e.Cell.Value;
- for (int i = 0; i < this.ultraGrid2.Rows.Count; i++)
- {
- this.ultraGrid2.Rows[i].Cells["BESELECT"].Value = false;
- }
- e.Cell.Value = temp;
- return;
- }
- private void ddlKUarea1_ValueChanged(object sender, EventArgs e)
- {
- DoQuerryLoad(1);
- }
- private void ddlKUarea2_ValueChanged(object sender, EventArgs e)
- {
- DoQuerryLoad(2);
- }
- }
- //-----------------
- /// <summary>
- /// 移垛用的节点
- /// </summary>
- public class MoveYardListNode
- {
- public MoveYardListNode(string CoilNo, string YardNow, string YardTo)
- {
- coilNo = CoilNo;
- yardNow = YardNow;
- yardTo = YardTo;
- }
- public string coilNo;
- public string yardNow;
- public string yardTo;
- }
- //--------------------
- /// <summary>
- /// 从CCP返回值中取得数据的方法集
- /// FLZ 2011-8-31
- /// 写在UIM010250下 因为我没有权把它加到项目工程目录中
- /// </summary>
- static class HashTableReadTest
- {
- /// <summary>
- /// 取得包含有CCP返回对象的内容的字符串 test用
- /// </summary>
- /// <param name="obj">CCP返回对象</param>
- /// <returns>包含有CCP返回对象的内容的字符串</returns>
- static public string WhatinIt(object obj)
- {
- try
- {
- string str = obj.GetType().ToString();
- if (str != "System.Collections.ArrayList")
- {
- Exception e = new Exception("类型不符!");
- }
- else
- {
- str = null;
- }
- System.Collections.ArrayList lev0 = (System.Collections.ArrayList)obj;
- str += "level0: count:" + lev0.Count.ToString() + "\n";
- for (int i = 0; i < lev0.Count; i++)
- {
- str += i.ToString() + ":" + lev0[i].GetType().ToString() + "\n";
- str += Keys(lev0[i]);
- }
- //System.Collections.ArrayList
- return str;
- }
- catch (Exception e)
- {
- string str = "error!\n" + e.ToString() + "\n";
- return str;
- }
- //return "error!\n code:-1";
- }
- /// <summary>
- /// 把哈希表的KEY与VALUE输出到字符串 test用
- /// </summary>
- /// <param name="obj">哈希表</param>
- /// <returns>包含有哈希表内容的字符串</returns>
- static private string Keys(object obj)
- {
- System.Collections.Hashtable objHasTab = (System.Collections.Hashtable)obj;
- string str = null;
- foreach (System.Collections.DictionaryEntry objDE in objHasTab)
- {
- str += objDE.Key.ToString() + "\n";
- if (objDE.Value.GetType().ToString() == "System.Collections.Hashtable")
- {
- str += Keys(objDE.Value);
- }
- else
- {
- str += " " + objDE.Value.ToString() + "\n";
- }
- }
- return str;
- }
- /// <summary>
- /// 取得CCP返回对象的某一行数据的方法
- /// </summary>
- /// <param name="obj">CCP的返回对象</param>
- /// <param name="i">行号</param>
- /// <returns>对应行的哈希表;如果出错,抛出“error”加错误编号的异常</returns>
- static public System.Collections.Hashtable GetHastabinArray(object obj, int i)
- {
- try
- {
- if (obj.GetType().ToString() == "System.Collections.ArrayList")
- {
- System.Collections.ArrayList objLIST = (System.Collections.ArrayList)obj;
- if (i >= objLIST.Count || i < 0)
- {
- Exception e = new Exception("(0)");
- throw e;
- }
- object r = objLIST[i];
- return (System.Collections.Hashtable)r;
- }
- else
- {
- Exception e = new Exception("(-1)");
- throw e;
- }
- }
- catch (Exception e)
- {
- string str = "error" + e.ToString();
- Exception re = new Exception(str);
- }
- return null;
- }
- /// <summary>
- /// 取得CCP返回对象的某一行数据的不会抛异常的方法
- /// </summary>
- /// <param name="obj">CCP的返回对象</param>
- /// <param name="i">行号</param>
- /// <returns>对应的哈希表.如果出错,返回NULL(如果这一行为NULL,也会返回NULL.要区别这种情况请用有异常返回的方法)</returns>
- static public System.Collections.Hashtable GetHastabinArrayNoEx(object obj, int i)
- {
- try
- {
- if (obj.GetType().ToString() == "System.Collections.ArrayList" && obj != null)
- {
- System.Collections.ArrayList objLIST = (System.Collections.ArrayList)obj;
- if (i >= objLIST.Count || i < 0)
- {
- return null;
- }
- object r = objLIST[i];
- return (System.Collections.Hashtable)r;
- }
- else
- {
- return null;
- }
- }
- catch (Exception e)
- {
- string str = "error:" + e.ToString();
- Exception re = new Exception(str);
- }
- return null;
- }
- /// <summary>
- /// 得到哈希表中的某一KEY值中的内容,如果其内容为哈希表,取该表的第一项内容
- /// </summary>
- /// <param name="hastab">要分析 的哈希表</param>
- /// <param name="keyname">键名</param>
- /// <returns>内容物。如果基内容为哈希表,取该表的第一项内容;后同</returns>
- static public object GetValueinHasTab(System.Collections.Hashtable hastab, string keyname)
- {
- try
- {
- object r = null;
- if (keyname == null)
- {
- foreach (System.Collections.DictionaryEntry objDE in hastab)
- {
- r = objDE.Value;
- if (r.GetType().ToString() == "System.Collections.Hashtable")
- {
- r = GetValueinHasTab((System.Collections.Hashtable)r, null);
- }
- break;
- }
- }
- else if (hastab.Contains(keyname))
- {
- r = hastab[keyname];
- if (r.GetType().ToString() == "System.Collections.Hashtable")
- {
- r = GetValueinHasTab((System.Collections.Hashtable)r, null);
- }
- }
- else
- {
- Exception e = new Exception("0");
- }
- return r;
- }
- catch (Exception e)
- {
- string str = "error in GetValueinHasTab:error code" + e.ToString();
- Exception re = new Exception(str);
- }
- return null;
- }
- /// <summary>
- /// 得到哈希表的所有KEY的名字。
- /// </summary>
- /// <param name="hastab">要分析的哈希表</param>
- /// <param name="output">要把KEY名输出的链表</param>
- /// <returns>是否成功</returns>
- static public bool GetKeys(System.Collections.Hashtable hastab, List<string> output)
- {
- try
- {
- output.Clear();
- foreach (System.Collections.DictionaryEntry objDE in hastab)
- {
- output.Add(objDE.Key.ToString());
- }
- return true;
- }
- catch
- {
- return false;
- }
- }
- }
- }
|