| | |
| | | import com.ld.igds.data.BaseParam; |
| | | import com.ld.igds.data.Page; |
| | | import com.ld.igds.data.PageResponse; |
| | | import com.ld.igds.data.SimpleDepot; |
| | | import com.ld.igds.grain.dto.GrainData; |
| | | import com.ld.igds.grain.service.CoreGrainService; |
| | | import com.ld.igds.inout.dto.InoutParam; |
| | | import com.ld.igds.models.*; |
| | | import com.ld.igds.sys.service.DicTriggerService; |
| | | import com.ld.igds.sys.service.SysDeptService; |
| | |
| | | import com.ld.igds.warn.data.WarnParam; |
| | | import com.ld.igds.warn.service.CoreWarnService; |
| | | import com.ld.igds.weather.CoreWeatherService; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | private CoreWarnService coreWarnService; |
| | | @Resource |
| | | private RedisUtil redisUtil; |
| | | |
| | | |
| | | /** |
| | | * 获取入库的下拉框 |
| | | * 获取入库作业中,仓库下拉框,值获取状态=非满仓的粮库 |
| | | * |
| | | * @return |
| | | */ |
| | | public List<Depot> listInDepot() { |
| | | List<Depot> list = listDepot(true); |
| | | return list; |
| | | public List<SimpleDepot> getCacheDeptIn(String companyId, String deptId) { |
| | | |
| | | List<SimpleDepot> result = new ArrayList<>(); |
| | | List<Depot> list = coreCommonService.getCacheDepotList(companyId, deptId); |
| | | |
| | | for (Depot depot : list) { |
| | | if (DepotStatus.STATUS_3.getCode().equals(depot.getDepotStatus())) continue; |
| | | if (DepotStatus.STATUS_31.getCode().equals(depot.getDepotStatus())) continue; |
| | | if (DepotStatus.STATUS_32.getCode().equals(depot.getDepotStatus())) continue; |
| | | if (DepotStatus.STATUS_33.getCode().equals(depot.getDepotStatus())) continue; |
| | | if (DepotStatus.STATUS_34.getCode().equals(depot.getDepotStatus())) continue; |
| | | |
| | | result.add(new SimpleDepot(depot)); |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 获取出库的下拉框 |
| | | * 获取出库下拉框列表,自动屏蔽空仓 |
| | | * |
| | | * @return |
| | | */ |
| | | public List<Depot> listOutDepot() { |
| | | List<Depot> list = listDepot(true); |
| | | public List<SimpleDepot> getCacheDeptOut(String companyId, String deptId) { |
| | | List<SimpleDepot> result = new ArrayList<>(); |
| | | List<Depot> list = coreCommonService.getCacheDepotList(companyId, deptId); |
| | | |
| | | return list; |
| | | for (Depot depot : list) { |
| | | if (DepotStatus.STATUS_1.getCode().equals(depot.getDepotStatus())) continue; |
| | | if (DepotStatus.STATUS_2.getCode().equals(depot.getDepotStatus())) continue; |
| | | |
| | | result.add(new SimpleDepot(depot)); |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | |
| | | /** |
| | | * 查询部门下属所有仓库列表 |
| | | * |
| | | * @param isDelOther |
| | | * @param companyId |
| | | * @param deptId |
| | | * @return |
| | | */ |
| | | public List<Depot> listDepotByDeptId(boolean isDelOther, String deptId) { |
| | | String companyId = ContextUtil.getCompanyId(); |
| | | |
| | | if (StringUtils.isEmpty(deptId)) { |
| | | return null; |
| | | } |
| | | |
| | | List<Depot> list = coreCommonService.getCacheDepotList(companyId); |
| | | if (null == list || list.isEmpty()) { |
| | | return list; |
| | | } |
| | | |
| | | List<Depot> listDepot = new ArrayList<>(); |
| | | for (Depot depot : list) { |
| | | if (depot.getDeptId().contains(deptId)) { |
| | | listDepot.add(depot); |
| | | } |
| | | } |
| | | |
| | | // 删除非仓库列表 |
| | | if (isDelOther) { |
| | | return listDepot |
| | | .stream() |
| | | .filter(item -> !item.getDepotType().equals( |
| | | DepotType.TYPE_99.getCode())).collect(Collectors.toList()); |
| | | } |
| | | |
| | | return listDepot; |
| | | public List<Depot> listDepotByDeptId(String companyId, String deptId) { |
| | | return coreCommonService.getCacheDepotList(companyId, deptId); |
| | | } |
| | | |
| | | /** |
| | |
| | | return new PageResponse<>(RespCodeEnum.CODE_0000, data); |
| | | } |
| | | |
| | | public PageResponse<Page<DicFoodOrigin>> pageFoodLocation(InoutParam param) { |
| | | |
| | | Page<DicFoodOrigin> result = coreDicService.pageFoodLocation(param); |
| | | |
| | | if (null == result.getRecords() || result.getRecords().isEmpty()) { |
| | | return new PageResponse<>(RespCodeEnum.CODE_2000.getCode(), |
| | | "获取到数据信息为空"); |
| | | } |
| | | return new PageResponse<Page<DicFoodOrigin>>(RespCodeEnum.CODE_0000, |
| | | result); |
| | | } |
| | | |
| | | |
| | | public DepotConf getDepotConf(String companyId, String depotId) { |
| | | return coreCommonService.getCacheDepotConf(companyId, depotId); |
| | |
| | | log.debug("----------------根据用户IP获取选择-地磅----{}", userIp); |
| | | |
| | | String key = "INOUT:WEIGHT:" + userIp; |
| | | |
| | | return (String) redisUtil.get(key); |
| | | String sort = (String)redisUtil.get(key); |
| | | if(StringUtils.isEmpty(sort))sort="1"; |
| | | return sort; |
| | | } |
| | | |
| | | /** |
| | |
| | | return (String) redisUtil.get(key); |
| | | } |
| | | |
| | | public Page<DicArea> pageDicArea(BaseParam param) { |
| | | |
| | | Page<DicArea> page = new Page<>(param.getPage(), param.getLimit()); |
| | | |
| | | List<DicArea> list = coreDicService.listDicArea(page, param); |
| | | page.setRecords(list); |
| | | |
| | | return page; |
| | | } |
| | | |
| | | |
| | | } |