养生A区
This commit is contained in:
@@ -0,0 +1,92 @@
|
||||
|
||||
package org.nl.wms.sch.ysa.rest;
|
||||
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import org.nl.wms.sch.ysa.service.YsapointService;
|
||||
import org.nl.wms.sch.ysa.service.dto.YsapointDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.*;
|
||||
import java.util.Map;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
* @date 2022-10-17
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "养生A区管理")
|
||||
@RequestMapping("/api/ysapoint")
|
||||
@Slf4j
|
||||
public class YsapointController {
|
||||
|
||||
private final YsapointService ysapointService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询养生A区")
|
||||
@ApiOperation("查询养生A区")
|
||||
//@SaCheckPermission("@el.check('ysapoint:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page){
|
||||
return new ResponseEntity<>(ysapointService.queryAll(whereJson,page),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
@Log("新增养生A区")
|
||||
@ApiOperation("新增养生A区")
|
||||
@SaIgnore
|
||||
//@SaCheckPermission("@el.check('ysapoint:add')")
|
||||
public ResponseEntity<Object> create(){
|
||||
ysapointService.create();
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改养生A区")
|
||||
@ApiOperation("修改养生A区")
|
||||
//@SaCheckPermission("@el.check('ysapoint:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody YsapointDto dto){
|
||||
ysapointService.update(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除养生A区")
|
||||
@ApiOperation("删除养生A区")
|
||||
//@SaCheckPermission("@el.check('ysapoint:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
||||
ysapointService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("获取快列排")
|
||||
@GetMapping("/blockRowCol/tree")
|
||||
@ApiOperation("获取快列排")
|
||||
public ResponseEntity<Object> arrangementTree() {
|
||||
return new ResponseEntity<>(ysapointService.getArrangementTree(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("启动")
|
||||
@PostMapping("/changeUsedOn")
|
||||
@ApiOperation("启动")
|
||||
public ResponseEntity<Object> changeUsedOn(@RequestBody JSONArray jsonArray) {
|
||||
ysapointService.changeUsed(jsonArray, 1);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("禁用")
|
||||
@PostMapping("/changeUsedOff")
|
||||
@ApiOperation("禁用")
|
||||
public ResponseEntity<Object> changeUsedOff(@RequestBody JSONArray jsonArray) {
|
||||
ysapointService.changeUsed(jsonArray, 0);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
|
||||
package org.nl.wms.sch.ysa.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import org.nl.wms.sch.ysa.service.dto.YsapointDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @description 服务接口
|
||||
* @author lyd
|
||||
* @date 2022-10-17
|
||||
**/
|
||||
public interface YsapointService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String,Object>
|
||||
*/
|
||||
Map<String,Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
* @param whereJson 条件参数
|
||||
* @return List<YsapointDto>
|
||||
*/
|
||||
List<YsapointDto> queryAll(Map whereJson);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
* @param point_id ID
|
||||
* @return Ysapoint
|
||||
*/
|
||||
YsapointDto findById(Long point_id);
|
||||
|
||||
/**
|
||||
* 根据编码查询
|
||||
* @param code code
|
||||
* @return Ysapoint
|
||||
*/
|
||||
YsapointDto findByCode(String code);
|
||||
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param dto /
|
||||
*/
|
||||
void create();
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param dto /
|
||||
*/
|
||||
void update(YsapointDto dto);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Long[] ids);
|
||||
|
||||
/**
|
||||
* 获取块列排树
|
||||
* @return
|
||||
*/
|
||||
JSONArray getArrangementTree();
|
||||
|
||||
/**
|
||||
* 改变启用状态
|
||||
* @param jsonArray
|
||||
* @return
|
||||
*/
|
||||
void changeUsed(JSONArray jsonArray, Integer flag);
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package org.nl.wms.sch.ysa.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.math.BigDecimal;
|
||||
import java.io.Serializable;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
|
||||
/**
|
||||
* @description /
|
||||
* @author lyd
|
||||
* @date 2022-10-17
|
||||
**/
|
||||
@Data
|
||||
public class YsapointDto implements Serializable {
|
||||
|
||||
/** 点位标识 */
|
||||
/** 防止精度丢失 */
|
||||
@JsonSerialize(using= ToStringSerializer.class)
|
||||
private Long point_id;
|
||||
|
||||
/** 点位编码 */
|
||||
private String point_code;
|
||||
|
||||
/** 批次 */
|
||||
private String pcsn;
|
||||
|
||||
/** 物料标识 */
|
||||
private Long material_id;
|
||||
|
||||
/** 库存数 */
|
||||
private BigDecimal ivt_qty;
|
||||
|
||||
/** 计量单位标识 */
|
||||
private Long qty_unit_id;
|
||||
|
||||
/** 入库时间 */
|
||||
private String instorage_time;
|
||||
|
||||
/** 外部编码 */
|
||||
private String ext_code;
|
||||
|
||||
/** 点位状态 */
|
||||
private String point_status;
|
||||
|
||||
/** 托盘类型 */
|
||||
private String vehicle_type;
|
||||
|
||||
/** 静置时间(分钟) */
|
||||
private BigDecimal standing_time;
|
||||
|
||||
/** 块 */
|
||||
private BigDecimal block_num;
|
||||
|
||||
/** 排 */
|
||||
private BigDecimal row_num;
|
||||
|
||||
/** 列 */
|
||||
private BigDecimal col_num;
|
||||
|
||||
/** 层 */
|
||||
private BigDecimal layer_num;
|
||||
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
|
||||
/** 是否启用 */
|
||||
private String is_used;
|
||||
|
||||
/** 是否锁定 */
|
||||
private String is_lock;
|
||||
|
||||
/** 创建人 */
|
||||
private Long create_id;
|
||||
|
||||
/** 创建人 */
|
||||
private String create_name;
|
||||
|
||||
/** 创建时间 */
|
||||
private String create_time;
|
||||
|
||||
/** 修改人 */
|
||||
private Long update_optid;
|
||||
|
||||
/** 修改人 */
|
||||
private String update_optname;
|
||||
|
||||
/** 修改时间 */
|
||||
private String update_time;
|
||||
}
|
||||
@@ -0,0 +1,239 @@
|
||||
|
||||
package org.nl.wms.sch.ysa.service.impl;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.wms.sch.ysa.service.YsapointService;
|
||||
import org.nl.wms.sch.ysa.service.dto.YsapointDto;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.modules.common.utils.SecurityUtils;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.WqlUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
|
||||
/**
|
||||
* @description 服务实现
|
||||
* @author lyd
|
||||
* @date 2022-10-17
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class YsapointServiceImpl implements YsapointService {
|
||||
|
||||
@Override
|
||||
public Map<String,Object> queryAll(Map whereJson, Pageable page){
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("flag", "1");
|
||||
if (!ObjectUtil.isNull(whereJson.get("point_code"))) {
|
||||
map.put("point_code", "%" + whereJson.get("point_code") + "%");
|
||||
}
|
||||
if (!ObjectUtil.isNull(whereJson.get("locationsOptions"))) {
|
||||
String locationsOptions = whereJson.get("locationsOptions").toString();
|
||||
String[] options = locationsOptions.split("/");
|
||||
map.put("block_num", options[0]);
|
||||
map.put("row_num", options[1]);
|
||||
map.put("col_num", options[2]);
|
||||
}
|
||||
map.put("is_lock", whereJson.get("is_lock"));
|
||||
map.put("is_used", whereJson.get("is_used"));
|
||||
map.put("point_status", whereJson.get("point_status"));
|
||||
map.put("vehicle_type", whereJson.get("vehicle_type"));
|
||||
map.put("begin_time", whereJson.get("begin_time"));
|
||||
map.put("end_time", whereJson.get("end_time"));
|
||||
JSONObject json = WQL.getWO("SCH_BASE_YSAPOINT").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "point_code asc");
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<YsapointDto> queryAll(Map whereJson){
|
||||
WQLObject wo = WQLObject.getWQLObject("sch_base_ysapoint");
|
||||
JSONArray arr = wo.query().getResultJSONArray(0);
|
||||
if (ObjectUtil.isNotEmpty(arr)) return arr.toJavaList(YsapointDto.class);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public YsapointDto findById(Long point_id) {
|
||||
WQLObject wo = WQLObject.getWQLObject("sch_base_ysapoint");
|
||||
JSONObject json = wo.query("point_id = '" + point_id + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)){
|
||||
return json.toJavaObject( YsapointDto.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public YsapointDto findByCode(String code) {
|
||||
WQLObject wo = WQLObject.getWQLObject("sch_base_ysapoint");
|
||||
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)){
|
||||
return json.toJavaObject( YsapointDto.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create() {
|
||||
|
||||
for (int i = 1; i <= 8; i++) {
|
||||
for (int j = 1; j <= 13; j++) {
|
||||
String row = "";
|
||||
if ( j == 13 && ( i == 7 || i == 8 ) ) break;
|
||||
if ( j < 10) row = "0" + j;
|
||||
else row = "" + j;
|
||||
for ( int k = 1; k <= 13; k++ ) {
|
||||
String col = "";
|
||||
if ( i < 7 && k > 9) break;
|
||||
if ( k < 10 ) col = "-" + "0" + k + "-" + "01";
|
||||
else col = "-" + k + "-" + "01";
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
JSONObject ysa = new JSONObject();
|
||||
ysa.put("point_id", IdUtil.getSnowflake(1,1).nextId());
|
||||
ysa.put("point_code", "2" + i + row + col);
|
||||
ysa.put("block_num", i);
|
||||
ysa.put("row_num", j);
|
||||
ysa.put("col_num", k);
|
||||
ysa.put("layer_num", 1);
|
||||
ysa.put("is_used", 1);
|
||||
ysa.put("is_lock", 0);
|
||||
ysa.put("standing_time", 0);
|
||||
ysa.put("create_id", currentUserId);
|
||||
ysa.put("create_name", nickName);
|
||||
ysa.put("create_time", now);
|
||||
ysa.put("update_optid", currentUserId);
|
||||
ysa.put("update_optname", nickName);
|
||||
ysa.put("update_time", now);
|
||||
WQLObject wo = WQLObject.getWQLObject("sch_base_YsaPoint");
|
||||
wo.insert(ysa);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(YsapointDto dto) {
|
||||
YsapointDto entity = this.findById(dto.getPoint_id());
|
||||
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
|
||||
String now = DateUtil.now();
|
||||
dto.setUpdate_time(now);
|
||||
dto.setUpdate_optid(currentUserId);
|
||||
dto.setUpdate_optname(nickName);
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("sch_base_ysapoint");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
wo.update(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(Long[] ids) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("sch_base_ysapoint");
|
||||
for (Long point_id: ids) {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("point_id", String.valueOf(point_id));
|
||||
param.put("is_delete", "1");
|
||||
param.put("update_optid", currentUserId);
|
||||
param.put("update_optname", nickName);
|
||||
param.put("update_time", now);
|
||||
wo.update(param);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取块列排树
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public JSONArray getArrangementTree() {
|
||||
/**
|
||||
* [{
|
||||
* label:块
|
||||
* value:
|
||||
* children:[{
|
||||
* label:排
|
||||
* value
|
||||
* children:[{
|
||||
* label:列
|
||||
* value
|
||||
* children:[{
|
||||
*
|
||||
* }]
|
||||
* }]
|
||||
* }]
|
||||
* }]
|
||||
*/
|
||||
JSONArray result = new JSONArray();
|
||||
// 获取所有的块
|
||||
for (int i = 1; i <= 8; i++) {
|
||||
JSONObject block = new JSONObject();
|
||||
block.put("label", i);
|
||||
block.put("value", i);
|
||||
JSONArray rows = new JSONArray();
|
||||
for (int j = 1; j <= 13; j++) {
|
||||
if ( j == 13 && ( i == 7 || i == 8 ) ) break;
|
||||
JSONObject row = new JSONObject();
|
||||
row.put("label", j);
|
||||
row.put("value", j);
|
||||
JSONArray cols = new JSONArray();
|
||||
for (int k = 1; k <= 13; k++) {
|
||||
if ( i < 7 && k > 9) break;
|
||||
JSONObject col = new JSONObject();
|
||||
col.put("label", k);
|
||||
col.put("value", k);
|
||||
cols.add(col);
|
||||
}
|
||||
row.put("children", cols);
|
||||
rows.add(row);
|
||||
}
|
||||
block.put("children", rows);
|
||||
result.add(block);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 改变启用状态
|
||||
*
|
||||
* @param jsonArray
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void changeUsed(JSONArray jsonArray, Integer flag) {
|
||||
WQLObject wo = WQLObject.getWQLObject("sch_base_YsaPoint");
|
||||
for ( int i = 0; i < jsonArray.size(); i++ ) {
|
||||
JSONObject object = jsonArray.getJSONObject(i);
|
||||
if (flag == 1) object.put("is_used", 1);
|
||||
else object.put("is_used", 0);
|
||||
wo.update(object);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
[交易说明]
|
||||
交易名: 养生A区
|
||||
所属模块:
|
||||
功能简述:
|
||||
版权所有:
|
||||
表引用:
|
||||
版本经历:
|
||||
|
||||
[数据库]
|
||||
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
|
||||
|
||||
[IO定义]
|
||||
#################################################
|
||||
## 表字段对应输入参数
|
||||
#################################################
|
||||
输入.flag TYPEAS s_string
|
||||
输入.point_code TYPEAS s_string
|
||||
输入.block_num TYPEAS s_string
|
||||
输入.row_num TYPEAS s_string
|
||||
输入.col_num TYPEAS s_string
|
||||
输入.is_lock TYPEAS s_string
|
||||
输入.is_used TYPEAS s_string
|
||||
输入.point_status TYPEAS s_string
|
||||
输入.vehicle_type TYPEAS s_string
|
||||
输入.begin_time TYPEAS s_string
|
||||
输入.end_time TYPEAS s_string
|
||||
|
||||
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
|
||||
[临时变量]
|
||||
--所有中间过程变量均可在此处定义
|
||||
|
||||
[业务过程]
|
||||
|
||||
##########################################
|
||||
# 1、输入输出检查 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 2、主过程前处理 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 3、业务主过程 #
|
||||
##########################################
|
||||
IF 输入.flag = "1"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
YsaPoint.*
|
||||
FROM
|
||||
sch_base_YsaPoint YsaPoint
|
||||
WHERE
|
||||
1 = 1
|
||||
OPTION 输入.point_code <> ""
|
||||
point_code LIKE 输入.point_code
|
||||
ENDOPTION
|
||||
OPTION 输入.point_status <> ""
|
||||
point_status = 输入.point_status
|
||||
ENDOPTION
|
||||
OPTION 输入.vehicle_type <> ""
|
||||
vehicle_type = 输入.vehicle_type
|
||||
ENDOPTION
|
||||
OPTION 输入.block_num <> ""
|
||||
block_num = 输入.block_num
|
||||
ENDOPTION
|
||||
OPTION 输入.row_num <> ""
|
||||
row_num = 输入.row_num
|
||||
ENDOPTION
|
||||
OPTION 输入.col_num <> ""
|
||||
col_num = 输入.col_num
|
||||
ENDOPTION
|
||||
OPTION 输入.is_lock <> ""
|
||||
is_lock = 输入.is_lock
|
||||
ENDOPTION
|
||||
OPTION 输入.is_used <> ""
|
||||
is_used = 输入.is_used
|
||||
ENDOPTION
|
||||
OPTION 输入.begin_time <> ""
|
||||
instorage_time >= 输入.begin_time
|
||||
ENDOPTION
|
||||
OPTION 输入.end_time <> ""
|
||||
instorage_time <= 输入.end_time
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
Reference in New Issue
Block a user