1.4.2 恢复WMS删除文件

master
xins 10 months ago
parent 17b03a251f
commit 8d36ef07d7

@ -0,0 +1,108 @@
package com.hw.wms.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.hw.common.core.annotation.Excel;
import com.hw.common.core.web.domain.BaseEntity;
/**
* wms_warehouse_material
*
* @author xins
* @date 2024-01-09
*/
public class WmsWarehouseMaterial extends BaseEntity
{
private static final long serialVersionUID = 1L;
private Long warehouseMaterialId;
/** 仓库ID */
private Long warehouseId;
/** 库位编码;单独需要针对库位设置的,后续扩展使用 */
private String locationCode;
/** 存储类型(1、物料2、物料类型);先支持物料 */
private String storageType;
/** 根据存储类型对应各自表的主键 */
private Long storageId;
private String materialCode;
private String materialName;
public Long getWarehouseMaterialId() {
return warehouseMaterialId;
}
public void setWarehouseMaterialId(Long warehouseMaterialId) {
this.warehouseMaterialId = warehouseMaterialId;
}
public void setWarehouseId(Long warehouseId)
{
this.warehouseId = warehouseId;
}
public Long getWarehouseId()
{
return warehouseId;
}
public void setLocationCode(String locationCode)
{
this.locationCode = locationCode;
}
public String getLocationCode()
{
return locationCode;
}
public void setStorageType(String storageType)
{
this.storageType = storageType;
}
public String getStorageType()
{
return storageType;
}
public void setStorageId(Long storageId)
{
this.storageId = storageId;
}
public Long getStorageId()
{
return storageId;
}
public String getMaterialCode() {
return materialCode;
}
public void setMaterialCode(String materialCode) {
this.materialCode = materialCode;
}
public String getMaterialName() {
return materialName;
}
public void setMaterialName(String materialName) {
this.materialName = materialName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("warehouseId", getWarehouseId())
.append("locationCode", getLocationCode())
.append("storageType", getStorageType())
.append("storageId", getStorageId())
.append("createTime", getCreateTime())
.append("createBy", getCreateBy())
.toString();
}
}

@ -0,0 +1,80 @@
package com.hw.wms.mapper;
import java.util.List;
import com.hw.wms.domain.WmsWarehouseMaterial;
/**
* Mapper
*
* @author xins
* @date 2024-01-09
*/
public interface WmsWarehouseMaterialMapper {
/**
*
*
* @param warehouseId
* @return
*/
public WmsWarehouseMaterial selectWmsWarehouseMaterialByWarehouseId(Long warehouseId);
/**
*
*
* @param wmsWarehouseMaterial
* @return
*/
public List<WmsWarehouseMaterial> selectWmsWarehouseMaterialList(WmsWarehouseMaterial wmsWarehouseMaterial);
/**
*
*
* @param wmsWarehouseMaterial
* @return
*/
public int insertWmsWarehouseMaterial(WmsWarehouseMaterial wmsWarehouseMaterial);
/**
*
*
* @param wmsWarehouseMaterial
* @return
*/
public int updateWmsWarehouseMaterial(WmsWarehouseMaterial wmsWarehouseMaterial);
/**
*
*
* @param warehouseId
* @return
*/
public int deleteWmsWarehouseMaterialByWarehouseMaterialId(Long warehouseId);
/**
*
*
* @param warehouseIds
* @return
*/
public int deleteWmsWarehouseMaterialByWarehouseMaterialIds(Long[] warehouseIds);
/**
* ,Join material
*
* @param wmsWarehouseMaterial
* @return
*/
public List<WmsWarehouseMaterial> selectWmsWarehouseMaterialJoinList(WmsWarehouseMaterial wmsWarehouseMaterial);
/**
*
*
* @param warehouseMaterialList
* @return
*/
public int batchInsertWarehouseMaterial(List<WmsWarehouseMaterial> warehouseMaterialList);
}

@ -0,0 +1,78 @@
package com.hw.wms.service;
import java.util.List;
import com.hw.wms.domain.WmsWarehouseMaterial;
/**
* Service
*
* @author xins
* @date 2024-01-09
*/
public interface IWmsWarehouseMaterialService
{
/**
*
*
* @param warehouseId
* @return
*/
public WmsWarehouseMaterial selectWmsWarehouseMaterialByWarehouseId(Long warehouseId);
/**
*
*
* @param wmsWarehouseMaterial
* @return
*/
public List<WmsWarehouseMaterial> selectWmsWarehouseMaterialList(WmsWarehouseMaterial wmsWarehouseMaterial);
/**
*
*
* @param wmsWarehouseMaterial
* @return
*/
public int insertWmsWarehouseMaterial(WmsWarehouseMaterial wmsWarehouseMaterial);
/**
*
*
* @param wmsWarehouseMaterial
* @return
*/
public int updateWmsWarehouseMaterial(WmsWarehouseMaterial wmsWarehouseMaterial);
/**
*
*
* @param warehouseMaterialIds
* @return
*/
public int deleteWmsWarehouseMaterialByWarehouseMaterialIds(Long[] warehouseMaterialIds);
/**
*
*
* @param warehouseMaterialId
* @return
*/
public int deleteWmsWarehouseMaterialByWarehouseMaterialId(Long warehouseMaterialId);
/**
* ,join material
*
* @param wmsWarehouseMaterial
* @return
*/
public List<WmsWarehouseMaterial> selectWmsWarehouseMaterialJoinList(WmsWarehouseMaterial wmsWarehouseMaterial);
/**
*
*
* @param warehouseId ID
* @param materialIds
*/
public void batchInsertWarehouseMaterial(Long warehouseId, Long[] materialIds);
}

@ -0,0 +1,134 @@
package com.hw.wms.service.impl;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.hw.common.core.constant.WmsConstants;
import com.hw.common.core.utils.DateUtils;
import com.hw.common.core.utils.StringUtils;
import com.hw.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hw.wms.mapper.WmsWarehouseMaterialMapper;
import com.hw.wms.domain.WmsWarehouseMaterial;
import com.hw.wms.service.IWmsWarehouseMaterialService;
/**
* Service
*
* @author xins
* @date 2024-01-09
*/
@Service
public class WmsWarehouseMaterialServiceImpl implements IWmsWarehouseMaterialService {
@Autowired
private WmsWarehouseMaterialMapper wmsWarehouseMaterialMapper;
/**
*
*
* @param warehouseId
* @return
*/
@Override
public WmsWarehouseMaterial selectWmsWarehouseMaterialByWarehouseId(Long warehouseId) {
return wmsWarehouseMaterialMapper.selectWmsWarehouseMaterialByWarehouseId(warehouseId);
}
/**
*
*
* @param wmsWarehouseMaterial
* @return
*/
@Override
public List<WmsWarehouseMaterial> selectWmsWarehouseMaterialList(WmsWarehouseMaterial wmsWarehouseMaterial) {
return wmsWarehouseMaterialMapper.selectWmsWarehouseMaterialList(wmsWarehouseMaterial);
}
/**
*
*
* @param wmsWarehouseMaterial
* @return
*/
@Override
public int insertWmsWarehouseMaterial(WmsWarehouseMaterial wmsWarehouseMaterial) {
wmsWarehouseMaterial.setCreateTime(DateUtils.getNowDate());
return wmsWarehouseMaterialMapper.insertWmsWarehouseMaterial(wmsWarehouseMaterial);
}
/**
*
*
* @param wmsWarehouseMaterial
* @return
*/
@Override
public int updateWmsWarehouseMaterial(WmsWarehouseMaterial wmsWarehouseMaterial) {
return wmsWarehouseMaterialMapper.updateWmsWarehouseMaterial(wmsWarehouseMaterial);
}
/**
*
*
* @param wmsWarehouseMaterialIds
* @return
*/
@Override
public int deleteWmsWarehouseMaterialByWarehouseMaterialIds(Long[] wmsWarehouseMaterialIds) {
return wmsWarehouseMaterialMapper.deleteWmsWarehouseMaterialByWarehouseMaterialIds(wmsWarehouseMaterialIds);
}
/**
*
*
* @param warehouseMaterialId
* @return
*/
@Override
public int deleteWmsWarehouseMaterialByWarehouseMaterialId(Long warehouseMaterialId) {
return wmsWarehouseMaterialMapper.deleteWmsWarehouseMaterialByWarehouseMaterialId(warehouseMaterialId);
}
/**
* ,join material
*
* @param wmsWarehouseMaterial
* @return
*/
@Override
public List<WmsWarehouseMaterial> selectWmsWarehouseMaterialJoinList(WmsWarehouseMaterial wmsWarehouseMaterial) {
return wmsWarehouseMaterialMapper.selectWmsWarehouseMaterialJoinList(wmsWarehouseMaterial);
}
/**
*
*
* @param warehouseId ID
* @param materialIds
*/
@Override
public void batchInsertWarehouseMaterial(Long warehouseId, Long[] materialIds) {
if (StringUtils.isNotEmpty(materialIds)) {
String userName = SecurityUtils.getUsername();
Date currentDate = new Date();
// 新增仓库的物料配置信息
List<WmsWarehouseMaterial> list = new ArrayList<WmsWarehouseMaterial>();
for (Long materialId : materialIds) {
WmsWarehouseMaterial warehouseMaterial = new WmsWarehouseMaterial();
warehouseMaterial.setWarehouseId(warehouseId);
warehouseMaterial.setStorageType(WmsConstants.WMS_WAREHOUSE_MATERIAL_STORAGE_TYPE_MATERIAL);
warehouseMaterial.setStorageId(materialId);
warehouseMaterial.setCreateBy(userName);
warehouseMaterial.setCreateTime(currentDate);
list.add(warehouseMaterial);
}
wmsWarehouseMaterialMapper.batchInsertWarehouseMaterial(list);
}
}
}

@ -0,0 +1,97 @@
<?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.WmsWarehouseMaterialMapper">
<resultMap type="WmsWarehouseMaterial" id="WmsWarehouseMaterialResult">
<result property="warehouseMaterialId" column="warehouse_material_id" />
<result property="warehouseId" column="warehouse_id" />
<result property="locationCode" column="location_code" />
<result property="storageType" column="storage_type" />
<result property="storageId" column="storage_id" />
<result property="createTime" column="create_time" />
<result property="createBy" column="create_by" />
<result property="materialCode" column="material_code" />
<result property="materialName" column="material_name" />
</resultMap>
<sql id="selectWmsWarehouseMaterialVo">
select warehouse_id, location_code, storage_type, storage_id, create_time, create_by from wms_warehouse_material
</sql>
<select id="selectWmsWarehouseMaterialList" parameterType="WmsWarehouseMaterial" resultMap="WmsWarehouseMaterialResult">
<include refid="selectWmsWarehouseMaterialVo"/>
<where>
</where>
</select>
<select id="selectWmsWarehouseMaterialByWarehouseId" parameterType="Long" resultMap="WmsWarehouseMaterialResult">
<include refid="selectWmsWarehouseMaterialVo"/>
where warehouse_id = #{warehouseId}
</select>
<insert id="insertWmsWarehouseMaterial" parameterType="WmsWarehouseMaterial">
insert into wms_warehouse_material
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="warehouseId != null">warehouse_id,</if>
<if test="locationCode != null">location_code,</if>
<if test="storageType != null">storage_type,</if>
<if test="storageId != null">storage_id,</if>
<if test="createTime != null">create_time,</if>
<if test="createBy != null">create_by,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="warehouseId != null">#{warehouseId},</if>
<if test="locationCode != null">#{locationCode},</if>
<if test="storageType != null">#{storageType},</if>
<if test="storageId != null">#{storageId},</if>
<if test="createTime != null">#{createTime},</if>
<if test="createBy != null">#{createBy},</if>
</trim>
</insert>
<update id="updateWmsWarehouseMaterial" parameterType="WmsWarehouseMaterial">
update wms_warehouse_material
<trim prefix="SET" suffixOverrides=",">
<if test="locationCode != null">location_code = #{locationCode},</if>
<if test="storageType != null">storage_type = #{storageType},</if>
<if test="storageId != null">storage_id = #{storageId},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
</trim>
where warehouse_id = #{warehouseId}
</update>
<delete id="deleteWmsWarehouseMaterialByWarehouseMaterialId" parameterType="Long">
delete from wms_warehouse_material where warehouse_material_id = #{warehouseMaterialId}
</delete>
<delete id="deleteWmsWarehouseMaterialByWarehouseMaterialIds" parameterType="String">
delete from wms_warehouse_material where warehouse_material_id in
<foreach item="warehouseMaterialId" collection="array" open="(" separator="," close=")">
#{warehouseMaterialId}
</foreach>
</delete>
<select id="selectWmsWarehouseMaterialJoinList" parameterType="WmsWarehouseMaterial" resultMap="WmsWarehouseMaterialResult">
select wwm.warehouse_material_id,wwm.warehouse_id, wwm.location_code, wwm.storage_type, wwm.storage_id, wwm.create_time, wwm.create_by,
mbm.material_code,mbm.material_name
from wms_warehouse_material wwm left join mes_base_material_info mbm on wwm.storage_id=mbm.material_id and wwm.storage_type='1'
<where>
<if test="warehouseId != null "> and warehouse_id = #{warehouseId}</if>
</where>
</select>
<insert id="batchInsertWarehouseMaterial">
insert into wms_warehouse_material(warehouse_id, storage_type,storage_id,create_time,create_by) values
<foreach item="item" index="index" collection="list" separator=",">
(#{item.warehouseId},#{item.storageType},#{item.storageId},#{item.createTime},#{item.createBy})
</foreach>
</insert>
</mapper>
Loading…
Cancel
Save