备件库存查询
This commit is contained in:
@@ -0,0 +1,78 @@
|
|||||||
|
|
||||||
|
package org.nl.wms.sb.stat.rest;
|
||||||
|
|
||||||
|
|
||||||
|
import org.nl.wms.sb.stat.service.DevicesparepartivtService;
|
||||||
|
import org.nl.wms.sb.stat.service.dto.DevicesparepartivtDto;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.nl.annotation.Log;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Liuxy
|
||||||
|
* @date 2022-06-28
|
||||||
|
**/
|
||||||
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Api(tags = "备件库存查询管理")
|
||||||
|
@RequestMapping("/api/devicesparepartivt")
|
||||||
|
@Slf4j
|
||||||
|
public class DevicesparepartivtController {
|
||||||
|
|
||||||
|
private final DevicesparepartivtService devicesparepartivtService;
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
@Log("查询备件库存查询")
|
||||||
|
@ApiOperation("查询备件库存查询")
|
||||||
|
//@PreAuthorize("@el.check('devicesparepartivt:list')")
|
||||||
|
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
|
||||||
|
return new ResponseEntity<>(devicesparepartivtService.queryAll(whereJson, page), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
@Log("新增备件库存查询")
|
||||||
|
@ApiOperation("新增备件库存查询")
|
||||||
|
//@PreAuthorize("@el.check('devicesparepartivt:add')")
|
||||||
|
public ResponseEntity<Object> create(@Validated @RequestBody DevicesparepartivtDto dto) {
|
||||||
|
devicesparepartivtService.create(dto);
|
||||||
|
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping
|
||||||
|
@Log("修改备件库存查询")
|
||||||
|
@ApiOperation("修改备件库存查询")
|
||||||
|
//@PreAuthorize("@el.check('devicesparepartivt:edit')")
|
||||||
|
public ResponseEntity<Object> update(@Validated @RequestBody DevicesparepartivtDto dto) {
|
||||||
|
devicesparepartivtService.update(dto);
|
||||||
|
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log("删除备件库存查询")
|
||||||
|
@ApiOperation("删除备件库存查询")
|
||||||
|
//@PreAuthorize("@el.check('devicesparepartivt:del')")
|
||||||
|
@DeleteMapping
|
||||||
|
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
||||||
|
devicesparepartivtService.deleteAll(ids);
|
||||||
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("导出数据")
|
||||||
|
@GetMapping(value = "/download")
|
||||||
|
public void download(HttpServletResponse response, @RequestParam Map whereJson) throws IOException {
|
||||||
|
devicesparepartivtService.download(whereJson, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
|
||||||
|
package org.nl.wms.sb.stat.service;
|
||||||
|
|
||||||
|
import org.nl.wms.sb.stat.service.dto.DevicesparepartivtDto;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.List;
|
||||||
|
import java.io.IOException;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Liuxy
|
||||||
|
* @description 服务接口
|
||||||
|
* @date 2022-06-28
|
||||||
|
**/
|
||||||
|
public interface DevicesparepartivtService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询数据分页
|
||||||
|
*
|
||||||
|
* @param whereJson 条件
|
||||||
|
* @param page 分页参数
|
||||||
|
* @return Map<String, Object>
|
||||||
|
*/
|
||||||
|
Map<String, Object> queryAll(Map whereJson, Pageable page);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有数据不分页
|
||||||
|
*
|
||||||
|
* @param whereJson 条件参数
|
||||||
|
* @return List<DevicesparepartivtDto>
|
||||||
|
*/
|
||||||
|
List<DevicesparepartivtDto> queryAll(Map whereJson);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ID查询
|
||||||
|
*
|
||||||
|
* @param stockrecord_id ID
|
||||||
|
* @return Devicesparepartivt
|
||||||
|
*/
|
||||||
|
DevicesparepartivtDto findById(Long stockrecord_id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据编码查询
|
||||||
|
*
|
||||||
|
* @param code code
|
||||||
|
* @return Devicesparepartivt
|
||||||
|
*/
|
||||||
|
DevicesparepartivtDto findByCode(String code);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建
|
||||||
|
*
|
||||||
|
* @param dto /
|
||||||
|
*/
|
||||||
|
void create(DevicesparepartivtDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑
|
||||||
|
*
|
||||||
|
* @param dto /
|
||||||
|
*/
|
||||||
|
void update(DevicesparepartivtDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多选删除
|
||||||
|
*
|
||||||
|
* @param ids /
|
||||||
|
*/
|
||||||
|
void deleteAll(Long[] ids);
|
||||||
|
|
||||||
|
void download(Map whereJson, HttpServletResponse response) throws IOException;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
package org.nl.wms.sb.stat.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 Liuxy
|
||||||
|
* @date 2022-06-28
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
public class DevicesparepartivtDto implements Serializable {
|
||||||
|
|
||||||
|
/** 库存记录标识 */
|
||||||
|
/** 防止精度丢失 */
|
||||||
|
@JsonSerialize(using= ToStringSerializer.class)
|
||||||
|
private Long stockrecord_id;
|
||||||
|
|
||||||
|
/** 备件唯一标识 */
|
||||||
|
private String sparepart_only_id;
|
||||||
|
|
||||||
|
/** 物料标识 */
|
||||||
|
private Long material_id;
|
||||||
|
|
||||||
|
/** 批次 */
|
||||||
|
private String pcsn;
|
||||||
|
|
||||||
|
/** 仓库标识 */
|
||||||
|
private Long stor_id;
|
||||||
|
|
||||||
|
/** 仓库名称 */
|
||||||
|
private String stor_name;
|
||||||
|
|
||||||
|
/** 仓位标识 */
|
||||||
|
private Long struct_id;
|
||||||
|
|
||||||
|
/** 仓位编码 */
|
||||||
|
private String struct_code;
|
||||||
|
|
||||||
|
/** 仓位名称 */
|
||||||
|
private String struct_name;
|
||||||
|
|
||||||
|
/** 库存数 */
|
||||||
|
private BigDecimal ivt_qty;
|
||||||
|
|
||||||
|
/** 数量计量单位标识 */
|
||||||
|
private Long qty_unit_id;
|
||||||
|
|
||||||
|
/** 数量计量单位名称 */
|
||||||
|
private String qty_unit_name;
|
||||||
|
|
||||||
|
/** 入库时间 */
|
||||||
|
private String instorage_time;
|
||||||
|
}
|
||||||
@@ -0,0 +1,175 @@
|
|||||||
|
|
||||||
|
package org.nl.wms.sb.stat.service.impl;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.hutool.core.map.MapUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.nl.exception.BadRequestException;
|
||||||
|
import org.nl.utils.FileUtil;
|
||||||
|
import org.nl.wms.sb.stat.service.DevicesparepartivtService;
|
||||||
|
import org.nl.wms.sb.stat.service.dto.DevicesparepartivtDto;
|
||||||
|
import org.nl.wql.WQL;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
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.utils.SecurityUtils;
|
||||||
|
import org.nl.wql.core.bean.ResultBean;
|
||||||
|
import org.nl.wql.core.bean.WQLObject;
|
||||||
|
import org.nl.wql.util.WqlUtil;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Liuxy
|
||||||
|
* @description 服务实现
|
||||||
|
* @date 2022-06-28
|
||||||
|
**/
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Slf4j
|
||||||
|
public class DevicesparepartivtServiceImpl implements DevicesparepartivtService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||||
|
String material_code = MapUtil.getStr(whereJson, "material_code");
|
||||||
|
String is_all = MapUtil.getStr(whereJson, "is_all");
|
||||||
|
|
||||||
|
HashMap<String, String> map = new HashMap<>();
|
||||||
|
if (ObjectUtil.isEmpty(is_all) || StrUtil.equals(is_all, "0")) {
|
||||||
|
map.put("flag", "1");
|
||||||
|
} else {
|
||||||
|
map.put("flag", "2");
|
||||||
|
}
|
||||||
|
map.put("stor_id", MapUtil.getStr(whereJson,"stor_id"));
|
||||||
|
map.put("sect_id", MapUtil.getStr(whereJson,"sect_id"));
|
||||||
|
if (ObjectUtil.isNotEmpty(material_code)) map.put("material_code", "%"+material_code+"%");
|
||||||
|
JSONObject json = WQL.getWO("EM_DEVICEIVT001").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "ivt.material_id DESC");
|
||||||
|
return json;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DevicesparepartivtDto> queryAll(Map whereJson) {
|
||||||
|
WQLObject wo = WQLObject.getWQLObject("em_bi_devicesparepartivt");
|
||||||
|
JSONArray arr = wo.query().getResultJSONArray(0);
|
||||||
|
if (ObjectUtil.isNotEmpty(arr)) return arr.toJavaList(DevicesparepartivtDto.class);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DevicesparepartivtDto findById(Long stockrecord_id) {
|
||||||
|
WQLObject wo = WQLObject.getWQLObject("em_bi_devicesparepartivt");
|
||||||
|
JSONObject json = wo.query("stockrecord_id = '" + stockrecord_id + "'").uniqueResult(0);
|
||||||
|
if (ObjectUtil.isNotEmpty(json)) {
|
||||||
|
return json.toJavaObject(DevicesparepartivtDto.class);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DevicesparepartivtDto findByCode(String code) {
|
||||||
|
WQLObject wo = WQLObject.getWQLObject("em_bi_devicesparepartivt");
|
||||||
|
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
|
||||||
|
if (ObjectUtil.isNotEmpty(json)) {
|
||||||
|
return json.toJavaObject(DevicesparepartivtDto.class);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void create(DevicesparepartivtDto dto) {
|
||||||
|
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||||
|
String nickName = SecurityUtils.getNickName();
|
||||||
|
String now = DateUtil.now();
|
||||||
|
|
||||||
|
dto.setStockrecord_id(IdUtil.getSnowflake(1, 1).nextId());
|
||||||
|
|
||||||
|
WQLObject wo = WQLObject.getWQLObject("em_bi_devicesparepartivt");
|
||||||
|
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||||
|
wo.insert(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void update(DevicesparepartivtDto dto) {
|
||||||
|
DevicesparepartivtDto entity = this.findById(dto.getStockrecord_id());
|
||||||
|
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||||
|
|
||||||
|
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||||
|
String nickName = SecurityUtils.getNickName();
|
||||||
|
|
||||||
|
String now = DateUtil.now();
|
||||||
|
|
||||||
|
WQLObject wo = WQLObject.getWQLObject("em_bi_devicesparepartivt");
|
||||||
|
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.getNickName();
|
||||||
|
String now = DateUtil.now();
|
||||||
|
|
||||||
|
WQLObject wo = WQLObject.getWQLObject("em_bi_devicesparepartivt");
|
||||||
|
for (Long stockrecord_id : ids) {
|
||||||
|
JSONObject param = new JSONObject();
|
||||||
|
param.put("stockrecord_id", String.valueOf(stockrecord_id));
|
||||||
|
param.put("is_delete", "1");
|
||||||
|
param.put("update_optid", currentUserId);
|
||||||
|
param.put("update_optname", nickName);
|
||||||
|
param.put("update_time", now);
|
||||||
|
wo.update(param);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void download(Map whereJson, HttpServletResponse response) throws IOException {
|
||||||
|
String material_code = MapUtil.getStr(whereJson, "material_code");
|
||||||
|
String is_all = MapUtil.getStr(whereJson, "is_all");
|
||||||
|
|
||||||
|
HashMap<String, String> map = new HashMap<>();
|
||||||
|
if (ObjectUtil.isEmpty(is_all) || StrUtil.equals(is_all, "0")) {
|
||||||
|
map.put("flag", "1");
|
||||||
|
} else {
|
||||||
|
map.put("flag", "2");
|
||||||
|
}
|
||||||
|
map.put("stor_id", MapUtil.getStr(whereJson,"stor_id"));
|
||||||
|
map.put("sect_id", MapUtil.getStr(whereJson,"sect_id"));
|
||||||
|
if (ObjectUtil.isNotEmpty(material_code)) map.put("material_code", "%"+material_code+"%");
|
||||||
|
JSONArray rows = WQL.getWO("EM_DEVICEIVT001").addParamMap(map).process().getResultJSONArray(0);
|
||||||
|
|
||||||
|
List<Map<String, Object>> list = new ArrayList<>();
|
||||||
|
for (int i = 0; i < rows.size(); i++) {
|
||||||
|
JSONObject jo = rows.getJSONObject(i);
|
||||||
|
Map<String, Object> dtl_map = new LinkedHashMap<>();
|
||||||
|
dtl_map.put("库区编码", jo.getString("sect_code"));
|
||||||
|
dtl_map.put("库区名称", jo.getString("sect_name"));
|
||||||
|
dtl_map.put("物料编码", jo.getString("material_code"));
|
||||||
|
dtl_map.put("物料名称", jo.getString("material_name"));
|
||||||
|
dtl_map.put("型号", jo.getString("material_model"));
|
||||||
|
dtl_map.put("技术规格", jo.getString("material_spec"));
|
||||||
|
dtl_map.put("批次", jo.getString("pcsn"));
|
||||||
|
dtl_map.put("库存数", jo.getString("ivt_qty"));
|
||||||
|
dtl_map.put("单位", jo.getString("qty_unit_name"));
|
||||||
|
dtl_map.put("入库时间", jo.getString("instorage_time"));
|
||||||
|
list.add(dtl_map);
|
||||||
|
}
|
||||||
|
FileUtil.downloadExcel(list, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,109 @@
|
|||||||
|
[交易说明]
|
||||||
|
交易名: 备件库存分页查询
|
||||||
|
所属模块:
|
||||||
|
功能简述:
|
||||||
|
版权所有:
|
||||||
|
表引用:
|
||||||
|
版本经历:
|
||||||
|
|
||||||
|
[数据库]
|
||||||
|
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
|
||||||
|
|
||||||
|
[IO定义]
|
||||||
|
#################################################
|
||||||
|
## 表字段对应输入参数
|
||||||
|
#################################################
|
||||||
|
输入.flag TYPEAS s_string
|
||||||
|
输入.stor_id TYPEAS s_string
|
||||||
|
输入.sect_id TYPEAS s_string
|
||||||
|
输入.material_code TYPEAS s_string
|
||||||
|
|
||||||
|
|
||||||
|
[临时表]
|
||||||
|
--这边列出来的临时表就会在运行期动态创建
|
||||||
|
|
||||||
|
[临时变量]
|
||||||
|
--所有中间过程变量均可在此处定义
|
||||||
|
|
||||||
|
[业务过程]
|
||||||
|
|
||||||
|
##########################################
|
||||||
|
# 1、输入输出检查 #
|
||||||
|
##########################################
|
||||||
|
|
||||||
|
|
||||||
|
##########################################
|
||||||
|
# 2、主过程前处理 #
|
||||||
|
##########################################
|
||||||
|
|
||||||
|
|
||||||
|
##########################################
|
||||||
|
# 3、业务主过程 #
|
||||||
|
##########################################
|
||||||
|
|
||||||
|
IF 输入.flag = "1"
|
||||||
|
PAGEQUERY
|
||||||
|
SELECT
|
||||||
|
MAX(struct.sect_code) AS sect_code,
|
||||||
|
MAX(struct.sect_name) AS sect_name,
|
||||||
|
me.material_code,
|
||||||
|
me.material_name,
|
||||||
|
me.material_spec,
|
||||||
|
me.material_model,
|
||||||
|
ivt.pcsn,
|
||||||
|
sum(ivt.ivt_qty) AS ivt_qty,
|
||||||
|
MAX(ivt.qty_unit_name) AS qty_unit_name,
|
||||||
|
MAX(ivt.instorage_time) AS instorage_time
|
||||||
|
FROM
|
||||||
|
EM_BI_DeviceSparePartIvt ivt
|
||||||
|
LEFT JOIN ST_IVT_StructAttr struct ON ivt.struct_id = struct.struct_id
|
||||||
|
LEFT JOIN MD_ME_MaterialBase me ON me.material_id = ivt.material_id
|
||||||
|
WHERE 1=1
|
||||||
|
OPTION 输入.stor_id <> ""
|
||||||
|
struct.stor_id = 输入.stor_id
|
||||||
|
ENDOPTION
|
||||||
|
OPTION 输入.sect_id <> ""
|
||||||
|
struct.sect_id = 输入.sect_id
|
||||||
|
ENDOPTION
|
||||||
|
|
||||||
|
OPTION 输入.material_code <> ""
|
||||||
|
(me.material_name like 输入.material_code or
|
||||||
|
me.material_code like 输入.material_code)
|
||||||
|
ENDOPTION
|
||||||
|
|
||||||
|
group by ivt.material_id,ivt.pcsn
|
||||||
|
|
||||||
|
ENDSELECT
|
||||||
|
ENDPAGEQUERY
|
||||||
|
ENDIF
|
||||||
|
|
||||||
|
IF 输入.flag = "2"
|
||||||
|
PAGEQUERY
|
||||||
|
SELECT
|
||||||
|
struct.sect_code,
|
||||||
|
struct.sect_name,
|
||||||
|
me.material_code,
|
||||||
|
me.material_name,
|
||||||
|
me.material_spec,
|
||||||
|
me.material_model,
|
||||||
|
ivt.*
|
||||||
|
FROM
|
||||||
|
EM_BI_DeviceSparePartIvt ivt
|
||||||
|
LEFT JOIN ST_IVT_StructAttr struct ON ivt.struct_id = struct.struct_id
|
||||||
|
LEFT JOIN MD_ME_MaterialBase me ON me.material_id = ivt.material_id
|
||||||
|
WHERE 1=1
|
||||||
|
OPTION 输入.stor_id <> ""
|
||||||
|
struct.stor_id = 输入.stor_id
|
||||||
|
ENDOPTION
|
||||||
|
OPTION 输入.sect_id <> ""
|
||||||
|
struct.sect_id = 输入.sect_id
|
||||||
|
ENDOPTION
|
||||||
|
|
||||||
|
OPTION 输入.material_code <> ""
|
||||||
|
(me.material_name like 输入.material_code or
|
||||||
|
me.material_code like 输入.material_code)
|
||||||
|
ENDOPTION
|
||||||
|
|
||||||
|
ENDSELECT
|
||||||
|
ENDPAGEQUERY
|
||||||
|
ENDIF
|
||||||
27
mes/qd/src/api/wms/sb/devicesparepartivt.js
Normal file
27
mes/qd/src/api/wms/sb/devicesparepartivt.js
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
export function add(data) {
|
||||||
|
return request({
|
||||||
|
url: 'api/devicesparepartivt',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function del(ids) {
|
||||||
|
return request({
|
||||||
|
url: 'api/devicesparepartivt/',
|
||||||
|
method: 'delete',
|
||||||
|
data: ids
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function edit(data) {
|
||||||
|
return request({
|
||||||
|
url: 'api/devicesparepartivt',
|
||||||
|
method: 'put',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export default { add, edit, del }
|
||||||
154
mes/qd/src/views/wms/sb/stat/deviceivtquery/index.vue
Normal file
154
mes/qd/src/views/wms/sb/stat/deviceivtquery/index.vue
Normal file
@@ -0,0 +1,154 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<!--工具栏-->
|
||||||
|
<div class="head-container">
|
||||||
|
<div v-if="crud.props.searchToggle">
|
||||||
|
<el-form
|
||||||
|
size="mini"
|
||||||
|
:inline="true"
|
||||||
|
class="demo-form-inline"
|
||||||
|
label-position="right"
|
||||||
|
label-width="80px"
|
||||||
|
label-suffix=":"
|
||||||
|
>
|
||||||
|
<el-form-item label="所属库区">
|
||||||
|
<el-cascader
|
||||||
|
placeholder="所属库区"
|
||||||
|
:options="sects"
|
||||||
|
:props="{ checkStrictly: true }"
|
||||||
|
clearable
|
||||||
|
class="filter-item"
|
||||||
|
@change="sectQueryChange"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="备件物料">
|
||||||
|
<el-input
|
||||||
|
v-model="query.material_code"
|
||||||
|
clearable
|
||||||
|
placeholder="编码、名称"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="按备件" label-width="120px">
|
||||||
|
<el-switch v-model="query.is_all" active-value="1" inactive-value="0" @change="crud.toQuery()" />
|
||||||
|
</el-form-item>
|
||||||
|
<rrOperation />
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||||
|
<crudOperation :permission="permission">
|
||||||
|
<el-button
|
||||||
|
slot="right"
|
||||||
|
class="filter-item"
|
||||||
|
type="success"
|
||||||
|
icon="el-icon-check"
|
||||||
|
size="mini"
|
||||||
|
@click="downdtl"
|
||||||
|
>
|
||||||
|
导出Excel
|
||||||
|
</el-button>
|
||||||
|
</crudOperation>
|
||||||
|
<!--表格渲染-->
|
||||||
|
<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="sect_code" label="库区编码" />
|
||||||
|
<el-table-column prop="sect_name" label="库区名称" />
|
||||||
|
<el-table-column prop="material_code" label="物料编码" />
|
||||||
|
<el-table-column prop="material_name" label="名称" />
|
||||||
|
<el-table-column prop="material_model" label="型号" />
|
||||||
|
<el-table-column prop="material_spec" label="技术规格" />
|
||||||
|
<el-table-column prop="pcsn" label="批次" />
|
||||||
|
<el-table-column prop="ivt_qty" label="库存数" />
|
||||||
|
<el-table-column prop="qty_unit_name" label="单位" />
|
||||||
|
<el-table-column prop="instorage_time" label="入库时间" width="150px" />
|
||||||
|
</el-table>
|
||||||
|
<!--分页组件-->
|
||||||
|
<pagination />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import crudDevicesparepartivt from '@/api/wms/sb/devicesparepartivt'
|
||||||
|
import CRUD, { presenter, header, form, crud } 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'
|
||||||
|
import crudSectattr from '@/api/wms/basedata/st/sectattr'
|
||||||
|
import { download } from '@/api/data'
|
||||||
|
import { downloadFile } from '@/utils'
|
||||||
|
|
||||||
|
const defaultForm = { stockrecord_id: null, sparepart_only_id: null, material_id: null, pcsn: null, stor_id: null, stor_name: null, struct_id: null, struct_code: null, struct_name: null, ivt_qty: null, qty_unit_id: null, qty_unit_name: null, instorage_time: null }
|
||||||
|
export default {
|
||||||
|
name: 'Deviceivtquery',
|
||||||
|
components: { pagination, crudOperation, rrOperation, udOperation },
|
||||||
|
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||||
|
cruds() {
|
||||||
|
return CRUD({
|
||||||
|
title: '备件库存查询',
|
||||||
|
url: 'api/devicesparepartivt',
|
||||||
|
idField: 'stockrecord_id',
|
||||||
|
sort: 'stockrecord_id,desc',
|
||||||
|
crudMethod: { ...crudDevicesparepartivt },
|
||||||
|
optShow: {
|
||||||
|
add: false,
|
||||||
|
edit: false,
|
||||||
|
del: false,
|
||||||
|
download: false,
|
||||||
|
reset: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
sects: [],
|
||||||
|
permission: {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
crudSectattr.getSect({ 'is_attachment': '1' }).then(res => {
|
||||||
|
this.sects = res.content
|
||||||
|
})
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
||||||
|
[CRUD.HOOK.beforeRefresh]() {
|
||||||
|
return true
|
||||||
|
},
|
||||||
|
sectQueryChange(val) {
|
||||||
|
if (val.length === 1) {
|
||||||
|
this.query.stor_id = val[0]
|
||||||
|
this.query.sect_id = ''
|
||||||
|
}
|
||||||
|
if (val.length === 0) {
|
||||||
|
this.query.sect_id = ''
|
||||||
|
this.query.stor_id = ''
|
||||||
|
}
|
||||||
|
if (val.length === 2) {
|
||||||
|
this.query.stor_id = val[0]
|
||||||
|
this.query.sect_id = val[1]
|
||||||
|
}
|
||||||
|
this.crud.toQuery()
|
||||||
|
},
|
||||||
|
downdtl() {
|
||||||
|
if (this.currentRow !== null) {
|
||||||
|
crud.downloadLoading = true
|
||||||
|
download('/api/devicesparepartivt/download', this.crud.query).then(result => {
|
||||||
|
downloadFile(result, '备件库存', 'xlsx')
|
||||||
|
crud.downloadLoading = false
|
||||||
|
}).catch(() => {
|
||||||
|
crud.downloadLoading = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -236,9 +236,9 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
crudSectattr.getSect().then(res => {
|
// crudSectattr.getSect().then(res => {
|
||||||
this.sects = res.content
|
// this.sects = res.content
|
||||||
})
|
// })
|
||||||
crudSectattr.getSect({ 'is_materialstore': '1' }).then(res => {
|
crudSectattr.getSect({ 'is_materialstore': '1' }).then(res => {
|
||||||
this.sects = res.content
|
this.sects = res.content
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user