Commit 1e28402f by Wyh

1、prj打印不顯示問題

2、prj沒有食品時不需要打印
parent d1f85c82
......@@ -76,7 +76,6 @@ android {
}
}
}
//dokit 扩展
dokitExt {
//通用设置
......@@ -125,8 +124,8 @@ dependencies {
addComponent 'component-coldchain'
// addComponent 'component-supply-chain'
addComponent 'component-webview'
addComponent 'component-scan'
addComponent 'component-pay'
// addComponent 'component-scan'
// addComponent 'component-pay'
implementation 'androidx.viewpager2:viewpager2:1.0.0-alpha03'
annotationProcessor rootProject.ext.dependencies["dagger2-compiler"]
......
......@@ -55,6 +55,7 @@ public class KitChenPrjFoodView extends LinearLayout {
}
private void init() {
setOrientation(LinearLayout.VERTICAL);
for (PrjBean.DataBean.Bean item : data) {
View view = View.inflate(getContext(), R.layout.print_kitchen_item_parent, null);
LinearLayout layout = view.findViewById(R.id.layout_print_kitchen_parent);
......@@ -80,6 +81,7 @@ public class KitChenPrjFoodView extends LinearLayout {
}
}
}
addView(view);
}
}
......
......@@ -3,13 +3,14 @@ package com.gingersoft.supply_chain.mvp.ui.adapter;
import android.content.Context;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
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.glide.GlideUtils;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.supply_chain.R;
......@@ -53,12 +54,15 @@ public class FoodListAdapter extends BaseQuickAdapter<PurchaseFoodBean, BaseView
*/
private Map<Integer, PurchaseFoodBean> integerMap;
private String moneyString;
public FoodListAdapter(Context context, @Nullable List<PurchaseFoodBean> data, int adapterType) {
super(R.layout.item_food_ingredient, data);
addChildClickViewIds(R.id.iv_supplier_edit, R.id.iv_supplier_delete);
this.context = context;
this.adapterType = adapterType;
integerMap = new HashMap<>(8);
moneyString = context.getString(R.string.amount_string_s);
}
public FoodListAdapter(int layoutId, Context context, @Nullable List<PurchaseFoodBean> data, int adapterType) {
......@@ -67,6 +71,7 @@ public class FoodListAdapter extends BaseQuickAdapter<PurchaseFoodBean, BaseView
this.context = context;
this.adapterType = adapterType;
integerMap = new HashMap<>(8);
moneyString = context.getString(R.string.amount_string_s);
}
@Override
......@@ -98,7 +103,7 @@ public class FoodListAdapter extends BaseQuickAdapter<PurchaseFoodBean, BaseView
viewHolder.setGone(R.id.iv_supplier_delete, false);
viewHolder.setGone(R.id.layout_operation_food_num, false);
viewHolder.setGone(R.id.cb_order_item_all_select, false);
viewHolder.setGone(R.id.line_supplier_info, true);
// viewHolder.setGone(R.id.line_supplier_info, true);
setEdit(viewHolder, foodInfoBean);
CheckBox checkBox = viewHolder.getView(R.id.cb_order_item_all_select);
checkBox.setChecked(foodInfoBean.isChecked());
......@@ -152,7 +157,10 @@ public class FoodListAdapter extends BaseQuickAdapter<PurchaseFoodBean, BaseView
* @param foodInfoBean
*/
private void setEdit(@NotNull BaseViewHolder viewHolder, PurchaseFoodBean foodInfoBean) {
//食品數量
EditText editText = viewHolder.getView(R.id.ed_food_ingredient_number);
//當前食品總價
TextView mTvTotalAmount = viewHolder.getViewOrNull(R.id.tv_food_item_total_amount);
//從緩存中取出這個食品信息,如果沒有對應的食品信息,說明沒操作過這個食品
//這裡是採購頁面和購物車頁面共用
PurchaseFoodBean food = integerMap.get(foodInfoBean.getId());
......@@ -162,6 +170,9 @@ public class FoodListAdapter extends BaseQuickAdapter<PurchaseFoodBean, BaseView
integerMap.put(foodInfoBean.getId(), foodInfoBean);
}
}
if (mTvTotalAmount != null) {
mTvTotalAmount.setText(String.format(moneyString, MoneyUtil.formatDouble(MoneyUtil.priceCalculation(food.getUnitPrice(), food.getFoodQuantity()))));
}
editText.setText(String.valueOf(food.getFoodQuantity()));
//食材減少按鈕監聽
viewHolder.getView(R.id.btn_food_operation_sub).setOnClickListener(v -> {
......@@ -169,6 +180,9 @@ public class FoodListAdapter extends BaseQuickAdapter<PurchaseFoodBean, BaseView
onNumberChangeListener.onChanged(foodInfoBean.getFoodQuantity(), foodInfoBean.getFoodQuantity() - 1, viewHolder.getAdapterPosition());
}
subNumber(editText, foodInfoBean);
if (mTvTotalAmount != null) {
mTvTotalAmount.setText(String.format(moneyString, MoneyUtil.formatDouble(MoneyUtil.priceCalculation(foodInfoBean.getUnitPrice(), foodInfoBean.getFoodQuantity()))));
}
});
//食材增加按鈕監聽
viewHolder.getView(R.id.btn_food_operation_add).setOnClickListener(v -> {
......@@ -176,8 +190,10 @@ public class FoodListAdapter extends BaseQuickAdapter<PurchaseFoodBean, BaseView
onNumberChangeListener.onChanged(foodInfoBean.getFoodQuantity(), foodInfoBean.getFoodQuantity() + 1, viewHolder.getAdapterPosition());
}
addNumber(editText, foodInfoBean);
if (mTvTotalAmount != null) {
mTvTotalAmount.setText(String.format(moneyString, MoneyUtil.formatDouble(MoneyUtil.priceCalculation(foodInfoBean.getUnitPrice(), foodInfoBean.getFoodQuantity()))));
}
});
//手動輸入食材數量變化監聽
TextWatcher foodNumTextWatcher = new TextWatcher() {
@Override
......@@ -205,6 +221,10 @@ public class FoodListAdapter extends BaseQuickAdapter<PurchaseFoodBean, BaseView
if (purchaseFoodBean.getFoodQuantity() > 0) {
integerMap.put(purchaseFoodBean.getId(), purchaseFoodBean);
}
//當前食品總價修改
if (mTvTotalAmount != null) {
mTvTotalAmount.setText(String.format(moneyString, MoneyUtil.formatDouble(MoneyUtil.priceCalculation(purchaseFoodBean.getUnitPrice(), purchaseFoodBean.getFoodQuantity()))));
}
}
}
};
......
......@@ -7,7 +7,6 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:orientation="vertical">
<LinearLayout
......@@ -15,10 +14,10 @@
android:layout_width="match_parent"
android:layout_height="@dimen/dp_40"
android:layout_marginLeft="@dimen/dp_8"
android:visibility="gone"
android:layout_marginRight="@dimen/dp_8"
android:gravity="center_vertical"
android:orientation="horizontal">
android:orientation="horizontal"
android:visibility="gone">
<TextView
android:layout_width="wrap_content"
......@@ -54,14 +53,14 @@
</LinearLayout>
<include
android:id="@+id/line_supplier_info"
layout="@layout/include_horizontal_color_eee_dividing_line" />
<!-- <include-->
<!-- android:id="@+id/line_supplier_info"-->
<!-- layout="@layout/include_horizontal_color_eee_dividing_line" />-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dp_8"
android:layout_margin="@dimen/dp_5"
android:orientation="horizontal">
<CheckBox
......@@ -107,12 +106,6 @@
android:orientation="horizontal">
<TextView
style="@style/Food_Ingredient_Info_TextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="編號:" />
<TextView
android:id="@+id/tv_food_item_no"
style="@style/Food_Ingredient_Info_TextStyle"
android:layout_width="0dp"
......@@ -127,25 +120,13 @@
android:src="@drawable/ic_red_delete" />
</LinearLayout>
<LinearLayout
<TextView
android:id="@+id/tv_food_item_name"
style="@style/Food_Ingredient_Info_TextStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_5"
android:orientation="horizontal">
<TextView
style="@style/Food_Ingredient_Info_TextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="品名:" />
<TextView
android:id="@+id/tv_food_item_name"
style="@style/Food_Ingredient_Info_TextStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="巴西肥牛" />
</LinearLayout>
tools:text="巴西肥牛" />
<LinearLayout
android:layout_width="match_parent"
......@@ -157,13 +138,23 @@
style="@style/Food_Ingredient_Info_TextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="單位:" />
android:text="單價:" />
<TextView
android:id="@+id/tv_food_item_price"
style="@style/Food_Ingredient_Info_TextStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
tools:text="$100.00" />
<TextView
android:id="@+id/tv_food_item_unit"
style="@style/Food_Ingredient_Info_TextStyle"
android:layout_width="match_parent"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="right"
tools:text="3KG/盒" />
</LinearLayout>
......@@ -177,51 +168,53 @@
style="@style/Food_Ingredient_Info_TextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="價格:" />
android:text="總價:" />
<TextView
android:id="@+id/tv_food_item_price"
android:id="@+id/tv_food_item_total_amount"
style="@style/Food_Ingredient_Info_TextStyle"
android:layout_width="match_parent"
android:layout_width="0dp"
android:layout_height="wrap_content"
tools:text="$100.00" />
</LinearLayout>
<LinearLayout
android:id="@+id/layout_operation_food_num"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:gravity="center_vertical"
android:orientation="horizontal">
<com.qmuiteam.qmui.layout.QMUIButton
android:id="@+id/btn_food_operation_sub"
android:layout_width="@dimen/dp_24"
android:layout_height="@dimen/dp_24"
android:background="@drawable/ic_circle_gray_sub" />
android:layout_weight="1"
tools:text="$100.000" />
<EditText
android:id="@+id/ed_food_ingredient_number"
<LinearLayout
android:id="@+id/layout_operation_food_num"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_10"
android:background="@null"
android:inputType="number"
android:maxLength="4"
android:paddingLeft="@dimen/dp_4"
android:paddingRight="@dimen/dp_4"
android:text="0"
android:textColor="@color/black"
android:textSize="@dimen/dp_22" />
<com.qmuiteam.qmui.layout.QMUIButton
android:id="@+id/btn_food_operation_add"
android:layout_width="@dimen/dp_24"
android:layout_height="@dimen/dp_24"
android:background="@drawable/ic_circle_theme_add" />
android:gravity="center_vertical"
android:orientation="horizontal">
<com.qmuiteam.qmui.layout.QMUIButton
android:id="@+id/btn_food_operation_sub"
android:layout_width="@dimen/dp_24"
android:layout_height="@dimen/dp_24"
android:background="@drawable/ic_circle_gray_sub" />
<EditText
android:id="@+id/ed_food_ingredient_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_10"
android:background="@null"
android:inputType="number"
android:maxLength="4"
android:paddingLeft="@dimen/dp_4"
android:paddingRight="@dimen/dp_4"
android:text="10"
android:textColor="@color/black"
android:textSize="@dimen/dp_22" />
<com.qmuiteam.qmui.layout.QMUIButton
android:id="@+id/btn_food_operation_add"
android:layout_width="@dimen/dp_24"
android:layout_height="@dimen/dp_24"
android:background="@drawable/ic_circle_theme_add" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
......
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