7669540ca80d4169326c4ccfa296ae0687ba96bd.svn-base 180 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637
  1. package QCM.JHY01.JHY0101;
  2. import java.math.BigDecimal;
  3. import java.sql.ResultSet;
  4. import java.sql.SQLException;
  5. import java.text.SimpleDateFormat;
  6. import java.util.ArrayList;
  7. import java.util.Date;
  8. import java.util.HashMap;
  9. import java.util.List;
  10. import java.util.TreeSet;
  11. import java.util.UUID;
  12. import org.apache.commons.lang.StringUtils;
  13. import org.apache.ibatis.session.SqlSession;
  14. import org.apache.log4j.Logger;
  15. import com.alibaba.fastjson.JSON;
  16. import com.alibaba.fastjson.JSONArray;
  17. import com.alibaba.fastjson.JSONObject;
  18. import CoreFS.SA01.CoreIComponent;
  19. import CoreFS.SA06.CoreReturnObject;
  20. import QCM.COMMUNAL.communalClass;
  21. import QCM.COMMUNAL.VO.QcmJhySampleROrd;
  22. import QCM.JHY01.VO.JhyQltyModel;
  23. import QCM.JHY01.VO.JhySampleDItemModel;
  24. import QCM.JHY01.VO.JhySampleDModel;
  25. public class DuplicateSample2 extends CoreIComponent {
  26. SqlSession SqlSession = QCM.COMMUNAL.SqlSessionBuilder.openSqlSession();
  27. QCM.COMMUNAL.OrderSqMapper mapper = SqlSession.getMapper(QCM.COMMUNAL.OrderSqMapper.class);
  28. Logger logger = Logger.getLogger(this.getClass().getName());
  29. public boolean DSampleLogo =false;//判断是否是复样块块取样
  30. public boolean DSampleLogo2 =false;//件件取样 标识
  31. public Integer heGold2 = 1;//线棒 金相数 判断第一个金相是否已做 已做 第二个金相就不用再做
  32. public Integer LT1A08 = 1;//连退 常温拉伸 峰值密度
  33. public boolean ZFMotherboard = false;//16中厚板按母板取样
  34. public boolean motherboard = true;//是否标识生成D表用到
  35. public String ZHmaterialNo ="";//中厚板复样取样材料号
  36. public synchronized String doDuplicateSample(JSONArray list) {
  37. logger.info("复样:==========复样" + list.toString());
  38. DuplicateSampleLog(list.toString(), "复样委托");// 插入日志
  39. String msg = checkInfo(list);
  40. if (!"".equals(msg)) {
  41. return msg;
  42. }
  43. try {
  44. // 当前试样号复样情况,不考虑引用状况
  45. createQltySample(list);
  46. createChemSample(list);
  47. SqlSession.commit();
  48. } catch (Exception e) {
  49. // TODO: handle exception
  50. logger.error(e.toString() + e.getMessage() + "复样委托:json数据:" + list.toString() + "\n");
  51. System.out.println("复样委托失败:json数据:" + list.toString() + "\n"+e.getMessage());
  52. e.printStackTrace();
  53. SqlSession.rollback();
  54. } finally {
  55. SqlSession.close();
  56. }
  57. if ("".equals(msg)) {
  58. return "1";
  59. } else {
  60. System.out.println("复样委托失败:json数据:" + list.toString() + "\n");
  61. return "生成失败!";
  62. }
  63. }
  64. private void createChemSample(JSONArray lists) {
  65. // TODO Auto-generated method stub
  66. StringBuffer sqlucomm = new StringBuffer();
  67. for (Object li : lists) {
  68. JSONObject list = (JSONObject) li;
  69. // 判断是否存在材质
  70. if (!"1".equals(list.getString("IS_CHEM"))) {
  71. continue;
  72. }
  73. String YNSql=" select t.* from qcm_jhy_sample_consign_d t,qcm_jhy_sample_r_ord r "
  74. +" where t.smp_no = r.smp_no and t.CHEM_ITEM is not null "
  75. +" and t.batch_no = '"+list.getString("BATCH_NO")+"' "
  76. +" and t.inspection_lot = '"+list.getString("INSPECTION_LOT")+"' "
  77. +" and t.Smp_Type_Name = '复样' "
  78. +" and r.psc = '"+list.getString("PSC")+"' "
  79. +" and to_char(r.THICK, 'fm990.099') = to_char('"+list.getString("THICK")+"', 'fm990.099') ";
  80. List<HashMap> results2 = mapper.query(YNSql.toString());
  81. if(results2 !=null && results2.size()>=1){
  82. continue;//判断是否已复样
  83. }
  84. sqlucomm.setLength(0);
  85. sqlucomm.append(
  86. "select t.smp_no,t.specimen_no,t.heat_no,t.batch_no,t.inspection_lot,t.freq_code,t.freq_name,");
  87. sqlucomm.append("t.material_no,t.smp_type_code,t.smp_type_name,t.consign_no,t.consign_no_seq,t.test_qty,");
  88. sqlucomm.append("t.smp_qty,t.smp_location,t.board_no,t.quote_consign_no,t.old_consign_no,t.pline_code,");
  89. sqlucomm.append("t.pline_name,t.status,t.validflag,t.source,t.guid,t.send_id,t.send_name,t.send_time,t.MEMO,t.PROCESS_NO,t.PROCESS_NOS,");
  90. sqlucomm.append(
  91. " t.chem_item,t.product_cnt,t.create_time,t.smp_location_code from QCM_JHY_SAMPLE_CONSIGN_D t inner join "
  92. + "QCM_JUDGE_CHEMICAL c on t.smp_no=c.smp_no and t.smp_no='" + list.getString("QLTY_SMP_NO")
  93. + "' and c.cic_result_code='2' and rownum <= 1 ");
  94. List<HashMap> results = mapper.query(sqlucomm.toString());
  95. if (results == null || results.size() < 1) {
  96. continue;
  97. }
  98. String specimen_no = "";
  99. String smpNo = createQltySamNo((String) results.get(0).get("PLINE_CODE"));
  100. String sql ="Insert into QCM_JHY_SAMPLE_CONSIGN_M(SMP_NO,HEAT_NO,BATCH_NO,INSPECTION_LOT,BOARD_NO,MATERIAL_NO,PSC, "
  101. +" PSC_DESC,SMP_CATG,CERT_INST_CODE,CERT_INST_NAME,SMP_TYPE_CODE,SMP_TYPE_NAME,GRADE_CODE,GRADE_NAME, "
  102. +" PLINE_CODE,PLINE_NAME,VALIDFLAG,MEMO,CREATE_ID,CREATE_NAME,CREATE_TIME,ITEM_FLAG,DUPLICATE_SAMPLE) "
  103. +" select '"+smpNo+"',HEAT_NO,BATCH_NO,INSPECTION_LOT,BOARD_NO,MATERIAL_NO,PSC, "
  104. +" PSC_DESC,SMP_CATG,CERT_INST_CODE,CERT_INST_NAME,SMP_TYPE_CODE,SMP_TYPE_NAME,GRADE_CODE,GRADE_NAME, "
  105. +" PLINE_CODE,PLINE_NAME,VALIDFLAG,MEMO,'sys','sys',sysdate,ITEM_FLAG,'复样' "
  106. +" from QCM_JHY_SAMPLE_CONSIGN_M t where t.SMP_NO = '"+list.getString("QLTY_SMP_NO")+"' and rownum <= 1 ";
  107. mapper.insert(sql);
  108. sql = "";
  109. sql = "Insert into QCM_JHY_SAMPLE_R_ORD(DESIGN_KEY,SMP_NO,PSC,PSC_DESC,HEAT_NO,BATCH_NO,INSPECTION_LOT,DELIVERY_STATE_CODE, "
  110. + " DELIVERY_STATE_DESC,THICK,WIDTH,LENGTH,PLINE_CODE,PLINE_NAME,MSC_PLINE,PROCESS_CODE,CERT_INST_CODE,CERT_INST_NAME, "
  111. + " SMP_TYPE_CODE,SMP_TYPE_NAME,SMELTING_CNT,PRODUCT_CNT,JUDGE_STATUS,PROD_CODE,"
  112. + " PROD_NAME,STEEL_CODE,STEEL_NAME,STD_CODE,STD_NAME,CREATE_TIME,CREATE_ID,CREATE_NAME,DUPLICATE_SAMPLE) "
  113. + " select DESIGN_KEY,'"+smpNo+"',PSC,PSC_DESC,HEAT_NO,BATCH_NO,INSPECTION_LOT,DELIVERY_STATE_CODE,DELIVERY_STATE_DESC, "
  114. + " THICK,WIDTH,LENGTH,PLINE_CODE,PLINE_NAME,MSC_PLINE,PROCESS_CODE,CERT_INST_CODE,CERT_INST_NAME,SMP_TYPE_CODE,"
  115. + " SMP_TYPE_NAME,SMELTING_CNT,PRODUCT_CNT,'0',PROD_CODE,PROD_NAME,STEEL_CODE, "
  116. + " STEEL_NAME,STD_CODE,STD_NAME,sysdate,'sys','sys','复样' "
  117. + " from QCM_JHY_SAMPLE_R_ORD t where t.SMP_NO = '"+list.getString("QLTY_SMP_NO")+"' and rownum <= 1 ";
  118. mapper.insert(sql);
  119. //把已经判定的ORD检验号置空 ord先插入后修改
  120. sql = "";
  121. sql =" update QCM_JHY_SAMPLE_R_ORD t set t.INSPECTION_LOT = '' "
  122. + " where t.batch_no = '"+list.getString("BATCH_NO")+"'"
  123. + " and t.smp_no = '"+list.getString("QLTY_SMP_NO")+"' "
  124. + " and t.judge_status = '1' ";
  125. mapper.updateJudgeStatus(sql.toString());
  126. String sqlD="select '"+smpNo+"' as smp_no,t.specimen_no,t.heat_no,t.batch_no,t.inspection_lot,t.freq_code, "
  127. +" t.freq_name,t.material_no,t.smp_type_code,t.smp_type_name,t.consign_no,t.consign_no_seq, "
  128. +" t.test_qty,t.smp_qty,t.smp_location,t.board_no,t.quote_consign_no,t.old_consign_no, "
  129. +" t.pline_code,t.pline_name,t.validflag,t.source,t.guid,t.MEMO,t.PROCESS_NO,t.PROCESS_NOS, "
  130. +" t.chem_item,t.product_cnt,t.create_time,t.smp_location_code "
  131. +" from QCM_JHY_SAMPLE_CONSIGN_D t ,QCM_JUDGE_CHEMICAL c "
  132. +" where t.smp_no = c.smp_no and t.smp_no = '"+list.getString("QLTY_SMP_NO")+"' and c.cic_result_code = '2' and rownum <= 1 ";
  133. List<HashMap> hmresult = mapper.query(sqlD.toString());
  134. for (HashMap result : hmresult) {
  135. // 生成新的复样的取样编号
  136. specimen_no = createSpecimen_no(smpNo);
  137. JhySampleDModel model = getSampleD(specimen_no, result);
  138. model.setSmp_type_code("0");//成分复样 复样类型代码用0 因为在自动判定时成分用的是0
  139. mapper.insertSampleD(model);
  140. }
  141. }
  142. }
  143. private JhySampleDModel getSampleD(String specimen_no, HashMap result) {
  144. // TODO Auto-generated method stub
  145. JhySampleDModel model = new JhySampleDModel();
  146. model.setSmp_no((String) result.get("SMP_NO"));
  147. model.setSpecimen_no(specimen_no);
  148. model.setHeat_no((String) result.get("HEAT_NO"));
  149. model.setBatch_no((String) result.get("BATCH_NO"));
  150. model.setInspection_lot((String) result.get("INSPECTION_LOT"));
  151. // 22.08.11 获取不同的取样材料号 判断是否件件取样 非件件取样 查询取样材料号
  152. String materialNo = "";
  153. if(!DSampleLogo2){//非件件取样
  154. materialNo = getBilletIdM((String) result.get("PLINE_CODE"), (String) result.get("BATCH_NO"));
  155. }else if(!DSampleLogo && DSampleLogo2){//高线小于六吊 件件取样 DSampleLogo:false && DSampleLogo2:true 初样不合格件件取样
  156. materialNo = getBilletIdM((String) result.get("PLINE_CODE"), (String) result.get("BATCH_NO"));
  157. }
  158. //中厚板按母板取样
  159. if(ZFMotherboard){
  160. materialNo = "";
  161. }
  162. if (StringUtils.isBlank(materialNo)) {
  163. model.setMaterial_no((String) result.get("MATERIAL_NO"));// 取样材料号
  164. if(result.get("PLINE_CODE").equals("HB1") || result.get("PLINE_CODE").equals("ZB1")){
  165. String MATERIAL_NO1 = (String) result.get("MATERIAL_NO");
  166. String boardNo=MATERIAL_NO1.substring(0, MATERIAL_NO1.lastIndexOf("."));
  167. model.setBoard_no(boardNo);
  168. }else{
  169. model.setBoard_no((String) result.get("BOARD_NO"));
  170. }
  171. } else {
  172. model.setMaterial_no(materialNo);
  173. if(result.get("PLINE_CODE").equals("HB1") || result.get("PLINE_CODE").equals("ZB1")){
  174. String MATERIAL_NO1 = materialNo;
  175. String boardNo=MATERIAL_NO1.substring(0, MATERIAL_NO1.lastIndexOf("."));
  176. model.setBoard_no(boardNo);
  177. }else{
  178. model.setBoard_no((String) result.get("BOARD_NO"));
  179. }
  180. }
  181. if(result.get("PLINE_CODE").equals("HB1") || result.get("PLINE_CODE").equals("ZB1")){
  182. model.setRz_mixroll((String) result.get("RZ_MIXROLL"));
  183. model.setRz_old_sampl_no((String) result.get("RZ_OLD_SAMPL_NO"));
  184. if(ZHmaterialNo.equals("复样")){//中厚板 力学复样 取样材料号一致
  185. model.setMaterial_no((String) result.get("MATERIAL_NO"));// 取样材料号
  186. }
  187. //model.setImprove_memo((String) result.get("IMPROVE_MEMO"));//性能改善
  188. }
  189. model.setFreq_code((String) result.get("FREQ_CODE"));
  190. model.setFreq_name((String) result.get("FREQ_NAME"));
  191. // 试验次数
  192. model.setTest_qty((BigDecimal) result.get("TEST_QTY"));
  193. model.setSmp_qty((BigDecimal) result.get("SMP_QTY"));
  194. //中厚板按母板取样
  195. if(ZFMotherboard){
  196. model.setSmp_type_code("4");
  197. model.setSmp_type_name("按母板取样");
  198. }else{
  199. // 件件取样
  200. if(DSampleLogo2){
  201. model.setSmp_type_code("3");
  202. model.setSmp_type_name("件件取样");
  203. }else{
  204. model.setSmp_type_code("1");
  205. model.setSmp_type_name("复样");
  206. }
  207. }
  208. model.setSmp_location((String) result.get("SMP_LOCATION"));
  209. model.setSmp_location_code((String) result.get("SMP_LOCATION_CODE"));
  210. // 初样取样编号(复样不能为空)
  211. model.setOld_consign_no((String) result.get("SPECIMEN_NO"));
  212. model.setPline_code((String) result.get("PLINE_CODE"));
  213. model.setPline_name((String) result.get("PLINE_NAME"));
  214. model.setValidflag("1");
  215. model.setStatus("0");
  216. model.setSource("0");
  217. model.setProduct_cnt((BigDecimal) result.get("PRODUCT_CNT"));
  218. model.setChem_item((String) result.get("CHEM_ITEM"));
  219. model.setGuid(this.getUUID());
  220. model.setMemo((String) result.get("MEMO"));
  221. model.setWeight((String)result.get("WEIGHT"));
  222. model.setWeight_std((String)result.get("WEIGHT_STD"));
  223. model.setWeight_sfd((String)result.get("WEIGHT_SFD"));
  224. model.setProcess_no((String)result.get("PROCESS_NO"));
  225. model.setProcess_nos((String)result.get("PROCESS_NOS"));
  226. model.setProcess_code((String)result.get("PROCESS_CODE"));
  227. return model;
  228. }
  229. /**
  230. * 查询 取样材料号
  231. *
  232. * @param parmas
  233. * @return
  234. */
  235. public String getBilletIdM(String plineCode, String batchNo) {
  236. String plineCode2 ="";
  237. if (plineCode.equals("BC2")) {
  238. plineCode2 = "4001BC2";
  239. }
  240. if (plineCode.equals("GX2")) {
  241. plineCode2 = "4001GX2";
  242. }
  243. if (plineCode.equals("GX1")) {
  244. plineCode2 = "4001GX1";
  245. }
  246. String materialNo = "";
  247. String sql = "";
  248. if (plineCode.equals("BC2") || plineCode.equals("GX2") || plineCode.equals("GX1")) {
  249. sql = " select t.pline_code,t.MATERIAL_NO, t.NUMS from ( "
  250. + " select productline pline_code, BILLETID as MATERIAL_NO,Substr(BILLETID, instr(BILLETID, '.') + 1, length(BILLETID)) NUMS from kch_turnofflist@xgcx where BILLETID like '"
  251. + batchNo + "'||'%' union "
  252. + " select productline pline_code, BILLETID as MATERIAL_NO,Substr(BILLETID, instr(BILLETID, '.') + 1, length(BILLETID)) NUMS from kcz_turnofflist@xgcx where BILLETID like '"
  253. + batchNo + "'||'%' union "
  254. + " select pld pline_code, BILLETID as MATERIAL_NO,Substr(BILLETID, instr(BILLETID, '.') + 1, length(BILLETID)) NUMS from kcx_turnofflist@xgcx where BILLETID like '"
  255. + batchNo + "'||'%' " + " ) t "
  256. + " where t.MATERIAL_NO not in (select d.material_no from QCM_JHY_SAMPLE_CONSIGN_D d where d.material_no like '"
  257. + batchNo + "'||'%') " + " and t.pline_code = '" + plineCode2 + "' "
  258. + " order by CAST(t.NUMS AS int) ";
  259. }
  260. if (plineCode.equals("HB1") || plineCode.equals("ZB1")) {
  261. sql = " select t.pline_code, t.MATERIAL_NO, t.NUMS from ( "
  262. + " select productline pline_code, BILLETID as MATERIAL_NO,Substr(BILLETID, instr(BILLETID, '.') + 1, length(BILLETID)) NUMS from kch_turnofflist@xgcx where BILLETID like '"
  263. + batchNo + "'||'%' union "
  264. + " select productline pline_code, BILLETID as MATERIAL_NO,Substr(BILLETID, instr(BILLETID, '.') + 1, length(BILLETID)) NUMS from kcz_turnofflist@xgcx where BILLETID like '"
  265. + batchNo + "'||'%' union "
  266. + " select pld pline_code, BILLETID as MATERIAL_NO,Substr(BILLETID, instr(BILLETID, '.') + 1, length(BILLETID)) NUMS from kcx_turnofflist@xgcx where BILLETID like '"
  267. + batchNo + "'||'%' " + " ) t "
  268. + " where t.MATERIAL_NO not in (select d.material_no from QCM_JHY_SAMPLE_CONSIGN_D d where d.material_no like '"
  269. + batchNo + "'||'%') ";
  270. }
  271. if (!StringUtils.isBlank(sql)) {
  272. List<HashMap> listEle = mapper.query(sql.toString());
  273. if (listEle != null && listEle.size() > 0) {
  274. materialNo = (String) listEle.get(0).get("MATERIAL_NO");
  275. System.out.println("0轧批号" + batchNo + "===" + materialNo);
  276. }
  277. }
  278. return materialNo;
  279. }
  280. /**
  281. * 当前试样号复样情况,不考虑引用状况
  282. */
  283. private void createQltySample(JSONArray lists) throws Exception {
  284. boolean blfy =false;//判断是否是复样
  285. StringBuffer sqlucomm = new StringBuffer();
  286. String IMPROVE_MEMO="";
  287. //type 1复样 8/3件件取样 16中厚板按母板件件取样
  288. for (Object li : lists) {
  289. blfy =false;
  290. DSampleLogo = false;
  291. DSampleLogo2 = false;
  292. ZFMotherboard = false;
  293. motherboard = false;
  294. JSONObject list = (JSONObject) li;
  295. // 判断是否存在材质
  296. if (!"1".equals(list.getString("IS_QTLY"))) {
  297. continue;
  298. }
  299. //19限制 19不复样
  300. String strdk=" select * from Qcm_Jhy_Sample_r_Ord t where t.smp_no='"+list.getString("QLTY_SMP_NO")+"' and t.design_key like '19%' ";
  301. List<HashMap> strdkhm = mapper.query(strdk.toString());
  302. if(strdkhm!=null && strdkhm.size()>=1){
  303. break;
  304. }
  305. //卷板件件取样
  306. if("3".equals(list.getString("TYPE")) && (list.getString("PLINE_CODE").equals("RZ1") || list.getString("PLINE_CODE").equals("LT1"))){
  307. String materialNo = list.getString("MATERIAL_NO").substring(0,12);
  308. String rzSQL= "select * from qcm_jhy_sample_consign_d t where t.smp_type_code = '3' "
  309. + " and t.batch_no = '"+list.getString("BATCH_NO")+"' and t.material_no like '"+materialNo+"%' ";
  310. List<HashMap> hmrz = mapper.query(rzSQL.toString());
  311. if(hmrz!=null && hmrz.size()>=1){
  312. continue;
  313. }
  314. doRzLtevery(list);
  315. continue;
  316. }
  317. if("1".equals(list.getString("TYPE")) && (list.getString("PLINE_CODE").equals("HB1") || list.getString("PLINE_CODE").equals("ZB1"))){
  318. String smpNo=list.getString("QLTY_SMP_NO");//and d.freq_code<>'D'
  319. String sql="select d.FREQ_CODE,d.HEAT_NO,d.BOARD_NO,d.MATERIAL_NO,r.BATCH_NO,r.design_key,r.steel_code,r.thick,r.Cert_Inst_Code,d.Smp_Location, "
  320. +" d.IMPROVE_MEMO from qcm_jhy_sample_consign_d d,qcm_jhy_sample_r_ord r "
  321. +" where d.smp_no = r.smp_no and r.smp_no ='"+smpNo+"' and rownum<=1 ";
  322. List<HashMap> log = mapper.query(sql.toString());
  323. if(log!=null && log.size()>=1){
  324. sql="";
  325. String freqCodeStr=log.get(0).get("FREQ_CODE").toString();
  326. if(!freqCodeStr.equals("D") && !freqCodeStr.equals("B") && !freqCodeStr.equals("C") && !freqCodeStr.equals("H") && !freqCodeStr.equals("I")){
  327. sql="select * from qcm_jhy_sample_consign_d d,qcm_jhy_sample_r_ord r "
  328. +" where d.smp_no = r.smp_no "
  329. +" and r.design_key ='"+log.get(0).get("DESIGN_KEY")+"' "
  330. +" and r.steel_code ='"+log.get(0).get("STEEL_CODE")+"' "
  331. +" and r.thick ='"+log.get(0).get("THICK")+"' "
  332. +" and r.Cert_Inst_Code ='"+log.get(0).get("CERT_INST_CODE")+"' "
  333. +" and d.Smp_Location ='"+log.get(0).get("SMP_LOCATION")+"' "
  334. +" and d.Smp_Type_Code='1' "
  335. +" and d.freq_code<>'D' "
  336. +" and nvl(d.PHY_ITEM,'null') <> '非金属夹杂A细系,非金属夹杂A粗系,非金属夹杂B细系,非金属夹杂B粗系,非金属夹杂C细系,非金属夹杂C粗系,非金属夹杂D细系,非金属夹杂D粗系,DS单颗粒球状类' "
  337. +" and r.BATCH_NO ='"+log.get(0).get("BATCH_NO")+"'";
  338. }else if(freqCodeStr.equals("B")){
  339. sql="select * from qcm_jhy_sample_consign_d d,qcm_jhy_sample_r_ord r "
  340. +" where d.smp_no = r.smp_no "
  341. +" and r.design_key ='"+log.get(0).get("DESIGN_KEY")+"' "
  342. +" and r.steel_code ='"+log.get(0).get("STEEL_CODE")+"' "
  343. +" and r.thick ='"+log.get(0).get("THICK")+"' "
  344. +" and r.Cert_Inst_Code ='"+log.get(0).get("CERT_INST_CODE")+"' "
  345. +" and d.Smp_Location ='"+log.get(0).get("SMP_LOCATION")+"' "
  346. +" and d.Smp_Type_Code='1' "
  347. +" and d.freq_code<>'D' "
  348. +" and d.BOARD_NO='"+log.get(0).get("BOARD_NO")+"' "
  349. +" and r.BATCH_NO ='"+log.get(0).get("BATCH_NO")+"' ";
  350. }else if(freqCodeStr.equals("C") || freqCodeStr.equals("H") || freqCodeStr.equals("I")){
  351. sql="select * from qcm_jhy_sample_consign_d d,qcm_jhy_sample_r_ord r "
  352. +" where d.smp_no = r.smp_no "
  353. +" and r.design_key ='"+log.get(0).get("DESIGN_KEY")+"' "
  354. +" and r.steel_code ='"+log.get(0).get("STEEL_CODE")+"' "
  355. +" and r.thick ='"+log.get(0).get("THICK")+"' "
  356. +" and r.Cert_Inst_Code ='"+log.get(0).get("CERT_INST_CODE")+"' "
  357. +" and d.Smp_Location ='"+log.get(0).get("SMP_LOCATION")+"' "
  358. +" and d.Smp_Type_Code='1' "
  359. +" and d.freq_code<>'D' "
  360. +" and d.MATERIAL_NO='"+log.get(0).get("MATERIAL_NO")+"' "
  361. +" and r.BATCH_NO ='"+log.get(0).get("BATCH_NO")+"'";
  362. }else if(freqCodeStr.equals("D")){
  363. String heatNo = log.get(0).get("HEAT_NO").toString().substring(0, 9);
  364. sql="select * from qcm_jhy_sample_consign_d t where t.heat_no like '"+heatNo+"%' "
  365. +" and t.pline_code in ('ZB1', 'HB1') and t.freq_code = 'D' and t.smp_type_code = '1' ";
  366. List<HashMap> log2 = mapper.query(sql.toString());
  367. if(log2!=null && log2.size()>=1){
  368. continue;
  369. }
  370. String fyhz="select * from qcm_jhy_sample_consign_d t where t.heat_no like '"+heatNo+"%' and t.pline_code in ('ZB1', 'HB1') "
  371. +" and t.freq_code = 'D' AND T.BATCH_NO <> '"+log.get(0).get("BATCH_NO")+"' AND T.QUOTE_CONSIGN_NO IS NOT NULL ";
  372. List<HashMap> HMFYHZ = mapper.query(fyhz.toString());
  373. if(HMFYHZ!=null && HMFYHZ.size()>=2){
  374. String fyhzt="select r.* from qcm_jhy_sample_consign_d t,qcm_jhy_sample_r_ord r where t.smp_no = r.smp_no "
  375. +" and t.heat_no like '"+heatNo+"%' and t.pline_code in ('ZB1', 'HB1') and t.freq_code = 'D' "
  376. +" AND T.BATCH_NO <> '"+log.get(0).get("BATCH_NO")+"' "
  377. +" AND T.QUOTE_CONSIGN_NO IS NOT NULL and r.Judge_Status is not null and r.judge_result_code is not null ";
  378. List<HashMap> HMFYHZT = mapper.query(fyhzt.toString());
  379. if(HMFYHZT==null || HMFYHZT.size()<2){
  380. continue;
  381. }
  382. }
  383. }
  384. List<HashMap> log2 = mapper.query(sql.toString());
  385. if(log2!=null && log2.size()>=1){
  386. continue;
  387. }
  388. }
  389. }else if("1".equals(list.getString("TYPE")) && (list.getString("PLINE_CODE").equals("GX1") || list.getString("PLINE_CODE").equals("GX2") || list.getString("PLINE_CODE").equals("BC2"))){
  390. String batch_no=list.getString("BATCH_NO");
  391. String sql="select * from qcm_jhy_sample_consign_d d,qcm_jhy_sample_r_ord r "
  392. +" where d.smp_no = r.smp_no and r.BATCH_NO ='"+batch_no+"' and d.Smp_Type_Code='1' ";
  393. List<HashMap> log = mapper.query(sql.toString());
  394. if(log!=null && log.size()>=1){
  395. sql="";
  396. sql =" update QCM_JHY_SAMPLE_R_ORD t set t.INSPECTION_LOT = '' "
  397. + " where t.batch_no like '%"+list.getString("BATCH_NO")+"%'"
  398. + " and t.psc like '%"+list.getString("PSC")+"%' "
  399. + " and t.judge_status = '1' ";
  400. mapper.updateJudgeStatus(sql.toString());
  401. }
  402. }
  403. //type 1复样 3件件取样 16中厚板按母板件件取样
  404. if("16".equals(list.getString("TYPE"))){
  405. ZFMotherboard =true;//中厚板按母板取样
  406. motherboard =true;//母板生成D表用到
  407. }else if("3".equals(list.getString("TYPE"))){//其它
  408. //22.08.22 判断是初样不合格 还是复样不合格 smp_type_code 0初样 1复样
  409. sqlucomm.setLength(0);
  410. sqlucomm.append(
  411. "select count(1) cnum from QCM_JUDGE_PHYSICAL_RESULT r left join QCM_JHY_SAMPLE_CONSIGN_D d on r.smp_no=d.smp_no and r.specimen_no=d.specimen_no "
  412. + " where r.batch_no like '%" + list.getString("BATCH_NO") + "%' and r.IS_PASS='1' and d.smp_type_code = '1' ");
  413. List<HashMap> hmCnum = mapper.query(sqlucomm.toString());
  414. BigDecimal bigd = (BigDecimal) hmCnum.get(0).get("CNUM");
  415. String bigd2 = bigd.toString();
  416. Integer bigd3 = Integer.parseInt(bigd2);
  417. if(bigd3 !=0 && bigd3 > 0){
  418. blfy = true;
  419. }
  420. DSampleLogo = true;
  421. }
  422. //按母板取样
  423. if(ZFMotherboard){
  424. /*sqlucomm.setLength(0);
  425. sqlucomm.append(" select max(t.SMP_TYPE_CODE) SMP_TYPE_CODE from QCM_JHY_SAMPLE_CONSIGN_D t, qcm_jhy_sample_r_ord r "
  426. + " where t.smp_no = r.smp_no and t.batch_no like '%" + list.getString("BATCH_NO") + "%' and t.smp_type_code in ('0','1') "
  427. + " and r.psc = '"+list.getString("PSC")+"' and to_char(r.thick, 'fm990.099') = to_char('"+list.getString("THICK")+"', 'fm990.099') ");
  428. List<HashMap> hmCnumj = mapper.query(sqlucomm.toString());
  429. String bigdjs = (String) hmCnumj.get(0).get("SMP_TYPE_CODE");
  430. Integer bigd4 = Integer.parseInt(bigdjs);*/
  431. if(list.getString("PLINE_CODE").equals("HB1") || list.getString("PLINE_CODE").equals("ZB1") ){
  432. sqlucomm.setLength(0);
  433. sqlucomm.append(
  434. "select r.*,d.BATCH_NO,d.FREQ_CODE,d.freq_name,d.test_qty,d.smp_qty,d.board_no,d.smp_location,d.pline_code,d.pline_name,d.product_cnt,d.smp_location_code,d.PROCESS_NO,d.PROCESS_NOS, "
  435. + " d.Quote_Consign_No,d.MEMO,d.Weight,d.weight_std,d.weight_sfd from QCM_JUDGE_PHYSICAL_RESULT r left join QCM_JHY_SAMPLE_CONSIGN_D d on r.smp_no=d.smp_no and r.specimen_no=d.specimen_no "
  436. + " where r.batch_no like '%" + list.getString("BATCH_NO") + "%' and r.IS_PASS='1' and d.smp_no = '"+list.getString("QLTY_SMP_NO")+"' order by r.smp_no ");
  437. }else{
  438. //按母板取样
  439. sqlucomm.setLength(0);
  440. sqlucomm.append(" select max(SMP_TYPE_CODE) SMP_TYPE_CODE from QCM_JHY_SAMPLE_CONSIGN_D t where t.batch_no like '%" + list.getString("BATCH_NO") + "%' and t.smp_type_code in ('0','1') ");
  441. List<HashMap> hmCnumj = mapper.query(sqlucomm.toString());
  442. String bigdjs = (String) hmCnumj.get(0).get("SMP_TYPE_CODE");
  443. Integer bigd4 = Integer.parseInt(bigdjs);
  444. sqlucomm.setLength(0);
  445. sqlucomm.append(
  446. "select r.*,d.BATCH_NO,d.FREQ_CODE,d.freq_name,d.test_qty,d.smp_qty,d.board_no,d.smp_location,d.pline_code,d.pline_name,d.product_cnt,d.smp_location_code, "
  447. + " d.Quote_Consign_No,d.MEMO,d.Weight,d.weight_std,d.weight_sfd from QCM_JUDGE_PHYSICAL_RESULT r left join QCM_JHY_SAMPLE_CONSIGN_D d on r.smp_no=d.smp_no and r.specimen_no=d.specimen_no "
  448. + " where r.batch_no like '%" + list.getString("BATCH_NO") + "%' and r.IS_PASS='1' and d.smp_type_code = '"+bigd4+"' order by r.smp_no ");
  449. }
  450. }else{//其它产线
  451. //如果是件件取样 判定取样材料号是否是用过
  452. if(DSampleLogo){
  453. if(!list.getString("PLINE_CODE").equals("YT1")){
  454. sqlucomm.setLength(0);
  455. sqlucomm.append(" select count(1) CNUM from QCM_JHY_SAMPLE_CONSIGN_D t where t.material_no = '"+list.getString("MATERIAL_NO")+"' ");
  456. List<HashMap> hmCnumj = mapper.query(sqlucomm.toString());
  457. BigDecimal bigdj = (BigDecimal) hmCnumj.get(0).get("CNUM");
  458. String bigdjs = bigdj.toString();
  459. Integer bigd4 = Integer.parseInt(bigdjs);
  460. if(bigd4 !=0 && bigd4 > 0){
  461. continue;
  462. }
  463. }
  464. }
  465. sqlucomm.setLength(0);
  466. if(blfy){
  467. //22.08.22 复样不合格
  468. sqlucomm.append(
  469. "select r.*,d.BATCH_NO,d.RZ_MIXROLL,d.rz_old_sampl_no,d.FREQ_CODE,d.freq_name,d.test_qty,d.smp_qty,d.board_no,d.smp_location,d.pline_code,d.pline_name,d.product_cnt,d.smp_location_code, "
  470. + " d.Quote_Consign_No,d.MEMO,d.Weight,d.weight_std,d.weight_sfd,d.PROCESS_NO,d.PROCESS_NOS,d.PROCESS_CODE from QCM_JUDGE_PHYSICAL_RESULT r left join QCM_JHY_SAMPLE_CONSIGN_D d on r.smp_no=d.smp_no and r.specimen_no=d.specimen_no "
  471. + " where r.smp_no = '"+list.getString("QLTY_SMP_NO")+"' and r.batch_no like '%" + list.getString("BATCH_NO") + "%' and r.IS_PASS='1' and d.smp_type_code = '1' order by r.smp_no ");
  472. }else{
  473. if(list.getString("PLINE_CODE").equals("GX1") || list.getString("PLINE_CODE").equals("GX2") || list.getString("PLINE_CODE").equals("BC2")){
  474. // 查询试样号向下的检验结果
  475. sqlucomm.append(
  476. "select r.*,d.BATCH_NO,d.RZ_MIXROLL,d.rz_old_sampl_no,d.FREQ_CODE,d.freq_name,d.test_qty,d.smp_qty,d.board_no,d.smp_location,d.pline_code,d.pline_name,d.product_cnt,d.smp_location_code, "
  477. + " d.Quote_Consign_No,d.MEMO,d.Weight,d.weight_std,d.weight_sfd,d.PROCESS_NO,d.PROCESS_NOS,d.PROCESS_CODE from QCM_JUDGE_PHYSICAL_RESULT r left join QCM_JHY_SAMPLE_CONSIGN_D d on r.smp_no=d.smp_no and r.specimen_no=d.specimen_no "
  478. + " where d.inspection_lot = '"+list.getString("INSPECTION_LOT")+"' and r.batch_no like '%" + list.getString("BATCH_NO") + "%' and r.IS_PASS='1' and d.smp_type_code = '0' order by r.smp_no ");
  479. }else{
  480. if(list.getString("PLINE_CODE").equals("HB1") || list.getString("PLINE_CODE").equals("ZB1") ){
  481. if(list.getString("HJ_NAME").toString().equals("1")){//HJ_NAME:夹杂 1 ,力学 0
  482. // 查询试样号向下的检验结果
  483. sqlucomm.append(
  484. "select r.*,d.BATCH_NO,d.RZ_MIXROLL,d.rz_old_sampl_no,d.FREQ_CODE,d.freq_name,d.test_qty,d.smp_qty,d.board_no,d.smp_location,d.pline_code,d.pline_name,d.product_cnt,d.smp_location_code,d.IMPROVE_MEMO, "
  485. + " d.Quote_Consign_No,d.MEMO,d.Weight,d.weight_std,d.weight_sfd,d.PROCESS_NO,d.PROCESS_NOS,d.PROCESS_CODE from QCM_JUDGE_PHYSICAL_RESULT r left join QCM_JHY_SAMPLE_CONSIGN_D d on r.smp_no=d.smp_no and r.specimen_no=d.specimen_no "
  486. + " where r.smp_no = '"+list.getString("QLTY_SMP_NO")+"' and r.batch_no like '%" + list.getString("BATCH_NO") + "%' and r.IS_PASS='1' and d.smp_type_code = '0' "
  487. + " and r.Phy_Code_l = 'HJ' order by r.smp_no ");
  488. List<HashMap> hmap = mapper.query(sqlucomm.toString());
  489. if(hmap == null || hmap.size() < 1){
  490. String heatNo = list.getString("HEAT_NO").toString().substring(0, 9);
  491. sqlucomm.setLength(0);
  492. sqlucomm.append("select r.*,d.BATCH_NO,d.RZ_MIXROLL,d.rz_old_sampl_no,d.FREQ_CODE,d.freq_name,d.test_qty,d.smp_qty,d.board_no,d.smp_location,d.pline_code,d.pline_name,d.product_cnt,d.smp_location_code,d.IMPROVE_MEMO, "
  493. + " d.Quote_Consign_No,d.MEMO,d.Weight,d.weight_std,d.weight_sfd,d.PROCESS_NO,d.PROCESS_NOS,d.PROCESS_CODE from QCM_JUDGE_PHYSICAL_RESULT r left join QCM_JHY_SAMPLE_CONSIGN_D d on r.smp_no=d.smp_no and r.specimen_no=d.specimen_no "
  494. + " where r.smp_no in (select r.smp_no from qcm_jhy_sample_consign_d t,qcm_jhy_sample_r_ord r where t.smp_no = r.smp_no "
  495. + " and t.freq_code = 'D' and r.JUDGE_STATUS= '1' and t.smp_type_code = '0' and r.heat_no like '"+heatNo+"%' and rownum = 1) "
  496. + " and r.IS_PASS='1' and d.smp_type_code = '0' and r.Phy_Code_l = 'HJ' order by r.smp_no ");
  497. }
  498. }else if(list.getString("HJ_NAME").toString().equals("0")){
  499. sqlucomm.append(
  500. "select r.*,d.BATCH_NO,d.RZ_MIXROLL,d.rz_old_sampl_no,d.FREQ_CODE,d.freq_name,d.test_qty,d.smp_qty,d.board_no,d.smp_location,d.pline_code,d.pline_name,d.product_cnt,d.smp_location_code,d.IMPROVE_MEMO, "
  501. + " d.Quote_Consign_No,d.MEMO,d.Weight,d.weight_std,d.weight_sfd,d.PROCESS_NO,d.PROCESS_NOS,d.PROCESS_CODE from QCM_JUDGE_PHYSICAL_RESULT r "
  502. + " left join QCM_JHY_SAMPLE_CONSIGN_D d on r.smp_no=d.smp_no and r.specimen_no=d.specimen_no "
  503. + " join qcm_jhy_sample_r_ord o on r.smp_no = o.smp_no and r.phy_id = o.phy_id "
  504. + " where r.smp_no = '"+list.getString("QLTY_SMP_NO")+"' and r.batch_no like '%" + list.getString("BATCH_NO") + "%' and r.IS_PASS='1' and d.smp_type_code = '0' "
  505. + " order by r.smp_no,r.PHY_CODE_L,r.PHY_CODE_S ");
  506. }else{
  507. // 查询试样号向下的检验结果
  508. sqlucomm.append(
  509. "select r.*,d.BATCH_NO,d.RZ_MIXROLL,d.rz_old_sampl_no,d.FREQ_CODE,d.freq_name,d.test_qty,d.smp_qty,d.board_no,d.smp_location,d.pline_code,d.pline_name,d.product_cnt,d.smp_location_code,d.IMPROVE_MEMO, "
  510. + " d.Quote_Consign_No,d.MEMO,d.Weight,d.weight_std,d.weight_sfd,d.PROCESS_NO,d.PROCESS_NOS,d.PROCESS_CODE from QCM_JUDGE_PHYSICAL_RESULT r "
  511. + " left join QCM_JHY_SAMPLE_CONSIGN_D d on r.smp_no=d.smp_no and r.specimen_no=d.specimen_no "
  512. + " join qcm_jhy_sample_r_ord o on r.smp_no = o.smp_no and r.phy_id = o.phy_id "
  513. + " where r.smp_no = '"+list.getString("QLTY_SMP_NO")+"' and r.batch_no like '%" + list.getString("BATCH_NO") + "%' and r.IS_PASS='1' and d.smp_type_code = '0' "
  514. + " order by r.smp_no,r.PHY_CODE_L,r.PHY_CODE_S ");
  515. }
  516. }else{
  517. // 查询试样号向下的检验结果
  518. sqlucomm.append(
  519. "select r.*,d.BATCH_NO,d.RZ_MIXROLL,d.rz_old_sampl_no,d.FREQ_CODE,d.freq_name,d.test_qty,d.smp_qty,d.board_no,d.smp_location,d.pline_code,d.pline_name,d.product_cnt,d.smp_location_code, "
  520. + " d.Quote_Consign_No,d.MEMO,d.Weight,d.weight_std,d.weight_sfd,d.PROCESS_NO,d.PROCESS_NOS,d.PROCESS_CODE from QCM_JUDGE_PHYSICAL_RESULT r left join QCM_JHY_SAMPLE_CONSIGN_D d on r.smp_no=d.smp_no and r.specimen_no=d.specimen_no "
  521. + " where r.smp_no = '"+list.getString("QLTY_SMP_NO")+"' and r.batch_no like '%" + list.getString("BATCH_NO") + "%' and r.IS_PASS='1' and d.smp_type_code = '0' "
  522. + " order by r.smp_no,r.PHY_CODE_L,r.PHY_CODE_S ");
  523. }
  524. }
  525. ZHmaterialNo="";
  526. ZHmaterialNo="复样";
  527. }
  528. }
  529. // 得到判定不合格的项目
  530. List<HashMap> results = mapper.query(sqlucomm.toString());
  531. logger.info("复样-查询有那些项目不合格-sql:" + sqlucomm.toString());
  532. logger.info("复样-查询有那些项目不合格-项目:" + results.toString());
  533. if (results == null || results.size() < 1) {
  534. continue;
  535. }/*else if((list.getString("PLINE_CODE").equals("HB1") || list.getString("PLINE_CODE").equals("ZB1")) && results.get(0).get("IMPROVE_MEMO")!=null){
  536. IMPROVE_MEMO=results.get(0).get("IMPROVE_MEMO").toString();
  537. }*/
  538. // 判断是否存在夹杂内控按炉取样不合格的项目,如果存在需要走另外的逻辑
  539. boolean isJz = false;
  540. List<HashMap> jzResource = null;
  541. String old_spefcial_no = null;
  542. HashMap sampleMJz = null;
  543. TreeSet<String> hjsets = new TreeSet<String>();
  544. String phyCodeLHJ = "0";//判断是否是引用/被引用
  545. for (HashMap result : results) {
  546. // 如果是夹杂的,需要验证是否存在内控按炉取样的项目
  547. if ("HJ".equals(((String) result.get("PHY_CODE_L"))) && !ZFMotherboard && result.get("FREQ_CODE").equals("D")
  548. && (result.get("PLINE_CODE").equals("HB1") || result.get("PLINE_CODE").equals("ZB1"))) {
  549. /* sqlucomm.setLength(0);
  550. sqlucomm.append(
  551. "SELECT DESIGN_KEY,PSC,SMP_TYPE_CODE,CERT_INST_CODE,BATCH_NO FROM QCM_JHY_SAMPLE_R_ORD WHERE SMP_NO='"
  552. + result.get("SMP_NO") + "'");
  553. // 试样号与合同信息关系表
  554. List<HashMap> resultsM = mapper.query(sqlucomm.toString());
  555. if (resultsM == null || resultsM.size() < 1) {
  556. continue;
  557. }
  558. // 根据合同信息和项目找到复样倍数信息
  559. HashMap sampleM = resultsM.get(0);
  560. sampleMJz = resultsM.get(0);
  561. sqlucomm.setLength(0);
  562. sqlucomm.append(
  563. "SELECT * FROM QCM_ORD_DESIGN_SAMPLE_M WHERE DESIGN_KEY='" + sampleM.get("DESIGN_KEY") + "'"
  564. + " and PSC='" + sampleM.get("PSC") + "' and SAMPLE_STYLE_CODE='"
  565. + sampleM.get("SMP_TYPE_CODE") + "' and ORG_CODE='" + sampleM.get("CERT_INST_CODE")
  566. + "' " + " and RATE_CODE='D' and PHY_CODE_L='HJ' AND SPECL_FL='2' ");
  567. sqlucomm.append(" and SMP_POSITION_CODE='" + result.get("SMP_LOCATION_CODE") + "'");
  568. jzResource = mapper.query(sqlucomm.toString());
  569. // 判断是不是内控按炉的夹杂
  570. if (jzResource == null || jzResource.size() < 1) {
  571. continue;
  572. }
  573. // 获取引用取样编号
  574. if (result.get("QUOTE_CONSIGN_NO") != null) {
  575. old_spefcial_no = (String) result.get("QUOTE_CONSIGN_NO");
  576. }
  577. result.put("SPECL_FL", "2");// 代表是内控的
  578. result.put("IS_JZ", "1");
  579. isJz = true;
  580. break;*/
  581. String heatNo = result.get("HEAT_NO").toString().substring(0, 9);//一共10位 截取9位 最后一位字母不要
  582. String strPlineCode = "";
  583. if(!result.get("PLINE_CODE").equals("ZB1") && !result.get("PLINE_CODE").equals("HB1") ){
  584. strPlineCode = " and t.pline_code = '"+result.get("PLINE_CODE")+"' ";
  585. }else{
  586. strPlineCode = " and t.pline_code in ('ZB1','HB1') ";
  587. }
  588. //判断是否是按炉的夹杂
  589. sqlucomm.setLength(0);
  590. sqlucomm.append(" select count(1) cnum from QCM_JHY_SAMPLE_CONSIGN_D t "
  591. + " where t.HEAT_NO like '"+heatNo+"%' "
  592. + " AND t.batch_no like '%"+list.getString("BATCH_NO")+"%' and t.FREQ_CODE = 'D' and T.QUOTE_CONSIGN_NO is null ");
  593. sqlucomm.append(strPlineCode);
  594. List<HashMap> hashMaplist2 = mapper.query(sqlucomm.toString());
  595. BigDecimal cou2 = (BigDecimal) hashMaplist2.get(0).get("CNUM");
  596. String coun2 = cou2.toString();
  597. Integer integ2 = Integer.parseInt(coun2);
  598. if(integ2>=1){
  599. hjsets.add("1");//按炉引用夹杂
  600. if("1".equals(list.getString("TYPE"))){//判断夹杂是否已经复样过 复样过不能再次复样
  601. String sqlfy = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D t "
  602. + " where heat_no like '"+heatNo+"%' "
  603. + " and smp_type_code = '1' and FREQ_CODE ='D' "
  604. + strPlineCode;
  605. List<HashMap> hmCnum = mapper.query(sqlfy.toString());
  606. if(hmCnum != null && hmCnum.size() > 1){//夹杂按炉复样 一定大于1 复样两个轧批
  607. return;
  608. }
  609. sqlfy="";
  610. sqlfy = "select * from qcm_jhy_sample_r_ord r,qcm_jhy_sample_consign_d t "
  611. +" where r.smp_no=t.smp_no and t.freq_code = 'D' "
  612. +" and t.heat_no like '"+heatNo+"%' "
  613. +" and r.Judge_Result_Code is not null and t.batch_no <> '"+list.getString("BATCH_NO")+"' "
  614. + strPlineCode;
  615. List<HashMap> hmCnum2 = mapper.query(sqlfy.toString());
  616. if(hmCnum2 == null || hmCnum2.size() <=0 ){//夹杂按炉判定要大于1 不包括初样送样的轧批号
  617. return;
  618. }
  619. }
  620. }else{
  621. phyCodeLHJ = "1";//跳出循环
  622. }
  623. }else{
  624. hjsets.add("2");
  625. }
  626. }
  627. // 存在夹杂内控按炉取样的另辟蹊径
  628. /*if (isJz) {
  629. // 1:得到判定不合格的项目 2:根据合同信息和项目找到复样倍数信息 3:引用取样编号
  630. // 4:传过来的值复样(判定)5:试样号与合同信息关系表数据
  631. createJznkSample(results, jzResource, old_spefcial_no, list, sampleMJz);
  632. continue;
  633. }*/
  634. heGold2 = 1;//金相数 判断第一个金相是否已做 已做 第二个金相就不用再做
  635. LT1A08 = 1;//连退 常温拉伸 峰值密度
  636. //22.08.18 按轧批号 把所有的项目拿到 但是生成是只能生成到一个试样号中
  637. String smpNolist = (String) results.get(0).get("SMP_NO");
  638. String plineCode1 = (String) results.get(0).get("PLINE_CODE");
  639. for (HashMap result : results) {
  640. String hjphycodel= "0";
  641. if (result.get("PLINE_CODE").equals("HB1") || result.get("PLINE_CODE").equals("ZB1")) {
  642. //判断是不是夹杂按炉取样
  643. if ("HJ".equals(((String) result.get("PHY_CODE_L"))) && !ZFMotherboard && result.get("FREQ_CODE").equals("D")) {
  644. String heatNo = result.get("HEAT_NO").toString().substring(0, 9);//一共10位 截取9位 最后一位字母不要
  645. String strPlineCode = "";
  646. if(!result.get("PLINE_CODE").equals("ZB1") && !result.get("PLINE_CODE").equals("HB1") ){
  647. strPlineCode = " and pline_code = '"+result.get("PLINE_CODE")+"' ";
  648. }else{
  649. strPlineCode = " and pline_code in ('ZB1','HB1') ";
  650. }
  651. for (String string : hjsets) {
  652. if(string.equals("1")){//夹杂按炉
  653. hjphycodel = "1";
  654. break;
  655. }
  656. }
  657. if(hjphycodel.equals("1")){//夹杂按炉
  658. //判断是初样不合格 还是复样不合格 smp_type_code 0初样 1复样
  659. sqlucomm.setLength(0);
  660. sqlucomm.append(
  661. "select count(1) cnum from QCM_JUDGE_PHYSICAL_RESULT r left join QCM_JHY_SAMPLE_CONSIGN_D d on r.smp_no=d.smp_no and r.specimen_no=d.specimen_no "
  662. + " where r.heat_no like '"+heatNo+"%' and r.IS_PASS='1' and d.smp_type_code = '1' ");
  663. sqlucomm.append(strPlineCode);
  664. List<HashMap> hmCnum = mapper.query(sqlucomm.toString());
  665. BigDecimal bigd = (BigDecimal) hmCnum.get(0).get("CNUM");
  666. String bigd2 = bigd.toString();
  667. Integer bigd3 = Integer.parseInt(bigd2);
  668. if(bigd3 !=0 && bigd3 > 0){
  669. blfy = true;
  670. DSampleLogo = true;
  671. }
  672. //判断是不是当前被引用的轧批号
  673. sqlucomm.setLength(0);
  674. sqlucomm.append(" select count(1) cnum from QCM_JHY_SAMPLE_CONSIGN_D t "
  675. + " where t.batch_no like '%"+list.getString("BATCH_NO")+"%'"
  676. + " and t.heat_no like '"+heatNo+"%' and t.QUOTE_CONSIGN_NO is null ");
  677. sqlucomm.append(strPlineCode);
  678. List<HashMap> hmCnum3 = mapper.query(sqlucomm.toString());
  679. BigDecimal num = (BigDecimal) hmCnum3.get(0).get("CNUM");
  680. String num6 = num.toString();
  681. Integer num7 = Integer.parseInt(num6);
  682. if(num7 !=0 && num7 > 0){
  683. ZHmaterialNo="";
  684. createJznkSample2(result);
  685. continue;
  686. }
  687. }
  688. }
  689. }
  690. result.put("SMP_NO", smpNolist);
  691. result.put("PLINE_CODE", plineCode1);
  692. if((list.getString("PLINE_CODE").equals("HB1") || list.getString("PLINE_CODE").equals("ZB1")) && list.getString("TYPE").equals("1") ){
  693. //中厚板复样子板号一样
  694. }else{
  695. result.put("MATERIAL_NO", list.getString("MATERIAL_NO"));
  696. }
  697. cteateOtherQtly(result, sqlucomm);
  698. }
  699. //判断是否小于六吊 如果小于六吊 true !true 非件件取样
  700. if(!DSampleLogo2 && !ZFMotherboard){
  701. //查询这个试样号 生成了几个复样 拿到 试样号 取样编号 轧批号
  702. sqlucomm.setLength(0);
  703. sqlucomm.append(" select t.* from QCM_JHY_SAMPLE_CONSIGN_D t "
  704. + " where t.batch_no like '%"+list.getString("BATCH_NO")+"%'"
  705. + " and t.smp_no = '"+smpNolist+"' and t.smp_type_code = '1' and t.STATUS = '0' order by t.specimen_no asc ");
  706. List<HashMap> hashlist = mapper.query(sqlucomm.toString());
  707. if(hashlist == null || hashlist.size() <= 0){
  708. continue;
  709. }
  710. //非件件取样
  711. //22.09.01 从新生成一条全新的试样号做为判定smpNolist
  712. String smpNo = createQltySamNo((String) results.get(0).get("PLINE_CODE"));
  713. String sql ="Insert into QCM_JHY_SAMPLE_CONSIGN_M(SMP_NO,HEAT_NO,BATCH_NO,INSPECTION_LOT,BOARD_NO,MATERIAL_NO,PSC, "
  714. +" PSC_DESC,SMP_CATG,CERT_INST_CODE,CERT_INST_NAME,SMP_TYPE_CODE,SMP_TYPE_NAME,GRADE_CODE,GRADE_NAME, "
  715. +" PLINE_CODE,PLINE_NAME,VALIDFLAG,MEMO,CREATE_ID,CREATE_NAME,CREATE_TIME,ITEM_FLAG,DUPLICATE_SAMPLE) "
  716. +" select '"+smpNo+"',HEAT_NO,BATCH_NO,INSPECTION_LOT,BOARD_NO,MATERIAL_NO,PSC, "
  717. +" PSC_DESC,SMP_CATG,CERT_INST_CODE,CERT_INST_NAME,SMP_TYPE_CODE,SMP_TYPE_NAME,GRADE_CODE,GRADE_NAME, "
  718. +" PLINE_CODE,PLINE_NAME,VALIDFLAG,MEMO,'sys','sys',sysdate,ITEM_FLAG,'复样' "
  719. +" from QCM_JHY_SAMPLE_CONSIGN_M t where t.SMP_NO = '"+list.getString("QLTY_SMP_NO")+"' and rownum <= 1 ";
  720. mapper.insert(sql);
  721. sql = "";
  722. sql = "Insert into QCM_JHY_SAMPLE_R_ORD(DESIGN_KEY,SMP_NO,PSC,PSC_DESC,HEAT_NO,BATCH_NO,INSPECTION_LOT,DELIVERY_STATE_CODE, "
  723. + " DELIVERY_STATE_DESC,THICK,WIDTH,LENGTH,PLINE_CODE,PLINE_NAME,MSC_PLINE,PROCESS_CODE,CERT_INST_CODE,CERT_INST_NAME, "
  724. + " SMP_TYPE_CODE,SMP_TYPE_NAME,SMELTING_CNT,PRODUCT_CNT,ASSAY_NO_CP,ASSAY_NO_RL,CIC_ID,JUDGE_STATUS,PROD_CODE,"
  725. + " PROD_NAME,STEEL_CODE,STEEL_NAME,STD_CODE,STD_NAME,CREATE_TIME,CREATE_ID,CREATE_NAME,DUPLICATE_SAMPLE) "
  726. + " select DESIGN_KEY,'"+smpNo+"',PSC,PSC_DESC,HEAT_NO,BATCH_NO,INSPECTION_LOT,DELIVERY_STATE_CODE,DELIVERY_STATE_DESC, "
  727. + " THICK,WIDTH,LENGTH,PLINE_CODE,PLINE_NAME,MSC_PLINE,PROCESS_CODE,CERT_INST_CODE,CERT_INST_NAME,SMP_TYPE_CODE,"
  728. + " SMP_TYPE_NAME,SMELTING_CNT,PRODUCT_CNT,ASSAY_NO_CP,ASSAY_NO_RL,CIC_ID,'0',PROD_CODE,PROD_NAME,STEEL_CODE, "
  729. + " STEEL_NAME,STD_CODE,STD_NAME,sysdate,'sys','sys','复样' "
  730. + " from QCM_JHY_SAMPLE_R_ORD t where t.SMP_NO = '"+list.getString("QLTY_SMP_NO")+"' and rownum <= 1 ";
  731. mapper.insert(sql);
  732. //把已经判定的ORD检验号置空 ord先插入后修改
  733. //20230605增加卷板
  734. sql = "";
  735. if(plineCode1.equals("ZB1") || plineCode1.equals("HB1") || plineCode1.equals("RZ1") || plineCode1.equals("LT1") || plineCode1.equals("YT1")){
  736. sql =" update QCM_JHY_SAMPLE_R_ORD t set t.INSPECTION_LOT = '' "
  737. + " where t.batch_no like '%"+list.getString("BATCH_NO")+"%'"
  738. + " and t.psc like '%"+list.getString("PSC")+"%' "
  739. //+ " and to_char(t.thick, 'fm990.099') = to_char('"+list.getString("THICK")+"', 'fm990.099') "
  740. + " and t.smp_no = '"+list.getString("QLTY_SMP_NO")+"' "
  741. + " and t.judge_status = '1' ";
  742. }else{
  743. sql =" update QCM_JHY_SAMPLE_R_ORD t set t.INSPECTION_LOT = '' "
  744. + " where t.batch_no like '%"+list.getString("BATCH_NO")+"%'"
  745. + " and t.psc like '%"+list.getString("PSC")+"%' "
  746. + " and t.judge_status = '1' ";
  747. }
  748. mapper.updateJudgeStatus(sql.toString());
  749. //查询这个试样号 生成了几个复样 拿到 试样号 取样编号 轧批号
  750. sqlucomm.setLength(0);
  751. sqlucomm.append(" select t.* from QCM_JHY_SAMPLE_CONSIGN_D t "
  752. + " where t.batch_no like '%"+list.getString("BATCH_NO")+"%'"
  753. + " and t.smp_no = '"+smpNolist+"' and t.smp_type_code = '1' and t.STATUS = '0' order by t.specimen_no asc ");
  754. List<HashMap> hashMaplist = mapper.query(sqlucomm.toString());
  755. //生成几个复样
  756. sqlucomm.setLength(0);
  757. sqlucomm.append(" select count(1) cnum from QCM_JHY_SAMPLE_CONSIGN_D t "
  758. + " where t.batch_no like '%"+list.getString("BATCH_NO")+"%'"
  759. + " and t.smp_no = '"+smpNolist+"' and t.smp_type_code = '1' and t.STATUS = '0' ");
  760. List<HashMap> hashMaplist2 = mapper.query(sqlucomm.toString());
  761. BigDecimal cou2 = (BigDecimal) hashMaplist2.get(0).get("CNUM");
  762. String coun2 = cou2.toString();
  763. Integer integ2 = Integer.parseInt(coun2);//生成了几个复样
  764. //获取最后一个取样编号 引用初样结果
  765. String specimenNoZy = "";
  766. //修改试样号 取样编号
  767. for(int i=0; i<integ2; i++){
  768. //截取取样编号后两位
  769. String specimenNo = hashMaplist.get(i).get("SPECIMEN_NO").toString();
  770. String lw = specimenNo.substring(specimenNo.length() - 2,specimenNo.length());
  771. //修改试样号
  772. sqlucomm.setLength(0);
  773. sqlucomm.append(" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t set t.smp_no = '"+smpNo+"',t.specimen_no ='"+smpNo+"'||'"+lw+"' ");
  774. sqlucomm.append(" where t.specimen_no = '"+hashMaplist.get(i).get("SPECIMEN_NO")+"' ");
  775. mapper.updateJudgeStatus(sqlucomm.toString());
  776. sqlucomm.setLength(0);
  777. sqlucomm.append(" update QCM_JHY_SAMPLE_CONSIGN_D t set t.smp_no = '"+smpNo+"',t.specimen_no ='"+smpNo+"'||'"+lw+"' ");
  778. sqlucomm.append(" where t.smp_no = '"+hashMaplist.get(i).get("SMP_NO")+"'"
  779. + " and t.specimen_no = '"+hashMaplist.get(i).get("SPECIMEN_NO")+"' "
  780. + " and t.batch_no like '%"+hashMaplist.get(i).get("BATCH_NO")+"%' ");
  781. mapper.updateJudgeStatus(sqlucomm.toString());
  782. specimenNoZy = smpNo + lw;
  783. }
  784. String sqlrownum = "";
  785. if(list.getString("PLINE_CODE").equals("HB1") || list.getString("PLINE_CODE").equals("ZB1") || plineCode1.equals("RZ1") || plineCode1.equals("LT1")
  786. || plineCode1.equals("YT1")){
  787. sqlrownum = " and t.SMP_NO like '%"+list.getString("QLTY_SMP_NO")+"%' and rownum = 1";
  788. sqlucomm.setLength(0);
  789. sqlucomm.append(" select t.SPECIMEN_NO,t.smp_type_code from QCM_JHY_SAMPLE_CONSIGN_D t "
  790. +" where t.smp_no in (select t.smp_no "
  791. +" from Qcm_Jhy_Sample_r_Ord t "
  792. +" where t.batch_no like '%"+list.getString("BATCH_NO")+"%' "
  793. + " and t.psc like '%"+list.getString("PSC")+"%' "+sqlrownum+" ) ");
  794. }else{
  795. //引用初样实绩
  796. //查询这个试样号 轧批号 获取初样所有取样编号
  797. sqlucomm.setLength(0);
  798. sqlucomm.append(" select t.SPECIMEN_NO,t.smp_type_code from QCM_JHY_SAMPLE_CONSIGN_D t "
  799. +" where t.smp_type_code = '0' "
  800. +" and t.smp_no in (select t.smp_no "
  801. +" from Qcm_Jhy_Sample_r_Ord t "
  802. +" where t.batch_no like '%"+list.getString("BATCH_NO")+"%' "
  803. + " and t.psc like '%"+list.getString("PSC")+"%' "+sqlrownum+" ) ");
  804. }
  805. List<HashMap> hmap = mapper.query(sqlucomm.toString());
  806. for (HashMap hm : hmap) {
  807. String quoteStatus = (String)hm.get("SMP_TYPE_CODE");//取样类型
  808. //查询当前初样取样编号的所有实绩
  809. sql = "";
  810. if(list.getString("PLINE_CODE").equals("HB1") || list.getString("PLINE_CODE").equals("ZB1")){
  811. sql = "select t.specimen_no,t.seq,t.test_qty from QCM_JHY_INSP_PHYSICS t "
  812. + " where t.specimen_no = '"+(String)hm.get("SPECIMEN_NO")+"' and t.seq<50 ";
  813. }else{
  814. sql = "select t.specimen_no,t.seq,t.test_qty from QCM_JHY_INSP_PHYSICS t "
  815. + " where t.specimen_no = '"+(String)hm.get("SPECIMEN_NO")+"'";
  816. }
  817. List<HashMap> hmPhysics = mapper.query(sql.toString());
  818. for (HashMap hashMap : hmPhysics) {
  819. //获取specimenNoZy取样编号 seq最大值
  820. sql = "";
  821. sql = "select decode(max(seq),'','49',max(seq))+1 as SEQ from QCM_JHY_INSP_PHYSICS t "
  822. + " where t.specimen_no = '"+specimenNoZy+"'";
  823. List<HashMap> seqhm = mapper.query(sql.toString());
  824. BigDecimal big = (BigDecimal)seqhm.get(0).get("SEQ");
  825. String seqs = big.toString();
  826. Integer seqint = Integer.parseInt(seqs);
  827. sql = "";
  828. sql = " insert into QCM_JHY_INSP_PHYSICS "
  829. +" (SPECIMEN_NO,SEQ,TEST_QTY,PHY_CODE_L,PHY_NAME_L,PHY_CODE_M,PHY_NAME_M,PHY_CODE_S,PHY_NAME_S,ITEM_CODE_D,ITEM_NAME_D, "
  830. +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
  831. +" VAL13,VAL14,VAL15,AVG_VAL,GUID,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, "
  832. +" PHY_UNIT,MEMO,QUOTE_SPECIMEN_NO,QUOTE_STATUS) "
  833. +" select '"+specimenNoZy+"','"+seqint+"',TEST_QTY,PHY_CODE_L,PHY_NAME_L,PHY_CODE_M,PHY_NAME_M,PHY_CODE_S,PHY_NAME_S,ITEM_CODE_D,ITEM_NAME_D, "
  834. +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
  835. +" VAL13,VAL14,VAL15,AVG_VAL,GUID,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, "
  836. +" PHY_UNIT,MEMO,'"+(String)hashMap.get("SPECIMEN_NO")+"','0' from QCM_JHY_INSP_PHYSICS t "
  837. + " where t.specimen_no = '"+(String)hashMap.get("SPECIMEN_NO")+"' "
  838. + "and t.seq = '"+hashMap.get("SEQ")+"' "
  839. + "and t.test_qty = '"+hashMap.get("TEST_QTY")+"' ";
  840. mapper.insert(sql);
  841. sql = "";
  842. sql = "insert into QCM_JHY_SAMPLE_CONSIGN_D_ITEM "
  843. +" (SPECIMEN_NO,SEQ,SMP_NO,PHY_NAME_L,PHY_CODE_L,PHY_CODE_M,PHY_NAME_M,PHY_CODE_S,PHY_NAME_S, "
  844. +" ITEM_CODE_D,ITEM_NAME_D,ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,ITEM_CODE_L,ITEM_DESC_L, "
  845. +" STDMIN_SIGN,STDMIN,STDMAX_SIGN,STDMAX,TEST_QTY,SMP_QTY,SPECL_FL,ISJUDGE,JUDGE_BASIS,PHY_UNIT,GROUP_SEQ, "
  846. +" QUOTE_SPECIMEN_NO,QUOTE_SEQ,ITEM_FLAG,MEMO,CREATE_ID,CREATE_NAME,CREATE_TIME,STDMEMO,RESMP_SEQ, "
  847. +" PHY_GROUP_CODE,FY_QUOTE_SPECIMEN_NO,FY_QUOTE_STATUS) "
  848. +" select '"+specimenNoZy+"','"+seqint+"','"+smpNo+"',PHY_NAME_L,PHY_CODE_L,PHY_CODE_M,PHY_NAME_M,PHY_CODE_S,PHY_NAME_S, "
  849. +" ITEM_CODE_D,ITEM_NAME_D,ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,ITEM_CODE_L,ITEM_DESC_L, "
  850. +" STDMIN_SIGN,STDMIN,STDMAX_SIGN,STDMAX,TEST_QTY,SMP_QTY,SPECL_FL,ISJUDGE,JUDGE_BASIS,PHY_UNIT,GROUP_SEQ, "
  851. +" QUOTE_SPECIMEN_NO,QUOTE_SEQ,ITEM_FLAG,MEMO,CREATE_ID,CREATE_NAME,CREATE_TIME,STDMEMO,RESMP_SEQ, "
  852. +" PHY_GROUP_CODE,'"+(String)hashMap.get("SPECIMEN_NO")+"','0' from QCM_JHY_SAMPLE_CONSIGN_D_ITEM "
  853. + " where specimen_no = '"+(String)hashMap.get("SPECIMEN_NO")+"' "
  854. + "and seq = '"+hashMap.get("SEQ")+"' ";
  855. mapper.insert(sql);
  856. }
  857. }
  858. }else{
  859. String smpTypeCode ="3";//默认为件件取样
  860. String smpTypeName ="件件取样";
  861. if(ZFMotherboard){
  862. //母板取样
  863. smpTypeCode = "4";
  864. smpTypeName ="母板取样";
  865. }
  866. //件件取样
  867. //查询这个试样号 生成了几个件件取样 拿到 试样号 取样编号 轧批号
  868. sqlucomm.setLength(0);
  869. sqlucomm.append(" select t.* from QCM_JHY_SAMPLE_CONSIGN_D t "
  870. + " where t.batch_no like '%"+list.getString("BATCH_NO")+"%'"
  871. + " and t.smp_no = '"+smpNolist+"' and t.smp_type_code = '"+smpTypeCode+"' and t.STATUS = '0' order by t.specimen_no asc ");
  872. List<HashMap> hashMaplist = mapper.query(sqlucomm.toString());
  873. if(hashMaplist == null || hashMaplist.size() <= 0){
  874. continue;
  875. }
  876. //生成几个件件取样
  877. sqlucomm.setLength(0);
  878. sqlucomm.append(" select count(1) cnum from QCM_JHY_SAMPLE_CONSIGN_D t "
  879. + " where t.batch_no like '%"+list.getString("BATCH_NO")+"%'"
  880. + " and t.smp_no = '"+smpNolist+"' and t.smp_type_code = '"+smpTypeCode+"' and t.STATUS = '0' ");
  881. List<HashMap> hashMaplist2 = mapper.query(sqlucomm.toString());
  882. BigDecimal cou2 = (BigDecimal) hashMaplist2.get(0).get("CNUM");
  883. String coun2 = cou2.toString();
  884. Integer integ2 = Integer.parseInt(coun2);//生成了几个件件取样
  885. for(int i=0; i<integ2; i++){
  886. String smpNo = createQltySamNo((String) results.get(0).get("PLINE_CODE"));
  887. String inspectionLot = createQltyInspectionLot(list.getString("BATCH_NO"));
  888. String sql ="Insert into QCM_JHY_SAMPLE_CONSIGN_M(SMP_NO,HEAT_NO,BATCH_NO,INSPECTION_LOT,BOARD_NO,MATERIAL_NO,PSC, "
  889. +" PSC_DESC,SMP_CATG,CERT_INST_CODE,CERT_INST_NAME,SMP_TYPE_CODE,SMP_TYPE_NAME,GRADE_CODE,GRADE_NAME, "
  890. +" PLINE_CODE,PLINE_NAME,VALIDFLAG,MEMO,CREATE_ID,CREATE_NAME,CREATE_TIME,ITEM_FLAG,DUPLICATE_SAMPLE) "
  891. +" select '"+smpNo+"',HEAT_NO,BATCH_NO,'"+inspectionLot+"',BOARD_NO,MATERIAL_NO,PSC, "
  892. +" PSC_DESC,SMP_CATG,CERT_INST_CODE,CERT_INST_NAME,SMP_TYPE_CODE,SMP_TYPE_NAME,GRADE_CODE,GRADE_NAME, "
  893. +" PLINE_CODE,PLINE_NAME,VALIDFLAG,MEMO,'sys','sys',sysdate,ITEM_FLAG,'"+smpTypeName+"' "
  894. +" from QCM_JHY_SAMPLE_CONSIGN_M t where t.SMP_NO = '"+smpNolist+"' and rownum <= 1 ";
  895. mapper.insert(sql);
  896. sql = "";
  897. sql = "Insert into QCM_JHY_SAMPLE_R_ORD(DESIGN_KEY,SMP_NO,PSC,PSC_DESC,HEAT_NO,BATCH_NO,INSPECTION_LOT,DELIVERY_STATE_CODE, "
  898. + " DELIVERY_STATE_DESC,THICK,WIDTH,LENGTH,PLINE_CODE,PLINE_NAME,MSC_PLINE,PROCESS_CODE,CERT_INST_CODE,CERT_INST_NAME, "
  899. + " SMP_TYPE_CODE,SMP_TYPE_NAME,SMELTING_CNT,PRODUCT_CNT,ASSAY_NO_CP,ASSAY_NO_RL,CIC_ID,JUDGE_STATUS,PROD_CODE,"
  900. + " PROD_NAME,STEEL_CODE,STEEL_NAME,STD_CODE,STD_NAME,CREATE_TIME,CREATE_ID,CREATE_NAME,DUPLICATE_SAMPLE) "
  901. + " select DESIGN_KEY,'"+smpNo+"',PSC,PSC_DESC,HEAT_NO,BATCH_NO,'"+inspectionLot+"',DELIVERY_STATE_CODE,DELIVERY_STATE_DESC, "
  902. + " THICK,WIDTH,LENGTH,PLINE_CODE,PLINE_NAME,MSC_PLINE,PROCESS_CODE,CERT_INST_CODE,CERT_INST_NAME,SMP_TYPE_CODE,"
  903. + " SMP_TYPE_NAME,SMELTING_CNT,PRODUCT_CNT,ASSAY_NO_CP,ASSAY_NO_RL,CIC_ID,'0',PROD_CODE,PROD_NAME,STEEL_CODE, "
  904. + " STEEL_NAME,STD_CODE,STD_NAME,sysdate,'sys','sys','"+smpTypeName+"' "
  905. + " from QCM_JHY_SAMPLE_R_ORD t where t.SMP_NO = '"+smpNolist+"' and rownum <= 1 ";
  906. mapper.insert(sql);
  907. if(list.getString("PLINE_CODE").equals("HB1") || list.getString("PLINE_CODE").equals("ZB1")
  908. || list.getString("PLINE_CODE").equals("GX1") || list.getString("PLINE_CODE").equals("BC2")
  909. || list.getString("PLINE_CODE").equals("GX2") ){
  910. //修改判定那边的检验号
  911. if("16".equals(list.getString("TYPE"))){//按母板ZFMotherboard
  912. String materialNo = (String) hashMaplist.get(i).get("MATERIAL_NO");
  913. String boardNo = materialNo.substring(0, materialNo.lastIndexOf("."));//H2-50381.1.1
  914. sqlucomm.setLength(0);
  915. sqlucomm.append(" update zj_result_all@xgcx t set t.billetid_jy = '"+inspectionLot+"' ");
  916. sqlucomm.append(" where t.billetid like '"+boardNo+"%' and t.JUDGERESULT='0' ");
  917. mapper.updateJudgeStatus(sqlucomm.toString());
  918. }else{//件件取样
  919. sqlucomm.setLength(0);
  920. sqlucomm.append(" update zj_result_all@xgcx t set t.billetid_jy = '"+inspectionLot+"' ");
  921. sqlucomm.append(" where t.billetid = '"+hashMaplist.get(i).get("MATERIAL_NO")+"' ");
  922. mapper.updateJudgeStatus(sqlucomm.toString());
  923. }
  924. }else if((list.getString("PLINE_CODE").equals("RZ1") || list.getString("PLINE_CODE").equals("LT1")) && smpTypeCode.equals("3")){
  925. if(list.getString("PLINE_CODE").equals("RZ1")){//1月22日改成LIKE形式
  926. String rzmaterialNo=list.getString("MATERIAL_NO").substring(0,12);
  927. String rzlt=" update qcm_judge_coil_result set PIC_IS_LOCK='0',PHYSRESULT = '0', PHYSRESULT_DESC = '待判', inspection_lot = '"+inspectionLot+"' "
  928. +" where coil_no like '"+rzmaterialNo+"%' ";
  929. mapper.updateJudgeStatus(rzlt.toString());
  930. rzlt="";
  931. rzlt=" update tbh02_coil_comm set SAMPL_NO = '"+inspectionLot+"' where OLD_SAMPL_NO like '"+rzmaterialNo+"%' ";
  932. mapper.updateJudgeStatus(rzlt.toString());
  933. }else{
  934. String rzlt=" update qcm_judge_coil_result set PHYSRESULT = '0', PHYSRESULT_DESC = '待判', inspection_lot = '"+inspectionLot+"' "
  935. +" where coil_no = '"+list.getString("MATERIAL_NO")+"' ";
  936. mapper.updateJudgeStatus(rzlt.toString());
  937. rzlt="";
  938. rzlt=" update C_TBC02_COIL_COMM set SMP_NO = '"+inspectionLot+"' where OLD_SAMPL_NO = '"+list.getString("MATERIAL_NO")+"' ";
  939. mapper.updateJudgeStatus(rzlt.toString());
  940. }
  941. }else if(list.getString("PLINE_CODE").equals("YT1") && smpTypeCode.equals("3")){
  942. String sqlmixRoll = "update QCM_JUDGE_YT_COIL_RESULT "
  943. + " set INSPECTION_LOT = '"+inspectionLot+"' "
  944. + " where COIL_NO ='"+list.getString("MATERIAL_NO")+"' ";
  945. mapper.updateJudgeStatus(sqlmixRoll.toString());
  946. }
  947. //截取取样编号后两位
  948. String specimenNo = hashMaplist.get(i).get("SPECIMEN_NO").toString();
  949. String lw = specimenNo.substring(specimenNo.length() - 2,specimenNo.length());
  950. //修改试样号
  951. sqlucomm.setLength(0);
  952. sqlucomm.append(" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t set t.smp_no = '"+smpNo+"',t.specimen_no ='"+smpNo+"'||'"+lw+"' ");
  953. sqlucomm.append(" where t.specimen_no = '"+hashMaplist.get(i).get("SPECIMEN_NO")+"' ");
  954. mapper.updateJudgeStatus(sqlucomm.toString());
  955. sqlucomm.setLength(0);
  956. sqlucomm.append(" update QCM_JHY_SAMPLE_CONSIGN_D t set t.inspection_lot='"+inspectionLot+"',t.smp_no = '"+smpNo+"',t.specimen_no ='"+smpNo+"'||'"+lw+"' ");
  957. sqlucomm.append(" where t.smp_no = '"+hashMaplist.get(i).get("SMP_NO")+"'"
  958. + " and t.specimen_no = '"+hashMaplist.get(i).get("SPECIMEN_NO")+"' "
  959. + " and t.batch_no like '%"+hashMaplist.get(i).get("BATCH_NO")+"%' ");
  960. mapper.updateJudgeStatus(sqlucomm.toString());
  961. String specimenNoZy = smpNo + lw;
  962. /*if(list.getString("PLINE_CODE").equals("GX1") || list.getString("PLINE_CODE").equals("BC2")
  963. || list.getString("PLINE_CODE").equals("GX2") ){
  964. String sqlggb = "update zj_result_all@xgcx t "
  965. + " set billetid_jy = '"+inspectionLot+"' "
  966. + " where billetid in (select MATERIAL_NO from QCM_JHY_SAMPLE_CONSIGN_D d"
  967. + " where d.specimen_no = '"+specimenNoZy+"' and rownum = 1 )";
  968. mapper.updateJudgeStatus(sqlggb.toString());
  969. }*/
  970. //引用初样实绩 除了当前取样类型 其它全部复制一遍
  971. //查询这个试样号 轧批号 获取初样所有取样编号
  972. String sqlrownum = "";
  973. sqlucomm.setLength(0);
  974. /* if(list.getString("PLINE_CODE").equals("HB1") || list.getString("PLINE_CODE").equals("ZB1")){
  975. sqlrownum = " and t.SMP_NO like '%"+list.getString("QLTY_SMP_NO")+"%' and rownum = 1";
  976. sqlucomm.append(" select t.SPECIMEN_NO,t.smp_type_code from QCM_JHY_SAMPLE_CONSIGN_D t "
  977. +" where t.smp_type_code <> '"+smpTypeCode+"' "
  978. + " and t.smp_no in (select t.smp_no "
  979. +" from Qcm_Jhy_Sample_r_Ord t "
  980. +" where t.batch_no like '%"+list.getString("BATCH_NO")+"%' "
  981. + " and t.psc like '%"+list.getString("PSC")+"%' "+sqlrownum+" ) ");
  982. }else{
  983. sqlucomm.append(" select t.SPECIMEN_NO,t.smp_type_code from QCM_JHY_SAMPLE_CONSIGN_D t "
  984. +" where t.smp_type_code = '0' "
  985. +" and t.smp_no in (select t.smp_no "
  986. +" from Qcm_Jhy_Sample_r_Ord t "
  987. +" where t.batch_no like '%"+list.getString("BATCH_NO")+"%' "
  988. + " and t.psc like '%"+list.getString("PSC")+"%') ");
  989. }*/
  990. //判断中厚板母板/件件取样 当前订单号是否有夹杂 20240918
  991. String zhfc="0";
  992. if(list.getString("PLINE_CODE").equals("HB1") || list.getString("PLINE_CODE").equals("ZB1")){
  993. String sqlFC="select T.* from qcm_jhy_sample_consign_d t where t.Freq_Code = 'D' AND T.INSPECTION_LOT IN ( "
  994. +" SELECT D.INSPECTION_LOT FROM QCM_JHY_SAMPLE_CONSIGN_D D WHERE D.SMP_NO = '"+list.getString("QLTY_SMP_NO")+"' ) ORDER BY T.CREATE_TIME DESC ";
  995. List<HashMap> HMFC = mapper.query(sqlFC.toString());
  996. if(HMFC!=null && HMFC.size()>=1){
  997. zhfc = HMFC.get(0).get("SMP_NO").toString();
  998. }
  999. }
  1000. if(!zhfc.equals("0")){
  1001. sqlucomm.append("select d.SPECIMEN_NO,d.smp_type_code,r.Guid "
  1002. +" from QCM_JUDGE_PHYSICAL_RESULT r "
  1003. +" left join QCM_JHY_SAMPLE_CONSIGN_D d "
  1004. +" on r.smp_no = d.smp_no "
  1005. +" and r.specimen_no = d.specimen_no "
  1006. +" where r.smp_no in ('"+list.getString("QLTY_SMP_NO")+"','"+zhfc+"') "
  1007. +" and r.batch_no like '"+list.getString("BATCH_NO")+"%' "
  1008. +" order by r.smp_no ");
  1009. }else{
  1010. sqlucomm.append("select d.SPECIMEN_NO,d.smp_type_code,r.Guid "
  1011. +" from QCM_JUDGE_PHYSICAL_RESULT r "
  1012. +" left join QCM_JHY_SAMPLE_CONSIGN_D d "
  1013. +" on r.smp_no = d.smp_no "
  1014. +" and r.specimen_no = d.specimen_no "
  1015. +" where r.smp_no = '"+list.getString("QLTY_SMP_NO")+"' "
  1016. +" and r.batch_no like '"+list.getString("BATCH_NO")+"%' "
  1017. +" order by r.smp_no ");
  1018. }
  1019. List<HashMap> hmap = mapper.query(sqlucomm.toString());
  1020. //判断线棒是不是小于五吊直接件件取样
  1021. String xbgb="0";
  1022. if(list.getString("PLINE_CODE").equals("GX1") || list.getString("PLINE_CODE").equals("BC2")
  1023. || list.getString("PLINE_CODE").equals("GX2") ){
  1024. if(hmap.get(0).get("SMP_TYPE_CODE").equals("0")){
  1025. hmap.clear();
  1026. sqlucomm.setLength(0);
  1027. sqlucomm.append(" select t.SPECIMEN_NO,t.smp_type_code from QCM_JHY_SAMPLE_CONSIGN_D t "
  1028. +" where t.smp_type_code = '0' "
  1029. +" and t.smp_no in (select t.smp_no from Qcm_Jhy_Sample_r_Ord t "
  1030. +" where t.batch_no like '%"+list.getString("BATCH_NO")+"%' and t.psc like '%"+list.getString("PSC")+"%') ");
  1031. hmap = mapper.query(sqlucomm.toString());
  1032. xbgb="1";
  1033. }
  1034. }
  1035. for (HashMap hm : hmap) {
  1036. String quoteStatus = (String)hm.get("SMP_TYPE_CODE");//取样类型
  1037. //查询当前初样取样编号的所有实绩
  1038. if(xbgb.equals("0")){
  1039. sql = "";
  1040. sql = "select t.specimen_no,t.seq,t.test_qty from QCM_JHY_INSP_PHYSICS t "
  1041. + " where t.specimen_no = '"+(String)hm.get("SPECIMEN_NO")+"' and t.GUID='"+(String)hm.get("GUID")+"' and rownum<=1";
  1042. }else{
  1043. sql = "";
  1044. sql = "select t.specimen_no,t.seq,t.test_qty from QCM_JHY_INSP_PHYSICS t "
  1045. + " where t.specimen_no = '"+(String)hm.get("SPECIMEN_NO")+"' ";
  1046. }
  1047. List<HashMap> hmPhysics = mapper.query(sql.toString());
  1048. for (HashMap hashMap : hmPhysics) {
  1049. //获取specimenNoZy取样编号 seq最大值
  1050. sql = "";
  1051. sql = "select decode(max(seq),'','49',max(seq))+1 as SEQ from QCM_JHY_INSP_PHYSICS t "
  1052. + " where t.specimen_no = '"+specimenNoZy+"'";
  1053. List<HashMap> seqhm = mapper.query(sql.toString());
  1054. BigDecimal big = (BigDecimal)seqhm.get(0).get("SEQ");
  1055. String seqs = big.toString();
  1056. Integer seqint = Integer.parseInt(seqs);
  1057. sql = "";
  1058. sql = " insert into QCM_JHY_INSP_PHYSICS "
  1059. +" (SPECIMEN_NO,SEQ,TEST_QTY,PHY_CODE_L,PHY_NAME_L,PHY_CODE_M,PHY_NAME_M,PHY_CODE_S,PHY_NAME_S,ITEM_CODE_D,ITEM_NAME_D, "
  1060. +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
  1061. +" VAL13,VAL14,VAL15,AVG_VAL,GUID,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, "
  1062. +" PHY_UNIT,MEMO,QUOTE_SPECIMEN_NO,QUOTE_STATUS) "
  1063. +" select '"+specimenNoZy+"','"+seqint+"',TEST_QTY,PHY_CODE_L,PHY_NAME_L,PHY_CODE_M,PHY_NAME_M,PHY_CODE_S,PHY_NAME_S,ITEM_CODE_D,ITEM_NAME_D, "
  1064. +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
  1065. +" VAL13,VAL14,VAL15,AVG_VAL,GUID,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, "
  1066. +" PHY_UNIT,MEMO,'"+(String)hashMap.get("SPECIMEN_NO")+"','"+quoteStatus+"' from QCM_JHY_INSP_PHYSICS t "
  1067. + " where t.specimen_no = '"+(String)hashMap.get("SPECIMEN_NO")+"' "
  1068. + "and t.seq = '"+hashMap.get("SEQ")+"' "
  1069. + "and t.test_qty = '"+hashMap.get("TEST_QTY")+"' ";
  1070. mapper.insert(sql);
  1071. sql = "";
  1072. sql = "insert into QCM_JHY_SAMPLE_CONSIGN_D_ITEM "
  1073. +" (SPECIMEN_NO,SEQ,SMP_NO,PHY_NAME_L,PHY_CODE_L,PHY_CODE_M,PHY_NAME_M,PHY_CODE_S,PHY_NAME_S, "
  1074. +" ITEM_CODE_D,ITEM_NAME_D,ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,ITEM_CODE_L,ITEM_DESC_L, "
  1075. +" STDMIN_SIGN,STDMIN,STDMAX_SIGN,STDMAX,TEST_QTY,SMP_QTY,SPECL_FL,ISJUDGE,JUDGE_BASIS,PHY_UNIT,GROUP_SEQ, "
  1076. +" QUOTE_SPECIMEN_NO,QUOTE_SEQ,ITEM_FLAG,MEMO,CREATE_ID,CREATE_NAME,CREATE_TIME,STDMEMO,RESMP_SEQ, "
  1077. +" PHY_GROUP_CODE,FY_QUOTE_SPECIMEN_NO,FY_QUOTE_STATUS) "
  1078. +" select '"+specimenNoZy+"','"+seqint+"','"+smpNo+"',PHY_NAME_L,PHY_CODE_L,PHY_CODE_M,PHY_NAME_M,PHY_CODE_S,PHY_NAME_S, "
  1079. +" ITEM_CODE_D,ITEM_NAME_D,ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,ITEM_CODE_L,ITEM_DESC_L, "
  1080. +" STDMIN_SIGN,STDMIN,STDMAX_SIGN,STDMAX,TEST_QTY,SMP_QTY,SPECL_FL,ISJUDGE,JUDGE_BASIS,PHY_UNIT,GROUP_SEQ, "
  1081. +" QUOTE_SPECIMEN_NO,QUOTE_SEQ,ITEM_FLAG,MEMO,CREATE_ID,CREATE_NAME,CREATE_TIME,STDMEMO,RESMP_SEQ, "
  1082. +" PHY_GROUP_CODE,'"+(String)hashMap.get("SPECIMEN_NO")+"','"+quoteStatus+"' from QCM_JHY_SAMPLE_CONSIGN_D_ITEM "
  1083. + " where specimen_no = '"+(String)hashMap.get("SPECIMEN_NO")+"' "
  1084. + "and seq = '"+hashMap.get("SEQ")+"' ";
  1085. mapper.insert(sql);
  1086. }
  1087. }
  1088. }
  1089. }
  1090. }
  1091. }
  1092. //夹杂按炉
  1093. private void createJznkSample2(HashMap result) throws Exception {
  1094. String heatNo = result.get("HEAT_NO").toString().substring(0, 9);//一共10位 截取9位 最后一位字母不要
  1095. String strPlineCode = "";
  1096. if(!result.get("PLINE_CODE").equals("ZB1") && !result.get("PLINE_CODE").equals("HB1") ){
  1097. strPlineCode = " and t.pline_code = '"+result.get("PLINE_CODE")+"' ";
  1098. }else{
  1099. strPlineCode = " and t.pline_code in ('ZB1','HB1') ";
  1100. }
  1101. StringBuffer sqlucomm = new StringBuffer();
  1102. String sql ="";
  1103. String baent = "0";
  1104. // 查询试样号对应的合同信息
  1105. sqlucomm.setLength(0);
  1106. sqlucomm.append(
  1107. "SELECT DESIGN_KEY,PSC,SMP_TYPE_CODE,CERT_INST_CODE,BATCH_NO,STEEL_CODE,BATCH_NO FROM QCM_JHY_SAMPLE_R_ORD WHERE SMP_NO='"
  1108. + result.get("SMP_NO") + "'");
  1109. List<HashMap> resultsM = mapper.query(sqlucomm.toString());
  1110. if (resultsM == null || resultsM.size() < 1) {
  1111. return;
  1112. }
  1113. // 根据合同信息和项目找到复样倍数信息
  1114. HashMap sampleM = resultsM.get(0);
  1115. if ("HJ".equals(((String) result.get("PHY_CODE_L")))) {
  1116. // 夹杂
  1117. sqlucomm.setLength(0);
  1118. sqlucomm.append("SELECT * FROM QCM_ORD_DESIGN_SAMPLE_M WHERE DESIGN_KEY='" + sampleM.get("DESIGN_KEY") + "'"
  1119. + " and PSC='" + sampleM.get("PSC") + "' and SAMPLE_STYLE_CODE='" + sampleM.get("SMP_TYPE_CODE")
  1120. + "' and ORG_CODE='" + sampleM.get("CERT_INST_CODE") + "' " + " and RATE_CODE='D' and PHY_CODE_L='HJ' ");
  1121. sqlucomm.append(" and SMP_POSITION_CODE='" + result.get("SMP_LOCATION_CODE") + "'");
  1122. }
  1123. List<HashMap> qtlyResource = mapper.query(sqlucomm.toString());
  1124. int time = 1;
  1125. if (qtlyResource == null || qtlyResource.size() < 1) {
  1126. return;
  1127. }
  1128. //查询除了当前轧批号不复样 其它全复样 检验委托只显示两个复样
  1129. sql ="";
  1130. if(DSampleLogo){
  1131. //件件取样
  1132. sql = " select t.*,o.steel_code,o.thick from QCM_JHY_SAMPLE_CONSIGN_D t,Qcm_Jhy_Sample_r_Ord o "
  1133. +" where t.smp_no = o.smp_no and t.heat_no like '"+heatNo+"%' "
  1134. + " and t.batch_no not in (select t.batch_no from QCM_JHY_SAMPLE_CONSIGN_D t "
  1135. +" where t.heat_no like '"+heatNo+"%' and t.QUOTE_CONSIGN_NO is null AND t.freq_code = 'D') "
  1136. + " AND t.freq_code = 'D' "
  1137. + strPlineCode;
  1138. }else{
  1139. //正常复样 and nvl(i.phy_code_s, 'null') <> 'J10'
  1140. sql = "select t.*,o.steel_code,o.thick from QCM_JHY_SAMPLE_CONSIGN_D t,Qcm_Jhy_Sample_r_Ord o "
  1141. +" where t.smp_no = o.smp_no and t.specimen_no in ( "
  1142. + " select t.specimen_no from QCM_JHY_SAMPLE_CONSIGN_D t, qcm_jhy_sample_consign_d_item i "
  1143. + " where t.specimen_no = i.specimen_no and t.heat_no like '"+heatNo+"%' and t.batch_no <> '"+result.get("BATCH_NO")+"' "
  1144. + " group by t.specimen_no ) "
  1145. + " and t.heat_no like '"+heatNo+"%' and t.batch_no <> '"+result.get("BATCH_NO")+"' "
  1146. + " AND t.freq_code = 'D' and t.smp_type_code = '0' AND o.JUDGE_STATUS='1' and t.QUOTE_CONSIGN_NO is not null "
  1147. + strPlineCode
  1148. + " and rownum <= 2 order by t.batch_no";
  1149. }
  1150. List<HashMap> hmap = mapper.query(sql.toString());
  1151. TreeSet<String> hjsets = new TreeSet<String>();
  1152. for (HashMap hashMap : hmap) {
  1153. hjsets.add((String)hashMap.get("BATCH_NO"));//这一炉除了 当前不合格的轧批 还有几个轧批
  1154. }
  1155. //非件件取样
  1156. if(!DSampleLogo){
  1157. // 查询当前炉 有没有复样
  1158. sqlucomm.setLength(0);
  1159. sqlucomm.append("SELECT SPECIMEN_NO FROM QCM_JHY_SAMPLE_CONSIGN_D t WHERE heat_no like '"+heatNo+"%' "
  1160. + " AND SMP_TYPE_CODE='1' AND FREQ_CODE='D' and STATUS='0' ");
  1161. sqlucomm.append(strPlineCode);
  1162. List<HashMap> resultsD = mapper.query(sqlucomm.toString());
  1163. if (resultsD != null && resultsD.size() >= 1) {
  1164. return;
  1165. }
  1166. }
  1167. String smpNo ="";
  1168. if(!DSampleLogo && hjsets.size() == 1){//非件件取样 并且只剩下一个轧批可用 用同一个试样号
  1169. smpNo = createQltySamNo((String) result.get("PLINE_CODE"));
  1170. }
  1171. String specimen_no = "";
  1172. int quote = 0;//大于两个轧批其它引用
  1173. for (HashMap hashMap : hmap) {
  1174. if(DSampleLogo || hjsets.size() >= 2){//件件取样 或者 轧批多于一个 用不同试样号 或者有多个夹杂轧批也用不同试样号
  1175. smpNo = createQltySamNo((String) result.get("PLINE_CODE"));
  1176. }
  1177. // 查询当前频率是否存在已经存在的取样要求信息 取样频率和取样位置代码
  1178. //件件取样
  1179. if(DSampleLogo){
  1180. sqlucomm.setLength(0);
  1181. sqlucomm.append("SELECT SPECIMEN_NO FROM QCM_JHY_SAMPLE_CONSIGN_D WHERE BATCH_NO='" + hashMap.get("BATCH_NO")
  1182. + "' " + " AND SMP_TYPE_CODE='3' AND FREQ_CODE='D' and STATUS='0' ");
  1183. }else{
  1184. //正常复样
  1185. // 查询当前频率是否存在已经存在的取样要求信息 取样频率和取样位置代码
  1186. sqlucomm.setLength(0);
  1187. sqlucomm.append("SELECT SPECIMEN_NO FROM QCM_JHY_SAMPLE_CONSIGN_D WHERE BATCH_NO='" + hashMap.get("BATCH_NO")
  1188. + "' " + " AND SMP_TYPE_CODE='1' AND FREQ_CODE='D' and STATUS='0' ");
  1189. }
  1190. List<HashMap> resultsD = mapper.query(sqlucomm.toString());
  1191. String Dsample ="";
  1192. String Dsamplecode ="";
  1193. String inspectionLot ="";
  1194. if (resultsD == null || resultsD.size() < 1) {//少于1代表没有生成复样或件件取样
  1195. //件件取样
  1196. if(DSampleLogo){
  1197. Dsample = "件件取样";
  1198. Dsamplecode = "3";
  1199. inspectionLot = createQltyInspectionLot(hashMap.get("BATCH_NO").toString());
  1200. }else{
  1201. Dsample = "复样";
  1202. Dsamplecode = "1";
  1203. }
  1204. if(!DSampleLogo){
  1205. sql = "";
  1206. sql ="Insert into QCM_JHY_SAMPLE_CONSIGN_M(SMP_NO,HEAT_NO,BATCH_NO,INSPECTION_LOT,BOARD_NO,MATERIAL_NO,PSC, "
  1207. +" PSC_DESC,SMP_CATG,CERT_INST_CODE,CERT_INST_NAME,SMP_TYPE_CODE,SMP_TYPE_NAME,GRADE_CODE,GRADE_NAME, "
  1208. +" PLINE_CODE,PLINE_NAME,VALIDFLAG,MEMO,CREATE_ID,CREATE_NAME,CREATE_TIME,ITEM_FLAG,DUPLICATE_SAMPLE) "
  1209. +" select '"+smpNo+"',HEAT_NO,BATCH_NO,INSPECTION_LOT,BOARD_NO,MATERIAL_NO,PSC, "
  1210. +" PSC_DESC,SMP_CATG,CERT_INST_CODE,CERT_INST_NAME,SMP_TYPE_CODE,SMP_TYPE_NAME,GRADE_CODE,GRADE_NAME, "
  1211. +" PLINE_CODE,PLINE_NAME,VALIDFLAG,MEMO,'sys','sys',sysdate,ITEM_FLAG,'"+Dsample+"' "
  1212. +" from QCM_JHY_SAMPLE_CONSIGN_M t where t.SMP_NO = '"+hashMap.get("SMP_NO")+"'"
  1213. + " and t.batch_no like '%"+hashMap.get("BATCH_NO")+"%' and rownum <= 1 ";
  1214. mapper.insert(sql);
  1215. sql = "";
  1216. sql = "Insert into QCM_JHY_SAMPLE_R_ORD(DESIGN_KEY,SMP_NO,PSC,PSC_DESC,HEAT_NO,BATCH_NO,INSPECTION_LOT,DELIVERY_STATE_CODE, "
  1217. + " DELIVERY_STATE_DESC,THICK,WIDTH,LENGTH,PLINE_CODE,PLINE_NAME,MSC_PLINE,PROCESS_CODE,CERT_INST_CODE,CERT_INST_NAME, "
  1218. + " SMP_TYPE_CODE,SMP_TYPE_NAME,SMELTING_CNT,PRODUCT_CNT,ASSAY_NO_CP,ASSAY_NO_RL,CIC_ID,JUDGE_STATUS,PROD_CODE,"
  1219. + " PROD_NAME,STEEL_CODE,STEEL_NAME,STD_CODE,STD_NAME,CREATE_TIME,CREATE_ID,CREATE_NAME,DUPLICATE_SAMPLE) "
  1220. + " select DESIGN_KEY,'"+smpNo+"',PSC,PSC_DESC,HEAT_NO,BATCH_NO,INSPECTION_LOT,DELIVERY_STATE_CODE,DELIVERY_STATE_DESC, "
  1221. + " THICK,WIDTH,LENGTH,PLINE_CODE,PLINE_NAME,MSC_PLINE,PROCESS_CODE,CERT_INST_CODE,CERT_INST_NAME,SMP_TYPE_CODE,"
  1222. + " SMP_TYPE_NAME,SMELTING_CNT,PRODUCT_CNT,ASSAY_NO_CP,ASSAY_NO_RL,CIC_ID,'0',PROD_CODE,PROD_NAME,STEEL_CODE, "
  1223. + " STEEL_NAME,STD_CODE,STD_NAME,sysdate,'sys','sys','"+Dsample+"' "
  1224. + " from QCM_JHY_SAMPLE_R_ORD t where t.SMP_NO = '"+hashMap.get("SMP_NO")+"' "
  1225. + " and t.batch_no like '%"+hashMap.get("BATCH_NO")+"%' and rownum <= 1 ";
  1226. mapper.insert(sql);
  1227. if(hjsets.size() >= 2){
  1228. //把已经判定的ORD检验号置空 ord先插入后修改
  1229. sql = "";
  1230. sql =" update QCM_JHY_SAMPLE_R_ORD t set t.INSPECTION_LOT = '' "
  1231. + " where t.batch_no like '%"+hashMap.get("BATCH_NO")+"%' "
  1232. + " and t.steel_code like '%"+hashMap.get("STEEL_CODE")+"%'"
  1233. + " and t.thick like '%"+hashMap.get("THICK")+"%' "
  1234. + " and t.SMP_NO = '"+hashMap.get("SMP_NO")+"' ";//and t.judge_status = '1'
  1235. mapper.updateJudgeStatus(sql.toString());
  1236. }else if(hjsets.size() == 1 && baent.equals("0")){
  1237. sql = "";
  1238. sql =" update QCM_JHY_SAMPLE_R_ORD t set t.INSPECTION_LOT = '' "
  1239. + " where t.batch_no like '%"+hashMap.get("BATCH_NO")+"%' "
  1240. + " and t.steel_code like '%"+hashMap.get("STEEL_CODE")+"%'"
  1241. + " and t.thick like '%"+hashMap.get("THICK")+"%' "
  1242. + " and t.SMP_NO = '"+hashMap.get("SMP_NO")+"' ";//and t.judge_status = '1'
  1243. mapper.updateJudgeStatus(sql.toString());
  1244. baent="1";
  1245. }
  1246. }else if(DSampleLogo){
  1247. sql = "";
  1248. sql ="Insert into QCM_JHY_SAMPLE_CONSIGN_M(SMP_NO,HEAT_NO,BATCH_NO,INSPECTION_LOT,BOARD_NO,MATERIAL_NO,PSC, "
  1249. +" PSC_DESC,SMP_CATG,CERT_INST_CODE,CERT_INST_NAME,SMP_TYPE_CODE,SMP_TYPE_NAME,GRADE_CODE,GRADE_NAME, "
  1250. +" PLINE_CODE,PLINE_NAME,VALIDFLAG,MEMO,CREATE_ID,CREATE_NAME,CREATE_TIME,ITEM_FLAG,DUPLICATE_SAMPLE) "
  1251. +" select '"+smpNo+"',HEAT_NO,BATCH_NO,'"+inspectionLot+"',BOARD_NO,MATERIAL_NO,PSC, "
  1252. +" PSC_DESC,SMP_CATG,CERT_INST_CODE,CERT_INST_NAME,SMP_TYPE_CODE,SMP_TYPE_NAME,GRADE_CODE,GRADE_NAME, "
  1253. +" PLINE_CODE,PLINE_NAME,VALIDFLAG,MEMO,'sys','sys',sysdate,ITEM_FLAG,'"+Dsample+"' "
  1254. +" from QCM_JHY_SAMPLE_CONSIGN_M t where t.SMP_NO = '"+hashMap.get("SMP_NO")+"'"
  1255. + " and t.batch_no like '%"+hashMap.get("BATCH_NO")+"%' and rownum <= 1 ";
  1256. mapper.insert(sql);
  1257. sql = "";
  1258. sql = "Insert into QCM_JHY_SAMPLE_R_ORD(DESIGN_KEY,SMP_NO,PSC,PSC_DESC,HEAT_NO,BATCH_NO,INSPECTION_LOT,DELIVERY_STATE_CODE, "
  1259. + " DELIVERY_STATE_DESC,THICK,WIDTH,LENGTH,PLINE_CODE,PLINE_NAME,MSC_PLINE,PROCESS_CODE,CERT_INST_CODE,CERT_INST_NAME, "
  1260. + " SMP_TYPE_CODE,SMP_TYPE_NAME,SMELTING_CNT,PRODUCT_CNT,ASSAY_NO_CP,ASSAY_NO_RL,CIC_ID,JUDGE_STATUS,PROD_CODE,"
  1261. + " PROD_NAME,STEEL_CODE,STEEL_NAME,STD_CODE,STD_NAME,CREATE_TIME,CREATE_ID,CREATE_NAME,DUPLICATE_SAMPLE) "
  1262. + " select DESIGN_KEY,'"+smpNo+"',PSC,PSC_DESC,HEAT_NO,BATCH_NO,'"+inspectionLot+"',DELIVERY_STATE_CODE,DELIVERY_STATE_DESC, "
  1263. + " THICK,WIDTH,LENGTH,PLINE_CODE,PLINE_NAME,MSC_PLINE,PROCESS_CODE,CERT_INST_CODE,CERT_INST_NAME,SMP_TYPE_CODE,"
  1264. + " SMP_TYPE_NAME,SMELTING_CNT,PRODUCT_CNT,ASSAY_NO_CP,ASSAY_NO_RL,CIC_ID,'0',PROD_CODE,PROD_NAME,STEEL_CODE, "
  1265. + " STEEL_NAME,STD_CODE,STD_NAME,sysdate,'sys','sys','"+Dsample+"' "
  1266. + " from QCM_JHY_SAMPLE_R_ORD t where t.SMP_NO = '"+hashMap.get("SMP_NO")+"' "
  1267. + " and t.batch_no like '%"+hashMap.get("BATCH_NO")+"%' and rownum <= 1 ";
  1268. mapper.insert(sql);
  1269. sql = "";
  1270. sql = " update zj_result_all@xgcx t set t.billetid_jy = '"+inspectionLot+"' ";
  1271. sql = " where t.billetid like '"+hashMap.get("BATCH_NO")+"%' ";
  1272. mapper.updateJudgeStatus(sqlucomm.toString());
  1273. }
  1274. int ibatchNO = 0;
  1275. //判断要复样的轧批有几个
  1276. if(hjsets.size() == 1){
  1277. ibatchNO = 2;
  1278. }else if(hjsets.size() >=2){
  1279. ibatchNO = 1;
  1280. }
  1281. if(!DSampleLogo){//非件件取样
  1282. // 生成新的复样的取样编号
  1283. for(int i=0;i<ibatchNO;i++){
  1284. specimen_no = createSpecimen_no(smpNo);
  1285. //插入D表
  1286. sql = "";
  1287. sql = "insert into qcm_jhy_sample_consign_d "
  1288. +" (smp_no, specimen_no, heat_no, batch_no, inspection_lot, freq_code, freq_name, material_no, smp_type_code, smp_type_name, consign_no, consign_no_seq, test_qty, smp_qty, smp_location, board_no, old_consign_no, pline_code, pline_name, status, validflag, source, guid, chem_item, product_cnt, create_time, smp_location_code, memo, weight, weight_std, weight_sfd, process_no, quote_batch_no,PROCESS_NOS,PROCESS_CODE) "
  1289. +" select "
  1290. +" '"+smpNo+"', '"+specimen_no+"', heat_no, batch_no, inspection_lot, freq_code, freq_name, material_no, '"+Dsamplecode+"', '"+Dsample+"', consign_no, consign_no_seq, test_qty, smp_qty, smp_location, board_no, '"+hashMap.get("SPECIMEN_NO")+"', pline_code, pline_name, '0', validflag, source, guid, chem_item, product_cnt, sysdate, smp_location_code, memo, weight, weight_std, weight_sfd, process_no, '"+result.get("BATCH_NO")+"',PROCESS_NOS,PROCESS_CODE "
  1291. +" from qcm_jhy_sample_consign_d t "
  1292. +" where t.SMP_NO = '"+hashMap.get("SMP_NO")+"' and t.heat_no like '"+heatNo+"%' and t.batch_no like '%"+hashMap.get("BATCH_NO")+"%' and t.freq_code = 'D' and t.smp_type_code = '0' and rownum <= 1";
  1293. mapper.insert(sql);
  1294. //插入ITEM表
  1295. sql = "";
  1296. sql = "insert into qcm_jhy_sample_consign_d_item "
  1297. +" (specimen_no, seq, smp_no, phy_name_l, phy_code_l, phy_code_m, phy_name_m, phy_code_s, phy_name_s, item_code_d, item_name_d, item_code_t, item_name_t, item_code_s, item_name_s, item_code_l, item_desc_l, stdmin_sign, stdmin, stdmax_sign, stdmax, test_qty, smp_qty, specl_fl, isjudge, judge_basis, phy_unit, group_seq, quote_seq, item_flag, memo, create_id, create_name, create_time, stdmemo, resmp_seq, phy_group_code) "
  1298. +" select '"+specimen_no+"', seq, '"+smpNo+"', phy_name_l, phy_code_l, phy_code_m, phy_name_m, phy_code_s, phy_name_s, item_code_d, item_name_d, item_code_t, item_name_t, item_code_s, item_name_s, item_code_l, item_desc_l, stdmin_sign, stdmin, stdmax_sign, stdmax, test_qty, smp_qty, specl_fl, isjudge, judge_basis, phy_unit, group_seq, quote_seq, item_flag, memo, '"+Dsample+"','"+Dsample+"' , SYSDATE, stdmemo, resmp_seq, phy_group_code "
  1299. +" from qcm_jhy_sample_consign_d_item t where t.specimen_no = '"+hashMap.get("SPECIMEN_NO")+"' ";
  1300. mapper.insert(sql);
  1301. }
  1302. //如果轧批多于一个 说明每个轧批都要获取相应的初样
  1303. if(hjsets.size() >=2){
  1304. //查询当前初样取样编号的所有实绩
  1305. sql = "";
  1306. sql = " select t.* from QCM_JHY_INSP_PHYSICS t "
  1307. +" where t.specimen_no in (select d.specimen_no from QCM_JHY_SAMPLE_CONSIGN_D d where d.smp_no = '"+hashMap.get("SMP_NO")+"') "
  1308. + " order by t.SPECIMEN_NO asc, t.phy_code_l asc,t.phy_code_s asc";//and d.FREQ_CODE='D'
  1309. List<HashMap> hmPhysics = mapper.query(sql.toString());
  1310. //把初样的项目 放到 复样中
  1311. for (HashMap hashMap1 : hmPhysics) {
  1312. sql = "";
  1313. sql = "select decode(max(seq),'','49',max(seq))+1 as SEQ from QCM_JHY_INSP_PHYSICS t "
  1314. + " where t.specimen_no = '"+specimen_no+"'";
  1315. List<HashMap> seqhm = mapper.query(sql.toString());
  1316. BigDecimal big = (BigDecimal)seqhm.get(0).get("SEQ");
  1317. String seqs = big.toString();
  1318. Integer seqint = Integer.parseInt(seqs);
  1319. sql = "";
  1320. sql = " insert into QCM_JHY_INSP_PHYSICS "
  1321. +" (SPECIMEN_NO,SEQ,TEST_QTY,PHY_CODE_L,PHY_NAME_L,PHY_CODE_M,PHY_NAME_M,PHY_CODE_S,PHY_NAME_S,ITEM_CODE_D,ITEM_NAME_D, "
  1322. +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
  1323. +" VAL13,VAL14,VAL15,AVG_VAL,GUID,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, "
  1324. +" PHY_UNIT,MEMO,QUOTE_SPECIMEN_NO,QUOTE_STATUS) "
  1325. +" select '"+specimen_no+"','"+seqint+"',TEST_QTY,PHY_CODE_L,PHY_NAME_L,PHY_CODE_M,PHY_NAME_M,PHY_CODE_S,PHY_NAME_S,ITEM_CODE_D,ITEM_NAME_D, "
  1326. +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
  1327. +" VAL13,VAL14,VAL15,AVG_VAL,GUID,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, "
  1328. +" PHY_UNIT,MEMO,'"+(String)hashMap1.get("SPECIMEN_NO")+"','0' from QCM_JHY_INSP_PHYSICS t "
  1329. + " where t.specimen_no = '"+(String)hashMap1.get("SPECIMEN_NO")+"' "
  1330. + " and t.phy_code_l = '"+hashMap1.get("PHY_CODE_L")+"' "
  1331. + " and t.phy_code_s = '"+hashMap1.get("PHY_CODE_S")+"' "
  1332. + " and t.PHY_CODE_M = '"+hashMap1.get("PHY_CODE_M")+"' "
  1333. + " and t.test_qty = '"+hashMap1.get("TEST_QTY")+"' ";
  1334. mapper.insert(sql);
  1335. sql = "";
  1336. sql = "insert into QCM_JHY_SAMPLE_CONSIGN_D_ITEM "
  1337. +" (SPECIMEN_NO,SEQ,SMP_NO,PHY_NAME_L,PHY_CODE_L,PHY_CODE_M,PHY_NAME_M,PHY_CODE_S,PHY_NAME_S, "
  1338. +" ITEM_CODE_D,ITEM_NAME_D,ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,ITEM_CODE_L,ITEM_DESC_L, "
  1339. +" STDMIN_SIGN,STDMIN,STDMAX_SIGN,STDMAX,TEST_QTY,SMP_QTY,SPECL_FL,ISJUDGE,JUDGE_BASIS,PHY_UNIT,GROUP_SEQ, "
  1340. +" QUOTE_SPECIMEN_NO,QUOTE_SEQ,ITEM_FLAG,MEMO,CREATE_ID,CREATE_NAME,CREATE_TIME,STDMEMO,RESMP_SEQ, "
  1341. +" PHY_GROUP_CODE,FY_QUOTE_SPECIMEN_NO,FY_QUOTE_STATUS) "
  1342. +" select '"+specimen_no+"','"+seqint+"','"+smpNo+"',PHY_NAME_L,PHY_CODE_L,PHY_CODE_M,PHY_NAME_M,PHY_CODE_S,PHY_NAME_S, "
  1343. +" ITEM_CODE_D,ITEM_NAME_D,ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,ITEM_CODE_L,ITEM_DESC_L, "
  1344. +" STDMIN_SIGN,STDMIN,STDMAX_SIGN,STDMAX,TEST_QTY,SMP_QTY,SPECL_FL,ISJUDGE,JUDGE_BASIS,PHY_UNIT,GROUP_SEQ, "
  1345. +" QUOTE_SPECIMEN_NO,QUOTE_SEQ,ITEM_FLAG,MEMO,CREATE_ID,CREATE_NAME,CREATE_TIME,STDMEMO,RESMP_SEQ, "
  1346. +" PHY_GROUP_CODE,'"+(String)hashMap1.get("SPECIMEN_NO")+"','0' from QCM_JHY_SAMPLE_CONSIGN_D_ITEM "
  1347. + " where specimen_no = '"+(String)hashMap1.get("SPECIMEN_NO")+"' "
  1348. + " and phy_code_l = '"+hashMap1.get("PHY_CODE_L")+"' "
  1349. + " and PHY_CODE_M = '"+hashMap1.get("PHY_CODE_M")+"' "
  1350. + " and phy_code_s = '"+hashMap1.get("PHY_CODE_S")+"' ";
  1351. mapper.insert(sql);
  1352. }
  1353. }
  1354. }else if(DSampleLogo){//件件取样
  1355. specimen_no = createSpecimen_no(smpNo);
  1356. //插入D表
  1357. sql = "";
  1358. sql = "insert into qcm_jhy_sample_consign_d "
  1359. +" (smp_no, specimen_no, heat_no, batch_no, inspection_lot, freq_code, freq_name, material_no, smp_type_code, smp_type_name, consign_no, consign_no_seq, test_qty, smp_qty, smp_location, board_no, old_consign_no, pline_code, pline_name, status, validflag, source, guid, chem_item, product_cnt, create_time, smp_location_code, memo, weight, weight_std, weight_sfd, process_no, quote_batch_no,PROCESS_NOS,PROCESS_CODE) "
  1360. +" select "
  1361. +" '"+smpNo+"', '"+specimen_no+"', heat_no, batch_no, '"+inspectionLot+"', freq_code, freq_name, material_no, '"+Dsamplecode+"', '"+Dsample+"', consign_no, consign_no_seq, test_qty, smp_qty, smp_location, board_no, '"+hashMap.get("SPECIMEN_NO")+"', pline_code, pline_name, '0', validflag, source, guid, chem_item, product_cnt, sysdate, smp_location_code, memo, weight, weight_std, weight_sfd, process_no, '"+result.get("BATCH_NO")+"',PROCESS_NOS,PROCESS_CODE "
  1362. +" from qcm_jhy_sample_consign_d t "
  1363. +" where t.SMP_NO = '"+hashMap.get("SMP_NO")+"' and t.heat_no like '"+heatNo+"%' and t.batch_no like '%"+hashMap.get("BATCH_NO")+"%' and t.freq_code = 'D' and t.smp_type_code = '0' and rownum <= 1";
  1364. mapper.insert(sql);
  1365. //插入ITEM表
  1366. sql = "";
  1367. sql = "insert into qcm_jhy_sample_consign_d_item "
  1368. +" (specimen_no, seq, smp_no, phy_name_l, phy_code_l, phy_code_m, phy_name_m, phy_code_s, phy_name_s, item_code_d, item_name_d, item_code_t, item_name_t, item_code_s, item_name_s, item_code_l, item_desc_l, stdmin_sign, stdmin, stdmax_sign, stdmax, test_qty, smp_qty, specl_fl, isjudge, judge_basis, phy_unit, group_seq, quote_seq, item_flag, memo, create_id, create_name, create_time, stdmemo, resmp_seq, phy_group_code) "
  1369. +" select '"+specimen_no+"', seq, '"+smpNo+"', phy_name_l, phy_code_l, phy_code_m, phy_name_m, phy_code_s, phy_name_s, item_code_d, item_name_d, item_code_t, item_name_t, item_code_s, item_name_s, item_code_l, item_desc_l, stdmin_sign, stdmin, stdmax_sign, stdmax, test_qty, smp_qty, specl_fl, isjudge, judge_basis, phy_unit, group_seq, quote_seq, item_flag, memo, '"+Dsample+"','"+Dsample+"' , SYSDATE, stdmemo, resmp_seq, phy_group_code "
  1370. +" from qcm_jhy_sample_consign_d_item t where t.specimen_no = '"+hashMap.get("SPECIMEN_NO")+"' ";
  1371. mapper.insert(sql);
  1372. //查询当前初样取样编号的所有实绩
  1373. sql = "";
  1374. sql = " select t.* from QCM_JHY_INSP_PHYSICS t "
  1375. +" where t.specimen_no in (select d.specimen_no from QCM_JHY_SAMPLE_CONSIGN_D d where d.smp_no = '"+hashMap.get("SMP_NO")+"') "
  1376. + " order by t.SPECIMEN_NO asc, t.phy_code_l asc,t.phy_code_s asc";//and d.FREQ_CODE='D'
  1377. List<HashMap> hmPhysics = mapper.query(sql.toString());
  1378. //把初样的项目 放到 复样中
  1379. for (HashMap hashMap1 : hmPhysics) {
  1380. sql = "";
  1381. sql = "select decode(max(seq),'','49',max(seq))+1 as SEQ from QCM_JHY_INSP_PHYSICS t "
  1382. + " where t.specimen_no = '"+specimen_no+"'";
  1383. List<HashMap> seqhm = mapper.query(sql.toString());
  1384. BigDecimal big = (BigDecimal)seqhm.get(0).get("SEQ");
  1385. String seqs = big.toString();
  1386. Integer seqint = Integer.parseInt(seqs);
  1387. sql = "";
  1388. sql = " insert into QCM_JHY_INSP_PHYSICS "
  1389. +" (SPECIMEN_NO,SEQ,TEST_QTY,PHY_CODE_L,PHY_NAME_L,PHY_CODE_M,PHY_NAME_M,PHY_CODE_S,PHY_NAME_S,ITEM_CODE_D,ITEM_NAME_D, "
  1390. +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
  1391. +" VAL13,VAL14,VAL15,AVG_VAL,GUID,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, "
  1392. +" PHY_UNIT,MEMO,QUOTE_SPECIMEN_NO) "
  1393. +" select '"+specimen_no+"','"+seqint+"',TEST_QTY,PHY_CODE_L,PHY_NAME_L,PHY_CODE_M,PHY_NAME_M,PHY_CODE_S,PHY_NAME_S,ITEM_CODE_D,ITEM_NAME_D, "
  1394. +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
  1395. +" VAL13,VAL14,VAL15,AVG_VAL,GUID,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, "
  1396. +" PHY_UNIT,MEMO,'"+(String)hashMap1.get("SPECIMEN_NO")+"' from QCM_JHY_INSP_PHYSICS t "
  1397. + " where t.specimen_no = '"+(String)hashMap1.get("SPECIMEN_NO")+"' "
  1398. + " and t.phy_code_l = '"+hashMap1.get("PHY_CODE_L")+"' "
  1399. + " and t.phy_code_s = '"+hashMap1.get("PHY_CODE_S")+"' "
  1400. + " and t.PHY_CODE_M = '"+hashMap1.get("PHY_CODE_M")+"' "
  1401. + " and t.test_qty = '"+hashMap1.get("TEST_QTY")+"' ";
  1402. mapper.insert(sql);
  1403. sql = "";
  1404. sql = "insert into QCM_JHY_SAMPLE_CONSIGN_D_ITEM "
  1405. +" (SPECIMEN_NO,SEQ,SMP_NO,PHY_NAME_L,PHY_CODE_L,PHY_CODE_M,PHY_NAME_M,PHY_CODE_S,PHY_NAME_S, "
  1406. +" ITEM_CODE_D,ITEM_NAME_D,ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,ITEM_CODE_L,ITEM_DESC_L, "
  1407. +" STDMIN_SIGN,STDMIN,STDMAX_SIGN,STDMAX,TEST_QTY,SMP_QTY,SPECL_FL,ISJUDGE,JUDGE_BASIS,PHY_UNIT,GROUP_SEQ, "
  1408. +" QUOTE_SPECIMEN_NO,QUOTE_SEQ,ITEM_FLAG,MEMO,CREATE_ID,CREATE_NAME,CREATE_TIME,STDMEMO,RESMP_SEQ, "
  1409. +" PHY_GROUP_CODE,FY_QUOTE_SPECIMEN_NO) "
  1410. +" select '"+specimen_no+"','"+seqint+"','"+smpNo+"',PHY_NAME_L,PHY_CODE_L,PHY_CODE_M,PHY_NAME_M,PHY_CODE_S,PHY_NAME_S, "
  1411. +" ITEM_CODE_D,ITEM_NAME_D,ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,ITEM_CODE_L,ITEM_DESC_L, "
  1412. +" STDMIN_SIGN,STDMIN,STDMAX_SIGN,STDMAX,TEST_QTY,SMP_QTY,SPECL_FL,ISJUDGE,JUDGE_BASIS,PHY_UNIT,GROUP_SEQ, "
  1413. +" QUOTE_SPECIMEN_NO,QUOTE_SEQ,ITEM_FLAG,MEMO,CREATE_ID,CREATE_NAME,CREATE_TIME,STDMEMO,RESMP_SEQ, "
  1414. +" PHY_GROUP_CODE,'"+(String)hashMap1.get("SPECIMEN_NO")+"' from QCM_JHY_SAMPLE_CONSIGN_D_ITEM "
  1415. + " where specimen_no = '"+(String)hashMap1.get("SPECIMEN_NO")+"' "
  1416. + " and phy_code_l = '"+hashMap1.get("PHY_CODE_L")+"' "
  1417. + " and PHY_CODE_M = '"+hashMap1.get("PHY_CODE_M")+"' "
  1418. + " and phy_code_s = '"+hashMap1.get("PHY_CODE_S")+"' ";
  1419. mapper.insert(sql);
  1420. }
  1421. }
  1422. }
  1423. }
  1424. //非件件取样 只有一个轧批时用的
  1425. if(!DSampleLogo && hjsets.size() <=1 ){
  1426. //查询当前初样取样编号的所有实绩 拿取除了初样送样的另一个轧批号hmap.get(0).get("SMP_NO")
  1427. sql = "";
  1428. sql = " select t.* from QCM_JHY_INSP_PHYSICS t "
  1429. +" where t.specimen_no in (select d.specimen_no from QCM_JHY_SAMPLE_CONSIGN_D d where d.smp_no = '"+hmap.get(0).get("SMP_NO")+"') "
  1430. + " order by t.SPECIMEN_NO asc, t.phy_code_l asc,t.phy_code_s asc";// and d.FREQ_CODE='D'
  1431. List<HashMap> hmPhysics = mapper.query(sql.toString());
  1432. //把初样的项目 放到 复样中
  1433. for (HashMap hashMap1 : hmPhysics) {
  1434. sql = "";
  1435. sql = "select decode(max(seq),'','49',max(seq))+1 as SEQ from QCM_JHY_INSP_PHYSICS t "
  1436. + " where t.specimen_no = '"+specimen_no+"'";
  1437. List<HashMap> seqhm = mapper.query(sql.toString());
  1438. BigDecimal big = (BigDecimal)seqhm.get(0).get("SEQ");
  1439. String seqs = big.toString();
  1440. Integer seqint = Integer.parseInt(seqs);
  1441. sql = "";
  1442. sql = " insert into QCM_JHY_INSP_PHYSICS "
  1443. +" (SPECIMEN_NO,SEQ,TEST_QTY,PHY_CODE_L,PHY_NAME_L,PHY_CODE_M,PHY_NAME_M,PHY_CODE_S,PHY_NAME_S,ITEM_CODE_D,ITEM_NAME_D, "
  1444. +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
  1445. +" VAL13,VAL14,VAL15,AVG_VAL,GUID,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, "
  1446. +" PHY_UNIT,MEMO,QUOTE_SPECIMEN_NO,QUOTE_STATUS) "
  1447. +" select '"+specimen_no+"','"+seqint+"',TEST_QTY,PHY_CODE_L,PHY_NAME_L,PHY_CODE_M,PHY_NAME_M,PHY_CODE_S,PHY_NAME_S,ITEM_CODE_D,ITEM_NAME_D, "
  1448. +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
  1449. +" VAL13,VAL14,VAL15,AVG_VAL,GUID,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, "
  1450. +" PHY_UNIT,MEMO,'"+(String)hashMap1.get("SPECIMEN_NO")+"','0' from QCM_JHY_INSP_PHYSICS t "
  1451. + " where t.specimen_no = '"+(String)hashMap1.get("SPECIMEN_NO")+"' "
  1452. + " and t.phy_code_l = '"+hashMap1.get("PHY_CODE_L")+"' "
  1453. + " and t.phy_code_s = '"+hashMap1.get("PHY_CODE_S")+"' "
  1454. + " and t.PHY_CODE_M = '"+hashMap1.get("PHY_CODE_M")+"' "
  1455. + " and t.test_qty = '"+hashMap1.get("TEST_QTY")+"' ";
  1456. mapper.insert(sql);
  1457. sql = "";
  1458. sql = "insert into QCM_JHY_SAMPLE_CONSIGN_D_ITEM "
  1459. +" (SPECIMEN_NO,SEQ,SMP_NO,PHY_NAME_L,PHY_CODE_L,PHY_CODE_M,PHY_NAME_M,PHY_CODE_S,PHY_NAME_S, "
  1460. +" ITEM_CODE_D,ITEM_NAME_D,ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,ITEM_CODE_L,ITEM_DESC_L, "
  1461. +" STDMIN_SIGN,STDMIN,STDMAX_SIGN,STDMAX,TEST_QTY,SMP_QTY,SPECL_FL,ISJUDGE,JUDGE_BASIS,PHY_UNIT,GROUP_SEQ, "
  1462. +" QUOTE_SPECIMEN_NO,QUOTE_SEQ,ITEM_FLAG,MEMO,CREATE_ID,CREATE_NAME,CREATE_TIME,STDMEMO,RESMP_SEQ, "
  1463. +" PHY_GROUP_CODE,FY_QUOTE_SPECIMEN_NO,FY_QUOTE_STATUS) "
  1464. +" select '"+specimen_no+"','"+seqint+"','"+smpNo+"',PHY_NAME_L,PHY_CODE_L,PHY_CODE_M,PHY_NAME_M,PHY_CODE_S,PHY_NAME_S, "
  1465. +" ITEM_CODE_D,ITEM_NAME_D,ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,ITEM_CODE_L,ITEM_DESC_L, "
  1466. +" STDMIN_SIGN,STDMIN,STDMAX_SIGN,STDMAX,TEST_QTY,SMP_QTY,SPECL_FL,ISJUDGE,JUDGE_BASIS,PHY_UNIT,GROUP_SEQ, "
  1467. +" QUOTE_SPECIMEN_NO,QUOTE_SEQ,ITEM_FLAG,MEMO,CREATE_ID,CREATE_NAME,CREATE_TIME,STDMEMO,RESMP_SEQ, "
  1468. +" PHY_GROUP_CODE,'"+(String)hashMap1.get("SPECIMEN_NO")+"','0' from QCM_JHY_SAMPLE_CONSIGN_D_ITEM "
  1469. + " where specimen_no = '"+(String)hashMap1.get("SPECIMEN_NO")+"' "
  1470. + " and phy_code_l = '"+hashMap1.get("PHY_CODE_L")+"' "
  1471. + " and PHY_CODE_M = '"+hashMap1.get("PHY_CODE_M")+"' "
  1472. + " and phy_code_s = '"+hashMap1.get("PHY_CODE_S")+"' ";
  1473. mapper.insert(sql);
  1474. }
  1475. }
  1476. }
  1477. /**
  1478. * 创建试样号
  1479. * @param pline_code 产线代码
  1480. * @return
  1481. */
  1482. private String createQltySamNo(String pline_code) {
  1483. // TODO Auto-generated method stub
  1484. String smp_no="";
  1485. SimpleDateFormat sdf = new SimpleDateFormat("yyMMdd");
  1486. if (pline_code.length()>3){
  1487. pline_code=pline_code.substring(0,3);
  1488. }else if (pline_code.length()==2){
  1489. pline_code="0"+pline_code;
  1490. }else if (pline_code.length()==1){
  1491. pline_code="00"+pline_code;
  1492. }
  1493. String syh = pline_code +sdf.format(new Date());
  1494. StringBuffer sqlucomm = new StringBuffer();
  1495. sqlucomm.append("SELECT (max(to_number(substr(smp_no,10)))+1) SMP_NO FROM QCM_JHY_SAMPLE_CONSIGN_M WHERE SMP_NO like '"+syh+"%' ");
  1496. HashMap result=mapper.queryOne(sqlucomm.toString());
  1497. BigDecimal seq=BigDecimal.ZERO;
  1498. if (result!=null && result.get("SMP_NO")!=null ) {
  1499. seq=(BigDecimal)result.get("SMP_NO");
  1500. }
  1501. seq=seq.add(BigDecimal.ONE);
  1502. smp_no=syh+ String.format("%04d", seq.intValue());
  1503. return smp_no;
  1504. }
  1505. /**
  1506. * 创建检验号
  1507. * @param batchNo
  1508. * @return
  1509. */
  1510. private String createQltyInspectionLot(String batchNo) {
  1511. String inspection_lot="";
  1512. StringBuffer sqlucomm = new StringBuffer();
  1513. sqlucomm.append("SELECT max(to_number(substr(inspection_lot,-4))) inspection_lot FROM QCM_JHY_SAMPLE_CONSIGN_M WHERE batch_no like '%"+batchNo+"%' ");
  1514. HashMap result=mapper.queryOne(sqlucomm.toString());
  1515. BigDecimal seq=BigDecimal.ZERO;
  1516. if (result!=null && result.get("INSPECTION_LOT")!=null ) {
  1517. seq=(BigDecimal)result.get("INSPECTION_LOT");
  1518. }
  1519. seq=seq.add(BigDecimal.ONE);
  1520. if(batchNo.contains("R")){
  1521. inspection_lot=batchNo+ String.format("%05d", seq.intValue());
  1522. }else if(batchNo.contains("L")){
  1523. inspection_lot=batchNo+ String.format("%03d", seq.intValue());
  1524. }else{
  1525. inspection_lot=batchNo+ String.format("%04d", seq.intValue());
  1526. }
  1527. return inspection_lot;
  1528. }
  1529. // 正常生成复样逻辑
  1530. private void cteateOtherQtly(HashMap result, StringBuffer sqlucomm) throws Exception {
  1531. // TODO Auto-generated method stub
  1532. Integer fynum = 0;// 委托数
  1533. String zlbz = "0";//螺纹钢 重量偏差 不复样
  1534. String bool="0";//是否是先金相后拉伸 金相4个委托 拉伸八个委托
  1535. // 查询试样号对应的合同信息
  1536. sqlucomm.setLength(0);
  1537. sqlucomm.append(
  1538. "SELECT DESIGN_KEY,PSC,SMP_TYPE_CODE,CERT_INST_CODE,BATCH_NO,STEEL_CODE,BATCH_NO FROM QCM_JHY_SAMPLE_R_ORD WHERE SMP_NO='"
  1539. + result.get("SMP_NO") + "'");
  1540. List<HashMap> resultsM = mapper.query(sqlucomm.toString());
  1541. if (resultsM == null || resultsM.size() < 1) {
  1542. return;
  1543. }
  1544. // 22.08.09 新增 生成委托 * 2倍 retest_qty
  1545. HashMap sampleMDK = resultsM.get(0);
  1546. sqlucomm.setLength(0);
  1547. sqlucomm.append("SELECT retest_qty as smp_count from QCM_ORD_DESIGN_STD_PIC_SMP where DESIGN_KEY='"
  1548. + sampleMDK.get("DESIGN_KEY") + "' and PSC='" + sampleMDK.get("PSC") + "'");
  1549. List<HashMap> smpCount = mapper.query(sqlucomm.toString());
  1550. if (smpCount != null && smpCount.size() > 0) {
  1551. if (smpCount.get(0).get("SMP_COUNT") != null) {
  1552. BigDecimal cou = (BigDecimal) smpCount.get(0).get("SMP_COUNT");
  1553. String coun = cou.toString();
  1554. Integer integ = Integer.parseInt(coun);
  1555. fynum = 2;//integ
  1556. // 螺纹钢
  1557. String steelCode = sampleMDK.get("STEEL_CODE").toString();
  1558. //判断是否是螺纹钢
  1559. String lugSteel="0";
  1560. if(result.get("PLINE_CODE").equals("BC2") || result.get("PLINE_CODE").equals("GX1") || result.get("PLINE_CODE").equals("GX2")){
  1561. String sqlSteel="select t.* from QCM_JHY_STEEL t where t.steel_name = '"+steelCode+"' and t.regulation = '1' and t.YN_LOG = '1' ";
  1562. List<HashMap> hmsteel=mapper.query(sqlSteel.toString());
  1563. if(hmsteel!=null && hmsteel.size()>=1){
  1564. lugSteel="1";
  1565. }
  1566. }
  1567. if ("HRB400".equals(sampleMDK.get("STEEL_CODE")) || "HRB400E".equals(sampleMDK.get("STEEL_CODE"))
  1568. || "HRB500E".equals(sampleMDK.get("STEEL_CODE")) || "HRB500".equals(sampleMDK.get("STEEL_CODE"))
  1569. || "HPB300".equals(sampleMDK.get("STEEL_CODE")) || steelCode.contains("GHRB400")
  1570. || steelCode.contains("GHRB500") || "TB400E".equals(sampleMDK.get("STEEL_CODE"))
  1571. || "TB400".equals(sampleMDK.get("STEEL_CODE")) || "HRB600E".equals(sampleMDK.get("STEEL_CODE"))
  1572. || "HRB600".equals(sampleMDK.get("STEEL_CODE")) || lugSteel.equals("1") ) {
  1573. zlbz = "1";
  1574. sqlucomm.setLength(0);
  1575. sqlucomm.append("SELECT count(1) CONUM from QCM_JHY_SAMPLE_CONSIGN_D where batch_no='"+ sampleMDK.get("BATCH_NO") + "' "
  1576. + " and smp_type_name = '初样' and status not in ('5','6') and INSPECTION_LOT = '"+result.get("INSPECTION_LOT")+"' " );
  1577. List<HashMap> smpCount2 = mapper.query(sqlucomm.toString());
  1578. if (smpCount2.get(0).get("CONUM") != null && !smpCount2.get(0).get("CONUM").equals("0") ) {
  1579. BigDecimal cou2 = (BigDecimal) smpCount2.get(0).get("CONUM");
  1580. String coun2 = cou2.toString();
  1581. Integer integ2 = Integer.parseInt(coun2);
  1582. fynum = integ2 * 2;
  1583. }
  1584. }
  1585. //高线 硬线 小于6个吊号 除初样 其它吊号全送
  1586. if (!"HRB400".equals(steelCode) && !"HRB400E".equals(steelCode)&&
  1587. !"HRB500".equals(steelCode) && !"HRB500E".equals(steelCode) &&
  1588. !"HPB300".equals(steelCode) && !"Q215".equals(steelCode) &&
  1589. !"Q235".equals(steelCode) && !steelCode.contains("GHRB400") &&
  1590. !steelCode.contains("GHRB500") && !"TB400E".equals(steelCode) && !"TB400".equals(steelCode)
  1591. && !"HRB600E".equals(steelCode) && !"HRB600".equals(steelCode)
  1592. && (result.get("PLINE_CODE").equals("GX2") ) ) {
  1593. fynum = 4;//硬线 2吊 翻倍4吊
  1594. String plineCode2 ="";
  1595. if (result.get("PLINE_CODE").equals("GX2")) {
  1596. plineCode2 = "4001GX2";
  1597. }
  1598. String batchNo =(String) result.get("BATCH_NO");
  1599. String sql = "";
  1600. //20240918 只要排除初样的子板号
  1601. sql = " select count(1) num from ("
  1602. + "select t.pline_code,t.MATERIAL_NO, t.NUMS from ( "
  1603. + " select productline pline_code, BILLETID as MATERIAL_NO,Substr(BILLETID, instr(BILLETID, '.') + 1, length(BILLETID)) NUMS from kch_turnofflist@xgcx where BILLETID like '"
  1604. + batchNo + "'||'%' union "
  1605. + " select productline pline_code, BILLETID as MATERIAL_NO,Substr(BILLETID, instr(BILLETID, '.') + 1, length(BILLETID)) NUMS from kcz_turnofflist@xgcx where BILLETID like '"
  1606. + batchNo + "'||'%' union "
  1607. + " select pld pline_code, BILLETID as MATERIAL_NO,Substr(BILLETID, instr(BILLETID, '.') + 1, length(BILLETID)) NUMS from kcx_turnofflist@xgcx where BILLETID like '"
  1608. + batchNo + "'||'%' " + " ) t "
  1609. + " where t.MATERIAL_NO not in (select d.material_no from QCM_JHY_SAMPLE_CONSIGN_D d where d.material_no like '"
  1610. + batchNo + "'||'%' and d.SMP_TYPE_CODE = '0' ) " + " and t.pline_code = '" + plineCode2 + "' "
  1611. +" ) ";
  1612. if (!StringUtils.isBlank(sql)) {
  1613. List<HashMap> listEle = mapper.query(sql.toString());
  1614. if (listEle != null && listEle.size() > 0) {
  1615. BigDecimal num = (BigDecimal) listEle.get(0).get("NUM");
  1616. String countnum = num.toString();
  1617. Integer num2 = Integer.parseInt(countnum);
  1618. if(num2 <= 3){//小于六吊 一共只有五吊
  1619. fynum = num2;
  1620. DSampleLogo2 = true;//件件取样
  1621. }
  1622. //如果是复样不合格 再复样 块块取样
  1623. if(DSampleLogo){
  1624. //件件取样 操作人员会一个一个选所以只要运行一次
  1625. //fynum = num2;
  1626. fynum = 1;
  1627. DSampleLogo2 = true;//件件取样
  1628. }
  1629. }
  1630. }
  1631. }else{
  1632. //如果是复样不合格 再复样 块块取样
  1633. if(DSampleLogo){
  1634. //如果是复样不合格 再复样 块块取样
  1635. //件件取样 操作人员会一个一个选所以只要运行一次
  1636. fynum = 1;
  1637. DSampleLogo2 = true;//件件取样
  1638. /* String batchNo =(String) result.get("BATCH_NO");
  1639. String sql = "";
  1640. sql = " select count(1) num from ("
  1641. + "select t.pline_code,t.MATERIAL_NO, t.NUMS from ( "
  1642. + " select productline pline_code, BILLETID as MATERIAL_NO,Substr(BILLETID, instr(BILLETID, '.') + 1, length(BILLETID)) NUMS from kch_turnofflist@xgcx where BILLETID like '"
  1643. + batchNo + "'||'%' union "
  1644. + " select productline pline_code, BILLETID as MATERIAL_NO,Substr(BILLETID, instr(BILLETID, '.') + 1, length(BILLETID)) NUMS from kcz_turnofflist@xgcx where BILLETID like '"
  1645. + batchNo + "'||'%' union "
  1646. + " select pld pline_code, BILLETID as MATERIAL_NO,Substr(BILLETID, instr(BILLETID, '.') + 1, length(BILLETID)) NUMS from kcx_turnofflist@xgcx where BILLETID like '"
  1647. + batchNo + "'||'%' " + " ) t "
  1648. + " where t.MATERIAL_NO not in (select d.material_no from QCM_JHY_SAMPLE_CONSIGN_D d where d.material_no like '"
  1649. + batchNo + "'||'%') "
  1650. +" ) ";
  1651. if (!StringUtils.isBlank(sql)) {
  1652. List<HashMap> listEle = mapper.query(sql.toString());
  1653. if (listEle != null && listEle.size() > 0) {
  1654. BigDecimal num = (BigDecimal) listEle.get(0).get("NUM");
  1655. String countnum = num.toString();
  1656. Integer num2 = Integer.parseInt(countnum);
  1657. //如果是复样不合格 再复样 块块取样
  1658. if(DSampleLogo){
  1659. fynum = num2;
  1660. DSampleLogo2 = true;//件件取样
  1661. }
  1662. }
  1663. }*/
  1664. }
  1665. }
  1666. //判断是否是 中厚板按母板取样
  1667. if(ZFMotherboard){
  1668. fynum = 1;
  1669. DSampleLogo2 = false;//件件取样
  1670. }
  1671. }
  1672. }
  1673. // 根据合同信息和项目找到复样倍数信息
  1674. HashMap sampleM = resultsM.get(0);
  1675. if ("HA".equals(((String) result.get("PHY_CODE_L"))) || "HC".equals(((String) result.get("PHY_CODE_L")))
  1676. || "HT".equals(((String) result.get("PHY_CODE_L"))) || "HE".equals(((String) result.get("PHY_CODE_L")))
  1677. || "HV".equals(((String) result.get("PHY_CODE_L"))) || "HD".equals(((String) result.get("PHY_CODE_L"))) ) {
  1678. // 拉伸试验HA或者冲击HC或者电磁HT或者金相HE
  1679. if(result.get("PLINE_CODE").equals("ZB1") || result.get("PLINE_CODE").equals("HB1")){
  1680. String phyCodemSql=" and PHY_CODE_M='"+ result.get("PHY_CODE_M") + "' ";
  1681. if("HA".equals(((String) result.get("PHY_CODE_L"))) && ("0".equals(((String) result.get("PHY_CODE_M"))) || "3".equals(((String) result.get("PHY_CODE_M"))) ) ){
  1682. phyCodemSql = " and PHY_CODE_M in ('0','3') ";
  1683. }else if("HC".equals(((String) result.get("PHY_CODE_L"))) && ("0".equals(((String) result.get("PHY_CODE_M"))) || "1".equals(((String) result.get("PHY_CODE_M"))) ) ){
  1684. phyCodemSql = " and PHY_CODE_M in ('0','1') ";
  1685. }
  1686. sqlucomm.setLength(0);
  1687. sqlucomm.append("SELECT * FROM QCM_ORD_DESIGN_SAMPLE_M WHERE DESIGN_KEY='" + sampleM.get("DESIGN_KEY") + "' "
  1688. + " and PSC='" + sampleM.get("PSC") + "' and SAMPLE_STYLE_CODE='" + sampleM.get("SMP_TYPE_CODE")+ "' "
  1689. + " and ORG_CODE='" + sampleM.get("CERT_INST_CODE") + "' " + " and RATE_CODE='"+ result.get("FREQ_CODE") + "' "
  1690. + " and PHY_CODE_L='" + result.get("PHY_CODE_L") + "' "
  1691. + phyCodemSql);
  1692. sqlucomm.append(" and SMP_POSITION_CODE='" + result.get("SMP_LOCATION_CODE") + "'");
  1693. }else{
  1694. sqlucomm.setLength(0);
  1695. sqlucomm.append("SELECT * FROM QCM_ORD_DESIGN_SAMPLE_M WHERE DESIGN_KEY='" + sampleM.get("DESIGN_KEY") + "'"
  1696. + " and PSC='" + sampleM.get("PSC") + "' and SAMPLE_STYLE_CODE='" + sampleM.get("SMP_TYPE_CODE")
  1697. + "' and ORG_CODE='" + sampleM.get("CERT_INST_CODE") + "' " + " and RATE_CODE='"
  1698. + result.get("FREQ_CODE") + "' and PHY_CODE_L='" + result.get("PHY_CODE_L") + "' and PHY_CODE_M='"
  1699. + result.get("PHY_CODE_M") + "'");
  1700. sqlucomm.append(" and SMP_POSITION_CODE='" + result.get("SMP_LOCATION_CODE") + "'");
  1701. }
  1702. // 材质检验项代码 金相 :(网状渗碳体E09、中心马氏体E12) 、( 微观组织E14、宏观金相E15)、( 脱碳层深度E05、边裂深度E08)20230524新质量委托判定系统委托需求申请  夏鹏  申报时间:2023-05-24 09:50:26 
  1703. if ("E09".equals(result.get("PHY_CODE_S")) || "E12".equals(result.get("PHY_CODE_S"))) {
  1704. sqlucomm.append(" and PHY_CODE_S in ('E09','E12') ");
  1705. } else if ("E14".equals(result.get("PHY_CODE_S")) || "E15".equals(result.get("PHY_CODE_S"))) {
  1706. sqlucomm.append(" and PHY_CODE_S in ('E14','E15') ");
  1707. } else if ("E05".equals(result.get("PHY_CODE_S")) || "E08".equals(result.get("PHY_CODE_S"))) {
  1708. sqlucomm.append(" and PHY_CODE_S in ('E05','E08') ");
  1709. } else if ("HE".equals(((String) result.get("PHY_CODE_L")))) {
  1710. sqlucomm.append(" and PHY_CODE_S = '" + result.get("PHY_CODE_S") + "' ");
  1711. }else if ("D01".equals(result.get("PHY_CODE_S")) || "D02".equals(result.get("PHY_CODE_S"))) {
  1712. sqlucomm.append(" and PHY_CODE_S in ('D01','D02') ");
  1713. }
  1714. //判断是否是件件取样 件件取样true !true 非件件取样
  1715. if(!DSampleLogo2 && !ZFMotherboard){
  1716. // 22.08.10 Z向拉伸 单倍样 那就 fynum / 2
  1717. if ("HA".equals(((String) result.get("PHY_CODE_L")))
  1718. && "Z向拉伸".equals(((String) result.get("PHY_NAME_M")))) {
  1719. fynum = fynum / 2;
  1720. }
  1721. // 22.08.10 冲击试验 单倍样 那就 fynum / 2
  1722. if ("HC".equals(((String) result.get("PHY_CODE_L")))) {
  1723. fynum = fynum / 2;
  1724. }
  1725. // 22.08.10 HF落锤试验 单倍样 那就 fynum / 2
  1726. if ("HF".equals(((String) result.get("PHY_CODE_L")))) {
  1727. fynum = fynum / 2;
  1728. }
  1729. // 22.08.10 电磁试验 单倍样 那就 fynum / 2 磁感T02 铁损T01
  1730. if ("HT".equals(((String) result.get("PHY_CODE_L")))) {
  1731. fynum = fynum / 2;
  1732. }
  1733. // 材质检验项代码 金相 :(网状渗碳体E09、中心马氏体E12) 、( 微观组织E14、宏观金相E15)
  1734. /* if ("E09".equals(result.get("PHY_CODE_S")) || "E12".equals(result.get("PHY_CODE_S"))) {
  1735. fynum = fynum / 2;
  1736. } else if ("E14".equals(result.get("PHY_CODE_S")) || "E15".equals(result.get("PHY_CODE_S"))) {
  1737. fynum = fynum / 2;
  1738. }*/
  1739. // 表面粗糙试验单倍样 20230811 L23039168-10 张立红
  1740. //改成双倍样,单份会卡到材质判定空,后续完成不了判定。
  1741. /* if ("HV".equals(((String) result.get("PHY_CODE_L")))) {
  1742. fynum = fynum / 2;
  1743. }*/
  1744. if (result.get("PLINE_CODE").equals("GX1") || result.get("PLINE_CODE").equals("BC2") ||result.get("PLINE_CODE").equals("GX2")) {
  1745. //金相 最多4条委托
  1746. if ("HE".equals(((String) result.get("PHY_CODE_L")))) {
  1747. fynum = 4;
  1748. }
  1749. }
  1750. }
  1751. } else if ("HJ".equals(((String) result.get("PHY_CODE_L")))) {
  1752. // 普通夹杂
  1753. sqlucomm.setLength(0);
  1754. sqlucomm.append("SELECT * FROM QCM_ORD_DESIGN_SAMPLE_M WHERE DESIGN_KEY='" + sampleM.get("DESIGN_KEY") + "'"
  1755. + " and PSC='" + sampleM.get("PSC") + "' and SAMPLE_STYLE_CODE='" + sampleM.get("SMP_TYPE_CODE")
  1756. + "' and ORG_CODE='" + sampleM.get("CERT_INST_CODE") + "' " + " and RATE_CODE='"
  1757. + result.get("FREQ_CODE") + "' and PHY_CODE_L='HJ' ");
  1758. sqlucomm.append(" and SMP_POSITION_CODE='" + result.get("SMP_LOCATION_CODE") + "'");
  1759. } else {
  1760. sqlucomm.setLength(0);
  1761. sqlucomm.append("SELECT * FROM QCM_ORD_DESIGN_SAMPLE_M WHERE DESIGN_KEY='" + sampleM.get("DESIGN_KEY") + "'"
  1762. + " and PSC='" + sampleM.get("PSC") + "' and SAMPLE_STYLE_CODE='" + sampleM.get("SMP_TYPE_CODE")
  1763. + "' and ORG_CODE='" + sampleM.get("CERT_INST_CODE") + "' " + "and PHY_CODE_L='"
  1764. + result.get("PHY_CODE_L") + "' and PHY_CODE_M='" + result.get("PHY_CODE_M") + "' "
  1765. + " and PHY_CODE_S='" + result.get("PHY_CODE_S") + "'");
  1766. if (result.get("ITEM_CODE_D") != null && !result.get("ITEM_CODE_D").toString().equals("null")) {
  1767. sqlucomm.append(" and ITEM_CODE_D='" + result.get("ITEM_CODE_D") + "'");
  1768. }
  1769. if (result.get("ITEM_CODE_T") != null && !result.get("ITEM_CODE_T").toString().equals("null")) {
  1770. sqlucomm.append(" and ITEM_CODE_T='" + result.get("ITEM_CODE_T") + "'");
  1771. }
  1772. if (result.get("ITEM_CODE_S") != null && !result.get("ITEM_CODE_S").toString().equals("null")) {
  1773. sqlucomm.append(" and ITEM_CODE_S='" + result.get("ITEM_CODE_S") + "'");
  1774. }
  1775. sqlucomm.append(" and SMP_POSITION_CODE='" + result.get("SMP_LOCATION_CODE") + "'");
  1776. //螺纹钢 重量偏差不复样 其它HZ 重量偏差 Z01
  1777. if(zlbz.equals("1") && "HZ".equals(((String) result.get("PHY_CODE_L"))) && "Z01".equals(((String) result.get("PHY_CODE_S")))){
  1778. sqlucomm.append(" and PHY_CODE_S <> 'Z01' ");
  1779. }
  1780. // 22.09.19 表面粗糙试验单倍 20230811注释
  1781. /*if ("HV".equals(((String) result.get("PHY_CODE_L"))) && result.get("PLINE_CODE").equals("LT1")) {
  1782. fynum = fynum / 2;
  1783. }*/
  1784. }
  1785. List<HashMap> qtlyResource = mapper.query(sqlucomm.toString());
  1786. int time = 1;
  1787. if (qtlyResource == null || qtlyResource.size() < 1) {
  1788. return;
  1789. }
  1790. for (int j = 0; j < qtlyResource.size(); j++) {
  1791. Integer heGold = 1;//金相数
  1792. HashMap resource = qtlyResource.get(j);
  1793. // 获取复样数量 复样数量都是技术中心维护的 他们维护多少是多少 如果错了找金恒找技术中心
  1794. if (null != resource.get("RETEST_QTY")) {
  1795. time = 1;
  1796. }
  1797. // 查询当前频率是否存在已经存在的取样要求信息 取样频率和取样位置代码
  1798. //件件取样 && result.get("PLINE_CODE").equals("GX2")
  1799. if(DSampleLogo2){
  1800. sqlucomm.setLength(0);
  1801. sqlucomm.append("SELECT SPECIMEN_NO FROM QCM_JHY_SAMPLE_CONSIGN_D WHERE SMP_NO='" + result.get("SMP_NO")
  1802. + "' " + " AND SMP_TYPE_CODE='3' AND FREQ_CODE='" + result.get("FREQ_CODE")
  1803. + "' and STATUS='0' and SMP_LOCATION_CODE='" + result.get("SMP_LOCATION_CODE") + "' " );
  1804. }else if (ZFMotherboard){//中厚板按母板取样
  1805. sqlucomm.setLength(0);
  1806. sqlucomm.append("SELECT max(SPECIMEN_NO) SPECIMEN_NO FROM QCM_JHY_SAMPLE_CONSIGN_D WHERE SMP_NO='" + result.get("SMP_NO")
  1807. + "' " + " AND SMP_TYPE_CODE='4' AND FREQ_CODE='" + result.get("FREQ_CODE")
  1808. + "' and STATUS='0' and SMP_LOCATION_CODE='" + result.get("SMP_LOCATION_CODE") + "' order by create_time desc");
  1809. }else{
  1810. //正常复样
  1811. // 查询当前频率是否存在已经存在的取样要求信息 取样频率和取样位置代码
  1812. //线棒自动复样做限制
  1813. sqlucomm.setLength(0);
  1814. if(result.get("PLINE_CODE").equals("GX1") || result.get("PLINE_CODE").equals("GX2") || result.get("PLINE_CODE").equals("BC2") ){
  1815. sqlucomm.append("SELECT SPECIMEN_NO FROM QCM_JHY_SAMPLE_CONSIGN_D WHERE SMP_NO='" + result.get("SMP_NO")
  1816. + "' " + " AND SMP_TYPE_CODE='1' AND FREQ_CODE='" + result.get("FREQ_CODE")
  1817. + "' and STATUS='0' and SMP_LOCATION_CODE='" + result.get("SMP_LOCATION_CODE") + "'");
  1818. List<HashMap> ggb = mapper.query(sqlucomm.toString());
  1819. if(ggb==null || ggb.size()<=0){
  1820. sqlucomm.setLength(0);
  1821. sqlucomm.append("SELECT SPECIMEN_NO FROM QCM_JHY_SAMPLE_CONSIGN_D WHERE BATCH_NO='" + result.get("BATCH_NO")
  1822. + "' " + " AND SMP_TYPE_CODE='1' AND FREQ_CODE='" + result.get("FREQ_CODE")
  1823. + "' and STATUS='0' and SMP_LOCATION_CODE='" + result.get("SMP_LOCATION_CODE") + "'");
  1824. }
  1825. }else{
  1826. sqlucomm.append("SELECT SPECIMEN_NO FROM QCM_JHY_SAMPLE_CONSIGN_D WHERE SMP_NO='" + result.get("SMP_NO")
  1827. + "' " + " AND SMP_TYPE_CODE='1' AND FREQ_CODE='" + result.get("FREQ_CODE")
  1828. + "' and STATUS='0' and SMP_LOCATION_CODE='" + result.get("SMP_LOCATION_CODE") + "'");
  1829. }
  1830. }
  1831. List<HashMap> resultsD = mapper.query(sqlucomm.toString());
  1832. String specimen_no = "";
  1833. if(bool.equals("1")){//先金相后拉伸
  1834. fynum = resultsD.size();//先金相了 最后循环拉伸时 所有的委托都得有拉伸
  1835. }
  1836. //(resultsD == null || resultsD.size() < 1) || ( resultsD.size() >= 1 && resultsD.size() < fynum)
  1837. //resultsD == null || resultsD.size() < 1
  1838. if ((resultsD == null || resultsD.size() < 1) || ( resultsD.size() >= 1 && resultsD.size() < fynum) || motherboard) {
  1839. if(ZFMotherboard){
  1840. motherboard = false;
  1841. }
  1842. //判断是 先金相后拉伸 先金相只生成4吊 后拉伸要生成8吊 缧纹钢 中厚板按母板不算 线棒
  1843. if((resultsD.size() >= 1 && resultsD.size() < fynum) && motherboard){//这里注意一下
  1844. fynum = fynum - resultsD.size();
  1845. bool="1";
  1846. }else if(resultsD.size() >= 1 && resultsD.size() < fynum &&
  1847. (result.get("PLINE_CODE").equals("ZB1") || result.get("PLINE_CODE").equals("HB1") ||
  1848. result.get("PLINE_CODE").equals("RZ1") || result.get("PLINE_CODE").equals("LT1") || result.get("PLINE_CODE").equals("YT1") )){
  1849. fynum = fynum - resultsD.size();
  1850. bool="1";
  1851. }
  1852. // 22.08.09 新增 for
  1853. for (int ii = 0; ii < fynum; ii++) {
  1854. // 生成新的复样的取样编号
  1855. specimen_no = createSpecimen_no((String) result.get("SMP_NO"));
  1856. JhySampleDModel model = getSampleD(specimen_no, result);
  1857. model.setSmp_no((String) result.get("SMP_NO"));
  1858. mapper.insertSampleD(model);
  1859. //System.out.println(ii+"=======");
  1860. // 生成复样的项目信息
  1861. for (int i = 0; i < time; i++) {
  1862. JhySampleDItemModel item = getSampleItem((String) result.get("SMP_NO"), specimen_no, resource,
  1863. i + 1);
  1864. //判断金相 最多4条委托中有金相
  1865. if ("HE".equals(((String) result.get("PHY_CODE_L"))) && (heGold > 4 || heGold2 > 8) && motherboard) {
  1866. continue;
  1867. }
  1868. //判断连退 常温拉伸 峰值密度 小项目单倍样
  1869. if ("A08".equals(item.getPhy_code_s()) && result.get("PLINE_CODE").equals("LT1") && LT1A08 != 1 && motherboard) {
  1870. continue;
  1871. }
  1872. mapper.insertSampleItem(item);
  1873. if ("HE".equals(((String) result.get("PHY_CODE_L"))) && motherboard) {
  1874. heGold++;//当前for的金相数
  1875. heGold2++;//金相总数
  1876. }
  1877. if ("A08".equals(item.getPhy_code_s()) && result.get("PLINE_CODE").equals("LT1") && motherboard) {
  1878. LT1A08++;
  1879. }
  1880. }
  1881. }
  1882. //判断是 先金相后拉伸 先金相只生成4吊 后拉伸要生成8吊 缧纹钢
  1883. if(bool.equals("0")){
  1884. continue;
  1885. }
  1886. //continue;
  1887. }
  1888. // 22.08.09 新增 if for
  1889. if (resultsD != null || resultsD.size() > 0) {
  1890. for (int ij = 0; ij < fynum; ij++) {
  1891. // 判断是否已经存在该项目,避免复样在取复样情况
  1892. // 22.08.09
  1893. // specimen_no=(String)resultsD.get(0).get("SPECIMEN_NO");修改成
  1894. // specimen_no=(String)resultsD.get(ij).get("SPECIMEN_NO");
  1895. specimen_no = (String) resultsD.get(ij).get("SPECIMEN_NO");
  1896. sqlucomm.setLength(0);
  1897. sqlucomm.append("SELECT * FROM QCM_JHY_SAMPLE_CONSIGN_D_ITEM WHERE SPECIMEN_NO='" + specimen_no
  1898. + "'" + " and SMP_NO='" + result.get("SMP_NO") + "' " + "and PHY_CODE_L='"
  1899. + resource.get("PHY_CODE_L") + "' and PHY_CODE_M='" + resource.get("PHY_CODE_M") + "'"
  1900. + " and PHY_CODE_S='" + resource.get("PHY_CODE_S") + "'");
  1901. if (result.get("ITEM_CODE_D") != null) {
  1902. sqlucomm.append(" and ITEM_CODE_D='" + resource.get("ITEM_CODE_D") + "'");
  1903. }
  1904. if (result.get("ITEM_CODE_T") != null) {
  1905. sqlucomm.append(" and ITEM_CODE_T='" + resource.get("ITEM_CODE_T") + "'");
  1906. }
  1907. if (result.get("ITEM_CODE_S") != null) {
  1908. sqlucomm.append(" and ITEM_CODE_S='" + resource.get("ITEM_CODE_S") + "'");
  1909. }
  1910. List<HashMap> resultsI = mapper.query(sqlucomm.toString());
  1911. if (resultsI == null || resultsI.size() < 1) {
  1912. for (int i = 0; i < time; i++) {
  1913. JhySampleDItemModel item = getSampleItem((String) result.get("SMP_NO"), specimen_no,
  1914. resource, i + 1);
  1915. //判断金相 最多4条委托中有金相 20231102 E2306760出了问题heGold2大于8了四个项目边裂深度、脱碳层深度体 网状渗碳体、中心马氏体需要复样,先注释掉
  1916. /* if ("HE".equals(((String) result.get("PHY_CODE_L"))) && (heGold > 4 || heGold2 > 8)) {
  1917. continue;
  1918. }*/
  1919. //判断连退 常温拉伸 峰值密度 小项目单倍样
  1920. if ("A08".equals(item.getPhy_code_s()) && result.get("PLINE_CODE").equals("LT1") && LT1A08 != 1) {
  1921. continue;
  1922. }
  1923. mapper.insertSampleItem(item);
  1924. if ("HE".equals(((String) result.get("PHY_CODE_L")))) {
  1925. heGold++;
  1926. heGold2++;
  1927. }
  1928. if ("A08".equals(item.getPhy_code_s()) && result.get("PLINE_CODE").equals("LT1")) {
  1929. LT1A08++;
  1930. }
  1931. }
  1932. }
  1933. }
  1934. }
  1935. }
  1936. }
  1937. /**
  1938. * 夹杂内控单独处理
  1939. *
  1940. * @param results
  1941. * @param jzResource
  1942. * @param old_spefcial_no
  1943. * @param list
  1944. * @param sampleMJz
  1945. * @throws Exception
  1946. * 1:得到判定不合格的项目 2:根据合同信息和项目找到复样倍数信息 3:引用取样编号
  1947. * 4:传过来的值复样(判定)5:试样号与合同信息关系表数据
  1948. */
  1949. private void createJznkSample(List<HashMap> results, List<HashMap> jzResource, String old_spefcial_no,
  1950. JSONObject list, HashMap sampleMJz) throws Exception {
  1951. // TODO Auto-generated method stub
  1952. StringBuffer sqlucomm = new StringBuffer();
  1953. // 夹杂内控是否已经生成过
  1954. boolean isJaze = false;
  1955. if (old_spefcial_no != null) {// 是否有引用编号 是
  1956. // 初样的轧批
  1957. // 判断该初样是否已经生成了复样
  1958. // SMP_TYPE_CODE:1复样
  1959. sqlucomm.setLength(0);
  1960. sqlucomm.append("SELECT * FROM QCM_JHY_SAMPLE_CONSIGN_D where (SPECIMEN_NO='" + old_spefcial_no + "' "
  1961. + "or QUOTE_CONSIGN_NO='" + old_spefcial_no + "' ) and SMP_TYPE_CODE='1'");
  1962. List<HashMap> olds = mapper.query(sqlucomm.toString());
  1963. if (olds != null && olds.size() > 0) {// 是否已经生成复样 已生成复样
  1964. // 判断原试样号是否已经生成复样的的信息
  1965. sqlucomm.setLength(0);
  1966. sqlucomm.append("SELECT * FROM QCM_JHY_SAMPLE_CONSIGN_D where SMP_NO='" + results.get(0).get("SMP_NO")
  1967. + "' " + " and SMP_TYPE_CODE='1'");
  1968. List<HashMap> olds2 = mapper.query(sqlucomm.toString());
  1969. if (olds2 != null && olds2.size() > 0) {
  1970. return;
  1971. }
  1972. // 直接引用 SPECL_FL:0交付标准 1特殊要求 2内控标准
  1973. Boolean isCreate = false;
  1974. for (HashMap result : results) {
  1975. if ("2".equals(result.get("SPECL_FL")) && isCreate) {
  1976. continue;
  1977. } else if ("2".equals(result.get("SPECL_FL")) && !isCreate) {
  1978. // 查询原引用取样编号向下夹杂内控的按炉取样的复样引用取样编号为空的数据DESIGN_KEY,PSC,SMP_TYPE_CODE,CERT_INST_CODE
  1979. // SMP_LOCATION_CODE取样位置代码 SMP_TYPE_CODE样品类型代码0初样1复样
  1980. // 认证机构代码CERT_INST_CODE
  1981. sqlucomm.setLength(0);
  1982. sqlucomm.append(
  1983. "SELECT d.* FROM QCM_JHY_SAMPLE_CONSIGN_D d inner join QCM_JHY_SAMPLE_R_ORD o on o.SMP_NO=d.SMP_NO"
  1984. + " and (d.QUOTE_CONSIGN_NO is null or d.QUOTE_CONSIGN_NO='') and d.SMP_TYPE_CODE='1' "
  1985. + " and d.SMP_LOCATION_CODE='" + result.get("SMP_LOCATION_CODE") + "' and "
  1986. + " d.FREQ_CODE='D' and o.DESIGN_KEY ='" + sampleMJz.get("DESIGN_KEY")
  1987. + "' and o.PSC='" + sampleMJz.get("PSC") + "' AND o.SMP_TYPE_CODE='"
  1988. + sampleMJz.get("SMP_TYPE_CODE") + "' and o.CERT_INST_CODE='"
  1989. + sampleMJz.get("CERT_INST_CODE") + "'");
  1990. // 需要被引用的取样编号
  1991. List<HashMap> oldSpecils = mapper.query(sqlucomm.toString());
  1992. for (HashMap oldSpecil : oldSpecils) {
  1993. // 根据引用的取样编号查询对应的项目值填写引用取样编号和SEQ
  1994. sqlucomm.setLength(0);
  1995. sqlucomm.append("select * from QCM_JHY_SAMPLE_CONSIGN_D_ITEM where SPECIMEN_NO='"
  1996. + oldSpecil.get("SPECIMEN_NO") + "' and " + " SMP_NO='" + oldSpecil.get("SMP_NO")
  1997. + "' order by SEQ ASC");
  1998. List<HashMap> quoteItems = mapper.query(sqlucomm.toString());
  1999. int count = 1;
  2000. String specimen_no = null;
  2001. // 生成新的复信息
  2002. for (HashMap resource : jzResource) {
  2003. if (count == 1) {
  2004. // 创建取样编号
  2005. specimen_no = createSpecimen_no((String) result.get("SMP_NO"));
  2006. JhySampleDModel model = getSampleD(specimen_no, result);
  2007. model.setSmp_no((String) result.get("SMP_NO"));
  2008. model.setQuote_consign_no((String) oldSpecil.get("SPECIMEN_NO"));
  2009. model.setOld_consign_no((String) result.get("SPECIMEN_NO"));
  2010. mapper.insertSampleD(model);
  2011. }
  2012. String resourceKey = resource.get("PHY_CODE_L") + "-" + resource.get("PHY_CODE_M") + "-"
  2013. + resource.get("PHY_CODE_S");
  2014. if (resource.get("ITEM_CODE_D") != null) {
  2015. resourceKey = resourceKey + "-" + resource.get("ITEM_CODE_D");
  2016. } else {
  2017. resourceKey = resourceKey + "-null";
  2018. }
  2019. if (resource.get("ITEM_CODE_T") != null) {
  2020. resourceKey = resourceKey + "-" + resource.get("ITEM_CODE_T");
  2021. } else {
  2022. resourceKey = resourceKey + "-null";
  2023. }
  2024. if (resource.get("ITEM_CODE_S") != null) {
  2025. resourceKey = resourceKey + "-" + resource.get("ITEM_CODE_S");
  2026. } else {
  2027. resourceKey = resourceKey + "-null";
  2028. }
  2029. int i = 0;
  2030. for (HashMap items : quoteItems) {
  2031. String itemKey = items.get("PHY_CODE_L") + "-" + items.get("PHY_CODE_M") + "-"
  2032. + items.get("PHY_CODE_S");
  2033. if (items.get("ITEM_CODE_D") != null) {
  2034. itemKey = itemKey + "-" + items.get("ITEM_CODE_D");
  2035. } else {
  2036. itemKey = itemKey + "-null";
  2037. }
  2038. if (items.get("ITEM_CODE_T") != null) {
  2039. itemKey = itemKey + "-" + items.get("ITEM_CODE_T");
  2040. } else {
  2041. itemKey = itemKey + "-null";
  2042. }
  2043. if (items.get("ITEM_CODE_S") != null) {
  2044. itemKey = itemKey + "-" + items.get("ITEM_CODE_S");
  2045. } else {
  2046. itemKey = itemKey + "-null";
  2047. }
  2048. if (resourceKey.equals(itemKey)) {
  2049. JhySampleDItemModel item = getSampleItem((String) result.get("SMP_NO"),
  2050. specimen_no, resource, i++);
  2051. item.setQuote_specimen_no((String) items.get("SPECIMEN_NO"));
  2052. item.setQuote_seq((Integer) items.get("SEQ"));
  2053. mapper.insertSampleItem(item);
  2054. }
  2055. }
  2056. }
  2057. }
  2058. continue;
  2059. }
  2060. // 获取引用了按炉取样的试样号,生成其他不合格项目的复样信息
  2061. cteateOtherQtly(result, sqlucomm);
  2062. }
  2063. } else {// 判断是否已生成复样 未生成复样
  2064. // 创建整套内控包括引用的 查到这个试样号的判断不合格的项目
  2065. sqlucomm.setLength(0);
  2066. sqlucomm.append(
  2067. "select r.*,d.FREQ_CODE,d.freq_name,d.test_qty,d.smp_qty,d.board_no,d.smp_location,d.pline_code,d.pline_name,d.product_cnt,d.smp_location_code "
  2068. + " from QCM_JUDGE_PHYSICAL_RESULT r left join QCM_JHY_SAMPLE_CONSIGN_D d on r.smp_no=d.smp_no and r.specimen_no=d.specimen_no "
  2069. + " where r.smp_no='" + old_spefcial_no + "' and r.IS_PASS='1'");
  2070. List<HashMap> results2 = mapper.query(sqlucomm.toString());
  2071. for (HashMap result : results2) {
  2072. // 如果有项目 并且是夹杂按炉引用
  2073. if ("HJ".equals(result.get("PHY_CODE_L")) && "D".equals(result.get("FREQ_CODE"))) {
  2074. createQtlyJznk(result, list, sampleMJz);
  2075. break;
  2076. }
  2077. }
  2078. // 获取引用了按炉取样的试样号,生成其他不合格项目的复样信息
  2079. sqlucomm.setLength(0);
  2080. sqlucomm.append("SELECT DISTINCT SMP_NO FROM QCM_JHY_SAMPLE_CONSIGN_D where " + "(SPECIMEN_NO='"
  2081. + results.get(0).get("SPECIMEN_NO") + "' or QUOTE_CONSIGN_NO='" + old_spefcial_no + "')");
  2082. List<HashMap> quoteSpec = mapper.query(sqlucomm.toString());
  2083. for (HashMap quote : quoteSpec) {
  2084. sqlucomm.setLength(0);
  2085. // 查询试样号向下的检验结果,去除按炉取样夹杂的
  2086. sqlucomm.append(
  2087. "select r.*,d.FREQ_CODE,d.freq_name,d.test_qty,d.smp_qty,d.board_no,d.smp_location,d.pline_code,d.pline_name,d.product_cnt,d.smp_location_code "
  2088. + " from QCM_JUDGE_PHYSICAL_RESULT r left join QCM_JHY_SAMPLE_CONSIGN_D d on r.smp_no=d.smp_no and r.specimen_no=d.specimen_no "
  2089. + " where r.smp_no='" + list.getString("QLTY_SMP_NO")
  2090. + "' and r.IS_PASS='1' and d.FREQ_CODE='D' and r.PHY_CODE_L='HJ'");
  2091. List<HashMap> resultQuotes = mapper.query(sqlucomm.toString());
  2092. if (resultQuotes == null || resultQuotes.size() < 1) {
  2093. continue;
  2094. }
  2095. for (HashMap result1 : resultQuotes) {
  2096. cteateOtherQtly(result1, sqlucomm);
  2097. }
  2098. }
  2099. }
  2100. } else {// 是否有引用编号 否
  2101. // 在检验委托明细表中 查询出当前试样号为复样的数据
  2102. sqlucomm.setLength(0);
  2103. sqlucomm.append("SELECT * FROM QCM_JHY_SAMPLE_CONSIGN_D where SMP_NO='" + results.get(0).get("SMP_NO")
  2104. + "' " + " and SMP_TYPE_CODE='1'");
  2105. List<HashMap> olds = mapper.query(sqlucomm.toString());
  2106. if (olds != null && olds.size() > 0) {
  2107. return;
  2108. }
  2109. // 创建整套内控包括引用的
  2110. for (HashMap result : results) {
  2111. if ("2".equals(result.get("SPECL_FL"))) {
  2112. // 内控
  2113. createQtlyJznk(result, list, sampleMJz);
  2114. break;
  2115. }
  2116. }
  2117. // 获取引用了按炉取样的试样号,生成其他不合格项目的复样信息
  2118. sqlucomm.setLength(0);
  2119. sqlucomm.append("SELECT DISTINCT SMP_NO FROM QCM_JHY_SAMPLE_CONSIGN_D where " + "(SPECIMEN_NO='"
  2120. + results.get(0).get("SPECIMEN_NO") + "' or QUOTE_CONSIGN_NO='" + results.get(0).get("SPECIMEN_NO")
  2121. + "')");
  2122. List<HashMap> quoteSpec = mapper.query(sqlucomm.toString());
  2123. for (HashMap quote : quoteSpec) {
  2124. sqlucomm.setLength(0);
  2125. // 查询试样号向下的检验结果,去除按炉取样夹杂的 判定不合格 按炉 夹杂
  2126. sqlucomm.append(
  2127. "select r.*,d.FREQ_CODE,d.freq_name,d.test_qty,d.smp_qty,d.board_no,d.smp_location,d.pline_code,d.pline_name,d.product_cnt,d.smp_location_code "
  2128. + " from QCM_JUDGE_PHYSICAL_RESULT r left join QCM_JHY_SAMPLE_CONSIGN_D d on r.smp_no=d.smp_no and r.specimen_no=d.specimen_no "
  2129. + " where r.smp_no='" + list.getString("QLTY_SMP_NO")
  2130. + "' and r.IS_PASS='1' and d.FREQ_CODE='D' and r.PHY_CODE_L='HJ'");
  2131. List<HashMap> resultQuotes = mapper.query(sqlucomm.toString());
  2132. if (resultQuotes == null || resultQuotes.size() < 1) {
  2133. continue;
  2134. }
  2135. for (HashMap result1 : resultQuotes) {
  2136. cteateOtherQtly(result1, sqlucomm);
  2137. }
  2138. }
  2139. }
  2140. }
  2141. /**
  2142. * 创建夹杂按炉取样内控的复样委托
  2143. * 内控按冶炼炉号做的夹杂物:如初样不合格,复样双倍样,但是复样是在该冶炼炉号中另取两个轧批号各做一个样。但是初样不合格的这个批号按初样结果进行判定,
  2144. * 该炉号其余轧批按复样结果进行判定。
  2145. *
  2146. * @param result
  2147. * @param list
  2148. * @param sampleM
  2149. * @throws Exception
  2150. */
  2151. private void createQtlyJznk(HashMap result, JSONObject list, HashMap sampleM) throws Exception {
  2152. // TODO Auto-generated method stub
  2153. StringBuffer sqlucomm = new StringBuffer();
  2154. // 查询内控对应的按炉取样的试样号
  2155. sqlucomm.setLength(0);
  2156. sqlucomm.append("select * from QCM_JHY_SAMPLE_R_ORD t where t.design_key='" + list.get("DESIGN_KEY")
  2157. + "' and t.psc='" + list.get("PSC") + "' " + " and t.cert_inst_code='" + sampleM.get("CERT_INST_CODE")
  2158. + "' and t.smp_type_code='" + sampleM.get("SMP_TYPE_CODE") + "' " + " and t.heat_no='"
  2159. + list.get("HEAT_NO") + "'");
  2160. List<QcmJhySampleROrd> ords = mapper.queryQcmJhySampleROrd1(sqlucomm.toString());
  2161. if (ords == null || ords.size() < 1) {
  2162. return;
  2163. }
  2164. TreeSet<String> sets = new TreeSet<String>();
  2165. for (QcmJhySampleROrd ord : ords) {
  2166. sets.add(ord.getBatch_no());
  2167. }
  2168. // 查询检验委托主表 是否有夹杂 内控的数据
  2169. // 22.08.06 取样频率代码 and RATE_CODE='"+sampleM.get("FREQ_CODE")+"'修改成
  2170. // and RATE_CODE='"+result.get("FREQ_CODE")+"'
  2171. sqlucomm.setLength(0);
  2172. sqlucomm.append("SELECT * FROM QCM_ORD_DESIGN_SAMPLE_M WHERE DESIGN_KEY='" + list.get("DESIGN_KEY") + "'"
  2173. + " and PSC='" + list.get("PSC") + "' and SAMPLE_STYLE_CODE='" + sampleM.get("SMP_TYPE_CODE")
  2174. + "' and ORG_CODE='" + sampleM.get("CERT_INST_CODE") + "' " + "and RATE_CODE='"
  2175. + result.get("FREQ_CODE") + "' and PHY_CODE_L='HJ' AND SPECL_FL='2' ");
  2176. List<HashMap> qtlyResource = mapper.query(sqlucomm.toString());
  2177. if (qtlyResource == null || qtlyResource.size() < 1) {
  2178. return;
  2179. }
  2180. // 被引用的目标取样编号项目集合
  2181. List<JhySampleDModel> tarSmpD = new ArrayList<JhySampleDModel>();
  2182. if (sets.size() == 1) {
  2183. // 只有当前轧批的情况下,如果只有当前一个批,在当前样生成一个取样编号,夹杂内控双倍样
  2184. // 查询当前订单下所有按炉取样的夹杂内控项目
  2185. // 生成试样号、生成项目//双倍样
  2186. String specimen_no = createSpecimen_no((String) result.get("SMP_NO"));
  2187. JhySampleDModel model = getSampleD(specimen_no, result);
  2188. model.setSmp_no((String) result.get("SMP_NO"));
  2189. mapper.insertSampleD(model);
  2190. model.setItems(new ArrayList<JhySampleDItemModel>());
  2191. // 生成复样的项目信息
  2192. int jj = 0;
  2193. for (int i = 0; i < 1; i++) {
  2194. for (int j = 0; j < qtlyResource.size(); j++) {
  2195. HashMap resource = qtlyResource.get(j);
  2196. JhySampleDItemModel item = getSampleItem((String) result.get("SMP_NO"), specimen_no, resource,
  2197. ++jj);
  2198. System.out.println(specimen_no + "===" + jj);
  2199. mapper.insertSampleItem(item);
  2200. item.setQuote_specimen_no(item.getSpecimen_no());
  2201. item.setQuote_seq(item.getSeq());
  2202. model.getItems().add(item);
  2203. }
  2204. }
  2205. tarSmpD.add(model);
  2206. // 处理引用的编号
  2207. sqlucomm.setLength(0);
  2208. sqlucomm.append("SELECT SMP_NO,SPECIMEN_NO,BATCH_NO FROM QCM_JHY_SAMPLE_CONSIGN_D where " + "(SPECIMEN_NO='"
  2209. + result.get("SPECIMEN_NO") + "' or QUOTE_CONSIGN_NO='" + result.get("SPECIMEN_NO") + "' )");
  2210. List<HashMap> quoteSpec = mapper.query(sqlucomm.toString());
  2211. for (HashMap quote : quoteSpec) {
  2212. if (((String) result.get("SMP_NO")).equals(quote.get("SMP_NO"))) {
  2213. continue;
  2214. }
  2215. for (JhySampleDModel tar : tarSmpD) {
  2216. String specimenNoQuote = createSpecimen_no((String) quote.get("SMP_NO"));
  2217. tar.setSmp_no((String) quote.get("SMP_NO"));
  2218. tar.setSpecimen_no(specimenNoQuote);
  2219. tar.setQuote_consign_no(specimen_no);
  2220. tar.setOld_consign_no((String) quote.get("SPECIMEN_NO"));
  2221. mapper.insertSampleD(tar);
  2222. List<JhySampleDItemModel> ranItem = tar.getItems();
  2223. for (JhySampleDItemModel jhySampleDItemModel : ranItem) {
  2224. jhySampleDItemModel.setSmp_no((String) quote.get("SMP_NO"));
  2225. jhySampleDItemModel.setSpecimen_no(specimenNoQuote);
  2226. // Integer seq = selSeq(specimenNoQuote);
  2227. // jhySampleDItemModel.setSeq(seq);
  2228. mapper.insertSampleItem(jhySampleDItemModel);
  2229. }
  2230. }
  2231. }
  2232. } else if (sets.size() == 2) {
  2233. // 如果有另外一个批,在另外一个批生成一个取样编号,夹杂内控双倍样
  2234. // 用后面的轧批生成
  2235. String smp_no = null;
  2236. sets.remove(((String) result.get("BATCH_NO")));// 移处当前轧批号 也就是第一个
  2237. for (QcmJhySampleROrd ord : ords) {
  2238. if (ord.getBatch_no().equals(sets.first())) {
  2239. smp_no = ord.getSmp_no();
  2240. break;
  2241. }
  2242. }
  2243. // 生成试样号、生成项目//双倍样
  2244. String specimen_no = createSpecimen_no(smp_no);
  2245. System.out.println("第一个试样号=====" + smp_no);
  2246. // 22.08.07 以第二轧批号的试样号生成取样编号 那插入的试样号也是第二轧批号的试样号
  2247. // 把 result 中的试样号修改成 第二次轧批号的试样号
  2248. result.put("SMP_NO", smp_no);
  2249. JhySampleDModel model = getSampleD(specimen_no, result);
  2250. model.setSmp_no(smp_no);
  2251. mapper.insertSampleD(model);
  2252. model.setItems(new ArrayList<JhySampleDItemModel>());
  2253. // 生成复样的项目信息
  2254. int jj = 0;
  2255. for (int i = 0; i < 1; i++) {
  2256. for (int j = 0; j < qtlyResource.size(); j++) {
  2257. HashMap resource = qtlyResource.get(j);
  2258. JhySampleDItemModel item = getSampleItem(smp_no, specimen_no, resource, ++jj);
  2259. mapper.insertSampleItem(item);
  2260. item.setQuote_specimen_no(item.getSpecimen_no());
  2261. item.setQuote_seq(item.getSeq());
  2262. model.getItems().add(item);
  2263. System.out.println(item.getSpecimen_no() + "===" + jj);
  2264. }
  2265. }
  2266. tarSmpD.add(model);
  2267. // 处理引用的编号
  2268. sqlucomm.setLength(0);
  2269. sqlucomm.append("SELECT SMP_NO,SPECIMEN_NO,BATCH_NO FROM QCM_JHY_SAMPLE_CONSIGN_D where " + "(SPECIMEN_NO='"
  2270. + result.get("SPECIMEN_NO") + "' or QUOTE_CONSIGN_NO='" + result.get("SPECIMEN_NO")
  2271. + "' and BATCH_NO <> '" + result.get("BATCH_NO") + "')");
  2272. List<HashMap> quoteSpec = mapper.query(sqlucomm.toString());
  2273. for (HashMap quote : quoteSpec) {
  2274. if ((model.getSmp_no()).equals(quote.get("SMP_NO"))) {
  2275. continue;
  2276. }
  2277. System.out.println("对比两个试样号=====" + model.getSmp_no() + "+<>+" + (String) quote.get("SMP_NO"));
  2278. for (JhySampleDModel tar : tarSmpD) {
  2279. String specimenNoQuote = createSpecimen_no((String) quote.get("SMP_NO"));
  2280. System.out.println("第二个试样号=====" + (String) quote.get("SMP_NO"));
  2281. tar.setSmp_no((String) quote.get("SMP_NO"));
  2282. tar.setSpecimen_no(specimenNoQuote);
  2283. tar.setQuote_consign_no(specimen_no);
  2284. tar.setOld_consign_no((String) quote.get("SPECIMEN_NO"));
  2285. mapper.insertSampleD(tar);
  2286. List<JhySampleDItemModel> ranItem = tar.getItems();
  2287. for (JhySampleDItemModel jhySampleDItemModel : ranItem) {
  2288. jhySampleDItemModel.setSmp_no((String) quote.get("SMP_NO"));
  2289. jhySampleDItemModel.setSpecimen_no(specimenNoQuote);
  2290. System.out.println(specimenNoQuote + "===" + jhySampleDItemModel.getSeq());
  2291. mapper.insertSampleItem(jhySampleDItemModel);
  2292. }
  2293. }
  2294. }
  2295. } else {
  2296. // 如果有另外两个批次,在另外两个各生成一个取样编号,夹杂内控各一套
  2297. sets.remove(((String) result.get("BATCH_NO")));
  2298. int i = 0;
  2299. String batchNo = "";// 第二个轧批号
  2300. List<JhySampleDModel> tarSmpDRan = new ArrayList<JhySampleDModel>();
  2301. String smp_01 = null;
  2302. String smp_02 = null;
  2303. for (String set : sets) {
  2304. // 用两个生成单倍样
  2305. if (i == 2) {
  2306. break;// 取了第二个轧批号就结束
  2307. }
  2308. // 用后面的轧批生成
  2309. String smp_no = null;
  2310. sets.remove(((String) result.get("BATCH_NO")));// 移处 第一个轧批号
  2311. // sets中还有两个轧批号
  2312. // 22.08.07 新加 移处第二个轧批号
  2313. /*
  2314. * if (i==1) { sets.remove(batchNo);//移处 第二个轧批号 sets中还有一个轧批号 }
  2315. */
  2316. for (QcmJhySampleROrd ord : ords) {
  2317. if (ord.getBatch_no().equals(set)) {
  2318. smp_no = ord.getSmp_no();
  2319. batchNo = ord.getBatch_no();
  2320. break;
  2321. }
  2322. }
  2323. if (i == 0) {
  2324. smp_01 = smp_no;
  2325. } else {
  2326. smp_02 = smp_no;
  2327. }
  2328. // 生成试样号、生成项目//双倍样
  2329. String specimen_no = createSpecimen_no(smp_no);
  2330. JhySampleDModel model = getSampleD(specimen_no, result);
  2331. model.setSmp_no(smp_no);
  2332. mapper.insertSampleD(model);
  2333. System.out.println("原來的取樣編號0---------" + model.getSpecimen_no() + "试样号:" + model.getSmp_no());
  2334. model.setItems(new ArrayList<JhySampleDItemModel>());
  2335. // System.out.println("原來的取樣編號---------"+specimen_no);
  2336. // 生成复样的单倍项目信息
  2337. for (int j = 0; j < qtlyResource.size(); j++) {
  2338. HashMap resource = qtlyResource.get(j);
  2339. JhySampleDItemModel item = getSampleItem(smp_no, specimen_no, resource, j + 1);
  2340. mapper.insertSampleItem(item);
  2341. model.getItems().add(item);
  2342. }
  2343. i++;
  2344. tarSmpDRan.add(model);
  2345. }
  2346. // 两个轧批相互引用
  2347. // 22.08.07 两个轧批号相互引用 那就取两个轧批号
  2348. // JhySampleDModel model2=tarSmpDRan.get(0); 修改成 JhySampleDModel
  2349. // model2=tarSmpDRan.get(1);
  2350. JhySampleDModel model1 = tarSmpDRan.get(0);
  2351. JhySampleDModel model2 = tarSmpDRan.get(1);
  2352. // 创建model1另一个取样编号
  2353. String specimen_no1 = createSpecimen_no(model1.getSmp_no());
  2354. String specimen_no2 = createSpecimen_no(model2.getSmp_no());
  2355. System.out.println("引用新的的取樣編號1---------" + specimen_no1);
  2356. System.out.println("引用新的的取樣編號2---------" + specimen_no2);
  2357. JhySampleDModel quote = getSampleD(specimen_no1, result);
  2358. quote.setQuote_consign_no(model2.getSpecimen_no());
  2359. // 第二個引用第三個的
  2360. quote.setSmp_no(model1.getSmp_no());
  2361. System.out.println("引用新的的取樣編號1---------" + quote.getSpecimen_no() + "试样号:" + quote.getSmp_no());
  2362. // 22.08.10 引用的复样不显示 状态改为已发送
  2363. quote.setStatus("1");
  2364. mapper.insertSampleD(quote);
  2365. quote.setItems(new ArrayList<JhySampleDItemModel>());
  2366. for (int j = 0; j < model2.getItems().size(); j++) {
  2367. JhySampleDItemModel item = model2.getItems().get(j);
  2368. item.setSmp_no(model1.getSmp_no());
  2369. item.setSpecimen_no(specimen_no1);
  2370. item.setQuote_specimen_no(model2.getSpecimen_no());
  2371. item.setQuote_seq(item.getSeq());
  2372. mapper.insertSampleItem(item);
  2373. quote.getItems().add(item);
  2374. }
  2375. tarSmpD.add(quote);
  2376. // 第三個引用第二個的
  2377. JhySampleDModel quote2 = getSampleD(specimen_no2, result);
  2378. quote2.setQuote_consign_no(model1.getSpecimen_no());
  2379. quote2.setSmp_no(model2.getSmp_no());
  2380. System.out.println("引用新的的取樣編號2---------" + quote2.getSpecimen_no() + "试样号:" + quote2.getSmp_no());
  2381. // 22.08.10 引用的复样不显示 状态改为已发送
  2382. quote2.setStatus("1");
  2383. mapper.insertSampleD(quote2);
  2384. quote2.setItems(new ArrayList<JhySampleDItemModel>());
  2385. for (int j = 0; j < model1.getItems().size(); j++) {
  2386. JhySampleDItemModel item = model1.getItems().get(j);
  2387. item.setSmp_no(model2.getSmp_no());
  2388. item.setSpecimen_no(specimen_no2);
  2389. item.setQuote_specimen_no(model1.getSpecimen_no());
  2390. item.setQuote_seq(item.getSeq());
  2391. mapper.insertSampleItem(item);
  2392. quote2.getItems().add(item);
  2393. }
  2394. tarSmpD.add(quote2);
  2395. // 查询引用了原取样编号的试样号生成全部引用生成一套复样
  2396. sqlucomm.setLength(0);
  2397. sqlucomm.append("SELECT SMP_NO,SPECIMEN_NO,BATCH_NO FROM QCM_JHY_SAMPLE_CONSIGN_D where " + "(SPECIMEN_NO='"
  2398. + result.get("SPECIMEN_NO") + "' or QUOTE_CONSIGN_NO='" + result.get("SPECIMEN_NO")
  2399. + "' and BATCH_NO <> '" + result.get("BATCH_NO") + "')");
  2400. List<HashMap> quoteSpec = mapper.query(sqlucomm.toString());
  2401. for (HashMap ranQuote : quoteSpec) {
  2402. if ((smp_02).equals(ranQuote.get("SMP_NO")) || (smp_01).equals(ranQuote.get("SMP_NO"))) {
  2403. // 这里已经生成了,不再生成
  2404. continue;
  2405. }
  2406. for (JhySampleDModel tar : tarSmpD) {
  2407. String specimenNoQuote = createSpecimen_no((String) ranQuote.get("SMP_NO"));
  2408. tar.setSmp_no((String) ranQuote.get("SMP_NO"));
  2409. tar.setSpecimen_no(specimenNoQuote);
  2410. // 22.08.09 新加引用编号 4-10轧批号引用 复样2或3的值 引用复样不显示 状态修改成 1
  2411. /*
  2412. * tar.setQuote_consign_no(tar.getSpecimen_no());
  2413. * tar.setOld_consign_no((String)ranQuote.get("SPECIMEN_NO")
  2414. * );
  2415. */
  2416. tar.setStatus("1");
  2417. mapper.insertSampleD(tar);
  2418. System.out.println(
  2419. "引用新的的取樣編號3---------" + specimenNoQuote + "试样号:" + (String) ranQuote.get("SMP_NO"));
  2420. List<JhySampleDItemModel> ranItem = tar.getItems();
  2421. for (JhySampleDItemModel jhySampleDItemModel : ranItem) {
  2422. jhySampleDItemModel.setSmp_no((String) ranQuote.get("SMP_NO"));
  2423. jhySampleDItemModel.setSpecimen_no(specimenNoQuote);
  2424. // Integer seq = selSeq(specimenNoQuote);
  2425. // jhySampleDItemModel.setSeq(seq);
  2426. mapper.insertSampleItem(jhySampleDItemModel);
  2427. }
  2428. }
  2429. }
  2430. }
  2431. }
  2432. private JhySampleDItemModel getSampleItem(String smp_no, String specimen_no, HashMap resource, int iy)
  2433. throws Exception {
  2434. // TODO Auto-generated method stub
  2435. JhySampleDItemModel model = new JhySampleDItemModel();
  2436. model.setSmp_no(smp_no);
  2437. model.setSpecimen_no(specimen_no);
  2438. model.setPhy_code_l((String) resource.get("PHY_CODE_L"));
  2439. ;
  2440. model.setPhy_code_m((String) resource.get("PHY_CODE_M"));
  2441. model.setPhy_code_s((String) resource.get("PHY_CODE_S"));
  2442. model.setPhy_name_l((String) resource.get("PHY_NAME_L"));
  2443. model.setPhy_name_m((String) resource.get("PHY_NAME_M"));
  2444. model.setPhy_name_s((String) resource.get("PHY_NAME_S"));
  2445. model.setItem_code_d((String) resource.get("ITEM_CODE_D"));
  2446. model.setItem_code_t((String) resource.get("ITEM_CODE_T"));
  2447. model.setItem_code_s((String) resource.get("ITEM_CODE_S"));
  2448. model.setItem_code_l((String) resource.get("ITEM_CODE_L"));
  2449. model.setItem_name_d((String) resource.get("ITEM_NAME_D"));
  2450. model.setItem_name_t((String) resource.get("ITEM_NAME_T"));
  2451. model.setItem_name_s((String) resource.get("ITEM_NAME_S"));
  2452. model.setItem_desc_l((String) resource.get("ITEM_DESC_L"));
  2453. model.setIsjudge((String) resource.get("ISJUDGE"));
  2454. model.setPhy_unit((String) resource.get("PHY_UNIT"));
  2455. model.setGroup_seq((String) resource.get("GROUP_SEQ"));
  2456. model.setSpecl_fl((String) resource.get("SPECL_FL"));
  2457. // 试验次数
  2458. model.setTest_qty((BigDecimal) resource.get("SMP_COUNT"));
  2459. model.setSmp_qty((BigDecimal) resource.get("SMP_QTY"));
  2460. model.setCreate_id((String) resource.get("CREATE_ID"));
  2461. model.setCreate_name((String) resource.get("CREATE_NAME"));
  2462. model.setCreate_time(new Date());
  2463. model.setMemo((String) resource.get("MEMO"));
  2464. model.setResmp_seq(String.valueOf(iy));
  2465. model.setStdmax_sign((String) resource.get("STDMAX_SIGN"));
  2466. model.setStdmax((String) resource.get("STDMAX"));
  2467. model.setStdmin_sign((String) resource.get("STDMIN_SIGN"));
  2468. model.setStdmin((String) resource.get("STDMIN"));
  2469. model.setSeq(createItemSeq(smp_no, specimen_no));
  2470. model.setStdmemo((String) resource.get("STDMEMO"));
  2471. // 样品类型
  2472. return model;
  2473. }
  2474. /**
  2475. * 创建项目seq
  2476. *
  2477. * @param specimen_no
  2478. * @param smp_no
  2479. * @param cn
  2480. * @return
  2481. * @throws Exception
  2482. */
  2483. private Integer createItemSeq(String smp_no, String specimen_no) throws Exception {
  2484. // TODO Auto-generated method stub
  2485. StringBuffer sqlucomm = new StringBuffer();
  2486. sqlucomm.append("SELECT max(SEQ) SEQ FROM QCM_JHY_SAMPLE_CONSIGN_D_ITEM WHERE SMP_NO ='" + smp_no
  2487. + "' and SPECIMEN_NO='" + specimen_no + "'");
  2488. HashMap result = mapper.queryOne(sqlucomm.toString());
  2489. Integer SEQ = 0;
  2490. if (result != null && result.get("SEQ") != null) {
  2491. SEQ = ((BigDecimal) result.get("SEQ")).intValue();
  2492. }
  2493. SEQ++;
  2494. return SEQ;
  2495. }
  2496. /**
  2497. * 生成不带 "-" 的UUID
  2498. *
  2499. * @return
  2500. */
  2501. private String getUUID() {
  2502. UUID uuid = UUID.randomUUID();
  2503. String str = uuid.toString();
  2504. String uuidStr = str.replace("-", "");
  2505. return uuidStr;
  2506. }
  2507. /**
  2508. * 获取取样编号
  2509. *
  2510. * @param smp_no
  2511. * @return
  2512. */
  2513. private String createSpecimen_no(String smp_no) {
  2514. // TODO Auto-generated method stub
  2515. String specimen_no = "";
  2516. StringBuffer sqlucomm = new StringBuffer();
  2517. sqlucomm.append("SELECT max(to_number(substr(SPECIMEN_NO,14))) SPECIMEN_NO FROM QCM_JHY_SAMPLE_CONSIGN_D "
  2518. + "WHERE SPECIMEN_NO like '" + smp_no + "%' and SMP_NO='" + smp_no + "'");
  2519. HashMap result = mapper.queryOne(sqlucomm.toString());
  2520. BigDecimal seq = BigDecimal.ZERO;
  2521. if (result != null && result.get("SPECIMEN_NO") != null) {
  2522. seq = (BigDecimal) result.get("SPECIMEN_NO");
  2523. }
  2524. seq = seq.add(BigDecimal.ONE);
  2525. specimen_no = smp_no + String.format("%02d", seq.intValue());
  2526. return specimen_no;
  2527. }
  2528. /**
  2529. * 获取取样编号的顺序号
  2530. *
  2531. * @param smp_no
  2532. * @return
  2533. */
  2534. private Integer selSeq(String SPECIMEN_NO) {
  2535. // TODO Auto-generated method stub
  2536. String seq = "";
  2537. StringBuffer sqlucomm = new StringBuffer();
  2538. sqlucomm.append("SELECT max(seq) seq FROM qcm_jhy_sample_consign_d_item " + "WHERE SPECIMEN_NO = '"
  2539. + SPECIMEN_NO + "'");
  2540. HashMap result = mapper.queryOne(sqlucomm.toString());
  2541. if (result != null && result.get("seq") != null) {
  2542. seq = (String) result.get("seq");
  2543. }
  2544. Integer seqs = Integer.parseInt(seq);
  2545. return seqs + 1;
  2546. }
  2547. private String checkInfo(JSONArray lists) {
  2548. // TODO Auto-generated method stub
  2549. String msg = "";
  2550. if (lists == null || lists.size() < 1) {
  2551. return "未寻到或无可生成检验委托的数据";
  2552. }
  2553. String inspection_lot = "";
  2554. TreeSet<String> treeSet = new TreeSet<String>();
  2555. ResultSet rs = null;
  2556. for (Object list : lists) {
  2557. JSONObject map = (JSONObject) list;
  2558. // 检验号
  2559. msg = checkField("INSPECTION_LOT", "检验号", map);
  2560. if (!"".equals(msg)) {
  2561. return msg;
  2562. }
  2563. // 获取共同检验号
  2564. inspection_lot = map.getString("INSPECTION_LOT");
  2565. treeSet.add(inspection_lot);
  2566. // DESIGN_KEY
  2567. msg = checkField("DESIGN_KEY", "DESIGN_KEY", map);
  2568. if (!"".equals(msg)) {
  2569. return msg;
  2570. }
  2571. // 炉号
  2572. msg = checkField("HEAT_NO", "炉号", map);
  2573. if (!"".equals(msg)) {
  2574. return msg;
  2575. }
  2576. // 轧批号
  2577. msg = checkField("BATCH_NO", "轧批号", map);
  2578. if (!"".equals(msg)) {
  2579. return msg;
  2580. }
  2581. // 全程产线号
  2582. msg = checkField("MSC_PLINE", "全程产线号", map);
  2583. if (!"".equals(msg)) {
  2584. return msg;
  2585. }
  2586. // 全程产线代码
  2587. msg = checkField("PLINE_CODE", "产线代码", map);
  2588. if (!"".equals(msg)) {
  2589. return msg;
  2590. }
  2591. // 全程产线名称
  2592. msg = checkField("PLINE_NAME", "产线名称", map);
  2593. if (!"".equals(msg)) {
  2594. return msg;
  2595. }
  2596. // //交货状态
  2597. // msg=checkField("DELIVERY_STATE_CODE","交货状态代码",map);
  2598. // if (!"".equals(msg)) {
  2599. // return msg;
  2600. // }
  2601. // //交货状态
  2602. // msg=checkField("DELIVERY_STATE_DESC","交货状态",map);
  2603. // if (!"".equals(msg)) {
  2604. // return msg;
  2605. // }
  2606. // 工序代码
  2607. // msg=checkField("PROCESS_CODE","工序代码",map);
  2608. // if (!"".equals(msg)) {
  2609. // return msg;
  2610. // }
  2611. // 厚款长
  2612. msg = checkField("THICK", "厚度", map);
  2613. if (!"".equals(msg)) {
  2614. return msg;
  2615. }
  2616. /*
  2617. * msg=checkField("WIDTH","宽度",map); if (!"".equals(msg)) { return
  2618. * msg; } msg=checkField("LENGTH","长度",map); if (!"".equals(msg)) {
  2619. * return msg; }
  2620. */
  2621. msg = checkField("PSC", "产品码", map);
  2622. if (!"".equals(msg)) {
  2623. return msg;
  2624. }
  2625. msg = checkField("QLTY_SMP_NO", "原试样号", map);
  2626. if (!"".equals(msg)) {
  2627. return msg;
  2628. }
  2629. }
  2630. if (treeSet.size() != 1) {
  2631. return "检验号不一致";
  2632. }
  2633. return msg;
  2634. }
  2635. /**
  2636. * 验证字段
  2637. *
  2638. * @param field
  2639. * 字段
  2640. * @param name
  2641. * 字段名
  2642. * @param map
  2643. * map对象
  2644. * @return
  2645. */
  2646. private String checkField(String field, String name, JSONObject map) {
  2647. if (map.get(field) == null) {
  2648. return name + "不存在";
  2649. }
  2650. String ran = (String) map.get(field);
  2651. if (ran == null || "".equals(ran.trim())) {
  2652. return name + "为空";
  2653. }
  2654. return "";
  2655. }
  2656. private void DuplicateSampleLog(String josnString, String memo) {
  2657. StringBuffer sqlucomm1 = new StringBuffer();
  2658. sqlucomm1.append("Delete From QCM_JHY_SAMPLE_LOG ");
  2659. sqlucomm1.append(
  2660. "where CREATE_TIME <= to_date(to_char(sysdate - 180, 'yyyy-MM-dd hh24:mi:ss'),'yyyy-MM-dd hh24:mi:ss') ");
  2661. try {
  2662. this.getDao("testDao").ExcuteNonQuery(sqlucomm1.toString());
  2663. } catch (SQLException e) {
  2664. }
  2665. int len = 0;
  2666. if (josnString.length() <= 3500) {
  2667. len = josnString.length();
  2668. } else {
  2669. len = 3400;
  2670. }
  2671. String josnli2 = josnString.substring(0, len);
  2672. String batchNo = "";
  2673. String smpNO = "";
  2674. JSONArray jsonArray = JSON.parseArray(josnString);
  2675. for (Object list : jsonArray) {
  2676. JSONObject map = (JSONObject) list;
  2677. batchNo = (String) map.get("BATCH_NO");
  2678. smpNO = (String) map.get("QLTY_SMP_NO");
  2679. break;
  2680. }
  2681. StringBuffer sqlucomm = new StringBuffer();
  2682. sqlucomm.append("INSERT INTO QCM_JHY_SAMPLE_LOG (GUID,MEMO,");
  2683. sqlucomm.append("CREATE_NAME,CREATE_TIME,JSON_TEXT,SMP_NO) VALUES ('");
  2684. sqlucomm.append(getUUID() + "','" + memo + "',");
  2685. sqlucomm.append(" '"+batchNo+"',sysdate,'" + josnli2 + "','"+smpNO+"')");
  2686. try {
  2687. this.getDao("testDao").ExcuteNonQuery(sqlucomm.toString());
  2688. } catch (SQLException e) {
  2689. }
  2690. }
  2691. //重判
  2692. public synchronized String doSentenceDuplicateSample(HashMap parmas) {
  2693. logger.info("重判:==========重判" + parmas.toString());
  2694. String msg = "0";
  2695. if (StringUtils.isBlank(parmas.get("BATCH_NO").toString())) {
  2696. return "轧批号为空";
  2697. }
  2698. if (StringUtils.isBlank(parmas.get("SMP_NO").toString())) {
  2699. return "试样号为空";
  2700. }
  2701. if (StringUtils.isBlank(parmas.get("MATERIAL_NO").toString())) {
  2702. return "取样材料号为空";
  2703. }
  2704. if (StringUtils.isBlank(parmas.get("SMP_TYPE_CODE").toString())) {
  2705. return "取样方式为空";
  2706. }
  2707. if (StringUtils.isBlank(parmas.get("DESIGN_KEY").toString())) {
  2708. return "销售订单号为空";
  2709. }
  2710. if (StringUtils.isBlank(parmas.get("PLINE_CODE").toString())) {
  2711. return "产线为空";
  2712. }
  2713. try {
  2714. String showSql=" select t.* from QCM_JHY_SAMPLE_CONSIGN_D t where t.batch_no ='"+parmas.get("BATCH_NO")+"' and t.material_no = '"+parmas.get("MATERIAL_NO")+"' "
  2715. +" and t.SMP_TYPE_CODE = '3' and t.Send_Id = '5' ";
  2716. List<HashMap> hmShow = mapper.query(showSql.toString());
  2717. if(hmShow !=null && hmShow.size()>=1){
  2718. return "1";
  2719. }
  2720. String smpNo = createQltySamNo(parmas.get("PLINE_CODE").toString());
  2721. String inspectionLot = createQltyInspectionLot(parmas.get("BATCH_NO").toString());
  2722. String specimen_no = createSpecimen_no(smpNo);
  2723. //初样、复样重判 QCM_JHY_SAMPLE_CONSIGN_M生成一条
  2724. String sql ="Insert into QCM_JHY_SAMPLE_CONSIGN_M(SMP_NO,HEAT_NO,BATCH_NO,INSPECTION_LOT,BOARD_NO,MATERIAL_NO,PSC, "
  2725. +" PSC_DESC,SMP_CATG,CERT_INST_CODE,CERT_INST_NAME,SMP_TYPE_CODE,SMP_TYPE_NAME,GRADE_CODE,GRADE_NAME, "
  2726. +" PLINE_CODE,PLINE_NAME,VALIDFLAG,MEMO,CREATE_ID,CREATE_NAME,CREATE_TIME,ITEM_FLAG,DUPLICATE_SAMPLE) "
  2727. +" select '"+smpNo+"',HEAT_NO,BATCH_NO,'"+inspectionLot+"',BOARD_NO,'"+parmas.get("MATERIAL_NO")+"',PSC, "
  2728. +" PSC_DESC,SMP_CATG,CERT_INST_CODE,CERT_INST_NAME,SMP_TYPE_CODE,SMP_TYPE_NAME,GRADE_CODE,GRADE_NAME, "
  2729. +" PLINE_CODE,PLINE_NAME,VALIDFLAG,MEMO,'','"+parmas.get("CREATE_NAME")+"',sysdate,ITEM_FLAG,'重判' "
  2730. +" from QCM_JHY_SAMPLE_CONSIGN_M t where t.SMP_NO = '"+parmas.get("SMP_NO")+"' and rownum <= 1 ";
  2731. mapper.insert(sql);
  2732. //初样、复样重判 QCM_JHY_SAMPLE_R_ORD生成一条
  2733. sql = "";
  2734. sql = "Insert into QCM_JHY_SAMPLE_R_ORD(DESIGN_KEY,SMP_NO,PSC,PSC_DESC,HEAT_NO,BATCH_NO,INSPECTION_LOT,DELIVERY_STATE_CODE, "
  2735. + " DELIVERY_STATE_DESC,THICK,WIDTH,LENGTH,PLINE_CODE,PLINE_NAME,MSC_PLINE,PROCESS_CODE,CERT_INST_CODE,CERT_INST_NAME, "
  2736. + " SMP_TYPE_CODE,SMP_TYPE_NAME,SMELTING_CNT,PRODUCT_CNT,ASSAY_NO_CP,ASSAY_NO_RL,CIC_ID,JUDGE_STATUS,PROD_CODE,"
  2737. + " PROD_NAME,STEEL_CODE,STEEL_NAME,STD_CODE,STD_NAME,CREATE_TIME,CREATE_ID,CREATE_NAME,ITEM_FLAG,DUPLICATE_SAMPLE) "
  2738. + " select DESIGN_KEY,'"+smpNo+"',PSC,PSC_DESC,HEAT_NO,BATCH_NO,'"+inspectionLot+"',DELIVERY_STATE_CODE,DELIVERY_STATE_DESC, "
  2739. + " THICK,WIDTH,LENGTH,PLINE_CODE,PLINE_NAME,MSC_PLINE,PROCESS_CODE,CERT_INST_CODE,CERT_INST_NAME,SMP_TYPE_CODE,"
  2740. + " SMP_TYPE_NAME,SMELTING_CNT,PRODUCT_CNT,ASSAY_NO_CP,ASSAY_NO_RL,CIC_ID,'0',PROD_CODE,PROD_NAME,STEEL_CODE, "
  2741. + " STEEL_NAME,STD_CODE,STD_NAME,sysdate,'','"+parmas.get("CREATE_NAME")+"',ITEM_FLAG,'重判' "
  2742. + " from QCM_JHY_SAMPLE_R_ORD t where t.SMP_NO = '"+parmas.get("SMP_NO")+"' and rownum <= 1 ";
  2743. mapper.insert(sql);
  2744. //初样、复样重判 QCM_JHY_SAMPLE_CONSIGN_D生成一条
  2745. sql = "";
  2746. sql = " Insert into QCM_JHY_SAMPLE_CONSIGN_D(SMP_NO,SPECIMEN_NO,HEAT_NO,BATCH_NO,INSPECTION_LOT,FREQ_CODE,FREQ_NAME,MATERIAL_NO,"
  2747. + " SMP_TYPE_CODE,SMP_TYPE_NAME,CONSIGN_NO,CONSIGN_NO_SEQ,TEST_QTY,SMP_QTY,SMP_LOCATION,BOARD_NO,QUOTE_CONSIGN_NO,OLD_CONSIGN_NO,"
  2748. + " PLINE_CODE,PLINE_NAME,STATUS,VALIDFLAG,SOURCE,GUID,SEND_ID,SEND_NAME,SEND_TIME,CHEM_ITEM,PRODUCT_CNT,CREATE_TIME,SMP_LOCATION_CODE,"
  2749. + " MEMO,WEIGHT,WEIGHT_STD,WEIGHT_SFD,SEND_MEMO,RZ_ROLL_MANA_NO,RZ_MIXROLL,RZ_OLD_SAMPL_NO,RZ_ROLL_SLAB_SEQ) "
  2750. + " select '"+smpNo+"','"+specimen_no+"',HEAT_NO,BATCH_NO,'"+inspectionLot+"',FREQ_CODE,FREQ_NAME,'"+parmas.get("MATERIAL_NO")+"',"
  2751. + " '3','件件取样',CONSIGN_NO,CONSIGN_NO_SEQ,TEST_QTY,SMP_QTY,SMP_LOCATION,BOARD_NO,QUOTE_CONSIGN_NO,OLD_CONSIGN_NO,"
  2752. + " PLINE_CODE,PLINE_NAME,'3',VALIDFLAG,SOURCE,GUID,'5','重判',sysdate,CHEM_ITEM,PRODUCT_CNT,sysdate,SMP_LOCATION_CODE,"
  2753. + " MEMO,WEIGHT,WEIGHT_STD,WEIGHT_SFD,SEND_MEMO,RZ_ROLL_MANA_NO,RZ_MIXROLL,RZ_OLD_SAMPL_NO,RZ_ROLL_SLAB_SEQ from QCM_JHY_SAMPLE_CONSIGN_D d"
  2754. + " where SMP_NO = '"+parmas.get("SMP_NO")+"' and BATCH_NO = '"+parmas.get("BATCH_NO")+"'"
  2755. + " and MATERIAL_NO = '"+parmas.get("MATERIAL_NO")+"' and rownum <= 1 ";
  2756. mapper.insert(sql);
  2757. //引用初样实绩
  2758. //查询这个试样号 轧批号 获取初样所有取样编号
  2759. sql = "";
  2760. String specimeNoM = "0";
  2761. //判断是重判初样还是复样
  2762. if(parmas.get("SMP_TYPE_CODE").equals("0")){
  2763. //查询初样当前子板信息
  2764. /* String dma = " select t.SPECIMEN_NO from QCM_JHY_SAMPLE_CONSIGN_D t where t.smp_type_code = '0' "
  2765. +" and t.batch_no='"+parmas.get("BATCH_NO")+"' and t.material_no = '"+parmas.get("MATERIAL_NO")+"' and rownum=1 ";
  2766. List<HashMap> hmaterialNo = mapper.query(dma.toString());
  2767. if(hmaterialNo!=null && hmaterialNo.size()>=1){
  2768. specimeNoM = hmaterialNo.get(0).get("SPECIMEN_NO").toString();
  2769. }else{
  2770. SqlSession.rollback();
  2771. return "该子板没有相应性能!";
  2772. }*/
  2773. //查询初样所有信息
  2774. sql = " select t.SPECIMEN_NO from QCM_JHY_SAMPLE_CONSIGN_D t "
  2775. +" where t.smp_type_code = '0' "
  2776. +" and t.batch_no='"+parmas.get("BATCH_NO")+"' and t.material_no = '"+parmas.get("MATERIAL_NO")+"' ";//and t.material_no = '"+parmas.get("MATERIAL_NO")+"'
  2777. }else if(parmas.get("SMP_TYPE_CODE").equals("1")){//20230807 E2304510 05、06/08/09 复样重判,没有带初样值seq:50
  2778. sql = " select t.SPECIMEN_NO,'0' seq "
  2779. +" from QCM_JHY_SAMPLE_CONSIGN_D t "
  2780. +" where t.smp_type_code = '1' "
  2781. +" and t.batch_no = '"+parmas.get("BATCH_NO")+"' "
  2782. +" and t.material_no = '"+parmas.get("MATERIAL_NO")+"' "
  2783. +" UNION ALL "
  2784. +" select t.SPECIMEN_NO,'50' seq "
  2785. +" from QCM_JHY_SAMPLE_CONSIGN_D t,qcm_jhy_sample_consign_d_item i "
  2786. +" where t.specimen_no = i.specimen_no "
  2787. +" and t.smp_type_code = '1' "
  2788. +" and t.batch_no = '"+parmas.get("BATCH_NO")+"' "
  2789. +" and i.seq >=50 "
  2790. +" group by t.specimen_no "
  2791. ;
  2792. }else{
  2793. sql = " select t.SPECIMEN_NO from QCM_JHY_SAMPLE_CONSIGN_D t "
  2794. +" where t.SMP_NO = '"+parmas.get("SMP_NO")+"' "
  2795. +" and t.batch_no='"+parmas.get("BATCH_NO")+"' and t.material_no = '"+parmas.get("MATERIAL_NO")+"' ";
  2796. }
  2797. List<HashMap> hmap = mapper.query(sql.toString());
  2798. if(hmap==null || hmap.size()<=0){
  2799. SqlSession.rollback();
  2800. return "该子板没有相应性能!!!";
  2801. }
  2802. for (HashMap hm : hmap) {
  2803. //查询当前初样取样编号的所有实绩
  2804. List<HashMap> hmPhysics=null;
  2805. sql = "";
  2806. if(parmas.get("SMP_TYPE_CODE").equals("1")){//复样重判
  2807. if(hm.get("SEQ").equals("50")){//拿取复样中的初样
  2808. sql = "select t.specimen_no,t.seq,t.test_qty from QCM_JHY_INSP_PHYSICS t "
  2809. + " where t.specimen_no = '"+(String)hm.get("SPECIMEN_NO")+"' and t.SEQ>=50 order by t.seq ";
  2810. hmPhysics = mapper.query(sql.toString());
  2811. }else{
  2812. sql = "select t.specimen_no,t.seq,t.test_qty from QCM_JHY_INSP_PHYSICS t "
  2813. + " where t.specimen_no = '"+(String)hm.get("SPECIMEN_NO")+"' and t.SEQ<50 ";
  2814. hmPhysics = mapper.query(sql.toString());
  2815. }
  2816. }else{
  2817. sql = "select t.specimen_no,t.seq,t.test_qty from QCM_JHY_INSP_PHYSICS t "
  2818. + " where t.specimen_no = '"+(String)hm.get("SPECIMEN_NO")+"' and t.SEQ<50 ";
  2819. hmPhysics = mapper.query(sql.toString());
  2820. }
  2821. for (HashMap hashMap : hmPhysics) {
  2822. //获取specimenNoZy取样编号 seq最大值
  2823. Integer seqint=0;
  2824. sql = "";
  2825. if(parmas.get("SMP_TYPE_CODE").equals("1")){//复样重判
  2826. if(hm.get("SEQ").equals("50")){//拿取复样中的初样
  2827. BigDecimal big = (BigDecimal)hashMap.get("SEQ");
  2828. String seqs = big.toString();
  2829. seqint = Integer.parseInt(seqs);
  2830. }else{
  2831. sql = "select decode(max(seq),'','1',max(seq))+1 as SEQ from QCM_JHY_INSP_PHYSICS t "
  2832. + " where t.specimen_no = '"+specimen_no+"'";
  2833. List<HashMap> seqhm = mapper.query(sql.toString());
  2834. BigDecimal big = (BigDecimal)seqhm.get(0).get("SEQ");
  2835. String seqs = big.toString();
  2836. seqint = Integer.parseInt(seqs);
  2837. }
  2838. }else{
  2839. // if(hashMap.get("SPECIMEN_NO").equals(specimeNoM)){
  2840. sql = "select decode(max(seq),'','1',max(seq))+1 as SEQ from QCM_JHY_INSP_PHYSICS t "
  2841. + " where t.specimen_no = '"+specimen_no+"' and t.SEQ<50 ";
  2842. List<HashMap> seqhm = mapper.query(sql.toString());
  2843. BigDecimal big = (BigDecimal)seqhm.get(0).get("SEQ");
  2844. String seqs = big.toString();
  2845. seqint = Integer.parseInt(seqs);
  2846. /* }else{
  2847. sql = "select decode(max(seq),'','49',max(seq))+1 as SEQ from QCM_JHY_INSP_PHYSICS t "
  2848. + " where t.specimen_no = '"+specimen_no+"' and t.SEQ>=50";
  2849. List<HashMap> seqhm = mapper.query(sql.toString());
  2850. BigDecimal big = (BigDecimal)seqhm.get(0).get("SEQ");
  2851. String seqs = big.toString();
  2852. seqint = Integer.parseInt(seqs);
  2853. }*/
  2854. }
  2855. sql = "";
  2856. sql = " insert into QCM_JHY_INSP_PHYSICS "
  2857. +" (SPECIMEN_NO,SEQ,TEST_QTY,PHY_CODE_L,PHY_NAME_L,PHY_CODE_M,PHY_NAME_M,PHY_CODE_S,PHY_NAME_S,ITEM_CODE_D,ITEM_NAME_D, "
  2858. +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
  2859. +" VAL13,VAL14,VAL15,AVG_VAL,GUID,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, "
  2860. +" PHY_UNIT,MEMO,QUOTE_SPECIMEN_NO) "
  2861. +" select '"+specimen_no+"','"+seqint+"',TEST_QTY,PHY_CODE_L,PHY_NAME_L,PHY_CODE_M,PHY_NAME_M,PHY_CODE_S,PHY_NAME_S,ITEM_CODE_D,ITEM_NAME_D, "
  2862. +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
  2863. +" VAL13,VAL14,VAL15,AVG_VAL,GUID,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, "
  2864. +" PHY_UNIT,MEMO,QUOTE_SPECIMEN_NO from QCM_JHY_INSP_PHYSICS t "
  2865. +" where t.specimen_no = '"+(String)hashMap.get("SPECIMEN_NO")+"' "
  2866. + "and t.seq = '"+hashMap.get("SEQ")+"' "
  2867. + "and t.test_qty = '"+hashMap.get("TEST_QTY")+"' ";
  2868. mapper.insert(sql);
  2869. sql = "";
  2870. sql = "insert into QCM_JHY_SAMPLE_CONSIGN_D_ITEM "
  2871. +" (SPECIMEN_NO,SEQ,SMP_NO,PHY_NAME_L,PHY_CODE_L,PHY_CODE_M,PHY_NAME_M,PHY_CODE_S,PHY_NAME_S, "
  2872. +" ITEM_CODE_D,ITEM_NAME_D,ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,ITEM_CODE_L,ITEM_DESC_L, "
  2873. +" STDMIN_SIGN,STDMIN,STDMAX_SIGN,STDMAX,TEST_QTY,SMP_QTY,SPECL_FL,ISJUDGE,JUDGE_BASIS,PHY_UNIT,GROUP_SEQ, "
  2874. +" QUOTE_SPECIMEN_NO,QUOTE_SEQ,ITEM_FLAG,MEMO,CREATE_ID,CREATE_NAME,CREATE_TIME,STDMEMO,RESMP_SEQ, "
  2875. +" PHY_GROUP_CODE,FY_QUOTE_SPECIMEN_NO) "
  2876. +" select '"+specimen_no+"','"+seqint+"','"+smpNo+"',PHY_NAME_L,PHY_CODE_L,PHY_CODE_M,PHY_NAME_M,PHY_CODE_S,PHY_NAME_S, "
  2877. +" ITEM_CODE_D,ITEM_NAME_D,ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,ITEM_CODE_L,ITEM_DESC_L, "
  2878. +" STDMIN_SIGN,STDMIN,STDMAX_SIGN,STDMAX,TEST_QTY,SMP_QTY,SPECL_FL,ISJUDGE,JUDGE_BASIS,PHY_UNIT,GROUP_SEQ, "
  2879. +" QUOTE_SPECIMEN_NO,QUOTE_SEQ,ITEM_FLAG,MEMO,CREATE_ID,CREATE_NAME,CREATE_TIME,STDMEMO,RESMP_SEQ, "
  2880. +" PHY_GROUP_CODE,FY_QUOTE_SPECIMEN_NO from QCM_JHY_SAMPLE_CONSIGN_D_ITEM "
  2881. + " where specimen_no = '"+(String)hashMap.get("SPECIMEN_NO")+"' "
  2882. + "and seq = '"+hashMap.get("SEQ")+"' ";
  2883. mapper.insert(sql);
  2884. }
  2885. }
  2886. //修改判定那边的检验号
  2887. sql = "";
  2888. sql = " update zj_result_all@xgcx t set t.billetid_jy = '"+inspectionLot+"',t.PHYSRESULT='0',t.PHYSRESULT_DESC='',t.PIC_IS_LOCK='0' "
  2889. + " where t.billetid = '"+parmas.get("MATERIAL_NO")+"' ";
  2890. mapper.updateJudgeStatus(sql.toString());
  2891. sql = "";
  2892. sql = "INSERT INTO QCM_JUDGE_LOG "
  2893. +" ( JUDGE_TYPE,MATERIAL_NO,CREATE_TIME,CREATE_NAME,PROD_LINE)"
  2894. +" VALUES "
  2895. +" ( 'P', '"+smpNo+"', SYSDATE,'system','"+parmas.get("PLINE_CODE")+"')";
  2896. mapper.insert(sql.toString());
  2897. SqlSession.commit();
  2898. msg = "1";
  2899. } catch (Exception e) {
  2900. logger.error(e.toString() + e.getMessage() + "重判:json数据:" + parmas.toString() + "\n");
  2901. e.printStackTrace();
  2902. SqlSession.rollback();
  2903. } finally {
  2904. SqlSession.close();
  2905. }
  2906. if ("1".equals(msg)) {
  2907. return "1";
  2908. } else {
  2909. return "生成失败!";
  2910. }
  2911. }
  2912. //(实物样)中厚板预测结果不合格 若预测结果不合格,该母板封闭,按要求取实物样进行判定;
  2913. public synchronized String ZHBCY(String smpNo){
  2914. try {
  2915. String sql="select * from qcm_jhy_sample_consign_d t,qcm_jhy_sample_r_ord r "
  2916. +" where t.smp_no = r.smp_no and t.smp_no = '"+smpNo+"' and rownum=1 ";
  2917. List<HashMap> lists=mapper.query(sql.toString());
  2918. if (lists==null || lists.size()<1) {
  2919. return "未找到相应委托";
  2920. }
  2921. if (lists!=null && lists.size()>=1) {
  2922. String specimen_no = lists.get(0).get("SPECIMEN_NO").toString();
  2923. String specimen_no2 = lists.get(0).get("RZ_OLD_SAMPL_NO").toString();
  2924. String steel_code = lists.get(0).get("STEEL_CODE").toString();
  2925. if(!"Q235B".equals(steel_code) && !"Q355B".equals(steel_code)){
  2926. return smpNo + "的牌号不为:[Q235B/Q355B]";
  2927. }
  2928. if(StringUtils.isBlank(specimen_no2)){
  2929. return smpNo + "抽样编号为空不是预测委托";
  2930. }
  2931. //判断是预测抽样实际委托 还是预测委托
  2932. if(!specimen_no.equals(specimen_no2)){
  2933. //预测委托
  2934. ZHBYCWT(lists);
  2935. }/*else if(specimen_no.equals(specimen_no2)){
  2936. //抽样委托
  2937. ZHBCYWT(lists);
  2938. }*/
  2939. }
  2940. SqlSession.commit();
  2941. } catch (Exception e) {
  2942. e.printStackTrace();
  2943. SqlSession.rollback();
  2944. } finally {
  2945. SqlSession.close();
  2946. }
  2947. return "成功";
  2948. }
  2949. public void ZHBYCWT(List<HashMap> lists){
  2950. String logmemo2=lists.get(0).get("BATCH_NO").toString()+','+lists.get(0).get("RZ_MIXROLL").toString()+','+lists.get(0).get("RZ_OLD_SAMPL_NO").toString();
  2951. String sql4= "INSERT INTO QCM_JUDGE_OPERATE_LOG (OPERATE_TYPE,PARAMS,OPERATE_NAME,PROD_LINE,BATCHNO,MEMO) "
  2952. + " VALUES('取实物再次判定','"+lists.get(0).get("MATERIAL_NO")+"','ZHBYCWT','"+lists.get(0).get("PLINE_CODE")+"',"
  2953. + " '"+lists.get(0).get("BATCH_NO")+"','"+logmemo2+"') ";
  2954. mapper.insert(sql4);
  2955. String sql = " update QCM_JHY_SAMPLE_CONSIGN_D t "
  2956. + " set t.STATUS = '0',RZ_OLD_SAMPL_NO='',t.RZ_ROLL_SLAB_SEQ='',t.RZ_MIXROLL=t.RZ_MIXROLL || '1' "
  2957. + " where t.SPECIMEN_NO = '"+(String)lists.get(0).get("SPECIMEN_NO")+"' ";
  2958. mapper.UpdateQcmWt(sql.toString());
  2959. sql="";
  2960. sql = " update Qcm_Jhy_Sample_r_Ord t "
  2961. + " set t.PHY_ID = '',t.JUDGE_STATUS='0',JUDGE_RESULT_CODE='',JUDGE_RESULT_DESC='',"
  2962. + " JUDGE_NAME='',JUDGE_TIME='',JUDGE_MEMO='' "
  2963. + " where t.SMP_NO = '"+(String)lists.get(0).get("SMP_NO")+"' ";
  2964. mapper.UpdateQcmWt(sql.toString());
  2965. sql="";
  2966. sql = " update zj_result_all@xgcx t "
  2967. + " set t.PHYSRESULT = '0',t.PHYSRESULT_DESC='',PHYSID='',PIC_IS_LOCK='' "
  2968. + " where t.BILLETID_JY = '"+(String)lists.get(0).get("INSPECTION_LOT")+"' ";
  2969. mapper.UpdateQcmWt(sql.toString());
  2970. }
  2971. public void ZHBCYWT(List<HashMap> lists){
  2972. String SMP_NO = lists.get(0).get("SMP_NO").toString();//原先试样号
  2973. String SPECIMEN_NO = lists.get(0).get("SPECIMEN_NO").toString();//原先取样编号
  2974. String freq_code = lists.get(0).get("FREQ_CODE").toString();
  2975. String pline_code = lists.get(0).get("PLINE_CODE").toString();
  2976. String smpNo = createQltySamNo(pline_code);//新试样号
  2977. String specimenNo = createSpecimen_no(smpNo);//新取样编号
  2978. if("A".equals(freq_code)){
  2979. String sql = "insert into qcm_jhy_sample_consign_m "
  2980. +" (smp_no,heat_no,batch_no,inspection_lot,board_no,material_no,psc,psc_desc, "
  2981. +" smp_catg,cert_inst_code,cert_inst_name,smp_type_code,smp_type_name, "
  2982. +" grade_code,grade_name, pline_code, pline_name,validflag,create_time) "
  2983. +" select '"+smpNo+"',heat_no,batch_no,inspection_lot,board_no,material_no, "
  2984. +" psc,psc_desc,smp_catg,cert_inst_code,cert_inst_name,smp_type_code, "
  2985. +" smp_type_name,grade_code,grade_name,pline_code,pline_name,validflag,sysdate "
  2986. +" from qcm_jhy_sample_consign_m t "
  2987. +" where t.smp_no = '"+SMP_NO+"' ";
  2988. mapper.insert(sql);
  2989. sql="";
  2990. sql = "insert into qcm_jhy_sample_r_ord "
  2991. +" (design_key, smp_no, psc, psc_desc, heat_no, batch_no, inspection_lot, delivery_state_code, delivery_state_desc, thick, width, "
  2992. +" length, pline_code, pline_name, msc_pline, process_code, cert_inst_code, cert_inst_name, smp_type_code, smp_type_name, "
  2993. +" prod_code, prod_name, steel_code, steel_name, std_code, std_name, create_time) "
  2994. +" select design_key, '"+smpNo+"', psc, psc_desc, heat_no, batch_no, inspection_lot, delivery_state_code, delivery_state_desc, thick, width, length, "
  2995. +" pline_code, pline_name, msc_pline, process_code, cert_inst_code, cert_inst_name, smp_type_code, smp_type_name, prod_code, "
  2996. +" prod_name, steel_code, steel_name, std_code, std_name, sysdate "
  2997. +" from qcm_jhy_sample_r_ord t "
  2998. +" where t.smp_no = '"+SMP_NO+"' ";
  2999. mapper.insert(sql);
  3000. sql="";
  3001. sql="insert into qcm_jhy_sample_consign_d "
  3002. +" (smp_no, specimen_no, heat_no, batch_no, inspection_lot, freq_code, freq_name, material_no, "
  3003. +" smp_type_code, smp_type_name,test_qty, smp_qty, smp_location,board_no,pline_code, "
  3004. +" pline_name, status, validflag, source,guid, chem_item, product_cnt, create_time, "
  3005. +" smp_location_code, memo, weight, weight_std, weight_sfd,rz_mixroll,rz_old_sampl_no, "
  3006. +" rz_roll_slab_seq, process_no,process_nos, process_code) "
  3007. +" select "
  3008. +" '"+smpNo+"', '"+specimenNo+"', heat_no, batch_no, inspection_lot, freq_code, freq_name, material_no, "
  3009. +" smp_type_code,smp_type_name,test_qty, smp_qty, smp_location,board_no,pline_code, "
  3010. +" pline_name, '0', validflag, source,guid,chem_item, product_cnt, sysdate, "
  3011. +" smp_location_code,memo, weight, weight_std, weight_sfd, rz_mixroll,rz_old_sampl_no, "
  3012. +" '预测抽样不合格再次送样', process_no,process_nos, process_code "
  3013. +" from qcm_jhy_sample_consign_d t where t.specimen_no = '"+SPECIMEN_NO+"' ";
  3014. mapper.insert(sql);
  3015. sql="";
  3016. sql="insert into qcm_jhy_sample_consign_d_item "
  3017. +" (specimen_no, seq, smp_no, phy_name_l, phy_code_l, phy_code_m, phy_name_m, phy_code_s, phy_name_s, "
  3018. +" item_code_d, item_name_d, item_code_t, item_name_t, item_code_s, item_name_s, item_code_l, item_desc_l, "
  3019. +" stdmin_sign, stdmin, stdmax_sign, stdmax, test_qty, smp_qty, specl_fl, isjudge, judge_basis, phy_unit, "
  3020. +" group_seq, quote_specimen_no, quote_seq, item_flag, memo, create_id, create_name, create_time, stdmemo, "
  3021. +" phy_group_code, fy_quote_specimen_no, quote_memo) "
  3022. +" select "
  3023. +" '"+specimenNo+"', seq, '"+smpNo+"', phy_name_l, phy_code_l, phy_code_m, phy_name_m, phy_code_s, phy_name_s, "
  3024. +" item_code_d, item_name_d, item_code_t, item_name_t, item_code_s, item_name_s, item_code_l, item_desc_l, "
  3025. +" stdmin_sign, stdmin, stdmax_sign, stdmax, test_qty, smp_qty, specl_fl, isjudge, judge_basis, phy_unit, "
  3026. +" group_seq, quote_specimen_no, quote_seq, item_flag, memo, create_id, create_name, create_time, stdmemo, "
  3027. +" phy_group_code, fy_quote_specimen_no, quote_memo "
  3028. +" from qcm_jhy_sample_consign_d_item t where t.specimen_no = '"+SPECIMEN_NO+"' ";
  3029. mapper.insert(sql);
  3030. sql="";
  3031. sql = " update Qcm_Jhy_Sample_r_Ord t "
  3032. + " set t.INSPECTION_LOT = '' "
  3033. + " where t.SMP_NO = '"+SMP_NO+"' ";
  3034. mapper.UpdateQcmWt(sql.toString());
  3035. }else if("B".equals(freq_code) || "F".equals(freq_code)){
  3036. }
  3037. }
  3038. //中厚板预测
  3039. /***
  3040. * 批批取样
  3041. * 预测 复样不合格判不合格 若复样不合格则在该取样批次时间段内其他批号钢板每批号按要求取实物样进行判定
  3042. * 预测 取样实际检测结果 并在该取样批次内其他批号钢板每批号按要求取实物样进行判定
  3043. * @param smpNo
  3044. * @return
  3045. */
  3046. public synchronized String ZHBCYK(String smpNo){
  3047. try {
  3048. String sql="select * from qcm_jhy_sample_consign_d t,qcm_jhy_sample_r_ord r "
  3049. +" where t.smp_no = r.smp_no and t.smp_no = '"+smpNo+"' "
  3050. +" and t.RZ_MIXROLL is not null and t.RZ_OLD_SAMPL_NO is not null "
  3051. +" and rownum=1 ";
  3052. List<HashMap> lists=mapper.query(sql.toString());
  3053. if (lists==null || lists.size()<1) {
  3054. return "未找到相应委托";
  3055. }
  3056. String batch_no = lists.get(0).get("BATCH_NO").toString();
  3057. String rz_mixroll = lists.get(0).get("RZ_MIXROLL").toString();
  3058. String rz_old_sampl_no = lists.get(0).get("RZ_OLD_SAMPL_NO").toString();
  3059. String smp_type_code = lists.get(0).get("SMP_TYPE_CODE").toString();//初复样
  3060. String material_no = lists.get(0).get("MATERIAL_NO").toString();
  3061. String pline_code = lists.get(0).get("PLINE_CODE").toString();
  3062. String logmemo="复样不合格批号"+ batch_no+','+rz_mixroll+','+rz_old_sampl_no;
  3063. String sql3= "INSERT INTO QCM_JUDGE_OPERATE_LOG (OPERATE_TYPE,PARAMS,OPERATE_NAME,PROD_LINE,BATCHNO,MEMO) "
  3064. + " VALUES('Q235B/Q355B两小时内的批次','"+material_no+"','ZHBCYK','"+pline_code+"',"
  3065. + " '"+batch_no+"','"+logmemo+"') ";
  3066. mapper.insert(sql3);
  3067. sql="";
  3068. sql="select * from qcm_jhy_sample_consign_d t "
  3069. +" where t.RZ_OLD_SAMPL_NO = '"+rz_old_sampl_no+"' and RZ_MIXROLL is null and RZ_ROLL_SLAB_SEQ like '每块%' ";
  3070. List<HashMap> lists2=mapper.query(sql.toString());
  3071. if (lists2 !=null && lists2.size()>=1) {
  3072. return "已进行过批次内其他批号钢板每批号按要求取实物样进行判定! 不可重复操作!";
  3073. }
  3074. //查询出最初抽样轧批号
  3075. sql="";
  3076. sql="select * from qcm_jhy_sample_consign_d t "
  3077. +" where t.SPECIMEN_NO = '"+rz_old_sampl_no+"' and rownum=1 ";
  3078. List<HashMap> lists3=mapper.query(sql.toString());
  3079. String batch_no2 = lists3.get(0).get("BATCH_NO").toString();
  3080. //取其它轧批实物样
  3081. if (smp_type_code.equals("1")){
  3082. //预测 把全部的初复样获取
  3083. sql="";
  3084. sql="select * from qcm_jhy_sample_consign_d t "
  3085. +" where t.RZ_OLD_SAMPL_NO = '"+rz_old_sampl_no+"' "
  3086. +" and t.RZ_MIXROLL= '"+rz_mixroll+"'"
  3087. +" or t.BATCH_NO<>'"+batch_no+"' or t.BATCH_NO<>'"+batch_no2+"' ";
  3088. List<HashMap> lists4=mapper.query(sql.toString());
  3089. sql="";
  3090. sql = " update QCM_JHY_SAMPLE_CONSIGN_D t "
  3091. + " set t.RZ_MIXROLL='' "
  3092. + " where t.BATCH_NO in ('"+batch_no+"','"+batch_no2+"') ";
  3093. mapper.UpdateQcmWt(sql.toString());
  3094. for (HashMap hashMap : lists4) {
  3095. if(hashMap.get("SMP_TYPE_CODE").equals("1")){
  3096. continue;
  3097. }
  3098. //判断有没有复样
  3099. sql="";
  3100. sql="select * from qcm_jhy_sample_consign_d t "
  3101. +" where t.RZ_OLD_SAMPL_NO = '"+rz_old_sampl_no+"' "
  3102. +" and t.RZ_MIXROLL= '"+rz_mixroll+"'"
  3103. +" and t.BATCH_NO='"+hashMap.get("BATCH_NO")+"' and t.SMP_TYPE_CODE='1' ";
  3104. List<HashMap> lists5=mapper.query(sql.toString());
  3105. if(lists5!=null && lists5.size()>=1){
  3106. sql="";
  3107. sql = " update Qcm_Jhy_Sample_r_Ord t "
  3108. + " set t.JUDGE_STATUS='3',INSPECTION_LOT='',MEMO='每块取样' "
  3109. + " where t.SMP_NO = '"+(String)lists5.get(0).get("SMP_NO")+"' ";
  3110. mapper.UpdateQcmWt(sql.toString());
  3111. sql="";
  3112. sql = " update QCM_JHY_SAMPLE_CONSIGN_D t "
  3113. + " set t.RZ_MIXROLL='' "
  3114. + " where t.SMP_NO = '"+(String)lists5.get(0).get("SMP_NO")+"' ";
  3115. mapper.UpdateQcmWt(sql.toString());
  3116. //把初样检验号还原
  3117. sql="";
  3118. sql = " update Qcm_Jhy_Sample_r_Ord t "
  3119. + " set INSPECTION_LOT='"+hashMap.get("INSPECTION_LOT")+"' "
  3120. + " where t.SMP_NO = '"+(String)hashMap.get("SMP_NO")+"' ";
  3121. mapper.UpdateQcmWt(sql.toString());
  3122. }
  3123. sql="";
  3124. sql = " update QCM_JHY_SAMPLE_CONSIGN_D t "
  3125. + " set t.STATUS = '0',t.RZ_MIXROLL='',t.RZ_ROLL_SLAB_SEQ='复样不合格送实物样',ONEMEMO='"+batch_no+"'||'复样不合格' "
  3126. + " where t.SPECIMEN_NO = '"+(String)hashMap.get("SPECIMEN_NO")+"' ";
  3127. mapper.UpdateQcmWt(sql.toString());
  3128. sql="";
  3129. sql = " update Qcm_Jhy_Sample_r_Ord t "
  3130. + " set t.PHY_ID = '',t.JUDGE_STATUS='',JUDGE_RESULT_CODE='',JUDGE_RESULT_DESC='',"
  3131. + " JUDGE_NAME='',JUDGE_TIME='',JUDGE_MEMO='' "
  3132. + " where t.SMP_NO = '"+(String)hashMap.get("SMP_NO")+"' ";
  3133. mapper.UpdateQcmWt(sql.toString());
  3134. sql="";
  3135. sql = " update zj_result_all@xgcx t "
  3136. + " set t.PHYSRESULT = '0',t.PHYSRESULT_DESC='',PHYSID='',PIC_IS_LOCK='' "
  3137. + " where t.BILLETID_JY = '"+(String)hashMap.get("INSPECTION_LOT")+"' ";
  3138. mapper.UpdateQcmWt(sql.toString());
  3139. String logmemo2="复样不合格批号:"+batch_no+','+rz_mixroll+','+rz_old_sampl_no;
  3140. String sql4= "INSERT INTO QCM_JUDGE_OPERATE_LOG (OPERATE_TYPE,PARAMS,OPERATE_NAME,PROD_LINE,BATCHNO,MEMO) "
  3141. + " VALUES('Q235B/Q355B两小时内的批次','"+hashMap.get("MATERIAL_NO")+"','ZHBCYK','"+pline_code+"',"
  3142. + " '"+hashMap.get("BATCH_NO")+"','"+logmemo2+"') ";
  3143. mapper.insert(sql4);
  3144. }
  3145. }/*else{
  3146. //最初抽样轧批号
  3147. if(!StringUtils.isBlank(lists.get(0).get("RZ_ROLL_SLAB_SEQ").toString())){
  3148. String rz_roll_slab_seq = lists.get(0).get("RZ_ROLL_SLAB_SEQ").toString();
  3149. if("(实)实物样".equals(rz_roll_slab_seq)){
  3150. sql="";
  3151. sql="select * from qcm_jhy_sample_consign_d t "
  3152. +" where t.RZ_OLD_SAMPL_NO = '"+rz_old_sampl_no+"' "
  3153. +" and t.RZ_MIXROLL= '"+rz_mixroll+"'"
  3154. +" or t.BATCH_NO<>'"+batch_no2+"' ";
  3155. List<HashMap> lists4=mapper.query(sql.toString());
  3156. for (HashMap hashMap : lists4) {
  3157. sql="";
  3158. sql = " update QCM_JHY_SAMPLE_CONSIGN_D t "
  3159. + " set t.STATUS = '0',t.RZ_MIXROLL='',t.RZ_ROLL_SLAB_SEQ='每块(实)实物样',ONEMEMO='"+batch_no+"'||'最初预测抽样实物按质量设计不合格' "
  3160. + " where t.SPECIMEN_NO = '"+(String)hashMap.get("SPECIMEN_NO")+"' ";
  3161. mapper.UpdateQcmWt(sql.toString());
  3162. sql="";
  3163. sql = " update Qcm_Jhy_Sample_r_Ord t "
  3164. + " set t.PHY_ID = '',t.JUDGE_STATUS='',JUDGE_RESULT_CODE='',JUDGE_RESULT_DESC='',"
  3165. + " JUDGE_NAME='',JUDGE_TIME='',JUDGE_MEMO='' "
  3166. + " where t.SMP_NO = '"+(String)hashMap.get("SMP_NO")+"' ";
  3167. mapper.UpdateQcmWt(sql.toString());
  3168. sql="";
  3169. sql = " update zj_result_all@xgcx t "
  3170. + " set t.PHYSRESULT = '0',t.PHYSRESULT_DESC='',PHYSID='',PIC_IS_LOCK='' "
  3171. + " where t.BILLETID_JY = '"+(String)hashMap.get("INSPECTION_LOT")+"' ";
  3172. mapper.UpdateQcmWt(sql.toString());
  3173. }
  3174. }else{
  3175. return smpNo+"当前试样号不是最初抽样轧批号!";
  3176. }
  3177. }else{
  3178. return smpNo+"当前试样号不是最初抽样轧批号!";
  3179. }
  3180. }*/
  3181. SqlSession.commit();
  3182. } catch (Exception e) {
  3183. e.printStackTrace();
  3184. SqlSession.rollback();
  3185. } finally {
  3186. SqlSession.close();
  3187. }
  3188. return "成功";
  3189. }
  3190. //卷板件件取样
  3191. public void doRzLtevery(JSONObject list){
  3192. String materialNo= list.getString("MATERIAL_NO").toString();
  3193. String lw = materialNo.substring(materialNo.length() - 1,materialNo.length());//截取后一位判断是否是小卷
  3194. if(!"0".equals(lw)){//不等于0的都是小卷
  3195. return;
  3196. }
  3197. String sql = " select * from qcm_jhy_sample_consign_d t,qcm_jhy_sample_r_ord r "
  3198. +" where t.smp_no = r.smp_no and r.smp_no = '"+list.getString("QLTY_SMP_NO")+"' and rownum = 1 ";
  3199. List<HashMap> hm = mapper.query(sql.toString());
  3200. if(hm!=null && hm.size()>=1){
  3201. String design_key = hm.get(0).get("DESIGN_KEY").toString();
  3202. String psc = hm.get(0).get("PSC").toString();
  3203. String thick = hm.get(0).get("THICK").toString();
  3204. String batch_no = hm.get(0).get("BATCH_NO").toString();
  3205. sql = "select t.* from qcm_jhy_sample_consign_d t,qcm_jhy_sample_r_ord r "
  3206. +" where t.smp_no = r.smp_no "
  3207. +" and r.design_key = '"+design_key+"' "
  3208. +" and r.psc = '"+psc+"' "
  3209. +" and r.thick = '"+thick+"' "
  3210. +" and r.batch_no = '"+batch_no+"' "
  3211. +" and t.smp_type_code = '0' "
  3212. //+" and t.ARTIFICIAL_MEMO is null "
  3213. +" and r.Judge_Result_Code is not null "
  3214. +" and rownum = 1 ";
  3215. List<HashMap> hashMap = mapper.query(sql.toString());
  3216. if(hashMap!=null && hashMap.size()>=1){
  3217. String smpNo = createQltySamNo(hashMap.get(0).get("PLINE_CODE").toString());
  3218. String specimen_no = createSpecimen_no(smpNo);
  3219. String inspectionLot = createQltyInspectionLot(batch_no);
  3220. String sqlstr = "insert into qcm_jhy_sample_consign_m "
  3221. +" (smp_no,heat_no,batch_no,inspection_lot,board_no,material_no,psc,psc_desc, "
  3222. +" smp_catg,cert_inst_code,cert_inst_name,smp_type_code,smp_type_name, "
  3223. +" grade_code,grade_name, pline_code, pline_name,validflag,create_time) "
  3224. +" select '"+smpNo+"',heat_no,batch_no,'"+inspectionLot+"',board_no,'"+list.getString("MATERIAL_NO")+"',psc,psc_desc, "
  3225. +" smp_catg,cert_inst_code,cert_inst_name,smp_type_code,smp_type_name, "
  3226. +" grade_code,grade_name,pline_code,pline_name,validflag,sysdate "
  3227. +" from qcm_jhy_sample_consign_m t "
  3228. +" where t.smp_no = '"+hashMap.get(0).get("SMP_NO").toString()+"' ";
  3229. mapper.insert(sqlstr);
  3230. sqlstr="";
  3231. sqlstr = "insert into qcm_jhy_sample_r_ord "
  3232. +" (design_key, smp_no, psc, psc_desc, heat_no, batch_no, inspection_lot, delivery_state_code, delivery_state_desc, thick, width, "
  3233. +" length, pline_code, pline_name, msc_pline, process_code, cert_inst_code, cert_inst_name, smp_type_code, smp_type_name, "
  3234. +" prod_code, prod_name, steel_code, steel_name, std_code, std_name, create_time) "
  3235. +" select design_key, '"+smpNo+"', psc, psc_desc, heat_no, batch_no, '"+inspectionLot+"', delivery_state_code, delivery_state_desc, thick, width, "
  3236. +" length,pline_code, pline_name, msc_pline, process_code, cert_inst_code, cert_inst_name, smp_type_code, smp_type_name, "
  3237. +" prod_code,prod_name, steel_code, steel_name, std_code, std_name, sysdate "
  3238. +" from qcm_jhy_sample_r_ord t "
  3239. +" where t.smp_no = '"+hashMap.get(0).get("SMP_NO").toString()+"' ";
  3240. mapper.insert(sqlstr);
  3241. String uuidstr = this.getUUID();
  3242. sqlstr="";
  3243. sqlstr="insert into qcm_jhy_sample_consign_d "
  3244. +" (smp_no, specimen_no, heat_no, batch_no, inspection_lot, freq_code, freq_name, material_no, "
  3245. +" smp_type_code, smp_type_name,test_qty, smp_qty, smp_location,board_no,pline_code, "
  3246. +" pline_name, status, validflag, source,guid, chem_item, product_cnt, create_time, "
  3247. +" smp_location_code, memo, weight, weight_std, weight_sfd,process_no,process_nos, process_code) "
  3248. +" select "
  3249. +" '"+smpNo+"', '"+specimen_no+"', heat_no, batch_no, '"+inspectionLot+"', freq_code, freq_name, '"+list.getString("MATERIAL_NO")+"', "
  3250. +" '3','件件取样',test_qty, smp_qty, smp_location,board_no,pline_code, "
  3251. +" pline_name, '0', validflag, source,'"+uuidstr+"',chem_item, product_cnt, sysdate, "
  3252. +" smp_location_code,memo, weight, weight_std, weight_sfd,process_no,process_nos, process_code "
  3253. +" from qcm_jhy_sample_consign_d t where t.smp_no = '"+hashMap.get(0).get("SMP_NO").toString()+"' ";
  3254. mapper.insert(sqlstr);
  3255. sqlstr="";
  3256. sqlstr="insert into qcm_jhy_sample_consign_d_item "
  3257. +" (specimen_no, seq, smp_no, phy_name_l, phy_code_l, phy_code_m, phy_name_m, phy_code_s, phy_name_s, "
  3258. +" item_code_d, item_name_d, item_code_t, item_name_t, item_code_s, item_name_s, item_code_l, item_desc_l, "
  3259. +" stdmin_sign, stdmin, stdmax_sign, stdmax, test_qty, smp_qty, specl_fl, isjudge, judge_basis, phy_unit, "
  3260. +" group_seq, create_id, create_name, create_time, stdmemo,phy_group_code) "
  3261. +" select "
  3262. +" '"+specimen_no+"', seq, '"+smpNo+"', phy_name_l, phy_code_l, phy_code_m, phy_name_m, phy_code_s, phy_name_s, "
  3263. +" item_code_d, item_name_d, item_code_t, item_name_t, item_code_s, item_name_s, item_code_l, item_desc_l, "
  3264. +" stdmin_sign, stdmin, stdmax_sign, stdmax, test_qty, smp_qty, specl_fl, isjudge, judge_basis, phy_unit, "
  3265. +" group_seq, create_id, create_name, sysdate, stdmemo,phy_group_code "
  3266. +" from qcm_jhy_sample_consign_d_item t where t.specimen_no = '"+hashMap.get(0).get("SPECIMEN_NO").toString()+"' ";
  3267. mapper.insert(sqlstr);
  3268. if((list.getString("PLINE_CODE").equals("RZ1") || list.getString("PLINE_CODE").equals("LT1")) && list.getString("TYPE").equals("3")){
  3269. if(list.getString("PLINE_CODE").equals("RZ1")){//2月21日改成LIKE形式
  3270. String rzmaterialNo=list.getString("MATERIAL_NO").substring(0,12);
  3271. String rzlt=" update qcm_judge_coil_result set PIC_IS_LOCK='0',PHYSRESULT = '0', PHYSRESULT_DESC = '待判', inspection_lot = '"+inspectionLot+"' "
  3272. +" where coil_no like '"+rzmaterialNo+"%' ";
  3273. mapper.updateJudgeStatus(rzlt.toString());
  3274. rzlt="";
  3275. rzlt=" update tbh02_coil_comm set SAMPL_NO = '"+inspectionLot+"' where OLD_SAMPL_NO like '"+rzmaterialNo+"%' ";
  3276. mapper.updateJudgeStatus(rzlt.toString());
  3277. }else{
  3278. String rzlt=" update qcm_judge_coil_result set PIC_IS_LOCK='0',PHYSRESULT = '0', PHYSRESULT_DESC = '待判', inspection_lot = '"+inspectionLot+"' "
  3279. +" where coil_no = '"+list.getString("MATERIAL_NO")+"' ";
  3280. mapper.updateJudgeStatus(rzlt.toString());
  3281. rzlt="";
  3282. rzlt=" update C_TBC02_COIL_COMM set SMP_NO = '"+inspectionLot+"' where OLD_SAMPL_NO = '"+list.getString("MATERIAL_NO")+"' ";
  3283. mapper.updateJudgeStatus(rzlt.toString());
  3284. }
  3285. }
  3286. }
  3287. }
  3288. }
  3289. }