为库位增加“允许产品混放”和“允许批次混放”两个标识;为库区增加批量设置所有库位产品混放和批次混放的功能。

This commit is contained in:
yinjinlu-pc\尹金路 2025-02-06 11:43:02 +08:00
parent b4d9add499
commit 4dd6e5be8a
6 changed files with 117 additions and 10 deletions

View File

@ -4,19 +4,13 @@ import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ktg.common.constant.UserConstants;
import com.ktg.mes.wm.domain.WmStorageArea;
import com.ktg.mes.wm.service.IWmStorageAreaService;
import com.ktg.mes.wm.utils.WmBarCodeUtil;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
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 org.springframework.web.bind.annotation.*;
import com.ktg.common.annotation.Log;
import com.ktg.common.core.controller.BaseController;
import com.ktg.common.core.domain.AjaxResult;
@ -94,7 +88,7 @@ public class WmStorageLocationController extends BaseController
return AjaxResult.error("库区名称已存在!");
}
wmStorageLocationService.insertWmStorageLocation(wmStorageLocation);
wmBarCodeUtil.generateBarCode(UserConstants.BARCODE_TYPE_WAREHOUSE,wmStorageLocation.getLocationId(),wmStorageLocation.getLocationCode(),wmStorageLocation.getLocationName());
wmBarCodeUtil.generateBarCode(UserConstants.BARCODE_TYPE_STORAGELOCATION,wmStorageLocation.getLocationId(),wmStorageLocation.getLocationCode(),wmStorageLocation.getLocationName());
return AjaxResult.success(wmStorageLocation.getLocationId());
}
@ -126,4 +120,28 @@ public class WmStorageLocationController extends BaseController
// }
return wmStorageLocationService.deleteWmStorageLocationByLocationIds(locationIds);
}
/**
* 设置库区下所有库位是否允许产品混放
*/
@PreAuthorize("@ss.hasPermi('mes:wm:location:edit')")
@PostMapping("/setProductMixing")
public AjaxResult setProductMixing(@RequestParam("locationId") Long locationId, @RequestParam("flag") Boolean flag)
{
wmStorageAreaService.updateWmStorageAreaProductMixing(locationId, flag==true?UserConstants.YES:UserConstants.NO);
return AjaxResult.success();
}
/**
* 设置库区下所有库位是否允许批次混放
*/
@PreAuthorize("@ss.hasPermi('mes:wm:location:edit')")
@PostMapping("/setBatchMixing")
public AjaxResult setBatchMixing(@RequestParam("locationId") Long locationId, @RequestParam("flag") Boolean flag)
{
wmStorageAreaService.updateWmStorageAreaBatchMixing(locationId, flag==true?UserConstants.YES:UserConstants.NO);
return AjaxResult.success();
}
}

View File

@ -55,8 +55,18 @@ public class WmStorageArea extends BaseEntity
@Excel(name = "是否启用")
private String enableFlag;
/** 是否冻结 */
@Excel(name = "是否冻结")
private String frozenFlag;
/** 是否允许产品混放 */
@Excel(name = "是否允许产品混放")
private String productMixing;
/** 是否允许批次混放 */
@Excel(name = "是否允许批次混放")
private String batchMixing;
/** 预留字段1 */
private String attr1;
@ -168,6 +178,22 @@ public class WmStorageArea extends BaseEntity
this.frozenFlag = frozenFlag;
}
public String getProductMixing() {
return productMixing;
}
public void setProductMixing(String productMixing) {
this.productMixing = productMixing;
}
public String getBatchMixing() {
return batchMixing;
}
public void setBatchMixing(String batchMixing) {
this.batchMixing = batchMixing;
}
public void setAttr1(String attr1)
{
this.attr1 = attr1;

View File

@ -51,6 +51,16 @@ public interface WmStorageAreaMapper
*/
public int updateWmStorageArea(WmStorageArea wmStorageArea);
/**
* 批量更新某个库区下库位的产品混合设置
*/
public void updateWmStorageAreaProductMixing(WmStorageArea wmStorageArea);
/**
* 批量更新某个库区下库位的批次混合设置
*/
public void updateWmStorageAreaBatchMixing(WmStorageArea wmStorageArea);
/**
* 删除库位设置
*

View File

@ -51,6 +51,20 @@ public interface IWmStorageAreaService
*/
public int updateWmStorageArea(WmStorageArea wmStorageArea);
/**
* 批量更新某个库区下库位的产品混合设置
* @param locationId
* @param flag
*/
public void updateWmStorageAreaProductMixing(Long locationId, String flag);
/**
* 批量更新某个库区下库位的批次混合设置
* @param locationId
* @param flag
*/
public void updateWmStorageAreaBatchMixing(Long locationId, String flag);
/**
* 批量删除库位设置
*

View File

@ -75,6 +75,22 @@ public class WmStorageAreaServiceImpl implements IWmStorageAreaService
return wmStorageAreaMapper.updateWmStorageArea(wmStorageArea);
}
@Override
public void updateWmStorageAreaProductMixing(Long locationId, String flag) {
WmStorageArea area = new WmStorageArea();
area.setLocationId(locationId);
area.setProductMixing(flag);
wmStorageAreaMapper.updateWmStorageAreaProductMixing(area);
}
@Override
public void updateWmStorageAreaBatchMixing(Long locationId, String flag) {
WmStorageArea area = new WmStorageArea();
area.setLocationId(locationId);
area.setBatchMixing(flag);
wmStorageAreaMapper.updateWmStorageAreaBatchMixing(area);
}
/**
* 批量删除库位设置
*

View File

@ -16,6 +16,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="positionZ" column="position_z" />
<result property="enableFlag" column="enable_flag" />
<result property="frozenFlag" column="frozen_flag" />
<result property="productMixing" column="product_mixing" />
<result property="batchMixing" column="batch_mixing" />
<result property="remark" column="remark" />
<result property="attr1" column="attr1" />
<result property="attr2" column="attr2" />
@ -28,7 +30,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectWmStorageAreaVo">
select area_id, area_code, area_name, location_id, area, max_loa, position_x, position_y, position_z, enable_flag, frozen_flag, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_storage_area
select area_id, area_code, area_name, location_id, area, max_loa, position_x, position_y, position_z, product_mixing, batch_mixing, enable_flag, frozen_flag, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_storage_area
</sql>
<select id="selectWmStorageAreaList" parameterType="WmStorageArea" resultMap="WmStorageAreaResult">
@ -43,6 +45,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="positionY != null and positionY !=0"> and position_y = #{positionY}</if>
<if test="positionZ != null and positionZ !=0"> and position_z = #{positionZ}</if>
<if test="enableFlag != null and enableFlag != ''"> and enable_flag = #{enableFlag}</if>
<if test="frozenFlag != null and frozenFlag != ''"> and frozen_flag = #{frozenFlag}</if>
<if test="productMixing != null and productMixing != ''"> and product_mixing = #{productMixing}</if>
<if test="batchMixing != null and batchMixing != ''"> and batch_mixing = #{batchMixing}</if>
</where>
</select>
@ -69,6 +74,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="positionZ != null">position_z,</if>
<if test="enableFlag != null">enable_flag,</if>
<if test="frozenFlag != null">frozen_flag,</if>
<if test="productMixing != null">product_mixing,</if>
<if test="batchMixing != null">batch_mixing,</if>
<if test="remark != null">remark,</if>
<if test="attr1 != null">attr1,</if>
<if test="attr2 != null">attr2,</if>
@ -90,6 +97,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="positionZ != null">#{positionZ},</if>
<if test="enableFlag != null">#{enableFlag},</if>
<if test="frozenFlag != null">#{frozenFlag},</if>
<if test="productMixing != null">#{productMixing},</if>
<if test="batchMixing != null">#{batchMixing},</if>
<if test="remark != null">#{remark},</if>
<if test="attr1 != null">#{attr1},</if>
<if test="attr2 != null">#{attr2},</if>
@ -115,6 +124,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="positionZ != null">position_z = #{positionZ},</if>
<if test="enableFlag != null">enable_flag = #{enableFlag},</if>
<if test="frozenFlag != null">frozen_flag = #{frozenFlag},</if>
<if test="productMixing != null">product_mixing = #{productMixing},</if>
<if test="batchMixing != null">batch_mixing = #{batchMixing},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="attr1 != null">attr1 = #{attr1},</if>
<if test="attr2 != null">attr2 = #{attr2},</if>
@ -128,6 +139,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where area_id = #{areaId}
</update>
<update id="updateWmStorageAreaProductMixing" parameterType="WmStorageArea">
update wm_storage_area
set product_mixing = #{productMixing}
where location_id = #{locationId}
</update>
<update id="updateWmStorageAreaBatchMixing" parameterType="WmStorageArea">
update wm_storage_area
set batch_mixing = #{batchMixing}
where location_id = #{locationId}
</update>
<delete id="deleteWmStorageAreaByAreaId" parameterType="Long">
delete from wm_storage_area where area_id = #{areaId}
</delete>