|
|
@@ -7,6 +7,7 @@ import android.content.Context;
|
|
|
import android.content.Intent;
|
|
|
import android.content.IntentFilter;
|
|
|
import android.os.Bundle;
|
|
|
+import android.os.Handler;
|
|
|
import android.view.View;
|
|
|
import android.widget.Button;
|
|
|
import android.widget.ImageView;
|
|
|
@@ -112,6 +113,14 @@ public class StockInNewActivity extends BaseActivity {
|
|
|
from = getParamString("from");
|
|
|
if("1".equals(from)){
|
|
|
binding.tvScanTips.setVisibility(View.GONE);
|
|
|
+ Button submit = findViewById(R.id.c_iv_common_submit);
|
|
|
+ submit.setBackgroundColor(Res.getColor("transparent"));
|
|
|
+ submit.setTextColor(Res.getColor("white"));
|
|
|
+ submit.setVisibility(View.VISIBLE);
|
|
|
+ submit.setText("同步");
|
|
|
+ submit.setOnClickListener(view -> {
|
|
|
+ syncErp();
|
|
|
+ });
|
|
|
}
|
|
|
if(!"1".equals(from)) {
|
|
|
Button submit = findViewById(R.id.c_iv_common_submit);
|
|
|
@@ -219,6 +228,52 @@ public class StockInNewActivity extends BaseActivity {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ private void syncErp(){
|
|
|
+ if(Constant.user==null || Constant.user.getUserId() == null){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ RequestParams params = httParams(Constant.SYNC_IN_STOCK);
|
|
|
+ if(stockModel==null){
|
|
|
+ ToastUtils.showToast(context, "入库单不存在");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ MyProgress myProgress = MyProgress.getInstance();
|
|
|
+ myProgress.show(context, "提示", "正在加载");
|
|
|
+ params.addBodyParameter("instockId", stockModel.getInstockId());
|
|
|
+ params.addBodyParameter("operator", Constant.user.getLoginName());
|
|
|
+ x.http().post(params, new Callback.CommonCallback<JSONObject>() {
|
|
|
+ @Override
|
|
|
+ public void onSuccess(JSONObject rs) {
|
|
|
+ mylog.info(rs.toString());
|
|
|
+ try {
|
|
|
+ ToastUtils.showToast(context, rs.getString("msg"));
|
|
|
+ if (rs.getInt("code") == 200) {
|
|
|
+ ToastUtils.showToast(context, "同步请求成功");
|
|
|
+ }else{
|
|
|
+ logoutAuth(rs.getInt("code"));
|
|
|
+ }
|
|
|
+ } catch (JSONException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ @Override
|
|
|
+ public void onError(Throwable ex, boolean isOnCallback) {
|
|
|
+ ex.printStackTrace();
|
|
|
+ HttpsUtil.parserError(StockInNewActivity.this, ex);
|
|
|
+ mylog.error("请求异常:", ex);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onFinished() {
|
|
|
+ myProgress.close();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onCancelled(CancelledException arg0) {
|
|
|
+ mylog.error("onRead:", arg0);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true, priority = 1)
|
|
|
public void onReceiveMsg(EventMessage message){
|