diff --git a/app/src/main/java/com/example/haiwei_mom/data/RawInstock.java b/app/src/main/java/com/example/haiwei_mom/data/RawInstock.java new file mode 100644 index 0000000..953cc1c --- /dev/null +++ b/app/src/main/java/com/example/haiwei_mom/data/RawInstock.java @@ -0,0 +1,132 @@ +package com.example.haiwei_mom.data; + + +import androidx.databinding.BaseObservable; + +/** + * 入库单-物料打印条码视图对象 wms_instock_print + * + * @author LionLi + * @date 2025-01-07 + */ + +public class RawInstock extends BaseObservable { + + + + /** + * 入库单子表主键 + */ + + private Long instockPrintId; + + /** + * 入库单号 + */ + + private String instockCode; + + /** + * 批次码 + */ + + private String batchCode; + + /** + * 条码数量 + */ + + private double materialQty; + + /** + * 分包数量 + */ + + private Long apportionQty; + + /** + * 物料id + */ + + private Long materialId; + + /** + * 物料编码 + */ + + private String materialCode; + + /** + * 物料名称 + */ + + private String materialName; + + /** + * 物料规格 + */ + + private String materialSpe; + + /** + * 计量单位名称 + */ + + private String unitName; + + public double getMaterialQty() { + return materialQty; + } + + + + /** + * 物料大类 + */ + + private String materialCategories; + + public String getInstockCode() { + return instockCode; + } + + public Long getMaterialId() { + return materialId; + } + + public String getMaterialCode() { + return materialCode; + } + + public String getMaterialName() { + return materialName; + } + + public String getMaterialSpe() { + return materialSpe; + } + + public String getUnitName() { + return unitName; + } + private String locationCode; + private String instockQty; + + public String getLocationCode() { + return locationCode; + } + + public void setLocationCode(String locationCode) { + this.locationCode = locationCode; + notifyChange(); + } + + public String getInstockQty() { + return instockQty; + } + + public void setInstockQty(String instockQty) { + this.instockQty = instockQty; + notifyChange(); + } +} diff --git a/app/src/main/java/com/example/haiwei_mom/wms/raw/RawInActivity.java b/app/src/main/java/com/example/haiwei_mom/wms/raw/RawInActivity.java index 20cb555..4976cb3 100644 --- a/app/src/main/java/com/example/haiwei_mom/wms/raw/RawInActivity.java +++ b/app/src/main/java/com/example/haiwei_mom/wms/raw/RawInActivity.java @@ -1,16 +1,84 @@ package com.example.haiwei_mom.wms.raw; import androidx.appcompat.app.AppCompatActivity; +import androidx.databinding.DataBindingUtil; import android.os.Bundle; +import android.view.View; +import android.widget.EditText; import com.example.haiwei_mom.R; +import com.example.haiwei_mom.base.BaseActivity; +import com.example.haiwei_mom.base.MyRecultCall; +import com.example.haiwei_mom.base.MyResult; +import com.example.haiwei_mom.data.RawInstock; +import com.example.haiwei_mom.databinding.ActivityRawInBinding; +import com.lzy.okgo.OkGo; +import com.lzy.okgo.model.Response; -public class RawInActivity extends AppCompatActivity { +import okhttp3.RequestBody; + +public class RawInActivity extends BaseActivity implements View.OnFocusChangeListener { + private RawInstock rawInstock; + private ActivityRawInBinding binding; + private EditText editTextView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.activity_raw_in); + binding = DataBindingUtil.setContentView(this, R.layout.activity_raw_in); + binding.materialInLocation.setOnFocusChangeListener(this); + binding.materialInGoods.setOnFocusChangeListener(this); + } + + @Override + public void getScannerData(String data) { + super.getScannerData(data); + if (editTextView == binding.materialInLocation) { + editTextView.setText(data); + + } else if (editTextView == binding.materialInGoods || rawInstock == null) { + binding.materialInGoods.setText(data); + OkGo.post(url + "/wms/pda/raw/inSelectCode").params("code", data).execute(new MyRecultCall(dialog, this) { + @Override + public void onSuccess(Response 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 onFocusChange(View v, boolean hasFocus) { + if (hasFocus) { + editTextView = (EditText) v; + } + } + + public void rawinSubmit(View view) { + OkGo.post(url + "/wms/pda/semi/submitOutInfo") + .upRequestBody(RequestBody.create(JSON, gson.toJson(rawInstock))) + .execute(new MyRecultCall(dialog, this) { + @Override + public void onSuccess(Response response) { + super.onSuccess(response); + var body = response.body(); + if (body.getCode() == 200) { + + finish(); + } + myToastUitls.show(body.getMsg()); + } + }); } } \ No newline at end of file diff --git a/app/src/main/res/layout/activity_raw_in.xml b/app/src/main/res/layout/activity_raw_in.xml index 60565dc..d5be13d 100644 --- a/app/src/main/res/layout/activity_raw_in.xml +++ b/app/src/main/res/layout/activity_raw_in.xml @@ -1,151 +1,168 @@ - + xmlns:tools="http://schemas.android.com/tools"> - + + + + + + android:layout_height="match_parent" + android:orientation="vertical" + tools:context=".wms.raw.RawInActivity"> - + - + android:layout_height="45dp" + android:layout_marginTop="12dp" + android:layout_marginEnd="4dp"> - + - + - + - - + android:layout_height="45dp" + android:layout_marginTop="12dp" + android:layout_marginEnd="4dp"> - + - + + - + - + android:layout_height="45dp" + android:layout_marginTop="12dp" + android:layout_marginEnd="4dp"> - + - + - + - + android:layout_height="45dp" + android:layout_marginTop="12dp" + android:layout_marginEnd="4dp"> - + - + - + - - - + + + android:layout_marginTop="12dp" + android:layout_marginEnd="4dp"> - + + + + + - - - - - + android:layout_height="45dp" + android:layout_marginTop="12dp" + android:layout_marginEnd="4dp"> + + + + + + +