098ec9a69022a40189889277ebf2431ff6a19253.svn-base 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. package UIM;
  2. import java.sql.PreparedStatement;
  3. import java.sql.ResultSet;
  4. import java.sql.SQLException;
  5. import java.util.ArrayList;
  6. import java.util.Iterator;
  7. import java.util.List;
  8. import java.util.Map;
  9. import UIB.COM.XmlSqlParsersFactory;
  10. import CoreFS.SA01.CoreIComponent;
  11. import CoreFS.SA06.CoreReturnObject;
  12. /**
  13. * 冷轧中间库库存数据移动
  14. *
  15. * @author siy
  16. * @date 2010-08-27
  17. */
  18. public class UIM010181 extends CoreIComponent {
  19. /**
  20. * 查询钢卷位置
  21. *
  22. * @param coilNo
  23. * 冷轧卷号
  24. * @return CoreReturnObject
  25. * @throws SQLException
  26. */
  27. public CoreReturnObject queryLoadLoc(String coilNo) throws SQLException {
  28. CoreReturnObject cro = new CoreReturnObject();
  29. String sql = XmlSqlParsersFactory.getSql("UIM010181_02.SELECT");
  30. List list = this.getDao("KgDao").ExcuteQueryReturnList(sql,
  31. new Object[] { coilNo });// .ExcuteQuery(sql);
  32. String curLoadLoc = "";
  33. Iterator it = list.iterator();
  34. while (it.hasNext()) {
  35. Map map = (Map) it.next();
  36. curLoadLoc = map.get("cur_load_loc").toString();
  37. }
  38. // System.out.println(count);
  39. cro.setResult(curLoadLoc);
  40. return cro;
  41. }
  42. public CoreReturnObject queryYardAreas() throws SQLException {
  43. CoreReturnObject cro = new CoreReturnObject();
  44. String sql = XmlSqlParsersFactory.getSql("UIM010181_01.SELECT");
  45. cro = this.getDao("KgDao").ExcuteQuery(sql);
  46. return cro;
  47. }
  48. /**
  49. * 查询区域中的垛位及钢卷
  50. *
  51. * @param areaName
  52. * @return
  53. * @throws SQLException
  54. */
  55. public CoreReturnObject queryYardCoils(String areaName) throws SQLException {
  56. CoreReturnObject cro = new CoreReturnObject();
  57. String[] rowBetween = areaName.split("-");
  58. if (rowBetween.length > 1) {
  59. String sql = XmlSqlParsersFactory.getSql("UIM010181_03.SELECT");
  60. cro = this.getDao("KgDao").ExcuteQuery(sql,
  61. new Object[] { rowBetween[0], rowBetween[1] });
  62. }
  63. return cro;
  64. }
  65. /**
  66. * 钢卷移垛
  67. *
  68. * @param moveList
  69. * 移垛钢卷垛位信息
  70. * @param regId
  71. * 移垛人
  72. * @param moveOrder
  73. * 移垛班次
  74. * @param moveGroup
  75. * 移垛班组
  76. * @param moveDate
  77. * 移垛时间
  78. * @return
  79. * @throws SQLException
  80. */
  81. public CoreReturnObject moveColdCoil(ArrayList<String[]> moveList,
  82. String regId, String moveOrder, String moveGroup, String moveDate)
  83. throws SQLException {
  84. CoreReturnObject cro = new CoreReturnObject();
  85. StringBuffer sqlBuffer = null;
  86. Map result = this.getDao("KgDao").CoreBeginTranscation();
  87. try {
  88. for (int i = 0; i < moveList.size(); i++) {
  89. String[] moveCoil = moveList.get(i);
  90. // 更新钢卷公共表
  91. sqlBuffer = new StringBuffer();
  92. sqlBuffer.append(XmlSqlParsersFactory
  93. .getSql("UIM010181_01.UPDATE"));
  94. this.getDao("KgDao").ExcuteNonQuery(sqlBuffer.toString(),
  95. new Object[] { moveCoil[1], moveCoil[2] });
  96. // 更新垛位表
  97. sqlBuffer = new StringBuffer();
  98. sqlBuffer.append(XmlSqlParsersFactory
  99. .getSql("UIM010181_02.UPDATE"));
  100. this.getDao("KgDao").ExcuteNonQuery(
  101. sqlBuffer.toString(),
  102. new Object[] { "", regId, moveCoil[0], moveCoil[0],
  103. moveCoil[0], moveCoil[0] });
  104. this.getDao("KgDao").ExcuteNonQuery(
  105. sqlBuffer.toString(),
  106. new Object[] { moveCoil[2], regId, moveCoil[1],
  107. moveCoil[1], moveCoil[1], moveCoil[1] });
  108. // 移垛完成后将移垛记录加入移垛记录表,便于跟踪钢卷移动记录
  109. sqlBuffer = new StringBuffer();
  110. sqlBuffer.append(XmlSqlParsersFactory
  111. .getSql("UIM010181_01.INSERT"));
  112. this.getDao("KgDao").ExcuteNonQuery(
  113. sqlBuffer.toString(),
  114. new Object[] { moveCoil[0], moveCoil[1], moveCoil[2],
  115. regId, moveOrder, moveGroup, moveDate });
  116. }
  117. this.getDao("KgDao").CoreCommit(result);
  118. } catch (Exception e) {
  119. e.printStackTrace();
  120. this.getDao("KgDao").CoreRollBack(result);
  121. }
  122. return cro;
  123. }
  124. /**
  125. * 查询空余垛位
  126. *
  127. * @param areaName
  128. * @return
  129. * @throws SQLException
  130. */
  131. public CoreReturnObject queryEmptyYards(String areaName)
  132. throws SQLException {
  133. CoreReturnObject cro = null;
  134. String[] rowBetween = null;
  135. if (areaName != null && !areaName.equals("")) {
  136. rowBetween = areaName.split("-");
  137. }
  138. String sql = "";
  139. if (rowBetween != null && rowBetween.length > 1) {
  140. sql = XmlSqlParsersFactory.getSql("UIM010181_06.SELECT");
  141. cro = this.getDao("KgDao").ExcuteQuery(sql,
  142. new Object[] { rowBetween[0], rowBetween[1] });
  143. } else {
  144. sql = XmlSqlParsersFactory.getSql("UIM010181_05.SELECT");
  145. cro = this.getDao("KgDao").ExcuteQuery(sql);
  146. }
  147. return cro;
  148. }
  149. }