| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383 |
- 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.Server;
- using CoreFS.CA06;
- using System.Collections;
- using Core.Mes.Client.Comm.Control;
- using Infragistics.Win.UltraWinGrid;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.Mcp.Control;
- using com.steering.mes.mcp.entity;
- using Core.Mes.Client.Comm.Format;
- using Core.StlMes.Client.Mcp.Control.Base;
- using Infragistics.Win;
- namespace Core.StlMes.Client.Mcp.Report
- {
- public partial class FrmJGMatReport : FrmBase
- {
- public FrmJGMatReport()
- {
- InitializeComponent();
- this.IsLoadUserView = true;
- }
- private void FrmJGMatReport_Load(object sender, EventArgs e)
- {
- EntityHelper.ShowGridCaption<CouplingMatButtressEntity>(ultraGrid1.DisplayLayout.Bands[0]);
- EntityHelper.ShowGridCaption<CouplingMatButtressEntity>(ultraGrid2.DisplayLayout.Bands[0]);
- EntityHelper.ShowGridCaption<CouplingMatButtressEntity>(ultraGrid4.DisplayLayout.Bands[0]);
- EntityHelper.ShowGridCaption<CouplingMatButtressEntity>(ultraGrid5.DisplayLayout.Bands[0]);
- EntityHelper.ShowGridCaption<PlnZyJgMiddleEntity>(ultraGrid3.DisplayLayout.Bands[0]);
- DateTime t = DateTime.Now;
- DateTime t1 = new DateTime(t.Year, t.Month, 1);
- RegStartTime.Value = DateTime.Parse(t1.ToString("yyyy-MM-dd 00:00:00"));
- RegEndTime.Value = DateTime.Parse(t1.AddMonths(1).AddDays(-1).ToString("yyyy-MM-dd 23:59:59"));
- //框号
- DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.Report.FrmJGMatNoReport.getKepNo", null, this.ob);
- cmbMaterial.DataSource = dt;
- cmbMaterial.DisplayMember = "KEP_NO";
- PipeManageClass.SetComboItemHeight(cmbMaterial);
- String[] str = this.ValidDataPurviewIds;
- 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];
- }
- DataTable dt1 = ServerHelper.GetData("com.steering.mes.mcp.common.WarehousePermissions.getStoreNo", new object[] { StorageType, StorageAttr, str }, this.ob);
- cmbWarehous.DataSource = dt1;
- cmbWarehous.DisplayMember = "STORAGE_NAME";
- cmbWarehous.ValueMember = "STORAGE_NO";
- PipeManageClass.SetComboItemHeight(cmbWarehous);
-
- }
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "Query":
- doQuery();
- break;
- case "Extinction":
- Extinction();
- break;
- case "doUpdate":
- doUpdate();
- break;
- case "Export":
- if (ultraTabControl1.SelectedTab.Key.Equals("0"))
- {
- GridHelper.ulGridToExcel(ultraGrid4, "库存信息");
- }
- else if (ultraTabControl1.SelectedTab.Key.Equals("1"))
- {
- GridHelper.ulGridToExcel(ultraGrid1, "库存信息");
- }
- else if (ultraTabControl1.SelectedTab.Key.Equals("2"))
- {
- GridHelper.ulGridToExcel(ultraGrid5, "库存信息");
- }
- break;
- case "Close":
- this.Close();
- break;
- }
- }
- /// <summary>
- /// 消亡
- /// </summary>
- private void Extinction()
- {
- this.ultraGrid1.UpdateData();
- IQueryable<UltraGridRow> checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
- if (checkMagRows.Count() == 0)
- {
- MessageUtil.ShowTips("请选择需要消亡的信息!");
- return;
- }
- ArrayList parm = new ArrayList();
- foreach (UltraGridRow uRow in checkMagRows)
- {
- CouplingMatButtressEntity matButtress = (CouplingMatButtressEntity)uRow.ListObject;
- string matButtressTity = JSONFormat.Format(matButtress);
- parm.Add(matButtressTity);
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.mcp.Report.FrmJGMatNoReport";
- ccp.MethodName = "Extinction";
- ccp.ServerParams = new object[] { parm, UserInfo.GetUserName()};
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("消亡成功!"))
- {
- doQuery();
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- /// <summary>
- /// 修改物料
- /// </summary>
- private void doUpdate()
- {
- this.ultraGrid1.UpdateData();
- IQueryable<UltraGridRow> checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
- if (checkMagRows.Count() == 0)
- {
- MessageUtil.ShowTips("请选择需要修改物料的信息!");
- return;
- }
- ArrayList parm = new ArrayList();
- foreach (UltraGridRow uRow in checkMagRows)
- {
- CouplingMatButtressEntity matButtress = (CouplingMatButtressEntity)uRow.ListObject;
- string matButtressTity = JSONFormat.Format(matButtress);
- parm.Add(matButtressTity);
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.mcp.Report.FrmJGMatNoReport";
- ccp.MethodName = "doUpdate";
- ccp.ServerParams = new object[] { parm };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("修改成功!"))
- {
- doQuery();
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- /// <summary>
- /// 查询
- /// </summary>
- private void doQuery()
- {
- if (!CheckQuery()) return;
- string strRegStart = "";
- string strRegEnd = "";
- string strWare = "";//仓库号
- //string strMat = "";//框号
- string strFurnace = "";//炉号
- string strBatch = "";//批号
- string strWoid = "";//工单号
- string qcmStaus = ""; //交货状态
- ArrayList pram = new ArrayList();
- if (chkWarehous.Checked)
- {
- strWare = cmbWarehous.Value.ToString();
- }
- //if (chkMaterial.Checked)
- //{
- // strMat = cmbMaterial.Value.ToString();
- //}
- if (chkRegTime.Checked)
- {
- strRegStart = RegStartTime.Value.ToString();
- strRegEnd = RegEndTime.Value.ToString();
- }
- else
- {
- strRegStart = "1";
- }
- if (chkFurnace.Checked)
- {
- strFurnace = txtFurnace.Text.Trim();
- }
- if (chkBatch.Checked)
- {
- strBatch = txtBatch.Text.Trim();
- }
- if (chkQcmStaus.Checked)
- {
- qcmStaus = cmbQcmStaus.Text.Trim();
- }
- pram.Add(strWare);
- pram.Add("");
- pram.Add(strFurnace);
- pram.Add(strRegStart);
- pram.Add(strRegStart);
- pram.Add(strRegStart);
- pram.Add(strRegEnd);
- pram.Add(strRegEnd);
- pram.Add(strBatch);
- pram.Add(qcmStaus);
- //DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.Report.FrmJGMatNoReport.doQueryInfoResult", new object[] { pram }, ob);
- //GridHelper.CopyDataToDatatable(dt, this.dateMat, true);
- List<CouplingMatButtressEntity> listSource = EntityHelper.GetData<CouplingMatButtressEntity>
- ("com.steering.mes.mcp.Report.FrmJGMatNoReport.getQueryCouplingMatTogether", new object[] { pram }, this.ob);
- bindingSource1.DataSource = listSource;
- GridHelper.RefreshAndAutoSize(ultraGrid4);
- List<CouplingMatButtressEntity> listSource1 = EntityHelper.GetData<CouplingMatButtressEntity>
- ("com.steering.mes.mcp.Report.FrmJGMatNoReport.getQueryCouplingMat", new object[] { pram }, this.ob);
- CouplingMatButtEntitybindingSource1.DataSource = listSource1;
- GridHelper.RefreshAndAutoSize(ultraGrid1);
- List<CouplingMatButtressEntity> listSource2 = EntityHelper.GetData<CouplingMatButtressEntity>
- ("com.steering.mes.mcp.Report.FrmJGMatNoReport.getQueryCouplingMat2", new object[] { pram }, this.ob);
- bindingSource2.DataSource = listSource2;
- GridHelper.RefreshAndAutoSize(ultraGrid5);
- }
- private void chkRegTime_CheckedChanged(object sender, EventArgs e)
- {
- if (chkBatch.Checked) { txtBatch.Enabled = true; } else { txtBatch.Enabled = false; }
- if (chkWarehous.Checked) { cmbWarehous.Enabled = true; } else { cmbWarehous.Enabled = false; }
- if (chkMaterial.Checked) { cmbMaterial.Enabled = true; } else { cmbMaterial.Enabled = false; }
- if (chkFurnace.Checked) { txtFurnace.Enabled = true; } else { txtFurnace.Enabled = false; }
- if (chkRegTime.Checked) { RegStartTime.Enabled = true; RegEndTime.Enabled = true; }
- else
- {
- RegStartTime.Enabled = false; RegEndTime.Enabled = false;
- }
- }
- ///查询时验证必填项
- private bool CheckQuery()
- {
- if (DataTimeUtil.JudgeTime(DateTime.Parse(RegStartTime.Value.ToString()), DateTime.Parse(RegEndTime.Value.ToString())) == 0)
- {
- MessageUtil.ShowTips("开始时间不能大于结束时间!");
- 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 (chkWarehous.Checked && string.IsNullOrEmpty(cmbWarehous.Text.Trim()))
- {
- MessageBox.Show("请选择仓库号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return false;
- }
- if (chkMaterial.Checked && string.IsNullOrEmpty(cmbMaterial.Text.Trim()))
- {
- MessageBox.Show("请选择框号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return false;
- }
- return true;
- }
- private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
- {
- UltraGridRow urg = ultraGrid1.ActiveRow;
- if (urg == null) return;
- string woid = urg.Cells["WoId"].Text;
- string matNo = urg.Cells["MatNo"].Text;
- string judgeNo = urg.Cells["JudgeStoveNo"].Text;
- //查询框号信息
- getQueryLocation(matNo);
- //查询合同相关信息
- getQueryOrder(woid,judgeNo);
- }
- //查询框号信息
- public void getQueryLocation(string matNo)
- {
- List<CouplingMatButtressEntity> listSource1 = EntityHelper.GetData<CouplingMatButtressEntity>
- ("com.steering.mes.mcp.Report.FrmJGMatNoReport.getQueryLocation", new object[] { matNo }, this.ob);
- CouplingButtbindingSource1.DataSource = listSource1;
- GridHelper.RefreshAndAutoSize(ultraGrid2);
- }
- //查询合同相关信息
- public void getQueryOrder(string woid,string judgeNo)
- {
- List<PlnZyJgMiddleEntity> listSource1 = EntityHelper.GetData<PlnZyJgMiddleEntity>
- ("com.steering.mes.mcp.Report.FrmJGMatNoReport.getQueryOrder", new object[] { woid,judgeNo }, this.ob);
- PlnZyJgMiddlebindingSource1.DataSource = listSource1;
- GridHelper.RefreshAndAutoSize(ultraGrid3);
- }
- private void ultraGrid1_AfterSelectChange(object sender, AfterSelectChangeEventArgs e)
- {
- foreach (UltraGridRow uRow in ultraGrid1.Selected.Rows)
- {
- if (uRow.GetType() != typeof(UltraGridGroupByRow))
- {
- uRow.Cells["CHK"].Value = true;
- }
- }
- }
- private void ultraTextEditor1_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
- {
- this.ultraGrid1.UpdateData();
- DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.Report.FrmJGMatNoReport.getBaseMaterialForChoose",
- new object[] { }, ob);
- dt.Columns["BASENAME"].Caption = "物料名称";
- BaseInfoPopup baseInfo = new BaseInfoPopup(dt, "BASENAME", "BASECODE");
- baseInfo.Shown += new EventHandler((a, b) =>
- {
- var actRow = baseInfo.UltraGrid1.Rows.AsQueryable().Where(
- c => c.GetValue("BASECODE") == this.cmbMaterial.Tag.ToString2()).FirstOrDefault();
- if (actRow != null) actRow.Activate();
- });
- if (baseInfo.ShowDialog() == System.Windows.Forms.DialogResult.OK)
- {
- //cmbLocationNo.Tag = baseInfo.ChoicedRow.GetValue("LOCATION_NO");
- //cmbLocationNo.Text = baseInfo.ChoicedRow.GetValue("LOCATION_NAME");
- this.ultraGrid1.ActiveCell.Value = baseInfo.ChoicedRow.GetValue("BASENAME");
- this.ultraGrid1.ActiveCell.Row.Cells["BlWlId"].Value = baseInfo.ChoicedRow.GetValue("BASECODE");
- }
- }
- private void FrmJGMatReport_Shown(object sender, EventArgs e)
- {
- toolMenu.Toolbars[0].Tools["Extinction"].InstanceProps.Visible = DefaultableBoolean.False;
- toolMenu.Toolbars[0].Tools["doUpdate"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- private void ultraTabControl1_SelectedTabChanged(object sender, Infragistics.Win.UltraWinTabControl.SelectedTabChangedEventArgs e)
- {
- if (toolMenu == null) return;
- if (ultraTabControl1.SelectedTab.Key.Equals("0"))
- {
- toolMenu.Toolbars[0].Tools["Extinction"].InstanceProps.Visible = DefaultableBoolean.False;
- toolMenu.Toolbars[0].Tools["doUpdate"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (ultraTabControl1.SelectedTab.Key.Equals("1"))
- {
- toolMenu.Toolbars[0].Tools["Extinction"].InstanceProps.Visible = DefaultableBoolean.True;
- toolMenu.Toolbars[0].Tools["doUpdate"].InstanceProps.Visible = DefaultableBoolean.True;
- }
- if (ultraTabControl1.SelectedTab.Key.Equals("2"))
- {
- toolMenu.Toolbars[0].Tools["Extinction"].InstanceProps.Visible = DefaultableBoolean.False;
- toolMenu.Toolbars[0].Tools["doUpdate"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- }
- }
- }
|