frmBaseCountProcesscost.cs 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. using Core.Mes.Client.Comm.Control;
  2. using Core.Mes.Client.Comm.Server;
  3. using Core.Mes.Client.Comm.Tool;
  4. using CoreFS.CA06;
  5. using System;
  6. using System.Collections;
  7. using System.Collections.Generic;
  8. using System.ComponentModel;
  9. using System.Data;
  10. using System.Drawing;
  11. using System.Linq;
  12. using System.Text;
  13. using System.Windows.Forms;
  14. namespace Core.StlMes.Client.PnCost
  15. {
  16. public partial class frmBaseCountProcesscost : FrmBase
  17. {
  18. #region 定义变量
  19. #endregion
  20. #region 初始化
  21. public frmBaseCountProcesscost()
  22. {
  23. InitializeComponent();
  24. }
  25. private void frmBaseCountProcesscost_Load(object sender, EventArgs e)
  26. {
  27. for (int i = 2000; i < 2051; i++)
  28. {
  29. yeardrop.Items.Add(i);
  30. }
  31. string str1 = "";
  32. for (int i = 1; i < 10; i++)
  33. {
  34. str1 = "0" + i.ToString2();
  35. monthdrop.Items.Add(str1);
  36. }
  37. monthdrop.Items.Add(10);
  38. monthdrop.Items.Add(11);
  39. monthdrop.Items.Add(12);
  40. yeardrop.Value = System.DateTime.Now.Year.ToString2();
  41. monthdrop.Value = System.DateTime.Now.Month.ToString2();
  42. }
  43. #endregion
  44. #region 方法
  45. public override void ToolBar_Click(object sender, string ToolbarKey)
  46. {
  47. base.ToolBar_Click(sender, ToolbarKey);
  48. switch (ToolbarKey)
  49. {
  50. case "Query":
  51. Query();
  52. break;
  53. case "Refresh":
  54. Refresh();
  55. break;
  56. case "Close":
  57. this.Close();
  58. break;
  59. }
  60. }
  61. /// 查询方法
  62. /// <summary>
  63. /// 查询方法
  64. /// </summary>
  65. private void Query()
  66. {
  67. #region 条件验证
  68. //年月
  69. string year = yeardrop.Value.ToString2();
  70. string month = monthdrop.Value.ToString2();
  71. string yue = "";
  72. if (Convert.ToDecimal(month) > 9)
  73. {
  74. yue = "cbpt.month_" + month;
  75. }
  76. else {
  77. yue = "cbpt.month_" + month.Substring(1,1).ToString2();
  78. }
  79. #endregion
  80. DataTable dt = ServerHelper.GetData("com.steering.pss.pncost.base.ComBaseCountProcesscost.querypai",
  81. new object[] { year + "-" + month,year,yue }, ob);
  82. GridHelper.CopyDataToDatatable(dt, dataTable1, true);
  83. if (ultraGrid1.Rows.Count == 0)
  84. {
  85. return;
  86. }
  87. for (int i = 0; i < ultraGrid1.Rows.Count; i++)//根据产线,投入产出物料取小时能力
  88. {
  89. string gongxu = ultraGrid1.Rows[i].Cells["PROCESS_CODE"].Value.ToString2();
  90. string chanxian = ultraGrid1.Rows[i].Cells["PLINE_CODE"].Value.ToString2();
  91. string zhebiao = "";
  92. #region 折标赋值
  93. string zonge = ultraGrid1.Rows[i].Cells["PRICE"].Value.ToString3();//分摊总额
  94. for (int j = 0; j < dt.Rows.Count; j++)
  95. {
  96. //&& touru ==dt.Rows[j]["INWL_ID"].ToString2()
  97. // && chanchu == dt.Rows[j]["OUTWL_ID"].ToString2()
  98. if (dt.Rows[j]["PLINE_CODE"].ToString2() == chanxian)
  99. {
  100. zhebiao = (Convert.ToDecimal(dt.Rows[j]["WEIGTH_S"].ToString3()) + Convert.ToDecimal(zhebiao.ToString3())).ToString3();
  101. }
  102. }
  103. ultraGrid1.Rows[i].Cells["PROCESSCOST"].Value = (Convert.ToDecimal(zonge.ToString3())
  104. * Convert.ToDecimal(ultraGrid1.Rows[i].Cells["WEIGTH_S"].Value.ToString3())
  105. / Convert.ToDecimal(zhebiao.ToString3())).ToString3();
  106. #endregion
  107. }
  108. ultraGrid1.UpdateData();
  109. ultraGrid1.ActiveRow = ultraGrid1.Rows[0];
  110. }
  111. #endregion
  112. #region 事件
  113. #endregion
  114. }
  115. }