增加 - 切换工位

master
wangh 8 months ago
parent b7a63ab1f7
commit 3471f2779f

@ -1,12 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<application
android:name=".base.MyApplication"
android:allowBackup="true"
android:usesCleartextTraffic="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/logo2"
@ -15,6 +18,10 @@
android:supportsRtl="true"
android:theme="@style/Theme.Aucmames"
tools:targetApi="31">
<activity
android:name=".ChangeActivity"
android:label="工位切换"
android:exported="false" />
<activity
android:name=".base.BaseActivity"
android:exported="false" />
@ -31,14 +38,13 @@
android:label="质量检测" />
<activity
android:name=".HomePageActivity"
android:exported="true">
</activity>
android:exported="true"></activity>
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

@ -0,0 +1,70 @@
package com.example.aucma_mes;
import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Toast;
import com.example.aucma_mes.base.BaseActivity;
import com.example.aucma_mes.databinding.ActivityChangeBinding;
import com.example.aucma_mes.entity.DefectBeen;
import com.example.aucma_mes.entity.Result;
import com.example.aucma_mes.entity.TeamBeen;
import com.example.aucma_mes.utils.MyRecultCall;
import com.example.aucma_mes.utils.SharedPreferencesUtils;
import com.google.gson.reflect.TypeToken;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.model.Response;
import java.util.ArrayList;
import java.util.List;
public class ChangeActivity extends BaseActivity {
private List<DefectBeen> list;
public List<String> tagList;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActivityChangeBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_change);
tagList = new ArrayList<>();
binding.setVm(this);
OkGo.<Result>get(url + "/base/productLine/findProductLineList?productLineType=2&stationType=2").tag(this)
.headers("Authorization", SharedPreferencesUtils.getstring("token", "")).execute(new MyRecultCall(dialog, this) {
@Override
public void onSuccess(Response<Result> response) {
var body = response.body();
if (body.getCode() == 200) {
list = gson.fromJson(gson.toJson(body.getData()), new TypeToken<List<DefectBeen>>() {
}.getType());
list.forEach(t -> tagList.add(t.getProductLineName()));
binding.setList(tagList);
}
Toast.makeText(ChangeActivity.this, body.getMsg(), Toast.LENGTH_SHORT).show();
}
});
}
@Override
protected void sanInfo(String code) {
}
private String tag;
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
tag = tagList.get(position);
productLineCode = list.get(position).getProductLineCode();
Log.e("TAG", "选中工位:" + tag);
}
private String productLineCode;
public void changeSubmit(View view){
SharedPreferencesUtils.putstring("stationName",tag);
SharedPreferencesUtils.putstring("stationCode",productLineCode);
finish();
}
}

@ -115,10 +115,7 @@ public class CheckActivity extends BaseActivity implements CheckAdapter.CheckIte
tipDialog.show();
}
// 测试
public void checkSubmint1(View view) {
sanInfo("B24010181060282920007");
}
// 提交
public void checkSubmint(View view) {
if (checkViewModel.getName() == null || checkViewModel.getName().isEmpty()) return;
@ -160,7 +157,8 @@ public class CheckActivity extends BaseActivity implements CheckAdapter.CheckIte
// 初始化-联动选择
private void initOptionpb(String stationCode) {
opv = new OptionsPickerBuilder(this, this).build();
OkGo.<Result>get(url + "/base/qualityInspectionItem/getQualityDefects/" + stationCode).tag(this).headers("Authorization", SharedPreferencesUtils.getstring("token", "")).execute(new MyRecultCall(dialog, this) {
OkGo.<Result>get(url + "/base/qualityInspectionItem/getQualityDefects/" + stationCode).tag(this)
.headers("Authorization", SharedPreferencesUtils.getstring("token", "")).execute(new MyRecultCall(dialog, this) {
@Override
public void onSuccess(Response<Result> response) {
super.onSuccess(response);

@ -24,6 +24,7 @@ public class HomePageActivity extends AppCompatActivity {
ActivityHomePageBinding binding;
private Intent intent;
private ArrayList<String> roles;
private User user;
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -37,19 +38,22 @@ public class HomePageActivity extends AppCompatActivity {
// Log.e("TAG", "onCreate:" + infoBeen.getUserPermission());
InfoDialog infoDialog = new InfoDialog(this);
try {
User user = infoBeen.getUser();
user = infoBeen.getUser();
user.setUsername(SharedPreferencesUtils.getstring("pdaName", ""));
user.setTeamName(SharedPreferencesUtils.getstring("teamName", null));
user.setTeamCode(SharedPreferencesUtils.getstring("teamCode", null));
infoDialog.setInfoData(infoBeen, user);
binding.homeButton1.setOnClickListener(v -> {
if (!roles.contains("quality_inspection")) {
Toast.makeText(this, "暂无权限", Toast.LENGTH_SHORT).show();
return;
}
intent = new Intent(this, CheckActivity.class);
intent.putExtra("stationCode", user.getStationCode());
intent.putExtra("stationName",user.getStationName());
intent.putExtra("stationCode", stationCode);
intent.putExtra("stationName", stationName);
startActivity(intent);
});
binding.homeButton2.setOnClickListener(v -> {
@ -68,8 +72,8 @@ public class HomePageActivity extends AppCompatActivity {
}
// 返修
intent = new Intent(this, RepairActivity.class);
intent.putExtra("userPermission",infoBeen.getUserPermission());
intent.putExtra("stationName",user.getStationName());
intent.putExtra("userPermission", infoBeen.getUserPermission());
intent.putExtra("stationName", stationName);
startActivity(intent);
});
binding.homeButton4.setOnClickListener(v -> {
@ -81,14 +85,40 @@ public class HomePageActivity extends AppCompatActivity {
intent.putExtra("title", "条码绑定");
startActivity(intent);
});
binding.homeButton6.setOnClickListener(v -> {
if (!roles.contains("switch_station")) {
Toast.makeText(this, "暂无权限", Toast.LENGTH_SHORT).show();
return;
}
intent = new Intent(this, ChangeActivity.class);
startActivity(intent);
});
binding.homeButton5.setOnClickListener(v -> {
infoDialog.show();
});
} catch (Exception e) {
Toast.makeText(this, "暂无权限", Toast.LENGTH_SHORT).show();
e.printStackTrace();
}
}
private String stationName;
private String stationCode;
@Override
protected void onResume() {
super.onResume();
stationName = SharedPreferencesUtils.getstring("stationName", user.getStationName());
stationCode = SharedPreferencesUtils.getstring("stationCode", user.getStationCode());
}
@Override
protected void onDestroy() {
super.onDestroy();
SharedPreferencesUtils.putstring("stationName",null);
SharedPreferencesUtils.putstring("stationCode",null);
}
}

@ -45,10 +45,10 @@ public class MainActivity extends BaseActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActivityMainBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_main);
String loginName = SharedPreferencesUtils.getstring("loginName", "");
String loginName = SharedPreferencesUtils.getstring("pdaName", "");
user = new User();
// user.setUsername(loginName);
// user.setPassword("123456");
user.setUsername(loginName);
user.setPassword("123456");
getSupportActionBar().hide(); // 隐藏原生标题栏
binding.setUser(user);

@ -26,7 +26,7 @@ import okhttp3.MediaType;
public abstract class BaseActivity extends AppCompatActivity {
private MyBroad receiver;
// public static String url="http://192.168.0.102:8080";
// public static String url="http://192.168.137.1:8080";
public static String url="http://10.100.72.10:8080";
public ProgressDialog dialog;
public Gson gson;

@ -23,6 +23,16 @@ public class DefectBeen extends BaseObservable {
private String qualityDefectName;
private String processResult;//返修结果
private String productLineName;//pda 工位名称
private String productLineCode;
public String getProductLineCode() {
return productLineCode;
}
public void setProductLineCode(String productLineCode) {
this.productLineCode = productLineCode;
}
public String getProductLineName() {
return productLineName;

@ -0,0 +1,57 @@
<?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="vm"
type="com.example.aucma_mes.ChangeActivity" />
<variable
name="list"
type="java.util.List" />
</data>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@color/grey"
tools:context=".ChangeActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="43dp"
android:layout_marginTop="15dp"
android:background="@color/white"
android:layout_marginEnd="4dp">
<TextView
style="@style/text_style1"
android:layout_width="90dp"
android:layout_height="match_parent"
android:background="@color/grey"
android:text="选择工位:" />
<Spinner
android:textAlignment="center"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:entries="@{list}"
android:onItemSelected="@{vm.onItemClick}"/>
</LinearLayout>
<Button
style="@style/button_true_style"
android:layout_width="370dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:layout_marginTop="50dp"
android:onClick="changeSubmit"
android:text="提交"/>
</LinearLayout>
</layout>

@ -64,6 +64,7 @@
android:drawableTop="@mipmap/icon_bd2"
android:text="条码绑定"
app:layout_columnWeight="1" />
<RadioButton
android:id="@+id/home_button5"
style="@style/radio_button_style"
@ -71,6 +72,13 @@
android:text="班组确认"
app:layout_columnWeight="1" />
<RadioButton
android:id="@+id/home_button6"
style="@style/radio_button_style"
android:drawableTop="@mipmap/icon_change"
android:text="切换工位"
app:layout_columnWeight="1" />
</androidx.gridlayout.widget.GridLayout>

Loading…
Cancel
Save