| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507 |
- 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 Core.Mes.Client.Comm.Server;
- using CoreFS.CA06;
- using System.Collections;
- using Core.Mes.Client.Comm.Control;
- using Infragistics.Win.UltraWinGrid;
- using Core.Mes.Client.Comm.Tool;
- using Infragistics.Win;
- using Infragistics.Win.UltraWinEditors;
- using Core.StlMes.Client.Mcp.Entity;
- using Core.StlMes.Client.Mcp.Control;
- namespace Core.StlMes.Client.Mcp.Coupling
- {
- public partial class FrmCouplingConfirm : FrmBase
- {
- public FrmCouplingConfirm()
- {
- InitializeComponent();
- this.IsLoadUserView = true;
- }
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "DoQuery":
- DoQuery();
- break;
- case "Confirm":
- Confirm();
- break;
- case "CancelConfirm":
- cancelConfirm();
- break;
- case "DoDelete":
- DoDelete();
- break;
- case "Export":
- GridHelper.ulGridToExcel(ultraGrid1, "接箍入库确认");
- break;
- case "DoClose":
- this.Close();
- break;
- }
- }
- /// <summary>
- /// 查询
- /// </summary>
- private void DoQuery()
- {
- string[] starts = { };
- string woId = "";//工单号
- string judgeStoveNo = "";//炉号
- string txtShift = "";//班次
- string txtConfirm = "";//是否确认
- string startTim = "";
- string endTim = "";
- #region 条件
- 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");
- }
- }
- if (chkStarts.Checked)
- {
- if (string.IsNullOrEmpty(cmbStarts.Text.Trim()))
- {
- MessageUtil.ShowTips("请选择工单状态!");
- return;
- }
- else
- {
- starts = (cmbStarts.Value as List<object>).Select(p => p.ToString().Trim()).ToArray();
- }
- }
- if (chkwoId.Checked)
- {
- if (chkwoId.Checked && string.IsNullOrEmpty(txtWoId.Text.Trim()))
- {
- MessageUtil.ShowTips("请输入工单号!");
- return;
- }
- else
- {
- woId = txtWoId.Text.ToString().Trim();
- }
- }
- if (chkJuNo.Checked)
- {
- if (chkJuNo.Checked && string.IsNullOrEmpty(txtJudgeStoveNO.Text.Trim()))
- {
- MessageUtil.ShowTips("请输入炉号!");
- return;
- }
- else
- {
- judgeStoveNo = txtJudgeStoveNO.Text.ToString().Trim();
- }
- }
- if (chkshift.Checked)
- {
- if (chkshift.Checked && string.IsNullOrEmpty(shift.Text.Trim()))
- {
- MessageUtil.ShowTips("请输入班次!");
- return;
- }
- else
- {
- if (string.IsNullOrEmpty(shift.Text.Trim()))
- {
- txtShift = "";
- }
- else
- {
- txtShift = shift.Value.ToString().Trim();
- }
- }
- }
-
- if (chkconfirm.Checked && string.IsNullOrEmpty(confirm.Text.Trim()))
- {
- MessageUtil.ShowTips("请选择是否确认!");
- return;
- }
- else
- {
- if(confirm.Text.ToString().Trim().Equals("确认"))
- {
- txtConfirm = "1";
- }
- else if (confirm.Text.ToString().Trim().Equals("未确认"))
- {
- txtConfirm = "0";
- }
- else
- {
- txtConfirm = "";
- }
- }
- #endregion
- List<PlnZyJgWorkMidbillEntity> listSource1 = EntityHelper.GetData<PlnZyJgWorkMidbillEntity>
- ("com.steering.mes.mcp.coup.PhosphateResultService.getphosInResult", new object[] { startTim, endTim,starts, woId, judgeStoveNo, txtShift, txtConfirm }, this.ob);
- couplingbindingSource.DataSource = listSource1;
- GridHelper.RefreshAndAutoSize(ultraGrid1);
- foreach (UltraGridRow urg in ultraGrid1.Rows)
- {
- if (urg.Cells["Matconfirm"].Value.Equals("确认"))
- {
- urg.Appearance.BackColor = Color.LightGreen;
- }
- }
- }
- /// <summary>
- /// 确认
- /// </summary>
- private void Confirm()
- {
- ultraGrid1.UpdateData();
- UltraGridRow uRow = this.ultraGrid1.ActiveRow;
- if (uRow == null) { MessageUtil.ShowTips("无数据!"); return; }
- ArrayList list1 = new ArrayList();
- int UpdaCount = 0;
- foreach (UltraGridRow ugr in ultraGrid1.Rows)
- {
- if (Convert.ToBoolean(ugr.Cells["CHK"].Text) == true)
- {
- if (ugr.Cells["Matconfirm"].Value.ToString().Equals("1"))
- {
- MessageUtil.ShowTips("选中有已确认实绩,不允许再次确认!");
- return;
- }
- string firm = "";
- string shift = "";
- if (ugr.Cells["Matconfirm"].Value.ToString().Equals("确认"))
- {
- firm = "1";
- }
- else
- {
- firm = "0";
- }
- if (ugr.Cells["ColShift"].Value.ToString().Equals("早班"))
- {
- shift = "1";
- }
- else if (ugr.Cells["ColShift"].Value.ToString().Equals("中班"))
- {
- shift = "2";
- }
- else if (ugr.Cells["ColShift"].Value.ToString().Equals("晚班"))
- {
- shift = "3";
- }
- else
- {
- shift = "4";
- }
- UpdaCount += 1;
- ArrayList list = new ArrayList();
- list.Add(ugr.Cells["WoId"].Text.ToString());
- list.Add(shift);
- list.Add(ugr.Cells["JudgeStoveNo"].Value.ToString());
- list.Add(ugr.Cells["BatchNo"].Value.ToString());
- list.Add(firm);
- list.Add(UserInfo.GetUserName());
- list.Add(DateTime.Now.ToString());
- list.Add(ugr.Cells["CreateTime"].Value.ToString());
- //list.Add(ugr.Cells[""])
- list1.Add(list);
- }
- }
- if (UpdaCount == 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.PhosphateResultService";
- ccp.MethodName = "getMatConfirm";
- ccp.ServerParams = new object[] { list1 };
- ccp = ob.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)
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- if (ccp.ReturnInfo.Equals("确认成功!"))
- {
- DoQuery();
- }
- }
- }
- ///
- /// 取消确认
- ///
- private void cancelConfirm()
- {
- ultraGrid1.UpdateData();
- UltraGridRow uRow = this.ultraGrid1.ActiveRow;
- if (uRow == null) { MessageUtil.ShowTips("无数据!"); return; }
- ArrayList list1 = new ArrayList();
- int UpdaCount = 0;
- foreach (UltraGridRow ugr in ultraGrid1.Rows)
- {
- if (Convert.ToBoolean(ugr.Cells["CHK"].Text) == true)
- {
- if (ugr.Cells["Matconfirm"].Value.ToString().Equals("0"))
- {
- MessageUtil.ShowTips("选中有没确认实绩,不允许取消确认!");
- return;
- }
- UpdaCount += 1;
- string firm = "";
- string shift = "";
- if (ugr.Cells["Matconfirm"].Value.ToString().Equals("确认"))
- {
- firm = "1";
- }
- else
- {
- firm = "0";
- }
- if (ugr.Cells["ColShift"].Value.ToString().Equals("早班"))
- {
- shift = "1";
- }
- else if (ugr.Cells["ColShift"].Value.ToString().Equals("中班"))
- {
- shift = "2";
- }
- else
- {
- shift = "3";
- }
- ArrayList list = new ArrayList();
- list.Add(ugr.Cells["WoId"].Text.ToString());
- list.Add(shift);
- list.Add(ugr.Cells["JudgeStoveNo"].Value.ToString());
- list.Add(ugr.Cells["BatchNo"].Value.ToString());
- list.Add(firm);
- list.Add(UserInfo.GetUserName());
- list.Add(DateTime.Today.ToString());
- list.Add(ugr.Cells["CreateTime"].Value.ToString());
- list1.Add(list);
- }
- }
- if (UpdaCount == 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.PhosphateResultService";
- ccp.MethodName = "getCancelMatConfirm";
- ccp.ServerParams = new object[] { list1 };
- ccp = ob.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)
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- if (ccp.ReturnInfo.Equals("取消确认成功!"))
- {
- DoQuery();
- }
- }
- }
- /// <summary>
- /// 修改
- /// </summary>
- private void DoUpdate()
- {
- ultraGrid1.UpdateData();
- int updateCount = 0;
- ArrayList list1 = new ArrayList();
- string dtime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
- string flag = "";
- foreach (UltraGridRow ugr in ultraGrid1.Rows)
- {
- if (Convert.ToBoolean(ugr.Cells["CHK"].Text) == true)
- {
- flag = "1";
- if (ugr.Cells["MACHINE_NO"].Text.Trim().Equals("")) { MessageUtil.ShowTips("请输入机床编号!"); return; }
- updateCount += 1;
- ArrayList list = new ArrayList();
- list.Add(ugr.Cells["MACHINE_NO"].Text.ToString());
- list.Add(this.UserInfo.GetUserName());
- list.Add(dtime);
- list.Add(ugr.Cells["MACHINE_NO"].Value.ToString());
- list.Add(ugr.Cells["MACHINE_NO"].Value.ToString());
- list1.Add(list);
- }
- }
- ArrayList list2 = new ArrayList();
- foreach (UltraGridRow ugr in ultraGrid1.Rows)
- {
- if (Convert.ToBoolean(ugr.Cells["CHK"].Text) == true)
- {
- flag = "2";
- updateCount += 1;
- UltraGridRow row = ultraGrid1.ActiveRow;
- if (row == null) { MessageUtil.ShowTips("机床信息不能为空"); return; }
- ArrayList list = new ArrayList();
- if (ugr.Cells["PRO_BZ"].Text.ToString().Equals(""))
- {
- MessageUtil.ShowTips("班组不能为空");
- return;
- }
- list.Add(row.Cells["MACHINE_NO"].Value.ToString());
- //list.Add(row.Cells["PLINE_NO"].Value.ToString());
- list.Add("700305");
- list.Add(ugr.Cells["MACHINE_USER1"].Text.Trim().ToString());
- list.Add(ugr.Cells["MACHINE_USER2"].Text.Trim().ToString());
- list.Add(ugr.Cells["PRO_BZ"].Value.ToString());
- list.Add(this.UserInfo.GetUserName());
- list.Add(dtime);
- list.Add(ugr.Cells["ID"].Value.ToString());
- list2.Add(list);
- }
- }
- if (updateCount == 0) { MessageUtil.ShowTips("请选择修改数据!"); return; }
- if (MessageUtil.ShowYesNoAndQuestion("是否修改?") == DialogResult.No) { return; }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.mcp.coup.FrmMachine";
- ccp.MethodName = "getUpdatePhosphateItem";
- ccp.ServerParams = new object[] { list1, list2, flag };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode == -1) return;
- MessageUtil.ShowTips(ccp.ReturnInfo);
- if (ccp.ReturnInfo.Equals("修改成功!"))
- {
- DoQuery();
- }
- }
- /// <summary>
- /// 删除
- /// </summary>
- private void DoDelete()
- {
- ultraGrid1.UpdateData();
- int updateCount = 0;
- ArrayList list1 = new ArrayList();
- ArrayList list2 = new ArrayList();
- string flag = "";
- foreach (UltraGridRow ugr in ultraGrid1.Rows)
- {
- if (Convert.ToBoolean(ugr.Cells["CHK"].Text) == true)
- {
- flag = "1";
- updateCount += 1;
- ArrayList list = new ArrayList();
- list.Add(ugr.Cells["MACHINE_NO"].Value.ToString());
- //list.Add(ugr.Cells["PLINE_NO"].Value.ToString());
- list.Add("700305");
- list1.Add(list);
- }
- }
- foreach (UltraGridRow ugr in ultraGrid1.Rows)
- {
- if (Convert.ToBoolean(ugr.Cells["CHK"].Text) == true)
- {
- flag = "2";
- updateCount += 1;
- ArrayList list = new ArrayList();
- list.Add(ugr.Cells["ID"].Value.ToString());
- list2.Add(list);
- }
- }
- if (updateCount == 0) { MessageUtil.ShowTips("请选择要删除的数据!"); return; }
- if (MessageUtil.ShowYesNoAndQuestion("是否删除?") == DialogResult.No) { return; }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.mcp.coup.FrmMachine";
- ccp.MethodName = "getDeletePhosphateItem";
- ccp.ServerParams = new object[] { list1,list2, flag };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode == -1) return;
- MessageUtil.ShowTips(ccp.ReturnInfo);
- if (ccp.ReturnInfo.Equals("删除成功!"))
- {
- DoQuery();
- }
- }
- private void FrmCouplingConfirm_Load(object sender, EventArgs e)
- {
- EntityHelper.ShowGridCaption<PlnZyJgWorkMidbillEntity>(ultraGrid1.DisplayLayout.Bands[0]);
- PipeManageClass.setUltraGridColumnInput(ultraGrid1, new string[] { "LhNum" });//支数
- this.IsLoadUserView = true;
- }
- private void chkStarts_CheckedChanged(object sender, EventArgs e)
- {
- if (chkStarts.Checked) { cmbStarts.Enabled = true; } else { cmbStarts.Enabled = false; }
- if (chkJuNo.Checked) { txtJudgeStoveNO.Enabled = true; } else { txtJudgeStoveNO.Enabled = false; }
- if (chkshift.Checked) { shift.Enabled = true; } else { shift.Enabled = false; }
- if (chkwoId.Checked) { txtWoId.Enabled = true; } else { txtWoId.Enabled = false; }
- }
- }
- }
|