|
|
@ -51,6 +51,16 @@ public class ShipmentRollServiceImpl extends ServiceImpl<ShipmentRollMapper, Shi |
|
|
return baseMapper.selectShipmentRollVoList(shipmentRollVo); |
|
|
return baseMapper.selectShipmentRollVoList(shipmentRollVo); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) throws ParseException { |
|
|
|
|
|
LocalDate now = LocalDate.now(); |
|
|
|
|
|
Date date1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse("2024-10-27 00:00:00"); |
|
|
|
|
|
LocalDate date = LocalDate.parse(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date1), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); |
|
|
|
|
|
long days = date.toEpochDay() - now.toEpochDay(); |
|
|
|
|
|
// 判断当前日期 是否在失效日期之前 |
|
|
|
|
|
if (new Date().after(date1) || days <= 20) { |
|
|
|
|
|
throw new RuntimeException(date1 + "超出出货有效期天数"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
@Override |
|
|
@Override |
|
|
@Transactional |
|
|
@Transactional |
|
|
public void insertShipmentRoll(ShipmentRollVo shipmentRollVo) { |
|
|
public void insertShipmentRoll(ShipmentRollVo shipmentRollVo) { |
|
|
@ -70,10 +80,10 @@ public class ShipmentRollServiceImpl extends ServiceImpl<ShipmentRollMapper, Shi |
|
|
try { |
|
|
try { |
|
|
value = Integer.parseInt(effectiveDays); |
|
|
value = Integer.parseInt(effectiveDays); |
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
throw new RuntimeException(rollData.getPartNo() + "的最小失效天数格式不正确"); |
|
|
|
|
|
|
|
|
throw new RuntimeException(rollData.getPartNo() + "的出货有效期天数格式不正确"); |
|
|
} |
|
|
} |
|
|
if (value <= 0) { |
|
|
if (value <= 0) { |
|
|
throw new RuntimeException(rollData.getPartNo() + "的最小失效天数维护不正确"); |
|
|
|
|
|
|
|
|
throw new RuntimeException(rollData.getPartNo() + "的出货有效期天数维护不正确"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
LocalDate now = LocalDate.now(); |
|
|
LocalDate now = LocalDate.now(); |
|
|
@ -81,7 +91,7 @@ public class ShipmentRollServiceImpl extends ServiceImpl<ShipmentRollMapper, Shi |
|
|
long days = date.toEpochDay() - now.toEpochDay(); |
|
|
long days = date.toEpochDay() - now.toEpochDay(); |
|
|
// 判断当前日期 是否在失效日期之前 |
|
|
// 判断当前日期 是否在失效日期之前 |
|
|
if (new Date().after(rollData.getExpiredDate()) || days <= value) { |
|
|
if (new Date().after(rollData.getExpiredDate()) || days <= value) { |
|
|
throw new RuntimeException(rollData.getPartNo() + "在最小失效日期内"); |
|
|
|
|
|
|
|
|
throw new RuntimeException(rollData.getPartNo() + "超出出货有效期天数"); |
|
|
} |
|
|
} |
|
|
value = 0; |
|
|
value = 0; |
|
|
// 获取PartNo 的属性 |
|
|
// 获取PartNo 的属性 |
|
|
@ -89,10 +99,10 @@ public class ShipmentRollServiceImpl extends ServiceImpl<ShipmentRollMapper, Shi |
|
|
try { |
|
|
try { |
|
|
value = Integer.parseInt(packageNum); |
|
|
value = Integer.parseInt(packageNum); |
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
throw new RuntimeException(rollData.getPartNo() + "的出货有效期天数格式不正确"); |
|
|
|
|
|
|
|
|
throw new RuntimeException(rollData.getPartNo() + "的最小包装数量格式不正确"); |
|
|
} |
|
|
} |
|
|
if (value <= 0) { |
|
|
if (value <= 0) { |
|
|
throw new RuntimeException(rollData.getPartNo() + "的出货有效期天数维护不正确"); |
|
|
|
|
|
|
|
|
throw new RuntimeException(rollData.getPartNo() + "的最小包装数量格式维护不正确"); |
|
|
} |
|
|
} |
|
|
// 获取箱子缓存 |
|
|
// 获取箱子缓存 |
|
|
ShipmentBox box = shipmentBoxService.lambdaQuery() |
|
|
ShipmentBox box = shipmentBoxService.lambdaQuery() |
|
|
|