7c68f278ed0d967925b576d5bc681395307ecbae.svn-base 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445
  1. package UIM.WGJ;
  2. import com.alibaba.excel.context.AnalysisContext;
  3. import com.alibaba.excel.event.AnalysisEventListener;
  4. import CoreFS.SA06.CoreReturnObject;
  5. import QCM.COMMUNAL.OrderSqMapper;
  6. import QCM.COMMUNAL.VO.ExcelWGJ;
  7. import QCM.COMMUNAL.VO.ExcelWGJCF;
  8. import QCM.COMMUNAL.VO.ExcelWGJCXN;
  9. import QCM.COMMUNAL.VO.ExcelWGJMain;
  10. import java.text.SimpleDateFormat;
  11. import java.util.ArrayList;
  12. import java.util.Date;
  13. import java.util.HashMap;
  14. import java.util.List;
  15. import java.util.Map;
  16. import org.apache.ibatis.session.ExecutorType;
  17. import org.apache.ibatis.session.SqlSession;
  18. public class ExcelModelListener extends AnalysisEventListener<ExcelWGJ> {
  19. private String opman;
  20. public ExcelModelListener(String opman){
  21. this.opman = opman;
  22. }
  23. private static final int BATCH_COUNT = 1000;
  24. List<ExcelWGJ> list = new ArrayList<ExcelWGJ>();
  25. List<ExcelWGJMain> list1 = new ArrayList<ExcelWGJMain>();
  26. List<ExcelWGJCXN> list2 = new ArrayList<ExcelWGJCXN>();
  27. List<ExcelWGJCF> list3 = new ArrayList<ExcelWGJCF>();
  28. List<ExcelWGJCF> list4 = new ArrayList<ExcelWGJCF>();
  29. //Map<String,Integer> map = new HashMap<>();
  30. private static int count = 1;
  31. @Override
  32. public void invoke(ExcelWGJ data, AnalysisContext context) {
  33. list.add(data);
  34. count ++;
  35. if (list.size() >= BATCH_COUNT) {
  36. saveData();
  37. list.clear();
  38. }
  39. }
  40. @Override
  41. public void doAfterAllAnalysed(AnalysisContext context) {
  42. saveData();
  43. list.clear();
  44. }
  45. private CoreReturnObject saveData() {
  46. int i = 0;
  47. int count=0;
  48. int index = 0;
  49. SimpleDateFormat sdf=new SimpleDateFormat("yy");
  50. String date=sdf.format(new Date());
  51. CoreReturnObject cro = new CoreReturnObject();
  52. SqlSession SqlSession = QCM.COMMUNAL.SqlSessionBuilder.openSqlSession();
  53. OrderSqMapper mapper = SqlSession.getMapper(QCM.COMMUNAL.OrderSqMapper.class);
  54. try{
  55. for(ExcelWGJ excelWGJ :list){
  56. count = Integer.parseInt(mapper.queryMaxXuHao());
  57. index = Integer.parseInt(excelWGJ.getCoil_no());
  58. /*if(!("".equals(excelWGJ.getKlqd())||null==excelWGJ.getKlqd())){
  59. ExcelWGJCXN ewxn = new ExcelWGJCXN();
  60. ewxn.setSpecimen_no(excelWGJ.getOld_sampl_no());
  61. ewxn.setPhy_name_s("抗拉强度");
  62. ewxn.setVal1(excelWGJ.getKlqd());
  63. //mapper.insertExcelWGJCXN(ewxn);
  64. list2.add(ewxn);
  65. }
  66. if(!("".equals(excelWGJ.getQfqd())||null==excelWGJ.getQfqd())){
  67. ExcelWGJCXN ewxn = new ExcelWGJCXN();
  68. ewxn.setSpecimen_no(excelWGJ.getOld_sampl_no());
  69. ewxn.setPhy_name_s("屈服强度");
  70. ewxn.setVal1(excelWGJ.getQfqd());
  71. //mapper.insertExcelWGJCXN(ewxn);
  72. list2.add(ewxn);
  73. }
  74. if(!("".equals(excelWGJ.getDhscl())||null==excelWGJ.getDhscl())){
  75. ExcelWGJCXN ewxn = new ExcelWGJCXN();
  76. ewxn.setSpecimen_no(excelWGJ.getOld_sampl_no());
  77. ewxn.setPhy_name_s("断后伸长率");
  78. ewxn.setVal1(excelWGJ.getDhscl());
  79. //mapper.insertExcelWGJCXN(ewxn);
  80. list2.add(ewxn);
  81. }*/
  82. if(excelWGJ.getCoil_no()!=""||excelWGJ.getCoil_no()!=null){
  83. ExcelWGJCXN ewxn = new ExcelWGJCXN();
  84. ewxn.setCoil_no("R"+date+String.format("%06d", count+index)+"W010");
  85. ewxn.setQfqd(excelWGJ.getQfqd());
  86. ewxn.setKlqd(excelWGJ.getKlqd());
  87. ewxn.setDhscl(excelWGJ.getDhscl());
  88. list2.add(ewxn);
  89. }
  90. /*if(!("".equals(excelWGJ.getCharge_no())||null==excelWGJ.getCharge_no())
  91. &&map.containsKey(excelWGJ.getCharge_no())==false){*/
  92. //if(mapper.haswgjcf("R"+date+String.format("%06d", count+index)+"W")<1){
  93. if(!("".equals(excelWGJ.getC())||null==excelWGJ.getC())){
  94. ExcelWGJCF ewcf = new ExcelWGJCF();
  95. ewcf.setBatch_no("R"+date+String.format("%06d", count+index)+"W");
  96. ewcf.setAssay_no("R"+date+String.format("%06d", count+index)+"W"+"CP-2");
  97. ewcf.setMaterial_no("R"+date+String.format("%06d", count+index)+"W");
  98. ewcf.setHeat_no("R"+date+String.format("%06d", count+index)+"W");
  99. ewcf.setChem_cd("C");
  100. ewcf.setChem_name("C");
  101. ewcf.setChem_value(excelWGJ.getC());
  102. ewcf.setCreate_name(opman);
  103. //mapper.insertExcelWGJCF(ewcf);
  104. list3.add(ewcf);
  105. ExcelWGJCF ewcf1 = new ExcelWGJCF();
  106. ewcf1.setCharge_no("R"+date+String.format("%06d", count+index)+"W");
  107. ewcf1.setChem_cd("C");
  108. ewcf1.setChem_value(excelWGJ.getC());
  109. ewcf1.setChem_value(excelWGJ.getC());
  110. list4.add(ewcf1);
  111. }
  112. if(!("".equals(excelWGJ.getB())||null==excelWGJ.getB())){
  113. ExcelWGJCF ewcf = new ExcelWGJCF();
  114. ewcf.setBatch_no("R"+date+String.format("%06d", count+index)+"W");
  115. ewcf.setAssay_no("R"+date+String.format("%06d", count+index)+"W"+"CP-2");
  116. ewcf.setMaterial_no("R"+date+String.format("%06d", count+index)+"W");
  117. ewcf.setHeat_no("R"+date+String.format("%06d", count+index)+"W");
  118. ewcf.setChem_cd("B");
  119. ewcf.setChem_name("B");
  120. ewcf.setChem_value(excelWGJ.getB());
  121. ewcf.setCreate_name(opman);
  122. //mapper.insertExcelWGJCF(ewcf);
  123. list3.add(ewcf);
  124. ExcelWGJCF ewcf1 = new ExcelWGJCF();
  125. ewcf1.setCharge_no("R"+date+String.format("%06d", count+index)+"W");
  126. ewcf1.setChem_cd("B");
  127. ewcf1.setChem_value(excelWGJ.getB());
  128. ewcf1.setChem_value(excelWGJ.getB());
  129. list4.add(ewcf1);
  130. }
  131. if(!("".equals(excelWGJ.getAls())||null==excelWGJ.getAls())){
  132. ExcelWGJCF ewcf = new ExcelWGJCF();
  133. ewcf.setBatch_no("R"+date+String.format("%06d", count+index)+"W");
  134. ewcf.setAssay_no("R"+date+String.format("%06d", count+index)+"W"+"CP-2");
  135. ewcf.setMaterial_no("R"+date+String.format("%06d", count+index)+"W");
  136. ewcf.setHeat_no("R"+date+String.format("%06d", count+index)+"W");
  137. ewcf.setChem_cd("Als");
  138. ewcf.setChem_name("Als");
  139. ewcf.setChem_value(excelWGJ.getAls());
  140. ewcf.setCreate_name(opman);
  141. //mapper.insertExcelWGJCF(ewcf);
  142. list3.add(ewcf);
  143. ExcelWGJCF ewcf1 = new ExcelWGJCF();
  144. ewcf1.setCharge_no("R"+date+String.format("%06d", count+index)+"W");
  145. ewcf1.setChem_cd("Als");
  146. ewcf1.setChem_value(excelWGJ.getAls());
  147. ewcf1.setChem_value(excelWGJ.getAls());
  148. list4.add(ewcf1);
  149. }
  150. if(!("".equals(excelWGJ.getAlt())||null==excelWGJ.getAlt())){
  151. ExcelWGJCF ewcf = new ExcelWGJCF();
  152. ewcf.setBatch_no("R"+date+String.format("%06d", count+index)+"W");
  153. ewcf.setAssay_no("R"+date+String.format("%06d", count+index)+"W"+"CP-2");
  154. ewcf.setMaterial_no("R"+date+String.format("%06d", count+index)+"W");
  155. ewcf.setHeat_no("R"+date+String.format("%06d", count+index)+"W");
  156. ewcf.setChem_cd("Alt");
  157. ewcf.setChem_name("Alt");
  158. ewcf.setChem_value(excelWGJ.getAlt());
  159. ewcf.setCreate_name(opman);
  160. //mapper.insertExcelWGJCF(ewcf);
  161. list3.add(ewcf);
  162. ExcelWGJCF ewcf1 = new ExcelWGJCF();
  163. ewcf1.setCharge_no("R"+date+String.format("%06d", count+index)+"W");
  164. ewcf1.setChem_cd("Alt");
  165. ewcf1.setChem_value(excelWGJ.getAlt());
  166. ewcf1.setChem_value(excelWGJ.getAlt());
  167. list4.add(ewcf1);
  168. }
  169. if(!("".equals(excelWGJ.getAs())||null==excelWGJ.getAs())){
  170. ExcelWGJCF ewcf = new ExcelWGJCF();
  171. ewcf.setBatch_no("R"+date+String.format("%06d", count+index)+"W");
  172. ewcf.setAssay_no("R"+date+String.format("%06d", count+index)+"W"+"CP-2");
  173. ewcf.setMaterial_no("R"+date+String.format("%06d", count+index)+"W");
  174. ewcf.setHeat_no("R"+date+String.format("%06d", count+index)+"W");
  175. ewcf.setChem_cd("As");
  176. ewcf.setChem_name("As");
  177. ewcf.setChem_value(excelWGJ.getAs());
  178. ewcf.setCreate_name(opman);
  179. //mapper.insertExcelWGJCF(ewcf);
  180. list3.add(ewcf);
  181. ExcelWGJCF ewcf1 = new ExcelWGJCF();
  182. ewcf1.setCharge_no("R"+date+String.format("%06d", count+index)+"W");
  183. ewcf1.setChem_cd("As");
  184. ewcf1.setChem_value(excelWGJ.getAs());
  185. ewcf1.setChem_value(excelWGJ.getAs());
  186. list4.add(ewcf1);
  187. }
  188. if(!("".equals(excelWGJ.getMo())||null==excelWGJ.getMo())){
  189. ExcelWGJCF ewcf = new ExcelWGJCF();
  190. ewcf.setBatch_no("R"+date+String.format("%06d", count+index)+"W");
  191. ewcf.setAssay_no("R"+date+String.format("%06d", count+index)+"W"+"CP-2");
  192. ewcf.setMaterial_no("R"+date+String.format("%06d", count+index)+"W");
  193. ewcf.setHeat_no("R"+date+String.format("%06d", count+index)+"W");
  194. ewcf.setChem_cd("Mo");
  195. ewcf.setChem_name("Mo");
  196. ewcf.setChem_value(excelWGJ.getMo());
  197. ewcf.setCreate_name(opman);
  198. //mapper.insertExcelWGJCF(ewcf);
  199. list3.add(ewcf);
  200. ExcelWGJCF ewcf1 = new ExcelWGJCF();
  201. ewcf1.setCharge_no("R"+date+String.format("%06d", count+index)+"W");
  202. ewcf1.setChem_cd("Mo");
  203. ewcf1.setChem_value(excelWGJ.getMo());
  204. ewcf1.setChem_value(excelWGJ.getMo());
  205. list4.add(ewcf1);
  206. }
  207. if(!("".equals(excelWGJ.getMn())||null==excelWGJ.getMn())){
  208. ExcelWGJCF ewcf = new ExcelWGJCF();
  209. ewcf.setBatch_no("R"+date+String.format("%06d", count+index)+"W");
  210. ewcf.setAssay_no("R"+date+String.format("%06d", count+index)+"W"+"CP-2");
  211. ewcf.setMaterial_no("R"+date+String.format("%06d", count+index)+"W");
  212. ewcf.setHeat_no("R"+date+String.format("%06d", count+index)+"W");
  213. ewcf.setChem_cd("Mn");
  214. ewcf.setChem_name("Mn");
  215. ewcf.setChem_value(excelWGJ.getMn());
  216. ewcf.setCreate_name(opman);
  217. //mapper.insertExcelWGJCF(ewcf);
  218. list3.add(ewcf);
  219. ExcelWGJCF ewcf1 = new ExcelWGJCF();
  220. ewcf1.setCharge_no("R"+date+String.format("%06d", count+index)+"W");
  221. ewcf1.setChem_cd("Mn");
  222. ewcf1.setChem_value(excelWGJ.getMn());
  223. ewcf1.setChem_value(excelWGJ.getMn());
  224. list4.add(ewcf1);
  225. }
  226. if(!("".equals(excelWGJ.getS())||null==excelWGJ.getS())){
  227. ExcelWGJCF ewcf = new ExcelWGJCF();
  228. ewcf.setBatch_no("R"+date+String.format("%06d", count+index)+"W");
  229. ewcf.setAssay_no("R"+date+String.format("%06d", count+index)+"W"+"CP-2");
  230. ewcf.setMaterial_no("R"+date+String.format("%06d", count+index)+"W");
  231. ewcf.setHeat_no("R"+date+String.format("%06d", count+index)+"W");
  232. ewcf.setChem_cd("S");
  233. ewcf.setChem_name("S");
  234. ewcf.setChem_value(excelWGJ.getS());
  235. ewcf.setCreate_name(opman);
  236. //mapper.insertExcelWGJCF(ewcf);
  237. list3.add(ewcf);
  238. ExcelWGJCF ewcf1 = new ExcelWGJCF();
  239. ewcf1.setCharge_no("R"+date+String.format("%06d", count+index)+"W");
  240. ewcf1.setChem_cd("S");
  241. ewcf1.setChem_value(excelWGJ.getS());
  242. ewcf1.setChem_value(excelWGJ.getS());
  243. list4.add(ewcf1);
  244. }
  245. if(!("".equals(excelWGJ.getP())||null==excelWGJ.getP())){
  246. ExcelWGJCF ewcf = new ExcelWGJCF();
  247. ewcf.setBatch_no("R"+date+String.format("%06d", count+index)+"W");
  248. ewcf.setAssay_no("R"+date+String.format("%06d", count+index)+"W"+"CP-2");
  249. ewcf.setMaterial_no("R"+date+String.format("%06d", count+index)+"W");
  250. ewcf.setHeat_no("R"+date+String.format("%06d", count+index)+"W");
  251. ewcf.setChem_cd("P");
  252. ewcf.setChem_name("P");
  253. ewcf.setChem_value(excelWGJ.getP());
  254. ewcf.setCreate_name(opman);
  255. //mapper.insertExcelWGJCF(ewcf);
  256. list3.add(ewcf);
  257. ExcelWGJCF ewcf1 = new ExcelWGJCF();
  258. ewcf1.setCharge_no("R"+date+String.format("%06d", count+index)+"W");
  259. ewcf1.setChem_cd("P");
  260. ewcf1.setChem_value(excelWGJ.getP());
  261. ewcf1.setChem_value(excelWGJ.getP());
  262. list4.add(ewcf1);
  263. }
  264. if(!("".equals(excelWGJ.getSi())||null==excelWGJ.getSi())){
  265. ExcelWGJCF ewcf = new ExcelWGJCF();
  266. ewcf.setBatch_no("R"+date+String.format("%06d", count+index)+"W");
  267. ewcf.setAssay_no("R"+date+String.format("%06d", count+index)+"W"+"CP-2");
  268. ewcf.setMaterial_no("R"+date+String.format("%06d", count+index)+"W");
  269. ewcf.setHeat_no("R"+date+String.format("%06d", count+index)+"W");
  270. ewcf.setChem_cd("Si");
  271. ewcf.setChem_name("Si");
  272. ewcf.setChem_value(excelWGJ.getSi());
  273. ewcf.setCreate_name(opman);
  274. //mapper.insertExcelWGJCF(ewcf);
  275. list3.add(ewcf);
  276. ExcelWGJCF ewcf1 = new ExcelWGJCF();
  277. ewcf1.setCharge_no("R"+date+String.format("%06d", count+index)+"W");
  278. ewcf1.setChem_cd("Si");
  279. ewcf1.setChem_value(excelWGJ.getSi());
  280. ewcf1.setChem_value(excelWGJ.getSi());
  281. list4.add(ewcf1);
  282. }
  283. if(!("".equals(excelWGJ.getCr())||null==excelWGJ.getCr())){
  284. ExcelWGJCF ewcf = new ExcelWGJCF();
  285. ewcf.setBatch_no("R"+date+String.format("%06d", count+index)+"W");
  286. ewcf.setAssay_no("R"+date+String.format("%06d", count+index)+"W"+"CP-2");
  287. ewcf.setMaterial_no("R"+date+String.format("%06d", count+index)+"W");
  288. ewcf.setHeat_no("R"+date+String.format("%06d", count+index)+"W");
  289. ewcf.setChem_cd("Cr");
  290. ewcf.setChem_name("Cr");
  291. ewcf.setChem_value(excelWGJ.getCr());
  292. ewcf.setCreate_name(opman);
  293. //mapper.insertExcelWGJCF(ewcf);
  294. list3.add(ewcf);
  295. ExcelWGJCF ewcf1 = new ExcelWGJCF();
  296. ewcf1.setCharge_no("R"+date+String.format("%06d", count+index)+"W");
  297. ewcf1.setChem_cd("Cr");
  298. ewcf1.setChem_value(excelWGJ.getCr());
  299. ewcf1.setChem_value(excelWGJ.getCr());
  300. list4.add(ewcf1);
  301. }
  302. if(!("".equals(excelWGJ.getNi())||null==excelWGJ.getNi())){
  303. ExcelWGJCF ewcf = new ExcelWGJCF();
  304. ewcf.setBatch_no("R"+date+String.format("%06d", count+index)+"W");
  305. ewcf.setAssay_no("R"+date+String.format("%06d", count+index)+"W"+"CP-2");
  306. ewcf.setMaterial_no("R"+date+String.format("%06d", count+index)+"W");
  307. ewcf.setHeat_no("R"+date+String.format("%06d", count+index)+"W");
  308. ewcf.setChem_cd("Ni");
  309. ewcf.setChem_name("Ni");
  310. ewcf.setChem_value(excelWGJ.getNi());
  311. ewcf.setCreate_name(opman);
  312. //mapper.insertExcelWGJCF(ewcf);
  313. list3.add(ewcf);
  314. ExcelWGJCF ewcf1 = new ExcelWGJCF();
  315. ewcf1.setCharge_no("R"+date+String.format("%06d", count+index)+"W");
  316. ewcf1.setChem_cd("Ni");
  317. ewcf1.setChem_value(excelWGJ.getNi());
  318. ewcf1.setChem_value(excelWGJ.getNi());
  319. list4.add(ewcf1);
  320. }
  321. if(!("".equals(excelWGJ.getCu())||null==excelWGJ.getCu())){
  322. ExcelWGJCF ewcf = new ExcelWGJCF();
  323. ewcf.setBatch_no("R"+date+String.format("%06d", count+index)+"W");
  324. ewcf.setAssay_no("R"+date+String.format("%06d", count+index)+"W"+"CP-2");
  325. ewcf.setMaterial_no("R"+date+String.format("%06d", count+index)+"W");
  326. ewcf.setHeat_no("R"+date+String.format("%06d", count+index)+"W");
  327. ewcf.setChem_cd("Cu");
  328. ewcf.setChem_name("Cu");
  329. ewcf.setChem_value(excelWGJ.getCu());
  330. ewcf.setCreate_name(opman);
  331. //mapper.insertExcelWGJCF(ewcf);
  332. list3.add(ewcf);
  333. ExcelWGJCF ewcf1 = new ExcelWGJCF();
  334. ewcf1.setCharge_no("R"+date+String.format("%06d", count+index)+"W");
  335. ewcf1.setChem_cd("Cu");
  336. ewcf1.setChem_value(excelWGJ.getCu());
  337. ewcf1.setChem_value(excelWGJ.getCu());
  338. list4.add(ewcf1);
  339. }
  340. if(!("".equals(excelWGJ.getV())||null==excelWGJ.getV())){
  341. ExcelWGJCF ewcf = new ExcelWGJCF();
  342. ewcf.setBatch_no("R"+date+String.format("%06d", count+index)+"W");
  343. ewcf.setAssay_no("R"+date+String.format("%06d", count+index)+"W"+"CP-2");
  344. ewcf.setMaterial_no("R"+date+String.format("%06d", count+index)+"W");
  345. ewcf.setHeat_no("R"+date+String.format("%06d", count+index)+"W");
  346. ewcf.setChem_cd("V");
  347. ewcf.setChem_name("V");
  348. ewcf.setChem_value(excelWGJ.getV());
  349. ewcf.setCreate_name(opman);
  350. //mapper.insertExcelWGJCF(ewcf);
  351. list3.add(ewcf);
  352. ExcelWGJCF ewcf1 = new ExcelWGJCF();
  353. ewcf1.setCharge_no("R"+date+String.format("%06d", count+index)+"W");
  354. ewcf1.setChem_cd("V");
  355. ewcf1.setChem_value(excelWGJ.getV());
  356. ewcf1.setChem_value(excelWGJ.getV());
  357. list4.add(ewcf1);
  358. }
  359. if(!("".equals(excelWGJ.getTi())||null==excelWGJ.getTi())){
  360. ExcelWGJCF ewcf = new ExcelWGJCF();
  361. ewcf.setBatch_no("R"+date+String.format("%06d", count+index)+"W");
  362. ewcf.setAssay_no("R"+date+String.format("%06d", count+index)+"W"+"CP-2");
  363. ewcf.setMaterial_no("R"+date+String.format("%06d", count+index)+"W");
  364. ewcf.setHeat_no("R"+date+String.format("%06d", count+index)+"W");
  365. ewcf.setChem_cd("Ti");
  366. ewcf.setChem_name("Ti");
  367. ewcf.setChem_value(excelWGJ.getTi());
  368. ewcf.setCreate_name(opman);
  369. //mapper.insertExcelWGJCF(ewcf);
  370. list3.add(ewcf);
  371. ExcelWGJCF ewcf1 = new ExcelWGJCF();
  372. ewcf1.setCharge_no("R"+date+String.format("%06d", count+index)+"W");
  373. ewcf1.setChem_cd("Ti");
  374. ewcf1.setChem_value(excelWGJ.getTi());
  375. ewcf1.setChem_value(excelWGJ.getTi());
  376. list4.add(ewcf1);
  377. }
  378. //map.put(excelWGJ.getCharge_no(), 1);
  379. //if("PRC".equals(excelWGJ.getCur_prog_cd())){
  380. if(mapper.haswgjcoil_no(excelWGJ.getCoil_no())<1){
  381. ExcelWGJMain ewm = new ExcelWGJMain();
  382. //count = Integer.parseInt(mapper.queryMaxXuHao());
  383. //index = Integer.parseInt(excelWGJ.getCoil_no());
  384. ewm.setSpec_stl_grd(excelWGJ.getSpec_stl_grd());
  385. ewm.setStl_grd(excelWGJ.getSpec_stl_grd());
  386. ewm.setSpec_abbsym(excelWGJ.getSpec_abbsym());
  387. ewm.setSlab_no(excelWGJ.getSlab_no());
  388. ewm.setOrd_fl(excelWGJ.getOrd_fl());
  389. ewm.setOld_sampl_no("R"+date+String.format("%06d", count+index)+"W010");
  390. ewm.setCur_prog_cd(excelWGJ.getCur_prog_cd());
  391. ewm.setCoil_wth(excelWGJ.getCoil_wth());
  392. ewm.setCoil_thk(excelWGJ.getCoil_thk());
  393. //ewm.setCoil_stat(String.valueOf(excelWGJ.getCoil_stat()));
  394. ewm.setCoil_outdia(excelWGJ.getCoil_outdia());
  395. ewm.setCoil_no("R"+date+String.format("%06d", count+index)+"W010");
  396. ewm.setCoil_len(excelWGJ.getCoil_len());
  397. ewm.setCoil_india(excelWGJ.getCoil_india());
  398. ewm.setAct_wgt(excelWGJ.getAct_wgt());
  399. //mapper.insertExcelWGJMain(ewm);
  400. list1.add(ewm);
  401. }
  402. i++;
  403. if(i > 0 && i%30==0){
  404. if(list1.size()!=0)
  405. mapper.insertExcelWGJMain(list1);
  406. if(list3.size()!=0)
  407. mapper.insertExcelWGJCF(list3);
  408. mapper.insertExcelWGJCF1(list4);
  409. if(list2.size()!=0)
  410. mapper.insertExcelWGJCXN(list2);
  411. SqlSession.commit();
  412. list1 = new ArrayList<ExcelWGJMain>();
  413. list2 = new ArrayList<ExcelWGJCXN>();
  414. list3 = new ArrayList<ExcelWGJCF>();
  415. }
  416. }
  417. }catch(Exception e){
  418. e.printStackTrace();
  419. SqlSession.rollback();
  420. SqlSession.close();
  421. }finally{
  422. if(list1.size()!=0)
  423. mapper.insertExcelWGJMain(list1);
  424. if(list3.size()!=0)
  425. mapper.insertExcelWGJCF(list3);
  426. mapper.insertExcelWGJCF1(list4);
  427. if(list2.size()!=0)
  428. mapper.insertExcelWGJCXN(list2);
  429. SqlSession.commit();
  430. }
  431. SqlSession.close();
  432. cro.setV_errCode(1);
  433. return cro;
  434. }
  435. }