增加负库存的开关

This commit is contained in:
季圣华
2020-06-18 22:31:04 +08:00
parent a0e61fa8eb
commit 84943631ba
9 changed files with 461 additions and 793 deletions

View File

@@ -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()));
}