生箔点位库存

This commit is contained in:
lyd
2022-10-10 14:00:42 +08:00
parent 2160e93d77
commit f6de45d426
7 changed files with 666 additions and 0 deletions

View File

@@ -0,0 +1,67 @@
package org.nl.wms.pdm.ivt.rest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.modules.logging.annotation.Log;
import org.nl.wms.pdm.ivt.service.SbPointIvtService;
import org.nl.wms.pdm.ivt.service.dto.SbPointIvtDto;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/**
* @author lyd
* @date 2022-10-10
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "生箔点位库存管理")
@RequestMapping("/api/sbpointivt")
@Slf4j
public class SbPointIvtController {
private final SbPointIvtService sbpointivtService;
@GetMapping
@Log("查询生箔点位库存")
@ApiOperation("查询生箔点位库存")
//@SaCheckPermission("@el.check('sbpointivt:list')")
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page){
return new ResponseEntity<>(sbpointivtService.queryAll(whereJson,page),HttpStatus.OK);
}
@PostMapping
@Log("新增生箔点位库存")
@ApiOperation("新增生箔点位库存")
//@SaCheckPermission("@el.check('sbpointivt:add')")
public ResponseEntity<Object> create(@Validated @RequestBody SbPointIvtDto dto){
sbpointivtService.create(dto);
return new ResponseEntity<>(HttpStatus.CREATED);
}
@PutMapping
@Log("修改生箔点位库存")
@ApiOperation("修改生箔点位库存")
//@SaCheckPermission("@el.check('sbpointivt:edit')")
public ResponseEntity<Object> update(@Validated @RequestBody SbPointIvtDto dto){
sbpointivtService.update(dto);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@Log("删除生箔点位库存")
@ApiOperation("删除生箔点位库存")
//@SaCheckPermission("@el.check('sbpointivt:del')")
@DeleteMapping
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
sbpointivtService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -0,0 +1,64 @@
package org.nl.wms.pdm.ivt.service;
import org.nl.wms.pdm.ivt.service.dto.SbPointIvtDto;
import org.springframework.data.domain.Pageable;
import java.util.List;
import java.util.Map;
/**
* @description 服务接口
* @author lyd
* @date 2022-10-10
**/
public interface SbPointIvtService {
/**
* 查询数据分页
* @param whereJson 条件
* @param page 分页参数
* @return Map<String,Object>
*/
Map<String,Object> queryAll(Map whereJson, Pageable page);
/**
* 查询所有数据不分页
* @param whereJson 条件参数
* @return List<SbpointivtDto>
*/
List<SbPointIvtDto> queryAll(Map whereJson);
/**
* 根据ID查询
* @param point_id ID
* @return Sbpointivt
*/
SbPointIvtDto findById(Long point_id);
/**
* 根据编码查询
* @param code code
* @return Sbpointivt
*/
SbPointIvtDto findByCode(String code);
/**
* 创建
* @param dto /
*/
void create(SbPointIvtDto dto);
/**
* 编辑
* @param dto /
*/
void update(SbPointIvtDto dto);
/**
* 多选删除
* @param ids /
*/
void deleteAll(Long[] ids);
}

View File

@@ -0,0 +1,63 @@
package org.nl.wms.pdm.ivt.service.dto;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import java.io.Serializable;
/**
* @description /
* @author lyd
* @date 2022-10-10
**/
@Data
public class SbPointIvtDto implements Serializable {
/** 点位标识 */
/** 防止精度丢失 */
@JsonSerialize(using= ToStringSerializer.class)
private Long point_id;
/** 点位编码 */
private String point_code;
/** 点位状态 */
private String point_status;
/** 载具编码 */
private String vehicle_code;
/** 生产区域 */
private String product_area;
/** 位置 */
private String point_location;
/** 外部编码 */
private String ext_code;
/** 备注 */
private String remark;
/** 是否启用 */
private String is_used;
/** 创建人 */
private Long create_id;
/** 创建人 */
private String create_name;
/** 创建时间 */
private String create_time;
/** 修改人 */
private Long update_optid;
/** 修改人 */
private String update_optname;
/** 修改时间 */
private String update_time;
}

View File

@@ -0,0 +1,135 @@
package org.nl.wms.pdm.ivt.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.common.utils.SecurityUtils;
import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.WqlUtil;
import org.nl.wms.pdm.ivt.service.SbPointIvtService;
import org.nl.wms.pdm.ivt.service.dto.SbPointIvtDto;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
/**
* @description 服务实现
* @author lyd
* @date 2022-10-10
**/
@Service
@RequiredArgsConstructor
@Slf4j
public class SbPointIvtServiceImpl implements SbPointIvtService {
@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") + "%");
map.put("point_status", whereJson.get("point_status"));
map.put("product_area", whereJson.get("product_area"));
map.put("is_used", whereJson.get("is_used"));
JSONObject json = WQL.getWO("ST_IVT_SBPOINTIVT").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "update_time desc");
return json;
}
@Override
public List<SbPointIvtDto> queryAll(Map whereJson){
WQLObject wo = WQLObject.getWQLObject("st_ivt_sbpointivt");
JSONArray arr = wo.query().getResultJSONArray(0);
if (ObjectUtil.isNotEmpty(arr)) return arr.toJavaList(SbPointIvtDto.class);
return null;
}
@Override
public SbPointIvtDto findById(Long point_id) {
WQLObject wo = WQLObject.getWQLObject("st_ivt_sbpointivt");
JSONObject json = wo.query("point_id = '" + point_id + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(json)){
return json.toJavaObject( SbPointIvtDto.class);
}
return null;
}
@Override
public SbPointIvtDto findByCode(String code) {
WQLObject wo = WQLObject.getWQLObject("st_ivt_sbpointivt");
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(json)){
return json.toJavaObject( SbPointIvtDto.class);
}
return null;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void create(SbPointIvtDto dto) {
Long currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
dto.setPoint_id(IdUtil.getSnowflake(1, 1).nextId());
dto.setCreate_id(currentUserId);
dto.setCreate_name(nickName);
dto.setUpdate_optid(currentUserId);
dto.setUpdate_optname(nickName);
dto.setUpdate_time(now);
dto.setCreate_time(now);
WQLObject wo = WQLObject.getWQLObject("st_ivt_sbpointivt");
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
wo.insert(json);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(SbPointIvtDto dto) {
SbPointIvtDto 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("st_ivt_sbpointivt");
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("st_ivt_sbpointivt");
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);
}
}
}

View File

@@ -0,0 +1,66 @@
[交易说明]
交易名: 生箔点位库存
所属模块:
功能简述:
版权所有:
表引用:
版本经历:
[数据库]
--指定数据库为空采用默认值默认为db.properties中列出的第一个库
[IO定义]
#################################################
## 表字段对应输入参数
#################################################
输入.flag TYPEAS s_string
输入.point_code TYPEAS s_string
输入.point_status TYPEAS s_string
输入.product_area TYPEAS s_string
输入.is_used TYPEAS s_string
[临时表]
--这边列出来的临时表就会在运行期动态创建
[临时变量]
--所有中间过程变量均可在此处定义
[业务过程]
##########################################
# 1、输入输出检查 #
##########################################
##########################################
# 2、主过程前处理 #
##########################################
##########################################
# 3、业务主过程 #
##########################################
IF 输入.flag = "1"
PAGEQUERY
SELECT
sb.*
FROM
st_ivt_sbpointivt sb
WHERE
1=1
OPTION 输入.point_code <> ""
point_code LIKE 输入.point_code
ENDOPTION
OPTION 输入.point_status <> ""
point_status = 输入.point_status
ENDOPTION
OPTION 输入.product_area <> ""
product_area = 输入.product_area
ENDOPTION
OPTION 输入.is_used <> ""
is_used = 输入.is_used
ENDOPTION
ENDSELECT
ENDPAGEQUERY
ENDIF

View File

@@ -0,0 +1,244 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<div v-if="crud.props.searchToggle">
<!-- 搜索 -->
<el-form
:inline="true"
class="demo-form-inline"
label-position="right"
label-width="90px"
label-suffix=":"
>
<el-form-item label="点位编码">
<el-input
v-model="query.point_code"
clearable
placeholder="输入点位编码"
style="width: 185px;"
class="filter-item"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
<el-form-item label="点位状态">
<el-select
v-model="query.point_status"
clearable
filterable
size="mini"
class="filter-item"
style="width: 185px;"
@change="hand"
>
<el-option
v-for="item in dict.sch_point_status"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="生产区域">
<el-select
v-model="query.product_area"
clearable
filterable
size="mini"
class="filter-item"
style="width: 185px;"
@change="hand"
>
<el-option
v-for="item in dict.product_area"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="是否启用">
<el-switch
@change="hand"
v-model="query.is_used"
active-value="0"
inactive-value="1"
active-color="#C0CCDA"
inactive-color="#409EFF"/>
</el-form-item>
<rrOperation :crud="crud" />
</el-form>
</div>
<!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'-->
<crudOperation :permission="permission" />
<!--表单组件-->
<el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px">
<el-form ref="form" :model="form" :rules="rules" size="mini" label-width="80px">
<el-form-item label="点位编码" prop="point_code">
<el-input v-model="form.point_code" style="width: 370px;" :disabled="true"/>
</el-form-item>
<el-form-item label="点位状态" prop="point_status">
<el-select
v-model="form.point_status"
size="mini"
placeholder="点位状态"
class="filter-item"
style="width: 370px;"
>
<el-option
v-for="item in dict.sch_point_status"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="载具编码">
<el-input v-model="form.vehicle_code" style="width: 370px;" :disabled="true"/>
</el-form-item>
<el-form-item label="生产区域">
<el-select
v-model="form.product_area"
size="mini"
placeholder="生产区域"
class="filter-item"
style="width: 370px;"
:disabled="true"
>
<el-option
v-for="item in dict.product_area"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="位置">
<el-select
v-model="form.point_location"
size="mini"
placeholder="位置"
class="filter-item"
style="width: 370px;"
:disabled="true"
>
<el-option
v-for="item in dict.point_location"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="外部编码">
<el-input v-model="form.ext_code" style="width: 370px;" :disabled="true"/>
</el-form-item>
<el-form-item label="是否启用" prop="is_used">
<el-switch v-model="form.is_used" active-value="1" inactive-value="0"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="crud.cancelCU">取消</el-button>
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
</div>
</el-dialog>
<!--表格渲染-->
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="mini" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
<el-table-column type="selection" width="55" />
<el-table-column prop="point_code" label="点位编码" />
<el-table-column prop="point_status" label="点位状态" min-width="100" show-overflow-tooltip >
<template slot-scope="scope">
{{ dict.label.sch_point_status[scope.row.point_status] }}
</template>
</el-table-column>
<el-table-column prop="vehicle_code" label="载具编码" />
<el-table-column prop="product_area" label="生产区域" >
<template slot-scope="scope">
{{ dict.label.product_area[scope.row.product_area] }}
</template>
</el-table-column>
<el-table-column prop="point_location" label="位置" >
<template slot-scope="scope">
{{ dict.label.point_location[scope.row.point_location] }}
</template>
</el-table-column>
<el-table-column prop="ext_code" label="外部编码" />
<el-table-column prop="remark" label="备注" />
<el-table-column prop="is_used" label="是否启用" >
<template slot-scope="scope">
{{ dict.label.is_used[scope.row.is_used] }}
</template>
</el-table-column>
<el-table-column prop="update_time" label="修改时间" min-width="150" show-overflow-tooltip />
<el-table-column v-permission="[]" label="操作" width="120px" align="center" fixed="right">
<template slot-scope="scope">
<udOperation
:data="scope.row"
:permission="permission"
:is-visiable-del="false"
/>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<pagination />
</div>
</div>
</template>
<script>
import crudSbpointivt from './sbpointivt'
import CRUD, { crud, form, header, presenter } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
const defaultForm = { point_id: null, point_code: null, point_status: null, vehicle_code: null, product_area: null, point_location: null, ext_code: null, remark: null, is_used: null, create_id: null, create_name: null, create_time: null, update_optid: null, update_optname: null, update_time: null }
export default {
name: 'SbPointIvt',
components: { pagination, crudOperation, rrOperation, udOperation },
dicts: ['sch_point_status', 'product_area', 'is_used', 'point_location'],
mixins: [presenter(), header(), form(defaultForm), crud()],
cruds() {
return CRUD({
title: '生箔点位库存',
url: 'api/sbpointivt',
idField: 'point_id',
sort: 'point_id,desc',
crudMethod: { ...crudSbpointivt },
optShow: {
add: false,
edit: true,
del: false,
download: false,
reset: true
}
})
},
data() {
return {
permission: {
},
rules: {
point_code: [
{ required: true, message: '点位编码不能为空', trigger: 'blur' }
],
point_status: [
{ required: true, message: '点位状态不能为空', trigger: 'blur' }
],
is_used: [
{ required: true, message: '是否启用不能为空', trigger: 'blur' }
]
}}
},
methods: {
// 钩子在获取表格数据之前执行false 则代表不获取数据
[CRUD.HOOK.beforeRefresh]() {
return true
},
hand(value) {
this.crud.toQuery()
}
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,27 @@
import request from '@/utils/request'
export function add(data) {
return request({
url: 'api/sbpointivt',
method: 'post',
data
})
}
export function del(ids) {
return request({
url: 'api/sbpointivt/',
method: 'delete',
data: ids
})
}
export function edit(data) {
return request({
url: 'api/sbpointivt',
method: 'put',
data
})
}
export default { add, edit, del }