80,354
社区成员
发帖
与我相关
我的任务
分享
colorName = null;
goodsNo = null;
longCode = null;
sizeCode = null;
//根据条码匹配本地的条码库,得到其他信息,并将此条码存入对应的条码文件中
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
try {
if (barcodearray == null) {//第一次扫描,将条码json数组放入内存
waitHandler.sendEmptyMessage(0);
String filename = com.ablejeans.ablestock.utils.SharedPreferencesUtils.getValue(mContext, "localjson").toString();
String sdpath = Environment.getExternalStorageDirectory() + "/" + "able/" + filename;
String localjsonstr = com.ablejeans.ablestock.utils.CommonTools.GetInfoByBarcode(sdpath);//得到本地json集合
barcodearray = JSONArray.parseArray(localjsonstr);
}
for (int i = 0; i < barcodearray.size(); i++) {
if (barcodearray.getJSONObject(i).get("BarCode").equals(barcodestr)) {
colorName = barcodearray.getJSONObject(i).get("color").toString();
goodsNo = barcodearray.getJSONObject(i).get("Goods_no").toString();
longCode = barcodearray.getJSONObject(i).get("Long").toString();
sizeCode = barcodearray.getJSONObject(i).get("Size").toString();
break;
}
}
} catch (JSONException e) {
e.printStackTrace();
}
}