1e0458842260acd62b21b35a7811f9f43957c6a8.svn-base 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596
  1. package xin.glue.ui.B;
  2. import java.util.List;
  3. import java.util.Map;
  4. import xin.glue.ui.common.blob.PosExcelEngine;
  5. import jxl.Cell;
  6. import jxl.CellType;
  7. import jxl.Sheet;
  8. import jxl.Workbook;
  9. import jxl.format.Alignment;
  10. import jxl.format.Border;
  11. import jxl.format.BorderLineStyle;
  12. import jxl.format.VerticalAlignment;
  13. import jxl.write.Label;
  14. import jxl.write.WritableCellFormat;
  15. import jxl.write.WritableFont;
  16. import jxl.write.WritableSheet;
  17. import jxl.write.WritableWorkbook;
  18. import jxl.write.WriteException;
  19. import jxl.write.biff.RowsExceededException;
  20. public class PosCertificate extends PosExcelEngine {
  21. private int TotalCols = 44;//原始38更改为44
  22. private int TheCols = 43;//原始37改为43
  23. private String pageCoilNo = null;
  24. protected void setData(Workbook rwb, WritableWorkbook wb) throws RowsExceededException, WriteException {
  25. Sheet rs = rwb.getSheet(0);
  26. setData(wb, rs);
  27. }
  28. private void setData(WritableWorkbook wb, Sheet rs) throws WriteException, RowsExceededException {
  29. this.addRows = 0;
  30. if (pageCount > 0)
  31. wb.importSheet("sheet" + (pageCount + 1), pageCount, rs);
  32. WritableSheet sheet = wb.getSheet(pageCount++);
  33. sheet.removeRow(12);
  34. sheet.removeRow(8);
  35. setHeader(rs, sheet);
  36. setSize(rs, sheet);
  37. setSample(rs, sheet);
  38. if (dataList.size() > 3) {
  39. if (((List)dataList.get(1)).size() > 0 || ((List)dataList.get(3)).size() > 0)
  40. setData(wb, rs);
  41. }
  42. }
  43. private void setHeader(Sheet rs, WritableSheet sheet) throws WriteException, RowsExceededException {
  44. if (dataList == null || dataList.size() < 1) return;
  45. List list = (List)dataList.get(0);
  46. if (list.size() > 0) {
  47. Map row = (Map)list.get(0);
  48. Cell cell;
  49. Label label;
  50. String fieldName;
  51. for (int curCol = 2; curCol < TotalCols; curCol++) {
  52. for (int curRow = 1; curRow < 4; curRow++) {
  53. cell = rs.getCell(curCol, curRow);
  54. if (cell.getType() == CellType.EMPTY) continue;
  55. fieldName = cell.getContents().trim();
  56. if (fieldName.startsWith("[") && fieldName.endsWith("]")) {
  57. fieldName = fieldName.substring(1, fieldName.length() - 1);
  58. if (row.get(fieldName) != null) {
  59. label = (Label)sheet.getWritableCell(curCol, curRow);
  60. label.setString(row.get(fieldName).toString());
  61. }
  62. else//当结果中没有该元素时,将该格子的值置为空
  63. {
  64. label = (Label)sheet.getWritableCell(curCol, curRow);
  65. label.setString("");
  66. }
  67. }
  68. }
  69. }
  70. // 订货单位、收货单位、订单号、产品名称、标准、发行指示编号
  71. // 车号、数量合计、重量合计、证明书编号、签发日期、发货日期
  72. }
  73. }
  74. protected void addBlankRow(WritableSheet sheet, int curRow, Sheet rs, int refRow, int rows) throws WriteException {
  75. if (autoBlank) {
  76. while (rows < pageSize) {
  77. curRow = insertRow(sheet, curRow, rs, refRow);
  78. setValue(sheet, curRow, 0, String.valueOf(++rows)); // NO.
  79. }
  80. }
  81. }
  82. private void setSize(Sheet rs, WritableSheet sheet) throws WriteException, RowsExceededException {
  83. if (dataList == null || dataList.size() < 2) return;
  84. List list = (List)dataList.get(1);
  85. Cell cell;
  86. int count = 0, curRow = 7;
  87. String coilNo = null;
  88. for (int i = 0; i < list.size(); ) {
  89. Map row = (Map)list.get(i);
  90. if (!row.get("COIL_NO").toString().equals(coilNo)) {
  91. if (count > pageSize) break;
  92. coilNo = row.get("COIL_NO").toString();
  93. pageCoilNo = coilNo;
  94. curRow = insertRow(sheet, curRow, rs, 8);
  95. sheet.mergeCells(2, curRow, 5, curRow);//炉号
  96. sheet.mergeCells(6, curRow, 8, curRow); // 牌号
  97. sheet.mergeCells(9, curRow, 10, curRow); // 厚度
  98. sheet.mergeCells(11, curRow, 12, curRow); // 宽度
  99. sheet.mergeCells(13, curRow, 14, curRow); // 长度
  100. sheet.mergeCells(15, curRow, 16, curRow); // 重量
  101. sheet.mergeCells(42, curRow, 43, curRow); // 车号
  102. setValue(sheet, curRow, 0, String.valueOf(++count)); // NO.
  103. }
  104. list.remove(i);
  105. for (int curCol = 1; curCol < TheCols; curCol++) {
  106. cell = rs.getCell(curCol, 8);
  107. if (cell.getType() != CellType.EMPTY)
  108. setValue(sheet, curRow, curCol, row.get(cell.getContents().trim()));
  109. }
  110. // CHARGE_NO、SMP_NO、COIL_THK、COIL_WTK、COIL_LEN、COIL_WGT、TP
  111. setChem(rs, sheet, coilNo, curRow);
  112. }
  113. addBlankRow(sheet, curRow, rs, 8, count);
  114. for (int i = count, j = 1; i < pageSize; i++, j++) {
  115. sheet.mergeCells(2, curRow+j, 5, curRow+j);//炉号
  116. sheet.mergeCells(6, curRow + j, 8, curRow + j); // 牌号
  117. sheet.mergeCells(9, curRow + j, 10, curRow + j); // 厚度
  118. sheet.mergeCells(11, curRow + j, 12, curRow + j); // 宽度
  119. sheet.mergeCells(13, curRow + j, 14, curRow + j); // 长度
  120. sheet.mergeCells(15, curRow + j, 16, curRow + j); // 重量
  121. sheet.mergeCells(42, curRow + j, 43, curRow + j); // 车号
  122. }
  123. }
  124. //成分
  125. private void setChem(Sheet rs, WritableSheet sheet, String coilNo, int curRow) throws WriteException, RowsExceededException {
  126. if (dataList == null || dataList.size() < 3) return;
  127. List list = (List)dataList.get(2);
  128. Cell cell;
  129. Label label;
  130. int curCol;
  131. boolean canExit = false;
  132. for (int i = 0; i < list.size(); ) {
  133. Map row = (Map)list.get(i);
  134. if (row.get("COIL_NO").equals(coilNo)) {
  135. canExit = true;
  136. String chemName = row.get("CHEM_CD").toString();
  137. String DISPLAY_LEN = row.get("DISPLAY_LEN").toString();
  138. for (curCol = 18; curCol < TotalCols; curCol++) {//元素存储从18位开始
  139. cell = sheet.getCell(curCol, 5);//第5列
  140. if (cell.getContents().equals(chemName)) break;
  141. if (cell.getType() == CellType.EMPTY) {
  142. cell = rs.getCell(curCol, 5);
  143. label = new Label(curCol, 5, chemName, cell.getCellFormat());
  144. sheet.addCell(label);
  145. /*
  146. //保留位数
  147. WritableFont superscript = new WritableFont(WritableFont.ARIAL,
  148. WritableFont.DEFAULT_POINT_SIZE, WritableFont.NO_BOLD, false,
  149. UnderlineStyle.NO_UNDERLINE, Colour.BLACK,
  150. ScriptStyle.SUPERSCRIPT);
  151. WritableCellFormat superscriptFormat = new WritableCellFormat(
  152. superscript);
  153. cell = rs.getCell(curCol, 7);
  154. label = new Label(curCol, 7, DISPLAY_LEN, superscriptFormat);
  155. sheet.addCell(label);
  156. label = new Label(curCol, 7, "10", superscriptFormat);
  157. sheet.addCell(label);
  158. */
  159. /*
  160. NumberFormat dp3 = new NumberFormat("#.###");
  161. WritableCellFormat dp3cell = new WritableCellFormat(dp3);
  162. jxl.write.Number n = new jxl.write.Number(curCol, 7, 3.1TotalCols5926535,dp3cell);
  163. sheet.addCell(n);
  164. */
  165. break;
  166. }
  167. }
  168. if (curCol < TotalCols) {
  169. label = (Label)sheet.getWritableCell(curCol, curRow);
  170. label.setString(row.get("CHEM_VAL").toString());
  171. }
  172. list.remove(i);
  173. } else {
  174. if (canExit) break;
  175. i++;
  176. }
  177. }
  178. }
  179. //性能
  180. private void setSample(Sheet rs, WritableSheet sheet) throws WriteException, RowsExceededException {
  181. if (dataList == null || dataList.size() < 4) return;
  182. List list = (List)dataList.get(3);
  183. String coilNo = null, samplePos = null, qltyCD, qltyName;
  184. int curRow = 10 + this.addRows, fixedRow = 9 + this.addRows, curCol = 0;
  185. int count = 0;
  186. Cell cell;
  187. Label label;
  188. boolean canExit = false, rowChange = false;
  189. for (int i = 0; i < list.size(); ) {
  190. Map row = (Map)list.get(i);
  191. if (!row.get("COIL_NO").equals(coilNo)) {
  192. if (row.get("COIL_NO").equals(pageCoilNo))
  193. canExit = true;
  194. if (canExit && count > pageSize) break;
  195. coilNo = row.get("COIL_NO").toString();
  196. curRow = insertRow(sheet, curRow, rs, 12);
  197. setValue(sheet, curRow, 0, String.valueOf(++count)); // NO.
  198. cell = rs.getCell(1, 12); // COIL NO. -> Sample NO.
  199. setValue(sheet, curRow, 1, row.get(cell.getContents().trim()));
  200. rowChange = true;
  201. }
  202. list.remove(i);
  203. if (rowChange || !row.get("SMP_NO").equals(samplePos)) {
  204. rowChange = false;
  205. samplePos = row.get("SMP_NO").toString();
  206. cell = rs.getCell(2, 12); // Sampling Position
  207. setValue(sheet, curRow, 2, row.get(cell.getContents().trim()));
  208. cell = rs.getCell(TheCols, 12); // 交货状态
  209. setValue(sheet, curRow, TheCols, row.get(cell.getContents().trim()));
  210. }
  211. qltyCD = row.get("QLTY_CD").toString();
  212. qltyName = row.get("QLTY_CD_CFNM").toString();
  213. if ((qltyCD.equals("YS") || qltyCD.equals("TE") ||
  214. qltyCD.equals("EL") || qltyCD.equals("RA") || qltyCD.equals("YR"))) {
  215. for (curCol = 3; curCol < 6; curCol++) {
  216. if(curCol == 3&&qltyCD.equals("TE")) //取抗拉强度的方向做为试验方向
  217. {
  218. cell = rs.getCell(curCol, 12);
  219. String fangXiang = row.get(cell.getContents().trim()).toString();
  220. if("H".equals(fangXiang))//横向
  221. {
  222. fangXiang = "T";
  223. }
  224. else if("Z".equals(fangXiang))//纵向
  225. {
  226. fangXiang = "L";
  227. }
  228. setValue(sheet, curRow, curCol, fangXiang);
  229. }
  230. }
  231. for (curCol = 6; curCol < 11; curCol++) {
  232. cell = rs.getCell(curCol, 12);
  233. if (qltyCD.equals(cell.getContents().trim())) {
  234. setValue(sheet, curRow, curCol, row.get("QLTY_VAL_WK"));
  235. break;
  236. }
  237. }
  238. if(qltyCD.equals("YS") )
  239. {
  240. cell = sheet.getCell(6, fixedRow+1);
  241. String ss = cell.getContents().toString();
  242. if("ReL".equals(ss))
  243. {
  244. Label ll = (Label)sheet.getWritableCell(6, fixedRow+1);
  245. ll.setString(qltyName.replaceAll("\\[矩形\\]", "").replaceAll("\\[圆形\\]", "").replaceAll("屈服强度", "") );
  246. }
  247. }
  248. else if(qltyCD.equals("EL"))
  249. {
  250. cell = sheet.getCell(8, fixedRow+1);
  251. String ss = cell.getContents().toString();
  252. if("A".equals(ss))
  253. {
  254. Label ll = (Label)sheet.getWritableCell(8, fixedRow+1);
  255. ll.setString(qltyName.replaceAll("\\[矩形\\]", "").replaceAll("\\[圆形\\]", "").replaceAll("伸长率", "") );
  256. }
  257. }
  258. }
  259. else if(qltyName.equals("非金属夹杂物A"))
  260. {
  261. cell = rs.getCell(37 , 12);
  262. setValue(sheet, curRow, 37, row.get("QLTY_VAL_WK"));
  263. }
  264. else if(qltyName.equals("非金属夹杂物B"))
  265. {
  266. cell = rs.getCell(38 , 12);
  267. setValue(sheet, curRow, 38, row.get("QLTY_VAL_WK"));
  268. }
  269. else if(qltyName.equals("非金属夹杂物C"))
  270. {
  271. cell = rs.getCell(39 , 12);
  272. setValue(sheet, curRow, 39, row.get("QLTY_VAL_WK"));
  273. }
  274. else if(qltyName.equals("非金属夹杂物D"))
  275. {
  276. cell = rs.getCell(40 , 12);
  277. setValue(sheet, curRow, 40, row.get("QLTY_VAL_WK"));
  278. }
  279. else if(qltyName.indexOf("夏比冲击剪切面积") != -1 )
  280. {
  281. cell = rs.getCell(18, 12);
  282. setValue(sheet, curRow, 18, row.get(cell.getContents().trim()));
  283. cell = rs.getCell(21, 12); // AVE
  284. setValue(sheet, curRow, 21, row.get("QLTY_VAL_WK"));
  285. setQlty(rs, sheet, coilNo, qltyCD, curRow);
  286. }
  287. else if(qltyName.equals("晶粒度"))
  288. {
  289. cell = rs.getCell(22 , 12);
  290. setValue(sheet, curRow, 22, row.get("QLTY_VAL_WK"));
  291. }
  292. else if(qltyName.equals("带状组织"))
  293. {
  294. cell = rs.getCell(23 , 12);
  295. setValue(sheet, curRow, 23, row.get("QLTY_VAL_WK"));
  296. }
  297. else if (qltyCD.equals("IM")) {
  298. if("S".equals(row.get("MS_QLTY_DIR")) ||"H".equals(row.get("MS_QLTY_DIR"))||"Z".equals(row.get("MS_QLTY_DIR")))//普通冲击
  299. {
  300. String str;
  301. for (curCol = 11; curCol < 14; curCol++) {
  302. cell = rs.getCell(curCol, 12);
  303. if(row.get(cell.getContents().trim()) != null)
  304. {
  305. str = row.get(cell.getContents().trim()).toString();
  306. }
  307. else
  308. {
  309. str = "";
  310. }
  311. if("H".equals(row.get(cell.getContents().trim())))
  312. {
  313. str = "T";
  314. }
  315. else if("Z".equals(row.get(cell.getContents().trim())))
  316. {
  317. str = "L";
  318. }
  319. setValue(sheet, curRow, curCol, str);
  320. }
  321. cell = rs.getCell(17, 12); // AVE
  322. setValue(sheet, curRow, 17, row.get("QLTY_VAL_WK"));
  323. setQlty(rs, sheet, coilNo, qltyCD, curRow);
  324. }
  325. if("L".equals(row.get("MS_QLTY_DIR"))||"X".equals(row.get("MS_QLTY_DIR")))//时效冲击
  326. {
  327. String str = "";
  328. for (curCol = 30; curCol < 33; curCol++) {
  329. cell = rs.getCell(curCol, 12);
  330. // str = row.get(cell.getContents().trim())== null ? "":row.get(cell.getContents().trim()).toString();
  331. if(row.get(cell.getContents().trim()) != null)
  332. {
  333. str = row.get(cell.getContents().trim()).toString();
  334. }
  335. else
  336. {
  337. str = "";
  338. }
  339. if("X".equals(row.get(cell.getContents().trim())))
  340. {
  341. str = "L";
  342. }
  343. else if("L".equals(row.get(cell.getContents().trim())))
  344. {
  345. str = "T";
  346. }
  347. setValue(sheet, curRow, curCol, str );
  348. }
  349. cell = rs.getCell(36, 12); // AVE
  350. setValue(sheet, curRow, 36, row.get("QLTY_VAL_WK"));
  351. setQlty(rs, sheet, coilNo, qltyCD, curRow);
  352. label = new Label(33, fixedRow, qltyName, cell.getCellFormat());
  353. label.setString(qltyName);
  354. sheet.addCell(label);
  355. }
  356. }else if (qltyCD.equals("?")) {
  357. cell = rs.getCell(18, 12);
  358. setValue(sheet, curRow, 18, row.get(cell.getContents().trim()));
  359. cell = rs.getCell(22, 12); // AVE
  360. setValue(sheet, curRow, 22, row.get("QLTY_VAL_WK"));
  361. setQlty(rs, sheet, coilNo, qltyCD, curRow);
  362. }else if (qltyCD.equals("HD")) {
  363. cell = rs.getCell(26, 12);
  364. setValue(sheet, curRow, 26, row.get(cell.getContents().trim()));
  365. cell = rs.getCell(29, 12); // AVE
  366. setValue(sheet, curRow, 29, row.get("QLTY_VAL_WK"));
  367. setQlty(rs, sheet, coilNo, qltyCD, curRow);
  368. //////////////////////////
  369. label = new Label(26, fixedRow, qltyName, cell.getCellFormat());
  370. label.setString(qltyName);
  371. sheet.addCell(label);
  372. } else if (qltyCD.equals("CB")) {
  373. cell = rs.getCell(24, 12); // CB
  374. setValue(sheet, curRow, 24, row.get("QLTY_VAL_WK"));
  375. setQlty(rs, sheet, coilNo, qltyCD, curRow);
  376. }
  377. // else if(qltyCD.equals("TT"))//----------------------------------------
  378. // else if("晶粒度".equals(qltyName))
  379. // {
  380. // cell = rs.getCell(32, 12);
  381. // setValue(sheet, curRow, 32, row.get("QLTY_VAL_WK"));
  382. // setQlty(rs, sheet, coilNo, qltyCD, curRow);
  383. // }
  384. else {
  385. // qltyName = (String)row.get("QLTY_CD_CFNM");
  386. for (curCol = 41; curCol < TheCols; curCol++) {
  387. cell = sheet.getCell(curCol, fixedRow);
  388. if (cell.getContents().equals(qltyName)) break;
  389. if (cell.getType() == CellType.EMPTY) {
  390. cell = rs.getCell(curCol, 10);
  391. label = new Label(curCol, fixedRow, qltyName, cell.getCellFormat());
  392. sheet.addCell(label);
  393. break;
  394. }
  395. }
  396. if (curCol < TotalCols)
  397. setValue(sheet, curRow, curCol, row.get("QLTY_VAL_WK"));
  398. }
  399. }
  400. addBlankRow(sheet, curRow, rs, 12, count);
  401. //制表人
  402. list = (List)dataList.get(0);
  403. if (list.size() > 0) {
  404. Map row = (Map)list.get(0);
  405. //注意,不能用rs.getRows(),rs代表的是原始模板
  406. //label = new Label(10, sheet.getRows()-1, row.get("USERID").toString());
  407. label = new Label(10, 33, row.get("USERID").toString());
  408. sheet.addCell(label);
  409. }
  410. //备注
  411. list = (List)dataList.get(0);
  412. if (list.size() > 0) {
  413. Map row = (Map)list.get(0);
  414. //注意,不能用rs.getRows(),rs代表的是原始模板
  415. // Label la = new Label(0,29 , "");
  416. label = new Label(2, 29, row.get("CRET_NO_RMK")==null?"": row.get("CRET_NO_RMK").toString() , PosCertificate.getCommStyle() );
  417. sheet.addCell(label);
  418. }
  419. }
  420. public static WritableCellFormat getCommStyle()
  421. {
  422. WritableFont wf =null;
  423. WritableCellFormat wcf =null;
  424. try
  425. {
  426. wf = new WritableFont(WritableFont.createFont("黑体") , 9);//设置字体大小
  427. // wf.setColour(Colour.RED);//设置颜色
  428. wcf = new WritableCellFormat(wf);
  429. wcf.setBorder(Border.ALL, BorderLineStyle.THIN);//设置边框
  430. wcf.setAlignment(Alignment.LEFT);
  431. wcf.setVerticalAlignment(VerticalAlignment.CENTRE);
  432. // wcf.setWrap(true);//自动换行
  433. }catch(Exception ex)
  434. {
  435. ex.printStackTrace();
  436. }
  437. return wcf;
  438. }
  439. private void setQlty(Sheet rs, WritableSheet sheet, String coilNo, String qltyCD, int curRow) {
  440. if (dataList == null || dataList.size() < 5) return;
  441. List list = (List)dataList.get(4);
  442. String qltySeq;
  443. Cell cell;
  444. int curCol = 0;
  445. boolean canExit = false;
  446. /*for (int i = 0; i < list.size(); ) {
  447. Map row = (Map)list.get(i);
  448. if (row.get("COIL_NO").equals(coilNo)) {
  449. canExit = true;
  450. String xxx = (String)row.get("QLTY_CD");
  451. if (row.get("QLTY_CD").equals(qltyCD)) {
  452. qltySeq = (String)row.get("QLTY_SEQ");
  453. if ("IM".equals(qltyCD)) {
  454. if("H".equals(row.get("MS_QLTY_DIR"))||"Z".equals(row.get("MS_QLTY_DIR")))
  455. {
  456. for (curCol = 14; curCol < 17; curCol++) {
  457. cell = rs.getCell(curCol, 12);
  458. if (cell.getContents().trim().equals(qltySeq)) {
  459. setValue(sheet, curRow, curCol, row.get("QLTY_VAL_WK"));
  460. break;
  461. }
  462. }
  463. }
  464. if("L".equals(row.get("MS_QLTY_DIR"))||"X".equals(row.get("MS_QLTY_DIR")))
  465. {
  466. for (curCol = 21; curCol < 24; curCol++) {
  467. cell = rs.getCell(curCol, 12);
  468. if (cell.getContents().trim().equals(qltySeq)) {
  469. setValue(sheet, curRow, curCol, row.get("QLTY_VAL_WK"));
  470. break;
  471. }
  472. }
  473. }
  474. } else if ("?".equals(qltyCD)) {
  475. for (curCol = 19; curCol < 22; curCol++) {
  476. cell = rs.getCell(curCol, 12);
  477. if (cell.getContents().trim().equals(qltySeq)) {
  478. setValue(sheet, curRow, curCol, row.get("QLTY_VAL_WK"));
  479. break;
  480. }
  481. }
  482. }else if ("HD".equals(qltyCD)) {
  483. for (curCol = 26; curCol < 29; curCol++) {
  484. cell = rs.getCell(curCol, 12);
  485. if (cell.getContents().trim().equals(qltySeq)) {
  486. setValue(sheet, curRow, curCol, row.get("QLTY_VAL_WK"));
  487. break;
  488. }
  489. }
  490. }
  491. list.remove(i);
  492. }
  493. } else {
  494. System.out.println("xxxxxxxxx");
  495. if (canExit) break;
  496. i++;
  497. }
  498. }*/
  499. for (int i = 0;i < list.size();i++) {
  500. Map row = (Map)list.get(i);
  501. if (row.get("COIL_NO").equals(coilNo)) {
  502. if (row.get("QLTY_CD").equals(qltyCD)) {
  503. qltySeq = (String)row.get("QLTY_SEQ");
  504. // String qltyName = row.get("QLTY_CD_CFNM").toString();
  505. if("IM".equals(qltyCD) && row.get("MS_QLTY_DIR") == null)
  506. {
  507. // System.out.println("#################"+row.get("QLTY_CD_CFNM"));
  508. for (curCol = 18; curCol < 21; curCol++) {
  509. cell = rs.getCell(curCol, 12);
  510. if (cell.getContents().trim().equals(qltySeq)) {
  511. setValue(sheet, curRow, curCol, row.get("QLTY_VAL_WK"));
  512. row.put("QLTY_CD", "isUsed");
  513. break;
  514. }
  515. }
  516. }
  517. else if ("IM".equals(qltyCD)) {
  518. if("S".equals(row.get("MS_QLTY_DIR")) || "H".equals(row.get("MS_QLTY_DIR"))||"Z".equals(row.get("MS_QLTY_DIR")))//普通冲击
  519. {
  520. for (curCol = 14; curCol < 17; curCol++) {
  521. cell = rs.getCell(curCol, 12);
  522. if (cell.getContents().trim().equals(qltySeq)) {
  523. setValue(sheet, curRow, curCol, row.get("QLTY_VAL_WK"));
  524. row.put("QLTY_CD", "isUsed");
  525. break;
  526. }
  527. }
  528. }
  529. if("L".equals(row.get("MS_QLTY_DIR"))||"X".equals(row.get("MS_QLTY_DIR")))//时效冲击
  530. {
  531. for (curCol = 33; curCol < 36; curCol++) {
  532. cell = rs.getCell(curCol, 12);
  533. if (cell.getContents().trim().equals(qltySeq)) {
  534. setValue(sheet, curRow, curCol, row.get("QLTY_VAL_WK"));
  535. row.put("QLTY_CD", "isUsed");
  536. break;
  537. }
  538. }
  539. }
  540. } else if ("?".equals(qltyCD)) {
  541. for (curCol = 19; curCol < 22; curCol++) {
  542. cell = rs.getCell(curCol, 12);
  543. if (cell.getContents().trim().equals(qltySeq)) {
  544. setValue(sheet, curRow, curCol, row.get("QLTY_VAL_WK"));
  545. row.put("QLTY_CD", "isUsed");
  546. break;
  547. }
  548. }
  549. }else if ("HD".equals(qltyCD)) {
  550. for (curCol = 26; curCol < 29; curCol++) {
  551. cell = rs.getCell(curCol, 12);
  552. if (cell.getContents().trim().equals(qltySeq)) {
  553. setValue(sheet, curRow, curCol, row.get("QLTY_VAL_WK"));
  554. row.put("QLTY_CD", "isUsed");
  555. break;
  556. }
  557. }
  558. }
  559. }
  560. }
  561. }
  562. }
  563. }