2,3,5楼生产看板接口

master
马雪伟 2 days ago
parent a7c70e552d
commit 5755eb05d8

@ -0,0 +1,32 @@
package com.hw.mes.board.controller;
import com.hw.common.core.web.domain.AjaxResult;
import com.hw.mes.board.service.FifthMesBorderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/fifthMesBorder")
public class FifthMesBorderController {
@Autowired
private FifthMesBorderService fifthMesBorderService;
/**
*
*/
@GetMapping("/productProgress")
public AjaxResult productProgress(){
return AjaxResult.success(fifthMesBorderService.productProgress());
}
/**
*
*/
@GetMapping("/workOrderProgress")
public AjaxResult workOrderProgress(){
return AjaxResult.success(fifthMesBorderService.workOrderProgress());
}
}

@ -0,0 +1,74 @@
package com.hw.mes.board.controller;
import com.hw.common.core.web.domain.AjaxResult;
import com.hw.mes.board.service.SecondMesBorderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/SecondMesBorder")
public class SecondMesBorderController {
@Autowired
private SecondMesBorderService secondBorderService;
/**
*
*/
@GetMapping("selectOrderMonth")
public AjaxResult selectOrderMonth(){
return AjaxResult.success(secondBorderService.selectOrderMonth());
}
/**
*
*/
@GetMapping("/selectLatestWorkOrder")
public AjaxResult selectLatestWorkOrder(){
return AjaxResult.success(secondBorderService.selectLatestWorkOrder());
}
/**
*
* @return
*/
@GetMapping("/getLineStatus")
public AjaxResult getLineStatus(){
return AjaxResult.success(secondBorderService.getLineStatus());
}
/**
* 6
* @return
*/
@GetMapping("/getHourProduction")
public AjaxResult getHourProduction(){
return AjaxResult.success(secondBorderService.getHourProduction());
}
/**
* 7
*/
@GetMapping("/getDayProduction")
public AjaxResult getDayProduction(){
return AjaxResult.success(secondBorderService.getDayProduction());
}
/**
*
*/
@GetMapping("/dustAnalysis")
public AjaxResult dustAnalysis(){
return AjaxResult.success(secondBorderService.dustAnalysis());
}
/**
*
* @return
*/
@GetMapping("/deviceTimeCount")
public AjaxResult deviceTimeCount(){
return AjaxResult.success(secondBorderService.deviceTimeCount());
}
}

@ -0,0 +1,62 @@
package com.hw.mes.board.controller;
import com.hw.common.core.web.domain.AjaxResult;
import com.hw.mes.board.service.ThirdMesBorderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/ThirdMesBorder")
public class ThirdMesBorderController {
@Autowired
private ThirdMesBorderService thirdMesBorderService;
/**
*
*/
@GetMapping("/thirdOrderPlan")
public AjaxResult thirdOrderPlan(){
return AjaxResult.success(thirdMesBorderService.thirdOrderPlan());
}
/**
*
*/
@GetMapping("/getLatestWorkOrder")
public AjaxResult getLatestWorkOrder(){
return AjaxResult.success(thirdMesBorderService.getLatestWorkOrder());
}
/**
* 湿线
*/
@GetMapping("/temperatureAndhumunity")
public AjaxResult temperatureAndhumunity(){
return AjaxResult.success(thirdMesBorderService.temperatureAndhumunity());
}
/**
*
*/
@GetMapping("/productAmount")
public AjaxResult productAmount(){
return AjaxResult.success(thirdMesBorderService.productAmount());
}
/**
* 3
*/
@GetMapping("/productCompleteCount")
public AjaxResult productCompleteCount(){
return AjaxResult.success(thirdMesBorderService.productCompleteCount());
}
/**
* 线
* @return
*/
@GetMapping("/rawInstock")
public AjaxResult rawInstock(){
return AjaxResult.success(thirdMesBorderService.rawInstock());
}
}

@ -0,0 +1,123 @@
package com.hw.mes.board.domain;
import java.io.Serializable;
import java.util.Date;
/**
* (DmsRealtimeStatusHistory)
*
* @author makejava
* @since 2024-11-06 10:57:57
*/
public class DmsRealtimeStatusHistory implements Serializable {
private static final long serialVersionUID = 153296577307956929L;
private Long historyId;
private Long statusId;
/**
*
*/
private String statusCode;
/**
*
*/
private String statusName;
/**
*
*/
private String statusValue;
/**
* id
*/
private Long deviceId;
/**
*
*/
private Date creatTime;
/**
*
*/
private Date updateTime;
/**
*
*/
private Date syncTime;
private Date hour;
private Long timeCount;
public Long getHistoryId() {
return historyId;
}
public void setHistoryId(Long historyId) {
this.historyId = historyId;
}
public Long getStatusId() {
return statusId;
}
public void setStatusId(Long statusId) {
this.statusId = statusId;
}
public String getStatusCode() {
return statusCode;
}
public void setStatusCode(String statusCode) {
this.statusCode = statusCode;
}
public String getStatusName() {
return statusName;
}
public void setStatusName(String statusName) {
this.statusName = statusName;
}
public String getStatusValue() {
return statusValue;
}
public void setStatusValue(String statusValue) {
this.statusValue = statusValue;
}
public Long getDeviceId() {
return deviceId;
}
public void setDeviceId(Long deviceId) {
this.deviceId = deviceId;
}
public Date getCreatTime() {
return creatTime;
}
public void setCreatTime(Date creatTime) {
this.creatTime = creatTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Date getSyncTime() {
return syncTime;
}
public void setSyncTime(Date syncTime) {
this.syncTime = syncTime;
}
}

@ -0,0 +1,13 @@
package com.hw.mes.board.domain;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class RawAmount {
private String materialId;
private BigDecimal inStock;
private BigDecimal outStock;
private String week;
}

@ -0,0 +1,24 @@
package com.hw.mes.board.domain;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
@Data
public class RecordIotenvInstant {
private Long objId;
private String monitorId;
private BigDecimal tempreture;
private BigDecimal humidity;
private BigDecimal illuminance;
private BigDecimal noise;
private BigDecimal concentration;
private BigDecimal pm1;
private BigDecimal pm2;
private BigDecimal pm10;
private BigDecimal standBy;
private Date collectTime;
private Date recodeTime;
}

@ -0,0 +1,14 @@
package com.hw.mes.board.service;
import com.hw.mes.domain.MesProductOrder;
import java.util.List;
import java.util.Map;
public interface FifthMesBorderService {
MesProductOrder productProgress();
List<MesProductOrder> workOrderProgress();
}

@ -0,0 +1,28 @@
package com.hw.mes.board.service;
import com.hw.mes.board.domain.DmsRealtimeStatusHistory;
import com.hw.mes.board.domain.RecordIotenvInstant;
import com.hw.mes.domain.MesProductOrder;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;
public interface SecondMesBorderService {
List<MesProductOrder> selectOrderMonth();
MesProductOrder selectLatestWorkOrder();
Boolean getLineStatus();
List<Map<Date, BigDecimal>> getHourProduction();
List<Map<Date, BigDecimal>> getDayProduction();
List<RecordIotenvInstant> dustAnalysis();
List<DmsRealtimeStatusHistory> deviceTimeCount();
}

@ -0,0 +1,24 @@
package com.hw.mes.board.service;
import com.hw.common.core.web.domain.AjaxResult;
import com.hw.mes.board.domain.RawAmount;
import com.hw.mes.board.domain.RecordIotenvInstant;
import com.hw.mes.domain.MesProductOrder;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
public interface ThirdMesBorderService{
List<MesProductOrder> thirdOrderPlan();
MesProductOrder getLatestWorkOrder();
List<RecordIotenvInstant> temperatureAndhumunity();
List<Map<String,Object>> productAmount();
List<RawAmount> productCompleteCount();
List<RawAmount> rawInstock();
}

@ -0,0 +1,27 @@
package com.hw.mes.board.service.impl;
import com.hw.mes.board.service.FifthMesBorderService;
import com.hw.mes.domain.MesProductOrder;
import com.hw.mes.mapper.MesProductOrderMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class FifthMesBoardServiceImpl implements FifthMesBorderService {
@Autowired
private MesProductOrderMapper mesProductOrderMapper;
@Override
public MesProductOrder productProgress() {
return mesProductOrderMapper.productProgress();
}
@Override
public List<MesProductOrder> workOrderProgress() {
return mesProductOrderMapper.selectFifthWorkorder();
}
}

@ -0,0 +1,55 @@
package com.hw.mes.board.service.impl;
import com.hw.mes.board.domain.DmsRealtimeStatusHistory;
import com.hw.mes.board.domain.RecordIotenvInstant;
import com.hw.mes.board.service.SecondMesBorderService;
import com.hw.mes.domain.MesProductOrder;
import com.hw.mes.mapper.MesProductOrderMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Service
public class SecondMesBoardServiceImpl implements SecondMesBorderService {
@Autowired
private MesProductOrderMapper mesProductOrderMapper;
@Override
public List<MesProductOrder> selectOrderMonth() {
return mesProductOrderMapper.selectOrderMonth();
}
@Override
public MesProductOrder selectLatestWorkOrder() {
return mesProductOrderMapper.selectLatestWorkOrder();
}
@Override
public Boolean getLineStatus() {
return mesProductOrderMapper.getLineStatus();
}
@Override
public List<DmsRealtimeStatusHistory> deviceTimeCount() {
return mesProductOrderMapper.deviceTimeCount();
}
@Override
public List<RecordIotenvInstant> dustAnalysis() {
return mesProductOrderMapper.dustAnalysis();
}
@Override
public List<Map<Date, BigDecimal>> getDayProduction() {
return mesProductOrderMapper.getDayProduction();
}
@Override
public List<Map<Date, BigDecimal>> getHourProduction() {
return mesProductOrderMapper.getHourProduction();
}
}

@ -0,0 +1,64 @@
package com.hw.mes.board.service.impl;
import com.hw.mes.board.domain.RawAmount;
import com.hw.mes.board.domain.RecordIotenvInstant;
import com.hw.mes.board.service.ThirdMesBorderService;
import com.hw.mes.domain.MesProductOrder;
import com.hw.mes.mapper.MesProductOrderMapper;
import com.hw.wms.api.domain.vo.WmsRawStockVo;
import org.springframework.beans.factory.annotation.Autowired;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class ThirdMesBorderServiceImpl implements ThirdMesBorderService {
@Autowired
private MesProductOrderMapper mesProductOrderMapper;
@Override
public MesProductOrder getLatestWorkOrder() {
return mesProductOrderMapper.getLatestWorkOrder();
}
@Override
public List<RecordIotenvInstant> temperatureAndhumunity() {
return mesProductOrderMapper.dustAnalysis();
}
@Override
public List<RawAmount> productCompleteCount() {
List<RawAmount> maps = mesProductOrderMapper.productCompleteCount();
List<RawAmount> maps1 = mesProductOrderMapper.productInstockCount();
List<RawAmount> rawAmounts = new ArrayList<>();
for (RawAmount map : maps) {
for (RawAmount decimalMap : maps1) {
RawAmount rawAmount = new RawAmount();
rawAmount.setMaterialId(map.getMaterialId());
rawAmount.setInStock(map.getInStock());
if (map.getMaterialId().equals(decimalMap.getMaterialId())){
rawAmount.setOutStock(decimalMap.getOutStock());
}
}
}
return rawAmounts;
}
@Override
public List<RawAmount> rawInstock() {
List<RawAmount> list = mesProductOrderMapper.rawInstock();
return list;
}
@Override
public List<Map<String,Object>> productAmount() {
return mesProductOrderMapper.productAmount();
}
@Override
public List<MesProductOrder> thirdOrderPlan() {
return mesProductOrderMapper.thirdOrderPlan();
}
}

@ -1,6 +1,13 @@
package com.hw.mes.mapper; package com.hw.mes.mapper;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map;
import com.hw.mes.board.domain.DmsRealtimeStatusHistory;
import com.hw.mes.board.domain.RawAmount;
import com.hw.mes.board.domain.RecordIotenvInstant;
import com.hw.mes.domain.MesProductOrder; import com.hw.mes.domain.MesProductOrder;
/** /**
@ -84,6 +91,33 @@ public interface MesProductOrderMapper
public List<MesProductOrder> selectMesProductOrderJoinList(MesProductOrder mesProductOrder); public List<MesProductOrder> selectMesProductOrderJoinList(MesProductOrder mesProductOrder);
List<MesProductOrder> selectOrderMonth();
MesProductOrder selectLatestWorkOrder();
Boolean getLineStatus();
List<Map<Date, BigDecimal>> getHourProduction();
List<Map<Date, BigDecimal>> getDayProduction();
List<RecordIotenvInstant> dustAnalysis();
List<DmsRealtimeStatusHistory> deviceTimeCount();
MesProductOrder productProgress();
List<MesProductOrder> selectFifthWorkorder();
MesProductOrder getLatestWorkOrder();
List<RawAmount> productCompleteCount();
List<RawAmount> productInstockCount();
List<RawAmount> rawInstock();
List<Map<String, Object>> productAmount();
List<MesProductOrder> thirdOrderPlan();
} }

@ -385,7 +385,140 @@
</where> </where>
order by mpo.product_order_id desc order by mpo.product_order_id desc
</select> </select>
<select id="selectOrderMonth" resultType="com.hw.mes.domain.MesProductOrder">
SELECT *
FROM mes_product_order
WHERE plan_begin_time > DATE_SUB(CURDATE(), INTERVAL 1 MONTH) order by plan_begin_time desc
</select>
<select id="selectLatestWorkOrder" resultType="com.hw.mes.domain.MesProductOrder">
SELECT *
FROM mes_product_order
WHERE plan_begin_time = (select max(plan_begin_time) FROM mes_product_order) order by product_order_id desc limit 1
</select>
<select id="getLineStatus" resultType="java.lang.Boolean">
SELECT x.status_value FROM `hwjy-cloud`.dms_realtime_status x where x.status_name = '烘干机风机状态'
</select>
<select id="getHourProduction" resultType="java.util.Map">
select
date_format(begin_time , '%Y-%m-%d %H:00:00') as hour,
sum(instock_amount) as amount
from
wms_product_instock
where
begin_time > now() -interval 6 hour and warehouse_id = 231
group by hour order by hour asc
</select>
<select id="getDayProduction" resultType="java.util.Map">
select
date_format(begin_time , '%Y-%m-%d 00:00:00') as day,
sum(instock_amount) as instock_amount
from
wms_product_instock
where
begin_time > now() -interval 7 day and warehouse_id = 231
group by hour order by hour desc
</select>
<select id="dustAnalysis" resultType="com.hw.mes.board.domain.RecordIotenvInstant">
SELECT x.* FROM `hwjy-cloud`.record_iotenv_instant x order by x.collectTime desc limit 10
</select>
<select id="deviceTimeCount" resultType="com.hw.mes.board.domain.DmsRealtimeStatusHistory">
select
DATE_FORMAT(sync_time , '%Y-%m-%d %H:00:00') as hour,count(1)*10 timeCount
from
dms_realtime_status_history
where
sync_time > now() - interval 7 hour
and status_value = true
and status_name = '烘干机风机状态'
group by hour
</select>
<select id="productProgress" resultType="com.hw.mes.domain.MesProductOrder">
SELECT x.* FROM `hwjy-cloud`.mes_product_order x where x.dispatch_id =4 order by x.real_begin_time desc limit 1
</select>
<select id="selectFifthWorkorder" resultType="com.hw.mes.domain.MesProductOrder">
select
x.*
from
`hwjy-cloud`.mes_product_order x
where
x.dispatch_id = 4
and x.real_begin_time > now() - interval 1 month
order by
x.real_begin_time asc
</select>
<select id="getLatestWorkOrder" resultType="com.hw.mes.domain.MesProductOrder">
SELECT x.* FROM `hwjy-cloud`.mes_product_order x where x.plan_begin_time > now() - interval 1 month order by plan_begin_time asc LIMIT 1
</select>
<select id="productCompleteCount" resultType="com.hw.mes.board.domain.RawAmount">
select
x.material_id materialId,
sum(x.instock_amount) inStock
from
`hwjy-cloud`.wms_raw_instock x
where
x.warehouse_id = 311
and x.apply_date > now() - interval 1 month
group by
material_id
</select>
<select id="productInstockCount" resultType="com.hw.mes.board.domain.RawAmount">
select
x.material_id materialId,
sum(x.real_outstock_amount) outStock
from
`hwjy-cloud`.wms_raw_outstock x
where
x.warehouse_id = 311
and x.apply_date > now() - interval 1 month
group by
material_id
</select>
<select id="rawInstock" resultType="com.hw.mes.board.domain.RawAmount">
SELECT
WEEK(apply_date) AS week,
sum(instock_amount) inStock
FROM
wms_raw_instock
WHERE
apply_date >= DATE_SUB(CURDATE(), INTERVAL 1 MONTH)
GROUP BY
week
ORDER BY
week;
</select>
<select id="productAmount" resultType="java.util.Map">
select
DATE_FORMAT(begin_time , '%Y-%m-%d 00:00:00') day,
sum(instock_amount) instockAmount
from
`hwjy-cloud`.wms_product_instock x
where
begin_time > now() - interval 1 month
group by
day
order by
day asc
</select>
<select id="thirdOrderPlan" resultType="com.hw.mes.domain.MesProductOrder">
SELECT x.* FROM `hwjy-cloud`.mes_product_order x where x.plan_begin_time > now() - interval 1 month order by plan_begin_time asc
</select>
<!--查询24小时内每小时的最新一条数据-->
<!-- SELECT-->
<!-- mes_product_order.*-->
<!-- FROM-->
<!-- mes_product_order-->
<!-- INNER JOIN (-->
<!-- select-->
<!-- DATE_FORMAT(create_time , '%Y-%m-%d %H:00:00') as hour,-->
<!-- MAX(create_time) as latest_timestamp-->
<!-- FROM-->
<!-- mes_product_order-->
<!-- WHERE-->
<!-- create_time > NOW() - INTERVAL 24 HOUR-->
<!-- GROUP BY-->
<!-- hour-->
<!-- ) as latest_records ON mes_product_order.create_time = latest_records.latest_timestamp;-->
</mapper> </mapper>

Loading…
Cancel
Save