feat(入库计划): 查询入库计划编码是否重复

This commit is contained in:
LJW 2024-11-14 16:54:03 +08:00
parent 7fbd042688
commit 6d0151cee1
4 changed files with 36 additions and 17 deletions

View File

@ -2,6 +2,7 @@ package com.ktg.mes.wm.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@ -23,14 +24,13 @@ import com.ktg.common.core.page.TableDataInfo;
/**
* 入库计划Controller
*
*
* @author yinjinlu
* @date 2024-10-31
*/
@RestController
@RequestMapping("/wm/PLAN")
public class WmsInPlanController extends BaseController
{
public class WmsInPlanController extends BaseController {
@Autowired
private IWmsInPlanService wmsInPlanService;
@ -39,8 +39,7 @@ public class WmsInPlanController extends BaseController
*/
@PreAuthorize("@ss.hasPermi('wm:PLAN:list')")
@GetMapping("/list")
public TableDataInfo list(WmsInPlan wmsInPlan)
{
public TableDataInfo list(WmsInPlan wmsInPlan) {
startPage();
List<WmsInPlan> list = wmsInPlanService.selectWmsInPlanList(wmsInPlan);
return getDataTable(list);
@ -52,8 +51,7 @@ public class WmsInPlanController extends BaseController
@PreAuthorize("@ss.hasPermi('wm:PLAN:export')")
@Log(title = "入库计划", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, WmsInPlan wmsInPlan)
{
public void export(HttpServletResponse response, WmsInPlan wmsInPlan) {
List<WmsInPlan> list = wmsInPlanService.selectWmsInPlanList(wmsInPlan);
ExcelUtil<WmsInPlan> util = new ExcelUtil<WmsInPlan>(WmsInPlan.class);
util.exportExcel(response, list, "入库计划数据");
@ -64,19 +62,23 @@ public class WmsInPlanController extends BaseController
*/
@PreAuthorize("@ss.hasPermi('wm:PLAN:query')")
@GetMapping(value = "/{planId}")
public AjaxResult getInfo(@PathVariable("planId") String planId)
{
public AjaxResult getInfo(@PathVariable("planId") String planId) {
return AjaxResult.success(wmsInPlanService.selectWmsInPlanByPlanId(planId));
}
@PreAuthorize("@ss.hasPermi('wm:PLAN:query')")
@GetMapping(value = "/isDuplicatePlanCode/{planCode}")
public AjaxResult isDuplicatePlanCode(@PathVariable("planCode") String planCode) {
return AjaxResult.success(wmsInPlanService.isDuplicatePlanCode(planCode));
}
/**
* 新增入库计划
*/
@PreAuthorize("@ss.hasPermi('wm:PLAN:add')")
@Log(title = "入库计划", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WmsInPlan wmsInPlan)
{
public AjaxResult add(@RequestBody WmsInPlan wmsInPlan) {
return toAjax(wmsInPlanService.insertWmsInPlan(wmsInPlan));
}
@ -86,8 +88,7 @@ public class WmsInPlanController extends BaseController
@PreAuthorize("@ss.hasPermi('wm:PLAN:edit')")
@Log(title = "入库计划", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WmsInPlan wmsInPlan)
{
public AjaxResult edit(@RequestBody WmsInPlan wmsInPlan) {
return toAjax(wmsInPlanService.updateWmsInPlan(wmsInPlan));
}
@ -96,9 +97,8 @@ public class WmsInPlanController extends BaseController
*/
@PreAuthorize("@ss.hasPermi('wm:PLAN:remove')")
@Log(title = "入库计划", businessType = BusinessType.DELETE)
@DeleteMapping("/{planIds}")
public AjaxResult remove(@PathVariable String[] planIds)
{
@DeleteMapping("/{planIds}")
public AjaxResult remove(@PathVariable String[] planIds) {
return toAjax(wmsInPlanService.deleteWmsInPlanByPlanIds(planIds));
}
}

View File

@ -86,4 +86,11 @@ public interface WmsInPlanMapper
public int deleteWmsInPlanDetailsByPlanId(String planId);
WmsInPlan selectWmsInPlanByPlanCode(String planCode);
/**
* 判断计划ID是否有重复
* @param planCode 计划ID
* @return 结果
*/
public Boolean isDuplicatePlanCode(String planCode);
}

View File

@ -61,4 +61,10 @@ public interface IWmsInPlanService
*/
public int deleteWmsInPlanByPlanId(String planId);
/**
* 入库计划ID是否重复
* @param planCode 入库计划ID
* @return 是否重复
*/
public Boolean isDuplicatePlanCode(String planCode);
}

View File

@ -88,7 +88,6 @@
PLAN_CODE,
PLAN_TYPE_ID
from WMS_IN_PLAN
order by CREATE_TIME desc
</sql>
<select id="selectWmsInPlanList" parameterType="WmsInPlan" resultMap="WmsInPlanResult">
@ -124,6 +123,7 @@
<if test="planCode != null and planCode != ''">and PLAN_CODE = #{planCode}</if>
<if test="planTypeId != null and planTypeId != ''">and PLAN_TYPE_ID = #{planTypeId}</if>
</where>
order by CREATE_TIME desc
</select>
<select id="selectWmsInPlanByPlanId" parameterType="String" resultMap="WmsInPlanWmsInPlanDetailsResult">
@ -355,4 +355,10 @@
#{item.updateTime}, #{item.isActivy}, #{item.isDelete})
</foreach>
</insert>
<select id="isDuplicatePlanCode" parameterType="String" resultType="boolean">
SELECT COUNT(1)
FROM WMS_IN_PLAN
WHERE PLAN_CODE = #{value}
</select>
</mapper>