修改 小料判断

master
wangh 1 year ago
parent 8ec5d0a9f2
commit 92705cbd38

@ -17,12 +17,12 @@ public class HomeActivity extends AppCompatActivity {
} }
public void startAc1(View view) { public void startAc1(View view) {
intent.putExtra("type",false); intent.putExtra("type",true);
startActivity(intent); startActivity(intent);
} }
public void startAc2(View view) { public void startAc2(View view) {
intent.putExtra("type",true); intent.putExtra("type",false);
startActivity(intent); startActivity(intent);
} }

@ -6,6 +6,7 @@ import android.app.AlertDialog;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log;
import android.view.View; import android.view.View;
import android.widget.Toast; import android.widget.Toast;
@ -56,12 +57,14 @@ public class MainActivity extends BaseActivity {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
ingredientInfo.setIsOpen(1); ingredientInfo.setIsOpen(1);
submitRequest();
} }
}) })
.setNeutralButton("保存数据", new DialogInterface.OnClickListener() { .setNeutralButton("保存数据", new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
ingredientInfo.setIsOpen(2); ingredientInfo.setIsOpen(2);
submitRequest();
} }
}).create(); }).create();
} }
@ -113,7 +116,10 @@ public class MainActivity extends BaseActivity {
return; return;
} }
alertDialog.show(); alertDialog.show();
}
private void submitRequest(){
var type = mainVm.isType(); var type = mainVm.isType();
Log.e("TAG", "submitRequest:" + type);
if (type) { if (type) {
ingredientInfo.setRemainder(mainVm.isResidueYes()); ingredientInfo.setRemainder(mainVm.isResidueYes());
var residueNum = mainVm.getResidueNum(); var residueNum = mainVm.getResidueNum();
@ -127,7 +133,7 @@ public class MainActivity extends BaseActivity {
} }
OkGo.<MyResult>post(url + "/api/IngCheck/" + (type ? "BigMaterial" : "SmallMaterial")) OkGo.<MyResult>post(url + "/api/IngCheck/" + (type ?"SmallMaterial": "BigMaterial" ))
.tag(this) .tag(this)
.upRequestBody(RequestBody.create(JSON, gson.toJson(ingredientInfo))) .upRequestBody(RequestBody.create(JSON, gson.toJson(ingredientInfo)))
.execute(new MyRecultCall(dialog, this) { .execute(new MyRecultCall(dialog, this) {
@ -143,8 +149,6 @@ public class MainActivity extends BaseActivity {
} }
}); });
} }
public void backAc(View view) { public void backAc(View view) {

@ -31,7 +31,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:gravity="center" android:gravity="center"
android:letterSpacing="0.2" android:letterSpacing="0.2"
android:text='@{vm.type?"大料料罐投料":"小料料罐投料"}' android:text='@{vm.type?"小料料罐投料":"大料料罐投料"}'
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="18sp" /> android:textSize="18sp" />

Loading…
Cancel
Save