This commit is contained in:
parent
ce9c84fb93
commit
5754e50bd2
|
|
@ -28,7 +28,9 @@ public enum MaMachineStatusEnum {
|
||||||
SCRAP_AUDIT(8, "已报废审核"),
|
SCRAP_AUDIT(8, "已报废审核"),
|
||||||
BACK_TO_STORE(9, "退料待入库"),
|
BACK_TO_STORE(9, "退料待入库"),
|
||||||
SCRAP_TO_AUDIT(10, "报废待审核"),
|
SCRAP_TO_AUDIT(10, "报废待审核"),
|
||||||
RETURNED_MATERIAL(11, "退料暂存");
|
RETURNED_MATERIAL(11, "退料暂存"),
|
||||||
|
// 信息采集
|
||||||
|
INFORMATION_COLLECTION(-1, "信息采集待入库");
|
||||||
|
|
||||||
private final Integer status;
|
private final Integer status;
|
||||||
private final String statusName;
|
private final String statusName;
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,11 @@ import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
import com.bonus.common.core.web.page.TableDataInfo;
|
import com.bonus.common.core.web.page.TableDataInfo;
|
||||||
import com.bonus.common.log.annotation.SysLog;
|
import com.bonus.common.log.annotation.SysLog;
|
||||||
import com.bonus.common.log.enums.OperaType;
|
import com.bonus.common.log.enums.OperaType;
|
||||||
import com.bonus.common.security.annotation.RequiresPermissions;
|
|
||||||
import com.bonus.material.basic.domain.BmQrBoxInfo;
|
import com.bonus.material.basic.domain.BmQrBoxInfo;
|
||||||
import com.bonus.material.basic.domain.dto.BoxBindWarehouseDto;
|
import com.bonus.material.basic.domain.dto.BoxBindWarehouseDto;
|
||||||
import com.bonus.material.basic.service.BmQrBoxService;
|
import com.bonus.material.basic.service.BmQrBoxService;
|
||||||
import com.bonus.material.common.annotation.PreventRepeatSubmit;
|
import com.bonus.material.common.annotation.PreventRepeatSubmit;
|
||||||
|
import com.bonus.material.ma.domain.Machine;
|
||||||
import com.bonus.material.ma.domain.TypeKeeper;
|
import com.bonus.material.ma.domain.TypeKeeper;
|
||||||
import com.bonus.material.ma.service.ITypeKeeperService;
|
import com.bonus.material.ma.service.ITypeKeeperService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
|
|
@ -290,4 +290,30 @@ public class BmQrBoxController extends BaseController {
|
||||||
return AjaxResult.error("查询失败,请联系管理员");
|
return AjaxResult.error("查询失败,请联系管理员");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据编码查询信息
|
||||||
|
* @param info
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "根据编码查询信息")
|
||||||
|
@GetMapping("/getMaCodeList")
|
||||||
|
public AjaxResult getMaCodeList(BmQrBoxInfo info) {
|
||||||
|
try {
|
||||||
|
return qrBoxService.getMaCodeList(info);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return AjaxResult.error("查询失败,请联系管理员");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APP -- 编码绑定标准箱
|
||||||
|
* @param machine
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "APP -- 编码绑定标准箱")
|
||||||
|
@PostMapping("/app_code_bind")
|
||||||
|
public AjaxResult addMaCodeBoxBind(@RequestBody @NotNull(message = "参数不能为空") Machine machine) {
|
||||||
|
return qrBoxService.addMaCodeBoxBind(machine);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package com.bonus.material.basic.service;
|
||||||
import com.bonus.common.core.web.domain.AjaxResult;
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
import com.bonus.material.basic.domain.BmQrBoxInfo;
|
import com.bonus.material.basic.domain.BmQrBoxInfo;
|
||||||
import com.bonus.material.basic.domain.dto.BoxBindWarehouseDto;
|
import com.bonus.material.basic.domain.dto.BoxBindWarehouseDto;
|
||||||
|
import com.bonus.material.ma.domain.Machine;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -126,4 +127,18 @@ public interface BmQrBoxService {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
AjaxResult getBoxDetails(BoxBindWarehouseDto info);
|
AjaxResult getBoxDetails(BoxBindWarehouseDto info);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据编码查询信息
|
||||||
|
* @param info
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
AjaxResult getMaCodeList(BmQrBoxInfo info);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APP -- 编码绑定标准箱
|
||||||
|
* @param machine
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
AjaxResult addMaCodeBoxBind(Machine machine);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ import com.bonus.material.basic.domain.dto.BoxBindWarehouseDto;
|
||||||
import com.bonus.material.basic.domain.vo.BoxInfoBindVo;
|
import com.bonus.material.basic.domain.vo.BoxInfoBindVo;
|
||||||
import com.bonus.material.basic.mapper.BmQrBoxMapper;
|
import com.bonus.material.basic.mapper.BmQrBoxMapper;
|
||||||
import com.bonus.material.basic.service.BmQrBoxService;
|
import com.bonus.material.basic.service.BmQrBoxService;
|
||||||
|
import com.bonus.material.ma.domain.Machine;
|
||||||
import com.bonus.material.ma.domain.vo.MachineVo;
|
import com.bonus.material.ma.domain.vo.MachineVo;
|
||||||
import com.bonus.material.ma.mapper.MachineMapper;
|
import com.bonus.material.ma.mapper.MachineMapper;
|
||||||
import com.bonus.material.purchase.config.RemoteConfig;
|
import com.bonus.material.purchase.config.RemoteConfig;
|
||||||
|
|
@ -418,7 +419,7 @@ public class BmQrBoxServiceImpl implements BmQrBoxService {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 物资状态要求是待入库、在库状态
|
// 物资状态要求是待入库、在库状态
|
||||||
final MachineVo machineVo = machineMapper.selectMachineByMaCode(bmQrBoxInfo.getQrCode());
|
final MachineVo machineVo = machineMapper.selectMachineByMaCode(bmQrBoxInfo);
|
||||||
if (null == machineVo || null == machineVo.getMaId()) {
|
if (null == machineVo || null == machineVo.getMaId()) {
|
||||||
return AjaxResult.error("物资信息不存在!");
|
return AjaxResult.error("物资信息不存在!");
|
||||||
}
|
}
|
||||||
|
|
@ -648,6 +649,91 @@ public class BmQrBoxServiceImpl implements BmQrBoxService {
|
||||||
return AjaxResult.success(list);
|
return AjaxResult.success(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据编码查询信息
|
||||||
|
* @param info
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AjaxResult getMaCodeList(BmQrBoxInfo info) {
|
||||||
|
// 先根据编码查询ma_machine
|
||||||
|
MachineVo machineVo = machineMapper.selectMachineByMaCode(info);
|
||||||
|
if (machineVo != null) {
|
||||||
|
if (!Objects.equals(machineVo.getMaStatus(), MaMachineStatusEnum.INFORMATION_COLLECTION.getStatus().toString())) {
|
||||||
|
return AjaxResult.error("物资状态非信息采集待入库状态,无法操作!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 先根据编码查询ws_ma_info
|
||||||
|
MachineVo wsMaInfo = machineMapper.selectMaInfoByMaCode(info);
|
||||||
|
return AjaxResult.success(wsMaInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加标准箱绑定物资信息
|
||||||
|
* @param machine
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public AjaxResult addMaCodeBoxBind(Machine machine) {
|
||||||
|
if (null == machine.getBoxId()) {return AjaxResult.error("标准箱ID为空,请完善后重试!");}
|
||||||
|
if (null == machine.getMaCode()) {return AjaxResult.error("编码为空,请完善后重试!");}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 先查询数据是否存在
|
||||||
|
BmQrBoxInfo bmQrBoxInfo = new BmQrBoxInfo();
|
||||||
|
bmQrBoxInfo.setMaCode(machine.getMaCode());
|
||||||
|
MachineVo vo = machineMapper.selectMachineByMaCode(bmQrBoxInfo);
|
||||||
|
machine.setMaStatus(MaMachineStatusEnum.INFORMATION_COLLECTION.getStatus().toString());
|
||||||
|
if (vo != null) {
|
||||||
|
machine.setMaId(vo.getMaId());
|
||||||
|
machine.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
int i = machineMapper.updateMachine(machine);
|
||||||
|
if (0 == i) {
|
||||||
|
return AjaxResult.error("更新绑定机具失败");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 先走新增获取maId,状态为待在库
|
||||||
|
machine.setCreateTime(DateUtils.getNowDate());
|
||||||
|
int result = machineMapper.insertMachine(machine);
|
||||||
|
if (0 == result) {
|
||||||
|
return AjaxResult.error("新增绑定机具失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 此物资未在其他标准型入过库,才可以绑定
|
||||||
|
if (0 < bmQrBoxMapper.existsMaId(machine.getMaId())) {
|
||||||
|
return AjaxResult.error("该物资已绑定其他标准箱,无法再次绑定!");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 一个标准型只有1种类型
|
||||||
|
final List<Long> boxMaTypeList = bmQrBoxMapper.getBoxMaTypeList(machine.getBoxId());
|
||||||
|
if (!boxMaTypeList.isEmpty()) {
|
||||||
|
if (1 < boxMaTypeList.size()) {
|
||||||
|
return AjaxResult.error("该标准箱已绑定多种物资,无法进行操作,请联系运维人员处理!");
|
||||||
|
}
|
||||||
|
if (!Objects.equals(boxMaTypeList.get(0), machine.getTypeId())) {
|
||||||
|
return AjaxResult.error("该标准箱已绑定其他类型物资,无法绑定此类型!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 验证通过,进行数据处理
|
||||||
|
bmQrBoxInfo.setMaId(machine.getMaId());
|
||||||
|
bmQrBoxInfo.setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName());
|
||||||
|
bmQrBoxInfo.setCreateTime(DateUtils.getNowDate());
|
||||||
|
bmQrBoxInfo.setBoxId(machine.getBoxId());
|
||||||
|
if (0 < bmQrBoxMapper.addQrcodeBoxBind(bmQrBoxInfo)) {
|
||||||
|
// 修改标准箱状态为已完成
|
||||||
|
bmQrBoxInfo.setStatus(QrBoxStatusEnum.QR_BOX_STATUS_WAIT_TRANSFER.getStatus().toString());
|
||||||
|
bmQrBoxMapper.updateBmQrcodeStatus(bmQrBoxInfo);
|
||||||
|
return AjaxResult.success(HttpCodeEnum.SUCCESS.getMsg());
|
||||||
|
}
|
||||||
|
return AjaxResult.error("绑定失败:成功绑定0条");
|
||||||
|
} catch (final Exception e) {
|
||||||
|
System.err.println("绑定失败,SQL执行异常:" + e.getMessage());
|
||||||
|
return AjaxResult.error("绑定失败,SQL执行异常:" + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private int updateBoxStatus(BoxBindWarehouseDto boxMa) {
|
private int updateBoxStatus(BoxBindWarehouseDto boxMa) {
|
||||||
int result = 0;
|
int result = 0;
|
||||||
result = bmQrBoxMapper.updateBoxStatus(boxMa);
|
result = bmQrBoxMapper.updateBoxStatus(boxMa);
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,11 @@ package com.bonus.material.ma.controller;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
import cn.hutool.core.convert.Convert;
|
import cn.hutool.core.convert.Convert;
|
||||||
import com.bonus.common.biz.annotation.StoreLog;
|
|
||||||
import com.bonus.common.biz.config.ListPagingUtil;
|
import com.bonus.common.biz.config.ListPagingUtil;
|
||||||
import com.bonus.common.core.utils.ServletUtils;
|
import com.bonus.common.core.utils.ServletUtils;
|
||||||
import com.bonus.common.log.enums.OperaType;
|
import com.bonus.common.log.enums.OperaType;
|
||||||
|
|
|
||||||
|
|
@ -243,4 +243,7 @@ public class Machine extends BaseEntity
|
||||||
|
|
||||||
@ApiModelProperty(value = "入库时间")
|
@ApiModelProperty(value = "入库时间")
|
||||||
private String inputTime;
|
private String inputTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "标准箱ID")
|
||||||
|
private Long boxId;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import java.util.List;
|
||||||
|
|
||||||
import com.bonus.common.biz.domain.lease.LeaseApplyInfo;
|
import com.bonus.common.biz.domain.lease.LeaseApplyInfo;
|
||||||
import com.bonus.common.biz.domain.lease.LeaseOutDetails;
|
import com.bonus.common.biz.domain.lease.LeaseOutDetails;
|
||||||
|
import com.bonus.material.basic.domain.BmQrBoxInfo;
|
||||||
import com.bonus.material.ma.domain.Machine;
|
import com.bonus.material.ma.domain.Machine;
|
||||||
import com.bonus.material.ma.domain.Type;
|
import com.bonus.material.ma.domain.Type;
|
||||||
import com.bonus.material.ma.domain.vo.MachineVo;
|
import com.bonus.material.ma.domain.vo.MachineVo;
|
||||||
|
|
@ -29,10 +30,10 @@ public interface MachineMapper
|
||||||
/**
|
/**
|
||||||
* 查询机具设备编码信息
|
* 查询机具设备编码信息
|
||||||
*
|
*
|
||||||
* @param qrCode QR编码
|
* @param bmQrBoxInfo
|
||||||
* @return 机具设备管理
|
* @return 机具设备管理
|
||||||
*/
|
*/
|
||||||
MachineVo selectMachineByMaCode(String qrCode);
|
MachineVo selectMachineByMaCode(BmQrBoxInfo bmQrBoxInfo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询机具设备管理列表
|
* 查询机具设备管理列表
|
||||||
|
|
@ -173,4 +174,11 @@ public interface MachineMapper
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<Machine> getInfoByMaCode(Machine machine);
|
List<Machine> getInfoByMaCode(Machine machine);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 先根据编码查询ws_ma_info
|
||||||
|
* @param info
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
MachineVo selectMaInfoByMaCode(BmQrBoxInfo info);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,6 @@ import com.bonus.material.settlement.mapper.SltAgreementInfoMapper;
|
||||||
import com.bonus.material.warehouse.domain.WhHouseSet;
|
import com.bonus.material.warehouse.domain.WhHouseSet;
|
||||||
import com.bonus.material.warehouse.service.IWhHouseSetService;
|
import com.bonus.material.warehouse.service.IWhHouseSetService;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.bonus.material.ma.mapper.TypeMapper;
|
import com.bonus.material.ma.mapper.TypeMapper;
|
||||||
import com.bonus.material.ma.domain.Type;
|
import com.bonus.material.ma.domain.Type;
|
||||||
|
|
|
||||||
|
|
@ -396,8 +396,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
ma_type_repair mtr on ma.type_id = mtr.type_id
|
ma_type_repair mtr on ma.type_id = mtr.type_id
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
bm_asset_attributes baa on ma.assets_id = baa.id
|
bm_asset_attributes baa on ma.assets_id = baa.id
|
||||||
where
|
where 1 = 1
|
||||||
ma.qr_code = #{qrCode}
|
<if test="maCode != null and maCode != ''">
|
||||||
|
and ma.ma_code = #{maCode}
|
||||||
|
</if>
|
||||||
|
<if test="qrCode != null and qrCode != ''">
|
||||||
|
and ma.qr_code = #{qrCode}
|
||||||
|
</if>
|
||||||
group by
|
group by
|
||||||
ma.ma_id
|
ma.ma_id
|
||||||
limit 1
|
limit 1
|
||||||
|
|
@ -722,4 +727,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
and ma.qr_code = #{qrCode}
|
and ma.qr_code = #{qrCode}
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectMaInfoByMaCode" resultType="com.bonus.material.ma.domain.vo.MachineVo">
|
||||||
|
SELECT
|
||||||
|
ma_name as materialName,
|
||||||
|
ma_model as materialModel,
|
||||||
|
ma_code as maCode,
|
||||||
|
supplier as maVender,
|
||||||
|
this_check_time as thisCheckTime,
|
||||||
|
next_check_time as nextCheckTime,
|
||||||
|
repair_man as inspectMan,
|
||||||
|
check_man as checkMan,
|
||||||
|
model_id as typeId,
|
||||||
|
result as inspectStatus,
|
||||||
|
phone as phone
|
||||||
|
FROM
|
||||||
|
ws_ma_info
|
||||||
|
where ma_code = #{maCode}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue