| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297 |
- using Core.Mes.Client.Comm.Control;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.ZGMil.Common;
- 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.Windows.Forms;
- namespace Core.StlMes.Client.ZGMil.Report
- {
- public partial class FrmUpdateYearMonthAndBelongNameGX : FrmBase
- {
- private string departm = "";
- private string[] plineCode = null;
- private string[] arr = null;
- private string[] arrId;//数据权限
- public FrmUpdateYearMonthAndBelongNameGX()
- {
- InitializeComponent();
- this.IsLoadUserView = true;
- }
- private void FrmUpdateYearMonthAndBelongNameGX_Load(object sender, EventArgs e)
- {
- NativeMethodNew na = new NativeMethodNew(this.ob);
- departm = UserInfo.GetDepartment();
- plineCode = BaseMethod.GetPlineCode(this.ValidDataPurviewIds,this.ob);//获取 用户 对应的产线
- arr = BaseMethod.InitPermissions(this.ValidDataPurviewIds,ob);
- arrId = this.ValidDataPurviewIds;//获取数据权限
- }
- /// <summary>
- /// 重写基类方法
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="ToolbarKey"></param>
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "Query":
- doQuery();
- break;
- case "UpdateYearMonth":
- doUpdateYearMonth();
- break;
- case "UpdateBelongName":
- doUpdateBelongName();
- break;
- case "Export":
- ExportData();
- break;
- case "Close":
- this.Close();
- break;
- }
- }
- /// <summary>
- /// 调整所属权
- /// </summary>
- private void doUpdateBelongName()
- {
- ultraGrid1.UpdateData();
- UltraGridRow row = ultraGrid1.ActiveRow;
- if (row == null) { MessageUtil.ShowTips("无数据!"); return; }
- int count = 0;
- ArrayList list = new ArrayList();
- foreach (UltraGridRow ugr in ultraGrid1.Rows)
- {
- if (Convert.ToBoolean(ugr.Cells["CHK"].Text) == true)
- {
- count += 1;
- if (ugr.Cells["TARGET"].Value.ToString().Equals("A"))
- {
- MessageUtil.ShowTips("产品标识为【A】的不可调整所属权!");
- return;
- }
- ArrayList pram = new ArrayList();
- pram.Add(ugr.Cells["BELONG_NAME_JUGDE"].Value.ToString());
- pram.Add(ugr.Cells["JUGDE_APPLY_CODE"].Value.ToString());
- pram.Add(ugr.Cells["JUDGE_STOVE_NO"].Value.ToString());
- pram.Add(ugr.Cells["BATCH_NO"].Value.ToString());
- pram.Add(ugr.Cells["BATCH_GROUD_NO"].Value.ToString());
- pram.Add(ugr.Cells["QUALITY_GROUP"].Value.ToString());
- pram.Add(ugr.Cells["MAT_GOWHERE_NAME"].Value.ToString());
- pram.Add(ugr.Cells["PLINE_CODE"].Value.ToString());
- list.Add(pram);
- }
- }
- if (count == 0 || count > 1)
- {
- MessageUtil.ShowTips("请选择一条需要修改的数据!");
- return;
- }
- if (MessageUtil.ShowYesNoAndQuestion("是否修改?") == DialogResult.No)
- {
- return;
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.zgmil.report.FrmUpdateBalYearMonth";
- ccp.MethodName = "doUpdateBelongName";
- ccp.ServerParams = new object[] { list };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- if (ccp.ReturnInfo.Equals("修改成功!"))
- {
- doQuery();
- }
- }
- }
- /// <summary>
- /// 查询
- /// </summary>
- private void doQuery()
- {
- string JudgeStoveNo = "";
- string barYearMonth = "";
- if (chkJudgeStoveNo.Checked)
- {
- if (uteJudgeStoveNo.Text.Trim() == "")
- {
- JudgeStoveNo = "";
- }
- else
- {
- JudgeStoveNo = uteJudgeStoveNo.Value.ToString();
- }
- }
- if (chkBalYearMonth.Checked)
- {
- if (BAL_YEAR_MONTH.Text.Trim() == "")
- {
- barYearMonth = "";
- }
- else
- {
- barYearMonth = BAL_YEAR_MONTH.Value.ToString("yyyyMM");
- }
- }
- WaitingForm2 wf = new WaitingForm2("正在加载,请稍候....");
- DataTable dt = new DataTable();
- dt = ServerHelper.GetData("com.steering.mes.zgmil.report.FrmUpdateBalYearMonth.getApplyBalYearMonthGX", new Object[] { barYearMonth, JudgeStoveNo, this.CustomInfo.ToString(), plineCode }, this.ob);
-
- GridHelper.CopyDataToDatatable(dt, this.dataTable1, true);
- GridHelper.RefreshAndAutoSize(this.ultraGrid1);
- wf.Close();
- }
- /// <summary>
- /// 调整结转年月
- /// </summary>
- private void doUpdateYearMonth()
- {
- ultraGrid1.UpdateData();
- UltraGridRow row = ultraGrid1.ActiveRow;
- if (row == null) { MessageUtil.ShowTips("无数据!"); return; }
- int count = 0;
- ArrayList list = new ArrayList();
- foreach (UltraGridRow ugr in ultraGrid1.Rows)
- {
- if (Convert.ToBoolean(ugr.Cells["CHK"].Text) == true)
- {
- count += 1;
- //if (ugr.Cells["INSTOCK_FLAG"].Text.ToString().Equals("未确认"))
- //{
- // MessageUtil.ShowTips("缴库标志未确认,不允许调整结转年月!");
- // return;
- //}
- //if (ugr.Cells["TARGET"].Value.ToString().Equals("A") && ugr.Cells["INSTOCK_FLAG"].Text.ToString().Equals("已确认"))
- //{
- // MessageUtil.ShowTips("缴库标志已确认,不允许调整结转年月!");
- // return;
- //}
-
- ArrayList pram = new ArrayList();
-
- string bal = DateTime.Parse(ugr.Cells["BAL_YEAR_MONTH"].Text).ToString("yyyyMM");
- pram.Add(bal);
- pram.Add(ugr.Cells["JUGDE_APPLY_CODE"].Value.ToString());
- pram.Add(ugr.Cells["JUDGE_STOVE_NO"].Value.ToString());
- pram.Add(ugr.Cells["BATCH_NO"].Value.ToString());
- pram.Add(ugr.Cells["BATCH_GROUD_NO"].Value.ToString());
- pram.Add(ugr.Cells["QUALITY_GROUP"].Value.ToString());
- pram.Add(ugr.Cells["MAT_GOWHERE_NAME"].Value.ToString());
- pram.Add(ugr.Cells["TARGET"].Value.ToString());
- pram.Add(ugr.Cells["PLINE_CODE"].Value.ToString());
- pram.Add(DateTime.Parse(ugr.Cells["BAL_YEAR_MONTH"].Text).ToString("yyyy-MM"));
- pram.Add(ugr.Cells["INSTOCK_FLAG"].Text.ToString());
-
- list.Add(pram);
- }
- }
- if (count == 0 )
- {
- MessageUtil.ShowTips("请选择需要修改的数据!");
- return;
- }
- if (MessageUtil.ShowYesNoAndQuestion("是否修改?") == DialogResult.No)
- {
- return;
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.zgmil.report.FrmUpdateBalYearMonth";
- ccp.MethodName = "doUpdateYearMonth";
- ccp.ServerParams = new object[] { list };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- if (ccp.ReturnInfo.Equals("修改成功!"))
- {
- doQuery();
- }
- }
- }
-
- /// <summary>
- /// 查询条件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void chkDate_CheckedChanged(object sender, EventArgs e)
- {
- if (chkBalYearMonth.Checked) { BAL_YEAR_MONTH.Enabled = true; } else { BAL_YEAR_MONTH.Enabled = false; }
- //if (chkLotNo.Checked) { uteLotNo.Enabled = true; } else { uteLotNo.Enabled = false; }
- if (chkJudgeStoveNo.Checked) { uteJudgeStoveNo.Enabled = true; } else { uteJudgeStoveNo.Enabled = false; }
- }
- /// <summary>
- /// 导出
- /// </summary>
- private void ExportData()
- {
- GridHelper.ulGridToExcel(ultraGrid1, "轧管投入产出报表");
- }
- private void ultraGrid1_InitializeLayout(object sender, InitializeLayoutEventArgs e)
- {
- foreach (UltraGridRow uRow in ultraGrid1.Selected.Rows)
- {
- if (uRow.GetType() != typeof(Infragistics.Win.UltraWinGrid.UltraGridGroupByRow))
- {
- uRow.Cells["CHK"].Value = true;
- }
- }
- }
- private void ultraGrid1_KeyUp(object sender, KeyEventArgs e)
- {
- BaseMethod.setGridCopyActColumn(ultraGrid1, e, "BAL_YEAR_MONTH");
- }
- private void ultraGrid1_AfterSelectChange(object sender, AfterSelectChangeEventArgs e)
- {
- foreach (UltraGridRow uRow in ultraGrid1.Selected.Rows)
- {
- if (uRow.GetType() != typeof(Infragistics.Win.UltraWinGrid.UltraGridGroupByRow))
- {
- uRow.Cells["CHK"].Value = true;
- }
- }
- }
- }
- }
|