|
|
@ -8,25 +8,23 @@ import android.widget.Toast;
|
|
|
|
|
|
|
|
|
|
|
|
import androidx.databinding.DataBindingUtil;
|
|
|
|
import androidx.databinding.DataBindingUtil;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.bigkoo.pickerview.builder.OptionsPickerBuilder;
|
|
|
|
import com.bigkoo.pickerview.builder.OptionsPickerBuilder;
|
|
|
|
import com.bigkoo.pickerview.listener.OnOptionsSelectListener;
|
|
|
|
import com.bigkoo.pickerview.listener.OnOptionsSelectListener;
|
|
|
|
import com.bigkoo.pickerview.view.OptionsPickerView;
|
|
|
|
import com.bigkoo.pickerview.view.OptionsPickerView;
|
|
|
|
import com.example.haiwei_mom.R;
|
|
|
|
import com.example.haiwei_mom.R;
|
|
|
|
import com.example.haiwei_mom.adapter.CheckAdapter;
|
|
|
|
import com.example.haiwei_mom.adapter.CheckAdapter;
|
|
|
|
import com.example.haiwei_mom.base.BaseActivity;
|
|
|
|
import com.example.haiwei_mom.base.BaseActivity;
|
|
|
|
|
|
|
|
|
|
|
|
import com.example.haiwei_mom.base.MyRecultCall;
|
|
|
|
import com.example.haiwei_mom.base.MyRecultCall;
|
|
|
|
import com.example.haiwei_mom.base.MyResult;
|
|
|
|
import com.example.haiwei_mom.base.MyResult;
|
|
|
|
import com.example.haiwei_mom.databinding.ActivityCheckBinding;
|
|
|
|
import com.example.haiwei_mom.databinding.ActivityCheckBinding;
|
|
|
|
import com.example.haiwei_mom.qm.data.CheckViewModel;
|
|
|
|
import com.example.haiwei_mom.qm.data.CheckViewModel;
|
|
|
|
import com.example.haiwei_mom.qm.data.DefectBeen;
|
|
|
|
import com.example.haiwei_mom.qm.data.DefectBeen;
|
|
|
|
|
|
|
|
import com.example.haiwei_mom.qm.data.QcTaskInfo;
|
|
|
|
import com.example.haiwei_mom.uitls.SharedPreferencesUtils;
|
|
|
|
import com.example.haiwei_mom.uitls.SharedPreferencesUtils;
|
|
|
|
import com.google.gson.reflect.TypeToken;
|
|
|
|
import com.google.gson.reflect.TypeToken;
|
|
|
|
import com.lzy.okgo.OkGo;
|
|
|
|
import com.lzy.okgo.OkGo;
|
|
|
|
import com.lzy.okgo.model.Response;
|
|
|
|
import com.lzy.okgo.model.Response;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
|
@ -49,55 +47,31 @@ public class CheckActivity extends BaseActivity implements CheckAdapter.CheckIte
|
|
|
|
@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() {
|
|
|
|
|
|
|
|
ActivityCheckBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_check);
|
|
|
|
ActivityCheckBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_check);
|
|
|
|
checkViewModel = new CheckViewModel();
|
|
|
|
checkViewModel = new CheckViewModel();
|
|
|
|
|
|
|
|
|
|
|
|
binding.setVm(checkViewModel);
|
|
|
|
binding.setVm(checkViewModel);
|
|
|
|
checkAdapter = new CheckAdapter(this, this);
|
|
|
|
checkAdapter = new CheckAdapter(this, this);
|
|
|
|
submitList = new ArrayList<>();
|
|
|
|
submitList = new ArrayList<>();
|
|
|
|
checkAdapter.setList(submitList);
|
|
|
|
checkAdapter.setList(submitList);
|
|
|
|
binding.recyclerView.setAdapter(checkAdapter);
|
|
|
|
binding.recyclerView.setAdapter(checkAdapter);
|
|
|
|
|
|
|
|
binding.checkGoodsCode.setOnEditorActionListener((v, actionId, event) -> {
|
|
|
|
}
|
|
|
|
selectGoodsInfo(v.getText().toString());
|
|
|
|
|
|
|
|
return true;
|
|
|
|
private void initStationSum() {
|
|
|
|
|
|
|
|
OkGo.<MyResult>post(url + "/api/pdaQueryQuantityNumber").tag(this).params("stationCode", stationCode).execute(new MyRecultCall(dialog, this) {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void onSuccess(Response<MyResult> response) {
|
|
|
|
|
|
|
|
super.onSuccess(response);
|
|
|
|
|
|
|
|
var 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());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void getScannerData(String code) {
|
|
|
|
public void getScannerData(String code) {
|
|
|
|
super.getScannerData(code);
|
|
|
|
super.getScannerData(code);
|
|
|
|
checkViewModel.setCode(code);
|
|
|
|
selectGoodsInfo(code);
|
|
|
|
OkGo.<MyResult>post(url + "/dev-api/api/pdaApi/getMateriallnfo" + code).tag(this)
|
|
|
|
|
|
|
|
// .params("code", code)
|
|
|
|
}
|
|
|
|
|
|
|
|
// 查询物料
|
|
|
|
|
|
|
|
public void selectGoodsInfo(String code) {
|
|
|
|
|
|
|
|
OkGo.<MyResult>get(url + "/api/pdaApi/getMaterialInfo").tag(this)
|
|
|
|
|
|
|
|
.params("code", code)
|
|
|
|
// .params("station", stationCode)
|
|
|
|
// .params("station", stationCode)
|
|
|
|
.execute(new MyRecultCall(dialog, this) {
|
|
|
|
.execute(new MyRecultCall(dialog, this) {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
@ -105,6 +79,9 @@ public class CheckActivity extends BaseActivity implements CheckAdapter.CheckIte
|
|
|
|
super.onSuccess(response);
|
|
|
|
super.onSuccess(response);
|
|
|
|
var result = response.body();
|
|
|
|
var result = response.body();
|
|
|
|
if (result.getCode() == 200) {
|
|
|
|
if (result.getCode() == 200) {
|
|
|
|
|
|
|
|
QcTaskInfo qcTaskInfo=gson.fromJson(result.getDataJson(),QcTaskInfo.class);
|
|
|
|
|
|
|
|
checkViewModel.setName(qcTaskInfo.getMaterialName());
|
|
|
|
|
|
|
|
initOptionpb( qcTaskInfo.getOperation());
|
|
|
|
/* checkViewModel.setName(result.getMsg());
|
|
|
|
/* checkViewModel.setName(result.getMsg());
|
|
|
|
topDefects = gson.fromJson(gson.toJson(result.getData()), new TypeToken<List<DefectBeen>>() {
|
|
|
|
topDefects = gson.fromJson(gson.toJson(result.getData()), new TypeToken<List<DefectBeen>>() {
|
|
|
|
}.getType());
|
|
|
|
}.getType());
|
|
|
@ -115,6 +92,7 @@ public class CheckActivity extends BaseActivity implements CheckAdapter.CheckIte
|
|
|
|
checkViewModel.setButtonVisbleState(true);*/
|
|
|
|
checkViewModel.setButtonVisbleState(true);*/
|
|
|
|
// tipDialog.setList(topDefects);
|
|
|
|
// tipDialog.setList(topDefects);
|
|
|
|
// tipDialog.show();
|
|
|
|
// tipDialog.show();
|
|
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -122,26 +100,24 @@ public class CheckActivity extends BaseActivity implements CheckAdapter.CheckIte
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 弹出选择框
|
|
|
|
// 弹出选择框
|
|
|
|
public void checkSelect(View view) {
|
|
|
|
public void checkSelect(View view) {
|
|
|
|
|
|
|
|
if (options1==null ||list.isEmpty()) return;
|
|
|
|
opv.show();
|
|
|
|
opv.show();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 弹出返修
|
|
|
|
|
|
|
|
// public void selectRepair(View view) {
|
|
|
|
|
|
|
|
// tipDialog.show();
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void checkSubmint1(View view) {
|
|
|
|
|
|
|
|
getScannerData("B24031483025025351528");
|
|
|
|
|
|
|
|
} // 提交
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void checkSubmint(View view) {
|
|
|
|
public void checkSubmint(View view) {
|
|
|
|
if (checkViewModel.getName() == null || checkViewModel.getName().isEmpty()) return;
|
|
|
|
if (checkViewModel.getName() == null || checkViewModel.getName().isEmpty()) return;
|
|
|
|
checkViewModel.setList(submitList);
|
|
|
|
Toast.makeText(context, "质检完成", Toast.LENGTH_SHORT).show();
|
|
|
|
|
|
|
|
finish();
|
|
|
|
|
|
|
|
/* checkViewModel.setList(submitList);
|
|
|
|
checkViewModel.setMeasure(submitList.isEmpty() ? "3" : "1");
|
|
|
|
checkViewModel.setMeasure(submitList.isEmpty() ? "3" : "1");
|
|
|
|
checkViewModel.setUserName(SharedPreferencesUtils.getstring("loginName", "pda01"));
|
|
|
|
checkViewModel.setUserName(SharedPreferencesUtils.getstring("loginName", "pda01"));
|
|
|
|
checkViewModel.setTeamCode(SharedPreferencesUtils.getstring("teamCode", null));
|
|
|
|
checkViewModel.setTeamCode(SharedPreferencesUtils.getstring("teamCode", null));
|
|
|
@ -158,12 +134,12 @@ public class CheckActivity extends BaseActivity implements CheckAdapter.CheckIte
|
|
|
|
checkViewModel.setButtonVisbleState(false);
|
|
|
|
checkViewModel.setButtonVisbleState(false);
|
|
|
|
submitList.clear();
|
|
|
|
submitList.clear();
|
|
|
|
checkAdapter.notifyDataSetChanged();
|
|
|
|
checkAdapter.notifyDataSetChanged();
|
|
|
|
initStationSum();
|
|
|
|
// initStationSum();
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
Toast.makeText(CheckActivity.this, result.getMsg(), Toast.LENGTH_SHORT).show();
|
|
|
|
Toast.makeText(CheckActivity.this, result.getMsg(), Toast.LENGTH_SHORT).show();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});*/
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 删除缺陷
|
|
|
|
// 删除缺陷
|
|
|
@ -177,7 +153,9 @@ public class CheckActivity extends BaseActivity implements CheckAdapter.CheckIte
|
|
|
|
// 初始化-联动选择
|
|
|
|
// 初始化-联动选择
|
|
|
|
private void initOptionpb(String stationCode) {
|
|
|
|
private void initOptionpb(String stationCode) {
|
|
|
|
opv = new OptionsPickerBuilder(this, this).build();
|
|
|
|
opv = new OptionsPickerBuilder(this, this).build();
|
|
|
|
OkGo.<MyResult>get(url + "/base/qualityInspectionItem/getQualityDefects/" + stationCode).tag(this).execute(new MyRecultCall(dialog, this) {
|
|
|
|
OkGo.<MyResult>get(url + "/api/pdaApi/getDefectDetail")
|
|
|
|
|
|
|
|
// .params("defectType", "BZP_DEFECT")
|
|
|
|
|
|
|
|
.params("defectType", stationCode).execute(new MyRecultCall(dialog, this) {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onSuccess(Response<MyResult> response) {
|
|
|
|
public void onSuccess(Response<MyResult> response) {
|
|
|
|
super.onSuccess(response);
|
|
|
|
super.onSuccess(response);
|
|
|
@ -191,36 +169,38 @@ public class CheckActivity extends BaseActivity implements CheckAdapter.CheckIte
|
|
|
|
Toast.makeText(CheckActivity.this, "缺陷列表没有维护", Toast.LENGTH_SHORT).show();
|
|
|
|
Toast.makeText(CheckActivity.this, "缺陷列表没有维护", Toast.LENGTH_SHORT).show();
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
options1 = new ArrayList<>();
|
|
|
|
options1 = new ArrayList<>(list.size());
|
|
|
|
options2 = new ArrayList<>();
|
|
|
|
// options2 = new ArrayList<>();
|
|
|
|
options3 = new ArrayList<>();
|
|
|
|
// options3 = new ArrayList<>();
|
|
|
|
list.forEach(defect -> {
|
|
|
|
list.forEach(defect -> {
|
|
|
|
String materialCategories = defect.getMaterialCategories();
|
|
|
|
options1.add(defect.getDefectDesc());
|
|
|
|
String materialSubclass = defect.getMaterialSubclass();
|
|
|
|
// String materialCategories = defect.getMaterialCategories();
|
|
|
|
String qualityDefectName = defect.getQualityDefectName();
|
|
|
|
// String materialSubclass = defect.getMaterialSubclass();
|
|
|
|
|
|
|
|
// String qualityDefectName = defect.getQualityDefectName();
|
|
|
|
if (!options1.contains(materialCategories)) {
|
|
|
|
//
|
|
|
|
options1.add(materialCategories);
|
|
|
|
// if (!options1.contains(materialCategories)) {
|
|
|
|
}
|
|
|
|
// options1.add(materialCategories);
|
|
|
|
int index1 = options1.indexOf(materialCategories);
|
|
|
|
// }
|
|
|
|
if (options2.size() <= index1) {
|
|
|
|
// int index1 = options1.indexOf(materialCategories);
|
|
|
|
options2.add(new ArrayList<>());
|
|
|
|
// if (options2.size() <= index1) {
|
|
|
|
}
|
|
|
|
// options2.add(new ArrayList<>());
|
|
|
|
if (!options2.get(index1).contains(materialSubclass)) {
|
|
|
|
// }
|
|
|
|
options2.get(index1).add(materialSubclass);
|
|
|
|
// if (!options2.get(index1).contains(materialSubclass)) {
|
|
|
|
}
|
|
|
|
// options2.get(index1).add(materialSubclass);
|
|
|
|
int index2 = options2.get(index1).indexOf(materialSubclass);
|
|
|
|
// }
|
|
|
|
if (options3.size() <= index1) {
|
|
|
|
// int index2 = options2.get(index1).indexOf(materialSubclass);
|
|
|
|
options3.add(new ArrayList<>());
|
|
|
|
// if (options3.size() <= index1) {
|
|
|
|
}
|
|
|
|
// options3.add(new ArrayList<>());
|
|
|
|
if (options3.get(index1).size() <= index2) {
|
|
|
|
// }
|
|
|
|
options3.get(index1).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);
|
|
|
|
// if (!options3.get(index1).get(index2).contains(qualityDefectName)) {
|
|
|
|
}
|
|
|
|
// options3.get(index1).get(index2).add(qualityDefectName);
|
|
|
|
|
|
|
|
// }
|
|
|
|
});
|
|
|
|
});
|
|
|
|
opv.setPicker(options1, options2, options3);
|
|
|
|
// opv.setPicker(options1, options2, options3);
|
|
|
|
|
|
|
|
opv.setPicker(options1);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
Toast.makeText(CheckActivity.this, body.getMsg(), Toast.LENGTH_SHORT).show();
|
|
|
|
Toast.makeText(CheckActivity.this, body.getMsg(), Toast.LENGTH_SHORT).show();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -232,10 +212,10 @@ public class CheckActivity extends BaseActivity implements CheckAdapter.CheckIte
|
|
|
|
// 三联添加
|
|
|
|
// 三联添加
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onOptionsSelect(int options1, int options2, int options3, View v) {
|
|
|
|
public void onOptionsSelect(int options1, int options2, int options3, View v) {
|
|
|
|
String defectName = this.options3.get(options1).get(options2).get(options3);
|
|
|
|
String defectName = this.options1.get(options1);
|
|
|
|
checkViewModel.setDefect(defectName);
|
|
|
|
checkViewModel.setDefect(defectName);
|
|
|
|
DefectBeen defectBeen = new DefectBeen();
|
|
|
|
DefectBeen defectBeen = new DefectBeen();
|
|
|
|
defectBeen.setQualityDefectName(defectName);
|
|
|
|
defectBeen.setDefectDesc(defectName);
|
|
|
|
DefectBeen defectBeen1 = list.get(list.indexOf(defectBeen));
|
|
|
|
DefectBeen defectBeen1 = list.get(list.indexOf(defectBeen));
|
|
|
|
if (submitList.contains(defectBeen1)) {
|
|
|
|
if (submitList.contains(defectBeen1)) {
|
|
|
|
Toast.makeText(this, "已经添加了", Toast.LENGTH_SHORT).show();
|
|
|
|
Toast.makeText(this, "已经添加了", Toast.LENGTH_SHORT).show();
|
|
|
|