| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496 |
- 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 CoreFS.CA06;
- using Infragistics.Win;
- using Infragistics.Win.UltraWinEditors;
- 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.Net;
- using System.Text;
- using System.Windows.Forms;
- namespace Core.StlMes.Client.YdmStuffManage
- {
- public partial class FrmGpApplyDecision : FrmBase
- {
- public FrmGpApplyDecision()
- {
- InitializeComponent();
- }
- private string plineCode = "";//产线
- private string[] arr = null;
- private void FrmGpApplyDecision_Load(object sender, EventArgs e)
- {
- DateTime now = DateTime.Now;
- DateTime dt1 = new DateTime(now.Year, now.Month, 1);//当月第一天
- DateTime dt2 = dt1.AddMonths(1).AddDays(-1);//当月最后一天
- this.StartTime.Value = DateTime.Parse(dt1.ToString("yyyy-MM-dd") + " 00:00:00");
- this.EndTime.Value = DateTime.Parse(dt2.ToString("yyyy-MM-dd") + " 23:59:59");
- switch(this.CustomInfo)
- {
- case"LG":
- arr = BaseMethod.InitLgPermissions(this.ValidDataPurviewIds,"B", this.ob);
- this.entityGrid1.DisplayLayout.Bands[0].Columns["SoureName"].Hidden = true;
- break;
- case"DZ":
- arr = BaseMethod.InitLgPermissions(this.ValidDataPurviewIds,"C", this.ob);
- this.entityGrid1.DisplayLayout.Bands[0].Columns["SoureName"].Hidden = true;
- break;
- }
-
- plineCode = BaseMethod.GetPCode(UserInfo.GetDepartment(),ob);
- }
- /// <summary>
- /// 重写基类方法
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="ToolbarKey"></param>
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "DoQueryMat":
- QueryMat();
- break;
- case "DoDecision":
- DoDecision();
- break;
- case "cancelDoDecision":
- cancelDoDecision();
- break;
- case"UploadingSuface":
- uploadingSuface();
- break;
- case "insertProssWt":
- insertProssWt();
- break;
- case "Close":
- this.Close();
- break;
- }
- }
- /// <summary>
- /// 回填过磅重量
- /// </summary>
- private void insertProssWt()
- {
- this.entityGrid2.UpdateData();
- UltraGridRow row = this.entityGrid1.ActiveRow;
- string departMentid = UserInfo.GetDeptid();
- if (row == null)
- {
- return;
- }
- IQueryable<UltraGridRow> checkMagRows = this.entityGrid2.Rows.AsQueryable().Where(" CHK = 'True'");
- if (checkMagRows.Count() == 0)
- {
- MessageUtil.ShowTips("请选择需要申请判定的主信息!");
- return;
- }
-
- ArrayList parm = new ArrayList();
- foreach (UltraGridRow uRow in checkMagRows)
- {
- foreach (UltraGridRow childRow in uRow.ChildBands[0].Rows)
- {
- if (Double.Parse(childRow.Cells["PonderGrossWt"].Value.ToString3()) <= 0)
- {
- MessageUtil.ShowTips("请输入正确的过磅重量!");
- return;
- }
- if (!childRow.Cells["JugdeApplyCode"].Value.ToString().Equals(""))
- {
- MessageUtil.ShowTips("已送判不能回报过磅重量!");
- return;
- }
- MatGpMEntity matGp = (MatGpMEntity)childRow.ListObject;
- string matGpEntity = JSONFormat.Format(matGp);
- parm.Add(matGpEntity);
- }
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "Core.LgMes.Server.Stuffmanage.FrmGpApplyDecision";
- ccp.MethodName = "insertProssWt";
- ccp.ServerParams = new object[] { parm, departMentid };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("回报成功!"))
- {
- QueryMat();
- //MatZcMEntity2bindingSource.Clear();
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- private void uploadingSuface()
- {
- this.entityGrid1.UpdateData();
- UltraGridRow uRow = this.entityGrid1.ActiveRow;
- if (uRow == null)
- {
- return;
- }
- string plineCode = uRow.Cells["PlineCode"].Text;
- string judgeNo = uRow.Cells["JudgeStoveNo"].Text;
- string path = "LgMil/surfcacReprot" + "/" + "C005" + "/" + judgeNo + "/";
- string name = plineCode + judgeNo + ".pdf";
- List<FileBean> list = new List<FileBean>();
- FileBean bean = new FileBean();
- OpenFileDialog file = new OpenFileDialog();
- file.Multiselect = false;
- file.Title = "选择需要上传的文件";
- file.Filter = "PDF Document(*.pdf)|*.pdf";
- DialogResult drStat;
- drStat = file.ShowDialog();
- if (drStat == DialogResult.OK)
- {
- foreach (string fileName in file.FileNames)
- {
- //string name = System.IO.Path.GetFileName(fileName);
- bean = new FileBean();
- bean.setFileName(name);
- bean.setPathName(path);
- bean.setFile(FileHelper.FileToArray(fileName));
- list.Add(bean);
- }
- bool isSuccess = Core.Mes.Client.Comm.Server.FileHelper.Upload(list);
- if (isSuccess)
- {
- int count = ServerHelper.SetData("Core.LgMes.Server.Stuffmanage.FrmGpApplyDecision.updateSurfaceDz", new object[] { path, judgeNo }, ob);
- if (count > 0)
- {
- MessageUtil.ShowTips("上传成功!");
- }
- else
- {
- MessageUtil.ShowTips("上传失败,请重试!");
- }
- }
- else
- {
- MessageUtil.ShowTips("上传失败,请重试!");
- }
- }
- }
- /// <summary>
- /// 查询炉计划信息
- /// </summary>
- private void QueryMat()
- {
- string plinCode = "";
- string stoveNo = "";
- string jugeNo = "";
- string startTim = "";
- string endTim = "";
- ArrayList list = new ArrayList();
-
- //string departId = this.UserInfo.GetDeptid();
- if (this.chkStove.Checked && this.txtStoveNo.Text.Trim() != "")
- {
- stoveNo = this.txtStoveNo.Text.Trim();
- }
- if (this.chkJudgeStoveNo.Checked && this.txtJudgeStoveNo.Text.Trim() != "")
- {
- jugeNo = this.txtJudgeStoveNo.Text.Trim();
- }
- if (chkTim2.Checked)
- {
- if (DateTime.Parse(this.StartTime.Value.ToString()) > DateTime.Parse(EndTime.Value.ToString()))
- {
- MessageUtil.ShowTips("选择的前面时间不能大于后面的时间!");
- return;
- }
- else
- {
- startTim = this.StartTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
- endTim = this.EndTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
- }
- }
- list.Add(stoveNo);
- list.Add(jugeNo);
- MatGpEntitybindingSource.Clear();
- List<MatGpMEntity> listSource = null;
- switch(this.CustomInfo)
- {
- case"LG":
- listSource = EntityHelper.GetData<MatGpMEntity>(
- "Core.LgMes.Server.Stuffmanage.FrmGpApplyDecision.doQueryMat", new object[] { list, startTim, endTim, this.ultraOptionSet1.CheckedItem.DataValue.ToString(), arr,this.ValidDataPurviewIds }, this.ob);
- break;
- case"DZ":
- listSource = EntityHelper.GetData<MatGpMEntity>(
- "Core.LgMes.Server.Stuffmanage.FrmGpApplyDecision.doQueryMat", new object[] { list, startTim, endTim, this.ultraOptionSet1.CheckedItem.DataValue.ToString(), arr,this.ValidDataPurviewIds }, this.ob);
- break;
- case"WG":
- listSource = EntityHelper.GetData<MatGpMEntity>(
- "Core.LgMes.Server.Stuffmanage.FrmGpApplyDecision.doQueryMatWG", new object[] { list, startTim, endTim, this.ultraOptionSet1.CheckedItem.DataValue.ToString(), this.UserInfo.GetDeptid() }, this.ob);
- break;
- }
-
- matGpMEntityBindingSource.DataSource = listSource;
- }
-
- /// <summary>
- /// 申请判定
- /// </summary>
- private void DoDecision()
- {
- this.entityGrid2.UpdateData();
- string cic = "";
- UltraGridRow row = this.entityGrid1.ActiveRow;
- MatGpMEntity matGpInfo = (MatGpMEntity)row.ListObject;
- string matGpinfoEntity = JSONFormat.Format(matGpInfo);
- if (row == null)
- {
- return;
- }
- IQueryable<UltraGridRow> checkMagRows = this.entityGrid2.Rows.AsQueryable().Where(" CHK = 'True'");
- if (checkMagRows.Count() == 0)
- {
- MessageUtil.ShowTips("请选择需要申请判定的主信息!");
- return;
- }
- if(this.cicChk.Checked)
- {
- cic = this.txtCic.Text;
- }
- //if (!doQueryNode(row.Cells["StoveNo"].Text))
- //{
- // MessageUtil.ShowTips("交库点存在未结炉,不允许申请判定!");
- // return;
- //}
- ArrayList parm = new ArrayList();
- foreach (UltraGridRow uRow in checkMagRows)
- {
- foreach (UltraGridRow childRow in uRow.ChildBands[0].Rows)
- {
- MatGpMEntity matGp = (MatGpMEntity)childRow.ListObject;
- string matGpEntity = JSONFormat.Format(matGp);
- parm.Add(matGpEntity);
- }
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "Core.LgMes.Server.Stuffmanage.FrmGpApplyDecision";
- ccp.MethodName = "doDecision";
- ccp.ServerParams = new object[] { parm, row.Cells["StoveNo"].Text, plineCode, UserInfo.GetUserName(), this.CustomInfo, UserInfo.GetUserOrder(), UserInfo.GetUserGroup(), this.txtMemo.Text.Trim(), cic, matGpinfoEntity };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("申请判定成功!"))
- {
- QueryMat();
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- /// <summary>
- /// 查询是否该炉已交库结炉
- /// </summary>
- /// <param name="jugeNo"></param>
- /// <param name="plineCode"></param>
- /// <returns></returns>
- private Boolean doQueryNode(string stoveNo)
- {
- bool node = false;
- DataTable ds = new DataTable();
- switch (this.CustomInfo)
- {
- case"LG":
- ds = ServerHelper.GetData("Core.LgMes.Server.Stuffmanage.FrmGpApplyDecision.doQueryNode", new object[] { stoveNo }, ob);
- break;
- case"DZ":
- ds = ServerHelper.GetData("Core.LgMes.Server.Stuffmanage.FrmGpApplyDecision.doQueryNode", new object[] { stoveNo }, ob);
- break;
- }
-
- if (int.Parse(ds.Rows[0][0].ToString()) > 0)
- {
- node = true;
- }
- return node;
- }
- /// <summary>
- /// 撤销申请判定
- /// </summary>
- private void cancelDoDecision()
- {
- this.entityGrid2.UpdateData();
- IQueryable<UltraGridRow> checkMagRows = this.entityGrid2.Rows.AsQueryable().Where(" CHK = 'True'");
- if (checkMagRows.Count() == 0)
- {
- MessageUtil.ShowTips("请选择需要撤销申请判定的主信息!");
- return;
- }
- ArrayList parm = new ArrayList();
- foreach (UltraGridRow uRow in checkMagRows)
- {
- foreach (UltraGridRow childRow in uRow.ChildBands[0].Rows)
- {
- MatGpMEntity matZcTity = (MatGpMEntity)childRow.ListObject;
- string matTity = JSONFormat.Format(matZcTity);
- parm.Add(matTity);
- }
-
- }
- if (MessageUtil.ShowYesNoAndQuestion("是否确认撤销?") == DialogResult.No) return;
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "Core.LgMes.Server.Stuffmanage.FrmGpApplyDecision";
- ccp.MethodName = "cancelDoDecision";
- ccp.ServerParams = new object[] { parm };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("撤销成功!"))
- {
- QueryMat();
-
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
-
- }
- private void entityGrid1_AfterRowActivate(object sender, EventArgs e)
- {
- UltraGridRow uRow = this.entityGrid1.ActiveRow;
- string[] L1 = null;
- string[] L2 = null;
- List<MatGpMEntity1> listSource = null;
- List<MatGpMEntity> listSource1 = null;
- MatGpEntitybindingSource.Clear();
- if (this.CustomInfo.Equals("WG"))
- {
- L1 = new string[] { "StoveNo", "JudgeStoveNo","FixLen" };
- L2 = new string[] { "StoveNo", "JudgeStoveNo","FixLen" };
- listSource = EntityHelper.GetData<MatGpMEntity1>(
- "Core.LgMes.Server.Stuffmanage.FrmGpApplyDecision.doQueryMatDataWG", new object[] { uRow.Cells["StoveNo"].Text, uRow.Cells["JudgeStoveNo"].Text,uRow.Cells["FixLen"].Text, this.ultraOptionSet1.CheckedItem.DataValue.ToString() }, this.ob);
- listSource1 = EntityHelper.GetData<MatGpMEntity>(
- "Core.LgMes.Server.Stuffmanage.FrmGpApplyDecision.doQueryMatDataFixNumWG", new object[] { uRow.Cells["StoveNo"].Text, uRow.Cells["JudgeStoveNo"].Text,uRow.Cells["FixLen"].Text, this.ultraOptionSet1.CheckedItem.DataValue.ToString() }, this.ob);
- }
- else
- {
- L1 = new string[] { "Furnaceno", "StoveNo", "JudgeStoveNo" };
- L2 = new string[] { "Furnaceno", "StoveNo", "JudgeStoveNo" };
- listSource = EntityHelper.GetData<MatGpMEntity1>(
- "Core.LgMes.Server.Stuffmanage.FrmGpApplyDecision.doQueryMatData", new object[] { uRow.Cells["StoveNo"].Text, uRow.Cells["JudgeStoveNo"].Text, uRow.Cells["Furnaceno"].Text,uRow.Cells["FixLen"].Text, this.ultraOptionSet1.CheckedItem.DataValue.ToString() }, this.ob);
- listSource1 = EntityHelper.GetData<MatGpMEntity>(
- "Core.LgMes.Server.Stuffmanage.FrmGpApplyDecision.doQueryMatDataFixNum", new object[] { uRow.Cells["StoveNo"].Text, uRow.Cells["JudgeStoveNo"].Text, uRow.Cells["Furnaceno"].Text,uRow.Cells["FixLen"].Text, this.ultraOptionSet1.CheckedItem.DataValue.ToString() }, this.ob);
- }
-
-
- EntityHelper.AddEntityRelation(listSource, listSource1, L1, L2);
- MatGpEntitybindingSource.DataSource = listSource;
- foreach (UltraGridRow ugr in this.entityGrid2.Rows)
- {
- ugr.Cells["CHK"].Value = true;
- }
- }
- private void chkTim2_CheckedChanged(object sender, EventArgs e)
- {
- this.StartTime.Enabled = this.EndTime.Enabled = this.chkTim2.Checked;
- }
- private void txtStoveNo_KeyDown(object sender, KeyEventArgs e)
- {
- if(e.KeyValue == 13)
- {
- QueryMat();
- }
- }
- private void FrmGpApplyDecision_Shown(object sender, EventArgs e)
- {
- if (toolMenu == null) return;
- if (this.CustomInfo.Equals("WG") || this.CustomInfo.Equals("LG"))
- {
- if (toolMenu.Toolbars[0].Tools.Exists("UploadingSuface"))
- {
- toolMenu.Toolbars[0].Tools["UploadingSuface"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- }
- }
- private void txtMemo_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
- {
- UltraTextEditor textEditor = (UltraTextEditor)sender;
- PopupTextBox popupText = new PopupTextBox(textEditor.Text, 500);
- if (popupText.ShowDialog() == System.Windows.Forms.DialogResult.OK)
- {
- textEditor.Text = popupText.TextInfo.Trim();
- }
- }
- private void txtCic_EditorButtonClick(object sender, EditorButtonEventArgs e)
- {
- this.entityGrid1.UpdateData();
- UltraGridRow uRow = this.entityGrid1.ActiveRow;
- if (uRow == null)
- {
- return;
- }
- DataTable dt = ServerHelper.GetData("Core.LgMes.Server.Stuffmanage.FrmGpApplyDecision.doQueryCic",
- new object[] { uRow.Cells["Gradename"].Text }, ob);
- dt.Columns["BASENAME"].Caption = "CIC";
- 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.txtCic.Tag.ToString2()).FirstOrDefault();
- if (actRow != null) actRow.Activate();
- });
- if (baseInfo.ShowDialog() == System.Windows.Forms.DialogResult.OK)
- {
- txtCic.Tag = baseInfo.ChoicedRow.GetValue("BASECODE");
- txtCic.Text = baseInfo.ChoicedRow.GetValue("BASENAME");
- }
- }
- private void chkStove_CheckedChanged(object sender, EventArgs e)
- {
- this.txtStoveNo.Enabled = this.chkStove.Checked;
- }
- private void chkJudgeStoveNo_CheckedChanged(object sender, EventArgs e)
- {
- this.txtJudgeStoveNo.Enabled = this.chkJudgeStoveNo.Checked;
- }
- }
- }
|