Commit 890979d5 by 宁斌

Merge branch 'dev' of http://gitlab.ricepon.com/ningbin/GSA-Cloud into dev

 Conflicts:
	component-table/src/main/res/layout/table_dialog_cancel_food.xml
parents ef2056da 94e2feb7
......@@ -372,7 +372,7 @@ public class ColdChainMainActivity extends BaseFragmentActivity<ColdChainMainPre
view.findViewById(R.id.layout_history_order).setOnClickListener(v1 -> {
CC.obtainBuilder(com.gingersoft.gsa.cloud.component.ComponentName.COMPONENT_DELIVERYPICK)
.setActionName("historyActivity")
.addParam(DeliveryPickConstans.ORDER_TYPE, "1")
.addParam(DeliveryPickConstans.ORDER_TYPE, DeliveryPickConstans.COLD_CHAIN_TYPE)
.build()
.call();
pop.dismiss();
......
......@@ -235,7 +235,7 @@ public class OrderDetailsActivity extends BaseActivity<OrderDetailsPresenter> im
mTvOrderStatus.setText("待確認訂單");
mTvOrderStatus.setTextColor(ContextCompat.getColor(mContext, R.color.order_state0_color));
}
mTvOrderNo.setText(getResources().getString(R.string.order_no) + bean.getORDER_NO());
mTvOrderNo.setText(getResources().getString(R.string.order_no) + bean.getID());
mTvCreateTime.setText(getResources().getString(R.string.create_order_time) + TimeUtils.parseTimeRepeat(bean.getCREATE_TIME(), TimeUtils.DEFAULT_DATE_FORMAT));
if (TextUtil.isNotEmptyOrNullOrUndefined(bean.getRECEIVER())) {
mTvReceiver.setText(bean.getRECEIVER());
......
......@@ -26,7 +26,7 @@ public class OrderListAdapter extends BaseQuickAdapter<OrderList.DataBeanX.DataB
public OrderListAdapter(@Nullable List<OrderList.DataBeanX.DataBean> data) {
super(R.layout.cold_chain_order_item2, data);
super(R.layout.cold_chain_order_item, data);
}
......@@ -48,7 +48,7 @@ public class OrderListAdapter extends BaseQuickAdapter<OrderList.DataBeanX.DataB
baseViewHolder.setText(R.id.tv_address, "地址:" + dataBean.getADDRESS_DETAIL());
baseViewHolder.setText(R.id.tv_delivery_state, getStatus(dataBean.getCurStat()));
baseViewHolder.setText(R.id.tv_order_amount, "$" + dataBean.getPAY_AMOUNT());
baseViewHolder.setText(R.id.tv_order_code, String.format(getContext().getString(R.string.str_order_code), dataBean.getTakeFoodCode()));
if (dataBean.getIsRead() == 0) {
baseViewHolder.setVisible(R.id.fl_border, true);
alphaAnimator(baseViewHolder.getView(R.id.fl_border));
......
......@@ -81,7 +81,7 @@
android:layout_height="wrap_content"
android:layout_margin="@dimen/other_order_info_dialog_content_marginLeft"
android:layout_marginTop="@dimen/dp_10"
tools:text="訂單號:" />
tools:text="訂單號:" />
<TextView
android:id="@+id/tv_create_time"
......@@ -149,7 +149,7 @@
style="@style/otherOrderReceiving_title_textStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="訂單:" />
android:text="訂單:" />
<TextView
android:id="@+id/tv_bill_num"
......
......@@ -3,36 +3,37 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_3"
android:layout_marginTop="@dimen/dp_7"
android:layout_marginRight="@dimen/dp_3">
android:layout_height="wrap_content">
<com.lihang.ShadowLayout
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:hl_cornerRadius="@dimen/dp_8"
app:hl_shadowLimit="@dimen/dp_3">
android:foreground="?attr/selectableItemBackground"
app:cardCornerRadius="@dimen/dp_8"
app:cardElevation="@dimen/dp_2"
app:cardPreventCornerOverlap="true"
app:cardUseCompatPadding="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="@dimen/dp_4"
android:orientation="horizontal"
android:paddingLeft="@dimen/dp_14"
android:paddingTop="@dimen/dp_10"
android:paddingRight="@dimen/dp_14"
android:paddingBottom="@dimen/dp_6">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_3"
android:gravity="center_vertical"
android:orientation="horizontal">
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginRight="@dimen/dp_5"
android:layout_weight="2"
android:orientation="vertical">
<TextView
android:id="@+id/tv_pay_method"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:background="@drawable/shape_payments_btn"
android:gravity="left"
android:paddingLeft="@dimen/dp_8"
......@@ -41,147 +42,134 @@
android:paddingBottom="@dimen/dp_6"
android:textColor="@color/white"
android:textSize="@dimen/dp_14"
android:textStyle="bold"/>
android:textStyle="bold"
tools:text="支付方式" />
<View
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1" />
<TextView
android:id="@+id/tv_order_user_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="2"
android:textColor="@color/theme_text_color"
android:textSize="@dimen/sp_14"
android:textStyle="bold"
tools:text="用戶名+手機號(1234567862)安居房三級分類誰的簡歷福克斯就"
tools:textColor="@color/theme_333_color" />
<View
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1" />
<TextView
android:id="@+id/tv_order_code"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:textColor="@color/theme_text_color"
android:textSize="@dimen/sp_14"
android:textStyle="bold"
tools:text="訂單碼:1002"
tools:textColor="@color/theme_333_color" />
<View
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1" />
<TextView
android:id="@+id/tv_address"
style="@style/order_item_info_textStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/color_3c"
tools:text="用戶收貨地址"
tools:textColor="#868686" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="right"
android:orientation="vertical">
<TextView
android:id="@+id/tv_order_time"
style="@style/order_item_twelve_textStyle"
android:layout_width="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_5"
android:layout_marginRight="@dimen/dp_10"
android:layout_weight="1"
android:gravity="right"
android:text="@string/Key_add_10"
android:textSize="@dimen/dp_10"
tools:text="下單時間"
tools:text="2019-07-06 15:30:00"
tools:textColor="@color/theme_333_color" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
<TextView
android:id="@+id/tv_logistics_order_print_state"
style="@style/order_item_info_title_textStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginTop="@dimen/dp_14"
android:orientation="vertical">
<TextView
android:id="@+id/tv_order_user_name"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/dp_2"
android:layout_marginRight="@dimen/dp_10"
android:textColor="@color/theme_text_color"
android:textSize="@dimen/sp_14"
android:textStyle="bold"
tools:text="用戶名+手機號(1234567862)"
tools:textColor="@color/theme_333_color" />
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_5">
<TextView
android:id="@+id/tv_address_text"
style="@style/order_item_info_title_textStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_6"
android:layout_marginBottom="@dimen/dp_10"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="地址:"
tools:textColor="@color/theme_333_color" />
<TextView
android:id="@+id/tv_address"
style="@style/order_item_info_textStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintLeft_toRightOf="@id/tv_address_text"
app:layout_constraintTop_toTopOf="@id/tv_address_text"
tools:text="用戶收貨地址"
tools:textColor="#868686" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
<LinearLayout
android:layout_marginTop="@dimen/dp_9"
android:gravity="right"
android:text="物流單已打印"
android:textColor="@color/color_3c" />
<TextView
android:id="@+id/tv_delivery_state"
style="@style/order_item_info_title_textStyle"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:orientation="vertical">
<ImageView
android:id="@+id/ic_vehicle"
android:layout_width="@dimen/dp_26"
android:layout_height="@dimen/dp_26"
android:layout_marginLeft="@dimen/dp_5"
android:layout_marginRight="@dimen/dp_5" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_2"
android:layout_weight="0.35"
android:gravity="center_horizontal"
android:orientation="vertical">
<TextView
android:id="@+id/tv_delivery_state"
style="@style/order_item_info_title_textStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_15"
android:textColor="@color/color_3c"
tools:text="已通知物流"
tools:textColor="@color/theme_333_color" />
<TextView
android:id="@+id/tv_order_state"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_11"
android:paddingLeft="@dimen/dp_13"
android:paddingTop="@dimen/dp_4"
android:paddingRight="@dimen/dp_13"
android:paddingBottom="@dimen/dp_4"
android:textColor="@color/white"
android:textSize="@dimen/dp_12"
tools:text="訂單狀態"
tools:textColor="@color/theme_333_color" />
<TextView
android:id="@+id/tv_order_amount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_2"
android:gravity="center_horizontal"
android:textColor="@color/red_600"
android:textSize="@dimen/sp_16"
app:layout_constraintHorizontal_weight="1"
app:layout_constraintLeft_toRightOf="@id/tv_address"
app:layout_constraintRight_toRightOf="parent"
tools:text="$14141"
tools:textColor="@color/theme_333_color" />
</LinearLayout>
android:layout_marginTop="@dimen/dp_9"
android:gravity="right"
android:textColor="@color/color_3c"
tools:text="已通知物流"
tools:textColor="@color/theme_333_color" />
<TextView
android:id="@+id/tv_order_state"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_3"
android:gravity="center"
android:paddingLeft="@dimen/dp_20"
android:paddingTop="@dimen/dp_8"
android:paddingRight="@dimen/dp_20"
android:paddingBottom="@dimen/dp_8"
android:textColor="@color/white"
android:textSize="@dimen/dp_12"
tools:text="訂單狀態"
tools:textColor="@color/theme_333_color" />
<TextView
android:id="@+id/tv_order_amount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_7"
android:gravity="center_horizontal"
android:maxWidth="@dimen/dp_100"
android:textColor="@color/red_600"
android:textSize="@dimen/sp_16"
tools:text="$14141144"
tools:textColor="@color/theme_333_color" />
</LinearLayout>
</LinearLayout>
</com.lihang.ShadowLayout>
<FrameLayout
android:id="@+id/fl_border"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/shape_order_border"
android:visibility="gone" />
<FrameLayout
android:id="@+id/fl_border"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/shape_order_border"
android:visibility="gone" />
</androidx.cardview.widget.CardView>
</FrameLayout>
......@@ -73,21 +73,33 @@
app:layout_constraintRight_toLeftOf="@id/tv_order_state"
app:layout_constraintTop_toBottomOf="@id/tv_pay_method"
app:layout_constraintTop_toTopOf="@id/tv_order_state"
tools:text="用戶名+手機號(1234567862)安居房三級分類誰的簡歷福克斯就"
tools:textColor="@color/theme_333_color" />
<TextView
android:id="@+id/tv_order_code"
android:layout_width="0dp"
android:layout_height="match_parent"
android:ellipsize="end"
android:maxLines="1"
android:textColor="@color/theme_text_color"
android:textSize="@dimen/sp_14"
android:textStyle="bold"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/tv_order_state"
app:layout_constraintTop_toBottomOf="@id/tv_order_user_name"
tools:text="用戶名+手機號(1234567862)"
tools:textColor="@color/theme_333_color" />
<TextView
android:id="@+id/tv_address"
style="@style/order_item_info_textStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_15"
android:layout_marginRight="@dimen/dp_10"
android:textColor="@color/color_3c"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/tv_order_amount"
app:layout_constraintTop_toBottomOf="@id/tv_order_user_name"
app:layout_constraintTop_toBottomOf="@id/tv_order_code"
app:layout_constraintVertical_bias="1"
tools:text="用戶收貨地址"
tools:textColor="#868686" />
......
......@@ -7,17 +7,17 @@
android:background="@color/white"
android:orientation="vertical">
<androidx.coordinatorlayout.widget.CoordinatorLayout
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/color_f0"
app:cardElevation="@dimen/dp_2"
tools:context=".ui.activity.DeliveryOrderMainActivity">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
app:elevation="@dimen/dp_0">
android:background="@color/white">
<com.qmuiteam.qmui.widget.QMUITopBar
android:id="@+id/coldchain_main_top_bar"
......@@ -198,11 +198,10 @@
android:padding="@dimen/dp_10"
android:text="餘額:"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_16"
android:visibility="gone" />
android:textSize="@dimen/dp_16" />
</com.google.android.material.appbar.AppBarLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</androidx.cardview.widget.CardView>
<androidx.viewpager.widget.ViewPager
android:id="@+id/view_pager"
......
<resources>
<string name="cold_chain_name">凍鏈</string>
<string name="str_order_code">訂單碼:%1$s</string>
</resources>
......@@ -6,6 +6,7 @@ import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.billy.cc.core.component.CC
import com.gingersoft.gsa.cloud.common.constans.DeliveryPickConstans
import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager
import com.gingersoft.gsa.cloud.common.utils.time.TimeUtils
import com.gingersoft.gsa.cloud.common.utils.toast.ToastUtils
......@@ -26,8 +27,8 @@ class HistoryOrderViewModel(private val historyOrderRepository: HistoryOrderRepo
var historyEndTime = MutableLiveData<String>(TimeUtils.getOldDate(0)) //查詢結束時間
var status = MutableLiveData("4") //按類型查詢
var searchValue = MutableLiveData("")//按搜索內容查詢
var orderType = "2,7" //訂單類型 2 線上外賣訂單,7 自取訂單
var orderFrom = 0 //訂單來源 8 冷鏈用
var orderType = DeliveryPickConstans.DELIVERY_TYPE //訂單類型 2 線上外賣訂單,7 自取訂單
var orderFrom = 0 //訂單來源
fun getHistoryOrderList(pageIndex: String, orderNum: String = "", startDate: String, endDate: String, status: String) {
launch({
......
......@@ -16,7 +16,6 @@ import com.epson.epos2.Epos2Exception;
import com.epson.epos2.printer.Printer;
import com.epson.epos2.printer.PrinterStatusInfo;
import com.epson.epos2.printer.ReceiveListener;
import com.gingersoft.gsa.cloud.common.constans.GoldConstants;
import com.gingersoft.gsa.cloud.common.constans.HttpsConstans;
import com.gingersoft.gsa.cloud.common.constans.PrintConstans;
import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager;
......@@ -42,9 +41,7 @@ import com.gingersoft.gsa.cloud.print.bean.UpdateBean;
import com.hyweb.n5.lib.constant.PrinterConstant;
import com.hyweb.n5.lib.util.PrinterUtil;
import com.hyweb.n5.server.aidl.IOnPrintCallback;
import com.jess.arms.utils.RxLifecycleUtils;
import com.joe.print.mvp.print.PrintPrjKitchen;
import com.joe.print.mvp.print.PrinterRoot;
import com.joe.print.mvp.print.common.PrinterFinderCallback;
import com.joe.print.mvp.print.common.SendResultCode;
import com.joe.print.mvp.print.maker.PrjPrintMaker;
......@@ -64,7 +61,6 @@ import org.json.JSONObject;
import java.io.IOException;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
......@@ -72,7 +68,6 @@ import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import io.reactivex.Observable;
import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
......@@ -94,13 +89,8 @@ import static com.gingersoft.gsa.cloud.database.bean.PrinterDeviceBean.PRINT_USB
*/
public class PrjService extends Service implements ReceiveListener {
// private static final String TAG = PrjService.class.getSimpleName();
private Disposable pollDisposable;
private Disposable wakeDisposable;
private List<PrinterDeviceBean> printerDeviceBeans;
private List<PrjBean.DataBean.Bean> printDatas = new ArrayList<>();
private List<PrintCurrencyBean> printCurrencyBeans;//通用打印配置
private Context mContext;
private String TAG = "Prj";
......@@ -116,17 +106,6 @@ public class PrjService extends Service implements ReceiveListener {
public int onStartCommand(Intent intent, int flags, int startId) {
mContext = this;
LoganManager.w_printer(TAG, "onStartCommand");
RxIOTask ioTask = new RxIOTask(0) {
@Override
public Object doInIOThread(Object o) {
LoganManager.w_printer(TAG, "获取打印設備信息");
LoganManager.w_printer(TAG, "currThredName-->" + Thread.currentThread().getName());
//获取打印設備信息
getPrintList();
return null;
}
};
RxJavaUtils.doInIOThread(ioTask);
//開始請求
startGetPrjInfo();
return super.onStartCommand(intent, flags, startId);
......@@ -162,15 +141,6 @@ public class PrjService extends Service implements ReceiveListener {
printerFinder.startFinder();
}
private void getPrintList() {
if (printerDeviceBeans == null || printerDeviceBeans.size() == 0) {
PrinterDeviceDaoUtils printerDeviceDaoUtils = new PrinterDeviceDaoUtils(this);
printerDeviceBeans = printerDeviceDaoUtils.queryAllPrinterDeviceBean();
printerDeviceDaoUtils.closeConnection();
}
printCurrencyBeans = MyPrintUtils.getPrintCurrencyBeans(this);
}
@Nullable
@Override
public IBinder onBind(Intent intent) {
......@@ -188,12 +158,9 @@ public class PrjService extends Service implements ReceiveListener {
return;
}
pollDisposable = RxJavaUtils.polling(10, 30, TimeUnit.SECONDS)
.subscribe(new Consumer<Long>() {
@Override
public void accept(Long aLong) throws Exception {
LoganManager.w_printer(TAG, "獲取Prj數據-->");
getPrjInfo();
}
.subscribe(aLong -> {
LoganManager.w_printer(TAG, "獲取Prj數據-->");
getPrjInfo();
});
}
......@@ -215,17 +182,13 @@ public class PrjService extends Service implements ReceiveListener {
public void onNext(String prjInfo) {
LoganManager.w_printer(TAG, "獲取Prj數據 onNext: " + prjInfo);
//請求到數據,停止輪詢,開始打印,在打印完之後再重新開始輪詢
// startPrint(s);
newPrint(prjInfo);
//開啟另一個定時,三十秒之後自動請求,避免上面的打印成功或失敗時沒有回調。
cancel(wakeDisposable);
wakeDisposable = RxJavaUtils.delay(30, TimeUnit.SECONDS)
.subscribe(new Consumer<Long>() {
@Override
public void accept(Long aLong) throws Exception {
LoganManager.w_printer(TAG, "輪詢獲取Prj數據-->");
startGetPrjInfo();
}
.subscribe(aLong -> {
LoganManager.w_printer(TAG, "輪詢獲取Prj數據-->");
startGetPrjInfo();
});
}
......@@ -254,7 +217,6 @@ public class PrjService extends Service implements ReceiveListener {
private int currentIndex;
private void newPrint(String json) {
printDatas.clear();
Map<String, List<PrjBean.DataBean.Bean>> listMap = new HashMap<>();
currentIndex = 0;
totalPrj = 0;
......@@ -300,8 +262,7 @@ public class PrjService extends Service implements ReceiveListener {
LoganManager.w_printer(TAG, "newPrint JSONException: " + e.getMessage());
}
setPrjIndex(listMap, totalPrj);
initPrinterDevices();
foreachPrint(listMap);
foreachPrint(listMap, getPrinterDevices());
}
private Map<String, List<PrjBean.DataBean.Bean>> setPrjIndex(Map<String, List<PrjBean.DataBean.Bean>> listMap, int totalPrj) {
......@@ -330,7 +291,7 @@ public class PrjService extends Service implements ReceiveListener {
return listMap;
}
private void foreachPrint(Map<String, List<PrjBean.DataBean.Bean>> listMap) {
private void foreachPrint(Map<String, List<PrjBean.DataBean.Bean>> listMap, List<PrinterDeviceBean> printerDeviceBeans) {
//雙重遍歷可以以後優化
//第二步:遍歷 Map<廚房位置,需要打印的數據>,通過廚房位置找到對應的打印機,並且通過數據拿到對應的通用配置
for (Map.Entry<String, List<PrjBean.DataBean.Bean>> prjMap : listMap.entrySet()) {
......@@ -351,15 +312,25 @@ public class PrjService extends Service implements ReceiveListener {
}
}
private void initPrinterDevices() {
/**
* 獲取打印設備
*
* @return 打印機列表
*/
private List<PrinterDeviceBean> getPrinterDevices() {
//讀取打印機和通用配置,可以優化
//獲取所有打印機
PrinterDeviceDaoUtils printerDeviceDaoUtils = new PrinterDeviceDaoUtils(this);
printerDeviceBeans = printerDeviceDaoUtils.queryAllPrinterDeviceBean();
//獲取所有通用配置
printCurrencyBeans = MyPrintUtils.getPrintCurrencyBeans(this);
LoganManager.w_printer(TAG, "获取打印設備信息");
return printerDeviceDaoUtils.queryAllPrinterDeviceBean();
}
/**
* 獲取通用打印配置
*
* @param beans prj數據
* @return 通用配置
*/
private PrintCurrencyBean getPrintCurrencyBean(List<PrjBean.DataBean.Bean> beans) {
PrintCurrencyBean printCurrencyBean = null;
if (beans != null && beans.size() > 0) {
......@@ -389,141 +360,102 @@ public class PrjService extends Service implements ReceiveListener {
PrinterPlugins.getOnPrinterFlowHandler().onPrinterDataBefore(orderType, PrintConstans.PRINT_KITCHEN, GsonUtils.GsonString(beans), GsonUtils.GsonString(printerDeviceBean));
if (isPinPrinter(printerDeviceBean) && printerDeviceBean.getPrinterDeviceType() == PRINT_IP) {
//針式打印機並且打印機類型為IP打印,生成獨特的格式
List<Map<String, Bitmap>> bitmapMaps = generatePrintMaps(key, beans, printerDeviceBean);
hookPrinterBitmap(bitmapMaps, beans);
//針式打印
stylusPrinting(key, beans, printerDeviceBean);
} else if (printerDeviceBean.getPrinterDeviceType() == PRINT_PRJ_PC) {
//prj模式,生成文件到共享電腦上
prjToPc(beans, printerDeviceBean);
} else if (printerDeviceBean.getPrinterDeviceType() == PRINT_LOCAL && PrintConstans.PRINT_MODEL_WISEPOS.contains(Build.MODEL)) {
//本機打印並且是BBPOS
EpsIds = getPrintIds(bitmapMaps);
//第一個參數是機型,第二個參數是語言,
Printer mPrinter = null;
try {
mPrinter = new Printer(Printer.TM_U220, Printer.MODEL_KOREAN, this);
mPrinter.setReceiveEventListener(this);
} catch (Epos2Exception e) {
e.printStackTrace();
updatePrjFailure(getPrintIds(bitmapMaps));
} else {
List<Map<String, Bitmap>> bitmapMaps = generatePrintMaps(key, beans, printerDeviceBean);
switch (printerDeviceBean.getPrinterDeviceType()) {
case PRINT_IP:
LoganManager.w_printer(TAG, "開始IP打印-->");
//IP打印
ipPrint(printerDeviceBean, bitmapMaps);
break;
case PRINT_LOCAL:
//本地N5或Sunmi打印
locationPrint(bitmapMaps);
break;
case PRINT_USB:
//USB打印
usbPrint(bitmapMaps);
break;
default:
break;
}
if (mPrinter != null) {
try {
mPrinter.clearCommandBuffer();
for (int i = 0; i < bitmapMaps.size(); i++) {
for (Map.Entry<String, Bitmap> mapEntry : bitmapMaps.get(i).entrySet()) {
mPrinter.addImage(mapEntry.getValue(), 0, 0,
mapEntry.getValue().getWidth(),
mapEntry.getValue().getHeight(),
Printer.COLOR_1,
Printer.MODE_MONO_HIGH_DENSITY,//高密度
Printer.HALFTONE_DITHER,//半色調抖動
Printer.PARAM_DEFAULT,
Printer.COMPRESS_NONE);//壓縮
mPrinter.addCut(Printer.CUT_FEED);
}
}
} catch (Epos2Exception e) {
e.printStackTrace();
updatePrjFailure(getPrintIds(bitmapMaps));
mPrinter.clearCommandBuffer();
}
try {
PrinterPlugins.getOnPrinterFlowHandler().connectionBefore("針式打印機", printerDeviceBean.getIp(), printerDeviceBean.getPort(), 0, 0);
mPrinter.connect("TCP:" + printerDeviceBean.getIp(), Printer.PARAM_DEFAULT);
mPrinter.sendData(Printer.PARAM_DEFAULT);
} catch (Exception e) {
e.printStackTrace();
updatePrjFailure(getPrintIds(bitmapMaps));
PrinterPlugins.getOnPrinterFlowHandler().connectionError(e);
while (true) {
try {
PrinterPlugins.getOnPrinterFlowHandler().disconnect();
mPrinter.disconnect();
break;
} catch (final Exception ex) {
if (ex instanceof Epos2Exception) {
//Note: If printer is processing such as printing and so on, the disconnect API returns ERR_PROCESSING.
if (((Epos2Exception) ex).getErrorStatus() == Epos2Exception.ERR_PROCESSING) {
}
}
} else {
break;
}
} else {
break;
}
}
}
mPrinter.clearCommandBuffer();
mPrinter.setReceiveEventListener(null);
/**
* PRJ模式,生成PRJ文件到共享的電腦上
*
* @param beans prj數據
* @param printerDeviceBean 打印設備
*/
private void prjToPc(List<PrjBean.DataBean.Bean> beans, PrinterDeviceBean printerDeviceBean) {
//PRJ模式,生成PRJ文件到共享的電腦上
ThreadPoolManager.getInstence().putExecutableTasks(() -> {
List<PrjBean.DataBean.Bean> noCutList = new ArrayList<>();
List<PrjBean.DataBean.Bean> cutList = new ArrayList<>();
for (PrjBean.DataBean.Bean bean : beans) {
if (bean.getStatus() == 2) {
//需要切紙
cutList.add(bean);
} else {
//不需要切紙
noCutList.add(bean);
}
} else {
updatePrjFailure(EpsIds);
}
} else if (printerDeviceBean.getPrinterDeviceType() == PRINT_PRJ_PC) {
} else {
List<Map<String, Bitmap>> bitmapMaps = null;
if (printerDeviceBean.getPrinterDeviceType() == PRINT_LOCAL && PrintConstans.PRINT_MODEL_WISEPOS.contains(Build.MODEL)) {
//本機打印並且是BBPOS
} else if (printerDeviceBean.getPrinterDeviceType() == PRINT_PRJ_PC) {
//PRJ模式,生成PRJ文件到共享的電腦上
ThreadPoolManager.getInstence().putExecutableTasks(() -> {
List<PrjBean.DataBean.Bean> noCutList = new ArrayList<>();
List<PrjBean.DataBean.Bean> cutList = new ArrayList<>();
for (PrjBean.DataBean.Bean bean : beans) {
if (bean.getStatus() == 2) {
//需要切紙
cutList.add(bean);
} else {
//不需要切紙
noCutList.add(bean);
String rootPath = "smb://" + printerDeviceBean.getPrintPath() + "/";
try {
SmbFile smbFile = new SmbFile(rootPath);
smbFile.connect();
if (smbFile.isDirectory()) {
for (int i = 0; i < cutList.size(); i++) {
String newFilePath = rootPath + System.currentTimeMillis() + ".prj";
SmbFile createFile = new SmbFile(newFilePath);
createFile.createNewFile();
if (createFile.exists()) {
PrintStream ps = new PrintStream(new SmbFileOutputStream(createFile));
// 往文件里写入字符串
String prjInfo = "[printType]ptKitchen\n" +
"[table]4\n" +
"[date]落單時間:11-13 17:48\n" +
"[waiter]n5 收銀員\n" +
"[KP]K2烤爐\n" +
"[PAX]人數:2\n" +
"[line]\n" +
"[food_1]1 包子(主項)\n" +
"[food_1]1 包子(主項)\n" +
"[table2]4\n";
ps.println(prjInfo);
}
}
String rootPath = "smb://" + printerDeviceBean.getPrintPath() + "/";
try {
SmbFile smbFile = new SmbFile(rootPath);
smbFile.connect();
if (smbFile.isDirectory()) {
for (int i = 0; i < cutList.size(); i++) {
String newFilePath = rootPath + System.currentTimeMillis() + ".prj";
SmbFile createFile = new SmbFile(newFilePath);
createFile.createNewFile();
if (createFile.exists()) {
PrintStream ps = new PrintStream(new SmbFileOutputStream(createFile));
// 往文件里写入字符串
String prjInfo = "[printType]ptKitchen\n" +
"[table]4\n" +
"[date]落單時間:11-13 17:48\n" +
"[waiter]n5 收銀員\n" +
"[KP]K2烤爐\n" +
"[PAX]人數:2\n" +
"[line]\n" +
"[food_1]1 包子(主項)\n" +
"[food_1]1 包子(主項)\n" +
"[table2]4\n";
ps.println(prjInfo);
if (noCutList.size() > 0) {
String newFilePath = rootPath + System.currentTimeMillis() + ".prj";
SmbFile createFile = new SmbFile(newFilePath);
createFile.createNewFile();
if (createFile.exists()) {
PrintStream ps = new PrintStream(new SmbFileOutputStream(createFile));
PrjBean.DataBean.Bean bean = noCutList.get(0);
String tableName = "";
if (TextUtil.isEmptyOrNullOrUndefined(bean.getTableName())) {
if (bean.getOrderType() == 7) {
tableName = "自取";
} else {
tableName = "外賣";
}
} else {
tableName = bean.getTableName();
}
if (noCutList.size() > 0) {
String newFilePath = rootPath + System.currentTimeMillis() + ".prj";
SmbFile createFile = new SmbFile(newFilePath);
createFile.createNewFile();
if (createFile.exists()) {
PrintStream ps = new PrintStream(new SmbFileOutputStream(createFile));
PrjBean.DataBean.Bean bean = noCutList.get(0);
String tableName = "";
if (TextUtil.isEmptyOrNullOrUndefined(bean.getTableName())) {
if (bean.getOrderType() == 7) {
tableName = "自取";
} else {
tableName = "外賣";
}
} else {
tableName = bean.getTableName();
}
// 往文件里写入字符串
// 往文件里写入字符串
// String prjInfo = "[printType]ptKitchen\n" +
// "[table]4\n" +
// "[date]落單時間:11-13 17:48\n" +
......@@ -534,47 +466,104 @@ public class PrjService extends Service implements ReceiveListener {
// "[food_1]1 包子(主項)\n" +
// "[food_1]1 包子(主項)\n" +
// "[table2]4\n";
String prjInfo = "[printType]ptKitchen\n" +
"[table]" + tableName + "\n" +
"[date]落單時間:11-13 17:48\n" +
"[waiter]n5 收銀員\n" +
"[KP]K2烤爐\n" +
"[PAX]人數:2\n" +
"[line]\n" +
"[food_1]1 包子(主項)\n" +
"[food_1]1 包子(主項)\n" +
"[table2]" + tableName + "\n";
ps.println(prjInfo);
}
}
String prjInfo = "[printType]ptKitchen\n" +
"[table]" + tableName + "\n" +
"[date]落單時間:11-13 17:48\n" +
"[waiter]n5 收銀員\n" +
"[KP]K2烤爐\n" +
"[PAX]人數:2\n" +
"[line]\n" +
"[food_1]1 包子(主項)\n" +
"[food_1]1 包子(主項)\n" +
"[table2]" + tableName + "\n";
ps.println(prjInfo);
}
}
} else {
ToastUtils.show(this, "PRJ輸出路徑必須為文件夾");
}
} catch (IOException e) {
e.printStackTrace();
}
});
}
/**
* 針式打印機
*
* @param key 廚房位置
* @param beans prj數據
* @param printerDeviceBean 打印機
*/
private void stylusPrinting(String key, List<PrjBean.DataBean.Bean> beans, PrinterDeviceBean printerDeviceBean) {
//針式打印機並且打印機類型為IP打印,生成獨特的格式
List<Map<String, Bitmap>> bitmapMaps = generatePrintMaps(key, beans, printerDeviceBean);
hookPrinterBitmap(bitmapMaps, beans);
EpsIds = getPrintIds(bitmapMaps);
//第一個參數是機型,第二個參數是語言,
Printer mPrinter = null;
try {
mPrinter = new Printer(Printer.TM_U220, Printer.MODEL_KOREAN, this);
mPrinter.setReceiveEventListener(this);
} catch (Epos2Exception e) {
e.printStackTrace();
updatePrjFailure(getPrintIds(bitmapMaps));
}
if (mPrinter != null) {
try {
mPrinter.clearCommandBuffer();
for (int i = 0; i < bitmapMaps.size(); i++) {
for (Map.Entry<String, Bitmap> mapEntry : bitmapMaps.get(i).entrySet()) {
mPrinter.addImage(mapEntry.getValue(), 0, 0,
mapEntry.getValue().getWidth(),
mapEntry.getValue().getHeight(),
Printer.COLOR_1,
Printer.MODE_MONO_HIGH_DENSITY,//高密度
Printer.HALFTONE_DITHER,//半色調抖動
Printer.PARAM_DEFAULT,
Printer.COMPRESS_NONE);//壓縮
mPrinter.addCut(Printer.CUT_FEED);
}
}
} catch (Epos2Exception e) {
e.printStackTrace();
updatePrjFailure(getPrintIds(bitmapMaps));
mPrinter.clearCommandBuffer();
}
try {
PrinterPlugins.getOnPrinterFlowHandler().connectionBefore("針式打印機", printerDeviceBean.getIp(), printerDeviceBean.getPort(), 0, 0);
mPrinter.connect("TCP:" + printerDeviceBean.getIp(), Printer.PARAM_DEFAULT);
mPrinter.sendData(Printer.PARAM_DEFAULT);
} catch (Exception e) {
e.printStackTrace();
updatePrjFailure(getPrintIds(bitmapMaps));
PrinterPlugins.getOnPrinterFlowHandler().connectionError(e);
while (true) {
try {
PrinterPlugins.getOnPrinterFlowHandler().disconnect();
mPrinter.disconnect();
break;
} catch (final Exception ex) {
if (ex instanceof Epos2Exception) {
//Note: If printer is processing such as printing and so on, the disconnect API returns ERR_PROCESSING.
if (((Epos2Exception) ex).getErrorStatus() == Epos2Exception.ERR_PROCESSING) {
} else {
break;
}
} else {
ToastUtils.show(this, "PRJ輸出路徑必須為文件夾");
break;
}
} catch (IOException e) {
e.printStackTrace();
}
});
} else {
bitmapMaps = generatePrintMaps(key, beans, printerDeviceBean);
switch (printerDeviceBean.getPrinterDeviceType()) {
case PRINT_IP:
LoganManager.w_printer(TAG, "開始IP打印-->");
//IP打印
ipPrint(printerDeviceBean, bitmapMaps);
break;
case PRINT_LOCAL:
//本地N5或Sunmi打印
locationPrint(bitmapMaps);
break;
case PRINT_USB:
//USB打印
usbPrint(bitmapMaps);
break;
default:
break;
}
mPrinter.clearCommandBuffer();
mPrinter.setReceiveEventListener(null);
}
} else {
updatePrjFailure(EpsIds);
}
}
......@@ -844,9 +833,6 @@ public class PrjService extends Service implements ReceiveListener {
* @param printState 打印狀態 1未打印 2打印中 3已打印
*/
private void updatePrjState(int printState, String ids) {
if (printDatas == null) {
return;
}
Long time = null;
if (printState == 3) {
time = TimeUtils.getCurrentTimeInLong();
......
......@@ -25,6 +25,8 @@ public class BillItemView extends LinearLayout {
public BillItemView(Context context, List<PrintBillItem> data) {
super(context);
this.data = data;
setOrientation(LinearLayout.VERTICAL);
init();
}
private void init() {
......
......@@ -24,6 +24,7 @@ public class BillTypeView extends LinearLayout {
public BillTypeView(Context context, List<PrintBillItem> data) {
super(context);
this.data = data;
setOrientation(LinearLayout.VERTICAL);
init();
}
......
......@@ -25,6 +25,7 @@ public class BillView extends LinearLayout {
public BillView(Context context, List<BillingBean> data) {
super(context);
this.data = data;
setOrientation(LinearLayout.VERTICAL);
init();
}
......
......@@ -34,6 +34,7 @@ public class PrintFoodView extends LinearLayout {
super(context);
this.showPrice = showPrice;
this.data = data;
setOrientation(LinearLayout.VERTICAL);
init(deviceBean);
}
......
......@@ -27,6 +27,7 @@ public class BasicUnitBean {
private long createTime;
private long updateTime;
private int updateUid;
private Integer id;
public BasicUnitBean() {
}
......
......@@ -25,6 +25,10 @@ public class PurchaseFoodBean implements Serializable {
public static final String CATEGORY_DIVIDER = "-";
private Integer id;
private String supplierName;
/**
* 運費
*/
private double shipping;
private String images;
private String foodNo;
private String name;
......
......@@ -35,7 +35,15 @@ public class SupplierInfoBean implements Serializable {
private long createTime;
private long updateTime;
private Integer deletes;
/**
* 最低採購
*/
private double minimumAmount;
/**
* 運費
*/
private double shipping;
private List<SupplierContacts> supplierContacts;
......
......@@ -40,6 +40,8 @@ public interface FoodUnitPageContract {
void callBackDeputyUnit(List<DeputyUnitBean> deputyUnitBeans);
void deleteDeputyUnit(int position);
void deleteUnitKey(int position);
}
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
......@@ -69,5 +71,7 @@ public interface FoodUnitPageContract {
* @return
*/
Observable<BaseResult> addBasicUnit(RequestBody requestBody);
Observable<BaseResult> deleteUnitKey(int id);
}
}
......@@ -4,6 +4,8 @@ import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.jess.arms.mvp.IView;
import com.jess.arms.mvp.IModel;
import java.util.Map;
import io.reactivex.Observable;
import okhttp3.RequestBody;
......@@ -24,6 +26,8 @@ public interface WarehousingInventoryContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends IView {
void updateSuccess();
void loadRecord();
}
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
......@@ -35,5 +39,13 @@ public interface WarehousingInventoryContract {
* @return
*/
Observable<BaseResult> consumeWareHousing(RequestBody requestBody);
/**
* 獲取庫存消耗記錄
*
* @param map
* @return
*/
Observable<BaseResult> getWarehousingRecord(Map<String, Object> map);
}
}
......@@ -68,4 +68,10 @@ public class FoodUnitPageModel extends BaseModel implements FoodUnitPageContract
public Observable<BaseResult> addBasicUnit(RequestBody requestBody) {
return mRepositoryManager.obtainRetrofitService(SupplierServer.class).addDeputyUnitInput(requestBody);
}
@Override
public Observable<BaseResult> deleteUnitKey(int id) {
return mRepositoryManager.obtainRetrofitService(SupplierServer.class).deleteUnitKey(id);
}
}
\ No newline at end of file
......@@ -14,6 +14,8 @@ import javax.inject.Inject;
import com.gingersoft.supply_chain.mvp.contract.WarehousingInventoryContract;
import java.util.Map;
import io.reactivex.Observable;
import okhttp3.RequestBody;
......@@ -53,4 +55,9 @@ public class WarehousingInventoryModel extends BaseModel implements WarehousingI
public Observable<BaseResult> consumeWareHousing(RequestBody requestBody) {
return mRepositoryManager.obtainRetrofitService(SupplierServer.class).consumeWareHousing(requestBody);
}
@Override
public Observable<BaseResult> getWarehousingRecord(Map<String, Object> map) {
return mRepositoryManager.obtainRetrofitService(SupplierServer.class).getWarehousingRecord(map);
}
}
\ No newline at end of file
......@@ -148,6 +148,10 @@ public class FoodUnitPagePresenter extends BasePresenter<FoodUnitPageContract.Mo
});
}
/**
* 新增基本單位
* @param data
*/
public void addDeputyUnit(List<DeputyUnitBean> data) {
//新增為false,修改為true
if (isUpdate) {
......@@ -280,7 +284,8 @@ public class FoodUnitPagePresenter extends BasePresenter<FoodUnitPageContract.Mo
@Override
public void onNext(BaseResult baseResult) {
if (baseResult.isSuccess()) {
mRootView.addBasicUnit(new BasicUnitBean(content));
BasicUnitBean basicUnitBean = GsonUtils.GsonToBean(baseResult.getData(), BasicUnitBean.class);
mRootView.addBasicUnit(basicUnitBean);
} else if (TextUtil.isNotEmptyOrNullOrUndefined(baseResult.getErrMsg())) {
mRootView.showMessage(baseResult.getErrMsg());
} else {
......@@ -290,4 +295,30 @@ public class FoodUnitPagePresenter extends BasePresenter<FoodUnitPageContract.Mo
});
}
/**
* 刪除基本單位快捷輸入的
* @param id 單位id
* @param position 單位下標,刪除成功後本地刷新
*/
public void deleteUnitKey(int id, int position){
mModel.deleteUnitKey(id)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(Constant.SAVE_LOADING))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<BaseResult>(mErrorHandler) {
@Override
public void onNext(BaseResult baseResult) {
if (baseResult.isSuccess()) {
mRootView.deleteUnitKey(position);
} else if (TextUtil.isNotEmptyOrNullOrUndefined(baseResult.getErrMsg())) {
mRootView.showMessage(baseResult.getErrMsg());
} else {
mRootView.showMessage(GET_INFO_ERROR);
}
}
});
}
}
......@@ -88,14 +88,17 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode
public final int addressIndex = 5;
public final int telephoneIndex = 6;
public final int lowPurchaseAmount = 7;
public final int emailIndex = 10;
public final int smsIndex = 15;
public final int remarkIndex = 18;
//運費
public final int shippingIndex = 8;
public final int WhatsAppIndex = 11;
public final int weChatIndex = 12;
public final int lineIndex = 13;
public final int kakaoIndex = 14;
public final int emailIndex = 11;
public final int smsIndex = 16;
public final int remarkIndex = 19;
public final int WhatsAppIndex = 12;
public final int weChatIndex = 13;
public final int lineIndex = 14;
public final int kakaoIndex = 15;
private InfoMultiAdapter infoMultiAdapter;
private SupplierInfoBean supplierBean;
......@@ -135,8 +138,8 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode
infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "聯繫人", true, "請輸入聯繫人", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 20), InputFilterUtils.getChAndEnAndNumInputFilter(mContext)}));
infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "詳細地址", true, "請輸入詳細地址", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 20), InputFilterUtils.getChAndEnAndNumInputFilter(mContext)}));
infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "聯繫人電話", true, "請輸入聯繫人電話", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 11)}, EditorInfo.TYPE_CLASS_PHONE));
infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "最低採購金額", false, "請輸入最低金額", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 7)}, EditorInfo.TYPE_CLASS_NUMBER));
// infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "運費", true, "請輸入運費", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 7)}, EditorInfo.TYPE_CLASS_NUMBER));
infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "最低採購金額", false, "請輸入最低金額", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 9)}, EditorInfo.TYPE_CLASS_NUMBER | EditorInfo.TYPE_NUMBER_FLAG_DECIMAL));
infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "運費", false, "請輸入運費", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 9)}, EditorInfo.TYPE_CLASS_NUMBER | EditorInfo.TYPE_NUMBER_FLAG_DECIMAL));
infoMultiBeans.add(new InfoMultiBean(InfoMultiBean.ITEM_TYPE_LINE));
infoMultiBeans.add(new InfoMultiBean(InfoMultiBean.ITEM_TYPE_TITLE, "接收方式"));
......@@ -175,6 +178,7 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode
infoMultiBeans.get(addressIndex).setShowValue(supplierBean.getAddress());
infoMultiBeans.get(remarkIndex).setShowValue(supplierBean.getRemarks());
infoMultiBeans.get(lowPurchaseAmount).setShowValue(supplierBean.getMinimumAmount() + "");
infoMultiBeans.get(shippingIndex).setShowValue(supplierBean.getShipping() + "");
}
infoMultiAdapter = new InfoMultiAdapter(mContext, infoMultiBeans);
infoMultiAdapter.setOnItemChildClickListener((adapter, view, position) -> {
......@@ -498,18 +502,31 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode
if (supplierInfoBean == null) {
supplierInfoBean = new SupplierInfoBean();
}
//供應商編號
supplierInfoBean.setSupplierNo(infoMultiBeans.get(supplierNoIndex).getShowValue());
//供應商名稱
supplierInfoBean.setSupplierName(infoMultiBeans.get(supplierNameIndex).getShowValue());
//聯繫人
supplierInfoBean.setContacts(infoMultiBeans.get(contactsIndex).getShowValue());
//手機號碼
String telephone = infoMultiBeans.get(telephoneIndex).getShowValue();
supplierInfoBean.setContactInformation(telephone);
//地址
supplierInfoBean.setAddress(infoMultiBeans.get(addressIndex).getShowValue());
//餐廳信息
supplierInfoBean.setRestaurantId(RestaurantInfoManager.newInstance().getRestaurantId());
supplierInfoBean.setBrandId(RestaurantInfoManager.newInstance().getBrandId());
//最低採購金額
String minimumAmount = infoMultiBeans.get(lowPurchaseAmount).getShowValue();
if (TextUtil.isNotEmptyOrNullOrUndefined(minimumAmount)) {
supplierInfoBean.setMinimumAmount(Double.parseDouble(minimumAmount));
}
//運費
String shipping = infoMultiBeans.get(shippingIndex).getShowValue();
if (TextUtil.isNotEmptyOrNullOrUndefined(shipping)) {
supplierInfoBean.setShipping(Double.parseDouble(shipping));
}
//供應商編號如果沒填,就設為空
if (TextUtil.isEmptyOrNullOrUndefined(supplierInfoBean.getSupplierNo())) {
supplierInfoBean.setSupplierNo(null);
}
......
......@@ -108,23 +108,28 @@ public class ShoppingCatPresenter extends BasePresenter<ShoppingCatContract.Mode
//統計當前供應商選中食材的種類
int supplierTotalSpecies = 0;
shoppingCartBean.setAllSelect(true);
double shipping = 0;
for (PurchaseFoodBean purchaseFoodBean : foods) {
if (purchaseFoodBean.isChecked()) {
supplierTotalAmount = MoneyUtil.sum(supplierTotalAmount, MoneyUtil.priceCalculation(purchaseFoodBean.getUnitPrice(), purchaseFoodBean.getFoodQuantity()));
supplierTotalSpecies++;
//有選中的食品才顯示運費
shipping = purchaseFoodBean.getShipping();
} else {
shoppingCartBean.setAllSelect(false);
}
}
//不滿足最低採購金額,不可點擊創建訂單按鈕
if (MoneyUtil.compareTo(shoppingCartBean.getMinimumAmount(), supplierTotalAmount) == 1) {
createBtnCheckable = false;
}
// shoppingCartBean.setShipping();運費
//運費
shoppingCartBean.setShipping(shipping);
shoppingCartBean.setInitialShippingTime(TimeUtils.getNextDay(1));
shoppingCartBean.setSelectFoodAmount(supplierTotalAmount);
shoppingCartBean.setSelectSpeciesNum(supplierTotalSpecies);
//統計所有供應商的選中的食材的總金額
totalPrice = MoneyUtil.sum(totalPrice, supplierTotalAmount);
//統計所有供應商的選中的食材的總金額,加上運費
totalPrice = MoneyUtil.sum(MoneyUtil.sum(totalPrice, supplierTotalAmount), shipping);
//統計所有供應商的選中的食材的種類數量
totalTypeNumber += supplierTotalSpecies;
shoppingCartBean.setFoodList(foods);
......@@ -177,6 +182,8 @@ public class ShoppingCatPresenter extends BasePresenter<ShoppingCatContract.Mode
}
if (checkState) {
shoppingCartBean.setSelectSpeciesNum(shoppingCartBean.getFoodList().size());
//總金額要加上運費
totalAmount = MoneyUtil.sum(totalAmount, shoppingCartBean.getShipping());
} else {
shoppingCartBean.setSelectSpeciesNum(0);
}
......
......@@ -21,6 +21,9 @@ import javax.inject.Inject;
import com.gingersoft.supply_chain.mvp.contract.WarehousingInventoryContract;
import com.jess.arms.utils.RxLifecycleUtils;
import java.util.HashMap;
import java.util.Map;
/**
* ================================================
......@@ -95,4 +98,35 @@ public class WarehousingInventoryPresenter extends BasePresenter<WarehousingInve
}
});
}
/**
* 查詢庫存盤點記錄
*/
public void getWarehousingRecord(int pageIndex) {
Map<String, Object> map = new HashMap<>(4);
Constant.addRestaurantId(map);
Constant.addBrandId(map);
Constant.addPageSize(map);
map.put("pageIndex", pageIndex * Constant.PAGE_SIZE);
mModel.getWarehousingRecord(map)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(Constant.SAVE_LOADING))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<BaseResult>(mErrorHandler) {
@Override
public void onNext(BaseResult baseResult) {
if (baseResult != null && baseResult.isSuccess()) {
//消耗完之後,關閉頁面
mRootView.loadRecord();
} else if (baseResult != null && TextUtil.isNotEmptyOrNullOrUndefined(baseResult.getErrMsg())) {
mRootView.showMessage(baseResult.getErrMsg());
} else {
mRootView.showMessage(Constant.SAVE_FAIL);
}
}
});
}
}
......@@ -273,6 +273,7 @@ public interface SupplierServer {
/**
* 修改採購單信息
*
* @param orderId 訂單id
* @return
*/
......@@ -393,6 +394,14 @@ public interface SupplierServer {
@POST("basicUnitType/add" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseResult> addDeputyUnitInput(@Body RequestBody requestBody);
/**
* 刪除副單位快捷輸入
*/
@Headers({"Domain-Name: ricepon-purchase"})
@FormUrlEncoded
@POST("basicUnitType/delete" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseResult> deleteUnitKey(@Field("id") int id);
/**
* 查詢入庫流水
......@@ -429,4 +438,13 @@ public interface SupplierServer {
@GET("purchaseConsume/get/remaining/quantity" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseResult> getWarehousingNum(@QueryMap Map<String, Object> map);
/**
* 查詢庫存消耗記錄
*/
@Headers({"Domain-Name: ricepon-purchase"})
@GET("purchaseConsume/list" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseResult> getWarehousingRecord(@QueryMap Map<String, Object> map);
}
......@@ -19,8 +19,11 @@ import java.util.List;
*/
public class BasicUnitAdapter extends BaseQuickAdapter<BasicUnitBean, BaseViewHolder> {
private boolean showDelete = false;
public BasicUnitAdapter(@Nullable List<BasicUnitBean> data) {
super(R.layout.item_basic_unit, data);
addChildClickViewIds(R.id.iv_delete_basic_unit);
}
@Override
......@@ -31,5 +34,16 @@ public class BasicUnitAdapter extends BaseQuickAdapter<BasicUnitBean, BaseViewHo
} else {
viewHolder.setTextColorRes(R.id.tv_basic_unit, R.color.color_3c);
}
//沒有id的,就是系統自帶的默認的單位,不能刪除
if (item.getId() != null) {
viewHolder.setGone(R.id.iv_delete_basic_unit, !showDelete);
} else {
viewHolder.setGone(R.id.iv_delete_basic_unit, true);
}
}
public void toggleDelete() {
this.showDelete = !showDelete;
notifyDataSetChanged();
}
}
......@@ -2,6 +2,8 @@ package com.gingersoft.supply_chain.mvp.ui.adapter;
import android.animation.AnimatorSet;
import android.content.Context;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.widget.CheckBox;
import android.widget.EditText;
......@@ -13,6 +15,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.gingersoft.gsa.cloud.common.utils.MoneyUtil;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.common.utils.time.TimeUtils;
import com.gingersoft.gsa.cloud.ui.recylcler.decorator.DividerItemDecoration;
import com.gingersoft.gsa.cloud.ui.utils.AnimateUtils;
......@@ -21,6 +24,7 @@ import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodBean;
import com.gingersoft.supply_chain.mvp.bean.ShoppingCartBean;
import com.google.android.material.internal.ViewUtils;
import com.google.android.material.textfield.TextInputEditText;
import com.xuexiang.rxutil2.rxjava.RxJavaUtils;
import org.jetbrains.annotations.NotNull;
......@@ -44,12 +48,15 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Base
private String amountUnitStr;
private String estimateDeliveryTimeStr;
private ShippingTextWatcher shippingTextWatcher;
public ShoppingCartAdapter(Context context, @Nullable List<ShoppingCartBean> data) {
super(R.layout.item_shopping_cart, data);
this.context = context;
dividerItemDecoration = new DividerItemDecoration(context, DividerItemDecoration.VERTICAL_LIST);
amountUnitStr = context.getString(R.string.amount_string);
estimateDeliveryTimeStr = context.getString(R.string.estimate_delivery_time);
shippingTextWatcher = new ShippingTextWatcher();
}
@Override
......@@ -59,13 +66,16 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Base
TextView tvMinMinimumAmount = viewHolder.getView(R.id.tv_minimumAmount);
viewHolder.setText(R.id.rv_purchase_shopping_estimate_delivery_time, String.format(estimateDeliveryTimeStr, shoppingCartBean.getInitialShippingTime()));
setTvMinimumAmount(shoppingCartBean, tvMinMinimumAmount, viewHolder.getView(R.id.rv_purchase_shopping_minimum_tip));
// viewHolder.setText(R.id.tv_order_item_freight, shoppingCartBean.getFoodList());
//選中食品的總價
setTotalAmount(viewHolder, shoppingCartBean.getSelectFoodAmount());
//運費
viewHolder.setText(R.id.tv_order_item_freight, String.format(amountUnitStr, shoppingCartBean.getShipping()));
TextInputEditText etShipping = viewHolder.getView(R.id.tv_order_item_freight);
etShipping.removeTextChangedListener(shippingTextWatcher);
viewHolder.setText(R.id.tv_order_item_freight, MoneyUtil.formatDouble(shoppingCartBean.getShipping()));
shippingTextWatcher.setViewHolder(viewHolder);
etShipping.addTextChangedListener(shippingTextWatcher);
//實際應付金額
setActualAmount(viewHolder, shoppingCartBean.getSelectFoodAmount());
setActualAmount(viewHolder, MoneyUtil.sum(shoppingCartBean.getSelectFoodAmount(), shoppingCartBean.getShipping()));
//選中食品的種類
TextView tvFoodTypeNumber = viewHolder.getView(R.id.tv_order_item_food_type_total);
tvFoodTypeNumber.setText(String.valueOf(shoppingCartBean.getSelectSpeciesNum()));
......@@ -175,6 +185,47 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Base
}
}
private class ShippingTextWatcher implements TextWatcher {
BaseViewHolder viewHolder;
public void setViewHolder(BaseViewHolder viewHolder) {
this.viewHolder = viewHolder;
}
@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) {
if (viewHolder != null) {
//需要修改實際應付金額和activity的總金額
//拿到現在的金額,減去之前的金額
double nowShipping = 0;
if (TextUtil.isNotEmptyOrNullOrUndefined(s)) {
nowShipping = Double.parseDouble(s.toString());
}
ShoppingCartBean shoppingCartBean = getData().get(viewHolder.getAdapterPosition());
//修改實際應付金額
setActualAmount(viewHolder, MoneyUtil.sum(shoppingCartBean.getSelectFoodAmount(), shoppingCartBean.getShipping()));
//通知activity修改
// getData().get(viewHolder.getAdapterPosition()).setShipping(Integer.parseInt());
}
}
}
/**
* 修改總金額
*/
......@@ -283,7 +334,7 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Base
double currentPrice = MoneyUtil.sum(cartBean.getSelectFoodAmount(), MoneyUtil.priceCalculation(unitPrice, foodQuantity));
cartBean.setSelectFoodAmount(currentPrice);
setTotalAmount(viewHolder, currentPrice);
setActualAmount(viewHolder, currentPrice);
setActualAmount(viewHolder, MoneyUtil.sum(currentPrice, cartBean.getShipping()));
//傳遞回去
if (onInfoChangeListener != null) {
onInfoChangeListener.onInfoChange(MoneyUtil.priceCalculation(unitPrice, foodQuantity), species);
......@@ -301,11 +352,13 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Base
private void minusTotalPrice(BaseViewHolder viewHolder, ShoppingCartBean cartBean, double unitPrice, int foodQuantity, int species) {
//供應商總價減去-這個食品的總價=等於現價
double currentPrice = MoneyUtil.sub(cartBean.getSelectFoodAmount(), MoneyUtil.priceCalculation(unitPrice, foodQuantity));
//修改選中食品的金額
cartBean.setSelectFoodAmount(currentPrice);
String amountStr = String.format(amountUnitStr, currentPrice);
//修改顯示總金額
setTotalAmount(viewHolder, currentPrice);
viewHolder.setText(R.id.tv_order_item_actual_pay_amount, amountStr);
//傳遞回去
//修改實際應付金額
setActualAmount(viewHolder, MoneyUtil.sum(currentPrice, cartBean.getShipping()));
//傳遞回去,由於是減少食品,所以金額為負
if (onInfoChangeListener != null) {
onInfoChangeListener.onInfoChange(-MoneyUtil.priceCalculation(unitPrice, foodQuantity), species);
}
......
......@@ -14,6 +14,8 @@ import androidx.fragment.app.FragmentActivity;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.listener.OnItemChildClickListener;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.ui.utils.AppDialog;
import com.gingersoft.supply_chain.R;
......@@ -144,6 +146,11 @@ public class FoodUnitPageFragment extends BaseSupplyChainFragment<FoodUnitPagePr
@Override
public void loadBasicUnitAdapter(List<BasicUnitBean> basicUnitBeans) {
basicUnitAdapter = new BasicUnitAdapter(basicUnitBeans);
//獲取到基礎單位之後,才在標題欄中添加刪除按鈕
topBar.addRightImageButton(R.drawable.ic_white_delete, R.id.btn_delete).setOnClickListener(v -> {
//刪除
basicUnitAdapter.toggleDelete();
});
rvBasicUnitList.setLayoutManager(new GridLayoutManager(mContext, 5));
rvBasicUnitList.setAdapter(basicUnitAdapter);
basicUnitAdapter.setOnItemClickListener((adapter, view, position) -> {
......@@ -174,13 +181,20 @@ public class FoodUnitPageFragment extends BaseSupplyChainFragment<FoodUnitPagePr
}
}
});
basicUnitAdapter.setOnItemChildClickListener((adapter, view, position) -> {
if (view.getId() == R.id.iv_delete_basic_unit) {
//刪除單位
mPresenter.deleteUnitKey(basicUnitAdapter.getItem(position).getId(), position);
}
});
}
@Override
public void addBasicUnit(BasicUnitBean basicUnitBean) {
if (basicUnitAdapter != null) {
int index = basicUnitAdapter.getItemCount() - 1;
basicUnitAdapter.addData(Math.max(index, 0), basicUnitBean);
basicUnitAdapter.addData(0, basicUnitBean);
rvBasicUnitList.scrollToPosition(0);
}
}
......@@ -227,4 +241,9 @@ public class FoodUnitPageFragment extends BaseSupplyChainFragment<FoodUnitPagePr
public void deleteDeputyUnit(int position) {
deputyUnitAdapter.removeAt(position);
}
@Override
public void deleteUnitKey(int position) {
basicUnitAdapter.removeAt(position);
}
}
package com.gingersoft.supply_chain.mvp.ui.fragment.order;
import android.app.Dialog;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
......
......@@ -14,6 +14,7 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.RecyclerView;
import com.gingersoft.gsa.cloud.common.utils.glide.GlideUtils;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
......@@ -49,12 +50,16 @@ public class WarehousingInventoryFragment extends BaseSupplyChainFragment<Wareho
TextView tvWarehouseDifference;
@BindView(R2.id.ed_warehouse_loss)
EditText edWarehouseLoss;
@BindView(R2.id.rv_warehouse_inventory_record)
RecyclerView rvRecord;
/**
* 食品總庫存
*/
private int foodNum;
private String foodNo;
private int pageIndex;
public static WarehousingInventoryFragment newInstance(WareHouseListBean.WareHousingDataBean.PurchaseWarehousingOrderDetailsVOSBean purchaseWarehousingOrderDetailsVosBean) {
WarehousingInventoryFragment fragment = new WarehousingInventoryFragment();
Bundle bundle = new Bundle();
......@@ -86,70 +91,89 @@ public class WarehousingInventoryFragment extends BaseSupplyChainFragment<Wareho
public void initData(@Nullable Bundle savedInstanceState) {
Bundle arguments = getArguments();
if (arguments != null) {
//獲取庫存盤點記錄
getWarehousingRecord();
int foodId = arguments.getInt(WarehouseDetailsFragment.FOOD_ID_KEY);
//食品編號
foodNo = arguments.getString(WarehouseDetailsFragment.FOOD_NO_KEY);
String foodName = arguments.getString(WarehouseDetailsFragment.FOOD_NAME_KEY);
//食品庫存總數
foodNum = arguments.getInt(WarehouseDetailsFragment.FOOD_NUM_KEY);
ivWarehouseImg.post(() -> {
ViewGroup.LayoutParams layoutParams = ivWarehouseImg.getLayoutParams();
layoutParams.height = ivWarehouseImg.getWidth();
layoutParams.width = ivWarehouseImg.getWidth();
ivWarehouseImg.setLayoutParams(layoutParams);
String foodImageUrl = arguments.getString(WarehouseDetailsFragment.FOOD_IMAGE_KEY);
if (TextUtil.isNotEmptyOrNullOrUndefined(foodImageUrl)) {
GlideUtils.display(requireContext(), ivWarehouseImg, foodImageUrl);
} else {
ivWarehouseImg.setImageResource(R.drawable.img_small_default);
}
});
//加載食品圖片
loadFoodImage(arguments);
//初始化標題
initTopBar(supplyTopBar, foodName);
Button btnSave = supplyTopBar.addRightTextButton(R.string.str_save, R.id.id_save);
btnSave.setTextColor(getColor(R.color.white));
btnSave.setOnClickListener(mOnClickListener);
//庫存數量
tvWarehouseTotal.setText(String.valueOf(foodNum));
tvWarehouseDifference.setText(String.valueOf(foodNum));
edWarehouseLoss.setOnFocusChangeListener((v, hasFocus) -> {
if (hasFocus && edWarehouseLoss.getText().toString().equals("0")) {
edWarehouseLoss.setText("");
}
});
edWarehouseLoss.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
initTopBar(arguments);
//初始化數量和編輯監聽
initEdit();
} else {
showMessage("獲取食材信息失敗,請稍候重試");
killMyself();
}
}
}
private void getWarehousingRecord() {
mPresenter.getWarehousingRecord(pageIndex);
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
private void initEdit() {
//庫存數量
tvWarehouseTotal.setText(String.valueOf(foodNum));
//庫存差異
tvWarehouseDifference.setText(String.valueOf(foodNum));
edWarehouseLoss.setOnFocusChangeListener((v, hasFocus) -> {
//當輸入框獲得焦點時,數量為0,去掉0
if (hasFocus && edWarehouseLoss.getText().toString().equals("0")) {
edWarehouseLoss.setText("");
}
});
edWarehouseLoss.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) {
if (TextUtil.isNotEmptyOrNullOrUndefined(s + "")) {
//用戶輸入的盤點數量
int inventoryNum = Integer.parseInt(s + "");
}
@Override
public void afterTextChanged(Editable s) {
if (TextUtil.isNotEmptyOrNullOrUndefined(s + "")) {
//用戶輸入的盤點數量
int inventoryNum = Integer.parseInt(s + "");
// if (inventoryNum > foodNum) {
// inventoryNum = foodNum;
// showMessage("不能大於庫存數");
// edWarehouseLoss.setText(String.valueOf(foodNum));
// edWarehouseLoss.setSelection(edWarehouseLoss.getText().length());
// }
tvWarehouseDifference.setText(String.valueOf(Math.abs(foodNum - inventoryNum)));
} else {
tvWarehouseDifference.setText(String.valueOf(foodNum));
}
tvWarehouseDifference.setText(String.valueOf(Math.abs(foodNum - inventoryNum)));
} else {
tvWarehouseDifference.setText(String.valueOf(foodNum));
}
});
}
});
}
private void initTopBar(Bundle arguments) {
String foodName = arguments.getString(WarehouseDetailsFragment.FOOD_NAME_KEY);
//初始化標題
initTopBar(supplyTopBar, foodName);
//添加保存按鈕
Button btnSave = supplyTopBar.addRightTextButton(R.string.str_save, R.id.id_save);
btnSave.setTextColor(getColor(R.color.white));
btnSave.setOnClickListener(mOnClickListener);
}
private void loadFoodImage(Bundle arguments) {
String foodImageUrl = arguments.getString(WarehouseDetailsFragment.FOOD_IMAGE_KEY);
if (TextUtil.isNotEmptyOrNullOrUndefined(foodImageUrl)) {
GlideUtils.display(requireContext(), ivWarehouseImg, foodImageUrl);
} else {
showMessage("獲取食材信息失敗,請稍候重試");
killMyself();
ivWarehouseImg.setImageResource(R.drawable.img_small_default);
}
}
private View.OnClickListener mOnClickListener = v -> {
if (v.getId() == R.id.id_save) {
//保存,調用庫存損耗
......@@ -174,4 +198,9 @@ public class WarehousingInventoryFragment extends BaseSupplyChainFragment<Wareho
public void updateSuccess() {
setFragmentResult(RESULT_OK, null);
}
@Override
public void loadRecord() {
}
}
......@@ -44,6 +44,7 @@
android:imeOptions="actionSearch"
android:hint="搜索供應商"
android:maxLines="1"
android:textCursorDrawable="@drawable/cursor_theme"
android:inputType="text"
android:textColor="@color/theme_333_color"
android:textColorHint="@color/hint_color"
......
......@@ -3,94 +3,170 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@color/color_f0"
android:orientation="vertical">
<include layout="@layout/supply_chain_top_bar" />
<ImageView
android:id="@+id/iv_warehouse_img"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_36"
android:layout_marginRight="@dimen/dp_36" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_20"
android:layout_marginLeft="@dimen/dp_5"
android:layout_marginTop="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_20"
android:layout_marginRight="@dimen/dp_5"
android:background="@drawable/shape_white_eight_corners_bg"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="庫存數量:"
android:textColor="@color/color_66"
android:textSize="@dimen/dp_17" />
<ImageView
android:id="@+id/iv_warehouse_img"
android:layout_width="@dimen/dp_77"
android:layout_height="@dimen/dp_77"
android:layout_margin="@dimen/dp_10" />
<TextView
android:id="@+id/tv_warehouse_total"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_17"
android:textStyle="bold"
tools:text="100" />
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/dp_6"
android:layout_marginRight="@dimen/dp_10"
android:layout_marginBottom="@dimen/dp_6"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="庫存差異:"
android:textColor="@color/color_66"
android:textSize="@dimen/dp_17" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_warehouse_difference"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_17"
android:textStyle="bold"
tools:text="+100" />
<TextView
style="@style/WareHouse_Details_TextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="庫存:" />
<TextView
android:id="@+id/tv_warehouse_total"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/other_order_details_sure_btn_color"
android:textSize="@dimen/dp_19"
tools:text="100" />
<TextView
android:id="@+id/tv_food_unit"
style="@style/WareHouse_Details_TextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="盒" />
</LinearLayout>
<View
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
style="@style/WareHouse_Details_TextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="庫存差異:" />
<TextView
android:id="@+id/tv_warehouse_difference"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_17"
android:textStyle="bold"
tools:text="+100" />
</LinearLayout>
<View
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
style="@style/WareHouse_Details_TextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="盤點庫存:"
android:textSize="@dimen/dp_15" />
<EditText
android:id="@+id/ed_warehouse_loss"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/shape_square_edit_border_aa"
android:gravity="center"
android:hint="請輸入"
android:inputType="number"
android:paddingTop="@dimen/dp_5"
android:paddingBottom="@dimen/dp_5"
android:text="0"
android:textColor="@color/theme_333_color"
android:textCursorDrawable="@drawable/cursor_theme"
android:textSize="@dimen/dp_18"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_20"
android:layout_marginTop="@dimen/dp_15"
android:layout_marginRight="@dimen/dp_20"
android:layout_height="@dimen/dp_38"
android:layout_marginTop="@dimen/dp_10"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="盤點庫存:"
android:textColor="@color/color_66"
android:textSize="@dimen/dp_17" />
<EditText
android:id="@+id/ed_warehouse_loss"
android:layout_width="@dimen/dp_86"
android:layout_height="wrap_content"
android:background="@drawable/shape_square_edit_border_3c"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.25"
android:background="@color/theme_color"
android:gravity="center"
android:hint="請輸入"
android:inputType="number"
android:paddingTop="@dimen/dp_9"
android:paddingBottom="@dimen/dp_9"
android:text="0"
android:textColor="@color/theme_333_color"
android:textCursorDrawable="@drawable/cursor_theme"
android:textSize="@dimen/dp_14"
android:textStyle="bold" />
android:text="用戶名"
android:textColor="@color/white"
android:textSize="@dimen/dp_12" />
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/dp_1"
android:layout_weight="0.3"
android:background="@color/theme_color"
android:gravity="center"
android:text="盤點"
android:textColor="@color/white"
android:textSize="@dimen/dp_12" />
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/dp_1"
android:layout_weight="0.55"
android:background="@color/theme_color"
android:gravity="center"
android:text="操作日期"
android:textColor="@color/white"
android:textSize="@dimen/dp_12" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_warehouse_inventory_record"
android:layout_width="match_parent"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
android:layout_height="match_parent" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
<FrameLayout 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="wrap_content"
android:layout_marginLeft="@dimen/dp_3"
android:layout_marginRight="@dimen/dp_3"
android:layout_marginTop="@dimen/dp_3"
android:layout_marginBottom="@dimen/dp_3"
android:background="@color/white"
app:cardCornerRadius="@dimen/dp_8"
app:elevation="@dimen/dp_10">
android:layout_height="wrap_content">
<TextView
android:id="@+id/tv_basic_unit"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:paddingTop="@dimen/dp_7"
android:paddingBottom="@dimen/dp_7"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_14"
tools:text="個" />
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_3"
android:layout_marginRight="@dimen/dp_3"
android:background="@color/white"
app:cardCornerRadius="@dimen/dp_4"
app:cardUseCompatPadding="true"
app:elevation="@dimen/dp_4">
<TextView
android:id="@+id/tv_basic_unit"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:ellipsize="end"
android:maxLines="1"
android:paddingTop="@dimen/dp_7"
android:paddingBottom="@dimen/dp_7"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_14"
tools:text="個" />
</androidx.cardview.widget.CardView>
</androidx.cardview.widget.CardView>
\ No newline at end of file
<ImageView
android:id="@+id/iv_delete_basic_unit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:elevation="@dimen/dp_5"
android:src="@drawable/ic_red_circular_delete" />
</FrameLayout>
......@@ -26,9 +26,9 @@
<CheckBox
android:id="@+id/cb_order_item_all_select"
android:layout_width="0dp"
android:layout_weight="6"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_12"
android:layout_weight="6"
android:button="@drawable/selector_checkbox"
android:textColor="@color/black"
android:textSize="@dimen/dp_16"
......@@ -41,10 +41,10 @@
android:layout_marginLeft="@dimen/dp_5"
android:layout_marginRight="@dimen/dp_5"
android:layout_weight="4"
android:textSize="@dimen/dp_14"
android:gravity="right"
android:text="@string/minimumAmount"
android:textColor="@color/required_color" />
android:textColor="@color/required_color"
android:textSize="@dimen/dp_14" />
</LinearLayout>
<include layout="@layout/include_horizontal_color_ccc_dividing_line" />
......@@ -117,11 +117,21 @@
android:textSize="@dimen/dp_15" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="$"
android:textColor="@color/required_color"
android:textSize="@dimen/dp_14"
android:textStyle="bold" />
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/tv_order_item_freight"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="$0"
android:background="@null"
android:inputType="numberDecimal"
android:text="0"
android:textColor="@color/required_color"
android:textSize="@dimen/dp_14"
android:textStyle="bold" />
......
......@@ -3,6 +3,12 @@ package com.gingersoft.gsa.cloud.common.constans;
public class DeliveryPickConstans {
public static final String ORDER_TYPE = "orderType";
/**
* 訂單類型:凍鏈
*/
public static final String COLD_CHAIN_TYPE = "8";
/**
* 2 線上外賣訂單,7 自取訂單
*/
public static final String DELIVERY_TYPE = "2,7";
}
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="@dimen/dp_4" />
<stroke
android:width="@dimen/dp_1"
android:color="@color/color_aaa" />
</shape>
\ No newline at end of file
......@@ -42,6 +42,8 @@ public class PrjBean {
private int id;
private int printerDeviceId;
private int status;//為2是帶*,需要切紙的
public static final int PRJ_CUTE = 2;
private String tableName;
private String orderNo;
private int orderTime;
......
......@@ -55,13 +55,14 @@ public class InputProvider<T extends InfoMultiBean> extends MyBaseItemProvider<T
InputViewHolder viewHolder = (InputViewHolder) baseViewHolder;
MultiInputBean infoMultiBean = (MultiInputBean) t;
viewHolder.removeTextWatcher();
TextInputEditText editText = baseViewHolder.getView(R.id.ed_multi_value);
editText.setError(null);
initEditFocusable(infoMultiBean, editText);
//設置輸入限制
setFilters(editText, infoMultiBean);
//刷新數據
viewHolder.updateView(infoMultiBean);
viewHolder.updateView();
//設置輸入框的值
initEditText(editText, infoMultiBean.getShowValue(), infoMultiBean.getHintText());
//添加焦點監聽
......@@ -95,6 +96,8 @@ public class InputProvider<T extends InfoMultiBean> extends MyBaseItemProvider<T
}
private void setFilters(EditText editText, MultiInputBean multiSelectBean) {
//先清空值,再
editText.setText("");
//輸入攔截器
editText.setFilters(multiSelectBean.getInputFilters());
//輸入類型限制
......@@ -110,17 +113,19 @@ public class InputProvider<T extends InfoMultiBean> extends MyBaseItemProvider<T
super(view);
ButterKnife.bind(this, view);
editText = view.findViewById(R.id.ed_multi_value);
editText.addTextChangedListener(inputTextWatcher);
}
public void updateView(MultiInputBean infoMultiBean) {
public void removeTextWatcher() {
editText.removeTextChangedListener(inputTextWatcher);
}
public void updateView() {
editText.addTextChangedListener(inputTextWatcher);
inputTextWatcher.inputViewHolder = this;
inputTextWatcher.infoMultiBean = infoMultiBean;
}
}
class InputTextWatcher implements TextWatcher {
MultiInputBean infoMultiBean;
InputViewHolder inputViewHolder;
@Override
......@@ -133,7 +138,8 @@ public class InputProvider<T extends InfoMultiBean> extends MyBaseItemProvider<T
@Override
public void afterTextChanged(Editable s) {
if (infoMultiBean != null) {
if (inputViewHolder != null) {
MultiInputBean infoMultiBean = (MultiInputBean) getAdapter().getItem(inputViewHolder.getAdapterPosition());
infoMultiBean.setShowValue(s + "");
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment