销售退货

This commit is contained in:
DESKTOP-J7ED0MB\yinjinlu 2022-10-29 23:00:17 +08:00
parent 662bc35be2
commit 422b63688d

View File

@ -2,6 +2,14 @@ package com.ktg.mes.wm.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ktg.common.utils.StringUtils;
import com.ktg.mes.wm.domain.WmStorageArea;
import com.ktg.mes.wm.domain.WmStorageLocation;
import com.ktg.mes.wm.domain.WmWarehouse;
import com.ktg.mes.wm.service.IWmStorageAreaService;
import com.ktg.mes.wm.service.IWmStorageLocationService;
import com.ktg.mes.wm.service.IWmWarehouseService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@ -34,6 +42,15 @@ public class WmRtSalseLineController extends BaseController
@Autowired
private IWmRtSalseLineService wmRtSalseLineService;
@Autowired
private IWmWarehouseService wmWarehouseService;
@Autowired
private IWmStorageLocationService wmStorageLocationService;
@Autowired
private IWmStorageAreaService wmStorageAreaService;
/**
* 查询产品销售退货行列表
*/
@ -77,6 +94,21 @@ public class WmRtSalseLineController extends BaseController
@PostMapping
public AjaxResult add(@RequestBody WmRtSalseLine wmRtSalseLine)
{
if(StringUtils.isNotNull(wmRtSalseLine.getWarehouseId())){
WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmRtSalseLine.getWarehouseId());
wmRtSalseLine.setWarehouseCode(warehouse.getWarehouseCode());
wmRtSalseLine.setWarehouseName(warehouse.getWarehouseName());
}
if(StringUtils.isNotNull(wmRtSalseLine.getLocationId())){
WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmRtSalseLine.getLocationId());
wmRtSalseLine.setLocationCode(location.getLocationCode());
wmRtSalseLine.setLocationName(location.getLocationName());
}
if(StringUtils.isNotNull(wmRtSalseLine.getAreaId())){
WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmRtSalseLine.getAreaId());
wmRtSalseLine.setAreaCode(area.getAreaCode());
wmRtSalseLine.setAreaName(area.getAreaName());
}
return toAjax(wmRtSalseLineService.insertWmRtSalseLine(wmRtSalseLine));
}
@ -88,6 +120,21 @@ public class WmRtSalseLineController extends BaseController
@PutMapping
public AjaxResult edit(@RequestBody WmRtSalseLine wmRtSalseLine)
{
if(StringUtils.isNotNull(wmRtSalseLine.getWarehouseId())){
WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmRtSalseLine.getWarehouseId());
wmRtSalseLine.setWarehouseCode(warehouse.getWarehouseCode());
wmRtSalseLine.setWarehouseName(warehouse.getWarehouseName());
}
if(StringUtils.isNotNull(wmRtSalseLine.getLocationId())){
WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmRtSalseLine.getLocationId());
wmRtSalseLine.setLocationCode(location.getLocationCode());
wmRtSalseLine.setLocationName(location.getLocationName());
}
if(StringUtils.isNotNull(wmRtSalseLine.getAreaId())){
WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmRtSalseLine.getAreaId());
wmRtSalseLine.setAreaCode(area.getAreaCode());
wmRtSalseLine.setAreaName(area.getAreaName());
}
return toAjax(wmRtSalseLineService.updateWmRtSalseLine(wmRtSalseLine));
}