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.YdmStuffReport.Entity; using Core.Mes.Client.Comm.Format; using Infragistics.Win.UltraWinGrid; using Core.StlMes.Client.YdmStuffManage; namespace Core.StlMes.Client.YdmStuffReport { public partial class FrmStoreSummaryMemeo : FrmBase { public FrmStoreSummaryMemeo() { InitializeComponent(); } ArrayList alistChecked = null; private string[] arr = null;//仓库权限 private string[] belongArr = null;//所属权权限 private void FrmStoreSummaryMemeo_Load(object sender, EventArgs e) { //getStoreAll(); InitBindColumn(); arr = BaseMethod.WarehousePermissionsStore(this.ValidDataPurviewIds, this.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("FixNum"); alistChecked.Add("FixLen"); } catch { } try { ArrayList alist = new ArrayList(); alist.Add("ActCount"); alist.Add("ActWeight"); } 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("0"); break; case "UpdateMngLock": // 修改封锁标志 doUpdate("1"); break; case "Close": this.Close(); break; } } /// /// 修改 /// flag 0:修改备注 1:修改封锁标志 /// private void doUpdate(String flag) { 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) { MatGpMEntity matGptity = (MatGpMEntity)uRow.ListObject; matGptity.MngLockMaker = UserInfo.GetUserName(); string matGpTity = JSONFormat.Format(matGptity); parm.Add(matGpTity); } if (MessageUtil.ShowYesNoAndQuestion("是否确认修改?") == DialogResult.No) return; CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "Core.LgMes.Server.Stuffmanage.Report.FrmStoreSummary"; if("0".Equals(flag)){ ccp.MethodName = "updateMemo"; } if ("1".Equals(flag)) { ccp.MethodName = "updateMngLock"; } 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)) { MessageUtil.ShowTips("请输入熔炼炉号!"); this.txtStoveNo.Focus(); return; } if (chkJudgeNo.Checked && string.IsNullOrEmpty(this.txtJudgeNo.Text)) { MessageUtil.ShowTips("请输入判定炉号!"); this.txtJudgeNo.Focus(); return; } ArrayList list = new ArrayList(); list.Add(this.txtStoveNo.Text); list.Add(this.txtJudgeNo.Text); list.Add(this.txtOrder.Text); listSource = EntityHelper.GetData( "Core.LgMes.Server.Stuffmanage.Report.FrmStoreSummary.queryDataMemo", new object[] { list, arr }, this.ob); MatGpMEntitybindingSource.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; } } }