| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166 |
- package QCM.JHY01.JHY0102;
- import java.math.BigDecimal;
- import java.sql.CallableStatement;
- import java.sql.Connection;
- 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 CoreFS.SA01.CoreIComponent;
- import CoreFS.SA06.CoreReturnObject;
- import QCM.COMMUNAL.VO.QcmJudgeLog;
- import QCM.COMMUNAL.VO.QcmJudgeOperateLog;
- import QCM.JHY01.VO.JhyQltyModel;
- import QCM.JHY01.VO.JhySampleDItemModel;
- import QCM.JHY01.VO.JhySampleDModel;
- import QCM.JHY01.VO.JhySampleMMdoel;
- import QCM.JHY01.VO.JhySampleOrdMdoel;
- import QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl;
- public class UpdateInfo extends CoreIComponent{
- CoreReturnObject cro = new CoreReturnObject();
- ResultSet rs = null;
- SqlSession SqlSession = QCM.COMMUNAL.SqlSessionBuilder.openSqlSession();
- QCM.COMMUNAL.OrderSqMapper mapper = SqlSession.getMapper(QCM.COMMUNAL.OrderSqMapper.class);
-
- /**
- * 修改热处理号 取样材料号 (作废)
- * @param materialInfo
- * @return
- * @throws Exception
- */
- public CoreReturnObject doAllUpdate(HashMap parmas) throws Exception {
- try {
- String rclState = "000000";
- /*String sqls= "";
- if(parmas.get("PLINE_CODE").equals("ZB1")){
- sqls = " select t.* from KCZ_TURNOFFLIST@xgcx t where t.BILLETID = '"+parmas.get("MATERIAL_NO")+"'"
- + " and t.rcl_state is not null ";
- }
- if(parmas.get("PLINE_CODE").equals("HB1")){
- sqls = " select t.* from KCH_TURNOFFLIST@xgcx t where t.BILLETID = '"+parmas.get("MATERIAL_NO")+"'"
- + " and t.rcl_state is not null ";
- }
- List<HashMap> tarMemo=mapper.query(sqls.toString());
- if (tarMemo!=null && tarMemo.size()>=1){
- if(StringUtils.isNotBlank(tarMemo.get(0).get("RCL_STATE").toString())){
- rclState = (String) tarMemo.get(0).get("RCL_STATE");
- }
- }
-
- if(rclState.equals("000000")){
- rclState=parmas.get("PROCESS_NOS").toString();
- }*/
-
- rclState=parmas.get("PROCESS_NOS").toString();
- String processNo ="";
- String sqlStr ="";
- //判断是否是模拟焊后
- String sqlmn="select * from QCM_JHY_SAMPLE_CONSIGN_D t where t.SMP_NO = '"+parmas.get("SMP_NO")+"' and t.SMP_LOCATION like '%模拟焊后%' and t.smp_type_code = '0' ";
- List<HashMap> map2=mapper.query(sqlmn.toString());
- if(map2!=null && map2.size()>=1){
- sqlStr="select * from QCM_JHY_SAMPLE_CONSIGN_D t where t.smp_no = '"+parmas.get("SMP_NO")+"' and t.smp_type_code='0' and t.freq_code <>'D'";
- }else{
- sqlStr = "select * from QCM_JHY_SAMPLE_CONSIGN_D t"
- + " where t.BATCH_NO = '"+parmas.get("BATCH_NO")+"' "
- + " and t.SPECIMEN_NO = '"+parmas.get("SPECIMEN_NO")+"' "
- + " and t.SMP_NO = '"+parmas.get("SMP_NO")+"' ";
- }
- List<HashMap> map=mapper.query(sqlStr.toString());
- if(map !=null && map.size()>=1){
- String str = parmas.get("USER_NAME")+"修改热处理号为"+rclState;
- for (HashMap<String,String> hashMap : map) {
- sqlStr="";
- sqlStr="update QCM_JHY_SAMPLE_CONSIGN_D t set PROCESS_NOS='"+rclState+"',"
- + " MATERIAL_NO='"+parmas.get("MATERIAL_NO")+"',"
- + " ARTIFICIAL_MEMO=t.ARTIFICIAL_MEMO||',"+str+"'||'原委托热处理号为:'||t.PROCESS_NOS "
- + " where t.BATCH_NO = '"+hashMap.get("BATCH_NO")+"' "
- + " and t.SPECIMEN_NO = '"+hashMap.get("SPECIMEN_NO")+"' "
- + " and t.SMP_NO = '"+hashMap.get("SMP_NO")+"' ";
- mapper.updateJudgeStatus(sqlStr.toString());
-
- String strMemo = "取样编号:"+hashMap.get("SPECIMEN_NO")+str+",原委托热处理号为:"+hashMap.get("PROCESS_NOS")
- +"原子板号:"+hashMap.get("MATERIAL_NO")+"现子板号:"+parmas.get("MATERIAL_NO");
- QcmJudgeOperateLog qjog = new QcmJudgeOperateLog();
- qjog.setOperate_name(parmas.get("USER_NAME").toString());
- qjog.setBatchno(parmas.get("BATCH_NO") == null ?"":parmas.get("BATCH_NO").toString());
- qjog.setOperate_type("修改");
- qjog.setParams(parmas.get("MATERIAL_NO") == null ?"":parmas.get("MATERIAL_NO").toString());
- qjog.setProd_line(parmas.get("PLINE_CODE") == null ?"":parmas.get("PLINE_CODE").toString());
- qjog.setMemo(strMemo);
- mapper.insertQcmJudgeOperateLog(qjog);
- }
- }
- } catch (Exception e) {
- SqlSession.rollback();
- SqlSession.close();
- cro.setV_errCode(-1);
- cro.setV_errMsg("修改失败!");
- return cro;
- }
- SqlSession.commit();
- SqlSession.close();
- cro.setV_errCode(1);
- return cro;
- }
-
- /**
- * 修改取样材料号
- * @param materialInfo
- * @return
- * @throws Exception
- */
- public CoreReturnObject updateMaterialNo(ArrayList<String> smpNo,ArrayList<String> specimenNo,ArrayList<String> batchNo,ArrayList<String> materialNo, ArrayList<String> sendMemo,
- ArrayList<String> inspectionLot,ArrayList<String> plineCode) throws Exception {
-
-
- try {
- for (int i = 0; i < smpNo.size(); i++) {
-
- UpdateInfo uinfo= new UpdateInfo();
- uinfo.doPhyItem(specimenNo.get(i).toString());
-
- StringBuffer sqlucomm = new StringBuffer();
- if(plineCode.get(i).equals("ZB1") || plineCode.get(i).equals("HB1")){
- String mater = materialNo.get(i).toString();
- String boardNo=mater.substring(0,mater.lastIndexOf("."));
-
- sqlucomm.append(" update qcm_jhy_sample_consign_d set MATERIAL_NO = '"+materialNo.get(i)+"' ");
- sqlucomm.append(" , SEND_MEMO = '"+sendMemo.get(i)+"' ,BOARD_NO='"+boardNo+"' ");
- sqlucomm.append(" where SMP_NO = '"+smpNo.get(i)+"' and SPECIMEN_NO = '"+specimenNo.get(i)+"' ");
- sqlucomm.append(" and BATCH_NO = '"+batchNo.get(i)+"' ");
- this.getDao("testDao").ExcuteNonQuery(sqlucomm.toString());
-
- String mstr=" update QCM_JHY_SAMPLE_CONSIGN_M set MATERIAL_NO='"+materialNo.get(i)+"' ,BOARD_NO='"+boardNo+"' "
- + " where SMP_NO = '"+smpNo.get(i)+"' and BATCH_NO = '"+batchNo.get(i)+"' ";
- this.getDao("testDao").ExcuteNonQuery(mstr.toString());
- }else{
- sqlucomm.append(" update qcm_jhy_sample_consign_d set MATERIAL_NO = '"+materialNo.get(i)+"' ");
- sqlucomm.append(" , SEND_MEMO = '"+sendMemo.get(i)+"' ");
- sqlucomm.append(" where SMP_NO = '"+smpNo.get(i)+"' and SPECIMEN_NO = '"+specimenNo.get(i)+"' ");
- sqlucomm.append(" and BATCH_NO = '"+batchNo.get(i)+"' ");
- this.getDao("testDao").ExcuteNonQuery(sqlucomm.toString());
- }
-
-
- if(plineCode.get(i).equals("ZB1") || plineCode.get(i).equals("HB1")){
-
- String sqlAmemo="select * from qcm_jhy_sample_consign_d t where t.specimen_no = '"+specimenNo.get(i)+"' and t.Artificial_Memo like '%原委托热处理号%'";
- List<HashMap> hmAmemo=mapper.query(sqlAmemo.toString());
-
- String sqlAmemo2="select * from qcm_jhy_sample_consign_d t where t.specimen_no = '"+specimenNo.get(i)+"' and t.FREQ_CODE in ('C','H','I')";
- List<HashMap> hmAmemo2=mapper.query(sqlAmemo2.toString());
-
- //中板线 厚板线热处理号
- if((plineCode.get(i).equals("ZB1") || plineCode.get(i).equals("HB1")) && hmAmemo.size()<=0 && hmAmemo2.size()>=1){
- String sqls= "";
- sqls="select r.rcl_state from (select t.RCL_STATE from KCZ_TURNOFFLIST@xgcx t where t.BILLETID = '"+materialNo.get(i)+"' "
- +" and t.rcl_state is not null "
- +" union "
- +" select t.RCL_STATE from KCH_TURNOFFLIST@xgcx t where t.BILLETID = '"+materialNo.get(i)+"' "
- +" and t.rcl_state is not null) r group by r.rcl_state order by r.rcl_state desc ";
-
- List<HashMap> tarMemo=mapper.query(sqls.toString());
- if (tarMemo!=null && tarMemo.size()>=1 && StringUtils.isNotBlank(tarMemo.get(0).get("RCL_STATE").toString())) {
- if(tarMemo.get(0).get("RCL_STATE").toString().contains("G")){
- continue;
- }
- //性能改善限制
- String sqlim =" select t.* from qcm_jhy_sample_consign_d t where t.specimen_no='"+specimenNo.get(i)+"' and IMPROVE_MEMO='性能改善' ";
- List<HashMap> hmim=mapper.query(sqlim.toString());
- if(hmim!=null && hmim.size()>=1){
- if(!tarMemo.get(0).get("RCL_STATE").toString().contains("G")){
- continue;
- }
- }
-
- if(tarMemo.get(0).get("RCL_STATE").toString().contains("G")){
- //19HJGP
- String 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 like '19HJGP%' "
- +" and t.freq_code<>'D' and t.specimen_no='"+specimenNo.get(i)+"' ";
- List<HashMap> hmap=mapper.query(sql.toString());
- if(hmap!=null && hmap.size()>=1){
- sqlucomm.setLength(0);
- sqlucomm.append(" update qcm_jhy_sample_consign_d set ARTIFICIAL_MEMO=ARTIFICIAL_MEMO ||',初委托热处理号'||PROCESS_NOS ,PROCESS_NO = '"+tarMemo.get(0).get("RCL_STATE")+"',PROCESS_NOS= '"+tarMemo.get(0).get("RCL_STATE")+"' ");
- sqlucomm.append(" where SMP_NO = '"+smpNo.get(i)+"' and SPECIMEN_NO = '"+specimenNo.get(i)+"' ");
- sqlucomm.append(" and BATCH_NO = '"+batchNo.get(i)+"' ");
- this.getDao("testDao").ExcuteNonQuery(sqlucomm.toString());
- }
- continue;
- }
- String sql ="select * from qcm_jhy_sample_consign_d where SMP_NO = '"+smpNo.get(i)+"' "
- + " and SPECIMEN_NO = '"+specimenNo.get(i)+"' and FREQ_CODE <> 'D' ";
- List<HashMap> hmap=mapper.query(sql.toString());
- if(hmap!=null && hmap.size()>=1){
- if(StringUtils.isNotBlank(hmap.get(0).get("FREQ_CODE").toString()) && !hmap.get(0).get("FREQ_CODE").equals("D")){
- sqlucomm.setLength(0);
- sqlucomm.append(" update qcm_jhy_sample_consign_d set ARTIFICIAL_MEMO=ARTIFICIAL_MEMO ||',初委托热处理号'||PROCESS_NOS ,PROCESS_NO = '"+tarMemo.get(0).get("RCL_STATE")+"',PROCESS_NOS= '"+tarMemo.get(0).get("RCL_STATE")+"' ");
- sqlucomm.append(" where SMP_NO = '"+smpNo.get(i)+"' and SPECIMEN_NO = '"+specimenNo.get(i)+"' ");
- sqlucomm.append(" and BATCH_NO = '"+batchNo.get(i)+"' ");
- this.getDao("testDao").ExcuteNonQuery(sqlucomm.toString());
- }
- }else{
-
- sql="";
- sql ="select t.* from QCM_JHY_SAMPLE_CONSIGN_D_ITEM t "
- +" where t.specimen_no = '"+specimenNo.get(i)+"' "
- +" and t.seq >= 50 "
- +" and t.phy_code_l <> 'HJ' ";
- hmap = null;
- hmap=mapper.query(sql.toString());
-
- if(hmap!=null && hmap.size()>=1){
- sql="";
- sql ="select * from qcm_jhy_sample_consign_d where SMP_NO = '"+smpNo.get(i)+"' "
- + " and SPECIMEN_NO = '"+specimenNo.get(i)+"' and SMP_TYPE_CODE in ('1','3','4') ";
- }else{
- sql="";
- sql ="select * from qcm_jhy_sample_consign_d where SMP_NO = '"+smpNo.get(i)+"' "
- + " and SPECIMEN_NO = '"+specimenNo.get(i)+"' and SMP_TYPE_CODE in ('3','4') ";
- }
- hmap = null;
- hmap=mapper.query(sql.toString());
- if(hmap!=null && hmap.size()>=1){
- sqlucomm.setLength(0);
- sqlucomm.append(" update qcm_jhy_sample_consign_d set ARTIFICIAL_MEMO=ARTIFICIAL_MEMO ||',初委托热处理号'||PROCESS_NOS,PROCESS_NO = '"+tarMemo.get(0).get("RCL_STATE")+"',PROCESS_NOS= '"+tarMemo.get(0).get("RCL_STATE")+"' ");
- sqlucomm.append(" where SMP_NO = '"+smpNo.get(i)+"' and SPECIMEN_NO = '"+specimenNo.get(i)+"' ");
- sqlucomm.append(" and BATCH_NO = '"+batchNo.get(i)+"' ");
- this.getDao("testDao").ExcuteNonQuery(sqlucomm.toString());
- }
- }
-
- }else{
- sqlucomm.setLength(0);
- sqlucomm.append(" update qcm_jhy_sample_consign_d set PROCESS_NO = '000000' ");
- sqlucomm.append(" where SMP_NO = '"+smpNo.get(i)+"' and SPECIMEN_NO = '"+specimenNo.get(i)+"' ");
- sqlucomm.append(" and BATCH_NO = '"+batchNo.get(i)+"' ");
- this.getDao("testDao").ExcuteNonQuery(sqlucomm.toString());
- }
- }
- }
- //热轧 连退 复制 初样委托 选择物料号时 修改 相应的检验号
- /* if(plineCode.get(i).equals("RZ1") || plineCode.get(i).equals("LT1")){
- String sql = "update QCM_JUDGE_COIL_RESULT set INSPECTION_LOT = '"+inspectionLot.get(i)+"' "
- + " where COIL_NO = '"+materialNo.get(i)+"' ";
- this.getDao("testDao").ExcuteNonQuery(sql.toString());
- }*/
- }
-
- } catch (Exception e) {
-
- }
- SqlSession.close();
- return cro;
- }
-
- /**
- * 复样 修改轧批号
- * @param materialInfo
- * @return
- * @throws Exception
- */
- public CoreReturnObject updateBatchNo(ArrayList<String> smpNo,ArrayList<String> specimenNo,ArrayList<String> batchNo,ArrayList<String> materialNo, ArrayList<String> sendMemo,
- ArrayList<String> inspectionLot,ArrayList<String> plineCode) throws Exception {
- Connection conn = this.getDao("testDao").getConnection();
-
- try {
- String maxVal ="";
- String minVal = "";
- TreeSet<String> treeSet = new TreeSet<String>();
- TreeSet<String> treeSet2 = new TreeSet<String>();
- for (int i = 0; i < batchNo.size(); i++) {
- treeSet.add(batchNo.get(i));
- treeSet2.add(specimenNo.get(i));
- }
-
- if(treeSet2.size() != 1){
- cro.setV_errCode(-1);
- cro.setV_errMsg("请勾选一个轧批修改!不能同时修改两个轧批");
- return cro;
- }
-
- //判断是否是一个轧批号
- if(smpNo.size()>1){
- maxVal = treeSet.last();//最大值
- minVal = treeSet.first() ;//最小值
- }
-
- String sqlsp="select * from qcm_jhy_sample_consign_d t where t.specimen_no = '"+treeSet2.first()+"' and rownum=1 ";
- List<HashMap> sphm=mapper.query(sqlsp.toString());
- if(sphm!=null && sphm.size()>=1){
- if(treeSet.first().equals(sphm.get(0).get("BATCH_NO").toString())){
- cro.setV_errCode(-1);
- cro.setV_errMsg("修改轧批号不能修改为同轧号请核实修改数据!");
- return cro;
- }
- }
-
- for (int i = 0; i < smpNo.size(); i++) {
- String sqlno=" select r.* from qcm_jhy_sample_consign_d t,qcm_jhy_sample_r_ord r "
- +" where t.smp_no = r.smp_no and t.specimen_no = '"+specimenNo.get(i)+"' and rownum = 1 ";
- List<HashMap> listhm=mapper.query(sqlno.toString());
-
- String storage = "{CALL ZHB1_HJ_HEATNO_QUOTE(?,?,?,?,?)}";
- CallableStatement cstm = conn.prepareCall(storage);
- cstm.setString(1,batchNo.get(i));
- cstm.setString(2,smpNo.get(i));
- cstm.setString(3,specimenNo.get(i));
- cstm.setString(4,sendMemo.get(i));
- cstm.registerOutParameter(5,java.sql.Types.VARCHAR);
- cstm.execute();
- if(cstm.getString(5) != null){
- if(!cstm.getString(5).equals("1")){
- SqlSession.close();
- conn.close();
- cro.setV_errCode(-1);
- cro.setV_errMsg(cstm.getString(5).toString());
- return cro;
- }
- }
- cstm.close();
-
- //判断当前订单下是否还有复样
- if(listhm !=null && listhm.size()>=1){
- String DESIGN_KEY = listhm.get(0).get("DESIGN_KEY").toString();
- String INSPECTION_LOT = listhm.get(0).get("INSPECTION_LOT").toString();
- String BATCH_NO = listhm.get(0).get("BATCH_NO").toString();
- String sqlf="select r.* 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 t.smp_type_code = '1' "
- +" and r.design_key = '"+DESIGN_KEY+"' and r.batch_no = '"+BATCH_NO+"' "
- +" and r.inspection_lot = '"+INSPECTION_LOT+"' and rownum = 1 ";
- List<HashMap> list2=mapper.query(sqlf.toString());
- if(list2 != null && list2.size()>=1){
- String sql2="select r.* 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 t.smp_type_code = '0' "
- +" and r.design_key = '"+DESIGN_KEY+"' and r.batch_no = '"+BATCH_NO+"' "
- +" and r.inspection_lot = '"+INSPECTION_LOT+"' and rownum = 1 ";
- List<HashMap> list3=mapper.query(sql2.toString());
- if(list3 != null && list3.size()>=1){
- //有复样,但是初没有清空检验号
- String sql3 =" update QCM_JHY_SAMPLE_R_ORD set inspection_lot = '' "
- +" where SMP_NO = '"+list3.get(0).get("SMP_NO")+"' and batch_no = '"+list3.get(0).get("BATCH_NO")+"' ";
- mapper.updateJudgeStatus(sql3.toString());
- }
-
- }
-
- }
- SqlSession.commit();
- SqlSession.close();
- conn.close();
- cro.setV_errCode(1);
- cro.setV_errMsg("修改轧批号成功!");
- return cro;
- }
-
- /* for (int i = 0; i < smpNo.size(); i++) {
-
- //判断当前试样号是否有两个复样 如果一个试样号下有两个复样说明复样夹杂时 只有一个轧批号满足条件复样
- String smpNoDSql = " select * from qcm_jhy_sample_consign_d t "
- +" where t.smp_no = '"+smpNo.get(i)+"' "
- +" and t.smp_type_code = '1' "
- +" and t.freq_code = 'D' ";
- List<HashMap> smpNoDSqlhm=mapper.query(smpNoDSql.toString());
- if(smpNoDSqlhm !=null && smpNoDSqlhm.size()>=2){
- //当前修改的轧批号是否初样已判定
- String ordSql = "select r.* from qcm_jhy_sample_r_ord r,qcm_jhy_sample_consign_d t "
- +" where r.smp_no = t.smp_no "
- +" and t.SMP_TYPE_CODE = '0' "
- +" and r.batch_no = '"+batchNo.get(i)+"' "
- +" and r.judge_status = '0' ";
- List<HashMap> ordhm=mapper.query(ordSql.toString());
- if(ordhm !=null && ordhm.size()>=1){
-
- String storage = "{CALL ZHB1_HJ_HEATNO_QUOTE(?,?,?,?,?)}";
- CallableStatement cstm = conn.prepareCall(storage);
- cstm.setString(1,batchNo.get(i));
- cstm.setString(2,smpNo.get(i));
- cstm.setString(3,specimenNo.get(i));
- cstm.setString(4,sendMemo.get(i));
- cstm.registerOutParameter(5,java.sql.Types.VARCHAR);
- cstm.execute();
- if(cstm.getString(5) != null){
- if(!cstm.getString(5).equals("1")){
- SqlSession.close();
- conn.close();
- cro.setV_errCode(-1);
- cro.setV_errMsg(cstm.getString(5).toString());
- return cro;
- }
- }
- cstm.close();
- SqlSession.commit();
- SqlSession.close();
- conn.close();
- cro.setV_errCode(1);
- cro.setV_errMsg("修改轧批号成功!");
-
- //初样未判定
- //cro.setV_errCode(-1);
- //cro.setV_errMsg("轧批号【"+batchNo.get(i)+"】初样未判定,请选择其它轧批号");
- return cro;
- }else{
- String batchPline2 = batchNo.get(i).substring(0, 1);
- String batchPlines2 = batchPline2;
- String batchNoplieCode = "";
- if(batchPlines2.equals("Z")){
- batchNoplieCode = "ZB1";
- }else if (batchPlines2.equals("H")){
- batchNoplieCode = "HB1";
- }
- String smp_no = createQltySamNo(batchNoplieCode);//新试样号
- String specimen_no = createSpecimen_no(smp_no);//新取样材料号
- String delSmpNo = smpNo.get(i);//要删除的试样号
-
- String delSpecimenNo ="";
- String sqlitem = "select * from qcm_jhy_sample_consign_d_item t where t.specimen_no='"+specimenNo.get(i)+"' and t.phy_code_l='HJ' and t.seq >=50 ";
- List<HashMap> sqlitemHM=mapper.query(sqlitem.toString());
- if(sqlitemHM==null || sqlitemHM.size()<=0){
- delSpecimenNo = specimenNo.get(i);//要删除的取样编号
- }else{
- sqlitem="";
- sqlitem = " select * from qcm_jhy_sample_consign_d t "
- +" where t.smp_no = '"+smpNo.get(i)+"' "
- +" and t.smp_type_code = '1' "
- +" and t.freq_code = 'D' and t.specimen_no<>'"+specimenNo.get(i)+"' ";
- sqlitemHM.clear();
- sqlitemHM=mapper.query(sqlitem.toString());
- if(sqlitemHM!=null && sqlitemHM.size()>=1){
- delSpecimenNo = sqlitemHM.get(0).get("SPECIMEN_NO").toString();//要删除的取样编号
- }else{
- delSpecimenNo = specimenNo.get(i);//要删除的取样编号
- }
- }
- String sql ="select * from qcm_jhy_sample_consign_d t "
- +" where t.smp_no = '"+delSmpNo+"' "
- +" and t.specimen_no = '"+delSpecimenNo+"' "
- +" and t.freq_code = 'D' "
- +" and t.smp_type_code = '1' ";
- List<HashMap> hmSql=mapper.query(sql.toString());
- if(hmSql!=null && hmSql.size()==1){
- //删除最开始的复样
- sql ="";
- sql =" delete from QCM_JHY_INSP_PHYSICS t where t.SPECIMEN_NO='"+delSpecimenNo+"' ";
- mapper.delete(sql.toString());
-
- sql ="";
- sql =" delete from QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where t.SPECIMEN_NO='"+delSpecimenNo+"' and t.SMP_NO='"+delSmpNo+"' ";
- mapper.delete(sql.toString());
-
- sql ="";
- sql =" delete from QCM_JHY_SAMPLE_CONSIGN_D t where t.SPECIMEN_NO='"+delSpecimenNo+"' and t.SMP_NO='"+delSmpNo+"' ";
- mapper.delete(sql.toString());
-
- //要修改成的轧批号初样的轧批信息
- sql ="";
- sql = "select t.* from qcm_jhy_sample_consign_d t "
- +" where t.SMP_TYPE_CODE = '0' "
- +" and t.batch_no = '"+batchNo.get(i)+"' "
- +" and t.freq_code = 'D' and rownum = 1 ";
- List<HashMap> ydhm=mapper.query(sql.toString());
- if(ydhm!=null && ydhm.size()>=1){
- 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 '"+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,'sys','sys',sysdate,ITEM_FLAG,'复样' "
- +" from QCM_JHY_SAMPLE_CONSIGN_M t where t.SMP_NO = '"+ydhm.get(0).get("SMP_NO")+"'"
- + " and t.batch_no = '"+ydhm.get(0).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,PHY_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,'"+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,PHY_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 = '"+ydhm.get(0).get("SMP_NO")+"' "
- + " and t.batch_no = '"+ydhm.get(0).get("BATCH_NO")+"' and rownum <= 1 ";
- mapper.insert(sql);
-
- //把选中的初样轧批号 检验号置空
- sql ="";
- sql +=" update QCM_JHY_SAMPLE_R_ORD set inspection_lot = '' ";
- sql +=" where SMP_NO = '"+ydhm.get(0).get("SMP_NO")+"' and batch_no = '"+ydhm.get(0).get("BATCH_NO")+"' ";
- mapper.updateJudgeStatus(sql.toString());
-
- //插入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,ARTIFICIAL_MEMO) "
- +" select "
- +" '"+smp_no+"', '"+specimen_no+"', heat_no, batch_no, inspection_lot, freq_code, freq_name, material_no, '1', '复样', consign_no, consign_no_seq, test_qty, smp_qty, smp_location, board_no, '"+ydhm.get(0).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, '"+ydhm.get(0).get("BATCH_NO")+"',PROCESS_NOS,PROCESS_CODE,'复样修改轧批号' "
- +" from qcm_jhy_sample_consign_d t "
- +" where t.SMP_NO = '"+ydhm.get(0).get("SMP_NO")+"' and t.heat_no = '"+ydhm.get(0).get("HEAT_NO")+"' and t.batch_no = '"+ydhm.get(0).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, '"+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, '复样','复样' , SYSDATE, stdmemo, resmp_seq, phy_group_code "
- +" from qcm_jhy_sample_consign_d_item t where t.specimen_no = '"+ydhm.get(0).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 = '"+ydhm.get(0).get("SMP_NO")+"' ) "
- + " order by t.SPECIMEN_NO asc, t.phy_code_l asc,t.phy_code_s asc ";
- 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+"','"+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,'"+(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);
- }
-
- }else{
- cro.setV_errCode(-1);
- cro.setV_errMsg("轧批号【"+batchNo.get(i)+"】未找到初样信息");
- return cro;
- }
-
- }
-
-
- }
- continue;
- }
-
-
-
- //查找复样的原本轧批号
- String dsql = "select t.BATCH_NO,t.HEAT_NO,t.smp_no from QCM_JHY_SAMPLE_CONSIGN_D t where "
- + " t.SPECIMEN_NO = '"+specimenNo.get(i)+"' and t.SMP_TYPE_CODE= '1' ";
- List<HashMap> SampleD=mapper.query(dsql.toString());
-
- if (SampleD == null || SampleD.size()<0) {
- cro.setV_errCode(-1);
- cro.setV_errMsg("没有找到相应的复样轧批号【"+batchNo.get(i)+"】");
- return cro;
- }
- dsql ="";
- dsql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D t where t.smp_no = '"+smpNo.get(i)+"' "
- + " and t.smp_type_code='0' and t.freq_code<>'D' ";
- List<HashMap> SampleD2=mapper.query(dsql.toString());
- if(SampleD2 != null && SampleD2.size()>=1){
- String storage = "{CALL ZHB1_HJ_HEATNO_QUOTE(?,?,?,?,?)}";
- CallableStatement cstm = conn.prepareCall(storage);
- cstm.setString(1,batchNo.get(i));
- cstm.setString(2,smpNo.get(i));
- cstm.setString(3,specimenNo.get(i));
- cstm.setString(4,sendMemo.get(i));
- cstm.registerOutParameter(5,java.sql.Types.VARCHAR);
- cstm.execute();
- if(cstm.getString(5) != null){
- if(!cstm.getString(5).equals("1")){
- SqlSession.close();
- conn.close();
- cro.setV_errCode(-1);
- cro.setV_errMsg(cstm.getString(5).toString());
- return cro;
- }
- }
- cstm.close();
- SqlSession.commit();
- SqlSession.close();
- conn.close();
- cro.setV_errCode(1);
- cro.setV_errMsg("修改轧批号成功!");
- return cro;
- }
- //查询当前轧批ord表
- dsql ="";
- dsql = "select m.INSPECTION_LOT,d.SMP_LOCATION,d.smp_no,d.specimen_no,d.heat_no,d.batch_no,d.freq_code,d.freq_name,d.material_no,d.smp_type_code,d.smp_type_name,"
- + " d.board_no,d.pline_code,d.pline_name,d.process_no,d.process_nos,m.GRADE_CODE,m.GRADE_NAME,r.psc,r.psc_desc,r.delivery_state_code,r.delivery_state_desc,r.thick,r.width,"
- + " r.length,r. msc_pline,r.process_code,r.cert_inst_code,r.cert_inst_name,r.smp_type_code,r.smp_type_name,r.prod_code,r.prod_name,"
- + " r.steel_code,r.steel_name,r.std_code,r.std_name,r.DESIGN_KEY"
- + " from qcm_jhy_sample_consign_d d,qcm_jhy_sample_consign_m m,qcm_jhy_sample_r_ord r "
- +" where d.smp_no = m.smp_no "
- +" and d.smp_no = r.smp_no "
- +" and m.smp_no = r.smp_no "
- +" and r.batch_no = '"+batchNo.get(i)+"' and d.Freq_Code = 'D' and d.smp_type_code='0' and rownum = 1 ";
- List<HashMap> map=mapper.query(dsql.toString());
- if(map == null || map.size()<=0){
- cro.setV_errCode(-1);
- cro.setV_errMsg("没有查找到当前要修改的轧批的信息!!!");
- return cro;
- }
-
- String sql ="";
- sql +=" update QCM_JHY_SAMPLE_CONSIGN_M set BATCH_NO = '"+batchNo.get(i)+"',inspection_lot = '"+batchNo.get(i)+"0001',"
- + " BOARD_NO='"+map.get(0).get("BOARD_NO")+"',PSC='"+map.get(0).get("PSC")+"', PSC_DESC='"+map.get(0).get("PSC_DESC")+"',"
- + " CERT_INST_CODE='"+map.get(0).get("CERT_INST_CODE")+"',CERT_INST_NAME='"+map.get(0).get("CERT_INST_NAME")+"',"
- + " GRADE_CODE='"+map.get(0).get("GRADE_CODE")+"',GRADE_NAME='"+map.get(0).get("GRADE_NAME")+"',"
- + " PLINE_CODE='"+map.get(0).get("PLINE_CODE")+"',PLINE_NAME='"+map.get(0).get("PLINE_NAME")+"',"
- + " MATERIAL_NO='"+map.get(0).get("MATERIAL_NO")+"'";
- sql +=" where SMP_NO = '"+smpNo.get(i)+"' ";
- mapper.updateJudgeStatus(sql.toString());
-
- sql ="";
- sql +=" update QCM_JHY_SAMPLE_R_ORD set BATCH_NO = '"+batchNo.get(i)+"' ,INSPECTION_LOT = '"+batchNo.get(i)+"0001',"
- + "PSC='"+map.get(0).get("PSC")+"', PSC_DESC='"+map.get(0).get("PSC_DESC")+"',"
- + "DELIVERY_STATE_CODE='"+map.get(0).get("DELIVERY_STATE_CODE")+"',DELIVERY_STATE_DESC='"+map.get(0).get("DELIVERY_STATE_DESC")+"', "
- + "THICK='"+map.get(0).get("THICK")+"', WIDTH='"+map.get(0).get("WIDTH")+"', LENGTH='"+map.get(0).get("LENGTH")+"',"
- + "PLINE_CODE='"+map.get(0).get("PLINE_CODE")+"',PLINE_NAME='"+map.get(0).get("PLINE_NAME")+"',"
- + "CERT_INST_CODE='"+map.get(0).get("CERT_INST_CODE")+"',CERT_INST_NAME='"+map.get(0).get("CERT_INST_NAME")+"', "
- + "PROD_CODE='"+map.get(0).get("PROD_CODE")+"',PROD_NAME='"+map.get(0).get("PROD_NAME")+"',"
- + "STEEL_CODE='"+map.get(0).get("STEEL_CODE")+"',STEEL_NAME='"+map.get(0).get("STEEL_NAME")+"',"
- + "STD_CODE='"+map.get(0).get("STD_CODE")+"',STD_NAME='"+map.get(0).get("STD_NAME")+"',"
- + "DESIGN_KEY='"+map.get(0).get("DESIGN_KEY")+"' ";
- sql +=" where SMP_NO = '"+smpNo.get(i)+"' ";
- mapper.updateJudgeStatus(sql.toString());
-
- //把选中的初样轧批号 检验号置空
- sql ="";
- sql +=" update QCM_JHY_SAMPLE_R_ORD set inspection_lot = '' ";
- sql +=" where SMP_NO in (select SMP_NO from QCM_JHY_SAMPLE_CONSIGN_D "
- + " where BATCH_NO = '"+batchNo.get(i)+"' and freq_code = 'D' AND smp_type_code='0' ) ";
- mapper.updateJudgeStatus(sql.toString());
-
-
- //把换下来的初样轧批号 检验号返回原来的检验号
- for (HashMap hm : SampleD) {
- sql ="";
- sql +=" update QCM_JHY_SAMPLE_R_ORD set inspection_lot = '"+hm.get("BATCH_NO")+"0001' ";
- sql +=" where BATCH_NO in (select batch_no from QCM_JHY_SAMPLE_CONSIGN_D "
- + " where BATCH_NO = '"+hm.get("BATCH_NO")+"' and freq_code = 'D' AND smp_type_code='0' ) ";
- mapper.updateJudgeStatus(sql.toString());
- }
-
- String batchPline2 = batchNo.get(i).substring(0, 1);
- String batchPlines2 = batchPline2;
- String batchNoplieCode = "";
- if(batchPlines2.equals("Z")){
- batchNoplieCode = "ZB1";
- }else if (batchPlines2.equals("H")){
- batchNoplieCode = "HB1";
- }
-
- if(batchNoplieCode.equals("HB1")){
- //厚
- sql ="";
- sql = "select BILLETID as MATERIAL_NO from kch_turnofflist@xgcx where BILLETID like '"+batchNo.get(i)+"'||'%' and rownum=1 ";
- }else if(batchNoplieCode.equals("ZB1")){
- //中
- sql ="";
- sql = "select BILLETID as MATERIAL_NO from kcz_turnofflist@xgcx where BILLETID like '"+batchNo.get(i)+"'||'%' and rownum=1 ";
- }
- List<HashMap> listEle= mapper.query(sql.toString());
- String VmaterialNo = "";
- if(listEle!=null && listEle.size()>=1){
- VmaterialNo = listEle.get(0).get("MATERIAL_NO").toString();
- }
-
- //换成修改的轧批号
- sql ="";
- sql +=" update QCM_JHY_SAMPLE_CONSIGN_D set BATCH_NO = '"+batchNo.get(i)+"',inspection_lot = '"+batchNo.get(i)+"0001',MATERIAL_NO='"+VmaterialNo+"',"
- + " FREQ_CODE='"+map.get(0).get("FREQ_CODE")+"',FREQ_NAME='"+map.get(0).get("FREQ_NAME")+"',"
- + " SMP_LOCATION='"+map.get(0).get("SMP_LOCATION")+"',BOARD_NO='"+map.get(0).get("BOARD_NO")+"',"
- + " PLINE_CODE='"+map.get(0).get("PLINE_CODE")+"',PLINE_NAME='"+map.get(0).get("PLINE_NAME")+"',"
- + " process_no='"+map.get(0).get("process_no")+"',PROCESS_NOS='"+map.get(0).get("PROCESS_NOS")+"' ";
- sql +=" where SMP_NO = '"+smpNo.get(i)+"' and SPECIMEN_NO = '"+specimenNo.get(i)+"' ";
- mapper.updateJudgeStatus(sql.toString());
-
- //删除当前复样的初样
- sql ="";
- sql +=" delete from QCM_JHY_INSP_PHYSICS t where t.SPECIMEN_NO='"+specimenNo.get(i)+"' and t.SEQ >= 50 ";
- mapper.delete(sql.toString());
-
- sql ="";
- sql +=" delete from QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where t.SPECIMEN_NO='"+specimenNo.get(i)+"' and t.SEQ >= 50 ";
- mapper.delete(sql.toString());
-
- //复样 引用 当前轧批初样实绩
- //查询当前初样取样编号的所有实绩
- 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 = '"+map.get(0).get("SMP_NO")+"' ) "
- + " order by t.SPECIMEN_NO asc, t.phy_code_l asc,t.phy_code_s asc ";
- 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 = '"+specimenNo.get(i)+"'";
- 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 '"+specimenNo.get(i)+"','"+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 '"+specimenNo.get(i)+"','"+seqint+"','"+smpNo.get(i)+"',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);
- }
-
- }*/
-
-
-
-
- } catch (Exception e) {
- SqlSession.rollback();
- SqlSession.close();
- cro.setV_errCode(-1);
- cro.setV_errMsg("修改轧批号失败!");
- return cro;
- }
-
- SqlSession.commit();
- SqlSession.close();
- conn.close();
- cro.setV_errCode(1);
- cro.setV_errMsg("修改轧批号成功!");
- return cro;
- }
-
- /**
- * 初样 修改取样轧批号按炉
- * @param materialInfo
- * @return
- * @throws Exception
- */
- public CoreReturnObject DoUpRefBatchNo(ArrayList<String> smpNo,ArrayList<String> specimenNo,ArrayList<String> batchNo,ArrayList<String> heatnNo,
- ArrayList<String> materialNo, ArrayList<String> sendMemo,ArrayList<String> inspectionLot,ArrayList<String> plineCode) throws Exception {
-
- try {
- TreeSet<String> treeSet = new TreeSet<String>();
- for (int i = 0; i < batchNo.size(); i++) {
- treeSet.add(batchNo.get(i));
- }
- if(treeSet.size() != 1){
- cro.setV_errCode(-1);
- cro.setV_errMsg("只能按同炉修改取样轧批号,请一个轧批一个轧批修改");
- return cro;
- }
-
- //判断该轧批号有没有生成委托
- String dsql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D t where "
- + " t.BATCH_NO = '"+batchNo.get(0)+"' and t.SMP_TYPE_CODE= '0' and t.freq_code = 'D' and rownum <= 1";
- List<HashMap> SampleD=mapper.query(dsql.toString());
-
- if (SampleD == null || SampleD.size()<0) {
- cro.setV_errCode(-1);
- cro.setV_errMsg("轧批号【'"+batchNo.get(0)+"'】按炉取样还未生成委托!");
- return cro;
- }
-
- for (int i = 0; i < treeSet.size(); i++) {
-
- //查到当前轧批的取样编号
- String selsql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D t where "
- + " t.SMP_NO = '"+smpNo.get(i)+"' and t.SMP_TYPE_CODE= '0' and t.freq_code = 'D' and rownum <= 1 ";
- List<HashMap> selhmbno=mapper.query(selsql.toString());
- if(selhmbno!=null && selhmbno.size()>=1){
- if(selhmbno.get(0).get("BATCH_NO").toString().equals(batchNo.get(i))){
- cro.setV_errCode(-1);
- cro.setV_errMsg("同轧批修改!无效操作!");
- return cro;
- }
- }
-
-
-
- //查到当前轧批的取样编号
- String sNOsql = "select t.SPECIMEN_NO from QCM_JHY_SAMPLE_CONSIGN_D t where "
- + " t.BATCH_NO = '"+batchNo.get(0)+"' and t.SMP_TYPE_CODE= '0' and t.freq_code = 'D' and rownum <= 1 ";
- List<HashMap> fYspecimenNo=mapper.query(sNOsql.toString());
-
- String logmemo = specimenNo.get(i)+','+materialNo.get(i)+"初样夹杂修改成"+batchNo.get(i);
- String sql3= "INSERT INTO QCM_JUDGE_OPERATE_LOG (OPERATE_TYPE,PARAMS,OPERATE_NAME,PROD_LINE,BATCHNO,MEMO) "
- + " VALUES('初样修改夹杂接口','"+materialNo.get(i)+"','createQtlySample','"+plineCode.get(i)+"',"
- + " '"+batchNo.get(i)+"','"+logmemo+"') ";
- mapper.insert(sql3);
-
- //修改引用取样编号 当前
- String sql =" update QCM_JHY_SAMPLE_CONSIGN_D "
- + " set QUOTE_CONSIGN_NO = '' , STATUS = '0', SEND_ID='',SEND_NAME = '',SEND_TIME = '' ";
- sql +=" where SPECIMEN_NO = '"+fYspecimenNo.get(0).get("SPECIMEN_NO")+"' ";
- //this.getDao("testDao").ExcuteNonQuery(sql.toString());
- mapper.updateJudgeStatus(sql.toString());
-
- sql = "";
- sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM set QUOTE_SPECIMEN_NO = '' ";
- sql +=" where SPECIMEN_NO = '"+fYspecimenNo.get(0).get("SPECIMEN_NO")+"' ";
- //this.getDao("testDao").ExcuteNonQuery(sql.toString());
- mapper.updateJudgeStatus(sql.toString());
-
- //修改其它引用轧批
- sql = "";
- sql =" update QCM_JHY_SAMPLE_CONSIGN_D "
- + " set QUOTE_CONSIGN_NO = '"+fYspecimenNo.get(0).get("SPECIMEN_NO")+"' , STATUS = '1', SEND_ID='sys',SEND_NAME = '引用发送',SEND_TIME = sysdate ";
- sql +=" where HEAT_NO = '"+heatnNo.get(0)+"' and SPECIMEN_NO <> '"+fYspecimenNo.get(0).get("SPECIMEN_NO")+"' and freq_code = 'D' ";
- //this.getDao("testDao").ExcuteNonQuery(sql.toString());
- mapper.updateJudgeStatus(sql.toString());
-
- //查询当前炉号的引用取样编号
- String sNOsqls = "select t.SPECIMEN_NO from QCM_JHY_SAMPLE_CONSIGN_D t "
- + " where HEAT_NO = '"+heatnNo.get(0)+"' and SPECIMEN_NO <> '"+fYspecimenNo.get(0).get("SPECIMEN_NO")+"' and freq_code = 'D' ";
- List<HashMap> listhm=mapper.query(sNOsqls.toString());
-
- if (listhm != null && listhm.size()>0) {
- for (HashMap hashMap : listhm) {
- sql = "";
- sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM set QUOTE_SPECIMEN_NO = '"+fYspecimenNo.get(0).get("SPECIMEN_NO")+"' ";
- sql +=" where SPECIMEN_NO = '"+hashMap.get("SPECIMEN_NO")+"' ";
- //this.getDao("testDao").ExcuteNonQuery(sql.toString());
- mapper.updateJudgeStatus(sql.toString());
- }
-
- }
-
-
- }
- } catch (Exception e) {
- SqlSession.rollback();
- SqlSession.close();
- cro.setV_errCode(-1);
- cro.setV_errMsg("修改轧批号失败!");
- return cro;
- }
- SqlSession.commit();
- SqlSession.close();
- cro.setV_errCode(1);
- cro.setV_errMsg("修改轧批号成功!");
- return cro;
- }
- /**
- * 删除检验项 检验委托明细项目表
- * @param materialInfo
- * @return
- * @throws Exception
- */
- public CoreReturnObject deleteInfo(String seq,String specimenNo) throws Exception {
-
-
- try {
- StringBuffer sqlucomm = new StringBuffer();
- sqlucomm.append(" delete from qcm_jhy_sample_consign_d_item ");
- sqlucomm.append(" where SPECIMEN_NO = '"+specimenNo+"' and SEQ = '"+seq+"' ");
- this.getDao("testDao").ExcuteNonQuery(sqlucomm.toString());
-
- } catch (Exception e) {
- cro.setV_errCode(-1);
- cro.setV_errMsg("删除失败!");
- return cro;
- }
- cro.setV_errCode(1);
- cro.setV_errMsg("删除成功!");
- return cro;
- }
-
- /**
- * 删除委托
- * @param materialInfo
- * @return
- * @throws Exception
- */
- public CoreReturnObject DoDelete(ArrayList<String> batchNo,ArrayList<String> designKey,ArrayList<String> smpNo,ArrayList<String> specimenNo,ArrayList<String> smpTypeName,String userName) throws Exception {
- try {
- Integer num = 0;
- TreeSet<String> treeSet = new TreeSet<String>();
- for(String batchNoVal : batchNo){
- if(StringUtils.isBlank(batchNoVal)){
- cro.setV_errCode(-1);
- cro.setV_errMsg("轧批号为空!!!");
- return cro;
- }
- treeSet.add(batchNoVal);
- num++;
- }
-
- if(treeSet.size()>1){
- cro.setV_errCode(-1);
- cro.setV_errMsg("只能删除同轧批号的委托!!!");
- return cro;
- }
-
- //件件取样
- /* for(int i=0;i<specimenNo.size();i++){
- String specimen = specimenNo.get(i);
- String jsql="select * from qcm_jhy_sample_consign_d t where t.status = '0' and t.SMP_TYPE_CODE = '3' and t.specimen_no = '"+specimen+"' ";
- List<HashMap> hm=mapper.query(jsql.toString());
- if(hm != null && hm.size()>=1){
- for (HashMap hmap : hm) {
- String spmNo= hmap.get("SMP_NO").toString();
- //删除 检验委托明细项目表
- String sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where t.specimen_no= '"+specimen+"' ";
- mapper.delete(sql.toString());
-
- //删除 检验委托明细表
- sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_D t where t.specimen_no= '"+specimen+"' ";
- mapper.delete(sql.toString());
-
- //删除 检验委托主表
- sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_M t where t.smp_no = '"+spmNo+"' ";
- mapper.delete(sql.toString());
-
- //删除 试样号与合同信息关系表
- sql = "DELETE QCM_JHY_SAMPLE_R_ORD t where t.smp_no = '"+spmNo+"' ";
- mapper.delete(sql.toString());
- }
- }
- }*/
-
- for(int i=0;i<batchNo.size();i++){
- if(smpTypeName.get(i).equals("件件取样")){
- cro.setV_errCode(-1);
- cro.setV_errMsg("件件取样暂时不支持删除!!!");
- return cro;
- }
- /* if(smpTypeName.get(i).equals("件件取样")){
- continue;
- }
- String jsql="select * from qcm_jhy_sample_consign_d t where t.status = '0' and t.SMP_TYPE_CODE = '3' and t.specimen_no = '"+specimenNo.get(i)+"' ";
- List<HashMap> hm=mapper.query(jsql.toString());
- if(hm != null && hm.size()>=1){
- continue;
- }*/
-
- //线棒限制
- String BCGX="select t.* from QCM_JHY_SAMPLE_CONSIGN_D t where "
- + " t.SPECIMEN_NO = '"+specimenNo.get(i)+"' and t.pline_code in ('BC2','GX1','GX2') and rownum = 1 ";
- List<HashMap> bcgxhm=mapper.query(BCGX.toString());
- if (bcgxhm != null && bcgxhm.size()>=1) {
- String BATCH_NO_BCGX = bcgxhm.get(0).get("BATCH_NO").toString();
- String INSPECTION_LOT_BCGX= bcgxhm.get(0).get("INSPECTION_LOT").toString();
-
- String BCGX2=" select * from qcm_jhy_sample_r_ord r "
- + " where r.batch_no = '"+BATCH_NO_BCGX+"' and r.inspection_lot = '"+INSPECTION_LOT_BCGX+"' "
- + " and r.judge_status = '1' and r.inspection_lot is not null ";
- List<HashMap> bcgxhm2=mapper.query(BCGX2.toString());
- if(bcgxhm2 !=null && bcgxhm2.size()>=1){
- cro.setV_errCode(-1);
- cro.setV_errMsg("【"+BATCH_NO_BCGX+"】轧批下的委托有判定请撤销判定再删除!");
- return cro;
- }
- }
-
-
- String dsql="select count(1) cnum from QCM_JHY_SAMPLE_CONSIGN_D t where "
- + " t.QUOTE_CONSIGN_NO = '"+specimenNo.get(i)+"' and FREQ_CODE = 'D' ";
- List<HashMap> Sampley=mapper.query(dsql.toString());
- if (Sampley != null && Sampley.size()>=1) {
- if(!Sampley.get(0).get("CNUM").toString().equals("0")){
- cro.setV_errCode(-1);
- cro.setV_errMsg("该夹杂已被同炉的夹杂引用不能删除!!!");
- return cro;
- }
- }
-
- //英国250吨
- dsql="";
- dsql="select count(1) cnum from QCM_JHY_SAMPLE_CONSIGN_D_ITEM t, qcm_jhy_sample_consign_d d "
- + " where t.specimen_no = d.specimen_no and d.pline_code in ('ZB1','HB1') and t.Quote_Specimen_No = '"+specimenNo.get(i)+"' ";
- List<HashMap> lrastr=mapper.query(dsql.toString());
- if (lrastr != null && lrastr.size()>=1) {
- if(!lrastr.get(0).get("CNUM").toString().equals("0")){
- cro.setV_errCode(-1);
- cro.setV_errMsg("该轧批已被引用英国船级社!!!");
- return cro;
- }
- }
-
-
- TreeSet<String> treeSteelCode = new TreeSet<String>(); //牌号
- TreeSet<String> treeSpecimenNo = new TreeSet<String>(); //取样编号
- int numsno=0;
- //XGEC- 订单开头的一个订单两个牌号
- String sqlLog = "select * from QCM_JHY_SAMPLE_CONSIGN_D t,Qcm_Jhy_Sample_r_Ord r "
- + " where t.SMP_NO=r.SMP_NO and r.DESIGN_KEY = '"+designKey.get(i)+"' and t.batch_no = '"+batchNo.get(i)+"' ";
- List<HashMap> lists = mapper.query(sqlLog);
- if(lists!=null && lists.size()>1){
- for (HashMap hashMap : lists) {
- treeSteelCode.add(hashMap.get("STEEL_CODE").toString());
- treeSpecimenNo.add(hashMap.get("SPECIMEN_NO").toString());
- }
- if(treeSteelCode.size()>=2){//一个订单两个牌号,需要一起删除
- for (String strsno : treeSpecimenNo) {
- for(int j=0;j<specimenNo.size();j++){
- if(strsno.equals(specimenNo.get(j))){
- numsno++;
- }
- }
- }
- if(numsno!=lists.size()){
- cro.setV_errCode(-1);
- cro.setV_errMsg("不能单独删除订单号【"+designKey.get(i)+"】的委托,这个订单有多个牌号的委托删除其中一个牌号会缺少委托项目,不能综判!请谨慎操作!");
- return cro;
- }
- }
- }
- }
-
- //检验委托明细表
- String dsql = "select count(1) cnum from QCM_JHY_SAMPLE_CONSIGN_D t where "
- + " t.batch_no = '"+batchNo.get(0)+"' and t.STATUS = '0' and t.SEND_TIME is null ";
-
- List<HashMap> SampleD=mapper.query(dsql.toString());
- if (SampleD == null || SampleD.size()<=0 || SampleD.get(0).get("CNUM").toString().equals("0")) {
- cro.setV_errCode(-1);
- cro.setV_errMsg("检验委托明细表未找到相应数据!!!");
- return cro;
- }
-
- for(int i=0;i<batchNo.size();i++){
- /*if(smpTypeName.get(i).equals("件件取样")){
- continue;
- }
- String jsql="select * from qcm_jhy_sample_consign_d t where t.status = '0' and t.SMP_TYPE_CODE = '3' and t.specimen_no = '"+specimenNo.get(i)+"' ";
- List<HashMap> hm=mapper.query(jsql.toString());
- if(hm != null && hm.size()>=1){
- continue;
- }*/
-
- String sqlLog = "select nvl(t.PROCESS_NOS,'null') PROCESS_NOS1,t.*,r.* from QCM_JHY_SAMPLE_CONSIGN_D t,Qcm_Jhy_Sample_r_Ord r "
- + " where t.SMP_NO=r.SMP_NO and t.specimen_no = '"+specimenNo.get(i)+"'";
- List<HashMap> lists = mapper.query(sqlLog);
- for (HashMap list : lists) {
- String strMemo = list.get("SPECIMEN_NO").toString()+","+list.get("DESIGN_KEY").toString()+","+list.get("STEEL_CODE").toString()+","
- +list.get("THICK").toString()+","+list.get("INSPECTION_LOT").toString()+","+list.get("SMP_TYPE_NAME").toString()+","
- +list.get("PROCESS_NOS1").toString();
- QcmJudgeOperateLog qjog = new QcmJudgeOperateLog();
- qjog.setOperate_name(userName);
- qjog.setBatchno(list.get("BATCH_NO") == null ?"":list.get("BATCH_NO").toString());
- qjog.setOperate_type("删除检验委托");
- qjog.setParams(list.get("MATERIAL_NO") == null ?"":list.get("MATERIAL_NO").toString());
- qjog.setProd_line(list.get("PLINE_CODE") == null ?"":list.get("PLINE_CODE").toString());
- qjog.setMemo(strMemo);
- mapper.insertQcmJudgeOperateLog(qjog);
- }
- if(smpTypeName.get(i).equals("初样") || smpTypeName.get(i).equals("认证样") || smpTypeName.get(i).equals("按母板取样") ){
- //记录删除的数据
- String sqlDel = " Insert into QCM_JHY_SAMPLE_CONSIGN_D_DEL(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,SPECIMENNOZH,SEND_MEMO,ITEM_FLAG,CREATETIMEDEL,CREATENAMEDEL,ARTIFICIAL_MEMO) "
- + " select 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,ITEM_FLAG,SYSDATE,'"+userName+"S',ARTIFICIAL_MEMO from QCM_JHY_SAMPLE_CONSIGN_D d"
- + " where d.smp_no = '"+smpNo.get(i)+"' and d.specimen_no= '"+specimenNo.get(i)+"' and d.batch_no = '"+batchNo.get(i)+"' ";
- mapper.insert(sqlDel);
-
- dsql ="";
- dsql = "select count(1) cnum from QCM_JHY_SAMPLE_CONSIGN_D t where "
- + " t.smp_no = '"+smpNo.get(i)+"' ";
-
- List<HashMap> smpNot=mapper.query(dsql.toString());
- if(smpNot!=null && smpNot.size()>=1 && !smpNot.get(0).get("CNUM").toString().equals("1")){
- //删除 检验委托明细项目表
- String sql = "DELETE QCM_JHY_INSP_PHYSICS t where t.specimen_no= '"+specimenNo.get(i)+"' ";
- mapper.delete(sql.toString());
-
- //删除 检验委托明细项目表
- sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where t.specimen_no= '"+specimenNo.get(i)+"' ";
- mapper.delete(sql.toString());
-
- //删除 检验委托明细表
- sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_D t where t.smp_no = '"+smpNo.get(i)+"' and t.specimen_no= '"+specimenNo.get(i)+"'"
- + " and t.batch_no = '"+batchNo.get(i)+"' ";
- mapper.delete(sql.toString());
- }else{
-
- //删除 检验委托明细项目表
- String sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where t.specimen_no= '"+specimenNo.get(i)+"' ";
- mapper.delete(sql.toString());
-
- //删除 检验委托明细表
- sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_D t where t.smp_no = '"+smpNo.get(i)+"' and t.specimen_no= '"+specimenNo.get(i)+"'"
- + " and t.batch_no = '"+batchNo.get(i)+"' ";
- mapper.delete(sql.toString());
-
- //删除 检验委托主表
- sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_M t where t.smp_no = '"+smpNo.get(i)+"' "
- + " and t.batch_no = '"+batchNo.get(i)+"' ";
- mapper.delete(sql.toString());
-
- //删除 试样号与合同信息关系表
- sql = "DELETE QCM_JHY_SAMPLE_R_ORD t where t.design_key = '"+designKey.get(i)+"' and t.smp_no = '"+smpNo.get(i)+"' "
- + " and t.batch_no = '"+batchNo.get(i)+"' ";
- mapper.delete(sql.toString());
-
- //删除 检验委托明细项目表
- sql = "DELETE QCM_JHY_INSP_PHYSICS t where t.specimen_no= '"+specimenNo.get(i)+"' ";
- mapper.delete(sql.toString());
- }
- }else if (smpTypeName.get(0).equals("复样")){
-
- //删除 检验委托明细项目表
- String sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where t.specimen_no= '"+specimenNo.get(i)+"' ";
- mapper.delete(sql.toString());
-
- //删除 检验委托明细表
- sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_D t where t.smp_no = '"+smpNo.get(i)+"' and t.specimen_no= '"+specimenNo.get(i)+"'"
- + " and t.batch_no = '"+batchNo.get(i)+"' and t.smp_type_code = '1' ";
- mapper.delete(sql.toString());
-
- //删除 检验委托主表
- sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_M t where t.smp_no = '"+smpNo.get(i)+"' "
- + " and t.batch_no = '"+batchNo.get(i)+"' and t.DUPLICATE_SAMPLE = '复样' ";
- mapper.delete(sql.toString());
-
- //删除 试样号与合同信息关系表
- sql = "DELETE QCM_JHY_SAMPLE_R_ORD t where t.design_key = '"+designKey.get(i)+"' and t.smp_no = '"+smpNo.get(i)+"' "
- + " and t.batch_no = '"+batchNo.get(i)+"' and t.DUPLICATE_SAMPLE = '复样' ";
- mapper.delete(sql.toString());
-
- //如果要删除复样委托时 也要删除实绩表qcm_jhy_insp_physics
- //删除 检验委托明细项目表
- sql = "DELETE QCM_JHY_INSP_PHYSICS t where t.specimen_no= '"+specimenNo.get(i)+"' ";
- mapper.delete(sql.toString());
- }
-
- }
-
- //删除复样时 初样检验号返回
- if (smpTypeName.get(0).equals("复样")){
- for (String batchNo2 : treeSet) {
- //把初样的检验号 修改到ord表中
- String sql =" select t.smp_no,t.inspection_lot from QCM_JHY_SAMPLE_CONSIGN_D t "
- +" where t.smp_type_code = '0' and t.batch_no = '"+batchNo2+"' ";
- List<HashMap> hmap = mapper.query(sql.toString());
-
- for (HashMap hm : hmap) {
- sql =" update QCM_JHY_SAMPLE_R_ORD t set t.inspection_lot = '"+(String)hm.get("INSPECTION_LOT")+"' "
- + " where t.smp_no = '"+(String)hm.get("SMP_NO")+"' and t.batch_no = '"+batchNo2+"' ";
- mapper.updateJudgeStatus(sql.toString());
- }
- }
- }
-
-
- } catch (Exception e) {
- SqlSession.rollback();
- SqlSession.close();
- cro.setV_errCode(-1);
- cro.setV_errMsg("删除委托失败!");
- return cro;
- }
- SqlSession.commit();
- SqlSession.close();
- cro.setV_errCode(1);
- cro.setV_errMsg("删除委托成功!");
- return cro;
- }
-
- /**
- * 取消复样接口
- * @param materialInfo
- * @return
- * @throws Exception
- */
- public CoreReturnObject DoDeleteFY(String batchNo,String designKey,String smpNo,String userName,String steelCode,String thick) throws Exception {
- try {
- Integer num = 0;
- String PLINE_CODE="";
- TreeSet<String> treeSet = new TreeSet<String>();
- if(StringUtils.isBlank(batchNo)){
- cro.setV_errCode(-1);
- cro.setV_errMsg("轧批号为空!!!");
- return cro;
- }
- if(StringUtils.isBlank(designKey)){
- cro.setV_errCode(-1);
- cro.setV_errMsg("订单号为空!!!");
- return cro;
- }
- if(StringUtils.isBlank(smpNo)){
- cro.setV_errCode(-1);
- cro.setV_errMsg("试样号为空!!!");
- return cro;
- }
- if(StringUtils.isBlank(steelCode)){
- cro.setV_errCode(-1);
- cro.setV_errMsg("牌号为空!!!");
- return cro;
- }
- if(StringUtils.isBlank(thick)){
- cro.setV_errCode(-1);
- cro.setV_errMsg("规格为空!!!");
- return cro;
- }
-
-
- String dinsql = "select nvl(t.PROCESS_NOS,'null') PROCESS_NOS1,t.* 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 '"+batchNo+"%' and t.SMP_TYPE_CODE= '0' and t.SMP_NO = '"+smpNo+"' "
- + " and r.steel_code = '"+steelCode+"' and to_char(r.thick, 'fm990.099') = to_char('"+thick+"', 'fm990.099') ";
- List<HashMap> Samplein=mapper.query(dinsql.toString());
- if(Samplein == null || Samplein.size()<=0){
- cro.setV_errCode(1);
- cro.setV_errMsg("未找到该试样号的初样信息:"+smpNo);
- return cro;
- }
- PLINE_CODE=Samplein.get(0).get("PLINE_CODE").toString();//产线
- String strMemo = "试样号:"+smpNo+','+designKey+','+steelCode+','+thick;
- if(Samplein.get(0).get("PLINE_CODE").toString().equals("HB1") || Samplein.get(0).get("PLINE_CODE").toString().equals("ZB1")){
- strMemo+=",热处理号:"+Samplein.get(0).get("PROCESS_NOS1").toString();
- }
- QcmJudgeOperateLog qjog = new QcmJudgeOperateLog();
- qjog.setOperate_name(userName);
- qjog.setBatchno(batchNo);
- qjog.setOperate_type("取消复样委托");
- qjog.setParams(Samplein.get(0).get("MATERIAL_NO").toString());
- qjog.setProd_line(Samplein.get(0).get("PLINE_CODE").toString());
- qjog.setMemo(strMemo);
- mapper.insertQcmJudgeOperateLog(qjog);
-
- //检验委托明细表
- String dsql = "select t.* 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 '"+batchNo+"%' and t.SMP_TYPE_CODE= '1' and r.DESIGN_KEY='"+designKey+"' "
- + " and r.steel_code = '"+steelCode+"' and to_char(r.thick, 'fm990.099') = to_char('"+thick+"', 'fm990.099') "
- + " and t.FREQ_CODE = '"+Samplein.get(0).get("FREQ_CODE")+"' and r.INSPECTION_LOT = '"+Samplein.get(0).get("INSPECTION_LOT")+"' ";
-
- List<HashMap> SampleD=mapper.query(dsql.toString());
- if (SampleD == null || SampleD.size()<=0) {
- dsql = "select t.* 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 '"+batchNo+"%' and t.SMP_TYPE_CODE= '1' "
- + " and r.steel_code = '"+steelCode+"' and to_char(r.thick, 'fm990.099') = to_char('"+thick+"', 'fm990.099')"
- + " and t.FREQ_CODE = '"+Samplein.get(0).get("FREQ_CODE")+"' and r.INSPECTION_LOT = '"+Samplein.get(0).get("INSPECTION_LOT")+"'";
- SampleD=null;
- SampleD=mapper.query(dsql.toString());
- if (SampleD == null || SampleD.size()<=0) {
- SqlSession.commit();
- SqlSession.close();
- cro.setV_errCode(1);
- cro.setV_errMsg("取消复样委托成功!");
- return cro;
- }
- }
-
- for (HashMap hm : SampleD) {
- if(!hm.get("STATUS").equals("0")){
- SqlSession.rollback();
- SqlSession.close();
- cro.setV_errCode(-1);
- cro.setV_errMsg("轧批号【'"+batchNo+"'】已发送委托不可撤销!");
- return cro;
- }
- }
- for (HashMap hmap : SampleD) {
-
- //删除 检验委托明细项目表
- String sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where t.specimen_no= '"+hmap.get("SPECIMEN_NO")+"' ";
- mapper.delete(sql.toString());
-
- //删除 检验委托明细表
- sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_D t where t.smp_no = '"+hmap.get("SMP_NO")+"' and t.specimen_no= '"+hmap.get("SPECIMEN_NO")+"'"
- + " and t.batch_no like '"+batchNo+"%' and t.smp_type_code = '1' ";
- mapper.delete(sql.toString());
-
- //删除 检验委托主表
- /* sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_M t where t.smp_no = '"+hmap.get("SMP_NO")+"' "
- + " and t.batch_no like '"+batchNo+"%' and t.DUPLICATE_SAMPLE = '复样' ";
- mapper.delete(sql.toString());*/
-
- //删除 试样号与合同信息关系表
- /* sql = "DELETE QCM_JHY_SAMPLE_R_ORD t where t.smp_no = '"+hmap.get("SMP_NO")+"' "
- + " and t.batch_no like '"+batchNo+"%' and t.DUPLICATE_SAMPLE = '复样' ";
- mapper.delete(sql.toString());*/
-
- //如果要删除复样委托时 也要删除实绩表qcm_jhy_insp_physics
- //删除 检验委托明细项目表
- sql = "DELETE QCM_JHY_INSP_PHYSICS t where t.specimen_no= '"+hmap.get("SPECIMEN_NO")+"' ";
- mapper.delete(sql.toString());
-
- }
-
- for (HashMap hmap : SampleD) {
- //删除 检验委托主表
- String sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_M t where t.smp_no = '"+hmap.get("SMP_NO")+"' "
- + " and t.batch_no like '"+batchNo+"%' and t.DUPLICATE_SAMPLE = '复样' ";
- mapper.delete(sql.toString());
-
- //删除 试样号与合同信息关系表
- sql = "DELETE QCM_JHY_SAMPLE_R_ORD t where t.smp_no = '"+hmap.get("SMP_NO")+"' "
- + " and t.batch_no like '"+batchNo+"%' and t.DUPLICATE_SAMPLE = '复样' ";
- mapper.delete(sql.toString());
- }
-
- String strSmpNo = " and r.SMP_NO = '"+smpNo+"' ";
- if(PLINE_CODE.equals("GX1") || PLINE_CODE.equals("GX2") || PLINE_CODE.equals("BC2")){
- strSmpNo="";
- }
- //删除复样时 初样检验号返回
- //把初样的检验号 修改到ord表中
- String sql =" select t.smp_no,t.inspection_lot from QCM_JHY_SAMPLE_CONSIGN_D t,qcm_jhy_sample_r_ord r where t.smp_no = r.smp_no "
- +" and t.smp_type_code = '0' and t.batch_no like '"+batchNo+"%' and r.DESIGN_KEY='"+designKey+"' "
- +" and r.steel_code = '"+steelCode+"' and to_char(r.thick, 'fm990.099') = to_char('"+thick+"', 'fm990.099')"
- + strSmpNo;
- List<HashMap> hmap = mapper.query(sql.toString());
- if(hmap==null || hmap.size()<=0){
- sql =" select t.smp_no,t.inspection_lot from QCM_JHY_SAMPLE_CONSIGN_D t,qcm_jhy_sample_r_ord r where t.smp_no = r.smp_no "
- +" and t.smp_type_code = '0' and t.batch_no like '"+batchNo+"%' " + strSmpNo
- +" and r.steel_code = '"+steelCode+"' and to_char(r.thick, 'fm990.099') = to_char('"+thick+"', 'fm990.099')";
- hmap=null;
- hmap = mapper.query(sql.toString());
- }
- for (HashMap hm : hmap) {
- sql =" update QCM_JHY_SAMPLE_R_ORD t set t.inspection_lot = '"+(String)hm.get("INSPECTION_LOT")+"' "
- + " where t.smp_no = '"+(String)hm.get("SMP_NO")+"' and t.batch_no like '"+batchNo+"%' ";
- mapper.updateJudgeStatus(sql.toString());
- }
-
-
-
- } catch (Exception e) {
- SqlSession.rollback();
- SqlSession.close();
- cro.setV_errCode(-1);
- cro.setV_errMsg("取消复样委托失败!");
- return cro;
- }
- SqlSession.commit();
- SqlSession.close();
- cro.setV_errCode(1);
- cro.setV_errMsg("取消复样委托成功!");
- return cro;
- }
-
- /**
- * 取消件件取样接口
- * @param materialInfo
- * @return
- * @throws Exception
- */
- public CoreReturnObject DoDeleteJ(String materialNo,String designKey,String smpNo,String userName,String steelCode,String thick) throws Exception {
- try {
- if(StringUtils.isBlank(materialNo)){
- cro.setV_errCode(-1);
- cro.setV_errMsg("子板号为空!!!");
- return cro;
- }
- if(StringUtils.isBlank(designKey)){
- cro.setV_errCode(-1);
- cro.setV_errMsg("订单号为空!!!");
- return cro;
- }
- if(StringUtils.isBlank(smpNo)){//为原不合格的试样号
- cro.setV_errCode(-1);
- cro.setV_errMsg("试样号为空!!!");
- return cro;
- }
- if(StringUtils.isBlank(steelCode)){
- cro.setV_errCode(-1);
- cro.setV_errMsg("牌号为空!!!");
- return cro;
- }
- if(StringUtils.isBlank(thick)){
- cro.setV_errCode(-1);
- cro.setV_errMsg("规格为空!!!");
- return cro;
- }
-
-
- String dinsql = "select nvl(t.PROCESS_NOS, 'null') PROCESS_NOS,t.* from QCM_JHY_SAMPLE_CONSIGN_D t,qcm_jhy_sample_r_ord r where t.smp_no = r.smp_no "
- + " and t.MATERIAL_NO = '"+materialNo+"' and t.SMP_TYPE_CODE= '3' and r.DESIGN_KEY = '"+designKey+"' "
- + " and r.steel_code = '"+steelCode+"' and to_char(r.thick, 'fm990.099') = to_char('"+thick+"', 'fm990.099') and rownum=1 ";
- List<HashMap> Samplein=mapper.query(dinsql.toString());
- if(Samplein == null || Samplein.size()<=0){
- cro.setV_errCode(1);
- cro.setV_errMsg("未找到该子板号件件取样信息:"+materialNo);
- return cro;
- }
- if(!Samplein.get(0).get("STATUS").equals("0")){
- cro.setV_errCode(-1);
- cro.setV_errMsg("子板号【'"+materialNo+"'】件件取样已发送委托不可取消!请先把委托撤销回来");
- return cro;
- }
- String strMemo = "原试样号:"+smpNo+','+designKey+','+steelCode+','+thick;
- if(Samplein.get(0).get("PLINE_CODE").toString().equals("HB1") || Samplein.get(0).get("PLINE_CODE").toString().equals("ZB1")){
- strMemo+=",热处理号:"+Samplein.get(0).get("PROCESS_NOS").toString();
- }
- QcmJudgeOperateLog qjog = new QcmJudgeOperateLog();
- qjog.setOperate_name(userName);
- qjog.setBatchno(Samplein.get(0).get("BATCH_NO").toString());
- qjog.setOperate_type("取消件件取样委托");
- qjog.setParams(Samplein.get(0).get("MATERIAL_NO").toString());
- qjog.setProd_line(Samplein.get(0).get("PLINE_CODE").toString());
- qjog.setMemo(strMemo);
- mapper.insertQcmJudgeOperateLog(qjog);
-
- for (HashMap hmap : Samplein) {
- String spmNo= hmap.get("SMP_NO").toString();
- String specimenNO= hmap.get("SPECIMEN_NO").toString();
- //删除 检验委托明细项目表
- String sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where t.specimen_no= '"+specimenNO+"' ";
- mapper.delete(sql.toString());
-
- //删除 检验委托明细表
- sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_D t where t.specimen_no= '"+specimenNO+"' ";
- mapper.delete(sql.toString());
-
- //删除 检验委托主表
- sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_M t where t.smp_no = '"+spmNo+"' ";
- mapper.delete(sql.toString());
-
- //删除 试样号与合同信息关系表
- sql = "DELETE QCM_JHY_SAMPLE_R_ORD t where t.smp_no = '"+spmNo+"' ";
- mapper.delete(sql.toString());
-
- sql = "DELETE QCM_JHY_INSP_PHYSICS t where t.specimen_no= '"+specimenNO+"' ";
- mapper.delete(sql.toString());
- }
-
- } catch (Exception e) {
- SqlSession.rollback();
- SqlSession.close();
- cro.setV_errCode(-1);
- cro.setV_errMsg("取消件件取样委托失败!");
- return cro;
- }
- SqlSession.commit();
- SqlSession.close();
- cro.setV_errCode(1);
- cro.setV_errMsg("取消件件取样委托成功!");
- return cro;
- }
-
- /**
- * 初样 撤销复制当前委托一条
- * @param materialInfo
- * @return
- * @throws Exception
- */
- public CoreReturnObject DoDelWtZy(String batchNo,String designKey,String smpNo,String specimenNo,String userName) throws Exception {
- try {
- if(StringUtils.isBlank(batchNo)){
- cro.setV_errCode(-1);
- cro.setV_errMsg("轧批号为空!!!");
- return cro;
- }
- if(StringUtils.isBlank(smpNo)){
- cro.setV_errCode(-1);
- cro.setV_errMsg("试样号为空!!!");
- return cro;
- }
- if(StringUtils.isBlank(specimenNo)){
- cro.setV_errCode(-1);
- cro.setV_errMsg("取样编号为空!!!");
- return cro;
- }
- if(StringUtils.isBlank(designKey)){
- cro.setV_errCode(-1);
- cro.setV_errMsg("订单号为空!!!");
- return cro;
- }
-
- //删除 检验委托明细项目表
- String sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where t.specimen_no= '"+specimenNo+"' and t.item_flag = '1' ";
- mapper.delete(sql.toString());
-
- //删除 检验委托明细表
- sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_D t where t.smp_no = '"+smpNo+"' and t.specimen_no= '"+specimenNo+"'"
- + " and t.batch_no = '"+batchNo+"' and t.item_flag = '1' ";
- mapper.delete(sql.toString());
-
- //删除 试样号与合同信息关系表
- sql = "DELETE QCM_JHY_SAMPLE_R_ORD t where t.design_key = '"+designKey+"' and t.smp_no = '"+smpNo+"' "
- + " and t.batch_no = '"+batchNo+"' and t.item_flag = '1' ";
- mapper.delete(sql.toString());
- //删除 检验委托主表
- sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_M t where t.smp_no = '"+smpNo+"' "
- + " and t.batch_no = '"+batchNo+"' and t.item_flag = '1' ";
- mapper.delete(sql.toString());
-
- String sqlLog = "select * from QCM_JHY_SAMPLE_CONSIGN_D t where t.specimen_no like '"+specimenNo+"'";
- List<HashMap> lists = mapper.query(sqlLog);
- for (HashMap list : lists) {
- QcmJudgeOperateLog qjog = new QcmJudgeOperateLog();
- qjog.setOperate_name(userName);
- qjog.setBatchno(list.get("BATCH_NO") == null ?"":list.get("BATCH_NO").toString());
- qjog.setOperate_type("撤销初样检验委托[复制]");
- qjog.setParams(list.get("MATERIAL_NO") == null ?"":list.get("MATERIAL_NO").toString());
- qjog.setProd_line(list.get("PLINE_CODE") == null ?"":list.get("PLINE_CODE").toString());
- mapper.insertQcmJudgeOperateLog(qjog);
- }
-
- } catch (Exception e) {
- SqlSession.rollback();
- SqlSession.close();
- cro.setV_errCode(-1);
- cro.setV_errMsg("撤销失败![复制委托]");
- return cro;
- }
- SqlSession.commit();
- SqlSession.close();
- cro.setV_errCode(1);
- cro.setV_errMsg("撤销复制委托成功!");
- return cro;
- }
-
-
- /**
- * 复样 撤销复制当前委托一条
- * @param materialInfo
- * @return
- * @throws Exception
- */
- public CoreReturnObject DoDelWtFy(String batchNo,String designKey,String smpNo,String specimenNo,String userName) throws Exception {
- try {
- if(StringUtils.isBlank(batchNo)){
- cro.setV_errCode(-1);
- cro.setV_errMsg("轧批号为空!!!");
- return cro;
- }
- if(StringUtils.isBlank(smpNo)){
- cro.setV_errCode(-1);
- cro.setV_errMsg("试样号为空!!!");
- return cro;
- }
- if(StringUtils.isBlank(specimenNo)){
- cro.setV_errCode(-1);
- cro.setV_errMsg("取样编号为空!!!");
- return cro;
- }
- if(StringUtils.isBlank(designKey)){
- cro.setV_errCode(-1);
- cro.setV_errMsg("订单号为空!!!");
- return cro;
- }
-
- //删除 检验委托明细项目表
- String sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where t.specimen_no= '"+specimenNo+"' and t.item_flag = '1' ";
- mapper.delete(sql.toString());
-
- //删除 检验委托明细表
- sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_D t where t.smp_no = '"+smpNo+"' and t.specimen_no= '"+specimenNo+"'"
- + " and t.batch_no = '"+batchNo+"' and t.item_flag = '1' ";
- mapper.delete(sql.toString());
-
- String sqlLog = "select * from QCM_JHY_SAMPLE_CONSIGN_D t where t.specimen_no like '"+specimenNo+"'";
- List<HashMap> lists = mapper.query(sqlLog);
- for (HashMap list : lists) {
- QcmJudgeOperateLog qjog = new QcmJudgeOperateLog();
- qjog.setOperate_name(userName);
- qjog.setBatchno(list.get("BATCH_NO") == null ?"":list.get("BATCH_NO").toString());
- qjog.setOperate_type("撤销复样检验委托[复制]");
- qjog.setParams(list.get("MATERIAL_NO") == null ?"":list.get("MATERIAL_NO").toString());
- qjog.setProd_line(list.get("PLINE_CODE") == null ?"":list.get("PLINE_CODE").toString());
- mapper.insertQcmJudgeOperateLog(qjog);
- }
- } catch (Exception e) {
- SqlSession.rollback();
- SqlSession.close();
- cro.setV_errCode(-1);
- cro.setV_errMsg("撤销复样委托失败![复制]");
- return cro;
- }
- SqlSession.commit();
- SqlSession.close();
- cro.setV_errCode(1);
- cro.setV_errMsg("撤销复样委托成功![复制]");
- return cro;
- }
-
-
- /**
- * 初样 新增当前复制委托一条
- * @param materialInfo
- * @return
- * @throws Exception
- */
- public CoreReturnObject DoAddWtZy(String batchNo,String designKey,String smpNo,String specimenNo,String userName) throws Exception {
- try {
- String plineCode = "";
- String inspectionLot = "";//检验号
- String smp_no = "";//试样号
- String specimen_no = "";//取样编号
- String material_no = "";//取样材料号
- if(StringUtils.isBlank(batchNo)){
- cro.setV_errCode(-1);
- cro.setV_errMsg("轧批号为空!!!");
- return cro;
- }
- if(StringUtils.isBlank(smpNo)){
- cro.setV_errCode(-1);
- cro.setV_errMsg("试样号为空!!!");
- return cro;
- }
- if(StringUtils.isBlank(specimenNo)){
- cro.setV_errCode(-1);
- cro.setV_errMsg("取样编号为空!!!");
- return cro;
- }
- if(StringUtils.isBlank(designKey)){
- cro.setV_errCode(-1);
- cro.setV_errMsg("订单号为空!!!");
- return cro;
- }
-
- //检验委托主表
- String sql = "select * from QCM_JHY_SAMPLE_CONSIGN_M t where "
- + " t.smp_no = '"+smpNo+"' and t.batch_no = '"+batchNo+"' ";
-
- List<HashMap> SampleM=mapper.query(sql.toString());
- if (SampleM == null || SampleM.size()<0) {
- cro.setV_errCode(-1);
- cro.setV_errMsg("检验委托主表未找到相应数据!!!");
- return cro;
- }
-
- //D表 用来做中厚板子板复制
- sql = "";
- sql = "select t.freq_code from QCM_JHY_SAMPLE_CONSIGN_D t where "
- + " t.smp_no = '"+smpNo+"' and t.batch_no = '"+batchNo+"' "
- + " and t.specimen_no = '"+specimenNo+"' ";
- List<HashMap> SampleM2=mapper.query(sql.toString());
-
- HashMap SampleMs = SampleM.get(0);
-
- //产线 热轧 连退 产线 需要修改检验号
- plineCode = (String) SampleMs.get("PLINE_CODE");
- if(plineCode.equals("RZ1") || plineCode.equals("LT1")){
- sql = "select max(to_number(substr(t.inspection_lot,-3))) maxlot from QCM_JHY_SAMPLE_CONSIGN_M t where "
- + " t.batch_no = '"+batchNo+"' ";
- List<HashMap> maxInspectionLot=mapper.query(sql.toString());
- BigDecimal cou = (BigDecimal)maxInspectionLot.get(0).get("MAXLOT");
- String coun2 = cou.toString();
- Integer integ2 = Integer.parseInt(coun2);
- String lotnum = integ2.toString();
- if (lotnum ==null || "".equals(lotnum)) {
- if(plineCode.equals("RZ1")){
- inspectionLot=batchNo+ String.format("%05d", 1);//轧批号+00001
- }else if(plineCode.equals("LT1")){
- inspectionLot=batchNo+ String.format("%03d", 1);//轧批号+001
- }
- }else{
- Integer lonums=Integer.parseInt(lotnum);
- lonums++;
- if(plineCode.equals("RZ1")){
- inspectionLot=batchNo+ String.format("%05d", lonums);//轧批号+00001
- }else if(plineCode.equals("LT1")){
- inspectionLot=batchNo+ String.format("%03d", lonums);//轧批号+001
- }
- }
-
- }else if(plineCode.equals("HB1") || plineCode.equals("ZB1")){
-
- if(SampleM2.get(0).get("FREQ_CODE").equals("C")|| SampleM2.get(0).get("FREQ_CODE").equals("H")){//子板复制
- sql = "";
- sql = "select max(to_number(substr(t.inspection_lot,-3))) MAXLOT from QCM_JHY_SAMPLE_CONSIGN_D t where "
- + " t.batch_no = '"+batchNo+"' ";
- List<HashMap> SampleM3=mapper.query(sql.toString());
- BigDecimal cou = (BigDecimal)SampleM3.get(0).get("MAXLOT");
- String coun2 = cou.toString();
- Integer integ2 = Integer.parseInt(coun2);
- String lotnum = integ2.toString();
- if (lotnum ==null || "".equals(lotnum) || lotnum.equals("0")) {
- inspectionLot=batchNo+ String.format("%04d", 1);//轧批号+0001
- }else{
- Integer lonums=Integer.parseInt(lotnum);
- lonums++;
- inspectionLot=batchNo+ String.format("%04d", lonums);//轧批号+0001
- }
- }
- }
-
- //生成试样信息主表 (检验委托主表)
- smp_no = createQltySamNo((String) SampleMs.get("PLINE_CODE"));
- JhySampleMMdoel model=getSampleM(smp_no,SampleMs,userName);
- if(plineCode.equals("RZ1") || plineCode.equals("LT1")){
- model.setInspection_lot(inspectionLot);//卷板 修改检验号
- }else if((plineCode.equals("HB1") || plineCode.equals("ZB1")) && (SampleM2.get(0).get("FREQ_CODE").equals("C")||SampleM2.get(0).get("FREQ_CODE").equals("H"))){
-
- sql ="";
- if(plineCode.equals("HB1")){
- //厚
- sql+="select min(t.MATERIAL_NO) MATERIAL_NO from (select BILLETID as MATERIAL_NO from kch_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.pline_code = '"+plineCode+"') ";
- }else if(plineCode.equals("ZB1")){
- //中
- sql+="select min(t.MATERIAL_NO) MATERIAL_NO from (select BILLETID as MATERIAL_NO from kcz_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.pline_code = '"+plineCode+"') ";
- }
- List<HashMap> SampleM3=mapper.query(sql.toString());
- material_no = (String)SampleM3.get(0).get("MATERIAL_NO");
- model.setMaterial_no(material_no);//取样材料号
- model.setInspection_lot(inspectionLot);// 修改检验号
-
- }
- mapper.insertSampleM(model);
-
-
- sql = "";
- //试样号与合同信息关系表
- sql = "select * from QCM_JHY_SAMPLE_R_ORD t where "
- + " t.DESIGN_KEY = '"+designKey+"' and t.smp_no = '"+smpNo+"' "
- + " and t.batch_no = '"+batchNo+"' ";
-
- List<HashMap> rord=mapper.query(sql.toString());
- if (rord == null || rord.size()<0) {
- cro.setV_errCode(-1);
- cro.setV_errMsg("生成合同表未找到相应数据!!!");
- return cro;
- }
- HashMap rords = rord.get(0);
- //生成合同表
- JhySampleOrdMdoel ord=getSampleOrd(smp_no,rords,userName);
- if(plineCode.equals("RZ1") || plineCode.equals("LT1")){
- ord.setInspection_lot(inspectionLot);//卷板 修改检验号
- }else if((plineCode.equals("HB1") || plineCode.equals("ZB1")) && (SampleM2.get(0).get("FREQ_CODE").equals("C")|| SampleM2.get(0).get("FREQ_CODE").equals("H"))){
- ord.setInspection_lot(inspectionLot);// 修改检验号
- }
- mapper.insertSampleOrd(ord);
-
-
- sql = "";
- //检验委托明细表
- sql = "select * from QCM_JHY_SAMPLE_CONSIGN_D t where "
- + " t.smp_no = '"+smpNo+"' and t.specimen_no = '"+specimenNo+"' and t.batch_no = '"+batchNo+"' ";
-
- List<HashMap> SampleD=mapper.query(sql.toString());
- if (SampleD == null || SampleD.size()<0) {
- cro.setV_errCode(-1);
- cro.setV_errMsg("检验委托明细表未找到相应数据!!!");
- return cro;
- }
- HashMap SampleDs = SampleD.get(0);
- specimen_no = createSpecimen_no(smp_no);
- JhySampleDModel modelD = getSampleD(smp_no,specimen_no, SampleDs);
- if(plineCode.equals("RZ1") || plineCode.equals("LT1")){
- modelD.setInspection_lot(inspectionLot);//卷板 修改检验号
- }else if((plineCode.equals("HB1") || plineCode.equals("ZB1")) && (SampleM2.get(0).get("FREQ_CODE").equals("C")||SampleM2.get(0).get("FREQ_CODE").equals("H"))){
- modelD.setMaterial_no(material_no);//取样材料号
- modelD.setInspection_lot(inspectionLot);// 修改检验号
- String sqlzj = "";
- sqlzj += " update zj_result_all@xgcx t set t.billetid_jy = '"+inspectionLot+"' ";
- sqlzj += " where t.billetid = '"+material_no+"' ";
- mapper.updateJudgeStatus(sqlzj.toString());
- }
- mapper.insertSampleD(modelD);
-
-
- sql = "";
- //检验委托明细项目表
- sql = "select * from QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where "
- + " t.smp_no = '"+smpNo+"' and t.specimen_no = '"+specimenNo+"' ";
-
- List<HashMap> SampleDitem=mapper.query(sql.toString());
- if (SampleDitem == null || SampleDitem.size()<0) {
- cro.setV_errCode(-1);
- cro.setV_errMsg("检验委托明细项目表未找到相应数据!!!");
- return cro;
- }
- for(HashMap map : SampleDitem){
- //生成材质项目表
- JhySampleDItemModel item=getSampleItem(smp_no,specimen_no,map,userName);
- mapper.insertSampleItem(item);
- }
- String sqlLog = "select * from QCM_JHY_SAMPLE_CONSIGN_D t where t.specimen_no like '"+specimenNo+"'";
- List<HashMap> lists = mapper.query(sqlLog);
- for (HashMap list : lists) {
- QcmJudgeOperateLog qjog = new QcmJudgeOperateLog();
- qjog.setOperate_name(userName);
- qjog.setBatchno(list.get("BATCH_NO") == null ?"":list.get("BATCH_NO").toString());
- qjog.setOperate_type("复制初样检验委托");
- qjog.setParams(list.get("MATERIAL_NO") == null ?"":list.get("MATERIAL_NO").toString());
- qjog.setProd_line(list.get("PLINE_CODE") == null ?"":list.get("PLINE_CODE").toString());
- //qjog.setMemo(zhyy);
- mapper.insertQcmJudgeOperateLog(qjog);
- }
-
- } catch (Exception e) {
- SqlSession.rollback();
- SqlSession.close();
- cro.setV_errCode(-1);
- cro.setV_errMsg("新增初样委托失败!");
- return cro;
- }
- SqlSession.commit();
- SqlSession.close();
- cro.setV_errCode(1);
- cro.setV_errMsg("新增初样委托成功!");
- return cro;
- }
- /**
- * 复样 新增当前复制委托一条
- * @param materialInfo
- * @return
- * @throws Exception
- */
- public CoreReturnObject DoAddWtFy(String batchNo,String designKey,String smpNo,String specimenNo,String userName) throws Exception {
- try {
- String smp_no = "";//试样号
- String specimen_no = "";//取样编号
- if(StringUtils.isBlank(batchNo)){
- cro.setV_errCode(-1);
- cro.setV_errMsg("轧批号为空!!!");
- return cro;
- }
- if(StringUtils.isBlank(smpNo)){
- cro.setV_errCode(-1);
- cro.setV_errMsg("试样号为空!!!");
- return cro;
- }
- if(StringUtils.isBlank(specimenNo)){
- cro.setV_errCode(-1);
- cro.setV_errMsg("取样编号为空!!!");
- return cro;
- }
- if(StringUtils.isBlank(designKey)){
- cro.setV_errCode(-1);
- cro.setV_errMsg("订单号为空!!!");
- return cro;
- }
-
-
- String sql = "";
- //检验委托明细表
- sql = "select * from QCM_JHY_SAMPLE_CONSIGN_D t where "
- + " t.smp_no = '"+smpNo+"' and t.specimen_no = '"+specimenNo+"' and t.batch_no = '"+batchNo+"' ";
-
- List<HashMap> SampleD=mapper.query(sql.toString());
- if (SampleD == null || SampleD.size()<0) {
- cro.setV_errCode(-1);
- cro.setV_errMsg("检验委托明细表未找到相应数据!!!");
- return cro;
- }
- HashMap SampleDs = SampleD.get(0);
- specimen_no = createSpecimen_no((String) SampleDs.get("SMP_NO"));
- JhySampleDModel modelD = getSampleD((String) SampleDs.get("SMP_NO"),specimen_no, SampleDs);
- mapper.insertSampleD(modelD);
-
-
- sql = "";
- //检验委托明细项目表
- sql = "select * from QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where "
- + " t.smp_no = '"+smpNo+"' and t.specimen_no = '"+specimenNo+"' and t.fy_quote_specimen_no is null ";
-
- List<HashMap> SampleDitem=mapper.query(sql.toString());
- if (SampleDitem == null || SampleDitem.size()<0) {
- cro.setV_errCode(-1);
- cro.setV_errMsg("检验委托明细项目表未找到相应数据!!!");
- return cro;
- }
- for(HashMap map : SampleDitem){
- smp_no = (String)map.get("SMP_NO");
- //生成材质项目表
- JhySampleDItemModel item=getSampleItem(smp_no,specimen_no,map,userName);
- mapper.insertSampleItem(item);
- }
- String sqlLog = "select * from QCM_JHY_SAMPLE_CONSIGN_D t where t.specimen_no like '"+specimenNo+"'";
- List<HashMap> lists = mapper.query(sqlLog);
- for (HashMap list : lists) {
- QcmJudgeOperateLog qjog = new QcmJudgeOperateLog();
- qjog.setOperate_name(userName);
- qjog.setBatchno(list.get("BATCH_NO") == null ?"":list.get("BATCH_NO").toString());
- qjog.setOperate_type("复制复样检验委托");
- qjog.setParams(list.get("MATERIAL_NO") == null ?"":list.get("MATERIAL_NO").toString());
- qjog.setProd_line(list.get("PLINE_CODE") == null ?"":list.get("PLINE_CODE").toString());
- //qjog.setMemo(zhyy);
- mapper.insertQcmJudgeOperateLog(qjog);
- }
-
- } catch (Exception e) {
- SqlSession.rollback();
- SqlSession.close();
- cro.setV_errCode(-1);
- cro.setV_errMsg("新增复样委托失败!");
- return cro;
- }
- SqlSession.commit();
- SqlSession.close();
- cro.setV_errCode(1);
- cro.setV_errMsg("新增复样委托成功!");
- return cro;
- }
-
-
-
- /**
- * 创建试样号
- * @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))) 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 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
- * @param qlty
- * @param smp_catg
- * @return
- */
- private JhySampleMMdoel getSampleM(String smp_no, HashMap qlty,String userName) {
- // TODO Auto-generated method stub
- JhySampleMMdoel model=new JhySampleMMdoel();
- model.setSmp_no(smp_no);
- model.setHeat_no((String) qlty.get("HEAT_NO"));
- model.setBatch_no((String) qlty.get("BATCH_NO"));
- model.setInspection_lot((String) qlty.get("INSPECTION_LOT"));
- model.setBoard_no((String) qlty.get("BOARD_NO"));
- model.setMaterial_no((String) qlty.get("MATERIAL_NO"));
- model.setPsc((String) qlty.get("PSC"));
- model.setPsc_desc((String) qlty.get("PSC_DESC"));
- model.setSmp_catg((String) qlty.get("SMP_CATG"));
- model.setCert_inst_code((String) qlty.get("CERT_INST_CODE"));
- model.setCert_inst_name((String) qlty.get("CERT_INST_NAME"));
- //试样类型
- model.setSmp_type_code((String) qlty.get("SMP_TYPE_CODE"));
- model.setSmp_type_name((String) qlty.get("SMP_TYPE_NAME"));
- model.setGrade_code((String) qlty.get("GRADE_CODE"));
- model.setGrade_name((String) qlty.get("GRADE_NAME"));
- model.setPline_code((String) qlty.get("PLINE_CODE"));
- model.setPline_name((String) qlty.get("PLINE_NAME"));
-
- model.setCreate_id((String) qlty.get("CREATE_ID"));
- model.setCreate_name(userName);
- model.setCreate_time(new Date());
- model.setItem_flag("1");//人工
- return model;
- }
-
- /**
- * 设置试样信息明细表对象值
- * @param smp_no
- * @param qlty
- * @return
- */
- private JhySampleOrdMdoel getSampleOrd(String smp_no, HashMap qlty,String userName) {
- // TODO Auto-generated method stub
- JhySampleOrdMdoel ord=new JhySampleOrdMdoel();
- ord.setSmp_no(smp_no);
- ord.setDesign_key((String) qlty.get("DESIGN_KEY"));
- ord.setPsc((String) qlty.get("PSC"));
- ord.setPsc_desc((String) qlty.get("PSC_DESC"));
-
- ord.setHeat_no((String) qlty.get("HEAT_NO"));
- ord.setBatch_no((String) qlty.get("BATCH_NO"));
- ord.setInspection_lot((String) qlty.get("INSPECTION_LOT"));
- ord.setDelivery_state_code((String) qlty.get("DELIVERY_STATE_CODE"));
- ord.setDelivery_state_desc((String) qlty.get("DELIVERY_STATE_DESC"));
- ord.setThick((String) qlty.get("THICK"));
- ord.setWidth((String) qlty.get("WIDTH"));
- ord.setLength((String) qlty.get("LENGTH"));
- ord.setPline_code((String) qlty.get("PLINE_CODE"));
- ord.setPline_name((String) qlty.get("PLINE_NAME"));
- ord.setMsc_pline((String) qlty.get("MSC_PLINE"));
-
- ord.setProcess_code((String) qlty.get("PROCESS_CODE"));
- ord.setCert_inst_code((String) qlty.get("CERT_INST_CODE"));
- ord.setCert_inst_name((String) qlty.get("CERT_INST_NAME"));
- ord.setSmp_type_code((String) qlty.get("SMP_TYPE_CODE"));
- ord.setSmp_type_name((String) qlty.get("SMP_TYPE_NAME"));
-
- ord.setProduct_cnt((BigDecimal) qlty.get("PRODUCT_CNT"));
- ord.setProd_code((String) qlty.get("PROD_CODE"));
- ord.setProd_name((String) qlty.get("PROD_NAME"));
- ord.setSteel_code((String) qlty.get("STEEL_CODE"));
- ord.setSteel_name((String) qlty.get("STEEL_NAME"));
- ord.setStd_code((String) qlty.get("STD_CODE"));
- ord.setStd_name((String) qlty.get("STD_NAME"));
- ord.setCreate_id((String) qlty.get("CREATE_ID"));
- ord.setCreate_name(userName);
- ord.setCreate_time(new Date());
- ord.setItem_flag("1");
- return ord;
- }
-
- /**
- * QCM_JHY_SAMPLE_CONSIGN_D 检验委托明细表 赋值
- *
- * @param smp_no
- * @return
- */
- private JhySampleDModel getSampleD(String smp_no,String specimen_no, HashMap result) {
- // TODO Auto-generated method stub
- JhySampleDModel model = new JhySampleDModel();
- model.setSmp_no(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"));
- model.setFreq_code((String) result.get("FREQ_CODE"));
- model.setFreq_name((String) result.get("FREQ_NAME"));
- model.setMaterial_no((String) result.get("MATERIAL_NO"));// 取样材料号
- // 样品类型
- model.setSmp_type_code((String) result.get("SMP_TYPE_CODE"));
- model.setSmp_type_name((String) result.get("SMP_TYPE_NAME"));
- // 试验次数
- model.setTest_qty((BigDecimal) result.get("TEST_QTY"));
- model.setSmp_qty((BigDecimal) result.get("SMP_QTY"));
- model.setSmp_location((String) result.get("SMP_LOCATION"));
- model.setBoard_no((String) result.get("BOARD_NO"));
- model.setQuote_consign_no((String) result.get("QUOTE_CONSIGN_NO"));
-
- // 初样取样编号
- model.setOld_consign_no((String) result.get("OLD_CONSIGN_NO"));
- model.setPline_code((String) result.get("PLINE_CODE"));
- model.setPline_name((String) result.get("PLINE_NAME"));
- model.setStatus("0");
- model.setValidflag("1");
- model.setSource((String) result.get("SOURCE"));
- model.setGuid(this.getUUID());
- model.setChem_item((String) result.get("CHEM_ITEM"));
- model.setProduct_cnt((BigDecimal) result.get("PRODUCT_CNT"));
- model.setSmp_location_code((String) result.get("SMP_LOCATION_CODE"));
- 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.setItem_flag("1");
- return model;
- }
-
- /**
- * 获取材质项目对象
- * @param smp_no
- * @param specimen_no
- * @param qlty
- * @return
- * @throws Exception
- */
- private JhySampleDItemModel getSampleItem(String smp_no, String specimen_no, HashMap qlty,String userName) throws Exception {
- JhySampleDItemModel model=new JhySampleDItemModel();
- model.setSmp_no(smp_no);
- model.setSpecimen_no(specimen_no);
-
- model.setSeq(createItemSeq(smp_no,specimen_no));
-
-
- model.setPhy_code_l((String)qlty.get("PHY_CODE_L"));;
- model.setPhy_code_m((String)qlty.get("PHY_CODE_M"));
- model.setPhy_code_s((String)qlty.get("PHY_CODE_S"));
- model.setPhy_name_l((String)qlty.get("PHY_NAME_L"));
- model.setPhy_name_m((String)qlty.get("PHY_NAME_M"));
- model.setPhy_name_s((String)qlty.get("PHY_NAME_S"));
- model.setItem_code_d((String)qlty.get("ITEM_CODE_D"));
- model.setItem_code_t((String)qlty.get("ITEM_CODE_T"));
- model.setItem_code_s((String)qlty.get("ITEM_CODE_S"));
- model.setItem_code_l((String)qlty.get("ITEM_CODE_L"));
- model.setItem_name_d((String)qlty.get("ITEM_NAME_D"));
- model.setItem_name_t((String)qlty.get("ITEM_NAME_T"));
- model.setItem_name_s((String)qlty.get("ITEM_NAME_S"));
- model.setItem_desc_l((String)qlty.get("ITEM_DESC_L"));
-
- model.setStdmax((String)qlty.get("STDMAX"));
- model.setStdmax_sign((String)qlty.get("STDMAX_SIGN"));
- model.setStdmin((String)qlty.get("STDMIN"));
- model.setStdmin_sign((String)qlty.get("STDMIN_SIGN"));
-
- //试验次数
- model.setTest_qty((BigDecimal) qlty.get("TEST_QTY"));
- model.setSmp_qty((BigDecimal) qlty.get("SMP_QTY"));
-
- model.setSpecl_fl((String)qlty.get("SPECL_FL"));
- model.setIsjudge((String)qlty.get("ISJUDGE"));
- model.setPhy_unit((String)qlty.get("PHY_UNIT"));
- model.setGroup_seq((String)qlty.get("GROUP_SEQ"));
-
- model.setQuote_specimen_no((String)qlty.get("QUOTE_SPECIMEN_NO"));
- model.setQuote_seq((Integer)qlty.get("QUOTE_SEQ"));
- model.setMemo((String)qlty.get("MEMO"));
- model.setCreate_id((String)qlty.get("CREATE_ID"));
- model.setCreate_name(userName);
- model.setCreate_time(new Date());
-
- model.setStdmemo((String)qlty.get("STDMEMO"));
- model.setPhy_group_code((String)qlty.get("PHY_GROUP_CODE"));
- model.setResmp_seq((String)qlty.get("RESMP_SEQ"));
- model.setItem_flag("1");
- //样品类型
- return model;
- }
-
-
- /**
- * 生成不带 "-" 的UUID
- *
- * @return
- */
- private String getUUID() {
- UUID uuid = UUID.randomUUID();
- String str = uuid.toString();
- String uuidStr = str.replace("-", "");
- return uuidStr;
- }
-
- /**
- * 创建项目seq
- *
- * @param specimen_no
- * @param smp_no
- * @param cn
- * @return
- * @throws Exception
- */
- private Integer createItemSeq(String smp_no, String specimen_no) throws Exception {
- 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;
- }
-
- /**
- * 不同订单 同轧批号 项目一样引用
- * @param materialInfo
- * @return
- * @throws Exception
- */
- public CoreReturnObject DoQuoteBatchNo(HashMap parmas) throws Exception {
-
- try {
- String strSql=" and r.CERT_INST_CODE !='IC005' ";//美国船级社不能被引用
- //判断是否是模拟焊后 模拟焊后不可引用 231201上午开会决定的
- String mlhSql="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 not like '19%' "
- + " and t.smp_no = '"+parmas.get("SMP_NO")+"' and t.SMP_LOCATION like '%模拟焊后%' and rownum <= 1 ";
- HashMap resultMlh = mapper.queryOne(mlhSql.toString());
- if(resultMlh != null && resultMlh.size()>=1){
- String msgmemo="订单号:"+parmas.get("DESIGN_KEY")+"下的轧批号:"+parmas.get("BATCH_NO")+"委托需全部下发实绩样委托!请核实数据";
- SqlSession.close();
- cro.setV_errCode(-1);
- cro.setV_errMsg("引用失败!当前轧批订单号下有模拟焊后标准,技术中心规定订单号下有模拟焊后标准不可引用需送实物样,"+msgmemo);
- return cro;
- }
-
- //厚板是手动选择,中板自动 小于等于-40度冲击都单独送样做
- if(parmas.get("PLINE_CODE").equals("ZB1")){
- String zbSql = " select i.* from qcm_jhy_sample_consign_d t,qcm_jhy_sample_r_ord r,qcm_jhy_sample_consign_d_item i "
- +" where t.smp_no = r.smp_no and t.specimen_no = i.specimen_no and r.smp_no = i.smp_no and i.phy_code_l = 'HC' "
- +" and r.design_key not like '19%' and to_number(REGEXP_REPLACE(i.item_code_t,'[^-0-9]','')) <= -40 "
- +" and t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' and rownum <= 1 ";
- HashMap hmapZb = mapper.queryOne(zbSql.toString());
- if(hmapZb != null && hmapZb.size()>=1){
- String msgmemo="订单号:"+parmas.get("DESIGN_KEY")+"轧批号:"+parmas.get("BATCH_NO");
- SqlSession.close();
- cro.setV_errCode(-1);
- cro.setV_errMsg("引用失败!勾选的轧批中有冲击项目并且是小于等于-40度不可引用需要下发委托,"+msgmemo);
- return cro;
- }
- }
-
- String MATERIAL_NO = "1";
- String smpLocationCode = "";
- String CERT_INST_CODE = "";
- String FREQ_CODE = "";
- String sql="";
- sql = " select r.CERT_INST_CODE,t.* from QCM_JHY_SAMPLE_CONSIGN_D t, qcm_jhy_sample_r_ord r"
- + " where t.smp_no = r.smp_no and t.SPECIMEN_NO='"+parmas.get("SPECIMEN_NO")+"' and rownum <= 1";
- HashMap resultM = mapper.queryOne(sql.toString());
- if(resultM != null && resultM.size()>=1){
- MATERIAL_NO = resultM.get("MATERIAL_NO").toString();
- smpLocationCode = resultM.get("SMP_LOCATION_CODE").toString();
- CERT_INST_CODE = resultM.get("CERT_INST_CODE").toString();
- FREQ_CODE = resultM.get("FREQ_CODE").toString();
- }
- //记录
- QcmJudgeOperateLog qjog = new QcmJudgeOperateLog();
- qjog.setOperate_name(parmas.get("CREATE_NAME")== null ?"":parmas.get("CREATE_NAME").toString());
- qjog.setBatchno(parmas.get("BATCH_NO") == null ?"":parmas.get("BATCH_NO").toString());
- qjog.setOperate_type("引用同批实绩");
- qjog.setParams(MATERIAL_NO == null ?"":MATERIAL_NO);
- qjog.setProd_line(parmas.get("PLINE_CODE") == null ?"":parmas.get("PLINE_CODE").toString());
- qjog.setMemo(parmas.get("SPECIMEN_NO").toString());
- mapper.insertQcmJudgeOperateLog(qjog);
- //19订单引用
- String dkey = parmas.get("DESIGN_KEY").toString().substring(0, 2);
- if("19".equals(dkey)){//19订单
- parmas.put("DESIGN_KEY", parmas.get("DESIGN_KEY").toString());
- if(parmas.get("SEND_ID").equals("1")){
- parmas.put("SEND_ID", "系统自动");
- parmas.put("CREATE_NAME", "系统自动");
- }
- String ret = DoQuoteBatchNo191(parmas);
- if(!ret.equals("1")){
- SqlSession.close();
- cro.setV_errCode(-1);
- cro.setV_errMsg("引用失败!"+ret);
- return cro;
- }
- SqlSession.close();
- cro.setV_errCode(1);
- cro.setV_errMsg("引用成功!");
- return cro;
- }
-
- //复样引用
- if(parmas.get("SMP_TYPE_CODE").toString().equals("1")){
- String ret = DoQuoteBatchNoFy(parmas);
- if(!ret.equals("1")){
- SqlSession.close();
- cro.setV_errCode(-1);
- cro.setV_errMsg("引用失败!"+ret);
- return cro;
- }
- SqlSession.close();
- cro.setV_errCode(1);
- cro.setV_errMsg("引用成功!");
- return cro;
-
- }
- //判断是否是船检
- String strAgent="";
- String strZ="select r.* from qcm_jhy_sample_consign_d t,qcm_jhy_sample_r_ord r where t.smp_no = r.smp_no "
- +" and t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' and r.Cert_Inst_Code in ('IC002','IC005','IC006','IC007','IC009','IC008') and rownum <= 1";
- HashMap hmZ=mapper.queryOne(strZ.toString());
- if(hmZ!=null && hmZ.size()>=1){ //同牌号同规格
- strAgent = " and r.steel_code = '"+hmZ.get("STEEL_CODE")+"' and r.thick = '"+hmZ.get("THICK")+"' and r.CERT_INST_CODE != '5000' ";
- }
-
- //引用中有两条委托 两条委托中都有冲击 而冲击温度不一样
- String HCSTR="0";
- HashMap result=null;
- sql ="";
- sql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' and t.PHY_CODE_L='HC' ";
- List<HashMap> hmHC=mapper.query(sql.toString());
- if(hmHC!=null && hmHC.size()>=1){
- String nuowei = "";
- if("IC001".equals(CERT_INST_CODE)){//判断是否是挪威 挪威冲击温度一致可引用
- nuowei =" and i.Item_Code_t = '"+hmHC.get(0).get("ITEM_CODE_T")+"' ";
- HCSTR="1";
- }
- if(FREQ_CODE.equals("C") || FREQ_CODE.equals("H") || FREQ_CODE.equals("I")){
- nuowei +=" and t.MATERIAL_NO = '"+MATERIAL_NO+"' ";
- }
- sql="";
- sql="select t.* from qcm_jhy_sample_r_ord r,qcm_jhy_sample_consign_d t,qcm_jhy_sample_consign_d_item i "
- +" where t.smp_no = r.smp_no and t.specimen_no = i.specimen_no and i.seq<=49 and i.Item_Code_t <= '"+hmHC.get(0).get("ITEM_CODE_T")+"' "
- +" and t.batch_no = '"+parmas.get("BATCH_NO")+"' and i.Phy_Code_l='HC' and t.status='3' and t.freq_code <> 'D' and t.CHEM_ITEM is null "
- +" and t.smp_type_code = '0' and nvl(t.QUOTE_MEMO ,'null') <> '引用实绩' and t.SMP_LOCATION_CODE='"+smpLocationCode+"' "
- +" and to_char(r.thick, 'fm990.099') = to_char('"+parmas.get("THICK")+"', 'fm990.099') " + strAgent + strSql +nuowei
- +" order by Item_Code_t asc ";
- List<HashMap> hmHC2=mapper.query(sql.toString());
- if(hmHC2!=null && hmHC2.size()>=1){
- sql ="";
- sql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D t where t.specimen_no = '"+hmHC2.get(0).get("SPECIMEN_NO")+"' and rownum <= 1 ";
- result=null;
- result = mapper.queryOne(sql.toString());
- HCSTR="1";
- }
- }
-
- if("0".equals(HCSTR)){
- //同子板引用
- sql ="";
- sql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D t,qcm_jhy_sample_r_ord r "
- +" where t.smp_no = r.smp_no and t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"' "
- +" and t.smp_type_code = '0' and t.status = '3' and nvl(t.QUOTE_MEMO ,'null') <> '引用实绩' "
- +" and t.freq_code <> 'D' and CHEM_ITEM is null and t.MATERIAL_NO = '"+MATERIAL_NO+"' and t.SMP_LOCATION_CODE='"+smpLocationCode+"' "
- +" and to_char(r.thick, 'fm990.099') = to_char('"+parmas.get("THICK")+"', 'fm990.099') " + strAgent + strSql
- +" and rownum <= 1 order by t.send_time asc ";
- result=null;
- result = mapper.queryOne(sql.toString());
- //同订单引用
- if(result == null || result.size()<=0){
- sql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D t,qcm_jhy_sample_r_ord r "
- +" where t.smp_no = r.smp_no and t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"' "
- +" and t.smp_type_code = '0' and t.status = '3' and nvl(t.QUOTE_MEMO ,'null') <> '引用实绩' and t.freq_code <> 'D' "
- +" and t.CHEM_ITEM is null and r.DESIGN_KEY = '"+parmas.get("DESIGN_KEY")+"' " + strAgent + strSql
- +" and rownum <= 1 order by t.send_time asc ";
- result=null;
- result = mapper.queryOne(sql.toString());
- //同规格同牌号
- if(result == null || result.size()<=0){
- sql ="";
- sql = "select * from (select * from ("
- + " select (select count(1) from qcm_jhy_sample_consign_d_item i where i.specimen_no = t.specimen_no) nums,t.* "
- + " from QCM_JHY_SAMPLE_CONSIGN_D t,qcm_jhy_sample_r_ord r "
- +" where t.smp_no = r.smp_no and t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"' "
- +" and t.smp_type_code = '0' and t.status = '3' and nvl(t.QUOTE_MEMO ,'null') <> '引用实绩' and t.SMP_LOCATION_CODE='"+smpLocationCode+"' "
- +" and t.freq_code <> 'D' and t.CHEM_ITEM is null and to_char(r.thick, 'fm990.099') = '"+parmas.get("THICK")+"' " + strSql
- +" and r.steel_name = '"+parmas.get("STEEL_NAME")+"' ) t order by t.nums desc) t where rownum=1 ";
- result=null;
- result = mapper.queryOne(sql.toString());
- //同规格引用
- if(result == null || result.size()<=0){
- sql ="";
- sql = "select * from (select * from ("
- +" select (select count(1) from qcm_jhy_sample_consign_d_item i where i.specimen_no = t.specimen_no) nums,t.* "
- +" from QCM_JHY_SAMPLE_CONSIGN_D t,qcm_jhy_sample_r_ord r "
- +" where t.smp_no = r.smp_no and t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"' "
- +" and t.smp_type_code = '0' and t.status = '3' and nvl(t.QUOTE_MEMO ,'null') <> '引用实绩' and t.SMP_LOCATION_CODE='"+smpLocationCode+"' "
- +" and t.freq_code <> 'D' and t.CHEM_ITEM is null and to_char(r.thick, 'fm990.099') = '"+parmas.get("THICK")+"' " + strAgent + strSql
- +" ) t order by t.nums desc) t where rownum=1 ";
- result=null;
- result = mapper.queryOne(sql.toString());
-
- //随机引用
- if((result == null || result.size()<=0) && strAgent.length()<=0){
- sql="";
- sql = "select * from (select * from (select (select count(1) from qcm_jhy_sample_consign_d_item i where i.specimen_no = t.specimen_no) nums, t.* "
- + " from QCM_JHY_SAMPLE_CONSIGN_D t,qcm_jhy_sample_r_ord r where t.smp_no = r.smp_no " + strSql
- + " and t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"' "
- + " and t.smp_type_code = '0' and t.status = '3' and nvl(t.QUOTE_MEMO ,'null') <> '引用实绩' "
- + " and t.freq_code <> 'D' and t.CHEM_ITEM is null ) t order by t.nums desc) t where rownum=1 ";
- result=null;
- result = mapper.queryOne(sql.toString());
- }
- }
- }
- }
- }
- if (result != null && result.size()>=1) {
-
- //判断厚度是否大于引用的厚度
- sql ="";
- sql = "select to_char(t.THICK, 'fm990.099') THICK,t.* from Qcm_Jhy_Sample_r_Ord t where t.SMP_NO = '"+result.get("SMP_NO")+"' and rownum <= 1 ";
- List<HashMap> OrdLists=mapper.query(sql.toString());
- if(OrdLists!=null && OrdLists.size()>=1){
- String thick2 = OrdLists.get(0).get("THICK").toString();
- String thick = parmas.get("THICK").toString();
- if(!thick2.equals(thick)){
- SqlSession.rollback();
- SqlSession.close();
- cro.setV_errCode(-1);
- cro.setV_errMsg("引用失败!规格不一样");
- return cro;
- }
- }
- //查询引用的所有明细 240308增加代码 and t.specl_fl <> '4' 把加项项目排除
- sql ="";
- sql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' and t.specl_fl <> '4' ";
- List<HashMap> qltyLists=mapper.query(sql.toString());
-
- List<HashMap> qltyLists2=null;
- //查询是否有LRA加项项目
- sql="";
- sql="select * from qcm_jhy_sample_consign_d_item i where i.specimen_no = '"+result.get("SPECIMEN_NO")+"' and i.specl_fl = '4' and i.phy_code_l='HC' ";
- List<HashMap> qltyLRA=mapper.query(sql.toString());
- if(qltyLRA!=null && qltyLRA.size()>=1){
- //查询被引用的所有明细
- sql ="";
- sql = "select t.* from QCM_JHY_INSP_PHYSICS t where t.specimen_no = '"+result.get("SPECIMEN_NO")+"' and t.quote_specimen_no is null and t.phy_code_l<>'HC' ";
- qltyLists2=mapper.query(sql.toString());
- }else{
- //查询被引用的所有明细
- sql ="";
- sql = "select t.* from QCM_JHY_INSP_PHYSICS t where t.specimen_no = '"+result.get("SPECIMEN_NO")+"' and t.quote_specimen_no is null ";
- qltyLists2=mapper.query(sql.toString());
- }
-
- Integer bQuote = qltyLists.size();//引用
- Integer yQuote = qltyLists2.size();//被引用
-
- int quotenum = 0;//已引用数据
- String hbB01 ="";//弯曲
- //引用
- for (int i = 0; i < qltyLists.size(); i++) {//引用在外层循环 对比 引用中有没有相应的项目有 插入
- if("B01".equals((String) qltyLists.get(i).get("PHY_CODE_S"))){
- hbB01 ="0";
- }else{
- hbB01 ="";
- }
- //代码
- String phyCodeL = (String) qltyLists.get(i).get("PHY_CODE_L");//材质检验大项代码
- String phyCodeM = (String) qltyLists.get(i).get("PHY_CODE_M");//试样组代码
- String phyCodeS = (String) qltyLists.get(i).get("PHY_CODE_S");//材质检验项目代码
- String itemCodeD = (String) qltyLists.get(i).get("ITEM_CODE_D");//试验方向代码
- String itemCodeT = (String) qltyLists.get(i).get("ITEM_CODE_T");//试验温度代码 试验温度代码 冲击 被引用
- String itemCodeS = (String) qltyLists.get(i).get("ITEM_CODE_S");//试样尺寸代码
- //名称
- String phyNameL = (String) qltyLists.get(i).get("PHY_NAME_L");//材质检验大项代码
- String phyNameM = (String) qltyLists.get(i).get("PHY_NAME_M");//试样组代码
- String phyNameS = (String) qltyLists.get(i).get("PHY_NAME_S");//材质检验项目代码
- String itemNameD = (String) qltyLists.get(i).get("ITEM_NAME_D");//试验方向代码
- String itemNameT = (String) qltyLists.get(i).get("ITEM_NAME_T");//试验温度代码 试验温度代码 冲击 被引用
- String itemNameS = (String) qltyLists.get(i).get("ITEM_NAME_S");//试样尺寸代码
-
- String itemCodeL = (String) qltyLists.get(i).get("ITEM_CODE_L");//试验位置代码
- String itemDescL = (String) qltyLists.get(i).get("ITEM_DESC_L");
- BigDecimal seq = (BigDecimal) qltyLists.get(i).get("SEQ");
- String bigdjs = seq.toString();
- Integer bigd4 = Integer.parseInt(bigdjs);
-
- String newItem=phyCodeL+"-"+phyCodeM+"-"+phyCodeS;
- newItem=newItem+"-"+(itemCodeD!=null?itemCodeD:"null");
- newItem=newItem+"-"+(itemCodeT!=null?itemCodeT:"null");
- newItem=newItem+"-"+(itemCodeS!=null?itemCodeS:"null");
- //newItem=newItem+"-"+(itemCodeL!=null?itemCodeL:"null");
- //弯曲
- ///// String newItemHB=phyCodeL+"-"+phyCodeM+"-"+phyCodeS+"-"+(itemCodeD!=null?itemCodeD:"null")+"-"+(itemCodeT!=null?itemCodeT:"null");
-
- //被引用
- for (HashMap hashMap : qltyLists2) {
-
- //代码
- String phyCodeL2 = (String) hashMap.get("PHY_CODE_L");//材质检验大项代码
- String phyCodeM2 = (String) hashMap.get("PHY_CODE_M");//试样组代码
- String phyCodeS2 = (String) hashMap.get("PHY_CODE_S");//材质检验项目代码
- String itemCodeD2 = (String) hashMap.get("ITEM_CODE_D");//试验方向代码
- String itemCodeT2 = (String) hashMap.get("ITEM_CODE_T");//试验温度代码 试验温度代码 冲击 被引用
- String itemCodeS2 = (String) hashMap.get("ITEM_CODE_S");//试样尺寸代码
- String itemCodeL2 = (String) hashMap.get("ITEM_CODE_L");//试验位置代码
-
- String newItem2=phyCodeL2+"-"+phyCodeM2+"-"+phyCodeS2;
- newItem2=newItem2+"-"+(itemCodeD2!=null?itemCodeD2:"null");
- newItem2=newItem2+"-"+(itemCodeT2!=null?itemCodeT2:"null");
- newItem2=newItem2+"-"+(itemCodeS2!=null?itemCodeS2:"null");
- //newItem2=newItem2+"-"+(itemCodeL2!=null?itemCodeL2:"null");
-
- //弯曲
- ///// String newItemHB2=phyCodeL2+"-"+phyCodeM2+"-"+phyCodeS2+"-"+(itemCodeD2!=null?itemCodeD2:"null")+"-"+(itemCodeT2!=null?itemCodeT2:"null");
-
- //判断是否是冲击试验
- if(phyCodeS.equals("C01") || phyCodeS.equals("C02")){
- if(phyCodeS.equals(phyCodeS2)){
- Integer co1t= Integer.parseInt(itemCodeT);//引用
- Integer co2t= Integer.parseInt(itemCodeT2);//被引用
- if(co1t >= co2t){
- 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,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, "
- +" PHY_UNIT,MEMO) "
- +" select '"+parmas.get("SPECIMEN_NO")+"','"+bigd4+"',TEST_QTY,'"+phyCodeL+"','"+phyNameL+"','"+phyCodeM+"','"+phyNameM+"','"+phyCodeS+"','"+phyNameS+"','"+itemCodeD+"','"+itemNameD+"', "
- +" '"+itemCodeT+"','"+itemNameT+"','"+itemCodeS+"','"+itemNameS+"',VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
- +" VAL13,VAL14,VAL15,AVG_VAL,'"+parmas.get("CREATE_NAME")+"',sysdate,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,'"+itemCodeL+"','"+itemDescL+"', "
- +" PHY_UNIT,MEMO from QCM_JHY_INSP_PHYSICS t "
- + " where t.specimen_no = '"+(String)hashMap.get("SPECIMEN_NO")+"' "
- + "and t.seq = '"+hashMap.get("SEQ")+"' ";
- mapper.insert(sql);
-
- //修改ITEM表
- sql = "";
- sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t set t.QUOTE_MEMO = '已引用"+result.get("SPECIMEN_NO")+"' "
- + " where t.SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' and t.seq = '"+seq+"' ";
- mapper.updateJudgeStatus(sql.toString());
- quotenum++;
- break;
- }
- }
-
- }/*else if (phyCodeS.equals("B01")){//弯曲试验 冷弯(面弯)试验/////
- //标准一样的引用
- if(newItemHB.equals(newItemHB2)){
-
- 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,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, "
- +" PHY_UNIT,MEMO) "
- +" select '"+parmas.get("SPECIMEN_NO")+"','"+bigd4+"',TEST_QTY,'"+phyCodeL+"','"+phyNameL+"','"+phyCodeM+"','"+phyNameM+"','"+phyCodeS+"','"+phyNameS+"','"+itemCodeD+"','"+itemNameD+"', "
- +" '"+itemCodeT+"','"+itemNameT+"','"+itemCodeS+"','"+itemNameS+"',VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
- +" VAL13,VAL14,VAL15,AVG_VAL,'"+parmas.get("CREATE_NAME")+"',sysdate,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,'"+itemCodeL+"','"+itemDescL+"', "
- +" PHY_UNIT,MEMO from QCM_JHY_INSP_PHYSICS t "
- + " where t.specimen_no = '"+(String)hashMap.get("SPECIMEN_NO")+"' "
- + "and t.seq = '"+hashMap.get("SEQ")+"' ";
- mapper.insert(sql);
-
- //修改ITEM表
- sql = "";
- sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t set t.QUOTE_MEMO = '已引用"+result.get("SPECIMEN_NO")+"' "
- + " where t.SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' and t.seq = '"+seq+"' ";
- mapper.updateJudgeStatus(sql.toString());
- quotenum++;
- hbB01 ="1";
- break;
- }
-
- }*/else{//其它试验
-
- //标准一样的引用
- if(newItem.equals(newItem2)){
-
- 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,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, "
- +" PHY_UNIT,MEMO) "
- +" select '"+parmas.get("SPECIMEN_NO")+"','"+bigd4+"',TEST_QTY,'"+phyCodeL+"','"+phyNameL+"','"+phyCodeM+"','"+phyNameM+"','"+phyCodeS+"','"+phyNameS+"','"+itemCodeD+"','"+itemNameD+"', "
- +" '"+itemCodeT+"','"+itemNameT+"','"+itemCodeS+"','"+itemNameS+"',VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
- +" VAL13,VAL14,VAL15,AVG_VAL,'"+parmas.get("CREATE_NAME")+"',sysdate,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,'"+itemCodeL+"','"+itemDescL+"', "
- +" PHY_UNIT,MEMO from QCM_JHY_INSP_PHYSICS t "
- + " where t.specimen_no = '"+(String)hashMap.get("SPECIMEN_NO")+"' "
- + "and t.seq = '"+hashMap.get("SEQ")+"' ";
- mapper.insert(sql);
-
- //修改ITEM表
- sql = "";
- sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t set t.QUOTE_MEMO = '已引用"+result.get("SPECIMEN_NO")+"' "
- + " where t.SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' and t.seq = '"+seq+"' ";
- mapper.updateJudgeStatus(sql.toString());
- quotenum++;
- break;
- }
-
- }
- }
-
- //申报:郭明清 主题:非计划船板改普板,冷弯需要系统默认合格 申报时间:2023-04-27 16:49:59
- //原牌号为船板 BV/IC003法国船级社,KR/IC004韩国船级社,DNV/IC001挪威船级社,CCS/IC010中国船级社 、ABS/IC005美国船级社、LR/IC009 英国船级社、NK/KA36/IC006 日本船级社、RINA/IC007 意大利船级社 、RS/IC002 俄罗斯 IC012 客户认证
- //改成普锰板(Q235A/B、Q345A/B、Q355B)
- //被引用是原牌号船板 引用是改判 普锰板
- //弯曲 默认合格
- if("B01".equals((String) qltyLists.get(i).get("PHY_CODE_S"))&& !"".equals(hbB01) && hbB01.equals("0")){
- sql="";
- sql="select d.* from qcm_jhy_sample_consign_d d,qcm_jhy_sample_r_ord r "
- +" where d.smp_no = r.smp_no and r.steel_code in ('Q235A','Q235B','Q345A','Q345B','Q355B') "
- +" and d.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' ";
- List<HashMap> hashMap=mapper.query(sql.toString());
- if(hashMap!=null && hashMap.size()>=1){
- sql="";
- sql="select r.* from qcm_jhy_sample_consign_d d,qcm_jhy_sample_r_ord r "
- +" where d.smp_no = r.smp_no and r.cert_inst_code in ('IC005','IC009','IC006','IC007','IC002','IC003','IC004','IC001','IC010') "
- +" and d.specimen_no = '"+result.get("SPECIMEN_NO")+"' ";
- List<HashMap> hashMap2=mapper.query(sql.toString());
-
- //船板没有弯曲
- sql="";
- sql="select * from qcm_jhy_sample_consign_d_item where specimen_no = '"+result.get("SPECIMEN_NO")+"' and phy_code_s='B01' ";
- List<HashMap> hashMap3=mapper.query(sql.toString());
- if(hashMap2!=null && hashMap2.size()>=1 && hashMap3.size()<=0 ){
- 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,AVG_VAL,CREATE_NAME,CREATE_TIME,DEFECT_FLAG,MAX_VAL, "
- +" MIN_VAL,ITEM_CODE_L,ITEM_DESC_L,PHY_UNIT,MEMO) "
- +" select t.specimen_no,t.seq,t.test_qty,t.phy_code_l,t.phy_name_l,t.phy_code_m,t.phy_name_m,t.phy_code_s,t.phy_name_s,t.item_code_d,t.item_name_d, "
- +" t.item_code_t,t.item_name_t,t.item_code_s,t.item_name_s,'合格','合格','"+parmas.get("CREATE_NAME")+"',sysdate,'0','合格','合格',t.item_code_l,t.item_desc_l, "
- +" t.phy_unit,'默认合格' "
- +" from qcm_jhy_sample_consign_d_item t "
- +" where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' "
- +" and t.phy_code_s = 'B01' ";
- mapper.insert(sql);
-
- //修改ITEM表
- sql = "";
- sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t set t.QUOTE_MEMO = '默认合格' "
- + " where t.SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' and t.phy_code_s = 'B01' ";
- mapper.updateJudgeStatus(sql.toString());
- quotenum++;
- }
- }
- }
-
- }
- //被引用的项目 全部 已引用
- if(quotenum == qltyLists.size()){
- //修改D表
- sql = "";
- sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.STATUS = '3',t.SEND_ID = '"+parmas.get("SEND_ID")+"',"
- + " t.SEND_NAME = '"+parmas.get("CREATE_NAME")+"',t.SEND_TIME = sysdate,t.SEND_MEMO = '有引用',t.QUOTE_MEMO = '引用实绩' "
- + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'"
- + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' ";
- mapper.updateJudgeStatus(sql.toString());
-
- //往log表中插入p
- sql = "";
- sql = " INSERT INTO QCM_JUDGE_LOG ( JUDGE_TYPE,MATERIAL_NO,CREATE_TIME,CREATE_NAME,PROD_LINE) "
- +" VALUES ( 'P', '"+parmas.get("SMP_NO")+"', SYSDATE,'system','"+parmas.get("PLINE_CODE")+"')";
- mapper.insert(sql);
- }else{
- //修改D表
- sql = "";
- sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.SEND_MEMO = '有引用',t.QUOTE_MEMO = '引用实绩' "
- + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'"
- + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' ";
- mapper.updateJudgeStatus(sql.toString());
- }
-
-
-
- }else{
- SqlSession.close();
- cro.setV_errCode(-1);
- cro.setV_errMsg("该轧批未返回实绩或没有引用的对象!请在委托记录中核实相应委托数据");
- return cro;
- }
- } catch (Exception e) {
- SqlSession.rollback();
- SqlSession.close();
- cro.setV_errCode(-1);
- cro.setV_errMsg("引用失败!"+e.getMessage());
- return cro;
- }
- SqlSession.commit();
- SqlSession.close();
- cro.setV_errCode(1);
- cro.setV_errMsg("引用成功!");
- return cro;
- }
-
-
-
- /**
- * 19订单自动引用 不同订单 同轧批号 项目一样引用
- * @param materialInfo
- * @return
- * @throws Exception
- */
- public void DoQuoteBatchNo19(HashMap parmas) throws Exception {
- SqlSession = QCM.COMMUNAL.SqlSessionBuilder.openSqlSession();
- mapper = SqlSession.getMapper(QCM.COMMUNAL.OrderSqMapper.class);
- try {
- String chiStr = "";
- String process_nos="";
- String pno1="";
- String pno2="";
- String pno3="";
- if(parmas.get("CREATE_NAME").equals("调试人员")){
- parmas.put("SEND_ID", "系统自动");
- parmas.put("CREATE_NAME", "系统自动");
- }
- //判断是否按子板取样 19订单
- String chi = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D t where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' and rownum <= 1 ";
- List<HashMap> CHILists=mapper.query(chi.toString());
- if(CHILists != null && CHILists.size()>=1 ){
- process_nos=CHILists.get(0).get("PROCESS_NOS").toString();
- if(CHILists.get(0).get("FREQ_CODE").equals("C") || CHILists.get(0).get("FREQ_CODE").equals("H") || CHILists.get(0).get("FREQ_CODE").equals("I")){
- chiStr = " and t.MATERIAL_NO = '"+CHILists.get(0).get("MATERIAL_NO")+"' ";
- }
- }
- pno1=process_nos.substring(0, 1);//第一位
- pno2=process_nos.substring(3, 4);//第四位
- pno3=process_nos.substring(4, 5);//第五位
- String sql ="";
- sql = "select * from (select * from ("
- + " select (select count(1) from qcm_jhy_sample_consign_d_item i where i.specimen_no = t.specimen_no AND i.Phy_Code_l <> 'HJ') nums,t.* "
- + " from QCM_JHY_SAMPLE_CONSIGN_D t,qcm_jhy_sample_r_ord r "
- +" where t.smp_no = r.smp_no and t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"' "
- +" and t.smp_type_code = '0' and t.status = '3' and t.freq_code <> 'D' and t.CHEM_ITEM is null "
- +" and to_char(r.thick, 'fm990.099') = to_char('"+parmas.get("THICK")+"', 'fm990.099') and r.DESIGN_KEY not like '19%' "
- + chiStr
- +" and substr(t.PROCESS_NOS,0,1)='"+pno1+"' "
- +" and substr(t.PROCESS_NOS,4,1)='"+pno2+"' "
- +" and substr(t.PROCESS_NOS,5,1)='"+pno3+"' "
- + " ) t where t.nums !=0 order by t.nums desc) t where rownum=1 ";
- HashMap result = mapper.queryOne(sql.toString());
-
- if(result==null || result.size()<=0){
- sql = "select t.* from (select (select count(1) from qcm_jhy_sample_consign_d_item i where i.specimen_no = t.specimen_no AND i.Phy_Code_l <> 'HJ') nums, t.* from QCM_JHY_SAMPLE_CONSIGN_D t "
- +" where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"' "
- +" and t.smp_type_code = '0' and t.status = '3' "
- +" and t.freq_code <> 'D' and CHEM_ITEM is null "
- +" and substr(t.PROCESS_NOS,0,1)='"+pno1+"' "
- +" and substr(t.PROCESS_NOS,4,1)='"+pno2+"' "
- +" and substr(t.PROCESS_NOS,5,1)='"+pno3+"' "
- +" and rownum <= 1 order by t.send_time asc ) t where t.nums != 0";
- result=null;
- result = mapper.queryOne(sql.toString());
- }
-
- if (result != null && result.size()>=1) {
- //判断厚度是否大于引用的厚度
- sql ="";
- sql = "select To_Number(t.thick) thick from Qcm_Jhy_Sample_r_Ord t where t.SMP_NO = '"+result.get("SMP_NO")+"' and rownum <= 1 ";
- List<HashMap> OrdLists=mapper.query(sql.toString());
- if(OrdLists!=null && OrdLists.size()>=1 && !StringUtils.isBlank(OrdLists.get(0).get("THICK").toString())){
- String hmap2 = OrdLists.get(0).get("THICK").toString();
- double thick1 = Double.parseDouble(hmap2);
- String thick = parmas.get("THICK").toString();
- double thick2 = Double.parseDouble(thick);
- if(thick2>thick1){
- String str =thick2+">"+thick1;
- //修改D表
- sql = "";
- sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.ONEMEMO = '19订单委托厚度大于引用厚度不可引用:'||'"+str+"' ,t.ARTIFICIAL_MEMO='0' "
- + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'"
- + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' ";
- mapper.updateJudgeStatus(sql.toString());
- SqlSession.commit();
- SqlSession.close();
- return;//被引用不能大于引用
- }
- if((thick1-thick2)>=3){
- String str =thick2+"<"+thick1;
- sql = "";
- sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.ONEMEMO = '19订单委托厚度小于引用厚度不可超过2mm,超过2mm不可引用:'||'"+str+"' ,t.ARTIFICIAL_MEMO='0' "
- + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'"
- + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' ";
- mapper.updateJudgeStatus(sql.toString());
- SqlSession.commit();
- SqlSession.close();
- return;//引用-被引用不能大于等于3 小2mm
- }
- }
- //查询被引用的所有明细
- sql ="";
- sql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' ";
- List<HashMap> qltyLists=mapper.query(sql.toString());
-
- //查询引用的所有明细
- sql ="";
- sql = "select t.* from QCM_JHY_INSP_PHYSICS t where t.specimen_no = '"+result.get("SPECIMEN_NO")+"' "
- + " and t.quote_specimen_no is null and t.VAL1 is not null and t.create_name <>'现场默认' ";
- List<HashMap> qltyLists2=mapper.query(sql.toString());
-
- Integer bQuote = qltyLists.size();//被引用
- Integer yQuote = qltyLists2.size();//引用
-
- int quotenum = 0;//已引用数据
- String hbB01 ="";//弯曲
- //被引用
- for (int i = 0; i < qltyLists.size(); i++) {//被引用在外层循环 对比 引用中有没有相应的项目有 插入
- if("B01".equals((String) qltyLists.get(i).get("PHY_CODE_S"))){
- hbB01 ="0";
- }else{
- hbB01 ="";
- }
-
- //代码
- String phyCodeL = (String) qltyLists.get(i).get("PHY_CODE_L");//材质检验大项代码
- String phyCodeM = (String) qltyLists.get(i).get("PHY_CODE_M");//试样组代码
- String phyCodeS = (String) qltyLists.get(i).get("PHY_CODE_S");//材质检验项目代码
- String itemCodeD = (String) qltyLists.get(i).get("ITEM_CODE_D");//试验方向代码
- String itemCodeT = (String) qltyLists.get(i).get("ITEM_CODE_T");//试验温度代码 试验温度代码 冲击 被引用
- String itemCodeS = (String) qltyLists.get(i).get("ITEM_CODE_S");//试样尺寸代码
- //名称
- String phyNameL = (String) qltyLists.get(i).get("PHY_NAME_L");//材质检验大项代码
- String phyNameM = (String) qltyLists.get(i).get("PHY_NAME_M");//试样组代码
- String phyNameS = (String) qltyLists.get(i).get("PHY_NAME_S");//材质检验项目代码
- String itemNameD = (String) qltyLists.get(i).get("ITEM_NAME_D");//试验方向代码
- String itemNameT = (String) qltyLists.get(i).get("ITEM_NAME_T");//试验温度代码 试验温度代码 冲击 被引用
- String itemNameS = (String) qltyLists.get(i).get("ITEM_NAME_S");//试样尺寸代码
-
- String itemCodeL = (String) qltyLists.get(i).get("ITEM_CODE_L");//试验位置代码
- String itemDescL = (String) qltyLists.get(i).get("ITEM_DESC_L");
- BigDecimal seq = (BigDecimal) qltyLists.get(i).get("SEQ");
- String bigdjs = seq.toString();
- Integer bigd4 = Integer.parseInt(bigdjs);
-
- String newItem=phyCodeL+"-"+phyCodeM+"-"+phyCodeS;
- newItem=newItem+"-"+(itemCodeD!=null?itemCodeD:"null");
- newItem=newItem+"-"+(itemCodeT!=null?itemCodeT:"null");
- newItem=newItem+"-"+(itemCodeS!=null?itemCodeS:"null");
-
- //引用
- for (HashMap hashMap : qltyLists2) {
-
- //代码
- String phyCodeL2 = (String) hashMap.get("PHY_CODE_L");//材质检验大项代码
- String phyCodeM2 = (String) hashMap.get("PHY_CODE_M");//试样组代码
- String phyCodeS2 = (String) hashMap.get("PHY_CODE_S");//材质检验项目代码
- String itemCodeD2 = (String) hashMap.get("ITEM_CODE_D");//试验方向代码
- String itemCodeT2 = (String) hashMap.get("ITEM_CODE_T");//试验温度代码 试验温度代码 冲击 被引用
- String itemCodeS2 = (String) hashMap.get("ITEM_CODE_S");//试样尺寸代码
-
- String newItem2=phyCodeL2+"-"+phyCodeM2+"-"+phyCodeS2;
- newItem2=newItem2+"-"+(itemCodeD2!=null?itemCodeD2:"null");
- newItem2=newItem2+"-"+(itemCodeT2!=null?itemCodeT2:"null");
- newItem2=newItem2+"-"+(itemCodeS2!=null?itemCodeS2:"null");
-
- //判断是否是冲击试验
- if(phyCodeS.equals("C01") || phyCodeS.equals("C02")){
- if(phyCodeS.equals(phyCodeS2)){
- double co1t = Double.valueOf(itemCodeT);
- double co2t = Double.valueOf(itemCodeT2);
- //Integer co1t= Integer.parseInt(itemCodeT);//被引用
- //Integer co2t= Integer.parseInt(itemCodeT2);//引用
- if(co1t >= co2t){
- 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,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, "
- +" PHY_UNIT,MEMO) "
- +" select '"+parmas.get("SPECIMEN_NO")+"','"+bigd4+"',TEST_QTY,'"+phyCodeL+"','"+phyNameL+"','"+phyCodeM+"','"+phyNameM+"','"+phyCodeS+"','"+phyNameS+"','"+itemCodeD+"','"+itemNameD+"', "
- +" '"+itemCodeT+"','"+itemNameT+"','"+itemCodeS+"','"+itemNameS+"',VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
- +" VAL13,VAL14,VAL15,AVG_VAL,'"+parmas.get("CREATE_NAME")+"',sysdate,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,'"+itemCodeL+"','"+itemDescL+"', "
- +" PHY_UNIT,MEMO from QCM_JHY_INSP_PHYSICS t "
- + " where t.specimen_no = '"+(String)hashMap.get("SPECIMEN_NO")+"' "
- + "and t.seq = '"+hashMap.get("SEQ")+"' ";
- mapper.insert(sql);
-
- //修改ITEM表
- sql = "";
- sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t set t.QUOTE_MEMO = '已引用"+result.get("SPECIMEN_NO")+"' "
- + " where t.SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' and t.seq = '"+seq+"' ";
- mapper.updateJudgeStatus(sql.toString());
- quotenum++;
- break;
- }
- }
-
- }else{//其它试验
-
- //标准一样的引用
- if(newItem.equals(newItem2)){
-
- 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,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, "
- +" PHY_UNIT,MEMO) "
- +" select '"+parmas.get("SPECIMEN_NO")+"','"+bigd4+"',TEST_QTY,'"+phyCodeL+"','"+phyNameL+"','"+phyCodeM+"','"+phyNameM+"','"+phyCodeS+"','"+phyNameS+"','"+itemCodeD+"','"+itemNameD+"', "
- +" '"+itemCodeT+"','"+itemNameT+"','"+itemCodeS+"','"+itemNameS+"',VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
- +" VAL13,VAL14,VAL15,AVG_VAL,'"+parmas.get("CREATE_NAME")+"',sysdate,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,'"+itemCodeL+"','"+itemDescL+"', "
- +" PHY_UNIT,MEMO from QCM_JHY_INSP_PHYSICS t "
- + " where t.specimen_no = '"+(String)hashMap.get("SPECIMEN_NO")+"' "
- + "and t.seq = '"+hashMap.get("SEQ")+"' ";
- mapper.insert(sql);
-
- //修改ITEM表
- sql = "";
- sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t set t.QUOTE_MEMO = '已引用"+result.get("SPECIMEN_NO")+"' "
- + " where t.SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' and t.seq = '"+seq+"' ";
- mapper.updateJudgeStatus(sql.toString());
- quotenum++;
- if("B01".equals(phyCodeS2) && "B01".equals((String) qltyLists.get(i).get("PHY_CODE_S"))){
- hbB01="1";
- }
- break;
- }
- }
- }
- //中厚板非计划处置维护 袁传泉 2023-11-07 10:47:23
- if("B01".equals((String) qltyLists.get(i).get("PHY_CODE_S"))&& !"".equals(hbB01) && hbB01.equals("0")){
- 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,AVG_VAL,CREATE_NAME,CREATE_TIME,DEFECT_FLAG,MAX_VAL, "
- +" MIN_VAL,ITEM_CODE_L,ITEM_DESC_L,PHY_UNIT,MEMO) "
- +" select t.specimen_no,t.seq,t.test_qty,t.phy_code_l,t.phy_name_l,t.phy_code_m,t.phy_name_m,t.phy_code_s,t.phy_name_s,t.item_code_d,t.item_name_d, "
- +" t.item_code_t,t.item_name_t,t.item_code_s,t.item_name_s,'合格','合格','"+parmas.get("CREATE_NAME")+"',sysdate,'0','合格','合格',t.item_code_l,t.item_desc_l, "
- +" t.phy_unit,'默认合格' "
- +" from qcm_jhy_sample_consign_d_item t "
- +" where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' "
- +" and t.phy_code_s = 'B01' ";
- mapper.insert(sql);
-
- //修改ITEM表
- sql = "";
- sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t set t.QUOTE_MEMO = '默认合格' "
- + " where t.SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' and t.phy_code_s = 'B01' ";
- mapper.updateJudgeStatus(sql.toString());
- quotenum++;
- }
- //申报:郭明清 主题:非计划船板改普板,冷弯需要系统默认合格 申报时间:2023-04-27 16:49:59
- //原牌号为船板 BV/IC003法国船级社,KR/IC004韩国船级社,DNV/IC001挪威船级社,CCS/IC010中国船级社 、ABS/IC005美国船级社、LR/IC009 英国船级社、NK/KA36/IC006 日本船级社、RINA/IC007 意大利船级社 、RS/IC002 俄罗斯 IC012 客户认证
- //改成普锰板(Q235A/B、Q345A/B、Q355B)
- //被引用是原牌号船板 引用是改判 普锰板
- //弯曲 默认合格
- /*if("B01".equals((String) qltyLists.get(i).get("PHY_CODE_S"))&& !"".equals(hbB01) && hbB01.equals("0")){
- sql="";
- sql="select d.* from qcm_jhy_sample_consign_d d,qcm_jhy_sample_r_ord r "
- +" where d.smp_no = r.smp_no and r.steel_code in ('Q235A','Q235B','Q345A','Q345B','Q355B') "
- +" and d.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' ";
- List<HashMap> hashMap=mapper.query(sql.toString());
- if(hashMap!=null && hashMap.size()>=1){
- sql="";
- sql="select r.* from qcm_jhy_sample_consign_d d,qcm_jhy_sample_r_ord r "
- +" where d.smp_no = r.smp_no and r.cert_inst_code in ('IC005','IC009','IC006','IC007','IC002','IC003','IC004','IC001','IC010') "
- +" and d.specimen_no = '"+result.get("SPECIMEN_NO")+"' ";
- List<HashMap> hashMap2=mapper.query(sql.toString());
-
- //船板没有弯曲
- sql="";
- sql="select * from qcm_jhy_sample_consign_d_item where specimen_no = '"+result.get("SPECIMEN_NO")+"' and phy_code_s='B01' ";
- List<HashMap> hashMap3=mapper.query(sql.toString());
- if(hashMap2!=null && hashMap2.size()>=1 && hashMap3.size()<=0 ){
- 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,AVG_VAL,CREATE_NAME,CREATE_TIME,DEFECT_FLAG,MAX_VAL, "
- +" MIN_VAL,ITEM_CODE_L,ITEM_DESC_L,PHY_UNIT,MEMO) "
- +" select t.specimen_no,t.seq,t.test_qty,t.phy_code_l,t.phy_name_l,t.phy_code_m,t.phy_name_m,t.phy_code_s,t.phy_name_s,t.item_code_d,t.item_name_d, "
- +" t.item_code_t,t.item_name_t,t.item_code_s,t.item_name_s,'合格','合格','"+parmas.get("CREATE_NAME")+"',sysdate,'0','合格','合格',t.item_code_l,t.item_desc_l, "
- +" t.phy_unit,'默认合格' "
- +" from qcm_jhy_sample_consign_d_item t "
- +" where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' "
- +" and t.phy_code_s = 'B01' ";
- mapper.insert(sql);
-
- //修改ITEM表
- sql = "";
- sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t set t.QUOTE_MEMO = '默认合格' "
- + " where t.SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' and t.phy_code_s = 'B01' ";
- mapper.updateJudgeStatus(sql.toString());
- quotenum++;
- }
- }
- }*/
-
- }
- //19HJGP 不自动下发
- sql="";
- sql="select r.* from qcm_jhy_sample_consign_d t,qcm_jhy_sample_r_ord r "
- + " where t.smp_no = r.smp_no and t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' and r.design_key like '19HJGP%' and rownum=1 ";
- HashMap resultHJGP = mapper.queryOne(sql.toString());
- if(resultHJGP!=null && resultHJGP.size()>=1){
- if(quotenum == qltyLists.size()){
- //修改D表
- sql = "";
- sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.STATUS = '3',t.SEND_ID = '"+parmas.get("SEND_ID")+"',"
- + " t.SEND_NAME = '"+parmas.get("CREATE_NAME")+"',t.SEND_TIME = sysdate,t.SEND_MEMO = '有引用',t.QUOTE_MEMO = '引用实绩' "
- + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'"
- + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' ";
- mapper.updateJudgeStatus(sql.toString());
-
- //往log表中插入p
- sql = "";
- sql = " INSERT INTO QCM_JUDGE_LOG ( JUDGE_TYPE,MATERIAL_NO,CREATE_TIME,CREATE_NAME,PROD_LINE) "
- +" VALUES ( 'P', '"+resultHJGP.get("SMP_NO")+"', SYSDATE,'system','"+parmas.get("PLINE_CODE")+"')";
- mapper.insert(sql);
- }else if(quotenum==0){
- sql = "";
- sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.ONEMEMO = '未找到一项可以引用的项目,订单标准全部不一样' ,t.ARTIFICIAL_MEMO='0' "
- + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'"
- + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' ";
- mapper.updateJudgeStatus(sql.toString());
- }else{
- //修改D表
- sql = "";
- sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.SEND_MEMO = '有引用',t.QUOTE_MEMO = '引用实绩' , t.ARTIFICIAL_MEMO='0', "
- + " t.ONEMEMO ='需下发委托' "
- + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'"
- + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' ";
- mapper.updateJudgeStatus(sql.toString());
- }
- }else{
- //被引用的项目 全部 已引用
- if(quotenum!=0){
- //修改D表
- sql = "";
- sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.STATUS = '3',t.SEND_ID = '"+parmas.get("SEND_ID")+"',"
- + " t.SEND_NAME = '"+parmas.get("CREATE_NAME")+"',t.SEND_TIME = sysdate,t.SEND_MEMO = '有引用',t.QUOTE_MEMO = '引用实绩' "
- + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'"
- + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' ";
- mapper.updateJudgeStatus(sql.toString());
-
- //往log表中插入p
- sql = "";
- sql = " INSERT INTO QCM_JUDGE_LOG ( JUDGE_TYPE,MATERIAL_NO,CREATE_TIME,CREATE_NAME,PROD_LINE) "
- +" VALUES ( 'P', '"+parmas.get("SMP_NO")+"', SYSDATE,'system','"+parmas.get("PLINE_CODE")+"')";
- mapper.insert(sql);
- }else if(quotenum==0){
- sql = "";
- sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.ONEMEMO = '未找到一项可以引用的项目,订单标准全部不一样' ,t.ARTIFICIAL_MEMO='0' "
- + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'"
- + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' ";
- mapper.updateJudgeStatus(sql.toString());
- }
- }
-
- }else{
- sql="";
- sql = "select * from (select * from ("
- + " select (select count(1) from qcm_jhy_sample_consign_d_item i where i.specimen_no = t.specimen_no) nums,t.* "
- + " from QCM_JHY_SAMPLE_CONSIGN_D t,qcm_jhy_sample_r_ord r "
- +" where t.smp_no = r.smp_no and t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"' "
- +" and t.smp_type_code = '0' and t.status in('0','2','7') "
- +" and t.freq_code <> 'D' and t.CHEM_ITEM is null and to_char(r.thick, 'fm990.099') = to_char('"+parmas.get("THICK")+"', 'fm990.099') "
- +" and r.DESIGN_KEY not like '19%' "
- +" and substr(t.PROCESS_NOS,0,1)='"+pno1+"' "
- +" and substr(t.PROCESS_NOS,4,1)='"+pno2+"' "
- +" and substr(t.PROCESS_NOS,5,1)='"+pno3+"' "
- + ") t order by t.nums desc) t where rownum=1 ";
- result=null;
- result = mapper.queryOne(sql.toString());
-
- if(result==null || result.size()<=0){
- sql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D t,qcm_jhy_sample_r_ord r "
- +" where t.smp_no = r.smp_no and t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"' "
- +" and t.smp_type_code = '0' and t.status in('0','2','7') "
- +" and t.freq_code <> 'D' and r.DESIGN_KEY not like '19%' and CHEM_ITEM is null "
- +" and substr(t.PROCESS_NOS,0,1)='"+pno1+"' "
- +" and substr(t.PROCESS_NOS,4,1)='"+pno2+"' "
- +" and substr(t.PROCESS_NOS,5,1)='"+pno3+"' "
- +" and rownum <= 1 order by t.send_time asc ";
- result=null;
- result = mapper.queryOne(sql.toString());
- }
-
- if (result != null && result.size()>=1) {
- sql = "";
- sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.ONEMEMO = '力学性能实绩未返回或未下发委托,请等实绩返回人工引用' ,t.ARTIFICIAL_MEMO='1' "
- + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'"
- + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' ";
- mapper.updateJudgeStatus(sql.toString());
- }else{
- //修改D表
- sql = "";
- sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.ONEMEMO = '没有找到相应力学性能委托' ,t.ARTIFICIAL_MEMO='0' "
- + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'"
- + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' ";
- mapper.updateJudgeStatus(sql.toString());
- }
- }
- } catch (Exception e) {
- SqlSession.rollback();
- SqlSession.close();
- }
- SqlSession.commit();
- SqlSession.close();
- }
-
- public String DoQuoteBatchNo191(HashMap parmas) throws Exception {
- SqlSession = QCM.COMMUNAL.SqlSessionBuilder.openSqlSession();
- mapper = SqlSession.getMapper(QCM.COMMUNAL.OrderSqMapper.class);
- String retnum = "0";
- try {
- String process_nos="";
- String pno1="";
- String pno2="";
- String pno3="";
- String chiStr = "";
- //判断是否按子板取样 19订单
- String chi = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D t where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' and rownum <= 1 ";
- List<HashMap> CHILists=mapper.query(chi.toString());
- if(CHILists != null && CHILists.size()>=1 ){
- process_nos=CHILists.get(0).get("PROCESS_NOS").toString();
- if(CHILists.get(0).get("FREQ_CODE").equals("C") || CHILists.get(0).get("FREQ_CODE").equals("H") || CHILists.get(0).get("FREQ_CODE").equals("I")){
- chiStr = " and t.MATERIAL_NO = '"+CHILists.get(0).get("MATERIAL_NO")+"' ";
- }
- }
- pno1=process_nos.substring(0, 1);//第一位
- pno2=process_nos.substring(3, 4);//第四位
- pno3=process_nos.substring(4, 5);//第五位
- //and nvl(t.QUOTE_MEMO ,'null') <> '引用实绩'
- String sql ="";
- sql = "select * from (select * from ("
- + " select (select count(1) from qcm_jhy_sample_consign_d_item i where i.specimen_no = t.specimen_no AND i.Phy_Code_l <> 'HJ' ) nums,t.* "
- + " from QCM_JHY_SAMPLE_CONSIGN_D t,qcm_jhy_sample_r_ord r "
- +" where t.smp_no = r.smp_no and t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"' "
- +" and t.smp_type_code = '0' and t.status = '3' and t.freq_code <> 'D' and t.CHEM_ITEM is null "
- + " and to_char(r.thick, 'fm990.099') = to_char('"+parmas.get("THICK")+"', 'fm990.099') and r.DESIGN_KEY not like '19%' "
- + chiStr
- +" and substr(t.PROCESS_NOS,0,1)='"+pno1+"' "
- +" and substr(t.PROCESS_NOS,4,1)='"+pno2+"' "
- +" and substr(t.PROCESS_NOS,5,1)='"+pno3+"' "
- + " ) t where t.nums !=0 order by t.nums desc) t where rownum=1 ";
- HashMap result = mapper.queryOne(sql.toString());
-
- if(result==null || result.size()<=0){
- sql = "select t.* from (select (select count(1) from qcm_jhy_sample_consign_d_item i where i.specimen_no = t.specimen_no AND i.Phy_Code_l <> 'HJ') nums, t.* from QCM_JHY_SAMPLE_CONSIGN_D t "
- +" where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"' "
- +" and t.smp_type_code = '0' and t.status = '3' "
- +" and t.freq_code <> 'D' and CHEM_ITEM is null "
- +" and substr(t.PROCESS_NOS,0,1)='"+pno1+"' "
- +" and substr(t.PROCESS_NOS,4,1)='"+pno2+"' "
- +" and substr(t.PROCESS_NOS,5,1)='"+pno3+"' "
- +" and rownum <= 1 order by t.send_time asc ) t where t.nums != 0";
- result=null;
- result = mapper.queryOne(sql.toString());
- }
-
- if (result != null && result.size()>=1) {
- //判断厚度是否大于引用的厚度
- sql ="";
- sql = "select To_Number(t.thick) thick from Qcm_Jhy_Sample_r_Ord t where t.SMP_NO = '"+result.get("SMP_NO")+"' and rownum <= 1 ";
- List<HashMap> OrdLists=mapper.query(sql.toString());
- if(OrdLists!=null && OrdLists.size()>=1 && !StringUtils.isBlank(OrdLists.get(0).get("THICK").toString())){
- String hmap2 = OrdLists.get(0).get("THICK").toString();
- double thick1 = Double.parseDouble(hmap2);
- String thick = parmas.get("THICK").toString();
- double thick2 = Double.parseDouble(thick);
- if(thick2>thick1){
- String str =thick2+">"+thick1;
- //修改D表
- sql = "";
- sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.ONEMEMO = '19订单委托厚度大于引用厚度不可引用:'||'"+str+"' ,t.ARTIFICIAL_MEMO='0' "
- + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'"
- + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' ";
- mapper.updateJudgeStatus(sql.toString());
- SqlSession.commit();
- SqlSession.close();
- return "厚度大于引用厚度不能引用";//被引用不能大于引用
- }
- if((thick1-thick2)>=3){
- String str =thick2+"<"+thick1;
- sql = "";
- sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.ONEMEMO = '19订单委托厚度小于引用厚度不可超过2mm,超过2mm不可引用:'||'"+str+"' ,t.ARTIFICIAL_MEMO='0' "
- + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'"
- + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' ";
- mapper.updateJudgeStatus(sql.toString());
- SqlSession.commit();
- SqlSession.close();
- return "只能引用大2mm厚度";//引用-被引用不能大于等于3 小2mm
- }
- }
- //查询被引用的所有明细
- sql ="";
- sql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' ";
- List<HashMap> qltyLists=mapper.query(sql.toString());
-
- //查询引用的所有明细
- sql ="";
- sql = "select t.* from QCM_JHY_INSP_PHYSICS t where t.specimen_no = '"+result.get("SPECIMEN_NO")+"' "
- + " and t.quote_specimen_no is null and t.val1 is not null and t.create_name <>'现场默认' ";
- List<HashMap> qltyLists2=mapper.query(sql.toString());
-
- Integer bQuote = qltyLists.size();//被引用
- Integer yQuote = qltyLists2.size();//引用
-
- int quotenum = 0;//已引用数据
- String hbB01 ="";//弯曲
- //被引用
- for (int i = 0; i < qltyLists.size(); i++) {//被引用在外层循环 对比 引用中有没有相应的项目有 插入
- //System.out.println("======="+qltyLists.get(i).get("PHY_CODE_S"));
- if("B01".equals((String) qltyLists.get(i).get("PHY_CODE_S"))){
- hbB01 ="0";
- }else{
- hbB01 ="";
- }
- //代码
- String phyCodeL = (String) qltyLists.get(i).get("PHY_CODE_L");//材质检验大项代码
- String phyCodeM = (String) qltyLists.get(i).get("PHY_CODE_M");//试样组代码
- String phyCodeS = (String) qltyLists.get(i).get("PHY_CODE_S");//材质检验项目代码
- String itemCodeD = (String) qltyLists.get(i).get("ITEM_CODE_D");//试验方向代码
- String itemCodeT = (String) qltyLists.get(i).get("ITEM_CODE_T");//试验温度代码 试验温度代码 冲击 被引用
- String itemCodeS = (String) qltyLists.get(i).get("ITEM_CODE_S");//试样尺寸代码
- //名称
- String phyNameL = (String) qltyLists.get(i).get("PHY_NAME_L");//材质检验大项代码
- String phyNameM = (String) qltyLists.get(i).get("PHY_NAME_M");//试样组代码
- String phyNameS = (String) qltyLists.get(i).get("PHY_NAME_S");//材质检验项目代码
- String itemNameD = (String) qltyLists.get(i).get("ITEM_NAME_D");//试验方向代码
- String itemNameT = (String) qltyLists.get(i).get("ITEM_NAME_T");//试验温度代码 试验温度代码 冲击 被引用
- String itemNameS = (String) qltyLists.get(i).get("ITEM_NAME_S");//试样尺寸代码
-
- String itemCodeL = (String) qltyLists.get(i).get("ITEM_CODE_L");//试验位置代码
- String itemDescL = (String) qltyLists.get(i).get("ITEM_DESC_L");
- BigDecimal seq = (BigDecimal) qltyLists.get(i).get("SEQ");
- String bigdjs = seq.toString();
- Integer bigd4 = Integer.parseInt(bigdjs);
-
- String newItem=phyCodeL+"-"+phyCodeM+"-"+phyCodeS;
- newItem=newItem+"-"+(itemCodeD!=null?itemCodeD:"null");
- newItem=newItem+"-"+(itemCodeT!=null?itemCodeT:"null");
- newItem=newItem+"-"+(itemCodeS!=null?itemCodeS:"null");
-
- //引用
- for (HashMap hashMap : qltyLists2) {
-
- //代码
- String phyCodeL2 = (String) hashMap.get("PHY_CODE_L");//材质检验大项代码
- String phyCodeM2 = (String) hashMap.get("PHY_CODE_M");//试样组代码
- String phyCodeS2 = (String) hashMap.get("PHY_CODE_S");//材质检验项目代码
- String itemCodeD2 = (String) hashMap.get("ITEM_CODE_D");//试验方向代码
- String itemCodeT2 = (String) hashMap.get("ITEM_CODE_T");//试验温度代码 试验温度代码 冲击 被引用
- String itemCodeS2 = (String) hashMap.get("ITEM_CODE_S");//试样尺寸代码
-
- String newItem2=phyCodeL2+"-"+phyCodeM2+"-"+phyCodeS2;
- newItem2=newItem2+"-"+(itemCodeD2!=null?itemCodeD2:"null");
- newItem2=newItem2+"-"+(itemCodeT2!=null?itemCodeT2:"null");
- newItem2=newItem2+"-"+(itemCodeS2!=null?itemCodeS2:"null");
-
- //判断是否是冲击试验
- if(phyCodeS.equals("C01") || phyCodeS.equals("C02")){
- if(phyCodeS.equals(phyCodeS2)){
- double co1t = Double.valueOf(itemCodeT);
- double co2t = Double.valueOf(itemCodeT2);
- //Integer co1t= Integer.parseInt(itemCodeT);//被引用
- //Integer co2t= Integer.parseInt(itemCodeT2);//引用
- if(co1t >= co2t){
- 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,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, "
- +" PHY_UNIT,MEMO) "
- +" select '"+parmas.get("SPECIMEN_NO")+"','"+bigd4+"',TEST_QTY,'"+phyCodeL+"','"+phyNameL+"','"+phyCodeM+"','"+phyNameM+"','"+phyCodeS+"','"+phyNameS+"','"+itemCodeD+"','"+itemNameD+"', "
- +" '"+itemCodeT+"','"+itemNameT+"','"+itemCodeS+"','"+itemNameS+"',VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
- +" VAL13,VAL14,VAL15,AVG_VAL,'"+parmas.get("CREATE_NAME")+"',sysdate,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,'"+itemCodeL+"','"+itemDescL+"', "
- +" PHY_UNIT,MEMO from QCM_JHY_INSP_PHYSICS t "
- + " where t.specimen_no = '"+(String)hashMap.get("SPECIMEN_NO")+"' "
- + "and t.seq = '"+hashMap.get("SEQ")+"' ";
- mapper.insert(sql);
-
- //修改ITEM表
- sql = "";
- sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t set t.QUOTE_MEMO = '已引用"+result.get("SPECIMEN_NO")+"' "
- + " where t.SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' and t.seq = '"+seq+"' ";
- mapper.updateJudgeStatus(sql.toString());
- quotenum++;
- break;
- }
- }
-
- }else{//其它试验
-
- //标准一样的引用
- if(newItem.equals(newItem2)){
-
- 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,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, "
- +" PHY_UNIT,MEMO) "
- +" select '"+parmas.get("SPECIMEN_NO")+"','"+bigd4+"',TEST_QTY,'"+phyCodeL+"','"+phyNameL+"','"+phyCodeM+"','"+phyNameM+"','"+phyCodeS+"','"+phyNameS+"','"+itemCodeD+"','"+itemNameD+"', "
- +" '"+itemCodeT+"','"+itemNameT+"','"+itemCodeS+"','"+itemNameS+"',VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
- +" VAL13,VAL14,VAL15,AVG_VAL,'"+parmas.get("CREATE_NAME")+"',sysdate,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,'"+itemCodeL+"','"+itemDescL+"', "
- +" PHY_UNIT,MEMO from QCM_JHY_INSP_PHYSICS t "
- + " where t.specimen_no = '"+(String)hashMap.get("SPECIMEN_NO")+"' "
- + "and t.seq = '"+hashMap.get("SEQ")+"' ";
- mapper.insert(sql);
-
- //修改ITEM表
- sql = "";
- sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t set t.QUOTE_MEMO = '已引用"+result.get("SPECIMEN_NO")+"' "
- + " where t.SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' and t.seq = '"+seq+"' ";
- mapper.updateJudgeStatus(sql.toString());
- quotenum++;
- if("B01".equals(phyCodeS2) && "B01".equals((String) qltyLists.get(i).get("PHY_CODE_S"))){
- hbB01="1";
- }
- break;
- }
- }
-
- }
-
- if("B01".equals((String) qltyLists.get(i).get("PHY_CODE_S"))&& !"".equals(hbB01) && hbB01.equals("0")){
- 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,AVG_VAL,CREATE_NAME,CREATE_TIME,DEFECT_FLAG,MAX_VAL, "
- +" MIN_VAL,ITEM_CODE_L,ITEM_DESC_L,PHY_UNIT,MEMO) "
- +" select t.specimen_no,t.seq,t.test_qty,t.phy_code_l,t.phy_name_l,t.phy_code_m,t.phy_name_m,t.phy_code_s,t.phy_name_s,t.item_code_d,t.item_name_d, "
- +" t.item_code_t,t.item_name_t,t.item_code_s,t.item_name_s,'合格','合格','"+parmas.get("CREATE_NAME")+"',sysdate,'0','合格','合格',t.item_code_l,t.item_desc_l, "
- +" t.phy_unit,'默认合格' "
- +" from qcm_jhy_sample_consign_d_item t "
- +" where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' "
- +" and t.phy_code_s = 'B01' ";
- mapper.insert(sql);
-
- //修改ITEM表
- sql = "";
- sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t set t.QUOTE_MEMO = '默认合格' "
- + " where t.SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' and t.phy_code_s = 'B01' ";
- mapper.updateJudgeStatus(sql.toString());
- quotenum++;
- }
-
- //申报:郭明清 主题:非计划船板改普板,冷弯需要系统默认合格 申报时间:2023-04-27 16:49:59
- //原牌号为船板 BV/IC003法国船级社,KR/IC004韩国船级社,DNV/IC001挪威船级社,CCS/IC010中国船级社 、ABS/IC005美国船级社、LR/IC009 英国船级社、NK/KA36/IC006 日本船级社、RINA/IC007 意大利船级社 、RS/IC002 俄罗斯 IC012 客户认证
- //改成普锰板(Q235A/B、Q345A/B、Q355B)
- //被引用是原牌号船板 引用是改判 普锰板
- //弯曲 默认合格
- /* if("B01".equals((String) qltyLists.get(i).get("PHY_CODE_S"))&& !"".equals(hbB01) && hbB01.equals("0")){
- sql="";
- sql="select d.* from qcm_jhy_sample_consign_d d,qcm_jhy_sample_r_ord r "
- +" where d.smp_no = r.smp_no and r.steel_code in ('Q235A','Q235B','Q345A','Q345B','Q355B') "
- +" and d.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' ";
- List<HashMap> hashMap=mapper.query(sql.toString());
- if(hashMap!=null && hashMap.size()>=1){
- sql="";
- sql="select r.* from qcm_jhy_sample_consign_d d,qcm_jhy_sample_r_ord r "
- +" where d.smp_no = r.smp_no and r.cert_inst_code in ('IC005','IC009','IC006','IC007','IC002','IC003','IC004','IC001','IC010') "
- +" and d.specimen_no = '"+result.get("SPECIMEN_NO")+"' ";
- List<HashMap> hashMap2=mapper.query(sql.toString());
-
- //船板没有弯曲
- sql="";
- sql="select * from qcm_jhy_sample_consign_d_item where specimen_no = '"+result.get("SPECIMEN_NO")+"' and phy_code_s='B01' ";
- List<HashMap> hashMap3=mapper.query(sql.toString());
- if(hashMap2!=null && hashMap2.size()>=1 && hashMap3.size()<=0 ){
- 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,AVG_VAL,CREATE_NAME,CREATE_TIME,DEFECT_FLAG,MAX_VAL, "
- +" MIN_VAL,ITEM_CODE_L,ITEM_DESC_L,PHY_UNIT,MEMO) "
- +" select t.specimen_no,t.seq,t.test_qty,t.phy_code_l,t.phy_name_l,t.phy_code_m,t.phy_name_m,t.phy_code_s,t.phy_name_s,t.item_code_d,t.item_name_d, "
- +" t.item_code_t,t.item_name_t,t.item_code_s,t.item_name_s,'合格','合格','"+parmas.get("CREATE_NAME")+"',sysdate,'0','合格','合格',t.item_code_l,t.item_desc_l, "
- +" t.phy_unit,'默认合格' "
- +" from qcm_jhy_sample_consign_d_item t "
- +" where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' "
- +" and t.phy_code_s = 'B01' ";
- mapper.insert(sql);
-
- //修改ITEM表
- sql = "";
- sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t set t.QUOTE_MEMO = '默认合格' "
- + " where t.SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' and t.phy_code_s = 'B01' ";
- mapper.updateJudgeStatus(sql.toString());
- quotenum++;
- }
- }
- }*/
- }
- //19HJGP 不自动下发
- sql="";
- sql="select r.* from qcm_jhy_sample_consign_d t,qcm_jhy_sample_r_ord r "
- + " where t.smp_no = r.smp_no and t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' and r.design_key like '19HJGP%' and rownum=1 ";
- HashMap resultHJGP = mapper.queryOne(sql.toString());
- if(resultHJGP!=null && resultHJGP.size()>=1){
- if(quotenum == qltyLists.size()){
- //修改D表
- sql = "";
- sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.STATUS = '3',t.SEND_ID = '"+parmas.get("SEND_ID")+"',"
- + " t.SEND_NAME = '"+parmas.get("CREATE_NAME")+"',t.SEND_TIME = sysdate,t.SEND_MEMO = '有引用',t.QUOTE_MEMO = '引用实绩' "
- + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'"
- + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' ";
- mapper.updateJudgeStatus(sql.toString());
-
- //往log表中插入p
- sql = "";
- sql = " INSERT INTO QCM_JUDGE_LOG ( JUDGE_TYPE,MATERIAL_NO,CREATE_TIME,CREATE_NAME,PROD_LINE) "
- +" VALUES ( 'P', '"+parmas.get("SMP_NO")+"', SYSDATE,'system','"+parmas.get("PLINE_CODE")+"')";
- mapper.insert(sql);
- retnum = "1";
- }else if(quotenum==0){
- sql = "";
- sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.ONEMEMO = '未找到一项可以引用的项目,订单标准全部不一样' ,t.ARTIFICIAL_MEMO='0' "
- + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'"
- + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' ";
- mapper.updateJudgeStatus(sql.toString());
- }else{
- //修改D表
- sql = "";
- sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.SEND_MEMO = '有引用',t.QUOTE_MEMO = '引用实绩', t.ARTIFICIAL_MEMO='0', "
- + " t.ONEMEMO ='需下发委托' "
- + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'"
- + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' ";
- mapper.updateJudgeStatus(sql.toString());
- }
- }else{
- //被引用的项目 全部 已引用
- if(quotenum!=0){
- //修改D表
- sql = "";
- sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.STATUS = '3',t.SEND_ID = '"+parmas.get("SEND_ID")+"',"
- + " t.SEND_NAME = '"+parmas.get("CREATE_NAME")+"',t.SEND_TIME = sysdate,t.SEND_MEMO = '有引用',t.QUOTE_MEMO = '引用实绩' "
- + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'"
- + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' ";
- mapper.updateJudgeStatus(sql.toString());
-
- //往log表中插入p
- sql = "";
- sql = " INSERT INTO QCM_JUDGE_LOG ( JUDGE_TYPE,MATERIAL_NO,CREATE_TIME,CREATE_NAME,PROD_LINE) "
- +" VALUES ( 'P', '"+parmas.get("SMP_NO")+"', SYSDATE,'system','"+parmas.get("PLINE_CODE")+"')";
- mapper.insert(sql);
- retnum = "1";
- }else if(quotenum==0){
- sql = "";
- sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.ONEMEMO = '未找到一项可以引用的项目,订单标准全部不一样' ,t.ARTIFICIAL_MEMO='0' "
- + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'"
- + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' ";
- mapper.updateJudgeStatus(sql.toString());
- }
- }
- }else{
- sql="";
- sql = "select * from (select * from ("
- + " select (select count(1) from qcm_jhy_sample_consign_d_item i where i.specimen_no = t.specimen_no) nums,t.* "
- + " from QCM_JHY_SAMPLE_CONSIGN_D t,qcm_jhy_sample_r_ord r "
- +" where t.smp_no = r.smp_no and t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"' "
- +" and t.smp_type_code = '0' and t.status in('0','2','7') "
- +" and t.freq_code <> 'D' and t.CHEM_ITEM is null and to_char(r.thick, 'fm990.099') = to_char('"+parmas.get("THICK")+"', 'fm990.099') "
- +" and r.DESIGN_KEY not like '19%' "
- +" and substr(t.PROCESS_NOS,0,1)='"+pno1+"' "
- +" and substr(t.PROCESS_NOS,4,1)='"+pno2+"' "
- +" and substr(t.PROCESS_NOS,5,1)='"+pno3+"' "
- +") t order by t.nums desc) t where rownum=1 ";
- result=null;
- result = mapper.queryOne(sql.toString());
-
- if(result==null || result.size()<=0){
- sql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D t,qcm_jhy_sample_r_ord r "
- +" where t.smp_no = r.smp_no and t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"' "
- +" and t.smp_type_code = '0' and t.status in('0','2','7') "
- +" and t.freq_code <> 'D' and r.DESIGN_KEY not like '19%' and CHEM_ITEM is null "
- +" and substr(t.PROCESS_NOS,0,1)='"+pno1+"' "
- +" and substr(t.PROCESS_NOS,4,1)='"+pno2+"' "
- +" and substr(t.PROCESS_NOS,5,1)='"+pno3+"' "
- +" and rownum <= 1 order by t.send_time asc ";
- result=null;
- result = mapper.queryOne(sql.toString());
- }
-
- if (result != null && result.size()>=1) {
- sql = "";
- sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.ONEMEMO = '力学性能实绩未返回或未下发委托,请等实绩返回人工引用' ,t.ARTIFICIAL_MEMO='1' "
- + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'"
- + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' ";
- mapper.updateJudgeStatus(sql.toString());
- }else{
- //修改D表
- sql = "";
- sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.ONEMEMO = '没有找到相应力学性能委托' ,t.ARTIFICIAL_MEMO='0' "
- + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'"
- + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' ";
- mapper.updateJudgeStatus(sql.toString());
- }
- }
- } catch (Exception e) {
- SqlSession.rollback();
- SqlSession.close();
- }
- SqlSession.commit();
- SqlSession.close();
- return retnum;
- }
-
- /**
- * 复样引用
- * @param materialInfo
- * @return
- * @throws Exception
- */
- public String DoQuoteBatchNoFy(HashMap parmas) throws Exception {
- String retnum = "0";
- try {
- String StrSpecimenNO="";
- TreeSet<String> treeSet = new TreeSet<String>();//取样编号
- String fysql=" select t.* from QCM_JHY_SAMPLE_CONSIGN_D t where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"' "
- + " and t.smp_type_code = '1' and t.status = '3' and nvl(t.QUOTE_MEMO, 'null') <> '引用实绩' and t.freq_code <> 'D' and t.CHEM_ITEM is null ";
- List<HashMap> hmfy=mapper.query(fysql.toString());
- if(hmfy!=null && hmfy.size()>=1){
- for (HashMap hashMap : hmfy) {
- fysql="";
- fysql="select * from qcm_jhy_sample_consign_d_item t where t.quote_memo like '%"+hashMap.get("SPECIMEN_NO")+"'";
- List<HashMap> hmfy2=mapper.query(fysql.toString());
- if(hmfy2==null || hmfy2.size()<=0){
- treeSet.add((String)hashMap.get("SPECIMEN_NO"));
- }
- }
- }
-
- String sql="";
- if(treeSet.size()>=1){
- sql="select * from qcm_jhy_sample_consign_d t where t.specimen_no = '"+treeSet.first()+"' and rownum=1";
- }else{
- sql = "select * from (select * from (select (select count(1) from qcm_jhy_sample_consign_d_item i where i.specimen_no = t.specimen_no) nums, t.* "
- + " from QCM_JHY_SAMPLE_CONSIGN_D t "
- +" where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"' "
- +" and t.smp_type_code = '1' and t.status = '3' and nvl(t.QUOTE_MEMO ,'null') <> '引用实绩' "
- + " and t.freq_code <> 'D' and t.CHEM_ITEM is null ) t order by t.nums desc) t where rownum=1 ";
- }
- HashMap result = mapper.queryOne(sql.toString());
- if (result != null && result.size()>=1) {
-
- //查询引用的所有明细
- sql ="";
- sql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' and seq<=49 ";
- List<HashMap> qltyLists=mapper.query(sql.toString());
-
- //查询被引用的所有明细
- sql ="";
- sql = "select t.* from QCM_JHY_INSP_PHYSICS t where t.specimen_no = '"+result.get("SPECIMEN_NO")+"' and t.quote_specimen_no is null and seq<=49 ";
- List<HashMap> qltyLists2=mapper.query(sql.toString());
-
- Integer bQuote = qltyLists.size();//引用
- Integer yQuote = qltyLists2.size();//被引用
- int quotenum = 0;//已引用数据
- //被引用
- for (int i = 0; i < qltyLists.size(); i++) {//被引用在外层循环 对比 引用中有没有相应的项目有 插入
-
- //代码
- String phyCodeL = (String) qltyLists.get(i).get("PHY_CODE_L");//材质检验大项代码
- String phyCodeM = (String) qltyLists.get(i).get("PHY_CODE_M");//试样组代码
- String phyCodeS = (String) qltyLists.get(i).get("PHY_CODE_S");//材质检验项目代码
- String itemCodeD = (String) qltyLists.get(i).get("ITEM_CODE_D");//试验方向代码
- String itemCodeT = (String) qltyLists.get(i).get("ITEM_CODE_T");//试验温度代码 试验温度代码 冲击 被引用
- String itemCodeS = (String) qltyLists.get(i).get("ITEM_CODE_S");//试样尺寸代码
- //名称
- String phyNameL = (String) qltyLists.get(i).get("PHY_NAME_L");//材质检验大项代码
- String phyNameM = (String) qltyLists.get(i).get("PHY_NAME_M");//试样组代码
- String phyNameS = (String) qltyLists.get(i).get("PHY_NAME_S");//材质检验项目代码
- String itemNameD = (String) qltyLists.get(i).get("ITEM_NAME_D");//试验方向代码
- String itemNameT = (String) qltyLists.get(i).get("ITEM_NAME_T");//试验温度代码 试验温度代码 冲击 被引用
- String itemNameS = (String) qltyLists.get(i).get("ITEM_NAME_S");//试样尺寸代码
-
- String itemCodeL = (String) qltyLists.get(i).get("ITEM_CODE_L");//试验位置代码
- String itemDescL = (String) qltyLists.get(i).get("ITEM_DESC_L");
- BigDecimal seq = (BigDecimal) qltyLists.get(i).get("SEQ");
- String bigdjs = seq.toString();
- Integer bigd4 = Integer.parseInt(bigdjs);
-
- String newItem=phyCodeL+"-"+phyCodeM+"-"+phyCodeS;
- newItem=newItem+"-"+(itemCodeD!=null?itemCodeD:"null");
- newItem=newItem+"-"+(itemCodeT!=null?itemCodeT:"null");
- newItem=newItem+"-"+(itemCodeS!=null?itemCodeS:"null");
- //newItem=newItem+"-"+(itemCodeL!=null?itemCodeL:"null");
-
- //引用
- for (HashMap hashMap : qltyLists2) {
-
- //代码
- String phyCodeL2 = (String) hashMap.get("PHY_CODE_L");//材质检验大项代码
- String phyCodeM2 = (String) hashMap.get("PHY_CODE_M");//试样组代码
- String phyCodeS2 = (String) hashMap.get("PHY_CODE_S");//材质检验项目代码
- String itemCodeD2 = (String) hashMap.get("ITEM_CODE_D");//试验方向代码
- String itemCodeT2 = (String) hashMap.get("ITEM_CODE_T");//试验温度代码 试验温度代码 冲击 被引用
- String itemCodeS2 = (String) hashMap.get("ITEM_CODE_S");//试样尺寸代码
- String itemCodeL2 = (String) hashMap.get("ITEM_CODE_L");//试验位置代码
-
- String newItem2=phyCodeL2+"-"+phyCodeM2+"-"+phyCodeS2;
- newItem2=newItem2+"-"+(itemCodeD2!=null?itemCodeD2:"null");
- newItem2=newItem2+"-"+(itemCodeT2!=null?itemCodeT2:"null");
- newItem2=newItem2+"-"+(itemCodeS2!=null?itemCodeS2:"null");
- //newItem2=newItem2+"-"+(itemCodeL2!=null?itemCodeL2:"null");
-
- //判断是否是冲击试验
- if(phyCodeS.equals("C01") || phyCodeS.equals("C02")){
- if(phyCodeS.equals(phyCodeS2)){
- Integer co1t= Integer.parseInt(itemCodeT);//被引用
- Integer co2t= Integer.parseInt(itemCodeT2);//引用
- if(co1t >= co2t){
- 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,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, "
- +" PHY_UNIT,MEMO) "
- +" select '"+parmas.get("SPECIMEN_NO")+"','"+bigd4+"',TEST_QTY,'"+phyCodeL+"','"+phyNameL+"','"+phyCodeM+"','"+phyNameM+"','"+phyCodeS+"','"+phyNameS+"','"+itemCodeD+"','"+itemNameD+"', "
- +" '"+itemCodeT+"','"+itemNameT+"','"+itemCodeS+"','"+itemNameS+"',VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
- +" VAL13,VAL14,VAL15,AVG_VAL,'"+parmas.get("CREATE_NAME")+"',sysdate,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,'"+itemCodeL+"','"+itemDescL+"', "
- +" PHY_UNIT,MEMO from QCM_JHY_INSP_PHYSICS t "
- + " where t.specimen_no = '"+(String)hashMap.get("SPECIMEN_NO")+"' "
- + "and t.seq = '"+hashMap.get("SEQ")+"' ";
- mapper.insert(sql);
-
- //修改ITEM表
- sql = "";
- sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t set t.QUOTE_MEMO = '已引用"+result.get("SPECIMEN_NO")+"' "
- + " where t.SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' and t.seq = '"+seq+"' ";
- mapper.updateJudgeStatus(sql.toString());
- quotenum++;
- break;
- }
- }
-
- }else{//其它试验
-
- //标准一样的引用
- if(newItem.equals(newItem2)){
-
- 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,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, "
- +" PHY_UNIT,MEMO) "
- +" select '"+parmas.get("SPECIMEN_NO")+"','"+bigd4+"',TEST_QTY,'"+phyCodeL+"','"+phyNameL+"','"+phyCodeM+"','"+phyNameM+"','"+phyCodeS+"','"+phyNameS+"','"+itemCodeD+"','"+itemNameD+"', "
- +" '"+itemCodeT+"','"+itemNameT+"','"+itemCodeS+"','"+itemNameS+"',VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
- +" VAL13,VAL14,VAL15,AVG_VAL,'"+parmas.get("CREATE_NAME")+"',sysdate,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,'"+itemCodeL+"','"+itemDescL+"', "
- +" PHY_UNIT,MEMO from QCM_JHY_INSP_PHYSICS t "
- + " where t.specimen_no = '"+(String)hashMap.get("SPECIMEN_NO")+"' "
- + "and t.seq = '"+hashMap.get("SEQ")+"' ";
- mapper.insert(sql);
-
- //修改ITEM表
- sql = "";
- sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t set t.QUOTE_MEMO = '已引用"+result.get("SPECIMEN_NO")+"' "
- + " where t.SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' and t.seq = '"+seq+"' ";
- mapper.updateJudgeStatus(sql.toString());
- quotenum++;
- break;
- }
-
- }
-
-
-
-
-
-
- }
- }
- //被引用的项目 全部 已引用
- if(quotenum == qltyLists.size()){
- //修改D表
- sql = "";
- sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.STATUS = '3',t.SEND_ID = '"+parmas.get("SEND_ID")+"',"
- + " t.SEND_NAME = '"+parmas.get("CREATE_NAME")+"',t.SEND_TIME = sysdate,t.SEND_MEMO = '有引用',t.QUOTE_MEMO = '引用实绩' "
- + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'"
- + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' ";
- mapper.updateJudgeStatus(sql.toString());
-
- //往log表中插入p
- sql = "";
- sql = " INSERT INTO QCM_JUDGE_LOG ( JUDGE_TYPE,MATERIAL_NO,CREATE_TIME,CREATE_NAME,PROD_LINE) "
- +" VALUES ( 'Q', '"+parmas.get("SMP_NO")+"', SYSDATE,'system','"+parmas.get("PLINE_CODE")+"')";
- mapper.insert(sql);
- retnum="1";
- }else{
- //修改D表
- sql = "";
- sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.SEND_MEMO = '有引用',t.QUOTE_MEMO = '引用实绩' "
- + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'"
- + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' ";
- mapper.updateJudgeStatus(sql.toString());
- }
-
-
-
- }else{
- SqlSession.close();
- return "该轧批未返回实绩或没有引用的对象!请在委托记录中核实相应委托数据";
- }
- } catch (Exception e) {
- SqlSession.rollback();
- SqlSession.close();
- return "引用失败!";
- }
- SqlSession.commit();
-
- doPhyItem(parmas.get("SPECIMEN_NO").toString());
-
- SqlSession.close();
- return retnum;
- }
-
- /**
- * 39 49 59订单自动引用 不同订单 同轧批号 项目一样引用
- * @param materialInfo
- * @return
- * @throws Exception
- */
- public void DoQuoteRZLT(HashMap parmas) throws Exception {
- SqlSession = QCM.COMMUNAL.SqlSessionBuilder.openSqlSession();
- mapper = SqlSession.getMapper(QCM.COMMUNAL.OrderSqMapper.class);
- try {
- if(parmas.get("CREATE_NAME").equals("调试人员")){
- parmas.put("SEND_ID", "系统自动");
- parmas.put("CREATE_NAME", "系统自动");
- }
- //and t.freq_code <> 'D'
- String sql ="";
- sql = "select * from (select * from ("
- + " select (select count(1) from qcm_jhy_sample_consign_d_item i where i.specimen_no = t.specimen_no) nums,t.* "
- + " from QCM_JHY_SAMPLE_CONSIGN_D t,qcm_jhy_sample_r_ord r "
- +" where t.smp_no = r.smp_no and t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"' "
- +" and t.smp_type_code = '0' and t.status = '3' and nvl(t.QUOTE_MEMO ,'null') <> '引用实绩' "
- + " and t.CHEM_ITEM is null and to_char(r.thick, 'fm990.099') = to_char('"+parmas.get("THICK")+"', 'fm990.099') "
- + " and r.DESIGN_KEY not like '39%' and r.DESIGN_KEY not like '49%' and r.DESIGN_KEY not like '59%' "
- + " ) t order by t.nums desc) t where rownum=1 ";
- HashMap result = mapper.queryOne(sql.toString());
- //and t.freq_code <> 'D'
- if(result==null || result.size()<=0){
- sql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D t "
- +" where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"' "
- +" and t.smp_type_code = '0' and t.status = '3' and nvl(t.QUOTE_MEMO ,'null') <> '引用实绩' "
- + " and CHEM_ITEM is null and rownum <= 1 order by t.send_time asc ";
- result=null;
- result = mapper.queryOne(sql.toString());
- }
-
- if (result != null && result.size()>=1) {
- //查询引用的所有明细是不是只有拉伸 横向可以替代纵向
- //当卷板存在横向试验时,且只有一组拉伸试样时,改判后需要纵向实验数据,可以直接用横向替代纵向。
- //热轧:改判,只有一组拉伸试样时并且方向是(纵向)时,横向可以替代纵向,直接把横向的值引用到纵向上
- //连退:改判,只有一组拉伸试样时并且方向是(纵向)时,横向可以替代纵向,直接把横向的值引用到纵向上,但是断后伸长率(横向A50 套纵向A50 )、(横向A80 套纵向A80 )
- //连退改判:断后伸长率:A50转成A80需要将A50的值乘以0.829; A80转成A50需要乘以1.207
- //主题:卷板改判规则维护01 申报人员:夏鹏 申报时间:2023-05-04 15:19:01
- String HAStr="";
- sql ="";
- sql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' and t.PHY_CODE_L <>'HA' ";
- List<HashMap> qltyListsHA=mapper.query(sql.toString());
- if(qltyListsHA==null || qltyListsHA.size()<=0){
- HAStr="HA";//只有拉伸
- }
- //查询引用的所有明细
- sql ="";
- sql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' ";
- List<HashMap> qltyLists=mapper.query(sql.toString());
-
- //查询被引用的所有明细
- sql ="";
- sql = "select t.* from QCM_JHY_INSP_PHYSICS t where t.specimen_no = '"+result.get("SPECIMEN_NO")+"' and t.quote_specimen_no is null and t.VAL1 is not null ";
- List<HashMap> qltyLists2=mapper.query(sql.toString());
-
- Integer bQuote = qltyLists.size();//引用
- Integer yQuote = qltyLists2.size();//被引用
-
- int quotenum = 0;//已引用数据
- //引用
- for (int i = 0; i < qltyLists.size(); i++) {//被引用在外层循环 对比 引用中有没有相应的项目有 插入
-
- //代码
- String phyCodeL = (String) qltyLists.get(i).get("PHY_CODE_L");//材质检验大项代码
- String phyCodeM = (String) qltyLists.get(i).get("PHY_CODE_M");//试样组代码
- String phyCodeS = (String) qltyLists.get(i).get("PHY_CODE_S");//材质检验项目代码
- String itemCodeD = (String) qltyLists.get(i).get("ITEM_CODE_D");//试验方向代码
- String itemCodeT = (String) qltyLists.get(i).get("ITEM_CODE_T");//试验温度代码 试验温度代码 冲击 被引用
- String itemCodeS = (String) qltyLists.get(i).get("ITEM_CODE_S");//试样尺寸代码
- //名称
- String phyNameL = (String) qltyLists.get(i).get("PHY_NAME_L");//材质检验大项代码
- String phyNameM = (String) qltyLists.get(i).get("PHY_NAME_M");//试样组代码
- String phyNameS = (String) qltyLists.get(i).get("PHY_NAME_S");//材质检验项目代码
- String itemNameD = (String) qltyLists.get(i).get("ITEM_NAME_D");//试验方向代码
- String itemNameT = (String) qltyLists.get(i).get("ITEM_NAME_T");//试验温度代码 试验温度代码 冲击 被引用
- String itemNameS = (String) qltyLists.get(i).get("ITEM_NAME_S");//试样尺寸代码
-
- String itemCodeL = (String) qltyLists.get(i).get("ITEM_CODE_L");//试验位置代码
- String itemDescL = (String) qltyLists.get(i).get("ITEM_DESC_L");
- BigDecimal seq = (BigDecimal) qltyLists.get(i).get("SEQ");
- String bigdjs = seq.toString();
- Integer bigd4 = Integer.parseInt(bigdjs);
-
- //横向替代纵向 只有拉伸并且引用是纵向B 横向A 被引用不管是横向还是纵向都能把值给到引用上面
- //连退改判:(断后伸长率)A50转成A80需要将A50的值乘以0.829; A80转成A50需要乘以1.207
- String EAFStr="";
- String PhyUnit="";//值单位
- if(!"".equals(HAStr) && HAStr.equals("HA") && itemCodeD.equals("B")){
- itemCodeD="B";
- //断后伸长率 && qltyLists.get(i).get("SPECIMEN_NO").toString().contains("LT1")
- if(phyCodeS.equals("A06")){
- PhyUnit=(String) qltyLists.get(i).get("PHY_UNIT");
- }
- }else if(!"".equals(HAStr) && HAStr.equals("HA") && itemCodeD.equals("A") && phyCodeS.equals("A06")){
- PhyUnit=(String) qltyLists.get(i).get("PHY_UNIT");
- }
-
- String newItem=phyCodeL+"-"+phyCodeM+"-"+phyCodeS;
- if(phyCodeL.equals("HV") && qltyLists.get(i).get("SPECIMEN_NO").toString().contains("LT1")){
- //连退 粗糙度 试验方向 不参于判断
- newItem=newItem+"-"+"null";
- }else{
- newItem=newItem+"-"+(itemCodeD!=null?itemCodeD:"null");
- }
- newItem=newItem+"-"+(itemCodeT!=null?itemCodeT:"null");
- newItem=newItem+"-"+(itemCodeS!=null?itemCodeS:"null");
-
- if(!"".equals(HAStr) && HAStr.equals("HA") && itemCodeD.equals("B")){
- //断后伸长率 要加上值单位去判 && qltyLists.get(i).get("SPECIMEN_NO").toString().contains("LT1")
- if(phyCodeS.equals("A06")){
- newItem=newItem+"-"+(PhyUnit!=null?PhyUnit:"null");
- }
- }else if(!"".equals(HAStr) && HAStr.equals("HA") && itemCodeD.equals("A") && phyCodeS.equals("A06")){
- newItem=newItem+"-"+(PhyUnit!=null?PhyUnit:"null");
- }
-
- //被引用
- for (HashMap hashMap : qltyLists2) {
-
- //代码
- String phyCodeL2 = (String) hashMap.get("PHY_CODE_L");//材质检验大项代码
- String phyCodeM2 = (String) hashMap.get("PHY_CODE_M");//试样组代码
- String phyCodeS2 = (String) hashMap.get("PHY_CODE_S");//材质检验项目代码
- String itemCodeD2 = (String) hashMap.get("ITEM_CODE_D");//试验方向代码
- String itemCodeT2 = (String) hashMap.get("ITEM_CODE_T");//试验温度代码 试验温度代码 冲击 被引用
- String itemCodeS2 = (String) hashMap.get("ITEM_CODE_S");//试样尺寸代码
-
- String PhyUnit2="";
- //横向替代纵向 只有拉伸并且引用是纵向B 被引用不管是横向还是纵向都能把值给到引用上面
- if(!"".equals(HAStr) && HAStr.equals("HA") && itemCodeD.equals("B")){
- itemCodeD2="B";//被引用 不管是横向还是纵向都能把值给到引用上
- //断后伸长率 && hashMap.get("SPECIMEN_NO").toString().contains("LT1")
- if(phyCodeS2.equals("A06")){
- sql ="";
- sql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D_ITEM t "
- + " where t.specimen_no = '"+hashMap.get("SPECIMEN_NO")+"' and t.PHY_CODE_S='A06' AND t.seq<=49 ";
- List<HashMap> qltyListsA=mapper.query(sql.toString());
- PhyUnit2=(String) qltyListsA.get(0).get("PHY_UNIT");
- }
- }else if(!"".equals(HAStr) && HAStr.equals("HA") && itemCodeD.equals("A") && phyCodeS.equals("A06") && itemCodeD2.equals("A") && phyCodeS2.equals("A06")){
- sql ="";
- sql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D_ITEM t "
- + " where t.specimen_no = '"+hashMap.get("SPECIMEN_NO")+"' and t.PHY_CODE_S='A06' AND t.seq<=49 ";
- List<HashMap> qltyListsA=mapper.query(sql.toString());
- PhyUnit2=(String) qltyListsA.get(0).get("PHY_UNIT");
- }
-
- String newItem2=phyCodeL2+"-"+phyCodeM2+"-"+phyCodeS2;
- if(phyCodeL2.equals("HV") && hashMap.get("SPECIMEN_NO").toString().contains("LT1")){
- //连退 粗糙度 试验方向 不参于判断
- newItem2=newItem2+"-"+"null";
- }else{
- newItem2=newItem2+"-"+(itemCodeD2!=null?itemCodeD2:"null");
- }
- newItem2=newItem2+"-"+(itemCodeT2!=null?itemCodeT2:"null");
- newItem2=newItem2+"-"+(itemCodeS2!=null?itemCodeS2:"null");
-
- if(!"".equals(HAStr) && HAStr.equals("HA") && itemCodeD.equals("B")){
- //断后伸长率 && hashMap.get("SPECIMEN_NO").toString().contains("LT1")
- if(phyCodeS2.equals("A06")){
- newItem2=newItem2+"-"+(PhyUnit2!=null?PhyUnit2:"null");
- }
- }else if(!"".equals(HAStr) && HAStr.equals("HA") && itemCodeD.equals("A") && phyCodeS.equals("A06") && itemCodeD2.equals("A") && phyCodeS2.equals("A06")){
- newItem2=newItem2+"-"+(PhyUnit2!=null?PhyUnit2:"null");
- }
-
- //判断是否是冲击试验
- if(phyCodeS.equals("C01") || phyCodeS.equals("C02")){
- if(phyCodeS.equals(phyCodeS2)){
- Integer co1t= Integer.parseInt(itemCodeT);//被引用
- Integer co2t= Integer.parseInt(itemCodeT2);//引用
- if(co1t >= co2t){
- 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,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, "
- +" PHY_UNIT,MEMO) "
- +" select '"+parmas.get("SPECIMEN_NO")+"','"+bigd4+"',TEST_QTY,'"+phyCodeL+"','"+phyNameL+"','"+phyCodeM+"','"+phyNameM+"','"+phyCodeS+"','"+phyNameS+"','"+itemCodeD+"','"+itemNameD+"', "
- +" '"+itemCodeT+"','"+itemNameT+"','"+itemCodeS+"','"+itemNameS+"',VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
- +" VAL13,VAL14,VAL15,AVG_VAL,'"+parmas.get("CREATE_NAME")+"',sysdate,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,'"+itemCodeL+"','"+itemDescL+"', "
- +" PHY_UNIT,MEMO from QCM_JHY_INSP_PHYSICS t "
- + " where t.specimen_no = '"+(String)hashMap.get("SPECIMEN_NO")+"' "
- + "and t.seq = '"+hashMap.get("SEQ")+"' ";
- mapper.insert(sql);
-
- //修改ITEM表
- sql = "";
- sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t set t.QUOTE_MEMO = '已引用"+result.get("SPECIMEN_NO")+"' "
- + " where t.SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' and t.seq = '"+seq+"' ";
- mapper.updateJudgeStatus(sql.toString());
- quotenum++;
- break;
- }
- }
-
- }else{//其它试验
-
- //标准一样的引用
- if(newItem.equals(newItem2)){
-
- 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,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, "
- +" PHY_UNIT,MEMO) "
- +" select '"+parmas.get("SPECIMEN_NO")+"','"+bigd4+"',TEST_QTY,'"+phyCodeL+"','"+phyNameL+"','"+phyCodeM+"','"+phyNameM+"','"+phyCodeS+"','"+phyNameS+"','"+itemCodeD+"','"+itemNameD+"', "
- +" '"+itemCodeT+"','"+itemNameT+"','"+itemCodeS+"','"+itemNameS+"',VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
- +" VAL13,VAL14,VAL15,AVG_VAL,'"+parmas.get("CREATE_NAME")+"',sysdate,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,'"+itemCodeL+"','"+itemDescL+"', "
- +" PHY_UNIT,MEMO from QCM_JHY_INSP_PHYSICS t "
- + " where t.specimen_no = '"+(String)hashMap.get("SPECIMEN_NO")+"' "
- + "and t.seq = '"+hashMap.get("SEQ")+"' ";
- mapper.insert(sql);
-
- //修改ITEM表
- sql = "";
- sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t set t.QUOTE_MEMO = '已引用"+result.get("SPECIMEN_NO")+"' "
- + " where t.SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' and t.seq = '"+seq+"' ";
- mapper.updateJudgeStatus(sql.toString());
- quotenum++;
- break;
-
- }else if(phyCodeS.equals("A06") && phyCodeS2.equals("A06") && HAStr.equals("HA")
- && (itemCodeD.equals("B") || (itemCodeD.equals("A") && itemCodeD2.equals("A")) )){
- //判断当前值单位是50mm 80mm
- if("50mm".equals(PhyUnit)){
- if("80mm".equals(PhyUnit2)){
- //A50=A80*1.207
- 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,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, "
- +" PHY_UNIT,MEMO) "
- +" select '"+parmas.get("SPECIMEN_NO")+"','"+bigd4+"',TEST_QTY,'"+phyCodeL+"','"+phyNameL+"','"+phyCodeM+"','"+phyNameM+"','"+phyCodeS+"','"+phyNameS+"','"+itemCodeD+"','"+itemNameD+"', "
- +" '"+itemCodeT+"','"+itemNameT+"','"+itemCodeS+"','"+itemNameS+"',JHY02.ROUDN_MATH_JGXY((val1*1.207), 0.5),JHY02.ROUDN_MATH_JGXY((val2*1.207), 0.5),JHY02.ROUDN_MATH_JGXY((val3*1.207), 0.5),"
- +" VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, VAL13,VAL14,VAL15,JHY02.ROUDN_MATH_JGXY((avg_val*1.207), 0.5),'"+parmas.get("CREATE_NAME")+"',sysdate,GROUP_SEQ,DEFECT_FLAG,"
- +" JHY02.ROUDN_MATH_JGXY((max_val*1.207), 0.5),JHY02.ROUDN_MATH_JGXY((min_val*1.207), 0.5),'"+itemCodeL+"','"+itemDescL+"', "
- +" PHY_UNIT,MEMO from QCM_JHY_INSP_PHYSICS t "
- + " where t.specimen_no = '"+(String)hashMap.get("SPECIMEN_NO")+"' "
- + "and t.seq = '"+hashMap.get("SEQ")+"' ";
- mapper.insert(sql);
- }
- }
- else if("80mm".equals(PhyUnit)){
- if("50mm".equals(PhyUnit2)){
- //A80=A50*0.829
- 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,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, "
- +" PHY_UNIT,MEMO) "
- +" select '"+parmas.get("SPECIMEN_NO")+"','"+bigd4+"',TEST_QTY,'"+phyCodeL+"','"+phyNameL+"','"+phyCodeM+"','"+phyNameM+"','"+phyCodeS+"','"+phyNameS+"','"+itemCodeD+"','"+itemNameD+"', "
- +" '"+itemCodeT+"','"+itemNameT+"','"+itemCodeS+"','"+itemNameS+"',JHY02.ROUDN_MATH_JGXY((val1*0.829), 0.5),JHY02.ROUDN_MATH_JGXY((val2*0.829), 0.5),JHY02.ROUDN_MATH_JGXY((val3*0.829), 0.5),"
- +" VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12,VAL13,VAL14,VAL15,JHY02.ROUDN_MATH_JGXY((avg_val*0.829), 0.5),'"+parmas.get("CREATE_NAME")+"',sysdate,GROUP_SEQ,DEFECT_FLAG,"
- +" JHY02.ROUDN_MATH_JGXY((max_val*0.829), 0.5),JHY02.ROUDN_MATH_JGXY((min_val*0.829), 0.5),'"+itemCodeL+"','"+itemDescL+"', "
- +" PHY_UNIT,MEMO from QCM_JHY_INSP_PHYSICS t "
- + " where t.specimen_no = '"+(String)hashMap.get("SPECIMEN_NO")+"' "
- + "and t.seq = '"+hashMap.get("SEQ")+"' ";
- mapper.insert(sql);
- }
- }
- //修改ITEM表
- sql = "";
- sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t set t.QUOTE_MEMO = '已引用"+result.get("SPECIMEN_NO")+"' "
- + " where t.SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' and t.seq = '"+seq+"' ";
- mapper.updateJudgeStatus(sql.toString());
- quotenum++;
- break;
- }
- }
-
- }
- }
- String ABATCHLOG = "";
- String sqlrz="select t.COIL_NO,t.ABATCHLOG from qcm_judge_coil_result t where t.COIL_NO in ( "
- +" select d.material_no from qcm_jhy_sample_consign_d d where d.specimen_no = '"+parmas.get("SPECIMEN_NO")+"') "
- +" and t.abatchlog is not null and rownum=1 ";
- HashMap resultrz = mapper.queryOne(sqlrz.toString());
- if(resultrz!=null && resultrz.size()>=1){
- ABATCHLOG = resultrz.get("ABATCHLOG").toString();
- }
- //被引用的项目 全部 已引用
- if(quotenum==bQuote){
- //修改D表
- sql = "";
- sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.STATUS = '3',t.SEND_ID = '"+parmas.get("SEND_ID")+"',t.IMPROVE_MEMO= '"+ABATCHLOG+"' , "
- + " t.SEND_NAME = '"+parmas.get("CREATE_NAME")+"',t.SEND_TIME = sysdate,t.SEND_MEMO = '有引用',t.QUOTE_MEMO = '引用实绩' "
- + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'"
- + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' ";
- mapper.updateJudgeStatus(sql.toString());
-
- //往log表中插入p
- sql = "";
- sql = " INSERT INTO QCM_JUDGE_LOG ( JUDGE_TYPE,MATERIAL_NO,CREATE_TIME,CREATE_NAME,PROD_LINE) "
- +" VALUES ( 'P', '"+parmas.get("SMP_NO")+"', SYSDATE,'system','"+parmas.get("PLINE_CODE")+"')";
- mapper.insert(sql);
- }else{
- //修改D表
- sql = "";
- sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.SEND_MEMO = '有引用',t.QUOTE_MEMO = '引用实绩',t.IMPROVE_MEMO= '"+ABATCHLOG+"' "
- + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'"
- + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' ";
- mapper.updateJudgeStatus(sql.toString());
- }
-
- }else{
- sql="";
- sql = "select * from (select * from ("
- + " select (select count(1) from qcm_jhy_sample_consign_d_item i where i.specimen_no = t.specimen_no) nums,t.* "
- + " from QCM_JHY_SAMPLE_CONSIGN_D t,qcm_jhy_sample_r_ord r "
- +" where t.smp_no = r.smp_no and t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"' "
- +" and t.smp_type_code = '0' and t.status in('0','2','7') and nvl(t.QUOTE_MEMO ,'null') <> '引用实绩' "
- + " and t.freq_code <> 'D' and t.CHEM_ITEM is null and to_char(r.thick, 'fm990.099') = to_char('"+parmas.get("THICK")+"', 'fm990.099') "
- + " and r.DESIGN_KEY not like '39%' and r.DESIGN_KEY not like '49%' and r.DESIGN_KEY not like '59%' "
- + " ) t order by t.nums desc) t where rownum=1 ";
- result=null;
- result = mapper.queryOne(sql.toString());
-
- if(result==null || result.size()<=0){
- sql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D t,qcm_jhy_sample_r_ord r "
- +" where t.smp_no = r.smp_no and t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"' "
- +" and t.smp_type_code = '0' and t.status in('0','2','7') and nvl(t.QUOTE_MEMO ,'null') <> '引用实绩' "
- + " and t.freq_code <> 'D' "
- + " and r.DESIGN_KEY not like '39%' and r.DESIGN_KEY not like '49%' and r.DESIGN_KEY not like '59%' "
- + " and CHEM_ITEM is null and rownum <= 1 order by t.send_time asc ";
- result=null;
- result = mapper.queryOne(sql.toString());
- }
-
- if (result != null && result.size()>=1) {
- sql = "";
- sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.ONEMEMO = '力学性能实绩未返回或未下发委托,请等实绩返回人工引用',t.ARTIFICIAL_MEMO='1' "
- + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'"
- + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' ";
- mapper.updateJudgeStatus(sql.toString());
- }else{
- //修改D表
- sql = "";
- sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.ONEMEMO = '没有找到相应力学性能委托' ,t.ARTIFICIAL_MEMO='0' "
- + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'"
- + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' ";
- mapper.updateJudgeStatus(sql.toString());
- }
- }
- } catch (Exception e) {
- SqlSession.rollback();
- SqlSession.close();
- }
- SqlSession.commit();
- SqlSession.close();
- }
-
- /**
- * 线棒LS订单自动引用 不同订单 同轧批号 项目一样引用
- * @param materialInfo
- * @return
- * @throws Exception
- */
- public void DoQuoteXB(HashMap parmas) throws Exception {
- SqlSession = QCM.COMMUNAL.SqlSessionBuilder.openSqlSession();
- mapper = SqlSession.getMapper(QCM.COMMUNAL.OrderSqMapper.class);
- try {
- String strsql="";
- if(parmas.get("MEMOLOG").equals("0")){//按子板件件取样
- strsql = " AND T.MATERIAL_NO='"+parmas.get("MATERIAL_NO")+"' ";
- }
- //查询当前生成的委托
- String sql ="SELECT T.SPECIMEN_NO,T.BATCH_NO,T.SMP_NO,T.PLINE_CODE,"
- +" (SELECT COUNT(1) FROM QCM_JHY_SAMPLE_CONSIGN_D_ITEM I WHERE I.SPECIMEN_NO = T.SPECIMEN_NO) COUNTN "
- +" FROM QCM_JHY_SAMPLE_CONSIGN_D T,QCM_JHY_SAMPLE_R_ORD R WHERE T.SMP_NO = R.SMP_NO AND T.PLINE_CODE IN ('GX1','GX2','BC2') AND T.SMP_TYPE_CODE ='0' "
- +" AND R.DESIGN_KEY = '"+parmas.get("DESIGN_KEY")+"' AND R.BATCH_NO ='"+parmas.get("BATCH_NO")+"' and t.status = '0' "
- +strsql
- + " ORDER BY COUNTN DESC ";
- List<HashMap> result1 = mapper.query(sql.toString());
- if(result1==null || result1.size()<=0){
- return;
- }
-
- //查询最初的委托 AND R.DESIGN_KEY not like 'LS%' SOURCE:是否正常批
- String sql2 = "SELECT T.SPECIMEN_NO,T.BATCH_NO,(SELECT COUNT(1) FROM QCM_JHY_SAMPLE_CONSIGN_D_ITEM I WHERE I.SPECIMEN_NO = T.SPECIMEN_NO) COUNTN "
- +" FROM QCM_JHY_SAMPLE_CONSIGN_D T,QCM_JHY_SAMPLE_R_ORD R "
- +" WHERE T.SMP_NO = R.SMP_NO AND T.PLINE_CODE IN ('GX1','GX2','BC2') AND T.SMP_TYPE_CODE ='0' AND T.SOURCE= '0' "
- +" AND T.QUOTE_MEMO IS NULL AND T.STATUS = '3' AND R.BATCH_NO ='"+parmas.get("BATCH_NO")+"' "
- +" ORDER BY COUNTN DESC ";
- List<HashMap> result = mapper.query(sql2.toString());
- if (result != null && result.size()>=1) {
- for (int a = 0; a < result1.size(); a++) {
- //查询引用的所有明细
- sql ="";
- sql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where t.specimen_no = '"+result1.get(a).get("SPECIMEN_NO")+"' ";
- List<HashMap> qltyLists=mapper.query(sql.toString());
-
- //查询被引用的所有明细
- sql ="";
- sql = "select t.* from QCM_JHY_INSP_PHYSICS t where t.specimen_no = '"+result.get(a).get("SPECIMEN_NO")+"' ";
- List<HashMap> qltyLists2=mapper.query(sql.toString());
- if(qltyLists2==null || qltyLists2.size()<=0){
- continue;
- }
-
- Integer bQuote = qltyLists.size();//引用
- int quotenum = 0;//已引用数据
- //引用
- for (int i = 0; i < qltyLists.size(); i++) {//被引用在外层循环 对比 引用中有没有相应的项目有 插入
-
- String specimenNo=(String) qltyLists.get(i).get("SPECIMEN_NO");
- //代码
- String phyCodeL = (String) qltyLists.get(i).get("PHY_CODE_L");//材质检验大项代码
- String phyCodeM = (String) qltyLists.get(i).get("PHY_CODE_M");//试样组代码
- String phyCodeS = (String) qltyLists.get(i).get("PHY_CODE_S");//材质检验项目代码
- String itemCodeD = (String) qltyLists.get(i).get("ITEM_CODE_D");//试验方向代码
- String itemCodeT = (String) qltyLists.get(i).get("ITEM_CODE_T");//试验温度代码 试验温度代码 冲击 被引用
- String itemCodeS = (String) qltyLists.get(i).get("ITEM_CODE_S");//试样尺寸代码
- //名称
- String phyNameL = (String) qltyLists.get(i).get("PHY_NAME_L");//材质检验大项代码
- String phyNameM = (String) qltyLists.get(i).get("PHY_NAME_M");//试样组代码
- String phyNameS = (String) qltyLists.get(i).get("PHY_NAME_S");//材质检验项目代码
- String itemNameD = (String) qltyLists.get(i).get("ITEM_NAME_D");//试验方向代码
- String itemNameT = (String) qltyLists.get(i).get("ITEM_NAME_T");//试验温度代码 试验温度代码 冲击 被引用
- String itemNameS = (String) qltyLists.get(i).get("ITEM_NAME_S");//试样尺寸代码
-
- String itemCodeL = (String) qltyLists.get(i).get("ITEM_CODE_L");//试验位置代码
- String itemDescL = (String) qltyLists.get(i).get("ITEM_DESC_L");
- BigDecimal seq = (BigDecimal) qltyLists.get(i).get("SEQ");
- String bigdjs = seq.toString();
- Integer bigd4 = Integer.parseInt(bigdjs);
-
-
- String newItem=phyCodeL+"-"+phyCodeM+"-"+phyCodeS;
- newItem=newItem+"-"+(itemCodeD!=null?itemCodeD:"null");
- newItem=newItem+"-"+(itemCodeT!=null?itemCodeT:"null");
- newItem=newItem+"-"+(itemCodeS!=null?itemCodeS:"null");
- newItem=newItem+"-"+(itemCodeL!=null?itemCodeL:"null");
-
- //被引用
- for (HashMap hashMap : qltyLists2) {
-
- //代码
- String phyCodeL2 = (String) hashMap.get("PHY_CODE_L");//材质检验大项代码
- String phyCodeM2 = (String) hashMap.get("PHY_CODE_M");//试样组代码
- String phyCodeS2 = (String) hashMap.get("PHY_CODE_S");//材质检验项目代码
- String itemCodeD2 = (String) hashMap.get("ITEM_CODE_D");//试验方向代码
- String itemCodeT2 = (String) hashMap.get("ITEM_CODE_T");//试验温度代码 试验温度代码 冲击 被引用
- String itemCodeS2 = (String) hashMap.get("ITEM_CODE_S");//试样尺寸代码
- String itemCodeL2 = (String) hashMap.get("ITEM_CODE_L");//试验位置代码
-
- String newItem2=phyCodeL2+"-"+phyCodeM2+"-"+phyCodeS2;
- newItem2=newItem2+"-"+(itemCodeD2!=null?itemCodeD2:"null");
- newItem2=newItem2+"-"+(itemCodeT2!=null?itemCodeT2:"null");
- newItem2=newItem2+"-"+(itemCodeS2!=null?itemCodeS2:"null");
- newItem2=newItem2+"-"+(itemCodeL2!=null?itemCodeL2:"null");
-
- //标准一样的引用
- if(newItem.equals(newItem2)){
-
- 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,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, "
- +" PHY_UNIT,MEMO) "
- +" select '"+specimenNo+"','"+bigd4+"',TEST_QTY,'"+phyCodeL+"','"+phyNameL+"','"+phyCodeM+"','"+phyNameM+"','"+phyCodeS+"','"+phyNameS+"','"+itemCodeD+"','"+itemNameD+"', "
- +" '"+itemCodeT+"','"+itemNameT+"','"+itemCodeS+"','"+itemNameS+"',VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
- +" VAL13,VAL14,VAL15,AVG_VAL,'"+parmas.get("CREATE_NAME")+"',sysdate,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,'"+itemCodeL+"','"+itemDescL+"', "
- +" PHY_UNIT,MEMO from QCM_JHY_INSP_PHYSICS t "
- + " where t.specimen_no = '"+(String)hashMap.get("SPECIMEN_NO")+"' "
- + "and t.seq = '"+hashMap.get("SEQ")+"' ";
- mapper.insert(sql);
-
- //修改ITEM表
- sql = "";
- sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t set t.QUOTE_MEMO = '已引用"+hashMap.get("SPECIMEN_NO")+"' "
- + " where t.SPECIMEN_NO ='"+specimenNo+"' and t.seq = '"+seq+"' ";
- mapper.updateJudgeStatus(sql.toString());
- quotenum++;
- break;
- }
- }
- }
- //被引用的项目 全部 已引用
- if(quotenum==bQuote){
- //修改D表
- sql = "";
- sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.STATUS = '3',t.SEND_ID = '"+parmas.get("CREATE_ID")+"', "
- + " t.SEND_NAME = '"+parmas.get("CREATE_NAME")+"',t.SEND_TIME = sysdate,t.SEND_MEMO = '有引用',t.QUOTE_MEMO = '引用实绩' "
- + " where t.batch_no = '"+result1.get(a).get("BATCH_NO")+"' and t.pline_code = '"+result1.get(a).get("PLINE_CODE")+"' "
- + " and t.SPECIMEN_NO ='"+result1.get(a).get("SPECIMEN_NO")+"' ";
- mapper.updateJudgeStatus(sql.toString());
-
- //往log表中插入p
- sql = "";
- sql = " INSERT INTO QCM_JUDGE_LOG ( JUDGE_TYPE,MATERIAL_NO,CREATE_TIME,CREATE_NAME,PROD_LINE) "
- +" VALUES ( 'P', '"+result1.get(a).get("SMP_NO")+"', SYSDATE,'system','"+result1.get(a).get("PLINE_CODE")+"')";
- mapper.insert(sql);
- }else{
- //修改D表
- sql = "";
- sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.SEND_MEMO = '有引用',t.QUOTE_MEMO = '引用实绩' "
- + " where t.batch_no = '"+result1.get(a).get("BATCH_NO")+"' and t.pline_code = '"+result1.get(a).get("PLINE_CODE")+"' "
- + " and t.SPECIMEN_NO ='"+result1.get(a).get("SPECIMEN_NO")+"' ";
- mapper.updateJudgeStatus(sql.toString());
- }
- }
- }
- } catch (Exception e) {
- SqlSession.rollback();
- SqlSession.close();
- }
- SqlSession.commit();
- SqlSession.close();
- }
-
- /**
- * 修改热轧清空组批区间
- * @param materialInfo
- * @return
- * @throws Exception
- */
- public CoreReturnObject DoCleanUpMixRoll(HashMap parmas) throws Exception {
- try {
-
- String logmemo ="轧批号:"+parmas.get("BATCH_NO").toString()+','+"子板号:"+ parmas.get("MATERIAL_NO").toString()+','+
- "组批区间"+parmas.get("MIXROLL").toString()+','+"产线:"+parmas.get("PLINE_CODE").toString()+','+
- "操作人:"+parmas.get("USER_NAME").toString();
- String sql= "INSERT INTO QCM_JUDGE_OPERATE_LOG (OPERATE_TYPE,PARAMS,OPERATE_NAME,PROD_LINE,BATCHNO,MEMO) "
- + " VALUES('热轧清除组批区间','"+parmas.get("MATERIAL_NO")+"','DoCleanUpMixRoll','"+parmas.get("PLINE_CODE")+"',"
- + " '"+parmas.get("BATCH_NO")+"','"+logmemo+"') ";
- mapper.insert(sql);
-
- String sqlStr="update tbf02_spec_mill t "
- + " set MIXROLL='' "
- + " where t.COIL_NO in ( "
- + " select COIL_NO from tbh02_coil_comm c where c.OLD_SAMPL_NO like '"+parmas.get("BATCH_NO").toString()+"%' "
- + " ) ";
- mapper.updateJudgeStatus(sqlStr.toString());
-
- } catch (Exception e) {
- SqlSession.rollback();
- SqlSession.close();
- cro.setV_errCode(-1);
- cro.setV_errMsg("清空组批区间失败!"+e.getMessage());
- return cro;
- }
- SqlSession.commit();
- SqlSession.close();
- cro.setV_errCode(1);
- return cro;
- }
-
- /**
- * 项目集 取样位置
- * @param materialInfo
- * @return
- * @throws Exception
- */
- public void doPhyItem(String SPECIMEN_NO) throws Exception {
- SqlSession = QCM.COMMUNAL.SqlSessionBuilder.openSqlSession();
- mapper = SqlSession.getMapper(QCM.COMMUNAL.OrderSqMapper.class);
- try {
- String sqlitem = "select * from qcm_jhy_sample_consign_d t "
- +" where t.phy_item is null "
- +" and t.specimen_no = '"+SPECIMEN_NO+"' ";
- List<HashMap> PhyItem=mapper.query(sqlitem.toString());
- if(PhyItem!=null && PhyItem.size()>=1){
- String sqlItem = "select GET_ITEM_SPECIMEN_NO('"+SPECIMEN_NO+"') PHY_ITEM from dual";
- List<HashMap> vhchm=mapper.query(sqlItem.toString());
- if(vhchm!=null && vhchm.size()>=1 && !vhchm.get(0).get("PHY_ITEM").equals("NULL")){
- String sql = " update QCM_JHY_SAMPLE_CONSIGN_D t "
- +" set PHY_ITEM= '"+vhchm.get(0).get("PHY_ITEM").toString()+"' "
- +" where t.SPECIMEN_NO='"+SPECIMEN_NO+"' ";
- mapper.UpdateQcmWt(sql);
- }
- }
-
- String getcin = "select r.* from qcm_jhy_sample_consign_d t, qcm_jhy_sample_r_ord r "
- +" where t.smp_no = r.smp_no and t.specimen_no ='"+SPECIMEN_NO+"' "
- +" and r.Three_Memo is null and r.pline_code in ('ZB1','HB1') ";
- List<HashMap> getcinHM=mapper.query(getcin.toString());
- if(getcinHM!=null && getcinHM.size()>=1){
- String sqlItem2 = "select GET_CERT_INST_NAME('"+SPECIMEN_NO+"') PHY_ITEM from dual";
- List<HashMap> vhchm2=mapper.query(sqlItem2.toString());
- if(vhchm2!=null && vhchm2.size()>=1 && !vhchm2.get(0).get("PHY_ITEM").equals("NULL")){
- String sql = " update qcm_jhy_sample_r_ord t "
- +" set THREE_MEMO= '"+vhchm2.get(0).get("PHY_ITEM").toString()+"' "
- +" where t.SMP_NO in ( select d.smp_no from qcm_jhy_sample_consign_d d where d.specimen_no = '"+SPECIMEN_NO+"') ";
- mapper.updateJudgeStatus(sql.toString());
- }
- }
-
- TreeSet<String> treeSet = new TreeSet<String>();
- String SQLsmpLocation = "select * from QCM_JHY_SAMPLE_CONSIGN_D_ITEM t "
- +" where t.SMP_LOCATION is null "
- +" and t.specimen_no = '"+SPECIMEN_NO+"' ";
- List<HashMap> PhySp=mapper.query(SQLsmpLocation.toString());
- if(PhySp!=null && PhySp.size()>=1){
- treeSet.add(SPECIMEN_NO);
- for (HashMap<String,String> hashMap : PhySp) {
- String fyQuoteSpecimenNo=String.valueOf(hashMap.get("FY_QUOTE_SPECIMEN_NO"));
- if(fyQuoteSpecimenNo!=null && !"".equals(fyQuoteSpecimenNo) && !"null".equals(fyQuoteSpecimenNo)){
- treeSet.add(fyQuoteSpecimenNo);
- }
- }
-
- if(treeSet.size()>=1){
- for (String str : treeSet) {
- //查出取样位置
- String sqlsl="select * from qcm_jhy_sample_consign_d t where t.specimen_no = '"+str+"' and rownum = 1 ";
- List<HashMap> sqlslhm=mapper.query(sqlsl.toString());
- if(sqlslhm!=null && sqlslhm.size()>=1){
- String SMP_LOCATION=sqlslhm.get(0).get("SMP_LOCATION").toString();//取样位置
- String sql="select * from QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where t.specimen_no = '"+str+"' "
- + " and t.SMP_LOCATION is null and t.FY_QUOTE_SPECIMEN_NO is null ";
- List<HashMap> hashMap=mapper.query(sql.toString());
- if(hashMap!=null && hashMap.size()>=1){
- sql="";
- sql = " update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t "
- +" set SMP_LOCATION= '"+SMP_LOCATION+"' "
- +" where t.SPECIMEN_NO='"+str+"' and t.SMP_LOCATION is null and t.FY_QUOTE_SPECIMEN_NO is null ";
- mapper.UpdateQcmWt(sql);
- }
-
- sql="";
- sql="select * from QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where t.FY_QUOTE_SPECIMEN_NO = '"+str+"' "
- + " and t.SMP_LOCATION is null and t.SEQ>=50 ";
- List<HashMap> hashMap2=mapper.query(sql.toString());
- if(hashMap2!=null && hashMap2.size()>=1){
- sql="";
- sql = " update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t "
- +" set SMP_LOCATION= '"+SMP_LOCATION+"' "
- +" where t.FY_QUOTE_SPECIMEN_NO='"+str+"' and t.SMP_LOCATION is null and t.SEQ>=50 ";
- mapper.UpdateQcmWt(sql);
- }
-
- }
- }
- }
- }
-
- } catch (Exception e) {
- SqlSession.rollback();
- SqlSession.close();
- }
- SqlSession.commit();
- SqlSession.close();
- }
-
- //19订单刷新 or t.onememo is null)
- public void AutoTimeZHB(String usreName) throws Exception {
- SqlSession = QCM.COMMUNAL.SqlSessionBuilder.openSqlSession();
- mapper = SqlSession.getMapper(QCM.COMMUNAL.OrderSqMapper.class);
- try {
- String sql="select * from ( "
- +" select t.create_time,r.design_key,r.batch_no,r.heat_no,r.smp_no,t.specimen_no,t.freq_code,t.pline_code,t.smp_type_code,r.thick, "
- +" (select COUNT(1) from qcm_jhy_sample_consign_d d,qcm_jhy_sample_r_ord r where d.smp_no= r.smp_no and d.batch_no=t.batch_no "
- + " and d.status='3' and d.freq_code<>'D' and r.design_key not like '19%' and substr(d.process_nos, 0, 1) =substr(t.process_nos, 0, 1) "
- + " and substr(d.process_nos, 4, 1) =substr(t.process_nos, 4, 1) and substr(d.process_nos, 5, 1) =substr(t.process_nos, 5, 1) ) NUMM,"
- + " (select count(1) from zj_result_all@xgcx z where z.billetid= t.material_no and z.JUDGERESULT='0' ) JUDGERESULT "
- +" from qcm_jhy_sample_consign_d t,qcm_jhy_sample_r_ord r "
- +" where t.smp_no = r.smp_no "
- +" and r.design_key like '19%' "
- +" and (t.ONEMEMO='力学性能实绩未返回或未下发委托,请等实绩返回人工引用' or t.onememo is null) "
- +" and nvl(t.ARTIFICIAL_MEMO,'1') ='1' "
- +" and t.status = '0' "
- +" and r.judge_status = '0' and t.freq_code <>'D' and t.pline_code in ('ZB1','HB1') "
- +" order by t.create_time"
- +" ) f "
- +" where f.numm<>'0' and f.JUDGERESULT>=1 and f.CREATE_TIME>=to_date('2023-01-18 00:00:00','yyyy-MM-dd HH24:mi:ss')"
- +" and rownum<=20 ";
- List<HashMap> qltyLists=mapper.query(sql.toString());
- if(qltyLists!=null && qltyLists.size()>=1){
- for (int i = 0; i < qltyLists.size(); i++) {
- HashMap<String, String> Quotehm =new HashMap<String, String>();
- Quotehm.put("HEAT_NO", qltyLists.get(i).get("HEAT_NO").toString());
- Quotehm.put("BATCH_NO", qltyLists.get(i).get("BATCH_NO").toString());
- Quotehm.put("SMP_NO", qltyLists.get(i).get("SMP_NO").toString());
- Quotehm.put("SPECIMEN_NO", qltyLists.get(i).get("SPECIMEN_NO").toString());
- Quotehm.put("FREQ_CODE", qltyLists.get(i).get("FREQ_CODE").toString());
- Quotehm.put("PLINE_CODE", qltyLists.get(i).get("PLINE_CODE").toString());
- Quotehm.put("SMP_TYPE_CODE", qltyLists.get(i).get("SMP_TYPE_CODE").toString());
- Quotehm.put("SEND_ID", "系统自动");
- Quotehm.put("CREATE_NAME", "系统自动");
- Quotehm.put("THICK", qltyLists.get(i).get("THICK").toString());
- Quotehm.put("DESIGN_KEY", qltyLists.get(i).get("DESIGN_KEY").toString());
- String str=DoQuoteBatchNo191(Quotehm);
- if("1".equals(str)){
- System.out.println(i+": 19刷新接口:"+qltyLists.get(i).get("BATCH_NO")+"、"+qltyLists.get(i).get("SPECIMEN_NO")+"成功");
- }else{
- System.out.println(i+": 19刷新接口:"+qltyLists.get(i).get("BATCH_NO")+"、"+qltyLists.get(i).get("SPECIMEN_NO")+"失败!"+str);
- }
- }
-
- }
-
- } catch (Exception e) {
- SqlSession.rollback();
- SqlSession.close();
- System.out.println("2:调用19失败!"+e.getMessage());
- }finally {
- SqlSession.close();
- }
- }
-
- //SQLS订单号多次换单导致材质判定时检验号被清空判不了
- public void AutoTimeSQLS(String usreName) throws Exception {
- SqlSession = QCM.COMMUNAL.SqlSessionBuilder.openSqlSession();
- mapper = SqlSession.getMapper(QCM.COMMUNAL.OrderSqMapper.class);
- try {
- String sql="select t.*,r.DESIGN_KEY,r.STEEL_CODE,r.THICK from qcm_jhy_sample_consign_d t,qcm_jhy_sample_r_ord r "
- +" where t.smp_no = r.smp_no "
- +" and r.design_key not like '19%' "
- +" and t.pline_code in ('ZB1','HB1') "
- +" and r.Judge_Status='1' "
- +" and r.Judge_Result_Code='3' "
- +" and r.Judge_Result_Desc = '没在库' "
- +" and t.freq_code <> 'D' and t.smp_type_code = '0' "
- +" and r.memo is null ";
- List<HashMap> qltyLists=mapper.query(sql.toString());
- if(qltyLists!=null && qltyLists.size()>=1){
- for (int i = 0; i < qltyLists.size(); i++) {
- String SMP_NO=qltyLists.get(i).get("SMP_NO").toString();
- String BATCH_NO=qltyLists.get(i).get("BATCH_NO").toString();
- String MATERIAL_NO=qltyLists.get(i).get("MATERIAL_NO").toString();
- String BOARD_NO=qltyLists.get(i).get("BOARD_NO").toString();
- String INSPECTION_LOT=qltyLists.get(i).get("INSPECTION_LOT").toString();
- String PLINE_CODE=qltyLists.get(i).get("PLINE_CODE").toString();
- String FREQ_CODE=qltyLists.get(i).get("FREQ_CODE").toString();
- String DESIGN_KEY=qltyLists.get(i).get("DESIGN_KEY").toString();
- String STEEL_CODE=qltyLists.get(i).get("STEEL_CODE").toString();
- String THICK=qltyLists.get(i).get("THICK").toString();
-
- String sql2="select * from zj_result_all@xgcx t "
- + " where t.billetid = '"+MATERIAL_NO+"' and t.BILLETID_JY is null ";
- List<HashMap> qltyLists2=mapper.query(sql2.toString());
- if(qltyLists2!=null && qltyLists2.size()>=1){
- String sqlzj = " update zj_result_all@xgcx t set t.billetid_jy = '"+INSPECTION_LOT+"' "
- + " where t.billetid='"+MATERIAL_NO+"' ";
- mapper.updateJudgeStatus(sqlzj.toString());
- //r.design_key like 'SQLS%'
- String sqlord = " update qcm_jhy_sample_r_ord r "
- +" set r.Judge_Status='0',r.Judge_Result_Code='', "
- +" r.Judge_Result_Desc = '',r.memo='订单:'||'"+DESIGN_KEY+"' "
- +" where 1=1 "
- +" and r.Smp_No='"+SMP_NO+"' ";
- mapper.updateJudgeStatus(sqlord.toString());
-
- String sqlP = " INSERT INTO QCM_JUDGE_LOG ( JUDGE_TYPE,MATERIAL_NO,CREATE_TIME,CREATE_NAME,PROD_LINE) "
- +" VALUES ( 'P', '"+SMP_NO+"', SYSDATE,'system','"+PLINE_CODE+"')";
- mapper.insert(sqlP);
- System.out.println("调用"+DESIGN_KEY+"订单接口成功:轧批号:"+BATCH_NO+"、试样号:"+SMP_NO);
- }else{
- String lot="0";
- HashMap<String, String> hashMapStr =new HashMap<String, String>();
- hashMapStr.put("BATCH_NO", BATCH_NO);
- hashMapStr.put("PLINE_CODE", PLINE_CODE);
- hashMapStr.put("DESIGN_KEY", DESIGN_KEY);
- hashMapStr.put("STEEL_CODE", STEEL_CODE);
- hashMapStr.put("THICK", THICK);
- hashMapStr.put("BOARD_NO", BOARD_NO);
- hashMapStr.put("FREQ_CODE", FREQ_CODE);
- hashMapStr.put("MATERIAL_NO", MATERIAL_NO);
-
- String deystr = DESIGN_KEY.substring(0, 2);
- if(!"19".equals(deystr)){
- String sqlstr = ZHBJudgeStatus(hashMapStr);
- List<HashMap> kczh=mapper.query(sqlstr.toString());
- if (kczh!=null && kczh.size()>=1) {
- for (HashMap hashMap : kczh) {
- String bcon = "select nvl(t.BILLETID_JY,'0') BILLETID_JY,t.* from zj_result_all@xgcx t "
- + " where t.billetid = '"+(String)hashMap.get("MATERIAL_NO")+"' "
- + " and rownum <= 1 ";
- List<HashMap> billetidJy = mapper.query(bcon.toString());
- if(billetidJy != null && billetidJy.size() >=1 && !billetidJy.get(0).get("BILLETID_JY").equals(INSPECTION_LOT)){
- mapper.zjResultAllZHB(MATERIAL_NO,INSPECTION_LOT);
- lot="1";
- }
- }
- }
- }
- if(lot.equals("1")){
- String sqlord = " update qcm_jhy_sample_r_ord r "
- +" set r.memo='订单:'||'"+DESIGN_KEY+"',JUDGE_STATUS='0',JUDGE_RESULT_CODE='',JUDGE_RESULT_DESC='' "
- +" where 1=1 "
- +" and r.Smp_No='"+SMP_NO+"' ";
- mapper.updateJudgeStatus(sqlord.toString());
- String sqlP = " INSERT INTO QCM_JUDGE_LOG ( JUDGE_TYPE,MATERIAL_NO,CREATE_TIME,CREATE_NAME,PROD_LINE) "
- +" VALUES ( 'P', '"+SMP_NO+"', SYSDATE,'system','"+PLINE_CODE+"')";
- mapper.insert(sqlP);
- }else{
- String sqlord = " update qcm_jhy_sample_r_ord r "
- +" set r.memo='订单:'||'"+DESIGN_KEY+"' "
- +" where 1=1 "
- +" and r.Smp_No='"+SMP_NO+"' ";
- mapper.updateJudgeStatus(sqlord.toString());
- }
- System.out.println("调用"+DESIGN_KEY+"订单接口检验号不为空:轧批号:"+BATCH_NO+"、试样号:"+SMP_NO);
- }
- }
- }
-
- } catch (Exception e) {
- SqlSession.rollback();
- SqlSession.close();
- System.out.println("2:调用SQLS订单接口失败!"+e.getMessage());
- }
- SqlSession.commit();
- SqlSession.close();
- }
-
- public String ZHBJudgeStatus(HashMap<String, String> hashMapStr){
- String freqCode="";
- //按母板取样
- if(hashMapStr.get("FREQ_CODE").equals("B") || hashMapStr.get("FREQ_CODE").equals("F") || hashMapStr.get("FREQ_CODE").equals("G")){
- freqCode =" and t.BOARD_NO = '"+hashMapStr.get("BOARD_NO")+"' ";
- }else if(hashMapStr.get("FREQ_CODE").equals("C") || hashMapStr.get("FREQ_CODE").equals("H") || hashMapStr.get("FREQ_CODE").equals("I")){
- freqCode =" and t.MATERIAL_NO = '"+hashMapStr.get("MATERIAL_NO")+"' ";
- }
-
-
- String materialNosql="";
- if(hashMapStr.get("PLINE_CODE").equals("ZB1")){
- materialNosql = "SELECT t.* "
- +" FROM (SELECT A.SAMPLINGREQUESTTIME,T.ORDERNO DESIGN_KEY,T.BATCHNO BATCH_NO,to_char(T.STEELCODE) GRADE_CODE,T.HEIGHT THICK,T.PRODUCTNO MATERIAL_NO "
- +" ,T.MOTHERPLATEID BOARD_NO FROM MB_PLANDETAILOFPLATE@xgcx T, SEL_PACTDETAIL_NEW@xgcx A "
- +" WHERE T.ORDERNO = A.ORDERNO "
- +" and T.PRODUCTNO not in "
- +" (select T.BILLETID from KCZ_TURNOFFLIST@xgcx T where t.ROLLNUMBER = '"+hashMapStr.get("BATCH_NO")+"') "
- +" and T.ORDERNO is not null AND A.SAMPLINGREQUESTTIME IN ('A', 'AB') "
- +" union all "
- +" SELECT A.SAMPLINGREQUESTTIME,T.ORDERNO DESIGN_KEY,T.ROLLNUMBER BATCH_NO,T.DETERMINANTCARDNUMBER GRADE_CODE,T.PLY THICK,T.BILLETID MATERIAL_NO "
- +" ,T.MOTHERBOARDNUMBER BOARD_NO FROM KCZ_TURNOFFLIST@xgcx T, SEL_PACTDETAIL_NEW@xgcx A "
- +" WHERE T.ORDERNO = A.ORDERNO and T.ORDERNO is not null AND T.ISVALID <> '0') t "
- +" WHERE t.BATCH_NO = '"+hashMapStr.get("BATCH_NO")+"' and t.BATCH_NO like 'Z%' "
- +" and t.GRADE_CODE = '"+hashMapStr.get("STEEL_CODE")+"' and to_char(t.THICK, 'fm990.099') = to_char('"+hashMapStr.get("THICK")+"', 'fm990.099') "
- +" and T.DESIGN_KEY = '"+hashMapStr.get("DESIGN_KEY")+"' "
- + freqCode
- + " group by t.SAMPLINGREQUESTTIME,T.DESIGN_KEY,T.BATCH_NO,T.GRADE_CODE,T.THICK,t.MATERIAL_NO,t.BOARD_NO order by t.MATERIAL_NO ";
-
- }else if(hashMapStr.get("PLINE_CODE").equals("HB1")){
-
- materialNosql ="SELECT t.* "
- +" FROM (SELECT A.SAMPLINGREQUESTTIME,T.ORDERID DESIGN_KEY,T.BATCHNO BATCH_NO,to_char(T.STEELTYPE) GRADE_CODE,T.THICK THICK,T.SLABNO MATERIAL_NO, "
- +" T.MOTHERSLAB BOARD_NO FROM ZYHB_PLANDETAILOFPLATE@xgcx T, SEL_PACTDETAIL_NEW@xgcx A "
- +" WHERE T.ORDERID = A.ORDERNO "
- +" and T.SLABNO not in "
- +" (select T.BILLETID from KCH_TURNOFFLIST@xgcx T where t.ROLLNUMBER = '"+hashMapStr.get("BATCH_NO")+"') "
- +" and T.ORDERID is not null "
- +" union all "
- +" SELECT A.SAMPLINGREQUESTTIME,T.ALLOTORDERFORM DESIGN_KEY,T.ROLLNUMBER BATCH_NO,T.DETERMINANTCARDNUMBER GRADE_CODE,T.PLY THICK,T.BILLETID MATERIAL_NO "
- +" ,T.MOTHERBOARDNUMBER BOARD_NO FROM KCH_TURNOFFLIST@xgcx T, SEL_PACTDETAIL_NEW@xgcx A "
- +" WHERE T.ALLOTORDERFORM = A.ORDERNO and T.ALLOTORDERFORM is not null AND T.PSTATFLAG <> '0') t "
- +" WHERE t.BATCH_NO = '"+hashMapStr.get("BATCH_NO")+"' and t.BATCH_NO like 'H%' "
- +" and t.GRADE_CODE = '"+hashMapStr.get("STEEL_CODE")+"' and to_char(t.THICK, 'fm990.099') = to_char('"+hashMapStr.get("THICK")+"', 'fm990.099') "
- +" and T.DESIGN_KEY = '"+hashMapStr.get("DESIGN_KEY")+"' "
- + freqCode
- +" group by t.SAMPLINGREQUESTTIME,T.DESIGN_KEY,T.BATCH_NO,T.GRADE_CODE,T.THICK,t.MATERIAL_NO,t.BOARD_NO order by t.MATERIAL_NO asc";
- }
- return materialNosql;
- }
-
- //自动刷激光
- public void AutoTimeJG() throws Exception {
- try {
- SqlSession = QCM.COMMUNAL.SqlSessionBuilder.openSqlSession();
- mapper = SqlSession.getMapper(QCM.COMMUNAL.OrderSqMapper.class);
- String sql="select t.* from QCM_JHY_SAMPLE_CONSIGN_JG t where t.yn = 'Y' and rownum <=100 ORDER BY T.CREATE_TIME ";
- List<HashMap> qltyLists=mapper.query(sql.toString());
- if(qltyLists!=null && qltyLists.size()>=1){
- for (int i = 0; i < qltyLists.size(); i++) {
- HashMap<String, String> Quotehm =new HashMap<String, String>();
- String SPECIMEN_NO = qltyLists.get(i).get("SPECIMEN_NO").toString();
- Quotehm.put("SPECIMEN_NO", SPECIMEN_NO);
- Quotehm.put("BATCH_NO", qltyLists.get(i).get("BATCH_NO").toString());
- Quotehm.put("PLINE_CODE", qltyLists.get(i).get("PLINE_CODE").toString());
- Send2 jg=new Send2();
- CoreReturnObject oj=jg.SendJG(SPECIMEN_NO,"JG","JG",Quotehm);
- String rinfo=oj.getV_errMsg().toString();
- if(rinfo.equals("待发送的检验委托数据已经不存在,请核实数据!")){
- String sqlord = " update QCM_JHY_SAMPLE_CONSIGN_JG r set r.SUCCESS_MEMO='"+rinfo+"',r.YN='N' "
- +" where r.SPECIMEN_NO='"+SPECIMEN_NO+"' ";
- mapper.updateJudgeStatus(sqlord.toString());
- SqlSession.commit();
- }
-
- }
- }
-
- } catch (Exception e) {
- SqlSession.rollback();
- SqlSession.close();
- System.out.println("发送激光接口失败:"+e.getMessage());
- }finally {
- SqlSession.close();
- }
-
- }
-
- //电弧炉熔炼成分自动判定
- public void AutoTimeHDL() throws Exception {
- try {
- SqlSession = QCM.COMMUNAL.SqlSessionBuilder.openSqlSession();
- mapper = SqlSession.getMapper(QCM.COMMUNAL.OrderSqMapper.class);
- String sql="select f.HEAT_NO,f.MATERIAL_NO,f.DESIGN_KEY,f.SNAME,f.STEEL_CODE,f.ASSAY_NO from ( "
- +" select k.STOVENO HEAT_NO,k.BILLETID MATERIAL_NO,k.ORDERNO DESIGN_KEY,'system' SNAME,k.DETERMINANTCARDNUMBER STEEL_CODE,t.ASSAY_NO "
- +" from kcx_turnofflist@xgcx k,zj_result_all@xgcx z,qcm_jhy_insp_elements t "
- +" where k.BILLETID = z.BILLETID "
- +" and k.STOVENO = t.HEAT_NO "
- +" and t.heat_no like 'E%' "
- +" and z.JUDGERESULT = '0' "
- +" and z.R_CHEMRESULT = '0' "
- +" and z.CREATE_TIME > TO_DATE('2024-09-01 00:00:01','YYYY-MM-DD HH24:MI:SS') "
- +" and k.STOVENO is not null "
- +" and k.BILLETID is not null "
- +" and k.ORDERNO is not null "
- +" and k.DETERMINANTCARDNUMBER is not null "
- +" and t.ASSAY_NO is not null "
- +" group by k.STOVENO,k.BILLETID,k.ORDERNO,k.DETERMINANTCARDNUMBER,t.ASSAY_NO "
- +" order by k.BILLETID) f "
- +" where rownum <=100 ";
- List<HashMap> qltyLists=mapper.query(sql.toString());
- if(qltyLists!=null && qltyLists.size()>=1){
- for (int i = 0; i < qltyLists.size(); i++) {
- String heat_no = qltyLists.get(i).get("HEAT_NO").toString();//炉号
- String material_no = qltyLists.get(i).get("MATERIAL_NO").toString();//子板号
- String design_key = qltyLists.get(i).get("DESIGN_KEY").toString();//订单号
- String username = qltyLists.get(i).get("SNAME").toString();//操作人
- String grade_name = qltyLists.get(i).get("STEEL_CODE").toString();//牌号
- String assay_no = qltyLists.get(i).get("ASSAY_NO").toString();//成分化验号
- ArrayList<String> list = new ArrayList<String>();
- list.add(assay_no);
- System.out.println("\n子板号:"+material_no);
- QcmJhyElementsServiceImpl impl = new QcmJhyElementsServiceImpl();
- impl.RlChemJudgeByHuman(heat_no, material_no, design_key, username, grade_name, list);
- System.out.println("\n子板号:"+material_no+"结束");
- }
- }
-
- } catch (Exception e) {
- SqlSession.rollback();
- SqlSession.close();
- System.out.println("电弧炉熔炼成分自动判定失败:"+e.getMessage());
- }finally {
- SqlSession.close();
- }
-
- }
-
- /**
- * 调整热处理号
- * @param materialInfo
- * @return
- * @throws Exception
- */
- public CoreReturnObject doProcessNos(HashMap parmas) throws Exception {
- try {
- String rclState =parmas.get("PROCESS_NOS").toString();//修改的热处理号
- String sqlStr ="";
- //判断是否是模拟焊后
- String sqlmn="select * from QCM_JHY_SAMPLE_CONSIGN_D t where t.SMP_NO = '"+parmas.get("SMP_NO")+"' and t.SMP_LOCATION like '%模拟焊后%' ";
- List<HashMap> map2=mapper.query(sqlmn.toString());
- if(map2!=null && map2.size()>=1){
- sqlStr="select * from QCM_JHY_SAMPLE_CONSIGN_D t where t.smp_no = '"+parmas.get("SMP_NO")+"' ";
- }else{
- sqlStr = "select * from QCM_JHY_SAMPLE_CONSIGN_D t"
- + " where t.BATCH_NO = '"+parmas.get("BATCH_NO")+"' "
- + " and t.SMP_NO = '"+parmas.get("SMP_NO")+"' ";
- // sqlStr = "select * from QCM_JHY_SAMPLE_CONSIGN_D t"
- // + " where t.BATCH_NO = '"+parmas.get("BATCH_NO")+"' "
- // + " and t.SPECIMEN_NO = '"+parmas.get("SPECIMEN_NO")+"' "
- // + " and t.SMP_NO = '"+parmas.get("SMP_NO")+"' ";
- }
- List<HashMap> map=mapper.query(sqlStr.toString());
- if(map !=null && map.size()>=1){
- String str = parmas.get("USER_NAME")+"修改热处理号为"+rclState;
- for (HashMap<String,String> hashMap : map) {
- sqlStr="";
- sqlStr="select * from QCM_JHY_SAMPLE_CONSIGN_D t where t.specimen_no = '"+hashMap.get("SPECIMEN_NO")+"' and t.process_nos <>'"+rclState+"'";
- List<HashMap> mappr=mapper.query(sqlStr.toString());
- if(mappr!=null && mappr.size()>=1){
- sqlStr="";
- sqlStr="update QCM_JHY_SAMPLE_CONSIGN_D t set PROCESS_NOS='"+rclState+"',"
- + " ARTIFICIAL_MEMO=t.ARTIFICIAL_MEMO||',"+str+"'||'原委托热处理号为:'||t.PROCESS_NOS "
- + " where t.BATCH_NO = '"+hashMap.get("BATCH_NO")+"' "
- + " and t.SPECIMEN_NO = '"+hashMap.get("SPECIMEN_NO")+"' "
- + " and t.SMP_NO = '"+hashMap.get("SMP_NO")+"' ";
- mapper.updateJudgeStatus(sqlStr.toString());
-
- String strMemo = "取样编号:"+hashMap.get("SPECIMEN_NO")+str+",原委托热处理号为:"+hashMap.get("PROCESS_NOS");
- QcmJudgeOperateLog qjog = new QcmJudgeOperateLog();
- qjog.setOperate_name(parmas.get("USER_NAME").toString());
- qjog.setBatchno(parmas.get("BATCH_NO") == null ?"":parmas.get("BATCH_NO").toString());
- qjog.setOperate_type("调整热处理号");
- qjog.setParams(parmas.get("MATERIAL_NO") == null ?"":parmas.get("MATERIAL_NO").toString());
- qjog.setProd_line(parmas.get("PLINE_CODE") == null ?"":parmas.get("PLINE_CODE").toString());
- qjog.setMemo(strMemo);
- mapper.insertQcmJudgeOperateLog(qjog);
- }
- }
- /* if(map.get(0).get("STATUS").toString().equals("3")){
- String INSPECTION_LOT = map.get(0).get("INSPECTION_LOT").toString();
- String PLINE_CODE = map.get(0).get("PLINE_CODE").toString();
- QcmJudgeLog qjlt = new QcmJudgeLog();
- qjlt.setJudge_type("R");
- qjlt.setMaterial_no(INSPECTION_LOT);
- qjlt.setCreate_name("sysZH");
- qjlt.setProd_line(PLINE_CODE);
- mapper.insertQcmJudgeLog(qjlt);
- }*/
- }
- } catch (Exception e) {
- SqlSession.rollback();
- SqlSession.close();
- cro.setV_errCode(-1);
- cro.setV_errMsg("调整失败!");
- return cro;
- }
- SqlSession.commit();
- SqlSession.close();
- cro.setV_errCode(1);
- return cro;
- }
-
- //打印标识
- public CoreReturnObject doPrintLog(String specimenNo) throws Exception {
- try {
- String sql= " update QCM_JHY_SAMPLE_CONSIGN_D t set t.print_log = '已打印' where t.specimen_no = '"+specimenNo+"' ";
- mapper.updateJudgeStatus(sql.toString());
- } catch (Exception e) {
- SqlSession.rollback();
- SqlSession.close();
- cro.setV_errCode(-1);
- cro.setV_errMsg("打印失败!");
- return cro;
- }
- SqlSession.commit();
- SqlSession.close();
- return cro;
- }
-
- //一键删除委托
- public CoreReturnObject doDelAllWT(HashMap parmas) throws Exception {
- try {
- String upsql="";
- String sql="select * from qcm_jhy_sample_consign_d t,qcm_jhy_sample_consign_m m, qcm_jhy_sample_r_ord r "
- +" where t.smp_no = r.smp_no "
- +" and t.smp_no = m.smp_no "
- +" and m.smp_no = r.smp_no "
- +" and t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' ";
- List<HashMap> hmap=mapper.query(sql.toString());
- if(hmap!=null && hmap.size()>=1){
-
- //材质判定
- if(!hmap.get(0).get("STATUS").equals("0") && (hmap.get(0).get("JUDGE_RESULT_CODE").equals("1") || hmap.get(0).get("JUDGE_RESULT_CODE").equals("2"))){
- upsql= " update QCM_JHY_SAMPLE_CONSIGN_D t set t.ONEMEMO = '已材质判定请取消判定' where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' ";
- mapper.updateJudgeStatus(upsql.toString());
- SqlSession.commit();
- SqlSession.close();
- return cro;
- }
-
- //不是按炉 下发委托 未撤回
- if(!hmap.get(0).get("STATUS").equals("0") && !hmap.get(0).get("FREQ_CODE").equals("D")){
- upsql= " update QCM_JHY_SAMPLE_CONSIGN_D t set t.ONEMEMO = '已下发委托未撤回' where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' ";
- mapper.updateJudgeStatus(upsql.toString());
- SqlSession.commit();
- SqlSession.close();
- return cro;
- }
-
- //按炉 送样委托 未撤回
- if(!hmap.get(0).get("STATUS").equals("0") && hmap.get(0).get("FREQ_CODE").equals("D") && hmap.get(0).get("QUOTE_CONSIGN_NO")==null){
- upsql= " update QCM_JHY_SAMPLE_CONSIGN_D t set t.ONEMEMO = '送样夹杂已下发委托未撤回' where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' ";
- mapper.updateJudgeStatus(upsql.toString());
- SqlSession.commit();
- SqlSession.close();
- return cro;
- }
- }
- //String uuid=this.getUUID();
- upsql= " update QCM_JHY_SAMPLE_CONSIGN_D t set VALIDFLAG='0',t.STATUS = '6',t.HEAT_NO='del' || t.HEAT_NO "
- + " where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' and t.smp_no = '"+parmas.get("SMP_NO")+"' ";
- mapper.updateJudgeStatus(upsql.toString());
-
- //夹杂复样按炉
- /*if(hmap.get(0).get("SMP_TYPE_CODE").equals("1") && hmap.get(0).get("FREQ_CODE").equals("D") && !hmap.get(0).get("JUDGE_RESULT_CODE").equals("1")){
- upsql= " update QCM_JHY_SAMPLE_CONSIGN_D t set t.HEAT_NO='del' || t.HEAT_NO "
- + " where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' and t.smp_no = '"+parmas.get("SMP_NO")+"' ";
- mapper.updateJudgeStatus(upsql.toString());
- }*/
- String strMemo = parmas.get("DESIGN_KEY").toString()+','+hmap.get(0).get("STEEL_CODE")+','+hmap.get(0).get("THICK")
- +",取样编号:"+parmas.get("SPECIMEN_NO")+"频次:"+hmap.get(0).get("FREQ_CODE")+"原因:"+parmas.get("MEMO").toString();
- QcmJudgeOperateLog qjog = new QcmJudgeOperateLog();
- qjog.setOperate_name(parmas.get("USER_NAME").toString());
- qjog.setBatchno(parmas.get("BATCH_NO") == null ?"":parmas.get("BATCH_NO").toString());
- qjog.setOperate_type("一键删除委托");
- qjog.setParams(parmas.get("MATERIAL_NO") == null ?"":parmas.get("MATERIAL_NO").toString());
- qjog.setProd_line(parmas.get("PLINE_CODE") == null ?"":parmas.get("PLINE_CODE").toString());
- qjog.setJudge_result(parmas.get("DESIGN_KEY") == null ?"":parmas.get("DESIGN_KEY").toString());
- qjog.setMemo(strMemo);
- mapper.insertQcmJudgeOperateLog(qjog);
-
- sql=" select * from qcm_jhy_sample_consign_d t "
- +" where t.smp_no = '"+parmas.get("SMP_NO")+"' and t.status <> '6' ";
- List<HashMap> hmapwt=mapper.query(sql.toString());
- if(hmapwt==null || hmapwt.size()<=0){
- upsql= " update Qcm_Jhy_Sample_r_Ord t set t.DESIGN_KEY = 'del' || t.DESIGN_KEY,t.THICK='del' || t.THICK,t.INSPECTION_LOT='',t.HEAT_NO='del' || t.HEAT_NO "
- + " where t.smp_no = '"+parmas.get("SMP_NO")+"' ";
- mapper.updateJudgeStatus(upsql.toString());
- }
- } catch (Exception e) {
- SqlSession.rollback();
- SqlSession.close();
- cro.setV_errCode(-1);
- cro.setV_errMsg("一键删除失败!");
- return cro;
- }
- SqlSession.commit();
- SqlSession.close();
- return cro;
- }
-
- //修改LRA
- public CoreReturnObject UPZHBLRA(HashMap parmas) throws Exception {
- try {
- //查询出系统默认指定的样数据
- String sql="select * from qcm_jhy_sample_consign_d t where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' ";
- List<HashMap> hmap=mapper.query(sql.toString());
- if(hmap==null || hmap.size()<=0){
- cro.setV_errCode(-1);
- cro.setV_errMsg("未找到相应修改数据!");
- return cro;
- }
- String special_quote_memo = hmap.get(0).get("SPECIAL_QUOTE_MEMO").toString();
- String BATCH_NO = hmap.get(0).get("BATCH_NO").toString();
-
- //查询出修改的数据
- sql="";
- sql="select * from qcm_jhy_sample_consign_d t where t.specimen_no = '"+parmas.get("SPECIMEN_NO_CK")+"' ";
- List<HashMap> hmLAR=mapper.query(sql.toString());
- if(hmLAR==null || hmLAR.size()<=0){
- cro.setV_errCode(-1);
- cro.setV_errMsg("未找到相应修改数据!");
- return cro;
- }
- String BATCH_NO_CK=hmLAR.get(0).get("BATCH_NO").toString();//人工指定的轧批号
- String SPECIMEN_NO_CK=parmas.get("SPECIMEN_NO_CK").toString();//人工指定的取样编号
- String MATERIAL_NO_CK=hmLAR.get(0).get("MATERIAL_NO").toString();
- String PLINE_CODE_CK=hmLAR.get(0).get("PLINE_CODE").toString();
- String DESIGN_KEY_CK=hmLAR.get(0).get("DESIGN_KEY").toString();
-
- //开始修改人工指定的轧批
- String updateD= " update QCM_JHY_SAMPLE_CONSIGN_D t set t.SPECIAL_QUOTE_MEMO = '"+special_quote_memo+"' where t.specimen_no = '"+parmas.get("SPECIMEN_NO_CK")+"' ";
- mapper.updateJudgeStatus(updateD.toString());
-
- String updateI = " update qcm_jhy_sample_consign_d_item t "
- +" set QUOTE_SPECIMEN_NO= '',QUOTE_SEQ = '',QUOTE_MEMO='', MEMOLAR='' "
- +" where t.SPECIMEN_NO='"+parmas.get("SPECIMEN_NO_CK")+"' and t.PHY_CODE_L = 'HC' ";
- mapper.updateJudgeStatus(updateI.toString());
-
- //清空默认指定的轧批D表
- updateD="";
- updateD= " update QCM_JHY_SAMPLE_CONSIGN_D t set t.SPECIAL_QUOTE_MEMO = '' where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' ";
- mapper.updateJudgeStatus(updateD.toString());
-
- //只要是还没有判定的就换成指定的引用轧批
- sql="";
- sql="select i.* from qcm_jhy_sample_consign_d t,qcm_jhy_sample_consign_d_item i "
- +" where t.specimen_no = i.specimen_no and t.status != '3' "
- +" and (i.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' or i.quote_specimen_no = '"+parmas.get("SPECIMEN_NO")+"') "
- +" and i.Phy_Code_l = 'HC' ";
- List<HashMap> hmitem=mapper.query(sql.toString());
- if(hmitem!=null && hmitem.size()>=1){
- TreeSet<String> specimenNo=new TreeSet<String>();//取样编号
- for (int i = 0; i < hmitem.size(); i++) {
- HashMap obj=hmitem.get(i);
- specimenNo.add((String)obj.get("SPECIMEN_NO"));
- }
- //循环改值
- for(String str : specimenNo){
- String updateItem= " update qcm_jhy_sample_consign_d_item t "
- +" set QUOTE_SPECIMEN_NO= '"+SPECIMEN_NO_CK+"',QUOTE_MEMO='已引用'||'"+SPECIMEN_NO_CK+"', "
- + " MEMOLAR='加项项目已引用'||'"+BATCH_NO_CK+"' "
- +" where t.SPECIMEN_NO='"+str+"' and t.PHY_CODE_L = 'HC' ";
- mapper.updateJudgeStatus(updateItem.toString());
- }
- }
-
- String strMemo = BATCH_NO+"修改成"+BATCH_NO_CK+"送样,取样编号:"+SPECIMEN_NO_CK;
- QcmJudgeOperateLog qjog = new QcmJudgeOperateLog();
- qjog.setOperate_name(parmas.get("USER_NAME").toString());
- qjog.setBatchno(BATCH_NO_CK);
- qjog.setOperate_type("修改LRA");
- qjog.setParams(MATERIAL_NO_CK);
- qjog.setProd_line(PLINE_CODE_CK);
- qjog.setJudge_result(DESIGN_KEY_CK);
- qjog.setMemo(strMemo);
- mapper.insertQcmJudgeOperateLog(qjog);
- } catch (Exception e) {
- SqlSession.rollback();
- SqlSession.close();
- cro.setV_errCode(-1);
- cro.setV_errMsg("修改失败!");
- return cro;
- }
- SqlSession.commit();
- SqlSession.close();
- return cro;
- }
-
-
- //预测换样
- public CoreReturnObject doForecastRZ(HashMap parmas) throws Exception {
- try {
- String sql="select * from qcm_jhy_sample_consign_d t where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.specimen_no ='"+parmas.get("SPECIMEN_NO")+"' "
- +" and t.rz_roll_mana_no is not null and t.status = '3' and rownum = 1";
- List<HashMap> hmap=mapper.query(sql.toString());
- if(hmap==null || hmap.size()<=0){
- cro.setV_errCode(-1);
- cro.setV_errMsg("未找到相应数据!");
- return cro;
- }
- String RZ_ROLL_MANA_NO = hmap.get(0).get("RZ_ROLL_MANA_NO").toString();//轧辊单元
- String RZ_MIXROLL = hmap.get(0).get("RZ_MIXROLL").toString();//组批区间
- String RZ_OLD_SAMPL_NO = hmap.get(0).get("RZ_OLD_SAMPL_NO").toString();//预测抽样卷
- String BATCH_NO = parmas.get("BATCH_NO").toString();//轧批号
- String INSPECTION_LOT = hmap.get(0).get("INSPECTION_LOT").toString();//检验号
-
- String sql2 = "select * from qcm_jhy_sample_consign_d t where t.RZ_ROLL_MANA_NO = '"+RZ_ROLL_MANA_NO+"' and t.rz_mixroll = '"+RZ_MIXROLL+"' "
- +" and t.Rz_Old_Sampl_No = '"+RZ_OLD_SAMPL_NO+"' and t.batch_no <>'"+BATCH_NO+"' and t.pline_code = 'RZ1' ";
- List<HashMap> hmap2=mapper.query(sql2.toString());
- if(hmap2==null || hmap2.size()<=0){
- cro.setV_errCode(-1);
- cro.setV_errMsg("未找到相应预测数据!");
- return cro;
- }
- for (int i = 0; i < hmap2.size(); i++) {
- HashMap obj=hmap2.get(i);
- String SMP_NO = obj.get("SMP_NO").toString();
- String SPECIMEN_NO = obj.get("SPECIMEN_NO").toString();
-
- //修改ORD表
- String ordUpSql="update QCM_JHY_SAMPLE_R_ORD ord set ord.judge_status = '0' where ord.pline_code = 'RZ1' and ord.smp_no = '"+SMP_NO+"' ";
- mapper.updateJudgeStatus(ordUpSql.toString());
-
- //修改D表
- String dUpSql = " update qcm_jhy_sample_consign_d t set t.status = '0' ,t.send_id = '',t.send_name = '',t.send_time = '', "
- + " t.RZ_ROLL_MANA_NO = '',t.rz_mixroll = '',t.Rz_Old_Sampl_No = '',t.RZ_ROLL_SLAB_SEQ = '',t.CONSIGN_NO = '', "
- + " t.CONSIGN_NO_SEQ = '' where t.SPECIMEN_NO = '"+SPECIMEN_NO+"' ";
- mapper.updateJudgeStatus(dUpSql.toString());
- }
-
- //修改D表
- String dUpSql = " update qcm_jhy_sample_consign_d t set t.SEND_MEMO = '预测换样' where t.SPECIMEN_NO = '"+parmas.get("SPECIMEN_NO")+"' ";
- mapper.updateJudgeStatus(dUpSql.toString());
-
- //预测抽样第一次不合格清除
- String millUpSql = "update tbf02_spec_mill t set MIXROLL='' where t.COIL_NO in ( "
- +" select COIL_NO from tbh02_coil_comm c where c.OLD_SAMPL_NO like '"+BATCH_NO+"%' )";
- mapper.updateJudgeStatus(millUpSql.toString());
-
- //查询预测下的所有子板
- String coilSelSql="select t.pic_is_lock,t.inspection_lot,t.COIL_NO from qcm_judge_coil_result t "
- +" where t.INSPECTION_LOT = '"+INSPECTION_LOT+"' and t.COIL_NO not like '"+BATCH_NO+"%' ";
- List<HashMap> hmap3=mapper.query(coilSelSql.toString());
- if(hmap3 != null && hmap3.size()>=1){
- for (int i = 0; i < hmap3.size(); i++) {
- HashMap obj=hmap3.get(i);
- String COIL_NO = obj.get("COIL_NO").toString();//子板号
-
- //异常处理界面解锁
- String lockUpSql="update qcm_judge_locking a set a.unlock_type_code = '9', a.unlock_type_desc = '解除' "
- +" where MATERIAL_NO ='"+COIL_NO+"' and unlock_type_code is null and lock_type_code = 'P' ";
- mapper.updateJudgeStatus(lockUpSql.toString());
-
- //热轧库存表解锁
- String coilUpSql="UPDATE qcm_judge_coil_result T SET T.PIC_IS_LOCK = '0' where t.COIL_NO = '"+COIL_NO+"' ";
- mapper.updateJudgeStatus(coilUpSql.toString());
- }
- }
-
-
- QcmJudgeOperateLog qjog = new QcmJudgeOperateLog();
- qjog.setOperate_name(parmas.get("USER_NAME").toString());
- qjog.setBatchno(BATCH_NO);
- qjog.setOperate_type("热轧预测换样");
- qjog.setParams(RZ_OLD_SAMPL_NO);
- qjog.setProd_line("RZ1");
- qjog.setMemo(RZ_ROLL_MANA_NO+":"+RZ_MIXROLL+":"+BATCH_NO +":"+parmas.get("SPECIMEN_NO").toString());
- mapper.insertQcmJudgeOperateLog(qjog);
-
- } catch (Exception e) {
- SqlSession.rollback();
- SqlSession.close();
- cro.setV_errCode(-1);
- cro.setV_errMsg("预测换样失败!");
- return cro;
- }
- SqlSession.commit();
- SqlSession.close();
- return cro;
- }
-
- //重置船检编号
- public CoreReturnObject upShipInspec(HashMap parmas) throws Exception {
- try {
- String cic= parmas.get("CERT_INST_CODE").toString();
- String uid= parmas.get("USERID").toString();
- String una= parmas.get("USERNAME").toString();
- // String YYMM= parmas.get("YYMM").toString();
- String upsql="update QCM_JHY_SHIP_INSPEC t set t.yn_log = '0' where t.Cert_Inst_Code = '"+cic+"' ";
- mapper.updateJudgeStatus(upsql.toString());
-
- String insql = "insert into qcm_jhy_ship_inspec "
- +" (cert_inst_code, cert_inst_name, pline_code, yymm,create_id, create_name, fh_log) "
- +" select t.cert_inst_code,t.cert_inst_name,t.pline_code,to_char(sysdate,'yymm'), "
- +" '"+uid+"','"+una+"',t.fh_log from qcm_jhy_ship_inspec t where t.Cert_Inst_Code = '"+cic+"' and rownum = 1 ";
- mapper.insert(insql);
-
- /*SimpleDateFormat sdf = new SimpleDateFormat("yyMM");
- String syh = sdf.format(new Date());
- String syh1=syh;*/
- String FH_LOG= parmas.get("FH_LOG").toString();//缩写
- // syh+=FH_LOG;
-
- /* if(!YYMM.equals(syh1)){
- YYMM+=FH_LOG;
- String uplog = "update QCM_JHY_SAMPLE_CONSIGN_D t set t.PRINT_SEQJLOT = '0' where t.PRINT_SEQJ like '"+YYMM+"%' and t.pline_code in ('ZB1','HB1') ";
- mapper.updateJudgeStatus(uplog.toString());
- }*/
- String uplog = "update QCM_JHY_SAMPLE_CONSIGN_D t set t.PRINT_SEQJLOT = '0' where t.PRINT_SEQJ like '"+FH_LOG+"%' and t.pline_code in ('ZB1','HB1') ";
- mapper.updateJudgeStatus(uplog.toString());
-
- SqlSession.commit();
- } catch (Exception e) {
- SqlSession.rollback();
- SqlSession.close();
- cro.setV_errCode(-1);
- cro.setV_errMsg("重置失败!");
- return cro;
- }
- cro.setV_errCode(1);
- cro.setV_errMsg("重置成功!");
- SqlSession.close();
- return cro;
- }
-
- //新增螺纹钢牌号
- public CoreReturnObject AddLWGSTEEL(HashMap parmas) throws Exception {
- try {
- String steel=parmas.get("STEEL").toString();
- String userid=parmas.get("USERID").toString();
- String username=parmas.get("USERNAME").toString();
- String sql="SELECT (max(T.SEQ) + 1) SEQ FROM QCM_JHY_STEEL T ";
- HashMap result=mapper.queryOne(sql.toString());
- BigDecimal seq=BigDecimal.ZERO;
- if (result!=null && result.get("SEQ")!=null ) {
- seq=(BigDecimal)result.get("SEQ");
- }
-
- String insql = "insert into QCM_JHY_STEEL "
- +" (SEQ, STEEL_NAME, REGULATION, CONTAIN,CREATE_ID, CREATE_NAME) "
- +" VALUES ('"+seq+"','"+steel+"','1','0','"+userid+"','"+username+"')";
- mapper.insert(insql);
-
- SqlSession.commit();
- } catch (Exception e) {
- SqlSession.rollback();
- SqlSession.close();
- cro.setV_errCode(-1);
- cro.setV_errMsg("增加失败!"+e.getMessage());
- return cro;
- }
- cro.setV_errCode(1);
- cro.setV_errMsg("增加成功");
- SqlSession.close();
- return cro;
- }
-
- //删除螺纹钢牌号
- public CoreReturnObject delLWGSTEEL(HashMap parmas) throws Exception {
- try {
- String steel=parmas.get("STEEL").toString();
- String userid=parmas.get("USERID").toString();
- String username=parmas.get("USERNAME").toString();
-
- String sql = "update QCM_JHY_STEEL t "
- +" set t.yn_log = '0',t.delete_id='"+userid+"',t.delete_name='"+username+"',t.delete_time=sysdate "
- +" where t.steel_name = '"+steel+"' ";
- mapper.updateJudgeStatus(sql.toString());
- SqlSession.commit();
- } catch (Exception e) {
- SqlSession.rollback();
- SqlSession.close();
- cro.setV_errCode(-1);
- cro.setV_errMsg("增加失败!"+e.getMessage());
- return cro;
- }
- cro.setV_errCode(1);
- cro.setV_errMsg("增加成功");
- SqlSession.close();
- return cro;
- }
-
- }
|