|
|
|
@ -16,14 +16,17 @@ import androidx.databinding.DataBindingUtil;
|
|
|
|
import com.example.tyre.R;
|
|
|
|
import com.example.tyre.R;
|
|
|
|
import com.example.tyre.databinding.ActivityCreateWorkOrderBinding;
|
|
|
|
import com.example.tyre.databinding.ActivityCreateWorkOrderBinding;
|
|
|
|
import com.example.tyre.entity.BaseCar;
|
|
|
|
import com.example.tyre.entity.BaseCar;
|
|
|
|
|
|
|
|
import com.example.tyre.entity.BaseTyre;
|
|
|
|
import com.example.tyre.maintenance.base.BaseActivity;
|
|
|
|
import com.example.tyre.maintenance.base.BaseActivity;
|
|
|
|
import com.example.tyre.maintenance.base.MyRecultCall;
|
|
|
|
import com.example.tyre.maintenance.base.MyRecultCall;
|
|
|
|
import com.example.tyre.maintenance.base.MyResult;
|
|
|
|
import com.example.tyre.maintenance.base.MyResult;
|
|
|
|
import com.example.tyre.maintenance.dialog.TipResultDialog;
|
|
|
|
import com.example.tyre.maintenance.dialog.TipResultDialog;
|
|
|
|
import com.example.tyre.util.MyUrl;
|
|
|
|
import com.example.tyre.util.MyUrl;
|
|
|
|
import com.example.tyre.util.SharedPreferencesUtils;
|
|
|
|
import com.example.tyre.util.SharedPreferencesUtils;
|
|
|
|
|
|
|
|
import com.google.gson.Gson;
|
|
|
|
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.callback.StringCallback;
|
|
|
|
import com.lzy.okgo.model.Response;
|
|
|
|
import com.lzy.okgo.model.Response;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
@ -44,12 +47,16 @@ public class CreateWorkOrderActivity extends BaseActivity {
|
|
|
|
private List<BaseCar> baseCarList;
|
|
|
|
private List<BaseCar> baseCarList;
|
|
|
|
private Map<String, Object> submitMap;
|
|
|
|
private Map<String, Object> submitMap;
|
|
|
|
private Runnable searchRunnable;
|
|
|
|
private Runnable searchRunnable;
|
|
|
|
|
|
|
|
private String typeTitle;
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
|
super.onCreate(savedInstanceState);
|
|
|
|
super.onCreate(savedInstanceState);
|
|
|
|
binding = DataBindingUtil.setContentView(this, R.layout.activity_create_work_order);
|
|
|
|
binding = DataBindingUtil.setContentView(this, R.layout.activity_create_work_order);
|
|
|
|
tipDialog = new TipResultDialog(this, this);
|
|
|
|
tipDialog = new TipResultDialog(this, this);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
initRFIDAndKeyReceiver();// 初始化RFID
|
|
|
|
|
|
|
|
|
|
|
|
binding.createWorkCarNo.addTextChangedListener(new TextWatcher() {
|
|
|
|
binding.createWorkCarNo.addTextChangedListener(new TextWatcher() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
|
|
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
|
|
|
@ -84,6 +91,7 @@ public class CreateWorkOrderActivity extends BaseActivity {
|
|
|
|
isSearch = false;
|
|
|
|
isSearch = false;
|
|
|
|
BaseCar baseCar = baseCarList.get(position);
|
|
|
|
BaseCar baseCar = baseCarList.get(position);
|
|
|
|
submitMap.put("vehicleId", baseCar.getId());
|
|
|
|
submitMap.put("vehicleId", baseCar.getId());
|
|
|
|
|
|
|
|
submitMap.put("orderType", "1" );
|
|
|
|
String carNo = baseCar.getCarNo();
|
|
|
|
String carNo = baseCar.getCarNo();
|
|
|
|
submitMap.put("plateNumber", carNo);
|
|
|
|
submitMap.put("plateNumber", carNo);
|
|
|
|
binding.createWorkCarNo.setText(carNo);
|
|
|
|
binding.createWorkCarNo.setText(carNo);
|
|
|
|
@ -103,7 +111,10 @@ public class CreateWorkOrderActivity extends BaseActivity {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
String typeTitle = getIntent().getStringExtra("title");
|
|
|
|
|
|
|
|
|
|
|
|
typeTitle = getIntent().getStringExtra("title");
|
|
|
|
|
|
|
|
binding.setTypeCode(typeTitle);//传入页面控制显示轮胎还是车牌
|
|
|
|
|
|
|
|
// 显示类型选择器
|
|
|
|
if (typeTitle != null) {
|
|
|
|
if (typeTitle != null) {
|
|
|
|
List<String> typeList = Arrays.asList(getResources().getStringArray(R.array.work_type));
|
|
|
|
List<String> typeList = Arrays.asList(getResources().getStringArray(R.array.work_type));
|
|
|
|
int index = typeList.indexOf(typeTitle);
|
|
|
|
int index = typeList.indexOf(typeTitle);
|
|
|
|
@ -152,9 +163,18 @@ public class CreateWorkOrderActivity extends BaseActivity {
|
|
|
|
|
|
|
|
|
|
|
|
// 提交数据
|
|
|
|
// 提交数据
|
|
|
|
public void generateWorkOrder(View view) {
|
|
|
|
public void generateWorkOrder(View view) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Object vehicleId = submitMap.get("vehicleId");
|
|
|
|
|
|
|
|
if ( vehicleId == null) {
|
|
|
|
|
|
|
|
tipDialog.show(false, null, "请先选择车辆/轮胎", false);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 选车牌时候已插入id
|
|
|
|
submitMap.put("typeCode", getTypeCode(binding.orderCreateType.getSelectedItem().toString()));
|
|
|
|
submitMap.put("typeCode", getTypeCode(binding.orderCreateType.getSelectedItem().toString()));
|
|
|
|
submitMap.put("factoryId", getDeptId(binding.orderCreateSite.getSelectedItem().toString()));
|
|
|
|
submitMap.put("factoryId", getDeptId(binding.orderCreateSite.getSelectedItem().toString()));
|
|
|
|
submitMap.put("createBy", SharedPreferencesUtils.getstring("user", "admin"));
|
|
|
|
submitMap.put("createBy", SharedPreferencesUtils.getstring("user", "admin"));
|
|
|
|
|
|
|
|
|
|
|
|
submitMap.put("status", "PROCESSING");
|
|
|
|
submitMap.put("status", "PROCESSING");
|
|
|
|
submitMap.put("maintainDate", dateFormat.format(new Date()));
|
|
|
|
submitMap.put("maintainDate", dateFormat.format(new Date()));
|
|
|
|
OkGo.<MyResult>post(MyUrl.url + "/tyre/order/PDAAddMaintenanceOrder")
|
|
|
|
OkGo.<MyResult>post(MyUrl.url + "/tyre/order/PDAAddMaintenanceOrder")
|
|
|
|
@ -173,4 +193,40 @@ public class CreateWorkOrderActivity extends BaseActivity {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void sanEpcCall(String epc) {
|
|
|
|
|
|
|
|
super.sanEpcCall(epc);
|
|
|
|
|
|
|
|
binding.createWorkTyreRfid.setText(epc);
|
|
|
|
|
|
|
|
findBaseTyre(epc);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void findBaseTyre(String epc) {
|
|
|
|
|
|
|
|
dialog.show();
|
|
|
|
|
|
|
|
OkGo.<String>post(MyUrl.url + "/tyre/tyre/pdaQueryTyreInfo")
|
|
|
|
|
|
|
|
.tag(this)
|
|
|
|
|
|
|
|
.params("tyreEpc", epc)
|
|
|
|
|
|
|
|
.execute(new StringCallback() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void onSuccess(Response<String> response) {
|
|
|
|
|
|
|
|
dialog.dismiss();
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
Gson gson = new Gson();
|
|
|
|
|
|
|
|
BaseTyre baseTyre = gson.fromJson(response.body(), BaseTyre.class);
|
|
|
|
|
|
|
|
if (baseTyre != null) {
|
|
|
|
|
|
|
|
// wtbm.setText(safeGetString(baseTyre.getTyreNo()));
|
|
|
|
|
|
|
|
submitMap.put("vehicleId", baseTyre.getTyreId());
|
|
|
|
|
|
|
|
submitMap.put("plateNumber", baseTyre.getTyreNo());
|
|
|
|
|
|
|
|
submitMap.put("orderType", "2" );
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
tipDialog.show(false, null, "未查询到轮胎信息", false);
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|