Search in sources :

Example 1 with PanoramicMaterialThresholdConfiguration

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;
}
Also used : PanoramicMaterialThresholdConfiguration(com.monitor.model.materialthresholdconfiguration.PanoramicMaterialThresholdConfiguration) PanoramicDailyInventorySummary(com.monitor.model.dailyinventorysummary.PanoramicDailyInventorySummary) Transactional(org.springframework.transaction.annotation.Transactional)

Example 2 with PanoramicMaterialThresholdConfiguration

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);
}
Also used : Condition(tk.mybatis.mapper.entity.Condition) PanoramicMaterialThresholdConfiguration(com.monitor.model.materialthresholdconfiguration.PanoramicMaterialThresholdConfiguration)

Example 3 with PanoramicMaterialThresholdConfiguration

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);
}
Also used : Condition(tk.mybatis.mapper.entity.Condition) PanoramicMaterialThresholdConfiguration(com.monitor.model.materialthresholdconfiguration.PanoramicMaterialThresholdConfiguration) ApiOperation(io.swagger.annotations.ApiOperation)

Aggregations

PanoramicMaterialThresholdConfiguration (com.monitor.model.materialthresholdconfiguration.PanoramicMaterialThresholdConfiguration)3 Condition (tk.mybatis.mapper.entity.Condition)2 PanoramicDailyInventorySummary (com.monitor.model.dailyinventorysummary.PanoramicDailyInventorySummary)1 ApiOperation (io.swagger.annotations.ApiOperation)1 Transactional (org.springframework.transaction.annotation.Transactional)1