diff --git a/app/build.gradle b/app/build.gradle index b696758..39f0ef5 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,7 +9,7 @@ android {compileSdkVersion 30 applicationId "com.icssoft.icspda" minSdkVersion 18 targetSdkVersion 28 - versionCode 19 + versionCode 20 versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } diff --git a/app/src/main/java/com/icssoft/icspda/activity/MOStockINActivity.java b/app/src/main/java/com/icssoft/icspda/activity/MOStockINActivity.java index 6f3a7f1..257d521 100644 --- a/app/src/main/java/com/icssoft/icspda/activity/MOStockINActivity.java +++ b/app/src/main/java/com/icssoft/icspda/activity/MOStockINActivity.java @@ -1,6 +1,8 @@ package com.icssoft.icspda.activity; +import android.content.DialogInterface; import android.graphics.Color; +import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.os.Looper; @@ -15,6 +17,7 @@ import android.widget.EditText; import android.widget.RadioButton; import android.widget.TextView; +import androidx.annotation.RequiresApi; import androidx.appcompat.app.AppCompatActivity; import com.bin.david.form.core.SmartTable; @@ -39,6 +42,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; public class MOStockINActivity extends AppCompatActivity { //region 变量初始化 @@ -97,6 +101,11 @@ public class MOStockINActivity extends AppCompatActivity { barCode.requestFocus(); HelpUtil.SetMsg(tvMsg, Color.BLUE, "产品条码扫描成功!"); break; + case 96: + HelpUtil.SetMsg(tvMsg, Color.BLUE, ErrorMsg); + barCode.setText(""); + barCode.requestFocus(); + break; case 97: barCode.requestFocus(); HelpUtil.SetMsg(tvMsg,Color.YELLOW,ErrorMsg); @@ -240,9 +249,13 @@ public class MOStockINActivity extends AppCompatActivity { return; } new Thread(new Runnable() { + @RequiresApi(api = Build.VERSION_CODES.N) @Override public void run() { - storageINForMONew(); + Looper.prepare(); +// showAlert(); + storageINForMO(); + Looper.loop(); if (IsFinish==true){ Looper.prepare(); barWithNumber.setProgress(100); @@ -536,46 +549,40 @@ public class MOStockINActivity extends AppCompatActivity { } } - public void storageINForMONew() { -// String BarCodeList = "";//物料条码 -// String BinCodeList = "";//库位 -// String POCode="";//单据 -// String PORow="";//行号 -// String POQty="";//已入库数量 -// List apiList = new ArrayList<>(); -// SubmitData list=new SubmitData(); -// List pdaListData=new ArrayList<>(); -// List pdaListDetailData=new ArrayList<>(); -// -// for (PdaListData moStockINData:dataList){ -// if (moStockINData.getBinCode()!=null||moStockINData.getBinCode().equals("")){ -// pdaListData.add(moStockINData); -// } else { -// ErrorMsg = "存在未扫描库位的条码,请确认后再提交"; -// handler.sendEmptyMessage(99); -// return; -// } -// } -// -//// Map params = new HashMap(); -//// params.put("barStr", BarCodeList); -//// params.put("stack", BinCodeList); -//// params.put("POCode", POCode); -//// params.put("PORow", PORow); -//// params.put("POQty", POQty); -//// params.put("userCode", "demo"); -//// params.put("userName", "开发者"); -//// params.put("workPoint", workPoint) ; -//// params.put("Type","收"); -// -// list.setDataList(pdaListData); -// list.setDataDetailList(pdaListDetailData); -// list.setUserCode(LoginActivity.user.getUserCode()); -// list.setUserName(LoginActivity.user.getUserName()); -// list.setWorkPoint(LoginActivity.user.getWorkPointCode()); -// list.setType("收"); -// Map content = new HashMap(); -// content.put("params", new Gson().toJson(list)); + @RequiresApi(api = Build.VERSION_CODES.N) + private void showAlert(){ + //若存在费用型料号,且未发货完成,给出提醒弹窗 + List tempMateArr = dataList.stream().filter(a -> new BigDecimal(a.getQuantity()).compareTo(new BigDecimal(a.getIssueQuantity())) > 0).collect(Collectors.toList()); + if (tempMateArr != null && tempMateArr.size() > 0){ + + android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(this); + android.app.AlertDialog alertDialog = builder.setTitle("生产耗用提醒") + .setCancelable(false) + .setMessage("存在非生产耗用料品,是否继续入库?") + .setPositiveButton("确定", new DialogInterface.OnClickListener() { + @RequiresApi(api = Build.VERSION_CODES.N) + @Override + public void onClick(DialogInterface dialog, int which) { + Log.e("提醒框选择:","继续入库"); + storageINForMO(); + } + }) + .setNegativeButton("取消", new DialogInterface.OnClickListener() { + @RequiresApi(api = Build.VERSION_CODES.N) + @Override + public void onClick(DialogInterface dialog, int which) { + Log.e("提醒框选择:","不入库"); + ErrorMsg = "放弃入库"; + handler.sendEmptyMessage(96); + } + }).create(); + alertDialog.show(); + }else { + storageINForMO(); + } + } + + public void storageINForMO() { Map params = new HashMap(); List tempArr = new ArrayList();