Commit 96d00b33 by 张建升

可以切换主单位 再来一单 预计发货时间修复

parent 50e28194
package com.gingersoft.supply_chain.mvp.bean;
import com.gingersoft.gsa.cloud.common.utils.time.TimeUtils;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.supply_chain.R;
import java.io.Serializable;
......@@ -70,11 +70,11 @@ public class SupplierInfoBean implements Serializable {
supplierInfoBean.setMinimumAmount(purchaseFoodBean.getMinimumAmount());
supplierInfoBean.setAddress(purchaseFoodBean.getAddress());
supplierInfoBean.setId(purchaseFoodBean.getSupplierId());
// supplierInfoBean.setDeliveryTime(purchaseFoodBean.getDeliveryTime());
// TODO: 2021/8/5
Float deliveryTime = Float.parseFloat(purchaseFoodBean.getDeliveryTime());
int deliveryMinute= (int) (deliveryTime*60);
supplierInfoBean.setDeliveryTime(TimeUtils.getCurrentDateByOffset(deliveryMinute));
if (TextUtil.isEmptyOrNullOrUndefined(purchaseFoodBean.getDeliveryTime())) {
supplierInfoBean.setDeliveryTime(0);
}else {
supplierInfoBean.setDeliveryTime(Float.parseFloat(purchaseFoodBean.getDeliveryTime()));
}
return supplierInfoBean;
}
......
......@@ -315,6 +315,7 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
if (baseResult.isSuccess()) {
List<PurchaseFoodBean> purchaseFoodBeans = GsonUtils.jsonToList(baseResult.getData(), PurchaseFoodBean.class);
for (PurchaseFoodBean purchaseFoodBean : purchaseFoodBeans) {
// LogUtil.e("zjs purchaseFoodBean=="+purchaseFoodBean.toString());
for (PurchaseOrderDetailsBean.PurchaseOrderDetailsInfoVosBean item : data) {
if (purchaseFoodBean.getId() == item.getPurchaseFoodId()) {
purchaseFoodBean.setFoodQuantity(item.getFoodQuantity());
......
......@@ -116,27 +116,37 @@ public class DishesFragment extends BaseSupplyChainFragment<DishesPresenter> imp
} else if (id == R.id.tv_dishes_unit) {
List<DeputyUnitBean> foodUnits= detailBean.getFoodUnits();
if (CollectionUtils.isNotNullOrEmpty(foodUnits)) {
int len=foodUnits.size();
List<String> units = new ArrayList<>();
for (int i = 0; i < foodUnits.size(); i++) {
for (int i = 0; i < len ; i++) {
String name=foodUnits.get(i).getDeputyUnit();
units.add(name);
}
units.add(detailBean.getFoodBasicUnit());
if (units.size() > 0) {
ChooseUnitPopup popup = new ChooseUnitPopup(requireContext()).setStringData(units).setOnSelectListener((pos, text) -> {
//將用戶之前輸入的值,修改到新選擇的單位匯中
String mainUnit= detailBean.getFoodBasicUnit();
DeputyUnitBean deputyUnitBean = foodUnits.get(pos);
String selectUnitName=deputyUnitBean.getDeputyUnit();
if (!mainUnit.equals(selectUnitName)) {//选中的不是主单位那么需要切换倍率
detailBean.setBasicUnitName(selectUnitName);
detailBean.setConversionMultiple(deputyUnitBean.getConversionMultiple());
dishDetailAdapter.notifyItemChanged(position);
}else {
// LogUtil.e("ZJS pos="+pos+" len"+len+" mainUnit="+mainUnit);
if (pos >= len ) {
detailBean.setBasicUnitName(mainUnit);
detailBean.setConversionMultiple(1.0);
dishDetailAdapter.notifyItemChanged(position);
}else {
DeputyUnitBean deputyUnitBean = foodUnits.get(pos);
String selectUnitName=deputyUnitBean.getDeputyUnit();
if (!mainUnit.equals(selectUnitName)) {//选中的不是主单位那么需要切换倍率
detailBean.setBasicUnitName(selectUnitName);
detailBean.setConversionMultiple(deputyUnitBean.getConversionMultiple());
dishDetailAdapter.notifyItemChanged(position);
}else {
detailBean.setBasicUnitName(mainUnit);
detailBean.setConversionMultiple(1.0);
dishDetailAdapter.notifyItemChanged(position);
}
}
});
new XPopup.Builder(getContext())
.hasShadowBg(false)
......@@ -298,8 +308,8 @@ public class DishesFragment extends BaseSupplyChainFragment<DishesPresenter> imp
}else { //全新 conversionMultiple 一定是1
for (int i = 0; i < len; i++) {
PurchaseFoodBean newBean= purchaseFood.get(i);
// LogUtil.i("zjs"," 全新 newBean="+newBean.toString());
DishDetailBean addNewBean=new DishDetailBean(newBean,curSelectDishNode);
// LogUtil.i("zjs"," 全新 newBean="+newBean.toString()+" addNewBean"+addNewBean.toString());
foodsNew.add(addNewBean);
}
}
......
......@@ -419,6 +419,17 @@ public class TimeUtils {
}
public static long getCurrentDateByOffset(int offset) {
try {
Calendar c = new GregorianCalendar();
c.add(Calendar.HOUR_OF_DAY, offset);
return c.getTime().getTime();
} catch (Exception e) {
e.printStackTrace();
}
return System.currentTimeMillis();
}
/**
* 描述:计算两个日期所差的天数.
*
......
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