盘带绑定接口开发
This commit is contained in:
parent
8b14acfa29
commit
ddcde38fb0
|
|
@ -46,6 +46,30 @@ public class PurchaseBindController extends BaseController {
|
||||||
return purchaseBindService.bind(dto);
|
return purchaseBindService.bind(dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 盘点绑定
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "盘点绑定")
|
||||||
|
@PreventRepeatSubmit
|
||||||
|
// @RequiresPermissions("purchase:bind:add")
|
||||||
|
@PostMapping("/inventoryBind")
|
||||||
|
public AjaxResult inventoryBind(@RequestBody @NotNull(message = "参数不能为空") PurchaseDto dto) {
|
||||||
|
return purchaseBindService.inventoryBind(dto);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取盘点绑定绑定扫描后详细信息
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "获取盘点绑定绑定扫描后详细信息")
|
||||||
|
// @RequiresPermissions("purchase:bind:query")
|
||||||
|
@GetMapping(value = "/getInventoryInfo")
|
||||||
|
public AjaxResult getInventoryInfo(PurchaseDto dto) {
|
||||||
|
return purchaseBindService.getInventoryInfo(dto);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取新购验收绑定详细信息
|
* 获取新购验收绑定详细信息
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -117,4 +117,7 @@ public class PurchaseVo {
|
||||||
|
|
||||||
@ApiModelProperty(value = "异常数量")
|
@ApiModelProperty(value = "异常数量")
|
||||||
private BigDecimal exceptionNum;
|
private BigDecimal exceptionNum;
|
||||||
|
|
||||||
|
private int isBindInventory;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -142,4 +142,19 @@ public interface PurchaseBindMapper {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
PurchaseCheckInfo selectSupplierByTaskId(String taskId);
|
PurchaseCheckInfo selectSupplierByTaskId(String taskId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据二维码查询
|
||||||
|
* @param purchaseDto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<PurchaseDto> selectByQrCode(PurchaseDto purchaseDto);
|
||||||
|
|
||||||
|
PurchaseVo getInventoryInfo(PurchaseDto dto);
|
||||||
|
|
||||||
|
int updateQrCodeInfo(PurchaseDto dto);
|
||||||
|
|
||||||
|
int insertMachineBind(PurchaseDto dto);
|
||||||
|
|
||||||
|
int selectMaCodeCount(PurchaseDto dto);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,4 +56,8 @@ public interface IPurchaseBindService {
|
||||||
AjaxResult reject(PurchaseDto dto);
|
AjaxResult reject(PurchaseDto dto);
|
||||||
|
|
||||||
AjaxResult getTypeByQrcode(PurchaseDto dto);
|
AjaxResult getTypeByQrcode(PurchaseDto dto);
|
||||||
|
|
||||||
|
AjaxResult inventoryBind(PurchaseDto dto);
|
||||||
|
|
||||||
|
AjaxResult getInventoryInfo(PurchaseDto dto);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -204,6 +204,43 @@ public class PurchaseBindServiceImpl implements IPurchaseBindService {
|
||||||
return AjaxResult.success("绑定成功");
|
return AjaxResult.success("绑定成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 盘点绑定
|
||||||
|
* @param dto 盘点绑定
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public AjaxResult inventoryBind(PurchaseDto dto) {
|
||||||
|
if(dto.getQrCode() == null || dto.getQrCode().isEmpty()){
|
||||||
|
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), "二维码不能为空");
|
||||||
|
}
|
||||||
|
if(dto.getMaCode()== null || dto.getMaCode().isEmpty()){
|
||||||
|
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), "设备编码不能为空");
|
||||||
|
}
|
||||||
|
if(dto.getTypeId() == null){
|
||||||
|
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), "未知设备类型,请扫描后再绑定");
|
||||||
|
}
|
||||||
|
//查找maCode是否重复
|
||||||
|
int count = purchaseBindMapper.selectMaCodeCount(dto);
|
||||||
|
if (count > 0) {
|
||||||
|
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), "该设备编码已存在,请勿重复添加");
|
||||||
|
}
|
||||||
|
dto.setUpdateBy(SecurityUtils.getLoginUser().getUserid().toString());
|
||||||
|
//修改bm_qrcode_info表中状态和ma_code
|
||||||
|
int countOne = purchaseBindMapper.updateQrCodeInfo(dto);
|
||||||
|
if (countOne == 0) {
|
||||||
|
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), "修改bm_qrcode_info表失败");
|
||||||
|
}
|
||||||
|
//插入ma_machine表
|
||||||
|
int countTwo = purchaseBindMapper.insertMachineBind(dto);
|
||||||
|
if (countTwo == 0) {
|
||||||
|
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), "插入ma_machine表失败");
|
||||||
|
}
|
||||||
|
return AjaxResult.success("绑定成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 提取状态更新逻辑到一个方法
|
* 提取状态更新逻辑到一个方法
|
||||||
* @param taskId
|
* @param taskId
|
||||||
|
|
@ -486,4 +523,27 @@ public class PurchaseBindServiceImpl implements IPurchaseBindService {
|
||||||
//extracted(list);
|
//extracted(list);
|
||||||
return AjaxResult.success(list);
|
return AjaxResult.success(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询盘点绑定信息
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AjaxResult getInventoryInfo(PurchaseDto dto) {
|
||||||
|
if (dto == null || dto.getQrCode() == null || dto.getQrCode().isEmpty()) {
|
||||||
|
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), "参数不能为空");
|
||||||
|
}
|
||||||
|
PurchaseVo vo = purchaseBindMapper.getInventoryInfo(dto);
|
||||||
|
if(vo == null){
|
||||||
|
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), "该二维码不存在,请重新扫描");
|
||||||
|
}
|
||||||
|
if(vo.getMaCode()!=null && !vo.getMaCode().equals("")){
|
||||||
|
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), "该二维码已绑定,请勿重复绑定");
|
||||||
|
}
|
||||||
|
if(vo.getIsBindInventory()==1){
|
||||||
|
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), "该二维码已绑定,请勿重复绑定");
|
||||||
|
}
|
||||||
|
return AjaxResult.success(vo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -442,4 +442,63 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
t.task_id = #{taskId}
|
t.task_id = #{taskId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectByQrCode" resultType="com.bonus.common.biz.domain.purchase.PurchaseDto">
|
||||||
|
SELECT
|
||||||
|
type_id as typeId,
|
||||||
|
ma_code as maCode,
|
||||||
|
ma_status as status
|
||||||
|
FROM
|
||||||
|
ma_machine
|
||||||
|
where qr_code = #{qrCode}
|
||||||
|
</select>
|
||||||
|
<select id="getInventoryInfo" resultType="com.bonus.material.purchase.domain.vo.PurchaseVo">
|
||||||
|
select
|
||||||
|
bqi.qr_code as qrCode,
|
||||||
|
bqi.is_bind as isBindInventory,
|
||||||
|
bqi.ma_code as maCode,
|
||||||
|
bqi.type_id as typeId,
|
||||||
|
mt2.type_name as materialName,
|
||||||
|
mt1.type_name as materialModel
|
||||||
|
from bm_qrcode_info bqi
|
||||||
|
left join ma_type mt1 on bqi.type_id = mt1.type_id
|
||||||
|
left join ma_type mt2 on mt1.parent_id = mt2.type_id
|
||||||
|
where qr_code = #{qrCode} and bqi.del_flag = 0
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<update id="updateQrCodeInfo">
|
||||||
|
UPDATE bm_qrcode_info
|
||||||
|
SET
|
||||||
|
ma_code = #{maCode},
|
||||||
|
status = 1,
|
||||||
|
update_by = #{updateBy},
|
||||||
|
update_time = now(),
|
||||||
|
is_bind = 1,
|
||||||
|
bind_user = #{updateBy}
|
||||||
|
WHERE qr_code = #{qrCode} and del_flag = 0
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<insert id="insertMachineBind">
|
||||||
|
insert into ma_machine
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="maCode != null">ma_code,</if>
|
||||||
|
ma_status,
|
||||||
|
<if test="qrCode != null">qr_code,</if>
|
||||||
|
<if test="typeId != null">type_id,</if>
|
||||||
|
<if test="outFacCode != null">out_fac_code,</if>
|
||||||
|
create_time
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="maCode != null">#{maCode},</if>
|
||||||
|
1,
|
||||||
|
<if test="qrCode != null">#{qrCode},</if>
|
||||||
|
<if test="typeId != null">#{typeId},</if>
|
||||||
|
<if test="outFacCode != null">#{outFacCode},</if>
|
||||||
|
now()
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<select id="selectMaCodeCount" resultType="java.lang.Integer">
|
||||||
|
select count(1) from ma_machine where ma_code = #{maCode}
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue