diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmStorageLocationController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmStorageLocationController.java new file mode 100644 index 0000000..b5af6bd --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmStorageLocationController.java @@ -0,0 +1,112 @@ +package com.ktg.mes.wm.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ktg.common.constant.UserConstants; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.wm.domain.WmStorageLocation; +import com.ktg.mes.wm.service.IWmStorageLocationService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 库区设置Controller + * + * @author yinjinlu + * @date 2022-05-07 + */ +@RestController +@RequestMapping("/mes/wm/location") +public class WmStorageLocationController extends BaseController +{ + @Autowired + private IWmStorageLocationService wmStorageLocationService; + + /** + * 查询库区设置列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:location:list')") + @GetMapping("/list") + public TableDataInfo list(WmStorageLocation wmStorageLocation) + { + startPage(); + List list = wmStorageLocationService.selectWmStorageLocationList(wmStorageLocation); + return getDataTable(list); + } + + /** + * 导出库区设置列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:location:export')") + @Log(title = "库区设置", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, WmStorageLocation wmStorageLocation) + { + List list = wmStorageLocationService.selectWmStorageLocationList(wmStorageLocation); + ExcelUtil util = new ExcelUtil(WmStorageLocation.class); + util.exportExcel(response, list, "库区设置数据"); + } + + /** + * 获取库区设置详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:location:query')") + @GetMapping(value = "/{locationId}") + public AjaxResult getInfo(@PathVariable("locationId") Long locationId) + { + return AjaxResult.success(wmStorageLocationService.selectWmStorageLocationByLocationId(locationId)); + } + + /** + * 新增库区设置 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:location:add')") + @Log(title = "库区设置", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmStorageLocation wmStorageLocation) + { + if(UserConstants.NOT_UNIQUE.equals(wmStorageLocationService.checkLocationCodeUnique(wmStorageLocation))){ + return AjaxResult.error("库区编码已存在!"); + } + if(UserConstants.NOT_UNIQUE.equals(wmStorageLocationService.checkLocationNameUnique(wmStorageLocation))){ + return AjaxResult.error("库区名称已存在!"); + } + return toAjax(wmStorageLocationService.insertWmStorageLocation(wmStorageLocation)); + } + + /** + * 修改库区设置 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:location:edit')") + @Log(title = "库区设置", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmStorageLocation wmStorageLocation) + { + return toAjax(wmStorageLocationService.updateWmStorageLocation(wmStorageLocation)); + } + + /** + * 删除库区设置 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:location:remove')") + @Log(title = "库区设置", businessType = BusinessType.DELETE) + @DeleteMapping("/{locationIds}") + public AjaxResult remove(@PathVariable Long[] locationIds) + { + return toAjax(wmStorageLocationService.deleteWmStorageLocationByLocationIds(locationIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmStorageLocation.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmStorageLocation.java new file mode 100644 index 0000000..d2744f3 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmStorageLocation.java @@ -0,0 +1,165 @@ +package com.ktg.mes.wm.domain; + +import java.math.BigDecimal; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 库区设置对象 wm_storage_location + * + * @author yinjinlu + * @date 2022-05-07 + */ +public class WmStorageLocation extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 库区ID */ + private Long locationId; + + /** 库区编码 */ + @Excel(name = "库区编码") + private String locationCode; + + /** 库区名称 */ + @Excel(name = "库区名称") + private String locationName; + + /** 仓库ID */ + @Excel(name = "仓库ID") + private Long warehouseId; + + /** 面积 */ + @Excel(name = "面积") + private BigDecimal area; + + /** 是否开启库位管理 */ + @Excel(name = "是否开启库位管理") + private String areaFlag; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setLocationId(Long locationId) + { + this.locationId = locationId; + } + + public Long getLocationId() + { + return locationId; + } + public void setLocationCode(String locationCode) + { + this.locationCode = locationCode; + } + + public String getLocationCode() + { + return locationCode; + } + public void setLocationName(String locationName) + { + this.locationName = locationName; + } + + public String getLocationName() + { + return locationName; + } + public void setWarehouseId(Long warehouseId) + { + this.warehouseId = warehouseId; + } + + public Long getWarehouseId() + { + return warehouseId; + } + public void setArea(BigDecimal area) + { + this.area = area; + } + + public BigDecimal getArea() + { + return area; + } + public void setAreaFlag(String areaFlag) + { + this.areaFlag = areaFlag; + } + + public String getAreaFlag() + { + return areaFlag; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("locationId", getLocationId()) + .append("locationCode", getLocationCode()) + .append("locationName", getLocationName()) + .append("warehouseId", getWarehouseId()) + .append("area", getArea()) + .append("areaFlag", getAreaFlag()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmStorageLocationMapper.java b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmStorageLocationMapper.java new file mode 100644 index 0000000..76d31f4 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmStorageLocationMapper.java @@ -0,0 +1,67 @@ +package com.ktg.mes.wm.mapper; + +import java.util.List; +import com.ktg.mes.wm.domain.WmStorageLocation; + +/** + * 库区设置Mapper接口 + * + * @author yinjinlu + * @date 2022-05-07 + */ +public interface WmStorageLocationMapper +{ + /** + * 查询库区设置 + * + * @param locationId 库区设置主键 + * @return 库区设置 + */ + public WmStorageLocation selectWmStorageLocationByLocationId(Long locationId); + + /** + * 查询库区设置列表 + * + * @param wmStorageLocation 库区设置 + * @return 库区设置集合 + */ + public List selectWmStorageLocationList(WmStorageLocation wmStorageLocation); + + + public WmStorageLocation checkLocationCodeUnique(WmStorageLocation wmStorageLocation); + public WmStorageLocation checkLocationNameUnique(WmStorageLocation wmStorageLocation); + + + + /** + * 新增库区设置 + * + * @param wmStorageLocation 库区设置 + * @return 结果 + */ + public int insertWmStorageLocation(WmStorageLocation wmStorageLocation); + + /** + * 修改库区设置 + * + * @param wmStorageLocation 库区设置 + * @return 结果 + */ + public int updateWmStorageLocation(WmStorageLocation wmStorageLocation); + + /** + * 删除库区设置 + * + * @param locationId 库区设置主键 + * @return 结果 + */ + public int deleteWmStorageLocationByLocationId(Long locationId); + + /** + * 批量删除库区设置 + * + * @param locationIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWmStorageLocationByLocationIds(Long[] locationIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmStorageLocationService.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmStorageLocationService.java new file mode 100644 index 0000000..7862487 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmStorageLocationService.java @@ -0,0 +1,76 @@ +package com.ktg.mes.wm.service; + +import java.util.List; +import com.ktg.mes.wm.domain.WmStorageLocation; + +/** + * 库区设置Service接口 + * + * @author yinjinlu + * @date 2022-05-07 + */ +public interface IWmStorageLocationService +{ + /** + * 查询库区设置 + * + * @param locationId 库区设置主键 + * @return 库区设置 + */ + public WmStorageLocation selectWmStorageLocationByLocationId(Long locationId); + + /** + * 查询库区设置列表 + * + * @param wmStorageLocation 库区设置 + * @return 库区设置集合 + */ + public List selectWmStorageLocationList(WmStorageLocation wmStorageLocation); + + + /** + * 检查库区编码是否唯一 + * @param wmStorageLocation + * @return + */ + public String checkLocationCodeUnique(WmStorageLocation wmStorageLocation); + + /** + * 检查库区名称是否唯一 + * @param wmStorageLocation + * @return + */ + public String checkLocationNameUnique(WmStorageLocation wmStorageLocation); + + /** + * 新增库区设置 + * + * @param wmStorageLocation 库区设置 + * @return 结果 + */ + public int insertWmStorageLocation(WmStorageLocation wmStorageLocation); + + /** + * 修改库区设置 + * + * @param wmStorageLocation 库区设置 + * @return 结果 + */ + public int updateWmStorageLocation(WmStorageLocation wmStorageLocation); + + /** + * 批量删除库区设置 + * + * @param locationIds 需要删除的库区设置主键集合 + * @return 结果 + */ + public int deleteWmStorageLocationByLocationIds(Long[] locationIds); + + /** + * 删除库区设置信息 + * + * @param locationId 库区设置主键 + * @return 结果 + */ + public int deleteWmStorageLocationByLocationId(Long locationId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmStorageLocationServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmStorageLocationServiceImpl.java new file mode 100644 index 0000000..9fc651b --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmStorageLocationServiceImpl.java @@ -0,0 +1,120 @@ +package com.ktg.mes.wm.service.impl; + +import java.util.List; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.DateUtils; +import com.ktg.common.utils.StringUtils; +import org.apache.catalina.User; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.wm.mapper.WmStorageLocationMapper; +import com.ktg.mes.wm.domain.WmStorageLocation; +import com.ktg.mes.wm.service.IWmStorageLocationService; + +/** + * 库区设置Service业务层处理 + * + * @author yinjinlu + * @date 2022-05-07 + */ +@Service +public class WmStorageLocationServiceImpl implements IWmStorageLocationService +{ + @Autowired + private WmStorageLocationMapper wmStorageLocationMapper; + + /** + * 查询库区设置 + * + * @param locationId 库区设置主键 + * @return 库区设置 + */ + @Override + public WmStorageLocation selectWmStorageLocationByLocationId(Long locationId) + { + return wmStorageLocationMapper.selectWmStorageLocationByLocationId(locationId); + } + + /** + * 查询库区设置列表 + * + * @param wmStorageLocation 库区设置 + * @return 库区设置 + */ + @Override + public List selectWmStorageLocationList(WmStorageLocation wmStorageLocation) + { + return wmStorageLocationMapper.selectWmStorageLocationList(wmStorageLocation); + } + + @Override + public String checkLocationCodeUnique(WmStorageLocation wmStorageLocation) { + WmStorageLocation location = wmStorageLocationMapper.checkLocationCodeUnique(wmStorageLocation); + Long locationId = wmStorageLocation.getLocationId()==null?-1L:wmStorageLocation.getLocationId(); + if(StringUtils.isNotNull(location) && location.getLocationId().longValue() != locationId.longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + @Override + public String checkLocationNameUnique(WmStorageLocation wmStorageLocation) { + WmStorageLocation location = wmStorageLocationMapper.checkLocationNameUnique(wmStorageLocation); + Long locationId = wmStorageLocation.getLocationId()==null?-1L:wmStorageLocation.getLocationId(); + if(StringUtils.isNotNull(location) && location.getLocationId().longValue() != locationId.longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 新增库区设置 + * + * @param wmStorageLocation 库区设置 + * @return 结果 + */ + @Override + public int insertWmStorageLocation(WmStorageLocation wmStorageLocation) + { + wmStorageLocation.setCreateTime(DateUtils.getNowDate()); + return wmStorageLocationMapper.insertWmStorageLocation(wmStorageLocation); + } + + /** + * 修改库区设置 + * + * @param wmStorageLocation 库区设置 + * @return 结果 + */ + @Override + public int updateWmStorageLocation(WmStorageLocation wmStorageLocation) + { + wmStorageLocation.setUpdateTime(DateUtils.getNowDate()); + return wmStorageLocationMapper.updateWmStorageLocation(wmStorageLocation); + } + + /** + * 批量删除库区设置 + * + * @param locationIds 需要删除的库区设置主键 + * @return 结果 + */ + @Override + public int deleteWmStorageLocationByLocationIds(Long[] locationIds) + { + return wmStorageLocationMapper.deleteWmStorageLocationByLocationIds(locationIds); + } + + /** + * 删除库区设置信息 + * + * @param locationId 库区设置主键 + * @return 结果 + */ + @Override + public int deleteWmStorageLocationByLocationId(Long locationId) + { + return wmStorageLocationMapper.deleteWmStorageLocationByLocationId(locationId); + } +} diff --git a/ktg-mes/src/main/resources/mapper/wm/WmStorageLocationMapper.xml b/ktg-mes/src/main/resources/mapper/wm/WmStorageLocationMapper.xml new file mode 100644 index 0000000..803c0c9 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/wm/WmStorageLocationMapper.xml @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + + + + + + + + + select location_id, location_code, location_name, warehouse_id, area, area_flag, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_storage_location + + + + + + + + + + + + insert into wm_storage_location + + location_code, + location_name, + warehouse_id, + area, + area_flag, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{locationCode}, + #{locationName}, + #{warehouseId}, + #{area}, + #{areaFlag}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update wm_storage_location + + location_code = #{locationCode}, + location_name = #{locationName}, + warehouse_id = #{warehouseId}, + area = #{area}, + area_flag = #{areaFlag}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where location_id = #{locationId} + + + + delete from wm_storage_location where location_id = #{locationId} + + + + delete from wm_storage_location where location_id in + + #{locationId} + + + \ No newline at end of file