package com.thhy.screen.modules.biz.bigscreen.service.impl;
|
|
import com.thhy.general.config.SysUserInfo;
|
import com.thhy.general.utils.UserInfoUtils;
|
import com.thhy.screen.modules.biz.agv.entity.AgvStateHistory;
|
import com.thhy.screen.modules.biz.agv.mapper.AgvStateHistoryMapper;
|
import com.thhy.screen.modules.biz.bigscreen.entity.*;
|
import com.thhy.screen.modules.biz.bigscreen.mapper.BigScreenMapper;
|
import com.thhy.screen.modules.biz.bigscreen.service.ProduceListenService;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Service;
|
|
import java.math.BigDecimal;
|
import java.math.RoundingMode;
|
import java.util.HashMap;
|
import java.util.List;
|
import java.util.Map;
|
|
@Service
|
public class ProduceListenServiceImpl implements ProduceListenService {
|
|
@Autowired
|
private BigScreenMapper bigScreenMapper;
|
|
@Autowired
|
private AgvStateHistoryMapper historyMapper;
|
|
@Override
|
public Map<String, Object> initProListen(String token) {
|
SysUserInfo userInfo = UserInfoUtils.getInstance().getUserInfo(token);
|
String companyId = userInfo.getCompanyId();
|
Map<String,Object> map = new HashMap<>();
|
//年度生产计划和实际完成
|
List<PipeYearCount> yearCountList = bigScreenMapper.queryAllProject(companyId);
|
yearCountList.forEach(yc ->{
|
PipePlanActual pipePlanActual = bigScreenMapper.pipePlanActual(companyId,yc.getProId());
|
pipePlanActual.setPlanProduct(yc.getPlanOutput());
|
BigDecimal rate = new BigDecimal(0);
|
if(pipePlanActual.getRingCount()!=0&&yc.getPlanOutput()!=0){
|
rate = new BigDecimal(pipePlanActual.getRingCount()).divide(new BigDecimal(yc.getPlanOutput()),2, RoundingMode.HALF_UP).multiply(new BigDecimal(100));
|
}
|
pipePlanActual.setCompleteRate(rate);
|
yc.setPipePlanActual(pipePlanActual);
|
});
|
|
map.put("pipePlanActual",yearCountList);
|
//月度生产计划和实际完成
|
List<PipeMonthPlanActual> pipeMonthPlanActuals = bigScreenMapper.pipeMonthPlanActual(companyId);
|
map.put("pipeMonthPlanActual",pipeMonthPlanActuals);
|
//原料消耗 周月
|
List<MaterialWeekAndMonth> materialWeekAndMonths = bigScreenMapper.materialWeekMonth(companyId);
|
map.put("materialWeekAndMonths",materialWeekAndMonths);
|
//水养池
|
List<WaterCulInfo> culInfoList = bigScreenMapper.WaterCulInfo(companyId);
|
map.put("waterCulInfo",culInfoList);
|
//堆场
|
List<RepoInfo> repoInfoList = bigScreenMapper.repoInfo(companyId);
|
map.put("repoInfo",repoInfoList);
|
//发运
|
List<SendInfo> sendInfoList = bigScreenMapper.sendInfo(companyId);
|
map.put("sendInfo",sendInfoList);
|
return map;
|
}
|
|
@Override
|
public Map<String, Object> getDisplay() {
|
return bigScreenMapper.displayText();
|
}
|
|
@Override
|
public List<AgvStateHistory> agv() {
|
return historyMapper.leastData();
|
}
|
|
@Override
|
public List<PipeYearCount> monthProductRingByPro(String token) {
|
SysUserInfo userInfo = UserInfoUtils.getInstance().getUserInfo(token);
|
List<PipeYearCount> yearCountList = bigScreenMapper.queryAllProject(userInfo.getCompanyId());
|
yearCountList.forEach(yc ->{
|
List<HashMap<String,Object>> monthList = bigScreenMapper.monthRingNumByPro(userInfo.getCompanyId(), yc.getProId());
|
yc.setMonthList(monthList);
|
});
|
return yearCountList;
|
}
|
}
|