parent
bcb57874eb
commit
890f8d3ba3
@ -0,0 +1,105 @@
|
||||
package com.hw.wms.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
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.hw.common.log.annotation.Log;
|
||||
import com.hw.common.log.enums.BusinessType;
|
||||
import com.hw.common.security.annotation.RequiresPermissions;
|
||||
import com.hw.wms.domain.WmsStockTotal;
|
||||
import com.hw.wms.service.IWmsStockTotalService;
|
||||
import com.hw.common.core.web.controller.BaseController;
|
||||
import com.hw.common.core.web.domain.AjaxResult;
|
||||
import com.hw.common.core.utils.poi.ExcelUtil;
|
||||
import com.hw.common.core.web.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 原材料库存Controller
|
||||
*
|
||||
* @author xins
|
||||
* @date 2024-03-14
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/stocktotal")
|
||||
public class WmsStockTotalController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IWmsStockTotalService wmsStockTotalService;
|
||||
|
||||
/**
|
||||
* 查询原材料库存列表
|
||||
*/
|
||||
@RequiresPermissions("wms:stocktotal:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(WmsStockTotal wmsStockTotal)
|
||||
{
|
||||
startPage();
|
||||
List<WmsStockTotal> list = wmsStockTotalService.selectWmsStockTotalList(wmsStockTotal);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出原材料库存列表
|
||||
*/
|
||||
@RequiresPermissions("wms:stocktotal:export")
|
||||
@Log(title = "原材料库存", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, WmsStockTotal wmsStockTotal)
|
||||
{
|
||||
List<WmsStockTotal> list = wmsStockTotalService.selectWmsStockTotalList(wmsStockTotal);
|
||||
ExcelUtil<WmsStockTotal> util = new ExcelUtil<WmsStockTotal>(WmsStockTotal.class);
|
||||
util.exportExcel(response, list, "原材料库存数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取原材料库存详细信息
|
||||
*/
|
||||
@RequiresPermissions("wms:stocktotal:query")
|
||||
@GetMapping(value = "/{stockTotalId}")
|
||||
public AjaxResult getInfo(@PathVariable("stockTotalId") Long stockTotalId)
|
||||
{
|
||||
return success(wmsStockTotalService.selectWmsStockTotalByStockTotalId(stockTotalId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增原材料库存
|
||||
*/
|
||||
@RequiresPermissions("wms:stocktotal:add")
|
||||
@Log(title = "原材料库存", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody WmsStockTotal wmsStockTotal)
|
||||
{
|
||||
return toAjax(wmsStockTotalService.insertWmsStockTotal(wmsStockTotal));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改原材料库存
|
||||
*/
|
||||
@RequiresPermissions("wms:stocktotal:edit")
|
||||
@Log(title = "原材料库存", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody WmsStockTotal wmsStockTotal)
|
||||
{
|
||||
return toAjax(wmsStockTotalService.updateWmsStockTotal(wmsStockTotal));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除原材料库存
|
||||
*/
|
||||
@RequiresPermissions("wms:stocktotal:remove")
|
||||
@Log(title = "原材料库存", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{stockTotalIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] stockTotalIds)
|
||||
{
|
||||
return toAjax(wmsStockTotalService.deleteWmsStockTotalByStockTotalIds(stockTotalIds));
|
||||
}
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
package com.hw.wms.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.hw.wms.domain.WmsStockTotal;
|
||||
|
||||
/**
|
||||
* 原材料库存Mapper接口
|
||||
*
|
||||
* @author xins
|
||||
* @date 2024-03-14
|
||||
*/
|
||||
public interface WmsStockTotalMapper
|
||||
{
|
||||
/**
|
||||
* 查询原材料库存
|
||||
*
|
||||
* @param stockTotalId 原材料库存主键
|
||||
* @return 原材料库存
|
||||
*/
|
||||
public WmsStockTotal selectWmsStockTotalByStockTotalId(Long stockTotalId);
|
||||
|
||||
/**
|
||||
* 查询原材料库存列表
|
||||
*
|
||||
* @param wmsStockTotal 原材料库存
|
||||
* @return 原材料库存集合
|
||||
*/
|
||||
public List<WmsStockTotal> selectWmsStockTotalList(WmsStockTotal wmsStockTotal);
|
||||
|
||||
/**
|
||||
* 新增原材料库存
|
||||
*
|
||||
* @param wmsStockTotal 原材料库存
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertWmsStockTotal(WmsStockTotal wmsStockTotal);
|
||||
|
||||
/**
|
||||
* 修改原材料库存
|
||||
*
|
||||
* @param wmsStockTotal 原材料库存
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateWmsStockTotal(WmsStockTotal wmsStockTotal);
|
||||
|
||||
/**
|
||||
* 删除原材料库存
|
||||
*
|
||||
* @param stockTotalId 原材料库存主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteWmsStockTotalByStockTotalId(Long stockTotalId);
|
||||
|
||||
/**
|
||||
* 批量删除原材料库存
|
||||
*
|
||||
* @param stockTotalIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteWmsStockTotalByStockTotalIds(Long[] stockTotalIds);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询总库存列表
|
||||
*
|
||||
* @param wmsStockTotal 总库存
|
||||
* @return 总库存集合
|
||||
*/
|
||||
public List<WmsStockTotal> selectWmsStockTotalJoinList(WmsStockTotal wmsStockTotal);
|
||||
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
package com.hw.wms.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.hw.wms.domain.WmsStockTotal;
|
||||
|
||||
/**
|
||||
* 原材料库存Service接口
|
||||
*
|
||||
* @author xins
|
||||
* @date 2024-03-14
|
||||
*/
|
||||
public interface IWmsStockTotalService
|
||||
{
|
||||
/**
|
||||
* 查询原材料库存
|
||||
*
|
||||
* @param stockTotalId 原材料库存主键
|
||||
* @return 原材料库存
|
||||
*/
|
||||
public WmsStockTotal selectWmsStockTotalByStockTotalId(Long stockTotalId);
|
||||
|
||||
/**
|
||||
* 查询原材料库存列表
|
||||
*
|
||||
* @param wmsStockTotal 原材料库存
|
||||
* @return 原材料库存集合
|
||||
*/
|
||||
public List<WmsStockTotal> selectWmsStockTotalList(WmsStockTotal wmsStockTotal);
|
||||
|
||||
/**
|
||||
* 新增原材料库存
|
||||
*
|
||||
* @param wmsStockTotal 原材料库存
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertWmsStockTotal(WmsStockTotal wmsStockTotal);
|
||||
|
||||
/**
|
||||
* 修改原材料库存
|
||||
*
|
||||
* @param wmsStockTotal 原材料库存
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateWmsStockTotal(WmsStockTotal wmsStockTotal);
|
||||
|
||||
/**
|
||||
* 批量删除原材料库存
|
||||
*
|
||||
* @param stockTotalIds 需要删除的原材料库存主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteWmsStockTotalByStockTotalIds(Long[] stockTotalIds);
|
||||
|
||||
/**
|
||||
* 删除原材料库存信息
|
||||
*
|
||||
* @param stockTotalId 原材料库存主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteWmsStockTotalByStockTotalId(Long stockTotalId);
|
||||
|
||||
|
||||
/**
|
||||
* 查询总库存列表,Join material
|
||||
*
|
||||
* @param wmsStockTotal 总库存
|
||||
* @return 总库存
|
||||
*/
|
||||
public List<WmsStockTotal> selectWmsStockTotalJoinList(WmsStockTotal wmsStockTotal);
|
||||
}
|
@ -0,0 +1,113 @@
|
||||
package com.hw.wms.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.hw.wms.mapper.WmsStockTotalMapper;
|
||||
import com.hw.wms.domain.WmsStockTotal;
|
||||
import com.hw.wms.service.IWmsStockTotalService;
|
||||
|
||||
/**
|
||||
* 原材料库存Service业务层处理
|
||||
*
|
||||
* @author xins
|
||||
* @date 2024-03-14
|
||||
*/
|
||||
@Service
|
||||
public class WmsStockTotalServiceImpl implements IWmsStockTotalService
|
||||
{
|
||||
@Autowired
|
||||
private WmsStockTotalMapper wmsStockTotalMapper;
|
||||
|
||||
/**
|
||||
* 查询原材料库存
|
||||
*
|
||||
* @param stockTotalId 原材料库存主键
|
||||
* @return 原材料库存
|
||||
*/
|
||||
@Override
|
||||
public WmsStockTotal selectWmsStockTotalByStockTotalId(Long stockTotalId)
|
||||
{
|
||||
return wmsStockTotalMapper.selectWmsStockTotalByStockTotalId(stockTotalId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询原材料库存列表
|
||||
*
|
||||
* @param wmsStockTotal 原材料库存
|
||||
* @return 原材料库存
|
||||
*/
|
||||
@Override
|
||||
public List<WmsStockTotal> selectWmsStockTotalList(WmsStockTotal wmsStockTotal)
|
||||
{
|
||||
return wmsStockTotalMapper.selectWmsStockTotalList(wmsStockTotal);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增原材料库存
|
||||
*
|
||||
* @param wmsStockTotal 原材料库存
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertWmsStockTotal(WmsStockTotal wmsStockTotal)
|
||||
{
|
||||
return wmsStockTotalMapper.insertWmsStockTotal(wmsStockTotal);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改原材料库存
|
||||
*
|
||||
* @param wmsStockTotal 原材料库存
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateWmsStockTotal(WmsStockTotal wmsStockTotal)
|
||||
{
|
||||
return wmsStockTotalMapper.updateWmsStockTotal(wmsStockTotal);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除原材料库存
|
||||
*
|
||||
* @param stockTotalIds 需要删除的原材料库存主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteWmsStockTotalByStockTotalIds(Long[] stockTotalIds)
|
||||
{
|
||||
return wmsStockTotalMapper.deleteWmsStockTotalByStockTotalIds(stockTotalIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除原材料库存信息
|
||||
*
|
||||
* @param stockTotalId 原材料库存主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteWmsStockTotalByStockTotalId(Long stockTotalId)
|
||||
{
|
||||
return wmsStockTotalMapper.deleteWmsStockTotalByStockTotalId(stockTotalId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询总库存列表,Join material
|
||||
*
|
||||
* @param wmsStockTotal 总库存
|
||||
* @return 总库存
|
||||
*/
|
||||
@Override
|
||||
public List<WmsStockTotal> selectWmsStockTotalJoinList(WmsStockTotal wmsStockTotal)
|
||||
{
|
||||
//todo:还需要计算锁库的数量
|
||||
return wmsStockTotalMapper.selectWmsStockTotalJoinList(wmsStockTotal);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,136 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.hw.wms.mapper.WmsStockTotalMapper">
|
||||
|
||||
<resultMap type="WmsStockTotal" id="WmsStockTotalResult">
|
||||
<result property="stockTotalId" column="stock_total_id" />
|
||||
<result property="warehouseId" column="warehouse_id" />
|
||||
<result property="warehouseFloor" column="warehouse_floor" />
|
||||
<result property="stockType" column="stock_type" />
|
||||
<result property="materialId" column="material_id" />
|
||||
<result property="totalAmount" column="total_amount" />
|
||||
<result property="frozenAmount" column="frozen_amount" />
|
||||
<result property="occupyAmount" column="occupy_amount" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createDate" column="create_date" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateDate" column="update_date" />
|
||||
<result property="activeFlag" column="active_flag" />
|
||||
<result property="materialCode" column="material_code" />
|
||||
<result property="materialName" column="material_name" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectWmsStockTotalVo">
|
||||
select stock_total_id, warehouse_id, warehouse_floor, stock_type, material_id, total_amount, frozen_amount, occupy_amount, create_by, create_date, update_by, update_date, active_flag from wms_stock_total
|
||||
</sql>
|
||||
|
||||
<select id="selectWmsStockTotalList" parameterType="WmsStockTotal" resultMap="WmsStockTotalResult">
|
||||
<include refid="selectWmsStockTotalVo"/>
|
||||
<where>
|
||||
<if test="warehouseId != null "> and warehouse_id = #{warehouseId}</if>
|
||||
<if test="warehouseFloor != null "> and warehouse_floor = #{warehouseFloor}</if>
|
||||
<if test="stockType != null and stockType != ''"> and stock_type = #{stockType}</if>
|
||||
<if test="materialId != null "> and material_id = #{materialId}</if>
|
||||
<if test="totalAmount != null "> and total_amount = #{totalAmount}</if>
|
||||
<if test="frozenAmount != null "> and frozen_amount = #{frozenAmount}</if>
|
||||
<if test="occupyAmount != null "> and occupy_amount = #{occupyAmount}</if>
|
||||
<if test="createDate != null "> and create_date = #{createDate}</if>
|
||||
<if test="updateDate != null "> and update_date = #{updateDate}</if>
|
||||
<if test="activeFlag != null and activeFlag != ''"> and active_flag = #{activeFlag}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectWmsStockTotalByStockTotalId" parameterType="Long" resultMap="WmsStockTotalResult">
|
||||
<include refid="selectWmsStockTotalVo"/>
|
||||
where stock_total_id = #{stockTotalId}
|
||||
</select>
|
||||
|
||||
<insert id="insertWmsStockTotal" parameterType="WmsStockTotal" useGeneratedKeys="true" keyProperty="stockTotalId">
|
||||
insert into wms_stock_total
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="warehouseId != null">warehouse_id,</if>
|
||||
<if test="warehouseFloor != null">warehouse_floor,</if>
|
||||
<if test="stockType != null and stockType != ''">stock_type,</if>
|
||||
<if test="materialId != null">material_id,</if>
|
||||
<if test="totalAmount != null">total_amount,</if>
|
||||
<if test="frozenAmount != null">frozen_amount,</if>
|
||||
<if test="occupyAmount != null">occupy_amount,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createDate != null">create_date,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateDate != null">update_date,</if>
|
||||
<if test="activeFlag != null">active_flag,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="warehouseId != null">#{warehouseId},</if>
|
||||
<if test="warehouseFloor != null">#{warehouseFloor},</if>
|
||||
<if test="stockType != null and stockType != ''">#{stockType},</if>
|
||||
<if test="materialId != null">#{materialId},</if>
|
||||
<if test="totalAmount != null">#{totalAmount},</if>
|
||||
<if test="frozenAmount != null">#{frozenAmount},</if>
|
||||
<if test="occupyAmount != null">#{occupyAmount},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createDate != null">#{createDate},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateDate != null">#{updateDate},</if>
|
||||
<if test="activeFlag != null">#{activeFlag},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateWmsStockTotal" parameterType="WmsStockTotal">
|
||||
update wms_stock_total
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="warehouseId != null">warehouse_id = #{warehouseId},</if>
|
||||
<if test="warehouseFloor != null">warehouse_floor = #{warehouseFloor},</if>
|
||||
<if test="stockType != null and stockType != ''">stock_type = #{stockType},</if>
|
||||
<if test="materialId != null">material_id = #{materialId},</if>
|
||||
<if test="totalAmount != null">total_amount = #{totalAmount},</if>
|
||||
<if test="frozenAmount != null">frozen_amount = #{frozenAmount},</if>
|
||||
<if test="occupyAmount != null">occupy_amount = #{occupyAmount},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createDate != null">create_date = #{createDate},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateDate != null">update_date = #{updateDate},</if>
|
||||
<if test="activeFlag != null">active_flag = #{activeFlag},</if>
|
||||
</trim>
|
||||
where stock_total_id = #{stockTotalId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteWmsStockTotalByStockTotalId" parameterType="Long">
|
||||
delete from wms_stock_total where stock_total_id = #{stockTotalId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteWmsStockTotalByStockTotalIds" parameterType="String">
|
||||
delete from wms_stock_total where stock_total_id in
|
||||
<foreach item="stockTotalId" collection="array" open="(" separator="," close=")">
|
||||
#{stockTotalId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<select id="selectWmsStockTotalJoinList" parameterType="WmsStockTotal" resultMap="WmsStockTotalResult">
|
||||
select wst.stock_total_id, wst.warehouse_id, wst.warehouse_floor, wst.stock_type, wst.material_id,
|
||||
wst.total_amount, wst.frozen_amount, wst.occupy_amount,
|
||||
mbmi.material_code,mbmi.material_name
|
||||
from wms_stock_total wst left join mes_base_material_info mbmi on wst.material_id = mbmi.material_id
|
||||
|
||||
<where>
|
||||
<if test="warehouseId != null "> and wst.warehouse_id = #{warehouseId}</if>
|
||||
<if test="warehouseFloor != null "> and wst.warehouse_floor = #{warehouseFloor}</if>
|
||||
<if test="stockType != null and stockType != ''"> and wst.stock_type = #{stockType}</if>
|
||||
<if test="materialId != null "> and wst.material_id = #{materialId}</if>
|
||||
<if test="materialName != null and materialName != ''">and mbmi.material_name like concat('%', #{materialName},
|
||||
'%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue