| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using CoreFS.CA06;
- using System.Collections;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Control;
- using Infragistics.Win.UltraWinGrid;
- using Core.StlMes.Client.YdmPipeManage.Controls;
- using Core.Mes.Client.Comm.Tool;
- using Infragistics.Win;
- using Core.StlMes.Client.YdmPipeManage.Tool;
- using Core.StlMes.Client.YdmBase;
- namespace Core.StlMes.Client.YdmPipeManage
- {
- public partial class frmPipeStow : FrmBase
- {
- ArrayList pram = new ArrayList();
- private int isSelect = 0;//新增
- public frmPipeStow()
- {
- InitializeComponent();
- }
- private void frmPipeStow_Load(object sender, EventArgs e)
- {
- //StorInfo();
- Init();
- ultraGrid3.Enabled = false;
- //doQuery();
- this.chkMaterial.Visible = false;
- BaseMethod.InitStorage(cmbWarehous, CustomInfo, this.ValidDataPurviewIds, this.ob);
- }
- /// <summary>
- /// 重写基类方法
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="ToolbarKey"></param>
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "Query":
- if(!CheckQuery())return;
- doQuery();
- break;
- case "Add":
- doSave();
- break;
- case"Refresh":
- doRefresh();
- break;
- case "Export":
- GridHelper.ulGridToExcel(ultraGrid4, "倒垛历史实绩");
- break;
- case "Close":
- this.Close();
- break;
- }
- }
- /// <summary>
- /// 绑定仓库号
- /// </summary>
- private void StorInfo()
- {
- ArrayList arList = new ArrayList();
- //获取用户对应科室ID
- string User = this.UserInfo.GetDeptid();
- string StorageType = "";//根据传递的参数获取仓库类别
- string StorageAttr = "";////根据传递的参数获取仓库类型
- if (CustomInfo != "")
- {
- string[] strflg = CustomInfo.ToString().Split(new char[] { ',' });
- StorageType = strflg[0];
- StorageAttr = strflg[1];
- }
- pram.Clear();
- pram.Add(StorageType);
- pram.Add(StorageAttr);
- pram.Add(User);
- PipeManageClass.BindComBaseInfo(pram, cmbWarehous, ob);
- }
- /// <summary>
- /// 绑定原料位号下拉框
- /// </summary>
- private void Init()
- {
- //绑定料位号
- string strStorage = "";
- if (cmbWarehous.SelectedIndex != -1)
- {
- strStorage = cmbWarehous.Value.ToString();
- }
- pram.Clear();
- pram.Add(strStorage);
- PipeManageClass.BindLocationInfo(pram, cmbMaterialEid, ob);
- }
- private void doQuery()
- {
- string strWare = "";//仓库号
- string strMat = "";//料位号
- string strFurnace = "";
- string strBatch = "";
- if (chkWarehous.Checked)
- {
- strWare = cmbWarehous.Value.ToString();
- }
- if (chkMaterial.Checked)
- {
- strMat = cmbMaterialEid.Value.ToString();
- }
-
- if (chkFurnace.Checked)
- {
- strFurnace = txtFurnace.Text.Trim();
- }
- if (chkBatch.Checked)
- {
- strBatch = txtBatch.Text.Trim();
- }
- pram.Clear();
- pram.Add(strWare);
- pram.Add(strMat);
- pram.Add(strFurnace);
- //pram.Add(strBatch);
- //pram.Add(txtGroup.Text.Trim());
- //pram.Add(this.UserInfo.GetUserName());
- string[] arr = BaseMethod.WarehousePermissions(CustomInfo,this.ValidDataPurviewIds,this.ob);
- if (ultraTabControl1.SelectedTab.Key.Equals("0"))
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmPipeStow.queryStorage", new object[] { pram, arr }, ob);
- GridHelper.CopyDataToDatatable(dt, this.dataStorage, true);
- GridHelper.RefreshAndAutoSize(ultraGrid1);
- }
- else
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmPipeStow.queryStowList", new object[] { pram, arr }, ob);
- GridHelper.CopyDataToDatatable(dt, this.dataStowList, true);
- GridHelper.RefreshAndAutoSize(ultraGrid4);
- }
- }
- /// <summary>
- /// 保存,新增
- /// </summary>
- private void doSave()
- {
- //需对倒垛历史表进行插入、对位置表进行删除
- ultraGrid3.UpdateData();
- int count = 0;
- UltraGridRow ugr1 = this.ultraGrid1.ActiveRow;
- UltraGridRow ugr3 = this.ultraGrid3.ActiveRow;
- UltraGridRow ugr2 = this.ultraGrid2.ActiveRow;
- string loactionNo = "";
- if (ugr3 == null||isSelect==0)
- {
- MessageUtil.ShowTips("请输入您要操作的记录!");
- return;
- }
- if (MessageUtil.ShowYesNoAndQuestion("是否确认倒垛?") == DialogResult.No)
- {
- return;
- }
- foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid3.Rows)
- {
- if (Convert.ToBoolean(uRow.Cells["CHOOSE"].Text) == true)
- {
- string strLocat=uRow.Cells["LOCATION_NO"].Text.Trim();
- if (strLocat == "")
- {
- MessageUtil.ShowTips("目标料位不能为空!");
- return;
- }
- if (ugr2.Cells["LOCATION_NO"].Text.Trim() == strLocat)
- {
- MessageUtil.ShowTips("目标料位与当前料位一致,请重新输入!");
- return;
- }
- if (uRow.Cells["ACT_COUNT"].Value.ToString() == "0" || uRow.Cells["ACT_COUNT"].Value.ToString() == "")
- {
- MessageUtil.ShowTips("目标支数不能为空或零!");
- return;
- }
- pram.Clear();
- pram.Add(ugr1.Cells["storage_no"].Text.Trim());
- pram.Add(ugr1.Cells["JUDGE_STOVE_NO"].Text.Trim());
- pram.Add(ugr1.Cells["BATCH_NO"].Text.Trim());
- pram.Add(ugr1.Cells["BATCH_GROUD_NO"].Text.Trim());
- pram.Add(ugr2.Cells["LOCATION_NO"].Text.Trim());
- pram.Add(uRow.Cells["ACT_COUNT"].Text.Trim());
- pram.Add(uRow.Cells["LOCATION_NO"].Text.Trim());
- pram.Add(this.UserInfo.GetUserOrder());
- pram.Add(this.UserInfo.GetUserGroup());
- pram.Add(this.UserInfo.GetUserName());
- pram.Add(UserInfo.GetDeptid());
- pram.Add(UserInfo.GetDepartment());
- loactionNo = this.ultraGrid3.ActiveRow.Cells["LOCATION_NO"].Text.ToString();
- string departMentNo = ClsBaseInfo.GetDepartIdBySectionId(UserInfo.GetDeptid(), this.ob);
- string departMent = ClsBaseInfo.GetDepartBySectionId(UserInfo.GetDeptid(), this.ob);
- pram.Add(departMentNo);
- pram.Add(departMent);
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.ydm.pipemanage.FrmPipeStow";
- ccp.MethodName = "addPipeSwtow";
- ccp.ServerParams = new object[] { pram };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode == -1)
- {
- return;
- }
- count += 1;
- //count = ServerHelper.SetData("com.steering.pss.ydm.pipemanage.FrmPipeStow.addPipeSwtow", new object[] { pram }, ob);
- }
- }
- if (count > 0)
- {
- MessageUtil.ShowTips("倒垛成功!");
- }
- QueryOutList();
- doQuery();
- YdmBaseClass.Postioning(this.ultraGrid1, "LOCATION_NO", loactionNo);
- }
- private void doRefresh()
- {
- StorInfo();
- Init();
- ultraGrid2.UpdateData();
- UltraGridRow ugr = this.ultraGrid2.ActiveRow;
- if (this.ultraGrid2.Rows.Count <= 0) return;
- if (ugr == null) return;
- if (ugr.IsFilterRow) return;
- if (ugr.HasParent() == true) return;
- pram.Clear();
- pram.Add(ugr.Cells["storage_no"].Text.ToString());
- PipeManageClass.BindLocationInfo(pram, cmbMaterialEid, ob);
- }
- private void QueryOutList()
- {
- ultraGrid1.UpdateData();
- UltraGridRow ugr = this.ultraGrid1.ActiveRow;
- if (this.ultraGrid1.Rows.Count <= 0) return;
- if (ugr == null) return;
- if (ugr.IsFilterRow) return;
- if (ugr.HasParent() == true) return;
- string strMat = "";
- if (cmbWarehous.SelectedIndex != -1)
- {
- strMat = cmbWarehous.Value.ToString();
- }
- pram.Clear();
- pram.Add(ugr.Cells["STORAGE_NO"].Value.ToString());
- pram.Add(ugr.Cells["judge_stove_no"].Text.ToString());
- pram.Add(ugr.Cells["batch_no"].Text.ToString());
- //pram.Add(ugr.Cells["batch_groud_no"].Text.ToString());
- pram.Add(ugr.Cells["LOCATION_NO"].Text.ToString());
- DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmPipeStow.queryStow", new object[] { pram }, ob);
- GridHelper.CopyDataToDatatable(dt, this.dataStow, true);
- GridHelper.RefreshAndAutoSize(ultraGrid2);
- }
- private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
- {
- QueryOutList();
- }
- private void ultraGrid2_AfterRowActivate(object sender, EventArgs e)
- {
- ultraGrid2.UpdateData();
- UltraGridRow ugr = this.ultraGrid2.ActiveRow;
- if (this.ultraGrid2.Rows.Count <= 0) return;
- if (ugr == null)
- {
- ultraGrid3.Enabled = false;
- return;
- }
- else
- {
- ultraGrid3.Enabled = true;
- }
- if (ugr.IsFilterRow) return;
- if (ugr.HasParent() == true) return;
- DataTable dt = new DataTable();
- pram.Clear();
- pram.Add(ugr.Cells["storage_no"].Text.ToString());
- //pram.Add(ugr.Cells["LOCATION_NO"].Text.ToString());
- //DataTable dtLond = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmPipeStow.queryLocaTarget", new object[] { pram }, ob);
- //cmbMaterialEid.DataSource = dtLond;
- //cmbMaterialEid.ValueMember = "LOCATION_NO";
- PipeManageClass.BindLocationInfo(pram, cmbMaterialEid, ob);
- GridHelper.CopyDataToDatatable(dt, this.dataTable1, true);
- }
- /// <summary>
- /// 验证Checked是否勾选,显示控件可编辑 打勾表示可编辑,不打勾表示不可编辑
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void chk_CheckedChanged(object sender, EventArgs e)
- {
- if (chkWarehous.Checked) { cmbWarehous.Enabled = true; } else { cmbWarehous.Enabled = false; }
- if (chkMaterial.Checked) { cmbMaterialEid.Enabled = true; } else { cmbMaterialEid.Enabled = false; }
- if (chkFurnace.Checked) { txtFurnace.Enabled = true; } else { txtFurnace.Enabled = false; }
- if (chkBatch.Checked) { txtBatch.Enabled = true; } else { txtBatch.Enabled = false; }
- if (chkGroup.Checked) { txtGroup.Enabled = true; } else { txtGroup.Enabled = false; }
- }
- private void cmbWarehous_TextChanged(object sender, EventArgs e)
- {
- Init();
- }
- ///查询时验证必填项
- private bool CheckQuery()
- {
- if (chkWarehous.Checked && string.IsNullOrEmpty(cmbWarehous.Text.Trim()))
- {
- MessageBox.Show("请选择仓库号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return false;
- }
- if (chkMaterial.Checked && string.IsNullOrEmpty(cmbMaterialEid.Text.Trim()))
- {
- MessageBox.Show("请选择料位号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return false;
- }
- if (chkFurnace.Checked && string.IsNullOrEmpty(txtFurnace.Text.Trim()))
- {
- MessageBox.Show("请输入炉号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return false;
- }
- if (chkBatch.Checked && string.IsNullOrEmpty(txtBatch.Text.Trim()))
- {
- MessageBox.Show("请输入批号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return false;
- }
- if (chkGroup.Checked && string.IsNullOrEmpty(txtGroup.Text.Trim()))
- {
- MessageBox.Show("请输入组号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return false;
- }
- return true;
- }
- /// <summary>
- /// 对录入支数进行判断
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void ultraGrid3_CellChange(object sender, CellEventArgs e)
- {
- ultraGrid2.UpdateData();
- ultraGrid3.UpdateData();
- UltraGridRow ugr = this.ultraGrid2.ActiveRow;
- UltraGridRow ugr1 = this.ultraGrid3.ActiveRow;
- string plannum = ugr.Cells["ACT_COUNT"].Value.ToString();//当前料位支数
- if (e.Cell.Column.Key.Equals("ACT_COUNT"))
- {
- double strCount = 0;
- foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid3.Rows)
- {
- if (uRow.Cells["ACT_COUNT"].Value.ToString()=="")
- {
- uRow.Cells["ACT_COUNT"].Value = "0";
- }
- if (Convert.ToBoolean(uRow.Cells["CHOOSE"].Text) == true)
- {
- strCount += double.Parse(uRow.Cells["ACT_COUNT"].Value.ToString());//目标料位支数
- }
- }
- if (strCount.ToString() != "" && strCount.ToString() != "0")
- {
- if (Convert.ToInt32(strCount.ToString()) > Convert.ToInt32(plannum))
- {
- MessageUtil.ShowWarning("目标料位支数不能大于当前料位支数!");
- ugr1.Cells["ACT_COUNT"].Value = "";
- return;
- }
- }
- }
- if (e.Cell.Column.Key.Equals("CHOOSE"))
- {
- if (Convert.ToBoolean(e.Cell.Value))
- {
- isSelect += 1;
- }
- else
- isSelect -= 1;
- }
- if (e.Cell.Column.Key.Equals("AREA_NO"))
- {
- this.ultraGrid3.ActiveRow.Cells["LOCATION_NO"].Value = this.ultraGrid1.ActiveRow.Cells["STORAGE_NO"].Text.Trim() + this.ultraGrid3.ActiveRow.Cells["AREA_NO"].Text.Trim() + this.ultraGrid3.ActiveRow.Cells["ROW_NO"].Text.Trim() + this.ultraGrid3.ActiveRow.Cells["COL_NO"].Text.Trim();
- }
- if (e.Cell.Column.Key.Equals("ROW_NO"))
- {
- this.ultraGrid3.ActiveRow.Cells["LOCATION_NO"].Value = this.ultraGrid1.ActiveRow.Cells["STORAGE_NO"].Text.Trim() + this.ultraGrid3.ActiveRow.Cells["AREA_NO"].Text.Trim() + this.ultraGrid3.ActiveRow.Cells["ROW_NO"].Text.Trim() + this.ultraGrid3.ActiveRow.Cells["COL_NO"].Text.Trim();
- }
- if (e.Cell.Column.Key.Equals("COL_NO"))
- {
- this.ultraGrid3.ActiveRow.Cells["LOCATION_NO"].Value = this.ultraGrid1.ActiveRow.Cells["STORAGE_NO"].Text.Trim() + this.ultraGrid3.ActiveRow.Cells["AREA_NO"].Text.Trim() + this.ultraGrid3.ActiveRow.Cells["ROW_NO"].Text.Trim() + this.ultraGrid3.ActiveRow.Cells["COL_NO"].Text.Trim();
- }
- }
- private void frmPipeStow_Shown(object sender, EventArgs e)
- {
- toolMenu.Toolbars[0].Tools["Export"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- private void ultraTabControl1_SelectedTabChanged(object sender, Infragistics.Win.UltraWinTabControl.SelectedTabChangedEventArgs e)
- {
- if (toolMenu == null) return;
- if (e.Tab.TabControl.SelectedTab.Key.Equals("0"))
- {
- toolMenu.Toolbars[0].Tools["Export"].InstanceProps.Visible = DefaultableBoolean.False;
- toolMenu.Toolbars[0].Tools["Add"].InstanceProps.Visible = DefaultableBoolean.True;
- }
- else
- {
- toolMenu.Toolbars[0].Tools["Export"].InstanceProps.Visible = DefaultableBoolean.True;
- toolMenu.Toolbars[0].Tools["Add"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- }
- private void ultraGrid3_InitializeRow(object sender, InitializeRowEventArgs e)
- {
- if (!Convert.ToBoolean(e.Row.Cells["CHOOSE"].Value))
- {
- for (int i = 0; i < e.Row.Cells.Count; i++)
- {
- if (!e.Row.Cells[i].Column.Key.Equals("CHOOSE"))
- e.Row.Cells[i].Activation = Activation.ActivateOnly;
- }
- }
- else
- {
- for (int i = 0; i < e.Row.Cells.Count; i++)
- {
- e.Row.Cells[i].Activation = Activation.AllowEdit;
- }
- }
- }
- private void txtFurnace_KeyDown(object sender, KeyEventArgs e)
- {
- if (e.KeyValue == 13)
- {
- doQuery();
- }
- }
- }
- }
|