2,3,5楼看板接口修改,及5楼仓储调度任务,库位占用率

master
马雪伟 2 days ago
parent 6537852996
commit 577322e4c1

@ -45,7 +45,13 @@ public class DmsRealtimeStatusHistory implements Serializable {
private Date syncTime; private Date syncTime;
private Date hour; private Date hour;
private Long timeCount; private Long timeCount;
public Long getTimeCount() {
return timeCount;
}
public void setTimeCount(Long timeCount) {
this.timeCount = timeCount;
}
public Long getHistoryId() { public Long getHistoryId() {
return historyId; return historyId;
@ -118,6 +124,13 @@ public class DmsRealtimeStatusHistory implements Serializable {
public void setSyncTime(Date syncTime) { public void setSyncTime(Date syncTime) {
this.syncTime = syncTime; this.syncTime = syncTime;
} }
public Date getHour() {
return hour;
}
public void setHour(Date hour) {
this.hour = hour;
}
} }

@ -1,11 +1,9 @@
package com.hw.mes.board.service; 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.RawAmount;
import com.hw.mes.board.domain.RecordIotenvInstant; import com.hw.mes.board.domain.RecordIotenvInstant;
import com.hw.mes.domain.MesProductOrder; import com.hw.mes.domain.MesProductOrder;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;

@ -5,14 +5,13 @@ import com.hw.mes.board.domain.RecordIotenvInstant;
import com.hw.mes.board.service.ThirdMesBorderService; import com.hw.mes.board.service.ThirdMesBorderService;
import com.hw.mes.domain.MesProductOrder; import com.hw.mes.domain.MesProductOrder;
import com.hw.mes.mapper.MesProductOrderMapper; import com.hw.mes.mapper.MesProductOrderMapper;
import com.hw.wms.api.domain.vo.WmsRawStockVo;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@Service
public class ThirdMesBorderServiceImpl implements ThirdMesBorderService { public class ThirdMesBorderServiceImpl implements ThirdMesBorderService {
@Autowired @Autowired
private MesProductOrderMapper mesProductOrderMapper; private MesProductOrderMapper mesProductOrderMapper;
@ -39,6 +38,7 @@ public class ThirdMesBorderServiceImpl implements ThirdMesBorderService {
rawAmount.setInStock(map.getInStock()); rawAmount.setInStock(map.getInStock());
if (map.getMaterialId().equals(decimalMap.getMaterialId())){ if (map.getMaterialId().equals(decimalMap.getMaterialId())){
rawAmount.setOutStock(decimalMap.getOutStock()); rawAmount.setOutStock(decimalMap.getOutStock());
rawAmounts.add(rawAmount);
} }
} }
} }

@ -9,6 +9,7 @@ import com.hw.mes.board.domain.DmsRealtimeStatusHistory;
import com.hw.mes.board.domain.RawAmount; import com.hw.mes.board.domain.RawAmount;
import com.hw.mes.board.domain.RecordIotenvInstant; import com.hw.mes.board.domain.RecordIotenvInstant;
import com.hw.mes.domain.MesProductOrder; import com.hw.mes.domain.MesProductOrder;
import org.apache.ibatis.annotations.Mapper;
/** /**
* Mapper * Mapper
@ -16,6 +17,7 @@ import com.hw.mes.domain.MesProductOrder;
* @author Yinq * @author Yinq
* @date 2024-02-20 * @date 2024-02-20
*/ */
@Mapper
public interface MesProductOrderMapper public interface MesProductOrderMapper
{ {
/** /**

@ -416,19 +416,19 @@
wms_product_instock wms_product_instock
where where
begin_time > now() -interval 7 day and warehouse_id = 231 begin_time > now() -interval 7 day and warehouse_id = 231
group by hour order by hour desc group by day order by day desc
</select> </select>
<select id="dustAnalysis" resultType="com.hw.mes.board.domain.RecordIotenvInstant"> <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 x.* FROM `hwjy-cloud`.record_iotenv_instant x order by x.collectTime desc limit 10
</select> </select>
<select id="deviceTimeCount" resultType="com.hw.mes.board.domain.DmsRealtimeStatusHistory"> <select id="deviceTimeCount" resultType="com.hw.mes.board.domain.DmsRealtimeStatusHistory">
select select
DATE_FORMAT(sync_time , '%Y-%m-%d %H:00:00') as hour,count(1)*10 timeCount DATE_FORMAT(sync_time , '%Y-%m-%d %H:00:00') hour,count(1)*10 timeCount
from from
dms_realtime_status_history dms_realtime_status_history
where where
sync_time > now() - interval 7 hour sync_time > now() - interval 7 hour
and status_value = true and status_value = 'True'
and status_name = '烘干机风机状态' and status_name = '烘干机风机状态'
group by hour group by hour

@ -29,6 +29,20 @@ public class FifthWmsBorderController {
public AjaxResult fifthPanake(){ public AjaxResult fifthPanake(){
return AjaxResult.success(fifthWmsBorderService.fifthPanake()); return AjaxResult.success(fifthWmsBorderService.fifthPanake());
} }
/**
*
*/
@GetMapping("/locationPercentage")
public AjaxResult locationPercentage(){
return AjaxResult.success(fifthWmsBorderService.locationPercentage());
}
/**
*
*/
@GetMapping("scheduleTask")
public AjaxResult scheduleTask(){
return AjaxResult.success(fifthWmsBorderService.scheduleTask());
}
} }

@ -0,0 +1,13 @@
package com.hw.wms.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;
}

@ -15,4 +15,8 @@ public interface FifthWmsBorderService {
Map locationCount(); Map locationCount();
Map fifthPanake(); Map fifthPanake();
BigDecimal locationPercentage();
List<WmsProductOutstockDetail> scheduleTask();
} }

@ -1,5 +1,6 @@
package com.hw.wms.board.service; package com.hw.wms.board.service;
import com.hw.wms.board.domain.RawAmount;
import com.hw.wms.domain.WmsBaseLocation; import com.hw.wms.domain.WmsBaseLocation;
import com.hw.wms.domain.WmsRawOutstock; import com.hw.wms.domain.WmsRawOutstock;
@ -12,4 +13,6 @@ public interface ThirdWmsBorderService {
List<WmsBaseLocation> locationStatus(); List<WmsBaseLocation> locationStatus();
List<WmsRawOutstock> productPlan(); List<WmsRawOutstock> productPlan();
} }

@ -31,6 +31,11 @@ public class FifthWmsBoardServiceImpl implements FifthWmsBorderService {
private WmsBaseLocationMapper wmsBaseLocationMapper; private WmsBaseLocationMapper wmsBaseLocationMapper;
@Override
public List<WmsProductOutstockDetail> scheduleTask() {
return wmsProductOutstockMapper.scheduleTask();
}
@Override @Override
public Map locationCount() { public Map locationCount() {
HashMap map = new HashMap<>(); HashMap map = new HashMap<>();
@ -52,6 +57,14 @@ public class FifthWmsBoardServiceImpl implements FifthWmsBorderService {
return map; return map;
} }
@Override
public BigDecimal locationPercentage() {
int allProductLocation = wmsBaseLocationMapper.selectAllProductLocation();
int productEmptyLocation = wmsBaseLocationMapper.selectAllProductEmptyLocation();
BigDecimal decimal = new BigDecimal(productEmptyLocation).divide(new BigDecimal(allProductLocation), 2, BigDecimal.ROUND_HALF_UP);
return decimal;
}
@Override @Override
public Map fifthPanake() { public Map fifthPanake() {
List<WmsRawStock> wmsRawStocks = wmsRawStockMapper.selectRawLocationPercentage(); List<WmsRawStock> wmsRawStocks = wmsRawStockMapper.selectRawLocationPercentage();

@ -52,8 +52,12 @@ public class SecondWmsBoardServiceImpl implements SecondWmsBorderService {
List<WmsProductOutstock> outstocks = wmsProductStockMapper.selectOutStock(); List<WmsProductOutstock> outstocks = wmsProductStockMapper.selectOutStock();
Map<Long,List<WmsProductOutstock>> map = outstocks.stream().collect(Collectors.groupingBy(WmsProductOutstock::getProductId)); Map<Long,List<WmsProductOutstock>> map = outstocks.stream().collect(Collectors.groupingBy(WmsProductOutstock::getProductId));
for (WmsProductInstock instock : instocks) { for (WmsProductInstock instock : instocks) {
WmsProductOutstock wmsProductOutstock = map.get(instock.getProductId()).get(0); if (map != null&&map.keySet().size()>0) {
instock.setOutStockAmount(wmsProductOutstock.getOutstockQty()); WmsProductOutstock wmsProductOutstock = map.get(instock.getProductId()).get(0);
instock.setOutStockAmount(wmsProductOutstock.getOutstockQty());
}else {
instock.setOutStockAmount(new BigDecimal(0));
}
} }
return instocks; return instocks;
} }

@ -1,5 +1,6 @@
package com.hw.wms.board.service.impl; package com.hw.wms.board.service.impl;
import com.hw.wms.board.domain.RawAmount;
import com.hw.wms.board.service.ThirdWmsBorderService; import com.hw.wms.board.service.ThirdWmsBorderService;
import com.hw.wms.domain.WmsBaseLocation; import com.hw.wms.domain.WmsBaseLocation;
import com.hw.wms.domain.WmsRawOutstock; import com.hw.wms.domain.WmsRawOutstock;
@ -7,12 +8,13 @@ import com.hw.wms.mapper.WmsBaseLocationMapper;
import com.hw.wms.mapper.WmsRawInstockMapper; import com.hw.wms.mapper.WmsRawInstockMapper;
import com.hw.wms.mapper.WmsRawOutstockMapper; import com.hw.wms.mapper.WmsRawOutstockMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@Service
public class ThirdWmsBorderServiceImpl implements ThirdWmsBorderService { public class ThirdWmsBorderServiceImpl implements ThirdWmsBorderService {
@Autowired @Autowired
private WmsRawInstockMapper wmsRawInstockMapper; private WmsRawInstockMapper wmsRawInstockMapper;
@ -31,6 +33,7 @@ public class ThirdWmsBorderServiceImpl implements ThirdWmsBorderService {
return hashMap; return hashMap;
} }
@Override @Override
public List<WmsRawOutstock> productPlan() { public List<WmsRawOutstock> productPlan() {
return wmsRawOutstockMapper.productPlan(); return wmsRawOutstockMapper.productPlan();

@ -97,4 +97,8 @@ public interface WmsBaseLocationMapper
int selectAllLocation(); int selectAllLocation();
List<WmsBaseLocation> locationStatus(); List<WmsBaseLocation> locationStatus();
int selectAllProductLocation();
int selectAllProductEmptyLocation();
} }

@ -143,4 +143,6 @@ public interface WmsProductOutstockMapper
WmsProductOutstock selectGetProductOutstockAuditByProductOutstockId(Long productOutstockId); WmsProductOutstock selectGetProductOutstockAuditByProductOutstockId(Long productOutstockId);
List<WmsProductOutstock> locationCount(); List<WmsProductOutstock> locationCount();
List<WmsProductOutstockDetail> scheduleTask();
} }

@ -318,6 +318,17 @@
where where
warehouse_id = 512 warehouse_id = 512
</select> </select>
<select id="selectAllProductLocation" resultType="java.lang.Integer">
select
count(1)
from
`hwjy-cloud`.wms_base_location
where
warehouse_id = 531
</select>
<select id="selectAllProductEmptyLocation" resultType="java.lang.Integer">
SELECT x.* FROM `hwjy-cloud`.wms_base_location x where x.warehouse_id = 531
</select>
</mapper> </mapper>

@ -400,14 +400,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<select id="locationCount" resultType="com.hw.wms.domain.WmsProductOutstock"> <select id="locationCount" resultType="com.hw.wms.domain.WmsProductOutstock">
select select
warehouse_id warehouse_id , ifnull(sum(outstock_qty),0) outstock_qty
sum(outstock_qty) outstock_qty
from from
wms_product_outstock wms_product_outstock
where where
apply_date > now() - interval 1 month apply_date > now() - interval 1 month
and warehouse_id = 531 and warehouse_id = 531
</select> </select>
<select id="scheduleTask" resultType="com.hw.wms.domain.WmsProductOutstockDetail">
SELECT x.* FROM `hwjy-cloud`.wms_product_outstock_detail x where x.begin_time > now() - interval 1 month
</select>
<update id="auditWmsProductOutstockByTaskCode" parameterType="WmsProductOutstock"> <update id="auditWmsProductOutstockByTaskCode" parameterType="WmsProductOutstock">
update wms_product_outstock update wms_product_outstock

Loading…
Cancel
Save