Переглянути джерело

注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 рік тому
батько
коміт
1dbfdabb24

+ 24 - 6
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;
@@ -218,9 +218,19 @@ public class ExternalPackingBarcodePrintActivity extends Activity {
 						if (barcodePrintInfoList != null
 								&& barcodePrintInfoList.size() > 0) {
 							barcodePrintInfoList.clear();
-						}
+						} 
 						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);
@@ -325,7 +335,7 @@ public class ExternalPackingBarcodePrintActivity extends Activity {
 												return null;
 											}
 										} });
-								CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
+								//CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
 								CustomToast.showToast(getApplicationContext(),
 										"条码不能为空", 2000);
 								return true;
@@ -338,7 +348,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);
 							thread = new HandlerThread("barcodeThread", 5);
@@ -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);

+ 42 - 10
src/com/jiaju/activity/FinishedProductHandOverActivity.java

@@ -111,8 +111,9 @@ 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);
+		orderEdt.findFocus(); 
 		allListeners();
 		thread = new HandlerThread("trademarkThread", 5);
 		thread.start();
@@ -365,6 +366,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 +386,17 @@ 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 +434,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);
@@ -748,8 +778,9 @@ public class FinishedProductHandOverActivity extends Activity {
 
 						return null;
 					}
-				} });
-				CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
+				//} });
+				//CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
+				}}); 
 				break;
 			case 1:
 				Bundle b1 = msg.getData();
@@ -848,10 +879,10 @@ public class FinishedProductHandOverActivity extends Activity {
 
 											return null;
 										}
-									} });
+									//} });
 								
-									CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
-
+									//CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
+									} });
 									return;
 
 								}
@@ -886,7 +917,7 @@ public class FinishedProductHandOverActivity extends Activity {
 							info.setUserCode(groutingUserCode);
 							info.setMouldCode(mouldCode);
 							info.setGroutingDate(groutingDate);
-							info.setDeliverTime(diliverTime);
+							info.setDeliverTime(diliverTime); 
 							//info.setBarcodeLimitNum(limitNum);
 
 //							if (trademarkSettingValue != null && trademarkSettingValue.equals("1")) {
@@ -1071,8 +1102,9 @@ public class FinishedProductHandOverActivity extends Activity {
 
 									return null;
 								}
+							
+							//CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
 							} });
-							CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
 						}
 
 					}
@@ -1223,7 +1255,7 @@ public class FinishedProductHandOverActivity extends Activity {
 					return null;
 				}
 			} });
-			CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
+			//CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
 
 		}
 	}

+ 39 - 17
src/com/jiaju/activity/PieceActivity.java

@@ -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());
@@ -597,6 +597,7 @@ public class PieceActivity extends Activity {
 				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() {
@@ -660,6 +661,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 +786,7 @@ public class PieceActivity extends Activity {
 										return null;
 									}
 								} });
-								CommonUtil.BarcodeMaxLength(barcode, 50);
+								//CommonUtil.BarcodeMaxLength(barcode, 50);;
 								CommonUtil.setDefault(
 										Notification.DEFAULT_VIBRATE,
 										getApplicationContext());
@@ -833,6 +841,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
@@ -890,7 +905,14 @@ public class PieceActivity extends Activity {
 							return true;
 						}
 
-						String etcode = barcode.getText().toString().trim();
+						String etcode = barcode.getText().toString().trim().replaceAll("\\n", "");
+						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 +989,7 @@ public class PieceActivity extends Activity {
 											return null;
 										}
 									} });
-									CommonUtil.BarcodeMaxLength(barcode, 50);
+									//CommonUtil.BarcodeMaxLength(barcode, 50);;
 									CommonUtil.setDefault(
 											Notification.DEFAULT_VIBRATE,
 											getApplicationContext());
@@ -1031,7 +1053,7 @@ public class PieceActivity extends Activity {
 									return null;
 								}
 							} });
-							CommonUtil.BarcodeMaxLength(barcode, 50);
+							//CommonUtil.BarcodeMaxLength(barcode, 50);;
 							return true;
 
 						}
@@ -1079,7 +1101,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 +1233,7 @@ public class PieceActivity extends Activity {
 						return null;
 					}
 				} });
-				CommonUtil.BarcodeMaxLength(barcode, 50);
+				//CommonUtil.BarcodeMaxLength(barcode, 50);;
 				break;
 			case 1:
 				ProcessDialogUtils.closeProgressDilog();
@@ -1258,7 +1280,7 @@ public class PieceActivity extends Activity {
 					}
 				} });
 
-				CommonUtil.BarcodeMaxLength(barcode, 50);
+				//CommonUtil.BarcodeMaxLength(barcode, 50);;
 				break;
 
 			case 2:
@@ -1406,7 +1428,7 @@ public class PieceActivity extends Activity {
 										return null;
 									}
 								} });
-								CommonUtil.BarcodeMaxLength(barcode, 50);
+								////CommonUtil.BarcodeMaxLength(barcode, 50);;
 
 							}
 
@@ -1577,7 +1599,7 @@ public class PieceActivity extends Activity {
 											return null;
 										}
 									} });
-									CommonUtil.BarcodeMaxLength(barcode, 50);	
+									////CommonUtil.BarcodeMaxLength(barcode, 50);;	
 								}
 //								如果是水校标识界面过来的  barcode成功返回后 直接关闭界面
 								if("wangyingjie".equals(NewWaterEfficiencyLabelActivity)) {
@@ -1676,7 +1698,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);
@@ -2192,7 +2214,7 @@ public class PieceActivity extends Activity {
 					return null;
 				}
 			} });
-			CommonUtil.BarcodeMaxLength(barcode, 50);
+			////CommonUtil.BarcodeMaxLength(barcode, 50);;
 		}
 		
 		if(requestCode==103&&resultCode==104) {
@@ -2210,7 +2232,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();
@@ -2338,7 +2360,7 @@ public class PieceActivity extends Activity {
 //								return null;
 //							}
 //						} });
-//						CommonUtil.BarcodeMaxLength(barcode, 50);
+//						//CommonUtil.BarcodeMaxLength(barcode, 50);;
 //						return;
 //					}
 
@@ -2371,7 +2393,7 @@ public class PieceActivity extends Activity {
 									return null;
 								}
 							} });
-							CommonUtil.BarcodeMaxLength(barcode, 50);
+							////CommonUtil.BarcodeMaxLength(barcode, 50);;
 						
 							CommonUtil.setDefault(Notification.DEFAULT_VIBRATE,
 									getApplicationContext());
@@ -2429,7 +2451,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();
@@ -232,6 +232,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();
@@ -290,7 +300,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();
@@ -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

@@ -1217,7 +1217,7 @@ public class CommonUtil {
 											}
 										} });
 
-								CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
+								//CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
 								if (bugnoEdt != null) {
 									bugnoEdt.setEnabled(true);
 									bugnoEdt.setText("");
@@ -1306,7 +1306,7 @@ public class CommonUtil {
 											}
 										} });
 
-								CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
+								//CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
 								if (bugnoEdt != null) {
 									bugnoEdt.setEnabled(true);
 									bugnoEdt.setText("");
@@ -1529,7 +1529,7 @@ public class CommonUtil {
 											}
 										} });
 
-								CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
+								//CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
 								InputMethodManager im = (InputMethodManager) barcodeEdt
 										.getContext().getSystemService(
 												Context.INPUT_METHOD_SERVICE);
@@ -1595,7 +1595,7 @@ public class CommonUtil {
 											}
 										} });
 
-								CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
+								//CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
 
 								InputMethodManager im = (InputMethodManager) barcodeEdt
 										.getContext().getSystemService(
@@ -1679,7 +1679,7 @@ public class CommonUtil {
 										}
 									} });
 
-							CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
+							//CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
 							InputMethodManager im = (InputMethodManager) barcodeEdt
 									.getContext().getSystemService(
 											Context.INPUT_METHOD_SERVICE);
@@ -1739,7 +1739,7 @@ public class CommonUtil {
 										}
 									} });
 
-							CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
+							//CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
 
 							InputMethodManager im = (InputMethodManager) barcodeEdt
 									.getContext().getSystemService(
@@ -1837,7 +1837,7 @@ public class CommonUtil {
 												return null;
 											}
 										} });
-								CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
+								//CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
 
 							}
 							return;
@@ -1882,7 +1882,7 @@ public class CommonUtil {
 												return null;
 											}
 										} });
-								CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
+								//CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
 
 							}
 							return;
@@ -1949,7 +1949,7 @@ public class CommonUtil {
 													return null;
 												}
 											} });
-									CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
+									//CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
 
 								}
 							}
@@ -1973,7 +1973,7 @@ public class CommonUtil {
 												return null;
 											}
 										} });
-								CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
+								//CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
 							}
 							return;
 						}
@@ -2018,7 +2018,7 @@ public class CommonUtil {
 													return null;
 												}
 											} });
-									CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
+									//CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
 
 								}
 							} else if (deliveryType == 1) {
@@ -2040,7 +2040,7 @@ public class CommonUtil {
 												return null;
 											}
 										} });
-								CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
+								//CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
 							}
 							return;
 						}