烘烤区

This commit is contained in:
lyd
2022-10-09 15:50:25 +08:00
parent 00154727c3
commit abf814d560
6 changed files with 518 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.HotPointIvtService;
import org.nl.wms.pdm.ivt.service.dto.HotPointIvtDto;
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-09
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "烘烤区点位库存管理")
@RequestMapping("/api/hotpointivt")
@Slf4j
public class HotPointIvtController {
private final HotPointIvtService hotpointivtService;
@GetMapping
@Log("查询烘烤区点位库存")
@ApiOperation("查询烘烤区点位库存")
//@SaCheckPermission("@el.check('hotpointivt:list')")
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page){
return new ResponseEntity<>(hotpointivtService.queryAll(whereJson,page),HttpStatus.OK);
}
@PostMapping
@Log("新增烘烤区点位库存")
@ApiOperation("新增烘烤区点位库存")
//@SaCheckPermission("@el.check('hotpointivt:add')")
public ResponseEntity<Object> create(@Validated @RequestBody HotPointIvtDto dto){
hotpointivtService.create(dto);
return new ResponseEntity<>(HttpStatus.CREATED);
}
@PutMapping
@Log("修改烘烤区点位库存")
@ApiOperation("修改烘烤区点位库存")
//@SaCheckPermission("@el.check('hotpointivt:edit')")
public ResponseEntity<Object> update(@Validated @RequestBody HotPointIvtDto dto){
hotpointivtService.update(dto);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@Log("删除烘烤区点位库存")
@ApiOperation("删除烘烤区点位库存")
//@SaCheckPermission("@el.check('hotpointivt:del')")
@DeleteMapping
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
hotpointivtService.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.HotPointIvtDto;
import org.springframework.data.domain.Pageable;
import java.util.List;
import java.util.Map;
/**
* @description 服务接口
* @author lyd
* @date 2022-10-09
**/
public interface HotPointIvtService {
/**
* 查询数据分页
* @param whereJson 条件
* @param page 分页参数
* @return Map<String,Object>
*/
Map<String,Object> queryAll(Map whereJson, Pageable page);
/**
* 查询所有数据不分页
* @param whereJson 条件参数
* @return List<HotpointivtDto>
*/
List<HotPointIvtDto> queryAll(Map whereJson);
/**
* 根据ID查询
* @param ivt_id ID
* @return Hotpointivt
*/
HotPointIvtDto findById(Long ivt_id);
/**
* 根据编码查询
* @param code code
* @return Hotpointivt
*/
HotPointIvtDto findByCode(String code);
/**
* 创建
* @param dto /
*/
void create(HotPointIvtDto dto);
/**
* 编辑
* @param dto /
*/
void update(HotPointIvtDto dto);
/**
* 多选删除
* @param ids /
*/
void deleteAll(Long[] ids);
}

View File

@@ -0,0 +1,88 @@
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;
import java.math.BigDecimal;
/**
* @description /
* @author lyd
* @date 2022-10-09
**/
@Data
public class HotPointIvtDto implements Serializable {
/** 库存记录标识 */
/** 防止精度丢失 */
@JsonSerialize(using= ToStringSerializer.class)
private Long ivt_id;
/** 点位编码 */
private String point_code;
/** 点位状态 */
private String point_status;
/** 母卷号 */
private String container_name;
/** 母卷工单标识 */
private String workorder_id;
/** 母卷轴编码 */
private String full_vehicle_code;
/** 批次 */
private String pcsn;
/** 库存数 */
private BigDecimal ivt_qty;
/** 计量单位标识 */
private Long qty_unit_id;
/** 入库时间 */
private String instorage_time;
/** 生产区域 */
private String product_area;
/** 温度 */
private BigDecimal temperature;
/** 组别 */
private String group_name;
/** 位置 */
private String point_location;
/** 顺序号 */
private BigDecimal sort_seq;
/** 是否启用 */
private String is_used;
/** 备注 */
private String remark;
/** 创建人 */
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,131 @@
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.core.bean.ResultBean;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.WqlUtil;
import org.nl.wms.pdm.ivt.service.HotPointIvtService;
import org.nl.wms.pdm.ivt.service.dto.HotPointIvtDto;
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-09
**/
@Service
@RequiredArgsConstructor
@Slf4j
public class HotPointIvtServiceImpl implements HotPointIvtService {
@Override
public Map<String,Object> queryAll(Map whereJson, Pageable page){
WQLObject wo = WQLObject.getWQLObject("st_ivt_hotpointivt");
ResultBean rb = wo.pagequery(WqlUtil.getHttpContext(page), "1=1", "update_time desc");
final JSONObject json = rb.pageResult();
return json;
}
@Override
public List<HotPointIvtDto> queryAll(Map whereJson){
WQLObject wo = WQLObject.getWQLObject("st_ivt_hotpointivt");
JSONArray arr = wo.query().getResultJSONArray(0);
if (ObjectUtil.isNotEmpty(arr)) return arr.toJavaList(HotPointIvtDto.class);
return null;
}
@Override
public HotPointIvtDto findById(Long ivt_id) {
WQLObject wo = WQLObject.getWQLObject("st_ivt_hotpointivt");
JSONObject json = wo.query("ivt_id = '" + ivt_id + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(json)){
return json.toJavaObject( HotPointIvtDto.class);
}
return null;
}
@Override
public HotPointIvtDto findByCode(String code) {
WQLObject wo = WQLObject.getWQLObject("st_ivt_hotpointivt");
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(json)){
return json.toJavaObject( HotPointIvtDto.class);
}
return null;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void create(HotPointIvtDto dto) {
Long currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
dto.setIvt_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_hotpointivt");
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
wo.insert(json);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(HotPointIvtDto dto) {
HotPointIvtDto entity = this.findById(dto.getIvt_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_hotpointivt");
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_hotpointivt");
for (Long ivt_id: ids) {
JSONObject param = new JSONObject();
param.put("ivt_id", String.valueOf(ivt_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,27 @@
import request from '@/utils/request'
export function add(data) {
return request({
url: 'api/hotpointivt',
method: 'post',
data
})
}
export function del(ids) {
return request({
url: 'api/hotpointivt/',
method: 'delete',
data: ids
})
}
export function edit(data) {
return request({
url: 'api/hotpointivt',
method: 'put',
data
})
}
export default { add, edit, del }

View File

@@ -0,0 +1,141 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<!--如果想在工具栏加入更多按钮可以使用插槽方式 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;" />
</el-form-item>
<el-form-item label="点位状态" prop="point_status">
<el-input v-model="form.point_status" style="width: 370px;" />
</el-form-item>
<el-form-item label="母卷号">
<el-input v-model="form.container_name" style="width: 370px;" />
</el-form-item>
<el-form-item label="母卷轴编码">
<el-input v-model="form.full_vehicle_code" style="width: 370px;" />
</el-form-item>
<el-form-item label="批次">
<el-input v-model="form.pcsn" style="width: 370px;" />
</el-form-item>
<el-form-item label="库存数" prop="ivt_qty">
<el-input v-model="form.ivt_qty" style="width: 370px;" />
</el-form-item>
<el-form-item label="入库时间">
<el-input v-model="form.instorage_time" style="width: 370px;" />
</el-form-item>
<el-form-item label="生产区域">
<el-input v-model="form.product_area" style="width: 370px;" />
</el-form-item>
<el-form-item label="温度">
<el-input v-model="form.temperature" style="width: 370px;" />
</el-form-item>
<el-form-item label="组别">
<el-input v-model="form.group_name" style="width: 370px;" />
</el-form-item>
<el-form-item label="位置">
<el-input v-model="form.point_location" style="width: 370px;" />
</el-form-item>
<el-form-item label="顺序号" prop="sort_seq">
<el-input v-model="form.sort_seq" style="width: 370px;" />
</el-form-item>
<el-form-item label="是否启用" prop="is_used">
<el-input v-model="form.is_used" style="width: 370px;" />
</el-form-item>
<el-form-item label="备注">
<el-input v-model="form.remark" style="width: 370px;" />
</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="点位状态" />
<el-table-column prop="container_name" label="母卷号" />
<el-table-column prop="full_vehicle_code" label="母卷轴编码" />
<el-table-column prop="pcsn" label="批次" />
<el-table-column prop="ivt_qty" label="库存数" />
<el-table-column prop="instorage_time" label="入库时间" />
<el-table-column prop="product_area" label="生产区域" />
<el-table-column prop="temperature" label="温度" />
<el-table-column prop="group_name" label="组别" />
<el-table-column prop="point_location" label="位置" />
<el-table-column prop="sort_seq" label="顺序号" />
<el-table-column prop="is_used" label="是否启用" />
<el-table-column prop="remark" label="备注" />
<el-table-column prop="create_name" label="创建人姓名" />
<el-table-column prop="update_time" label="修改时间" />
<el-table-column v-permission="[]" label="操作" width="120px" align="center" fixed="right">
<template slot-scope="scope">
<udOperation
:data="scope.row"
:permission="permission"
/>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<pagination />
</div>
</div>
</template>
<script>
import crudHotpointivt from './hotpointivt'
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 = { ivt_id: null, point_code: null, point_status: null, container_name: null, workorder_id: null, full_vehicle_code: null, pcsn: null, ivt_qty: null, qty_unit_id: null, instorage_time: null, product_area: null, temperature: null, group_name: null, point_location: null, sort_seq: null, is_used: null, remark: null, create_id: null, create_name: null, create_time: null, update_optid: null, update_optname: null, update_time: null }
export default {
name: 'HotPointIvt',
components: { pagination, crudOperation, rrOperation, udOperation },
mixins: [presenter(), header(), form(defaultForm), crud()],
cruds() {
return CRUD({ title: '烘烤区点位库存', url: 'api/hotpointivt', idField: 'ivt_id', sort: 'ivt_id,desc', crudMethod: { ...crudHotpointivt }})
},
data() {
return {
permission: {
},
rules: {
point_code: [
{ required: true, message: '点位编码不能为空', trigger: 'blur' }
],
point_status: [
{ required: true, message: '点位状态不能为空', trigger: 'blur' }
],
ivt_qty: [
{ required: true, message: '库存数不能为空', trigger: 'blur' }
],
sort_seq: [
{ required: true, message: '顺序号不能为空', trigger: 'blur' }
],
is_used: [
{ required: true, message: '是否启用不能为空', trigger: 'blur' }
]
}}
},
methods: {
// 钩子在获取表格数据之前执行false 则代表不获取数据
[CRUD.HOOK.beforeRefresh]() {
return true
}
}
}
</script>
<style scoped>
</style>