@@ -145,7 +145,9 @@ | |||||
tools:ignore="Instantiatable" /> | tools:ignore="Instantiatable" /> | ||||
<activity | <activity | ||||
android:name=".modules.home.activity.BottomNavigationMainActivity" | android:name=".modules.home.activity.BottomNavigationMainActivity" | ||||
android:exported="false" /> | |||||
android:exported="false" | |||||
android:windowSoftInputMode="stateHidden|stateAlwaysHidden" | |||||
/> | |||||
<activity | <activity | ||||
android:name=".modules.home.fragment.from.FileActivity" | android:name=".modules.home.fragment.from.FileActivity" | ||||
android:exported="false" /> | android:exported="false" /> | ||||
@@ -178,6 +180,7 @@ | |||||
</activity> | </activity> | ||||
<activity android:name=".modules.welcome.activity.LoginActivity"></activity> | <activity android:name=".modules.welcome.activity.LoginActivity"></activity> | ||||
<receiver | <receiver | ||||
android:name=".common.base.BootReceiver" | android:name=".common.base.BootReceiver" | ||||
android:exported="true"> | android:exported="true"> | ||||
@@ -47,4 +47,38 @@ public class CookieHelper { | |||||
.show(); | .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(); | |||||
} | |||||
} | |||||
} | } |
@@ -6,8 +6,15 @@ import androidx.fragment.app.Fragment; | |||||
import androidx.viewpager.widget.ViewPager; | import androidx.viewpager.widget.ViewPager; | ||||
import android.os.Bundle; | import android.os.Bundle; | ||||
import android.text.Editable; | |||||
import android.text.TextWatcher; | |||||
import android.util.Log; | import android.util.Log; | ||||
import android.view.KeyEvent; | |||||
import android.view.MenuItem; | 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 android.widget.RelativeLayout; | ||||
import com.bonait.bnframework.R; | import com.bonait.bnframework.R; | ||||
@@ -51,6 +58,8 @@ public class BottomNavigationMainActivity extends BaseActivity{ | |||||
@BindView(R.id.viewpager) | @BindView(R.id.viewpager) | ||||
QMUIViewPager viewPager; | QMUIViewPager viewPager; | ||||
@BindView(R.id.Test_res) | |||||
EditText shaoma_Text; | |||||
@Override | @Override | ||||
protected void onCreate(Bundle savedInstanceState) { | protected void onCreate(Bundle savedInstanceState) { | ||||
@@ -69,9 +78,56 @@ public class BottomNavigationMainActivity extends BaseActivity{ | |||||
initFragment(); | initFragment(); | ||||
Init(); | 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 | @Override | ||||
protected void onDestroy() { | protected void onDestroy() { | ||||
//关闭PLC连接 | //关闭PLC连接 | ||||
@@ -1,5 +1,6 @@ | |||||
package com.bonait.bnframework.modules.home.fragment; | package com.bonait.bnframework.modules.home.fragment; | ||||
import static android.content.Context.INPUT_METHOD_SERVICE; | |||||
import static com.bonait.bnframework.MainApplication.getContext; | import static com.bonait.bnframework.MainApplication.getContext; | ||||
import androidx.annotation.NonNull; | import androidx.annotation.NonNull; | ||||
@@ -16,11 +17,21 @@ import android.graphics.Color; | |||||
import android.os.Bundle; | import android.os.Bundle; | ||||
import android.os.Handler; | import android.os.Handler; | ||||
import android.os.Message; | 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.util.Log; | ||||
import android.view.Gravity; | import android.view.Gravity; | ||||
import android.view.KeyEvent; | |||||
import android.view.LayoutInflater; | import android.view.LayoutInflater; | ||||
import android.view.View; | 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.Button; | ||||
import android.widget.EditText; | |||||
import android.widget.ListView; | import android.widget.ListView; | ||||
import android.widget.RelativeLayout; | import android.widget.RelativeLayout; | ||||
import android.widget.TextView; | 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.QMUIDialog; | ||||
import com.qmuiteam.qmui.widget.dialog.QMUIDialogAction; | import com.qmuiteam.qmui.widget.dialog.QMUIDialogAction; | ||||
import org.w3c.dom.Text; | |||||
import java.lang.reflect.Method; | |||||
import java.security.PublicKey; | import java.security.PublicKey; | ||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import java.util.Arrays; | import java.util.Arrays; | ||||
@@ -94,6 +108,7 @@ import java.util.List; | |||||
import butterknife.BindView; | import butterknife.BindView; | ||||
import butterknife.ButterKnife; | import butterknife.ButterKnife; | ||||
import butterknife.OnClick; | import butterknife.OnClick; | ||||
import io.netty.util.internal.StringUtil; | |||||
/** | /** | ||||
* | * | ||||
@@ -102,10 +117,7 @@ public class MakeGoodFragment extends BaseFragment { | |||||
private String TAG="主页面"; | private String TAG="主页面"; | ||||
public void InfoView(String shaoma){ | |||||
shaoma_view.setVisibility(3); | |||||
shaoma_Text.setText(shaoma); | |||||
} | |||||
private QMUIViewPager viewPager; | private QMUIViewPager viewPager; | ||||
@BindView(R.id.topbar) | @BindView(R.id.topbar) | ||||
QMUITopBarLayout mTopBar;//顶部标题 | QMUITopBarLayout mTopBar;//顶部标题 | ||||
@@ -161,7 +173,7 @@ public class MakeGoodFragment extends BaseFragment { | |||||
* 获取扫码内容 | * 获取扫码内容 | ||||
*/ | */ | ||||
@BindView(R.id.res_text) | @BindView(R.id.res_text) | ||||
TextView shaoma_Text; | |||||
EditText shaoma_Text; | |||||
/** | /** | ||||
* 扫码界面展示 | * 扫码界面展示 | ||||
@@ -194,7 +206,7 @@ public class MakeGoodFragment extends BaseFragment { | |||||
Run(); | Run(); | ||||
ShaomaTest.Getinstance().Open(activity,this.context); | |||||
/*ShaomaTest.Getinstance().Open(activity,this.context);*/ | |||||
/* SerialManage.GetInstance().init(new SerialInter() { | /* SerialManage.GetInstance().init(new SerialInter() { | ||||
@Override | @Override | ||||
public void connectMsg(String path, boolean isSucc) { | public void connectMsg(String path, boolean isSucc) { | ||||
@@ -490,9 +502,9 @@ public class MakeGoodFragment extends BaseFragment { | |||||
} | } | ||||
break; | break; | ||||
case R.id.yes: | case R.id.yes: | ||||
shaoma_view.setVisibility(View.GONE); | |||||
shaoma_view.setVisibility(View.INVISIBLE); | |||||
case R.id.no: | 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; | 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); | |||||
} | |||||
} | |||||
}); | |||||
} | |||||
/** | /** | ||||
* 实时显示线程 | * 实时显示线程 | ||||
*/ | */ | ||||
@@ -11,6 +11,7 @@ | |||||
<RelativeLayout | <RelativeLayout | ||||
android:layout_width="match_parent" | android:layout_width="match_parent" | ||||
android:layout_height="match_parent"> | android:layout_height="match_parent"> | ||||
<com.qmuiteam.qmui.widget.QMUIViewPager | <com.qmuiteam.qmui.widget.QMUIViewPager | ||||
android:id="@+id/viewpager" | android:id="@+id/viewpager" | ||||
android:background="?attr/app_content_bg_color" | android:background="?attr/app_content_bg_color" | ||||
@@ -76,6 +77,31 @@ | |||||
android:textStyle="bold|italic" /> | android:textStyle="bold|italic" /> | ||||
</RelativeLayout> | </RelativeLayout> | ||||
</LinearLayout> | </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> | </RelativeLayout> | ||||
<!--水印--> | <!--水印--> | ||||
@@ -6,6 +6,7 @@ | |||||
android:layout_height="match_parent" | android:layout_height="match_parent" | ||||
android:background="@color/app_color_blue"> | android:background="@color/app_color_blue"> | ||||
<RelativeLayout | <RelativeLayout | ||||
android:layout_width="match_parent" | android:layout_width="match_parent" | ||||
android:layout_height="match_parent" | android:layout_height="match_parent" | ||||
@@ -118,8 +119,7 @@ | |||||
android:layout_width="match_parent" | android:layout_width="match_parent" | ||||
android:layout_height="match_parent" | android:layout_height="match_parent" | ||||
android:visibility="gone" | android:visibility="gone" | ||||
android:clickable="true" | |||||
android:focusable="true"/> | |||||
android:clickable="true"/> | |||||
<LinearLayout | <LinearLayout | ||||
android:layout_width="match_parent" | android:layout_width="match_parent" | ||||
android:layout_height="wrap_content" | android:layout_height="wrap_content" | ||||
@@ -190,11 +190,12 @@ | |||||
android:layout_width="match_parent" | android:layout_width="match_parent" | ||||
android:layout_height="wrap_content" | android:layout_height="wrap_content" | ||||
android:background="@color/app_color_blue" /> | android:background="@color/app_color_blue" /> | ||||
<RelativeLayout | <RelativeLayout | ||||
android:id="@+id/shaoma_view" | android:id="@+id/shaoma_view" | ||||
android:layout_width="match_parent" | android:layout_width="match_parent" | ||||
android:layout_height="match_parent" | android:layout_height="match_parent" | ||||
android:visibility="gone" | |||||
android:visibility="invisible" | |||||
android:background="#A5000000"> | android:background="#A5000000"> | ||||
<LinearLayout | <LinearLayout | ||||
@@ -228,12 +229,14 @@ | |||||
android:layout_height="wrap_content" | android:layout_height="wrap_content" | ||||
android:text="扫码编号:" | android:text="扫码编号:" | ||||
android:gravity="right"/> | android:gravity="right"/> | ||||
<TextView | |||||
<EditText | |||||
android:layout_width="wrap_content" | android:layout_width="wrap_content" | ||||
android:layout_weight="1" | android:layout_weight="1" | ||||
android:layout_height="wrap_content" | android:layout_height="wrap_content" | ||||
android:gravity="left" | android:gravity="left" | ||||
android:textSize="18dp" | android:textSize="18dp" | ||||
android:focusable="true" | |||||
android:focusableInTouchMode="true" | |||||
android:textColor="@color/black" | android:textColor="@color/black" | ||||
android:id="@+id/res_text"/> | android:id="@+id/res_text"/> | ||||
@@ -281,4 +284,5 @@ | |||||
</LinearLayout> | </LinearLayout> | ||||
</RelativeLayout> | </RelativeLayout> | ||||
</com.qmuiteam.qmui.widget.QMUIWindowInsetLayout> | </com.qmuiteam.qmui.widget.QMUIWindowInsetLayout> |