|
|
@@ -0,0 +1,673 @@
|
|
|
+package com.uas.pda_smart_com_lg.fragment;
|
|
|
+
|
|
|
+import android.app.AlertDialog;
|
|
|
+import android.content.Context;
|
|
|
+import android.content.DialogInterface;
|
|
|
+import android.content.Intent;
|
|
|
+import android.graphics.Color;
|
|
|
+import android.graphics.drawable.BitmapDrawable;
|
|
|
+import android.os.Bundle;
|
|
|
+import android.support.v4.content.ContextCompat;
|
|
|
+import android.text.TextUtils;
|
|
|
+import android.view.Gravity;
|
|
|
+import android.view.KeyEvent;
|
|
|
+import android.view.LayoutInflater;
|
|
|
+import android.view.View;
|
|
|
+import android.view.Window;
|
|
|
+import android.view.WindowManager;
|
|
|
+import android.view.inputmethod.EditorInfo;
|
|
|
+import android.view.inputmethod.InputMethodManager;
|
|
|
+import android.widget.Button;
|
|
|
+import android.widget.CheckBox;
|
|
|
+import android.widget.CompoundButton;
|
|
|
+import android.widget.ImageView;
|
|
|
+import android.widget.LinearLayout;
|
|
|
+import android.widget.PopupWindow;
|
|
|
+import android.widget.TextView;
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.android.volley.Request;
|
|
|
+import com.bin.david.form.core.SmartTable;
|
|
|
+import com.bin.david.form.core.TableConfig;
|
|
|
+import com.bin.david.form.data.CellInfo;
|
|
|
+import com.bin.david.form.data.column.Column;
|
|
|
+import com.bin.david.form.data.format.bg.BaseCellBackgroundFormat;
|
|
|
+import com.bin.david.form.data.style.FontStyle;
|
|
|
+import com.bin.david.form.data.table.TableData;
|
|
|
+import com.bin.david.form.listener.OnColumnItemClickListener;
|
|
|
+import com.uas.pda_smart_com_lg.R;
|
|
|
+import com.uas.pda_smart_com_lg.activity.FunctionActivity;
|
|
|
+import com.uas.pda_smart_com_lg.bean.OutBoundListAddDalieBean;
|
|
|
+import com.uas.pda_smart_com_lg.global.GloableParams;
|
|
|
+import com.uas.pda_smart_com_lg.listener.MyEditorActionListener;
|
|
|
+import com.uas.pda_smart_com_lg.tools.SharedPreUtil;
|
|
|
+import com.uas.pda_smart_com_lg.util.CameraUtil;
|
|
|
+import com.uas.pda_smart_com_lg.util.CommonUtil;
|
|
|
+import com.uas.pda_smart_com_lg.util.Constants;
|
|
|
+import com.uas.pda_smart_com_lg.util.FastjsonUtil;
|
|
|
+import com.uas.pda_smart_com_lg.util.HttpCallback;
|
|
|
+import com.uas.pda_smart_com_lg.util.HttpParams;
|
|
|
+import com.uas.pda_smart_com_lg.util.StringUtil;
|
|
|
+import com.uas.pda_smart_com_lg.util.VolleyRequest;
|
|
|
+import com.uas.pda_smart_com_lg.view.ClearableEditText;
|
|
|
+import com.uuzuche.lib_zxing.activity.CaptureActivity;
|
|
|
+import com.uuzuche.lib_zxing.activity.CodeUtils;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Collections;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+import razerdp.basepopup.BasePopupWindow;
|
|
|
+
|
|
|
+/**
|
|
|
+ * Created by cjh on 2022-10-09
|
|
|
+ */
|
|
|
+public class OutboundListAdd_Fragment extends BaseFragment implements OnColumnItemClickListener<String>, View.OnClickListener {
|
|
|
+
|
|
|
+ private ClearableEditText storage_recharge_collect_ets;
|
|
|
+ private ImageView storage_recharge_scan_ivs;
|
|
|
+ private SmartTable mSmartTable;
|
|
|
+ private TextView tv_documents_code;
|
|
|
+ private static final int SCAN_BARCODE_CODE = 111;
|
|
|
+ private int mFocusId;
|
|
|
+ private Column<String> va_detnoColumn,va_Pd_wmpdnoCoulmn,va_pucodeCoulmn,va_prodcodeColumn,va_qtyColumn,va_codeColumn,va_detailColumn,va_pr_specColumn,va_bar_loactioncColumn;
|
|
|
+ private TableData<OutBoundListAddDalieBean> mTableData;
|
|
|
+ private List<OutBoundListAddDalieBean> mFilterStorageInBeans;
|
|
|
+ private String va_ids;
|
|
|
+ private CheckBox add_checkbos;
|
|
|
+ private Button jlt_storage_in_generate_detailed_btn;
|
|
|
+ private CheckBox ck_special_outbound;
|
|
|
+
|
|
|
+ private ClearableEditText edit_et;
|
|
|
+ private PopupWindow editPW;
|
|
|
+ private String bar_remain;
|
|
|
+ private String pi_status;
|
|
|
+ private InputMethodManager imm;
|
|
|
+ private boolean ischeck=false;
|
|
|
+ private Double pd_barcodeqtyDouble;
|
|
|
+ private Double pd_outqtyDouble;
|
|
|
+ private Double numberDouble;
|
|
|
+ private Integer integer;
|
|
|
+ private String pi_classs;
|
|
|
+ private PopupWindow mMenuPopupWindow;
|
|
|
+ private ImageView mMoreButton;
|
|
|
+ private View mMenuView;
|
|
|
+ private String pi_inoutno;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected int getLayout() {
|
|
|
+ return R.layout.fragment_outboundlistadd;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void initViews() {
|
|
|
+ FunctionActivity.setTitle(getString(R.string.title_outbound_rechargeadd));
|
|
|
+ ((FunctionActivity) getActivity()).setListIconIvVisible(false);
|
|
|
+ mMoreButton = (ImageView) getActivity().findViewById(R.id.btn_actionbar_list_icon_iv);
|
|
|
+ storage_recharge_collect_ets = mActivity.findViewById(R.id.storage_recharge_collect_ets);
|
|
|
+ storage_recharge_scan_ivs = mActivity.findViewById(R.id.storage_recharge_scan_ivs);
|
|
|
+ tv_documents_code = mActivity.findViewById(R.id.tv_documents_code);
|
|
|
+ mSmartTable = mActivity.findViewById(R.id.jlt_storage_in_filter_list_sts);
|
|
|
+ add_checkbos = mActivity.findViewById(R.id.add_checkbos);
|
|
|
+ jlt_storage_in_generate_detailed_btn = mActivity.findViewById(R.id.jlt_storage_in_generate_detailed_btn);
|
|
|
+ ck_special_outbound = mActivity.findViewById(R.id.ck_special_outbound);
|
|
|
+
|
|
|
+ imm = (InputMethodManager) mActivity.getSystemService(Context.INPUT_METHOD_SERVICE);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void initEvents() {
|
|
|
+ Bundle arguments = getArguments();
|
|
|
+ if (arguments != null) {
|
|
|
+ pi_inoutno = arguments.getString("pi_inoutno");
|
|
|
+ }
|
|
|
+ if (!TextUtils.isEmpty(pi_inoutno)) {
|
|
|
+ tv_documents_code.setText(pi_inoutno);
|
|
|
+ getDataCommitList();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ SharedPreUtil.removeString(mActivity,Constants.STORAGEERECHADD);
|
|
|
+ storage_recharge_scan_ivs.setOnClickListener(this);
|
|
|
+ jlt_storage_in_generate_detailed_btn.setOnClickListener(this);
|
|
|
+ mMoreButton.setOnClickListener(this);
|
|
|
+ storage_recharge_collect_ets.requestFocus();
|
|
|
+ storage_recharge_collect_ets.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 data = storage_recharge_collect_ets.getText().toString().trim();
|
|
|
+ storage_recharge_collect_ets.selectAll();
|
|
|
+ storage_recharge_collect_ets.requestFocus();
|
|
|
+ imm.showSoftInput(storage_recharge_collect_ets, InputMethodManager.RESULT_HIDDEN);
|
|
|
+ getDatalistCodes(data);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ add_checkbos.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
+ @Override
|
|
|
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
|
|
+ if (isChecked==true){
|
|
|
+ ck_special_outbound.setChecked(false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ ck_special_outbound.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
+ @Override
|
|
|
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
|
|
+ if (isChecked==true){
|
|
|
+ add_checkbos.setChecked(false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ mFilterStorageInBeans = Collections.synchronizedList(new ArrayList<>());
|
|
|
+ va_detnoColumn = new Column<String>("出库数量", "BI_OUTQTY");
|
|
|
+ va_detnoColumn.setFixed(true);
|
|
|
+ va_Pd_wmpdnoCoulmn = new Column<String>("料号", "BI_PRODCODE");
|
|
|
+ va_pucodeCoulmn = new Column<String>("物料名称", "PR_DETAIL");
|
|
|
+;
|
|
|
+ }
|
|
|
+ @Override
|
|
|
+ protected void initDatas() {
|
|
|
+ WindowManager wm = mActivity.getWindowManager();
|
|
|
+ int screenWith = wm.getDefaultDisplay().getWidth();
|
|
|
+ mSmartTable.getConfig().setMinTableWidth(screenWith)
|
|
|
+ .setShowXSequence(false)
|
|
|
+ .setShowYSequence(false)
|
|
|
+ .setShowTableTitle(false)
|
|
|
+ .setFixedTitle(true)
|
|
|
+ .setVerticalPadding(CommonUtil.dip2px(mActivity, 12))
|
|
|
+ .setColumnTitleVerticalPadding(CommonUtil.dip2px(mActivity, 12))
|
|
|
+ .setHorizontalPadding(CommonUtil.dip2px(mActivity, 10))
|
|
|
+ .setSequenceHorizontalPadding(CommonUtil.dip2px(mActivity, 10))
|
|
|
+ .setColumnTitleHorizontalPadding(CommonUtil.dip2px(mActivity, 10))
|
|
|
+ .setColumnTitleStyle(new FontStyle(CommonUtil.sp2px(mActivity, 15), Color.parseColor("#000000")))
|
|
|
+ .setContentCellBackgroundFormat(new BaseCellBackgroundFormat<CellInfo>() {
|
|
|
+ @Override
|
|
|
+ public int getBackGroundColor(CellInfo cellInfo) {
|
|
|
+
|
|
|
+ if (cellInfo.row == 0) {
|
|
|
+ return ContextCompat.getColor(mActivity, R.color.text_blue);
|
|
|
+
|
|
|
+ }
|
|
|
+ return TableConfig.INVALID_COLOR;
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean onKeyDown(int keyCode, KeyEvent event) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean onFragmentBackPressed() {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 请求条码第一次
|
|
|
+ * @param data
|
|
|
+ */
|
|
|
+ private void getDatalistCodes(String data) {
|
|
|
+ progressDialog.show();
|
|
|
+
|
|
|
+ String ifcancel;
|
|
|
+ if (add_checkbos.isChecked()==true){
|
|
|
+ ifcancel="true";
|
|
|
+ }else {
|
|
|
+
|
|
|
+ ifcancel="false";
|
|
|
+ }
|
|
|
+ String ifspecial;
|
|
|
+ if (ck_special_outbound.isChecked()==true){
|
|
|
+ ifspecial="true";
|
|
|
+ }else {
|
|
|
+ ifspecial="false";
|
|
|
+ }
|
|
|
+ VolleyRequest.getInstance().stringRequest(new HttpParams.Builder()
|
|
|
+ .url(GloableParams.ADDRESS_DOCUMENTLIBRARY_ADD_OUTBOUNDLIST)
|
|
|
+ .method(Request.Method.GET)
|
|
|
+ .tag(TAG + "getindatalist")
|
|
|
+ .flag(0)
|
|
|
+ .addParam("barcode", data)
|
|
|
+ .addParam("inoutno", tv_documents_code.getText().toString().trim())
|
|
|
+ .addParam("ifspecial",ifspecial)//是否勾选了特殊出库
|
|
|
+ .addParam("ifcancel",ifcancel)//是否勾选了取消采集
|
|
|
+ .build(), new HttpCallback() {
|
|
|
+ @Override
|
|
|
+ public void onSuccess(int flag, Object o) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ String result = o.toString();
|
|
|
+ JSONObject resultObject = JSON.parseObject(result);
|
|
|
+ JSONObject dataObject = resultObject.getJSONObject("data");
|
|
|
+ if (dataObject != null) {
|
|
|
+ bar_remain = FastjsonUtil.getText(dataObject, "pi_inoutno");
|
|
|
+// if (!add_checkbos.isChecked()){
|
|
|
+// initEditPopupWindow();
|
|
|
+// }
|
|
|
+
|
|
|
+ if (!tv_documents_code.getText().toString().trim().isEmpty()){
|
|
|
+ getDataCommitList();
|
|
|
+ if (add_checkbos.isChecked()==true){
|
|
|
+ CommonUtil.toastNoRepeat(mActivity,"取消成功");
|
|
|
+ }else {
|
|
|
+ CommonUtil.toastNoRepeat(mActivity,"采集成功");
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ tv_documents_code.setText(bar_remain);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onFail(int flag, String failStr) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, failStr);
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+ storage_recharge_collect_ets.selectAll();
|
|
|
+ storage_recharge_collect_ets.requestFocus();
|
|
|
+ imm.showSoftInput(storage_recharge_collect_ets, InputMethodManager.RESULT_HIDDEN);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 弹框保存按钮
|
|
|
+ */
|
|
|
+
|
|
|
+ //弹窗
|
|
|
+ private void initEditPopupWindow() {
|
|
|
+ View contView = LayoutInflater.from(mActivity).inflate(R.layout.index_edit_pup, null);
|
|
|
+ edit_et = (ClearableEditText) contView.findViewById(R.id.edit_et);
|
|
|
+ TextView sure_tv = (TextView) contView.findViewById(R.id.sure_tv);
|
|
|
+ TextView cancle_tv = (TextView) contView.findViewById(R.id.cancle_tv);
|
|
|
+ ImageView search_im = contView.findViewById(R.id.search_im);
|
|
|
+ edit_et.setText(bar_remain);
|
|
|
+ editPW = new PopupWindow(contView, LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT, true);
|
|
|
+ editPW.setTouchable(true);
|
|
|
+ editPW.setBackgroundDrawable(new BitmapDrawable());
|
|
|
+ editPW.setOnDismissListener(new BasePopupWindow.OnDismissListener() {
|
|
|
+ @Override
|
|
|
+ public void onDismiss() {
|
|
|
+ closeListPopupWindow();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ View parentView = mActivity.getWindow().findViewById(Window.ID_ANDROID_CONTENT);
|
|
|
+
|
|
|
+ editPW.showAtLocation(parentView, Gravity.CENTER, 0, 0);
|
|
|
+ CommonUtil.setBackgroundAlpha(mActivity, 0.5f);
|
|
|
+
|
|
|
+ sure_tv.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ String code = edit_et.getText().toString().trim();
|
|
|
+ getDialogDatalistCodes(storage_recharge_collect_ets.getText().toString().trim(),code);
|
|
|
+ closeListPopupWindow();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ CommonUtil.setEditorActionListener(edit_et, new MyEditorActionListener() {
|
|
|
+ @Override
|
|
|
+ public void MyEditorAction(String text, int actionId, KeyEvent event) {
|
|
|
+ String code = edit_et.getText().toString().trim();
|
|
|
+ getDialogDatalistCodes(storage_recharge_collect_ets.getText().toString().trim(),code);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ cancle_tv.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ closeListPopupWindow();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ private void closeListPopupWindow() {
|
|
|
+ if (editPW != null) {
|
|
|
+ editPW.dismiss();
|
|
|
+ editPW = null;
|
|
|
+ CommonUtil.setBackgroundAlpha(mActivity, 1f);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private void getDialogDatalistCodes(String data,String number) {
|
|
|
+ String pd_pdnoid = SharedPreUtil.getString(mActivity, "positionid", null);
|
|
|
+
|
|
|
+ if (!StringUtil.isEmpty(pd_pdnoid)){
|
|
|
+ integer = Integer.valueOf(pd_pdnoid);
|
|
|
+ String pd_barcodeqty = mFilterStorageInBeans.get(integer).getPD_BARCODEQTY();//条码数量
|
|
|
+ String pd_outqty = mFilterStorageInBeans.get(integer).getPD_OUTQTY();//数量
|
|
|
+ if (pd_barcodeqty.isEmpty()){
|
|
|
+ pd_barcodeqtyDouble=0.0;
|
|
|
+ }else {
|
|
|
+ pd_barcodeqtyDouble = Double.valueOf(pd_barcodeqty);
|
|
|
+ }
|
|
|
+ if (pd_outqty.isEmpty()){
|
|
|
+ pd_outqtyDouble=0.0;
|
|
|
+ }else {
|
|
|
+ pd_outqtyDouble = Double.valueOf(pd_outqty);
|
|
|
+ }
|
|
|
+ if (number.isEmpty()){
|
|
|
+ numberDouble = 0.0;
|
|
|
+ }else {
|
|
|
+ numberDouble = Double.valueOf(number);
|
|
|
+ }
|
|
|
+ double v = pd_barcodeqtyDouble + numberDouble;
|
|
|
+ if (add_checkbos.isChecked()==true){
|
|
|
+ baoucn(data,number);
|
|
|
+ }else {
|
|
|
+ if (pd_barcodeqtyDouble > pd_outqtyDouble||pd_barcodeqtyDouble + numberDouble > pd_outqtyDouble){
|
|
|
+ dialosDatas(data,number,v, pd_outqtyDouble);
|
|
|
+ }else {
|
|
|
+ baoucn(data,number);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //保存
|
|
|
+ public void baoucn(String data,String number){
|
|
|
+ String positionid = SharedPreUtil.getString(mActivity, "pd_pdnoid", null);
|
|
|
+ String pd_wmpdno = SharedPreUtil.getString(mActivity, "pd_wmpdno", null);
|
|
|
+ progressDialog.show();
|
|
|
+ String out_editorcodes = SharedPreUtil.getString(mActivity, "out_editorcodes", null);
|
|
|
+ String ifcancel;
|
|
|
+ if (add_checkbos.isChecked()==true){
|
|
|
+ ifcancel="true";
|
|
|
+ }else {
|
|
|
+ ifcancel="false";
|
|
|
+ }
|
|
|
+ String string_va_id = SharedPreUtil.getString(mActivity, Constants.STORAGEERECHADD, null);
|
|
|
+ if (!StringUtil.isEmpty(va_ids)){
|
|
|
+ string_va_id=va_ids;
|
|
|
+ }
|
|
|
+
|
|
|
+ VolleyRequest.getInstance().stringRequest(new HttpParams.Builder()
|
|
|
+ .url(GloableParams.ADDRESS_DOCUMENTLIBRARY_SAVE_OUTBOUNDLIST)
|
|
|
+ .method(Request.Method.GET)
|
|
|
+ .tag(TAG + "getindatalist")
|
|
|
+ .flag(0)
|
|
|
+ .addParam("barcode", out_editorcodes)
|
|
|
+ .addParam("pi_id", string_va_id)
|
|
|
+ .addParam("ifcancel",ifcancel)//是否勾选了取消采集
|
|
|
+ .addParam("remain",number)//手动输入的数
|
|
|
+ .addParam("pd_pdno",positionid)//明细序号
|
|
|
+ .addParam("pd_wmpdno",pd_wmpdno)
|
|
|
+ .build(), new HttpCallback() {
|
|
|
+ @Override
|
|
|
+ public void onSuccess(int flag, Object o) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ String result = o.toString();
|
|
|
+ JSONObject resultObject = JSON.parseObject(result);
|
|
|
+ JSONObject dataObject = resultObject.getJSONObject("data");
|
|
|
+ if (dataObject != null) {
|
|
|
+ //单据编号
|
|
|
+ String pi_inoutno = FastjsonUtil.getText(dataObject, "pi_inoutno");
|
|
|
+ String va_id = FastjsonUtil.getText(dataObject, "pi_id");
|
|
|
+ SharedPreUtil.saveString(mActivity, Constants.STORAGEERECHADD, va_id);
|
|
|
+
|
|
|
+ tv_documents_code.setText(pi_inoutno);
|
|
|
+ }
|
|
|
+ getDataCommitList();
|
|
|
+ if (add_checkbos.isChecked()==true){
|
|
|
+ CommonUtil.toastNoRepeat(mActivity,"取消成功");
|
|
|
+ }else {
|
|
|
+ CommonUtil.toastNoRepeat(mActivity,"采集成功");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onFail(int flag, String failStr) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, failStr);
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public void dialosDatas(String data,String number,Double v,Double pd_outqtyDouble){
|
|
|
+ new AlertDialog.Builder(getActivity()).setTitle("提示").setMessage("本次条码数量:"+v+"大于出库数量:"+pd_outqtyDouble)
|
|
|
+ .setPositiveButton(getString(R.string.confirm), new DialogInterface.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(DialogInterface dialog, int which) {
|
|
|
+ baoucn(data,number);
|
|
|
+
|
|
|
+ }
|
|
|
+ }).setNegativeButton(getString(R.string.cancel), null).create().show();
|
|
|
+ }
|
|
|
+ //生成明细数据
|
|
|
+ private void getDataadCommitList(){
|
|
|
+ if (tv_documents_code.getText().toString().isEmpty()){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ progressDialog.show();
|
|
|
+ VolleyRequest.getInstance().stringRequest(new HttpParams.Builder()
|
|
|
+ .url(GloableParams.ADDRESS_DOCUMENTLIBRARY_DETAIL_OUTBOUNDLIST)
|
|
|
+ .method(Request.Method.GET)
|
|
|
+ .tag(TAG + "datalist")
|
|
|
+ .flag(0)
|
|
|
+ .addParam("inoutno",tv_documents_code.getText().toString().trim())
|
|
|
+ .build(), new HttpCallback() {
|
|
|
+ @Override
|
|
|
+ public void onSuccess(int flag, Object o) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ getDataCommitList();
|
|
|
+ }
|
|
|
+ @Override
|
|
|
+ public void onFail(int flag, String failStr) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, failStr);
|
|
|
+ getDataCommitList();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //展示明细数据
|
|
|
+ private void getDataCommitList(){
|
|
|
+ if (tv_documents_code.getText().toString().isEmpty()){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ progressDialog.show();
|
|
|
+ String string_va_ids = SharedPreUtil.getString(mActivity, Constants.STORAGEERECHADD, null);
|
|
|
+ if (!StringUtil.isEmpty(va_ids)){
|
|
|
+ string_va_ids=va_ids;
|
|
|
+ }
|
|
|
+ VolleyRequest.getInstance().stringRequest(new HttpParams.Builder()
|
|
|
+ .url(GloableParams.ADDRESS_DOCUMENTLIBRARY_DETAIL_OUTBOUNDLISTS)
|
|
|
+ .method(Request.Method.GET)
|
|
|
+ .tag(TAG + "datalist")
|
|
|
+ .flag(0)
|
|
|
+ .addParam("inoutno",tv_documents_code.getText().toString().trim())
|
|
|
+ .build(), new HttpCallback() {
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onSuccess(int flag, Object o) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ try {
|
|
|
+ mFilterStorageInBeans.clear();
|
|
|
+ String result = o.toString();
|
|
|
+ JSONObject resultObject = JSON.parseObject(result);
|
|
|
+ JSONArray dataArray = resultObject.getJSONArray("data");
|
|
|
+ List<OutBoundListAddDalieBean> list = new ArrayList<>();
|
|
|
+ list.clear();
|
|
|
+ if (dataArray != null && dataArray.size() > 0) {
|
|
|
+ for (int i = 0; i < dataArray.size(); i++) {
|
|
|
+ JSONObject dataObject = dataArray.getJSONObject(i);
|
|
|
+ if (dataObject != null) {
|
|
|
+ OutBoundListAddDalieBean jltStorageInBean = new OutBoundListAddDalieBean();
|
|
|
+ jltStorageInBean.setBI_OUTQTY(FastjsonUtil.getText(dataObject, "BI_OUTQTY"));
|
|
|
+ jltStorageInBean.setBI_PRODCODE(FastjsonUtil.getText(dataObject, "BI_PRODCODE"));
|
|
|
+ jltStorageInBean.setPR_DETAIL(FastjsonUtil.getText(dataObject, "PR_DETAIL"));
|
|
|
+ list.add(jltStorageInBean);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+// mFilterStorageInBeans = list;
|
|
|
+
|
|
|
+ mFilterStorageInBeans = list;//PI_INOUTNO
|
|
|
+ setFilterTableData(mFilterStorageInBeans);
|
|
|
+ progressDialog.dismiss();
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ progressDialog.dismiss();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ @Override
|
|
|
+ public void onFail(int flag, String failStr) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ setFilterTableData(new ArrayList<>());
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, failStr);
|
|
|
+ setFilterTableData(mFilterStorageInBeans);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ progressDialog.dismiss();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onStop() {
|
|
|
+ super.onStop();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private void setFilterTableData(List<OutBoundListAddDalieBean> filterTableData) {
|
|
|
+ mTableData = new TableData<OutBoundListAddDalieBean>("列表", filterTableData,
|
|
|
+ va_detnoColumn,va_Pd_wmpdnoCoulmn,va_pucodeCoulmn);
|
|
|
+ mSmartTable.setTableData(mTableData);
|
|
|
+// mSmartTable.requestLayout();
|
|
|
+ mSmartTable.postDelayed(new Runnable() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ mSmartTable.postInvalidate();
|
|
|
+ }
|
|
|
+ }, 100);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ switch (v.getId()) {
|
|
|
+ case R.id.storage_recharge_scan_ivs:
|
|
|
+ if (CameraUtil.hasCamera()) {
|
|
|
+ if (root.findFocus() != null) {
|
|
|
+ mFocusId = root.findFocus().getId();
|
|
|
+ Intent intent = new Intent();
|
|
|
+ intent.setClass(mActivity, CaptureActivity.class);
|
|
|
+ startActivityForResult(intent, SCAN_BARCODE_CODE);
|
|
|
+ } else {
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "请选择您要操作的输入框");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, getString(R.string.no_camera_detected));
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case R.id.jlt_storage_in_generate_detailed_btn://生成明细
|
|
|
+ getDataadCommitList();
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onClick (Column < String > column, String value, String s,int position){
|
|
|
+ String pd_pdno = mFilterStorageInBeans.get(position).getPD_PDNO();
|
|
|
+ String pd_wmpdno = mFilterStorageInBeans.get(position).getPD_WMPDNO();
|
|
|
+
|
|
|
+ SharedPreUtil.saveString(mActivity,"positionid",position+"");
|
|
|
+ SharedPreUtil.saveString(mActivity,"pd_pdnoid",pd_pdno+"");
|
|
|
+ SharedPreUtil.saveString(mActivity,"pd_wmpdno",pd_wmpdno+"");
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ mSmartTable.getConfig()
|
|
|
+ .setContentCellBackgroundFormat(new BaseCellBackgroundFormat<CellInfo>() {
|
|
|
+ @Override
|
|
|
+ public int getBackGroundColor(CellInfo cellInfo) {
|
|
|
+ if (cellInfo.row == position) {
|
|
|
+ ischeck=false;
|
|
|
+ if (ischeck==false){
|
|
|
+ return ContextCompat.getColor(mActivity, R.color.text_blue);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ return TableConfig.INVALID_COLOR;
|
|
|
+ }
|
|
|
+ });
|
|
|
+// }
|
|
|
+
|
|
|
+ mSmartTable.postDelayed(new Runnable() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ mSmartTable.postInvalidate();
|
|
|
+ }
|
|
|
+ }, 100);
|
|
|
+
|
|
|
+ }
|
|
|
+ @Override
|
|
|
+ public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
|
+ super.onActivityResult(requestCode, resultCode, data);
|
|
|
+ if (requestCode == SCAN_BARCODE_CODE && data != null) {
|
|
|
+ if (data.getExtras() != null) {
|
|
|
+ String result = data.getExtras().getString(CodeUtils.RESULT_STRING);
|
|
|
+ SharedPreUtil.saveString(mActivity,"out_editorcodes",result);
|
|
|
+ if (mFocusId == R.id.storage_recharge_collect_ets) {
|
|
|
+ storage_recharge_collect_ets.setText(result);
|
|
|
+ storage_recharge_collect_ets.setSelection(result.length());
|
|
|
+ storage_recharge_collect_ets.selectAll();
|
|
|
+ storage_recharge_collect_ets.requestFocus();
|
|
|
+ imm.showSoftInput(storage_recharge_collect_ets, InputMethodManager.RESULT_HIDDEN);
|
|
|
+ getDatalistCodes(result);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ @Override
|
|
|
+ public void onDestroyView() {
|
|
|
+ super.onDestroyView();
|
|
|
+ ((FunctionActivity) getActivity()).setMoreBtnVisible(false);
|
|
|
+ CommonUtil.closeKeybord(storage_recharge_collect_ets, mActivity);
|
|
|
+ ((TextView) (getActivity().findViewById(R.id.tv_actionbar_withback))).setText(getString(R.string.title_outbound_rechargeadd));
|
|
|
+ SharedPreUtil.removeString(mActivity,Constants.STORAGEERECHADD);
|
|
|
+ }
|
|
|
+ @Override
|
|
|
+ public void onHiddenChanged(boolean hidden) {
|
|
|
+ super.onHiddenChanged(hidden);
|
|
|
+ if (hidden) {
|
|
|
+ ((FunctionActivity) getActivity()).setMoreBtnVisible(false);
|
|
|
+ } else {
|
|
|
+ FunctionActivity.setTitle(getString(R.string.title_outbound_rechargeadd));
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ @Override
|
|
|
+ public void onDestroy() {
|
|
|
+ super.onDestroy();
|
|
|
+
|
|
|
+ }
|
|
|
+}
|