实时盘点保存数据成功

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_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.adapter.RealTimeKcpdAdapter;
import com.rehome.zhdcoa.base.BaseActivity; import com.rehome.zhdcoa.base.BaseActivity;
import com.rehome.zhdcoa.base.BaseActivity2; import com.rehome.zhdcoa.base.BaseActivity2;
import com.rehome.zhdcoa.bean.DagerEnterApplyBaseBean;
import com.rehome.zhdcoa.bean.OneLevelShelvesBean; import com.rehome.zhdcoa.bean.OneLevelShelvesBean;
import com.rehome.zhdcoa.bean.RealTimeKcpdInfo; import com.rehome.zhdcoa.bean.RealTimeKcpdInfo;
import com.rehome.zhdcoa.bean.SaveRealTimeKcpdInfo; 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.NohttpUtils;
import com.rehome.zhdcoa.utils.SPUtils; import com.rehome.zhdcoa.utils.SPUtils;
import com.rehome.zhdcoa.utils.UiUtlis; import com.rehome.zhdcoa.utils.UiUtlis;
import com.rehome.zhdcoa.weiget.ListViewForScrollView;
import com.rehome.zhdcoa.weiget.PdDialog; import com.rehome.zhdcoa.weiget.PdDialog;
import com.rehome.zhdcoa.weiget.RealTimePdDialog;
import com.yolanda.nohttp.NoHttp; import com.yolanda.nohttp.NoHttp;
import com.yolanda.nohttp.RequestMethod; import com.yolanda.nohttp.RequestMethod;
import com.yolanda.nohttp.rest.Request; import com.yolanda.nohttp.rest.Request;
@ -55,7 +58,7 @@ public class HjpdActivity extends BaseActivity implements RealTimeKcpdAdapter.Ca
EditText et_hgtm; EditText et_hgtm;
TextView tv_sys; TextView tv_sys;
Button btn_query; Button btn_query;
ListView lv; ListViewForScrollView lv;
TextView et_xm; TextView et_xm;
TextView et_ms; TextView et_ms;
TextView et_sl; TextView et_sl;
@ -117,10 +120,10 @@ public class HjpdActivity extends BaseActivity implements RealTimeKcpdAdapter.Ca
if (infos.get(i).isFlag()) { if (infos.get(i).isFlag()) {
//判断是否已经盘点 //判断是否已经盘点
if (infos.get(i).getISPD().equals("1")) { if (infos.get(i).getISPD().equals("1")) {
showPdDialog(false); showPdDialog(infos.get(i));
} else { } else {
//如果没有盘点,就盘点 //如果没有盘点,就盘点
scData(toJson("1")); scData(addJson(infos.get(i)));
} }
} }
} }
@ -129,54 +132,55 @@ public class HjpdActivity extends BaseActivity implements RealTimeKcpdAdapter.Ca
} }
} else { } else {
//如果没有选中,点击保存。 //如果没有选中,点击保存。
showToast("请选择要盘点的物资");
// String spinnerSonSelectItemStr = spinnerSon.getSelectedItem().toString(); // String spinnerSonSelectItemStr = spinnerSon.getSelectedItem().toString();
// Request<String> request = NoHttp.createStringRequest(Contans.IP + Contans.REAL_TIME_PD); // Request<String> request = NoHttp.createStringRequest(Contans.IP + Contans.REAL_TIME_PD);
// request.add("UDBINNUM", spinnerSonSelectItemStr); // request.add("UDBINNUM", spinnerSonSelectItemStr);
// request.add("ITEMNUM", UiUtlis.getText(etXmh)); // request.add("ITEMNUM", UiUtlis.getText(etXmh));
// request.add("BINNUM", UiUtlis.getText(et_hgtm)); // request.add("BINNUM", UiUtlis.getText(et_hgtm));
if (!UiUtlis.getText(et_sjsl).isEmpty() && !UiUtlis.getText(et_hgtm).isEmpty()) { // if (!UiUtlis.getText(et_sjsl).isEmpty() && !UiUtlis.getText(et_hgtm).isEmpty()) {
boolean ispd = false; // boolean ispd = false;
if (infos.size() != 0) { // if (infos.size() != 0) {
for (RealTimeKcpdInfo.RowsBean kcpd : infos) { // for (RealTimeKcpdInfo.RowsBean kcpd : infos) {
//
if (kcpd.getISPD().equals("1") && kcpd.getBINNUM().equals(spinnerSon.getSelectedItem().toString())) { // if (kcpd.getISPD().equals("1") && kcpd.getBINNUM().equals(spinnerSon.getSelectedItem().toString())) {
ispd = true; // ispd = true;
break; // break;
} // }
} // }
playSound(); // playSound();
AlertDialog.Builder builder = new AlertDialog.Builder(context); // AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setCancelable(false); // builder.setCancelable(false);
builder.setTitle("提示"); // builder.setTitle("提示");
builder.setMessage("该物资未在该货架下,确定保存吗?"); // builder.setMessage("该物资未在该货架下,确定保存吗?");
builder.setNegativeButton("取消", new DialogInterface.OnClickListener() { // builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
@Override // @Override
public void onClick(DialogInterface dialog, int which) { // public void onClick(DialogInterface dialog, int which) {
dialog.dismiss(); // dialog.dismiss();
} // }
}); // });
final boolean finalIspd = ispd; // final boolean finalIspd = ispd;
builder.setPositiveButton("确定", new DialogInterface.OnClickListener() { // builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {
@Override // @Override
public void onClick(DialogInterface dialog, int which) { // public void onClick(DialogInterface dialog, int which) {
//
//如果已经盘点。就覆盖。 // //如果已经盘点。就覆盖。
if (finalIspd) { // if (finalIspd) {
showPdDialog(true); // showPdDialog(true);
} else { // } else {
String json = addJson("4", infos.get(0)); // String json = addJson("4", infos.get(0));
scData(json); // scData(json);
} // }
dialog.dismiss(); // dialog.dismiss();
//
} // }
}); // });
builder.create().show(); // builder.create().show();
} // }
} else { // } else {
showToast("你还有数据未输入"); // showToast("你还有数据未输入");
} // }
} }
} }
}); });
@ -290,37 +294,20 @@ public class HjpdActivity extends BaseActivity implements RealTimeKcpdAdapter.Ca
} }
} }
private void showPdDialog(final boolean isAdd) { private void showPdDialog(RealTimeKcpdInfo.RowsBean kcpd) {
final PdDialog dialog = new PdDialog(this); final RealTimePdDialog dialog = new RealTimePdDialog(this);
dialog.setFgOnClick(new View.OnClickListener() { dialog.setFgOnClick(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
scData(addJson(kcpd));
if (!isAdd) {
scData(toJson("2"));
} else {
scData(addJson("2", infos.get(0)));
}
dialog.close(); 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() { dialog.setQxOnClick(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
et_sjsl.setText("");
dialog.close(); dialog.close();
} }
}); });
@ -337,7 +324,7 @@ public class HjpdActivity extends BaseActivity implements RealTimeKcpdAdapter.Ca
//上传数据 //上传数据
private void scData(String json) { 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); request.setDefineRequestBodyForJson(json);
NohttpUtils.getInstance().add(HjpdActivity.this, 1, request, callback, true, true, UiUtlis.getString(context, R.string.upload)); 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; break;
case 1: case 1:
StatusInfo info = GsonUtils.GsonToBean(response.get(), StatusInfo.class); DagerEnterApplyBaseBean info = GsonUtils.GsonToBean(response.get(), DagerEnterApplyBaseBean.class);
if (info != null) { if (info != null) {
String status = info.getRows().get(0).getStatus(); if (info.isFlag()) {
if (status.equals("1")) {
showToast("盘点成功"); showToast("盘点成功");
if (!UiUtlis.getText(etXmh).isEmpty()) { // if (!UiUtlis.getText(etXmh).isEmpty()) {
removeView(); // removeView();
} else { // } else {
requestData("刷新.."); // requestData("刷新..");
} // }
requestData("刷新..");
playSound(); playSound();
} else if (status.equals("0")) { } else {
showToast("盘点失败"); showToast("盘点失败");
} }
} else { } else {
@ -484,7 +471,7 @@ public class HjpdActivity extends BaseActivity implements RealTimeKcpdAdapter.Ca
ll.setVisibility(View.INVISIBLE); ll.setVisibility(View.INVISIBLE);
} }
private String toJson(String sjpdzt) { private String toJson() {
String json = ""; String json = "";
// if (selectItem != -1) { // if (selectItem != -1) {
// KcpdInfo info = new KcpdInfo(); // KcpdInfo info = new KcpdInfo();
@ -503,7 +490,7 @@ public class HjpdActivity extends BaseActivity implements RealTimeKcpdAdapter.Ca
return json; return json;
} }
private String addJson(String sjpdzt, RealTimeKcpdInfo.RowsBean kcpd) { private String addJson(RealTimeKcpdInfo.RowsBean kcpd) {
String json = ""; String json = "";
SaveRealTimeKcpdInfo info = new SaveRealTimeKcpdInfo(); SaveRealTimeKcpdInfo info = new SaveRealTimeKcpdInfo();
info.setPDSL(et_sjsl.getText().toString()); 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) { if (oneLevelShelvesBean.isFlag() && oneLevelShelvesBean.getDatas() != null && oneLevelShelvesBean.getDatas().size() > 0) {
String BINNUM = oneLevelShelvesBean.getDatas().get(0).getBINNUM(); String BINNUM = oneLevelShelvesBean.getDatas().get(0).getBINNUM();
getSpinnerSonData(BINNUM); getSpinnerSonData(BINNUM);
}else{ } else {
showToast("查询不到子货架号,请确认母货架号是否正确"); showToast("查询不到子货架号,请确认母货架号是否正确");
} }
} }
@ -657,6 +644,21 @@ public class HjpdActivity extends BaseActivity implements RealTimeKcpdAdapter.Ca
* 1K103 * 1K103
* 1K101-034 * 1K101-034
* IT16159 * 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 <HorizontalScrollView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="500px" android:layout_height="wrap_content"
android:layout_marginTop="20px"> android:layout_marginTop="10dp">
<ListView <com.rehome.zhdcoa.weiget.ListViewForScrollView
android:id="@+id/lv" android:id="@+id/lv"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:descendantFocusability="beforeDescendants"
android:divider="#00000000" /> android:divider="#00000000" />
</HorizontalScrollView> </HorizontalScrollView>
@ -258,7 +257,8 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/px_40" android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:gravity="center"> android:gravity="center">
<Button <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 <Button
android:id="@+id/btn_xj" android:id="@+id/btn_xj"
style="@style/button" style="@style/button"
android:layout_marginLeft="@dimen/px_30"
android:layout_marginRight="@dimen/px_30"
android:layout_weight="1" android:layout_weight="1"
android:text="相加"/> android:text="相加"/>
<Button <Button
android:id="@+id/btn_qx" android:id="@+id/btn_qx"
style="@style/button" style="@style/button"
android:layout_marginLeft="0dp" android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/cancel"/> android:text="@string/cancel"/>

@ -48,7 +48,7 @@
</style> </style>
<style name="button"> <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_width">100px</item>
<item name="android:layout_height">80px</item> <item name="android:layout_height">80px</item>
<item name="android:background">@drawable/presslr</item> <item name="android:background">@drawable/presslr</item>

Loading…
Cancel
Save