Jelajahi Sumber

注CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
添加if(barcode.length() >= 73)
{
String[] parts = barcode.split("-", 2); // 第二个参数限制分割后的数组长度,这里为2

if (parts.length == 2) {
//System.out.println("第一部分: " + parts[0]);
//System.out.println("第二部分: " + parts[1]);
barcode = parts[1];
}
}

李士越 1 tahun lalu
induk
melakukan
887dfa47d3

+ 23 - 5
src/com/jiaju/activity/ExternalPackingBarcodePrintActivity.java

@@ -209,7 +209,7 @@ public class ExternalPackingBarcodePrintActivity extends Activity {
 										return null;
 									}
 								} });
-						CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
+						//CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
 						CustomToast.showToast(getApplicationContext(),
 								"条码不能为空", 2000);
 						return;
@@ -221,7 +221,16 @@ public class ExternalPackingBarcodePrintActivity extends Activity {
 						}
 						barcodeInfoListAdapter.notifyDataSetChanged();
 					}
-
+					if(barcode.length() >= 73)
+					{
+						String[] parts = barcode.split("-", 2); // 第二个参数限制分割后的数组长度,这里为2  
+						  
+			        if (parts.length == 2) {  
+		            //System.out.println("第一部分: " + parts[0]);  
+			            //System.out.println("第二部分: " + parts[1]);  
+				            barcode = parts[1];
+				        }  
+					} 
 					ProcessDialogUtils
 							.showProcessDialog(ExternalPackingBarcodePrintActivity.this);
 					thread = new HandlerThread("barcodeThread", 5);
@@ -325,7 +334,7 @@ public class ExternalPackingBarcodePrintActivity extends Activity {
 												return null;
 											}
 										} });
-								CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
+								//CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
 								CustomToast.showToast(getApplicationContext(),
 										"条码不能为空", 2000);
 								return true;
@@ -338,6 +347,15 @@ public class ExternalPackingBarcodePrintActivity extends Activity {
 								}
 								barcodeInfoListAdapter.notifyDataSetChanged();
 							}
+							if(barcode.length() >= 73)
+							{
+							  String[] parts = barcode.split("-", 2); // 第二个参数限制分割后的数组长度,这里为2  
+							if (parts.length == 2) {  
+								 //System.out.println("第一部分: " + parts[0]);  
+								//System.out.println("第二部分: " + parts[1]);  
+								barcode = parts[1];
+							 }  
+							} 
 
 							ProcessDialogUtils
 									.showProcessDialog(ExternalPackingBarcodePrintActivity.this);
@@ -601,7 +619,7 @@ public class ExternalPackingBarcodePrintActivity extends Activity {
 											return null;
 										}
 									} });
-							CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
+							//CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
 							InputMethodManager im = (InputMethodManager) barcodeEdt
 									.getContext().getSystemService(
 											Context.INPUT_METHOD_SERVICE);
@@ -645,7 +663,7 @@ public class ExternalPackingBarcodePrintActivity extends Activity {
 						return null;
 					}
 				} });
-				CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
+				//CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
 				CommonUtil.setDefault(Notification.DEFAULT_VIBRATE,
 						getApplicationContext());
 				CustomToast.showToast(getApplicationContext(), message, 2000);

+ 34 - 6
src/com/jiaju/activity/FinishedProductHandOverActivity.java

@@ -111,8 +111,8 @@ public class FinishedProductHandOverActivity extends Activity {
 		tvTitle.setText(title);
 		orderEdt.setFocusable(true);
 		orderEdt.requestFocus();
-		orderEdt.findFocus();
-		CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
+		//orderEdt.findFocus();
+		//CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
 		allListeners();
 		thread = new HandlerThread("trademarkThread", 5);
 		thread.start();
@@ -365,6 +365,16 @@ public class FinishedProductHandOverActivity extends Activity {
 			@Override 
 			public void onTextChanged(CharSequence s, int start, int before, int count) {
 				barcodeUpper = barcodeEdt.getText().toString().trim();
+				if(barcodeUpper.length() >= 73)
+ 				{
+ 					String[] parts = barcodeUpper.split("-", 2); // 第二个参数限制分割后的数组长度,这里为2  
+ 					  
+ 			        if (parts.length == 2) {  
+ 			            //System.out.println("第一部分: " + parts[0]);  
+ 			            //System.out.println("第二部分: " + parts[1]);  
+ 			        	barcodeUpper = parts[1];
+ 			        }  
+ 				}
 				// 判断输入的文字是否是小写
 				for (int i = 0; i < barcodeUpper.length(); i++) {
 					if (barcodeUpper.charAt(i) - 0 >= 97 && barcodeUpper.charAt(i) - 0 <= 122) {
@@ -375,6 +385,16 @@ public class FinishedProductHandOverActivity extends Activity {
 			    	 String barcode =barcodeEdt.getText().toString();
 			    	 barcode = barcode.trim();
 					 if (!TextUtils.isEmpty(barcode)) {
+						 if(barcode.length() >= 73)
+	 						{
+	 							String[] parts = barcode.split("-", 2); // 第二个参数限制分割后的数组长度,这里为2  
+	 							  
+	 					        if (parts.length == 2) {  
+	 					            //System.out.println("第一部分: " + parts[0]);  
+	 					            //System.out.println("第二部分: " + parts[1]);  
+	 					            barcode = parts[1];
+	 					        }  
+	 						} 
 					 ProcessDialogUtils
 					 .showProcessDialog(FinishedProductHandOverActivity.this);
 					 barcodeEdt.setEnabled(false);
@@ -412,6 +432,14 @@ public class FinishedProductHandOverActivity extends Activity {
 		 if (actionId==EditorInfo.IME_ACTION_GO) {
 		 String barcode =barcodeEdt.getText().toString();
 		 if (!TextUtils.isEmpty(barcode)) {
+			 if(barcode.length() >= 73) {
+				 String[] parts = barcode.split("-", 2); // 第二个参数限制分割后的数组长度,这里为2  
+				 if (parts.length == 2) {  
+				  //System.out.println("第一部分: " + parts[0]);  
+				  //System.out.println("第二部分: " + parts[1]);  
+				  barcode = parts[1];
+				  }  
+				} 
 		 ProcessDialogUtils
 		 .showProcessDialog(FinishedProductHandOverActivity.this);
 		 barcodeEdt.setEnabled(false);
@@ -749,7 +777,7 @@ public class FinishedProductHandOverActivity extends Activity {
 						return null;
 					}
 				} });
-				CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
+				//CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
 				break;
 			case 1:
 				Bundle b1 = msg.getData();
@@ -850,7 +878,7 @@ public class FinishedProductHandOverActivity extends Activity {
 										}
 									} });
 								
-									CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
+									//CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
 
 									return;
 
@@ -1072,7 +1100,7 @@ public class FinishedProductHandOverActivity extends Activity {
 									return null;
 								}
 							} });
-							CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
+							//CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
 						}
 
 					}
@@ -1223,7 +1251,7 @@ public class FinishedProductHandOverActivity extends Activity {
 					return null;
 				}
 			} });
-			CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
+			//CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
 
 		}
 	}

+ 37 - 16
src/com/jiaju/activity/PieceActivity.java

@@ -51,7 +51,7 @@ import android.widget.PopupWindow;
 import android.widget.TextView;
 import android.widget.TextView.OnEditorActionListener;
 import android.widget.Toast;
-
+//点数装板
 public class PieceActivity extends Activity {
 	private EditText met; // 工号
 	private EditText barcode; // 条码
@@ -121,7 +121,7 @@ public class PieceActivity extends Activity {
 		setContentView(R.layout.activity_pieces);
 		piecelist = new ArrayList<Piece>();
 		initview();
-		CommonUtil.BarcodeMaxLength(barcode, 50);
+		//CommonUtil.BarcodeMaxLength(barcode, 50);
 		alllistener();
 		Intent intent = getIntent();
 		Bundle bundle = intent.getExtras();
@@ -303,7 +303,7 @@ public class PieceActivity extends Activity {
 							return null;
 						}
 					} });
-					CommonUtil.BarcodeMaxLength(barcode, 50);
+					//CommonUtil.BarcodeMaxLength(barcode, 50);
 					CommonUtil.setDefault(
 							Notification.DEFAULT_VIBRATE,
 							getApplicationContext());
@@ -660,6 +660,13 @@ public class PieceActivity extends Activity {
 				if (barcode.getText().toString().contains("\n")) {
 					String etcode = barcode.getText().toString().trim()
 							.replaceAll("\\n", "");
+					if(etcode.length() >= 73)
+ 					{
+  						String[] parts = etcode.split("-", 2);   
+ 				        if (parts.length == 2) {   
+  				        	etcode = parts[1];
+ 				        }  
+  					} 
 					String workno = met.getText().toString();
 					if (TextUtils.isEmpty(workno)) {
 						// Toast.makeText(getApplicationContext(), "生产工号不能为空",
@@ -778,7 +785,7 @@ public class PieceActivity extends Activity {
 										return null;
 									}
 								} });
-								CommonUtil.BarcodeMaxLength(barcode, 50);
+								//CommonUtil.BarcodeMaxLength(barcode, 50);
 								CommonUtil.setDefault(
 										Notification.DEFAULT_VIBRATE,
 										getApplicationContext());
@@ -833,6 +840,13 @@ public class PieceActivity extends Activity {
 			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
@@ -891,6 +905,13 @@ public class PieceActivity extends Activity {
 						}
 
 						String etcode = barcode.getText().toString().trim();
+						if(etcode.length() >= 73)
+			 			{
+			 				String[] parts = etcode.split("-", 2);   
+			 		        if (parts.length == 2) {   
+			 		        	etcode = parts[1];
+			 		        }  
+			 			} 
 						 ProcessDialogUtils
 							.showProcessDialog(PieceActivity.this);
 						barcode.setEnabled(false);
@@ -967,7 +988,7 @@ public class PieceActivity extends Activity {
 											return null;
 										}
 									} });
-									CommonUtil.BarcodeMaxLength(barcode, 50);
+									//CommonUtil.BarcodeMaxLength(barcode, 50);
 									CommonUtil.setDefault(
 											Notification.DEFAULT_VIBRATE,
 											getApplicationContext());
@@ -1031,7 +1052,7 @@ public class PieceActivity extends Activity {
 									return null;
 								}
 							} });
-							CommonUtil.BarcodeMaxLength(barcode, 50);
+							//CommonUtil.BarcodeMaxLength(barcode, 50);
 							return true;
 
 						}
@@ -1079,7 +1100,7 @@ public class PieceActivity extends Activity {
 								}
 							} });
 
-							CommonUtil.BarcodeMaxLength(barcode, 50);
+							//CommonUtil.BarcodeMaxLength(barcode, 50);
 							userID1 = object.getString("UserID");
 							userCode1 = object.getString("UserCode");
 							userName1 = object.getString("UserName");
@@ -1211,7 +1232,7 @@ public class PieceActivity extends Activity {
 						return null;
 					}
 				} });
-				CommonUtil.BarcodeMaxLength(barcode, 50);
+				//CommonUtil.BarcodeMaxLength(barcode, 50);
 				break;
 			case 1:
 				ProcessDialogUtils.closeProgressDilog();
@@ -1258,7 +1279,7 @@ public class PieceActivity extends Activity {
 					}
 				} });
 
-				CommonUtil.BarcodeMaxLength(barcode, 50);
+				//CommonUtil.BarcodeMaxLength(barcode, 50);
 				break;
 
 			case 2:
@@ -1406,7 +1427,7 @@ public class PieceActivity extends Activity {
 										return null;
 									}
 								} });
-								CommonUtil.BarcodeMaxLength(barcode, 50);
+								//CommonUtil.BarcodeMaxLength(barcode, 50);
 
 							}
 
@@ -1577,7 +1598,7 @@ public class PieceActivity extends Activity {
 											return null;
 										}
 									} });
-									CommonUtil.BarcodeMaxLength(barcode, 50);	
+									//CommonUtil.BarcodeMaxLength(barcode, 50);	
 								}
 //								如果是水校标识界面过来的  barcode成功返回后 直接关闭界面
 								if("wangyingjie".equals(NewWaterEfficiencyLabelActivity)) {
@@ -1676,7 +1697,7 @@ public class PieceActivity extends Activity {
 							return null;
 						}
 					} });
-					CommonUtil.BarcodeMaxLength(barcode, 50);
+					//CommonUtil.BarcodeMaxLength(barcode, 50);
 					InputMethodManager im = (InputMethodManager) barcode
 							.getContext().getSystemService(
 									Context.INPUT_METHOD_SERVICE);
@@ -2185,7 +2206,7 @@ public class PieceActivity extends Activity {
 					return null;
 				}
 			} });
-			CommonUtil.BarcodeMaxLength(barcode, 50);
+			//CommonUtil.BarcodeMaxLength(barcode, 50);
 		}
 		
 		if(requestCode==103&&resultCode==104) {
@@ -2203,7 +2224,7 @@ public class PieceActivity extends Activity {
 					return null;
 				}
 			} });
-			CommonUtil.BarcodeMaxLength(barcode, 50);	
+			//CommonUtil.BarcodeMaxLength(barcode, 50);	
 		}
 		if (requestCode == 102 && resultCode == RESULT_OK) {
 			Bundle bundle = intent.getExtras();
@@ -2364,7 +2385,7 @@ public class PieceActivity extends Activity {
 									return null;
 								}
 							} });
-							CommonUtil.BarcodeMaxLength(barcode, 50);
+							//CommonUtil.BarcodeMaxLength(barcode, 50);
 						
 							CommonUtil.setDefault(Notification.DEFAULT_VIBRATE,
 									getApplicationContext());
@@ -2422,7 +2443,7 @@ public class PieceActivity extends Activity {
 							return null;
 						}
 					} });
-					CommonUtil.BarcodeMaxLength(barcode, 50);
+					//CommonUtil.BarcodeMaxLength(barcode, 50);
 					return;
 
 				}

+ 33 - 4
src/com/jiaju/activity/ProductPathActivity.java

@@ -109,7 +109,7 @@ public class ProductPathActivity extends Activity {
 		SysApplication.getInstance().addActivity(this);
 		listItem = new ArrayList<HashMap<String, Object>>();
 		initview();
-		CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
+		//CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
 		title.setText("产品跟踪");
 		title.setTextSize(24);
 		alllistener();
@@ -290,7 +290,26 @@ public class ProductPathActivity extends Activity {
 							return source.length() < 1 ? dest.subSequence(dstart, dend) : "";
 						}
 					} });
-
+					 if(barcode.length() >= 73)
+			  			{
+			 				String[] parts = barcode.split("-", 2); // 第二个参数限制分割后的数组长度,这里为2  
+			  				  
+			 	        if (parts.length == 2) {  
+			 		            //System.out.println("第一部分: " + parts[0]);  
+			 		            //System.out.println("第二部分: " + parts[1]);  
+			 		            barcode = parts[1];
+			 		        }  
+			 			}
+					 if(barcode.length() >= 73)
+			  			{
+			 				String[] parts = barcode.split("-", 2); // 第二个参数限制分割后的数组长度,这里为2  
+			  				  
+			 	        if (parts.length == 2) {  
+			 		            //System.out.println("第一部分: " + parts[0]);  
+			 		            //System.out.println("第二部分: " + parts[1]);  
+			 		            barcode = parts[1];
+			 		        }  
+			 			}
 					thread = null;
 					thread = new HandlerThread("BarCoderThread", 5);
 					thread.start();
@@ -460,7 +479,7 @@ public class ProductPathActivity extends Activity {
 								return null;
 							}
 						} });
-						CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
+						//CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
 						InputMethodManager im = (InputMethodManager) barcodeEdt.getContext()
 								.getSystemService(Context.INPUT_METHOD_SERVICE);
 						im.hideSoftInputFromWindow(barcodeEdt.getWindowToken(),
@@ -510,7 +529,7 @@ public class ProductPathActivity extends Activity {
 						return null;
 					}
 				} });
-				CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
+				//CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
 				Bundle b1 = msg.getData();
 				String message = b1.getString("message");
 				CustomToast.showToast(getApplicationContext(), message, 2000);
@@ -608,6 +627,16 @@ public class ProductPathActivity extends Activity {
 						return source.length() < 1 ? dest.subSequence(dstart, dend) : "";
 					}
 				} });
+				if(barcode.length() >= 73)
+	 			{
+	 				String[] parts = barcode.split("-", 2); // 第二个参数限制分割后的数组长度,这里为2  
+	 				  
+ 		        if (parts.length == 2) {  
+	 		            //System.out.println("第一部分: " + parts[0]);  
+	 		            //System.out.println("第二部分: " + parts[1]);  
+	 		            barcode = parts[1];
+	 		        }  
+	 			}
 				thread = null;
 				thread = new HandlerThread("BarCoderThread", 5);
 				thread.start();

+ 12 - 12
src/com/jiaju/utils/CommonUtil.java

@@ -1203,7 +1203,7 @@ public class CommonUtil {
 											}
 										} });
 
-								CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
+								//CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
 								if (bugnoEdt != null) {
 									bugnoEdt.setEnabled(true);
 									bugnoEdt.setText("");
@@ -1292,7 +1292,7 @@ public class CommonUtil {
 											}
 										} });
 
-								CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
+								//CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
 								if (bugnoEdt != null) {
 									bugnoEdt.setEnabled(true);
 									bugnoEdt.setText("");
@@ -1515,7 +1515,7 @@ public class CommonUtil {
 											}
 										} });
 
-								CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
+								//CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
 								InputMethodManager im = (InputMethodManager) barcodeEdt
 										.getContext().getSystemService(
 												Context.INPUT_METHOD_SERVICE);
@@ -1581,7 +1581,7 @@ public class CommonUtil {
 											}
 										} });
 
-								CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
+								//CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
 
 								InputMethodManager im = (InputMethodManager) barcodeEdt
 										.getContext().getSystemService(
@@ -1665,7 +1665,7 @@ public class CommonUtil {
 										}
 									} });
 
-							CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
+							//CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
 							InputMethodManager im = (InputMethodManager) barcodeEdt
 									.getContext().getSystemService(
 											Context.INPUT_METHOD_SERVICE);
@@ -1725,7 +1725,7 @@ public class CommonUtil {
 										}
 									} });
 
-							CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
+							//CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
 
 							InputMethodManager im = (InputMethodManager) barcodeEdt
 									.getContext().getSystemService(
@@ -1823,7 +1823,7 @@ public class CommonUtil {
 												return null;
 											}
 										} });
-								CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
+								//CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
 
 							}
 							return;
@@ -1868,7 +1868,7 @@ public class CommonUtil {
 												return null;
 											}
 										} });
-								CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
+								//CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
 
 							}
 							return;
@@ -1935,7 +1935,7 @@ public class CommonUtil {
 													return null;
 												}
 											} });
-									CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
+									//CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
 
 								}
 							}
@@ -1959,7 +1959,7 @@ public class CommonUtil {
 												return null;
 											}
 										} });
-								CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
+								//CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
 							}
 							return;
 						}
@@ -2004,7 +2004,7 @@ public class CommonUtil {
 													return null;
 												}
 											} });
-									CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
+									//CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
 
 								}
 							} else if (deliveryType == 1) {
@@ -2026,7 +2026,7 @@ public class CommonUtil {
 												return null;
 											}
 										} });
-								CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
+								//CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
 							}
 							return;
 						}