Compare commits

..

2 Commits

@ -54,4 +54,7 @@ dependencies {
implementation files('libs/SerialPort.jar')
implementation 'androidx.gridlayout:gridlayout:1.0.0'
implementation 'com.google.android.material:material:1.11.0'
implementation 'com.github.xuexiangjys:XUpdate:2.1.4'
implementation 'com.github.xuexiangjys.XUpdateAPI:xupdate-easy:1.0.1'
implementation 'com.github.bumptech.glide:glide:4.16.0'
}

@ -83,7 +83,7 @@ public class TyreSearchActivity extends AppCompatActivity {
private void bindViews() {
inSantext = binding.inSantext;
basemessage = binding.basemessage;
// basemessage = binding.basemessage;
button = binding.button;
pinpai = binding.pinpai;
xinghao = binding.xinghao;

@ -296,7 +296,7 @@ public class WorkExecuteActivity extends BaseActivity {
public void tekePhotoResult(String fileUrl, File file) {
super.tekePhotoResult(fileUrl, file);
Log.e("TAG", "拍照成功,路径是:" + fileUrl);
tireUpdateDialog.setImage(file);
tireUpdateDialog.setImage(fileUrl,file);
}
// 删除实时表、卸车记录表

@ -33,7 +33,8 @@ import okhttp3.RequestBody;
public class WorkOrderActivity extends BaseActivity implements OrderAdapter.SelectTagAdapterListener {
private ActivityWorkOrderBinding binding;
private ObservableBoolean status;
private DatePickerDialog datePickerDialog;
private DatePickerDialog datePickerDialogStart;
private DatePickerDialog datePickerDialogEnd;
private ListPopupWindow listPopupWindow;
private List<Order> list;
private OrderAdapter adapter;
@ -51,18 +52,8 @@ public class WorkOrderActivity extends BaseActivity implements OrderAdapter.Sele
typeCode = intent.getStringExtra("typeCode");
binding.setTitle(title);
// 获取当前日期
Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
int month = calendar.get(Calendar.MONTH);
int day = calendar.get(Calendar.DAY_OF_MONTH);
binding.workOrderDate.setText(dateFormat.format(calendar.getTime()));
datePickerDialog = new DatePickerDialog(this, (view1, year1, monthOfYear, dayOfMonth) -> {
@SuppressLint("DefaultLocale") String selectedDate =
year1 + "-" + String.format("%02d", (monthOfYear + 1)) + "-" + String.format("%02d", dayOfMonth);
binding.workOrderDate.setText(selectedDate);
selectWorkOrder(selectedDate, getDeptId(binding.workOrderSite.getText().toString()), status.get() ? "COMPLETED" : "PROCESSING");
initDataSelect();
}, year, month, day);
// 初始化选择框
listPopupWindow = new ListPopupWindow(this);
listPopupWindow.setAnchorView(binding.workOrderSite);
@ -73,42 +64,81 @@ public class WorkOrderActivity extends BaseActivity implements OrderAdapter.Sele
binding.workOrderSite.setText(text);
SharedPreferencesUtils.putstring("workOrderSite", text);
listPopupWindow.dismiss();
selectWorkOrder(binding.workOrderDate.getText().toString(), getDeptId(text), status.get() ? "COMPLETED" : "PROCESSING");
selectWorkOrder(binding.workOrderDateStart.getText().toString(), binding.workOrderDateEnd.getText().toString(), getDeptId(text), status.get() ? "COMPLETED" : "PROCESSING");
});
adapter = new OrderAdapter(this, this);
binding.setAdapter(adapter);
}
private void selectWorkOrder(String selectedDate, int deptId, String state) {
private void initDataSelect() {
// 开始日期
Calendar calendarStart = Calendar.getInstance();
calendarStart.add(Calendar.DAY_OF_MONTH, -7);
binding.workOrderDateStart.setText(dateFormat.format(calendarStart.getTime()));
datePickerDialogStart = new DatePickerDialog(this, (view1, year, monthOfYear, dayOfMonth) -> {
@SuppressLint("DefaultLocale")
String selectedDate =
year + "-" + String.format("%02d", (monthOfYear + 1)) + "-" + String.format("%02d", dayOfMonth);
binding.workOrderDateStart.setText(selectedDate);
// 查询
selectWorkOrder(selectedDate,
binding.workOrderDateEnd.getText().toString(),
getDeptId(binding.workOrderSite.getText().toString()),
status.get() ? "COMPLETED" : "PROCESSING");
}, calendarStart.get(Calendar.YEAR), calendarStart.get(Calendar.MONTH), calendarStart.get(Calendar.DAY_OF_MONTH));
// 结束日期
Calendar calendarEnd = Calendar.getInstance();
binding.workOrderDateEnd.setText(dateFormat.format(calendarEnd.getTime()));
datePickerDialogEnd = new DatePickerDialog(this, (view1, year, monthOfYear, dayOfMonth) -> {
@SuppressLint("DefaultLocale")
String selectedDate =
year + "-" + String.format("%02d", (monthOfYear + 1)) + "-" + String.format("%02d", dayOfMonth);
binding.workOrderDateEnd.setText(selectedDate);
selectWorkOrder(binding.workOrderDateStart.getText().toString(),
selectedDate,
getDeptId(binding.workOrderSite.getText().toString()),
status.get() ? "COMPLETED" : "PROCESSING");
}, calendarEnd.get(Calendar.YEAR), calendarEnd.get(Calendar.MONTH), calendarEnd.get(Calendar.DAY_OF_MONTH));
}
// 查询工单
private void selectWorkOrder(String selectedDate1, String selectedDate2, int deptId, String state) {
Map<String, Object> params = new HashMap<>();
params.put("status", state);
params.put("maintainDate", selectedDate);
// params.put("maintainDateStart", selectedDate1);
params.put("maintainDate", selectedDate2);
params.put("factoryId", deptId);
if (typeCode != null && !typeCode.isEmpty()) {
params.put("typeCode", typeCode);
}
OkGo.<MyResult>post(url + "/tyre/order/PDAGetMaintenanceOrder")
.upRequestBody(RequestBody.create(JSON, gson.toJson(params)))
.execute(new MyRecultCall(dialog, this) {
@Override
public void onSuccess(Response<MyResult> response) {
super.onSuccess(response);
var body = response.body();
if (body.getCode() == 0) {
list = gson.fromJson(body.getJson(), new TypeToken<List<Order>>() {
}.getType());
adapter.setList(list);
adapter.notifyDataSetChanged();
}
}
});
OkGo.<MyResult>post(url + "/tyre/order/PDAGetMaintenanceOrder").upRequestBody(RequestBody.create(JSON, gson.toJson(params))).execute(new MyRecultCall(dialog, this) {
@Override
public void onSuccess(Response<MyResult> response) {
super.onSuccess(response);
var body = response.body();
if (body.getCode() == 0) {
list = gson.fromJson(body.getJson(), new TypeToken<List<Order>>() {
}.getType());
adapter.setList(list);
adapter.notifyDataSetChanged();
}
}
});
}
// 选日期
public void selectDate(View view) {
datePickerDialog.show();
public void selectDate1(View view) {
datePickerDialogStart.show();
}
public void selectDate2(View view) {
datePickerDialogEnd.show();
}
// 选站点
@ -123,7 +153,10 @@ public class WorkOrderActivity extends BaseActivity implements OrderAdapter.Sele
public void switchStatus(View view) {
status.set(!status.get());
selectWorkOrder(binding.workOrderDate.getText().toString(), getDeptId(binding.workOrderSite.getText().toString()), status.get() ? "COMPLETED" : "PROCESSING");
selectWorkOrder(binding.workOrderDateStart.getText().toString(),
binding.workOrderDateEnd.getText().toString(),
getDeptId(binding.workOrderSite.getText().toString()),
status.get() ? "COMPLETED" : "PROCESSING");
}
// 执行工单
@ -134,9 +167,9 @@ public class WorkOrderActivity extends BaseActivity implements OrderAdapter.Sele
String typeCode1 = order.getTypeCode();
if (typeCode1.equals("6")) {
intent = new Intent(this, TireRepairActivity.class);
}else if (typeCode1.equals("7")){
} else if (typeCode1.equals("7")) {
intent = new Intent(this, TireScrapActivity.class);
}else {
} else {
intent = new Intent(this, WorkExecuteActivity.class);
}
@ -151,6 +184,6 @@ public class WorkOrderActivity extends BaseActivity implements OrderAdapter.Sele
protected void onResume() {
super.onResume();
binding.workOrderSite.setText(SharedPreferencesUtils.getstring("workOrderSite", "光明修理厂"));
selectWorkOrder(binding.workOrderDate.getText().toString(), getDeptId(binding.workOrderSite.getText().toString()), "PROCESSING");
selectWorkOrder(binding.workOrderDateStart.getText().toString(), binding.workOrderDateEnd.getText().toString(), getDeptId(binding.workOrderSite.getText().toString()), "PROCESSING");
}
}

@ -0,0 +1,92 @@
package com.example.tyre.maintenance.adapter;
import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.databinding.DataBindingUtil;
import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide;
import com.example.tyre.BR;
import com.example.tyre.R;
import com.example.tyre.databinding.ItemDisposalImgBinding;
import com.example.tyre.maintenance.been.CheckInstanceFiles;
import java.util.List;
/**
* @author wanghao
* @date 2024/3/11
*/
public class DisposalFileAdapter extends RecyclerView.Adapter<DisposalFileAdapter.MyViewHolder> {
private List<CheckInstanceFiles> list;
private static Context context;
private LayoutInflater inflater;
private ItemClickCall clickCall;
private boolean delectState=false;
public void setDelectState(boolean delectState) {
this.delectState = delectState;
}
public DisposalFileAdapter(Context context, ItemClickCall clickCall) {
this.context = context;
this.clickCall = clickCall;
inflater = LayoutInflater.from(context);
}
public void setList(List<CheckInstanceFiles> list) {
this.list = list;
}
@NonNull
@Override
public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
ItemDisposalImgBinding binding = DataBindingUtil.inflate(inflater, R.layout.item_disposal_img, parent, false);
return new MyViewHolder(binding);
}
// @SuppressLint("CheckResult")
@Override
public void onBindViewHolder(@NonNull MyViewHolder holder, int position) {
var outstock = list.get(position);
var binding = holder.binding;
binding.setVariable(BR.vm,outstock);
Log.e("TAG", "onBindViewHolder:" + outstock.isState());
Glide.with(context)
.load(outstock.getFaultFile())
.into(binding.disFile);
binding.disFile.setOnClickListener(v -> clickCall.onClick(position,true));
if (delectState){
binding.disposalDelect.setVisibility(View.GONE);
}else{
binding.disposalDelect.setVisibility(View.VISIBLE);
binding.disposalDelect.setOnClickListener(v -> clickCall.onClick(position,false));
}
}
@Override
public int getItemCount() {
return list==null?0:list.size();
}
class MyViewHolder extends RecyclerView.ViewHolder {
private ItemDisposalImgBinding binding;
public MyViewHolder(ItemDisposalImgBinding binding) {
super(binding.getRoot());
this.binding = binding;
}
}
public interface ItemClickCall {
void onClick(int position,boolean type);
}
}

@ -0,0 +1,37 @@
package com.example.tyre.maintenance.been;
import androidx.databinding.BaseObservable;
/**
* @author wanghao
*
* @date 2024/3/11 10:00
*/
public class CheckInstanceFiles extends BaseObservable {
private String faultFile;
private boolean state=false;
public boolean isState() {
return state;
}
public void setState(boolean state) {
this.state = state;
}
public String getFaultFile() {
return faultFile;
}
public void setFaultFile(String faultFile) {
this.faultFile = faultFile;
}
@Override
public String toString() {
return "CheckInstanceFiles{" +
"faultFile='" + faultFile + '\'' +
'}';
}
}

@ -51,7 +51,7 @@ public class TireChangeDialog extends Dialog {
String wheelPostion = tire.getWheelPostion();
tyreMap.put(wheelPostion, tire);
if (tire.getTyreNo() == null || tire.getTyreNo().equals("")) {
tire.setTyreNo("t:" + wheelPostion);
tire.setTyreNo("测试标识:" + wheelPostion);
}
initTire(wheelPostion, tire);
});

@ -22,10 +22,13 @@ import androidx.databinding.ObservableBoolean;
import com.example.tyre.R;
import com.example.tyre.databinding.DialogTireUpdateBinding;
import com.example.tyre.maintenance.adapter.DisposalFileAdapter;
import com.example.tyre.maintenance.been.BaseTyre;
import com.example.tyre.maintenance.been.BizOrderTireDetail;
import com.example.tyre.maintenance.been.CheckInstanceFiles;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
public class TireUpdateDialog extends Dialog {
@ -36,7 +39,7 @@ public class TireUpdateDialog extends Dialog {
private BizOrderTireDetail newTireDetail;// 新轮胎
private TireUpdateDialogSaveListener listener;
private File image;
private ObservableBoolean photoState;
// private ObservableBoolean photoState;
private TireChangeDialog tireChangeDialog;// 同车轮胎互换弹窗
private List<BaseTyre> baseTyreList;
private BaseTyre newBaseTyre;
@ -100,8 +103,8 @@ public class TireUpdateDialog extends Dialog {
// 拍照按钮点击事件
binding.dialogUpdatePhoto.setOnClickListener(view -> listener.onTakePhoto());
photoState = new ObservableBoolean(false);
binding.setPhotoState(photoState);
// photoState = new ObservableBoolean(false);
// binding.setPhotoState(photoState);
setContentView(binding.getRoot());
tireChangeDialog = new TireChangeDialog(context, new TireChangeDialog.TireChangeListener() {
@Override
@ -111,7 +114,12 @@ public class TireUpdateDialog extends Dialog {
});
disposalFileAdapter=new DisposalFileAdapter(context, new DisposalFileAdapter.ItemClickCall() {
@Override
public void onClick(int position, boolean type) {
}
});
}
// 换新胎了
@ -151,8 +159,9 @@ public class TireUpdateDialog extends Dialog {
newTireDetail.setDataType("换新胎,装车");
newTireDetail.setTireStatus("换新胎,装车");
// 重置ui
photoState.set(false);
// photoState.set(false);
binding.dialogUpdatePhoto.setImageResource(R.mipmap.ic_xiangji);
filesList=new ArrayList<>();
show();
}
@ -180,11 +189,18 @@ public class TireUpdateDialog extends Dialog {
// 点击外部不关闭
setCanceledOnTouchOutside(false);
}
public void setImage(File image) {
private DisposalFileAdapter disposalFileAdapter;
private List<CheckInstanceFiles> filesList ;
public void setImage(String fileUrl,File image) {
this.image = image;
photoState.set(true);
binding.dialogUpdatePhoto.setImageResource(R.mipmap.ic_duihao);
// photoState.set(true);
// binding.dialogUpdatePhoto.setImageResource(R.mipmap.ic_duihao);
CheckInstanceFiles checkInstanceFiles = new CheckInstanceFiles();
checkInstanceFiles.setFaultFile(fileUrl);
checkInstanceFiles.setState(true);
filesList.add(checkInstanceFiles);
disposalFileAdapter.notifyDataSetChanged();
}
public interface TireUpdateDialogSaveListener {

@ -12,6 +12,7 @@
<variable
name="status"
type="androidx.databinding.ObservableBoolean" />
<variable
name="adapter"
type="com.example.tyre.maintenance.adapter.OrderAdapter" />
@ -39,17 +40,28 @@
<TextView
android:layout_height="45dp"
android:gravity="left|center"
android:text="保养日期"
android:text="选择保养周期查询:"
android:textColor="@color/textColor1"
app:layout_columnSpan="3" />
<TextView
android:id="@+id/work_order_date_start"
android:layout_height="45dp"
android:gravity="left|center"
android:onClick="selectDate1"
android:paddingEnd="10dp"
android:text="开始保养日期"
android:textColor="@color/textColor2"
android:textStyle="bold"
app:layout_columnWeight="1" />
<TextView
android:id="@+id/work_order_date"
android:id="@+id/work_order_date_end"
android:layout_height="45dp"
android:gravity="right|center"
android:onClick="selectDate"
android:onClick="selectDate2"
android:paddingEnd="10dp"
android:text="保养日期"
android:text="结束保养日期"
android:textColor="@color/textColor2"
android:textStyle="bold"
app:layout_columnWeight="1" />
@ -77,12 +89,12 @@
android:id="@+id/work_order_site"
android:layout_height="45dp"
android:gravity="right|center"
android:onClick="selectOrderSite"
android:paddingEnd="10dp"
android:text="光明修理厂"
android:textColor="@color/textColor2"
android:textStyle="bold"
app:layout_columnWeight="1"
android:text="光明修理厂"
android:onClick="selectOrderSite"
tools:ignore="RtlHardcoded,RtlSymmetry" />
<ImageView
@ -140,7 +152,7 @@
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:adapter="@{adapter}"
android:adapter="@{adapter}"
android:padding="12dp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />

@ -161,6 +161,27 @@
android:textColor="@color/textColor1"
app:layout_columnWeight="1" />
<View
android:layout_height="1dp"
android:layout_marginTop="8dp"
android:background="#F1F1F1"
app:layout_columnSpan="2" />
<TextView
android:layout_height="40dp"
android:gravity="left|center"
android:text="花纹初始深度"
android:textColor="@color/textColor1"
app:layout_columnWeight="1" />
<TextView
android:layout_height="40dp"
android:gravity="right|center"
android:text='@{tire.patternDepth+" mm"}'
android:textColor="@color/textColor1"
app:layout_columnWeight="1" />
<View
android:layout_height="1dp"
@ -177,8 +198,8 @@
<Switch
android:layout_height="40dp"
android:visibility="gone"
android:textColor="@color/textColor1"
android:visibility="gone"
app:layout_columnWeight="1"
tools:ignore="UseSwitchCompatOrMaterialXml" />
@ -290,7 +311,50 @@
android:layout_height="40dp"
android:layout_marginTop="8dp"
android:gravity="left|center"
android:text="胎压"
android:text="保养前胎压"
android:textColor="@color/textColor1"
app:layout_columnWeight="1" />
<LinearLayout
android:layout_height="40dp"
android:layout_marginTop="8dp"
android:background="@drawable/bg_grey"
android:gravity="center"
android:orientation="horizontal"
android:padding="5dp"
app:layout_columnWeight="1">
<EditText
android:id="@+id/dialog_tire_taiya_old"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@color/blue1_3"
android:gravity="center"
android:inputType="numberDecimal"
android:textColor="@color/textColor1" />
<TextView
android:layout_width="40dp"
android:layout_height="match_parent"
android:layout_marginEnd="4dp"
android:background="@drawable/bg_blue1_2"
android:gravity="center"
android:text="kpa"
android:textColor="@color/blue1_1" />
</LinearLayout>
<View
android:layout_height="1dp"
android:layout_marginTop="8dp"
android:background="#F1F1F1"
app:layout_columnSpan="2" />
<TextView
android:layout_height="40dp"
android:layout_marginTop="8dp"
android:gravity="left|center"
android:text="保养后胎压"
android:textColor="@color/textColor1"
app:layout_columnWeight="1" />
@ -338,16 +402,35 @@
app:layout_columnWeight="1" />
<ImageView
android:id="@+id/dialog_update_photo"
style="@style/text_block_style"
android:layout_width="100dp"
android:layout_height="100dp"
android:background="@drawable/bg_block_img_selector"
android:padding="30dp"
android:selected="@{photoState}"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="90dp"
android:layout_marginTop="5dp"
android:background="@color/white"
app:layout_columnSpan="2" />
android:orientation="horizontal"
app:layout_columnSpan="2">
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:adapter="@{adapter1}"
android:orientation="horizontal"
android:paddingLeft="5dp"
android:paddingRight="5dp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
<ImageView
android:id="@+id/dialog_update_photo"
style="@style/text_block_style"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="@drawable/bg_block_img_selector"
android:padding="10dp"
android:src="@mipmap/ic_xiangji"
/>
</LinearLayout>
<View
android:layout_height="1dp"
@ -407,7 +490,6 @@
android:textColor="@color/white"
android:textSize="16sp"
android:textStyle="bold"
android:visibility="gone"
app:layout_columnSpan="2" />
<LinearLayout
@ -472,10 +554,10 @@
android:layout_height="40dp"
android:layout_marginTop="8dp"
android:gravity="center"
android:textColor="@color/textColor1"
app:layout_columnWeight="1"
android:hint="输入轮胎自编号"
android:inputType="textVisiblePassword"
android:hint="输入轮胎自编号"/>
android:textColor="@color/textColor1"
app:layout_columnWeight="1" />
<View
android:layout_height="1dp"

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<variable
name="vm"
type="com.example.tyre.maintenance.been.CheckInstanceFiles" />
<import type="android.view.View" />
</data>
<FrameLayout
android:layout_width="80dp"
android:layout_height="match_parent">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@mipmap/ic_picture_err"
android:padding="20dp"/>
<ImageView
android:id="@+id/dis_file"
android:paddingTop="5dp"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ImageView
android:id="@+id/disposal_delect"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="right"
android:src="@mipmap/ic_cha1" />
</FrameLayout>
</layout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Loading…
Cancel
Save