Browse Source

裸瓷交接

姜永辉 5 months ago
parent
commit
c23ef4cd48

+ 8 - 0
AndroidManifest.xml

@@ -680,6 +680,14 @@
             android:name=".ClockInActivity"
             >
         </activity>
+         <activity
+            android:name=".LuociPriceActivity"
+            >
+        </activity>
+        <activity
+            android:name=".LuociRevokeActivity"
+            >
+        </activity>
     </application>
 
 </manifest>

+ 87 - 0
res/layout/finished_product_handover_head_viewluoci.xml

@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical" >
+
+  
+ 
+
+    <LinearLayout
+        android:id="@+id/barcodelay"
+        android:layout_width="fill_parent"
+        android:layout_height="wrap_content"
+        android:orientation="horizontal" >
+
+        <com.jiaju.widget.JustifyTextView
+            android:id="@+id/barcodeTitle"
+            android:layout_width="80dp"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="10dp"
+            android:layout_marginTop="5dp"
+            android:text="包装条码"
+            android:textColor="@color/white"
+            android:textSize="@dimen/textsize_16" />
+
+        <TextView
+            android:id="@+id/symbol1"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_centerVertical="true"
+            android:layout_marginTop="5dp"
+            android:text=":"
+            android:textColor="@color/white"
+            android:textSize="@dimen/textsize_16" />
+
+        <LinearLayout
+            android:layout_width="fill_parent"
+            android:layout_height="wrap_content"
+            android:orientation="vertical" >
+
+            <EditText
+                android:id="@+id/barcodeEdt"
+                android:layout_width="fill_parent"
+                android:layout_height="wrap_content"
+                android:layout_marginRight="10dp"
+                android:background="@null"
+                android:imeOptions="actionGo"
+                android:singleLine="true"
+                android:text=""
+                android:textColor="@color/white"
+                android:textSize="@dimen/textsize_24" />
+
+            <View
+                android:layout_width="fill_parent"
+                android:layout_height="1dp"
+                android:background="@color/text_gray" />
+        </LinearLayout>
+    </LinearLayout>
+
+    <LinearLayout
+        android:id="@+id/lin3"
+        android:layout_width="fill_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="12dp"
+        android:orientation="vertical" >
+
+        <View
+            android:layout_width="fill_parent"
+            android:layout_height="1dp"
+            android:background="@color/text_gray" />
+
+        <TextView
+            android:layout_width="fill_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="10dp"
+            android:layout_marginRight="10dp"
+            android:text="产品信息:"
+            android:textColor="@color/white"
+            android:textSize="@dimen/textsize_16" />
+
+        <View
+            android:layout_width="fill_parent"
+            android:layout_height="1dp"
+            android:background="@color/text_gray" />
+    </LinearLayout>
+
+</LinearLayout>

+ 47 - 0
res/layout/piece_head_view.xml

@@ -92,6 +92,53 @@
              />
 
      </LinearLayout>
+     
+            <LinearLayout 
+      android:id="@+id/baozhuang"
+                    android:layout_width="fill_parent"
+                    android:layout_height="wrap_content"
+                    android:layout_marginTop="3dp"
+                    android:orientation="horizontal"
+                      android:visibility="gone"  >
+
+                 <com.jiaju.widget.JustifyTextView 
+                    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: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" />
+
+              <LinearLayout
+                  android:id="@+id/mouldCodeLay"
+                  android:layout_width="fill_parent"
+                  android:layout_height="wrap_content"
+                  android:orientation="vertical" >
+
+                  <Spinner
+                  android:id="@+id/trademarksource"
+                  android:layout_width="fill_parent"
+                  android:layout_height="40dp"
+                  android:layout_marginRight="10dp"
+                  android:background="@drawable/spinner_drop_down" />
+
+                  <View
+                      android:layout_width="wrap_content"
+                      android:layout_height="1dp"
+                      android:layout_marginRight="10dp"
+                      android:layout_marginTop="1dp"
+                      android:background="@color/text_gray" />
+             </LinearLayout>
+     </LinearLayout> 
          <LinearLayout 
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"

+ 36 - 3
src/com/jiaju/activity/HomeActivity.java

@@ -58,6 +58,7 @@ public class HomeActivity extends Activity {
 	private ProductLineModel productSuspend;
 	private ProductLineModel groutingPm;
 	private ProductLineModel calloutPm;
+	private ProductLineModel LCFinishedProduct;//Âă´Ç˝ť˝ÓÄŁżé
 	private List<ProductLineModel> productLineList = new ArrayList<ProductLineModel>();
 	private List<ProductLineModel> otherProductLineList = new ArrayList<ProductLineModel>();
 	private List<ProductLineModel> originalProductLineList = new ArrayList<ProductLineModel>();
@@ -290,7 +291,7 @@ public class HomeActivity extends Activity {
 
 				List<ProcedureModel> reportlist = new ArrayList<ProcedureModel>();
 				List<ProcedureModel> mouldManageProcedureList = new ArrayList<ProcedureModel>();
-				List<ProcedureModel> spotCheckProcedureList = new ArrayList<ProcedureModel>();
+				List<ProcedureModel> spotCheckProcedureList = new ArrayList<ProcedureModel>();			
 				if (status1 == 0) {
 					String result10 = jo1.optString("Result");
 					JSONObject jo2 = new JSONObject(result10);
@@ -304,6 +305,7 @@ public class HomeActivity extends Activity {
 						List<ProcedureModel> suspendProcedurelList = new ArrayList<ProcedureModel>();
 						List<ProcedureModel> semiCheckReworkList = new ArrayList<ProcedureModel>();
 						List<ProcedureModel>  calloutList=new ArrayList<ProcedureModel>();
+						List<ProcedureModel> LCBZList = new ArrayList<ProcedureModel>();
 						for (int i = 0; i < jarray.length(); i++) {
 							JSONObject jo3 = jarray.optJSONObject(i);
 							String functionname = jo3.optString("FUNCTIONNAME");
@@ -762,7 +764,31 @@ public class HomeActivity extends Activity {
 								pm18.setProcedureId(106);
 								groutinglist.add(pm18);	
 							}
-
+							else if (functionCode.equals("0634")) { //Âă´É˝ť˝Ó
+								LCFinishedProduct = new ProductLineModel();
+								LCFinishedProduct.setProductLineMenuCode(functionCode);
+								LCFinishedProduct.setProductionMenuName("Âă´É˝ť˝Ó");
+								LCFinishedProduct.setProcedureList(null);
+								productLineList.add(LCFinishedProduct);
+							} else if (functionCode.equals("063401")) // Âă´É˝ť˝Ó-˝ť˝Ó
+							{
+								ProcedureModel pm21 = new ProcedureModel();
+								pm21.setProcedureMenuCode(functionCode);
+								pm21.setProcedureMenuName("˝ť˝Ó");
+								pm21.setProcedureModel("00" + 104);
+								pm21.setModelType(103);
+								pm21.setProcedureId(103);
+								LCBZList.add(pm21);
+							}else if (functionCode.equals("063402")) // Âă´É˝ť˝Ó-łˇĎú
+							{
+								ProcedureModel pm22 = new ProcedureModel();
+								pm22.setProcedureMenuCode(functionCode);
+								pm22.setProcedureMenuName("łˇĎú");
+								pm22.setProcedureModel("00" + 104);
+								pm22.setModelType(103);
+								pm22.setProcedureId(103);
+								LCBZList.add(pm22);
+							}
 						
 							else {
 								ProductLineModel pm1 = new ProductLineModel();
@@ -805,7 +831,14 @@ public class HomeActivity extends Activity {
 								
 								}
 						}
-							
+						if (LCBZList != null && LCBZList.size() > 0) {
+							for (ProductLineModel model : productLineList) {
+								if (model.getProductLineMenuCode().equals("0634")) {
+									model.setProcedureList(LCBZList);
+								}
+
+							}
+						}	
 						productLineList.addAll(otherProductLineList);
 						
 

+ 823 - 0
src/com/jiaju/activity/LuociPriceActivity.java

@@ -0,0 +1,823 @@
+package com.jiaju.activity;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import com.jiaju.adapter.HandOverAdapter;
+import com.jiaju.adapter.OrderSpinnerAdapter;
+import com.jiaju.adapter.SapSpinnerAdapter;
+import com.jiaju.model.BarcodeInfo;
+import com.jiaju.model.Order;
+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 android.app.Activity;
+import android.app.Notification;
+import android.content.Context;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.content.SharedPreferences.Editor;
+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.KeyEvent;
+import android.view.Menu;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.inputmethod.EditorInfo;
+import android.widget.AdapterView;
+import android.widget.AdapterView.OnItemSelectedListener;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.ImageButton;
+import android.widget.ImageView;
+import android.widget.ListView;
+import android.widget.RelativeLayout;
+import android.widget.Spinner;
+import android.widget.TextView;
+//裸辞交接
+public class LuociPriceActivity extends Activity {
+	private TextView tvTitle;
+	private String password;
+	private String sessionkey;
+	private SharedPreferences preferences;
+	private String ServerAddress_ip;
+	private String ServerAddress_port;
+	private String accountCode;
+	private String handover_usercode;
+	private HandlerThread thread;
+	private Handler mHandler;
+	private WebClient client;
+	private List<Order> orderList;
+	private Spinner orderSpinner;
+	private SapSpinnerAdapter adapter1;
+	private EditText barcodeEdt;
+	private String barcode;
+	private TextView tvBack;
+	private ImageView ivBack;
+	private Object obj = new Object();
+	private List<BarcodeInfo> barcodeInfoList = new ArrayList<BarcodeInfo>();
+	private ListView barcodeLst;
+	private HandOverAdapter handoverAdapter;
+	private Button saveBtn;
+//	private EditText orderEdt;
+	private boolean orderFlag;
+	private Handler barcodeUpperH = new Handler();
+	private String barcodeUpper;
+	private boolean checkedFlag = false;
+	private boolean isOrderTextChange;
+	private OrderSpinnerAdapter adapter;
+	private boolean isBarcodeTextChange;
+	private RelativeLayout parent; 
+	private static final String[] m = {"APP1", "APP2", "APP3"};
+	private Spinner spinner;
+	private String spinnerName = "APP2";
+	private String spinner_ = "";
+	private boolean first = true;
+	@Override
+	protected void onCreate(Bundle savedInstanceState) {
+		super.onCreate(savedInstanceState);
+		setContentView(R.layout.activity_finished_product_handover); 
+		initView(); 
+		preferences = getSharedPreferences("user", Context.MODE_PRIVATE);
+		ServerAddress_ip = preferences.getString("ServerAddress_ip", "");
+		ServerAddress_port = preferences.getString("ServerAddress_duankou", "");
+		accountCode = preferences.getString("AccountCode", "");
+		handover_usercode = preferences.getString("UserCode", "");
+		password = preferences.getString("UserPassword", "");
+		sessionkey = preferences.getString("SessionKey", ""); 
+		Bundle b = getIntent().getExtras();
+		String title = b.getString("title");
+		tvTitle.setText(title); 
+		allListeners();
+		thread = new HandlerThread("trademarkThread", 5);
+		thread.start();
+		mHandler = new Handler(thread.getLooper());
+		OrderListRunnable orderListRunnable = new OrderListRunnable(obj);
+		mHandler.post(orderListRunnable);
+	} 
+	private void initView() {
+		tvTitle = (TextView) findViewById(R.id.title);
+		ivBack = (ImageButton) findViewById(R.id.left_img);
+		tvBack = (TextView) findViewById(R.id.back);
+		View head = View.inflate(this,
+				R.layout.finished_product_handover_head_viewluoci, null); 
+		barcodeEdt = (EditText) head.findViewById(R.id.barcodeEdt);
+		barcodeEdt.setRawInputType(InputType.TYPE_CLASS_NUMBER);
+		barcodeLst = (ListView) findViewById(R.id.handoverlst);
+		barcodeLst.addHeaderView(head, null, false);
+		handoverAdapter = new HandOverAdapter(
+				LuociPriceActivity.this, barcodeInfoList);
+		barcodeLst.setAdapter(handoverAdapter);
+		saveBtn = (Button) findViewById(R.id.saveBtn); 
+		parent = (RelativeLayout) findViewById(R.id.parentRel); 
+	}
+	private void allListeners() {
+		ivBack.setOnClickListener(new OnClickListener() {
+			@Override
+			public void onClick(View v) {
+				finish();
+			}
+		});
+		tvBack.setOnClickListener(new OnClickListener() {
+			@Override
+			public void onClick(View v) {
+				finish();
+			}
+		}); 
+		saveBtn.setOnClickListener(new View.OnClickListener() {
+			@Override
+			public void onClick(View v) { 
+				int orderId; 
+				if (barcodeInfoList == null || barcodeInfoList.size() == 0) {
+					CustomToast.showToast(getApplicationContext(), "条码信息不能为空",
+							2000);
+					return;
+				}
+				ProcessDialogUtils.showProcessDialog(
+						LuociPriceActivity.this);
+				thread = null;
+				thread = new HandlerThread("saveThread", 5);
+				thread.start();
+				mHandler = new Handler(thread.getLooper());
+				SaveRunnable saveRunnable = new SaveRunnable(obj);
+				mHandler.post(saveRunnable);
+			}
+		}); 
+		barcodeEdt.addTextChangedListener(new TextWatcher() {
+			@Override
+			public void afterTextChanged(Editable arg0) { 
+				
+				
+			}
+			@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 = 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) {
+						barcodeUpperH.postDelayed(UpperCase, 300);
+					}
+				}
+				if (start == 0 && before == 0 && count > 1) {
+					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(
+								LuociPriceActivity.this);
+						barcodeEdt.setEnabled(false);
+						barcodeEdt.setFocusable(false);
+						barcodeEdt.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)
+												: "";
+									}
+								}});
+					
+						thread = new HandlerThread("barcodeThread", 5);
+						thread.start();
+						mHandler = new Handler(thread.getLooper());
+						BarcodeRunnable barcodeRunnable = new BarcodeRunnable(
+								obj, barcode);
+						mHandler.post(barcodeRunnable);
+					}
+				}
+			}
+		});
+		barcodeEdt.setOnEditorActionListener(
+				new TextView.OnEditorActionListener() {
+					@Override
+					public boolean onEditorAction(TextView v, int actionId,
+							KeyEvent event) {
+						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(
+										LuociPriceActivity.this);
+								barcodeEdt.setEnabled(false);
+								barcodeEdt.setFocusable(false);
+								barcodeEdt.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)
+														: "";
+											}
+										}});
+								thread = new HandlerThread("barcodeThread", 5);
+								thread.start();
+								mHandler = new Handler(thread.getLooper());
+								BarcodeRunnable barcodeRunnable = new BarcodeRunnable(
+										obj, barcode);
+								mHandler.post(barcodeRunnable);
+								return true;
+							}
+						}
+						return false;
+					}
+				});
+	}
+	Runnable UpperCase = new Runnable() {
+		@Override
+		public void run() {
+			// 小写转大写
+			barcodeEdt.setText(barcodeUpper.toUpperCase());
+			// 设置EditText光标位置
+			barcodeEdt.setSelection(barcodeUpper.length());
+		}
+	};
+	public static int getOrderIndex(String order, List<Order> orderList) {
+		int newposition = -1;
+		for (int position = 0; position < orderList.size(); position++) {
+			if (order
+					.equalsIgnoreCase((orderList.get(position).getOrderNo()))) {
+				newposition = position;
+				break;
+			}
+		}
+		return newposition;
+	}
+	private class SaveRunnable implements Runnable {
+		private Object object; 
+		public SaveRunnable(Object object) {
+			this.object = object; 
+		}
+		@Override
+		public void run() {
+			synchronized (object) {
+				try {
+					client = null;
+					client = new WebClient();
+					JSONObject js = new JSONObject();
+					js.put("accountCode", accountCode);
+					js.put("userCode", handover_usercode);
+					js.put("userPassword", password);
+					js.put("sessionKey", sessionkey);
+					js.put("module", "LCFinishedProduct");
+					js.put("SPANAME", spinnerName);
+					js.put("action", "LCSaveFinishedHandover");
+					JSONArray orderEntity = new JSONArray();
+					for (BarcodeInfo info : barcodeInfoList) {
+						JSONObject obj = new JSONObject();
+						obj.put("BarCode", info.getBarcode());
+						obj.put("GoodsModel", info.getGoodsCode());
+						obj.put("SPANAME", spinnerName);
+						obj.put("logoID", info.getLogoId());
+						obj.put("LogoName", info.getLogoName());
+						orderEntity.put(obj);
+					}
+					JSONObject data = new JSONObject();
+//					data.put("OrderID", orderId);
+					data.put("Table", orderEntity);
+					data.put("SPANAME", spinnerName);
+					js.put("jsonData", data.toString());
+					String result = client.doPost(
+							"http://" + ServerAddress_ip + ":"
+									+ ServerAddress_port
+									+ Constants.serverAction + "/DoAction",
+							js.toString(), "application/json");
+					Message m = new Message();
+					m.what = 3;
+					Bundle b = new Bundle();
+					b.putString("saveResult", result);
+					m.setData(b);
+					handler.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);
+				}
+			}
+		}
+	};
+	private class BarcodeRunnable implements Runnable {
+		private Object object;
+		private String barcode;
+		public BarcodeRunnable(Object object, String barcode) {
+			this.object = object;
+			this.barcode = barcode;
+		}
+		@Override
+		public void run() {
+			synchronized (object) {
+				try {
+					client = null;
+					client = new WebClient();
+					JSONObject js1 = new JSONObject();
+					js1.put("accountCode", accountCode);
+					js1.put("userCode", handover_usercode);
+					js1.put("userPassword", password);
+					js1.put("sessionKey", sessionkey);
+					JSONObject data = new JSONObject();
+					data.put("Barcode", barcode);
+					js1.put("jsonData", data.toString());
+					js1.put("module", "LCFinishedProduct");
+					js1.put("action", "LCFinishedHandoverBarcode");
+					String result2 = client.doPost(
+							"http://" + ServerAddress_ip + ":"
+									+ ServerAddress_port
+									+ Constants.serverAction + "/DoAction",
+							js1.toString(), "application/json");
+					Bundle b = new Bundle();
+					Message message = new Message();
+					message.what = 1;
+					b.putString("barcode", barcode);
+					b.putString("result", result2);
+					message.setData(b);
+					handler.sendMessage(message);
+				} 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);
+				}
+			}
+		}
+	};
+	private class OrderListRunnable implements Runnable {
+		private Object object;
+		public OrderListRunnable(Object object) {
+			this.object = object;
+		}
+		@Override
+		public void run() {
+			synchronized (object) {
+				try {
+					client = null;
+					client = new WebClient();
+					JSONObject js = new JSONObject();
+					js.put("accountCode", accountCode);
+					js.put("userCode", handover_usercode);
+					js.put("userPassword", password);
+					js.put("sessionKey", sessionkey);
+					JSONObject orderEntity = new JSONObject();
+					js.put("order", orderEntity);
+					String result = client.doPost(
+							"http://" + ServerAddress_ip + ":"
+									+ ServerAddress_port
+									+ Constants.serverAction + "/GetOrderList",
+							js.toString(), "application/json");
+					JSONObject j = new JSONObject(result);
+					JSONObject j1 = j.optJSONObject("d");
+					int status = j1.optInt("Status");
+					String message = j1.optString("Message");
+					if (status == 0) {
+						String result1 = j1.optString("Result");
+						JSONArray jarray = new JSONArray(result1);
+						if (jarray != null && jarray.length() > 0) {
+							orderList = new ArrayList<Order>();
+							Order order = new Order();
+							order.setOrderId(-1);
+							order.setOrderNo("请选择订单");
+							orderList.add(order);
+							for (int i = 0; i < jarray.length(); i++) {
+								JSONObject obj = jarray.optJSONObject(i);
+								int orderId = obj.optInt("ORDERID");
+								String orderNo = obj.optString("ORDERNO");
+								String valueFlag = obj.optString("VALUEFLAG");
+								if (valueFlag.equals("1")) {
+									Order order1 = new Order();
+									order1.setOrderId(orderId);
+									order1.setOrderNo(orderNo);
+									orderList.add(order1);
+								}
+							}
+						} 
+						Message m = new Message();
+						m.what = 0;
+						Bundle b = new Bundle();
+						b.putSerializable("orderList",
+								(Serializable) orderList);
+						m.setData(b);
+						handler.sendMessage(m); 
+					} else {
+						Bundle b = new Bundle();
+						b.putInt("status", status);
+						b.putString("message", message);
+						Message m = new Message();
+						m.what = 1;
+						m.setData(b);
+						exceptionHandler.sendMessage(m);
+						return;
+					}
+				} 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);
+				}
+			}
+		}
+	};
+	Handler exceptionHandler = new Handler() {
+		@Override
+		public void handleMessage(Message msg) {
+			switch (msg.what) {
+				case 0 :
+					Bundle b = msg.getData();
+					String message = b.getString("message");
+					ProcessDialogUtils.closeProgressDilog();
+					if (mHandler != null) {
+						mHandler.removeCallbacksAndMessages(null);
+						mHandler.getLooper().quit();
+					}
+					CustomToast.showToast(getApplicationContext(), message,
+							2000);
+					CommonUtil.setDefault(Notification.DEFAULT_VIBRATE,
+							getApplicationContext());
+					barcodeEdt.setEnabled(true);
+					barcodeEdt.setText("");
+					barcodeEdt.setFocusable(true);
+					barcodeEdt.setFocusableInTouchMode(true);
+					barcodeEdt.requestFocus();
+					barcodeEdt.findFocus();
+					barcodeEdt.setFilters(new InputFilter[]{new InputFilter() {
+						@Override
+						public CharSequence filter(CharSequence source,
+								int start, int end, Spanned dest, int dstart,
+								int dend) {
+							return null;
+						}
+					}}); 
+					break;
+				case 1 :
+					Bundle b1 = msg.getData();
+					int status1 = b1.getInt("status");
+					String message1 = b1.getString("message");
+					ProcessDialogUtils.closeProgressDilog();
+					if (mHandler != null) {
+						mHandler.removeCallbacksAndMessages(null);
+						mHandler.getLooper().quit();
+					}
+					CommonUtil.setDefault(Notification.DEFAULT_VIBRATE,
+							getApplicationContext());
+					CommonUtil.showBarCodeAlertDialog(status1, message1,
+							LuociPriceActivity.this, barcodeEdt,
+							null, null);
+					break;
+			}
+		}
+	};
+	Handler handler = new Handler() {
+		@SuppressWarnings("unchecked")
+		@Override
+		public void handleMessage(Message msg) {
+			switch (msg.what) {
+				case 0 :
+					Bundle b = msg.getData();
+					orderList = (List<Order>) b.getSerializable("orderList");
+					if (mHandler != null) {
+						mHandler.removeCallbacksAndMessages(null);
+						mHandler.getLooper().quit();
+					}
+					ProcessDialogUtils.closeProgressDilog(); 
+					break;
+				case 1 :
+					ProcessDialogUtils.closeProgressDilog();
+					if (mHandler != null) {
+						mHandler.removeCallbacksAndMessages(null);
+						mHandler.getLooper().quit();
+					}
+					Bundle b1 = msg.getData();
+					String result1 = b1.getString("result");
+					barcode = b1.getString("barcode");
+					JSONObject jobj2;
+					try {
+						jobj2 = new JSONObject(result1);
+						JSONObject jobj3 = jobj2.optJSONObject("d");
+						int status3 = jobj3.optInt("Status");
+						if (status3 == 0) {
+							String result4 = jobj3.optString("Result");
+							JSONObject jobj4 = new JSONObject(result4);
+							JSONArray arry4 = jobj4.optJSONArray("Table");
+							if (arry4 != null && arry4.length() > 0) {
+								JSONObject jobj6 = arry4.optJSONObject(0);
+								String outbarcode = jobj6.optString("BARCODE");
+								if (barcodeInfoList.size() > 0) {
+									boolean b2 = Removeduplicate.removeBarCode(
+											outbarcode, barcodeInfoList);
+									if (b2) {
+										String message = "条码" + outbarcode
+												+ "重复";
+										CustomToast.showToast(
+												getApplicationContext(),
+												message, 2000);
+										CommonUtil.setDefault(
+												Notification.DEFAULT_VIBRATE,
+												getApplicationContext());
+										barcodeEdt.setEnabled(true);
+										barcodeEdt.setText("");
+										barcodeEdt.setFocusable(true);
+										barcodeEdt
+												.setFocusableInTouchMode(true);
+										barcodeEdt.requestFocus();
+										barcodeEdt.findFocus();
+										barcodeEdt.setFilters(new InputFilter[]{
+												new InputFilter() {
+													@Override
+													public CharSequence filter(
+															CharSequence source,
+															int start, int end,
+															Spanned dest,
+															int dstart,
+															int dend) {
+														return null;
+													}
+												}}); 
+										return;
+									}
+								}
+								for (int i = 0; i < arry4.length(); i++) {
+									JSONObject jobj5 = arry4.optJSONObject(i);
+									int logoId = jobj5.optInt("LOGOID");
+									String logoCode = jobj5
+											.optString("LOGOCODE");
+									String logoName = jobj5
+											.optString("LOGONAME");
+									String goodsCode = jobj5
+											.optString("GOODSCODE");
+									String finishedBarCode = jobj5
+											.optString("FINISHEDBARCODE");
+									String outbarcode1 = jobj5
+											.optString("BARCODE");
+									int userId = jobj5.optInt("USERID");
+									String groutingUserCode = jobj5
+											.optString("GROUTINGUSERCODE");
+									String mouldCode = jobj5
+											.optString("MOULDCODE");
+									String groutingDate = jobj5
+											.optString("GROUTINGDATE");
+									groutingDate = CommonUtil
+											.commonDateConverter(groutingDate);
+									String diliverTime = jobj5
+											.optString("DELIVERTIME");
+									String goodsModel = jobj5
+											.optString("GOODSMODEL");
+									diliverTime = CommonUtil
+											.commonDateConverter(diliverTime);
+									// limitNum = jobj5.optInt("PLATELIMITNUM");
+									BarcodeInfo info = new BarcodeInfo();
+									info.setBarcode(outbarcode1);
+									info.setLogoId(logoId);
+									info.setLogoCode(logoCode);
+									info.setFinishedBarCode(finishedBarCode);
+									info.setLogoName(logoName);
+									info.setGoodsCode(goodsCode);
+									info.setGoodsModel(goodsModel);
+									info.setUserId(userId);
+									info.setUserCode(groutingUserCode);
+									info.setMouldCode(mouldCode);
+									info.setGroutingDate(groutingDate);
+									info.setDeliverTime(diliverTime);
+									info.setBanMa(
+											(jobj5.optString("BANMA") == "null")
+													? ""
+													: jobj5.optString("BANMA"));
+								 
+									barcodeInfoList.add(info);
+								}
+								if (handoverAdapter == null) {
+									handoverAdapter = new HandOverAdapter(
+											LuociPriceActivity.this,
+											barcodeInfoList);
+									barcodeLst.setAdapter(handoverAdapter);
+								 
+								} else {
+									handoverAdapter.notifyDataSetChanged();
+								}
+							 
+								barcodeEdt.setEnabled(true);
+								barcodeEdt.setText("");
+								barcodeEdt.setFocusable(true);
+								barcodeEdt.setFocusableInTouchMode(true);
+								barcodeEdt.requestFocus();
+								barcodeEdt.findFocus();
+								barcodeEdt.setFilters(
+										new InputFilter[]{new InputFilter() {
+											@Override
+											public CharSequence filter(
+													CharSequence source,
+													int start, int end,
+													Spanned dest, int dstart,
+													int dend) {
+												return null;
+											}
+										}}); 
+							}
+						} else {
+							String message = jobj3.optString("Message");
+							CommonUtil.setDefault(Notification.DEFAULT_VIBRATE,
+									getApplicationContext());
+							CommonUtil.showBarCodeAlertDialog(status3, message,
+									LuociPriceActivity.this,
+									barcodeEdt, null, null);
+							return;
+						}
+						saveBtn.setText("保存(" + barcodeInfoList.size() + ")");
+					} catch (JSONException e1) {
+						e1.printStackTrace();
+					}
+					break;
+				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 b3 = new Bundle();
+					b3.putString("msg", errmsg);
+					b3.putString("missingFlag", missFlag);
+					intent.putExtras(b3);
+					intent.setClass(LuociPriceActivity.this,
+							MissingScanActivity.class);
+					startActivityForResult(intent, 101);
+					break;
+				case 3 :
+					Bundle b4 = msg.getData();
+					String result3 = b4.getString("saveResult");
+					if (mHandler != null) {
+						mHandler.removeCallbacksAndMessages(null);
+						mHandler.getLooper().quit();
+					}
+					ProcessDialogUtils.closeProgressDilog();
+					barcodeEdt.setEnabled(true);
+					barcodeEdt.setText("");
+					barcodeEdt.setFocusable(true);
+					barcodeEdt.setFocusableInTouchMode(true);
+					barcodeEdt.requestFocus();
+					barcodeEdt.findFocus();
+					barcodeEdt.setFilters(new InputFilter[]{new InputFilter() {
+						@Override
+						public CharSequence filter(CharSequence source,
+								int start, int end, Spanned dest, int dstart,
+								int dend) {
+							return null;
+						}
+					}});
+					try {
+						JSONObject jo = new JSONObject(result3);
+						JSONObject jo1 = jo.optJSONObject("d");
+						int status = jo1.optInt("Status");
+						String message = jo1.optString("Message");
+						if (status == 0) {
+							CustomToast.showToast(getApplicationContext(),
+									"保存成功", 2000);
+							// if (quantitySettingValue.equals("0")) {
+							// saveBtn.setEnabled(true);
+							//
+							// } else {
+							// saveBtn.setEnabled(false);
+							//
+							// }
+//							orderEdt.setText("");
+							if (handoverAdapter != null) {
+								barcodeInfoList.removeAll(barcodeInfoList);
+								handoverAdapter.notifyDataSetChanged();
+								saveBtn.setText(
+										"保存(" + barcodeInfoList.size() + ")");
+							}
+							CommonUtil.playSound(getApplicationContext());
+						} else {
+							CommonUtil.setDefault(Notification.DEFAULT_VIBRATE,
+									getApplicationContext());
+							CommonUtil.showBarCodeAlertDialog(status, message,
+									LuociPriceActivity.this,
+									barcodeEdt, null, null);
+						}
+					} catch (JSONException e) {
+						e.printStackTrace();
+					}
+					break;
+			}
+		}
+	};
+	@Override
+	public boolean dispatchTouchEvent(MotionEvent ev) {
+		switch (ev.getAction()) {
+			case MotionEvent.ACTION_DOWN :
+				View view = getCurrentFocus();
+				CommonUtil.hideKeyboard(ev, view,
+						LuociPriceActivity.this);// 调用方法判断是否需要隐藏键盘
+				break;
+			default :
+				break;
+		}
+		return super.dispatchTouchEvent(ev);
+	}
+	@Override
+	protected void onActivityResult(int requestCode, int resultCode,
+			Intent intent) {
+		if (requestCode == 101 && resultCode == 103) {
+//			orderEdt.setEnabled(true);
+//			orderEdt.setFocusable(true);
+//			orderEdt.setFocusableInTouchMode(true);
+//			orderEdt.setFilters(new InputFilter[]{new InputFilter() {
+//				@Override
+//				public CharSequence filter(CharSequence source, int start,
+//						int end, Spanned dest, int dstart, int dend) {
+//					return null;
+//				}
+//			}});
+			barcodeEdt.setEnabled(true);
+			barcodeEdt.setText("");
+			barcodeEdt.setFocusable(true);
+			barcodeEdt.setFocusableInTouchMode(true);
+			barcodeEdt.requestFocus();
+			barcodeEdt.findFocus();
+			barcodeEdt.setFilters(new InputFilter[]{new InputFilter() {
+				@Override
+				public CharSequence filter(CharSequence source, int start,
+						int end, Spanned dest, int dstart, int dend) {
+					return null;
+				}
+			}}); 
+		}
+	}
+	@Override
+	public boolean onCreateOptionsMenu(Menu menu) {
+		getMenuInflater().inflate(R.menu.finished_product_handover, menu);
+		return true;
+	}
+}

+ 627 - 0
src/com/jiaju/activity/LuociRevokeActivity.java

@@ -0,0 +1,627 @@
+package com.jiaju.activity;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import com.jiaju.adapter.CancelFinishedProductHandOverAdapter;
+import com.jiaju.model.BarcodeInfo;
+import com.jiaju.net.WebClient;
+import com.jiaju.utils.CommonUtil;
+import com.jiaju.utils.Constants;
+import com.jiaju.utils.ProcessDialogUtils;
+import com.jiaju.utils.Removeduplicate;
+
+import android.app.Activity;
+import android.app.Notification;
+import android.content.Context;
+import android.content.SharedPreferences;
+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.KeyEvent;
+import android.view.Menu;
+import android.view.View;
+import android.view.View.OnClickListener;
+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.ListView;
+import android.widget.TextView;
+import android.widget.Toast;
+//裸辞交接 撤销
+public class LuociRevokeActivity extends Activity {
+	private TextView title;
+	private EditText barcodeEdt;
+	private String accountCode;
+	private String cancelPacking_userCode;
+	private String password;
+	private String sessionkey;
+	private SharedPreferences preferences;
+	private String ServerAddress_ip;
+	private String ServerAddress_duankou;
+	private HandlerThread thread;
+	private Handler mHandler;
+	private WebClient client = null;
+	private TextView backtext;
+	private ImageButton backbtn;
+	private Object obj = new Object();
+	private List<BarcodeInfo> barcodeList;
+	private CancelFinishedProductHandOverAdapter adapter = null;
+	private ListView cancellstview;
+	private Button saveBtn;
+	private String procedureName;
+	private Handler barcodeUpperH = new Handler();
+	private String barcodeUpper;
+	@Override
+	protected void onCreate(Bundle savedInstanceState) {
+		super.onCreate(savedInstanceState);
+		setContentView(R.layout.activity_cancel_finished_product_hand_over);
+		initView();
+		preferences = getSharedPreferences("user", Context.MODE_PRIVATE);
+		ServerAddress_ip = preferences.getString("ServerAddress_ip", "");
+		ServerAddress_duankou = preferences.getString("ServerAddress_duankou",
+				"");
+		accountCode = preferences.getString("AccountCode", "");
+		cancelPacking_userCode = preferences.getString("UserCode", "");
+		password = preferences.getString("UserPassword", "");
+		sessionkey = preferences.getString("SessionKey", "");
+		Bundle b = getIntent().getExtras();
+		procedureName = b.getString("title");
+		title.setText(procedureName);
+		CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
+		barcodeList = new ArrayList<BarcodeInfo>();
+		allListeners();
+	}
+	public void initView() {
+		title = (TextView) findViewById(R.id.title);
+		barcodeEdt = (EditText) findViewById(R.id.barcodeEdt);
+		barcodeEdt.setRawInputType(InputType.TYPE_CLASS_NUMBER);
+		backbtn = (ImageButton) findViewById(R.id.left_img);
+		backtext = (TextView) findViewById(R.id.back);
+		cancellstview = (ListView) findViewById(R.id.cancel_listview);
+		saveBtn = (Button) findViewById(R.id.saveBtn);
+	}
+	public void allListeners() {
+		saveBtn.setOnClickListener(new View.OnClickListener() {
+			@Override
+			public void onClick(View v) {
+				if (barcodeList == null) {
+					Toast.makeText(getApplicationContext(), "条码信息不能为空",
+							Toast.LENGTH_SHORT).show();
+					return;
+				} else {
+					if (barcodeList.size() == 0) {
+						Toast.makeText(getApplicationContext(), "条码信息不能为空",
+								Toast.LENGTH_SHORT).show();
+						return;
+					}
+					BarcodeInfo info = barcodeList.get(0);
+					String barcode = info.getBarcode();
+					ProcessDialogUtils.showProcessDialog(
+							LuociRevokeActivity.this);
+					if (saveBtn.isEnabled()) {
+						saveBtn.setEnabled(false);
+						thread = new HandlerThread("saveThread", 5);
+						thread.start();
+						mHandler = new Handler(thread.getLooper());
+						SaveRunnable saveRunnable = new SaveRunnable(barcode,
+								obj);
+						mHandler.post(saveRunnable);
+					}
+				}
+			}
+		});
+		backtext.setOnClickListener(new OnClickListener() {
+			@Override
+			public void onClick(View v) {
+				finish();
+			}
+		});
+		backbtn.setOnClickListener(new View.OnClickListener() {
+			@Override
+			public void onClick(View v) {
+				finish();
+			}
+		});
+		barcodeEdt.addTextChangedListener(new TextWatcher() {
+			@Override
+			public void afterTextChanged(Editable arg0) {
+			}
+			@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 = barcodeEdt.getText().toString().trim();
+				// 判断输入的文字是否是小写
+				for (int i = 0; i < barcodeUpper.length(); i++) {
+					if (barcodeUpper.charAt(i) - 0 >= 97
+							&& barcodeUpper.charAt(i) - 0 <= 122) {
+						barcodeUpperH.postDelayed(UpperCase, 300);
+					}
+				}
+				if (start == 0 && before == 0 && count > 1) {
+					String barcode = barcodeEdt.getText().toString().trim();
+					if (!TextUtils.isEmpty(barcode)) {
+						if (barcodeList.size() > 0) {
+							boolean b = Removeduplicate.removeBarCode(barcode,
+									barcodeList);
+							if (b) {
+								barcodeEdt.setText("");
+								barcodeEdt.setFocusable(true);
+								barcodeEdt.requestFocus();
+								CommonUtil.setDefault(
+										Notification.DEFAULT_VIBRATE,
+										getApplicationContext());
+								Toast.makeText(getApplicationContext(),
+										"条码" + barcode + "重复",
+										Toast.LENGTH_SHORT).show();
+								return;
+							}
+						}
+						if (barcodeList != null && barcodeList.size() > 0) {
+							barcodeList.removeAll(barcodeList);
+							if (adapter != null) {
+								adapter.notifyDataSetChanged();
+							}
+						}
+						ProcessDialogUtils.showProcessDialog(
+								LuociRevokeActivity.this);
+						barcodeEdt.setEnabled(false);
+						barcodeEdt.setFocusable(false);
+						barcodeEdt.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)
+												: "";
+									}
+								}});
+						thread = new HandlerThread("barcodeThread", 5);
+						thread.start();
+						mHandler = new Handler(thread.getLooper());
+						BarcodeRunnable barcodeRunnable = new BarcodeRunnable(
+								barcode, obj);
+						mHandler.post(barcodeRunnable);
+					}
+				}
+			}
+		});
+		barcodeEdt.setOnEditorActionListener(
+				new TextView.OnEditorActionListener() {
+					@Override
+					public boolean onEditorAction(TextView v, int actionId,
+							KeyEvent event) {
+						if (actionId == EditorInfo.IME_ACTION_GO) {
+							String barcode = barcodeEdt.getText().toString();
+							if (!TextUtils.isEmpty(barcode)) {
+								if (barcodeList.size() > 0) {
+									boolean b = Removeduplicate.removeBarCode(
+											barcode, barcodeList);
+									if (b) {
+										barcodeEdt.setText("");
+										barcodeEdt.setFocusable(true);
+										barcodeEdt.requestFocus();
+										CommonUtil.setDefault(
+												Notification.DEFAULT_VIBRATE,
+												getApplicationContext());
+										Toast.makeText(getApplicationContext(),
+												"条码" + barcode + "重复",
+												Toast.LENGTH_SHORT).show();
+										return true;
+									}
+								}
+								if (barcodeList != null
+										&& barcodeList.size() > 0) {
+									barcodeList.removeAll(barcodeList);
+									if (adapter != null) {
+										adapter.notifyDataSetChanged();
+									}
+								}
+								ProcessDialogUtils.showProcessDialog(
+										LuociRevokeActivity.this);
+								barcodeEdt.setEnabled(false);
+								barcodeEdt.setFocusable(false);
+								barcodeEdt.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)
+														: "";
+											}
+										}});
+								thread = new HandlerThread("barcodeThread", 5);
+								thread.start();
+								mHandler = new Handler(thread.getLooper());
+								BarcodeRunnable barcodeRunnable = new BarcodeRunnable(
+										barcode, obj);
+								mHandler.post(barcodeRunnable);
+								return true;
+							} else {
+								Toast.makeText(getApplicationContext(),
+										"产品条码不能为空", Toast.LENGTH_SHORT).show();
+								return true;
+							}
+						}
+						return false;
+					}
+				});
+	}
+	Runnable BarcodeUpperCase = new Runnable() {
+		@Override
+		public void run() {
+			// 小写转大写
+			barcodeEdt.setText(barcodeUpper.toUpperCase());
+			// 设置EditText光标位置
+			barcodeEdt.setSelection(barcodeUpper.length());
+		}
+	};
+	Runnable UpperCase = new Runnable() {
+		@Override
+		public void run() {
+			// 小写转大写
+			barcodeEdt.setText(barcodeUpper.toUpperCase());
+			// 设置EditText光标位置
+			barcodeEdt.setSelection(barcodeUpper.length());
+		}
+	};
+	Handler h = new Handler() {
+		@Override
+		public void handleMessage(Message msg) {
+			switch (msg.what) {
+				case 0 :
+					Bundle b1 = msg.getData();
+					String json1 = b1.getString("barcodeResult");
+					ProcessDialogUtils.closeProgressDilog();
+					try {
+						JSONObject jo2 = new JSONObject(json1);
+						JSONObject jo3 = jo2.optJSONObject("d");
+						int status = jo3.optInt("Status");
+						String message = jo3.optString("Message");
+						if (status == 0) {
+							String result = jo3.optString("Result");
+							JSONObject resultObj = new JSONObject(result);
+							JSONArray jarray = resultObj.optJSONArray("Table");
+							if (jarray != null && jarray.length() > 0) {
+								for (int i = 0; i < jarray.length(); i++) {
+									JSONObject jo = jarray.optJSONObject(i);
+									String orderNo = jo.optString("ORDERNO");
+									String goodsCode = jo
+											.optString("GOODSCODE");
+									String groutingUserCode = jo
+											.optString("GROUTINGUSERCODE");
+									int logoId = jo.optInt("LOGOID");
+									String logoCode = jo.optString("LOGOCODE");
+									String logoName = jo.optString("LOGONAME");
+									String barcode = jo.optString("BARCODE");
+									String finishedBarcode = jo
+											.optString("FINISHEDBARCODE");
+									String groutingDate = jo
+											.optString("GROUTINGDATE");
+									String billetDate = jo
+											.optString("DELIVERTIME");
+									String mouldCode = jo
+											.optString("GROUTINGMOULDCODE");
+									BarcodeInfo info = new BarcodeInfo();
+									info.setBarcode(barcode);
+									info.setFinishedBarCode(finishedBarcode);
+									info.setOrderNo(orderNo);
+									info.setGoodsCode(goodsCode);
+									info.setUserCode(groutingUserCode);
+									info.setLogoId(logoId);
+									info.setLogoCode(logoCode);
+									info.setLogoName(logoName);
+									info.setBanMa(
+											(jo.optString("BANMA") == "null")
+													? ""
+													: jo.optString("BANMA"));
+									if (!TextUtils.isEmpty(groutingDate)) {
+										if (groutingDate.contains("/")) {
+											groutingDate = CommonUtil
+													.dateStringConverter(
+															groutingDate);
+										} else if (groutingDate.contains("-")) {
+											groutingDate = CommonUtil
+													.commonDateConverter(
+															groutingDate);
+										}
+										info.setGroutingDate(groutingDate);
+									} else {
+										info.setGroutingDate("");
+									}
+									if (!TextUtils.isEmpty(billetDate)) {
+										if (billetDate.contains("/")) {
+											billetDate = CommonUtil
+													.dateStringConverter(
+															billetDate);
+										} else if (billetDate.contains("-")) {
+											billetDate = CommonUtil
+													.commonDateConverter(
+															billetDate);
+										}
+										info.setDeliverTime(billetDate);
+									} else {
+										info.setDeliverTime("");
+									}
+									info.setMouldCode(mouldCode);
+									barcodeList.add(info);
+								}
+								adapter = new CancelFinishedProductHandOverAdapter(
+										LuociRevokeActivity.this,
+										barcodeList);
+								cancellstview.setAdapter(adapter);
+								saveBtn.setText(
+										"保存(" + barcodeList.size() + ")");
+							} else {
+								Toast.makeText(getApplicationContext(),
+										"此条码不存在", Toast.LENGTH_SHORT).show();
+							}
+							barcodeEdt.setEnabled(true);
+							barcodeEdt.setText("");
+							barcodeEdt.setFocusable(true);
+							barcodeEdt.setFocusableInTouchMode(true);
+							barcodeEdt.requestFocus();
+							barcodeEdt.findFocus();
+							barcodeEdt.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(barcodeEdt, 50);
+						} else {
+							CommonUtil.setDefault(Notification.DEFAULT_VIBRATE,
+									getApplicationContext());
+							CommonUtil.showBarCodeAlertDialog(status, message,
+									LuociRevokeActivity.this,
+									barcodeEdt, null, null);
+						}
+						if (mHandler != null) {
+							mHandler.removeCallbacksAndMessages(null);
+							mHandler.getLooper().quit();
+						}
+					} catch (JSONException e1) {
+						e1.printStackTrace();
+						Toast.makeText(getApplicationContext(), "json数据异常",
+								Toast.LENGTH_SHORT).show();
+					}
+					break;
+				case 1 :
+					Bundle b = msg.getData();
+					String json = b.getString("saveResult");
+					ProcessDialogUtils.closeProgressDilog();
+					if (mHandler != null) {
+						mHandler.removeCallbacksAndMessages(null);
+						mHandler.getLooper().quit();
+					}
+					saveBtn.setEnabled(true);
+					try {
+						JSONObject jo = new JSONObject(json);
+						JSONObject jo1 = jo.optJSONObject("d");
+						int status = jo1.optInt("Status");
+						String message = jo1.optString("Message");
+						if (barcodeList != null && barcodeList.size() > 0) {
+							barcodeList.removeAll(barcodeList);
+							if (adapter != null) {
+								adapter.notifyDataSetChanged();
+							}
+						}
+						saveBtn.setText("保存(" + barcodeList.size() + ")");
+						if (status == 0) {
+							barcodeEdt.setEnabled(true);
+							barcodeEdt.setText("");
+							barcodeEdt.setFocusable(true);
+							barcodeEdt.setFocusableInTouchMode(true);
+							barcodeEdt.requestFocus();
+							barcodeEdt.findFocus();
+							barcodeEdt.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(barcodeEdt, 50);
+							InputMethodManager im = (InputMethodManager) barcodeEdt
+									.getContext().getSystemService(
+											Context.INPUT_METHOD_SERVICE);
+							im.hideSoftInputFromWindow(
+									LuociRevokeActivity.this
+											.getCurrentFocus().getWindowToken(),
+									InputMethodManager.HIDE_NOT_ALWAYS);
+							Toast.makeText(getApplicationContext(), "上传成功",
+									Toast.LENGTH_SHORT).show();
+							CommonUtil.playSound(getApplicationContext());
+						} else {
+							CommonUtil.showBarCodeAlertDialog(status, message,
+									LuociRevokeActivity.this,
+									barcodeEdt, null, null);
+							CommonUtil.setDefault(Notification.DEFAULT_VIBRATE,
+									getApplicationContext());
+						}
+					} catch (JSONException e) {
+						e.printStackTrace();
+						Toast.makeText(getApplicationContext(), "json数据异常",
+								Toast.LENGTH_SHORT).show();
+					}
+					break;
+			}
+		}
+	};
+	private Handler exceptionHandler = new Handler() {
+		@Override
+		public void handleMessage(Message msg) {
+			super.handleMessage(msg);
+			switch (msg.what) {
+				case 0 :
+					ProcessDialogUtils.closeProgressDilog();
+					saveBtn.setEnabled(true);
+					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_SHORT).show();
+					barcodeEdt.setEnabled(true);
+					barcodeEdt.setText("");
+					barcodeEdt.setFocusable(true);
+					barcodeEdt.setFocusableInTouchMode(true);
+					barcodeEdt.requestFocus();
+					barcodeEdt.findFocus();
+					barcodeEdt.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(barcodeEdt, 50);
+					break;
+			}
+		}
+	};
+	public class SaveRunnable implements Runnable {
+		String barcode;
+		Object obj;
+		public SaveRunnable(String barcode, Object obj) {
+			this.barcode = barcode;
+			this.obj = obj;
+		}
+		@Override
+		public void run() {
+			synchronized (obj) {
+				try {
+					client = new WebClient();
+					JSONObject js = new JSONObject();
+					js.put("accountCode", accountCode);
+					js.put("userCode", cancelPacking_userCode);
+					js.put("userPassword", password);
+					js.put("sessionKey", sessionkey);
+					js.put("module", "LCFinishedProduct");
+					js.put("action", "LCBackFinishedHandover");
+					JSONArray barcodeArray = new JSONArray();
+					for (int i = 0; i < barcodeList.size(); i++) {
+						BarcodeInfo barcodeInfo = barcodeList.get(i);
+						JSONObject jobj = new JSONObject();
+						jobj.put("BarCode", barcodeInfo.getBarcode());
+						jobj.put("GoodsModel", barcodeInfo.getGoodsCode());
+						jobj.put("logoID", barcodeInfo.getLogoId());
+						jobj.put("LogoName", barcodeInfo.getLogoName());
+						barcodeArray.put(jobj);
+					}
+					JSONObject data = new JSONObject();
+					data.put("Table", barcodeArray);
+					js.put("jsonData", data.toString());
+					String result = client.doPost(
+							"http://" + ServerAddress_ip + ":"
+									+ ServerAddress_duankou
+									+ Constants.serverAction + "/DoAction",
+							js.toString(), "application/json");
+					Message m = new Message();
+					m.what = 1;
+					Bundle b = new Bundle();
+					b.putString("saveResult", result);
+					m.setData(b);
+					h.sendMessage(m);
+				} catch (Exception e) {
+					e.printStackTrace();
+					Message m = new Message();
+					m.what = 0;
+					Bundle b = new Bundle();
+					b.putString("message", "网络连接异常");
+					m.setData(b);
+					exceptionHandler.sendMessage(m);
+					return;
+				}
+			}
+		}
+	};
+	public 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 {
+					client = new WebClient();
+					JSONObject js = new JSONObject();
+					js.put("accountCode", accountCode);
+					js.put("userCode", cancelPacking_userCode);
+					js.put("userPassword", password);
+					js.put("sessionKey", sessionkey);
+					js.put("module", "LCFinishedProduct");
+					js.put("action", "LCBackFinishedHandoverCheck");
+					JSONObject data = new JSONObject();
+					data.put("Barcode", barcode);
+					js.put("jsonData", data.toString());
+					String result = client.doPost(
+							"http://" + ServerAddress_ip + ":"
+									+ ServerAddress_duankou
+									+ Constants.serverAction + "/DoAction",
+							js.toString(), "application/json");
+					Message m = new Message();
+					m.what = 0;
+					Bundle b = new Bundle();
+					b.putString("barcodeResult", result);
+					m.setData(b);
+					h.sendMessage(m);
+				} catch (Exception e) {
+					e.printStackTrace();
+					Message m = new Message();
+					m.what = 0;
+					Bundle b = new Bundle();
+					b.putString("message", "网络连接异常");
+					m.setData(b);
+					exceptionHandler.sendMessage(m);
+					return;
+				}
+			}
+		}
+	};
+	@Override
+	public boolean onCreateOptionsMenu(Menu menu) {
+		// Inflate the menu; this adds items to the action bar if it is present.
+		getMenuInflater().inflate(R.menu.cancel_packing, menu);
+		return true;
+	}
+}

+ 290 - 66
src/com/jiaju/activity/PieceActivity.java

@@ -7,7 +7,10 @@ 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;
@@ -48,6 +51,7 @@ 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;
@@ -114,6 +118,11 @@ public class PieceActivity extends Activity {
 	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) {
@@ -121,7 +130,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();
@@ -143,6 +152,12 @@ public class PieceActivity extends Activity {
 		// 获取服务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);
@@ -303,7 +318,7 @@ public class PieceActivity extends Activity {
 							return null;
 						}
 					} });
-					//CommonUtil.BarcodeMaxLength(barcode, 50);
+					//CommonUtil.BarcodeMaxLength(barcode, 50);;
 					CommonUtil.setDefault(
 							Notification.DEFAULT_VIBRATE,
 							getApplicationContext());
@@ -322,7 +337,7 @@ public class PieceActivity extends Activity {
 			}
 			}
               
-              if(collectType==1&&nodeType==3) {
+              if(collectType==1&&nodeType==3 &&proId!=luociproId) {
 					if(plateNum>0&&piecelist.size()==plateNum) {
 						CommonUtil.setDefault(Notification.DEFAULT_VIBRATE,
 							getApplicationContext());
@@ -332,7 +347,24 @@ public class PieceActivity extends Activity {
 						
 						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);
@@ -362,7 +394,8 @@ public class PieceActivity extends Activity {
 		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() {
@@ -506,7 +539,7 @@ public class PieceActivity extends Activity {
 								"没有可提交的明细信息", 2000);
 						return;
 					}
-					if(collectType==1&&nodeType==3) {
+					if(collectType==1&&nodeType==3 && proId!=luociproId) {
 					if(plateNum>0&&piecelist.size()!=plateNum) {
 						CommonUtil.setDefault(Notification.DEFAULT_VIBRATE,
 								getApplicationContext());
@@ -517,6 +550,30 @@ public class PieceActivity extends Activity {
 					}
 					}
 					
+					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();
@@ -597,6 +654,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,13 +718,13 @@ public class PieceActivity extends Activity {
 				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];
- 				        }  
-  					} 
+					 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(), "生产工号不能为空",
@@ -785,7 +843,7 @@ public class PieceActivity extends Activity {
 										return null;
 									}
 								} });
-								//CommonUtil.BarcodeMaxLength(barcode, 50);
+								//CommonUtil.BarcodeMaxLength(barcode, 50);;
 								CommonUtil.setDefault(
 										Notification.DEFAULT_VIBRATE,
 										getApplicationContext());
@@ -804,7 +862,7 @@ public class PieceActivity extends Activity {
 						}
 						}
                           
-                          if(collectType==1&&nodeType==3) {
+                         if(collectType==1&&nodeType==3&&proId!=luociproId) {
           					if(plateNum>0&&piecelist.size()==plateNum) {
           						CommonUtil.setDefault(Notification.DEFAULT_VIBRATE,
         								getApplicationContext());
@@ -814,7 +872,22 @@ public class PieceActivity extends Activity {
           						
           						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);
@@ -840,13 +913,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];
-		   	        }  
-		   		} 
+				  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
@@ -906,12 +979,12 @@ public class PieceActivity extends Activity {
 
 						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[] parts = etcode.split("-", 2);   
+							 		        if (parts.length == 2) {   
+							 		        	etcode = parts[1];
+							 		        }  
+							 			} 
 						 ProcessDialogUtils
 							.showProcessDialog(PieceActivity.this);
 						barcode.setEnabled(false);
@@ -988,7 +1061,7 @@ public class PieceActivity extends Activity {
 											return null;
 										}
 									} });
-									//CommonUtil.BarcodeMaxLength(barcode, 50);
+									//CommonUtil.BarcodeMaxLength(barcode, 50);;
 									CommonUtil.setDefault(
 											Notification.DEFAULT_VIBRATE,
 											getApplicationContext());
@@ -1008,7 +1081,7 @@ public class PieceActivity extends Activity {
 							}
 							}
 							
-                              if(collectType==1&&nodeType==3) {
+                              if(collectType==1&&nodeType==3 &&proId!=luociproId) {
                 					if(plateNum>0&&piecelist.size()==plateNum) {
                 						CommonUtil.setDefault(Notification.DEFAULT_VIBRATE,
                 								getApplicationContext());
@@ -1020,7 +1093,22 @@ public class PieceActivity extends Activity {
                 						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();
@@ -1052,7 +1140,7 @@ public class PieceActivity extends Activity {
 									return null;
 								}
 							} });
-							//CommonUtil.BarcodeMaxLength(barcode, 50);
+							//CommonUtil.BarcodeMaxLength(barcode, 50);;
 							return true;
 
 						}
@@ -1100,7 +1188,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");
@@ -1156,7 +1244,35 @@ public class PieceActivity extends Activity {
 					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;
 			}
 		}
 
@@ -1232,7 +1348,7 @@ public class PieceActivity extends Activity {
 						return null;
 					}
 				} });
-				//CommonUtil.BarcodeMaxLength(barcode, 50);
+				//CommonUtil.BarcodeMaxLength(barcode, 50);;
 				break;
 			case 1:
 				ProcessDialogUtils.closeProgressDilog();
@@ -1279,7 +1395,7 @@ public class PieceActivity extends Activity {
 					}
 				} });
 
-				//CommonUtil.BarcodeMaxLength(barcode, 50);
+				//CommonUtil.BarcodeMaxLength(barcode, 50);;
 				break;
 
 			case 2:
@@ -1427,7 +1543,7 @@ public class PieceActivity extends Activity {
 										return null;
 									}
 								} });
-								//CommonUtil.BarcodeMaxLength(barcode, 50);
+								////CommonUtil.BarcodeMaxLength(barcode, 50);;
 
 							}
 
@@ -1598,7 +1714,7 @@ public class PieceActivity extends Activity {
 											return null;
 										}
 									} });
-									//CommonUtil.BarcodeMaxLength(barcode, 50);	
+									////CommonUtil.BarcodeMaxLength(barcode, 50);;	
 								}
 //								如果是水校标识界面过来的  barcode成功返回后 直接关闭界面
 								if("wangyingjie".equals(NewWaterEfficiencyLabelActivity)) {
@@ -1697,7 +1813,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);
@@ -1883,6 +1999,7 @@ public class PieceActivity extends Activity {
 								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);
@@ -1975,7 +2092,7 @@ public class PieceActivity extends Activity {
 							     String orginalGoodsModelForCheck=p2.getGoodsModel();
 							     String  originalGoodsCode=p2.getGoodsCode();
 									if(spm_011.equals("1")) {
-									if(!logoId.equals(originalLogoId))	{
+									if(!logoId.equals(originalLogoId))	{ 
 										Bundle bundle=new Bundle();
 										bundle.putInt("Status",0);
 										bundle.putString("Message","此产品【"+outbarcode+"】的商标【"+logoName+"】与此批次商标【"+originalLogoName+"】不同,不能进行该操作。");
@@ -1989,6 +2106,12 @@ public class PieceActivity extends Activity {
 									
 									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+"】不同,不能进行该操作。");
@@ -2206,7 +2329,7 @@ public class PieceActivity extends Activity {
 					return null;
 				}
 			} });
-			//CommonUtil.BarcodeMaxLength(barcode, 50);
+			////CommonUtil.BarcodeMaxLength(barcode, 50);;
 		}
 		
 		if(requestCode==103&&resultCode==104) {
@@ -2224,7 +2347,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();
@@ -2352,7 +2475,7 @@ public class PieceActivity extends Activity {
 //								return null;
 //							}
 //						} });
-//						CommonUtil.BarcodeMaxLength(barcode, 50);
+//						//CommonUtil.BarcodeMaxLength(barcode, 50);;
 //						return;
 //					}
 
@@ -2385,7 +2508,7 @@ public class PieceActivity extends Activity {
 									return null;
 								}
 							} });
-							//CommonUtil.BarcodeMaxLength(barcode, 50);
+							////CommonUtil.BarcodeMaxLength(barcode, 50);;
 						
 							CommonUtil.setDefault(Notification.DEFAULT_VIBRATE,
 									getApplicationContext());
@@ -2402,7 +2525,7 @@ public class PieceActivity extends Activity {
 						}
 					}
 
-					       if(collectType==1&&nodeType==3) {
+				    if(collectType==1&&nodeType==3 &&proId!=luociproId) {
          					if(plateNum>0&&piecelist.size()==plateNum) {
          						CommonUtil.setDefault(Notification.DEFAULT_VIBRATE,
         								getApplicationContext());	
@@ -2411,8 +2534,23 @@ public class PieceActivity extends Activity {
          						  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();
@@ -2443,7 +2581,7 @@ public class PieceActivity extends Activity {
 							return null;
 						}
 					} });
-					//CommonUtil.BarcodeMaxLength(barcode, 50);
+					////CommonUtil.BarcodeMaxLength(barcode, 50);;
 					return;
 
 				}
@@ -2512,16 +2650,36 @@ public class PieceActivity extends Activity {
 								"没有可提交的明细信息", 2000);
 						return true;
 					}
-					if(collectType==1&&nodeType==3) {
-					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) {
+						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();
@@ -2601,17 +2759,37 @@ public class PieceActivity extends Activity {
 								Toast.LENGTH_SHORT).show();
 						return true;
 					}
-					if(collectType==1&&nodeType==3) {
-					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) {
+						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();
@@ -2672,5 +2850,51 @@ public class PieceActivity extends Activity {
 		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);
+			}
+		}
+	};
 
 }

+ 57 - 0
src/com/jiaju/adapter/CarBrandSpinnerAdapter.java

@@ -0,0 +1,57 @@
+package com.jiaju.adapter;
+
+import java.util.List;
+
+import com.jiaju.activity.R;
+import com.jiaju.model.CarBrandModel;
+import com.jiaju.model.Logo;
+import com.jiaju.model.ResponsibilityProcedure; 
+import com.jiaju.model.WorkNo;
+import com.jiaju.model.WorkType;
+
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+
+import android.view.ViewGroup;
+import android.widget.BaseAdapter;
+import android.widget.TextView;
+
+public class CarBrandSpinnerAdapter extends BaseAdapter {
+	private List<CarBrandModel> mList;
+	private Context mContext;
+
+	public CarBrandSpinnerAdapter(Context pContext, List<CarBrandModel> pList) {
+		this.mContext = pContext;
+		this.mList = pList;
+	}
+
+	@Override
+	public int getCount() {
+		return mList.size();
+	}
+
+	@Override
+	public Object getItem(int position) {
+		return mList.get(position);
+	}
+
+	@Override
+	public long getItemId(int position) {
+		return position;
+	}
+
+	@Override
+	public View getView(int position, View convertView, ViewGroup parent) {
+		LayoutInflater _LayoutInflater = LayoutInflater.from(mContext);
+		convertView = _LayoutInflater.inflate(R.layout.spinner, null);
+		if (convertView != null) {
+			TextView _TextView1 = (TextView) convertView
+					.findViewById(R.id.typetxt);
+
+			_TextView1.setText(mList.get(position).getCarBrandName());
+
+		}
+		return convertView;
+	}
+}

+ 23 - 1
src/com/jiaju/adapter/ProductLineExpandableListView.java

@@ -48,6 +48,8 @@ import com.jiaju.activity.InventoryActivity;
 import com.jiaju.activity.KilnCarMissScanSupplyPieceActivity;
 import com.jiaju.activity.KilnCarStatisticsActivity;
 import com.jiaju.activity.LoadKilnCarActivity;
+import com.jiaju.activity.LuociPriceActivity;
+import com.jiaju.activity.LuociRevokeActivity;
 import com.jiaju.activity.BadBilletDataStatisticsActivity;
 import com.jiaju.activity.BarcodePrintActivity;
 import com.jiaju.activity.PrinterSetActivity;
@@ -1520,7 +1522,27 @@ public class ProductLineExpandableListView extends ExpandableListView implements
 			i.setClass(mContext, CancelCallOutActivity.class);
 			mContext.startActivity(i);
 		}
-		
+		else if (procedureMenuCode.equals("063401")) {
+			//裸辞交接
+			Intent i = new Intent();
+			Bundle b = new Bundle();
+			b.putString("procedureName", procedureName);
+			b.putString("title", "交接");
+			i.putExtras(b);
+			i.setClass(mContext, LuociPriceActivity.class);
+			mContext.startActivity(i);
+
+		} else if (procedureMenuCode.equals("063402")) {
+			//裸辞交接-撤销
+			Intent i = new Intent();
+			Bundle b = new Bundle();
+			b.putString("procedureName", procedureName);
+			b.putString("title", "撤销");
+			i.putExtras(b);
+			i.setClass(mContext, LuociRevokeActivity.class);
+			mContext.startActivity(i);
+
+		} 
 		else {
 
 			ProcessDialogUtils.showProcessDialog(mContext);

+ 58 - 0
src/com/jiaju/adapter/SapSpinnerAdapter.java

@@ -0,0 +1,58 @@
+package com.jiaju.adapter;
+
+ 
+import java.util.List;
+
+import com.jiaju.activity.R;
+import com.jiaju.model.Logo;
+import com.jiaju.model.Order;
+import com.jiaju.model.ResponsibilityProcedure;
+import com.jiaju.model.WorkNo;
+import com.jiaju.model.WorkType;
+
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+
+import android.view.ViewGroup;
+import android.widget.BaseAdapter;
+import android.widget.TextView;
+
+public class SapSpinnerAdapter extends BaseAdapter {
+	private  String[] mList;
+	private Context mContext;
+
+	public SapSpinnerAdapter(Context pContext,  String[] pList) {
+		this.mContext = pContext;
+		this.mList = pList;
+	}
+
+	@Override
+	public int getCount() {
+		return mList.length;
+	}
+
+	@Override
+	public Object getItem(int position) {
+		return mList[position];
+	}
+
+	@Override
+	public long getItemId(int position) {
+		return position;
+	}
+
+	@Override
+	public View getView(int position, View convertView, ViewGroup parent) {
+		LayoutInflater _LayoutInflater = LayoutInflater.from(mContext);
+		convertView = _LayoutInflater.inflate(R.layout.spinner, null);
+		if (convertView != null) {
+			TextView _TextView1 = (TextView) convertView
+					.findViewById(R.id.typetxt);
+
+			_TextView1.setText( mList[position]);
+
+		}
+		return convertView;
+	}
+}

+ 7 - 0
src/com/jiaju/model/BarcodeInfo.java

@@ -26,6 +26,13 @@ public class BarcodeInfo implements Serializable {
 	private String suspendProcedureId;
 	private boolean checkedFlag;
 	private String remarks;
+	private String BanMa;
+	public String getBanMa() {
+		return BanMa;
+	}
+	public void setBanMa(String banMa) {
+		BanMa = banMa;
+	}
 	public String getRemarks() {
 		return remarks;
 	}

+ 24 - 0
src/com/jiaju/model/CarBrandModel.java

@@ -0,0 +1,24 @@
+package com.jiaju.model;
+
+import java.io.Serializable;
+
+public class CarBrandModel implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+	
+	private String carBrandId;
+	public String getCarBrandId() {
+		return carBrandId;
+	}
+	public void setCarBrandId(String carBrandId) {
+		this.carBrandId = carBrandId;
+	}
+	public String getCarBrandName() {
+		return carBrandName;
+	}
+	public void setCarBrandName(String carBrandName) {
+		this.carBrandName = carBrandName;
+	}
+	private String carBrandName;
+
+}