完成 半成品出库

master
wangh 1 year ago
parent 709c63fc30
commit e183334d63

@ -23,6 +23,7 @@ import com.example.jingyuan_mes.store.ProductInActivity;
import com.example.jingyuan_mes.store.ProductOutActivity; import com.example.jingyuan_mes.store.ProductOutActivity;
import com.example.jingyuan_mes.store.ProductOutApplyActivity; import com.example.jingyuan_mes.store.ProductOutApplyActivity;
import com.example.jingyuan_mes.store.ProductOutConfirmActivity; import com.example.jingyuan_mes.store.ProductOutConfirmActivity;
import com.example.jingyuan_mes.store.SemiActivity;
import com.example.jingyuan_mes.store.StockreturnActivity; import com.example.jingyuan_mes.store.StockreturnActivity;
import com.example.jingyuan_mes.store.StockreturnConfirmActivity; import com.example.jingyuan_mes.store.StockreturnConfirmActivity;
import com.example.jingyuan_mes.uitls.SharedPreferencesUtils; import com.example.jingyuan_mes.uitls.SharedPreferencesUtils;
@ -63,7 +64,7 @@ public class HomePageActivity extends BaseActivity implements ItemClickCall {
map.put("成品出库申请", ProductOutApplyActivity.class); map.put("成品出库申请", ProductOutApplyActivity.class);
map.put("成品出库", ProductOutActivity.class); map.put("成品出库", ProductOutActivity.class);
map.put("成品出库确认", ProductOutConfirmActivity.class); map.put("成品出库确认", ProductOutConfirmActivity.class);
map.put("半成品入成品库", ProductOutConfirmActivity.class); map.put("半成品入成品库", SemiActivity.class);
} }
private void initRequest() { private void initRequest() {

@ -0,0 +1,66 @@
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.ItemReturnListBinding;
import com.example.jingyuan_mes.databinding.ItemSemiBinding;
import com.example.jingyuan_mes.entity.RawReturn;
import com.example.jingyuan_mes.entity.Semi;
import java.util.List;
/**
* @author wanghao
* @date 2024/1/31 15:18
*/
public class ItemSemiAdapter extends RecyclerView.Adapter<ItemSemiAdapter.ItemtViewHolder> {
private List<Semi> list;
private Context context;
private LayoutInflater inflater;
public ItemSemiAdapter(Context context) {
this.context = context;
inflater = LayoutInflater.from(context);
}
public void setList(List<Semi> list) {
this.list = list;
}
@NonNull
@Override
public ItemtViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
ItemSemiBinding binding = DataBindingUtil.inflate(inflater, R.layout.item_semi, parent, false);
return new ItemtViewHolder(binding);
}
@Override
public void onBindViewHolder(@NonNull ItemtViewHolder holder, int position) {
var rawReturn = list.get(position);
var binding = holder.binding;
binding.setVariable(BR.vm,rawReturn);
}
@Override
public int getItemCount() {
return list==null?0:list.size();
}
class ItemtViewHolder extends RecyclerView.ViewHolder {
private ItemSemiBinding binding;
public ItemtViewHolder(ItemSemiBinding binding) {
super(binding.getRoot());
this.binding = binding;
}
}
}

@ -30,7 +30,7 @@ public class BaseActivity extends AppCompatActivity {
public Gson gson; public Gson gson;
public MediaType JSON = MediaType.parse("application/json; charset=utf-8"); public MediaType JSON = MediaType.parse("application/json; charset=utf-8");
private MyReceiver myReceiver; private MyReceiver myReceiver;
public String handle = "eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX2tleSI6ImVjNTExZWRmLTFhZmUtNGM3NC1hYzY0LWE0NDAzNGYyNjViZCIsInVzZXJuYW1lIjoiYWRtaW4ifQ.o5gRcCOrE9xBzwgy5-emClML29gWyuS9sYW12Nd9XvJrUVBEcrDvemHGIsUm_SVsGuZYPAWjMPN0zSARQ5UHvw"; public String handle = "eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX2tleSI6IjViOTgxMWFlLWMzNTMtNDhhZC1hMjlkLTM0MzAwNThhYTI2OCIsInVzZXJuYW1lIjoiYWRtaW4ifQ.w5QX9R4ca6IanVpP_zOY2xG0ed8f2z3z6nBYuN2B9ng2wjd3Js_FH1jDUKx9QPManOy38mM4GslQkqTxJX1D2A";
public Context context; public Context context;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {

@ -0,0 +1,243 @@
package com.example.jingyuan_mes.entity;
import androidx.databinding.BaseObservable;
/**
* wmstransfer
*/
public class Semi extends BaseObservable {
/**
* ID
*/
private Long transferId;
/**
*
*/
private String taskCode;
/**
* ID
*/
private Long oriWarehouseId;
/**
*
*/
private String oriLocationCode;
/**
* ID
*/
private Long targetWarehouseId;
/**
*
*/
private String targetLocationCode;
/**
* ID
*/
private Long materialId;
/**
*
*/
private String productBatch;
/**
* ,pd_base_plan_infoplan_code
*/
private String planCode;
/**
*
*/
private int applyQty;
/**
*
*/
private int outstockQty;
/**
*
*/
private int instockQty;
/**
* (1)
*/
private String transferType;
/**
*
*/
private String applyReason;
/**
*
*/
private String applyBy;
/**
*
*/
private String applyDate;
private String oriWarehouseName;
private String targetWarehouseName;
private String materialCode;
private String materialName;
public Long getTransferId() {
return transferId;
}
public void setTransferId(Long transferId) {
this.transferId = transferId;
}
public String getTaskCode() {
return taskCode;
}
public void setTaskCode(String taskCode) {
this.taskCode = taskCode;
}
public Long getOriWarehouseId() {
return oriWarehouseId;
}
public void setOriWarehouseId(Long oriWarehouseId) {
this.oriWarehouseId = oriWarehouseId;
}
public String getOriLocationCode() {
return oriLocationCode;
}
public void setOriLocationCode(String oriLocationCode) {
this.oriLocationCode = oriLocationCode;
}
public Long getTargetWarehouseId() {
return targetWarehouseId;
}
public void setTargetWarehouseId(Long targetWarehouseId) {
this.targetWarehouseId = targetWarehouseId;
}
public String getTargetLocationCode() {
return targetLocationCode;
}
public void setTargetLocationCode(String targetLocationCode) {
this.targetLocationCode = targetLocationCode;
}
public Long getMaterialId() {
return materialId;
}
public void setMaterialId(Long materialId) {
this.materialId = materialId;
}
public String getProductBatch() {
return productBatch;
}
public void setProductBatch(String productBatch) {
this.productBatch = productBatch;
}
public String getPlanCode() {
return planCode;
}
public void setPlanCode(String planCode) {
this.planCode = planCode;
}
public int getApplyQty() {
return applyQty;
}
public void setApplyQty(int applyQty) {
this.applyQty = applyQty;
}
public int getOutstockQty() {
return outstockQty;
}
public void setOutstockQty(int outstockQty) {
this.outstockQty = outstockQty;
}
public int getInstockQty() {
return instockQty;
}
public void setInstockQty(int instockQty) {
this.instockQty = instockQty;
}
public String getTransferType() {
return transferType;
}
public void setTransferType(String transferType) {
this.transferType = transferType;
}
public String getApplyReason() {
return applyReason;
}
public void setApplyReason(String applyReason) {
this.applyReason = applyReason;
}
public String getApplyBy() {
return applyBy;
}
public void setApplyBy(String applyBy) {
this.applyBy = applyBy;
}
public String getApplyDate() {
return applyDate;
}
public void setApplyDate(String applyDate) {
this.applyDate = applyDate;
}
public String getOriWarehouseName() {
return oriWarehouseName;
}
public void setOriWarehouseName(String oriWarehouseName) {
this.oriWarehouseName = oriWarehouseName;
}
public String getTargetWarehouseName() {
return targetWarehouseName;
}
public void setTargetWarehouseName(String targetWarehouseName) {
this.targetWarehouseName = targetWarehouseName;
}
public String getMaterialCode() {
return materialCode;
}
public void setMaterialCode(String materialCode) {
this.materialCode = materialCode;
}
public String getMaterialName() {
return materialName;
}
public void setMaterialName(String materialName) {
this.materialName = materialName;
}
}

@ -1,16 +1,91 @@
package com.example.jingyuan_mes.store; package com.example.jingyuan_mes.store;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;
import androidx.databinding.ObservableField;
import android.os.Bundle; import android.os.Bundle;
import android.widget.Toast;
import com.example.jingyuan_mes.R; import com.example.jingyuan_mes.R;
import com.example.jingyuan_mes.adapter.ItemSemiAdapter;
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.ActivitySemiBinding;
import com.example.jingyuan_mes.entity.RawReturn;
import com.example.jingyuan_mes.entity.Semi;
import com.example.jingyuan_mes.uitls.SharedPreferencesUtils;
import com.google.gson.reflect.TypeToken;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.model.Response;
public class SemiActivity extends AppCompatActivity { import java.util.HashMap;
import java.util.List;
import java.util.Map;
import okhttp3.RequestBody;
public class SemiActivity extends BaseActivity {
private ItemSemiAdapter adapter;
private List<Semi> list;
public ObservableField<String> locationCode;
public ObservableField<String> proCode;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_semi); ActivitySemiBinding binding= DataBindingUtil.setContentView(this,R.layout.activity_semi);
adapter=new ItemSemiAdapter(this);
binding.setAdapter(adapter);
locationCode=new ObservableField<>();
proCode=new ObservableField<>();
binding.setVm(this);
initRequest();
}
private void initRequest() {
OkGo.<MyResult>get(url + "/wms/mobile/getTransfers").tag(this)
.headers("Authorization", SharedPreferencesUtils.getstring("access_token", ""))
.execute(new MyRecultCall(dialog, this) {
@Override
public void onSuccess(Response<MyResult> response) {
super.onSuccess(response);
var body = response.body();
if (body.getTotal()==0) {
if (list != null) {
list.clear();
adapter.notifyDataSetChanged();
}
Toast.makeText(context, body.getCode() == 200 ? "暂无审批数据" : body.getMsg(), Toast.LENGTH_SHORT).show();
return;
}
list = gson.fromJson(gson.toJson(body.getRows()), new TypeToken<List<Semi>>() {}.getType());
adapter.setList(list);
adapter.notifyDataSetChanged();
}
});
}
public void submit(boolean b){
Map<String,String> map=new HashMap<>();
map.put("locationCode",locationCode.get());
map.put("materialBarcode",proCode.get());
OkGo.<MyResult>post(url+"/wms/mobile/"+(b?"transferOutstock":"transferInstock"))
.headers("Authorization", SharedPreferencesUtils.getstring("access_token", ""))
.upRequestBody(RequestBody.create(JSON,gson.toJson(map)))
.execute(new MyRecultCall(dialog,this){
@Override
public void onSuccess(Response<MyResult> response) {
super.onSuccess(response);
var body = response.body();
if (body.getCode()==200){
initRequest();
}
Toast.makeText(context, body.getMsg(), Toast.LENGTH_SHORT).show();
}
});
} }
} }

@ -1,16 +0,0 @@
package com.example.jingyuan_mes.store;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import com.example.jingyuan_mes.R;
public class SemiFinishedActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_semi_finished);
}
}

@ -4,15 +4,18 @@
xmlns:tools="http://schemas.android.com/tools"> xmlns:tools="http://schemas.android.com/tools">
<data> <data>
<variable <variable
name="title" name="title"
type="String" /> type="String" />
<variable <variable
name="vm" name="vm"
type="com.example.jingyuan_mes.entity.OutStoreSubmit" /> type="com.example.jingyuan_mes.store.SemiActivity" />
<variable <variable
name="adapter" name="adapter"
type="com.example.jingyuan_mes.adapter.MaterialOutPassAdapter" /> type="com.example.jingyuan_mes.adapter.ItemSemiAdapter" />
</data> </data>
<LinearLayout <LinearLayout
@ -20,84 +23,94 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical" android:orientation="vertical"
tools:context=".store.SemiActivity"> tools:context=".store.SemiActivity">
<include layout="@layout/toolbar"
<include
layout="@layout/toolbar"
app:title='@{title??"出半成品库入成品库"}' /> app:title='@{title??"出半成品库入成品库"}' />
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:adapter="@{adapter}"
android:padding="5dp" android:padding="5dp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
android:adapter="@{adapter}" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="45dp" android:layout_height="45dp">
android:layout_marginEnd="4dp">
<TextView <TextView
style="@style/text_title" style="@style/text_title"
android:layout_width="90dp" android:layout_width="90dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:text="扫描物料:" /> android:text="扫描库位:" />
<EditText <EditText
style="@style/text_san" style="@style/text_san"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:text="@={vm.instockBatch}" /> android:text="@={vm.locationCode}" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="45dp"
android:layout_marginTop="12dp" android:layout_marginTop="12dp">
android:layout_marginEnd="4dp">
<TextView <TextView
style="@style/text_title" style="@style/text_title"
android:layout_width="90dp" android:layout_width="90dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:text="扫描库位:" /> android:text="扫描物料:" />
<!-- --> <!-- -->
<EditText <EditText
style="@style/text_san" style="@style/text_san"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:minHeight="45dp" android:text="@={vm.proCode}" />
android:text="@={vm.locationCode}" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="45dp" android:layout_height="40dp"
android:layout_marginTop="12dp" android:layout_margin="12dp"
android:layout_marginEnd="4dp"> android:orientation="horizontal">
<TextView
style="@style/text_title" <Button
android:layout_width="90dp" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:text="输入数量:" /> android:layout_weight="1"
android:background="@drawable/button_bg"
android:text="申请" />
<EditText <View
style="@style/text_info"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:inputType="numberDecimal" android:layout_weight="1" />
android:text='@={vm.outstockAmount + ""}' />
</LinearLayout> <Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:onClick="@{()->vm.submit(true)}"
android:layout_weight="1"
android:background="@drawable/button_bg"
android:layout_marginEnd="5dp"
android:text="出库" />
<Button <Button
style="@style/button_style"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="55dp" android:layout_height="match_parent"
android:layout_margin="20dp" android:layout_weight="1"
android:onClick="outPassSubmit" android:onClick="@{()->vm.submit(false)}"
android:text="提交" /> android:layout_marginStart="5dp"
android:background="@drawable/button_bg"
android:text="入库" />
</LinearLayout>
</LinearLayout> </LinearLayout>
</layout> </layout>

@ -1,20 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<data>
<variable
name="title"
type="String" />
</data>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".store.SemiFinishedActivity">
<include
layout="@layout/toolbar"
app:title='@{title??"半成品入成品库"}'/>
</LinearLayout>
</layout>

@ -0,0 +1,166 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<data>
<variable
name="vm"
type="com.example.jingyuan_mes.entity.Semi" />
</data>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="210dp"
android:background="@drawable/san_text_bg"
android:orientation="vertical"
android:layout_marginTop="5dp"
android:padding="5dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dp">
<TextView
style="@style/item_title_blue"
android:layout_width="70dp"
android:layout_height="match_parent"
android:text="半成品库:" />
<TextView
style="@style/item_text_13"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="@{vm.oriWarehouseName}" />
<TextView
style="@style/item_title_blue"
android:layout_width="70dp"
android:layout_height="match_parent"
android:text="成品库:" />
<TextView
style="@style/item_text_13"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="@{vm.targetWarehouseName}" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dp">
<TextView
style="@style/item_title_blue"
android:layout_width="70dp"
android:layout_height="match_parent"
android:text="成品编号:" />
<TextView
style="@style/item_text_13"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="@{vm.materialCode}" />
<TextView
style="@style/item_title_blue"
android:layout_width="70dp"
android:layout_height="match_parent"
android:text="成品名称:" />
<TextView
style="@style/item_text_13"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="@{vm.materialName}" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dp">
<TextView
style="@style/item_title_blue"
android:layout_width="70dp"
android:layout_height="match_parent"
android:text="生产订单:" />
<TextView
style="@style/item_text_13"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="@{vm.planCode}" />
<TextView
style="@style/item_title_blue"
android:layout_width="70dp"
android:layout_height="match_parent"
android:text="半成品库位:" />
<TextView
style="@style/item_text_13"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="@{vm.oriLocationCode}" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dp">
<TextView
style="@style/item_title_blue"
android:layout_width="70dp"
android:layout_height="match_parent"
android:text="申请日期:" />
<TextView
style="@style/item_text_13"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="@{vm.applyDate}" />
<TextView
style="@style/item_title_blue"
android:layout_width="70dp"
android:layout_height="match_parent"
android:text="申请人:" />
<TextView
style="@style/item_text_13"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="@{vm.applyBy}" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dp">
<TextView
style="@style/item_title_blue"
android:layout_width="185dp"
android:layout_height="match_parent"
android:text="申请数量/已出数量/已入数量:" />
<TextView
style="@style/item_text_13"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text='@{vm.applyQty+"/"+vm.outstockQty+"/"+vm.instockQty}' />
</LinearLayout>
</LinearLayout>
</layout>

@ -26,6 +26,19 @@
<item name="android:gravity">center</item> <item name="android:gravity">center</item>
<item name="android:textColor">@color/black</item> <item name="android:textColor">@color/black</item>
</style> </style>
<style name="item_title_blue">
<item name="android:textSize">13sp</item>
<item name="android:gravity">center</item>
<item name="android:textColor">@color/blue</item>
</style>
<style name="item_text_13">
<item name="android:textSize">13sp</item>
<item name="android:gravity">center</item>
<item name="android:textColor">@color/black</item>
</style>
<style name="item_title_left"> <style name="item_title_left">
<item name="android:textSize">13sp</item> <item name="android:textSize">13sp</item>
<item name="android:gravity">center|left</item> <item name="android:gravity">center|left</item>

Loading…
Cancel
Save