hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstoragecagetask/controller/BigStorageCageHistoryTaskController.java
@@ -4,6 +4,7 @@ import com.mes.bigstoragecagetask.entity.BigStorageCageHistoryTask; import com.mes.bigstoragecagetask.entity.request.BigStorageCageHistoryRequest; import com.mes.bigstoragecagetask.service.BigStorageCageHistoryTaskService; import com.mes.largenscreen.entity.DailyProductionVO; import com.mes.utils.Result; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -14,7 +15,6 @@ import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import java.util.List; /** * @Author : zhoush @@ -34,4 +34,10 @@ public Result<Page<BigStorageCageHistoryTask>> queryBigStorageCageHistoryTask(@RequestBody @Validated BigStorageCageHistoryRequest request) { return Result.build(200, "查询成功", bigStorageCageHistoryTaskService.queryBigStorageCageHistoryTask(request)); } @ApiOperation(value = "查询本条线历史指定日期的日生产数据", notes = "查询本条线历史指定日期的日生产数据") @PostMapping("/queryBigDailyProduction") public Result<DailyProductionVO> queryBigDailyProduction(@RequestBody BigStorageCageHistoryRequest request) { return Result.success(bigStorageCageHistoryTaskService.queryBigDailyProduction(request)); } } hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstoragecagetask/mapper/BigStorageCageHistoryTaskMapper.java
@@ -3,6 +3,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.mes.bigstoragecagetask.entity.BigStorageCageHistoryTask; import com.mes.largenscreen.entity.DailyProductionVO; import org.apache.ibatis.annotations.Param; /** * (BigStorageCageHistoryTask)表数据库访问层 @@ -12,5 +14,6 @@ */ public interface BigStorageCageHistoryTaskMapper extends BaseMapper<BigStorageCageHistoryTask> { DailyProductionVO queryBigDailyProduction(@Param("beginDate") String beginDate, @Param("endDate") String endDate); } hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstoragecagetask/service/BigStorageCageHistoryTaskService.java
@@ -5,8 +5,7 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.mes.bigstoragecagetask.entity.BigStorageCageHistoryTask; import com.mes.bigstoragecagetask.entity.request.BigStorageCageHistoryRequest; import java.util.List; import com.mes.largenscreen.entity.DailyProductionVO; /** * (BigStorageCageHistoryTask)表服务接口 @@ -17,5 +16,7 @@ public interface BigStorageCageHistoryTaskService extends IService<BigStorageCageHistoryTask> { Page<BigStorageCageHistoryTask> queryBigStorageCageHistoryTask(BigStorageCageHistoryRequest request); DailyProductionVO queryBigDailyProduction(BigStorageCageHistoryRequest request); } hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstoragecagetask/service/impl/BigStorageCageHistoryTaskServiceImpl.java
@@ -10,8 +10,11 @@ import com.mes.bigstoragecagetask.entity.request.BigStorageCageHistoryRequest; import com.mes.bigstoragecagetask.mapper.BigStorageCageHistoryTaskMapper; import com.mes.bigstoragecagetask.service.BigStorageCageHistoryTaskService; import com.mes.largenscreen.entity.DailyProductionVO; import com.mes.tools.DateUtil; import org.springframework.stereotype.Service; import java.text.SimpleDateFormat; /** * (BigStorageCageHistoryTask)表服务实现类 @@ -39,5 +42,17 @@ .orderByDesc(BigStorageCageHistoryTask::getCreateTime); return this.page(page, wrapper); } @Override public DailyProductionVO queryBigDailyProduction(BigStorageCageHistoryRequest request) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); String beginDate = null; String endDate = null; if (com.baomidou.mybatisplus.core.toolkit.StringUtils.checkValNotNull(request.getBeginDate())) { beginDate = sdf.format(request.getBeginDate()); endDate = sdf.format(request.getEndDate()); } return baseMapper.queryBigDailyProduction(beginDate, endDate); } } hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/mapper/BigStorageCageHistoryTaskMapper.xml
New file @@ -0,0 +1,48 @@ <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > <mapper namespace="com.mes.bigstoragecagetask.mapper.BigStorageCageHistoryTaskMapper"> <resultMap id="baseMap" type="com.mes.largenscreen.entity.DailyProductionVO"> <result column="date" property="date"/> <result column="count_out_one" property="countOutOne"/> <result column="total_area_out_one" property="totalAreaOutOne"/> <result column="count_out_two" property="countOutTwo"/> <result column="total_area_out_two" property="totalAreaOutTwo"/> <result column="count_in" property="countIn"/> <result column="total_area_in" property="totalAreaIn"/> <result column="count_out" property="countOut"/> <result column="total_area_out" property="totalAreaOut"/> <result column="hollow_count_out_one" property="hollowCountOutOne"/> <result column="hollow_total_area_out_one" property="hollowTotalAreaOutOne"/> <result column="hollow_count_out_two" property="hollowCountOutTwo"/> <result column="hollow_total_area_out_two" property="hollowTotalAreaOutTwo"/> </resultMap> <select id="queryBigDailyProduction" resultMap="baseMap"> with big_storage_in_temp as ( select count(t.glass_id) as count_in, round(sum(t1.width * t1.height) / 1000000, 2) as total_area_in from big_storage_cage_history_task t INNER JOIN glass_info t1 on t.glass_id = t1.glass_id where t.task_type = 1 <if test="beginDate != null and beginDate != ''"> AND STR_TO_DATE( t.create_time, '%Y-%m-%d' ) BETWEEN #{beginDate} AND #{endDate} </if> ), big_storage_out_temp as ( select count(t.glass_id) as count_out, round(sum(t1.width * t1.height) / 1000000, 2) as total_area_out from big_storage_cage_history_task t INNER JOIN glass_info t1 on t.glass_id = t1.glass_id where t.task_type = 2 <if test="beginDate != null and beginDate != ''"> AND STR_TO_DATE( t.create_time, '%Y-%m-%d' ) BETWEEN #{beginDate} AND #{endDate} </if> ) select * from big_storage_in_temp INNER join big_storage_out_temp on 1 = 1 </select> </mapper> hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassOutRelationInfoServiceImpl.java
@@ -363,6 +363,7 @@ if (930 == request.getCell()) { Map<Integer, List<HollowBigStorageCageDetails>> listMap = hollowBigStorageCageDetailsList.stream() .collect(Collectors.groupingBy(HollowBigStorageCageDetails::getHollowSequence)); List<List<HollowGlassQueueInfo>> disorderList = new ArrayList<>(); for (Map.Entry<Integer, List<HollowBigStorageCageDetails>> entry : listMap.entrySet()) { //创建队列接收不满足成对情况下:一对玻璃分几次上车的次序问题 List<HollowGlassQueueInfo> tempList = new ArrayList<>(); @@ -372,7 +373,7 @@ for (HollowBigStorageCageDetails item : reverse) { remainWidth = remainWidth - (int) Math.max(item.getWidth(), item.getHeight()); if (remainWidth < 0) { hollowQueues.addAll(CollectionUtil.reverse(tempList)); disorderList.add(CollectionUtil.reverse(tempList)); tempList = new ArrayList<>(); remainWidth = carWidth - (int) Math.max(item.getWidth(), item.getHeight()); } @@ -380,7 +381,7 @@ tempList.add(queueInfo); remainWidth = remainWidth - glassGap; } hollowQueues.addAll(CollectionUtil.reverse(tempList)); disorderList.add(CollectionUtil.reverse(tempList)); HollowBigStorageCageDetails cageDetails = entry.getValue().get(0); if (cageDetails.getIsPair() == 1) { isPairCount = isPairCount - cageDetails.getTotalLayer(); @@ -389,6 +390,11 @@ } } } //防止玻璃中空线玻璃无序,将玻璃按照顺序重新排序 Collections.sort(disorderList, (s1, s2) -> s1.get(0).getHollowSequence() - s2.get(0).getHollowSequence()); for (List<HollowGlassQueueInfo> list : disorderList) { hollowQueues.addAll(list); } } else { loop: for (HollowBigStorageCageDetails item : hollowBigStorageCageDetailsList) { hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollowtask/controller/HollowBigStorageCageHistoryTaskController.java
@@ -5,6 +5,7 @@ import com.mes.hollowtask.entity.HollowBigStorageCageHistoryTask; import com.mes.hollowtask.entity.request.HollowBigStorageCageHistoryRequest; import com.mes.hollowtask.service.HollowBigStorageCageHistoryTaskService; import com.mes.largenscreen.entity.DailyProductionVO; import com.mes.utils.Result; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -15,7 +16,6 @@ import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import java.util.List; /** * (HollowBigStorageCageHistoryTask)表控制层 @@ -36,5 +36,11 @@ public Result<Page<HollowBigStorageCageHistoryTask>> queryHollowBigStorageCageHistoryTask(@RequestBody @Validated HollowBigStorageCageHistoryRequest request) { return Result.build(200, "查询成功", hollowBigStorageCageHistoryTaskService.queryHollowBigStorageCageHistoryTask(request)); } @ApiOperation(value = "查询本条线历史指定日期的日生产数据", notes = "查询本条线历史指定日期的日生产数据") @PostMapping("/queryHollowDailyProduction") public Result<DailyProductionVO> queryHollowDailyProduction(@RequestBody HollowBigStorageCageHistoryRequest request) { return Result.success(hollowBigStorageCageHistoryTaskService.queryHollowDailyProduction(request)); } } hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollowtask/mapper/HollowBigStorageCageHistoryTaskMapper.java
@@ -2,6 +2,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.mes.hollowtask.entity.HollowBigStorageCageHistoryTask; import com.mes.largenscreen.entity.DailyProductionVO; import org.apache.ibatis.annotations.Param; /** * (HollowBigStorageCageHistoryTask)表数据库访问层 @@ -11,5 +13,6 @@ */ public interface HollowBigStorageCageHistoryTaskMapper extends BaseMapper<HollowBigStorageCageHistoryTask> { DailyProductionVO queryHollowDailyProduction(@Param("beginDate") String beginDate, @Param("endDate") String endDate); } hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollowtask/service/HollowBigStorageCageHistoryTaskService.java
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.mes.hollowtask.entity.HollowBigStorageCageHistoryTask; import com.mes.hollowtask.entity.request.HollowBigStorageCageHistoryRequest; import com.mes.largenscreen.entity.DailyProductionVO; /** * (HollowBigStorageCageHistoryTask)表服务接口 @@ -14,5 +15,7 @@ public interface HollowBigStorageCageHistoryTaskService extends IService<HollowBigStorageCageHistoryTask> { Page<HollowBigStorageCageHistoryTask> queryHollowBigStorageCageHistoryTask(HollowBigStorageCageHistoryRequest request); DailyProductionVO queryHollowDailyProduction(HollowBigStorageCageHistoryRequest request); } hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollowtask/service/impl/HollowBigStorageCageHistoryTaskServiceImpl.java
@@ -9,8 +9,11 @@ import com.mes.hollowtask.entity.request.HollowBigStorageCageHistoryRequest; import com.mes.hollowtask.mapper.HollowBigStorageCageHistoryTaskMapper; import com.mes.hollowtask.service.HollowBigStorageCageHistoryTaskService; import com.mes.largenscreen.entity.DailyProductionVO; import com.mes.tools.DateUtil; import org.springframework.stereotype.Service; import java.text.SimpleDateFormat; /** * (HollowBigStorageCageHistoryTask)表服务实现类 @@ -38,5 +41,17 @@ .orderByDesc(HollowBigStorageCageHistoryTask::getCreateTime); return this.page(page,wrapper); } @Override public DailyProductionVO queryHollowDailyProduction(HollowBigStorageCageHistoryRequest request) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); String beginDate = null; String endDate = null; if (com.baomidou.mybatisplus.core.toolkit.StringUtils.checkValNotNull(request.getBeginDate())) { beginDate = sdf.format(request.getBeginDate()); endDate = sdf.format(request.getEndDate()); } return baseMapper.queryHollowDailyProduction(beginDate, endDate); } } hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/mapper/HollowBigStorageCageHistoryTaskMapper.xml
New file @@ -0,0 +1,50 @@ <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > <mapper namespace="com.mes.hollowtask.mapper.HollowBigStorageCageHistoryTaskMapper"> <resultMap id="baseMap" type="com.mes.largenscreen.entity.DailyProductionVO"> <result column="date" property="date"/> <result column="count_out_one" property="countOutOne"/> <result column="total_area_out_one" property="totalAreaOutOne"/> <result column="count_out_two" property="countOutTwo"/> <result column="total_area_out_two" property="totalAreaOutTwo"/> <result column="count_in" property="countIn"/> <result column="total_area_in" property="totalAreaIn"/> <result column="count_out" property="countOut"/> <result column="total_area_out" property="totalAreaOut"/> <result column="hollow_count_out_one" property="hollowCountOutOne"/> <result column="hollow_total_area_out_one" property="hollowTotalAreaOutOne"/> <result column="hollow_count_out_two" property="hollowCountOutTwo"/> <result column="hollow_total_area_out_two" property="hollowTotalAreaOutTwo"/> </resultMap> <select id="queryHollowDailyProduction" resultMap="baseMap"> with hollow_out_one_temp as ( select count(t.glass_id) as hollow_count_out_one, round(sum(t1.width * t1.height) / 1000000, 2) as hollow_total_area_out_one from hollow_big_storage_cage_history_task t INNER JOIN glass_info t1 on t.glass_id = t1.glass_id where t.task_type = 5 and t.target_slot = 930 <if test="beginDate != null and beginDate != ''"> AND STR_TO_DATE( t.create_time, '%Y-%m-%d' ) BETWEEN #{beginDate} AND #{endDate} </if> ), hollow_out_two_temp as ( select count(t.glass_id) as hollow_count_out_two, round(sum(t1.width * t1.height) / 1000000, 2) as hollow_total_area_out_two from hollow_big_storage_cage_history_task t INNER JOIN glass_info t1 on t.glass_id = t1.glass_id where t.task_type = 5 and t.target_slot = 931 <if test="beginDate != null and beginDate != ''"> AND STR_TO_DATE( t.create_time, '%Y-%m-%d' ) BETWEEN #{beginDate} AND #{endDate} </if> ) select * from hollow_out_one_temp inner join hollow_out_two_temp on 1 = 1 </select> </mapper>