konghe 1 rok pred
rodič
commit
0429b16176

+ 1 - 0
res/layout/activity_send_out_goods.xml

@@ -2,6 +2,7 @@
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
+    android:background="@color/background"
     tools:context="${relativePackage}.${activityClass}" >
 
    <include

+ 9 - 0
src/com/jiaju/activity/HomeActivity.java

@@ -913,6 +913,15 @@ public class HomeActivity extends Activity {
 								pm19.setModelType(103);
 								pm19.setProcedureId(103);
 								Invoicelist.add(pm19);
+							}else if (functionCode.equals("063101")) // 
+							{
+								ProcedureModel pm19 = new ProcedureModel();
+								pm19.setProcedureMenuCode(functionCode);
+								pm19.setProcedureMenuName("´´½¨·¢»õµ¥");
+								pm19.setProcedureModel("00" + 104);
+								pm19.setModelType(103);
+								pm19.setProcedureId(103);
+								suibianList.add(pm19);
 							} else if (functionCode.equals("063102")) // ·¢»õµ¥Ò»ÀÀ
 							{
 								ProcedureModel pm20 = new ProcedureModel();

+ 89 - 49
src/com/jiaju/activity/SendOutGoods.java

@@ -71,6 +71,7 @@ import android.widget.Button;
 import android.widget.EditText;
 import android.widget.ImageButton;
 import android.widget.ImageView;
+import android.widget.LinearLayout;
 import android.widget.ListView;
 import android.widget.Spinner;
 import android.widget.TextView;
@@ -149,8 +150,17 @@ public class SendOutGoods extends Activity {
 		barcodeList = new ArrayList<BarcodeInfo>();
 		loadProcedureDataSource();
 		initView();
+		sendOutGoodLogId="";
+		
+	    sendOutGoodLogId = this.getIntent().getStringExtra("sendOutGoodLog");
+			if(sendOutGoodLogId==null||sendOutGoodLogId=="")
+			{
+				((LinearLayout) findViewById(R.id.LinearLayout06)).setVisibility(View.GONE);
+			}else
+			{
+				sGoodsLogcode.setText(sendOutGoodLogId);
+			}
 		procedureTv.setText(send_userCode);
-		sGoodsLogcode.setText(send_userCode);
 		selectedDate = CommonUtil.getCurrentDate();
 		TextView04.setText(selectedDate);
 		timeMillis = System.currentTimeMillis();
@@ -170,7 +180,7 @@ public class SendOutGoods extends Activity {
 
 			}
 		});
-
+		
 		selectedDate1 = CommonUtil.getCurrentDate();
 		TextView01.setText(selectedDate1);
 		timeMillis = System.currentTimeMillis();
@@ -190,9 +200,8 @@ public class SendOutGoods extends Activity {
 
 			}
 		});
-
+		
 		allListeners();
-
 		thread = new HandlerThread("sendOutThread", 5);
 		thread.start();
 		mHandler = new Handler(thread.getLooper());
@@ -210,9 +219,19 @@ public class SendOutGoods extends Activity {
 		mHandler = new Handler(thread.getLooper());
 		SendOutRunnable glazeRunnable = new SendOutRunnable(obj);
 		mHandler.post(glazeRunnable);
-
+		;
 	}
 
+	 protected void onResume() {
+	        super.onResume();
+	        // 如果值已经在onCreate()中加载完成,可以在这里直接调用方法
+	    
+		HandlerThread thread = new HandlerThread("worThread", 5);
+		thread.start();
+		mHandler = new Handler(thread.getLooper());
+		mHandler.post(responsibilityWorkNoRunnable);
+		
+	    }
 	private class CarBrandRunnable implements Runnable {
 		private Object object;
 
@@ -641,7 +660,7 @@ public class SendOutGoods extends Activity {
 			Method m = null;
 			Method mouldId = null;
 			try {
-				m = clss.getMethod("getBarcode");
+				m = clss.getMethod("getBanMa");
 			} catch (NoSuchMethodException e) {
 				// TODO Auto-generated catch block
 				e.printStackTrace();
@@ -732,11 +751,6 @@ public class SendOutGoods extends Activity {
 	}
 
 	public void loadProcedureDataSource() {
-		//thread = new HandlerThread("mouldScrapThread", 5);
-		//thread.start();
-		//mHandler = new Handler(thread.getLooper());
-		//ProcedureRunnable procedureRunnable = new ProcedureRunnable();
-		//mHandler.post(procedureRunnable);
 	}
 
 	private Runnable responsibilityWorkNoRunnable = new Runnable() {
@@ -753,14 +767,11 @@ public class SendOutGoods extends Activity {
 				js.put("sessionKey", sessionkey);
 				js.put("module", "SendOutGoods");
 				js.put("action", "GetSendOutGoodsLogs");
-				// String result = client.doPost("http://" + ServerAddress_ip
-				// + ":" + ServerAddress_duankou + Constants.serverAction
-				// + "/GetSendOutGoodsListAndReceive",
-				// js.toString(), "application/json");
 				JSONObject data = new JSONObject();
 				data.put("Lgort", Lgort);// 发出仓
 				data.put("sendoutgoodslogid", sendOutGoodLogId);// 日志id
 				js.put("jsonData", data.toString());
+				if(Lgort!=null) {
 				String result = client.doPost(
 						"http://" + serverAddress_ip + ":" + serverAddress_port + Constants.serverAction + "/DoAction",
 						js.toString(), "application/json");
@@ -769,9 +780,6 @@ public class SendOutGoods extends Activity {
 				int status = jo.optInt("Status");
 				String message = jo.optString("Message");
 				if (status == 0) {
-					storageJArray = null;// sap库存
-					// storageJArray=
-					// barcodelist加载listview
 					Message m = new Message();
 					m.what = 10;
 					Bundle b = new Bundle();
@@ -793,7 +801,7 @@ public class SendOutGoods extends Activity {
 					// worknolist.add(w);
 
 					// }
-				}
+				}}
 
 			}
 
@@ -820,7 +828,7 @@ public class SendOutGoods extends Activity {
 				JSONObject js = new JSONObject();
 				
 				JSONObject js6 = new JSONObject();
-				js6.put("SENDOUTCODE", send_userCode);
+				js6.put("SENDOUTCODE", sendOutGoodLogId);
 				js6.put("USERCODE", send_userCode);			
 				
 				if(TextView04.getText()== null|| TextView04.getText().toString()== "")
@@ -905,8 +913,12 @@ public class SendOutGoods extends Activity {
 						jarray6.put(jo6);
 					}
 					js.put("setDetailEntity", jarray6);
+				}else
+				{
+					CustomToast.showToast(getApplicationContext(),
+							"发货单信息不能为空", 2000);
+					return;
 				}
-				js.put("setDetailEntity", "");
 				JSONObject js5 = new JSONObject();
 				js5.put("accountCode", accountCode);
 				js5.put("userCode", send_userCode);
@@ -1054,7 +1066,7 @@ public class SendOutGoods extends Activity {
 						JSONArray jArray = new JSONArray(result);
 
 						String mCODE = ((JSONObject) jArray.opt(0)).optString("MATERIALCODE");
-						String Count = ((JSONObject) jArray.opt(0)).optString("Count");
+						String Count = ((JSONObject) jArray.opt(0)).optString("COUNT");
 						int mcount = 0;
 						for (BarcodeInfo bd : barcodeList) {
 							if (bd.getLogoCode() == mCODE) {
@@ -1066,15 +1078,15 @@ public class SendOutGoods extends Activity {
 							for (int i = 0; i < storageJArray.length(); i++) {
 
 								JSONObject sobject = (JSONObject) storageJArray.opt(i);
-								String MATERIALCODE = sobject.optString("MATERIALCODE");
+								String MATERIALCODE = sobject.optString("MATNR");
 								if (MATERIALCODE == mCODE) {
-									storageConout = storageConout + Integer.parseInt(sobject.optString("c"));// sap库存
+									storageConout = storageConout + Integer.parseInt(sobject.optString("LABST"));// sap库存
 								}
 
 							}
-						}
-						if (mcount + Integer.parseInt(Count) > storageConout) {
-							CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, getApplicationContext());
+						} 
+						if ((Double.parseDouble(Count)) <= storageConout-mcount) {
+							//CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, getApplicationContext());
 							CommonUtil.showBarCodeAlertDialog(status, "库存不足", SendOutGoods.this, barcodeEdt, null,
 									null);
 							return;
@@ -1082,21 +1094,18 @@ public class SendOutGoods extends Activity {
 							if (jArray != null && jArray.length() > 0) {
 								for (int i = 0; i < jArray.length(); i++) {
 									JSONObject object2 = (JSONObject) jArray.opt(i);
-									String barcode = object2.optString("BARCODE");
+									String barcode = object2.optString("BANMA");
 									String goodsCode = object2.optString("GOODSCODE");
-									String LogoCode = object2.optString("GROUTINGDATE");
-									// groutingDate = CommonUtil.commonDateConverter(groutingDate);
-									String LogoName = object2.optString("GROUTINGMOULDCODE");
-									String orderNo = object2.optString("USERCODE");
-									int groutingDailyDetailId = object2.optInt("GROUTINGDAILYDETAILID");
+									String LogoCode = object2.optString("MATERIALCODE");
+									String LogoName = object2.optString("MATERIALREMARK");
+									int orderNo = object2.optInt("COUNT");
 									BarcodeInfo barcodeInfo = new BarcodeInfo();
-									barcodeInfo.setBanMa(barcode);
+									barcodeInfo.setBanMa(barcode=="null"?"":barcode);
 									barcodeInfo.setGoodsCode(goodsCode);
 									barcodeInfo.setLogoCode(LogoCode);
 									barcodeInfo.setLogoName(LogoName);
-									// barcodeInfo.setUserCode(userCode);
-									barcodeInfo.setOrderNo(orderNo);
-									barcodeInfo.setGroutingDailyDetailId(String.valueOf(groutingDailyDetailId));
+									barcodeInfo.setOrderNo(String.valueOf(orderNo));
+									barcodeInfo.setFinishedBarCode(object2.optString("FINISHEDLOADBATCHNO"));//判断是否重复
 									barcodeList.add(barcodeInfo);
 								}
 								if (adapter == null) {
@@ -1132,9 +1141,29 @@ public class SendOutGoods extends Activity {
 
 							}
 						}
-					} else {
+					} else if (status==-1)					
+					{
+						message="此产品已发货,不能进行该操作";
 						CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, getApplicationContext());
-						CommonUtil.showBarCodeAlertDialog(status, message, SendOutGoods.this, barcodeEdt, null, null);
+						CommonUtil.showBarCodeAlertDialog(0, message, SendOutGoods.this, barcodeEdt, null, null);
+						return;
+					}else if (status==-102)	
+					{
+						message="此产品未交接,不能进行该操作";
+						CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, getApplicationContext());
+						CommonUtil.showBarCodeAlertDialog(0, message, SendOutGoods.this, barcodeEdt, null, null);
+						return;
+					}else if (status==-100)	
+					{
+						message="此产品已被废弃,不能进行该操作";
+						CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, getApplicationContext());
+						CommonUtil.showBarCodeAlertDialog(0, message, SendOutGoods.this, barcodeEdt, null, null);
+						return;
+					}else if (status==-999)	
+					{
+						message="此产品无效条码,不能进行该操作";
+						CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, getApplicationContext());
+						CommonUtil.showBarCodeAlertDialog(0, message, SendOutGoods.this, barcodeEdt, null, null);
 						return;
 					}
 				} catch (JSONException e) {
@@ -1158,11 +1187,13 @@ public class SendOutGoods extends Activity {
 					JSONObject object = (JSONObject) jObject.opt("d");
 					int status = object.optInt("Status");
 					String message = object.optString("Message");
+					JSONObject result3 =(JSONObject) object.opt("Result");
+					JSONArray resArray = (JSONArray)result3.opt("Result");
 					if (status == 0) {
 						barcodeList.removeAll(barcodeList);
 						adapter.notifyDataSetChanged();
 						saveBtn.setText("保存(" + barcodeList.size() + ")");
-						CustomToast.showToast(getApplicationContext(), "上传成功", 2000);
+						CustomToast.showToast(getApplicationContext(), "成功", 2000);
 						CommonUtil.playSound(getApplicationContext());
 						checkedProcedureList.clear();
 						procedureTv.setText("");
@@ -1170,9 +1201,17 @@ public class SendOutGoods extends Activity {
 						desc = "";
 						booleans = new boolean[procedureList.size()];
 
-					} else {
+					} else if (status == 1) {	
+						CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, getApplicationContext());
+						CommonUtil.showSaveAlertDialog(0, "存在已发货产品", SendOutGoods.this, null, barcodeEdt, 2);					
+						
+					}else if (status == -102) {	
 						CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, getApplicationContext());
-						CommonUtil.showSaveAlertDialog(status, message, SendOutGoods.this, null, barcodeEdt, 2);
+						CommonUtil.showSaveAlertDialog(0, "库存不足", SendOutGoods.this, null, barcodeEdt, 2);					
+						
+					}else {
+						CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, getApplicationContext());
+						CommonUtil.showSaveAlertDialog(0, "失败", SendOutGoods.this, null, barcodeEdt, 2);
 					}
 				} catch (JSONException e) {
 
@@ -1307,18 +1346,19 @@ public class SendOutGoods extends Activity {
 					String message = object.optString("Message");
 					if (status == 0) {
 						String result = object.optString("Result");
-						JSONArray jArray = new JSONArray(result);
+						JSONArray jArr = new JSONArray(result);
+						storageJArray=(JSONArray)jArr.opt(0);
+						JSONArray jArray = (JSONArray)jArr.opt(1);
 						if (jArray != null && jArray.length() > 0) {
 							for (int i = 0; i < jArray.length(); i++) {
 								JSONObject object2 = (JSONObject) jArray.opt(i);
-								String barcode = object2.optString("BARCODE");
+								String barcode = object2.optString("BANMA");
 								String goodsCode = object2.optString("GOODSCODE");
-								String LogoCode = object2.optString("GROUTINGDATE");
+								String LogoCode = object2.optString("MATERIALCODE");
 								// groutingDate = CommonUtil.commonDateConverter(groutingDate);
-								String LogoName = object2.optString("GROUTINGMOULDCODE");
+								String LogoName = object2.optString("MATERIALREMARK");
 								// String userCode = object2.optString("USERCODE");
-								String orderNo = object2.optString("PROCEDURENAME");
-								int groutingDailyDetailId = object2.optInt("GROUTINGDAILYDETAILID");
+								String orderNo = object2.optString("COUNT");
 								BarcodeInfo barcodeInfo = new BarcodeInfo();
 								barcodeInfo.setBanMa(barcode);
 								barcodeInfo.setGoodsCode(goodsCode);
@@ -1326,7 +1366,7 @@ public class SendOutGoods extends Activity {
 								barcodeInfo.setLogoName(LogoName);
 								// barcodeInfo.setUserCode(userCode);
 								barcodeInfo.setOrderNo(orderNo);
-								barcodeInfo.setGroutingDailyDetailId(String.valueOf(groutingDailyDetailId));
+								barcodeInfo.setFinishedBarCode(object2.optString("FINISHEDLOADBATCHNO"));
 								barcodeList.add(barcodeInfo);
 							}
 							if (adapter == null) {

+ 5 - 0
src/com/jiaju/adapter/ProductLineExpandableListView.java

@@ -81,6 +81,7 @@ import com.jiaju.activity.SemiCheckRegisterActivity;
 import com.jiaju.activity.SemiCheckRegisterModifyActivity;
 import com.jiaju.activity.SemiCheckReworkActivity;
 import com.jiaju.activity.SemiCheckReworkModifyActivity;
+import com.jiaju.activity.SendOutGoods;
 import com.jiaju.activity.SpotCheckActivity;
 import com.jiaju.activity.SpotCheckRecordActivity;
 import com.jiaju.activity.StationBarcodePrintActivity;
@@ -1372,6 +1373,10 @@ public class ProductLineExpandableListView extends ExpandableListView
 			i.putExtras(b);
 			i.setClass(mContext, CancelGroutingScrapActivity.class);
 			mContext.startActivity(i);
+		}else if (procedureMenuCode.equals("063101")) {
+			Intent i = new Intent();
+			i.setClass(mContext, SendOutGoods.class);
+			mContext.startActivity(i);
 		}
 
 		else if (procedureMenuCode.equals("062401")) {