frmSelectWeight.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using CoreFS.CA06;
  10. using System.Collections;
  11. namespace Core.StlMes.Client.LgCommon
  12. {
  13. public partial class frmSelectWeight : FrmBase
  14. {
  15. public string sWeight = "";
  16. public string MaterCode = "";
  17. public string MaterName = "";
  18. public string Weight = "";
  19. public string HeatProcessNo = "";
  20. public string Weightno = "";
  21. public string VDate = "";
  22. public string WorkShopNo = "";
  23. public bool flag = false;
  24. public bool isCancel = false;
  25. public string vProcessNo = "";
  26. public bool isResult = false;
  27. private OpeBase _ob;
  28. public frmSelectWeight(OpeBase ob)
  29. {
  30. InitializeComponent();
  31. _ob = ob;
  32. }
  33. private void frmSelectWeight_Load(object sender, EventArgs e)
  34. {
  35. label2.Text = "";
  36. label4.Text = "";
  37. label6.Text = sWeight;
  38. label2.Text = MaterName;
  39. if (isResult)
  40. {
  41. buttcancel.Visible = false;
  42. buttsave.Text = "选择";
  43. getResultHJWeight();
  44. }
  45. else
  46. {
  47. getHJWeight();
  48. }
  49. }
  50. // 查询合金重量
  51. /// <summary>
  52. /// 查询合金重量
  53. /// </summary>
  54. private void getHJWeight()
  55. {
  56. try
  57. {
  58. string strErr = "";
  59. ArrayList arry = new ArrayList();
  60. ArrayList sqlList = new ArrayList();
  61. arry.Add("GetBofOptTime.Select");//此ID为XML文件ID
  62. arry.Add(HeatProcessNo.Substring(5, 8));
  63. arry.Add(HeatProcessNo.Substring(1, 2));
  64. arry.Add(HeatProcessNo.Substring(3, 2));
  65. arry.Add(HeatProcessNo.Substring(5, 8));
  66. arry.Add(HeatProcessNo.Substring(1, 2));
  67. arry.Add(HeatProcessNo.Substring(3, 2));
  68. CommonClientToServer cctos = new CommonClientToServer();
  69. cctos.ob = this._ob;
  70. DataSet ds1 = cctos.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery",
  71. "doSimpleQuery", arry, out strErr);
  72. DateTime strDate = DateTime.Now;
  73. if (ds1 != null && ds1.Tables.Count > 0 && ds1.Tables[0].Rows.Count > 0)
  74. {
  75. strDate = Convert.ToDateTime(ds1.Tables[0].Rows[0]["OPTDATE"].ToString());
  76. vProcessNo = ds1.Tables[0].Rows[0]["HEATPROCESSNO"].ToString();
  77. }
  78. strErr = "";
  79. string vLd = "";
  80. if (HeatProcessNo.Substring(2, 1) == "3")
  81. {
  82. vLd = "1";
  83. WorkShopNo = "2";
  84. }
  85. else if (HeatProcessNo.Substring(2, 1) == "4")
  86. {
  87. vLd = "2";
  88. WorkShopNo = "2";
  89. }
  90. else if (HeatProcessNo.Substring(2, 1) == "5")
  91. {
  92. vLd = "3";
  93. WorkShopNo = "2";
  94. }
  95. string strFrom = strDate.AddMinutes(-10).ToString("yyyy-MM-dd HH:mm:ss");
  96. string strTo = strDate.AddMinutes(30).ToString("yyyy-MM-dd HH:mm:ss");
  97. arry.Clear();
  98. arry.Add(vLd);
  99. arry.Add(WorkShopNo);
  100. arry.Add(strFrom);
  101. arry.Add(strTo);
  102. CommonClientToServer ccTos = new CommonClientToServer();
  103. ccTos.ob = _ob;
  104. //查询合金记录
  105. DataSet ds = ccTos.ExecuteQueryFunctionsSqlID("Core.Mes.Server.Common.ComDataAccess",
  106. "QueryWithParameter", "STL_JOB0014", 5, arry, out strErr);
  107. //arry.Add("GetBofHJMater.Select");//此ID为XML文件ID
  108. //sqlList = GetSqlWhere(strDate);
  109. //CoreClientParam CCP_LgEts = new CoreClientParam();
  110. //DataTable dt = new DataTable();
  111. //CCP_LgEts.ServerName = "Core.LgMes.Server.Common.ComDBMcmsQuery";
  112. //CCP_LgEts.MethodName = "doQuery";
  113. //CCP_LgEts.ServerParams = new object[] { arry, sqlList };
  114. //CCP_LgEts.SourceDataTable = dt;
  115. //this.ob = _ob;
  116. //this.ExecuteSortResultByQueryToDataTable(CCP_LgEts, CoreInvokeType.Internal);
  117. //ultraDataSource1.Rows.Clear();
  118. //DataSet ds = new DataSet();
  119. //ds.Tables.Add(dt);
  120. if (strErr == "" && ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
  121. {
  122. ultraDataSource1.Rows.Clear();
  123. for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
  124. {
  125. DataRow dr = ds.Tables[0].Rows[i];
  126. this.ultraDataSource1.Rows.Add(new object[]{
  127. dr["WEIGHTNO"].ToString(),
  128. dr["POINT"].ToString(),
  129. dr["WEIGHT"].ToString(),
  130. dr["FLAG"].ToString(),
  131. dr["WEIGTHTIME"].ToString(),
  132. dr["HEATNO"].ToString(),
  133. dr["MATIELCODE"].ToString(),
  134. dr["MATIELNAME"].ToString(),
  135. dr["HEATPROCESSNO"].ToString(),
  136. dr["WORKSHOP"].ToString(),
  137. dr["SHIFTCODE"].ToString(),
  138. dr["COUNTTIME"].ToString()
  139. });
  140. }
  141. }
  142. // PublicMethod.RefreshAndAutoSize(ultraGrid1);
  143. }
  144. catch { }
  145. }
  146. // 查询实绩合金重量
  147. /// <summary>
  148. /// 查询实绩合金重量
  149. /// </summary>
  150. private void getResultHJWeight()
  151. {
  152. try
  153. {
  154. string strErr = "";
  155. string strHeatno = "";
  156. ArrayList arry = new ArrayList();
  157. arry.Add(vProcessNo);
  158. arry.Add(vProcessNo);
  159. CommonClientToServer cctos = new CommonClientToServer();
  160. cctos.ob = _ob;
  161. //查询合金记录
  162. DataSet ds1 = cctos.ExecuteQueryFunctionsSqlID("Core.Mes.Server.Common.ComDataAccess",
  163. "QueryWithParameter", "STL_JOB0016", 5, arry, out strErr);
  164. DateTime strDate = DateTime.Now;
  165. if (ds1 != null && ds1.Tables.Count > 0 && ds1.Tables[0].Rows.Count > 0)
  166. {
  167. strDate = Convert.ToDateTime(ds1.Tables[0].Rows[0]["OPTDATE"].ToString());
  168. strHeatno = ds1.Tables[0].Rows[0]["HEATNO"].ToString();
  169. }
  170. strErr = "";
  171. string vLd = "";
  172. if (strHeatno.Substring(2, 1) == "3")
  173. {
  174. vLd = "1";
  175. WorkShopNo = "2";
  176. }
  177. else if (strHeatno.Substring(2, 1) == "4")
  178. {
  179. vLd = "2";
  180. WorkShopNo = "2";
  181. }
  182. else if (strHeatno.Substring(2, 1) == "5")
  183. {
  184. vLd = "3";
  185. WorkShopNo = "2";
  186. }
  187. string strFrom = strDate.AddMinutes(-10).ToString("yyyy-MM-dd HH:mm:ss");
  188. string strTo = strDate.AddMinutes(30).ToString("yyyy-MM-dd HH:mm:ss");
  189. arry.Clear();
  190. arry.Add(vLd);
  191. arry.Add(WorkShopNo);
  192. arry.Add(strFrom);
  193. arry.Add(strTo);
  194. CommonClientToServer ccTos = new CommonClientToServer();
  195. ccTos.ob = _ob;
  196. //查询合金记录
  197. DataSet ds = ccTos.ExecuteQueryFunctionsSqlID("Core.Mes.Server.Common.ComDataAccess",
  198. "QueryWithParameter", "STL_JOB0014", 5, arry, out strErr);
  199. if (strErr == "" && ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
  200. {
  201. ultraDataSource1.Rows.Clear();
  202. for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
  203. {
  204. DataRow dr = ds.Tables[0].Rows[i];
  205. this.ultraDataSource1.Rows.Add(new object[]{
  206. dr["WEIGHTNO"].ToString(),
  207. dr["POINT"].ToString(),
  208. dr["WEIGHT"].ToString(),
  209. dr["FLAG"].ToString(),
  210. dr["WEIGTHTIME"].ToString(),
  211. dr["HEATNO"].ToString(),
  212. dr["MATIELCODE"].ToString(),
  213. dr["MATIELNAME"].ToString(),
  214. dr["HEATPROCESSNO"].ToString(),
  215. dr["WORKSHOP"].ToString(),
  216. dr["SHIFTCODE"].ToString(),
  217. dr["COUNTTIME"].ToString()
  218. });
  219. }
  220. }
  221. // PublicMethod.RefreshAndAutoSize(ultraGrid1);
  222. }
  223. catch { }
  224. }
  225. private void buttrefrsh_Click(object sender, EventArgs e)
  226. {
  227. if (isResult)
  228. {
  229. getResultHJWeight();
  230. }
  231. else
  232. {
  233. getHJWeight();
  234. }
  235. }
  236. private void buttsave_Click(object sender, EventArgs e)
  237. {
  238. try
  239. {
  240. flag = true;
  241. isCancel = false;
  242. this.Close();
  243. }
  244. catch { }
  245. }
  246. private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
  247. {
  248. try
  249. {
  250. label4.Text = ultraGrid1.ActiveRow.Cells["WEIGHT"].Value.ToString();
  251. Weight = ultraGrid1.ActiveRow.Cells["WEIGHT"].Value.ToString();
  252. Weightno = ultraGrid1.ActiveRow.Cells["WEIGHTNO"].Value.ToString();
  253. VDate = ultraGrid1.ActiveRow.Cells["WEIGTHTIME"].Value.ToString();
  254. }
  255. catch { }
  256. }
  257. private void ultraGrid1_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e)
  258. {
  259. //设置Row颜色
  260. if (e.Row.Cells["FLAG"].Value.ToString().Trim() == "已选")
  261. {
  262. e.Row.Cells["FLAG"].Appearance.BackColor = Color.SandyBrown;
  263. e.Row.Cells["FLAG"].Appearance.ForeColor = Color.Black;
  264. }
  265. }
  266. private void buttcancel_Click(object sender, EventArgs e)
  267. {
  268. flag = true;
  269. isCancel = true;
  270. this.Close();
  271. }
  272. }
  273. }