|
|
|
|
@ -11,6 +11,7 @@ import android.widget.Toast;
|
|
|
|
|
import com.example.aucma_mes.adapter.RepairAdapter;
|
|
|
|
|
import com.example.aucma_mes.base.BaseActivity;
|
|
|
|
|
import com.example.aucma_mes.databinding.ActivityRepairBinding;
|
|
|
|
|
import com.example.aucma_mes.entity.CheckSum;
|
|
|
|
|
import com.example.aucma_mes.entity.DefectBeen;
|
|
|
|
|
import com.example.aucma_mes.entity.RepairSubmitInfo;
|
|
|
|
|
import com.example.aucma_mes.entity.RepairMeasures;
|
|
|
|
|
@ -43,14 +44,14 @@ public class RepairActivity extends BaseActivity {
|
|
|
|
|
binding = DataBindingUtil.setContentView(this, R.layout.activity_repair);
|
|
|
|
|
adapter = new RepairAdapter(this);
|
|
|
|
|
repairVm = new RepairVm();
|
|
|
|
|
binding.setTitle("质量返修 — "+getIntent().getStringExtra("stationName"));
|
|
|
|
|
binding.setTitle("质量返修 — " + getIntent().getStringExtra("stationName"));
|
|
|
|
|
binding.setVm(repairVm);
|
|
|
|
|
submitList = new ArrayList<>();
|
|
|
|
|
binding.recyclerView.setAdapter(adapter);
|
|
|
|
|
//查询返修措施
|
|
|
|
|
// 查询返修措施
|
|
|
|
|
OkGo.<Result>get(url + "/report/repairMeasures/getRepairMeasures").tag(this)
|
|
|
|
|
.headers("Authorization", SharedPreferencesUtils.getstring("token", ""))
|
|
|
|
|
.params("userPermission",getIntent().getIntExtra("userPermission",-1))
|
|
|
|
|
.params("userPermission", getIntent().getIntExtra("userPermission", -1))
|
|
|
|
|
.execute(new MyRecultCall(dialog, this) {
|
|
|
|
|
@Override
|
|
|
|
|
public void onSuccess(Response<Result> response) {
|
|
|
|
|
@ -65,6 +66,35 @@ public class RepairActivity extends BaseActivity {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
checkSum = new CheckSum();
|
|
|
|
|
stationCode = getIntent().getStringExtra("stationCode");
|
|
|
|
|
binding.setSum(checkSum);
|
|
|
|
|
initStationSum();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private CheckSum checkSum;
|
|
|
|
|
private String stationCode;
|
|
|
|
|
|
|
|
|
|
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());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@ -81,14 +111,13 @@ public class RepairActivity extends BaseActivity {
|
|
|
|
|
if (result.getCode() == 200) {
|
|
|
|
|
defectBeens = gson.fromJson(gson.toJson(result.getData()), new TypeToken<List<DefectBeen>>() {
|
|
|
|
|
}.getType());
|
|
|
|
|
Log.e("TAG", "onSuccess:" + defectBeens.toString());
|
|
|
|
|
Log.e("TAG", "onSuccess:" + defectBeens.toString());
|
|
|
|
|
defectBeens.forEach(t -> submitList.add(t.getObjId()));
|
|
|
|
|
adapter.setList(defectBeens);
|
|
|
|
|
adapter.notifyDataSetChanged();
|
|
|
|
|
repairVm.setMaterialName(defectBeens.get(0).getMaterialName());
|
|
|
|
|
} else {
|
|
|
|
|
Toast.makeText(RepairActivity.this, result.getMsg(), Toast.LENGTH_SHORT).show();
|
|
|
|
|
repairSubmit(null);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
@ -96,11 +125,11 @@ public class RepairActivity extends BaseActivity {
|
|
|
|
|
|
|
|
|
|
public void repairSubmit(View view) {
|
|
|
|
|
if (submitList.isEmpty()) return;
|
|
|
|
|
RepairSubmitInfo repairSubmitInfo =new RepairSubmitInfo(submitList,
|
|
|
|
|
RepairSubmitInfo repairSubmitInfo = new RepairSubmitInfo(submitList,
|
|
|
|
|
SharedPreferencesUtils.getstring("loginName", "pda01")
|
|
|
|
|
,repairVm.getRepairName(),repairVm.getIsFlag());
|
|
|
|
|
, repairVm.getRepairName(), repairVm.getIsFlag());
|
|
|
|
|
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));
|
|
|
|
|
OkGo.<Result>post(url + "/api/submitRepair")
|
|
|
|
|
.tag(this).headers("Authorization", SharedPreferencesUtils.getstring("token", ""))
|
|
|
|
|
.upRequestBody(body)
|
|
|
|
|
@ -110,12 +139,13 @@ public class RepairActivity extends BaseActivity {
|
|
|
|
|
super.onSuccess(response);
|
|
|
|
|
Result result = response.body();
|
|
|
|
|
Toast.makeText(RepairActivity.this, result.getMsg(), Toast.LENGTH_SHORT).show();
|
|
|
|
|
if (result.getCode()==200){
|
|
|
|
|
if (result.getCode() == 200) {
|
|
|
|
|
defectBeens.clear();
|
|
|
|
|
adapter.notifyDataSetChanged();
|
|
|
|
|
repairVm.setCode(null);
|
|
|
|
|
repairVm.setMaterialName(null);
|
|
|
|
|
submitList.clear();
|
|
|
|
|
initStationSum();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|