close: wx-2

asv2022.3.1
wanghao 1 day ago
parent b3308ec86f
commit 40e1c536e6

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

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

@ -45,16 +45,23 @@ import cn.pda.serialport.Tools;
import okhttp3.MediaType;
public class BaseActivity extends AppCompatActivity {
public static final int CAMERA_PHOTO = 1;
public SimpleDateFormat dateFormat;
public ProgressDialog dialog;
public Context context;
public Gson gson;
public String url;
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 File outputImage;
public byte[] accessBytes = Tools.HexString2Bytes("00000000");
@SuppressLint("SimpleDateFormat")
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
@ -79,10 +86,13 @@ public class BaseActivity extends AppCompatActivity {
}
public int getDeptId(String name) {
if (name.equals("光明修理厂"))
if (name.equals("光明修理厂")) {
return 200;
} else if (name.equals("石岩修理厂")) {
return 201;
}
return 209;
}
public String getTypeCode(String typeName) {
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 {
outputImage = new File(getExternalCacheDir(), "output_imgage" + format.format(new Date()) + ".jpg");
outputImage.createNewFile();
@ -170,7 +178,8 @@ public class BaseActivity extends AppCompatActivity {
public boolean dispatchTouchEvent(MotionEvent ev) {
if (ev.getAction() == MotionEvent.ACTION_DOWN) {
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) {
Rect outRect = new Rect();
v.getGlobalVisibleRect(outRect);
@ -183,7 +192,8 @@ public class BaseActivity extends AppCompatActivity {
}
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);
}
@ -191,9 +201,7 @@ public class BaseActivity extends AppCompatActivity {
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
return imm.isAcceptingText();
}
public UhfReader uhfReader;
public MediaPlayer music;
public MyKeyReceiver keyReceiver;
public void initRFID() {
uhfReader = MyApplication.getManager();
music = MediaPlayer.create(this, R.raw.msg);
@ -203,6 +211,7 @@ public class BaseActivity extends AppCompatActivity {
initRFID();
initKeyRecriver(this::readEPC);
}
@SuppressLint("UnspecifiedRegisterReceiverFlag")
public void initKeyRecriver(MyKeyInfoCall call) {
keyReceiver = new MyKeyReceiver(call);

@ -6,7 +6,7 @@ package com.example.tyre.util;
* @date: 2019-10-24 13:59
*/
public class MyUrl {
public static String url="http://192.168.0.18:8020";
public static String url="http://192.168.137.1:8020";
// public static String url="http://www.qdhys.xyz:8020";
// public static String url="http://10.11.187.77:8020";
}

@ -47,6 +47,14 @@
/>
<RadioButton
android:id="@+id/chuku1"
style="@style/TabRadioButton"
android:drawableTop="@mipmap/icon_home3"
android:text="调拨出库"
/>
<!--<RadioButton-->
<!--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_height="match_parent"
android:background="@color/allbg"
android:orientation="vertical">
<TextView
android:id="@+id/out_title"
style="@style/tablebarStyleTwo"
android:layout_width="match_parent"
android:layout_height="55dp"
@ -196,23 +208,45 @@
<LinearLayout
style="@style/layout_t12_s8_style"
android:layout_width="match_parent"
android:layout_height="45dp">
android:layout_height="45dp"
android:visibility="@{aType?View.GONE:View.VISIBLE}">
<TextView
style="@style/alltext"
android:layout_width="90dp"
android:layout_height="match_parent"
android:text="卸胎原因:" />
android:text="调拨站点:" />
<Spinner
android:id="@+id/out_reason"
android:id="@+id/out_store_site"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:entries="@array/chukuy"
android:textAlignment="center" />
android:layout_height="45dp"
android:background="@drawable/bg_select_grey"
android:entries="@array/zxzd"
android:paddingStart="12dp" />
</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
style="@style/layout_t12_s8_style"
android:layout_width="match_parent"
@ -226,7 +260,7 @@
android:layout_marginEnd="18dp"
android:layout_weight="1"
android:letterSpacing="0.5"
android:text="轮胎出库" />
android:text='@{aType?"轮胎出库":"调拨出库" }' />
<Button
android:id="@+id/back"
@ -239,3 +273,4 @@
android:text="返回" />
</LinearLayout>
</LinearLayout>
</layout>

Loading…
Cancel
Save