增加 - 查询质检数量

master
wangh 2 years ago
parent 3471f2779f
commit ab0c066f18

@ -10,8 +10,8 @@ android {
applicationId "com.example.aucma_mes"
minSdk 24
targetSdk 33
versionCode 5
versionName "1.0"
versionCode 8
versionName "1.8"
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", ""))
.params("boxCode", boxCode.get())
.params("innerCode", innerCode.get())
.params("loginName", SharedPreferencesUtils.getstring("pdaName", ""))
.params("loginName", SharedPreferencesUtils.getstring("loginName", ""))
.execute(new StringCallback() {
@Override
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.databinding.ActivityCheckBinding;
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.DictBeen;
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<List<String>>> options3;
private List<DefectBeen> topDefects;
private String stationCode;
private CheckSum checkSum;
@Override
protected void onCreate(Bundle 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);
checkViewModel = new CheckViewModel();
getSupportActionBar().hide();
@ -64,13 +79,28 @@ public class CheckActivity extends BaseActivity implements CheckAdapter.CheckIte
submitList = new ArrayList<>();
checkAdapter.setList(submitList);
binding.recyclerView.setAdapter(checkAdapter);
Intent intent = getIntent();
String stationCode = intent.getStringExtra("stationCode");
checkViewModel.setStationCode(stationCode);
binding.setTitle("质量检测 - "+ intent.getStringExtra("stationName"));
// 三联
initOptionpb(stationCode);
tipDialog = new RepairSubmintInfoDialog(this, this);
checkSum=new CheckSum();
binding.setSum(checkSum);
}
private void initStationSum() {
OkGo.<Result>post(url + "/api/pdaQueryQuantityNumber").tag(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,29 +151,29 @@ public class CheckActivity extends BaseActivity implements CheckAdapter.CheckIte
if (checkViewModel.getName() == null || checkViewModel.getName().isEmpty()) return;
checkViewModel.setList(submitList);
checkViewModel.setMeasure(submitList.isEmpty() ? "3" : "1");
checkViewModel.setUserName(SharedPreferencesUtils.getstring("pdaName", "pda01"));
checkViewModel.setTeamCode(SharedPreferencesUtils.getstring("teamCode",null));
checkViewModel.setUserName(SharedPreferencesUtils.getstring("loginName", "pda01"));
checkViewModel.setTeamCode(SharedPreferencesUtils.getstring("teamCode", null));
OkGo.<Result>post(url + "/api/checkSubmit").tag(this)
.headers("Authorization", SharedPreferencesUtils.getstring("token", ""))
.upRequestBody(RequestBody.create(JSON, gson.toJson(checkViewModel)))
.execute(new MyRecultCall(dialog, this) {
@Override
public void onSuccess(Response<Result> response) {
super.onSuccess(response);
Result result = response.body();
if (result.getCode() == 200) {
Toast.makeText(CheckActivity.this, "提交成功", Toast.LENGTH_SHORT).show();
checkViewModel.setCode(null);
checkViewModel.setName(null);
checkViewModel.setDefect(null);
checkViewModel.setButtonVisbleState(false);
submitList.clear();
checkAdapter.notifyDataSetChanged();
} else {
Toast.makeText(CheckActivity.this, result.getMsg(), Toast.LENGTH_SHORT).show();
}
}
});
@Override
public void onSuccess(Response<Result> response) {
super.onSuccess(response);
Result result = response.body();
if (result.getCode() == 200) {
Toast.makeText(CheckActivity.this, "提交成功", Toast.LENGTH_SHORT).show();
checkViewModel.setCode(null);
checkViewModel.setName(null);
checkViewModel.setDefect(null);
checkViewModel.setButtonVisbleState(false);
submitList.clear();
checkAdapter.notifyDataSetChanged();
} else {
Toast.makeText(CheckActivity.this, result.getMsg(), Toast.LENGTH_SHORT).show();
}
}
});
}
// 删除缺陷
@ -159,55 +189,55 @@ public class CheckActivity extends BaseActivity implements CheckAdapter.CheckIte
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) {
@Override
public void onSuccess(Response<Result> response) {
super.onSuccess(response);
Result body = response.body();
Log.e("TAG", "onSuccess:" + body.toString());
if (body.getCode() == 200) {
Toast.makeText(CheckActivity.this, "请求成功", Toast.LENGTH_SHORT).show();
list = gson.fromJson(gson.toJson(body.getData()), new TypeToken<List<DefectBeen>>() {
}.getType());
if (list == null || list.isEmpty()) {
Toast.makeText(CheckActivity.this, "缺陷列表没有维护", Toast.LENGTH_SHORT).show();
return;
@Override
public void onSuccess(Response<Result> response) {
super.onSuccess(response);
Result body = response.body();
Log.e("TAG", "onSuccess:" + body.toString());
if (body.getCode() == 200) {
Toast.makeText(CheckActivity.this, "请求成功", Toast.LENGTH_SHORT).show();
list = gson.fromJson(gson.toJson(body.getData()), new TypeToken<List<DefectBeen>>() {
}.getType());
if (list == null || list.isEmpty()) {
Toast.makeText(CheckActivity.this, "缺陷列表没有维护", Toast.LENGTH_SHORT).show();
return;
}
options1 = new ArrayList<>();
options2 = new ArrayList<>();
options3 = new ArrayList<>();
list.forEach(defect -> {
String materialCategories = defect.getMaterialCategories();
String materialSubclass = defect.getMaterialSubclass();
String qualityDefectName = defect.getQualityDefectName();
if (!options1.contains(materialCategories)) {
options1.add(materialCategories);
}
int index1 = options1.indexOf(materialCategories);
if (options2.size() <= index1) {
options2.add(new ArrayList<>());
}
if (!options2.get(index1).contains(materialSubclass)) {
options2.get(index1).add(materialSubclass);
}
int index2 = options2.get(index1).indexOf(materialSubclass);
if (options3.size() <= index1) {
options3.add(new ArrayList<>());
}
if (options3.get(index1).size() <= index2) {
options3.get(index1).add(new ArrayList<>());
}
if (!options3.get(index1).get(index2).contains(qualityDefectName)) {
options3.get(index1).get(index2).add(qualityDefectName);
}
});
opv.setPicker(options1, options2, options3);
} else {
Toast.makeText(CheckActivity.this, body.getMsg(), Toast.LENGTH_SHORT).show();
}
}
options1 = new ArrayList<>();
options2 = new ArrayList<>();
options3 = new ArrayList<>();
list.forEach(defect -> {
String materialCategories = defect.getMaterialCategories();
String materialSubclass = defect.getMaterialSubclass();
String qualityDefectName = defect.getQualityDefectName();
if (!options1.contains(materialCategories)) {
options1.add(materialCategories);
}
int index1 = options1.indexOf(materialCategories);
if (options2.size() <= index1) {
options2.add(new ArrayList<>());
}
if (!options2.get(index1).contains(materialSubclass)) {
options2.get(index1).add(materialSubclass);
}
int index2 = options2.get(index1).indexOf(materialSubclass);
if (options3.size() <= index1) {
options3.add(new ArrayList<>());
}
if (options3.get(index1).size() <= index2) {
options3.get(index1).add(new ArrayList<>());
}
if (!options3.get(index1).get(index2).contains(qualityDefectName)) {
options3.get(index1).get(index2).add(qualityDefectName);
}
});
opv.setPicker(options1, options2, options3);
} else {
Toast.makeText(CheckActivity.this, body.getMsg(), Toast.LENGTH_SHORT).show();
}
}
});
});
}
// 三联添加

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

@ -45,7 +45,7 @@ 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("pdaName", "");
String loginName = SharedPreferencesUtils.getstring("loginName", "");
user = new User();
user.setUsername(loginName);
user.setPassword("123456");
@ -176,7 +176,7 @@ public class MainActivity extends BaseActivity {
Intent intent = new Intent(MainActivity.this, HomePageActivity.class);
intent.putExtra("role", loginBack.getRoles());
intent.putExtra("info", body);
SharedPreferencesUtils.putstring("pdaName", user.username);
SharedPreferencesUtils.putstring("loginName", user.username);
SharedPreferencesUtils.putstring("teamCode", user.getTeamCode());
SharedPreferencesUtils.putstring("teamName", user.getTeamName());
SharedPreferencesUtils.putstring("token", token);

@ -97,7 +97,7 @@ public class RepairActivity extends BaseActivity {
public void repairSubmit(View view) {
if (submitList.isEmpty()) return;
RepairSubmitInfo repairSubmitInfo =new RepairSubmitInfo(submitList,
SharedPreferencesUtils.getstring("pdaName", "pda01")
SharedPreferencesUtils.getstring("loginName", "pda01")
,repairVm.getRepairName(),repairVm.getIsFlag());
MediaType JSON = MediaType.parse("application/json; charset=utf-8");
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,146 +4,194 @@
xmlns:tools="http://schemas.android.com/tools">
<data>
<variable
name="title"
type="String" />
name="title"
type="String" />
<variable
name="vm"
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>
<LinearLayout
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/grey"
android:orientation="vertical"
tools:context=".CheckActivity">
<TextView
android:layout_width="match_parent"
android:layout_height="45dp"
android:background="@color/blue"
android:gravity="center|left"
android:paddingStart="12dp"
android:text="@{title}"
android:textColor="@color/white"
android:textSize="20sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="43dp"
android:layout_marginTop="5dp"
android:layout_marginEnd="4dp">
<TextView
style="@style/text_style1"
android:layout_width="90dp"
android:layout_height="match_parent"
android:text="产品条码:" />
<TextView
style="@style/san_text_style"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@={vm.code}" />
</LinearLayout>
<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="90dp"
android:layout_height="match_parent"
android:background="@color/grey"
android:text="产品型号:" />
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
style="@style/text_style1_1"
android:text="@{vm.name}"/>
</LinearLayout>
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="43dp"
android:layout_marginTop="5dp"
android:layout_marginEnd="4dp">
android:layout_height="match_parent"
android:background="@color/grey"
android:orientation="vertical"
tools:context=".CheckActivity">
<TextView
style="@style/text_style1"
android:layout_width="90dp"
android:layout_height="match_parent"
android:text="选择缺陷:" />
<TextView
style="@style/text_style1_1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:drawableRight="@mipmap/icon_select"
android:onClick="checkSelect"
android:layout_weight="1"
android:paddingEnd="10dp"
android:text="@{vm.defect}" />
<TextView
android:gravity="center"
android:layout_width="50dp"
android:layout_height="match_parent"
android:background="@drawable/button_w"
android:layout_height="45dp"
android:background="@color/blue"
android:gravity="center|left"
android:paddingStart="12dp"
android:text="@{title}"
android:textColor="@color/white"
android:textSize="15sp"
android:textStyle="bold"
android:onClick="selectRepair"
android:visibility="@{vm.buttonVisbleState? View.VISIBLE : View.GONE}"
android:text="显示\n返修" />
android:textSize="20sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="43dp"
android:layout_marginTop="5dp"
android:layout_marginEnd="4dp">
<TextView
style="@style/text_style1"
android:layout_width="90dp"
android:layout_height="match_parent"
android:text="产品条码:" />
<TextView
style="@style/san_text_style"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@={vm.code}" />
</LinearLayout>
<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="90dp"
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:text="@{vm.name}" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="43dp"
android:layout_marginTop="5dp"
android:layout_marginEnd="4dp">
<TextView
style="@style/text_style1"
android:layout_width="90dp"
android:layout_height="match_parent"
android:text="选择缺陷:" />
<TextView
style="@style/text_style1_1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:drawableRight="@mipmap/icon_select"
android:onClick="checkSelect"
android:paddingEnd="10dp"
android:text="@{vm.defect}" />
<TextView
android:layout_width="50dp"
android:layout_height="match_parent"
android:background="@drawable/button_w"
android:gravity="center"
android:onClick="selectRepair"
android:text="显示\n返修"
android:textColor="@color/white"
android:textSize="15sp"
android:textStyle="bold"
android:visibility="@{vm.buttonVisbleState? View.VISIBLE : View.GONE}" />
</LinearLayout>
<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>
<TextView
android:layout_width="90dp"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:text="缺陷详情"
android:textColor="@color/purple_700" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="224dp"
android:background="@color/white"
android:padding="5dp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
<Button
style="@style/button_true_style"
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_margin="10dp"
android:onClick="checkSubmint"
android:text="提交" />
<!-- 查询数据 -->
</LinearLayout>
<TextView
android:layout_width="90dp"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:text="缺陷详情"
android:textColor="@color/purple_700" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="224dp"
android:background="@color/white"
android:padding="5dp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
<Button
style="@style/button_true_style"
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_margin="10dp"
android:onClick="checkSubmint"
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>
</ScrollView>
</layout>
Loading…
Cancel
Save