From e158ef5dd4db90ba7cfd23731b215c66bd8ff592 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?yinjinlu-pc=5C=E5=B0=B9=E9=87=91=E8=B7=AF?= <411641505@qq.com> Date: Wed, 16 Aug 2023 23:39:24 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E7=AB=AF=E9=87=87=E8=B4=AD?= =?UTF-8?q?=E9=80=80=E8=B4=A7=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mobile/WmRtVendorLineMobController.java | 81 +++++++++++ .../mobile/WmRtVendorMobController.java | 136 ++++++++++++++++++ 2 files changed, 217 insertions(+) create mode 100644 ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmRtVendorLineMobController.java create mode 100644 ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmRtVendorMobController.java diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmRtVendorLineMobController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmRtVendorLineMobController.java new file mode 100644 index 0000000..2a95043 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmRtVendorLineMobController.java @@ -0,0 +1,81 @@ +package com.ktg.mes.wm.controller.mobile; + +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.page.TableDataInfo; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.wm.domain.WmRtVendorLine; +import com.ktg.mes.wm.service.IWmRtVendorLineService; +import io.swagger.annotations.Api; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +@Api("退回供应商行信息") +@RestController +@RequestMapping("/mobile/wm/rtvendorline") +public class WmRtVendorLineMobController extends BaseController { + + @Autowired + private IWmRtVendorLineService wmRtVendorLineService; + + /** + * 查询供应商退货行列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtvendorline:list')") + @GetMapping("/list") + public TableDataInfo list(WmRtVendorLine wmRtVendorLine) + { + startPage(); + List list = wmRtVendorLineService.selectWmRtVendorLineList(wmRtVendorLine); + return getDataTable(list); + } + + /** + * 获取供应商退货行详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtvendorline:query')") + @GetMapping(value = "/{lineId}") + public AjaxResult getInfo(@PathVariable("lineId") Long lineId) + { + return AjaxResult.success(wmRtVendorLineService.selectWmRtVendorLineByLineId(lineId)); + } + + /** + * 新增供应商退货行 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtvendorline:add')") + @Log(title = "供应商退货行", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmRtVendorLine wmRtVendorLine) + { + wmRtVendorLine.setCreateBy(getUsername()); + return toAjax(wmRtVendorLineService.insertWmRtVendorLine(wmRtVendorLine)); + } + + /** + * 修改供应商退货行 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtvendorline:edit')") + @Log(title = "供应商退货行", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmRtVendorLine wmRtVendorLine) + { + return toAjax(wmRtVendorLineService.updateWmRtVendorLine(wmRtVendorLine)); + } + + /** + * 删除供应商退货行 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:rtvendorline:remove')") + @Log(title = "供应商退货行", businessType = BusinessType.DELETE) + @DeleteMapping("/{lineIds}") + public AjaxResult remove(@PathVariable Long[] lineIds) + { + return toAjax(wmRtVendorLineService.deleteWmRtVendorLineByLineIds(lineIds)); + } + +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmRtVendorMobController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmRtVendorMobController.java new file mode 100644 index 0000000..346c7fc --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/mobile/WmRtVendorMobController.java @@ -0,0 +1,136 @@ +package com.ktg.mes.wm.controller.mobile; + +import com.ktg.common.annotation.Log; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.page.TableDataInfo; +import com.ktg.common.enums.BusinessType; +import com.ktg.common.utils.StringUtils; +import com.ktg.mes.md.domain.MdVendor; +import com.ktg.mes.md.service.IMdVendorService; +import com.ktg.mes.wm.domain.WmRtVendor; +import com.ktg.mes.wm.domain.tx.RtVendorTxBean; +import com.ktg.mes.wm.service.IStorageCoreService; +import com.ktg.mes.wm.service.IWmRtVendorService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +@Api("退回供应商") +@RestController +@RequestMapping("/mobile/wm/rtvendor") +public class WmRtVendorMobController extends BaseController { + + @Autowired + private IWmRtVendorService wmRtVendorService; + + @Autowired + private IStorageCoreService storageCoreService; + + @Autowired + private IMdVendorService mdVendorService; + + /** + * 查询供应商退货列表 + */ + @ApiOperation("查询采购退货单据清单") + @PreAuthorize("@ss.hasPermi('mes:wm:rtvendor:list')") + @GetMapping("/list") + public TableDataInfo list(WmRtVendor wmRtVendor) + { + startPage(); + List list = wmRtVendorService.selectWmRtVendorList(wmRtVendor); + return getDataTable(list); + } + + /** + * 获取供应商退货详细信息 + */ + @ApiOperation("查询采购退货单据明细") + @PreAuthorize("@ss.hasPermi('mes:wm:rtvendor:query')") + @GetMapping(value = "/{rtId}") + public AjaxResult getInfo(@PathVariable("rtId") Long rtId) + { + return AjaxResult.success(wmRtVendorService.selectWmRtVendorByRtId(rtId)); + } + + /** + * 新增供应商退货 + */ + @ApiOperation("新增采购退货单") + @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("退货单编号已经存在!"); + } + + if(StringUtils.isNotNull(wmRtVendor.getVendorId())){ + MdVendor vendor = mdVendorService.selectMdVendorByVendorId(wmRtVendor.getVendorId()); + wmRtVendor.setVendorCode(vendor.getVendorCode()); + wmRtVendor.setVendorName(vendor.getVendorName()); + wmRtVendor.setVendorNick(vendor.getVendorNick()); + } + + wmRtVendor.setCreateBy(getUsername()); + return toAjax(wmRtVendorService.insertWmRtVendor(wmRtVendor)); + } + + /** + * 修改供应商退货 + */ + @ApiOperation("编辑采购退货单") + @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("退货单编号已经存在!"); + } + + if(StringUtils.isNotNull(wmRtVendor.getVendorId())){ + MdVendor vendor = mdVendorService.selectMdVendorByVendorId(wmRtVendor.getVendorId()); + wmRtVendor.setVendorCode(vendor.getVendorCode()); + wmRtVendor.setVendorName(vendor.getVendorName()); + wmRtVendor.setVendorNick(vendor.getVendorNick()); + } + + return toAjax(wmRtVendorService.updateWmRtVendor(wmRtVendor)); + } + + + /** + * 执行退货 + */ + @ApiOperation("执行退货") + @PreAuthorize("@ss.hasPermi('mes:wm:rtvendor:edit')") + @Log(title = "供应商退货单", businessType = BusinessType.UPDATE) + @Transactional + @PutMapping("/{rtId}") + public AjaxResult execute(@PathVariable Long rtId){ + //判断单据状态 + WmRtVendor wmRtVendor = wmRtVendorService.selectWmRtVendorByRtId(rtId); + + //构造事务Bean + List beans = wmRtVendorService.getTxBeans(rtId); + + //调用库存核心 + storageCoreService.processRtVendor(beans); + + //更新单据状态 + WmRtVendor rtVendor = wmRtVendorService.selectWmRtVendorByRtId(rtId); + rtVendor.setStatus(UserConstants.ORDER_STATUS_FINISHED); + wmRtVendorService.updateWmRtVendor(rtVendor); + + return AjaxResult.success(); + } +}