|
|
@ -105,7 +105,7 @@ public class StdcostpriceServiceImpl implements StdcostpriceService { |
|
|
|
massage += ex.getMessage() + ","; |
|
|
|
} |
|
|
|
try { |
|
|
|
validateCodeExists(null,stdcostprice.getItemCode()); |
|
|
|
validateCodeExists(null,stdcostprice.getSupplierCode(),stdcostprice.getItemCode()); |
|
|
|
} catch (ServiceException ex) { |
|
|
|
massage += ex.getMessage() + ","; |
|
|
|
} |
|
|
@ -137,7 +137,7 @@ public class StdcostpriceServiceImpl implements StdcostpriceService { |
|
|
|
if(errorList == null) { |
|
|
|
|
|
|
|
// 判断如果不存在,在进行插入
|
|
|
|
StdcostpriceDO existStdcostprice = stdcostpriceMapper.selectByStdcostpriceCode(stdcostprice.getSupplierCode()); |
|
|
|
StdcostpriceDO existStdcostprice = stdcostpriceMapper.selectByStdcostpriceCode(stdcostprice.getSupplierCode(),stdcostprice.getItemCode()); |
|
|
|
if (existStdcostprice == null && mode != 3) { |
|
|
|
stdcostpriceMapper.insert(StdcostpriceConvert.INSTANCE.convert(stdcostprice)); |
|
|
|
} else if (existStdcostprice != null && mode != 2) {// 如果存在,判断是否允许更新
|
|
|
@ -162,7 +162,7 @@ public class StdcostpriceServiceImpl implements StdcostpriceService { |
|
|
|
DataPermissionUtils.executeIgnore(() -> { |
|
|
|
validateStdcostpriceExists(id); |
|
|
|
// 校验code唯一
|
|
|
|
validateCodeExists(id,itemcode); |
|
|
|
validateCodeExists(id,itemcode,suppercode); |
|
|
|
validateSuppercodeExists(suppercode); |
|
|
|
validateCurrencyExists(currency); |
|
|
|
validatePriceExists(price); |
|
|
@ -181,14 +181,20 @@ public class StdcostpriceServiceImpl implements StdcostpriceService { |
|
|
|
} |
|
|
|
|
|
|
|
@VisibleForTesting |
|
|
|
private void validateCodeExists(Long id,String itemcode) { |
|
|
|
private void validateCodeExists(Long id,String itemcode,String suppercode) { |
|
|
|
if (itemcode.isEmpty()) { |
|
|
|
throw exception(STDCOSTPRICE_ITEN_CODE_NOT_EXISTS); |
|
|
|
} |
|
|
|
if (suppercode.isEmpty()) { |
|
|
|
throw exception(STDCOSTPRICE_SUPPLIER_CODE_NOT_EXISTS); |
|
|
|
} |
|
|
|
if (StrUtil.isBlank(itemcode)) { |
|
|
|
return; |
|
|
|
} |
|
|
|
StdcostpriceDO stdcostprice = stdcostpriceMapper.selectByStdcostpriceCode(itemcode); |
|
|
|
if (StrUtil.isBlank(suppercode)) { |
|
|
|
return; |
|
|
|
} |
|
|
|
StdcostpriceDO stdcostprice = stdcostpriceMapper.selectByStdcostpriceCode(suppercode, itemcode); |
|
|
|
if (stdcostprice == null) { |
|
|
|
return; |
|
|
|
} |
|
|
|