|
|
@@ -53,6 +53,7 @@ import java.util.List;
|
|
|
|
|
|
public class StorageRechargeFragment extends BaseFragment implements View.OnClickListener, HttpCallback {
|
|
|
private static final int SCAN_BARCODE_CODE = 111;
|
|
|
+ private static final int SCAN_BARCODE = 222;
|
|
|
private static final int FLAG_GET_BARCODE = 0x01;
|
|
|
private static final int FLAG_TURN_VERIFY = 0x02;
|
|
|
private static final int FLAG_TURN_QC = 0x03;
|
|
|
@@ -74,6 +75,8 @@ public class StorageRechargeFragment extends BaseFragment implements View.OnClic
|
|
|
private StringRequest mStringRequest;
|
|
|
private PopupWindow mMenuPopupWindow;
|
|
|
private Fragment mFragment;
|
|
|
+ private ClearableEditText ce_prodcode;
|
|
|
+ private ImageView prodcode_iv;
|
|
|
|
|
|
@Override
|
|
|
protected int getLayout() {
|
|
|
@@ -87,7 +90,7 @@ public class StorageRechargeFragment extends BaseFragment implements View.OnClic
|
|
|
|
|
|
mMenuButton = (Button) mActivity.findViewById(R.id.btn_actionbar_more);
|
|
|
mBarcodeEditText = (ClearableEditText) root.findViewById(R.id.storage_recharge_collect_et);
|
|
|
- mBarcodeEditText.requestFocus();
|
|
|
+// mBarcodeEditText.requestFocus();
|
|
|
mScanImageView = (ImageView) root.findViewById(R.id.storage_recharge_scan_iv);
|
|
|
mTransferButton = (Button) root.findViewById(R.id.storage_recharge_transfer_btn);
|
|
|
mDataLinearLayout = (LinearLayout) root.findViewById(R.id.storage_recharge_data_ll);
|
|
|
@@ -95,7 +98,9 @@ public class StorageRechargeFragment extends BaseFragment implements View.OnClic
|
|
|
mErrorTextView = (TextView) root.findViewById(R.id.storage_recharge_error_tv);
|
|
|
mErrorScrollView = (ScrollView) root.findViewById(R.id.storage_recharge_error_sv);
|
|
|
mChangeButton = (Button) root.findViewById(R.id.storage_recharge_purchase_change_btn);
|
|
|
-
|
|
|
+ ce_prodcode = root.findViewById(R.id.ce_Prodcode);
|
|
|
+ prodcode_iv = root.findViewById(R.id.Prodcode_iv);
|
|
|
+ ce_prodcode.requestFocus();
|
|
|
View headerView = View.inflate(mActivity, R.layout.header_storage_recharge_list, null);
|
|
|
mHeaderBarcodeTextView = (TextView) headerView.findViewById(R.id.header_storage_recharge_barcode_tv);
|
|
|
mHeaderReceiptTextView = (TextView) headerView.findViewById(R.id.header_storage_recharge_receipt_tv);
|
|
|
@@ -167,6 +172,7 @@ public class StorageRechargeFragment extends BaseFragment implements View.OnClic
|
|
|
mScanImageView.setOnClickListener(this);
|
|
|
mTransferButton.setOnClickListener(this);
|
|
|
mChangeButton.setOnClickListener(this);
|
|
|
+ prodcode_iv.setOnClickListener(this);
|
|
|
|
|
|
mBarcodeEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
|
|
@Override
|
|
|
@@ -181,43 +187,47 @@ public class StorageRechargeFragment extends BaseFragment implements View.OnClic
|
|
|
return false;
|
|
|
}
|
|
|
});
|
|
|
+ ce_prodcode.setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
|
|
+ @Override
|
|
|
+ public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
|
|
+ if (actionId == EditorInfo.IME_ACTION_DONE
|
|
|
+ || actionId == EditorInfo.IME_ACTION_SEND
|
|
|
+ || (event != null && event.getAction() == KeyEvent.ACTION_DOWN && event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) {
|
|
|
+ String barcode = ce_prodcode.getText().toString().trim();
|
|
|
+ if (barcode.isEmpty()){
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "请输入通知单号");
|
|
|
+ }else {
|
|
|
+ mBarcodeEditText.requestFocus();
|
|
|
+ }
|
|
|
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ });
|
|
|
mStorageRechargeAdapter.setOnQuantityModifyListener(new StorageRechargeAdapter.OnQuantityModifyListener() {
|
|
|
@Override
|
|
|
- public void onQuantityModify(final DialogInterface dialogInterface, String text, final int position) {
|
|
|
- double quantity = -1;
|
|
|
- try {
|
|
|
- quantity = Double.parseDouble(text);
|
|
|
- } catch (Exception e) {
|
|
|
- CommonUtil.toastNoRepeat(mActivity, "请输入正确的数字");
|
|
|
-// dialogInterface.dismiss();
|
|
|
- return;
|
|
|
- }
|
|
|
+ public void onQuantityModify(final DialogInterface dialogInterface, String text, String description,final int position) {
|
|
|
+ if (text.isEmpty()||description.isEmpty()){
|
|
|
|
|
|
- if (quantity <= 0) {
|
|
|
- CommonUtil.toastNoRepeat(mActivity, "数量必须大于0");
|
|
|
-// dialogInterface.dismiss();
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
+ Log.e("descr22iption",text);
|
|
|
progressDialog.show();
|
|
|
- final double finalQuantity = quantity;
|
|
|
VolleyRequest.getInstance().stringRequest(mStringRequest,
|
|
|
new HttpParams.Builder()
|
|
|
- .url(GloableParams.ADDRESS_RECHARGE_UPDATEANDINQTY)
|
|
|
+ .url(GloableParams.ADDRESS_UPDATEANDWHCODE)
|
|
|
.method(Request.Method.POST)
|
|
|
.tag(TAG + "updateandinqty")
|
|
|
.flag(FLAG_UPDATEANDINQTY)
|
|
|
.addParam("and_id", mStorageRechargeListBeans.get(position).getAndId() + "")
|
|
|
- .addParam("qty", quantity + "")
|
|
|
+ .addParam("whcode", text)
|
|
|
.build(), new HttpCallback() {
|
|
|
@Override
|
|
|
public void onSuccess(int flag, Object o) throws Exception {
|
|
|
progressDialog.dismiss();
|
|
|
dialogInterface.dismiss();
|
|
|
-
|
|
|
- mStorageRechargeListBeans.get(position).setQuantity(finalQuantity);
|
|
|
-
|
|
|
+ mStorageRechargeListBeans.get(position).setAnd_whcode(text+"("+description+")");
|
|
|
mStorageRechargeAdapter.notifyDataSetChanged();
|
|
|
}
|
|
|
|
|
|
@@ -242,6 +252,7 @@ public class StorageRechargeFragment extends BaseFragment implements View.OnClic
|
|
|
public void onClick(View v) {
|
|
|
switch (v.getId()) {
|
|
|
case R.id.storage_recharge_scan_iv:
|
|
|
+ mBarcodeEditText.requestFocus();
|
|
|
if (CameraUtil.hasCamera()) {
|
|
|
if (root.findFocus() != null) {
|
|
|
mFocusId = root.findFocus().getId();
|
|
|
@@ -255,6 +266,21 @@ public class StorageRechargeFragment extends BaseFragment implements View.OnClic
|
|
|
CommonUtil.toastNoRepeat(mActivity, getString(R.string.no_camera_detected));
|
|
|
}
|
|
|
break;
|
|
|
+ case R.id.Prodcode_iv:
|
|
|
+ ce_prodcode.requestFocus();
|
|
|
+ if (CameraUtil.hasCamera()) {
|
|
|
+ if (root.findFocus() != null) {
|
|
|
+ mFocusId = root.findFocus().getId();
|
|
|
+ Intent intent = new Intent();
|
|
|
+ intent.setClass(mActivity, CaptureActivity.class);
|
|
|
+ startActivityForResult(intent, SCAN_BARCODE);
|
|
|
+ } else {
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "请选择您要操作的输入框");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, getString(R.string.no_camera_detected));
|
|
|
+ }
|
|
|
+ break;
|
|
|
case R.id.btn_actionbar_more:
|
|
|
CommonUtil.setBackgroundAlpha(getActivity(), 0.5f);
|
|
|
mMenuPopupWindow.showAsDropDown(mMenuButton);
|
|
|
@@ -268,7 +294,14 @@ public class StorageRechargeFragment extends BaseFragment implements View.OnClic
|
|
|
return;
|
|
|
}
|
|
|
if (!CommonUtil.isRepeatClick()) {
|
|
|
- hideAllViews();
|
|
|
+ for (int i=0;i<mStorageRechargeListBeans.size();i++){
|
|
|
+ Log.e("mSteListBeans",mStorageRechargeListBeans.get(i).getAnd_whcode());
|
|
|
+ if (mStorageRechargeListBeans.get(i).getAnd_whcode().isEmpty()){
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "请检查是否有明细未选择仓库");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
progressDialog.show();
|
|
|
VolleyRequest.getInstance().stringRequest(mStringRequest,
|
|
|
new HttpParams.Builder()
|
|
|
@@ -314,6 +347,18 @@ public class StorageRechargeFragment extends BaseFragment implements View.OnClic
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ if (requestCode == SCAN_BARCODE && data != null) {
|
|
|
+ if (data.getExtras() != null) {
|
|
|
+ String result = data.getExtras().getString(CodeUtils.RESULT_STRING);
|
|
|
+ if (mFocusId == R.id.storage_recharge_collect_et) {
|
|
|
+ if (result.isEmpty()){
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "请输入通知单号");
|
|
|
+ }else {
|
|
|
+ mBarcodeEditText.requestFocus();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private void closeMenuPopupWindow() {
|
|
|
@@ -385,6 +430,7 @@ public class StorageRechargeFragment extends BaseFragment implements View.OnClic
|
|
|
JSONObject resultObject = JSON.parseObject(result);
|
|
|
JSONArray dataArray = resultObject.getJSONArray("data");
|
|
|
if (dataArray != null) {
|
|
|
+ hideAllViews();
|
|
|
String successMsg = "送检成功";
|
|
|
for (int i = 0; i < dataArray.size(); i++) {
|
|
|
JSONObject dataObject = dataArray.getJSONObject(i);
|
|
|
@@ -494,6 +540,11 @@ public class StorageRechargeFragment extends BaseFragment implements View.OnClic
|
|
|
JSONObject mainObject = dataObject.getJSONObject("main");
|
|
|
if (mainObject != null) {
|
|
|
mMainId = FastjsonUtil.getInt(mainObject, "AN_ID");
|
|
|
+ if (!FastjsonUtil.getText(mainObject, "AN_CODE").equals(ce_prodcode.getText().toString().trim())){
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "通知单号不匹配");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ mBarcodeEditText.requestFocus();
|
|
|
mHeaderReceiptTextView.setText(FastjsonUtil.getText(mainObject, "AN_CODE"));
|
|
|
mHeaderSupplierTextView.setText(FastjsonUtil.getText(mainObject, "AN_VENDNAME"));
|
|
|
mHeaderStateTextView.setText(FastjsonUtil.getText(mainObject, "AN_STATUS"));
|
|
|
@@ -503,6 +554,9 @@ public class StorageRechargeFragment extends BaseFragment implements View.OnClic
|
|
|
for (int i = 0; i < detailArray.size(); i++) {
|
|
|
JSONObject detailObject = detailArray.getJSONObject(i);
|
|
|
if (detailObject != null) {
|
|
|
+ if (FastjsonUtil.getText(detailObject, "AND_PRODCODE").equals("")){
|
|
|
+
|
|
|
+ }
|
|
|
StorageRechargeListBean storageRechargeListBean = new StorageRechargeListBean();
|
|
|
storageRechargeListBean.setAndId(FastjsonUtil.getLong(detailObject, "AND_ID"));
|
|
|
storageRechargeListBean.setProdcode(FastjsonUtil.getText(detailObject, "AND_PRODCODE"));
|
|
|
@@ -511,6 +565,7 @@ public class StorageRechargeFragment extends BaseFragment implements View.OnClic
|
|
|
storageRechargeListBean.setQuantity(FastjsonUtil.getDouble(detailObject, "AND_INQTY"));
|
|
|
storageRechargeListBean.setDetail(FastjsonUtil.getText(detailObject, "PR_DETAIL"));
|
|
|
storageRechargeListBean.setSpec(FastjsonUtil.getText(detailObject, "PR_SPEC"));
|
|
|
+ storageRechargeListBean.setAnd_whcode(FastjsonUtil.getText(detailObject, "AND_WHCODE"));
|
|
|
mStorageRechargeListBeans.add(storageRechargeListBean);
|
|
|
}
|
|
|
}
|