实时盘点保存数据成功

master
hwf453 2 years ago
parent 00c176a493
commit 4ba76504c7

@ -293,6 +293,10 @@ public class Contans {
*
*/
public static String REAL_TIME_PD = "WLJS/KCSSPD/GetListData.ashx";
/**
*
*/
public static String REAL_TIME_PDJHSC = "WLJS/KCSSPD/SavePDData.ashx";
/**
*

@ -28,6 +28,7 @@ import com.rehome.zhdcoa.adapter.KcpdAdapter;
import com.rehome.zhdcoa.adapter.RealTimeKcpdAdapter;
import com.rehome.zhdcoa.base.BaseActivity;
import com.rehome.zhdcoa.base.BaseActivity2;
import com.rehome.zhdcoa.bean.DagerEnterApplyBaseBean;
import com.rehome.zhdcoa.bean.OneLevelShelvesBean;
import com.rehome.zhdcoa.bean.RealTimeKcpdInfo;
import com.rehome.zhdcoa.bean.SaveRealTimeKcpdInfo;
@ -39,7 +40,9 @@ import com.rehome.zhdcoa.utils.HttpListener;
import com.rehome.zhdcoa.utils.NohttpUtils;
import com.rehome.zhdcoa.utils.SPUtils;
import com.rehome.zhdcoa.utils.UiUtlis;
import com.rehome.zhdcoa.weiget.ListViewForScrollView;
import com.rehome.zhdcoa.weiget.PdDialog;
import com.rehome.zhdcoa.weiget.RealTimePdDialog;
import com.yolanda.nohttp.NoHttp;
import com.yolanda.nohttp.RequestMethod;
import com.yolanda.nohttp.rest.Request;
@ -55,7 +58,7 @@ public class HjpdActivity extends BaseActivity implements RealTimeKcpdAdapter.Ca
EditText et_hgtm;
TextView tv_sys;
Button btn_query;
ListView lv;
ListViewForScrollView lv;
TextView et_xm;
TextView et_ms;
TextView et_sl;
@ -117,10 +120,10 @@ public class HjpdActivity extends BaseActivity implements RealTimeKcpdAdapter.Ca
if (infos.get(i).isFlag()) {
//判断是否已经盘点
if (infos.get(i).getISPD().equals("1")) {
showPdDialog(false);
showPdDialog(infos.get(i));
} else {
//如果没有盘点,就盘点
scData(toJson("1"));
scData(addJson(infos.get(i)));
}
}
}
@ -129,54 +132,55 @@ public class HjpdActivity extends BaseActivity implements RealTimeKcpdAdapter.Ca
}
} else {
//如果没有选中,点击保存。
showToast("请选择要盘点的物资");
// String spinnerSonSelectItemStr = spinnerSon.getSelectedItem().toString();
// Request<String> request = NoHttp.createStringRequest(Contans.IP + Contans.REAL_TIME_PD);
// request.add("UDBINNUM", spinnerSonSelectItemStr);
// request.add("ITEMNUM", UiUtlis.getText(etXmh));
// request.add("BINNUM", UiUtlis.getText(et_hgtm));
if (!UiUtlis.getText(et_sjsl).isEmpty() && !UiUtlis.getText(et_hgtm).isEmpty()) {
boolean ispd = false;
if (infos.size() != 0) {
for (RealTimeKcpdInfo.RowsBean kcpd : infos) {
if (kcpd.getISPD().equals("1") && kcpd.getBINNUM().equals(spinnerSon.getSelectedItem().toString())) {
ispd = true;
break;
}
}
playSound();
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setCancelable(false);
builder.setTitle("提示");
builder.setMessage("该物资未在该货架下,确定保存吗?");
builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
final boolean finalIspd = ispd;
builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
//如果已经盘点。就覆盖。
if (finalIspd) {
showPdDialog(true);
} else {
String json = addJson("4", infos.get(0));
scData(json);
}
dialog.dismiss();
}
});
builder.create().show();
}
} else {
showToast("你还有数据未输入");
}
// if (!UiUtlis.getText(et_sjsl).isEmpty() && !UiUtlis.getText(et_hgtm).isEmpty()) {
// boolean ispd = false;
// if (infos.size() != 0) {
// for (RealTimeKcpdInfo.RowsBean kcpd : infos) {
//
// if (kcpd.getISPD().equals("1") && kcpd.getBINNUM().equals(spinnerSon.getSelectedItem().toString())) {
// ispd = true;
// break;
// }
// }
// playSound();
// AlertDialog.Builder builder = new AlertDialog.Builder(context);
// builder.setCancelable(false);
// builder.setTitle("提示");
// builder.setMessage("该物资未在该货架下,确定保存吗?");
// builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
// @Override
// public void onClick(DialogInterface dialog, int which) {
// dialog.dismiss();
// }
// });
// final boolean finalIspd = ispd;
// builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {
// @Override
// public void onClick(DialogInterface dialog, int which) {
//
// //如果已经盘点。就覆盖。
// if (finalIspd) {
// showPdDialog(true);
// } else {
// String json = addJson("4", infos.get(0));
// scData(json);
// }
// dialog.dismiss();
//
// }
// });
// builder.create().show();
// }
// } else {
// showToast("你还有数据未输入");
// }
}
}
});
@ -290,37 +294,20 @@ public class HjpdActivity extends BaseActivity implements RealTimeKcpdAdapter.Ca
}
}
private void showPdDialog(final boolean isAdd) {
final PdDialog dialog = new PdDialog(this);
private void showPdDialog(RealTimeKcpdInfo.RowsBean kcpd) {
final RealTimePdDialog dialog = new RealTimePdDialog(this);
dialog.setFgOnClick(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (!isAdd) {
scData(toJson("2"));
} else {
scData(addJson("2", infos.get(0)));
}
scData(addJson(kcpd));
dialog.close();
}
});
dialog.setXjOnClick(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (!isAdd) {
scData(toJson("3"));
} else {
scData(addJson("3", infos.get(0)));
}
dialog.close();
}
});
dialog.setQxOnClick(new View.OnClickListener() {
@Override
public void onClick(View v) {
et_sjsl.setText("");
dialog.close();
}
});
@ -337,7 +324,7 @@ public class HjpdActivity extends BaseActivity implements RealTimeKcpdAdapter.Ca
//上传数据
private void scData(String json) {
Request<String> request = NoHttp.createStringRequest(Contans.IP + Contans.PDJHSC, RequestMethod.POST);
Request<String> request = NoHttp.createStringRequest(Contans.IP + Contans.REAL_TIME_PDJHSC, RequestMethod.POST);
request.setDefineRequestBodyForJson(json);
NohttpUtils.getInstance().add(HjpdActivity.this, 1, request, callback, true, true, UiUtlis.getString(context, R.string.upload));
}
@ -385,18 +372,18 @@ public class HjpdActivity extends BaseActivity implements RealTimeKcpdAdapter.Ca
}
break;
case 1:
StatusInfo info = GsonUtils.GsonToBean(response.get(), StatusInfo.class);
DagerEnterApplyBaseBean info = GsonUtils.GsonToBean(response.get(), DagerEnterApplyBaseBean.class);
if (info != null) {
String status = info.getRows().get(0).getStatus();
if (status.equals("1")) {
if (info.isFlag()) {
showToast("盘点成功");
if (!UiUtlis.getText(etXmh).isEmpty()) {
removeView();
} else {
requestData("刷新..");
}
// if (!UiUtlis.getText(etXmh).isEmpty()) {
// removeView();
// } else {
// requestData("刷新..");
// }
requestData("刷新..");
playSound();
} else if (status.equals("0")) {
} else {
showToast("盘点失败");
}
} else {
@ -484,7 +471,7 @@ public class HjpdActivity extends BaseActivity implements RealTimeKcpdAdapter.Ca
ll.setVisibility(View.INVISIBLE);
}
private String toJson(String sjpdzt) {
private String toJson() {
String json = "";
// if (selectItem != -1) {
// KcpdInfo info = new KcpdInfo();
@ -503,7 +490,7 @@ public class HjpdActivity extends BaseActivity implements RealTimeKcpdAdapter.Ca
return json;
}
private String addJson(String sjpdzt, RealTimeKcpdInfo.RowsBean kcpd) {
private String addJson(RealTimeKcpdInfo.RowsBean kcpd) {
String json = "";
SaveRealTimeKcpdInfo info = new SaveRealTimeKcpdInfo();
info.setPDSL(et_sjsl.getText().toString());
@ -547,7 +534,7 @@ public class HjpdActivity extends BaseActivity implements RealTimeKcpdAdapter.Ca
if (oneLevelShelvesBean.isFlag() && oneLevelShelvesBean.getDatas() != null && oneLevelShelvesBean.getDatas().size() > 0) {
String BINNUM = oneLevelShelvesBean.getDatas().get(0).getBINNUM();
getSpinnerSonData(BINNUM);
}else{
} else {
showToast("查询不到子货架号,请确认母货架号是否正确");
}
}
@ -657,6 +644,21 @@ public class HjpdActivity extends BaseActivity implements RealTimeKcpdAdapter.Ca
* 1K103
* 1K101-034
* IT16159
* <p>
* 1K101
* 1K101-043
* IT63867
* <p>
* 1K102
* 1K101-013
* IT62209
* IT62210
* IT62211
* IT60669
* <p>
* 1K103
* 1K101-034
* IT16159
*/
/**

@ -0,0 +1,82 @@
package com.rehome.zhdcoa.weiget;
import android.content.Context;
import androidx.appcompat.app.AlertDialog;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.TextView;
import com.rehome.zhdcoa.R;
/**
* Created by gzw on 2016/8/17.
*/
public class RealTimePdDialog {
private final Context mContext;
private final AlertDialog dialog;
private final TextView tv_title;
private final TextView tv_message;
private final Button btn_fg;
private final Button btn_qx;
private final Window mWindow;
public RealTimePdDialog(Context context) {
mContext = context;
dialog = new AlertDialog.Builder(context).create();
dialog.setCancelable(true);
dialog.show();
mWindow = dialog.getWindow();
mWindow.setContentView(R.layout.dialog_real_time_pd);
tv_title = mWindow.findViewById(R.id.tv_title);
tv_message = mWindow.findViewById(R.id.tv_message);
btn_fg = mWindow.findViewById(R.id.btn_fg);
btn_qx = mWindow.findViewById(R.id.btn_qx);
}
/**
*
*
* @param listener
*/
public void setFgOnClick(View.OnClickListener listener) {
btn_fg.setOnClickListener(listener);
}
/**
*
*
* @param listener
*/
public void setQxOnClick(View.OnClickListener listener) {
btn_qx.setOnClickListener(listener);
}
/**
* Title
*
* @param title
*/
public void setTitle(String title) {
tv_title.setText(title);
}
/**
* message
*
* @param message
*/
public void setMessage(String message) {
tv_message.setText(message);
}
public void close() {
dialog.dismiss();
}
}

@ -145,14 +145,13 @@
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="500px"
android:layout_marginTop="20px">
android:layout_height="wrap_content"
android:layout_marginTop="10dp">
<ListView
<com.rehome.zhdcoa.weiget.ListViewForScrollView
android:id="@+id/lv"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:descendantFocusability="beforeDescendants"
android:layout_height="wrap_content"
android:divider="#00000000" />
</HorizontalScrollView>
@ -258,7 +257,8 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/px_40"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:gravity="center">
<Button

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<com.zhy.autolayout.AutoLinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/tv_title"
android:layout_width="match_parent"
android:layout_height="@dimen/px_100"
android:gravity="center"
android:text="提示"
android:textSize="26px"/>
<View
android:layout_width="match_parent"
android:layout_height="2px"
android:background="@color/blue"></View>
<TextView
android:id="@+id/tv_message"
android:layout_width="match_parent"
android:layout_height="@dimen/px_150"
android:layout_marginStart="30dp"
android:layout_marginEnd="30dp"
android:gravity="center"
android:text="你已盘点过该物资了,需要执行下面哪个操作?"
android:textSize="26px"/>
<View
android:layout_width="match_parent"
android:layout_height="2px"
android:background="@color/blue"></View>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/px_100"
android:layout_marginTop="@dimen/px_10"
android:layout_marginStart="30dp"
android:layout_marginEnd="30dp"
android:gravity="center"
android:orientation="horizontal">
<Button
android:id="@+id/btn_fg"
style="@style/button"
android:layout_weight="1"
android:text="覆盖"/>
<Button
android:id="@+id/btn_qx"
style="@style/button"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:layout_weight="1"
android:text="@string/cancel"/>
</LinearLayout>
</com.zhy.autolayout.AutoLinearLayout>

@ -46,15 +46,14 @@
<Button
android:id="@+id/btn_xj"
style="@style/button"
android:layout_marginLeft="@dimen/px_30"
android:layout_marginRight="@dimen/px_30"
android:layout_weight="1"
android:text="相加"/>
<Button
android:id="@+id/btn_qx"
style="@style/button"
android:layout_marginLeft="0dp"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:layout_weight="1"
android:text="@string/cancel"/>

@ -48,7 +48,7 @@
</style>
<style name="button">
<item name="android:layout_marginLeft">10px</item>
<item name="android:layout_marginStart">10dp</item>
<item name="android:layout_width">100px</item>
<item name="android:layout_height">80px</item>
<item name="android:background">@drawable/presslr</item>

Loading…
Cancel
Save