增加 半成品出库

master
wanghao 5 months ago
parent 0b57b27987
commit 0bb69ef38c

@ -30,7 +30,11 @@ public class MainActivity extends BaseActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActivityMainBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_main);
// ActivityMainBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_main);
ActivityMainBinding binding = ActivityMainBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
loginVm = new LoginVm();
boolean isRemember = SharedPreferencesUtils.getboolean("isRemember", true);
if (isRemember) {

@ -0,0 +1,132 @@
package com.example.haiwei_mom.data;
import androidx.databinding.BaseObservable;
/**
* wms_hpp_storage_detail
*/
public class SemiOutVo extends BaseObservable {
private Long objId;
/**
*
*/
private String cardNo;
/**
*
*/
private String shelfNo;
/**
*
*/
private String instockType;
/**
* Id
*/
private Long materialId;
/**
* id
*/
private Long storePlaceId;
/**
*
*/
private double sourceNum;
/**
*
*/
private double storageNum;
private String createTime;
private String storePlaceCode;
private String materialCode;
private String materialSpec;
private double minParkingTime;
private double maxParkingTime;
private String minTime;
private String maxTime;
private String unitName;
public String getMaterialSpec() {
return materialSpec;
}
public String getUnitName() {
return unitName;
}
public String getCardNo() {
return cardNo;
}
public void setCardNo(String cardNo) {
this.cardNo = cardNo;
}
public String getShelfNo() {
return shelfNo;
}
public void setShelfNo(String shelfNo) {
this.shelfNo = shelfNo;
}
public double getStorageNum() {
return storageNum;
}
public void setStorageNum(double storageNum) {
this.storageNum = storageNum;
}
public String getCreateTime() {
return createTime;
}
public void setCreateTime(String createTime) {
this.createTime = createTime;
}
public String getMaterialCode() {
return materialCode;
}
public void setMaterialCode(String materialCode) {
this.materialCode = materialCode;
}
public String getMinTime() {
return minTime;
}
public void setMinTime(String minTime) {
this.minTime = minTime;
}
public String getMaxTime() {
return maxTime;
}
public void setMaxTime(String maxTime) {
this.maxTime = maxTime;
}
private double outNumber;
public double getOutNumber() {
return outNumber;
}
public void setOutNumber(double outNumber) {
this.outNumber = outNumber;
notifyChange();
}
}

@ -1,6 +1,8 @@
package com.example.haiwei_mom.wms.semi;
import android.annotation.SuppressLint;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import androidx.databinding.DataBindingUtil;
@ -10,32 +12,104 @@ 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.SemiInVo;
import com.example.haiwei_mom.data.SemiOutVo;
import com.example.haiwei_mom.databinding.ActivitySemiInBinding;
import com.example.haiwei_mom.databinding.ActivitySemiOutBinding;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.model.Response;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import okhttp3.RequestBody;
public class SemiOutActivity extends BaseActivity {
private SemiInVo semi;
private SemiOutVo semi;
private ActivitySemiOutBinding binding;
private DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
@SuppressLint("ClickableViewAccessibility")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActivitySemiOutBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_semi_out);
binding = DataBindingUtil.setContentView(this, R.layout.activity_semi_out);
binding.semiOutCode.setOnTouchListener((v, event) -> {
if (event.getAction() == MotionEvent.ACTION_UP) {
// 获取触摸的位置
int x = (int) event.getX();
if (x >= 464) {
selectHppStorageInfo(binding.semiOutCode.getText().toString());
return true;
}
}
return false;
});
}
public void semiInSubmit(View view) {
OkGo.<MyResult>post(url + "")
.upRequestBody(RequestBody.create(JSON, gson.toJson(semi)))
.execute(new MyRecultCall(dialog,this) {
private void selectHppStorageInfo(String code) {
OkGo.<MyResult>post(url + "/wms/pda/semi/selectHppStorageInfo")
.params("code", code)
.execute(new MyRecultCall(dialog, this) {
@Override
public void onSuccess(Response<MyResult> response) {
super.onSuccess(response);
var body = response.body();
if (body.getCode() == 200) {
semi = gson.fromJson(body.getDataJson(), SemiOutVo.class);
semi.setOutNumber(semi.getStorageNum());
binding.setData(semi);
return;
}
myToastUitls.show(body.getMsg());
}
});
}
public void semiInSubmit(View view) {
if (semi == null) return;
if (semi.getStorageNum() < semi.getOutNumber()) {
myToastUitls.show("出库数量大于物料数量");
return;
}
var now = LocalDateTime.now();
LocalDateTime dateMin = LocalDateTime.parse(semi.getMinTime(), formatter);
LocalDateTime dateMax = LocalDateTime.parse(semi.getMaxTime(), formatter);
if (!now.isAfter(dateMin)) {
myToastUitls.show("停放时间没有达到要求,不能使用");
return;
}
if (!now.isBefore(dateMax)) {
myToastUitls.show("已经失效,不能使用");
return;
}
OkGo.<MyResult>post(url + "/wms/pda/semi/submitOutInfo")
.upRequestBody(RequestBody.create(JSON, gson.toJson(semi)))
.execute(new MyRecultCall(dialog, this) {
@Override
public void onSuccess(Response<MyResult> response) {
super.onSuccess(response);
var body = response.body();
if (body.getCode()==200){
}
myToastUitls.show(body.getMsg());
}
});
}
@Override
public void getScannerData(String data) {
super.getScannerData(data);
binding.semiOutCode.setText(data);
selectHppStorageInfo(data);
}
}

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#91F495"/>
<corners android:radius="6dp"/>
</shape>

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#FFC107"/>
<corners android:radius="6dp"/>
</shape>

@ -9,6 +9,10 @@
name="title"
type="String" />
<variable
name="data"
type="com.example.haiwei_mom.data.SemiOutVo" />
</data>
<LinearLayout
@ -34,10 +38,11 @@
android:text="扫描流转卡:" />
<EditText
android:id="@+id/material_in_goods"
android:id="@+id/semi_out_code"
style="@style/text_san"
android:layout_width="match_parent"
android:layout_height="match_parent" />
android:layout_height="match_parent"
android:drawableRight="@mipmap/icon_chaxun" />
</LinearLayout>
@ -57,8 +62,7 @@
style="@style/text_info"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@{data.materialCode}" />
<!-- android:text="@{vo.materialName}"-->
android:text="@{data.materialCode}"/>
</LinearLayout>
@ -92,26 +96,27 @@
style="@style/text_title"
android:layout_width="110dp"
android:layout_height="match_parent"
android:text="库存数量:" />
android:text="数量:" />
<TextView
style="@style/text_info"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginEnd="5dp"
android:layout_weight="1"
android:text='@{String.valueOf(data.instockNum)??"0"}'
android:layout_marginEnd="5dp"/>
android:text='@{String.valueOf(data.storageNum)??"0"}' />
<TextView
style="@style/text_info"
android:layout_width="60dp"
android:layout_height="match_parent" />
android:layout_height="match_parent"
android:text="@{data.unitName}" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="45dp"
android:layout_marginTop="12dp"
android:layout_marginEnd="4dp">
@ -119,22 +124,84 @@
style="@style/text_title"
android:layout_width="110dp"
android:layout_height="match_parent"
android:text="目标库位:" />
<!-- -->
<EditText
android:id="@+id/material_in_location"
style="@style/text_san"
android:text="生产时间:" />
<TextView
style="@style/text_info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="45dp" />
android:layout_height="match_parent"
android:text="@{data.createTime}" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_marginTop="12dp"
android:layout_marginEnd="4dp">
<TextView
style="@style/text_title"
android:layout_width="110dp"
android:layout_height="match_parent"
android:text="可使用时间:" />
<TextView
style="@style/text_info"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/text_bg_g"
android:text="@{data.minTime}" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_marginTop="12dp"
android:layout_marginEnd="4dp">
<TextView
style="@style/text_title"
android:layout_width="110dp"
android:layout_height="match_parent"
android:text="失效时间:" />
<TextView
style="@style/text_info"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/text_bg_y"
android:text="@{data.maxTime}" />
</LinearLayout>
<!-- <LinearLayout-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginTop="12dp"-->
<!-- android:layout_marginEnd="4dp">-->
<!-- <TextView-->
<!-- style="@style/text_title"-->
<!-- android:layout_width="110dp"-->
<!-- android:layout_height="match_parent"-->
<!-- android:text="目标库位:" />-->
<!-- <EditText-->
<!-- android:id="@+id/material_in_location"-->
<!-- style="@style/text_san"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:minHeight="45dp" />-->
<!-- </LinearLayout>-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_marginTop="20dp"
android:layout_marginTop="12dp"
android:layout_marginEnd="4dp">
<TextView
@ -147,7 +214,8 @@
style="@style/text_info"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:inputType="numberDecimal" />
android:inputType="numberDecimal"
android:text='@={data.outNumber+""}'/>
</LinearLayout>

Loading…
Cancel
Save