CheckCollectModifyActivity.java 229 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213
  1. package com.jiaju.activity;
  2. import java.io.File;
  3. import java.io.IOException;
  4. import java.io.Serializable;
  5. import java.lang.ref.WeakReference;
  6. import java.util.ArrayList;
  7. import java.util.HashMap;
  8. import java.util.LinkedHashMap;
  9. import java.util.List;
  10. import org.json.JSONArray;
  11. import org.json.JSONException;
  12. import org.json.JSONObject;
  13. import com.jiaju.adapter.ProductClassifyAdapter;
  14. import com.jiaju.adapter.ReworkProcedureSpinnerAdapter;
  15. import com.jiaju.adapter.SwipeAdapter;
  16. import com.jiaju.model.DefectDeduction;
  17. import com.jiaju.model.DefectFines;
  18. import com.jiaju.model.DefectLocation;
  19. import com.jiaju.model.DefectNo;
  20. import com.jiaju.model.DutyPerson;
  21. import com.jiaju.model.ImagePath;
  22. import com.jiaju.model.ProductClassifyInfo;
  23. import com.jiaju.model.ProductDefectInfo;
  24. import com.jiaju.model.ProductionInfo;
  25. import com.jiaju.model.ResponsibilityProcedure;
  26. import com.jiaju.model.ReworkProcedureInfo;
  27. import com.jiaju.model.WorkNo;
  28. import com.jiaju.model.WorkType;
  29. import com.jiaju.net.OkAsyncHttpClient;
  30. import com.jiaju.net.WebClient;
  31. import com.jiaju.utils.CommonUtil;
  32. import com.jiaju.utils.Constants;
  33. import com.jiaju.utils.CustomToast;
  34. import com.jiaju.utils.Md5Utils;
  35. import com.jiaju.utils.PopupWindowCheckChoose;
  36. import com.jiaju.utils.PopupWindowCheckChoose.onEventLisenter;
  37. import com.jiaju.utils.ProcessDialogUtils;
  38. import com.jiaju.utils.ViewUtil;
  39. import com.jiaju.widget.DefectCommonPopMenu;
  40. import com.jiaju.widget.SwipeListView;
  41. import android.app.Activity;
  42. import android.app.Notification;
  43. import android.content.Context;
  44. import android.content.Intent;
  45. import android.content.SharedPreferences;
  46. import android.content.res.Configuration;
  47. import android.content.res.Resources;
  48. import android.os.Bundle;
  49. import android.os.Handler;
  50. import android.os.HandlerThread;
  51. import android.os.Message;
  52. import android.text.Editable;
  53. import android.text.InputFilter;
  54. import android.text.InputType;
  55. import android.text.Spanned;
  56. import android.text.TextUtils;
  57. import android.text.TextWatcher;
  58. import android.view.Gravity;
  59. import android.view.KeyEvent;
  60. import android.view.Menu;
  61. import android.view.MotionEvent;
  62. import android.view.View;
  63. import android.view.View.OnClickListener;
  64. import android.view.View.OnFocusChangeListener;
  65. import android.view.View.OnTouchListener;
  66. import android.view.inputmethod.EditorInfo;
  67. import android.view.inputmethod.InputMethodManager;
  68. import android.widget.AbsListView;
  69. import android.widget.AdapterView;
  70. import android.widget.Button;
  71. import android.widget.EditText;
  72. import android.widget.ImageButton;
  73. import android.widget.ImageView;
  74. import android.widget.LinearLayout;
  75. import android.widget.PopupWindow;
  76. import android.widget.RelativeLayout;
  77. import android.widget.Spinner;
  78. import android.widget.TextView;
  79. import android.widget.Toast;
  80. /**
  81. * 质量登记
  82. *
  83. * @author wangyingjie
  84. *
  85. */
  86. public class CheckCollectModifyActivity extends Activity {
  87. private EditText barcode;
  88. private String accountCode;
  89. private static String checkCollectModify_userCode;
  90. private String password;
  91. private String sessionkey;
  92. private SharedPreferences preferences;
  93. private String ServerAddress_ip;
  94. private String ServerAddress_duankou;
  95. private HandlerThread thread;
  96. private Handler mHandler;
  97. private WebClient client = null;
  98. private ReworkProcedureSpinnerAdapter adapterReWorkProcedure;
  99. private List<ReworkProcedureInfo> listReWorkProcedure = null;// 跳转信息列表
  100. private int proId;
  101. private ProductionInfo productionInfo;
  102. private Button save;
  103. private ImageButton backBtn;
  104. private TextView back;
  105. private Spinner gotoSpin;
  106. private TextView productNumber;
  107. private TextView productCode, productName;
  108. private SwipeAdapter mAdapter;
  109. private int defectflag = 1;
  110. private List<ProductClassifyInfo> listProductClassify = null;
  111. private List<ProductClassifyInfo> listCheckLeak = null;// 漏气数据源
  112. private List<ProductClassifyInfo> listCheckNourishingWater = null;// 养水数据源
  113. private List<ProductClassifyInfo> listCheckNourishingWaterPosition = null;// 养水不合格位置数据源
  114. private List<ProductClassifyInfo> listCheckWaterTest = null;// 试水数据源
  115. private List<ProductClassifyInfo> listCheckWaterTestPosition = null;// 试水不合格位置数据源
  116. private List<ProductClassifyInfo> listCheckRepairCrackPosition = null;// 补裂位置数据源
  117. private List<ProductClassifyInfo> listCheckOfflineIdentificatio = null;// 下标划线数据源
  118. private List<ProductClassifyInfo> list_null = new ArrayList<ProductClassifyInfo>();// 空数据源
  119. private String defectLocation;
  120. private Spinner classifySpin;
  121. private Spinner check_leak;// 漏气
  122. private Spinner check_nourishing_water;// 养水
  123. private Spinner check_nourishing_water_position;// 养水不合格位置
  124. private Spinner check_water_test;// 试水
  125. private Spinner check_grinding_test;// 修磨
  126. private Spinner check_water_test_position;// 试水不合格位置
  127. private Spinner check_offline_identificatio;// 下线标识
  128. private TextView check_repair_crack_position;// 补裂位置
  129. private LinearLayout lay_check_repair_crack_position;// 补裂位置布局
  130. private ProductClassifyInfo classifyInfo = null;
  131. private ProductClassifyAdapter adapterProductClassify;
  132. private ProductClassifyAdapter adapterCheckLeak;// 漏气适配器
  133. private ProductClassifyAdapter adapterCheckNourishingWater;// 养水适配器
  134. private ProductClassifyAdapter adapterCheckNourishingWaterPosition;// 养水不合格位置适配器
  135. private ProductClassifyAdapter adapterCheckOfflineIdentificatio;// 下标划线适配器
  136. private ProductClassifyAdapter adapterCheckWaterTest;// 试水适配器
  137. private ProductClassifyAdapter adapterCheckWaterTestPosition;// 试水不合格位置适配器
  138. private ProductClassifyAdapter adapterCheckRepairCrackPositionPosition;// 补裂位置适配器
  139. private Button recordBug;// 记录缺陷按钮
  140. private SwipeListView mListView;
  141. private int modelType;
  142. int productionDataId;
  143. private EditText worknoEdt;
  144. private int collectType; // 采集类型:1-集中 2-单点
  145. private int nodeType;
  146. private TextView title;
  147. private boolean worknovalid;
  148. private boolean defectnovalid;
  149. private String userID = "";// 条码对应的产品ID
  150. private String worknouserCode;
  151. private boolean produceCodeIsValid = false;
  152. private String out_goodsID;
  153. private String out_goodsCode;
  154. private String out_goodsName;
  155. private String out_groutingUserCode;
  156. private String operationFlag;
  157. private String workNoName;
  158. private EditText bugnotxt;
  159. private String defectno;
  160. private DefectNo defectNo;
  161. private int defectId;
  162. private String defectName;
  163. private TextView bugnametxt;
  164. private EditText loctxt;
  165. private boolean defectlocationvalid;
  166. private DefectLocation dl;
  167. private boolean refineflag;
  168. private TextView refineEdt;
  169. private ImageView checkCollectModify;
  170. private boolean repairFlag;
  171. private TextView repairEdt;
  172. private LinearLayout repairLay;
  173. private ImageView productRecord;
  174. private RelativeLayout parent;
  175. private PopupWindow mPopupWindow; // 弹出框
  176. private int refire;
  177. private String refireName;
  178. private String specialRepairFlag;
  179. private String specialRepairFlagName;
  180. private List<WorkNo> worknolist = null;
  181. public View footerdivider;
  182. public Object obj = new Object();
  183. private boolean dryRepairFlag = false;
  184. private ReworkProcedureInfo reworkProcedureInfo;
  185. private String timestamp;
  186. private TextView trademarkNameTxt;
  187. private TextView tvLeak;
  188. private TextView tvInternalLeak;
  189. private TextView tvPassBall;
  190. private String user;
  191. private boolean overdueFlag = false;
  192. private String checkTime;
  193. private String remarks;
  194. private EditText memoEdt;
  195. private TextView tvLocName;
  196. private Handler h = new Handler();
  197. private ExceptionHandler exceptionHandler = new ExceptionHandler(this);
  198. private SaveValidHandler saveValidHandler = new SaveValidHandler(this);
  199. private ResultHandler handler = new ResultHandler(this);
  200. private Handler barcodeUpperH = new Handler();
  201. private String barcodeUpper;
  202. private String checkFlag = "1";
  203. private boolean deleteFlag;
  204. private int originalGoodsLevelTypeId;
  205. private static String repeatFlag = "";
  206. private List<ProductDefectInfo> productBugList = new ArrayList<ProductDefectInfo>();
  207. private OkAsyncHttpClient mClient;
  208. private String GOODSMODELforCheck = "";// 判断产品 是大件还是小件 通过扫描barcode BAR_CODE_VALID获得
  209. private String RECYCLINGFLAG = "";
  210. private String webServerAddress_port;
  211. private ArrayList<String> mList = new ArrayList();
  212. private PopupWindowCheckChoose mPopup;
  213. private String mCheckRepairCrackPositionDate = "";
  214. private ProductClassifyInfo check_offline_identificatioInfo;
  215. private LinearLayout llay_cold_repair_category;// 冷补类别
  216. private Spinner check_cold_repair_category;// 冷补类别
  217. private List<ProductClassifyInfo> listCheckColdRepairCategory = null;// 冷补类别
  218. private ProductClassifyAdapter adapterCheckColdRepairCategory;// 冷补类别适配器
  219. private List<ProductClassifyInfo> listCheckGrinding = null;// 修磨数据源
  220. private ProductClassifyAdapter adapterCheckGrinding;// 修磨适配器
  221. private static String Mout_ReworkProcedureId = "";
  222. private static String refireflag = "";
  223. @Override
  224. protected void onCreate(Bundle savedInstanceState) {
  225. super.onCreate(savedInstanceState);
  226. setContentView(R.layout.update_check_collect);
  227. initView();
  228. Bundle b = getIntent().getExtras();
  229. String procedureName = b.getString("ProcedureName");
  230. proId = b.getInt("procedureId");
  231. modelType = b.getInt("modelType");
  232. collectType = b.getInt("collectType");
  233. procedureName = b.getString("procedureName");
  234. nodeType = b.getInt("nodeType");
  235. title.setText(procedureName);// 设置标题
  236. gotoSpin.setEnabled(false);
  237. preferences = getSharedPreferences("user", Context.MODE_PRIVATE);
  238. ServerAddress_ip = preferences.getString("ServerAddress_ip", "");
  239. mClient = OkAsyncHttpClient.getInstance(CheckCollectModifyActivity.this);
  240. ServerAddress_duankou = preferences.getString("ServerAddress_duankou", "");
  241. // webServerAddress_port = preferences.getString("WebServerAddress_port", "");
  242. webServerAddress_port = "9001";
  243. accountCode = preferences.getString("AccountCode", "");
  244. checkCollectModify_userCode = preferences.getString("UserCode", "");
  245. password = preferences.getString("UserPassword", "");
  246. sessionkey = preferences.getString("SessionKey", "");
  247. CommonUtil.BarcodeMaxLength(barcode, 50);
  248. if (collectType == 1) {
  249. worknoEdt.setSelectAllOnFocus(true);
  250. worknoEdt.setFocusable(true);
  251. worknoEdt.requestFocus();
  252. worknoEdt.findFocus();
  253. }
  254. repeatFlag = System.currentTimeMillis() + "-" + checkCollectModify_userCode;
  255. // 标题包含漏气 漏气就能点击 包含养水 养水就能点击 包含试水 试水 就能点击
  256. // 养水或者 试水不合格 那对应的 不合格位置 就会放开 否则就会 禁止点击
  257. check_leak.setEnabled(false);// 漏气
  258. check_nourishing_water.setEnabled(false);// 养水
  259. check_water_test.setEnabled(false);// 试水
  260. lay_check_repair_crack_position.setEnabled(false);// 补裂位置
  261. if (title.getText().toString().indexOf("漏气") != -1) {
  262. check_leak.setEnabled(true);// 漏气
  263. } else if (title.getText().toString().indexOf("养水") != -1) {
  264. check_nourishing_water.setEnabled(true);// 养水
  265. } else if (title.getText().toString().indexOf("试水") != -1) {
  266. check_water_test.setEnabled(true);// 试水
  267. } else if (title.getText().toString().indexOf("补裂") != -1) {// 放开补裂位置控件权限
  268. lay_check_repair_crack_position.setEnabled(true);// 补裂位置
  269. } else if (proId == 125) {// 三车间 三检 放开下线标识控件权限
  270. check_offline_identificatio.setEnabled(true); // 下线标识
  271. }
  272. if ((proId == 125) || (proId == 131)) { // todo 三检 的时候 增加 冷补类别 -- 外观: 冷补返工为冷补确认, --功能: 冷补返工为冷补交接 --注:
  273. // 产品等级选择为冷补后,必须选择[冷补类别]
  274. // llay_cold_repair_category.setVisibility(View.VISIBLE);
  275. }
  276. if (proId == 157 ) { //修模进
  277. check_leak.setEnabled(true);// 漏气
  278. }
  279. if (proId == 123 || proId == 157) { // 修模 养水 进
  280. classifySpin.setEnabled(false);
  281. }
  282. check_nourishing_water_position.setEnabled(false);
  283. check_water_test_position.setEnabled(false);
  284. AllListeners();
  285. }
  286. private void initView() {
  287. barcode = (EditText) findViewById(R.id.bar_code);
  288. barcode.setRawInputType(InputType.TYPE_CLASS_NUMBER);
  289. footerdivider = findViewById(R.id.footerdivider);
  290. repairEdt = (TextView) findViewById(R.id.repairtxt);
  291. backBtn = (ImageButton) findViewById(R.id.left_img);
  292. checkCollectModify = (ImageView) findViewById(R.id.modifyid);
  293. recordBug = (Button) findViewById(R.id.check_record_bug);
  294. save = (Button) findViewById(R.id.check_save);
  295. back = (TextView) findViewById(R.id.back);
  296. classifySpin = (Spinner) findViewById(R.id.check_classify);
  297. productNumber = (TextView) findViewById(R.id.check_product_number);
  298. productCode = (TextView) findViewById(R.id.check_product_code);
  299. productName = (TextView) findViewById(R.id.check_product_name);
  300. tvLeak = (TextView) findViewById(R.id.tvLeak);
  301. tvInternalLeak = (TextView) findViewById(R.id.tvInternalLeak);
  302. tvLocName = (TextView) findViewById(R.id.tvLocName);
  303. tvPassBall = (TextView) findViewById(R.id.tvPassBall);
  304. mListView = (SwipeListView) findViewById(R.id.listview);
  305. trademarkNameTxt = (TextView) findViewById(R.id.trademarkName);
  306. memoEdt = (EditText) findViewById(R.id.memoEdt);
  307. memoEdt.setOnTouchListener(new OnTouchListener() {
  308. public boolean onTouch(View view, MotionEvent event) {
  309. if (view.getId() == R.id.memoEdt) {
  310. view.getParent().requestDisallowInterceptTouchEvent(true);
  311. switch (event.getAction() & MotionEvent.ACTION_MASK) {
  312. case MotionEvent.ACTION_UP:
  313. view.getParent().requestDisallowInterceptTouchEvent(false);
  314. break;
  315. }
  316. }
  317. return false;
  318. }
  319. });
  320. title = (TextView) findViewById(R.id.title);
  321. gotoSpin = (Spinner) findViewById(R.id.check_goto_job);
  322. check_leak = (Spinner) findViewById(R.id.check_leak);// 漏气
  323. check_nourishing_water = (Spinner) findViewById(R.id.check_nourishing_water);// 养水
  324. check_nourishing_water_position = (Spinner) findViewById(R.id.check_nourishing_water_position);// 养水不合格位置
  325. check_water_test = (Spinner) findViewById(R.id.check_water_test);// 试水
  326. check_grinding_test = (Spinner) findViewById(R.id.check_grinding_test);// 修磨
  327. check_offline_identificatio = (Spinner) findViewById(R.id.check_offline_identificatio);// 下线标识
  328. check_water_test_position = (Spinner) findViewById(R.id.check_water_test_position);// 试水不合格位置
  329. lay_check_repair_crack_position = (LinearLayout) findViewById(R.id.lay_check_repair_crack_position);// 补裂位置
  330. // 注册补裂位置控件
  331. check_repair_crack_position = (TextView) findViewById(R.id.tv_check_repair_crack_position);// 补裂位置 注册补裂位置控件
  332. worknoEdt = (EditText) findViewById(R.id.user_code);
  333. bugnotxt = (EditText) findViewById(R.id.bugnotxt);
  334. bugnotxt.setRawInputType(InputType.TYPE_CLASS_NUMBER);
  335. bugnametxt = (TextView) findViewById(R.id.bugnametxt);
  336. loctxt = (EditText) findViewById(R.id.loctxt);
  337. loctxt.setRawInputType(InputType.TYPE_CLASS_NUMBER);
  338. refineEdt = (TextView) findViewById(R.id.refinetxt);
  339. repairLay = (LinearLayout) findViewById(R.id.repairlay);
  340. productRecord = (ImageView) findViewById(R.id.search);
  341. productRecord.setVisibility(View.VISIBLE);
  342. parent = (RelativeLayout) findViewById(R.id.parentRel);
  343. // 冷补类别
  344. llay_cold_repair_category = (LinearLayout) findViewById(R.id.llay_cold_repair_category);
  345. check_cold_repair_category = (Spinner) findViewById(R.id.check_cold_repair_category);// 冷补类别
  346. mPopup = new PopupWindowCheckChoose(this, mList);
  347. }
  348. private void AllListeners() {
  349. // LoadRunnable 上来就调用 给 漏气 养水 养水不合格位置 试水 试水不合格位置 提供数据源
  350. // start -----------------
  351. thread = new HandlerThread("trademarkThread", 5);
  352. thread.start();
  353. mHandler = new Handler(thread.getLooper());
  354. LoadRunnable loadRunnable = new LoadRunnable();
  355. mHandler.post(loadRunnable);
  356. // end -----------------
  357. switch (collectType) {
  358. case 1:
  359. worknoEdt.setOnFocusChangeListener(new OnFocusChangeListener() {
  360. @Override
  361. public void onFocusChange(View v, boolean hasFocus) {
  362. JSONObject jsonObject = null;
  363. EditText e = (EditText) v;
  364. String workno = e.getText().toString();
  365. if (!workno.contains("\n")) {
  366. workno = workno.trim();
  367. if (!hasFocus) {
  368. if (!TextUtils.isEmpty(workno)) {
  369. ProcessDialogUtils.showProcessDialog(CheckCollectModifyActivity.this);
  370. worknoEdt.setEnabled(false);
  371. worknoEdt.setFocusable(false);
  372. worknoEdt.setFilters(new InputFilter[] { new InputFilter() {
  373. @Override
  374. public CharSequence filter(CharSequence source, int start, int end, Spanned dest,
  375. int dstart, int dend) {
  376. return source.length() < 1 ? dest.subSequence(dstart, dend) : "";
  377. }
  378. } });
  379. barcode.setEnabled(false);
  380. barcode.setFocusable(false);
  381. barcode.setFilters(new InputFilter[] { new InputFilter() {
  382. @Override
  383. public CharSequence filter(CharSequence source, int start, int end, Spanned dest,
  384. int dstart, int dend) {
  385. return source.length() < 1 ? dest.subSequence(dstart, dend) : "";
  386. }
  387. } });
  388. bugnotxt.setEnabled(false);
  389. bugnotxt.setFocusable(false);
  390. bugnotxt.setFilters(new InputFilter[] { new InputFilter() {
  391. @Override
  392. public CharSequence filter(CharSequence source, int start, int end, Spanned dest,
  393. int dstart, int dend) {
  394. return source.length() < 1 ? dest.subSequence(dstart, dend) : "";
  395. }
  396. } });
  397. loctxt.setEnabled(false);
  398. loctxt.setFocusable(false);
  399. loctxt.setFilters(new InputFilter[] { new InputFilter() {
  400. @Override
  401. public CharSequence filter(CharSequence source, int start, int end, Spanned dest,
  402. int dstart, int dend) {
  403. return source.length() < 1 ? dest.subSequence(dstart, dend) : "";
  404. }
  405. } });
  406. memoEdt.setEnabled(false);
  407. memoEdt.setFocusable(false);
  408. memoEdt.setFilters(new InputFilter[] { new InputFilter() {
  409. @Override
  410. public CharSequence filter(CharSequence source, int start, int end, Spanned dest,
  411. int dstart, int dend) {
  412. return source.length() < 1 ? dest.subSequence(dstart, dend) : "";
  413. }
  414. } });
  415. try {
  416. jsonObject = new JSONObject();
  417. jsonObject.put("accountCode", accountCode);
  418. jsonObject.put("userCode", checkCollectModify_userCode);
  419. jsonObject.put("userPassword", password);
  420. jsonObject.put("sessionKey", sessionkey);
  421. // 生产工号检验请求数据
  422. jsonObject.put("procedureID", proId);// 工序ID,菜单页面传过来的
  423. jsonObject.put("procedureUserCode", workno);// 生产工号
  424. thread = new HandlerThread("userThread", 5);
  425. thread.start();
  426. mHandler = new Handler(thread.getLooper());
  427. UserRunnable userRunnable = new UserRunnable(jsonObject);
  428. mHandler.post(userRunnable);
  429. } catch (JSONException e1) {
  430. e1.printStackTrace();
  431. }
  432. }
  433. }
  434. }
  435. }
  436. }
  437. );
  438. worknoEdt.addTextChangedListener(new TextWatcher() {
  439. @Override
  440. public void afterTextChanged(Editable arg0) {
  441. if (worknoEdt.getText().toString().contains("\n")) {
  442. String workno = worknoEdt.getText().toString().trim().replaceAll("\\n", "");
  443. if (!TextUtils.isEmpty(workno)) {
  444. ProcessDialogUtils.showProcessDialog(CheckCollectModifyActivity.this);
  445. worknoEdt.setEnabled(false);
  446. worknoEdt.setFocusable(false);
  447. worknoEdt.setFilters(new InputFilter[] { new InputFilter() {
  448. @Override
  449. public CharSequence filter(CharSequence source, int start, int end, Spanned dest,
  450. int dstart, int dend) {
  451. return source.length() < 1 ? dest.subSequence(dstart, dend) : "";
  452. }
  453. } });
  454. barcode.setEnabled(false);
  455. barcode.setFocusable(false);
  456. barcode.setFilters(new InputFilter[] { new InputFilter() {
  457. @Override
  458. public CharSequence filter(CharSequence source, int start, int end, Spanned dest,
  459. int dstart, int dend) {
  460. return source.length() < 1 ? dest.subSequence(dstart, dend) : "";
  461. }
  462. } });
  463. bugnotxt.setEnabled(false);
  464. bugnotxt.setFocusable(false);
  465. bugnotxt.setFilters(new InputFilter[] { new InputFilter() {
  466. @Override
  467. public CharSequence filter(CharSequence source, int start, int end, Spanned dest,
  468. int dstart, int dend) {
  469. return source.length() < 1 ? dest.subSequence(dstart, dend) : "";
  470. }
  471. } });
  472. loctxt.setEnabled(false);
  473. loctxt.setFocusable(false);
  474. loctxt.setFilters(new InputFilter[] { new InputFilter() {
  475. @Override
  476. public CharSequence filter(CharSequence source, int start, int end, Spanned dest,
  477. int dstart, int dend) {
  478. return source.length() < 1 ? dest.subSequence(dstart, dend) : "";
  479. }
  480. } });
  481. memoEdt.setEnabled(false);
  482. memoEdt.setFocusable(false);
  483. memoEdt.setFilters(new InputFilter[] { new InputFilter() {
  484. @Override
  485. public CharSequence filter(CharSequence source, int start, int end, Spanned dest,
  486. int dstart, int dend) {
  487. return source.length() < 1 ? dest.subSequence(dstart, dend) : "";
  488. }
  489. } });
  490. JSONObject sendJsonHead = new JSONObject();
  491. try {
  492. sendJsonHead.put("accountCode", accountCode);
  493. sendJsonHead.put("userCode", checkCollectModify_userCode);
  494. sendJsonHead.put("userPassword", password);
  495. sendJsonHead.put("sessionKey", sessionkey);
  496. // 生产工号检验请求数据
  497. sendJsonHead.put("procedureID", proId);// 工序ID,菜单页面传过来的
  498. sendJsonHead.put("procedureUserCode", workno);// 生产工号
  499. thread = new HandlerThread("userThread", 5);
  500. thread.start();
  501. mHandler = new Handler(thread.getLooper());
  502. UserRunnable userRunnable = new UserRunnable(sendJsonHead);
  503. mHandler.post(userRunnable);
  504. } catch (JSONException e1) {
  505. e1.printStackTrace();
  506. }
  507. }
  508. }
  509. }
  510. @Override
  511. public void beforeTextChanged(CharSequence s, int start, int count, int after) {
  512. }
  513. @Override
  514. public void onTextChanged(CharSequence s, int start, int before, int count) {
  515. user = worknoEdt.getText().toString();
  516. // 判断输入的文字是否是小写
  517. for (int i = 0; i < user.length(); i++) {
  518. if (user.charAt(i) - 0 >= 97 && user.charAt(i) - 0 <= 122) {
  519. h.postDelayed(UpperCase, 300);
  520. }
  521. }
  522. }
  523. });
  524. break;
  525. case 2:
  526. worknoEdt.setText(checkCollectModify_userCode);
  527. worknoEdt.setEnabled(false);
  528. worknoEdt.setFocusable(false);
  529. worknoEdt.setFilters(new InputFilter[] { new InputFilter() {
  530. @Override
  531. public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
  532. int dend) {
  533. return source.length() < 1 ? dest.subSequence(dstart, dend) : "";
  534. }
  535. } });
  536. JSONObject sendJsonHead = new JSONObject();
  537. try {
  538. sendJsonHead.put("accountCode", accountCode);
  539. sendJsonHead.put("userCode", checkCollectModify_userCode);
  540. sendJsonHead.put("userPassword", password);
  541. sendJsonHead.put("sessionKey", sessionkey);
  542. // 生产工号检验请求数据
  543. sendJsonHead.put("procedureID", proId);// 工序ID,菜单页面传过来的
  544. sendJsonHead.put("procedureUserCode", checkCollectModify_userCode);// 生产工号
  545. } catch (JSONException e) {
  546. // TODO Auto-generated catch block
  547. e.printStackTrace();
  548. }
  549. ProcessDialogUtils.showProcessDialog(CheckCollectModifyActivity.this);
  550. thread = new HandlerThread("userThread", 5);
  551. thread.start();
  552. mHandler = new Handler(thread.getLooper());
  553. UserRunnable userRunnable = new UserRunnable(sendJsonHead);
  554. mHandler.post(userRunnable);
  555. break;
  556. }
  557. lay_check_repair_crack_position.setOnClickListener(new View.OnClickListener() {
  558. @Override
  559. public void onClick(View v) {
  560. mPopup.showPop(check_repair_crack_position);
  561. }
  562. });
  563. bugnotxt.setOnEditorActionListener(new TextView.OnEditorActionListener() {
  564. @Override
  565. public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
  566. if (actionId == EditorInfo.IME_ACTION_NEXT) {
  567. ProcessDialogUtils.showProcessDialog(CheckCollectModifyActivity.this);
  568. defectno = bugnotxt.getText().toString().trim();
  569. if (!TextUtils.isEmpty(defectno)) {
  570. thread = null;
  571. thread = new HandlerThread("bugnoThread", 5);
  572. thread.start();
  573. mHandler = new Handler(thread.getLooper());
  574. mHandler.post(bugnoRunnable);
  575. } else {
  576. Toast.makeText(getApplicationContext(), "缺陷号不能为空", Toast.LENGTH_SHORT).show();
  577. ProcessDialogUtils.closeProgressDilog();
  578. bugnotxt.setFocusable(true);
  579. bugnotxt.requestFocus();
  580. return true;
  581. }
  582. }
  583. return true;
  584. }
  585. });
  586. bugnotxt.addTextChangedListener(new TextWatcher() {
  587. @Override
  588. public void onTextChanged(CharSequence s, int start, int before, int count) {
  589. }
  590. @Override
  591. public void beforeTextChanged(CharSequence s, int start, int count, int after) {
  592. }
  593. @Override
  594. public void afterTextChanged(Editable s) {
  595. defectnovalid = false;
  596. }
  597. });
  598. productRecord.setOnClickListener(new View.OnClickListener() {
  599. @Override
  600. public void onClick(View v) {
  601. int height = parent.getHeight() - v.getHeight();
  602. DefectCommonPopMenu recordPopMenu = new DefectCommonPopMenu(CheckCollectModifyActivity.this, height);
  603. mPopupWindow = recordPopMenu.getMenu();
  604. if (mPopupWindow == null) {
  605. return;
  606. }
  607. if (mPopupWindow.isShowing()) {
  608. mPopupWindow.dismiss();
  609. return;
  610. }
  611. mPopupWindow.showAtLocation(parent, Gravity.BOTTOM, 0, 0);
  612. LinearLayout scanLay = (LinearLayout) recordPopMenu.menu.findViewById(R.id.scanlay);
  613. ImageView scanImg = (ImageView) recordPopMenu.menu.findViewById(R.id.scanimg);
  614. TextView scanTitle = (TextView) recordPopMenu.menu.findViewById(R.id.scantitle);
  615. scanTitle.setText("扫一扫");
  616. scanImg.setBackgroundResource(R.drawable.scan);
  617. scanLay.setOnClickListener(new View.OnClickListener() {
  618. @Override
  619. public void onClick(View v) {
  620. Intent openCameraIntent = new Intent(CheckCollectModifyActivity.this, CaptureActivity.class);
  621. startActivityForResult(openCameraIntent, 102);
  622. if (mPopupWindow.isShowing()) {
  623. mPopupWindow.dismiss();
  624. }
  625. }
  626. });
  627. }
  628. });
  629. loctxt.setOnEditorActionListener(new TextView.OnEditorActionListener() {
  630. @Override
  631. public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
  632. if (actionId == EditorInfo.IME_ACTION_GO) {
  633. defectLocation = loctxt.getText().toString().trim();
  634. if (!TextUtils.isEmpty(defectLocation)) {
  635. ProcessDialogUtils.showProcessDialog(CheckCollectModifyActivity.this);
  636. thread = null;
  637. thread = new HandlerThread("buglocationThread", 5);
  638. thread.start();
  639. mHandler = null;
  640. mHandler = new Handler(thread.getLooper());
  641. mHandler.post(bugLocationRunnable);
  642. return true;
  643. }
  644. else {
  645. ProcessDialogUtils.closeProgressDilog();
  646. Toast.makeText(getApplicationContext(), "缺陷位置不能为空", Toast.LENGTH_SHORT).show();
  647. loctxt.setFocusable(true);
  648. loctxt.requestFocus();
  649. return true;
  650. }
  651. }
  652. return true;
  653. }
  654. });
  655. loctxt.addTextChangedListener(new TextWatcher() {
  656. @Override
  657. public void onTextChanged(CharSequence s, int start, int before, int count) {
  658. }
  659. @Override
  660. public void beforeTextChanged(CharSequence s, int start, int count, int after) {
  661. }
  662. @Override
  663. public void afterTextChanged(Editable s) {
  664. defectlocationvalid = false;
  665. }
  666. });
  667. recordBug.setOnClickListener(new OnClickListener() {
  668. @Override
  669. public void onClick(View v) {
  670. ProductClassifyInfo classifyInfo = (ProductClassifyInfo) classifySpin.getSelectedItem();
  671. if (classifyInfo == null) {
  672. Toast.makeText(getApplicationContext(), "产品分级不能为空", Toast.LENGTH_SHORT).show();
  673. return;
  674. }
  675. int GoodsLevelTypeID = classifyInfo.getGoodsLevelTypeID();
  676. if (GoodsLevelTypeID == 4) {
  677. Toast.makeText(getApplicationContext(), "正品不能记录缺陷", Toast.LENGTH_SHORT).show();
  678. return;
  679. }
  680. String code = productNumber.getText().toString();
  681. if (TextUtils.isEmpty(code)) {
  682. Toast.makeText(getApplicationContext(), "产品条码信息不能为空", Toast.LENGTH_SHORT).show();
  683. return;
  684. }
  685. String productIsbn = productCode.getText().toString();
  686. if (TextUtils.isEmpty(productIsbn)) {
  687. Toast.makeText(getApplicationContext(), "产品编码不能为空", Toast.LENGTH_SHORT).show();
  688. return;
  689. }
  690. defectno = bugnotxt.getText().toString().trim();
  691. if (TextUtils.isEmpty(defectno)) {
  692. Toast.makeText(getApplicationContext(), "缺陷号不能为空", Toast.LENGTH_SHORT).show();
  693. bugnotxt.setFocusable(true);
  694. bugnotxt.requestFocus();
  695. return;
  696. } else {
  697. if (!defectnovalid) {
  698. Toast.makeText(getApplicationContext(), "请在缺陷号输入框内按回车键验证缺陷号", Toast.LENGTH_SHORT).show();
  699. bugnotxt.setFocusable(true);
  700. bugnotxt.requestFocus();
  701. return;
  702. }
  703. }
  704. defectLocation = loctxt.getText().toString().trim();
  705. if (TextUtils.isEmpty(defectLocation)) {
  706. Toast.makeText(getApplicationContext(), "缺陷位置不能为空", Toast.LENGTH_SHORT).show();
  707. loctxt.setFocusable(true);
  708. loctxt.requestFocus();
  709. return;
  710. } else {
  711. if (!defectlocationvalid) {
  712. Toast.makeText(getApplicationContext(), "请在缺陷位置输入框内按回车键验证缺陷位置", Toast.LENGTH_SHORT).show();
  713. loctxt.setFocusable(true);
  714. loctxt.requestFocus();
  715. return;
  716. }
  717. }
  718. // 如果该条产品已经有废品标志,再点击记录缺陷按钮,则传一个标志位为True,否则传false
  719. Bundle bundle = new Bundle();
  720. try {
  721. Intent intent = new Intent();
  722. // bundle.putInt("scrapflag", 0);
  723. bundle.putString("out_goodsID", String.valueOf(productionInfo.getGoodsId()));
  724. bundle.putString("out_goodsCode", productionInfo.getGoodsCode());
  725. bundle.putInt("proId", proId);
  726. bundle.putInt("modeltype", modelType);
  727. bundle.putString("repairFlag", specialRepairFlag);
  728. bundle.putString("barCode", productionInfo.getBarCode());
  729. bundle.putString("operationFlag", "add");
  730. bundle.putSerializable("defectNo", defectNo);
  731. bundle.putSerializable("defectLocation", dl);
  732. bundle.putSerializable("recyclingFlag", RECYCLINGFLAG);
  733. bundle.putSerializable("productBugList", (Serializable) productBugList);
  734. intent.putExtras(bundle);
  735. intent.setClass(CheckCollectModifyActivity.this, ProductBugActivity.class);
  736. startActivityForResult(intent, 100);
  737. } catch (Exception e) {
  738. }
  739. }
  740. });
  741. barcode.addTextChangedListener(new TextWatcher() {
  742. @Override
  743. public void afterTextChanged(Editable arg0) {
  744. if (barcode.getText().toString().contains("\n")) {
  745. String code = barcode.getText().toString().trim().replaceAll("\\n", "");
  746. String workno = worknoEdt.getText().toString();
  747. if (TextUtils.isEmpty(workno)) {
  748. Toast.makeText(getApplicationContext(), "生产工号不能为空", Toast.LENGTH_SHORT).show();
  749. worknoEdt.setEnabled(true);
  750. worknoEdt.setFocusable(true);
  751. worknoEdt.setFocusableInTouchMode(true);
  752. worknoEdt.requestFocus();
  753. worknoEdt.findFocus();
  754. worknoEdt.setFilters(new InputFilter[] { new InputFilter() {
  755. @Override
  756. public CharSequence filter(CharSequence source, int start, int end, Spanned dest,
  757. int dstart, int dend) {
  758. return null;
  759. }
  760. } });
  761. return;
  762. } else {
  763. if (!worknovalid) {
  764. Toast.makeText(getApplicationContext(), "请先验证生产工号", Toast.LENGTH_SHORT).show();
  765. worknoEdt.setEnabled(true);
  766. worknoEdt.setFocusable(true);
  767. worknoEdt.setFocusableInTouchMode(true);
  768. worknoEdt.requestFocus();
  769. worknoEdt.findFocus();
  770. worknoEdt.setFilters(new InputFilter[] { new InputFilter() {
  771. @Override
  772. public CharSequence filter(CharSequence source, int start, int end, Spanned dest,
  773. int dstart, int dend) {
  774. return null;
  775. }
  776. } });
  777. return;
  778. }
  779. }
  780. ProcessDialogUtils.showProcessDialog(CheckCollectModifyActivity.this);
  781. recordBug.setEnabled(true);
  782. overdueFlag = false;
  783. productNumber.setText("");
  784. memoEdt.setText("");
  785. productCode.setText("");
  786. productName.setText("");
  787. refineEdt.setText("");
  788. bugnotxt.setText("");
  789. bugnametxt.setText("");
  790. trademarkNameTxt.setText("");
  791. loctxt.setText("");
  792. repairEdt.setText("");
  793. tvLeak.setText("");
  794. tvInternalLeak.setText("");
  795. tvPassBall.setText("");
  796. if (classifySpin.getSelectedItem() != null) {
  797. listProductClassify.removeAll(listProductClassify);
  798. if (adapterProductClassify != null) {
  799. adapterProductClassify.notifyDataSetChanged();
  800. }
  801. }
  802. if (gotoSpin.getSelectedItem() != null) {
  803. listReWorkProcedure.clear();
  804. if (adapterReWorkProcedure != null) {
  805. adapterReWorkProcedure.notifyDataSetChanged();
  806. }
  807. }
  808. save.setVisibility(View.VISIBLE);
  809. if (productBugList != null && productBugList.size() > 0) {
  810. productBugList.removeAll(productBugList);
  811. if (mAdapter != null) {
  812. mAdapter.notifyDataSetChanged();
  813. }
  814. save.setText("保存(" + productBugList.size() + ")");
  815. }
  816. barcode.setEnabled(false);
  817. barcode.setFocusable(false);
  818. barcode.setFilters(new InputFilter[] { new InputFilter() {
  819. @Override
  820. public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
  821. int dend) {
  822. return source.length() < 1 ? dest.subSequence(dstart, dend) : "";
  823. }
  824. } });
  825. bugnotxt.setEnabled(false);
  826. bugnotxt.setFocusable(false);
  827. bugnotxt.setFocusableInTouchMode(false);
  828. bugnotxt.setFilters(new InputFilter[] { new InputFilter() {
  829. @Override
  830. public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
  831. int dend) {
  832. return source.length() < 1 ? dest.subSequence(dstart, dend) : "";
  833. }
  834. } });
  835. loctxt.setEnabled(false);
  836. loctxt.setFocusable(false);
  837. loctxt.setFocusableInTouchMode(false);
  838. loctxt.setFilters(new InputFilter[] { new InputFilter() {
  839. @Override
  840. public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
  841. int dend) {
  842. return source.length() < 1 ? dest.subSequence(dstart, dend) : "";
  843. }
  844. } });
  845. thread = new HandlerThread("barcodeThread", 5);
  846. thread.start();
  847. mHandler = new Handler(thread.getLooper());
  848. BarcodeRunnable barcodeRunnable = new BarcodeRunnable(code, obj);
  849. mHandler.post(barcodeRunnable);
  850. }
  851. }
  852. @Override
  853. public void beforeTextChanged(CharSequence s, int start, int count, int after) {
  854. }
  855. @Override
  856. public void onTextChanged(CharSequence s, int start, int before, int count) {
  857. barcodeUpper = barcode.getText().toString();
  858. // 判断输入的文字是否是小写
  859. for (int i = 0; i < barcodeUpper.length(); i++) {
  860. if (barcodeUpper.charAt(i) - 0 >= 97 && barcodeUpper.charAt(i) - 0 <= 122) {
  861. barcodeUpperH.postDelayed(BarcodeUpperCase, 300);
  862. }
  863. }
  864. }
  865. });
  866. barcode.setOnEditorActionListener(new TextView.OnEditorActionListener() {
  867. @Override
  868. public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
  869. if (actionId == EditorInfo.IME_ACTION_GO) {
  870. String workno = worknoEdt.getText().toString();
  871. if (TextUtils.isEmpty(workno)) {
  872. Toast.makeText(getApplicationContext(), "生产工号不能为空", Toast.LENGTH_SHORT).show();
  873. worknoEdt.setEnabled(true);
  874. worknoEdt.setFocusable(true);
  875. worknoEdt.setFocusableInTouchMode(true);
  876. worknoEdt.requestFocus();
  877. worknoEdt.findFocus();
  878. worknoEdt.setFilters(new InputFilter[] { new InputFilter() {
  879. @Override
  880. public CharSequence filter(CharSequence source, int start, int end, Spanned dest,
  881. int dstart, int dend) {
  882. return null;
  883. }
  884. } });
  885. return true;
  886. } else {
  887. if (!worknovalid) {
  888. Toast.makeText(getApplicationContext(), "请先验证生产工号", Toast.LENGTH_SHORT).show();
  889. worknoEdt.setEnabled(true);
  890. worknoEdt.setFocusable(true);
  891. worknoEdt.setFocusableInTouchMode(true);
  892. worknoEdt.requestFocus();
  893. worknoEdt.findFocus();
  894. worknoEdt.setFilters(new InputFilter[] { new InputFilter() {
  895. @Override
  896. public CharSequence filter(CharSequence source, int start, int end, Spanned dest,
  897. int dstart, int dend) {
  898. return null;
  899. }
  900. } });
  901. return true;
  902. }
  903. }
  904. String code = barcode.getText().toString().trim();
  905. if (!TextUtils.isEmpty(code)) {
  906. recordBug.setEnabled(true);
  907. overdueFlag = false;
  908. productNumber.setText("");
  909. productCode.setText("");
  910. productName.setText("");
  911. trademarkNameTxt.setText("");
  912. refineEdt.setText("");
  913. bugnotxt.setText("");
  914. memoEdt.setText("");
  915. bugnametxt.setText("");
  916. trademarkNameTxt.setText("");
  917. tvLeak.setText("");
  918. tvInternalLeak.setText("");
  919. tvPassBall.setText("");
  920. loctxt.setText("");
  921. repairEdt.setText("");
  922. if (classifySpin.getSelectedItem() != null) {
  923. listProductClassify.removeAll(listProductClassify);
  924. if (adapterProductClassify != null) {
  925. adapterProductClassify.notifyDataSetChanged();
  926. }
  927. }
  928. if (gotoSpin.getSelectedItem() != null) {
  929. listReWorkProcedure.clear();
  930. if (adapterReWorkProcedure != null) {
  931. adapterReWorkProcedure.notifyDataSetChanged();
  932. }
  933. }
  934. save.setVisibility(View.VISIBLE);
  935. if (productBugList != null && productBugList.size() > 0) {
  936. productBugList.removeAll(productBugList);
  937. if (mAdapter != null) {
  938. mAdapter.notifyDataSetChanged();
  939. }
  940. save.setText("保存(" + productBugList.size() + ")");
  941. }
  942. ProcessDialogUtils.showProcessDialog(CheckCollectModifyActivity.this);
  943. barcode.setEnabled(false);
  944. barcode.setFocusable(false);
  945. barcode.setFilters(new InputFilter[] { new InputFilter() {
  946. @Override
  947. public CharSequence filter(CharSequence source, int start, int end, Spanned dest,
  948. int dstart, int dend) {
  949. return source.length() < 1 ? dest.subSequence(dstart, dend) : "";
  950. }
  951. } });
  952. bugnotxt.setEnabled(false);
  953. bugnotxt.setFocusable(false);
  954. bugnotxt.setFocusableInTouchMode(false);
  955. bugnotxt.setFilters(new InputFilter[] { new InputFilter() {
  956. @Override
  957. public CharSequence filter(CharSequence source, int start, int end, Spanned dest,
  958. int dstart, int dend) {
  959. return source.length() < 1 ? dest.subSequence(dstart, dend) : "";
  960. }
  961. } });
  962. loctxt.setEnabled(false);
  963. loctxt.setFocusable(false);
  964. loctxt.setFocusableInTouchMode(false);
  965. loctxt.setFilters(new InputFilter[] { new InputFilter() {
  966. @Override
  967. public CharSequence filter(CharSequence source, int start, int end, Spanned dest,
  968. int dstart, int dend) {
  969. return source.length() < 1 ? dest.subSequence(dstart, dend) : "";
  970. }
  971. } });
  972. // startTime= System.currentTimeMillis();
  973. thread = new HandlerThread("barcodeThread", 5);
  974. thread.start();
  975. mHandler = new Handler(thread.getLooper());
  976. BarcodeRunnable barcodeRunnable = new BarcodeRunnable(code, obj);
  977. mHandler.post(barcodeRunnable);
  978. return true;
  979. }
  980. }
  981. return true;
  982. }
  983. });
  984. back.setOnClickListener(new View.OnClickListener() {
  985. @Override
  986. public void onClick(View v) {
  987. if (productBugList != null && productBugList.size() > 0) {
  988. productBugList.removeAll(productBugList);
  989. }
  990. finish();
  991. }
  992. });
  993. backBtn.setOnClickListener(new View.OnClickListener() {
  994. @Override
  995. public void onClick(View v) {
  996. if (productBugList != null && productBugList.size() > 0) {
  997. productBugList.removeAll(productBugList);
  998. }
  999. finish();
  1000. }
  1001. });
  1002. // 点击保存按钮
  1003. save.setOnClickListener(new OnClickListener() {
  1004. @Override
  1005. public void onClick(View v) {
  1006. try {
  1007. String workno = worknoEdt.getText().toString();
  1008. if (TextUtils.isEmpty(workno)) {
  1009. Toast.makeText(getApplicationContext(), "生产工号不能为空", Toast.LENGTH_SHORT).show();
  1010. worknoEdt.setEnabled(true);
  1011. worknoEdt.setFocusable(true);
  1012. worknoEdt.setFocusableInTouchMode(true);
  1013. worknoEdt.requestFocus();
  1014. worknoEdt.findFocus();
  1015. worknoEdt.setFilters(new InputFilter[] { new InputFilter() {
  1016. @Override
  1017. public CharSequence filter(CharSequence source, int start, int end, Spanned dest,
  1018. int dstart, int dend) {
  1019. return null;
  1020. }
  1021. } });
  1022. return;
  1023. } else {
  1024. if (!worknovalid) {
  1025. Toast.makeText(getApplicationContext(), "请先验证生产工号", Toast.LENGTH_SHORT).show();
  1026. worknoEdt.setEnabled(true);
  1027. worknoEdt.setFocusable(true);
  1028. worknoEdt.setFocusableInTouchMode(true);
  1029. worknoEdt.requestFocus();
  1030. worknoEdt.findFocus();
  1031. worknoEdt.setFilters(new InputFilter[] { new InputFilter() {
  1032. @Override
  1033. public CharSequence filter(CharSequence source, int start, int end, Spanned dest,
  1034. int dstart, int dend) {
  1035. return null;
  1036. }
  1037. } });
  1038. return;
  1039. }
  1040. }
  1041. String code = productNumber.getText().toString();
  1042. if (TextUtils.isEmpty(code)) {
  1043. Toast.makeText(getApplicationContext(), "产品条码信息不能为空", Toast.LENGTH_SHORT).show();
  1044. return;
  1045. }
  1046. String productIsbn = productCode.getText().toString();
  1047. if (TextUtils.isEmpty(productIsbn)) {
  1048. Toast.makeText(getApplicationContext(), "产品编码不能为空", Toast.LENGTH_SHORT).show();
  1049. return;
  1050. }
  1051. ProductClassifyInfo classifyInfo = (ProductClassifyInfo) classifySpin.getSelectedItem();
  1052. if (classifyInfo == null) {
  1053. Toast.makeText(getApplicationContext(), "产品分级不能为空", Toast.LENGTH_SHORT).show();
  1054. return;
  1055. }
  1056. ProductClassifyInfo check_leakInfo = (ProductClassifyInfo) check_leak.getSelectedItem();
  1057. ProductClassifyInfo check_nourishing_waterInfo = (ProductClassifyInfo) check_nourishing_water
  1058. .getSelectedItem();
  1059. ProductClassifyInfo check_nourishing_water_positionInfo = (ProductClassifyInfo) check_nourishing_water_position
  1060. .getSelectedItem();
  1061. // 当养水不合格 的 时候要判断 养水不合格位置
  1062. if ("不合格".equals(check_nourishing_waterInfo.getDefectFlagName())
  1063. && check_nourishing_water_positionInfo == null) {
  1064. Toast.makeText(getApplicationContext(), "养水不合格位置不能为空", Toast.LENGTH_SHORT).show();
  1065. return;
  1066. }
  1067. ProductClassifyInfo check_water_testInfo = (ProductClassifyInfo) check_water_test.getSelectedItem();
  1068. ProductClassifyInfo check_water_test_positionInfo = (ProductClassifyInfo) check_water_test_position
  1069. .getSelectedItem();
  1070. if (proId == 125) { // 三检 三车间
  1071. check_offline_identificatioInfo = (ProductClassifyInfo) check_offline_identificatio
  1072. .getSelectedItem();
  1073. }
  1074. // 当试水不合格 的 时候要判断 试水不合格位置
  1075. if ("不合格".equals(check_water_testInfo.getDefectFlagName())
  1076. && check_water_test_positionInfo == null) {
  1077. Toast.makeText(getApplicationContext(), "试水不合格位置不能为空", Toast.LENGTH_SHORT).show();
  1078. return;
  1079. }
  1080. // if (title.getText().toString().indexOf("补裂") != -1) {// 2023/3/14 当页面为补裂的时候 校验补裂位置选项
  1081. // if ("".equals(mCheckRepairCrackPositionDate)) {
  1082. // Toast.makeText(getApplicationContext(), "请选择补裂位置", Toast.LENGTH_SHORT).show();
  1083. // return;
  1084. // }
  1085. // }
  1086. int GoodsLevelTypeID = classifyInfo.getGoodsLevelTypeID();
  1087. int GoodsLevelID = classifyInfo.getDefectFlagId();
  1088. if (!(proId == 123 || proId == 157)) { // 养水 3#修模 不判断产品等级缺陷
  1089. if (productBugList != null && productBugList.size() > 0) {
  1090. if (classifyInfo.getGoodsLevelTypeID() == 4) {
  1091. Toast.makeText(getApplicationContext(), "缺陷产品不能为正品", Toast.LENGTH_SHORT).show();
  1092. return;
  1093. }
  1094. if (gotoSpin.getSelectedItem() == null && classifyInfo.getGoodsLevelTypeID() == 6) {
  1095. Toast.makeText(getApplicationContext(), "返工工序不能为空", Toast.LENGTH_SHORT).show();
  1096. return;
  1097. }
  1098. } else {
  1099. if (classifyInfo.getGoodsLevelTypeID() > 4) {
  1100. Toast.makeText(getApplicationContext(), "非正品需要选择缺陷", Toast.LENGTH_SHORT).show();
  1101. return;
  1102. }
  1103. }
  1104. }
  1105. if (operationFlag.equals("modify")) {
  1106. boolean isModify = false;
  1107. if (productBugList != null && productBugList.size() > 0) {
  1108. for (int i = 0; i < productBugList.size(); i++) {
  1109. ProductDefectInfo defectInfo = productBugList.get(i);
  1110. if (defectInfo.getDeleteFlag().equals("local")) {
  1111. isModify = true;
  1112. }
  1113. }
  1114. }
  1115. if ("不合格".equals(check_leakInfo.getDefectFlagName())
  1116. || "不合格".equals(check_nourishing_waterInfo.getDefectFlagName())
  1117. || "不合格".equals(check_water_testInfo.getDefectFlagName())) {
  1118. isModify = true;
  1119. }
  1120. // if (!check_leakInfo.getDefectFlagName().equals(productionInfo.getOut_LeakFlag1Name())) { // 判断漏气
  1121. // // 数据是否改变
  1122. // isModify = true;
  1123. // }
  1124. // if (!check_nourishing_waterInfo.getDefectFlagName()
  1125. // .equals(productionInfo.getOut_LeakFlag4Name())) { // 判断养水 数据是否改变
  1126. // isModify = true;
  1127. // }
  1128. // if (!check_water_testInfo.getDefectFlagName().equals(productionInfo.getOut_LeakFlag5Name())) { // 判断试水
  1129. // // 数据是否改变
  1130. // isModify = true;
  1131. // }
  1132. if (proId == 125) { // 三检 三车间
  1133. if (!((check_offline_identificatioInfo.getDefectFlagId() + "")
  1134. .equals(productionInfo.getOfflineFlag()))) { // 判断下线标识 数据是否改变
  1135. isModify = true;
  1136. }
  1137. }
  1138. if (proId != 157) { //不是修磨才进来判断,修磨不判断了
  1139. if (classifyInfo.getGoodsLevelTypeID() != 16) { // 产品等级 是冷补的时候 不校验
  1140. if ((!isModify) && (!deleteFlag) && (GoodsLevelTypeID == originalGoodsLevelTypeId)) {
  1141. CustomToast.showToast(getApplicationContext(), "数据没有修改不能保存", 2000);
  1142. return;
  1143. }
  1144. }
  1145. }
  1146. }
  1147. reworkProcedureInfo = (ReworkProcedureInfo) gotoSpin.getSelectedItem();
  1148. remarks = memoEdt.getText().toString();
  1149. if (productBugList != null && productBugList.size() > 0) {
  1150. if (operationFlag.equals("add")) {
  1151. for (int i = 0; i < productBugList.size(); i++) {
  1152. ProductDefectInfo pdf = productBugList.get(i);
  1153. pdf.setCreateTime(null);
  1154. }
  1155. }
  1156. }
  1157. // 2023年10月16日
  1158. // if (classifyInfo.getDefectFlagName() == "冷补") {// 产品等级选择为冷补后,必须选择[冷补类别]
  1159. // ProductClassifyInfo check_cold_repair_categoryInfo = (ProductClassifyInfo) check_cold_repair_category
  1160. // .getSelectedItem();
  1161. // if (check_cold_repair_categoryInfo == null) {
  1162. // Toast.makeText(getApplicationContext(), "产品等级选择为冷补后,必须选择[冷补类别]", Toast.LENGTH_SHORT).show();
  1163. // return;
  1164. // }
  1165. // }
  1166. ProcessDialogUtils.showProcessDialog(CheckCollectModifyActivity.this);
  1167. if (save.isEnabled()) {
  1168. save.setEnabled(false);
  1169. thread = null;
  1170. thread = new HandlerThread("SaveThread", 5);
  1171. thread.start();
  1172. mHandler = null;
  1173. mHandler = new Handler(thread.getLooper());
  1174. SaveRunnable saveRunnable = new SaveRunnable(obj, GoodsLevelTypeID, GoodsLevelID);
  1175. mHandler.post(saveRunnable);
  1176. }
  1177. } catch (Exception e) {
  1178. e.printStackTrace();
  1179. }
  1180. }
  1181. });
  1182. classifySpin.setOnItemSelectedListener(new Spinner.OnItemSelectedListener() {
  1183. @Override
  1184. public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
  1185. classifyInfo = (ProductClassifyInfo) arg0.getItemAtPosition(arg2);
  1186. int GoodsLevelTypeID = classifyInfo.getGoodsLevelTypeID();// 所选产品分级类型
  1187. // GoodsLevelID = classifyInfo.getDefectFlagId();
  1188. //2023年10月16日
  1189. // if (GoodsLevelTypeID == 16) { // 产品分级选中冷补 把冷补类别打开
  1190. // check_cold_repair_category.setEnabled(true);
  1191. // } else {
  1192. // check_cold_repair_category.setEnabled(false);
  1193. // }
  1194. if (GoodsLevelTypeID != 6) {
  1195. gotoSpin.setEnabled(false);
  1196. }
  1197. if (GoodsLevelTypeID == 4) {
  1198. if (listReWorkProcedure != null) {
  1199. listReWorkProcedure.clear();
  1200. if (adapterReWorkProcedure != null) {
  1201. adapterReWorkProcedure.notifyDataSetChanged();
  1202. }
  1203. }
  1204. } else {
  1205. if (GoodsLevelTypeID == 6 || GoodsLevelTypeID == 16) { // 重烧 和冷补 可以进
  1206. try {
  1207. JSONObject jsonObject = new JSONObject();
  1208. jsonObject.put("accountCode", accountCode);
  1209. jsonObject.put("userCode", checkCollectModify_userCode);
  1210. jsonObject.put("userPassword", password);
  1211. jsonObject.put("sessionKey", sessionkey);
  1212. jsonObject.put("procedureID", proId);
  1213. thread = new HandlerThread("reworkProcedureThread", 5);
  1214. thread.start();
  1215. mHandler = new Handler(thread.getLooper());
  1216. ReworkProcedureRunnable reworkProcedureRunnable = new ReworkProcedureRunnable(jsonObject);
  1217. mHandler.post(reworkProcedureRunnable);
  1218. } catch (JSONException e) {
  1219. // TODO Auto-generated catch block
  1220. e.printStackTrace();
  1221. }
  1222. }
  1223. if (!overdueFlag) {
  1224. recordBug.setEnabled(true);
  1225. }
  1226. if (listReWorkProcedure != null) {
  1227. listReWorkProcedure.clear();
  1228. if (adapterReWorkProcedure != null) {
  1229. adapterReWorkProcedure.notifyDataSetChanged();
  1230. }
  1231. }
  1232. }
  1233. // if ((proId == 125) || (proId == 131)) { // 三检 显示
  1234. // if (GoodsLevelTypeID != 16) { // 产品分级选择冷补的时候 给冷补类型赋值 其他清空
  1235. // adapterCheckColdRepairCategory = new ProductClassifyAdapter(list_null, getApplicationContext());
  1236. // check_cold_repair_category.setAdapter(adapterCheckColdRepairCategory);
  1237. // }
  1238. //
  1239. // }
  1240. }
  1241. @Override
  1242. public void onNothingSelected(AdapterView<?> arg0) {
  1243. }
  1244. });
  1245. // 养水点击事件
  1246. check_nourishing_water.setOnItemSelectedListener(new Spinner.OnItemSelectedListener() {
  1247. @Override
  1248. public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
  1249. // 在养水页面的时候 养水的点击事件才会生效
  1250. classifyInfo = (ProductClassifyInfo) arg0.getItemAtPosition(arg2);
  1251. String DefectFlagName = classifyInfo.getDefectFlagName();// 所选产品分级类型
  1252. if (title.getText().toString().indexOf("养水") != -1) {
  1253. if ("不合格".equals(DefectFlagName)) { // 点击 不合格 默认 刷到第一个item
  1254. check_nourishing_water_position.setEnabled(true);
  1255. adapterCheckNourishingWaterPosition = new ProductClassifyAdapter(
  1256. listCheckNourishingWaterPosition, getApplicationContext());
  1257. check_nourishing_water_position.setAdapter(adapterCheckNourishingWaterPosition);
  1258. check_nourishing_water_position.setPrompt("请选择");
  1259. } else {
  1260. check_nourishing_water_position.setEnabled(false);
  1261. adapterCheckNourishingWaterPosition = new ProductClassifyAdapter(list_null,
  1262. getApplicationContext());
  1263. check_nourishing_water_position.setAdapter(adapterCheckNourishingWaterPosition);
  1264. check_nourishing_water_position.setPrompt("请选择");
  1265. }
  1266. }
  1267. }
  1268. @Override
  1269. public void onNothingSelected(AdapterView<?> arg0) {
  1270. }
  1271. });
  1272. // 修磨事件
  1273. check_grinding_test.setOnItemSelectedListener(new Spinner.OnItemSelectedListener() {
  1274. @Override
  1275. public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
  1276. // 在养水页面的时候 养水的点击事件才会生效
  1277. classifyInfo = (ProductClassifyInfo) arg0.getItemAtPosition(arg2);
  1278. String DefectFlagName = classifyInfo.getDefectFlagName();// 所选产品分级类型
  1279. }
  1280. @Override
  1281. public void onNothingSelected(AdapterView<?> arg0) {
  1282. }
  1283. });
  1284. // 试水 点击事件
  1285. check_water_test.setOnItemSelectedListener(new Spinner.OnItemSelectedListener() {
  1286. @Override
  1287. public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
  1288. classifyInfo = (ProductClassifyInfo) arg0.getItemAtPosition(arg2);
  1289. String DefectFlagName = classifyInfo.getDefectFlagName();// 所选产品分级类型
  1290. //在试水页面的时候 试水的点击事件才会生效
  1291. if (title.getText().toString().indexOf("试水") != -1) {
  1292. if ("不合格".equals(DefectFlagName)) {
  1293. check_water_test_position.setEnabled(true);
  1294. adapterCheckWaterTestPosition = new ProductClassifyAdapter(listCheckWaterTestPosition,
  1295. CheckCollectModifyActivity.this);
  1296. check_water_test_position.setAdapter(adapterCheckWaterTestPosition);
  1297. check_nourishing_water_position.setPrompt("请选择");
  1298. } else {
  1299. check_water_test_position.setEnabled(false);
  1300. adapterCheckWaterTestPosition = new ProductClassifyAdapter(list_null,
  1301. CheckCollectModifyActivity.this);
  1302. check_water_test_position.setAdapter(adapterCheckWaterTestPosition);
  1303. check_nourishing_water_position.setPrompt("请选择");
  1304. }
  1305. }
  1306. }
  1307. @Override
  1308. public void onNothingSelected(AdapterView<?> arg0) {
  1309. }
  1310. });
  1311. // 冷补类别 点击事件
  1312. check_cold_repair_category.setOnItemSelectedListener(new Spinner.OnItemSelectedListener() {
  1313. @Override
  1314. public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
  1315. classifyInfo = (ProductClassifyInfo) arg0.getItemAtPosition(arg2);
  1316. String DefectFlagName = classifyInfo.getDefectFlagName();// 所选产品分级类型
  1317. ProductClassifyInfo check_cold_repair_categoryInfo = (ProductClassifyInfo) check_cold_repair_category
  1318. .getSelectedItem();
  1319. // --外观: 冷补返工为冷补确认 --功能: 冷补返工为冷补交接
  1320. int position = 0;
  1321. if (listReWorkProcedure != null && check_cold_repair_categoryInfo != null) {
  1322. for (int i = 0; i < listReWorkProcedure.size(); i++) {
  1323. if ("外观".equals(DefectFlagName)) {
  1324. if (listReWorkProcedure.get(i).getReworkProcedureName().contains("冷补确认")) {
  1325. position = i;
  1326. break;
  1327. }
  1328. }
  1329. if ("功能".equals(DefectFlagName)) {
  1330. if (listReWorkProcedure.get(i).getReworkProcedureName().contains("冷补交接")) {
  1331. position = i;
  1332. break;
  1333. }
  1334. }
  1335. }
  1336. gotoSpin.setSelection(position);
  1337. }
  1338. }
  1339. @Override
  1340. public void onNothingSelected(AdapterView<?> arg0) {
  1341. }
  1342. });
  1343. }
  1344. /**
  1345. * 数据
  1346. *
  1347. * @return
  1348. */
  1349. public ArrayList<String> getPopList() {
  1350. ArrayList<String> popList = new ArrayList<String>();
  1351. popList.add("asdasdsad1");
  1352. popList.add("asdasdsad2");
  1353. popList.add("asdasdsad3");
  1354. popList.add("asdasdsad4");
  1355. popList.add("asdasdsad5");
  1356. popList.add("asdasdsad6");
  1357. return popList;
  1358. }
  1359. // 调用数据源 养水数据接口 和 试水数据接口 和 补裂位置数据源
  1360. private class LoadRunnable implements Runnable {
  1361. public LoadRunnable() {
  1362. }
  1363. @Override
  1364. public void run() {
  1365. try {
  1366. { // 代码块 给 下线标识 赋值(写死 1:是 0:否)
  1367. ProductClassifyInfo classifyInfo;
  1368. listCheckOfflineIdentificatio = new ArrayList<ProductClassifyInfo>();// 试水不合格位置数据源
  1369. classifyInfo = new ProductClassifyInfo();
  1370. classifyInfo.setDefectFlagType("");
  1371. classifyInfo.setDefectFlagName("否");
  1372. classifyInfo.setDefectFlagId(0);
  1373. listCheckOfflineIdentificatio.add(classifyInfo);
  1374. classifyInfo = new ProductClassifyInfo();
  1375. classifyInfo.setDefectFlagType("");
  1376. classifyInfo.setDefectFlagName("是");
  1377. classifyInfo.setDefectFlagId(1);
  1378. listCheckOfflineIdentificatio.add(classifyInfo);
  1379. if (proId == 125) { // 三检 显示
  1380. adapterCheckOfflineIdentificatio = new ProductClassifyAdapter(listCheckOfflineIdentificatio,
  1381. getApplicationContext());
  1382. check_offline_identificatio.setAdapter(adapterCheckOfflineIdentificatio);
  1383. }
  1384. }
  1385. { // 代码块 给 冷补类别赋值
  1386. ProductClassifyInfo classifyInfo;
  1387. listCheckColdRepairCategory = new ArrayList<ProductClassifyInfo>();//
  1388. classifyInfo = new ProductClassifyInfo();
  1389. classifyInfo.setDefectFlagType("");
  1390. classifyInfo.setDefectFlagName("外观");
  1391. classifyInfo.setDefectFlagId(0);
  1392. listCheckColdRepairCategory.add(classifyInfo);
  1393. classifyInfo = new ProductClassifyInfo();
  1394. classifyInfo.setDefectFlagType("");
  1395. classifyInfo.setDefectFlagName("功能");
  1396. classifyInfo.setDefectFlagId(1);
  1397. listCheckColdRepairCategory.add(classifyInfo);
  1398. }
  1399. { // 代码块 给修磨赋值
  1400. ProductClassifyInfo classifyInfo;
  1401. listCheckGrinding = new ArrayList<ProductClassifyInfo>();//
  1402. classifyInfo = new ProductClassifyInfo();
  1403. classifyInfo.setDefectFlagType("");
  1404. classifyInfo.setDefectFlagName("合格");
  1405. classifyInfo.setDefectFlagId(1);
  1406. listCheckGrinding.add(classifyInfo);
  1407. classifyInfo = new ProductClassifyInfo();
  1408. classifyInfo.setDefectFlagType("");
  1409. classifyInfo.setDefectFlagName("不合格");
  1410. classifyInfo.setDefectFlagId(0);
  1411. listCheckGrinding.add(classifyInfo);
  1412. adapterCheckGrinding = new ProductClassifyAdapter(listCheckGrinding, getApplicationContext());
  1413. check_grinding_test.setAdapter(adapterCheckGrinding);
  1414. }
  1415. // 先把数据源new 出来
  1416. client = null;
  1417. client = new WebClient();
  1418. JSONObject js = new JSONObject();
  1419. js.put("accountCode", accountCode);
  1420. js.put("userCode", checkCollectModify_userCode);
  1421. js.put("userPassword", password);
  1422. js.put("sessionKey", sessionkey);
  1423. js.put("dicType", "TPC014"); // 养水不合格
  1424. String result = client.doPost("http://" + ServerAddress_ip + ":" + ServerAddress_duankou
  1425. + Constants.serverAction + "/GetDataDictionaryByType", js.toString(), "application/json");
  1426. JSONObject j2 = new JSONObject(result);
  1427. JSONObject j3 = j2.optJSONObject("d");
  1428. int status3 = j3.optInt("Status");
  1429. String message3 = j3.optString("Message");
  1430. String json = j3.getString("Result");
  1431. if (status3 == 0) {
  1432. Message message = new Message();
  1433. Bundle b = new Bundle();
  1434. b.putString("result", json);
  1435. message.what = 8;
  1436. message.setData(b);
  1437. handler.sendMessage(message);
  1438. } else {
  1439. ProcessDialogUtils.closeProgressDilog();
  1440. if (mHandler != null) {
  1441. mHandler.removeCallbacksAndMessages(null);
  1442. mHandler.getLooper().quit();
  1443. }
  1444. CommonUtil.showAlertDialog(status3, message3, CheckCollectModifyActivity.this);
  1445. }
  1446. client = null;
  1447. client = new WebClient();
  1448. JSONObject js1 = new JSONObject();
  1449. js1.put("accountCode", accountCode);
  1450. js1.put("userCode", checkCollectModify_userCode);
  1451. js1.put("userPassword", password);
  1452. js1.put("sessionKey", sessionkey);
  1453. js1.put("dicType", "TPC015");// 试水不合格
  1454. String result2 = client.doPost("http://" + ServerAddress_ip + ":" + ServerAddress_duankou
  1455. + Constants.serverAction + "/GetDataDictionaryByType", js1.toString(), "application/json");
  1456. JSONObject j4 = new JSONObject(result2);
  1457. JSONObject j5 = j4.optJSONObject("d");
  1458. int status5 = j5.optInt("Status");
  1459. String message5 = j5.optString("Message");
  1460. String json5 = j5.getString("Result");
  1461. if (status5 == 0) {
  1462. Message message1 = new Message();
  1463. Bundle b = new Bundle();
  1464. b.putString("result", json5);
  1465. message1.what = 9;
  1466. message1.setData(b);
  1467. handler.sendMessage(message1);
  1468. } else {
  1469. ProcessDialogUtils.closeProgressDilog();
  1470. if (mHandler != null) {
  1471. mHandler.removeCallbacksAndMessages(null);
  1472. mHandler.getLooper().quit();
  1473. }
  1474. CommonUtil.showAlertDialog(status5, message5, CheckCollectModifyActivity.this);
  1475. }
  1476. if (title.getText().toString().indexOf("补裂") != -1) { // 页面为补裂 才可以调用 补裂位置数据源接口
  1477. client = null;
  1478. client = new WebClient();
  1479. JSONObject js17 = new JSONObject();
  1480. js17.put("accountCode", accountCode);
  1481. js17.put("userCode", checkCollectModify_userCode);
  1482. js17.put("userPassword", password);
  1483. js17.put("sessionKey", sessionkey);
  1484. js17.put("dicType", "TPC017");// 补裂位置
  1485. String result17 = client.doPost("http://" + ServerAddress_ip + ":" + ServerAddress_duankou
  1486. + Constants.serverAction + "/GetDataDictionaryByType", js17.toString(), "application/json");
  1487. JSONObject j17 = new JSONObject(result17);
  1488. JSONObject j517 = j17.optJSONObject("d");
  1489. int status17 = j517.optInt("Status");
  1490. String message17 = j517.optString("Message");
  1491. String json17 = j517.getString("Result");
  1492. if (status17 == 0) {
  1493. Message message117 = new Message();
  1494. Bundle b = new Bundle();
  1495. b.putString("result", json17);
  1496. message117.what = 11;
  1497. message117.setData(b);
  1498. handler.sendMessage(message117);
  1499. } else {
  1500. ProcessDialogUtils.closeProgressDilog();
  1501. if (mHandler != null) {
  1502. mHandler.removeCallbacksAndMessages(null);
  1503. mHandler.getLooper().quit();
  1504. }
  1505. CommonUtil.showAlertDialog(status17, message17, CheckCollectModifyActivity.this);
  1506. }
  1507. }
  1508. } catch (Exception e) {
  1509. e.printStackTrace();
  1510. Message m = new Message();
  1511. Bundle b = new Bundle();
  1512. b.putString("message", "网络连接异常");
  1513. m.setData(b);
  1514. m.what = 0;
  1515. exceptionHandler.sendMessage(m);
  1516. }
  1517. }
  1518. };
  1519. Runnable BarcodeUpperCase = new Runnable() {
  1520. @Override
  1521. public void run() {
  1522. // 小写转大写
  1523. barcode.setText(barcodeUpper.toUpperCase());
  1524. // 设置EditText光标位置
  1525. barcode.setSelection(barcodeUpper.length());
  1526. }
  1527. };
  1528. private static class SaveValidHandler extends Handler {
  1529. private final WeakReference mActivity;
  1530. public SaveValidHandler(CheckCollectModifyActivity activity) {
  1531. mActivity = new WeakReference(activity);
  1532. }
  1533. @Override
  1534. public void handleMessage(Message msg) {
  1535. final CheckCollectModifyActivity activity = (CheckCollectModifyActivity) mActivity.get();
  1536. switch (msg.what) {
  1537. case 0:
  1538. ProcessDialogUtils.closeProgressDilog();
  1539. Bundle b3 = msg.getData();
  1540. String msg3 = b3.getString("message");
  1541. CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, activity.getApplicationContext());
  1542. Toast.makeText(activity.getApplicationContext(), msg3, Toast.LENGTH_SHORT).show();
  1543. activity.save.setEnabled(true);
  1544. break;
  1545. case 3:
  1546. ProcessDialogUtils.closeProgressDilog();
  1547. Bundle b = msg.getData();
  1548. String message = b.getString("message");
  1549. CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, activity.getApplicationContext());
  1550. // CommonUtil.showRepeatDialog(message,CheckCollectModifyActivity.this);
  1551. Toast.makeText(activity.getApplicationContext(), message, Toast.LENGTH_SHORT).show();
  1552. activity.loctxt.setFocusable(true);
  1553. activity.loctxt.requestFocus();
  1554. break;
  1555. }
  1556. }
  1557. };
  1558. private class SaveRunnable implements Runnable {
  1559. Object obj;
  1560. int GoodsLevelTypeID;
  1561. int GoodsLevelID;
  1562. public SaveRunnable(Object obj, int GoodsLevelTypeID, int GoodsLevelID) {
  1563. this.obj = obj;
  1564. this.GoodsLevelTypeID = GoodsLevelTypeID;
  1565. this.GoodsLevelID = GoodsLevelID;
  1566. }
  1567. @Override
  1568. public void run() {
  1569. synchronized (obj) {
  1570. try {
  1571. ProductClassifyInfo saveClassifyInfo = (ProductClassifyInfo) classifySpin.getSelectedItem();
  1572. if (saveClassifyInfo.getGoodsLevelTypeID() == 6) {// 重烧 不管界面 怎么选 写死 返回工序
  1573. HashMap<String, String> params = new LinkedHashMap<String, String>();
  1574. params.put("barcode", productNumber.getText().toString().trim().replaceAll("\\n", ""));
  1575. String resultGOODS = mClient.requestGetBySyn(
  1576. "http://" + ServerAddress_ip + ":9100" + "/main/login/api/UpdateReworkProduce.ashx",
  1577. params);
  1578. // JSONObject jGOODS = new JSONObject(resultGOODS);
  1579. // String msgGOODSresult = jGOODS.optString("rows");
  1580. // JSONArray jarrayGOODS = new JSONArray(msgGOODSresult);
  1581. // JSONObject jobjGOODS = jarrayGOODS.optJSONObject(0);
  1582. // GOODSMODELforCheck = jobjGOODS.optString("GOODSTYPECODE");
  1583. // String GOODSTYPECODE = jobjGOODS.optString("GOODSTYPECODE").substring(0, 6);
  1584. // if ("001001".equals(GOODSTYPECODE)) {// 大件
  1585. // reworkProcedureInfo.setReworkProcedureID("138");
  1586. // reworkProcedureInfo.setReworkProcedureName("重烧接收");
  1587. // } else if ("001002".equals(GOODSTYPECODE)) { // 小件
  1588. // reworkProcedureInfo.setReworkProcedureID("57");
  1589. // reworkProcedureInfo.setReworkProcedureName("4-5重烧交接");
  1590. // }
  1591. }
  1592. JSONObject jsonObject = new JSONObject();
  1593. if (productBugList != null && productBugList.size() > 0) {
  1594. defectflag = 2;
  1595. }
  1596. jsonObject.put("accountCode", accountCode);
  1597. jsonObject.put("userCode", checkCollectModify_userCode);
  1598. jsonObject.put("userPassword", password);
  1599. jsonObject.put("sessionKey", sessionkey);
  1600. jsonObject.put("procedureID", proId);
  1601. JSONArray productionDataEntitys = new JSONArray();
  1602. JSONObject productionData = new JSONObject();
  1603. productionData.put("CheckFlag", checkFlag);
  1604. productionData.put("Barcode", productionInfo.getBarCode());
  1605. productionData.put("UserID", userID);
  1606. productionData.put("UserCode", worknouserCode);
  1607. productionData.put("OPTimeStampPDA", timestamp);
  1608. productionData.put("UserName", workNoName);
  1609. productionData.put("GoodsLevelTypeID", GoodsLevelTypeID);
  1610. productionData.put("IsPDA", 1);
  1611. productionData.put("Remarks", remarks);
  1612. productionData.put("GoodsLevelID", GoodsLevelID);
  1613. productionData.put("DefectFlag", defectflag);
  1614. productionData.put("DataKey", repeatFlag);
  1615. if (operationFlag.equals("modify")) {
  1616. productionData.put("PDACheckTime", productionInfo.getCheckTime());
  1617. productionData.put("ProductionDataID", productionDataId);
  1618. productionData.put("OrgGoodsLevelTypeID", productionInfo.getGoodsLevelTypeId());
  1619. }
  1620. if (operationFlag.equals("add")) {
  1621. if (dryRepairFlag) {
  1622. productionData.put("ProductionDataID", productionDataId);
  1623. }
  1624. }
  1625. if (productBugList != null && productBugList.size() > 0) {
  1626. if (reworkProcedureInfo != null) {
  1627. productionData.put("ReworkProcedureID",
  1628. Double.parseDouble(reworkProcedureInfo.getReworkProcedureID()));
  1629. productionData.put("ReworkProcedureName", reworkProcedureInfo.getReworkProcedureName());
  1630. }
  1631. JSONArray productionDefects = new JSONArray();
  1632. for (int j = 0; j < productBugList.size(); j++) {
  1633. ProductDefectInfo productDefectInfo = productBugList.get(j);
  1634. JSONObject jsonObject2 = new JSONObject();
  1635. jsonObject2.put("IsPDA", "1");
  1636. jsonObject2.put("PDACheckTime", productDefectInfo.getCreateTime());
  1637. jsonObject2.put("DefectID", productDefectInfo.getDefectNo().getDefectId());
  1638. jsonObject2.put("DefectCode", productDefectInfo.getDefectNo().getDefectCode());
  1639. jsonObject2.put("DefectName", productDefectInfo.getDefectNo().getDefectName());
  1640. if (productDefectInfo.getDefectLocation() != null) {
  1641. jsonObject2.put("DefectPositionID",
  1642. productDefectInfo.getDefectLocation().getDefectPositionId());
  1643. jsonObject2.put("DefectPositionCode",
  1644. productDefectInfo.getDefectLocation().getDefectPositionCode());
  1645. jsonObject2.put("DefectPositionName",
  1646. productDefectInfo.getDefectLocation().getDefectPositionName());
  1647. }
  1648. boolean IsSpecialDefectFlag = productDefectInfo.isSpecialDefectFlag();
  1649. if (IsSpecialDefectFlag) {
  1650. jsonObject2.put("SpecialDefect", 1);
  1651. } else {
  1652. jsonObject2.put("SpecialDefect", 0);
  1653. }
  1654. if (productDefectInfo.getResponsibilityProcedure() != null) {
  1655. if (productDefectInfo.getResponsibilityProcedure().getDutyProcedureId() > 0.0) {
  1656. jsonObject2.put("DefectProcedureID",
  1657. productDefectInfo.getResponsibilityProcedure().getDutyProcedureId());
  1658. jsonObject2.put("DefectProcedureCode",
  1659. productDefectInfo.getResponsibilityProcedure().getDutyProcedureCode());
  1660. jsonObject2.put("DefectProcedureName",
  1661. productDefectInfo.getResponsibilityProcedure().getDutyProcedureName());
  1662. }
  1663. if (productDefectInfo.getResponsibilityProcedure().getDutyProcedureId() == 0.0) {
  1664. if (productDefectInfo.getWorkno() != null) {
  1665. jsonObject2.put("DefectUserID", productDefectInfo.getWorkno().getUserId());
  1666. jsonObject2.put("DefectUserCode", productDefectInfo.getWorkno().getUserCode());
  1667. jsonObject2.put("DefectUserName", productDefectInfo.getWorkno().getUserName());
  1668. }
  1669. }
  1670. else {
  1671. if (productDefectInfo.getWorkno() != null) {
  1672. jsonObject2.put("DefectProductionDataID",
  1673. productDefectInfo.getWorkno().getProductionDataId());
  1674. jsonObject2.put("DefectUserID", productDefectInfo.getWorkno().getUserId());
  1675. jsonObject2.put("DefectUserCode", productDefectInfo.getWorkno().getUserCode());
  1676. jsonObject2.put("DefectUserName", productDefectInfo.getWorkno().getUserName());
  1677. }
  1678. }
  1679. }
  1680. if (productDefectInfo.getResponsibilityProcedure() == null) {
  1681. if (productDefectInfo.getWorkno() != null) {
  1682. jsonObject2.put("DefectUserID", productDefectInfo.getWorkno().getUserId());
  1683. jsonObject2.put("DefectUserCode", productDefectInfo.getWorkno().getUserCode());
  1684. jsonObject2.put("DefectUserName", productDefectInfo.getWorkno().getUserName());
  1685. }
  1686. }
  1687. if (productDefectInfo.getWorkType() != null) {
  1688. jsonObject2.put("DefectJobs", productDefectInfo.getWorkType().getJobsID());
  1689. }
  1690. if (productDefectInfo.getDefectFines() != null
  1691. && productDefectInfo.getDefectFines().getDefectFinesId() > 0.0) {
  1692. jsonObject2.put("DefectFine", productDefectInfo.getDefectFines().getDefectFinesId());
  1693. }
  1694. if (productDefectInfo.getDefectDeduction() != null) {
  1695. jsonObject2.put("DefectDeductionNum",
  1696. productDefectInfo.getDefectDeduction().getDefectDeductionNum());
  1697. }
  1698. if (productDefectInfo.getMissingDefectWorkNo() != null
  1699. && productDefectInfo.getMissingDefectWorkNo().getUserId() > 0.0) {
  1700. jsonObject2.put("MissedUserID", productDefectInfo.getMissingDefectWorkNo().getUserId());
  1701. jsonObject2.put("MissedUserCode",
  1702. productDefectInfo.getMissingDefectWorkNo().getUserCode());
  1703. jsonObject2.put("MissedUserName",
  1704. productDefectInfo.getMissingDefectWorkNo().getUserName());
  1705. }
  1706. JSONArray DefectResponsibles = new JSONArray();
  1707. List<DutyPerson> dutyPersonList = productBugList.get(j).getDutyPersonList();
  1708. if (dutyPersonList != null && dutyPersonList.size() > 0) {
  1709. for (int k = 0; k < dutyPersonList.size(); k++) {
  1710. JSONObject dutyPerson = new JSONObject();
  1711. dutyPerson.put("StaffID", dutyPersonList.get(k).getStaffId());
  1712. dutyPerson.put("UserID", dutyPersonList.get(k).getUserId());
  1713. dutyPerson.put("UserCode", dutyPersonList.get(k).getUserCode());
  1714. dutyPerson.put("UJobsID", dutyPersonList.get(k).getJobsId());
  1715. dutyPerson.put("StaffStatus", dutyPersonList.get(k).getStaffStatus());
  1716. dutyPerson.put("SJobsID", dutyPersonList.get(k).getsJobsId());
  1717. DefectResponsibles.put(dutyPerson);
  1718. }
  1719. jsonObject2.put("DefectResponsibles", DefectResponsibles);
  1720. }
  1721. JSONArray missingDefectDutyPersonArray = new JSONArray();
  1722. List<DutyPerson> missingDefectDutyPersonList = productBugList.get(j)
  1723. .getMissingDefectDutyPersonList();
  1724. if (missingDefectDutyPersonList != null && missingDefectDutyPersonList.size() > 0) {
  1725. for (int m = 0; m < missingDefectDutyPersonList.size(); m++) {
  1726. JSONObject missingdefectdutyPerson = new JSONObject();
  1727. missingdefectdutyPerson.put("StaffID",
  1728. missingDefectDutyPersonList.get(m).getStaffId());
  1729. missingdefectdutyPerson.put("UserID",
  1730. missingDefectDutyPersonList.get(m).getUserId());
  1731. missingdefectdutyPerson.put("UserCode",
  1732. missingDefectDutyPersonList.get(m).getUserCode());
  1733. missingdefectdutyPerson.put("UJobsID",
  1734. missingDefectDutyPersonList.get(m).getJobsId());
  1735. missingdefectdutyPerson.put("SJobsID",
  1736. missingDefectDutyPersonList.get(m).getsJobsId());
  1737. missingdefectdutyPerson.put("StaffStatus",
  1738. missingDefectDutyPersonList.get(m).getStaffStatus());
  1739. missingDefectDutyPersonArray.put(missingdefectdutyPerson);
  1740. }
  1741. jsonObject2.put("DefectMissedResponsibles", missingDefectDutyPersonArray);
  1742. }
  1743. JSONArray DefectImages = new JSONArray();
  1744. List<ImagePath> imgPathList = productBugList.get(j).getDefectImgPath();
  1745. if (imgPathList != null && imgPathList.size() > 0) {
  1746. for (int m = 0; m < imgPathList.size(); m++) {
  1747. String imagePath = imgPathList.get(m).getLocalPath();
  1748. File file = new File(imagePath);
  1749. if (file.exists() && file.length() > 0) {
  1750. File f = ViewUtil.compressImage(imagePath);
  1751. long size = f.length();
  1752. if (size > 0) {
  1753. WebClient client = new WebClient();
  1754. String json = client.uploadStream(imagePath,
  1755. "http://" + ServerAddress_ip + ":" + ServerAddress_duankou
  1756. + Constants.serverAction + "/SaveImg",
  1757. CheckCollectModifyActivity.this);
  1758. if (json != null) {
  1759. JSONObject jo = new JSONObject(json);
  1760. JSONObject js = (JSONObject) jo.opt("d");
  1761. int status = js.optInt("Status");
  1762. String message = js.optString("Message");
  1763. if (status == 0) {
  1764. String imgpath = js.optString("Result");
  1765. if (imgpath != null) {
  1766. JSONObject Path = new JSONObject();
  1767. Path.put("ImagePath", imgpath);
  1768. DefectImages.put(m, Path);
  1769. }
  1770. }
  1771. else {
  1772. Message msg = new Message();
  1773. msg.what = 0;
  1774. Bundle b1 = new Bundle();
  1775. b1.putString("message", message);
  1776. msg.setData(b1);
  1777. saveValidHandler.sendMessage(msg);
  1778. return;
  1779. }
  1780. } else {
  1781. Message m3 = new Message();
  1782. m3.what = 0;
  1783. Bundle b = new Bundle();
  1784. b.putString("message", "附件上传失败");
  1785. m3.setData(b);
  1786. saveValidHandler.sendMessage(m3);
  1787. return;
  1788. }
  1789. }
  1790. }
  1791. }
  1792. if (DefectImages != null && DefectImages.length() > 0) {
  1793. jsonObject2.put("DefectImages", DefectImages);
  1794. }
  1795. }
  1796. productionDefects.put(jsonObject2);
  1797. }
  1798. productionData.put("ProductionDefects", productionDefects);
  1799. }
  1800. ProductClassifyInfo check_leakInfo = (ProductClassifyInfo) check_leak.getSelectedItem();
  1801. ProductClassifyInfo check_nourishing_waterInfo = (ProductClassifyInfo) check_nourishing_water
  1802. .getSelectedItem();
  1803. ProductClassifyInfo check_nourishing_water_positionInfo = (ProductClassifyInfo) check_nourishing_water_position
  1804. .getSelectedItem();
  1805. ProductClassifyInfo check_water_testInfo = (ProductClassifyInfo) check_water_test.getSelectedItem();
  1806. ProductClassifyInfo check_water_test_positionInfo = (ProductClassifyInfo) check_water_test_position
  1807. .getSelectedItem();
  1808. ProductClassifyInfo check_grinding_info = (ProductClassifyInfo) check_grinding_test
  1809. .getSelectedItem();
  1810. ProductClassifyInfo check_offline_identificatioInfo = (ProductClassifyInfo) check_offline_identificatio
  1811. .getSelectedItem();
  1812. ProductClassifyInfo check_cold_repair_categoryInfo = (ProductClassifyInfo) check_cold_repair_category
  1813. .getSelectedItem();
  1814. productionData.put("LENGBUTYPE", check_cold_repair_categoryInfo == null ? ""
  1815. : check_cold_repair_categoryInfo.getDefectFlagName());// 冷补类别
  1816. productionData.put("LeakFlag1", check_leakInfo.getDefectFlagId());// 漏气
  1817. productionData.put("LeakFlag4", check_nourishing_waterInfo.getDefectFlagId());// 养水
  1818. productionData.put("LeakFlag4Position",
  1819. check_nourishing_water_positionInfo != null
  1820. ? check_nourishing_water_positionInfo.getDefectFlagName()
  1821. : "");// 养水
  1822. // 不合格位置
  1823. productionData.put("LeakFlag5", check_water_testInfo.getDefectFlagId());// 试水
  1824. productionData.put("LeakFlag5Position",
  1825. check_water_test_positionInfo != null ? check_water_test_positionInfo.getDefectFlagName()
  1826. : "");// 试水不合格位置
  1827. productionData.put("LeakFlag7",
  1828. check_grinding_info != null ? check_grinding_info.getDefectFlagId() : "");// 修磨
  1829. productionData.put("LeakFlag6Position", mCheckRepairCrackPositionDate);// 补裂位置 传参
  1830. productionData.put("OfflineFlag",
  1831. check_offline_identificatioInfo != null ? check_offline_identificatioInfo.getDefectFlagId()
  1832. : "");// 下线标识
  1833. productionDataEntitys.put(productionData);
  1834. jsonObject.put("productionDataEntitys", productionDataEntitys);
  1835. WebClient client = new WebClient();
  1836. String result = client.doPost(
  1837. "http://" + ServerAddress_ip + ":" + ServerAddress_duankou + Constants.SAVE_CHECK_INFO,
  1838. jsonObject.toString(), "application/json");
  1839. Bundle b = new Bundle();
  1840. b.putString("result", result);
  1841. Message m = new Message();
  1842. m.setData(b);
  1843. m.what = 4;
  1844. handler.sendMessage(m);
  1845. } catch (JSONException e) {
  1846. e.printStackTrace();
  1847. Message m3 = new Message();
  1848. m3.what = 0;
  1849. Bundle b = new Bundle();
  1850. b.putString("message", "json数据异常");
  1851. m3.setData(b);
  1852. saveValidHandler.sendMessage(m3);
  1853. } catch (Exception e) {
  1854. e.printStackTrace();
  1855. Message m3 = new Message();
  1856. m3.what = 0;
  1857. Bundle b = new Bundle();
  1858. b.putString("message", "网络连接异常");
  1859. m3.setData(b);
  1860. saveValidHandler.sendMessage(m3);
  1861. }
  1862. }
  1863. }
  1864. };
  1865. @Override
  1866. protected void onDestroy() {
  1867. super.onDestroy();
  1868. Mout_ReworkProcedureId = "";
  1869. }
  1870. private Runnable bugLocationRunnable = new Runnable() {
  1871. @Override
  1872. public void run() {
  1873. try {
  1874. client = null;
  1875. client = new WebClient();
  1876. JSONObject js = new JSONObject();
  1877. js.put("accountCode", accountCode);
  1878. js.put("userCode", checkCollectModify_userCode);
  1879. js.put("userPassword", password);
  1880. js.put("sessionKey", sessionkey);
  1881. js.put("goodsID", productionInfo.getGoodsId());
  1882. js.put("positionCode", defectLocation);
  1883. String result = client.doPost("http://" + ServerAddress_ip + ":" + ServerAddress_duankou
  1884. + Constants.serverAction + "/GetDefectPositionByGoodsIDAndPositionCode", js.toString(),
  1885. "application/json");
  1886. Message m = new Message();
  1887. m.what = 7;
  1888. Bundle b = new Bundle();
  1889. b.putString("buglocResult", result);
  1890. m.setData(b);
  1891. handler.sendMessage(m);
  1892. } catch (Exception e) {
  1893. e.printStackTrace();
  1894. Message m3 = new Message();
  1895. m3.what = 3;
  1896. Bundle b = new Bundle();
  1897. b.putString("message", "网络连接异常");
  1898. m3.setData(b);
  1899. saveValidHandler.sendMessage(m3);
  1900. return;
  1901. }
  1902. }
  1903. };
  1904. private class UserRunnable implements Runnable {
  1905. JSONObject jsonObject;
  1906. public UserRunnable(JSONObject jsonObject) {
  1907. this.jsonObject = jsonObject;
  1908. }
  1909. @Override
  1910. public void run() {
  1911. Message message = new Message();
  1912. client = new WebClient();
  1913. try {
  1914. Bundle b = new Bundle();
  1915. String result;
  1916. result = client.doPost(
  1917. "http://" + ServerAddress_ip + ":" + ServerAddress_duankou + Constants.PRODUCER_NO_VALID,
  1918. jsonObject.toString(), "application/json");
  1919. b.putString("result", result);
  1920. message.what = 0;
  1921. message.setData(b);
  1922. handler.sendMessage(message);
  1923. } catch (JSONException e) {
  1924. e.printStackTrace();
  1925. Message m = new Message();
  1926. m.what = 1;
  1927. Bundle b = new Bundle();
  1928. b.putString("message", "json数据异常");
  1929. m.setData(b);
  1930. exceptionHandler.sendMessage(m);
  1931. return;
  1932. } catch (Exception e) {
  1933. e.printStackTrace();
  1934. Message m = new Message();
  1935. m.what = 1;
  1936. Bundle b = new Bundle();
  1937. b.putString("message", "网络连接异常");
  1938. m.setData(b);
  1939. exceptionHandler.sendMessage(m);
  1940. return;
  1941. }
  1942. }
  1943. }
  1944. private Runnable bugnoRunnable = new Runnable() {
  1945. @Override
  1946. public void run() {
  1947. try {
  1948. client = null;
  1949. client = new WebClient();
  1950. JSONObject js = new JSONObject();
  1951. js.put("accountCode", accountCode);
  1952. js.put("userCode", checkCollectModify_userCode);
  1953. js.put("userPassword", password);
  1954. js.put("sessionKey", sessionkey);
  1955. js.put("procedureID", proId);
  1956. js.put("defectCode", defectno);
  1957. String result = client.doPost("http://" + ServerAddress_ip + ":" + ServerAddress_duankou
  1958. + Constants.serverAction + "/GetDefectByProcedureIDAndDefectCode", js.toString(),
  1959. "application/json");
  1960. Message m = new Message();
  1961. m.what = 6;
  1962. Bundle b = new Bundle();
  1963. b.putString("bugnoResult", result);
  1964. m.setData(b);
  1965. handler.sendMessage(m);
  1966. } catch (Exception e) {
  1967. Message m = new Message();
  1968. m.what = 4;
  1969. Bundle b = new Bundle();
  1970. b.putString("message", "网络连接异常");
  1971. m.setData(b);
  1972. exceptionHandler.sendMessage(m);
  1973. return;
  1974. }
  1975. }
  1976. };
  1977. Runnable UpperCase = new Runnable() {
  1978. @Override
  1979. public void run() {
  1980. // 小写转大写
  1981. worknoEdt.setText(user.toUpperCase());
  1982. // 设置EditText光标位置
  1983. worknoEdt.setSelection(user.length());
  1984. }
  1985. };
  1986. private class ReworkProcedureRunnable implements Runnable {
  1987. JSONObject jsonObject;
  1988. public ReworkProcedureRunnable(JSONObject jsonObject) {
  1989. this.jsonObject = jsonObject;
  1990. }
  1991. @Override
  1992. public void run() {
  1993. Message message = new Message();
  1994. client = new WebClient();
  1995. String result;
  1996. Bundle b = new Bundle();
  1997. try {
  1998. result = client.doPost("http://" + ServerAddress_ip + ":" + ServerAddress_duankou
  1999. + Constants.GET_ENDPRODUCT_REWORK_PROCEDURE, jsonObject.toString(), "application/json");
  2000. b.putString("result", result);
  2001. message.what = 3;
  2002. message.setData(b);
  2003. handler.sendMessage(message);
  2004. } catch (JSONException e) {
  2005. // TODO Auto-generated catch block
  2006. e.printStackTrace();
  2007. Message m = new Message();
  2008. m.what = 5;
  2009. Bundle b5 = new Bundle();
  2010. b5.putString("message", "json数据异常");
  2011. m.setData(b5);
  2012. exceptionHandler.sendMessage(m);
  2013. } catch (Exception e) {
  2014. Message m = new Message();
  2015. m.what = 5;
  2016. Bundle b5 = new Bundle();
  2017. b5.putString("message", "网络连接异常");
  2018. m.setData(b5);
  2019. exceptionHandler.sendMessage(m);
  2020. e.printStackTrace();
  2021. return;
  2022. }
  2023. }
  2024. }
  2025. private static class ExceptionHandler extends Handler {
  2026. private final WeakReference mActivity;
  2027. public ExceptionHandler(CheckCollectModifyActivity activity) {
  2028. mActivity = new WeakReference(activity);
  2029. }
  2030. @Override
  2031. public void handleMessage(Message msg) {
  2032. super.handleMessage(msg);
  2033. CheckCollectModifyActivity activity = (CheckCollectModifyActivity) mActivity.get();
  2034. switch (msg.what) {
  2035. case 0:
  2036. ProcessDialogUtils.closeProgressDilog();
  2037. Bundle b = msg.getData();
  2038. int status = b.getInt("status");
  2039. String errorMsg = b.getString("errorMsg");
  2040. CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, activity.getApplicationContext());
  2041. CommonUtil.showBarCodeAlertDialog(status, errorMsg, activity, activity.barcode, activity.bugnotxt,
  2042. activity.loctxt);
  2043. if (activity.mHandler != null) {
  2044. activity.mHandler.removeCallbacksAndMessages(null);
  2045. activity.mHandler.getLooper().quit();
  2046. }
  2047. break;
  2048. case 1:
  2049. ProcessDialogUtils.closeProgressDilog();
  2050. Bundle b2 = msg.getData();
  2051. String message = b2.getString("message");
  2052. CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, activity);
  2053. CustomToast.showToast(activity.getApplicationContext(), message, 2000);
  2054. if (activity.collectType == 1) {
  2055. activity.worknoEdt.setEnabled(true);
  2056. activity.worknoEdt.setText("");
  2057. activity.worknoEdt.setFocusable(true);
  2058. activity.worknoEdt.setFocusableInTouchMode(true);
  2059. activity.worknoEdt.requestFocus();
  2060. activity.worknoEdt.findFocus();
  2061. activity.worknoEdt.setFilters(new InputFilter[] { new InputFilter() {
  2062. @Override
  2063. public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
  2064. int dend) {
  2065. return null;
  2066. }
  2067. } });
  2068. activity.barcode.setEnabled(true);
  2069. activity.barcode.setFocusable(true);
  2070. activity.barcode.setFocusableInTouchMode(true);
  2071. activity.barcode.setFilters(new InputFilter[] { new InputFilter() {
  2072. @Override
  2073. public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
  2074. int dend) {
  2075. return null;
  2076. }
  2077. } });
  2078. CommonUtil.BarcodeMaxLength(activity.barcode, 50);
  2079. activity.bugnotxt.setEnabled(true);
  2080. activity.bugnotxt.setText("");
  2081. activity.bugnotxt.setFocusable(true);
  2082. activity.bugnotxt.setFocusableInTouchMode(true);
  2083. activity.bugnotxt.setFilters(new InputFilter[] { new InputFilter() {
  2084. @Override
  2085. public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
  2086. int dend) {
  2087. return null;
  2088. }
  2089. } });
  2090. activity.loctxt.setEnabled(true);
  2091. activity.loctxt.setText("");
  2092. activity.loctxt.setFocusable(true);
  2093. activity.loctxt.setFocusableInTouchMode(true);
  2094. activity.loctxt.setFilters(new InputFilter[] { new InputFilter() {
  2095. @Override
  2096. public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
  2097. int dend) {
  2098. return null;
  2099. }
  2100. } });
  2101. }
  2102. if (activity.mHandler != null) {
  2103. activity.mHandler.removeCallbacksAndMessages(null);
  2104. activity.mHandler.getLooper().quit();
  2105. }
  2106. break;
  2107. case 2:
  2108. ProcessDialogUtils.closeProgressDilog();
  2109. if (activity.mHandler != null) {
  2110. activity.mHandler.removeCallbacksAndMessages(null);
  2111. activity.mHandler.getLooper().quit();
  2112. }
  2113. Bundle b3 = msg.getData();
  2114. String message3 = b3.getString("message");
  2115. CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, activity.getApplicationContext());
  2116. // CommonUtil.showRepeatDialog(message3,CheckCollectModifyActivity.this);
  2117. // Toast.makeText(getApplicationContext(), message3,
  2118. // Toast.LENGTH_SHORT).show();
  2119. CustomToast.showToast(activity.getApplicationContext(), message3, 2000);
  2120. activity.barcode.setEnabled(true);
  2121. activity.barcode.setText("");
  2122. activity.barcode.setFocusable(true);
  2123. activity.barcode.setFocusableInTouchMode(true);
  2124. activity.barcode.requestFocus();
  2125. activity.barcode.findFocus();
  2126. activity.barcode.setFilters(new InputFilter[] { new InputFilter() {
  2127. @Override
  2128. public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
  2129. int dend) {
  2130. return null;
  2131. }
  2132. } });
  2133. CommonUtil.BarcodeMaxLength(activity.barcode, 50);
  2134. activity.bugnotxt.setEnabled(true);
  2135. activity.bugnotxt.setText("");
  2136. activity.bugnotxt.setFocusable(true);
  2137. activity.bugnotxt.setFocusableInTouchMode(true);
  2138. activity.bugnotxt.setFilters(new InputFilter[] { new InputFilter() {
  2139. @Override
  2140. public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
  2141. int dend) {
  2142. return null;
  2143. }
  2144. } });
  2145. activity.loctxt.setEnabled(true);
  2146. activity.loctxt.setText("");
  2147. activity.loctxt.setFocusable(true);
  2148. activity.loctxt.setFocusableInTouchMode(true);
  2149. activity.loctxt.setFilters(new InputFilter[] { new InputFilter() {
  2150. @Override
  2151. public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
  2152. int dend) {
  2153. return null;
  2154. }
  2155. } });
  2156. break;
  2157. case 3:
  2158. ProcessDialogUtils.closeProgressDilog();
  2159. Bundle b7 = msg.getData();
  2160. int status7 = b7.getInt("status");
  2161. String message7 = b7.getString("message");
  2162. activity.save.setVisibility(View.GONE);
  2163. activity.recordBug.setEnabled(false);
  2164. CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, activity.getApplicationContext());
  2165. CommonUtil.showBarCodeAlertDialog(status7, message7, activity, activity.barcode, activity.bugnotxt,
  2166. activity.loctxt);
  2167. if (activity.mHandler != null) {
  2168. activity.mHandler.removeCallbacksAndMessages(null);
  2169. activity.mHandler.getLooper().quit();
  2170. }
  2171. break;
  2172. case 4:
  2173. if (activity.mHandler != null) {
  2174. activity.mHandler.removeCallbacksAndMessages(null);
  2175. activity.mHandler.getLooper().quit();
  2176. }
  2177. ProcessDialogUtils.closeProgressDilog();
  2178. Bundle b4 = msg.getData();
  2179. String message4 = b4.getString("message");
  2180. CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, activity.getApplicationContext());
  2181. CustomToast.showToast(activity.getApplicationContext(), message4, 2000);
  2182. activity.bugnotxt.setFocusable(true);
  2183. activity.bugnotxt.requestFocus();
  2184. break;
  2185. case 5:
  2186. if (activity.mHandler != null) {
  2187. activity.mHandler.removeCallbacksAndMessages(null);
  2188. activity.mHandler.getLooper().quit();
  2189. }
  2190. ProcessDialogUtils.closeProgressDilog();
  2191. Bundle b5 = msg.getData();
  2192. String message5 = b5.getString("message");
  2193. CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, activity.getApplicationContext());
  2194. // CommonUtil.showRepeatDialog(message5,CheckCollectModifyActivity.this);
  2195. // Toast.makeText(getApplicationContext(), message5,
  2196. // Toast.LENGTH_SHORT).show();
  2197. CustomToast.showToast(activity.getApplicationContext(), message5, 2000);
  2198. break;
  2199. case 6:
  2200. if (activity.mHandler != null) {
  2201. activity.mHandler.removeCallbacksAndMessages(null);
  2202. activity.mHandler.getLooper().quit();
  2203. }
  2204. ProcessDialogUtils.closeProgressDilog();
  2205. Bundle b1 = msg.getData();
  2206. String errmsg = b1.getString("errmsg");
  2207. String missingFlag = b1.getString("flag");
  2208. Intent intent = new Intent();
  2209. Bundle b6 = new Bundle();
  2210. b6.putString("msg", errmsg);
  2211. b6.putString("missingFlag", missingFlag);
  2212. intent.putExtras(b6);
  2213. intent.setClass(activity, MissingScanActivity.class);
  2214. activity.startActivityForResult(intent, 101);
  2215. break;
  2216. case 7:
  2217. ProcessDialogUtils.closeProgressDilog();
  2218. if (activity.mHandler != null) {
  2219. activity.mHandler.removeCallbacksAndMessages(null);
  2220. activity.mHandler.getLooper().quit();
  2221. }
  2222. Bundle b8 = msg.getData();
  2223. String message8 = b8.getString("message");
  2224. CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, activity.getApplicationContext());
  2225. CommonUtil.showRepeatDialog(message8, activity);
  2226. activity.barcode.setEnabled(true);
  2227. activity.barcode.setText("");
  2228. activity.barcode.setFocusable(true);
  2229. activity.barcode.setFocusableInTouchMode(true);
  2230. activity.barcode.requestFocus();
  2231. activity.barcode.findFocus();
  2232. activity.barcode.setFilters(new InputFilter[] { new InputFilter() {
  2233. @Override
  2234. public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
  2235. int dend) {
  2236. return null;
  2237. }
  2238. } });
  2239. CommonUtil.BarcodeMaxLength(activity.barcode, 50);
  2240. activity.bugnotxt.setEnabled(true);
  2241. activity.bugnotxt.setText("");
  2242. activity.bugnotxt.setFocusable(true);
  2243. activity.bugnotxt.setFocusableInTouchMode(true);
  2244. activity.bugnotxt.setFilters(new InputFilter[] { new InputFilter() {
  2245. @Override
  2246. public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
  2247. int dend) {
  2248. return null;
  2249. }
  2250. } });
  2251. activity.loctxt.setEnabled(true);
  2252. activity.loctxt.setText("");
  2253. activity.loctxt.setFocusable(true);
  2254. activity.loctxt.setFocusableInTouchMode(true);
  2255. activity.loctxt.setFilters(new InputFilter[] { new InputFilter() {
  2256. @Override
  2257. public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
  2258. int dend) {
  2259. return null;
  2260. }
  2261. } });
  2262. break;
  2263. }
  2264. }
  2265. };
  2266. private static class ResultHandler extends Handler {
  2267. private final WeakReference mActivity;
  2268. public ResultHandler(CheckCollectModifyActivity activity) {
  2269. mActivity = new WeakReference(activity);
  2270. }
  2271. @Override
  2272. public void handleMessage(Message msg) {
  2273. final CheckCollectModifyActivity activity = (CheckCollectModifyActivity) mActivity.get();
  2274. switch (msg.what) {
  2275. case 0:
  2276. String rest = msg.getData().getString("result");
  2277. ProcessDialogUtils.closeProgressDilog();
  2278. try {
  2279. JSONObject jsonObject = new JSONObject(rest);
  2280. jsonObject = jsonObject.getJSONObject("d");
  2281. int status = jsonObject.getInt("Status");
  2282. String message = jsonObject.getString("Message");
  2283. String json = jsonObject.getString("Result");
  2284. if (status == 0) {
  2285. jsonObject = new JSONObject(json);
  2286. String outErrMsg = jsonObject.optString("ErrMsg");
  2287. if (outErrMsg.equals("null")) {
  2288. activity.userID = jsonObject.getString("UserID");
  2289. activity.worknouserCode = jsonObject.getString("UserCode");
  2290. activity.workNoName = jsonObject.getString("UserName");
  2291. activity.worknovalid = true;
  2292. activity.barcode.setEnabled(true);
  2293. activity.barcode.setFocusable(true);
  2294. activity.barcode.setFocusableInTouchMode(true);
  2295. activity.barcode.requestFocus();
  2296. activity.barcode.findFocus();
  2297. activity.barcode.setFilters(new InputFilter[] { new InputFilter() {
  2298. @Override
  2299. public CharSequence filter(CharSequence source, int start, int end, Spanned dest,
  2300. int dstart, int dend) {
  2301. return null;
  2302. }
  2303. } });
  2304. CommonUtil.BarcodeMaxLength(activity.barcode, 50);
  2305. if (activity.collectType == 1) {
  2306. activity.bugnotxt.setEnabled(true);
  2307. activity.bugnotxt.setFocusable(true);
  2308. activity.bugnotxt.setFocusableInTouchMode(true);
  2309. activity.bugnotxt.setFilters(new InputFilter[] { new InputFilter() {
  2310. @Override
  2311. public CharSequence filter(CharSequence source, int start, int end, Spanned dest,
  2312. int dstart, int dend) {
  2313. return null;
  2314. }
  2315. } });
  2316. activity.loctxt.setEnabled(true);
  2317. activity.loctxt.setFocusable(true);
  2318. activity.loctxt.setFocusableInTouchMode(true);
  2319. activity.loctxt.setFilters(new InputFilter[] { new InputFilter() {
  2320. @Override
  2321. public CharSequence filter(CharSequence source, int start, int end, Spanned dest,
  2322. int dstart, int dend) {
  2323. return null;
  2324. }
  2325. } });
  2326. activity.memoEdt.setEnabled(true);
  2327. activity.memoEdt.setFocusable(true);
  2328. activity.memoEdt.setFocusableInTouchMode(true);
  2329. activity.memoEdt.setFilters(new InputFilter[] { new InputFilter() {
  2330. @Override
  2331. public CharSequence filter(CharSequence source, int start, int end, Spanned dest,
  2332. int dstart, int dend) {
  2333. return null;
  2334. }
  2335. } });
  2336. }
  2337. if (activity.mHandler != null) {
  2338. activity.mHandler.removeCallbacksAndMessages(null);
  2339. activity.mHandler.getLooper().quit();
  2340. }
  2341. // ///////////////////////////////////////////////------yws--------------
  2342. // InputMethodManager im =(InputMethodManager)
  2343. // tvUserCode.getContext()
  2344. // .getSystemService(Context.INPUT_METHOD_SERVICE);
  2345. // im.hideSoftInputFromWindow(CheckCollectActivity.this.getCurrentFocus().getWindowToken(),InputMethodManager.HIDE_NOT_ALWAYS);
  2346. } else {
  2347. if (activity.mHandler != null) {
  2348. activity.mHandler.removeCallbacksAndMessages(null);
  2349. activity.mHandler.getLooper().quit();
  2350. }
  2351. activity.worknovalid = false;
  2352. CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, activity.getApplicationContext());
  2353. CommonUtil.showWorkNoAlertDialog(status, outErrMsg, activity, activity.worknoEdt,
  2354. activity.barcode, activity.bugnotxt, activity.loctxt, activity.collectType);
  2355. return;
  2356. }
  2357. } else {
  2358. if (activity.mHandler != null) {
  2359. activity.mHandler.removeCallbacksAndMessages(null);
  2360. activity.mHandler.getLooper().quit();
  2361. }
  2362. activity.worknovalid = false;
  2363. CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, activity.getApplicationContext());
  2364. CommonUtil.showWorkNoAlertDialog(status, message, activity, activity.worknoEdt,
  2365. activity.barcode, activity.bugnotxt, activity.loctxt, activity.collectType);
  2366. }
  2367. } catch (Exception e) {
  2368. e.printStackTrace();
  2369. }
  2370. break;
  2371. case 1:
  2372. ProcessDialogUtils.closeProgressDilog();
  2373. activity.save.setText("保存(" + activity.productBugList.size() + ")");
  2374. // 调完baicode赋值 9527
  2375. if (activity.mHandler != null) {
  2376. activity.mHandler.removeCallbacksAndMessages(null);
  2377. activity.mHandler.getLooper().quit();
  2378. }
  2379. Bundle b1 = msg.getData();
  2380. activity.listProductClassify = (List<ProductClassifyInfo>) b1.getSerializable("productclassifylist");
  2381. activity.productNumber.setText(activity.productionInfo.getBarCode());
  2382. activity.productCode.setText(activity.productionInfo.getGoodsCode());
  2383. activity.productName.setText(activity.productionInfo.getGoodsName());
  2384. String trademarkName = activity.productionInfo.getTrademarkName();
  2385. if (trademarkName.equals("null")) {
  2386. activity.trademarkNameTxt.setText("");
  2387. } else {
  2388. activity.trademarkNameTxt.setText(trademarkName);
  2389. }
  2390. // productionInfo.setOut_LeakFlag1Name(jsonObject31.optString("out_LeakFlag1Name"));//漏气
  2391. // productionInfo.setOut_LeakFlag4Name(jsonObject31.optString("out_LeakFlag4Name"));//养水
  2392. // productionInfo.setOut_LeakFlag5Name(jsonObject31.optString("out_LeakFlag5Name"));//试水
  2393. // productionInfo.setLeakFlag4TablePOSITION(jsonObjectleakFlag4Table.optString("POSITION"));//养水 不合格位置
  2394. // productionInfo.setLeakFlag5TablePOSITION(jsonObjectleakFlag5Table.optString("POSITION"));//试水 不合格位置
  2395. activity.refineEdt.setText(activity.refireName);
  2396. activity.repairEdt.setText(activity.specialRepairFlagName);
  2397. activity.tvLeak.setText(activity.productionInfo.getLeak());
  2398. // 回显 漏气 养水 试水
  2399. if ("不合格".equals(activity.productionInfo.getOut_LeakFlag1Name())) { // 漏气
  2400. activity.check_leak.setSelection(1, true);
  2401. }
  2402. if ("不合格".equals(activity.productionInfo.getOut_LeakFlag4Name())) {// 养水
  2403. activity.check_nourishing_water.setSelection(1, true);
  2404. }
  2405. if ("不合格".equals(activity.productionInfo.getOut_LeakFlag5Name())) {// 试水
  2406. activity.check_water_test.setSelection(1, true);
  2407. }
  2408. if ("不合格".equals(activity.productionInfo.getOut_LeakFlag7Name())) {// 修磨
  2409. activity.check_grinding_test.setSelection(1, true);
  2410. }
  2411. if (!"".equals(activity.mCheckRepairCrackPositionDate)) { // 如果有补裂位置 那就赋值
  2412. activity.check_repair_crack_position.setText(activity.mCheckRepairCrackPositionDate);
  2413. }
  2414. // 回显 养水不合格位置 试水不合格位置 todo
  2415. // if ((activity.title.getText().toString().indexOf("养水") != -1)
  2416. // || (activity.title.getText().toString().indexOf("试水") != -1)) {
  2417. for (int i = 0; i < activity.listCheckNourishingWaterPosition.size(); i++) {
  2418. if (activity.listCheckNourishingWaterPosition.get(i).getDefectFlagName()
  2419. .equals(activity.productionInfo.getLeakFlag4TablePOSITION())) {
  2420. activity.adapterCheckNourishingWaterPosition = new ProductClassifyAdapter(
  2421. activity.listCheckNourishingWaterPosition, activity.getApplicationContext());
  2422. activity.check_nourishing_water_position
  2423. .setAdapter(activity.adapterCheckNourishingWaterPosition);
  2424. activity.check_nourishing_water_position.setPrompt("请选择");
  2425. activity.check_nourishing_water_position.setSelection(i, true);
  2426. }
  2427. }
  2428. if (activity.title.getText().toString().indexOf("试水") != -1) {
  2429. // for (int i = 0; i < activity.listCheckWaterTestPosition.size(); i++) {
  2430. // if (activity.listCheckWaterTestPosition.get(i).getDefectFlagName()
  2431. // .equals(activity.productionInfo.getLeakFlag5TablePOSITION())) {
  2432. // activity.adapterCheckWaterTestPosition = new ProductClassifyAdapter(activity.listCheckWaterTestPosition,
  2433. // activity.getApplicationContext());
  2434. //
  2435. // activity.check_water_test_position.setAdapter(activity.adapterCheckWaterTestPosition);
  2436. // activity.check_nourishing_water_position.setPrompt("请选择");
  2437. // activity.check_water_test_position.setSelection(i, true);
  2438. // }
  2439. // }
  2440. // 根本就不用带出试水的回显数据
  2441. // }
  2442. }
  2443. // 回显下标划线
  2444. if (activity.proId == 125) {
  2445. for (int i = 0; i < activity.listCheckOfflineIdentificatio.size(); i++) {
  2446. if ((activity.listCheckOfflineIdentificatio.get(i).getDefectFlagId() + "")
  2447. .equals(activity.productionInfo.getOfflineFlag())) {
  2448. activity.adapterCheckOfflineIdentificatio = new ProductClassifyAdapter(
  2449. activity.listCheckOfflineIdentificatio, activity.getApplicationContext());
  2450. activity.check_offline_identificatio.setAdapter(activity.adapterCheckOfflineIdentificatio);
  2451. activity.check_offline_identificatio.setPrompt("请选择");
  2452. activity.check_offline_identificatio.setSelection(i, true);
  2453. }
  2454. }
  2455. }
  2456. activity.tvInternalLeak.setText(activity.productionInfo.getInternalLeak());
  2457. activity.tvPassBall.setText(activity.productionInfo.getPassBall());
  2458. activity.barcode.setEnabled(true);
  2459. activity.barcode.setText("");
  2460. activity.barcode.setFocusable(true);
  2461. activity.barcode.setFocusableInTouchMode(true);
  2462. activity.barcode.requestFocus();
  2463. activity.barcode.findFocus();
  2464. activity.barcode.setFilters(new InputFilter[] { new InputFilter() {
  2465. @Override
  2466. public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
  2467. int dend) {
  2468. return null;
  2469. }
  2470. } });
  2471. CommonUtil.BarcodeMaxLength(activity.barcode, 50);
  2472. activity.bugnotxt.setEnabled(true);
  2473. activity.bugnotxt.setText("");
  2474. activity.bugnotxt.setFocusable(true);
  2475. activity.bugnotxt.setFocusableInTouchMode(true);
  2476. activity.bugnotxt.setFilters(new InputFilter[] { new InputFilter() {
  2477. @Override
  2478. public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
  2479. int dend) {
  2480. return null;
  2481. }
  2482. } });
  2483. activity.loctxt.setEnabled(true);
  2484. activity.loctxt.setText("");
  2485. activity.loctxt.setFocusable(true);
  2486. activity.loctxt.setFocusableInTouchMode(true);
  2487. activity.loctxt.setFilters(new InputFilter[] { new InputFilter() {
  2488. @Override
  2489. public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
  2490. int dend) {
  2491. return null;
  2492. }
  2493. } });
  2494. activity.adapterProductClassify = new ProductClassifyAdapter(activity.listProductClassify, activity);
  2495. activity.classifySpin.setAdapter(activity.adapterProductClassify);
  2496. activity.classifySpin.setPrompt("请选择产品分级");
  2497. if (activity.productionInfo != null) {
  2498. // int position = CommonUtil.getProductClassifyIndex(activity.productionInfo.getGoodsLevelTypeId(),
  2499. // activity.listProductClassify);
  2500. //
  2501. // activity.classifySpin.setSelection(position);
  2502. // 回显 产品分级
  2503. for (int i = 0; i < activity.listProductClassify.size(); i++) {
  2504. String a = activity.listProductClassify.get(i).getDefectFlagId() + "";
  2505. String b = activity.productionInfo.getOut_Grade() + "";
  2506. if (activity.listProductClassify.get(i).getDefectFlagId() == activity.productionInfo
  2507. .getOut_Grade()) {
  2508. activity.classifySpin.setSelection(i, true);
  2509. }
  2510. }
  2511. if (!(activity.proId == 123 || activity.proId == 157)) { // 养水 3#修模
  2512. activity.classifySpin.setEnabled(true);
  2513. }
  2514. }
  2515. // endTime=System.currentTimeMillis();
  2516. // long time=endTime-startTime;
  2517. // Toast.makeText(getApplicationContext(),time+"",Toast.LENGTH_LONG).show();
  2518. // System.out.println(time+"time");
  2519. if (activity.operationFlag.equals("modify")) {
  2520. activity.productBugList = (List<ProductDefectInfo>) b1.getSerializable("productbuglist");
  2521. activity.mAdapter = new SwipeAdapter(activity, activity.mListView.getRightViewWidth(),
  2522. activity.ServerAddress_ip, activity.ServerAddress_duankou, activity.accountCode,
  2523. activity.checkCollectModify_userCode, activity.password, activity.sessionkey,
  2524. activity.productBugList);
  2525. activity.mListView.setAdapter(activity.mAdapter);
  2526. activity.save.setText("保存(" + activity.productBugList.size() + ")");
  2527. activity.memoEdt.setText(activity.productionInfo.getRemarks());
  2528. activity.mAdapter.setOnRightItemClickListener(new SwipeAdapter.onRightItemClickListener() {
  2529. @Override
  2530. public void onRightItemClick(View v, int position) {
  2531. if (!activity.overdueFlag) {
  2532. ProductDefectInfo defectInfo = activity.productBugList.get(position);
  2533. if (defectInfo.getDeleteFlag().equals("server")) {
  2534. activity.deleteFlag = true;
  2535. }
  2536. activity.mListView.deleteItem(activity.mListView.getChildAt(position));
  2537. activity.productBugList.remove(position);
  2538. activity.save.setText("保存(" + activity.productBugList.size() + ")");
  2539. activity.mAdapter.notifyDataSetChanged();
  2540. }
  2541. }
  2542. });
  2543. }
  2544. break;
  2545. case 2:// 产品分级
  2546. try {
  2547. Bundle b = msg.getData();
  2548. String rest1 = b.getString("result");
  2549. JSONObject jsonObject1 = new JSONObject(rest1);
  2550. JSONObject jsonobject2 = jsonObject1.getJSONObject("d");
  2551. int status1 = jsonobject2.getInt("Status");
  2552. String message1 = jsonobject2.getString("Message");
  2553. if (status1 == 0) {
  2554. String json1 = jsonobject2.getString("Result");
  2555. JSONArray jsonArray = new JSONArray(json1);
  2556. activity.listProductClassify = new ArrayList<ProductClassifyInfo>();
  2557. for (int i = 0; i < jsonArray.length(); i++) {
  2558. activity.classifyInfo = new ProductClassifyInfo();
  2559. JSONObject jsonObject2 = (JSONObject) jsonArray.get(i);
  2560. activity.classifyInfo.setGoodsLevelTypeID((int) jsonObject2.getDouble("GOODSLEVELTYPEID"));
  2561. activity.classifyInfo.setDefectFlagName(jsonObject2.getString("DEFECTFLAGNAME"));
  2562. activity.classifyInfo.setDefectFlagId((int) jsonObject2.getInt("DEFECTFLAGID"));
  2563. activity.listProductClassify.add(i, activity.classifyInfo);
  2564. }
  2565. activity.adapterProductClassify = new ProductClassifyAdapter(activity.listProductClassify,
  2566. activity);
  2567. // 第四步:将适配器添加到下拉列表上
  2568. activity.classifySpin.setAdapter(activity.adapterProductClassify);
  2569. activity.classifySpin.setPrompt("请选择产品分级");
  2570. if (activity.productionInfo != null) {
  2571. int position = CommonUtil.getProductClassifyIndex(
  2572. activity.productionInfo.getGoodsLevelTypeId(), activity.listProductClassify);
  2573. activity.classifySpin.setSelection(position);
  2574. }
  2575. if (activity.mHandler != null) {
  2576. activity.mHandler.removeCallbacksAndMessages(null);
  2577. activity.mHandler.getLooper().quit();
  2578. }
  2579. } else {
  2580. if (activity.mHandler != null) {
  2581. activity.mHandler.removeCallbacksAndMessages(null);
  2582. activity.mHandler.getLooper().quit();
  2583. }
  2584. CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, activity.getApplicationContext());
  2585. CommonUtil.showAlertDialog(status1, message1, activity);
  2586. }
  2587. } catch (Exception e) {
  2588. e.printStackTrace();
  2589. }
  2590. break;
  2591. case 3:// 跳转工序
  2592. try {
  2593. Bundle b = msg.getData();
  2594. String rest2 = b.getString("result");
  2595. JSONObject jsonObject1 = new JSONObject(rest2);
  2596. JSONObject jsonObject2 = jsonObject1.getJSONObject("d");
  2597. int status2 = jsonObject2.getInt("Status");
  2598. String message2 = jsonObject2.getString("Message");
  2599. if (status2 == 0) {
  2600. String json1 = jsonObject2.getString("Result");
  2601. JSONArray jsonArray = new JSONArray(json1);
  2602. int goodsLevelTypeID = activity.classifyInfo.getGoodsLevelTypeID();// 所选产品分级类型
  2603. activity.listReWorkProcedure = new ArrayList<ReworkProcedureInfo>();
  2604. for (int i = 0; i < jsonArray.length(); i++) {
  2605. ReworkProcedureInfo reworkProcedureInfo1 = new ReworkProcedureInfo();
  2606. JSONObject object = (JSONObject) jsonArray.get(i);
  2607. reworkProcedureInfo1
  2608. .setReworkProcedureID(String.valueOf(object.getDouble("REWORKPROCEDUREID")));
  2609. reworkProcedureInfo1.setReworkProcedureName(object.getString("REWORKPROCEDURENAME"));
  2610. if (goodsLevelTypeID == 6 && object.getString("REWORKPROCEDURENAME").contains("重烧")) {
  2611. // 重烧
  2612. activity.listReWorkProcedure.add(reworkProcedureInfo1);
  2613. }
  2614. if (goodsLevelTypeID == 16 && object.getString("REWORKPROCEDURENAME").contains("冷补")) {
  2615. // 冷补
  2616. activity.listReWorkProcedure.add(reworkProcedureInfo1);
  2617. }
  2618. }
  2619. activity.adapterReWorkProcedure = new ReworkProcedureSpinnerAdapter(activity,
  2620. activity.listReWorkProcedure);
  2621. activity.gotoSpin.setPrompt("请选择跳转工序");
  2622. activity.gotoSpin.setAdapter(activity.adapterReWorkProcedure);
  2623. int position = 0;
  2624. // if (activity.operationFlag.equals("modify")) {
  2625. if (goodsLevelTypeID == 6) { // 重烧进 大件默认重烧接收 小件 默认重烧交接 根据GOODSMODELforCheck 包不包含CT 判断
  2626. if (activity.listReWorkProcedure != null && activity.listReWorkProcedure.size() > 0) {
  2627. String GOODSMODELforCheck = activity.GOODSMODELforCheck.substring(0, 2);
  2628. for (int i = 0; i < activity.listReWorkProcedure.size(); i++) {
  2629. // if ("CT".equals(GOODSMODELforCheck)) {
  2630. if ("1".equals(refireflag)) {
  2631. if (activity.listReWorkProcedure.get(i).getReworkProcedureName()
  2632. .contains("重烧接收")) {
  2633. position = i;
  2634. break;
  2635. }
  2636. } else {
  2637. if (activity.listReWorkProcedure.get(i).getReworkProcedureName()
  2638. .contains("重烧交接")) {
  2639. position = i;
  2640. break;
  2641. }
  2642. }
  2643. }
  2644. }
  2645. } else if (goodsLevelTypeID == 16) { // 冷补
  2646. // if (activity.productionInfo.getReworkProcedureId() > 0) {
  2647. // if (activity.listReWorkProcedure != null && activity.listReWorkProcedure.size() > 0) {
  2648. // for (int i = 0; i < activity.listReWorkProcedure.size(); i++) {
  2649. // if ((int) Double.parseDouble(activity.listReWorkProcedure.get(i)
  2650. // .getReworkProcedureID()) == activity.productionInfo
  2651. // .getReworkProcedureId()) {
  2652. // position = i;
  2653. // break;
  2654. // }
  2655. // }
  2656. // }
  2657. // } else {
  2658. if (activity.listReWorkProcedure != null && activity.listReWorkProcedure.size() > 0) {
  2659. if (!"136".equals(Mout_ReworkProcedureId)) {
  2660. for (int i = 0; i < activity.listReWorkProcedure.size(); i++) {
  2661. if ((int) Double.parseDouble(
  2662. activity.listReWorkProcedure.get(i).getReworkProcedureID()) == 153) {
  2663. position = i;
  2664. break;
  2665. }
  2666. }
  2667. }
  2668. }
  2669. // }
  2670. } else {
  2671. if (activity.productionInfo.getReworkProcedureId() > 0) {
  2672. if (activity.listReWorkProcedure != null && activity.listReWorkProcedure.size() > 0) {
  2673. for (int i = 0; i < activity.listReWorkProcedure.size(); i++) {
  2674. if ((int) Double.parseDouble(activity.listReWorkProcedure.get(i)
  2675. .getReworkProcedureID()) == activity.productionInfo
  2676. .getReworkProcedureId()) {
  2677. position = i;
  2678. break;
  2679. }
  2680. }
  2681. }
  2682. }
  2683. }
  2684. // }
  2685. // 2023年10月16日
  2686. // if ((activity.proId == 125) || (activity.proId == 131)) { // 三检 显示
  2687. // if (goodsLevelTypeID == 16) { // 产品分级选择冷补的时候 给冷补类型赋值 其他清空
  2688. // activity.adapterCheckColdRepairCategory = new ProductClassifyAdapter(
  2689. // activity.listCheckColdRepairCategory, activity.getApplicationContext());
  2690. // activity.check_cold_repair_category.setAdapter(activity.adapterCheckColdRepairCategory);
  2691. // }
  2692. //
  2693. // }
  2694. // 只有一个选项的时候,默认选中
  2695. activity.gotoSpin.setSelection(position);
  2696. if (activity.mHandler != null) {
  2697. activity.mHandler.removeCallbacksAndMessages(null);
  2698. activity.mHandler.getLooper().quit();
  2699. }
  2700. if (goodsLevelTypeID != 6) { // 不是重烧 就可以放开
  2701. activity.gotoSpin.setEnabled(true);
  2702. }
  2703. } else {
  2704. if (activity.mHandler != null) {
  2705. activity.mHandler.removeCallbacksAndMessages(null);
  2706. activity.mHandler.getLooper().quit();
  2707. }
  2708. CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, activity.getApplicationContext());
  2709. CommonUtil.showAlertDialog(status2, message2, activity);
  2710. }
  2711. } catch (Exception e) {
  2712. e.printStackTrace();
  2713. }
  2714. break;
  2715. case 4:
  2716. String rest2 = msg.getData().getString("result");
  2717. ProcessDialogUtils.closeProgressDilog();
  2718. repeatFlag = System.currentTimeMillis() + "-" + checkCollectModify_userCode;
  2719. try {
  2720. JSONObject jsonObject4 = new JSONObject(rest2);
  2721. JSONObject jsonObject5 = jsonObject4.getJSONObject("d");
  2722. int status2 = jsonObject5.getInt("Status");
  2723. String message2 = jsonObject5.getString("Message");
  2724. activity.dryRepairFlag = false;
  2725. if (activity.collectType == 1) {
  2726. activity.worknovalid = false;
  2727. }
  2728. if (status2 == 0) {
  2729. //2023年10月16日
  2730. // if ((activity.proId == 125) || (activity.proId == 131)) { // 三检 显示
  2731. // // 保存完事 清除冷补类别
  2732. // activity.adapterCheckColdRepairCategory = new ProductClassifyAdapter(activity.list_null,
  2733. // activity.getApplicationContext());
  2734. // activity.check_cold_repair_category.setAdapter(activity.adapterCheckColdRepairCategory);
  2735. // activity.check_cold_repair_category.setEnabled(false);
  2736. //
  2737. // }
  2738. // 保存成功把 漏气 养水 养水不合格位置 试水 试水不合格位置 还原
  2739. activity.check_leak.setSelection(0, true);
  2740. activity.check_nourishing_water.setSelection(0, true);
  2741. activity.check_water_test.setSelection(0, true);
  2742. activity.adapterCheckNourishingWaterPosition = new ProductClassifyAdapter(activity.list_null,
  2743. activity.getApplicationContext());
  2744. activity.check_nourishing_water_position
  2745. .setAdapter(activity.adapterCheckNourishingWaterPosition);
  2746. activity.check_nourishing_water_position.setPrompt("请选择");
  2747. activity.adapterCheckWaterTestPosition = new ProductClassifyAdapter(activity.list_null,
  2748. activity.getApplicationContext());
  2749. activity.check_water_test_position.setAdapter(activity.adapterCheckWaterTestPosition);
  2750. activity.check_nourishing_water_position.setPrompt("请选择");
  2751. activity.adapterCheckOfflineIdentificatio = new ProductClassifyAdapter(
  2752. activity.listCheckOfflineIdentificatio, activity.getApplicationContext());
  2753. activity.check_offline_identificatio.setAdapter(activity.adapterCheckOfflineIdentificatio);
  2754. String Result = jsonObject5.getString("Result");
  2755. if (Result.equals("")) {
  2756. // barcode.setText("");
  2757. activity.save.setEnabled(true);
  2758. activity.deleteFlag = false;
  2759. activity.originalGoodsLevelTypeId = 0;
  2760. // barcode.setFocusable(true);
  2761. // barcode.requestFocus();
  2762. activity.productNumber.setText("");
  2763. activity.productCode.setText("");
  2764. activity.productName.setText("");
  2765. activity.defectflag = 1;
  2766. activity.refineEdt.setText("");
  2767. activity.repairEdt.setText("");
  2768. activity.tvLeak.setText("");
  2769. activity.tvInternalLeak.setText("");
  2770. activity.tvPassBall.setText("");
  2771. activity.bugnotxt.setText("");
  2772. activity.bugnametxt.setText("");
  2773. activity.loctxt.setText("");
  2774. activity.tvLocName.setText("");
  2775. activity.check_repair_crack_position.setText("");
  2776. activity.mCheckRepairCrackPositionDate = "";// 清除补裂位置
  2777. activity.memoEdt.setText("");
  2778. activity.trademarkNameTxt.setText("");
  2779. activity.mCheckRepairCrackPositionDate = "";
  2780. if (activity.collectType == 1) { // 采集类型:1-集中 2-单点
  2781. activity.worknovalid = false;
  2782. activity.worknoEdt.setEnabled(true);
  2783. activity.worknoEdt.setText("");
  2784. activity.worknoEdt.setFocusable(true);
  2785. activity.worknoEdt.setFocusableInTouchMode(true);
  2786. activity.worknoEdt.requestFocus();
  2787. activity.worknoEdt.findFocus();
  2788. activity.worknoEdt.setFilters(new InputFilter[] { new InputFilter() {
  2789. @Override
  2790. public CharSequence filter(CharSequence source, int start, int end, Spanned dest,
  2791. int dstart, int dend) {
  2792. return null;
  2793. }
  2794. } });
  2795. } else {
  2796. activity.barcode.setEnabled(true);
  2797. activity.barcode.setText("");
  2798. activity.barcode.setFocusable(true);
  2799. activity.barcode.setFocusableInTouchMode(true);
  2800. activity.barcode.requestFocus();
  2801. activity.barcode.findFocus();
  2802. activity.barcode.setFilters(new InputFilter[] { new InputFilter() {
  2803. @Override
  2804. public CharSequence filter(CharSequence source, int start, int end, Spanned dest,
  2805. int dstart, int dend) {
  2806. return null;
  2807. }
  2808. } });
  2809. CommonUtil.BarcodeMaxLength(activity.barcode, 50);
  2810. }
  2811. activity.footerdivider.setVisibility(View.GONE);
  2812. // saveEnd=System.currentTimeMillis();
  2813. // long saveTime= saveEnd-saveStart;
  2814. // Toast.makeText(getApplicationContext(),saveTime+"save",Toast.LENGTH_LONG).show();
  2815. // System.out.println(saveTime+"save");
  2816. CommonUtil.playSound(activity.getApplicationContext());
  2817. // Toast.makeText(getApplicationContext(), "上传成功",
  2818. // Toast.LENGTH_SHORT).show();
  2819. CustomToast.showToast(activity.getApplicationContext(), "上传成功", 2000);
  2820. if (activity.classifySpin.getSelectedItem() != null) {
  2821. activity.listProductClassify.removeAll(activity.listProductClassify);
  2822. if (activity.adapterProductClassify != null) {
  2823. activity.adapterProductClassify.notifyDataSetChanged();
  2824. }
  2825. activity.classifySpin.setEnabled(false);
  2826. }
  2827. if (activity.gotoSpin.getSelectedItem() != null) {
  2828. activity.listReWorkProcedure.clear();
  2829. if (activity.adapterReWorkProcedure != null) {
  2830. activity.adapterReWorkProcedure.notifyDataSetChanged();
  2831. }
  2832. activity.gotoSpin.setEnabled(false);
  2833. }
  2834. //
  2835. // if (mAdapter != null
  2836. // && mAdapter.bitmapCache.size() > 0) {
  2837. // ViewUtil.FreeBitmap(mAdapter.bitmapCache);
  2838. // }
  2839. if (activity.productBugList != null && activity.productBugList.size() > 0) {
  2840. for (ProductDefectInfo p1 : activity.productBugList) {
  2841. List<ImagePath> imagepathlist = p1.getDefectImgPath();
  2842. for (ImagePath path : imagepathlist) {
  2843. String localpath = path.getLocalPath();
  2844. File f = new File(localpath);
  2845. if (f.exists()) {
  2846. f.delete();
  2847. }
  2848. }
  2849. }
  2850. activity.productBugList.removeAll(activity.productBugList);
  2851. activity.mAdapter.notifyDataSetChanged();
  2852. activity.save.setText("保存(" + activity.productBugList.size() + ")");
  2853. }
  2854. if (activity.mHandler != null) {
  2855. activity.mHandler.removeCallbacksAndMessages(null);
  2856. activity.mHandler.getLooper().quit();
  2857. }
  2858. } else {
  2859. // Toast.makeText(CheckCollectActivity.this,
  2860. // Result, Toast.LENGTH_LONG).show();
  2861. if (activity.mHandler != null) {
  2862. activity.mHandler.removeCallbacksAndMessages(null);
  2863. activity.mHandler.getLooper().quit();
  2864. }
  2865. activity.save.setEnabled(true);
  2866. CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, activity.getApplicationContext());
  2867. CommonUtil.showSaveAlertDialog(status2, Result, activity, activity.worknoEdt,
  2868. activity.barcode, activity.collectType);
  2869. return;
  2870. }
  2871. } else if (status2 == 2) {
  2872. if (activity.mHandler != null) {
  2873. activity.mHandler.removeCallbacksAndMessages(null);
  2874. activity.mHandler.getLooper().quit();
  2875. }
  2876. return;
  2877. } else {
  2878. if (activity.mHandler != null) {
  2879. activity.mHandler.removeCallbacksAndMessages(null);
  2880. activity.mHandler.getLooper().quit();
  2881. }
  2882. activity.save.setEnabled(true);
  2883. CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, activity.getApplicationContext());
  2884. CommonUtil.showSaveAlertDialog(status2, message2, activity, activity.worknoEdt,
  2885. activity.barcode, activity.collectType);
  2886. return;
  2887. }
  2888. } catch (JSONException e) {
  2889. if (activity.mHandler != null) {
  2890. activity.mHandler.removeCallbacksAndMessages(null);
  2891. activity.mHandler.getLooper().quit();
  2892. }
  2893. e.printStackTrace();
  2894. }
  2895. break;
  2896. case 6:
  2897. Bundle b = msg.getData();
  2898. try {
  2899. String json = b.getString("bugnoResult");
  2900. ProcessDialogUtils.closeProgressDilog();
  2901. JSONObject j = new JSONObject(json);
  2902. JSONObject jo = (JSONObject) j.opt("d");
  2903. int status = jo.optInt("Status");
  2904. String message = jo.optString("Message");
  2905. // InputMethodManager im1 = (InputMethodManager) bugnotxt
  2906. // .getContext().getSystemService(
  2907. // Context.INPUT_METHOD_SERVICE);
  2908. // im1.hideSoftInputFromWindow(CheckCollectModifyActivity.this
  2909. // .getCurrentFocus().getWindowToken(),
  2910. // InputMethodManager.HIDE_NOT_ALWAYS);
  2911. if (status == 0) {
  2912. String result = jo.optString("Result");
  2913. JSONObject jre = new JSONObject(result);
  2914. String errmsg = jre.optString("ErrMsg");
  2915. if (errmsg.equals("")) {
  2916. activity.defectnovalid = true;
  2917. // Toast.makeText(ProductBugActivity.this, "缺陷号正确",
  2918. // Toast.LENGTH_LONG).show();
  2919. activity.defectNo = new DefectNo();
  2920. activity.defectId = jre.optInt("DefectID");
  2921. activity.defectNo.setDefectId(activity.defectId);
  2922. activity.defectName = jre.optString("DefectName");
  2923. activity.defectNo.setDefectName(activity.defectName);
  2924. activity.defectNo.setDefectCode(activity.defectno);
  2925. activity.bugnametxt.setText(activity.defectName);
  2926. activity.loctxt.setFocusable(true);
  2927. activity.loctxt.requestFocus();
  2928. if (activity.mHandler != null) {
  2929. activity.mHandler.removeCallbacksAndMessages(null);
  2930. activity.mHandler.getLooper().quit();
  2931. }
  2932. } else {
  2933. activity.bugnotxt.setText("");
  2934. activity.bugnametxt.setText("");
  2935. activity.bugnotxt.setFocusable(true);
  2936. activity.bugnotxt.requestFocus();
  2937. CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, activity.getApplicationContext());
  2938. CommonUtil.showAlertDialog(status, errmsg, activity);
  2939. return;
  2940. }
  2941. } else {
  2942. CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, activity.getApplicationContext());
  2943. CommonUtil.showAlertDialog(status, message, activity);
  2944. return;
  2945. }
  2946. } catch (Exception e) {
  2947. }
  2948. break;
  2949. case 7:
  2950. Bundle b2 = msg.getData();
  2951. String json = b2.getString("buglocResult");
  2952. try {
  2953. ProcessDialogUtils.closeProgressDilog();
  2954. JSONObject j = new JSONObject(json);
  2955. JSONObject jo = (JSONObject) j.opt("d");
  2956. int status = jo.optInt("Status");
  2957. String message = jo.optString("Message");
  2958. activity.hintKb(activity.loctxt);
  2959. if (status == 0) {
  2960. String result = jo.optString("Result");
  2961. JSONObject jre = new JSONObject(result);
  2962. String errmsg = jre.optString("ErrMsg");
  2963. if (errmsg.equals("")) {
  2964. activity.defectlocationvalid = true;
  2965. int defectPositionId = jre.optInt("DefectPositionID");
  2966. String defectPositionName = jre.optString("DefectPositionName");
  2967. activity.dl = new DefectLocation();
  2968. activity.dl.setDefectPositionId(defectPositionId);
  2969. activity.dl.setDefectPositionCode(activity.defectLocation);
  2970. activity.dl.setDefectPositionName(defectPositionName);
  2971. if (activity.mHandler != null) {
  2972. activity.mHandler.removeCallbacksAndMessages(null);
  2973. activity.mHandler.getLooper().quit();
  2974. }
  2975. activity.tvLocName.setText(defectPositionName);
  2976. } else {
  2977. activity.defectlocationvalid = false;
  2978. activity.loctxt.setText("");
  2979. activity.loctxt.setFocusable(true);
  2980. activity.loctxt.requestFocus();
  2981. activity.tvLocName.setText("");
  2982. CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, activity.getApplicationContext());
  2983. CommonUtil.showAlertDialog(status, errmsg, activity);
  2984. if (activity.mHandler != null) {
  2985. activity.mHandler.removeCallbacksAndMessages(null);
  2986. activity.mHandler.getLooper().quit();
  2987. }
  2988. return;
  2989. }
  2990. } else {
  2991. if (activity.mHandler != null) {
  2992. activity.mHandler.removeCallbacksAndMessages(null);
  2993. activity.mHandler.getLooper().quit();
  2994. }
  2995. CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, activity.getApplicationContext());
  2996. CommonUtil.showAlertDialog(status, message, activity);
  2997. }
  2998. } catch (JSONException e) {
  2999. if (activity.mHandler != null) {
  3000. activity.mHandler.removeCallbacksAndMessages(null);
  3001. activity.mHandler.getLooper().quit();
  3002. }
  3003. e.printStackTrace();
  3004. }
  3005. break;
  3006. case 8:
  3007. String rest8 = msg.getData().getString("result");
  3008. ProcessDialogUtils.closeProgressDilog();
  3009. try {
  3010. activity.listCheckLeak = new ArrayList<ProductClassifyInfo>();// 漏气数据源
  3011. activity.listCheckNourishingWater = new ArrayList<ProductClassifyInfo>();// 养水数据源
  3012. activity.listCheckNourishingWaterPosition = new ArrayList<ProductClassifyInfo>();// 养水不合格位置数据源
  3013. activity.listCheckWaterTest = new ArrayList<ProductClassifyInfo>();// 试水数据源
  3014. JSONArray jarray = new JSONArray(rest8);
  3015. // 养水的时候 才给养水不合格位置 赋值
  3016. if (jarray != null && jarray.length() > 0) {
  3017. for (int i = 0; i < jarray.length(); i++) {
  3018. activity.classifyInfo = new ProductClassifyInfo();
  3019. JSONObject jsonObject2 = (JSONObject) jarray.get(i);
  3020. activity.classifyInfo.setDefectFlagType(jsonObject2.optString("DICTIONARYTYPE"));
  3021. activity.classifyInfo.setDefectFlagName(jsonObject2.optString("DICTIONARYVALUE"));
  3022. activity.classifyInfo.setDefectFlagId((int) jsonObject2.getInt("DICTIONARYID"));
  3023. activity.listCheckNourishingWaterPosition.add(i, activity.classifyInfo);
  3024. }
  3025. }
  3026. // 给漏气 养水 试水 赋上 合格和不合格 数据源
  3027. activity.classifyInfo = new ProductClassifyInfo();
  3028. activity.classifyInfo.setDefectFlagType("");
  3029. activity.classifyInfo.setDefectFlagName("合格");
  3030. activity.classifyInfo.setDefectFlagId(1);
  3031. activity.listCheckLeak.add(0, activity.classifyInfo);
  3032. activity.listCheckNourishingWater.add(0, activity.classifyInfo);
  3033. activity.listCheckWaterTest.add(0, activity.classifyInfo);
  3034. activity.classifyInfo = new ProductClassifyInfo();
  3035. activity.classifyInfo.setDefectFlagType("");
  3036. activity.classifyInfo.setDefectFlagName("不合格");
  3037. activity.classifyInfo.setDefectFlagId(0);
  3038. activity.listCheckLeak.add(1, activity.classifyInfo);
  3039. activity.listCheckNourishingWater.add(1, activity.classifyInfo);
  3040. activity.listCheckWaterTest.add(1, activity.classifyInfo);
  3041. activity.adapterCheckLeak = new ProductClassifyAdapter(activity.listCheckLeak,
  3042. activity.getApplicationContext());
  3043. activity.adapterCheckNourishingWater = new ProductClassifyAdapter(activity.listCheckNourishingWater,
  3044. activity.getApplicationContext());
  3045. activity.adapterCheckWaterTest = new ProductClassifyAdapter(activity.listCheckWaterTest,
  3046. activity.getApplicationContext());
  3047. // 第四步:将适配器添加到下拉列表上
  3048. activity.check_leak.setAdapter(activity.adapterCheckLeak);
  3049. activity.check_nourishing_water.setAdapter(activity.adapterCheckNourishingWater);
  3050. activity.check_water_test.setAdapter(activity.adapterCheckWaterTest);
  3051. activity.check_leak.setPrompt("请选择是否合格");
  3052. activity.check_nourishing_water.setPrompt("请选择是否合格");
  3053. activity.check_water_test.setPrompt("请选择是否合格");
  3054. } catch (JSONException e) {
  3055. if (activity.mHandler != null) {
  3056. activity.mHandler.removeCallbacksAndMessages(null);
  3057. activity.mHandler.getLooper().quit();
  3058. }
  3059. e.printStackTrace();
  3060. }
  3061. break;
  3062. case 9:
  3063. String rest9 = msg.getData().getString("result");
  3064. ProcessDialogUtils.closeProgressDilog();
  3065. try {
  3066. activity.listCheckWaterTestPosition = new ArrayList<ProductClassifyInfo>();// 试水不合格位置数据源
  3067. JSONArray jarray = new JSONArray(rest9);
  3068. // 试水的时候 才给试水不合格位置 赋值
  3069. if (jarray != null && jarray.length() > 0) {
  3070. for (int i = 0; i < jarray.length(); i++) {
  3071. activity.classifyInfo = new ProductClassifyInfo();
  3072. JSONObject jsonObject2 = (JSONObject) jarray.get(i);
  3073. activity.classifyInfo.setDefectFlagType(jsonObject2.optString("DICTIONARYTYPE"));
  3074. activity.classifyInfo.setDefectFlagName(jsonObject2.optString("DICTIONARYVALUE"));
  3075. activity.classifyInfo.setDefectFlagId((int) jsonObject2.getInt("DICTIONARYID"));
  3076. activity.listCheckWaterTestPosition.add(i, activity.classifyInfo);
  3077. }
  3078. }
  3079. } catch (JSONException e) {
  3080. if (activity.mHandler != null) {
  3081. activity.mHandler.removeCallbacksAndMessages(null);
  3082. activity.mHandler.getLooper().quit();
  3083. }
  3084. e.printStackTrace();
  3085. }
  3086. break;
  3087. case 10:
  3088. Bundle bproductbuglist = msg.getData();
  3089. activity.productBugList = (List<ProductDefectInfo>) bproductbuglist.getSerializable("productbuglist");
  3090. activity.mAdapter = new SwipeAdapter(activity, activity.mListView.getRightViewWidth(),
  3091. activity.ServerAddress_ip, activity.ServerAddress_duankou, activity.accountCode,
  3092. activity.checkCollectModify_userCode, activity.password, activity.sessionkey,
  3093. activity.productBugList);
  3094. activity.mListView.setAdapter(activity.mAdapter);
  3095. activity.mAdapter.setOnRightItemClickListener(new SwipeAdapter.onRightItemClickListener() {
  3096. @Override
  3097. public void onRightItemClick(View v, int position) {
  3098. if (!activity.overdueFlag) {
  3099. ProductDefectInfo defectInfo = activity.productBugList.get(position);
  3100. if (defectInfo.getDeleteFlag().equals("server")) {
  3101. activity.deleteFlag = true;
  3102. }
  3103. activity.mListView.deleteItem(activity.mListView.getChildAt(position));
  3104. activity.productBugList.remove(position);
  3105. activity.save.setText("保存(" + activity.productBugList.size() + ")");
  3106. activity.mAdapter.notifyDataSetChanged();
  3107. }
  3108. }
  3109. });
  3110. break;
  3111. case 11: // 补裂位置
  3112. String rest11 = msg.getData().getString("result");
  3113. ProcessDialogUtils.closeProgressDilog();
  3114. try {
  3115. activity.listCheckRepairCrackPosition = new ArrayList<ProductClassifyInfo>();// 试水不合格位置数据源
  3116. JSONArray jarray = new JSONArray(rest11);
  3117. // 试水的时候 才给试水不合格位置 赋值
  3118. if (jarray != null && jarray.length() > 0) {
  3119. activity.mList = new ArrayList();
  3120. for (int i = 0; i < jarray.length(); i++) {
  3121. JSONObject jsonObject2 = (JSONObject) jarray.get(i);
  3122. activity.mList.add(jsonObject2.optString("DICTIONARYVALUE"));
  3123. }
  3124. activity.mPopup = new PopupWindowCheckChoose(activity, activity.mList);
  3125. // * 设置ListView的选择模式
  3126. // * 多选:AbsListView.CHOICE_MODE_MULTIPLE
  3127. // * 单选:AbsListView.CHOICE_MODE_SINGLE
  3128. activity.mPopup.setTagTxt("补裂位置")// 设置顶部title的内容
  3129. .setButtomTxt("确认")// 设置底部按钮内容
  3130. .setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE);// 单选
  3131. activity.mPopup.setOnEventLisenter(new onEventLisenter() {
  3132. @Override
  3133. public void onItemClick(ArrayList<String> positionList) {
  3134. // mTvContent.setText(mList.get(positionList.get(0)));
  3135. StringBuffer resultBuffer = new StringBuffer();
  3136. for (int i = 0; i < positionList.size(); i++) {
  3137. String result = positionList.get(i);
  3138. if (i == 0) {
  3139. resultBuffer.append(result);
  3140. } else {
  3141. resultBuffer.append("," + result);
  3142. }
  3143. }
  3144. String testResult = resultBuffer.toString();
  3145. // Toast.makeText(activity.getApplicationContext(),testResult, Toast.LENGTH_SHORT).show();
  3146. activity.mCheckRepairCrackPositionDate = testResult;
  3147. activity.check_repair_crack_position.setText(activity.mCheckRepairCrackPositionDate);
  3148. activity.mPopup.dismiss();
  3149. }
  3150. });
  3151. }
  3152. } catch (JSONException e) {
  3153. if (activity.mHandler != null) {
  3154. activity.mHandler.removeCallbacksAndMessages(null);
  3155. activity.mHandler.getLooper().quit();
  3156. }
  3157. e.printStackTrace();
  3158. }
  3159. break;
  3160. }
  3161. }
  3162. };
  3163. private void hintKb(View v) {
  3164. InputMethodManager im = (InputMethodManager) v.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
  3165. im.hideSoftInputFromWindow(v.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
  3166. }
  3167. private class BarcodeRunnable implements Runnable {
  3168. String barcode;
  3169. Object obj;
  3170. public BarcodeRunnable(String barcode, Object obj) {
  3171. this.barcode = barcode;
  3172. this.obj = obj;
  3173. }
  3174. @Override
  3175. public void run() {
  3176. synchronized (obj) {
  3177. try {
  3178. {// 2023/2/23 为了获取大件小件标识
  3179. JSONObject jsonObject28 = new JSONObject();
  3180. jsonObject28.put("accountCode", accountCode);
  3181. jsonObject28.put("userCode", checkCollectModify_userCode);
  3182. jsonObject28.put("userPassword", password);
  3183. jsonObject28.put("sessionKey", sessionkey);
  3184. jsonObject28.put("procedureID", proId);// 工序ID,菜单页面传过来的
  3185. jsonObject28.put("barcode", barcode);// 产品条码
  3186. WebClient client = new WebClient();
  3187. String result28 = client.doPost(
  3188. "http://" + ServerAddress_ip + ":" + ServerAddress_duankou + Constants.BAR_CODE_VALID,
  3189. jsonObject28.toString(), "application/json");
  3190. JSONObject jsonObject29 = new JSONObject(result28);
  3191. JSONObject jsonObject30 = jsonObject29.getJSONObject("d");
  3192. int status30 = jsonObject30.getInt("Status");
  3193. String message30 = jsonObject30.getString("Message");
  3194. String result30 = jsonObject30.getString("Result");
  3195. JSONArray jsonArray321 = new JSONArray(result30);
  3196. JSONObject jsonObject331 = (JSONObject) jsonArray321.get(0);
  3197. String outErrMsg331 = jsonObject331.getString("out_errMsg");
  3198. String missFlag = jsonObject331.optString("out_missFlag");
  3199. Mout_ReworkProcedureId = jsonObject331.optString("out_ReworkProcedureId");
  3200. if (status30 == 0) {
  3201. if (!TextUtils.isEmpty(outErrMsg331)) {// 2023/3/10
  3202. if (missFlag.equals("0")) {
  3203. Message m = new Message();
  3204. Bundle b = new Bundle();
  3205. b.putInt("status", status30);
  3206. b.putString("errorMsg", outErrMsg331);
  3207. m.what = 0;
  3208. m.setData(b);
  3209. exceptionHandler.sendMessage(m);
  3210. return;
  3211. } else {
  3212. Message m1 = new Message();
  3213. Bundle b1 = new Bundle();
  3214. b1.putString("errmsg", outErrMsg331);
  3215. b1.putString("flag", missFlag);
  3216. m1.what = 4;
  3217. m1.setData(b1);
  3218. exceptionHandler.sendMessage(m1);
  3219. return;
  3220. }
  3221. } else {
  3222. JSONArray jsonArray30 = new JSONArray(result30);
  3223. JSONObject jsonObject31 = (JSONObject) jsonArray30.get(0);
  3224. RECYCLINGFLAG = jsonObject31.optString("recyclingFlag");
  3225. GOODSMODELforCheck = jsonObject31.optString("GOODSMODELforCheck");
  3226. refireflag=jsonObject31.optString("refireflag");
  3227. if ((GOODSMODELforCheck == null) || (GOODSMODELforCheck == "")
  3228. || (GOODSMODELforCheck == "null")) {
  3229. HashMap<String, String> params = new LinkedHashMap<String, String>();
  3230. params.put("barcode", barcode);
  3231. String resultGOODS = mClient.requestGetBySyn("http://" + ServerAddress_ip + ":9100"
  3232. + "/main/login/api/GetCheckBarcode.ashx", params);
  3233. if (!("".equals(resultGOODS) || resultGOODS == null)) { // 2023年4月17日 防止因为没返回值
  3234. // 包json异常
  3235. JSONObject jGOODS = new JSONObject(resultGOODS);
  3236. String msgGOODSresult = jGOODS.optString("rows");
  3237. JSONArray jarrayGOODS = new JSONArray(msgGOODSresult);
  3238. JSONObject jobjGOODS = jarrayGOODS.optJSONObject(0);
  3239. GOODSMODELforCheck = jobjGOODS.optString("GOODSTYPECODE");
  3240. String GOODSTYPECODE = jobjGOODS.optString("GOODSTYPECODE").substring(0, 6);
  3241. if ("001001".equals(GOODSTYPECODE)) {// todo 又被秦琪坑了 2023/3/8
  3242. GOODSMODELforCheck = "CT";
  3243. } else if ("001002".equals(GOODSTYPECODE)) {
  3244. GOODSMODELforCheck = "11";
  3245. }
  3246. }
  3247. } //
  3248. }
  3249. }
  3250. }
  3251. client = null;
  3252. client = new WebClient();
  3253. JSONObject js = new JSONObject();
  3254. js.put("accountCode", accountCode);
  3255. js.put("userCode", checkCollectModify_userCode);
  3256. js.put("userPassword", password);
  3257. js.put("sessionKey", sessionkey);
  3258. js.put("barcode", barcode);
  3259. String result = client.doPost("http://" + ServerAddress_ip + ":" + ServerAddress_duankou
  3260. + Constants.serverAction + "/GetCompleteProcedureIDPDA", js.toString(), "application/json");
  3261. JSONObject j = new JSONObject(result);
  3262. JSONObject jo = (JSONObject) j.opt("d");
  3263. int status = jo.optInt("Status");
  3264. String msg = jo.optString("Message");
  3265. if (status == 0) {
  3266. String msgresult = jo.optString("Result");
  3267. JSONArray jarray1 = new JSONArray(msgresult);
  3268. if (jarray1 != null && jarray1.length() > 0) {
  3269. JSONObject jobj1 = jarray1.optJSONObject(0);
  3270. int procId = (int) jobj1.optDouble("COMPLETEPROCEDUREID");
  3271. int rest = (int) jobj1.optDouble("PROCEDUREID");
  3272. timestamp = jobj1.optString("CONVERTOPTIMESTAMP");
  3273. if (rest == -1) {
  3274. Message m = new Message();
  3275. m.what = 2;
  3276. Bundle b = new Bundle();
  3277. b.putString("message", "条码" + barcode + "不可编辑");
  3278. m.setData(b);
  3279. exceptionHandler.sendMessage(m);
  3280. return;
  3281. }
  3282. else if (rest > 0) {
  3283. client = null;
  3284. client = new WebClient();
  3285. JSONObject js1 = new JSONObject();
  3286. js1.put("accountCode", accountCode);
  3287. js1.put("userCode", checkCollectModify_userCode);
  3288. js1.put("userPassword", password);
  3289. js1.put("sessionKey", sessionkey);
  3290. js1.put("BarCode", barcode);
  3291. js1.put("ProcedureID", proId);
  3292. String productionDataResult = client.doPost(
  3293. "http://" + ServerAddress_ip + ":" + ServerAddress_duankou
  3294. + Constants.serverAction + "/GetProductionData",
  3295. js1.toString(), "application/json");
  3296. JSONObject json = new JSONObject(productionDataResult);
  3297. JSONObject jb = (JSONObject) json.opt("d");
  3298. int status1 = jb.optInt("Status");
  3299. if (status1 == 0) {
  3300. String result1 = jb.optString("Result");
  3301. JSONArray ja = new JSONArray(result1);
  3302. JSONObject jsonobj = (JSONObject) ja.get(0);
  3303. productionDataId = (int) jsonobj.optDouble("PRODUCTIONDATAID");
  3304. }
  3305. String a111 = proId + "";
  3306. String b111 = procId + "";
  3307. if (proId == procId) {
  3308. if (proId == rest) {
  3309. JSONObject jsonObject69 = new JSONObject();
  3310. jsonObject69.put("accountCode", accountCode);
  3311. jsonObject69.put("userCode", checkCollectModify_userCode);
  3312. jsonObject69.put("userPassword", password);
  3313. jsonObject69.put("sessionKey", sessionkey);
  3314. jsonObject69.put("barcode", barcode);// 产品条码
  3315. client = new WebClient();
  3316. String result69 = client.doPost(
  3317. "http://" + ServerAddress_ip + ":" + ServerAddress_duankou
  3318. + Constants.CHECK_SCRAP_PRODUCT,
  3319. jsonObject69.toString(), "application/json");
  3320. JSONObject jsonObject70 = new JSONObject(result69);
  3321. JSONObject jsonObject71 = jsonObject70.getJSONObject("d");
  3322. int status70 = jsonObject71.getInt("Status");
  3323. String message70 = jsonObject71.getString("Message");
  3324. if (status70 == 0) {
  3325. client = null;
  3326. client = new WebClient();
  3327. JSONObject jsonhead = new JSONObject();
  3328. jsonhead.put("accountCode", accountCode);
  3329. jsonhead.put("userCode", checkCollectModify_userCode);
  3330. jsonhead.put("userPassword", password);
  3331. jsonhead.put("sessionKey", sessionkey);
  3332. jsonhead.put("productionDataID", productionDataId);
  3333. String Result = client.doPost(
  3334. "http://" + ServerAddress_ip + ":" + ServerAddress_duankou
  3335. + Constants.serverAction + "/GetProductionDataByID",
  3336. jsonhead.toString(), "application/json");
  3337. JSONObject jobj = new JSONObject(Result);
  3338. JSONObject jso = (JSONObject) jobj.opt("d");
  3339. int status2 = jso.optInt("Status");
  3340. String Message1 = jso.optString("Message");
  3341. if (status2 == 0) {
  3342. if (productBugList != null && productBugList.size() > 0) {
  3343. productBugList.removeAll(productBugList);
  3344. }
  3345. String res = jso.optString("Result");
  3346. JSONObject je = new JSONObject(res);
  3347. JSONArray jarray = je.optJSONArray("PDAProductionData");
  3348. JSONObject jo1 = (JSONObject) jarray.get(0);
  3349. int goodsId = jo1.optInt("GoodsID");
  3350. String goodsCode = (String) jo1.optString("GoodsCode");
  3351. String goodsName = (String) jo1.optString("GoodsName");
  3352. int defectFlagId = jo1.optInt("DefectFlagID");
  3353. int reworkProcedureId = jo1.optInt("ReworkProcedureID");
  3354. int userId = (int) jo1.optInt("UserID");
  3355. String userCode = jo1.optString("UserCode");
  3356. String userName1 = jo1.optString("UserName");
  3357. String trademarkName = jo1.optString("LogoName");
  3358. String leakName = jo1.optString("LeakFlag1Name");
  3359. String internalLeakName = jo1.optString("LeakFlag2Name");
  3360. String passBall = jo1.optString("LeakFlag3Name");
  3361. specialRepairFlag = String.valueOf(jo1.optInt("SpecialRepairflag"));
  3362. specialRepairFlagName = jo1.optString("SpecialRepairFlagName");
  3363. refire = jo1.optInt("IsReFire");
  3364. refireName = jo1.optString("IsReFireName");
  3365. int goodsLevelTypeId = jo1.optInt("GoodsLevelTypeID");
  3366. originalGoodsLevelTypeId = jo1.optInt("GoodsLevelTypeID");
  3367. String createTime = jo1.optString("CreateTime");
  3368. createTime = CommonUtil.commonDateConverter(createTime);
  3369. checkTime = jo1.optString("CheckTime");
  3370. remarks = jo1.optString("Remarks");
  3371. operationFlag = "modify";
  3372. checkFlag = "2";
  3373. if (goodsLevelTypeId == 7) {
  3374. JSONObject jsonObject20 = new JSONObject();
  3375. jsonObject20.put("accountCode", accountCode);
  3376. jsonObject20.put("userCode", checkCollectModify_userCode);
  3377. jsonObject20.put("userPassword", password);
  3378. jsonObject20.put("sessionKey", sessionkey);
  3379. jsonObject20.put("barcode", barcode);// 产品条码
  3380. client = new WebClient();
  3381. String result20 = client.doPost(
  3382. "http://" + ServerAddress_ip + ":" + ServerAddress_duankou
  3383. + Constants.serverAction + "/GetSubstandardInfo",
  3384. jsonObject20.toString(), "application/json");
  3385. JSONObject jo20 = new JSONObject(result20);
  3386. JSONObject jo21 = (JSONObject) jo20.opt("d");
  3387. int status21 = (Integer) jo21.optInt("Status");
  3388. String message21 = jo21.optString("Message");
  3389. if (status21 == 0) {
  3390. String result21 = jo21.optString("Result");
  3391. if (result21.equals("0")) {
  3392. Message m = new Message();
  3393. m.what = 2;
  3394. Bundle b = new Bundle();
  3395. b.putString("message", "次品不能修改");
  3396. m.setData(b);
  3397. exceptionHandler.sendMessage(m);
  3398. return;
  3399. }
  3400. } else {
  3401. Message m = new Message();
  3402. m.what = 0;
  3403. Bundle b = new Bundle();
  3404. b.putInt("status", status21);
  3405. b.putString("errorMsg", message21);
  3406. m.setData(b);
  3407. exceptionHandler.sendMessage(m);
  3408. return;
  3409. }
  3410. }
  3411. productionInfo = new ProductionInfo();
  3412. productionInfo.setBarCode(barcode);
  3413. productionInfo.setGoodsId(goodsId);
  3414. productionInfo.setGoodsCode(goodsCode);
  3415. productionInfo.setGoodsName(goodsName);
  3416. productionInfo.setLeak(leakName);
  3417. productionInfo.setInternalLeak(internalLeakName);
  3418. productionInfo.setPassBall(passBall);
  3419. productionInfo.setDefectFlagId(defectFlagId);
  3420. productionInfo.setReworkProcedureId(reworkProcedureId);
  3421. productionInfo.setCheckTime(checkTime);
  3422. productionInfo.setRemarks(remarks);
  3423. productionInfo.setUserId(userId);
  3424. productionInfo.setUserCode(userCode);
  3425. productionInfo.setUserName(userName1);
  3426. productionInfo.setGoodsLevelTypeId(goodsLevelTypeId);
  3427. productionInfo.setTrademarkName(trademarkName);
  3428. JSONArray defectArray = jo1.optJSONArray("PDADefects");
  3429. if (defectArray != null && defectArray.length() > 0) {
  3430. for (int i = 0; i < defectArray.length(); i++) {
  3431. ProductDefectInfo pdf = new ProductDefectInfo();
  3432. JSONObject job = (JSONObject) defectArray.get(i);
  3433. int defectId = job.optInt("DefectID");
  3434. String defectCode = job.optString("DefectCode");
  3435. String defectName = job.optString("DefectName");
  3436. DefectNo dn = new DefectNo();
  3437. dn.setDefectId(defectId);
  3438. dn.setDefectCode(defectCode);
  3439. dn.setDefectName(defectName);
  3440. pdf.setDefectNo(dn);
  3441. pdf.setDeleteFlag("server");
  3442. int defectPositionId = (int) job.optInt("DefectPositionID");
  3443. String defectPositionCode = job.optString("DefectPositionCode");
  3444. String defectPositionName = job.optString("DefectPositionName");
  3445. DefectLocation dl = new DefectLocation();
  3446. dl.setDefectPositionId(defectPositionId);
  3447. dl.setDefectPositionCode(defectPositionCode);
  3448. dl.setDefectPositionName(defectPositionName);
  3449. pdf.setDefectLocation(dl);
  3450. int defectProcedureId = job.optInt("DefectProcedureID");
  3451. String defectProcedureCode = job
  3452. .optString("DefectProcedureCode");
  3453. String defectProcedureName = job
  3454. .optString("DefectProcedureName");
  3455. ResponsibilityProcedure rp = new ResponsibilityProcedure();
  3456. rp.setDutyProcedureId(defectProcedureId);
  3457. rp.setDutyProcedureCode(defectProcedureCode);
  3458. rp.setDutyProcedureName(defectProcedureName);
  3459. pdf.setResponsibilityProcedure(rp);
  3460. DefectDeduction defectDeduction = new DefectDeduction();
  3461. double defectDeductionNum = job.optDouble("DefectDeductionNum");
  3462. defectDeduction.setDefectDeductionNum(
  3463. String.valueOf(defectDeductionNum));
  3464. pdf.setDefectDeduction(defectDeduction);
  3465. String specialDefect = job.optString("SpecialDefect");
  3466. if (specialDefect.equals("0")) {
  3467. pdf.setSpecialDefectFlag(false);
  3468. } else {
  3469. pdf.setSpecialDefectFlag(true);
  3470. }
  3471. int defectUserId = (int) job.optInt("DefectUserID");
  3472. String defectUserCode = job.optString("DefectUserCode");
  3473. String defectUserName = job.optString("DefectUserName");
  3474. int ProductionDataId = (int) job
  3475. .optInt("DefectProductionDataID");
  3476. if (defectProcedureId > 0) {
  3477. WorkNo wn = new WorkNo();
  3478. wn.setUserId(defectUserId);
  3479. wn.setUserCode(defectUserCode);
  3480. wn.setUserName(defectUserName);
  3481. wn.setProductionDataId(ProductionDataId);
  3482. pdf.setWorkno(wn);
  3483. }
  3484. else {
  3485. WorkNo wn = new WorkNo();
  3486. wn.setUserId(defectUserId);
  3487. wn.setUserCode(defectUserCode);
  3488. wn.setUserName(defectUserName);
  3489. pdf.setWorkno(wn);
  3490. }
  3491. int jobs = job.optInt("Jobs");
  3492. String jobsText = job.optString("JobsText");
  3493. WorkType wt = new WorkType();
  3494. wt.setJobsID(jobs);
  3495. wt.setJobsName(jobsText);
  3496. pdf.setWorkType(wt);
  3497. int defectFineId = job.optInt("DefectFineID");
  3498. String defectFinesValue = job.optString("DefectFineValue");
  3499. DefectFines df = new DefectFines();
  3500. df.setDefectFinesId(defectFineId);
  3501. df.setDefectFinesName(defectFinesValue);
  3502. pdf.setDefectFines(df);
  3503. JSONArray defectResponsibles = job
  3504. .optJSONArray("PDADefectResponsibles");
  3505. List<DutyPerson> dutyPersonList = new ArrayList<DutyPerson>();
  3506. if (defectResponsibles != null
  3507. && defectResponsibles.length() > 0) {
  3508. for (int k = 0; k < defectResponsibles.length(); k++) {
  3509. JSONObject jo2 = (JSONObject) defectResponsibles.get(k);
  3510. int staffId = jo2.optInt("StaffID");
  3511. String staffCode = jo2.optString("StaffCode");
  3512. String staffName = jo2.optString("StaffName");
  3513. int staffStatus = jo2.optInt("StaffStatus");
  3514. int uJobsId = jo2.optInt("UJobsID");
  3515. int sJobsId = jo2.optInt("SJobsID");
  3516. DutyPerson dp = new DutyPerson();
  3517. dp.setStaffId(staffId);
  3518. dp.setStaffCode(staffCode);
  3519. dp.setStaffName(staffName);
  3520. dp.setStaffStatus(staffStatus);
  3521. dp.setJobsId(uJobsId);
  3522. dp.setsJobsId(sJobsId);
  3523. dp.setUserId(defectUserId);
  3524. dp.setUserCode(defectUserCode);
  3525. dutyPersonList.add(dp);
  3526. }
  3527. }
  3528. pdf.setDutyPersonList(dutyPersonList);
  3529. List<ImagePath> imagePathList = new ArrayList<ImagePath>();
  3530. JSONArray imageJsonArray = job
  3531. .optJSONArray("PDADefectImageResults");
  3532. if (imageJsonArray != null && imageJsonArray.length() > 0) {
  3533. for (int n = 0; n < imageJsonArray.length(); n++) {
  3534. JSONObject imageJo = (JSONObject) imageJsonArray.get(n);
  3535. String path = imageJo.optString("Imagepath");
  3536. ImagePath ip = new ImagePath();
  3537. ip.setServerPath(path);
  3538. ip.setFlag("remote");
  3539. String pPath1 = CommonUtil.getRootFilePath();
  3540. String fileDir1 = pPath1 + Constants.DATA_CACHE_PATH;
  3541. File file1 = new File(fileDir1);
  3542. if (!file1.exists()) {
  3543. file1.mkdir();
  3544. }
  3545. String s = Md5Utils.encode(path);
  3546. String imgName = s + ".jpg";
  3547. File f1 = new File(file1.getAbsolutePath(), imgName);
  3548. if (!f1.exists()) {
  3549. try {
  3550. f1.createNewFile();
  3551. } catch (IOException e) {
  3552. e.printStackTrace();
  3553. }
  3554. }
  3555. ip.setLocalPath(f1.getAbsolutePath());
  3556. imagePathList.add(ip);
  3557. }
  3558. }
  3559. String checkTime = job.optString("CheckTime");
  3560. pdf.setCreateTime(checkTime);
  3561. pdf.setDefectImgPath(imagePathList);
  3562. productBugList.add(pdf);
  3563. }
  3564. }
  3565. // wangyingjie 22/12/30 因为 可能是改判的原因 加的 Start
  3566. // 如果 有bug 请删除 仅是赋值 漏气 试水 养水 试水不合格位置 养水不合格位置
  3567. {
  3568. JSONObject jsonObject28 = new JSONObject();
  3569. jsonObject28.put("accountCode", accountCode);
  3570. jsonObject28.put("userCode", checkCollectModify_userCode);
  3571. jsonObject28.put("userPassword", password);
  3572. jsonObject28.put("sessionKey", sessionkey);
  3573. jsonObject28.put("procedureID", proId);// 工序ID,菜单页面传过来的
  3574. jsonObject28.put("barcode", barcode);// 产品条码
  3575. jsonObject28.put("isNewCheck", true);//
  3576. client = new WebClient();
  3577. String result28 = client.doPost(
  3578. "http://" + ServerAddress_ip + ":" + ServerAddress_duankou
  3579. + Constants.BAR_CODE_VALID,
  3580. jsonObject28.toString(), "application/json");
  3581. JSONObject jsonObject29 = new JSONObject(result28);
  3582. JSONObject jsonObject30 = jsonObject29.getJSONObject("d");
  3583. int status30 = jsonObject30.getInt("Status");
  3584. String message30 = jsonObject30.getString("Message");
  3585. if (status30 == 0) {
  3586. String result30 = jsonObject30.getString("Result");
  3587. JSONObject resultObjBarCodeTable = new JSONObject(result30);
  3588. JSONArray resultArrayBarCodeTable = (JSONArray) resultObjBarCodeTable
  3589. .opt("BarCodeTable");// 之前的
  3590. JSONArray resultArrayleakFlag4Table = (JSONArray) resultObjBarCodeTable
  3591. .opt("leakFlag4Table");// 养水 数据
  3592. JSONArray resultArrayleakFlag5Table = (JSONArray) resultObjBarCodeTable
  3593. .opt("leakFlag5Table");// 试水 数据
  3594. JSONArray resultArrayleakFlag6Table = (JSONArray) resultObjBarCodeTable
  3595. .opt("leakFlag6Table");// 补裂 位置数据 传送门
  3596. JSONArray resultArrayDefectTable = (JSONArray) resultObjBarCodeTable
  3597. .opt("DefectTable");// 缺陷信息
  3598. JSONObject jsonObject31 = (JSONObject) resultArrayBarCodeTable
  3599. .get(0);
  3600. String outErrMsg30 = jsonObject31.getString("out_errMsg");
  3601. String missFlag = jsonObject31.optString("out_missFlag");
  3602. if (!TextUtils.isEmpty(outErrMsg30)) {
  3603. if (missFlag.equals("0")) {
  3604. Message m = new Message();
  3605. Bundle b = new Bundle();
  3606. b.putInt("status", status30);
  3607. b.putString("errorMsg", outErrMsg30);
  3608. m.what = 0;
  3609. m.setData(b);
  3610. exceptionHandler.sendMessage(m);
  3611. return;
  3612. } else {
  3613. Message m1 = new Message();
  3614. Bundle b1 = new Bundle();
  3615. b1.putString("errmsg", outErrMsg30);
  3616. b1.putString("flag", missFlag);
  3617. m1.what = 4;
  3618. m1.setData(b1);
  3619. exceptionHandler.sendMessage(m1);
  3620. return;
  3621. }
  3622. } else {
  3623. // produceCodeIsValid = true;
  3624. // if (worknovalid) {
  3625. // productionInfo = new ProductionInfo();
  3626. // productionInfo.setUserId(Integer.parseInt(userID));
  3627. // productionInfo.setUserCode(worknouserCode);
  3628. // productionInfo.setUserName(workNoName);
  3629. //
  3630. // }
  3631. // out_goodsID = jsonObject31.getString("out_goodsID");
  3632. // out_goodsCode = jsonObject31.getString("out_goodsCode");
  3633. // out_goodsName = jsonObject31.getString("out_goodsName");
  3634. // out_groutingUserCode = jsonObject31.getString("out_groutingUserCode");
  3635. // productionInfo.setBarCode(barcode);
  3636. // TODO 由于缺陷信息重复 所以 注释这一块
  3637. // 2023/1/3 start 增加 缺陷信息赋值 z
  3638. // if (resultArrayDefectTable != null
  3639. // && resultArrayDefectTable.length() > 0) {
  3640. // for (int i = 0; i < resultArrayDefectTable
  3641. // .length(); i++) {
  3642. // ProductDefectInfo pdf = new ProductDefectInfo();
  3643. // JSONObject job = (JSONObject) resultArrayDefectTable
  3644. // .get(i);
  3645. // int defectId = job.optInt("DEFECTID");
  3646. // String defectCode = job.optString("DEFECTCODE");
  3647. // String defectName = job.optString("DEFECTNAME");
  3648. // DefectNo dn = new DefectNo();
  3649. // dn.setDefectId(defectId);
  3650. // dn.setDefectCode(defectCode);
  3651. // dn.setDefectName(defectName);
  3652. // pdf.setDefectNo(dn);
  3653. // pdf.setDeleteFlag("server");
  3654. // int defectPositionId = (int) job
  3655. // .optInt("DEFECTPOSITIONID");
  3656. // String defectPositionCode = job
  3657. // .optString("DEFECTPOSITIONCODE");
  3658. // String defectPositionName = job
  3659. // .optString("DEFECTPOSITIONNAME");
  3660. // DefectLocation dl = new DefectLocation();
  3661. // dl.setDefectPositionId(defectPositionId);
  3662. // dl.setDefectPositionCode(defectPositionCode);
  3663. // dl.setDefectPositionName(defectPositionName);
  3664. // pdf.setDefectLocation(dl);
  3665. // int defectProcedureId = job
  3666. // .optInt("DEFECTPROCEDUREID");
  3667. // String defectProcedureCode = job
  3668. // .optString("DEFECTPROCEDURECODE");
  3669. // String defectProcedureName = job
  3670. // .optString("DEFECTPROCEDURENAME");
  3671. // ResponsibilityProcedure rp = new ResponsibilityProcedure();
  3672. // rp.setDutyProcedureId(defectProcedureId);
  3673. // rp.setDutyProcedureCode(defectProcedureCode);
  3674. // rp.setDutyProcedureName(defectProcedureName);
  3675. // pdf.setResponsibilityProcedure(rp);
  3676. //
  3677. // DefectDeduction defectDeduction = new DefectDeduction();
  3678. // double defectDeductionNum = job
  3679. // .optDouble("DEFECTDEDUCTIONNUM");
  3680. // defectDeduction.setDefectDeductionNum(
  3681. // String.valueOf(defectDeductionNum));
  3682. // pdf.setDefectDeduction(defectDeduction);
  3683. // String specialDefect = job
  3684. // .optString("SPECIALDEFECT");
  3685. // if (specialDefect.equals("0")) {
  3686. // pdf.setSpecialDefectFlag(false);
  3687. // } else {
  3688. // pdf.setSpecialDefectFlag(true);
  3689. // }
  3690. // int defectUserId = (int) job.optInt("DEFECTUSERID");
  3691. // String defectUserCode = job
  3692. // .optString("DEFECTUSERCODE");
  3693. // String defectUserName = job
  3694. // .optString("DEFECTUSERNAME");
  3695. // int ProductionDataId = (int) job
  3696. // .optInt("DEFECTPRODUCTIONDATAID");
  3697. // if (defectProcedureId > 0) {
  3698. // WorkNo wn = new WorkNo();
  3699. // wn.setUserId(defectUserId);
  3700. // wn.setUserCode(defectUserCode);
  3701. // wn.setUserName(defectUserName);
  3702. // wn.setProductionDataId(ProductionDataId);
  3703. // pdf.setWorkno(wn);
  3704. // }
  3705. //
  3706. // else {
  3707. // WorkNo wn = new WorkNo();
  3708. // wn.setUserId(defectUserId);
  3709. // wn.setUserCode(defectUserCode);
  3710. // wn.setUserName(defectUserName);
  3711. // pdf.setWorkno(wn);
  3712. // }
  3713. //
  3714. // int jobs = job.optInt("JOBS");
  3715. // String jobsText = job.optString("JOBSTEXT");
  3716. // WorkType wt = new WorkType();
  3717. // wt.setJobsID(jobs);
  3718. // wt.setJobsName(jobsText);
  3719. // pdf.setWorkType(wt);
  3720. //
  3721. // int defectFineId = job.optInt("DEFECTFINEID");
  3722. // String defectFinesValue = job
  3723. // .optString("DEFECTFINEVALUE");
  3724. // DefectFines df = new DefectFines();
  3725. // df.setDefectFinesId(defectFineId);
  3726. // df.setDefectFinesName(defectFinesValue);
  3727. // pdf.setDefectFines(df);
  3728. // JSONArray defectResponsibles = job
  3729. // .optJSONArray("PDADefectResponsibles");
  3730. // List<DutyPerson> dutyPersonList = new ArrayList<DutyPerson>();
  3731. // if (defectResponsibles != null
  3732. // && defectResponsibles.length() > 0) {
  3733. //
  3734. // for (int k = 0; k < defectResponsibles
  3735. // .length(); k++) {
  3736. // JSONObject jo2 = (JSONObject) defectResponsibles
  3737. // .get(k);
  3738. // int staffId = jo2.optInt("StaffID");
  3739. // String staffCode = jo2
  3740. // .optString("StaffCode");
  3741. // String staffName = jo2
  3742. // .optString("StaffName");
  3743. // int staffStatus = jo2.optInt("StaffStatus");
  3744. // int uJobsId = jo2.optInt("UJobsID");
  3745. // int sJobsId = jo2.optInt("SJobsID");
  3746. // DutyPerson dp = new DutyPerson();
  3747. // dp.setStaffId(staffId);
  3748. // dp.setStaffCode(staffCode);
  3749. // dp.setStaffName(staffName);
  3750. // dp.setStaffStatus(staffStatus);
  3751. // dp.setJobsId(uJobsId);
  3752. // dp.setsJobsId(sJobsId);
  3753. // dp.setUserId(defectUserId);
  3754. // dp.setUserCode(defectUserCode);
  3755. // dutyPersonList.add(dp);
  3756. // }
  3757. //
  3758. // }
  3759. // pdf.setDutyPersonList(dutyPersonList);
  3760. //
  3761. // List<ImagePath> imagePathList = new ArrayList<ImagePath>();
  3762. // JSONArray imageJsonArray = job
  3763. // .optJSONArray("PDADefectImageResults");
  3764. // if (imageJsonArray != null
  3765. // && imageJsonArray.length() > 0) {
  3766. // for (int n = 0; n < imageJsonArray
  3767. // .length(); n++) {
  3768. // JSONObject imageJo = (JSONObject) imageJsonArray
  3769. // .get(n);
  3770. // String path = imageJo
  3771. // .optString("Imagepath");
  3772. // ImagePath ip = new ImagePath();
  3773. // ip.setServerPath(path);
  3774. // ip.setFlag("remote");
  3775. // String pPath1 = CommonUtil
  3776. // .getRootFilePath();
  3777. // String fileDir1 = pPath1
  3778. // + Constants.DATA_CACHE_PATH;
  3779. // File file1 = new File(fileDir1);
  3780. // if (!file1.exists()) {
  3781. // file1.mkdir();
  3782. // }
  3783. // String s = Md5Utils.encode(path);
  3784. // String imgName = s + ".jpg";
  3785. // File f1 = new File(file1.getAbsolutePath(),
  3786. // imgName);
  3787. // if (!f1.exists()) {
  3788. // try {
  3789. // f1.createNewFile();
  3790. // } catch (IOException e) {
  3791. // e.printStackTrace();
  3792. // }
  3793. // }
  3794. // ip.setLocalPath(f1.getAbsolutePath());
  3795. // imagePathList.add(ip);
  3796. // }
  3797. // }
  3798. //
  3799. // String checkTime = job.optString("CHECKTIME");
  3800. // pdf.setCreateTime(checkTime);
  3801. // pdf.setDefectImgPath(imagePathList);
  3802. // productBugList.add(pdf);
  3803. //
  3804. // }
  3805. // Message messageproductBugList = new Message();
  3806. // Bundle bproductBugList = new Bundle();
  3807. // bproductBugList.putSerializable("productbuglist",
  3808. // (Serializable) productBugList);
  3809. // messageproductBugList.what = 10;
  3810. // messageproductBugList.setData(bproductBugList);
  3811. // handler.sendMessage(messageproductBugList);
  3812. // }
  3813. // end z
  3814. productionInfo
  3815. .setOut_Grade(jsonObject31.optInt("DefectFlagID"));
  3816. productionInfo.setOfflineFlag(
  3817. jsonObject31.optString("offlineFlag")); // 下标划线
  3818. productionInfo.setOut_LeakFlag1Name(
  3819. jsonObject31.optString("out_LeakFlag1Name"));// 漏气
  3820. productionInfo.setOut_LeakFlag4Name(
  3821. jsonObject31.optString("out_LeakFlag4Name"));// 养水
  3822. productionInfo.setOut_LeakFlag5Name(
  3823. jsonObject31.optString("out_LeakFlag5Name"));// 试水
  3824. productionInfo.setOut_LeakFlag7Name(
  3825. jsonObject31.optString("out_LeakFlag7Name"));// 修磨
  3826. if (resultArrayleakFlag4Table != null
  3827. && resultArrayleakFlag4Table.length() > 0) {
  3828. JSONObject jsonObjectleakFlag4Table = (JSONObject) resultArrayleakFlag4Table
  3829. .get(0);
  3830. productionInfo.setLeakFlag4TablePOSITION(
  3831. jsonObjectleakFlag4Table.optString("POSITION"));// 养水
  3832. // 不合格位置
  3833. }
  3834. if (resultArrayleakFlag5Table != null
  3835. && resultArrayleakFlag5Table.length() > 0) {
  3836. JSONObject jsonObjectleakFlag5Table = (JSONObject) resultArrayleakFlag5Table
  3837. .get(0);
  3838. productionInfo.setLeakFlag5TablePOSITION(
  3839. jsonObjectleakFlag5Table.optString("POSITION"));// 试水
  3840. // 不合格位置
  3841. }
  3842. if (resultArrayleakFlag6Table != null
  3843. && resultArrayleakFlag6Table.length() > 0) {
  3844. JSONObject jsonObjectleakFlag6Table = (JSONObject) resultArrayleakFlag6Table
  3845. .get(0);
  3846. productionInfo.setLeakFlag6TablePOSITION(
  3847. jsonObjectleakFlag6Table.optString("POSITION")); // 补裂位置
  3848. mCheckRepairCrackPositionDate = jsonObjectleakFlag6Table
  3849. .optString("POSITION");
  3850. }
  3851. // productionInfo.setGoodsId(Integer.parseInt(out_goodsID));
  3852. // productionInfo.setGoodsCode(out_goodsCode);
  3853. // productionInfo.setGoodsName(out_goodsName);
  3854. // specialRepairFlag = jsonObject31.optString("out_specialRepairFlag");
  3855. // specialRepairFlagName = jsonObject31
  3856. // .optString("out_specialRepairFlagName");
  3857. // refire = Integer.parseInt(jsonObject31.optString("out_isReFire"));
  3858. // refireName = jsonObject31.optString("out_isReFireName");
  3859. //
  3860. // productionInfo.setTrademarkName(jsonObject31.optString("out_logoName"));
  3861. //
  3862. //
  3863. // productionInfo.setLeak(jsonObject31.optString("out_LeakFlag1Name"));
  3864. //
  3865. // productionInfo.setInternalLeak(jsonObject31.optString("out_LeakFlag2Name"));
  3866. //
  3867. // productionInfo.setPassBall(jsonObject31.optString("out_LeakFlag3Name"));
  3868. }
  3869. }
  3870. else {
  3871. Message m = new Message();
  3872. m.what = 0;
  3873. Bundle b = new Bundle();
  3874. b.putInt("status", status30);
  3875. b.putString("errorMsg", message30);
  3876. m.setData(b);
  3877. exceptionHandler.sendMessage(m);
  3878. return;
  3879. }
  3880. //
  3881. }
  3882. // ----------end
  3883. client = null;
  3884. client = new WebClient();
  3885. JSONObject js6 = new JSONObject();
  3886. js6.put("accountCode", accountCode);
  3887. js6.put("userCode", checkCollectModify_userCode);
  3888. js6.put("userPassword", password);
  3889. js6.put("sessionKey", sessionkey);
  3890. js6.put("settingcode", "S_PM_009");
  3891. String result6 = client.doPost(
  3892. "http://" + ServerAddress_ip + ":" + ServerAddress_duankou
  3893. + Constants.serverAction
  3894. + "/GetSystemSettingDataByCode",
  3895. js6.toString(),
  3896. "application/json");
  3897. JSONObject js10 = new JSONObject(result6);
  3898. JSONObject js11 = js10.optJSONObject("d");
  3899. int status11 = js11.optInt("Status");
  3900. String message11 = js11.optString("Message");
  3901. if (status11 == 0) {
  3902. String result11 = js11.optString("Result");
  3903. JSONArray jarray11 = new JSONArray(result11);
  3904. if (jarray11 != null && jarray.length() > 0) {
  3905. JSONObject js12 = jarray11.optJSONObject(0);
  3906. String settingValueStr = js12.optString("SETTINGVALUE");
  3907. if (!TextUtils.isEmpty(settingValueStr)) {
  3908. int settingValue = Integer.parseInt(settingValueStr);
  3909. if (settingValue > 0) {
  3910. client = null;
  3911. client = new WebClient();
  3912. JSONObject js13 = new JSONObject();
  3913. js13.put("accountCode", accountCode);
  3914. js13.put("userCode", checkCollectModify_userCode);
  3915. js13.put("userPassword", password);
  3916. js13.put("sessionKey", sessionkey);
  3917. js13.put("orgTime", createTime);
  3918. js13.put("days", settingValue);
  3919. js13.put("settingCode", "S_PM_009");
  3920. String result13 = client.doPost(
  3921. "http://" + ServerAddress_ip + ":"
  3922. + ServerAddress_duankou
  3923. + Constants.serverAction
  3924. + "/BarcodeAllowCancel",
  3925. js13.toString(), "application/json");
  3926. JSONObject jobj13 = new JSONObject(result13);
  3927. JSONObject jobj14 = jobj13.optJSONObject("d");
  3928. int status14 = jobj14.optInt("Status");
  3929. String message14 = jobj14.optString("Message");
  3930. if (status14 != 0) {
  3931. overdueFlag = true;
  3932. Bundle b = new Bundle();
  3933. b.putString("message", message14);
  3934. b.putInt("status", status14);
  3935. Message m = new Message();
  3936. m.what = 3;
  3937. m.setData(b);
  3938. exceptionHandler.sendMessage(m);
  3939. }
  3940. }
  3941. }
  3942. }
  3943. }
  3944. else {
  3945. Bundle b = new Bundle();
  3946. b.putString("message", message11);
  3947. b.putInt("status", status11);
  3948. Message m = new Message();
  3949. m.what = 3;
  3950. m.setData(b);
  3951. exceptionHandler.sendMessage(m);
  3952. }
  3953. String result90;
  3954. WebClient client = new WebClient();
  3955. JSONObject jsonObject90 = new JSONObject();
  3956. jsonObject90.put("accountCode", accountCode);
  3957. jsonObject90.put("userCode", checkCollectModify_userCode);
  3958. jsonObject90.put("userPassword", password);
  3959. jsonObject90.put("sessionKey", sessionkey);
  3960. result90 = client.doPost(
  3961. "http://" + ServerAddress_ip + ":" + ServerAddress_duankou
  3962. + Constants.GET_GOODS_GRADE,
  3963. jsonObject90.toString(), "application/json");
  3964. JSONObject jsonObject91 = new JSONObject(result90);
  3965. JSONObject jsonobject92 = jsonObject91.getJSONObject("d");
  3966. int status92 = jsonobject92.getInt("Status");
  3967. String message92 = jsonobject92.getString("Message");
  3968. if (status92 == 0) {
  3969. String json93 = jsonobject92.getString("Result");
  3970. JSONArray jsonArray94 = new JSONArray(json93);
  3971. listProductClassify = new ArrayList<ProductClassifyInfo>();
  3972. for (int i = 0; i < jsonArray94.length(); i++) {
  3973. classifyInfo = new ProductClassifyInfo();
  3974. JSONObject jsonObject95 = (JSONObject) jsonArray94.get(i);
  3975. classifyInfo.setGoodsLevelTypeID(
  3976. (int) jsonObject95.getDouble("GOODSLEVELTYPEID"));
  3977. classifyInfo.setDefectFlagName(
  3978. jsonObject95.getString("DEFECTFLAGNAME"));
  3979. classifyInfo.setDefectFlagId(
  3980. (int) jsonObject95.getInt("DEFECTFLAGID"));
  3981. listProductClassify.add(i, classifyInfo);
  3982. }
  3983. } else {
  3984. Message m = new Message();
  3985. m.what = 0;
  3986. Bundle b = new Bundle();
  3987. b.putInt("status", status92);
  3988. b.putString("errorMsg", message92);
  3989. m.setData(b);
  3990. exceptionHandler.sendMessage(m);
  3991. return;
  3992. }
  3993. Message m = new Message();
  3994. m.what = 1;
  3995. Bundle b = new Bundle();
  3996. b.putSerializable("productbuglist", (Serializable) productBugList);
  3997. b.putSerializable("productclassifylist",
  3998. (Serializable) listProductClassify);
  3999. m.setData(b);
  4000. handler.sendMessage(m);
  4001. return;
  4002. }
  4003. else {
  4004. Message m = new Message();
  4005. m.what = 0;
  4006. Bundle b = new Bundle();
  4007. b.putInt("status", status2);
  4008. b.putString("errorMsg", Message1);
  4009. m.setData(b);
  4010. exceptionHandler.sendMessage(m);
  4011. return;
  4012. }
  4013. } else {
  4014. Message m = new Message();
  4015. m.what = 0;
  4016. Bundle b = new Bundle();
  4017. b.putInt("status", status70);
  4018. b.putString("errorMsg", message70);
  4019. m.setData(b);
  4020. exceptionHandler.sendMessage(m);
  4021. return;
  4022. }
  4023. } else {
  4024. operationFlag = "add";
  4025. dryRepairFlag = true;
  4026. checkFlag = "1";
  4027. JSONObject jsonObject36 = new JSONObject();
  4028. jsonObject36.put("accountCode", accountCode);
  4029. jsonObject36.put("userCode", checkCollectModify_userCode);
  4030. jsonObject36.put("userPassword", password);
  4031. jsonObject36.put("sessionKey", sessionkey);
  4032. jsonObject36.put("procedureID", proId);// 工序ID,菜单页面传过来的
  4033. jsonObject36.put("barcode", barcode);// 产品条码
  4034. client = new WebClient();
  4035. String result36 = client.doPost(
  4036. "http://" + ServerAddress_ip + ":" + ServerAddress_duankou
  4037. + Constants.DRY_REPAIR_BARCODE_CHECK,
  4038. jsonObject36.toString(), "application/json");
  4039. JSONObject jsonObject37 = new JSONObject(result36);
  4040. JSONObject jsonObject38 = jsonObject37.getJSONObject("d");
  4041. int status38 = jsonObject38.getInt("Status");
  4042. String message38 = jsonObject38.getString("Message");
  4043. if (status38 == 0) {
  4044. String result39 = jsonObject38.getString("Result");
  4045. JSONArray jsonArray39 = new JSONArray(result39);
  4046. JSONObject jsonObject40 = (JSONObject) jsonArray39.get(0);
  4047. if (worknovalid) {
  4048. productionInfo = new ProductionInfo();
  4049. productionInfo.setUserId(Integer.parseInt(userID));
  4050. productionInfo.setUserCode(worknouserCode);
  4051. productionInfo.setUserName(workNoName);
  4052. }
  4053. out_goodsID = String.valueOf(jsonObject40.optInt("GOODSID"));
  4054. out_goodsCode = jsonObject40.getString("GOODSCODE");
  4055. out_goodsName = jsonObject40.getString("GOODSNAME");
  4056. specialRepairFlag = jsonObject40.optString("SPECIALREPAIRFLAG");
  4057. refire = Integer.parseInt(jsonObject40.optString("ISREFIRE"));
  4058. String trademarkName = jsonObject40.optString("LOGONAME");
  4059. productionInfo.setTrademarkName(trademarkName);
  4060. // out_groutingUserCode =
  4061. // jsonObject40
  4062. // .getString("out_groutingUserCode");
  4063. productionInfo.setBarCode(barcode);
  4064. productionInfo.setGoodsId(Integer.parseInt(out_goodsID));
  4065. productionInfo.setGoodsCode(out_goodsCode);
  4066. productionInfo.setGoodsName(out_goodsName);
  4067. // productionInfo.setGroutingUserCode(out_groutingUserCode);
  4068. // JSONObject jsonObject41 = new
  4069. // JSONObject();
  4070. // jsonObject41.put("accountCode",
  4071. // accountCode);
  4072. // jsonObject41.put("userCode",
  4073. // userName);
  4074. // jsonObject41.put("userPassword",
  4075. // Md5Utils.encode(password));
  4076. // jsonObject41.put("sessionKey",
  4077. // sessionkey);
  4078. // jsonObject41.put("barcode",
  4079. // code);// 产品条码
  4080. // client = new WebClient();
  4081. // String result41 =
  4082. // client.doPost("http://"
  4083. // + ServerAddress_ip + ":" +
  4084. // ServerAddress_duankou
  4085. // +
  4086. // Constants.GET_IN_PRODUCTION_DATA_LIST,
  4087. // jsonObject41.toString(),
  4088. // "application/json");
  4089. // JSONObject j42=new
  4090. // JSONObject(result41);
  4091. // JSONObject
  4092. // j43=j42.optJSONObject("d");
  4093. // int
  4094. // status43=j43.optInt("Status");
  4095. // String
  4096. // message43=j43.optString("Message");
  4097. // if(status43==0){
  4098. // String
  4099. // result43=j43.optString("Result");
  4100. // JSONArray jarray43=new
  4101. // JSONArray(result43);
  4102. // JSONObject j44=
  4103. // jarray43.optJSONObject(0);
  4104. // refire=Integer.parseInt(j44.optString("ISREFIRE"));
  4105. // specialRepairFlag=j44.optString("SPECIALREPAIRFLAG");
  4106. // }
  4107. // else{
  4108. // Message m=new Message();
  4109. // m.what=0;
  4110. // Bundle b=new Bundle();
  4111. // b.putInt("status",status43);
  4112. // b.putString("errorMsg",message43);
  4113. // m.setData(b);
  4114. // exceptionHandler.sendMessage(m);
  4115. // return;
  4116. // }
  4117. // editstatus = true;
  4118. JSONObject jsonObject45 = new JSONObject();
  4119. jsonObject45.put("accountCode", accountCode);
  4120. jsonObject45.put("userCode", checkCollectModify_userCode);
  4121. jsonObject45.put("userPassword", password);
  4122. jsonObject45.put("sessionKey", sessionkey);
  4123. jsonObject45.put("barCode", barcode);// 产品条码
  4124. client = new WebClient();
  4125. String result45 = client.doPost(
  4126. "http://" + ServerAddress_ip + ":" + ServerAddress_duankou
  4127. + Constants.CHECK_COLLECT_HAND_OVER_URL,
  4128. jsonObject45.toString(), "application/json");
  4129. JSONObject jsonObject46 = new JSONObject(result45);
  4130. JSONObject jsonObject47 = jsonObject46.getJSONObject("d");
  4131. int status47 = jsonObject47.getInt("Status");
  4132. if (status47 == 0) {
  4133. String result47 = jsonObject47.getString("Result");
  4134. JSONObject resultObj48 = new JSONObject(result47);
  4135. JSONArray resultArray48 = (JSONArray) resultObj48
  4136. .opt("PreProductCheck");
  4137. if (resultArray48 != null && resultArray48.length() > 0) {
  4138. JSONObject jobj49 = (JSONObject) resultArray48.opt(0);
  4139. int goodsLevelTypeId = jobj49.optInt("GOODSLEVELTYPEID");
  4140. int reworkProcedureId = jobj49.optInt("REWORKPROCEDUREID");
  4141. productionInfo.setGoodsLevelTypeId(goodsLevelTypeId);
  4142. productionInfo.setReworkProcedureId(reworkProcedureId);
  4143. }
  4144. }
  4145. //
  4146. String result50;
  4147. WebClient client = new WebClient();
  4148. JSONObject jsonObject50 = new JSONObject();
  4149. jsonObject50.put("accountCode", accountCode);
  4150. jsonObject50.put("userCode", checkCollectModify_userCode);
  4151. jsonObject50.put("userPassword", password);
  4152. jsonObject50.put("sessionKey", sessionkey);
  4153. result50 = client.doPost(
  4154. "http://" + ServerAddress_ip + ":" + ServerAddress_duankou
  4155. + Constants.GET_GOODS_GRADE,
  4156. jsonObject50.toString(), "application/json");
  4157. JSONObject jsonObject51 = new JSONObject(result50);
  4158. JSONObject jsonobject52 = jsonObject51.getJSONObject("d");
  4159. int status52 = jsonobject52.getInt("Status");
  4160. String message52 = jsonobject52.getString("Message");
  4161. if (status52 == 0) {
  4162. String json53 = jsonobject52.getString("Result");
  4163. JSONArray jsonArray54 = new JSONArray(json53);
  4164. listProductClassify = new ArrayList<ProductClassifyInfo>();
  4165. for (int i = 0; i < jsonArray54.length(); i++) {
  4166. classifyInfo = new ProductClassifyInfo();
  4167. JSONObject jsonObject55 = (JSONObject) jsonArray54.get(i);
  4168. classifyInfo.setGoodsLevelTypeID(
  4169. (int) jsonObject55.getDouble("GOODSLEVELTYPEID"));
  4170. classifyInfo.setDefectFlagName(
  4171. jsonObject55.getString("DEFECTFLAGNAME"));
  4172. classifyInfo
  4173. .setDefectFlagId((int) jsonObject55.getInt("DEFECTFLAGID"));
  4174. listProductClassify.add(i, classifyInfo);
  4175. }
  4176. } else {
  4177. Message m = new Message();
  4178. m.what = 0;
  4179. Bundle b = new Bundle();
  4180. b.putInt("status", status52);
  4181. b.putString("errorMsg", message52);
  4182. m.setData(b);
  4183. exceptionHandler.sendMessage(m);
  4184. return;
  4185. }
  4186. Message m = new Message();
  4187. m.what = 1;
  4188. Bundle b = new Bundle();
  4189. b.putSerializable("productclassifylist",
  4190. (Serializable) listProductClassify);
  4191. m.setData(b);
  4192. handler.sendMessage(m);
  4193. return;
  4194. } else {
  4195. Message m = new Message();
  4196. m.what = 0;
  4197. Bundle b = new Bundle();
  4198. b.putInt("status", status38);
  4199. b.putString("errorMsg", message38);
  4200. m.setData(b);
  4201. exceptionHandler.sendMessage(m);
  4202. return;
  4203. }
  4204. }
  4205. }
  4206. else {
  4207. client = null;
  4208. client = new WebClient();
  4209. JSONObject jsonhead = new JSONObject();
  4210. jsonhead.put("accountCode", accountCode);
  4211. jsonhead.put("userCode", checkCollectModify_userCode);
  4212. jsonhead.put("userPassword", password);
  4213. jsonhead.put("sessionKey", sessionkey);
  4214. jsonhead.put("BarCode", barcode);
  4215. String result11 = client.doPost(
  4216. "http://" + ServerAddress_ip + ":" + ServerAddress_duankou
  4217. + Constants.serverAction + "/GetProductionDataCheckID",
  4218. jsonhead.toString(), "application/json");
  4219. JSONObject jobj = new JSONObject(result11);
  4220. JSONObject jso = (JSONObject) jobj.opt("d");
  4221. int status11 = jso.optInt("Status");
  4222. String result1 = jso.optString("Result");
  4223. if (status11 == 0) {
  4224. if (!TextUtils.isEmpty(result1)) { // proId = 139 是补裂
  4225. JSONArray ja = new JSONArray(result1);
  4226. JSONObject jsonobj = (JSONObject) ja.get(0);
  4227. int procedureId = jsonobj.optInt("PROCEDUREID");
  4228. if (procedureId == proId) {
  4229. client = null;
  4230. client = new WebClient();
  4231. JSONObject jsonhead12 = new JSONObject();
  4232. jsonhead12.put("accountCode", accountCode);
  4233. jsonhead12.put("userCode", checkCollectModify_userCode);
  4234. jsonhead12.put("userPassword", password);
  4235. jsonhead12.put("sessionKey", sessionkey);
  4236. jsonhead12.put("productionDataID", productionDataId);
  4237. String Result = client.doPost(
  4238. "http://" + ServerAddress_ip + ":" + ServerAddress_duankou
  4239. + Constants.serverAction + "/GetProductionDataByID",
  4240. jsonhead12.toString(), "application/json");
  4241. JSONObject jobj12 = new JSONObject(Result);
  4242. JSONObject jso12 = (JSONObject) jobj12.opt("d");
  4243. int status12 = jso12.optInt("Status");
  4244. String message12 = jso12.optString("Message");
  4245. if (status12 == 0) {
  4246. if (productBugList != null && productBugList.size() > 0) {
  4247. productBugList.removeAll(productBugList);
  4248. }
  4249. operationFlag = "modify";
  4250. checkFlag = "3";
  4251. String res = jso12.optString("Result");
  4252. JSONObject je = new JSONObject(res);
  4253. JSONArray jarray = je.optJSONArray("PDAProductionData");
  4254. JSONObject jo1 = (JSONObject) jarray.get(0);
  4255. int goodsId = jo1.optInt("GoodsID");
  4256. String goodsCode = (String) jo1.optString("GoodsCode");
  4257. String goodsName = (String) jo1.optString("GoodsName");
  4258. int defectFlagId = jo1.optInt("DefectFlagID");
  4259. int reworkProcedureId = jo1.optInt("ReworkProcedureID");
  4260. int userId = (int) jo1.optInt("UserID");
  4261. String userCode = jo1.optString("UserCode");
  4262. String userName1 = jo1.optString("UserName");
  4263. specialRepairFlag = String.valueOf(jo1.optInt("SpecialRepairflag"));
  4264. specialRepairFlagName = jo1.optString("SpecialRepairFlagName");
  4265. refire = jo1.optInt("IsReFire");
  4266. refireName = jo1.optString("IsReFireName");
  4267. int goodsLevelTypeId = jo1.optInt("GoodsLevelTypeID");
  4268. String trademarkName = jo1.optString("LogoName");
  4269. String createTime = jo1.optString("CreateTime");
  4270. createTime = CommonUtil.commonDateConverter(createTime);
  4271. checkTime = jo1.optString("CheckTime");
  4272. remarks = jo1.optString("Remarks");
  4273. String leakName = jo1.optString("LeakFlag1Name");
  4274. String internalLeakName = jo1.optString("LeakFlag2Name");
  4275. String passBallName = jo1.optString("LeakFlag3Name");
  4276. productionInfo = new ProductionInfo();
  4277. productionInfo.setBarCode(barcode);
  4278. productionInfo.setGoodsId(goodsId);
  4279. productionInfo.setGoodsCode(goodsCode);
  4280. productionInfo.setGoodsName(goodsName);
  4281. productionInfo.setLeak(leakName);
  4282. productionInfo.setInternalLeak(internalLeakName);
  4283. productionInfo.setPassBall(passBallName);
  4284. productionInfo.setDefectFlagId(defectFlagId);
  4285. productionInfo.setOut_Grade(defectFlagId);
  4286. productionInfo.setReworkProcedureId(reworkProcedureId);
  4287. productionInfo.setCheckTime(checkTime);
  4288. productionInfo.setRemarks(remarks);
  4289. productionInfo.setUserId(userId);
  4290. productionInfo.setUserCode(userCode);
  4291. productionInfo.setUserName(userName1);
  4292. productionInfo.setGoodsLevelTypeId(goodsLevelTypeId);
  4293. productionInfo.setTrademarkName(trademarkName);
  4294. JSONArray defectArray = jo1.optJSONArray("PDADefects");
  4295. if (defectArray != null && defectArray.length() > 0) {
  4296. for (int i = 0; i < defectArray.length(); i++) {
  4297. ProductDefectInfo pdf = new ProductDefectInfo();
  4298. JSONObject job = (JSONObject) defectArray.get(i);
  4299. int defectId = job.optInt("DefectID");
  4300. String defectCode = job.optString("DefectCode");
  4301. String defectName = job.optString("DefectName");
  4302. DefectNo dn = new DefectNo();
  4303. dn.setDefectId(defectId);
  4304. dn.setDefectCode(defectCode);
  4305. dn.setDefectName(defectName);
  4306. pdf.setDefectNo(dn);
  4307. pdf.setDeleteFlag("server");
  4308. int defectPositionId = (int) job.optInt("DefectPositionID");
  4309. String defectPositionCode = job
  4310. .optString("DefectPositionCode");
  4311. String defectPositionName = job
  4312. .optString("DefectPositionName");
  4313. DefectLocation dl = new DefectLocation();
  4314. dl.setDefectPositionId(defectPositionId);
  4315. dl.setDefectPositionCode(defectPositionCode);
  4316. dl.setDefectPositionName(defectPositionName);
  4317. pdf.setDefectLocation(dl);
  4318. int defectProcedureId = job.optInt("DefectProcedureID");
  4319. String defectProcedureCode = job
  4320. .optString("DefectProcedureCode");
  4321. String defectProcedureName = job
  4322. .optString("DefectProcedureName");
  4323. ResponsibilityProcedure rp = new ResponsibilityProcedure();
  4324. rp.setDutyProcedureId(defectProcedureId);
  4325. rp.setDutyProcedureCode(defectProcedureCode);
  4326. rp.setDutyProcedureName(defectProcedureName);
  4327. pdf.setResponsibilityProcedure(rp);
  4328. DefectDeduction defectDeduction = new DefectDeduction();
  4329. double defectDeductionNum = job
  4330. .optDouble("DefectDeductionNum");
  4331. defectDeduction.setDefectDeductionNum(
  4332. String.valueOf(defectDeductionNum));
  4333. pdf.setDefectDeduction(defectDeduction);
  4334. String specialDefect = job.optString("SpecialDefect");
  4335. if (specialDefect.equals("0")) {
  4336. pdf.setSpecialDefectFlag(false);
  4337. } else {
  4338. pdf.setSpecialDefectFlag(true);
  4339. }
  4340. int defectUserId = (int) job.optInt("DefectUserID");
  4341. String defectUserCode = job.optString("DefectUserCode");
  4342. String defectUserName = job.optString("DefectUserName");
  4343. int ProductionDataId = (int) job
  4344. .optInt("DefectProductionDataID");
  4345. if (defectProcedureId > 0) {
  4346. WorkNo wn = new WorkNo();
  4347. wn.setUserId(defectUserId);
  4348. wn.setUserCode(defectUserCode);
  4349. wn.setUserName(defectUserName);
  4350. wn.setProductionDataId(ProductionDataId);
  4351. pdf.setWorkno(wn);
  4352. }
  4353. else {
  4354. WorkNo wn = new WorkNo();
  4355. wn.setUserId(defectUserId);
  4356. wn.setUserCode(defectUserCode);
  4357. wn.setUserName(defectUserName);
  4358. pdf.setWorkno(wn);
  4359. }
  4360. int jobs = job.optInt("Jobs");
  4361. String jobsText = job.optString("JobsText");
  4362. WorkType wt = new WorkType();
  4363. wt.setJobsID(jobs);
  4364. wt.setJobsName(jobsText);
  4365. pdf.setWorkType(wt);
  4366. int defectFineId = job.optInt("DefectFineID");
  4367. String defectFinesValue = job.optString("DefectFineValue");
  4368. DefectFines df = new DefectFines();
  4369. df.setDefectFinesId(defectFineId);
  4370. df.setDefectFinesName(defectFinesValue);
  4371. pdf.setDefectFines(df);
  4372. JSONArray defectResponsibles = job
  4373. .optJSONArray("PDADefectResponsibles");
  4374. List<DutyPerson> dutyPersonList = new ArrayList<DutyPerson>();
  4375. if (defectResponsibles != null
  4376. && defectResponsibles.length() > 0) {
  4377. for (int k = 0; k < defectResponsibles.length(); k++) {
  4378. JSONObject jo2 = (JSONObject) defectResponsibles
  4379. .get(k);
  4380. int staffId = jo2.optInt("StaffID");
  4381. String staffCode = jo2.optString("StaffCode");
  4382. String staffName = jo2.optString("StaffName");
  4383. int staffStatus = jo2.optInt("StaffStatus");
  4384. int uJobsId = jo2.optInt("UJobsID");
  4385. int sJobsId = jo2.optInt("SJobsID");
  4386. DutyPerson dp = new DutyPerson();
  4387. dp.setStaffId(staffId);
  4388. dp.setStaffCode(staffCode);
  4389. dp.setStaffName(staffName);
  4390. dp.setStaffStatus(staffStatus);
  4391. dp.setJobsId(uJobsId);
  4392. dp.setsJobsId(sJobsId);
  4393. dp.setUserId(defectUserId);
  4394. dp.setUserCode(defectUserCode);
  4395. dutyPersonList.add(dp);
  4396. }
  4397. }
  4398. pdf.setDutyPersonList(dutyPersonList);
  4399. List<ImagePath> imagePathList = new ArrayList<ImagePath>();
  4400. JSONArray imageJsonArray = job
  4401. .optJSONArray("PDADefectImageResults");
  4402. if (imageJsonArray != null && imageJsonArray.length() > 0) {
  4403. for (int n = 0; n < imageJsonArray.length(); n++) {
  4404. JSONObject imageJo = (JSONObject) imageJsonArray
  4405. .get(n);
  4406. String path = imageJo.optString("Imagepath");
  4407. ImagePath ip = new ImagePath();
  4408. ip.setServerPath(path);
  4409. ip.setFlag("remote");
  4410. String pPath1 = CommonUtil.getRootFilePath();
  4411. String fileDir1 = pPath1
  4412. + Constants.DATA_CACHE_PATH;
  4413. File file1 = new File(fileDir1);
  4414. if (!file1.exists()) {
  4415. file1.mkdir();
  4416. }
  4417. String s = Md5Utils.encode(path);
  4418. String imgName = s + ".jpg";
  4419. File f1 = new File(file1.getAbsolutePath(),
  4420. imgName);
  4421. if (!f1.exists()) {
  4422. try {
  4423. f1.createNewFile();
  4424. } catch (IOException e) {
  4425. e.printStackTrace();
  4426. }
  4427. }
  4428. ip.setLocalPath(f1.getAbsolutePath());
  4429. imagePathList.add(ip);
  4430. }
  4431. }
  4432. String checkTime = job.optString("CheckTime");
  4433. pdf.setCreateTime(checkTime);
  4434. pdf.setDefectImgPath(imagePathList);
  4435. productBugList.add(pdf);
  4436. }
  4437. }
  4438. client = null;
  4439. client = new WebClient();
  4440. JSONObject js6 = new JSONObject();
  4441. js6.put("accountCode", accountCode);
  4442. js6.put("userCode", checkCollectModify_userCode);
  4443. js6.put("userPassword", password);
  4444. js6.put("sessionKey", sessionkey);
  4445. js6.put("settingcode", "S_PM_009");
  4446. String result6 = client.doPost(
  4447. "http://" + ServerAddress_ip + ":" + ServerAddress_duankou
  4448. + Constants.serverAction
  4449. + "/GetSystemSettingDataByCode",
  4450. js6.toString(), "application/json");
  4451. JSONObject js10 = new JSONObject(result6);
  4452. JSONObject js11 = js10.optJSONObject("d");
  4453. int status13 = js11.optInt("Status");
  4454. String message13 = js11.optString("Message");
  4455. if (status13 == 0) {
  4456. String result13 = js11.optString("Result");
  4457. JSONArray jarray13 = new JSONArray(result13);
  4458. if (jarray13 != null && jarray13.length() > 0) {
  4459. JSONObject js12 = jarray13.optJSONObject(0);
  4460. String settingValueStr = js12.optString("SETTINGVALUE");
  4461. if (!TextUtils.isEmpty(settingValueStr)) {
  4462. int settingValue = Integer.parseInt(settingValueStr);
  4463. if (settingValue > 0) {
  4464. client = null;
  4465. client = new WebClient();
  4466. JSONObject js13 = new JSONObject();
  4467. js13.put("accountCode", accountCode);
  4468. js13.put("userCode", checkCollectModify_userCode);
  4469. js13.put("userPassword", password);
  4470. js13.put("sessionKey", sessionkey);
  4471. js13.put("orgTime", createTime);
  4472. js13.put("days", settingValue);
  4473. js13.put("settingCode", "S_PM_009");
  4474. String result14 = client.doPost(
  4475. "http://" + ServerAddress_ip + ":"
  4476. + ServerAddress_duankou
  4477. + Constants.serverAction
  4478. + "/BarcodeAllowCancel",
  4479. js13.toString(), "application/json");
  4480. JSONObject jobj13 = new JSONObject(result14);
  4481. JSONObject jobj14 = jobj13.optJSONObject("d");
  4482. int status14 = jobj14.optInt("Status");
  4483. String message14 = jobj14.optString("Message");
  4484. if (status14 != 0) {
  4485. overdueFlag = true;
  4486. Bundle b = new Bundle();
  4487. b.putString("message", message14);
  4488. b.putInt("status", status14);
  4489. Message m = new Message();
  4490. m.what = 5;
  4491. m.setData(b);
  4492. exceptionHandler.sendMessage(m);
  4493. }
  4494. }
  4495. }
  4496. }
  4497. } else {
  4498. Bundle b = new Bundle();
  4499. b.putString("message", message13);
  4500. b.putInt("status", status13);
  4501. Message m = new Message();
  4502. m.what = 5;
  4503. m.setData(b);
  4504. exceptionHandler.sendMessage(m);
  4505. }
  4506. } else {
  4507. Message m = new Message();
  4508. m.what = 5;
  4509. Bundle b = new Bundle();
  4510. b.putInt("status", status12);
  4511. b.putString("message", message12);
  4512. m.setData(b);
  4513. exceptionHandler.sendMessage(m);
  4514. return;
  4515. }
  4516. } else {
  4517. // 2023/3/14 不知道为什么有这个提示 31测漏气,3#试水,第一次进来提示,改成查询条码
  4518. // Message m = new Message();
  4519. // m.what = 2;
  4520. // Bundle b = new Bundle();
  4521. // b.putString("message", "该工序不可到达!请确认质量登记工序");
  4522. // m.setData(b);
  4523. // exceptionHandler.sendMessage(m);
  4524. // return;
  4525. operationFlag = "add";
  4526. checkFlag = "1";
  4527. JSONObject jsonObject28 = new JSONObject();
  4528. jsonObject28.put("accountCode", accountCode);
  4529. jsonObject28.put("userCode", checkCollectModify_userCode);
  4530. jsonObject28.put("userPassword", password);
  4531. jsonObject28.put("sessionKey", sessionkey);
  4532. jsonObject28.put("procedureID", proId);// 工序ID,菜单页面传过来的
  4533. jsonObject28.put("barcode", barcode);// 产品条码
  4534. jsonObject28.put("isNewCheck", true);// 用于区分新查询缺陷的checkbarcode
  4535. client = new WebClient();
  4536. String result28 = client.doPost(
  4537. "http://" + ServerAddress_ip + ":" + ServerAddress_duankou
  4538. + Constants.BAR_CODE_VALID,
  4539. jsonObject28.toString(), "application/json");
  4540. JSONObject jsonObject29 = new JSONObject(result28);
  4541. JSONObject jsonObject30 = jsonObject29.getJSONObject("d");
  4542. int status30 = jsonObject30.getInt("Status");
  4543. String message30 = jsonObject30.getString("Message");
  4544. if (status30 == 0) {
  4545. String result30 = jsonObject30.getString("Result");
  4546. JSONObject resultObjBarCodeTable = new JSONObject(result30);
  4547. JSONArray resultArrayBarCodeTable = (JSONArray) resultObjBarCodeTable
  4548. .opt("BarCodeTable");// 之前的
  4549. JSONArray resultArrayleakFlag4Table = (JSONArray) resultObjBarCodeTable
  4550. .opt("leakFlag4Table");// 养水 数据
  4551. JSONArray resultArrayleakFlag5Table = (JSONArray) resultObjBarCodeTable
  4552. .opt("leakFlag5Table");// 试水 数据
  4553. JSONArray resultArrayleakFlag6Table = (JSONArray) resultObjBarCodeTable
  4554. .opt("leakFlag6Table");// 补裂位置 数据
  4555. JSONArray resultArrayDefectTable = (JSONArray) resultObjBarCodeTable
  4556. .opt("DefectTable");// 缺陷信息
  4557. JSONObject jsonObject31 = (JSONObject) resultArrayBarCodeTable
  4558. .get(0);
  4559. String outErrMsg30 = jsonObject31.getString("out_errMsg");
  4560. String missFlag = jsonObject31.optString("out_missFlag");
  4561. if (!TextUtils.isEmpty(outErrMsg30)) {
  4562. if (missFlag.equals("0")) {
  4563. Message m = new Message();
  4564. Bundle b = new Bundle();
  4565. b.putInt("status", status30);
  4566. b.putString("errorMsg", outErrMsg30);
  4567. m.what = 0;
  4568. m.setData(b);
  4569. exceptionHandler.sendMessage(m);
  4570. return;
  4571. } else {
  4572. Message m1 = new Message();
  4573. Bundle b1 = new Bundle();
  4574. b1.putString("errmsg", outErrMsg30);
  4575. b1.putString("flag", missFlag);
  4576. m1.what = 4;
  4577. m1.setData(b1);
  4578. exceptionHandler.sendMessage(m1);
  4579. return;
  4580. }
  4581. } else {
  4582. produceCodeIsValid = true;
  4583. if (worknovalid) {
  4584. productionInfo = new ProductionInfo();
  4585. productionInfo.setUserId(Integer.parseInt(userID));
  4586. productionInfo.setUserCode(worknouserCode);
  4587. productionInfo.setUserName(workNoName);
  4588. }
  4589. // 2023/1/3 start 增加 缺陷信息赋值 z
  4590. if (resultArrayDefectTable != null
  4591. && resultArrayDefectTable.length() > 0) {
  4592. for (int i = 0; i < resultArrayDefectTable.length(); i++) {
  4593. ProductDefectInfo pdf = new ProductDefectInfo();
  4594. JSONObject job = (JSONObject) resultArrayDefectTable
  4595. .get(i);
  4596. int defectId = job.optInt("DEFECTID");
  4597. String defectCode = job.optString("DEFECTCODE");
  4598. String defectName = job.optString("DEFECTNAME");
  4599. DefectNo dn = new DefectNo();
  4600. dn.setDefectId(defectId);
  4601. dn.setDefectCode(defectCode);
  4602. dn.setDefectName(defectName);
  4603. pdf.setDefectNo(dn);
  4604. pdf.setDeleteFlag("server");
  4605. int defectPositionId = (int) job
  4606. .optInt("DEFECTPOSITIONID");
  4607. String defectPositionCode = job
  4608. .optString("DEFECTPOSITIONCODE");
  4609. String defectPositionName = job
  4610. .optString("DEFECTPOSITIONNAME");
  4611. DefectLocation dl = new DefectLocation();
  4612. dl.setDefectPositionId(defectPositionId);
  4613. dl.setDefectPositionCode(defectPositionCode);
  4614. dl.setDefectPositionName(defectPositionName);
  4615. pdf.setDefectLocation(dl);
  4616. int defectProcedureId = job.optInt("DEFECTPROCEDUREID");
  4617. String defectProcedureCode = job
  4618. .optString("DEFECTPROCEDURECODE");
  4619. String defectProcedureName = job
  4620. .optString("DEFECTPROCEDURENAME");
  4621. ResponsibilityProcedure rp = new ResponsibilityProcedure();
  4622. rp.setDutyProcedureId(defectProcedureId);
  4623. rp.setDutyProcedureCode(defectProcedureCode);
  4624. rp.setDutyProcedureName(defectProcedureName);
  4625. pdf.setResponsibilityProcedure(rp);
  4626. DefectDeduction defectDeduction = new DefectDeduction();
  4627. double defectDeductionNum = job
  4628. .optDouble("DEFECTDEDUCTIONNUM");
  4629. defectDeduction.setDefectDeductionNum(
  4630. String.valueOf(defectDeductionNum));
  4631. pdf.setDefectDeduction(defectDeduction);
  4632. String specialDefect = job.optString("SPECIALDEFECT");
  4633. if (specialDefect.equals("0")) {
  4634. pdf.setSpecialDefectFlag(false);
  4635. } else {
  4636. pdf.setSpecialDefectFlag(true);
  4637. }
  4638. int defectUserId = (int) job.optInt("DEFECTUSERID");
  4639. String defectUserCode = job.optString("DEFECTUSERCODE");
  4640. String defectUserName = job.optString("DEFECTUSERNAME");
  4641. int ProductionDataId = (int) job
  4642. .optInt("DEFECTPRODUCTIONDATAID");
  4643. if (defectProcedureId > 0) {
  4644. WorkNo wn = new WorkNo();
  4645. wn.setUserId(defectUserId);
  4646. wn.setUserCode(defectUserCode);
  4647. wn.setUserName(defectUserName);
  4648. wn.setProductionDataId(ProductionDataId);
  4649. pdf.setWorkno(wn);
  4650. }
  4651. else {
  4652. WorkNo wn = new WorkNo();
  4653. wn.setUserId(defectUserId);
  4654. wn.setUserCode(defectUserCode);
  4655. wn.setUserName(defectUserName);
  4656. pdf.setWorkno(wn);
  4657. }
  4658. int jobs = job.optInt("JOBS");
  4659. String jobsText = job.optString("JOBSTEXT");
  4660. WorkType wt = new WorkType();
  4661. wt.setJobsID(jobs);
  4662. wt.setJobsName(jobsText);
  4663. pdf.setWorkType(wt);
  4664. int defectFineId = job.optInt("DEFECTFINEID");
  4665. String defectFinesValue = job
  4666. .optString("DEFECTFINEVALUE");
  4667. DefectFines df = new DefectFines();
  4668. df.setDefectFinesId(defectFineId);
  4669. df.setDefectFinesName(defectFinesValue);
  4670. pdf.setDefectFines(df);
  4671. JSONArray defectResponsibles = job
  4672. .optJSONArray("PDADefectResponsibles");
  4673. List<DutyPerson> dutyPersonList = new ArrayList<DutyPerson>();
  4674. if (defectResponsibles != null
  4675. && defectResponsibles.length() > 0) {
  4676. for (int k = 0; k < defectResponsibles
  4677. .length(); k++) {
  4678. JSONObject jo2 = (JSONObject) defectResponsibles
  4679. .get(k);
  4680. int staffId = jo2.optInt("StaffID");
  4681. String staffCode = jo2.optString("StaffCode");
  4682. String staffName = jo2.optString("StaffName");
  4683. int staffStatus = jo2.optInt("StaffStatus");
  4684. int uJobsId = jo2.optInt("UJobsID");
  4685. int sJobsId = jo2.optInt("SJobsID");
  4686. DutyPerson dp = new DutyPerson();
  4687. dp.setStaffId(staffId);
  4688. dp.setStaffCode(staffCode);
  4689. dp.setStaffName(staffName);
  4690. dp.setStaffStatus(staffStatus);
  4691. dp.setJobsId(uJobsId);
  4692. dp.setsJobsId(sJobsId);
  4693. dp.setUserId(defectUserId);
  4694. dp.setUserCode(defectUserCode);
  4695. dutyPersonList.add(dp);
  4696. }
  4697. }
  4698. pdf.setDutyPersonList(dutyPersonList);
  4699. List<ImagePath> imagePathList = new ArrayList<ImagePath>();
  4700. JSONArray imageJsonArray = job
  4701. .optJSONArray("PDADefectImageResults");
  4702. if (imageJsonArray != null
  4703. && imageJsonArray.length() > 0) {
  4704. for (int n = 0; n < imageJsonArray.length(); n++) {
  4705. JSONObject imageJo = (JSONObject) imageJsonArray
  4706. .get(n);
  4707. String path = imageJo.optString("Imagepath");
  4708. ImagePath ip = new ImagePath();
  4709. ip.setServerPath(path);
  4710. ip.setFlag("remote");
  4711. String pPath1 = CommonUtil.getRootFilePath();
  4712. String fileDir1 = pPath1
  4713. + Constants.DATA_CACHE_PATH;
  4714. File file1 = new File(fileDir1);
  4715. if (!file1.exists()) {
  4716. file1.mkdir();
  4717. }
  4718. String s = Md5Utils.encode(path);
  4719. String imgName = s + ".jpg";
  4720. File f1 = new File(file1.getAbsolutePath(),
  4721. imgName);
  4722. if (!f1.exists()) {
  4723. try {
  4724. f1.createNewFile();
  4725. } catch (IOException e) {
  4726. e.printStackTrace();
  4727. }
  4728. }
  4729. ip.setLocalPath(f1.getAbsolutePath());
  4730. imagePathList.add(ip);
  4731. }
  4732. }
  4733. String checkTime = job.optString("CHECKTIME");
  4734. pdf.setCreateTime(checkTime);
  4735. pdf.setDefectImgPath(imagePathList);
  4736. productBugList.add(pdf);
  4737. }
  4738. Message messageproductBugList = new Message();
  4739. Bundle bproductBugList = new Bundle();
  4740. bproductBugList.putSerializable("productbuglist",
  4741. (Serializable) productBugList);
  4742. messageproductBugList.what = 10;
  4743. messageproductBugList.setData(bproductBugList);
  4744. handler.sendMessage(messageproductBugList);
  4745. }
  4746. // end z
  4747. if (resultArrayleakFlag4Table != null
  4748. && resultArrayleakFlag4Table.length() > 0) {
  4749. JSONObject jsonObjectleakFlag4Table = (JSONObject) resultArrayleakFlag4Table
  4750. .get(0);
  4751. productionInfo.setLeakFlag4TablePOSITION(
  4752. jsonObjectleakFlag4Table.optString("POSITION"));// 养水
  4753. // 不合格位置
  4754. }
  4755. if (resultArrayleakFlag5Table != null
  4756. && resultArrayleakFlag5Table.length() > 0) {
  4757. JSONObject jsonObjectleakFlag5Table = (JSONObject) resultArrayleakFlag5Table
  4758. .get(0);
  4759. productionInfo.setLeakFlag5TablePOSITION(
  4760. jsonObjectleakFlag5Table.optString("POSITION"));// 试水
  4761. // 不合格位置
  4762. }
  4763. if (resultArrayleakFlag6Table != null
  4764. && resultArrayleakFlag6Table.length() > 0) {
  4765. JSONObject jsonObjectleakFlag6Table = (JSONObject) resultArrayleakFlag6Table
  4766. .get(0);
  4767. productionInfo.setLeakFlag6TablePOSITION(
  4768. jsonObjectleakFlag6Table.optString("POSITION")); // 补裂位置
  4769. mCheckRepairCrackPositionDate = jsonObjectleakFlag6Table
  4770. .optString("POSITION");
  4771. }
  4772. out_goodsID = jsonObject31.getString("out_goodsID");
  4773. out_goodsCode = jsonObject31.getString("out_goodsCode");
  4774. out_goodsName = jsonObject31.getString("out_goodsName");
  4775. out_groutingUserCode = jsonObject31
  4776. .getString("out_groutingUserCode");
  4777. productionInfo.setBarCode(barcode);
  4778. productionInfo
  4779. .setOut_Grade(jsonObject31.optInt("DefectFlagID"));
  4780. productionInfo
  4781. .setOfflineFlag(jsonObject31.optString("offlineFlag")); // 下标划线
  4782. productionInfo.setOut_LeakFlag1Name(
  4783. jsonObject31.optString("out_LeakFlag1Name"));// 漏气
  4784. productionInfo.setOut_LeakFlag4Name(
  4785. jsonObject31.optString("out_LeakFlag4Name"));// 养水
  4786. productionInfo.setOut_LeakFlag5Name(
  4787. jsonObject31.optString("out_LeakFlag5Name"));// 试水
  4788. productionInfo.setOut_LeakFlag7Name(
  4789. jsonObject31.optString("out_LeakFlag7Name"));// 修磨
  4790. productionInfo.setGoodsId(Integer.parseInt(out_goodsID));
  4791. productionInfo.setGoodsCode(out_goodsCode);
  4792. productionInfo.setGoodsName(out_goodsName);
  4793. specialRepairFlag = jsonObject31
  4794. .optString("out_specialRepairFlag");
  4795. specialRepairFlagName = jsonObject31
  4796. .optString("out_specialRepairFlagName");
  4797. refire = Integer
  4798. .parseInt(jsonObject31.optString("out_isReFire"));
  4799. refireName = jsonObject31.optString("out_isReFireName");
  4800. String trademarkName = jsonObject31.optString("out_logoName");
  4801. productionInfo.setTrademarkName(trademarkName);
  4802. productionInfo
  4803. .setOut_Grade(jsonObject31.optInt("DefectFlagID"));
  4804. productionInfo
  4805. .setOfflineFlag(jsonObject31.optString("offlineFlag")); // 下标划线
  4806. String leakName = jsonObject31.optString("out_LeakFlag1Name");
  4807. productionInfo.setLeak(leakName);
  4808. String internalLeak = jsonObject31
  4809. .optString("out_LeakFlag2Name");
  4810. productionInfo.setInternalLeak(internalLeak);
  4811. String passBall = jsonObject31.optString("out_LeakFlag3Name");
  4812. productionInfo.setPassBall(passBall);
  4813. JSONObject jsonObject45 = new JSONObject();
  4814. jsonObject45.put("accountCode", accountCode);
  4815. jsonObject45.put("userCode", checkCollectModify_userCode);
  4816. jsonObject45.put("userPassword", password);
  4817. jsonObject45.put("sessionKey", sessionkey);
  4818. jsonObject45.put("barCode", barcode);// 产品条码
  4819. client = new WebClient();
  4820. String result45 = client.doPost(
  4821. "http://" + ServerAddress_ip + ":"
  4822. + ServerAddress_duankou
  4823. + Constants.CHECK_COLLECT_HAND_OVER_URL,
  4824. jsonObject45.toString(), "application/json");
  4825. JSONObject jsonObject46 = new JSONObject(result45);
  4826. JSONObject jsonObject47 = jsonObject46.getJSONObject("d");
  4827. int status47 = jsonObject47.getInt("Status");
  4828. if (status47 == 0) {
  4829. String result47 = jsonObject47.getString("Result");
  4830. JSONObject resultObj48 = new JSONObject(result47);
  4831. JSONArray resultArray48 = (JSONArray) resultObj48
  4832. .opt("PreProductCheck");
  4833. if (resultArray48 != null && resultArray48.length() > 0) {
  4834. JSONObject jobj49 = (JSONObject) resultArray48.opt(0);
  4835. int goodsLevelTypeId = jobj49
  4836. .optInt("GOODSLEVELTYPEID");
  4837. int reworkProcedureId = jobj49
  4838. .optInt("REWORKPROCEDUREID");
  4839. productionInfo.setGoodsLevelTypeId(goodsLevelTypeId);
  4840. productionInfo.setReworkProcedureId(reworkProcedureId);
  4841. }
  4842. }
  4843. }
  4844. }
  4845. }
  4846. }
  4847. }
  4848. else {
  4849. operationFlag = "add";
  4850. checkFlag = "1";
  4851. JSONObject jsonObject28 = new JSONObject();
  4852. jsonObject28.put("accountCode", accountCode);
  4853. jsonObject28.put("userCode", checkCollectModify_userCode);
  4854. jsonObject28.put("userPassword", password);
  4855. jsonObject28.put("sessionKey", sessionkey);
  4856. jsonObject28.put("procedureID", proId);// 工序ID,菜单页面传过来的
  4857. jsonObject28.put("barcode", barcode);// 产品条码
  4858. jsonObject28.put("isNewCheck", true);// 用于区分新查询缺陷的checkbarcode
  4859. client = new WebClient();
  4860. String result28 = client.doPost(
  4861. "http://" + ServerAddress_ip + ":" + ServerAddress_duankou
  4862. + Constants.BAR_CODE_VALID,
  4863. jsonObject28.toString(), "application/json");
  4864. JSONObject jsonObject29 = new JSONObject(result28);
  4865. JSONObject jsonObject30 = jsonObject29.getJSONObject("d");
  4866. int status30 = jsonObject30.getInt("Status");
  4867. String message30 = jsonObject30.getString("Message");
  4868. if (status30 == 0) {
  4869. String result30 = jsonObject30.getString("Result");
  4870. JSONObject resultObjBarCodeTable = new JSONObject(result30);
  4871. JSONArray resultArrayBarCodeTable = (JSONArray) resultObjBarCodeTable
  4872. .opt("BarCodeTable");// 之前的
  4873. JSONArray resultArrayleakFlag4Table = (JSONArray) resultObjBarCodeTable
  4874. .opt("leakFlag4Table");// 养水 数据
  4875. JSONArray resultArrayleakFlag5Table = (JSONArray) resultObjBarCodeTable
  4876. .opt("leakFlag5Table");// 试水 数据
  4877. JSONArray resultArrayleakFlag6Table = (JSONArray) resultObjBarCodeTable
  4878. .opt("leakFlag6Table");// 补裂 位置数据 传送门
  4879. JSONArray resultArrayDefectTable = (JSONArray) resultObjBarCodeTable
  4880. .opt("DefectTable");// 缺陷信息
  4881. JSONObject jsonObject31 = (JSONObject) resultArrayBarCodeTable.get(0);
  4882. String outErrMsg30 = jsonObject31.getString("out_errMsg");
  4883. String missFlag = jsonObject31.optString("out_missFlag");
  4884. if (!TextUtils.isEmpty(outErrMsg30)) {
  4885. if (missFlag.equals("0")) {
  4886. Message m = new Message();
  4887. Bundle b = new Bundle();
  4888. b.putInt("status", status30);
  4889. b.putString("errorMsg", outErrMsg30);
  4890. m.what = 0;
  4891. m.setData(b);
  4892. exceptionHandler.sendMessage(m);
  4893. return;
  4894. } else {
  4895. Message m1 = new Message();
  4896. Bundle b1 = new Bundle();
  4897. b1.putString("errmsg", outErrMsg30);
  4898. b1.putString("flag", missFlag);
  4899. m1.what = 4;
  4900. m1.setData(b1);
  4901. exceptionHandler.sendMessage(m1);
  4902. return;
  4903. }
  4904. } else {
  4905. produceCodeIsValid = true;
  4906. if (worknovalid) {
  4907. productionInfo = new ProductionInfo();
  4908. productionInfo.setUserId(Integer.parseInt(userID));
  4909. productionInfo.setUserCode(worknouserCode);
  4910. productionInfo.setUserName(workNoName);
  4911. }
  4912. // 2023/1/3 start 增加 缺陷信息赋值 z
  4913. if (resultArrayDefectTable != null
  4914. && resultArrayDefectTable.length() > 0) {
  4915. for (int i = 0; i < resultArrayDefectTable.length(); i++) {
  4916. ProductDefectInfo pdf = new ProductDefectInfo();
  4917. JSONObject job = (JSONObject) resultArrayDefectTable.get(i);
  4918. int defectId = job.optInt("DEFECTID");
  4919. String defectCode = job.optString("DEFECTCODE");
  4920. String defectName = job.optString("DEFECTNAME");
  4921. DefectNo dn = new DefectNo();
  4922. dn.setDefectId(defectId);
  4923. dn.setDefectCode(defectCode);
  4924. dn.setDefectName(defectName);
  4925. pdf.setDefectNo(dn);
  4926. pdf.setDeleteFlag("server");
  4927. int defectPositionId = (int) job.optInt("DEFECTPOSITIONID");
  4928. String defectPositionCode = job.optString("DEFECTPOSITIONCODE");
  4929. String defectPositionName = job.optString("DEFECTPOSITIONNAME");
  4930. DefectLocation dl = new DefectLocation();
  4931. dl.setDefectPositionId(defectPositionId);
  4932. dl.setDefectPositionCode(defectPositionCode);
  4933. dl.setDefectPositionName(defectPositionName);
  4934. pdf.setDefectLocation(dl);
  4935. int defectProcedureId = job.optInt("DEFECTPROCEDUREID");
  4936. String defectProcedureCode = job
  4937. .optString("DEFECTPROCEDURECODE");
  4938. String defectProcedureName = job
  4939. .optString("DEFECTPROCEDURENAME");
  4940. ResponsibilityProcedure rp = new ResponsibilityProcedure();
  4941. rp.setDutyProcedureId(defectProcedureId);
  4942. rp.setDutyProcedureCode(defectProcedureCode);
  4943. rp.setDutyProcedureName(defectProcedureName);
  4944. pdf.setResponsibilityProcedure(rp);
  4945. DefectDeduction defectDeduction = new DefectDeduction();
  4946. double defectDeductionNum = job.optDouble("DEFECTDEDUCTIONNUM");
  4947. defectDeduction.setDefectDeductionNum(
  4948. String.valueOf(defectDeductionNum));
  4949. pdf.setDefectDeduction(defectDeduction);
  4950. String specialDefect = job.optString("SPECIALDEFECT");
  4951. if (specialDefect.equals("0")) {
  4952. pdf.setSpecialDefectFlag(false);
  4953. } else {
  4954. pdf.setSpecialDefectFlag(true);
  4955. }
  4956. int defectUserId = (int) job.optInt("DEFECTUSERID");
  4957. String defectUserCode = job.optString("DEFECTUSERCODE");
  4958. String defectUserName = job.optString("DEFECTUSERNAME");
  4959. int ProductionDataId = (int) job
  4960. .optInt("DEFECTPRODUCTIONDATAID");
  4961. if (defectProcedureId > 0) {
  4962. WorkNo wn = new WorkNo();
  4963. wn.setUserId(defectUserId);
  4964. wn.setUserCode(defectUserCode);
  4965. wn.setUserName(defectUserName);
  4966. wn.setProductionDataId(ProductionDataId);
  4967. pdf.setWorkno(wn);
  4968. }
  4969. else {
  4970. WorkNo wn = new WorkNo();
  4971. wn.setUserId(defectUserId);
  4972. wn.setUserCode(defectUserCode);
  4973. wn.setUserName(defectUserName);
  4974. pdf.setWorkno(wn);
  4975. }
  4976. int jobs = job.optInt("JOBS");
  4977. String jobsText = job.optString("JOBSTEXT");
  4978. WorkType wt = new WorkType();
  4979. wt.setJobsID(jobs);
  4980. wt.setJobsName(jobsText);
  4981. pdf.setWorkType(wt);
  4982. int defectFineId = job.optInt("DEFECTFINEID");
  4983. String defectFinesValue = job.optString("DEFECTFINEVALUE");
  4984. DefectFines df = new DefectFines();
  4985. df.setDefectFinesId(defectFineId);
  4986. df.setDefectFinesName(defectFinesValue);
  4987. pdf.setDefectFines(df);
  4988. JSONArray defectResponsibles = job
  4989. .optJSONArray("PDADefectResponsibles");
  4990. List<DutyPerson> dutyPersonList = new ArrayList<DutyPerson>();
  4991. if (defectResponsibles != null
  4992. && defectResponsibles.length() > 0) {
  4993. for (int k = 0; k < defectResponsibles.length(); k++) {
  4994. JSONObject jo2 = (JSONObject) defectResponsibles.get(k);
  4995. int staffId = jo2.optInt("StaffID");
  4996. String staffCode = jo2.optString("StaffCode");
  4997. String staffName = jo2.optString("StaffName");
  4998. int staffStatus = jo2.optInt("StaffStatus");
  4999. int uJobsId = jo2.optInt("UJobsID");
  5000. int sJobsId = jo2.optInt("SJobsID");
  5001. DutyPerson dp = new DutyPerson();
  5002. dp.setStaffId(staffId);
  5003. dp.setStaffCode(staffCode);
  5004. dp.setStaffName(staffName);
  5005. dp.setStaffStatus(staffStatus);
  5006. dp.setJobsId(uJobsId);
  5007. dp.setsJobsId(sJobsId);
  5008. dp.setUserId(defectUserId);
  5009. dp.setUserCode(defectUserCode);
  5010. dutyPersonList.add(dp);
  5011. }
  5012. }
  5013. pdf.setDutyPersonList(dutyPersonList);
  5014. List<ImagePath> imagePathList = new ArrayList<ImagePath>();
  5015. JSONArray imageJsonArray = job
  5016. .optJSONArray("PDADefectImageResults");
  5017. if (imageJsonArray != null && imageJsonArray.length() > 0) {
  5018. for (int n = 0; n < imageJsonArray.length(); n++) {
  5019. JSONObject imageJo = (JSONObject) imageJsonArray.get(n);
  5020. String path = imageJo.optString("Imagepath");
  5021. ImagePath ip = new ImagePath();
  5022. ip.setServerPath(path);
  5023. ip.setFlag("remote");
  5024. String pPath1 = CommonUtil.getRootFilePath();
  5025. String fileDir1 = pPath1 + Constants.DATA_CACHE_PATH;
  5026. File file1 = new File(fileDir1);
  5027. if (!file1.exists()) {
  5028. file1.mkdir();
  5029. }
  5030. String s = Md5Utils.encode(path);
  5031. String imgName = s + ".jpg";
  5032. File f1 = new File(file1.getAbsolutePath(), imgName);
  5033. if (!f1.exists()) {
  5034. try {
  5035. f1.createNewFile();
  5036. } catch (IOException e) {
  5037. e.printStackTrace();
  5038. }
  5039. }
  5040. ip.setLocalPath(f1.getAbsolutePath());
  5041. imagePathList.add(ip);
  5042. }
  5043. }
  5044. String checkTime = job.optString("CHECKTIME");
  5045. pdf.setCreateTime(checkTime);
  5046. pdf.setDefectImgPath(imagePathList);
  5047. productBugList.add(pdf);
  5048. }
  5049. Message messageproductBugList = new Message();
  5050. Bundle bproductBugList = new Bundle();
  5051. bproductBugList.putSerializable("productbuglist",
  5052. (Serializable) productBugList);
  5053. messageproductBugList.what = 10;
  5054. messageproductBugList.setData(bproductBugList);
  5055. handler.sendMessage(messageproductBugList);
  5056. }
  5057. // end z
  5058. out_goodsID = jsonObject31.getString("out_goodsID");
  5059. out_goodsCode = jsonObject31.getString("out_goodsCode");
  5060. out_goodsName = jsonObject31.getString("out_goodsName");
  5061. out_groutingUserCode = jsonObject31.getString("out_groutingUserCode");
  5062. productionInfo.setOut_Grade(jsonObject31.optInt("DefectFlagID"));
  5063. productionInfo.setBarCode(barcode);
  5064. productionInfo.setOfflineFlag(jsonObject31.optString("offlineFlag")); // 下标划线
  5065. productionInfo.setOut_LeakFlag1Name(
  5066. jsonObject31.optString("out_LeakFlag1Name"));// 漏气
  5067. productionInfo.setOut_LeakFlag4Name(
  5068. jsonObject31.optString("out_LeakFlag4Name"));// 养水
  5069. productionInfo.setOut_LeakFlag5Name(
  5070. jsonObject31.optString("out_LeakFlag5Name"));// 试水
  5071. productionInfo.setOut_LeakFlag7Name(
  5072. jsonObject31.optString("out_LeakFlag7Name"));// 修磨
  5073. if (resultArrayleakFlag4Table != null
  5074. && resultArrayleakFlag4Table.length() > 0) {
  5075. JSONObject jsonObjectleakFlag4Table = (JSONObject) resultArrayleakFlag4Table
  5076. .get(0);
  5077. productionInfo.setLeakFlag4TablePOSITION(
  5078. jsonObjectleakFlag4Table.optString("POSITION"));// 养水 不合格位置
  5079. }
  5080. if (resultArrayleakFlag5Table != null
  5081. && resultArrayleakFlag5Table.length() > 0) {
  5082. JSONObject jsonObjectleakFlag5Table = (JSONObject) resultArrayleakFlag5Table
  5083. .get(0);
  5084. productionInfo.setLeakFlag5TablePOSITION(
  5085. jsonObjectleakFlag5Table.optString("POSITION"));// 试水 不合格位置
  5086. }
  5087. if (resultArrayleakFlag6Table != null
  5088. && resultArrayleakFlag6Table.length() > 0) {
  5089. JSONObject jsonObjectleakFlag6Table = (JSONObject) resultArrayleakFlag6Table
  5090. .get(0);
  5091. productionInfo.setLeakFlag6TablePOSITION(
  5092. jsonObjectleakFlag6Table.optString("POSITION")); // 补裂位置
  5093. mCheckRepairCrackPositionDate = jsonObjectleakFlag6Table
  5094. .optString("POSITION");
  5095. }
  5096. productionInfo.setGoodsId(Integer.parseInt(out_goodsID));
  5097. productionInfo.setGoodsCode(out_goodsCode);
  5098. productionInfo.setGoodsName(out_goodsName);
  5099. specialRepairFlag = jsonObject31.optString("out_specialRepairFlag");
  5100. specialRepairFlagName = jsonObject31
  5101. .optString("out_specialRepairFlagName");
  5102. if (jsonObject31.has("out_isReFire")) {
  5103. String out_isReFire = jsonObject31.optString("out_isReFire");
  5104. if (!jsonObject31.isNull("out_isReFire")) {
  5105. // 字段不为 null,可以进行相应的处理
  5106. refire = Integer
  5107. .parseInt(jsonObject31.optString("out_isReFire"));
  5108. } else {
  5109. // 字段为 null,可以进行相应的处理
  5110. }
  5111. }
  5112. refireName = jsonObject31.optString("out_isReFireName");
  5113. String trademarkName = jsonObject31.optString("out_logoName");
  5114. productionInfo.setTrademarkName(trademarkName);
  5115. productionInfo.setOut_Grade(jsonObject31.optInt("DefectFlagID"));
  5116. productionInfo.setOfflineFlag(jsonObject31.optString("offlineFlag")); // 下标划线
  5117. String leakName = jsonObject31.optString("out_LeakFlag1Name");
  5118. productionInfo.setLeak(leakName);
  5119. String internalLeak = jsonObject31.optString("out_LeakFlag2Name");
  5120. productionInfo.setInternalLeak(internalLeak);
  5121. String passBall = jsonObject31.optString("out_LeakFlag3Name");
  5122. productionInfo.setPassBall(passBall);
  5123. JSONObject jsonObject45 = new JSONObject();
  5124. jsonObject45.put("accountCode", accountCode);
  5125. jsonObject45.put("userCode", checkCollectModify_userCode);
  5126. jsonObject45.put("userPassword", password);
  5127. jsonObject45.put("sessionKey", sessionkey);
  5128. jsonObject45.put("barCode", barcode);// 产品条码
  5129. client = new WebClient();
  5130. String result45 = client.doPost(
  5131. "http://" + ServerAddress_ip + ":" + ServerAddress_duankou
  5132. + Constants.CHECK_COLLECT_HAND_OVER_URL,
  5133. jsonObject45.toString(), "application/json");
  5134. JSONObject jsonObject46 = new JSONObject(result45);
  5135. JSONObject jsonObject47 = jsonObject46.getJSONObject("d");
  5136. int status47 = jsonObject47.getInt("Status");
  5137. if (status47 == 0) {
  5138. String result47 = jsonObject47.getString("Result");
  5139. JSONObject resultObj48 = new JSONObject(result47);
  5140. JSONArray resultArray48 = (JSONArray) resultObj48
  5141. .opt("PreProductCheck");
  5142. if (resultArray48 != null && resultArray48.length() > 0) {
  5143. JSONObject jobj49 = (JSONObject) resultArray48.opt(0);
  5144. int goodsLevelTypeId = jobj49.optInt("GOODSLEVELTYPEID");
  5145. int reworkProcedureId = jobj49.optInt("REWORKPROCEDUREID");
  5146. productionInfo.setGoodsLevelTypeId(goodsLevelTypeId);
  5147. productionInfo.setReworkProcedureId(reworkProcedureId);
  5148. }
  5149. }
  5150. }
  5151. }
  5152. else {
  5153. Message m = new Message();
  5154. m.what = 0;
  5155. Bundle b = new Bundle();
  5156. b.putInt("status", status30);
  5157. b.putString("errorMsg", message30);
  5158. m.setData(b);
  5159. exceptionHandler.sendMessage(m);
  5160. return;
  5161. }
  5162. //
  5163. }
  5164. }
  5165. }
  5166. }
  5167. else {
  5168. JSONObject jsonObject30 = new JSONObject();
  5169. jsonObject30.put("accountCode", accountCode);
  5170. jsonObject30.put("userCode", checkCollectModify_userCode);
  5171. jsonObject30.put("userPassword", password);
  5172. jsonObject30.put("sessionKey", sessionkey);
  5173. jsonObject30.put("procedureID", proId);// 工序ID,菜单页面传过来的
  5174. jsonObject30.put("barcode", barcode);// 产品条码
  5175. jsonObject30.put("isNewCheck", true);// 用于区分新查询缺陷的checkbarcode
  5176. client = new WebClient();
  5177. String result30 = client.doPost("http://" + ServerAddress_ip + ":" + ServerAddress_duankou
  5178. + Constants.BAR_CODE_VALID, jsonObject30.toString(), "application/json");
  5179. JSONObject jsonObject31 = new JSONObject(result30);
  5180. JSONObject jsonObject32 = jsonObject31.getJSONObject("d");
  5181. int status32 = jsonObject32.getInt("Status");
  5182. String message32 = jsonObject32.getString("Message");
  5183. if (status32 == 0) { // 2022/12/29 王英杰 修改
  5184. String result32 = jsonObject32.getString("Result");
  5185. // 没有 过多的操作 所以 不做数据处理
  5186. JSONObject resultObjBarCodeTable = new JSONObject(result32);
  5187. JSONArray resultArrayBarCodeTable = (JSONArray) resultObjBarCodeTable
  5188. .opt("BarCodeTable");// 之前的
  5189. JSONObject resultObjleakFlag4Table = new JSONObject(result30);
  5190. JSONArray resultArrayleakFlag4Table = (JSONArray) resultObjleakFlag4Table
  5191. .opt("leakFlag4Table");// 养水 数据
  5192. JSONObject resultObjleakFlag5Table = new JSONObject(result30);
  5193. JSONArray resultArrayleakFlag5Table = (JSONArray) resultObjleakFlag5Table
  5194. .opt("leakFlag5Table");// 试水 数据
  5195. JSONArray resultArrayleakFlag6Table = (JSONArray) resultObjBarCodeTable
  5196. .opt("leakFlag6Table");// 补裂 位置数据 传送门
  5197. JSONObject jsonObject33 = (JSONObject) resultArrayBarCodeTable.get(0);
  5198. String outErrMsg33 = jsonObject33.getString("out_errMsg");
  5199. String missFlag = jsonObject33.optString("out_missFlag");
  5200. if (!TextUtils.isEmpty(outErrMsg33)) {
  5201. produceCodeIsValid = false;
  5202. if (missFlag.equals("0")) {
  5203. Message m = new Message();
  5204. Bundle b = new Bundle();
  5205. b.putInt("status", status32);
  5206. b.putString("errorMsg", outErrMsg33);
  5207. m.what = 0;
  5208. m.setData(b);
  5209. exceptionHandler.sendMessage(m);
  5210. return;
  5211. } else {
  5212. Message m1 = new Message();
  5213. Bundle b1 = new Bundle();
  5214. b1.putString("errmsg", outErrMsg33);
  5215. b1.putString("flag", missFlag);
  5216. m1.what = 6;
  5217. m1.setData(b1);
  5218. exceptionHandler.sendMessage(m1);
  5219. return;
  5220. }
  5221. }
  5222. }
  5223. else {
  5224. Message m = new Message();
  5225. m.what = 0;
  5226. Bundle b = new Bundle();
  5227. b.putInt("status", status32);
  5228. b.putString("errorMsg", message32);
  5229. m.setData(b);
  5230. exceptionHandler.sendMessage(m);
  5231. return;
  5232. }
  5233. }
  5234. }
  5235. else {
  5236. Message m = new Message();
  5237. m.what = 0;
  5238. Bundle b = new Bundle();
  5239. b.putInt("status", status);
  5240. b.putString("errorMsg", msg);
  5241. m.setData(b);
  5242. exceptionHandler.sendMessage(m);
  5243. return;
  5244. }
  5245. String result30;
  5246. WebClient client = new WebClient();
  5247. JSONObject jsonObject30 = new JSONObject();
  5248. jsonObject30.put("accountCode", accountCode);
  5249. jsonObject30.put("userCode", checkCollectModify_userCode);
  5250. jsonObject30.put("userPassword", password);
  5251. jsonObject30.put("sessionKey", sessionkey);
  5252. result30 = client.doPost(
  5253. "http://" + ServerAddress_ip + ":" + ServerAddress_duankou + Constants.GET_GOODS_GRADE,
  5254. jsonObject30.toString(), "application/json");
  5255. JSONObject jsonObject31 = new JSONObject(result30);
  5256. JSONObject jsonobject32 = jsonObject31.getJSONObject("d");
  5257. int status32 = jsonobject32.getInt("Status");
  5258. String message32 = jsonobject32.getString("Message");
  5259. if (status32 == 0) {
  5260. String json33 = jsonobject32.getString("Result");
  5261. JSONArray jsonArray34 = new JSONArray(json33);
  5262. listProductClassify = new ArrayList<ProductClassifyInfo>();
  5263. for (int i = 0; i < jsonArray34.length(); i++) {
  5264. classifyInfo = new ProductClassifyInfo();
  5265. JSONObject jsonObject35 = (JSONObject) jsonArray34.get(i);
  5266. classifyInfo.setGoodsLevelTypeID((int) jsonObject35.getDouble("GOODSLEVELTYPEID"));
  5267. classifyInfo.setDefectFlagName(jsonObject35.getString("DEFECTFLAGNAME"));
  5268. classifyInfo.setDefectFlagId((int) jsonObject35.getInt("DEFECTFLAGID"));
  5269. listProductClassify.add(i, classifyInfo);
  5270. }
  5271. } else {
  5272. Message m = new Message();
  5273. m.what = 0;
  5274. Bundle b = new Bundle();
  5275. b.putInt("status", status32);
  5276. b.putString("errorMsg", message32);
  5277. m.setData(b);
  5278. exceptionHandler.sendMessage(m);
  5279. return;
  5280. }
  5281. Message m = new Message();
  5282. m.what = 1;
  5283. Bundle b = new Bundle();
  5284. b.putSerializable("productbuglist", (Serializable) productBugList);
  5285. b.putSerializable("productclassifylist", (Serializable) listProductClassify);
  5286. m.setData(b);
  5287. handler.sendMessage(m);
  5288. return;
  5289. }
  5290. catch (Exception e) {
  5291. e.printStackTrace();
  5292. Message m = new Message();
  5293. m.what = 2;
  5294. Bundle b4 = new Bundle();
  5295. b4.putString("message", "网络连接异常");
  5296. m.setData(b4);
  5297. exceptionHandler.sendMessage(m);
  5298. return;
  5299. }
  5300. }
  5301. }
  5302. };
  5303. @SuppressWarnings("unchecked")
  5304. @Override
  5305. protected void onActivityResult(int requestCode, int resultCode, Intent data) {
  5306. if (requestCode == 101 && resultCode == 103) {
  5307. barcode.setEnabled(true);
  5308. barcode.setText("");
  5309. barcode.setFocusable(true);
  5310. barcode.setFocusableInTouchMode(true);
  5311. barcode.requestFocus();
  5312. barcode.findFocus();
  5313. barcode.setFilters(new InputFilter[] { new InputFilter() {
  5314. @Override
  5315. public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
  5316. int dend) {
  5317. return null;
  5318. }
  5319. } });
  5320. CommonUtil.BarcodeMaxLength(barcode, 50);
  5321. bugnotxt.setEnabled(true);
  5322. bugnotxt.setText("");
  5323. bugnotxt.setFocusable(true);
  5324. bugnotxt.setFocusableInTouchMode(true);
  5325. bugnotxt.setFilters(new InputFilter[] { new InputFilter() {
  5326. @Override
  5327. public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
  5328. int dend) {
  5329. return null;
  5330. }
  5331. } });
  5332. loctxt.setEnabled(true);
  5333. loctxt.setText("");
  5334. loctxt.setFocusable(true);
  5335. loctxt.setFocusableInTouchMode(true);
  5336. loctxt.setFilters(new InputFilter[] { new InputFilter() {
  5337. @Override
  5338. public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
  5339. int dend) {
  5340. return null;
  5341. }
  5342. } });
  5343. }
  5344. if (requestCode == 100 && resultCode == 101) {
  5345. try {
  5346. Bundle bundle = data.getExtras();
  5347. productBugList = (List<ProductDefectInfo>) bundle.getSerializable("productBugList");
  5348. if (null != productBugList && productBugList.size() > 0) {
  5349. save.setText("保存(" + productBugList.size() + ")");
  5350. bugnotxt.setText("");
  5351. bugnotxt.requestFocus();
  5352. loctxt.setText("");
  5353. bugnametxt.setText("");
  5354. mAdapter = new SwipeAdapter(CheckCollectModifyActivity.this, mListView.getRightViewWidth(),
  5355. ServerAddress_ip, ServerAddress_duankou, accountCode, checkCollectModify_userCode, password,
  5356. sessionkey, productBugList);
  5357. mListView.setAdapter(mAdapter);
  5358. mAdapter.setOnRightItemClickListener(new SwipeAdapter.onRightItemClickListener() {
  5359. @Override
  5360. public void onRightItemClick(View v, int position) {
  5361. if (!overdueFlag) {
  5362. ProductDefectInfo defectInfo = productBugList.get(position);
  5363. if (defectInfo.getDeleteFlag().equals("server")) {
  5364. deleteFlag = true;
  5365. }
  5366. mListView.deleteItem(mListView.getChildAt(position));
  5367. productBugList.remove(position);
  5368. save.setText("保存(" + productBugList.size() + ")");
  5369. mAdapter.notifyDataSetChanged();
  5370. }
  5371. }
  5372. });
  5373. }
  5374. } catch (Exception e) {
  5375. }
  5376. }
  5377. if (requestCode == 102 && resultCode == RESULT_OK) {
  5378. Bundle bundle = data.getExtras();
  5379. String scanResult = bundle.getString("result");
  5380. View rootview = this.getWindow().getDecorView();
  5381. EditText v = (EditText) rootview.findFocus();
  5382. int id = v.getId();
  5383. v.setText(scanResult);
  5384. v.setSelection(scanResult.length());
  5385. switch (id) {
  5386. case R.id.user_code:
  5387. String workno = v.getText().toString();
  5388. if (TextUtils.isEmpty(workno)) {
  5389. CustomToast.showToast(getApplicationContext(), "生产工号不能为空", 2000);
  5390. v.setFocusable(true);
  5391. v.requestFocus();
  5392. return;
  5393. }
  5394. ProcessDialogUtils.showProcessDialog(CheckCollectModifyActivity.this);
  5395. JSONObject sendJsonHead = new JSONObject();
  5396. try {
  5397. sendJsonHead.put("accountCode", accountCode);
  5398. sendJsonHead.put("userCode", checkCollectModify_userCode);
  5399. sendJsonHead.put("userPassword", password);
  5400. sendJsonHead.put("sessionKey", sessionkey);
  5401. // 生产工号检验请求数据
  5402. sendJsonHead.put("procedureID", proId);// 工序ID,菜单页面传过来的
  5403. sendJsonHead.put("procedureUserCode", workno);// 生产工号
  5404. worknoEdt.setEnabled(false);
  5405. worknoEdt.setFocusable(false);
  5406. worknoEdt.setFilters(new InputFilter[] { new InputFilter() {
  5407. @Override
  5408. public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
  5409. int dend) {
  5410. return source.length() < 1 ? dest.subSequence(dstart, dend) : "";
  5411. }
  5412. } });
  5413. barcode.setEnabled(false);
  5414. barcode.setFocusable(false);
  5415. barcode.setFilters(new InputFilter[] { new InputFilter() {
  5416. @Override
  5417. public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
  5418. int dend) {
  5419. return source.length() < 1 ? dest.subSequence(dstart, dend) : "";
  5420. }
  5421. } });
  5422. bugnotxt.setEnabled(false);
  5423. bugnotxt.setFocusable(false);
  5424. bugnotxt.setFilters(new InputFilter[] { new InputFilter() {
  5425. @Override
  5426. public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
  5427. int dend) {
  5428. return source.length() < 1 ? dest.subSequence(dstart, dend) : "";
  5429. }
  5430. } });
  5431. loctxt.setEnabled(false);
  5432. loctxt.setFocusable(false);
  5433. loctxt.setFilters(new InputFilter[] { new InputFilter() {
  5434. @Override
  5435. public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
  5436. int dend) {
  5437. return source.length() < 1 ? dest.subSequence(dstart, dend) : "";
  5438. }
  5439. } });
  5440. thread = new HandlerThread("userThread", 5);
  5441. thread.start();
  5442. mHandler = new Handler(thread.getLooper());
  5443. UserRunnable userRunnable = new UserRunnable(sendJsonHead);
  5444. mHandler.post(userRunnable);
  5445. } catch (JSONException e1) {
  5446. e1.printStackTrace();
  5447. }
  5448. break;
  5449. case R.id.bar_code:
  5450. String worknocode = worknoEdt.getText().toString();
  5451. if (TextUtils.isEmpty(worknocode)) {
  5452. // Toast.makeText(getApplicationContext(), "生产工号不能为空",
  5453. // Toast.LENGTH_SHORT).show();
  5454. CustomToast.showToast(getApplicationContext(), "生产工号不能为空", 2000);
  5455. worknoEdt.setEnabled(true);
  5456. worknoEdt.setFocusable(true);
  5457. worknoEdt.setFocusableInTouchMode(true);
  5458. worknoEdt.requestFocus();
  5459. worknoEdt.findFocus();
  5460. worknoEdt.setFilters(new InputFilter[] { new InputFilter() {
  5461. @Override
  5462. public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
  5463. int dend) {
  5464. return null;
  5465. }
  5466. } });
  5467. return;
  5468. } else {
  5469. if (!worknovalid) {
  5470. // Toast.makeText(getApplicationContext(), "请先验证生产工号",
  5471. // Toast.LENGTH_SHORT).show();
  5472. CustomToast.showToast(getApplicationContext(), "请先验证生产工号", 2000);
  5473. worknoEdt.setEnabled(true);
  5474. worknoEdt.setFocusable(true);
  5475. worknoEdt.setFocusableInTouchMode(true);
  5476. worknoEdt.requestFocus();
  5477. worknoEdt.findFocus();
  5478. worknoEdt.setFilters(new InputFilter[] { new InputFilter() {
  5479. @Override
  5480. public CharSequence filter(CharSequence source, int start, int end, Spanned dest,
  5481. int dstart, int dend) {
  5482. return null;
  5483. }
  5484. } });
  5485. return;
  5486. }
  5487. }
  5488. String code = v.getText().toString().trim();
  5489. ProcessDialogUtils.showProcessDialog(CheckCollectModifyActivity.this);
  5490. if (!CommonUtil.isNumber(code)) {
  5491. ProcessDialogUtils.closeProgressDilog();
  5492. // CommonUtil.showRepeatDialog(code+"格式不匹配",CheckCollectModifyActivity.this);
  5493. // Toast.makeText(getApplicationContext(), code + "格式不匹配",
  5494. // Toast.LENGTH_SHORT).show();
  5495. CustomToast.showToast(getApplicationContext(), code + "格式不匹配", 2000);
  5496. barcode.setEnabled(true);
  5497. barcode.setText("");
  5498. barcode.setFocusable(true);
  5499. barcode.setFocusableInTouchMode(true);
  5500. barcode.requestFocus();
  5501. barcode.findFocus();
  5502. barcode.setFilters(new InputFilter[] { new InputFilter() {
  5503. @Override
  5504. public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
  5505. int dend) {
  5506. return null;
  5507. }
  5508. } });
  5509. CommonUtil.BarcodeMaxLength(barcode, 50);
  5510. return;
  5511. }
  5512. productNumber.setText("");
  5513. productCode.setText("");
  5514. productName.setText("");
  5515. refineEdt.setText("");
  5516. bugnotxt.setText("");
  5517. bugnametxt.setText("");
  5518. loctxt.setText("");
  5519. trademarkNameTxt.setText("");
  5520. // repairEdt.setText("");
  5521. if (classifySpin.getSelectedItem() != null) {
  5522. listProductClassify.removeAll(listProductClassify);
  5523. if (adapterProductClassify != null) {
  5524. adapterProductClassify.notifyDataSetChanged();
  5525. }
  5526. }
  5527. if (gotoSpin.getSelectedItem() != null) {
  5528. listReWorkProcedure.clear();
  5529. if (adapterReWorkProcedure != null) {
  5530. adapterReWorkProcedure.notifyDataSetChanged();
  5531. }
  5532. }
  5533. if (productBugList != null && productBugList.size() > 0) {
  5534. productBugList.removeAll(productBugList);
  5535. if (mAdapter != null) {
  5536. mAdapter.notifyDataSetChanged();
  5537. }
  5538. save.setText("保存(" + productBugList.size() + ")");
  5539. }
  5540. barcode.setEnabled(false);
  5541. barcode.setFocusable(false);
  5542. barcode.setFilters(new InputFilter[] { new InputFilter() {
  5543. @Override
  5544. public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
  5545. int dend) {
  5546. return source.length() < 1 ? dest.subSequence(dstart, dend) : "";
  5547. }
  5548. } });
  5549. bugnotxt.setEnabled(false);
  5550. bugnotxt.setFocusable(false);
  5551. bugnotxt.setFocusableInTouchMode(false);
  5552. bugnotxt.setFilters(new InputFilter[] { new InputFilter() {
  5553. @Override
  5554. public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
  5555. int dend) {
  5556. return source.length() < 1 ? dest.subSequence(dstart, dend) : "";
  5557. }
  5558. } });
  5559. loctxt.setEnabled(false);
  5560. loctxt.setFocusable(false);
  5561. loctxt.setFocusableInTouchMode(false);
  5562. loctxt.setFilters(new InputFilter[] { new InputFilter() {
  5563. @Override
  5564. public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart,
  5565. int dend) {
  5566. return source.length() < 1 ? dest.subSequence(dstart, dend) : "";
  5567. }
  5568. } });
  5569. thread = new HandlerThread("barcodeThread", 5);
  5570. thread.start();
  5571. mHandler = new Handler(thread.getLooper());
  5572. BarcodeRunnable barcodeRunnable = new BarcodeRunnable(code, obj);
  5573. mHandler.post(barcodeRunnable);
  5574. break;
  5575. }
  5576. }
  5577. }
  5578. @Override
  5579. public void onBackPressed() {
  5580. if (productBugList != null && productBugList.size() > 0) {
  5581. productBugList.removeAll(productBugList);
  5582. }
  5583. super.onBackPressed();
  5584. }
  5585. @Override
  5586. public Resources getResources() {
  5587. Resources res = super.getResources();
  5588. Configuration config = new Configuration();
  5589. config.setToDefaults();
  5590. res.updateConfiguration(config, res.getDisplayMetrics());
  5591. return res;
  5592. }
  5593. @Override
  5594. public boolean onCreateOptionsMenu(Menu menu) {
  5595. // Inflate the menu; this adds items to the action bar if it is present.
  5596. getMenuInflater().inflate(R.menu.update_check_collect, menu);
  5597. return true;
  5598. }
  5599. }