Commit 2a495b3e by Wyh

1、PRJ打印顯示不完全問題修改

2、供應鏈代碼
parent 90f41b1d
......@@ -28,7 +28,7 @@ class HistoryFragment : BaseFragment(R.layout.fragment_other_order) {
override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
viewModel = ViewModelProvider(activity!!.viewModelStore, InjectorUtil.getHistoryModelFactory())[HistoryOrderViewModel::class.java].apply {
viewModel = ViewModelProvider(requireActivity().viewModelStore, InjectorUtil.getHistoryModelFactory())[HistoryOrderViewModel::class.java].apply {
historyData.observe(viewLifecycleOwner, Observer{ it ->
cancelDialogForLoading()
refresh_layout.finishRefresh()
......
......@@ -18,7 +18,7 @@ import com.gingersoft.gsa.cloud.print.bean.PrjBean;
import com.joe.print.mvp.model.bean.HtmlLable;
import com.joe.print.mvp.print.common.HtmlContract;
import com.joe.print.R;
import com.joe.print.mvp.ui.adapter.KitChenPrjPrintFoodAdapter;
import com.joe.print.mvp.ui.view.KitChenPrjFoodView;
import java.util.ArrayList;
import java.util.HashMap;
......@@ -265,16 +265,18 @@ public class PrintPrjKitchen extends PrinterRoot {
TextView tvPeople = view.findViewById(R.id.tv_people);
TextView tvOperator = view.findViewById(R.id.tv_operator);
TextView tvCurrentPageIndex = view.findViewById(R.id.tv_prj_page_index);
RecyclerView rvFood = view.findViewById(R.id.rv_kitchen_food);
// RecyclerView rvFood = view.findViewById(R.id.rv_kitchen_food);
LinearLayout foodLayout = view.findViewById(R.id.layout_kitchen_food);
TextView tvTableNumber2 = view.findViewById(R.id.tv_kitchen_print_table_number2);
TextView tvFirstOrder = view.findViewById(R.id.tv_kitchen_print_first_order);
TextView tvPrintQuantity = view.findViewById(R.id.tv_kitchen_print_quantity);
LinearLayout layoutOpenTableTime = view.findViewById(R.id.layout_opening_table_time);
KitChenPrjPrintFoodAdapter foodAdapter = new KitChenPrjPrintFoodAdapter(data, printerDeviceBean);
rvFood.setLayoutManager(new LinearLayoutManager(context));
rvFood.setAdapter(foodAdapter);
foodLayout.addView(new KitChenPrjFoodView(context, data, printerDeviceBean));
// KitChenPrjPrintFoodAdapter foodAdapter = new KitChenPrjPrintFoodAdapter(data, printerDeviceBean);
// rvFood.setLayoutManager(new LinearLayoutManager(context));
// rvFood.setAdapter(foodAdapter);
//廚房位置
if (!TextUtil.isEmptyOrNullOrUndefined(key) && !key.equals("-1")) {
tvKitChenLocation.setText(key + "廚房");//.replace("*", "")
......
......@@ -52,12 +52,12 @@ public class KitChenPrjPrintFoodAdapter extends BaseQuickAdapter<PrjBean.DataBea
if (languageType.contains(".")) {
languageType = type.substring(0, type.indexOf("."));
}
if (languageType.equals("2")) {
if (languageType.equals(PrinterDeviceBean.LANGUAGE_TWO)) {
//語言二
if (TextUtil.isNotEmptyOrNullOrUndefined(item.getProductName2())) {
layout.addView(getOtherLanguageView(helper.getAdapterPosition(), item.getItemType(), item.getProductName2(), item.getNumber()));
}
} else if (languageType.equals("3")) {
} else if (languageType.equals(PrinterDeviceBean.LANGUAGE_THREE)) {
//語言三
if (TextUtil.isNotEmptyOrNullOrUndefined(item.getProductName3())) {
layout.addView(getOtherLanguageView(helper.getAdapterPosition(), item.getItemType(), item.getProductName3(), item.getNumber()));
......
package com.joe.print.mvp.ui.view;
import android.content.Context;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.Nullable;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.database.bean.PrinterDeviceBean;
import com.gingersoft.gsa.cloud.print.bean.PrjBean;
import com.joe.print.R;
import java.math.BigDecimal;
import java.util.List;
/**
* @author 宇航.
* User: admin
* Date: 2021/1/20
* Time: 14:45
* Use:
*/
public class KitChenPrjFoodView extends LinearLayout {
private int indentation = 0;
private int foodFontSize = 24;
private int modifierFontSize = 24;
private int foodIsBold;
private int modifierIsBold;
private int foodIsItalic;
private int modifierIsItalic;
private String[] languageTypes;
private List<PrjBean.DataBean.Bean> data;
public KitChenPrjFoodView(Context context, @Nullable List<PrjBean.DataBean.Bean> data, PrinterDeviceBean printerDeviceBean) {
super(context);
try {
this.foodFontSize = Integer.parseInt(printerDeviceBean.getFoodFont()) * 2;
this.modifierFontSize = Integer.parseInt(printerDeviceBean.getModifierFont()) * 2;
} catch (NumberFormatException e) {
e.printStackTrace();
}
this.foodIsBold = printerDeviceBean.getFoodIsBold();
this.modifierIsBold = printerDeviceBean.getModifierIsBold();
this.foodIsItalic = printerDeviceBean.getFoodIsItalic();
this.modifierIsItalic = printerDeviceBean.getModifierIsItalic();
this.data = data;
languageTypes = printerDeviceBean.getLanguageType().split(",");
init();
}
private void init() {
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);
for (String type : languageTypes) {
String languageType = type;
if (languageType.contains(".")) {
languageType = type.substring(0, type.indexOf("."));
}
if (languageType.equals(PrinterDeviceBean.LANGUAGE_TWO)) {
//語言二
if (TextUtil.isNotEmptyOrNullOrUndefined(item.getProductName2())) {
layout.addView(getOtherLanguageView(item.getItemType(), item.getProductName2(), item.getNumber()));
}
} else if (languageType.equals(PrinterDeviceBean.LANGUAGE_THREE)) {
//語言三
if (TextUtil.isNotEmptyOrNullOrUndefined(item.getProductName3())) {
layout.addView(getOtherLanguageView(item.getItemType(), item.getProductName3(), item.getNumber()));
}
} else {
//語言一或其他
if (TextUtil.isNotEmptyOrNullOrUndefined(item.getProductName())) {
layout.addView(getOtherLanguageView(item.getItemType(), item.getProductName(), item.getNumber()));
}
}
}
}
}
private View getOtherLanguageView(int itemType, String foodName, int foodNumber) {
View view = View.inflate(getContext(), R.layout.print_kitchen_item_food, null);
TextView tvFoodName = view.findViewById(R.id.tv_food_name);
TextView tvFoodNum = view.findViewById(R.id.tv_food_number);
if (indentation == 0) {
//只第一次測量一下
indentation = BigDecimal.valueOf(tvFoodName.getPaint().measureText("哈")).setScale(0, BigDecimal.ROUND_HALF_UP).intValue();
}
boolean isBold, isItalic;
int paddingLeft;
if (itemType == PrjBean.DataBean.Bean.FOOD_SECONDARY) {
//細項,縮進
paddingLeft = indentation;
tvFoodName.setTextSize(modifierFontSize);
tvFoodNum.setTextSize(modifierFontSize);
isBold = modifierIsBold == 1;
isItalic = modifierIsItalic == 1;
} else if (itemType == PrjBean.DataBean.Bean.FOOD_THREE_LEVEL) {
//細項,縮進
paddingLeft = indentation * 2;
tvFoodName.setTextSize(modifierFontSize);
tvFoodNum.setTextSize(modifierFontSize);
isBold = modifierIsBold == 1;
isItalic = modifierIsItalic == 1;
} else {
paddingLeft = 0;
tvFoodName.setTextSize(foodFontSize);
tvFoodNum.setTextSize(foodFontSize);
isBold = foodIsBold == 1;
isItalic = foodIsItalic == 1;
}
tvFoodName.setPadding(paddingLeft, tvFoodName.getPaddingTop(), tvFoodName.getPaddingRight(), tvFoodName.getPaddingBottom());
tvFoodNum.setText(String.valueOf(foodNumber));
tvFoodName.setText(foodName);
if (isBold && isItalic) {
tvFoodName.setTypeface(null, Typeface.BOLD_ITALIC);
tvFoodNum.setTypeface(null, Typeface.BOLD_ITALIC);
} else if (isBold) {
tvFoodName.setTypeface(null, Typeface.BOLD);
tvFoodNum.setTypeface(null, Typeface.BOLD);
} else if (isItalic) {
tvFoodName.setTypeface(null, Typeface.ITALIC);
tvFoodNum.setTypeface(null, Typeface.ITALIC);
} else {
tvFoodName.setTypeface(null, Typeface.NORMAL);
tvFoodNum.setTypeface(null, Typeface.NORMAL);
}
return view;
}
}
......@@ -17,6 +17,7 @@ import lombok.Data;
@Data
public class PurchaseFoodBean implements Serializable {
private static final long serialVersionUID = 7084280906070243339L;
public static final String CATEGORY_DIVIDER = "-";
private int id;
private String supplierName;
private String images;
......@@ -25,7 +26,7 @@ public class PurchaseFoodBean implements Serializable {
/**
* 單價
*/
private double unitPrice;
private Double unitPrice;
/**
* 分類名
*/
......
package com.gingersoft.supply_chain.mvp.bean;
import com.gingersoft.supply_chain.R;
import java.util.List;
import lombok.Data;
......@@ -42,6 +44,7 @@ public class PurchaseOrderDetailsBean {
public static final int ALL = 0;
private static String[] states = new String[]{"", "待收貨", "部分收貨", "已完成", "拒收"};
private static int[] colors = new int[]{R.color.color_3c, R.color.order_state0_color, R.color.order_state5_color, R.color.brick_red, R.color.red};
public static String getStringByOrderState(int state) {
if (state < 0 || state > states.length) {
......@@ -50,10 +53,28 @@ public class PurchaseOrderDetailsBean {
return states[state];
}
public static int getColorByOrderState(int state) {
if (state < 0 || state > colors.length) {
return colors[0];
}
return colors[state];
}
/**
* 待收貨
*/
public static final int WAIT_RECEIVED = 1;
/**
* 部分收貨
*/
public static final int PART_RECEIVED = 2;
/**
* 全部收貨
*/
public static final int COMPLETE_RECEIVED = 3;
/**
* 拒收
*/
public static final int REFUSE_RECEIVED = 4;
private String supplierName;
......@@ -106,7 +127,7 @@ public class PurchaseOrderDetailsBean {
/**
* 未入庫時,後台傳來的副單位集合
*/
private List<DeputyUnitBean> foodUnits;
private List<DeputyUnitBean> foodUnits;
/**
* 入庫後,後台傳來的副單位數據
*/
......
......@@ -9,7 +9,7 @@ package com.gingersoft.supply_chain.mvp.bean;
*/
public class WareHousingUnitBean {
private int id;
private Integer id;
/**
* 入庫單詳情id
*/
......
......@@ -33,6 +33,8 @@ public interface SupplierListContract {
void deleteSuccess(int position);
void loadError();
void setSelectIndex(int index);
}
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
......
......@@ -107,8 +107,8 @@ public class FoodUnitPagePresenter extends BasePresenter<FoodUnitPageContract.Mo
deputyUnitBeans = CollectionUtils.deepCopy(afterDeputyUnits);
foodId = arguments.getInt(FoodUnitPageFragment.FOOD_ID_KEY);
isUpdate = arguments.getBoolean(FoodUnitPageFragment.UPDATE_UNIT_KEY);
mRootView.setMainUnit(basicUnitName);
if (isUpdate) {
mRootView.setMainUnit(basicUnitName);
mRootView.initTopBar("編輯商品單位");
} else {
mRootView.initTopBar("填寫商品單位");
......@@ -248,8 +248,16 @@ public class FoodUnitPagePresenter extends BasePresenter<FoodUnitPageContract.Mo
/**
* 添加基本單位-快捷輸入
* @param content 新增的基本單位
* @param basicUnitBeans 已有的基本單位——需要判斷是否已經存在了
*/
public void addBasicUnit(String content) {
public void addBasicUnit(String content, List<BasicUnitBean> basicUnitBeans) {
for (BasicUnitBean basicUnitBean : basicUnitBeans) {
if(basicUnitBean.getContent().equals(content)){
mRootView.showMessage("此單位已存在,不能重複添加");
return;
}
}
JSONObject jsonObject = new JSONObject();
try {
jsonObject.put("content", content);
......
......@@ -3,12 +3,14 @@ package com.gingersoft.supply_chain.mvp.presenter;
import android.app.Application;
import android.content.Context;
import android.text.InputFilter;
import android.text.InputType;
import android.view.inputmethod.EditorInfo;
import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager;
import com.gingersoft.gsa.cloud.common.utils.JsonUtils;
import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils;
import com.gingersoft.gsa.cloud.common.utils.inputFilter.DecimalDigitsInputFilter;
import com.gingersoft.gsa.cloud.common.utils.inputFilter.InputFilterUtils;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.common.utils.view.BitmapUtil;
......@@ -115,6 +117,10 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient
* 如果是修改食材,則不為空
*/
private PurchaseFoodBean purchaseFoodBean;
/**
* 分類名:一級,二級,三級
*/
private List<String> categoryNames;
@Inject
public NewFoodIngredientsPresenter(NewFoodIngredientsContract.Model model, NewFoodIngredientsContract.View rootView) {
......@@ -134,6 +140,10 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient
this.purchaseFoodBean = purchaseFoodBean;
}
public void setCategoryNames(List<String> categoryNames) {
this.categoryNames = categoryNames;
}
/**
* 獲取食材詳情
*/
......@@ -187,7 +197,7 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient
infoMultiBeans.add(new MultiSelectBean(InfoMultiBean.EDIT_FOOD_ITEM_SELECT, "基本單位", false, "請選擇食材單位", SELECT_PACKAGE_SPECIFICATION_REQUEST_CODE, FoodUnitPageFragment.class));
infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "包裝說明", false, "請輸入包裝說明"));
infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "食材編號", false, "請輸入食材編號"));
infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "單價($)", false, "請輸入數字,保留2位小數", "0"));
infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "單價($)", false, "請輸入單價,保留2位小數", new InputFilter[]{InputFilterUtils.getLengthFilter(context, 9), new DecimalDigitsInputFilter(context, 2)}, InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL));
infoMultiBeans.add(new InfoMultiBean(InfoMultiBean.ITEM_TYPE_LINE));
infoMultiBeans.add(new InfoMultiBean(InfoMultiBean.ITEM_TYPE_TITLE, "庫存預警"));
infoMultiBeans.add(new InfoMultiBean(InfoMultiBean.ITEM_MULTIPLE_BOOLEAN, "是否審核", false, "請輸入單位"));
......@@ -203,7 +213,11 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient
//食品名稱
infoMultiBeans.get(foodNameIndex).setShowValue(purchaseFoodBean.getName());
//食品分類
categoryName = purchaseFoodBean.getFoodCategoryName();
if (categoryNames != null && categoryNames.size() > 0) {
categoryName = categoryNames.get(categoryNames.size() - 1);
} else {
categoryName = purchaseFoodBean.getFoodCategoryName();
}
infoMultiBeans.get(foodIngredientCategoryIndex).setShowValue(purchaseFoodBean.getFoodCategoryName());
//基本單位
infoMultiBeans.get(basicUnitIndex).setShowValue(purchaseFoodBean.getBasicUnitName());
......@@ -212,7 +226,9 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient
//食品編號
infoMultiBeans.get(foodNoIndex).setShowValue(purchaseFoodBean.getFoodNo());
//單價
infoMultiBeans.get(foodIngredientPriceIndex).setShowValue(purchaseFoodBean.getUnitPrice() + "");
if (purchaseFoodBean.getUnitPrice() != null) {
infoMultiBeans.get(foodIngredientPriceIndex).setShowValue(purchaseFoodBean.getUnitPrice() + "");
}
//預警
PurchaseFoodBean.InventoryAlarm inventoryAlarm = purchaseFoodBean.getInventoryAlarm();
if (inventoryAlarm != null) {
......@@ -282,12 +298,18 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient
public void setCategoryInfo(List<SectionCheckItem> sectionCheckItems, List<InfoMultiBean> infoMultiBeans) {
StringBuilder categoryName = new StringBuilder();
if(categoryNames == null){
categoryNames = new ArrayList<>();
}
categoryNames.clear();
for (SectionCheckItem sectionCheckItem : sectionCheckItems) {
categoryNames.add(sectionCheckItem.getText());
categoryName.append(sectionCheckItem.getText())
.append("-");
.append(PurchaseFoodBean.CATEGORY_DIVIDER);
}
this.categoryName = sectionCheckItems.get(sectionCheckItems.size() - 1).getText();
categoryName.deleteCharAt(categoryName.lastIndexOf("-"));
categoryName.deleteCharAt(categoryName.lastIndexOf(PurchaseFoodBean.CATEGORY_DIVIDER));
infoMultiBeans.get(foodIngredientCategoryIndex).setShowValue(categoryName.toString());
mRootView.refreshAdapterByPosition(foodIngredientCategoryIndex);
}
......@@ -415,7 +437,12 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient
//食材編號
purchaseFoodBean.setFoodNo(infoMultiBeans.get(foodNoIndex).getShowValue());
//單價
purchaseFoodBean.setUnitPrice(Double.parseDouble(infoMultiBeans.get(foodIngredientPriceIndex).getShowValue()));
String unitPriceStr = infoMultiBeans.get(foodIngredientPriceIndex).getShowValue();
if (TextUtil.isNotEmptyOrNullOrUndefined(unitPriceStr)) {
purchaseFoodBean.setUnitPrice(Double.parseDouble(unitPriceStr));
} else {
purchaseFoodBean.setUnitPrice(0d);
}
//庫存預警
//是否修改了庫存預警,如果沒修過,就不傳遞給後台
boolean isUpdateAlarm = false;
......
......@@ -15,6 +15,7 @@ import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.ui.adapter.bean.InfoMultiBean;
import com.gingersoft.gsa.cloud.ui.adapter.bean.MultiCheckInputBean;
import com.gingersoft.gsa.cloud.ui.adapter.bean.MultiInputBean;
import com.gingersoft.gsa.cloud.ui.adapter.bean.MultiSelectBean;
import com.gingersoft.gsa.cloud.ui.adapter.multi.InfoMultiAdapter;
import com.gingersoft.gsa.cloud.ui.adapter.multi.RemarkProvider;
import com.gingersoft.supply_chain.R;
......@@ -199,7 +200,7 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode
}
//供應商聯繫方式不是在這個接口修改,就不傳到後台去了
supplierInfoBean.setSupplierContacts(null);
//修改供應商聯繫方式
//修改供應商聯繫方式單獨在這個接口
updateSupplierContact();
if (supplierName.equals(supplierInfoBean.getSupplierName())) {
supplierInfoBean.setSupplierName(null);
......@@ -309,7 +310,7 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode
if (supplierContacts != null) {
//如果這個供應商之前有聯繫方式,則需要拿現在的聯繫方式和之前的進行對比,哪些有修改
Iterator<SupplierInfoBean.SupplierContacts> iterator = contacts.iterator();
while (iterator.hasNext()){
while (iterator.hasNext()) {
boolean afterHasThisContact = false;
SupplierInfoBean.SupplierContacts nextContact = iterator.next();
for (SupplierInfoBean.SupplierContacts supplierContact : supplierContacts) {
......@@ -319,9 +320,11 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode
break;
}
}
if (!afterHasThisContact && TextUtil.isEmptyOrNullOrUndefined(nextContact.getConfigText())) {
//之前沒有這個聯繫方式,如果這個聯繫方式是空的,就移除掉
iterator.remove();
if (!afterHasThisContact) {
if (!nextContact.isDefault() && TextUtil.isEmptyOrNullOrUndefined(nextContact.getConfigText())) {
//之前沒有這個聯繫方式,並且不是默認的,如果這個聯繫方式是空的,就移除掉
iterator.remove();
}
}
}
} else {
......@@ -444,11 +447,16 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode
}
private void deleteNullContact(List<SupplierInfoBean.SupplierContacts> contacts) {
Iterator<SupplierInfoBean.SupplierContacts> iterator = contacts.iterator();
while (iterator.hasNext()){
if (TextUtil.isEmptyOrNullOrUndefined(iterator.next().getConfigText())) {
//如果聯繫方式的內容是空的,則需要去掉
iterator.remove();
if (contacts != null) {
Iterator<SupplierInfoBean.SupplierContacts> iterator = contacts.iterator();
while (iterator.hasNext()) {
SupplierInfoBean.SupplierContacts nextContact = iterator.next();
if (!nextContact.isDefault()) {
if (TextUtil.isEmptyOrNullOrUndefined(nextContact.getConfigText())) {
//如果聯繫方式的內容是空的,則需要去掉
iterator.remove();
}
}
}
}
}
......@@ -472,14 +480,36 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode
contacts.add(new SupplierInfoBean.SupplierContacts(email, Email, multiCheckInputBean.isDefault()));
}
} else {
contacts.add(new SupplierInfoBean.SupplierContacts(email, Email, multiCheckInputBean.isDefault()));
if (multiCheckInputBean.isDefault()) {
mRootView.showMessage("請輸入郵箱地址");
return null;
} else {
contacts.add(new SupplierInfoBean.SupplierContacts(email, Email, multiCheckInputBean.isDefault()));
}
}
}
addContacts(contacts, data, WhatsAppIndex, Whatsapp);
addContacts(contacts, data, weChatIndex, WeChat);
addContacts(contacts, data, lineIndex, Line);
addContacts(contacts, data, kakaoIndex, Kakao_Talk);
addContacts(contacts, data, smsIndex, SMS);
InfoMultiBean smsInfoMultiBean = data.get(smsIndex);
if (smsInfoMultiBean instanceof MultiCheckInputBean) {
MultiCheckInputBean smsMultiCheckBean = (MultiCheckInputBean) smsInfoMultiBean;
if (smsMultiCheckBean.isDefault()) {
//如果設置sms是默認聯繫方式,那麼需要判斷是否輸入了內容
if (TextUtil.isNotEmptyOrNullOrUndefined(smsMultiCheckBean.getShowValue())) {
addContacts(contacts, data, smsIndex, SMS);
} else {
mRootView.showMessage("請輸入sms");
return null;
}
} else {
addContacts(contacts, data, smsIndex, SMS);
}
} else {
addContacts(contacts, data, smsIndex, SMS);
}
if (supplierBean != null) {
for (SupplierInfoBean.SupplierContacts contact : contacts) {
contact.setSupplierId(supplierBean.getId());
......
......@@ -117,12 +117,21 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
//遍歷訂單商品
for (PurchaseOrderDetailsBean.PurchaseOrderDetailsInfoVosBean purchaseOrderDetailsInfoVO : purchaseOrderDetailsInfoVos) {
purchaseOrderDetailsInfoVO.setOrderNo(orderDetailsBean.getOrderNo());
List<DeputyUnitBean> deputyUnitBeans = new ArrayList<>();
deputyUnitBeans.add(new DeputyUnitBean("單價(HKD)", purchaseOrderDetailsInfoVO.getFoodPrice()));
deputyUnitBeans.add(new DeputyUnitBean(purchaseOrderDetailsInfoVO.getBasicUnitName(), purchaseOrderDetailsInfoVO.getFoodQuantity()));
//入庫金額和總金額
purchaseOrderDetailsInfoVO.setWarehousingAmount(MoneyUtil.priceCalculation(purchaseOrderDetailsInfoVO.getFoodPrice(), purchaseOrderDetailsInfoVO.getFoodQuantity()));
double warehousingAmount = 0;
if (purchaseOrderDetailsInfoVO.getStatus() == PurchaseOrderDetailsBean.WAIT_RECEIVED) {
//只要是待收貨的商品,都需要添加單價、主單位到副單位列表
deputyUnitBeans.add(new DeputyUnitBean("單價(HKD)", purchaseOrderDetailsInfoVO.getFoodPrice()));
if (TextUtil.isNotEmptyOrNullOrUndefined(purchaseOrderDetailsInfoVO.getBasicUnitName())) {
deputyUnitBeans.add(new DeputyUnitBean(purchaseOrderDetailsInfoVO.getBasicUnitName(), purchaseOrderDetailsInfoVO.getFoodQuantity()));
}
warehousingAmount = MoneyUtil.priceCalculation(purchaseOrderDetailsInfoVO.getFoodPrice(), purchaseOrderDetailsInfoVO.getFoodQuantity());
} else {
//如果不是待收貨的商品,入庫金額和總金額由副單位第一個值和第二個值相乘
//UI要改,先不管
}
purchaseOrderDetailsInfoVO.setWarehousingAmount(warehousingAmount);
purchaseOrderDetailsInfoVO.setTotalAmount(MoneyUtil.priceCalculation(purchaseOrderDetailsInfoVO.getFoodPrice(), purchaseOrderDetailsInfoVO.getFoodQuantity()));
if (purchaseOrderDetailsInfoVO.getFoodUnits() != null) {
......@@ -228,9 +237,12 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
purchaseWarehousingOrderDetail.setBasicUnitValue(deputyUnitBeans.get(1).getDeputyValue());
//統計副單位
List<WareHousingUnitBean> wareHousingUnitBeans = new ArrayList<>();
for (int i = 2; i < deputyUnitBeans.size(); i++) {
for (int i = 0; i < deputyUnitBeans.size(); i++) {
DeputyUnitBean deputyUnitBean = deputyUnitBeans.get(i);
WareHousingUnitBean wareHousingUnitBean = new WareHousingUnitBean(purchaseOrderDetailsInfoVosBean.getId(), deputyUnitBean.getDeputyUnit(), deputyUnitBean.getDeputyValue(), deputyUnitBean.getConversionMultiple());
if (deputyUnitBean.getId() != null) {
wareHousingUnitBean.setId(deputyUnitBean.getId());
}
wareHousingUnitBean.setBrandId(RestaurantInfoManager.newInstance().getBrandId());
wareHousingUnitBean.setRestaurantId(RestaurantInfoManager.newInstance().getRestaurantId());
wareHousingUnitBeans.add(wareHousingUnitBean);
......
......@@ -6,6 +6,7 @@ import com.gingersoft.gsa.cloud.common.bean.BaseResult;
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.OrderBean;
import com.gingersoft.supply_chain.mvp.bean.PurchaseOrderDetailsBean;
import com.gingersoft.supply_chain.mvp.bean.PurchaseOrderResultBean;
import com.gingersoft.supply_chain.mvp.content.Constant;
import com.gingersoft.supply_chain.mvp.contract.PurchaseListContract;
......@@ -30,6 +31,7 @@ import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber;
import okhttp3.MediaType;
import okhttp3.RequestBody;
import static com.gingersoft.supply_chain.mvp.bean.PurchaseOrderDetailsBean.WAIT_RECEIVED;
import static com.gingersoft.supply_chain.mvp.content.Constant.PAGE_SIZE;
......@@ -73,7 +75,15 @@ public class PurchaseListPresenter extends BasePresenter<PurchaseListContract.Mo
map.put("orderNo", orderNo);
}
if (orderStatus != 0) {
map.put("status", orderStatus);
if (orderStatus == PurchaseOrderDetailsBean.WAIT_RECEIVED) {
//如果是查未完成訂單,需要傳入兩個狀態,未收貨和部分收貨
List<Integer> list = new ArrayList<>();
list.add(PurchaseOrderDetailsBean.WAIT_RECEIVED);
list.add(PurchaseOrderDetailsBean.PART_RECEIVED);
map.put("status", "1,2");
} else {
map.put("status", orderStatus);
}
}
map.put("pageIndex", pageIndex * PAGE_SIZE);
mModel.getOrderList(map)
......
......@@ -15,6 +15,8 @@ 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 com.xuexiang.rxutil2.rxjava.RxJavaUtils;
import com.xuexiang.rxutil2.rxjava.task.RxAsyncTask;
import java.util.ArrayList;
import java.util.HashMap;
......@@ -56,6 +58,7 @@ public class SupplierListPresenter extends BasePresenter<SupplierListContract.Mo
AppManager mAppManager;
private List<SupplierInfoBean> supplierBeanList;
private String supplierName;
@Inject
public SupplierListPresenter(SupplierListContract.Model model, SupplierListContract.View rootView) {
......@@ -71,7 +74,18 @@ public class SupplierListPresenter extends BasePresenter<SupplierListContract.Mo
this.mApplication = null;
}
public void getSupplierList(String content, int pageIndex) {
public void setSupplierName(String supplierName) {
this.supplierName = supplierName;
}
/**
* 獲取供應商列表
*
* @param content 用於搜索的內容
* @param pageIndex 頁數
* @param needGetIndex 是否需要遍歷來獲取默認選中的供應商
*/
public void getSupplierList(String content, int pageIndex, boolean needGetIndex) {
Map<String, Object> map = new HashMap<>(5);
map.put("pageSize", Constant.PAGE_SIZE);
map.put("pageIndex", pageIndex * Constant.PAGE_SIZE);
......@@ -104,6 +118,34 @@ public class SupplierListPresenter extends BasePresenter<SupplierListContract.Mo
supplierBeanList.addAll(list);
}
mRootView.loadSupplierList(supplierBeanList);
if (info.getData() != null) {
if (needGetIndex && TextUtil.isNotEmptyOrNullOrUndefined(supplierName)) {
//當前頁面用於選擇,並且供應商名稱不為空,遍歷獲取默認選中的供應商
RxJavaUtils.executeAsyncTask(new RxAsyncTask<Object, Integer>(1) {
@Override
public void doInUIThread(Integer o) {
if(o != null){
mRootView.setSelectIndex(o);
}
}
@Override
public Integer doInIOThread(Object o) {
List<SupplierInfoBean> list = info.getData().getList();
if (list != null) {
int size = list.size();
for (int i = 0; i < size; i++) {
if (list.get(i).getSupplierName().equals(supplierName)) {
return supplierBeanList.size() - list.size() + i;
}
}
}
return null;
}
});
}
}
} else if (TextUtil.isNotEmptyOrNullOrUndefined(info.getErrMsg())) {
mRootView.showMessage(info.getErrMsg());
} else {
......
......@@ -32,6 +32,7 @@ public class OrderCategoryAdapter extends BaseQuickAdapter<OrderCategoryBean.Foo
public static final int PRIMARY_CATEGORY = 1;
public static final int SECOND_CATEGORY = 2;
public static final int THIRD_CATEGORY = 3;
/**
* 當前顯示的是幾級分類
*/
......
package com.gingersoft.supply_chain.mvp.ui.adapter;
import androidx.core.content.ContextCompat;
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.time.TimeUtils;
import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.mvp.bean.NewPurchaseOrderBean;
......@@ -25,7 +28,7 @@ public class PurchaseOrderAdapter extends BaseQuickAdapter<OrderBean, BaseViewHo
public PurchaseOrderAdapter(@Nullable List<OrderBean> data) {
super(R.layout.item_purchase_order, data);
addChildClickViewIds(R.id.btn_purchase_send, R.id.btn_purchase_buy_again, R.id.btn_receiver_goods);
addChildClickViewIds(R.id.iv_purchase_order_more, R.id.btn_purchase_send, R.id.btn_purchase_buy_again, R.id.btn_receiver_goods);
}
@Override
......@@ -35,8 +38,8 @@ public class PurchaseOrderAdapter extends BaseQuickAdapter<OrderBean, BaseViewHo
viewHolder.setText(R.id.tv_purchase_order_create_time, TimeUtils.getTime(purchaseOrderBean.getCreateTime(), TimeUtils.DEFAULT_DATE_FORMAT_YMDHM));
viewHolder.setText(R.id.tv_purchase_order_goods_num, purchaseOrderBean.getPurchaseFoodCount() + "");
viewHolder.setText(R.id.tv_purchase_order_goods, purchaseOrderBean.getName());
viewHolder.setText(R.id.tv_purchase_order_total_price, purchaseOrderBean.getTotalAmount() + "");
viewHolder.setText(R.id.tv_purchase_order_total_price, String.format(getContext().getString(R.string.amount_string_s), MoneyUtil.formatDouble(purchaseOrderBean.getTotalAmount())));
viewHolder.setText(R.id.btn_receiver_goods, PurchaseOrderDetailsBean.getStringByOrderState(purchaseOrderBean.getStatus()));
viewHolder.setTextColor(R.id.btn_receiver_goods, ContextCompat.getColor(getContext(), PurchaseOrderDetailsBean.getColorByOrderState(purchaseOrderBean.getStatus())));
}
}
......@@ -8,8 +8,10 @@ import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.gingersoft.gsa.cloud.common.utils.time.TimeUtils;
import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.mvp.bean.SupplierInfoBean;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.List;
/**
......@@ -22,7 +24,7 @@ import java.util.List;
public class SupplierAdapter extends BaseQuickAdapter<SupplierInfoBean, BaseViewHolder> {
private boolean isSelect;
private int selectIndex = 0;
private int selectIndex = -1;
public SupplierAdapter(@Nullable List<SupplierInfoBean> data) {
this(data, false);
......@@ -44,7 +46,7 @@ public class SupplierAdapter extends BaseQuickAdapter<SupplierInfoBean, BaseView
viewHolder.setGone(R.id.rb_supplier, !isSelect);
viewHolder.setGone(R.id.iv_supplier_edit, isSelect);
viewHolder.setGone(R.id.iv_supplier_delete, isSelect);
if(isSelect) {
if (isSelect) {
RadioButton radioButton = viewHolder.getView(R.id.rb_supplier);
radioButton.setChecked(viewHolder.getAdapterPosition() == selectIndex);
radioButton.setOnCheckedChangeListener((buttonView, isChecked) -> {
......@@ -68,4 +70,14 @@ public class SupplierAdapter extends BaseQuickAdapter<SupplierInfoBean, BaseView
public int getSelectIndex() {
return selectIndex;
}
public void setSelectIndex(int selectIndex) {
if (this.selectIndex != -1) {
notifyItemChanged(this.selectIndex);
}
this.selectIndex = selectIndex;
if (selectIndex != -1) {
notifyItemChanged(selectIndex);
}
}
}
......@@ -100,7 +100,7 @@ public class FunctionListFragment extends BaseSupplyChainFragment<FunctionListPr
List<Function> data = functionChildAdapter.getData();
switch (data.get(position).getResName()) {
case "供應商":
start(SupplierListFragment.newInstance(false));
start(SupplierListFragment.newInstance(false, null));
break;
case "食材":
start(FoodIngredientsFragment.newInstance(FOOD_INGREDIENTS));
......
......@@ -31,6 +31,7 @@ import java.util.List;
import butterknife.BindView;
import butterknife.OnClick;
import static com.gingersoft.gsa.cloud.ui.adapter.BaseRadioSectionAdapter.SEPARATOR;
......@@ -57,12 +58,22 @@ public class CategorySelectFragment extends BaseSupplyChainFragment<CategorySele
* 選中的分類數據key
*/
public final static String SELECT_CATEGORY_DATA_KEY = "categoryKey";
private final static String CATEGORY_NAME_KEY = "categoryNameKey";
public static CategorySelectFragment newInstance() {
public static CategorySelectFragment newInstance(List<String> categoryNames) {
CategorySelectFragment fragment = new CategorySelectFragment();
if (categoryNames != null && categoryNames.size() > 0) {
Bundle bundle = new Bundle();
bundle.putSerializable(CATEGORY_NAME_KEY, (Serializable) categoryNames);
fragment.setArguments(bundle);
}
return fragment;
}
public static CategorySelectFragment newInstance() {
return newInstance(null);
}
@Override
public void setupFragmentComponent(@NonNull AppComponent appComponent) {
DaggerCategorySelectComponent //如找不到该类,请编译一下项目
......@@ -215,9 +226,9 @@ public class CategorySelectFragment extends BaseSupplyChainFragment<CategorySele
getTheDeepest(sections.get(Integer.parseInt(split[i])).getSectionCheckItems(), split, i + 1, isChecked);
}
} else if (sections != null) {
for (int j = 0; j < sections.size(); j++) {
}
// for (int j = 0; j < sections.size(); j++) {
//
// }
}
}
}
......@@ -164,7 +164,7 @@ public class FoodUnitPageFragment extends BaseSupplyChainFragment<FoodUnitPagePr
@Override
public void onConfirm(String text) {
if (TextUtil.isNotEmptyOrNullOrUndefined(text)) {
mPresenter.addBasicUnit(text);
mPresenter.addBasicUnit(text, basicUnitAdapter.getData());
}
}
});
......
......@@ -51,6 +51,7 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
......@@ -108,11 +109,11 @@ public class NewFoodIngredientsFragment extends BaseSupplyChainFragment<NewFoodI
return fragment;
}
public static NewFoodIngredientsFragment newInstance(String supplierName, String categoryName) {
public static NewFoodIngredientsFragment newInstance(String supplierName, List<String> categoryNames) {
NewFoodIngredientsFragment fragment = new NewFoodIngredientsFragment();
Bundle bundle = new Bundle();
bundle.putSerializable(SUPPLIER_NAME_KEY, supplierName);
bundle.putSerializable(CATEGORY_NAME_KEY, categoryName);
bundle.putString(SUPPLIER_NAME_KEY, supplierName);
bundle.putSerializable(CATEGORY_NAME_KEY, (Serializable) categoryNames);
fragment.setArguments(bundle);
return fragment;
}
......@@ -153,7 +154,19 @@ public class NewFoodIngredientsFragment extends BaseSupplyChainFragment<NewFoodI
isUpdate = false;
initTopBar(topbarNewFoodIngredients, "新增食材");
purchaseFoodBean = new PurchaseFoodBean();
purchaseFoodBean.setFoodCategoryName(arguments.getString(CATEGORY_NAME_KEY));
//拿到分類集合
List<String> categoryNames = (List<String>) arguments.getSerializable(CATEGORY_NAME_KEY);
if (categoryNames != null && categoryNames.size()>0) {
//分類不為空,設置分類信息
mPresenter.setCategoryNames(categoryNames);
StringBuilder category = new StringBuilder();
for (String categoryName : categoryNames) {
category.append(categoryName).append(PurchaseFoodBean.CATEGORY_DIVIDER);
}
category.deleteCharAt(category.lastIndexOf(PurchaseFoodBean.CATEGORY_DIVIDER));
purchaseFoodBean.setFoodCategoryName(category.toString());
}
//供應商名稱
purchaseFoodBean.setSupplierName(arguments.getString(SUPPLIER_NAME_KEY));
mPresenter.setPurchaseFoodBean(purchaseFoodBean);
initAdapter();
......@@ -177,10 +190,13 @@ public class NewFoodIngredientsFragment extends BaseSupplyChainFragment<NewFoodI
if (infoMultiBean instanceof MultiSelectBean) {
MultiSelectBean multiBean = (MultiSelectBean) infoMultiBean;
if (infoMultiBean.getFragment() == SupplierListFragment.class) {
startForResult(SupplierListFragment.newInstance(true), multiBean.getRequestCode());
//選擇供應商
startForResult(SupplierListFragment.newInstance(true, multiBean.getShowValue()), multiBean.getRequestCode());
} else if (infoMultiBean.getFragment() == CategorySelectFragment.class) {
//選擇分類
startForResult(CategorySelectFragment.newInstance(), multiBean.getRequestCode());
} else if (infoMultiBean.getFragment() == FoodUnitPageFragment.class) {
//食品單位
startForResult(FoodUnitPageFragment.newInstance(mPresenter.getBasicUnit(data), mPresenter.getDeputyUnitBeans(), isUpdate, mPresenter.getFoodId()), multiBean.getRequestCode());
}
}
......
......@@ -169,19 +169,21 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr
initRecyclerView(orderDetailsBean);
//全選按鈕狀態切換
cbOrderDetailsAllSelected.setOnCheckedChangeListener((buttonView, isChecked) -> {
//重新計算總價
totalAmount = 0;
typesOfFood = isChecked ? orderDetailsFoodAdapter.getData().size() : 0;
//修改所有食品的選中狀態
for (PurchaseOrderDetailsBean.PurchaseOrderDetailsInfoVosBean datum : orderDetailsFoodAdapter.getData()) {
datum.setChecked(isChecked);
if (isChecked) {
totalAmount = MoneyUtil.sum(totalAmount, datum.getWarehousingAmount());
if (buttonView.isPressed()) {
//重新計算總價
totalAmount = 0;
typesOfFood = isChecked ? orderDetailsFoodAdapter.getData().size() : 0;
//修改所有食品的選中狀態
for (PurchaseOrderDetailsBean.PurchaseOrderDetailsInfoVosBean datum : orderDetailsFoodAdapter.getData()) {
datum.setChecked(isChecked);
if (isChecked) {
totalAmount = MoneyUtil.sum(totalAmount, datum.getWarehousingAmount());
}
}
orderDetailsFoodAdapter.notifyDataSetChanged();
setTotalAmount();
setTypesOfFood();
}
orderDetailsFoodAdapter.notifyDataSetChanged();
setTotalAmount();
setTypesOfFood();
});
}
......
......@@ -31,12 +31,16 @@ import com.gingersoft.supply_chain.mvp.ui.adapter.PurchaseOrderAdapter;
import com.gingersoft.supply_chain.mvp.ui.adapter.PurchasePageAdapter;
import com.gingersoft.supply_chain.mvp.ui.fragment.BaseSupplyChainFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.food.FoodIngredientsFragment;
import com.gingersoft.supply_chain.mvp.ui.widget.PurchaseListMorePopup;
import com.gingersoft.supply_chain.mvp.ui.widget.ScreenView;
import com.jess.arms.di.component.AppComponent;
import com.kingja.loadsir.callback.Callback;
import com.kingja.loadsir.callback.SuccessCallback;
import com.kingja.loadsir.core.LoadService;
import com.kingja.loadsir.core.LoadSir;
import com.lxj.xpopup.XPopup;
import com.lxj.xpopup.enums.PopupPosition;
import com.lxj.xpopup.interfaces.OnSelectListener;
import com.qmuiteam.qmui.alpha.QMUIAlphaButton;
import com.qmuiteam.qmui.util.QMUIDisplayHelper;
import com.qmuiteam.qmui.widget.QMUITopBar;
......@@ -88,6 +92,9 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr
return fragment;
}
/**
* 待收貨,已完成
*/
private final int[] orderState = new int[]{PurchaseOrderDetailsBean.WAIT_RECEIVED, PurchaseOrderDetailsBean.COMPLETE_RECEIVED};
private int pageIndex = 0;
/**
......@@ -169,35 +176,34 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr
purchaseOrderAdapter.setOnItemClickListener((adapter, view, position) -> startForResult(OrderDetailsFragment.newInstance(purchaseOrderAdapter.getData().get(position).getId(), orderState[orderStateIndex]), REQUEST_ORDER_DETAILS_CODE));
purchaseOrderAdapter.setOnItemChildClickListener((adapter, view, position) -> {
int viewId = view.getId();
if (viewId == R.id.btn_purchase_send) {
//發送採購單
List<OrderBean> data = purchaseOrderAdapter.getData();
OrderBean orderBean = data.get(position);
ConfirmOrderBean.PurchaseOrder purchaseOrder = new ConfirmOrderBean.PurchaseOrder();
purchaseOrder.setId(orderBean.getId());
purchaseOrder.setSupplierId(orderBean.getSupplierId());
purchaseOrder.setSupplierName(orderBean.getSupplierName());
start(SendMsgFragment.newInstance(Collections.singletonList(purchaseOrder)));
if (viewId == R.id.iv_purchase_order_more) {
//更多:刪除。發送。再次購買
new XPopup.Builder(mContext)
.atView(view)
.hasShadowBg(false)
.popupPosition(PopupPosition.Left)
.asCustom(new PurchaseListMorePopup(mContext)
.setStringData(new String[]{"删除", "发送", "再次购买"}, new int[]{R.drawable.ic_purchase_delete, R.drawable.ic_purchase_send, R.drawable.ic_purchase_buy_again})
.setOnSelectListener((position1, text) -> {
if (position1 == 2) {
//發送
//發送採購單
sendPurchase(position);
}
}))
.show();
}
// if (viewId == R.id.iv_supplier_delete) {
// //刪除採購單
// AppDialog.getInstance().showWaringDialog(mContext, "是否刪除採購單?", (view1, dialog) -> {
// List<OrderBean> data = purchaseOrderAdapter.getData();
// mPresenter.deleteOrder(position, data.get(position));
// dialog.dismiss();
// });
// }
});
PurchasePageAdapter adapter = new PurchasePageAdapter(purchaseOrderAdapter, 2);
contentViewPager.setAdapter(adapter);
mTabSegment.setupWithViewPager(contentViewPager);
mTabSegment.setIndicator(new QMUITabIndicator(
QMUIDisplayHelper.dp2px(getContext(), 2), false, false));
//new QMUITabIndicator(
// QMUIDisplayHelper.dp2px(getContext(), 2), false, false)
QMUITabIndicator qmuiTabIndicator = new QMUITabIndicator(
ContextCompat.getDrawable(mContext, R.drawable.ic_open_close), false, false, ContextCompat.getColor(mContext, R.color.color_3c));
mTabSegment.setIndicator(qmuiTabIndicator);
mTabSegment.addTab(builder.setText("未完成").build(getContext()));
mTabSegment.addTab(builder.setText("已完成").build(getContext()));
// mTabSegment.addTab(builder.setText("部分收貨").build(getContext()));
// mTabSegment.addTab(builder.setText("全部收貨").build(getContext()));
mTabSegment.notifyDataChanged();
mTabSegment.setMode(QMUITabSegment.MODE_FIXED);
mTabSegment.addOnTabSelectedListener(new QMUIBasicTabSegment.OnTabSelectedListener() {
......@@ -224,11 +230,22 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr
});
}
@OnClick({R2.id.layout_purchase_list_screen, R2.id.iv_purchase_list_search})
private void sendPurchase(int position) {
List<OrderBean> data = purchaseOrderAdapter.getData();
OrderBean orderBean = data.get(position);
ConfirmOrderBean.PurchaseOrder purchaseOrder = new ConfirmOrderBean.PurchaseOrder();
purchaseOrder.setId(orderBean.getId());
purchaseOrder.setSupplierId(orderBean.getSupplierId());
purchaseOrder.setSupplierName(orderBean.getSupplierName());
start(SendMsgFragment.newInstance(Collections.singletonList(purchaseOrder)));
}
@OnClick({R2.id.iv_purchase_list_screen, R2.id.iv_purchase_list_search})
@Override
public void onClick(View v) {
int viewId = v.getId();
if (viewId == R.id.layout_purchase_list_screen) {
if (viewId == R.id.iv_purchase_list_screen) {
//篩選
screenView.setVisibility(screenView.getVisibility() == View.VISIBLE ? View.GONE : View.VISIBLE);
} else if (viewId == R.id.iv_purchase_list_search) {
......@@ -276,7 +293,7 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr
@Override
public void onFragmentResult(int requestCode, int resultCode, Bundle data) {
super.onFragmentResult(requestCode, resultCode, data);
if(requestCode == REQUEST_ORDER_DETAILS_CODE && resultCode == RESULT_OK){
if (requestCode == REQUEST_ORDER_DETAILS_CODE && resultCode == RESULT_OK) {
//用戶進行了收貨操作,需要對列表進行刷新
getOrderList();
}
......
......@@ -32,6 +32,8 @@ import com.kingja.loadsir.core.LoadSir;
import com.qmuiteam.qmui.alpha.QMUIAlphaTextView;
import com.qmuiteam.qmui.widget.QMUITopBar;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.xuexiang.rxutil2.rxjava.RxJavaUtils;
import com.xuexiang.rxutil2.rxjava.task.RxAsyncTask;
import org.jetbrains.annotations.NotNull;
......@@ -75,11 +77,13 @@ public class SupplierListFragment extends BaseSupplyChainFragment<SupplierListPr
*/
private boolean isSelect = false;
public static final String IS_SELECT_KEY = "selectSupplier";
private static final String SUPPLIER_NAME_KEY = "supplierNameKey";
public static SupplierListFragment newInstance(boolean isSelect) {
public static SupplierListFragment newInstance(boolean isSelect, String supplierName) {
SupplierListFragment fragment = new SupplierListFragment();
Bundle bundle = new Bundle();
bundle.putBoolean(IS_SELECT_KEY, isSelect);
bundle.putString(SUPPLIER_NAME_KEY, supplierName);
fragment.setArguments(bundle);
return fragment;
}
......@@ -106,6 +110,7 @@ public class SupplierListFragment extends BaseSupplyChainFragment<SupplierListPr
Bundle arguments = getArguments();
if (arguments != null) {
isSelect = arguments.getBoolean(IS_SELECT_KEY);
mPresenter.setSupplierName(arguments.getString(SUPPLIER_NAME_KEY));
}
btnConfirm.setVisibility(isSelect ? View.VISIBLE : View.GONE);
btnCancel.setVisibility(isSelect ? View.VISIBLE : View.GONE);
......@@ -140,7 +145,11 @@ public class SupplierListFragment extends BaseSupplyChainFragment<SupplierListPr
}
private void getSupplierList() {
mPresenter.getSupplierList(edSupplier.getText() + "", pageIndex);
if (supplierAdapter == null) {
mPresenter.getSupplierList(edSupplier.getText() + "", pageIndex, isSelect);
} else {
mPresenter.getSupplierList(edSupplier.getText() + "", pageIndex, isSelect && supplierAdapter.getSelectIndex() == -1);
}
}
private void initTopBar() {
......@@ -241,4 +250,11 @@ public class SupplierListFragment extends BaseSupplyChainFragment<SupplierListPr
public void loadError() {
loadService.showCallback(ErrorCallback.class);
}
@Override
public void setSelectIndex(int index) {
if (supplierAdapter != null) {
supplierAdapter.setSelectIndex(index);
}
}
}
package com.gingersoft.supply_chain.mvp.ui.widget;
import android.content.Context;
import androidx.annotation.NonNull;
import com.gingersoft.supply_chain.R;
import com.lxj.xpopup.impl.AttachListPopupView;
/**
* @author 宇航.
* User: admin
* Date: 2021/1/19
* Time: 16:06
* Use:
*/
public class PurchaseListMorePopup extends AttachListPopupView {
/**
* @param context
* @param bindLayoutId layoutId 要求layoutId中必须有一个id为recyclerView的RecyclerView
* @param bindItemLayoutId itemLayoutId 条目的布局id,要求布局中必须有id为iv_image的ImageView,和id为tv_text的TextView
*/
public PurchaseListMorePopup(@NonNull Context context) {
super(context, R.layout.pop_purchase_list_more, R.layout.pop_purchase_list_more_item);
}
@Override
protected void onCreate() {
super.onCreate();
findViewById(R.id.recyclerView);
}
}
......@@ -20,7 +20,8 @@
android:layout_width="match_parent"
android:layout_height="@dimen/dp_48"
android:layout_margin="@dimen/dp_10"
android:orientation="horizontal">
android:orientation="horizontal"
android:visibility="gone">
<LinearLayout
android:layout_width="0dp"
......@@ -29,14 +30,6 @@
android:background="@drawable/shape_white_eight_corners_bg"
android:orientation="horizontal">
<ImageView
android:id="@+id/iv_purchase_list_search"
android:layout_width="@dimen/dp_24"
android:layout_height="@dimen/dp_24"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/dp_10"
android:src="@drawable/ic_search" />
<EditText
android:id="@+id/ed_food_ingredients_search"
android:layout_width="match_parent"
......@@ -87,11 +80,38 @@
android:layout_height="match_parent"
android:visibility="gone" />
<com.qmuiteam.qmui.widget.tab.QMUITabSegment2
android:id="@+id/purchase_list_tabSegment"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/dp_42"
android:background="@color/white" />
android:background="@color/white"
android:orientation="horizontal">
<ImageView
android:id="@+id/iv_purchase_list_search"
android:layout_width="@dimen/dp_42"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:paddingLeft="@dimen/dp_6"
android:paddingRight="@dimen/dp_6"
android:src="@drawable/ic_search"
android:visibility="gone" />
<com.qmuiteam.qmui.widget.tab.QMUITabSegment2
android:id="@+id/purchase_list_tabSegment"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
<ImageView
android:id="@+id/iv_purchase_list_screen"
android:layout_width="@dimen/dp_42"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:paddingLeft="@dimen/dp_6"
android:paddingRight="@dimen/dp_6"
android:src="@drawable/ic_screen"
android:visibility="gone" />
</LinearLayout>
<FrameLayout
android:layout_width="match_parent"
......
......@@ -58,6 +58,7 @@
android:layout_weight="1"
android:ellipsize="end"
android:maxLines="1"
android:visibility="gone"
android:textSize="@dimen/dp_12"
tools:text="SP001" />
......@@ -67,7 +68,6 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:ellipsize="end"
android:gravity="right"
android:maxLines="2"
android:textColor="@color/black"
android:textSize="@dimen/dp_17"
......
......@@ -58,11 +58,10 @@
android:paddingLeft="@dimen/dp_5"
android:paddingRight="@dimen/dp_2"
android:paddingBottom="@dimen/dp_10"
android:singleLine="true"
android:textColor="@color/s_btn_blue_3c_text"
android:textSize="@dimen/dp_14"
android:textStyle="bold"
tools:text="果蔬類" />
tools:text="果蔬類阿斯蘭大家阿拉斯加的垃圾勞動局阿克蘇奧術大師大所多啊實打實大" />
<View
android:id="@+id/order_primary_category_line"
......
......@@ -15,7 +15,6 @@
android:layout_width="match_parent"
android:layout_height="@dimen/dp_40"
android:layout_marginLeft="@dimen/dp_8"
android:layout_marginRight="@dimen/dp_8"
android:gravity="center_vertical"
android:orientation="horizontal">
......@@ -35,13 +34,16 @@
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:textStyle="bold"
tools:text="收貨狀態" />
<ImageView
android:id="@+id/iv_purchase_order_more"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:padding="@dimen/dp_10"
android:paddingLeft="@dimen/dp_10"
android:paddingRight="@dimen/dp_5"
android:layout_marginRight="@dimen/dp_5"
android:src="@drawable/ic_more" />
</LinearLayout>
......
......@@ -22,10 +22,11 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_height="13dp"
android:text="供應商:"
android:textColor="@color/black"
android:textSize="@dimen/dp_17"
android:visibility="gone"
android:textStyle="bold" />
<TextView
......
<?xml version="1.0" encoding="utf-8"?>
<androidx.recyclerview.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:background="@drawable/shape_white_eight_corners_bg"
android:elevation="@dimen/dp_10" />
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingLeft="@dimen/dp_10"
android:paddingTop="@dimen/dp_10"
android:paddingRight="@dimen/dp_10"
android:paddingBottom="@dimen/dp_10">
<ImageView
android:id="@+id/iv_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/tv_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_15" />
</LinearLayout>
\ No newline at end of file
......@@ -96,6 +96,9 @@ public abstract class BaseActivity<P extends IPresenter> extends AppCompatActivi
if (QMUIDeviceHelper.isTablet(this)) {
//平板端按照系統方向來
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
} else {
//手機端直接強制竖屏
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
//DecorView的背景对我来说无用,但是会产生一次Overdraw,这里去掉(过度绘制优化)
getWindow().setBackgroundDrawable(null);
......
......@@ -104,7 +104,10 @@ public abstract class BaseFragmentActivity<P extends IPresenter> extends Fragmen
// .init();
mDelegate.onCreate(savedInstanceState);
mContext = this;
if (!QMUIDeviceHelper.isTablet(this)) {
if (QMUIDeviceHelper.isTablet(this)) {
//平板端按照系統方向來
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
} else {
//手機端直接強制竖屏
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
......
......@@ -7,7 +7,9 @@ import com.gingersoft.gsa.cloud.common.core.user.UserContext;
import com.gingersoft.gsa.cloud.common.oaId.DeviceID;
import com.gingersoft.gsa.cloud.common.utils.encryption.Aes;
import com.jess.arms.utils.DeviceUtils;
import java.io.IOException;
import okhttp3.Headers;
import okhttp3.Interceptor;
import okhttp3.Request;
......@@ -29,8 +31,11 @@ public class HeadersInterceptor implements Interceptor {
builder.set("appinfo", DeviceUtils.getVersionName(GsaCloudApplication.getAppContext()));
builder.set("mobileId", "1");
builder.set("uid", UserContext.newInstance().getMemberId() + "");
builder.set("deviceId", DeviceID.getDeviceId());
String deviceId = DeviceID.getDeviceId();
if (deviceId != null) {
builder.set("deviceId", DeviceID.getDeviceId());
}
Headers headers = originalRequest.headers();
for (int i = 0; i < headers.size(); i++) {
builder.set(headers.name(i), headers.value(i));
......
package com.gingersoft.gsa.cloud.common.utils.inputFilter;
import android.content.Context;
import android.text.InputFilter;
import android.text.Spanned;
import com.gingersoft.gsa.cloud.common.utils.toast.ToastUtils;
/**
* @author 宇航.
* User: admin
* Date: 2021/1/19
* Time: 18:29
* Use:
*/
public class DecimalDigitsInputFilter implements InputFilter {
/**
* 限制小数位数
*/
private final int decimalDigits;
private Context context;
public DecimalDigitsInputFilter(Context context, int decimalDigits) {
this.decimalDigits = decimalDigits;
this.context = context;
}
@Override
public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) {
int dotPos = -1;
int len = dest.length();
for (int i = 0; i < len; i++) {
char c = dest.charAt(i);
if (c == '.' || c == ',') {
dotPos = i;
break;
}
}
if (source.equals(".") && dstart == 0 && dend == 0) {
return "";
}
if (dotPos >= 0) {
// protects against many dots
if (source.equals(".") || source.equals(",")) {
return "";
}
// if the text is entered before the dot
if (dend <= dotPos) {
return null;
}
if (len - dotPos > decimalDigits) {
ToastUtils.show(context, "最多只能兩位小數");
return "";
}
}
return null;
}
}
......@@ -11,12 +11,12 @@
android:orientation="horizontal"
app:cardElevation="@dimen/dp_10">
<LinearLayout
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="@dimen/dp_10"
android:paddingBottom="@dimen/dp_10">
android:paddingTop="@dimen/dp_5"
android:paddingBottom="@dimen/dp_5">
<TextView
android:id="@+id/tv_category_name"
......@@ -24,22 +24,24 @@
android:layout_height="wrap_content"
android:button="@null"
android:ellipsize="marquee"
android:layout_toLeftOf="@id/iv_category_delete"
android:gravity="center_vertical"
android:paddingLeft="@dimen/dp_5"
android:paddingRight="@dimen/dp_2"
android:singleLine="true"
android:textColor="@color/s_btn_blue_3c_text"
android:textSize="@dimen/dp_14"
android:textStyle="bold"
tools:text="果蔬類" />
</LinearLayout>
tools:text="果蔬類看書福利卡駕駛的垃圾死了阿斯蘭大家啦款手機愛上了的框架拉三季度阿薩德科技拉屎" />
<com.qmuiteam.qmui.alpha.QMUIAlphaImageButton
android:id="@+id/iv_category_delete"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:paddingLeft="@dimen/dp_5"
android:paddingRight="@dimen/dp_5"
android:src="@drawable/ic_red_circular_delete" />
</RelativeLayout>
<com.qmuiteam.qmui.alpha.QMUIAlphaImageButton
android:id="@+id/iv_category_delete"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:paddingLeft="@dimen/dp_5"
android:paddingRight="@dimen/dp_5"
android:layout_gravity="right|center_vertical"
android:src="@drawable/ic_red_circular_delete" />
</androidx.cardview.widget.CardView>
\ No newline at end of file
......@@ -487,9 +487,11 @@
<color name="order_state2_color">#FF720A</color>
<!-- 待取餐背景色-->
<color name="order_state3_color">#00479D</color>
<!-- 供應鏈部分收貨字體顏色 -->
<color name="order_state5_color">#EF9A1B</color>
<!-- 待製作按鈕背景色-->
<color name="order_state4_color">#21AE37</color>
<!-- 在線支付背景色-->
<color name="cash_on_delivery_bg">#E1BF32</color>
<color name="online_payments_bg">#6EBF8D</color>
......
......@@ -84,6 +84,10 @@ public class PrinterDeviceBean implements Serializable {
private String languageType;
public final static String LANGUAGE_ONE = "1";
public final static String LANGUAGE_TWO = "2";
public final static String LANGUAGE_THREE = "3";
@Generated(hash = 626885316)
public PrinterDeviceBean() {
}
......
......@@ -79,6 +79,11 @@ public class PrjBean {
* 3:細項
*/
private int itemType;
public final static int FOOD_MAIN = 1;
public final static int FOOD_SECONDARY = 2;
public final static int FOOD_THREE_LEVEL = 3;
private String sender;
private String takeTime;
......
......@@ -2,7 +2,6 @@ package com.gingersoft.gsa.cloud.ui.adapter.bean;
import android.text.InputFilter;
import android.text.TextWatcher;
import lombok.Data;
import me.yokeyword.fragmentation.ISupportFragment;
......
......@@ -6,18 +6,17 @@ import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import androidx.core.content.ContextCompat;
import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.ui.R;
import com.gingersoft.gsa.cloud.ui.adapter.bean.InfoMultiBean;
import com.gingersoft.gsa.cloud.ui.adapter.bean.MultiInputBean;
import com.gingersoft.gsa.cloud.ui.adapter.bean.MultiSelectBean;
import com.google.android.material.textfield.TextInputEditText;
import com.qmuiteam.qmui.util.QMUIKeyboardHelper;
import com.xuexiang.rxutil2.rxjava.RxJavaUtils;
import org.jetbrains.annotations.NotNull;
import org.w3c.dom.Text;
/**
* @author 宇航.
......@@ -49,7 +48,7 @@ public class InputProvider<T extends InfoMultiBean> extends BaseItemProvider<T>
} else {
baseViewHolder.setText(R.id.tv_multi_title, "");
}
EditText editText = baseViewHolder.getView(R.id.ed_multi_value);
TextInputEditText editText = baseViewHolder.getView(R.id.ed_multi_value);
setFilters(editText, infoMultiBean);
initEditText(editText, infoMultiBean.getShowValue(), infoMultiBean.getHintText());
......@@ -79,25 +78,27 @@ public class InputProvider<T extends InfoMultiBean> extends BaseItemProvider<T>
editText.setOnFocusChangeListener((v, hasFocus) -> {
if (hasFocus) {
editText.addTextChangedListener(textWatcher);
baseViewHolder.setGone(R.id.iv_clear_multi_content, TextUtil.isEmptyOrNullOrUndefined(editText));
RxJavaUtils.delay(1, aLong -> baseViewHolder.setGone(R.id.iv_clear_multi_content, TextUtil.isEmptyOrNullOrUndefined(editText)));
} else {
editText.removeTextChangedListener(textWatcher);
baseViewHolder.setGone(R.id.iv_clear_multi_content, true);
RxJavaUtils.delay(1, aLong -> baseViewHolder.setGone(R.id.iv_clear_multi_content, true));
}
});
ImageView ivClear = baseViewHolder.getView(R.id.iv_clear_multi_content);
ivClear.setOnClickListener(v -> {
editText.setText("");
editText.requestFocus();
QMUIKeyboardHelper.showKeyboard(editText, false);
ivClear.setVisibility(View.GONE);
});
editText.setFocusable(infoMultiBean.isEdit());
if (infoMultiBean.isEdit()) {
editText.setTextColor(ContextCompat.getColor(context, R.color.color_3c));
} else {
editText.setTextColor(ContextCompat.getColor(context, R.color.color_c9));
}
// if (infoMultiBean.isEdit()) {
// editText.setTextColor(ContextCompat.getColor(context, R.color.color_3c));
// } else {
// editText.setTextColor(ContextCompat.getColor(context, R.color.color_c9));
// }
}
......
......@@ -98,11 +98,11 @@ public class MultiCheckProvider<T extends InfoMultiBean> extends BaseItemProvide
editText.addTextChangedListener(infoMultiBean.getTextWatcher());
editText.setFocusable(infoMultiBean.isEdit());
if(infoMultiBean.isEdit()){
editText.setTextColor(ContextCompat.getColor(context, R.color.color_3c));
} else {
editText.setTextColor(ContextCompat.getColor(context, R.color.color_c9));
}
// if(infoMultiBean.isEdit()){
// editText.setTextColor(ContextCompat.getColor(context, R.color.color_3c));
// } else {
// editText.setTextColor(ContextCompat.getColor(context, R.color.color_c9));
// }
}
private void setEditText(MultiCheckInputBean infoMultiBean, EditText editText) {
......
......@@ -89,10 +89,10 @@ public class SelectItemProvider<T extends InfoMultiBean> extends BaseItemProvide
edFirst.removeTextChangedListener(textWatcher);
}
});
edFirst.setTextColor(getColor(R.color.color_3c));
// edFirst.setTextColor(getColor(R.color.color_3c));
} else {
edFirst.setKeyListener(null);
edFirst.setTextColor(getColor(R.color.color_c9));
// edFirst.setTextColor(getColor(R.color.color_c9));
}
// edFirst.setFocusableInTouchMode(multiSelectBean.isEdit());
// edFirst.setFocusable(multiSelectBean.isEdit());
......
package com.gingersoft.gsa.cloud.ui.view;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.EditText;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
/**
* @author 宇航.
* User: admin
* Date: 2021/1/12
* Time: 16:57
* Use: 只能輸入兩位小數
* 小數位為0時只顯示整數位
*/
public class AmountEditText extends androidx.appcompat.widget.AppCompatEditText {
public AmountEditText(@NonNull Context context) {
super(context);
}
public AmountEditText(@NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
}
public AmountEditText(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
private void init(){
}
}
......@@ -8,13 +8,15 @@
<include layout="@layout/item_multi_title_layout" />
<EditText
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/ed_multi_value"
style="@style/Multi_Input_editStyle"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/dp_5"
android:layout_weight="1"
android:focusableInTouchMode="true"
android:focusable="true"
android:background="@null"
tools:hint="請輸入食品組名稱" />
......
......@@ -187,7 +187,16 @@
android:id="@+id/rv_kitchen_food"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10" />
android:layout_marginTop="@dimen/dp_10"
android:visibility="gone" />
<LinearLayout
android:id="@+id/layout_kitchen_food"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:orientation="vertical" />
<TextView
android:id="@+id/tv_kitchen_print_table_number2"
......
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