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 Core.Mes.Client.Comm.Server; using Core.Mes.Client.Comm.Control; using System.Collections; using Core.Mes.Client.Comm.Tool; using Core.StlMes.Client.YdmBcPipeManage.Entity; using Infragistics.Win.UltraWinGrid; using Core.Mes.Client.Comm.Format; namespace Core.StlMes.Client.YdmBcPipeManage { public partial class FrmStoreSummaryMemo : FrmBase { public FrmStoreSummaryMemo() { InitializeComponent(); this.IsLoadUserView = true; } ArrayList alistChecked = null; private string[] arr = null;//仓库权限 private string[] belongArr = null;//所属权权限 private void FrmStoreSummaryMemo_Load(object sender, EventArgs e) { //getStoreAll(); InitBindColumn(); arr = BaseMethod.WarehousePermissionsStore(this.ValidDataPurviewIds, ob); belongArr = this.ValidDataPurviewIds; EntityHelper.ShowGridCaption(ultraGrid1.DisplayLayout.Bands[0]); try { alistChecked = new ArrayList(); alistChecked.Add("StoveNo"); alistChecked.Add("JudgeStoveNo"); alistChecked.Add("MaterialName"); alistChecked.Add("ProcessDesc"); //alistChecked.Add("FixLen"); } catch { } } /// /// 字段绑定 /// private void InitBindColumn() { //材料状态 this.ultraGrid1.DisplayLayout.ValueLists[0].ValueListItems.Add("80150101", "材料产出等待"); this.ultraGrid1.DisplayLayout.ValueLists[0].ValueListItems.Add("80150102", "材料管理封锁"); this.ultraGrid1.DisplayLayout.ValueLists[0].ValueListItems.Add("80150103", "材料质量封锁"); this.ultraGrid1.DisplayLayout.ValueLists[0].ValueListItems.Add("80150104", "材料可编计划"); this.ultraGrid1.DisplayLayout.ValueLists[0].ValueListItems.Add("80150105", "材料已编计划"); this.ultraGrid1.DisplayLayout.ValueLists[0].ValueListItems.Add("80150106", "材料为余材"); this.ultraGrid1.DisplayLayout.ValueLists[0].ValueListItems.Add("80150201", "材料产出等待(未综合判定)"); this.ultraGrid1.DisplayLayout.ValueLists[0].ValueListItems.Add("80150202", "材料产出(已综合判定"); this.ultraGrid1.DisplayLayout.ValueLists[0].ValueListItems.Add("80150203", "材料为余材(已综合判定)"); this.ultraGrid1.DisplayLayout.ValueLists[0].ValueListItems.Add("80150204", "材料脱单余材(销售组织脱单)"); this.ultraGrid1.DisplayLayout.ValueLists[0].ValueListItems.Add("80150301", "材料可编计划(发运控制)"); this.ultraGrid1.DisplayLayout.ValueLists[0].ValueListItems.Add("80150302", "材料已编计划(发运控制)"); this.ultraGrid1.DisplayLayout.ValueLists[0].ValueListItems.Add("80150303", "销售出厂"); //材料类别 this.ultraGrid1.DisplayLayout.ValueLists[1].ValueListItems.Add("801401", "在制品"); this.ultraGrid1.DisplayLayout.ValueLists[1].ValueListItems.Add("801402", "成品"); this.ultraGrid1.DisplayLayout.ValueLists[1].ValueListItems.Add("801403", "商品"); DataTable ds = ClsLoad.GetValueListDataTable("8014", this.ob); this.ultraGrid1.DisplayLayout.Bands[0].Columns["ProductFlag"].ValueList = ClsLoad.GeneralValuelist(ref ds, "BASECODE", "BASENAME"); string[] arr = new string[3] { "801501", "801502", "801503" }; DataTable dt = ClsLoad.GetValueListDataTable(arr, this.ob); this.ultraGrid1.DisplayLayout.Bands[0].Columns["MatStatus"].ValueList = ClsLoad.GeneralValuelist(ref dt, "BASECODE", "BASENAME"); } /// /// 获取仓库 /// //private void getStoreAll() //{ // string storeNo = "800201"; // string[] arr = BaseMethod.WarehousePermissions(this.CustomInfo, this.ValidDataPurviewIds, this.ob); // DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.Stuffmanage.FrmStuffBase.getStoreAll", new object[] { storeNo, arr }, this.ob); // if (dt.Rows.Count > 0) // { // cmbStorgeNo.DataSource = dt; // cmbStorgeNo.DisplayMember = "STORAGE_NAME"; // cmbStorgeNo.ValueMember = "STORAGE_NO"; // } //} /// /// 重写基类方法 /// /// /// public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": QueryData(); break; case "Export": ExportData(); break; case "Update": doUpdate(); break; case "Print": doPrint(); break; case "Close": this.Close(); break; } } /// /// 打印 /// private void doPrint() { this.ultraGrid1.UpdateData(); UltraGridRow uRow = this.ultraGrid1.ActiveRow; if (uRow == null) { return; } ArrayList parm = new ArrayList(); MatBcMEntity3 matGptity = (MatBcMEntity3)uRow.ListObject; string url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepLabelTH.cpt&JUDGE_STOVE_NO=" + matGptity.JudgeStoveNo + "&BATCH_NO=" + matGptity.BatchNo + "&PRO_ORDER_NO=" + matGptity.ProOrderNo + "&LOCATION_NO=" + matGptity.LocationNo + "&USER=" + this.UserInfo.GetUserID(); FrmRepExcel fre = new FrmRepExcel(this.ob, url); //fre.AutoSize = true; fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height); fre.Text = "标牌打印"; fre.ShowDialog(); } /// /// 修改 /// private void doUpdate() { this.ultraGrid1.UpdateData(); UltraGridRow uRow1 = this.ultraGrid1.ActiveRow; if (uRow1 == null) { return; } ArrayList parm = new ArrayList(); IQueryable checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'"); if (checkMagRows.Count() == 0) { MessageUtil.ShowTips("请选择需要修改的信息!"); return; } foreach (UltraGridRow uRow in checkMagRows) { MatBcMEntity3 matGptity = (MatBcMEntity3)uRow.ListObject; string matGpTity = JSONFormat.Format(matGptity); parm.Add(matGpTity); } if (MessageUtil.ShowYesNoAndQuestion("是否确认修改?") == DialogResult.No) return; CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.ydm.bc.report.FrmBcStoreSummary"; ccp.MethodName = "updateMemo"; ccp.ServerParams = new object[] { parm }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("修改成功!")) { QueryData(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } /// /// 查询 /// private void QueryData() { List listSource = null; if (chkStoveNo.Checked && string.IsNullOrEmpty(this.txtStoveNo.Text.Trim())) { MessageUtil.ShowTips("请输入熔炼炉号!"); this.txtStoveNo.Focus(); return; } if (chkJudgeNo.Checked && string.IsNullOrEmpty(this.txtJudgeNo.Text.Trim())) { MessageUtil.ShowTips("请输入判定炉号!"); this.txtJudgeNo.Focus(); return; } if (this.chkFlagStoveNo.Checked && string.IsNullOrEmpty(this.txtFlagStoveNo.Text.Trim())) { MessageUtil.ShowTips("请输入标识炉号!"); this.txtJudgeNo.Focus(); return; } string stoveNo = ""; string judgeNo = ""; string flagStoveNo = ""; string orderNo = ""; ArrayList list = new ArrayList(); if (chkStoveNo.Checked) { stoveNo = this.txtStoveNo.Text.Trim(); } if(chkJudgeNo.Checked) { judgeNo = this.txtJudgeNo.Text.Trim(); } if(chkFlagStoveNo.Checked) { flagStoveNo = this.txtFlagStoveNo.Text.Trim(); } if (chkOrder.Checked) { orderNo = this.txtOrder.Text.Trim(); } list.Add(stoveNo); list.Add(judgeNo); list.Add(flagStoveNo); list.Add(orderNo); listSource = EntityHelper.GetData( "com.steering.ydm.bc.report.FrmBcStoreSummary.queryDataMemo", new object[] { list, arr }, this.ob); matBcMEntity3BindingSource.DataSource = listSource; GridHelper.RefreshAndAutoSize(this.ultraGrid1); } /// /// 导出 /// private void ExportData() { GridHelper.ulGridToExcel(ultraGrid1, "钢管库存汇总"); } private void cbx_GroupBy_CheckedChanged(object sender, EventArgs e) { CommonMethod.SetGridGroupBy(ref this.ultraGrid1, cbx_GroupBy.Checked); CommonMethod.SetGridSumArea(this.ultraGrid1); } private void chkStoveNo_CheckedChanged(object sender, EventArgs e) { this.txtStoveNo.Enabled = this.chkStoveNo.Checked; } private void chkJudgeNo_CheckedChanged(object sender, EventArgs e) { this.txtJudgeNo.Enabled = this.chkJudgeNo.Checked; } private void txtStoveNo_KeyDown(object sender, KeyEventArgs e) { if (e.KeyValue == 13) { QueryData(); } } private void txtJudgeNo_KeyDown(object sender, KeyEventArgs e) { if (e.KeyValue == 13) { QueryData(); } } private void txtOrder_KeyDown(object sender, KeyEventArgs e) { if (e.KeyValue == 13) { QueryData(); } } private void chkOrder_CheckedChanged(object sender, EventArgs e) { this.txtOrder.Enabled = this.chkOrder.Checked; } private void chkFlagStoveNo_CheckedChanged(object sender, EventArgs e) { this.txtFlagStoveNo.Enabled = this.chkFlagStoveNo.Checked; } } }