psh
7 months ago
14 changed files with 348 additions and 78 deletions
@ -0,0 +1,98 @@ |
|||
package org.nl.wms.board.controller; |
|||
|
|||
import cn.dev33.satoken.annotation.SaIgnore; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.common.logging.annotation.Log; |
|||
import org.nl.wms.board.service.BoardService; |
|||
import org.nl.wms.pda.service.PdaService; |
|||
import org.nl.wms.sch.point.service.ISchBasePointService; |
|||
import org.nl.wms.sch.point.service.dao.SchBasePoint; |
|||
import org.nl.wms.sch.region.service.ISchBaseRegionService; |
|||
import org.nl.wms.sch.region.service.dao.SchBaseRegion; |
|||
import org.springframework.context.annotation.Lazy; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import javax.annotation.Resource; |
|||
import java.util.Map; |
|||
|
|||
|
|||
@Slf4j |
|||
@RestController |
|||
@Api(tags = "看板接口") |
|||
@RequestMapping("/api/board" + |
|||
"") |
|||
@SaIgnore |
|||
@Lazy |
|||
public class BoardController { |
|||
|
|||
@Resource |
|||
private BoardService boardService; |
|||
|
|||
|
|||
@PostMapping("/cz") |
|||
@Log("称重看板") |
|||
@ApiOperation("称重看板") |
|||
@SaIgnore |
|||
public ResponseEntity<Object> cz(@RequestBody JSONObject param){ |
|||
return new ResponseEntity<>(boardService.cz(param), HttpStatus.OK); |
|||
} |
|||
|
|||
@PostMapping("/rk/kc") |
|||
@Log("入库看板库存") |
|||
@ApiOperation("入库看板库存") |
|||
@SaIgnore |
|||
public ResponseEntity<Object> kc(@RequestBody JSONObject param){ |
|||
return new ResponseEntity<>(boardService.kc(), HttpStatus.OK); |
|||
} |
|||
|
|||
@PostMapping("/rk/hw") |
|||
@Log("入库看板货位占用") |
|||
@ApiOperation("入库看板货位占用") |
|||
@SaIgnore |
|||
public ResponseEntity<Object> hw(@RequestBody JSONObject param){ |
|||
return new ResponseEntity<>(boardService.hw(), HttpStatus.OK); |
|||
} |
|||
|
|||
@PostMapping("/rk/kn") |
|||
@Log("入库看板库内物料") |
|||
@ApiOperation("入库看板库内物料") |
|||
@SaIgnore |
|||
public ResponseEntity<Object> kn(@RequestBody JSONObject param){ |
|||
return new ResponseEntity<>(boardService.kn(), HttpStatus.OK); |
|||
} |
|||
|
|||
@PostMapping("/rk/wrk") |
|||
@Log("入库看板未入库物料") |
|||
@ApiOperation("入库看板未入库物料") |
|||
@SaIgnore |
|||
public ResponseEntity<Object> wrk(@RequestBody JSONObject param){ |
|||
return new ResponseEntity<>(boardService.wrk(), HttpStatus.OK); |
|||
} |
|||
|
|||
|
|||
@PostMapping("/sc/pt") |
|||
@Log("生产看板普通回温") |
|||
@ApiOperation("生产看板普通回温") |
|||
@SaIgnore |
|||
public ResponseEntity<Object> pt(){ |
|||
return new ResponseEntity<>(boardService.sc("HW"), HttpStatus.OK); |
|||
} |
|||
|
|||
|
|||
@PostMapping("/sc/ks") |
|||
@Log("生产看板快速回温") |
|||
@ApiOperation("生产看板快速回温") |
|||
@SaIgnore |
|||
public ResponseEntity<Object> ks(){ |
|||
return new ResponseEntity<>(boardService.sc("HWK"), HttpStatus.OK); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,23 @@ |
|||
package org.nl.wms.board.service; |
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
import org.nl.wms.board.service.dao.dto.HwDto; |
|||
import org.nl.wms.board.service.dao.dto.ScDto; |
|||
import org.nl.wms.board.service.dao.dto.WlDto; |
|||
import org.nl.wms.pda.service.dao.vo.PdaResponseVo; |
|||
|
|||
import java.util.List; |
|||
|
|||
public interface BoardService { |
|||
PdaResponseVo cz(JSONObject param); |
|||
|
|||
PdaResponseVo kc(); |
|||
|
|||
HwDto hw(); |
|||
|
|||
List<WlDto> kn(); |
|||
|
|||
List<WlDto> wrk(); |
|||
|
|||
List<ScDto> sc(String region_code); |
|||
} |
@ -0,0 +1,14 @@ |
|||
package org.nl.wms.board.service.dao.dto; |
|||
|
|||
import lombok.Data; |
|||
|
|||
@Data |
|||
public class HwDto { |
|||
private int pointNumber; |
|||
private int pointUsed; |
|||
private int pointRemain; |
|||
private int emptyNumber; |
|||
private int emptyUsed; |
|||
private int emptyRemain; |
|||
private int emptyQty; |
|||
} |
@ -0,0 +1,15 @@ |
|||
package org.nl.wms.board.service.dao.dto; |
|||
|
|||
import lombok.Data; |
|||
|
|||
@Data |
|||
public class ScDto { |
|||
private String productName; |
|||
private String supplierName; |
|||
private String productDescription; |
|||
private String batch; |
|||
private String number; |
|||
private String standingTime; |
|||
private String usedTime; |
|||
private int state; |
|||
} |
@ -0,0 +1,13 @@ |
|||
package org.nl.wms.board.service.dao.dto; |
|||
|
|||
import lombok.Data; |
|||
|
|||
@Data |
|||
public class WlDto { |
|||
private String palletSN; |
|||
private String productName; |
|||
private String productDescription; |
|||
private String qty; |
|||
private String incomingWeight; |
|||
private String supplierName; |
|||
} |
@ -0,0 +1,20 @@ |
|||
package org.nl.wms.board.service.dao.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import org.nl.wms.board.service.dao.dto.HwDto; |
|||
import org.nl.wms.board.service.dao.dto.ScDto; |
|||
import org.nl.wms.board.service.dao.dto.WlDto; |
|||
import org.nl.wms.pdm.service.dao.PointDetail; |
|||
|
|||
import java.util.List; |
|||
import java.util.logging.Handler; |
|||
|
|||
public interface BoardMapper { |
|||
List<ScDto> sc(String region_code); |
|||
|
|||
List<WlDto> kn(); |
|||
|
|||
List<WlDto> wrk(); |
|||
|
|||
HwDto hw(); |
|||
} |
@ -0,0 +1,108 @@ |
|||
<?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="org.nl.wms.board.service.dao.mapper.BoardMapper"> |
|||
|
|||
<select id="sc" resultType="org.nl.wms.board.service.dao.dto.ScDto"> |
|||
SELECT |
|||
*, |
|||
CASE |
|||
WHEN b.standing_time > b.usedTime THEN |
|||
0 ELSE 1 |
|||
END AS state |
|||
FROM |
|||
( |
|||
SELECT |
|||
productName, |
|||
supplierName, |
|||
productDescription, |
|||
pcsn AS batch, |
|||
standing_time, |
|||
TIMESTAMPDIFF( |
|||
HOUR, |
|||
instorage_time, |
|||
curtime()) AS usedTime |
|||
FROM |
|||
( |
|||
SELECT |
|||
* |
|||
FROM |
|||
sch_base_vehiclematerialgroup |
|||
WHERE |
|||
vehicle_code IN ( SELECT vehicle_code2 FROM sch_base_point WHERE region_code = #{region_code} AND vehicle_code IS NOT NULL )) a |
|||
LEFT JOIN sch_base_material m ON a.vehicle_code = m.PalletSN |
|||
AND m.group_bind_material_status = 2 |
|||
) b |
|||
</select> |
|||
|
|||
<select id="kn" resultType="org.nl.wms.board.service.dao.dto.WlDto"> |
|||
SELECT |
|||
a.palletSN, |
|||
any_value ( a.productName ), |
|||
any_value ( a.productDescription ), |
|||
sum( a.qty ), |
|||
sum( a.incomingWeight ), |
|||
any_value ( a.supplierName ) |
|||
FROM |
|||
( |
|||
SELECT |
|||
m.* |
|||
FROM |
|||
sch_base_material m, |
|||
sch_base_point p |
|||
WHERE |
|||
m.PalletSN = p.vehicle_code2 |
|||
AND p.region_code = 'YL' |
|||
) a |
|||
GROUP BY |
|||
PalletSN; |
|||
</select> |
|||
|
|||
<select id="wrk" resultType="org.nl.wms.board.service.dao.dto.WlDto"> |
|||
SELECT |
|||
a.palletSN, |
|||
any_value ( a.productName ), |
|||
any_value ( a.productDescription ), |
|||
sum( a.qty ), |
|||
sum( a.incomingWeight ), |
|||
any_value ( a.supplierName ) |
|||
FROM |
|||
( |
|||
SELECT |
|||
m.* |
|||
FROM |
|||
sch_base_material m |
|||
WHERE |
|||
m.PalletSN NOT IN ( SELECT vehicle_code2 FROM sch_base_point where vehicle_code2 is not null )) a |
|||
GROUP BY |
|||
PalletSN; |
|||
</select> |
|||
|
|||
<select id="hw" resultType="org.nl.wms.board.service.dao.dto.HwDto"> |
|||
SELECT |
|||
a.*, |
|||
b.*, |
|||
emptyRemain * 10 AS emptyQty |
|||
FROM |
|||
( |
|||
SELECT |
|||
COUNT(*) AS pointNumber, |
|||
SUM( CASE WHEN vehicle_code2 = '' OR vehicle_code2 IS NULL THEN 1 ELSE 0 END ) AS pointUsed, |
|||
SUM( CASE WHEN vehicle_code2 != '' AND vehicle_code2 IS NOT NULL THEN 1 ELSE 0 END ) AS pointRemain |
|||
FROM |
|||
sch_base_point |
|||
WHERE |
|||
region_code IN ( 'YL', 'HW', 'HWK' ) |
|||
) a, |
|||
( |
|||
SELECT |
|||
COUNT(*) AS emptyNumber, |
|||
SUM( CASE WHEN vehicle_qty = 0 THEN 1 ELSE 0 END ) AS emptyUsed, |
|||
SUM( CASE WHEN vehicle_qty = 1 THEN 1 ELSE 0 END ) AS emptyRemain |
|||
FROM |
|||
sch_base_point |
|||
WHERE |
|||
region_code IN ( 'KJHC' ) |
|||
)b |
|||
</select> |
|||
|
|||
</mapper> |
@ -0,0 +1,49 @@ |
|||
package org.nl.wms.board.service.impl; |
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.wms.board.service.BoardService; |
|||
import org.nl.wms.board.service.dao.dto.HwDto; |
|||
import org.nl.wms.board.service.dao.dto.ScDto; |
|||
import org.nl.wms.board.service.dao.dto.WlDto; |
|||
import org.nl.wms.board.service.dao.mapper.BoardMapper; |
|||
import org.nl.wms.pda.service.dao.vo.PdaResponseVo; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.List; |
|||
|
|||
@Slf4j |
|||
@Service |
|||
public class BoardServiceImpl implements BoardService { |
|||
@Autowired |
|||
private BoardMapper boardMapper; |
|||
public PdaResponseVo cz(JSONObject param){ |
|||
return PdaResponseVo.pdaResultOk("回温状态查询成功"); |
|||
} |
|||
|
|||
public PdaResponseVo rk(JSONObject param){ |
|||
return PdaResponseVo.pdaResultOk("回温状态查询成功"); |
|||
} |
|||
|
|||
public PdaResponseVo kc(){ |
|||
return PdaResponseVo.pdaResultOk("回温状态查询成功"); |
|||
} |
|||
|
|||
public HwDto hw(){ |
|||
return boardMapper.hw(); |
|||
} |
|||
|
|||
|
|||
public List<WlDto> kn(){ |
|||
return boardMapper.kn(); |
|||
} |
|||
|
|||
public List<WlDto> wrk(){ |
|||
return boardMapper.wrk(); |
|||
} |
|||
|
|||
public List<ScDto> sc(String region_code){ |
|||
return boardMapper.sc(region_code); |
|||
} |
|||
} |
Loading…
Reference in new issue