临时版
This commit is contained in:
parent
c338ca4314
commit
cabb78cffc
|
|
@ -149,14 +149,14 @@ public class DocumentOutAdapter extends BaseAdapter {
|
|||
GoodsBean goodsBean = new GoodsBean();
|
||||
goodsBean.setMaterialId(documentOutDetailBean.getMaterialId());
|
||||
goodsBean.setMaterialName(documentOutDetailBean.getMaterialName());
|
||||
goodsBean.setMaterialTotalNum(documentOutDetailBean.getFetchNum());
|
||||
goodsBean.setTotalQualifiedNum(documentOutDetailBean.getFetchNum());
|
||||
goodsBean.setMaterialTotalNum(new BigDecimal(documentOutDetailBean.getFetchNum()));
|
||||
goodsBean.setTotalQualifiedNum(new BigDecimal(documentOutDetailBean.getFetchNum()));
|
||||
goodsBean.setInventoryId(documentOutDetailBean.getInventoryId());
|
||||
goodsBean.setUnitName(documentOutDetailBean.getUnitName());
|
||||
goodsBean.setUnitId(documentOutDetailBean.getUnitId());
|
||||
goodsBean.setMaterialTypeName(documentOutDetailBean.getMaterialTypeName());
|
||||
goodsBean.setMaterialCode(documentOutDetailBean.getMaterialCode());
|
||||
goodsBean.setOutCount(documentOutDetailBean.getOutCount());
|
||||
goodsBean.setOutCount(new BigDecimal(documentOutDetailBean.getOutCount()));
|
||||
goodsBean.setFetchDetailId(documentOutDetailBean.getFetchDetailId());
|
||||
goodsBeanList.add(goodsBean);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ import com.bonus.canteen.utils.WorkConfig;
|
|||
|
||||
import org.easydarwin.easypusher.R;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
public class EnterDetailAdapter extends BaseAdapter {
|
||||
|
|
@ -103,9 +104,9 @@ public class EnterDetailAdapter extends BaseAdapter {
|
|||
holder.name.setText(bean.getMaterialName());
|
||||
holder.type.setText(bean.getMaterialTypeName());
|
||||
holder.unit.setText(bean.getUnitName());
|
||||
holder.price.setText(bean.getUnitPrice());
|
||||
holder.inspectedGoodsNum.setText(bean.getInventoryNum());
|
||||
holder.subTotal.setText(bean.getTotalPrice());
|
||||
holder.price.setText(bean.getUnitPrice().divide(BigDecimal.valueOf(100)) + "");
|
||||
holder.inspectedGoodsNum.setText(bean.getIntoNum() + "");
|
||||
holder.subTotal.setText(bean.getTotalPrice().divide(BigDecimal.valueOf(100)) + "");
|
||||
return convertView;
|
||||
}
|
||||
private class ViewHolder {
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ public class GoodsAdapter extends BaseAdapter {
|
|||
holder.code.setText(bean.getMaterialCode());
|
||||
holder.type.setText(bean.getMaterialTypeName());
|
||||
holder.unit.setText(bean.getUnitName());
|
||||
holder.num.setText(StringHelper.isEmptyAndNull(bean.getMaterialTotalNum()) ? "0" : bean.getMaterialTotalNum());
|
||||
holder.num.setText(StringHelper.isEmptyAndNullOrZero(bean.getMaterialTotalNum()) ? "0" : bean.getMaterialTotalNum() + "");
|
||||
String url = bean.getImgUrl();
|
||||
if (!StringHelper.isEmptyAndNull(bean.getImgUrl()) && !url.contains("http")) {
|
||||
url = WorkConfig.getFileUrl() + bean.getImgUrl();
|
||||
|
|
@ -124,7 +124,7 @@ public class GoodsAdapter extends BaseAdapter {
|
|||
if (StringHelper.isEmptyAndNull(bean.getIsSelect()) || !bean.getIsSelect().equals("1")) {
|
||||
//判断当前库存是否大于0
|
||||
if (pageType.equals("out")){
|
||||
if (StringHelper.isEmptyAndNull(bean.getMaterialTotalNum()) || new BigDecimal(bean.getMaterialTotalNum()).compareTo(BigDecimal.valueOf(0)) <= 0) {
|
||||
if (StringHelper.isEmptyAndNullOrZero(bean.getMaterialTotalNum()) || bean.getMaterialTotalNum().compareTo(BigDecimal.valueOf(0)) <= 0) {
|
||||
ProductSelectionFragment tempFragment = productSelectionFragment.get();
|
||||
if(tempFragment != null && !tempFragment.isDetached()){
|
||||
tempFragment.showToast("当前商品库存不足,无法选择!");
|
||||
|
|
|
|||
|
|
@ -96,8 +96,8 @@ public class OutDetailAdapter extends BaseAdapter {
|
|||
holder.name.setText(bean.getMaterialName());
|
||||
holder.type.setText(bean.getMaterialTypeName());
|
||||
holder.unit.setText(bean.getUnitName());
|
||||
holder.num.setText(bean.getInventoryNum());
|
||||
holder.collectedNum.setText(bean.getFetchNum());
|
||||
holder.num.setText(bean.getInventoryNum() + "");
|
||||
holder.collectedNum.setText(bean.getFetchNum() + "");
|
||||
return convertView;
|
||||
}
|
||||
private class ViewHolder {
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import com.bonus.canteen.utils.StringHelper;
|
|||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public class GoodsBean implements Serializable {
|
||||
@SerializedName("materialId")
|
||||
|
|
@ -39,35 +40,35 @@ public class GoodsBean implements Serializable {
|
|||
@SerializedName("unitName")
|
||||
private String unitName;
|
||||
@SerializedName(value = "unitPrice", alternate = {"singlePrice"})
|
||||
private String unitPrice;
|
||||
private BigDecimal unitPrice;
|
||||
private String imgUrl;
|
||||
@SerializedName(value = "materialTotalNum", alternate = {"orderNum","materialNum"})
|
||||
private String materialTotalNum;
|
||||
private BigDecimal materialTotalNum;
|
||||
private String isSelect;
|
||||
|
||||
private String inventoryId;
|
||||
private String fetchDetailId;
|
||||
private String supplierId;
|
||||
private String supplierName;
|
||||
private String totalPrice;
|
||||
private String purNum;
|
||||
private String deliveryNum;
|
||||
private String fetchNum;
|
||||
private String unqualifiedNum;
|
||||
private String totalQualifiedNum;
|
||||
private String inventoryNum;
|
||||
private BigDecimal totalPrice;
|
||||
private BigDecimal purNum;
|
||||
private BigDecimal deliveryNum;
|
||||
private BigDecimal fetchNum;
|
||||
private BigDecimal unqualifiedNum;
|
||||
private BigDecimal totalQualifiedNum;
|
||||
private BigDecimal inventoryNum;
|
||||
private String warehouseId;
|
||||
private String expireTime;
|
||||
private String productDate;
|
||||
private String weight;
|
||||
private String takePhoto;
|
||||
private String intoNum;
|
||||
private String outNum;
|
||||
private String outCount;
|
||||
private BigDecimal intoNum;
|
||||
private BigDecimal outNum;
|
||||
private BigDecimal outCount;
|
||||
private String ifFillInventory;
|
||||
@SuppressLint("DefaultLocale")
|
||||
public String getTotalQualifiedNum() {
|
||||
return StringHelper.isEmptyAndNullOrZero(totalQualifiedNum) ? "0" : String.format("%.2f", Double.parseDouble(totalQualifiedNum));
|
||||
public BigDecimal getTotalQualifiedNum() {
|
||||
return StringHelper.isEmptyAndNullOrZero(totalQualifiedNum) ? new BigDecimal("0") : totalQualifiedNum;
|
||||
}
|
||||
|
||||
public String getWarehouseId() {
|
||||
|
|
@ -95,51 +96,51 @@ public class GoodsBean implements Serializable {
|
|||
}
|
||||
|
||||
@SuppressLint("DefaultLocale")
|
||||
public String getIntoNum() {
|
||||
return StringHelper.isEmptyAndNullOrZero(intoNum) ? "0" : String.format("%.2f", Double.parseDouble(intoNum));
|
||||
public BigDecimal getIntoNum() {
|
||||
return StringHelper.isEmptyAndNullOrZero(intoNum) ? new BigDecimal("0") : intoNum;
|
||||
}
|
||||
|
||||
public void setIntoNum(String intoNum) {
|
||||
public void setIntoNum(BigDecimal intoNum) {
|
||||
this.intoNum = intoNum;
|
||||
}
|
||||
|
||||
public void setTotalQualifiedNum(String totalQualifiedNum) {
|
||||
public void setTotalQualifiedNum(BigDecimal totalQualifiedNum) {
|
||||
this.totalQualifiedNum = totalQualifiedNum;
|
||||
}
|
||||
|
||||
@SuppressLint("DefaultLocale")
|
||||
public String getFetchNum() {
|
||||
return StringHelper.isEmptyAndNullOrZero(fetchNum) ? "0" : String.format("%.2f", Double.parseDouble(fetchNum));
|
||||
public BigDecimal getFetchNum() {
|
||||
return StringHelper.isEmptyAndNullOrZero(fetchNum) ? new BigDecimal("0") : fetchNum;
|
||||
}
|
||||
|
||||
@SuppressLint("DefaultLocale")
|
||||
public String getDeliveryNum() {
|
||||
return StringHelper.isEmptyAndNullOrZero(deliveryNum) ? "0" : String.format("%.2f", Double.parseDouble(deliveryNum));
|
||||
public BigDecimal getDeliveryNum() {
|
||||
return StringHelper.isEmptyAndNullOrZero(deliveryNum) ? new BigDecimal("0") : deliveryNum;
|
||||
}
|
||||
|
||||
public void setDeliveryNum(String deliveryNum) {
|
||||
public void setDeliveryNum(BigDecimal deliveryNum) {
|
||||
this.deliveryNum = deliveryNum;
|
||||
}
|
||||
|
||||
@SuppressLint("DefaultLocale")
|
||||
public String getOutNum() {
|
||||
return StringHelper.isEmptyAndNullOrZero(outNum) ? "0" : String.format("%.2f", Double.parseDouble(outNum));
|
||||
public BigDecimal getOutNum() {
|
||||
return StringHelper.isEmptyAndNullOrZero(outNum) ? new BigDecimal("0") : outNum;
|
||||
}
|
||||
|
||||
public void setOutNum(String outNum) {
|
||||
public void setOutNum(BigDecimal outNum) {
|
||||
this.outNum = outNum;
|
||||
}
|
||||
|
||||
@SuppressLint("DefaultLocale")
|
||||
public String getOutCount() {
|
||||
return StringHelper.isEmptyAndNullOrZero(outCount) ? "0" : String.format("%.2f", Double.parseDouble(outCount));
|
||||
public BigDecimal getOutCount() {
|
||||
return StringHelper.isEmptyAndNullOrZero(outCount) ? new BigDecimal("0") : outCount;
|
||||
}
|
||||
|
||||
public void setOutCount(String outCount) {
|
||||
public void setOutCount(BigDecimal outCount) {
|
||||
this.outCount = outCount;
|
||||
}
|
||||
|
||||
public void setFetchNum(String fetchNum) {
|
||||
public void setFetchNum(BigDecimal fetchNum) {
|
||||
this.fetchNum = fetchNum;
|
||||
}
|
||||
|
||||
|
|
@ -200,11 +201,11 @@ public class GoodsBean implements Serializable {
|
|||
}
|
||||
|
||||
@SuppressLint("DefaultLocale")
|
||||
public String getUnitPrice() {
|
||||
return StringHelper.isEmptyAndNullOrZero(unitPrice) ? "0" : String.format("%.2f", Double.parseDouble(unitPrice));
|
||||
public BigDecimal getUnitPrice() {
|
||||
return StringHelper.isEmptyAndNullOrZero(unitPrice) ? new BigDecimal("0") : unitPrice;
|
||||
}
|
||||
|
||||
public void setUnitPrice(String unitPrice) {
|
||||
public void setUnitPrice(BigDecimal unitPrice) {
|
||||
this.unitPrice = unitPrice;
|
||||
}
|
||||
|
||||
|
|
@ -217,11 +218,11 @@ public class GoodsBean implements Serializable {
|
|||
}
|
||||
|
||||
@SuppressLint("DefaultLocale")
|
||||
public String getMaterialTotalNum() {
|
||||
return StringHelper.isEmptyAndNullOrZero(materialTotalNum) ? "0" : String.format("%.2f", Double.parseDouble(materialTotalNum));
|
||||
public BigDecimal getMaterialTotalNum() {
|
||||
return StringHelper.isEmptyAndNullOrZero(materialTotalNum) ? new BigDecimal("0") : materialTotalNum;
|
||||
}
|
||||
|
||||
public void setMaterialTotalNum(String materialTotalNum) {
|
||||
public void setMaterialTotalNum(BigDecimal materialTotalNum) {
|
||||
this.materialTotalNum = materialTotalNum;
|
||||
}
|
||||
|
||||
|
|
@ -258,38 +259,38 @@ public class GoodsBean implements Serializable {
|
|||
}
|
||||
|
||||
@SuppressLint("DefaultLocale")
|
||||
public String getTotalPrice() {
|
||||
return StringHelper.isEmptyAndNullOrZero(totalPrice) ? "0" : String.format("%.2f", Double.parseDouble(totalPrice));
|
||||
public BigDecimal getTotalPrice() {
|
||||
return StringHelper.isEmptyAndNullOrZero(totalPrice) ? new BigDecimal("0") : totalPrice;
|
||||
}
|
||||
|
||||
public void setTotalPrice(String totalPrice) {
|
||||
public void setTotalPrice(BigDecimal totalPrice) {
|
||||
this.totalPrice = totalPrice;
|
||||
}
|
||||
|
||||
@SuppressLint("DefaultLocale")
|
||||
public String getPurNum() {
|
||||
return StringHelper.isEmptyAndNullOrZero(purNum) ? "0" : String.format("%.2f", Double.parseDouble(purNum));
|
||||
public BigDecimal getPurNum() {
|
||||
return StringHelper.isEmptyAndNullOrZero(purNum) ? new BigDecimal("0") : purNum;
|
||||
}
|
||||
|
||||
public void setPurNum(String purNum) {
|
||||
public void setPurNum(BigDecimal purNum) {
|
||||
this.purNum = purNum;
|
||||
}
|
||||
|
||||
@SuppressLint("DefaultLocale")
|
||||
public String getUnqualifiedNum() {
|
||||
return StringHelper.isEmptyAndNullOrZero(unqualifiedNum) ? "0" : String.format("%.2f", Double.parseDouble(unqualifiedNum));
|
||||
public BigDecimal getUnqualifiedNum() {
|
||||
return StringHelper.isEmptyAndNullOrZero(unqualifiedNum) ? new BigDecimal("0") : unqualifiedNum;
|
||||
}
|
||||
|
||||
public void setUnqualifiedNum(String unqualifiedNum) {
|
||||
public void setUnqualifiedNum(BigDecimal unqualifiedNum) {
|
||||
this.unqualifiedNum = unqualifiedNum;
|
||||
}
|
||||
|
||||
@SuppressLint("DefaultLocale")
|
||||
public String getInventoryNum() {
|
||||
return StringHelper.isEmptyAndNullOrZero(inventoryNum) ? "0" : String.format("%.2f", Double.parseDouble(inventoryNum));
|
||||
public BigDecimal getInventoryNum() {
|
||||
return StringHelper.isEmptyAndNullOrZero(inventoryNum) ? new BigDecimal("0") : inventoryNum;
|
||||
}
|
||||
|
||||
public void setInventoryNum(String inventoryNum) {
|
||||
public void setInventoryNum(BigDecimal inventoryNum) {
|
||||
this.inventoryNum = inventoryNum;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ import okhttp3.MediaType;
|
|||
import okhttp3.Request;
|
||||
import okhttp3.RequestBody;
|
||||
|
||||
@Page(name = "出入库记录", anim = CoreAnim.none)
|
||||
|
||||
public class EnterAndOutRecordsFragment extends BaseFragment<ActivityRecordMainPageBinding> {
|
||||
public final OkHttpService service = new OkHttpService();
|
||||
private EasyIndicator mEasyIndicator;
|
||||
|
|
|
|||
|
|
@ -118,6 +118,7 @@ import java.math.RoundingMode;
|
|||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
|
|
@ -186,6 +187,7 @@ public class InspectionWarehousingFragment extends BaseFragment<ActivityInspecti
|
|||
}).setTimeSelectChangeListener(date -> Log.i("pvTime", "onTimeSelectChanged"))
|
||||
.setTitleText("日期选择")
|
||||
.setType(true, true, true, false, false, false)
|
||||
.setRangDate(Calendar.getInstance(), null) // 设置最小日期为今天
|
||||
.build();
|
||||
}
|
||||
|
||||
|
|
@ -198,6 +200,7 @@ public class InspectionWarehousingFragment extends BaseFragment<ActivityInspecti
|
|||
}).setTimeSelectChangeListener(date -> Log.i("pvTime", "onTimeSelectChanged"))
|
||||
.setTitleText("日期选择")
|
||||
.setType(true, true, true, false, false, false)
|
||||
.setRangDate(null, Calendar.getInstance()) // 设置最大日期为今天
|
||||
.build();
|
||||
}
|
||||
|
||||
|
|
@ -334,8 +337,8 @@ public class InspectionWarehousingFragment extends BaseFragment<ActivityInspecti
|
|||
.orElse(null);
|
||||
if (goodsBean != null) {
|
||||
goodsBean.setWeight("0");
|
||||
goodsBean.setPurNum("0");
|
||||
goodsBean.setTotalPrice("0");
|
||||
goodsBean.setPurNum(BigDecimal.ZERO);
|
||||
goodsBean.setTotalPrice(BigDecimal.ZERO);
|
||||
goodsBean.setExpireTime("");
|
||||
goodsBean.setProductDate("");
|
||||
goodsBean.setSupplierId("");
|
||||
|
|
@ -486,8 +489,8 @@ public class InspectionWarehousingFragment extends BaseFragment<ActivityInspecti
|
|||
BigDecimal totalNum = BigDecimal.ZERO;
|
||||
BigDecimal totalAmount = BigDecimal.ZERO;
|
||||
for (GoodsBean goods : selectedGoods) {
|
||||
totalNum = totalNum.add(new BigDecimal(goods.getPurNum()));
|
||||
totalAmount = totalAmount.add(new BigDecimal(goods.getTotalPrice()));
|
||||
totalNum = totalNum.add(goods.getPurNum());
|
||||
totalAmount = totalAmount.add(goods.getTotalPrice());
|
||||
}
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("warehouseId", ((WarehouseBean) binding.warehouseSpinner.getSelectedItem()).getWarehouseId());
|
||||
|
|
@ -670,8 +673,8 @@ public class InspectionWarehousingFragment extends BaseFragment<ActivityInspecti
|
|||
code.setText(goodsBean.getMaterialCode());
|
||||
type.setText(goodsBean.getMaterialTypeName());
|
||||
unit.setText(goodsBean.getUnitName());
|
||||
num.setText(StringHelper.isEmptyAndNull(goodsBean.getMaterialTotalNum()) ? "0" : goodsBean.getMaterialTotalNum());
|
||||
price.setText(StringHelper.isEmptyAndNull(goodsBean.getUnitPrice()) ? "0" : new BigDecimal(goodsBean.getUnitPrice()).divide(BigDecimal.valueOf(100)).toString());
|
||||
num.setText(StringHelper.isEmptyAndNullOrZero(goodsBean.getMaterialTotalNum()) ? "0" : goodsBean.getMaterialTotalNum() + "");
|
||||
price.setText(StringHelper.isEmptyAndNullOrZero(goodsBean.getUnitPrice()) ? "0" : goodsBean.getUnitPrice().divide(BigDecimal.valueOf(100)).toString());
|
||||
weight.setText("0");
|
||||
enterWeight.setText("0");
|
||||
if (!StringHelper.isEmptyAndNull(goodsBean.getSupplierName())) {
|
||||
|
|
@ -868,14 +871,14 @@ public class InspectionWarehousingFragment extends BaseFragment<ActivityInspecti
|
|||
TextView weightView = view.findViewById(R.id.weight);
|
||||
TextView enterWeight = view.findViewById(R.id.enter_weight);
|
||||
TextView subtotal = view.findViewById(R.id.subtotal);
|
||||
BigDecimal priceValue = new BigDecimal(goodsBean.getUnitPrice());
|
||||
BigDecimal priceValue = goodsBean.getUnitPrice();
|
||||
if (unit.getText().toString().equals("斤")) {
|
||||
weightView.setText(String.valueOf(weight * 2));
|
||||
if ("enter".equals(pageType)) {
|
||||
enterWeight.setText(String.valueOf(weight * 2));
|
||||
} else {
|
||||
BigDecimal rate = BigDecimal.valueOf(100).subtract(new BigDecimal(paramSettingInfo.getWeighDownwardRatio())).divide(BigDecimal.valueOf(100));
|
||||
BigDecimal unInspectedGoodsNum = new BigDecimal(goodsBean.getTotalQualifiedNum()).subtract(new BigDecimal(goodsBean.getIntoNum()));
|
||||
BigDecimal unInspectedGoodsNum = goodsBean.getTotalQualifiedNum().subtract(goodsBean.getIntoNum());
|
||||
BigDecimal originalNum = unInspectedGoodsNum.multiply(rate);
|
||||
Log.e(TAG, "Weight: " + weight + ", Original number: " + originalNum.doubleValue() + ", Uninspected goods unInspectedGoodsNum: " + unInspectedGoodsNum);
|
||||
if (weight * 2 >= originalNum.doubleValue()) {
|
||||
|
|
@ -892,7 +895,7 @@ public class InspectionWarehousingFragment extends BaseFragment<ActivityInspecti
|
|||
enterWeight.setText(String.valueOf(weight));
|
||||
} else {
|
||||
BigDecimal rate = BigDecimal.valueOf(100).subtract(new BigDecimal(paramSettingInfo.getWeighDownwardRatio())).divide(BigDecimal.valueOf(100));
|
||||
BigDecimal unInspectedGoodsNum = new BigDecimal(goodsBean.getTotalQualifiedNum()).subtract(new BigDecimal(goodsBean.getIntoNum()));
|
||||
BigDecimal unInspectedGoodsNum = goodsBean.getTotalQualifiedNum().subtract(goodsBean.getIntoNum());
|
||||
BigDecimal originalNum = unInspectedGoodsNum.multiply(rate);
|
||||
Log.e(TAG, "Weight: " + weight + ", Original number: " + originalNum.doubleValue() + ", Uninspected goods unInspectedGoodsNum: " + unInspectedGoodsNum);
|
||||
if (weight >= originalNum.doubleValue()) {
|
||||
|
|
@ -984,7 +987,7 @@ public class InspectionWarehousingFragment extends BaseFragment<ActivityInspecti
|
|||
.findFirst()
|
||||
.orElse(null);
|
||||
if (goodsBean != null) {
|
||||
BigDecimal priceValue = new BigDecimal(goodsBean.getUnitPrice());
|
||||
BigDecimal priceValue = goodsBean.getUnitPrice();
|
||||
BigDecimal subtotalValue = roundedWeight.multiply(priceValue).divide(BigDecimal.valueOf(100));
|
||||
subtotal.setText(subtotalValue.toString());
|
||||
}
|
||||
|
|
@ -1048,11 +1051,11 @@ public class InspectionWarehousingFragment extends BaseFragment<ActivityInspecti
|
|||
XToastUtils.warning("生产日期不能大于到期日期");
|
||||
return;
|
||||
}
|
||||
if (subtotal.getText().toString().isEmpty()) {
|
||||
dialog.dismiss();
|
||||
XToastUtils.warning("小计不能为空");
|
||||
return;
|
||||
}
|
||||
// if (subtotal.getText().toString().isEmpty()) {
|
||||
// dialog.dismiss();
|
||||
// XToastUtils.warning("小计不能为空");
|
||||
// return;
|
||||
// }
|
||||
if (Double.parseDouble(weightView.getText().toString()) <= 0) {
|
||||
dialog.dismiss();
|
||||
XToastUtils.warning("称重结果必须大于0");
|
||||
|
|
@ -1060,9 +1063,9 @@ public class InspectionWarehousingFragment extends BaseFragment<ActivityInspecti
|
|||
}
|
||||
//对list进行数据更新
|
||||
goodsBean.setWeight(weightView.getText().toString());
|
||||
goodsBean.setDeliveryNum(weightView.getText().toString());
|
||||
goodsBean.setPurNum(enterWeight.getText().toString());
|
||||
goodsBean.setTotalPrice(String.valueOf(new BigDecimal(subtotal.getText().toString()).multiply(BigDecimal.valueOf(100)).setScale(0, RoundingMode.DOWN).toPlainString()));
|
||||
goodsBean.setDeliveryNum(new BigDecimal(weightView.getText().toString()));
|
||||
goodsBean.setPurNum(new BigDecimal(enterWeight.getText().toString()));
|
||||
goodsBean.setTotalPrice(new BigDecimal(subtotal.getText().toString()).multiply(BigDecimal.valueOf(100)).setScale(0, RoundingMode.DOWN));
|
||||
goodsBean.setExpireTime(dateTextView.getText().toString());
|
||||
goodsBean.setProductDate(productionDate.getText().toString());
|
||||
goodsBean.setImgUrl(goodsBean.getTakePhoto() != null ? goodsBean.getTakePhoto() : "");
|
||||
|
|
@ -1167,7 +1170,7 @@ public class InspectionWarehousingFragment extends BaseFragment<ActivityInspecti
|
|||
|
||||
CameraManager manager = (CameraManager) requireActivity().getSystemService(Context.CAMERA_SERVICE);
|
||||
try {
|
||||
cameraId = manager.getCameraIdList()[0]; // 使用后置相机
|
||||
cameraId = manager.getCameraIdList()[1]; // 使用后置相机
|
||||
|
||||
// 获取相机特性并选择预览尺寸
|
||||
CameraCharacteristics characteristics = manager.getCameraCharacteristics(cameraId);
|
||||
|
|
|
|||
|
|
@ -409,7 +409,7 @@ public class EnterWarehouseFragment extends BaseFragment<ActivityEnterMainPageBi
|
|||
BigDecimal totalAmount = BigDecimal.ZERO;
|
||||
for (GoodsBean goods : selectedGoods) {
|
||||
totalNum = totalNum.add(new BigDecimal(goods.getWeight()));
|
||||
totalAmount = totalAmount.add(new BigDecimal(goods.getTotalPrice()));
|
||||
totalAmount = totalAmount.add(goods.getTotalPrice());
|
||||
}
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("warehouseId", ((WarehouseBean) warehouseSpinner.getSelectedItem()).getWarehouseId());
|
||||
|
|
|
|||
|
|
@ -375,7 +375,7 @@ public class InspectionWarehousingOutFragment extends BaseFragment<ActivityInspe
|
|||
code.setText(goodsBean.getMaterialCode());
|
||||
type.setText(goodsBean.getMaterialTypeName());
|
||||
unit.setText(goodsBean.getUnitName());
|
||||
num.setText(StringHelper.isEmptyAndNull(goodsBean.getMaterialTotalNum()) ? "0" : goodsBean.getMaterialTotalNum());
|
||||
num.setText(StringHelper.isEmptyAndNullOrZero(goodsBean.getMaterialTotalNum()) ? "0" : goodsBean.getMaterialTotalNum() + "");
|
||||
weight.setText("0");
|
||||
enterWeight.setText("0");
|
||||
|
||||
|
|
@ -453,8 +453,8 @@ public class InspectionWarehousingOutFragment extends BaseFragment<ActivityInspe
|
|||
.orElse(null);
|
||||
if (goodsBean != null) {
|
||||
goodsBean.setWeight("0");
|
||||
goodsBean.setPurNum("0");
|
||||
goodsBean.setTotalPrice("0");
|
||||
goodsBean.setPurNum(BigDecimal.ZERO);
|
||||
goodsBean.setTotalPrice(BigDecimal.ZERO);
|
||||
goodsBean.setExpireTime("");
|
||||
goodsBean.setSupplierId("");
|
||||
goodsBean.setSupplierName("");
|
||||
|
|
@ -546,7 +546,7 @@ public class InspectionWarehousingOutFragment extends BaseFragment<ActivityInspe
|
|||
|
||||
private boolean handlerResultParameters(List<GoodsBean> selectedGoods) {
|
||||
List<GoodsBean> filteredGoods = new ArrayList<>(selectedGoods.stream()
|
||||
.filter(goods -> !StringHelper.isEmptyAndNull(goods.getFetchNum()) && Double.parseDouble(goods.getFetchNum()) > 0)
|
||||
.filter(goods -> !StringHelper.isEmptyAndNullOrZero(goods.getFetchNum()) && goods.getFetchNum().compareTo(BigDecimal.ZERO) > 0)
|
||||
.collect(Collectors.toMap(GoodsBean::getMaterialCode, goods -> goods, (g1, g2) -> g1))
|
||||
.values());
|
||||
if (filteredGoods.isEmpty()) {
|
||||
|
|
@ -589,7 +589,8 @@ public class InspectionWarehousingOutFragment extends BaseFragment<ActivityInspe
|
|||
}
|
||||
|
||||
json.put("warehouseId", ((WarehouseBean) binding.warehouseSpinner.getSelectedItem()).getWarehouseId());
|
||||
json.put("fetchUserId", ((MaterialRequesterBean) binding.enterPersonSpinner.getSelectedItem()).getUserId());
|
||||
Object selectedUser = binding.enterPersonSpinner.getSelectedItem();
|
||||
json.put("fetchUserId", selectedUser instanceof MaterialRequesterBean ? ((MaterialRequesterBean) selectedUser).getUserId() : "");
|
||||
json.put("outDate", DateTimeHelper.getTime());
|
||||
json.put("totalNum", totalNum.toPlainString());
|
||||
json.put("outType", ((SpinnerBean) binding.inboundTypeSpinner.getSelectedItem()).getId());
|
||||
|
|
@ -761,7 +762,7 @@ public class InspectionWarehousingOutFragment extends BaseFragment<ActivityInspe
|
|||
weightView.setText(String.valueOf(weight * 2));
|
||||
}
|
||||
} else {
|
||||
BigDecimal unInspectedGoodsNum = new BigDecimal(goodsBean.getTotalQualifiedNum()).subtract(new BigDecimal(goodsBean.getOutCount()));
|
||||
BigDecimal unInspectedGoodsNum = goodsBean.getTotalQualifiedNum().subtract(goodsBean.getOutCount());
|
||||
BigDecimal rate = BigDecimal.valueOf(100).subtract(new BigDecimal(paramSettingInfo.getWeighDownwardRatio())).divide(BigDecimal.valueOf(100));
|
||||
BigDecimal originalNum = unInspectedGoodsNum.multiply(rate);
|
||||
Log.e(TAG, "unInspectedGoodsNum=" + unInspectedGoodsNum);
|
||||
|
|
@ -787,7 +788,7 @@ public class InspectionWarehousingOutFragment extends BaseFragment<ActivityInspe
|
|||
weightView.setText(String.valueOf(weight));
|
||||
}
|
||||
} else {
|
||||
BigDecimal unInspectedGoodsNum = new BigDecimal(goodsBean.getMaterialTotalNum()).subtract(new BigDecimal(goodsBean.getOutCount()));
|
||||
BigDecimal unInspectedGoodsNum = goodsBean.getMaterialTotalNum().subtract(goodsBean.getOutCount());
|
||||
BigDecimal rate = BigDecimal.valueOf(100).subtract(new BigDecimal(paramSettingInfo.getWeighDownwardRatio())).divide(BigDecimal.valueOf(100));
|
||||
BigDecimal originalNum = unInspectedGoodsNum.multiply(rate);
|
||||
Log.e(TAG, "goodsBean=" + goodsBean);
|
||||
|
|
@ -914,12 +915,12 @@ public class InspectionWarehousingOutFragment extends BaseFragment<ActivityInspe
|
|||
}
|
||||
//对list进行数据更新
|
||||
goodsBean.setWeight(weightView.getText().toString());
|
||||
goodsBean.setDeliveryNum(weightView.getText().toString());
|
||||
goodsBean.setFetchNum(enterWeight.getText().toString());
|
||||
BigDecimal subtotal = new BigDecimal(goodsBean.getUnitPrice())
|
||||
goodsBean.setDeliveryNum(new BigDecimal(weightView.getText().toString()));
|
||||
goodsBean.setFetchNum(new BigDecimal(enterWeight.getText().toString()));
|
||||
BigDecimal subtotal = goodsBean.getUnitPrice()
|
||||
.multiply(new BigDecimal(weightView.getText().toString()))
|
||||
.setScale(0, RoundingMode.DOWN);
|
||||
goodsBean.setTotalPrice(subtotal.toPlainString());
|
||||
goodsBean.setTotalPrice(subtotal);
|
||||
goodsBean.setImgUrl(goodsBean.getTakePhoto() != null ? goodsBean.getTakePhoto() : "");
|
||||
int index = goodsList.indexOf(goodsBean);
|
||||
if (index != -1) {
|
||||
|
|
|
|||
|
|
@ -430,12 +430,12 @@ public class OutWarehouseFragment extends BaseFragment<ActivityOutMainPageBindin
|
|||
List<OutWarehouseDetailsBean> outWarehouseDetailsBeans = new ArrayList<>();
|
||||
for (GoodsBean goods : selectedGoods) {
|
||||
totalNum = totalNum.add(new BigDecimal(goods.getWeight()));
|
||||
if (!StringHelper.isEmptyAndNull(goods.getUnitPrice())) {
|
||||
totalPrice = totalPrice.add(new BigDecimal(goods.getTotalPrice()));
|
||||
if (!StringHelper.isEmptyAndNullOrZero(goods.getUnitPrice())) {
|
||||
totalPrice = totalPrice.add(goods.getTotalPrice());
|
||||
}
|
||||
outWarehouseDetailsBeans.add(new OutWarehouseDetailsBean(
|
||||
goods.getWeight(),
|
||||
goods.getTotalPrice(),
|
||||
goods.getTotalPrice() + "",
|
||||
goods.getImgUrl()
|
||||
));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -257,8 +257,7 @@ public class DocumentSelectionFragment extends BaseFragment<ActivityDocumentStro
|
|||
jsonObject.put("supplierId", supplierId);
|
||||
jsonObject.put("pageNum", 1);
|
||||
jsonObject.put("pageSize", 10);
|
||||
jsonObject.put("ifAllInspect", 2);
|
||||
jsonObject.put("endDateTime", DateTimeHelper.getNowDate() + " 23:59:59");
|
||||
// jsonObject.put("ifAllInspect", 2);
|
||||
jsonObject.put("startDateTime", DateTimeHelper.getLastDate(-29) + " 00:00:00");
|
||||
String jsonString = jsonObject.toString();
|
||||
Log.e(TAG, "jsonString==" + jsonString);
|
||||
|
|
@ -319,10 +318,10 @@ public class DocumentSelectionFragment extends BaseFragment<ActivityDocumentStro
|
|||
public void changeFragment(DocumentBean documentBean) {
|
||||
List<GoodsBean> goodsList = documentBean.getGoodsList();
|
||||
BigDecimal intoNum = goodsList.stream()
|
||||
.map(goods -> new BigDecimal(goods.getIntoNum()))
|
||||
.map(GoodsBean::getIntoNum)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
BigDecimal inspectionNum = goodsList.stream()
|
||||
.map(goods -> new BigDecimal(goods.getTotalQualifiedNum()))
|
||||
.map(GoodsBean::getTotalQualifiedNum)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
if (inspectionNum.compareTo(intoNum) == 0) {
|
||||
requireActivity().runOnUiThread(() -> {
|
||||
|
|
|
|||
|
|
@ -134,14 +134,10 @@ public class ProductSelectionFragment extends BaseFragment<ActivityProductSelect
|
|||
String url;
|
||||
String result;
|
||||
if (AppConstants.OUT.equals(pageType)) {
|
||||
url = WorkConfig.getBaseUrl() + "/api/v1/drpinventory/list?pageSize=" + 1000 + "&pageNum=1";
|
||||
// 定义 JSON 的 MediaType
|
||||
MediaType mediaType = MediaType.parse(AppConstants.MEDIA_TYPE);
|
||||
// 创建 RequestBody
|
||||
RequestBody body = RequestBody.create(mediaType, new JSONObject().toString());
|
||||
result = service.httpPost(url, body, requireContext());
|
||||
url = WorkConfig.getBaseUrl() + "/api/v1/drpinventory/list?pageSize=" + 1000 + "&pageNum=1&unitName=CRKYTJ";
|
||||
result = service.httpGet(url, requireContext());
|
||||
} else {
|
||||
url = WorkConfig.getBaseUrl() + "/cook_material/list?pageSize=" + 1000 + "&pageNum=1";
|
||||
url = WorkConfig.getBaseUrl() + "/cook_material/list?pageSize=" + 1000 + "&pageNum=1&unitName=CRKYTJ";
|
||||
result = service.httpGet(url, requireContext());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -304,7 +304,7 @@ public class OkHttpService {
|
|||
try {
|
||||
OkHttpClient client = getInstance();
|
||||
Request request = new Request.Builder()
|
||||
.post(body)
|
||||
.get()
|
||||
.url(url).addHeader(
|
||||
"Authorization", "Bearer " + AppDatabase.getDatabase(context).loginInfoDao().getLoginInfoOne().getToken()
|
||||
).build();
|
||||
|
|
|
|||
|
|
@ -54,6 +54,15 @@ public class StringHelper {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
public static boolean isEmptyAndNullOrZero(BigDecimal str) {
|
||||
if (str == null) {
|
||||
return true;
|
||||
}
|
||||
if (str.compareTo(BigDecimal.ZERO) == 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证手机格式
|
||||
|
|
|
|||
|
|
@ -25,10 +25,10 @@ public class WorkConfig {
|
|||
throw new UnsupportedOperationException("Cannot instantiate utility class");
|
||||
}
|
||||
//本地
|
||||
// protected static String baseUrl = "http://192.168.0.176:48380/smart-canteen";
|
||||
// protected static String prefixesUrl = "http://192.168.0.176:48380";
|
||||
protected static String baseUrl = "http://192.168.0.244:48380/smart-canteen";
|
||||
protected static String prefixesUrl = "http://192.168.0.244:48380";
|
||||
protected static String baseUrl = "http://192.168.0.34:48380/smart-canteen";
|
||||
protected static String prefixesUrl = "http://192.168.0.34:48380";
|
||||
// protected static String baseUrl = "http://192.168.0.244:48380/smart-canteen";
|
||||
// protected static String prefixesUrl = "http://192.168.0.244:48380";
|
||||
protected static String fileUrl = "http://192.168.0.244:48380/lnyst/";
|
||||
protected static String updateUrl = "https://www.baidu.com";
|
||||
protected static String serverUri = "tcp://192.168.0.244:1883";
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@
|
|||
<LinearLayout
|
||||
android:layout_width="170dp"
|
||||
android:layout_height="130dp"
|
||||
android:layout_marginStart="@dimen/config_margin_10dp"
|
||||
android:orientation="vertical">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
|||
Loading…
Reference in New Issue