| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196 |
- using Core.Mes.Client.Comm.Control;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Tool;
- 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.YdmBcPipeManage
- {
- public partial class FrmBcRunTimeReport : FrmBase
- {
- public FrmBcRunTimeReport()
- {
- InitializeComponent();
- }
- private string[] belongArr = null;//所属权
- private void FrmBcRunTimeReport_Load(object sender, EventArgs e)
- {
- this.dataYearMoth.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM"));
- belongArr = this.ValidDataPurviewIds;
- }
-
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "Query":
- queryData();
- break;
- case "Export":
- exportData();
- break;
- case "InsertInital":
- insertInital();
- break;
- case "Close":
- this.Close();
- break;
- }
- }
- private void queryData()
- {
- string bathYearMoth = this.dataYearMoth.Value.ToString("yyyyMM");
- try
- {
- this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
- if (Constant.WaitingForm == null)
- {
- Constant.WaitingForm = new WaitingForm();
- }
- Constant.WaitingForm.ShowToUser = true;
- Constant.WaitingForm.Show();
- Constant.WaitingForm.Update();
- DataTable dt = ServerHelper.GetData("com.steering.ydm.bc.report.FrmBcRunTimeReport.queryDataRun", new object[] { bathYearMoth, belongArr,this.CustomInfo }, ob);
- GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true);
- this.SetStaticsInfo();
- CommonMethod.SetGridSumArea(this.ultraGrid1);
- this.Cursor = Cursors.Default;
- Constant.WaitingForm.ShowToUser = false;
- Constant.WaitingForm.Close();
- Constant.WaitingForm = null;
- }
- catch (Exception e)
- {
- this.Cursor = Cursors.Default;
- Constant.WaitingForm.ShowToUser = false;
- Constant.WaitingForm.Close();
- Constant.WaitingForm = null;
- }
- }
- private void SetStaticsInfo()
- {
- try
- {
- if (this.ultraGrid1.Rows.Count == 0)
- {
- this.ultraGrid1.DisplayLayout.Bands[0].Summaries.Clear();
- }
- else
- {
- ArrayList alist = new ArrayList();
- alist.Add("ORIGINAL_AMOUNT");
- alist.Add("ORIGINAL_COUNT");
- alist.Add("MONTH_1");
- alist.Add("MONTH_1COUNT");
- alist.Add("MONTH_2");
- alist.Add("MONTH_2COUNT");
- alist.Add("END_AMOUNT");
- alist.Add("END_COUNT");
- alist.Add("HC_COUNT");
- alist.Add("HC_WGT");
- alist.Add("GP_COUNT");
- alist.Add("GP_WGT");
- alist.Add("GPC_COUNT");
- alist.Add("GPC_WGT");
- CommonMethod.SetStaticsInfoSum(ref this.ultraGrid1, alist, true);
- }
- }
- catch { }
- }
- private void insertInital()
- {
- this.ultraGrid1.UpdateData();
- string nowTim = this.dataYearMoth.Value.ToString("yyyyMM");
- UltraGridRow uRow = this.ultraGrid1.ActiveRow;
- if (uRow == null)
- {
- MessageUtil.ShowTips("无期末数据,无法结转!");
- return;
- }
- DataTable ds = ServerHelper.GetData("com.steering.ydm.bc.report.FrmBcRunTimeReport.doQueryInialData", new object[] { nowTim,this.CustomInfo }, ob);
- if (int.Parse(ds.Rows[0][0].ToString()) > 0)
- {
- MessageUtil.ShowTips("已存在下月结转数据,不允许重复结转!");
- return;
- }
- ArrayList parm = new ArrayList();
- if (MessageUtil.ShowYesNoAndQuestion("是否结转期初数据?") == DialogResult.No) return;
- try
- {
- this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
- if (Constant.WaitingForm == null)
- {
- Constant.WaitingForm = new WaitingForm();
- }
- Constant.WaitingForm.ShowToUser = true;
- Constant.WaitingForm.Show();
- Constant.WaitingForm.Update();
- foreach (UltraGridRow row in ultraGrid1.Rows)
- {
- ArrayList list = new ArrayList();
- if (int.Parse(row.Cells["END_COUNT"].Value.ToString()) != 0)
- {
- //row.Cells["STOVE_NO"].Text.ToString()
- //row.Cells["JUDGE_STOVE_NO"].Value.ToString()
- list.Add(row.Cells["JUDGE_STOVE_NO"].Text.ToString());
- list.Add(row.Cells["BATCH_NO"].Value.ToString());
- list.Add(row.Cells["END_COUNT"].Value.ToString());
- list.Add(row.Cells["END_AMOUNT"].Value.ToString());
- list.Add(row.Cells["PROCESS_CDOE"].Value.ToString());
- list.Add(row.Cells["PLINE_CODE"].Value.ToString());
- list.Add(row.Cells["MATERIAL_NAME"].Value.ToString());
- parm.Add(list);
- }
-
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.ydm.bc.report.FrmBcRunTimeReport";
- ccp.MethodName = "insertInital";
- ccp.ServerParams = new object[] { parm, nowTim,this.UserInfo.GetUserName(),this.CustomInfo };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("期初数据结转成功!"))
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- this.Cursor = Cursors.Default;
- Constant.WaitingForm.ShowToUser = false;
- Constant.WaitingForm.Close();
- Constant.WaitingForm = null;
- }
- catch (Exception e)
- {
- this.Cursor = Cursors.Default;
- Constant.WaitingForm.ShowToUser = false;
- Constant.WaitingForm.Close();
- Constant.WaitingForm = null;
- }
- }
- private void exportData()
- {
- GridHelper.ulGridToExcel(ultraGrid1, "半成品运行年月收发存汇总");
- }
- }
- }
|