| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900 |
- package com.jiaju.activity;
- import java.io.Serializable;
- import java.util.ArrayList;
- import java.util.HashMap;
- import java.util.List;
- import org.json.JSONArray;
- import org.json.JSONException;
- import org.json.JSONObject;
- import com.jiaju.adapter.CarBrandSpinnerAdapter;
- import com.jiaju.adapter.PieceListMessageAdapter;
- import com.jiaju.model.CarBrandModel;
- import com.jiaju.model.Piece;
- import com.jiaju.net.WebClient;
- import com.jiaju.utils.CommonUtil;
- import com.jiaju.utils.Constants;
- import com.jiaju.utils.CustomToast;
- import com.jiaju.utils.ProcessDialogUtils;
- import com.jiaju.utils.Removeduplicate;
- import com.jiaju.widget.CommonPopMenu;
- import android.app.Activity;
- import android.app.Notification;
- import android.content.Context;
- import android.content.Intent;
- import android.content.SharedPreferences;
- import android.content.res.Configuration;
- import android.content.res.Resources;
- import android.os.Bundle;
- import android.os.Handler;
- import android.os.HandlerThread;
- import android.os.Message;
- import android.text.Editable;
- import android.text.InputFilter;
- import android.text.InputType;
- import android.text.Spanned;
- import android.text.TextUtils;
- import android.text.TextWatcher;
- import android.view.Gravity;
- import android.view.KeyEvent;
- import android.view.MotionEvent;
- import android.view.View;
- import android.view.View.OnClickListener;
- import android.view.View.OnFocusChangeListener;
- import android.view.inputmethod.EditorInfo;
- import android.view.inputmethod.InputMethodManager;
- import android.widget.Button;
- import android.widget.EditText;
- import android.widget.ImageButton;
- import android.widget.ImageView;
- import android.widget.LinearLayout;
- import android.widget.ListView;
- import android.widget.PopupWindow;
- import android.widget.Spinner;
- import android.widget.TextView;
- import android.widget.TextView.OnEditorActionListener;
- import android.widget.Toast;
- //点数装板
- public class PieceActivity extends Activity {
- private EditText met; // 工号
- private EditText barcode; // 条码
- public Button bt2;// 确定按键
- private ImageButton btnCancle;// 返回
- private TextView backtext;
- private TextView title;// 标题
- private SharedPreferences sp;
- private String FILE = "user";// 用于保存SharedPreferences的文件
- private String accountCode = "";// 帐套
- private String userPassword = "";// 用户密码
- private String sessionKey = "";// sessionKey,每次登陆都会改变
- private String ServerAddress_ip, ServerAddress_duankou;
- private JSONObject jsonObject;
- private PieceListMessageAdapter pieceAdapter = null;
- private WebClient client;
- private int proId;// 工序I
- public static boolean isSlide = false;
- private String code = "";
- private int collectType;// 采集类型:1-集中 2-单点
- private ListView list1;
- private Boolean produceCodeIsValid = false;// 条码是否验证
- private Boolean userCodeIsValid = false;// 生产工号是否验证
- private String piece_userCode;
- // 生产工号验证返回字段
- private String userID1 = "";// 条码对应的产品ID
- private String userCode1 = "";// 生产工号Code
- private String userName1 = "";// 生产工号Name
- private String outErrMsg = "";
- // 服务器返回_生产条码检验
- private String out_goodsID = "";// 条码对应的产品ID
- private String out_goodsCode = "";// 条码对应的产品Code
- private String out_goodsName = "";// 条码对应的产品Name
- private ArrayList<HashMap<String, Object>> listItem = new ArrayList<HashMap<String, Object>>();
- private Piece piece = null;
- private String procedureName;
- public static List<Piece> piecelist = null;
- private HandlerThread thread;
- private Handler mHandler = null;
- private int nodeType;
- private ImageView productRecord;
- private LinearLayout parent;
- private PopupWindow mPopupWindow; // 弹出框
- private Object obj = new Object();
- private Handler upperH = new Handler();
- private String userUpper;
- private Handler barcodeUpperH = new Handler();
- private String barcodeUpper;
- //限制同商标
- private String spm_011;
- //限制同型号
- private String spm_012;
- //限制每板装板数量
- private String spm_013;
- // 最大装车数量
- private int plateNum;
-
- private int isGlazeChange;
-
- private String NewWaterEfficiencyLabelActivity;//水效标识flag
-
- private String NewWaterBarcode=""; //水效标识的barcode
- private LinearLayout baozhuang; // 版码布局
- private Spinner trademarksource;
- private List<CarBrandModel> carBrandList;
- private CarBrandSpinnerAdapter carBrandAdapter;
- private int luociproId = 63;// 裸瓷点数装板 工序id 正式库要修改。。。。。。。。。。。。。。。。。。。。。
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_pieces);
- piecelist = new ArrayList<Piece>();
- initview();
- ////CommonUtil.BarcodeMaxLength(barcode, 50);;
- alllistener();
- Intent intent = getIntent();
- Bundle bundle = intent.getExtras();
- proId = bundle.getInt("procedureId");
- nodeType=bundle.getInt("nodeType");
- isGlazeChange=bundle.getInt("isGlazeChange");
- NewWaterEfficiencyLabelActivity=bundle.getString("NewWaterEfficiencyLabelActivity");
- NewWaterBarcode=bundle.getString("NewWaterBarcode");
-
- collectType = bundle.getInt("collectType");
- sp = getSharedPreferences(FILE, MODE_PRIVATE);
- procedureName = bundle.getString("procedureName");
- title.setText(bundle.getString("procedureName"));// 设置标题
- // 获得账户信息;
- accountCode = sp.getString("AccountCode", "");
- piece_userCode = sp.getString("UserCode", "");
- userPassword = sp.getString("UserPassword", "");
- sessionKey = sp.getString("SessionKey", "");
- // 获取服务ip和端口号
- ServerAddress_ip = sp.getString("ServerAddress_ip", "");
- ServerAddress_duankou = sp.getString("ServerAddress_duankou", "");
- // 裸瓷点数装板 工序id
- if(proId==luociproId) {
- baozhuang.setVisibility(View.VISIBLE);
- //获取装板数量
- getsum();
- }
- switch (collectType) {
- case 2:// 单点采集
- met.setEnabled(false);
- met.setFocusable(false);
- met.setText(piece_userCode);
- met.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start,
- int end, Spanned dest, int dstart, int dend) {
- return source.length() < 1 ? dest.subSequence(dstart, dend)
- : "";
- }
- } });
- bt2.setVisibility(View.INVISIBLE);
- barcode.setFocusable(true);
- barcode.requestFocus();
- barcode.findFocus();
- ProcessDialogUtils.showProcessDialog(PieceActivity.this);
- thread = null;
- thread = new HandlerThread("userHandlerThread", 5);
- thread.start();
- mHandler = null;
- mHandler = new Handler(thread.getLooper());
- UserRunnable userRunnable = new UserRunnable();
- mHandler.post(userRunnable);
- break;
- case 1:// 集中采集
- met.setEnabled(true);
- met.setFocusable(true);
- met.requestFocus();
- met.findFocus();
- met.setSelectAllOnFocus(true);
- break;
- }
- }
- /**
- * 如果是从水效标识界面过来的 会调用这个方法
- */
- private void searchBarCode(String etcode) {
-
- String workno = met.getText().toString();
- if (TextUtils.isEmpty(workno)) {
- // Toast.makeText(getApplicationContext(), "生产工号不能为空",
- // Toast.LENGTH_SHORT).show();
- CustomToast.showToast(getApplicationContext(),
- "生产工号不能为空", 2000);
- met.setEnabled(true);
- met.setFocusable(true);
- met.setFocusableInTouchMode(true);
- met.requestFocus();
- met.findFocus();
- met.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source,
- int start, int end, Spanned dest,
- int dstart, int dend) {
- return null;
- }
- } });
- return;
- } else {
-
- if (!userCodeIsValid) {
- ProcessDialogUtils.closeProgressDilog();
- CustomToast.showToast(getApplicationContext(),
- "请在生产工号输入框内按回车键验证生产工号", 2000);
- met.setEnabled(true);
- met.setFocusable(true);
- met.setFocusableInTouchMode(true);
- met.requestFocus();
- met.findFocus();
- met.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source,
- int start, int end, Spanned dest,
- int dstart, int dend) {
- return null;
- }
- } });
- return;
- }
- ProcessDialogUtils
- .showProcessDialog(PieceActivity.this);
- barcode.setEnabled(false);
- barcode.setFocusable(false);
- barcode.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source,
- int start, int end, Spanned dest,
- int dstart, int dend) {
- return source.length() < 1 ? dest.subSequence(
- dstart, dend) : "";
- }
- } });
- // if (!CommonUtil.isNumber(etcode)) {
- // ProcessDialogUtils.closeProgressDilog();
- // CommonUtil.setDefault(Notification.DEFAULT_VIBRATE,
- // getApplicationContext());
- // //
- // CommonUtil.showRepeatDialog(code+"格式不匹配",PieceActivity.this);
- // CustomToast.showToast(getApplicationContext(),
- // etcode + "格式不匹配", 1000);
- // barcode.setEnabled(true);
- // barcode.setText("");
- // barcode.setFocusable(true);
- // barcode.setFocusableInTouchMode(true);
- // barcode.requestFocus();
- // barcode.findFocus();
- // barcode.setFilters(new InputFilter[] { new
- // InputFilter() {
- // @Override
- // public CharSequence filter(CharSequence source,
- // int start, int end, Spanned dest,
- // int dstart, int dend) {
- //
- // return null;
- // }
- // } });
- // CommonUtil.BarcodeMaxLength(barcode,50);
- // return;
- // }
- if (collectType == 2) {
- if (piecelist != null && piecelist.size() > 0) {
- piecelist.removeAll(piecelist);
- if (pieceAdapter != null) {
- pieceAdapter.notifyDataSetChanged();
- }
- }
- }
- if(nodeType!=3) {
- if (piecelist.size() > 0) {
- boolean b = Removeduplicate.removeBarCode(etcode,
- piecelist);
- if (b) {
- ProcessDialogUtils.closeProgressDilog();
- barcode.setEnabled(true);
- barcode.setText("");
- barcode.setFocusable(true);
- barcode.setFocusableInTouchMode(true);
- barcode.requestFocus();
- barcode.findFocus();
- barcode.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(
- CharSequence source, int start,
- int end, Spanned dest, int dstart,
- int dend) {
- return null;
- }
- } });
- //CommonUtil.BarcodeMaxLength(barcode, 50);;
- CommonUtil.setDefault(
- Notification.DEFAULT_VIBRATE,
- getApplicationContext());
- if (collectType == 2) {
- CommonUtil.showRepeatDialog("条码" + etcode
- + "重复", PieceActivity.this);
- } else if (collectType == 1) {
- // Toast.makeText(getApplicationContext(),"条码"+etcode+"重复",Toast.LENGTH_SHORT).show();
- CustomToast.showToast(
- getApplicationContext(), "条码"
- + etcode + "重复", 2000);
- }
- ProcessDialogUtils.closeProgressDilog();
- return;
- }
- }
- }
-
- if(collectType==1&&nodeType==3 &&proId!=luociproId) {
- if(plateNum>0&&piecelist.size()==plateNum) {
- CommonUtil.setDefault(Notification.DEFAULT_VIBRATE,
- getApplicationContext());
- CommonUtil.showBarCodeAlertDialog(0, "超过装板数量【"+plateNum+"】",
- PieceActivity.this, barcode, null, null);
- ProcessDialogUtils.closeProgressDilog();
-
- return;
- }
- }
-
- if (collectType == 1 && nodeType == 3 &&proId==luociproId) {
- CarBrandModel carbrandModel = (CarBrandModel) trademarksource.getSelectedItem();
-
- String zhuangbanshuliang=carbrandModel.getCarBrandName();
-
- int num=Integer.parseInt(zhuangbanshuliang);
- if( piecelist.size()>num-1) {
- CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, getApplicationContext());
- CommonUtil.showBarCodeAlertDialog(0, "超过装板数量【" + num + "】", PieceActivity.this,
- barcode, null, null);
- ProcessDialogUtils.closeProgressDilog();
- return;
- }
-
-
- }
-
- thread = null;
- thread = new HandlerThread("BarCoderThread", 5);
- thread.start();
- mHandler = null;
- mHandler = new Handler(thread.getLooper());
- BarcodeRunnable barcodeRunnable = new BarcodeRunnable(
- etcode, obj);
- mHandler.post(barcodeRunnable);
- }
- }
- private void initview() {
- title = (TextView) findViewById(R.id.title);
- View head=View.inflate(this,R.layout.piece_head_view,null);
- btnCancle = (ImageButton) findViewById(R.id.left_img);
- barcode = (EditText) head.findViewById(R.id.good_tm);
- barcode.setRawInputType(InputType.TYPE_CLASS_NUMBER);
- met = (EditText)head.findViewById(R.id.good_code);
- bt2 = (Button) findViewById(R.id.btnsure);
- backtext = (TextView) findViewById(R.id.back);
- list1 = (ListView) this.findViewById(R.id.message_listview);
- list1.addHeaderView(head);
- pieceAdapter = new PieceListMessageAdapter(PieceActivity.this,piecelist);
- list1.setAdapter(pieceAdapter);
- parent = (LinearLayout) findViewById(R.id.parentRel);
- productRecord = (ImageView) findViewById(R.id.search);
- productRecord.setVisibility(View.VISIBLE);
- trademarksource = (Spinner) head.findViewById(R.id.trademarksource);
- baozhuang = (LinearLayout) head.findViewById(R.id.baozhuang);// 板码布局
- }
-
- private void alllistener() {
- productRecord.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- int height = parent.getHeight() - v.getHeight();
- CommonPopMenu recordPopMenu = new CommonPopMenu(
- PieceActivity.this, height);
- mPopupWindow = recordPopMenu.getMenu();
- if (mPopupWindow == null) {
- return;
- }
- if (mPopupWindow.isShowing()) {
- mPopupWindow.dismiss();
- return;
- }
- mPopupWindow.showAtLocation(parent, Gravity.BOTTOM, 0, 0);
- LinearLayout barcodeLay = (LinearLayout) recordPopMenu.menu
- .findViewById(R.id.barcodechangelay);
- ImageView scanImg = (ImageView) recordPopMenu.menu
- .findViewById(R.id.scanimg);
- TextView scanTitle = (TextView) recordPopMenu.menu
- .findViewById(R.id.scantitle);
- scanTitle.setText("扫一扫");
- scanImg.setBackgroundResource(R.drawable.scan);
- LinearLayout statisticsLay = (LinearLayout) recordPopMenu.menu
- .findViewById(R.id.statisticslay);
- statisticsLay.setVisibility(View.VISIBLE);
- ImageView statisticsImg = (ImageView) recordPopMenu.menu
- .findViewById(R.id.statisticsimg);
- statisticsImg.setBackgroundResource(R.drawable.tongji9);
- TextView statisticsTitle = (TextView) recordPopMenu.menu
- .findViewById(R.id.statisticstitle);
- statisticsTitle.setText("采集统计");
- statisticsLay.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- Intent intent = new Intent();
- Bundle bundle = new Bundle();
- bundle.putInt("procedureId", proId);
- bundle.putInt("collectType", collectType);
- bundle.putString("procedureName", procedureName);
- intent.putExtras(bundle);
- intent.setClass(PieceActivity.this,
- CollectionActivity.class);
- startActivity(intent);
- if (mPopupWindow.isShowing()) {
- mPopupWindow.dismiss();
- }
- }
- });
- barcodeLay.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- Intent openCameraIntent = new Intent(
- PieceActivity.this, CaptureActivity.class);
- startActivityForResult(openCameraIntent, 102);
- if (mPopupWindow.isShowing()) {
- mPopupWindow.dismiss();
- }
- }
- });
- }
- });
- backtext.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- finish();
- }
- });
- btnCancle.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- finish();
- }
- });
- // 保存确定按钮触发事件
- bt2.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- if (collectType == 1) {
- String workno = met.getText().toString();
- if (TextUtils.isEmpty(workno)) {
-
- CustomToast.showToast(getApplicationContext(),
- "生产工号不能为空", 2000);
- met.setEnabled(true);
- met.setFocusable(true);
- met.setFocusableInTouchMode(true);
- met.requestFocus();
- met.findFocus();
- met.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source,
- int start, int end, Spanned dest,
- int dstart, int dend) {
- return null;
- }
- } });
- return;
- } else {
- if (!userCodeIsValid) {
- CustomToast.showToast(getApplicationContext(),
- "请在生产工号输入框内按回车键验证生产工号", 2000);
- met.setEnabled(true);
- met.setFocusable(true);
- met.setFocusableInTouchMode(true);
- met.requestFocus();
- met.findFocus();
- met.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source,
- int start, int end, Spanned dest,
- int dstart, int dend) {
- return null;
- }
- } });
- return;
- }
- }
- if (piecelist.size() == 0) {
-
- CustomToast.showToast(getApplicationContext(),
- "没有可提交的明细信息", 2000);
- return;
- }
- if(collectType==1&&nodeType==3 && proId!=luociproId) {
- if(plateNum>0&&piecelist.size()!=plateNum) {
- CommonUtil.setDefault(Notification.DEFAULT_VIBRATE,
- getApplicationContext());
-
- CommonUtil.showBarCodeAlertDialog(0, "未达到装板数量【"+plateNum+"】",
- PieceActivity.this, barcode, null, null);
- return;
- }
- }
-
- if (collectType == 1 && nodeType == 3 &&proId==luociproId) {
- CarBrandModel carbrandModel = (CarBrandModel) trademarksource.getSelectedItem();
-
- String zhuangbanshuliang=carbrandModel.getCarBrandName();
-
- int num=Integer.parseInt(zhuangbanshuliang);
- if( piecelist.size()>num) {
- CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, getApplicationContext());
- CommonUtil.showBarCodeAlertDialog(0, "超过装板数量【" + num + "】", PieceActivity.this,
- barcode, null, null);
- ProcessDialogUtils.closeProgressDilog();
- return;
- }
- else if( piecelist.size()<num){
- CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, getApplicationContext());
- CommonUtil.showBarCodeAlertDialog(0, "未达到装板数量【" + num + "】", PieceActivity.this,
- barcode, null, null);
- ProcessDialogUtils.closeProgressDilog();
- return;
- }
-
- }
-
-
- if(isGlazeChange==1)
- {
- Intent intent=new Intent();
- intent.setClass(PieceActivity.this, GlazePieceSetActivity.class);
- Bundle b=new Bundle();
- b.putInt("procedureId",proId);
- intent.putExtras(b);
- startActivityForResult(intent,100);
-
- }
- else
- {
- ProcessDialogUtils.showProcessDialog(PieceActivity.this);
- if (bt2.isEnabled()) {
- bt2.setEnabled(false);
- getDataSaveBarCode();
- }
- }
- }
- }
- });
- met.setOnFocusChangeListener(new OnFocusChangeListener() {
- @Override
- public void onFocusChange(View v, boolean hasFocus) {
- EditText e = (EditText) v;
- String woCode = e.getText().toString();
- if (!woCode.contains("\n")) {
- if (!hasFocus) {
- if (!TextUtils.isEmpty(woCode)) {
- woCode = woCode.trim();
- met.setFocusable(false);
- met.setEnabled(false);
- met.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source,
- int start, int end, Spanned dest,
- int dstart, int dend) {
- return source.length() < 1 ? dest
- .subSequence(dstart, dend) : "";
- }
- } });
- barcode.setEnabled(false);
- barcode.setFocusable(false);
- barcode.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source,
- int start, int end, Spanned dest,
- int dstart, int dend) {
- return source.length() < 1 ? dest
- .subSequence(dstart, dend) : "";
- }
- } });
- ProcessDialogUtils
- .showProcessDialog(PieceActivity.this);
- thread = null;
- thread = new HandlerThread("userHandlerThread", 5);
- thread.start();
- mHandler = null;
- mHandler = new Handler(thread.getLooper());
- UserRunnable userRunnable = new UserRunnable(woCode);
- mHandler.post(userRunnable);
- }
- }
- }
- }
- });
- met.addTextChangedListener(new TextWatcher() {
- @Override
- public void afterTextChanged(Editable arg0) {
- if (met.getText().toString().contains("\n")) {
- String woCode = met.getText().toString().trim()
- .replaceAll("\\n", "");
-
- met.setFocusable(false);
- met.setEnabled(false);
- met.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source,
- int start, int end, Spanned dest, int dstart,
- int dend) {
- return source.length() < 1 ? dest.subSequence(
- dstart, dend) : "";
- }
- } });
- barcode.setEnabled(false);
- barcode.setFocusable(false);
- barcode.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source,
- int start, int end, Spanned dest, int dstart,
- int dend) {
- return source.length() < 1 ? dest.subSequence(
- dstart, dend) : "";
- }
- } });
- ProcessDialogUtils.showProcessDialog(PieceActivity.this);
- thread = null;
- thread = new HandlerThread("userHandlerThread", 5);
- thread.start();
- mHandler = null;
- mHandler = new Handler(thread.getLooper());
- UserRunnable userRunnable = new UserRunnable(woCode);
- mHandler.post(userRunnable);
- }
- }
- @Override
- public void beforeTextChanged(CharSequence s, int start, int count,
- int after) {
- }
- @Override
- public void onTextChanged(CharSequence s, int start, int before,
- int count) {
- userUpper = met.getText().toString();
- // 判断输入的文字是否是小写
- for (int i = 0; i < userUpper.length(); i++) {
- if (userUpper.charAt(i) - 0 >= 97
- && userUpper.charAt(i) - 0 <= 122) {
- upperH.postDelayed(UpperCase, 300);
- }
- }
- }
- });
- barcode.addTextChangedListener(new TextWatcher() {
- @Override
- public void afterTextChanged(Editable arg0) {
- if (barcode.getText().toString().contains("\n")) {
- String etcode = barcode.getText().toString().trim()
- .replaceAll("\\n", "").replaceAll("\n", "");
- if(etcode.substring(0, 4).equals("http"))
- {
- String[] parts = etcode.split("-", 2);
- if (parts.length == 2) {
- etcode = parts[1];
- }
- }
- String workno = met.getText().toString();
- if (TextUtils.isEmpty(workno)) {
- // Toast.makeText(getApplicationContext(), "生产工号不能为空",
- // Toast.LENGTH_SHORT).show();
- CustomToast.showToast(getApplicationContext(),
- "生产工号不能为空", 2000);
- met.setEnabled(true);
- met.setFocusable(true);
- met.setFocusableInTouchMode(true);
- met.requestFocus();
- met.findFocus();
- met.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source,
- int start, int end, Spanned dest,
- int dstart, int dend) {
- return null;
- }
- } });
- return;
- } else {
-
- if (!userCodeIsValid) {
- ProcessDialogUtils.closeProgressDilog();
- CustomToast.showToast(getApplicationContext(),
- "请在生产工号输入框内按回车键验证生产工号", 2000);
- met.setEnabled(true);
- met.setFocusable(true);
- met.setFocusableInTouchMode(true);
- met.requestFocus();
- met.findFocus();
- met.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source,
- int start, int end, Spanned dest,
- int dstart, int dend) {
- return null;
- }
- } });
- return;
- }
- ProcessDialogUtils
- .showProcessDialog(PieceActivity.this);
- barcode.setEnabled(false);
- barcode.setFocusable(false);
- barcode.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source,
- int start, int end, Spanned dest,
- int dstart, int dend) {
- return source.length() < 1 ? dest.subSequence(
- dstart, dend) : "";
- }
- } });
- // if (!CommonUtil.isNumber(etcode)) {
- // ProcessDialogUtils.closeProgressDilog();
- // CommonUtil.setDefault(Notification.DEFAULT_VIBRATE,
- // getApplicationContext());
- // //
- // CommonUtil.showRepeatDialog(code+"格式不匹配",PieceActivity.this);
- // CustomToast.showToast(getApplicationContext(),
- // etcode + "格式不匹配", 1000);
- // barcode.setEnabled(true);
- // barcode.setText("");
- // barcode.setFocusable(true);
- // barcode.setFocusableInTouchMode(true);
- // barcode.requestFocus();
- // barcode.findFocus();
- // barcode.setFilters(new InputFilter[] { new
- // InputFilter() {
- // @Override
- // public CharSequence filter(CharSequence source,
- // int start, int end, Spanned dest,
- // int dstart, int dend) {
- //
- // return null;
- // }
- // } });
- // CommonUtil.BarcodeMaxLength(barcode,50);
- // return;
- // }
- if (collectType == 2) {
- if (piecelist != null && piecelist.size() > 0) {
- piecelist.removeAll(piecelist);
- if (pieceAdapter != null) {
- pieceAdapter.notifyDataSetChanged();
- }
- }
- }
- if(nodeType!=3) {
- if (piecelist.size() > 0) {
- boolean b = Removeduplicate.removeBarCode(etcode,
- piecelist);
- if (b) {
- ProcessDialogUtils.closeProgressDilog();
- barcode.setEnabled(true);
- barcode.setText("");
- barcode.setFocusable(true);
- barcode.setFocusableInTouchMode(true);
- barcode.requestFocus();
- barcode.findFocus();
- barcode.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(
- CharSequence source, int start,
- int end, Spanned dest, int dstart,
- int dend) {
- return null;
- }
- } });
- //CommonUtil.BarcodeMaxLength(barcode, 50);;
- CommonUtil.setDefault(
- Notification.DEFAULT_VIBRATE,
- getApplicationContext());
- if (collectType == 2) {
- CommonUtil.showRepeatDialog("条码" + etcode
- + "重复", PieceActivity.this);
- } else if (collectType == 1) {
- // Toast.makeText(getApplicationContext(),"条码"+etcode+"重复",Toast.LENGTH_SHORT).show();
- CustomToast.showToast(
- getApplicationContext(), "条码"
- + etcode + "重复", 2000);
- }
- ProcessDialogUtils.closeProgressDilog();
- return;
- }
- }
- }
-
- if(collectType==1&&nodeType==3&&proId!=luociproId) {
- if(plateNum>0&&piecelist.size()==plateNum) {
- CommonUtil.setDefault(Notification.DEFAULT_VIBRATE,
- getApplicationContext());
- CommonUtil.showBarCodeAlertDialog(0, "超过装板数量【"+plateNum+"】",
- PieceActivity.this, barcode, null, null);
- ProcessDialogUtils.closeProgressDilog();
-
- return;
- }
- }
-
- if (collectType == 1 && nodeType == 3 &&proId==luociproId) {
- CarBrandModel carbrandModel = (CarBrandModel) trademarksource.getSelectedItem();
-
- String zhuangbanshuliang=carbrandModel.getCarBrandName();
-
- int num=Integer.parseInt(zhuangbanshuliang);
- if( piecelist.size()>num-1) {
- CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, getApplicationContext());
- CommonUtil.showBarCodeAlertDialog(0, "超过装板数量【" + num + "】", PieceActivity.this,
- barcode, null, null);
- ProcessDialogUtils.closeProgressDilog();
- return;
- }
- }
-
- thread = null;
- thread = new HandlerThread("BarCoderThread", 5);
- thread.start();
- mHandler = null;
- mHandler = new Handler(thread.getLooper());
- BarcodeRunnable barcodeRunnable = new BarcodeRunnable(
- etcode, obj);
- mHandler.post(barcodeRunnable);
- }
- }
- }
- @Override
- public void beforeTextChanged(CharSequence s, int start, int count,
- int after) {
- }
- @Override
- public void onTextChanged(CharSequence s, int start, int before,
- int count) {
- barcodeUpper = barcode.getText().toString();
- if(barcodeUpper.length() >= 73)
- {
- String[] parts = barcodeUpper.split("-", 2);
- if (parts.length == 2) {
- barcodeUpper = parts[1];
- }
- }
- // 判断输入的文字是否是小写
- for (int i = 0; i < barcodeUpper.length(); i++) {
- if (barcodeUpper.charAt(i) - 0 >= 97
- && barcodeUpper.charAt(i) - 0 <= 122) {
- barcodeUpperH.postDelayed(BarcodeUpperCase, 300);
- }
- }
- }
- });
- // //产品条码键盘触发事件
- barcode.setOnEditorActionListener(new OnEditorActionListener() {
- @Override
- public boolean onEditorAction(TextView arg0, int arg1, KeyEvent arg2) {
- if (arg1 == EditorInfo.IME_ACTION_GO) {
- String workno = met.getText().toString();
- if (TextUtils.isEmpty(workno)) {
-
- CustomToast.showToast(getApplicationContext(),
- "生产工号不能为空", 2000);
- met.setEnabled(true);
- met.setFocusable(true);
- met.setFocusableInTouchMode(true);
- met.requestFocus();
- met.findFocus();
- met.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source,
- int start, int end, Spanned dest,
- int dstart, int dend) {
- return null;
- }
- } });
- return true;
- } else {
- if (!userCodeIsValid) {
- CustomToast.showToast(getApplicationContext(),
- "请在生产工号输入框内按回车键验证生产工号", 2000);
- met.setEnabled(true);
- met.setFocusable(true);
- met.setFocusableInTouchMode(true);
- met.requestFocus();
- met.findFocus();
- met.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source,
- int start, int end, Spanned dest,
- int dstart, int dend) {
- return null;
- }
- } });
- return true;
- }
- String etcode = barcode.getText().toString().trim().replaceAll("\\n", "").replaceAll("\n", "");
- if(etcode.substring(0, 4).equals("http"))
- {
- String[] parts = etcode.split("-", 2);
- if (parts.length == 2) {
- etcode = parts[1];
- }
- }
- ProcessDialogUtils
- .showProcessDialog(PieceActivity.this);
- barcode.setEnabled(false);
- barcode.setFocusable(false);
- barcode.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source,
- int start, int end, Spanned dest,
- int dstart, int dend) {
- return source.length() < 1 ? dest.subSequence(
- dstart, dend) : "";
- }
- } });
- if (!TextUtils.isEmpty(etcode)) {
- // if (!CommonUtil.isNumber(etcode)) {
- // ProcessDialogUtils.closeProgressDilog();
- // CommonUtil.setDefault(
- // Notification.DEFAULT_VIBRATE,
- // getApplicationContext());
- // //
- // CommonUtil.showRepeatDialog(code+"格式不匹配",PieceActivity.this);
- // //
- // Toast.makeText(getApplicationContext(),etcode+"格式不匹配",Toast.LENGTH_SHORT).show();
- // CustomToast.showToast(getApplicationContext(),
- // etcode + "格式不匹配", 1000);
- // barcode.setEnabled(true);
- // barcode.setText("");
- // barcode.setFocusable(true);
- // barcode.setFocusableInTouchMode(true);
- // barcode.requestFocus();
- // barcode.findFocus();
- // barcode.setFilters(new InputFilter[] { new
- // InputFilter() {
- // @Override
- // public CharSequence filter(
- // CharSequence source, int start,
- // int end, Spanned dest, int dstart,
- // int dend) {
- //
- // return null;
- // }
- // } });
- // CommonUtil.BarcodeMaxLength(barcode,50);
- // return true;
- // }
- if (collectType == 2) {
- if (piecelist != null && piecelist.size() > 0) {
- piecelist.removeAll(piecelist);
- }
- if (pieceAdapter != null) {
- pieceAdapter.notifyDataSetChanged();
- }
- }
- if(nodeType!=3) {
- if (piecelist.size() > 0) {
- boolean b = Removeduplicate.removeBarCode(
- etcode, piecelist);
- if (b) {
- barcode.setEnabled(true);
- barcode.setText("");
- barcode.setFocusable(true);
- barcode.setFocusableInTouchMode(true);
- barcode.requestFocus();
- barcode.findFocus();
- barcode.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(
- CharSequence source, int start,
- int end, Spanned dest,
- int dstart, int dend) {
- return null;
- }
- } });
- //CommonUtil.BarcodeMaxLength(barcode, 50);;
- CommonUtil.setDefault(
- Notification.DEFAULT_VIBRATE,
- getApplicationContext());
- if (collectType == 2) {
- CommonUtil.showRepeatDialog("条码"
- + etcode + "重复",
- PieceActivity.this);
- } else if (collectType == 1) {
- CustomToast.showToast(
- getApplicationContext(), "条码"
- + etcode + "重复", 2000);
- }
- ProcessDialogUtils.closeProgressDilog();
- return true;
- }
- }
- }
-
- if(collectType==1&&nodeType==3 &&proId!=luociproId) {
- if(plateNum>0&&piecelist.size()==plateNum) {
- CommonUtil.setDefault(Notification.DEFAULT_VIBRATE,
- getApplicationContext());
-
- CommonUtil.showBarCodeAlertDialog(0, "超过装板数量【"+plateNum+"】",
- PieceActivity.this, barcode, null, null);
-
- ProcessDialogUtils.closeProgressDilog();
- return true;
- }
- }
- if (collectType == 1 && nodeType == 3 &&proId==luociproId) {
- CarBrandModel carbrandModel = (CarBrandModel) trademarksource.getSelectedItem();
-
- String zhuangbanshuliang=carbrandModel.getCarBrandName();
-
- int num=Integer.parseInt(zhuangbanshuliang);
- if( piecelist.size()>num-1) {
- CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, getApplicationContext());
- CommonUtil.showBarCodeAlertDialog(0, "超过装板数量【" + num + "】", PieceActivity.this,
- barcode, null, null);
- ProcessDialogUtils.closeProgressDilog();
- return true;
- }
-
- }
-
- thread = null;
- thread = new HandlerThread("BarCoderThread", 5);
- thread.start();
- mHandler = null;
- mHandler = new Handler(thread.getLooper());
- BarcodeRunnable barcodeRunnable = new BarcodeRunnable(
- etcode, obj);
- mHandler.post(barcodeRunnable);
- }
- else {
- ProcessDialogUtils.closeProgressDilog();
-
- CustomToast.showToast(getApplicationContext(),
- "请输入产品条码", 2000);
- barcode.setEnabled(true);
- barcode.setText("");
- barcode.setFocusable(true);
- met.setFocusableInTouchMode(true);
- met.requestFocus();
- met.findFocus();
- barcode.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source,
- int start, int end, Spanned dest,
- int dstart, int dend) {
- return null;
- }
- } });
- //CommonUtil.BarcodeMaxLength(barcode, 50);;
- return true;
- }
- }
- }
- return true;
- }
- });
- }
-
- private Handler handler1 = new Handler() {
- @Override
- public void handleMessage(Message msg) {
- super.handleMessage(msg);
- switch (msg.what) {
- case 0:
- Bundle b = msg.getData();
- String json = b.getString("worknoResult");
- ProcessDialogUtils.closeProgressDilog();
- try {
- JSONObject j = new JSONObject(json);
- JSONObject jo = (JSONObject) j.opt("d");
- int status = jo.getInt("Status");
- String message = jo.getString("Message");
- if (status == 0) {
- String result = jo.optString("Result");
- JSONObject object = new JSONObject(result);
- outErrMsg = object.optString("ErrMsg");
- if (outErrMsg.equals("null")) {
- barcode.setEnabled(true);
- barcode.setText("");
- barcode.setFocusable(true);
- barcode.setFocusableInTouchMode(true);
- barcode.requestFocus();
- barcode.findFocus();
- barcode.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source,
- int start, int end, Spanned dest,
- int dstart, int dend) {
- return null;
- }
- } });
- ////CommonUtil.BarcodeMaxLength(barcode, 50);;
- userID1 = object.getString("UserID");
- userCode1 = object.getString("UserCode");
- userName1 = object.getString("UserName");
- userCodeIsValid = true;
-
- if (mHandler != null) {
- mHandler.removeCallbacksAndMessages(null);
- mHandler.getLooper().quit();
- }
-
- InputMethodManager im = (InputMethodManager) met
- .getContext().getSystemService(
- Context.INPUT_METHOD_SERVICE);
- im.hideSoftInputFromWindow(met.getWindowToken(),
- InputMethodManager.HIDE_NOT_ALWAYS);
- } else {
- if (mHandler != null) {
- mHandler.removeCallbacksAndMessages(null);
- mHandler.getLooper().quit();
- }
- userCodeIsValid = false;
- CommonUtil.setDefault(Notification.DEFAULT_VIBRATE,
- getApplicationContext());
- CommonUtil.showWorkNoAlertDialog(status, outErrMsg,
- PieceActivity.this, met, barcode, null,
- null, collectType);
- return;
- }
- // 如果是水效标识来的 NewWaterEfficiencyLabelActivity= wangyingjie
- if("wangyingjie".equals(NewWaterEfficiencyLabelActivity)) {
- barcode.setText(NewWaterBarcode);
- searchBarCode(NewWaterBarcode);
- }
-
- } else {
- if (mHandler != null) {
- mHandler.removeCallbacksAndMessages(null);
- mHandler.getLooper().quit();
- }
- userCodeIsValid = false;
- CommonUtil.setDefault(Notification.DEFAULT_VIBRATE,
- getApplicationContext());
- CommonUtil.showWorkNoAlertDialog(status, message,
- PieceActivity.this, met, barcode, null, null,
- collectType);
- }
- } catch (Exception e) {
- if (mHandler != null) {
- mHandler.removeCallbacksAndMessages(null);
- mHandler.getLooper().quit();
- }
- e.printStackTrace();
- }
- break;
- /**李士越2025-05 获取装板数量*/
- case 3:
- try {
- Bundle b6 = msg.getData();
- String result6 = b6.getString("sumResult");
- JSONObject jo = new JSONObject(result6);
- JSONObject jobj = jo.optJSONObject("d");
- String result3 = jobj.optString("Result");
- JSONArray resultArray = new JSONArray(result3);
- if(resultArray!=null) {
- carBrandList = new ArrayList<CarBrandModel>();
- for (int i = 0; i < resultArray.length(); i++) {
- JSONObject resultObj = (JSONObject) resultArray.opt(i);
- int dictionaryId = resultObj.optInt("DICTIONARYID");
- String dictionaryValue = resultObj.optString("DICTIONARYVALUE");
- CarBrandModel carBrandModel = new CarBrandModel();
- carBrandModel.setCarBrandId(String.valueOf(dictionaryId));
- carBrandModel.setCarBrandName(dictionaryValue);
- carBrandList.add(carBrandModel);
- }
- carBrandAdapter = new CarBrandSpinnerAdapter(PieceActivity.this, carBrandList);
- trademarksource.setAdapter(carBrandAdapter);
- }
-
- }catch (Exception e) {
- e.printStackTrace();
- }
- break;
- }
- }
- };
- Runnable BarcodeUpperCase = new Runnable() {
- @Override
- public void run() {
- // 小写转大写
- barcode.setText(barcodeUpper.toUpperCase());
- // 设置EditText光标位置
- barcode.setSelection(barcodeUpper.length());
- }
- };
- private Handler handler2 = new Handler() {
- @Override
- public void handleMessage(Message msg) {
- super.handleMessage(msg);
- switch (msg.what) {
- case 2:
- ProcessDialogUtils.closeProgressDilog();
- if (mHandler != null) {
- mHandler.removeCallbacksAndMessages(null);
- mHandler.getLooper().quit();
- }
- Bundle b2 = msg.getData();
- String errmsg = b2.getString("msg");
- String missFlag = b2.getString("missingFlag");
- Intent intent = new Intent();
- Bundle b1 = new Bundle();
- b1.putString("msg", errmsg);
- b1.putString("missingFlag", missFlag);
- intent.putExtras(b1);
- intent.setClass(PieceActivity.this, MissingScanActivity.class);
- startActivityForResult(intent, 101);
- break;
- }
- }
- };
- private Handler exceptionHandler = new Handler() {
- @Override
- public void handleMessage(Message msg) {
- super.handleMessage(msg);
- switch (msg.what) {
- case 0:
- ProcessDialogUtils.closeProgressDilog();
- if (mHandler != null) {
- mHandler.removeCallbacksAndMessages(null);
- mHandler.getLooper().quit();
- }
- Bundle b = msg.getData();
- String message = b.getString("message");
- CommonUtil.setDefault(Notification.DEFAULT_VIBRATE,
- getApplicationContext());
- Toast.makeText(getApplicationContext(),message, Toast.LENGTH_LONG).show();
- barcode.setEnabled(true);
- barcode.setText("");
- barcode.setFocusable(true);
- barcode.setFocusableInTouchMode(true);
- barcode.requestFocus();
- barcode.findFocus();
- barcode.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start,
- int end, Spanned dest, int dstart, int dend) {
- return null;
- }
- } });
- //CommonUtil.BarcodeMaxLength(barcode, 50);;
- break;
- case 1:
- ProcessDialogUtils.closeProgressDilog();
- if (mHandler != null) {
- mHandler.removeCallbacksAndMessages(null);
- mHandler.getLooper().quit();
- }
- Bundle b1 = msg.getData();
- String message1 = b1.getString("message");
- CommonUtil.setDefault(Notification.DEFAULT_VIBRATE,
- getApplicationContext());
- CustomToast.showToast(getApplicationContext(), message1, 2000);
- if (collectType == 1) {
- met.setEnabled(true);
- met.setText("");
- met.setFocusable(true);
- met.setFocusableInTouchMode(true);
- met.requestFocus();
- met.findFocus();
- met.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source,
- int start, int end, Spanned dest, int dstart,
- int dend) {
- return null;
- }
- } });
- }
-
- barcode.setEnabled(true);
- barcode.setText("");
- barcode.setFocusable(true);
- barcode.setFocusableInTouchMode(true);
- barcode.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source,
- int start, int end, Spanned dest,
- int dstart, int dend) {
- return null;
- }
- } });
- //CommonUtil.BarcodeMaxLength(barcode, 50);;
- break;
- case 2:
- ProcessDialogUtils.closeProgressDilog();
- if (mHandler != null) {
- mHandler.removeCallbacksAndMessages(null);
- mHandler.getLooper().quit();
- }
- Bundle b2 = msg.getData();
- int status2 = b2.getInt("Status");
- String message2 = b2.getString("Message");
- CommonUtil.setDefault(Notification.DEFAULT_VIBRATE,
- getApplicationContext());
- CommonUtil.showBarCodeAlertDialog(status2, message2,
- PieceActivity.this, barcode, null, null);
- break;
- case 3:
- ProcessDialogUtils.closeProgressDilog();
- if (mHandler != null) {
- mHandler.removeCallbacksAndMessages(null);
- mHandler.getLooper().quit();
- }
- Bundle b3 = msg.getData();
- int status3 = b3.getInt("Status");
- String message3 = b3.getString("Message");
- if (piecelist != null && piecelist.size() > 0) {
- piecelist.removeAll(piecelist);
- if (pieceAdapter != null) {
- pieceAdapter.notifyDataSetChanged();
- }
- CommonUtil.setDefault(Notification.DEFAULT_VIBRATE,
- getApplicationContext());
- CommonUtil.showBarCodeAlertDialog(status3, message3,
- PieceActivity.this, barcode, null, null);
- }
- break;
-
- case 4:
- ProcessDialogUtils.closeProgressDilog();
- if (mHandler != null) {
- mHandler.removeCallbacksAndMessages(null);
- mHandler.getLooper().quit();
- }
- Bundle b4 = msg.getData();
- String missFlag= b4.getString("missingFlag");
- String message4=b4.getString("Message");
- Intent intent = new Intent();
- Bundle b5 = new Bundle();
- b5.putString("msg", message4);
- b5.putString("missingFlag", missFlag);
- intent.putExtras(b5);
- intent.setClass(PieceActivity.this,
- MissingScanActivity.class);
- startActivityForResult(intent, 101);
- break;
- }
- }
- };
- Handler saveValidHandler = new Handler() {
- @Override
- public void handleMessage(Message msg) {
- switch (msg.what) {
- case 0:
- ProcessDialogUtils.closeProgressDilog();
- if (mHandler != null) {
- mHandler.removeCallbacksAndMessages(null);
- mHandler.getLooper().quit();
- }
- Bundle b = msg.getData();
- String message = b.getString("message");
- CommonUtil.setDefault(Notification.DEFAULT_VIBRATE,
- getApplicationContext());
-
- CustomToast.showToast(getApplicationContext(), message, 2000);
- bt2.setEnabled(true);
- break;
- }
- }
- };
- // 保存
- private Handler handler3 = new Handler() {
- @Override
- public void handleMessage(Message msg) {
- super.handleMessage(msg);
- switch (msg.what) {
- case 2:
- Bundle b = msg.getData();
- String json = b.getString("saveResult");
- bt2.setEnabled(true);
- ProcessDialogUtils.closeProgressDilog();
- try {
- JSONObject j = new JSONObject(json);
- JSONObject jobj = (JSONObject) j.opt("d");
- int status = jobj.optInt("Status");
- String message = jobj.optString("Message");
- if (status == 0) {
- String result = jobj.optString("Result");
- piecelist.removeAll(piecelist);
- pieceAdapter.notifyDataSetChanged();
- bt2.setText("保存(" + piecelist.size() + ")");
- if (collectType == 1) {
- userCodeIsValid = false;
- }
- produceCodeIsValid = false;
- JSONArray jsonArray2 = new JSONArray(result);
- JSONObject object2 = (JSONObject) jsonArray2.get(0);
- String outErrMsg = object2.getString("out_errMsg");
- if (TextUtils.isEmpty(outErrMsg)) {
- if (collectType == 1) {
- met.setEnabled(true);
- met.setText("");
- met.setFocusable(true);
- met.setFocusableInTouchMode(true);
- met.requestFocus();
- met.findFocus();
- met.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(
- CharSequence source, int start,
- int end, Spanned dest, int dstart,
- int dend) {
- return null;
- }
- } });
- } else {
- barcode.setEnabled(true);
- barcode.setText("");
- barcode.setFocusable(true);
- barcode.setFocusableInTouchMode(true);
- barcode.requestFocus();
- barcode.findFocus();
- barcode.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(
- CharSequence source, int start,
- int end, Spanned dest, int dstart,
- int dend) {
- return null;
- }
- } });
- ////CommonUtil.BarcodeMaxLength(barcode, 50);;
- }
- CustomToast.showToast(getApplicationContext(),
- "上传成功", 2000);
- CommonUtil.playSound(PieceActivity.this);
- if (mHandler != null) {
- mHandler.removeCallbacksAndMessages(null);
- mHandler.getLooper().quit();
- }
- return;
- } else {
- CommonUtil.showSaveAlertDialog(status, outErrMsg,
- PieceActivity.this, met, barcode,
- collectType);
- if (mHandler != null) {
- mHandler.removeCallbacksAndMessages(null);
- mHandler.getLooper().quit();
- }
- return;
- }
- } else {
- if (mHandler != null) {
- mHandler.removeCallbacksAndMessages(null);
- mHandler.getLooper().quit();
- }
- if (status == 1) {
- piecelist.removeAll(piecelist);
- pieceAdapter.notifyDataSetChanged();
- bt2.setText("保存(" + piecelist.size() + ")");
- if (collectType == 1) {
- userCodeIsValid = false;
- }
- produceCodeIsValid = false;
- }
- CommonUtil.setDefault(Notification.DEFAULT_VIBRATE,
- getApplicationContext());
- CommonUtil.showSaveAlertDialog(status, message,
- PieceActivity.this, met, barcode, collectType);
- }
- System.gc();
- break;
- } catch (Exception e) {
- if (mHandler != null) {
- mHandler.removeCallbacksAndMessages(null);
- mHandler.getLooper().quit();
- }
- e.printStackTrace();
- }
- break;
- case 3:
-
- Bundle b3 = msg.getData();
- String result6=b3.getString("result");
- JSONObject jo6;
- ProcessDialogUtils.closeProgressDilog();
- try {
- jo6 = new JSONObject(result6);
- JSONObject jo7 = jo6.optJSONObject("d");
- int status7 = jo7.optInt("Status");
- String message7 = jo7.optString("Message");
- if (status7 == 0) {
- String result = jo7.optString("Result");
- JSONArray jarray7 = new JSONArray(result);
- if (jarray7 != null && jarray7.length() > 0) {
- JSONObject jo8 = jarray7.optJSONObject(0);
- String outErrMsg = jo8.optString("out_errMsg");
- String missFlag = jo8.optString("out_missFlag");
- if (TextUtils.isEmpty(outErrMsg)) {
- if (userCodeIsValid) {
- piece = null;
- piece = new Piece();
- piece.setUserId(userID1);
- piece.setUserCode(userCode1);
- piece.setUserName(userName1);
- }
- produceCodeIsValid = true;// test
- out_goodsID = jo8.optString("out_goodsID");
- piece.setGoodsId(out_goodsID);
- out_goodsCode = jo8
- .optString("out_goodsCode");
- piece.setGoodsCode(out_goodsCode);
- out_goodsName = jo8
- .optString("out_goodsName");
- piece.setGoodsName(out_goodsName);
- String outbarcode = jo8
- .optString("out_barcode");
- piece.setBarCode(outbarcode);
- String groutingNum = jo8
- .optString("out_groutingNum");
- String mouldCode = jo8
- .optString("out_mouldCode");
- String groutingDate = jo8
- .optString("out_groutingdate");
- String groutingcode = jo8
- .optString("out_groutingUserCode");
- String publicBodyFlag = jo8
- .optString("out_ispublicbody");
- String trademarkName = jo8
- .optString("out_logoName");
-
- String waterLabelCode=jo8.optString("out_WaterLabelCode");
- String checkFlag=jo8.optString("out_CodeCheckFlag");
- piece.setTrademarkName(trademarkName);
- piece.setGroutingUserCode(groutingcode);
- piece.setMouldNo(mouldCode);
- piece.setGroutingNum(Integer
- .parseInt(groutingNum));
- if (!TextUtils.isEmpty(groutingDate)) {
- if (groutingDate.contains("/")) {
- groutingDate = CommonUtil
- .dateStringConverter(groutingDate);
- } else if (groutingDate.contains("-")) {
- groutingDate = CommonUtil
- .commonDateConverter(groutingDate);
- }
- piece.setGroutingDate(groutingDate);
- } else {
- piece.setGroutingDate("");
- }
- piece.setPublicBilletFlag(publicBodyFlag);
- piecelist.add(0, piece);
- if(pieceAdapter==null){
- pieceAdapter = new PieceListMessageAdapter(PieceActivity.this,piecelist);
- list1.setAdapter(pieceAdapter);
- }
- else{
- pieceAdapter.notifyDataSetChanged();
- }
- CustomToast.showToast(getApplicationContext(),
- "上传成功", 2000);
- CommonUtil.playSound(PieceActivity.this);
-
-
- if(checkFlag.equals("1")&&!TextUtils.isEmpty(waterLabelCode)) {
- Intent intent = new Intent();
- Bundle b1 = new Bundle();
- b1.putString("WaterLabelCode", waterLabelCode);
- intent.putExtras(b1);
- intent.setClass(PieceActivity.this, WaterLabelCheckActivity.class);
- startActivityForResult(intent, 103);
- }
- else
- {
- barcode.setEnabled(true);
- barcode.setText("");
- barcode.setFocusable(true);
- barcode.setFocusableInTouchMode(true);
- barcode.requestFocus();
- barcode.findFocus();
- barcode.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start,
- int end, Spanned dest, int dstart, int dend) {
- return null;
- }
- } });
- ////CommonUtil.BarcodeMaxLength(barcode, 50);;
- }
- // 如果是水校标识界面过来的 barcode成功返回后 直接关闭界面
- if("wangyingjie".equals(NewWaterEfficiencyLabelActivity)) {
- finish();
- }
-
- }
- else {
- produceCodeIsValid = false;
- if (missFlag.equals("0")) {
- CommonUtil.setDefault(Notification.DEFAULT_VIBRATE,
- getApplicationContext());
- CommonUtil.showBarCodeAlertDialog(status7,outErrMsg,
- PieceActivity.this, barcode, null, null);
-
- }
- else {
- Intent intent = new Intent();
- Bundle b1 = new Bundle();
- b1.putString("msg", outErrMsg);
- b1.putString("missingFlag", missFlag);
- intent.putExtras(b1);
- intent.setClass(PieceActivity.this, MissingScanActivity.class);
- startActivityForResult(intent, 101);
-
- }
-
- }
- }
-
- } else {
- produceCodeIsValid = false;
-
- CommonUtil.setDefault(Notification.DEFAULT_VIBRATE,
- getApplicationContext());
- CommonUtil.showBarCodeAlertDialog(status7, message7,
- PieceActivity.this, barcode, null, null);
- return;
- }
-
-
-
- bt2.setText("保存(" + piecelist.size() + ")");
- if (mHandler != null) {
- mHandler.removeCallbacksAndMessages(null);
- mHandler.getLooper().quit();
- }
-
- } catch (JSONException e1) {
-
- e1.printStackTrace();
- }
-
- break;
- case 4:
- ProcessDialogUtils.closeProgressDilog();
- if (mHandler != null) {
- mHandler.removeCallbacksAndMessages(null);
- mHandler.getLooper().quit();
- }
-
- Bundle b4= msg.getData();
- Piece piece=(Piece) b4.getSerializable("piece");
- piecelist.add(0, piece);
- if(pieceAdapter==null){
- pieceAdapter = new PieceListMessageAdapter(
- PieceActivity.this,piecelist);
- list1.setAdapter(pieceAdapter);
- }
-
- else
- {
- pieceAdapter.notifyDataSetChanged();
- }
- bt2.setText("保存(" + piecelist.size() + ")");
- barcode.setEnabled(true);
- barcode.setText("");
- barcode.setFocusable(true);
- barcode.setFocusableInTouchMode(true);
- barcode.requestFocus();
- barcode.findFocus();
- barcode.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source,
- int start, int end, Spanned dest,
- int dstart, int dend) {
- return null;
- }
- } });
- ////CommonUtil.BarcodeMaxLength(barcode, 50);;
- InputMethodManager im = (InputMethodManager) barcode
- .getContext().getSystemService(
- Context.INPUT_METHOD_SERVICE);
- im.hideSoftInputFromWindow(barcode.getWindowToken(),
- InputMethodManager.HIDE_NOT_ALWAYS);
- ProcessDialogUtils.closeProgressDilog();
- break;
- }
- }
- };
- private class SavePieceRunnable implements Runnable {
- Object obj;
- public SavePieceRunnable(Object obj) {
- this.obj = obj;
- }
- @Override
- public void run() {
- synchronized (obj) {
- try {
- jsonObject = new JSONObject();
- jsonObject.put("accountCode", accountCode);
- jsonObject.put("userCode", piece_userCode);
- jsonObject.put("userPassword", userPassword);
- jsonObject.put("sessionKey", sessionKey);
- jsonObject.put("procedureID", proId);
- JSONArray productionDataEntitys = new JSONArray();
- for (Piece p : piecelist) {
- JSONObject obj = new JSONObject();
- String userId = p.getUserId();
- obj.put("UserID", Long.parseLong(userId));
- String userCode = p.getUserCode();
- obj.put("UserCode", userCode);
- String userName = p.getUserName();
- obj.put("UserName", userName);
- String barcode = p.getBarCode();
- obj.put("Barcode", barcode);
- productionDataEntitys.put(obj);
- }
- jsonObject.put("productionDataEntitys",
- productionDataEntitys);
- client = null;
- client = new WebClient();
- String result = client.doPost("http://" + ServerAddress_ip
- + ":" + ServerAddress_duankou
- + Constants.ADD_WORK_PIECE, jsonObject.toString(),
- "application/json");
- Message m = new Message();
- m.what = 2;
- Bundle b = new Bundle();
- b.putString("saveResult", result);
- m.setData(b);
- handler3.sendMessage(m);
- } catch (JSONException e) {
- e.printStackTrace();
- Message m = new Message();
- m.what = 0;
- Bundle b = new Bundle();
- b.putString("message", "json数据异常");
- m.setData(b);
- saveValidHandler.sendMessage(m);
- ProcessDialogUtils.closeProgressDilog();
- } catch (Exception e) {
- e.printStackTrace();
- Message m = new Message();
- m.what = 0;
- Bundle b = new Bundle();
- b.putString("message", "网络连接异常");
- m.setData(b);
- saveValidHandler.sendMessage(m);
- }
- }
- }
- };
- private class BarcodeRunnable implements Runnable {
- String barcode;
- Object obj;
- public BarcodeRunnable(String barcode, Object obj) {
- this.barcode = barcode;
- this.obj = obj;
- }
- @Override
- public void run() {
- synchronized (obj) {
- try {
- if (collectType == 1) {
- jsonObject = new JSONObject();
- jsonObject.put("accountCode", accountCode);
- jsonObject.put("userCode", piece_userCode);
- jsonObject.put("userPassword", userPassword);
- jsonObject.put("sessionKey", sessionKey);
- jsonObject.put("procedureID", proId);// 工序ID,菜单页面传过来的
- jsonObject.put("barcode", barcode);// 条码
- client = null;
- client = new WebClient();
- String result = client.doPost("http://"
- + ServerAddress_ip + ":"
- + ServerAddress_duankou
- + Constants.BAR_CODE_VALID,
- jsonObject.toString(), "application/json");
-
- JSONObject j1 = new JSONObject(result);
- JSONObject jobj = (JSONObject) j1.opt("d");
- int status = jobj.optInt("Status");
- String message = jobj.optString("Message");
- if (status == 0) {
- String result1 = jobj.optString("Result");
- JSONArray jsonArray = new JSONArray(result1);
- JSONObject object1 = (JSONObject) jsonArray.get(0);
- outErrMsg = object1.getString("out_errMsg");
- String missFlag = object1.optString("out_missFlag");
- if (!TextUtils.isEmpty(outErrMsg)) {
- if (missFlag.equals("0")) {
- Bundle bundle=new Bundle();
- bundle.putInt("Status", status);
- bundle.putString("Message", outErrMsg);
- Message msg=new Message();
- msg.what=2;
- msg.setData(bundle);
- exceptionHandler.sendMessage(msg);
- return;
- } else {
- Bundle bundle=new Bundle();
- bundle.putString("missingFlag", missFlag);
- bundle.putString("Message", outErrMsg);
- Message msg=new Message();
- msg.what=4;
- msg.setData(bundle);
- exceptionHandler.sendMessage(msg);
-
- return;
- }
- }
- String outbarcode = object1.getString("out_barcode");
- if(nodeType==3) {
- if (piecelist.size() > 0 ) {
- boolean b = Removeduplicate.removeBarCode(
- outbarcode, piecelist);
- if (b) {
- Bundle bundle=new Bundle();
- bundle.putString("message","条码"+outbarcode+"重复");
- Message msg=new Message();
- msg.what=0;
- msg.setData(bundle);
- exceptionHandler.sendMessage(msg);
- return;
-
- }
- }
- }
-
-
- if (userCodeIsValid) {
- piece = null;
- piece = new Piece();
- piece.setUserId(userID1);
- piece.setUserCode(userCode1);
- piece.setUserName(userName1);
- }
-
- produceCodeIsValid = true;
- String logoId=object1.optString("out_logoID");
- String logoCode=object1.optString("out_logoCode");
- piece.setLogoCode(logoCode);
- piece.setLogoId(logoId);
- String logoName=object1.optString("out_logoName");
- piece.setLogoName(logoName);
- String goodsModelForCheck=object1.optString("GOODSMODELforCheck");
- String plateLimitNum=object1.optString("PlateLimitNum");
- piece.setPlateLimitNum(plateLimitNum);
- piece.setGoodsModel(goodsModelForCheck);
- out_goodsID = object1.getString("out_goodsID");
- piece.setGoodsId(out_goodsID);
- out_goodsCode = object1.getString("out_goodsCode");
- String outGoodsCodeForCheck=object1.optString("out_goodsCode");
- piece.setGoodsCode(out_goodsCode);
- out_goodsName = object1.getString("out_goodsName");
- piece.setGoodsName(out_goodsName);
- piece.setBarCode(outbarcode);
- String groutingNum = object1
- .optString("out_groutingNum");
- String mouldCode = object1.optString("out_mouldCode");
- String groutingDate = object1
- .optString("out_groutingdate");
- String groutingcode = object1
- .optString("out_groutingUserCode");
- String publicBodyFlag = object1
- .optString("out_ispublicbody");
- String trademarkName = object1
- .optString("out_logoName");
- piece.setTrademarkName(trademarkName);
- piece.setGroutingUserCode(groutingcode);
- piece.setMouldNo(mouldCode);
- piece.setGroutingNum(Integer.parseInt(groutingNum));
- if (!TextUtils.isEmpty(groutingDate)) {
- if (groutingDate.contains("/")) {
- groutingDate = CommonUtil
- .dateStringConverter(groutingDate);
- } else if (groutingDate.contains("-")) {
- groutingDate = CommonUtil
- .commonDateConverter(groutingDate);
- }
- piece.setGroutingDate(groutingDate);
- } else {
- piece.setGroutingDate("");
- }
- piece.setPublicBilletFlag(publicBodyFlag);
-
-
- if(piecelist!=null&&piecelist.size()==0&&nodeType==3) {
-
- jsonObject = new JSONObject();
- jsonObject.put("accountCode", accountCode);
- jsonObject.put("userCode", piece_userCode);
- jsonObject.put("userPassword", userPassword);
- jsonObject.put("sessionKey", sessionKey);
- jsonObject.put("procedureID", proId);// 工序ID,菜单页面传过来的
- jsonObject.put("barcode", barcode);// 条码
- jsonObject.put("module", "FinishedLoadingCar");
- jsonObject.put("action","GetSetting");
- JSONObject data = new JSONObject();
- data.put("GoodsID",out_goodsID);
- jsonObject.put("jsonData",data.toString());
- client = null;
- client = new WebClient();
- String result5 = client.doPost("http://"
- + ServerAddress_ip + ":"
- + ServerAddress_duankou
- + Constants.serverAction + "/DoAction",
- jsonObject.toString( ), "application/json");
- JSONObject jsonObject5=new JSONObject(result5);
- JSONObject json6=(JSONObject) jsonObject5.opt("d");
- int status6=json6.optInt("Status");
- String message6=json6.optString("Message");
- if(status6==0) {
- String result6=json6.optString("Result");
- JSONObject js7=new JSONObject(result6);
- spm_011 =js7.optString("S_PM_011");
- spm_012=js7.optString("S_PM_012");
- spm_013=js7.optString("S_PM_013");
- if(spm_012.equals("1")&&spm_013.equals("1")) {
- plateNum=Integer.parseInt(plateLimitNum);
- }
- else {
- plateNum=0;
- }
-
- }
- else {
- Bundle bundle=new Bundle();
- bundle.putInt("Status", status6);
- bundle.putString("Message", message6);
- Message msg=new Message();
- msg.what=2;
- msg.setData(bundle);
- exceptionHandler.sendMessage(msg);
- return;
- }
-
- }
- else if(piecelist!=null&&piecelist.size()>0&&nodeType==3) {
- Piece p2=piecelist.get(0);
- String originalLogoId= p2.getLogoId();
- String originalLogoName=p2.getLogoName();
- String orginalGoodsModelForCheck=p2.getGoodsModel();
- String originalGoodsCode=p2.getGoodsCode();
- if(spm_011.equals("1")) {
- if(!logoId.equals(originalLogoId)) {
- Bundle bundle=new Bundle();
- bundle.putInt("Status",0);
- bundle.putString("Message","此产品【"+outbarcode+"】的商标【"+logoName+"】与此批次商标【"+originalLogoName+"】不同,不能进行该操作。");
- Message msg=new Message();
- msg.what=2;
- msg.setData(bundle);
- exceptionHandler.sendMessage(msg);
- return;
- }
- }
-
- if(spm_012.equals("1")) {
- if(!goodsModelForCheck.equals(orginalGoodsModelForCheck)) {
- //注掉为点数装板 限制同型号装板
- //由于H01412M与H01412M-G物料编码一致
- //这两个产品可以装入一板内
- //要是不让装入一板将上面if注释
- //而这个注释打开
- // if(!outGoodsCodeForCheck.equals(originalGoodsCode)) {
- Bundle bundle=new Bundle();
- bundle.putInt("Status",0);
- bundle.putString("Message","此产品【"+outbarcode+"】的型号【"+out_goodsCode+"】与此批次型号【"+originalGoodsCode+"】不同,不能进行该操作。");
- Message msg=new Message();
- msg.what=2;
- msg.setData(bundle);
- exceptionHandler.sendMessage(msg);
- return;
- }
- }
- }
-
- Message m5=new Message();
- m5.what=4;
- Bundle bundle=new Bundle();
- bundle.putSerializable("piece", (Serializable)piece);
- m5.setData(bundle);
- handler3.sendMessage(m5);
-
- } else {
- Bundle bundle=new Bundle();
- bundle.putInt("Status", status);
- bundle.putString("Message", message);
- Message msg=new Message();
- msg.what=2;
- msg.setData(bundle);
- exceptionHandler.sendMessage(msg);
- return;
-
- }
-
- } else if (collectType == 2) {
- jsonObject = new JSONObject();
- // 保存条码信息请求数据
- jsonObject.put("accountCode", accountCode);
- jsonObject.put("userCode", piece_userCode);
- jsonObject.put("userPassword", userPassword);
- jsonObject.put("sessionKey", sessionKey);
- jsonObject.put("procedureID", proId);
- JSONArray productionDataEntitys = new JSONArray();
- JSONObject jsonobj = new JSONObject();
- jsonobj.put("UserID", Long.parseLong(userID1));
- jsonobj.put("UserCode", userCode1);
- jsonobj.put("UserName", userName1);
- jsonobj.put("Barcode", barcode);
- productionDataEntitys.put(jsonobj);
- jsonObject.put("productionDataEntitys",
- productionDataEntitys);
- client = null;
- client = new WebClient();
- String result6 = client.doPost("http://"
- + ServerAddress_ip + ":"
- + ServerAddress_duankou
- + Constants.ADD_WORK_PIECE,
- jsonObject.toString(), "application/json");
- Message m = new Message();
- m.what = 3;
- Bundle b = new Bundle();
- b.putString("result",
- result6);
- m.setData(b);
- handler3.sendMessage(m);
-
- }
- }
- catch (JSONException e) {
- e.printStackTrace();
- Message m = new Message();
- m.what = 0;
- Bundle b = new Bundle();
- b.putString("message", "json数据异常");
- m.setData(b);
- exceptionHandler.sendMessage(m);
- }
- catch (Exception e) {
- e.printStackTrace();
- Message m = new Message();
- Bundle b = new Bundle();
- b.putString("message", "网络连接异常");
- m.setData(b);
- m.what = 0;
- exceptionHandler.sendMessage(m);
- }
- }
- }
- };
- Runnable UpperCase = new Runnable() {
- @Override
- public void run() {
- // 小写转大写
- met.setText(userUpper.toUpperCase());
- // 设置EditText光标位置
- met.setSelection(userUpper.length());
- }
- };
-
- // 保存条码
- private void getDataSaveBarCode() {
-
- thread = null;
- thread = new HandlerThread("SavePieceThread", 5);
- thread.start();
- mHandler = new Handler(thread.getLooper());
- SavePieceRunnable savePieceRunnable = new SavePieceRunnable(obj);
- mHandler.post(savePieceRunnable);
- }
-
- private class UserRunnable implements Runnable {
- String workno;
- public UserRunnable(String workno) {
- this.workno = workno;
- }
- public UserRunnable() {
- }
- @Override
- public void run() {
- try {
- jsonObject = new JSONObject();
- switch (collectType) {
- case 1:// 集中
- jsonObject.put("accountCode", accountCode);
- jsonObject.put("userCode", piece_userCode);
- jsonObject.put("userPassword", userPassword);
- jsonObject.put("sessionKey", sessionKey);
- jsonObject.put("procedureID", proId);// 工序ID,菜单页面传过来的
- jsonObject.put("procedureUserCode", workno);// 生产工号2
- break;
- case 2:// 单点
- jsonObject.put("accountCode", accountCode);
- jsonObject.put("userCode", piece_userCode);
- jsonObject.put("userPassword", userPassword);
- jsonObject.put("sessionKey", sessionKey);
- jsonObject.put("procedureID", proId);// 工序ID,菜单页面传过来的
- jsonObject.put("procedureUserCode", piece_userCode);// 生产工号2
- break;
- }
- client = new WebClient();
- String result = client.doPost("http://" + ServerAddress_ip
- + ":" + ServerAddress_duankou
- + Constants.PRODUCER_NO_VALID, jsonObject.toString(),
- "application/json");
- Message m = new Message();
- m.what = 0;
- Bundle b = new Bundle();
- b.putString("worknoResult", result);
- m.setData(b);
- handler1.sendMessage(m);
- } catch (Exception e) {
- e.printStackTrace();
- Message m = new Message();
- Bundle b = new Bundle();
- b.putString("message", "网络连接异常");
- m.setData(b);
- m.what = 1;
- exceptionHandler.sendMessage(m);
- }
- }
- };
- @Override
- public void onBackPressed() {
- if (piecelist != null && piecelist.size() > 0) {
- piecelist.clear();
- }
- super.onBackPressed();
- }
- @Override
- protected void onActivityResult(int requestCode, int resultCode,
- Intent intent) {
-
- if(requestCode==100&&resultCode==101)
- {
- ProcessDialogUtils.showProcessDialog(PieceActivity.this);
- if (bt2.isEnabled()) {
- bt2.setEnabled(false);
- getDataSaveBarCode();
- }
- }
- if (requestCode == 101 && resultCode == 103) {
- barcode.setEnabled(true);
- barcode.setText("");
- barcode.setFocusable(true);
- barcode.setFocusableInTouchMode(true);
- barcode.requestFocus();
- barcode.findFocus();
- barcode.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start,
- int end, Spanned dest, int dstart, int dend) {
- return null;
- }
- } });
- ////CommonUtil.BarcodeMaxLength(barcode, 50);;
- }
-
- if(requestCode==103&&resultCode==104) {
- barcode.setEnabled(true);
- barcode.setText("");
- barcode.setFocusable(true);
- barcode.setFocusableInTouchMode(true);
- barcode.requestFocus();
- barcode.findFocus();
- barcode.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start,
- int end, Spanned dest, int dstart, int dend) {
- return null;
- }
- } });
- ////CommonUtil.BarcodeMaxLength(barcode, 50);;
- }
- if (requestCode == 102 && resultCode == RESULT_OK) {
- Bundle bundle = intent.getExtras();
- String scanResult = bundle.getString("result");
- View rootview = this.getWindow().getDecorView();
- EditText v = (EditText) rootview.findFocus();
- int id = v.getId();
- v.setText(scanResult);
- v.setSelection(scanResult.length());
- switch (id) {
- case R.id.good_code:
- String woCode = v.getText().toString();
- met.setEnabled(false);
- met.setFocusable(false);
- met.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start,
- int end, Spanned dest, int dstart, int dend) {
- return source.length() < 1 ? dest.subSequence(dstart,
- dend) : "";
- }
- } });
- barcode.setEnabled(false);
- barcode.setFocusable(false);
- barcode.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start,
- int end, Spanned dest, int dstart, int dend) {
- return source.length() < 1 ? dest.subSequence(dstart,
- dend) : "";
- }
- } });
- ProcessDialogUtils.showProcessDialog(PieceActivity.this);
- thread = new HandlerThread("userThread", 5);
- thread.start();
- mHandler = new Handler(thread.getLooper());
- UserRunnable userRunnable = new UserRunnable(woCode);
- mHandler.post(userRunnable);
- break;
- case R.id.good_tm:
- String etcode = v.getText().toString().trim();
- String workno = met.getText().toString();
- if (TextUtils.isEmpty(workno)) {
- CustomToast.showToast(getApplicationContext(), "生产工号不能为空",
- 2000);
- met.setEnabled(true);
- met.setFocusable(true);
- met.setFocusableInTouchMode(true);
- met.requestFocus();
- met.findFocus();
- met.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source,
- int start, int end, Spanned dest, int dstart,
- int dend) {
- return null;
- }
- } });
- return;
- } else {
- if (!userCodeIsValid) {
- // Toast.makeText(getApplicationContext(),
- // "请在生产工号输入框内按回车键验证生产工号",Toast.LENGTH_SHORT).show();
- CustomToast.showToast(getApplicationContext(),
- "请在生产工号输入框内按回车键验证生产工号", 2000);
- met.setEnabled(true);
- met.setFocusable(true);
- met.setFocusableInTouchMode(true);
- met.requestFocus();
- met.findFocus();
- met.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source,
- int start, int end, Spanned dest,
- int dstart, int dend) {
- return null;
- }
- } });
- return;
- }
- }
-
- ProcessDialogUtils.showProcessDialog(PieceActivity.this);
- barcode.setEnabled(false);
- barcode.setFocusable(false);
- barcode.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source, int start,
- int end, Spanned dest, int dstart, int dend) {
- return source.length() < 1 ? dest.subSequence(dstart,
- dend) : "";
- }
- } });
-
- if (!TextUtils.isEmpty(etcode)) {
- // if (!CommonUtil.isNumber(etcode)) {
- // ProcessDialogUtils.closeProgressDilog();
- // CommonUtil.setDefault(Notification.DEFAULT_VIBRATE,
- // getApplicationContext());
- // // CommonUtil.showRepeatDialog(code+"格式不匹配",PieceActivity.this);
- // // Toast.makeText(getApplicationContext(),
- // // etcode+"格式不匹配",Toast.LENGTH_SHORT).show();
- // CustomToast.showToast(getApplicationContext(), etcode
- // + "格式不匹配", 2000);
- // barcode.setEnabled(true);
- // barcode.setText("");
- // barcode.setFocusable(true);
- // barcode.setFocusableInTouchMode(true);
- // barcode.requestFocus();
- // barcode.findFocus();
- // barcode.setFilters(new InputFilter[] { new InputFilter() {
- // @Override
- // public CharSequence filter(CharSequence source,
- // int start, int end, Spanned dest,
- // int dstart, int dend) {
- //
- // return null;
- // }
- // } });
- // //CommonUtil.BarcodeMaxLength(barcode, 50);;
- // return;
- // }
- if (collectType == 2) {
- if (piecelist != null && piecelist.size() > 0) {
- piecelist.removeAll(piecelist);
- }
- if (pieceAdapter != null) {
- pieceAdapter.notifyDataSetChanged();
- }
- }
- if (piecelist.size() > 0) {
- boolean b = Removeduplicate.removeBarCode(etcode,
- piecelist);
- if (b) {
- barcode.setEnabled(true);
- barcode.setText("");
- barcode.setFocusable(true);
- barcode.setFocusableInTouchMode(true);
- barcode.requestFocus();
- barcode.findFocus();
- barcode.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source,
- int start, int end, Spanned dest,
- int dstart, int dend) {
- return null;
- }
- } });
- ////CommonUtil.BarcodeMaxLength(barcode, 50);;
-
- CommonUtil.setDefault(Notification.DEFAULT_VIBRATE,
- getApplicationContext());
- if (collectType == 2) {
- CommonUtil.showRepeatDialog("条码" + etcode
- + "重复", PieceActivity.this);
- } else if (collectType == 1) {
- // Toast.makeText(getApplicationContext(),"条码"+etcode+"重复",Toast.LENGTH_SHORT).show();
- CustomToast.showToast(getApplicationContext(),
- "条码" + etcode + "重复", 2000);
- }
- ProcessDialogUtils.closeProgressDilog();
- return;
- }
- }
- if(collectType==1&&nodeType==3 &&proId!=luociproId) {
- if(plateNum>0&&piecelist.size()==plateNum) {
- CommonUtil.setDefault(Notification.DEFAULT_VIBRATE,
- getApplicationContext());
- CommonUtil.showBarCodeAlertDialog(0, "超过装板数量【"+plateNum+"】",
- PieceActivity.this, barcode, null, null);
- ProcessDialogUtils.closeProgressDilog();
- return;
- }
- }
- if (collectType == 1 && nodeType == 3 &&proId==luociproId) {
- CarBrandModel carbrandModel = (CarBrandModel) trademarksource.getSelectedItem();
-
- String zhuangbanshuliang=carbrandModel.getCarBrandName();
- int num=Integer.parseInt(zhuangbanshuliang);
- if( piecelist.size()>num-1) {
- CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, getApplicationContext());
- CommonUtil.showBarCodeAlertDialog(0, "超过装板数量【" + num + "】", PieceActivity.this,
- barcode, null, null);
- ProcessDialogUtils.closeProgressDilog();
- return ;
- }
-
-
- }
-
- thread = null;
- thread = new HandlerThread("BarCoderThread", 5);
- thread.start();
- mHandler = null;
- mHandler = new Handler(thread.getLooper());
- BarcodeRunnable barcodeRunnable = new BarcodeRunnable(
- etcode, obj);
- mHandler.post(barcodeRunnable);
- }
- else {
- ProcessDialogUtils.closeProgressDilog();
- CustomToast.showToast(getApplicationContext(), "请输入产品条码",
- 2000);
- barcode.setEnabled(true);
- barcode.setText("");
- barcode.setFocusable(true);
- barcode.setFocusableInTouchMode(true);
- barcode.requestFocus();
- barcode.findFocus();
- barcode.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source,
- int start, int end, Spanned dest, int dstart,
- int dend) {
- return null;
- }
- } });
- ////CommonUtil.BarcodeMaxLength(barcode, 50);;
- return;
- }
- break;
- }
- }
- }
- @Override
- public boolean onKeyDown(int keyCode, KeyEvent event) {
- // 获取手机当前音量值
- switch (keyCode) {
- // 音量减小
- case KeyEvent.KEYCODE_VOLUME_DOWN:
- if (event.getRepeatCount() == 0) {
- if (collectType == 1) {
- String workno = met.getText().toString();
- if (TextUtils.isEmpty(workno)) {
- CustomToast.showToast(getApplicationContext(),
- "生产工号不能为空", 2000);
- met.setEnabled(true);
- met.setFocusable(true);
- met.setFocusableInTouchMode(true);
- met.requestFocus();
- met.findFocus();
- met.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source,
- int start, int end, Spanned dest,
- int dstart, int dend) {
- return null;
- }
- } });
- return true;
- } else {
- if (!userCodeIsValid) {
-
- CustomToast.showToast(getApplicationContext(),
- "请在生产工号输入框内按回车键验证生产工号", 2000);
- met.setEnabled(true);
- met.setFocusable(true);
- met.setFocusableInTouchMode(true);
- met.requestFocus();
- met.findFocus();
- met.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source,
- int start, int end, Spanned dest,
- int dstart, int dend) {
- return null;
- }
- } });
- return true;
- }
- }
- if (piecelist.size() == 0) {
-
- CustomToast.showToast(getApplicationContext(),
- "没有可提交的明细信息", 2000);
- return true;
- }
- if(collectType==1&&nodeType==3 &&proId!=luociproId) {
- if(plateNum>0&&piecelist.size()!=plateNum) {
- CommonUtil.setDefault(Notification.DEFAULT_VIBRATE,
- getApplicationContext());
- CommonUtil.showBarCodeAlertDialog(0, "未达到装板数量【"+plateNum+"】",
- PieceActivity.this, barcode, null, null);
- return true;
- }
- }
- if (collectType == 1 && nodeType == 3 &&proId==luociproId) {
- CarBrandModel carbrandModel = (CarBrandModel) trademarksource.getSelectedItem();
-
- String zhuangbanshuliang=carbrandModel.getCarBrandName();
- int num=Integer.parseInt(zhuangbanshuliang);
- if( piecelist.size()>num) {
- CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, getApplicationContext());
- CommonUtil.showBarCodeAlertDialog(0, "超过装板数量【" + num + "】", PieceActivity.this,
- barcode, null, null);
- ProcessDialogUtils.closeProgressDilog();
- return true ;
- }
- else if( piecelist.size()<num){
- CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, getApplicationContext());
- CommonUtil.showBarCodeAlertDialog(0, "未达到装板数量【" + num + "】", PieceActivity.this,
- barcode, null, null);
- ProcessDialogUtils.closeProgressDilog();
- return true ;
- }
-
- }
- if(isGlazeChange==1)
- {
- Intent intent=new Intent();
- intent.setClass(PieceActivity.this, GlazePieceSetActivity.class);
- Bundle b=new Bundle();
- b.putInt("procedureId",proId);
- intent.putExtras(b);
- startActivityForResult(intent,100);
-
- }
- else
- {
- ProcessDialogUtils.showProcessDialog(PieceActivity.this);
- if (bt2.isEnabled()) {
- bt2.setEnabled(false);
- getDataSaveBarCode();
- }
- }
- }
- }
- // 音量减小时应该执行的功能代码
- return true;
- // 音量增大
- case KeyEvent.KEYCODE_VOLUME_UP:
- if (event.getRepeatCount() == 0) {
- if (collectType == 1) {
- String workno = met.getText().toString();
- if (TextUtils.isEmpty(workno)) {
-
- CustomToast.showToast(getApplicationContext(),
- "生产工号不能为空", 2000);
- met.setEnabled(true);
- met.setFocusable(true);
- met.setFocusableInTouchMode(true);
- met.requestFocus();
- met.findFocus();
- met.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source,
- int start, int end, Spanned dest,
- int dstart, int dend) {
- return null;
- }
- } });
- return true;
- } else {
- if (!userCodeIsValid) {
- CustomToast.showToast(getApplicationContext(),
- "请在生产工号输入框内按回车键验证生产工号", 2000);
- met.setEnabled(true);
- met.setFocusable(true);
- met.setFocusableInTouchMode(true);
- met.requestFocus();
- met.findFocus();
- met.setFilters(new InputFilter[] { new InputFilter() {
- @Override
- public CharSequence filter(CharSequence source,
- int start, int end, Spanned dest,
- int dstart, int dend) {
- return null;
- }
- } });
- return true;
- }
- }
- if (piecelist.size() == 0) {
- ProcessDialogUtils.closeProgressDilog();
- Toast.makeText(getApplicationContext(), "没有可提交的明细信息",
- Toast.LENGTH_SHORT).show();
- return true;
- }
- if(collectType==1&&nodeType==3 &&proId!=luociproId) {
- if(plateNum>0&&piecelist.size()!=plateNum) {
- CommonUtil.setDefault(Notification.DEFAULT_VIBRATE,
- getApplicationContext());
-
- CommonUtil.showBarCodeAlertDialog(0, "未达到装板数量【"+plateNum+"】",
- PieceActivity.this, barcode, null, null);
- return true;
- }
- }
- if (collectType == 1 && nodeType == 3 &&proId==luociproId) {
- CarBrandModel carbrandModel = (CarBrandModel) trademarksource.getSelectedItem();
-
- String zhuangbanshuliang=carbrandModel.getCarBrandName();
- int num=Integer.parseInt(zhuangbanshuliang);
- if( piecelist.size()>num) {
- CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, getApplicationContext());
- CommonUtil.showBarCodeAlertDialog(0, "超过装板数量【" + num + "】", PieceActivity.this,
- barcode, null, null);
- ProcessDialogUtils.closeProgressDilog();
- return true ;
- }
- else if( piecelist.size()<num){
- CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, getApplicationContext());
- CommonUtil.showBarCodeAlertDialog(0, "未达到装板数量【" + num + "】", PieceActivity.this,
- barcode, null, null);
- ProcessDialogUtils.closeProgressDilog();
- return true ;
- }
-
- }
- if(isGlazeChange==1)
- {
- Intent intent=new Intent();
- intent.setClass(PieceActivity.this, GlazePieceSetActivity.class);
- Bundle b=new Bundle();
- b.putInt("procedureId",proId);
- intent.putExtras(b);
- startActivityForResult(intent,100);
-
- }
- else
- {
- ProcessDialogUtils.showProcessDialog(PieceActivity.this);
- if (bt2.isEnabled()) {
- bt2.setEnabled(false);
- getDataSaveBarCode();
- }
- }
- // 音量增大时应该执行的功能代码
- }
- }
- return true;
-
-
- }
- return super.onKeyDown(keyCode, event);
- }
-
- @Override
- protected void onDestroy() {
- super.onDestroy();
- }
-
- @Override
- public boolean dispatchTouchEvent(MotionEvent ev) {
- switch (ev.getAction()) {
- case MotionEvent.ACTION_DOWN:
- View view = getCurrentFocus();
- CommonUtil.hideKeyboard(ev, view, PieceActivity.this);//调用方法判断是否需要隐藏键盘
- break;
-
- default:
- break;
- }
- return super.dispatchTouchEvent(ev);
- }
- @Override
- public Resources getResources() {
- Resources res = super.getResources();
- Configuration config = new Configuration();
- config.setToDefaults();
- res.updateConfiguration(config, res.getDisplayMetrics());
- return res;
- }
-
-
- /**获取装板数量*/
- public void getsum( ) {
- thread = null;
- thread = new HandlerThread("SavePieceThread", 5);
- thread.start();
- mHandler = new Handler(thread.getLooper());
- Togetsum getsum=new Togetsum();
- mHandler.post(getsum);
- }
- private class Togetsum implements Runnable {
- public Togetsum() {
- }
- @Override
- public void run() {
- try {
- client = null;
- client = new WebClient();
- JSONObject js = new JSONObject();
- js.put("accountCode", accountCode);
- js.put("userCode", piece_userCode);
- js.put("userPassword", userPassword);
- js.put("sessionKey", sessionKey);
- js.put("dicType", "TPC030");
- String result = client.doPost("http://"+ ServerAddress_ip + ":" + ServerAddress_duankou +"/DKService/PDAModuleService/GetDataDictionaryByType",
- js.toString(), "application/json");
- Message m = new Message();
- m.what = 3;
- Bundle b = new Bundle();
- b.putString("sumResult", result);
- m.setData(b);
- handler1.sendMessage(m);
- } catch (Exception e) {
- e.printStackTrace();
- Message m = new Message();
- Bundle b = new Bundle();
- b.putString("message", "网络连接异常");
- m.setData(b);
- m.what = 1;
- exceptionHandler.sendMessage(m);
- }
- }
- };
- }
|