Răsfoiți Sursa

质量等级 增加 裸辞标识

姜永辉 5 zile în urmă
părinte
comite
fb5ad76d74

+ 31 - 1
res/layout/update_check_collect.xml

@@ -343,7 +343,37 @@
                         android:background="@drawable/spinner_drop_down" />
                 </LinearLayout>
 
-                    
+                 <LinearLayout
+                    android:layout_width="fill_parent"
+                    android:layout_height="wrap_content" >
+
+                    <com.jiaju.widget.JustifyTextView
+                        android:id="@+id/check_luoci_title"
+                        android:layout_width="70dip"
+                        android:layout_height="wrap_content"
+                        android:layout_gravity="center_vertical"
+                        android:layout_marginLeft="10dip"
+                        android:text="裸瓷标识"
+                        android:textColor="@color/white"
+                        android:textSize="@dimen/textsize_16" />
+
+                    <TextView
+                        android:id="@+id/symbolluoci"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:layout_gravity="center_vertical"
+                        android:text=":"
+                        android:textColor="@color/white"
+                        android:textSize="@dimen/textsize_16" />
+
+                    <Spinner
+                        android:id="@+id/check_luoci"
+                        android:layout_width="fill_parent"
+                        android:layout_height="40dp"
+                        android:layout_marginLeft="8dip"
+                        android:layout_marginRight="10dip"
+                        android:background="@drawable/spinner_drop_down" />
+                </LinearLayout>   
                 
                 <LinearLayout
                     android:id="@+id/refinelay"

+ 73 - 5
src/com/jiaju/activity/CheckCollectAddActivity.java

@@ -10,6 +10,7 @@ import java.util.List;
 import org.json.JSONArray;
 import org.json.JSONException;
 import org.json.JSONObject;
+ 
 import com.jiaju.adapter.ProductClassifyAdapter;
 import com.jiaju.adapter.ReworkProcedureSpinnerAdapter;
 import com.jiaju.adapter.SwipeAdapter;
@@ -109,11 +110,15 @@ public class CheckCollectAddActivity extends Activity {
 	private TextView productCode;
 	private SwipeAdapter mAdapter;
 	private int defectflag = 1;
+	private int luociFlag = 0; // 0非裸瓷 1裸瓷
 	private List<ProductClassifyInfo> listProductClassify = null;
+	private List<ProductClassifyInfo> listLuoci = null;// 裸瓷数据源
 	private String defectLocation;
 	private Spinner classifySpin;
+	private Spinner checkLuociSpin;// 裸瓷标识
 	private ProductClassifyInfo classifyInfo = null;
 	private ProductClassifyAdapter adapterProductClassify;
+	private ProductClassifyAdapter adapterProductLuoci;
 	private Button recordBug;// 记录缺陷按钮
 	private SwipeListView mListView;
 	private int modelType;
@@ -208,7 +213,13 @@ public class CheckCollectAddActivity extends Activity {
 		}
 		CommonUtil.BarcodeMaxLength(barcode, 50);
 		AllListeners();
-
+		// LoadRunnable 裸瓷交接 提供数据源
+				// start -----------------
+			HandlerThread thread = new HandlerThread("trademarkThread", 5);
+				thread.start();
+				mHandler = new Handler(thread.getLooper());
+				LoadRunnable loadRunnable = new LoadRunnable();
+				mHandler.post(loadRunnable);
 //		 List<String> sqllist = new ArrayList<String>();
 //	        sqllist.add(DbUtil.logSqlString);
 //	        
@@ -233,6 +244,7 @@ public class CheckCollectAddActivity extends Activity {
 		save = (Button) findViewById(R.id.check_save);
 		back = (TextView) findViewById(R.id.back);
 		classifySpin = (Spinner) findViewById(R.id.check_classify);
+		checkLuociSpin= (Spinner) findViewById(R.id.check_luoci);
 		productNumber = (TextView) findViewById(R.id.check_product_number);
 		productCode = (TextView) findViewById(R.id.check_product_code);
 		mListView = (SwipeListView) findViewById(R.id.listview);
@@ -1539,8 +1551,9 @@ public class CheckCollectAddActivity extends Activity {
 							}
 						}
 						}
-						
-						if((!isModify)&&(GoodsLevelTypeID==originalGoodsLevelTypeId))
+						ProductClassifyInfo pClassifyInfo =  (ProductClassifyInfo) checkLuociSpin.getSelectedItem();
+						if((!isModify)&&(GoodsLevelTypeID==originalGoodsLevelTypeId)
+								&&  luociFlag == pClassifyInfo.getDefectFlagId() 	)
 						{
 							CustomToast.showToast(getApplicationContext(),
 									"数据没有修改不能保存", 2000);
@@ -2112,6 +2125,8 @@ public class CheckCollectAddActivity extends Activity {
 								productionDefects);
 
 					}
+					ProductClassifyInfo pClassifyInfo =  (ProductClassifyInfo) checkLuociSpin.getSelectedItem();
+				    productionData.put("LuociFlag", pClassifyInfo.getDefectFlagId());// 裸瓷标识
 					productionDataEntitys.put(productionData);
 					jsonObject.put("productionDataEntitys",
 							productionDataEntitys);
@@ -2888,7 +2903,16 @@ private static class ResultHandler extends Handler {
 					activity.classifySpin.setPrompt("请选择产品分级");
 					activity.classifySpin.setEnabled(true);
 				}
-
+				for (int i = 0; i < activity.listLuoci.size(); i++) {
+					if ((activity.listLuoci.get(i).getDefectFlagId() + "")
+						.equals(activity.luociFlag + "")) {
+					    activity.adapterProductLuoci = new ProductClassifyAdapter(
+						    activity.listLuoci, activity.getApplicationContext());
+					    activity.checkLuociSpin.setAdapter(activity.adapterProductLuoci);
+					    activity.checkLuociSpin.setPrompt("请选择");
+					    activity.checkLuociSpin.setSelection(i, true);
+					}
+				}
 				if (activity.operationFlag.equals("modify")) {
 
 					if (activity.productionInfo != null) {
@@ -3483,6 +3507,27 @@ private static class ResultHandler extends Handler {
 				try {
 					WebClient	client = null;
 					client = new WebClient();
+					// 裸瓷 
+					JSONObject jsonObjectLuoci = new JSONObject();
+					jsonObjectLuoci.put("accountCode", accountCode);
+					jsonObjectLuoci.put("userCode", checkCollectAdd_userCode);
+					jsonObjectLuoci.put("userPassword", password);
+					jsonObjectLuoci.put("sessionKey", sessionkey);
+					jsonObjectLuoci.put("procedureID", proId);// 工序ID,菜单页面传过来的
+					jsonObjectLuoci.put("barcode", barcode);// 产品条码 		
+					
+					String resultLuoci = client.doPost(
+						"http://" + ServerAddress_ip + ":" + ServerAddress_duankou + Constants.BAR_CODE_VALID,
+						jsonObjectLuoci.toString(), "application/json");
+					JSONObject jsonObjectLuociR = new JSONObject(resultLuoci);
+					JSONObject jsonObjectLuociRD = jsonObjectLuociR.getJSONObject("d");
+					String rd = jsonObjectLuociRD.getString("Result");
+					JSONArray jsonArrayLuoci = new JSONArray(rd);
+					JSONObject jsLuoci = (JSONObject) jsonArrayLuoci.get(0);
+					luociFlag = jsLuoci.getInt("LuociFlag");
+					
+					client = null;
+					client = new WebClient();
 					JSONObject js = new JSONObject();
 					js.put("accountCode", accountCode);
 					js.put("userCode", checkCollectAdd_userCode);
@@ -5421,7 +5466,30 @@ private static class ResultHandler extends Handler {
 
 	};
 
-	
+	// 调用数据源 裸瓷
+    private class LoadRunnable implements Runnable {
+    	public LoadRunnable() {
+
+    	}
+    	@Override
+    	public void run() {
+    		// 代码块 给 下线标识 赋值(写死 1:裸瓷 0:非裸瓷)    		
+    		ProductClassifyInfo classifyInfo;
+    		listLuoci = new ArrayList<ProductClassifyInfo>();// 试水不合格位置数据源
+		    classifyInfo = new ProductClassifyInfo(); 
+		    classifyInfo.setDefectFlagName("非裸瓷");
+		    classifyInfo.setDefectFlagId(0);
+		    listLuoci.add(classifyInfo);
+		    classifyInfo = new ProductClassifyInfo(); 
+		    classifyInfo.setDefectFlagName("裸瓷");
+		    classifyInfo.setDefectFlagId(1);
+		    listLuoci.add(classifyInfo);
+		    adapterProductLuoci = new ProductClassifyAdapter(listLuoci, getApplicationContext());
+			checkLuociSpin.setAdapter(adapterProductLuoci);
+			
+		    
+    	}    	
+    }
 
 	@SuppressWarnings("unchecked")
 	@Override

+ 78 - 7
src/com/jiaju/activity/CheckCollectModifyActivity.java

@@ -10,7 +10,7 @@ import java.util.List;
 import org.json.JSONArray;
 import org.json.JSONException;
 import org.json.JSONObject;
-
+ 
 import com.jiaju.adapter.ProductClassifyAdapter;
 import com.jiaju.adapter.ReworkProcedureSpinnerAdapter;
 import com.jiaju.adapter.SwipeAdapter;
@@ -102,13 +102,17 @@ public class CheckCollectModifyActivity extends Activity {
     private TextView productCode;
     private SwipeAdapter mAdapter;
     private int defectflag = 1;
+    private int luociFlag = 0; // 0非裸瓷 1裸瓷
     private List<ProductClassifyInfo> listProductClassify = null;
     private List<ProductClassifyInfo> listMissedDetection = null;
+    private List<ProductClassifyInfo> listLuoci = null;// 裸瓷数据源
     private String defectLocation;
     private Spinner classifySpin;
+    private Spinner checkLuociSpin;// 裸瓷标识
     private ProductClassifyInfo classifyInfo = null;
     private ProductClassifyAdapter adapterProductClassify;
     private ProductClassifyAdapter adapterMissedDetection;
+    private ProductClassifyAdapter adapterProductLuoci;
     private Button recordBug;// 记录缺陷按钮
     private SwipeListView mListView;
     private int modelType;
@@ -214,7 +218,13 @@ public class CheckCollectModifyActivity extends Activity {
 //	        		savePath+"meslog.db", 1);
 //	        dataBaseOpenHelper.createTable(sqllist);
 	AllListeners();
-
+	// LoadRunnable 裸瓷交接 提供数据源
+		// start -----------------
+	HandlerThread thread = new HandlerThread("trademarkThread", 5);
+		thread.start();
+		mHandler = new Handler(thread.getLooper());
+		LoadRunnable loadRunnable = new LoadRunnable();
+		mHandler.post(loadRunnable);
     }
 
     private void initView() {
@@ -228,6 +238,7 @@ public class CheckCollectModifyActivity extends Activity {
 	save = (Button) findViewById(R.id.check_save);
 	back = (TextView) findViewById(R.id.back);
 	classifySpin = (Spinner) findViewById(R.id.check_classify);
+	checkLuociSpin= (Spinner) findViewById(R.id.check_luoci);
 	productNumber = (TextView) findViewById(R.id.check_product_number);
 	productCode = (TextView) findViewById(R.id.check_product_code);
 	mListView = (SwipeListView) findViewById(R.id.listview);
@@ -1300,8 +1311,9 @@ public class CheckCollectModifyActivity extends Activity {
 				}
 			    }
 			}
-
-			if ((!isModify) && (!deleteFlag) && (GoodsLevelTypeID == originalGoodsLevelTypeId)) {
+			ProductClassifyInfo pClassifyInfo =  (ProductClassifyInfo) checkLuociSpin.getSelectedItem();
+			if ((!isModify) && (!deleteFlag) && (GoodsLevelTypeID == originalGoodsLevelTypeId) 
+					&&  luociFlag == pClassifyInfo.getDefectFlagId()    ) {
 			    CustomToast.showToast(getApplicationContext(), "数据没有修改不能保存", 2000);
 			    return;
 			}
@@ -1711,6 +1723,8 @@ public class CheckCollectModifyActivity extends Activity {
 			productionData.put("ProductionDefects", productionDefects);
 
 		    }
+		    ProductClassifyInfo pClassifyInfo =  (ProductClassifyInfo) checkLuociSpin.getSelectedItem();
+		    productionData.put("LuociFlag", pClassifyInfo.getDefectFlagId());// 裸瓷标识
 		    productionDataEntitys.put(productionData);
 		    jsonObject.put("productionDataEntitys", productionDataEntitys);
 
@@ -2444,6 +2458,17 @@ public class CheckCollectModifyActivity extends Activity {
 		    activity.classifySpin.setSelection(position);
 		    activity.classifySpin.setEnabled(true);
 		}
+		
+		for (int i = 0; i < activity.listLuoci.size(); i++) {
+			if ((activity.listLuoci.get(i).getDefectFlagId() + "")
+				.equals(activity.luociFlag + "")) {
+			    activity.adapterProductLuoci = new ProductClassifyAdapter(
+				    activity.listLuoci, activity.getApplicationContext());
+			    activity.checkLuociSpin.setAdapter(activity.adapterProductLuoci);
+			    activity.checkLuociSpin.setPrompt("请选择");
+			    activity.checkLuociSpin.setSelection(i, true);
+			}
+		}
 
 		// endTime=System.currentTimeMillis();
 		// long time=endTime-startTime;
@@ -2940,10 +2965,30 @@ public class CheckCollectModifyActivity extends Activity {
 	@Override
 	public void run() {
 	    synchronized (obj) {
-		try {
-
-		    WebClient client = null;
+		try {	
+			WebClient client = null;
 		    client = new WebClient();
+			// 裸瓷 
+			JSONObject jsonObjectLuoci = new JSONObject();
+			jsonObjectLuoci.put("accountCode", accountCode);
+			jsonObjectLuoci.put("userCode", checkCollectModify_userCode);
+			jsonObjectLuoci.put("userPassword", password);
+			jsonObjectLuoci.put("sessionKey", sessionkey);
+			jsonObjectLuoci.put("procedureID", proId);// 工序ID,菜单页面传过来的
+			jsonObjectLuoci.put("barcode", barcode);// 产品条码 		
+			
+			String resultLuoci = client.doPost(
+				"http://" + ServerAddress_ip + ":" + ServerAddress_duankou + Constants.BAR_CODE_VALID,
+				jsonObjectLuoci.toString(), "application/json");
+			JSONObject jsonObjectLuociR = new JSONObject(resultLuoci);
+			JSONObject jsonObjectLuociRD = jsonObjectLuociR.getJSONObject("d");
+			String rd = jsonObjectLuociRD.getString("Result");
+			JSONArray jsonArrayLuoci = new JSONArray(rd);
+			JSONObject jsLuoci = (JSONObject) jsonArrayLuoci.get(0);
+			luociFlag = jsLuoci.getInt("LuociFlag");			
+
+			client = null;
+			client = new WebClient();
 		    JSONObject js = new JSONObject();
 		    js.put("accountCode", accountCode);
 		    js.put("userCode", checkCollectModify_userCode);
@@ -4413,6 +4458,32 @@ public class CheckCollectModifyActivity extends Activity {
 
     };
 
+    // 调用数据源 裸瓷
+    private class LoadRunnable implements Runnable {
+    	public LoadRunnable() {
+
+    	}
+    	@Override
+    	public void run() {
+    		// 代码块 给 下线标识 赋值(写死 1:裸瓷 0:非裸瓷)    		
+    		ProductClassifyInfo classifyInfo;
+    		listLuoci = new ArrayList<ProductClassifyInfo>();// 试水不合格位置数据源
+		    classifyInfo = new ProductClassifyInfo(); 
+		    classifyInfo.setDefectFlagName("非裸瓷");
+		    classifyInfo.setDefectFlagId(0);
+		    listLuoci.add(classifyInfo);
+		    classifyInfo = new ProductClassifyInfo(); 
+		    classifyInfo.setDefectFlagName("裸瓷");
+		    classifyInfo.setDefectFlagId(1);
+		    listLuoci.add(classifyInfo);
+		    adapterProductLuoci = new ProductClassifyAdapter(listLuoci, getApplicationContext());
+			checkLuociSpin.setAdapter(adapterProductLuoci);
+			
+		    
+    	}    	
+    }
+    
+    
     @SuppressWarnings("unchecked")
     @Override
     protected void onActivityResult(int requestCode, int resultCode, Intent data) {

+ 9 - 0
src/com/jiaju/model/ProductionInfo.java

@@ -20,6 +20,15 @@ public class ProductionInfo implements Serializable {
 	private String GoodsCode;
 	private String GoodsName;
 	private int DefectFlagId;
+	private int luociFlag;
+	public int getLuociFlag() {
+		return luociFlag;
+	}
+
+	public void setLuociFlag(int luociFlag) {
+		this.luociFlag = luociFlag;
+	}
+
 	private int ReworkProcedureId;
 	private String ReworkPocedureName;
 	private String SemiCheckUserId;