add:仓库、库区
This commit is contained in:
@@ -4,15 +4,14 @@ package org.nl.wms.storage_manage.database.controller;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.storage_manage.database.dao.StIvtBsrealstorattr;
|
||||
import org.nl.wms.storage_manage.database.dto.StorQuery;
|
||||
import org.nl.wms.storage_manage.database.service.IStIvtBsrealstorattrService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -46,4 +45,32 @@ public class StIvtBsrealstorattrController {
|
||||
return new ResponseEntity<>(iStIvtBsrealstorattrService.getStor(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增仓库")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody StIvtBsrealstorattr whereJson) {
|
||||
iStIvtBsrealstorattrService.create(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改仓库")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody StIvtBsrealstorattr dao) {
|
||||
iStIvtBsrealstorattrService.update(dao);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Log("删除仓库")
|
||||
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
||||
iStIvtBsrealstorattrService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PutMapping("/changeActive")
|
||||
@Log("修改仓库管理状态")
|
||||
public ResponseEntity<Object> changeActive(@Validated @RequestBody StIvtBsrealstorattr dao) {
|
||||
iStIvtBsrealstorattrService.changeActive(dao);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,17 @@
|
||||
package org.nl.wms.storage_manage.database.controller;
|
||||
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.storage_manage.database.dao.StIvtBsrealstorattr;
|
||||
import org.nl.wms.storage_manage.database.dao.StIvtSectattr;
|
||||
import org.nl.wms.storage_manage.database.dto.SectQuery;
|
||||
import org.nl.wms.storage_manage.database.service.IStIvtSectattrService;
|
||||
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.*;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -16,4 +25,44 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@RequestMapping("/api/stIvtSectattr")
|
||||
public class StIvtSectattrController {
|
||||
|
||||
/**
|
||||
* 库区服务
|
||||
*/
|
||||
@Autowired
|
||||
private IStIvtSectattrService iStIvtSectattrService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询库区")
|
||||
public ResponseEntity<Object> query(SectQuery query, PageQuery page){
|
||||
return new ResponseEntity<>(iStIvtSectattrService.pageQuery(query,page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增库区")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody StIvtSectattr dao) {
|
||||
iStIvtSectattrService.create(dao);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改库区")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody StIvtSectattr dao) {
|
||||
iStIvtSectattrService.update(dao);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Log("删除库区")
|
||||
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
||||
iStIvtSectattrService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PutMapping("/changeActive")
|
||||
@Log("修改库区管理状态")
|
||||
public ResponseEntity<Object> changeActive(@Validated @RequestBody StIvtSectattr dao) {
|
||||
iStIvtSectattrService.changeActive(dao);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package org.nl.wms.storage_manage.database.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nl.common.domain.query.BaseQuery;
|
||||
import org.nl.common.domain.query.QParam;
|
||||
import org.nl.common.enums.QueryTEnum;
|
||||
import org.nl.wms.storage_manage.database.dao.StIvtBsrealstorattr;
|
||||
|
||||
/**
|
||||
* 仓库查询条件
|
||||
* @author LXY
|
||||
* @Date 2023/11/10 14:49
|
||||
*/
|
||||
@Data
|
||||
public class SectQuery extends BaseQuery<StIvtBsrealstorattr> {
|
||||
|
||||
/**
|
||||
* 仓库编码
|
||||
*/
|
||||
private String stor_code;
|
||||
|
||||
/**
|
||||
* 仓库id
|
||||
*/
|
||||
private String stor_id;
|
||||
|
||||
/**
|
||||
* 库区编码
|
||||
*/
|
||||
private String sect_code;
|
||||
|
||||
@Override
|
||||
public void paramMapping() {
|
||||
super.doP.put("stor_code", QParam.builder().k(new String[]{"stor_code"}).type(QueryTEnum.LK).build());
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,13 @@
|
||||
package org.nl.wms.storage_manage.database.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.storage_manage.database.dao.StIvtSectattr;
|
||||
import org.nl.wms.storage_manage.database.dto.SectQuery;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -13,4 +19,11 @@ import org.nl.wms.storage_manage.database.dao.StIvtSectattr;
|
||||
*/
|
||||
public interface StIvtSectattrMapper extends BaseMapper<StIvtSectattr> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param query:查询条件
|
||||
* @param pageQuery 分页
|
||||
* @return List<Map>
|
||||
*/
|
||||
List<Map> getPageQuery( @Param("query") SectQuery query, @Param("pageQuery") PageQuery pageQuery);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,8 @@
|
||||
is_delete = '0'
|
||||
|
||||
<if test="query.stor_code != null and query.stor_code != ''">
|
||||
and stor_code LIKE '%${query.stor_code}%'
|
||||
and (stor_code LIKE '%${query.stor_code}%'
|
||||
or stor_name LIKE '%${query.stor_code}%')
|
||||
</if>
|
||||
|
||||
</where>
|
||||
|
||||
@@ -2,4 +2,27 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.nl.wms.storage_manage.database.mapper.StIvtSectattrMapper">
|
||||
|
||||
<select id="getPageQuery" resultType="java.util.Map">
|
||||
SELECT
|
||||
sect.*,
|
||||
attr.stor_name
|
||||
FROM
|
||||
st_ivt_sectattr sect
|
||||
LEFT JOIN st_ivt_bsrealstorattr attr ON sect.stor_id = attr.stor_id
|
||||
<where>
|
||||
sect.is_delete = '0'
|
||||
|
||||
<if test="query.stor_id != null and query.stor_id != ''">
|
||||
and sect.stor_id = #{query.stor_id}
|
||||
</if>
|
||||
|
||||
<if test="query.sect_code != null and query.sect_code != ''">
|
||||
and (sect.sect_code LIKE '%${query.sect_code}%'
|
||||
or sect.sect_name LIKE '%${query.sect_code}%')
|
||||
</if>
|
||||
|
||||
</where>
|
||||
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -40,4 +40,29 @@ public interface IStIvtBsrealstorattrService extends IService<StIvtBsrealstoratt
|
||||
* @return JSONObject
|
||||
*/
|
||||
List<JSONObject> getStor(Map whereJson);
|
||||
|
||||
/**
|
||||
* 新增仓库
|
||||
* @param dao: 仓库实体类
|
||||
*
|
||||
*/
|
||||
void create(StIvtBsrealstorattr dao);
|
||||
|
||||
/**
|
||||
* 修改仓库
|
||||
* @param dao:仓库实体类
|
||||
*/
|
||||
void update(StIvtBsrealstorattr dao);
|
||||
|
||||
/**
|
||||
* 删除仓库
|
||||
* @param ids:标识
|
||||
*/
|
||||
void deleteAll(Long[] ids);
|
||||
|
||||
/**
|
||||
* 修改状态
|
||||
* @param dao: 仓库实体类
|
||||
*/
|
||||
void changeActive(StIvtBsrealstorattr dao);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package org.nl.wms.storage_manage.database.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.storage_manage.database.dao.StIvtSectattr;
|
||||
import org.nl.wms.storage_manage.database.dto.SectQuery;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -13,4 +15,35 @@ import org.nl.wms.storage_manage.database.dao.StIvtSectattr;
|
||||
*/
|
||||
public interface IStIvtSectattrService extends IService<StIvtSectattr> {
|
||||
|
||||
/**
|
||||
* 查询库区
|
||||
* @param query 查询条件
|
||||
* @param page 分页查询
|
||||
* @return Object
|
||||
*/
|
||||
Object pageQuery(SectQuery query, PageQuery page);
|
||||
|
||||
/**
|
||||
* 新增库区
|
||||
* @param dao:库区实体
|
||||
*/
|
||||
void create(StIvtSectattr dao);
|
||||
|
||||
/**
|
||||
* 修改库区
|
||||
* @param dao: 库区实体
|
||||
*/
|
||||
void update(StIvtSectattr dao);
|
||||
|
||||
/**
|
||||
* 删除库区
|
||||
* @param ids
|
||||
*/
|
||||
void deleteAll(Long[] ids);
|
||||
|
||||
/**
|
||||
* 修改状态
|
||||
* @param dao
|
||||
*/
|
||||
void changeActive(StIvtSectattr dao);
|
||||
}
|
||||
|
||||
@@ -1,18 +1,26 @@
|
||||
package org.nl.wms.storage_manage.database.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import org.nl.common.base.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.wms.storage_manage.database.dao.StIvtBsrealstorattr;
|
||||
import org.nl.wms.storage_manage.database.dto.StorQuery;
|
||||
import org.nl.wms.storage_manage.database.mapper.StIvtBsrealstorattrMapper;
|
||||
import org.nl.wms.storage_manage.database.service.IStIvtBsrealstorattrService;
|
||||
import org.nl.wms.storage_manage.ios.enums.IOSEnum;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -28,6 +36,7 @@ import java.util.Map;
|
||||
@Service
|
||||
public class StIvtBsrealstorattrServiceImpl extends ServiceImpl<StIvtBsrealstorattrMapper, StIvtBsrealstorattr> implements IStIvtBsrealstorattrService {
|
||||
|
||||
|
||||
@Override
|
||||
public StIvtBsrealstorattr getById(Long storId) {
|
||||
if (ObjectUtil.isEmpty(this.baseMapper.selectById(storId))) {
|
||||
@@ -52,4 +61,80 @@ public class StIvtBsrealstorattrServiceImpl extends ServiceImpl<StIvtBsrealstora
|
||||
public List<JSONObject> getStor(Map whereJson) {
|
||||
return this.baseMapper.getStor(whereJson);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(StIvtBsrealstorattr dao) {
|
||||
StIvtBsrealstorattr isDao = this.getOne(
|
||||
new QueryWrapper<StIvtBsrealstorattr>().lambda()
|
||||
.eq(StIvtBsrealstorattr::getStor_code, dao.getStor_code())
|
||||
.eq(StIvtBsrealstorattr::getIs_delete, IOSEnum.IS_NOTANDYES.code("否"))
|
||||
);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(isDao)) {
|
||||
throw new BadRequestException("已存在相同编码的仓库【"+dao.getStor_code()+"】");
|
||||
}
|
||||
|
||||
dao.setStor_id(IdUtil.getStringId());
|
||||
dao.setCreate_id(SecurityUtils.getCurrentUserId());
|
||||
dao.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||
dao.setUpdate_optid(SecurityUtils.getCurrentUserId());
|
||||
dao.setUpdate_optname(SecurityUtils.getCurrentNickName());
|
||||
dao.setUpdate_time(DateUtil.now());
|
||||
dao.setCreate_time(DateUtil.now());
|
||||
|
||||
dao.setSyscompanyid(IOSEnum.IS_NOTANDYES.code("否"));
|
||||
dao.setSysdeptid(IOSEnum.IS_NOTANDYES.code("否"));
|
||||
dao.setSysownerid(IOSEnum.IS_NOTANDYES.code("否"));
|
||||
|
||||
this.save(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(StIvtBsrealstorattr dao) {
|
||||
StIvtBsrealstorattr isDao = this.getById(dao.getStor_id());
|
||||
|
||||
if (isDao == null) {
|
||||
throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
}
|
||||
|
||||
dao.setUpdate_time(DateUtil.now());
|
||||
dao.setUpdate_optid(SecurityUtils.getCurrentUserId());
|
||||
dao.setUpdate_optname(SecurityUtils.getCurrentNickName());
|
||||
|
||||
this.updateById(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(Long[] ids) {
|
||||
for (Long storId : ids) {
|
||||
this.update(
|
||||
new UpdateWrapper<StIvtBsrealstorattr>().lambda()
|
||||
.set(StIvtBsrealstorattr::getIs_delete, IOSEnum.IS_NOTANDYES.code("是"))
|
||||
.set(StIvtBsrealstorattr::getUpdate_optid, SecurityUtils.getCurrentUserId())
|
||||
.set(StIvtBsrealstorattr::getUpdate_optname, SecurityUtils.getCurrentNickName())
|
||||
.set(StIvtBsrealstorattr::getUpdate_time, DateUtil.now())
|
||||
.eq(StIvtBsrealstorattr::getStor_id, storId)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void changeActive(StIvtBsrealstorattr dao) {
|
||||
|
||||
String isUsed = IOSEnum.IS_NOTANDYES.code("是");
|
||||
if (StrUtil.equals(IOSEnum.IS_NOTANDYES.code("是"), dao.getIs_used())) {
|
||||
isUsed = IOSEnum.IS_NOTANDYES.code("否");
|
||||
}
|
||||
|
||||
dao.setIs_used(isUsed);
|
||||
dao.setUpdate_time(DateUtil.now());
|
||||
dao.setUpdate_optid(SecurityUtils.getCurrentUserId());
|
||||
dao.setUpdate_optname(SecurityUtils.getCurrentNickName());
|
||||
this.updateById(dao);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,31 @@
|
||||
package org.nl.wms.storage_manage.database.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import org.nl.common.base.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.wms.storage_manage.database.dao.StIvtBsrealstorattr;
|
||||
import org.nl.wms.storage_manage.database.dao.StIvtSectattr;
|
||||
import org.nl.wms.storage_manage.database.dto.SectQuery;
|
||||
import org.nl.wms.storage_manage.database.mapper.StIvtSectattrMapper;
|
||||
import org.nl.wms.storage_manage.database.service.IStIvtBsrealstorattrService;
|
||||
import org.nl.wms.storage_manage.database.service.IStIvtSectattrService;
|
||||
import org.nl.wms.storage_manage.ios.enums.IOSEnum;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -17,4 +38,100 @@ import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class StIvtSectattrServiceImpl extends ServiceImpl<StIvtSectattrMapper, StIvtSectattr> implements IStIvtSectattrService {
|
||||
|
||||
/**
|
||||
* 仓库服务
|
||||
*/
|
||||
@Autowired
|
||||
private IStIvtBsrealstorattrService iStIvtBsrealstorattrService;
|
||||
|
||||
@Override
|
||||
public Object pageQuery(SectQuery query, PageQuery pageQuery) {
|
||||
Page<Object> page = PageHelper.startPage(pageQuery.getPage() + 1, pageQuery.getSize());
|
||||
page.setOrderBy("create_time DESC");
|
||||
List<Map> mst_detail = this.baseMapper.getPageQuery(query, pageQuery);
|
||||
|
||||
TableDataInfo<Map> build = TableDataInfo.build(mst_detail);
|
||||
build.setTotalElements(page.getTotal());
|
||||
return build;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(StIvtSectattr dao) {
|
||||
|
||||
StIvtSectattr isDao = this.getOne(
|
||||
new QueryWrapper<StIvtSectattr>().lambda()
|
||||
.eq(StIvtSectattr::getSect_code, dao.getSect_code())
|
||||
.eq(StIvtSectattr::getIs_delete, IOSEnum.IS_NOTANDYES.code("否"))
|
||||
);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(isDao)) {
|
||||
throw new BadRequestException("已存在相同编码的仓库【"+dao.getSect_code()+"】");
|
||||
}
|
||||
|
||||
dao.setSect_id(IdUtil.getStringId());
|
||||
dao.setCreate_id(SecurityUtils.getCurrentUserId());
|
||||
dao.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||
dao.setUpdate_optid(SecurityUtils.getCurrentUserId());
|
||||
dao.setUpdate_optname(SecurityUtils.getCurrentNickName());
|
||||
dao.setUpdate_time(DateUtil.now());
|
||||
dao.setCreate_time(DateUtil.now());
|
||||
|
||||
StIvtBsrealstorattr attrDao = iStIvtBsrealstorattrService.getById(dao.getStor_id());
|
||||
dao.setStor_type(attrDao.getStor_type_scode());
|
||||
this.save(dao);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(StIvtSectattr dao) {
|
||||
|
||||
StIvtSectattr isDao = this.getById(dao.getSect_id());
|
||||
|
||||
if (isDao == null) {
|
||||
throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
}
|
||||
|
||||
dao.setUpdate_optid(SecurityUtils.getCurrentUserId());
|
||||
dao.setUpdate_optname(SecurityUtils.getCurrentNickName());
|
||||
dao.setUpdate_time(DateUtil.now());
|
||||
|
||||
StIvtBsrealstorattr attrDao = iStIvtBsrealstorattrService.getById(dao.getStor_id());
|
||||
dao.setStor_type(attrDao.getStor_type_scode());
|
||||
|
||||
this.updateById(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(Long[] ids) {
|
||||
for (Long sectId : ids) {
|
||||
this.update(
|
||||
new UpdateWrapper<StIvtSectattr>().lambda()
|
||||
.set(StIvtSectattr::getIs_delete, IOSEnum.IS_NOTANDYES.code("是"))
|
||||
.set(StIvtSectattr::getUpdate_optid, SecurityUtils.getCurrentUserId())
|
||||
.set(StIvtSectattr::getUpdate_optname, SecurityUtils.getCurrentNickName())
|
||||
.set(StIvtSectattr::getUpdate_time, DateUtil.now())
|
||||
.eq(StIvtSectattr::getSect_id, sectId)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void changeActive(StIvtSectattr dao) {
|
||||
|
||||
String isUsed = IOSEnum.IS_NOTANDYES.code("是");
|
||||
if (StrUtil.equals(IOSEnum.IS_NOTANDYES.code("是"), dao.getIs_used())) {
|
||||
isUsed = IOSEnum.IS_NOTANDYES.code("否");
|
||||
}
|
||||
|
||||
dao.setIs_used(isUsed);
|
||||
dao.setUpdate_time(DateUtil.now());
|
||||
dao.setUpdate_optid(SecurityUtils.getCurrentUserId());
|
||||
dao.setUpdate_optname(SecurityUtils.getCurrentNickName());
|
||||
this.updateById(dao);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
324
lms/nladmin-ui/src/views/wms/basedata/st/sect/index.vue
Normal file
324
lms/nladmin-ui/src/views/wms/basedata/st/sect/index.vue
Normal file
@@ -0,0 +1,324 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!--工具栏-->
|
||||
<div class="head-container">
|
||||
<div v-if="crud.props.searchToggle">
|
||||
<el-select
|
||||
v-model="query.stor_id"
|
||||
clearable
|
||||
class="filter-item"
|
||||
placeholder="所属仓库"
|
||||
@change="crud.toQuery"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in stors"
|
||||
:key="item.stor_id"
|
||||
:label="item.stor_name"
|
||||
:value="item.stor_id"
|
||||
/>
|
||||
</el-select>
|
||||
<el-input
|
||||
v-model="query.search"
|
||||
clearable
|
||||
class="filter-item"
|
||||
style="width: 200px"
|
||||
size="mini"
|
||||
placeholder="输入库区编码或名称"
|
||||
prefix-icon="el-icon-search"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
<rrOperation />
|
||||
</div>
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<crudOperation :permission="permission" />
|
||||
<!--表单组件-->
|
||||
<el-dialog
|
||||
:close-on-click-modal="false"
|
||||
:before-close="crud.cancelCU"
|
||||
:visible.sync="crud.status.cu > 0"
|
||||
:title="crud.status.title"
|
||||
width="700px"
|
||||
>
|
||||
<el-form ref="form" :model="form" :rules="rules" size="mini" label-width="80px">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="库区编码" prop="sect_code">
|
||||
<el-input v-model="form.sect_code" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="库区名称" prop="sect_name">
|
||||
<el-input v-model="form.sect_name" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="库区简称">
|
||||
<el-input v-model="form.simple_name" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="归属仓库" prop="stor_id">
|
||||
<el-select
|
||||
v-model="form.stor_id"
|
||||
placeholder=""
|
||||
style="width: 200px"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in stors"
|
||||
:key="item.stor_id"
|
||||
:label="item.stor_name"
|
||||
:value="item.stor_id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="库区容量" prop="capacity">
|
||||
<el-input v-model="form.capacity" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="库区类型" prop="sect_type_attr">
|
||||
<el-select
|
||||
v-model="form.sect_type_attr"
|
||||
placeholder=""
|
||||
style="width: 200px"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.st_sect_type"
|
||||
:key="item.id"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="负责人">
|
||||
<el-input v-model="form.sect_manager_name" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="联系电话" prop="mobile_no">
|
||||
<el-input v-model="form.mobile_no" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注">
|
||||
<label slot="label">备 注</label>
|
||||
<el-input v-model="form.remark" :rows="3" type="textarea" style="width: 550px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</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 prop="sect_code" sortable label="库区编码" />
|
||||
<el-table-column prop="sect_name" label="库区名称" width="150" />
|
||||
<el-table-column prop="simple_name" label="库区简称" width="150" />
|
||||
<el-table-column prop="stor_name" label="仓库名称" width="150" />
|
||||
<el-table-column prop="capacity" label="容量" />
|
||||
<el-table-column prop="sect_manager_name" label="负责人" />
|
||||
<el-table-column prop="mobile_no" label="联系电话" width="100px" />
|
||||
<el-table-column label="是否启用" align="center" prop="is_used">
|
||||
<template slot-scope="scope">
|
||||
<el-switch
|
||||
:value="format_is_used(scope.row.is_used)"
|
||||
active-color="#409EFF"
|
||||
inactive-color="#F56C6C"
|
||||
@change="changeEnabled(scope.row, scope.row.is_used)"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="ext_id" label="外部标识" />
|
||||
<el-table-column prop="remark" label="备注" />
|
||||
<el-table-column
|
||||
v-permission="['admin','sectattr:edit','sectattr:del']"
|
||||
label="操作"
|
||||
width="120px"
|
||||
fixed="right"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<udOperation
|
||||
:data="scope.row"
|
||||
:permission="permission"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import crudSectattr from '@/views/wms/basedata/st/sect/sectattr'
|
||||
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'
|
||||
import crudStorattr, { getStor } from '@/views/wms/basedata/st/stor/storattr'
|
||||
import { isvalidPhone } from '@/utils/validate'
|
||||
|
||||
const defaultForm = {
|
||||
sect_id: null,
|
||||
sect_code: null,
|
||||
sect_name: null,
|
||||
simple_name: null,
|
||||
sect_type_attr: null,
|
||||
stor_id: null,
|
||||
stor_type: null,
|
||||
capacity: null,
|
||||
width: null,
|
||||
height: null,
|
||||
zdepth: null,
|
||||
xqty: null,
|
||||
yqty: null,
|
||||
zqty: null,
|
||||
sect_manager_name: null,
|
||||
mobile_no: null,
|
||||
remark: null,
|
||||
create_id: null,
|
||||
create_name: null,
|
||||
create_time: null,
|
||||
update_optid: null,
|
||||
update_optname: null,
|
||||
update_time: null,
|
||||
is_delete: null,
|
||||
back_ground_color: null,
|
||||
front_ground_color: null,
|
||||
back_ground_pic: null,
|
||||
font_direction_scode: null,
|
||||
floor_no: null,
|
||||
is_used: '',
|
||||
ext_id: null
|
||||
}
|
||||
export default {
|
||||
name: 'Sectattr',
|
||||
dicts: ['st_sect_type', 'is_used'],
|
||||
components: { pagination, crudOperation, rrOperation, udOperation },
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
cruds() {
|
||||
return CRUD({
|
||||
title: '库区',
|
||||
optShow: { add: true, reset: true },
|
||||
url: 'api/stIvtSectattr',
|
||||
idField: 'sect_id',
|
||||
sort: 'sect_id,desc',
|
||||
crudMethod: { ...crudSectattr }
|
||||
})
|
||||
},
|
||||
data() {
|
||||
const validPhone = (rule, value, callback) => {
|
||||
if (value && !isvalidPhone(value)) {
|
||||
callback(new Error('请输入正确的11位手机号码'))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
const numberOne = (rule, value, callback) => {
|
||||
const numReg = /^[+]{0,1}(\d+)$|^[+]{0,1}(\d+\.\d+)$/
|
||||
const numRe = new RegExp(numReg)
|
||||
if (value) {
|
||||
if (!numRe.test(value)) {
|
||||
callback(new Error('只能输入数字'))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
return {
|
||||
stors: [],
|
||||
permission: {
|
||||
add: ['admin', 'user:add'],
|
||||
edit: ['admin', 'user:edit'],
|
||||
del: ['admin', 'user:del']
|
||||
},
|
||||
rules: {
|
||||
sect_code: [
|
||||
{ required: true, message: '库区编码不能为空', trigger: 'blur' }
|
||||
],
|
||||
sect_name: [
|
||||
{ required: true, message: '库区名称不能为空', trigger: 'blur' }
|
||||
],
|
||||
sect_type_attr: [
|
||||
{ required: true, message: '库区类型不能为空', trigger: 'blur' }
|
||||
],
|
||||
stor_id: [
|
||||
{ required: true, message: '仓库标识不能为空', trigger: 'blur' }
|
||||
],
|
||||
capacity: [
|
||||
{ required: false, message: '不能为空', trigger: 'blur' },
|
||||
{ validator: numberOne }
|
||||
],
|
||||
mobile_no: [
|
||||
{ required: false, trigger: 'blur', validator: validPhone }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
crudStorattr.getStor({}).then(res => {
|
||||
this.stors = res
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
||||
[CRUD.HOOK.beforeRefresh]() {
|
||||
return true
|
||||
},
|
||||
// 改变状态
|
||||
format_is_used(is_used) {
|
||||
return is_used === '1'
|
||||
},
|
||||
changeEnabled(data, val) {
|
||||
let msg = '此操作将停用,是否继续!'
|
||||
if (val !== '1') {
|
||||
msg = '此操作将启用,是否继续!'
|
||||
}
|
||||
this.$confirm(msg, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
crudSectattr.changeActive(data).then(res => {
|
||||
this.crud.toQuery()
|
||||
this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
}).catch(() => {
|
||||
data.is_used = !data.is_used
|
||||
})
|
||||
}).catch(() => {
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
43
lms/nladmin-ui/src/views/wms/basedata/st/sect/sectattr.js
Normal file
43
lms/nladmin-ui/src/views/wms/basedata/st/sect/sectattr.js
Normal file
@@ -0,0 +1,43 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function add(data) {
|
||||
return request({
|
||||
url: 'api/stIvtSectattr',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function del(ids) {
|
||||
return request({
|
||||
url: 'api/stIvtSectattr/',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
|
||||
export function edit(data) {
|
||||
return request({
|
||||
url: 'api/stIvtSectattr',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function getSect(params) {
|
||||
return request({
|
||||
url: 'api/stIvtSectattr/getSect',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
export function changeActive(data) {
|
||||
return request({
|
||||
url: 'api/stIvtSectattr/changeActive',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, getSect, changeActive }
|
||||
@@ -41,6 +41,11 @@
|
||||
<el-input v-model="form.simple_name" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="外部标识">
|
||||
<el-input v-model="form.ext_id" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
@@ -89,13 +94,6 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="外部标识">
|
||||
<el-input v-model="form.ext_id" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-form-item label="仓库类型" required>
|
||||
<el-col :span="4" />
|
||||
@@ -280,9 +278,6 @@ export default {
|
||||
stor_name: [
|
||||
{ required: true, message: '仓库名称不能为空', trigger: 'blur' }
|
||||
],
|
||||
sysdeptid: [
|
||||
{ required: true, message: '所属部门不能为空', trigger: 'blur' }
|
||||
],
|
||||
stor_capacity: [
|
||||
{ required: false, message: '不能为空', trigger: 'blur' },
|
||||
{ validator: numberOne }
|
||||
@@ -358,6 +353,31 @@ export default {
|
||||
this.depts = date
|
||||
})
|
||||
},
|
||||
buildDepts(depts) {
|
||||
depts.forEach(data => {
|
||||
if (data.children) {
|
||||
this.buildDepts(data.children)
|
||||
}
|
||||
if (data.hasChildren && !data.children) {
|
||||
data.children = null
|
||||
}
|
||||
})
|
||||
},
|
||||
loadDepts({ action, parentNode, callback }) {
|
||||
if (action === LOAD_CHILDREN_OPTIONS) {
|
||||
getDepts({ enabled: true, pid: parentNode.id }).then(res => {
|
||||
parentNode.children = res.content.map(function(obj) {
|
||||
if (obj.hasChildren) {
|
||||
obj.children = null
|
||||
}
|
||||
return obj
|
||||
})
|
||||
setTimeout(() => {
|
||||
callback()
|
||||
}, 200)
|
||||
})
|
||||
}
|
||||
},
|
||||
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
||||
[CRUD.HOOK.beforeRefresh]() {
|
||||
return true
|
||||
|
||||
Reference in New Issue
Block a user