diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 36216c2..31bca52 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -57,6 +57,7 @@
+
diff --git a/app/src/main/java/com/icssoft/icspda/activity/INVTrans1Activity.java b/app/src/main/java/com/icssoft/icspda/activity/INVTrans1Activity.java
new file mode 100644
index 0000000..acf736f
--- /dev/null
+++ b/app/src/main/java/com/icssoft/icspda/activity/INVTrans1Activity.java
@@ -0,0 +1,773 @@
+package com.icssoft.icspda.activity;
+
+import android.graphics.Color;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Looper;
+import android.os.Message;
+import android.os.SystemClock;
+import android.text.TextUtils;
+import android.util.Log;
+import android.view.KeyEvent;
+import android.view.View;
+import android.view.inputmethod.EditorInfo;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.RadioButton;
+import android.widget.TextView;
+
+import androidx.appcompat.app.AppCompatActivity;
+
+import com.bin.david.form.core.SmartTable;
+import com.bin.david.form.data.column.Column;
+import com.bin.david.form.data.table.TableData;
+import com.google.gson.Gson;
+import com.google.gson.JsonSyntaxException;
+import com.icssoft.icspda.R;
+import com.icssoft.icspda.entity.ApplicationModel;
+import com.icssoft.icspda.entity.CfreeApplicationModel;
+import com.icssoft.icspda.entity.CfreeData;
+import com.icssoft.icspda.entity.Data;
+import com.icssoft.icspda.entity.Detail;
+import com.icssoft.icspda.net.WebServiceUtil;
+import com.icssoft.icspda.util.BaseDialog;
+import com.icssoft.icspda.util.HelpUtil;
+import com.icssoft.icspda.util.HorizontalProgressBarWithNumber;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class INVTrans1Activity extends AppCompatActivity {
+ //region 变量初始化
+ private TextView tvMsg;
+ private String result;
+ private ApplicationModel applicationModel;
+ private List lotDatas;
+ private List dataList;
+ private List dataDetailList;
+ private SmartTable smartTable;
+ private SmartTable smartDetailTable;
+ private EditText transferNo;
+ private EditText toBin;
+ private EditText barCode;
+ private Button btnDel;
+ private Button btnOk;
+ private RadioButton rbIn;
+ private RadioButton rbOut;
+ private int selectRowIndex = 999;
+ private String selectRowInvCode = "";
+ private TableData tableData;
+ private List columns;
+ private String ErrorMsg = "";
+ private BigDecimal LotQty;
+ private String InvCode;
+ // private String WhCode;
+ private String ToWhCode;
+ private BigDecimal NeedQty;
+ private long[] mHits = new long[2];//存储时间的数组
+ private final String WorkPoint = LoginActivity.user.getWorkPointCode();
+ private Data whData;
+ private HorizontalProgressBarWithNumber barWithNumber;
+ private BaseDialog dialog;
+ private Boolean IsFinish=false;
+ private CfreeApplicationModel cfreeApplicationModel;
+ private List cfreeDataList;
+
+ //endregion
+
+ private Handler handler = new Handler() {
+ @Override
+ public void handleMessage(Message msg) {
+ super.handleMessage(msg);
+ switch (msg.what) {
+ case 0:
+// if (dataList!=null) {
+// dataList.clear();
+// }
+// dataDetailList.clear();
+ gridBarCode();
+ toBin.requestFocus();
+ HelpUtil.SetMsg(tvMsg, Color.BLUE, "源头单据扫描成功!");
+ break;
+ case 1:
+ transferNo.requestFocus();
+ HelpUtil.SetMsg(tvMsg, Color.RED, ErrorMsg);
+ break;
+ case 2:
+ toBin.requestFocus();
+ HelpUtil.SetMsg(tvMsg, Color.RED, ErrorMsg);
+ break;
+ case 3:
+ barCode.requestFocus();
+ HelpUtil.SetMsg(tvMsg, Color.RED, ErrorMsg);
+ break;
+ case 5:
+ barCode.requestFocus();
+ HelpUtil.SetMsg(tvMsg, Color.BLUE, "调拨数量记录成功!");
+ break;
+ case 6:
+ clear();
+ HelpUtil.SetMsg(tvMsg, Color.BLUE, ErrorMsg);
+ break;
+ case 7:
+ barCode.requestFocus();
+ HelpUtil.SetMsg(tvMsg, Color.BLUE, "库位条码扫描成功!");
+ break;
+ case 99:
+ HelpUtil.SetMsg(tvMsg, Color.RED, ErrorMsg);
+ break;
+ }
+ }
+ };
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_invtrans1);
+ bindView();
+ }
+
+ private void bindView() {
+ this.setTitle("物料调拨无源头单据");
+ tvMsg = findViewById(R.id.tv_msg);
+ smartTable = findViewById(R.id.table);
+ toBin = findViewById(R.id.et_toBin);
+ barCode = findViewById(R.id.et_barCode);
+ btnDel = findViewById(R.id.btn_del);
+ btnOk = findViewById(R.id.btn_ok);
+ rbIn = findViewById(R.id.rbIn);
+ rbOut = findViewById(R.id.rbOut);
+ HelpUtil.disableShowSoftInput(toBin);
+ HelpUtil.disableShowSoftInput(barCode);
+ dataList = new ArrayList<>();
+ dataDetailList = new ArrayList<>();
+ whData = new Data();
+ cfreeDataList = new ArrayList<>();
+
+ //目标库位
+ toBin.setOnEditorActionListener(new TextView.OnEditorActionListener() {
+ @Override
+ public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
+ try {
+ 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) {
+ new Thread(new Runnable() {
+ @Override
+ public void run() {
+ CheckStackCode();
+ }
+ }).start();
+
+ new Thread(new Runnable() {
+ @Override
+ public void run() {
+ JDT();
+ }
+ }).start();
+ }
+ }
+ return false;
+ } catch (Exception ex) {
+ ErrorMsg = ex.getMessage();
+ handler.sendEmptyMessage(99);
+ } return false;
+ }
+ });
+ //物料条码
+ barCode.setOnEditorActionListener(new TextView.OnEditorActionListener() {
+ @Override
+ public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
+ try {
+ 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) {
+ new Thread(new Runnable() {
+ @Override
+ public void run() {
+ if (TextUtils.isEmpty(toBin.getText().toString().trim())) {
+ ErrorMsg = "请先扫描目标库位!";
+ handler.sendEmptyMessage(2);
+ return;
+ }
+ if (rbIn.isChecked()) {
+ for (Detail itemLotDetailData : dataDetailList) {
+ if (itemLotDetailData.getInvCode().equals(barCode.getText())) {
+ ErrorMsg = "请勿扫描重复条码!";
+ handler.sendEmptyMessage(3);
+ return;
+ }
+ }
+ }
+ new Thread(new Runnable() {
+ @Override
+ public void run() {
+ CheckLotNoForTrans();
+ }
+ }).start();
+
+ new Thread(new Runnable() {
+ @Override
+ public void run() {
+ JDT();
+ }
+ }).start();
+ }
+ }).start();
+ }
+ }
+ return false;
+ } catch (Exception ex) {
+ ErrorMsg = ex.getMessage();
+ handler.sendEmptyMessage(99);
+ } return false;
+ }
+ });
+ //子表清空,主表数量清零
+ btnDel.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ try {
+ if (tableData != null && selectRowIndex != 999 && !TextUtils.isEmpty(selectRowInvCode)) {
+ //dataList正常显示,本次数量清0
+ for (Data invTransData : dataList) {
+ invTransData.setCurrentQty("0.00");
+ }
+ dataDetailList.clear();
+ /*for (PdaListData invTransData : dataList) {
+ if (invTransData.getINVCode().equals(selectRowInvCode))
+ dataList.remove(invTransData);
+ }
+ for (PdaListDetailData itemLotDetailData : dataDetailList) {
+ if (itemLotDetailData.getINVCode().equals(selectRowInvCode)) {
+ dataDetailList.remove(itemLotDetailData);
+ }
+ }*/
+ tableData = new TableData<>("物料调拨", dataList, columns);
+ smartTable.setTableData(tableData);
+ HelpUtil.SetMsg(tvMsg, Color.BLUE, "条码信息移除成功!");
+ selectRowInvCode = "";
+ selectRowIndex = 999;
+ } else {
+ HelpUtil.SetMsg(tvMsg, Color.RED, "尚未扫入任何条码!");
+ }
+ } catch (Exception ex) {
+ HelpUtil.SetMsg(tvMsg, Color.RED, ex.getMessage());
+ }
+ }
+ });
+ //提交按钮
+ 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() {
+ WareHouseTrans();
+ }
+ }).start();
+
+ new Thread(new Runnable() {
+ @Override
+ public void run() {
+ JDT();
+ }
+ }).start();
+
+
+ }
+ });
+ }
+
+ private void JDT(){
+ barWithNumber = (HorizontalProgressBarWithNumber) findViewById(R.id.hpbwn);
+ System.out.println(IsFinish);
+ new Thread(new Runnable() {
+ @Override
+ public void run() {
+ Looper.prepare();
+ showJDT();
+ Looper.loop();
+ Looper.getMainLooper().quit();
+ }
+ }).start();
+ for (int i = 0; i <= 100; i++) {
+ if (IsFinish == false){
+ try {
+ Thread.sleep(50);
+ barWithNumber.setProgress(i);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }else {
+ new Thread(new Runnable() {
+ @Override
+ public void run() {
+ Looper.prepare();
+ barWithNumber.setProgress(100);
+ dialog.dismiss();
+ IsFinish=false;
+
+ }
+ }).start();
+ break;
+ }
+ }
+ }
+
+ private void showJDT() {
+ View tableView = View.inflate(this, R.layout.jindutiao, null);
+ barWithNumber=tableView.findViewById(R.id.hpbwn);
+ dialog = new BaseDialog.Builder(this).setFillWidth(true).setContentView(tableView).create();
+ dialog.show();
+ dialog.setCanceledOnTouchOutside(false);
+ }
+
+
+
+ private void gridBarCode() {
+ try {
+// dataList = new Gson().fromJson(result, new TypeToken>() {
+// }.getType());
+
+// WhCode = dataList.get(dataList.size() - 1).getFromWHCode();//源仓库
+ ToWhCode = dataList.get(dataList.size() - 1).getWHCode();//目标仓库
+
+ HelpUtil.InitSmartTable(smartTable, this.getApplicationContext());
+
+ //region 声明列
+ columns = new ArrayList<>();
+ columns.add(new Column("行号", "TransSequence"));
+// columns.add(new Column("源仓库", "FromWHCode"));
+ columns.add(new Column("目标仓库", "ToWarehouseCode"));
+ columns.add(new Column("物料编码", "InvCode"));
+ columns.add(new Column("物料名称", "InvName"));
+ columns.add(new Column("规格型号", "InvStd"));
+ columns.add(new Column("计划数量", "Quantity"));
+// columns.add(new Column("已发数量", "IssueQuantity"));
+ columns.add(new Column("本次数量", "CurrentQty"));
+ columns.add(new Column("单位", "InvUnit"));
+// List filter= LoginActivity.ICSExtList.stream().filter(s -> s.getEnable()
+// .equals("1")).collect(Collectors.toList());
+// filter.stream().forEach(s->{
+// if (s.getColCode().equals("BatchCode"))
+// columns.add(new Column("批次", "Batch"));
+// else if (s.getColCode().equals("ProjectCode"))
+// columns.add(new Column("项目号", "ORDERNO"));
+// else
+// columns.add(new Column( s.getColName(),s.getColCode()));
+// });
+ /******************************************自由项动态显示*******************************************/
+ try {
+ if (LoginActivity.CfreeFlag){
+ cfreeApplicationModel = new Gson().fromJson(LoginActivity.CfreeString, CfreeApplicationModel.class);
+ cfreeDataList = cfreeApplicationModel.getData();
+ for (CfreeData cfreeData : cfreeDataList) {
+ columns.add(new Column(cfreeData.getColName(),cfreeData.getColCode()));
+ }
+ }
+ } catch (JsonSyntaxException e) {
+ e.printStackTrace();
+ ErrorMsg = e.getMessage();
+ handler.sendEmptyMessage(99);
+ }
+ /************************************************************************************************/
+ //endregion
+
+ tableData = new TableData<>("物料调拨", dataList, columns);
+
+ tableData.setOnRowClickListener(new TableData.OnRowClickListener() {
+ @Override
+ public void onClick(Column column, Data data, int col, int row) {
+ System.arraycopy(mHits, 1, mHits, 0, mHits.length - 1);
+ mHits[mHits.length - 1] = SystemClock.uptimeMillis();
+ if (mHits[0] >= (SystemClock.uptimeMillis() - 500)) {
+ showSMTableDialog(data.getInvCode(), data.getTransSequence());
+ } else {
+ HelpUtil.ChangeRowBackgroundColor(smartTable, row);
+ smartTable.invalidate();
+ selectRowIndex = row;
+ selectRowInvCode = data.getInvCode();
+ HelpUtil.SetMsg(tvMsg, Color.RED, "当前选中第" + (selectRowIndex + 1) + "行,物料编码为:" + data.getInvCode());
+ }
+ }
+
+ });
+ smartTable.setTableData(tableData);
+ } catch (Exception ex) {
+ ErrorMsg = ex.getMessage();
+ handler.sendEmptyMessage(99);
+ }
+ }
+ //目标库位
+ private void CheckStackCode() {
+ Map params = new HashMap();
+ params.put("LocationCode",toBin.getText().toString().trim());
+// params.put("StackCode", toBin.getText().toString());
+ params.put("WorkPoint", WorkPoint);
+ try {
+ result = "";
+ result = WebServiceUtil.GetWSReturnInfo("Location/Get", params);
+ Log.e("判断目标库位是否存在", "CheckStackCode: "+result );
+ if (result != null && result.length() != 0) {
+ applicationModel = new Gson().fromJson(result, ApplicationModel.class);
+ IsFinish=true;
+ if (applicationModel.getSuccess()){
+ whData = applicationModel.getData().get(0);
+ handler.sendEmptyMessage(7);
+ }else {
+ ErrorMsg = applicationModel.getMessage();
+ handler.sendEmptyMessage(2);
+ }
+
+// if (applicationModel.getCode().equals("0")) {
+// if (!applicationModel.getData().equals(ToWhCode)) {
+// ErrorMsg = "目标库位与源头单据不符,请确认后重新扫描!";
+// handler.sendEmptyMessage(2);
+// } else {
+// handler.sendEmptyMessage(7);
+// }
+// } else {
+// ErrorMsg = "库位条码不存在!";
+// handler.sendEmptyMessage(2);
+// }
+ }
+ } catch (Exception ex) {
+ ErrorMsg = ex.getMessage();
+ handler.sendEmptyMessage(99);
+ }
+ }
+
+ private void showSMTableDialog(String InvCode, String TransferLine) {
+ List dData = new ArrayList<>();
+ for (Detail itemLotDetailData : dataDetailList) {
+ if (itemLotDetailData.getTransSequence().equals(TransferLine)
+ && itemLotDetailData.getInvCode().equals(InvCode)) {
+ dData.add(itemLotDetailData);
+ }
+ }
+ View tableView = View.inflate(this, R.layout.detialinfo, null);
+ smartDetailTable = tableView.findViewById(R.id.detailTable);
+ smartDetailTable.getConfig().setShowTableTitle(false);
+ smartDetailTable.getConfig().setShowXSequence(false);
+ smartDetailTable.getConfig().setShowYSequence(false);
+ smartDetailTable.getConfig().setFixedTitle(true);
+ smartDetailTable.setData(dData);
+ BaseDialog dialog = new BaseDialog.Builder(this).setFillWidth(true).setContentView(tableView).create();
+ dialog.show();
+ }
+
+ /**
+ * 获取条码信息
+ */
+ private void CheckLotNoForTrans() {
+ Map params = new HashMap();
+ // params.put("TransCode", transferNo.getText().toString().trim());
+ params.put("Code", barCode.getText().toString().trim());
+ params.put("TransType", "一步调拨");
+ params.put("WorkPoint",WorkPoint);
+ try {
+ result = "";
+ result = WebServiceUtil.GetWSReturnInfo("BarCodeInformation/Get", params);//InvOut的方法
+ Log.e("物料条码", "CheckLotNoForTrans: "+result );
+ if (result != null && result.length() != 0){
+ applicationModel = new Gson().fromJson(result,ApplicationModel.class);
+ IsFinish=true;
+ }
+ if (!applicationModel.getSuccess()) {
+ ErrorMsg = applicationModel.getMessage();
+ handler.sendEmptyMessage(3);
+ return;
+ } else {
+ GetLotData();
+ }
+ } catch (Exception ex) {
+ ErrorMsg = ex.getMessage();
+ handler.sendEmptyMessage(99);
+ }
+ }
+
+ private void GetLotData() {
+ boolean ifExist = false;
+ BigDecimal planQty = BigDecimal.ZERO;
+ BigDecimal currentQty = BigDecimal.ZERO;
+ BigDecimal sendQty = BigDecimal.ZERO;
+ try {
+// lotDetails = new Gson().fromJson(result, new TypeToken>() {
+// }.getType());
+ lotDatas = applicationModel.getData();
+ if (rbIn.isChecked()) {
+ for (Data lotData : lotDatas) {
+ lotData.setQuantity(HelpUtil.getAssignedFigures(lotData.getQuantity(),LoginActivity.DEFAULT_DECIMAL_FIGURE));
+ lotData.setIssueQuantity(HelpUtil.getAssignedFigures(lotData.getIssueQuantity(),LoginActivity.DEFAULT_DECIMAL_FIGURE));
+ lotData.setCurrentQty(HelpUtil.getAssignedFigures(lotData.getCurrentQty(),LoginActivity.DEFAULT_DECIMAL_FIGURE));
+ for (int i = 0; i < dataList.size(); i++) {
+ Data invTransData = dataList.get(i);
+ if (invTransData.getWHCode().equals(lotData.getWHCode())//源头仓库
+ && invTransData.getInvCode().equals(lotData.getInvCode())//物料编码
+// && invTransData.getProjectCode().equals(lotData.getProjectCode())//项目号
+// && invTransData.getBatchCode().equals(lotData.getBatchCode())//批次
+ ) {
+ planQty = planQty.add(new BigDecimal(invTransData.getQuantity()));//计划数量
+// currentQty += Double.parseDouble(invTransData.getCurrentQty());//本次数量
+// sendQty += Double.parseDouble(invTransData.getHasQuantity());//已发数量
+ ifExist = true;
+ selectRowIndex = i;
+ HelpUtil.ChangeRowBackgroundColor(smartTable, selectRowIndex);
+ break;
+ }
+ }
+
+ if (ifExist) {
+ LotQty = new BigDecimal(lotData.getQuantity());
+// InvCode = lotData.getInvCode() + lotData.getWHCode() +lotData.getProjectCode()+ lotData.getBatchCode();//物料编码,源头仓库,项目号,批次
+ InvCode = lotData.getInvCode();
+ if (planQty.compareTo(currentQty.add(sendQty).add(LotQty)) == -1) {
+ NeedQty = planQty.subtract(currentQty).subtract(sendQty);
+ if (NeedQty.compareTo(BigDecimal.ZERO) != 1) {
+ ErrorMsg = "此行物料已调拨完成,请确认后重新扫描";
+ handler.sendEmptyMessage(3);
+ return;
+ }
+ } else {
+ NeedQty = LotQty;
+ }
+// for (Detail itemLotDetailData : dataDetailList) {
+// if (itemLotDetailData.getLotNo().toUpperCase().equals(lotData.getLotNo().toUpperCase())) {
+// ErrorMsg = "请勿扫描重复条码!";
+// handler.sendEmptyMessage(3);
+// return;
+// }
+// }
+ } else {
+ ErrorMsg = "条码对应的物料/仓库/项目号/批次与源头单据不符!";
+ handler.sendEmptyMessage(3);
+ return;
+ }
+ SetMainTableQty();
+ DetailSum();
+ }
+ tableData = new TableData<>("物料调拨", dataList, columns);
+ smartTable.setTableData(tableData);
+ handler.sendEmptyMessage(5);
+ } else if (rbOut.isChecked()) {
+ if (dataDetailList != null && dataDetailList.size() > 0 && !dataDetailList.get(0).getTransSequence().equals("0")) {
+ for (int i = dataDetailList.size() - 1; i >= 0; i--) {
+ Detail rows = dataDetailList.get(i);
+ if (rows.getLotNo().toUpperCase().equals(barCode.getText().toString().toUpperCase())) {
+ for (Data invTransData : dataList) {
+ if (rows.getInvCode().equals(invTransData.getInvCode()) && new BigDecimal(invTransData.getCurrentQty()).compareTo(BigDecimal.ZERO) == 1//产品编码,本次数量
+ && rows.getTransSequence().equals(invTransData.getTransSequence())) {//序号
+ invTransData.setCurrentQty(new BigDecimal(invTransData.getCurrentQty()).subtract(new BigDecimal(rows.getCurrentQty())) + "");
+ dataDetailList.remove(rows);
+ break;
+ }
+ }
+ }
+ }
+ }
+ tableData = new TableData<>("物料调拨", dataList, columns);
+ smartTable.setTableData(tableData);
+ ErrorMsg = "已移除!";
+ handler.sendEmptyMessage(3);
+ }
+ } catch (Exception ex) {
+ ErrorMsg = ex.getMessage();
+ handler.sendEmptyMessage(99);
+ }
+ }
+ //给主表的本次数量赋值CurrentQTY
+ private void SetMainTableQty() {
+ try {
+ for (int j = 0; j < dataList.size(); j++) {
+ Data row = dataList.get(j);
+ String ItemCode = row.getInvCode();
+// String ItemCode = row.getInvCode()+row.getFromWHCode()+row.getProjectCode()+row.getBatchCode();//物料编码,源头仓库,项目号,批次
+ BigDecimal PlanQTY = new BigDecimal(row.getQuantity());
+ BigDecimal SendQTY = new BigDecimal(row.getIssueQuantity());
+ BigDecimal CurrentQTY = new BigDecimal(row.getCurrentQty());
+ BigDecimal PlQty = PlanQTY.subtract(SendQTY).subtract(CurrentQTY);
+
+ if (PlQty.compareTo(BigDecimal.ZERO) == 0){
+ continue;
+ }
+
+ if (ItemCode.equals(InvCode)) {
+ if (LotQty.compareTo(PlanQTY.subtract(SendQTY).subtract(CurrentQTY)) == 1 && (PlanQTY.subtract(SendQTY).subtract(CurrentQTY)).compareTo(BigDecimal.ZERO) != 0 && LotQty.compareTo(BigDecimal.ZERO) != 0) {
+ LotQty = LotQty.subtract(PlanQTY.subtract(SendQTY).subtract(CurrentQTY));
+ row.setCurrentQty(CurrentQTY.add(PlanQTY.subtract(SendQTY).subtract(CurrentQTY)) + "");
+ Detail itemLotDetailData = new Detail();
+ itemLotDetailData.setLotNo(barCode.getText().toString().trim());
+ itemLotDetailData.setTransSequence(row.getTransSequence());
+ itemLotDetailData.setInvCode(row.getInvCode());
+ itemLotDetailData.setInvName(row.getInvName());
+ itemLotDetailData.setQuantity(LotQty.toString());//条码数量
+ itemLotDetailData.setCurrentQty(PlanQTY.subtract(SendQTY).subtract(CurrentQTY) + "");
+// itemLotDetailData.setBinCode(toBin.getText().toString().trim());
+ itemLotDetailData.setProjectCode(row.getProjectCode());
+ itemLotDetailData.setBatchCode(row.getBatchCode());
+ dataDetailList.add(itemLotDetailData);
+ } else if (LotQty.compareTo(PlanQTY.subtract(SendQTY)) != 1 && LotQty.compareTo(BigDecimal.ZERO) != 0 && PlanQTY.subtract(SendQTY).subtract(CurrentQTY).compareTo(BigDecimal.ZERO) != 0) {
+ row.setCurrentQty(CurrentQTY.add(LotQty) + "");
+ Detail itemLotDetailData = new Detail();
+ itemLotDetailData.setLotNo(barCode.getText().toString().trim());
+ itemLotDetailData.setTransSequence(row.getTransSequence());
+ itemLotDetailData.setInvCode(row.getInvCode());
+ itemLotDetailData.setInvName(row.getInvName());
+ itemLotDetailData.setQuantity(LotQty.toString());
+ itemLotDetailData.setCurrentQty(LotQty + "");
+// itemLotDetailData.setBinCode(toBin.getText().toString().trim());//目标库位
+ itemLotDetailData.setProjectCode(row.getProjectCode());
+ itemLotDetailData.setBatchCode(row.getBatchCode());
+ dataDetailList.add(itemLotDetailData);
+ LotQty = BigDecimal.ZERO;
+ }
+ }
+ }
+ } catch (Exception ex) {
+ ErrorMsg = ex.getMessage();
+ handler.sendEmptyMessage(99);
+ }
+ }
+ //合并子表
+ private void DetailSum() {
+ try {
+ List newDataDetailList = new ArrayList<>();
+ for (Detail row : dataDetailList) {
+ if (newDataDetailList != null) {
+ if (newDataDetailList.size() > 0) {
+ for (Detail item : newDataDetailList) {
+ if (item.getLotNo().toUpperCase().equals(row.getLotNo().toUpperCase())
+ && item.getTransSequence().equals(row.getTransSequence())) {
+ item.setCurrentQty(new BigDecimal(item.getCurrentQty()).add(new BigDecimal(row.getCurrentQty())) + "");
+ } else {
+ newDataDetailList.add(row);
+ }
+ }
+ } else {
+ newDataDetailList.add(row);
+ }
+ }
+ }
+ dataDetailList = newDataDetailList;
+ }catch (Exception ex) {
+ ErrorMsg = ex.getMessage();
+ handler.sendEmptyMessage(99);
+ }
+ }
+
+ private void WareHouseTrans() {
+
+ String MUSER = LoginActivity.user.getUserCode();
+ String MTIME = HelpUtil.GetFormatDate();
+// Double PlanQty = 0.0;
+// Double HasQty = 0.0;
+// for (Data invTransData : dataList) {
+// PlanQty += Double.parseDouble(invTransData.getQuantity());
+// HasQty += Double.parseDouble(invTransData.getHasQuantity()) + Double.parseDouble(invTransData.getCurrentQty());
+// }
+ //测试关掉,使用时请还原
+// if (PlanQty > HasQty) {
+// ErrorMsg = "该单据尚有条码未扫入,请补全后再提交!";
+// handler.sendEmptyMessage(3);
+// return;
+// }
+
+ List tempArrP = new ArrayList();
+ for (Data data : dataList){
+ Map params = new HashMap();
+ BigDecimal currQtyy = new BigDecimal(data.getCurrentQty());
+ if (currQtyy.compareTo(BigDecimal.ZERO) != 1){
+ continue;
+ }
+ //params.put("TransCode", transferNo.getText().toString().trim());
+ params.put("TransSequence", data.getTransSequence());
+ params.put("User", MUSER);
+ params.put("Mtime", MTIME);
+ params.put("WorkPoint",WorkPoint);
+ params.put("TransType","1");//类型(一步调拨为1,两步调拨为2)
+
+ List tempArr = new ArrayList();
+ for (Detail detail : dataDetailList) {
+ Map tempDetailMap = new HashMap();
+ BigDecimal currQty = new BigDecimal(detail.getCurrentQty());
+ if (currQty.compareTo(BigDecimal.ZERO) > 0) {
+ tempDetailMap.put("LotNo", detail.getLotNo());
+ tempDetailMap.put("CurrentQuantity", detail.getCurrentQty());
+ tempDetailMap.put("LocationCode",whData.getLocationCode());
+ tempDetailMap.put("WarehouseCode",whData.getWarehouseCode());
+ tempDetailMap.put("Quantity",data.getQuantity());
+ tempDetailMap.put("Amount",data.getAmount());
+ if (data.getTransSequence().equals(detail.getTransSequence())) {
+ tempArr.add(tempDetailMap);
+ }
+ } else {
+ ErrorMsg = "提交数量不可为0,请确认后再提交";
+ handler.sendEmptyMessage(99);
+ return;
+ }
+ }
+ params.put("Detail",tempArr);
+ tempArrP.add(params);
+ }
+
+ try {
+ result = "";
+ result = WebServiceUtil.GetWSReturnInfoNew("TransferDoc/Update", tempArrP);
+ if (result != null && result.length() != 0) {
+ applicationModel = new Gson().fromJson(result, ApplicationModel.class);
+ IsFinish=true;
+ boolean flag = applicationModel.getSuccess();
+ if (flag) {
+ ErrorMsg = "调拨成功!";
+ handler.sendEmptyMessage(6);
+ } else {
+ ErrorMsg = applicationModel.getMessage();
+ handler.sendEmptyMessage(3);
+ }
+ }
+ } catch (Exception ex) {
+ ErrorMsg = ex.getMessage();
+ handler.sendEmptyMessage(99);
+ }
+ }
+
+ private void clear() {
+ try {
+ // transferNo.setText("");
+ toBin.setText("");
+ barCode.setText("");
+ //transferNo.requestFocus();
+ dataList.clear();
+ dataDetailList.clear();
+ /*ItemLotData itemLotData = new ItemLotData();
+ itemLotData.setVouchRow("");
+ itemLotData.setFromWHCode("");
+ itemLotData.setToWHCode("");
+ itemLotData.setINVCode("");
+ itemLotData.setINVName("");
+ itemLotData.setInvStd("");
+ itemLotData.setCurrentQty("");
+ itemLotData.setQuantity("");
+ itemLotData.setHasQty("");
+ itemLotData.setCurrentQty("");
+ itemLotData.setInvUom("");
+ itemLotData.setORDERNO("");
+ itemLotData.setBatch("");
+ dataList.add(itemLotData);*/
+ tableData = new TableData<>("物料调拨", dataList, columns);
+ smartTable.setTableData(tableData);
+ } catch (Exception ex) {
+ ErrorMsg = ex.getMessage();
+ handler.sendEmptyMessage(99);
+ }
+ }
+}
diff --git a/app/src/main/res/layout/activity_invtrans1.xml b/app/src/main/res/layout/activity_invtrans1.xml
new file mode 100644
index 0000000..904d691
--- /dev/null
+++ b/app/src/main/res/layout/activity_invtrans1.xml
@@ -0,0 +1,209 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index eca2820..c134521 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -39,6 +39,7 @@
两步调入
移库扫描
物料调拨
+ 物料调拨无源头单据
盘点扫描
移箱扫描
条码分批