销售出库
This commit is contained in:
parent
1ff7b3fb3e
commit
b1da8396a0
@ -2,6 +2,13 @@ package com.ktg.mes.wm.controller;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.ktg.common.constant.UserConstants;
|
||||||
|
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.*;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
@ -17,7 +24,6 @@ import com.ktg.common.core.controller.BaseController;
|
|||||||
import com.ktg.common.core.domain.AjaxResult;
|
import com.ktg.common.core.domain.AjaxResult;
|
||||||
import com.ktg.common.enums.BusinessType;
|
import com.ktg.common.enums.BusinessType;
|
||||||
import com.ktg.mes.wm.domain.WmProductSalse;
|
import com.ktg.mes.wm.domain.WmProductSalse;
|
||||||
import com.ktg.mes.wm.service.IWmProductSalseService;
|
|
||||||
import com.ktg.common.utils.poi.ExcelUtil;
|
import com.ktg.common.utils.poi.ExcelUtil;
|
||||||
import com.ktg.common.core.page.TableDataInfo;
|
import com.ktg.common.core.page.TableDataInfo;
|
||||||
|
|
||||||
@ -34,6 +40,18 @@ public class WmProductSalseController extends BaseController
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IWmProductSalseService wmProductSalseService;
|
private IWmProductSalseService wmProductSalseService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IWmWarehouseService wmWarehouseService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IWmStorageLocationService wmStorageLocationService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IWmStorageAreaService wmStorageAreaService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IStorageCoreService storageCoreService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询销售出库单列表
|
* 查询销售出库单列表
|
||||||
*/
|
*/
|
||||||
@ -77,6 +95,24 @@ public class WmProductSalseController extends BaseController
|
|||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@RequestBody WmProductSalse wmProductSalse)
|
public AjaxResult add(@RequestBody WmProductSalse wmProductSalse)
|
||||||
{
|
{
|
||||||
|
if(UserConstants.NOT_UNIQUE.equals(wmProductSalseService.checkUnique(wmProductSalse))){
|
||||||
|
return AjaxResult.error("出库单编号已存在!");
|
||||||
|
}
|
||||||
|
if(StringUtils.isNotNull(wmProductSalse.getWarehouseId())){
|
||||||
|
WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmProductSalse.getWarehouseId());
|
||||||
|
wmProductSalse.setWarehouseCode(warehouse.getWarehouseCode());
|
||||||
|
wmProductSalse.setWarehouseName(warehouse.getWarehouseName());
|
||||||
|
}
|
||||||
|
if(StringUtils.isNotNull(wmProductSalse.getLocationId())){
|
||||||
|
WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmProductSalse.getLocationId());
|
||||||
|
wmProductSalse.setLocationCode(location.getLocationCode());
|
||||||
|
wmProductSalse.setLocationName(location.getLocationName());
|
||||||
|
}
|
||||||
|
if(StringUtils.isNotNull(wmProductSalse.getAreaId())){
|
||||||
|
WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmProductSalse.getAreaId());
|
||||||
|
wmProductSalse.setAreaCode(area.getAreaCode());
|
||||||
|
wmProductSalse.setAreaName(area.getAreaName());
|
||||||
|
}
|
||||||
return toAjax(wmProductSalseService.insertWmProductSalse(wmProductSalse));
|
return toAjax(wmProductSalseService.insertWmProductSalse(wmProductSalse));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,6 +124,24 @@ public class WmProductSalseController extends BaseController
|
|||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@RequestBody WmProductSalse wmProductSalse)
|
public AjaxResult edit(@RequestBody WmProductSalse wmProductSalse)
|
||||||
{
|
{
|
||||||
|
if(UserConstants.NOT_UNIQUE.equals(wmProductSalseService.checkUnique(wmProductSalse))){
|
||||||
|
return AjaxResult.error("出库单编号已存在!");
|
||||||
|
}
|
||||||
|
if(StringUtils.isNotNull(wmProductSalse.getWarehouseId())){
|
||||||
|
WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmProductSalse.getWarehouseId());
|
||||||
|
wmProductSalse.setWarehouseCode(warehouse.getWarehouseCode());
|
||||||
|
wmProductSalse.setWarehouseName(warehouse.getWarehouseName());
|
||||||
|
}
|
||||||
|
if(StringUtils.isNotNull(wmProductSalse.getLocationId())){
|
||||||
|
WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmProductSalse.getLocationId());
|
||||||
|
wmProductSalse.setLocationCode(location.getLocationCode());
|
||||||
|
wmProductSalse.setLocationName(location.getLocationName());
|
||||||
|
}
|
||||||
|
if(StringUtils.isNotNull(wmProductSalse.getAreaId())){
|
||||||
|
WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmProductSalse.getAreaId());
|
||||||
|
wmProductSalse.setAreaCode(area.getAreaCode());
|
||||||
|
wmProductSalse.setAreaName(area.getAreaName());
|
||||||
|
}
|
||||||
return toAjax(wmProductSalseService.updateWmProductSalse(wmProductSalse));
|
return toAjax(wmProductSalseService.updateWmProductSalse(wmProductSalse));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,6 +27,13 @@ public interface WmProductSalseMapper
|
|||||||
*/
|
*/
|
||||||
public List<WmProductSalse> selectWmProductSalseList(WmProductSalse wmProductSalse);
|
public List<WmProductSalse> selectWmProductSalseList(WmProductSalse wmProductSalse);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查编号唯一性
|
||||||
|
* @param wmProductSalse
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public WmProductSalse checkUnique(WmProductSalse wmProductSalse);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增销售出库单
|
* 新增销售出库单
|
||||||
*
|
*
|
||||||
|
@ -27,6 +27,13 @@ public interface IWmProductSalseService
|
|||||||
*/
|
*/
|
||||||
public List<WmProductSalse> selectWmProductSalseList(WmProductSalse wmProductSalse);
|
public List<WmProductSalse> selectWmProductSalseList(WmProductSalse wmProductSalse);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查编号唯一性
|
||||||
|
* @param wmProductSalse
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String checkUnique(WmProductSalse wmProductSalse);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增销售出库单
|
* 新增销售出库单
|
||||||
*
|
*
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
package com.ktg.mes.wm.service.impl;
|
package com.ktg.mes.wm.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.ktg.common.constant.UserConstants;
|
||||||
import com.ktg.common.utils.DateUtils;
|
import com.ktg.common.utils.DateUtils;
|
||||||
|
import com.ktg.common.utils.StringUtils;
|
||||||
|
import org.apache.catalina.User;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.ktg.mes.wm.mapper.WmProductSalseMapper;
|
import com.ktg.mes.wm.mapper.WmProductSalseMapper;
|
||||||
@ -44,6 +48,16 @@ public class WmProductSalseServiceImpl implements IWmProductSalseService
|
|||||||
return wmProductSalseMapper.selectWmProductSalseList(wmProductSalse);
|
return wmProductSalseMapper.selectWmProductSalseList(wmProductSalse);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String checkUnique(WmProductSalse wmProductSalse) {
|
||||||
|
WmProductSalse salse = wmProductSalseMapper.checkUnique(wmProductSalse);
|
||||||
|
Long salseId = wmProductSalse.getSalseId() ==null? -1L:wmProductSalse.getSalseId();
|
||||||
|
if(StringUtils.isNotNull(salse) && salseId.longValue() != salse.getSalseId().longValue()){
|
||||||
|
return UserConstants.NOT_UNIQUE;
|
||||||
|
}
|
||||||
|
return UserConstants.UNIQUE;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增销售出库单
|
* 新增销售出库单
|
||||||
*
|
*
|
||||||
|
@ -72,6 +72,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
where salse_id = #{salseId}
|
where salse_id = #{salseId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="checkUnique" parameterMap="WmProductSalse" resultMap="WmProductSalseResult">
|
||||||
|
<include refid="selectWmProductSalseVo"/>
|
||||||
|
where salse_code = #{salseCode}
|
||||||
|
</select>
|
||||||
|
|
||||||
<insert id="insertWmProductSalse" parameterType="WmProductSalse" useGeneratedKeys="true" keyProperty="salseId">
|
<insert id="insertWmProductSalse" parameterType="WmProductSalse" useGeneratedKeys="true" keyProperty="salseId">
|
||||||
insert into wm_product_salse
|
insert into wm_product_salse
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
Loading…
Reference in New Issue
Block a user