ソースを参照

lyw 上传

茶饮配方
lyw 7ヶ月前
コミット
a62b0ee444
6個のファイルの変更244行の追加13行の削除
  1. +4
    -1
      app/src/main/AndroidManifest.xml
  2. +34
    -0
      app/src/main/java/com/bonait/bnframework/common/cookie/CookieHelper.java
  3. +56
    -0
      app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigationMainActivity.java
  4. +116
    -8
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/MakeGoodFragment.java
  5. +26
    -0
      app/src/main/res/layout/activity_bottom_navigation_main.xml
  6. +8
    -4
      app/src/main/res/layout/fragment_make_good.xml

+ 4
- 1
app/src/main/AndroidManifest.xml ファイルの表示

@@ -145,7 +145,9 @@
tools:ignore="Instantiatable" />
<activity
android:name=".modules.home.activity.BottomNavigationMainActivity"
android:exported="false" />
android:exported="false"
android:windowSoftInputMode="stateHidden|stateAlwaysHidden"
/>
<activity
android:name=".modules.home.fragment.from.FileActivity"
android:exported="false" />
@@ -178,6 +180,7 @@
</activity>
<activity android:name=".modules.welcome.activity.LoginActivity"></activity>


<receiver
android:name=".common.base.BootReceiver"
android:exported="true">


+ 34
- 0
app/src/main/java/com/bonait/bnframework/common/cookie/CookieHelper.java ファイルの表示

@@ -47,4 +47,38 @@ public class CookieHelper {
.show();
}
}

public static void Show(Activity activity, String title, String message,int showTime) {
if (Mode == 1) {
new CookieBar.Builder(activity)
.setBackgroundColor(R.color.app_color_blue)
.setActionColor(android.R.color.white)
.setTitleColor(R.color.white)
.setTitle(title)
.setMessage(message)
.setDuration(showTime)
.setActionWithIcon(R.mipmap.ic_action_close, new OnActionClickListener() {
@Override
public void onClick() {

}
})
.show();
} else {
new CookieBar.Builder(activity)
.setTitle(title)
.setMessage(message)
.setDuration(showTime)
.setBackgroundColor(R.color.app_color_blue)
.setActionColor(android.R.color.white)
.setTitleColor(R.color.white)
.setAction("已读确认关闭", new OnActionClickListener() {
@Override
public void onClick() {

}
})
.show();
}
}
}

+ 56
- 0
app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigationMainActivity.java ファイルの表示

@@ -6,8 +6,15 @@ import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;

import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
import android.view.KeyEvent;
import android.view.MenuItem;
import android.view.View;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.RelativeLayout;

import com.bonait.bnframework.R;
@@ -51,6 +58,8 @@ public class BottomNavigationMainActivity extends BaseActivity{
@BindView(R.id.viewpager)
QMUIViewPager viewPager;

@BindView(R.id.Test_res)
EditText shaoma_Text;

@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -69,9 +78,56 @@ public class BottomNavigationMainActivity extends BaseActivity{
initFragment();
Init();

shaoma_Text.requestFocus();
shaoma_Text.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (hasFocus) {
} else {
shaoma_Text.clearFocus();
shaoma_Text.requestFocus();
}
}
});
shaoma_Text.setOnKeyListener(new View.OnKeyListener() {
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_ENTER && event.getAction() == KeyEvent.ACTION_DOWN) {
if (shaoma_Text.getText() != null && shaoma_Text.getText().toString() != "") {
String msg = shaoma_Text.getText().toString();
msg = msg.replace("\\n", "");
if (fragmentList.size()>2){
MakeGoodFragment makeGoodFragment=(MakeGoodFragment) fragmentList.get(2);
makeGoodFragment.RecipeRun(msg);
}
/*RecipeRun(msg);*/
}
shaoma_Text.setText("");

}
return false;
}
});
InputMethodManager im = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
shaoma_Text.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}

@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}

@Override
public void afterTextChanged(Editable s) {
im.hideSoftInputFromWindow(shaoma_Text.getWindowToken(), 0);
}
});


}


@Override
protected void onDestroy() {
//关闭PLC连接


+ 116
- 8
app/src/main/java/com/bonait/bnframework/modules/home/fragment/MakeGoodFragment.java ファイルの表示

@@ -1,5 +1,6 @@
package com.bonait.bnframework.modules.home.fragment;

import static android.content.Context.INPUT_METHOD_SERVICE;
import static com.bonait.bnframework.MainApplication.getContext;

import androidx.annotation.NonNull;
@@ -16,11 +17,21 @@ import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.os.ResultReceiver;
import android.text.Editable;
import android.text.InputType;
import android.text.TextWatcher;
import android.text.method.KeyListener;
import android.util.Log;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;
@@ -85,6 +96,9 @@ import com.qmuiteam.qmui.widget.QMUIViewPager;
import com.qmuiteam.qmui.widget.dialog.QMUIDialog;
import com.qmuiteam.qmui.widget.dialog.QMUIDialogAction;

import org.w3c.dom.Text;

import java.lang.reflect.Method;
import java.security.PublicKey;
import java.util.ArrayList;
import java.util.Arrays;
@@ -94,6 +108,7 @@ import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import io.netty.util.internal.StringUtil;

/**
*
@@ -102,10 +117,7 @@ public class MakeGoodFragment extends BaseFragment {

private String TAG="主页面";

public void InfoView(String shaoma){
shaoma_view.setVisibility(3);
shaoma_Text.setText(shaoma);
}

private QMUIViewPager viewPager;
@BindView(R.id.topbar)
QMUITopBarLayout mTopBar;//顶部标题
@@ -161,7 +173,7 @@ public class MakeGoodFragment extends BaseFragment {
* 获取扫码内容
*/
@BindView(R.id.res_text)
TextView shaoma_Text;
EditText shaoma_Text;

/**
* 扫码界面展示
@@ -194,7 +206,7 @@ public class MakeGoodFragment extends BaseFragment {
Run();


ShaomaTest.Getinstance().Open(activity,this.context);
/*ShaomaTest.Getinstance().Open(activity,this.context);*/
/* SerialManage.GetInstance().init(new SerialInter() {
@Override
public void connectMsg(String path, boolean isSucc) {
@@ -490,9 +502,9 @@ public class MakeGoodFragment extends BaseFragment {
}
break;
case R.id.yes:
shaoma_view.setVisibility(View.GONE);
shaoma_view.setVisibility(View.INVISIBLE);
case R.id.no:
shaoma_view.setVisibility(View.GONE);
shaoma_view.setVisibility(View.INVISIBLE);

}
}
@@ -520,6 +532,102 @@ public class MakeGoodFragment extends BaseFragment {
};

int time=0;



public void RecipeRun(String msg)
{
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
if ((msg != null) && (((String) msg).length() > 2) && ((String) msg).contains("|")) {
//拿到扫码数据
//例如 ORD001|P0003|A001,M002,T001|2
// OR001|A001|2,22|1

String[] res = ((String) msg).split("[|]");
if (res.length >= 4) {
String orderid = res[0];//ORD001
String goodid = res[1];//P0003 商品id
String ggid = res[2];//A001,M002,T001 配方ids

String ggids = "";//规格id集合
String names = "";

if (QueryDB.GetOrderthirdPartyIDIs(orderid)) {
message = "已有订单,重复扫码!";
mHandler.sendEmptyMessage(1);
return;
}
int num = 1;
try {
num = Integer.parseInt(res[3]);
for (String item : ggid.split("[,]")) {
for (ResGoodProperty k : DataBus.getInstance().bpa_goodproperties) {
if (k.child != null && k.child.size() > 0) {
for (ResGoodProperty chd : k.child) {
if (chd.foreignKeyRe != null && !chd.foreignKeyRe.isEmpty() && chd.foreignKeyRe.equals(item)) {
ggids += chd.id + ",";
names += "/" + chd.name;
}
}
}

}
}

if (!ggids.isEmpty()) {
ggids = ggids.substring(0, ggids.length() - 1);
}
} catch (Exception ex) {
}

BPA_GOODS good = QueryDB.GetGoodsforeignKeyId(goodid);
if (good == null) {
message = "没有查询到该商品!";
mHandler.sendEmptyMessage(1);
} else {
BPA_GOODSRECIPENAME goodsrecipename = QueryDB.GetGoodsRecipeNameDesignId(ggids, good.id);
if (goodsrecipename != null) {
BPA_ORDER order = new BPA_ORDER();
order.thirdPartyID = orderid;
order.status = 0;
order.deviceID = ConfigName.getInstance().DeviceId;
order.userID = ConfigName.getInstance().user.userID;
QueryDB.AddOrder(order);

for (int mm = 0; mm < num; mm++) {
BPA_SUBORDER suborder = new BPA_SUBORDER();
suborder.deviceID = ConfigName.getInstance().DeviceId;
suborder.userID = ConfigName.getInstance().user.userID;
suborder.orderID = order.id;
suborder.goodsID = good.id;
suborder.recipeID = goodsrecipename.id;
suborder.number = 1;
suborder.status = 0;
suborder.exp = names;
QueryDB.AddSubOrder(suborder);
DataBus.getInstance().AddGoodsMake(suborder);
}
message = "加入订单队列成功!";
mHandler.sendEmptyMessage(2);
} else {
message = "没有查询到该商品配方信息!";
mHandler.sendEmptyMessage(1);
}
}

} else {
message = "没有查询到该商品!";
mHandler.sendEmptyMessage(1);
}
} else {
message = "服务器异常,请稍后重试!";
mHandler.sendEmptyMessage(1);
}
}
});
}
/**
* 实时显示线程
*/


+ 26
- 0
app/src/main/res/layout/activity_bottom_navigation_main.xml ファイルの表示

@@ -11,6 +11,7 @@
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">

<com.qmuiteam.qmui.widget.QMUIViewPager
android:id="@+id/viewpager"
android:background="?attr/app_content_bg_color"
@@ -76,6 +77,31 @@
android:textStyle="bold|italic" />
</RelativeLayout>
</LinearLayout>

<LinearLayout
android:layout_width="260dp"
android:layout_height="50dp"
android:visibility="invisible"
android:orientation="horizontal"
android:gravity="center">
<TextView
android:layout_width="wrap_content"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="扫码编号:"
android:gravity="right"/>
<EditText
android:layout_width="wrap_content"
android:layout_weight="1"
android:layout_height="wrap_content"
android:gravity="left"
android:textSize="18dp"
android:focusable="true"
android:focusableInTouchMode="true"
android:textColor="@color/black"
android:id="@+id/Test_res"/>

</LinearLayout>
</RelativeLayout>

<!--水印-->


+ 8
- 4
app/src/main/res/layout/fragment_make_good.xml ファイルの表示

@@ -6,6 +6,7 @@
android:layout_height="match_parent"
android:background="@color/app_color_blue">


<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
@@ -118,8 +119,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"
android:clickable="true"
android:focusable="true"/>
android:clickable="true"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -190,11 +190,12 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/app_color_blue" />

<RelativeLayout
android:id="@+id/shaoma_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"
android:visibility="invisible"
android:background="#A5000000">

<LinearLayout
@@ -228,12 +229,14 @@
android:layout_height="wrap_content"
android:text="扫码编号:"
android:gravity="right"/>
<TextView
<EditText
android:layout_width="wrap_content"
android:layout_weight="1"
android:layout_height="wrap_content"
android:gravity="left"
android:textSize="18dp"
android:focusable="true"
android:focusableInTouchMode="true"
android:textColor="@color/black"
android:id="@+id/res_text"/>

@@ -281,4 +284,5 @@
</LinearLayout>

</RelativeLayout>

</com.qmuiteam.qmui.widget.QMUIWindowInsetLayout>

読み込み中…
キャンセル
保存