|
|
|
@ -127,14 +127,17 @@ import com.rehome.dywoa.utils.BitmapUtil;
|
|
|
|
import com.rehome.dywoa.utils.FullyGridLayoutManager;
|
|
|
|
import com.rehome.dywoa.utils.FullyGridLayoutManager;
|
|
|
|
import com.rehome.dywoa.utils.GsonUtils;
|
|
|
|
import com.rehome.dywoa.utils.GsonUtils;
|
|
|
|
import com.rehome.dywoa.utils.HttpListener;
|
|
|
|
import com.rehome.dywoa.utils.HttpListener;
|
|
|
|
|
|
|
|
import com.rehome.dywoa.utils.HttpResponseListener;
|
|
|
|
import com.rehome.dywoa.utils.NohttpUtils;
|
|
|
|
import com.rehome.dywoa.utils.NohttpUtils;
|
|
|
|
import com.rehome.dywoa.utils.SPUtils;
|
|
|
|
import com.rehome.dywoa.utils.SPUtils;
|
|
|
|
import com.rehome.dywoa.utils.UiUtlis;
|
|
|
|
import com.rehome.dywoa.utils.UiUtlis;
|
|
|
|
|
|
|
|
import com.rehome.dywoa.weiget.WaitDialog;
|
|
|
|
import com.yalantis.ucrop.UCrop;
|
|
|
|
import com.yalantis.ucrop.UCrop;
|
|
|
|
import com.yalantis.ucrop.UCropImageEngine;
|
|
|
|
import com.yalantis.ucrop.UCropImageEngine;
|
|
|
|
import com.yolanda.nohttp.NoHttp;
|
|
|
|
import com.yolanda.nohttp.NoHttp;
|
|
|
|
import com.yolanda.nohttp.RequestMethod;
|
|
|
|
import com.yolanda.nohttp.RequestMethod;
|
|
|
|
import com.yolanda.nohttp.rest.Request;
|
|
|
|
import com.yolanda.nohttp.rest.Request;
|
|
|
|
|
|
|
|
import com.yolanda.nohttp.rest.RequestQueue;
|
|
|
|
import com.yolanda.nohttp.rest.Response;
|
|
|
|
import com.yolanda.nohttp.rest.Response;
|
|
|
|
import org.litepal.crud.DataSupport;
|
|
|
|
import org.litepal.crud.DataSupport;
|
|
|
|
|
|
|
|
|
|
|
|
@ -154,8 +157,6 @@ import top.zibin.luban.OnRenameListener;
|
|
|
|
|
|
|
|
|
|
|
|
public class SQxgdlrfActivity extends BaseActivity {
|
|
|
|
public class SQxgdlrfActivity extends BaseActivity {
|
|
|
|
|
|
|
|
|
|
|
|
// QxgdListActivity
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
EditText etGd;
|
|
|
|
EditText etGd;
|
|
|
|
EditText etMs;
|
|
|
|
EditText etMs;
|
|
|
|
Spinner et_zy;
|
|
|
|
Spinner et_zy;
|
|
|
|
@ -232,6 +233,9 @@ public class SQxgdlrfActivity extends BaseActivity {
|
|
|
|
|
|
|
|
|
|
|
|
private QxgdInfo mQxgdInfo;
|
|
|
|
private QxgdInfo mQxgdInfo;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private RequestQueue queue;
|
|
|
|
|
|
|
|
private WaitDialog dialog;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void findView() {
|
|
|
|
private void findView() {
|
|
|
|
@ -262,6 +266,25 @@ public class SQxgdlrfActivity extends BaseActivity {
|
|
|
|
btnSc.setOnClickListener(new View.OnClickListener() {
|
|
|
|
btnSc.setOnClickListener(new View.OnClickListener() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onClick(View v) {
|
|
|
|
public void onClick(View v) {
|
|
|
|
|
|
|
|
if (!TextUtils.isEmpty(et_kks.getText().toString())
|
|
|
|
|
|
|
|
&& !TextUtils.isEmpty(etMs.getText().toString())) {
|
|
|
|
|
|
|
|
if(isEdit){
|
|
|
|
|
|
|
|
//编辑,上传
|
|
|
|
|
|
|
|
mData.clear();
|
|
|
|
|
|
|
|
mData.addAll(mAdapter.getData());
|
|
|
|
|
|
|
|
if (updateData()) {
|
|
|
|
|
|
|
|
showToast("保存成功");
|
|
|
|
|
|
|
|
//clearView();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
//新增,不保存直接上传
|
|
|
|
|
|
|
|
mData.clear();
|
|
|
|
|
|
|
|
mData.addAll(mAdapter.getData());
|
|
|
|
|
|
|
|
uploadDataByNoSave();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
showToast("你还有信息未填写");
|
|
|
|
|
|
|
|
}
|
|
|
|
//scData();
|
|
|
|
//scData();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
@ -311,8 +334,11 @@ public class SQxgdlrfActivity extends BaseActivity {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void initView() {
|
|
|
|
public void initView() {
|
|
|
|
username = App.getInstance().getUserInfo().getManid();
|
|
|
|
username = App.getInstance().getUserInfo().getManid();
|
|
|
|
|
|
|
|
queue = NoHttp.newRequestQueue(1);
|
|
|
|
|
|
|
|
dialog = new WaitDialog(context, "上传中...");
|
|
|
|
findView();
|
|
|
|
findView();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Intent intent = getIntent();
|
|
|
|
Intent intent = getIntent();
|
|
|
|
isEdit = intent.getBooleanExtra("edit",false);
|
|
|
|
isEdit = intent.getBooleanExtra("edit",false);
|
|
|
|
editIndex = intent.getIntExtra("index",0);
|
|
|
|
editIndex = intent.getIntExtra("index",0);
|
|
|
|
@ -343,6 +369,7 @@ public class SQxgdlrfActivity extends BaseActivity {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
btnSc.setVisibility(View.GONE);
|
|
|
|
}else{
|
|
|
|
}else{
|
|
|
|
initToolbar("缺陷工单新增", "缺陷管理", new View.OnClickListener() {
|
|
|
|
initToolbar("缺陷工单新增", "缺陷管理", new View.OnClickListener() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
@ -374,6 +401,12 @@ public class SQxgdlrfActivity extends BaseActivity {
|
|
|
|
initSpinnerGzlx();
|
|
|
|
initSpinnerGzlx();
|
|
|
|
if(isEdit){
|
|
|
|
if(isEdit){
|
|
|
|
getDataInSqlite();
|
|
|
|
getDataInSqlite();
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
Intent intent = getIntent();
|
|
|
|
|
|
|
|
String kksCode = intent.getStringExtra("kks");
|
|
|
|
|
|
|
|
if(!TextUtils.isEmpty(kksCode)){
|
|
|
|
|
|
|
|
et_kks.setText(kksCode);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -393,7 +426,14 @@ public class SQxgdlrfActivity extends BaseActivity {
|
|
|
|
//返回的文本内容
|
|
|
|
//返回的文本内容
|
|
|
|
String qrCodeStr = resultIntent.getStringExtra("result");
|
|
|
|
String qrCodeStr = resultIntent.getStringExtra("result");
|
|
|
|
showLog(qrCodeStr);
|
|
|
|
showLog(qrCodeStr);
|
|
|
|
et_kks.setText(qrCodeStr);
|
|
|
|
if(!TextUtils.isEmpty(qrCodeStr)){
|
|
|
|
|
|
|
|
if(qrCodeStr.startsWith("KK:")){
|
|
|
|
|
|
|
|
String qrCodeStrSub = qrCodeStr.replace("KK:","").trim();
|
|
|
|
|
|
|
|
et_kks.setText(qrCodeStrSub);
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
showToast("KKS码无法识别");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
@ -434,9 +474,23 @@ public class SQxgdlrfActivity extends BaseActivity {
|
|
|
|
private void initSpinnerGzlx() {
|
|
|
|
private void initSpinnerGzlx() {
|
|
|
|
adapterGzlx = new SpinnerAdapter(gzlxs, context);
|
|
|
|
adapterGzlx = new SpinnerAdapter(gzlxs, context);
|
|
|
|
et_gzlx.setAdapter(adapterGzlx);
|
|
|
|
et_gzlx.setAdapter(adapterGzlx);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//初始化响应等级选择
|
|
|
|
|
|
|
|
int itemGzlx = -1;
|
|
|
|
|
|
|
|
for (int i = 0; i < gzlxs.size(); i++) {
|
|
|
|
|
|
|
|
if (gzlxs.get(i).getValue().equals("CM(消缺)")) {
|
|
|
|
|
|
|
|
itemGzlx = i;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (itemGzlx != -1) {
|
|
|
|
|
|
|
|
et_gzlx.setSelection(itemGzlx);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void scData() {
|
|
|
|
private void scData() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//缺陷工单,如果缺陷工单为空,就没有上传
|
|
|
|
//缺陷工单,如果缺陷工单为空,就没有上传
|
|
|
|
List<QxgdInfo> infos = DataSupport.findAll(QxgdInfo.class);
|
|
|
|
List<QxgdInfo> infos = DataSupport.findAll(QxgdInfo.class);
|
|
|
|
if (infos.size() != 0) {
|
|
|
|
if (infos.size() != 0) {
|
|
|
|
@ -605,6 +659,134 @@ public class SQxgdlrfActivity extends BaseActivity {
|
|
|
|
return info.save();
|
|
|
|
return info.save();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void uploadDataByNoSave() {
|
|
|
|
|
|
|
|
finalList.clear();
|
|
|
|
|
|
|
|
for (LocalMedia media : mData) {
|
|
|
|
|
|
|
|
//finalList.add(media.getCompressPath());
|
|
|
|
|
|
|
|
if(media.getCompressPath()!=null){
|
|
|
|
|
|
|
|
finalList.add(media.getCompressPath());
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
if(media.getSandboxPath()!=null){
|
|
|
|
|
|
|
|
finalList.add(media.getSandboxPath());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
showLog(new Gson().toJson(media));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
showLog(finalList.toString().toLowerCase());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QxgdInfo info = new QxgdInfo();
|
|
|
|
|
|
|
|
info.setGzqx(UiUtlis.getText(etMs));
|
|
|
|
|
|
|
|
info.setKks(UiUtlis.getText(et_kks));
|
|
|
|
|
|
|
|
info.setZy(zys.get(et_zy.getSelectedItemPosition()).getKey());
|
|
|
|
|
|
|
|
info.setJz(jzs.get(et_jz.getSelectedItemPosition()).getKey());
|
|
|
|
|
|
|
|
info.setXydj(xydjs.get(et_xydj.getSelectedItemPosition()).getKey());
|
|
|
|
|
|
|
|
info.setGzlx(gzlxs.get(et_gzlx.getSelectedItemPosition()).getKey());
|
|
|
|
|
|
|
|
info.setZyDesc(zys.get(et_zy.getSelectedItemPosition()).getValue());
|
|
|
|
|
|
|
|
info.setJzDesc(jzs.get(et_jz.getSelectedItemPosition()).getValue());
|
|
|
|
|
|
|
|
info.setXydjDesc(xydjs.get(et_xydj.getSelectedItemPosition()).getValue());
|
|
|
|
|
|
|
|
info.setGzlxDesc(gzlxs.get(et_gzlx.getSelectedItemPosition()).getValue());
|
|
|
|
|
|
|
|
info.setBgr(username);
|
|
|
|
|
|
|
|
info.setUsername(username);
|
|
|
|
|
|
|
|
info.setDate(new SimpleDateFormat("yyyy-MM-dd HH:mm").format(new Date()));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(finalList.size()>0){
|
|
|
|
|
|
|
|
info.setPhotos(new Gson().toJson(mData));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
upLoadQx(info);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//上传单条缺陷工单
|
|
|
|
|
|
|
|
private void upLoadQx(QxgdInfo qxItemUpload) {
|
|
|
|
|
|
|
|
String url = Contans.IP + Contans.XJD_UPLOAD_QX;
|
|
|
|
|
|
|
|
showLog(url);
|
|
|
|
|
|
|
|
Request request = NoHttp.createStringRequest(url, RequestMethod.POST);
|
|
|
|
|
|
|
|
request.add("kks", qxItemUpload.getKks());
|
|
|
|
|
|
|
|
request.add("jz", qxItemUpload.getJz());
|
|
|
|
|
|
|
|
request.add("zy", qxItemUpload.getZy());
|
|
|
|
|
|
|
|
request.add("xydj", qxItemUpload.getXydj());
|
|
|
|
|
|
|
|
request.add("gzlx", qxItemUpload.getGzlx());
|
|
|
|
|
|
|
|
request.add("bgr", username);
|
|
|
|
|
|
|
|
request.add("gzqx", qxItemUpload.getGzqx());
|
|
|
|
|
|
|
|
request.add("date", qxItemUpload.getDate());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (App.getInstance().getUserInfo() != null && App.getInstance().getUserInfo().getToken() != null) {
|
|
|
|
|
|
|
|
String token = App.getInstance().getUserInfo().getToken();
|
|
|
|
|
|
|
|
String credential = "Bearer "+token;
|
|
|
|
|
|
|
|
request.addHeader("Authorization", credential);
|
|
|
|
|
|
|
|
request.addHeader("token", token);
|
|
|
|
|
|
|
|
showLog(request.url());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!TextUtils.isEmpty(qxItemUpload.getPhotos())) {
|
|
|
|
|
|
|
|
//List<LocalMedia> mDataTemp = GsonUtils.GsonToList(qxItemUpload.getPhotos(),LocalMedia.class);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gson gson = new Gson();
|
|
|
|
|
|
|
|
List<LocalMedia> mDataTemp = gson.fromJson(qxItemUpload.getPhotos(), new TypeToken<List<LocalMedia>>() {}.getType());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//gson.fromJson(qxItemUpload.getPhotos(),new TypeToken<List<LocalMedia>>() {}.getType());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// = gson.fromJson<List<LocalMedia>>(
|
|
|
|
|
|
|
|
// qxItemUpload.photos,
|
|
|
|
|
|
|
|
// object : TypeToken<List<LocalMedia?>?>() {}.type
|
|
|
|
|
|
|
|
// )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (LocalMedia localMedia : mDataTemp) {
|
|
|
|
|
|
|
|
showLog(new Gson().toJson(localMedia));
|
|
|
|
|
|
|
|
if(localMedia.getCompressPath()!=null){
|
|
|
|
|
|
|
|
request.add("file", new File(localMedia.getCompressPath()));
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
if(localMedia.getSandboxPath()!=null){
|
|
|
|
|
|
|
|
request.add("file", new File(localMedia.getSandboxPath()));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (dialog != null) {
|
|
|
|
|
|
|
|
dialog.show();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
queue.add(5, request, new HttpResponseListener<>(SQxgdlrfActivity.this, request, new HttpListener<String>() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void onSucceed(int what, Response<String> response) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (dialog != null && dialog.isShowing()) {
|
|
|
|
|
|
|
|
dialog.dismiss();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String result = response.get();
|
|
|
|
|
|
|
|
showLog(result);
|
|
|
|
|
|
|
|
com.rehome.dywoa.bean.StatusInfo info = GsonUtils.GsonToBean(result, com.rehome.dywoa.bean.StatusInfo.class);
|
|
|
|
|
|
|
|
if (info != null&&info.getState() == 1) {
|
|
|
|
|
|
|
|
showLog("缺陷工单上传成功");
|
|
|
|
|
|
|
|
showToast("缺陷工单上传成功");
|
|
|
|
|
|
|
|
clearView();
|
|
|
|
|
|
|
|
}else if (info != null&&info.getState() != 1) {
|
|
|
|
|
|
|
|
if(TextUtils.isEmpty(info.getMsg())){
|
|
|
|
|
|
|
|
showLog("缺陷工单上传失败");
|
|
|
|
|
|
|
|
showToast("缺陷工单上传失败");
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
showLog(info.getMsg());
|
|
|
|
|
|
|
|
showToast(info.getMsg());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
showLog("缺陷工单上传失败");
|
|
|
|
|
|
|
|
showToast("缺陷工单上传失败");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void onFailed(int what, Response<String> response) {
|
|
|
|
|
|
|
|
if (dialog != null && dialog.isShowing()) {
|
|
|
|
|
|
|
|
dialog.dismiss();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}, true, false, ""));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public boolean updateData() {
|
|
|
|
public boolean updateData() {
|
|
|
|
finalList.clear();
|
|
|
|
finalList.clear();
|
|
|
|
for (LocalMedia media : mData) {
|
|
|
|
for (LocalMedia media : mData) {
|
|
|
|
|