using Core.Mes.Client.Comm.Control; using Core.Mes.Client.Comm.Server; using Core.Mes.Client.Comm.Tool; using CoreFS.CA06; 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.PnCost { public partial class frmBaseCountProcesscost : FrmBase { #region 定义变量 #endregion #region 初始化 public frmBaseCountProcesscost() { InitializeComponent(); } private void frmBaseCountProcesscost_Load(object sender, EventArgs e) { for (int i = 2000; i < 2051; i++) { yeardrop.Items.Add(i); } string str1 = ""; for (int i = 1; i < 10; i++) { str1 = "0" + i.ToString2(); monthdrop.Items.Add(str1); } monthdrop.Items.Add(10); monthdrop.Items.Add(11); monthdrop.Items.Add(12); yeardrop.Value = System.DateTime.Now.Year.ToString2(); monthdrop.Value = System.DateTime.Now.Month.ToString2(); } #endregion #region 方法 public override void ToolBar_Click(object sender, string ToolbarKey) { base.ToolBar_Click(sender, ToolbarKey); switch (ToolbarKey) { case "Query": Query(); break; case "Refresh": Refresh(); break; case "Close": this.Close(); break; } } /// 查询方法 /// /// 查询方法 /// private void Query() { #region 条件验证 //年月 string year = yeardrop.Value.ToString2(); string month = monthdrop.Value.ToString2(); string yue = ""; if (Convert.ToDecimal(month) > 9) { yue = "cbpt.month_" + month; } else { yue = "cbpt.month_" + month.Substring(1,1).ToString2(); } #endregion DataTable dt = ServerHelper.GetData("com.steering.pss.pncost.base.ComBaseCountProcesscost.querypai", new object[] { year + "-" + month,year,yue }, ob); GridHelper.CopyDataToDatatable(dt, dataTable1, true); if (ultraGrid1.Rows.Count == 0) { return; } for (int i = 0; i < ultraGrid1.Rows.Count; i++)//根据产线,投入产出物料取小时能力 { string gongxu = ultraGrid1.Rows[i].Cells["PROCESS_CODE"].Value.ToString2(); string chanxian = ultraGrid1.Rows[i].Cells["PLINE_CODE"].Value.ToString2(); string zhebiao = ""; #region 折标赋值 string zonge = ultraGrid1.Rows[i].Cells["PRICE"].Value.ToString3();//分摊总额 for (int j = 0; j < dt.Rows.Count; j++) { //&& touru ==dt.Rows[j]["INWL_ID"].ToString2() // && chanchu == dt.Rows[j]["OUTWL_ID"].ToString2() if (dt.Rows[j]["PLINE_CODE"].ToString2() == chanxian) { zhebiao = (Convert.ToDecimal(dt.Rows[j]["WEIGTH_S"].ToString3()) + Convert.ToDecimal(zhebiao.ToString3())).ToString3(); } } ultraGrid1.Rows[i].Cells["PROCESSCOST"].Value = (Convert.ToDecimal(zonge.ToString3()) * Convert.ToDecimal(ultraGrid1.Rows[i].Cells["WEIGTH_S"].Value.ToString3()) / Convert.ToDecimal(zhebiao.ToString3())).ToString3(); #endregion } ultraGrid1.UpdateData(); ultraGrid1.ActiveRow = ultraGrid1.Rows[0]; } #endregion #region 事件 #endregion } }