|
|
@@ -30,7 +30,11 @@ import com.uas.uaspda.tools.SharedPreUtil;
|
|
|
import com.uas.uaspda.tools.VolleyUtil;
|
|
|
import com.uas.uaspda.util.CommonUtil;
|
|
|
import com.uas.uaspda.util.Constants;
|
|
|
+import com.uas.uaspda.util.FastjsonUtil;
|
|
|
+import com.uas.uaspda.util.HttpCallback;
|
|
|
+import com.uas.uaspda.util.HttpParams;
|
|
|
import com.uas.uaspda.util.JsonUtils;
|
|
|
+import com.uas.uaspda.util.VolleyRequest;
|
|
|
import com.uas.uaspda.view.ClearableEditText;
|
|
|
import com.uas.uaspda.view.TextViewWithButton;
|
|
|
|
|
|
@@ -46,7 +50,7 @@ import java.util.Map;
|
|
|
*/
|
|
|
public class SCSMTChangeFragment extends BaseFragment implements TextViewWithButton.TvHintHelper, View.OnClickListener {
|
|
|
JSONObject makeCraft;
|
|
|
- TextViewWithButton tvLocation, tvBarcode, tvRemainqty, mLocationTextView;
|
|
|
+ TextViewWithButton tvLocation, tvBarcode, tvRemainqty, mLocationTextView, mFeederTextView;
|
|
|
TextView tvMsgNotice, tvMsgLocation, tvMsgProdcode, tvMsgBarcode, tvMsgQuantity, tvMsgSpec;
|
|
|
RelativeLayout rlCollect;
|
|
|
int wrongColor, rightColor;
|
|
|
@@ -62,6 +66,8 @@ public class SCSMTChangeFragment extends BaseFragment implements TextViewWithBut
|
|
|
private String mSmtLocationCache;
|
|
|
private SmtDslBean mSmtDslBean = new SmtDslBean();
|
|
|
private StringRequest mStringRequest;
|
|
|
+ private TextViewWithButton.OnTextClearListener mLocationClearListener;
|
|
|
+ private TextViewWithButton.OnTextClearListener mFeederClearListener;
|
|
|
|
|
|
@Override
|
|
|
protected int getLayout() {
|
|
|
@@ -88,10 +94,11 @@ public class SCSMTChangeFragment extends BaseFragment implements TextViewWithBut
|
|
|
mMacodeTextView = (TextView) root.findViewById(R.id.smt_change_macode_tv);
|
|
|
mLocationTextView = (TextViewWithButton) root.findViewById(R.id.smt_change_location_tv);
|
|
|
mCollectEditText = (ClearableEditText) root.findViewById(R.id.smt_change_collect_et);
|
|
|
+ mFeederTextView = root.findViewById(R.id.smt_change_feeder_tv);
|
|
|
|
|
|
mCollectEditText.requestFocus();
|
|
|
|
|
|
- mCollectEditText.setHint("请采集换料站位");
|
|
|
+ mCollectEditText.setHint("请采集飞达编号");
|
|
|
wrongColor = getResources().getColor(R.color.text_error);
|
|
|
rightColor = getResources().getColor(R.color.green);
|
|
|
|
|
|
@@ -143,26 +150,37 @@ public class SCSMTChangeFragment extends BaseFragment implements TextViewWithBut
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- mLocationTextView.setOnTextClearListener(new TextViewWithButton.OnTextClearListener() {
|
|
|
+ mFeederClearListener = new TextViewWithButton.OnTextClearListener() {
|
|
|
@Override
|
|
|
public void onTextClear() {
|
|
|
- mCollectEditText.setHint("请采集换料站位");
|
|
|
+ mLocationTextView.setOnTextClearListener(null);
|
|
|
+ mLocationTextView.setText("");
|
|
|
+ mLocationTextView.setOnTextClearListener(mLocationClearListener);
|
|
|
+ mCollectEditText.setHint("请采集飞达编号");
|
|
|
mCollectEditText.setText("");
|
|
|
+ }
|
|
|
+ };
|
|
|
|
|
|
-// tvMsgNotice.setText("");
|
|
|
-// tvMsgProdcode.setText("");
|
|
|
-// tvMsgLocation.setText("");
|
|
|
-// tvMsgBarcode.setText("");
|
|
|
-// tvMsgQuantity.setText("");
|
|
|
-// tvMsgSpec.setText("");
|
|
|
+ mLocationClearListener = new TextViewWithButton.OnTextClearListener() {
|
|
|
+ @Override
|
|
|
+ public void onTextClear() {
|
|
|
+ mFeederTextView.setOnTextClearListener(null);
|
|
|
+ mFeederTextView.setText("");
|
|
|
+ mFeederTextView.setOnTextClearListener(mFeederClearListener);
|
|
|
+ mCollectEditText.setHint("请采集飞达编号");
|
|
|
+ mCollectEditText.setText("");
|
|
|
}
|
|
|
- });
|
|
|
+ };
|
|
|
+
|
|
|
+ mLocationTextView.setOnTextClearListener(mLocationClearListener);
|
|
|
+
|
|
|
+ mFeederTextView.setOnTextClearListener(mFeederClearListener);
|
|
|
}
|
|
|
|
|
|
private void confirmEvent(String collect) {
|
|
|
String location = mLocationTextView.getText().toString().trim();
|
|
|
if (TextUtils.isEmpty(location)) {
|
|
|
- locationCheck(collect);
|
|
|
+ feederGetLocation(collect);
|
|
|
} else {
|
|
|
mSmtDslBean.setDsl_barcode(collect);
|
|
|
//接料操作
|
|
|
@@ -170,7 +188,48 @@ public class SCSMTChangeFragment extends BaseFragment implements TextViewWithBut
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void locationCheck(String collect) {
|
|
|
+ private void feederGetLocation(String collect) {
|
|
|
+ progressDialog.show();
|
|
|
+ VolleyRequest.getInstance().stringRequest(new HttpParams.Builder()
|
|
|
+ .url(GloableParams.ADDRESS_SMT_GETFEEDERBARCODE)
|
|
|
+ .method(Request.Method.POST)
|
|
|
+ .addParam("fe_code", collect)
|
|
|
+ .build(), new HttpCallback() {
|
|
|
+ @Override
|
|
|
+ public void onSuccess(int flag, Object o) throws Exception {
|
|
|
+ try {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ String result = o.toString();
|
|
|
+ com.alibaba.fastjson.JSONObject resultObject = JSON.parseObject(result);
|
|
|
+ com.alibaba.fastjson.JSONObject dataObject = resultObject.getJSONObject("data");
|
|
|
+ if (dataObject != null) {
|
|
|
+ String fe_code = FastjsonUtil.getText(dataObject, "fe_code");
|
|
|
+ String fe_location = FastjsonUtil.getText(dataObject, "fe_location");
|
|
|
+
|
|
|
+ locationCheck(fe_location, fe_code);
|
|
|
+ } else {
|
|
|
+ tvMsgNotice.setTextColor(getResources().getColor(R.color.red));
|
|
|
+ tvMsgNotice.setText("数据为空");
|
|
|
+ CommonUtil.makeNotice();
|
|
|
+ mCollectEditText.setText("");
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onFail(int flag, String failStr) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ tvMsgNotice.setTextColor(getResources().getColor(R.color.red));
|
|
|
+ tvMsgNotice.setText(failStr);
|
|
|
+ CommonUtil.makeNotice();
|
|
|
+ mCollectEditText.setText("");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ private void locationCheck(String collect, String feeder) {
|
|
|
tvMsgProdcode.setText("");
|
|
|
tvMsgLocation.setText("");
|
|
|
tvMsgBarcode.setText("");
|
|
|
@@ -187,6 +246,7 @@ public class SCSMTChangeFragment extends BaseFragment implements TextViewWithBut
|
|
|
if (collect.equals(JsonUtils.optStringNotNull(locationObject, "PSL_LOCATION"))) {
|
|
|
isExist = true;
|
|
|
mLocationTextView.setText(collect);
|
|
|
+ mFeederTextView.setText(feeder);
|
|
|
mCollectEditText.setText("");
|
|
|
|
|
|
String psl_prodcode = JsonUtils.optStringNotNull(locationObject, "PSL_PRODCODE");
|
|
|
@@ -200,7 +260,7 @@ public class SCSMTChangeFragment extends BaseFragment implements TextViewWithBut
|
|
|
// tvMsgNotice.setText("站位采集成功,请采集首选料[" + psl_prodcode + "]的料卷编号");
|
|
|
// else
|
|
|
String[] repcodes = psl_repcode.split(",");
|
|
|
- String notice = "站位采集成功,请采集物料\n";
|
|
|
+ String notice = "飞达采集成功,请采集物料\n";
|
|
|
for (int j = 0; j < repcodes.length; j++) {
|
|
|
String repcode = repcodes[j];
|
|
|
notice = notice + repcode + "\n";
|
|
|
@@ -210,10 +270,10 @@ public class SCSMTChangeFragment extends BaseFragment implements TextViewWithBut
|
|
|
tvMsgNotice.setText(notice);
|
|
|
} else if (!TextUtils.isEmpty(psl_prodcode)) {
|
|
|
tvMsgNotice.setTextColor(getResources().getColor(R.color.green));
|
|
|
- tvMsgNotice.setText("站位采集成功,请采集物料\n" + psl_prodcode + "\n的料卷编号/物料编号");
|
|
|
+ tvMsgNotice.setText("飞达采集成功,请采集物料\n" + psl_prodcode + "\n的料卷编号/物料编号");
|
|
|
} else {
|
|
|
tvMsgNotice.setTextColor(getResources().getColor(R.color.green));
|
|
|
- tvMsgNotice.setText("站位采集成功,物料编号获取失败");
|
|
|
+ tvMsgNotice.setText("飞达采集成功,物料编号获取失败");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -270,7 +330,7 @@ public class SCSMTChangeFragment extends BaseFragment implements TextViewWithBut
|
|
|
mCollectEditText.setText("");
|
|
|
|
|
|
mSmtDslBean = new SmtDslBean();
|
|
|
- mCollectEditText.setHint("请采集换料站位");
|
|
|
+ mCollectEditText.setHint("请采集飞达编号");
|
|
|
}
|
|
|
} catch (JSONException e) {
|
|
|
e.printStackTrace();
|