李永德
1 year ago
19 changed files with 523 additions and 5 deletions
Binary file not shown.
@ -0,0 +1,66 @@ |
|||
package org.nl.wms.pdm.residue.controller; |
|||
|
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.common.base.TableDataInfo; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
import org.nl.common.logging.annotation.Log; |
|||
import org.nl.wms.pdm.residue.service.IPdmBdMaterialResidueService; |
|||
import org.nl.wms.pdm.residue.service.dao.PdmBdMaterialResidue; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
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; |
|||
import java.util.Set; |
|||
/** |
|||
* @author lyd |
|||
* @date 2023-07-28 |
|||
**/ |
|||
@Slf4j |
|||
@RestController |
|||
@Api(tags = "压机泥料剩余记录管理") |
|||
@RequestMapping("/api/pdmBdMaterialResidue") |
|||
public class PdmBdMaterialResidueController { |
|||
|
|||
@Autowired |
|||
private IPdmBdMaterialResidueService pdmBdMaterialResidueService; |
|||
|
|||
@GetMapping |
|||
@Log("查询压机泥料剩余记录") |
|||
@ApiOperation("查询压机泥料剩余记录") |
|||
//@SaCheckPermission("@el.check('pdmBdMaterialResidue:list')")
|
|||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page){ |
|||
return new ResponseEntity<>(TableDataInfo.build(pdmBdMaterialResidueService.queryAll(whereJson,page)),HttpStatus.OK); |
|||
} |
|||
|
|||
@PostMapping |
|||
@Log("新增压机泥料剩余记录") |
|||
@ApiOperation("新增压机泥料剩余记录") |
|||
//@SaCheckPermission("@el.check('pdmBdMaterialResidue:add')")
|
|||
public ResponseEntity<Object> create(@Validated @RequestBody PdmBdMaterialResidue entity){ |
|||
pdmBdMaterialResidueService.create(entity); |
|||
return new ResponseEntity<>(HttpStatus.CREATED); |
|||
} |
|||
|
|||
@PutMapping |
|||
@Log("修改压机泥料剩余记录") |
|||
@ApiOperation("修改压机泥料剩余记录") |
|||
//@SaCheckPermission("@el.check('pdmBdMaterialResidue:edit')")
|
|||
public ResponseEntity<Object> update(@Validated @RequestBody PdmBdMaterialResidue entity){ |
|||
pdmBdMaterialResidueService.update(entity); |
|||
return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
|||
} |
|||
|
|||
@Log("删除压机泥料剩余记录") |
|||
@ApiOperation("删除压机泥料剩余记录") |
|||
//@SaCheckPermission("@el.check('pdmBdMaterialResidue:del')")
|
|||
@DeleteMapping |
|||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) { |
|||
pdmBdMaterialResidueService.deleteAll(ids); |
|||
return new ResponseEntity<>(HttpStatus.OK); |
|||
} |
|||
} |
@ -0,0 +1,49 @@ |
|||
package org.nl.wms.pdm.residue.service; |
|||
|
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import org.nl.wms.ext.acs.service.dto.to.wms.ApplyTaskRequest; |
|||
import org.nl.wms.pdm.residue.service.dao.PdmBdMaterialResidue; |
|||
|
|||
import java.util.Map; |
|||
import java.util.Set; |
|||
|
|||
/** |
|||
* @description 服务接口 |
|||
* @author lyd |
|||
* @date 2023-07-28 |
|||
**/ |
|||
public interface IPdmBdMaterialResidueService extends IService<PdmBdMaterialResidue> { |
|||
|
|||
/** |
|||
* 查询数据分页 |
|||
* @param whereJson 条件 |
|||
* @param pageable 分页参数 |
|||
* @return IPage<PdmBdMaterialResidue> |
|||
*/ |
|||
IPage<PdmBdMaterialResidue> queryAll(Map whereJson, PageQuery pageable); |
|||
|
|||
/** |
|||
* 创建 |
|||
* @param entity / |
|||
*/ |
|||
void create(PdmBdMaterialResidue entity); |
|||
|
|||
/** |
|||
* 编辑 |
|||
* @param entity / |
|||
*/ |
|||
void update(PdmBdMaterialResidue entity); |
|||
|
|||
/** |
|||
* 多选删除 |
|||
* @param ids / |
|||
*/ |
|||
void deleteAll(Set<String> ids); |
|||
|
|||
/** |
|||
* 添加数据 |
|||
*/ |
|||
void addByApplyTaskRequest(ApplyTaskRequest applyTaskRequest); |
|||
} |
@ -0,0 +1,46 @@ |
|||
package org.nl.wms.pdm.residue.service.dao; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.IdType; |
|||
import com.baomidou.mybatisplus.annotation.TableId; |
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @description / |
|||
* @author lyd |
|||
* @date 2023-07-28 |
|||
**/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = false) |
|||
@TableName("pdm_bd_material_residue") |
|||
public class PdmBdMaterialResidue implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
@TableId(value = "record_id", type = IdType.NONE) |
|||
@ApiModelProperty(value = "记录标识") |
|||
private String record_id; |
|||
|
|||
@ApiModelProperty(value = "泥料编码") |
|||
private String raw_material_code; |
|||
|
|||
@ApiModelProperty(value = "设备编码") |
|||
private String device_code; |
|||
|
|||
@ApiModelProperty(value = "泥料编码") |
|||
private String weight; |
|||
|
|||
@ApiModelProperty(value = "工单号") |
|||
private String workorder_code; |
|||
|
|||
@ApiModelProperty(value = "物料id") |
|||
private String material_id; |
|||
|
|||
@ApiModelProperty(value = "记录时间") |
|||
private String record_time; |
|||
|
|||
} |
@ -0,0 +1,12 @@ |
|||
package org.nl.wms.pdm.residue.service.dao.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import org.nl.wms.pdm.residue.service.dao.PdmBdMaterialResidue; |
|||
|
|||
/** |
|||
* @author lyd |
|||
* @date 2023-07-28 |
|||
**/ |
|||
public interface PdmBdMaterialResidueMapper extends BaseMapper<PdmBdMaterialResidue> { |
|||
|
|||
} |
@ -0,0 +1,5 @@ |
|||
<?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.pdm.residue.service.dao.mapper.PdmBdMaterialResidueMapper"> |
|||
|
|||
</mapper> |
@ -0,0 +1,34 @@ |
|||
package org.nl.wms.pdm.residue.service.dto; |
|||
|
|||
import lombok.Data; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @description / |
|||
* @author lyd |
|||
* @date 2023-07-28 |
|||
**/ |
|||
@Data |
|||
public class PdmBdMaterialResidueDto implements Serializable { |
|||
|
|||
/** 记录标识 */ |
|||
private String record_id; |
|||
|
|||
/** 泥料编码 */ |
|||
private String raw_material_code; |
|||
|
|||
/** 设备编码 */ |
|||
private String device_code; |
|||
|
|||
/** 泥料编码 */ |
|||
private String weight; |
|||
|
|||
/** 工单号 */ |
|||
private String workorder_code; |
|||
|
|||
/** 物料id */ |
|||
private String material_id; |
|||
|
|||
/** 记录时间 */ |
|||
private String record_time; |
|||
} |
@ -0,0 +1,12 @@ |
|||
package org.nl.wms.pdm.residue.service.dto; |
|||
|
|||
import org.nl.common.domain.query.BaseQuery; |
|||
import org.nl.wms.pdm.residue.service.dao.PdmBdMaterialResidue; |
|||
|
|||
/** |
|||
* @author lyd |
|||
* @date 2023-07-28 |
|||
**/ |
|||
public class PdmBdMaterialResidueQuery extends BaseQuery<PdmBdMaterialResidue> { |
|||
|
|||
} |
@ -0,0 +1,90 @@ |
|||
package org.nl.wms.pdm.residue.service.impl; |
|||
|
|||
import cn.hutool.core.date.DateUtil; |
|||
import cn.hutool.core.util.IdUtil; |
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
import org.nl.common.exception.BadRequestException; |
|||
import org.nl.common.utils.SecurityUtils; |
|||
import org.nl.wms.ext.acs.service.dto.to.wms.ApplyTaskRequest; |
|||
import org.nl.wms.pdm.residue.service.IPdmBdMaterialResidueService; |
|||
import org.nl.wms.pdm.residue.service.dao.mapper.PdmBdMaterialResidueMapper; |
|||
import org.nl.wms.pdm.residue.service.dao.PdmBdMaterialResidue; |
|||
import org.nl.wms.pdm.workorder.service.IPdmBdWorkorderService; |
|||
import org.nl.wms.pdm.workorder.service.dao.PdmBdWorkorder; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.Map; |
|||
import java.util.Set; |
|||
|
|||
/** |
|||
* @description 服务实现 |
|||
* @author lyd |
|||
* @date 2023-07-28 |
|||
**/ |
|||
@Slf4j |
|||
@Service |
|||
public class PdmBdMaterialResidueServiceImpl extends ServiceImpl<PdmBdMaterialResidueMapper, PdmBdMaterialResidue> implements IPdmBdMaterialResidueService { |
|||
|
|||
@Autowired |
|||
private PdmBdMaterialResidueMapper pdmBdMaterialResidueMapper; |
|||
@Autowired |
|||
private IPdmBdWorkorderService workorderService; |
|||
|
|||
@Override |
|||
public IPage<PdmBdMaterialResidue> queryAll(Map whereJson, PageQuery page){ |
|||
LambdaQueryWrapper<PdmBdMaterialResidue> lam = new LambdaQueryWrapper<>(); |
|||
IPage<PdmBdMaterialResidue> pages = new Page<>(page.getPage() + 1, page.getSize()); |
|||
pdmBdMaterialResidueMapper.selectPage(pages, lam); |
|||
return pages; |
|||
} |
|||
|
|||
@Override |
|||
public void create(PdmBdMaterialResidue entity) { |
|||
entity.setRecord_id(IdUtil.getSnowflake(1, 1).nextIdStr()); |
|||
entity.setRecord_time(DateUtil.now()); |
|||
pdmBdMaterialResidueMapper.insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
public void update(PdmBdMaterialResidue entity) { |
|||
PdmBdMaterialResidue dto = pdmBdMaterialResidueMapper.selectById(entity.getRecord_id()); |
|||
if (dto == null) throw new BadRequestException("被删除或无权限,操作失败!"); |
|||
String now = DateUtil.now(); |
|||
entity.setRecord_time(now); |
|||
|
|||
pdmBdMaterialResidueMapper.updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
public void deleteAll(Set<String> ids) { |
|||
// 真删除
|
|||
pdmBdMaterialResidueMapper.deleteBatchIds(ids); |
|||
} |
|||
|
|||
@Override |
|||
public void addByApplyTaskRequest(ApplyTaskRequest applyTaskRequest) { |
|||
// 查找工单
|
|||
PdmBdWorkorder code = workorderService.getByCode(applyTaskRequest.getOrder_code()); |
|||
PdmBdMaterialResidue materialResidue = new PdmBdMaterialResidue(); |
|||
materialResidue.setRecord_id(IdUtil.getSnowflake(1,1).nextIdStr()); |
|||
if (ObjectUtil.isNotEmpty(code)) { |
|||
materialResidue.setMaterial_id(code.getMaterial_id()); |
|||
} |
|||
materialResidue.setWorkorder_code(applyTaskRequest.getOrder_code()); |
|||
materialResidue.setDevice_code(applyTaskRequest.getDevice_code()); |
|||
materialResidue.setRaw_material_code(applyTaskRequest.getMaterial_code()); |
|||
materialResidue.setWeight(applyTaskRequest.getWeight()); |
|||
materialResidue.setRecord_time(DateUtil.now()); |
|||
pdmBdMaterialResidueMapper.insert(materialResidue); |
|||
|
|||
} |
|||
|
|||
} |
@ -0,0 +1,102 @@ |
|||
<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="泥料编码"> |
|||
<el-input v-model="form.raw_material_code" style="width: 370px;" /> |
|||
</el-form-item> |
|||
<el-form-item label="设备编码"> |
|||
<el-input v-model="form.device_code" style="width: 370px;" /> |
|||
</el-form-item> |
|||
<el-form-item label="泥料编码"> |
|||
<el-input v-model="form.weight" style="width: 370px;" /> |
|||
</el-form-item> |
|||
<el-form-item label="工单号"> |
|||
<el-input v-model="form.workorder_code" style="width: 370px;" /> |
|||
</el-form-item> |
|||
<el-form-item label="记录时间"> |
|||
<el-input v-model="form.record_time" 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="raw_material_code" label="泥料编码" :min-width="flexWidth('raw_material_code',crud.data,'泥料编码')"/> |
|||
<el-table-column prop="device_code" label="设备编码" :min-width="flexWidth('device_code',crud.data,'设备编码')"/> |
|||
<el-table-column prop="weight" label="泥料编码" :min-width="flexWidth('weight',crud.data,'泥料编码')"/> |
|||
<el-table-column prop="workorder_code" label="工单号" :min-width="flexWidth('workorder_code',crud.data,'工单号')"/> |
|||
<el-table-column prop="record_time" label="记录时间" :min-width="flexWidth('record_time',crud.data,'记录时间')"/> |
|||
<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 crudPdmBdMaterialResidue from './pdmBdMaterialResidue' |
|||
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 = { |
|||
record_id: null, |
|||
raw_material_code: null, |
|||
device_code: null, |
|||
weight: null, |
|||
workorder_code: null, |
|||
material_id: null, |
|||
record_time: null |
|||
} |
|||
export default { |
|||
name: 'PdmBdMaterialResidue', |
|||
components: { pagination, crudOperation, rrOperation, udOperation }, |
|||
mixins: [presenter(), header(), form(defaultForm), crud()], |
|||
cruds() { |
|||
return CRUD({ |
|||
title: '压机泥料剩余记录', |
|||
url: 'api/pdmBdMaterialResidue', |
|||
idField: 'record_id', |
|||
sort: 'record_id,desc', |
|||
crudMethod: { ...crudPdmBdMaterialResidue } |
|||
}) |
|||
}, |
|||
data() { |
|||
return { |
|||
permission: { |
|||
}, |
|||
rules: { |
|||
} } |
|||
}, |
|||
methods: { |
|||
// 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
|||
[CRUD.HOOK.beforeRefresh]() { |
|||
return true |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style scoped> |
|||
|
|||
</style> |
@ -0,0 +1,27 @@ |
|||
import request from '@/utils/request' |
|||
|
|||
export function add(data) { |
|||
return request({ |
|||
url: 'api/pdmBdMaterialResidue', |
|||
method: 'post', |
|||
data |
|||
}) |
|||
} |
|||
|
|||
export function del(ids) { |
|||
return request({ |
|||
url: 'api/pdmBdMaterialResidue/', |
|||
method: 'delete', |
|||
data: ids |
|||
}) |
|||
} |
|||
|
|||
export function edit(data) { |
|||
return request({ |
|||
url: 'api/pdmBdMaterialResidue', |
|||
method: 'put', |
|||
data |
|||
}) |
|||
} |
|||
|
|||
export default { add, edit, del } |
Loading…
Reference in new issue