标准箱绑定新购批次判断

This commit is contained in:
syruan 2025-01-10 14:07:24 +08:00
parent cbf86d3d75
commit 476eaf3a81
5 changed files with 36 additions and 4 deletions

View File

@ -166,7 +166,7 @@ public class BmQrBoxController extends BaseController {
* APP -- 扫码绑定机具
*/
@ApiOperation(value = "APP -- 扫码绑定机具")
@PreventRepeatSubmit
// @PreventRepeatSubmit
//@RequiresPermissions("basic:qrBox:edit")
@SysLog(title = "APP-二维码标准箱管理", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->APP扫码绑定机具")
@PostMapping("/app_bind_ma")

View File

@ -52,6 +52,13 @@ public interface BmQrBoxMapper {
*/
List<Long> getBoxMaTypeList(Long boxId);
/**
* 根据标准箱ID查询标准箱已绑定物资的任务ID
* @param boxId 标准箱id
* @return 标准箱物资的绑定批次 buyTask
*/
Long getBoxBindMaBuyTaskByBoxId(Long boxId);
/**
* 查询此机具是否已经被标准箱绑定过
*/

View File

@ -357,8 +357,17 @@ public class BmQrBoxServiceImpl implements BmQrBoxService {
return AjaxResult.error("物资状态非在库或待入库状态,无法操作:" + machineVo.getMaStatus());
}
// 物资的新购批次判断是否和Box标准箱内已存在的是同一批
if (null == machineVo.getBuyTask()) {
return AjaxResult.error("物资未关联采购批次,请完善后重试!");
}
Long boxBindMaBuyTaskId = bmQrBoxMapper.getBoxBindMaBuyTaskByBoxId(bmQrBoxInfo.getBoxId());
if (null != boxBindMaBuyTaskId && !Objects.equals(boxBindMaBuyTaskId, machineVo.getBuyTask())) {
return AjaxResult.error("该物资批次与标准箱已存在批次不匹配,请完善后重试!");
}
// 此物资未在其他标准型入过库才可以绑定
if (bmQrBoxMapper.existsMaId(machineVo.getMaId()) > 0) {
if (0 < bmQrBoxMapper.existsMaId(machineVo.getMaId())) {
return AjaxResult.error("该物资已绑定其他标准箱,无法再次绑定!");
}

View File

@ -42,4 +42,7 @@ public class MachineVo extends Machine {
@ApiModelProperty("状态名称")
private String statusName;
@ApiModelProperty("购置批次")
private Long buyTask;
}

View File

@ -229,7 +229,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join
ma_machine mm on bqi.type_id = mm.type_id and bqi.ma_code = mm.ma_code
where
bqi.del_flag is null or bqi.del_flag = '0'
bqi.del_flag is null or bqi.del_flag = '0' and bqi.qr_code = #{qrCode}
group by
bqi.id limit 1
</select>
@ -255,4 +255,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bqb.box_code = #{boxCode} AND
mt.type_id = #{maTypeId}
</select>
<select id="getBoxBindMaBuyTaskByBoxId" resultType="java.lang.Long">
select
mm.buy_task
from
bm_qrcode_box_bind qbb
LEFT JOIN
ma_machine mm ON mm.ma_id = qbb.ma_id
where
qbb.box_id = #{boxId}
group by
qbb.box_id LIMIT 1
</select>
</mapper>