增加 选择工位

master
wanghao 1 month ago
parent c0350056a6
commit 38eba84a89

@ -82,6 +82,8 @@ public class ClassItemActivity extends BaseActivity {
super.onSuccess(response);
var body = response.body();
if (body.getCode() == 200) {
SharedPreferencesUtils.putstring("班组",classText);
SharedPreferencesUtils.putstring("班次",shiftText);
finish();
return;
}

@ -24,6 +24,7 @@ public class ConfigActivity extends BaseActivity {
private List<MachineInfo> machineInfoList;
private List<String> stringList;
private ActivityConfigBinding binding;
private MachineInfo machineInfo;
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -32,7 +33,6 @@ public class ConfigActivity extends BaseActivity {
binding.configSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
machineInfo = machineInfoList.get(position);
binding.setItem(machineInfo);
}
@ -44,13 +44,14 @@ public class ConfigActivity extends BaseActivity {
});
initRequest();
}
private MachineInfo machineInfo;
public void configSubmit(View view) {
if (machineInfo==null|| machineInfo.getMachineIp().equals(":")){
if (machineInfo == null || machineInfo.getMachineIp().equals(":")) {
return;
}
SharedPreferencesUtils.putstring("machineIp", machineInfo.getMachineIp());
SharedPreferencesUtils.putstring("machineNo", machineInfo.getMachineCode());
SharedPreferencesUtils.putstring("machineId", machineInfo.getMachineId());
Toast.makeText(context, "保存成功", Toast.LENGTH_SHORT).show();
finish();
}

@ -41,6 +41,7 @@ import okhttp3.MediaType;
public class BaseActivity extends AppCompatActivity implements MyScannerCall {
public static final int CAMERA_PHOTO = 1;
// public static String url = "http://172.20.10.4:6080";
public static String url = "http://10.11.180.67:6080";
// public static String url = "http://1.13.177.47:6080";
public ProgressDialog dialog;

@ -0,0 +1,101 @@
package com.example.haiwei_mom.data;
import java.util.List;
/**
* base_tooling_info
*
* @author zangch
* @date 2025-01-08
*/
public class BaseToolingInfo {
private Long toolingId;
/**
*
*/
private String toolingCode;
/**
*
*/
private String toolingName;
/**
*
*/
private String toolingBarcode;
/**
* RFID
*/
private String toolingRfidBarcode;
/**
*
*/
private String materialCode;
private List<TyreInfo> tyreInfoList;
public List<TyreInfo> getTyreInfoList() {
return tyreInfoList;
}
public void setTyreInfoList(List<TyreInfo> tyreInfoList) {
this.tyreInfoList = tyreInfoList;
}
public Long getToolingId() {
return toolingId;
}
public void setToolingId(Long toolingId) {
this.toolingId = toolingId;
}
public String getToolingCode() {
return toolingCode;
}
public void setToolingCode(String toolingCode) {
this.toolingCode = toolingCode;
}
public String getToolingName() {
return toolingName;
}
public void setToolingName(String toolingName) {
this.toolingName = toolingName;
}
public String getToolingBarcode() {
return toolingBarcode;
}
public void setToolingBarcode(String toolingBarcode) {
this.toolingBarcode = toolingBarcode;
}
public String getToolingRfidBarcode() {
return toolingRfidBarcode;
}
public void setToolingRfidBarcode(String toolingRfidBarcode) {
this.toolingRfidBarcode = toolingRfidBarcode;
}
public String getMaterialCode() {
return materialCode;
}
public void setMaterialCode(String materialCode) {
this.materialCode = materialCode;
}
}

@ -5,8 +5,17 @@ public class MachineInfo {
private String machineCode,
machineName,
machineIp;
private String machineId;
public String getMachineId() {
return machineId;
}
public void setMachineId(String machineId) {
this.machineId = machineId;
}
public String getMachineCode() {
return machineCode;
}

@ -0,0 +1,33 @@
package com.example.haiwei_mom.data;
public class TyreInfo {
private String returnBarcode;
private Long materialId;
private String materialName;
public String getReturnBarcode() {
return returnBarcode;
}
public void setReturnBarcode(String returnBarcode) {
this.returnBarcode = returnBarcode;
}
public Long getMaterialId() {
return materialId;
}
public void setMaterialId(Long materialId) {
this.materialId = materialId;
}
public String getMaterialName() {
return materialName;
}
public void setMaterialName(String materialName) {
this.materialName = materialName;
}
}

@ -18,10 +18,12 @@ import com.example.haiwei_mom.ipc.data.MachinePlan;
import com.example.haiwei_mom.uitls.SharedPreferencesUtils;
import com.google.android.material.snackbar.Snackbar;
import com.google.gson.reflect.TypeToken;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.model.Response;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import okhttp3.RequestBody;
@ -42,16 +44,11 @@ public class FeedingMaterialsActivity extends BaseActivity {
binding.feedingCode.setText(machineNo);
initRequest();
binding.feedingBarCode.setOnEditorActionListener((v, actionId, event) -> {
// Log.e("TAG", "搜索1:" );
// if (actionId == EditorInfo.IME_ACTION_SEARCH){
// Log.e("TAG", "搜索2:" );
//
// }
feedingCodeSubmit(null);
return true;
});
}
// 获取计划
private void initRequest() {
Map map = new HashMap();
map.put("MachineNo", machineNo);
@ -68,6 +65,25 @@ public class FeedingMaterialsActivity extends BaseActivity {
machinePlan = gson.fromJson(body.getDataJson(), MachinePlan.class);
binding.setMachineState(body.getMsg());
binding.setData(machinePlan);
selectMachineStationList();
return;
}
myToastUitls.show(body.getMsg());
}
});
}
private void selectMachineStationList(){
OkGo.<MyResult>post(url + "/wms/pda/selectMachineStationList")
.params("machineId", SharedPreferencesUtils.getstring("machineId",""))
.execute(new MyRecultCall(dialog, this) {
@Override
public void onSuccess(Response<MyResult> response) {
super.onSuccess(response);
var body = response.body();
if (body.getCode() == 200) {
List<String> list=gson.fromJson(body.getDataJson(),new TypeToken<List<String>>(){}.getType());
binding.setList(list);
return;
}
myToastUitls.show(body.getMsg());
@ -87,7 +103,7 @@ public class FeedingMaterialsActivity extends BaseActivity {
// }else {
machinePlan.setBarCode(data);
// }
machinePlan.setStationCode(binding.feedingSelectStation.getSelectedItem().toString());
OkGo.<MyResult>post("http://" + SharedPreferencesUtils.getstring("machineIp", null) +
"/api/semi_product/scan")
// .params("machineNo", machineNo)

@ -8,11 +8,18 @@ public class MachinePlan {
private String MaterialId;
private String MaterialName;
private String stationCode;
private String from;
private String barCode;
private String workCode;
public String getStationCode() {
return stationCode;
}
public void setStationCode(String stationCode) {
this.stationCode = stationCode;
}
public String getFrom() {
return from;

@ -1,20 +1,21 @@
package com.example.haiwei_mom.wms.product;
import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;
import androidx.databinding.ObservableInt;
import android.annotation.SuppressLint;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import androidx.databinding.DataBindingUtil;
import androidx.databinding.ObservableInt;
import com.example.haiwei_mom.R;
import com.example.haiwei_mom.adapter.BindVehicleAdapter;
import com.example.haiwei_mom.adapter.ItemClickCall;
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.BaseToolingInfo;
import com.example.haiwei_mom.data.TyreInfo;
import com.example.haiwei_mom.databinding.ActivityBindVehicleBinding;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.model.Response;
@ -23,11 +24,13 @@ import java.util.ArrayList;
import java.util.List;
public class BindVehicleActivity extends BaseActivity implements ItemClickCall {
boolean sanState = true;
private ActivityBindVehicleBinding binding;
private ArrayList<String> list;
private BindVehicleAdapter adapter;
private ObservableInt listSize;
private List<TyreInfo> tyreInfoList;
private BaseToolingInfo baseToolingInfo;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@ -38,25 +41,82 @@ public class BindVehicleActivity extends BaseActivity implements ItemClickCall {
adapter = new BindVehicleAdapter(this, this);
adapter.setList(list);
binding.setAdapter(adapter);
binding.bindVehicleCode.setOnEditorActionListener((v, actionId, event) -> {
selectVehicle(v.getText().toString());
return true;
});
binding.bindProductCode.setOnEditorActionListener((v, actionId, event) -> {
selectTyre(v.getText().toString());
return true;
});
}
// 查询工装
private void selectVehicle(String code) {
OkGo.<MyResult>post(url + "/wms/pda/product/selectVehicle")
.params("code", code)
.execute(new MyRecultCall(dialog, this) {
@Override
public void onSuccess(Response<MyResult> response) {
super.onSuccess(response);
var body = response.body();
binding.setCode2(null);
if (body.getCode() == 200) {
baseToolingInfo = gson.fromJson(body.getDataJson(), BaseToolingInfo.class);
binding.setCode2(baseToolingInfo.getToolingCode());
sanState = false;
tyreInfoList=new ArrayList<>();
baseToolingInfo.setTyreInfoList(tyreInfoList);
}
myToastUitls.show(body.getMsg());
}
});
}
// 查询轮胎
private void selectTyre(String code) {
OkGo.<MyResult>post(url + "/wms/pda/product/selectTyreCode")
.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) {
TyreInfo tyreInfo= gson.fromJson(body.getDataJson(), TyreInfo.class);
String data = tyreInfo.getReturnBarcode();
if (list.contains(data)) {
return;
}
Log.e("TAG", "getScannerData:" + listSize.get());
list.add(data);
adapter.notifyDataSetChanged();
listSize.set(list.size());
}
myToastUitls.show(body.getMsg());
}
});
}
@SuppressLint("NotifyDataSetChanged")
@Override
public void getScannerData(String data) {
super.getScannerData(data);
var text = binding.bindVehicleCode.getText().toString();
if (text.isEmpty()) {
if (sanState) {
binding.bindVehicleCode.setText(data);
selectVehicle(data);
return;
}
if (list.contains(data)) {
return;
}
Log.e("TAG", "getScannerData:" + listSize.get());
list.add(data);
adapter.notifyDataSetChanged();
listSize.set(list.size());
}
@SuppressLint("NotifyDataSetChanged")

@ -8,12 +8,18 @@
<variable
name="title"
type="String" />
<variable
name="size"
type="androidx.databinding.ObservableInt" />
<variable
name="adapter"
type="com.example.haiwei_mom.adapter.BindVehicleAdapter" />
<variable
name="code2"
type="String" />
</data>
<LinearLayout
@ -42,7 +48,31 @@
android:id="@+id/bind_vehicle_code"
style="@style/text_san"
android:layout_width="match_parent"
android:layout_height="match_parent" />
android:layout_height="match_parent"
android:imeOptions="actionSearch"
android:inputType="text"
android:lines="1" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="4dp">
<TextView
style="@style/text_title"
android:layout_width="90dp"
android:layout_height="match_parent"
android:text="载具编号:" />
<TextView
android:id="@+id/bind_vehicle_result_code"
style="@style/text_info"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@{code2}" />
</LinearLayout>
@ -52,10 +82,10 @@
android:layout_height="match_parent"
android:layout_margin="5dp"
android:layout_weight="1"
android:padding="2dp"
android:adapter="@{adapter}"
android:background="@drawable/text_edit"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
android:adapter="@{adapter}"/>
android:padding="2dp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
<LinearLayout
android:layout_width="match_parent"
@ -75,12 +105,35 @@
android:text='@{size +""}' />
</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="90dp"
android:layout_height="match_parent"
android:text="扫描轮胎:" />
<EditText
android:id="@+id/bind_product_code"
style="@style/text_san"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:imeOptions="actionSearch"
android:inputType="text"
android:lines="1" />
</LinearLayout>
<Button
style="@style/button_submit"
android:layout_width="match_parent"
android:layout_height="55dp"
android:onClick="bindVehicleSubmit"
android:text="提交" />
android:text="提交绑定" />
</LinearLayout>

@ -13,6 +13,10 @@
name="machineState"
type="String" />
<variable
name="list"
type="java.util.List" />
<variable
name="data"
type="com.example.haiwei_mom.ipc.data.MachinePlan" />
@ -48,6 +52,26 @@
android:layout_height="match_parent" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="4dp">
<TextView
style="@style/text_title"
android:layout_width="100dp"
android:layout_height="match_parent"
android:text="选择工位:" />
<Spinner
android:id="@+id/feeding_select_station"
style="@style/spinner_style"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:entries="@{list}" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="45dp"
@ -127,10 +151,10 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:lines="1"
android:maxLines="1"
android:imeOptions="actionSearch"
android:inputType="text"
android:imeOptions="actionSearch" />
android:lines="1"
android:maxLines="1" />
</LinearLayout>
@ -141,8 +165,8 @@
android:layout_width="300dp"
android:layout_height="55dp"
android:layout_gravity="center"
android:layout_marginBottom="20dp"
android:layout_marginTop="100dp"
android:layout_marginBottom="20dp"
android:onClick="feedingCodeSubmit"
android:text="提交" />
</LinearLayout>

@ -41,7 +41,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:drawableRight="@mipmap/icon_chaxun"
android:text="@{data.toolingBarcode}"/>
android:text="@={data.toolingBarcode}"/>
</LinearLayout>

@ -1,9 +1,92 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<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"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".wms.product.ProductOutActivity">
xmlns:tools="http://schemas.android.com/tools">
</androidx.constraintlayout.widget.ConstraintLayout>
<data>
<variable
name="title"
type="String" />
</data>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".wms.product.ProductOutActivity">
<include
layout="@layout/toolbar"
app:title='@{title??"原材料出库"}' />
<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="90dp"
android:layout_height="match_parent"
android:text="出库单号:" />
<EditText
android:id="@+id/raw_out_code"
style="@style/text_san"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:drawableRight="@mipmap/icon_chaxun"
/>
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:text="待出库物料"
android:textColor="@color/blue" />
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@color/white"
android:padding="5dp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="4dp">
<TextView
style="@style/text_title"
android:layout_width="110dp"
android:layout_height="match_parent"
android:text="扫描轮胎:" />
<EditText
android:id="@+id/raw_out_goods"
style="@style/text_san"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</LinearLayout>
<Button
style="@style/button_style"
android:layout_width="match_parent"
android:layout_height="55dp"
android:layout_margin="12dp"
android:onClick="rawOutSubmit"
android:text="提交" />
</LinearLayout>
</layout>
Loading…
Cancel
Save