use of com.monitor.model.materialthresholdconfiguration.PanoramicMaterialThresholdConfiguration in project new-cloud by xie-summer.
the class PanoramicDailyInventorySummaryServiceImpl method check.
@Override
@Transactional(propagation = Propagation.NOT_SUPPORTED, rollbackFor = Exception.class)
public Map<String, String> check(List<String> codeList, String date) {
Map<String, String> result = Maps.newHashMap();
codeList.forEach((String e) -> {
PanoramicDailyInventorySummary dailyInventorySummary = this.queryByDateAndCode(e, date);
PanoramicMaterialThresholdConfiguration configuration = materialThresholdConfigurationService.findByCode(ThresholdConfigConstant.STOCK, e);
result.put(e, ExceptionRecordStatusEnum.normal.getCode());
if (!Optional.ofNullable(configuration).isPresent()) {
// 3 库存配置异常
result.put(e, ExceptionRecordStatusEnum.configuration.getCode());
} else if ((!Optional.ofNullable(dailyInventorySummary).isPresent()) || dailyInventorySummary.getValue() < configuration.getLowerLimit()) {
// 1:库存偏低
result.put(e, ExceptionRecordStatusEnum.low.getCode());
} else if (dailyInventorySummary.getValue() > configuration.getUpperLimit()) {
result.put(e, ExceptionRecordStatusEnum.high.getCode());
}
});
return result;
}
use of com.monitor.model.materialthresholdconfiguration.PanoramicMaterialThresholdConfiguration in project new-cloud by xie-summer.
the class PanoramicMaterialThresholdConfigurationServiceImpl method findByCode.
@Override
public PanoramicMaterialThresholdConfiguration findByCode(String category, String code) {
Condition condition = new Condition(PanoramicMaterialThresholdConfiguration.class, false);
condition.createCriteria().andCondition("code ='" + code + "' and status =1 and delete_flag =1");
List<PanoramicMaterialThresholdConfiguration> configurationList = materialThresholdConfigurationMapper.selectByCondition(condition);
return (null == configurationList || configurationList.size() == 0) ? null : configurationList.get(0);
}
use of com.monitor.model.materialthresholdconfiguration.PanoramicMaterialThresholdConfiguration in project new-cloud by xie-summer.
the class PanoramicMaterialThresholdConfigurationController method listByCategory.
/**
* 根据category查询所有物料上下线配置
*
* @param category
* @return
*/
@ApiOperation(value = "根据category查询所有物料上下线配置接口", notes = "根据category查询所有物料上下线配置")
@GetMapping("/list/{category}")
public ResultCode<List<PanoramicMaterialThresholdConfiguration>> listByCategory(@PathVariable("category") String category) {
Condition condition = new Condition(PanoramicMaterialThresholdConfiguration.class, false);
condition.createCriteria().andCondition("category ='" + category + "' and status =1 and delete_flag =1");
List<PanoramicMaterialThresholdConfiguration> list = materialThresholdConfigurationService.findByCondition(condition);
return ResultCode.getSuccessReturn(list);
}
Aggregations