二维码标准箱联调

This commit is contained in:
mashuai 2024-12-12 11:10:03 +08:00
parent a565d21313
commit 0fde9252fe
7 changed files with 154 additions and 50 deletions

View File

@ -35,7 +35,7 @@ public class BmQrBoxController extends BaseController {
* @return
*/
@ApiOperation(value = "查询二维码标准箱管理列表")
@RequiresPermissions("basic:qrBox:list")
//@RequiresPermissions("basic:qrBox:list")
@GetMapping("/list")
public TableDataInfo list(BmQrBoxInfo bmQrBoxInfo)
{
@ -44,6 +44,21 @@ public class BmQrBoxController extends BaseController {
return getDataTable(list);
}
/**
* 查询二维码标准箱绑定详情列表
* @param bmQrBoxInfo
* @return
*/
@ApiOperation(value = "查询二维码标准箱绑定详情列表")
//@RequiresPermissions("basic:qrBox:list")
@GetMapping("/getList")
public TableDataInfo getList(BmQrBoxInfo bmQrBoxInfo)
{
startPage();
List<BmQrBoxInfo> list = qrBoxService.getList(bmQrBoxInfo);
return getDataTable(list);
}
/**
* 新增二维码标准箱管理
* @param bmQrBoxInfo
@ -80,7 +95,7 @@ public class BmQrBoxController extends BaseController {
* @return
*/
@ApiOperation(value = "删除二维码标准箱")
//@PreventRepeatSubmit
@PreventRepeatSubmit
//@RequiresPermissions("basic:info:remove")
@SysLog(title = "二维码标准箱管理", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除二维码标准箱")
@PostMapping("/deleteById")
@ -96,7 +111,7 @@ public class BmQrBoxController extends BaseController {
* @return
*/
@ApiOperation(value = "下载二维码标准箱")
//@PreventRepeatSubmit
@PreventRepeatSubmit
//@RequiresPermissions("basic:qrBox:download")
@PostMapping("/download")
public void download(@RequestBody BmQrBoxInfo bmQrBoxInfo, HttpServletResponse response)

View File

@ -42,7 +42,7 @@ public class BmStorageLogController extends BaseController
* 查询库存日志列表
*/
@ApiOperation(value = "查询库存日志列表")
@RequiresPermissions("basic:log:list")
@RequiresPermissions("stock:log:list")
@GetMapping("/list")
public TableDataInfo list(BmStorageLog bmStorageLog)
{

View File

@ -1,7 +1,7 @@
package com.bonus.material.basic.domain;
import com.bonus.common.core.annotation.Excel;
import com.bonus.common.core.web.domain.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
@ -20,35 +20,46 @@ public class BmQrBoxInfo extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 二维码ID */
private Long qrId;
@ApiModelProperty(value = "绑定明细id")
private Long id;
/** 标准箱ID */
private Long boxId;
@ApiModelProperty(value = "二维码标准箱名称")
private String qrName;
private String boxName;
/** 二维码 */
@ApiModelProperty(value = "二维码")
private String qrCode;
private String boxCode;
@ApiModelProperty(value = "二维码路径")
private String qrUrl;
/** 类型ID */
@ApiModelProperty(value = "类型ID")
private Long typeId;
private String boxUrl;
/** 二维码类型 */
@ApiModelProperty(value = "二维码类型")
private String qrType;
/** 任务ID */
@Excel(name = "任务ID")
@ApiModelProperty(value = "任务ID")
private Long taskId;
private String boxType;
/** 数据所属组织 */
@ApiModelProperty(value = "标准箱绑定机具数量")
private Integer typeNum;
private Integer devNum;
@JsonFormat(pattern = "yyyy-MM-dd")
private String startTime;
@JsonFormat(pattern = "yyyy-MM-dd")
private String endTime;
@ApiModelProperty(value = "关键字")
private String keyWord;
@ApiModelProperty(value = "类型名称")
private String typeName;
@ApiModelProperty(value = "规格类型")
private String typeModelName;
@ApiModelProperty(value = "机具编号")
private String maCode;
}

View File

@ -38,4 +38,18 @@ public interface BmQrBoxMapper {
* @return
*/
int deleteById(BmQrBoxInfo bmQrBoxInfo);
/**
* 根据二维码标准箱ID查询二维码数量
* @param boxId
* @return
*/
int countBmQrcodeInfoByBoxId(Long boxId);
/**
* 查询二维码标准箱管理绑定详情列表
* @param bmQrBoxInfo
* @return
*/
List<BmQrBoxInfo> getList(BmQrBoxInfo bmQrBoxInfo);
}

View File

@ -47,4 +47,11 @@ public interface BmQrBoxService {
* @return
*/
AjaxResult deleteById(BmQrBoxInfo bmQrBoxInfo);
/**
* 查询二维码标准箱管理列表
* @param bmQrBoxInfo
* @return
*/
List<BmQrBoxInfo> getList(BmQrBoxInfo bmQrBoxInfo);
}

View File

@ -51,8 +51,8 @@ public class BmQrBoxServiceImpl implements BmQrBoxService {
public AjaxResult insertBmQrcodeInfo(BmQrBoxInfo bmQrBoxInfo) {
//生成二维码
String code = "BOX-" + DateTimeHelper.getNowTimeFomart();
bmQrBoxInfo.setQrCode(code);
bmQrBoxInfo.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
bmQrBoxInfo.setBoxCode(code);
bmQrBoxInfo.setCreateBy(SecurityUtils.getUsername());
bmQrBoxInfo.setCreateTime(DateUtils.getNowDate());
int result = bmQrBoxMapper.insertBmQrcodeInfo(bmQrBoxInfo);
return result > 0 ? AjaxResult.success(HttpCodeEnum.SUCCESS.getMsg()) : AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
@ -70,7 +70,7 @@ public class BmQrBoxServiceImpl implements BmQrBoxService {
List<BmQrBoxInfo> list = bmQrBoxMapper.find(bmQrBoxInfo);
String code = "无编码";
if (list.size() > 0) {
code = list.get(0).getQrCode();
code = list.get(0).getBoxCode();
}
// 新购管理-二维码打印-新增
String url = BackstageApplication.getUrl() + "backstage/machine/qrCodePage?qrcode=" + code;
@ -121,7 +121,7 @@ public class BmQrBoxServiceImpl implements BmQrBoxService {
*/
@Override
public AjaxResult updateBmQrcodeInfo(BmQrBoxInfo bmQrBoxInfo) {
bmQrBoxInfo.setUpdateBy(String.valueOf(SecurityUtils.getUserId()));
bmQrBoxInfo.setUpdateBy(SecurityUtils.getUsername());
bmQrBoxInfo.setUpdateTime(DateUtils.getNowDate());
int result = bmQrBoxMapper.updateBmQrcodeInfo(bmQrBoxInfo);
return result > 0 ? AjaxResult.success(HttpCodeEnum.SUCCESS.getMsg()) : AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
@ -134,7 +134,21 @@ public class BmQrBoxServiceImpl implements BmQrBoxService {
*/
@Override
public AjaxResult deleteById(BmQrBoxInfo bmQrBoxInfo) {
//根据id查看标准箱是否绑定绑定不能删除
if (bmQrBoxMapper.countBmQrcodeInfoByBoxId(bmQrBoxInfo.getBoxId()) > 0) {
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), "该标准箱还绑定设备,无法删除");
}
int result = bmQrBoxMapper.deleteById(bmQrBoxInfo);
return result > 0 ? AjaxResult.success(HttpCodeEnum.SUCCESS.getMsg()) : AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
}
/**
* 查询二维码标准箱管理绑定详情列表
* @param bmQrBoxInfo
* @return
*/
@Override
public List<BmQrBoxInfo> getList(BmQrBoxInfo bmQrBoxInfo) {
return bmQrBoxMapper.getList(bmQrBoxInfo);
}
}

View File

@ -6,36 +6,79 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="find" resultType="com.bonus.material.basic.domain.BmQrBoxInfo">
select
qr_id as qrId,
qr_name as qrName,
qr_code as qrCode,
qr_type as qrType,
create_by as createBy,
create_time as createTime,
update_by as updateBy,
update_time as updateTime
from bm_qrcode_box
bqb.box_id as boxId,
bqb.box_name as boxName,
bqb.box_code as boxCode,
bqb.box_type as boxType,
bqb.create_by as createBy,
bqb.create_time as createTime,
bqb.update_by as updateBy,
bqb.update_time as updateTime,
COUNT(qbb.box_id) as devNum
from bm_qrcode_box bqb
left join qrcode_box_bind qbb on bqb.box_id = qbb.box_id
<where>
<if test="qrId != null">and qr_id = #{qrId}</if>
<if test="qrName != null and qrName != ''">and qr_name like concat('%',#{qrName},'%')</if>
<if test="qrCode != null and qrCode != ''">and qr_code like concat('%',#{qrCode},'%')</if>
<if test="qrType != null">and qr_type = #{qrType}</if>
<if test="boxId != null">and bqb.box_id = #{boxId}</if>
<if test="boxName != null and boxName != ''">and bqb.box_name like concat('%',#{boxName},'%')</if>
<if test="boxCode != null and boxCode != ''">and bqb.box_code like concat('%',#{boxCode},'%')</if>
<if test="boxType != null">and bqb.box_type = #{boxType}</if>
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
<![CDATA[ AND DATE_FORMAT( bqb.create_time, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime} ]]>
</if>
<if test="keyWord != null and keyWord != ''">
AND (
bqb.box_name like concat('%',#{keyWord},'%')
OR bqb.box_code like concat('%',#{keyWord},'%')
)
</if>
</where>
GROUP BY bqb.box_id
order by bqb.create_time desc
</select>
<insert id="insertBmQrcodeInfo" parameterType="com.bonus.material.basic.domain.BmQrBoxInfo" useGeneratedKeys="true" keyProperty="qrId">
<select id="countBmQrcodeInfoByBoxId" resultType="java.lang.Integer">
select count(1) from qrcode_box_bind where box_id = #{boxId}
</select>
<select id="getList" resultType="com.bonus.material.basic.domain.BmQrBoxInfo">
SELECT
qb.id as id,
qb.box_id as boxId,
mt1.type_name as typeName,
mt.type_name as typeModelName,
mm.ma_code as maCode,
qb.create_by as createBy
FROM
qrcode_box_bind qb
LEFT JOIN ma_machine mm ON qb.ma_id = mm.ma_id
LEFT JOIN ma_type mt ON mm.type_id = mt.type_id
AND mt.del_flag = '0'
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
AND mt1.del_flag = '0'
WHERE
1 = 1
<if test="keyWord != null and keyWord != ''">
AND (
mt1.type_name like concat('%',#{keyWord},'%')
OR mt.type_name like concat('%',#{keyWord},'%')
OR mm.ma_code like concat('%',#{keyWord},'%')
)
</if>
</select>
<insert id="insertBmQrcodeInfo" parameterType="com.bonus.material.basic.domain.BmQrBoxInfo" useGeneratedKeys="true" keyProperty="boxId">
insert into bm_qrcode_box
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="qrCode != null">qr_code,</if>
<if test="qrName != null and qrName != ''">qr_name,</if>
<if test="qrType != null">qr_type,</if>
<if test="boxCode != null">box_code,</if>
<if test="boxName != null and boxName != ''">box_name,</if>
<if test="boxType != null">box_type,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="qrCode != null">#{qrCode},</if>
<if test="qrName != null and qrName != ''">#{qrName},</if>
<if test="qrType != null">#{qrType},</if>
<if test="boxCode != null">#{boxCode},</if>
<if test="boxName != null and boxName != ''">#{boxName},</if>
<if test="boxType != null">#{boxType},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
@ -44,19 +87,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="updateBmQrcodeInfo" parameterType="com.bonus.material.basic.domain.BmQrBoxInfo">
update bm_qrcode_box
<trim prefix="SET" suffixOverrides=",">
<if test="qrCode != null">qr_code = #{qrCode},</if>
<if test="qrType != null">qr_type = #{qrType},</if>
<if test="qrName != null and qrName != ''">qr_name = #{qrName},</if>
<if test="boxCode != null">box_code = #{boxCode},</if>
<if test="boxType != null">box_type = #{boxType},</if>
<if test="boxName != null and boxName != ''">box_name = #{boxName},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where qr_id = #{qrId}
where box_id = #{boxId}
</update>
<delete id="deleteById">
delete
from bm_qrcode_box
where qr_id = #{qrId}
where box_id = #{boxId}
</delete>
</mapper>