125793a0cb020a3335daefbf87f8fa3137d0c455.svn-base 250 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166
  1. package QCM.JHY01.JHY0102;
  2. import java.math.BigDecimal;
  3. import java.sql.CallableStatement;
  4. import java.sql.Connection;
  5. import java.sql.ResultSet;
  6. import java.sql.SQLException;
  7. import java.text.SimpleDateFormat;
  8. import java.util.ArrayList;
  9. import java.util.Date;
  10. import java.util.HashMap;
  11. import java.util.List;
  12. import java.util.TreeSet;
  13. import java.util.UUID;
  14. import org.apache.commons.lang.StringUtils;
  15. import org.apache.ibatis.session.SqlSession;
  16. import CoreFS.SA01.CoreIComponent;
  17. import CoreFS.SA06.CoreReturnObject;
  18. import QCM.COMMUNAL.VO.QcmJudgeLog;
  19. import QCM.COMMUNAL.VO.QcmJudgeOperateLog;
  20. import QCM.JHY01.VO.JhyQltyModel;
  21. import QCM.JHY01.VO.JhySampleDItemModel;
  22. import QCM.JHY01.VO.JhySampleDModel;
  23. import QCM.JHY01.VO.JhySampleMMdoel;
  24. import QCM.JHY01.VO.JhySampleOrdMdoel;
  25. import QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl;
  26. public class UpdateInfo extends CoreIComponent{
  27. CoreReturnObject cro = new CoreReturnObject();
  28. ResultSet rs = null;
  29. SqlSession SqlSession = QCM.COMMUNAL.SqlSessionBuilder.openSqlSession();
  30. QCM.COMMUNAL.OrderSqMapper mapper = SqlSession.getMapper(QCM.COMMUNAL.OrderSqMapper.class);
  31. /**
  32. * 修改热处理号 取样材料号 (作废)
  33. * @param materialInfo
  34. * @return
  35. * @throws Exception
  36. */
  37. public CoreReturnObject doAllUpdate(HashMap parmas) throws Exception {
  38. try {
  39. String rclState = "000000";
  40. /*String sqls= "";
  41. if(parmas.get("PLINE_CODE").equals("ZB1")){
  42. sqls = " select t.* from KCZ_TURNOFFLIST@xgcx t where t.BILLETID = '"+parmas.get("MATERIAL_NO")+"'"
  43. + " and t.rcl_state is not null ";
  44. }
  45. if(parmas.get("PLINE_CODE").equals("HB1")){
  46. sqls = " select t.* from KCH_TURNOFFLIST@xgcx t where t.BILLETID = '"+parmas.get("MATERIAL_NO")+"'"
  47. + " and t.rcl_state is not null ";
  48. }
  49. List<HashMap> tarMemo=mapper.query(sqls.toString());
  50. if (tarMemo!=null && tarMemo.size()>=1){
  51. if(StringUtils.isNotBlank(tarMemo.get(0).get("RCL_STATE").toString())){
  52. rclState = (String) tarMemo.get(0).get("RCL_STATE");
  53. }
  54. }
  55. if(rclState.equals("000000")){
  56. rclState=parmas.get("PROCESS_NOS").toString();
  57. }*/
  58. rclState=parmas.get("PROCESS_NOS").toString();
  59. String processNo ="";
  60. String sqlStr ="";
  61. //判断是否是模拟焊后
  62. 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' ";
  63. List<HashMap> map2=mapper.query(sqlmn.toString());
  64. if(map2!=null && map2.size()>=1){
  65. 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'";
  66. }else{
  67. sqlStr = "select * from QCM_JHY_SAMPLE_CONSIGN_D t"
  68. + " where t.BATCH_NO = '"+parmas.get("BATCH_NO")+"' "
  69. + " and t.SPECIMEN_NO = '"+parmas.get("SPECIMEN_NO")+"' "
  70. + " and t.SMP_NO = '"+parmas.get("SMP_NO")+"' ";
  71. }
  72. List<HashMap> map=mapper.query(sqlStr.toString());
  73. if(map !=null && map.size()>=1){
  74. String str = parmas.get("USER_NAME")+"修改热处理号为"+rclState;
  75. for (HashMap<String,String> hashMap : map) {
  76. sqlStr="";
  77. sqlStr="update QCM_JHY_SAMPLE_CONSIGN_D t set PROCESS_NOS='"+rclState+"',"
  78. + " MATERIAL_NO='"+parmas.get("MATERIAL_NO")+"',"
  79. + " ARTIFICIAL_MEMO=t.ARTIFICIAL_MEMO||',"+str+"'||'原委托热处理号为:'||t.PROCESS_NOS "
  80. + " where t.BATCH_NO = '"+hashMap.get("BATCH_NO")+"' "
  81. + " and t.SPECIMEN_NO = '"+hashMap.get("SPECIMEN_NO")+"' "
  82. + " and t.SMP_NO = '"+hashMap.get("SMP_NO")+"' ";
  83. mapper.updateJudgeStatus(sqlStr.toString());
  84. String strMemo = "取样编号:"+hashMap.get("SPECIMEN_NO")+str+",原委托热处理号为:"+hashMap.get("PROCESS_NOS")
  85. +"原子板号:"+hashMap.get("MATERIAL_NO")+"现子板号:"+parmas.get("MATERIAL_NO");
  86. QcmJudgeOperateLog qjog = new QcmJudgeOperateLog();
  87. qjog.setOperate_name(parmas.get("USER_NAME").toString());
  88. qjog.setBatchno(parmas.get("BATCH_NO") == null ?"":parmas.get("BATCH_NO").toString());
  89. qjog.setOperate_type("修改");
  90. qjog.setParams(parmas.get("MATERIAL_NO") == null ?"":parmas.get("MATERIAL_NO").toString());
  91. qjog.setProd_line(parmas.get("PLINE_CODE") == null ?"":parmas.get("PLINE_CODE").toString());
  92. qjog.setMemo(strMemo);
  93. mapper.insertQcmJudgeOperateLog(qjog);
  94. }
  95. }
  96. } catch (Exception e) {
  97. SqlSession.rollback();
  98. SqlSession.close();
  99. cro.setV_errCode(-1);
  100. cro.setV_errMsg("修改失败!");
  101. return cro;
  102. }
  103. SqlSession.commit();
  104. SqlSession.close();
  105. cro.setV_errCode(1);
  106. return cro;
  107. }
  108. /**
  109. * 修改取样材料号
  110. * @param materialInfo
  111. * @return
  112. * @throws Exception
  113. */
  114. public CoreReturnObject updateMaterialNo(ArrayList<String> smpNo,ArrayList<String> specimenNo,ArrayList<String> batchNo,ArrayList<String> materialNo, ArrayList<String> sendMemo,
  115. ArrayList<String> inspectionLot,ArrayList<String> plineCode) throws Exception {
  116. try {
  117. for (int i = 0; i < smpNo.size(); i++) {
  118. UpdateInfo uinfo= new UpdateInfo();
  119. uinfo.doPhyItem(specimenNo.get(i).toString());
  120. StringBuffer sqlucomm = new StringBuffer();
  121. if(plineCode.get(i).equals("ZB1") || plineCode.get(i).equals("HB1")){
  122. String mater = materialNo.get(i).toString();
  123. String boardNo=mater.substring(0,mater.lastIndexOf("."));
  124. sqlucomm.append(" update qcm_jhy_sample_consign_d set MATERIAL_NO = '"+materialNo.get(i)+"' ");
  125. sqlucomm.append(" , SEND_MEMO = '"+sendMemo.get(i)+"' ,BOARD_NO='"+boardNo+"' ");
  126. sqlucomm.append(" where SMP_NO = '"+smpNo.get(i)+"' and SPECIMEN_NO = '"+specimenNo.get(i)+"' ");
  127. sqlucomm.append(" and BATCH_NO = '"+batchNo.get(i)+"' ");
  128. this.getDao("testDao").ExcuteNonQuery(sqlucomm.toString());
  129. String mstr=" update QCM_JHY_SAMPLE_CONSIGN_M set MATERIAL_NO='"+materialNo.get(i)+"' ,BOARD_NO='"+boardNo+"' "
  130. + " where SMP_NO = '"+smpNo.get(i)+"' and BATCH_NO = '"+batchNo.get(i)+"' ";
  131. this.getDao("testDao").ExcuteNonQuery(mstr.toString());
  132. }else{
  133. sqlucomm.append(" update qcm_jhy_sample_consign_d set MATERIAL_NO = '"+materialNo.get(i)+"' ");
  134. sqlucomm.append(" , SEND_MEMO = '"+sendMemo.get(i)+"' ");
  135. sqlucomm.append(" where SMP_NO = '"+smpNo.get(i)+"' and SPECIMEN_NO = '"+specimenNo.get(i)+"' ");
  136. sqlucomm.append(" and BATCH_NO = '"+batchNo.get(i)+"' ");
  137. this.getDao("testDao").ExcuteNonQuery(sqlucomm.toString());
  138. }
  139. if(plineCode.get(i).equals("ZB1") || plineCode.get(i).equals("HB1")){
  140. String sqlAmemo="select * from qcm_jhy_sample_consign_d t where t.specimen_no = '"+specimenNo.get(i)+"' and t.Artificial_Memo like '%原委托热处理号%'";
  141. List<HashMap> hmAmemo=mapper.query(sqlAmemo.toString());
  142. 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')";
  143. List<HashMap> hmAmemo2=mapper.query(sqlAmemo2.toString());
  144. //中板线 厚板线热处理号
  145. if((plineCode.get(i).equals("ZB1") || plineCode.get(i).equals("HB1")) && hmAmemo.size()<=0 && hmAmemo2.size()>=1){
  146. String sqls= "";
  147. sqls="select r.rcl_state from (select t.RCL_STATE from KCZ_TURNOFFLIST@xgcx t where t.BILLETID = '"+materialNo.get(i)+"' "
  148. +" and t.rcl_state is not null "
  149. +" union "
  150. +" select t.RCL_STATE from KCH_TURNOFFLIST@xgcx t where t.BILLETID = '"+materialNo.get(i)+"' "
  151. +" and t.rcl_state is not null) r group by r.rcl_state order by r.rcl_state desc ";
  152. List<HashMap> tarMemo=mapper.query(sqls.toString());
  153. if (tarMemo!=null && tarMemo.size()>=1 && StringUtils.isNotBlank(tarMemo.get(0).get("RCL_STATE").toString())) {
  154. if(tarMemo.get(0).get("RCL_STATE").toString().contains("G")){
  155. continue;
  156. }
  157. //性能改善限制
  158. String sqlim =" select t.* from qcm_jhy_sample_consign_d t where t.specimen_no='"+specimenNo.get(i)+"' and IMPROVE_MEMO='性能改善' ";
  159. List<HashMap> hmim=mapper.query(sqlim.toString());
  160. if(hmim!=null && hmim.size()>=1){
  161. if(!tarMemo.get(0).get("RCL_STATE").toString().contains("G")){
  162. continue;
  163. }
  164. }
  165. if(tarMemo.get(0).get("RCL_STATE").toString().contains("G")){
  166. //19HJGP
  167. String sql =" select t.* from qcm_jhy_sample_consign_d t,qcm_jhy_sample_r_ord r "
  168. +" where t.smp_no = r.smp_no and r.design_key like '19HJGP%' "
  169. +" and t.freq_code<>'D' and t.specimen_no='"+specimenNo.get(i)+"' ";
  170. List<HashMap> hmap=mapper.query(sql.toString());
  171. if(hmap!=null && hmap.size()>=1){
  172. sqlucomm.setLength(0);
  173. 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")+"' ");
  174. sqlucomm.append(" where SMP_NO = '"+smpNo.get(i)+"' and SPECIMEN_NO = '"+specimenNo.get(i)+"' ");
  175. sqlucomm.append(" and BATCH_NO = '"+batchNo.get(i)+"' ");
  176. this.getDao("testDao").ExcuteNonQuery(sqlucomm.toString());
  177. }
  178. continue;
  179. }
  180. String sql ="select * from qcm_jhy_sample_consign_d where SMP_NO = '"+smpNo.get(i)+"' "
  181. + " and SPECIMEN_NO = '"+specimenNo.get(i)+"' and FREQ_CODE <> 'D' ";
  182. List<HashMap> hmap=mapper.query(sql.toString());
  183. if(hmap!=null && hmap.size()>=1){
  184. if(StringUtils.isNotBlank(hmap.get(0).get("FREQ_CODE").toString()) && !hmap.get(0).get("FREQ_CODE").equals("D")){
  185. sqlucomm.setLength(0);
  186. 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")+"' ");
  187. sqlucomm.append(" where SMP_NO = '"+smpNo.get(i)+"' and SPECIMEN_NO = '"+specimenNo.get(i)+"' ");
  188. sqlucomm.append(" and BATCH_NO = '"+batchNo.get(i)+"' ");
  189. this.getDao("testDao").ExcuteNonQuery(sqlucomm.toString());
  190. }
  191. }else{
  192. sql="";
  193. sql ="select t.* from QCM_JHY_SAMPLE_CONSIGN_D_ITEM t "
  194. +" where t.specimen_no = '"+specimenNo.get(i)+"' "
  195. +" and t.seq >= 50 "
  196. +" and t.phy_code_l <> 'HJ' ";
  197. hmap = null;
  198. hmap=mapper.query(sql.toString());
  199. if(hmap!=null && hmap.size()>=1){
  200. sql="";
  201. sql ="select * from qcm_jhy_sample_consign_d where SMP_NO = '"+smpNo.get(i)+"' "
  202. + " and SPECIMEN_NO = '"+specimenNo.get(i)+"' and SMP_TYPE_CODE in ('1','3','4') ";
  203. }else{
  204. sql="";
  205. sql ="select * from qcm_jhy_sample_consign_d where SMP_NO = '"+smpNo.get(i)+"' "
  206. + " and SPECIMEN_NO = '"+specimenNo.get(i)+"' and SMP_TYPE_CODE in ('3','4') ";
  207. }
  208. hmap = null;
  209. hmap=mapper.query(sql.toString());
  210. if(hmap!=null && hmap.size()>=1){
  211. sqlucomm.setLength(0);
  212. 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")+"' ");
  213. sqlucomm.append(" where SMP_NO = '"+smpNo.get(i)+"' and SPECIMEN_NO = '"+specimenNo.get(i)+"' ");
  214. sqlucomm.append(" and BATCH_NO = '"+batchNo.get(i)+"' ");
  215. this.getDao("testDao").ExcuteNonQuery(sqlucomm.toString());
  216. }
  217. }
  218. }else{
  219. sqlucomm.setLength(0);
  220. sqlucomm.append(" update qcm_jhy_sample_consign_d set PROCESS_NO = '000000' ");
  221. sqlucomm.append(" where SMP_NO = '"+smpNo.get(i)+"' and SPECIMEN_NO = '"+specimenNo.get(i)+"' ");
  222. sqlucomm.append(" and BATCH_NO = '"+batchNo.get(i)+"' ");
  223. this.getDao("testDao").ExcuteNonQuery(sqlucomm.toString());
  224. }
  225. }
  226. }
  227. //热轧 连退 复制 初样委托 选择物料号时 修改 相应的检验号
  228. /* if(plineCode.get(i).equals("RZ1") || plineCode.get(i).equals("LT1")){
  229. String sql = "update QCM_JUDGE_COIL_RESULT set INSPECTION_LOT = '"+inspectionLot.get(i)+"' "
  230. + " where COIL_NO = '"+materialNo.get(i)+"' ";
  231. this.getDao("testDao").ExcuteNonQuery(sql.toString());
  232. }*/
  233. }
  234. } catch (Exception e) {
  235. }
  236. SqlSession.close();
  237. return cro;
  238. }
  239. /**
  240. * 复样 修改轧批号
  241. * @param materialInfo
  242. * @return
  243. * @throws Exception
  244. */
  245. public CoreReturnObject updateBatchNo(ArrayList<String> smpNo,ArrayList<String> specimenNo,ArrayList<String> batchNo,ArrayList<String> materialNo, ArrayList<String> sendMemo,
  246. ArrayList<String> inspectionLot,ArrayList<String> plineCode) throws Exception {
  247. Connection conn = this.getDao("testDao").getConnection();
  248. try {
  249. String maxVal ="";
  250. String minVal = "";
  251. TreeSet<String> treeSet = new TreeSet<String>();
  252. TreeSet<String> treeSet2 = new TreeSet<String>();
  253. for (int i = 0; i < batchNo.size(); i++) {
  254. treeSet.add(batchNo.get(i));
  255. treeSet2.add(specimenNo.get(i));
  256. }
  257. if(treeSet2.size() != 1){
  258. cro.setV_errCode(-1);
  259. cro.setV_errMsg("请勾选一个轧批修改!不能同时修改两个轧批");
  260. return cro;
  261. }
  262. //判断是否是一个轧批号
  263. if(smpNo.size()>1){
  264. maxVal = treeSet.last();//最大值
  265. minVal = treeSet.first() ;//最小值
  266. }
  267. String sqlsp="select * from qcm_jhy_sample_consign_d t where t.specimen_no = '"+treeSet2.first()+"' and rownum=1 ";
  268. List<HashMap> sphm=mapper.query(sqlsp.toString());
  269. if(sphm!=null && sphm.size()>=1){
  270. if(treeSet.first().equals(sphm.get(0).get("BATCH_NO").toString())){
  271. cro.setV_errCode(-1);
  272. cro.setV_errMsg("修改轧批号不能修改为同轧号请核实修改数据!");
  273. return cro;
  274. }
  275. }
  276. for (int i = 0; i < smpNo.size(); i++) {
  277. String sqlno=" select r.* from qcm_jhy_sample_consign_d t,qcm_jhy_sample_r_ord r "
  278. +" where t.smp_no = r.smp_no and t.specimen_no = '"+specimenNo.get(i)+"' and rownum = 1 ";
  279. List<HashMap> listhm=mapper.query(sqlno.toString());
  280. String storage = "{CALL ZHB1_HJ_HEATNO_QUOTE(?,?,?,?,?)}";
  281. CallableStatement cstm = conn.prepareCall(storage);
  282. cstm.setString(1,batchNo.get(i));
  283. cstm.setString(2,smpNo.get(i));
  284. cstm.setString(3,specimenNo.get(i));
  285. cstm.setString(4,sendMemo.get(i));
  286. cstm.registerOutParameter(5,java.sql.Types.VARCHAR);
  287. cstm.execute();
  288. if(cstm.getString(5) != null){
  289. if(!cstm.getString(5).equals("1")){
  290. SqlSession.close();
  291. conn.close();
  292. cro.setV_errCode(-1);
  293. cro.setV_errMsg(cstm.getString(5).toString());
  294. return cro;
  295. }
  296. }
  297. cstm.close();
  298. //判断当前订单下是否还有复样
  299. if(listhm !=null && listhm.size()>=1){
  300. String DESIGN_KEY = listhm.get(0).get("DESIGN_KEY").toString();
  301. String INSPECTION_LOT = listhm.get(0).get("INSPECTION_LOT").toString();
  302. String BATCH_NO = listhm.get(0).get("BATCH_NO").toString();
  303. String sqlf="select r.* from qcm_jhy_sample_consign_d t,qcm_jhy_sample_r_ord r "
  304. +" where t.smp_no = r.smp_no and t.freq_code = 'D' and t.smp_type_code = '1' "
  305. +" and r.design_key = '"+DESIGN_KEY+"' and r.batch_no = '"+BATCH_NO+"' "
  306. +" and r.inspection_lot = '"+INSPECTION_LOT+"' and rownum = 1 ";
  307. List<HashMap> list2=mapper.query(sqlf.toString());
  308. if(list2 != null && list2.size()>=1){
  309. String sql2="select r.* from qcm_jhy_sample_consign_d t,qcm_jhy_sample_r_ord r "
  310. +" where t.smp_no = r.smp_no and t.freq_code = 'D' and t.smp_type_code = '0' "
  311. +" and r.design_key = '"+DESIGN_KEY+"' and r.batch_no = '"+BATCH_NO+"' "
  312. +" and r.inspection_lot = '"+INSPECTION_LOT+"' and rownum = 1 ";
  313. List<HashMap> list3=mapper.query(sql2.toString());
  314. if(list3 != null && list3.size()>=1){
  315. //有复样,但是初没有清空检验号
  316. String sql3 =" update QCM_JHY_SAMPLE_R_ORD set inspection_lot = '' "
  317. +" where SMP_NO = '"+list3.get(0).get("SMP_NO")+"' and batch_no = '"+list3.get(0).get("BATCH_NO")+"' ";
  318. mapper.updateJudgeStatus(sql3.toString());
  319. }
  320. }
  321. }
  322. SqlSession.commit();
  323. SqlSession.close();
  324. conn.close();
  325. cro.setV_errCode(1);
  326. cro.setV_errMsg("修改轧批号成功!");
  327. return cro;
  328. }
  329. /* for (int i = 0; i < smpNo.size(); i++) {
  330. //判断当前试样号是否有两个复样 如果一个试样号下有两个复样说明复样夹杂时 只有一个轧批号满足条件复样
  331. String smpNoDSql = " select * from qcm_jhy_sample_consign_d t "
  332. +" where t.smp_no = '"+smpNo.get(i)+"' "
  333. +" and t.smp_type_code = '1' "
  334. +" and t.freq_code = 'D' ";
  335. List<HashMap> smpNoDSqlhm=mapper.query(smpNoDSql.toString());
  336. if(smpNoDSqlhm !=null && smpNoDSqlhm.size()>=2){
  337. //当前修改的轧批号是否初样已判定
  338. String ordSql = "select r.* from qcm_jhy_sample_r_ord r,qcm_jhy_sample_consign_d t "
  339. +" where r.smp_no = t.smp_no "
  340. +" and t.SMP_TYPE_CODE = '0' "
  341. +" and r.batch_no = '"+batchNo.get(i)+"' "
  342. +" and r.judge_status = '0' ";
  343. List<HashMap> ordhm=mapper.query(ordSql.toString());
  344. if(ordhm !=null && ordhm.size()>=1){
  345. String storage = "{CALL ZHB1_HJ_HEATNO_QUOTE(?,?,?,?,?)}";
  346. CallableStatement cstm = conn.prepareCall(storage);
  347. cstm.setString(1,batchNo.get(i));
  348. cstm.setString(2,smpNo.get(i));
  349. cstm.setString(3,specimenNo.get(i));
  350. cstm.setString(4,sendMemo.get(i));
  351. cstm.registerOutParameter(5,java.sql.Types.VARCHAR);
  352. cstm.execute();
  353. if(cstm.getString(5) != null){
  354. if(!cstm.getString(5).equals("1")){
  355. SqlSession.close();
  356. conn.close();
  357. cro.setV_errCode(-1);
  358. cro.setV_errMsg(cstm.getString(5).toString());
  359. return cro;
  360. }
  361. }
  362. cstm.close();
  363. SqlSession.commit();
  364. SqlSession.close();
  365. conn.close();
  366. cro.setV_errCode(1);
  367. cro.setV_errMsg("修改轧批号成功!");
  368. //初样未判定
  369. //cro.setV_errCode(-1);
  370. //cro.setV_errMsg("轧批号【"+batchNo.get(i)+"】初样未判定,请选择其它轧批号");
  371. return cro;
  372. }else{
  373. String batchPline2 = batchNo.get(i).substring(0, 1);
  374. String batchPlines2 = batchPline2;
  375. String batchNoplieCode = "";
  376. if(batchPlines2.equals("Z")){
  377. batchNoplieCode = "ZB1";
  378. }else if (batchPlines2.equals("H")){
  379. batchNoplieCode = "HB1";
  380. }
  381. String smp_no = createQltySamNo(batchNoplieCode);//新试样号
  382. String specimen_no = createSpecimen_no(smp_no);//新取样材料号
  383. String delSmpNo = smpNo.get(i);//要删除的试样号
  384. String delSpecimenNo ="";
  385. 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 ";
  386. List<HashMap> sqlitemHM=mapper.query(sqlitem.toString());
  387. if(sqlitemHM==null || sqlitemHM.size()<=0){
  388. delSpecimenNo = specimenNo.get(i);//要删除的取样编号
  389. }else{
  390. sqlitem="";
  391. sqlitem = " select * from qcm_jhy_sample_consign_d t "
  392. +" where t.smp_no = '"+smpNo.get(i)+"' "
  393. +" and t.smp_type_code = '1' "
  394. +" and t.freq_code = 'D' and t.specimen_no<>'"+specimenNo.get(i)+"' ";
  395. sqlitemHM.clear();
  396. sqlitemHM=mapper.query(sqlitem.toString());
  397. if(sqlitemHM!=null && sqlitemHM.size()>=1){
  398. delSpecimenNo = sqlitemHM.get(0).get("SPECIMEN_NO").toString();//要删除的取样编号
  399. }else{
  400. delSpecimenNo = specimenNo.get(i);//要删除的取样编号
  401. }
  402. }
  403. String sql ="select * from qcm_jhy_sample_consign_d t "
  404. +" where t.smp_no = '"+delSmpNo+"' "
  405. +" and t.specimen_no = '"+delSpecimenNo+"' "
  406. +" and t.freq_code = 'D' "
  407. +" and t.smp_type_code = '1' ";
  408. List<HashMap> hmSql=mapper.query(sql.toString());
  409. if(hmSql!=null && hmSql.size()==1){
  410. //删除最开始的复样
  411. sql ="";
  412. sql =" delete from QCM_JHY_INSP_PHYSICS t where t.SPECIMEN_NO='"+delSpecimenNo+"' ";
  413. mapper.delete(sql.toString());
  414. sql ="";
  415. sql =" delete from QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where t.SPECIMEN_NO='"+delSpecimenNo+"' and t.SMP_NO='"+delSmpNo+"' ";
  416. mapper.delete(sql.toString());
  417. sql ="";
  418. sql =" delete from QCM_JHY_SAMPLE_CONSIGN_D t where t.SPECIMEN_NO='"+delSpecimenNo+"' and t.SMP_NO='"+delSmpNo+"' ";
  419. mapper.delete(sql.toString());
  420. //要修改成的轧批号初样的轧批信息
  421. sql ="";
  422. sql = "select t.* from qcm_jhy_sample_consign_d t "
  423. +" where t.SMP_TYPE_CODE = '0' "
  424. +" and t.batch_no = '"+batchNo.get(i)+"' "
  425. +" and t.freq_code = 'D' and rownum = 1 ";
  426. List<HashMap> ydhm=mapper.query(sql.toString());
  427. if(ydhm!=null && ydhm.size()>=1){
  428. sql = "";
  429. sql ="Insert into QCM_JHY_SAMPLE_CONSIGN_M(SMP_NO,HEAT_NO,BATCH_NO,INSPECTION_LOT,BOARD_NO,MATERIAL_NO,PSC, "
  430. +" PSC_DESC,SMP_CATG,CERT_INST_CODE,CERT_INST_NAME,SMP_TYPE_CODE,SMP_TYPE_NAME,GRADE_CODE,GRADE_NAME, "
  431. +" PLINE_CODE,PLINE_NAME,VALIDFLAG,MEMO,CREATE_ID,CREATE_NAME,CREATE_TIME,ITEM_FLAG,DUPLICATE_SAMPLE) "
  432. +" select '"+smp_no+"',HEAT_NO,BATCH_NO,INSPECTION_LOT,BOARD_NO,MATERIAL_NO,PSC, "
  433. +" PSC_DESC,SMP_CATG,CERT_INST_CODE,CERT_INST_NAME,SMP_TYPE_CODE,SMP_TYPE_NAME,GRADE_CODE,GRADE_NAME, "
  434. +" PLINE_CODE,PLINE_NAME,VALIDFLAG,MEMO,'sys','sys',sysdate,ITEM_FLAG,'复样' "
  435. +" from QCM_JHY_SAMPLE_CONSIGN_M t where t.SMP_NO = '"+ydhm.get(0).get("SMP_NO")+"'"
  436. + " and t.batch_no = '"+ydhm.get(0).get("BATCH_NO")+"' and rownum <= 1 ";
  437. mapper.insert(sql);
  438. sql = "";
  439. sql = "Insert into QCM_JHY_SAMPLE_R_ORD(DESIGN_KEY,SMP_NO,PSC,PSC_DESC,HEAT_NO,BATCH_NO,INSPECTION_LOT,DELIVERY_STATE_CODE, "
  440. + " DELIVERY_STATE_DESC,THICK,WIDTH,LENGTH,PLINE_CODE,PLINE_NAME,MSC_PLINE,PROCESS_CODE,CERT_INST_CODE,CERT_INST_NAME, "
  441. + " SMP_TYPE_CODE,SMP_TYPE_NAME,SMELTING_CNT,PRODUCT_CNT,ASSAY_NO_CP,ASSAY_NO_RL,CIC_ID,PHY_ID,JUDGE_STATUS,PROD_CODE,"
  442. + " PROD_NAME,STEEL_CODE,STEEL_NAME,STD_CODE,STD_NAME,CREATE_TIME,CREATE_ID,CREATE_NAME,DUPLICATE_SAMPLE) "
  443. + " select DESIGN_KEY,'"+smp_no+"',PSC,PSC_DESC,HEAT_NO,BATCH_NO,INSPECTION_LOT,DELIVERY_STATE_CODE,DELIVERY_STATE_DESC, "
  444. + " THICK,WIDTH,LENGTH,PLINE_CODE,PLINE_NAME,MSC_PLINE,PROCESS_CODE,CERT_INST_CODE,CERT_INST_NAME,SMP_TYPE_CODE,"
  445. + " SMP_TYPE_NAME,SMELTING_CNT,PRODUCT_CNT,ASSAY_NO_CP,ASSAY_NO_RL,CIC_ID,PHY_ID,'0',PROD_CODE,PROD_NAME,STEEL_CODE, "
  446. + " STEEL_NAME,STD_CODE,STD_NAME,sysdate,'sys','sys','复样' "
  447. + " from QCM_JHY_SAMPLE_R_ORD t where t.SMP_NO = '"+ydhm.get(0).get("SMP_NO")+"' "
  448. + " and t.batch_no = '"+ydhm.get(0).get("BATCH_NO")+"' and rownum <= 1 ";
  449. mapper.insert(sql);
  450. //把选中的初样轧批号 检验号置空
  451. sql ="";
  452. sql +=" update QCM_JHY_SAMPLE_R_ORD set inspection_lot = '' ";
  453. sql +=" where SMP_NO = '"+ydhm.get(0).get("SMP_NO")+"' and batch_no = '"+ydhm.get(0).get("BATCH_NO")+"' ";
  454. mapper.updateJudgeStatus(sql.toString());
  455. //插入D表
  456. sql = "";
  457. sql = "insert into qcm_jhy_sample_consign_d "
  458. +" (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) "
  459. +" select "
  460. +" '"+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,'复样修改轧批号' "
  461. +" from qcm_jhy_sample_consign_d t "
  462. +" 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";
  463. mapper.insert(sql);
  464. //插入ITEM表
  465. sql = "";
  466. sql = "insert into qcm_jhy_sample_consign_d_item "
  467. +" (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) "
  468. +" 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 "
  469. +" from qcm_jhy_sample_consign_d_item t where t.specimen_no = '"+ydhm.get(0).get("SPECIMEN_NO")+"' ";
  470. mapper.insert(sql);
  471. //复样 引用 当前轧批初样实绩
  472. //查询当前初样取样编号的所有实绩
  473. sql = "";
  474. sql = " select t.* from QCM_JHY_INSP_PHYSICS t "
  475. +" 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")+"' ) "
  476. + " order by t.SPECIMEN_NO asc, t.phy_code_l asc,t.phy_code_s asc ";
  477. List<HashMap> hmPhysics = mapper.query(sql.toString());
  478. //把初样的项目 放到 复样中
  479. for (HashMap hashMap1 : hmPhysics) {
  480. sql = "";
  481. sql = "select decode(max(seq),'','49',max(seq))+1 as SEQ from QCM_JHY_INSP_PHYSICS t "
  482. + " where t.specimen_no = '"+specimen_no+"'";
  483. List<HashMap> seqhm = mapper.query(sql.toString());
  484. BigDecimal big = (BigDecimal)seqhm.get(0).get("SEQ");
  485. String seqs = big.toString();
  486. Integer seqint = Integer.parseInt(seqs);
  487. sql = "";
  488. sql = " insert into QCM_JHY_INSP_PHYSICS "
  489. +" (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, "
  490. +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
  491. +" VAL13,VAL14,VAL15,AVG_VAL,GUID,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, "
  492. +" PHY_UNIT,MEMO,QUOTE_SPECIMEN_NO) "
  493. +" 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, "
  494. +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
  495. +" VAL13,VAL14,VAL15,AVG_VAL,GUID,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, "
  496. +" PHY_UNIT,MEMO,'"+(String)hashMap1.get("SPECIMEN_NO")+"' from QCM_JHY_INSP_PHYSICS t "
  497. + " where t.specimen_no = '"+(String)hashMap1.get("SPECIMEN_NO")+"' "
  498. + " and t.phy_code_l = '"+hashMap1.get("PHY_CODE_L")+"' "
  499. + " and t.phy_code_s = '"+hashMap1.get("PHY_CODE_S")+"' "
  500. + " and t.PHY_CODE_M = '"+hashMap1.get("PHY_CODE_M")+"' "
  501. + " and t.test_qty = '"+hashMap1.get("TEST_QTY")+"' ";
  502. mapper.insert(sql);
  503. sql = "";
  504. sql = "insert into QCM_JHY_SAMPLE_CONSIGN_D_ITEM "
  505. +" (SPECIMEN_NO,SEQ,SMP_NO,PHY_NAME_L,PHY_CODE_L,PHY_CODE_M,PHY_NAME_M,PHY_CODE_S,PHY_NAME_S, "
  506. +" ITEM_CODE_D,ITEM_NAME_D,ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,ITEM_CODE_L,ITEM_DESC_L, "
  507. +" STDMIN_SIGN,STDMIN,STDMAX_SIGN,STDMAX,TEST_QTY,SMP_QTY,SPECL_FL,ISJUDGE,JUDGE_BASIS,PHY_UNIT,GROUP_SEQ, "
  508. +" QUOTE_SPECIMEN_NO,QUOTE_SEQ,ITEM_FLAG,MEMO,CREATE_ID,CREATE_NAME,CREATE_TIME,STDMEMO,RESMP_SEQ, "
  509. +" PHY_GROUP_CODE,FY_QUOTE_SPECIMEN_NO) "
  510. +" select '"+specimen_no+"','"+seqint+"','"+smp_no+"',PHY_NAME_L,PHY_CODE_L,PHY_CODE_M,PHY_NAME_M,PHY_CODE_S,PHY_NAME_S, "
  511. +" ITEM_CODE_D,ITEM_NAME_D,ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,ITEM_CODE_L,ITEM_DESC_L, "
  512. +" STDMIN_SIGN,STDMIN,STDMAX_SIGN,STDMAX,TEST_QTY,SMP_QTY,SPECL_FL,ISJUDGE,JUDGE_BASIS,PHY_UNIT,GROUP_SEQ, "
  513. +" QUOTE_SPECIMEN_NO,QUOTE_SEQ,ITEM_FLAG,MEMO,CREATE_ID,CREATE_NAME,CREATE_TIME,STDMEMO,RESMP_SEQ, "
  514. +" PHY_GROUP_CODE,'"+(String)hashMap1.get("SPECIMEN_NO")+"' from QCM_JHY_SAMPLE_CONSIGN_D_ITEM "
  515. + " where specimen_no = '"+(String)hashMap1.get("SPECIMEN_NO")+"' "
  516. + " and phy_code_l = '"+hashMap1.get("PHY_CODE_L")+"' "
  517. + " and PHY_CODE_M = '"+hashMap1.get("PHY_CODE_M")+"' "
  518. + " and phy_code_s = '"+hashMap1.get("PHY_CODE_S")+"' ";
  519. mapper.insert(sql);
  520. }
  521. }else{
  522. cro.setV_errCode(-1);
  523. cro.setV_errMsg("轧批号【"+batchNo.get(i)+"】未找到初样信息");
  524. return cro;
  525. }
  526. }
  527. }
  528. continue;
  529. }
  530. //查找复样的原本轧批号
  531. String dsql = "select t.BATCH_NO,t.HEAT_NO,t.smp_no from QCM_JHY_SAMPLE_CONSIGN_D t where "
  532. + " t.SPECIMEN_NO = '"+specimenNo.get(i)+"' and t.SMP_TYPE_CODE= '1' ";
  533. List<HashMap> SampleD=mapper.query(dsql.toString());
  534. if (SampleD == null || SampleD.size()<0) {
  535. cro.setV_errCode(-1);
  536. cro.setV_errMsg("没有找到相应的复样轧批号【"+batchNo.get(i)+"】");
  537. return cro;
  538. }
  539. dsql ="";
  540. dsql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D t where t.smp_no = '"+smpNo.get(i)+"' "
  541. + " and t.smp_type_code='0' and t.freq_code<>'D' ";
  542. List<HashMap> SampleD2=mapper.query(dsql.toString());
  543. if(SampleD2 != null && SampleD2.size()>=1){
  544. String storage = "{CALL ZHB1_HJ_HEATNO_QUOTE(?,?,?,?,?)}";
  545. CallableStatement cstm = conn.prepareCall(storage);
  546. cstm.setString(1,batchNo.get(i));
  547. cstm.setString(2,smpNo.get(i));
  548. cstm.setString(3,specimenNo.get(i));
  549. cstm.setString(4,sendMemo.get(i));
  550. cstm.registerOutParameter(5,java.sql.Types.VARCHAR);
  551. cstm.execute();
  552. if(cstm.getString(5) != null){
  553. if(!cstm.getString(5).equals("1")){
  554. SqlSession.close();
  555. conn.close();
  556. cro.setV_errCode(-1);
  557. cro.setV_errMsg(cstm.getString(5).toString());
  558. return cro;
  559. }
  560. }
  561. cstm.close();
  562. SqlSession.commit();
  563. SqlSession.close();
  564. conn.close();
  565. cro.setV_errCode(1);
  566. cro.setV_errMsg("修改轧批号成功!");
  567. return cro;
  568. }
  569. //查询当前轧批ord表
  570. dsql ="";
  571. 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,"
  572. + " 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,"
  573. + " 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,"
  574. + " r.steel_code,r.steel_name,r.std_code,r.std_name,r.DESIGN_KEY"
  575. + " from qcm_jhy_sample_consign_d d,qcm_jhy_sample_consign_m m,qcm_jhy_sample_r_ord r "
  576. +" where d.smp_no = m.smp_no "
  577. +" and d.smp_no = r.smp_no "
  578. +" and m.smp_no = r.smp_no "
  579. +" and r.batch_no = '"+batchNo.get(i)+"' and d.Freq_Code = 'D' and d.smp_type_code='0' and rownum = 1 ";
  580. List<HashMap> map=mapper.query(dsql.toString());
  581. if(map == null || map.size()<=0){
  582. cro.setV_errCode(-1);
  583. cro.setV_errMsg("没有查找到当前要修改的轧批的信息!!!");
  584. return cro;
  585. }
  586. String sql ="";
  587. sql +=" update QCM_JHY_SAMPLE_CONSIGN_M set BATCH_NO = '"+batchNo.get(i)+"',inspection_lot = '"+batchNo.get(i)+"0001',"
  588. + " BOARD_NO='"+map.get(0).get("BOARD_NO")+"',PSC='"+map.get(0).get("PSC")+"', PSC_DESC='"+map.get(0).get("PSC_DESC")+"',"
  589. + " CERT_INST_CODE='"+map.get(0).get("CERT_INST_CODE")+"',CERT_INST_NAME='"+map.get(0).get("CERT_INST_NAME")+"',"
  590. + " GRADE_CODE='"+map.get(0).get("GRADE_CODE")+"',GRADE_NAME='"+map.get(0).get("GRADE_NAME")+"',"
  591. + " PLINE_CODE='"+map.get(0).get("PLINE_CODE")+"',PLINE_NAME='"+map.get(0).get("PLINE_NAME")+"',"
  592. + " MATERIAL_NO='"+map.get(0).get("MATERIAL_NO")+"'";
  593. sql +=" where SMP_NO = '"+smpNo.get(i)+"' ";
  594. mapper.updateJudgeStatus(sql.toString());
  595. sql ="";
  596. sql +=" update QCM_JHY_SAMPLE_R_ORD set BATCH_NO = '"+batchNo.get(i)+"' ,INSPECTION_LOT = '"+batchNo.get(i)+"0001',"
  597. + "PSC='"+map.get(0).get("PSC")+"', PSC_DESC='"+map.get(0).get("PSC_DESC")+"',"
  598. + "DELIVERY_STATE_CODE='"+map.get(0).get("DELIVERY_STATE_CODE")+"',DELIVERY_STATE_DESC='"+map.get(0).get("DELIVERY_STATE_DESC")+"', "
  599. + "THICK='"+map.get(0).get("THICK")+"', WIDTH='"+map.get(0).get("WIDTH")+"', LENGTH='"+map.get(0).get("LENGTH")+"',"
  600. + "PLINE_CODE='"+map.get(0).get("PLINE_CODE")+"',PLINE_NAME='"+map.get(0).get("PLINE_NAME")+"',"
  601. + "CERT_INST_CODE='"+map.get(0).get("CERT_INST_CODE")+"',CERT_INST_NAME='"+map.get(0).get("CERT_INST_NAME")+"', "
  602. + "PROD_CODE='"+map.get(0).get("PROD_CODE")+"',PROD_NAME='"+map.get(0).get("PROD_NAME")+"',"
  603. + "STEEL_CODE='"+map.get(0).get("STEEL_CODE")+"',STEEL_NAME='"+map.get(0).get("STEEL_NAME")+"',"
  604. + "STD_CODE='"+map.get(0).get("STD_CODE")+"',STD_NAME='"+map.get(0).get("STD_NAME")+"',"
  605. + "DESIGN_KEY='"+map.get(0).get("DESIGN_KEY")+"' ";
  606. sql +=" where SMP_NO = '"+smpNo.get(i)+"' ";
  607. mapper.updateJudgeStatus(sql.toString());
  608. //把选中的初样轧批号 检验号置空
  609. sql ="";
  610. sql +=" update QCM_JHY_SAMPLE_R_ORD set inspection_lot = '' ";
  611. sql +=" where SMP_NO in (select SMP_NO from QCM_JHY_SAMPLE_CONSIGN_D "
  612. + " where BATCH_NO = '"+batchNo.get(i)+"' and freq_code = 'D' AND smp_type_code='0' ) ";
  613. mapper.updateJudgeStatus(sql.toString());
  614. //把换下来的初样轧批号 检验号返回原来的检验号
  615. for (HashMap hm : SampleD) {
  616. sql ="";
  617. sql +=" update QCM_JHY_SAMPLE_R_ORD set inspection_lot = '"+hm.get("BATCH_NO")+"0001' ";
  618. sql +=" where BATCH_NO in (select batch_no from QCM_JHY_SAMPLE_CONSIGN_D "
  619. + " where BATCH_NO = '"+hm.get("BATCH_NO")+"' and freq_code = 'D' AND smp_type_code='0' ) ";
  620. mapper.updateJudgeStatus(sql.toString());
  621. }
  622. String batchPline2 = batchNo.get(i).substring(0, 1);
  623. String batchPlines2 = batchPline2;
  624. String batchNoplieCode = "";
  625. if(batchPlines2.equals("Z")){
  626. batchNoplieCode = "ZB1";
  627. }else if (batchPlines2.equals("H")){
  628. batchNoplieCode = "HB1";
  629. }
  630. if(batchNoplieCode.equals("HB1")){
  631. //厚
  632. sql ="";
  633. sql = "select BILLETID as MATERIAL_NO from kch_turnofflist@xgcx where BILLETID like '"+batchNo.get(i)+"'||'%' and rownum=1 ";
  634. }else if(batchNoplieCode.equals("ZB1")){
  635. //中
  636. sql ="";
  637. sql = "select BILLETID as MATERIAL_NO from kcz_turnofflist@xgcx where BILLETID like '"+batchNo.get(i)+"'||'%' and rownum=1 ";
  638. }
  639. List<HashMap> listEle= mapper.query(sql.toString());
  640. String VmaterialNo = "";
  641. if(listEle!=null && listEle.size()>=1){
  642. VmaterialNo = listEle.get(0).get("MATERIAL_NO").toString();
  643. }
  644. //换成修改的轧批号
  645. sql ="";
  646. sql +=" update QCM_JHY_SAMPLE_CONSIGN_D set BATCH_NO = '"+batchNo.get(i)+"',inspection_lot = '"+batchNo.get(i)+"0001',MATERIAL_NO='"+VmaterialNo+"',"
  647. + " FREQ_CODE='"+map.get(0).get("FREQ_CODE")+"',FREQ_NAME='"+map.get(0).get("FREQ_NAME")+"',"
  648. + " SMP_LOCATION='"+map.get(0).get("SMP_LOCATION")+"',BOARD_NO='"+map.get(0).get("BOARD_NO")+"',"
  649. + " PLINE_CODE='"+map.get(0).get("PLINE_CODE")+"',PLINE_NAME='"+map.get(0).get("PLINE_NAME")+"',"
  650. + " process_no='"+map.get(0).get("process_no")+"',PROCESS_NOS='"+map.get(0).get("PROCESS_NOS")+"' ";
  651. sql +=" where SMP_NO = '"+smpNo.get(i)+"' and SPECIMEN_NO = '"+specimenNo.get(i)+"' ";
  652. mapper.updateJudgeStatus(sql.toString());
  653. //删除当前复样的初样
  654. sql ="";
  655. sql +=" delete from QCM_JHY_INSP_PHYSICS t where t.SPECIMEN_NO='"+specimenNo.get(i)+"' and t.SEQ >= 50 ";
  656. mapper.delete(sql.toString());
  657. sql ="";
  658. sql +=" delete from QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where t.SPECIMEN_NO='"+specimenNo.get(i)+"' and t.SEQ >= 50 ";
  659. mapper.delete(sql.toString());
  660. //复样 引用 当前轧批初样实绩
  661. //查询当前初样取样编号的所有实绩
  662. sql = "";
  663. sql = " select t.* from QCM_JHY_INSP_PHYSICS t "
  664. +" 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")+"' ) "
  665. + " order by t.SPECIMEN_NO asc, t.phy_code_l asc,t.phy_code_s asc ";
  666. List<HashMap> hmPhysics = mapper.query(sql.toString());
  667. //把初样的项目 放到 复样中
  668. for (HashMap hashMap1 : hmPhysics) {
  669. sql = "";
  670. sql = "select decode(max(seq),'','49',max(seq))+1 as SEQ from QCM_JHY_INSP_PHYSICS t "
  671. + " where t.specimen_no = '"+specimenNo.get(i)+"'";
  672. List<HashMap> seqhm = mapper.query(sql.toString());
  673. BigDecimal big = (BigDecimal)seqhm.get(0).get("SEQ");
  674. String seqs = big.toString();
  675. Integer seqint = Integer.parseInt(seqs);
  676. sql = "";
  677. sql = " insert into QCM_JHY_INSP_PHYSICS "
  678. +" (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, "
  679. +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
  680. +" VAL13,VAL14,VAL15,AVG_VAL,GUID,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, "
  681. +" PHY_UNIT,MEMO,QUOTE_SPECIMEN_NO,QUOTE_STATUS) "
  682. +" 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, "
  683. +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
  684. +" VAL13,VAL14,VAL15,AVG_VAL,GUID,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, "
  685. +" PHY_UNIT,MEMO,'"+(String)hashMap1.get("SPECIMEN_NO")+"','0' from QCM_JHY_INSP_PHYSICS t "
  686. + " where t.specimen_no = '"+(String)hashMap1.get("SPECIMEN_NO")+"' "
  687. + " and t.phy_code_l = '"+hashMap1.get("PHY_CODE_L")+"' "
  688. + " and t.phy_code_s = '"+hashMap1.get("PHY_CODE_S")+"' "
  689. + " and t.PHY_CODE_M = '"+hashMap1.get("PHY_CODE_M")+"' "
  690. + " and t.test_qty = '"+hashMap1.get("TEST_QTY")+"' ";
  691. mapper.insert(sql);
  692. sql = "";
  693. sql = "insert into QCM_JHY_SAMPLE_CONSIGN_D_ITEM "
  694. +" (SPECIMEN_NO,SEQ,SMP_NO,PHY_NAME_L,PHY_CODE_L,PHY_CODE_M,PHY_NAME_M,PHY_CODE_S,PHY_NAME_S, "
  695. +" ITEM_CODE_D,ITEM_NAME_D,ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,ITEM_CODE_L,ITEM_DESC_L, "
  696. +" STDMIN_SIGN,STDMIN,STDMAX_SIGN,STDMAX,TEST_QTY,SMP_QTY,SPECL_FL,ISJUDGE,JUDGE_BASIS,PHY_UNIT,GROUP_SEQ, "
  697. +" QUOTE_SPECIMEN_NO,QUOTE_SEQ,ITEM_FLAG,MEMO,CREATE_ID,CREATE_NAME,CREATE_TIME,STDMEMO,RESMP_SEQ, "
  698. +" PHY_GROUP_CODE,FY_QUOTE_SPECIMEN_NO,FY_QUOTE_STATUS) "
  699. +" 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, "
  700. +" ITEM_CODE_D,ITEM_NAME_D,ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,ITEM_CODE_L,ITEM_DESC_L, "
  701. +" STDMIN_SIGN,STDMIN,STDMAX_SIGN,STDMAX,TEST_QTY,SMP_QTY,SPECL_FL,ISJUDGE,JUDGE_BASIS,PHY_UNIT,GROUP_SEQ, "
  702. +" QUOTE_SPECIMEN_NO,QUOTE_SEQ,ITEM_FLAG,MEMO,CREATE_ID,CREATE_NAME,CREATE_TIME,STDMEMO,RESMP_SEQ, "
  703. +" PHY_GROUP_CODE,'"+(String)hashMap1.get("SPECIMEN_NO")+"','0' from QCM_JHY_SAMPLE_CONSIGN_D_ITEM "
  704. + " where specimen_no = '"+(String)hashMap1.get("SPECIMEN_NO")+"' "
  705. + " and phy_code_l = '"+hashMap1.get("PHY_CODE_L")+"' "
  706. + " and PHY_CODE_M = '"+hashMap1.get("PHY_CODE_M")+"' "
  707. + " and phy_code_s = '"+hashMap1.get("PHY_CODE_S")+"' ";
  708. mapper.insert(sql);
  709. }
  710. }*/
  711. } catch (Exception e) {
  712. SqlSession.rollback();
  713. SqlSession.close();
  714. cro.setV_errCode(-1);
  715. cro.setV_errMsg("修改轧批号失败!");
  716. return cro;
  717. }
  718. SqlSession.commit();
  719. SqlSession.close();
  720. conn.close();
  721. cro.setV_errCode(1);
  722. cro.setV_errMsg("修改轧批号成功!");
  723. return cro;
  724. }
  725. /**
  726. * 初样 修改取样轧批号按炉
  727. * @param materialInfo
  728. * @return
  729. * @throws Exception
  730. */
  731. public CoreReturnObject DoUpRefBatchNo(ArrayList<String> smpNo,ArrayList<String> specimenNo,ArrayList<String> batchNo,ArrayList<String> heatnNo,
  732. ArrayList<String> materialNo, ArrayList<String> sendMemo,ArrayList<String> inspectionLot,ArrayList<String> plineCode) throws Exception {
  733. try {
  734. TreeSet<String> treeSet = new TreeSet<String>();
  735. for (int i = 0; i < batchNo.size(); i++) {
  736. treeSet.add(batchNo.get(i));
  737. }
  738. if(treeSet.size() != 1){
  739. cro.setV_errCode(-1);
  740. cro.setV_errMsg("只能按同炉修改取样轧批号,请一个轧批一个轧批修改");
  741. return cro;
  742. }
  743. //判断该轧批号有没有生成委托
  744. String dsql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D t where "
  745. + " t.BATCH_NO = '"+batchNo.get(0)+"' and t.SMP_TYPE_CODE= '0' and t.freq_code = 'D' and rownum <= 1";
  746. List<HashMap> SampleD=mapper.query(dsql.toString());
  747. if (SampleD == null || SampleD.size()<0) {
  748. cro.setV_errCode(-1);
  749. cro.setV_errMsg("轧批号【'"+batchNo.get(0)+"'】按炉取样还未生成委托!");
  750. return cro;
  751. }
  752. for (int i = 0; i < treeSet.size(); i++) {
  753. //查到当前轧批的取样编号
  754. String selsql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D t where "
  755. + " t.SMP_NO = '"+smpNo.get(i)+"' and t.SMP_TYPE_CODE= '0' and t.freq_code = 'D' and rownum <= 1 ";
  756. List<HashMap> selhmbno=mapper.query(selsql.toString());
  757. if(selhmbno!=null && selhmbno.size()>=1){
  758. if(selhmbno.get(0).get("BATCH_NO").toString().equals(batchNo.get(i))){
  759. cro.setV_errCode(-1);
  760. cro.setV_errMsg("同轧批修改!无效操作!");
  761. return cro;
  762. }
  763. }
  764. //查到当前轧批的取样编号
  765. String sNOsql = "select t.SPECIMEN_NO from QCM_JHY_SAMPLE_CONSIGN_D t where "
  766. + " t.BATCH_NO = '"+batchNo.get(0)+"' and t.SMP_TYPE_CODE= '0' and t.freq_code = 'D' and rownum <= 1 ";
  767. List<HashMap> fYspecimenNo=mapper.query(sNOsql.toString());
  768. String logmemo = specimenNo.get(i)+','+materialNo.get(i)+"初样夹杂修改成"+batchNo.get(i);
  769. String sql3= "INSERT INTO QCM_JUDGE_OPERATE_LOG (OPERATE_TYPE,PARAMS,OPERATE_NAME,PROD_LINE,BATCHNO,MEMO) "
  770. + " VALUES('初样修改夹杂接口','"+materialNo.get(i)+"','createQtlySample','"+plineCode.get(i)+"',"
  771. + " '"+batchNo.get(i)+"','"+logmemo+"') ";
  772. mapper.insert(sql3);
  773. //修改引用取样编号 当前
  774. String sql =" update QCM_JHY_SAMPLE_CONSIGN_D "
  775. + " set QUOTE_CONSIGN_NO = '' , STATUS = '0', SEND_ID='',SEND_NAME = '',SEND_TIME = '' ";
  776. sql +=" where SPECIMEN_NO = '"+fYspecimenNo.get(0).get("SPECIMEN_NO")+"' ";
  777. //this.getDao("testDao").ExcuteNonQuery(sql.toString());
  778. mapper.updateJudgeStatus(sql.toString());
  779. sql = "";
  780. sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM set QUOTE_SPECIMEN_NO = '' ";
  781. sql +=" where SPECIMEN_NO = '"+fYspecimenNo.get(0).get("SPECIMEN_NO")+"' ";
  782. //this.getDao("testDao").ExcuteNonQuery(sql.toString());
  783. mapper.updateJudgeStatus(sql.toString());
  784. //修改其它引用轧批
  785. sql = "";
  786. sql =" update QCM_JHY_SAMPLE_CONSIGN_D "
  787. + " set QUOTE_CONSIGN_NO = '"+fYspecimenNo.get(0).get("SPECIMEN_NO")+"' , STATUS = '1', SEND_ID='sys',SEND_NAME = '引用发送',SEND_TIME = sysdate ";
  788. sql +=" where HEAT_NO = '"+heatnNo.get(0)+"' and SPECIMEN_NO <> '"+fYspecimenNo.get(0).get("SPECIMEN_NO")+"' and freq_code = 'D' ";
  789. //this.getDao("testDao").ExcuteNonQuery(sql.toString());
  790. mapper.updateJudgeStatus(sql.toString());
  791. //查询当前炉号的引用取样编号
  792. String sNOsqls = "select t.SPECIMEN_NO from QCM_JHY_SAMPLE_CONSIGN_D t "
  793. + " where HEAT_NO = '"+heatnNo.get(0)+"' and SPECIMEN_NO <> '"+fYspecimenNo.get(0).get("SPECIMEN_NO")+"' and freq_code = 'D' ";
  794. List<HashMap> listhm=mapper.query(sNOsqls.toString());
  795. if (listhm != null && listhm.size()>0) {
  796. for (HashMap hashMap : listhm) {
  797. sql = "";
  798. sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM set QUOTE_SPECIMEN_NO = '"+fYspecimenNo.get(0).get("SPECIMEN_NO")+"' ";
  799. sql +=" where SPECIMEN_NO = '"+hashMap.get("SPECIMEN_NO")+"' ";
  800. //this.getDao("testDao").ExcuteNonQuery(sql.toString());
  801. mapper.updateJudgeStatus(sql.toString());
  802. }
  803. }
  804. }
  805. } catch (Exception e) {
  806. SqlSession.rollback();
  807. SqlSession.close();
  808. cro.setV_errCode(-1);
  809. cro.setV_errMsg("修改轧批号失败!");
  810. return cro;
  811. }
  812. SqlSession.commit();
  813. SqlSession.close();
  814. cro.setV_errCode(1);
  815. cro.setV_errMsg("修改轧批号成功!");
  816. return cro;
  817. }
  818. /**
  819. * 删除检验项 检验委托明细项目表
  820. * @param materialInfo
  821. * @return
  822. * @throws Exception
  823. */
  824. public CoreReturnObject deleteInfo(String seq,String specimenNo) throws Exception {
  825. try {
  826. StringBuffer sqlucomm = new StringBuffer();
  827. sqlucomm.append(" delete from qcm_jhy_sample_consign_d_item ");
  828. sqlucomm.append(" where SPECIMEN_NO = '"+specimenNo+"' and SEQ = '"+seq+"' ");
  829. this.getDao("testDao").ExcuteNonQuery(sqlucomm.toString());
  830. } catch (Exception e) {
  831. cro.setV_errCode(-1);
  832. cro.setV_errMsg("删除失败!");
  833. return cro;
  834. }
  835. cro.setV_errCode(1);
  836. cro.setV_errMsg("删除成功!");
  837. return cro;
  838. }
  839. /**
  840. * 删除委托
  841. * @param materialInfo
  842. * @return
  843. * @throws Exception
  844. */
  845. public CoreReturnObject DoDelete(ArrayList<String> batchNo,ArrayList<String> designKey,ArrayList<String> smpNo,ArrayList<String> specimenNo,ArrayList<String> smpTypeName,String userName) throws Exception {
  846. try {
  847. Integer num = 0;
  848. TreeSet<String> treeSet = new TreeSet<String>();
  849. for(String batchNoVal : batchNo){
  850. if(StringUtils.isBlank(batchNoVal)){
  851. cro.setV_errCode(-1);
  852. cro.setV_errMsg("轧批号为空!!!");
  853. return cro;
  854. }
  855. treeSet.add(batchNoVal);
  856. num++;
  857. }
  858. if(treeSet.size()>1){
  859. cro.setV_errCode(-1);
  860. cro.setV_errMsg("只能删除同轧批号的委托!!!");
  861. return cro;
  862. }
  863. //件件取样
  864. /* for(int i=0;i<specimenNo.size();i++){
  865. String specimen = specimenNo.get(i);
  866. 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+"' ";
  867. List<HashMap> hm=mapper.query(jsql.toString());
  868. if(hm != null && hm.size()>=1){
  869. for (HashMap hmap : hm) {
  870. String spmNo= hmap.get("SMP_NO").toString();
  871. //删除 检验委托明细项目表
  872. String sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where t.specimen_no= '"+specimen+"' ";
  873. mapper.delete(sql.toString());
  874. //删除 检验委托明细表
  875. sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_D t where t.specimen_no= '"+specimen+"' ";
  876. mapper.delete(sql.toString());
  877. //删除 检验委托主表
  878. sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_M t where t.smp_no = '"+spmNo+"' ";
  879. mapper.delete(sql.toString());
  880. //删除 试样号与合同信息关系表
  881. sql = "DELETE QCM_JHY_SAMPLE_R_ORD t where t.smp_no = '"+spmNo+"' ";
  882. mapper.delete(sql.toString());
  883. }
  884. }
  885. }*/
  886. for(int i=0;i<batchNo.size();i++){
  887. if(smpTypeName.get(i).equals("件件取样")){
  888. cro.setV_errCode(-1);
  889. cro.setV_errMsg("件件取样暂时不支持删除!!!");
  890. return cro;
  891. }
  892. /* if(smpTypeName.get(i).equals("件件取样")){
  893. continue;
  894. }
  895. 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)+"' ";
  896. List<HashMap> hm=mapper.query(jsql.toString());
  897. if(hm != null && hm.size()>=1){
  898. continue;
  899. }*/
  900. //线棒限制
  901. String BCGX="select t.* from QCM_JHY_SAMPLE_CONSIGN_D t where "
  902. + " t.SPECIMEN_NO = '"+specimenNo.get(i)+"' and t.pline_code in ('BC2','GX1','GX2') and rownum = 1 ";
  903. List<HashMap> bcgxhm=mapper.query(BCGX.toString());
  904. if (bcgxhm != null && bcgxhm.size()>=1) {
  905. String BATCH_NO_BCGX = bcgxhm.get(0).get("BATCH_NO").toString();
  906. String INSPECTION_LOT_BCGX= bcgxhm.get(0).get("INSPECTION_LOT").toString();
  907. String BCGX2=" select * from qcm_jhy_sample_r_ord r "
  908. + " where r.batch_no = '"+BATCH_NO_BCGX+"' and r.inspection_lot = '"+INSPECTION_LOT_BCGX+"' "
  909. + " and r.judge_status = '1' and r.inspection_lot is not null ";
  910. List<HashMap> bcgxhm2=mapper.query(BCGX2.toString());
  911. if(bcgxhm2 !=null && bcgxhm2.size()>=1){
  912. cro.setV_errCode(-1);
  913. cro.setV_errMsg("【"+BATCH_NO_BCGX+"】轧批下的委托有判定请撤销判定再删除!");
  914. return cro;
  915. }
  916. }
  917. String dsql="select count(1) cnum from QCM_JHY_SAMPLE_CONSIGN_D t where "
  918. + " t.QUOTE_CONSIGN_NO = '"+specimenNo.get(i)+"' and FREQ_CODE = 'D' ";
  919. List<HashMap> Sampley=mapper.query(dsql.toString());
  920. if (Sampley != null && Sampley.size()>=1) {
  921. if(!Sampley.get(0).get("CNUM").toString().equals("0")){
  922. cro.setV_errCode(-1);
  923. cro.setV_errMsg("该夹杂已被同炉的夹杂引用不能删除!!!");
  924. return cro;
  925. }
  926. }
  927. //英国250吨
  928. dsql="";
  929. dsql="select count(1) cnum from QCM_JHY_SAMPLE_CONSIGN_D_ITEM t, qcm_jhy_sample_consign_d d "
  930. + " where t.specimen_no = d.specimen_no and d.pline_code in ('ZB1','HB1') and t.Quote_Specimen_No = '"+specimenNo.get(i)+"' ";
  931. List<HashMap> lrastr=mapper.query(dsql.toString());
  932. if (lrastr != null && lrastr.size()>=1) {
  933. if(!lrastr.get(0).get("CNUM").toString().equals("0")){
  934. cro.setV_errCode(-1);
  935. cro.setV_errMsg("该轧批已被引用英国船级社!!!");
  936. return cro;
  937. }
  938. }
  939. TreeSet<String> treeSteelCode = new TreeSet<String>(); //牌号
  940. TreeSet<String> treeSpecimenNo = new TreeSet<String>(); //取样编号
  941. int numsno=0;
  942. //XGEC- 订单开头的一个订单两个牌号
  943. String sqlLog = "select * from QCM_JHY_SAMPLE_CONSIGN_D t,Qcm_Jhy_Sample_r_Ord r "
  944. + " where t.SMP_NO=r.SMP_NO and r.DESIGN_KEY = '"+designKey.get(i)+"' and t.batch_no = '"+batchNo.get(i)+"' ";
  945. List<HashMap> lists = mapper.query(sqlLog);
  946. if(lists!=null && lists.size()>1){
  947. for (HashMap hashMap : lists) {
  948. treeSteelCode.add(hashMap.get("STEEL_CODE").toString());
  949. treeSpecimenNo.add(hashMap.get("SPECIMEN_NO").toString());
  950. }
  951. if(treeSteelCode.size()>=2){//一个订单两个牌号,需要一起删除
  952. for (String strsno : treeSpecimenNo) {
  953. for(int j=0;j<specimenNo.size();j++){
  954. if(strsno.equals(specimenNo.get(j))){
  955. numsno++;
  956. }
  957. }
  958. }
  959. if(numsno!=lists.size()){
  960. cro.setV_errCode(-1);
  961. cro.setV_errMsg("不能单独删除订单号【"+designKey.get(i)+"】的委托,这个订单有多个牌号的委托删除其中一个牌号会缺少委托项目,不能综判!请谨慎操作!");
  962. return cro;
  963. }
  964. }
  965. }
  966. }
  967. //检验委托明细表
  968. String dsql = "select count(1) cnum from QCM_JHY_SAMPLE_CONSIGN_D t where "
  969. + " t.batch_no = '"+batchNo.get(0)+"' and t.STATUS = '0' and t.SEND_TIME is null ";
  970. List<HashMap> SampleD=mapper.query(dsql.toString());
  971. if (SampleD == null || SampleD.size()<=0 || SampleD.get(0).get("CNUM").toString().equals("0")) {
  972. cro.setV_errCode(-1);
  973. cro.setV_errMsg("检验委托明细表未找到相应数据!!!");
  974. return cro;
  975. }
  976. for(int i=0;i<batchNo.size();i++){
  977. /*if(smpTypeName.get(i).equals("件件取样")){
  978. continue;
  979. }
  980. 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)+"' ";
  981. List<HashMap> hm=mapper.query(jsql.toString());
  982. if(hm != null && hm.size()>=1){
  983. continue;
  984. }*/
  985. 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 "
  986. + " where t.SMP_NO=r.SMP_NO and t.specimen_no = '"+specimenNo.get(i)+"'";
  987. List<HashMap> lists = mapper.query(sqlLog);
  988. for (HashMap list : lists) {
  989. String strMemo = list.get("SPECIMEN_NO").toString()+","+list.get("DESIGN_KEY").toString()+","+list.get("STEEL_CODE").toString()+","
  990. +list.get("THICK").toString()+","+list.get("INSPECTION_LOT").toString()+","+list.get("SMP_TYPE_NAME").toString()+","
  991. +list.get("PROCESS_NOS1").toString();
  992. QcmJudgeOperateLog qjog = new QcmJudgeOperateLog();
  993. qjog.setOperate_name(userName);
  994. qjog.setBatchno(list.get("BATCH_NO") == null ?"":list.get("BATCH_NO").toString());
  995. qjog.setOperate_type("删除检验委托");
  996. qjog.setParams(list.get("MATERIAL_NO") == null ?"":list.get("MATERIAL_NO").toString());
  997. qjog.setProd_line(list.get("PLINE_CODE") == null ?"":list.get("PLINE_CODE").toString());
  998. qjog.setMemo(strMemo);
  999. mapper.insertQcmJudgeOperateLog(qjog);
  1000. }
  1001. if(smpTypeName.get(i).equals("初样") || smpTypeName.get(i).equals("认证样") || smpTypeName.get(i).equals("按母板取样") ){
  1002. //记录删除的数据
  1003. 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) "
  1004. + " 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"
  1005. + " where d.smp_no = '"+smpNo.get(i)+"' and d.specimen_no= '"+specimenNo.get(i)+"' and d.batch_no = '"+batchNo.get(i)+"' ";
  1006. mapper.insert(sqlDel);
  1007. dsql ="";
  1008. dsql = "select count(1) cnum from QCM_JHY_SAMPLE_CONSIGN_D t where "
  1009. + " t.smp_no = '"+smpNo.get(i)+"' ";
  1010. List<HashMap> smpNot=mapper.query(dsql.toString());
  1011. if(smpNot!=null && smpNot.size()>=1 && !smpNot.get(0).get("CNUM").toString().equals("1")){
  1012. //删除 检验委托明细项目表
  1013. String sql = "DELETE QCM_JHY_INSP_PHYSICS t where t.specimen_no= '"+specimenNo.get(i)+"' ";
  1014. mapper.delete(sql.toString());
  1015. //删除 检验委托明细项目表
  1016. sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where t.specimen_no= '"+specimenNo.get(i)+"' ";
  1017. mapper.delete(sql.toString());
  1018. //删除 检验委托明细表
  1019. sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_D t where t.smp_no = '"+smpNo.get(i)+"' and t.specimen_no= '"+specimenNo.get(i)+"'"
  1020. + " and t.batch_no = '"+batchNo.get(i)+"' ";
  1021. mapper.delete(sql.toString());
  1022. }else{
  1023. //删除 检验委托明细项目表
  1024. String sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where t.specimen_no= '"+specimenNo.get(i)+"' ";
  1025. mapper.delete(sql.toString());
  1026. //删除 检验委托明细表
  1027. sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_D t where t.smp_no = '"+smpNo.get(i)+"' and t.specimen_no= '"+specimenNo.get(i)+"'"
  1028. + " and t.batch_no = '"+batchNo.get(i)+"' ";
  1029. mapper.delete(sql.toString());
  1030. //删除 检验委托主表
  1031. sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_M t where t.smp_no = '"+smpNo.get(i)+"' "
  1032. + " and t.batch_no = '"+batchNo.get(i)+"' ";
  1033. mapper.delete(sql.toString());
  1034. //删除 试样号与合同信息关系表
  1035. sql = "DELETE QCM_JHY_SAMPLE_R_ORD t where t.design_key = '"+designKey.get(i)+"' and t.smp_no = '"+smpNo.get(i)+"' "
  1036. + " and t.batch_no = '"+batchNo.get(i)+"' ";
  1037. mapper.delete(sql.toString());
  1038. //删除 检验委托明细项目表
  1039. sql = "DELETE QCM_JHY_INSP_PHYSICS t where t.specimen_no= '"+specimenNo.get(i)+"' ";
  1040. mapper.delete(sql.toString());
  1041. }
  1042. }else if (smpTypeName.get(0).equals("复样")){
  1043. //删除 检验委托明细项目表
  1044. String sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where t.specimen_no= '"+specimenNo.get(i)+"' ";
  1045. mapper.delete(sql.toString());
  1046. //删除 检验委托明细表
  1047. sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_D t where t.smp_no = '"+smpNo.get(i)+"' and t.specimen_no= '"+specimenNo.get(i)+"'"
  1048. + " and t.batch_no = '"+batchNo.get(i)+"' and t.smp_type_code = '1' ";
  1049. mapper.delete(sql.toString());
  1050. //删除 检验委托主表
  1051. sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_M t where t.smp_no = '"+smpNo.get(i)+"' "
  1052. + " and t.batch_no = '"+batchNo.get(i)+"' and t.DUPLICATE_SAMPLE = '复样' ";
  1053. mapper.delete(sql.toString());
  1054. //删除 试样号与合同信息关系表
  1055. sql = "DELETE QCM_JHY_SAMPLE_R_ORD t where t.design_key = '"+designKey.get(i)+"' and t.smp_no = '"+smpNo.get(i)+"' "
  1056. + " and t.batch_no = '"+batchNo.get(i)+"' and t.DUPLICATE_SAMPLE = '复样' ";
  1057. mapper.delete(sql.toString());
  1058. //如果要删除复样委托时 也要删除实绩表qcm_jhy_insp_physics
  1059. //删除 检验委托明细项目表
  1060. sql = "DELETE QCM_JHY_INSP_PHYSICS t where t.specimen_no= '"+specimenNo.get(i)+"' ";
  1061. mapper.delete(sql.toString());
  1062. }
  1063. }
  1064. //删除复样时 初样检验号返回
  1065. if (smpTypeName.get(0).equals("复样")){
  1066. for (String batchNo2 : treeSet) {
  1067. //把初样的检验号 修改到ord表中
  1068. String sql =" select t.smp_no,t.inspection_lot from QCM_JHY_SAMPLE_CONSIGN_D t "
  1069. +" where t.smp_type_code = '0' and t.batch_no = '"+batchNo2+"' ";
  1070. List<HashMap> hmap = mapper.query(sql.toString());
  1071. for (HashMap hm : hmap) {
  1072. sql =" update QCM_JHY_SAMPLE_R_ORD t set t.inspection_lot = '"+(String)hm.get("INSPECTION_LOT")+"' "
  1073. + " where t.smp_no = '"+(String)hm.get("SMP_NO")+"' and t.batch_no = '"+batchNo2+"' ";
  1074. mapper.updateJudgeStatus(sql.toString());
  1075. }
  1076. }
  1077. }
  1078. } catch (Exception e) {
  1079. SqlSession.rollback();
  1080. SqlSession.close();
  1081. cro.setV_errCode(-1);
  1082. cro.setV_errMsg("删除委托失败!");
  1083. return cro;
  1084. }
  1085. SqlSession.commit();
  1086. SqlSession.close();
  1087. cro.setV_errCode(1);
  1088. cro.setV_errMsg("删除委托成功!");
  1089. return cro;
  1090. }
  1091. /**
  1092. * 取消复样接口
  1093. * @param materialInfo
  1094. * @return
  1095. * @throws Exception
  1096. */
  1097. public CoreReturnObject DoDeleteFY(String batchNo,String designKey,String smpNo,String userName,String steelCode,String thick) throws Exception {
  1098. try {
  1099. Integer num = 0;
  1100. String PLINE_CODE="";
  1101. TreeSet<String> treeSet = new TreeSet<String>();
  1102. if(StringUtils.isBlank(batchNo)){
  1103. cro.setV_errCode(-1);
  1104. cro.setV_errMsg("轧批号为空!!!");
  1105. return cro;
  1106. }
  1107. if(StringUtils.isBlank(designKey)){
  1108. cro.setV_errCode(-1);
  1109. cro.setV_errMsg("订单号为空!!!");
  1110. return cro;
  1111. }
  1112. if(StringUtils.isBlank(smpNo)){
  1113. cro.setV_errCode(-1);
  1114. cro.setV_errMsg("试样号为空!!!");
  1115. return cro;
  1116. }
  1117. if(StringUtils.isBlank(steelCode)){
  1118. cro.setV_errCode(-1);
  1119. cro.setV_errMsg("牌号为空!!!");
  1120. return cro;
  1121. }
  1122. if(StringUtils.isBlank(thick)){
  1123. cro.setV_errCode(-1);
  1124. cro.setV_errMsg("规格为空!!!");
  1125. return cro;
  1126. }
  1127. 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 "
  1128. + " and t.batch_no like '"+batchNo+"%' and t.SMP_TYPE_CODE= '0' and t.SMP_NO = '"+smpNo+"' "
  1129. + " and r.steel_code = '"+steelCode+"' and to_char(r.thick, 'fm990.099') = to_char('"+thick+"', 'fm990.099') ";
  1130. List<HashMap> Samplein=mapper.query(dinsql.toString());
  1131. if(Samplein == null || Samplein.size()<=0){
  1132. cro.setV_errCode(1);
  1133. cro.setV_errMsg("未找到该试样号的初样信息:"+smpNo);
  1134. return cro;
  1135. }
  1136. PLINE_CODE=Samplein.get(0).get("PLINE_CODE").toString();//产线
  1137. String strMemo = "试样号:"+smpNo+','+designKey+','+steelCode+','+thick;
  1138. if(Samplein.get(0).get("PLINE_CODE").toString().equals("HB1") || Samplein.get(0).get("PLINE_CODE").toString().equals("ZB1")){
  1139. strMemo+=",热处理号:"+Samplein.get(0).get("PROCESS_NOS1").toString();
  1140. }
  1141. QcmJudgeOperateLog qjog = new QcmJudgeOperateLog();
  1142. qjog.setOperate_name(userName);
  1143. qjog.setBatchno(batchNo);
  1144. qjog.setOperate_type("取消复样委托");
  1145. qjog.setParams(Samplein.get(0).get("MATERIAL_NO").toString());
  1146. qjog.setProd_line(Samplein.get(0).get("PLINE_CODE").toString());
  1147. qjog.setMemo(strMemo);
  1148. mapper.insertQcmJudgeOperateLog(qjog);
  1149. //检验委托明细表
  1150. String dsql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D t,qcm_jhy_sample_r_ord r where t.smp_no = r.smp_no "
  1151. + " and t.batch_no like '"+batchNo+"%' and t.SMP_TYPE_CODE= '1' and r.DESIGN_KEY='"+designKey+"' "
  1152. + " and r.steel_code = '"+steelCode+"' and to_char(r.thick, 'fm990.099') = to_char('"+thick+"', 'fm990.099') "
  1153. + " and t.FREQ_CODE = '"+Samplein.get(0).get("FREQ_CODE")+"' and r.INSPECTION_LOT = '"+Samplein.get(0).get("INSPECTION_LOT")+"' ";
  1154. List<HashMap> SampleD=mapper.query(dsql.toString());
  1155. if (SampleD == null || SampleD.size()<=0) {
  1156. dsql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D t,qcm_jhy_sample_r_ord r where t.smp_no = r.smp_no "
  1157. + " and t.batch_no like '"+batchNo+"%' and t.SMP_TYPE_CODE= '1' "
  1158. + " and r.steel_code = '"+steelCode+"' and to_char(r.thick, 'fm990.099') = to_char('"+thick+"', 'fm990.099')"
  1159. + " and t.FREQ_CODE = '"+Samplein.get(0).get("FREQ_CODE")+"' and r.INSPECTION_LOT = '"+Samplein.get(0).get("INSPECTION_LOT")+"'";
  1160. SampleD=null;
  1161. SampleD=mapper.query(dsql.toString());
  1162. if (SampleD == null || SampleD.size()<=0) {
  1163. SqlSession.commit();
  1164. SqlSession.close();
  1165. cro.setV_errCode(1);
  1166. cro.setV_errMsg("取消复样委托成功!");
  1167. return cro;
  1168. }
  1169. }
  1170. for (HashMap hm : SampleD) {
  1171. if(!hm.get("STATUS").equals("0")){
  1172. SqlSession.rollback();
  1173. SqlSession.close();
  1174. cro.setV_errCode(-1);
  1175. cro.setV_errMsg("轧批号【'"+batchNo+"'】已发送委托不可撤销!");
  1176. return cro;
  1177. }
  1178. }
  1179. for (HashMap hmap : SampleD) {
  1180. //删除 检验委托明细项目表
  1181. String sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where t.specimen_no= '"+hmap.get("SPECIMEN_NO")+"' ";
  1182. mapper.delete(sql.toString());
  1183. //删除 检验委托明细表
  1184. sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_D t where t.smp_no = '"+hmap.get("SMP_NO")+"' and t.specimen_no= '"+hmap.get("SPECIMEN_NO")+"'"
  1185. + " and t.batch_no like '"+batchNo+"%' and t.smp_type_code = '1' ";
  1186. mapper.delete(sql.toString());
  1187. //删除 检验委托主表
  1188. /* sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_M t where t.smp_no = '"+hmap.get("SMP_NO")+"' "
  1189. + " and t.batch_no like '"+batchNo+"%' and t.DUPLICATE_SAMPLE = '复样' ";
  1190. mapper.delete(sql.toString());*/
  1191. //删除 试样号与合同信息关系表
  1192. /* sql = "DELETE QCM_JHY_SAMPLE_R_ORD t where t.smp_no = '"+hmap.get("SMP_NO")+"' "
  1193. + " and t.batch_no like '"+batchNo+"%' and t.DUPLICATE_SAMPLE = '复样' ";
  1194. mapper.delete(sql.toString());*/
  1195. //如果要删除复样委托时 也要删除实绩表qcm_jhy_insp_physics
  1196. //删除 检验委托明细项目表
  1197. sql = "DELETE QCM_JHY_INSP_PHYSICS t where t.specimen_no= '"+hmap.get("SPECIMEN_NO")+"' ";
  1198. mapper.delete(sql.toString());
  1199. }
  1200. for (HashMap hmap : SampleD) {
  1201. //删除 检验委托主表
  1202. String sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_M t where t.smp_no = '"+hmap.get("SMP_NO")+"' "
  1203. + " and t.batch_no like '"+batchNo+"%' and t.DUPLICATE_SAMPLE = '复样' ";
  1204. mapper.delete(sql.toString());
  1205. //删除 试样号与合同信息关系表
  1206. sql = "DELETE QCM_JHY_SAMPLE_R_ORD t where t.smp_no = '"+hmap.get("SMP_NO")+"' "
  1207. + " and t.batch_no like '"+batchNo+"%' and t.DUPLICATE_SAMPLE = '复样' ";
  1208. mapper.delete(sql.toString());
  1209. }
  1210. String strSmpNo = " and r.SMP_NO = '"+smpNo+"' ";
  1211. if(PLINE_CODE.equals("GX1") || PLINE_CODE.equals("GX2") || PLINE_CODE.equals("BC2")){
  1212. strSmpNo="";
  1213. }
  1214. //删除复样时 初样检验号返回
  1215. //把初样的检验号 修改到ord表中
  1216. 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 "
  1217. +" and t.smp_type_code = '0' and t.batch_no like '"+batchNo+"%' and r.DESIGN_KEY='"+designKey+"' "
  1218. +" and r.steel_code = '"+steelCode+"' and to_char(r.thick, 'fm990.099') = to_char('"+thick+"', 'fm990.099')"
  1219. + strSmpNo;
  1220. List<HashMap> hmap = mapper.query(sql.toString());
  1221. if(hmap==null || hmap.size()<=0){
  1222. 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 "
  1223. +" and t.smp_type_code = '0' and t.batch_no like '"+batchNo+"%' " + strSmpNo
  1224. +" and r.steel_code = '"+steelCode+"' and to_char(r.thick, 'fm990.099') = to_char('"+thick+"', 'fm990.099')";
  1225. hmap=null;
  1226. hmap = mapper.query(sql.toString());
  1227. }
  1228. for (HashMap hm : hmap) {
  1229. sql =" update QCM_JHY_SAMPLE_R_ORD t set t.inspection_lot = '"+(String)hm.get("INSPECTION_LOT")+"' "
  1230. + " where t.smp_no = '"+(String)hm.get("SMP_NO")+"' and t.batch_no like '"+batchNo+"%' ";
  1231. mapper.updateJudgeStatus(sql.toString());
  1232. }
  1233. } catch (Exception e) {
  1234. SqlSession.rollback();
  1235. SqlSession.close();
  1236. cro.setV_errCode(-1);
  1237. cro.setV_errMsg("取消复样委托失败!");
  1238. return cro;
  1239. }
  1240. SqlSession.commit();
  1241. SqlSession.close();
  1242. cro.setV_errCode(1);
  1243. cro.setV_errMsg("取消复样委托成功!");
  1244. return cro;
  1245. }
  1246. /**
  1247. * 取消件件取样接口
  1248. * @param materialInfo
  1249. * @return
  1250. * @throws Exception
  1251. */
  1252. public CoreReturnObject DoDeleteJ(String materialNo,String designKey,String smpNo,String userName,String steelCode,String thick) throws Exception {
  1253. try {
  1254. if(StringUtils.isBlank(materialNo)){
  1255. cro.setV_errCode(-1);
  1256. cro.setV_errMsg("子板号为空!!!");
  1257. return cro;
  1258. }
  1259. if(StringUtils.isBlank(designKey)){
  1260. cro.setV_errCode(-1);
  1261. cro.setV_errMsg("订单号为空!!!");
  1262. return cro;
  1263. }
  1264. if(StringUtils.isBlank(smpNo)){//为原不合格的试样号
  1265. cro.setV_errCode(-1);
  1266. cro.setV_errMsg("试样号为空!!!");
  1267. return cro;
  1268. }
  1269. if(StringUtils.isBlank(steelCode)){
  1270. cro.setV_errCode(-1);
  1271. cro.setV_errMsg("牌号为空!!!");
  1272. return cro;
  1273. }
  1274. if(StringUtils.isBlank(thick)){
  1275. cro.setV_errCode(-1);
  1276. cro.setV_errMsg("规格为空!!!");
  1277. return cro;
  1278. }
  1279. 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 "
  1280. + " and t.MATERIAL_NO = '"+materialNo+"' and t.SMP_TYPE_CODE= '3' and r.DESIGN_KEY = '"+designKey+"' "
  1281. + " and r.steel_code = '"+steelCode+"' and to_char(r.thick, 'fm990.099') = to_char('"+thick+"', 'fm990.099') and rownum=1 ";
  1282. List<HashMap> Samplein=mapper.query(dinsql.toString());
  1283. if(Samplein == null || Samplein.size()<=0){
  1284. cro.setV_errCode(1);
  1285. cro.setV_errMsg("未找到该子板号件件取样信息:"+materialNo);
  1286. return cro;
  1287. }
  1288. if(!Samplein.get(0).get("STATUS").equals("0")){
  1289. cro.setV_errCode(-1);
  1290. cro.setV_errMsg("子板号【'"+materialNo+"'】件件取样已发送委托不可取消!请先把委托撤销回来");
  1291. return cro;
  1292. }
  1293. String strMemo = "原试样号:"+smpNo+','+designKey+','+steelCode+','+thick;
  1294. if(Samplein.get(0).get("PLINE_CODE").toString().equals("HB1") || Samplein.get(0).get("PLINE_CODE").toString().equals("ZB1")){
  1295. strMemo+=",热处理号:"+Samplein.get(0).get("PROCESS_NOS").toString();
  1296. }
  1297. QcmJudgeOperateLog qjog = new QcmJudgeOperateLog();
  1298. qjog.setOperate_name(userName);
  1299. qjog.setBatchno(Samplein.get(0).get("BATCH_NO").toString());
  1300. qjog.setOperate_type("取消件件取样委托");
  1301. qjog.setParams(Samplein.get(0).get("MATERIAL_NO").toString());
  1302. qjog.setProd_line(Samplein.get(0).get("PLINE_CODE").toString());
  1303. qjog.setMemo(strMemo);
  1304. mapper.insertQcmJudgeOperateLog(qjog);
  1305. for (HashMap hmap : Samplein) {
  1306. String spmNo= hmap.get("SMP_NO").toString();
  1307. String specimenNO= hmap.get("SPECIMEN_NO").toString();
  1308. //删除 检验委托明细项目表
  1309. String sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where t.specimen_no= '"+specimenNO+"' ";
  1310. mapper.delete(sql.toString());
  1311. //删除 检验委托明细表
  1312. sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_D t where t.specimen_no= '"+specimenNO+"' ";
  1313. mapper.delete(sql.toString());
  1314. //删除 检验委托主表
  1315. sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_M t where t.smp_no = '"+spmNo+"' ";
  1316. mapper.delete(sql.toString());
  1317. //删除 试样号与合同信息关系表
  1318. sql = "DELETE QCM_JHY_SAMPLE_R_ORD t where t.smp_no = '"+spmNo+"' ";
  1319. mapper.delete(sql.toString());
  1320. sql = "DELETE QCM_JHY_INSP_PHYSICS t where t.specimen_no= '"+specimenNO+"' ";
  1321. mapper.delete(sql.toString());
  1322. }
  1323. } catch (Exception e) {
  1324. SqlSession.rollback();
  1325. SqlSession.close();
  1326. cro.setV_errCode(-1);
  1327. cro.setV_errMsg("取消件件取样委托失败!");
  1328. return cro;
  1329. }
  1330. SqlSession.commit();
  1331. SqlSession.close();
  1332. cro.setV_errCode(1);
  1333. cro.setV_errMsg("取消件件取样委托成功!");
  1334. return cro;
  1335. }
  1336. /**
  1337. * 初样 撤销复制当前委托一条
  1338. * @param materialInfo
  1339. * @return
  1340. * @throws Exception
  1341. */
  1342. public CoreReturnObject DoDelWtZy(String batchNo,String designKey,String smpNo,String specimenNo,String userName) throws Exception {
  1343. try {
  1344. if(StringUtils.isBlank(batchNo)){
  1345. cro.setV_errCode(-1);
  1346. cro.setV_errMsg("轧批号为空!!!");
  1347. return cro;
  1348. }
  1349. if(StringUtils.isBlank(smpNo)){
  1350. cro.setV_errCode(-1);
  1351. cro.setV_errMsg("试样号为空!!!");
  1352. return cro;
  1353. }
  1354. if(StringUtils.isBlank(specimenNo)){
  1355. cro.setV_errCode(-1);
  1356. cro.setV_errMsg("取样编号为空!!!");
  1357. return cro;
  1358. }
  1359. if(StringUtils.isBlank(designKey)){
  1360. cro.setV_errCode(-1);
  1361. cro.setV_errMsg("订单号为空!!!");
  1362. return cro;
  1363. }
  1364. //删除 检验委托明细项目表
  1365. String sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where t.specimen_no= '"+specimenNo+"' and t.item_flag = '1' ";
  1366. mapper.delete(sql.toString());
  1367. //删除 检验委托明细表
  1368. sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_D t where t.smp_no = '"+smpNo+"' and t.specimen_no= '"+specimenNo+"'"
  1369. + " and t.batch_no = '"+batchNo+"' and t.item_flag = '1' ";
  1370. mapper.delete(sql.toString());
  1371. //删除 试样号与合同信息关系表
  1372. sql = "DELETE QCM_JHY_SAMPLE_R_ORD t where t.design_key = '"+designKey+"' and t.smp_no = '"+smpNo+"' "
  1373. + " and t.batch_no = '"+batchNo+"' and t.item_flag = '1' ";
  1374. mapper.delete(sql.toString());
  1375. //删除 检验委托主表
  1376. sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_M t where t.smp_no = '"+smpNo+"' "
  1377. + " and t.batch_no = '"+batchNo+"' and t.item_flag = '1' ";
  1378. mapper.delete(sql.toString());
  1379. String sqlLog = "select * from QCM_JHY_SAMPLE_CONSIGN_D t where t.specimen_no like '"+specimenNo+"'";
  1380. List<HashMap> lists = mapper.query(sqlLog);
  1381. for (HashMap list : lists) {
  1382. QcmJudgeOperateLog qjog = new QcmJudgeOperateLog();
  1383. qjog.setOperate_name(userName);
  1384. qjog.setBatchno(list.get("BATCH_NO") == null ?"":list.get("BATCH_NO").toString());
  1385. qjog.setOperate_type("撤销初样检验委托[复制]");
  1386. qjog.setParams(list.get("MATERIAL_NO") == null ?"":list.get("MATERIAL_NO").toString());
  1387. qjog.setProd_line(list.get("PLINE_CODE") == null ?"":list.get("PLINE_CODE").toString());
  1388. mapper.insertQcmJudgeOperateLog(qjog);
  1389. }
  1390. } catch (Exception e) {
  1391. SqlSession.rollback();
  1392. SqlSession.close();
  1393. cro.setV_errCode(-1);
  1394. cro.setV_errMsg("撤销失败![复制委托]");
  1395. return cro;
  1396. }
  1397. SqlSession.commit();
  1398. SqlSession.close();
  1399. cro.setV_errCode(1);
  1400. cro.setV_errMsg("撤销复制委托成功!");
  1401. return cro;
  1402. }
  1403. /**
  1404. * 复样 撤销复制当前委托一条
  1405. * @param materialInfo
  1406. * @return
  1407. * @throws Exception
  1408. */
  1409. public CoreReturnObject DoDelWtFy(String batchNo,String designKey,String smpNo,String specimenNo,String userName) throws Exception {
  1410. try {
  1411. if(StringUtils.isBlank(batchNo)){
  1412. cro.setV_errCode(-1);
  1413. cro.setV_errMsg("轧批号为空!!!");
  1414. return cro;
  1415. }
  1416. if(StringUtils.isBlank(smpNo)){
  1417. cro.setV_errCode(-1);
  1418. cro.setV_errMsg("试样号为空!!!");
  1419. return cro;
  1420. }
  1421. if(StringUtils.isBlank(specimenNo)){
  1422. cro.setV_errCode(-1);
  1423. cro.setV_errMsg("取样编号为空!!!");
  1424. return cro;
  1425. }
  1426. if(StringUtils.isBlank(designKey)){
  1427. cro.setV_errCode(-1);
  1428. cro.setV_errMsg("订单号为空!!!");
  1429. return cro;
  1430. }
  1431. //删除 检验委托明细项目表
  1432. String sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where t.specimen_no= '"+specimenNo+"' and t.item_flag = '1' ";
  1433. mapper.delete(sql.toString());
  1434. //删除 检验委托明细表
  1435. sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_D t where t.smp_no = '"+smpNo+"' and t.specimen_no= '"+specimenNo+"'"
  1436. + " and t.batch_no = '"+batchNo+"' and t.item_flag = '1' ";
  1437. mapper.delete(sql.toString());
  1438. String sqlLog = "select * from QCM_JHY_SAMPLE_CONSIGN_D t where t.specimen_no like '"+specimenNo+"'";
  1439. List<HashMap> lists = mapper.query(sqlLog);
  1440. for (HashMap list : lists) {
  1441. QcmJudgeOperateLog qjog = new QcmJudgeOperateLog();
  1442. qjog.setOperate_name(userName);
  1443. qjog.setBatchno(list.get("BATCH_NO") == null ?"":list.get("BATCH_NO").toString());
  1444. qjog.setOperate_type("撤销复样检验委托[复制]");
  1445. qjog.setParams(list.get("MATERIAL_NO") == null ?"":list.get("MATERIAL_NO").toString());
  1446. qjog.setProd_line(list.get("PLINE_CODE") == null ?"":list.get("PLINE_CODE").toString());
  1447. mapper.insertQcmJudgeOperateLog(qjog);
  1448. }
  1449. } catch (Exception e) {
  1450. SqlSession.rollback();
  1451. SqlSession.close();
  1452. cro.setV_errCode(-1);
  1453. cro.setV_errMsg("撤销复样委托失败![复制]");
  1454. return cro;
  1455. }
  1456. SqlSession.commit();
  1457. SqlSession.close();
  1458. cro.setV_errCode(1);
  1459. cro.setV_errMsg("撤销复样委托成功![复制]");
  1460. return cro;
  1461. }
  1462. /**
  1463. * 初样 新增当前复制委托一条
  1464. * @param materialInfo
  1465. * @return
  1466. * @throws Exception
  1467. */
  1468. public CoreReturnObject DoAddWtZy(String batchNo,String designKey,String smpNo,String specimenNo,String userName) throws Exception {
  1469. try {
  1470. String plineCode = "";
  1471. String inspectionLot = "";//检验号
  1472. String smp_no = "";//试样号
  1473. String specimen_no = "";//取样编号
  1474. String material_no = "";//取样材料号
  1475. if(StringUtils.isBlank(batchNo)){
  1476. cro.setV_errCode(-1);
  1477. cro.setV_errMsg("轧批号为空!!!");
  1478. return cro;
  1479. }
  1480. if(StringUtils.isBlank(smpNo)){
  1481. cro.setV_errCode(-1);
  1482. cro.setV_errMsg("试样号为空!!!");
  1483. return cro;
  1484. }
  1485. if(StringUtils.isBlank(specimenNo)){
  1486. cro.setV_errCode(-1);
  1487. cro.setV_errMsg("取样编号为空!!!");
  1488. return cro;
  1489. }
  1490. if(StringUtils.isBlank(designKey)){
  1491. cro.setV_errCode(-1);
  1492. cro.setV_errMsg("订单号为空!!!");
  1493. return cro;
  1494. }
  1495. //检验委托主表
  1496. String sql = "select * from QCM_JHY_SAMPLE_CONSIGN_M t where "
  1497. + " t.smp_no = '"+smpNo+"' and t.batch_no = '"+batchNo+"' ";
  1498. List<HashMap> SampleM=mapper.query(sql.toString());
  1499. if (SampleM == null || SampleM.size()<0) {
  1500. cro.setV_errCode(-1);
  1501. cro.setV_errMsg("检验委托主表未找到相应数据!!!");
  1502. return cro;
  1503. }
  1504. //D表 用来做中厚板子板复制
  1505. sql = "";
  1506. sql = "select t.freq_code from QCM_JHY_SAMPLE_CONSIGN_D t where "
  1507. + " t.smp_no = '"+smpNo+"' and t.batch_no = '"+batchNo+"' "
  1508. + " and t.specimen_no = '"+specimenNo+"' ";
  1509. List<HashMap> SampleM2=mapper.query(sql.toString());
  1510. HashMap SampleMs = SampleM.get(0);
  1511. //产线 热轧 连退 产线 需要修改检验号
  1512. plineCode = (String) SampleMs.get("PLINE_CODE");
  1513. if(plineCode.equals("RZ1") || plineCode.equals("LT1")){
  1514. sql = "select max(to_number(substr(t.inspection_lot,-3))) maxlot from QCM_JHY_SAMPLE_CONSIGN_M t where "
  1515. + " t.batch_no = '"+batchNo+"' ";
  1516. List<HashMap> maxInspectionLot=mapper.query(sql.toString());
  1517. BigDecimal cou = (BigDecimal)maxInspectionLot.get(0).get("MAXLOT");
  1518. String coun2 = cou.toString();
  1519. Integer integ2 = Integer.parseInt(coun2);
  1520. String lotnum = integ2.toString();
  1521. if (lotnum ==null || "".equals(lotnum)) {
  1522. if(plineCode.equals("RZ1")){
  1523. inspectionLot=batchNo+ String.format("%05d", 1);//轧批号+00001
  1524. }else if(plineCode.equals("LT1")){
  1525. inspectionLot=batchNo+ String.format("%03d", 1);//轧批号+001
  1526. }
  1527. }else{
  1528. Integer lonums=Integer.parseInt(lotnum);
  1529. lonums++;
  1530. if(plineCode.equals("RZ1")){
  1531. inspectionLot=batchNo+ String.format("%05d", lonums);//轧批号+00001
  1532. }else if(plineCode.equals("LT1")){
  1533. inspectionLot=batchNo+ String.format("%03d", lonums);//轧批号+001
  1534. }
  1535. }
  1536. }else if(plineCode.equals("HB1") || plineCode.equals("ZB1")){
  1537. if(SampleM2.get(0).get("FREQ_CODE").equals("C")|| SampleM2.get(0).get("FREQ_CODE").equals("H")){//子板复制
  1538. sql = "";
  1539. sql = "select max(to_number(substr(t.inspection_lot,-3))) MAXLOT from QCM_JHY_SAMPLE_CONSIGN_D t where "
  1540. + " t.batch_no = '"+batchNo+"' ";
  1541. List<HashMap> SampleM3=mapper.query(sql.toString());
  1542. BigDecimal cou = (BigDecimal)SampleM3.get(0).get("MAXLOT");
  1543. String coun2 = cou.toString();
  1544. Integer integ2 = Integer.parseInt(coun2);
  1545. String lotnum = integ2.toString();
  1546. if (lotnum ==null || "".equals(lotnum) || lotnum.equals("0")) {
  1547. inspectionLot=batchNo+ String.format("%04d", 1);//轧批号+0001
  1548. }else{
  1549. Integer lonums=Integer.parseInt(lotnum);
  1550. lonums++;
  1551. inspectionLot=batchNo+ String.format("%04d", lonums);//轧批号+0001
  1552. }
  1553. }
  1554. }
  1555. //生成试样信息主表 (检验委托主表)
  1556. smp_no = createQltySamNo((String) SampleMs.get("PLINE_CODE"));
  1557. JhySampleMMdoel model=getSampleM(smp_no,SampleMs,userName);
  1558. if(plineCode.equals("RZ1") || plineCode.equals("LT1")){
  1559. model.setInspection_lot(inspectionLot);//卷板 修改检验号
  1560. }else if((plineCode.equals("HB1") || plineCode.equals("ZB1")) && (SampleM2.get(0).get("FREQ_CODE").equals("C")||SampleM2.get(0).get("FREQ_CODE").equals("H"))){
  1561. sql ="";
  1562. if(plineCode.equals("HB1")){
  1563. //厚
  1564. sql+="select min(t.MATERIAL_NO) MATERIAL_NO from (select BILLETID as MATERIAL_NO from kch_turnofflist@xgcx where BILLETID like '"+batchNo+"'||'%' )t"
  1565. + " where t.MATERIAL_NO not in "
  1566. + "(select d.material_no from QCM_JHY_SAMPLE_CONSIGN_D d where d.material_no like '"+batchNo + "%' and d.pline_code = '"+plineCode+"') ";
  1567. }else if(plineCode.equals("ZB1")){
  1568. //中
  1569. sql+="select min(t.MATERIAL_NO) MATERIAL_NO from (select BILLETID as MATERIAL_NO from kcz_turnofflist@xgcx where BILLETID like '"+batchNo+"'||'%' )t"
  1570. + " where t.MATERIAL_NO not in"
  1571. + " (select d.material_no from QCM_JHY_SAMPLE_CONSIGN_D d where d.material_no like '"+batchNo + "%' and d.pline_code = '"+plineCode+"') ";
  1572. }
  1573. List<HashMap> SampleM3=mapper.query(sql.toString());
  1574. material_no = (String)SampleM3.get(0).get("MATERIAL_NO");
  1575. model.setMaterial_no(material_no);//取样材料号
  1576. model.setInspection_lot(inspectionLot);// 修改检验号
  1577. }
  1578. mapper.insertSampleM(model);
  1579. sql = "";
  1580. //试样号与合同信息关系表
  1581. sql = "select * from QCM_JHY_SAMPLE_R_ORD t where "
  1582. + " t.DESIGN_KEY = '"+designKey+"' and t.smp_no = '"+smpNo+"' "
  1583. + " and t.batch_no = '"+batchNo+"' ";
  1584. List<HashMap> rord=mapper.query(sql.toString());
  1585. if (rord == null || rord.size()<0) {
  1586. cro.setV_errCode(-1);
  1587. cro.setV_errMsg("生成合同表未找到相应数据!!!");
  1588. return cro;
  1589. }
  1590. HashMap rords = rord.get(0);
  1591. //生成合同表
  1592. JhySampleOrdMdoel ord=getSampleOrd(smp_no,rords,userName);
  1593. if(plineCode.equals("RZ1") || plineCode.equals("LT1")){
  1594. ord.setInspection_lot(inspectionLot);//卷板 修改检验号
  1595. }else if((plineCode.equals("HB1") || plineCode.equals("ZB1")) && (SampleM2.get(0).get("FREQ_CODE").equals("C")|| SampleM2.get(0).get("FREQ_CODE").equals("H"))){
  1596. ord.setInspection_lot(inspectionLot);// 修改检验号
  1597. }
  1598. mapper.insertSampleOrd(ord);
  1599. sql = "";
  1600. //检验委托明细表
  1601. sql = "select * from QCM_JHY_SAMPLE_CONSIGN_D t where "
  1602. + " t.smp_no = '"+smpNo+"' and t.specimen_no = '"+specimenNo+"' and t.batch_no = '"+batchNo+"' ";
  1603. List<HashMap> SampleD=mapper.query(sql.toString());
  1604. if (SampleD == null || SampleD.size()<0) {
  1605. cro.setV_errCode(-1);
  1606. cro.setV_errMsg("检验委托明细表未找到相应数据!!!");
  1607. return cro;
  1608. }
  1609. HashMap SampleDs = SampleD.get(0);
  1610. specimen_no = createSpecimen_no(smp_no);
  1611. JhySampleDModel modelD = getSampleD(smp_no,specimen_no, SampleDs);
  1612. if(plineCode.equals("RZ1") || plineCode.equals("LT1")){
  1613. modelD.setInspection_lot(inspectionLot);//卷板 修改检验号
  1614. }else if((plineCode.equals("HB1") || plineCode.equals("ZB1")) && (SampleM2.get(0).get("FREQ_CODE").equals("C")||SampleM2.get(0).get("FREQ_CODE").equals("H"))){
  1615. modelD.setMaterial_no(material_no);//取样材料号
  1616. modelD.setInspection_lot(inspectionLot);// 修改检验号
  1617. String sqlzj = "";
  1618. sqlzj += " update zj_result_all@xgcx t set t.billetid_jy = '"+inspectionLot+"' ";
  1619. sqlzj += " where t.billetid = '"+material_no+"' ";
  1620. mapper.updateJudgeStatus(sqlzj.toString());
  1621. }
  1622. mapper.insertSampleD(modelD);
  1623. sql = "";
  1624. //检验委托明细项目表
  1625. sql = "select * from QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where "
  1626. + " t.smp_no = '"+smpNo+"' and t.specimen_no = '"+specimenNo+"' ";
  1627. List<HashMap> SampleDitem=mapper.query(sql.toString());
  1628. if (SampleDitem == null || SampleDitem.size()<0) {
  1629. cro.setV_errCode(-1);
  1630. cro.setV_errMsg("检验委托明细项目表未找到相应数据!!!");
  1631. return cro;
  1632. }
  1633. for(HashMap map : SampleDitem){
  1634. //生成材质项目表
  1635. JhySampleDItemModel item=getSampleItem(smp_no,specimen_no,map,userName);
  1636. mapper.insertSampleItem(item);
  1637. }
  1638. String sqlLog = "select * from QCM_JHY_SAMPLE_CONSIGN_D t where t.specimen_no like '"+specimenNo+"'";
  1639. List<HashMap> lists = mapper.query(sqlLog);
  1640. for (HashMap list : lists) {
  1641. QcmJudgeOperateLog qjog = new QcmJudgeOperateLog();
  1642. qjog.setOperate_name(userName);
  1643. qjog.setBatchno(list.get("BATCH_NO") == null ?"":list.get("BATCH_NO").toString());
  1644. qjog.setOperate_type("复制初样检验委托");
  1645. qjog.setParams(list.get("MATERIAL_NO") == null ?"":list.get("MATERIAL_NO").toString());
  1646. qjog.setProd_line(list.get("PLINE_CODE") == null ?"":list.get("PLINE_CODE").toString());
  1647. //qjog.setMemo(zhyy);
  1648. mapper.insertQcmJudgeOperateLog(qjog);
  1649. }
  1650. } catch (Exception e) {
  1651. SqlSession.rollback();
  1652. SqlSession.close();
  1653. cro.setV_errCode(-1);
  1654. cro.setV_errMsg("新增初样委托失败!");
  1655. return cro;
  1656. }
  1657. SqlSession.commit();
  1658. SqlSession.close();
  1659. cro.setV_errCode(1);
  1660. cro.setV_errMsg("新增初样委托成功!");
  1661. return cro;
  1662. }
  1663. /**
  1664. * 复样 新增当前复制委托一条
  1665. * @param materialInfo
  1666. * @return
  1667. * @throws Exception
  1668. */
  1669. public CoreReturnObject DoAddWtFy(String batchNo,String designKey,String smpNo,String specimenNo,String userName) throws Exception {
  1670. try {
  1671. String smp_no = "";//试样号
  1672. String specimen_no = "";//取样编号
  1673. if(StringUtils.isBlank(batchNo)){
  1674. cro.setV_errCode(-1);
  1675. cro.setV_errMsg("轧批号为空!!!");
  1676. return cro;
  1677. }
  1678. if(StringUtils.isBlank(smpNo)){
  1679. cro.setV_errCode(-1);
  1680. cro.setV_errMsg("试样号为空!!!");
  1681. return cro;
  1682. }
  1683. if(StringUtils.isBlank(specimenNo)){
  1684. cro.setV_errCode(-1);
  1685. cro.setV_errMsg("取样编号为空!!!");
  1686. return cro;
  1687. }
  1688. if(StringUtils.isBlank(designKey)){
  1689. cro.setV_errCode(-1);
  1690. cro.setV_errMsg("订单号为空!!!");
  1691. return cro;
  1692. }
  1693. String sql = "";
  1694. //检验委托明细表
  1695. sql = "select * from QCM_JHY_SAMPLE_CONSIGN_D t where "
  1696. + " t.smp_no = '"+smpNo+"' and t.specimen_no = '"+specimenNo+"' and t.batch_no = '"+batchNo+"' ";
  1697. List<HashMap> SampleD=mapper.query(sql.toString());
  1698. if (SampleD == null || SampleD.size()<0) {
  1699. cro.setV_errCode(-1);
  1700. cro.setV_errMsg("检验委托明细表未找到相应数据!!!");
  1701. return cro;
  1702. }
  1703. HashMap SampleDs = SampleD.get(0);
  1704. specimen_no = createSpecimen_no((String) SampleDs.get("SMP_NO"));
  1705. JhySampleDModel modelD = getSampleD((String) SampleDs.get("SMP_NO"),specimen_no, SampleDs);
  1706. mapper.insertSampleD(modelD);
  1707. sql = "";
  1708. //检验委托明细项目表
  1709. sql = "select * from QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where "
  1710. + " t.smp_no = '"+smpNo+"' and t.specimen_no = '"+specimenNo+"' and t.fy_quote_specimen_no is null ";
  1711. List<HashMap> SampleDitem=mapper.query(sql.toString());
  1712. if (SampleDitem == null || SampleDitem.size()<0) {
  1713. cro.setV_errCode(-1);
  1714. cro.setV_errMsg("检验委托明细项目表未找到相应数据!!!");
  1715. return cro;
  1716. }
  1717. for(HashMap map : SampleDitem){
  1718. smp_no = (String)map.get("SMP_NO");
  1719. //生成材质项目表
  1720. JhySampleDItemModel item=getSampleItem(smp_no,specimen_no,map,userName);
  1721. mapper.insertSampleItem(item);
  1722. }
  1723. String sqlLog = "select * from QCM_JHY_SAMPLE_CONSIGN_D t where t.specimen_no like '"+specimenNo+"'";
  1724. List<HashMap> lists = mapper.query(sqlLog);
  1725. for (HashMap list : lists) {
  1726. QcmJudgeOperateLog qjog = new QcmJudgeOperateLog();
  1727. qjog.setOperate_name(userName);
  1728. qjog.setBatchno(list.get("BATCH_NO") == null ?"":list.get("BATCH_NO").toString());
  1729. qjog.setOperate_type("复制复样检验委托");
  1730. qjog.setParams(list.get("MATERIAL_NO") == null ?"":list.get("MATERIAL_NO").toString());
  1731. qjog.setProd_line(list.get("PLINE_CODE") == null ?"":list.get("PLINE_CODE").toString());
  1732. //qjog.setMemo(zhyy);
  1733. mapper.insertQcmJudgeOperateLog(qjog);
  1734. }
  1735. } catch (Exception e) {
  1736. SqlSession.rollback();
  1737. SqlSession.close();
  1738. cro.setV_errCode(-1);
  1739. cro.setV_errMsg("新增复样委托失败!");
  1740. return cro;
  1741. }
  1742. SqlSession.commit();
  1743. SqlSession.close();
  1744. cro.setV_errCode(1);
  1745. cro.setV_errMsg("新增复样委托成功!");
  1746. return cro;
  1747. }
  1748. /**
  1749. * 创建试样号
  1750. * @param pline_code 产线代码
  1751. * @return
  1752. */
  1753. private String createQltySamNo(String pline_code) {
  1754. // TODO Auto-generated method stub
  1755. String smp_no="";
  1756. SimpleDateFormat sdf = new SimpleDateFormat("yyMMdd");
  1757. if (pline_code.length()>3){
  1758. pline_code=pline_code.substring(0,3);
  1759. }else if (pline_code.length()==2){
  1760. pline_code="0"+pline_code;
  1761. }else if (pline_code.length()==1){
  1762. pline_code="00"+pline_code;
  1763. }
  1764. String syh = pline_code +sdf.format(new Date());
  1765. StringBuffer sqlucomm = new StringBuffer();
  1766. sqlucomm.append("SELECT max(to_number(substr(smp_no,10))) SMP_NO FROM QCM_JHY_SAMPLE_CONSIGN_M WHERE SMP_NO like '"+syh+"%' ");
  1767. HashMap result=mapper.queryOne(sqlucomm.toString());
  1768. BigDecimal seq=BigDecimal.ZERO;
  1769. if (result!=null && result.get("SMP_NO")!=null ) {
  1770. seq=(BigDecimal)result.get("SMP_NO");
  1771. }
  1772. seq=seq.add(BigDecimal.ONE);
  1773. smp_no=syh+ String.format("%04d", seq.intValue());
  1774. return smp_no;
  1775. }
  1776. /**
  1777. * 获取取样编号
  1778. *
  1779. * @param smp_no
  1780. * @return
  1781. */
  1782. private String createSpecimen_no(String smp_no) {
  1783. // TODO Auto-generated method stub
  1784. String specimen_no = "";
  1785. StringBuffer sqlucomm = new StringBuffer();
  1786. sqlucomm.append("SELECT max(to_number(substr(SPECIMEN_NO,14))) SPECIMEN_NO FROM QCM_JHY_SAMPLE_CONSIGN_D "
  1787. + "WHERE SPECIMEN_NO like '" + smp_no + "%' and SMP_NO='" + smp_no + "'");
  1788. HashMap result = mapper.queryOne(sqlucomm.toString());
  1789. BigDecimal seq = BigDecimal.ZERO;
  1790. if (result != null && result.get("SPECIMEN_NO") != null) {
  1791. seq = (BigDecimal) result.get("SPECIMEN_NO");
  1792. }
  1793. seq = seq.add(BigDecimal.ONE);
  1794. specimen_no = smp_no + String.format("%02d", seq.intValue());
  1795. return specimen_no;
  1796. }
  1797. /**
  1798. * 设置试样信息主表对象值
  1799. * @param smp_no
  1800. * @param qlty
  1801. * @param smp_catg
  1802. * @return
  1803. */
  1804. private JhySampleMMdoel getSampleM(String smp_no, HashMap qlty,String userName) {
  1805. // TODO Auto-generated method stub
  1806. JhySampleMMdoel model=new JhySampleMMdoel();
  1807. model.setSmp_no(smp_no);
  1808. model.setHeat_no((String) qlty.get("HEAT_NO"));
  1809. model.setBatch_no((String) qlty.get("BATCH_NO"));
  1810. model.setInspection_lot((String) qlty.get("INSPECTION_LOT"));
  1811. model.setBoard_no((String) qlty.get("BOARD_NO"));
  1812. model.setMaterial_no((String) qlty.get("MATERIAL_NO"));
  1813. model.setPsc((String) qlty.get("PSC"));
  1814. model.setPsc_desc((String) qlty.get("PSC_DESC"));
  1815. model.setSmp_catg((String) qlty.get("SMP_CATG"));
  1816. model.setCert_inst_code((String) qlty.get("CERT_INST_CODE"));
  1817. model.setCert_inst_name((String) qlty.get("CERT_INST_NAME"));
  1818. //试样类型
  1819. model.setSmp_type_code((String) qlty.get("SMP_TYPE_CODE"));
  1820. model.setSmp_type_name((String) qlty.get("SMP_TYPE_NAME"));
  1821. model.setGrade_code((String) qlty.get("GRADE_CODE"));
  1822. model.setGrade_name((String) qlty.get("GRADE_NAME"));
  1823. model.setPline_code((String) qlty.get("PLINE_CODE"));
  1824. model.setPline_name((String) qlty.get("PLINE_NAME"));
  1825. model.setCreate_id((String) qlty.get("CREATE_ID"));
  1826. model.setCreate_name(userName);
  1827. model.setCreate_time(new Date());
  1828. model.setItem_flag("1");//人工
  1829. return model;
  1830. }
  1831. /**
  1832. * 设置试样信息明细表对象值
  1833. * @param smp_no
  1834. * @param qlty
  1835. * @return
  1836. */
  1837. private JhySampleOrdMdoel getSampleOrd(String smp_no, HashMap qlty,String userName) {
  1838. // TODO Auto-generated method stub
  1839. JhySampleOrdMdoel ord=new JhySampleOrdMdoel();
  1840. ord.setSmp_no(smp_no);
  1841. ord.setDesign_key((String) qlty.get("DESIGN_KEY"));
  1842. ord.setPsc((String) qlty.get("PSC"));
  1843. ord.setPsc_desc((String) qlty.get("PSC_DESC"));
  1844. ord.setHeat_no((String) qlty.get("HEAT_NO"));
  1845. ord.setBatch_no((String) qlty.get("BATCH_NO"));
  1846. ord.setInspection_lot((String) qlty.get("INSPECTION_LOT"));
  1847. ord.setDelivery_state_code((String) qlty.get("DELIVERY_STATE_CODE"));
  1848. ord.setDelivery_state_desc((String) qlty.get("DELIVERY_STATE_DESC"));
  1849. ord.setThick((String) qlty.get("THICK"));
  1850. ord.setWidth((String) qlty.get("WIDTH"));
  1851. ord.setLength((String) qlty.get("LENGTH"));
  1852. ord.setPline_code((String) qlty.get("PLINE_CODE"));
  1853. ord.setPline_name((String) qlty.get("PLINE_NAME"));
  1854. ord.setMsc_pline((String) qlty.get("MSC_PLINE"));
  1855. ord.setProcess_code((String) qlty.get("PROCESS_CODE"));
  1856. ord.setCert_inst_code((String) qlty.get("CERT_INST_CODE"));
  1857. ord.setCert_inst_name((String) qlty.get("CERT_INST_NAME"));
  1858. ord.setSmp_type_code((String) qlty.get("SMP_TYPE_CODE"));
  1859. ord.setSmp_type_name((String) qlty.get("SMP_TYPE_NAME"));
  1860. ord.setProduct_cnt((BigDecimal) qlty.get("PRODUCT_CNT"));
  1861. ord.setProd_code((String) qlty.get("PROD_CODE"));
  1862. ord.setProd_name((String) qlty.get("PROD_NAME"));
  1863. ord.setSteel_code((String) qlty.get("STEEL_CODE"));
  1864. ord.setSteel_name((String) qlty.get("STEEL_NAME"));
  1865. ord.setStd_code((String) qlty.get("STD_CODE"));
  1866. ord.setStd_name((String) qlty.get("STD_NAME"));
  1867. ord.setCreate_id((String) qlty.get("CREATE_ID"));
  1868. ord.setCreate_name(userName);
  1869. ord.setCreate_time(new Date());
  1870. ord.setItem_flag("1");
  1871. return ord;
  1872. }
  1873. /**
  1874. * QCM_JHY_SAMPLE_CONSIGN_D 检验委托明细表 赋值
  1875. *
  1876. * @param smp_no
  1877. * @return
  1878. */
  1879. private JhySampleDModel getSampleD(String smp_no,String specimen_no, HashMap result) {
  1880. // TODO Auto-generated method stub
  1881. JhySampleDModel model = new JhySampleDModel();
  1882. model.setSmp_no(smp_no);
  1883. model.setSpecimen_no(specimen_no);
  1884. model.setHeat_no((String) result.get("HEAT_NO"));
  1885. model.setBatch_no((String) result.get("BATCH_NO"));
  1886. model.setInspection_lot((String) result.get("INSPECTION_LOT"));
  1887. model.setFreq_code((String) result.get("FREQ_CODE"));
  1888. model.setFreq_name((String) result.get("FREQ_NAME"));
  1889. model.setMaterial_no((String) result.get("MATERIAL_NO"));// 取样材料号
  1890. // 样品类型
  1891. model.setSmp_type_code((String) result.get("SMP_TYPE_CODE"));
  1892. model.setSmp_type_name((String) result.get("SMP_TYPE_NAME"));
  1893. // 试验次数
  1894. model.setTest_qty((BigDecimal) result.get("TEST_QTY"));
  1895. model.setSmp_qty((BigDecimal) result.get("SMP_QTY"));
  1896. model.setSmp_location((String) result.get("SMP_LOCATION"));
  1897. model.setBoard_no((String) result.get("BOARD_NO"));
  1898. model.setQuote_consign_no((String) result.get("QUOTE_CONSIGN_NO"));
  1899. // 初样取样编号
  1900. model.setOld_consign_no((String) result.get("OLD_CONSIGN_NO"));
  1901. model.setPline_code((String) result.get("PLINE_CODE"));
  1902. model.setPline_name((String) result.get("PLINE_NAME"));
  1903. model.setStatus("0");
  1904. model.setValidflag("1");
  1905. model.setSource((String) result.get("SOURCE"));
  1906. model.setGuid(this.getUUID());
  1907. model.setChem_item((String) result.get("CHEM_ITEM"));
  1908. model.setProduct_cnt((BigDecimal) result.get("PRODUCT_CNT"));
  1909. model.setSmp_location_code((String) result.get("SMP_LOCATION_CODE"));
  1910. model.setMemo((String) result.get("MEMO"));
  1911. model.setWeight((String)result.get("WEIGHT"));
  1912. model.setWeight_std((String)result.get("WEIGHT_STD"));
  1913. model.setWeight_sfd((String)result.get("WEIGHT_SFD"));
  1914. model.setItem_flag("1");
  1915. return model;
  1916. }
  1917. /**
  1918. * 获取材质项目对象
  1919. * @param smp_no
  1920. * @param specimen_no
  1921. * @param qlty
  1922. * @return
  1923. * @throws Exception
  1924. */
  1925. private JhySampleDItemModel getSampleItem(String smp_no, String specimen_no, HashMap qlty,String userName) throws Exception {
  1926. JhySampleDItemModel model=new JhySampleDItemModel();
  1927. model.setSmp_no(smp_no);
  1928. model.setSpecimen_no(specimen_no);
  1929. model.setSeq(createItemSeq(smp_no,specimen_no));
  1930. model.setPhy_code_l((String)qlty.get("PHY_CODE_L"));;
  1931. model.setPhy_code_m((String)qlty.get("PHY_CODE_M"));
  1932. model.setPhy_code_s((String)qlty.get("PHY_CODE_S"));
  1933. model.setPhy_name_l((String)qlty.get("PHY_NAME_L"));
  1934. model.setPhy_name_m((String)qlty.get("PHY_NAME_M"));
  1935. model.setPhy_name_s((String)qlty.get("PHY_NAME_S"));
  1936. model.setItem_code_d((String)qlty.get("ITEM_CODE_D"));
  1937. model.setItem_code_t((String)qlty.get("ITEM_CODE_T"));
  1938. model.setItem_code_s((String)qlty.get("ITEM_CODE_S"));
  1939. model.setItem_code_l((String)qlty.get("ITEM_CODE_L"));
  1940. model.setItem_name_d((String)qlty.get("ITEM_NAME_D"));
  1941. model.setItem_name_t((String)qlty.get("ITEM_NAME_T"));
  1942. model.setItem_name_s((String)qlty.get("ITEM_NAME_S"));
  1943. model.setItem_desc_l((String)qlty.get("ITEM_DESC_L"));
  1944. model.setStdmax((String)qlty.get("STDMAX"));
  1945. model.setStdmax_sign((String)qlty.get("STDMAX_SIGN"));
  1946. model.setStdmin((String)qlty.get("STDMIN"));
  1947. model.setStdmin_sign((String)qlty.get("STDMIN_SIGN"));
  1948. //试验次数
  1949. model.setTest_qty((BigDecimal) qlty.get("TEST_QTY"));
  1950. model.setSmp_qty((BigDecimal) qlty.get("SMP_QTY"));
  1951. model.setSpecl_fl((String)qlty.get("SPECL_FL"));
  1952. model.setIsjudge((String)qlty.get("ISJUDGE"));
  1953. model.setPhy_unit((String)qlty.get("PHY_UNIT"));
  1954. model.setGroup_seq((String)qlty.get("GROUP_SEQ"));
  1955. model.setQuote_specimen_no((String)qlty.get("QUOTE_SPECIMEN_NO"));
  1956. model.setQuote_seq((Integer)qlty.get("QUOTE_SEQ"));
  1957. model.setMemo((String)qlty.get("MEMO"));
  1958. model.setCreate_id((String)qlty.get("CREATE_ID"));
  1959. model.setCreate_name(userName);
  1960. model.setCreate_time(new Date());
  1961. model.setStdmemo((String)qlty.get("STDMEMO"));
  1962. model.setPhy_group_code((String)qlty.get("PHY_GROUP_CODE"));
  1963. model.setResmp_seq((String)qlty.get("RESMP_SEQ"));
  1964. model.setItem_flag("1");
  1965. //样品类型
  1966. return model;
  1967. }
  1968. /**
  1969. * 生成不带 "-" 的UUID
  1970. *
  1971. * @return
  1972. */
  1973. private String getUUID() {
  1974. UUID uuid = UUID.randomUUID();
  1975. String str = uuid.toString();
  1976. String uuidStr = str.replace("-", "");
  1977. return uuidStr;
  1978. }
  1979. /**
  1980. * 创建项目seq
  1981. *
  1982. * @param specimen_no
  1983. * @param smp_no
  1984. * @param cn
  1985. * @return
  1986. * @throws Exception
  1987. */
  1988. private Integer createItemSeq(String smp_no, String specimen_no) throws Exception {
  1989. StringBuffer sqlucomm = new StringBuffer();
  1990. sqlucomm.append("SELECT max(SEQ) SEQ FROM QCM_JHY_SAMPLE_CONSIGN_D_ITEM WHERE SMP_NO ='" + smp_no
  1991. + "' and SPECIMEN_NO='" + specimen_no + "'");
  1992. HashMap result = mapper.queryOne(sqlucomm.toString());
  1993. Integer SEQ = 0;
  1994. if (result != null && result.get("SEQ") != null) {
  1995. SEQ = ((BigDecimal) result.get("SEQ")).intValue();
  1996. }
  1997. SEQ++;
  1998. return SEQ;
  1999. }
  2000. /**
  2001. * 不同订单 同轧批号 项目一样引用
  2002. * @param materialInfo
  2003. * @return
  2004. * @throws Exception
  2005. */
  2006. public CoreReturnObject DoQuoteBatchNo(HashMap parmas) throws Exception {
  2007. try {
  2008. String strSql=" and r.CERT_INST_CODE !='IC005' ";//美国船级社不能被引用
  2009. //判断是否是模拟焊后 模拟焊后不可引用 231201上午开会决定的
  2010. String mlhSql="select t.* from qcm_jhy_sample_consign_d t,qcm_jhy_sample_r_ord r "
  2011. + " where t.smp_no = r.smp_no and r.design_key not like '19%' "
  2012. + " and t.smp_no = '"+parmas.get("SMP_NO")+"' and t.SMP_LOCATION like '%模拟焊后%' and rownum <= 1 ";
  2013. HashMap resultMlh = mapper.queryOne(mlhSql.toString());
  2014. if(resultMlh != null && resultMlh.size()>=1){
  2015. String msgmemo="订单号:"+parmas.get("DESIGN_KEY")+"下的轧批号:"+parmas.get("BATCH_NO")+"委托需全部下发实绩样委托!请核实数据";
  2016. SqlSession.close();
  2017. cro.setV_errCode(-1);
  2018. cro.setV_errMsg("引用失败!当前轧批订单号下有模拟焊后标准,技术中心规定订单号下有模拟焊后标准不可引用需送实物样,"+msgmemo);
  2019. return cro;
  2020. }
  2021. //厚板是手动选择,中板自动 小于等于-40度冲击都单独送样做
  2022. if(parmas.get("PLINE_CODE").equals("ZB1")){
  2023. String zbSql = " select i.* from qcm_jhy_sample_consign_d t,qcm_jhy_sample_r_ord r,qcm_jhy_sample_consign_d_item i "
  2024. +" 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' "
  2025. +" and r.design_key not like '19%' and to_number(REGEXP_REPLACE(i.item_code_t,'[^-0-9]','')) <= -40 "
  2026. +" and t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' and rownum <= 1 ";
  2027. HashMap hmapZb = mapper.queryOne(zbSql.toString());
  2028. if(hmapZb != null && hmapZb.size()>=1){
  2029. String msgmemo="订单号:"+parmas.get("DESIGN_KEY")+"轧批号:"+parmas.get("BATCH_NO");
  2030. SqlSession.close();
  2031. cro.setV_errCode(-1);
  2032. cro.setV_errMsg("引用失败!勾选的轧批中有冲击项目并且是小于等于-40度不可引用需要下发委托,"+msgmemo);
  2033. return cro;
  2034. }
  2035. }
  2036. String MATERIAL_NO = "1";
  2037. String smpLocationCode = "";
  2038. String CERT_INST_CODE = "";
  2039. String FREQ_CODE = "";
  2040. String sql="";
  2041. sql = " select r.CERT_INST_CODE,t.* from QCM_JHY_SAMPLE_CONSIGN_D t, qcm_jhy_sample_r_ord r"
  2042. + " where t.smp_no = r.smp_no and t.SPECIMEN_NO='"+parmas.get("SPECIMEN_NO")+"' and rownum <= 1";
  2043. HashMap resultM = mapper.queryOne(sql.toString());
  2044. if(resultM != null && resultM.size()>=1){
  2045. MATERIAL_NO = resultM.get("MATERIAL_NO").toString();
  2046. smpLocationCode = resultM.get("SMP_LOCATION_CODE").toString();
  2047. CERT_INST_CODE = resultM.get("CERT_INST_CODE").toString();
  2048. FREQ_CODE = resultM.get("FREQ_CODE").toString();
  2049. }
  2050. //记录
  2051. QcmJudgeOperateLog qjog = new QcmJudgeOperateLog();
  2052. qjog.setOperate_name(parmas.get("CREATE_NAME")== null ?"":parmas.get("CREATE_NAME").toString());
  2053. qjog.setBatchno(parmas.get("BATCH_NO") == null ?"":parmas.get("BATCH_NO").toString());
  2054. qjog.setOperate_type("引用同批实绩");
  2055. qjog.setParams(MATERIAL_NO == null ?"":MATERIAL_NO);
  2056. qjog.setProd_line(parmas.get("PLINE_CODE") == null ?"":parmas.get("PLINE_CODE").toString());
  2057. qjog.setMemo(parmas.get("SPECIMEN_NO").toString());
  2058. mapper.insertQcmJudgeOperateLog(qjog);
  2059. //19订单引用
  2060. String dkey = parmas.get("DESIGN_KEY").toString().substring(0, 2);
  2061. if("19".equals(dkey)){//19订单
  2062. parmas.put("DESIGN_KEY", parmas.get("DESIGN_KEY").toString());
  2063. if(parmas.get("SEND_ID").equals("1")){
  2064. parmas.put("SEND_ID", "系统自动");
  2065. parmas.put("CREATE_NAME", "系统自动");
  2066. }
  2067. String ret = DoQuoteBatchNo191(parmas);
  2068. if(!ret.equals("1")){
  2069. SqlSession.close();
  2070. cro.setV_errCode(-1);
  2071. cro.setV_errMsg("引用失败!"+ret);
  2072. return cro;
  2073. }
  2074. SqlSession.close();
  2075. cro.setV_errCode(1);
  2076. cro.setV_errMsg("引用成功!");
  2077. return cro;
  2078. }
  2079. //复样引用
  2080. if(parmas.get("SMP_TYPE_CODE").toString().equals("1")){
  2081. String ret = DoQuoteBatchNoFy(parmas);
  2082. if(!ret.equals("1")){
  2083. SqlSession.close();
  2084. cro.setV_errCode(-1);
  2085. cro.setV_errMsg("引用失败!"+ret);
  2086. return cro;
  2087. }
  2088. SqlSession.close();
  2089. cro.setV_errCode(1);
  2090. cro.setV_errMsg("引用成功!");
  2091. return cro;
  2092. }
  2093. //判断是否是船检
  2094. String strAgent="";
  2095. String strZ="select r.* from qcm_jhy_sample_consign_d t,qcm_jhy_sample_r_ord r where t.smp_no = r.smp_no "
  2096. +" and t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' and r.Cert_Inst_Code in ('IC002','IC005','IC006','IC007','IC009','IC008') and rownum <= 1";
  2097. HashMap hmZ=mapper.queryOne(strZ.toString());
  2098. if(hmZ!=null && hmZ.size()>=1){ //同牌号同规格
  2099. strAgent = " and r.steel_code = '"+hmZ.get("STEEL_CODE")+"' and r.thick = '"+hmZ.get("THICK")+"' and r.CERT_INST_CODE != '5000' ";
  2100. }
  2101. //引用中有两条委托 两条委托中都有冲击 而冲击温度不一样
  2102. String HCSTR="0";
  2103. HashMap result=null;
  2104. sql ="";
  2105. 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' ";
  2106. List<HashMap> hmHC=mapper.query(sql.toString());
  2107. if(hmHC!=null && hmHC.size()>=1){
  2108. String nuowei = "";
  2109. if("IC001".equals(CERT_INST_CODE)){//判断是否是挪威 挪威冲击温度一致可引用
  2110. nuowei =" and i.Item_Code_t = '"+hmHC.get(0).get("ITEM_CODE_T")+"' ";
  2111. HCSTR="1";
  2112. }
  2113. if(FREQ_CODE.equals("C") || FREQ_CODE.equals("H") || FREQ_CODE.equals("I")){
  2114. nuowei +=" and t.MATERIAL_NO = '"+MATERIAL_NO+"' ";
  2115. }
  2116. sql="";
  2117. sql="select t.* from qcm_jhy_sample_r_ord r,qcm_jhy_sample_consign_d t,qcm_jhy_sample_consign_d_item i "
  2118. +" 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")+"' "
  2119. +" 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 "
  2120. +" and t.smp_type_code = '0' and nvl(t.QUOTE_MEMO ,'null') <> '引用实绩' and t.SMP_LOCATION_CODE='"+smpLocationCode+"' "
  2121. +" and to_char(r.thick, 'fm990.099') = to_char('"+parmas.get("THICK")+"', 'fm990.099') " + strAgent + strSql +nuowei
  2122. +" order by Item_Code_t asc ";
  2123. List<HashMap> hmHC2=mapper.query(sql.toString());
  2124. if(hmHC2!=null && hmHC2.size()>=1){
  2125. sql ="";
  2126. sql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D t where t.specimen_no = '"+hmHC2.get(0).get("SPECIMEN_NO")+"' and rownum <= 1 ";
  2127. result=null;
  2128. result = mapper.queryOne(sql.toString());
  2129. HCSTR="1";
  2130. }
  2131. }
  2132. if("0".equals(HCSTR)){
  2133. //同子板引用
  2134. sql ="";
  2135. sql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D t,qcm_jhy_sample_r_ord r "
  2136. +" where t.smp_no = r.smp_no and t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"' "
  2137. +" and t.smp_type_code = '0' and t.status = '3' and nvl(t.QUOTE_MEMO ,'null') <> '引用实绩' "
  2138. +" and t.freq_code <> 'D' and CHEM_ITEM is null and t.MATERIAL_NO = '"+MATERIAL_NO+"' and t.SMP_LOCATION_CODE='"+smpLocationCode+"' "
  2139. +" and to_char(r.thick, 'fm990.099') = to_char('"+parmas.get("THICK")+"', 'fm990.099') " + strAgent + strSql
  2140. +" and rownum <= 1 order by t.send_time asc ";
  2141. result=null;
  2142. result = mapper.queryOne(sql.toString());
  2143. //同订单引用
  2144. if(result == null || result.size()<=0){
  2145. sql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D t,qcm_jhy_sample_r_ord r "
  2146. +" where t.smp_no = r.smp_no and t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"' "
  2147. +" and t.smp_type_code = '0' and t.status = '3' and nvl(t.QUOTE_MEMO ,'null') <> '引用实绩' and t.freq_code <> 'D' "
  2148. +" and t.CHEM_ITEM is null and r.DESIGN_KEY = '"+parmas.get("DESIGN_KEY")+"' " + strAgent + strSql
  2149. +" and rownum <= 1 order by t.send_time asc ";
  2150. result=null;
  2151. result = mapper.queryOne(sql.toString());
  2152. //同规格同牌号
  2153. if(result == null || result.size()<=0){
  2154. sql ="";
  2155. sql = "select * from (select * from ("
  2156. + " select (select count(1) from qcm_jhy_sample_consign_d_item i where i.specimen_no = t.specimen_no) nums,t.* "
  2157. + " from QCM_JHY_SAMPLE_CONSIGN_D t,qcm_jhy_sample_r_ord r "
  2158. +" where t.smp_no = r.smp_no and t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"' "
  2159. +" and t.smp_type_code = '0' and t.status = '3' and nvl(t.QUOTE_MEMO ,'null') <> '引用实绩' and t.SMP_LOCATION_CODE='"+smpLocationCode+"' "
  2160. +" and t.freq_code <> 'D' and t.CHEM_ITEM is null and to_char(r.thick, 'fm990.099') = '"+parmas.get("THICK")+"' " + strSql
  2161. +" and r.steel_name = '"+parmas.get("STEEL_NAME")+"' ) t order by t.nums desc) t where rownum=1 ";
  2162. result=null;
  2163. result = mapper.queryOne(sql.toString());
  2164. //同规格引用
  2165. if(result == null || result.size()<=0){
  2166. sql ="";
  2167. sql = "select * from (select * from ("
  2168. +" select (select count(1) from qcm_jhy_sample_consign_d_item i where i.specimen_no = t.specimen_no) nums,t.* "
  2169. +" from QCM_JHY_SAMPLE_CONSIGN_D t,qcm_jhy_sample_r_ord r "
  2170. +" where t.smp_no = r.smp_no and t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"' "
  2171. +" and t.smp_type_code = '0' and t.status = '3' and nvl(t.QUOTE_MEMO ,'null') <> '引用实绩' and t.SMP_LOCATION_CODE='"+smpLocationCode+"' "
  2172. +" and t.freq_code <> 'D' and t.CHEM_ITEM is null and to_char(r.thick, 'fm990.099') = '"+parmas.get("THICK")+"' " + strAgent + strSql
  2173. +" ) t order by t.nums desc) t where rownum=1 ";
  2174. result=null;
  2175. result = mapper.queryOne(sql.toString());
  2176. //随机引用
  2177. if((result == null || result.size()<=0) && strAgent.length()<=0){
  2178. sql="";
  2179. 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.* "
  2180. + " from QCM_JHY_SAMPLE_CONSIGN_D t,qcm_jhy_sample_r_ord r where t.smp_no = r.smp_no " + strSql
  2181. + " and t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"' "
  2182. + " and t.smp_type_code = '0' and t.status = '3' and nvl(t.QUOTE_MEMO ,'null') <> '引用实绩' "
  2183. + " and t.freq_code <> 'D' and t.CHEM_ITEM is null ) t order by t.nums desc) t where rownum=1 ";
  2184. result=null;
  2185. result = mapper.queryOne(sql.toString());
  2186. }
  2187. }
  2188. }
  2189. }
  2190. }
  2191. if (result != null && result.size()>=1) {
  2192. //判断厚度是否大于引用的厚度
  2193. sql ="";
  2194. 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 ";
  2195. List<HashMap> OrdLists=mapper.query(sql.toString());
  2196. if(OrdLists!=null && OrdLists.size()>=1){
  2197. String thick2 = OrdLists.get(0).get("THICK").toString();
  2198. String thick = parmas.get("THICK").toString();
  2199. if(!thick2.equals(thick)){
  2200. SqlSession.rollback();
  2201. SqlSession.close();
  2202. cro.setV_errCode(-1);
  2203. cro.setV_errMsg("引用失败!规格不一样");
  2204. return cro;
  2205. }
  2206. }
  2207. //查询引用的所有明细 240308增加代码 and t.specl_fl <> '4' 把加项项目排除
  2208. sql ="";
  2209. sql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' and t.specl_fl <> '4' ";
  2210. List<HashMap> qltyLists=mapper.query(sql.toString());
  2211. List<HashMap> qltyLists2=null;
  2212. //查询是否有LRA加项项目
  2213. sql="";
  2214. 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' ";
  2215. List<HashMap> qltyLRA=mapper.query(sql.toString());
  2216. if(qltyLRA!=null && qltyLRA.size()>=1){
  2217. //查询被引用的所有明细
  2218. sql ="";
  2219. 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' ";
  2220. qltyLists2=mapper.query(sql.toString());
  2221. }else{
  2222. //查询被引用的所有明细
  2223. sql ="";
  2224. sql = "select t.* from QCM_JHY_INSP_PHYSICS t where t.specimen_no = '"+result.get("SPECIMEN_NO")+"' and t.quote_specimen_no is null ";
  2225. qltyLists2=mapper.query(sql.toString());
  2226. }
  2227. Integer bQuote = qltyLists.size();//引用
  2228. Integer yQuote = qltyLists2.size();//被引用
  2229. int quotenum = 0;//已引用数据
  2230. String hbB01 ="";//弯曲
  2231. //引用
  2232. for (int i = 0; i < qltyLists.size(); i++) {//引用在外层循环 对比 引用中有没有相应的项目有 插入
  2233. if("B01".equals((String) qltyLists.get(i).get("PHY_CODE_S"))){
  2234. hbB01 ="0";
  2235. }else{
  2236. hbB01 ="";
  2237. }
  2238. //代码
  2239. String phyCodeL = (String) qltyLists.get(i).get("PHY_CODE_L");//材质检验大项代码
  2240. String phyCodeM = (String) qltyLists.get(i).get("PHY_CODE_M");//试样组代码
  2241. String phyCodeS = (String) qltyLists.get(i).get("PHY_CODE_S");//材质检验项目代码
  2242. String itemCodeD = (String) qltyLists.get(i).get("ITEM_CODE_D");//试验方向代码
  2243. String itemCodeT = (String) qltyLists.get(i).get("ITEM_CODE_T");//试验温度代码 试验温度代码 冲击 被引用
  2244. String itemCodeS = (String) qltyLists.get(i).get("ITEM_CODE_S");//试样尺寸代码
  2245. //名称
  2246. String phyNameL = (String) qltyLists.get(i).get("PHY_NAME_L");//材质检验大项代码
  2247. String phyNameM = (String) qltyLists.get(i).get("PHY_NAME_M");//试样组代码
  2248. String phyNameS = (String) qltyLists.get(i).get("PHY_NAME_S");//材质检验项目代码
  2249. String itemNameD = (String) qltyLists.get(i).get("ITEM_NAME_D");//试验方向代码
  2250. String itemNameT = (String) qltyLists.get(i).get("ITEM_NAME_T");//试验温度代码 试验温度代码 冲击 被引用
  2251. String itemNameS = (String) qltyLists.get(i).get("ITEM_NAME_S");//试样尺寸代码
  2252. String itemCodeL = (String) qltyLists.get(i).get("ITEM_CODE_L");//试验位置代码
  2253. String itemDescL = (String) qltyLists.get(i).get("ITEM_DESC_L");
  2254. BigDecimal seq = (BigDecimal) qltyLists.get(i).get("SEQ");
  2255. String bigdjs = seq.toString();
  2256. Integer bigd4 = Integer.parseInt(bigdjs);
  2257. String newItem=phyCodeL+"-"+phyCodeM+"-"+phyCodeS;
  2258. newItem=newItem+"-"+(itemCodeD!=null?itemCodeD:"null");
  2259. newItem=newItem+"-"+(itemCodeT!=null?itemCodeT:"null");
  2260. newItem=newItem+"-"+(itemCodeS!=null?itemCodeS:"null");
  2261. //newItem=newItem+"-"+(itemCodeL!=null?itemCodeL:"null");
  2262. //弯曲
  2263. ///// String newItemHB=phyCodeL+"-"+phyCodeM+"-"+phyCodeS+"-"+(itemCodeD!=null?itemCodeD:"null")+"-"+(itemCodeT!=null?itemCodeT:"null");
  2264. //被引用
  2265. for (HashMap hashMap : qltyLists2) {
  2266. //代码
  2267. String phyCodeL2 = (String) hashMap.get("PHY_CODE_L");//材质检验大项代码
  2268. String phyCodeM2 = (String) hashMap.get("PHY_CODE_M");//试样组代码
  2269. String phyCodeS2 = (String) hashMap.get("PHY_CODE_S");//材质检验项目代码
  2270. String itemCodeD2 = (String) hashMap.get("ITEM_CODE_D");//试验方向代码
  2271. String itemCodeT2 = (String) hashMap.get("ITEM_CODE_T");//试验温度代码 试验温度代码 冲击 被引用
  2272. String itemCodeS2 = (String) hashMap.get("ITEM_CODE_S");//试样尺寸代码
  2273. String itemCodeL2 = (String) hashMap.get("ITEM_CODE_L");//试验位置代码
  2274. String newItem2=phyCodeL2+"-"+phyCodeM2+"-"+phyCodeS2;
  2275. newItem2=newItem2+"-"+(itemCodeD2!=null?itemCodeD2:"null");
  2276. newItem2=newItem2+"-"+(itemCodeT2!=null?itemCodeT2:"null");
  2277. newItem2=newItem2+"-"+(itemCodeS2!=null?itemCodeS2:"null");
  2278. //newItem2=newItem2+"-"+(itemCodeL2!=null?itemCodeL2:"null");
  2279. //弯曲
  2280. ///// String newItemHB2=phyCodeL2+"-"+phyCodeM2+"-"+phyCodeS2+"-"+(itemCodeD2!=null?itemCodeD2:"null")+"-"+(itemCodeT2!=null?itemCodeT2:"null");
  2281. //判断是否是冲击试验
  2282. if(phyCodeS.equals("C01") || phyCodeS.equals("C02")){
  2283. if(phyCodeS.equals(phyCodeS2)){
  2284. Integer co1t= Integer.parseInt(itemCodeT);//引用
  2285. Integer co2t= Integer.parseInt(itemCodeT2);//被引用
  2286. if(co1t >= co2t){
  2287. sql = "";
  2288. sql = " insert into QCM_JHY_INSP_PHYSICS "
  2289. +" (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, "
  2290. +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
  2291. +" VAL13,VAL14,VAL15,AVG_VAL,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, "
  2292. +" PHY_UNIT,MEMO) "
  2293. +" select '"+parmas.get("SPECIMEN_NO")+"','"+bigd4+"',TEST_QTY,'"+phyCodeL+"','"+phyNameL+"','"+phyCodeM+"','"+phyNameM+"','"+phyCodeS+"','"+phyNameS+"','"+itemCodeD+"','"+itemNameD+"', "
  2294. +" '"+itemCodeT+"','"+itemNameT+"','"+itemCodeS+"','"+itemNameS+"',VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
  2295. +" VAL13,VAL14,VAL15,AVG_VAL,'"+parmas.get("CREATE_NAME")+"',sysdate,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,'"+itemCodeL+"','"+itemDescL+"', "
  2296. +" PHY_UNIT,MEMO from QCM_JHY_INSP_PHYSICS t "
  2297. + " where t.specimen_no = '"+(String)hashMap.get("SPECIMEN_NO")+"' "
  2298. + "and t.seq = '"+hashMap.get("SEQ")+"' ";
  2299. mapper.insert(sql);
  2300. //修改ITEM表
  2301. sql = "";
  2302. sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t set t.QUOTE_MEMO = '已引用"+result.get("SPECIMEN_NO")+"' "
  2303. + " where t.SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' and t.seq = '"+seq+"' ";
  2304. mapper.updateJudgeStatus(sql.toString());
  2305. quotenum++;
  2306. break;
  2307. }
  2308. }
  2309. }/*else if (phyCodeS.equals("B01")){//弯曲试验 冷弯(面弯)试验/////
  2310. //标准一样的引用
  2311. if(newItemHB.equals(newItemHB2)){
  2312. sql = "";
  2313. sql = " insert into QCM_JHY_INSP_PHYSICS "
  2314. +" (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, "
  2315. +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
  2316. +" VAL13,VAL14,VAL15,AVG_VAL,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, "
  2317. +" PHY_UNIT,MEMO) "
  2318. +" select '"+parmas.get("SPECIMEN_NO")+"','"+bigd4+"',TEST_QTY,'"+phyCodeL+"','"+phyNameL+"','"+phyCodeM+"','"+phyNameM+"','"+phyCodeS+"','"+phyNameS+"','"+itemCodeD+"','"+itemNameD+"', "
  2319. +" '"+itemCodeT+"','"+itemNameT+"','"+itemCodeS+"','"+itemNameS+"',VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
  2320. +" VAL13,VAL14,VAL15,AVG_VAL,'"+parmas.get("CREATE_NAME")+"',sysdate,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,'"+itemCodeL+"','"+itemDescL+"', "
  2321. +" PHY_UNIT,MEMO from QCM_JHY_INSP_PHYSICS t "
  2322. + " where t.specimen_no = '"+(String)hashMap.get("SPECIMEN_NO")+"' "
  2323. + "and t.seq = '"+hashMap.get("SEQ")+"' ";
  2324. mapper.insert(sql);
  2325. //修改ITEM表
  2326. sql = "";
  2327. sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t set t.QUOTE_MEMO = '已引用"+result.get("SPECIMEN_NO")+"' "
  2328. + " where t.SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' and t.seq = '"+seq+"' ";
  2329. mapper.updateJudgeStatus(sql.toString());
  2330. quotenum++;
  2331. hbB01 ="1";
  2332. break;
  2333. }
  2334. }*/else{//其它试验
  2335. //标准一样的引用
  2336. if(newItem.equals(newItem2)){
  2337. sql = "";
  2338. sql = " insert into QCM_JHY_INSP_PHYSICS "
  2339. +" (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, "
  2340. +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
  2341. +" VAL13,VAL14,VAL15,AVG_VAL,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, "
  2342. +" PHY_UNIT,MEMO) "
  2343. +" select '"+parmas.get("SPECIMEN_NO")+"','"+bigd4+"',TEST_QTY,'"+phyCodeL+"','"+phyNameL+"','"+phyCodeM+"','"+phyNameM+"','"+phyCodeS+"','"+phyNameS+"','"+itemCodeD+"','"+itemNameD+"', "
  2344. +" '"+itemCodeT+"','"+itemNameT+"','"+itemCodeS+"','"+itemNameS+"',VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
  2345. +" VAL13,VAL14,VAL15,AVG_VAL,'"+parmas.get("CREATE_NAME")+"',sysdate,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,'"+itemCodeL+"','"+itemDescL+"', "
  2346. +" PHY_UNIT,MEMO from QCM_JHY_INSP_PHYSICS t "
  2347. + " where t.specimen_no = '"+(String)hashMap.get("SPECIMEN_NO")+"' "
  2348. + "and t.seq = '"+hashMap.get("SEQ")+"' ";
  2349. mapper.insert(sql);
  2350. //修改ITEM表
  2351. sql = "";
  2352. sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t set t.QUOTE_MEMO = '已引用"+result.get("SPECIMEN_NO")+"' "
  2353. + " where t.SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' and t.seq = '"+seq+"' ";
  2354. mapper.updateJudgeStatus(sql.toString());
  2355. quotenum++;
  2356. break;
  2357. }
  2358. }
  2359. }
  2360. //申报:郭明清 主题:非计划船板改普板,冷弯需要系统默认合格 申报时间:2023-04-27 16:49:59
  2361. //原牌号为船板 BV/IC003法国船级社,KR/IC004韩国船级社,DNV/IC001挪威船级社,CCS/IC010中国船级社 、ABS/IC005美国船级社、LR/IC009 英国船级社、NK/KA36/IC006 日本船级社、RINA/IC007 意大利船级社 、RS/IC002 俄罗斯 IC012 客户认证
  2362. //改成普锰板(Q235A/B、Q345A/B、Q355B)
  2363. //被引用是原牌号船板 引用是改判 普锰板
  2364. //弯曲 默认合格
  2365. if("B01".equals((String) qltyLists.get(i).get("PHY_CODE_S"))&& !"".equals(hbB01) && hbB01.equals("0")){
  2366. sql="";
  2367. sql="select d.* from qcm_jhy_sample_consign_d d,qcm_jhy_sample_r_ord r "
  2368. +" where d.smp_no = r.smp_no and r.steel_code in ('Q235A','Q235B','Q345A','Q345B','Q355B') "
  2369. +" and d.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' ";
  2370. List<HashMap> hashMap=mapper.query(sql.toString());
  2371. if(hashMap!=null && hashMap.size()>=1){
  2372. sql="";
  2373. sql="select r.* from qcm_jhy_sample_consign_d d,qcm_jhy_sample_r_ord r "
  2374. +" where d.smp_no = r.smp_no and r.cert_inst_code in ('IC005','IC009','IC006','IC007','IC002','IC003','IC004','IC001','IC010') "
  2375. +" and d.specimen_no = '"+result.get("SPECIMEN_NO")+"' ";
  2376. List<HashMap> hashMap2=mapper.query(sql.toString());
  2377. //船板没有弯曲
  2378. sql="";
  2379. sql="select * from qcm_jhy_sample_consign_d_item where specimen_no = '"+result.get("SPECIMEN_NO")+"' and phy_code_s='B01' ";
  2380. List<HashMap> hashMap3=mapper.query(sql.toString());
  2381. if(hashMap2!=null && hashMap2.size()>=1 && hashMap3.size()<=0 ){
  2382. sql="";
  2383. sql="insert into QCM_JHY_INSP_PHYSICS "
  2384. +" (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, "
  2385. +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,AVG_VAL,CREATE_NAME,CREATE_TIME,DEFECT_FLAG,MAX_VAL, "
  2386. +" MIN_VAL,ITEM_CODE_L,ITEM_DESC_L,PHY_UNIT,MEMO) "
  2387. +" 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, "
  2388. +" 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, "
  2389. +" t.phy_unit,'默认合格' "
  2390. +" from qcm_jhy_sample_consign_d_item t "
  2391. +" where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' "
  2392. +" and t.phy_code_s = 'B01' ";
  2393. mapper.insert(sql);
  2394. //修改ITEM表
  2395. sql = "";
  2396. sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t set t.QUOTE_MEMO = '默认合格' "
  2397. + " where t.SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' and t.phy_code_s = 'B01' ";
  2398. mapper.updateJudgeStatus(sql.toString());
  2399. quotenum++;
  2400. }
  2401. }
  2402. }
  2403. }
  2404. //被引用的项目 全部 已引用
  2405. if(quotenum == qltyLists.size()){
  2406. //修改D表
  2407. sql = "";
  2408. sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.STATUS = '3',t.SEND_ID = '"+parmas.get("SEND_ID")+"',"
  2409. + " t.SEND_NAME = '"+parmas.get("CREATE_NAME")+"',t.SEND_TIME = sysdate,t.SEND_MEMO = '有引用',t.QUOTE_MEMO = '引用实绩' "
  2410. + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'"
  2411. + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' ";
  2412. mapper.updateJudgeStatus(sql.toString());
  2413. //往log表中插入p
  2414. sql = "";
  2415. sql = " INSERT INTO QCM_JUDGE_LOG ( JUDGE_TYPE,MATERIAL_NO,CREATE_TIME,CREATE_NAME,PROD_LINE) "
  2416. +" VALUES ( 'P', '"+parmas.get("SMP_NO")+"', SYSDATE,'system','"+parmas.get("PLINE_CODE")+"')";
  2417. mapper.insert(sql);
  2418. }else{
  2419. //修改D表
  2420. sql = "";
  2421. sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.SEND_MEMO = '有引用',t.QUOTE_MEMO = '引用实绩' "
  2422. + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'"
  2423. + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' ";
  2424. mapper.updateJudgeStatus(sql.toString());
  2425. }
  2426. }else{
  2427. SqlSession.close();
  2428. cro.setV_errCode(-1);
  2429. cro.setV_errMsg("该轧批未返回实绩或没有引用的对象!请在委托记录中核实相应委托数据");
  2430. return cro;
  2431. }
  2432. } catch (Exception e) {
  2433. SqlSession.rollback();
  2434. SqlSession.close();
  2435. cro.setV_errCode(-1);
  2436. cro.setV_errMsg("引用失败!"+e.getMessage());
  2437. return cro;
  2438. }
  2439. SqlSession.commit();
  2440. SqlSession.close();
  2441. cro.setV_errCode(1);
  2442. cro.setV_errMsg("引用成功!");
  2443. return cro;
  2444. }
  2445. /**
  2446. * 19订单自动引用 不同订单 同轧批号 项目一样引用
  2447. * @param materialInfo
  2448. * @return
  2449. * @throws Exception
  2450. */
  2451. public void DoQuoteBatchNo19(HashMap parmas) throws Exception {
  2452. SqlSession = QCM.COMMUNAL.SqlSessionBuilder.openSqlSession();
  2453. mapper = SqlSession.getMapper(QCM.COMMUNAL.OrderSqMapper.class);
  2454. try {
  2455. String chiStr = "";
  2456. String process_nos="";
  2457. String pno1="";
  2458. String pno2="";
  2459. String pno3="";
  2460. if(parmas.get("CREATE_NAME").equals("调试人员")){
  2461. parmas.put("SEND_ID", "系统自动");
  2462. parmas.put("CREATE_NAME", "系统自动");
  2463. }
  2464. //判断是否按子板取样 19订单
  2465. String chi = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D t where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' and rownum <= 1 ";
  2466. List<HashMap> CHILists=mapper.query(chi.toString());
  2467. if(CHILists != null && CHILists.size()>=1 ){
  2468. process_nos=CHILists.get(0).get("PROCESS_NOS").toString();
  2469. 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")){
  2470. chiStr = " and t.MATERIAL_NO = '"+CHILists.get(0).get("MATERIAL_NO")+"' ";
  2471. }
  2472. }
  2473. pno1=process_nos.substring(0, 1);//第一位
  2474. pno2=process_nos.substring(3, 4);//第四位
  2475. pno3=process_nos.substring(4, 5);//第五位
  2476. String sql ="";
  2477. sql = "select * from (select * from ("
  2478. + " 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.* "
  2479. + " from QCM_JHY_SAMPLE_CONSIGN_D t,qcm_jhy_sample_r_ord r "
  2480. +" where t.smp_no = r.smp_no and t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"' "
  2481. +" and t.smp_type_code = '0' and t.status = '3' and t.freq_code <> 'D' and t.CHEM_ITEM is null "
  2482. +" and to_char(r.thick, 'fm990.099') = to_char('"+parmas.get("THICK")+"', 'fm990.099') and r.DESIGN_KEY not like '19%' "
  2483. + chiStr
  2484. +" and substr(t.PROCESS_NOS,0,1)='"+pno1+"' "
  2485. +" and substr(t.PROCESS_NOS,4,1)='"+pno2+"' "
  2486. +" and substr(t.PROCESS_NOS,5,1)='"+pno3+"' "
  2487. + " ) t where t.nums !=0 order by t.nums desc) t where rownum=1 ";
  2488. HashMap result = mapper.queryOne(sql.toString());
  2489. if(result==null || result.size()<=0){
  2490. 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 "
  2491. +" where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"' "
  2492. +" and t.smp_type_code = '0' and t.status = '3' "
  2493. +" and t.freq_code <> 'D' and CHEM_ITEM is null "
  2494. +" and substr(t.PROCESS_NOS,0,1)='"+pno1+"' "
  2495. +" and substr(t.PROCESS_NOS,4,1)='"+pno2+"' "
  2496. +" and substr(t.PROCESS_NOS,5,1)='"+pno3+"' "
  2497. +" and rownum <= 1 order by t.send_time asc ) t where t.nums != 0";
  2498. result=null;
  2499. result = mapper.queryOne(sql.toString());
  2500. }
  2501. if (result != null && result.size()>=1) {
  2502. //判断厚度是否大于引用的厚度
  2503. sql ="";
  2504. 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 ";
  2505. List<HashMap> OrdLists=mapper.query(sql.toString());
  2506. if(OrdLists!=null && OrdLists.size()>=1 && !StringUtils.isBlank(OrdLists.get(0).get("THICK").toString())){
  2507. String hmap2 = OrdLists.get(0).get("THICK").toString();
  2508. double thick1 = Double.parseDouble(hmap2);
  2509. String thick = parmas.get("THICK").toString();
  2510. double thick2 = Double.parseDouble(thick);
  2511. if(thick2>thick1){
  2512. String str =thick2+">"+thick1;
  2513. //修改D表
  2514. sql = "";
  2515. sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.ONEMEMO = '19订单委托厚度大于引用厚度不可引用:'||'"+str+"' ,t.ARTIFICIAL_MEMO='0' "
  2516. + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'"
  2517. + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' ";
  2518. mapper.updateJudgeStatus(sql.toString());
  2519. SqlSession.commit();
  2520. SqlSession.close();
  2521. return;//被引用不能大于引用
  2522. }
  2523. if((thick1-thick2)>=3){
  2524. String str =thick2+"<"+thick1;
  2525. sql = "";
  2526. sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.ONEMEMO = '19订单委托厚度小于引用厚度不可超过2mm,超过2mm不可引用:'||'"+str+"' ,t.ARTIFICIAL_MEMO='0' "
  2527. + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'"
  2528. + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' ";
  2529. mapper.updateJudgeStatus(sql.toString());
  2530. SqlSession.commit();
  2531. SqlSession.close();
  2532. return;//引用-被引用不能大于等于3 小2mm
  2533. }
  2534. }
  2535. //查询被引用的所有明细
  2536. sql ="";
  2537. sql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' ";
  2538. List<HashMap> qltyLists=mapper.query(sql.toString());
  2539. //查询引用的所有明细
  2540. sql ="";
  2541. sql = "select t.* from QCM_JHY_INSP_PHYSICS t where t.specimen_no = '"+result.get("SPECIMEN_NO")+"' "
  2542. + " and t.quote_specimen_no is null and t.VAL1 is not null and t.create_name <>'现场默认' ";
  2543. List<HashMap> qltyLists2=mapper.query(sql.toString());
  2544. Integer bQuote = qltyLists.size();//被引用
  2545. Integer yQuote = qltyLists2.size();//引用
  2546. int quotenum = 0;//已引用数据
  2547. String hbB01 ="";//弯曲
  2548. //被引用
  2549. for (int i = 0; i < qltyLists.size(); i++) {//被引用在外层循环 对比 引用中有没有相应的项目有 插入
  2550. if("B01".equals((String) qltyLists.get(i).get("PHY_CODE_S"))){
  2551. hbB01 ="0";
  2552. }else{
  2553. hbB01 ="";
  2554. }
  2555. //代码
  2556. String phyCodeL = (String) qltyLists.get(i).get("PHY_CODE_L");//材质检验大项代码
  2557. String phyCodeM = (String) qltyLists.get(i).get("PHY_CODE_M");//试样组代码
  2558. String phyCodeS = (String) qltyLists.get(i).get("PHY_CODE_S");//材质检验项目代码
  2559. String itemCodeD = (String) qltyLists.get(i).get("ITEM_CODE_D");//试验方向代码
  2560. String itemCodeT = (String) qltyLists.get(i).get("ITEM_CODE_T");//试验温度代码 试验温度代码 冲击 被引用
  2561. String itemCodeS = (String) qltyLists.get(i).get("ITEM_CODE_S");//试样尺寸代码
  2562. //名称
  2563. String phyNameL = (String) qltyLists.get(i).get("PHY_NAME_L");//材质检验大项代码
  2564. String phyNameM = (String) qltyLists.get(i).get("PHY_NAME_M");//试样组代码
  2565. String phyNameS = (String) qltyLists.get(i).get("PHY_NAME_S");//材质检验项目代码
  2566. String itemNameD = (String) qltyLists.get(i).get("ITEM_NAME_D");//试验方向代码
  2567. String itemNameT = (String) qltyLists.get(i).get("ITEM_NAME_T");//试验温度代码 试验温度代码 冲击 被引用
  2568. String itemNameS = (String) qltyLists.get(i).get("ITEM_NAME_S");//试样尺寸代码
  2569. String itemCodeL = (String) qltyLists.get(i).get("ITEM_CODE_L");//试验位置代码
  2570. String itemDescL = (String) qltyLists.get(i).get("ITEM_DESC_L");
  2571. BigDecimal seq = (BigDecimal) qltyLists.get(i).get("SEQ");
  2572. String bigdjs = seq.toString();
  2573. Integer bigd4 = Integer.parseInt(bigdjs);
  2574. String newItem=phyCodeL+"-"+phyCodeM+"-"+phyCodeS;
  2575. newItem=newItem+"-"+(itemCodeD!=null?itemCodeD:"null");
  2576. newItem=newItem+"-"+(itemCodeT!=null?itemCodeT:"null");
  2577. newItem=newItem+"-"+(itemCodeS!=null?itemCodeS:"null");
  2578. //引用
  2579. for (HashMap hashMap : qltyLists2) {
  2580. //代码
  2581. String phyCodeL2 = (String) hashMap.get("PHY_CODE_L");//材质检验大项代码
  2582. String phyCodeM2 = (String) hashMap.get("PHY_CODE_M");//试样组代码
  2583. String phyCodeS2 = (String) hashMap.get("PHY_CODE_S");//材质检验项目代码
  2584. String itemCodeD2 = (String) hashMap.get("ITEM_CODE_D");//试验方向代码
  2585. String itemCodeT2 = (String) hashMap.get("ITEM_CODE_T");//试验温度代码 试验温度代码 冲击 被引用
  2586. String itemCodeS2 = (String) hashMap.get("ITEM_CODE_S");//试样尺寸代码
  2587. String newItem2=phyCodeL2+"-"+phyCodeM2+"-"+phyCodeS2;
  2588. newItem2=newItem2+"-"+(itemCodeD2!=null?itemCodeD2:"null");
  2589. newItem2=newItem2+"-"+(itemCodeT2!=null?itemCodeT2:"null");
  2590. newItem2=newItem2+"-"+(itemCodeS2!=null?itemCodeS2:"null");
  2591. //判断是否是冲击试验
  2592. if(phyCodeS.equals("C01") || phyCodeS.equals("C02")){
  2593. if(phyCodeS.equals(phyCodeS2)){
  2594. double co1t = Double.valueOf(itemCodeT);
  2595. double co2t = Double.valueOf(itemCodeT2);
  2596. //Integer co1t= Integer.parseInt(itemCodeT);//被引用
  2597. //Integer co2t= Integer.parseInt(itemCodeT2);//引用
  2598. if(co1t >= co2t){
  2599. sql = "";
  2600. sql = " insert into QCM_JHY_INSP_PHYSICS "
  2601. +" (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, "
  2602. +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
  2603. +" VAL13,VAL14,VAL15,AVG_VAL,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, "
  2604. +" PHY_UNIT,MEMO) "
  2605. +" select '"+parmas.get("SPECIMEN_NO")+"','"+bigd4+"',TEST_QTY,'"+phyCodeL+"','"+phyNameL+"','"+phyCodeM+"','"+phyNameM+"','"+phyCodeS+"','"+phyNameS+"','"+itemCodeD+"','"+itemNameD+"', "
  2606. +" '"+itemCodeT+"','"+itemNameT+"','"+itemCodeS+"','"+itemNameS+"',VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
  2607. +" VAL13,VAL14,VAL15,AVG_VAL,'"+parmas.get("CREATE_NAME")+"',sysdate,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,'"+itemCodeL+"','"+itemDescL+"', "
  2608. +" PHY_UNIT,MEMO from QCM_JHY_INSP_PHYSICS t "
  2609. + " where t.specimen_no = '"+(String)hashMap.get("SPECIMEN_NO")+"' "
  2610. + "and t.seq = '"+hashMap.get("SEQ")+"' ";
  2611. mapper.insert(sql);
  2612. //修改ITEM表
  2613. sql = "";
  2614. sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t set t.QUOTE_MEMO = '已引用"+result.get("SPECIMEN_NO")+"' "
  2615. + " where t.SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' and t.seq = '"+seq+"' ";
  2616. mapper.updateJudgeStatus(sql.toString());
  2617. quotenum++;
  2618. break;
  2619. }
  2620. }
  2621. }else{//其它试验
  2622. //标准一样的引用
  2623. if(newItem.equals(newItem2)){
  2624. sql = "";
  2625. sql = " insert into QCM_JHY_INSP_PHYSICS "
  2626. +" (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, "
  2627. +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
  2628. +" VAL13,VAL14,VAL15,AVG_VAL,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, "
  2629. +" PHY_UNIT,MEMO) "
  2630. +" select '"+parmas.get("SPECIMEN_NO")+"','"+bigd4+"',TEST_QTY,'"+phyCodeL+"','"+phyNameL+"','"+phyCodeM+"','"+phyNameM+"','"+phyCodeS+"','"+phyNameS+"','"+itemCodeD+"','"+itemNameD+"', "
  2631. +" '"+itemCodeT+"','"+itemNameT+"','"+itemCodeS+"','"+itemNameS+"',VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
  2632. +" VAL13,VAL14,VAL15,AVG_VAL,'"+parmas.get("CREATE_NAME")+"',sysdate,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,'"+itemCodeL+"','"+itemDescL+"', "
  2633. +" PHY_UNIT,MEMO from QCM_JHY_INSP_PHYSICS t "
  2634. + " where t.specimen_no = '"+(String)hashMap.get("SPECIMEN_NO")+"' "
  2635. + "and t.seq = '"+hashMap.get("SEQ")+"' ";
  2636. mapper.insert(sql);
  2637. //修改ITEM表
  2638. sql = "";
  2639. sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t set t.QUOTE_MEMO = '已引用"+result.get("SPECIMEN_NO")+"' "
  2640. + " where t.SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' and t.seq = '"+seq+"' ";
  2641. mapper.updateJudgeStatus(sql.toString());
  2642. quotenum++;
  2643. if("B01".equals(phyCodeS2) && "B01".equals((String) qltyLists.get(i).get("PHY_CODE_S"))){
  2644. hbB01="1";
  2645. }
  2646. break;
  2647. }
  2648. }
  2649. }
  2650. //中厚板非计划处置维护 袁传泉 2023-11-07 10:47:23
  2651. if("B01".equals((String) qltyLists.get(i).get("PHY_CODE_S"))&& !"".equals(hbB01) && hbB01.equals("0")){
  2652. sql="";
  2653. sql="insert into QCM_JHY_INSP_PHYSICS "
  2654. +" (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, "
  2655. +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,AVG_VAL,CREATE_NAME,CREATE_TIME,DEFECT_FLAG,MAX_VAL, "
  2656. +" MIN_VAL,ITEM_CODE_L,ITEM_DESC_L,PHY_UNIT,MEMO) "
  2657. +" 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, "
  2658. +" 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, "
  2659. +" t.phy_unit,'默认合格' "
  2660. +" from qcm_jhy_sample_consign_d_item t "
  2661. +" where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' "
  2662. +" and t.phy_code_s = 'B01' ";
  2663. mapper.insert(sql);
  2664. //修改ITEM表
  2665. sql = "";
  2666. sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t set t.QUOTE_MEMO = '默认合格' "
  2667. + " where t.SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' and t.phy_code_s = 'B01' ";
  2668. mapper.updateJudgeStatus(sql.toString());
  2669. quotenum++;
  2670. }
  2671. //申报:郭明清 主题:非计划船板改普板,冷弯需要系统默认合格 申报时间:2023-04-27 16:49:59
  2672. //原牌号为船板 BV/IC003法国船级社,KR/IC004韩国船级社,DNV/IC001挪威船级社,CCS/IC010中国船级社 、ABS/IC005美国船级社、LR/IC009 英国船级社、NK/KA36/IC006 日本船级社、RINA/IC007 意大利船级社 、RS/IC002 俄罗斯 IC012 客户认证
  2673. //改成普锰板(Q235A/B、Q345A/B、Q355B)
  2674. //被引用是原牌号船板 引用是改判 普锰板
  2675. //弯曲 默认合格
  2676. /*if("B01".equals((String) qltyLists.get(i).get("PHY_CODE_S"))&& !"".equals(hbB01) && hbB01.equals("0")){
  2677. sql="";
  2678. sql="select d.* from qcm_jhy_sample_consign_d d,qcm_jhy_sample_r_ord r "
  2679. +" where d.smp_no = r.smp_no and r.steel_code in ('Q235A','Q235B','Q345A','Q345B','Q355B') "
  2680. +" and d.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' ";
  2681. List<HashMap> hashMap=mapper.query(sql.toString());
  2682. if(hashMap!=null && hashMap.size()>=1){
  2683. sql="";
  2684. sql="select r.* from qcm_jhy_sample_consign_d d,qcm_jhy_sample_r_ord r "
  2685. +" where d.smp_no = r.smp_no and r.cert_inst_code in ('IC005','IC009','IC006','IC007','IC002','IC003','IC004','IC001','IC010') "
  2686. +" and d.specimen_no = '"+result.get("SPECIMEN_NO")+"' ";
  2687. List<HashMap> hashMap2=mapper.query(sql.toString());
  2688. //船板没有弯曲
  2689. sql="";
  2690. sql="select * from qcm_jhy_sample_consign_d_item where specimen_no = '"+result.get("SPECIMEN_NO")+"' and phy_code_s='B01' ";
  2691. List<HashMap> hashMap3=mapper.query(sql.toString());
  2692. if(hashMap2!=null && hashMap2.size()>=1 && hashMap3.size()<=0 ){
  2693. sql="";
  2694. sql="insert into QCM_JHY_INSP_PHYSICS "
  2695. +" (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, "
  2696. +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,AVG_VAL,CREATE_NAME,CREATE_TIME,DEFECT_FLAG,MAX_VAL, "
  2697. +" MIN_VAL,ITEM_CODE_L,ITEM_DESC_L,PHY_UNIT,MEMO) "
  2698. +" 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, "
  2699. +" 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, "
  2700. +" t.phy_unit,'默认合格' "
  2701. +" from qcm_jhy_sample_consign_d_item t "
  2702. +" where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' "
  2703. +" and t.phy_code_s = 'B01' ";
  2704. mapper.insert(sql);
  2705. //修改ITEM表
  2706. sql = "";
  2707. sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t set t.QUOTE_MEMO = '默认合格' "
  2708. + " where t.SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' and t.phy_code_s = 'B01' ";
  2709. mapper.updateJudgeStatus(sql.toString());
  2710. quotenum++;
  2711. }
  2712. }
  2713. }*/
  2714. }
  2715. //19HJGP 不自动下发
  2716. sql="";
  2717. sql="select r.* from qcm_jhy_sample_consign_d t,qcm_jhy_sample_r_ord r "
  2718. + " where t.smp_no = r.smp_no and t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' and r.design_key like '19HJGP%' and rownum=1 ";
  2719. HashMap resultHJGP = mapper.queryOne(sql.toString());
  2720. if(resultHJGP!=null && resultHJGP.size()>=1){
  2721. if(quotenum == qltyLists.size()){
  2722. //修改D表
  2723. sql = "";
  2724. sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.STATUS = '3',t.SEND_ID = '"+parmas.get("SEND_ID")+"',"
  2725. + " t.SEND_NAME = '"+parmas.get("CREATE_NAME")+"',t.SEND_TIME = sysdate,t.SEND_MEMO = '有引用',t.QUOTE_MEMO = '引用实绩' "
  2726. + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'"
  2727. + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' ";
  2728. mapper.updateJudgeStatus(sql.toString());
  2729. //往log表中插入p
  2730. sql = "";
  2731. sql = " INSERT INTO QCM_JUDGE_LOG ( JUDGE_TYPE,MATERIAL_NO,CREATE_TIME,CREATE_NAME,PROD_LINE) "
  2732. +" VALUES ( 'P', '"+resultHJGP.get("SMP_NO")+"', SYSDATE,'system','"+parmas.get("PLINE_CODE")+"')";
  2733. mapper.insert(sql);
  2734. }else if(quotenum==0){
  2735. sql = "";
  2736. sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.ONEMEMO = '未找到一项可以引用的项目,订单标准全部不一样' ,t.ARTIFICIAL_MEMO='0' "
  2737. + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'"
  2738. + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' ";
  2739. mapper.updateJudgeStatus(sql.toString());
  2740. }else{
  2741. //修改D表
  2742. sql = "";
  2743. sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.SEND_MEMO = '有引用',t.QUOTE_MEMO = '引用实绩' , t.ARTIFICIAL_MEMO='0', "
  2744. + " t.ONEMEMO ='需下发委托' "
  2745. + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'"
  2746. + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' ";
  2747. mapper.updateJudgeStatus(sql.toString());
  2748. }
  2749. }else{
  2750. //被引用的项目 全部 已引用
  2751. if(quotenum!=0){
  2752. //修改D表
  2753. sql = "";
  2754. sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.STATUS = '3',t.SEND_ID = '"+parmas.get("SEND_ID")+"',"
  2755. + " t.SEND_NAME = '"+parmas.get("CREATE_NAME")+"',t.SEND_TIME = sysdate,t.SEND_MEMO = '有引用',t.QUOTE_MEMO = '引用实绩' "
  2756. + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'"
  2757. + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' ";
  2758. mapper.updateJudgeStatus(sql.toString());
  2759. //往log表中插入p
  2760. sql = "";
  2761. sql = " INSERT INTO QCM_JUDGE_LOG ( JUDGE_TYPE,MATERIAL_NO,CREATE_TIME,CREATE_NAME,PROD_LINE) "
  2762. +" VALUES ( 'P', '"+parmas.get("SMP_NO")+"', SYSDATE,'system','"+parmas.get("PLINE_CODE")+"')";
  2763. mapper.insert(sql);
  2764. }else if(quotenum==0){
  2765. sql = "";
  2766. sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.ONEMEMO = '未找到一项可以引用的项目,订单标准全部不一样' ,t.ARTIFICIAL_MEMO='0' "
  2767. + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'"
  2768. + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' ";
  2769. mapper.updateJudgeStatus(sql.toString());
  2770. }
  2771. }
  2772. }else{
  2773. sql="";
  2774. sql = "select * from (select * from ("
  2775. + " select (select count(1) from qcm_jhy_sample_consign_d_item i where i.specimen_no = t.specimen_no) nums,t.* "
  2776. + " from QCM_JHY_SAMPLE_CONSIGN_D t,qcm_jhy_sample_r_ord r "
  2777. +" where t.smp_no = r.smp_no and t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"' "
  2778. +" and t.smp_type_code = '0' and t.status in('0','2','7') "
  2779. +" 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') "
  2780. +" and r.DESIGN_KEY not like '19%' "
  2781. +" and substr(t.PROCESS_NOS,0,1)='"+pno1+"' "
  2782. +" and substr(t.PROCESS_NOS,4,1)='"+pno2+"' "
  2783. +" and substr(t.PROCESS_NOS,5,1)='"+pno3+"' "
  2784. + ") t order by t.nums desc) t where rownum=1 ";
  2785. result=null;
  2786. result = mapper.queryOne(sql.toString());
  2787. if(result==null || result.size()<=0){
  2788. sql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D t,qcm_jhy_sample_r_ord r "
  2789. +" where t.smp_no = r.smp_no and t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"' "
  2790. +" and t.smp_type_code = '0' and t.status in('0','2','7') "
  2791. +" and t.freq_code <> 'D' and r.DESIGN_KEY not like '19%' and CHEM_ITEM is null "
  2792. +" and substr(t.PROCESS_NOS,0,1)='"+pno1+"' "
  2793. +" and substr(t.PROCESS_NOS,4,1)='"+pno2+"' "
  2794. +" and substr(t.PROCESS_NOS,5,1)='"+pno3+"' "
  2795. +" and rownum <= 1 order by t.send_time asc ";
  2796. result=null;
  2797. result = mapper.queryOne(sql.toString());
  2798. }
  2799. if (result != null && result.size()>=1) {
  2800. sql = "";
  2801. sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.ONEMEMO = '力学性能实绩未返回或未下发委托,请等实绩返回人工引用' ,t.ARTIFICIAL_MEMO='1' "
  2802. + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'"
  2803. + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' ";
  2804. mapper.updateJudgeStatus(sql.toString());
  2805. }else{
  2806. //修改D表
  2807. sql = "";
  2808. sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.ONEMEMO = '没有找到相应力学性能委托' ,t.ARTIFICIAL_MEMO='0' "
  2809. + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'"
  2810. + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' ";
  2811. mapper.updateJudgeStatus(sql.toString());
  2812. }
  2813. }
  2814. } catch (Exception e) {
  2815. SqlSession.rollback();
  2816. SqlSession.close();
  2817. }
  2818. SqlSession.commit();
  2819. SqlSession.close();
  2820. }
  2821. public String DoQuoteBatchNo191(HashMap parmas) throws Exception {
  2822. SqlSession = QCM.COMMUNAL.SqlSessionBuilder.openSqlSession();
  2823. mapper = SqlSession.getMapper(QCM.COMMUNAL.OrderSqMapper.class);
  2824. String retnum = "0";
  2825. try {
  2826. String process_nos="";
  2827. String pno1="";
  2828. String pno2="";
  2829. String pno3="";
  2830. String chiStr = "";
  2831. //判断是否按子板取样 19订单
  2832. String chi = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D t where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' and rownum <= 1 ";
  2833. List<HashMap> CHILists=mapper.query(chi.toString());
  2834. if(CHILists != null && CHILists.size()>=1 ){
  2835. process_nos=CHILists.get(0).get("PROCESS_NOS").toString();
  2836. 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")){
  2837. chiStr = " and t.MATERIAL_NO = '"+CHILists.get(0).get("MATERIAL_NO")+"' ";
  2838. }
  2839. }
  2840. pno1=process_nos.substring(0, 1);//第一位
  2841. pno2=process_nos.substring(3, 4);//第四位
  2842. pno3=process_nos.substring(4, 5);//第五位
  2843. //and nvl(t.QUOTE_MEMO ,'null') <> '引用实绩'
  2844. String sql ="";
  2845. sql = "select * from (select * from ("
  2846. + " 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.* "
  2847. + " from QCM_JHY_SAMPLE_CONSIGN_D t,qcm_jhy_sample_r_ord r "
  2848. +" where t.smp_no = r.smp_no and t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"' "
  2849. +" and t.smp_type_code = '0' and t.status = '3' and t.freq_code <> 'D' and t.CHEM_ITEM is null "
  2850. + " and to_char(r.thick, 'fm990.099') = to_char('"+parmas.get("THICK")+"', 'fm990.099') and r.DESIGN_KEY not like '19%' "
  2851. + chiStr
  2852. +" and substr(t.PROCESS_NOS,0,1)='"+pno1+"' "
  2853. +" and substr(t.PROCESS_NOS,4,1)='"+pno2+"' "
  2854. +" and substr(t.PROCESS_NOS,5,1)='"+pno3+"' "
  2855. + " ) t where t.nums !=0 order by t.nums desc) t where rownum=1 ";
  2856. HashMap result = mapper.queryOne(sql.toString());
  2857. if(result==null || result.size()<=0){
  2858. 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 "
  2859. +" where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"' "
  2860. +" and t.smp_type_code = '0' and t.status = '3' "
  2861. +" and t.freq_code <> 'D' and CHEM_ITEM is null "
  2862. +" and substr(t.PROCESS_NOS,0,1)='"+pno1+"' "
  2863. +" and substr(t.PROCESS_NOS,4,1)='"+pno2+"' "
  2864. +" and substr(t.PROCESS_NOS,5,1)='"+pno3+"' "
  2865. +" and rownum <= 1 order by t.send_time asc ) t where t.nums != 0";
  2866. result=null;
  2867. result = mapper.queryOne(sql.toString());
  2868. }
  2869. if (result != null && result.size()>=1) {
  2870. //判断厚度是否大于引用的厚度
  2871. sql ="";
  2872. 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 ";
  2873. List<HashMap> OrdLists=mapper.query(sql.toString());
  2874. if(OrdLists!=null && OrdLists.size()>=1 && !StringUtils.isBlank(OrdLists.get(0).get("THICK").toString())){
  2875. String hmap2 = OrdLists.get(0).get("THICK").toString();
  2876. double thick1 = Double.parseDouble(hmap2);
  2877. String thick = parmas.get("THICK").toString();
  2878. double thick2 = Double.parseDouble(thick);
  2879. if(thick2>thick1){
  2880. String str =thick2+">"+thick1;
  2881. //修改D表
  2882. sql = "";
  2883. sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.ONEMEMO = '19订单委托厚度大于引用厚度不可引用:'||'"+str+"' ,t.ARTIFICIAL_MEMO='0' "
  2884. + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'"
  2885. + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' ";
  2886. mapper.updateJudgeStatus(sql.toString());
  2887. SqlSession.commit();
  2888. SqlSession.close();
  2889. return "厚度大于引用厚度不能引用";//被引用不能大于引用
  2890. }
  2891. if((thick1-thick2)>=3){
  2892. String str =thick2+"<"+thick1;
  2893. sql = "";
  2894. sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.ONEMEMO = '19订单委托厚度小于引用厚度不可超过2mm,超过2mm不可引用:'||'"+str+"' ,t.ARTIFICIAL_MEMO='0' "
  2895. + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'"
  2896. + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' ";
  2897. mapper.updateJudgeStatus(sql.toString());
  2898. SqlSession.commit();
  2899. SqlSession.close();
  2900. return "只能引用大2mm厚度";//引用-被引用不能大于等于3 小2mm
  2901. }
  2902. }
  2903. //查询被引用的所有明细
  2904. sql ="";
  2905. sql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' ";
  2906. List<HashMap> qltyLists=mapper.query(sql.toString());
  2907. //查询引用的所有明细
  2908. sql ="";
  2909. sql = "select t.* from QCM_JHY_INSP_PHYSICS t where t.specimen_no = '"+result.get("SPECIMEN_NO")+"' "
  2910. + " and t.quote_specimen_no is null and t.val1 is not null and t.create_name <>'现场默认' ";
  2911. List<HashMap> qltyLists2=mapper.query(sql.toString());
  2912. Integer bQuote = qltyLists.size();//被引用
  2913. Integer yQuote = qltyLists2.size();//引用
  2914. int quotenum = 0;//已引用数据
  2915. String hbB01 ="";//弯曲
  2916. //被引用
  2917. for (int i = 0; i < qltyLists.size(); i++) {//被引用在外层循环 对比 引用中有没有相应的项目有 插入
  2918. //System.out.println("======="+qltyLists.get(i).get("PHY_CODE_S"));
  2919. if("B01".equals((String) qltyLists.get(i).get("PHY_CODE_S"))){
  2920. hbB01 ="0";
  2921. }else{
  2922. hbB01 ="";
  2923. }
  2924. //代码
  2925. String phyCodeL = (String) qltyLists.get(i).get("PHY_CODE_L");//材质检验大项代码
  2926. String phyCodeM = (String) qltyLists.get(i).get("PHY_CODE_M");//试样组代码
  2927. String phyCodeS = (String) qltyLists.get(i).get("PHY_CODE_S");//材质检验项目代码
  2928. String itemCodeD = (String) qltyLists.get(i).get("ITEM_CODE_D");//试验方向代码
  2929. String itemCodeT = (String) qltyLists.get(i).get("ITEM_CODE_T");//试验温度代码 试验温度代码 冲击 被引用
  2930. String itemCodeS = (String) qltyLists.get(i).get("ITEM_CODE_S");//试样尺寸代码
  2931. //名称
  2932. String phyNameL = (String) qltyLists.get(i).get("PHY_NAME_L");//材质检验大项代码
  2933. String phyNameM = (String) qltyLists.get(i).get("PHY_NAME_M");//试样组代码
  2934. String phyNameS = (String) qltyLists.get(i).get("PHY_NAME_S");//材质检验项目代码
  2935. String itemNameD = (String) qltyLists.get(i).get("ITEM_NAME_D");//试验方向代码
  2936. String itemNameT = (String) qltyLists.get(i).get("ITEM_NAME_T");//试验温度代码 试验温度代码 冲击 被引用
  2937. String itemNameS = (String) qltyLists.get(i).get("ITEM_NAME_S");//试样尺寸代码
  2938. String itemCodeL = (String) qltyLists.get(i).get("ITEM_CODE_L");//试验位置代码
  2939. String itemDescL = (String) qltyLists.get(i).get("ITEM_DESC_L");
  2940. BigDecimal seq = (BigDecimal) qltyLists.get(i).get("SEQ");
  2941. String bigdjs = seq.toString();
  2942. Integer bigd4 = Integer.parseInt(bigdjs);
  2943. String newItem=phyCodeL+"-"+phyCodeM+"-"+phyCodeS;
  2944. newItem=newItem+"-"+(itemCodeD!=null?itemCodeD:"null");
  2945. newItem=newItem+"-"+(itemCodeT!=null?itemCodeT:"null");
  2946. newItem=newItem+"-"+(itemCodeS!=null?itemCodeS:"null");
  2947. //引用
  2948. for (HashMap hashMap : qltyLists2) {
  2949. //代码
  2950. String phyCodeL2 = (String) hashMap.get("PHY_CODE_L");//材质检验大项代码
  2951. String phyCodeM2 = (String) hashMap.get("PHY_CODE_M");//试样组代码
  2952. String phyCodeS2 = (String) hashMap.get("PHY_CODE_S");//材质检验项目代码
  2953. String itemCodeD2 = (String) hashMap.get("ITEM_CODE_D");//试验方向代码
  2954. String itemCodeT2 = (String) hashMap.get("ITEM_CODE_T");//试验温度代码 试验温度代码 冲击 被引用
  2955. String itemCodeS2 = (String) hashMap.get("ITEM_CODE_S");//试样尺寸代码
  2956. String newItem2=phyCodeL2+"-"+phyCodeM2+"-"+phyCodeS2;
  2957. newItem2=newItem2+"-"+(itemCodeD2!=null?itemCodeD2:"null");
  2958. newItem2=newItem2+"-"+(itemCodeT2!=null?itemCodeT2:"null");
  2959. newItem2=newItem2+"-"+(itemCodeS2!=null?itemCodeS2:"null");
  2960. //判断是否是冲击试验
  2961. if(phyCodeS.equals("C01") || phyCodeS.equals("C02")){
  2962. if(phyCodeS.equals(phyCodeS2)){
  2963. double co1t = Double.valueOf(itemCodeT);
  2964. double co2t = Double.valueOf(itemCodeT2);
  2965. //Integer co1t= Integer.parseInt(itemCodeT);//被引用
  2966. //Integer co2t= Integer.parseInt(itemCodeT2);//引用
  2967. if(co1t >= co2t){
  2968. sql = "";
  2969. sql = " insert into QCM_JHY_INSP_PHYSICS "
  2970. +" (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, "
  2971. +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
  2972. +" VAL13,VAL14,VAL15,AVG_VAL,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, "
  2973. +" PHY_UNIT,MEMO) "
  2974. +" select '"+parmas.get("SPECIMEN_NO")+"','"+bigd4+"',TEST_QTY,'"+phyCodeL+"','"+phyNameL+"','"+phyCodeM+"','"+phyNameM+"','"+phyCodeS+"','"+phyNameS+"','"+itemCodeD+"','"+itemNameD+"', "
  2975. +" '"+itemCodeT+"','"+itemNameT+"','"+itemCodeS+"','"+itemNameS+"',VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
  2976. +" VAL13,VAL14,VAL15,AVG_VAL,'"+parmas.get("CREATE_NAME")+"',sysdate,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,'"+itemCodeL+"','"+itemDescL+"', "
  2977. +" PHY_UNIT,MEMO from QCM_JHY_INSP_PHYSICS t "
  2978. + " where t.specimen_no = '"+(String)hashMap.get("SPECIMEN_NO")+"' "
  2979. + "and t.seq = '"+hashMap.get("SEQ")+"' ";
  2980. mapper.insert(sql);
  2981. //修改ITEM表
  2982. sql = "";
  2983. sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t set t.QUOTE_MEMO = '已引用"+result.get("SPECIMEN_NO")+"' "
  2984. + " where t.SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' and t.seq = '"+seq+"' ";
  2985. mapper.updateJudgeStatus(sql.toString());
  2986. quotenum++;
  2987. break;
  2988. }
  2989. }
  2990. }else{//其它试验
  2991. //标准一样的引用
  2992. if(newItem.equals(newItem2)){
  2993. sql = "";
  2994. sql = " insert into QCM_JHY_INSP_PHYSICS "
  2995. +" (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, "
  2996. +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
  2997. +" VAL13,VAL14,VAL15,AVG_VAL,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, "
  2998. +" PHY_UNIT,MEMO) "
  2999. +" select '"+parmas.get("SPECIMEN_NO")+"','"+bigd4+"',TEST_QTY,'"+phyCodeL+"','"+phyNameL+"','"+phyCodeM+"','"+phyNameM+"','"+phyCodeS+"','"+phyNameS+"','"+itemCodeD+"','"+itemNameD+"', "
  3000. +" '"+itemCodeT+"','"+itemNameT+"','"+itemCodeS+"','"+itemNameS+"',VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
  3001. +" VAL13,VAL14,VAL15,AVG_VAL,'"+parmas.get("CREATE_NAME")+"',sysdate,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,'"+itemCodeL+"','"+itemDescL+"', "
  3002. +" PHY_UNIT,MEMO from QCM_JHY_INSP_PHYSICS t "
  3003. + " where t.specimen_no = '"+(String)hashMap.get("SPECIMEN_NO")+"' "
  3004. + "and t.seq = '"+hashMap.get("SEQ")+"' ";
  3005. mapper.insert(sql);
  3006. //修改ITEM表
  3007. sql = "";
  3008. sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t set t.QUOTE_MEMO = '已引用"+result.get("SPECIMEN_NO")+"' "
  3009. + " where t.SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' and t.seq = '"+seq+"' ";
  3010. mapper.updateJudgeStatus(sql.toString());
  3011. quotenum++;
  3012. if("B01".equals(phyCodeS2) && "B01".equals((String) qltyLists.get(i).get("PHY_CODE_S"))){
  3013. hbB01="1";
  3014. }
  3015. break;
  3016. }
  3017. }
  3018. }
  3019. if("B01".equals((String) qltyLists.get(i).get("PHY_CODE_S"))&& !"".equals(hbB01) && hbB01.equals("0")){
  3020. sql="";
  3021. sql="insert into QCM_JHY_INSP_PHYSICS "
  3022. +" (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, "
  3023. +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,AVG_VAL,CREATE_NAME,CREATE_TIME,DEFECT_FLAG,MAX_VAL, "
  3024. +" MIN_VAL,ITEM_CODE_L,ITEM_DESC_L,PHY_UNIT,MEMO) "
  3025. +" 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, "
  3026. +" 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, "
  3027. +" t.phy_unit,'默认合格' "
  3028. +" from qcm_jhy_sample_consign_d_item t "
  3029. +" where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' "
  3030. +" and t.phy_code_s = 'B01' ";
  3031. mapper.insert(sql);
  3032. //修改ITEM表
  3033. sql = "";
  3034. sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t set t.QUOTE_MEMO = '默认合格' "
  3035. + " where t.SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' and t.phy_code_s = 'B01' ";
  3036. mapper.updateJudgeStatus(sql.toString());
  3037. quotenum++;
  3038. }
  3039. //申报:郭明清 主题:非计划船板改普板,冷弯需要系统默认合格 申报时间:2023-04-27 16:49:59
  3040. //原牌号为船板 BV/IC003法国船级社,KR/IC004韩国船级社,DNV/IC001挪威船级社,CCS/IC010中国船级社 、ABS/IC005美国船级社、LR/IC009 英国船级社、NK/KA36/IC006 日本船级社、RINA/IC007 意大利船级社 、RS/IC002 俄罗斯 IC012 客户认证
  3041. //改成普锰板(Q235A/B、Q345A/B、Q355B)
  3042. //被引用是原牌号船板 引用是改判 普锰板
  3043. //弯曲 默认合格
  3044. /* if("B01".equals((String) qltyLists.get(i).get("PHY_CODE_S"))&& !"".equals(hbB01) && hbB01.equals("0")){
  3045. sql="";
  3046. sql="select d.* from qcm_jhy_sample_consign_d d,qcm_jhy_sample_r_ord r "
  3047. +" where d.smp_no = r.smp_no and r.steel_code in ('Q235A','Q235B','Q345A','Q345B','Q355B') "
  3048. +" and d.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' ";
  3049. List<HashMap> hashMap=mapper.query(sql.toString());
  3050. if(hashMap!=null && hashMap.size()>=1){
  3051. sql="";
  3052. sql="select r.* from qcm_jhy_sample_consign_d d,qcm_jhy_sample_r_ord r "
  3053. +" where d.smp_no = r.smp_no and r.cert_inst_code in ('IC005','IC009','IC006','IC007','IC002','IC003','IC004','IC001','IC010') "
  3054. +" and d.specimen_no = '"+result.get("SPECIMEN_NO")+"' ";
  3055. List<HashMap> hashMap2=mapper.query(sql.toString());
  3056. //船板没有弯曲
  3057. sql="";
  3058. sql="select * from qcm_jhy_sample_consign_d_item where specimen_no = '"+result.get("SPECIMEN_NO")+"' and phy_code_s='B01' ";
  3059. List<HashMap> hashMap3=mapper.query(sql.toString());
  3060. if(hashMap2!=null && hashMap2.size()>=1 && hashMap3.size()<=0 ){
  3061. sql="";
  3062. sql="insert into QCM_JHY_INSP_PHYSICS "
  3063. +" (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, "
  3064. +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,AVG_VAL,CREATE_NAME,CREATE_TIME,DEFECT_FLAG,MAX_VAL, "
  3065. +" MIN_VAL,ITEM_CODE_L,ITEM_DESC_L,PHY_UNIT,MEMO) "
  3066. +" 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, "
  3067. +" 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, "
  3068. +" t.phy_unit,'默认合格' "
  3069. +" from qcm_jhy_sample_consign_d_item t "
  3070. +" where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' "
  3071. +" and t.phy_code_s = 'B01' ";
  3072. mapper.insert(sql);
  3073. //修改ITEM表
  3074. sql = "";
  3075. sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t set t.QUOTE_MEMO = '默认合格' "
  3076. + " where t.SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' and t.phy_code_s = 'B01' ";
  3077. mapper.updateJudgeStatus(sql.toString());
  3078. quotenum++;
  3079. }
  3080. }
  3081. }*/
  3082. }
  3083. //19HJGP 不自动下发
  3084. sql="";
  3085. sql="select r.* from qcm_jhy_sample_consign_d t,qcm_jhy_sample_r_ord r "
  3086. + " where t.smp_no = r.smp_no and t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' and r.design_key like '19HJGP%' and rownum=1 ";
  3087. HashMap resultHJGP = mapper.queryOne(sql.toString());
  3088. if(resultHJGP!=null && resultHJGP.size()>=1){
  3089. if(quotenum == qltyLists.size()){
  3090. //修改D表
  3091. sql = "";
  3092. sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.STATUS = '3',t.SEND_ID = '"+parmas.get("SEND_ID")+"',"
  3093. + " t.SEND_NAME = '"+parmas.get("CREATE_NAME")+"',t.SEND_TIME = sysdate,t.SEND_MEMO = '有引用',t.QUOTE_MEMO = '引用实绩' "
  3094. + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'"
  3095. + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' ";
  3096. mapper.updateJudgeStatus(sql.toString());
  3097. //往log表中插入p
  3098. sql = "";
  3099. sql = " INSERT INTO QCM_JUDGE_LOG ( JUDGE_TYPE,MATERIAL_NO,CREATE_TIME,CREATE_NAME,PROD_LINE) "
  3100. +" VALUES ( 'P', '"+parmas.get("SMP_NO")+"', SYSDATE,'system','"+parmas.get("PLINE_CODE")+"')";
  3101. mapper.insert(sql);
  3102. retnum = "1";
  3103. }else if(quotenum==0){
  3104. sql = "";
  3105. sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.ONEMEMO = '未找到一项可以引用的项目,订单标准全部不一样' ,t.ARTIFICIAL_MEMO='0' "
  3106. + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'"
  3107. + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' ";
  3108. mapper.updateJudgeStatus(sql.toString());
  3109. }else{
  3110. //修改D表
  3111. sql = "";
  3112. sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.SEND_MEMO = '有引用',t.QUOTE_MEMO = '引用实绩', t.ARTIFICIAL_MEMO='0', "
  3113. + " t.ONEMEMO ='需下发委托' "
  3114. + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'"
  3115. + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' ";
  3116. mapper.updateJudgeStatus(sql.toString());
  3117. }
  3118. }else{
  3119. //被引用的项目 全部 已引用
  3120. if(quotenum!=0){
  3121. //修改D表
  3122. sql = "";
  3123. sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.STATUS = '3',t.SEND_ID = '"+parmas.get("SEND_ID")+"',"
  3124. + " t.SEND_NAME = '"+parmas.get("CREATE_NAME")+"',t.SEND_TIME = sysdate,t.SEND_MEMO = '有引用',t.QUOTE_MEMO = '引用实绩' "
  3125. + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'"
  3126. + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' ";
  3127. mapper.updateJudgeStatus(sql.toString());
  3128. //往log表中插入p
  3129. sql = "";
  3130. sql = " INSERT INTO QCM_JUDGE_LOG ( JUDGE_TYPE,MATERIAL_NO,CREATE_TIME,CREATE_NAME,PROD_LINE) "
  3131. +" VALUES ( 'P', '"+parmas.get("SMP_NO")+"', SYSDATE,'system','"+parmas.get("PLINE_CODE")+"')";
  3132. mapper.insert(sql);
  3133. retnum = "1";
  3134. }else if(quotenum==0){
  3135. sql = "";
  3136. sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.ONEMEMO = '未找到一项可以引用的项目,订单标准全部不一样' ,t.ARTIFICIAL_MEMO='0' "
  3137. + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'"
  3138. + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' ";
  3139. mapper.updateJudgeStatus(sql.toString());
  3140. }
  3141. }
  3142. }else{
  3143. sql="";
  3144. sql = "select * from (select * from ("
  3145. + " select (select count(1) from qcm_jhy_sample_consign_d_item i where i.specimen_no = t.specimen_no) nums,t.* "
  3146. + " from QCM_JHY_SAMPLE_CONSIGN_D t,qcm_jhy_sample_r_ord r "
  3147. +" where t.smp_no = r.smp_no and t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"' "
  3148. +" and t.smp_type_code = '0' and t.status in('0','2','7') "
  3149. +" 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') "
  3150. +" and r.DESIGN_KEY not like '19%' "
  3151. +" and substr(t.PROCESS_NOS,0,1)='"+pno1+"' "
  3152. +" and substr(t.PROCESS_NOS,4,1)='"+pno2+"' "
  3153. +" and substr(t.PROCESS_NOS,5,1)='"+pno3+"' "
  3154. +") t order by t.nums desc) t where rownum=1 ";
  3155. result=null;
  3156. result = mapper.queryOne(sql.toString());
  3157. if(result==null || result.size()<=0){
  3158. sql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D t,qcm_jhy_sample_r_ord r "
  3159. +" where t.smp_no = r.smp_no and t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"' "
  3160. +" and t.smp_type_code = '0' and t.status in('0','2','7') "
  3161. +" and t.freq_code <> 'D' and r.DESIGN_KEY not like '19%' and CHEM_ITEM is null "
  3162. +" and substr(t.PROCESS_NOS,0,1)='"+pno1+"' "
  3163. +" and substr(t.PROCESS_NOS,4,1)='"+pno2+"' "
  3164. +" and substr(t.PROCESS_NOS,5,1)='"+pno3+"' "
  3165. +" and rownum <= 1 order by t.send_time asc ";
  3166. result=null;
  3167. result = mapper.queryOne(sql.toString());
  3168. }
  3169. if (result != null && result.size()>=1) {
  3170. sql = "";
  3171. sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.ONEMEMO = '力学性能实绩未返回或未下发委托,请等实绩返回人工引用' ,t.ARTIFICIAL_MEMO='1' "
  3172. + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'"
  3173. + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' ";
  3174. mapper.updateJudgeStatus(sql.toString());
  3175. }else{
  3176. //修改D表
  3177. sql = "";
  3178. sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.ONEMEMO = '没有找到相应力学性能委托' ,t.ARTIFICIAL_MEMO='0' "
  3179. + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'"
  3180. + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' ";
  3181. mapper.updateJudgeStatus(sql.toString());
  3182. }
  3183. }
  3184. } catch (Exception e) {
  3185. SqlSession.rollback();
  3186. SqlSession.close();
  3187. }
  3188. SqlSession.commit();
  3189. SqlSession.close();
  3190. return retnum;
  3191. }
  3192. /**
  3193. * 复样引用
  3194. * @param materialInfo
  3195. * @return
  3196. * @throws Exception
  3197. */
  3198. public String DoQuoteBatchNoFy(HashMap parmas) throws Exception {
  3199. String retnum = "0";
  3200. try {
  3201. String StrSpecimenNO="";
  3202. TreeSet<String> treeSet = new TreeSet<String>();//取样编号
  3203. 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")+"' "
  3204. + " 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 ";
  3205. List<HashMap> hmfy=mapper.query(fysql.toString());
  3206. if(hmfy!=null && hmfy.size()>=1){
  3207. for (HashMap hashMap : hmfy) {
  3208. fysql="";
  3209. fysql="select * from qcm_jhy_sample_consign_d_item t where t.quote_memo like '%"+hashMap.get("SPECIMEN_NO")+"'";
  3210. List<HashMap> hmfy2=mapper.query(fysql.toString());
  3211. if(hmfy2==null || hmfy2.size()<=0){
  3212. treeSet.add((String)hashMap.get("SPECIMEN_NO"));
  3213. }
  3214. }
  3215. }
  3216. String sql="";
  3217. if(treeSet.size()>=1){
  3218. sql="select * from qcm_jhy_sample_consign_d t where t.specimen_no = '"+treeSet.first()+"' and rownum=1";
  3219. }else{
  3220. 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.* "
  3221. + " from QCM_JHY_SAMPLE_CONSIGN_D t "
  3222. +" where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"' "
  3223. +" and t.smp_type_code = '1' and t.status = '3' and nvl(t.QUOTE_MEMO ,'null') <> '引用实绩' "
  3224. + " and t.freq_code <> 'D' and t.CHEM_ITEM is null ) t order by t.nums desc) t where rownum=1 ";
  3225. }
  3226. HashMap result = mapper.queryOne(sql.toString());
  3227. if (result != null && result.size()>=1) {
  3228. //查询引用的所有明细
  3229. sql ="";
  3230. sql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' and seq<=49 ";
  3231. List<HashMap> qltyLists=mapper.query(sql.toString());
  3232. //查询被引用的所有明细
  3233. sql ="";
  3234. 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 ";
  3235. List<HashMap> qltyLists2=mapper.query(sql.toString());
  3236. Integer bQuote = qltyLists.size();//引用
  3237. Integer yQuote = qltyLists2.size();//被引用
  3238. int quotenum = 0;//已引用数据
  3239. //被引用
  3240. for (int i = 0; i < qltyLists.size(); i++) {//被引用在外层循环 对比 引用中有没有相应的项目有 插入
  3241. //代码
  3242. String phyCodeL = (String) qltyLists.get(i).get("PHY_CODE_L");//材质检验大项代码
  3243. String phyCodeM = (String) qltyLists.get(i).get("PHY_CODE_M");//试样组代码
  3244. String phyCodeS = (String) qltyLists.get(i).get("PHY_CODE_S");//材质检验项目代码
  3245. String itemCodeD = (String) qltyLists.get(i).get("ITEM_CODE_D");//试验方向代码
  3246. String itemCodeT = (String) qltyLists.get(i).get("ITEM_CODE_T");//试验温度代码 试验温度代码 冲击 被引用
  3247. String itemCodeS = (String) qltyLists.get(i).get("ITEM_CODE_S");//试样尺寸代码
  3248. //名称
  3249. String phyNameL = (String) qltyLists.get(i).get("PHY_NAME_L");//材质检验大项代码
  3250. String phyNameM = (String) qltyLists.get(i).get("PHY_NAME_M");//试样组代码
  3251. String phyNameS = (String) qltyLists.get(i).get("PHY_NAME_S");//材质检验项目代码
  3252. String itemNameD = (String) qltyLists.get(i).get("ITEM_NAME_D");//试验方向代码
  3253. String itemNameT = (String) qltyLists.get(i).get("ITEM_NAME_T");//试验温度代码 试验温度代码 冲击 被引用
  3254. String itemNameS = (String) qltyLists.get(i).get("ITEM_NAME_S");//试样尺寸代码
  3255. String itemCodeL = (String) qltyLists.get(i).get("ITEM_CODE_L");//试验位置代码
  3256. String itemDescL = (String) qltyLists.get(i).get("ITEM_DESC_L");
  3257. BigDecimal seq = (BigDecimal) qltyLists.get(i).get("SEQ");
  3258. String bigdjs = seq.toString();
  3259. Integer bigd4 = Integer.parseInt(bigdjs);
  3260. String newItem=phyCodeL+"-"+phyCodeM+"-"+phyCodeS;
  3261. newItem=newItem+"-"+(itemCodeD!=null?itemCodeD:"null");
  3262. newItem=newItem+"-"+(itemCodeT!=null?itemCodeT:"null");
  3263. newItem=newItem+"-"+(itemCodeS!=null?itemCodeS:"null");
  3264. //newItem=newItem+"-"+(itemCodeL!=null?itemCodeL:"null");
  3265. //引用
  3266. for (HashMap hashMap : qltyLists2) {
  3267. //代码
  3268. String phyCodeL2 = (String) hashMap.get("PHY_CODE_L");//材质检验大项代码
  3269. String phyCodeM2 = (String) hashMap.get("PHY_CODE_M");//试样组代码
  3270. String phyCodeS2 = (String) hashMap.get("PHY_CODE_S");//材质检验项目代码
  3271. String itemCodeD2 = (String) hashMap.get("ITEM_CODE_D");//试验方向代码
  3272. String itemCodeT2 = (String) hashMap.get("ITEM_CODE_T");//试验温度代码 试验温度代码 冲击 被引用
  3273. String itemCodeS2 = (String) hashMap.get("ITEM_CODE_S");//试样尺寸代码
  3274. String itemCodeL2 = (String) hashMap.get("ITEM_CODE_L");//试验位置代码
  3275. String newItem2=phyCodeL2+"-"+phyCodeM2+"-"+phyCodeS2;
  3276. newItem2=newItem2+"-"+(itemCodeD2!=null?itemCodeD2:"null");
  3277. newItem2=newItem2+"-"+(itemCodeT2!=null?itemCodeT2:"null");
  3278. newItem2=newItem2+"-"+(itemCodeS2!=null?itemCodeS2:"null");
  3279. //newItem2=newItem2+"-"+(itemCodeL2!=null?itemCodeL2:"null");
  3280. //判断是否是冲击试验
  3281. if(phyCodeS.equals("C01") || phyCodeS.equals("C02")){
  3282. if(phyCodeS.equals(phyCodeS2)){
  3283. Integer co1t= Integer.parseInt(itemCodeT);//被引用
  3284. Integer co2t= Integer.parseInt(itemCodeT2);//引用
  3285. if(co1t >= co2t){
  3286. sql = "";
  3287. sql = " insert into QCM_JHY_INSP_PHYSICS "
  3288. +" (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, "
  3289. +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
  3290. +" VAL13,VAL14,VAL15,AVG_VAL,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, "
  3291. +" PHY_UNIT,MEMO) "
  3292. +" select '"+parmas.get("SPECIMEN_NO")+"','"+bigd4+"',TEST_QTY,'"+phyCodeL+"','"+phyNameL+"','"+phyCodeM+"','"+phyNameM+"','"+phyCodeS+"','"+phyNameS+"','"+itemCodeD+"','"+itemNameD+"', "
  3293. +" '"+itemCodeT+"','"+itemNameT+"','"+itemCodeS+"','"+itemNameS+"',VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
  3294. +" VAL13,VAL14,VAL15,AVG_VAL,'"+parmas.get("CREATE_NAME")+"',sysdate,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,'"+itemCodeL+"','"+itemDescL+"', "
  3295. +" PHY_UNIT,MEMO from QCM_JHY_INSP_PHYSICS t "
  3296. + " where t.specimen_no = '"+(String)hashMap.get("SPECIMEN_NO")+"' "
  3297. + "and t.seq = '"+hashMap.get("SEQ")+"' ";
  3298. mapper.insert(sql);
  3299. //修改ITEM表
  3300. sql = "";
  3301. sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t set t.QUOTE_MEMO = '已引用"+result.get("SPECIMEN_NO")+"' "
  3302. + " where t.SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' and t.seq = '"+seq+"' ";
  3303. mapper.updateJudgeStatus(sql.toString());
  3304. quotenum++;
  3305. break;
  3306. }
  3307. }
  3308. }else{//其它试验
  3309. //标准一样的引用
  3310. if(newItem.equals(newItem2)){
  3311. sql = "";
  3312. sql = " insert into QCM_JHY_INSP_PHYSICS "
  3313. +" (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, "
  3314. +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
  3315. +" VAL13,VAL14,VAL15,AVG_VAL,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, "
  3316. +" PHY_UNIT,MEMO) "
  3317. +" select '"+parmas.get("SPECIMEN_NO")+"','"+bigd4+"',TEST_QTY,'"+phyCodeL+"','"+phyNameL+"','"+phyCodeM+"','"+phyNameM+"','"+phyCodeS+"','"+phyNameS+"','"+itemCodeD+"','"+itemNameD+"', "
  3318. +" '"+itemCodeT+"','"+itemNameT+"','"+itemCodeS+"','"+itemNameS+"',VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
  3319. +" VAL13,VAL14,VAL15,AVG_VAL,'"+parmas.get("CREATE_NAME")+"',sysdate,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,'"+itemCodeL+"','"+itemDescL+"', "
  3320. +" PHY_UNIT,MEMO from QCM_JHY_INSP_PHYSICS t "
  3321. + " where t.specimen_no = '"+(String)hashMap.get("SPECIMEN_NO")+"' "
  3322. + "and t.seq = '"+hashMap.get("SEQ")+"' ";
  3323. mapper.insert(sql);
  3324. //修改ITEM表
  3325. sql = "";
  3326. sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t set t.QUOTE_MEMO = '已引用"+result.get("SPECIMEN_NO")+"' "
  3327. + " where t.SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' and t.seq = '"+seq+"' ";
  3328. mapper.updateJudgeStatus(sql.toString());
  3329. quotenum++;
  3330. break;
  3331. }
  3332. }
  3333. }
  3334. }
  3335. //被引用的项目 全部 已引用
  3336. if(quotenum == qltyLists.size()){
  3337. //修改D表
  3338. sql = "";
  3339. sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.STATUS = '3',t.SEND_ID = '"+parmas.get("SEND_ID")+"',"
  3340. + " t.SEND_NAME = '"+parmas.get("CREATE_NAME")+"',t.SEND_TIME = sysdate,t.SEND_MEMO = '有引用',t.QUOTE_MEMO = '引用实绩' "
  3341. + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'"
  3342. + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' ";
  3343. mapper.updateJudgeStatus(sql.toString());
  3344. //往log表中插入p
  3345. sql = "";
  3346. sql = " INSERT INTO QCM_JUDGE_LOG ( JUDGE_TYPE,MATERIAL_NO,CREATE_TIME,CREATE_NAME,PROD_LINE) "
  3347. +" VALUES ( 'Q', '"+parmas.get("SMP_NO")+"', SYSDATE,'system','"+parmas.get("PLINE_CODE")+"')";
  3348. mapper.insert(sql);
  3349. retnum="1";
  3350. }else{
  3351. //修改D表
  3352. sql = "";
  3353. sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.SEND_MEMO = '有引用',t.QUOTE_MEMO = '引用实绩' "
  3354. + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'"
  3355. + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' ";
  3356. mapper.updateJudgeStatus(sql.toString());
  3357. }
  3358. }else{
  3359. SqlSession.close();
  3360. return "该轧批未返回实绩或没有引用的对象!请在委托记录中核实相应委托数据";
  3361. }
  3362. } catch (Exception e) {
  3363. SqlSession.rollback();
  3364. SqlSession.close();
  3365. return "引用失败!";
  3366. }
  3367. SqlSession.commit();
  3368. doPhyItem(parmas.get("SPECIMEN_NO").toString());
  3369. SqlSession.close();
  3370. return retnum;
  3371. }
  3372. /**
  3373. * 39 49 59订单自动引用 不同订单 同轧批号 项目一样引用
  3374. * @param materialInfo
  3375. * @return
  3376. * @throws Exception
  3377. */
  3378. public void DoQuoteRZLT(HashMap parmas) throws Exception {
  3379. SqlSession = QCM.COMMUNAL.SqlSessionBuilder.openSqlSession();
  3380. mapper = SqlSession.getMapper(QCM.COMMUNAL.OrderSqMapper.class);
  3381. try {
  3382. if(parmas.get("CREATE_NAME").equals("调试人员")){
  3383. parmas.put("SEND_ID", "系统自动");
  3384. parmas.put("CREATE_NAME", "系统自动");
  3385. }
  3386. //and t.freq_code <> 'D'
  3387. String sql ="";
  3388. sql = "select * from (select * from ("
  3389. + " select (select count(1) from qcm_jhy_sample_consign_d_item i where i.specimen_no = t.specimen_no) nums,t.* "
  3390. + " from QCM_JHY_SAMPLE_CONSIGN_D t,qcm_jhy_sample_r_ord r "
  3391. +" where t.smp_no = r.smp_no and t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"' "
  3392. +" and t.smp_type_code = '0' and t.status = '3' and nvl(t.QUOTE_MEMO ,'null') <> '引用实绩' "
  3393. + " and t.CHEM_ITEM is null and to_char(r.thick, 'fm990.099') = to_char('"+parmas.get("THICK")+"', 'fm990.099') "
  3394. + " and r.DESIGN_KEY not like '39%' and r.DESIGN_KEY not like '49%' and r.DESIGN_KEY not like '59%' "
  3395. + " ) t order by t.nums desc) t where rownum=1 ";
  3396. HashMap result = mapper.queryOne(sql.toString());
  3397. //and t.freq_code <> 'D'
  3398. if(result==null || result.size()<=0){
  3399. sql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D t "
  3400. +" where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"' "
  3401. +" and t.smp_type_code = '0' and t.status = '3' and nvl(t.QUOTE_MEMO ,'null') <> '引用实绩' "
  3402. + " and CHEM_ITEM is null and rownum <= 1 order by t.send_time asc ";
  3403. result=null;
  3404. result = mapper.queryOne(sql.toString());
  3405. }
  3406. if (result != null && result.size()>=1) {
  3407. //查询引用的所有明细是不是只有拉伸 横向可以替代纵向
  3408. //当卷板存在横向试验时,且只有一组拉伸试样时,改判后需要纵向实验数据,可以直接用横向替代纵向。
  3409. //热轧:改判,只有一组拉伸试样时并且方向是(纵向)时,横向可以替代纵向,直接把横向的值引用到纵向上
  3410. //连退:改判,只有一组拉伸试样时并且方向是(纵向)时,横向可以替代纵向,直接把横向的值引用到纵向上,但是断后伸长率(横向A50 套纵向A50 )、(横向A80 套纵向A80 )
  3411. //连退改判:断后伸长率:A50转成A80需要将A50的值乘以0.829; A80转成A50需要乘以1.207
  3412. //主题:卷板改判规则维护01 申报人员:夏鹏 申报时间:2023-05-04 15:19:01
  3413. String HAStr="";
  3414. sql ="";
  3415. 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' ";
  3416. List<HashMap> qltyListsHA=mapper.query(sql.toString());
  3417. if(qltyListsHA==null || qltyListsHA.size()<=0){
  3418. HAStr="HA";//只有拉伸
  3419. }
  3420. //查询引用的所有明细
  3421. sql ="";
  3422. sql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' ";
  3423. List<HashMap> qltyLists=mapper.query(sql.toString());
  3424. //查询被引用的所有明细
  3425. sql ="";
  3426. 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 ";
  3427. List<HashMap> qltyLists2=mapper.query(sql.toString());
  3428. Integer bQuote = qltyLists.size();//引用
  3429. Integer yQuote = qltyLists2.size();//被引用
  3430. int quotenum = 0;//已引用数据
  3431. //引用
  3432. for (int i = 0; i < qltyLists.size(); i++) {//被引用在外层循环 对比 引用中有没有相应的项目有 插入
  3433. //代码
  3434. String phyCodeL = (String) qltyLists.get(i).get("PHY_CODE_L");//材质检验大项代码
  3435. String phyCodeM = (String) qltyLists.get(i).get("PHY_CODE_M");//试样组代码
  3436. String phyCodeS = (String) qltyLists.get(i).get("PHY_CODE_S");//材质检验项目代码
  3437. String itemCodeD = (String) qltyLists.get(i).get("ITEM_CODE_D");//试验方向代码
  3438. String itemCodeT = (String) qltyLists.get(i).get("ITEM_CODE_T");//试验温度代码 试验温度代码 冲击 被引用
  3439. String itemCodeS = (String) qltyLists.get(i).get("ITEM_CODE_S");//试样尺寸代码
  3440. //名称
  3441. String phyNameL = (String) qltyLists.get(i).get("PHY_NAME_L");//材质检验大项代码
  3442. String phyNameM = (String) qltyLists.get(i).get("PHY_NAME_M");//试样组代码
  3443. String phyNameS = (String) qltyLists.get(i).get("PHY_NAME_S");//材质检验项目代码
  3444. String itemNameD = (String) qltyLists.get(i).get("ITEM_NAME_D");//试验方向代码
  3445. String itemNameT = (String) qltyLists.get(i).get("ITEM_NAME_T");//试验温度代码 试验温度代码 冲击 被引用
  3446. String itemNameS = (String) qltyLists.get(i).get("ITEM_NAME_S");//试样尺寸代码
  3447. String itemCodeL = (String) qltyLists.get(i).get("ITEM_CODE_L");//试验位置代码
  3448. String itemDescL = (String) qltyLists.get(i).get("ITEM_DESC_L");
  3449. BigDecimal seq = (BigDecimal) qltyLists.get(i).get("SEQ");
  3450. String bigdjs = seq.toString();
  3451. Integer bigd4 = Integer.parseInt(bigdjs);
  3452. //横向替代纵向 只有拉伸并且引用是纵向B 横向A 被引用不管是横向还是纵向都能把值给到引用上面
  3453. //连退改判:(断后伸长率)A50转成A80需要将A50的值乘以0.829; A80转成A50需要乘以1.207
  3454. String EAFStr="";
  3455. String PhyUnit="";//值单位
  3456. if(!"".equals(HAStr) && HAStr.equals("HA") && itemCodeD.equals("B")){
  3457. itemCodeD="B";
  3458. //断后伸长率 && qltyLists.get(i).get("SPECIMEN_NO").toString().contains("LT1")
  3459. if(phyCodeS.equals("A06")){
  3460. PhyUnit=(String) qltyLists.get(i).get("PHY_UNIT");
  3461. }
  3462. }else if(!"".equals(HAStr) && HAStr.equals("HA") && itemCodeD.equals("A") && phyCodeS.equals("A06")){
  3463. PhyUnit=(String) qltyLists.get(i).get("PHY_UNIT");
  3464. }
  3465. String newItem=phyCodeL+"-"+phyCodeM+"-"+phyCodeS;
  3466. if(phyCodeL.equals("HV") && qltyLists.get(i).get("SPECIMEN_NO").toString().contains("LT1")){
  3467. //连退 粗糙度 试验方向 不参于判断
  3468. newItem=newItem+"-"+"null";
  3469. }else{
  3470. newItem=newItem+"-"+(itemCodeD!=null?itemCodeD:"null");
  3471. }
  3472. newItem=newItem+"-"+(itemCodeT!=null?itemCodeT:"null");
  3473. newItem=newItem+"-"+(itemCodeS!=null?itemCodeS:"null");
  3474. if(!"".equals(HAStr) && HAStr.equals("HA") && itemCodeD.equals("B")){
  3475. //断后伸长率 要加上值单位去判 && qltyLists.get(i).get("SPECIMEN_NO").toString().contains("LT1")
  3476. if(phyCodeS.equals("A06")){
  3477. newItem=newItem+"-"+(PhyUnit!=null?PhyUnit:"null");
  3478. }
  3479. }else if(!"".equals(HAStr) && HAStr.equals("HA") && itemCodeD.equals("A") && phyCodeS.equals("A06")){
  3480. newItem=newItem+"-"+(PhyUnit!=null?PhyUnit:"null");
  3481. }
  3482. //被引用
  3483. for (HashMap hashMap : qltyLists2) {
  3484. //代码
  3485. String phyCodeL2 = (String) hashMap.get("PHY_CODE_L");//材质检验大项代码
  3486. String phyCodeM2 = (String) hashMap.get("PHY_CODE_M");//试样组代码
  3487. String phyCodeS2 = (String) hashMap.get("PHY_CODE_S");//材质检验项目代码
  3488. String itemCodeD2 = (String) hashMap.get("ITEM_CODE_D");//试验方向代码
  3489. String itemCodeT2 = (String) hashMap.get("ITEM_CODE_T");//试验温度代码 试验温度代码 冲击 被引用
  3490. String itemCodeS2 = (String) hashMap.get("ITEM_CODE_S");//试样尺寸代码
  3491. String PhyUnit2="";
  3492. //横向替代纵向 只有拉伸并且引用是纵向B 被引用不管是横向还是纵向都能把值给到引用上面
  3493. if(!"".equals(HAStr) && HAStr.equals("HA") && itemCodeD.equals("B")){
  3494. itemCodeD2="B";//被引用 不管是横向还是纵向都能把值给到引用上
  3495. //断后伸长率 && hashMap.get("SPECIMEN_NO").toString().contains("LT1")
  3496. if(phyCodeS2.equals("A06")){
  3497. sql ="";
  3498. sql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D_ITEM t "
  3499. + " where t.specimen_no = '"+hashMap.get("SPECIMEN_NO")+"' and t.PHY_CODE_S='A06' AND t.seq<=49 ";
  3500. List<HashMap> qltyListsA=mapper.query(sql.toString());
  3501. PhyUnit2=(String) qltyListsA.get(0).get("PHY_UNIT");
  3502. }
  3503. }else if(!"".equals(HAStr) && HAStr.equals("HA") && itemCodeD.equals("A") && phyCodeS.equals("A06") && itemCodeD2.equals("A") && phyCodeS2.equals("A06")){
  3504. sql ="";
  3505. sql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D_ITEM t "
  3506. + " where t.specimen_no = '"+hashMap.get("SPECIMEN_NO")+"' and t.PHY_CODE_S='A06' AND t.seq<=49 ";
  3507. List<HashMap> qltyListsA=mapper.query(sql.toString());
  3508. PhyUnit2=(String) qltyListsA.get(0).get("PHY_UNIT");
  3509. }
  3510. String newItem2=phyCodeL2+"-"+phyCodeM2+"-"+phyCodeS2;
  3511. if(phyCodeL2.equals("HV") && hashMap.get("SPECIMEN_NO").toString().contains("LT1")){
  3512. //连退 粗糙度 试验方向 不参于判断
  3513. newItem2=newItem2+"-"+"null";
  3514. }else{
  3515. newItem2=newItem2+"-"+(itemCodeD2!=null?itemCodeD2:"null");
  3516. }
  3517. newItem2=newItem2+"-"+(itemCodeT2!=null?itemCodeT2:"null");
  3518. newItem2=newItem2+"-"+(itemCodeS2!=null?itemCodeS2:"null");
  3519. if(!"".equals(HAStr) && HAStr.equals("HA") && itemCodeD.equals("B")){
  3520. //断后伸长率 && hashMap.get("SPECIMEN_NO").toString().contains("LT1")
  3521. if(phyCodeS2.equals("A06")){
  3522. newItem2=newItem2+"-"+(PhyUnit2!=null?PhyUnit2:"null");
  3523. }
  3524. }else if(!"".equals(HAStr) && HAStr.equals("HA") && itemCodeD.equals("A") && phyCodeS.equals("A06") && itemCodeD2.equals("A") && phyCodeS2.equals("A06")){
  3525. newItem2=newItem2+"-"+(PhyUnit2!=null?PhyUnit2:"null");
  3526. }
  3527. //判断是否是冲击试验
  3528. if(phyCodeS.equals("C01") || phyCodeS.equals("C02")){
  3529. if(phyCodeS.equals(phyCodeS2)){
  3530. Integer co1t= Integer.parseInt(itemCodeT);//被引用
  3531. Integer co2t= Integer.parseInt(itemCodeT2);//引用
  3532. if(co1t >= co2t){
  3533. sql = "";
  3534. sql = " insert into QCM_JHY_INSP_PHYSICS "
  3535. +" (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, "
  3536. +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
  3537. +" VAL13,VAL14,VAL15,AVG_VAL,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, "
  3538. +" PHY_UNIT,MEMO) "
  3539. +" select '"+parmas.get("SPECIMEN_NO")+"','"+bigd4+"',TEST_QTY,'"+phyCodeL+"','"+phyNameL+"','"+phyCodeM+"','"+phyNameM+"','"+phyCodeS+"','"+phyNameS+"','"+itemCodeD+"','"+itemNameD+"', "
  3540. +" '"+itemCodeT+"','"+itemNameT+"','"+itemCodeS+"','"+itemNameS+"',VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
  3541. +" VAL13,VAL14,VAL15,AVG_VAL,'"+parmas.get("CREATE_NAME")+"',sysdate,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,'"+itemCodeL+"','"+itemDescL+"', "
  3542. +" PHY_UNIT,MEMO from QCM_JHY_INSP_PHYSICS t "
  3543. + " where t.specimen_no = '"+(String)hashMap.get("SPECIMEN_NO")+"' "
  3544. + "and t.seq = '"+hashMap.get("SEQ")+"' ";
  3545. mapper.insert(sql);
  3546. //修改ITEM表
  3547. sql = "";
  3548. sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t set t.QUOTE_MEMO = '已引用"+result.get("SPECIMEN_NO")+"' "
  3549. + " where t.SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' and t.seq = '"+seq+"' ";
  3550. mapper.updateJudgeStatus(sql.toString());
  3551. quotenum++;
  3552. break;
  3553. }
  3554. }
  3555. }else{//其它试验
  3556. //标准一样的引用
  3557. if(newItem.equals(newItem2)){
  3558. sql = "";
  3559. sql = " insert into QCM_JHY_INSP_PHYSICS "
  3560. +" (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, "
  3561. +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
  3562. +" VAL13,VAL14,VAL15,AVG_VAL,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, "
  3563. +" PHY_UNIT,MEMO) "
  3564. +" select '"+parmas.get("SPECIMEN_NO")+"','"+bigd4+"',TEST_QTY,'"+phyCodeL+"','"+phyNameL+"','"+phyCodeM+"','"+phyNameM+"','"+phyCodeS+"','"+phyNameS+"','"+itemCodeD+"','"+itemNameD+"', "
  3565. +" '"+itemCodeT+"','"+itemNameT+"','"+itemCodeS+"','"+itemNameS+"',VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
  3566. +" VAL13,VAL14,VAL15,AVG_VAL,'"+parmas.get("CREATE_NAME")+"',sysdate,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,'"+itemCodeL+"','"+itemDescL+"', "
  3567. +" PHY_UNIT,MEMO from QCM_JHY_INSP_PHYSICS t "
  3568. + " where t.specimen_no = '"+(String)hashMap.get("SPECIMEN_NO")+"' "
  3569. + "and t.seq = '"+hashMap.get("SEQ")+"' ";
  3570. mapper.insert(sql);
  3571. //修改ITEM表
  3572. sql = "";
  3573. sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t set t.QUOTE_MEMO = '已引用"+result.get("SPECIMEN_NO")+"' "
  3574. + " where t.SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' and t.seq = '"+seq+"' ";
  3575. mapper.updateJudgeStatus(sql.toString());
  3576. quotenum++;
  3577. break;
  3578. }else if(phyCodeS.equals("A06") && phyCodeS2.equals("A06") && HAStr.equals("HA")
  3579. && (itemCodeD.equals("B") || (itemCodeD.equals("A") && itemCodeD2.equals("A")) )){
  3580. //判断当前值单位是50mm 80mm
  3581. if("50mm".equals(PhyUnit)){
  3582. if("80mm".equals(PhyUnit2)){
  3583. //A50=A80*1.207
  3584. sql = "";
  3585. sql = " insert into QCM_JHY_INSP_PHYSICS "
  3586. +" (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, "
  3587. +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
  3588. +" VAL13,VAL14,VAL15,AVG_VAL,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, "
  3589. +" PHY_UNIT,MEMO) "
  3590. +" select '"+parmas.get("SPECIMEN_NO")+"','"+bigd4+"',TEST_QTY,'"+phyCodeL+"','"+phyNameL+"','"+phyCodeM+"','"+phyNameM+"','"+phyCodeS+"','"+phyNameS+"','"+itemCodeD+"','"+itemNameD+"', "
  3591. +" '"+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),"
  3592. +" 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,"
  3593. +" JHY02.ROUDN_MATH_JGXY((max_val*1.207), 0.5),JHY02.ROUDN_MATH_JGXY((min_val*1.207), 0.5),'"+itemCodeL+"','"+itemDescL+"', "
  3594. +" PHY_UNIT,MEMO from QCM_JHY_INSP_PHYSICS t "
  3595. + " where t.specimen_no = '"+(String)hashMap.get("SPECIMEN_NO")+"' "
  3596. + "and t.seq = '"+hashMap.get("SEQ")+"' ";
  3597. mapper.insert(sql);
  3598. }
  3599. }
  3600. else if("80mm".equals(PhyUnit)){
  3601. if("50mm".equals(PhyUnit2)){
  3602. //A80=A50*0.829
  3603. sql = "";
  3604. sql = " insert into QCM_JHY_INSP_PHYSICS "
  3605. +" (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, "
  3606. +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
  3607. +" VAL13,VAL14,VAL15,AVG_VAL,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, "
  3608. +" PHY_UNIT,MEMO) "
  3609. +" select '"+parmas.get("SPECIMEN_NO")+"','"+bigd4+"',TEST_QTY,'"+phyCodeL+"','"+phyNameL+"','"+phyCodeM+"','"+phyNameM+"','"+phyCodeS+"','"+phyNameS+"','"+itemCodeD+"','"+itemNameD+"', "
  3610. +" '"+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),"
  3611. +" 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,"
  3612. +" JHY02.ROUDN_MATH_JGXY((max_val*0.829), 0.5),JHY02.ROUDN_MATH_JGXY((min_val*0.829), 0.5),'"+itemCodeL+"','"+itemDescL+"', "
  3613. +" PHY_UNIT,MEMO from QCM_JHY_INSP_PHYSICS t "
  3614. + " where t.specimen_no = '"+(String)hashMap.get("SPECIMEN_NO")+"' "
  3615. + "and t.seq = '"+hashMap.get("SEQ")+"' ";
  3616. mapper.insert(sql);
  3617. }
  3618. }
  3619. //修改ITEM表
  3620. sql = "";
  3621. sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t set t.QUOTE_MEMO = '已引用"+result.get("SPECIMEN_NO")+"' "
  3622. + " where t.SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' and t.seq = '"+seq+"' ";
  3623. mapper.updateJudgeStatus(sql.toString());
  3624. quotenum++;
  3625. break;
  3626. }
  3627. }
  3628. }
  3629. }
  3630. String ABATCHLOG = "";
  3631. String sqlrz="select t.COIL_NO,t.ABATCHLOG from qcm_judge_coil_result t where t.COIL_NO in ( "
  3632. +" select d.material_no from qcm_jhy_sample_consign_d d where d.specimen_no = '"+parmas.get("SPECIMEN_NO")+"') "
  3633. +" and t.abatchlog is not null and rownum=1 ";
  3634. HashMap resultrz = mapper.queryOne(sqlrz.toString());
  3635. if(resultrz!=null && resultrz.size()>=1){
  3636. ABATCHLOG = resultrz.get("ABATCHLOG").toString();
  3637. }
  3638. //被引用的项目 全部 已引用
  3639. if(quotenum==bQuote){
  3640. //修改D表
  3641. sql = "";
  3642. sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.STATUS = '3',t.SEND_ID = '"+parmas.get("SEND_ID")+"',t.IMPROVE_MEMO= '"+ABATCHLOG+"' , "
  3643. + " t.SEND_NAME = '"+parmas.get("CREATE_NAME")+"',t.SEND_TIME = sysdate,t.SEND_MEMO = '有引用',t.QUOTE_MEMO = '引用实绩' "
  3644. + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'"
  3645. + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' ";
  3646. mapper.updateJudgeStatus(sql.toString());
  3647. //往log表中插入p
  3648. sql = "";
  3649. sql = " INSERT INTO QCM_JUDGE_LOG ( JUDGE_TYPE,MATERIAL_NO,CREATE_TIME,CREATE_NAME,PROD_LINE) "
  3650. +" VALUES ( 'P', '"+parmas.get("SMP_NO")+"', SYSDATE,'system','"+parmas.get("PLINE_CODE")+"')";
  3651. mapper.insert(sql);
  3652. }else{
  3653. //修改D表
  3654. sql = "";
  3655. sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.SEND_MEMO = '有引用',t.QUOTE_MEMO = '引用实绩',t.IMPROVE_MEMO= '"+ABATCHLOG+"' "
  3656. + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'"
  3657. + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' ";
  3658. mapper.updateJudgeStatus(sql.toString());
  3659. }
  3660. }else{
  3661. sql="";
  3662. sql = "select * from (select * from ("
  3663. + " select (select count(1) from qcm_jhy_sample_consign_d_item i where i.specimen_no = t.specimen_no) nums,t.* "
  3664. + " from QCM_JHY_SAMPLE_CONSIGN_D t,qcm_jhy_sample_r_ord r "
  3665. +" where t.smp_no = r.smp_no and t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"' "
  3666. +" and t.smp_type_code = '0' and t.status in('0','2','7') and nvl(t.QUOTE_MEMO ,'null') <> '引用实绩' "
  3667. + " 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') "
  3668. + " and r.DESIGN_KEY not like '39%' and r.DESIGN_KEY not like '49%' and r.DESIGN_KEY not like '59%' "
  3669. + " ) t order by t.nums desc) t where rownum=1 ";
  3670. result=null;
  3671. result = mapper.queryOne(sql.toString());
  3672. if(result==null || result.size()<=0){
  3673. sql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D t,qcm_jhy_sample_r_ord r "
  3674. +" where t.smp_no = r.smp_no and t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"' "
  3675. +" and t.smp_type_code = '0' and t.status in('0','2','7') and nvl(t.QUOTE_MEMO ,'null') <> '引用实绩' "
  3676. + " and t.freq_code <> 'D' "
  3677. + " and r.DESIGN_KEY not like '39%' and r.DESIGN_KEY not like '49%' and r.DESIGN_KEY not like '59%' "
  3678. + " and CHEM_ITEM is null and rownum <= 1 order by t.send_time asc ";
  3679. result=null;
  3680. result = mapper.queryOne(sql.toString());
  3681. }
  3682. if (result != null && result.size()>=1) {
  3683. sql = "";
  3684. sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.ONEMEMO = '力学性能实绩未返回或未下发委托,请等实绩返回人工引用',t.ARTIFICIAL_MEMO='1' "
  3685. + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'"
  3686. + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' ";
  3687. mapper.updateJudgeStatus(sql.toString());
  3688. }else{
  3689. //修改D表
  3690. sql = "";
  3691. sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.ONEMEMO = '没有找到相应力学性能委托' ,t.ARTIFICIAL_MEMO='0' "
  3692. + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'"
  3693. + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' ";
  3694. mapper.updateJudgeStatus(sql.toString());
  3695. }
  3696. }
  3697. } catch (Exception e) {
  3698. SqlSession.rollback();
  3699. SqlSession.close();
  3700. }
  3701. SqlSession.commit();
  3702. SqlSession.close();
  3703. }
  3704. /**
  3705. * 线棒LS订单自动引用 不同订单 同轧批号 项目一样引用
  3706. * @param materialInfo
  3707. * @return
  3708. * @throws Exception
  3709. */
  3710. public void DoQuoteXB(HashMap parmas) throws Exception {
  3711. SqlSession = QCM.COMMUNAL.SqlSessionBuilder.openSqlSession();
  3712. mapper = SqlSession.getMapper(QCM.COMMUNAL.OrderSqMapper.class);
  3713. try {
  3714. String strsql="";
  3715. if(parmas.get("MEMOLOG").equals("0")){//按子板件件取样
  3716. strsql = " AND T.MATERIAL_NO='"+parmas.get("MATERIAL_NO")+"' ";
  3717. }
  3718. //查询当前生成的委托
  3719. String sql ="SELECT T.SPECIMEN_NO,T.BATCH_NO,T.SMP_NO,T.PLINE_CODE,"
  3720. +" (SELECT COUNT(1) FROM QCM_JHY_SAMPLE_CONSIGN_D_ITEM I WHERE I.SPECIMEN_NO = T.SPECIMEN_NO) COUNTN "
  3721. +" 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' "
  3722. +" AND R.DESIGN_KEY = '"+parmas.get("DESIGN_KEY")+"' AND R.BATCH_NO ='"+parmas.get("BATCH_NO")+"' and t.status = '0' "
  3723. +strsql
  3724. + " ORDER BY COUNTN DESC ";
  3725. List<HashMap> result1 = mapper.query(sql.toString());
  3726. if(result1==null || result1.size()<=0){
  3727. return;
  3728. }
  3729. //查询最初的委托 AND R.DESIGN_KEY not like 'LS%' SOURCE:是否正常批
  3730. 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 "
  3731. +" FROM QCM_JHY_SAMPLE_CONSIGN_D T,QCM_JHY_SAMPLE_R_ORD R "
  3732. +" 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' "
  3733. +" AND T.QUOTE_MEMO IS NULL AND T.STATUS = '3' AND R.BATCH_NO ='"+parmas.get("BATCH_NO")+"' "
  3734. +" ORDER BY COUNTN DESC ";
  3735. List<HashMap> result = mapper.query(sql2.toString());
  3736. if (result != null && result.size()>=1) {
  3737. for (int a = 0; a < result1.size(); a++) {
  3738. //查询引用的所有明细
  3739. sql ="";
  3740. sql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where t.specimen_no = '"+result1.get(a).get("SPECIMEN_NO")+"' ";
  3741. List<HashMap> qltyLists=mapper.query(sql.toString());
  3742. //查询被引用的所有明细
  3743. sql ="";
  3744. sql = "select t.* from QCM_JHY_INSP_PHYSICS t where t.specimen_no = '"+result.get(a).get("SPECIMEN_NO")+"' ";
  3745. List<HashMap> qltyLists2=mapper.query(sql.toString());
  3746. if(qltyLists2==null || qltyLists2.size()<=0){
  3747. continue;
  3748. }
  3749. Integer bQuote = qltyLists.size();//引用
  3750. int quotenum = 0;//已引用数据
  3751. //引用
  3752. for (int i = 0; i < qltyLists.size(); i++) {//被引用在外层循环 对比 引用中有没有相应的项目有 插入
  3753. String specimenNo=(String) qltyLists.get(i).get("SPECIMEN_NO");
  3754. //代码
  3755. String phyCodeL = (String) qltyLists.get(i).get("PHY_CODE_L");//材质检验大项代码
  3756. String phyCodeM = (String) qltyLists.get(i).get("PHY_CODE_M");//试样组代码
  3757. String phyCodeS = (String) qltyLists.get(i).get("PHY_CODE_S");//材质检验项目代码
  3758. String itemCodeD = (String) qltyLists.get(i).get("ITEM_CODE_D");//试验方向代码
  3759. String itemCodeT = (String) qltyLists.get(i).get("ITEM_CODE_T");//试验温度代码 试验温度代码 冲击 被引用
  3760. String itemCodeS = (String) qltyLists.get(i).get("ITEM_CODE_S");//试样尺寸代码
  3761. //名称
  3762. String phyNameL = (String) qltyLists.get(i).get("PHY_NAME_L");//材质检验大项代码
  3763. String phyNameM = (String) qltyLists.get(i).get("PHY_NAME_M");//试样组代码
  3764. String phyNameS = (String) qltyLists.get(i).get("PHY_NAME_S");//材质检验项目代码
  3765. String itemNameD = (String) qltyLists.get(i).get("ITEM_NAME_D");//试验方向代码
  3766. String itemNameT = (String) qltyLists.get(i).get("ITEM_NAME_T");//试验温度代码 试验温度代码 冲击 被引用
  3767. String itemNameS = (String) qltyLists.get(i).get("ITEM_NAME_S");//试样尺寸代码
  3768. String itemCodeL = (String) qltyLists.get(i).get("ITEM_CODE_L");//试验位置代码
  3769. String itemDescL = (String) qltyLists.get(i).get("ITEM_DESC_L");
  3770. BigDecimal seq = (BigDecimal) qltyLists.get(i).get("SEQ");
  3771. String bigdjs = seq.toString();
  3772. Integer bigd4 = Integer.parseInt(bigdjs);
  3773. String newItem=phyCodeL+"-"+phyCodeM+"-"+phyCodeS;
  3774. newItem=newItem+"-"+(itemCodeD!=null?itemCodeD:"null");
  3775. newItem=newItem+"-"+(itemCodeT!=null?itemCodeT:"null");
  3776. newItem=newItem+"-"+(itemCodeS!=null?itemCodeS:"null");
  3777. newItem=newItem+"-"+(itemCodeL!=null?itemCodeL:"null");
  3778. //被引用
  3779. for (HashMap hashMap : qltyLists2) {
  3780. //代码
  3781. String phyCodeL2 = (String) hashMap.get("PHY_CODE_L");//材质检验大项代码
  3782. String phyCodeM2 = (String) hashMap.get("PHY_CODE_M");//试样组代码
  3783. String phyCodeS2 = (String) hashMap.get("PHY_CODE_S");//材质检验项目代码
  3784. String itemCodeD2 = (String) hashMap.get("ITEM_CODE_D");//试验方向代码
  3785. String itemCodeT2 = (String) hashMap.get("ITEM_CODE_T");//试验温度代码 试验温度代码 冲击 被引用
  3786. String itemCodeS2 = (String) hashMap.get("ITEM_CODE_S");//试样尺寸代码
  3787. String itemCodeL2 = (String) hashMap.get("ITEM_CODE_L");//试验位置代码
  3788. String newItem2=phyCodeL2+"-"+phyCodeM2+"-"+phyCodeS2;
  3789. newItem2=newItem2+"-"+(itemCodeD2!=null?itemCodeD2:"null");
  3790. newItem2=newItem2+"-"+(itemCodeT2!=null?itemCodeT2:"null");
  3791. newItem2=newItem2+"-"+(itemCodeS2!=null?itemCodeS2:"null");
  3792. newItem2=newItem2+"-"+(itemCodeL2!=null?itemCodeL2:"null");
  3793. //标准一样的引用
  3794. if(newItem.equals(newItem2)){
  3795. sql = "";
  3796. sql = " insert into QCM_JHY_INSP_PHYSICS "
  3797. +" (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, "
  3798. +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
  3799. +" VAL13,VAL14,VAL15,AVG_VAL,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, "
  3800. +" PHY_UNIT,MEMO) "
  3801. +" select '"+specimenNo+"','"+bigd4+"',TEST_QTY,'"+phyCodeL+"','"+phyNameL+"','"+phyCodeM+"','"+phyNameM+"','"+phyCodeS+"','"+phyNameS+"','"+itemCodeD+"','"+itemNameD+"', "
  3802. +" '"+itemCodeT+"','"+itemNameT+"','"+itemCodeS+"','"+itemNameS+"',VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, "
  3803. +" VAL13,VAL14,VAL15,AVG_VAL,'"+parmas.get("CREATE_NAME")+"',sysdate,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,'"+itemCodeL+"','"+itemDescL+"', "
  3804. +" PHY_UNIT,MEMO from QCM_JHY_INSP_PHYSICS t "
  3805. + " where t.specimen_no = '"+(String)hashMap.get("SPECIMEN_NO")+"' "
  3806. + "and t.seq = '"+hashMap.get("SEQ")+"' ";
  3807. mapper.insert(sql);
  3808. //修改ITEM表
  3809. sql = "";
  3810. sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t set t.QUOTE_MEMO = '已引用"+hashMap.get("SPECIMEN_NO")+"' "
  3811. + " where t.SPECIMEN_NO ='"+specimenNo+"' and t.seq = '"+seq+"' ";
  3812. mapper.updateJudgeStatus(sql.toString());
  3813. quotenum++;
  3814. break;
  3815. }
  3816. }
  3817. }
  3818. //被引用的项目 全部 已引用
  3819. if(quotenum==bQuote){
  3820. //修改D表
  3821. sql = "";
  3822. sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.STATUS = '3',t.SEND_ID = '"+parmas.get("CREATE_ID")+"', "
  3823. + " t.SEND_NAME = '"+parmas.get("CREATE_NAME")+"',t.SEND_TIME = sysdate,t.SEND_MEMO = '有引用',t.QUOTE_MEMO = '引用实绩' "
  3824. + " where t.batch_no = '"+result1.get(a).get("BATCH_NO")+"' and t.pline_code = '"+result1.get(a).get("PLINE_CODE")+"' "
  3825. + " and t.SPECIMEN_NO ='"+result1.get(a).get("SPECIMEN_NO")+"' ";
  3826. mapper.updateJudgeStatus(sql.toString());
  3827. //往log表中插入p
  3828. sql = "";
  3829. sql = " INSERT INTO QCM_JUDGE_LOG ( JUDGE_TYPE,MATERIAL_NO,CREATE_TIME,CREATE_NAME,PROD_LINE) "
  3830. +" VALUES ( 'P', '"+result1.get(a).get("SMP_NO")+"', SYSDATE,'system','"+result1.get(a).get("PLINE_CODE")+"')";
  3831. mapper.insert(sql);
  3832. }else{
  3833. //修改D表
  3834. sql = "";
  3835. sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.SEND_MEMO = '有引用',t.QUOTE_MEMO = '引用实绩' "
  3836. + " where t.batch_no = '"+result1.get(a).get("BATCH_NO")+"' and t.pline_code = '"+result1.get(a).get("PLINE_CODE")+"' "
  3837. + " and t.SPECIMEN_NO ='"+result1.get(a).get("SPECIMEN_NO")+"' ";
  3838. mapper.updateJudgeStatus(sql.toString());
  3839. }
  3840. }
  3841. }
  3842. } catch (Exception e) {
  3843. SqlSession.rollback();
  3844. SqlSession.close();
  3845. }
  3846. SqlSession.commit();
  3847. SqlSession.close();
  3848. }
  3849. /**
  3850. * 修改热轧清空组批区间
  3851. * @param materialInfo
  3852. * @return
  3853. * @throws Exception
  3854. */
  3855. public CoreReturnObject DoCleanUpMixRoll(HashMap parmas) throws Exception {
  3856. try {
  3857. String logmemo ="轧批号:"+parmas.get("BATCH_NO").toString()+','+"子板号:"+ parmas.get("MATERIAL_NO").toString()+','+
  3858. "组批区间"+parmas.get("MIXROLL").toString()+','+"产线:"+parmas.get("PLINE_CODE").toString()+','+
  3859. "操作人:"+parmas.get("USER_NAME").toString();
  3860. String sql= "INSERT INTO QCM_JUDGE_OPERATE_LOG (OPERATE_TYPE,PARAMS,OPERATE_NAME,PROD_LINE,BATCHNO,MEMO) "
  3861. + " VALUES('热轧清除组批区间','"+parmas.get("MATERIAL_NO")+"','DoCleanUpMixRoll','"+parmas.get("PLINE_CODE")+"',"
  3862. + " '"+parmas.get("BATCH_NO")+"','"+logmemo+"') ";
  3863. mapper.insert(sql);
  3864. String sqlStr="update tbf02_spec_mill t "
  3865. + " set MIXROLL='' "
  3866. + " where t.COIL_NO in ( "
  3867. + " select COIL_NO from tbh02_coil_comm c where c.OLD_SAMPL_NO like '"+parmas.get("BATCH_NO").toString()+"%' "
  3868. + " ) ";
  3869. mapper.updateJudgeStatus(sqlStr.toString());
  3870. } catch (Exception e) {
  3871. SqlSession.rollback();
  3872. SqlSession.close();
  3873. cro.setV_errCode(-1);
  3874. cro.setV_errMsg("清空组批区间失败!"+e.getMessage());
  3875. return cro;
  3876. }
  3877. SqlSession.commit();
  3878. SqlSession.close();
  3879. cro.setV_errCode(1);
  3880. return cro;
  3881. }
  3882. /**
  3883. * 项目集 取样位置
  3884. * @param materialInfo
  3885. * @return
  3886. * @throws Exception
  3887. */
  3888. public void doPhyItem(String SPECIMEN_NO) throws Exception {
  3889. SqlSession = QCM.COMMUNAL.SqlSessionBuilder.openSqlSession();
  3890. mapper = SqlSession.getMapper(QCM.COMMUNAL.OrderSqMapper.class);
  3891. try {
  3892. String sqlitem = "select * from qcm_jhy_sample_consign_d t "
  3893. +" where t.phy_item is null "
  3894. +" and t.specimen_no = '"+SPECIMEN_NO+"' ";
  3895. List<HashMap> PhyItem=mapper.query(sqlitem.toString());
  3896. if(PhyItem!=null && PhyItem.size()>=1){
  3897. String sqlItem = "select GET_ITEM_SPECIMEN_NO('"+SPECIMEN_NO+"') PHY_ITEM from dual";
  3898. List<HashMap> vhchm=mapper.query(sqlItem.toString());
  3899. if(vhchm!=null && vhchm.size()>=1 && !vhchm.get(0).get("PHY_ITEM").equals("NULL")){
  3900. String sql = " update QCM_JHY_SAMPLE_CONSIGN_D t "
  3901. +" set PHY_ITEM= '"+vhchm.get(0).get("PHY_ITEM").toString()+"' "
  3902. +" where t.SPECIMEN_NO='"+SPECIMEN_NO+"' ";
  3903. mapper.UpdateQcmWt(sql);
  3904. }
  3905. }
  3906. String getcin = "select r.* from qcm_jhy_sample_consign_d t, qcm_jhy_sample_r_ord r "
  3907. +" where t.smp_no = r.smp_no and t.specimen_no ='"+SPECIMEN_NO+"' "
  3908. +" and r.Three_Memo is null and r.pline_code in ('ZB1','HB1') ";
  3909. List<HashMap> getcinHM=mapper.query(getcin.toString());
  3910. if(getcinHM!=null && getcinHM.size()>=1){
  3911. String sqlItem2 = "select GET_CERT_INST_NAME('"+SPECIMEN_NO+"') PHY_ITEM from dual";
  3912. List<HashMap> vhchm2=mapper.query(sqlItem2.toString());
  3913. if(vhchm2!=null && vhchm2.size()>=1 && !vhchm2.get(0).get("PHY_ITEM").equals("NULL")){
  3914. String sql = " update qcm_jhy_sample_r_ord t "
  3915. +" set THREE_MEMO= '"+vhchm2.get(0).get("PHY_ITEM").toString()+"' "
  3916. +" where t.SMP_NO in ( select d.smp_no from qcm_jhy_sample_consign_d d where d.specimen_no = '"+SPECIMEN_NO+"') ";
  3917. mapper.updateJudgeStatus(sql.toString());
  3918. }
  3919. }
  3920. TreeSet<String> treeSet = new TreeSet<String>();
  3921. String SQLsmpLocation = "select * from QCM_JHY_SAMPLE_CONSIGN_D_ITEM t "
  3922. +" where t.SMP_LOCATION is null "
  3923. +" and t.specimen_no = '"+SPECIMEN_NO+"' ";
  3924. List<HashMap> PhySp=mapper.query(SQLsmpLocation.toString());
  3925. if(PhySp!=null && PhySp.size()>=1){
  3926. treeSet.add(SPECIMEN_NO);
  3927. for (HashMap<String,String> hashMap : PhySp) {
  3928. String fyQuoteSpecimenNo=String.valueOf(hashMap.get("FY_QUOTE_SPECIMEN_NO"));
  3929. if(fyQuoteSpecimenNo!=null && !"".equals(fyQuoteSpecimenNo) && !"null".equals(fyQuoteSpecimenNo)){
  3930. treeSet.add(fyQuoteSpecimenNo);
  3931. }
  3932. }
  3933. if(treeSet.size()>=1){
  3934. for (String str : treeSet) {
  3935. //查出取样位置
  3936. String sqlsl="select * from qcm_jhy_sample_consign_d t where t.specimen_no = '"+str+"' and rownum = 1 ";
  3937. List<HashMap> sqlslhm=mapper.query(sqlsl.toString());
  3938. if(sqlslhm!=null && sqlslhm.size()>=1){
  3939. String SMP_LOCATION=sqlslhm.get(0).get("SMP_LOCATION").toString();//取样位置
  3940. String sql="select * from QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where t.specimen_no = '"+str+"' "
  3941. + " and t.SMP_LOCATION is null and t.FY_QUOTE_SPECIMEN_NO is null ";
  3942. List<HashMap> hashMap=mapper.query(sql.toString());
  3943. if(hashMap!=null && hashMap.size()>=1){
  3944. sql="";
  3945. sql = " update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t "
  3946. +" set SMP_LOCATION= '"+SMP_LOCATION+"' "
  3947. +" where t.SPECIMEN_NO='"+str+"' and t.SMP_LOCATION is null and t.FY_QUOTE_SPECIMEN_NO is null ";
  3948. mapper.UpdateQcmWt(sql);
  3949. }
  3950. sql="";
  3951. sql="select * from QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where t.FY_QUOTE_SPECIMEN_NO = '"+str+"' "
  3952. + " and t.SMP_LOCATION is null and t.SEQ>=50 ";
  3953. List<HashMap> hashMap2=mapper.query(sql.toString());
  3954. if(hashMap2!=null && hashMap2.size()>=1){
  3955. sql="";
  3956. sql = " update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t "
  3957. +" set SMP_LOCATION= '"+SMP_LOCATION+"' "
  3958. +" where t.FY_QUOTE_SPECIMEN_NO='"+str+"' and t.SMP_LOCATION is null and t.SEQ>=50 ";
  3959. mapper.UpdateQcmWt(sql);
  3960. }
  3961. }
  3962. }
  3963. }
  3964. }
  3965. } catch (Exception e) {
  3966. SqlSession.rollback();
  3967. SqlSession.close();
  3968. }
  3969. SqlSession.commit();
  3970. SqlSession.close();
  3971. }
  3972. //19订单刷新 or t.onememo is null)
  3973. public void AutoTimeZHB(String usreName) throws Exception {
  3974. SqlSession = QCM.COMMUNAL.SqlSessionBuilder.openSqlSession();
  3975. mapper = SqlSession.getMapper(QCM.COMMUNAL.OrderSqMapper.class);
  3976. try {
  3977. String sql="select * from ( "
  3978. +" 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, "
  3979. +" (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 "
  3980. + " 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) "
  3981. + " 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,"
  3982. + " (select count(1) from zj_result_all@xgcx z where z.billetid= t.material_no and z.JUDGERESULT='0' ) JUDGERESULT "
  3983. +" from qcm_jhy_sample_consign_d t,qcm_jhy_sample_r_ord r "
  3984. +" where t.smp_no = r.smp_no "
  3985. +" and r.design_key like '19%' "
  3986. +" and (t.ONEMEMO='力学性能实绩未返回或未下发委托,请等实绩返回人工引用' or t.onememo is null) "
  3987. +" and nvl(t.ARTIFICIAL_MEMO,'1') ='1' "
  3988. +" and t.status = '0' "
  3989. +" and r.judge_status = '0' and t.freq_code <>'D' and t.pline_code in ('ZB1','HB1') "
  3990. +" order by t.create_time"
  3991. +" ) f "
  3992. +" 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')"
  3993. +" and rownum<=20 ";
  3994. List<HashMap> qltyLists=mapper.query(sql.toString());
  3995. if(qltyLists!=null && qltyLists.size()>=1){
  3996. for (int i = 0; i < qltyLists.size(); i++) {
  3997. HashMap<String, String> Quotehm =new HashMap<String, String>();
  3998. Quotehm.put("HEAT_NO", qltyLists.get(i).get("HEAT_NO").toString());
  3999. Quotehm.put("BATCH_NO", qltyLists.get(i).get("BATCH_NO").toString());
  4000. Quotehm.put("SMP_NO", qltyLists.get(i).get("SMP_NO").toString());
  4001. Quotehm.put("SPECIMEN_NO", qltyLists.get(i).get("SPECIMEN_NO").toString());
  4002. Quotehm.put("FREQ_CODE", qltyLists.get(i).get("FREQ_CODE").toString());
  4003. Quotehm.put("PLINE_CODE", qltyLists.get(i).get("PLINE_CODE").toString());
  4004. Quotehm.put("SMP_TYPE_CODE", qltyLists.get(i).get("SMP_TYPE_CODE").toString());
  4005. Quotehm.put("SEND_ID", "系统自动");
  4006. Quotehm.put("CREATE_NAME", "系统自动");
  4007. Quotehm.put("THICK", qltyLists.get(i).get("THICK").toString());
  4008. Quotehm.put("DESIGN_KEY", qltyLists.get(i).get("DESIGN_KEY").toString());
  4009. String str=DoQuoteBatchNo191(Quotehm);
  4010. if("1".equals(str)){
  4011. System.out.println(i+": 19刷新接口:"+qltyLists.get(i).get("BATCH_NO")+"、"+qltyLists.get(i).get("SPECIMEN_NO")+"成功");
  4012. }else{
  4013. System.out.println(i+": 19刷新接口:"+qltyLists.get(i).get("BATCH_NO")+"、"+qltyLists.get(i).get("SPECIMEN_NO")+"失败!"+str);
  4014. }
  4015. }
  4016. }
  4017. } catch (Exception e) {
  4018. SqlSession.rollback();
  4019. SqlSession.close();
  4020. System.out.println("2:调用19失败!"+e.getMessage());
  4021. }finally {
  4022. SqlSession.close();
  4023. }
  4024. }
  4025. //SQLS订单号多次换单导致材质判定时检验号被清空判不了
  4026. public void AutoTimeSQLS(String usreName) throws Exception {
  4027. SqlSession = QCM.COMMUNAL.SqlSessionBuilder.openSqlSession();
  4028. mapper = SqlSession.getMapper(QCM.COMMUNAL.OrderSqMapper.class);
  4029. try {
  4030. 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 "
  4031. +" where t.smp_no = r.smp_no "
  4032. +" and r.design_key not like '19%' "
  4033. +" and t.pline_code in ('ZB1','HB1') "
  4034. +" and r.Judge_Status='1' "
  4035. +" and r.Judge_Result_Code='3' "
  4036. +" and r.Judge_Result_Desc = '没在库' "
  4037. +" and t.freq_code <> 'D' and t.smp_type_code = '0' "
  4038. +" and r.memo is null ";
  4039. List<HashMap> qltyLists=mapper.query(sql.toString());
  4040. if(qltyLists!=null && qltyLists.size()>=1){
  4041. for (int i = 0; i < qltyLists.size(); i++) {
  4042. String SMP_NO=qltyLists.get(i).get("SMP_NO").toString();
  4043. String BATCH_NO=qltyLists.get(i).get("BATCH_NO").toString();
  4044. String MATERIAL_NO=qltyLists.get(i).get("MATERIAL_NO").toString();
  4045. String BOARD_NO=qltyLists.get(i).get("BOARD_NO").toString();
  4046. String INSPECTION_LOT=qltyLists.get(i).get("INSPECTION_LOT").toString();
  4047. String PLINE_CODE=qltyLists.get(i).get("PLINE_CODE").toString();
  4048. String FREQ_CODE=qltyLists.get(i).get("FREQ_CODE").toString();
  4049. String DESIGN_KEY=qltyLists.get(i).get("DESIGN_KEY").toString();
  4050. String STEEL_CODE=qltyLists.get(i).get("STEEL_CODE").toString();
  4051. String THICK=qltyLists.get(i).get("THICK").toString();
  4052. String sql2="select * from zj_result_all@xgcx t "
  4053. + " where t.billetid = '"+MATERIAL_NO+"' and t.BILLETID_JY is null ";
  4054. List<HashMap> qltyLists2=mapper.query(sql2.toString());
  4055. if(qltyLists2!=null && qltyLists2.size()>=1){
  4056. String sqlzj = " update zj_result_all@xgcx t set t.billetid_jy = '"+INSPECTION_LOT+"' "
  4057. + " where t.billetid='"+MATERIAL_NO+"' ";
  4058. mapper.updateJudgeStatus(sqlzj.toString());
  4059. //r.design_key like 'SQLS%'
  4060. String sqlord = " update qcm_jhy_sample_r_ord r "
  4061. +" set r.Judge_Status='0',r.Judge_Result_Code='', "
  4062. +" r.Judge_Result_Desc = '',r.memo='订单:'||'"+DESIGN_KEY+"' "
  4063. +" where 1=1 "
  4064. +" and r.Smp_No='"+SMP_NO+"' ";
  4065. mapper.updateJudgeStatus(sqlord.toString());
  4066. String sqlP = " INSERT INTO QCM_JUDGE_LOG ( JUDGE_TYPE,MATERIAL_NO,CREATE_TIME,CREATE_NAME,PROD_LINE) "
  4067. +" VALUES ( 'P', '"+SMP_NO+"', SYSDATE,'system','"+PLINE_CODE+"')";
  4068. mapper.insert(sqlP);
  4069. System.out.println("调用"+DESIGN_KEY+"订单接口成功:轧批号:"+BATCH_NO+"、试样号:"+SMP_NO);
  4070. }else{
  4071. String lot="0";
  4072. HashMap<String, String> hashMapStr =new HashMap<String, String>();
  4073. hashMapStr.put("BATCH_NO", BATCH_NO);
  4074. hashMapStr.put("PLINE_CODE", PLINE_CODE);
  4075. hashMapStr.put("DESIGN_KEY", DESIGN_KEY);
  4076. hashMapStr.put("STEEL_CODE", STEEL_CODE);
  4077. hashMapStr.put("THICK", THICK);
  4078. hashMapStr.put("BOARD_NO", BOARD_NO);
  4079. hashMapStr.put("FREQ_CODE", FREQ_CODE);
  4080. hashMapStr.put("MATERIAL_NO", MATERIAL_NO);
  4081. String deystr = DESIGN_KEY.substring(0, 2);
  4082. if(!"19".equals(deystr)){
  4083. String sqlstr = ZHBJudgeStatus(hashMapStr);
  4084. List<HashMap> kczh=mapper.query(sqlstr.toString());
  4085. if (kczh!=null && kczh.size()>=1) {
  4086. for (HashMap hashMap : kczh) {
  4087. String bcon = "select nvl(t.BILLETID_JY,'0') BILLETID_JY,t.* from zj_result_all@xgcx t "
  4088. + " where t.billetid = '"+(String)hashMap.get("MATERIAL_NO")+"' "
  4089. + " and rownum <= 1 ";
  4090. List<HashMap> billetidJy = mapper.query(bcon.toString());
  4091. if(billetidJy != null && billetidJy.size() >=1 && !billetidJy.get(0).get("BILLETID_JY").equals(INSPECTION_LOT)){
  4092. mapper.zjResultAllZHB(MATERIAL_NO,INSPECTION_LOT);
  4093. lot="1";
  4094. }
  4095. }
  4096. }
  4097. }
  4098. if(lot.equals("1")){
  4099. String sqlord = " update qcm_jhy_sample_r_ord r "
  4100. +" set r.memo='订单:'||'"+DESIGN_KEY+"',JUDGE_STATUS='0',JUDGE_RESULT_CODE='',JUDGE_RESULT_DESC='' "
  4101. +" where 1=1 "
  4102. +" and r.Smp_No='"+SMP_NO+"' ";
  4103. mapper.updateJudgeStatus(sqlord.toString());
  4104. String sqlP = " INSERT INTO QCM_JUDGE_LOG ( JUDGE_TYPE,MATERIAL_NO,CREATE_TIME,CREATE_NAME,PROD_LINE) "
  4105. +" VALUES ( 'P', '"+SMP_NO+"', SYSDATE,'system','"+PLINE_CODE+"')";
  4106. mapper.insert(sqlP);
  4107. }else{
  4108. String sqlord = " update qcm_jhy_sample_r_ord r "
  4109. +" set r.memo='订单:'||'"+DESIGN_KEY+"' "
  4110. +" where 1=1 "
  4111. +" and r.Smp_No='"+SMP_NO+"' ";
  4112. mapper.updateJudgeStatus(sqlord.toString());
  4113. }
  4114. System.out.println("调用"+DESIGN_KEY+"订单接口检验号不为空:轧批号:"+BATCH_NO+"、试样号:"+SMP_NO);
  4115. }
  4116. }
  4117. }
  4118. } catch (Exception e) {
  4119. SqlSession.rollback();
  4120. SqlSession.close();
  4121. System.out.println("2:调用SQLS订单接口失败!"+e.getMessage());
  4122. }
  4123. SqlSession.commit();
  4124. SqlSession.close();
  4125. }
  4126. public String ZHBJudgeStatus(HashMap<String, String> hashMapStr){
  4127. String freqCode="";
  4128. //按母板取样
  4129. if(hashMapStr.get("FREQ_CODE").equals("B") || hashMapStr.get("FREQ_CODE").equals("F") || hashMapStr.get("FREQ_CODE").equals("G")){
  4130. freqCode =" and t.BOARD_NO = '"+hashMapStr.get("BOARD_NO")+"' ";
  4131. }else if(hashMapStr.get("FREQ_CODE").equals("C") || hashMapStr.get("FREQ_CODE").equals("H") || hashMapStr.get("FREQ_CODE").equals("I")){
  4132. freqCode =" and t.MATERIAL_NO = '"+hashMapStr.get("MATERIAL_NO")+"' ";
  4133. }
  4134. String materialNosql="";
  4135. if(hashMapStr.get("PLINE_CODE").equals("ZB1")){
  4136. materialNosql = "SELECT t.* "
  4137. +" 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 "
  4138. +" ,T.MOTHERPLATEID BOARD_NO FROM MB_PLANDETAILOFPLATE@xgcx T, SEL_PACTDETAIL_NEW@xgcx A "
  4139. +" WHERE T.ORDERNO = A.ORDERNO "
  4140. +" and T.PRODUCTNO not in "
  4141. +" (select T.BILLETID from KCZ_TURNOFFLIST@xgcx T where t.ROLLNUMBER = '"+hashMapStr.get("BATCH_NO")+"') "
  4142. +" and T.ORDERNO is not null AND A.SAMPLINGREQUESTTIME IN ('A', 'AB') "
  4143. +" union all "
  4144. +" SELECT A.SAMPLINGREQUESTTIME,T.ORDERNO DESIGN_KEY,T.ROLLNUMBER BATCH_NO,T.DETERMINANTCARDNUMBER GRADE_CODE,T.PLY THICK,T.BILLETID MATERIAL_NO "
  4145. +" ,T.MOTHERBOARDNUMBER BOARD_NO FROM KCZ_TURNOFFLIST@xgcx T, SEL_PACTDETAIL_NEW@xgcx A "
  4146. +" WHERE T.ORDERNO = A.ORDERNO and T.ORDERNO is not null AND T.ISVALID <> '0') t "
  4147. +" WHERE t.BATCH_NO = '"+hashMapStr.get("BATCH_NO")+"' and t.BATCH_NO like 'Z%' "
  4148. +" and t.GRADE_CODE = '"+hashMapStr.get("STEEL_CODE")+"' and to_char(t.THICK, 'fm990.099') = to_char('"+hashMapStr.get("THICK")+"', 'fm990.099') "
  4149. +" and T.DESIGN_KEY = '"+hashMapStr.get("DESIGN_KEY")+"' "
  4150. + freqCode
  4151. + " 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 ";
  4152. }else if(hashMapStr.get("PLINE_CODE").equals("HB1")){
  4153. materialNosql ="SELECT t.* "
  4154. +" 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, "
  4155. +" T.MOTHERSLAB BOARD_NO FROM ZYHB_PLANDETAILOFPLATE@xgcx T, SEL_PACTDETAIL_NEW@xgcx A "
  4156. +" WHERE T.ORDERID = A.ORDERNO "
  4157. +" and T.SLABNO not in "
  4158. +" (select T.BILLETID from KCH_TURNOFFLIST@xgcx T where t.ROLLNUMBER = '"+hashMapStr.get("BATCH_NO")+"') "
  4159. +" and T.ORDERID is not null "
  4160. +" union all "
  4161. +" SELECT A.SAMPLINGREQUESTTIME,T.ALLOTORDERFORM DESIGN_KEY,T.ROLLNUMBER BATCH_NO,T.DETERMINANTCARDNUMBER GRADE_CODE,T.PLY THICK,T.BILLETID MATERIAL_NO "
  4162. +" ,T.MOTHERBOARDNUMBER BOARD_NO FROM KCH_TURNOFFLIST@xgcx T, SEL_PACTDETAIL_NEW@xgcx A "
  4163. +" WHERE T.ALLOTORDERFORM = A.ORDERNO and T.ALLOTORDERFORM is not null AND T.PSTATFLAG <> '0') t "
  4164. +" WHERE t.BATCH_NO = '"+hashMapStr.get("BATCH_NO")+"' and t.BATCH_NO like 'H%' "
  4165. +" and t.GRADE_CODE = '"+hashMapStr.get("STEEL_CODE")+"' and to_char(t.THICK, 'fm990.099') = to_char('"+hashMapStr.get("THICK")+"', 'fm990.099') "
  4166. +" and T.DESIGN_KEY = '"+hashMapStr.get("DESIGN_KEY")+"' "
  4167. + freqCode
  4168. +" 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";
  4169. }
  4170. return materialNosql;
  4171. }
  4172. //自动刷激光
  4173. public void AutoTimeJG() throws Exception {
  4174. try {
  4175. SqlSession = QCM.COMMUNAL.SqlSessionBuilder.openSqlSession();
  4176. mapper = SqlSession.getMapper(QCM.COMMUNAL.OrderSqMapper.class);
  4177. String sql="select t.* from QCM_JHY_SAMPLE_CONSIGN_JG t where t.yn = 'Y' and rownum <=100 ORDER BY T.CREATE_TIME ";
  4178. List<HashMap> qltyLists=mapper.query(sql.toString());
  4179. if(qltyLists!=null && qltyLists.size()>=1){
  4180. for (int i = 0; i < qltyLists.size(); i++) {
  4181. HashMap<String, String> Quotehm =new HashMap<String, String>();
  4182. String SPECIMEN_NO = qltyLists.get(i).get("SPECIMEN_NO").toString();
  4183. Quotehm.put("SPECIMEN_NO", SPECIMEN_NO);
  4184. Quotehm.put("BATCH_NO", qltyLists.get(i).get("BATCH_NO").toString());
  4185. Quotehm.put("PLINE_CODE", qltyLists.get(i).get("PLINE_CODE").toString());
  4186. Send2 jg=new Send2();
  4187. CoreReturnObject oj=jg.SendJG(SPECIMEN_NO,"JG","JG",Quotehm);
  4188. String rinfo=oj.getV_errMsg().toString();
  4189. if(rinfo.equals("待发送的检验委托数据已经不存在,请核实数据!")){
  4190. String sqlord = " update QCM_JHY_SAMPLE_CONSIGN_JG r set r.SUCCESS_MEMO='"+rinfo+"',r.YN='N' "
  4191. +" where r.SPECIMEN_NO='"+SPECIMEN_NO+"' ";
  4192. mapper.updateJudgeStatus(sqlord.toString());
  4193. SqlSession.commit();
  4194. }
  4195. }
  4196. }
  4197. } catch (Exception e) {
  4198. SqlSession.rollback();
  4199. SqlSession.close();
  4200. System.out.println("发送激光接口失败:"+e.getMessage());
  4201. }finally {
  4202. SqlSession.close();
  4203. }
  4204. }
  4205. //电弧炉熔炼成分自动判定
  4206. public void AutoTimeHDL() throws Exception {
  4207. try {
  4208. SqlSession = QCM.COMMUNAL.SqlSessionBuilder.openSqlSession();
  4209. mapper = SqlSession.getMapper(QCM.COMMUNAL.OrderSqMapper.class);
  4210. String sql="select f.HEAT_NO,f.MATERIAL_NO,f.DESIGN_KEY,f.SNAME,f.STEEL_CODE,f.ASSAY_NO from ( "
  4211. +" select k.STOVENO HEAT_NO,k.BILLETID MATERIAL_NO,k.ORDERNO DESIGN_KEY,'system' SNAME,k.DETERMINANTCARDNUMBER STEEL_CODE,t.ASSAY_NO "
  4212. +" from kcx_turnofflist@xgcx k,zj_result_all@xgcx z,qcm_jhy_insp_elements t "
  4213. +" where k.BILLETID = z.BILLETID "
  4214. +" and k.STOVENO = t.HEAT_NO "
  4215. +" and t.heat_no like 'E%' "
  4216. +" and z.JUDGERESULT = '0' "
  4217. +" and z.R_CHEMRESULT = '0' "
  4218. +" and z.CREATE_TIME > TO_DATE('2024-09-01 00:00:01','YYYY-MM-DD HH24:MI:SS') "
  4219. +" and k.STOVENO is not null "
  4220. +" and k.BILLETID is not null "
  4221. +" and k.ORDERNO is not null "
  4222. +" and k.DETERMINANTCARDNUMBER is not null "
  4223. +" and t.ASSAY_NO is not null "
  4224. +" group by k.STOVENO,k.BILLETID,k.ORDERNO,k.DETERMINANTCARDNUMBER,t.ASSAY_NO "
  4225. +" order by k.BILLETID) f "
  4226. +" where rownum <=100 ";
  4227. List<HashMap> qltyLists=mapper.query(sql.toString());
  4228. if(qltyLists!=null && qltyLists.size()>=1){
  4229. for (int i = 0; i < qltyLists.size(); i++) {
  4230. String heat_no = qltyLists.get(i).get("HEAT_NO").toString();//炉号
  4231. String material_no = qltyLists.get(i).get("MATERIAL_NO").toString();//子板号
  4232. String design_key = qltyLists.get(i).get("DESIGN_KEY").toString();//订单号
  4233. String username = qltyLists.get(i).get("SNAME").toString();//操作人
  4234. String grade_name = qltyLists.get(i).get("STEEL_CODE").toString();//牌号
  4235. String assay_no = qltyLists.get(i).get("ASSAY_NO").toString();//成分化验号
  4236. ArrayList<String> list = new ArrayList<String>();
  4237. list.add(assay_no);
  4238. System.out.println("\n子板号:"+material_no);
  4239. QcmJhyElementsServiceImpl impl = new QcmJhyElementsServiceImpl();
  4240. impl.RlChemJudgeByHuman(heat_no, material_no, design_key, username, grade_name, list);
  4241. System.out.println("\n子板号:"+material_no+"结束");
  4242. }
  4243. }
  4244. } catch (Exception e) {
  4245. SqlSession.rollback();
  4246. SqlSession.close();
  4247. System.out.println("电弧炉熔炼成分自动判定失败:"+e.getMessage());
  4248. }finally {
  4249. SqlSession.close();
  4250. }
  4251. }
  4252. /**
  4253. * 调整热处理号
  4254. * @param materialInfo
  4255. * @return
  4256. * @throws Exception
  4257. */
  4258. public CoreReturnObject doProcessNos(HashMap parmas) throws Exception {
  4259. try {
  4260. String rclState =parmas.get("PROCESS_NOS").toString();//修改的热处理号
  4261. String sqlStr ="";
  4262. //判断是否是模拟焊后
  4263. String sqlmn="select * from QCM_JHY_SAMPLE_CONSIGN_D t where t.SMP_NO = '"+parmas.get("SMP_NO")+"' and t.SMP_LOCATION like '%模拟焊后%' ";
  4264. List<HashMap> map2=mapper.query(sqlmn.toString());
  4265. if(map2!=null && map2.size()>=1){
  4266. sqlStr="select * from QCM_JHY_SAMPLE_CONSIGN_D t where t.smp_no = '"+parmas.get("SMP_NO")+"' ";
  4267. }else{
  4268. sqlStr = "select * from QCM_JHY_SAMPLE_CONSIGN_D t"
  4269. + " where t.BATCH_NO = '"+parmas.get("BATCH_NO")+"' "
  4270. + " and t.SMP_NO = '"+parmas.get("SMP_NO")+"' ";
  4271. // sqlStr = "select * from QCM_JHY_SAMPLE_CONSIGN_D t"
  4272. // + " where t.BATCH_NO = '"+parmas.get("BATCH_NO")+"' "
  4273. // + " and t.SPECIMEN_NO = '"+parmas.get("SPECIMEN_NO")+"' "
  4274. // + " and t.SMP_NO = '"+parmas.get("SMP_NO")+"' ";
  4275. }
  4276. List<HashMap> map=mapper.query(sqlStr.toString());
  4277. if(map !=null && map.size()>=1){
  4278. String str = parmas.get("USER_NAME")+"修改热处理号为"+rclState;
  4279. for (HashMap<String,String> hashMap : map) {
  4280. sqlStr="";
  4281. sqlStr="select * from QCM_JHY_SAMPLE_CONSIGN_D t where t.specimen_no = '"+hashMap.get("SPECIMEN_NO")+"' and t.process_nos <>'"+rclState+"'";
  4282. List<HashMap> mappr=mapper.query(sqlStr.toString());
  4283. if(mappr!=null && mappr.size()>=1){
  4284. sqlStr="";
  4285. sqlStr="update QCM_JHY_SAMPLE_CONSIGN_D t set PROCESS_NOS='"+rclState+"',"
  4286. + " ARTIFICIAL_MEMO=t.ARTIFICIAL_MEMO||',"+str+"'||'原委托热处理号为:'||t.PROCESS_NOS "
  4287. + " where t.BATCH_NO = '"+hashMap.get("BATCH_NO")+"' "
  4288. + " and t.SPECIMEN_NO = '"+hashMap.get("SPECIMEN_NO")+"' "
  4289. + " and t.SMP_NO = '"+hashMap.get("SMP_NO")+"' ";
  4290. mapper.updateJudgeStatus(sqlStr.toString());
  4291. String strMemo = "取样编号:"+hashMap.get("SPECIMEN_NO")+str+",原委托热处理号为:"+hashMap.get("PROCESS_NOS");
  4292. QcmJudgeOperateLog qjog = new QcmJudgeOperateLog();
  4293. qjog.setOperate_name(parmas.get("USER_NAME").toString());
  4294. qjog.setBatchno(parmas.get("BATCH_NO") == null ?"":parmas.get("BATCH_NO").toString());
  4295. qjog.setOperate_type("调整热处理号");
  4296. qjog.setParams(parmas.get("MATERIAL_NO") == null ?"":parmas.get("MATERIAL_NO").toString());
  4297. qjog.setProd_line(parmas.get("PLINE_CODE") == null ?"":parmas.get("PLINE_CODE").toString());
  4298. qjog.setMemo(strMemo);
  4299. mapper.insertQcmJudgeOperateLog(qjog);
  4300. }
  4301. }
  4302. /* if(map.get(0).get("STATUS").toString().equals("3")){
  4303. String INSPECTION_LOT = map.get(0).get("INSPECTION_LOT").toString();
  4304. String PLINE_CODE = map.get(0).get("PLINE_CODE").toString();
  4305. QcmJudgeLog qjlt = new QcmJudgeLog();
  4306. qjlt.setJudge_type("R");
  4307. qjlt.setMaterial_no(INSPECTION_LOT);
  4308. qjlt.setCreate_name("sysZH");
  4309. qjlt.setProd_line(PLINE_CODE);
  4310. mapper.insertQcmJudgeLog(qjlt);
  4311. }*/
  4312. }
  4313. } catch (Exception e) {
  4314. SqlSession.rollback();
  4315. SqlSession.close();
  4316. cro.setV_errCode(-1);
  4317. cro.setV_errMsg("调整失败!");
  4318. return cro;
  4319. }
  4320. SqlSession.commit();
  4321. SqlSession.close();
  4322. cro.setV_errCode(1);
  4323. return cro;
  4324. }
  4325. //打印标识
  4326. public CoreReturnObject doPrintLog(String specimenNo) throws Exception {
  4327. try {
  4328. String sql= " update QCM_JHY_SAMPLE_CONSIGN_D t set t.print_log = '已打印' where t.specimen_no = '"+specimenNo+"' ";
  4329. mapper.updateJudgeStatus(sql.toString());
  4330. } catch (Exception e) {
  4331. SqlSession.rollback();
  4332. SqlSession.close();
  4333. cro.setV_errCode(-1);
  4334. cro.setV_errMsg("打印失败!");
  4335. return cro;
  4336. }
  4337. SqlSession.commit();
  4338. SqlSession.close();
  4339. return cro;
  4340. }
  4341. //一键删除委托
  4342. public CoreReturnObject doDelAllWT(HashMap parmas) throws Exception {
  4343. try {
  4344. String upsql="";
  4345. String sql="select * from qcm_jhy_sample_consign_d t,qcm_jhy_sample_consign_m m, qcm_jhy_sample_r_ord r "
  4346. +" where t.smp_no = r.smp_no "
  4347. +" and t.smp_no = m.smp_no "
  4348. +" and m.smp_no = r.smp_no "
  4349. +" and t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' ";
  4350. List<HashMap> hmap=mapper.query(sql.toString());
  4351. if(hmap!=null && hmap.size()>=1){
  4352. //材质判定
  4353. 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"))){
  4354. upsql= " update QCM_JHY_SAMPLE_CONSIGN_D t set t.ONEMEMO = '已材质判定请取消判定' where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' ";
  4355. mapper.updateJudgeStatus(upsql.toString());
  4356. SqlSession.commit();
  4357. SqlSession.close();
  4358. return cro;
  4359. }
  4360. //不是按炉 下发委托 未撤回
  4361. if(!hmap.get(0).get("STATUS").equals("0") && !hmap.get(0).get("FREQ_CODE").equals("D")){
  4362. upsql= " update QCM_JHY_SAMPLE_CONSIGN_D t set t.ONEMEMO = '已下发委托未撤回' where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' ";
  4363. mapper.updateJudgeStatus(upsql.toString());
  4364. SqlSession.commit();
  4365. SqlSession.close();
  4366. return cro;
  4367. }
  4368. //按炉 送样委托 未撤回
  4369. if(!hmap.get(0).get("STATUS").equals("0") && hmap.get(0).get("FREQ_CODE").equals("D") && hmap.get(0).get("QUOTE_CONSIGN_NO")==null){
  4370. upsql= " update QCM_JHY_SAMPLE_CONSIGN_D t set t.ONEMEMO = '送样夹杂已下发委托未撤回' where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' ";
  4371. mapper.updateJudgeStatus(upsql.toString());
  4372. SqlSession.commit();
  4373. SqlSession.close();
  4374. return cro;
  4375. }
  4376. }
  4377. //String uuid=this.getUUID();
  4378. upsql= " update QCM_JHY_SAMPLE_CONSIGN_D t set VALIDFLAG='0',t.STATUS = '6',t.HEAT_NO='del' || t.HEAT_NO "
  4379. + " where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' and t.smp_no = '"+parmas.get("SMP_NO")+"' ";
  4380. mapper.updateJudgeStatus(upsql.toString());
  4381. //夹杂复样按炉
  4382. /*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")){
  4383. upsql= " update QCM_JHY_SAMPLE_CONSIGN_D t set t.HEAT_NO='del' || t.HEAT_NO "
  4384. + " where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' and t.smp_no = '"+parmas.get("SMP_NO")+"' ";
  4385. mapper.updateJudgeStatus(upsql.toString());
  4386. }*/
  4387. String strMemo = parmas.get("DESIGN_KEY").toString()+','+hmap.get(0).get("STEEL_CODE")+','+hmap.get(0).get("THICK")
  4388. +",取样编号:"+parmas.get("SPECIMEN_NO")+"频次:"+hmap.get(0).get("FREQ_CODE")+"原因:"+parmas.get("MEMO").toString();
  4389. QcmJudgeOperateLog qjog = new QcmJudgeOperateLog();
  4390. qjog.setOperate_name(parmas.get("USER_NAME").toString());
  4391. qjog.setBatchno(parmas.get("BATCH_NO") == null ?"":parmas.get("BATCH_NO").toString());
  4392. qjog.setOperate_type("一键删除委托");
  4393. qjog.setParams(parmas.get("MATERIAL_NO") == null ?"":parmas.get("MATERIAL_NO").toString());
  4394. qjog.setProd_line(parmas.get("PLINE_CODE") == null ?"":parmas.get("PLINE_CODE").toString());
  4395. qjog.setJudge_result(parmas.get("DESIGN_KEY") == null ?"":parmas.get("DESIGN_KEY").toString());
  4396. qjog.setMemo(strMemo);
  4397. mapper.insertQcmJudgeOperateLog(qjog);
  4398. sql=" select * from qcm_jhy_sample_consign_d t "
  4399. +" where t.smp_no = '"+parmas.get("SMP_NO")+"' and t.status <> '6' ";
  4400. List<HashMap> hmapwt=mapper.query(sql.toString());
  4401. if(hmapwt==null || hmapwt.size()<=0){
  4402. 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 "
  4403. + " where t.smp_no = '"+parmas.get("SMP_NO")+"' ";
  4404. mapper.updateJudgeStatus(upsql.toString());
  4405. }
  4406. } catch (Exception e) {
  4407. SqlSession.rollback();
  4408. SqlSession.close();
  4409. cro.setV_errCode(-1);
  4410. cro.setV_errMsg("一键删除失败!");
  4411. return cro;
  4412. }
  4413. SqlSession.commit();
  4414. SqlSession.close();
  4415. return cro;
  4416. }
  4417. //修改LRA
  4418. public CoreReturnObject UPZHBLRA(HashMap parmas) throws Exception {
  4419. try {
  4420. //查询出系统默认指定的样数据
  4421. String sql="select * from qcm_jhy_sample_consign_d t where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' ";
  4422. List<HashMap> hmap=mapper.query(sql.toString());
  4423. if(hmap==null || hmap.size()<=0){
  4424. cro.setV_errCode(-1);
  4425. cro.setV_errMsg("未找到相应修改数据!");
  4426. return cro;
  4427. }
  4428. String special_quote_memo = hmap.get(0).get("SPECIAL_QUOTE_MEMO").toString();
  4429. String BATCH_NO = hmap.get(0).get("BATCH_NO").toString();
  4430. //查询出修改的数据
  4431. sql="";
  4432. sql="select * from qcm_jhy_sample_consign_d t where t.specimen_no = '"+parmas.get("SPECIMEN_NO_CK")+"' ";
  4433. List<HashMap> hmLAR=mapper.query(sql.toString());
  4434. if(hmLAR==null || hmLAR.size()<=0){
  4435. cro.setV_errCode(-1);
  4436. cro.setV_errMsg("未找到相应修改数据!");
  4437. return cro;
  4438. }
  4439. String BATCH_NO_CK=hmLAR.get(0).get("BATCH_NO").toString();//人工指定的轧批号
  4440. String SPECIMEN_NO_CK=parmas.get("SPECIMEN_NO_CK").toString();//人工指定的取样编号
  4441. String MATERIAL_NO_CK=hmLAR.get(0).get("MATERIAL_NO").toString();
  4442. String PLINE_CODE_CK=hmLAR.get(0).get("PLINE_CODE").toString();
  4443. String DESIGN_KEY_CK=hmLAR.get(0).get("DESIGN_KEY").toString();
  4444. //开始修改人工指定的轧批
  4445. 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")+"' ";
  4446. mapper.updateJudgeStatus(updateD.toString());
  4447. String updateI = " update qcm_jhy_sample_consign_d_item t "
  4448. +" set QUOTE_SPECIMEN_NO= '',QUOTE_SEQ = '',QUOTE_MEMO='', MEMOLAR='' "
  4449. +" where t.SPECIMEN_NO='"+parmas.get("SPECIMEN_NO_CK")+"' and t.PHY_CODE_L = 'HC' ";
  4450. mapper.updateJudgeStatus(updateI.toString());
  4451. //清空默认指定的轧批D表
  4452. updateD="";
  4453. updateD= " update QCM_JHY_SAMPLE_CONSIGN_D t set t.SPECIAL_QUOTE_MEMO = '' where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' ";
  4454. mapper.updateJudgeStatus(updateD.toString());
  4455. //只要是还没有判定的就换成指定的引用轧批
  4456. sql="";
  4457. sql="select i.* from qcm_jhy_sample_consign_d t,qcm_jhy_sample_consign_d_item i "
  4458. +" where t.specimen_no = i.specimen_no and t.status != '3' "
  4459. +" and (i.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' or i.quote_specimen_no = '"+parmas.get("SPECIMEN_NO")+"') "
  4460. +" and i.Phy_Code_l = 'HC' ";
  4461. List<HashMap> hmitem=mapper.query(sql.toString());
  4462. if(hmitem!=null && hmitem.size()>=1){
  4463. TreeSet<String> specimenNo=new TreeSet<String>();//取样编号
  4464. for (int i = 0; i < hmitem.size(); i++) {
  4465. HashMap obj=hmitem.get(i);
  4466. specimenNo.add((String)obj.get("SPECIMEN_NO"));
  4467. }
  4468. //循环改值
  4469. for(String str : specimenNo){
  4470. String updateItem= " update qcm_jhy_sample_consign_d_item t "
  4471. +" set QUOTE_SPECIMEN_NO= '"+SPECIMEN_NO_CK+"',QUOTE_MEMO='已引用'||'"+SPECIMEN_NO_CK+"', "
  4472. + " MEMOLAR='加项项目已引用'||'"+BATCH_NO_CK+"' "
  4473. +" where t.SPECIMEN_NO='"+str+"' and t.PHY_CODE_L = 'HC' ";
  4474. mapper.updateJudgeStatus(updateItem.toString());
  4475. }
  4476. }
  4477. String strMemo = BATCH_NO+"修改成"+BATCH_NO_CK+"送样,取样编号:"+SPECIMEN_NO_CK;
  4478. QcmJudgeOperateLog qjog = new QcmJudgeOperateLog();
  4479. qjog.setOperate_name(parmas.get("USER_NAME").toString());
  4480. qjog.setBatchno(BATCH_NO_CK);
  4481. qjog.setOperate_type("修改LRA");
  4482. qjog.setParams(MATERIAL_NO_CK);
  4483. qjog.setProd_line(PLINE_CODE_CK);
  4484. qjog.setJudge_result(DESIGN_KEY_CK);
  4485. qjog.setMemo(strMemo);
  4486. mapper.insertQcmJudgeOperateLog(qjog);
  4487. } catch (Exception e) {
  4488. SqlSession.rollback();
  4489. SqlSession.close();
  4490. cro.setV_errCode(-1);
  4491. cro.setV_errMsg("修改失败!");
  4492. return cro;
  4493. }
  4494. SqlSession.commit();
  4495. SqlSession.close();
  4496. return cro;
  4497. }
  4498. //预测换样
  4499. public CoreReturnObject doForecastRZ(HashMap parmas) throws Exception {
  4500. try {
  4501. 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")+"' "
  4502. +" and t.rz_roll_mana_no is not null and t.status = '3' and rownum = 1";
  4503. List<HashMap> hmap=mapper.query(sql.toString());
  4504. if(hmap==null || hmap.size()<=0){
  4505. cro.setV_errCode(-1);
  4506. cro.setV_errMsg("未找到相应数据!");
  4507. return cro;
  4508. }
  4509. String RZ_ROLL_MANA_NO = hmap.get(0).get("RZ_ROLL_MANA_NO").toString();//轧辊单元
  4510. String RZ_MIXROLL = hmap.get(0).get("RZ_MIXROLL").toString();//组批区间
  4511. String RZ_OLD_SAMPL_NO = hmap.get(0).get("RZ_OLD_SAMPL_NO").toString();//预测抽样卷
  4512. String BATCH_NO = parmas.get("BATCH_NO").toString();//轧批号
  4513. String INSPECTION_LOT = hmap.get(0).get("INSPECTION_LOT").toString();//检验号
  4514. 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+"' "
  4515. +" and t.Rz_Old_Sampl_No = '"+RZ_OLD_SAMPL_NO+"' and t.batch_no <>'"+BATCH_NO+"' and t.pline_code = 'RZ1' ";
  4516. List<HashMap> hmap2=mapper.query(sql2.toString());
  4517. if(hmap2==null || hmap2.size()<=0){
  4518. cro.setV_errCode(-1);
  4519. cro.setV_errMsg("未找到相应预测数据!");
  4520. return cro;
  4521. }
  4522. for (int i = 0; i < hmap2.size(); i++) {
  4523. HashMap obj=hmap2.get(i);
  4524. String SMP_NO = obj.get("SMP_NO").toString();
  4525. String SPECIMEN_NO = obj.get("SPECIMEN_NO").toString();
  4526. //修改ORD表
  4527. 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+"' ";
  4528. mapper.updateJudgeStatus(ordUpSql.toString());
  4529. //修改D表
  4530. String dUpSql = " update qcm_jhy_sample_consign_d t set t.status = '0' ,t.send_id = '',t.send_name = '',t.send_time = '', "
  4531. + " t.RZ_ROLL_MANA_NO = '',t.rz_mixroll = '',t.Rz_Old_Sampl_No = '',t.RZ_ROLL_SLAB_SEQ = '',t.CONSIGN_NO = '', "
  4532. + " t.CONSIGN_NO_SEQ = '' where t.SPECIMEN_NO = '"+SPECIMEN_NO+"' ";
  4533. mapper.updateJudgeStatus(dUpSql.toString());
  4534. }
  4535. //修改D表
  4536. String dUpSql = " update qcm_jhy_sample_consign_d t set t.SEND_MEMO = '预测换样' where t.SPECIMEN_NO = '"+parmas.get("SPECIMEN_NO")+"' ";
  4537. mapper.updateJudgeStatus(dUpSql.toString());
  4538. //预测抽样第一次不合格清除
  4539. String millUpSql = "update tbf02_spec_mill t set MIXROLL='' where t.COIL_NO in ( "
  4540. +" select COIL_NO from tbh02_coil_comm c where c.OLD_SAMPL_NO like '"+BATCH_NO+"%' )";
  4541. mapper.updateJudgeStatus(millUpSql.toString());
  4542. //查询预测下的所有子板
  4543. String coilSelSql="select t.pic_is_lock,t.inspection_lot,t.COIL_NO from qcm_judge_coil_result t "
  4544. +" where t.INSPECTION_LOT = '"+INSPECTION_LOT+"' and t.COIL_NO not like '"+BATCH_NO+"%' ";
  4545. List<HashMap> hmap3=mapper.query(coilSelSql.toString());
  4546. if(hmap3 != null && hmap3.size()>=1){
  4547. for (int i = 0; i < hmap3.size(); i++) {
  4548. HashMap obj=hmap3.get(i);
  4549. String COIL_NO = obj.get("COIL_NO").toString();//子板号
  4550. //异常处理界面解锁
  4551. String lockUpSql="update qcm_judge_locking a set a.unlock_type_code = '9', a.unlock_type_desc = '解除' "
  4552. +" where MATERIAL_NO ='"+COIL_NO+"' and unlock_type_code is null and lock_type_code = 'P' ";
  4553. mapper.updateJudgeStatus(lockUpSql.toString());
  4554. //热轧库存表解锁
  4555. String coilUpSql="UPDATE qcm_judge_coil_result T SET T.PIC_IS_LOCK = '0' where t.COIL_NO = '"+COIL_NO+"' ";
  4556. mapper.updateJudgeStatus(coilUpSql.toString());
  4557. }
  4558. }
  4559. QcmJudgeOperateLog qjog = new QcmJudgeOperateLog();
  4560. qjog.setOperate_name(parmas.get("USER_NAME").toString());
  4561. qjog.setBatchno(BATCH_NO);
  4562. qjog.setOperate_type("热轧预测换样");
  4563. qjog.setParams(RZ_OLD_SAMPL_NO);
  4564. qjog.setProd_line("RZ1");
  4565. qjog.setMemo(RZ_ROLL_MANA_NO+":"+RZ_MIXROLL+":"+BATCH_NO +":"+parmas.get("SPECIMEN_NO").toString());
  4566. mapper.insertQcmJudgeOperateLog(qjog);
  4567. } catch (Exception e) {
  4568. SqlSession.rollback();
  4569. SqlSession.close();
  4570. cro.setV_errCode(-1);
  4571. cro.setV_errMsg("预测换样失败!");
  4572. return cro;
  4573. }
  4574. SqlSession.commit();
  4575. SqlSession.close();
  4576. return cro;
  4577. }
  4578. //重置船检编号
  4579. public CoreReturnObject upShipInspec(HashMap parmas) throws Exception {
  4580. try {
  4581. String cic= parmas.get("CERT_INST_CODE").toString();
  4582. String uid= parmas.get("USERID").toString();
  4583. String una= parmas.get("USERNAME").toString();
  4584. // String YYMM= parmas.get("YYMM").toString();
  4585. String upsql="update QCM_JHY_SHIP_INSPEC t set t.yn_log = '0' where t.Cert_Inst_Code = '"+cic+"' ";
  4586. mapper.updateJudgeStatus(upsql.toString());
  4587. String insql = "insert into qcm_jhy_ship_inspec "
  4588. +" (cert_inst_code, cert_inst_name, pline_code, yymm,create_id, create_name, fh_log) "
  4589. +" select t.cert_inst_code,t.cert_inst_name,t.pline_code,to_char(sysdate,'yymm'), "
  4590. +" '"+uid+"','"+una+"',t.fh_log from qcm_jhy_ship_inspec t where t.Cert_Inst_Code = '"+cic+"' and rownum = 1 ";
  4591. mapper.insert(insql);
  4592. /*SimpleDateFormat sdf = new SimpleDateFormat("yyMM");
  4593. String syh = sdf.format(new Date());
  4594. String syh1=syh;*/
  4595. String FH_LOG= parmas.get("FH_LOG").toString();//缩写
  4596. // syh+=FH_LOG;
  4597. /* if(!YYMM.equals(syh1)){
  4598. YYMM+=FH_LOG;
  4599. 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') ";
  4600. mapper.updateJudgeStatus(uplog.toString());
  4601. }*/
  4602. 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') ";
  4603. mapper.updateJudgeStatus(uplog.toString());
  4604. SqlSession.commit();
  4605. } catch (Exception e) {
  4606. SqlSession.rollback();
  4607. SqlSession.close();
  4608. cro.setV_errCode(-1);
  4609. cro.setV_errMsg("重置失败!");
  4610. return cro;
  4611. }
  4612. cro.setV_errCode(1);
  4613. cro.setV_errMsg("重置成功!");
  4614. SqlSession.close();
  4615. return cro;
  4616. }
  4617. //新增螺纹钢牌号
  4618. public CoreReturnObject AddLWGSTEEL(HashMap parmas) throws Exception {
  4619. try {
  4620. String steel=parmas.get("STEEL").toString();
  4621. String userid=parmas.get("USERID").toString();
  4622. String username=parmas.get("USERNAME").toString();
  4623. String sql="SELECT (max(T.SEQ) + 1) SEQ FROM QCM_JHY_STEEL T ";
  4624. HashMap result=mapper.queryOne(sql.toString());
  4625. BigDecimal seq=BigDecimal.ZERO;
  4626. if (result!=null && result.get("SEQ")!=null ) {
  4627. seq=(BigDecimal)result.get("SEQ");
  4628. }
  4629. String insql = "insert into QCM_JHY_STEEL "
  4630. +" (SEQ, STEEL_NAME, REGULATION, CONTAIN,CREATE_ID, CREATE_NAME) "
  4631. +" VALUES ('"+seq+"','"+steel+"','1','0','"+userid+"','"+username+"')";
  4632. mapper.insert(insql);
  4633. SqlSession.commit();
  4634. } catch (Exception e) {
  4635. SqlSession.rollback();
  4636. SqlSession.close();
  4637. cro.setV_errCode(-1);
  4638. cro.setV_errMsg("增加失败!"+e.getMessage());
  4639. return cro;
  4640. }
  4641. cro.setV_errCode(1);
  4642. cro.setV_errMsg("增加成功");
  4643. SqlSession.close();
  4644. return cro;
  4645. }
  4646. //删除螺纹钢牌号
  4647. public CoreReturnObject delLWGSTEEL(HashMap parmas) throws Exception {
  4648. try {
  4649. String steel=parmas.get("STEEL").toString();
  4650. String userid=parmas.get("USERID").toString();
  4651. String username=parmas.get("USERNAME").toString();
  4652. String sql = "update QCM_JHY_STEEL t "
  4653. +" set t.yn_log = '0',t.delete_id='"+userid+"',t.delete_name='"+username+"',t.delete_time=sysdate "
  4654. +" where t.steel_name = '"+steel+"' ";
  4655. mapper.updateJudgeStatus(sql.toString());
  4656. SqlSession.commit();
  4657. } catch (Exception e) {
  4658. SqlSession.rollback();
  4659. SqlSession.close();
  4660. cro.setV_errCode(-1);
  4661. cro.setV_errMsg("增加失败!"+e.getMessage());
  4662. return cro;
  4663. }
  4664. cro.setV_errCode(1);
  4665. cro.setV_errMsg("增加成功");
  4666. SqlSession.close();
  4667. return cro;
  4668. }
  4669. }