diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 4856608..f256820 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -13,18 +13,26 @@ android:supportsRtl="true" android:theme="@style/Theme.Beijingdaxing" tools:targetApi="31"> + + + android:exported="false" + android:windowSoftInputMode="adjustPan" /> + android:exported="false" + android:windowSoftInputMode="adjustPan" /> @@ -36,7 +44,7 @@ + android:exported="true" /> \ No newline at end of file diff --git a/app/src/main/java/com/example/beijing_daxing/BFActivity.java b/app/src/main/java/com/example/beijing_daxing/BFActivity.java new file mode 100644 index 0000000..0a8722d --- /dev/null +++ b/app/src/main/java/com/example/beijing_daxing/BFActivity.java @@ -0,0 +1,82 @@ +package com.example.beijing_daxing; + +import androidx.appcompat.app.AppCompatActivity; +import androidx.databinding.DataBindingUtil; +import androidx.databinding.ViewDataBinding; + +import android.os.Bundle; +import android.view.View; +import android.widget.Toast; + +import com.example.beijing_daxing.base.BaseActivity; +import com.example.beijing_daxing.base.MyRecultCall; +import com.example.beijing_daxing.base.MyResult; +import com.example.beijing_daxing.been.LedgerRfid; +import com.example.beijing_daxing.databinding.ActivityBfactivityBinding; +import com.example.beijing_daxing.uitls.SharedPreferencesUtils; +import com.example.beijing_daxing.vm.BFWm; +import com.lzy.okgo.OkGo; +import com.lzy.okgo.model.Response; + +import java.util.List; + +public class BFActivity extends BaseActivity { + private BFWm wm; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + ActivityBfactivityBinding dataBinding = DataBindingUtil.setContentView(this, R.layout.activity_bfactivity); + wm=new BFWm(); + dataBinding.setVm(wm); + } + + @Override + protected void sanRfid(List epcs) { + var epc = epcs.get(0); + wm.setEpc(epc); + OkGo.post(url+"/bf/select") + .tag(this) + .params("epc",epc) + .execute(new MyRecultCall(dialog,this){ + @Override + public void onSuccess(Response response) { + super.onSuccess(response); + var body = response.body(); + if (body.getCode()==0){ + LedgerRfid ledgerRfid=gson.fromJson(body.getData().toString(),LedgerRfid.class); + wm.setPcode(ledgerRfid.getBatchCode()); + wm.setState(ledgerRfid.getDictLabel()); + }else { + wm.clearText(); + Toast.makeText(BFActivity.this, body.getMsg(), Toast.LENGTH_SHORT).show(); + } + + } + }); + } + + public void bf_submit(View view){ + if (wm.getState().equals("正常")){ + OkGo.post(url+"/bf/submit") + .params("epc",wm.getEpc()) + .params("remark",wm.getRemark()) + .params("user", SharedPreferencesUtils.getstring("user","test-user")) + .execute(new MyRecultCall(dialog,this){ + @Override + public void onSuccess(Response response) { + super.onSuccess(response); + var body = response.body(); + if (body.getCode()==0){ + Toast.makeText(BFActivity.this, "提交成功", Toast.LENGTH_SHORT).show(); + finish(); + }else { + Toast.makeText(BFActivity.this,body.getMsg(), Toast.LENGTH_SHORT).show(); + } + } + }); + + }else { + Toast.makeText(this, "轮挡已报废,无需操作", Toast.LENGTH_SHORT).show(); + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/beijing_daxing/FpInActivity.java b/app/src/main/java/com/example/beijing_daxing/FpInActivity.java new file mode 100644 index 0000000..e2fcaa5 --- /dev/null +++ b/app/src/main/java/com/example/beijing_daxing/FpInActivity.java @@ -0,0 +1,90 @@ +package com.example.beijing_daxing; + +import androidx.appcompat.app.AppCompatActivity; +import androidx.databinding.DataBindingUtil; + +import android.os.Bundle; +import android.view.View; +import android.widget.Toast; + +import com.example.beijing_daxing.base.BaseActivity; +import com.example.beijing_daxing.base.MyRecultCall; +import com.example.beijing_daxing.base.MyResult; +import com.example.beijing_daxing.been.LedgerRfid; +import com.example.beijing_daxing.databinding.ActivityFpInBinding; +import com.example.beijing_daxing.uitls.SharedPreferencesUtils; +import com.example.beijing_daxing.vm.FpInVm; +import com.lzy.okgo.OkGo; +import com.lzy.okgo.model.Response; + +import java.util.List; + +public class FpInActivity extends BaseActivity { + private FpInVm vm; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + ActivityFpInBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_fp_in); + vm = new FpInVm(); + binding.setVm(vm); + } + + @Override + protected void sanRfid(List epcs) { + var epc = epcs.get(0); + vm.setEpc(epc); + OkGo.post(url+"/fpin/select") + .tag(this).params("epc",epc) + .execute(new MyRecultCall(dialog,this){ + @Override + public void onSuccess(Response response) { + super.onSuccess(response); + var body = response.body(); + if (body.getCode()==0){ + LedgerRfid ledgerRfid=gson.fromJson(body.getData().toString(),LedgerRfid.class); + vm.setBichCode(ledgerRfid.getBatchCode()); + vm.setLocation(ledgerRfid.getLocationType()); + vm.setLocationCode(ledgerRfid.getLocationCode()); + vm.setState(ledgerRfid.getDictLabel()); + vm.setTime(ledgerRfid.getCreateTime()); + vm.setList(ledgerRfid.getBaseLocationList()); + } + Toast.makeText(FpInActivity.this, body.getMsg(), Toast.LENGTH_SHORT).show(); + } + }); + } + + public void fpin_submit(View view){ + var state = vm.getState(); + if (!state.equals("报废")){ + Toast.makeText(this, "轮挡状态:"+state+",不能使用废品入库功能", Toast.LENGTH_SHORT).show(); + return; + } + if (!vm.getLocation().equals("仓库")){ + Toast.makeText(this, "轮挡状态已在仓库", Toast.LENGTH_SHORT).show(); + return; + } + OkGo.post(url+"/fpin/submit").tag(this) + .params("epc",vm.getEpc()) + .params("localtionCode",vm.getLocationCode()) + .params("user", SharedPreferencesUtils.getstring("user","")) + .params("bf",vm.getTime()) + .params("subCode",vm.getSubmitCode()) + .execute(new MyRecultCall(dialog,this){ + @Override + public void onSuccess(Response response) { + super.onSuccess(response); + var body = response.body(); + if (body.getCode()==0){ + finish(); + Toast.makeText(FpInActivity.this, "提交成功", Toast.LENGTH_SHORT).show(); + return; + } + Toast.makeText(FpInActivity.this, body.getMsg(), Toast.LENGTH_SHORT).show(); + } + }); + + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/beijing_daxing/HomePageActivity.java b/app/src/main/java/com/example/beijing_daxing/HomePageActivity.java index 75878d8..2c3224f 100644 --- a/app/src/main/java/com/example/beijing_daxing/HomePageActivity.java +++ b/app/src/main/java/com/example/beijing_daxing/HomePageActivity.java @@ -12,10 +12,9 @@ import android.widget.Toast; import com.example.beijing_daxing.adapter.HomePageAdapter; import com.example.beijing_daxing.databinding.ActivityHomePageBinding; -import com.example.beijing_daxing.entity.HomeIcon; +import com.example.beijing_daxing.been.HomeIcon; import java.util.ArrayList; -import java.util.Iterator; import java.util.List; public class HomePageActivity extends AppCompatActivity { @@ -29,8 +28,8 @@ public class HomePageActivity extends AppCompatActivity { list.add(new HomeIcon(R.mipmap.home_out1, "轮挡领用出库", OutActivity.class)); list.add(new HomeIcon(R.mipmap.home_store_check, "仓库盘点", StoreCheckActivity.class)); list.add(new HomeIcon(R.mipmap.home_check, "轮挡巡检", CheckActivity.class)); - list.add(new HomeIcon(R.mipmap.home_check, "轮挡报废", CheckActivity.class)); - list.add(new HomeIcon(R.mipmap.home_in, "废品入库", CheckActivity.class)); + list.add(new HomeIcon(R.mipmap.home_bf, "轮挡报废", BFActivity.class)); + list.add(new HomeIcon(R.mipmap.home_in, "废品入库", FpInActivity.class)); list.add(new HomeIcon(R.mipmap.home_out, "废品出库", CheckActivity.class)); /* try { diff --git a/app/src/main/java/com/example/beijing_daxing/MainActivity.java b/app/src/main/java/com/example/beijing_daxing/MainActivity.java index 3d906e5..2703e95 100644 --- a/app/src/main/java/com/example/beijing_daxing/MainActivity.java +++ b/app/src/main/java/com/example/beijing_daxing/MainActivity.java @@ -74,4 +74,12 @@ public class MainActivity extends BaseActivity { } }); } + + @Override + protected void onDestroy() { + super.onDestroy(); + if (uhfLongerManager!=null){ + uhfLongerManager.close(); + } + } } \ No newline at end of file diff --git a/app/src/main/java/com/example/beijing_daxing/OutActivity.java b/app/src/main/java/com/example/beijing_daxing/OutActivity.java index 1207231..511f03c 100644 --- a/app/src/main/java/com/example/beijing_daxing/OutActivity.java +++ b/app/src/main/java/com/example/beijing_daxing/OutActivity.java @@ -1,6 +1,5 @@ package com.example.beijing_daxing; -import androidx.appcompat.app.AppCompatActivity; import androidx.databinding.DataBindingUtil; import android.os.Bundle; import android.view.View; @@ -10,9 +9,8 @@ import com.example.beijing_daxing.base.AdapterClickCall; import com.example.beijing_daxing.base.BaseActivity; import com.example.beijing_daxing.base.MyRecultCall; import com.example.beijing_daxing.base.MyResult; -import com.example.beijing_daxing.been.InStoreSelectBody; import com.example.beijing_daxing.databinding.ActivityOutBinding; -import com.example.beijing_daxing.entity.BaseLocation; +import com.example.beijing_daxing.been.BaseLocation; import com.example.beijing_daxing.uitls.SharedPreferencesUtils; import com.example.beijing_daxing.vm.OutStoreVm; import com.google.gson.reflect.TypeToken; diff --git a/app/src/main/java/com/example/beijing_daxing/adapter/HomePageAdapter.java b/app/src/main/java/com/example/beijing_daxing/adapter/HomePageAdapter.java index 67138c4..b847375 100644 --- a/app/src/main/java/com/example/beijing_daxing/adapter/HomePageAdapter.java +++ b/app/src/main/java/com/example/beijing_daxing/adapter/HomePageAdapter.java @@ -5,14 +5,12 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; -import android.widget.ImageView; -import android.widget.TextView; import androidx.databinding.DataBindingUtil; import com.example.beijing_daxing.R; import com.example.beijing_daxing.databinding.ItemHomepageBinding; -import com.example.beijing_daxing.entity.HomeIcon; +import com.example.beijing_daxing.been.HomeIcon; import java.util.List; diff --git a/app/src/main/java/com/example/beijing_daxing/entity/BaseLocation.java b/app/src/main/java/com/example/beijing_daxing/been/BaseLocation.java similarity index 97% rename from app/src/main/java/com/example/beijing_daxing/entity/BaseLocation.java rename to app/src/main/java/com/example/beijing_daxing/been/BaseLocation.java index ad99203..fb42e6a 100644 --- a/app/src/main/java/com/example/beijing_daxing/entity/BaseLocation.java +++ b/app/src/main/java/com/example/beijing_daxing/been/BaseLocation.java @@ -1,4 +1,4 @@ -package com.example.beijing_daxing.entity; +package com.example.beijing_daxing.been; /** * 库位信息维护对象 base_location diff --git a/app/src/main/java/com/example/beijing_daxing/entity/BaseManufacturer.java b/app/src/main/java/com/example/beijing_daxing/been/BaseManufacturer.java similarity index 97% rename from app/src/main/java/com/example/beijing_daxing/entity/BaseManufacturer.java rename to app/src/main/java/com/example/beijing_daxing/been/BaseManufacturer.java index 28b0932..15c0b73 100644 --- a/app/src/main/java/com/example/beijing_daxing/entity/BaseManufacturer.java +++ b/app/src/main/java/com/example/beijing_daxing/been/BaseManufacturer.java @@ -1,4 +1,4 @@ -package com.example.beijing_daxing.entity; +package com.example.beijing_daxing.been; diff --git a/app/src/main/java/com/example/beijing_daxing/entity/HomeIcon.java b/app/src/main/java/com/example/beijing_daxing/been/HomeIcon.java similarity index 96% rename from app/src/main/java/com/example/beijing_daxing/entity/HomeIcon.java rename to app/src/main/java/com/example/beijing_daxing/been/HomeIcon.java index 2ff2893..c3e3732 100644 --- a/app/src/main/java/com/example/beijing_daxing/entity/HomeIcon.java +++ b/app/src/main/java/com/example/beijing_daxing/been/HomeIcon.java @@ -1,4 +1,4 @@ -package com.example.beijing_daxing.entity; +package com.example.beijing_daxing.been; /** * @author wanghao diff --git a/app/src/main/java/com/example/beijing_daxing/been/InStoreSelectBody.java b/app/src/main/java/com/example/beijing_daxing/been/InStoreSelectBody.java index 6d5fb85..eebe9db 100644 --- a/app/src/main/java/com/example/beijing_daxing/been/InStoreSelectBody.java +++ b/app/src/main/java/com/example/beijing_daxing/been/InStoreSelectBody.java @@ -1,8 +1,5 @@ package com.example.beijing_daxing.been; -import com.example.beijing_daxing.entity.BaseLocation; -import com.example.beijing_daxing.entity.BaseManufacturer; - import java.util.List; /** diff --git a/app/src/main/java/com/example/beijing_daxing/been/LedgerRfid.java b/app/src/main/java/com/example/beijing_daxing/been/LedgerRfid.java new file mode 100644 index 0000000..59fd403 --- /dev/null +++ b/app/src/main/java/com/example/beijing_daxing/been/LedgerRfid.java @@ -0,0 +1,106 @@ +package com.example.beijing_daxing.been; + +import java.util.Date; +import java.util.List; + +/** + * 轮挡台账对象 ledger_rfid + * + * @author wangh + * @date 2024-01-17 + */ +public class LedgerRfid { + + private Long objid; + private Long manufacturerId; + /** + * RFID编码 + */ + private String rifdCode; + /** + * 生产批次 + */ + private String batchCode; + /** + * 所在位置 + */ + private String locationType; + /** + * 位置编码 + */ + private String locationCode; + /** + * 是否报废 + */ + private String isScrap; + private String dictLabel; + private List baseLocationList; + private String createTime; + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public List getBaseLocationList() { + return baseLocationList; + } + + public void setBaseLocationList(List baseLocationList) { + this.baseLocationList = baseLocationList; + } + + public String getDictLabel() { + return dictLabel; + } + public void setDictLabel(String dictLabel) { + this.dictLabel = dictLabel; + } + public void setObjid(Long objid) { + this.objid = objid; + } + public Long getObjid() { + return objid; + } + public void setManufacturerId(Long manufacturerId) { + this.manufacturerId = manufacturerId; + } + public Long getManufacturerId() { + return manufacturerId; + } + public void setRifdCode(String rifdCode) { + this.rifdCode = rifdCode; + } + public String getRifdCode() { + return rifdCode; + } + public void setBatchCode(String batchCode) { + this.batchCode = batchCode; + } + public String getBatchCode() { + return batchCode; + } + public void setLocationType(String locationType) { + this.locationType = locationType; + } + public String getLocationType() { + return locationType; + } + public void setLocationCode(String locationCode) { + this.locationCode = locationCode; + } + public String getLocationCode() { + return locationCode; + } + public void setIsScrap(String isScrap) { + this.isScrap = isScrap; + } + public String getIsScrap() { + return isScrap; + } + + +} diff --git a/app/src/main/java/com/example/beijing_daxing/vm/BFWm.java b/app/src/main/java/com/example/beijing_daxing/vm/BFWm.java new file mode 100644 index 0000000..574f38b --- /dev/null +++ b/app/src/main/java/com/example/beijing_daxing/vm/BFWm.java @@ -0,0 +1,54 @@ +package com.example.beijing_daxing.vm; + +import androidx.databinding.BaseObservable; + +/** + * @author wanghao + * @date 2024/1/25 16:59 + */ +public class BFWm extends BaseObservable { + private String epc; + private String pcode; + private String state; + private String remark; + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + notifyChange(); + } + + public String getEpc() { + return epc; + } + + public void setEpc(String epc) { + this.epc = epc; + notifyChange(); + } + + public String getState() { + return state; + } + + public void setState(String state) { + this.state = state; + notifyChange(); + } + + public String getPcode() { + return pcode; + } + + public void setPcode(String pcode) { + this.pcode = pcode; + } + + public void clearText() { + state = remark = pcode = null; + notifyChange(); + } +} diff --git a/app/src/main/java/com/example/beijing_daxing/vm/FpInVm.java b/app/src/main/java/com/example/beijing_daxing/vm/FpInVm.java new file mode 100644 index 0000000..7923439 --- /dev/null +++ b/app/src/main/java/com/example/beijing_daxing/vm/FpInVm.java @@ -0,0 +1,100 @@ +package com.example.beijing_daxing.vm; + +import android.view.View; +import android.widget.Adapter; +import android.widget.AdapterView; + +import androidx.databinding.BaseObservable; + +import com.example.beijing_daxing.been.BaseLocation; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author wanghao + * @date 2024/1/26 15:32 + */ +public class FpInVm extends BaseObservable { + private String epc; + private String bichCode; + private String location; + private String locationCode; + private String state; + private String time; + private String submitCode; + private List list; + + public void selectLocation(AdapterView parent, View view, int position, long id) { + this.submitCode=list.get(position); + } + + + public String getSubmitCode() { + return submitCode; + } + + public List getList() { + return list; + } + + public void setList(List list1) { + list=new ArrayList<>(); + list1.forEach(t -> this.list.add(t.getLocationCode())); + notifyChange(); + } + + public String getEpc() { + return epc; + } + + public void setEpc(String epc) { + this.epc = epc; + notifyChange(); + } + + public String getBichCode() { + return bichCode; + } + + public void setBichCode(String bichCode) { + this.bichCode = bichCode; + notifyChange(); + } + + public String getLocation() { + return location; + } + + public void setLocation(String location) { + this.location = location; + notifyChange(); + } + + public String getLocationCode() { + return locationCode; + } + + public void setLocationCode(String locationCode) { + this.locationCode = locationCode; + notifyChange(); + } + + public String getState() { + return state; + } + + public void setState(String state) { + this.state = state; + notifyChange(); + } + + public String getTime() { + return time; + } + + public void setTime(String time) { + this.time = time; + notifyChange(); + } +} diff --git a/app/src/main/java/com/example/beijing_daxing/vm/InStoreVM.java b/app/src/main/java/com/example/beijing_daxing/vm/InStoreVM.java index 177eec1..0fb6d02 100644 --- a/app/src/main/java/com/example/beijing_daxing/vm/InStoreVM.java +++ b/app/src/main/java/com/example/beijing_daxing/vm/InStoreVM.java @@ -4,10 +4,9 @@ import android.view.View; import android.widget.AdapterView; import androidx.databinding.BaseObservable; -import androidx.recyclerview.widget.RecyclerView; -import com.example.beijing_daxing.entity.BaseLocation; -import com.example.beijing_daxing.entity.BaseManufacturer; +import com.example.beijing_daxing.been.BaseLocation; +import com.example.beijing_daxing.been.BaseManufacturer; import java.util.ArrayList; import java.util.List; diff --git a/app/src/main/java/com/example/beijing_daxing/vm/OutStoreVm.java b/app/src/main/java/com/example/beijing_daxing/vm/OutStoreVm.java index 5d6498f..806f79f 100644 --- a/app/src/main/java/com/example/beijing_daxing/vm/OutStoreVm.java +++ b/app/src/main/java/com/example/beijing_daxing/vm/OutStoreVm.java @@ -5,7 +5,7 @@ import android.widget.AdapterView; import androidx.databinding.BaseObservable; -import com.example.beijing_daxing.entity.BaseLocation; +import com.example.beijing_daxing.been.BaseLocation; import java.util.ArrayList; import java.util.List; diff --git a/app/src/main/res/layout/activity_bfactivity.xml b/app/src/main/res/layout/activity_bfactivity.xml new file mode 100644 index 0000000..be21825 --- /dev/null +++ b/app/src/main/res/layout/activity_bfactivity.xml @@ -0,0 +1,118 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +