| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423 |
- using Core.Mes.Client.Comm.Control;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.Mcp.Common;
- using Core.StlMes.Client.Mcp.Control;
- using Core.StlMes.Client.Mcp.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.Windows.Forms;
- namespace Core.StlMes.Client.Mcp.Coupling
- {
- public partial class FrmWeiTuo : FrmBase
- {
- public FrmWeiTuo()
- {
- InitializeComponent();
- this.IsLoadUserView = true;
- }
- private void FrmWeiTuo_Load(object sender, EventArgs e)
- {
- EntityHelper.ShowGridCaption<CouplingOutsourcResultEntity>(ultraGrid1.DisplayLayout.Bands[0]);
- McpBaseHelper.InitPlineUnit(cmbPlinCode, this.ValidDataPurviewIds, ob, "H");
-
- }
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "DoQuery":
- QuerySinglePlan();//查询计划
- break;
- case "DoComplete":
- DoComplete();//审批通过
- break;
- case "UnDoComplete":
- UnDoComplete();//审批不通过
- break;
- case "OutsourcReturn":
- DoOutsourcReturn();
- break;
- case "Close":
- this.Close();
- break;
- }
- }
- private void QuerySinglePlan()
- {
- string plnNo = "";
- string status = "";
- string plinCode = "";
- string judgeNo = "";
- if (chkwoId.Checked)
- {
- if (txtWoId.Text == "")
- {
- MessageUtil.ShowTips("委托单号不能为空!");
- return;
- }
- else
- {
- plnNo = txtWoId.Text.ToString().Trim();
- }
- }
- if (chkPlin.Checked)
- {
- if (cmbPlinCode.Text == "")
- {
- MessageUtil.ShowTips("生产产线不能为空!");
- return;
- }
- else
- {
- plinCode = cmbPlinCode.Text.Trim().ToString();
- }
- }
- if (chkJuNo.Checked)
- {
- if (txtStatus.Text == "")
- {
- MessageUtil.ShowTips("状态不能为空!");
- return;
- }
- else
- {
- status = txtStatus.Value.ToString();
- }
- }
- if (chkJugeHeatNo.Checked)
- {
- judgeNo = txtJugeNo.Text.ToString().Trim();
- }
- ArrayList list = new ArrayList();
- list.Add(plnNo);
- list.Add(plinCode);
- list.Add(status);
- list.Add(judgeNo);
- List<CouplingOutsourcResultEntity> listSource = EntityHelper.GetData<CouplingOutsourcResultEntity>(
- "com.steering.mes.mcp.coup.FrmWeiTuo.geQueryEntrusted", new object[] { list}, this.ob);
- CouplingOutEntitySource.DataSource = listSource;
- }
- private void chkStarts_CheckedChanged(object sender, EventArgs e)
- {
- if (chkwoId.Checked) { txtWoId.Enabled = true; } else { txtWoId.Enabled = false; }
- if (chkPlin.Checked) { cmbPlinCode.Enabled = true; } else { cmbPlinCode.Enabled = false; }
- if (chkJuNo.Checked) { txtStatus.Enabled = true; } else { txtStatus.Enabled = false; }
- if (chkJugeHeatNo.Checked) { txtJugeNo.Enabled = true; } else { txtJugeNo.Enabled = false; }
- }
- private void ContPublic_KeyDown(object sender, KeyEventArgs e)
- {
- if (e.KeyCode == Keys.Enter)
- {
- QuerySinglePlan();
- }
- }
- /// <summary>
- /// 审批通过
- /// </summary>
- private void DoComplete()
- {
- UltraGridRow row = ultraGrid1.ActiveRow;
- if (row == null) return;
- //ultraGridPlnWork.UpdateData();
- int AddCount = 0;
- ArrayList list = new ArrayList();
- foreach (UltraGridRow urg in ultraGrid1.Rows)
- {
- if (Convert.ToBoolean(urg.Cells["CHK"].Text) == true)
- {
- AddCount += 1;
- ArrayList list1 = new ArrayList();
- if (!row.Cells["EntrustedLog"].Text.ToString().Equals("已申请"))
- {
- MessageUtil.ShowTips("选中的委外单不是已申请状态,不能审批通过!");
- return;
- }
- list1.Add(urg.Cells["EntrustedNo"].Text.ToString());
- list.Add(list1);
- }
- }
- if (AddCount == 0) { MessageUtil.ShowTips("请选中要审批的委托单!"); return; }
- if (MessageUtil.ShowYesNoAndQuestion("是否审批委托?") == DialogResult.No)
- {
- return;
- }
- CoreClientParam ccp = new CoreClientParam();
- try
- {
- this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
- if (Constant.WaitingForm == null)
- {
- Constant.WaitingForm = new WaitingForm();
- }
- Constant.WaitingForm.ShowToUser = true;
- Constant.WaitingForm.Show();
- Constant.WaitingForm.Update();
- ccp.ServerName = "com.steering.mes.mcp.coup.FrmWeiTuo";
- ccp.MethodName = "commEntrustedResult";
- ccp.ServerParams = new object[] { list,this.UserInfo.GetUserName() };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- this.Cursor = Cursors.Default;
- Constant.WaitingForm.ShowToUser = false;
- Constant.WaitingForm.Close();
- Constant.WaitingForm = null;
- }
- catch (Exception ex)
- {
- this.Cursor = Cursors.Default;
- Constant.WaitingForm.ShowToUser = false;
- Constant.WaitingForm.Close();
- Constant.WaitingForm = null;
- }
- if (ccp.ReturnCode == -1) return;
- MessageUtil.ShowTips(ccp.ReturnInfo);
- if (ccp.ReturnInfo.Equals("审批通过!"))
- {
- QuerySinglePlan();
- }
- }
- /// <summary>
- /// 审批不通过
- /// </summary>
- private void UnDoComplete()
- {
- UltraGridRow row = ultraGrid1.ActiveRow;
- if (row == null) return;
- //ultraGridPlnWork.UpdateData();
- int AddCount = 0;
- ArrayList list = new ArrayList();
- foreach (UltraGridRow urg in ultraGrid1.Rows)
- {
- if (Convert.ToBoolean(urg.Cells["CHK"].Text) == true)
- {
- AddCount += 1;
- ArrayList list1 = new ArrayList();
- if (!row.Cells["EntrustedLog"].Text.ToString().Equals("已申请"))
- {
- MessageUtil.ShowTips("选中的委外单不是已申请状态,不能审批不通过!");
- return;
- }
- list1.Add(urg.Cells["EntrustedNo"].Text.ToString());
- list.Add(list1);
- }
- }
- if (AddCount == 0) { MessageUtil.ShowTips("请选中要审批的委托单!"); return; }
- if (MessageUtil.ShowYesNoAndQuestion("是否审批?") == DialogResult.No)
- {
- return;
- }
- CoreClientParam ccp = new CoreClientParam();
- try
- {
- this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
- if (Constant.WaitingForm == null)
- {
- Constant.WaitingForm = new WaitingForm();
- }
- Constant.WaitingForm.ShowToUser = true;
- Constant.WaitingForm.Show();
- Constant.WaitingForm.Update();
- ccp.ServerName = "com.steering.mes.mcp.coup.FrmWeiTuo";
- ccp.MethodName = "kownCommEntrustedResult";
- ccp.ServerParams = new object[] { list,this.UserInfo.GetUserName() };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- this.Cursor = Cursors.Default;
- Constant.WaitingForm.ShowToUser = false;
- Constant.WaitingForm.Close();
- Constant.WaitingForm = null;
- }
- catch (Exception ex)
- {
- this.Cursor = Cursors.Default;
- Constant.WaitingForm.ShowToUser = false;
- Constant.WaitingForm.Close();
- Constant.WaitingForm = null;
- }
- if (ccp.ReturnCode == -1) return;
- MessageUtil.ShowTips(ccp.ReturnInfo);
- if (ccp.ReturnInfo.Equals("审批不通过!"))
- {
- QuerySinglePlan();
- }
- }
- /// <summary>
- /// 委外回报
- /// </summary>
- private void DoOutsourcReturn()
- {
- this.ultraGrid1.UpdateData();
- IQueryable<UltraGridRow> checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
- if (checkMagRows.Count() == 0)
- {
- MessageUtil.ShowTips("请勾选需要回报的委外信息!");
- return;
- }
- ArrayList parm2 = new ArrayList();
- foreach (UltraGridRow row in checkMagRows)
- {
- if (!row.Cells["EntrustedLog"].Text.ToString().Equals("审批通过"))
- {
- MessageUtil.ShowTips("选中的委外单不是审批通过状态,不能委外回报!");
- return;
- }
- //if (row.Cells["EntrustedLog"].Text.ToString().Equals("回报完毕"))
- //{
- // MessageUtil.ShowTips("选中的委外单已回报,不能重复委外回报!");
- // return;
- //}
- if (row.Cells["SubcontractcompleteNum"].Value.ToString().Equals("0"))
- {
- MessageUtil.ShowTips("请输入委外回报支数!");
- return;
- }
- if (row.Cells["SubcontractcompleteWt"].Value.ToString().Equals("0"))
- {
- MessageUtil.ShowTips("请输入委外回报重量!");
- return;
- }
- ArrayList parm = new ArrayList();
- parm.Add(row.Cells["SubcontractcompleteNum"].Value.ToString());
- parm.Add(row.Cells["SubcontractcompleteWt"].Value.ToString());
- parm.Add(row.Cells["HbFpNum"].Text.ToString());
- parm.Add(row.Cells["HbFpWt"].Text.ToString());
- parm.Add(row.Cells["EntrustedNo"].Text.ToString());
- parm2.Add(parm);
- }
- if (MessageUtil.ShowYesNoAndQuestion("是否确认委外回报?") == DialogResult.No) return;
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.mcp.coup.FrmWeiTuo";
- ccp.MethodName = "doOutsourcReturn";
- ccp.ServerParams = new object[] { parm2,this.UserInfo.GetUserName() };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- if (ccp.ReturnInfo.Equals("委外回报成功!"))
- {
- QuerySinglePlan();
- }
- }
- }
- private void ultraGrid1_CellChange(object sender, CellEventArgs e)
- {
- UltraGridRow row=ultraGrid1.ActiveRow;
- if(row==null)return;
- //委外回报合格支
- if (e.Cell.Column.Key.Equals("SubcontractcompleteNum"))
- {
- if (e.Cell.Row.Cells["SubcontractcompleteNum"].Value == null)
- {
- e.Cell.Row.Cells["SubcontractcompleteNum"].Value = "0";
- }
- else
- {
- ultraGrid1.UpdateData();
- string hbConNum = e.Cell.Row.Cells["SubcontractcompleteNum"].Value.ToString();
- if (!StringUtil.IsInt(hbConNum) || hbConNum == "0")
- {
- e.Cell.Row.Cells["SubcontractcompleteNum"].Value = "0";
- }
- if (int.Parse(e.Cell.Row.Cells["SubcontractcompleteNum"].Value.ToString()) > int.Parse(e.Cell.Row.Cells["EntrustedNum1"].Value.ToString()))
- {
- if (!row.Cells["StationCode"].Text.ToString().Equals("700301"))
- {
- e.Cell.Row.Cells["SubcontractcompleteNum"].Value = "0";
- }
- }
- if (!row.Cells["StationCode"].Text.ToString().Equals("700301"))
- {
- e.Cell.Row.Cells["SubcontractcompleteWt"].Value = ((double.Parse(e.Cell.Row.Cells["EntrustedWt1"].Value.ToString()) / int.Parse(e.Cell.Row.Cells["EntrustedNum1"].Value.ToString())) * int.Parse(e.Cell.Row.Cells["SubcontractcompleteNum"].Value.ToString())).ToString("f3");
- e.Cell.Row.Cells["HbFpNum"].Value = (int.Parse(e.Cell.Row.Cells["EntrustedNum1"].Value.ToString()) - int.Parse(e.Cell.Row.Cells["SubcontractcompleteNum"].Value.ToString())).ToString();
- e.Cell.Row.Cells["HbFpWt"].Value = (double.Parse(e.Cell.Row.Cells["EntrustedWt1"].Value.ToString()) - double.Parse(e.Cell.Row.Cells["SubcontractcompleteWt"].Value.ToString())).ToString("f3");
- }
- }
- }
- //委外回报合格吨
- if (e.Cell.Column.Key.Equals("SubcontractcompleteWt"))
- {
- if (e.Cell.Row.Cells["SubcontractcompleteWt"].Value == null)
- {
- e.Cell.Row.Cells["SubcontractcompleteWt"].Value = "0";
- }
- else
- {
- ultraGrid1.UpdateData();
- string hbConWt = e.Cell.Row.Cells["SubcontractcompleteWt"].Value.ToString();
- if (!StringUtil.IsFloat(hbConWt) || hbConWt == "0")
- {
- e.Cell.Row.Cells["SubcontractcompleteWt"].Value = "0";
- }
- if (double.Parse(e.Cell.Row.Cells["SubcontractcompleteWt"].Value.ToString()) > double.Parse(e.Cell.Row.Cells["EntrustedWt1"].Text.ToString()))
- {
- if (!row.Cells["StationCode"].Text.ToString().Equals("700301"))
- {
- e.Cell.Row.Cells["SubcontractcompleteWt"].Value = "0";
- }
- }
- if (!row.Cells["StationCode"].Text.ToString().Equals("700301"))
- {
- e.Cell.Row.Cells["HbFpWt"].Value = (double.Parse(e.Cell.Row.Cells["EntrustedWt1"].Text.ToString()) - double.Parse(e.Cell.Row.Cells["SubcontractcompleteWt"].Value.ToString())).ToString("f3");
- }
- }
- }
- //委外回报废品个
- if (e.Cell.Column.Key.Equals("HbFpNum"))
- {
- if (e.Cell.Row.Cells["HbFpNum"].Value == null)
- {
- e.Cell.Row.Cells["HbFpNum"].Value = "0";
- }
- else
- {
- ultraGrid1.UpdateData();
- string hbConWt = e.Cell.Row.Cells["HbFpNum"].Value.ToString();
- if (!StringUtil.IsFloat(hbConWt) || hbConWt == "0")
- {
- e.Cell.Row.Cells["HbFpNum"].Value = "0";
- }
- }
- }
- //委外回报废品吨
- if (e.Cell.Column.Key.Equals("HbFpWt"))
- {
- if (e.Cell.Row.Cells["HbFpWt"].Value == null)
- {
- e.Cell.Row.Cells["HbFpWt"].Value = "0";
- }
- else
- {
- ultraGrid1.UpdateData();
- string hbConWt = e.Cell.Row.Cells["HbFpWt"].Value.ToString();
- if (!StringUtil.IsFloat(hbConWt) || hbConWt == "0")
- {
- e.Cell.Row.Cells["HbFpWt"].Value = "0";
- }
- }
- }
- }
- }
- }
|