diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmRtIssueController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmRtIssueController.java new file mode 100644 index 0000000..71af548 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmRtIssueController.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.WmRtIssue; +import com.ktg.mes.wm.service.IWmRtIssueService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 生产退料单头Controller + * + * @author yinjinlu + * @date 2022-09-15 + */ +@RestController +@RequestMapping("/mes/wm/rtissue") +public class WmRtIssueController extends BaseController +{ + @Autowired + private IWmRtIssueService wmRtIssueService; + + /** + * 查询生产退料单头列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtissue:list')") + @GetMapping("/list") + public TableDataInfo list(WmRtIssue wmRtIssue) + { + startPage(); + List list = wmRtIssueService.selectWmRtIssueList(wmRtIssue); + return getDataTable(list); + } + + /** + * 导出生产退料单头列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtissue:export')") + @Log(title = "生产退料单头", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, WmRtIssue wmRtIssue) + { + List list = wmRtIssueService.selectWmRtIssueList(wmRtIssue); + ExcelUtil util = new ExcelUtil(WmRtIssue.class); + util.exportExcel(response, list, "生产退料单头数据"); + } + + /** + * 获取生产退料单头详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtissue:query')") + @GetMapping(value = "/{rtId}") + public AjaxResult getInfo(@PathVariable("rtId") Long rtId) + { + return AjaxResult.success(wmRtIssueService.selectWmRtIssueByRtId(rtId)); + } + + /** + * 新增生产退料单头 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtissue:add')") + @Log(title = "生产退料单头", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmRtIssue wmRtIssue) + { + if(UserConstants.NOT_UNIQUE.equals(wmRtIssueService.checkUnique(wmRtIssue))){ + return AjaxResult.error("退料单编号已存在"); + } + return toAjax(wmRtIssueService.insertWmRtIssue(wmRtIssue)); + } + + /** + * 修改生产退料单头 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtissue:edit')") + @Log(title = "生产退料单头", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmRtIssue wmRtIssue) + { + if(UserConstants.NOT_UNIQUE.equals(wmRtIssueService.checkUnique(wmRtIssue))){ + return AjaxResult.error("退料单编号已存在"); + } + return toAjax(wmRtIssueService.updateWmRtIssue(wmRtIssue)); + } + + /** + * 删除生产退料单头 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtissue:remove')") + @Log(title = "生产退料单头", businessType = BusinessType.DELETE) + @DeleteMapping("/{rtIds}") + public AjaxResult remove(@PathVariable Long[] rtIds) + { + return toAjax(wmRtIssueService.deleteWmRtIssueByRtIds(rtIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmRtIssue.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmRtIssue.java new file mode 100644 index 0000000..ea12f53 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmRtIssue.java @@ -0,0 +1,307 @@ +package com.ktg.mes.wm.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +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_rt_issue + * + * @author yinjinlu + * @date 2022-09-15 + */ +public class WmRtIssue extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 退料单ID */ + private Long rtId; + + /** 退料单编号 */ + @Excel(name = "退料单编号") + private String rtCode; + + /** 退料单名称 */ + @Excel(name = "退料单名称") + private String rtName; + + /** 生产工单ID */ + @Excel(name = "生产工单ID") + private Long workorderId; + + /** 生产工单编码 */ + @Excel(name = "生产工单编码") + private String workorderCode; + + /** 仓库ID */ + @Excel(name = "仓库ID") + private Long warehouseId; + + /** 仓库编码 */ + @Excel(name = "仓库编码") + private String warehouseCode; + + /** 仓库名称 */ + @Excel(name = "仓库名称") + private String warehouseName; + + /** 库区ID */ + @Excel(name = "库区ID") + private Long locationId; + + /** 库区编码 */ + @Excel(name = "库区编码") + private String locationCode; + + /** 库区名称 */ + @Excel(name = "库区名称") + private String locationName; + + /** 库位ID */ + @Excel(name = "库位ID") + private Long areaId; + + /** 库位编码 */ + @Excel(name = "库位编码") + private String areaCode; + + /** 库位名称 */ + @Excel(name = "库位名称") + private String areaName; + + /** 退料日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "退料日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date rtDate; + + /** 单据状态 */ + @Excel(name = "单据状态") + private String status; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setRtId(Long rtId) + { + this.rtId = rtId; + } + + public Long getRtId() + { + return rtId; + } + public void setRtCode(String rtCode) + { + this.rtCode = rtCode; + } + + public String getRtCode() + { + return rtCode; + } + public void setRtName(String rtName) + { + this.rtName = rtName; + } + + public String getRtName() + { + return rtName; + } + public void setWorkorderId(Long workorderId) + { + this.workorderId = workorderId; + } + + public Long getWorkorderId() + { + return workorderId; + } + public void setWorkorderCode(String workorderCode) + { + this.workorderCode = workorderCode; + } + + public String getWorkorderCode() + { + return workorderCode; + } + public void setWarehouseId(Long warehouseId) + { + this.warehouseId = warehouseId; + } + + public Long getWarehouseId() + { + return warehouseId; + } + public void setWarehouseCode(String warehouseCode) + { + this.warehouseCode = warehouseCode; + } + + public String getWarehouseCode() + { + return warehouseCode; + } + public void setWarehouseName(String warehouseName) + { + this.warehouseName = warehouseName; + } + + public String getWarehouseName() + { + return warehouseName; + } + 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 setAreaId(Long areaId) + { + this.areaId = areaId; + } + + public Long getAreaId() + { + return areaId; + } + public void setAreaCode(String areaCode) + { + this.areaCode = areaCode; + } + + public String getAreaCode() + { + return areaCode; + } + public void setAreaName(String areaName) + { + this.areaName = areaName; + } + + public String getAreaName() + { + return areaName; + } + public void setRtDate(Date rtDate) + { + this.rtDate = rtDate; + } + + public Date getRtDate() + { + return rtDate; + } + public void setStatus(String status) + { + this.status = status; + } + + public String getStatus() + { + return status; + } + 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("rtId", getRtId()) + .append("rtCode", getRtCode()) + .append("rtName", getRtName()) + .append("workorderId", getWorkorderId()) + .append("workorderCode", getWorkorderCode()) + .append("warehouseId", getWarehouseId()) + .append("warehouseCode", getWarehouseCode()) + .append("warehouseName", getWarehouseName()) + .append("locationId", getLocationId()) + .append("locationCode", getLocationCode()) + .append("locationName", getLocationName()) + .append("areaId", getAreaId()) + .append("areaCode", getAreaCode()) + .append("areaName", getAreaName()) + .append("rtDate", getRtDate()) + .append("status", getStatus()) + .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/WmRtIssueMapper.java b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmRtIssueMapper.java new file mode 100644 index 0000000..31816bd --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmRtIssueMapper.java @@ -0,0 +1,68 @@ +package com.ktg.mes.wm.mapper; + +import java.util.List; +import com.ktg.mes.wm.domain.WmRtIssue; + +/** + * 生产退料单头Mapper接口 + * + * @author yinjinlu + * @date 2022-09-15 + */ +public interface WmRtIssueMapper +{ + /** + * 查询生产退料单头 + * + * @param rtId 生产退料单头主键 + * @return 生产退料单头 + */ + public WmRtIssue selectWmRtIssueByRtId(Long rtId); + + /** + * 查询生产退料单头列表 + * + * @param wmRtIssue 生产退料单头 + * @return 生产退料单头集合 + */ + public List selectWmRtIssueList(WmRtIssue wmRtIssue); + + /** + * 检查编号是否重复 + * @param wmRtIssue + * @return + */ + public WmRtIssue checkUnique(WmRtIssue wmRtIssue); + + /** + * 新增生产退料单头 + * + * @param wmRtIssue 生产退料单头 + * @return 结果 + */ + public int insertWmRtIssue(WmRtIssue wmRtIssue); + + /** + * 修改生产退料单头 + * + * @param wmRtIssue 生产退料单头 + * @return 结果 + */ + public int updateWmRtIssue(WmRtIssue wmRtIssue); + + /** + * 删除生产退料单头 + * + * @param rtId 生产退料单头主键 + * @return 结果 + */ + public int deleteWmRtIssueByRtId(Long rtId); + + /** + * 批量删除生产退料单头 + * + * @param rtIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWmRtIssueByRtIds(Long[] rtIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmRtIssueService.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmRtIssueService.java new file mode 100644 index 0000000..febb16a --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmRtIssueService.java @@ -0,0 +1,68 @@ +package com.ktg.mes.wm.service; + +import java.util.List; +import com.ktg.mes.wm.domain.WmRtIssue; + +/** + * 生产退料单头Service接口 + * + * @author yinjinlu + * @date 2022-09-15 + */ +public interface IWmRtIssueService +{ + /** + * 查询生产退料单头 + * + * @param rtId 生产退料单头主键 + * @return 生产退料单头 + */ + public WmRtIssue selectWmRtIssueByRtId(Long rtId); + + /** + * 查询生产退料单头列表 + * + * @param wmRtIssue 生产退料单头 + * @return 生产退料单头集合 + */ + public List selectWmRtIssueList(WmRtIssue wmRtIssue); + + /** + * 检查编号是否重复 + * @param wmRtIssue + * @return + */ + public String checkUnique(WmRtIssue wmRtIssue); + + /** + * 新增生产退料单头 + * + * @param wmRtIssue 生产退料单头 + * @return 结果 + */ + public int insertWmRtIssue(WmRtIssue wmRtIssue); + + /** + * 修改生产退料单头 + * + * @param wmRtIssue 生产退料单头 + * @return 结果 + */ + public int updateWmRtIssue(WmRtIssue wmRtIssue); + + /** + * 批量删除生产退料单头 + * + * @param rtIds 需要删除的生产退料单头主键集合 + * @return 结果 + */ + public int deleteWmRtIssueByRtIds(Long[] rtIds); + + /** + * 删除生产退料单头信息 + * + * @param rtId 生产退料单头主键 + * @return 结果 + */ + public int deleteWmRtIssueByRtId(Long rtId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmRtIssueServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmRtIssueServiceImpl.java new file mode 100644 index 0000000..6edba9b --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmRtIssueServiceImpl.java @@ -0,0 +1,109 @@ +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.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.wm.mapper.WmRtIssueMapper; +import com.ktg.mes.wm.domain.WmRtIssue; +import com.ktg.mes.wm.service.IWmRtIssueService; + +/** + * 生产退料单头Service业务层处理 + * + * @author yinjinlu + * @date 2022-09-15 + */ +@Service +public class WmRtIssueServiceImpl implements IWmRtIssueService +{ + @Autowired + private WmRtIssueMapper wmRtIssueMapper; + + /** + * 查询生产退料单头 + * + * @param rtId 生产退料单头主键 + * @return 生产退料单头 + */ + @Override + public WmRtIssue selectWmRtIssueByRtId(Long rtId) + { + return wmRtIssueMapper.selectWmRtIssueByRtId(rtId); + } + + /** + * 查询生产退料单头列表 + * + * @param wmRtIssue 生产退料单头 + * @return 生产退料单头 + */ + @Override + public List selectWmRtIssueList(WmRtIssue wmRtIssue) + { + return wmRtIssueMapper.selectWmRtIssueList(wmRtIssue); + } + + @Override + public String checkUnique(WmRtIssue wmRtIssue) { + WmRtIssue issue = wmRtIssueMapper.checkUnique(wmRtIssue); + Long rtId = wmRtIssue.getRtId() == null? -1L: wmRtIssue.getRtId(); + if(StringUtils.isNotNull(issue) && issue.getRtId().longValue() != rtId.longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 新增生产退料单头 + * + * @param wmRtIssue 生产退料单头 + * @return 结果 + */ + @Override + public int insertWmRtIssue(WmRtIssue wmRtIssue) + { + wmRtIssue.setCreateTime(DateUtils.getNowDate()); + return wmRtIssueMapper.insertWmRtIssue(wmRtIssue); + } + + /** + * 修改生产退料单头 + * + * @param wmRtIssue 生产退料单头 + * @return 结果 + */ + @Override + public int updateWmRtIssue(WmRtIssue wmRtIssue) + { + wmRtIssue.setUpdateTime(DateUtils.getNowDate()); + return wmRtIssueMapper.updateWmRtIssue(wmRtIssue); + } + + /** + * 批量删除生产退料单头 + * + * @param rtIds 需要删除的生产退料单头主键 + * @return 结果 + */ + @Override + public int deleteWmRtIssueByRtIds(Long[] rtIds) + { + return wmRtIssueMapper.deleteWmRtIssueByRtIds(rtIds); + } + + /** + * 删除生产退料单头信息 + * + * @param rtId 生产退料单头主键 + * @return 结果 + */ + @Override + public int deleteWmRtIssueByRtId(Long rtId) + { + return wmRtIssueMapper.deleteWmRtIssueByRtId(rtId); + } +} diff --git a/ktg-mes/src/main/resources/mapper/wm/WmRtIssueMapper.xml b/ktg-mes/src/main/resources/mapper/wm/WmRtIssueMapper.xml new file mode 100644 index 0000000..03c4093 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/wm/WmRtIssueMapper.xml @@ -0,0 +1,167 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select rt_id, rt_code, rt_name, workorder_id, workorder_code, warehouse_id, warehouse_code, warehouse_name, location_id, location_code, location_name, area_id, area_code, area_name, rt_date, status, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_rt_issue + + + + + + + + + + insert into wm_rt_issue + + rt_code, + rt_name, + workorder_id, + workorder_code, + warehouse_id, + warehouse_code, + warehouse_name, + location_id, + location_code, + location_name, + area_id, + area_code, + area_name, + rt_date, + status, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{rtCode}, + #{rtName}, + #{workorderId}, + #{workorderCode}, + #{warehouseId}, + #{warehouseCode}, + #{warehouseName}, + #{locationId}, + #{locationCode}, + #{locationName}, + #{areaId}, + #{areaCode}, + #{areaName}, + #{rtDate}, + #{status}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update wm_rt_issue + + rt_code = #{rtCode}, + rt_name = #{rtName}, + workorder_id = #{workorderId}, + workorder_code = #{workorderCode}, + warehouse_id = #{warehouseId}, + warehouse_code = #{warehouseCode}, + warehouse_name = #{warehouseName}, + location_id = #{locationId}, + location_code = #{locationCode}, + location_name = #{locationName}, + area_id = #{areaId}, + area_code = #{areaCode}, + area_name = #{areaName}, + rt_date = #{rtDate}, + status = #{status}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where rt_id = #{rtId} + + + + delete from wm_rt_issue where rt_id = #{rtId} + + + + delete from wm_rt_issue where rt_id in + + #{rtId} + + + \ No newline at end of file