CommonAtomStlCcmMgt.cs 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using CoreFS.CA06;
  6. using System.Data;
  7. using System.Collections;
  8. using Core.Mes.Client.Common;
  9. namespace Core.LgMes.Client.lgBll.lgResMgt
  10. {
  11. public class CommonAtomStlCcmMgt
  12. {
  13. private ClientParam _cParam = null;
  14. public CommonAtomStlCcmMgt(ClientParam param)
  15. {
  16. this._cParam = param;
  17. }
  18. public CommonAtomStlCcmMgt()
  19. {
  20. }
  21. /// <summary>
  22. /// 获取连铸实绩数据
  23. /// </summary>
  24. /// <param name="param"></param>
  25. /// <returns></returns>
  26. public DataSet returnDsOfCcmInfo(ClientParamWithSqlConditionAndOpenBase param)
  27. {
  28. DataSet ds = new DataSet();
  29. try
  30. {
  31. ds = DbCommon.returnDataSet(CommonAtomForLgResMgt.returnSqlOfStl_Ccm_Optinfo(param.sqlCondition), param.ob);
  32. }
  33. catch
  34. {
  35. }
  36. return ds;
  37. }
  38. /// <summary>
  39. /// 获取连铸实绩数据
  40. /// </summary>
  41. /// <param name="sqlConditon"></param>
  42. /// <returns></returns>
  43. public DataSet returnDsOfCcmInfo(string sqlConditon)
  44. {
  45. DataSet ds = new DataSet();
  46. try
  47. {
  48. ds = DbCommon.returnDataSet(CommonAtomForLgResMgt.returnSqlOfStl_Ccm_Optinfo(sqlConditon),_cParam.ob);
  49. }
  50. catch
  51. {
  52. }
  53. return ds;
  54. }
  55. /// <summary>
  56. /// 获取带有包晶数据的连铸实绩数据
  57. /// </summary>
  58. /// <param name="param"></param>
  59. /// <returns></returns>
  60. public DataSet returnDsOfCcmChemInfo(ClientParamWithSqlConditionAndOpenBase param)
  61. {
  62. DataSet ds = new DataSet();
  63. try
  64. {
  65. ds = DbCommon.returnDataSet(CommonAtomForLgResMgt.returnSqlOfCcmChemInfo(param.sqlCondition), param.ob);
  66. }
  67. catch
  68. {
  69. }
  70. return ds;
  71. }
  72. /// <summary>
  73. /// 获取某一炉号在该浇次中实绩冶炼顺序
  74. /// </summary>
  75. /// <param name="castNo"></param>
  76. /// <returns></returns>
  77. public int returnHeatSeqByCastSeq(string heatNo)
  78. {
  79. string planSqlConditon = string.Format(" and CHARGE_NO = '{0}'", heatNo);
  80. ClientParam param = new ClientParam("",planSqlConditon, _cParam.ob);
  81. string castNo = "";
  82. int index = 0;
  83. int rowCount = 0;
  84. bool isExist = false;
  85. try
  86. {
  87. castNo = Core.LgMes.Client.lgBll.lgPlanMgt.CommonLgPlanMgt.return3qCastNoByHeatNo(param);
  88. }
  89. catch
  90. {
  91. }
  92. if (castNo.Length > 0)
  93. {
  94. try
  95. {
  96. ArrayList list = Core.LgMes.Client.lgBll.lgPlanMgt.CommonLgPlanMgt.returnHeatNoListByCastNo(new ClientParam("", string.Format(" and CAST_NO = '{0}'", castNo), _cParam.ob));
  97. DataSet dsCcm = returnDsOfCcmInfo(lgCommon.returnSqlWhereConditionByColumnListAndColumnName(list,"HEATNO"));
  98. DataSet dsSortByOPTDATE = lgCommon.returnDsByAscOrderFromSourceDataSet(dsCcm, "OPTDATE");
  99. if (!lgCommon.isDataSetDataFoundCheck(dsSortByOPTDATE))
  100. return 1;
  101. rowCount = dsSortByOPTDATE.Tables[0].Rows.Count;
  102. for (int i = rowCount - 1; i >= 0; i--)
  103. {
  104. index = i + 1;
  105. if (dsSortByOPTDATE.Tables[0].Rows[i]["HEATNO"].ToString() == heatNo)
  106. {
  107. isExist = true;
  108. break;
  109. }
  110. }
  111. }
  112. catch
  113. {
  114. }
  115. }
  116. return (index == 0) ? 1 : (!isExist)? index + 1 : index;
  117. }
  118. /// <summary>
  119. ///
  120. /// </summary>
  121. /// <param name="heatNo">炉号</param>
  122. /// <param name="vCastNo">浇次号</param>
  123. /// <returns></returns>
  124. public int returnHeatSeqByCastSeq(string heatNo,string vCastNo)
  125. {
  126. string castNo = vCastNo;
  127. int index = 0;
  128. int rowCount = 0;
  129. bool isExist = false;
  130. if (castNo.Length > 0)
  131. {
  132. try
  133. {
  134. DataSet dsCcm = returnDsOfCcmInfo(string.Format(" and MOULDNO = '{0}'", castNo));
  135. DataSet dsSortByOPTDATE = lgCommon.returnDsByAscOrderFromSourceDataSet(dsCcm, "OPTDATE");
  136. if (dsSortByOPTDATE == null & dsSortByOPTDATE.Tables.Count == 0)
  137. return 1;
  138. rowCount = dsSortByOPTDATE.Tables[0].Rows.Count;
  139. if (rowCount == 0)
  140. return 1;
  141. for (int i = rowCount - 1; i >= 0; i--)
  142. {
  143. index = i + 1;
  144. if (dsSortByOPTDATE.Tables[0].Rows[i]["HEATNO"].ToString() == heatNo)
  145. {
  146. isExist = true;
  147. break;
  148. }
  149. }
  150. }
  151. catch
  152. {
  153. }
  154. }
  155. return (index == 0) ? 1 : (!isExist) ? index + 1 : index;
  156. }
  157. }
  158. }