载具维护
This commit is contained in:
@@ -1,85 +0,0 @@
|
|||||||
|
|
||||||
package org.nl.wms.basedata.rest;
|
|
||||||
|
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
|
||||||
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.basedata.service.StoragevehicleinfoService;
|
|
||||||
import org.nl.wms.basedata.service.dto.VehicleDto;
|
|
||||||
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 ldjun
|
|
||||||
* @date 2021-12-09
|
|
||||||
**/
|
|
||||||
@RestController
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
@Api(tags = "载具管理")
|
|
||||||
@RequestMapping("/api/storagevehicleinfo")
|
|
||||||
@Slf4j
|
|
||||||
public class StoragevehicleinfoController {
|
|
||||||
|
|
||||||
private final StoragevehicleinfoService storagevehicleinfoService;
|
|
||||||
|
|
||||||
@GetMapping
|
|
||||||
@Log("查询载具")
|
|
||||||
@ApiOperation("查询载具")
|
|
||||||
//@SaCheckPermission("mdPbStoragevehicleinfo:list")
|
|
||||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page){
|
|
||||||
return new ResponseEntity<>(storagevehicleinfoService.queryAll(whereJson,page),HttpStatus.OK);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping
|
|
||||||
@Log("新增载具")
|
|
||||||
@ApiOperation("新增载具")
|
|
||||||
//@SaCheckPermission("mdPbStoragevehicleinfo:add")
|
|
||||||
public ResponseEntity<Object> create(@RequestBody Map map){
|
|
||||||
return new ResponseEntity<>(storagevehicleinfoService.create(map),HttpStatus.CREATED);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PutMapping
|
|
||||||
@Log("修改载具")
|
|
||||||
@ApiOperation("修改载具")
|
|
||||||
//@SaCheckPermission("mdPbStoragevehicleinfo:edit")
|
|
||||||
public ResponseEntity<Object> update(@Validated @RequestBody VehicleDto dto){
|
|
||||||
storagevehicleinfoService.update(dto);
|
|
||||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Log("删除载具")
|
|
||||||
@ApiOperation("删除载具")
|
|
||||||
//@SaCheckPermission("mdPbStoragevehicleinfo:del")
|
|
||||||
@DeleteMapping
|
|
||||||
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
|
||||||
storagevehicleinfoService.deleteAll(ids);
|
|
||||||
return new ResponseEntity<>(HttpStatus.OK);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PutMapping("/changeActive")
|
|
||||||
@Log("修改点位启用状态")
|
|
||||||
@ApiOperation("修改点位启用状态")
|
|
||||||
//@SaCheckPermission("store:edit")
|
|
||||||
public ResponseEntity<Object> changeActive(@RequestBody JSONObject json) {
|
|
||||||
storagevehicleinfoService.changeActive(json);
|
|
||||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/getVehicle/{code}")
|
|
||||||
@Log("获取起始载具号")
|
|
||||||
@ApiOperation("获取起始载具号")
|
|
||||||
//@SaCheckPermission("store:edit")
|
|
||||||
public ResponseEntity<Object> getVehicle(@PathVariable String code) {
|
|
||||||
JSONObject json = storagevehicleinfoService.getVehicle(code);
|
|
||||||
return new ResponseEntity<>(json,HttpStatus.OK);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
|
||||||
|
package org.nl.wms.basedata.rest;
|
||||||
|
|
||||||
|
|
||||||
|
import org.nl.wms.basedata.service.VehicleService;
|
||||||
|
import org.nl.wms.basedata.service.dto.VehicleDto;
|
||||||
|
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-18
|
||||||
|
**/
|
||||||
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Api(tags = "载具维护管理")
|
||||||
|
@RequestMapping("/api/vehicle")
|
||||||
|
@Slf4j
|
||||||
|
public class VehicleController {
|
||||||
|
|
||||||
|
private final VehicleService vehicleService;
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
@Log("查询载具维护")
|
||||||
|
@ApiOperation("查询载具维护")
|
||||||
|
//@SaCheckPermission("@el.check('vehicle:list')")
|
||||||
|
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page){
|
||||||
|
return new ResponseEntity<>(vehicleService.queryAll(whereJson,page),HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
@Log("新增载具维护")
|
||||||
|
@ApiOperation("新增载具维护")
|
||||||
|
//@SaCheckPermission("@el.check('vehicle:add')")
|
||||||
|
public ResponseEntity<Object> create(@Validated @RequestBody VehicleDto dto){
|
||||||
|
vehicleService.create(dto);
|
||||||
|
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping
|
||||||
|
@Log("修改载具维护")
|
||||||
|
@ApiOperation("修改载具维护")
|
||||||
|
//@SaCheckPermission("@el.check('vehicle:edit')")
|
||||||
|
public ResponseEntity<Object> update(@Validated @RequestBody VehicleDto dto){
|
||||||
|
vehicleService.update(dto);
|
||||||
|
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log("删除载具维护")
|
||||||
|
@ApiOperation("删除载具维护")
|
||||||
|
//@SaCheckPermission("@el.check('vehicle:del')")
|
||||||
|
@DeleteMapping
|
||||||
|
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
||||||
|
vehicleService.deleteAll(ids);
|
||||||
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,20 +1,19 @@
|
|||||||
|
|
||||||
package org.nl.wms.basedata.service;
|
package org.nl.wms.basedata.service;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONArray;
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
|
||||||
import org.nl.wms.basedata.service.dto.VehicleDto;
|
import org.nl.wms.basedata.service.dto.VehicleDto;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.List;
|
||||||
|
import java.io.IOException;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 服务接口
|
* @description 服务接口
|
||||||
* @author ldjun
|
* @author lyd
|
||||||
* @date 2021-12-09
|
* @date 2022-10-18
|
||||||
**/
|
**/
|
||||||
public interface StoragevehicleinfoService {
|
public interface VehicleService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询数据分页
|
* 查询数据分页
|
||||||
@@ -27,30 +26,30 @@ public interface StoragevehicleinfoService {
|
|||||||
/**
|
/**
|
||||||
* 查询所有数据不分页
|
* 查询所有数据不分页
|
||||||
* @param whereJson 条件参数
|
* @param whereJson 条件参数
|
||||||
* @return List<StoragevehicleinfoDto>
|
* @return List<VehicleDto>
|
||||||
*/
|
*/
|
||||||
List<VehicleDto> queryAll(Map whereJson);
|
List<VehicleDto> queryAll(Map whereJson);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据ID查询
|
* 根据ID查询
|
||||||
* @param storagevehicle_id ID
|
* @param vehicle_id ID
|
||||||
* @return MdPbStoragevehicleinfo
|
* @return Vehicle
|
||||||
*/
|
*/
|
||||||
VehicleDto findById(Long storagevehicle_id);
|
VehicleDto findById(Long vehicle_id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据编码查询
|
* 根据编码查询
|
||||||
* @param code code
|
* @param code code
|
||||||
* @return MdPbStoragevehicleinfo
|
* @return Vehicle
|
||||||
*/
|
*/
|
||||||
VehicleDto findByCode(String code);
|
VehicleDto findByCode(String code);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建
|
* 创建
|
||||||
* @param map /
|
* @param dto /
|
||||||
*/
|
*/
|
||||||
JSONArray create(Map map);
|
void create(VehicleDto dto);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 编辑
|
* 编辑
|
||||||
@@ -63,16 +62,4 @@ public interface StoragevehicleinfoService {
|
|||||||
* @param ids /
|
* @param ids /
|
||||||
*/
|
*/
|
||||||
void deleteAll(Long[] ids);
|
void deleteAll(Long[] ids);
|
||||||
|
|
||||||
/**
|
|
||||||
* 多修改启用状态
|
|
||||||
* @param json /
|
|
||||||
*/
|
|
||||||
void changeActive(JSONObject json);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取起始载具号
|
|
||||||
* @param code /
|
|
||||||
*/
|
|
||||||
JSONObject getVehicle(String code);
|
|
||||||
}
|
}
|
||||||
@@ -1,61 +1,75 @@
|
|||||||
package org.nl.wms.basedata.service.dto;
|
package org.nl.wms.basedata.service.dto;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
|
||||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.math.BigDecimal;
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description /
|
* @description /
|
||||||
* @author ldjun
|
* @author lyd
|
||||||
* @date 2021-12-09
|
* @date 2022-10-18
|
||||||
**/
|
**/
|
||||||
@Data
|
@Data
|
||||||
public class VehicleDto implements Serializable {
|
public class VehicleDto implements Serializable {
|
||||||
|
|
||||||
/** 防止精度丢失 */
|
/** 载具标识 */
|
||||||
@JsonSerialize(using= ToStringSerializer.class)
|
/** 防止精度丢失 */
|
||||||
private Long storagevehicle_id;
|
@JsonSerialize(using= ToStringSerializer.class)
|
||||||
|
private Long vehicle_id;
|
||||||
|
|
||||||
private String vehicle_code;
|
/** 载具编码 */
|
||||||
|
private String vehicle_code;
|
||||||
|
|
||||||
private String vehicle_name;
|
/** 载具名称 */
|
||||||
|
private String vehicle_name;
|
||||||
|
|
||||||
private String one_code;
|
/** 一维码 */
|
||||||
|
private String one_code;
|
||||||
|
|
||||||
private String two_code;
|
/** 二维码 */
|
||||||
|
private String two_code;
|
||||||
|
|
||||||
private String rfid_code;
|
/** RFID编码 */
|
||||||
|
private String rfid_code;
|
||||||
|
|
||||||
private Long create_id;
|
/** 载具类型 */
|
||||||
|
private String vehicle_type;
|
||||||
|
|
||||||
private String create_name;
|
/** 载具宽度 */
|
||||||
|
private BigDecimal vehicle_width;
|
||||||
|
|
||||||
private String create_time;
|
/** 载具长度 */
|
||||||
|
private BigDecimal vehicle_long;
|
||||||
|
|
||||||
private Long update_optid;
|
/** 载具高度 */
|
||||||
|
private BigDecimal vehicle_height;
|
||||||
|
|
||||||
private String update_optname;
|
/** 载具超仓位类型 */
|
||||||
|
private String overstruct_type;
|
||||||
|
|
||||||
private String update_time;
|
/** 占仓位数 */
|
||||||
|
private BigDecimal occupystruct_qty;
|
||||||
|
|
||||||
private String is_delete;
|
/** 外部标识 */
|
||||||
|
private String ext_id;
|
||||||
|
|
||||||
private String is_used;
|
/** 创建人 */
|
||||||
|
private Long create_id;
|
||||||
|
|
||||||
private String storagevehicle_type;
|
/** 创建人 */
|
||||||
|
private String create_name;
|
||||||
|
|
||||||
private BigDecimal vehicle_width;
|
/** 创建时间 */
|
||||||
|
private String create_time;
|
||||||
|
|
||||||
private BigDecimal vehicle_long;
|
/** 修改人 */
|
||||||
|
private Long update_optid;
|
||||||
|
|
||||||
private BigDecimal vehicle_height;
|
/** 修改人 */
|
||||||
|
private String update_optname;
|
||||||
|
|
||||||
private String overstruct_type;
|
/** 修改时间 */
|
||||||
|
private String update_time;
|
||||||
private BigDecimal occupystruct_qty;
|
|
||||||
|
|
||||||
private String ext_id;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,218 +0,0 @@
|
|||||||
|
|
||||||
package org.nl.wms.basedata.service.impl;
|
|
||||||
|
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
|
||||||
import cn.hutool.core.map.MapUtil;
|
|
||||||
import cn.hutool.core.util.IdUtil;
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
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.system.service.impl.GenCodeServiceImpl;
|
|
||||||
import org.nl.modules.system.util.CodeUtil;
|
|
||||||
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.basedata.service.StoragevehicleinfoService;
|
|
||||||
import org.nl.wms.basedata.service.dto.VehicleDto;
|
|
||||||
import org.springframework.data.domain.Pageable;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author ldjun
|
|
||||||
* @description 服务实现
|
|
||||||
* @date 2021-12-09
|
|
||||||
**/
|
|
||||||
@Service
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
@Slf4j
|
|
||||||
public class StoragevehicleinfoServiceImpl implements StoragevehicleinfoService {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
|
||||||
WQLObject taskTab = WQLObject.getWQLObject("sch_base_task");
|
|
||||||
|
|
||||||
String ehicle_code_begin = (String) whereJson.get("ehicle_code_begin");
|
|
||||||
String ehicle_code_end = (String) whereJson.get("ehicle_code_end");
|
|
||||||
String storagevehicle_type = (String) whereJson.get("storagevehicle_type");
|
|
||||||
|
|
||||||
HashMap<String, Object> map = new HashMap();
|
|
||||||
map.put("ehicle_code_begin", ehicle_code_begin);
|
|
||||||
map.put("ehicle_code_end", ehicle_code_end);
|
|
||||||
map.put("storagevehicle_type", storagevehicle_type);
|
|
||||||
map.put("flag", "1");
|
|
||||||
JSONObject json = WQL.getWO("QMD_PB_STORAGEVEHICLEINFO").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "s.ehicle_code ASC");
|
|
||||||
JSONArray content = json.getJSONArray("content");
|
|
||||||
for (int i = 0; i < content.size(); i++) {
|
|
||||||
JSONObject jsonObject = content.getJSONObject(i);
|
|
||||||
JSONObject jsonTask = taskTab.query("vehicle_code = '" + jsonObject.getString("ehicle_code") + "' and task_status <> '99' and is_delete = '0'").uniqueResult(0);
|
|
||||||
}
|
|
||||||
return json;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<VehicleDto> queryAll(Map whereJson) {
|
|
||||||
WQLObject wo = WQLObject.getWQLObject("md_pb_storagevehicleinfo");
|
|
||||||
JSONArray arr = wo.query().getResultJSONArray(0);
|
|
||||||
List<VehicleDto> list = arr.toJavaList(VehicleDto.class);
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public VehicleDto findById(Long storagevehicle_id) {
|
|
||||||
WQLObject wo = WQLObject.getWQLObject("md_pb_storagevehicleinfo");
|
|
||||||
JSONObject json = wo.query("storagevehicle_id =" + storagevehicle_id + "").uniqueResult(0);
|
|
||||||
final VehicleDto obj = json.toJavaObject(VehicleDto.class);
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public VehicleDto findByCode(String code) {
|
|
||||||
WQLObject wo = WQLObject.getWQLObject("md_pb_storagevehicleinfo");
|
|
||||||
JSONObject json = wo.query("ehicle_code ='" + code + "'").uniqueResult(0);
|
|
||||||
if (ObjectUtil.isEmpty(json)){
|
|
||||||
throw new BadRequestException("请输入正确的载具号!");
|
|
||||||
}
|
|
||||||
final VehicleDto obj = json.toJavaObject(VehicleDto.class);
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public JSONArray create(Map map) {
|
|
||||||
WQLObject wo = WQLObject.getWQLObject("md_pb_storagevehicleinfo");
|
|
||||||
JSONObject jsonObject = wo.query("ehicle_code = '" + map.get("ehicle_code") + "' and is_delete = '0'").uniqueResult(0);
|
|
||||||
if (!ObjectUtil.isEmpty(jsonObject)) {
|
|
||||||
throw new BadRequestException("此载具已存在");
|
|
||||||
}
|
|
||||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
|
||||||
String nickName = SecurityUtils.getCurrentNickName();
|
|
||||||
String now = DateUtil.now();
|
|
||||||
|
|
||||||
String storagevehicle_type = (String) map.get("storagevehicle_type");
|
|
||||||
String code = "";
|
|
||||||
switch (storagevehicle_type) {
|
|
||||||
case "00":
|
|
||||||
code = "VEHICCLE_CODE_MTP";
|
|
||||||
break;
|
|
||||||
case "01":
|
|
||||||
code = "VEHICCLE_CODE_TTP";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
JSONArray resultCodeArr = new JSONArray();
|
|
||||||
int num = MapUtil.getInt(map, "num");
|
|
||||||
for (int i = 0; i < num; i++) {
|
|
||||||
VehicleDto dto = new VehicleDto();
|
|
||||||
dto.setStoragevehicle_id(IdUtil.getSnowflake(1, 1).nextId());
|
|
||||||
dto.setVehicle_code(CodeUtil.getNewCode(code));
|
|
||||||
dto.setCreate_id(currentUserId);
|
|
||||||
dto.setVehicle_name(dto.getVehicle_code());
|
|
||||||
dto.setCreate_name(nickName);
|
|
||||||
dto.setUpdate_optid(currentUserId);
|
|
||||||
dto.setUpdate_optname(nickName);
|
|
||||||
dto.setUpdate_time(now);
|
|
||||||
dto.setCreate_time(now);
|
|
||||||
dto.setStoragevehicle_type((String) map.get("storagevehicle_type"));
|
|
||||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
|
||||||
wo.insert(json);
|
|
||||||
resultCodeArr.add(dto.getVehicle_code());
|
|
||||||
}
|
|
||||||
return resultCodeArr;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public void update(VehicleDto dto) {
|
|
||||||
WQLObject wo = WQLObject.getWQLObject("md_pb_storagevehicleinfo");
|
|
||||||
JSONObject jsonObject = wo.query("ehicle_code = '" + dto.getVehicle_code() + "' and is_delete = '0'").uniqueResult(0);
|
|
||||||
if (!ObjectUtil.isEmpty(jsonObject)) {
|
|
||||||
throw new BadRequestException("此载具已存在");
|
|
||||||
}
|
|
||||||
VehicleDto entity = this.findById(dto.getStoragevehicle_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);
|
|
||||||
|
|
||||||
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("md_pb_storagevehicleinfo");
|
|
||||||
for (Long storagevehicle_id : ids) {
|
|
||||||
JSONObject param = new JSONObject();
|
|
||||||
param.put("storagevehicle_id", String.valueOf(storagevehicle_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
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public void changeActive(JSONObject json) {
|
|
||||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
|
||||||
String nickName = SecurityUtils.getCurrentNickName();
|
|
||||||
String now = DateUtil.now();
|
|
||||||
|
|
||||||
String is_used = "1";
|
|
||||||
if (StrUtil.equals("1", json.getString("is_used"))) {
|
|
||||||
is_used = "0";
|
|
||||||
}
|
|
||||||
json.put("is_used", is_used);
|
|
||||||
json.put("update_optid", currentUserId);
|
|
||||||
json.put("update_optname", nickName);
|
|
||||||
json.put("update_time", now);
|
|
||||||
WQLObject.getWQLObject("md_pb_storagevehicleinfo").update(json);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public JSONObject getVehicle(String code) {
|
|
||||||
String term = "";
|
|
||||||
switch (code) {
|
|
||||||
case "00":
|
|
||||||
term = "VEHICCLE_CODE_MTP";
|
|
||||||
break;
|
|
||||||
case "01":
|
|
||||||
term = "VEHICCLE_CODE_TTP";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
HashMap<String, String> map = new HashMap<>();
|
|
||||||
map.put("code", term);
|
|
||||||
map.put("flag", "0");
|
|
||||||
GenCodeServiceImpl genCodeService = new GenCodeServiceImpl();
|
|
||||||
String value = genCodeService.codeDemo(map);
|
|
||||||
|
|
||||||
JSONObject json = new JSONObject();
|
|
||||||
json.put("value", value);
|
|
||||||
return json;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,133 @@
|
|||||||
|
|
||||||
|
package org.nl.wms.basedata.service.impl;
|
||||||
|
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.nl.modules.common.exception.BadRequestException;
|
||||||
|
import org.nl.wms.basedata.service.VehicleService;
|
||||||
|
import org.nl.wms.basedata.service.dto.VehicleDto;
|
||||||
|
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.ResultBean;
|
||||||
|
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-18
|
||||||
|
**/
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Slf4j
|
||||||
|
public class VehicleServiceImpl implements VehicleService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String,Object> queryAll(Map whereJson, Pageable page){
|
||||||
|
WQLObject wo = WQLObject.getWQLObject("md_pb_vehicle");
|
||||||
|
ResultBean rb = wo.pagequery(WqlUtil.getHttpContext(page), "1=1", "update_time desc");
|
||||||
|
final JSONObject json = rb.pageResult();
|
||||||
|
return json;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<VehicleDto> queryAll(Map whereJson){
|
||||||
|
WQLObject wo = WQLObject.getWQLObject("md_pb_vehicle");
|
||||||
|
JSONArray arr = wo.query().getResultJSONArray(0);
|
||||||
|
if (ObjectUtil.isNotEmpty(arr)) return arr.toJavaList(VehicleDto.class);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VehicleDto findById(Long vehicle_id) {
|
||||||
|
WQLObject wo = WQLObject.getWQLObject("md_pb_vehicle");
|
||||||
|
JSONObject json = wo.query("vehicle_id = '" + vehicle_id + "'").uniqueResult(0);
|
||||||
|
if (ObjectUtil.isNotEmpty(json)){
|
||||||
|
return json.toJavaObject( VehicleDto.class);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VehicleDto findByCode(String code) {
|
||||||
|
WQLObject wo = WQLObject.getWQLObject("md_pb_vehicle");
|
||||||
|
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
|
||||||
|
if (ObjectUtil.isNotEmpty(json)){
|
||||||
|
return json.toJavaObject( VehicleDto.class);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void create(VehicleDto dto) {
|
||||||
|
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||||
|
String nickName = SecurityUtils.getCurrentNickName();
|
||||||
|
String now = DateUtil.now();
|
||||||
|
|
||||||
|
dto.setVehicle_id(IdUtil.getSnowflake(1, 1).nextId());
|
||||||
|
dto.setVehicle_name(dto.getVehicle_name());
|
||||||
|
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("md_pb_vehicle");
|
||||||
|
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||||
|
wo.insert(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void update(VehicleDto dto) {
|
||||||
|
VehicleDto entity = this.findById(dto.getVehicle_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("md_pb_vehicle");
|
||||||
|
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("md_pb_vehicle");
|
||||||
|
for (Long vehicle_id: ids) {
|
||||||
|
JSONObject param = new JSONObject();
|
||||||
|
param.put("vehicle_id", String.valueOf(vehicle_id));
|
||||||
|
param.put("is_delete", "1");
|
||||||
|
param.put("update_optid", currentUserId);
|
||||||
|
param.put("update_optname", nickName);
|
||||||
|
param.put("update_time", now);
|
||||||
|
wo.update(param);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -10,7 +10,7 @@ import org.nl.modules.common.utils.SecurityUtils;
|
|||||||
import org.nl.modules.wql.core.bean.WQLObject;
|
import org.nl.modules.wql.core.bean.WQLObject;
|
||||||
|
|
||||||
import org.nl.modules.wql.util.SpringContextHolder;
|
import org.nl.modules.wql.util.SpringContextHolder;
|
||||||
import org.nl.wms.basedata.service.StoragevehicleinfoService;
|
import org.nl.wms.basedata.service.VehicleService;
|
||||||
import org.nl.wms.basedata.service.dto.VehicleDto;
|
import org.nl.wms.basedata.service.dto.VehicleDto;
|
||||||
import org.nl.wms.pda.emptyandqty.service.EmptyAndQtyService;
|
import org.nl.wms.pda.emptyandqty.service.EmptyAndQtyService;
|
||||||
|
|
||||||
@@ -29,12 +29,12 @@ public class EmptyAndQtyServiceImpl implements EmptyAndQtyService {
|
|||||||
String qty = whereJson.getString("qty");
|
String qty = whereJson.getString("qty");
|
||||||
|
|
||||||
WQLObject vqTab = WQLObject.getWQLObject("PDM_BI_vehicleQty");
|
WQLObject vqTab = WQLObject.getWQLObject("PDM_BI_vehicleQty");
|
||||||
VehicleDto byCode = SpringContextHolder.getBean(StoragevehicleinfoService.class).findByCode(vehicle_code);
|
VehicleDto byCode = SpringContextHolder.getBean(VehicleService.class).findByCode(vehicle_code);
|
||||||
|
|
||||||
// 插入记录
|
// 插入记录
|
||||||
JSONObject json = new JSONObject();
|
JSONObject json = new JSONObject();
|
||||||
json.put("vehicleqty_id", IdUtil.getSnowflake(1, 1).nextId());
|
json.put("vehicleqty_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||||
json.put("vehicle_id", byCode.getStoragevehicle_id());
|
json.put("vehicle_id", byCode.getVehicle_id());
|
||||||
json.put("vehicle_code", vehicle_code);
|
json.put("vehicle_code", vehicle_code);
|
||||||
json.put("qty", qty);
|
json.put("qty", qty);
|
||||||
json.put("create_id", SecurityUtils.getCurrentUserId());
|
json.put("create_id", SecurityUtils.getCurrentUserId());
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import org.nl.modules.system.util.CodeUtil;
|
|||||||
import org.nl.modules.wql.WQL;
|
import org.nl.modules.wql.WQL;
|
||||||
import org.nl.modules.wql.core.bean.WQLObject;
|
import org.nl.modules.wql.core.bean.WQLObject;
|
||||||
import org.nl.modules.wql.util.SpringContextHolder;
|
import org.nl.modules.wql.util.SpringContextHolder;
|
||||||
import org.nl.wms.basedata.service.StoragevehicleinfoService;
|
import org.nl.wms.basedata.service.VehicleService;
|
||||||
import org.nl.wms.basedata.service.dto.VehicleDto;
|
import org.nl.wms.basedata.service.dto.VehicleDto;
|
||||||
import org.nl.wms.pdm.service.DeviceService;
|
import org.nl.wms.pdm.service.DeviceService;
|
||||||
import org.nl.wms.pdm.service.dto.DeviceDto;
|
import org.nl.wms.pdm.service.dto.DeviceDto;
|
||||||
@@ -239,9 +239,9 @@ public class SendEmpVehicleTask extends AbstractAcsTask {
|
|||||||
// 如果说明是货梯业务:则判断载具号是否为空
|
// 如果说明是货梯业务:则判断载具号是否为空
|
||||||
if (ObjectUtil.isEmpty(vehicle_code)) throw new BadRequestException("起点点位错误");
|
if (ObjectUtil.isEmpty(vehicle_code)) throw new BadRequestException("起点点位错误");
|
||||||
// 根据载具号找对应的载具类型
|
// 根据载具号找对应的载具类型
|
||||||
VehicleDto vehicleDto = SpringContextHolder.getBean(StoragevehicleinfoService.class).findByCode(vehicle_code);
|
VehicleDto vehicleDto = SpringContextHolder.getBean(VehicleService.class).findByCode(vehicle_code);
|
||||||
if (ObjectUtil.isEmpty(vehicleDto)) throw new BadRequestException("载具不存在");
|
if (ObjectUtil.isEmpty(vehicleDto)) throw new BadRequestException("载具不存在");
|
||||||
vehicle_type = vehicleDto.getStoragevehicle_type();
|
vehicle_type = vehicleDto.getVehicle_type();
|
||||||
} else {
|
} else {
|
||||||
// 不为空说明不是货梯业务:则根据工单找到对应类型
|
// 不为空说明不是货梯业务:则根据工单找到对应类型
|
||||||
JSONObject jsonOrder = orderTab.query("device_id = '" + deviceDto.getDevice_id() + "' and order_status = '02' and is_delete = '0'").uniqueResult(0);
|
JSONObject jsonOrder = orderTab.query("device_id = '" + deviceDto.getDevice_id() + "' and order_status = '02' and is_delete = '0'").uniqueResult(0);
|
||||||
|
|||||||
@@ -1,42 +0,0 @@
|
|||||||
import request from '@/utils/request'
|
|
||||||
|
|
||||||
export function add(data) {
|
|
||||||
return request({
|
|
||||||
url: 'api/storagevehicleinfo',
|
|
||||||
method: 'post',
|
|
||||||
data
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
export function del(ids) {
|
|
||||||
return request({
|
|
||||||
url: 'api/storagevehicleinfo/',
|
|
||||||
method: 'delete',
|
|
||||||
data: ids
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
export function edit(data) {
|
|
||||||
return request({
|
|
||||||
url: 'api/storagevehicleinfo',
|
|
||||||
method: 'put',
|
|
||||||
data
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
export function changeActive(data) {
|
|
||||||
return request({
|
|
||||||
url: 'api/storagevehicleinfo/changeActive',
|
|
||||||
method: 'put',
|
|
||||||
data
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getVehicle(code) {
|
|
||||||
return request({
|
|
||||||
url: 'api/storagevehicleinfo/getVehicle/' + code,
|
|
||||||
method: 'get'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
export default { add, edit, del, changeActive, getVehicle }
|
|
||||||
@@ -2,89 +2,22 @@
|
|||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<!--工具栏-->
|
<!--工具栏-->
|
||||||
<div class="head-container">
|
<div class="head-container">
|
||||||
<div v-if="crud.props.searchToggle">
|
|
||||||
<!-- 搜索 -->
|
|
||||||
<el-form
|
|
||||||
:inline="true"
|
|
||||||
class="demo-form-inline"
|
|
||||||
label-position="right"
|
|
||||||
label-width="80px"
|
|
||||||
label-suffix=":"
|
|
||||||
>
|
|
||||||
<el-form-item label="载具类型">
|
|
||||||
<el-select
|
|
||||||
v-model="query.vehicle_type"
|
|
||||||
clearable
|
|
||||||
size="mini"
|
|
||||||
placeholder="请选择"
|
|
||||||
class="filter-item"
|
|
||||||
style="width: 180px;"
|
|
||||||
@change="hand"
|
|
||||||
>
|
|
||||||
<el-option
|
|
||||||
v-for="item in dict.vehicle_type"
|
|
||||||
:label="item.label"
|
|
||||||
:value="item.value"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item label="载具号">
|
|
||||||
<el-input
|
|
||||||
v-model="query.vehicle_code_begin"
|
|
||||||
clearable
|
|
||||||
size="mini"
|
|
||||||
placeholder="起始载具号"
|
|
||||||
style="width: 110px;"
|
|
||||||
class="filter-item"
|
|
||||||
@keyup.enter.native="crud.toQuery"
|
|
||||||
/>
|
|
||||||
-
|
|
||||||
<el-input
|
|
||||||
v-model="query.vehicle_code_end"
|
|
||||||
clearable
|
|
||||||
size="mini"
|
|
||||||
placeholder="结束载具号"
|
|
||||||
style="width: 110px;"
|
|
||||||
class="filter-item"
|
|
||||||
@keyup.enter.native="crud.toQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<rrOperation />
|
|
||||||
</el-form>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||||
<crudOperation :permission="permission">
|
<crudOperation :permission="permission" />
|
||||||
<el-button
|
|
||||||
slot="right"
|
|
||||||
class="filter-item"
|
|
||||||
type="success"
|
|
||||||
icon="el-icon-printer"
|
|
||||||
size="mini"
|
|
||||||
@click="print"
|
|
||||||
>
|
|
||||||
打印
|
|
||||||
</el-button>
|
|
||||||
</crudOperation>
|
|
||||||
<!--表单组件-->
|
<!--表单组件-->
|
||||||
<el-dialog
|
<el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px">
|
||||||
:before-close="crud.cancelCU"
|
<el-form ref="form" :model="form" :rules="rules" size="mini" label-width="80px">
|
||||||
:close-on-click-modal="false"
|
<el-form-item label="载具编码" prop="vehicle_code">
|
||||||
:title="crud.status.title"
|
<el-input v-model="form.vehicle_code" style="width: 370px;" />
|
||||||
:visible.sync="crud.status.cu > 0"
|
</el-form-item>
|
||||||
width="450px"
|
<el-form-item label="载具类型">
|
||||||
>
|
|
||||||
<el-form ref="form" :model="form" :rules="rules" size="mini" label-width="100px">
|
|
||||||
<el-form-item label="载具类型" prop="vehicle_type">
|
|
||||||
<el-select
|
<el-select
|
||||||
v-model="form.vehicle_type"
|
v-model="form.vehicle_type"
|
||||||
clearable
|
clearable
|
||||||
|
filterable
|
||||||
size="mini"
|
size="mini"
|
||||||
placeholder="请选择"
|
|
||||||
class="filter-item"
|
class="filter-item"
|
||||||
style="width: 250px;"
|
style="width: 370px;"
|
||||||
@change="getVehicle"
|
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in dict.vehicle_type"
|
v-for="item in dict.vehicle_type"
|
||||||
@@ -93,61 +26,28 @@
|
|||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<br>
|
|
||||||
<el-form-item label="起始载具号" prop="vehicle_code">
|
|
||||||
<el-input v-model="form.vehicle_code" :disabled="true" style="width: 250px;" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="载具数量" prop="num">
|
|
||||||
<el-input-number v-model="form.num" :precision="0" style="width: 150px;" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="是否启用">
|
|
||||||
<el-radio v-model="form.is_used" label="0">否</el-radio>
|
|
||||||
<el-radio v-model="form.is_used" label="1">是</el-radio>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
</el-form>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
<el-button type="info" @click="crud.cancelCU">取消</el-button>
|
<el-button type="text" @click="crud.cancelCU">取消</el-button>
|
||||||
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">生成</el-button>
|
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
|
||||||
<el-button type="primary" @click="addAndprint">生成并打印</el-button>
|
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
<!--表格渲染-->
|
<!--表格渲染-->
|
||||||
<el-table
|
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="mini" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
|
||||||
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 type="selection" width="55" />
|
||||||
<el-table-column v-if="false" prop="storagevehicle_id" label="载具标识" />
|
|
||||||
<el-table-column prop="vehicle_type_name" label="载具类型" />
|
|
||||||
<el-table-column prop="vehicle_code" label="载具编码" />
|
<el-table-column prop="vehicle_code" label="载具编码" />
|
||||||
<el-table-column label="是否启用" align="center" prop="is_used">
|
<el-table-column prop="vehicle_type" label="载具类型" >
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-switch
|
{{ dict.label.vehicle_type[scope.row.vehicle_type] }}
|
||||||
:value="format_is_used(scope.row.is_used)"
|
|
||||||
active-color="#409EFF"
|
|
||||||
inactive-color="#F56C6C"
|
|
||||||
@change="changeEnabled(scope.row, scope.row.is_used)"
|
|
||||||
/>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="create_name" label="创建人" />
|
<el-table-column prop="update_optname" label="修改人" />
|
||||||
<el-table-column prop="create_time" label="创建时间" width="150px" />
|
<el-table-column prop="update_time" label="修改时间" />
|
||||||
<el-table-column
|
<el-table-column v-permission="[]" label="操作" width="120px" align="center" fixed="right">
|
||||||
v-permission="['admin','vehicle:edit','vehicle:del']"
|
|
||||||
label="操作"
|
|
||||||
width="100px"
|
|
||||||
align="center"
|
|
||||||
fixed="right"
|
|
||||||
>
|
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<udOperation
|
<udOperation
|
||||||
:data="scope.row"
|
:data="scope.row"
|
||||||
:permission="permission"
|
:permission="permission"
|
||||||
:is-visiable-edit="false"
|
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@@ -159,188 +59,45 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import crudStoragevehicleinfo from '@/api/wms/basedata/vehicle'
|
import crudVehicle from './vehicle'
|
||||||
import CRUD, { crud, form, header, presenter } from '@crud/crud'
|
import CRUD, { crud, form, header, presenter } from '@crud/crud'
|
||||||
import rrOperation from '@crud/RR.operation'
|
import rrOperation from '@crud/RR.operation'
|
||||||
import crudOperation from '@crud/CRUD.operation'
|
import crudOperation from '@crud/CRUD.operation'
|
||||||
import udOperation from '@crud/UD.operation'
|
import udOperation from '@crud/UD.operation'
|
||||||
import pagination from '@crud/Pagination'
|
import pagination from '@crud/Pagination'
|
||||||
import { getLodop } from '@/assets/js/lodop/LodopFuncs'
|
|
||||||
|
|
||||||
const defaultForm = {
|
const defaultForm = { vehicle_id: null, vehicle_code: null, vehicle_name: null, one_code: null, two_code: null, rfid_code: null, vehicle_type: null, vehicle_width: null, vehicle_long: null, vehicle_height: null, overstruct_type: null, occupystruct_qty: null, ext_id: null, create_id: null, create_name: null, create_time: null, update_optid: null, update_optname: null, update_time: null }
|
||||||
storagevehicle_id: null,
|
|
||||||
vehicle_code: null,
|
|
||||||
one_code: null,
|
|
||||||
two_code: null,
|
|
||||||
rfid_code: null,
|
|
||||||
create_id: null,
|
|
||||||
create_name: null,
|
|
||||||
create_time: null,
|
|
||||||
update_optid: null,
|
|
||||||
update_optname: null,
|
|
||||||
update_time: null,
|
|
||||||
is_delete: null,
|
|
||||||
is_used: '1',
|
|
||||||
vehicle_type: null,
|
|
||||||
vehicle_width: null,
|
|
||||||
vehicle_long: null,
|
|
||||||
vehicle_height: null,
|
|
||||||
overstruct_type: null,
|
|
||||||
occupystruct_qty: null,
|
|
||||||
ext_id: null,
|
|
||||||
num: '1'
|
|
||||||
}
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Storagevehicleinfo',
|
name: 'Vehicle',
|
||||||
dicts: ['vehicle_type'],
|
dicts:['vehicle_type'],
|
||||||
components: { pagination, crudOperation, rrOperation, udOperation },
|
components: { pagination, crudOperation, rrOperation, udOperation },
|
||||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||||
cruds() {
|
cruds() {
|
||||||
return CRUD({
|
return CRUD({ title: '载具维护', url: 'api/vehicle', idField: 'vehicle_id', sort: 'vehicle_id,desc', crudMethod: { ...crudVehicle }})
|
||||||
title: '载具',
|
|
||||||
url: 'api/storagevehicleinfo',
|
|
||||||
idField: 'storagevehicle_id',
|
|
||||||
sort: 'storagevehicle_id,desc',
|
|
||||||
crudMethod: { ...crudStoragevehicleinfo },
|
|
||||||
optShow: {
|
|
||||||
add: true,
|
|
||||||
edit: false,
|
|
||||||
del: false,
|
|
||||||
download: false,
|
|
||||||
reset: true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
var numberOne = (rule, value, callback) => {
|
|
||||||
const numReg = /^[+]{0,1}(\d+)$|^[+]{0,1}(\d+\.\d+)$/
|
|
||||||
const numRe = new RegExp(numReg)
|
|
||||||
if (!numRe.test(value)) {
|
|
||||||
callback(new Error('只能输入数字'))
|
|
||||||
} else {
|
|
||||||
callback()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return {
|
return {
|
||||||
resultCodeArr: [],
|
permission: {
|
||||||
permission: {},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
vehicle_code: [
|
vehicle_code: [
|
||||||
{ required: true, message: '不能为空', trigger: 'blur' }
|
{ required: true, message: '载具编码不能为空', trigger: 'blur' }
|
||||||
],
|
|
||||||
create_id: [
|
|
||||||
{ required: true, message: '不能为空', trigger: 'blur' }
|
|
||||||
],
|
|
||||||
create_name: [
|
|
||||||
{ required: true, message: '不能为空', trigger: 'blur' }
|
|
||||||
],
|
|
||||||
create_time: [
|
|
||||||
{ required: true, message: '不能为空', trigger: 'blur' }
|
|
||||||
],
|
|
||||||
is_delete: [
|
|
||||||
{ required: true, message: '不能为空', trigger: 'blur' }
|
|
||||||
],
|
|
||||||
is_used: [
|
|
||||||
{ required: true, message: '不能为空', trigger: 'blur' }
|
|
||||||
],
|
],
|
||||||
vehicle_type: [
|
vehicle_type: [
|
||||||
{ required: true, message: '不能为空', trigger: 'blur' }
|
{ required: true, message: '载具类型不能为空', trigger: 'blur' }
|
||||||
],
|
],
|
||||||
overstruct_type: [
|
overstruct_type: [
|
||||||
{ required: true, message: '不能为空', trigger: 'blur' }
|
{ required: true, message: '载具超仓位类型不能为空', trigger: 'blur' }
|
||||||
],
|
],
|
||||||
num: [
|
occupystruct_qty: [
|
||||||
{ required: true, message: '不能为空', trigger: 'blur' },
|
{ required: true, message: '占仓位数不能为空', trigger: 'blur' }
|
||||||
{ validator: numberOne }
|
|
||||||
]
|
]
|
||||||
}
|
}}
|
||||||
}
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
||||||
[CRUD.HOOK.beforeRefresh]() {
|
[CRUD.HOOK.beforeRefresh]() {
|
||||||
return true
|
return true
|
||||||
},
|
|
||||||
hand(value) {
|
|
||||||
this.crud.toQuery()
|
|
||||||
},
|
|
||||||
changeEnabled(data, val) {
|
|
||||||
let msg = '此操作将停用载具,是否继续!'
|
|
||||||
if (val !== '1') {
|
|
||||||
msg = '此操作将启用载具,是否继续!'
|
|
||||||
}
|
|
||||||
this.$confirm(msg, '提示', {
|
|
||||||
confirmButtonText: '确定',
|
|
||||||
cancelButtonText: '取消',
|
|
||||||
type: 'warning'
|
|
||||||
}).then(() => {
|
|
||||||
crudStoragevehicleinfo.changeActive(data).then(res => {
|
|
||||||
this.crud.toQuery()
|
|
||||||
this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
|
||||||
}).catch(() => {
|
|
||||||
data.is_used = !data.is_used
|
|
||||||
})
|
|
||||||
}).catch(() => {
|
|
||||||
})
|
|
||||||
},
|
|
||||||
format_is_used(is_used) {
|
|
||||||
return is_used === '1'
|
|
||||||
},
|
|
||||||
print() {
|
|
||||||
const _selectData = this.$refs.table.selection
|
|
||||||
if (!_selectData || _selectData.length < 1) {
|
|
||||||
this.crud.notify('请选择一条记录', CRUD.NOTIFICATION_TYPE.INFO)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
for (let i = 0; i < _selectData.length; i++) {
|
|
||||||
const code = _selectData[i].vehicle_code
|
|
||||||
const LODOP = getLodop()
|
|
||||||
LODOP.SET_SHOW_MODE('HIDE_DISBUTTIN_SETUP', 1)// 隐藏那些无效按钮
|
|
||||||
// 打印纸张大小设置https://www.it610.com/article/2094844.html
|
|
||||||
LODOP.SET_PRINT_PAGESIZE(1, '50mm', '30mm', '')
|
|
||||||
// LODOP.ADD_PRINT_RECT('0mm', '0mm', '48mm', '28mm', 0, 1)
|
|
||||||
LODOP.ADD_PRINT_BARCODE('4.3mm', '8.2mm', '40mm', '20mm', '128Auto', code)
|
|
||||||
// LODOP.PREVIEW()// 预览
|
|
||||||
LODOP.PRINT()// 打印
|
|
||||||
this.crud.notify('打印成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
|
||||||
this.crud.toQuery()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
addAndprint() {
|
|
||||||
const data = this.form
|
|
||||||
if (!this.form.vehicle_type) {
|
|
||||||
this.crud.notify('载具类型不能为空', CRUD.NOTIFICATION_TYPE.INFO)
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
if (!this.form.num) {
|
|
||||||
this.crud.notify('数量不能为空', CRUD.NOTIFICATION_TYPE.INFO)
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
crudStoragevehicleinfo.add(data).then(res => {
|
|
||||||
res.forEach((item) => {
|
|
||||||
const LODOP = getLodop()
|
|
||||||
LODOP.SET_SHOW_MODE('HIDE_DISBUTTIN_SETUP', 1)// 隐藏那些无效按钮
|
|
||||||
// 打印纸张大小设置https://www.it610.com/article/2094844.html
|
|
||||||
LODOP.SET_PRINT_PAGESIZE(1, '50mm', '30mm', '1')
|
|
||||||
// LODOP.ADD_PRINT_RECT('0mm', '0mm', '50mm', '30mm', 0, 1)
|
|
||||||
LODOP.ADD_PRINT_BARCODE('4.3mm', '6.2mm', '40mm', '20mm', '128Auto', item)
|
|
||||||
// LODOP.PREVIEW()// 预览
|
|
||||||
LODOP.PRINT()// 打印
|
|
||||||
})
|
|
||||||
this.crud.status.add = CRUD.STATUS.NORMAL
|
|
||||||
this.crud.toQuery()
|
|
||||||
this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
|
||||||
})
|
|
||||||
},
|
|
||||||
getVehicle(code) {
|
|
||||||
if (!code) {
|
|
||||||
this.crud.notify('请选择载具类型', CRUD.NOTIFICATION_TYPE.INFO)
|
|
||||||
this.form.vehicle_code = ''
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
crudStoragevehicleinfo.getVehicle(code).then(res => {
|
|
||||||
this.form.vehicle_code = res.value
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
27
lms/nladmin-ui/src/views/wms/basedata/vehicle/vehicle.js
Normal file
27
lms/nladmin-ui/src/views/wms/basedata/vehicle/vehicle.js
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
export function add(data) {
|
||||||
|
return request({
|
||||||
|
url: 'api/vehicle',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function del(ids) {
|
||||||
|
return request({
|
||||||
|
url: 'api/vehicle/',
|
||||||
|
method: 'delete',
|
||||||
|
data: ids
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function edit(data) {
|
||||||
|
return request({
|
||||||
|
url: 'api/vehicle',
|
||||||
|
method: 'put',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export default { add, edit, del }
|
||||||
Reference in New Issue
Block a user