From e9fdfc6fd837590e0d9014cc631c8d9947617d15 Mon Sep 17 00:00:00 2001 From: fyw Date: Wed, 14 Sep 2022 14:45:28 +0800 Subject: [PATCH] =?UTF-8?q?=E9=94=80=E5=94=AE=E9=80=80=E8=B4=A7=E5=8E=BB?= =?UTF-8?q?=E9=99=A4=E6=89=AB=E6=8F=8F=E6=BA=90=E5=A4=B4=E5=8D=95=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../activity/DispatchListReturnActivity.java | 174 +++--------------- 1 file changed, 23 insertions(+), 151 deletions(-) diff --git a/app/src/main/java/com/icssoft/icspda/activity/DispatchListReturnActivity.java b/app/src/main/java/com/icssoft/icspda/activity/DispatchListReturnActivity.java index 5d8a1e8..9ae3fea 100644 --- a/app/src/main/java/com/icssoft/icspda/activity/DispatchListReturnActivity.java +++ b/app/src/main/java/com/icssoft/icspda/activity/DispatchListReturnActivity.java @@ -139,12 +139,6 @@ public class DispatchListReturnActivity extends AppCompatActivity { @Override public void run() { CheckStackCode(); - if (IsFinish==true){ - Looper.prepare(); - barWithNumber.setProgress(100); - dialog.dismiss(); - IsFinish=false; - } } }).start(); @@ -171,22 +165,15 @@ public class DispatchListReturnActivity extends AppCompatActivity { if (actionId == EditorInfo.IME_ACTION_SEND || actionId == EditorInfo.IME_ACTION_DONE || actionId == EditorInfo.IME_ACTION_NEXT || (event != null && KeyEvent.KEYCODE_ENTER == event.getKeyCode() && KeyEvent.ACTION_DOWN == event.getAction())) { if (v.getText().length() > 0) { - + if (TextUtils.isEmpty(binCode.getText().toString().trim())){ + ErrorMsg="请先扫描目标库位!"; + handler.sendEmptyMessage(1); + return false; + } new Thread(new Runnable() { @Override public void run() { - if (TextUtils.isEmpty(binCode.getText().toString().trim())){ - ErrorMsg=HelpUtil.Languange("PDA027"); - handler.sendEmptyMessage(1); - return; - } CheckLotnoForSOReturnNew(); - if (IsFinish==true){ - Looper.prepare(); - barWithNumber.setProgress(100); - dialog.dismiss(); - IsFinish=false; - } } }).start(); @@ -232,21 +219,15 @@ public class DispatchListReturnActivity extends AppCompatActivity { btnOk.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { + if (dataList.size() <= 0) { + HelpUtil.SetMsg(tvMsg, Color.RED, "请先扫描条码!"); + barCode.requestFocus(); + return; + } new Thread(new Runnable() { @Override public void run() { - if (dataList.size() <= 0) { - ErrorMsg = HelpUtil.Languange("PDA013"); - handler.sendEmptyMessage(3); - return; - } DispatchIN(); - if (IsFinish==true){ - Looper.prepare(); - barWithNumber.setProgress(100); - dialog.dismiss(); - IsFinish=false; - } } }).start(); @@ -260,28 +241,6 @@ public class DispatchListReturnActivity extends AppCompatActivity { }); } - //源头单据 - public void CheckSOCode() { - Map params = new HashMap(); - params.put("TransCode", transNo.getText().toString().trim()); - params.put("TransType", "销售退货-销售退货单"); - params.put("WorkPoint", LoginActivity.user.getWorkPointCode()); - try { - result = ""; - result = WebServiceUtil.GetWSReturnInfo("TransInformation/Get", params); - applicationModel=new Gson().fromJson(result,ApplicationModel.class); - IsFinish=true; - if (applicationModel.getSuccess()==true) { - handler.sendEmptyMessage(5); - } else { - ErrorMsg = applicationModel.getMessage(); - handler.sendEmptyMessage(6); - } - } catch (Exception ex) { - ErrorMsg = ex.getMessage(); - handler.sendEmptyMessage(7); - } - } private void JDT(){ barWithNumber = (HorizontalProgressBarWithNumber) findViewById(R.id.hpbwn); @@ -299,12 +258,7 @@ public class DispatchListReturnActivity extends AppCompatActivity { if (IsFinish==false){ try { Thread.sleep(50); - if (i<100){ - barWithNumber.setProgress(i); - }else { - Looper.prepare(); - dialog.dismiss(); - } + barWithNumber.setProgress(i); } catch (InterruptedException e) { e.printStackTrace(); } @@ -322,13 +276,6 @@ public class DispatchListReturnActivity extends AppCompatActivity { break; } } - - if (IsFinish==true){ - Looper.prepare(); - barWithNumber.setProgress(100); - dialog.dismiss(); - IsFinish=false; - } } private void showJDT() { @@ -339,85 +286,6 @@ public class DispatchListReturnActivity extends AppCompatActivity { dialog.setCanceledOnTouchOutside(false); } - private void QtyConfirmClick() { - for (String str : tempArr) { - if (barCode.getText().toString().trim().equals(str)) - return; - } - BigDecimal OutQTY = BigDecimal.ZERO; - BigDecimal CurrentQty = BigDecimal.ZERO; - BigDecimal SumPlanQty = BigDecimal.ZERO; -// LotQty=null==LotQty?0.00:LotQty; - if (outQty.getText().toString().trim().equals("")) { - HelpUtil.SetMsg(tvMsg, Color.RED, "请输入出库数量"); - return; - } - if (LotQty==null){ - HelpUtil.SetMsg(tvMsg, Color.RED, "请输入条码数量"); - return; - } - try { - if (rbIn.isChecked()) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {//&& a.getExtensionID().equals(ExtensionId) && a.getExtensionID().equals(ExtensionId) - SumPlanQty = BigDecimal.valueOf(dataList.stream().filter(a -> a.getInvCode().equals(InvCode)).collect(Collectors.toList()).stream().mapToDouble(Data::getQuantityy).sum()); - } - if (new BigDecimal(outQty.getText().toString().trim()).compareTo(LotQty) == 1) {//bug - Map params = new HashMap(); - params.put("code","PDA003"); - try { - result = ""; - result = WebServiceUtil.GetWSReturnInfo("PromptInformation/Get", params); - applicationModel=new Gson().fromJson(result,ApplicationModel.class); - String CnValue=applicationModel.getData().get(0).getName(); - ErrorMsg= String.format(CnValue,outQty.getText().toString(),LotQty.toString() ); -// ErrorMsg=Value; - handler.sendEmptyMessage(2); - - } catch (Exception ex) { - ErrorMsg = ex.getMessage(); - handler.sendEmptyMessage(99); - } - }else if (new BigDecimal(outQty.getText().toString().trim()).compareTo(SumPlanQty) == 1) {//bug - Map params = new HashMap(); - params.put("code","PDA001"); - try { - result = ""; - result = WebServiceUtil.GetWSReturnInfo("PromptInformation/Get", params); - applicationModel=new Gson().fromJson(result,ApplicationModel.class); - String CnValue=applicationModel.getData().get(0).getName(); - ErrorMsg= String.format(CnValue,outQty.getText().toString(),SumPlanQty.toString() ); -// ErrorMsg=Value; - handler.sendEmptyMessage(99); - - } catch (Exception ex) { - ErrorMsg = ex.getMessage(); - handler.sendEmptyMessage(99); - } - } - else { - BigDecimal PlanQTY = BigDecimal.ZERO; - BigDecimal CurrentQTY = BigDecimal.ZERO; - for (Data data : dataList) { - if (InvCode.equals(data.getInvCode())&& InvCode!="0"&& data.getInvCode()!="0") { - PlanQTY = PlanQTY.add(new BigDecimal(data.getQuantity())); - CurrentQTY = CurrentQTY.add(new BigDecimal(data.getCurrentQty())); - OutQTY = OutQTY.add(new BigDecimal(data.getIssueQuantity()));//已发数量 - } - } - SetMainTableQty(new BigDecimal("".equals(outQty.getText().toString().trim())?"0.00":outQty.getText().toString().trim()), InvCode, VenderLotNo, OrderNo,iNum); -// DetailSum(); - handler.sendEmptyMessage(8); - } - tableData = new TableData<>("销售发货", dataList, columns); - smartTable.setTableData(tableData); - } - - } catch (Exception ex) { - ErrorMsg = ex.getMessage(); - handler.sendEmptyMessage(99); - } - } - private void Del(){ if (tableData != null && selectRowIndex != 999 ) { @@ -442,8 +310,7 @@ public class DispatchListReturnActivity extends AppCompatActivity { selectRowLotNo = ""; selectRowIndex = 999; } else { - ErrorMsg = HelpUtil.Languange("PDA004"); - handler.sendEmptyMessage(3); + HelpUtil.SetMsg(tvMsg, Color.RED, "尚未扫入任何条码!"); } } @@ -478,7 +345,7 @@ public class DispatchListReturnActivity extends AppCompatActivity { //产品条码 private void CheckLotnoForSOReturnNew() { Map params=new HashMap(); - params.put("code", barCode.getText().toString().trim()); + params.put("code", barCode.getText().toString()); params.put("TransType", "销售退货-销售退货单"); params.put("WorkPoint", LoginActivity.user.getWorkPointCode()); @@ -492,8 +359,8 @@ public class DispatchListReturnActivity extends AppCompatActivity { if (applicationModel.getSuccess()==true){ if (rbIn.isChecked() && dataList.size()>0){ for (Data dispatchListReturnData:dataList){ - if (dispatchListReturnData.getLotNo().equals(barCode.getText().toString().trim())){ - ErrorMsg = HelpUtil.Languange("PDA012"); + if (dispatchListReturnData.getLotNo().equals(barCode.getText().toString())){ + ErrorMsg = "物料条码已扫描,请勿重复扫描!"; handler.sendEmptyMessage(3); return; } @@ -562,7 +429,7 @@ public class DispatchListReturnActivity extends AppCompatActivity { data.setcFree10(lot.getcFree10()); dataList.add(data); }else if (rbOut.isChecked()){ - ErrorMsg = HelpUtil.Languange("PDA008"); + ErrorMsg = "已移除!"; handler.sendEmptyMessage(3); } } @@ -621,6 +488,11 @@ public class DispatchListReturnActivity extends AppCompatActivity { } //确定按钮 private void DispatchIN() { + if (StackCode==""){ + ErrorMsg = "库位不存在,移除后重新扫描!"; + handler.sendEmptyMessage(99); + return; + } Map params = new HashMap(); List tempArr = new ArrayList(); @@ -640,7 +512,7 @@ public class DispatchListReturnActivity extends AppCompatActivity { tempDetailMap.put("Quantity",data.getQuantity()); tempArr.add(tempDetailMap); }else { - ErrorMsg = HelpUtil.Languange("PDA022"); + ErrorMsg = "提交数量不可为0,请确认后再提交"; handler.sendEmptyMessage(99); return; } @@ -656,7 +528,7 @@ public class DispatchListReturnActivity extends AppCompatActivity { applicationModel = new Gson().fromJson(result, ApplicationModel.class); IsFinish=true; if (applicationModel.getSuccess()==true) { - ErrorMsg = HelpUtil.Languange("PDA023"); + ErrorMsg = "退货成功!"; handler.sendEmptyMessage(2); } else { ErrorMsg = applicationModel.getMessage();