using Core.Mes.Client.Comm.Control; using Core.Mes.Client.Comm.Format; using Core.Mes.Client.Comm.Server; using Core.Mes.Client.Comm.Tool; using Core.StlMes.Client.YdmStuffManage.Entity; //using Core.StlMes.Client.ZGMil.Common; //using Core.StlMes.Client.ZGMil.Entity; //using Core.StlMes.Client.ZGMil.NodeResultQuery; using CoreFS.CA06; using Infragistics.Win.UltraWinGrid; using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace Core.StlMes.Client.YdmStuffManage { public partial class FrmDzFeedLoadResult : FrmBase { private string departm = ""; private string plineCode = ""; private string user = ""; private string bc = ""; private string bz = ""; private string[] pCode; //private string plineCode = ""; public FrmDzFeedLoadResult() { InitializeComponent(); bc = UserInfo.GetUserOrder(); bz = UserInfo.GetUserGroup(); } public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": doQuery(); break; case "Node": node(); break; case "NodeBack": nodeBack(); break; case "Close": this.Close(); break; } } #region 方法 /// /// 上料 /// private void node() { this.ultraGrid1.UpdateData(); IQueryable checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'"); if (checkMagRows.Count() == 0) { MessageUtil.ShowTips("请勾选需要上料的炉批信息!"); return; } //if (checkMagRows.Count() > 1) //{ // MessageUtil.ShowTips("请不要勾选多个炉批信息!"); // return; //} ArrayList parm = new ArrayList(); ArrayList parm1 = new ArrayList(); ArrayList parm2 = new ArrayList(); int a = 0; double b = 0.0; foreach (UltraGridRow uRow in checkMagRows) { PlnZyDzMEntity plnZyDzMEntity = (PlnZyDzMEntity)uRow.ListObject; string plnZyDzMEntityString = JSONFormat.Format(plnZyDzMEntity); parm.Add(plnZyDzMEntityString); foreach (var plnZyDzCEntity in plnZyDzMEntity.PlnZyDzCTity) { if (!StringUtil.IsInt32(plnZyDzCEntity.RealIndoubleNum.ToString2())) { MessageUtil.ShowTips("输入的上料支不是整数!"); return; } if (!StringUtil.IsDouble(plnZyDzCEntity.RealIndoubleWt.ToString2())) { MessageUtil.ShowTips("输入的上料吨不是数字!"); return; } a = int.Parse(plnZyDzCEntity.PlanIndoubleNum.ToString2()) - int.Parse(plnZyDzCEntity.RealIndoubleNum.ToString2()); b = double.Parse(plnZyDzCEntity.PlanIndoubleWt.ToString2()) - double.Parse(plnZyDzCEntity.RealIndoubleWt.ToString2()); if ( a < 0 || b < 0 ) { MessageUtil.ShowTips("输入的上料支吨不能大于计划支吨!"); return; } parm1.Add(JSONFormat.Format(plnZyDzCEntity)); } } string[] arr = BaseMethod.WarehousePermissionsStore(this.ValidDataPurviewIds, this.ob); parm2.Add(bc); parm2.Add(bz); parm2.Add(user); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "Core.LgMes.Server.Stuffmanage.FrmDzFeedLoad"; ccp.MethodName = "node"; ccp.ServerParams = new object[] { parm, parm1, arr, parm2 }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { MessageUtil.ShowTips("上料成功!"); doQuery(); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } /// /// 上料回退 /// private void nodeBack() { this.ultraGrid1.UpdateData(); IQueryable checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'"); if (checkMagRows.Count() == 0) { MessageUtil.ShowTips("请勾选需要上料的炉批信息!"); return; } ArrayList parm = new ArrayList(); ArrayList parm2 = new ArrayList(); foreach (UltraGridRow uRow in checkMagRows) { PlnZyDzMEntity plnZyDzMEntity = (PlnZyDzMEntity)uRow.ListObject; string plnZyDzMEntityString = JSONFormat.Format(plnZyDzMEntity); parm.Add(plnZyDzMEntityString); foreach (var plnZyDzCEntity in plnZyDzMEntity.PlnZyDzCTity) { parm2.Add(JSONFormat.Format(plnZyDzCEntity)); } } //string[] arr = BaseMethod.WarehousePermissionsStore(this.ValidDataPurviewIds, this.ob); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "Core.LgMes.Server.Stuffmanage.FrmDzFeedLoad"; ccp.MethodName = "nodeBack"; ccp.ServerParams = new object[] { parm, parm2 }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { MessageUtil.ShowTips("上料回退成功!"); doQuery(); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } /// /// 查询 /// private void doQuery() { string JudgeStoveNo = ""; string LotNo = ""; string IsLoad = "0"; if (chkJudgeStoveNo.Checked) { if (uteJudgeStoveNo.Text.Trim() == "") { JudgeStoveNo = ""; } else { JudgeStoveNo = uteJudgeStoveNo.Value.ToString(); } } if (chkLotNo.Checked) { if (uteLotNo.Text.Trim() == "") { LotNo = ""; } else { LotNo = uteLotNo.Value.ToString(); } } if (chkIsLoad.Checked) { IsLoad = "1"; } WaitingForm2 wf = new WaitingForm2("正在加载,请稍候...."); List listSource = EntityHelper.GetData( "Core.LgMes.Server.Stuffmanage.FrmDzFeedLoad.doQueryDataM", new object[] { JudgeStoveNo, LotNo, IsLoad }, this.ob); List listSource2 = EntityHelper.GetData( "Core.LgMes.Server.Stuffmanage.FrmDzFeedLoad.doQueryDataC", new object[] { JudgeStoveNo, LotNo, IsLoad }, this.ob); EntityHelper.AddEntityRelation(listSource, listSource2, "HeatPlanNo", "HeatPlanNo"); plnZyDzMEntityBindingSource.DataSource = listSource; wf.Close(); } /// /// 非250、258、168、460的产线代码都为空 /// /// private string getPlineCode() { if (plineCode.Equals("C008") || plineCode.Equals("C009") || plineCode.Equals("C010") || plineCode.Equals("C017")) { return plineCode; } else { return ""; } } #endregion #region 事件 private void FrmFeedLoadResult_Load(object sender, EventArgs e) { NativeMethodNew na = new NativeMethodNew(this.ob); departm = UserInfo.GetDepartment(); string[] arr = BaseMethod.WarehousePermissionsStore(this.ValidDataPurviewIds, this.ob); pCode = na.GetPlineCode(arr);//获取 用户 对应的产线 foreach (String pCode1 in pCode) { if (!pCode1.Equals("")) { plineCode = pCode1; } } //plineCode = na.GetPCode(departm);//获取 用户 对应的产线 //planWeight.Value = UserInfo.GetUserOrderText(); //actualWeight.Value = UserInfo.GetUserGroupText(); user = UserInfo.GetUserName(); bc = UserInfo.GetUserOrder(); bz = UserInfo.GetUserGroup(); //EntityHelper.ShowGridCaption(ultraGrid1.DisplayLayout.Bands[0]); //EntityHelper.ShowGridCaption(ultraGrid2.DisplayLayout.Bands[0]); EntityHelper.ShowGridCaption(ultraGrid1.DisplayLayout.Bands[0]); EntityHelper.ShowGridCaption(ultraGrid1.DisplayLayout.Bands[1]); doQuery(); } private void chkLotNo_CheckedChanged(object sender, EventArgs e) { if (chkLotNo.Checked) { uteLotNo.Enabled = true; } else { uteLotNo.Enabled = false; } if (chkJudgeStoveNo.Checked) { uteJudgeStoveNo.Enabled = true; } else { uteJudgeStoveNo.Enabled = false; } } //private void ultraGrid2_CellChange(object sender, CellEventArgs e) //{ // foreach (UltraGridRow uRow in ultraGrid2.Rows) // { // if (int.Parse(uRow.Cells["PLAN_INDOUBLE_NUM"].Value.ToString3()) > int.Parse(uRow.Cells["ACT_COUNT"].Value.ToString3())) // { // MessageUtil.ShowTips("输入的上料支不能大于可分配支!"); // return; // } // if (!StringUtil.IsInt(uRow.Cells["PLAN_INDOUBLE_NUM"].Value.ToString3())) // { // MessageUtil.ShowTips("输入的上料支不为整数,请重新输入!"); // return; // } // } // int a = 0; // double b = 0.0; // if (ultraGrid2.Rows.Count > 0) // { // foreach (UltraGridRow uRow in ultraGrid2.Rows) // { // a += int.Parse(uRow.Cells["PLAN_INDOUBLE_NUM"].Value.ToString3()) * int.Parse(uRow.Cells["FIX_NUM"].Value.ToString3()); // b += int.Parse(uRow.Cells["PLAN_INDOUBLE_NUM"].Value.ToString3()) * double.Parse(uRow.Cells["WEIGHT_M"].Value.ToString3()); // } // } // actualNum.Value = a; // actualWeight.Value = b; //} #endregion } }