| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637 |
- package QCM.JHY01.JHY0101;
- import java.math.BigDecimal;
- import java.sql.ResultSet;
- import java.sql.SQLException;
- import java.text.SimpleDateFormat;
- import java.util.ArrayList;
- import java.util.Date;
- import java.util.HashMap;
- import java.util.List;
- import java.util.TreeSet;
- import java.util.UUID;
- import org.apache.commons.lang.StringUtils;
- import org.apache.ibatis.session.SqlSession;
- import org.apache.log4j.Logger;
- import com.alibaba.fastjson.JSON;
- import com.alibaba.fastjson.JSONArray;
- import com.alibaba.fastjson.JSONObject;
- import CoreFS.SA01.CoreIComponent;
- import CoreFS.SA06.CoreReturnObject;
- import QCM.COMMUNAL.communalClass;
- import QCM.COMMUNAL.VO.QcmJhySampleROrd;
- import QCM.JHY01.VO.JhyQltyModel;
- import QCM.JHY01.VO.JhySampleDItemModel;
- import QCM.JHY01.VO.JhySampleDModel;
- public class DuplicateSample2 extends CoreIComponent {
- SqlSession SqlSession = QCM.COMMUNAL.SqlSessionBuilder.openSqlSession();
- QCM.COMMUNAL.OrderSqMapper mapper = SqlSession.getMapper(QCM.COMMUNAL.OrderSqMapper.class);
- Logger logger = Logger.getLogger(this.getClass().getName());
-
- public boolean DSampleLogo =false;//判断是否是复样块块取样
- public boolean DSampleLogo2 =false;//件件取样 标识
- public Integer heGold2 = 1;//线棒 金相数 判断第一个金相是否已做 已做 第二个金相就不用再做
- public Integer LT1A08 = 1;//连退 常温拉伸 峰值密度
- public boolean ZFMotherboard = false;//16中厚板按母板取样
- public boolean motherboard = true;//是否标识生成D表用到
- public String ZHmaterialNo ="";//中厚板复样取样材料号
- public synchronized String doDuplicateSample(JSONArray list) {
- logger.info("复样:==========复样" + list.toString());
- DuplicateSampleLog(list.toString(), "复样委托");// 插入日志
- String msg = checkInfo(list);
- if (!"".equals(msg)) {
- return msg;
- }
- try {
- // 当前试样号复样情况,不考虑引用状况
- createQltySample(list);
- createChemSample(list);
- SqlSession.commit();
- } catch (Exception e) {
- // TODO: handle exception
- logger.error(e.toString() + e.getMessage() + "复样委托:json数据:" + list.toString() + "\n");
- System.out.println("复样委托失败:json数据:" + list.toString() + "\n"+e.getMessage());
- e.printStackTrace();
- SqlSession.rollback();
- } finally {
- SqlSession.close();
- }
- if ("".equals(msg)) {
- return "1";
- } else {
- System.out.println("复样委托失败:json数据:" + list.toString() + "\n");
- return "生成失败!";
- }
- }
- private void createChemSample(JSONArray lists) {
- // TODO Auto-generated method stub
- StringBuffer sqlucomm = new StringBuffer();
- for (Object li : lists) {
- JSONObject list = (JSONObject) li;
- // 判断是否存在材质
- if (!"1".equals(list.getString("IS_CHEM"))) {
- continue;
- }
- String YNSql=" select t.* from qcm_jhy_sample_consign_d t,qcm_jhy_sample_r_ord r "
- +" where t.smp_no = r.smp_no and t.CHEM_ITEM is not null "
- +" and t.batch_no = '"+list.getString("BATCH_NO")+"' "
- +" and t.inspection_lot = '"+list.getString("INSPECTION_LOT")+"' "
- +" and t.Smp_Type_Name = '复样' "
- +" and r.psc = '"+list.getString("PSC")+"' "
- +" and to_char(r.THICK, 'fm990.099') = to_char('"+list.getString("THICK")+"', 'fm990.099') ";
- List<HashMap> results2 = mapper.query(YNSql.toString());
- if(results2 !=null && results2.size()>=1){
- continue;//判断是否已复样
- }
- sqlucomm.setLength(0);
- sqlucomm.append(
- "select t.smp_no,t.specimen_no,t.heat_no,t.batch_no,t.inspection_lot,t.freq_code,t.freq_name,");
- sqlucomm.append("t.material_no,t.smp_type_code,t.smp_type_name,t.consign_no,t.consign_no_seq,t.test_qty,");
- sqlucomm.append("t.smp_qty,t.smp_location,t.board_no,t.quote_consign_no,t.old_consign_no,t.pline_code,");
- 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,");
- sqlucomm.append(
- " t.chem_item,t.product_cnt,t.create_time,t.smp_location_code from QCM_JHY_SAMPLE_CONSIGN_D t inner join "
- + "QCM_JUDGE_CHEMICAL c on t.smp_no=c.smp_no and t.smp_no='" + list.getString("QLTY_SMP_NO")
- + "' and c.cic_result_code='2' and rownum <= 1 ");
- List<HashMap> results = mapper.query(sqlucomm.toString());
- if (results == null || results.size() < 1) {
- continue;
- }
- String specimen_no = "";
- String smpNo = createQltySamNo((String) results.get(0).get("PLINE_CODE"));
- String sql ="Insert into QCM_JHY_SAMPLE_CONSIGN_M(SMP_NO,HEAT_NO,BATCH_NO,INSPECTION_LOT,BOARD_NO,MATERIAL_NO,PSC, "
- +" PSC_DESC,SMP_CATG,CERT_INST_CODE,CERT_INST_NAME,SMP_TYPE_CODE,SMP_TYPE_NAME,GRADE_CODE,GRADE_NAME, "
- +" PLINE_CODE,PLINE_NAME,VALIDFLAG,MEMO,CREATE_ID,CREATE_NAME,CREATE_TIME,ITEM_FLAG,DUPLICATE_SAMPLE) "
- +" select '"+smpNo+"',HEAT_NO,BATCH_NO,INSPECTION_LOT,BOARD_NO,MATERIAL_NO,PSC, "
- +" PSC_DESC,SMP_CATG,CERT_INST_CODE,CERT_INST_NAME,SMP_TYPE_CODE,SMP_TYPE_NAME,GRADE_CODE,GRADE_NAME, "
- +" PLINE_CODE,PLINE_NAME,VALIDFLAG,MEMO,'sys','sys',sysdate,ITEM_FLAG,'复样' "
- +" from QCM_JHY_SAMPLE_CONSIGN_M t where t.SMP_NO = '"+list.getString("QLTY_SMP_NO")+"' and rownum <= 1 ";
- mapper.insert(sql);
-
- sql = "";
- sql = "Insert into QCM_JHY_SAMPLE_R_ORD(DESIGN_KEY,SMP_NO,PSC,PSC_DESC,HEAT_NO,BATCH_NO,INSPECTION_LOT,DELIVERY_STATE_CODE, "
- + " DELIVERY_STATE_DESC,THICK,WIDTH,LENGTH,PLINE_CODE,PLINE_NAME,MSC_PLINE,PROCESS_CODE,CERT_INST_CODE,CERT_INST_NAME, "
- + " SMP_TYPE_CODE,SMP_TYPE_NAME,SMELTING_CNT,PRODUCT_CNT,JUDGE_STATUS,PROD_CODE,"
- + " PROD_NAME,STEEL_CODE,STEEL_NAME,STD_CODE,STD_NAME,CREATE_TIME,CREATE_ID,CREATE_NAME,DUPLICATE_SAMPLE) "
- + " select DESIGN_KEY,'"+smpNo+"',PSC,PSC_DESC,HEAT_NO,BATCH_NO,INSPECTION_LOT,DELIVERY_STATE_CODE,DELIVERY_STATE_DESC, "
- + " THICK,WIDTH,LENGTH,PLINE_CODE,PLINE_NAME,MSC_PLINE,PROCESS_CODE,CERT_INST_CODE,CERT_INST_NAME,SMP_TYPE_CODE,"
- + " SMP_TYPE_NAME,SMELTING_CNT,PRODUCT_CNT,'0',PROD_CODE,PROD_NAME,STEEL_CODE, "
- + " STEEL_NAME,STD_CODE,STD_NAME,sysdate,'sys','sys','复样' "
- + " from QCM_JHY_SAMPLE_R_ORD t where t.SMP_NO = '"+list.getString("QLTY_SMP_NO")+"' and rownum <= 1 ";
- mapper.insert(sql);
-
- //把已经判定的ORD检验号置空 ord先插入后修改
- sql = "";
- sql =" update QCM_JHY_SAMPLE_R_ORD t set t.INSPECTION_LOT = '' "
- + " where t.batch_no = '"+list.getString("BATCH_NO")+"'"
- + " and t.smp_no = '"+list.getString("QLTY_SMP_NO")+"' "
- + " and t.judge_status = '1' ";
- mapper.updateJudgeStatus(sql.toString());
-
- String sqlD="select '"+smpNo+"' as smp_no,t.specimen_no,t.heat_no,t.batch_no,t.inspection_lot,t.freq_code, "
- +" t.freq_name,t.material_no,t.smp_type_code,t.smp_type_name,t.consign_no,t.consign_no_seq, "
- +" t.test_qty,t.smp_qty,t.smp_location,t.board_no,t.quote_consign_no,t.old_consign_no, "
- +" t.pline_code,t.pline_name,t.validflag,t.source,t.guid,t.MEMO,t.PROCESS_NO,t.PROCESS_NOS, "
- +" t.chem_item,t.product_cnt,t.create_time,t.smp_location_code "
- +" from QCM_JHY_SAMPLE_CONSIGN_D t ,QCM_JUDGE_CHEMICAL c "
- +" 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 ";
- List<HashMap> hmresult = mapper.query(sqlD.toString());
- for (HashMap result : hmresult) {
- // 生成新的复样的取样编号
- specimen_no = createSpecimen_no(smpNo);
- JhySampleDModel model = getSampleD(specimen_no, result);
- model.setSmp_type_code("0");//成分复样 复样类型代码用0 因为在自动判定时成分用的是0
- mapper.insertSampleD(model);
- }
-
- }
- }
- private JhySampleDModel getSampleD(String specimen_no, HashMap result) {
- // TODO Auto-generated method stub
- JhySampleDModel model = new JhySampleDModel();
- model.setSmp_no((String) result.get("SMP_NO"));
- model.setSpecimen_no(specimen_no);
- model.setHeat_no((String) result.get("HEAT_NO"));
- model.setBatch_no((String) result.get("BATCH_NO"));
-
- model.setInspection_lot((String) result.get("INSPECTION_LOT"));
- // 22.08.11 获取不同的取样材料号 判断是否件件取样 非件件取样 查询取样材料号
- String materialNo = "";
- if(!DSampleLogo2){//非件件取样
- materialNo = getBilletIdM((String) result.get("PLINE_CODE"), (String) result.get("BATCH_NO"));
- }else if(!DSampleLogo && DSampleLogo2){//高线小于六吊 件件取样 DSampleLogo:false && DSampleLogo2:true 初样不合格件件取样
- materialNo = getBilletIdM((String) result.get("PLINE_CODE"), (String) result.get("BATCH_NO"));
- }
- //中厚板按母板取样
- if(ZFMotherboard){
- materialNo = "";
- }
- if (StringUtils.isBlank(materialNo)) {
- model.setMaterial_no((String) result.get("MATERIAL_NO"));// 取样材料号
- if(result.get("PLINE_CODE").equals("HB1") || result.get("PLINE_CODE").equals("ZB1")){
- String MATERIAL_NO1 = (String) result.get("MATERIAL_NO");
- String boardNo=MATERIAL_NO1.substring(0, MATERIAL_NO1.lastIndexOf("."));
- model.setBoard_no(boardNo);
- }else{
- model.setBoard_no((String) result.get("BOARD_NO"));
- }
- } else {
- model.setMaterial_no(materialNo);
- if(result.get("PLINE_CODE").equals("HB1") || result.get("PLINE_CODE").equals("ZB1")){
- String MATERIAL_NO1 = materialNo;
- String boardNo=MATERIAL_NO1.substring(0, MATERIAL_NO1.lastIndexOf("."));
- model.setBoard_no(boardNo);
- }else{
- model.setBoard_no((String) result.get("BOARD_NO"));
- }
- }
- if(result.get("PLINE_CODE").equals("HB1") || result.get("PLINE_CODE").equals("ZB1")){
- model.setRz_mixroll((String) result.get("RZ_MIXROLL"));
- model.setRz_old_sampl_no((String) result.get("RZ_OLD_SAMPL_NO"));
- if(ZHmaterialNo.equals("复样")){//中厚板 力学复样 取样材料号一致
- model.setMaterial_no((String) result.get("MATERIAL_NO"));// 取样材料号
- }
- //model.setImprove_memo((String) result.get("IMPROVE_MEMO"));//性能改善
- }
- model.setFreq_code((String) result.get("FREQ_CODE"));
- model.setFreq_name((String) result.get("FREQ_NAME"));
- // 试验次数
- model.setTest_qty((BigDecimal) result.get("TEST_QTY"));
- model.setSmp_qty((BigDecimal) result.get("SMP_QTY"));
- //中厚板按母板取样
- if(ZFMotherboard){
- model.setSmp_type_code("4");
- model.setSmp_type_name("按母板取样");
- }else{
- // 件件取样
- if(DSampleLogo2){
- model.setSmp_type_code("3");
- model.setSmp_type_name("件件取样");
- }else{
- model.setSmp_type_code("1");
- model.setSmp_type_name("复样");
- }
- }
- model.setSmp_location((String) result.get("SMP_LOCATION"));
- model.setSmp_location_code((String) result.get("SMP_LOCATION_CODE"));
- // 初样取样编号(复样不能为空)
- model.setOld_consign_no((String) result.get("SPECIMEN_NO"));
- model.setPline_code((String) result.get("PLINE_CODE"));
- model.setPline_name((String) result.get("PLINE_NAME"));
- model.setValidflag("1");
- model.setStatus("0");
- model.setSource("0");
- model.setProduct_cnt((BigDecimal) result.get("PRODUCT_CNT"));
- model.setChem_item((String) result.get("CHEM_ITEM"));
- model.setGuid(this.getUUID());
- model.setMemo((String) result.get("MEMO"));
- model.setWeight((String)result.get("WEIGHT"));
- model.setWeight_std((String)result.get("WEIGHT_STD"));
- model.setWeight_sfd((String)result.get("WEIGHT_SFD"));
- model.setProcess_no((String)result.get("PROCESS_NO"));
- model.setProcess_nos((String)result.get("PROCESS_NOS"));
- model.setProcess_code((String)result.get("PROCESS_CODE"));
- return model;
- }
- /**
- * 查询 取样材料号
- *
- * @param parmas
- * @return
- */
- public String getBilletIdM(String plineCode, String batchNo) {
- String plineCode2 ="";
- if (plineCode.equals("BC2")) {
- plineCode2 = "4001BC2";
- }
- if (plineCode.equals("GX2")) {
- plineCode2 = "4001GX2";
- }
- if (plineCode.equals("GX1")) {
- plineCode2 = "4001GX1";
- }
- String materialNo = "";
- String sql = "";
- if (plineCode.equals("BC2") || plineCode.equals("GX2") || plineCode.equals("GX1")) {
- sql = " select t.pline_code,t.MATERIAL_NO, t.NUMS from ( "
- + " select productline pline_code, BILLETID as MATERIAL_NO,Substr(BILLETID, instr(BILLETID, '.') + 1, length(BILLETID)) NUMS from kch_turnofflist@xgcx where BILLETID like '"
- + batchNo + "'||'%' union "
- + " select productline pline_code, BILLETID as MATERIAL_NO,Substr(BILLETID, instr(BILLETID, '.') + 1, length(BILLETID)) NUMS from kcz_turnofflist@xgcx where BILLETID like '"
- + batchNo + "'||'%' union "
- + " select pld pline_code, BILLETID as MATERIAL_NO,Substr(BILLETID, instr(BILLETID, '.') + 1, length(BILLETID)) NUMS from kcx_turnofflist@xgcx where BILLETID like '"
- + batchNo + "'||'%' " + " ) t "
- + " where t.MATERIAL_NO not in (select d.material_no from QCM_JHY_SAMPLE_CONSIGN_D d where d.material_no like '"
- + batchNo + "'||'%') " + " and t.pline_code = '" + plineCode2 + "' "
- + " order by CAST(t.NUMS AS int) ";
- }
- if (plineCode.equals("HB1") || plineCode.equals("ZB1")) {
- sql = " select t.pline_code, t.MATERIAL_NO, t.NUMS from ( "
- + " select productline pline_code, BILLETID as MATERIAL_NO,Substr(BILLETID, instr(BILLETID, '.') + 1, length(BILLETID)) NUMS from kch_turnofflist@xgcx where BILLETID like '"
- + batchNo + "'||'%' union "
- + " select productline pline_code, BILLETID as MATERIAL_NO,Substr(BILLETID, instr(BILLETID, '.') + 1, length(BILLETID)) NUMS from kcz_turnofflist@xgcx where BILLETID like '"
- + batchNo + "'||'%' union "
- + " select pld pline_code, BILLETID as MATERIAL_NO,Substr(BILLETID, instr(BILLETID, '.') + 1, length(BILLETID)) NUMS from kcx_turnofflist@xgcx where BILLETID like '"
- + batchNo + "'||'%' " + " ) t "
- + " where t.MATERIAL_NO not in (select d.material_no from QCM_JHY_SAMPLE_CONSIGN_D d where d.material_no like '"
- + batchNo + "'||'%') ";
- }
- if (!StringUtils.isBlank(sql)) {
- List<HashMap> listEle = mapper.query(sql.toString());
- if (listEle != null && listEle.size() > 0) {
- materialNo = (String) listEle.get(0).get("MATERIAL_NO");
- System.out.println("0轧批号" + batchNo + "===" + materialNo);
- }
- }
- return materialNo;
- }
- /**
- * 当前试样号复样情况,不考虑引用状况
- */
- private void createQltySample(JSONArray lists) throws Exception {
- boolean blfy =false;//判断是否是复样
- StringBuffer sqlucomm = new StringBuffer();
- String IMPROVE_MEMO="";
- //type 1复样 8/3件件取样 16中厚板按母板件件取样
- for (Object li : lists) {
- blfy =false;
- DSampleLogo = false;
- DSampleLogo2 = false;
- ZFMotherboard = false;
- motherboard = false;
- JSONObject list = (JSONObject) li;
-
- // 判断是否存在材质
- if (!"1".equals(list.getString("IS_QTLY"))) {
- continue;
- }
-
- //19限制 19不复样
- 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%' ";
- List<HashMap> strdkhm = mapper.query(strdk.toString());
- if(strdkhm!=null && strdkhm.size()>=1){
- break;
- }
- //卷板件件取样
- if("3".equals(list.getString("TYPE")) && (list.getString("PLINE_CODE").equals("RZ1") || list.getString("PLINE_CODE").equals("LT1"))){
- String materialNo = list.getString("MATERIAL_NO").substring(0,12);
- String rzSQL= "select * from qcm_jhy_sample_consign_d t where t.smp_type_code = '3' "
- + " and t.batch_no = '"+list.getString("BATCH_NO")+"' and t.material_no like '"+materialNo+"%' ";
- List<HashMap> hmrz = mapper.query(rzSQL.toString());
- if(hmrz!=null && hmrz.size()>=1){
- continue;
- }
- doRzLtevery(list);
- continue;
- }
- if("1".equals(list.getString("TYPE")) && (list.getString("PLINE_CODE").equals("HB1") || list.getString("PLINE_CODE").equals("ZB1"))){
- String smpNo=list.getString("QLTY_SMP_NO");//and d.freq_code<>'D'
- 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, "
- +" d.IMPROVE_MEMO from qcm_jhy_sample_consign_d d,qcm_jhy_sample_r_ord r "
- +" where d.smp_no = r.smp_no and r.smp_no ='"+smpNo+"' and rownum<=1 ";
- List<HashMap> log = mapper.query(sql.toString());
- if(log!=null && log.size()>=1){
- sql="";
- String freqCodeStr=log.get(0).get("FREQ_CODE").toString();
- if(!freqCodeStr.equals("D") && !freqCodeStr.equals("B") && !freqCodeStr.equals("C") && !freqCodeStr.equals("H") && !freqCodeStr.equals("I")){
- sql="select * from qcm_jhy_sample_consign_d d,qcm_jhy_sample_r_ord r "
- +" where d.smp_no = r.smp_no "
- +" and r.design_key ='"+log.get(0).get("DESIGN_KEY")+"' "
- +" and r.steel_code ='"+log.get(0).get("STEEL_CODE")+"' "
- +" and r.thick ='"+log.get(0).get("THICK")+"' "
- +" and r.Cert_Inst_Code ='"+log.get(0).get("CERT_INST_CODE")+"' "
- +" and d.Smp_Location ='"+log.get(0).get("SMP_LOCATION")+"' "
- +" and d.Smp_Type_Code='1' "
- +" and d.freq_code<>'D' "
- +" and nvl(d.PHY_ITEM,'null') <> '非金属夹杂A细系,非金属夹杂A粗系,非金属夹杂B细系,非金属夹杂B粗系,非金属夹杂C细系,非金属夹杂C粗系,非金属夹杂D细系,非金属夹杂D粗系,DS单颗粒球状类' "
- +" and r.BATCH_NO ='"+log.get(0).get("BATCH_NO")+"'";
- }else if(freqCodeStr.equals("B")){
- sql="select * from qcm_jhy_sample_consign_d d,qcm_jhy_sample_r_ord r "
- +" where d.smp_no = r.smp_no "
- +" and r.design_key ='"+log.get(0).get("DESIGN_KEY")+"' "
- +" and r.steel_code ='"+log.get(0).get("STEEL_CODE")+"' "
- +" and r.thick ='"+log.get(0).get("THICK")+"' "
- +" and r.Cert_Inst_Code ='"+log.get(0).get("CERT_INST_CODE")+"' "
- +" and d.Smp_Location ='"+log.get(0).get("SMP_LOCATION")+"' "
- +" and d.Smp_Type_Code='1' "
- +" and d.freq_code<>'D' "
- +" and d.BOARD_NO='"+log.get(0).get("BOARD_NO")+"' "
- +" and r.BATCH_NO ='"+log.get(0).get("BATCH_NO")+"' ";
- }else if(freqCodeStr.equals("C") || freqCodeStr.equals("H") || freqCodeStr.equals("I")){
- sql="select * from qcm_jhy_sample_consign_d d,qcm_jhy_sample_r_ord r "
- +" where d.smp_no = r.smp_no "
- +" and r.design_key ='"+log.get(0).get("DESIGN_KEY")+"' "
- +" and r.steel_code ='"+log.get(0).get("STEEL_CODE")+"' "
- +" and r.thick ='"+log.get(0).get("THICK")+"' "
- +" and r.Cert_Inst_Code ='"+log.get(0).get("CERT_INST_CODE")+"' "
- +" and d.Smp_Location ='"+log.get(0).get("SMP_LOCATION")+"' "
- +" and d.Smp_Type_Code='1' "
- +" and d.freq_code<>'D' "
- +" and d.MATERIAL_NO='"+log.get(0).get("MATERIAL_NO")+"' "
- +" and r.BATCH_NO ='"+log.get(0).get("BATCH_NO")+"'";
- }else if(freqCodeStr.equals("D")){
- String heatNo = log.get(0).get("HEAT_NO").toString().substring(0, 9);
- sql="select * from qcm_jhy_sample_consign_d t where t.heat_no like '"+heatNo+"%' "
- +" and t.pline_code in ('ZB1', 'HB1') and t.freq_code = 'D' and t.smp_type_code = '1' ";
- List<HashMap> log2 = mapper.query(sql.toString());
- if(log2!=null && log2.size()>=1){
- continue;
- }
-
- String fyhz="select * from qcm_jhy_sample_consign_d t where t.heat_no like '"+heatNo+"%' and t.pline_code in ('ZB1', 'HB1') "
- +" and t.freq_code = 'D' AND T.BATCH_NO <> '"+log.get(0).get("BATCH_NO")+"' AND T.QUOTE_CONSIGN_NO IS NOT NULL ";
- List<HashMap> HMFYHZ = mapper.query(fyhz.toString());
- if(HMFYHZ!=null && HMFYHZ.size()>=2){
- String fyhzt="select r.* from qcm_jhy_sample_consign_d t,qcm_jhy_sample_r_ord r where t.smp_no = r.smp_no "
- +" and t.heat_no like '"+heatNo+"%' and t.pline_code in ('ZB1', 'HB1') and t.freq_code = 'D' "
- +" AND T.BATCH_NO <> '"+log.get(0).get("BATCH_NO")+"' "
- +" AND T.QUOTE_CONSIGN_NO IS NOT NULL and r.Judge_Status is not null and r.judge_result_code is not null ";
- List<HashMap> HMFYHZT = mapper.query(fyhzt.toString());
- if(HMFYHZT==null || HMFYHZT.size()<2){
- continue;
- }
- }
-
- }
- List<HashMap> log2 = mapper.query(sql.toString());
- if(log2!=null && log2.size()>=1){
- continue;
- }
- }
- }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"))){
- String batch_no=list.getString("BATCH_NO");
- String sql="select * from qcm_jhy_sample_consign_d d,qcm_jhy_sample_r_ord r "
- +" where d.smp_no = r.smp_no and r.BATCH_NO ='"+batch_no+"' and d.Smp_Type_Code='1' ";
- List<HashMap> log = mapper.query(sql.toString());
- if(log!=null && log.size()>=1){
- sql="";
- sql =" update QCM_JHY_SAMPLE_R_ORD t set t.INSPECTION_LOT = '' "
- + " where t.batch_no like '%"+list.getString("BATCH_NO")+"%'"
- + " and t.psc like '%"+list.getString("PSC")+"%' "
- + " and t.judge_status = '1' ";
- mapper.updateJudgeStatus(sql.toString());
- }
- }
-
-
- //type 1复样 3件件取样 16中厚板按母板件件取样
- if("16".equals(list.getString("TYPE"))){
- ZFMotherboard =true;//中厚板按母板取样
- motherboard =true;//母板生成D表用到
- }else if("3".equals(list.getString("TYPE"))){//其它
- //22.08.22 判断是初样不合格 还是复样不合格 smp_type_code 0初样 1复样
- sqlucomm.setLength(0);
- sqlucomm.append(
- "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 "
- + " where r.batch_no like '%" + list.getString("BATCH_NO") + "%' and r.IS_PASS='1' and d.smp_type_code = '1' ");
- List<HashMap> hmCnum = mapper.query(sqlucomm.toString());
- BigDecimal bigd = (BigDecimal) hmCnum.get(0).get("CNUM");
- String bigd2 = bigd.toString();
- Integer bigd3 = Integer.parseInt(bigd2);
- if(bigd3 !=0 && bigd3 > 0){
- blfy = true;
- }
- DSampleLogo = true;
- }
-
- //按母板取样
- if(ZFMotherboard){
- /*sqlucomm.setLength(0);
- sqlucomm.append(" select max(t.SMP_TYPE_CODE) SMP_TYPE_CODE from QCM_JHY_SAMPLE_CONSIGN_D t, qcm_jhy_sample_r_ord r "
- + " where t.smp_no = r.smp_no and t.batch_no like '%" + list.getString("BATCH_NO") + "%' and t.smp_type_code in ('0','1') "
- + " and r.psc = '"+list.getString("PSC")+"' and to_char(r.thick, 'fm990.099') = to_char('"+list.getString("THICK")+"', 'fm990.099') ");
- List<HashMap> hmCnumj = mapper.query(sqlucomm.toString());
- String bigdjs = (String) hmCnumj.get(0).get("SMP_TYPE_CODE");
- Integer bigd4 = Integer.parseInt(bigdjs);*/
- if(list.getString("PLINE_CODE").equals("HB1") || list.getString("PLINE_CODE").equals("ZB1") ){
- sqlucomm.setLength(0);
- sqlucomm.append(
- "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, "
- + " 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 "
- + " 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 ");
- }else{
- //按母板取样
- sqlucomm.setLength(0);
- 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') ");
- List<HashMap> hmCnumj = mapper.query(sqlucomm.toString());
- String bigdjs = (String) hmCnumj.get(0).get("SMP_TYPE_CODE");
- Integer bigd4 = Integer.parseInt(bigdjs);
- sqlucomm.setLength(0);
- sqlucomm.append(
- "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.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 "
- + " 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 ");
- }
-
- }else{//其它产线
-
-
- //如果是件件取样 判定取样材料号是否是用过
- if(DSampleLogo){
- if(!list.getString("PLINE_CODE").equals("YT1")){
- sqlucomm.setLength(0);
- sqlucomm.append(" select count(1) CNUM from QCM_JHY_SAMPLE_CONSIGN_D t where t.material_no = '"+list.getString("MATERIAL_NO")+"' ");
- List<HashMap> hmCnumj = mapper.query(sqlucomm.toString());
- BigDecimal bigdj = (BigDecimal) hmCnumj.get(0).get("CNUM");
- String bigdjs = bigdj.toString();
- Integer bigd4 = Integer.parseInt(bigdjs);
- if(bigd4 !=0 && bigd4 > 0){
- continue;
- }
- }
- }
-
- sqlucomm.setLength(0);
- if(blfy){
- //22.08.22 复样不合格
- 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.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 "
- + " 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 ");
- }else{
- if(list.getString("PLINE_CODE").equals("GX1") || list.getString("PLINE_CODE").equals("GX2") || list.getString("PLINE_CODE").equals("BC2")){
- // 查询试样号向下的检验结果
- 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.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 "
- + " 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 ");
- }else{
- if(list.getString("PLINE_CODE").equals("HB1") || list.getString("PLINE_CODE").equals("ZB1") ){
- if(list.getString("HJ_NAME").toString().equals("1")){//HJ_NAME:夹杂 1 ,力学 0
- // 查询试样号向下的检验结果
- 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, "
- + " 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 "
- + " 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' "
- + " and r.Phy_Code_l = 'HJ' order by r.smp_no ");
- List<HashMap> hmap = mapper.query(sqlucomm.toString());
- if(hmap == null || hmap.size() < 1){
- String heatNo = list.getString("HEAT_NO").toString().substring(0, 9);
- sqlucomm.setLength(0);
- 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, "
- + " 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 "
- + " 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 "
- + " 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) "
- + " and r.IS_PASS='1' and d.smp_type_code = '0' and r.Phy_Code_l = 'HJ' order by r.smp_no ");
- }
- }else if(list.getString("HJ_NAME").toString().equals("0")){
- 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, "
- + " 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 "
- + " join qcm_jhy_sample_r_ord o on r.smp_no = o.smp_no and r.phy_id = o.phy_id "
- + " 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' "
- + " order by r.smp_no,r.PHY_CODE_L,r.PHY_CODE_S ");
- }else{
- // 查询试样号向下的检验结果
- 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, "
- + " 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 "
- + " join qcm_jhy_sample_r_ord o on r.smp_no = o.smp_no and r.phy_id = o.phy_id "
- + " 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' "
- + " order by r.smp_no,r.PHY_CODE_L,r.PHY_CODE_S ");
- }
- }else{
- // 查询试样号向下的检验结果
- 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.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 "
- + " 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' "
- + " order by r.smp_no,r.PHY_CODE_L,r.PHY_CODE_S ");
- }
- }
- ZHmaterialNo="";
- ZHmaterialNo="复样";
- }
- }
- // 得到判定不合格的项目
- List<HashMap> results = mapper.query(sqlucomm.toString());
- logger.info("复样-查询有那些项目不合格-sql:" + sqlucomm.toString());
- logger.info("复样-查询有那些项目不合格-项目:" + results.toString());
- if (results == null || results.size() < 1) {
- continue;
- }/*else if((list.getString("PLINE_CODE").equals("HB1") || list.getString("PLINE_CODE").equals("ZB1")) && results.get(0).get("IMPROVE_MEMO")!=null){
- IMPROVE_MEMO=results.get(0).get("IMPROVE_MEMO").toString();
- }*/
- // 判断是否存在夹杂内控按炉取样不合格的项目,如果存在需要走另外的逻辑
- boolean isJz = false;
- List<HashMap> jzResource = null;
- String old_spefcial_no = null;
- HashMap sampleMJz = null;
- TreeSet<String> hjsets = new TreeSet<String>();
- String phyCodeLHJ = "0";//判断是否是引用/被引用
- for (HashMap result : results) {
- // 如果是夹杂的,需要验证是否存在内控按炉取样的项目
- if ("HJ".equals(((String) result.get("PHY_CODE_L"))) && !ZFMotherboard && result.get("FREQ_CODE").equals("D")
- && (result.get("PLINE_CODE").equals("HB1") || result.get("PLINE_CODE").equals("ZB1"))) {
- /* sqlucomm.setLength(0);
- sqlucomm.append(
- "SELECT DESIGN_KEY,PSC,SMP_TYPE_CODE,CERT_INST_CODE,BATCH_NO FROM QCM_JHY_SAMPLE_R_ORD WHERE SMP_NO='"
- + result.get("SMP_NO") + "'");
- // 试样号与合同信息关系表
- List<HashMap> resultsM = mapper.query(sqlucomm.toString());
- if (resultsM == null || resultsM.size() < 1) {
- continue;
- }
- // 根据合同信息和项目找到复样倍数信息
- HashMap sampleM = resultsM.get(0);
- sampleMJz = resultsM.get(0);
- sqlucomm.setLength(0);
- sqlucomm.append(
- "SELECT * FROM QCM_ORD_DESIGN_SAMPLE_M WHERE DESIGN_KEY='" + sampleM.get("DESIGN_KEY") + "'"
- + " and PSC='" + sampleM.get("PSC") + "' and SAMPLE_STYLE_CODE='"
- + sampleM.get("SMP_TYPE_CODE") + "' and ORG_CODE='" + sampleM.get("CERT_INST_CODE")
- + "' " + " and RATE_CODE='D' and PHY_CODE_L='HJ' AND SPECL_FL='2' ");
- sqlucomm.append(" and SMP_POSITION_CODE='" + result.get("SMP_LOCATION_CODE") + "'");
- jzResource = mapper.query(sqlucomm.toString());
- // 判断是不是内控按炉的夹杂
- if (jzResource == null || jzResource.size() < 1) {
- continue;
- }
- // 获取引用取样编号
- if (result.get("QUOTE_CONSIGN_NO") != null) {
- old_spefcial_no = (String) result.get("QUOTE_CONSIGN_NO");
- }
-
- result.put("SPECL_FL", "2");// 代表是内控的
- result.put("IS_JZ", "1");
-
-
- isJz = true;
- break;*/
-
- String heatNo = result.get("HEAT_NO").toString().substring(0, 9);//一共10位 截取9位 最后一位字母不要
- String strPlineCode = "";
- if(!result.get("PLINE_CODE").equals("ZB1") && !result.get("PLINE_CODE").equals("HB1") ){
- strPlineCode = " and t.pline_code = '"+result.get("PLINE_CODE")+"' ";
- }else{
- strPlineCode = " and t.pline_code in ('ZB1','HB1') ";
- }
- //判断是否是按炉的夹杂
- sqlucomm.setLength(0);
- sqlucomm.append(" select count(1) cnum from QCM_JHY_SAMPLE_CONSIGN_D t "
- + " where t.HEAT_NO like '"+heatNo+"%' "
- + " AND t.batch_no like '%"+list.getString("BATCH_NO")+"%' and t.FREQ_CODE = 'D' and T.QUOTE_CONSIGN_NO is null ");
- sqlucomm.append(strPlineCode);
- List<HashMap> hashMaplist2 = mapper.query(sqlucomm.toString());
- BigDecimal cou2 = (BigDecimal) hashMaplist2.get(0).get("CNUM");
- String coun2 = cou2.toString();
- Integer integ2 = Integer.parseInt(coun2);
- if(integ2>=1){
- hjsets.add("1");//按炉引用夹杂
- if("1".equals(list.getString("TYPE"))){//判断夹杂是否已经复样过 复样过不能再次复样
- String sqlfy = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D t "
- + " where heat_no like '"+heatNo+"%' "
- + " and smp_type_code = '1' and FREQ_CODE ='D' "
- + strPlineCode;
- List<HashMap> hmCnum = mapper.query(sqlfy.toString());
- if(hmCnum != null && hmCnum.size() > 1){//夹杂按炉复样 一定大于1 复样两个轧批
- return;
- }
- sqlfy="";
- sqlfy = "select * from qcm_jhy_sample_r_ord r,qcm_jhy_sample_consign_d t "
- +" where r.smp_no=t.smp_no and t.freq_code = 'D' "
- +" and t.heat_no like '"+heatNo+"%' "
- +" and r.Judge_Result_Code is not null and t.batch_no <> '"+list.getString("BATCH_NO")+"' "
- + strPlineCode;
- List<HashMap> hmCnum2 = mapper.query(sqlfy.toString());
- if(hmCnum2 == null || hmCnum2.size() <=0 ){//夹杂按炉判定要大于1 不包括初样送样的轧批号
- return;
- }
- }
- }else{
- phyCodeLHJ = "1";//跳出循环
- }
-
- }else{
- hjsets.add("2");
- }
- }
-
- // 存在夹杂内控按炉取样的另辟蹊径
- /*if (isJz) {
- // 1:得到判定不合格的项目 2:根据合同信息和项目找到复样倍数信息 3:引用取样编号
- // 4:传过来的值复样(判定)5:试样号与合同信息关系表数据
- createJznkSample(results, jzResource, old_spefcial_no, list, sampleMJz);
- continue;
- }*/
-
-
- heGold2 = 1;//金相数 判断第一个金相是否已做 已做 第二个金相就不用再做
- LT1A08 = 1;//连退 常温拉伸 峰值密度
- //22.08.18 按轧批号 把所有的项目拿到 但是生成是只能生成到一个试样号中
- String smpNolist = (String) results.get(0).get("SMP_NO");
- String plineCode1 = (String) results.get(0).get("PLINE_CODE");
- for (HashMap result : results) {
- String hjphycodel= "0";
-
- if (result.get("PLINE_CODE").equals("HB1") || result.get("PLINE_CODE").equals("ZB1")) {
- //判断是不是夹杂按炉取样
- if ("HJ".equals(((String) result.get("PHY_CODE_L"))) && !ZFMotherboard && result.get("FREQ_CODE").equals("D")) {
-
- String heatNo = result.get("HEAT_NO").toString().substring(0, 9);//一共10位 截取9位 最后一位字母不要
- String strPlineCode = "";
- if(!result.get("PLINE_CODE").equals("ZB1") && !result.get("PLINE_CODE").equals("HB1") ){
- strPlineCode = " and pline_code = '"+result.get("PLINE_CODE")+"' ";
- }else{
- strPlineCode = " and pline_code in ('ZB1','HB1') ";
- }
-
- for (String string : hjsets) {
- if(string.equals("1")){//夹杂按炉
- hjphycodel = "1";
- break;
- }
- }
- if(hjphycodel.equals("1")){//夹杂按炉
- //判断是初样不合格 还是复样不合格 smp_type_code 0初样 1复样
- sqlucomm.setLength(0);
- sqlucomm.append(
- "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 "
- + " where r.heat_no like '"+heatNo+"%' and r.IS_PASS='1' and d.smp_type_code = '1' ");
- sqlucomm.append(strPlineCode);
- List<HashMap> hmCnum = mapper.query(sqlucomm.toString());
- BigDecimal bigd = (BigDecimal) hmCnum.get(0).get("CNUM");
- String bigd2 = bigd.toString();
- Integer bigd3 = Integer.parseInt(bigd2);
- if(bigd3 !=0 && bigd3 > 0){
- blfy = true;
- DSampleLogo = true;
- }
-
- //判断是不是当前被引用的轧批号
- sqlucomm.setLength(0);
- sqlucomm.append(" select count(1) cnum from QCM_JHY_SAMPLE_CONSIGN_D t "
- + " where t.batch_no like '%"+list.getString("BATCH_NO")+"%'"
- + " and t.heat_no like '"+heatNo+"%' and t.QUOTE_CONSIGN_NO is null ");
- sqlucomm.append(strPlineCode);
- List<HashMap> hmCnum3 = mapper.query(sqlucomm.toString());
- BigDecimal num = (BigDecimal) hmCnum3.get(0).get("CNUM");
- String num6 = num.toString();
- Integer num7 = Integer.parseInt(num6);
- if(num7 !=0 && num7 > 0){
- ZHmaterialNo="";
- createJznkSample2(result);
- continue;
- }
-
- }
-
- }
- }
-
- result.put("SMP_NO", smpNolist);
- result.put("PLINE_CODE", plineCode1);
- if((list.getString("PLINE_CODE").equals("HB1") || list.getString("PLINE_CODE").equals("ZB1")) && list.getString("TYPE").equals("1") ){
- //中厚板复样子板号一样
- }else{
- result.put("MATERIAL_NO", list.getString("MATERIAL_NO"));
- }
- cteateOtherQtly(result, sqlucomm);
- }
-
-
- //判断是否小于六吊 如果小于六吊 true !true 非件件取样
- if(!DSampleLogo2 && !ZFMotherboard){
- //查询这个试样号 生成了几个复样 拿到 试样号 取样编号 轧批号
- sqlucomm.setLength(0);
- sqlucomm.append(" select t.* from QCM_JHY_SAMPLE_CONSIGN_D t "
- + " where t.batch_no like '%"+list.getString("BATCH_NO")+"%'"
- + " and t.smp_no = '"+smpNolist+"' and t.smp_type_code = '1' and t.STATUS = '0' order by t.specimen_no asc ");
- List<HashMap> hashlist = mapper.query(sqlucomm.toString());
- if(hashlist == null || hashlist.size() <= 0){
- continue;
- }
-
- //非件件取样
- //22.09.01 从新生成一条全新的试样号做为判定smpNolist
- String smpNo = createQltySamNo((String) results.get(0).get("PLINE_CODE"));
- String sql ="Insert into QCM_JHY_SAMPLE_CONSIGN_M(SMP_NO,HEAT_NO,BATCH_NO,INSPECTION_LOT,BOARD_NO,MATERIAL_NO,PSC, "
- +" PSC_DESC,SMP_CATG,CERT_INST_CODE,CERT_INST_NAME,SMP_TYPE_CODE,SMP_TYPE_NAME,GRADE_CODE,GRADE_NAME, "
- +" PLINE_CODE,PLINE_NAME,VALIDFLAG,MEMO,CREATE_ID,CREATE_NAME,CREATE_TIME,ITEM_FLAG,DUPLICATE_SAMPLE) "
- +" select '"+smpNo+"',HEAT_NO,BATCH_NO,INSPECTION_LOT,BOARD_NO,MATERIAL_NO,PSC, "
- +" PSC_DESC,SMP_CATG,CERT_INST_CODE,CERT_INST_NAME,SMP_TYPE_CODE,SMP_TYPE_NAME,GRADE_CODE,GRADE_NAME, "
- +" PLINE_CODE,PLINE_NAME,VALIDFLAG,MEMO,'sys','sys',sysdate,ITEM_FLAG,'复样' "
- +" from QCM_JHY_SAMPLE_CONSIGN_M t where t.SMP_NO = '"+list.getString("QLTY_SMP_NO")+"' and rownum <= 1 ";
- mapper.insert(sql);
-
- sql = "";
- sql = "Insert into QCM_JHY_SAMPLE_R_ORD(DESIGN_KEY,SMP_NO,PSC,PSC_DESC,HEAT_NO,BATCH_NO,INSPECTION_LOT,DELIVERY_STATE_CODE, "
- + " DELIVERY_STATE_DESC,THICK,WIDTH,LENGTH,PLINE_CODE,PLINE_NAME,MSC_PLINE,PROCESS_CODE,CERT_INST_CODE,CERT_INST_NAME, "
- + " SMP_TYPE_CODE,SMP_TYPE_NAME,SMELTING_CNT,PRODUCT_CNT,ASSAY_NO_CP,ASSAY_NO_RL,CIC_ID,JUDGE_STATUS,PROD_CODE,"
- + " PROD_NAME,STEEL_CODE,STEEL_NAME,STD_CODE,STD_NAME,CREATE_TIME,CREATE_ID,CREATE_NAME,DUPLICATE_SAMPLE) "
- + " select DESIGN_KEY,'"+smpNo+"',PSC,PSC_DESC,HEAT_NO,BATCH_NO,INSPECTION_LOT,DELIVERY_STATE_CODE,DELIVERY_STATE_DESC, "
- + " THICK,WIDTH,LENGTH,PLINE_CODE,PLINE_NAME,MSC_PLINE,PROCESS_CODE,CERT_INST_CODE,CERT_INST_NAME,SMP_TYPE_CODE,"
- + " SMP_TYPE_NAME,SMELTING_CNT,PRODUCT_CNT,ASSAY_NO_CP,ASSAY_NO_RL,CIC_ID,'0',PROD_CODE,PROD_NAME,STEEL_CODE, "
- + " STEEL_NAME,STD_CODE,STD_NAME,sysdate,'sys','sys','复样' "
- + " from QCM_JHY_SAMPLE_R_ORD t where t.SMP_NO = '"+list.getString("QLTY_SMP_NO")+"' and rownum <= 1 ";
- mapper.insert(sql);
-
- //把已经判定的ORD检验号置空 ord先插入后修改
- //20230605增加卷板
- sql = "";
- if(plineCode1.equals("ZB1") || plineCode1.equals("HB1") || plineCode1.equals("RZ1") || plineCode1.equals("LT1") || plineCode1.equals("YT1")){
- sql =" update QCM_JHY_SAMPLE_R_ORD t set t.INSPECTION_LOT = '' "
- + " where t.batch_no like '%"+list.getString("BATCH_NO")+"%'"
- + " and t.psc like '%"+list.getString("PSC")+"%' "
- //+ " and to_char(t.thick, 'fm990.099') = to_char('"+list.getString("THICK")+"', 'fm990.099') "
- + " and t.smp_no = '"+list.getString("QLTY_SMP_NO")+"' "
- + " and t.judge_status = '1' ";
- }else{
- sql =" update QCM_JHY_SAMPLE_R_ORD t set t.INSPECTION_LOT = '' "
- + " where t.batch_no like '%"+list.getString("BATCH_NO")+"%'"
- + " and t.psc like '%"+list.getString("PSC")+"%' "
- + " and t.judge_status = '1' ";
- }
- mapper.updateJudgeStatus(sql.toString());
-
-
- //查询这个试样号 生成了几个复样 拿到 试样号 取样编号 轧批号
- sqlucomm.setLength(0);
- sqlucomm.append(" select t.* from QCM_JHY_SAMPLE_CONSIGN_D t "
- + " where t.batch_no like '%"+list.getString("BATCH_NO")+"%'"
- + " and t.smp_no = '"+smpNolist+"' and t.smp_type_code = '1' and t.STATUS = '0' order by t.specimen_no asc ");
- List<HashMap> hashMaplist = mapper.query(sqlucomm.toString());
-
- //生成几个复样
- sqlucomm.setLength(0);
- sqlucomm.append(" select count(1) cnum from QCM_JHY_SAMPLE_CONSIGN_D t "
- + " where t.batch_no like '%"+list.getString("BATCH_NO")+"%'"
- + " and t.smp_no = '"+smpNolist+"' and t.smp_type_code = '1' and t.STATUS = '0' ");
- List<HashMap> hashMaplist2 = mapper.query(sqlucomm.toString());
- BigDecimal cou2 = (BigDecimal) hashMaplist2.get(0).get("CNUM");
- String coun2 = cou2.toString();
- Integer integ2 = Integer.parseInt(coun2);//生成了几个复样
-
- //获取最后一个取样编号 引用初样结果
- String specimenNoZy = "";
- //修改试样号 取样编号
- for(int i=0; i<integ2; i++){
- //截取取样编号后两位
- String specimenNo = hashMaplist.get(i).get("SPECIMEN_NO").toString();
- String lw = specimenNo.substring(specimenNo.length() - 2,specimenNo.length());
- //修改试样号
- sqlucomm.setLength(0);
- sqlucomm.append(" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t set t.smp_no = '"+smpNo+"',t.specimen_no ='"+smpNo+"'||'"+lw+"' ");
- sqlucomm.append(" where t.specimen_no = '"+hashMaplist.get(i).get("SPECIMEN_NO")+"' ");
- mapper.updateJudgeStatus(sqlucomm.toString());
-
- sqlucomm.setLength(0);
- sqlucomm.append(" update QCM_JHY_SAMPLE_CONSIGN_D t set t.smp_no = '"+smpNo+"',t.specimen_no ='"+smpNo+"'||'"+lw+"' ");
- sqlucomm.append(" where t.smp_no = '"+hashMaplist.get(i).get("SMP_NO")+"'"
- + " and t.specimen_no = '"+hashMaplist.get(i).get("SPECIMEN_NO")+"' "
- + " and t.batch_no like '%"+hashMaplist.get(i).get("BATCH_NO")+"%' ");
- mapper.updateJudgeStatus(sqlucomm.toString());
- specimenNoZy = smpNo + lw;
- }
-
- String sqlrownum = "";
- if(list.getString("PLINE_CODE").equals("HB1") || list.getString("PLINE_CODE").equals("ZB1") || plineCode1.equals("RZ1") || plineCode1.equals("LT1")
- || plineCode1.equals("YT1")){
- sqlrownum = " and t.SMP_NO like '%"+list.getString("QLTY_SMP_NO")+"%' and rownum = 1";
- sqlucomm.setLength(0);
- sqlucomm.append(" select t.SPECIMEN_NO,t.smp_type_code from QCM_JHY_SAMPLE_CONSIGN_D t "
- +" where t.smp_no in (select t.smp_no "
- +" from Qcm_Jhy_Sample_r_Ord t "
- +" where t.batch_no like '%"+list.getString("BATCH_NO")+"%' "
- + " and t.psc like '%"+list.getString("PSC")+"%' "+sqlrownum+" ) ");
- }else{
- //引用初样实绩
- //查询这个试样号 轧批号 获取初样所有取样编号
- sqlucomm.setLength(0);
- sqlucomm.append(" select t.SPECIMEN_NO,t.smp_type_code from QCM_JHY_SAMPLE_CONSIGN_D t "
- +" where t.smp_type_code = '0' "
- +" and t.smp_no in (select t.smp_no "
- +" from Qcm_Jhy_Sample_r_Ord t "
- +" where t.batch_no like '%"+list.getString("BATCH_NO")+"%' "
- + " and t.psc like '%"+list.getString("PSC")+"%' "+sqlrownum+" ) ");
- }
- List<HashMap> hmap = mapper.query(sqlucomm.toString());
-
- for (HashMap hm : hmap) {
- String quoteStatus = (String)hm.get("SMP_TYPE_CODE");//取样类型
- //查询当前初样取样编号的所有实绩
- sql = "";
- if(list.getString("PLINE_CODE").equals("HB1") || list.getString("PLINE_CODE").equals("ZB1")){
- sql = "select t.specimen_no,t.seq,t.test_qty from QCM_JHY_INSP_PHYSICS t "
- + " where t.specimen_no = '"+(String)hm.get("SPECIMEN_NO")+"' and t.seq<50 ";
- }else{
- sql = "select t.specimen_no,t.seq,t.test_qty from QCM_JHY_INSP_PHYSICS t "
- + " where t.specimen_no = '"+(String)hm.get("SPECIMEN_NO")+"'";
- }
- List<HashMap> hmPhysics = mapper.query(sql.toString());
-
- for (HashMap hashMap : hmPhysics) {
- //获取specimenNoZy取样编号 seq最大值
- sql = "";
- sql = "select decode(max(seq),'','49',max(seq))+1 as SEQ from QCM_JHY_INSP_PHYSICS t "
- + " where t.specimen_no = '"+specimenNoZy+"'";
- List<HashMap> seqhm = mapper.query(sql.toString());
- BigDecimal big = (BigDecimal)seqhm.get(0).get("SEQ");
- String seqs = big.toString();
- Integer seqint = Integer.parseInt(seqs);
- sql = "";
- sql = " insert into QCM_JHY_INSP_PHYSICS "
- +" (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, "
- +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
- +" VAL13,VAL14,VAL15,AVG_VAL,GUID,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, "
- +" PHY_UNIT,MEMO,QUOTE_SPECIMEN_NO,QUOTE_STATUS) "
- +" 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, "
- +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
- +" VAL13,VAL14,VAL15,AVG_VAL,GUID,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, "
- +" PHY_UNIT,MEMO,'"+(String)hashMap.get("SPECIMEN_NO")+"','0' from QCM_JHY_INSP_PHYSICS t "
- + " where t.specimen_no = '"+(String)hashMap.get("SPECIMEN_NO")+"' "
- + "and t.seq = '"+hashMap.get("SEQ")+"' "
- + "and t.test_qty = '"+hashMap.get("TEST_QTY")+"' ";
- mapper.insert(sql);
-
- sql = "";
- sql = "insert into QCM_JHY_SAMPLE_CONSIGN_D_ITEM "
- +" (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_SPECIMEN_NO,QUOTE_SEQ,ITEM_FLAG,MEMO,CREATE_ID,CREATE_NAME,CREATE_TIME,STDMEMO,RESMP_SEQ, "
- +" PHY_GROUP_CODE,FY_QUOTE_SPECIMEN_NO,FY_QUOTE_STATUS) "
- +" select '"+specimenNoZy+"','"+seqint+"','"+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_SPECIMEN_NO,QUOTE_SEQ,ITEM_FLAG,MEMO,CREATE_ID,CREATE_NAME,CREATE_TIME,STDMEMO,RESMP_SEQ, "
- +" PHY_GROUP_CODE,'"+(String)hashMap.get("SPECIMEN_NO")+"','0' from QCM_JHY_SAMPLE_CONSIGN_D_ITEM "
- + " where specimen_no = '"+(String)hashMap.get("SPECIMEN_NO")+"' "
- + "and seq = '"+hashMap.get("SEQ")+"' ";
- mapper.insert(sql);
- }
- }
-
- }else{
- String smpTypeCode ="3";//默认为件件取样
- String smpTypeName ="件件取样";
- if(ZFMotherboard){
- //母板取样
- smpTypeCode = "4";
- smpTypeName ="母板取样";
- }
- //件件取样
- //查询这个试样号 生成了几个件件取样 拿到 试样号 取样编号 轧批号
- sqlucomm.setLength(0);
- sqlucomm.append(" select t.* from QCM_JHY_SAMPLE_CONSIGN_D t "
- + " where t.batch_no like '%"+list.getString("BATCH_NO")+"%'"
- + " and t.smp_no = '"+smpNolist+"' and t.smp_type_code = '"+smpTypeCode+"' and t.STATUS = '0' order by t.specimen_no asc ");
- List<HashMap> hashMaplist = mapper.query(sqlucomm.toString());
- if(hashMaplist == null || hashMaplist.size() <= 0){
- continue;
- }
- //生成几个件件取样
- sqlucomm.setLength(0);
- sqlucomm.append(" select count(1) cnum from QCM_JHY_SAMPLE_CONSIGN_D t "
- + " where t.batch_no like '%"+list.getString("BATCH_NO")+"%'"
- + " and t.smp_no = '"+smpNolist+"' and t.smp_type_code = '"+smpTypeCode+"' and t.STATUS = '0' ");
- List<HashMap> hashMaplist2 = mapper.query(sqlucomm.toString());
- BigDecimal cou2 = (BigDecimal) hashMaplist2.get(0).get("CNUM");
- String coun2 = cou2.toString();
- Integer integ2 = Integer.parseInt(coun2);//生成了几个件件取样
- for(int i=0; i<integ2; i++){
- String smpNo = createQltySamNo((String) results.get(0).get("PLINE_CODE"));
- String inspectionLot = createQltyInspectionLot(list.getString("BATCH_NO"));
- String sql ="Insert into QCM_JHY_SAMPLE_CONSIGN_M(SMP_NO,HEAT_NO,BATCH_NO,INSPECTION_LOT,BOARD_NO,MATERIAL_NO,PSC, "
- +" PSC_DESC,SMP_CATG,CERT_INST_CODE,CERT_INST_NAME,SMP_TYPE_CODE,SMP_TYPE_NAME,GRADE_CODE,GRADE_NAME, "
- +" PLINE_CODE,PLINE_NAME,VALIDFLAG,MEMO,CREATE_ID,CREATE_NAME,CREATE_TIME,ITEM_FLAG,DUPLICATE_SAMPLE) "
- +" select '"+smpNo+"',HEAT_NO,BATCH_NO,'"+inspectionLot+"',BOARD_NO,MATERIAL_NO,PSC, "
- +" PSC_DESC,SMP_CATG,CERT_INST_CODE,CERT_INST_NAME,SMP_TYPE_CODE,SMP_TYPE_NAME,GRADE_CODE,GRADE_NAME, "
- +" PLINE_CODE,PLINE_NAME,VALIDFLAG,MEMO,'sys','sys',sysdate,ITEM_FLAG,'"+smpTypeName+"' "
- +" from QCM_JHY_SAMPLE_CONSIGN_M t where t.SMP_NO = '"+smpNolist+"' and rownum <= 1 ";
- mapper.insert(sql);
-
- sql = "";
- sql = "Insert into QCM_JHY_SAMPLE_R_ORD(DESIGN_KEY,SMP_NO,PSC,PSC_DESC,HEAT_NO,BATCH_NO,INSPECTION_LOT,DELIVERY_STATE_CODE, "
- + " DELIVERY_STATE_DESC,THICK,WIDTH,LENGTH,PLINE_CODE,PLINE_NAME,MSC_PLINE,PROCESS_CODE,CERT_INST_CODE,CERT_INST_NAME, "
- + " SMP_TYPE_CODE,SMP_TYPE_NAME,SMELTING_CNT,PRODUCT_CNT,ASSAY_NO_CP,ASSAY_NO_RL,CIC_ID,JUDGE_STATUS,PROD_CODE,"
- + " PROD_NAME,STEEL_CODE,STEEL_NAME,STD_CODE,STD_NAME,CREATE_TIME,CREATE_ID,CREATE_NAME,DUPLICATE_SAMPLE) "
- + " select DESIGN_KEY,'"+smpNo+"',PSC,PSC_DESC,HEAT_NO,BATCH_NO,'"+inspectionLot+"',DELIVERY_STATE_CODE,DELIVERY_STATE_DESC, "
- + " THICK,WIDTH,LENGTH,PLINE_CODE,PLINE_NAME,MSC_PLINE,PROCESS_CODE,CERT_INST_CODE,CERT_INST_NAME,SMP_TYPE_CODE,"
- + " SMP_TYPE_NAME,SMELTING_CNT,PRODUCT_CNT,ASSAY_NO_CP,ASSAY_NO_RL,CIC_ID,'0',PROD_CODE,PROD_NAME,STEEL_CODE, "
- + " STEEL_NAME,STD_CODE,STD_NAME,sysdate,'sys','sys','"+smpTypeName+"' "
- + " from QCM_JHY_SAMPLE_R_ORD t where t.SMP_NO = '"+smpNolist+"' and rownum <= 1 ";
- mapper.insert(sql);
- if(list.getString("PLINE_CODE").equals("HB1") || list.getString("PLINE_CODE").equals("ZB1")
- || list.getString("PLINE_CODE").equals("GX1") || list.getString("PLINE_CODE").equals("BC2")
- || list.getString("PLINE_CODE").equals("GX2") ){
- //修改判定那边的检验号
- if("16".equals(list.getString("TYPE"))){//按母板ZFMotherboard
- String materialNo = (String) hashMaplist.get(i).get("MATERIAL_NO");
- String boardNo = materialNo.substring(0, materialNo.lastIndexOf("."));//H2-50381.1.1
- sqlucomm.setLength(0);
- sqlucomm.append(" update zj_result_all@xgcx t set t.billetid_jy = '"+inspectionLot+"' ");
- sqlucomm.append(" where t.billetid like '"+boardNo+"%' and t.JUDGERESULT='0' ");
- mapper.updateJudgeStatus(sqlucomm.toString());
- }else{//件件取样
- sqlucomm.setLength(0);
- sqlucomm.append(" update zj_result_all@xgcx t set t.billetid_jy = '"+inspectionLot+"' ");
- sqlucomm.append(" where t.billetid = '"+hashMaplist.get(i).get("MATERIAL_NO")+"' ");
- mapper.updateJudgeStatus(sqlucomm.toString());
- }
- }else if((list.getString("PLINE_CODE").equals("RZ1") || list.getString("PLINE_CODE").equals("LT1")) && smpTypeCode.equals("3")){
-
- if(list.getString("PLINE_CODE").equals("RZ1")){//1月22日改成LIKE形式
- String rzmaterialNo=list.getString("MATERIAL_NO").substring(0,12);
- String rzlt=" update qcm_judge_coil_result set PIC_IS_LOCK='0',PHYSRESULT = '0', PHYSRESULT_DESC = '待判', inspection_lot = '"+inspectionLot+"' "
- +" where coil_no like '"+rzmaterialNo+"%' ";
- mapper.updateJudgeStatus(rzlt.toString());
-
- rzlt="";
- rzlt=" update tbh02_coil_comm set SAMPL_NO = '"+inspectionLot+"' where OLD_SAMPL_NO like '"+rzmaterialNo+"%' ";
- mapper.updateJudgeStatus(rzlt.toString());
- }else{
- String rzlt=" update qcm_judge_coil_result set PHYSRESULT = '0', PHYSRESULT_DESC = '待判', inspection_lot = '"+inspectionLot+"' "
- +" where coil_no = '"+list.getString("MATERIAL_NO")+"' ";
- mapper.updateJudgeStatus(rzlt.toString());
-
- rzlt="";
- rzlt=" update C_TBC02_COIL_COMM set SMP_NO = '"+inspectionLot+"' where OLD_SAMPL_NO = '"+list.getString("MATERIAL_NO")+"' ";
- mapper.updateJudgeStatus(rzlt.toString());
- }
-
- }else if(list.getString("PLINE_CODE").equals("YT1") && smpTypeCode.equals("3")){
- String sqlmixRoll = "update QCM_JUDGE_YT_COIL_RESULT "
- + " set INSPECTION_LOT = '"+inspectionLot+"' "
- + " where COIL_NO ='"+list.getString("MATERIAL_NO")+"' ";
- mapper.updateJudgeStatus(sqlmixRoll.toString());
- }
- //截取取样编号后两位
- String specimenNo = hashMaplist.get(i).get("SPECIMEN_NO").toString();
- String lw = specimenNo.substring(specimenNo.length() - 2,specimenNo.length());
- //修改试样号
- sqlucomm.setLength(0);
- sqlucomm.append(" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t set t.smp_no = '"+smpNo+"',t.specimen_no ='"+smpNo+"'||'"+lw+"' ");
- sqlucomm.append(" where t.specimen_no = '"+hashMaplist.get(i).get("SPECIMEN_NO")+"' ");
- mapper.updateJudgeStatus(sqlucomm.toString());
-
- sqlucomm.setLength(0);
- sqlucomm.append(" update QCM_JHY_SAMPLE_CONSIGN_D t set t.inspection_lot='"+inspectionLot+"',t.smp_no = '"+smpNo+"',t.specimen_no ='"+smpNo+"'||'"+lw+"' ");
- sqlucomm.append(" where t.smp_no = '"+hashMaplist.get(i).get("SMP_NO")+"'"
- + " and t.specimen_no = '"+hashMaplist.get(i).get("SPECIMEN_NO")+"' "
- + " and t.batch_no like '%"+hashMaplist.get(i).get("BATCH_NO")+"%' ");
- mapper.updateJudgeStatus(sqlucomm.toString());
- String specimenNoZy = smpNo + lw;
-
- /*if(list.getString("PLINE_CODE").equals("GX1") || list.getString("PLINE_CODE").equals("BC2")
- || list.getString("PLINE_CODE").equals("GX2") ){
- String sqlggb = "update zj_result_all@xgcx t "
- + " set billetid_jy = '"+inspectionLot+"' "
- + " where billetid in (select MATERIAL_NO from QCM_JHY_SAMPLE_CONSIGN_D d"
- + " where d.specimen_no = '"+specimenNoZy+"' and rownum = 1 )";
- mapper.updateJudgeStatus(sqlggb.toString());
- }*/
-
- //引用初样实绩 除了当前取样类型 其它全部复制一遍
- //查询这个试样号 轧批号 获取初样所有取样编号
- String sqlrownum = "";
- sqlucomm.setLength(0);
- /* if(list.getString("PLINE_CODE").equals("HB1") || list.getString("PLINE_CODE").equals("ZB1")){
- sqlrownum = " and t.SMP_NO like '%"+list.getString("QLTY_SMP_NO")+"%' and rownum = 1";
- sqlucomm.append(" select t.SPECIMEN_NO,t.smp_type_code from QCM_JHY_SAMPLE_CONSIGN_D t "
- +" where t.smp_type_code <> '"+smpTypeCode+"' "
- + " and t.smp_no in (select t.smp_no "
- +" from Qcm_Jhy_Sample_r_Ord t "
- +" where t.batch_no like '%"+list.getString("BATCH_NO")+"%' "
- + " and t.psc like '%"+list.getString("PSC")+"%' "+sqlrownum+" ) ");
- }else{
- sqlucomm.append(" select t.SPECIMEN_NO,t.smp_type_code from QCM_JHY_SAMPLE_CONSIGN_D t "
- +" where t.smp_type_code = '0' "
- +" and t.smp_no in (select t.smp_no "
- +" from Qcm_Jhy_Sample_r_Ord t "
- +" where t.batch_no like '%"+list.getString("BATCH_NO")+"%' "
- + " and t.psc like '%"+list.getString("PSC")+"%') ");
- }*/
- //判断中厚板母板/件件取样 当前订单号是否有夹杂 20240918
- String zhfc="0";
- if(list.getString("PLINE_CODE").equals("HB1") || list.getString("PLINE_CODE").equals("ZB1")){
- String sqlFC="select T.* from qcm_jhy_sample_consign_d t where t.Freq_Code = 'D' AND T.INSPECTION_LOT IN ( "
- +" 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 ";
- List<HashMap> HMFC = mapper.query(sqlFC.toString());
- if(HMFC!=null && HMFC.size()>=1){
- zhfc = HMFC.get(0).get("SMP_NO").toString();
- }
- }
- if(!zhfc.equals("0")){
- sqlucomm.append("select d.SPECIMEN_NO,d.smp_type_code,r.Guid "
- +" 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 "
- +" where r.smp_no in ('"+list.getString("QLTY_SMP_NO")+"','"+zhfc+"') "
- +" and r.batch_no like '"+list.getString("BATCH_NO")+"%' "
- +" order by r.smp_no ");
- }else{
- sqlucomm.append("select d.SPECIMEN_NO,d.smp_type_code,r.Guid "
- +" 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 "
- +" where r.smp_no = '"+list.getString("QLTY_SMP_NO")+"' "
- +" and r.batch_no like '"+list.getString("BATCH_NO")+"%' "
- +" order by r.smp_no ");
- }
- List<HashMap> hmap = mapper.query(sqlucomm.toString());
-
- //判断线棒是不是小于五吊直接件件取样
- String xbgb="0";
- if(list.getString("PLINE_CODE").equals("GX1") || list.getString("PLINE_CODE").equals("BC2")
- || list.getString("PLINE_CODE").equals("GX2") ){
- if(hmap.get(0).get("SMP_TYPE_CODE").equals("0")){
- hmap.clear();
- sqlucomm.setLength(0);
- sqlucomm.append(" select t.SPECIMEN_NO,t.smp_type_code from QCM_JHY_SAMPLE_CONSIGN_D t "
- +" where t.smp_type_code = '0' "
- +" and t.smp_no in (select t.smp_no from Qcm_Jhy_Sample_r_Ord t "
- +" where t.batch_no like '%"+list.getString("BATCH_NO")+"%' and t.psc like '%"+list.getString("PSC")+"%') ");
- hmap = mapper.query(sqlucomm.toString());
- xbgb="1";
- }
- }
-
- for (HashMap hm : hmap) {
- String quoteStatus = (String)hm.get("SMP_TYPE_CODE");//取样类型
- //查询当前初样取样编号的所有实绩
- if(xbgb.equals("0")){
- sql = "";
- sql = "select t.specimen_no,t.seq,t.test_qty from QCM_JHY_INSP_PHYSICS t "
- + " where t.specimen_no = '"+(String)hm.get("SPECIMEN_NO")+"' and t.GUID='"+(String)hm.get("GUID")+"' and rownum<=1";
- }else{
- sql = "";
- sql = "select t.specimen_no,t.seq,t.test_qty from QCM_JHY_INSP_PHYSICS t "
- + " where t.specimen_no = '"+(String)hm.get("SPECIMEN_NO")+"' ";
- }
- List<HashMap> hmPhysics = mapper.query(sql.toString());
-
- for (HashMap hashMap : hmPhysics) {
- //获取specimenNoZy取样编号 seq最大值
- sql = "";
- sql = "select decode(max(seq),'','49',max(seq))+1 as SEQ from QCM_JHY_INSP_PHYSICS t "
- + " where t.specimen_no = '"+specimenNoZy+"'";
- List<HashMap> seqhm = mapper.query(sql.toString());
- BigDecimal big = (BigDecimal)seqhm.get(0).get("SEQ");
- String seqs = big.toString();
- Integer seqint = Integer.parseInt(seqs);
- sql = "";
- sql = " insert into QCM_JHY_INSP_PHYSICS "
- +" (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, "
- +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
- +" VAL13,VAL14,VAL15,AVG_VAL,GUID,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, "
- +" PHY_UNIT,MEMO,QUOTE_SPECIMEN_NO,QUOTE_STATUS) "
- +" 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, "
- +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
- +" VAL13,VAL14,VAL15,AVG_VAL,GUID,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, "
- +" PHY_UNIT,MEMO,'"+(String)hashMap.get("SPECIMEN_NO")+"','"+quoteStatus+"' from QCM_JHY_INSP_PHYSICS t "
- + " where t.specimen_no = '"+(String)hashMap.get("SPECIMEN_NO")+"' "
- + "and t.seq = '"+hashMap.get("SEQ")+"' "
- + "and t.test_qty = '"+hashMap.get("TEST_QTY")+"' ";
- mapper.insert(sql);
-
- sql = "";
- sql = "insert into QCM_JHY_SAMPLE_CONSIGN_D_ITEM "
- +" (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_SPECIMEN_NO,QUOTE_SEQ,ITEM_FLAG,MEMO,CREATE_ID,CREATE_NAME,CREATE_TIME,STDMEMO,RESMP_SEQ, "
- +" PHY_GROUP_CODE,FY_QUOTE_SPECIMEN_NO,FY_QUOTE_STATUS) "
- +" select '"+specimenNoZy+"','"+seqint+"','"+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_SPECIMEN_NO,QUOTE_SEQ,ITEM_FLAG,MEMO,CREATE_ID,CREATE_NAME,CREATE_TIME,STDMEMO,RESMP_SEQ, "
- +" PHY_GROUP_CODE,'"+(String)hashMap.get("SPECIMEN_NO")+"','"+quoteStatus+"' from QCM_JHY_SAMPLE_CONSIGN_D_ITEM "
- + " where specimen_no = '"+(String)hashMap.get("SPECIMEN_NO")+"' "
- + "and seq = '"+hashMap.get("SEQ")+"' ";
- mapper.insert(sql);
- }
- }
-
- }
-
- }
-
- }
- }
-
- //夹杂按炉
- private void createJznkSample2(HashMap result) throws Exception {
- String heatNo = result.get("HEAT_NO").toString().substring(0, 9);//一共10位 截取9位 最后一位字母不要
- String strPlineCode = "";
- if(!result.get("PLINE_CODE").equals("ZB1") && !result.get("PLINE_CODE").equals("HB1") ){
- strPlineCode = " and t.pline_code = '"+result.get("PLINE_CODE")+"' ";
- }else{
- strPlineCode = " and t.pline_code in ('ZB1','HB1') ";
- }
-
- StringBuffer sqlucomm = new StringBuffer();
- String sql ="";
- String baent = "0";
- // 查询试样号对应的合同信息
- sqlucomm.setLength(0);
- sqlucomm.append(
- "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='"
- + result.get("SMP_NO") + "'");
- List<HashMap> resultsM = mapper.query(sqlucomm.toString());
- if (resultsM == null || resultsM.size() < 1) {
- return;
- }
- // 根据合同信息和项目找到复样倍数信息
- HashMap sampleM = resultsM.get(0);
- if ("HJ".equals(((String) result.get("PHY_CODE_L")))) {
- // 夹杂
- sqlucomm.setLength(0);
- sqlucomm.append("SELECT * FROM QCM_ORD_DESIGN_SAMPLE_M WHERE DESIGN_KEY='" + sampleM.get("DESIGN_KEY") + "'"
- + " and PSC='" + sampleM.get("PSC") + "' and SAMPLE_STYLE_CODE='" + sampleM.get("SMP_TYPE_CODE")
- + "' and ORG_CODE='" + sampleM.get("CERT_INST_CODE") + "' " + " and RATE_CODE='D' and PHY_CODE_L='HJ' ");
- sqlucomm.append(" and SMP_POSITION_CODE='" + result.get("SMP_LOCATION_CODE") + "'");
- }
- List<HashMap> qtlyResource = mapper.query(sqlucomm.toString());
- int time = 1;
- if (qtlyResource == null || qtlyResource.size() < 1) {
- return;
- }
-
- //查询除了当前轧批号不复样 其它全复样 检验委托只显示两个复样
- sql ="";
- if(DSampleLogo){
- //件件取样
- sql = " select t.*,o.steel_code,o.thick from QCM_JHY_SAMPLE_CONSIGN_D t,Qcm_Jhy_Sample_r_Ord o "
- +" where t.smp_no = o.smp_no and t.heat_no like '"+heatNo+"%' "
- + " and t.batch_no not in (select t.batch_no from QCM_JHY_SAMPLE_CONSIGN_D t "
- +" where t.heat_no like '"+heatNo+"%' and t.QUOTE_CONSIGN_NO is null AND t.freq_code = 'D') "
- + " AND t.freq_code = 'D' "
- + strPlineCode;
- }else{
- //正常复样 and nvl(i.phy_code_s, 'null') <> 'J10'
- sql = "select t.*,o.steel_code,o.thick from QCM_JHY_SAMPLE_CONSIGN_D t,Qcm_Jhy_Sample_r_Ord o "
- +" where t.smp_no = o.smp_no and t.specimen_no in ( "
- + " select t.specimen_no from QCM_JHY_SAMPLE_CONSIGN_D t, qcm_jhy_sample_consign_d_item i "
- + " where t.specimen_no = i.specimen_no and t.heat_no like '"+heatNo+"%' and t.batch_no <> '"+result.get("BATCH_NO")+"' "
- + " group by t.specimen_no ) "
- + " and t.heat_no like '"+heatNo+"%' and t.batch_no <> '"+result.get("BATCH_NO")+"' "
- + " AND t.freq_code = 'D' and t.smp_type_code = '0' AND o.JUDGE_STATUS='1' and t.QUOTE_CONSIGN_NO is not null "
- + strPlineCode
- + " and rownum <= 2 order by t.batch_no";
- }
-
- List<HashMap> hmap = mapper.query(sql.toString());
- TreeSet<String> hjsets = new TreeSet<String>();
- for (HashMap hashMap : hmap) {
- hjsets.add((String)hashMap.get("BATCH_NO"));//这一炉除了 当前不合格的轧批 还有几个轧批
- }
-
- //非件件取样
- if(!DSampleLogo){
- // 查询当前炉 有没有复样
- sqlucomm.setLength(0);
- sqlucomm.append("SELECT SPECIMEN_NO FROM QCM_JHY_SAMPLE_CONSIGN_D t WHERE heat_no like '"+heatNo+"%' "
- + " AND SMP_TYPE_CODE='1' AND FREQ_CODE='D' and STATUS='0' ");
- sqlucomm.append(strPlineCode);
- List<HashMap> resultsD = mapper.query(sqlucomm.toString());
- if (resultsD != null && resultsD.size() >= 1) {
- return;
- }
- }
-
- String smpNo ="";
- if(!DSampleLogo && hjsets.size() == 1){//非件件取样 并且只剩下一个轧批可用 用同一个试样号
- smpNo = createQltySamNo((String) result.get("PLINE_CODE"));
- }
- String specimen_no = "";
- int quote = 0;//大于两个轧批其它引用
- for (HashMap hashMap : hmap) {
- if(DSampleLogo || hjsets.size() >= 2){//件件取样 或者 轧批多于一个 用不同试样号 或者有多个夹杂轧批也用不同试样号
- smpNo = createQltySamNo((String) result.get("PLINE_CODE"));
- }
- // 查询当前频率是否存在已经存在的取样要求信息 取样频率和取样位置代码
- //件件取样
- if(DSampleLogo){
- sqlucomm.setLength(0);
- sqlucomm.append("SELECT SPECIMEN_NO FROM QCM_JHY_SAMPLE_CONSIGN_D WHERE BATCH_NO='" + hashMap.get("BATCH_NO")
- + "' " + " AND SMP_TYPE_CODE='3' AND FREQ_CODE='D' and STATUS='0' ");
- }else{
- //正常复样
- // 查询当前频率是否存在已经存在的取样要求信息 取样频率和取样位置代码
- sqlucomm.setLength(0);
- sqlucomm.append("SELECT SPECIMEN_NO FROM QCM_JHY_SAMPLE_CONSIGN_D WHERE BATCH_NO='" + hashMap.get("BATCH_NO")
- + "' " + " AND SMP_TYPE_CODE='1' AND FREQ_CODE='D' and STATUS='0' ");
- }
- List<HashMap> resultsD = mapper.query(sqlucomm.toString());
-
- String Dsample ="";
- String Dsamplecode ="";
- String inspectionLot ="";
- if (resultsD == null || resultsD.size() < 1) {//少于1代表没有生成复样或件件取样
- //件件取样
- if(DSampleLogo){
- Dsample = "件件取样";
- Dsamplecode = "3";
- inspectionLot = createQltyInspectionLot(hashMap.get("BATCH_NO").toString());
- }else{
- Dsample = "复样";
- Dsamplecode = "1";
- }
- if(!DSampleLogo){
- sql = "";
- sql ="Insert into QCM_JHY_SAMPLE_CONSIGN_M(SMP_NO,HEAT_NO,BATCH_NO,INSPECTION_LOT,BOARD_NO,MATERIAL_NO,PSC, "
- +" PSC_DESC,SMP_CATG,CERT_INST_CODE,CERT_INST_NAME,SMP_TYPE_CODE,SMP_TYPE_NAME,GRADE_CODE,GRADE_NAME, "
- +" PLINE_CODE,PLINE_NAME,VALIDFLAG,MEMO,CREATE_ID,CREATE_NAME,CREATE_TIME,ITEM_FLAG,DUPLICATE_SAMPLE) "
- +" select '"+smpNo+"',HEAT_NO,BATCH_NO,INSPECTION_LOT,BOARD_NO,MATERIAL_NO,PSC, "
- +" PSC_DESC,SMP_CATG,CERT_INST_CODE,CERT_INST_NAME,SMP_TYPE_CODE,SMP_TYPE_NAME,GRADE_CODE,GRADE_NAME, "
- +" PLINE_CODE,PLINE_NAME,VALIDFLAG,MEMO,'sys','sys',sysdate,ITEM_FLAG,'"+Dsample+"' "
- +" from QCM_JHY_SAMPLE_CONSIGN_M t where t.SMP_NO = '"+hashMap.get("SMP_NO")+"'"
- + " and t.batch_no like '%"+hashMap.get("BATCH_NO")+"%' and rownum <= 1 ";
- mapper.insert(sql);
-
- sql = "";
- sql = "Insert into QCM_JHY_SAMPLE_R_ORD(DESIGN_KEY,SMP_NO,PSC,PSC_DESC,HEAT_NO,BATCH_NO,INSPECTION_LOT,DELIVERY_STATE_CODE, "
- + " DELIVERY_STATE_DESC,THICK,WIDTH,LENGTH,PLINE_CODE,PLINE_NAME,MSC_PLINE,PROCESS_CODE,CERT_INST_CODE,CERT_INST_NAME, "
- + " SMP_TYPE_CODE,SMP_TYPE_NAME,SMELTING_CNT,PRODUCT_CNT,ASSAY_NO_CP,ASSAY_NO_RL,CIC_ID,JUDGE_STATUS,PROD_CODE,"
- + " PROD_NAME,STEEL_CODE,STEEL_NAME,STD_CODE,STD_NAME,CREATE_TIME,CREATE_ID,CREATE_NAME,DUPLICATE_SAMPLE) "
- + " select DESIGN_KEY,'"+smpNo+"',PSC,PSC_DESC,HEAT_NO,BATCH_NO,INSPECTION_LOT,DELIVERY_STATE_CODE,DELIVERY_STATE_DESC, "
- + " THICK,WIDTH,LENGTH,PLINE_CODE,PLINE_NAME,MSC_PLINE,PROCESS_CODE,CERT_INST_CODE,CERT_INST_NAME,SMP_TYPE_CODE,"
- + " SMP_TYPE_NAME,SMELTING_CNT,PRODUCT_CNT,ASSAY_NO_CP,ASSAY_NO_RL,CIC_ID,'0',PROD_CODE,PROD_NAME,STEEL_CODE, "
- + " STEEL_NAME,STD_CODE,STD_NAME,sysdate,'sys','sys','"+Dsample+"' "
- + " from QCM_JHY_SAMPLE_R_ORD t where t.SMP_NO = '"+hashMap.get("SMP_NO")+"' "
- + " and t.batch_no like '%"+hashMap.get("BATCH_NO")+"%' and rownum <= 1 ";
- mapper.insert(sql);
-
- if(hjsets.size() >= 2){
- //把已经判定的ORD检验号置空 ord先插入后修改
- sql = "";
- sql =" update QCM_JHY_SAMPLE_R_ORD t set t.INSPECTION_LOT = '' "
- + " where t.batch_no like '%"+hashMap.get("BATCH_NO")+"%' "
- + " and t.steel_code like '%"+hashMap.get("STEEL_CODE")+"%'"
- + " and t.thick like '%"+hashMap.get("THICK")+"%' "
- + " and t.SMP_NO = '"+hashMap.get("SMP_NO")+"' ";//and t.judge_status = '1'
- mapper.updateJudgeStatus(sql.toString());
- }else if(hjsets.size() == 1 && baent.equals("0")){
- sql = "";
- sql =" update QCM_JHY_SAMPLE_R_ORD t set t.INSPECTION_LOT = '' "
- + " where t.batch_no like '%"+hashMap.get("BATCH_NO")+"%' "
- + " and t.steel_code like '%"+hashMap.get("STEEL_CODE")+"%'"
- + " and t.thick like '%"+hashMap.get("THICK")+"%' "
- + " and t.SMP_NO = '"+hashMap.get("SMP_NO")+"' ";//and t.judge_status = '1'
- mapper.updateJudgeStatus(sql.toString());
- baent="1";
- }
-
- }else if(DSampleLogo){
- sql = "";
- sql ="Insert into QCM_JHY_SAMPLE_CONSIGN_M(SMP_NO,HEAT_NO,BATCH_NO,INSPECTION_LOT,BOARD_NO,MATERIAL_NO,PSC, "
- +" PSC_DESC,SMP_CATG,CERT_INST_CODE,CERT_INST_NAME,SMP_TYPE_CODE,SMP_TYPE_NAME,GRADE_CODE,GRADE_NAME, "
- +" PLINE_CODE,PLINE_NAME,VALIDFLAG,MEMO,CREATE_ID,CREATE_NAME,CREATE_TIME,ITEM_FLAG,DUPLICATE_SAMPLE) "
- +" select '"+smpNo+"',HEAT_NO,BATCH_NO,'"+inspectionLot+"',BOARD_NO,MATERIAL_NO,PSC, "
- +" PSC_DESC,SMP_CATG,CERT_INST_CODE,CERT_INST_NAME,SMP_TYPE_CODE,SMP_TYPE_NAME,GRADE_CODE,GRADE_NAME, "
- +" PLINE_CODE,PLINE_NAME,VALIDFLAG,MEMO,'sys','sys',sysdate,ITEM_FLAG,'"+Dsample+"' "
- +" from QCM_JHY_SAMPLE_CONSIGN_M t where t.SMP_NO = '"+hashMap.get("SMP_NO")+"'"
- + " and t.batch_no like '%"+hashMap.get("BATCH_NO")+"%' and rownum <= 1 ";
- mapper.insert(sql);
-
- sql = "";
- sql = "Insert into QCM_JHY_SAMPLE_R_ORD(DESIGN_KEY,SMP_NO,PSC,PSC_DESC,HEAT_NO,BATCH_NO,INSPECTION_LOT,DELIVERY_STATE_CODE, "
- + " DELIVERY_STATE_DESC,THICK,WIDTH,LENGTH,PLINE_CODE,PLINE_NAME,MSC_PLINE,PROCESS_CODE,CERT_INST_CODE,CERT_INST_NAME, "
- + " SMP_TYPE_CODE,SMP_TYPE_NAME,SMELTING_CNT,PRODUCT_CNT,ASSAY_NO_CP,ASSAY_NO_RL,CIC_ID,JUDGE_STATUS,PROD_CODE,"
- + " PROD_NAME,STEEL_CODE,STEEL_NAME,STD_CODE,STD_NAME,CREATE_TIME,CREATE_ID,CREATE_NAME,DUPLICATE_SAMPLE) "
- + " select DESIGN_KEY,'"+smpNo+"',PSC,PSC_DESC,HEAT_NO,BATCH_NO,'"+inspectionLot+"',DELIVERY_STATE_CODE,DELIVERY_STATE_DESC, "
- + " THICK,WIDTH,LENGTH,PLINE_CODE,PLINE_NAME,MSC_PLINE,PROCESS_CODE,CERT_INST_CODE,CERT_INST_NAME,SMP_TYPE_CODE,"
- + " SMP_TYPE_NAME,SMELTING_CNT,PRODUCT_CNT,ASSAY_NO_CP,ASSAY_NO_RL,CIC_ID,'0',PROD_CODE,PROD_NAME,STEEL_CODE, "
- + " STEEL_NAME,STD_CODE,STD_NAME,sysdate,'sys','sys','"+Dsample+"' "
- + " from QCM_JHY_SAMPLE_R_ORD t where t.SMP_NO = '"+hashMap.get("SMP_NO")+"' "
- + " and t.batch_no like '%"+hashMap.get("BATCH_NO")+"%' and rownum <= 1 ";
- mapper.insert(sql);
-
- sql = "";
- sql = " update zj_result_all@xgcx t set t.billetid_jy = '"+inspectionLot+"' ";
- sql = " where t.billetid like '"+hashMap.get("BATCH_NO")+"%' ";
- mapper.updateJudgeStatus(sqlucomm.toString());
- }
- int ibatchNO = 0;
- //判断要复样的轧批有几个
- if(hjsets.size() == 1){
- ibatchNO = 2;
- }else if(hjsets.size() >=2){
- ibatchNO = 1;
- }
- if(!DSampleLogo){//非件件取样
- // 生成新的复样的取样编号
- for(int i=0;i<ibatchNO;i++){
- specimen_no = createSpecimen_no(smpNo);
- //插入D表
- sql = "";
- sql = "insert into qcm_jhy_sample_consign_d "
- +" (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) "
- +" select "
- +" '"+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 "
- +" from qcm_jhy_sample_consign_d t "
- +" 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";
- mapper.insert(sql);
-
- //插入ITEM表
- sql = "";
- sql = "insert into qcm_jhy_sample_consign_d_item "
- +" (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) "
- +" 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 "
- +" from qcm_jhy_sample_consign_d_item t where t.specimen_no = '"+hashMap.get("SPECIMEN_NO")+"' ";
- mapper.insert(sql);
-
- }
-
- //如果轧批多于一个 说明每个轧批都要获取相应的初样
- if(hjsets.size() >=2){
- //查询当前初样取样编号的所有实绩
- sql = "";
- sql = " select t.* from QCM_JHY_INSP_PHYSICS t "
- +" where t.specimen_no in (select d.specimen_no from QCM_JHY_SAMPLE_CONSIGN_D d where d.smp_no = '"+hashMap.get("SMP_NO")+"') "
- + " order by t.SPECIMEN_NO asc, t.phy_code_l asc,t.phy_code_s asc";//and d.FREQ_CODE='D'
- List<HashMap> hmPhysics = mapper.query(sql.toString());
- //把初样的项目 放到 复样中
- for (HashMap hashMap1 : hmPhysics) {
- sql = "";
- sql = "select decode(max(seq),'','49',max(seq))+1 as SEQ from QCM_JHY_INSP_PHYSICS t "
- + " where t.specimen_no = '"+specimen_no+"'";
- List<HashMap> seqhm = mapper.query(sql.toString());
- BigDecimal big = (BigDecimal)seqhm.get(0).get("SEQ");
- String seqs = big.toString();
- Integer seqint = Integer.parseInt(seqs);
- sql = "";
- sql = " insert into QCM_JHY_INSP_PHYSICS "
- +" (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, "
- +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
- +" VAL13,VAL14,VAL15,AVG_VAL,GUID,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, "
- +" PHY_UNIT,MEMO,QUOTE_SPECIMEN_NO,QUOTE_STATUS) "
- +" 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, "
- +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
- +" VAL13,VAL14,VAL15,AVG_VAL,GUID,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, "
- +" PHY_UNIT,MEMO,'"+(String)hashMap1.get("SPECIMEN_NO")+"','0' from QCM_JHY_INSP_PHYSICS t "
- + " where t.specimen_no = '"+(String)hashMap1.get("SPECIMEN_NO")+"' "
- + " and t.phy_code_l = '"+hashMap1.get("PHY_CODE_L")+"' "
- + " and t.phy_code_s = '"+hashMap1.get("PHY_CODE_S")+"' "
- + " and t.PHY_CODE_M = '"+hashMap1.get("PHY_CODE_M")+"' "
- + " and t.test_qty = '"+hashMap1.get("TEST_QTY")+"' ";
- mapper.insert(sql);
-
- sql = "";
- sql = "insert into QCM_JHY_SAMPLE_CONSIGN_D_ITEM "
- +" (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_SPECIMEN_NO,QUOTE_SEQ,ITEM_FLAG,MEMO,CREATE_ID,CREATE_NAME,CREATE_TIME,STDMEMO,RESMP_SEQ, "
- +" PHY_GROUP_CODE,FY_QUOTE_SPECIMEN_NO,FY_QUOTE_STATUS) "
- +" select '"+specimen_no+"','"+seqint+"','"+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_SPECIMEN_NO,QUOTE_SEQ,ITEM_FLAG,MEMO,CREATE_ID,CREATE_NAME,CREATE_TIME,STDMEMO,RESMP_SEQ, "
- +" PHY_GROUP_CODE,'"+(String)hashMap1.get("SPECIMEN_NO")+"','0' from QCM_JHY_SAMPLE_CONSIGN_D_ITEM "
- + " where specimen_no = '"+(String)hashMap1.get("SPECIMEN_NO")+"' "
- + " and phy_code_l = '"+hashMap1.get("PHY_CODE_L")+"' "
- + " and PHY_CODE_M = '"+hashMap1.get("PHY_CODE_M")+"' "
- + " and phy_code_s = '"+hashMap1.get("PHY_CODE_S")+"' ";
- mapper.insert(sql);
- }
- }
-
- }else if(DSampleLogo){//件件取样
- specimen_no = createSpecimen_no(smpNo);
- //插入D表
- sql = "";
- sql = "insert into qcm_jhy_sample_consign_d "
- +" (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) "
- +" select "
- +" '"+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 "
- +" from qcm_jhy_sample_consign_d t "
- +" 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";
- mapper.insert(sql);
-
- //插入ITEM表
- sql = "";
- sql = "insert into qcm_jhy_sample_consign_d_item "
- +" (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) "
- +" 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 "
- +" from qcm_jhy_sample_consign_d_item t where t.specimen_no = '"+hashMap.get("SPECIMEN_NO")+"' ";
- mapper.insert(sql);
-
- //查询当前初样取样编号的所有实绩
- sql = "";
- sql = " select t.* from QCM_JHY_INSP_PHYSICS t "
- +" where t.specimen_no in (select d.specimen_no from QCM_JHY_SAMPLE_CONSIGN_D d where d.smp_no = '"+hashMap.get("SMP_NO")+"') "
- + " order by t.SPECIMEN_NO asc, t.phy_code_l asc,t.phy_code_s asc";//and d.FREQ_CODE='D'
- List<HashMap> hmPhysics = mapper.query(sql.toString());
- //把初样的项目 放到 复样中
- for (HashMap hashMap1 : hmPhysics) {
- sql = "";
- sql = "select decode(max(seq),'','49',max(seq))+1 as SEQ from QCM_JHY_INSP_PHYSICS t "
- + " where t.specimen_no = '"+specimen_no+"'";
- List<HashMap> seqhm = mapper.query(sql.toString());
- BigDecimal big = (BigDecimal)seqhm.get(0).get("SEQ");
- String seqs = big.toString();
- Integer seqint = Integer.parseInt(seqs);
- sql = "";
- sql = " insert into QCM_JHY_INSP_PHYSICS "
- +" (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, "
- +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
- +" VAL13,VAL14,VAL15,AVG_VAL,GUID,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, "
- +" PHY_UNIT,MEMO,QUOTE_SPECIMEN_NO) "
- +" 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, "
- +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
- +" VAL13,VAL14,VAL15,AVG_VAL,GUID,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, "
- +" PHY_UNIT,MEMO,'"+(String)hashMap1.get("SPECIMEN_NO")+"' from QCM_JHY_INSP_PHYSICS t "
- + " where t.specimen_no = '"+(String)hashMap1.get("SPECIMEN_NO")+"' "
- + " and t.phy_code_l = '"+hashMap1.get("PHY_CODE_L")+"' "
- + " and t.phy_code_s = '"+hashMap1.get("PHY_CODE_S")+"' "
- + " and t.PHY_CODE_M = '"+hashMap1.get("PHY_CODE_M")+"' "
- + " and t.test_qty = '"+hashMap1.get("TEST_QTY")+"' ";
- mapper.insert(sql);
-
- sql = "";
- sql = "insert into QCM_JHY_SAMPLE_CONSIGN_D_ITEM "
- +" (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_SPECIMEN_NO,QUOTE_SEQ,ITEM_FLAG,MEMO,CREATE_ID,CREATE_NAME,CREATE_TIME,STDMEMO,RESMP_SEQ, "
- +" PHY_GROUP_CODE,FY_QUOTE_SPECIMEN_NO) "
- +" select '"+specimen_no+"','"+seqint+"','"+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_SPECIMEN_NO,QUOTE_SEQ,ITEM_FLAG,MEMO,CREATE_ID,CREATE_NAME,CREATE_TIME,STDMEMO,RESMP_SEQ, "
- +" PHY_GROUP_CODE,'"+(String)hashMap1.get("SPECIMEN_NO")+"' from QCM_JHY_SAMPLE_CONSIGN_D_ITEM "
- + " where specimen_no = '"+(String)hashMap1.get("SPECIMEN_NO")+"' "
- + " and phy_code_l = '"+hashMap1.get("PHY_CODE_L")+"' "
- + " and PHY_CODE_M = '"+hashMap1.get("PHY_CODE_M")+"' "
- + " and phy_code_s = '"+hashMap1.get("PHY_CODE_S")+"' ";
- mapper.insert(sql);
- }
- }
- }
-
- }
-
- //非件件取样 只有一个轧批时用的
- if(!DSampleLogo && hjsets.size() <=1 ){
- //查询当前初样取样编号的所有实绩 拿取除了初样送样的另一个轧批号hmap.get(0).get("SMP_NO")
- sql = "";
- sql = " select t.* from QCM_JHY_INSP_PHYSICS t "
- +" 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")+"') "
- + " order by t.SPECIMEN_NO asc, t.phy_code_l asc,t.phy_code_s asc";// and d.FREQ_CODE='D'
- List<HashMap> hmPhysics = mapper.query(sql.toString());
- //把初样的项目 放到 复样中
- for (HashMap hashMap1 : hmPhysics) {
- sql = "";
- sql = "select decode(max(seq),'','49',max(seq))+1 as SEQ from QCM_JHY_INSP_PHYSICS t "
- + " where t.specimen_no = '"+specimen_no+"'";
- List<HashMap> seqhm = mapper.query(sql.toString());
- BigDecimal big = (BigDecimal)seqhm.get(0).get("SEQ");
- String seqs = big.toString();
- Integer seqint = Integer.parseInt(seqs);
- sql = "";
- sql = " insert into QCM_JHY_INSP_PHYSICS "
- +" (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, "
- +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
- +" VAL13,VAL14,VAL15,AVG_VAL,GUID,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, "
- +" PHY_UNIT,MEMO,QUOTE_SPECIMEN_NO,QUOTE_STATUS) "
- +" 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, "
- +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
- +" VAL13,VAL14,VAL15,AVG_VAL,GUID,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, "
- +" PHY_UNIT,MEMO,'"+(String)hashMap1.get("SPECIMEN_NO")+"','0' from QCM_JHY_INSP_PHYSICS t "
- + " where t.specimen_no = '"+(String)hashMap1.get("SPECIMEN_NO")+"' "
- + " and t.phy_code_l = '"+hashMap1.get("PHY_CODE_L")+"' "
- + " and t.phy_code_s = '"+hashMap1.get("PHY_CODE_S")+"' "
- + " and t.PHY_CODE_M = '"+hashMap1.get("PHY_CODE_M")+"' "
- + " and t.test_qty = '"+hashMap1.get("TEST_QTY")+"' ";
- mapper.insert(sql);
-
- sql = "";
- sql = "insert into QCM_JHY_SAMPLE_CONSIGN_D_ITEM "
- +" (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_SPECIMEN_NO,QUOTE_SEQ,ITEM_FLAG,MEMO,CREATE_ID,CREATE_NAME,CREATE_TIME,STDMEMO,RESMP_SEQ, "
- +" PHY_GROUP_CODE,FY_QUOTE_SPECIMEN_NO,FY_QUOTE_STATUS) "
- +" select '"+specimen_no+"','"+seqint+"','"+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_SPECIMEN_NO,QUOTE_SEQ,ITEM_FLAG,MEMO,CREATE_ID,CREATE_NAME,CREATE_TIME,STDMEMO,RESMP_SEQ, "
- +" PHY_GROUP_CODE,'"+(String)hashMap1.get("SPECIMEN_NO")+"','0' from QCM_JHY_SAMPLE_CONSIGN_D_ITEM "
- + " where specimen_no = '"+(String)hashMap1.get("SPECIMEN_NO")+"' "
- + " and phy_code_l = '"+hashMap1.get("PHY_CODE_L")+"' "
- + " and PHY_CODE_M = '"+hashMap1.get("PHY_CODE_M")+"' "
- + " and phy_code_s = '"+hashMap1.get("PHY_CODE_S")+"' ";
- mapper.insert(sql);
- }
- }
- }
-
- /**
- * 创建试样号
- * @param pline_code 产线代码
- * @return
- */
- private String createQltySamNo(String pline_code) {
- // TODO Auto-generated method stub
- String smp_no="";
- SimpleDateFormat sdf = new SimpleDateFormat("yyMMdd");
- if (pline_code.length()>3){
- pline_code=pline_code.substring(0,3);
- }else if (pline_code.length()==2){
- pline_code="0"+pline_code;
- }else if (pline_code.length()==1){
- pline_code="00"+pline_code;
- }
-
- String syh = pline_code +sdf.format(new Date());
-
- StringBuffer sqlucomm = new StringBuffer();
- sqlucomm.append("SELECT (max(to_number(substr(smp_no,10)))+1) SMP_NO FROM QCM_JHY_SAMPLE_CONSIGN_M WHERE SMP_NO like '"+syh+"%' ");
- HashMap result=mapper.queryOne(sqlucomm.toString());
- BigDecimal seq=BigDecimal.ZERO;
- if (result!=null && result.get("SMP_NO")!=null ) {
- seq=(BigDecimal)result.get("SMP_NO");
- }
- seq=seq.add(BigDecimal.ONE);
-
- smp_no=syh+ String.format("%04d", seq.intValue());
- return smp_no;
- }
-
- /**
- * 创建检验号
- * @param batchNo
- * @return
- */
- private String createQltyInspectionLot(String batchNo) {
- String inspection_lot="";
-
- StringBuffer sqlucomm = new StringBuffer();
- sqlucomm.append("SELECT max(to_number(substr(inspection_lot,-4))) inspection_lot FROM QCM_JHY_SAMPLE_CONSIGN_M WHERE batch_no like '%"+batchNo+"%' ");
- HashMap result=mapper.queryOne(sqlucomm.toString());
- BigDecimal seq=BigDecimal.ZERO;
- if (result!=null && result.get("INSPECTION_LOT")!=null ) {
- seq=(BigDecimal)result.get("INSPECTION_LOT");
- }
- seq=seq.add(BigDecimal.ONE);
- if(batchNo.contains("R")){
- inspection_lot=batchNo+ String.format("%05d", seq.intValue());
- }else if(batchNo.contains("L")){
- inspection_lot=batchNo+ String.format("%03d", seq.intValue());
- }else{
- inspection_lot=batchNo+ String.format("%04d", seq.intValue());
- }
- return inspection_lot;
- }
- // 正常生成复样逻辑
- private void cteateOtherQtly(HashMap result, StringBuffer sqlucomm) throws Exception {
- // TODO Auto-generated method stub
- Integer fynum = 0;// 委托数
- String zlbz = "0";//螺纹钢 重量偏差 不复样
- String bool="0";//是否是先金相后拉伸 金相4个委托 拉伸八个委托
-
- // 查询试样号对应的合同信息
- sqlucomm.setLength(0);
- sqlucomm.append(
- "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='"
- + result.get("SMP_NO") + "'");
- List<HashMap> resultsM = mapper.query(sqlucomm.toString());
- if (resultsM == null || resultsM.size() < 1) {
- return;
- }
- // 22.08.09 新增 生成委托 * 2倍 retest_qty
- HashMap sampleMDK = resultsM.get(0);
- sqlucomm.setLength(0);
- sqlucomm.append("SELECT retest_qty as smp_count from QCM_ORD_DESIGN_STD_PIC_SMP where DESIGN_KEY='"
- + sampleMDK.get("DESIGN_KEY") + "' and PSC='" + sampleMDK.get("PSC") + "'");
- List<HashMap> smpCount = mapper.query(sqlucomm.toString());
- if (smpCount != null && smpCount.size() > 0) {
- if (smpCount.get(0).get("SMP_COUNT") != null) {
- BigDecimal cou = (BigDecimal) smpCount.get(0).get("SMP_COUNT");
- String coun = cou.toString();
- Integer integ = Integer.parseInt(coun);
- fynum = 2;//integ
- // 螺纹钢
- String steelCode = sampleMDK.get("STEEL_CODE").toString();
- //判断是否是螺纹钢
- String lugSteel="0";
- if(result.get("PLINE_CODE").equals("BC2") || result.get("PLINE_CODE").equals("GX1") || result.get("PLINE_CODE").equals("GX2")){
- String sqlSteel="select t.* from QCM_JHY_STEEL t where t.steel_name = '"+steelCode+"' and t.regulation = '1' and t.YN_LOG = '1' ";
- List<HashMap> hmsteel=mapper.query(sqlSteel.toString());
- if(hmsteel!=null && hmsteel.size()>=1){
- lugSteel="1";
- }
- }
- if ("HRB400".equals(sampleMDK.get("STEEL_CODE")) || "HRB400E".equals(sampleMDK.get("STEEL_CODE"))
- || "HRB500E".equals(sampleMDK.get("STEEL_CODE")) || "HRB500".equals(sampleMDK.get("STEEL_CODE"))
- || "HPB300".equals(sampleMDK.get("STEEL_CODE")) || steelCode.contains("GHRB400")
- || steelCode.contains("GHRB500") || "TB400E".equals(sampleMDK.get("STEEL_CODE"))
- || "TB400".equals(sampleMDK.get("STEEL_CODE")) || "HRB600E".equals(sampleMDK.get("STEEL_CODE"))
- || "HRB600".equals(sampleMDK.get("STEEL_CODE")) || lugSteel.equals("1") ) {
- zlbz = "1";
- sqlucomm.setLength(0);
- sqlucomm.append("SELECT count(1) CONUM from QCM_JHY_SAMPLE_CONSIGN_D where batch_no='"+ sampleMDK.get("BATCH_NO") + "' "
- + " and smp_type_name = '初样' and status not in ('5','6') and INSPECTION_LOT = '"+result.get("INSPECTION_LOT")+"' " );
- List<HashMap> smpCount2 = mapper.query(sqlucomm.toString());
- if (smpCount2.get(0).get("CONUM") != null && !smpCount2.get(0).get("CONUM").equals("0") ) {
- BigDecimal cou2 = (BigDecimal) smpCount2.get(0).get("CONUM");
- String coun2 = cou2.toString();
- Integer integ2 = Integer.parseInt(coun2);
- fynum = integ2 * 2;
- }
- }
-
- //高线 硬线 小于6个吊号 除初样 其它吊号全送
- if (!"HRB400".equals(steelCode) && !"HRB400E".equals(steelCode)&&
- !"HRB500".equals(steelCode) && !"HRB500E".equals(steelCode) &&
- !"HPB300".equals(steelCode) && !"Q215".equals(steelCode) &&
- !"Q235".equals(steelCode) && !steelCode.contains("GHRB400") &&
- !steelCode.contains("GHRB500") && !"TB400E".equals(steelCode) && !"TB400".equals(steelCode)
- && !"HRB600E".equals(steelCode) && !"HRB600".equals(steelCode)
- && (result.get("PLINE_CODE").equals("GX2") ) ) {
- fynum = 4;//硬线 2吊 翻倍4吊
- String plineCode2 ="";
- if (result.get("PLINE_CODE").equals("GX2")) {
- plineCode2 = "4001GX2";
- }
- String batchNo =(String) result.get("BATCH_NO");
- String sql = "";
- //20240918 只要排除初样的子板号
- sql = " select count(1) num from ("
- + "select t.pline_code,t.MATERIAL_NO, t.NUMS from ( "
- + " select productline pline_code, BILLETID as MATERIAL_NO,Substr(BILLETID, instr(BILLETID, '.') + 1, length(BILLETID)) NUMS from kch_turnofflist@xgcx where BILLETID like '"
- + batchNo + "'||'%' union "
- + " select productline pline_code, BILLETID as MATERIAL_NO,Substr(BILLETID, instr(BILLETID, '.') + 1, length(BILLETID)) NUMS from kcz_turnofflist@xgcx where BILLETID like '"
- + batchNo + "'||'%' union "
- + " select pld pline_code, BILLETID as MATERIAL_NO,Substr(BILLETID, instr(BILLETID, '.') + 1, length(BILLETID)) NUMS from kcx_turnofflist@xgcx where BILLETID like '"
- + batchNo + "'||'%' " + " ) t "
- + " where t.MATERIAL_NO not in (select d.material_no from QCM_JHY_SAMPLE_CONSIGN_D d where d.material_no like '"
- + batchNo + "'||'%' and d.SMP_TYPE_CODE = '0' ) " + " and t.pline_code = '" + plineCode2 + "' "
- +" ) ";
- if (!StringUtils.isBlank(sql)) {
- List<HashMap> listEle = mapper.query(sql.toString());
- if (listEle != null && listEle.size() > 0) {
- BigDecimal num = (BigDecimal) listEle.get(0).get("NUM");
- String countnum = num.toString();
- Integer num2 = Integer.parseInt(countnum);
- if(num2 <= 3){//小于六吊 一共只有五吊
- fynum = num2;
- DSampleLogo2 = true;//件件取样
- }
- //如果是复样不合格 再复样 块块取样
- if(DSampleLogo){
- //件件取样 操作人员会一个一个选所以只要运行一次
- //fynum = num2;
- fynum = 1;
- DSampleLogo2 = true;//件件取样
- }
- }
- }
- }else{
-
- //如果是复样不合格 再复样 块块取样
- if(DSampleLogo){
-
- //如果是复样不合格 再复样 块块取样
- //件件取样 操作人员会一个一个选所以只要运行一次
- fynum = 1;
- DSampleLogo2 = true;//件件取样
- /* String batchNo =(String) result.get("BATCH_NO");
- String sql = "";
- sql = " select count(1) num from ("
- + "select t.pline_code,t.MATERIAL_NO, t.NUMS from ( "
- + " select productline pline_code, BILLETID as MATERIAL_NO,Substr(BILLETID, instr(BILLETID, '.') + 1, length(BILLETID)) NUMS from kch_turnofflist@xgcx where BILLETID like '"
- + batchNo + "'||'%' union "
- + " select productline pline_code, BILLETID as MATERIAL_NO,Substr(BILLETID, instr(BILLETID, '.') + 1, length(BILLETID)) NUMS from kcz_turnofflist@xgcx where BILLETID like '"
- + batchNo + "'||'%' union "
- + " select pld pline_code, BILLETID as MATERIAL_NO,Substr(BILLETID, instr(BILLETID, '.') + 1, length(BILLETID)) NUMS from kcx_turnofflist@xgcx where BILLETID like '"
- + batchNo + "'||'%' " + " ) t "
- + " where t.MATERIAL_NO not in (select d.material_no from QCM_JHY_SAMPLE_CONSIGN_D d where d.material_no like '"
- + batchNo + "'||'%') "
- +" ) ";
- if (!StringUtils.isBlank(sql)) {
- List<HashMap> listEle = mapper.query(sql.toString());
- if (listEle != null && listEle.size() > 0) {
- BigDecimal num = (BigDecimal) listEle.get(0).get("NUM");
- String countnum = num.toString();
- Integer num2 = Integer.parseInt(countnum);
- //如果是复样不合格 再复样 块块取样
- if(DSampleLogo){
- fynum = num2;
- DSampleLogo2 = true;//件件取样
- }
- }
- }*/
- }
- }
-
- //判断是否是 中厚板按母板取样
- if(ZFMotherboard){
- fynum = 1;
- DSampleLogo2 = false;//件件取样
- }
-
- }
- }
- // 根据合同信息和项目找到复样倍数信息
- HashMap sampleM = resultsM.get(0);
- if ("HA".equals(((String) result.get("PHY_CODE_L"))) || "HC".equals(((String) result.get("PHY_CODE_L")))
- || "HT".equals(((String) result.get("PHY_CODE_L"))) || "HE".equals(((String) result.get("PHY_CODE_L")))
- || "HV".equals(((String) result.get("PHY_CODE_L"))) || "HD".equals(((String) result.get("PHY_CODE_L"))) ) {
-
- // 拉伸试验HA或者冲击HC或者电磁HT或者金相HE
- if(result.get("PLINE_CODE").equals("ZB1") || result.get("PLINE_CODE").equals("HB1")){
- String phyCodemSql=" and PHY_CODE_M='"+ result.get("PHY_CODE_M") + "' ";
- 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"))) ) ){
- phyCodemSql = " and PHY_CODE_M in ('0','3') ";
- }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"))) ) ){
- phyCodemSql = " and PHY_CODE_M in ('0','1') ";
- }
- sqlucomm.setLength(0);
- sqlucomm.append("SELECT * FROM QCM_ORD_DESIGN_SAMPLE_M WHERE DESIGN_KEY='" + sampleM.get("DESIGN_KEY") + "' "
- + " and PSC='" + sampleM.get("PSC") + "' and SAMPLE_STYLE_CODE='" + sampleM.get("SMP_TYPE_CODE")+ "' "
- + " and ORG_CODE='" + sampleM.get("CERT_INST_CODE") + "' " + " and RATE_CODE='"+ result.get("FREQ_CODE") + "' "
- + " and PHY_CODE_L='" + result.get("PHY_CODE_L") + "' "
- + phyCodemSql);
- sqlucomm.append(" and SMP_POSITION_CODE='" + result.get("SMP_LOCATION_CODE") + "'");
- }else{
- sqlucomm.setLength(0);
- sqlucomm.append("SELECT * FROM QCM_ORD_DESIGN_SAMPLE_M WHERE DESIGN_KEY='" + sampleM.get("DESIGN_KEY") + "'"
- + " and PSC='" + sampleM.get("PSC") + "' and SAMPLE_STYLE_CODE='" + sampleM.get("SMP_TYPE_CODE")
- + "' and ORG_CODE='" + sampleM.get("CERT_INST_CODE") + "' " + " and RATE_CODE='"
- + result.get("FREQ_CODE") + "' and PHY_CODE_L='" + result.get("PHY_CODE_L") + "' and PHY_CODE_M='"
- + result.get("PHY_CODE_M") + "'");
- sqlucomm.append(" and SMP_POSITION_CODE='" + result.get("SMP_LOCATION_CODE") + "'");
- }
- // 材质检验项代码 金相 :(网状渗碳体E09、中心马氏体E12) 、( 微观组织E14、宏观金相E15)、( 脱碳层深度E05、边裂深度E08)20230524新质量委托判定系统委托需求申请 夏鹏 申报时间:2023-05-24 09:50:26
- if ("E09".equals(result.get("PHY_CODE_S")) || "E12".equals(result.get("PHY_CODE_S"))) {
- sqlucomm.append(" and PHY_CODE_S in ('E09','E12') ");
- } else if ("E14".equals(result.get("PHY_CODE_S")) || "E15".equals(result.get("PHY_CODE_S"))) {
- sqlucomm.append(" and PHY_CODE_S in ('E14','E15') ");
- } else if ("E05".equals(result.get("PHY_CODE_S")) || "E08".equals(result.get("PHY_CODE_S"))) {
- sqlucomm.append(" and PHY_CODE_S in ('E05','E08') ");
- } else if ("HE".equals(((String) result.get("PHY_CODE_L")))) {
- sqlucomm.append(" and PHY_CODE_S = '" + result.get("PHY_CODE_S") + "' ");
- }else if ("D01".equals(result.get("PHY_CODE_S")) || "D02".equals(result.get("PHY_CODE_S"))) {
- sqlucomm.append(" and PHY_CODE_S in ('D01','D02') ");
- }
- //判断是否是件件取样 件件取样true !true 非件件取样
- if(!DSampleLogo2 && !ZFMotherboard){
- // 22.08.10 Z向拉伸 单倍样 那就 fynum / 2
- if ("HA".equals(((String) result.get("PHY_CODE_L")))
- && "Z向拉伸".equals(((String) result.get("PHY_NAME_M")))) {
- fynum = fynum / 2;
- }
- // 22.08.10 冲击试验 单倍样 那就 fynum / 2
- if ("HC".equals(((String) result.get("PHY_CODE_L")))) {
- fynum = fynum / 2;
- }
- // 22.08.10 HF落锤试验 单倍样 那就 fynum / 2
- if ("HF".equals(((String) result.get("PHY_CODE_L")))) {
- fynum = fynum / 2;
- }
- // 22.08.10 电磁试验 单倍样 那就 fynum / 2 磁感T02 铁损T01
- if ("HT".equals(((String) result.get("PHY_CODE_L")))) {
- fynum = fynum / 2;
- }
-
- // 材质检验项代码 金相 :(网状渗碳体E09、中心马氏体E12) 、( 微观组织E14、宏观金相E15)
- /* if ("E09".equals(result.get("PHY_CODE_S")) || "E12".equals(result.get("PHY_CODE_S"))) {
- fynum = fynum / 2;
- } else if ("E14".equals(result.get("PHY_CODE_S")) || "E15".equals(result.get("PHY_CODE_S"))) {
- fynum = fynum / 2;
- }*/
-
- // 表面粗糙试验单倍样 20230811 L23039168-10 张立红
- //改成双倍样,单份会卡到材质判定空,后续完成不了判定。
- /* if ("HV".equals(((String) result.get("PHY_CODE_L")))) {
- fynum = fynum / 2;
- }*/
-
- if (result.get("PLINE_CODE").equals("GX1") || result.get("PLINE_CODE").equals("BC2") ||result.get("PLINE_CODE").equals("GX2")) {
- //金相 最多4条委托
- if ("HE".equals(((String) result.get("PHY_CODE_L")))) {
- fynum = 4;
- }
- }
-
- }
-
- } else if ("HJ".equals(((String) result.get("PHY_CODE_L")))) {
- // 普通夹杂
- sqlucomm.setLength(0);
- sqlucomm.append("SELECT * FROM QCM_ORD_DESIGN_SAMPLE_M WHERE DESIGN_KEY='" + sampleM.get("DESIGN_KEY") + "'"
- + " and PSC='" + sampleM.get("PSC") + "' and SAMPLE_STYLE_CODE='" + sampleM.get("SMP_TYPE_CODE")
- + "' and ORG_CODE='" + sampleM.get("CERT_INST_CODE") + "' " + " and RATE_CODE='"
- + result.get("FREQ_CODE") + "' and PHY_CODE_L='HJ' ");
- sqlucomm.append(" and SMP_POSITION_CODE='" + result.get("SMP_LOCATION_CODE") + "'");
- } else {
- sqlucomm.setLength(0);
- sqlucomm.append("SELECT * FROM QCM_ORD_DESIGN_SAMPLE_M WHERE DESIGN_KEY='" + sampleM.get("DESIGN_KEY") + "'"
- + " and PSC='" + sampleM.get("PSC") + "' and SAMPLE_STYLE_CODE='" + sampleM.get("SMP_TYPE_CODE")
- + "' and ORG_CODE='" + sampleM.get("CERT_INST_CODE") + "' " + "and PHY_CODE_L='"
- + result.get("PHY_CODE_L") + "' and PHY_CODE_M='" + result.get("PHY_CODE_M") + "' "
- + " and PHY_CODE_S='" + result.get("PHY_CODE_S") + "'");
- if (result.get("ITEM_CODE_D") != null && !result.get("ITEM_CODE_D").toString().equals("null")) {
- sqlucomm.append(" and ITEM_CODE_D='" + result.get("ITEM_CODE_D") + "'");
- }
- if (result.get("ITEM_CODE_T") != null && !result.get("ITEM_CODE_T").toString().equals("null")) {
- sqlucomm.append(" and ITEM_CODE_T='" + result.get("ITEM_CODE_T") + "'");
- }
- if (result.get("ITEM_CODE_S") != null && !result.get("ITEM_CODE_S").toString().equals("null")) {
- sqlucomm.append(" and ITEM_CODE_S='" + result.get("ITEM_CODE_S") + "'");
- }
- sqlucomm.append(" and SMP_POSITION_CODE='" + result.get("SMP_LOCATION_CODE") + "'");
-
- //螺纹钢 重量偏差不复样 其它HZ 重量偏差 Z01
- if(zlbz.equals("1") && "HZ".equals(((String) result.get("PHY_CODE_L"))) && "Z01".equals(((String) result.get("PHY_CODE_S")))){
- sqlucomm.append(" and PHY_CODE_S <> 'Z01' ");
- }
-
- // 22.09.19 表面粗糙试验单倍 20230811注释
- /*if ("HV".equals(((String) result.get("PHY_CODE_L"))) && result.get("PLINE_CODE").equals("LT1")) {
- fynum = fynum / 2;
- }*/
-
- }
- List<HashMap> qtlyResource = mapper.query(sqlucomm.toString());
- int time = 1;
- if (qtlyResource == null || qtlyResource.size() < 1) {
- return;
- }
-
- for (int j = 0; j < qtlyResource.size(); j++) {
- Integer heGold = 1;//金相数
- HashMap resource = qtlyResource.get(j);
- // 获取复样数量 复样数量都是技术中心维护的 他们维护多少是多少 如果错了找金恒找技术中心
- if (null != resource.get("RETEST_QTY")) {
- time = 1;
- }
- // 查询当前频率是否存在已经存在的取样要求信息 取样频率和取样位置代码
- //件件取样 && result.get("PLINE_CODE").equals("GX2")
- if(DSampleLogo2){
- sqlucomm.setLength(0);
- sqlucomm.append("SELECT SPECIMEN_NO FROM QCM_JHY_SAMPLE_CONSIGN_D WHERE SMP_NO='" + result.get("SMP_NO")
- + "' " + " AND SMP_TYPE_CODE='3' AND FREQ_CODE='" + result.get("FREQ_CODE")
- + "' and STATUS='0' and SMP_LOCATION_CODE='" + result.get("SMP_LOCATION_CODE") + "' " );
- }else if (ZFMotherboard){//中厚板按母板取样
- sqlucomm.setLength(0);
- sqlucomm.append("SELECT max(SPECIMEN_NO) SPECIMEN_NO FROM QCM_JHY_SAMPLE_CONSIGN_D WHERE SMP_NO='" + result.get("SMP_NO")
- + "' " + " AND SMP_TYPE_CODE='4' AND FREQ_CODE='" + result.get("FREQ_CODE")
- + "' and STATUS='0' and SMP_LOCATION_CODE='" + result.get("SMP_LOCATION_CODE") + "' order by create_time desc");
- }else{
- //正常复样
- // 查询当前频率是否存在已经存在的取样要求信息 取样频率和取样位置代码
- //线棒自动复样做限制
- sqlucomm.setLength(0);
- if(result.get("PLINE_CODE").equals("GX1") || result.get("PLINE_CODE").equals("GX2") || result.get("PLINE_CODE").equals("BC2") ){
- sqlucomm.append("SELECT SPECIMEN_NO FROM QCM_JHY_SAMPLE_CONSIGN_D WHERE SMP_NO='" + result.get("SMP_NO")
- + "' " + " AND SMP_TYPE_CODE='1' AND FREQ_CODE='" + result.get("FREQ_CODE")
- + "' and STATUS='0' and SMP_LOCATION_CODE='" + result.get("SMP_LOCATION_CODE") + "'");
- List<HashMap> ggb = mapper.query(sqlucomm.toString());
- if(ggb==null || ggb.size()<=0){
- sqlucomm.setLength(0);
- sqlucomm.append("SELECT SPECIMEN_NO FROM QCM_JHY_SAMPLE_CONSIGN_D WHERE BATCH_NO='" + result.get("BATCH_NO")
- + "' " + " AND SMP_TYPE_CODE='1' AND FREQ_CODE='" + result.get("FREQ_CODE")
- + "' and STATUS='0' and SMP_LOCATION_CODE='" + result.get("SMP_LOCATION_CODE") + "'");
- }
-
- }else{
- sqlucomm.append("SELECT SPECIMEN_NO FROM QCM_JHY_SAMPLE_CONSIGN_D WHERE SMP_NO='" + result.get("SMP_NO")
- + "' " + " AND SMP_TYPE_CODE='1' AND FREQ_CODE='" + result.get("FREQ_CODE")
- + "' and STATUS='0' and SMP_LOCATION_CODE='" + result.get("SMP_LOCATION_CODE") + "'");
- }
- }
- List<HashMap> resultsD = mapper.query(sqlucomm.toString());
- String specimen_no = "";
- if(bool.equals("1")){//先金相后拉伸
- fynum = resultsD.size();//先金相了 最后循环拉伸时 所有的委托都得有拉伸
- }
- //(resultsD == null || resultsD.size() < 1) || ( resultsD.size() >= 1 && resultsD.size() < fynum)
- //resultsD == null || resultsD.size() < 1
- if ((resultsD == null || resultsD.size() < 1) || ( resultsD.size() >= 1 && resultsD.size() < fynum) || motherboard) {
-
- if(ZFMotherboard){
- motherboard = false;
- }
-
- //判断是 先金相后拉伸 先金相只生成4吊 后拉伸要生成8吊 缧纹钢 中厚板按母板不算 线棒
- if((resultsD.size() >= 1 && resultsD.size() < fynum) && motherboard){//这里注意一下
- fynum = fynum - resultsD.size();
- bool="1";
- }else if(resultsD.size() >= 1 && resultsD.size() < fynum &&
- (result.get("PLINE_CODE").equals("ZB1") || result.get("PLINE_CODE").equals("HB1") ||
- result.get("PLINE_CODE").equals("RZ1") || result.get("PLINE_CODE").equals("LT1") || result.get("PLINE_CODE").equals("YT1") )){
- fynum = fynum - resultsD.size();
- bool="1";
- }
-
- // 22.08.09 新增 for
- for (int ii = 0; ii < fynum; ii++) {
-
- // 生成新的复样的取样编号
- specimen_no = createSpecimen_no((String) result.get("SMP_NO"));
- JhySampleDModel model = getSampleD(specimen_no, result);
- model.setSmp_no((String) result.get("SMP_NO"));
- mapper.insertSampleD(model);
- //System.out.println(ii+"=======");
-
- // 生成复样的项目信息
- for (int i = 0; i < time; i++) {
- JhySampleDItemModel item = getSampleItem((String) result.get("SMP_NO"), specimen_no, resource,
- i + 1);
-
- //判断金相 最多4条委托中有金相
- if ("HE".equals(((String) result.get("PHY_CODE_L"))) && (heGold > 4 || heGold2 > 8) && motherboard) {
- continue;
- }
- //判断连退 常温拉伸 峰值密度 小项目单倍样
- if ("A08".equals(item.getPhy_code_s()) && result.get("PLINE_CODE").equals("LT1") && LT1A08 != 1 && motherboard) {
- continue;
- }
- mapper.insertSampleItem(item);
- if ("HE".equals(((String) result.get("PHY_CODE_L"))) && motherboard) {
- heGold++;//当前for的金相数
- heGold2++;//金相总数
- }
- if ("A08".equals(item.getPhy_code_s()) && result.get("PLINE_CODE").equals("LT1") && motherboard) {
- LT1A08++;
- }
-
- }
- }
-
- //判断是 先金相后拉伸 先金相只生成4吊 后拉伸要生成8吊 缧纹钢
- if(bool.equals("0")){
- continue;
- }
- //continue;
- }
- // 22.08.09 新增 if for
- if (resultsD != null || resultsD.size() > 0) {
- for (int ij = 0; ij < fynum; ij++) {
- // 判断是否已经存在该项目,避免复样在取复样情况
- // 22.08.09
- // specimen_no=(String)resultsD.get(0).get("SPECIMEN_NO");修改成
- // specimen_no=(String)resultsD.get(ij).get("SPECIMEN_NO");
- specimen_no = (String) resultsD.get(ij).get("SPECIMEN_NO");
- sqlucomm.setLength(0);
- sqlucomm.append("SELECT * FROM QCM_JHY_SAMPLE_CONSIGN_D_ITEM WHERE SPECIMEN_NO='" + specimen_no
- + "'" + " and SMP_NO='" + result.get("SMP_NO") + "' " + "and PHY_CODE_L='"
- + resource.get("PHY_CODE_L") + "' and PHY_CODE_M='" + resource.get("PHY_CODE_M") + "'"
- + " and PHY_CODE_S='" + resource.get("PHY_CODE_S") + "'");
- if (result.get("ITEM_CODE_D") != null) {
- sqlucomm.append(" and ITEM_CODE_D='" + resource.get("ITEM_CODE_D") + "'");
- }
- if (result.get("ITEM_CODE_T") != null) {
- sqlucomm.append(" and ITEM_CODE_T='" + resource.get("ITEM_CODE_T") + "'");
- }
- if (result.get("ITEM_CODE_S") != null) {
- sqlucomm.append(" and ITEM_CODE_S='" + resource.get("ITEM_CODE_S") + "'");
- }
- List<HashMap> resultsI = mapper.query(sqlucomm.toString());
- if (resultsI == null || resultsI.size() < 1) {
- for (int i = 0; i < time; i++) {
- JhySampleDItemModel item = getSampleItem((String) result.get("SMP_NO"), specimen_no,
- resource, i + 1);
- //判断金相 最多4条委托中有金相 20231102 E2306760出了问题heGold2大于8了四个项目边裂深度、脱碳层深度体 网状渗碳体、中心马氏体需要复样,先注释掉
- /* if ("HE".equals(((String) result.get("PHY_CODE_L"))) && (heGold > 4 || heGold2 > 8)) {
- continue;
- }*/
- //判断连退 常温拉伸 峰值密度 小项目单倍样
- if ("A08".equals(item.getPhy_code_s()) && result.get("PLINE_CODE").equals("LT1") && LT1A08 != 1) {
- continue;
- }
- mapper.insertSampleItem(item);
- if ("HE".equals(((String) result.get("PHY_CODE_L")))) {
- heGold++;
- heGold2++;
- }
- if ("A08".equals(item.getPhy_code_s()) && result.get("PLINE_CODE").equals("LT1")) {
- LT1A08++;
- }
- }
- }
- }
- }
- }
- }
- /**
- * 夹杂内控单独处理
- *
- * @param results
- * @param jzResource
- * @param old_spefcial_no
- * @param list
- * @param sampleMJz
- * @throws Exception
- * 1:得到判定不合格的项目 2:根据合同信息和项目找到复样倍数信息 3:引用取样编号
- * 4:传过来的值复样(判定)5:试样号与合同信息关系表数据
- */
- private void createJznkSample(List<HashMap> results, List<HashMap> jzResource, String old_spefcial_no,
- JSONObject list, HashMap sampleMJz) throws Exception {
- // TODO Auto-generated method stub
- StringBuffer sqlucomm = new StringBuffer();
- // 夹杂内控是否已经生成过
- boolean isJaze = false;
- if (old_spefcial_no != null) {// 是否有引用编号 是
- // 初样的轧批
- // 判断该初样是否已经生成了复样
- // SMP_TYPE_CODE:1复样
- sqlucomm.setLength(0);
- sqlucomm.append("SELECT * FROM QCM_JHY_SAMPLE_CONSIGN_D where (SPECIMEN_NO='" + old_spefcial_no + "' "
- + "or QUOTE_CONSIGN_NO='" + old_spefcial_no + "' ) and SMP_TYPE_CODE='1'");
- List<HashMap> olds = mapper.query(sqlucomm.toString());
- if (olds != null && olds.size() > 0) {// 是否已经生成复样 已生成复样
- // 判断原试样号是否已经生成复样的的信息
- sqlucomm.setLength(0);
- sqlucomm.append("SELECT * FROM QCM_JHY_SAMPLE_CONSIGN_D where SMP_NO='" + results.get(0).get("SMP_NO")
- + "' " + " and SMP_TYPE_CODE='1'");
- List<HashMap> olds2 = mapper.query(sqlucomm.toString());
- if (olds2 != null && olds2.size() > 0) {
- return;
- }
- // 直接引用 SPECL_FL:0交付标准 1特殊要求 2内控标准
- Boolean isCreate = false;
- for (HashMap result : results) {
- if ("2".equals(result.get("SPECL_FL")) && isCreate) {
- continue;
- } else if ("2".equals(result.get("SPECL_FL")) && !isCreate) {
- // 查询原引用取样编号向下夹杂内控的按炉取样的复样引用取样编号为空的数据DESIGN_KEY,PSC,SMP_TYPE_CODE,CERT_INST_CODE
- // SMP_LOCATION_CODE取样位置代码 SMP_TYPE_CODE样品类型代码0初样1复样
- // 认证机构代码CERT_INST_CODE
- sqlucomm.setLength(0);
- sqlucomm.append(
- "SELECT d.* FROM QCM_JHY_SAMPLE_CONSIGN_D d inner join QCM_JHY_SAMPLE_R_ORD o on o.SMP_NO=d.SMP_NO"
- + " and (d.QUOTE_CONSIGN_NO is null or d.QUOTE_CONSIGN_NO='') and d.SMP_TYPE_CODE='1' "
- + " and d.SMP_LOCATION_CODE='" + result.get("SMP_LOCATION_CODE") + "' and "
- + " d.FREQ_CODE='D' and o.DESIGN_KEY ='" + sampleMJz.get("DESIGN_KEY")
- + "' and o.PSC='" + sampleMJz.get("PSC") + "' AND o.SMP_TYPE_CODE='"
- + sampleMJz.get("SMP_TYPE_CODE") + "' and o.CERT_INST_CODE='"
- + sampleMJz.get("CERT_INST_CODE") + "'");
- // 需要被引用的取样编号
- List<HashMap> oldSpecils = mapper.query(sqlucomm.toString());
- for (HashMap oldSpecil : oldSpecils) {
- // 根据引用的取样编号查询对应的项目值填写引用取样编号和SEQ
- sqlucomm.setLength(0);
- sqlucomm.append("select * from QCM_JHY_SAMPLE_CONSIGN_D_ITEM where SPECIMEN_NO='"
- + oldSpecil.get("SPECIMEN_NO") + "' and " + " SMP_NO='" + oldSpecil.get("SMP_NO")
- + "' order by SEQ ASC");
- List<HashMap> quoteItems = mapper.query(sqlucomm.toString());
- int count = 1;
- String specimen_no = null;
- // 生成新的复信息
- for (HashMap resource : jzResource) {
- if (count == 1) {
- // 创建取样编号
- specimen_no = createSpecimen_no((String) result.get("SMP_NO"));
- JhySampleDModel model = getSampleD(specimen_no, result);
- model.setSmp_no((String) result.get("SMP_NO"));
- model.setQuote_consign_no((String) oldSpecil.get("SPECIMEN_NO"));
- model.setOld_consign_no((String) result.get("SPECIMEN_NO"));
- mapper.insertSampleD(model);
- }
- String resourceKey = resource.get("PHY_CODE_L") + "-" + resource.get("PHY_CODE_M") + "-"
- + resource.get("PHY_CODE_S");
- if (resource.get("ITEM_CODE_D") != null) {
- resourceKey = resourceKey + "-" + resource.get("ITEM_CODE_D");
- } else {
- resourceKey = resourceKey + "-null";
- }
- if (resource.get("ITEM_CODE_T") != null) {
- resourceKey = resourceKey + "-" + resource.get("ITEM_CODE_T");
- } else {
- resourceKey = resourceKey + "-null";
- }
- if (resource.get("ITEM_CODE_S") != null) {
- resourceKey = resourceKey + "-" + resource.get("ITEM_CODE_S");
- } else {
- resourceKey = resourceKey + "-null";
- }
- int i = 0;
- for (HashMap items : quoteItems) {
- String itemKey = items.get("PHY_CODE_L") + "-" + items.get("PHY_CODE_M") + "-"
- + items.get("PHY_CODE_S");
- if (items.get("ITEM_CODE_D") != null) {
- itemKey = itemKey + "-" + items.get("ITEM_CODE_D");
- } else {
- itemKey = itemKey + "-null";
- }
- if (items.get("ITEM_CODE_T") != null) {
- itemKey = itemKey + "-" + items.get("ITEM_CODE_T");
- } else {
- itemKey = itemKey + "-null";
- }
- if (items.get("ITEM_CODE_S") != null) {
- itemKey = itemKey + "-" + items.get("ITEM_CODE_S");
- } else {
- itemKey = itemKey + "-null";
- }
- if (resourceKey.equals(itemKey)) {
- JhySampleDItemModel item = getSampleItem((String) result.get("SMP_NO"),
- specimen_no, resource, i++);
- item.setQuote_specimen_no((String) items.get("SPECIMEN_NO"));
- item.setQuote_seq((Integer) items.get("SEQ"));
- mapper.insertSampleItem(item);
- }
- }
- }
- }
- continue;
- }
- // 获取引用了按炉取样的试样号,生成其他不合格项目的复样信息
- cteateOtherQtly(result, sqlucomm);
- }
- } else {// 判断是否已生成复样 未生成复样
- // 创建整套内控包括引用的 查到这个试样号的判断不合格的项目
- sqlucomm.setLength(0);
- sqlucomm.append(
- "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 "
- + " 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 "
- + " where r.smp_no='" + old_spefcial_no + "' and r.IS_PASS='1'");
- List<HashMap> results2 = mapper.query(sqlucomm.toString());
- for (HashMap result : results2) {
- // 如果有项目 并且是夹杂按炉引用
- if ("HJ".equals(result.get("PHY_CODE_L")) && "D".equals(result.get("FREQ_CODE"))) {
- createQtlyJznk(result, list, sampleMJz);
- break;
- }
- }
- // 获取引用了按炉取样的试样号,生成其他不合格项目的复样信息
- sqlucomm.setLength(0);
- sqlucomm.append("SELECT DISTINCT SMP_NO FROM QCM_JHY_SAMPLE_CONSIGN_D where " + "(SPECIMEN_NO='"
- + results.get(0).get("SPECIMEN_NO") + "' or QUOTE_CONSIGN_NO='" + old_spefcial_no + "')");
- List<HashMap> quoteSpec = mapper.query(sqlucomm.toString());
- for (HashMap quote : quoteSpec) {
- sqlucomm.setLength(0);
- // 查询试样号向下的检验结果,去除按炉取样夹杂的
- sqlucomm.append(
- "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 "
- + " 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 "
- + " where r.smp_no='" + list.getString("QLTY_SMP_NO")
- + "' and r.IS_PASS='1' and d.FREQ_CODE='D' and r.PHY_CODE_L='HJ'");
- List<HashMap> resultQuotes = mapper.query(sqlucomm.toString());
- if (resultQuotes == null || resultQuotes.size() < 1) {
- continue;
- }
- for (HashMap result1 : resultQuotes) {
- cteateOtherQtly(result1, sqlucomm);
- }
- }
- }
- } else {// 是否有引用编号 否
- // 在检验委托明细表中 查询出当前试样号为复样的数据
- sqlucomm.setLength(0);
- sqlucomm.append("SELECT * FROM QCM_JHY_SAMPLE_CONSIGN_D where SMP_NO='" + results.get(0).get("SMP_NO")
- + "' " + " and SMP_TYPE_CODE='1'");
- List<HashMap> olds = mapper.query(sqlucomm.toString());
- if (olds != null && olds.size() > 0) {
- return;
- }
- // 创建整套内控包括引用的
- for (HashMap result : results) {
- if ("2".equals(result.get("SPECL_FL"))) {
- // 内控
- createQtlyJznk(result, list, sampleMJz);
- break;
- }
- }
- // 获取引用了按炉取样的试样号,生成其他不合格项目的复样信息
- sqlucomm.setLength(0);
- sqlucomm.append("SELECT DISTINCT SMP_NO FROM QCM_JHY_SAMPLE_CONSIGN_D where " + "(SPECIMEN_NO='"
- + results.get(0).get("SPECIMEN_NO") + "' or QUOTE_CONSIGN_NO='" + results.get(0).get("SPECIMEN_NO")
- + "')");
- List<HashMap> quoteSpec = mapper.query(sqlucomm.toString());
- for (HashMap quote : quoteSpec) {
- sqlucomm.setLength(0);
- // 查询试样号向下的检验结果,去除按炉取样夹杂的 判定不合格 按炉 夹杂
- sqlucomm.append(
- "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 "
- + " 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 "
- + " where r.smp_no='" + list.getString("QLTY_SMP_NO")
- + "' and r.IS_PASS='1' and d.FREQ_CODE='D' and r.PHY_CODE_L='HJ'");
- List<HashMap> resultQuotes = mapper.query(sqlucomm.toString());
- if (resultQuotes == null || resultQuotes.size() < 1) {
- continue;
- }
- for (HashMap result1 : resultQuotes) {
- cteateOtherQtly(result1, sqlucomm);
- }
- }
- }
- }
- /**
- * 创建夹杂按炉取样内控的复样委托
- * 内控按冶炼炉号做的夹杂物:如初样不合格,复样双倍样,但是复样是在该冶炼炉号中另取两个轧批号各做一个样。但是初样不合格的这个批号按初样结果进行判定,
- * 该炉号其余轧批按复样结果进行判定。
- *
- * @param result
- * @param list
- * @param sampleM
- * @throws Exception
- */
- private void createQtlyJznk(HashMap result, JSONObject list, HashMap sampleM) throws Exception {
- // TODO Auto-generated method stub
- StringBuffer sqlucomm = new StringBuffer();
- // 查询内控对应的按炉取样的试样号
- sqlucomm.setLength(0);
- sqlucomm.append("select * from QCM_JHY_SAMPLE_R_ORD t where t.design_key='" + list.get("DESIGN_KEY")
- + "' and t.psc='" + list.get("PSC") + "' " + " and t.cert_inst_code='" + sampleM.get("CERT_INST_CODE")
- + "' and t.smp_type_code='" + sampleM.get("SMP_TYPE_CODE") + "' " + " and t.heat_no='"
- + list.get("HEAT_NO") + "'");
- List<QcmJhySampleROrd> ords = mapper.queryQcmJhySampleROrd1(sqlucomm.toString());
- if (ords == null || ords.size() < 1) {
- return;
- }
- TreeSet<String> sets = new TreeSet<String>();
- for (QcmJhySampleROrd ord : ords) {
- sets.add(ord.getBatch_no());
- }
- // 查询检验委托主表 是否有夹杂 内控的数据
- // 22.08.06 取样频率代码 and RATE_CODE='"+sampleM.get("FREQ_CODE")+"'修改成
- // and RATE_CODE='"+result.get("FREQ_CODE")+"'
- sqlucomm.setLength(0);
- sqlucomm.append("SELECT * FROM QCM_ORD_DESIGN_SAMPLE_M WHERE DESIGN_KEY='" + list.get("DESIGN_KEY") + "'"
- + " and PSC='" + list.get("PSC") + "' and SAMPLE_STYLE_CODE='" + sampleM.get("SMP_TYPE_CODE")
- + "' and ORG_CODE='" + sampleM.get("CERT_INST_CODE") + "' " + "and RATE_CODE='"
- + result.get("FREQ_CODE") + "' and PHY_CODE_L='HJ' AND SPECL_FL='2' ");
- List<HashMap> qtlyResource = mapper.query(sqlucomm.toString());
- if (qtlyResource == null || qtlyResource.size() < 1) {
- return;
- }
- // 被引用的目标取样编号项目集合
- List<JhySampleDModel> tarSmpD = new ArrayList<JhySampleDModel>();
- if (sets.size() == 1) {
- // 只有当前轧批的情况下,如果只有当前一个批,在当前样生成一个取样编号,夹杂内控双倍样
- // 查询当前订单下所有按炉取样的夹杂内控项目
- // 生成试样号、生成项目//双倍样
- String specimen_no = createSpecimen_no((String) result.get("SMP_NO"));
- JhySampleDModel model = getSampleD(specimen_no, result);
- model.setSmp_no((String) result.get("SMP_NO"));
- mapper.insertSampleD(model);
- model.setItems(new ArrayList<JhySampleDItemModel>());
- // 生成复样的项目信息
- int jj = 0;
- for (int i = 0; i < 1; i++) {
- for (int j = 0; j < qtlyResource.size(); j++) {
- HashMap resource = qtlyResource.get(j);
- JhySampleDItemModel item = getSampleItem((String) result.get("SMP_NO"), specimen_no, resource,
- ++jj);
- System.out.println(specimen_no + "===" + jj);
- mapper.insertSampleItem(item);
- item.setQuote_specimen_no(item.getSpecimen_no());
- item.setQuote_seq(item.getSeq());
- model.getItems().add(item);
- }
- }
- tarSmpD.add(model);
- // 处理引用的编号
- sqlucomm.setLength(0);
- sqlucomm.append("SELECT SMP_NO,SPECIMEN_NO,BATCH_NO FROM QCM_JHY_SAMPLE_CONSIGN_D where " + "(SPECIMEN_NO='"
- + result.get("SPECIMEN_NO") + "' or QUOTE_CONSIGN_NO='" + result.get("SPECIMEN_NO") + "' )");
- List<HashMap> quoteSpec = mapper.query(sqlucomm.toString());
- for (HashMap quote : quoteSpec) {
- if (((String) result.get("SMP_NO")).equals(quote.get("SMP_NO"))) {
- continue;
- }
- for (JhySampleDModel tar : tarSmpD) {
- String specimenNoQuote = createSpecimen_no((String) quote.get("SMP_NO"));
- tar.setSmp_no((String) quote.get("SMP_NO"));
- tar.setSpecimen_no(specimenNoQuote);
- tar.setQuote_consign_no(specimen_no);
- tar.setOld_consign_no((String) quote.get("SPECIMEN_NO"));
- mapper.insertSampleD(tar);
- List<JhySampleDItemModel> ranItem = tar.getItems();
- for (JhySampleDItemModel jhySampleDItemModel : ranItem) {
- jhySampleDItemModel.setSmp_no((String) quote.get("SMP_NO"));
- jhySampleDItemModel.setSpecimen_no(specimenNoQuote);
- // Integer seq = selSeq(specimenNoQuote);
- // jhySampleDItemModel.setSeq(seq);
- mapper.insertSampleItem(jhySampleDItemModel);
- }
- }
- }
- } else if (sets.size() == 2) {
- // 如果有另外一个批,在另外一个批生成一个取样编号,夹杂内控双倍样
- // 用后面的轧批生成
- String smp_no = null;
- sets.remove(((String) result.get("BATCH_NO")));// 移处当前轧批号 也就是第一个
- for (QcmJhySampleROrd ord : ords) {
- if (ord.getBatch_no().equals(sets.first())) {
- smp_no = ord.getSmp_no();
- break;
- }
- }
- // 生成试样号、生成项目//双倍样
- String specimen_no = createSpecimen_no(smp_no);
- System.out.println("第一个试样号=====" + smp_no);
- // 22.08.07 以第二轧批号的试样号生成取样编号 那插入的试样号也是第二轧批号的试样号
- // 把 result 中的试样号修改成 第二次轧批号的试样号
- result.put("SMP_NO", smp_no);
- JhySampleDModel model = getSampleD(specimen_no, result);
- model.setSmp_no(smp_no);
- mapper.insertSampleD(model);
- model.setItems(new ArrayList<JhySampleDItemModel>());
- // 生成复样的项目信息
- int jj = 0;
- for (int i = 0; i < 1; i++) {
- for (int j = 0; j < qtlyResource.size(); j++) {
- HashMap resource = qtlyResource.get(j);
- JhySampleDItemModel item = getSampleItem(smp_no, specimen_no, resource, ++jj);
- mapper.insertSampleItem(item);
- item.setQuote_specimen_no(item.getSpecimen_no());
- item.setQuote_seq(item.getSeq());
- model.getItems().add(item);
- System.out.println(item.getSpecimen_no() + "===" + jj);
- }
- }
- tarSmpD.add(model);
- // 处理引用的编号
- sqlucomm.setLength(0);
- sqlucomm.append("SELECT SMP_NO,SPECIMEN_NO,BATCH_NO FROM QCM_JHY_SAMPLE_CONSIGN_D where " + "(SPECIMEN_NO='"
- + result.get("SPECIMEN_NO") + "' or QUOTE_CONSIGN_NO='" + result.get("SPECIMEN_NO")
- + "' and BATCH_NO <> '" + result.get("BATCH_NO") + "')");
- List<HashMap> quoteSpec = mapper.query(sqlucomm.toString());
- for (HashMap quote : quoteSpec) {
- if ((model.getSmp_no()).equals(quote.get("SMP_NO"))) {
- continue;
- }
- System.out.println("对比两个试样号=====" + model.getSmp_no() + "+<>+" + (String) quote.get("SMP_NO"));
- for (JhySampleDModel tar : tarSmpD) {
- String specimenNoQuote = createSpecimen_no((String) quote.get("SMP_NO"));
- System.out.println("第二个试样号=====" + (String) quote.get("SMP_NO"));
- tar.setSmp_no((String) quote.get("SMP_NO"));
- tar.setSpecimen_no(specimenNoQuote);
- tar.setQuote_consign_no(specimen_no);
- tar.setOld_consign_no((String) quote.get("SPECIMEN_NO"));
- mapper.insertSampleD(tar);
- List<JhySampleDItemModel> ranItem = tar.getItems();
- for (JhySampleDItemModel jhySampleDItemModel : ranItem) {
- jhySampleDItemModel.setSmp_no((String) quote.get("SMP_NO"));
- jhySampleDItemModel.setSpecimen_no(specimenNoQuote);
- System.out.println(specimenNoQuote + "===" + jhySampleDItemModel.getSeq());
- mapper.insertSampleItem(jhySampleDItemModel);
- }
- }
- }
- } else {
- // 如果有另外两个批次,在另外两个各生成一个取样编号,夹杂内控各一套
- sets.remove(((String) result.get("BATCH_NO")));
- int i = 0;
- String batchNo = "";// 第二个轧批号
- List<JhySampleDModel> tarSmpDRan = new ArrayList<JhySampleDModel>();
- String smp_01 = null;
- String smp_02 = null;
- for (String set : sets) {
- // 用两个生成单倍样
- if (i == 2) {
- break;// 取了第二个轧批号就结束
- }
- // 用后面的轧批生成
- String smp_no = null;
- sets.remove(((String) result.get("BATCH_NO")));// 移处 第一个轧批号
- // sets中还有两个轧批号
- // 22.08.07 新加 移处第二个轧批号
- /*
- * if (i==1) { sets.remove(batchNo);//移处 第二个轧批号 sets中还有一个轧批号 }
- */
- for (QcmJhySampleROrd ord : ords) {
- if (ord.getBatch_no().equals(set)) {
- smp_no = ord.getSmp_no();
- batchNo = ord.getBatch_no();
- break;
- }
- }
- if (i == 0) {
- smp_01 = smp_no;
- } else {
- smp_02 = smp_no;
- }
- // 生成试样号、生成项目//双倍样
- String specimen_no = createSpecimen_no(smp_no);
- JhySampleDModel model = getSampleD(specimen_no, result);
- model.setSmp_no(smp_no);
- mapper.insertSampleD(model);
- System.out.println("原來的取樣編號0---------" + model.getSpecimen_no() + "试样号:" + model.getSmp_no());
- model.setItems(new ArrayList<JhySampleDItemModel>());
- // System.out.println("原來的取樣編號---------"+specimen_no);
- // 生成复样的单倍项目信息
- for (int j = 0; j < qtlyResource.size(); j++) {
- HashMap resource = qtlyResource.get(j);
- JhySampleDItemModel item = getSampleItem(smp_no, specimen_no, resource, j + 1);
- mapper.insertSampleItem(item);
- model.getItems().add(item);
- }
- i++;
- tarSmpDRan.add(model);
- }
- // 两个轧批相互引用
- // 22.08.07 两个轧批号相互引用 那就取两个轧批号
- // JhySampleDModel model2=tarSmpDRan.get(0); 修改成 JhySampleDModel
- // model2=tarSmpDRan.get(1);
- JhySampleDModel model1 = tarSmpDRan.get(0);
- JhySampleDModel model2 = tarSmpDRan.get(1);
- // 创建model1另一个取样编号
- String specimen_no1 = createSpecimen_no(model1.getSmp_no());
- String specimen_no2 = createSpecimen_no(model2.getSmp_no());
- System.out.println("引用新的的取樣編號1---------" + specimen_no1);
- System.out.println("引用新的的取樣編號2---------" + specimen_no2);
- JhySampleDModel quote = getSampleD(specimen_no1, result);
- quote.setQuote_consign_no(model2.getSpecimen_no());
- // 第二個引用第三個的
- quote.setSmp_no(model1.getSmp_no());
- System.out.println("引用新的的取樣編號1---------" + quote.getSpecimen_no() + "试样号:" + quote.getSmp_no());
- // 22.08.10 引用的复样不显示 状态改为已发送
- quote.setStatus("1");
-
- mapper.insertSampleD(quote);
- quote.setItems(new ArrayList<JhySampleDItemModel>());
- for (int j = 0; j < model2.getItems().size(); j++) {
- JhySampleDItemModel item = model2.getItems().get(j);
- item.setSmp_no(model1.getSmp_no());
- item.setSpecimen_no(specimen_no1);
- item.setQuote_specimen_no(model2.getSpecimen_no());
- item.setQuote_seq(item.getSeq());
- mapper.insertSampleItem(item);
- quote.getItems().add(item);
- }
- tarSmpD.add(quote);
- // 第三個引用第二個的
- JhySampleDModel quote2 = getSampleD(specimen_no2, result);
- quote2.setQuote_consign_no(model1.getSpecimen_no());
- quote2.setSmp_no(model2.getSmp_no());
- System.out.println("引用新的的取樣編號2---------" + quote2.getSpecimen_no() + "试样号:" + quote2.getSmp_no());
- // 22.08.10 引用的复样不显示 状态改为已发送
- quote2.setStatus("1");
-
- mapper.insertSampleD(quote2);
- quote2.setItems(new ArrayList<JhySampleDItemModel>());
- for (int j = 0; j < model1.getItems().size(); j++) {
- JhySampleDItemModel item = model1.getItems().get(j);
- item.setSmp_no(model2.getSmp_no());
- item.setSpecimen_no(specimen_no2);
- item.setQuote_specimen_no(model1.getSpecimen_no());
- item.setQuote_seq(item.getSeq());
- mapper.insertSampleItem(item);
- quote2.getItems().add(item);
- }
- tarSmpD.add(quote2);
- // 查询引用了原取样编号的试样号生成全部引用生成一套复样
- sqlucomm.setLength(0);
- sqlucomm.append("SELECT SMP_NO,SPECIMEN_NO,BATCH_NO FROM QCM_JHY_SAMPLE_CONSIGN_D where " + "(SPECIMEN_NO='"
- + result.get("SPECIMEN_NO") + "' or QUOTE_CONSIGN_NO='" + result.get("SPECIMEN_NO")
- + "' and BATCH_NO <> '" + result.get("BATCH_NO") + "')");
- List<HashMap> quoteSpec = mapper.query(sqlucomm.toString());
- for (HashMap ranQuote : quoteSpec) {
- if ((smp_02).equals(ranQuote.get("SMP_NO")) || (smp_01).equals(ranQuote.get("SMP_NO"))) {
- // 这里已经生成了,不再生成
- continue;
- }
- for (JhySampleDModel tar : tarSmpD) {
- String specimenNoQuote = createSpecimen_no((String) ranQuote.get("SMP_NO"));
- tar.setSmp_no((String) ranQuote.get("SMP_NO"));
- tar.setSpecimen_no(specimenNoQuote);
- // 22.08.09 新加引用编号 4-10轧批号引用 复样2或3的值 引用复样不显示 状态修改成 1
- /*
- * tar.setQuote_consign_no(tar.getSpecimen_no());
- * tar.setOld_consign_no((String)ranQuote.get("SPECIMEN_NO")
- * );
- */
- tar.setStatus("1");
- mapper.insertSampleD(tar);
- System.out.println(
- "引用新的的取樣編號3---------" + specimenNoQuote + "试样号:" + (String) ranQuote.get("SMP_NO"));
- List<JhySampleDItemModel> ranItem = tar.getItems();
- for (JhySampleDItemModel jhySampleDItemModel : ranItem) {
- jhySampleDItemModel.setSmp_no((String) ranQuote.get("SMP_NO"));
- jhySampleDItemModel.setSpecimen_no(specimenNoQuote);
- // Integer seq = selSeq(specimenNoQuote);
- // jhySampleDItemModel.setSeq(seq);
- mapper.insertSampleItem(jhySampleDItemModel);
- }
- }
- }
- }
- }
- private JhySampleDItemModel getSampleItem(String smp_no, String specimen_no, HashMap resource, int iy)
- throws Exception {
- // TODO Auto-generated method stub
- JhySampleDItemModel model = new JhySampleDItemModel();
- model.setSmp_no(smp_no);
- model.setSpecimen_no(specimen_no);
- model.setPhy_code_l((String) resource.get("PHY_CODE_L"));
- ;
- model.setPhy_code_m((String) resource.get("PHY_CODE_M"));
- model.setPhy_code_s((String) resource.get("PHY_CODE_S"));
- model.setPhy_name_l((String) resource.get("PHY_NAME_L"));
- model.setPhy_name_m((String) resource.get("PHY_NAME_M"));
- model.setPhy_name_s((String) resource.get("PHY_NAME_S"));
- model.setItem_code_d((String) resource.get("ITEM_CODE_D"));
- model.setItem_code_t((String) resource.get("ITEM_CODE_T"));
- model.setItem_code_s((String) resource.get("ITEM_CODE_S"));
- model.setItem_code_l((String) resource.get("ITEM_CODE_L"));
- model.setItem_name_d((String) resource.get("ITEM_NAME_D"));
- model.setItem_name_t((String) resource.get("ITEM_NAME_T"));
- model.setItem_name_s((String) resource.get("ITEM_NAME_S"));
- model.setItem_desc_l((String) resource.get("ITEM_DESC_L"));
- model.setIsjudge((String) resource.get("ISJUDGE"));
- model.setPhy_unit((String) resource.get("PHY_UNIT"));
- model.setGroup_seq((String) resource.get("GROUP_SEQ"));
- model.setSpecl_fl((String) resource.get("SPECL_FL"));
- // 试验次数
- model.setTest_qty((BigDecimal) resource.get("SMP_COUNT"));
- model.setSmp_qty((BigDecimal) resource.get("SMP_QTY"));
- model.setCreate_id((String) resource.get("CREATE_ID"));
- model.setCreate_name((String) resource.get("CREATE_NAME"));
- model.setCreate_time(new Date());
- model.setMemo((String) resource.get("MEMO"));
- model.setResmp_seq(String.valueOf(iy));
- model.setStdmax_sign((String) resource.get("STDMAX_SIGN"));
- model.setStdmax((String) resource.get("STDMAX"));
- model.setStdmin_sign((String) resource.get("STDMIN_SIGN"));
- model.setStdmin((String) resource.get("STDMIN"));
- model.setSeq(createItemSeq(smp_no, specimen_no));
- model.setStdmemo((String) resource.get("STDMEMO"));
- // 样品类型
- return model;
- }
- /**
- * 创建项目seq
- *
- * @param specimen_no
- * @param smp_no
- * @param cn
- * @return
- * @throws Exception
- */
- private Integer createItemSeq(String smp_no, String specimen_no) throws Exception {
- // TODO Auto-generated method stub
- StringBuffer sqlucomm = new StringBuffer();
- sqlucomm.append("SELECT max(SEQ) SEQ FROM QCM_JHY_SAMPLE_CONSIGN_D_ITEM WHERE SMP_NO ='" + smp_no
- + "' and SPECIMEN_NO='" + specimen_no + "'");
- HashMap result = mapper.queryOne(sqlucomm.toString());
- Integer SEQ = 0;
- if (result != null && result.get("SEQ") != null) {
- SEQ = ((BigDecimal) result.get("SEQ")).intValue();
- }
- SEQ++;
- return SEQ;
- }
- /**
- * 生成不带 "-" 的UUID
- *
- * @return
- */
- private String getUUID() {
- UUID uuid = UUID.randomUUID();
- String str = uuid.toString();
- String uuidStr = str.replace("-", "");
- return uuidStr;
- }
- /**
- * 获取取样编号
- *
- * @param smp_no
- * @return
- */
- private String createSpecimen_no(String smp_no) {
- // TODO Auto-generated method stub
- String specimen_no = "";
- StringBuffer sqlucomm = new StringBuffer();
- sqlucomm.append("SELECT max(to_number(substr(SPECIMEN_NO,14))) SPECIMEN_NO FROM QCM_JHY_SAMPLE_CONSIGN_D "
- + "WHERE SPECIMEN_NO like '" + smp_no + "%' and SMP_NO='" + smp_no + "'");
- HashMap result = mapper.queryOne(sqlucomm.toString());
- BigDecimal seq = BigDecimal.ZERO;
- if (result != null && result.get("SPECIMEN_NO") != null) {
- seq = (BigDecimal) result.get("SPECIMEN_NO");
- }
- seq = seq.add(BigDecimal.ONE);
- specimen_no = smp_no + String.format("%02d", seq.intValue());
- return specimen_no;
- }
- /**
- * 获取取样编号的顺序号
- *
- * @param smp_no
- * @return
- */
- private Integer selSeq(String SPECIMEN_NO) {
- // TODO Auto-generated method stub
- String seq = "";
- StringBuffer sqlucomm = new StringBuffer();
- sqlucomm.append("SELECT max(seq) seq FROM qcm_jhy_sample_consign_d_item " + "WHERE SPECIMEN_NO = '"
- + SPECIMEN_NO + "'");
- HashMap result = mapper.queryOne(sqlucomm.toString());
- if (result != null && result.get("seq") != null) {
- seq = (String) result.get("seq");
- }
- Integer seqs = Integer.parseInt(seq);
- return seqs + 1;
- }
- private String checkInfo(JSONArray lists) {
- // TODO Auto-generated method stub
- String msg = "";
- if (lists == null || lists.size() < 1) {
- return "未寻到或无可生成检验委托的数据";
- }
- String inspection_lot = "";
- TreeSet<String> treeSet = new TreeSet<String>();
- ResultSet rs = null;
- for (Object list : lists) {
- JSONObject map = (JSONObject) list;
- // 检验号
- msg = checkField("INSPECTION_LOT", "检验号", map);
- if (!"".equals(msg)) {
- return msg;
- }
- // 获取共同检验号
- inspection_lot = map.getString("INSPECTION_LOT");
- treeSet.add(inspection_lot);
- // DESIGN_KEY
- msg = checkField("DESIGN_KEY", "DESIGN_KEY", map);
- if (!"".equals(msg)) {
- return msg;
- }
- // 炉号
- msg = checkField("HEAT_NO", "炉号", map);
- if (!"".equals(msg)) {
- return msg;
- }
- // 轧批号
- msg = checkField("BATCH_NO", "轧批号", map);
- if (!"".equals(msg)) {
- return msg;
- }
- // 全程产线号
- msg = checkField("MSC_PLINE", "全程产线号", map);
- if (!"".equals(msg)) {
- return msg;
- }
- // 全程产线代码
- msg = checkField("PLINE_CODE", "产线代码", map);
- if (!"".equals(msg)) {
- return msg;
- }
- // 全程产线名称
- msg = checkField("PLINE_NAME", "产线名称", map);
- if (!"".equals(msg)) {
- return msg;
- }
- // //交货状态
- // msg=checkField("DELIVERY_STATE_CODE","交货状态代码",map);
- // if (!"".equals(msg)) {
- // return msg;
- // }
- // //交货状态
- // msg=checkField("DELIVERY_STATE_DESC","交货状态",map);
- // if (!"".equals(msg)) {
- // return msg;
- // }
- // 工序代码
- // msg=checkField("PROCESS_CODE","工序代码",map);
- // if (!"".equals(msg)) {
- // return msg;
- // }
- // 厚款长
- msg = checkField("THICK", "厚度", map);
- if (!"".equals(msg)) {
- return msg;
- }
- /*
- * msg=checkField("WIDTH","宽度",map); if (!"".equals(msg)) { return
- * msg; } msg=checkField("LENGTH","长度",map); if (!"".equals(msg)) {
- * return msg; }
- */
- msg = checkField("PSC", "产品码", map);
- if (!"".equals(msg)) {
- return msg;
- }
- msg = checkField("QLTY_SMP_NO", "原试样号", map);
- if (!"".equals(msg)) {
- return msg;
- }
- }
- if (treeSet.size() != 1) {
- return "检验号不一致";
- }
- return msg;
- }
- /**
- * 验证字段
- *
- * @param field
- * 字段
- * @param name
- * 字段名
- * @param map
- * map对象
- * @return
- */
- private String checkField(String field, String name, JSONObject map) {
- if (map.get(field) == null) {
- return name + "不存在";
- }
- String ran = (String) map.get(field);
- if (ran == null || "".equals(ran.trim())) {
- return name + "为空";
- }
- return "";
- }
- private void DuplicateSampleLog(String josnString, String memo) {
- StringBuffer sqlucomm1 = new StringBuffer();
- sqlucomm1.append("Delete From QCM_JHY_SAMPLE_LOG ");
- sqlucomm1.append(
- "where CREATE_TIME <= to_date(to_char(sysdate - 180, 'yyyy-MM-dd hh24:mi:ss'),'yyyy-MM-dd hh24:mi:ss') ");
- try {
- this.getDao("testDao").ExcuteNonQuery(sqlucomm1.toString());
- } catch (SQLException e) {
- }
- int len = 0;
- if (josnString.length() <= 3500) {
- len = josnString.length();
- } else {
- len = 3400;
- }
- String josnli2 = josnString.substring(0, len);
-
- String batchNo = "";
- String smpNO = "";
- JSONArray jsonArray = JSON.parseArray(josnString);
- for (Object list : jsonArray) {
- JSONObject map = (JSONObject) list;
- batchNo = (String) map.get("BATCH_NO");
- smpNO = (String) map.get("QLTY_SMP_NO");
- break;
- }
-
- StringBuffer sqlucomm = new StringBuffer();
- sqlucomm.append("INSERT INTO QCM_JHY_SAMPLE_LOG (GUID,MEMO,");
- sqlucomm.append("CREATE_NAME,CREATE_TIME,JSON_TEXT,SMP_NO) VALUES ('");
- sqlucomm.append(getUUID() + "','" + memo + "',");
- sqlucomm.append(" '"+batchNo+"',sysdate,'" + josnli2 + "','"+smpNO+"')");
- try {
- this.getDao("testDao").ExcuteNonQuery(sqlucomm.toString());
- } catch (SQLException e) {
- }
- }
-
- //重判
- public synchronized String doSentenceDuplicateSample(HashMap parmas) {
- logger.info("重判:==========重判" + parmas.toString());
- String msg = "0";
- if (StringUtils.isBlank(parmas.get("BATCH_NO").toString())) {
- return "轧批号为空";
- }
- if (StringUtils.isBlank(parmas.get("SMP_NO").toString())) {
- return "试样号为空";
- }
- if (StringUtils.isBlank(parmas.get("MATERIAL_NO").toString())) {
- return "取样材料号为空";
- }
- if (StringUtils.isBlank(parmas.get("SMP_TYPE_CODE").toString())) {
- return "取样方式为空";
- }
- if (StringUtils.isBlank(parmas.get("DESIGN_KEY").toString())) {
- return "销售订单号为空";
- }
- if (StringUtils.isBlank(parmas.get("PLINE_CODE").toString())) {
- return "产线为空";
- }
- try {
- 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")+"' "
- +" and t.SMP_TYPE_CODE = '3' and t.Send_Id = '5' ";
- List<HashMap> hmShow = mapper.query(showSql.toString());
- if(hmShow !=null && hmShow.size()>=1){
- return "1";
- }
-
- String smpNo = createQltySamNo(parmas.get("PLINE_CODE").toString());
- String inspectionLot = createQltyInspectionLot(parmas.get("BATCH_NO").toString());
- String specimen_no = createSpecimen_no(smpNo);
-
- //初样、复样重判 QCM_JHY_SAMPLE_CONSIGN_M生成一条
- String sql ="Insert into QCM_JHY_SAMPLE_CONSIGN_M(SMP_NO,HEAT_NO,BATCH_NO,INSPECTION_LOT,BOARD_NO,MATERIAL_NO,PSC, "
- +" PSC_DESC,SMP_CATG,CERT_INST_CODE,CERT_INST_NAME,SMP_TYPE_CODE,SMP_TYPE_NAME,GRADE_CODE,GRADE_NAME, "
- +" PLINE_CODE,PLINE_NAME,VALIDFLAG,MEMO,CREATE_ID,CREATE_NAME,CREATE_TIME,ITEM_FLAG,DUPLICATE_SAMPLE) "
- +" select '"+smpNo+"',HEAT_NO,BATCH_NO,'"+inspectionLot+"',BOARD_NO,'"+parmas.get("MATERIAL_NO")+"',PSC, "
- +" PSC_DESC,SMP_CATG,CERT_INST_CODE,CERT_INST_NAME,SMP_TYPE_CODE,SMP_TYPE_NAME,GRADE_CODE,GRADE_NAME, "
- +" PLINE_CODE,PLINE_NAME,VALIDFLAG,MEMO,'','"+parmas.get("CREATE_NAME")+"',sysdate,ITEM_FLAG,'重判' "
- +" from QCM_JHY_SAMPLE_CONSIGN_M t where t.SMP_NO = '"+parmas.get("SMP_NO")+"' and rownum <= 1 ";
- mapper.insert(sql);
-
- //初样、复样重判 QCM_JHY_SAMPLE_R_ORD生成一条
- sql = "";
- sql = "Insert into QCM_JHY_SAMPLE_R_ORD(DESIGN_KEY,SMP_NO,PSC,PSC_DESC,HEAT_NO,BATCH_NO,INSPECTION_LOT,DELIVERY_STATE_CODE, "
- + " DELIVERY_STATE_DESC,THICK,WIDTH,LENGTH,PLINE_CODE,PLINE_NAME,MSC_PLINE,PROCESS_CODE,CERT_INST_CODE,CERT_INST_NAME, "
- + " SMP_TYPE_CODE,SMP_TYPE_NAME,SMELTING_CNT,PRODUCT_CNT,ASSAY_NO_CP,ASSAY_NO_RL,CIC_ID,JUDGE_STATUS,PROD_CODE,"
- + " PROD_NAME,STEEL_CODE,STEEL_NAME,STD_CODE,STD_NAME,CREATE_TIME,CREATE_ID,CREATE_NAME,ITEM_FLAG,DUPLICATE_SAMPLE) "
- + " select DESIGN_KEY,'"+smpNo+"',PSC,PSC_DESC,HEAT_NO,BATCH_NO,'"+inspectionLot+"',DELIVERY_STATE_CODE,DELIVERY_STATE_DESC, "
- + " THICK,WIDTH,LENGTH,PLINE_CODE,PLINE_NAME,MSC_PLINE,PROCESS_CODE,CERT_INST_CODE,CERT_INST_NAME,SMP_TYPE_CODE,"
- + " SMP_TYPE_NAME,SMELTING_CNT,PRODUCT_CNT,ASSAY_NO_CP,ASSAY_NO_RL,CIC_ID,'0',PROD_CODE,PROD_NAME,STEEL_CODE, "
- + " STEEL_NAME,STD_CODE,STD_NAME,sysdate,'','"+parmas.get("CREATE_NAME")+"',ITEM_FLAG,'重判' "
- + " from QCM_JHY_SAMPLE_R_ORD t where t.SMP_NO = '"+parmas.get("SMP_NO")+"' and rownum <= 1 ";
- mapper.insert(sql);
-
- //初样、复样重判 QCM_JHY_SAMPLE_CONSIGN_D生成一条
- sql = "";
- sql = " Insert into QCM_JHY_SAMPLE_CONSIGN_D(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,QUOTE_CONSIGN_NO,OLD_CONSIGN_NO,"
- + " PLINE_CODE,PLINE_NAME,STATUS,VALIDFLAG,SOURCE,GUID,SEND_ID,SEND_NAME,SEND_TIME,CHEM_ITEM,PRODUCT_CNT,CREATE_TIME,SMP_LOCATION_CODE,"
- + " MEMO,WEIGHT,WEIGHT_STD,WEIGHT_SFD,SEND_MEMO,RZ_ROLL_MANA_NO,RZ_MIXROLL,RZ_OLD_SAMPL_NO,RZ_ROLL_SLAB_SEQ) "
- + " select '"+smpNo+"','"+specimen_no+"',HEAT_NO,BATCH_NO,'"+inspectionLot+"',FREQ_CODE,FREQ_NAME,'"+parmas.get("MATERIAL_NO")+"',"
- + " '3','件件取样',CONSIGN_NO,CONSIGN_NO_SEQ,TEST_QTY,SMP_QTY,SMP_LOCATION,BOARD_NO,QUOTE_CONSIGN_NO,OLD_CONSIGN_NO,"
- + " PLINE_CODE,PLINE_NAME,'3',VALIDFLAG,SOURCE,GUID,'5','重判',sysdate,CHEM_ITEM,PRODUCT_CNT,sysdate,SMP_LOCATION_CODE,"
- + " 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"
- + " where SMP_NO = '"+parmas.get("SMP_NO")+"' and BATCH_NO = '"+parmas.get("BATCH_NO")+"'"
- + " and MATERIAL_NO = '"+parmas.get("MATERIAL_NO")+"' and rownum <= 1 ";
- mapper.insert(sql);
-
- //引用初样实绩
- //查询这个试样号 轧批号 获取初样所有取样编号
- sql = "";
- String specimeNoM = "0";
- //判断是重判初样还是复样
- if(parmas.get("SMP_TYPE_CODE").equals("0")){
- //查询初样当前子板信息
- /* String dma = " select t.SPECIMEN_NO from QCM_JHY_SAMPLE_CONSIGN_D t where t.smp_type_code = '0' "
- +" and t.batch_no='"+parmas.get("BATCH_NO")+"' and t.material_no = '"+parmas.get("MATERIAL_NO")+"' and rownum=1 ";
- List<HashMap> hmaterialNo = mapper.query(dma.toString());
- if(hmaterialNo!=null && hmaterialNo.size()>=1){
- specimeNoM = hmaterialNo.get(0).get("SPECIMEN_NO").toString();
- }else{
- SqlSession.rollback();
- return "该子板没有相应性能!";
- }*/
- //查询初样所有信息
- sql = " select t.SPECIMEN_NO from QCM_JHY_SAMPLE_CONSIGN_D t "
- +" where t.smp_type_code = '0' "
- +" and t.batch_no='"+parmas.get("BATCH_NO")+"' and t.material_no = '"+parmas.get("MATERIAL_NO")+"' ";//and t.material_no = '"+parmas.get("MATERIAL_NO")+"'
- }else if(parmas.get("SMP_TYPE_CODE").equals("1")){//20230807 E2304510 05、06/08/09 复样重判,没有带初样值seq:50
- sql = " select t.SPECIMEN_NO,'0' seq "
- +" from QCM_JHY_SAMPLE_CONSIGN_D t "
- +" where t.smp_type_code = '1' "
- +" and t.batch_no = '"+parmas.get("BATCH_NO")+"' "
- +" and t.material_no = '"+parmas.get("MATERIAL_NO")+"' "
- +" UNION ALL "
- +" select t.SPECIMEN_NO,'50' seq "
- +" from QCM_JHY_SAMPLE_CONSIGN_D t,qcm_jhy_sample_consign_d_item i "
- +" where t.specimen_no = i.specimen_no "
- +" and t.smp_type_code = '1' "
- +" and t.batch_no = '"+parmas.get("BATCH_NO")+"' "
- +" and i.seq >=50 "
- +" group by t.specimen_no "
- ;
- }else{
- sql = " select t.SPECIMEN_NO from QCM_JHY_SAMPLE_CONSIGN_D t "
- +" where t.SMP_NO = '"+parmas.get("SMP_NO")+"' "
- +" and t.batch_no='"+parmas.get("BATCH_NO")+"' and t.material_no = '"+parmas.get("MATERIAL_NO")+"' ";
- }
- List<HashMap> hmap = mapper.query(sql.toString());
- if(hmap==null || hmap.size()<=0){
- SqlSession.rollback();
- return "该子板没有相应性能!!!";
- }
- for (HashMap hm : hmap) {
- //查询当前初样取样编号的所有实绩
- List<HashMap> hmPhysics=null;
- sql = "";
- if(parmas.get("SMP_TYPE_CODE").equals("1")){//复样重判
- if(hm.get("SEQ").equals("50")){//拿取复样中的初样
- sql = "select t.specimen_no,t.seq,t.test_qty from QCM_JHY_INSP_PHYSICS t "
- + " where t.specimen_no = '"+(String)hm.get("SPECIMEN_NO")+"' and t.SEQ>=50 order by t.seq ";
- hmPhysics = mapper.query(sql.toString());
- }else{
- sql = "select t.specimen_no,t.seq,t.test_qty from QCM_JHY_INSP_PHYSICS t "
- + " where t.specimen_no = '"+(String)hm.get("SPECIMEN_NO")+"' and t.SEQ<50 ";
- hmPhysics = mapper.query(sql.toString());
- }
- }else{
- sql = "select t.specimen_no,t.seq,t.test_qty from QCM_JHY_INSP_PHYSICS t "
- + " where t.specimen_no = '"+(String)hm.get("SPECIMEN_NO")+"' and t.SEQ<50 ";
- hmPhysics = mapper.query(sql.toString());
- }
- for (HashMap hashMap : hmPhysics) {
- //获取specimenNoZy取样编号 seq最大值
- Integer seqint=0;
- sql = "";
- if(parmas.get("SMP_TYPE_CODE").equals("1")){//复样重判
- if(hm.get("SEQ").equals("50")){//拿取复样中的初样
- BigDecimal big = (BigDecimal)hashMap.get("SEQ");
- String seqs = big.toString();
- seqint = Integer.parseInt(seqs);
- }else{
- sql = "select decode(max(seq),'','1',max(seq))+1 as SEQ from QCM_JHY_INSP_PHYSICS t "
- + " where t.specimen_no = '"+specimen_no+"'";
- List<HashMap> seqhm = mapper.query(sql.toString());
- BigDecimal big = (BigDecimal)seqhm.get(0).get("SEQ");
- String seqs = big.toString();
- seqint = Integer.parseInt(seqs);
- }
- }else{
- // if(hashMap.get("SPECIMEN_NO").equals(specimeNoM)){
- sql = "select decode(max(seq),'','1',max(seq))+1 as SEQ from QCM_JHY_INSP_PHYSICS t "
- + " where t.specimen_no = '"+specimen_no+"' and t.SEQ<50 ";
- List<HashMap> seqhm = mapper.query(sql.toString());
- BigDecimal big = (BigDecimal)seqhm.get(0).get("SEQ");
- String seqs = big.toString();
- seqint = Integer.parseInt(seqs);
- /* }else{
- sql = "select decode(max(seq),'','49',max(seq))+1 as SEQ from QCM_JHY_INSP_PHYSICS t "
- + " where t.specimen_no = '"+specimen_no+"' and t.SEQ>=50";
- List<HashMap> seqhm = mapper.query(sql.toString());
- BigDecimal big = (BigDecimal)seqhm.get(0).get("SEQ");
- String seqs = big.toString();
- seqint = Integer.parseInt(seqs);
- }*/
- }
- sql = "";
- sql = " insert into QCM_JHY_INSP_PHYSICS "
- +" (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, "
- +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
- +" VAL13,VAL14,VAL15,AVG_VAL,GUID,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, "
- +" PHY_UNIT,MEMO,QUOTE_SPECIMEN_NO) "
- +" 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, "
- +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
- +" VAL13,VAL14,VAL15,AVG_VAL,GUID,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, "
- +" PHY_UNIT,MEMO,QUOTE_SPECIMEN_NO from QCM_JHY_INSP_PHYSICS t "
- +" where t.specimen_no = '"+(String)hashMap.get("SPECIMEN_NO")+"' "
- + "and t.seq = '"+hashMap.get("SEQ")+"' "
- + "and t.test_qty = '"+hashMap.get("TEST_QTY")+"' ";
- mapper.insert(sql);
-
- sql = "";
- sql = "insert into QCM_JHY_SAMPLE_CONSIGN_D_ITEM "
- +" (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_SPECIMEN_NO,QUOTE_SEQ,ITEM_FLAG,MEMO,CREATE_ID,CREATE_NAME,CREATE_TIME,STDMEMO,RESMP_SEQ, "
- +" PHY_GROUP_CODE,FY_QUOTE_SPECIMEN_NO) "
- +" select '"+specimen_no+"','"+seqint+"','"+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_SPECIMEN_NO,QUOTE_SEQ,ITEM_FLAG,MEMO,CREATE_ID,CREATE_NAME,CREATE_TIME,STDMEMO,RESMP_SEQ, "
- +" PHY_GROUP_CODE,FY_QUOTE_SPECIMEN_NO from QCM_JHY_SAMPLE_CONSIGN_D_ITEM "
- + " where specimen_no = '"+(String)hashMap.get("SPECIMEN_NO")+"' "
- + "and seq = '"+hashMap.get("SEQ")+"' ";
- mapper.insert(sql);
- }
- }
-
- //修改判定那边的检验号
- sql = "";
- sql = " update zj_result_all@xgcx t set t.billetid_jy = '"+inspectionLot+"',t.PHYSRESULT='0',t.PHYSRESULT_DESC='',t.PIC_IS_LOCK='0' "
- + " where t.billetid = '"+parmas.get("MATERIAL_NO")+"' ";
- mapper.updateJudgeStatus(sql.toString());
- sql = "";
- sql = "INSERT INTO QCM_JUDGE_LOG "
- +" ( JUDGE_TYPE,MATERIAL_NO,CREATE_TIME,CREATE_NAME,PROD_LINE)"
- +" VALUES "
- +" ( 'P', '"+smpNo+"', SYSDATE,'system','"+parmas.get("PLINE_CODE")+"')";
- mapper.insert(sql.toString());
-
- SqlSession.commit();
- msg = "1";
- } catch (Exception e) {
- logger.error(e.toString() + e.getMessage() + "重判:json数据:" + parmas.toString() + "\n");
- e.printStackTrace();
- SqlSession.rollback();
- } finally {
- SqlSession.close();
- }
- if ("1".equals(msg)) {
- return "1";
- } else {
- return "生成失败!";
- }
- }
-
- //(实物样)中厚板预测结果不合格 若预测结果不合格,该母板封闭,按要求取实物样进行判定;
- public synchronized String ZHBCY(String smpNo){
- try {
- String sql="select * from qcm_jhy_sample_consign_d t,qcm_jhy_sample_r_ord r "
- +" where t.smp_no = r.smp_no and t.smp_no = '"+smpNo+"' and rownum=1 ";
- List<HashMap> lists=mapper.query(sql.toString());
- if (lists==null || lists.size()<1) {
- return "未找到相应委托";
- }
- if (lists!=null && lists.size()>=1) {
- String specimen_no = lists.get(0).get("SPECIMEN_NO").toString();
- String specimen_no2 = lists.get(0).get("RZ_OLD_SAMPL_NO").toString();
- String steel_code = lists.get(0).get("STEEL_CODE").toString();
- if(!"Q235B".equals(steel_code) && !"Q355B".equals(steel_code)){
- return smpNo + "的牌号不为:[Q235B/Q355B]";
- }
- if(StringUtils.isBlank(specimen_no2)){
- return smpNo + "抽样编号为空不是预测委托";
- }
- //判断是预测抽样实际委托 还是预测委托
- if(!specimen_no.equals(specimen_no2)){
- //预测委托
- ZHBYCWT(lists);
- }/*else if(specimen_no.equals(specimen_no2)){
- //抽样委托
- ZHBCYWT(lists);
- }*/
- }
-
- SqlSession.commit();
- } catch (Exception e) {
- e.printStackTrace();
- SqlSession.rollback();
- } finally {
- SqlSession.close();
- }
- return "成功";
- }
-
- public void ZHBYCWT(List<HashMap> lists){
- 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();
- String sql4= "INSERT INTO QCM_JUDGE_OPERATE_LOG (OPERATE_TYPE,PARAMS,OPERATE_NAME,PROD_LINE,BATCHNO,MEMO) "
- + " VALUES('取实物再次判定','"+lists.get(0).get("MATERIAL_NO")+"','ZHBYCWT','"+lists.get(0).get("PLINE_CODE")+"',"
- + " '"+lists.get(0).get("BATCH_NO")+"','"+logmemo2+"') ";
- mapper.insert(sql4);
-
- String sql = " update QCM_JHY_SAMPLE_CONSIGN_D t "
- + " set t.STATUS = '0',RZ_OLD_SAMPL_NO='',t.RZ_ROLL_SLAB_SEQ='',t.RZ_MIXROLL=t.RZ_MIXROLL || '1' "
- + " where t.SPECIMEN_NO = '"+(String)lists.get(0).get("SPECIMEN_NO")+"' ";
- mapper.UpdateQcmWt(sql.toString());
-
- sql="";
- sql = " update Qcm_Jhy_Sample_r_Ord t "
- + " set t.PHY_ID = '',t.JUDGE_STATUS='0',JUDGE_RESULT_CODE='',JUDGE_RESULT_DESC='',"
- + " JUDGE_NAME='',JUDGE_TIME='',JUDGE_MEMO='' "
- + " where t.SMP_NO = '"+(String)lists.get(0).get("SMP_NO")+"' ";
- mapper.UpdateQcmWt(sql.toString());
-
- sql="";
- sql = " update zj_result_all@xgcx t "
- + " set t.PHYSRESULT = '0',t.PHYSRESULT_DESC='',PHYSID='',PIC_IS_LOCK='' "
- + " where t.BILLETID_JY = '"+(String)lists.get(0).get("INSPECTION_LOT")+"' ";
- mapper.UpdateQcmWt(sql.toString());
-
- }
-
- public void ZHBCYWT(List<HashMap> lists){
- String SMP_NO = lists.get(0).get("SMP_NO").toString();//原先试样号
- String SPECIMEN_NO = lists.get(0).get("SPECIMEN_NO").toString();//原先取样编号
- String freq_code = lists.get(0).get("FREQ_CODE").toString();
- String pline_code = lists.get(0).get("PLINE_CODE").toString();
- String smpNo = createQltySamNo(pline_code);//新试样号
- String specimenNo = createSpecimen_no(smpNo);//新取样编号
- if("A".equals(freq_code)){
- String sql = "insert into qcm_jhy_sample_consign_m "
- +" (smp_no,heat_no,batch_no,inspection_lot,board_no,material_no,psc,psc_desc, "
- +" smp_catg,cert_inst_code,cert_inst_name,smp_type_code,smp_type_name, "
- +" grade_code,grade_name, pline_code, pline_name,validflag,create_time) "
- +" select '"+smpNo+"',heat_no,batch_no,inspection_lot,board_no,material_no, "
- +" psc,psc_desc,smp_catg,cert_inst_code,cert_inst_name,smp_type_code, "
- +" smp_type_name,grade_code,grade_name,pline_code,pline_name,validflag,sysdate "
- +" from qcm_jhy_sample_consign_m t "
- +" where t.smp_no = '"+SMP_NO+"' ";
- mapper.insert(sql);
-
- sql="";
- sql = "insert into qcm_jhy_sample_r_ord "
- +" (design_key, smp_no, psc, psc_desc, heat_no, batch_no, inspection_lot, delivery_state_code, delivery_state_desc, thick, width, "
- +" length, pline_code, pline_name, msc_pline, process_code, cert_inst_code, cert_inst_name, smp_type_code, smp_type_name, "
- +" prod_code, prod_name, steel_code, steel_name, std_code, std_name, create_time) "
- +" select design_key, '"+smpNo+"', psc, psc_desc, heat_no, batch_no, inspection_lot, delivery_state_code, delivery_state_desc, thick, width, length, "
- +" pline_code, pline_name, msc_pline, process_code, cert_inst_code, cert_inst_name, smp_type_code, smp_type_name, prod_code, "
- +" prod_name, steel_code, steel_name, std_code, std_name, sysdate "
- +" from qcm_jhy_sample_r_ord t "
- +" where t.smp_no = '"+SMP_NO+"' ";
- mapper.insert(sql);
-
- sql="";
- sql="insert into qcm_jhy_sample_consign_d "
- +" (smp_no, specimen_no, heat_no, batch_no, inspection_lot, freq_code, freq_name, material_no, "
- +" smp_type_code, smp_type_name,test_qty, smp_qty, smp_location,board_no,pline_code, "
- +" pline_name, status, validflag, source,guid, chem_item, product_cnt, create_time, "
- +" smp_location_code, memo, weight, weight_std, weight_sfd,rz_mixroll,rz_old_sampl_no, "
- +" rz_roll_slab_seq, process_no,process_nos, process_code) "
- +" select "
- +" '"+smpNo+"', '"+specimenNo+"', heat_no, batch_no, inspection_lot, freq_code, freq_name, material_no, "
- +" smp_type_code,smp_type_name,test_qty, smp_qty, smp_location,board_no,pline_code, "
- +" pline_name, '0', validflag, source,guid,chem_item, product_cnt, sysdate, "
- +" smp_location_code,memo, weight, weight_std, weight_sfd, rz_mixroll,rz_old_sampl_no, "
- +" '预测抽样不合格再次送样', process_no,process_nos, process_code "
- +" from qcm_jhy_sample_consign_d t where t.specimen_no = '"+SPECIMEN_NO+"' ";
- mapper.insert(sql);
-
- sql="";
- sql="insert into qcm_jhy_sample_consign_d_item "
- +" (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_specimen_no, quote_seq, item_flag, memo, create_id, create_name, create_time, stdmemo, "
- +" phy_group_code, fy_quote_specimen_no, quote_memo) "
- +" select "
- +" '"+specimenNo+"', 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_specimen_no, quote_seq, item_flag, memo, create_id, create_name, create_time, stdmemo, "
- +" phy_group_code, fy_quote_specimen_no, quote_memo "
- +" from qcm_jhy_sample_consign_d_item t where t.specimen_no = '"+SPECIMEN_NO+"' ";
- mapper.insert(sql);
- sql="";
- sql = " update Qcm_Jhy_Sample_r_Ord t "
- + " set t.INSPECTION_LOT = '' "
- + " where t.SMP_NO = '"+SMP_NO+"' ";
- mapper.UpdateQcmWt(sql.toString());
-
- }else if("B".equals(freq_code) || "F".equals(freq_code)){
-
- }
- }
- //中厚板预测
- /***
- * 批批取样
- * 预测 复样不合格判不合格 若复样不合格则在该取样批次时间段内其他批号钢板每批号按要求取实物样进行判定
- * 预测 取样实际检测结果 并在该取样批次内其他批号钢板每批号按要求取实物样进行判定
- * @param smpNo
- * @return
- */
- public synchronized String ZHBCYK(String smpNo){
- try {
- String sql="select * from qcm_jhy_sample_consign_d t,qcm_jhy_sample_r_ord r "
- +" where t.smp_no = r.smp_no and t.smp_no = '"+smpNo+"' "
- +" and t.RZ_MIXROLL is not null and t.RZ_OLD_SAMPL_NO is not null "
- +" and rownum=1 ";
- List<HashMap> lists=mapper.query(sql.toString());
- if (lists==null || lists.size()<1) {
- return "未找到相应委托";
- }
- String batch_no = lists.get(0).get("BATCH_NO").toString();
- String rz_mixroll = lists.get(0).get("RZ_MIXROLL").toString();
- String rz_old_sampl_no = lists.get(0).get("RZ_OLD_SAMPL_NO").toString();
- String smp_type_code = lists.get(0).get("SMP_TYPE_CODE").toString();//初复样
- String material_no = lists.get(0).get("MATERIAL_NO").toString();
- String pline_code = lists.get(0).get("PLINE_CODE").toString();
-
- String logmemo="复样不合格批号"+ batch_no+','+rz_mixroll+','+rz_old_sampl_no;
- String sql3= "INSERT INTO QCM_JUDGE_OPERATE_LOG (OPERATE_TYPE,PARAMS,OPERATE_NAME,PROD_LINE,BATCHNO,MEMO) "
- + " VALUES('Q235B/Q355B两小时内的批次','"+material_no+"','ZHBCYK','"+pline_code+"',"
- + " '"+batch_no+"','"+logmemo+"') ";
- mapper.insert(sql3);
- sql="";
- sql="select * from qcm_jhy_sample_consign_d t "
- +" where t.RZ_OLD_SAMPL_NO = '"+rz_old_sampl_no+"' and RZ_MIXROLL is null and RZ_ROLL_SLAB_SEQ like '每块%' ";
- List<HashMap> lists2=mapper.query(sql.toString());
- if (lists2 !=null && lists2.size()>=1) {
- return "已进行过批次内其他批号钢板每批号按要求取实物样进行判定! 不可重复操作!";
- }
-
- //查询出最初抽样轧批号
- sql="";
- sql="select * from qcm_jhy_sample_consign_d t "
- +" where t.SPECIMEN_NO = '"+rz_old_sampl_no+"' and rownum=1 ";
- List<HashMap> lists3=mapper.query(sql.toString());
- String batch_no2 = lists3.get(0).get("BATCH_NO").toString();
-
- //取其它轧批实物样
- if (smp_type_code.equals("1")){
- //预测 把全部的初复样获取
- sql="";
- sql="select * from qcm_jhy_sample_consign_d t "
- +" where t.RZ_OLD_SAMPL_NO = '"+rz_old_sampl_no+"' "
- +" and t.RZ_MIXROLL= '"+rz_mixroll+"'"
- +" or t.BATCH_NO<>'"+batch_no+"' or t.BATCH_NO<>'"+batch_no2+"' ";
- List<HashMap> lists4=mapper.query(sql.toString());
-
- sql="";
- sql = " update QCM_JHY_SAMPLE_CONSIGN_D t "
- + " set t.RZ_MIXROLL='' "
- + " where t.BATCH_NO in ('"+batch_no+"','"+batch_no2+"') ";
- mapper.UpdateQcmWt(sql.toString());
-
- for (HashMap hashMap : lists4) {
-
- if(hashMap.get("SMP_TYPE_CODE").equals("1")){
- continue;
- }
- //判断有没有复样
- sql="";
- sql="select * from qcm_jhy_sample_consign_d t "
- +" where t.RZ_OLD_SAMPL_NO = '"+rz_old_sampl_no+"' "
- +" and t.RZ_MIXROLL= '"+rz_mixroll+"'"
- +" and t.BATCH_NO='"+hashMap.get("BATCH_NO")+"' and t.SMP_TYPE_CODE='1' ";
- List<HashMap> lists5=mapper.query(sql.toString());
- if(lists5!=null && lists5.size()>=1){
- sql="";
- sql = " update Qcm_Jhy_Sample_r_Ord t "
- + " set t.JUDGE_STATUS='3',INSPECTION_LOT='',MEMO='每块取样' "
- + " where t.SMP_NO = '"+(String)lists5.get(0).get("SMP_NO")+"' ";
- mapper.UpdateQcmWt(sql.toString());
-
- sql="";
- sql = " update QCM_JHY_SAMPLE_CONSIGN_D t "
- + " set t.RZ_MIXROLL='' "
- + " where t.SMP_NO = '"+(String)lists5.get(0).get("SMP_NO")+"' ";
- mapper.UpdateQcmWt(sql.toString());
-
- //把初样检验号还原
- sql="";
- sql = " update Qcm_Jhy_Sample_r_Ord t "
- + " set INSPECTION_LOT='"+hashMap.get("INSPECTION_LOT")+"' "
- + " where t.SMP_NO = '"+(String)hashMap.get("SMP_NO")+"' ";
- mapper.UpdateQcmWt(sql.toString());
- }
-
- sql="";
- sql = " update QCM_JHY_SAMPLE_CONSIGN_D t "
- + " set t.STATUS = '0',t.RZ_MIXROLL='',t.RZ_ROLL_SLAB_SEQ='复样不合格送实物样',ONEMEMO='"+batch_no+"'||'复样不合格' "
- + " where t.SPECIMEN_NO = '"+(String)hashMap.get("SPECIMEN_NO")+"' ";
- mapper.UpdateQcmWt(sql.toString());
-
- sql="";
- sql = " update Qcm_Jhy_Sample_r_Ord t "
- + " set t.PHY_ID = '',t.JUDGE_STATUS='',JUDGE_RESULT_CODE='',JUDGE_RESULT_DESC='',"
- + " JUDGE_NAME='',JUDGE_TIME='',JUDGE_MEMO='' "
- + " where t.SMP_NO = '"+(String)hashMap.get("SMP_NO")+"' ";
- mapper.UpdateQcmWt(sql.toString());
-
- sql="";
- sql = " update zj_result_all@xgcx t "
- + " set t.PHYSRESULT = '0',t.PHYSRESULT_DESC='',PHYSID='',PIC_IS_LOCK='' "
- + " where t.BILLETID_JY = '"+(String)hashMap.get("INSPECTION_LOT")+"' ";
- mapper.UpdateQcmWt(sql.toString());
-
- String logmemo2="复样不合格批号:"+batch_no+','+rz_mixroll+','+rz_old_sampl_no;
- String sql4= "INSERT INTO QCM_JUDGE_OPERATE_LOG (OPERATE_TYPE,PARAMS,OPERATE_NAME,PROD_LINE,BATCHNO,MEMO) "
- + " VALUES('Q235B/Q355B两小时内的批次','"+hashMap.get("MATERIAL_NO")+"','ZHBCYK','"+pline_code+"',"
- + " '"+hashMap.get("BATCH_NO")+"','"+logmemo2+"') ";
- mapper.insert(sql4);
- }
-
- }/*else{
- //最初抽样轧批号
- if(!StringUtils.isBlank(lists.get(0).get("RZ_ROLL_SLAB_SEQ").toString())){
- String rz_roll_slab_seq = lists.get(0).get("RZ_ROLL_SLAB_SEQ").toString();
- if("(实)实物样".equals(rz_roll_slab_seq)){
- sql="";
- sql="select * from qcm_jhy_sample_consign_d t "
- +" where t.RZ_OLD_SAMPL_NO = '"+rz_old_sampl_no+"' "
- +" and t.RZ_MIXROLL= '"+rz_mixroll+"'"
- +" or t.BATCH_NO<>'"+batch_no2+"' ";
- List<HashMap> lists4=mapper.query(sql.toString());
- for (HashMap hashMap : lists4) {
- sql="";
- sql = " update QCM_JHY_SAMPLE_CONSIGN_D t "
- + " set t.STATUS = '0',t.RZ_MIXROLL='',t.RZ_ROLL_SLAB_SEQ='每块(实)实物样',ONEMEMO='"+batch_no+"'||'最初预测抽样实物按质量设计不合格' "
- + " where t.SPECIMEN_NO = '"+(String)hashMap.get("SPECIMEN_NO")+"' ";
- mapper.UpdateQcmWt(sql.toString());
-
- sql="";
- sql = " update Qcm_Jhy_Sample_r_Ord t "
- + " set t.PHY_ID = '',t.JUDGE_STATUS='',JUDGE_RESULT_CODE='',JUDGE_RESULT_DESC='',"
- + " JUDGE_NAME='',JUDGE_TIME='',JUDGE_MEMO='' "
- + " where t.SMP_NO = '"+(String)hashMap.get("SMP_NO")+"' ";
- mapper.UpdateQcmWt(sql.toString());
-
- sql="";
- sql = " update zj_result_all@xgcx t "
- + " set t.PHYSRESULT = '0',t.PHYSRESULT_DESC='',PHYSID='',PIC_IS_LOCK='' "
- + " where t.BILLETID_JY = '"+(String)hashMap.get("INSPECTION_LOT")+"' ";
- mapper.UpdateQcmWt(sql.toString());
- }
- }else{
- return smpNo+"当前试样号不是最初抽样轧批号!";
- }
- }else{
- return smpNo+"当前试样号不是最初抽样轧批号!";
- }
- }*/
-
-
-
-
- SqlSession.commit();
- } catch (Exception e) {
- e.printStackTrace();
- SqlSession.rollback();
- } finally {
- SqlSession.close();
- }
- return "成功";
- }
-
- //卷板件件取样
- public void doRzLtevery(JSONObject list){
- String materialNo= list.getString("MATERIAL_NO").toString();
- String lw = materialNo.substring(materialNo.length() - 1,materialNo.length());//截取后一位判断是否是小卷
- if(!"0".equals(lw)){//不等于0的都是小卷
- return;
- }
- String sql = " select * from qcm_jhy_sample_consign_d t,qcm_jhy_sample_r_ord r "
- +" where t.smp_no = r.smp_no and r.smp_no = '"+list.getString("QLTY_SMP_NO")+"' and rownum = 1 ";
- List<HashMap> hm = mapper.query(sql.toString());
- if(hm!=null && hm.size()>=1){
- String design_key = hm.get(0).get("DESIGN_KEY").toString();
- String psc = hm.get(0).get("PSC").toString();
- String thick = hm.get(0).get("THICK").toString();
- String batch_no = hm.get(0).get("BATCH_NO").toString();
- sql = "select t.* from qcm_jhy_sample_consign_d t,qcm_jhy_sample_r_ord r "
- +" where t.smp_no = r.smp_no "
- +" and r.design_key = '"+design_key+"' "
- +" and r.psc = '"+psc+"' "
- +" and r.thick = '"+thick+"' "
- +" and r.batch_no = '"+batch_no+"' "
- +" and t.smp_type_code = '0' "
- //+" and t.ARTIFICIAL_MEMO is null "
- +" and r.Judge_Result_Code is not null "
- +" and rownum = 1 ";
- List<HashMap> hashMap = mapper.query(sql.toString());
- if(hashMap!=null && hashMap.size()>=1){
- String smpNo = createQltySamNo(hashMap.get(0).get("PLINE_CODE").toString());
- String specimen_no = createSpecimen_no(smpNo);
- String inspectionLot = createQltyInspectionLot(batch_no);
-
- String sqlstr = "insert into qcm_jhy_sample_consign_m "
- +" (smp_no,heat_no,batch_no,inspection_lot,board_no,material_no,psc,psc_desc, "
- +" smp_catg,cert_inst_code,cert_inst_name,smp_type_code,smp_type_name, "
- +" grade_code,grade_name, pline_code, pline_name,validflag,create_time) "
- +" select '"+smpNo+"',heat_no,batch_no,'"+inspectionLot+"',board_no,'"+list.getString("MATERIAL_NO")+"',psc,psc_desc, "
- +" smp_catg,cert_inst_code,cert_inst_name,smp_type_code,smp_type_name, "
- +" grade_code,grade_name,pline_code,pline_name,validflag,sysdate "
- +" from qcm_jhy_sample_consign_m t "
- +" where t.smp_no = '"+hashMap.get(0).get("SMP_NO").toString()+"' ";
- mapper.insert(sqlstr);
-
- sqlstr="";
- sqlstr = "insert into qcm_jhy_sample_r_ord "
- +" (design_key, smp_no, psc, psc_desc, heat_no, batch_no, inspection_lot, delivery_state_code, delivery_state_desc, thick, width, "
- +" length, pline_code, pline_name, msc_pline, process_code, cert_inst_code, cert_inst_name, smp_type_code, smp_type_name, "
- +" prod_code, prod_name, steel_code, steel_name, std_code, std_name, create_time) "
- +" select design_key, '"+smpNo+"', psc, psc_desc, heat_no, batch_no, '"+inspectionLot+"', delivery_state_code, delivery_state_desc, thick, width, "
- +" length,pline_code, pline_name, msc_pline, process_code, cert_inst_code, cert_inst_name, smp_type_code, smp_type_name, "
- +" prod_code,prod_name, steel_code, steel_name, std_code, std_name, sysdate "
- +" from qcm_jhy_sample_r_ord t "
- +" where t.smp_no = '"+hashMap.get(0).get("SMP_NO").toString()+"' ";
- mapper.insert(sqlstr);
-
- String uuidstr = this.getUUID();
- sqlstr="";
- sqlstr="insert into qcm_jhy_sample_consign_d "
- +" (smp_no, specimen_no, heat_no, batch_no, inspection_lot, freq_code, freq_name, material_no, "
- +" smp_type_code, smp_type_name,test_qty, smp_qty, smp_location,board_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,process_nos, process_code) "
- +" select "
- +" '"+smpNo+"', '"+specimen_no+"', heat_no, batch_no, '"+inspectionLot+"', freq_code, freq_name, '"+list.getString("MATERIAL_NO")+"', "
- +" '3','件件取样',test_qty, smp_qty, smp_location,board_no,pline_code, "
- +" pline_name, '0', validflag, source,'"+uuidstr+"',chem_item, product_cnt, sysdate, "
- +" smp_location_code,memo, weight, weight_std, weight_sfd,process_no,process_nos, process_code "
- +" from qcm_jhy_sample_consign_d t where t.smp_no = '"+hashMap.get(0).get("SMP_NO").toString()+"' ";
- mapper.insert(sqlstr);
-
- sqlstr="";
- sqlstr="insert into qcm_jhy_sample_consign_d_item "
- +" (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, create_id, create_name, create_time, stdmemo,phy_group_code) "
- +" 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, create_id, create_name, sysdate, stdmemo,phy_group_code "
- +" from qcm_jhy_sample_consign_d_item t where t.specimen_no = '"+hashMap.get(0).get("SPECIMEN_NO").toString()+"' ";
- mapper.insert(sqlstr);
-
- if((list.getString("PLINE_CODE").equals("RZ1") || list.getString("PLINE_CODE").equals("LT1")) && list.getString("TYPE").equals("3")){
-
- if(list.getString("PLINE_CODE").equals("RZ1")){//2月21日改成LIKE形式
- String rzmaterialNo=list.getString("MATERIAL_NO").substring(0,12);
- String rzlt=" update qcm_judge_coil_result set PIC_IS_LOCK='0',PHYSRESULT = '0', PHYSRESULT_DESC = '待判', inspection_lot = '"+inspectionLot+"' "
- +" where coil_no like '"+rzmaterialNo+"%' ";
- mapper.updateJudgeStatus(rzlt.toString());
-
- rzlt="";
- rzlt=" update tbh02_coil_comm set SAMPL_NO = '"+inspectionLot+"' where OLD_SAMPL_NO like '"+rzmaterialNo+"%' ";
- mapper.updateJudgeStatus(rzlt.toString());
- }else{
- String rzlt=" update qcm_judge_coil_result set PIC_IS_LOCK='0',PHYSRESULT = '0', PHYSRESULT_DESC = '待判', inspection_lot = '"+inspectionLot+"' "
- +" where coil_no = '"+list.getString("MATERIAL_NO")+"' ";
- mapper.updateJudgeStatus(rzlt.toString());
-
- rzlt="";
- rzlt=" update C_TBC02_COIL_COMM set SMP_NO = '"+inspectionLot+"' where OLD_SAMPL_NO = '"+list.getString("MATERIAL_NO")+"' ";
- mapper.updateJudgeStatus(rzlt.toString());
- }
-
- }
-
- }
-
- }
-
- }
-
-
-
-
-
-
-
-
-
-
- }
|