|
@@ -8,40 +8,45 @@ import android.content.IntentFilter;
|
|
|
import android.os.Bundle;
|
|
|
import android.os.Handler;
|
|
|
import android.os.Message;
|
|
|
-import android.text.Editable;
|
|
|
-import android.text.TextWatcher;
|
|
|
+import android.support.v7.widget.RecyclerView;
|
|
|
import android.view.KeyEvent;
|
|
|
import android.view.View;
|
|
|
-import android.view.inputmethod.EditorInfo;
|
|
|
import android.widget.EditText;
|
|
|
-import android.widget.GridLayout;
|
|
|
-import android.widget.ImageButton;
|
|
|
import android.widget.LinearLayout;
|
|
|
import android.widget.TextView;
|
|
|
|
|
|
+import com.chad.library.adapter.base.BaseQuickAdapter;
|
|
|
import com.elvishew.xlog.XLog;
|
|
|
import com.fxy.R;
|
|
|
-import com.fxy.adapter.GridImageAdapter;
|
|
|
-import com.fxy.adapter.ShowPictureAdapter;
|
|
|
+import com.fxy.adapter.PictureListAdapter;
|
|
|
import com.fxy.baselibrary.base.BaseActivity;
|
|
|
import com.fxy.baselibrary.bean.BaseEventBusBean;
|
|
|
import com.fxy.baselibrary.interfaces.OnRxScanerListener;
|
|
|
-import com.fxy.baselibrary.qrcode.ActivityScanerCode;
|
|
|
import com.fxy.baselibrary.util.JsonUtil;
|
|
|
+import com.fxy.baselibrary.views.MarqueeTextView;
|
|
|
import com.fxy.bean.ActionBean;
|
|
|
import com.fxy.bean.ScanBean;
|
|
|
+import com.fxy.common.PictureSelectorUpload;
|
|
|
import com.fxy.constant.BaseConfig;
|
|
|
import com.fxy.constant.EventCode;
|
|
|
+import com.fxy.detection.bean.StepsBaseBean;
|
|
|
+import com.fxy.detection.bean.StepsInfoBean;
|
|
|
+import com.fxy.detection.bean.StepsPictureBean;
|
|
|
import com.fxy.net.MyDialogCallback;
|
|
|
import com.fxy.net.Urls;
|
|
|
-import com.fxy.view.FloatingImageView;
|
|
|
+import com.google.gson.Gson;
|
|
|
import com.google.zxing.Result;
|
|
|
+import com.luck.picture.lib.config.PictureConfig;
|
|
|
+import com.luck.picture.lib.entity.LocalMedia;
|
|
|
import com.lzy.okgo.OkGo;
|
|
|
import com.lzy.okgo.model.Response;
|
|
|
|
|
|
+import org.json.JSONArray;
|
|
|
+import org.json.JSONException;
|
|
|
import org.json.JSONObject;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
|
|
|
import butterknife.BindView;
|
|
@@ -52,35 +57,75 @@ import sto.android.app.StoJNI;
|
|
|
import sto.android.app.StoPdaKeyEvent;
|
|
|
import sto.android.app.StoTongJNI;
|
|
|
|
|
|
+import static com.fxy.baselibrary.util.Tools.getScreenHeight;
|
|
|
+import static com.fxy.baselibrary.util.Tools.getScreenWidth;
|
|
|
+
|
|
|
public class DetectionWorkMainActivity extends BaseActivity implements StoJNI.ScanCallBack {
|
|
|
/**
|
|
|
* 列表适配器
|
|
|
*/
|
|
|
Context mContext = this;
|
|
|
|
|
|
- //单号
|
|
|
- @BindView(R.id.et_box_code)
|
|
|
- EditText etBoxCode;
|
|
|
|
|
|
- //单号
|
|
|
- @BindView(R.id.et_location_code)
|
|
|
- EditText etLocationCode;
|
|
|
+ @BindView(R.id.mt_box_number)
|
|
|
+ MarqueeTextView mtBoxNumber;
|
|
|
|
|
|
- @BindView(R.id.gl_img)
|
|
|
- GridLayout glImg;
|
|
|
+ @BindView(R.id.mt_unit_code)
|
|
|
+ MarqueeTextView mtUnitCode;
|
|
|
|
|
|
- //扫码扫码动作
|
|
|
- private ScanBean scanBean;
|
|
|
+ @BindView(R.id.recyclerview)
|
|
|
+ RecyclerView recyclerView;
|
|
|
+
|
|
|
+
|
|
|
+ @BindView(R.id.tv_pictures_type)
|
|
|
+ TextView tvPicturesType;
|
|
|
+
|
|
|
+
|
|
|
+ @BindView(R.id.btn_last_step)
|
|
|
+ TextView btnLastStep;
|
|
|
+
|
|
|
+ @BindView(R.id.btn_confirm)
|
|
|
+ TextView btnConfirm;
|
|
|
+//
|
|
|
+ @BindView(R.id.ll_recycler_view)
|
|
|
+ LinearLayout llRecyclerView;
|
|
|
+
|
|
|
+ private PictureListAdapter pictureAdapter;
|
|
|
+
|
|
|
+ //分步数据
|
|
|
+ private JSONObject stepsBaseObject = new JSONObject();
|
|
|
+ private List<JSONObject> stepsListObject = new ArrayList();
|
|
|
+ private List<String> mapPictureCode = new ArrayList();
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ private StepsBaseBean stepsBaseBean;
|
|
|
+ private List<StepsPictureBean> listStepsPictureBean;
|
|
|
+
|
|
|
+ private String nodeCode = "";
|
|
|
|
|
|
- //浮动按钮
|
|
|
- @BindView(R.id.iv_drag)
|
|
|
- FloatingImageView iv_drag;
|
|
|
+ private JSONObject submitData = new JSONObject();
|
|
|
|
|
|
- private ShowPictureAdapter pictureAdapter;
|
|
|
-
|
|
|
+
|
|
|
+ //当几个
|
|
|
+ private HashMap<Integer,String> mapStepsAttrId = new HashMap<>();;
|
|
|
+ private HashMap<Integer,PictureSelectorUpload> mapPictureSelector = new HashMap<>();;
|
|
|
+ //第几部
|
|
|
+ private int step;
|
|
|
+
|
|
|
+ private int currentPictureInx = -1;
|
|
|
+
|
|
|
+ //所有选择中数据
|
|
|
+ private HashMap<Integer, HashMap<Integer,String>> AllStepsAttrId = new HashMap<>();
|
|
|
+ private HashMap<Integer,HashMap<Integer,PictureSelectorUpload>> AllPictureSelector= new HashMap<>();
|
|
|
+
|
|
|
+ private JSONArray submitStepsArray = new JSONArray();
|
|
|
+
|
|
|
+ private ScanBean scanBean;
|
|
|
|
|
|
private Unbinder unbinder;
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public int getContentViewResId() {
|
|
@@ -100,6 +145,9 @@ public class DetectionWorkMainActivity extends BaseActivity implements StoJNI.Sc
|
|
|
@Override
|
|
|
protected void getBundleExtras(Bundle bundle) {
|
|
|
|
|
|
+ stepsBaseBean = JsonUtil.jsonString2Bean(bundle.getString("data"),StepsBaseBean.class);
|
|
|
+ step = bundle.getInt("step",0);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
//finish的返回监听
|
|
@@ -111,6 +159,17 @@ public class DetectionWorkMainActivity extends BaseActivity implements StoJNI.Sc
|
|
|
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
|
super.onActivityResult(requestCode, resultCode, data);
|
|
|
|
|
|
+ // 图片选择结果回调
|
|
|
+ if (resultCode == RESULT_OK) {
|
|
|
+ // 图片选择结果回调
|
|
|
+ if (requestCode == PictureConfig.CHOOSE_REQUEST || requestCode == PictureConfig.REQUEST_CAMERA) {
|
|
|
+ PictureSelectorUpload filedUpload = mapPictureSelector.get(currentPictureInx);
|
|
|
+ if (filedUpload != null){
|
|
|
+ filedUpload.getSelectImg(data);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
@@ -136,36 +195,208 @@ public class DetectionWorkMainActivity extends BaseActivity implements StoJNI.Sc
|
|
|
@Override
|
|
|
protected void initView() {
|
|
|
unbinder = ButterKnife.bind(this);
|
|
|
- setTitleName("单箱上架");
|
|
|
+ setTitleName("按箱操作");
|
|
|
+ stepInitData();
|
|
|
+ }
|
|
|
|
|
|
+ private void stepInitData(){
|
|
|
initAdapter();
|
|
|
initData();
|
|
|
- initEdit();
|
|
|
- //监听浮动按钮
|
|
|
- iv_drag.setOnClickListener(new View.OnClickListener() {
|
|
|
- @Override
|
|
|
- public void onClick(View v) {
|
|
|
- if (!iv_drag.isDrag()) {
|
|
|
- ActivityScanerCode.setScanerListener(mScanerListener);
|
|
|
- ActivityScanerCode.intent2Activity(mContext, BaseConfig.COMMON_SCANNER_ONLY);
|
|
|
- }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void initData() {
|
|
|
+ StepsInfoBean currentStepsBaseBean = stepsBaseBean.getSteps().get(step);
|
|
|
+ nodeCode = currentStepsBaseBean.getNodeCode();
|
|
|
+
|
|
|
+ mtBoxNumber.setText(stepsBaseBean.getBoxNumber());
|
|
|
+ mtUnitCode.setText(stepsBaseBean.getUnitCode());
|
|
|
+ pictureAdapter.setPictureType(nodeCode);
|
|
|
+
|
|
|
+ //
|
|
|
+ btnLastStep.setVisibility(step>0?View.VISIBLE:View.GONE);
|
|
|
+
|
|
|
+ String nextName = step == stepsBaseBean.getSteps().size()-1 ? "检测完成" : "下一步";
|
|
|
+ btnConfirm.setText(nextName);
|
|
|
+ tvPicturesType.setText(currentStepsBaseBean.getNodeName());
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ //想要清空
|
|
|
+ llRecyclerView.removeAllViews();
|
|
|
+ mapStepsAttrId = new HashMap<>();;
|
|
|
+ mapPictureSelector = new HashMap<>();;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ listStepsPictureBean = new ArrayList<>();
|
|
|
+
|
|
|
+ switch (nodeCode){
|
|
|
+ case "parts":
|
|
|
+ listStepsPictureBean.addAll(listStepsPictureBean.size(),currentStepsBaseBean.getPicture_1());
|
|
|
+ listStepsPictureBean.addAll(listStepsPictureBean.size(),currentStepsBaseBean.getPicture_2());
|
|
|
+ listStepsPictureBean.addAll(listStepsPictureBean.size(),currentStepsBaseBean.getPicture_3());
|
|
|
+ break;
|
|
|
+ case "func":
|
|
|
+ listStepsPictureBean = currentStepsBaseBean.getFunc_points();
|
|
|
+ break;
|
|
|
+ case "facade":
|
|
|
+ listStepsPictureBean = currentStepsBaseBean.getFacade_points();
|
|
|
+ break;
|
|
|
+ case "spare":
|
|
|
+ listStepsPictureBean.addAll(currentStepsBaseBean.getSpare_picture_1());
|
|
|
+ listStepsPictureBean.addAll(currentStepsBaseBean.getSpare_picture_2());
|
|
|
+ break;
|
|
|
+ case "pack":
|
|
|
+ listStepsPictureBean = currentStepsBaseBean.getPack_points();
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if (AllStepsAttrId.containsKey(step)){
|
|
|
+ mapStepsAttrId = AllStepsAttrId.get(step);
|
|
|
+ if (AllPictureSelector.containsKey(step)){
|
|
|
+ mapPictureSelector = AllPictureSelector.get(step);
|
|
|
+
|
|
|
}
|
|
|
- });
|
|
|
+ for (int i=0;i<listStepsPictureBean.size();i++){
|
|
|
+ StepsPictureBean tmp = listStepsPictureBean.get(i);
|
|
|
+ if (mapStepsAttrId.containsKey(i)){
|
|
|
+ tmp.setChecked(true);
|
|
|
|
|
|
+ if (tmp.getNeedPhoto().equals("1")){
|
|
|
|
|
|
+ ArrayList<String> photoList = mapPictureSelector.get(i).getPhotoList();
|
|
|
+ List<LocalMedia> selectList = mapPictureSelector.get(i).getSelectList();
|
|
|
+ addPictureSelectorUpload(i);
|
|
|
+ mapPictureSelector.get(i).setSelectList(selectList,photoList);
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
+ }
|
|
|
+ listStepsPictureBean.set(i,tmp);
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
- private void initData() {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ pictureAdapter.setNewData(listStepsPictureBean);
|
|
|
+ pictureAdapter.notifyDataSetChanged();
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
private void initAdapter() {
|
|
|
|
|
|
|
|
|
+
|
|
|
+ pictureAdapter = new PictureListAdapter(mContext,DetectionWorkMainActivity.this,recyclerView,listStepsPictureBean,nodeCode);
|
|
|
+ pictureAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
|
|
|
+ XLog.e("运行setOnItemClickListener"+view.getId());
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ pictureAdapter.setOnItemChildClickListener(new BaseQuickAdapter.OnItemChildClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) {
|
|
|
+ XLog.e("运行setOnItemChildClickListener");
|
|
|
+
|
|
|
+ StepsPictureBean stepsPictureBean = listStepsPictureBean.get(position);
|
|
|
+ String attrId = stepsPictureBean.getAttrId();
|
|
|
+ String field_key = stepsPictureBean.getFieldKey();
|
|
|
+
|
|
|
+ try {
|
|
|
+ if ((view.getId() == R.id.cb_select || view.getId() == R.id.tv_name)){
|
|
|
+
|
|
|
+
|
|
|
+ if (mapStepsAttrId.containsKey(position)){
|
|
|
+ mapStepsAttrId.remove(position);
|
|
|
+ }else{
|
|
|
+ mapStepsAttrId.put(position,attrId);
|
|
|
+ }
|
|
|
+
|
|
|
+ //不选中且需要拍照则自动打开
|
|
|
+ if (listStepsPictureBean.get(position).getNeedPhoto().equals("1")){
|
|
|
+
|
|
|
+ currentPictureInx = position;
|
|
|
+ String tagKey = "recyclerview"+position;
|
|
|
+ if (mapPictureSelector.containsKey(position)){
|
|
|
+ mapPictureSelector.remove(position);
|
|
|
+ // 或者,如果你需要遍历并删除满足某个条件的视图
|
|
|
+ for (int i = 0; i < llRecyclerView.getChildCount(); i++) {
|
|
|
+ View child = llRecyclerView.getChildAt(i);
|
|
|
+ if (tagKey.equals(child.getTag().toString())) {
|
|
|
+ llRecyclerView.removeViewAt(i);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+
|
|
|
+ addPictureSelectorUpload(position);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ XLog.e("看看是不是异步执行");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ showErrorToast("异常"+e.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ private void addPictureSelectorUpload(int position){
|
|
|
+ String tagKey = "recyclerview"+position;
|
|
|
+ View itemPictureSelector = View.inflate(mContext, R.layout.item_picture_selector, null);
|
|
|
+ TextView tvPicturesTitle = itemPictureSelector.findViewById(R.id.tv_pictures_title);
|
|
|
+ tvPicturesTitle.setText(listStepsPictureBean.get(position).getDesc());
|
|
|
+ RecyclerView rvLabelShowImg = (RecyclerView)itemPictureSelector.findViewById(R.id.recyclerview);
|
|
|
+ itemPictureSelector.setTag(tagKey);
|
|
|
+ llRecyclerView.addView(itemPictureSelector);
|
|
|
+ PictureSelectorUpload tmpPictureSelector = setItemPicture(String.valueOf(position),rvLabelShowImg,9,PictureConfig.TYPE_IMAGE);
|
|
|
+ mapPictureSelector.put(position,tmpPictureSelector);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 设置多个上传文件
|
|
|
+ * @param actionType String
|
|
|
+ * @param showImg RecyclerView
|
|
|
+ */
|
|
|
+ private PictureSelectorUpload setItemPicture(String actionType,RecyclerView showImg,int maxNum,int pictureType){
|
|
|
+ PictureSelectorUpload pictureUpload = new PictureSelectorUpload(DetectionWorkMainActivity.this,showImg,"detection",maxNum,pictureType);
|
|
|
+ pictureUpload.setActionType(actionType);
|
|
|
+ pictureUpload.setCompress(true,100,500);
|
|
|
+ pictureUpload.setOnlyCamera(true);
|
|
|
+ pictureUpload.setProgressType(2);
|
|
|
+ //showImg.onTouchEvent()
|
|
|
+
|
|
|
+ pictureUpload.setOnChangeListener(new PictureSelectorUpload.UploadChangeListener() {
|
|
|
+ @Override
|
|
|
+ public void uploadResult(boolean State,String actionType) {
|
|
|
+ if (State) {
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void uploadActionType(String actionType) {
|
|
|
+ System.out.println("actionType:"+actionType);
|
|
|
+ currentPictureInx = Integer.parseInt(actionType);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return pictureUpload;
|
|
|
+ }
|
|
|
|
|
|
@Override
|
|
|
public boolean dispatchKeyEvent(KeyEvent event) {
|
|
@@ -293,22 +524,12 @@ public class DetectionWorkMainActivity extends BaseActivity implements StoJNI.Sc
|
|
|
//统一按钮回调
|
|
|
public void callbackEditor(View v) {
|
|
|
switch (v.getId()) {
|
|
|
- case R.id.et_location_code:
|
|
|
- checkLocation();
|
|
|
- break;
|
|
|
- case R.id.et_box_code:
|
|
|
- bindLocation();
|
|
|
- break;
|
|
|
default:
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private void initEdit() {
|
|
|
- List<EditText> list = new ArrayList<>();
|
|
|
- list.add(etLocationCode);
|
|
|
- list.add(etBoxCode);
|
|
|
- unifyEdit(list);
|
|
|
- etLocationCode.requestFocus();
|
|
|
+
|
|
|
}
|
|
|
|
|
|
private OnRxScanerListener mScanerListener = new OnRxScanerListener() {
|
|
@@ -343,58 +564,28 @@ public class DetectionWorkMainActivity extends BaseActivity implements StoJNI.Sc
|
|
|
|
|
|
|
|
|
/**
|
|
|
- * 检查打托信息
|
|
|
+ * 完成
|
|
|
*/
|
|
|
- private void bindLocation() {
|
|
|
-
|
|
|
+ private void DecorationCompleted() {
|
|
|
if (!validate()) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
|
|
|
- String postJson = formatParam(2);
|
|
|
- if (!checkRepeat(Urls.FXY_DETECTION_PUTAWAY + (postJson))) {
|
|
|
+ if (step < stepsBaseBean.getSteps().size()-1){
|
|
|
+ step = step+1;
|
|
|
+ stepInitData();
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
- OkGo.<String>post(Urls.getServiceAddress(this) + Urls.FXY_DETECTION_PUTAWAY).upJson(postJson)
|
|
|
- .execute(new MyDialogCallback(this, true, true) {
|
|
|
- @Override
|
|
|
- public void onSuccess(Response<String> response) {
|
|
|
- super.onSuccess(response);
|
|
|
- try {
|
|
|
- ActionBean bean = JsonUtil.getObject(response.body(), ActionBean.class);
|
|
|
- if (bean.code == 1) {
|
|
|
- showSuccessToast(bean.msg);
|
|
|
- clearData();
|
|
|
- } else {
|
|
|
- etBoxCode.selectAll();
|
|
|
- showWarningToast(bean.msg);
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- XLog.e("请求返回打托信息错误", e.getMessage());
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 检查库位
|
|
|
- */
|
|
|
- private void checkLocation() {
|
|
|
- if (!checkNull(etLocationCode)) {
|
|
|
- setEditTextFocused(etLocationCode, true);
|
|
|
- showWarningToast(etLocationCode.getHint().toString());
|
|
|
- return ;
|
|
|
+ if (!formatParam()) {
|
|
|
+ return;
|
|
|
}
|
|
|
|
|
|
- String postJson = formatParam(1);
|
|
|
- if (!checkRepeat(Urls.FXY_DETECTION_CHECK_LOCATION + (postJson))) {
|
|
|
+ String postJson = submitData.toString();;
|
|
|
+ if (!checkRepeat(Urls.FXY_DETECTION_COMPLETED + (postJson))) {
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
- OkGo.<String>post(Urls.getServiceAddress(this) + Urls.FXY_DETECTION_CHECK_LOCATION).upJson(postJson)
|
|
|
+ OkGo.<String>post(Urls.getServiceAddress(this) + Urls.FXY_DETECTION_COMPLETED).upJson(postJson)
|
|
|
.execute(new MyDialogCallback(this, true, true) {
|
|
|
@Override
|
|
|
public void onSuccess(Response<String> response) {
|
|
@@ -403,25 +594,18 @@ public class DetectionWorkMainActivity extends BaseActivity implements StoJNI.Sc
|
|
|
ActionBean bean = JsonUtil.getObject(response.body(), ActionBean.class);
|
|
|
if (bean.code == 1) {
|
|
|
showSuccessToast(bean.msg);
|
|
|
- etBoxCode.requestFocus();
|
|
|
+ finish();
|
|
|
} else {
|
|
|
showWarningToast(bean.msg);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
- XLog.e("请求返回箱号检查错误", e.getMessage());
|
|
|
+ XLog.e("请求返回打托信息错误", e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 完成
|
|
|
- */
|
|
|
- private void finished() {
|
|
|
- clearData();
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* @param type int 1、库位,2、箱号
|
|
|
* @return
|
|
@@ -429,11 +613,6 @@ public class DetectionWorkMainActivity extends BaseActivity implements StoJNI.Sc
|
|
|
private String formatParam(int type) {
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
try {
|
|
|
- jsonObject.put("location_number", etLocationCode.getText().toString().trim());
|
|
|
- if (type > 1) {
|
|
|
- jsonObject.put("box_code", etBoxCode.getText().toString().trim());
|
|
|
- }
|
|
|
-
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -447,128 +626,104 @@ public class DetectionWorkMainActivity extends BaseActivity implements StoJNI.Sc
|
|
|
*/
|
|
|
private boolean validate() {
|
|
|
|
|
|
- if (!checkNull(etLocationCode)) {
|
|
|
- setEditTextFocused(etLocationCode, true);
|
|
|
- showWarningToast(etLocationCode.getHint().toString());
|
|
|
- return false;
|
|
|
- }
|
|
|
+ try {
|
|
|
+ submitData.put("box_number",stepsBaseBean.getBoxNumber());
|
|
|
+ submitData.put("goods_id",stepsBaseBean.getGoodsId());
|
|
|
+ submitData.put("unit_code",stepsBaseBean.getUnitCode());
|
|
|
|
|
|
- if (!checkNull(etBoxCode)) {
|
|
|
- setEditTextFocused(etBoxCode, true);
|
|
|
- showWarningToast(etBoxCode.getHint().toString());
|
|
|
- return false;
|
|
|
- }
|
|
|
+ JSONObject item = new JSONObject();
|
|
|
+ Gson gson = new Gson();
|
|
|
|
|
|
- return true;
|
|
|
- }
|
|
|
+ JSONArray stepsArray = new JSONArray();
|
|
|
+ for (Integer position : mapStepsAttrId.keySet()) {
|
|
|
|
|
|
+ StepsPictureBean stepsPictureBean = listStepsPictureBean.get(position);
|
|
|
+ item.put("node_code",nodeCode);
|
|
|
+ item.put("field_key",stepsPictureBean.getFieldKey());
|
|
|
+ item.put("attr_id",mapStepsAttrId.get(position));
|
|
|
|
|
|
+ if (stepsPictureBean.getNeedPhoto().equals("1")){
|
|
|
+ if (mapPictureSelector.get(position)==null){
|
|
|
+ showToast(stepsPictureBean.getDesc()+"需要拍照");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
|
|
|
+ ArrayList<String> urlList = mapPictureSelector.get(position).getPhotoList();
|
|
|
+ if (urlList.size()==0){
|
|
|
+ showToast(stepsPictureBean.getDesc()+"需要拍照");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ item.put("url",gson.toJson(urlList));
|
|
|
|
|
|
- //清除订单信息
|
|
|
- private void clearData() {
|
|
|
- etBoxCode.setText("");
|
|
|
- etLocationCode.setText("");
|
|
|
+ }
|
|
|
|
|
|
- setEditTextNormal(etLocationCode, true);
|
|
|
- setEditTextNormal(etBoxCode, true);
|
|
|
- etLocationCode.requestFocus();
|
|
|
- }
|
|
|
+ stepsArray.put(item);
|
|
|
+ }
|
|
|
+ submitStepsArray.put(step,stepsArray);
|
|
|
|
|
|
- @OnClick({R.id.btn_confirm})
|
|
|
- public void onViewClicked(View view) {
|
|
|
- Bundle bundle = new Bundle();
|
|
|
- switch (view.getId()) {
|
|
|
- case R.id.btn_confirm:
|
|
|
- finished();
|
|
|
- break;
|
|
|
- default:
|
|
|
- break;
|
|
|
+
|
|
|
+ AllPictureSelector.put(step,mapPictureSelector);
|
|
|
+ AllStepsAttrId.put(step,mapStepsAttrId);
|
|
|
+ } catch (JSONException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ showToast(e.getMessage());
|
|
|
+ return false;
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- /**
|
|
|
- * 统一设置Edit监听
|
|
|
- *
|
|
|
- * @param list
|
|
|
- */
|
|
|
- public void unifyEdit(List<EditText> list) {
|
|
|
- for (int i = 0; i < list.size(); i++) {
|
|
|
- EditText editText = list.get(i);
|
|
|
|
|
|
- LinearLayout linearLayout = (LinearLayout) editText.getParent();
|
|
|
- ImageButton imageButton = getChildImageButton(linearLayout);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
|
|
|
|
|
|
- //监听按确定
|
|
|
- editText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
|
|
- @Override
|
|
|
- public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
|
|
- XLog.e("actionId:" + actionId);
|
|
|
- if (event != null) {
|
|
|
- XLog.e("KeyCode:" + event.getKeyCode() + "--ActionCode:" + event.getAction());
|
|
|
- }
|
|
|
|
|
|
- //|| (actionId == KeyEvent.ACTION_DOWN && event.getKeyCode()==KeyEvent.KEYCODE_ENTER )
|
|
|
- if (actionId == EditorInfo.IME_ACTION_SEND || actionId == EditorInfo.IME_ACTION_DONE ||
|
|
|
- (actionId == KeyEvent.ACTION_DOWN && event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) {
|
|
|
- if (v.getText().toString().trim().isEmpty()) {
|
|
|
- setEditTextFocused(v, true);
|
|
|
- showWarningToast(v.getHint().toString());
|
|
|
- return true;
|
|
|
- } else {
|
|
|
- setEditTextNormal(v, true);
|
|
|
- }
|
|
|
- callbackEditor(v);
|
|
|
- return false;
|
|
|
- }
|
|
|
- return false;
|
|
|
+ /*
|
|
|
+ * 校验必录
|
|
|
+ */
|
|
|
+ private boolean formatParam() {
|
|
|
|
|
|
- //返回true,保留软键盘。false,隐藏软键盘
|
|
|
+ try {
|
|
|
+ JSONArray stepsArray = new JSONArray();
|
|
|
+ for (int i=0;i<submitStepsArray.length();i++){
|
|
|
+ JSONArray tmp = submitStepsArray.getJSONArray(i);
|
|
|
+ for (int j=0;j<tmp.length();j++){
|
|
|
+ stepsArray.put(tmp.getJSONObject(j));
|
|
|
}
|
|
|
- });
|
|
|
- editText.addTextChangedListener(new TextWatcher() {
|
|
|
- public void onTextChanged(CharSequence s, int start, int before, int count) {
|
|
|
- EditText currentEditText = null;
|
|
|
- ImageButton currentImage = null;
|
|
|
- //获取焦点的view对象
|
|
|
- View view = getWindow().getDecorView().findFocus();
|
|
|
- //如果是EditText
|
|
|
- if (view instanceof EditText) {
|
|
|
- currentEditText = (EditText) view;
|
|
|
- currentImage = getChildImageButton((LinearLayout) currentEditText.getParent());
|
|
|
- }
|
|
|
+ }
|
|
|
+ submitData.put("steps",stepsArray );
|
|
|
+ } catch (JSONException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ showToast(e.getMessage());
|
|
|
+ return false;
|
|
|
+ }
|
|
|
|
|
|
- if (s.length() > 0) {
|
|
|
|
|
|
- if (currentImage != null) {
|
|
|
- currentImage.setVisibility(View.VISIBLE);
|
|
|
- }
|
|
|
- if (currentEditText != null) {
|
|
|
- setEditTextNormal(currentEditText, true);
|
|
|
- }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
- } else {
|
|
|
- if (currentImage != null) {
|
|
|
- currentImage.setVisibility(View.INVISIBLE);
|
|
|
- }
|
|
|
- if (currentEditText != null) {
|
|
|
- setEditTextFocused(currentEditText, true);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
- public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
|
|
- }
|
|
|
|
|
|
- public void afterTextChanged(Editable s) {
|
|
|
+ //清除订单信息
|
|
|
+ private void clearData() {
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
+ @OnClick({R.id.btn_confirm,R.id.btn_last_step})
|
|
|
+ public void onViewClicked(View view) {
|
|
|
+ Bundle bundle = new Bundle();
|
|
|
+ switch (view.getId()) {
|
|
|
+ case R.id.btn_confirm:
|
|
|
+ DecorationCompleted();
|
|
|
+ break;
|
|
|
+ case R.id.btn_last_step:
|
|
|
+ if (step>0){
|
|
|
+ step = step-1;
|
|
|
+ stepInitData();
|
|
|
}
|
|
|
- });
|
|
|
|
|
|
- if (imageButton != null) {
|
|
|
- unifyClearEdit(imageButton);
|
|
|
- }
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
|