|
|
@@ -10,10 +10,14 @@ import android.view.View;
|
|
|
import android.widget.ImageView;
|
|
|
import android.widget.LinearLayout;
|
|
|
import android.widget.TextView;
|
|
|
+import android.widget.Toast;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.android.volley.Request;
|
|
|
+import com.uas.pda_smart_sa.adapter.SpotCheckAdapter;
|
|
|
+import com.uas.pda_smart_sa.bean.SpotCheckBean;
|
|
|
import com.uas.pda_smart_sa.listener.MyEditorActionListener;
|
|
|
import com.uas.pda_smart_sa.R;
|
|
|
import com.uas.pda_smart_sa.adapter.CommonFormAdapter;
|
|
|
@@ -36,7 +40,7 @@ import java.util.List;
|
|
|
* Desc: 成品检验
|
|
|
*/
|
|
|
public class ProductCheckFragment extends BaseFragment implements View.OnClickListener {
|
|
|
- private ClearableEditText mBoxEditText;
|
|
|
+ private ClearableEditText mBoxEditText, mRealNumEditText;
|
|
|
private ImageView mScanImageView;
|
|
|
private RecyclerView mRecyclerView;
|
|
|
private TextView mQualifiedTv, mUnqualifiedTv;
|
|
|
@@ -45,6 +49,10 @@ public class ProductCheckFragment extends BaseFragment implements View.OnClickLi
|
|
|
private List<CaptionValueBean> mCaptionValueBeans;
|
|
|
private ProductUnqualifiedPop mUnqualifiedPop;
|
|
|
private String mBoxcode;
|
|
|
+ private RecyclerView mSpotCheckRecyclerView;
|
|
|
+ private LinearLayout mSpotCheckLinearLayout;
|
|
|
+ private List<SpotCheckBean> mSpotCheckBeans;
|
|
|
+ private SpotCheckAdapter mSpotCheckAdapter;
|
|
|
|
|
|
@Override
|
|
|
protected int getLayout() {
|
|
|
@@ -61,11 +69,18 @@ public class ProductCheckFragment extends BaseFragment implements View.OnClickLi
|
|
|
mOperatorLl = root.findViewById(R.id.product_check_operator_ll);
|
|
|
mQualifiedTv = root.findViewById(R.id.product_check_qualified_tv);
|
|
|
mUnqualifiedTv = root.findViewById(R.id.product_check_unqualified_tv);
|
|
|
+ mSpotCheckLinearLayout = root.findViewById(R.id.product_check_spotcheck_ll);
|
|
|
+ mRealNumEditText = root.findViewById(R.id.product_check_realnum_et);
|
|
|
mRecyclerView = root.findViewById(R.id.product_check_result_rv);
|
|
|
mRecyclerView.setLayoutManager(new LinearLayoutManager(mActivity));
|
|
|
mCaptionValueBeans = new ArrayList<>();
|
|
|
mCommonFormAdapter = new CommonFormAdapter(mCaptionValueBeans);
|
|
|
mRecyclerView.setAdapter(mCommonFormAdapter);
|
|
|
+ mSpotCheckRecyclerView = root.findViewById(R.id.product_check_spotcheck_rv);
|
|
|
+ mSpotCheckRecyclerView.setLayoutManager(new LinearLayoutManager(mActivity));
|
|
|
+ mSpotCheckBeans = new ArrayList<>();
|
|
|
+ mSpotCheckAdapter = new SpotCheckAdapter(mSpotCheckBeans);
|
|
|
+ mSpotCheckRecyclerView.setAdapter(mSpotCheckAdapter);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -88,6 +103,9 @@ public class ProductCheckFragment extends BaseFragment implements View.OnClickLi
|
|
|
}
|
|
|
|
|
|
private void getBoxInfo() {
|
|
|
+ mOperatorLl.setVisibility(View.GONE);
|
|
|
+ mRealNumEditText.setText("");
|
|
|
+ mSpotCheckLinearLayout.setVisibility(View.GONE);
|
|
|
String boxCode = mBoxEditText.getText().toString().trim();
|
|
|
if (TextUtils.isEmpty(boxCode)) {
|
|
|
return;
|
|
|
@@ -95,6 +113,7 @@ public class ProductCheckFragment extends BaseFragment implements View.OnClickLi
|
|
|
mBoxcode = boxCode;
|
|
|
progressDialog.show();
|
|
|
mCaptionValueBeans.clear();
|
|
|
+ mSpotCheckBeans.clear();
|
|
|
|
|
|
VolleyRequest.getInstance().stringRequest(new HttpParams.Builder()
|
|
|
.url(GloableParams.ADDRESS_OUTFINISH_GETCHECKBOXCODE)
|
|
|
@@ -112,15 +131,34 @@ public class ProductCheckFragment extends BaseFragment implements View.OnClickLi
|
|
|
JSONObject dataObject = resultObject.getJSONObject("data");
|
|
|
mOperatorLl.setVisibility(View.VISIBLE);
|
|
|
if (dataObject != null) {
|
|
|
- mBoxcode = FastjsonUtil.getText(dataObject, "BOXCODE");
|
|
|
- mCaptionValueBeans.add(new CaptionValueBean("箱号", mBoxcode));
|
|
|
- mCaptionValueBeans.add(new CaptionValueBean("产品编号", FastjsonUtil.getText(dataObject, "PRCODE")));
|
|
|
- mCaptionValueBeans.add(new CaptionValueBean("产品名称", FastjsonUtil.getText(dataObject, "PRDETAIL")));
|
|
|
- mCaptionValueBeans.add(new CaptionValueBean("产品规格", FastjsonUtil.getText(dataObject, "PRSPEC")));
|
|
|
+ if (!TextUtils.isEmpty(FastjsonUtil.getText(dataObject, "BOXCODE"))) {
|
|
|
+ mBoxcode = FastjsonUtil.getText(dataObject, "BOXCODE");
|
|
|
+ }
|
|
|
+ mCaptionValueBeans.add(new CaptionValueBean("型号", FastjsonUtil.getText(dataObject, "ORISPECCODE")));
|
|
|
mCaptionValueBeans.add(new CaptionValueBean("包数", FastjsonUtil.getText(dataObject, "BOXNUMBER")));
|
|
|
- mCaptionValueBeans.add(new CaptionValueBean("总数量", FastjsonUtil.getText(dataObject, "QTY")));
|
|
|
+ mCaptionValueBeans.add(new CaptionValueBean("数量", FastjsonUtil.getText(dataObject, "QTY")));
|
|
|
+ mCaptionValueBeans.add(new CaptionValueBean("批号", FastjsonUtil.getText(dataObject, "LOTNO")));
|
|
|
+ String stachecknum = FastjsonUtil.getText(dataObject, "STACHECKNUM");
|
|
|
+ mCaptionValueBeans.add(new CaptionValueBean("标准抽样数", stachecknum));
|
|
|
|
|
|
mCommonFormAdapter.notifyDataSetChanged();
|
|
|
+
|
|
|
+ mRealNumEditText.setText(stachecknum);
|
|
|
+ JSONArray checkitems = dataObject.getJSONArray("CHECKITEMS");
|
|
|
+ if (checkitems != null && checkitems.size() > 0) {
|
|
|
+ mSpotCheckLinearLayout.setVisibility(View.VISIBLE);
|
|
|
+ for (int i = 0; i < checkitems.size(); i++) {
|
|
|
+ String checkname = checkitems.getString(i);
|
|
|
+ SpotCheckBean spotCheckBean = new SpotCheckBean();
|
|
|
+ spotCheckBean.setCheckname(checkname);
|
|
|
+ spotCheckBean.setChecknum(stachecknum);
|
|
|
+
|
|
|
+ mSpotCheckBeans.add(spotCheckBean);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ mSpotCheckLinearLayout.setVisibility(View.GONE);
|
|
|
+ }
|
|
|
+ mSpotCheckAdapter.notifyDataSetChanged();
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
mOperatorLl.setVisibility(View.GONE);
|
|
|
@@ -148,10 +186,11 @@ public class ProductCheckFragment extends BaseFragment implements View.OnClickLi
|
|
|
CommonUtil.scanBarcode(mActivity, this, 0x11);
|
|
|
break;
|
|
|
case R.id.product_check_qualified_tv:
|
|
|
- checkBoxCode(false, "");
|
|
|
+ checkBoxCode(false);
|
|
|
break;
|
|
|
case R.id.product_check_unqualified_tv:
|
|
|
- if (mUnqualifiedPop == null) {
|
|
|
+ checkBoxCode(true);
|
|
|
+ /*if (mUnqualifiedPop == null) {
|
|
|
mUnqualifiedPop = new ProductUnqualifiedPop(mActivity);
|
|
|
mUnqualifiedPop.setOnConfirmListener(new ProductUnqualifiedPop.OnConfirmListener() {
|
|
|
@Override
|
|
|
@@ -160,21 +199,35 @@ public class ProductCheckFragment extends BaseFragment implements View.OnClickLi
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
- mUnqualifiedPop.showPopupWindow();
|
|
|
+ mUnqualifiedPop.showPopupWindow();*/
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void checkBoxCode(boolean isNg, String ngReason) {
|
|
|
+ private void checkBoxCode(boolean isNg) {
|
|
|
+ String realnum = mRealNumEditText.getText().toString();
|
|
|
+ if (TextUtils.isEmpty(realnum)) {
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "请输入实际抽样数");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ for (int i = 0; i < mSpotCheckBeans.size(); i++) {
|
|
|
+ SpotCheckBean spotCheckBean = mSpotCheckBeans.get(i);
|
|
|
+ if (TextUtils.isEmpty(spotCheckBean.getChecknum())) {
|
|
|
+ CommonUtil.toastNoRepeat(mActivity,
|
|
|
+ "请输入[" + spotCheckBean.getCheckname() + "]的抽检数");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
progressDialog.show();
|
|
|
VolleyRequest.getInstance().stringRequest(new HttpParams.Builder()
|
|
|
.url(GloableParams.ADDRESS_OUTFINISH_CHECKBOXCODENG)
|
|
|
.method(Request.Method.POST)
|
|
|
.addParam("boxCode", mBoxcode)
|
|
|
.addParam("isNg", Boolean.toString(isNg))
|
|
|
- .addParam("ngReason", ngReason)
|
|
|
+ .addParam("realCheckNum", realnum)
|
|
|
+ .addParam("checkItems", JSON.toJSONString(mSpotCheckBeans))
|
|
|
.build(), new HttpCallback() {
|
|
|
@Override
|
|
|
public void onSuccess(int flag, Object o) throws Exception {
|