| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213 |
- package com.jiaju.activity;
- import java.io.File;
- import java.io.IOException;
- import java.io.Serializable;
- import java.lang.ref.WeakReference;
- import java.util.ArrayList;
- import java.util.HashMap;
- import java.util.LinkedHashMap;
- import java.util.List;
- import org.json.JSONArray;
- import org.json.JSONException;
- import org.json.JSONObject;
- import com.jiaju.adapter.ProductClassifyAdapter;
- import com.jiaju.adapter.ReworkProcedureSpinnerAdapter;
- import com.jiaju.adapter.SwipeAdapter;
- import com.jiaju.model.DefectDeduction;
- import com.jiaju.model.DefectFines;
- import com.jiaju.model.DefectLocation;
- import com.jiaju.model.DefectNo;
- import com.jiaju.model.DutyPerson;
- import com.jiaju.model.ImagePath;
- import com.jiaju.model.ProductClassifyInfo;
- import com.jiaju.model.ProductDefectInfo;
- import com.jiaju.model.ProductionInfo;
- import com.jiaju.model.ResponsibilityProcedure;
- import com.jiaju.model.ReworkProcedureInfo;
- import com.jiaju.model.WorkNo;
- import com.jiaju.model.WorkType;
- import com.jiaju.net.OkAsyncHttpClient;
- import com.jiaju.net.WebClient;
- import com.jiaju.utils.CommonUtil;
- import com.jiaju.utils.Constants;
- import com.jiaju.utils.CustomToast;
- import com.jiaju.utils.Md5Utils;
- import com.jiaju.utils.PopupWindowCheckChoose;
- import com.jiaju.utils.PopupWindowCheckChoose.onEventLisenter;
- import com.jiaju.utils.ProcessDialogUtils;
- import com.jiaju.utils.ViewUtil;
- import com.jiaju.widget.DefectCommonPopMenu;
- import com.jiaju.widget.SwipeListView;
- import android.app.Activity;
- import android.app.Notification;
- import android.content.Context;
- import android.content.Intent;
- import android.content.SharedPreferences;
- import android.content.res.Configuration;
- import android.content.res.Resources;
- import android.os.Bundle;
- import android.os.Handler;
- import android.os.HandlerThread;
- import android.os.Message;
- import android.text.Editable;
- import android.text.InputFilter;
- import android.text.InputType;
- import android.text.Spanned;
- import android.text.TextUtils;
- import android.text.TextWatcher;
- import android.view.Gravity;
- import android.view.KeyEvent;
- import android.view.Menu;
- import android.view.MotionEvent;
- import android.view.View;
- import android.view.View.OnClickListener;
- import android.view.View.OnFocusChangeListener;
- import android.view.View.OnTouchListener;
- import android.view.inputmethod.EditorInfo;
- import android.view.inputmethod.InputMethodManager;
- import android.widget.AbsListView;
- import android.widget.AdapterView;
- import android.widget.Button;
- import android.widget.EditText;
- import android.widget.ImageButton;
- import android.widget.ImageView;
- import android.widget.LinearLayout;
- import android.widget.PopupWindow;
- import android.widget.RelativeLayout;
- import android.widget.Spinner;
- import android.widget.TextView;
- import android.widget.Toast;
- /**
- * 质量登记
- *
- * @author wangyingjie
- *
- */
- public class CheckCollectModifyActivity extends Activity {
- private EditText barcode;
- private String accountCode;
- private static String checkCollectModify_userCode;
- private String password;
- private String sessionkey;
- private SharedPreferences preferences;
- private String ServerAddress_ip;
- private String ServerAddress_duankou;
- private HandlerThread thread;
- private Handler mHandler;
- private WebClient client = null;
- private ReworkProcedureSpinnerAdapter adapterReWorkProcedure;
- private List<ReworkProcedureInfo> listReWorkProcedure = null;// 跳转信息列表
- private int proId;
- private ProductionInfo productionInfo;
- private Button save;
- private ImageButton backBtn;
- private TextView back;
- private Spinner gotoSpin;
- private TextView productNumber;
- private TextView productCode, productName;
- private SwipeAdapter mAdapter;
- private int defectflag = 1;
- private List<ProductClassifyInfo> listProductClassify = null;
- private List<ProductClassifyInfo> listCheckLeak = null;// 漏气数据源
- private List<ProductClassifyInfo> listCheckNourishingWater = null;// 养水数据源
- private List<ProductClassifyInfo> listCheckNourishingWaterPosition = null;// 养水不合格位置数据源
- private List<ProductClassifyInfo> listCheckWaterTest = null;// 试水数据源
- private List<ProductClassifyInfo> listCheckWaterTestPosition = null;// 试水不合格位置数据源
- private List<ProductClassifyInfo> listCheckRepairCrackPosition = null;// 补裂位置数据源
- private List<ProductClassifyInfo> listCheckOfflineIdentificatio = null;// 下标划线数据源
- private List<ProductClassifyInfo> list_null = new ArrayList<ProductClassifyInfo>();// 空数据源
- private String defectLocation;
- private Spinner classifySpin;
- private Spinner check_leak;// 漏气
- private Spinner check_nourishing_water;// 养水
- private Spinner check_nourishing_water_position;// 养水不合格位置
- private Spinner check_water_test;// 试水
- private Spinner check_grinding_test;// 修磨
- private Spinner check_water_test_position;// 试水不合格位置
- private Spinner check_offline_identificatio;// 下线标识
- private TextView check_repair_crack_position;// 补裂位置
- private LinearLayout lay_check_repair_crack_position;// 补裂位置布局
- private ProductClassifyInfo classifyInfo = null;
- private ProductClassifyAdapter adapterProductClassify;
- private ProductClassifyAdapter adapterCheckLeak;// 漏气适配器
- private ProductClassifyAdapter adapterCheckNourishingWater;// 养水适配器
- private ProductClassifyAdapter adapterCheckNourishingWaterPosition;// 养水不合格位置适配器
- private ProductClassifyAdapter adapterCheckOfflineIdentificatio;// 下标划线适配器
- private ProductClassifyAdapter adapterCheckWaterTest;// 试水适配器
- private ProductClassifyAdapter adapterCheckWaterTestPosition;// 试水不合格位置适配器
- private ProductClassifyAdapter adapterCheckRepairCrackPositionPosition;// 补裂位置适配器
- private Button recordBug;// 记录缺陷按钮
- private SwipeListView mListView;
- private int modelType;
- int productionDataId;
- private EditText worknoEdt;
- private int collectType; // 采集类型:1-集中 2-单点
- private int nodeType;
- private TextView title;
- private boolean worknovalid;
- private boolean defectnovalid;
- private String userID = "";// 条码对应的产品ID
- private String worknouserCode;
- private boolean produceCodeIsValid = false;
- private String out_goodsID;
- private String out_goodsCode;
- private String out_goodsName;
- private String out_groutingUserCode;
- private String operationFlag;
- private String workNoName;
- private EditText bugnotxt;
- private String defectno;
- private DefectNo defectNo;
- private int defectId;
- private String defectName;
- private TextView bugnametxt;
- private EditText loctxt;
- private boolean defectlocationvalid;
- private DefectLocation dl;
- private boolean refineflag;
- private TextView refineEdt;
- private ImageView checkCollectModify;
- private boolean repairFlag;
- private TextView repairEdt;
- private LinearLayout repairLay;
- private ImageView productRecord;
- private RelativeLayout parent;
- private PopupWindow mPopupWindow; // 弹出框
- private int refire;
- private String refireName;
- private String specialRepairFlag;
- private String specialRepairFlagName;
- private List<WorkNo> worknolist = null;
- public View footerdivider;
- public Object obj = new Object();
- private boolean dryRepairFlag = false;
- private ReworkProcedureInfo reworkProcedureInfo;
- private String timestamp;
- private TextView trademarkNameTxt;
- private TextView tvLeak;
- private TextView tvInternalLeak;
- private TextView tvPassBall;
- private String user;
- private boolean overdueFlag = false;
- private String checkTime;
- private String remarks;
- private EditText memoEdt;
- private TextView tvLocName;
- private Handler h = new Handler();
- private ExceptionHandler exceptionHandler = new ExceptionHandler(this);
- private SaveValidHandler saveValidHandler = new SaveValidHandler(this);
- private ResultHandler handler = new ResultHandler(this);
- private Handler barcodeUpperH = new Handler();
- private String barcodeUpper;
- private String checkFlag = "1";
- private boolean deleteFlag;
- private int originalGoodsLevelTypeId;
- private static String repeatFlag = "";
- private List<ProductDefectInfo> productBugList = new ArrayList<ProductDefectInfo>();
- private OkAsyncHttpClient mClient;
- private String GOODSMODELforCheck = "";// 判断产品 是大件还是小件 通过扫描barcode BAR_CODE_VALID获得
- private String RECYCLINGFLAG = "";
- private String webServerAddress_port;
- private ArrayList<String> mList = new ArrayList();
- private PopupWindowCheckChoose mPopup;
- private String mCheckRepairCrackPositionDate = "";
- private ProductClassifyInfo check_offline_identificatioInfo;
- private LinearLayout llay_cold_repair_category;// 冷补类别
- private Spinner check_cold_repair_category;// 冷补类别
- private List<ProductClassifyInfo> listCheckColdRepairCategory = null;// 冷补类别
- private ProductClassifyAdapter adapterCheckColdRepairCategory;// 冷补类别适配器
- private List<ProductClassifyInfo> listCheckGrinding = null;// 修磨数据源
- private ProductClassifyAdapter adapterCheckGrinding;// 修磨适配器
- private static String Mout_ReworkProcedureId = "";
- private static String refireflag = "";
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.update_check_collect);
- initView();
- Bundle b = getIntent().getExtras();
- String procedureName = b.getString("ProcedureName");
- proId = b.getInt("procedureId");
- modelType = b.getInt("modelType");
- collectType = b.getInt("collectType");
- procedureName = b.getString("procedureName");
- nodeType = b.getInt("nodeType");
- title.setText(procedureName);// 设置标题
- gotoSpin.setEnabled(false);
- preferences = getSharedPreferences("user", Context.MODE_PRIVATE);
- ServerAddress_ip = preferences.getString("ServerAddress_ip", "");
- mClient = OkAsyncHttpClient.getInstance(CheckCollectModifyActivity.this);
- ServerAddress_duankou = preferences.getString("ServerAddress_duankou", "");
- // webServerAddress_port = preferences.getString("WebServerAddress_port", "");
- webServerAddress_port = "9001";
- accountCode = preferences.getString("AccountCode", "");
- checkCollectModify_userCode = preferences.getString("UserCode", "");
- password = preferences.getString("UserPassword", "");
- sessionkey = preferences.getString("SessionKey", "");
- CommonUtil.BarcodeMaxLength(barcode, 50);
- if (collectType == 1) {
- worknoEdt.setSelectAllOnFocus(true);
- worknoEdt.setFocusable(true);
- worknoEdt.requestFocus();
- worknoEdt.findFocus();
- }
- repeatFlag = System.currentTimeMillis() + "-" + checkCollectModify_userCode;
- // 标题包含漏气 漏气就能点击 包含养水 养水就能点击 包含试水 试水 就能点击
- // 养水或者 试水不合格 那对应的 不合格位置 就会放开 否则就会 禁止点击
- check_leak.setEnabled(false);// 漏气
- check_nourishing_water.setEnabled(false);// 养水
- check_water_test.setEnabled(false);// 试水
- lay_check_repair_crack_position.setEnabled(false);// 补裂位置
- if (title.getText().toString().indexOf("漏气") != -1) {
- check_leak.setEnabled(true);// 漏气
- } else if (title.getText().toString().indexOf("养水") != -1) {
- check_nourishing_water.setEnabled(true);// 养水
- } else if (title.getText().toString().indexOf("试水") != -1) {
- check_water_test.setEnabled(true);// 试水
- } else if (title.getText().toString().indexOf("补裂") != -1) {// 放开补裂位置控件权限
- lay_check_repair_crack_position.setEnabled(true);// 补裂位置
- } else if (proId == 125) {// 三车间 三检 放开下线标识控件权限
- check_offline_identificatio.setEnabled(true); // 下线标识
- }
- if ((proId == 125) || (proId == 131)) { // todo 三检 的时候 增加 冷补类别 -- 外观: 冷补返工为冷补确认, --功能: 冷补返工为冷补交接 --注:
- // 产品等级选择为冷补后,必须选择[冷补类别]
- // llay_cold_repair_category.setVisibility(View.VISIBLE);
- }
- if (proId == 157 ) { //修模进
- check_leak.setEnabled(true);// 漏气
- }
- if (proId == 123 || proId == 157) { // 修模 养水 进
- classifySpin.setEnabled(false);
- }
- check_nourishing_water_position.setEnabled(false);
- check_water_test_position.setEnabled(false);
- AllListeners();
- }
- private void initView() {
- barcode = (EditText) findViewById(R.id.bar_code);
- barcode.setRawInputType(InputType.TYPE_CLASS_NUMBER);
- footerdivider = findViewById(R.id.footerdivider);
- repairEdt = (TextView) findViewById(R.id.repairtxt);
- backBtn = (ImageButton) findViewById(R.id.left_img);
- checkCollectModify = (ImageView) findViewById(R.id.modifyid);
- recordBug = (Button) findViewById(R.id.check_record_bug);
- save = (Button) findViewById(R.id.check_save);
- back = (TextView) findViewById(R.id.back);
- classifySpin = (Spinner) findViewById(R.id.check_classify);
- productNumber = (TextView) findViewById(R.id.check_product_number);
- productCode = (TextView) findViewById(R.id.check_product_code);
- productName = (TextView) findViewById(R.id.check_product_name);
- tvLeak = (TextView) findViewById(R.id.tvLeak);
- tvInternalLeak = (TextView) findViewById(R.id.tvInternalLeak);
- tvLocName = (TextView) findViewById(R.id.tvLocName);
- tvPassBall = (TextView) findViewById(R.id.tvPassBall);
- mListView = (SwipeListView) findViewById(R.id.listview);
- trademarkNameTxt = (TextView) findViewById(R.id.trademarkName);
- memoEdt = (EditText) findViewById(R.id.memoEdt);
- memoEdt.setOnTouchListener(new OnTouchListener() {
- public boolean onTouch(View view, MotionEvent event) {
- if (view.getId() == R.id.memoEdt) {
- view.getParent().requestDisallowInterceptTouchEvent(true);
- switch (event.getAction() & MotionEvent.ACTION_MASK) {
- case MotionEvent.ACTION_UP:
- view.getParent().requestDisallowInterceptTouchEvent(false);
- break;
- }
- }
- return false;
- }
- });
- title = (TextView) findViewById(R.id.title);
- gotoSpin = (Spinner) findViewById(R.id.check_goto_job);
- check_leak = (Spinner) findViewById(R.id.check_leak);// 漏气
- check_nourishing_water = (Spinner) findViewById(R.id.check_nourishing_water);// 养水
- check_nourishing_water_position = (Spinner) findViewById(R.id.check_nourishing_water_position);// 养水不合格位置
- check_water_test = (Spinner) findViewById(R.id.check_water_test);// 试水
- check_grinding_test = (Spinner) findViewById(R.id.check_grinding_test);// 修磨
- check_offline_identificatio = (Spinner) findViewById(R.id.check_offline_identificatio);// 下线标识
- check_water_test_position = (Spinner) findViewById(R.id.check_water_test_position);// 试水不合格位置
- lay_check_repair_crack_position = (LinearLayout) findViewById(R.id.lay_check_repair_crack_position);// 补裂位置
- // 注册补裂位置控件
- check_repair_crack_position = (TextView) findViewById(R.id.tv_check_repair_crack_position);// 补裂位置 注册补裂位置控件
- worknoEdt = (EditText) findViewById(R.id.user_code);
- bugnotxt = (EditText) findViewById(R.id.bugnotxt);
- bugnotxt.setRawInputType(InputType.TYPE_CLASS_NUMBER);
- bugnametxt = (TextView) findViewById(R.id.bugnametxt);
- loctxt = (EditText) findViewById(R.id.loctxt);
- loctxt.setRawInputType(InputType.TYPE_CLASS_NUMBER);
- refineEdt = (TextView) findViewById(R.id.refinetxt);
- repairLay = (LinearLayout) findViewById(R.id.repairlay);
- productRecord = (ImageView) findViewById(R.id.search);
- productRecord.setVisibility(View.VISIBLE);
- parent = (RelativeLayout) findViewById(R.id.parentRel);
- // 冷补类别
- llay_cold_repair_category = (LinearLayout) findViewById(R.id.llay_cold_repair_category);
- check_cold_repair_category = (Spinner) findViewById(R.id.check_cold_repair_category);// 冷补类别
- mPopup = new PopupWindowCheckChoose(this, mList);
- }
- private void AllListeners() {
- // LoadRunnable 上来就调用 给 漏气 养水 养水不合格位置 试水 试水不合格位置 提供数据源
- // start -----------------
- thread = new HandlerThread("trademarkThread", 5);
- thread.start();
- mHandler = new Handler(thread.getLooper());
- LoadRunnable loadRunnable = new LoadRunnable();
- mHandler.post(loadRunnable);
- // end -----------------
- switch (collectType) {
- case 1:
- worknoEdt.setOnFocusChangeListener(new OnFocusChangeListener() {
- @Override
- public void onFocusChange(View v, boolean hasFocus) {
- JSONObject jsonObject = null;
- EditText e = (EditText) v;
- String workno = e.getText().toString();
- if (!workno.contains("\n")) {
- workno = workno.trim();
- if (!hasFocus) {
- if (!TextUtils.isEmpty(workno)) {
- ProcessDialogUtils.showProcessDialog(CheckCollectModifyActivity.this);
- worknoEdt.setEnabled(false);
- worknoEdt.setFocusable(false);
- worknoEdt.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start, int end, Spanned dest,
- int dstart, int dend) {
- return source.length() < 1 ? dest.subSequence(dstart, dend) : "";
- }
- } });
- barcode.setEnabled(false);
- barcode.setFocusable(false);
- barcode.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start, int end, Spanned dest,
- int dstart, int dend) {
- return source.length() < 1 ? dest.subSequence(dstart, dend) : "";
- }
- } });
- bugnotxt.setEnabled(false);
- bugnotxt.setFocusable(false);
- bugnotxt.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start, int end, Spanned dest,
- int dstart, int dend) {
- return source.length() < 1 ? dest.subSequence(dstart, dend) : "";
- }
- } });
- loctxt.setEnabled(false);
- loctxt.setFocusable(false);
- loctxt.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start, int end, Spanned dest,
- int dstart, int dend) {
- return source.length() < 1 ? dest.subSequence(dstart, dend) : "";
- }
- } });
- memoEdt.setEnabled(false);
- memoEdt.setFocusable(false);
- memoEdt.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start, int end, Spanned dest,
- int dstart, int dend) {
- return source.length() < 1 ? dest.subSequence(dstart, dend) : "";
- }
- } });
- try {
- jsonObject = new JSONObject();
- jsonObject.put("accountCode", accountCode);
- jsonObject.put("userCode", checkCollectModify_userCode);
- jsonObject.put("userPassword", password);
- jsonObject.put("sessionKey", sessionkey);
- // 生产工号检验请求数据
- jsonObject.put("procedureID", proId);// 工序ID,菜单页面传过来的
- jsonObject.put("procedureUserCode", workno);// 生产工号
- thread = new HandlerThread("userThread", 5);
- thread.start();
- mHandler = new Handler(thread.getLooper());
- UserRunnable userRunnable = new UserRunnable(jsonObject);
- mHandler.post(userRunnable);
- } catch (JSONException e1) {
- e1.printStackTrace();
- }
- }
- }
- }
- }
- }
- );
- worknoEdt.addTextChangedListener(new TextWatcher() {
- @Override
- public void afterTextChanged(Editable arg0) {
- if (worknoEdt.getText().toString().contains("\n")) {
- String workno = worknoEdt.getText().toString().trim().replaceAll("\\n", "");
- if (!TextUtils.isEmpty(workno)) {
- ProcessDialogUtils.showProcessDialog(CheckCollectModifyActivity.this);
- worknoEdt.setEnabled(false);
- worknoEdt.setFocusable(false);
- worknoEdt.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start, int end, Spanned dest,
- int dstart, int dend) {
- return source.length() < 1 ? dest.subSequence(dstart, dend) : "";
- }
- } });
- barcode.setEnabled(false);
- barcode.setFocusable(false);
- barcode.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start, int end, Spanned dest,
- int dstart, int dend) {
- return source.length() < 1 ? dest.subSequence(dstart, dend) : "";
- }
- } });
- bugnotxt.setEnabled(false);
- bugnotxt.setFocusable(false);
- bugnotxt.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start, int end, Spanned dest,
- int dstart, int dend) {
- return source.length() < 1 ? dest.subSequence(dstart, dend) : "";
- }
- } });
- loctxt.setEnabled(false);
- loctxt.setFocusable(false);
- loctxt.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start, int end, Spanned dest,
- int dstart, int dend) {
- return source.length() < 1 ? dest.subSequence(dstart, dend) : "";
- }
- } });
- memoEdt.setEnabled(false);
- memoEdt.setFocusable(false);
- memoEdt.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start, int end, Spanned dest,
- int dstart, int dend) {
- return source.length() < 1 ? dest.subSequence(dstart, dend) : "";
- }
- } });
- JSONObject sendJsonHead = new JSONObject();
- try {
- sendJsonHead.put("accountCode", accountCode);
- sendJsonHead.put("userCode", checkCollectModify_userCode);
- sendJsonHead.put("userPassword", password);
- sendJsonHead.put("sessionKey", sessionkey);
- // 生产工号检验请求数据
- sendJsonHead.put("procedureID", proId);// 工序ID,菜单页面传过来的
- sendJsonHead.put("procedureUserCode", workno);// 生产工号
- thread = new HandlerThread("userThread", 5);
- thread.start();
- mHandler = new Handler(thread.getLooper());
- UserRunnable userRunnable = new UserRunnable(sendJsonHead);
- mHandler.post(userRunnable);
- } catch (JSONException e1) {
- e1.printStackTrace();
- }
- }
- }
- }
- @Override
- public void beforeTextChanged(CharSequence s, int start, int count, int after) {
- }
- @Override
- public void onTextChanged(CharSequence s, int start, int before, int count) {
- user = worknoEdt.getText().toString();
- // 判断输入的文字是否是小写
- for (int i = 0; i < user.length(); i++) {
- if (user.charAt(i) - 0 >= 97 && user.charAt(i) - 0 <= 122) {
- h.postDelayed(UpperCase, 300);
- }
- }
- }
- });
- break;
- case 2:
- worknoEdt.setText(checkCollectModify_userCode);
- worknoEdt.setEnabled(false);
- worknoEdt.setFocusable(false);
- worknoEdt.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
- int dend) {
- return source.length() < 1 ? dest.subSequence(dstart, dend) : "";
- }
- } });
- JSONObject sendJsonHead = new JSONObject();
- try {
- sendJsonHead.put("accountCode", accountCode);
- sendJsonHead.put("userCode", checkCollectModify_userCode);
- sendJsonHead.put("userPassword", password);
- sendJsonHead.put("sessionKey", sessionkey);
- // 生产工号检验请求数据
- sendJsonHead.put("procedureID", proId);// 工序ID,菜单页面传过来的
- sendJsonHead.put("procedureUserCode", checkCollectModify_userCode);// 生产工号
- } catch (JSONException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- ProcessDialogUtils.showProcessDialog(CheckCollectModifyActivity.this);
- thread = new HandlerThread("userThread", 5);
- thread.start();
- mHandler = new Handler(thread.getLooper());
- UserRunnable userRunnable = new UserRunnable(sendJsonHead);
- mHandler.post(userRunnable);
- break;
- }
- lay_check_repair_crack_position.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- mPopup.showPop(check_repair_crack_position);
- }
- });
- bugnotxt.setOnEditorActionListener(new TextView.OnEditorActionListener() {
- @Override
- public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
- if (actionId == EditorInfo.IME_ACTION_NEXT) {
- ProcessDialogUtils.showProcessDialog(CheckCollectModifyActivity.this);
- defectno = bugnotxt.getText().toString().trim();
- if (!TextUtils.isEmpty(defectno)) {
- thread = null;
- thread = new HandlerThread("bugnoThread", 5);
- thread.start();
- mHandler = new Handler(thread.getLooper());
- mHandler.post(bugnoRunnable);
- } else {
- Toast.makeText(getApplicationContext(), "缺陷号不能为空", Toast.LENGTH_SHORT).show();
- ProcessDialogUtils.closeProgressDilog();
- bugnotxt.setFocusable(true);
- bugnotxt.requestFocus();
- return true;
- }
- }
- return true;
- }
- });
- bugnotxt.addTextChangedListener(new TextWatcher() {
- @Override
- public void onTextChanged(CharSequence s, int start, int before, int count) {
- }
- @Override
- public void beforeTextChanged(CharSequence s, int start, int count, int after) {
- }
- @Override
- public void afterTextChanged(Editable s) {
- defectnovalid = false;
- }
- });
- productRecord.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- int height = parent.getHeight() - v.getHeight();
- DefectCommonPopMenu recordPopMenu = new DefectCommonPopMenu(CheckCollectModifyActivity.this, height);
- mPopupWindow = recordPopMenu.getMenu();
- if (mPopupWindow == null) {
- return;
- }
- if (mPopupWindow.isShowing()) {
- mPopupWindow.dismiss();
- return;
- }
- mPopupWindow.showAtLocation(parent, Gravity.BOTTOM, 0, 0);
- LinearLayout scanLay = (LinearLayout) recordPopMenu.menu.findViewById(R.id.scanlay);
- ImageView scanImg = (ImageView) recordPopMenu.menu.findViewById(R.id.scanimg);
- TextView scanTitle = (TextView) recordPopMenu.menu.findViewById(R.id.scantitle);
- scanTitle.setText("扫一扫");
- scanImg.setBackgroundResource(R.drawable.scan);
- scanLay.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- Intent openCameraIntent = new Intent(CheckCollectModifyActivity.this, CaptureActivity.class);
- startActivityForResult(openCameraIntent, 102);
- if (mPopupWindow.isShowing()) {
- mPopupWindow.dismiss();
- }
- }
- });
- }
- });
- loctxt.setOnEditorActionListener(new TextView.OnEditorActionListener() {
- @Override
- public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
- if (actionId == EditorInfo.IME_ACTION_GO) {
- defectLocation = loctxt.getText().toString().trim();
- if (!TextUtils.isEmpty(defectLocation)) {
- ProcessDialogUtils.showProcessDialog(CheckCollectModifyActivity.this);
- thread = null;
- thread = new HandlerThread("buglocationThread", 5);
- thread.start();
- mHandler = null;
- mHandler = new Handler(thread.getLooper());
- mHandler.post(bugLocationRunnable);
- return true;
- }
- else {
- ProcessDialogUtils.closeProgressDilog();
- Toast.makeText(getApplicationContext(), "缺陷位置不能为空", Toast.LENGTH_SHORT).show();
- loctxt.setFocusable(true);
- loctxt.requestFocus();
- return true;
- }
- }
- return true;
- }
- });
- loctxt.addTextChangedListener(new TextWatcher() {
- @Override
- public void onTextChanged(CharSequence s, int start, int before, int count) {
- }
- @Override
- public void beforeTextChanged(CharSequence s, int start, int count, int after) {
- }
- @Override
- public void afterTextChanged(Editable s) {
- defectlocationvalid = false;
- }
- });
- recordBug.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- ProductClassifyInfo classifyInfo = (ProductClassifyInfo) classifySpin.getSelectedItem();
- if (classifyInfo == null) {
- Toast.makeText(getApplicationContext(), "产品分级不能为空", Toast.LENGTH_SHORT).show();
- return;
- }
- int GoodsLevelTypeID = classifyInfo.getGoodsLevelTypeID();
- if (GoodsLevelTypeID == 4) {
- Toast.makeText(getApplicationContext(), "正品不能记录缺陷", Toast.LENGTH_SHORT).show();
- return;
- }
- String code = productNumber.getText().toString();
- if (TextUtils.isEmpty(code)) {
- Toast.makeText(getApplicationContext(), "产品条码信息不能为空", Toast.LENGTH_SHORT).show();
- return;
- }
- String productIsbn = productCode.getText().toString();
- if (TextUtils.isEmpty(productIsbn)) {
- Toast.makeText(getApplicationContext(), "产品编码不能为空", Toast.LENGTH_SHORT).show();
- return;
- }
- defectno = bugnotxt.getText().toString().trim();
- if (TextUtils.isEmpty(defectno)) {
- Toast.makeText(getApplicationContext(), "缺陷号不能为空", Toast.LENGTH_SHORT).show();
- bugnotxt.setFocusable(true);
- bugnotxt.requestFocus();
- return;
- } else {
- if (!defectnovalid) {
- Toast.makeText(getApplicationContext(), "请在缺陷号输入框内按回车键验证缺陷号", Toast.LENGTH_SHORT).show();
- bugnotxt.setFocusable(true);
- bugnotxt.requestFocus();
- return;
- }
- }
- defectLocation = loctxt.getText().toString().trim();
- if (TextUtils.isEmpty(defectLocation)) {
- Toast.makeText(getApplicationContext(), "缺陷位置不能为空", Toast.LENGTH_SHORT).show();
- loctxt.setFocusable(true);
- loctxt.requestFocus();
- return;
- } else {
- if (!defectlocationvalid) {
- Toast.makeText(getApplicationContext(), "请在缺陷位置输入框内按回车键验证缺陷位置", Toast.LENGTH_SHORT).show();
- loctxt.setFocusable(true);
- loctxt.requestFocus();
- return;
- }
- }
- // 如果该条产品已经有废品标志,再点击记录缺陷按钮,则传一个标志位为True,否则传false
- Bundle bundle = new Bundle();
- try {
- Intent intent = new Intent();
- // bundle.putInt("scrapflag", 0);
- bundle.putString("out_goodsID", String.valueOf(productionInfo.getGoodsId()));
- bundle.putString("out_goodsCode", productionInfo.getGoodsCode());
- bundle.putInt("proId", proId);
- bundle.putInt("modeltype", modelType);
- bundle.putString("repairFlag", specialRepairFlag);
- bundle.putString("barCode", productionInfo.getBarCode());
- bundle.putString("operationFlag", "add");
- bundle.putSerializable("defectNo", defectNo);
- bundle.putSerializable("defectLocation", dl);
- bundle.putSerializable("recyclingFlag", RECYCLINGFLAG);
- bundle.putSerializable("productBugList", (Serializable) productBugList);
- intent.putExtras(bundle);
- intent.setClass(CheckCollectModifyActivity.this, ProductBugActivity.class);
- startActivityForResult(intent, 100);
- } catch (Exception e) {
- }
- }
- });
- barcode.addTextChangedListener(new TextWatcher() {
- @Override
- public void afterTextChanged(Editable arg0) {
- if (barcode.getText().toString().contains("\n")) {
- String code = barcode.getText().toString().trim().replaceAll("\\n", "");
- String workno = worknoEdt.getText().toString();
- if (TextUtils.isEmpty(workno)) {
- Toast.makeText(getApplicationContext(), "生产工号不能为空", Toast.LENGTH_SHORT).show();
- worknoEdt.setEnabled(true);
- worknoEdt.setFocusable(true);
- worknoEdt.setFocusableInTouchMode(true);
- worknoEdt.requestFocus();
- worknoEdt.findFocus();
- worknoEdt.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start, int end, Spanned dest,
- int dstart, int dend) {
- return null;
- }
- } });
- return;
- } else {
- if (!worknovalid) {
- Toast.makeText(getApplicationContext(), "请先验证生产工号", Toast.LENGTH_SHORT).show();
- worknoEdt.setEnabled(true);
- worknoEdt.setFocusable(true);
- worknoEdt.setFocusableInTouchMode(true);
- worknoEdt.requestFocus();
- worknoEdt.findFocus();
- worknoEdt.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start, int end, Spanned dest,
- int dstart, int dend) {
- return null;
- }
- } });
- return;
- }
- }
- ProcessDialogUtils.showProcessDialog(CheckCollectModifyActivity.this);
- recordBug.setEnabled(true);
- overdueFlag = false;
- productNumber.setText("");
- memoEdt.setText("");
- productCode.setText("");
- productName.setText("");
- refineEdt.setText("");
- bugnotxt.setText("");
- bugnametxt.setText("");
- trademarkNameTxt.setText("");
- loctxt.setText("");
- repairEdt.setText("");
- tvLeak.setText("");
- tvInternalLeak.setText("");
- tvPassBall.setText("");
- if (classifySpin.getSelectedItem() != null) {
- listProductClassify.removeAll(listProductClassify);
- if (adapterProductClassify != null) {
- adapterProductClassify.notifyDataSetChanged();
- }
- }
- if (gotoSpin.getSelectedItem() != null) {
- listReWorkProcedure.clear();
- if (adapterReWorkProcedure != null) {
- adapterReWorkProcedure.notifyDataSetChanged();
- }
- }
- save.setVisibility(View.VISIBLE);
- if (productBugList != null && productBugList.size() > 0) {
- productBugList.removeAll(productBugList);
- if (mAdapter != null) {
- mAdapter.notifyDataSetChanged();
- }
- save.setText("保存(" + productBugList.size() + ")");
- }
- barcode.setEnabled(false);
- barcode.setFocusable(false);
- barcode.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
- int dend) {
- return source.length() < 1 ? dest.subSequence(dstart, dend) : "";
- }
- } });
- bugnotxt.setEnabled(false);
- bugnotxt.setFocusable(false);
- bugnotxt.setFocusableInTouchMode(false);
- bugnotxt.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
- int dend) {
- return source.length() < 1 ? dest.subSequence(dstart, dend) : "";
- }
- } });
- loctxt.setEnabled(false);
- loctxt.setFocusable(false);
- loctxt.setFocusableInTouchMode(false);
- loctxt.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
- int dend) {
- return source.length() < 1 ? dest.subSequence(dstart, dend) : "";
- }
- } });
- thread = new HandlerThread("barcodeThread", 5);
- thread.start();
- mHandler = new Handler(thread.getLooper());
- BarcodeRunnable barcodeRunnable = new BarcodeRunnable(code, obj);
- mHandler.post(barcodeRunnable);
- }
- }
- @Override
- public void beforeTextChanged(CharSequence s, int start, int count, int after) {
- }
- @Override
- public void onTextChanged(CharSequence s, int start, int before, int count) {
- barcodeUpper = barcode.getText().toString();
- // 判断输入的文字是否是小写
- for (int i = 0; i < barcodeUpper.length(); i++) {
- if (barcodeUpper.charAt(i) - 0 >= 97 && barcodeUpper.charAt(i) - 0 <= 122) {
- barcodeUpperH.postDelayed(BarcodeUpperCase, 300);
- }
- }
- }
- });
- barcode.setOnEditorActionListener(new TextView.OnEditorActionListener() {
- @Override
- public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
- if (actionId == EditorInfo.IME_ACTION_GO) {
- String workno = worknoEdt.getText().toString();
- if (TextUtils.isEmpty(workno)) {
- Toast.makeText(getApplicationContext(), "生产工号不能为空", Toast.LENGTH_SHORT).show();
- worknoEdt.setEnabled(true);
- worknoEdt.setFocusable(true);
- worknoEdt.setFocusableInTouchMode(true);
- worknoEdt.requestFocus();
- worknoEdt.findFocus();
- worknoEdt.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start, int end, Spanned dest,
- int dstart, int dend) {
- return null;
- }
- } });
- return true;
- } else {
- if (!worknovalid) {
- Toast.makeText(getApplicationContext(), "请先验证生产工号", Toast.LENGTH_SHORT).show();
- worknoEdt.setEnabled(true);
- worknoEdt.setFocusable(true);
- worknoEdt.setFocusableInTouchMode(true);
- worknoEdt.requestFocus();
- worknoEdt.findFocus();
- worknoEdt.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start, int end, Spanned dest,
- int dstart, int dend) {
- return null;
- }
- } });
- return true;
- }
- }
- String code = barcode.getText().toString().trim();
- if (!TextUtils.isEmpty(code)) {
- recordBug.setEnabled(true);
- overdueFlag = false;
- productNumber.setText("");
- productCode.setText("");
- productName.setText("");
- trademarkNameTxt.setText("");
- refineEdt.setText("");
- bugnotxt.setText("");
- memoEdt.setText("");
- bugnametxt.setText("");
- trademarkNameTxt.setText("");
- tvLeak.setText("");
- tvInternalLeak.setText("");
- tvPassBall.setText("");
- loctxt.setText("");
- repairEdt.setText("");
- if (classifySpin.getSelectedItem() != null) {
- listProductClassify.removeAll(listProductClassify);
- if (adapterProductClassify != null) {
- adapterProductClassify.notifyDataSetChanged();
- }
- }
- if (gotoSpin.getSelectedItem() != null) {
- listReWorkProcedure.clear();
- if (adapterReWorkProcedure != null) {
- adapterReWorkProcedure.notifyDataSetChanged();
- }
- }
- save.setVisibility(View.VISIBLE);
- if (productBugList != null && productBugList.size() > 0) {
- productBugList.removeAll(productBugList);
- if (mAdapter != null) {
- mAdapter.notifyDataSetChanged();
- }
- save.setText("保存(" + productBugList.size() + ")");
- }
- ProcessDialogUtils.showProcessDialog(CheckCollectModifyActivity.this);
- barcode.setEnabled(false);
- barcode.setFocusable(false);
- barcode.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start, int end, Spanned dest,
- int dstart, int dend) {
- return source.length() < 1 ? dest.subSequence(dstart, dend) : "";
- }
- } });
- bugnotxt.setEnabled(false);
- bugnotxt.setFocusable(false);
- bugnotxt.setFocusableInTouchMode(false);
- bugnotxt.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start, int end, Spanned dest,
- int dstart, int dend) {
- return source.length() < 1 ? dest.subSequence(dstart, dend) : "";
- }
- } });
- loctxt.setEnabled(false);
- loctxt.setFocusable(false);
- loctxt.setFocusableInTouchMode(false);
- loctxt.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start, int end, Spanned dest,
- int dstart, int dend) {
- return source.length() < 1 ? dest.subSequence(dstart, dend) : "";
- }
- } });
- // startTime= System.currentTimeMillis();
- thread = new HandlerThread("barcodeThread", 5);
- thread.start();
- mHandler = new Handler(thread.getLooper());
- BarcodeRunnable barcodeRunnable = new BarcodeRunnable(code, obj);
- mHandler.post(barcodeRunnable);
- return true;
- }
- }
- return true;
- }
- });
- back.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (productBugList != null && productBugList.size() > 0) {
- productBugList.removeAll(productBugList);
- }
- finish();
- }
- });
- backBtn.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (productBugList != null && productBugList.size() > 0) {
- productBugList.removeAll(productBugList);
- }
- finish();
- }
- });
- // 点击保存按钮
- save.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- try {
- String workno = worknoEdt.getText().toString();
- if (TextUtils.isEmpty(workno)) {
- Toast.makeText(getApplicationContext(), "生产工号不能为空", Toast.LENGTH_SHORT).show();
- worknoEdt.setEnabled(true);
- worknoEdt.setFocusable(true);
- worknoEdt.setFocusableInTouchMode(true);
- worknoEdt.requestFocus();
- worknoEdt.findFocus();
- worknoEdt.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start, int end, Spanned dest,
- int dstart, int dend) {
- return null;
- }
- } });
- return;
- } else {
- if (!worknovalid) {
- Toast.makeText(getApplicationContext(), "请先验证生产工号", Toast.LENGTH_SHORT).show();
- worknoEdt.setEnabled(true);
- worknoEdt.setFocusable(true);
- worknoEdt.setFocusableInTouchMode(true);
- worknoEdt.requestFocus();
- worknoEdt.findFocus();
- worknoEdt.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start, int end, Spanned dest,
- int dstart, int dend) {
- return null;
- }
- } });
- return;
- }
- }
- String code = productNumber.getText().toString();
- if (TextUtils.isEmpty(code)) {
- Toast.makeText(getApplicationContext(), "产品条码信息不能为空", Toast.LENGTH_SHORT).show();
- return;
- }
- String productIsbn = productCode.getText().toString();
- if (TextUtils.isEmpty(productIsbn)) {
- Toast.makeText(getApplicationContext(), "产品编码不能为空", Toast.LENGTH_SHORT).show();
- return;
- }
- ProductClassifyInfo classifyInfo = (ProductClassifyInfo) classifySpin.getSelectedItem();
- if (classifyInfo == null) {
- Toast.makeText(getApplicationContext(), "产品分级不能为空", Toast.LENGTH_SHORT).show();
- return;
- }
- ProductClassifyInfo check_leakInfo = (ProductClassifyInfo) check_leak.getSelectedItem();
- ProductClassifyInfo check_nourishing_waterInfo = (ProductClassifyInfo) check_nourishing_water
- .getSelectedItem();
- ProductClassifyInfo check_nourishing_water_positionInfo = (ProductClassifyInfo) check_nourishing_water_position
- .getSelectedItem();
- // 当养水不合格 的 时候要判断 养水不合格位置
- if ("不合格".equals(check_nourishing_waterInfo.getDefectFlagName())
- && check_nourishing_water_positionInfo == null) {
- Toast.makeText(getApplicationContext(), "养水不合格位置不能为空", Toast.LENGTH_SHORT).show();
- return;
- }
- ProductClassifyInfo check_water_testInfo = (ProductClassifyInfo) check_water_test.getSelectedItem();
- ProductClassifyInfo check_water_test_positionInfo = (ProductClassifyInfo) check_water_test_position
- .getSelectedItem();
- if (proId == 125) { // 三检 三车间
- check_offline_identificatioInfo = (ProductClassifyInfo) check_offline_identificatio
- .getSelectedItem();
- }
- // 当试水不合格 的 时候要判断 试水不合格位置
- if ("不合格".equals(check_water_testInfo.getDefectFlagName())
- && check_water_test_positionInfo == null) {
- Toast.makeText(getApplicationContext(), "试水不合格位置不能为空", Toast.LENGTH_SHORT).show();
- return;
- }
- // if (title.getText().toString().indexOf("补裂") != -1) {// 2023/3/14 当页面为补裂的时候 校验补裂位置选项
- // if ("".equals(mCheckRepairCrackPositionDate)) {
- // Toast.makeText(getApplicationContext(), "请选择补裂位置", Toast.LENGTH_SHORT).show();
- // return;
- // }
- // }
- int GoodsLevelTypeID = classifyInfo.getGoodsLevelTypeID();
- int GoodsLevelID = classifyInfo.getDefectFlagId();
- if (!(proId == 123 || proId == 157)) { // 养水 3#修模 不判断产品等级缺陷
- if (productBugList != null && productBugList.size() > 0) {
- if (classifyInfo.getGoodsLevelTypeID() == 4) {
- Toast.makeText(getApplicationContext(), "缺陷产品不能为正品", Toast.LENGTH_SHORT).show();
- return;
- }
- if (gotoSpin.getSelectedItem() == null && classifyInfo.getGoodsLevelTypeID() == 6) {
- Toast.makeText(getApplicationContext(), "返工工序不能为空", Toast.LENGTH_SHORT).show();
- return;
- }
- } else {
- if (classifyInfo.getGoodsLevelTypeID() > 4) {
- Toast.makeText(getApplicationContext(), "非正品需要选择缺陷", Toast.LENGTH_SHORT).show();
- return;
- }
- }
- }
- if (operationFlag.equals("modify")) {
- boolean isModify = false;
- if (productBugList != null && productBugList.size() > 0) {
- for (int i = 0; i < productBugList.size(); i++) {
- ProductDefectInfo defectInfo = productBugList.get(i);
- if (defectInfo.getDeleteFlag().equals("local")) {
- isModify = true;
- }
- }
- }
- if ("不合格".equals(check_leakInfo.getDefectFlagName())
- || "不合格".equals(check_nourishing_waterInfo.getDefectFlagName())
- || "不合格".equals(check_water_testInfo.getDefectFlagName())) {
- isModify = true;
- }
- // if (!check_leakInfo.getDefectFlagName().equals(productionInfo.getOut_LeakFlag1Name())) { // 判断漏气
- // // 数据是否改变
- // isModify = true;
- // }
- // if (!check_nourishing_waterInfo.getDefectFlagName()
- // .equals(productionInfo.getOut_LeakFlag4Name())) { // 判断养水 数据是否改变
- // isModify = true;
- // }
- // if (!check_water_testInfo.getDefectFlagName().equals(productionInfo.getOut_LeakFlag5Name())) { // 判断试水
- // // 数据是否改变
- // isModify = true;
- // }
- if (proId == 125) { // 三检 三车间
- if (!((check_offline_identificatioInfo.getDefectFlagId() + "")
- .equals(productionInfo.getOfflineFlag()))) { // 判断下线标识 数据是否改变
- isModify = true;
- }
- }
- if (proId != 157) { //不是修磨才进来判断,修磨不判断了
- if (classifyInfo.getGoodsLevelTypeID() != 16) { // 产品等级 是冷补的时候 不校验
- if ((!isModify) && (!deleteFlag) && (GoodsLevelTypeID == originalGoodsLevelTypeId)) {
- CustomToast.showToast(getApplicationContext(), "数据没有修改不能保存", 2000);
- return;
- }
- }
- }
- }
- reworkProcedureInfo = (ReworkProcedureInfo) gotoSpin.getSelectedItem();
- remarks = memoEdt.getText().toString();
- if (productBugList != null && productBugList.size() > 0) {
- if (operationFlag.equals("add")) {
- for (int i = 0; i < productBugList.size(); i++) {
- ProductDefectInfo pdf = productBugList.get(i);
- pdf.setCreateTime(null);
- }
- }
- }
- // 2023年10月16日
- // if (classifyInfo.getDefectFlagName() == "冷补") {// 产品等级选择为冷补后,必须选择[冷补类别]
- // ProductClassifyInfo check_cold_repair_categoryInfo = (ProductClassifyInfo) check_cold_repair_category
- // .getSelectedItem();
- // if (check_cold_repair_categoryInfo == null) {
- // Toast.makeText(getApplicationContext(), "产品等级选择为冷补后,必须选择[冷补类别]", Toast.LENGTH_SHORT).show();
- // return;
- // }
- // }
- ProcessDialogUtils.showProcessDialog(CheckCollectModifyActivity.this);
- if (save.isEnabled()) {
- save.setEnabled(false);
- thread = null;
- thread = new HandlerThread("SaveThread", 5);
- thread.start();
- mHandler = null;
- mHandler = new Handler(thread.getLooper());
- SaveRunnable saveRunnable = new SaveRunnable(obj, GoodsLevelTypeID, GoodsLevelID);
- mHandler.post(saveRunnable);
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- });
- classifySpin.setOnItemSelectedListener(new Spinner.OnItemSelectedListener() {
- @Override
- public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
- classifyInfo = (ProductClassifyInfo) arg0.getItemAtPosition(arg2);
- int GoodsLevelTypeID = classifyInfo.getGoodsLevelTypeID();// 所选产品分级类型
- // GoodsLevelID = classifyInfo.getDefectFlagId();
- //2023年10月16日
- // if (GoodsLevelTypeID == 16) { // 产品分级选中冷补 把冷补类别打开
- // check_cold_repair_category.setEnabled(true);
- // } else {
- // check_cold_repair_category.setEnabled(false);
- // }
- if (GoodsLevelTypeID != 6) {
- gotoSpin.setEnabled(false);
- }
- if (GoodsLevelTypeID == 4) {
- if (listReWorkProcedure != null) {
- listReWorkProcedure.clear();
- if (adapterReWorkProcedure != null) {
- adapterReWorkProcedure.notifyDataSetChanged();
- }
- }
- } else {
- if (GoodsLevelTypeID == 6 || GoodsLevelTypeID == 16) { // 重烧 和冷补 可以进
- try {
- JSONObject jsonObject = new JSONObject();
- jsonObject.put("accountCode", accountCode);
- jsonObject.put("userCode", checkCollectModify_userCode);
- jsonObject.put("userPassword", password);
- jsonObject.put("sessionKey", sessionkey);
- jsonObject.put("procedureID", proId);
- thread = new HandlerThread("reworkProcedureThread", 5);
- thread.start();
- mHandler = new Handler(thread.getLooper());
- ReworkProcedureRunnable reworkProcedureRunnable = new ReworkProcedureRunnable(jsonObject);
- mHandler.post(reworkProcedureRunnable);
- } catch (JSONException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- if (!overdueFlag) {
- recordBug.setEnabled(true);
- }
- if (listReWorkProcedure != null) {
- listReWorkProcedure.clear();
- if (adapterReWorkProcedure != null) {
- adapterReWorkProcedure.notifyDataSetChanged();
- }
- }
- }
- // if ((proId == 125) || (proId == 131)) { // 三检 显示
- // if (GoodsLevelTypeID != 16) { // 产品分级选择冷补的时候 给冷补类型赋值 其他清空
- // adapterCheckColdRepairCategory = new ProductClassifyAdapter(list_null, getApplicationContext());
- // check_cold_repair_category.setAdapter(adapterCheckColdRepairCategory);
- // }
- //
- // }
- }
- @Override
- public void onNothingSelected(AdapterView<?> arg0) {
- }
- });
- // 养水点击事件
- check_nourishing_water.setOnItemSelectedListener(new Spinner.OnItemSelectedListener() {
- @Override
- public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
- // 在养水页面的时候 养水的点击事件才会生效
- classifyInfo = (ProductClassifyInfo) arg0.getItemAtPosition(arg2);
- String DefectFlagName = classifyInfo.getDefectFlagName();// 所选产品分级类型
- if (title.getText().toString().indexOf("养水") != -1) {
- if ("不合格".equals(DefectFlagName)) { // 点击 不合格 默认 刷到第一个item
- check_nourishing_water_position.setEnabled(true);
- adapterCheckNourishingWaterPosition = new ProductClassifyAdapter(
- listCheckNourishingWaterPosition, getApplicationContext());
- check_nourishing_water_position.setAdapter(adapterCheckNourishingWaterPosition);
- check_nourishing_water_position.setPrompt("请选择");
- } else {
- check_nourishing_water_position.setEnabled(false);
- adapterCheckNourishingWaterPosition = new ProductClassifyAdapter(list_null,
- getApplicationContext());
- check_nourishing_water_position.setAdapter(adapterCheckNourishingWaterPosition);
- check_nourishing_water_position.setPrompt("请选择");
- }
- }
- }
- @Override
- public void onNothingSelected(AdapterView<?> arg0) {
- }
- });
- // 修磨事件
- check_grinding_test.setOnItemSelectedListener(new Spinner.OnItemSelectedListener() {
- @Override
- public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
- // 在养水页面的时候 养水的点击事件才会生效
- classifyInfo = (ProductClassifyInfo) arg0.getItemAtPosition(arg2);
- String DefectFlagName = classifyInfo.getDefectFlagName();// 所选产品分级类型
- }
- @Override
- public void onNothingSelected(AdapterView<?> arg0) {
- }
- });
- // 试水 点击事件
- check_water_test.setOnItemSelectedListener(new Spinner.OnItemSelectedListener() {
- @Override
- public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
- classifyInfo = (ProductClassifyInfo) arg0.getItemAtPosition(arg2);
- String DefectFlagName = classifyInfo.getDefectFlagName();// 所选产品分级类型
- //在试水页面的时候 试水的点击事件才会生效
- if (title.getText().toString().indexOf("试水") != -1) {
- if ("不合格".equals(DefectFlagName)) {
- check_water_test_position.setEnabled(true);
- adapterCheckWaterTestPosition = new ProductClassifyAdapter(listCheckWaterTestPosition,
- CheckCollectModifyActivity.this);
- check_water_test_position.setAdapter(adapterCheckWaterTestPosition);
- check_nourishing_water_position.setPrompt("请选择");
- } else {
- check_water_test_position.setEnabled(false);
- adapterCheckWaterTestPosition = new ProductClassifyAdapter(list_null,
- CheckCollectModifyActivity.this);
- check_water_test_position.setAdapter(adapterCheckWaterTestPosition);
- check_nourishing_water_position.setPrompt("请选择");
- }
- }
- }
- @Override
- public void onNothingSelected(AdapterView<?> arg0) {
- }
- });
- // 冷补类别 点击事件
- check_cold_repair_category.setOnItemSelectedListener(new Spinner.OnItemSelectedListener() {
- @Override
- public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
- classifyInfo = (ProductClassifyInfo) arg0.getItemAtPosition(arg2);
- String DefectFlagName = classifyInfo.getDefectFlagName();// 所选产品分级类型
- ProductClassifyInfo check_cold_repair_categoryInfo = (ProductClassifyInfo) check_cold_repair_category
- .getSelectedItem();
- // --外观: 冷补返工为冷补确认 --功能: 冷补返工为冷补交接
- int position = 0;
- if (listReWorkProcedure != null && check_cold_repair_categoryInfo != null) {
- for (int i = 0; i < listReWorkProcedure.size(); i++) {
- if ("外观".equals(DefectFlagName)) {
- if (listReWorkProcedure.get(i).getReworkProcedureName().contains("冷补确认")) {
- position = i;
- break;
- }
- }
- if ("功能".equals(DefectFlagName)) {
- if (listReWorkProcedure.get(i).getReworkProcedureName().contains("冷补交接")) {
- position = i;
- break;
- }
- }
- }
- gotoSpin.setSelection(position);
- }
- }
- @Override
- public void onNothingSelected(AdapterView<?> arg0) {
- }
- });
- }
- /**
- * 数据
- *
- * @return
- */
- public ArrayList<String> getPopList() {
- ArrayList<String> popList = new ArrayList<String>();
- popList.add("asdasdsad1");
- popList.add("asdasdsad2");
- popList.add("asdasdsad3");
- popList.add("asdasdsad4");
- popList.add("asdasdsad5");
- popList.add("asdasdsad6");
- return popList;
- }
- // 调用数据源 养水数据接口 和 试水数据接口 和 补裂位置数据源
- private class LoadRunnable implements Runnable {
- public LoadRunnable() {
- }
- @Override
- public void run() {
- try {
- { // 代码块 给 下线标识 赋值(写死 1:是 0:否)
- ProductClassifyInfo classifyInfo;
- listCheckOfflineIdentificatio = new ArrayList<ProductClassifyInfo>();// 试水不合格位置数据源
- classifyInfo = new ProductClassifyInfo();
- classifyInfo.setDefectFlagType("");
- classifyInfo.setDefectFlagName("否");
- classifyInfo.setDefectFlagId(0);
- listCheckOfflineIdentificatio.add(classifyInfo);
- classifyInfo = new ProductClassifyInfo();
- classifyInfo.setDefectFlagType("");
- classifyInfo.setDefectFlagName("是");
- classifyInfo.setDefectFlagId(1);
- listCheckOfflineIdentificatio.add(classifyInfo);
- if (proId == 125) { // 三检 显示
- adapterCheckOfflineIdentificatio = new ProductClassifyAdapter(listCheckOfflineIdentificatio,
- getApplicationContext());
- check_offline_identificatio.setAdapter(adapterCheckOfflineIdentificatio);
- }
- }
- { // 代码块 给 冷补类别赋值
- ProductClassifyInfo classifyInfo;
- listCheckColdRepairCategory = new ArrayList<ProductClassifyInfo>();//
- classifyInfo = new ProductClassifyInfo();
- classifyInfo.setDefectFlagType("");
- classifyInfo.setDefectFlagName("外观");
- classifyInfo.setDefectFlagId(0);
- listCheckColdRepairCategory.add(classifyInfo);
- classifyInfo = new ProductClassifyInfo();
- classifyInfo.setDefectFlagType("");
- classifyInfo.setDefectFlagName("功能");
- classifyInfo.setDefectFlagId(1);
- listCheckColdRepairCategory.add(classifyInfo);
- }
- { // 代码块 给修磨赋值
- ProductClassifyInfo classifyInfo;
- listCheckGrinding = new ArrayList<ProductClassifyInfo>();//
- classifyInfo = new ProductClassifyInfo();
- classifyInfo.setDefectFlagType("");
- classifyInfo.setDefectFlagName("合格");
- classifyInfo.setDefectFlagId(1);
- listCheckGrinding.add(classifyInfo);
- classifyInfo = new ProductClassifyInfo();
- classifyInfo.setDefectFlagType("");
- classifyInfo.setDefectFlagName("不合格");
- classifyInfo.setDefectFlagId(0);
- listCheckGrinding.add(classifyInfo);
- adapterCheckGrinding = new ProductClassifyAdapter(listCheckGrinding, getApplicationContext());
- check_grinding_test.setAdapter(adapterCheckGrinding);
- }
- // 先把数据源new 出来
- client = null;
- client = new WebClient();
- JSONObject js = new JSONObject();
- js.put("accountCode", accountCode);
- js.put("userCode", checkCollectModify_userCode);
- js.put("userPassword", password);
- js.put("sessionKey", sessionkey);
- js.put("dicType", "TPC014"); // 养水不合格
- String result = client.doPost("http://" + ServerAddress_ip + ":" + ServerAddress_duankou
- + Constants.serverAction + "/GetDataDictionaryByType", js.toString(), "application/json");
- JSONObject j2 = new JSONObject(result);
- JSONObject j3 = j2.optJSONObject("d");
- int status3 = j3.optInt("Status");
- String message3 = j3.optString("Message");
- String json = j3.getString("Result");
- if (status3 == 0) {
- Message message = new Message();
- Bundle b = new Bundle();
- b.putString("result", json);
- message.what = 8;
- message.setData(b);
- handler.sendMessage(message);
- } else {
- ProcessDialogUtils.closeProgressDilog();
- if (mHandler != null) {
- mHandler.removeCallbacksAndMessages(null);
- mHandler.getLooper().quit();
- }
- CommonUtil.showAlertDialog(status3, message3, CheckCollectModifyActivity.this);
- }
- client = null;
- client = new WebClient();
- JSONObject js1 = new JSONObject();
- js1.put("accountCode", accountCode);
- js1.put("userCode", checkCollectModify_userCode);
- js1.put("userPassword", password);
- js1.put("sessionKey", sessionkey);
- js1.put("dicType", "TPC015");// 试水不合格
- String result2 = client.doPost("http://" + ServerAddress_ip + ":" + ServerAddress_duankou
- + Constants.serverAction + "/GetDataDictionaryByType", js1.toString(), "application/json");
- JSONObject j4 = new JSONObject(result2);
- JSONObject j5 = j4.optJSONObject("d");
- int status5 = j5.optInt("Status");
- String message5 = j5.optString("Message");
- String json5 = j5.getString("Result");
- if (status5 == 0) {
- Message message1 = new Message();
- Bundle b = new Bundle();
- b.putString("result", json5);
- message1.what = 9;
- message1.setData(b);
- handler.sendMessage(message1);
- } else {
- ProcessDialogUtils.closeProgressDilog();
- if (mHandler != null) {
- mHandler.removeCallbacksAndMessages(null);
- mHandler.getLooper().quit();
- }
- CommonUtil.showAlertDialog(status5, message5, CheckCollectModifyActivity.this);
- }
- if (title.getText().toString().indexOf("补裂") != -1) { // 页面为补裂 才可以调用 补裂位置数据源接口
- client = null;
- client = new WebClient();
- JSONObject js17 = new JSONObject();
- js17.put("accountCode", accountCode);
- js17.put("userCode", checkCollectModify_userCode);
- js17.put("userPassword", password);
- js17.put("sessionKey", sessionkey);
- js17.put("dicType", "TPC017");// 补裂位置
- String result17 = client.doPost("http://" + ServerAddress_ip + ":" + ServerAddress_duankou
- + Constants.serverAction + "/GetDataDictionaryByType", js17.toString(), "application/json");
- JSONObject j17 = new JSONObject(result17);
- JSONObject j517 = j17.optJSONObject("d");
- int status17 = j517.optInt("Status");
- String message17 = j517.optString("Message");
- String json17 = j517.getString("Result");
- if (status17 == 0) {
- Message message117 = new Message();
- Bundle b = new Bundle();
- b.putString("result", json17);
- message117.what = 11;
- message117.setData(b);
- handler.sendMessage(message117);
- } else {
- ProcessDialogUtils.closeProgressDilog();
- if (mHandler != null) {
- mHandler.removeCallbacksAndMessages(null);
- mHandler.getLooper().quit();
- }
- CommonUtil.showAlertDialog(status17, message17, CheckCollectModifyActivity.this);
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
- Message m = new Message();
- Bundle b = new Bundle();
- b.putString("message", "网络连接异常");
- m.setData(b);
- m.what = 0;
- exceptionHandler.sendMessage(m);
- }
- }
- };
- Runnable BarcodeUpperCase = new Runnable() {
- @Override
- public void run() {
- // 小写转大写
- barcode.setText(barcodeUpper.toUpperCase());
- // 设置EditText光标位置
- barcode.setSelection(barcodeUpper.length());
- }
- };
- private static class SaveValidHandler extends Handler {
- private final WeakReference mActivity;
- public SaveValidHandler(CheckCollectModifyActivity activity) {
- mActivity = new WeakReference(activity);
- }
- @Override
- public void handleMessage(Message msg) {
- final CheckCollectModifyActivity activity = (CheckCollectModifyActivity) mActivity.get();
- switch (msg.what) {
- case 0:
- ProcessDialogUtils.closeProgressDilog();
- Bundle b3 = msg.getData();
- String msg3 = b3.getString("message");
- CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, activity.getApplicationContext());
- Toast.makeText(activity.getApplicationContext(), msg3, Toast.LENGTH_SHORT).show();
- activity.save.setEnabled(true);
- break;
- case 3:
- ProcessDialogUtils.closeProgressDilog();
- Bundle b = msg.getData();
- String message = b.getString("message");
- CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, activity.getApplicationContext());
- // CommonUtil.showRepeatDialog(message,CheckCollectModifyActivity.this);
- Toast.makeText(activity.getApplicationContext(), message, Toast.LENGTH_SHORT).show();
- activity.loctxt.setFocusable(true);
- activity.loctxt.requestFocus();
- break;
- }
- }
- };
- private class SaveRunnable implements Runnable {
- Object obj;
- int GoodsLevelTypeID;
- int GoodsLevelID;
- public SaveRunnable(Object obj, int GoodsLevelTypeID, int GoodsLevelID) {
- this.obj = obj;
- this.GoodsLevelTypeID = GoodsLevelTypeID;
- this.GoodsLevelID = GoodsLevelID;
- }
- @Override
- public void run() {
- synchronized (obj) {
- try {
- ProductClassifyInfo saveClassifyInfo = (ProductClassifyInfo) classifySpin.getSelectedItem();
- if (saveClassifyInfo.getGoodsLevelTypeID() == 6) {// 重烧 不管界面 怎么选 写死 返回工序
- HashMap<String, String> params = new LinkedHashMap<String, String>();
- params.put("barcode", productNumber.getText().toString().trim().replaceAll("\\n", ""));
- String resultGOODS = mClient.requestGetBySyn(
- "http://" + ServerAddress_ip + ":9100" + "/main/login/api/UpdateReworkProduce.ashx",
- params);
- // JSONObject jGOODS = new JSONObject(resultGOODS);
- // String msgGOODSresult = jGOODS.optString("rows");
- // JSONArray jarrayGOODS = new JSONArray(msgGOODSresult);
- // JSONObject jobjGOODS = jarrayGOODS.optJSONObject(0);
- // GOODSMODELforCheck = jobjGOODS.optString("GOODSTYPECODE");
- // String GOODSTYPECODE = jobjGOODS.optString("GOODSTYPECODE").substring(0, 6);
- // if ("001001".equals(GOODSTYPECODE)) {// 大件
- // reworkProcedureInfo.setReworkProcedureID("138");
- // reworkProcedureInfo.setReworkProcedureName("重烧接收");
- // } else if ("001002".equals(GOODSTYPECODE)) { // 小件
- // reworkProcedureInfo.setReworkProcedureID("57");
- // reworkProcedureInfo.setReworkProcedureName("4-5重烧交接");
- // }
- }
- JSONObject jsonObject = new JSONObject();
- if (productBugList != null && productBugList.size() > 0) {
- defectflag = 2;
- }
- jsonObject.put("accountCode", accountCode);
- jsonObject.put("userCode", checkCollectModify_userCode);
- jsonObject.put("userPassword", password);
- jsonObject.put("sessionKey", sessionkey);
- jsonObject.put("procedureID", proId);
- JSONArray productionDataEntitys = new JSONArray();
- JSONObject productionData = new JSONObject();
- productionData.put("CheckFlag", checkFlag);
- productionData.put("Barcode", productionInfo.getBarCode());
- productionData.put("UserID", userID);
- productionData.put("UserCode", worknouserCode);
- productionData.put("OPTimeStampPDA", timestamp);
- productionData.put("UserName", workNoName);
- productionData.put("GoodsLevelTypeID", GoodsLevelTypeID);
- productionData.put("IsPDA", 1);
- productionData.put("Remarks", remarks);
- productionData.put("GoodsLevelID", GoodsLevelID);
- productionData.put("DefectFlag", defectflag);
- productionData.put("DataKey", repeatFlag);
- if (operationFlag.equals("modify")) {
- productionData.put("PDACheckTime", productionInfo.getCheckTime());
- productionData.put("ProductionDataID", productionDataId);
- productionData.put("OrgGoodsLevelTypeID", productionInfo.getGoodsLevelTypeId());
- }
- if (operationFlag.equals("add")) {
- if (dryRepairFlag) {
- productionData.put("ProductionDataID", productionDataId);
- }
- }
- if (productBugList != null && productBugList.size() > 0) {
- if (reworkProcedureInfo != null) {
- productionData.put("ReworkProcedureID",
- Double.parseDouble(reworkProcedureInfo.getReworkProcedureID()));
- productionData.put("ReworkProcedureName", reworkProcedureInfo.getReworkProcedureName());
- }
- JSONArray productionDefects = new JSONArray();
- for (int j = 0; j < productBugList.size(); j++) {
- ProductDefectInfo productDefectInfo = productBugList.get(j);
- JSONObject jsonObject2 = new JSONObject();
- jsonObject2.put("IsPDA", "1");
- jsonObject2.put("PDACheckTime", productDefectInfo.getCreateTime());
- jsonObject2.put("DefectID", productDefectInfo.getDefectNo().getDefectId());
- jsonObject2.put("DefectCode", productDefectInfo.getDefectNo().getDefectCode());
- jsonObject2.put("DefectName", productDefectInfo.getDefectNo().getDefectName());
- if (productDefectInfo.getDefectLocation() != null) {
- jsonObject2.put("DefectPositionID",
- productDefectInfo.getDefectLocation().getDefectPositionId());
- jsonObject2.put("DefectPositionCode",
- productDefectInfo.getDefectLocation().getDefectPositionCode());
- jsonObject2.put("DefectPositionName",
- productDefectInfo.getDefectLocation().getDefectPositionName());
- }
- boolean IsSpecialDefectFlag = productDefectInfo.isSpecialDefectFlag();
- if (IsSpecialDefectFlag) {
- jsonObject2.put("SpecialDefect", 1);
- } else {
- jsonObject2.put("SpecialDefect", 0);
- }
- if (productDefectInfo.getResponsibilityProcedure() != null) {
- if (productDefectInfo.getResponsibilityProcedure().getDutyProcedureId() > 0.0) {
- jsonObject2.put("DefectProcedureID",
- productDefectInfo.getResponsibilityProcedure().getDutyProcedureId());
- jsonObject2.put("DefectProcedureCode",
- productDefectInfo.getResponsibilityProcedure().getDutyProcedureCode());
- jsonObject2.put("DefectProcedureName",
- productDefectInfo.getResponsibilityProcedure().getDutyProcedureName());
- }
- if (productDefectInfo.getResponsibilityProcedure().getDutyProcedureId() == 0.0) {
- if (productDefectInfo.getWorkno() != null) {
- jsonObject2.put("DefectUserID", productDefectInfo.getWorkno().getUserId());
- jsonObject2.put("DefectUserCode", productDefectInfo.getWorkno().getUserCode());
- jsonObject2.put("DefectUserName", productDefectInfo.getWorkno().getUserName());
- }
- }
- else {
- if (productDefectInfo.getWorkno() != null) {
- jsonObject2.put("DefectProductionDataID",
- productDefectInfo.getWorkno().getProductionDataId());
- jsonObject2.put("DefectUserID", productDefectInfo.getWorkno().getUserId());
- jsonObject2.put("DefectUserCode", productDefectInfo.getWorkno().getUserCode());
- jsonObject2.put("DefectUserName", productDefectInfo.getWorkno().getUserName());
- }
- }
- }
- if (productDefectInfo.getResponsibilityProcedure() == null) {
- if (productDefectInfo.getWorkno() != null) {
- jsonObject2.put("DefectUserID", productDefectInfo.getWorkno().getUserId());
- jsonObject2.put("DefectUserCode", productDefectInfo.getWorkno().getUserCode());
- jsonObject2.put("DefectUserName", productDefectInfo.getWorkno().getUserName());
- }
- }
- if (productDefectInfo.getWorkType() != null) {
- jsonObject2.put("DefectJobs", productDefectInfo.getWorkType().getJobsID());
- }
- if (productDefectInfo.getDefectFines() != null
- && productDefectInfo.getDefectFines().getDefectFinesId() > 0.0) {
- jsonObject2.put("DefectFine", productDefectInfo.getDefectFines().getDefectFinesId());
- }
- if (productDefectInfo.getDefectDeduction() != null) {
- jsonObject2.put("DefectDeductionNum",
- productDefectInfo.getDefectDeduction().getDefectDeductionNum());
- }
- if (productDefectInfo.getMissingDefectWorkNo() != null
- && productDefectInfo.getMissingDefectWorkNo().getUserId() > 0.0) {
- jsonObject2.put("MissedUserID", productDefectInfo.getMissingDefectWorkNo().getUserId());
- jsonObject2.put("MissedUserCode",
- productDefectInfo.getMissingDefectWorkNo().getUserCode());
- jsonObject2.put("MissedUserName",
- productDefectInfo.getMissingDefectWorkNo().getUserName());
- }
- JSONArray DefectResponsibles = new JSONArray();
- List<DutyPerson> dutyPersonList = productBugList.get(j).getDutyPersonList();
- if (dutyPersonList != null && dutyPersonList.size() > 0) {
- for (int k = 0; k < dutyPersonList.size(); k++) {
- JSONObject dutyPerson = new JSONObject();
- dutyPerson.put("StaffID", dutyPersonList.get(k).getStaffId());
- dutyPerson.put("UserID", dutyPersonList.get(k).getUserId());
- dutyPerson.put("UserCode", dutyPersonList.get(k).getUserCode());
- dutyPerson.put("UJobsID", dutyPersonList.get(k).getJobsId());
- dutyPerson.put("StaffStatus", dutyPersonList.get(k).getStaffStatus());
- dutyPerson.put("SJobsID", dutyPersonList.get(k).getsJobsId());
- DefectResponsibles.put(dutyPerson);
- }
- jsonObject2.put("DefectResponsibles", DefectResponsibles);
- }
- JSONArray missingDefectDutyPersonArray = new JSONArray();
- List<DutyPerson> missingDefectDutyPersonList = productBugList.get(j)
- .getMissingDefectDutyPersonList();
- if (missingDefectDutyPersonList != null && missingDefectDutyPersonList.size() > 0) {
- for (int m = 0; m < missingDefectDutyPersonList.size(); m++) {
- JSONObject missingdefectdutyPerson = new JSONObject();
- missingdefectdutyPerson.put("StaffID",
- missingDefectDutyPersonList.get(m).getStaffId());
- missingdefectdutyPerson.put("UserID",
- missingDefectDutyPersonList.get(m).getUserId());
- missingdefectdutyPerson.put("UserCode",
- missingDefectDutyPersonList.get(m).getUserCode());
- missingdefectdutyPerson.put("UJobsID",
- missingDefectDutyPersonList.get(m).getJobsId());
- missingdefectdutyPerson.put("SJobsID",
- missingDefectDutyPersonList.get(m).getsJobsId());
- missingdefectdutyPerson.put("StaffStatus",
- missingDefectDutyPersonList.get(m).getStaffStatus());
- missingDefectDutyPersonArray.put(missingdefectdutyPerson);
- }
- jsonObject2.put("DefectMissedResponsibles", missingDefectDutyPersonArray);
- }
- JSONArray DefectImages = new JSONArray();
- List<ImagePath> imgPathList = productBugList.get(j).getDefectImgPath();
- if (imgPathList != null && imgPathList.size() > 0) {
- for (int m = 0; m < imgPathList.size(); m++) {
- String imagePath = imgPathList.get(m).getLocalPath();
- File file = new File(imagePath);
- if (file.exists() && file.length() > 0) {
- File f = ViewUtil.compressImage(imagePath);
- long size = f.length();
- if (size > 0) {
- WebClient client = new WebClient();
- String json = client.uploadStream(imagePath,
- "http://" + ServerAddress_ip + ":" + ServerAddress_duankou
- + Constants.serverAction + "/SaveImg",
- CheckCollectModifyActivity.this);
- if (json != null) {
- JSONObject jo = new JSONObject(json);
- JSONObject js = (JSONObject) jo.opt("d");
- int status = js.optInt("Status");
- String message = js.optString("Message");
- if (status == 0) {
- String imgpath = js.optString("Result");
- if (imgpath != null) {
- JSONObject Path = new JSONObject();
- Path.put("ImagePath", imgpath);
- DefectImages.put(m, Path);
- }
- }
- else {
- Message msg = new Message();
- msg.what = 0;
- Bundle b1 = new Bundle();
- b1.putString("message", message);
- msg.setData(b1);
- saveValidHandler.sendMessage(msg);
- return;
- }
- } else {
- Message m3 = new Message();
- m3.what = 0;
- Bundle b = new Bundle();
- b.putString("message", "附件上传失败");
- m3.setData(b);
- saveValidHandler.sendMessage(m3);
- return;
- }
- }
- }
- }
- if (DefectImages != null && DefectImages.length() > 0) {
- jsonObject2.put("DefectImages", DefectImages);
- }
- }
- productionDefects.put(jsonObject2);
- }
- productionData.put("ProductionDefects", productionDefects);
- }
- ProductClassifyInfo check_leakInfo = (ProductClassifyInfo) check_leak.getSelectedItem();
- ProductClassifyInfo check_nourishing_waterInfo = (ProductClassifyInfo) check_nourishing_water
- .getSelectedItem();
- ProductClassifyInfo check_nourishing_water_positionInfo = (ProductClassifyInfo) check_nourishing_water_position
- .getSelectedItem();
- ProductClassifyInfo check_water_testInfo = (ProductClassifyInfo) check_water_test.getSelectedItem();
- ProductClassifyInfo check_water_test_positionInfo = (ProductClassifyInfo) check_water_test_position
- .getSelectedItem();
- ProductClassifyInfo check_grinding_info = (ProductClassifyInfo) check_grinding_test
- .getSelectedItem();
- ProductClassifyInfo check_offline_identificatioInfo = (ProductClassifyInfo) check_offline_identificatio
- .getSelectedItem();
- ProductClassifyInfo check_cold_repair_categoryInfo = (ProductClassifyInfo) check_cold_repair_category
- .getSelectedItem();
- productionData.put("LENGBUTYPE", check_cold_repair_categoryInfo == null ? ""
- : check_cold_repair_categoryInfo.getDefectFlagName());// 冷补类别
- productionData.put("LeakFlag1", check_leakInfo.getDefectFlagId());// 漏气
- productionData.put("LeakFlag4", check_nourishing_waterInfo.getDefectFlagId());// 养水
- productionData.put("LeakFlag4Position",
- check_nourishing_water_positionInfo != null
- ? check_nourishing_water_positionInfo.getDefectFlagName()
- : "");// 养水
- // 不合格位置
- productionData.put("LeakFlag5", check_water_testInfo.getDefectFlagId());// 试水
- productionData.put("LeakFlag5Position",
- check_water_test_positionInfo != null ? check_water_test_positionInfo.getDefectFlagName()
- : "");// 试水不合格位置
- productionData.put("LeakFlag7",
- check_grinding_info != null ? check_grinding_info.getDefectFlagId() : "");// 修磨
- productionData.put("LeakFlag6Position", mCheckRepairCrackPositionDate);// 补裂位置 传参
- productionData.put("OfflineFlag",
- check_offline_identificatioInfo != null ? check_offline_identificatioInfo.getDefectFlagId()
- : "");// 下线标识
- productionDataEntitys.put(productionData);
- jsonObject.put("productionDataEntitys", productionDataEntitys);
- WebClient client = new WebClient();
- String result = client.doPost(
- "http://" + ServerAddress_ip + ":" + ServerAddress_duankou + Constants.SAVE_CHECK_INFO,
- jsonObject.toString(), "application/json");
- Bundle b = new Bundle();
- b.putString("result", result);
- Message m = new Message();
- m.setData(b);
- m.what = 4;
- handler.sendMessage(m);
- } catch (JSONException e) {
- e.printStackTrace();
- Message m3 = new Message();
- m3.what = 0;
- Bundle b = new Bundle();
- b.putString("message", "json数据异常");
- m3.setData(b);
- saveValidHandler.sendMessage(m3);
- } catch (Exception e) {
- e.printStackTrace();
- Message m3 = new Message();
- m3.what = 0;
- Bundle b = new Bundle();
- b.putString("message", "网络连接异常");
- m3.setData(b);
- saveValidHandler.sendMessage(m3);
- }
- }
- }
- };
- @Override
- protected void onDestroy() {
- super.onDestroy();
- Mout_ReworkProcedureId = "";
- }
- private Runnable bugLocationRunnable = new Runnable() {
- @Override
- public void run() {
- try {
- client = null;
- client = new WebClient();
- JSONObject js = new JSONObject();
- js.put("accountCode", accountCode);
- js.put("userCode", checkCollectModify_userCode);
- js.put("userPassword", password);
- js.put("sessionKey", sessionkey);
- js.put("goodsID", productionInfo.getGoodsId());
- js.put("positionCode", defectLocation);
- String result = client.doPost("http://" + ServerAddress_ip + ":" + ServerAddress_duankou
- + Constants.serverAction + "/GetDefectPositionByGoodsIDAndPositionCode", js.toString(),
- "application/json");
- Message m = new Message();
- m.what = 7;
- Bundle b = new Bundle();
- b.putString("buglocResult", result);
- m.setData(b);
- handler.sendMessage(m);
- } catch (Exception e) {
- e.printStackTrace();
- Message m3 = new Message();
- m3.what = 3;
- Bundle b = new Bundle();
- b.putString("message", "网络连接异常");
- m3.setData(b);
- saveValidHandler.sendMessage(m3);
- return;
- }
- }
- };
- private class UserRunnable implements Runnable {
- JSONObject jsonObject;
- public UserRunnable(JSONObject jsonObject) {
- this.jsonObject = jsonObject;
- }
- @Override
- public void run() {
- Message message = new Message();
- client = new WebClient();
- try {
- Bundle b = new Bundle();
- String result;
- result = client.doPost(
- "http://" + ServerAddress_ip + ":" + ServerAddress_duankou + Constants.PRODUCER_NO_VALID,
- jsonObject.toString(), "application/json");
- b.putString("result", result);
- message.what = 0;
- message.setData(b);
- handler.sendMessage(message);
- } catch (JSONException e) {
- e.printStackTrace();
- Message m = new Message();
- m.what = 1;
- Bundle b = new Bundle();
- b.putString("message", "json数据异常");
- m.setData(b);
- exceptionHandler.sendMessage(m);
- return;
- } catch (Exception e) {
- e.printStackTrace();
- Message m = new Message();
- m.what = 1;
- Bundle b = new Bundle();
- b.putString("message", "网络连接异常");
- m.setData(b);
- exceptionHandler.sendMessage(m);
- return;
- }
- }
- }
- private Runnable bugnoRunnable = new Runnable() {
- @Override
- public void run() {
- try {
- client = null;
- client = new WebClient();
- JSONObject js = new JSONObject();
- js.put("accountCode", accountCode);
- js.put("userCode", checkCollectModify_userCode);
- js.put("userPassword", password);
- js.put("sessionKey", sessionkey);
- js.put("procedureID", proId);
- js.put("defectCode", defectno);
- String result = client.doPost("http://" + ServerAddress_ip + ":" + ServerAddress_duankou
- + Constants.serverAction + "/GetDefectByProcedureIDAndDefectCode", js.toString(),
- "application/json");
- Message m = new Message();
- m.what = 6;
- Bundle b = new Bundle();
- b.putString("bugnoResult", result);
- m.setData(b);
- handler.sendMessage(m);
- } catch (Exception e) {
- Message m = new Message();
- m.what = 4;
- Bundle b = new Bundle();
- b.putString("message", "网络连接异常");
- m.setData(b);
- exceptionHandler.sendMessage(m);
- return;
- }
- }
- };
- Runnable UpperCase = new Runnable() {
- @Override
- public void run() {
- // 小写转大写
- worknoEdt.setText(user.toUpperCase());
- // 设置EditText光标位置
- worknoEdt.setSelection(user.length());
- }
- };
- private class ReworkProcedureRunnable implements Runnable {
- JSONObject jsonObject;
- public ReworkProcedureRunnable(JSONObject jsonObject) {
- this.jsonObject = jsonObject;
- }
- @Override
- public void run() {
- Message message = new Message();
- client = new WebClient();
- String result;
- Bundle b = new Bundle();
- try {
- result = client.doPost("http://" + ServerAddress_ip + ":" + ServerAddress_duankou
- + Constants.GET_ENDPRODUCT_REWORK_PROCEDURE, jsonObject.toString(), "application/json");
- b.putString("result", result);
- message.what = 3;
- message.setData(b);
- handler.sendMessage(message);
- } catch (JSONException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- Message m = new Message();
- m.what = 5;
- Bundle b5 = new Bundle();
- b5.putString("message", "json数据异常");
- m.setData(b5);
- exceptionHandler.sendMessage(m);
- } catch (Exception e) {
- Message m = new Message();
- m.what = 5;
- Bundle b5 = new Bundle();
- b5.putString("message", "网络连接异常");
- m.setData(b5);
- exceptionHandler.sendMessage(m);
- e.printStackTrace();
- return;
- }
- }
- }
- private static class ExceptionHandler extends Handler {
- private final WeakReference mActivity;
- public ExceptionHandler(CheckCollectModifyActivity activity) {
- mActivity = new WeakReference(activity);
- }
- @Override
- public void handleMessage(Message msg) {
- super.handleMessage(msg);
- CheckCollectModifyActivity activity = (CheckCollectModifyActivity) mActivity.get();
- switch (msg.what) {
- case 0:
- ProcessDialogUtils.closeProgressDilog();
- Bundle b = msg.getData();
- int status = b.getInt("status");
- String errorMsg = b.getString("errorMsg");
- CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, activity.getApplicationContext());
- CommonUtil.showBarCodeAlertDialog(status, errorMsg, activity, activity.barcode, activity.bugnotxt,
- activity.loctxt);
- if (activity.mHandler != null) {
- activity.mHandler.removeCallbacksAndMessages(null);
- activity.mHandler.getLooper().quit();
- }
- break;
- case 1:
- ProcessDialogUtils.closeProgressDilog();
- Bundle b2 = msg.getData();
- String message = b2.getString("message");
- CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, activity);
- CustomToast.showToast(activity.getApplicationContext(), message, 2000);
- if (activity.collectType == 1) {
- activity.worknoEdt.setEnabled(true);
- activity.worknoEdt.setText("");
- activity.worknoEdt.setFocusable(true);
- activity.worknoEdt.setFocusableInTouchMode(true);
- activity.worknoEdt.requestFocus();
- activity.worknoEdt.findFocus();
- activity.worknoEdt.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
- int dend) {
- return null;
- }
- } });
- activity.barcode.setEnabled(true);
- activity.barcode.setFocusable(true);
- activity.barcode.setFocusableInTouchMode(true);
- activity.barcode.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
- int dend) {
- return null;
- }
- } });
- CommonUtil.BarcodeMaxLength(activity.barcode, 50);
- activity.bugnotxt.setEnabled(true);
- activity.bugnotxt.setText("");
- activity.bugnotxt.setFocusable(true);
- activity.bugnotxt.setFocusableInTouchMode(true);
- activity.bugnotxt.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
- int dend) {
- return null;
- }
- } });
- activity.loctxt.setEnabled(true);
- activity.loctxt.setText("");
- activity.loctxt.setFocusable(true);
- activity.loctxt.setFocusableInTouchMode(true);
- activity.loctxt.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
- int dend) {
- return null;
- }
- } });
- }
- if (activity.mHandler != null) {
- activity.mHandler.removeCallbacksAndMessages(null);
- activity.mHandler.getLooper().quit();
- }
- break;
- case 2:
- ProcessDialogUtils.closeProgressDilog();
- if (activity.mHandler != null) {
- activity.mHandler.removeCallbacksAndMessages(null);
- activity.mHandler.getLooper().quit();
- }
- Bundle b3 = msg.getData();
- String message3 = b3.getString("message");
- CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, activity.getApplicationContext());
- // CommonUtil.showRepeatDialog(message3,CheckCollectModifyActivity.this);
- // Toast.makeText(getApplicationContext(), message3,
- // Toast.LENGTH_SHORT).show();
- CustomToast.showToast(activity.getApplicationContext(), message3, 2000);
- activity.barcode.setEnabled(true);
- activity.barcode.setText("");
- activity.barcode.setFocusable(true);
- activity.barcode.setFocusableInTouchMode(true);
- activity.barcode.requestFocus();
- activity.barcode.findFocus();
- activity.barcode.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
- int dend) {
- return null;
- }
- } });
- CommonUtil.BarcodeMaxLength(activity.barcode, 50);
- activity.bugnotxt.setEnabled(true);
- activity.bugnotxt.setText("");
- activity.bugnotxt.setFocusable(true);
- activity.bugnotxt.setFocusableInTouchMode(true);
- activity.bugnotxt.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
- int dend) {
- return null;
- }
- } });
- activity.loctxt.setEnabled(true);
- activity.loctxt.setText("");
- activity.loctxt.setFocusable(true);
- activity.loctxt.setFocusableInTouchMode(true);
- activity.loctxt.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
- int dend) {
- return null;
- }
- } });
- break;
- case 3:
- ProcessDialogUtils.closeProgressDilog();
- Bundle b7 = msg.getData();
- int status7 = b7.getInt("status");
- String message7 = b7.getString("message");
- activity.save.setVisibility(View.GONE);
- activity.recordBug.setEnabled(false);
- CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, activity.getApplicationContext());
- CommonUtil.showBarCodeAlertDialog(status7, message7, activity, activity.barcode, activity.bugnotxt,
- activity.loctxt);
- if (activity.mHandler != null) {
- activity.mHandler.removeCallbacksAndMessages(null);
- activity.mHandler.getLooper().quit();
- }
- break;
- case 4:
- if (activity.mHandler != null) {
- activity.mHandler.removeCallbacksAndMessages(null);
- activity.mHandler.getLooper().quit();
- }
- ProcessDialogUtils.closeProgressDilog();
- Bundle b4 = msg.getData();
- String message4 = b4.getString("message");
- CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, activity.getApplicationContext());
- CustomToast.showToast(activity.getApplicationContext(), message4, 2000);
- activity.bugnotxt.setFocusable(true);
- activity.bugnotxt.requestFocus();
- break;
- case 5:
- if (activity.mHandler != null) {
- activity.mHandler.removeCallbacksAndMessages(null);
- activity.mHandler.getLooper().quit();
- }
- ProcessDialogUtils.closeProgressDilog();
- Bundle b5 = msg.getData();
- String message5 = b5.getString("message");
- CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, activity.getApplicationContext());
- // CommonUtil.showRepeatDialog(message5,CheckCollectModifyActivity.this);
- // Toast.makeText(getApplicationContext(), message5,
- // Toast.LENGTH_SHORT).show();
- CustomToast.showToast(activity.getApplicationContext(), message5, 2000);
- break;
- case 6:
- if (activity.mHandler != null) {
- activity.mHandler.removeCallbacksAndMessages(null);
- activity.mHandler.getLooper().quit();
- }
- ProcessDialogUtils.closeProgressDilog();
- Bundle b1 = msg.getData();
- String errmsg = b1.getString("errmsg");
- String missingFlag = b1.getString("flag");
- Intent intent = new Intent();
- Bundle b6 = new Bundle();
- b6.putString("msg", errmsg);
- b6.putString("missingFlag", missingFlag);
- intent.putExtras(b6);
- intent.setClass(activity, MissingScanActivity.class);
- activity.startActivityForResult(intent, 101);
- break;
- case 7:
- ProcessDialogUtils.closeProgressDilog();
- if (activity.mHandler != null) {
- activity.mHandler.removeCallbacksAndMessages(null);
- activity.mHandler.getLooper().quit();
- }
- Bundle b8 = msg.getData();
- String message8 = b8.getString("message");
- CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, activity.getApplicationContext());
- CommonUtil.showRepeatDialog(message8, activity);
- activity.barcode.setEnabled(true);
- activity.barcode.setText("");
- activity.barcode.setFocusable(true);
- activity.barcode.setFocusableInTouchMode(true);
- activity.barcode.requestFocus();
- activity.barcode.findFocus();
- activity.barcode.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
- int dend) {
- return null;
- }
- } });
- CommonUtil.BarcodeMaxLength(activity.barcode, 50);
- activity.bugnotxt.setEnabled(true);
- activity.bugnotxt.setText("");
- activity.bugnotxt.setFocusable(true);
- activity.bugnotxt.setFocusableInTouchMode(true);
- activity.bugnotxt.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
- int dend) {
- return null;
- }
- } });
- activity.loctxt.setEnabled(true);
- activity.loctxt.setText("");
- activity.loctxt.setFocusable(true);
- activity.loctxt.setFocusableInTouchMode(true);
- activity.loctxt.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
- int dend) {
- return null;
- }
- } });
- break;
- }
- }
- };
- private static class ResultHandler extends Handler {
- private final WeakReference mActivity;
- public ResultHandler(CheckCollectModifyActivity activity) {
- mActivity = new WeakReference(activity);
- }
- @Override
- public void handleMessage(Message msg) {
- final CheckCollectModifyActivity activity = (CheckCollectModifyActivity) mActivity.get();
- switch (msg.what) {
- case 0:
- String rest = msg.getData().getString("result");
- ProcessDialogUtils.closeProgressDilog();
- try {
- JSONObject jsonObject = new JSONObject(rest);
- jsonObject = jsonObject.getJSONObject("d");
- int status = jsonObject.getInt("Status");
- String message = jsonObject.getString("Message");
- String json = jsonObject.getString("Result");
- if (status == 0) {
- jsonObject = new JSONObject(json);
- String outErrMsg = jsonObject.optString("ErrMsg");
- if (outErrMsg.equals("null")) {
- activity.userID = jsonObject.getString("UserID");
- activity.worknouserCode = jsonObject.getString("UserCode");
- activity.workNoName = jsonObject.getString("UserName");
- activity.worknovalid = true;
- activity.barcode.setEnabled(true);
- activity.barcode.setFocusable(true);
- activity.barcode.setFocusableInTouchMode(true);
- activity.barcode.requestFocus();
- activity.barcode.findFocus();
- activity.barcode.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start, int end, Spanned dest,
- int dstart, int dend) {
- return null;
- }
- } });
- CommonUtil.BarcodeMaxLength(activity.barcode, 50);
- if (activity.collectType == 1) {
- activity.bugnotxt.setEnabled(true);
- activity.bugnotxt.setFocusable(true);
- activity.bugnotxt.setFocusableInTouchMode(true);
- activity.bugnotxt.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start, int end, Spanned dest,
- int dstart, int dend) {
- return null;
- }
- } });
- activity.loctxt.setEnabled(true);
- activity.loctxt.setFocusable(true);
- activity.loctxt.setFocusableInTouchMode(true);
- activity.loctxt.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start, int end, Spanned dest,
- int dstart, int dend) {
- return null;
- }
- } });
- activity.memoEdt.setEnabled(true);
- activity.memoEdt.setFocusable(true);
- activity.memoEdt.setFocusableInTouchMode(true);
- activity.memoEdt.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start, int end, Spanned dest,
- int dstart, int dend) {
- return null;
- }
- } });
- }
- if (activity.mHandler != null) {
- activity.mHandler.removeCallbacksAndMessages(null);
- activity.mHandler.getLooper().quit();
- }
- // ///////////////////////////////////////////////------yws--------------
- // InputMethodManager im =(InputMethodManager)
- // tvUserCode.getContext()
- // .getSystemService(Context.INPUT_METHOD_SERVICE);
- // im.hideSoftInputFromWindow(CheckCollectActivity.this.getCurrentFocus().getWindowToken(),InputMethodManager.HIDE_NOT_ALWAYS);
- } else {
- if (activity.mHandler != null) {
- activity.mHandler.removeCallbacksAndMessages(null);
- activity.mHandler.getLooper().quit();
- }
- activity.worknovalid = false;
- CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, activity.getApplicationContext());
- CommonUtil.showWorkNoAlertDialog(status, outErrMsg, activity, activity.worknoEdt,
- activity.barcode, activity.bugnotxt, activity.loctxt, activity.collectType);
- return;
- }
- } else {
- if (activity.mHandler != null) {
- activity.mHandler.removeCallbacksAndMessages(null);
- activity.mHandler.getLooper().quit();
- }
- activity.worknovalid = false;
- CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, activity.getApplicationContext());
- CommonUtil.showWorkNoAlertDialog(status, message, activity, activity.worknoEdt,
- activity.barcode, activity.bugnotxt, activity.loctxt, activity.collectType);
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- break;
- case 1:
- ProcessDialogUtils.closeProgressDilog();
- activity.save.setText("保存(" + activity.productBugList.size() + ")");
- // 调完baicode赋值 9527
- if (activity.mHandler != null) {
- activity.mHandler.removeCallbacksAndMessages(null);
- activity.mHandler.getLooper().quit();
- }
- Bundle b1 = msg.getData();
- activity.listProductClassify = (List<ProductClassifyInfo>) b1.getSerializable("productclassifylist");
- activity.productNumber.setText(activity.productionInfo.getBarCode());
- activity.productCode.setText(activity.productionInfo.getGoodsCode());
- activity.productName.setText(activity.productionInfo.getGoodsName());
- String trademarkName = activity.productionInfo.getTrademarkName();
- if (trademarkName.equals("null")) {
- activity.trademarkNameTxt.setText("");
- } else {
- activity.trademarkNameTxt.setText(trademarkName);
- }
- // productionInfo.setOut_LeakFlag1Name(jsonObject31.optString("out_LeakFlag1Name"));//漏气
- // productionInfo.setOut_LeakFlag4Name(jsonObject31.optString("out_LeakFlag4Name"));//养水
- // productionInfo.setOut_LeakFlag5Name(jsonObject31.optString("out_LeakFlag5Name"));//试水
- // productionInfo.setLeakFlag4TablePOSITION(jsonObjectleakFlag4Table.optString("POSITION"));//养水 不合格位置
- // productionInfo.setLeakFlag5TablePOSITION(jsonObjectleakFlag5Table.optString("POSITION"));//试水 不合格位置
- activity.refineEdt.setText(activity.refireName);
- activity.repairEdt.setText(activity.specialRepairFlagName);
- activity.tvLeak.setText(activity.productionInfo.getLeak());
- // 回显 漏气 养水 试水
- if ("不合格".equals(activity.productionInfo.getOut_LeakFlag1Name())) { // 漏气
- activity.check_leak.setSelection(1, true);
- }
- if ("不合格".equals(activity.productionInfo.getOut_LeakFlag4Name())) {// 养水
- activity.check_nourishing_water.setSelection(1, true);
- }
- if ("不合格".equals(activity.productionInfo.getOut_LeakFlag5Name())) {// 试水
- activity.check_water_test.setSelection(1, true);
- }
- if ("不合格".equals(activity.productionInfo.getOut_LeakFlag7Name())) {// 修磨
- activity.check_grinding_test.setSelection(1, true);
- }
- if (!"".equals(activity.mCheckRepairCrackPositionDate)) { // 如果有补裂位置 那就赋值
- activity.check_repair_crack_position.setText(activity.mCheckRepairCrackPositionDate);
- }
- // 回显 养水不合格位置 试水不合格位置 todo
- // if ((activity.title.getText().toString().indexOf("养水") != -1)
- // || (activity.title.getText().toString().indexOf("试水") != -1)) {
- for (int i = 0; i < activity.listCheckNourishingWaterPosition.size(); i++) {
- if (activity.listCheckNourishingWaterPosition.get(i).getDefectFlagName()
- .equals(activity.productionInfo.getLeakFlag4TablePOSITION())) {
- activity.adapterCheckNourishingWaterPosition = new ProductClassifyAdapter(
- activity.listCheckNourishingWaterPosition, activity.getApplicationContext());
- activity.check_nourishing_water_position
- .setAdapter(activity.adapterCheckNourishingWaterPosition);
- activity.check_nourishing_water_position.setPrompt("请选择");
- activity.check_nourishing_water_position.setSelection(i, true);
- }
- }
- if (activity.title.getText().toString().indexOf("试水") != -1) {
- // for (int i = 0; i < activity.listCheckWaterTestPosition.size(); i++) {
- // if (activity.listCheckWaterTestPosition.get(i).getDefectFlagName()
- // .equals(activity.productionInfo.getLeakFlag5TablePOSITION())) {
- // activity.adapterCheckWaterTestPosition = new ProductClassifyAdapter(activity.listCheckWaterTestPosition,
- // activity.getApplicationContext());
- //
- // activity.check_water_test_position.setAdapter(activity.adapterCheckWaterTestPosition);
- // activity.check_nourishing_water_position.setPrompt("请选择");
- // activity.check_water_test_position.setSelection(i, true);
- // }
- // }
- // 根本就不用带出试水的回显数据
- // }
- }
- // 回显下标划线
- if (activity.proId == 125) {
- for (int i = 0; i < activity.listCheckOfflineIdentificatio.size(); i++) {
- if ((activity.listCheckOfflineIdentificatio.get(i).getDefectFlagId() + "")
- .equals(activity.productionInfo.getOfflineFlag())) {
- activity.adapterCheckOfflineIdentificatio = new ProductClassifyAdapter(
- activity.listCheckOfflineIdentificatio, activity.getApplicationContext());
- activity.check_offline_identificatio.setAdapter(activity.adapterCheckOfflineIdentificatio);
- activity.check_offline_identificatio.setPrompt("请选择");
- activity.check_offline_identificatio.setSelection(i, true);
- }
- }
- }
- activity.tvInternalLeak.setText(activity.productionInfo.getInternalLeak());
- activity.tvPassBall.setText(activity.productionInfo.getPassBall());
- activity.barcode.setEnabled(true);
- activity.barcode.setText("");
- activity.barcode.setFocusable(true);
- activity.barcode.setFocusableInTouchMode(true);
- activity.barcode.requestFocus();
- activity.barcode.findFocus();
- activity.barcode.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
- int dend) {
- return null;
- }
- } });
- CommonUtil.BarcodeMaxLength(activity.barcode, 50);
- activity.bugnotxt.setEnabled(true);
- activity.bugnotxt.setText("");
- activity.bugnotxt.setFocusable(true);
- activity.bugnotxt.setFocusableInTouchMode(true);
- activity.bugnotxt.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
- int dend) {
- return null;
- }
- } });
- activity.loctxt.setEnabled(true);
- activity.loctxt.setText("");
- activity.loctxt.setFocusable(true);
- activity.loctxt.setFocusableInTouchMode(true);
- activity.loctxt.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
- int dend) {
- return null;
- }
- } });
- activity.adapterProductClassify = new ProductClassifyAdapter(activity.listProductClassify, activity);
- activity.classifySpin.setAdapter(activity.adapterProductClassify);
- activity.classifySpin.setPrompt("请选择产品分级");
- if (activity.productionInfo != null) {
- // int position = CommonUtil.getProductClassifyIndex(activity.productionInfo.getGoodsLevelTypeId(),
- // activity.listProductClassify);
- //
- // activity.classifySpin.setSelection(position);
- // 回显 产品分级
- for (int i = 0; i < activity.listProductClassify.size(); i++) {
- String a = activity.listProductClassify.get(i).getDefectFlagId() + "";
- String b = activity.productionInfo.getOut_Grade() + "";
- if (activity.listProductClassify.get(i).getDefectFlagId() == activity.productionInfo
- .getOut_Grade()) {
- activity.classifySpin.setSelection(i, true);
- }
- }
- if (!(activity.proId == 123 || activity.proId == 157)) { // 养水 3#修模
- activity.classifySpin.setEnabled(true);
- }
- }
- // endTime=System.currentTimeMillis();
- // long time=endTime-startTime;
- // Toast.makeText(getApplicationContext(),time+"",Toast.LENGTH_LONG).show();
- // System.out.println(time+"time");
- if (activity.operationFlag.equals("modify")) {
- activity.productBugList = (List<ProductDefectInfo>) b1.getSerializable("productbuglist");
- activity.mAdapter = new SwipeAdapter(activity, activity.mListView.getRightViewWidth(),
- activity.ServerAddress_ip, activity.ServerAddress_duankou, activity.accountCode,
- activity.checkCollectModify_userCode, activity.password, activity.sessionkey,
- activity.productBugList);
- activity.mListView.setAdapter(activity.mAdapter);
- activity.save.setText("保存(" + activity.productBugList.size() + ")");
- activity.memoEdt.setText(activity.productionInfo.getRemarks());
- activity.mAdapter.setOnRightItemClickListener(new SwipeAdapter.onRightItemClickListener() {
- @Override
- public void onRightItemClick(View v, int position) {
- if (!activity.overdueFlag) {
- ProductDefectInfo defectInfo = activity.productBugList.get(position);
- if (defectInfo.getDeleteFlag().equals("server")) {
- activity.deleteFlag = true;
- }
- activity.mListView.deleteItem(activity.mListView.getChildAt(position));
- activity.productBugList.remove(position);
- activity.save.setText("保存(" + activity.productBugList.size() + ")");
- activity.mAdapter.notifyDataSetChanged();
- }
- }
- });
- }
- break;
- case 2:// 产品分级
- try {
- Bundle b = msg.getData();
- String rest1 = b.getString("result");
- JSONObject jsonObject1 = new JSONObject(rest1);
- JSONObject jsonobject2 = jsonObject1.getJSONObject("d");
- int status1 = jsonobject2.getInt("Status");
- String message1 = jsonobject2.getString("Message");
- if (status1 == 0) {
- String json1 = jsonobject2.getString("Result");
- JSONArray jsonArray = new JSONArray(json1);
- activity.listProductClassify = new ArrayList<ProductClassifyInfo>();
- for (int i = 0; i < jsonArray.length(); i++) {
- activity.classifyInfo = new ProductClassifyInfo();
- JSONObject jsonObject2 = (JSONObject) jsonArray.get(i);
- activity.classifyInfo.setGoodsLevelTypeID((int) jsonObject2.getDouble("GOODSLEVELTYPEID"));
- activity.classifyInfo.setDefectFlagName(jsonObject2.getString("DEFECTFLAGNAME"));
- activity.classifyInfo.setDefectFlagId((int) jsonObject2.getInt("DEFECTFLAGID"));
- activity.listProductClassify.add(i, activity.classifyInfo);
- }
- activity.adapterProductClassify = new ProductClassifyAdapter(activity.listProductClassify,
- activity);
- // 第四步:将适配器添加到下拉列表上
- activity.classifySpin.setAdapter(activity.adapterProductClassify);
- activity.classifySpin.setPrompt("请选择产品分级");
- if (activity.productionInfo != null) {
- int position = CommonUtil.getProductClassifyIndex(
- activity.productionInfo.getGoodsLevelTypeId(), activity.listProductClassify);
- activity.classifySpin.setSelection(position);
- }
- if (activity.mHandler != null) {
- activity.mHandler.removeCallbacksAndMessages(null);
- activity.mHandler.getLooper().quit();
- }
- } else {
- if (activity.mHandler != null) {
- activity.mHandler.removeCallbacksAndMessages(null);
- activity.mHandler.getLooper().quit();
- }
- CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, activity.getApplicationContext());
- CommonUtil.showAlertDialog(status1, message1, activity);
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- break;
- case 3:// 跳转工序
- try {
- Bundle b = msg.getData();
- String rest2 = b.getString("result");
- JSONObject jsonObject1 = new JSONObject(rest2);
- JSONObject jsonObject2 = jsonObject1.getJSONObject("d");
- int status2 = jsonObject2.getInt("Status");
- String message2 = jsonObject2.getString("Message");
- if (status2 == 0) {
- String json1 = jsonObject2.getString("Result");
- JSONArray jsonArray = new JSONArray(json1);
- int goodsLevelTypeID = activity.classifyInfo.getGoodsLevelTypeID();// 所选产品分级类型
- activity.listReWorkProcedure = new ArrayList<ReworkProcedureInfo>();
- for (int i = 0; i < jsonArray.length(); i++) {
- ReworkProcedureInfo reworkProcedureInfo1 = new ReworkProcedureInfo();
- JSONObject object = (JSONObject) jsonArray.get(i);
- reworkProcedureInfo1
- .setReworkProcedureID(String.valueOf(object.getDouble("REWORKPROCEDUREID")));
- reworkProcedureInfo1.setReworkProcedureName(object.getString("REWORKPROCEDURENAME"));
- if (goodsLevelTypeID == 6 && object.getString("REWORKPROCEDURENAME").contains("重烧")) {
- // 重烧
- activity.listReWorkProcedure.add(reworkProcedureInfo1);
- }
- if (goodsLevelTypeID == 16 && object.getString("REWORKPROCEDURENAME").contains("冷补")) {
- // 冷补
- activity.listReWorkProcedure.add(reworkProcedureInfo1);
- }
- }
- activity.adapterReWorkProcedure = new ReworkProcedureSpinnerAdapter(activity,
- activity.listReWorkProcedure);
- activity.gotoSpin.setPrompt("请选择跳转工序");
- activity.gotoSpin.setAdapter(activity.adapterReWorkProcedure);
- int position = 0;
- // if (activity.operationFlag.equals("modify")) {
- if (goodsLevelTypeID == 6) { // 重烧进 大件默认重烧接收 小件 默认重烧交接 根据GOODSMODELforCheck 包不包含CT 判断
- if (activity.listReWorkProcedure != null && activity.listReWorkProcedure.size() > 0) {
- String GOODSMODELforCheck = activity.GOODSMODELforCheck.substring(0, 2);
- for (int i = 0; i < activity.listReWorkProcedure.size(); i++) {
- // if ("CT".equals(GOODSMODELforCheck)) {
- if ("1".equals(refireflag)) {
- if (activity.listReWorkProcedure.get(i).getReworkProcedureName()
- .contains("重烧接收")) {
- position = i;
- break;
- }
- } else {
- if (activity.listReWorkProcedure.get(i).getReworkProcedureName()
- .contains("重烧交接")) {
- position = i;
- break;
- }
- }
- }
- }
- } else if (goodsLevelTypeID == 16) { // 冷补
- // if (activity.productionInfo.getReworkProcedureId() > 0) {
- // if (activity.listReWorkProcedure != null && activity.listReWorkProcedure.size() > 0) {
- // for (int i = 0; i < activity.listReWorkProcedure.size(); i++) {
- // if ((int) Double.parseDouble(activity.listReWorkProcedure.get(i)
- // .getReworkProcedureID()) == activity.productionInfo
- // .getReworkProcedureId()) {
- // position = i;
- // break;
- // }
- // }
- // }
- // } else {
- if (activity.listReWorkProcedure != null && activity.listReWorkProcedure.size() > 0) {
- if (!"136".equals(Mout_ReworkProcedureId)) {
- for (int i = 0; i < activity.listReWorkProcedure.size(); i++) {
- if ((int) Double.parseDouble(
- activity.listReWorkProcedure.get(i).getReworkProcedureID()) == 153) {
- position = i;
- break;
- }
- }
- }
- }
- // }
- } else {
- if (activity.productionInfo.getReworkProcedureId() > 0) {
- if (activity.listReWorkProcedure != null && activity.listReWorkProcedure.size() > 0) {
- for (int i = 0; i < activity.listReWorkProcedure.size(); i++) {
- if ((int) Double.parseDouble(activity.listReWorkProcedure.get(i)
- .getReworkProcedureID()) == activity.productionInfo
- .getReworkProcedureId()) {
- position = i;
- break;
- }
- }
- }
- }
- }
- // }
- // 2023年10月16日
- // if ((activity.proId == 125) || (activity.proId == 131)) { // 三检 显示
- // if (goodsLevelTypeID == 16) { // 产品分级选择冷补的时候 给冷补类型赋值 其他清空
- // activity.adapterCheckColdRepairCategory = new ProductClassifyAdapter(
- // activity.listCheckColdRepairCategory, activity.getApplicationContext());
- // activity.check_cold_repair_category.setAdapter(activity.adapterCheckColdRepairCategory);
- // }
- //
- // }
- // 只有一个选项的时候,默认选中
- activity.gotoSpin.setSelection(position);
- if (activity.mHandler != null) {
- activity.mHandler.removeCallbacksAndMessages(null);
- activity.mHandler.getLooper().quit();
- }
- if (goodsLevelTypeID != 6) { // 不是重烧 就可以放开
- activity.gotoSpin.setEnabled(true);
- }
- } else {
- if (activity.mHandler != null) {
- activity.mHandler.removeCallbacksAndMessages(null);
- activity.mHandler.getLooper().quit();
- }
- CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, activity.getApplicationContext());
- CommonUtil.showAlertDialog(status2, message2, activity);
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- break;
- case 4:
- String rest2 = msg.getData().getString("result");
- ProcessDialogUtils.closeProgressDilog();
- repeatFlag = System.currentTimeMillis() + "-" + checkCollectModify_userCode;
- try {
- JSONObject jsonObject4 = new JSONObject(rest2);
- JSONObject jsonObject5 = jsonObject4.getJSONObject("d");
- int status2 = jsonObject5.getInt("Status");
- String message2 = jsonObject5.getString("Message");
- activity.dryRepairFlag = false;
- if (activity.collectType == 1) {
- activity.worknovalid = false;
- }
- if (status2 == 0) {
- //2023年10月16日
- // if ((activity.proId == 125) || (activity.proId == 131)) { // 三检 显示
- // // 保存完事 清除冷补类别
- // activity.adapterCheckColdRepairCategory = new ProductClassifyAdapter(activity.list_null,
- // activity.getApplicationContext());
- // activity.check_cold_repair_category.setAdapter(activity.adapterCheckColdRepairCategory);
- // activity.check_cold_repair_category.setEnabled(false);
- //
- // }
- // 保存成功把 漏气 养水 养水不合格位置 试水 试水不合格位置 还原
- activity.check_leak.setSelection(0, true);
- activity.check_nourishing_water.setSelection(0, true);
- activity.check_water_test.setSelection(0, true);
- activity.adapterCheckNourishingWaterPosition = new ProductClassifyAdapter(activity.list_null,
- activity.getApplicationContext());
- activity.check_nourishing_water_position
- .setAdapter(activity.adapterCheckNourishingWaterPosition);
- activity.check_nourishing_water_position.setPrompt("请选择");
- activity.adapterCheckWaterTestPosition = new ProductClassifyAdapter(activity.list_null,
- activity.getApplicationContext());
- activity.check_water_test_position.setAdapter(activity.adapterCheckWaterTestPosition);
- activity.check_nourishing_water_position.setPrompt("请选择");
- activity.adapterCheckOfflineIdentificatio = new ProductClassifyAdapter(
- activity.listCheckOfflineIdentificatio, activity.getApplicationContext());
- activity.check_offline_identificatio.setAdapter(activity.adapterCheckOfflineIdentificatio);
- String Result = jsonObject5.getString("Result");
- if (Result.equals("")) {
- // barcode.setText("");
- activity.save.setEnabled(true);
- activity.deleteFlag = false;
- activity.originalGoodsLevelTypeId = 0;
- // barcode.setFocusable(true);
- // barcode.requestFocus();
- activity.productNumber.setText("");
- activity.productCode.setText("");
- activity.productName.setText("");
- activity.defectflag = 1;
- activity.refineEdt.setText("");
- activity.repairEdt.setText("");
- activity.tvLeak.setText("");
- activity.tvInternalLeak.setText("");
- activity.tvPassBall.setText("");
- activity.bugnotxt.setText("");
- activity.bugnametxt.setText("");
- activity.loctxt.setText("");
- activity.tvLocName.setText("");
- activity.check_repair_crack_position.setText("");
- activity.mCheckRepairCrackPositionDate = "";// 清除补裂位置
- activity.memoEdt.setText("");
- activity.trademarkNameTxt.setText("");
- activity.mCheckRepairCrackPositionDate = "";
- if (activity.collectType == 1) { // 采集类型:1-集中 2-单点
- activity.worknovalid = false;
- activity.worknoEdt.setEnabled(true);
- activity.worknoEdt.setText("");
- activity.worknoEdt.setFocusable(true);
- activity.worknoEdt.setFocusableInTouchMode(true);
- activity.worknoEdt.requestFocus();
- activity.worknoEdt.findFocus();
- activity.worknoEdt.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start, int end, Spanned dest,
- int dstart, int dend) {
- return null;
- }
- } });
- } else {
- activity.barcode.setEnabled(true);
- activity.barcode.setText("");
- activity.barcode.setFocusable(true);
- activity.barcode.setFocusableInTouchMode(true);
- activity.barcode.requestFocus();
- activity.barcode.findFocus();
- activity.barcode.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start, int end, Spanned dest,
- int dstart, int dend) {
- return null;
- }
- } });
- CommonUtil.BarcodeMaxLength(activity.barcode, 50);
- }
- activity.footerdivider.setVisibility(View.GONE);
- // saveEnd=System.currentTimeMillis();
- // long saveTime= saveEnd-saveStart;
- // Toast.makeText(getApplicationContext(),saveTime+"save",Toast.LENGTH_LONG).show();
- // System.out.println(saveTime+"save");
- CommonUtil.playSound(activity.getApplicationContext());
- // Toast.makeText(getApplicationContext(), "上传成功",
- // Toast.LENGTH_SHORT).show();
- CustomToast.showToast(activity.getApplicationContext(), "上传成功", 2000);
- if (activity.classifySpin.getSelectedItem() != null) {
- activity.listProductClassify.removeAll(activity.listProductClassify);
- if (activity.adapterProductClassify != null) {
- activity.adapterProductClassify.notifyDataSetChanged();
- }
- activity.classifySpin.setEnabled(false);
- }
- if (activity.gotoSpin.getSelectedItem() != null) {
- activity.listReWorkProcedure.clear();
- if (activity.adapterReWorkProcedure != null) {
- activity.adapterReWorkProcedure.notifyDataSetChanged();
- }
- activity.gotoSpin.setEnabled(false);
- }
- //
- // if (mAdapter != null
- // && mAdapter.bitmapCache.size() > 0) {
- // ViewUtil.FreeBitmap(mAdapter.bitmapCache);
- // }
- if (activity.productBugList != null && activity.productBugList.size() > 0) {
- for (ProductDefectInfo p1 : activity.productBugList) {
- List<ImagePath> imagepathlist = p1.getDefectImgPath();
- for (ImagePath path : imagepathlist) {
- String localpath = path.getLocalPath();
- File f = new File(localpath);
- if (f.exists()) {
- f.delete();
- }
- }
- }
- activity.productBugList.removeAll(activity.productBugList);
- activity.mAdapter.notifyDataSetChanged();
- activity.save.setText("保存(" + activity.productBugList.size() + ")");
- }
- if (activity.mHandler != null) {
- activity.mHandler.removeCallbacksAndMessages(null);
- activity.mHandler.getLooper().quit();
- }
- } else {
- // Toast.makeText(CheckCollectActivity.this,
- // Result, Toast.LENGTH_LONG).show();
- if (activity.mHandler != null) {
- activity.mHandler.removeCallbacksAndMessages(null);
- activity.mHandler.getLooper().quit();
- }
- activity.save.setEnabled(true);
- CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, activity.getApplicationContext());
- CommonUtil.showSaveAlertDialog(status2, Result, activity, activity.worknoEdt,
- activity.barcode, activity.collectType);
- return;
- }
- } else if (status2 == 2) {
- if (activity.mHandler != null) {
- activity.mHandler.removeCallbacksAndMessages(null);
- activity.mHandler.getLooper().quit();
- }
- return;
- } else {
- if (activity.mHandler != null) {
- activity.mHandler.removeCallbacksAndMessages(null);
- activity.mHandler.getLooper().quit();
- }
- activity.save.setEnabled(true);
- CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, activity.getApplicationContext());
- CommonUtil.showSaveAlertDialog(status2, message2, activity, activity.worknoEdt,
- activity.barcode, activity.collectType);
- return;
- }
- } catch (JSONException e) {
- if (activity.mHandler != null) {
- activity.mHandler.removeCallbacksAndMessages(null);
- activity.mHandler.getLooper().quit();
- }
- e.printStackTrace();
- }
- break;
- case 6:
- Bundle b = msg.getData();
- try {
- String json = b.getString("bugnoResult");
- ProcessDialogUtils.closeProgressDilog();
- JSONObject j = new JSONObject(json);
- JSONObject jo = (JSONObject) j.opt("d");
- int status = jo.optInt("Status");
- String message = jo.optString("Message");
- // InputMethodManager im1 = (InputMethodManager) bugnotxt
- // .getContext().getSystemService(
- // Context.INPUT_METHOD_SERVICE);
- // im1.hideSoftInputFromWindow(CheckCollectModifyActivity.this
- // .getCurrentFocus().getWindowToken(),
- // InputMethodManager.HIDE_NOT_ALWAYS);
- if (status == 0) {
- String result = jo.optString("Result");
- JSONObject jre = new JSONObject(result);
- String errmsg = jre.optString("ErrMsg");
- if (errmsg.equals("")) {
- activity.defectnovalid = true;
- // Toast.makeText(ProductBugActivity.this, "缺陷号正确",
- // Toast.LENGTH_LONG).show();
- activity.defectNo = new DefectNo();
- activity.defectId = jre.optInt("DefectID");
- activity.defectNo.setDefectId(activity.defectId);
- activity.defectName = jre.optString("DefectName");
- activity.defectNo.setDefectName(activity.defectName);
- activity.defectNo.setDefectCode(activity.defectno);
- activity.bugnametxt.setText(activity.defectName);
- activity.loctxt.setFocusable(true);
- activity.loctxt.requestFocus();
- if (activity.mHandler != null) {
- activity.mHandler.removeCallbacksAndMessages(null);
- activity.mHandler.getLooper().quit();
- }
- } else {
- activity.bugnotxt.setText("");
- activity.bugnametxt.setText("");
- activity.bugnotxt.setFocusable(true);
- activity.bugnotxt.requestFocus();
- CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, activity.getApplicationContext());
- CommonUtil.showAlertDialog(status, errmsg, activity);
- return;
- }
- } else {
- CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, activity.getApplicationContext());
- CommonUtil.showAlertDialog(status, message, activity);
- return;
- }
- } catch (Exception e) {
- }
- break;
- case 7:
- Bundle b2 = msg.getData();
- String json = b2.getString("buglocResult");
- try {
- ProcessDialogUtils.closeProgressDilog();
- JSONObject j = new JSONObject(json);
- JSONObject jo = (JSONObject) j.opt("d");
- int status = jo.optInt("Status");
- String message = jo.optString("Message");
- activity.hintKb(activity.loctxt);
- if (status == 0) {
- String result = jo.optString("Result");
- JSONObject jre = new JSONObject(result);
- String errmsg = jre.optString("ErrMsg");
- if (errmsg.equals("")) {
- activity.defectlocationvalid = true;
- int defectPositionId = jre.optInt("DefectPositionID");
- String defectPositionName = jre.optString("DefectPositionName");
- activity.dl = new DefectLocation();
- activity.dl.setDefectPositionId(defectPositionId);
- activity.dl.setDefectPositionCode(activity.defectLocation);
- activity.dl.setDefectPositionName(defectPositionName);
- if (activity.mHandler != null) {
- activity.mHandler.removeCallbacksAndMessages(null);
- activity.mHandler.getLooper().quit();
- }
- activity.tvLocName.setText(defectPositionName);
- } else {
- activity.defectlocationvalid = false;
- activity.loctxt.setText("");
- activity.loctxt.setFocusable(true);
- activity.loctxt.requestFocus();
- activity.tvLocName.setText("");
- CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, activity.getApplicationContext());
- CommonUtil.showAlertDialog(status, errmsg, activity);
- if (activity.mHandler != null) {
- activity.mHandler.removeCallbacksAndMessages(null);
- activity.mHandler.getLooper().quit();
- }
- return;
- }
- } else {
- if (activity.mHandler != null) {
- activity.mHandler.removeCallbacksAndMessages(null);
- activity.mHandler.getLooper().quit();
- }
- CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, activity.getApplicationContext());
- CommonUtil.showAlertDialog(status, message, activity);
- }
- } catch (JSONException e) {
- if (activity.mHandler != null) {
- activity.mHandler.removeCallbacksAndMessages(null);
- activity.mHandler.getLooper().quit();
- }
- e.printStackTrace();
- }
- break;
- case 8:
- String rest8 = msg.getData().getString("result");
- ProcessDialogUtils.closeProgressDilog();
- try {
- activity.listCheckLeak = new ArrayList<ProductClassifyInfo>();// 漏气数据源
- activity.listCheckNourishingWater = new ArrayList<ProductClassifyInfo>();// 养水数据源
- activity.listCheckNourishingWaterPosition = new ArrayList<ProductClassifyInfo>();// 养水不合格位置数据源
- activity.listCheckWaterTest = new ArrayList<ProductClassifyInfo>();// 试水数据源
- JSONArray jarray = new JSONArray(rest8);
- // 养水的时候 才给养水不合格位置 赋值
- if (jarray != null && jarray.length() > 0) {
- for (int i = 0; i < jarray.length(); i++) {
- activity.classifyInfo = new ProductClassifyInfo();
- JSONObject jsonObject2 = (JSONObject) jarray.get(i);
- activity.classifyInfo.setDefectFlagType(jsonObject2.optString("DICTIONARYTYPE"));
- activity.classifyInfo.setDefectFlagName(jsonObject2.optString("DICTIONARYVALUE"));
- activity.classifyInfo.setDefectFlagId((int) jsonObject2.getInt("DICTIONARYID"));
- activity.listCheckNourishingWaterPosition.add(i, activity.classifyInfo);
- }
- }
- // 给漏气 养水 试水 赋上 合格和不合格 数据源
- activity.classifyInfo = new ProductClassifyInfo();
- activity.classifyInfo.setDefectFlagType("");
- activity.classifyInfo.setDefectFlagName("合格");
- activity.classifyInfo.setDefectFlagId(1);
- activity.listCheckLeak.add(0, activity.classifyInfo);
- activity.listCheckNourishingWater.add(0, activity.classifyInfo);
- activity.listCheckWaterTest.add(0, activity.classifyInfo);
- activity.classifyInfo = new ProductClassifyInfo();
- activity.classifyInfo.setDefectFlagType("");
- activity.classifyInfo.setDefectFlagName("不合格");
- activity.classifyInfo.setDefectFlagId(0);
- activity.listCheckLeak.add(1, activity.classifyInfo);
- activity.listCheckNourishingWater.add(1, activity.classifyInfo);
- activity.listCheckWaterTest.add(1, activity.classifyInfo);
- activity.adapterCheckLeak = new ProductClassifyAdapter(activity.listCheckLeak,
- activity.getApplicationContext());
- activity.adapterCheckNourishingWater = new ProductClassifyAdapter(activity.listCheckNourishingWater,
- activity.getApplicationContext());
- activity.adapterCheckWaterTest = new ProductClassifyAdapter(activity.listCheckWaterTest,
- activity.getApplicationContext());
- // 第四步:将适配器添加到下拉列表上
- activity.check_leak.setAdapter(activity.adapterCheckLeak);
- activity.check_nourishing_water.setAdapter(activity.adapterCheckNourishingWater);
- activity.check_water_test.setAdapter(activity.adapterCheckWaterTest);
- activity.check_leak.setPrompt("请选择是否合格");
- activity.check_nourishing_water.setPrompt("请选择是否合格");
- activity.check_water_test.setPrompt("请选择是否合格");
- } catch (JSONException e) {
- if (activity.mHandler != null) {
- activity.mHandler.removeCallbacksAndMessages(null);
- activity.mHandler.getLooper().quit();
- }
- e.printStackTrace();
- }
- break;
- case 9:
- String rest9 = msg.getData().getString("result");
- ProcessDialogUtils.closeProgressDilog();
- try {
- activity.listCheckWaterTestPosition = new ArrayList<ProductClassifyInfo>();// 试水不合格位置数据源
- JSONArray jarray = new JSONArray(rest9);
- // 试水的时候 才给试水不合格位置 赋值
- if (jarray != null && jarray.length() > 0) {
- for (int i = 0; i < jarray.length(); i++) {
- activity.classifyInfo = new ProductClassifyInfo();
- JSONObject jsonObject2 = (JSONObject) jarray.get(i);
- activity.classifyInfo.setDefectFlagType(jsonObject2.optString("DICTIONARYTYPE"));
- activity.classifyInfo.setDefectFlagName(jsonObject2.optString("DICTIONARYVALUE"));
- activity.classifyInfo.setDefectFlagId((int) jsonObject2.getInt("DICTIONARYID"));
- activity.listCheckWaterTestPosition.add(i, activity.classifyInfo);
- }
- }
- } catch (JSONException e) {
- if (activity.mHandler != null) {
- activity.mHandler.removeCallbacksAndMessages(null);
- activity.mHandler.getLooper().quit();
- }
- e.printStackTrace();
- }
- break;
- case 10:
- Bundle bproductbuglist = msg.getData();
- activity.productBugList = (List<ProductDefectInfo>) bproductbuglist.getSerializable("productbuglist");
- activity.mAdapter = new SwipeAdapter(activity, activity.mListView.getRightViewWidth(),
- activity.ServerAddress_ip, activity.ServerAddress_duankou, activity.accountCode,
- activity.checkCollectModify_userCode, activity.password, activity.sessionkey,
- activity.productBugList);
- activity.mListView.setAdapter(activity.mAdapter);
- activity.mAdapter.setOnRightItemClickListener(new SwipeAdapter.onRightItemClickListener() {
- @Override
- public void onRightItemClick(View v, int position) {
- if (!activity.overdueFlag) {
- ProductDefectInfo defectInfo = activity.productBugList.get(position);
- if (defectInfo.getDeleteFlag().equals("server")) {
- activity.deleteFlag = true;
- }
- activity.mListView.deleteItem(activity.mListView.getChildAt(position));
- activity.productBugList.remove(position);
- activity.save.setText("保存(" + activity.productBugList.size() + ")");
- activity.mAdapter.notifyDataSetChanged();
- }
- }
- });
- break;
- case 11: // 补裂位置
- String rest11 = msg.getData().getString("result");
- ProcessDialogUtils.closeProgressDilog();
- try {
- activity.listCheckRepairCrackPosition = new ArrayList<ProductClassifyInfo>();// 试水不合格位置数据源
- JSONArray jarray = new JSONArray(rest11);
- // 试水的时候 才给试水不合格位置 赋值
- if (jarray != null && jarray.length() > 0) {
- activity.mList = new ArrayList();
- for (int i = 0; i < jarray.length(); i++) {
- JSONObject jsonObject2 = (JSONObject) jarray.get(i);
- activity.mList.add(jsonObject2.optString("DICTIONARYVALUE"));
- }
- activity.mPopup = new PopupWindowCheckChoose(activity, activity.mList);
- // * 设置ListView的选择模式
- // * 多选:AbsListView.CHOICE_MODE_MULTIPLE
- // * 单选:AbsListView.CHOICE_MODE_SINGLE
- activity.mPopup.setTagTxt("补裂位置")// 设置顶部title的内容
- .setButtomTxt("确认")// 设置底部按钮内容
- .setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE);// 单选
- activity.mPopup.setOnEventLisenter(new onEventLisenter() {
- @Override
- public void onItemClick(ArrayList<String> positionList) {
- // mTvContent.setText(mList.get(positionList.get(0)));
- StringBuffer resultBuffer = new StringBuffer();
- for (int i = 0; i < positionList.size(); i++) {
- String result = positionList.get(i);
- if (i == 0) {
- resultBuffer.append(result);
- } else {
- resultBuffer.append("," + result);
- }
- }
- String testResult = resultBuffer.toString();
- // Toast.makeText(activity.getApplicationContext(),testResult, Toast.LENGTH_SHORT).show();
- activity.mCheckRepairCrackPositionDate = testResult;
- activity.check_repair_crack_position.setText(activity.mCheckRepairCrackPositionDate);
- activity.mPopup.dismiss();
- }
- });
- }
- } catch (JSONException e) {
- if (activity.mHandler != null) {
- activity.mHandler.removeCallbacksAndMessages(null);
- activity.mHandler.getLooper().quit();
- }
- e.printStackTrace();
- }
- break;
- }
- }
- };
- private void hintKb(View v) {
- InputMethodManager im = (InputMethodManager) v.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
- im.hideSoftInputFromWindow(v.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
- }
- private class BarcodeRunnable implements Runnable {
- String barcode;
- Object obj;
- public BarcodeRunnable(String barcode, Object obj) {
- this.barcode = barcode;
- this.obj = obj;
- }
- @Override
- public void run() {
- synchronized (obj) {
- try {
- {// 2023/2/23 为了获取大件小件标识
- JSONObject jsonObject28 = new JSONObject();
- jsonObject28.put("accountCode", accountCode);
- jsonObject28.put("userCode", checkCollectModify_userCode);
- jsonObject28.put("userPassword", password);
- jsonObject28.put("sessionKey", sessionkey);
- jsonObject28.put("procedureID", proId);// 工序ID,菜单页面传过来的
- jsonObject28.put("barcode", barcode);// 产品条码
- WebClient client = new WebClient();
- String result28 = client.doPost(
- "http://" + ServerAddress_ip + ":" + ServerAddress_duankou + Constants.BAR_CODE_VALID,
- jsonObject28.toString(), "application/json");
- JSONObject jsonObject29 = new JSONObject(result28);
- JSONObject jsonObject30 = jsonObject29.getJSONObject("d");
- int status30 = jsonObject30.getInt("Status");
- String message30 = jsonObject30.getString("Message");
- String result30 = jsonObject30.getString("Result");
- JSONArray jsonArray321 = new JSONArray(result30);
- JSONObject jsonObject331 = (JSONObject) jsonArray321.get(0);
- String outErrMsg331 = jsonObject331.getString("out_errMsg");
- String missFlag = jsonObject331.optString("out_missFlag");
- Mout_ReworkProcedureId = jsonObject331.optString("out_ReworkProcedureId");
- if (status30 == 0) {
- if (!TextUtils.isEmpty(outErrMsg331)) {// 2023/3/10
- if (missFlag.equals("0")) {
- Message m = new Message();
- Bundle b = new Bundle();
- b.putInt("status", status30);
- b.putString("errorMsg", outErrMsg331);
- m.what = 0;
- m.setData(b);
- exceptionHandler.sendMessage(m);
- return;
- } else {
- Message m1 = new Message();
- Bundle b1 = new Bundle();
- b1.putString("errmsg", outErrMsg331);
- b1.putString("flag", missFlag);
- m1.what = 4;
- m1.setData(b1);
- exceptionHandler.sendMessage(m1);
- return;
- }
- } else {
- JSONArray jsonArray30 = new JSONArray(result30);
- JSONObject jsonObject31 = (JSONObject) jsonArray30.get(0);
- RECYCLINGFLAG = jsonObject31.optString("recyclingFlag");
- GOODSMODELforCheck = jsonObject31.optString("GOODSMODELforCheck");
- refireflag=jsonObject31.optString("refireflag");
- if ((GOODSMODELforCheck == null) || (GOODSMODELforCheck == "")
- || (GOODSMODELforCheck == "null")) {
- HashMap<String, String> params = new LinkedHashMap<String, String>();
- params.put("barcode", barcode);
- String resultGOODS = mClient.requestGetBySyn("http://" + ServerAddress_ip + ":9100"
- + "/main/login/api/GetCheckBarcode.ashx", params);
- if (!("".equals(resultGOODS) || resultGOODS == null)) { // 2023年4月17日 防止因为没返回值
- // 包json异常
- JSONObject jGOODS = new JSONObject(resultGOODS);
- String msgGOODSresult = jGOODS.optString("rows");
- JSONArray jarrayGOODS = new JSONArray(msgGOODSresult);
- JSONObject jobjGOODS = jarrayGOODS.optJSONObject(0);
- GOODSMODELforCheck = jobjGOODS.optString("GOODSTYPECODE");
- String GOODSTYPECODE = jobjGOODS.optString("GOODSTYPECODE").substring(0, 6);
- if ("001001".equals(GOODSTYPECODE)) {// todo 又被秦琪坑了 2023/3/8
- GOODSMODELforCheck = "CT";
- } else if ("001002".equals(GOODSTYPECODE)) {
- GOODSMODELforCheck = "11";
- }
- }
- } //
- }
- }
- }
- client = null;
- client = new WebClient();
- JSONObject js = new JSONObject();
- js.put("accountCode", accountCode);
- js.put("userCode", checkCollectModify_userCode);
- js.put("userPassword", password);
- js.put("sessionKey", sessionkey);
- js.put("barcode", barcode);
- String result = client.doPost("http://" + ServerAddress_ip + ":" + ServerAddress_duankou
- + Constants.serverAction + "/GetCompleteProcedureIDPDA", js.toString(), "application/json");
- JSONObject j = new JSONObject(result);
- JSONObject jo = (JSONObject) j.opt("d");
- int status = jo.optInt("Status");
- String msg = jo.optString("Message");
- if (status == 0) {
- String msgresult = jo.optString("Result");
- JSONArray jarray1 = new JSONArray(msgresult);
- if (jarray1 != null && jarray1.length() > 0) {
- JSONObject jobj1 = jarray1.optJSONObject(0);
- int procId = (int) jobj1.optDouble("COMPLETEPROCEDUREID");
- int rest = (int) jobj1.optDouble("PROCEDUREID");
- timestamp = jobj1.optString("CONVERTOPTIMESTAMP");
- if (rest == -1) {
- Message m = new Message();
- m.what = 2;
- Bundle b = new Bundle();
- b.putString("message", "条码" + barcode + "不可编辑");
- m.setData(b);
- exceptionHandler.sendMessage(m);
- return;
- }
- else if (rest > 0) {
- client = null;
- client = new WebClient();
- JSONObject js1 = new JSONObject();
- js1.put("accountCode", accountCode);
- js1.put("userCode", checkCollectModify_userCode);
- js1.put("userPassword", password);
- js1.put("sessionKey", sessionkey);
- js1.put("BarCode", barcode);
- js1.put("ProcedureID", proId);
- String productionDataResult = client.doPost(
- "http://" + ServerAddress_ip + ":" + ServerAddress_duankou
- + Constants.serverAction + "/GetProductionData",
- js1.toString(), "application/json");
- JSONObject json = new JSONObject(productionDataResult);
- JSONObject jb = (JSONObject) json.opt("d");
- int status1 = jb.optInt("Status");
- if (status1 == 0) {
- String result1 = jb.optString("Result");
- JSONArray ja = new JSONArray(result1);
- JSONObject jsonobj = (JSONObject) ja.get(0);
- productionDataId = (int) jsonobj.optDouble("PRODUCTIONDATAID");
- }
- String a111 = proId + "";
- String b111 = procId + "";
- if (proId == procId) {
- if (proId == rest) {
- JSONObject jsonObject69 = new JSONObject();
- jsonObject69.put("accountCode", accountCode);
- jsonObject69.put("userCode", checkCollectModify_userCode);
- jsonObject69.put("userPassword", password);
- jsonObject69.put("sessionKey", sessionkey);
- jsonObject69.put("barcode", barcode);// 产品条码
- client = new WebClient();
- String result69 = client.doPost(
- "http://" + ServerAddress_ip + ":" + ServerAddress_duankou
- + Constants.CHECK_SCRAP_PRODUCT,
- jsonObject69.toString(), "application/json");
- JSONObject jsonObject70 = new JSONObject(result69);
- JSONObject jsonObject71 = jsonObject70.getJSONObject("d");
- int status70 = jsonObject71.getInt("Status");
- String message70 = jsonObject71.getString("Message");
- if (status70 == 0) {
- client = null;
- client = new WebClient();
- JSONObject jsonhead = new JSONObject();
- jsonhead.put("accountCode", accountCode);
- jsonhead.put("userCode", checkCollectModify_userCode);
- jsonhead.put("userPassword", password);
- jsonhead.put("sessionKey", sessionkey);
- jsonhead.put("productionDataID", productionDataId);
- String Result = client.doPost(
- "http://" + ServerAddress_ip + ":" + ServerAddress_duankou
- + Constants.serverAction + "/GetProductionDataByID",
- jsonhead.toString(), "application/json");
- JSONObject jobj = new JSONObject(Result);
- JSONObject jso = (JSONObject) jobj.opt("d");
- int status2 = jso.optInt("Status");
- String Message1 = jso.optString("Message");
- if (status2 == 0) {
- if (productBugList != null && productBugList.size() > 0) {
- productBugList.removeAll(productBugList);
- }
- String res = jso.optString("Result");
- JSONObject je = new JSONObject(res);
- JSONArray jarray = je.optJSONArray("PDAProductionData");
- JSONObject jo1 = (JSONObject) jarray.get(0);
- int goodsId = jo1.optInt("GoodsID");
- String goodsCode = (String) jo1.optString("GoodsCode");
- String goodsName = (String) jo1.optString("GoodsName");
- int defectFlagId = jo1.optInt("DefectFlagID");
- int reworkProcedureId = jo1.optInt("ReworkProcedureID");
- int userId = (int) jo1.optInt("UserID");
- String userCode = jo1.optString("UserCode");
- String userName1 = jo1.optString("UserName");
- String trademarkName = jo1.optString("LogoName");
- String leakName = jo1.optString("LeakFlag1Name");
- String internalLeakName = jo1.optString("LeakFlag2Name");
- String passBall = jo1.optString("LeakFlag3Name");
- specialRepairFlag = String.valueOf(jo1.optInt("SpecialRepairflag"));
- specialRepairFlagName = jo1.optString("SpecialRepairFlagName");
- refire = jo1.optInt("IsReFire");
- refireName = jo1.optString("IsReFireName");
- int goodsLevelTypeId = jo1.optInt("GoodsLevelTypeID");
- originalGoodsLevelTypeId = jo1.optInt("GoodsLevelTypeID");
- String createTime = jo1.optString("CreateTime");
- createTime = CommonUtil.commonDateConverter(createTime);
- checkTime = jo1.optString("CheckTime");
- remarks = jo1.optString("Remarks");
- operationFlag = "modify";
- checkFlag = "2";
- if (goodsLevelTypeId == 7) {
- JSONObject jsonObject20 = new JSONObject();
- jsonObject20.put("accountCode", accountCode);
- jsonObject20.put("userCode", checkCollectModify_userCode);
- jsonObject20.put("userPassword", password);
- jsonObject20.put("sessionKey", sessionkey);
- jsonObject20.put("barcode", barcode);// 产品条码
- client = new WebClient();
- String result20 = client.doPost(
- "http://" + ServerAddress_ip + ":" + ServerAddress_duankou
- + Constants.serverAction + "/GetSubstandardInfo",
- jsonObject20.toString(), "application/json");
- JSONObject jo20 = new JSONObject(result20);
- JSONObject jo21 = (JSONObject) jo20.opt("d");
- int status21 = (Integer) jo21.optInt("Status");
- String message21 = jo21.optString("Message");
- if (status21 == 0) {
- String result21 = jo21.optString("Result");
- if (result21.equals("0")) {
- Message m = new Message();
- m.what = 2;
- Bundle b = new Bundle();
- b.putString("message", "次品不能修改");
- m.setData(b);
- exceptionHandler.sendMessage(m);
- return;
- }
- } else {
- Message m = new Message();
- m.what = 0;
- Bundle b = new Bundle();
- b.putInt("status", status21);
- b.putString("errorMsg", message21);
- m.setData(b);
- exceptionHandler.sendMessage(m);
- return;
- }
- }
- productionInfo = new ProductionInfo();
- productionInfo.setBarCode(barcode);
- productionInfo.setGoodsId(goodsId);
- productionInfo.setGoodsCode(goodsCode);
- productionInfo.setGoodsName(goodsName);
- productionInfo.setLeak(leakName);
- productionInfo.setInternalLeak(internalLeakName);
- productionInfo.setPassBall(passBall);
- productionInfo.setDefectFlagId(defectFlagId);
- productionInfo.setReworkProcedureId(reworkProcedureId);
- productionInfo.setCheckTime(checkTime);
- productionInfo.setRemarks(remarks);
- productionInfo.setUserId(userId);
- productionInfo.setUserCode(userCode);
- productionInfo.setUserName(userName1);
- productionInfo.setGoodsLevelTypeId(goodsLevelTypeId);
- productionInfo.setTrademarkName(trademarkName);
- JSONArray defectArray = jo1.optJSONArray("PDADefects");
- if (defectArray != null && defectArray.length() > 0) {
- for (int i = 0; i < defectArray.length(); i++) {
- ProductDefectInfo pdf = new ProductDefectInfo();
- JSONObject job = (JSONObject) defectArray.get(i);
- int defectId = job.optInt("DefectID");
- String defectCode = job.optString("DefectCode");
- String defectName = job.optString("DefectName");
- DefectNo dn = new DefectNo();
- dn.setDefectId(defectId);
- dn.setDefectCode(defectCode);
- dn.setDefectName(defectName);
- pdf.setDefectNo(dn);
- pdf.setDeleteFlag("server");
- int defectPositionId = (int) job.optInt("DefectPositionID");
- String defectPositionCode = job.optString("DefectPositionCode");
- String defectPositionName = job.optString("DefectPositionName");
- DefectLocation dl = new DefectLocation();
- dl.setDefectPositionId(defectPositionId);
- dl.setDefectPositionCode(defectPositionCode);
- dl.setDefectPositionName(defectPositionName);
- pdf.setDefectLocation(dl);
- int defectProcedureId = job.optInt("DefectProcedureID");
- String defectProcedureCode = job
- .optString("DefectProcedureCode");
- String defectProcedureName = job
- .optString("DefectProcedureName");
- ResponsibilityProcedure rp = new ResponsibilityProcedure();
- rp.setDutyProcedureId(defectProcedureId);
- rp.setDutyProcedureCode(defectProcedureCode);
- rp.setDutyProcedureName(defectProcedureName);
- pdf.setResponsibilityProcedure(rp);
- DefectDeduction defectDeduction = new DefectDeduction();
- double defectDeductionNum = job.optDouble("DefectDeductionNum");
- defectDeduction.setDefectDeductionNum(
- String.valueOf(defectDeductionNum));
- pdf.setDefectDeduction(defectDeduction);
- String specialDefect = job.optString("SpecialDefect");
- if (specialDefect.equals("0")) {
- pdf.setSpecialDefectFlag(false);
- } else {
- pdf.setSpecialDefectFlag(true);
- }
- int defectUserId = (int) job.optInt("DefectUserID");
- String defectUserCode = job.optString("DefectUserCode");
- String defectUserName = job.optString("DefectUserName");
- int ProductionDataId = (int) job
- .optInt("DefectProductionDataID");
- if (defectProcedureId > 0) {
- WorkNo wn = new WorkNo();
- wn.setUserId(defectUserId);
- wn.setUserCode(defectUserCode);
- wn.setUserName(defectUserName);
- wn.setProductionDataId(ProductionDataId);
- pdf.setWorkno(wn);
- }
- else {
- WorkNo wn = new WorkNo();
- wn.setUserId(defectUserId);
- wn.setUserCode(defectUserCode);
- wn.setUserName(defectUserName);
- pdf.setWorkno(wn);
- }
- int jobs = job.optInt("Jobs");
- String jobsText = job.optString("JobsText");
- WorkType wt = new WorkType();
- wt.setJobsID(jobs);
- wt.setJobsName(jobsText);
- pdf.setWorkType(wt);
- int defectFineId = job.optInt("DefectFineID");
- String defectFinesValue = job.optString("DefectFineValue");
- DefectFines df = new DefectFines();
- df.setDefectFinesId(defectFineId);
- df.setDefectFinesName(defectFinesValue);
- pdf.setDefectFines(df);
- JSONArray defectResponsibles = job
- .optJSONArray("PDADefectResponsibles");
- List<DutyPerson> dutyPersonList = new ArrayList<DutyPerson>();
- if (defectResponsibles != null
- && defectResponsibles.length() > 0) {
- for (int k = 0; k < defectResponsibles.length(); k++) {
- JSONObject jo2 = (JSONObject) defectResponsibles.get(k);
- int staffId = jo2.optInt("StaffID");
- String staffCode = jo2.optString("StaffCode");
- String staffName = jo2.optString("StaffName");
- int staffStatus = jo2.optInt("StaffStatus");
- int uJobsId = jo2.optInt("UJobsID");
- int sJobsId = jo2.optInt("SJobsID");
- DutyPerson dp = new DutyPerson();
- dp.setStaffId(staffId);
- dp.setStaffCode(staffCode);
- dp.setStaffName(staffName);
- dp.setStaffStatus(staffStatus);
- dp.setJobsId(uJobsId);
- dp.setsJobsId(sJobsId);
- dp.setUserId(defectUserId);
- dp.setUserCode(defectUserCode);
- dutyPersonList.add(dp);
- }
- }
- pdf.setDutyPersonList(dutyPersonList);
- List<ImagePath> imagePathList = new ArrayList<ImagePath>();
- JSONArray imageJsonArray = job
- .optJSONArray("PDADefectImageResults");
- if (imageJsonArray != null && imageJsonArray.length() > 0) {
- for (int n = 0; n < imageJsonArray.length(); n++) {
- JSONObject imageJo = (JSONObject) imageJsonArray.get(n);
- String path = imageJo.optString("Imagepath");
- ImagePath ip = new ImagePath();
- ip.setServerPath(path);
- ip.setFlag("remote");
- String pPath1 = CommonUtil.getRootFilePath();
- String fileDir1 = pPath1 + Constants.DATA_CACHE_PATH;
- File file1 = new File(fileDir1);
- if (!file1.exists()) {
- file1.mkdir();
- }
- String s = Md5Utils.encode(path);
- String imgName = s + ".jpg";
- File f1 = new File(file1.getAbsolutePath(), imgName);
- if (!f1.exists()) {
- try {
- f1.createNewFile();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- ip.setLocalPath(f1.getAbsolutePath());
- imagePathList.add(ip);
- }
- }
- String checkTime = job.optString("CheckTime");
- pdf.setCreateTime(checkTime);
- pdf.setDefectImgPath(imagePathList);
- productBugList.add(pdf);
- }
- }
- // wangyingjie 22/12/30 因为 可能是改判的原因 加的 Start
- // 如果 有bug 请删除 仅是赋值 漏气 试水 养水 试水不合格位置 养水不合格位置
- {
- JSONObject jsonObject28 = new JSONObject();
- jsonObject28.put("accountCode", accountCode);
- jsonObject28.put("userCode", checkCollectModify_userCode);
- jsonObject28.put("userPassword", password);
- jsonObject28.put("sessionKey", sessionkey);
- jsonObject28.put("procedureID", proId);// 工序ID,菜单页面传过来的
- jsonObject28.put("barcode", barcode);// 产品条码
- jsonObject28.put("isNewCheck", true);//
- client = new WebClient();
- String result28 = client.doPost(
- "http://" + ServerAddress_ip + ":" + ServerAddress_duankou
- + Constants.BAR_CODE_VALID,
- jsonObject28.toString(), "application/json");
- JSONObject jsonObject29 = new JSONObject(result28);
- JSONObject jsonObject30 = jsonObject29.getJSONObject("d");
- int status30 = jsonObject30.getInt("Status");
- String message30 = jsonObject30.getString("Message");
- if (status30 == 0) {
- String result30 = jsonObject30.getString("Result");
- JSONObject resultObjBarCodeTable = new JSONObject(result30);
- JSONArray resultArrayBarCodeTable = (JSONArray) resultObjBarCodeTable
- .opt("BarCodeTable");// 之前的
- JSONArray resultArrayleakFlag4Table = (JSONArray) resultObjBarCodeTable
- .opt("leakFlag4Table");// 养水 数据
- JSONArray resultArrayleakFlag5Table = (JSONArray) resultObjBarCodeTable
- .opt("leakFlag5Table");// 试水 数据
- JSONArray resultArrayleakFlag6Table = (JSONArray) resultObjBarCodeTable
- .opt("leakFlag6Table");// 补裂 位置数据 传送门
- JSONArray resultArrayDefectTable = (JSONArray) resultObjBarCodeTable
- .opt("DefectTable");// 缺陷信息
- JSONObject jsonObject31 = (JSONObject) resultArrayBarCodeTable
- .get(0);
- String outErrMsg30 = jsonObject31.getString("out_errMsg");
- String missFlag = jsonObject31.optString("out_missFlag");
- if (!TextUtils.isEmpty(outErrMsg30)) {
- if (missFlag.equals("0")) {
- Message m = new Message();
- Bundle b = new Bundle();
- b.putInt("status", status30);
- b.putString("errorMsg", outErrMsg30);
- m.what = 0;
- m.setData(b);
- exceptionHandler.sendMessage(m);
- return;
- } else {
- Message m1 = new Message();
- Bundle b1 = new Bundle();
- b1.putString("errmsg", outErrMsg30);
- b1.putString("flag", missFlag);
- m1.what = 4;
- m1.setData(b1);
- exceptionHandler.sendMessage(m1);
- return;
- }
- } else {
- // produceCodeIsValid = true;
- // if (worknovalid) {
- // productionInfo = new ProductionInfo();
- // productionInfo.setUserId(Integer.parseInt(userID));
- // productionInfo.setUserCode(worknouserCode);
- // productionInfo.setUserName(workNoName);
- //
- // }
- // out_goodsID = jsonObject31.getString("out_goodsID");
- // out_goodsCode = jsonObject31.getString("out_goodsCode");
- // out_goodsName = jsonObject31.getString("out_goodsName");
- // out_groutingUserCode = jsonObject31.getString("out_groutingUserCode");
- // productionInfo.setBarCode(barcode);
- // TODO 由于缺陷信息重复 所以 注释这一块
- // 2023/1/3 start 增加 缺陷信息赋值 z
- // if (resultArrayDefectTable != null
- // && resultArrayDefectTable.length() > 0) {
- // for (int i = 0; i < resultArrayDefectTable
- // .length(); i++) {
- // ProductDefectInfo pdf = new ProductDefectInfo();
- // JSONObject job = (JSONObject) resultArrayDefectTable
- // .get(i);
- // int defectId = job.optInt("DEFECTID");
- // String defectCode = job.optString("DEFECTCODE");
- // String defectName = job.optString("DEFECTNAME");
- // DefectNo dn = new DefectNo();
- // dn.setDefectId(defectId);
- // dn.setDefectCode(defectCode);
- // dn.setDefectName(defectName);
- // pdf.setDefectNo(dn);
- // pdf.setDeleteFlag("server");
- // int defectPositionId = (int) job
- // .optInt("DEFECTPOSITIONID");
- // String defectPositionCode = job
- // .optString("DEFECTPOSITIONCODE");
- // String defectPositionName = job
- // .optString("DEFECTPOSITIONNAME");
- // DefectLocation dl = new DefectLocation();
- // dl.setDefectPositionId(defectPositionId);
- // dl.setDefectPositionCode(defectPositionCode);
- // dl.setDefectPositionName(defectPositionName);
- // pdf.setDefectLocation(dl);
- // int defectProcedureId = job
- // .optInt("DEFECTPROCEDUREID");
- // String defectProcedureCode = job
- // .optString("DEFECTPROCEDURECODE");
- // String defectProcedureName = job
- // .optString("DEFECTPROCEDURENAME");
- // ResponsibilityProcedure rp = new ResponsibilityProcedure();
- // rp.setDutyProcedureId(defectProcedureId);
- // rp.setDutyProcedureCode(defectProcedureCode);
- // rp.setDutyProcedureName(defectProcedureName);
- // pdf.setResponsibilityProcedure(rp);
- //
- // DefectDeduction defectDeduction = new DefectDeduction();
- // double defectDeductionNum = job
- // .optDouble("DEFECTDEDUCTIONNUM");
- // defectDeduction.setDefectDeductionNum(
- // String.valueOf(defectDeductionNum));
- // pdf.setDefectDeduction(defectDeduction);
- // String specialDefect = job
- // .optString("SPECIALDEFECT");
- // if (specialDefect.equals("0")) {
- // pdf.setSpecialDefectFlag(false);
- // } else {
- // pdf.setSpecialDefectFlag(true);
- // }
- // int defectUserId = (int) job.optInt("DEFECTUSERID");
- // String defectUserCode = job
- // .optString("DEFECTUSERCODE");
- // String defectUserName = job
- // .optString("DEFECTUSERNAME");
- // int ProductionDataId = (int) job
- // .optInt("DEFECTPRODUCTIONDATAID");
- // if (defectProcedureId > 0) {
- // WorkNo wn = new WorkNo();
- // wn.setUserId(defectUserId);
- // wn.setUserCode(defectUserCode);
- // wn.setUserName(defectUserName);
- // wn.setProductionDataId(ProductionDataId);
- // pdf.setWorkno(wn);
- // }
- //
- // else {
- // WorkNo wn = new WorkNo();
- // wn.setUserId(defectUserId);
- // wn.setUserCode(defectUserCode);
- // wn.setUserName(defectUserName);
- // pdf.setWorkno(wn);
- // }
- //
- // int jobs = job.optInt("JOBS");
- // String jobsText = job.optString("JOBSTEXT");
- // WorkType wt = new WorkType();
- // wt.setJobsID(jobs);
- // wt.setJobsName(jobsText);
- // pdf.setWorkType(wt);
- //
- // int defectFineId = job.optInt("DEFECTFINEID");
- // String defectFinesValue = job
- // .optString("DEFECTFINEVALUE");
- // DefectFines df = new DefectFines();
- // df.setDefectFinesId(defectFineId);
- // df.setDefectFinesName(defectFinesValue);
- // pdf.setDefectFines(df);
- // JSONArray defectResponsibles = job
- // .optJSONArray("PDADefectResponsibles");
- // List<DutyPerson> dutyPersonList = new ArrayList<DutyPerson>();
- // if (defectResponsibles != null
- // && defectResponsibles.length() > 0) {
- //
- // for (int k = 0; k < defectResponsibles
- // .length(); k++) {
- // JSONObject jo2 = (JSONObject) defectResponsibles
- // .get(k);
- // int staffId = jo2.optInt("StaffID");
- // String staffCode = jo2
- // .optString("StaffCode");
- // String staffName = jo2
- // .optString("StaffName");
- // int staffStatus = jo2.optInt("StaffStatus");
- // int uJobsId = jo2.optInt("UJobsID");
- // int sJobsId = jo2.optInt("SJobsID");
- // DutyPerson dp = new DutyPerson();
- // dp.setStaffId(staffId);
- // dp.setStaffCode(staffCode);
- // dp.setStaffName(staffName);
- // dp.setStaffStatus(staffStatus);
- // dp.setJobsId(uJobsId);
- // dp.setsJobsId(sJobsId);
- // dp.setUserId(defectUserId);
- // dp.setUserCode(defectUserCode);
- // dutyPersonList.add(dp);
- // }
- //
- // }
- // pdf.setDutyPersonList(dutyPersonList);
- //
- // List<ImagePath> imagePathList = new ArrayList<ImagePath>();
- // JSONArray imageJsonArray = job
- // .optJSONArray("PDADefectImageResults");
- // if (imageJsonArray != null
- // && imageJsonArray.length() > 0) {
- // for (int n = 0; n < imageJsonArray
- // .length(); n++) {
- // JSONObject imageJo = (JSONObject) imageJsonArray
- // .get(n);
- // String path = imageJo
- // .optString("Imagepath");
- // ImagePath ip = new ImagePath();
- // ip.setServerPath(path);
- // ip.setFlag("remote");
- // String pPath1 = CommonUtil
- // .getRootFilePath();
- // String fileDir1 = pPath1
- // + Constants.DATA_CACHE_PATH;
- // File file1 = new File(fileDir1);
- // if (!file1.exists()) {
- // file1.mkdir();
- // }
- // String s = Md5Utils.encode(path);
- // String imgName = s + ".jpg";
- // File f1 = new File(file1.getAbsolutePath(),
- // imgName);
- // if (!f1.exists()) {
- // try {
- // f1.createNewFile();
- // } catch (IOException e) {
- // e.printStackTrace();
- // }
- // }
- // ip.setLocalPath(f1.getAbsolutePath());
- // imagePathList.add(ip);
- // }
- // }
- //
- // String checkTime = job.optString("CHECKTIME");
- // pdf.setCreateTime(checkTime);
- // pdf.setDefectImgPath(imagePathList);
- // productBugList.add(pdf);
- //
- // }
- // Message messageproductBugList = new Message();
- // Bundle bproductBugList = new Bundle();
- // bproductBugList.putSerializable("productbuglist",
- // (Serializable) productBugList);
- // messageproductBugList.what = 10;
- // messageproductBugList.setData(bproductBugList);
- // handler.sendMessage(messageproductBugList);
- // }
- // end z
- productionInfo
- .setOut_Grade(jsonObject31.optInt("DefectFlagID"));
- productionInfo.setOfflineFlag(
- jsonObject31.optString("offlineFlag")); // 下标划线
- productionInfo.setOut_LeakFlag1Name(
- jsonObject31.optString("out_LeakFlag1Name"));// 漏气
- productionInfo.setOut_LeakFlag4Name(
- jsonObject31.optString("out_LeakFlag4Name"));// 养水
- productionInfo.setOut_LeakFlag5Name(
- jsonObject31.optString("out_LeakFlag5Name"));// 试水
- productionInfo.setOut_LeakFlag7Name(
- jsonObject31.optString("out_LeakFlag7Name"));// 修磨
- if (resultArrayleakFlag4Table != null
- && resultArrayleakFlag4Table.length() > 0) {
- JSONObject jsonObjectleakFlag4Table = (JSONObject) resultArrayleakFlag4Table
- .get(0);
- productionInfo.setLeakFlag4TablePOSITION(
- jsonObjectleakFlag4Table.optString("POSITION"));// 养水
- // 不合格位置
- }
- if (resultArrayleakFlag5Table != null
- && resultArrayleakFlag5Table.length() > 0) {
- JSONObject jsonObjectleakFlag5Table = (JSONObject) resultArrayleakFlag5Table
- .get(0);
- productionInfo.setLeakFlag5TablePOSITION(
- jsonObjectleakFlag5Table.optString("POSITION"));// 试水
- // 不合格位置
- }
- if (resultArrayleakFlag6Table != null
- && resultArrayleakFlag6Table.length() > 0) {
- JSONObject jsonObjectleakFlag6Table = (JSONObject) resultArrayleakFlag6Table
- .get(0);
- productionInfo.setLeakFlag6TablePOSITION(
- jsonObjectleakFlag6Table.optString("POSITION")); // 补裂位置
- mCheckRepairCrackPositionDate = jsonObjectleakFlag6Table
- .optString("POSITION");
- }
- // productionInfo.setGoodsId(Integer.parseInt(out_goodsID));
- // productionInfo.setGoodsCode(out_goodsCode);
- // productionInfo.setGoodsName(out_goodsName);
- // specialRepairFlag = jsonObject31.optString("out_specialRepairFlag");
- // specialRepairFlagName = jsonObject31
- // .optString("out_specialRepairFlagName");
- // refire = Integer.parseInt(jsonObject31.optString("out_isReFire"));
- // refireName = jsonObject31.optString("out_isReFireName");
- //
- // productionInfo.setTrademarkName(jsonObject31.optString("out_logoName"));
- //
- //
- // productionInfo.setLeak(jsonObject31.optString("out_LeakFlag1Name"));
- //
- // productionInfo.setInternalLeak(jsonObject31.optString("out_LeakFlag2Name"));
- //
- // productionInfo.setPassBall(jsonObject31.optString("out_LeakFlag3Name"));
- }
- }
- else {
- Message m = new Message();
- m.what = 0;
- Bundle b = new Bundle();
- b.putInt("status", status30);
- b.putString("errorMsg", message30);
- m.setData(b);
- exceptionHandler.sendMessage(m);
- return;
- }
- //
- }
- // ----------end
- client = null;
- client = new WebClient();
- JSONObject js6 = new JSONObject();
- js6.put("accountCode", accountCode);
- js6.put("userCode", checkCollectModify_userCode);
- js6.put("userPassword", password);
- js6.put("sessionKey", sessionkey);
- js6.put("settingcode", "S_PM_009");
- String result6 = client.doPost(
- "http://" + ServerAddress_ip + ":" + ServerAddress_duankou
- + Constants.serverAction
- + "/GetSystemSettingDataByCode",
- js6.toString(),
- "application/json");
- JSONObject js10 = new JSONObject(result6);
- JSONObject js11 = js10.optJSONObject("d");
- int status11 = js11.optInt("Status");
- String message11 = js11.optString("Message");
- if (status11 == 0) {
- String result11 = js11.optString("Result");
- JSONArray jarray11 = new JSONArray(result11);
- if (jarray11 != null && jarray.length() > 0) {
- JSONObject js12 = jarray11.optJSONObject(0);
- String settingValueStr = js12.optString("SETTINGVALUE");
- if (!TextUtils.isEmpty(settingValueStr)) {
- int settingValue = Integer.parseInt(settingValueStr);
- if (settingValue > 0) {
- client = null;
- client = new WebClient();
- JSONObject js13 = new JSONObject();
- js13.put("accountCode", accountCode);
- js13.put("userCode", checkCollectModify_userCode);
- js13.put("userPassword", password);
- js13.put("sessionKey", sessionkey);
- js13.put("orgTime", createTime);
- js13.put("days", settingValue);
- js13.put("settingCode", "S_PM_009");
- String result13 = client.doPost(
- "http://" + ServerAddress_ip + ":"
- + ServerAddress_duankou
- + Constants.serverAction
- + "/BarcodeAllowCancel",
- js13.toString(), "application/json");
- JSONObject jobj13 = new JSONObject(result13);
- JSONObject jobj14 = jobj13.optJSONObject("d");
- int status14 = jobj14.optInt("Status");
- String message14 = jobj14.optString("Message");
- if (status14 != 0) {
- overdueFlag = true;
- Bundle b = new Bundle();
- b.putString("message", message14);
- b.putInt("status", status14);
- Message m = new Message();
- m.what = 3;
- m.setData(b);
- exceptionHandler.sendMessage(m);
- }
- }
- }
- }
- }
- else {
- Bundle b = new Bundle();
- b.putString("message", message11);
- b.putInt("status", status11);
- Message m = new Message();
- m.what = 3;
- m.setData(b);
- exceptionHandler.sendMessage(m);
- }
- String result90;
- WebClient client = new WebClient();
- JSONObject jsonObject90 = new JSONObject();
- jsonObject90.put("accountCode", accountCode);
- jsonObject90.put("userCode", checkCollectModify_userCode);
- jsonObject90.put("userPassword", password);
- jsonObject90.put("sessionKey", sessionkey);
- result90 = client.doPost(
- "http://" + ServerAddress_ip + ":" + ServerAddress_duankou
- + Constants.GET_GOODS_GRADE,
- jsonObject90.toString(), "application/json");
- JSONObject jsonObject91 = new JSONObject(result90);
- JSONObject jsonobject92 = jsonObject91.getJSONObject("d");
- int status92 = jsonobject92.getInt("Status");
- String message92 = jsonobject92.getString("Message");
- if (status92 == 0) {
- String json93 = jsonobject92.getString("Result");
- JSONArray jsonArray94 = new JSONArray(json93);
- listProductClassify = new ArrayList<ProductClassifyInfo>();
- for (int i = 0; i < jsonArray94.length(); i++) {
- classifyInfo = new ProductClassifyInfo();
- JSONObject jsonObject95 = (JSONObject) jsonArray94.get(i);
- classifyInfo.setGoodsLevelTypeID(
- (int) jsonObject95.getDouble("GOODSLEVELTYPEID"));
- classifyInfo.setDefectFlagName(
- jsonObject95.getString("DEFECTFLAGNAME"));
- classifyInfo.setDefectFlagId(
- (int) jsonObject95.getInt("DEFECTFLAGID"));
- listProductClassify.add(i, classifyInfo);
- }
- } else {
- Message m = new Message();
- m.what = 0;
- Bundle b = new Bundle();
- b.putInt("status", status92);
- b.putString("errorMsg", message92);
- m.setData(b);
- exceptionHandler.sendMessage(m);
- return;
- }
- Message m = new Message();
- m.what = 1;
- Bundle b = new Bundle();
- b.putSerializable("productbuglist", (Serializable) productBugList);
- b.putSerializable("productclassifylist",
- (Serializable) listProductClassify);
- m.setData(b);
- handler.sendMessage(m);
- return;
- }
- else {
- Message m = new Message();
- m.what = 0;
- Bundle b = new Bundle();
- b.putInt("status", status2);
- b.putString("errorMsg", Message1);
- m.setData(b);
- exceptionHandler.sendMessage(m);
- return;
- }
- } else {
- Message m = new Message();
- m.what = 0;
- Bundle b = new Bundle();
- b.putInt("status", status70);
- b.putString("errorMsg", message70);
- m.setData(b);
- exceptionHandler.sendMessage(m);
- return;
- }
- } else {
- operationFlag = "add";
- dryRepairFlag = true;
- checkFlag = "1";
- JSONObject jsonObject36 = new JSONObject();
- jsonObject36.put("accountCode", accountCode);
- jsonObject36.put("userCode", checkCollectModify_userCode);
- jsonObject36.put("userPassword", password);
- jsonObject36.put("sessionKey", sessionkey);
- jsonObject36.put("procedureID", proId);// 工序ID,菜单页面传过来的
- jsonObject36.put("barcode", barcode);// 产品条码
- client = new WebClient();
- String result36 = client.doPost(
- "http://" + ServerAddress_ip + ":" + ServerAddress_duankou
- + Constants.DRY_REPAIR_BARCODE_CHECK,
- jsonObject36.toString(), "application/json");
- JSONObject jsonObject37 = new JSONObject(result36);
- JSONObject jsonObject38 = jsonObject37.getJSONObject("d");
- int status38 = jsonObject38.getInt("Status");
- String message38 = jsonObject38.getString("Message");
- if (status38 == 0) {
- String result39 = jsonObject38.getString("Result");
- JSONArray jsonArray39 = new JSONArray(result39);
- JSONObject jsonObject40 = (JSONObject) jsonArray39.get(0);
- if (worknovalid) {
- productionInfo = new ProductionInfo();
- productionInfo.setUserId(Integer.parseInt(userID));
- productionInfo.setUserCode(worknouserCode);
- productionInfo.setUserName(workNoName);
- }
- out_goodsID = String.valueOf(jsonObject40.optInt("GOODSID"));
- out_goodsCode = jsonObject40.getString("GOODSCODE");
- out_goodsName = jsonObject40.getString("GOODSNAME");
- specialRepairFlag = jsonObject40.optString("SPECIALREPAIRFLAG");
- refire = Integer.parseInt(jsonObject40.optString("ISREFIRE"));
- String trademarkName = jsonObject40.optString("LOGONAME");
- productionInfo.setTrademarkName(trademarkName);
- // out_groutingUserCode =
- // jsonObject40
- // .getString("out_groutingUserCode");
- productionInfo.setBarCode(barcode);
- productionInfo.setGoodsId(Integer.parseInt(out_goodsID));
- productionInfo.setGoodsCode(out_goodsCode);
- productionInfo.setGoodsName(out_goodsName);
- // productionInfo.setGroutingUserCode(out_groutingUserCode);
- // JSONObject jsonObject41 = new
- // JSONObject();
- // jsonObject41.put("accountCode",
- // accountCode);
- // jsonObject41.put("userCode",
- // userName);
- // jsonObject41.put("userPassword",
- // Md5Utils.encode(password));
- // jsonObject41.put("sessionKey",
- // sessionkey);
- // jsonObject41.put("barcode",
- // code);// 产品条码
- // client = new WebClient();
- // String result41 =
- // client.doPost("http://"
- // + ServerAddress_ip + ":" +
- // ServerAddress_duankou
- // +
- // Constants.GET_IN_PRODUCTION_DATA_LIST,
- // jsonObject41.toString(),
- // "application/json");
- // JSONObject j42=new
- // JSONObject(result41);
- // JSONObject
- // j43=j42.optJSONObject("d");
- // int
- // status43=j43.optInt("Status");
- // String
- // message43=j43.optString("Message");
- // if(status43==0){
- // String
- // result43=j43.optString("Result");
- // JSONArray jarray43=new
- // JSONArray(result43);
- // JSONObject j44=
- // jarray43.optJSONObject(0);
- // refire=Integer.parseInt(j44.optString("ISREFIRE"));
- // specialRepairFlag=j44.optString("SPECIALREPAIRFLAG");
- // }
- // else{
- // Message m=new Message();
- // m.what=0;
- // Bundle b=new Bundle();
- // b.putInt("status",status43);
- // b.putString("errorMsg",message43);
- // m.setData(b);
- // exceptionHandler.sendMessage(m);
- // return;
- // }
- // editstatus = true;
- JSONObject jsonObject45 = new JSONObject();
- jsonObject45.put("accountCode", accountCode);
- jsonObject45.put("userCode", checkCollectModify_userCode);
- jsonObject45.put("userPassword", password);
- jsonObject45.put("sessionKey", sessionkey);
- jsonObject45.put("barCode", barcode);// 产品条码
- client = new WebClient();
- String result45 = client.doPost(
- "http://" + ServerAddress_ip + ":" + ServerAddress_duankou
- + Constants.CHECK_COLLECT_HAND_OVER_URL,
- jsonObject45.toString(), "application/json");
- JSONObject jsonObject46 = new JSONObject(result45);
- JSONObject jsonObject47 = jsonObject46.getJSONObject("d");
- int status47 = jsonObject47.getInt("Status");
- if (status47 == 0) {
- String result47 = jsonObject47.getString("Result");
- JSONObject resultObj48 = new JSONObject(result47);
- JSONArray resultArray48 = (JSONArray) resultObj48
- .opt("PreProductCheck");
- if (resultArray48 != null && resultArray48.length() > 0) {
- JSONObject jobj49 = (JSONObject) resultArray48.opt(0);
- int goodsLevelTypeId = jobj49.optInt("GOODSLEVELTYPEID");
- int reworkProcedureId = jobj49.optInt("REWORKPROCEDUREID");
- productionInfo.setGoodsLevelTypeId(goodsLevelTypeId);
- productionInfo.setReworkProcedureId(reworkProcedureId);
- }
- }
- //
- String result50;
- WebClient client = new WebClient();
- JSONObject jsonObject50 = new JSONObject();
- jsonObject50.put("accountCode", accountCode);
- jsonObject50.put("userCode", checkCollectModify_userCode);
- jsonObject50.put("userPassword", password);
- jsonObject50.put("sessionKey", sessionkey);
- result50 = client.doPost(
- "http://" + ServerAddress_ip + ":" + ServerAddress_duankou
- + Constants.GET_GOODS_GRADE,
- jsonObject50.toString(), "application/json");
- JSONObject jsonObject51 = new JSONObject(result50);
- JSONObject jsonobject52 = jsonObject51.getJSONObject("d");
- int status52 = jsonobject52.getInt("Status");
- String message52 = jsonobject52.getString("Message");
- if (status52 == 0) {
- String json53 = jsonobject52.getString("Result");
- JSONArray jsonArray54 = new JSONArray(json53);
- listProductClassify = new ArrayList<ProductClassifyInfo>();
- for (int i = 0; i < jsonArray54.length(); i++) {
- classifyInfo = new ProductClassifyInfo();
- JSONObject jsonObject55 = (JSONObject) jsonArray54.get(i);
- classifyInfo.setGoodsLevelTypeID(
- (int) jsonObject55.getDouble("GOODSLEVELTYPEID"));
- classifyInfo.setDefectFlagName(
- jsonObject55.getString("DEFECTFLAGNAME"));
- classifyInfo
- .setDefectFlagId((int) jsonObject55.getInt("DEFECTFLAGID"));
- listProductClassify.add(i, classifyInfo);
- }
- } else {
- Message m = new Message();
- m.what = 0;
- Bundle b = new Bundle();
- b.putInt("status", status52);
- b.putString("errorMsg", message52);
- m.setData(b);
- exceptionHandler.sendMessage(m);
- return;
- }
- Message m = new Message();
- m.what = 1;
- Bundle b = new Bundle();
- b.putSerializable("productclassifylist",
- (Serializable) listProductClassify);
- m.setData(b);
- handler.sendMessage(m);
- return;
- } else {
- Message m = new Message();
- m.what = 0;
- Bundle b = new Bundle();
- b.putInt("status", status38);
- b.putString("errorMsg", message38);
- m.setData(b);
- exceptionHandler.sendMessage(m);
- return;
- }
- }
- }
- else {
- client = null;
- client = new WebClient();
- JSONObject jsonhead = new JSONObject();
- jsonhead.put("accountCode", accountCode);
- jsonhead.put("userCode", checkCollectModify_userCode);
- jsonhead.put("userPassword", password);
- jsonhead.put("sessionKey", sessionkey);
- jsonhead.put("BarCode", barcode);
- String result11 = client.doPost(
- "http://" + ServerAddress_ip + ":" + ServerAddress_duankou
- + Constants.serverAction + "/GetProductionDataCheckID",
- jsonhead.toString(), "application/json");
- JSONObject jobj = new JSONObject(result11);
- JSONObject jso = (JSONObject) jobj.opt("d");
- int status11 = jso.optInt("Status");
- String result1 = jso.optString("Result");
- if (status11 == 0) {
- if (!TextUtils.isEmpty(result1)) { // proId = 139 是补裂
- JSONArray ja = new JSONArray(result1);
- JSONObject jsonobj = (JSONObject) ja.get(0);
- int procedureId = jsonobj.optInt("PROCEDUREID");
- if (procedureId == proId) {
- client = null;
- client = new WebClient();
- JSONObject jsonhead12 = new JSONObject();
- jsonhead12.put("accountCode", accountCode);
- jsonhead12.put("userCode", checkCollectModify_userCode);
- jsonhead12.put("userPassword", password);
- jsonhead12.put("sessionKey", sessionkey);
- jsonhead12.put("productionDataID", productionDataId);
- String Result = client.doPost(
- "http://" + ServerAddress_ip + ":" + ServerAddress_duankou
- + Constants.serverAction + "/GetProductionDataByID",
- jsonhead12.toString(), "application/json");
- JSONObject jobj12 = new JSONObject(Result);
- JSONObject jso12 = (JSONObject) jobj12.opt("d");
- int status12 = jso12.optInt("Status");
- String message12 = jso12.optString("Message");
- if (status12 == 0) {
- if (productBugList != null && productBugList.size() > 0) {
- productBugList.removeAll(productBugList);
- }
- operationFlag = "modify";
- checkFlag = "3";
- String res = jso12.optString("Result");
- JSONObject je = new JSONObject(res);
- JSONArray jarray = je.optJSONArray("PDAProductionData");
- JSONObject jo1 = (JSONObject) jarray.get(0);
- int goodsId = jo1.optInt("GoodsID");
- String goodsCode = (String) jo1.optString("GoodsCode");
- String goodsName = (String) jo1.optString("GoodsName");
- int defectFlagId = jo1.optInt("DefectFlagID");
- int reworkProcedureId = jo1.optInt("ReworkProcedureID");
- int userId = (int) jo1.optInt("UserID");
- String userCode = jo1.optString("UserCode");
- String userName1 = jo1.optString("UserName");
- specialRepairFlag = String.valueOf(jo1.optInt("SpecialRepairflag"));
- specialRepairFlagName = jo1.optString("SpecialRepairFlagName");
- refire = jo1.optInt("IsReFire");
- refireName = jo1.optString("IsReFireName");
- int goodsLevelTypeId = jo1.optInt("GoodsLevelTypeID");
- String trademarkName = jo1.optString("LogoName");
- String createTime = jo1.optString("CreateTime");
- createTime = CommonUtil.commonDateConverter(createTime);
- checkTime = jo1.optString("CheckTime");
- remarks = jo1.optString("Remarks");
- String leakName = jo1.optString("LeakFlag1Name");
- String internalLeakName = jo1.optString("LeakFlag2Name");
- String passBallName = jo1.optString("LeakFlag3Name");
- productionInfo = new ProductionInfo();
- productionInfo.setBarCode(barcode);
- productionInfo.setGoodsId(goodsId);
- productionInfo.setGoodsCode(goodsCode);
- productionInfo.setGoodsName(goodsName);
- productionInfo.setLeak(leakName);
- productionInfo.setInternalLeak(internalLeakName);
- productionInfo.setPassBall(passBallName);
- productionInfo.setDefectFlagId(defectFlagId);
- productionInfo.setOut_Grade(defectFlagId);
- productionInfo.setReworkProcedureId(reworkProcedureId);
- productionInfo.setCheckTime(checkTime);
- productionInfo.setRemarks(remarks);
- productionInfo.setUserId(userId);
- productionInfo.setUserCode(userCode);
- productionInfo.setUserName(userName1);
- productionInfo.setGoodsLevelTypeId(goodsLevelTypeId);
- productionInfo.setTrademarkName(trademarkName);
- JSONArray defectArray = jo1.optJSONArray("PDADefects");
- if (defectArray != null && defectArray.length() > 0) {
- for (int i = 0; i < defectArray.length(); i++) {
- ProductDefectInfo pdf = new ProductDefectInfo();
- JSONObject job = (JSONObject) defectArray.get(i);
- int defectId = job.optInt("DefectID");
- String defectCode = job.optString("DefectCode");
- String defectName = job.optString("DefectName");
- DefectNo dn = new DefectNo();
- dn.setDefectId(defectId);
- dn.setDefectCode(defectCode);
- dn.setDefectName(defectName);
- pdf.setDefectNo(dn);
- pdf.setDeleteFlag("server");
- int defectPositionId = (int) job.optInt("DefectPositionID");
- String defectPositionCode = job
- .optString("DefectPositionCode");
- String defectPositionName = job
- .optString("DefectPositionName");
- DefectLocation dl = new DefectLocation();
- dl.setDefectPositionId(defectPositionId);
- dl.setDefectPositionCode(defectPositionCode);
- dl.setDefectPositionName(defectPositionName);
- pdf.setDefectLocation(dl);
- int defectProcedureId = job.optInt("DefectProcedureID");
- String defectProcedureCode = job
- .optString("DefectProcedureCode");
- String defectProcedureName = job
- .optString("DefectProcedureName");
- ResponsibilityProcedure rp = new ResponsibilityProcedure();
- rp.setDutyProcedureId(defectProcedureId);
- rp.setDutyProcedureCode(defectProcedureCode);
- rp.setDutyProcedureName(defectProcedureName);
- pdf.setResponsibilityProcedure(rp);
- DefectDeduction defectDeduction = new DefectDeduction();
- double defectDeductionNum = job
- .optDouble("DefectDeductionNum");
- defectDeduction.setDefectDeductionNum(
- String.valueOf(defectDeductionNum));
- pdf.setDefectDeduction(defectDeduction);
- String specialDefect = job.optString("SpecialDefect");
- if (specialDefect.equals("0")) {
- pdf.setSpecialDefectFlag(false);
- } else {
- pdf.setSpecialDefectFlag(true);
- }
- int defectUserId = (int) job.optInt("DefectUserID");
- String defectUserCode = job.optString("DefectUserCode");
- String defectUserName = job.optString("DefectUserName");
- int ProductionDataId = (int) job
- .optInt("DefectProductionDataID");
- if (defectProcedureId > 0) {
- WorkNo wn = new WorkNo();
- wn.setUserId(defectUserId);
- wn.setUserCode(defectUserCode);
- wn.setUserName(defectUserName);
- wn.setProductionDataId(ProductionDataId);
- pdf.setWorkno(wn);
- }
- else {
- WorkNo wn = new WorkNo();
- wn.setUserId(defectUserId);
- wn.setUserCode(defectUserCode);
- wn.setUserName(defectUserName);
- pdf.setWorkno(wn);
- }
- int jobs = job.optInt("Jobs");
- String jobsText = job.optString("JobsText");
- WorkType wt = new WorkType();
- wt.setJobsID(jobs);
- wt.setJobsName(jobsText);
- pdf.setWorkType(wt);
- int defectFineId = job.optInt("DefectFineID");
- String defectFinesValue = job.optString("DefectFineValue");
- DefectFines df = new DefectFines();
- df.setDefectFinesId(defectFineId);
- df.setDefectFinesName(defectFinesValue);
- pdf.setDefectFines(df);
- JSONArray defectResponsibles = job
- .optJSONArray("PDADefectResponsibles");
- List<DutyPerson> dutyPersonList = new ArrayList<DutyPerson>();
- if (defectResponsibles != null
- && defectResponsibles.length() > 0) {
- for (int k = 0; k < defectResponsibles.length(); k++) {
- JSONObject jo2 = (JSONObject) defectResponsibles
- .get(k);
- int staffId = jo2.optInt("StaffID");
- String staffCode = jo2.optString("StaffCode");
- String staffName = jo2.optString("StaffName");
- int staffStatus = jo2.optInt("StaffStatus");
- int uJobsId = jo2.optInt("UJobsID");
- int sJobsId = jo2.optInt("SJobsID");
- DutyPerson dp = new DutyPerson();
- dp.setStaffId(staffId);
- dp.setStaffCode(staffCode);
- dp.setStaffName(staffName);
- dp.setStaffStatus(staffStatus);
- dp.setJobsId(uJobsId);
- dp.setsJobsId(sJobsId);
- dp.setUserId(defectUserId);
- dp.setUserCode(defectUserCode);
- dutyPersonList.add(dp);
- }
- }
- pdf.setDutyPersonList(dutyPersonList);
- List<ImagePath> imagePathList = new ArrayList<ImagePath>();
- JSONArray imageJsonArray = job
- .optJSONArray("PDADefectImageResults");
- if (imageJsonArray != null && imageJsonArray.length() > 0) {
- for (int n = 0; n < imageJsonArray.length(); n++) {
- JSONObject imageJo = (JSONObject) imageJsonArray
- .get(n);
- String path = imageJo.optString("Imagepath");
- ImagePath ip = new ImagePath();
- ip.setServerPath(path);
- ip.setFlag("remote");
- String pPath1 = CommonUtil.getRootFilePath();
- String fileDir1 = pPath1
- + Constants.DATA_CACHE_PATH;
- File file1 = new File(fileDir1);
- if (!file1.exists()) {
- file1.mkdir();
- }
- String s = Md5Utils.encode(path);
- String imgName = s + ".jpg";
- File f1 = new File(file1.getAbsolutePath(),
- imgName);
- if (!f1.exists()) {
- try {
- f1.createNewFile();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- ip.setLocalPath(f1.getAbsolutePath());
- imagePathList.add(ip);
- }
- }
- String checkTime = job.optString("CheckTime");
- pdf.setCreateTime(checkTime);
- pdf.setDefectImgPath(imagePathList);
- productBugList.add(pdf);
- }
- }
- client = null;
- client = new WebClient();
- JSONObject js6 = new JSONObject();
- js6.put("accountCode", accountCode);
- js6.put("userCode", checkCollectModify_userCode);
- js6.put("userPassword", password);
- js6.put("sessionKey", sessionkey);
- js6.put("settingcode", "S_PM_009");
- String result6 = client.doPost(
- "http://" + ServerAddress_ip + ":" + ServerAddress_duankou
- + Constants.serverAction
- + "/GetSystemSettingDataByCode",
- js6.toString(), "application/json");
- JSONObject js10 = new JSONObject(result6);
- JSONObject js11 = js10.optJSONObject("d");
- int status13 = js11.optInt("Status");
- String message13 = js11.optString("Message");
- if (status13 == 0) {
- String result13 = js11.optString("Result");
- JSONArray jarray13 = new JSONArray(result13);
- if (jarray13 != null && jarray13.length() > 0) {
- JSONObject js12 = jarray13.optJSONObject(0);
- String settingValueStr = js12.optString("SETTINGVALUE");
- if (!TextUtils.isEmpty(settingValueStr)) {
- int settingValue = Integer.parseInt(settingValueStr);
- if (settingValue > 0) {
- client = null;
- client = new WebClient();
- JSONObject js13 = new JSONObject();
- js13.put("accountCode", accountCode);
- js13.put("userCode", checkCollectModify_userCode);
- js13.put("userPassword", password);
- js13.put("sessionKey", sessionkey);
- js13.put("orgTime", createTime);
- js13.put("days", settingValue);
- js13.put("settingCode", "S_PM_009");
- String result14 = client.doPost(
- "http://" + ServerAddress_ip + ":"
- + ServerAddress_duankou
- + Constants.serverAction
- + "/BarcodeAllowCancel",
- js13.toString(), "application/json");
- JSONObject jobj13 = new JSONObject(result14);
- JSONObject jobj14 = jobj13.optJSONObject("d");
- int status14 = jobj14.optInt("Status");
- String message14 = jobj14.optString("Message");
- if (status14 != 0) {
- overdueFlag = true;
- Bundle b = new Bundle();
- b.putString("message", message14);
- b.putInt("status", status14);
- Message m = new Message();
- m.what = 5;
- m.setData(b);
- exceptionHandler.sendMessage(m);
- }
- }
- }
- }
- } else {
- Bundle b = new Bundle();
- b.putString("message", message13);
- b.putInt("status", status13);
- Message m = new Message();
- m.what = 5;
- m.setData(b);
- exceptionHandler.sendMessage(m);
- }
- } else {
- Message m = new Message();
- m.what = 5;
- Bundle b = new Bundle();
- b.putInt("status", status12);
- b.putString("message", message12);
- m.setData(b);
- exceptionHandler.sendMessage(m);
- return;
- }
- } else {
- // 2023/3/14 不知道为什么有这个提示 31测漏气,3#试水,第一次进来提示,改成查询条码
- // Message m = new Message();
- // m.what = 2;
- // Bundle b = new Bundle();
- // b.putString("message", "该工序不可到达!请确认质量登记工序");
- // m.setData(b);
- // exceptionHandler.sendMessage(m);
- // return;
- operationFlag = "add";
- checkFlag = "1";
- JSONObject jsonObject28 = new JSONObject();
- jsonObject28.put("accountCode", accountCode);
- jsonObject28.put("userCode", checkCollectModify_userCode);
- jsonObject28.put("userPassword", password);
- jsonObject28.put("sessionKey", sessionkey);
- jsonObject28.put("procedureID", proId);// 工序ID,菜单页面传过来的
- jsonObject28.put("barcode", barcode);// 产品条码
- jsonObject28.put("isNewCheck", true);// 用于区分新查询缺陷的checkbarcode
- client = new WebClient();
- String result28 = client.doPost(
- "http://" + ServerAddress_ip + ":" + ServerAddress_duankou
- + Constants.BAR_CODE_VALID,
- jsonObject28.toString(), "application/json");
- JSONObject jsonObject29 = new JSONObject(result28);
- JSONObject jsonObject30 = jsonObject29.getJSONObject("d");
- int status30 = jsonObject30.getInt("Status");
- String message30 = jsonObject30.getString("Message");
- if (status30 == 0) {
- String result30 = jsonObject30.getString("Result");
- JSONObject resultObjBarCodeTable = new JSONObject(result30);
- JSONArray resultArrayBarCodeTable = (JSONArray) resultObjBarCodeTable
- .opt("BarCodeTable");// 之前的
- JSONArray resultArrayleakFlag4Table = (JSONArray) resultObjBarCodeTable
- .opt("leakFlag4Table");// 养水 数据
- JSONArray resultArrayleakFlag5Table = (JSONArray) resultObjBarCodeTable
- .opt("leakFlag5Table");// 试水 数据
- JSONArray resultArrayleakFlag6Table = (JSONArray) resultObjBarCodeTable
- .opt("leakFlag6Table");// 补裂位置 数据
- JSONArray resultArrayDefectTable = (JSONArray) resultObjBarCodeTable
- .opt("DefectTable");// 缺陷信息
- JSONObject jsonObject31 = (JSONObject) resultArrayBarCodeTable
- .get(0);
- String outErrMsg30 = jsonObject31.getString("out_errMsg");
- String missFlag = jsonObject31.optString("out_missFlag");
- if (!TextUtils.isEmpty(outErrMsg30)) {
- if (missFlag.equals("0")) {
- Message m = new Message();
- Bundle b = new Bundle();
- b.putInt("status", status30);
- b.putString("errorMsg", outErrMsg30);
- m.what = 0;
- m.setData(b);
- exceptionHandler.sendMessage(m);
- return;
- } else {
- Message m1 = new Message();
- Bundle b1 = new Bundle();
- b1.putString("errmsg", outErrMsg30);
- b1.putString("flag", missFlag);
- m1.what = 4;
- m1.setData(b1);
- exceptionHandler.sendMessage(m1);
- return;
- }
- } else {
- produceCodeIsValid = true;
- if (worknovalid) {
- productionInfo = new ProductionInfo();
- productionInfo.setUserId(Integer.parseInt(userID));
- productionInfo.setUserCode(worknouserCode);
- productionInfo.setUserName(workNoName);
- }
- // 2023/1/3 start 增加 缺陷信息赋值 z
- if (resultArrayDefectTable != null
- && resultArrayDefectTable.length() > 0) {
- for (int i = 0; i < resultArrayDefectTable.length(); i++) {
- ProductDefectInfo pdf = new ProductDefectInfo();
- JSONObject job = (JSONObject) resultArrayDefectTable
- .get(i);
- int defectId = job.optInt("DEFECTID");
- String defectCode = job.optString("DEFECTCODE");
- String defectName = job.optString("DEFECTNAME");
- DefectNo dn = new DefectNo();
- dn.setDefectId(defectId);
- dn.setDefectCode(defectCode);
- dn.setDefectName(defectName);
- pdf.setDefectNo(dn);
- pdf.setDeleteFlag("server");
- int defectPositionId = (int) job
- .optInt("DEFECTPOSITIONID");
- String defectPositionCode = job
- .optString("DEFECTPOSITIONCODE");
- String defectPositionName = job
- .optString("DEFECTPOSITIONNAME");
- DefectLocation dl = new DefectLocation();
- dl.setDefectPositionId(defectPositionId);
- dl.setDefectPositionCode(defectPositionCode);
- dl.setDefectPositionName(defectPositionName);
- pdf.setDefectLocation(dl);
- int defectProcedureId = job.optInt("DEFECTPROCEDUREID");
- String defectProcedureCode = job
- .optString("DEFECTPROCEDURECODE");
- String defectProcedureName = job
- .optString("DEFECTPROCEDURENAME");
- ResponsibilityProcedure rp = new ResponsibilityProcedure();
- rp.setDutyProcedureId(defectProcedureId);
- rp.setDutyProcedureCode(defectProcedureCode);
- rp.setDutyProcedureName(defectProcedureName);
- pdf.setResponsibilityProcedure(rp);
- DefectDeduction defectDeduction = new DefectDeduction();
- double defectDeductionNum = job
- .optDouble("DEFECTDEDUCTIONNUM");
- defectDeduction.setDefectDeductionNum(
- String.valueOf(defectDeductionNum));
- pdf.setDefectDeduction(defectDeduction);
- String specialDefect = job.optString("SPECIALDEFECT");
- if (specialDefect.equals("0")) {
- pdf.setSpecialDefectFlag(false);
- } else {
- pdf.setSpecialDefectFlag(true);
- }
- int defectUserId = (int) job.optInt("DEFECTUSERID");
- String defectUserCode = job.optString("DEFECTUSERCODE");
- String defectUserName = job.optString("DEFECTUSERNAME");
- int ProductionDataId = (int) job
- .optInt("DEFECTPRODUCTIONDATAID");
- if (defectProcedureId > 0) {
- WorkNo wn = new WorkNo();
- wn.setUserId(defectUserId);
- wn.setUserCode(defectUserCode);
- wn.setUserName(defectUserName);
- wn.setProductionDataId(ProductionDataId);
- pdf.setWorkno(wn);
- }
- else {
- WorkNo wn = new WorkNo();
- wn.setUserId(defectUserId);
- wn.setUserCode(defectUserCode);
- wn.setUserName(defectUserName);
- pdf.setWorkno(wn);
- }
- int jobs = job.optInt("JOBS");
- String jobsText = job.optString("JOBSTEXT");
- WorkType wt = new WorkType();
- wt.setJobsID(jobs);
- wt.setJobsName(jobsText);
- pdf.setWorkType(wt);
- int defectFineId = job.optInt("DEFECTFINEID");
- String defectFinesValue = job
- .optString("DEFECTFINEVALUE");
- DefectFines df = new DefectFines();
- df.setDefectFinesId(defectFineId);
- df.setDefectFinesName(defectFinesValue);
- pdf.setDefectFines(df);
- JSONArray defectResponsibles = job
- .optJSONArray("PDADefectResponsibles");
- List<DutyPerson> dutyPersonList = new ArrayList<DutyPerson>();
- if (defectResponsibles != null
- && defectResponsibles.length() > 0) {
- for (int k = 0; k < defectResponsibles
- .length(); k++) {
- JSONObject jo2 = (JSONObject) defectResponsibles
- .get(k);
- int staffId = jo2.optInt("StaffID");
- String staffCode = jo2.optString("StaffCode");
- String staffName = jo2.optString("StaffName");
- int staffStatus = jo2.optInt("StaffStatus");
- int uJobsId = jo2.optInt("UJobsID");
- int sJobsId = jo2.optInt("SJobsID");
- DutyPerson dp = new DutyPerson();
- dp.setStaffId(staffId);
- dp.setStaffCode(staffCode);
- dp.setStaffName(staffName);
- dp.setStaffStatus(staffStatus);
- dp.setJobsId(uJobsId);
- dp.setsJobsId(sJobsId);
- dp.setUserId(defectUserId);
- dp.setUserCode(defectUserCode);
- dutyPersonList.add(dp);
- }
- }
- pdf.setDutyPersonList(dutyPersonList);
- List<ImagePath> imagePathList = new ArrayList<ImagePath>();
- JSONArray imageJsonArray = job
- .optJSONArray("PDADefectImageResults");
- if (imageJsonArray != null
- && imageJsonArray.length() > 0) {
- for (int n = 0; n < imageJsonArray.length(); n++) {
- JSONObject imageJo = (JSONObject) imageJsonArray
- .get(n);
- String path = imageJo.optString("Imagepath");
- ImagePath ip = new ImagePath();
- ip.setServerPath(path);
- ip.setFlag("remote");
- String pPath1 = CommonUtil.getRootFilePath();
- String fileDir1 = pPath1
- + Constants.DATA_CACHE_PATH;
- File file1 = new File(fileDir1);
- if (!file1.exists()) {
- file1.mkdir();
- }
- String s = Md5Utils.encode(path);
- String imgName = s + ".jpg";
- File f1 = new File(file1.getAbsolutePath(),
- imgName);
- if (!f1.exists()) {
- try {
- f1.createNewFile();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- ip.setLocalPath(f1.getAbsolutePath());
- imagePathList.add(ip);
- }
- }
- String checkTime = job.optString("CHECKTIME");
- pdf.setCreateTime(checkTime);
- pdf.setDefectImgPath(imagePathList);
- productBugList.add(pdf);
- }
- Message messageproductBugList = new Message();
- Bundle bproductBugList = new Bundle();
- bproductBugList.putSerializable("productbuglist",
- (Serializable) productBugList);
- messageproductBugList.what = 10;
- messageproductBugList.setData(bproductBugList);
- handler.sendMessage(messageproductBugList);
- }
- // end z
- if (resultArrayleakFlag4Table != null
- && resultArrayleakFlag4Table.length() > 0) {
- JSONObject jsonObjectleakFlag4Table = (JSONObject) resultArrayleakFlag4Table
- .get(0);
- productionInfo.setLeakFlag4TablePOSITION(
- jsonObjectleakFlag4Table.optString("POSITION"));// 养水
- // 不合格位置
- }
- if (resultArrayleakFlag5Table != null
- && resultArrayleakFlag5Table.length() > 0) {
- JSONObject jsonObjectleakFlag5Table = (JSONObject) resultArrayleakFlag5Table
- .get(0);
- productionInfo.setLeakFlag5TablePOSITION(
- jsonObjectleakFlag5Table.optString("POSITION"));// 试水
- // 不合格位置
- }
- if (resultArrayleakFlag6Table != null
- && resultArrayleakFlag6Table.length() > 0) {
- JSONObject jsonObjectleakFlag6Table = (JSONObject) resultArrayleakFlag6Table
- .get(0);
- productionInfo.setLeakFlag6TablePOSITION(
- jsonObjectleakFlag6Table.optString("POSITION")); // 补裂位置
- mCheckRepairCrackPositionDate = jsonObjectleakFlag6Table
- .optString("POSITION");
- }
- out_goodsID = jsonObject31.getString("out_goodsID");
- out_goodsCode = jsonObject31.getString("out_goodsCode");
- out_goodsName = jsonObject31.getString("out_goodsName");
- out_groutingUserCode = jsonObject31
- .getString("out_groutingUserCode");
- productionInfo.setBarCode(barcode);
- productionInfo
- .setOut_Grade(jsonObject31.optInt("DefectFlagID"));
- productionInfo
- .setOfflineFlag(jsonObject31.optString("offlineFlag")); // 下标划线
- productionInfo.setOut_LeakFlag1Name(
- jsonObject31.optString("out_LeakFlag1Name"));// 漏气
- productionInfo.setOut_LeakFlag4Name(
- jsonObject31.optString("out_LeakFlag4Name"));// 养水
- productionInfo.setOut_LeakFlag5Name(
- jsonObject31.optString("out_LeakFlag5Name"));// 试水
- productionInfo.setOut_LeakFlag7Name(
- jsonObject31.optString("out_LeakFlag7Name"));// 修磨
- productionInfo.setGoodsId(Integer.parseInt(out_goodsID));
- productionInfo.setGoodsCode(out_goodsCode);
- productionInfo.setGoodsName(out_goodsName);
- specialRepairFlag = jsonObject31
- .optString("out_specialRepairFlag");
- specialRepairFlagName = jsonObject31
- .optString("out_specialRepairFlagName");
- refire = Integer
- .parseInt(jsonObject31.optString("out_isReFire"));
- refireName = jsonObject31.optString("out_isReFireName");
- String trademarkName = jsonObject31.optString("out_logoName");
- productionInfo.setTrademarkName(trademarkName);
- productionInfo
- .setOut_Grade(jsonObject31.optInt("DefectFlagID"));
- productionInfo
- .setOfflineFlag(jsonObject31.optString("offlineFlag")); // 下标划线
- String leakName = jsonObject31.optString("out_LeakFlag1Name");
- productionInfo.setLeak(leakName);
- String internalLeak = jsonObject31
- .optString("out_LeakFlag2Name");
- productionInfo.setInternalLeak(internalLeak);
- String passBall = jsonObject31.optString("out_LeakFlag3Name");
- productionInfo.setPassBall(passBall);
- JSONObject jsonObject45 = new JSONObject();
- jsonObject45.put("accountCode", accountCode);
- jsonObject45.put("userCode", checkCollectModify_userCode);
- jsonObject45.put("userPassword", password);
- jsonObject45.put("sessionKey", sessionkey);
- jsonObject45.put("barCode", barcode);// 产品条码
- client = new WebClient();
- String result45 = client.doPost(
- "http://" + ServerAddress_ip + ":"
- + ServerAddress_duankou
- + Constants.CHECK_COLLECT_HAND_OVER_URL,
- jsonObject45.toString(), "application/json");
- JSONObject jsonObject46 = new JSONObject(result45);
- JSONObject jsonObject47 = jsonObject46.getJSONObject("d");
- int status47 = jsonObject47.getInt("Status");
- if (status47 == 0) {
- String result47 = jsonObject47.getString("Result");
- JSONObject resultObj48 = new JSONObject(result47);
- JSONArray resultArray48 = (JSONArray) resultObj48
- .opt("PreProductCheck");
- if (resultArray48 != null && resultArray48.length() > 0) {
- JSONObject jobj49 = (JSONObject) resultArray48.opt(0);
- int goodsLevelTypeId = jobj49
- .optInt("GOODSLEVELTYPEID");
- int reworkProcedureId = jobj49
- .optInt("REWORKPROCEDUREID");
- productionInfo.setGoodsLevelTypeId(goodsLevelTypeId);
- productionInfo.setReworkProcedureId(reworkProcedureId);
- }
- }
- }
- }
- }
- }
- }
- else {
- operationFlag = "add";
- checkFlag = "1";
- JSONObject jsonObject28 = new JSONObject();
- jsonObject28.put("accountCode", accountCode);
- jsonObject28.put("userCode", checkCollectModify_userCode);
- jsonObject28.put("userPassword", password);
- jsonObject28.put("sessionKey", sessionkey);
- jsonObject28.put("procedureID", proId);// 工序ID,菜单页面传过来的
- jsonObject28.put("barcode", barcode);// 产品条码
- jsonObject28.put("isNewCheck", true);// 用于区分新查询缺陷的checkbarcode
- client = new WebClient();
- String result28 = client.doPost(
- "http://" + ServerAddress_ip + ":" + ServerAddress_duankou
- + Constants.BAR_CODE_VALID,
- jsonObject28.toString(), "application/json");
- JSONObject jsonObject29 = new JSONObject(result28);
- JSONObject jsonObject30 = jsonObject29.getJSONObject("d");
- int status30 = jsonObject30.getInt("Status");
- String message30 = jsonObject30.getString("Message");
- if (status30 == 0) {
- String result30 = jsonObject30.getString("Result");
- JSONObject resultObjBarCodeTable = new JSONObject(result30);
- JSONArray resultArrayBarCodeTable = (JSONArray) resultObjBarCodeTable
- .opt("BarCodeTable");// 之前的
- JSONArray resultArrayleakFlag4Table = (JSONArray) resultObjBarCodeTable
- .opt("leakFlag4Table");// 养水 数据
- JSONArray resultArrayleakFlag5Table = (JSONArray) resultObjBarCodeTable
- .opt("leakFlag5Table");// 试水 数据
- JSONArray resultArrayleakFlag6Table = (JSONArray) resultObjBarCodeTable
- .opt("leakFlag6Table");// 补裂 位置数据 传送门
- JSONArray resultArrayDefectTable = (JSONArray) resultObjBarCodeTable
- .opt("DefectTable");// 缺陷信息
- JSONObject jsonObject31 = (JSONObject) resultArrayBarCodeTable.get(0);
- String outErrMsg30 = jsonObject31.getString("out_errMsg");
- String missFlag = jsonObject31.optString("out_missFlag");
- if (!TextUtils.isEmpty(outErrMsg30)) {
- if (missFlag.equals("0")) {
- Message m = new Message();
- Bundle b = new Bundle();
- b.putInt("status", status30);
- b.putString("errorMsg", outErrMsg30);
- m.what = 0;
- m.setData(b);
- exceptionHandler.sendMessage(m);
- return;
- } else {
- Message m1 = new Message();
- Bundle b1 = new Bundle();
- b1.putString("errmsg", outErrMsg30);
- b1.putString("flag", missFlag);
- m1.what = 4;
- m1.setData(b1);
- exceptionHandler.sendMessage(m1);
- return;
- }
- } else {
- produceCodeIsValid = true;
- if (worknovalid) {
- productionInfo = new ProductionInfo();
- productionInfo.setUserId(Integer.parseInt(userID));
- productionInfo.setUserCode(worknouserCode);
- productionInfo.setUserName(workNoName);
- }
- // 2023/1/3 start 增加 缺陷信息赋值 z
- if (resultArrayDefectTable != null
- && resultArrayDefectTable.length() > 0) {
- for (int i = 0; i < resultArrayDefectTable.length(); i++) {
- ProductDefectInfo pdf = new ProductDefectInfo();
- JSONObject job = (JSONObject) resultArrayDefectTable.get(i);
- int defectId = job.optInt("DEFECTID");
- String defectCode = job.optString("DEFECTCODE");
- String defectName = job.optString("DEFECTNAME");
- DefectNo dn = new DefectNo();
- dn.setDefectId(defectId);
- dn.setDefectCode(defectCode);
- dn.setDefectName(defectName);
- pdf.setDefectNo(dn);
- pdf.setDeleteFlag("server");
- int defectPositionId = (int) job.optInt("DEFECTPOSITIONID");
- String defectPositionCode = job.optString("DEFECTPOSITIONCODE");
- String defectPositionName = job.optString("DEFECTPOSITIONNAME");
- DefectLocation dl = new DefectLocation();
- dl.setDefectPositionId(defectPositionId);
- dl.setDefectPositionCode(defectPositionCode);
- dl.setDefectPositionName(defectPositionName);
- pdf.setDefectLocation(dl);
- int defectProcedureId = job.optInt("DEFECTPROCEDUREID");
- String defectProcedureCode = job
- .optString("DEFECTPROCEDURECODE");
- String defectProcedureName = job
- .optString("DEFECTPROCEDURENAME");
- ResponsibilityProcedure rp = new ResponsibilityProcedure();
- rp.setDutyProcedureId(defectProcedureId);
- rp.setDutyProcedureCode(defectProcedureCode);
- rp.setDutyProcedureName(defectProcedureName);
- pdf.setResponsibilityProcedure(rp);
- DefectDeduction defectDeduction = new DefectDeduction();
- double defectDeductionNum = job.optDouble("DEFECTDEDUCTIONNUM");
- defectDeduction.setDefectDeductionNum(
- String.valueOf(defectDeductionNum));
- pdf.setDefectDeduction(defectDeduction);
- String specialDefect = job.optString("SPECIALDEFECT");
- if (specialDefect.equals("0")) {
- pdf.setSpecialDefectFlag(false);
- } else {
- pdf.setSpecialDefectFlag(true);
- }
- int defectUserId = (int) job.optInt("DEFECTUSERID");
- String defectUserCode = job.optString("DEFECTUSERCODE");
- String defectUserName = job.optString("DEFECTUSERNAME");
- int ProductionDataId = (int) job
- .optInt("DEFECTPRODUCTIONDATAID");
- if (defectProcedureId > 0) {
- WorkNo wn = new WorkNo();
- wn.setUserId(defectUserId);
- wn.setUserCode(defectUserCode);
- wn.setUserName(defectUserName);
- wn.setProductionDataId(ProductionDataId);
- pdf.setWorkno(wn);
- }
- else {
- WorkNo wn = new WorkNo();
- wn.setUserId(defectUserId);
- wn.setUserCode(defectUserCode);
- wn.setUserName(defectUserName);
- pdf.setWorkno(wn);
- }
- int jobs = job.optInt("JOBS");
- String jobsText = job.optString("JOBSTEXT");
- WorkType wt = new WorkType();
- wt.setJobsID(jobs);
- wt.setJobsName(jobsText);
- pdf.setWorkType(wt);
- int defectFineId = job.optInt("DEFECTFINEID");
- String defectFinesValue = job.optString("DEFECTFINEVALUE");
- DefectFines df = new DefectFines();
- df.setDefectFinesId(defectFineId);
- df.setDefectFinesName(defectFinesValue);
- pdf.setDefectFines(df);
- JSONArray defectResponsibles = job
- .optJSONArray("PDADefectResponsibles");
- List<DutyPerson> dutyPersonList = new ArrayList<DutyPerson>();
- if (defectResponsibles != null
- && defectResponsibles.length() > 0) {
- for (int k = 0; k < defectResponsibles.length(); k++) {
- JSONObject jo2 = (JSONObject) defectResponsibles.get(k);
- int staffId = jo2.optInt("StaffID");
- String staffCode = jo2.optString("StaffCode");
- String staffName = jo2.optString("StaffName");
- int staffStatus = jo2.optInt("StaffStatus");
- int uJobsId = jo2.optInt("UJobsID");
- int sJobsId = jo2.optInt("SJobsID");
- DutyPerson dp = new DutyPerson();
- dp.setStaffId(staffId);
- dp.setStaffCode(staffCode);
- dp.setStaffName(staffName);
- dp.setStaffStatus(staffStatus);
- dp.setJobsId(uJobsId);
- dp.setsJobsId(sJobsId);
- dp.setUserId(defectUserId);
- dp.setUserCode(defectUserCode);
- dutyPersonList.add(dp);
- }
- }
- pdf.setDutyPersonList(dutyPersonList);
- List<ImagePath> imagePathList = new ArrayList<ImagePath>();
- JSONArray imageJsonArray = job
- .optJSONArray("PDADefectImageResults");
- if (imageJsonArray != null && imageJsonArray.length() > 0) {
- for (int n = 0; n < imageJsonArray.length(); n++) {
- JSONObject imageJo = (JSONObject) imageJsonArray.get(n);
- String path = imageJo.optString("Imagepath");
- ImagePath ip = new ImagePath();
- ip.setServerPath(path);
- ip.setFlag("remote");
- String pPath1 = CommonUtil.getRootFilePath();
- String fileDir1 = pPath1 + Constants.DATA_CACHE_PATH;
- File file1 = new File(fileDir1);
- if (!file1.exists()) {
- file1.mkdir();
- }
- String s = Md5Utils.encode(path);
- String imgName = s + ".jpg";
- File f1 = new File(file1.getAbsolutePath(), imgName);
- if (!f1.exists()) {
- try {
- f1.createNewFile();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- ip.setLocalPath(f1.getAbsolutePath());
- imagePathList.add(ip);
- }
- }
- String checkTime = job.optString("CHECKTIME");
- pdf.setCreateTime(checkTime);
- pdf.setDefectImgPath(imagePathList);
- productBugList.add(pdf);
- }
- Message messageproductBugList = new Message();
- Bundle bproductBugList = new Bundle();
- bproductBugList.putSerializable("productbuglist",
- (Serializable) productBugList);
- messageproductBugList.what = 10;
- messageproductBugList.setData(bproductBugList);
- handler.sendMessage(messageproductBugList);
- }
- // end z
- out_goodsID = jsonObject31.getString("out_goodsID");
- out_goodsCode = jsonObject31.getString("out_goodsCode");
- out_goodsName = jsonObject31.getString("out_goodsName");
- out_groutingUserCode = jsonObject31.getString("out_groutingUserCode");
- productionInfo.setOut_Grade(jsonObject31.optInt("DefectFlagID"));
- productionInfo.setBarCode(barcode);
- productionInfo.setOfflineFlag(jsonObject31.optString("offlineFlag")); // 下标划线
- productionInfo.setOut_LeakFlag1Name(
- jsonObject31.optString("out_LeakFlag1Name"));// 漏气
- productionInfo.setOut_LeakFlag4Name(
- jsonObject31.optString("out_LeakFlag4Name"));// 养水
- productionInfo.setOut_LeakFlag5Name(
- jsonObject31.optString("out_LeakFlag5Name"));// 试水
- productionInfo.setOut_LeakFlag7Name(
- jsonObject31.optString("out_LeakFlag7Name"));// 修磨
- if (resultArrayleakFlag4Table != null
- && resultArrayleakFlag4Table.length() > 0) {
- JSONObject jsonObjectleakFlag4Table = (JSONObject) resultArrayleakFlag4Table
- .get(0);
- productionInfo.setLeakFlag4TablePOSITION(
- jsonObjectleakFlag4Table.optString("POSITION"));// 养水 不合格位置
- }
- if (resultArrayleakFlag5Table != null
- && resultArrayleakFlag5Table.length() > 0) {
- JSONObject jsonObjectleakFlag5Table = (JSONObject) resultArrayleakFlag5Table
- .get(0);
- productionInfo.setLeakFlag5TablePOSITION(
- jsonObjectleakFlag5Table.optString("POSITION"));// 试水 不合格位置
- }
- if (resultArrayleakFlag6Table != null
- && resultArrayleakFlag6Table.length() > 0) {
- JSONObject jsonObjectleakFlag6Table = (JSONObject) resultArrayleakFlag6Table
- .get(0);
- productionInfo.setLeakFlag6TablePOSITION(
- jsonObjectleakFlag6Table.optString("POSITION")); // 补裂位置
- mCheckRepairCrackPositionDate = jsonObjectleakFlag6Table
- .optString("POSITION");
- }
- productionInfo.setGoodsId(Integer.parseInt(out_goodsID));
- productionInfo.setGoodsCode(out_goodsCode);
- productionInfo.setGoodsName(out_goodsName);
- specialRepairFlag = jsonObject31.optString("out_specialRepairFlag");
- specialRepairFlagName = jsonObject31
- .optString("out_specialRepairFlagName");
- if (jsonObject31.has("out_isReFire")) {
- String out_isReFire = jsonObject31.optString("out_isReFire");
- if (!jsonObject31.isNull("out_isReFire")) {
- // 字段不为 null,可以进行相应的处理
- refire = Integer
- .parseInt(jsonObject31.optString("out_isReFire"));
- } else {
- // 字段为 null,可以进行相应的处理
- }
- }
- refireName = jsonObject31.optString("out_isReFireName");
- String trademarkName = jsonObject31.optString("out_logoName");
- productionInfo.setTrademarkName(trademarkName);
- productionInfo.setOut_Grade(jsonObject31.optInt("DefectFlagID"));
- productionInfo.setOfflineFlag(jsonObject31.optString("offlineFlag")); // 下标划线
- String leakName = jsonObject31.optString("out_LeakFlag1Name");
- productionInfo.setLeak(leakName);
- String internalLeak = jsonObject31.optString("out_LeakFlag2Name");
- productionInfo.setInternalLeak(internalLeak);
- String passBall = jsonObject31.optString("out_LeakFlag3Name");
- productionInfo.setPassBall(passBall);
- JSONObject jsonObject45 = new JSONObject();
- jsonObject45.put("accountCode", accountCode);
- jsonObject45.put("userCode", checkCollectModify_userCode);
- jsonObject45.put("userPassword", password);
- jsonObject45.put("sessionKey", sessionkey);
- jsonObject45.put("barCode", barcode);// 产品条码
- client = new WebClient();
- String result45 = client.doPost(
- "http://" + ServerAddress_ip + ":" + ServerAddress_duankou
- + Constants.CHECK_COLLECT_HAND_OVER_URL,
- jsonObject45.toString(), "application/json");
- JSONObject jsonObject46 = new JSONObject(result45);
- JSONObject jsonObject47 = jsonObject46.getJSONObject("d");
- int status47 = jsonObject47.getInt("Status");
- if (status47 == 0) {
- String result47 = jsonObject47.getString("Result");
- JSONObject resultObj48 = new JSONObject(result47);
- JSONArray resultArray48 = (JSONArray) resultObj48
- .opt("PreProductCheck");
- if (resultArray48 != null && resultArray48.length() > 0) {
- JSONObject jobj49 = (JSONObject) resultArray48.opt(0);
- int goodsLevelTypeId = jobj49.optInt("GOODSLEVELTYPEID");
- int reworkProcedureId = jobj49.optInt("REWORKPROCEDUREID");
- productionInfo.setGoodsLevelTypeId(goodsLevelTypeId);
- productionInfo.setReworkProcedureId(reworkProcedureId);
- }
- }
- }
- }
- else {
- Message m = new Message();
- m.what = 0;
- Bundle b = new Bundle();
- b.putInt("status", status30);
- b.putString("errorMsg", message30);
- m.setData(b);
- exceptionHandler.sendMessage(m);
- return;
- }
- //
- }
- }
- }
- }
- else {
- JSONObject jsonObject30 = new JSONObject();
- jsonObject30.put("accountCode", accountCode);
- jsonObject30.put("userCode", checkCollectModify_userCode);
- jsonObject30.put("userPassword", password);
- jsonObject30.put("sessionKey", sessionkey);
- jsonObject30.put("procedureID", proId);// 工序ID,菜单页面传过来的
- jsonObject30.put("barcode", barcode);// 产品条码
- jsonObject30.put("isNewCheck", true);// 用于区分新查询缺陷的checkbarcode
- client = new WebClient();
- String result30 = client.doPost("http://" + ServerAddress_ip + ":" + ServerAddress_duankou
- + Constants.BAR_CODE_VALID, jsonObject30.toString(), "application/json");
- JSONObject jsonObject31 = new JSONObject(result30);
- JSONObject jsonObject32 = jsonObject31.getJSONObject("d");
- int status32 = jsonObject32.getInt("Status");
- String message32 = jsonObject32.getString("Message");
- if (status32 == 0) { // 2022/12/29 王英杰 修改
- String result32 = jsonObject32.getString("Result");
- // 没有 过多的操作 所以 不做数据处理
- JSONObject resultObjBarCodeTable = new JSONObject(result32);
- JSONArray resultArrayBarCodeTable = (JSONArray) resultObjBarCodeTable
- .opt("BarCodeTable");// 之前的
- JSONObject resultObjleakFlag4Table = new JSONObject(result30);
- JSONArray resultArrayleakFlag4Table = (JSONArray) resultObjleakFlag4Table
- .opt("leakFlag4Table");// 养水 数据
- JSONObject resultObjleakFlag5Table = new JSONObject(result30);
- JSONArray resultArrayleakFlag5Table = (JSONArray) resultObjleakFlag5Table
- .opt("leakFlag5Table");// 试水 数据
- JSONArray resultArrayleakFlag6Table = (JSONArray) resultObjBarCodeTable
- .opt("leakFlag6Table");// 补裂 位置数据 传送门
- JSONObject jsonObject33 = (JSONObject) resultArrayBarCodeTable.get(0);
- String outErrMsg33 = jsonObject33.getString("out_errMsg");
- String missFlag = jsonObject33.optString("out_missFlag");
- if (!TextUtils.isEmpty(outErrMsg33)) {
- produceCodeIsValid = false;
- if (missFlag.equals("0")) {
- Message m = new Message();
- Bundle b = new Bundle();
- b.putInt("status", status32);
- b.putString("errorMsg", outErrMsg33);
- m.what = 0;
- m.setData(b);
- exceptionHandler.sendMessage(m);
- return;
- } else {
- Message m1 = new Message();
- Bundle b1 = new Bundle();
- b1.putString("errmsg", outErrMsg33);
- b1.putString("flag", missFlag);
- m1.what = 6;
- m1.setData(b1);
- exceptionHandler.sendMessage(m1);
- return;
- }
- }
- }
- else {
- Message m = new Message();
- m.what = 0;
- Bundle b = new Bundle();
- b.putInt("status", status32);
- b.putString("errorMsg", message32);
- m.setData(b);
- exceptionHandler.sendMessage(m);
- return;
- }
- }
- }
- else {
- Message m = new Message();
- m.what = 0;
- Bundle b = new Bundle();
- b.putInt("status", status);
- b.putString("errorMsg", msg);
- m.setData(b);
- exceptionHandler.sendMessage(m);
- return;
- }
- String result30;
- WebClient client = new WebClient();
- JSONObject jsonObject30 = new JSONObject();
- jsonObject30.put("accountCode", accountCode);
- jsonObject30.put("userCode", checkCollectModify_userCode);
- jsonObject30.put("userPassword", password);
- jsonObject30.put("sessionKey", sessionkey);
- result30 = client.doPost(
- "http://" + ServerAddress_ip + ":" + ServerAddress_duankou + Constants.GET_GOODS_GRADE,
- jsonObject30.toString(), "application/json");
- JSONObject jsonObject31 = new JSONObject(result30);
- JSONObject jsonobject32 = jsonObject31.getJSONObject("d");
- int status32 = jsonobject32.getInt("Status");
- String message32 = jsonobject32.getString("Message");
- if (status32 == 0) {
- String json33 = jsonobject32.getString("Result");
- JSONArray jsonArray34 = new JSONArray(json33);
- listProductClassify = new ArrayList<ProductClassifyInfo>();
- for (int i = 0; i < jsonArray34.length(); i++) {
- classifyInfo = new ProductClassifyInfo();
- JSONObject jsonObject35 = (JSONObject) jsonArray34.get(i);
- classifyInfo.setGoodsLevelTypeID((int) jsonObject35.getDouble("GOODSLEVELTYPEID"));
- classifyInfo.setDefectFlagName(jsonObject35.getString("DEFECTFLAGNAME"));
- classifyInfo.setDefectFlagId((int) jsonObject35.getInt("DEFECTFLAGID"));
- listProductClassify.add(i, classifyInfo);
- }
- } else {
- Message m = new Message();
- m.what = 0;
- Bundle b = new Bundle();
- b.putInt("status", status32);
- b.putString("errorMsg", message32);
- m.setData(b);
- exceptionHandler.sendMessage(m);
- return;
- }
- Message m = new Message();
- m.what = 1;
- Bundle b = new Bundle();
- b.putSerializable("productbuglist", (Serializable) productBugList);
- b.putSerializable("productclassifylist", (Serializable) listProductClassify);
- m.setData(b);
- handler.sendMessage(m);
- return;
- }
- catch (Exception e) {
- e.printStackTrace();
- Message m = new Message();
- m.what = 2;
- Bundle b4 = new Bundle();
- b4.putString("message", "网络连接异常");
- m.setData(b4);
- exceptionHandler.sendMessage(m);
- return;
- }
- }
- }
- };
- @SuppressWarnings("unchecked")
- @Override
- protected void onActivityResult(int requestCode, int resultCode, Intent data) {
- if (requestCode == 101 && resultCode == 103) {
- barcode.setEnabled(true);
- barcode.setText("");
- barcode.setFocusable(true);
- barcode.setFocusableInTouchMode(true);
- barcode.requestFocus();
- barcode.findFocus();
- barcode.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
- int dend) {
- return null;
- }
- } });
- CommonUtil.BarcodeMaxLength(barcode, 50);
- bugnotxt.setEnabled(true);
- bugnotxt.setText("");
- bugnotxt.setFocusable(true);
- bugnotxt.setFocusableInTouchMode(true);
- bugnotxt.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
- int dend) {
- return null;
- }
- } });
- loctxt.setEnabled(true);
- loctxt.setText("");
- loctxt.setFocusable(true);
- loctxt.setFocusableInTouchMode(true);
- loctxt.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
- int dend) {
- return null;
- }
- } });
- }
- if (requestCode == 100 && resultCode == 101) {
- try {
- Bundle bundle = data.getExtras();
- productBugList = (List<ProductDefectInfo>) bundle.getSerializable("productBugList");
- if (null != productBugList && productBugList.size() > 0) {
- save.setText("保存(" + productBugList.size() + ")");
- bugnotxt.setText("");
- bugnotxt.requestFocus();
- loctxt.setText("");
- bugnametxt.setText("");
- mAdapter = new SwipeAdapter(CheckCollectModifyActivity.this, mListView.getRightViewWidth(),
- ServerAddress_ip, ServerAddress_duankou, accountCode, checkCollectModify_userCode, password,
- sessionkey, productBugList);
- mListView.setAdapter(mAdapter);
- mAdapter.setOnRightItemClickListener(new SwipeAdapter.onRightItemClickListener() {
- @Override
- public void onRightItemClick(View v, int position) {
- if (!overdueFlag) {
- ProductDefectInfo defectInfo = productBugList.get(position);
- if (defectInfo.getDeleteFlag().equals("server")) {
- deleteFlag = true;
- }
- mListView.deleteItem(mListView.getChildAt(position));
- productBugList.remove(position);
- save.setText("保存(" + productBugList.size() + ")");
- mAdapter.notifyDataSetChanged();
- }
- }
- });
- }
- } catch (Exception e) {
- }
- }
- if (requestCode == 102 && resultCode == RESULT_OK) {
- Bundle bundle = data.getExtras();
- String scanResult = bundle.getString("result");
- View rootview = this.getWindow().getDecorView();
- EditText v = (EditText) rootview.findFocus();
- int id = v.getId();
- v.setText(scanResult);
- v.setSelection(scanResult.length());
- switch (id) {
- case R.id.user_code:
- String workno = v.getText().toString();
- if (TextUtils.isEmpty(workno)) {
- CustomToast.showToast(getApplicationContext(), "生产工号不能为空", 2000);
- v.setFocusable(true);
- v.requestFocus();
- return;
- }
- ProcessDialogUtils.showProcessDialog(CheckCollectModifyActivity.this);
- JSONObject sendJsonHead = new JSONObject();
- try {
- sendJsonHead.put("accountCode", accountCode);
- sendJsonHead.put("userCode", checkCollectModify_userCode);
- sendJsonHead.put("userPassword", password);
- sendJsonHead.put("sessionKey", sessionkey);
- // 生产工号检验请求数据
- sendJsonHead.put("procedureID", proId);// 工序ID,菜单页面传过来的
- sendJsonHead.put("procedureUserCode", workno);// 生产工号
- worknoEdt.setEnabled(false);
- worknoEdt.setFocusable(false);
- worknoEdt.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
- int dend) {
- return source.length() < 1 ? dest.subSequence(dstart, dend) : "";
- }
- } });
- barcode.setEnabled(false);
- barcode.setFocusable(false);
- barcode.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
- int dend) {
- return source.length() < 1 ? dest.subSequence(dstart, dend) : "";
- }
- } });
- bugnotxt.setEnabled(false);
- bugnotxt.setFocusable(false);
- bugnotxt.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
- int dend) {
- return source.length() < 1 ? dest.subSequence(dstart, dend) : "";
- }
- } });
- loctxt.setEnabled(false);
- loctxt.setFocusable(false);
- loctxt.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
- int dend) {
- return source.length() < 1 ? dest.subSequence(dstart, dend) : "";
- }
- } });
- thread = new HandlerThread("userThread", 5);
- thread.start();
- mHandler = new Handler(thread.getLooper());
- UserRunnable userRunnable = new UserRunnable(sendJsonHead);
- mHandler.post(userRunnable);
- } catch (JSONException e1) {
- e1.printStackTrace();
- }
- break;
- case R.id.bar_code:
- String worknocode = worknoEdt.getText().toString();
- if (TextUtils.isEmpty(worknocode)) {
- // Toast.makeText(getApplicationContext(), "生产工号不能为空",
- // Toast.LENGTH_SHORT).show();
- CustomToast.showToast(getApplicationContext(), "生产工号不能为空", 2000);
- worknoEdt.setEnabled(true);
- worknoEdt.setFocusable(true);
- worknoEdt.setFocusableInTouchMode(true);
- worknoEdt.requestFocus();
- worknoEdt.findFocus();
- worknoEdt.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
- int dend) {
- return null;
- }
- } });
- return;
- } else {
- if (!worknovalid) {
- // Toast.makeText(getApplicationContext(), "请先验证生产工号",
- // Toast.LENGTH_SHORT).show();
- CustomToast.showToast(getApplicationContext(), "请先验证生产工号", 2000);
- worknoEdt.setEnabled(true);
- worknoEdt.setFocusable(true);
- worknoEdt.setFocusableInTouchMode(true);
- worknoEdt.requestFocus();
- worknoEdt.findFocus();
- worknoEdt.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start, int end, Spanned dest,
- int dstart, int dend) {
- return null;
- }
- } });
- return;
- }
- }
- String code = v.getText().toString().trim();
- ProcessDialogUtils.showProcessDialog(CheckCollectModifyActivity.this);
- if (!CommonUtil.isNumber(code)) {
- ProcessDialogUtils.closeProgressDilog();
- // CommonUtil.showRepeatDialog(code+"格式不匹配",CheckCollectModifyActivity.this);
- // Toast.makeText(getApplicationContext(), code + "格式不匹配",
- // Toast.LENGTH_SHORT).show();
- CustomToast.showToast(getApplicationContext(), code + "格式不匹配", 2000);
- barcode.setEnabled(true);
- barcode.setText("");
- barcode.setFocusable(true);
- barcode.setFocusableInTouchMode(true);
- barcode.requestFocus();
- barcode.findFocus();
- barcode.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
- int dend) {
- return null;
- }
- } });
- CommonUtil.BarcodeMaxLength(barcode, 50);
- return;
- }
- productNumber.setText("");
- productCode.setText("");
- productName.setText("");
- refineEdt.setText("");
- bugnotxt.setText("");
- bugnametxt.setText("");
- loctxt.setText("");
- trademarkNameTxt.setText("");
- // repairEdt.setText("");
- if (classifySpin.getSelectedItem() != null) {
- listProductClassify.removeAll(listProductClassify);
- if (adapterProductClassify != null) {
- adapterProductClassify.notifyDataSetChanged();
- }
- }
- if (gotoSpin.getSelectedItem() != null) {
- listReWorkProcedure.clear();
- if (adapterReWorkProcedure != null) {
- adapterReWorkProcedure.notifyDataSetChanged();
- }
- }
- if (productBugList != null && productBugList.size() > 0) {
- productBugList.removeAll(productBugList);
- if (mAdapter != null) {
- mAdapter.notifyDataSetChanged();
- }
- save.setText("保存(" + productBugList.size() + ")");
- }
- barcode.setEnabled(false);
- barcode.setFocusable(false);
- barcode.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
- int dend) {
- return source.length() < 1 ? dest.subSequence(dstart, dend) : "";
- }
- } });
- bugnotxt.setEnabled(false);
- bugnotxt.setFocusable(false);
- bugnotxt.setFocusableInTouchMode(false);
- bugnotxt.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
- int dend) {
- return source.length() < 1 ? dest.subSequence(dstart, dend) : "";
- }
- } });
- loctxt.setEnabled(false);
- loctxt.setFocusable(false);
- loctxt.setFocusableInTouchMode(false);
- loctxt.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
- int dend) {
- return source.length() < 1 ? dest.subSequence(dstart, dend) : "";
- }
- } });
- thread = new HandlerThread("barcodeThread", 5);
- thread.start();
- mHandler = new Handler(thread.getLooper());
- BarcodeRunnable barcodeRunnable = new BarcodeRunnable(code, obj);
- mHandler.post(barcodeRunnable);
- break;
- }
- }
- }
- @Override
- public void onBackPressed() {
- if (productBugList != null && productBugList.size() > 0) {
- productBugList.removeAll(productBugList);
- }
- super.onBackPressed();
- }
- @Override
- public Resources getResources() {
- Resources res = super.getResources();
- Configuration config = new Configuration();
- config.setToDefaults();
- res.updateConfiguration(config, res.getDisplayMetrics());
- return res;
- }
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.update_check_collect, menu);
- return true;
- }
- }
|