diff --git a/app/src/main/java/com/example/jingyuan_mes/adapter/MaterialOutInfoAdapter.java b/app/src/main/java/com/example/jingyuan_mes/adapter/MaterialOutInfoAdapter.java new file mode 100644 index 0000000..efface1 --- /dev/null +++ b/app/src/main/java/com/example/jingyuan_mes/adapter/MaterialOutInfoAdapter.java @@ -0,0 +1,67 @@ +package com.example.jingyuan_mes.adapter; + +import android.content.Context; +import android.view.LayoutInflater; +import android.view.ViewGroup; + +import androidx.annotation.NonNull; +import androidx.databinding.DataBindingUtil; +import androidx.recyclerview.widget.RecyclerView; + +import com.example.jingyuan_mes.BR; +import com.example.jingyuan_mes.R; +import com.example.jingyuan_mes.databinding.ItemOutInfoBinding; +import com.example.jingyuan_mes.databinding.ItemReturnInfoBinding; +import com.example.jingyuan_mes.entity.OutstockDetail; +import com.example.jingyuan_mes.entity.RawReturnDetail; + +import java.util.List; + +/** + * @author wanghao + * @date 2024/1/31 15:18 + */ +public class MaterialOutInfoAdapter extends RecyclerView.Adapter { + private List list; + private Context context; + private LayoutInflater inflater; + public MaterialOutInfoAdapter(Context context) { + this.context = context; + inflater = LayoutInflater.from(context); + } + + public void setList(List list) { + this.list = list; + } + + @NonNull + @Override + public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + ItemOutInfoBinding binding = DataBindingUtil.inflate(inflater, R.layout.item_out_info, parent, false); + return new MyViewHolder(binding); + } + + @Override + public void onBindViewHolder(@NonNull MyViewHolder holder, int position) { + var item = list.get(position); + item.setIndex(position+1); + var binding = holder.binding; + binding.setVariable(BR.vm,item); + } + + @Override + public int getItemCount() { + return list==null?0:list.size(); + } + + class MyViewHolder extends RecyclerView.ViewHolder { + private ItemOutInfoBinding binding; + + public MyViewHolder(ItemOutInfoBinding binding) { + super(binding.getRoot()); + this.binding = binding; + } + + + } +} diff --git a/app/src/main/java/com/example/jingyuan_mes/base/BaseActivity.java b/app/src/main/java/com/example/jingyuan_mes/base/BaseActivity.java index 8189834..2527db4 100644 --- a/app/src/main/java/com/example/jingyuan_mes/base/BaseActivity.java +++ b/app/src/main/java/com/example/jingyuan_mes/base/BaseActivity.java @@ -29,7 +29,7 @@ public class BaseActivity extends AppCompatActivity { public Gson gson; public MediaType JSON = MediaType.parse("application/json; charset=utf-8"); private MyReceiver myReceiver; - public String handle = "eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX2tleSI6IjI3MWU3ZTc2LTJjNDctNGQ3MS04NDkyLWQ1ZWQ5MzNhMTMyOCIsInVzZXJuYW1lIjoiYWRtaW4ifQ.6V0NfRNWJFTRrccqThRKmI15FL9l1gJqbdqOlLHx8gH-kr9C6brLyZgr1PY6X7fma3L3BPEcJDv2aRis0DUAnw"; + public String handle = "eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX2tleSI6ImYzZDU3MWE5LWVhY2UtNGZlYi05OGIzLWI1YjlmNWI0ZmNlYyIsInVzZXJuYW1lIjoiYWRtaW4ifQ.IXlAZ1Byx_Ou6Szul1vy6AEpgsIMGZ97OAdpZjCbwTLoCwQ6jt2tJmxFtdL-FVl35zrAFqNHMPe-oxr5kaGY8A"; public Context context; @Override protected void onCreate(Bundle savedInstanceState) { diff --git a/app/src/main/java/com/example/jingyuan_mes/entity/Outstock.java b/app/src/main/java/com/example/jingyuan_mes/entity/Outstock.java index e09ce33..410e81f 100644 --- a/app/src/main/java/com/example/jingyuan_mes/entity/Outstock.java +++ b/app/src/main/java/com/example/jingyuan_mes/entity/Outstock.java @@ -1,5 +1,7 @@ package com.example.jingyuan_mes.entity; +import java.util.List; + public class Outstock { @@ -34,6 +36,15 @@ public class Outstock { private String applyBy; private String applyDate; private String warehouseName; + private List wmsRawOutstockDetailList; + + public List getWmsRawOutstockDetailList() { + return wmsRawOutstockDetailList; + } + + public void setWmsRawOutstockDetailList(List wmsRawOutstockDetailList) { + this.wmsRawOutstockDetailList = wmsRawOutstockDetailList; + } public int getRawOutstockId() { return rawOutstockId; diff --git a/app/src/main/java/com/example/jingyuan_mes/entity/OutstockDetail.java b/app/src/main/java/com/example/jingyuan_mes/entity/OutstockDetail.java index 57fab7a..647059c 100644 --- a/app/src/main/java/com/example/jingyuan_mes/entity/OutstockDetail.java +++ b/app/src/main/java/com/example/jingyuan_mes/entity/OutstockDetail.java @@ -141,6 +141,15 @@ public class OutstockDetail { private String taskType; private String taskCode; +private int index; + + public int getIndex() { + return index; + } + + public void setIndex(int index) { + this.index = index; + } public void setRawOutstockDetailId(Long rawOutstockDetailId) { this.rawOutstockDetailId = rawOutstockDetailId; diff --git a/app/src/main/java/com/example/jingyuan_mes/store/MaterialOutInfoActivity.java b/app/src/main/java/com/example/jingyuan_mes/store/MaterialOutInfoActivity.java index 1d5a51b..5af75db 100644 --- a/app/src/main/java/com/example/jingyuan_mes/store/MaterialOutInfoActivity.java +++ b/app/src/main/java/com/example/jingyuan_mes/store/MaterialOutInfoActivity.java @@ -8,26 +8,36 @@ import android.view.View; import android.widget.Toast; import com.example.jingyuan_mes.R; +import com.example.jingyuan_mes.adapter.MaterialOutInfoAdapter; +import com.example.jingyuan_mes.adapter.RawReturnInfoAdapter; import com.example.jingyuan_mes.base.BaseActivity; import com.example.jingyuan_mes.base.MyRecultCall; import com.example.jingyuan_mes.base.MyResult; import com.example.jingyuan_mes.databinding.ActivityMaterialOutBinding; import com.example.jingyuan_mes.databinding.ActivityMaterialOutInfoBinding; import com.example.jingyuan_mes.entity.OutStoreAudit; +import com.example.jingyuan_mes.entity.Outstock; +import com.example.jingyuan_mes.entity.RawReturn; +import com.example.jingyuan_mes.entity.RawReturnDetail; import com.example.jingyuan_mes.uitls.SharedPreferencesUtils; +import com.google.gson.reflect.TypeToken; import com.lzy.okgo.OkGo; import com.lzy.okgo.model.Response; +import java.util.List; + import okhttp3.RequestBody; public class MaterialOutInfoActivity extends BaseActivity { private OutStoreAudit auditStatus; private ActivityMaterialOutInfoBinding binding; + private MaterialOutInfoAdapter adapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); binding = DataBindingUtil.setContentView(this, R.layout.activity_material_out_info); - binding.setTitle("出库审批"); + adapter=new MaterialOutInfoAdapter(this); + binding.setAdapter(adapter); } @Override @@ -41,16 +51,22 @@ public class MaterialOutInfoActivity extends BaseActivity { auditStatus=new OutStoreAudit(); var id = getIntent().getIntExtra("id", 0); auditStatus.setRawOutstockId(id); - // OkGo.get(url+"/wms/mobile/getRawOutstockByOutstockId/"+id) - // .tag(this) - // .headers("Authorization", SharedPreferencesUtils.getstring("access_token", "")) - // .execute(new MyRecultCall(dialog,this){ - // @Override - // public void onSuccess(Response response) { - // super.onSuccess(response); - // - // } - // }); + OkGo.get(url+"/wms/mobile/getRawOutstockByOutstockId/"+id) + .tag(this) + .headers("Authorization", SharedPreferencesUtils.getstring("access_token", "")) + .execute(new MyRecultCall(dialog,this){ + @Override + public void onSuccess(Response response) { + super.onSuccess(response); + var body = response.body(); + var data = body.getData(); + if (data !=null){ + Outstock rawReturn=gson.fromJson(data.toString(),Outstock.class); + adapter.setList(rawReturn.getWmsRawOutstockDetailList()); + adapter.notifyDataSetChanged(); + } + } + }); } diff --git a/app/src/main/java/com/example/jingyuan_mes/store/StockreturnConfirmInfoActivity.java b/app/src/main/java/com/example/jingyuan_mes/store/StockreturnConfirmInfoActivity.java index 7bc2062..17ef1ee 100644 --- a/app/src/main/java/com/example/jingyuan_mes/store/StockreturnConfirmInfoActivity.java +++ b/app/src/main/java/com/example/jingyuan_mes/store/StockreturnConfirmInfoActivity.java @@ -6,6 +6,7 @@ import androidx.databinding.ViewDataBinding; import android.content.pm.LauncherApps; import android.os.Bundle; +import android.view.View; import android.widget.Toast; import com.example.jingyuan_mes.R; @@ -23,11 +24,15 @@ import com.lzy.okgo.model.Response; import java.util.List; +import okhttp3.RequestBody; + public class StockreturnConfirmInfoActivity extends BaseActivity { private RawReturnInfoAdapter adapter; private RawReturnDetail sub; - private List wmsRawReturnDetailList; - private ActivityStockreturnConfirmInfoBinding binding; + private List wmsRawReturnDetailList; + private ActivityStockreturnConfirmInfoBinding binding; + private long id; + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -36,7 +41,8 @@ public class StockreturnConfirmInfoActivity extends BaseActivity { adapter = new RawReturnInfoAdapter(this); binding.setAdapter(adapter); sub = new RawReturnDetail(); - var id = getIntent().getLongExtra("id", 0L); + + id = getIntent().getLongExtra("id", 0L); sub.setRawReturnId(id); binding.setSub(sub); @@ -52,7 +58,7 @@ public class StockreturnConfirmInfoActivity extends BaseActivity { super.onSuccess(response); var body = response.body(); if (body.getCode() == 200) { - RawReturn rawReturn = gson.fromJson(body.getData().toString(),RawReturn.class ); + RawReturn rawReturn = gson.fromJson(body.getData().toString(), RawReturn.class); binding.setVm(rawReturn); wmsRawReturnDetailList = rawReturn.getWmsRawReturnDetailList(); adapter.setList(wmsRawReturnDetailList); @@ -62,4 +68,21 @@ public class StockreturnConfirmInfoActivity extends BaseActivity { } }); } + + public void returnConfirmSubmit(View view) { + OkGo.post(url + "/wms/mobile/confirmRawReturn") + .headers("Authorization", SharedPreferencesUtils.getstring("access_token", "")) + .upRequestBody(RequestBody.create(JSON, gson.toJson(sub))) + .execute(new MyRecultCall(dialog, this) { + @Override + public void onSuccess(Response response) { + super.onSuccess(response); + var body = response.body(); + if (body.getCode() == 200) { + initRequest(id); + } + Toast.makeText(context, body.getMsg(), Toast.LENGTH_SHORT).show(); + } + }); + } } \ No newline at end of file diff --git a/app/src/main/res/layout/activity_material_out_info.xml b/app/src/main/res/layout/activity_material_out_info.xml index 53ac418..1f71edf 100644 --- a/app/src/main/res/layout/activity_material_out_info.xml +++ b/app/src/main/res/layout/activity_material_out_info.xml @@ -9,7 +9,7 @@ type="String" /> + type="com.example.jingyuan_mes.adapter.MaterialOutInfoAdapter" /> + app:title='@{title??"出库审批"}' /> \ No newline at end of file diff --git a/app/src/main/res/layout/item_out_info.xml b/app/src/main/res/layout/item_out_info.xml new file mode 100644 index 0000000..4b0b11b --- /dev/null +++ b/app/src/main/res/layout/item_out_info.xml @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/item_out_item.xml b/app/src/main/res/layout/item_out_item.xml deleted file mode 100644 index 213ac70..0000000 --- a/app/src/main/res/layout/item_out_item.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file