|
|
@@ -9,26 +9,20 @@ import java.util.List;
|
|
|
import org.json.JSONArray;
|
|
|
import org.json.JSONException;
|
|
|
import org.json.JSONObject;
|
|
|
-
|
|
|
+
|
|
|
import com.jiaju.adapter.FactoryTransferInListMessageAdapter;
|
|
|
import com.jiaju.adapter.SendOutSpinnerAdapter;
|
|
|
-import com.jiaju.model.BarcodeInfo;
|
|
|
-import com.jiaju.model.CarBrandModel;
|
|
|
-import com.jiaju.model.Procedure;
|
|
|
-import com.jiaju.model.ReceiveModel;
|
|
|
+import com.jiaju.model.BarcodeInfo;
|
|
|
+import com.jiaju.model.Procedure;
|
|
|
import com.jiaju.model.SendOutModel;
|
|
|
import com.jiaju.net.WebClient;
|
|
|
import com.jiaju.utils.CommonUtil;
|
|
|
import com.jiaju.utils.Constants;
|
|
|
-import com.jiaju.utils.CustomToast;
|
|
|
-import com.jiaju.utils.MultiChoiceProcedurePopWindow;
|
|
|
+import com.jiaju.utils.CustomToast;
|
|
|
import com.jiaju.utils.ProcessDialogUtils;
|
|
|
-import android.app.Activity;
|
|
|
-import android.app.AlertDialog;
|
|
|
-import android.app.Dialog;
|
|
|
+import android.app.Activity;
|
|
|
import android.app.Notification;
|
|
|
-import android.content.Context;
|
|
|
-import android.content.DialogInterface;
|
|
|
+import android.content.Context;
|
|
|
import android.content.SharedPreferences;
|
|
|
import android.os.Bundle;
|
|
|
import android.os.Handler;
|
|
|
@@ -46,8 +40,7 @@ import android.view.Menu;
|
|
|
import android.view.MenuItem;
|
|
|
import android.view.View;
|
|
|
import android.view.View.OnClickListener;
|
|
|
-import android.view.inputmethod.EditorInfo;
|
|
|
-import android.widget.AdapterView;
|
|
|
+import android.view.inputmethod.EditorInfo;
|
|
|
import android.widget.Button;
|
|
|
import android.widget.EditText;
|
|
|
import android.widget.ImageButton;
|
|
|
@@ -56,7 +49,7 @@ import android.widget.Spinner;
|
|
|
import android.widget.TextView;
|
|
|
import android.widget.Toast;
|
|
|
|
|
|
-//
|
|
|
+// 工厂调入
|
|
|
public class FactoryTransferInActivity extends Activity {
|
|
|
|
|
|
private String serverAddress_ip;
|
|
|
@@ -69,20 +62,20 @@ public class FactoryTransferInActivity extends Activity {
|
|
|
private SharedPreferences preferences;
|
|
|
private HandlerThread thread;
|
|
|
private Handler mHandler;
|
|
|
- private List<Procedure> procedureList;
|
|
|
+ private List<Procedure> procedureList;
|
|
|
private TextView title;
|
|
|
private TextView backtext;
|
|
|
private ImageButton backbtn;
|
|
|
private Object obj = new Object();
|
|
|
boolean booleans[];
|
|
|
boolean booleansTemp[];
|
|
|
- boolean[] selItems;
|
|
|
- private EditText barcodeEdt;
|
|
|
+ boolean[] selItems;
|
|
|
+ private EditText barcodeEdt;
|
|
|
private String barcodeUpper;
|
|
|
private String Lgort;// 发出仓
|
|
|
private TextView procedureTv;
|
|
|
private List<BarcodeInfo> barcodeList;
|
|
|
- private List<SendOutModel> sendOutList;
|
|
|
+ private List<SendOutModel> sendOutList;
|
|
|
private JSONArray storageJArray;// 库存
|
|
|
private ListView messageLst;
|
|
|
public Button saveBtn;
|
|
|
@@ -92,7 +85,7 @@ public class FactoryTransferInActivity extends Activity {
|
|
|
private String desc;
|
|
|
private SendOutSpinnerAdapter sendOutAdapter;
|
|
|
private Handler barcodeUpperH = new Handler();
|
|
|
- private FactoryTransferInListMessageAdapter adapter;
|
|
|
+ private FactoryTransferInListMessageAdapter adapter;
|
|
|
private boolean isFirst = true;
|
|
|
private int Height = 188;
|
|
|
private String DATAKEY = "";
|
|
|
@@ -111,27 +104,29 @@ public class FactoryTransferInActivity extends Activity {
|
|
|
barcodeList = new ArrayList<BarcodeInfo>();
|
|
|
initView();
|
|
|
procedureTv.setText(send_userCode);
|
|
|
- allListeners();
|
|
|
-// updateDataKey();
|
|
|
-
|
|
|
+ allListeners();
|
|
|
+
|
|
|
thread = new HandlerThread("HandlerThread2", 5);
|
|
|
thread.start();
|
|
|
mHandler = new Handler(thread.getLooper());
|
|
|
SendOutRunnable glazeRunnable = new SendOutRunnable(obj);
|
|
|
mHandler.post(glazeRunnable);
|
|
|
- }
|
|
|
-
|
|
|
- /** 更新唯一标识 */
|
|
|
- private void updateDataKey() {
|
|
|
- // 获取当前时间戳
|
|
|
- long timestamp = new Date().getTime();
|
|
|
-
|
|
|
- // 获取TextView文本内容
|
|
|
- String text = procedureTv.getText().toString();
|
|
|
+
|
|
|
+ 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) {
|
|
|
|
|
|
- // 拼接字符串
|
|
|
- DATAKEY = timestamp + "-" + text;
|
|
|
- }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ } });
|
|
|
+ }
|
|
|
|
|
|
private class SendOutRunnable implements Runnable {
|
|
|
private Object object;
|
|
|
@@ -144,7 +139,7 @@ public class FactoryTransferInActivity extends Activity {
|
|
|
public void run() {
|
|
|
synchronized (object) {
|
|
|
try {
|
|
|
- //ProcessDialogUtils.showProcessDialog(FactoryTransferInActivity.this);
|
|
|
+ // ProcessDialogUtils.showProcessDialog(FactoryTransferInActivity.this);
|
|
|
client = null;
|
|
|
client = new WebClient();
|
|
|
JSONObject js = new JSONObject();
|
|
|
@@ -356,18 +351,14 @@ public class FactoryTransferInActivity extends Activity {
|
|
|
}
|
|
|
|
|
|
Runnable BarcodeUpperCase = new Runnable() {
|
|
|
-
|
|
|
@Override
|
|
|
public void run() {
|
|
|
// 小写转大写
|
|
|
barcodeEdt.setText(barcodeUpper.toUpperCase());
|
|
|
// 设置EditText光标位置
|
|
|
barcodeEdt.setSelection(barcodeUpper.length());
|
|
|
-
|
|
|
}
|
|
|
-
|
|
|
};
|
|
|
-
|
|
|
|
|
|
public boolean removeFinishedBarCode(String code, List<BarcodeInfo> data) {
|
|
|
boolean rem = false;
|
|
|
@@ -456,24 +447,22 @@ public class FactoryTransferInActivity extends Activity {
|
|
|
backbtn = (ImageButton) findViewById(R.id.left_img);
|
|
|
backtext = (TextView) findViewById(R.id.back);
|
|
|
title.setText("工厂调入");
|
|
|
- View head = View.inflate(this,
|
|
|
- R.layout.factory_transferin_head, null);
|
|
|
-
|
|
|
+ View head = View.inflate(this, R.layout.factory_transferin_head, null);
|
|
|
+
|
|
|
procedureTv = (TextView) head.findViewById(R.id.procedureTvFt);
|
|
|
procedureTv.setMovementMethod(ScrollingMovementMethod.getInstance());
|
|
|
procedureTv.setEllipsize(TextUtils.TruncateAt.MARQUEE);
|
|
|
- procedureTv.setMarqueeRepeatLimit(6);
|
|
|
+ procedureTv.setMarqueeRepeatLimit(6);
|
|
|
barcodeEdt = (EditText) head.findViewById(R.id.barcodeEdtt);
|
|
|
barcodeEdt.setRawInputType(InputType.TYPE_CLASS_NUMBER);
|
|
|
sendOutSpinner = (Spinner) head.findViewById(R.id.fatory_transfer_in);
|
|
|
- CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
|
|
|
+ CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
|
|
|
messageLst = (ListView) findViewById(R.id.message_listview_ft);
|
|
|
messageLst.addHeaderView(head, null, false);
|
|
|
- adapter = new FactoryTransferInListMessageAdapter(FactoryTransferInActivity.this,
|
|
|
- barcodeList);
|
|
|
+ adapter = new FactoryTransferInListMessageAdapter(FactoryTransferInActivity.this, barcodeList);
|
|
|
messageLst.setAdapter(adapter);
|
|
|
saveBtn = (Button) findViewById(R.id.btnSaveFT);
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
private class SaveRunnable implements Runnable {
|
|
|
@@ -505,9 +494,9 @@ public class FactoryTransferInActivity extends Activity {
|
|
|
|
|
|
js.put("setEntity", js6);
|
|
|
JSONArray jarrayDetails = new JSONArray();
|
|
|
- if (barcodeList != null && barcodeList.size() > 0) {
|
|
|
+ if (barcodeList != null && barcodeList.size() > 0) {
|
|
|
for (BarcodeInfo bd : barcodeList) {
|
|
|
- JSONObject jo6 = new JSONObject();
|
|
|
+ JSONObject jo6 = new JSONObject();
|
|
|
jo6.put("BARCODE", bd.getBarcode());
|
|
|
jo6.put("GOODSCODE", bd.getGoodsCode());
|
|
|
jo6.put("MATERIALCODE", bd.getMaterialCode());
|
|
|
@@ -529,9 +518,9 @@ public class FactoryTransferInActivity extends Activity {
|
|
|
js5.put("sessionKey", sessionkey);
|
|
|
js5.put("module", "DockingLuoci");
|
|
|
js5.put("action", "SaveDockingLuoci");
|
|
|
- JSONObject data = new JSONObject();
|
|
|
+ JSONObject data = new JSONObject();
|
|
|
data.put("Table", jarrayDetails);
|
|
|
- js5.put("jsonData", data.toString());
|
|
|
+ js5.put("jsonData", data.toString());
|
|
|
String result = client.doPost(
|
|
|
"http://" + serverAddress_ip + ":" + serverAddress_port + Constants.serverAction + "/DoAction",
|
|
|
js5.toString(), "application/json");
|
|
|
@@ -577,7 +566,7 @@ public class FactoryTransferInActivity extends Activity {
|
|
|
js.put("action", "CheckDockingLuoci");
|
|
|
JSONObject data = new JSONObject();
|
|
|
data.put("barcode", barcode);
|
|
|
- SendOutModel model = (SendOutModel) sendOutSpinner.getSelectedItem();
|
|
|
+ SendOutModel model = (SendOutModel) sendOutSpinner.getSelectedItem();
|
|
|
data.put("workshop", model.getSendOutId());
|
|
|
// data.put("workshop", 154);
|
|
|
js.put("jsonData", data.toString());
|
|
|
@@ -640,7 +629,7 @@ public class FactoryTransferInActivity extends Activity {
|
|
|
procedureList.add(procedure);
|
|
|
}
|
|
|
|
|
|
- booleans = new boolean[procedureList.size()];
|
|
|
+ booleans = new boolean[procedureList.size()];
|
|
|
|
|
|
}
|
|
|
} else {
|
|
|
@@ -669,13 +658,12 @@ public class FactoryTransferInActivity extends Activity {
|
|
|
String message = object.optString("Message");
|
|
|
|
|
|
if (status == 0) {
|
|
|
-
|
|
|
// barcodeList 必须先保存前面的板码信息,然后才能在扫描
|
|
|
- if (barcodeList!=null && barcodeList.size() > 0) {
|
|
|
+ if (barcodeList != null && barcodeList.size() > 0) {
|
|
|
message = "必须先保存当前的产品信息,不能进行多板扫码操作";
|
|
|
CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, getApplicationContext());
|
|
|
- CommonUtil.showBarCodeAlertDialog(0, message, FactoryTransferInActivity.this, barcodeEdt, null,
|
|
|
- null);
|
|
|
+ CommonUtil.showBarCodeAlertDialog(0, message, FactoryTransferInActivity.this, barcodeEdt,
|
|
|
+ null, null);
|
|
|
barcodeEdt.setEnabled(true);
|
|
|
barcodeEdt.setText("");
|
|
|
barcodeEdt.setFocusable(true);
|
|
|
@@ -691,11 +679,11 @@ public class FactoryTransferInActivity extends Activity {
|
|
|
}
|
|
|
} });
|
|
|
CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
|
|
|
-
|
|
|
+
|
|
|
ProcessDialogUtils.closeProgressDilog();
|
|
|
return;
|
|
|
- }
|
|
|
-
|
|
|
+ }
|
|
|
+
|
|
|
String result = object.optString("Result");
|
|
|
JSONObject jobj4 = new JSONObject(result);
|
|
|
JSONArray jArray = jobj4.optJSONArray("Table");
|
|
|
@@ -704,12 +692,11 @@ public class FactoryTransferInActivity extends Activity {
|
|
|
JSONObject object2 = (JSONObject) jArray.opt(i);
|
|
|
String barcode = object2.optString("BARCODE");
|
|
|
String materialCode = object2.optString("MATERIALCODE");
|
|
|
- String goodsCode = object2.optString("GOODSCODE");
|
|
|
+ String goodsCode = object2.optString("GOODSCODE");
|
|
|
int goodsId = object2.optInt("GOODSID");
|
|
|
String logoName = object2.optString("LOGONAME");
|
|
|
int logoId = object2.optInt("LOGOID");
|
|
|
- boolean isHas = removeFinishedBarCode(object2.optString("BARCODE"),
|
|
|
- barcodeList);
|
|
|
+ boolean isHas = removeFinishedBarCode(object2.optString("BARCODE"), barcodeList);
|
|
|
if (isHas) {
|
|
|
CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
|
|
|
CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, getApplicationContext());
|
|
|
@@ -717,12 +704,12 @@ public class FactoryTransferInActivity extends Activity {
|
|
|
break;
|
|
|
}
|
|
|
BarcodeInfo barcodeInfo = new BarcodeInfo();
|
|
|
- barcodeInfo.setBarcode( barcode);
|
|
|
+ barcodeInfo.setBarcode(barcode);
|
|
|
barcodeInfo.setGoodsId(goodsId);
|
|
|
barcodeInfo.setGoodsCode(goodsCode);
|
|
|
barcodeInfo.setLogoId(logoId);
|
|
|
barcodeInfo.setLogoName(logoName);
|
|
|
- barcodeInfo.setMaterialCode(materialCode);
|
|
|
+ barcodeInfo.setMaterialCode(materialCode);
|
|
|
barcodeList.add(barcodeInfo);
|
|
|
}
|
|
|
// messageLst.getLayoutParams().height = (barcodeList.size() * Height);
|
|
|
@@ -752,35 +739,30 @@ public class FactoryTransferInActivity extends Activity {
|
|
|
}
|
|
|
} });
|
|
|
CommonUtil.BarcodeMaxLength(barcodeEdt, 50);
|
|
|
-
|
|
|
+
|
|
|
ProcessDialogUtils.closeProgressDilog();
|
|
|
|
|
|
- } else if (status == -1) {
|
|
|
- CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, getApplicationContext());
|
|
|
- CommonUtil.showBarCodeAlertDialog(0, message, FactoryTransferInActivity.this, barcodeEdt, null,
|
|
|
- null);
|
|
|
- return;
|
|
|
- } else if (status == -102) {
|
|
|
- message = "此产品未交接,不能进行该操作";
|
|
|
- CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, getApplicationContext());
|
|
|
- CommonUtil.showBarCodeAlertDialog(0, message, FactoryTransferInActivity.this, barcodeEdt, null,
|
|
|
- null);
|
|
|
- return;
|
|
|
- } else if (status == -100) {
|
|
|
- message = "此产品已被废弃,不能进行该操作";
|
|
|
- CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, getApplicationContext());
|
|
|
- CommonUtil.showBarCodeAlertDialog(0, message, FactoryTransferInActivity.this, barcodeEdt, null,
|
|
|
- null);
|
|
|
- return;
|
|
|
- } else if (status == -999) {
|
|
|
- message = "此产品无效条码,不能进行该操作";
|
|
|
+ } else {
|
|
|
+ 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.setDefault(Notification.DEFAULT_VIBRATE, getApplicationContext());
|
|
|
CommonUtil.showBarCodeAlertDialog(0, message, FactoryTransferInActivity.this, barcodeEdt, null,
|
|
|
null);
|
|
|
return;
|
|
|
}
|
|
|
} catch (JSONException e) {
|
|
|
-
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
|
|
|
@@ -800,32 +782,26 @@ public class FactoryTransferInActivity 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) {
|
|
|
+ CustomToast.showToast(getApplicationContext(), "保存成功", 2000);
|
|
|
barcodeList.removeAll(barcodeList);
|
|
|
adapter.notifyDataSetChanged();
|
|
|
- messageLst.getLayoutParams().height = (barcodeList.size() * Height);
|
|
|
saveBtn.setText("保存(" + barcodeList.size() + ")");
|
|
|
CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, getApplicationContext());
|
|
|
-// CommonUtil.showSaveAlertDialog(0,message , FactoryTransferInActivity.this, null, barcodeEdt, 2);
|
|
|
-// CustomToast.showToast(getApplicationContext(), "成功", 2000);
|
|
|
-// CommonUtil.playSound(getApplicationContext());
|
|
|
- // checkedProcedureList.clear();
|
|
|
- // procedureTv.setText("");
|
|
|
- // descEdt.setText("");
|
|
|
- // desc = "";
|
|
|
- // booleans = new boolean[procedureList.size()];
|
|
|
- Dialog alertDialog = new AlertDialog.Builder(FactoryTransferInActivity.this).setMessage(message)
|
|
|
- .setPositiveButton("确定", new DialogInterface.OnClickListener() {
|
|
|
- @Override
|
|
|
- public void onClick(DialogInterface dialog, int which) {
|
|
|
-
|
|
|
- finish();
|
|
|
- }
|
|
|
- }).create();
|
|
|
- alertDialog.setCanceledOnTouchOutside(false);
|
|
|
- alertDialog.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;
|
|
|
+ }
|
|
|
+ } });
|
|
|
|
|
|
} else {
|
|
|
CommonUtil.setDefault(Notification.DEFAULT_VIBRATE, getApplicationContext());
|
|
|
@@ -970,8 +946,6 @@ public class FactoryTransferInActivity extends Activity {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-
|
|
|
-
|
|
|
@Override
|
|
|
public boolean onCreateOptionsMenu(Menu menu) {
|
|
|
|