Merge remote-tracking branch 'origin/asv2022.3.1' into asv2022.3.1

# Conflicts:
#	app/src/main/java/com/example/tyre/util/MyUrl.java
asv2022.3.1
杨万里 2 days ago
commit 118cf21ea4

@ -2,14 +2,13 @@ package com.example.tyre;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.View;
import android.widget.Button; import android.widget.Button;
import android.widget.RadioButton; import android.widget.RadioButton;
import android.widget.Toast; import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import com.example.tyre.databinding.ActivityHomePageBinding; import com.example.tyre.databinding.ActivityHomePageBinding;
import com.example.tyre.maintenance.NewHomePageActivity; import com.example.tyre.maintenance.NewHomePageActivity;
@ -19,8 +18,6 @@ import com.example.tyre.maintenance.NewHomePageActivity;
public class HomePageActivity extends AppCompatActivity { public class HomePageActivity extends AppCompatActivity {
private ActivityHomePageBinding binding;
RadioButton chaxun; RadioButton chaxun;
RadioButton ruku; RadioButton ruku;
RadioButton chuku; RadioButton chuku;
@ -28,7 +25,7 @@ public class HomePageActivity extends AppCompatActivity {
RadioButton huanwei; RadioButton huanwei;
RadioButton zhijian; RadioButton zhijian;
Button logout; Button logout;
private ActivityHomePageBinding binding;
private long exitTime = 0; private long exitTime = 0;
@Override @Override
@ -60,10 +57,14 @@ public class HomePageActivity extends AppCompatActivity {
Intent intent = new Intent(this, InStoreHouseActivity.class); Intent intent = new Intent(this, InStoreHouseActivity.class);
startActivity(intent); startActivity(intent);
}); });
Intent outStoreIntent = new Intent(this, OutStoreHouseActivity.class);
binding.chuku.setOnClickListener(v -> { binding.chuku.setOnClickListener(v -> {
Intent intent = new Intent(this, OutStoreHouseActivity.class); outStoreIntent.putExtra("title","轮胎出库");
startActivity(intent); startActivity(outStoreIntent);
});
binding.chuku1.setOnClickListener(v -> {
outStoreIntent.putExtra("title","调拨出库");
startActivity(outStoreIntent);
}); });
binding.zhuangxie.setOnClickListener(v -> { binding.zhuangxie.setOnClickListener(v -> {

@ -10,9 +10,9 @@ import android.os.Bundle;
import android.os.SystemClock; import android.os.SystemClock;
import android.util.Log; import android.util.Log;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.ObservableBoolean;
import com.android.hdhe.uhf.reader.UhfReader; import com.android.hdhe.uhf.reader.UhfReader;
import com.android.hdhe.uhf.readerInterface.TagModel; import com.android.hdhe.uhf.readerInterface.TagModel;
@ -47,16 +47,15 @@ public class OutStoreHouseActivity extends AppCompatActivity {
long lastTime; long lastTime;
long nextTime; long nextTime;
private ActivityOutStoreHouseBinding binding; private ActivityOutStoreHouseBinding binding;
private boolean isStart = true;
private ProgressDialog progressDialog; private ProgressDialog progressDialog;
private boolean runFlag = true; private boolean runFlag = true;
private boolean startFlag = false; private boolean startFlag = false;
private UhfReader manager; // UHF manager,UHF Operating handle private UhfReader manager; // UHF manager,UHF Operating handle
private ArrayList<EPC> listEPC; private ArrayList<EPC> listEPC;
private ArrayList<String> listepc = new ArrayList<String>(); private ArrayList<String> listepc = new ArrayList<String>();
private Toast mToast;
private Toast toast;
private KeyReceiver keyReceiver; private KeyReceiver keyReceiver;
private ObservableBoolean aType;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
@ -70,6 +69,12 @@ public class OutStoreHouseActivity extends AppCompatActivity {
Thread thread = new InventoryThread(); Thread thread = new InventoryThread();
thread.start(); thread.start();
Util.initSoundPool(this); Util.initSoundPool(this);
Intent intent = getIntent();
String title = intent.getStringExtra("title");
binding.outTitle.setText(title);
aType = new ObservableBoolean();
aType.set(title.equals("轮胎出库"));
binding.setAType(aType);
} }
private void bindViews() { private void bindViews() {
@ -232,13 +237,14 @@ public class OutStoreHouseActivity extends AppCompatActivity {
private String safeGetString(String value) { private String safeGetString(String value) {
return value == null || "null".equals(value) ? "" : value; return value == null || "null".equals(value) ? "" : value;
} }
// 出库提交
private void out_inventory(String epc, String createBy) { private void out_inventory(String epc, String createBy) {
String outReason = binding.outReason.getSelectedItem().toString();//出库原因
OkGo.<String>post(MyUrl.url + "/tyre/inventory/pdaOutInventory").tag(this) OkGo.<String>post(MyUrl.url + "/tyre/inventory/pdaOutInventory").tag(this)
.params("tyreRfid", epc) .params("tyreRfid", epc)
// .params("outReason", outReason)
.params("createBy", createBy) .params("createBy", createBy)
.params("outType", (aType.get() ? "0" : "1"))
.params("deptId", getDeptId(binding.outStoreSite.getSelectedItem().toString()))
.execute(new StringCallback() { .execute(new StringCallback() {
@Override @Override
public void onSuccess(Response<String> response) { public void onSuccess(Response<String> response) {
@ -263,6 +269,15 @@ public class OutStoreHouseActivity extends AppCompatActivity {
unregisterReceiver(keyReceiver); unregisterReceiver(keyReceiver);
} }
public int getDeptId(String name) {
if (name.equals("光明修理厂")) {
return 200;
} else if (name.equals("石岩修理厂")) {
return 201;
}
return 209;
}
/** /**
* Inventory EPC Thread * Inventory EPC Thread
*/ */
@ -316,5 +331,4 @@ public class OutStoreHouseActivity extends AppCompatActivity {
} }
} }
} }
} }

@ -45,16 +45,23 @@ import cn.pda.serialport.Tools;
import okhttp3.MediaType; import okhttp3.MediaType;
public class BaseActivity extends AppCompatActivity { public class BaseActivity extends AppCompatActivity {
public static final int CAMERA_PHOTO = 1;
public SimpleDateFormat dateFormat; public SimpleDateFormat dateFormat;
public ProgressDialog dialog; public ProgressDialog dialog;
public Context context; public Context context;
public Gson gson; public Gson gson;
public String url; public String url;
public MediaType JSON = MediaType.parse("application/json; charset=utf-8"); public MediaType JSON = MediaType.parse("application/json; charset=utf-8");
public byte[] accessBytes = Tools.HexString2Bytes("00000000");
@SuppressLint("SimpleDateFormat")
public SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd_HHmmss");
public UhfReader uhfReader;
public MediaPlayer music;
public MyKeyReceiver keyReceiver;
// 拍照 // 拍照
private Uri img_uri; private Uri img_uri;
private File outputImage; private File outputImage;
public byte[] accessBytes = Tools.HexString2Bytes("00000000");
@SuppressLint("SimpleDateFormat") @SuppressLint("SimpleDateFormat")
@Override @Override
protected void onCreate(@Nullable Bundle savedInstanceState) { protected void onCreate(@Nullable Bundle savedInstanceState) {
@ -79,10 +86,13 @@ public class BaseActivity extends AppCompatActivity {
} }
public int getDeptId(String name) { public int getDeptId(String name) {
if (name.equals("光明修理厂")) if (name.equals("光明修理厂")) {
return 200; return 200;
} else if (name.equals("石岩修理厂")) {
return 201; return 201;
} }
return 209;
}
public String getTypeCode(String typeName) { public String getTypeCode(String typeName) {
if (typeName.equals("二级保养")) { if (typeName.equals("二级保养")) {
@ -102,9 +112,7 @@ public class BaseActivity extends AppCompatActivity {
} }
public static final int CAMERA_PHOTO = 1;
@SuppressLint("SimpleDateFormat")
public SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd_HHmmss");
public void teke_photo() throws IOException { public void teke_photo() throws IOException {
outputImage = new File(getExternalCacheDir(), "output_imgage" + format.format(new Date()) + ".jpg"); outputImage = new File(getExternalCacheDir(), "output_imgage" + format.format(new Date()) + ".jpg");
outputImage.createNewFile(); outputImage.createNewFile();
@ -149,7 +157,7 @@ public class BaseActivity extends AppCompatActivity {
fos.write(compressedImageData); fos.write(compressedImageData);
fos.flush(); fos.flush();
fos.close();*/ fos.close();*/
if (requestCode == CAMERA_PHOTO ){ if (requestCode == CAMERA_PHOTO) {
tekePhotoResult(img_uri.toString(), outputImage); tekePhotoResult(img_uri.toString(), outputImage);
} }
@ -170,11 +178,12 @@ public class BaseActivity extends AppCompatActivity {
public boolean dispatchTouchEvent(MotionEvent ev) { public boolean dispatchTouchEvent(MotionEvent ev) {
if (ev.getAction() == MotionEvent.ACTION_DOWN) { if (ev.getAction() == MotionEvent.ACTION_DOWN) {
View v = getCurrentFocus(); View v = getCurrentFocus();
boolean isKeyboardShown = v != null && (v instanceof EditText) && isKeyboardShowing(getCurrentFocus(), this); boolean isKeyboardShown =
v != null && (v instanceof EditText) && isKeyboardShowing(getCurrentFocus(), this);
if (isKeyboardShown) { if (isKeyboardShown) {
Rect outRect = new Rect(); Rect outRect = new Rect();
v.getGlobalVisibleRect(outRect); v.getGlobalVisibleRect(outRect);
if (!outRect.contains((int)ev.getRawX(), (int)ev.getRawY())) { if (!outRect.contains((int) ev.getRawX(), (int) ev.getRawY())) {
hideSoftKeyboard(this); hideSoftKeyboard(this);
} }
} }
@ -183,7 +192,8 @@ public class BaseActivity extends AppCompatActivity {
} }
private void hideSoftKeyboard(Activity activity) { private void hideSoftKeyboard(Activity activity) {
InputMethodManager inputMethodManager = (InputMethodManager) activity.getSystemService(Activity.INPUT_METHOD_SERVICE); InputMethodManager inputMethodManager =
(InputMethodManager) activity.getSystemService(Activity.INPUT_METHOD_SERVICE);
inputMethodManager.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(), 0); inputMethodManager.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(), 0);
} }
@ -191,9 +201,7 @@ public class BaseActivity extends AppCompatActivity {
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
return imm.isAcceptingText(); return imm.isAcceptingText();
} }
public UhfReader uhfReader;
public MediaPlayer music;
public MyKeyReceiver keyReceiver;
public void initRFID() { public void initRFID() {
uhfReader = MyApplication.getManager(); uhfReader = MyApplication.getManager();
music = MediaPlayer.create(this, R.raw.msg); music = MediaPlayer.create(this, R.raw.msg);
@ -203,6 +211,7 @@ public class BaseActivity extends AppCompatActivity {
initRFID(); initRFID();
initKeyRecriver(this::readEPC); initKeyRecriver(this::readEPC);
} }
@SuppressLint("UnspecifiedRegisterReceiverFlag") @SuppressLint("UnspecifiedRegisterReceiverFlag")
public void initKeyRecriver(MyKeyInfoCall call) { public void initKeyRecriver(MyKeyInfoCall call) {
keyReceiver = new MyKeyReceiver(call); keyReceiver = new MyKeyReceiver(call);

@ -47,6 +47,14 @@
/> />
<RadioButton
android:id="@+id/chuku1"
style="@style/TabRadioButton"
android:drawableTop="@mipmap/icon_home3"
android:text="调拨出库"
/>
<!--<RadioButton--> <!--<RadioButton-->
<!--android:id="@+id/zhijian"--> <!--android:id="@+id/zhijian"-->

@ -1,10 +1,22 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <layout xmlns:android="http://schemas.android.com/apk/res/android">
<data>
<variable
name="aType"
type="androidx.databinding.ObservableBoolean" />
<import type="android.view.View" />
</data>
<LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/allbg" android:background="@color/allbg"
android:orientation="vertical"> android:orientation="vertical">
<TextView <TextView
android:id="@+id/out_title"
style="@style/tablebarStyleTwo" style="@style/tablebarStyleTwo"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="55dp" android:layout_height="55dp"
@ -196,23 +208,45 @@
<LinearLayout <LinearLayout
style="@style/layout_t12_s8_style" style="@style/layout_t12_s8_style"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="45dp"> android:layout_height="45dp"
android:visibility="@{aType?View.GONE:View.VISIBLE}">
<TextView <TextView
style="@style/alltext" style="@style/alltext"
android:layout_width="90dp" android:layout_width="90dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:text="卸胎原因:" />
android:text="调拨站点:" />
<Spinner <Spinner
android:id="@+id/out_reason" android:id="@+id/out_store_site"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="45dp"
android:entries="@array/chukuy" android:background="@drawable/bg_select_grey"
android:textAlignment="center" /> android:entries="@array/zxzd"
android:paddingStart="12dp" />
</LinearLayout> </LinearLayout>
<!-- <LinearLayout-->
<!-- style="@style/layout_t12_s8_style"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="45dp">-->
<!-- <TextView-->
<!-- style="@style/alltext"-->
<!-- android:layout_width="90dp"-->
<!-- android:layout_height="match_parent"-->
<!-- android:text="卸胎原因:" />-->
<!-- <Spinner-->
<!-- android:id="@+id/out_reason"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- android:entries="@array/chukuy"-->
<!-- android:textAlignment="center" />-->
<!-- </LinearLayout>-->
<LinearLayout <LinearLayout
style="@style/layout_t12_s8_style" style="@style/layout_t12_s8_style"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -226,7 +260,7 @@
android:layout_marginEnd="18dp" android:layout_marginEnd="18dp"
android:layout_weight="1" android:layout_weight="1"
android:letterSpacing="0.5" android:letterSpacing="0.5"
android:text="轮胎出库" /> android:text='@{aType?"轮胎出库":"调拨出库" }' />
<Button <Button
android:id="@+id/back" android:id="@+id/back"
@ -238,4 +272,5 @@
android:letterSpacing="1" android:letterSpacing="1"
android:text="返回" /> android:text="返回" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</layout>

Loading…
Cancel
Save