Commit 8a4d2d49 by jason

食材数量 支持小数点

parent 044908ec
...@@ -64,7 +64,7 @@ public class ConfirmOrderBean { ...@@ -64,7 +64,7 @@ public class ConfirmOrderBean {
@Data @Data
public static class PurchaseOrderDetails { public static class PurchaseOrderDetails {
private int purchaseFoodId; private int purchaseFoodId;
private int foodQuantity; private double foodQuantity;
private double foodPrice; private double foodPrice;
private int orderId; private int orderId;
} }
......
...@@ -17,7 +17,7 @@ public class DishDetailBean { ...@@ -17,7 +17,7 @@ public class DishDetailBean {
private int restaurantId;// number 非必须 private int restaurantId;// number 非必须
private int purchaseFoodId;// number 非必须 食材编号 private int purchaseFoodId;// number 非必须 食材编号
private String foodName;// string 非必须 食材名称 private String foodName;// string 非必须 食材名称
private int consumeQuantity;// number 非必须 消耗个数 private double consumeQuantity;// number 非必须 消耗个数
private String basicUnitName;// string 非必须 配置单位 private String basicUnitName;// string 非必须 配置单位
private String foodNo;// string 非必须 食材编号 private String foodNo;// string 非必须 食材编号
private int type;// number 非必须 状态 0 食材 1 细项 private int type;// number 非必须 状态 0 食材 1 细项
......
...@@ -22,7 +22,7 @@ public class NewPurchaseOrderBean { ...@@ -22,7 +22,7 @@ public class NewPurchaseOrderBean {
@Data @Data
public static class NewPurchaseOrderDetailsBean { public static class NewPurchaseOrderDetailsBean {
private int foodId; private int foodId;
private int foodQuantity; private double foodQuantity;
private double foodPrice; private double foodPrice;
private int supplierId; private int supplierId;
} }
......
...@@ -40,7 +40,7 @@ public class OrderWareHouseBean { ...@@ -40,7 +40,7 @@ public class OrderWareHouseBean {
public static class PurchaseWarehousingOrderDetail { public static class PurchaseWarehousingOrderDetail {
private Integer orderDetailsId; private Integer orderDetailsId;
private Integer purchaseFoodId; private Integer purchaseFoodId;
private int foodQuantity; private double foodQuantity;
private double foodPrice; private double foodPrice;
private double totalPrice; private double totalPrice;
private int brandId; private int brandId;
......
...@@ -56,7 +56,7 @@ public class PurchaseFoodBean implements Serializable, QMUISection.Model<Purchas ...@@ -56,7 +56,7 @@ public class PurchaseFoodBean implements Serializable, QMUISection.Model<Purchas
*/ */
private String packingDescription; private String packingDescription;
private long createTime; private long createTime;
private int foodQuantity; private double foodQuantity;
/** /**
* 最低採購金額,食品列表用 * 最低採購金額,食品列表用
*/ */
......
...@@ -288,7 +288,7 @@ public class BuyIngredientsAdapter extends GroupedRecyclerViewAdapter<BuyIngredi ...@@ -288,7 +288,7 @@ public class BuyIngredientsAdapter extends GroupedRecyclerViewAdapter<BuyIngredi
}); });
} }
private void foodNumberChange(BaseViewHolder itemViewHolder, PurchaseFoodBean purchaseFoodBean, int groupPosition, int childPosition, int changeNum) { private void foodNumberChange(BaseViewHolder itemViewHolder, PurchaseFoodBean purchaseFoodBean, int groupPosition, int childPosition, double changeNum) {
purchaseFoodBean.setFoodQuantity(purchaseFoodBean.getFoodQuantity() + changeNum); purchaseFoodBean.setFoodQuantity(purchaseFoodBean.getFoodQuantity() + changeNum);
itemViewHolder.setText(R.id.ed_food_ingredient_number, String.valueOf(purchaseFoodBean.getFoodQuantity())); itemViewHolder.setText(R.id.ed_food_ingredient_number, String.valueOf(purchaseFoodBean.getFoodQuantity()));
setSubAndNumShow(itemViewHolder, purchaseFoodBean.getFoodQuantity() <= 0); setSubAndNumShow(itemViewHolder, purchaseFoodBean.getFoodQuantity() <= 0);
...@@ -308,7 +308,7 @@ public class BuyIngredientsAdapter extends GroupedRecyclerViewAdapter<BuyIngredi ...@@ -308,7 +308,7 @@ public class BuyIngredientsAdapter extends GroupedRecyclerViewAdapter<BuyIngredi
* @param beforeNum 之前的數量 * @param beforeNum 之前的數量
* @param currentNum 現在的數量 * @param currentNum 現在的數量
*/ */
void onChange(PurchaseFoodBean purchaseFoodBean, int parentCategoryIndex, int categoryIndex, int beforeNum, int currentNum); void onChange(PurchaseFoodBean purchaseFoodBean, int parentCategoryIndex, int categoryIndex, double beforeNum, double currentNum);
} }
public void setOnFoodNumberChangeListener(OnFoodNumberChangeListener onFoodNumberChangeListener) { public void setOnFoodNumberChangeListener(OnFoodNumberChangeListener onFoodNumberChangeListener) {
......
...@@ -146,7 +146,7 @@ public class FoodListAdapter extends BaseQuickAdapter<PurchaseFoodBean, BaseView ...@@ -146,7 +146,7 @@ public class FoodListAdapter extends BaseQuickAdapter<PurchaseFoodBean, BaseView
* @param number 修改後的食品數量 * @param number 修改後的食品數量
* @param position 操作的食品下標 * @param position 操作的食品下標
*/ */
void onChanged(int beforeNumber, int number, int position); void onChanged(double beforeNumber, double number, int position);
} }
public void setOnCheckedChangeListener(OnCheckedChangeListener onCheckedChangeListener) { public void setOnCheckedChangeListener(OnCheckedChangeListener onCheckedChangeListener) {
......
...@@ -297,7 +297,7 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Shop ...@@ -297,7 +297,7 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Shop
* @param purchaseFoodBean 需要刪除的食品對象 * @param purchaseFoodBean 需要刪除的食品對象
* @return 是否刪除供應商 * @return 是否刪除供應商
*/ */
private boolean deleteFood(int supplierPosition, BaseViewHolder viewHolder, TextView tvFoodTypeNumber, FoodListAdapter foodListAdapter, int beforeNumber, int position, PurchaseFoodBean purchaseFoodBean) { private boolean deleteFood(int supplierPosition, BaseViewHolder viewHolder, TextView tvFoodTypeNumber, FoodListAdapter foodListAdapter, double beforeNumber, int position, PurchaseFoodBean purchaseFoodBean) {
foodListAdapter.removeAt(position); foodListAdapter.removeAt(position);
//如果這個供應商沒有食品了,需要當前adapter刪除掉這個供應商 //如果這個供應商沒有食品了,需要當前adapter刪除掉這個供應商
if (foodListAdapter.getItemCount() == 0) { if (foodListAdapter.getItemCount() == 0) {
...@@ -328,7 +328,7 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Shop ...@@ -328,7 +328,7 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Shop
* @param unitPrice 食品單價 * @param unitPrice 食品單價
* @param foodQuantity 食品數量 * @param foodQuantity 食品數量
*/ */
private void minusFood(BaseViewHolder viewHolder, ShoppingCartBean cartBean, double unitPrice, int foodQuantity) { private void minusFood(BaseViewHolder viewHolder, ShoppingCartBean cartBean, double unitPrice, double foodQuantity) {
int species = cartBean.getSelectSpeciesNum() - 1; int species = cartBean.getSelectSpeciesNum() - 1;
cartBean.setSelectSpeciesNum(species); cartBean.setSelectSpeciesNum(species);
viewHolder.setText(R.id.tv_order_item_food_type_total, String.valueOf(species)); viewHolder.setText(R.id.tv_order_item_food_type_total, String.valueOf(species));
...@@ -342,7 +342,7 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Shop ...@@ -342,7 +342,7 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Shop
* @param unitPrice 食品單價 * @param unitPrice 食品單價
* @param foodQuantity 食品數量 * @param foodQuantity 食品數量
*/ */
private void addFood(BaseViewHolder viewHolder, ShoppingCartBean cartBean, double unitPrice, int foodQuantity) { private void addFood(BaseViewHolder viewHolder, ShoppingCartBean cartBean, double unitPrice, double foodQuantity) {
int species = cartBean.getSelectSpeciesNum() + 1; int species = cartBean.getSelectSpeciesNum() + 1;
cartBean.setSelectSpeciesNum(species); cartBean.setSelectSpeciesNum(species);
viewHolder.setText(R.id.tv_order_item_food_type_total, String.valueOf(species)); viewHolder.setText(R.id.tv_order_item_food_type_total, String.valueOf(species));
...@@ -357,7 +357,7 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Shop ...@@ -357,7 +357,7 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Shop
* @param foodQuantity 食品數量 * @param foodQuantity 食品數量
* @param species 需要增加的種類數量 * @param species 需要增加的種類數量
*/ */
private void addTotalAmount(BaseViewHolder viewHolder, ShoppingCartBean cartBean, double unitPrice, int foodQuantity, int species) { private void addTotalAmount(BaseViewHolder viewHolder, ShoppingCartBean cartBean, double unitPrice, double foodQuantity, int species) {
//供應商總價減去-這個食品的總價=等於現價 //供應商總價減去-這個食品的總價=等於現價
double currentPrice = MoneyUtil.sum(cartBean.getSelectFoodAmount(), MoneyUtil.priceCalculation(unitPrice, foodQuantity)); double currentPrice = MoneyUtil.sum(cartBean.getSelectFoodAmount(), MoneyUtil.priceCalculation(unitPrice, foodQuantity));
cartBean.setSelectFoodAmount(currentPrice); cartBean.setSelectFoodAmount(currentPrice);
...@@ -377,7 +377,7 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Shop ...@@ -377,7 +377,7 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Shop
* @param foodQuantity 食品數量 * @param foodQuantity 食品數量
* @param species 需要減少的種類數量 * @param species 需要減少的種類數量
*/ */
private void minusTotalPrice(BaseViewHolder viewHolder, ShoppingCartBean cartBean, double unitPrice, int foodQuantity, int species) { private void minusTotalPrice(BaseViewHolder viewHolder, ShoppingCartBean cartBean, double unitPrice, double foodQuantity, int species) {
//供應商總價減去-這個食品的總價=等於現價 //供應商總價減去-這個食品的總價=等於現價
double currentPrice = MoneyUtil.sub(cartBean.getSelectFoodAmount(), MoneyUtil.priceCalculation(unitPrice, foodQuantity)); double currentPrice = MoneyUtil.sub(cartBean.getSelectFoodAmount(), MoneyUtil.priceCalculation(unitPrice, foodQuantity));
//修改選中食品的金額 //修改選中食品的金額
......
...@@ -54,7 +54,7 @@ public class DishDetailAdapter extends BaseQuickAdapter<DishDetailBean, BaseView ...@@ -54,7 +54,7 @@ public class DishDetailAdapter extends BaseQuickAdapter<DishDetailBean, BaseView
count.setText(String.valueOf(tag.getConsumeQuantity())); count.setText(String.valueOf(tag.getConsumeQuantity()));
count.setSelection(count.getText().toString().length()); count.setSelection(count.getText().toString().length());
}else { }else {
tag.setConsumeQuantity(Integer.parseInt(s.toString())); tag.setConsumeQuantity(Double.valueOf(s.toString()));
} }
} }
}); });
......
...@@ -158,7 +158,7 @@ public class FunctionListFragment extends BaseSupplyChainFragment<FunctionListPr ...@@ -158,7 +158,7 @@ public class FunctionListFragment extends BaseSupplyChainFragment<FunctionListPr
case "設置": case "設置":
new XPopup.Builder(requireContext()).asCustom(new UpdateRestaurantInfoPop(requireContext())).show(); new XPopup.Builder(requireContext()).asCustom(new UpdateRestaurantInfoPop(requireContext())).show();
break; break;
case "菜品Boom": case "菜品Bom":
start(DishesFragment.newInstance()); start(DishesFragment.newInstance());
break; break;
default: default:
......
...@@ -655,7 +655,7 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien ...@@ -655,7 +655,7 @@ public class BuyIngredientsFragment extends BaseSupplyChainFragment<BuyIngredien
* @param beforeNum 改变之前的数量 * @param beforeNum 改变之前的数量
* @param currentNum 改变之后的数量 * @param currentNum 改变之后的数量
*/ */
private void foodNumberChanger(PurchaseFoodBean purchaseFoodBean, int parentCategoryIndex, int beforeNum, int currentNum) { private void foodNumberChanger(PurchaseFoodBean purchaseFoodBean, int parentCategoryIndex, double beforeNum, double currentNum) {
BuyIngredientsBean firstCategory = mPresenter.getFirstCategoryByIndex(parentCategoryIndex); BuyIngredientsBean firstCategory = mPresenter.getFirstCategoryByIndex(parentCategoryIndex);
if (firstCategory != null) { if (firstCategory != null) {
int firstCategoryByIndex = firstLevelCategoryAdapter.getItemPosition(new OrderCategoryBean.FoodCategoryTrees(firstCategory.id, firstCategory.categoryName, firstCategory.parentId)); int firstCategoryByIndex = firstLevelCategoryAdapter.getItemPosition(new OrderCategoryBean.FoodCategoryTrees(firstCategory.id, firstCategory.categoryName, firstCategory.parentId));
......
...@@ -667,7 +667,7 @@ public class OtherFunctionFragment extends BaseSupplyChainFragment<OtherFunction ...@@ -667,7 +667,7 @@ public class OtherFunctionFragment extends BaseSupplyChainFragment<OtherFunction
* @param beforeNum 改变之前的数量 * @param beforeNum 改变之前的数量
* @param currentNum 改变之后的数量 * @param currentNum 改变之后的数量
*/ */
private void foodNumberChanger(PurchaseFoodBean purchaseFoodBean, int parentCategoryIndex, int beforeNum, int currentNum) { private void foodNumberChanger(PurchaseFoodBean purchaseFoodBean, int parentCategoryIndex, double beforeNum, double currentNum) {
BuyIngredientsBean firstCategory = mPresenter.getFirstCategoryByIndex(parentCategoryIndex); BuyIngredientsBean firstCategory = mPresenter.getFirstCategoryByIndex(parentCategoryIndex);
if (firstCategory != null) { if (firstCategory != null) {
int firstCategoryByIndex = firstLevelCategoryAdapter.getItemPosition(new OrderCategoryBean.FoodCategoryTrees(firstCategory.id, firstCategory.categoryName, firstCategory.parentId)); int firstCategoryByIndex = firstLevelCategoryAdapter.getItemPosition(new OrderCategoryBean.FoodCategoryTrees(firstCategory.id, firstCategory.categoryName, firstCategory.parentId));
......
...@@ -156,7 +156,7 @@ public class GoodsDetailsPopup extends CenterPopupView { ...@@ -156,7 +156,7 @@ public class GoodsDetailsPopup extends CenterPopupView {
}); });
} }
private int hasFocusNum; private double hasFocusNum;
public GoodsDetailsPopup setEditNumber(boolean editNumber) { public GoodsDetailsPopup setEditNumber(boolean editNumber) {
isEditNumber = editNumber; isEditNumber = editNumber;
...@@ -186,7 +186,7 @@ public class GoodsDetailsPopup extends CenterPopupView { ...@@ -186,7 +186,7 @@ public class GoodsDetailsPopup extends CenterPopupView {
public void setLongClick(boolean addOrSub) { public void setLongClick(boolean addOrSub) {
//開啟線程 //開啟線程
ThreadPoolManager.getInstence().putExecutableTasks(() -> { ThreadPoolManager.getInstence().putExecutableTasks(() -> {
int number = purchaseFoodBean.getFoodQuantity(); double number = purchaseFoodBean.getFoodQuantity();
delayTime = PurchaseConstant.LONG_CLICK_INIT_TIME; delayTime = PurchaseConstant.LONG_CLICK_INIT_TIME;
if (addOrSub) { if (addOrSub) {
//+ //+
...@@ -228,7 +228,7 @@ public class GoodsDetailsPopup extends CenterPopupView { ...@@ -228,7 +228,7 @@ public class GoodsDetailsPopup extends CenterPopupView {
}); });
} }
private void foodNumberChange(int changeNum) { private void foodNumberChange(double changeNum) {
if (changeNum == 0) { if (changeNum == 0) {
return; return;
} }
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
android:textColor="@color/color_18" android:textColor="@color/color_18"
android:background="@drawable/shape_border_bg_c8" android:background="@drawable/shape_border_bg_c8"
android:gravity="center" android:gravity="center"
android:inputType="numberDecimal" android:inputType="numberDecimal|number"
android:maxLines="1" android:maxLines="1"
android:textColorHighlight="@color/theme_color" android:textColorHighlight="@color/theme_color"
android:textCursorDrawable="@drawable/cursor_theme" android:textCursorDrawable="@drawable/cursor_theme"
......
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