增加负库存的开关
This commit is contained in:
@@ -17,6 +17,7 @@ import com.jsh.erp.service.MaterialExtend.MaterialExtendService;
|
||||
import com.jsh.erp.service.log.LogService;
|
||||
import com.jsh.erp.service.material.MaterialService;
|
||||
import com.jsh.erp.service.serialNumber.SerialNumberService;
|
||||
import com.jsh.erp.service.systemConfig.SystemConfigService;
|
||||
import com.jsh.erp.service.user.UserService;
|
||||
import com.jsh.erp.utils.QueryUtils;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
@@ -60,6 +61,8 @@ public class DepotItemService {
|
||||
@Resource
|
||||
private UserService userService;
|
||||
@Resource
|
||||
private SystemConfigService systemConfigService;
|
||||
@Resource
|
||||
private LogService logService;
|
||||
|
||||
public DepotItem getDepotItem(long id)throws Exception {
|
||||
@@ -429,7 +432,7 @@ public class DepotItemService {
|
||||
}
|
||||
BigDecimal stock = getStockByParam(depotItem.getDepotid(),depotItem.getMaterialid(),null,null,tenantId);
|
||||
BigDecimal thisBasicNumber = depotItem.getBasicnumber()==null?BigDecimal.ZERO:depotItem.getBasicnumber();
|
||||
if(stock.compareTo(thisBasicNumber)<0){
|
||||
if(systemConfigService.getMinusStockFlag() == false && stock.compareTo(thisBasicNumber)<0){
|
||||
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_CODE,
|
||||
String.format(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_MSG,material==null?"":material.getName()));
|
||||
}
|
||||
@@ -558,7 +561,7 @@ public class DepotItemService {
|
||||
if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())){
|
||||
BigDecimal stock = getStockByParam(depotItem.getDepotid(),depotItem.getMaterialid(),null,null,tenantId);
|
||||
BigDecimal thisBasicNumber = depotItem.getBasicnumber()==null?BigDecimal.ZERO:depotItem.getBasicnumber();
|
||||
if(stock.compareTo(thisBasicNumber)<0){
|
||||
if(systemConfigService.getMinusStockFlag() == false && stock.compareTo(thisBasicNumber)<0){
|
||||
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_CODE,
|
||||
String.format(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_MSG,material==null?"":material.getName()));
|
||||
}
|
||||
|
||||
@@ -199,4 +199,21 @@ public class SystemConfigService {
|
||||
}
|
||||
return customerFlag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取负库存开关
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public boolean getMinusStockFlag() throws Exception {
|
||||
boolean minusStockFlag = false;
|
||||
List<SystemConfig> list = getSystemConfig();
|
||||
if(list.size()>0) {
|
||||
String flag = list.get(0).getMinusStockFlag();
|
||||
if(("1").equals(flag)) {
|
||||
minusStockFlag = true;
|
||||
}
|
||||
}
|
||||
return minusStockFlag;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user