修改 大料查询物料

master
wangh 6 months ago
parent 27756bac01
commit 592d697d98

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="deploymentTargetDropDown">
<runningDeviceTargetSelectedWithDropDown>
<Target>
<type value="RUNNING_DEVICE_TARGET" />
<deviceKey>
<Key>
<type value="SERIAL_NUMBER" />
<value value="52540732" />
</Key>
</deviceKey>
</Target>
</runningDeviceTargetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2024-01-26T09:08:37.212757200Z" />
</component>
</project>

@ -10,8 +10,8 @@ android {
applicationId "com.example.duken_mes"
minSdk 24
targetSdk 33
versionCode 2
versionName "1.0"
versionCode 4
versionName "3.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

@ -11,8 +11,8 @@
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 2,
"versionName": "1.0",
"versionCode": 4,
"versionName": "3.1",
"outputFile": "app-release.apk"
}
],

@ -14,11 +14,15 @@
android:theme="@style/Theme.Dukenmes"
android:usesCleartextTraffic="true"
tools:targetApi="31">
<activity
android:name=".SelectActivity"
android:exported="false" />
<activity
android:name=".HomeActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
@ -26,7 +30,6 @@
<activity
android:name=".MainActivity"
android:exported="false" />
</application>
</manifest>

@ -8,12 +8,14 @@ import android.view.View;
public class HomeActivity extends AppCompatActivity {
private Intent intent;
private Intent intent2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);
intent = new Intent(this, MainActivity.class);
intent2 = new Intent(this, SelectActivity.class);
}
public void startAc1(View view) {
@ -25,5 +27,8 @@ public class HomeActivity extends AppCompatActivity {
intent.putExtra("type",false);
startActivity(intent);
}
public void startAc3(View view) {
startActivity(intent2);
}
}

@ -25,17 +25,17 @@ import okhttp3.RequestBody;
public class MainActivity extends BaseActivity {
private MainVm mainVm;
private AlertDialog alertDialog;
private String url;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActivityMainBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_main);
mainVm = new MainVm();
var type = getIntent().getBooleanExtra("type", false);
url=type?urls:urlb;
mainVm.setType(type);
binding.setVm(mainVm);
binding.trayCodeid.setOnEditorActionListener((v, actionId, event) -> {
selectGoods();
binding.trayCodeid.setOnEditorActionListener((v, actionId, event) -> {selectGoods();
/*if (actionId == EditorInfo.IME_ACTION_DONE) {
InputMethodManager imm = (InputMethodManager)v.getContext()
@ -72,7 +72,7 @@ public class MainActivity extends BaseActivity {
@Override
protected void sanInfo(String code) {
var tankCode = mainVm.getTankCode();
if (tankCode==null||tankCode.isEmpty()) {
if (tankCode == null || tankCode.isEmpty()) {
mainVm.setTankCode(code);
} else {
mainVm.setTrayCode(code);
@ -137,7 +137,7 @@ public class MainActivity extends BaseActivity {
}
OkGo.<MyResult>post(url + "/api/IngCheck/" + (type ? "SmallMaterial" : "BigMaterial"))
OkGo.<MyResult>post(url + (type ? "CwssIngCheck/SmallMaterial" : "McsIngCheck/BigMaterial"))
.tag(this)
.upRequestBody(RequestBody.create(JSON, gson.toJson(ingredientInfo)))
.execute(new MyRecultCall(dialog, this) {
@ -158,26 +158,23 @@ public class MainActivity extends BaseActivity {
public void backAc(View view) {
finish();
}
private void selectGoods(){
OkGo.<MyResult>get(url + "/api/IngCheck/GetMcsMaterialInfo/" + mainVm.getTrayCode())
private void selectGoods() {
var type = mainVm.isType();
OkGo.<MyResult>get(url + (type ? "CwssIngCheck/GetCwssMaterialInfo/" : "McsIngCheck/GetMcsMaterialInfo/") + mainVm.getTrayCode())
.tag(this)
.execute(new MyRecultCall(dialog, this) {
@Override
public void onSuccess(Response<MyResult> response) {
super.onSuccess(response);
var body = response.body();
if (body.getStatusCode()==200){
if (mainVm.isType()){
}else {
// 大料
var material=gson.fromJson(body.getMessage(), Material.class);
mainVm.setGoodsCode(material.getMatCode());
mainVm.setGoodsName(material.getMatName());
mainVm.setGoodsNumber(material.getMatType());
mainVm.setGoodsVis(true);
}
}else {
if (body.getStatusCode() == 200) {
var material = gson.fromJson(body.getMessage(), Material.class);
mainVm.setGoodsCode(material.getMatCode());
mainVm.setGoodsName(material.getMatName());
mainVm.setGoodsNumber(material.getMatType());
mainVm.setGoodsVis(!type);
} else {
Toast.makeText(MainActivity.this, body.getMessage(), Toast.LENGTH_SHORT).show();
}
}

@ -0,0 +1,14 @@
package com.example.duken_mes;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class SelectActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_select);
}
}

@ -16,8 +16,9 @@ import com.google.gson.Gson;
import okhttp3.MediaType;
public abstract class BaseActivity extends AppCompatActivity {
public static String url = "http://10.168.205.73:6089";
// public static String url = "http://10.11.41.121:6089";
public static String urls = "http://10.168.205.70:6089/api/";
public static String urlb = "http://10.168.205.73:6089/api/";
// public static String url = "http://10.11.43.138:5001";
public ProgressDialog dialog;
public Gson gson;
public MediaType JSON = MediaType.parse("application/json; charset=utf-8");

@ -26,6 +26,7 @@
android:layout_marginStart="20dp"
android:layout_marginTop="40dp"
android:layout_marginEnd="20dp"
app:columnCount="2"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
@ -44,9 +45,17 @@
android:id="@+id/home_button2"
style="@style/radio_button_style"
android:drawableTop="@mipmap/icon_big"
android:text="大料投料"
android:text="上辅机投料"
app:layout_columnWeight="1" />
<RadioButton
android:onClick="startAc3"
style="@style/radio_button_style"
android:drawableTop="@mipmap/icon_cx"
android:text="投料记录查询"
app:layout_columnWeight="1" />
</androidx.gridlayout.widget.GridLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

@ -0,0 +1,71 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".SelectActivity"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="45dp"
android:background="@color/blue">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:letterSpacing="0.2"
android:text='@{vm.type?"投料记录查询"}'
android:textColor="@color/white"
android:textSize="18sp" />
<TextView
android:layout_width="70dp"
android:layout_height="match_parent"
android:layout_marginStart="10dp"
android:drawableLeft="@mipmap/icon_back"
android:gravity="center"
android:onClick="backAc"
android:text="返回"
android:textColor="@color/white"
android:textSize="15sp" />
</FrameLayout>
<TextView
style="@style/name_style"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="物料条码" />
<LinearLayout
style="@style/LinearLayout_style"
android:layout_width="match_parent"
android:layout_height="38dp"
android:layout_marginTop="5dp"
android:layout_marginEnd="18dp">
<EditText
android:id="@+id/trayCodeid"
style="@style/san_style"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:imeOptions="actionDone"
android:inputType="text"
android:lines="1"
android:maxLines="1"
android:singleLine="true"
android:text="@={vm.trayCode}" />
<ImageView
android:layout_width="38dp"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:background="@drawable/san_text_bg"
android:onClick="san_tray"
android:padding="10dp"
android:src="@mipmap/icon_san" />
</LinearLayout>
</LinearLayout>
Loading…
Cancel
Save