Commit 1e28402f by Wyh

1、prj打印不顯示問題

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