|
|
|
|
@ -1,14 +1,12 @@
|
|
|
|
|
package com.example.haiwei_mom.wms.raw;
|
|
|
|
|
|
|
|
|
|
import androidx.appcompat.app.AppCompatActivity;
|
|
|
|
|
import androidx.databinding.DataBindingUtil;
|
|
|
|
|
|
|
|
|
|
import android.content.Intent;
|
|
|
|
|
import android.os.Bundle;
|
|
|
|
|
import android.view.View;
|
|
|
|
|
import android.widget.EditText;
|
|
|
|
|
import android.widget.Toast;
|
|
|
|
|
|
|
|
|
|
import androidx.databinding.DataBindingUtil;
|
|
|
|
|
|
|
|
|
|
import com.example.haiwei_mom.R;
|
|
|
|
|
import com.example.haiwei_mom.base.BaseActivity;
|
|
|
|
|
import com.example.haiwei_mom.base.MyRecultCall;
|
|
|
|
|
@ -24,7 +22,8 @@ public class RawInActivity extends BaseActivity implements View.OnFocusChangeLis
|
|
|
|
|
private RawInstock rawInstock;
|
|
|
|
|
private ActivityRawInBinding binding;
|
|
|
|
|
private EditText editTextView;
|
|
|
|
|
private String title;
|
|
|
|
|
private String title;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
|
|
super.onCreate(savedInstanceState);
|
|
|
|
|
@ -35,7 +34,7 @@ private String title;
|
|
|
|
|
binding.materialInLocation.setOnFocusChangeListener(this);
|
|
|
|
|
binding.materialInGoods.setOnFocusChangeListener(this);
|
|
|
|
|
binding.materialInGoods.setOnEditorActionListener((v, actionId, event) -> {
|
|
|
|
|
selectGoods( binding.materialInGoods.getText().toString());
|
|
|
|
|
selectGoods(binding.materialInGoods.getText().toString());
|
|
|
|
|
return true;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
@ -54,23 +53,26 @@ private String title;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void selectGoods(String data){
|
|
|
|
|
private void selectGoods(String data) {
|
|
|
|
|
OkGo.<MyResult>post(url + "/wms/pda/raw/inSelectCode")
|
|
|
|
|
.params("code", data)
|
|
|
|
|
.params("type", title)
|
|
|
|
|
.execute(new MyRecultCall(dialog, this) {
|
|
|
|
|
@Override
|
|
|
|
|
public void onSuccess(Response<MyResult> response) {
|
|
|
|
|
super.onSuccess(response);
|
|
|
|
|
var body = response.body();
|
|
|
|
|
if (body.getCode() == 200) {
|
|
|
|
|
rawInstock = gson.fromJson(body.getDataJson(), RawInstock.class);
|
|
|
|
|
binding.setData(rawInstock);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
myToastUitls.show(body.getMsg());
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
@Override
|
|
|
|
|
public void onSuccess(Response<MyResult> response) {
|
|
|
|
|
super.onSuccess(response);
|
|
|
|
|
var body = response.body();
|
|
|
|
|
if (body.getCode() == 200) {
|
|
|
|
|
rawInstock = gson.fromJson(body.getDataJson(), RawInstock.class);
|
|
|
|
|
if (title.equals("质检入库")) {
|
|
|
|
|
rawInstock.setInstockQty(String.valueOf(rawInstock.getMaterialQty()));
|
|
|
|
|
}
|
|
|
|
|
binding.setData(rawInstock);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
myToastUitls.show(body.getMsg());
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@ -80,28 +82,71 @@ private String title;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void rawinSubmit(View view) {
|
|
|
|
|
if (rawInstock == null) {
|
|
|
|
|
// 入库
|
|
|
|
|
public void rawinSubmit1(View view) {
|
|
|
|
|
if (!inCheck()) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
// 必检
|
|
|
|
|
if (rawInstock.getInspectionRequest().equals("0")) {
|
|
|
|
|
// 必检有结果
|
|
|
|
|
if (rawInstock.getInspectionType().equals("0") || rawInstock.getInspectionType().equals("1")) {
|
|
|
|
|
Toast.makeText(context, "检验完成前不能入库", Toast.LENGTH_SHORT).show();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
rawinSubmit();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 质检
|
|
|
|
|
public void rawinSubmit2(View view) {
|
|
|
|
|
if (!inCheck()) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String inspectionType = rawInstock.getInspectionType();
|
|
|
|
|
|
|
|
|
|
if (!inspectionType.equals("0")) {
|
|
|
|
|
Toast.makeText(context, "必检物料先放入待检区,检验完成后正常入库", Toast.LENGTH_SHORT).show();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
rawinSubmit();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 提交验证
|
|
|
|
|
private boolean inCheck() {
|
|
|
|
|
if (rawInstock == null) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var instockQty = rawInstock.getInstockQty();
|
|
|
|
|
if (instockQty == null || instockQty.isEmpty()) return;
|
|
|
|
|
if (instockQty == null || instockQty.isEmpty()) return false;
|
|
|
|
|
|
|
|
|
|
var parseDouble = Double.parseDouble(instockQty);
|
|
|
|
|
if (parseDouble > rawInstock.getMaterialQty()) {
|
|
|
|
|
myToastUitls.show("输入数量不能超过条码数量");
|
|
|
|
|
return;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void rawinSubmit() {
|
|
|
|
|
|
|
|
|
|
rawInstock.setTitle(title);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
OkGo.<MyResult>post(url + "/wms/pda/raw/inSubmit").upRequestBody(RequestBody.create(JSON, gson.toJson(rawInstock))).execute(new MyRecultCall(dialog, this) {
|
|
|
|
|
@Override
|
|
|
|
|
public void onSuccess(Response<MyResult> response) {
|
|
|
|
|
super.onSuccess(response);
|
|
|
|
|
var body = response.body();
|
|
|
|
|
if (body.getCode() == 200) {
|
|
|
|
|
rawInstock.setInstockQty(null);
|
|
|
|
|
rawInstock.setLocationCode(null);
|
|
|
|
|
rawInstock.setMaterialQty(rawInstock.getMaterialQty() - parseDouble);
|
|
|
|
|
rawInstock.setMaterialQty(rawInstock.getMaterialQty() - Double.parseDouble(rawInstock.getInstockQty()));
|
|
|
|
|
rawInstock.setInstockQty(null);
|
|
|
|
|
// finish();
|
|
|
|
|
Toast.makeText(RawInActivity.this, "入库成功", Toast.LENGTH_SHORT).show();
|
|
|
|
|
return;
|
|
|
|
|
|