增加 - 查询质检数量

master
wangh 2 years ago
parent 3471f2779f
commit ab0c066f18

@ -10,8 +10,8 @@ android {
applicationId "com.example.aucma_mes" applicationId "com.example.aucma_mes"
minSdk 24 minSdk 24
targetSdk 33 targetSdk 33
versionCode 5 versionCode 8
versionName "1.0" versionName "1.8"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
} }

@ -67,7 +67,7 @@ public class BindingActivity extends BaseActivity {
OkGo.<String>post(url + s).tag(this).headers("Authorization", SharedPreferencesUtils.getstring("token", "")) OkGo.<String>post(url + s).tag(this).headers("Authorization", SharedPreferencesUtils.getstring("token", ""))
.params("boxCode", boxCode.get()) .params("boxCode", boxCode.get())
.params("innerCode", innerCode.get()) .params("innerCode", innerCode.get())
.params("loginName", SharedPreferencesUtils.getstring("pdaName", "")) .params("loginName", SharedPreferencesUtils.getstring("loginName", ""))
.execute(new StringCallback() { .execute(new StringCallback() {
@Override @Override
public void onSuccess(Response<String> response) { public void onSuccess(Response<String> response) {

@ -22,6 +22,7 @@ import com.example.aucma_mes.adapter.RepaitSubmintInfoAdapter;
import com.example.aucma_mes.base.BaseActivity; import com.example.aucma_mes.base.BaseActivity;
import com.example.aucma_mes.databinding.ActivityCheckBinding; import com.example.aucma_mes.databinding.ActivityCheckBinding;
import com.example.aucma_mes.dialog.RepairSubmintInfoDialog; import com.example.aucma_mes.dialog.RepairSubmintInfoDialog;
import com.example.aucma_mes.entity.CheckSum;
import com.example.aucma_mes.entity.DefectBeen; import com.example.aucma_mes.entity.DefectBeen;
import com.example.aucma_mes.entity.DictBeen; import com.example.aucma_mes.entity.DictBeen;
import com.example.aucma_mes.entity.Result; import com.example.aucma_mes.entity.Result;
@ -52,10 +53,24 @@ public class CheckActivity extends BaseActivity implements CheckAdapter.CheckIte
private List<List<String>> options2; private List<List<String>> options2;
private List<List<List<String>>> options3; private List<List<List<String>>> options3;
private List<DefectBeen> topDefects; private List<DefectBeen> topDefects;
private String stationCode;
private CheckSum checkSum;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
initView();
Intent intent = getIntent();
stationCode = intent.getStringExtra("stationCode");
// 查询检测
initStationSum();
checkViewModel.setStationCode(stationCode);
binding.setTitle("质量检测 - " + intent.getStringExtra("stationName"));
// 三联
initOptionpb(stationCode);
tipDialog = new RepairSubmintInfoDialog(this, this);
}
private void initView() {
binding = DataBindingUtil.setContentView(this, R.layout.activity_check); binding = DataBindingUtil.setContentView(this, R.layout.activity_check);
checkViewModel = new CheckViewModel(); checkViewModel = new CheckViewModel();
getSupportActionBar().hide(); getSupportActionBar().hide();
@ -64,13 +79,28 @@ public class CheckActivity extends BaseActivity implements CheckAdapter.CheckIte
submitList = new ArrayList<>(); submitList = new ArrayList<>();
checkAdapter.setList(submitList); checkAdapter.setList(submitList);
binding.recyclerView.setAdapter(checkAdapter); binding.recyclerView.setAdapter(checkAdapter);
Intent intent = getIntent(); checkSum=new CheckSum();
String stationCode = intent.getStringExtra("stationCode"); binding.setSum(checkSum);
checkViewModel.setStationCode(stationCode); }
binding.setTitle("质量检测 - "+ intent.getStringExtra("stationName"));
// 三联 private void initStationSum() {
initOptionpb(stationCode); OkGo.<Result>post(url + "/api/pdaQueryQuantityNumber").tag(this)
tipDialog = new RepairSubmintInfoDialog(this, this); .headers("Authorization", SharedPreferencesUtils.getstring("token", ""))
.params("stationCode", stationCode).execute(new MyRecultCall(dialog, this) {
@Override
public void onSuccess(Response<Result> response) {
super.onSuccess(response);
Result result = response.body();
if (result.getCode() == 200) {
var data = result.getData();
if (data !=null){
CheckSum checkSum1= gson.fromJson(data.toString(),CheckSum.class);
checkSum.setQUANTITY_SUM(checkSum1.getQUANTITY_SUM());
checkSum.setREPAIR_SUM(checkSum1.getREPAIR_SUM());
}
}
}
});
} }
// 扫码 // 扫码
@ -121,8 +151,8 @@ public class CheckActivity extends BaseActivity implements CheckAdapter.CheckIte
if (checkViewModel.getName() == null || checkViewModel.getName().isEmpty()) return; if (checkViewModel.getName() == null || checkViewModel.getName().isEmpty()) return;
checkViewModel.setList(submitList); checkViewModel.setList(submitList);
checkViewModel.setMeasure(submitList.isEmpty() ? "3" : "1"); checkViewModel.setMeasure(submitList.isEmpty() ? "3" : "1");
checkViewModel.setUserName(SharedPreferencesUtils.getstring("pdaName", "pda01")); checkViewModel.setUserName(SharedPreferencesUtils.getstring("loginName", "pda01"));
checkViewModel.setTeamCode(SharedPreferencesUtils.getstring("teamCode",null)); checkViewModel.setTeamCode(SharedPreferencesUtils.getstring("teamCode", null));
OkGo.<Result>post(url + "/api/checkSubmit").tag(this) OkGo.<Result>post(url + "/api/checkSubmit").tag(this)
.headers("Authorization", SharedPreferencesUtils.getstring("token", "")) .headers("Authorization", SharedPreferencesUtils.getstring("token", ""))
.upRequestBody(RequestBody.create(JSON, gson.toJson(checkViewModel))) .upRequestBody(RequestBody.create(JSON, gson.toJson(checkViewModel)))

@ -40,7 +40,7 @@ public class HomePageActivity extends AppCompatActivity {
try { try {
user = infoBeen.getUser(); user = infoBeen.getUser();
user.setUsername(SharedPreferencesUtils.getstring("pdaName", "")); user.setUsername(SharedPreferencesUtils.getstring("loginName", ""));
user.setTeamName(SharedPreferencesUtils.getstring("teamName", null)); user.setTeamName(SharedPreferencesUtils.getstring("teamName", null));
user.setTeamCode(SharedPreferencesUtils.getstring("teamCode", null)); user.setTeamCode(SharedPreferencesUtils.getstring("teamCode", null));
infoDialog.setInfoData(infoBeen, user); infoDialog.setInfoData(infoBeen, user);

@ -45,7 +45,7 @@ public class MainActivity extends BaseActivity {
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
ActivityMainBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_main); ActivityMainBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_main);
String loginName = SharedPreferencesUtils.getstring("pdaName", ""); String loginName = SharedPreferencesUtils.getstring("loginName", "");
user = new User(); user = new User();
user.setUsername(loginName); user.setUsername(loginName);
user.setPassword("123456"); user.setPassword("123456");
@ -176,7 +176,7 @@ public class MainActivity extends BaseActivity {
Intent intent = new Intent(MainActivity.this, HomePageActivity.class); Intent intent = new Intent(MainActivity.this, HomePageActivity.class);
intent.putExtra("role", loginBack.getRoles()); intent.putExtra("role", loginBack.getRoles());
intent.putExtra("info", body); intent.putExtra("info", body);
SharedPreferencesUtils.putstring("pdaName", user.username); SharedPreferencesUtils.putstring("loginName", user.username);
SharedPreferencesUtils.putstring("teamCode", user.getTeamCode()); SharedPreferencesUtils.putstring("teamCode", user.getTeamCode());
SharedPreferencesUtils.putstring("teamName", user.getTeamName()); SharedPreferencesUtils.putstring("teamName", user.getTeamName());
SharedPreferencesUtils.putstring("token", token); SharedPreferencesUtils.putstring("token", token);

@ -97,7 +97,7 @@ public class RepairActivity extends BaseActivity {
public void repairSubmit(View view) { public void repairSubmit(View view) {
if (submitList.isEmpty()) return; if (submitList.isEmpty()) return;
RepairSubmitInfo repairSubmitInfo =new RepairSubmitInfo(submitList, RepairSubmitInfo repairSubmitInfo =new RepairSubmitInfo(submitList,
SharedPreferencesUtils.getstring("pdaName", "pda01") SharedPreferencesUtils.getstring("loginName", "pda01")
,repairVm.getRepairName(),repairVm.getIsFlag()); ,repairVm.getRepairName(),repairVm.getIsFlag());
MediaType JSON = MediaType.parse("application/json; charset=utf-8"); MediaType JSON = MediaType.parse("application/json; charset=utf-8");
RequestBody body = RequestBody.create(JSON,gson.toJson(repairSubmitInfo) ); RequestBody body = RequestBody.create(JSON,gson.toJson(repairSubmitInfo) );

@ -0,0 +1,36 @@
package com.example.aucma_mes.entity;
import androidx.databinding.BaseObservable;
/**
* @author wanghao
* @date 2024/3/15 13:46
*/
public class CheckSum extends BaseObservable {
/**
* QUANTITY_SUM : 380
* REPAIR_SUM : 2
*/
private int QUANTITY_SUM;
private int REPAIR_SUM;
public int getQUANTITY_SUM() {
return QUANTITY_SUM;
}
public void setQUANTITY_SUM(int QUANTITY_SUM) {
this.QUANTITY_SUM = QUANTITY_SUM;
notifyChange();
}
public int getREPAIR_SUM() {
return REPAIR_SUM;
}
public void setREPAIR_SUM(int REPAIR_SUM) {
this.REPAIR_SUM = REPAIR_SUM;
notifyChange();
}
}

@ -4,22 +4,33 @@
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.aucma_mes.vm.CheckViewModel" /> type="com.example.aucma_mes.vm.CheckViewModel" />
<import type="android.view.View" />
<import type="android.view.View" />
<variable
name="sum"
type="com.example.aucma_mes.entity.CheckSum" />
</data> </data>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/grey" android:background="@color/grey"
android:orientation="vertical" android:orientation="vertical"
tools:context=".CheckActivity"> tools:context=".CheckActivity">
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="45dp" android:layout_height="45dp"
@ -29,6 +40,7 @@
android:text="@{title}" android:text="@{title}"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="20sp" /> android:textSize="20sp" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="43dp" android:layout_height="43dp"
@ -47,6 +59,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:text="@={vm.code}" /> android:text="@={vm.code}" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="43dp" android:layout_height="43dp"
@ -63,10 +76,10 @@
android:text="产品型号:" /> android:text="产品型号:" />
<TextView <TextView
style="@style/text_style1_1"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
style="@style/text_style1_1" android:text="@{vm.name}" />
android:text="@{vm.name}"/>
</LinearLayout> </LinearLayout>
@ -88,23 +101,68 @@
style="@style/text_style1_1" style="@style/text_style1_1"
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:drawableRight="@mipmap/icon_select" android:drawableRight="@mipmap/icon_select"
android:onClick="checkSelect" android:onClick="checkSelect"
android:layout_weight="1"
android:paddingEnd="10dp" android:paddingEnd="10dp"
android:text="@{vm.defect}" /> android:text="@{vm.defect}" />
<TextView <TextView
android:gravity="center"
android:layout_width="50dp" android:layout_width="50dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@drawable/button_w" android:background="@drawable/button_w"
android:gravity="center"
android:onClick="selectRepair"
android:text="显示\n返修"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="15sp" android:textSize="15sp"
android:textStyle="bold" android:textStyle="bold"
android:onClick="selectRepair" android:visibility="@{vm.buttonVisbleState? View.VISIBLE : View.GONE}" />
android:visibility="@{vm.buttonVisbleState? View.VISIBLE : View.GONE}" </LinearLayout>
android:text="显示\n返修" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="当班检测数据"
android:textColor="@color/blue" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="43dp"
android:layout_marginTop="5dp"
android:layout_marginEnd="4dp"
android:background="@color/white"
android:orientation="horizontal">
<TextView
style="@style/text_style1"
android:layout_width="100dp"
android:layout_height="match_parent"
android:background="@color/grey"
android:text="已检测数量:" />
<TextView
style="@style/text_style1_1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="@{String.valueOf(sum.QUANTITY_SUM)}" />
<TextView
style="@style/text_style1"
android:layout_width="80dp"
android:layout_height="match_parent"
android:background="@color/grey"
android:text="返修数量:" />
<TextView
style="@style/text_style1_1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="@{String.valueOf(sum.REPAIR_SUM)}" />
</LinearLayout> </LinearLayout>
<TextView <TextView
@ -123,10 +181,6 @@
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" /> app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
<Button <Button
style="@style/button_true_style" style="@style/button_true_style"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -135,15 +189,9 @@
android:onClick="checkSubmint" android:onClick="checkSubmint"
android:text="提交" /> android:text="提交" />
<Button
style="@style/button_true_style" <!-- 查询数据 -->
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_margin="10dp"
android:onClick="checkSubmint1"
android:visibility="gone"
android:text="测试" />
<!-- -->
</LinearLayout> </LinearLayout>
</ScrollView>
</layout> </layout>
Loading…
Cancel
Save