优化单据中仓库的校验逻辑

This commit is contained in:
季圣华
2020-12-22 00:02:05 +08:00
parent 8cc8dea077
commit 6f733eb0a0
3 changed files with 20 additions and 7 deletions

View File

@@ -294,6 +294,12 @@ public class ExceptionConstants {
//单据录入数量超出限制
public static final int DEPOT_HEAD_OVER_LIMIT_FAILED_CODE = 8500003;
public static final String DEPOT_HEAD_OVER_LIMIT_FAILED_MSG = "单据录入数量超出限制,请联系管理员";
//单据录入-仓库不能为空
public static final int DEPOT_HEAD_DEPOT_FAILED_CODE = 8500004;
public static final String DEPOT_HEAD_DEPOT_FAILED_MSG = "仓库不能为空";
//单据录入-调入仓库不能为空
public static final int DEPOT_HEAD_ANOTHER_DEPOT_FAILED_CODE = 8500005;
public static final String DEPOT_HEAD_ANOTHER_DEPOT_FAILED_MSG = "调入仓库不能为空";
/**
* 单据明细信息
* type = 90

View File

@@ -355,12 +355,19 @@ public class DepotItemService {
if (StringUtil.isExist(rowObj.get("AllPrice"))) {
depotItem.setAllPrice(rowObj.getBigDecimal("AllPrice"));
}
depotItem.setRemark(rowObj.getString("Remark"));
if (rowObj.get("DepotId") != null && !StringUtil.isEmpty(rowObj.get("DepotId").toString())) {
if (StringUtil.isExist(rowObj.get("DepotId"))) {
depotItem.setDepotId(rowObj.getLong("DepotId"));
} else {
throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_DEPOT_FAILED_CODE,
String.format(ExceptionConstants.DEPOT_HEAD_DEPOT_FAILED_MSG));
}
if (rowObj.get("AnotherDepotId") != null && !StringUtil.isEmpty(rowObj.get("AnotherDepotId").toString())) {
depotItem.setAnotherDepotId(rowObj.getLong("AnotherDepotId"));
if(BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubType())) {
if (StringUtil.isExist(rowObj.get("AnotherDepotId"))) {
depotItem.setAnotherDepotId(rowObj.getLong("AnotherDepotId"));
} else {
throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_ANOTHER_DEPOT_FAILED_CODE,
String.format(ExceptionConstants.DEPOT_HEAD_ANOTHER_DEPOT_FAILED_MSG));
}
}
if (StringUtil.isExist(rowObj.get("TaxRate"))) {
depotItem.setTaxRate(rowObj.getBigDecimal("TaxRate"));
@@ -371,10 +378,10 @@ public class DepotItemService {
if (StringUtil.isExist(rowObj.get("TaxLastMoney"))) {
depotItem.setTaxLastMoney(rowObj.getBigDecimal("TaxLastMoney"));
}
if (rowObj.get("MType") != null) {
if (StringUtil.isExist(rowObj.get("MType"))) {
depotItem.setMaterialType(rowObj.getString("MType"));
}
if (rowObj.get("Remark") != null) {
if (StringUtil.isExist(rowObj.get("Remark"))) {
depotItem.setRemark(rowObj.getString("Remark"));
}
//出库时判断库存是否充足