diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmRtVendorController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmRtVendorController.java new file mode 100644 index 0000000..2b07f85 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmRtVendorController.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.WmRtVendor; +import com.ktg.mes.wm.service.IWmRtVendorService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 供应商退货Controller + * + * @author yinjinlu + * @date 2022-06-13 + */ +@RestController +@RequestMapping("/mes/wm/rtvendor") +public class WmRtVendorController extends BaseController +{ + @Autowired + private IWmRtVendorService wmRtVendorService; + + /** + * 查询供应商退货列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtvendor:list')") + @GetMapping("/list") + public TableDataInfo list(WmRtVendor wmRtVendor) + { + startPage(); + List list = wmRtVendorService.selectWmRtVendorList(wmRtVendor); + return getDataTable(list); + } + + /** + * 导出供应商退货列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtvendor:export')") + @Log(title = "供应商退货", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, WmRtVendor wmRtVendor) + { + List list = wmRtVendorService.selectWmRtVendorList(wmRtVendor); + ExcelUtil util = new ExcelUtil(WmRtVendor.class); + util.exportExcel(response, list, "供应商退货数据"); + } + + /** + * 获取供应商退货详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtvendor:query')") + @GetMapping(value = "/{rtId}") + public AjaxResult getInfo(@PathVariable("rtId") Long rtId) + { + return AjaxResult.success(wmRtVendorService.selectWmRtVendorByRtId(rtId)); + } + + /** + * 新增供应商退货 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtvendor:add')") + @Log(title = "供应商退货", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmRtVendor wmRtVendor) + { + if(UserConstants.NOT_UNIQUE.equals(wmRtVendorService.checkCodeUnique(wmRtVendor))){ + return AjaxResult.error("退货单编号已经存在!"); + } + return toAjax(wmRtVendorService.insertWmRtVendor(wmRtVendor)); + } + + /** + * 修改供应商退货 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtvendor:edit')") + @Log(title = "供应商退货", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmRtVendor wmRtVendor) + { + if(UserConstants.NOT_UNIQUE.equals(wmRtVendorService.checkCodeUnique(wmRtVendor))){ + return AjaxResult.error("退货单编号已经存在!"); + } + return toAjax(wmRtVendorService.updateWmRtVendor(wmRtVendor)); + } + + /** + * 删除供应商退货 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtvendor:remove')") + @Log(title = "供应商退货", businessType = BusinessType.DELETE) + @DeleteMapping("/{rtIds}") + public AjaxResult remove(@PathVariable Long[] rtIds) + { + return toAjax(wmRtVendorService.deleteWmRtVendorByRtIds(rtIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmRtVendor.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmRtVendor.java new file mode 100644 index 0000000..e17dbc5 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmRtVendor.java @@ -0,0 +1,223 @@ +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_vendor + * + * @author yinjinlu + * @date 2022-06-13 + */ +public class WmRtVendor extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 退货单ID */ + private Long rtId; + + /** 退货单编号 */ + @Excel(name = "退货单编号") + private String rtCode; + + /** 退货单名称 */ + @Excel(name = "退货单名称") + private String rtName; + + /** 采购订单编号 */ + @Excel(name = "采购订单编号") + private String poCode; + + /** 供应商ID */ + @Excel(name = "供应商ID") + private Long vendorId; + + /** 供应商编码 */ + @Excel(name = "供应商编码") + private String vendorCode; + + /** 供应商名称 */ + @Excel(name = "供应商名称") + private String vendorName; + + /** 供应商简称 */ + @Excel(name = "供应商简称") + private String vendorNick; + + /** 退货日期 */ + @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 setPoCode(String poCode) + { + this.poCode = poCode; + } + + public String getPoCode() + { + return poCode; + } + public void setVendorId(Long vendorId) + { + this.vendorId = vendorId; + } + + public Long getVendorId() + { + return vendorId; + } + public void setVendorCode(String vendorCode) + { + this.vendorCode = vendorCode; + } + + public String getVendorCode() + { + return vendorCode; + } + public void setVendorName(String vendorName) + { + this.vendorName = vendorName; + } + + public String getVendorName() + { + return vendorName; + } + public void setVendorNick(String vendorNick) + { + this.vendorNick = vendorNick; + } + + public String getVendorNick() + { + return vendorNick; + } + 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("poCode", getPoCode()) + .append("vendorId", getVendorId()) + .append("vendorCode", getVendorCode()) + .append("vendorName", getVendorName()) + .append("vendorNick", getVendorNick()) + .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/WmRtVendorMapper.java b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmRtVendorMapper.java new file mode 100644 index 0000000..866c0cb --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmRtVendorMapper.java @@ -0,0 +1,68 @@ +package com.ktg.mes.wm.mapper; + +import java.util.List; +import com.ktg.mes.wm.domain.WmRtVendor; + +/** + * 供应商退货Mapper接口 + * + * @author yinjinlu + * @date 2022-06-13 + */ +public interface WmRtVendorMapper +{ + /** + * 查询供应商退货 + * + * @param rtId 供应商退货主键 + * @return 供应商退货 + */ + public WmRtVendor selectWmRtVendorByRtId(Long rtId); + + /** + * 查询供应商退货列表 + * + * @param wmRtVendor 供应商退货 + * @return 供应商退货集合 + */ + public List selectWmRtVendorList(WmRtVendor wmRtVendor); + + /** + * 检查供应商退货单编码是否唯一 + * @param wmRtVendor + * @return + */ + public WmRtVendor checkCodeUnique(WmRtVendor wmRtVendor); + + /** + * 新增供应商退货 + * + * @param wmRtVendor 供应商退货 + * @return 结果 + */ + public int insertWmRtVendor(WmRtVendor wmRtVendor); + + /** + * 修改供应商退货 + * + * @param wmRtVendor 供应商退货 + * @return 结果 + */ + public int updateWmRtVendor(WmRtVendor wmRtVendor); + + /** + * 删除供应商退货 + * + * @param rtId 供应商退货主键 + * @return 结果 + */ + public int deleteWmRtVendorByRtId(Long rtId); + + /** + * 批量删除供应商退货 + * + * @param rtIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWmRtVendorByRtIds(Long[] rtIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmRtVendorService.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmRtVendorService.java new file mode 100644 index 0000000..8f31a61 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmRtVendorService.java @@ -0,0 +1,68 @@ +package com.ktg.mes.wm.service; + +import java.util.List; +import com.ktg.mes.wm.domain.WmRtVendor; + +/** + * 供应商退货Service接口 + * + * @author yinjinlu + * @date 2022-06-13 + */ +public interface IWmRtVendorService +{ + /** + * 查询供应商退货 + * + * @param rtId 供应商退货主键 + * @return 供应商退货 + */ + public WmRtVendor selectWmRtVendorByRtId(Long rtId); + + /** + * 查询供应商退货列表 + * + * @param wmRtVendor 供应商退货 + * @return 供应商退货集合 + */ + public List selectWmRtVendorList(WmRtVendor wmRtVendor); + + /** + * 检查供应商退货单编码是否唯一 + * @param wmRtVendor + * @return + */ + public String checkCodeUnique(WmRtVendor wmRtVendor); + + /** + * 新增供应商退货 + * + * @param wmRtVendor 供应商退货 + * @return 结果 + */ + public int insertWmRtVendor(WmRtVendor wmRtVendor); + + /** + * 修改供应商退货 + * + * @param wmRtVendor 供应商退货 + * @return 结果 + */ + public int updateWmRtVendor(WmRtVendor wmRtVendor); + + /** + * 批量删除供应商退货 + * + * @param rtIds 需要删除的供应商退货主键集合 + * @return 结果 + */ + public int deleteWmRtVendorByRtIds(Long[] rtIds); + + /** + * 删除供应商退货信息 + * + * @param rtId 供应商退货主键 + * @return 结果 + */ + public int deleteWmRtVendorByRtId(Long rtId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmRtVendorServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmRtVendorServiceImpl.java new file mode 100644 index 0000000..606d36d --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmRtVendorServiceImpl.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.WmRtVendorMapper; +import com.ktg.mes.wm.domain.WmRtVendor; +import com.ktg.mes.wm.service.IWmRtVendorService; + +/** + * 供应商退货Service业务层处理 + * + * @author yinjinlu + * @date 2022-06-13 + */ +@Service +public class WmRtVendorServiceImpl implements IWmRtVendorService +{ + @Autowired + private WmRtVendorMapper wmRtVendorMapper; + + /** + * 查询供应商退货 + * + * @param rtId 供应商退货主键 + * @return 供应商退货 + */ + @Override + public WmRtVendor selectWmRtVendorByRtId(Long rtId) + { + return wmRtVendorMapper.selectWmRtVendorByRtId(rtId); + } + + /** + * 查询供应商退货列表 + * + * @param wmRtVendor 供应商退货 + * @return 供应商退货 + */ + @Override + public List selectWmRtVendorList(WmRtVendor wmRtVendor) + { + return wmRtVendorMapper.selectWmRtVendorList(wmRtVendor); + } + + @Override + public String checkCodeUnique(WmRtVendor wmRtVendor) { + WmRtVendor rt = wmRtVendorMapper.checkCodeUnique(wmRtVendor); + Long rtId = wmRtVendor.getRtId() ==null?-1L:wmRtVendor.getRtId(); + if(StringUtils.isNotNull(rt) && rt.getRtId().longValue() != rtId.longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 新增供应商退货 + * + * @param wmRtVendor 供应商退货 + * @return 结果 + */ + @Override + public int insertWmRtVendor(WmRtVendor wmRtVendor) + { + wmRtVendor.setCreateTime(DateUtils.getNowDate()); + return wmRtVendorMapper.insertWmRtVendor(wmRtVendor); + } + + /** + * 修改供应商退货 + * + * @param wmRtVendor 供应商退货 + * @return 结果 + */ + @Override + public int updateWmRtVendor(WmRtVendor wmRtVendor) + { + wmRtVendor.setUpdateTime(DateUtils.getNowDate()); + return wmRtVendorMapper.updateWmRtVendor(wmRtVendor); + } + + /** + * 批量删除供应商退货 + * + * @param rtIds 需要删除的供应商退货主键 + * @return 结果 + */ + @Override + public int deleteWmRtVendorByRtIds(Long[] rtIds) + { + return wmRtVendorMapper.deleteWmRtVendorByRtIds(rtIds); + } + + /** + * 删除供应商退货信息 + * + * @param rtId 供应商退货主键 + * @return 结果 + */ + @Override + public int deleteWmRtVendorByRtId(Long rtId) + { + return wmRtVendorMapper.deleteWmRtVendorByRtId(rtId); + } +} diff --git a/ktg-mes/src/main/resources/mapper/wm/WmRtVendorMapper.xml b/ktg-mes/src/main/resources/mapper/wm/WmRtVendorMapper.xml new file mode 100644 index 0000000..9b540e1 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/wm/WmRtVendorMapper.xml @@ -0,0 +1,137 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + select rt_id, rt_code, rt_name, po_code, vendor_id, vendor_code, vendor_name, vendor_nick, rt_date, status, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_rt_vendor + + + + + + + + + + insert into wm_rt_vendor + + rt_code, + rt_name, + po_code, + vendor_id, + vendor_code, + vendor_name, + vendor_nick, + rt_date, + status, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{rtCode}, + #{rtName}, + #{poCode}, + #{vendorId}, + #{vendorCode}, + #{vendorName}, + #{vendorNick}, + #{rtDate}, + #{status}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update wm_rt_vendor + + rt_code = #{rtCode}, + rt_name = #{rtName}, + po_code = #{poCode}, + vendor_id = #{vendorId}, + vendor_code = #{vendorCode}, + vendor_name = #{vendorName}, + vendor_nick = #{vendorNick}, + 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_vendor where rt_id = #{rtId} + + + + delete from wm_rt_vendor where rt_id in + + #{rtId} + + + \ No newline at end of file