| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347 |
-
- 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.ZGMil.Entity;
- 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.Text.RegularExpressions;
- using System.Windows.Forms;
- namespace Core.StlMes.Client.ZGMil.Signature
- {
- public partial class FrmScrapStoveApplyDescion : FrmBase
- {
- public FrmScrapStoveApplyDescion()
- {
- InitializeComponent();
- }
- private string departCode = "";//所属权
- private void FrmScrapStoveApplyDescion_Load(object sender, EventArgs e)
- {
- dtBathYear.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM"));
- EntityHelper.ShowGridCaption<MilPlanEntity3>(ultraGrid1.DisplayLayout.Bands[0]);
- EntityHelper.ShowGridCaption<QcmZgJugdeApplyEntity>(ultraGrid2.DisplayLayout.Bands[0]);
- EntityHelper.ShowGridCaption<MilPlanEntity3>(ultraGrid3.DisplayLayout.Bands[0]);
- }
- /// <summary>
- /// 基类方法
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="ToolbarKey"></param>
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "Query":
- queryData();
- break;
- case"QueryScrap":
- queryScrapData();
- break;
- case "insertScrapMata":
- insertScrapMata();
- break;
- case "insertWhiteBank":
- insertWhiteBank();
- break;
- case"cancelScrapMata":
- cancelScrapMata();
- break;
- case "Export":
- ExportData();
- break;
- case "Close":
- this.Close();
- break;
- }
- }
- /// <summary>
- /// 查询整炉废
- /// </summary>
- private void queryScrapData()
- {
- string jugeNo = "";
- string bathYear = this.dtBathYear.Value.ToString("yyyyMM");
- string plineCode = this.ultraComboEditor1.Value.ToString();
- if (this.ultraComboEditor1.Text.ToString() == "")
- {
- MessageUtil.ShowTips("请选择产线!");
- return;
- }
- //departCode = ClsBaseInfo.GetDepartIdBySectionId(this.UserInfo.GetDeptid(), this.ob);
- if (this.chkHeatNo2.Checked)
- {
- if (this.txtHeatNo2.Text.Trim() == "")
- {
- MessageUtil.ShowTips("请输入炉号!");
- }
- else
- {
- jugeNo = this.txtHeatNo2.Text.Trim();
- }
- }
- ArrayList parmList = new ArrayList();
- parmList.Add(jugeNo);
- parmList.Add(bathYear);
- parmList.Add(plineCode);
- List<MilPlanEntity3> listSource = EntityHelper.GetData<MilPlanEntity3>(
- "com.steering.mes.signature.FrmScrapStoveApplyDescion.doQueryMata", new object[] { parmList }, this.ob);
- PortMilBatchSampleResultEntity1bindingSource.DataSource = listSource;
- queryQcm();
- }
-
- /// <summary>
- /// 查询白条信息
- /// </summary>
- private void queryData()
- {
- string jugeNo = "";
- string bathYear = this.dtBathYear.Value.ToString("yyyyMM");
- string plineCode = this.ultraComboEditor1.Value.ToString();
- if (this.ultraComboEditor1.Text.ToString() == "")
- {
- MessageUtil.ShowTips("请选择产线!");
- return;
- }
- //departCode = ClsBaseInfo.GetDepartIdBySectionId(this.UserInfo.GetDeptid(), this.ob);
- if(this.chkHeatNo2.Checked)
- {
- if (this.txtHeatNo2.Text.Trim() == "")
- {
- MessageUtil.ShowTips("请输入炉号!");
- }
- else
- {
- jugeNo = this.txtHeatNo2.Text.Trim();
- }
- }
- ArrayList parmList = new ArrayList();
- parmList.Add(jugeNo);
- parmList.Add(bathYear);
- parmList.Add(plineCode);
- List<MilPlanEntity3> listSourceS = EntityHelper.GetData<MilPlanEntity3>(
- "com.steering.mes.signature.FrmScrapStoveApplyDescion.doQueryBTMata", new object[] { parmList }, this.ob);
- PortMilBatchSampleResultEntitybindingSource.DataSource = listSourceS;
- queryQcm();
- }
- /// <summary>
- /// 查询当月所有白条\ 整炉废判定数据
- /// </summary>
- public void queryQcm()
- {
- string jugeNo = "";
- string bathYear = this.dtBathYear.Value.ToString("yyyyMM");
- string plineCode = this.ultraComboEditor1.Value.ToString();
- if (this.ultraComboEditor1.Text.ToString() == "")
- {
- MessageUtil.ShowTips("请选择产线!");
- return;
- }
- //departCode = ClsBaseInfo.GetDepartIdBySectionId(this.UserInfo.GetDeptid(), this.ob);
- if (this.chkHeatNo2.Checked)
- {
- if (this.txtHeatNo2.Text.Trim() == "")
- {
- MessageUtil.ShowTips("请输入炉号!");
- }
- else
- {
- jugeNo = this.txtHeatNo2.Text.Trim();
- }
- }
- ArrayList parmList = new ArrayList();
- parmList.Add(jugeNo);
- parmList.Add(bathYear);
- parmList.Add(plineCode);
- List<QcmZgJugdeApplyEntity> listSource = EntityHelper.GetData<QcmZgJugdeApplyEntity>(
- "com.steering.mes.signature.FrmScrapStoveApplyDescion.doQueryQcmMata", new object[] { parmList }, this.ob);
- QcmZgJugdeApplyEntitybindingSource.DataSource = listSource;
- }
- /// <summary>
- /// 增加整炉判废判定记录
- /// </summary>
- private void insertScrapMata()
- {
- this.ultraGrid3.UpdateData();
- IQueryable<UltraGridRow> checkMagRows = this.ultraGrid3.Rows.AsQueryable().Where(" CHK = 'True'");
- if (checkMagRows.Count()==0)
- {
- MessageUtil.ShowTips("请选择需要整炉废信息");
- return;
- }
- ArrayList parmList = new ArrayList();
- foreach (UltraGridRow uRow in checkMagRows)
- {
- MilPlanEntity3 milPlanEntity = (MilPlanEntity3)uRow.ListObject;
- string mPlanTity = JSONFormat.Format(milPlanEntity);
- parmList.Add(mPlanTity);
- }
-
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.signature.FrmScrapStoveApplyDescion";
- ccp.MethodName = "doDecisionScrap";
- ccp.ServerParams = new object[] { parmList, this.UserInfo.GetUserName() };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("送判成功!"))
- {
- queryScrapData();
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- /// <summary>
- /// 增加白条判定记录
- /// </summary>
- private void insertWhiteBank()
- {
- this.ultraGrid1.UpdateData();
- IQueryable<UltraGridRow> checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
- if (checkMagRows.Count() == 0)
- {
- MessageUtil.ShowTips("请选择需要打白条的信息");
- return;
- }
- ArrayList parmList = new ArrayList();
- foreach(UltraGridRow uRow in checkMagRows)
- {
- MilPlanEntity3 milPlanEntity = (MilPlanEntity3)uRow.ListObject;
- //if (!IsInt(milPlanEntity.ActCount.ToString()))
- //{
- // MessageUtil.ShowTips("支数请输入整数!");
- // return;
- //}
- //if (!IsNumber(milPlanEntity.ActWeight.ToString()))
- //{
- // MessageUtil.ShowTips("重量请输入数字!");
- // return;
- //}
- string mPlanTity = JSONFormat.Format(milPlanEntity);
- parmList.Add(mPlanTity);
- }
-
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.signature.FrmScrapStoveApplyDescion";
- ccp.MethodName = "insertWhiteBank";
- ccp.ServerParams = new object[] { parmList, this.UserInfo.GetUserName() };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("送判成功!"))
- {
- queryData();
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- /// <summary>
- /// 检验是否为数字
- /// </summary>
- /// <param name="str">需要检验的字符串</param>
- /// <returns>是否为数字:true代表是,false代表否</returns>
- public static bool IsNumber(string str)
- {
- Regex rx = new Regex(@"^[+-]?[0123456789]*[.]?[0123456789]*$");
- return rx.IsMatch(str);
- }
- /// <summary>
- /// 检验是否是整数
- /// </summary>
- /// <param name="str">需要检验的字符串</param>
- /// <returns>是否为整数:true是整数,false非整数</returns>
- public static bool IsInt(string str)
- {
- Regex rx = new Regex(@"^[0123456789]+$");
- return rx.IsMatch(str);
- }
- /// <summary>
- /// 撤销整炉废
- /// </summary>
- private void cancelScrapMata()
- {
- this.ultraGrid2.UpdateData();
- UltraGridRow uRow = this.ultraGrid2.ActiveRow;
- if (uRow == null)
- {
- MessageUtil.ShowTips("请选择需要撤销的信息");
- return;
- }
- QcmZgJugdeApplyEntity qcmEntity = (QcmZgJugdeApplyEntity)uRow.ListObject;
- string qcmZcTity = JSONFormat.Format(qcmEntity);
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.signature.FrmScrapStoveApplyDescion";
- ccp.MethodName = "cancelScrapMata";
- ccp.ServerParams = new object[] { qcmZcTity};
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("撤销成功!"))
- {
- queryData();
- queryScrapData();
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- private void chkHeatNo2_CheckedChanged(object sender, EventArgs e)
- {
- txtHeatNo2.Enabled = this.chkHeatNo2.Checked;
- }
- /// <summary>
- /// 导出
- /// </summary>
- private void ExportData()
- {
- GridHelper.ulGridToExcel(ultraGrid2, "虚数申请判定->整炉废(白条信息)");
- }
- private void ultraGrid1_CellChange(object sender, CellEventArgs e)
- {
- this.ultraGrid1.UpdateData();
- int strCountTex = 0;
- double strWgtTex = 0.000;
- if (e.Cell.Column.Key == "CHK")
- {
- IQueryable<UltraGridRow> checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
- foreach (UltraGridRow uRow in checkMagRows)
- {
- strCountTex = strCountTex + int.Parse(uRow.Cells["ActCount"].Value.ToString3());
- strWgtTex = strWgtTex + double.Parse(uRow.Cells["ActWeight"].Value.ToString3());
- }
- this.ultraGroupBox1.Text = "可打白条信息" + " " + "已选支:" + strCountTex.ToString() + " " + "已选产量: " + strWgtTex.ToString();
- }
- }
- }
- }
|