Commit 7f36f6c7 by Wyh

1、供應鏈入庫代碼

parent 268b6d27
package com.gingersoft.supply_chain.mvp.bean;
import java.util.List;
/**
* @author 宇航. 1239658231@qq.com
* User: admin
* Date: 2021/4/30
* Time: 11:58
* Use:
*/
public class NoIsFoodSnTipBean {
private List<String> MessageCode;
private List<String> list;
public List<String> getMessageCode() {
return MessageCode;
}
public void setMessageCode(List<String> MessageCode) {
this.MessageCode = MessageCode;
}
public List<String> getList() {
return list;
}
public void setList(List<String> list) {
this.list = list;
}
}
......@@ -14,7 +14,7 @@ import lombok.Data;
@Data
public class OrderWareHouseBean {
private int status;
private int orderId;
private Integer orderId;
// private List<String> encodeFoodNos;
private List<PurchaseConsumeVerifyEncodeSn> purchaseConsumeVerifyEncodeSn;
......@@ -32,6 +32,8 @@ public class OrderWareHouseBean {
private int brandId;
private int restaurantId;
//入庫原因,字符串
private String storageType;
}
@Data
......@@ -41,6 +43,8 @@ public class OrderWareHouseBean {
private int foodQuantity;
private double foodPrice;
private double totalPrice;
private int brandId;
private int restaurantId;
/**
* 主單位名稱
*/
......
......@@ -107,7 +107,14 @@ public class PurchaseFoodBean implements Serializable, QMUISection.Model<Purchas
private int foodMarkSn;
public static final int NOT_HAS_SN = 0;
public static final int HAS_SN = 1;
/**
* 本地食材新增一個SN集合,新建入庫單時保存進去
*/
private List<PurchaseFoodEncodeSn> purchaseFoodEncodeSn;
/**
* 本地食材新增一個單位,存放用戶選中的單位
*/
private DeputyUnitBean showUnit;
/**
* 庫存預警 模塊
*/
......
package com.gingersoft.supply_chain.mvp.content;
import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.supply_chain.BuildConfig;
import java.util.Map;
......@@ -69,13 +67,13 @@ public class PurchaseConstant {
public static final String DELETE_FAIL = "刪除失敗,請稍後重試";
public static int getBrandId() {
return RestaurantInfoManager.newInstance().getBrandId();
// return BuildConfig.DEBUG ? 1 : RestaurantInfoManager.newInstance().getBrandId();
// return RestaurantInfoManager.newInstance().getBrandId();
return BuildConfig.DEBUG ? 1 : RestaurantInfoManager.newInstance().getBrandId();
}
public static int getRestaurantId() {
return RestaurantInfoManager.newInstance().getRestaurantId();
// return BuildConfig.DEBUG ? 26 : RestaurantInfoManager.newInstance().getRestaurantId();
// return RestaurantInfoManager.newInstance().getRestaurantId();
return BuildConfig.DEBUG ? 26 : RestaurantInfoManager.newInstance().getRestaurantId();
}
public static void addBrandId(@NonNull Map<String, Object> map) {
......
......@@ -69,6 +69,10 @@ public interface WarehouseDetailsContract {
*/
void printConsumeOrder(List<String> snCodes, String consumeReasonDesc, int consumptionNum);
/**
* 移除掉不是這個食品的SN碼
*/
void removeNoFoodSn(List<String> sns);
}
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
......
package com.gingersoft.supply_chain.mvp.contract;
import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.supply_chain.mvp.ui.adapter.ConsumptionReasonAdapter;
import com.gingersoft.supply_chain.mvp.ui.adapter.WareHousingOrderFoodAdapter;
import com.jess.arms.mvp.IView;
import com.jess.arms.mvp.IModel;
import java.util.Map;
import io.reactivex.Observable;
import okhttp3.RequestBody;
/**
* ================================================
......@@ -28,6 +34,14 @@ public interface WarehousingOrderDetailsContract {
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
interface Model extends IModel {
/**
* 獲取庫存入庫原因
*/
Observable<BaseResult> getMultipleStorageCauseList(Map<String, Object> map);
/**
* 生成入庫單
*/
Observable<BaseResult> addWarehousingOrder(RequestBody requestBody);
}
}
......@@ -2,6 +2,8 @@ package com.gingersoft.supply_chain.mvp.model;
import android.app.Application;
import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.supply_chain.mvp.server.SupplierServer;
import com.google.gson.Gson;
import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;
......@@ -12,6 +14,11 @@ import javax.inject.Inject;
import com.gingersoft.supply_chain.mvp.contract.WarehousingOrderDetailsContract;
import java.util.Map;
import io.reactivex.Observable;
import okhttp3.RequestBody;
/**
* ================================================
......@@ -43,4 +50,14 @@ public class WarehousingOrderDetailsModel extends BaseModel implements Warehousi
this.mGson = null;
this.mApplication = null;
}
@Override
public Observable<BaseResult> getMultipleStorageCauseList(Map<String, Object> map) {
return mRepositoryManager.obtainRetrofitService(SupplierServer.class).getMultipleStorageCauseList(map);
}
@Override
public Observable<BaseResult> addWarehousingOrder(RequestBody requestBody) {
return mRepositoryManager.obtainRetrofitService(SupplierServer.class).addWarehousingOrder(requestBody);
}
}
\ No newline at end of file
......@@ -549,6 +549,10 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
*/
public void uploadPic(String filePath) {
File file = new File(BitmapUtil.compressImage(filePath));
if (file.length() <= 0) {
mRootView.showMessage("圖片已損壞,請重新選擇圖片");
return;
}
List<MultipartBody.Part> multipartBodies = new ArrayList<>();
multipartBodies.add(MultipartBody.Part.createFormData("files", file.getName(), RequestBody.create(MediaType.parse("image/png"), file)));
Map<String, Object> map = new HashMap<>(1);
......
......@@ -9,14 +9,23 @@ import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.supply_chain.mvp.bean.ConsumeReasonBean;
import com.gingersoft.supply_chain.mvp.bean.ConsumeWareHousingBean;
import com.gingersoft.supply_chain.mvp.bean.NoIsFoodSnTipBean;
import com.gingersoft.supply_chain.mvp.bean.PurchaseConsumeSnBean;
import com.gingersoft.supply_chain.mvp.bean.PurchaseWarehousingOrderDetailsVO;
import com.gingersoft.supply_chain.mvp.bean.WarehouseDetailsBean;
import com.gingersoft.supply_chain.mvp.content.PurchaseConstant;
import com.jess.arms.integration.AppManager;
import com.gingersoft.supply_chain.mvp.contract.WarehouseDetailsContract;
import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.mvp.BasePresenter;
import com.jess.arms.http.imageloader.ImageLoader;
import com.jess.arms.integration.AppManager;
import com.jess.arms.mvp.BasePresenter;
import com.jess.arms.utils.RxLifecycleUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.inject.Inject;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
......@@ -25,15 +34,6 @@ import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber;
import okhttp3.MediaType;
import okhttp3.RequestBody;
import javax.inject.Inject;
import com.gingersoft.supply_chain.mvp.contract.WarehouseDetailsContract;
import com.jess.arms.utils.RxLifecycleUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* ================================================
......@@ -46,6 +46,7 @@ import java.util.Map;
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
* @author admin
*/
@FragmentScope
public class WarehouseDetailsPresenter extends BasePresenter<WarehouseDetailsContract.Model, WarehouseDetailsContract.View> {
......@@ -108,7 +109,7 @@ public class WarehouseDetailsPresenter extends BasePresenter<WarehouseDetailsCon
/**
* 獲取出庫庫訂單流水
*
* @param foodNo
* @param foodNo 食材編號
*/
public void getOutStockDetails(String foodNo) {
Map<String, Object> map = new HashMap<>(4);
......@@ -209,10 +210,15 @@ public class WarehouseDetailsPresenter extends BasePresenter<WarehouseDetailsCon
//如果需要打印,則在打印完成後執行
mRootView.showList(View.VISIBLE);
} else if (baseResult != null && TextUtil.isNotEmptyOrNullOrUndefined(baseResult.getErrMsg())) {
NoIsFoodSnTipBean noIsFoodSnTipBean = GsonUtils.GsonToBean(baseResult.getData(), NoIsFoodSnTipBean.class);
if (noIsFoodSnTipBean.getList() != null) {
mRootView.removeNoFoodSn(noIsFoodSnTipBean.getList());
}
mRootView.showMessage(baseResult.getErrMsg());
} else {
mRootView.showMessage(PurchaseConstant.UPDATE_FAIL);
}
}
});
}
......
......@@ -489,4 +489,14 @@ public interface SupplierServer {
Observable<BaseResult> getWarehousingRecord(@QueryMap Map<String, Object> map);
/**
* 查詢入庫原因
*/
@Headers({"Domain-Name: ricepon-purchase"})
@GET("purchaseConsumeReason/multipleStorageCauseList" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseResult> getMultipleStorageCauseList(@QueryMap Map<String, Object> map);
@Headers({"Domain-Name: ricepon-purchase"})
@POST("purchaseWarehousingOrder/details/addMultipleStorageDetails" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseResult> addWarehousingOrder(@Body RequestBody requestBody);
}
package com.gingersoft.supply_chain.mvp.ui.adapter;
import android.graphics.drawable.Drawable;
import android.view.View;
import android.widget.TextView;
import androidx.cardview.widget.CardView;
import androidx.core.content.ContextCompat;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
......@@ -27,8 +27,8 @@ import java.util.List;
public class FoodCategoryAdapter extends BaseQuickAdapter<OrderCategoryBean.FoodCategoryTrees, BaseViewHolder> {
private int selectIndex = 0;
private Drawable checkedBg;
private Drawable unCheckedBg;
private int checkedBg = -1;
private int unCheckedBg = -1;
private int checkedTextColor;
private int unCheckedTextColor;
......@@ -57,15 +57,16 @@ public class FoodCategoryAdapter extends BaseQuickAdapter<OrderCategoryBean.Food
}
viewHolder.setVisible(R.id.tv_second_category_title, TextUtil.isNotEmptyOrNullOrUndefined(categoryBean.getName()));
if (viewHolder.getAdapterPosition() == selectIndex) {
if (checkedBg != null) {
cardView.setBackground(checkedBg);
if (checkedBg != -1) {
cardView.setBackground(ContextCompat.getDrawable(getContext(), checkedBg));
}
if (checkedTextColor != 0) {
tvName.setTextColor(checkedTextColor);
}
} else {
if (unCheckedBg != null) {
cardView.setBackground(unCheckedBg);
if (unCheckedBg != -1) {
cardView.setBackground(ContextCompat.getDrawable(getContext(), unCheckedBg));
}
if (unCheckedTextColor != 0) {
tvName.setTextColor(unCheckedTextColor);
......@@ -78,12 +79,12 @@ public class FoodCategoryAdapter extends BaseQuickAdapter<OrderCategoryBean.Food
notifyDataSetChanged();
}
public FoodCategoryAdapter setCheckedBg(Drawable checkedBg) {
public FoodCategoryAdapter setCheckedBg(int checkedBg) {
this.checkedBg = checkedBg;
return this;
}
public FoodCategoryAdapter setUnCheckedBg(Drawable unCheckedBg) {
public FoodCategoryAdapter setUnCheckedBg(int unCheckedBg) {
this.unCheckedBg = unCheckedBg;
return this;
}
......
package com.gingersoft.supply_chain.mvp.ui.adapter;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.gingersoft.supply_chain.R;
......@@ -21,7 +22,7 @@ public class WareHousingOrderFoodAdapter extends BaseQuickAdapter<PurchaseFoodBe
public WareHousingOrderFoodAdapter(@Nullable List<PurchaseFoodBean> data) {
super(R.layout.item_warehousing_order_details, data);
addChildClickViewIds(R.id.tv_edit);
addChildClickViewIds(R.id.tv_edit, R.id.layout_unit_switch);
}
@Override
......@@ -29,7 +30,15 @@ public class WareHousingOrderFoodAdapter extends BaseQuickAdapter<PurchaseFoodBe
holder.setText(R.id.tv_goods_name, item.getName());
holder.setText(R.id.tv_goods_unit, item.getBasicUnitName());
holder.setText(R.id.tv_goods_quantity, String.valueOf(item.getFoodQuantity()));
holder.setText(R.id.tv_edit, getContext().getString(R.string.str_look_over));
if (item.getFoodMarkSn() == PurchaseFoodBean.HAS_SN) {
//是SN食材
holder.setText(R.id.tv_edit, getContext().getString(R.string.str_warehousing));
holder.setTextColor(R.id.tv_edit, ContextCompat.getColor(getContext(), R.color.additional_service_charge_btn_color));
} else {
//不是SN食材
holder.setText(R.id.tv_edit, getContext().getString(R.string.str_look_over));
holder.setTextColor(R.id.tv_edit, ContextCompat.getColor(getContext(), R.color.theme_333_color));
}
if (item.getFoodUnits() != null && item.getFoodUnits().size() > 1) {
holder.setVisible(R.id.iv_switch_unit, true);
} else {
......
......@@ -96,8 +96,8 @@ public class FunctionListFragment extends BaseSupplyChainFragment<FunctionListPr
List<Function> storage = new ArrayList<>();
storage.add(new Function("庫存查詢", R.drawable.ic_inventory_inquiry));
storage.add(new Function("入庫", R.drawable.ic_warehousing));
storage.add(new Function("出庫", R.drawable.ic_out_of_stock));
storage.add(new Function("盤點", R.drawable.ic_inventory));
// storage.add(new Function("出庫", R.drawable.ic_out_of_stock));
// storage.add(new Function("盤點", R.drawable.ic_inventory));
if (BuildConfig.DEBUG) {
storage.add(new Function("切換環境", R.drawable.ic_seekbar_btn));
}
......
......@@ -338,8 +338,8 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter>
//加載一級分類
if (categoryAdapter == null) {
categoryAdapter = new FoodCategoryAdapter(R.layout.item_first_category, data)
.setUnCheckedBg(ContextCompat.getDrawable(mContext, R.color.trans))
.setCheckedBg(ContextCompat.getDrawable(mContext, R.drawable.shape_left_radio_shadow))
.setUnCheckedBg(R.color.trans)
.setCheckedBg(R.drawable.shape_left_radio_shadow)
.setUnCheckedTextColor(ContextCompat.getColor(mContext, R.color.color_3c))
.setCheckedTextColor(ContextCompat.getColor(mContext, R.color.theme_color));
rvFirstCategory.setAdapter(categoryAdapter);
......@@ -396,8 +396,8 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter>
secondCategoryAdapter = new FoodCategoryAdapter(data);
//因為第一個數據是空的,用來顯示按鈕,所以下標跳過0,默認選中1
//設置adapter的信息
secondCategoryAdapter.setCheckedBg(ContextCompat.getDrawable(mContext, R.drawable.shape_app_btn_small_radius))
.setUnCheckedBg(ContextCompat.getDrawable(mContext, R.drawable.shape_five_radius_gray_stroke))
secondCategoryAdapter.setCheckedBg(R.drawable.shape_app_btn_small_radius)
.setUnCheckedBg(R.drawable.shape_five_radius_gray_stroke)
.setCheckedTextColor(ContextCompat.getColor(mContext, R.color.white))
.setUnCheckedTextColor(ContextCompat.getColor(mContext, R.color.color_3c))
.setSelectIndex(categoryPosition[1] + 1)
......@@ -465,8 +465,8 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter>
if (thirdCategoryAdapter == null) {
thirdCategoryAdapter = new FoodCategoryAdapter(data);
thirdCategoryAdapter.setSelectIndex(categoryPosition[2] + 1)
.setCheckedBg(ContextCompat.getDrawable(mContext, R.drawable.shape_color_theme_stoke_fifteen_corners))
.setUnCheckedBg(ContextCompat.getDrawable(mContext, R.drawable.shape_color_da_stoke_fifteen_corners))
.setCheckedBg(R.drawable.shape_color_theme_stoke_fifteen_corners)
.setUnCheckedBg(R.drawable.shape_color_da_stoke_fifteen_corners)
.setCheckedTextColor(ContextCompat.getColor(mContext, R.color.white))
.setUnCheckedTextColor(ContextCompat.getColor(mContext, R.color.color_68))
.setOnItemClickListener((adapter, view, position) -> {
......
......@@ -255,7 +255,11 @@ public class NewFoodIngredientsFragment extends BaseSupplyChainFragment<NewFoodI
if (uri != null) {
//有報錯
File file = SelectPicture.getInstance().uriToFileApiQ(requireContext(), uri);
SelectPicture.getInstance().crop(Uri.fromFile(file), this);
if (file == null) {
showMessage("圖片已損壞,請重新選擇圖片");
} else {
SelectPicture.getInstance().crop(Uri.fromFile(file), this);
}
}
}
} else if (requestCode == SelectPicture.TAKE_PHOTO && resultCode == RESULT_OK) {
......
......@@ -48,6 +48,7 @@ import com.gingersoft.supply_chain.mvp.ui.widget.InventoryConsumptionView;
import com.gingersoft.supply_chain.mvp.ui.widget.ScanSnView;
import com.jess.arms.di.component.AppComponent;
import com.kingja.loadsir.core.LoadSir;
import com.lxj.xpopup.interfaces.OnConfirmListener;
import com.qmuiteam.qmui.widget.QMUITopBar;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
......@@ -76,6 +77,7 @@ public class WarehouseDetailsFragment extends BaseSupplyChainFragment<WarehouseD
@BindView(R2.id.tv_warehouse_specifications)
TextView tvWarehouseSpecifications;
@BindView(R2.id.tv_warehouse_unit_price)
TextView tvWarehouseUnitPrice;
@BindView(R2.id.tv_warehouse_total_amount)
TextView tvWarehouseTotalAmount;
......@@ -385,6 +387,17 @@ public class WarehouseDetailsFragment extends BaseSupplyChainFragment<WarehouseD
onPrintPdf(snCodes, consumeReasonDesc, inventoryConsumptionView.getRemark(), consumptionNum);
}
@Override
public void removeNoFoodSn(List<String> sns) {
AppDialog.getInstance().showTipDialog(requireContext(), "是否移除非當前食材的SN碼?" + sns.toString(), () -> {
if (scanSnView != null) {
//修改上面的數量
inventoryConsumptionView.setConsumptionNumber(scanSnView.getSnSize() - sns.size());
scanSnView.removeCode(sns);
}
});
}
private void onPrintPdf(List<String> snCodes, String consumptionReason, String remarks, int foodNum) {
PrintHelper printHelper = new PrintHelper(requireContext());
boolean b = PrintHelper.systemSupportsPrint();
......
......@@ -6,21 +6,28 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.SwitchCompat;
import androidx.core.content.ContextCompat;
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.CollectionUtils;
import com.gingersoft.gsa.cloud.common.utils.MoneyUtil;
import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.R2;
import com.gingersoft.supply_chain.di.component.DaggerWarehousingOrderDetailsComponent;
import com.gingersoft.supply_chain.mvp.bean.ConsumeReasonBean;
import com.gingersoft.supply_chain.mvp.bean.DeputyUnitBean;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodBean;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodEncodeSn;
import com.gingersoft.supply_chain.mvp.bean.PurchaseOrderDetailsBean;
import com.gingersoft.supply_chain.mvp.content.SupplyShoppingCart;
import com.gingersoft.supply_chain.mvp.contract.WarehousingOrderDetailsContract;
import com.gingersoft.supply_chain.mvp.presenter.WarehousingOrderDetailsPresenter;
......@@ -29,15 +36,19 @@ import com.gingersoft.supply_chain.mvp.ui.adapter.WareHousingOrderFoodAdapter;
import com.gingersoft.supply_chain.mvp.ui.fragment.BaseSupplyChainFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.food.BuyIngredientsFragment;
import com.gingersoft.supply_chain.mvp.ui.widget.GoodsDetailsPopup;
import com.gingersoft.supply_chain.mvp.ui.widget.ScanSnPopup;
import com.jess.arms.di.component.AppComponent;
import com.lxj.xpopup.XPopup;
import com.qmuiteam.qmui.alpha.QMUIAlphaTextView;
import com.qmuiteam.qmui.widget.QMUITopBar;
import com.yanzhenjie.recyclerview.widget.DefaultItemDecoration;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import butterknife.BindView;
import butterknife.OnClick;
/**
......@@ -45,7 +56,7 @@ import butterknife.BindView;
*
* @author admin
*/
public class WarehousingOrderDetailsFragment extends BaseSupplyChainFragment<WarehousingOrderDetailsPresenter> implements WarehousingOrderDetailsContract.View {
public class WarehousingOrderDetailsFragment extends BaseSupplyChainFragment<WarehousingOrderDetailsPresenter> implements WarehousingOrderDetailsContract.View, View.OnClickListener {
@BindView(R2.id.supply_top_bar)
QMUITopBar supplyTopBar;
......@@ -92,7 +103,11 @@ public class WarehousingOrderDetailsFragment extends BaseSupplyChainFragment<War
//入庫類型
rvWarehousingType.setLayoutManager(new GridLayoutManager(requireContext(), 3));
mPresenter.getWarehousingReason();
mPresenter.getWarehousingFood();
mPresenter.initWarehousingFood();
//總價
tvOrderTotalAmount.setText(String.format(getString(R.string.str_amount_tran_s), MoneyUtil.formatDouble(mPresenter.getFoodTotalAmount())));
//種類
tvFoodSpecies.setText(mPresenter.getFoodSize() + "");
}
private View getHeader() {
......@@ -122,28 +137,78 @@ public class WarehousingOrderDetailsFragment extends BaseSupplyChainFragment<War
@Override
public void initFoodView(WareHousingOrderFoodAdapter wareHousingOrderFoodAdapter) {
wareHousingOrderFoodAdapter.addHeaderView(getHeader());
rvWarehousingFood.addItemDecoration(new DefaultItemDecoration(ContextCompat.getColor(requireContext(), R.color.color_ccc), LinearLayout.LayoutParams.MATCH_PARENT, 1));
wareHousingOrderFoodAdapter.addFooterView(getFooter(v -> start(BuyIngredientsFragment.newInstance(BuyIngredientsFragment.GET_FOOD_BY_WAREHOUSING_ORDER))));
rvWarehousingFood.setAdapter(wareHousingOrderFoodAdapter);
wareHousingOrderFoodAdapter.setOnItemChildClickListener(new OnItemChildClickListener() {
@Override
public void onItemChildClick(@NonNull BaseQuickAdapter adapter, @NonNull View view, int position) {
int viewId = view.getId();
if (viewId == R.id.tv_edit) {
//查看
PurchaseFoodBean item = wareHousingOrderFoodAdapter.getItem(position);
if (wareHousingOrderFoodAdapter.getItem(position).getFoodMarkSn() == PurchaseFoodBean.HAS_SN) {
//SN食材,輸入SN碼
} else {
//顯示詳情
new XPopup.Builder(requireContext())
.autoOpenSoftInput(false)
.autoFocusEditText(false)
.asCustom(new GoodsDetailsPopup(requireContext(), item).setEditNumber(false))
.show();
}
wareHousingOrderFoodAdapter.setOnItemChildClickListener((adapter, view, position) -> {
int viewId = view.getId();
if (viewId == R.id.layout_unit_switch) {
//切換單位
} else if (viewId == R.id.tv_edit) {
//查看
PurchaseFoodBean item = wareHousingOrderFoodAdapter.getItem(position);
if (wareHousingOrderFoodAdapter.getItem(position).getFoodMarkSn() == PurchaseFoodBean.HAS_SN) {
//SN食材,輸入SN碼
showScanPopup(wareHousingOrderFoodAdapter.getItem(position));
} else {
//顯示詳情
new XPopup.Builder(requireContext())
.autoOpenSoftInput(false)
.autoFocusEditText(false)
.asCustom(new GoodsDetailsPopup(requireContext(), item).setEditNumber(false))
.show();
}
}
});
}
/**
* 顯示掃碼popupwindow
*
* @param infoVosBean 食品信息
*/
private void showScanPopup(PurchaseFoodBean infoVosBean) {
List<PurchaseFoodEncodeSn> foodEncodeSns = infoVosBean.getPurchaseFoodEncodeSn();
ScanSnPopup scanSnPopup = new ScanSnPopup(this, infoVosBean.getName(), foodEncodeSns, true)
.setOnDeleteListener((snCode, snPosition) -> {
foodEncodeSns.remove(snCode);
});
scanSnPopup.setOnScanResultListener((popup, scanResult) -> {
//當前食材infoVosBean裡面有個sn碼集合,將scanResult添加進去
// //添加到食品中去
// if (foodEncodeSns != null) {
// foodEncodeSns.addAll(newAddSnCodes);
// } else {
// infoVosBean.setPurchaseFoodEncodeSns(newAddSnCodes);
// }
DeputyUnitBean showUnit = infoVosBean.getShowUnit();
showUnit.setDeputyValue(scanResult.size());
scanSnPopup.dismissOrHideSoftInput();
if (!scanSnPopup.isDismiss()) {
scanSnPopup.dismiss();
}
});
new XPopup.Builder(
requireContext())
.asCustom(scanSnPopup)
.show();
}
private void createWarehousingOrder() {
mPresenter.createWarehousingOrder(edRemark.getText().toString());
}
@OnClick(R2.id.tv_order_confirm)
@Override
public void onClick(View v) {
int vId = v.getId();
if (vId == R.id.tv_order_confirm) {
//創建入庫單
createWarehousingOrder();
} else if (vId == R.id.tv_order_cancel) {
killMyself();
}
}
}
......@@ -198,15 +198,15 @@ public class ScanSnView extends FrameLayout {
adapter.setOnItemChildClickListener((adapter1, view, position) -> {
if (view.getId() == R.id.iv_sn_code_delete) {
// if (adapter.getItem(position).newAdd) {
onSingerResultListener.onScanValue(false, adapter.getItem(position), adapter.getItemCount());
if (onDeleteSnCodeListener != null) {
onDeleteSnCodeListener.onDelete(adapter.getItem(position), position);
}
if (adapter.getItem(position).newAdd) {
newCodeSize--;
}
adapter1.removeAt(position);
setConfirmBtnState();
onSingerResultListener.onScanValue(false, adapter.getItem(position), adapter.getItemCount());
if (onDeleteSnCodeListener != null) {
onDeleteSnCodeListener.onDelete(adapter.getItem(position), position);
}
if (adapter.getItem(position).newAdd) {
newCodeSize--;
}
adapter1.removeAt(position);
setConfirmBtnState();
// } else {
// ToastUtils.show(getContext(), "已入庫的SN碼不可刪除");
// }
......@@ -275,6 +275,7 @@ public class ScanSnView extends FrameLayout {
PurchaseFoodEncodeSn purchaseFoodEncodeSn = new PurchaseFoodEncodeSn(snCode);
purchaseFoodEncodeSn.newAdd = true;
adapter.addData(0, purchaseFoodEncodeSn);
adapter.notifyDataSetChanged();
newCodeSize++;
edInputSn.setText("");
setConfirmBtnState();
......@@ -292,6 +293,19 @@ public class ScanSnView extends FrameLayout {
return this;
}
public ScanSnView removeCode(List<String> sns) {
for (String sn : sns) {
for (PurchaseFoodEncodeSn datum : adapter.getData()) {
if (datum.getEncodeSnNo().equals(sn)) {
adapter.remove(datum);
break;
}
}
}
setConfirmBtnState();
return this;
}
public ScanSnView setMaxCodeSize(int maxCodeSize) {
this.maxCodeSize = maxCodeSize;
return this;
......
......@@ -64,9 +64,9 @@ public class SelectPicture {
*/
public void showSelectType(Fragment fragment) {
//拍照或者選擇圖片
PermissionX.init(fragment).permissions(Manifest.permission.CAMERA)
.onExplainRequestReason((scope, deniedList) -> scope.showRequestReasonDialog(deniedList, "上傳圖片需要獲取拍照權限", "確定", "取消"))
.onForwardToSettings((scope, deniedList) -> scope.showForwardToSettingsDialog(deniedList, "您需要去設置當中開啟拍照權限", "確定", "取消"))
PermissionX.init(fragment).permissions(Manifest.permission.CAMERA, Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.READ_EXTERNAL_STORAGE)
.onExplainRequestReason((scope, deniedList) -> scope.showRequestReasonDialog(deniedList, "上傳圖片需要讀取文件權限", "確定", "取消"))
.onForwardToSettings((scope, deniedList) -> scope.showForwardToSettingsDialog(deniedList, "您需要去設置當中開啟讀取文件權限", "確定", "取消"))
.request((allGranted, grantedList, deniedList) -> showPictureChoice(fragment));
}
......@@ -77,9 +77,9 @@ public class SelectPicture {
*/
public void showSelectType(FragmentActivity activity) {
//拍照或者選擇圖片
PermissionX.init(activity).permissions(Manifest.permission.CAMERA)
.onExplainRequestReason((scope, deniedList) -> scope.showRequestReasonDialog(deniedList, "上傳圖片需要獲取拍照權限", "確定", "取消"))
.onForwardToSettings((scope, deniedList) -> scope.showForwardToSettingsDialog(deniedList, "您需要去設置當中開啟拍照權限", "確定", "取消"))
PermissionX.init(activity).permissions(Manifest.permission.CAMERA, Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.READ_EXTERNAL_STORAGE)
.onExplainRequestReason((scope, deniedList) -> scope.showRequestReasonDialog(deniedList, "上傳圖片需要讀取文件權限", "確定", "取消"))
.onForwardToSettings((scope, deniedList) -> scope.showForwardToSettingsDialog(deniedList, "您需要去設置當中開啟讀取文件權限", "確定", "取消"))
.request((allGranted, grantedList, deniedList) -> showPictureChoice(activity));
}
......
<?xml version="1.0" encoding="utf-8"?>
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tv_add_food"
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:paddingLeft="@dimen/dp_10"
android:paddingTop="@dimen/dp_5"
android:paddingRight="@dimen/dp_10"
android:paddingBottom="@dimen/dp_5"
android:text="+添加食材"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/supply_chain_textSize_16" />
android:layout_height="wrap_content">
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id="@+id/tv_add_food"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:paddingLeft="@dimen/dp_10"
android:paddingTop="@dimen/dp_5"
android:paddingRight="@dimen/dp_10"
android:paddingBottom="@dimen/dp_5"
android:text="+添加食材"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/supply_chain_textSize_16" />
<include
layout="@layout/include_horizontal_color_ccc_dividing_line"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_1"
android:layout_gravity="bottom" />
</FrameLayout>
......@@ -60,7 +60,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="種類:"
android:text="總數:"
android:textColor="@color/color_222"
android:textSize="@dimen/supply_chain_textSize_16" />
......@@ -102,9 +102,8 @@
android:layout_marginTop="@dimen/dp_2"
android:layout_marginRight="@dimen/dp_15"
android:textCursorDrawable="@drawable/cursor_theme"
android:text="勝多負少"
android:hint="@string/str_remark"
android:textColorHint="@color/theme_333_color"
android:textColorHint="@color/color_ccc"
android:textSize="@dimen/supply_chain_textSize_16" />
<LinearLayout
......
......@@ -32,15 +32,12 @@
android:orientation="horizontal">
<TextView
android:id="@+id/tv_food_item_no"
android:id="@+id/tv_food_item_name"
style="@style/Food_Ingredient_Info_TextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/dp_10"
android:ellipsize="end"
android:maxLines="1"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_12"
tools:text="SP001" />
android:textStyle="bold"
tools:text="巴西肥牛" />
<View
android:layout_width="0dp"
......@@ -57,14 +54,16 @@
android:textStyle="bold"
tools:text="海鮮天地" />
</LinearLayout>
<TextView
android:id="@+id/tv_food_item_name"
style="@style/Food_Ingredient_Info_TextStyle"
android:id="@+id/tv_food_item_no"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textStyle="bold"
tools:text="巴西肥牛" />
android:layout_marginRight="@dimen/dp_10"
android:ellipsize="end"
android:maxLines="1"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_12"
tools:text="SP001" />
<LinearLayout
android:layout_width="match_parent"
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_goods_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:gravity="center"
android:paddingTop="@dimen/dp_5"
android:paddingBottom="@dimen/dp_5"
android:text="食材名"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/supply_chain_textSize_16" />
<include layout="@layout/include_vertical_color_ccc_dividing_line" />
android:layout_height="wrap_content">
<include layout="@layout/include_horizontal_color_ccc_dividing_line" />
<LinearLayout
android:layout_width="0dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_goods_unit"
android:id="@+id/tv_goods_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_weight="3"
android:gravity="center"
android:paddingTop="@dimen/dp_5"
android:paddingBottom="@dimen/dp_5"
android:text="單位"
android:text="食材名"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/supply_chain_textSize_16" />
<ImageView
android:id="@+id/iv_switch_unit"
android:layout_width="@dimen/dp_10"
android:layout_height="@dimen/dp_6"
android:layout_gravity="center_vertical"
android:layout_marginRight="@dimen/dp_11"
android:src="@drawable/ic_inverted_triangle_66"
android:visibility="gone" />
</LinearLayout>
<include layout="@layout/include_vertical_color_ccc_dividing_line" />
<include layout="@layout/include_vertical_color_ccc_dividing_line" />
<TextView
android:id="@+id/tv_goods_quantity"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:paddingTop="@dimen/dp_5"
android:paddingBottom="@dimen/dp_5"
android:text="數量"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/supply_chain_textSize_16" />
<LinearLayout
android:id="@+id/layout_unit_switch"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal">
<include layout="@layout/include_vertical_color_ccc_dividing_line" />
<TextView
android:id="@+id/tv_goods_unit"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:paddingTop="@dimen/dp_5"
android:paddingBottom="@dimen/dp_5"
android:text="單位"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/supply_chain_textSize_16" />
<TextView
android:id="@+id/tv_edit"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:paddingTop="@dimen/dp_5"
android:paddingBottom="@dimen/dp_5"
android:text="編輯"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/supply_chain_textSize_16" />
<ImageView
android:id="@+id/iv_switch_unit"
android:layout_width="@dimen/dp_10"
android:layout_height="@dimen/dp_6"
android:layout_gravity="center_vertical"
android:layout_marginRight="@dimen/dp_11"
android:src="@drawable/ic_inverted_triangle_66"
android:visibility="gone" />
</LinearLayout>
<include layout="@layout/include_vertical_color_ccc_dividing_line" />
</LinearLayout>
\ No newline at end of file
<TextView
android:id="@+id/tv_goods_quantity"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:paddingTop="@dimen/dp_5"
android:paddingBottom="@dimen/dp_5"
android:text="數量"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/supply_chain_textSize_16" />
<include layout="@layout/include_vertical_color_ccc_dividing_line" />
<TextView
android:id="@+id/tv_edit"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:paddingTop="@dimen/dp_5"
android:paddingBottom="@dimen/dp_5"
android:text="編輯"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/supply_chain_textSize_16" />
</LinearLayout>
</FrameLayout>
......@@ -3,6 +3,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="@dimen/dp_20"
android:gravity="center">
<ImageView
......
......@@ -27,7 +27,6 @@
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_purchase_function_list_child_list"
android:layout_width="match_parent"
android:layout_marginTop="@dimen/dp_20"
android:layout_marginBottom="@dimen/dp_20"
android:layout_height="wrap_content" />
</LinearLayout>
......
......@@ -201,7 +201,7 @@ public class MoneyUtil {
return price.add(b2);
}
/**
* 計算
* 計算
*
* @param v1
* @param v2
......
......@@ -286,4 +286,5 @@
<string name="str_please_modify_current_category_name">请修改當前類別名稱</string>
<string name="str_data_info">出錯啦,請重新進入後再試</string>
<string name="str_look_over">查看</string>
<string name="str_warehousing">入庫</string>
</resources>
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