优化及bug修复

This commit is contained in:
mashuai 2025-07-04 18:07:30 +08:00
parent 0901a311a0
commit 6e43c00a91
47 changed files with 750 additions and 117 deletions

View File

@ -110,8 +110,17 @@ public class LeaseOutDetails extends BaseEntity {
@ApiModelProperty(value = "是否完成 (0:未完成 1:已完成)")
private Integer isFinished;
@ApiModelProperty(value = "领料单位")
private String leaseUnit;
@ApiModelProperty(value = "领料工程")
private String leaseProject;
@ApiModelProperty(value = "是否退回 (0未退回1退回)")
private Integer isBack;
/**
* 领料出库机具编码集合
*/
private List<MaterialLeaseMaCodeDto> maCodeList;
private List<LeaseOutDetails> maCodeList;
}

View File

@ -316,4 +316,15 @@ public class BmQrBoxController extends BaseController {
public AjaxResult addMaCodeBoxBind(@RequestBody @NotNull(message = "参数不能为空") Machine machine) {
return qrBoxService.addMaCodeBoxBind(machine);
}
/**
* APP -- 查询新信息采集二维码标准箱绑定列表
* @param bean
* @return
*/
@ApiOperation(value = "APP -- 查询新信息采集二维码标准箱绑定列表")
@GetMapping("/app_box_bind_wsList")
public AjaxResult getBoxBindWsList(BmQrBoxInfo bean) {
return AjaxResult.success(getDataTable(qrBoxService.getBoxBindWsList(bean)));
}
}

View File

@ -79,4 +79,8 @@ public interface BmAgreementInfoMapper
* @return
*/
BmAgreementInfo queryByTeamIdAndProjectId(BmAgreementInfo bmAgreementInfo);
BmAgreementInfo queryByTeamIdAndProjectIdCl(BmAgreementInfo bmAgreementInfo);
int insertBmAgreementInfoClz(BmAgreementInfo bmAgreementInfo);
}

View File

@ -159,4 +159,18 @@ public interface BmQrBoxMapper {
* @return
*/
BoxBindWarehouseDto getBoxInfo(BoxBindWarehouseDto info);
/**
* 一个标准型只有1种类型
* @param boxId
* @return
*/
List<Long> getBoxWsTypeList(Long boxId);
/**
* 查询标准箱已绑定的仓库信息
* @param bean
* @return
*/
List<BmQrBoxInfo> getBoxBindWsList(BmQrBoxInfo bean);
}

View File

@ -141,4 +141,11 @@ public interface BmQrBoxService {
* @return
*/
AjaxResult addMaCodeBoxBind(Machine machine);
/**
* 查询移交库管员列表
* @param bean
* @return
*/
List<BmQrBoxInfo> getBoxBindWsList(BmQrBoxInfo bean);
}

View File

@ -656,13 +656,13 @@ public class BmQrBoxServiceImpl implements BmQrBoxService {
*/
@Override
public AjaxResult getMaCodeList(BmQrBoxInfo info) {
// 先根据编码查询ma_machine
/* // 先根据编码查询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);
@ -683,9 +683,9 @@ public class BmQrBoxServiceImpl implements BmQrBoxService {
// 先查询数据是否存在
BmQrBoxInfo bmQrBoxInfo = new BmQrBoxInfo();
bmQrBoxInfo.setMaCode(machine.getMaCode());
MachineVo vo = machineMapper.selectMachineByMaCode(bmQrBoxInfo);
machine.setMaStatus(MaMachineStatusEnum.INFORMATION_COLLECTION.getStatus().toString());
if (vo != null) {
//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);
@ -699,14 +699,14 @@ public class BmQrBoxServiceImpl implements BmQrBoxService {
if (0 == result) {
return AjaxResult.error("新增绑定机具失败");
}
}
}*/
// 此物资未在其他标准型入过库才可以绑定
if (0 < bmQrBoxMapper.existsMaId(machine.getMaId())) {
return AjaxResult.error("该物资已绑定其他标准箱,无法再次绑定!");
}
// 一个标准型只有1种类型
final List<Long> boxMaTypeList = bmQrBoxMapper.getBoxMaTypeList(machine.getBoxId());
final List<Long> boxMaTypeList = bmQrBoxMapper.getBoxWsTypeList(machine.getBoxId());
if (!boxMaTypeList.isEmpty()) {
if (1 < boxMaTypeList.size()) {
return AjaxResult.error("该标准箱已绑定多种物资,无法进行操作,请联系运维人员处理!");
@ -721,8 +721,11 @@ public class BmQrBoxServiceImpl implements BmQrBoxService {
bmQrBoxInfo.setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName());
bmQrBoxInfo.setCreateTime(DateUtils.getNowDate());
bmQrBoxInfo.setBoxId(machine.getBoxId());
// 关联ws_ma_info
bmQrBoxInfo.setBoxType("0");
bmQrBoxMapper.updateBmQrcodeInfoById(bmQrBoxInfo);
if (0 < bmQrBoxMapper.addQrcodeBoxBind(bmQrBoxInfo)) {
// 修改标准箱状态为已完成
// 修改标准箱状态为待移交
bmQrBoxInfo.setStatus(QrBoxStatusEnum.QR_BOX_STATUS_WAIT_TRANSFER.getStatus().toString());
bmQrBoxMapper.updateBmQrcodeStatus(bmQrBoxInfo);
return AjaxResult.success(HttpCodeEnum.SUCCESS.getMsg());
@ -734,6 +737,16 @@ public class BmQrBoxServiceImpl implements BmQrBoxService {
}
}
/**
* 获取标准箱绑定物资信息
* @param bean
* @return
*/
@Override
public List<BmQrBoxInfo> getBoxBindWsList(BmQrBoxInfo bean) {
return bmQrBoxMapper.getBoxBindWsList(bean);
}
private int updateBoxStatus(BoxBindWarehouseDto boxMa) {
int result = 0;
result = bmQrBoxMapper.updateBoxStatus(boxMa);

View File

@ -109,4 +109,9 @@ public class BmTeam {
* 班组长账号
*/
private String idCard;
/**
* 单位类型id
*/
private Long typeId;
}

View File

@ -278,4 +278,7 @@ public class MaterialLeaseApplyInfo extends BaseEntity {
@ApiModelProperty(value="工程id")
private Long proId;
@ApiModelProperty(value = "协议id集合")
private List<Long> agreementIdList;
}

View File

@ -3,6 +3,7 @@ package com.bonus.material.clz.mapper;
import com.bonus.common.biz.domain.TypeTreeNode;
import com.bonus.common.biz.domain.lease.LeaseOutDetails;
import com.bonus.material.back.domain.vo.MaCodeVo;
import com.bonus.material.basic.domain.BmAgreementInfo;
import com.bonus.material.basic.domain.BmQrcodeInfo;
import com.bonus.material.clz.domain.vo.MaterialMaCodeVo;
import com.bonus.material.ma.domain.Type;
@ -269,4 +270,18 @@ public interface MaterialLeaseInfoMapper {
* @return
*/
BigDecimal getStorageNum(@Param("agreementId") Long agreementId, @Param("typeId") Long typeId);
/**
* 根据工程id去协议表中查询协议id
* @param bean
* @return
*/
List<BmAgreementInfo> getAgreementIdByProId(MaterialLeaseApplyInfo bean);
/**
* 根据工程和班组id查询协议id
* @param bean
* @return
*/
BmAgreementInfo getAgreeId(MaterialLeaseApplyInfo bean);
}

View File

@ -115,6 +115,8 @@ public class IwsTeamUserServiceImpl implements IwsTeamUserService {
bmTeam.setIdCard(StringUtils.isNotBlank(iwsTeamUserVo.getTeamLeaderIdCard()) ? iwsTeamUserVo.getTeamLeaderIdCard() : null);
bmTeam.setProjectId(StringUtils.isNotBlank(iwsTeamUserVo.getProjectId()) ? iwsTeamUserVo.getProjectId() : null);
bmTeam.setRelPhone(StringUtils.isNotBlank(iwsTeamUserVo.getTeamLeaderPhone()) ? iwsTeamUserVo.getTeamLeaderPhone() : null);
// 班组类型固定传值
bmTeam.setTypeId(1731L);
// 根据班组名称去bm_unit表查询班组信息
BmTeam bmTeam1 = bmTeamMapper.selectByName(bmTeam);
if (bmTeam1 == null) {

View File

@ -493,12 +493,14 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
bmAgreementInfo.setUnitId(leaseApplyRequestVo.getLeaseApplyInfo().getTeamId());
bmAgreementInfo.setCreateTime(DateUtils.getNowDate());
bmAgreementInfo.setCreateBy(createBy);
bmAgreementInfo.setSignTime(DateUtils.getNowDate());
bmAgreementInfo.setAgreementCode(getAgreementCode());
// 先根据班组和工程id查询若存在则直接返回不存在则新增
BmAgreementInfo info = bmAgreementInfoMapper.queryByTeamIdAndProjectId(bmAgreementInfo);
BmAgreementInfo info = bmAgreementInfoMapper.queryByTeamIdAndProjectIdCl(bmAgreementInfo);
if (info != null) {
leaseApplyRequestVo.getLeaseApplyInfo().setAgreementId(info.getAgreementId());
} else {
int count = bmAgreementInfoMapper.insertBmAgreementInfo(bmAgreementInfo);
int count = bmAgreementInfoMapper.insertBmAgreementInfoClz(bmAgreementInfo);
if (count > 0) {
leaseApplyRequestVo.getLeaseApplyInfo().setAgreementId(bmAgreementInfo.getAgreementId());
} else {
@ -540,6 +542,19 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
}
}
/**
* 获取协议编号
* @return
*/
private String getAgreementCode() {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
Date nowDate = DateUtils.getNowDate();
String format = dateFormat.format(nowDate);
String result = format.replace("-", "");
int num = bmAgreementInfoMapper.selectNumByMonth(nowDate);
return MaterialConstants.AGREEMENT_PREFIX + result + String.format("-%03d", num + 1);
}
/**
* 修改领料任务
* @param leaseApplyRequestVo
@ -781,72 +796,118 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
List<TypeTreeNode> listL4 = new ArrayList<>();
List<TypeTreeNode> listL3 = new ArrayList<>();
List<TypeTreeNode> listL21 = new ArrayList<>();
List<TypeTreeNode> listL5 = new ArrayList<>();
List<TypeTreeNode> list7 = new ArrayList<>();
try {
// 先查第四层类型
BackApplyInfo backApplyInfo = new BackApplyInfo();
backApplyInfo.setAgreementId(bean.getAgreementId());
listL4 = mapper.getUseTypeTreeL4(backApplyInfo);
// 根据协议id去clz_slt_agreement_info材料站协议表中查询在用设备进行数据筛选去除
List<TypeTreeNode> list5 = materialLeaseInfoMapper.getUseTypeTree(bean);
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(listL4)) {
if (!CollectionUtils.isEmpty(list5)) {
// 将list4中typeId和list5中相同数据进行num相减并剔除相减后为0的数据
Map<Long, BigDecimal> typeIdToNum = list5.stream()
.collect(Collectors.toMap(
TypeTreeNode::getTypeId,
TypeTreeNode::getNum,
BigDecimal::add
));
Iterator<TypeTreeNode> iterator = listL4.iterator();
while (iterator.hasNext()) {
TypeTreeNode node = iterator.next();
Long typeId = node.getTypeId();
// 获取要减去的值默认值为BigDecimal.ZERO
BigDecimal subtractNum = typeIdToNum.getOrDefault(typeId, BigDecimal.ZERO);
// 计算新值处理num为null的情况若业务允许
BigDecimal currentNum = Optional.ofNullable(node.getNum())
.orElse(BigDecimal.ZERO);
BigDecimal newNum = currentNum.subtract(subtractNum);
if (newNum.compareTo(BigDecimal.ZERO) == 0) {
iterator.remove();
} else {
node.setNum(newNum);
if (!CollectionUtils.isEmpty(bean.getAgreementIdList())) {
for (Long agreementId : bean.getAgreementIdList()) {
backApplyInfo.setAgreementId(agreementId);
listL4 = mapper.getUseTypeTreeL4(backApplyInfo);
if (!CollectionUtils.isEmpty(listL4)) {
// 将listL5中typeId相同的数据进行num相加
for (TypeTreeNode node : listL4) {
// 根据node中的typeId查询listL5中相同数据,如果在listL5中存在则将num相加,反之将node添加到list5中
TypeTreeNode node1 = listL5.stream()
.filter(item -> item.getTypeId() == (node.getTypeId()))
.findFirst()
.orElse(null);
if (node1 != null) {
node1.setNum(node1.getNum().add(node.getNum()));
}
if (node1 == null) {
listL5.add(node);
}
}
}
}
}
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(listL4)) {
for (TypeTreeNode node : listL4) {
// 根据协议id以及typeId查询在用量
if (bean.getAgreementId() != null) {
Type maType = new Type();
maType.setAgreementId(bean.getAgreementId());
maType.setTypeId(node.getTypeId());
Type dto = typeMapper.getNumList(maType);
if (dto != null) {
node.setUseNum(dto.getUseNum());
// 根据工程id去协议表中查询协议id
List<BmAgreementInfo> listAgreement = materialLeaseInfoMapper.getAgreementIdByProId(bean);
if (!CollectionUtils.isEmpty(listAgreement)) {
for (BmAgreementInfo agreementInfo : listAgreement) {
bean.setAgreementId(agreementInfo.getAgreementId());
List<TypeTreeNode> list6 = materialLeaseInfoMapper.getUseTypeTree(bean);
if (!CollectionUtils.isEmpty(list6)) {
for (TypeTreeNode node : list6) {
// 根据node中的typeId查询listL7中相同数据,如果在listL7中存在则将num相加,反之将node添加到list7中
TypeTreeNode node1 = list7.stream()
.filter(item -> item.getTypeId() == (node.getTypeId()))
.findFirst()
.orElse(null);
if (node1 != null) {
node1.setNum(node1.getNum().add(node.getNum()));
}
if (node1 == null) {
list7.add(node);
}
}
}
}
}
// 根据协议id去clz_slt_agreement_info材料站协议表中查询在用设备进行数据筛选去除
if (!CollectionUtils.isEmpty(listL5)) {
if (!CollectionUtils.isEmpty(list7)) {
// 将list5中typeId和list7中相同数据进行num相减并剔除相减后为0的数据
Map<Long, BigDecimal> typeIdToNum = list7.stream()
.collect(Collectors.toMap(
TypeTreeNode::getTypeId,
TypeTreeNode::getNum,
BigDecimal::add
));
Iterator<TypeTreeNode> iterator = listL5.iterator();
while (iterator.hasNext()) {
TypeTreeNode node = iterator.next();
Long typeId = node.getTypeId();
// 获取要减去的值默认值为BigDecimal.ZERO
BigDecimal subtractNum = typeIdToNum.getOrDefault(typeId, BigDecimal.ZERO);
// 计算新值处理num为null的情况若业务允许
BigDecimal currentNum = Optional.ofNullable(node.getNum())
.orElse(BigDecimal.ZERO);
BigDecimal newNum = currentNum.subtract(subtractNum);
if (newNum.compareTo(BigDecimal.ZERO) == 0) {
iterator.remove();
} else {
node.setNum(newNum);
}
}
}
}
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(listL5)) {
for (TypeTreeNode node : listL5) {
// 根据协议id以及typeId查询在用量
if (bean.getAgreementId() != null) {
// 根据工程和班组id查询协议id
BmAgreementInfo info = materialLeaseInfoMapper.getAgreeId(bean);
Type maType = new Type();
maType.setAgreementId(info.getAgreementId());
maType.setTypeId(node.getTypeId());
Type dto = typeMapper.getNumList(maType);
if (dto != null) {
node.setUseNum(dto.getUseNum());
} else {
node.setUseNum(BigDecimal.ZERO);
}
} else {
node.setUseNum(BigDecimal.ZERO);
}
} else {
node.setUseNum(BigDecimal.ZERO);
}
List<Long> list4ParentIds = listL5.stream().map(TypeTreeNode::getParentId).collect(Collectors.toList());
// 根据第四层parentId 查第三层类型
listL3 = mapper.getUseTypeTreeL3(list4ParentIds);
List<Long> list3ParentIds = listL3.stream().map(TypeTreeNode::getParentId).collect(Collectors.toList());
// 根据第三层parentId 查第1.2层类型
listL21 = mapper.getUseTypeTreeL21(list3ParentIds);
list.addAll(listL5);
list.addAll(listL3);
list.addAll(listL21);
}
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(list)) {
// 创建树形结构数据集合作为参数
TypeTreeBuild treeBuild = new TypeTreeBuild(list);
// 原查询结果转换树形结构
groupList = treeBuild.buildTree();
}
List<Long> list4ParentIds = listL4.stream().map(TypeTreeNode::getParentId).collect(Collectors.toList());
// 根据第四层parentId 查第三层类型
listL3 = mapper.getUseTypeTreeL3(list4ParentIds);
List<Long> list3ParentIds = listL3.stream().map(TypeTreeNode::getParentId).collect(Collectors.toList());
// 根据第三层parentId 查第1.2层类型
listL21 = mapper.getUseTypeTreeL21(list3ParentIds);
list.addAll(listL4);
list.addAll(listL3);
list.addAll(listL21);
}
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(list)) {
// 创建树形结构数据集合作为参数
TypeTreeBuild treeBuild = new TypeTreeBuild(list);
// 原查询结果转换树形结构
groupList = treeBuild.buildTree();
}
} catch (Exception e) {
AjaxResult.error("类型树-查询失败", e);

View File

@ -4,6 +4,8 @@ import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* 机具信息实体类对应数据库表 ws_ma_info
* 用于记录每台机具的基础信息检修信息检验情况等
@ -96,4 +98,14 @@ public class WsMaInfo {
* 最后更新时间建议格式 yyyy-MM-dd HH:mm:ss
*/
private String optTime;
/**
* 编码集合
*/
private List<String> maCodeList;
/**
* 二维码
*/
private String qrCode;
}

View File

@ -82,12 +82,10 @@ public interface WsMaInfoMapper {
/**
* 判断编码是否存在
*
* @param maModel 规格
* @param maCode 编码
* @return 条数
*/
int existsByModelAndCode(@Param("maModel") String maModel, @Param("maCode") String maCode);
int existsByModelAndCode(@Param("maCode") String maCode);
/**
* 更新时间

View File

@ -1,5 +1,6 @@
package com.bonus.material.codeCollection.service.impl;
import com.alibaba.nacos.common.utils.CollectionUtils;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.material.codeCollection.domain.WsMaInfo;
import com.bonus.material.codeCollection.mapper.WsMaInfoMapper;
@ -74,12 +75,22 @@ public class WsMaInfoServiceImpl implements WsMaInfoService {
*/
@Override
public AjaxResult save(WsMaInfo info) {
if (CollectionUtils.isEmpty(info.getMaCodeList())) {
return AjaxResult.error("机具编码不能为空");
}
try {
int i = mapper.existsByModelAndCode(info.getMaModel(), info.getMaCode());
if (i > 0) {
return AjaxResult.error("该机具规格与编码已存在,请勿重复添加!");
for (String maCode : info.getMaCodeList()) {
info.setMaCode(maCode);
int i = mapper.existsByModelAndCode(info.getMaCode());
if (i > 0) {
return AjaxResult.error(info.getMaCode() + ":该机具规格与编码已存在,请勿重复添加!");
}
}
int result = 0;
for (String maCode : info.getMaCodeList()) {
info.setMaCode(maCode);
result = mapper.insert(info);
}
int result = mapper.insert(info);
return result > 0 ? AjaxResult.success("新增成功") : AjaxResult.error("新增失败");
} catch (Exception e) {
log.error(e.getMessage());
@ -100,7 +111,7 @@ public class WsMaInfoServiceImpl implements WsMaInfoService {
if (info.getId() == null) {
return AjaxResult.error("ID不能为空");
}
int i = mapper.existsByModelAndCode(info.getMaModel(), info.getMaCode());
int i = mapper.existsByModelAndCode(info.getMaCode());
if (i > 1) {
return AjaxResult.error("该机具规格与编码已存在,请勿重复添加!");
}
@ -142,7 +153,7 @@ public class WsMaInfoServiceImpl implements WsMaInfoService {
public AjaxResult getMaTypeData() {
try {
List<Map<String, Objects>> maTypeData = mapper.getMaTypeData();
return ObjectUtils.isNotEmpty(maTypeData) ? AjaxResult.success(maTypeData) : AjaxResult.error("");
return ObjectUtils.isNotEmpty(maTypeData) ? AjaxResult.success(maTypeData) : AjaxResult.success();
} catch (Exception e) {
log.error(e.getMessage());
return AjaxResult.error("");

View File

@ -193,4 +193,11 @@ public interface SelectMapper {
* @return
*/
List<BmProject> getProjectInfo(BmProject bmProject);
/**
* 获取往来单位id和标段工程id获取协议信息
* @param dto
* @return
*/
List<AgreementVo> getAgreementInfoBy(SelectDto dto);
}

View File

@ -154,6 +154,7 @@ public class SelectServiceImpl implements SelectService {
@Override
public AjaxResult getTeamList(ProAuthorizeInfo bean) {
try {
// 班组固定查询typeId为1731
return AjaxResult.success(mapper.getTeamList(bean));
} catch (Exception e) {
log.error("班组-查询失败", e);
@ -455,14 +456,22 @@ public class SelectServiceImpl implements SelectService {
@Override
public AjaxResult getAgreementInfoById(SelectDto dto) {
List<Integer> agreementIdList = new ArrayList<>();
AgreementVo vo = new AgreementVo();
try {
if (dto != null && dto.getTeamId() > 0) {
dto.setUnitId(dto.getTeamId());
}
List<AgreementVo> list = mapper.getAgreementInfoById(dto);
if (CollectionUtils.isNotEmpty(list)) {
vo = list.get(0);
List<AgreementVo> list = mapper.getAgreementInfoBy(dto);
if (CollectionUtils.isNotEmpty(list)) {
for (AgreementVo agreementVo : list) {
agreementIdList.add(agreementVo.getAgreementId());
}
}
return AjaxResult.success(agreementIdList);
} else {
List<AgreementVo> list = mapper.getAgreementInfoById(dto);
if (CollectionUtils.isNotEmpty(list)) {
vo = list.get(0);
}
}
} catch (Exception e) {
log.error("往来单位id和标段工程id获取协议信息", e);

View File

@ -295,6 +295,21 @@ public class LeaseApplyInfoController extends BaseController {
}
}
/**
* 信息采集领料出库
* @param leaseOutRequestVo
* @return
*/
@ApiOperation(value = "信息采集领料出库")
@PostMapping("/leaseOutByInfo")
public AjaxResult leaseOutByInfo(@NotNull(message = "领料出库信息不能为空") @RequestBody LeaseOutRequestVo leaseOutRequestVo) {
try {
return leaseApplyInfoService.leaseOutByInfo(leaseOutRequestVo);
} catch (Exception e) {
return error("系统错误, " + e.getMessage());
}
}
/**
* app领料出库退回
* @param leaseOutDetails

View File

@ -88,4 +88,18 @@ public interface LeaseOutDetailsMapper {
* @return
*/
int deleteLeaseOutDetails(LeaseOutDetails leaseOutDetails);
/**
* 添加领料出库明细lease_out_num
* @param record
* @return
*/
int insertLeaseOutNum(LeaseOutDetails record);
/**
* 修改机具数据
* @param record
* @return
*/
int updateMachine(LeaseOutDetails record);
}

View File

@ -168,4 +168,10 @@ public interface ILeaseApplyInfoService {
AjaxResult useExamine(LeaseApplyInfo leaseApplyInfo);
/**
* 信息采集领料出库
* @param leaseOutRequestVo
* @return
*/
AjaxResult leaseOutByInfo(LeaseOutRequestVo leaseOutRequestVo);
}

View File

@ -68,4 +68,11 @@ public interface ILeaseOutDetailsService {
* @return
*/
AjaxResult leaseOutBack(LeaseOutDetails leaseOutDetails);
/**
* 信息采集领料出库
* @param bean
* @return
*/
AjaxResult leaseOutByInfo(LeaseOutDetails bean);
}

View File

@ -573,6 +573,21 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
}
}
/**
* 信息采集领料出库
* @param leaseOutRequestVo
* @return
*/
@Override
public AjaxResult leaseOutByInfo(LeaseOutRequestVo leaseOutRequestVo) {
for (LeaseOutDetails bean : leaseOutRequestVo.getLeaseOutDetailsList()) {
AjaxResult ajaxResult = leaseOutDetailsService.leaseOutByInfo(bean);
if (ajaxResult.isError()) {
return ajaxResult;
}
}
return AjaxResult.success();
}
/**

View File

@ -270,6 +270,86 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
return AjaxResult.success("出库退回成功");
}
/**
* 信息采集领料出库
* @param record
* @return
*/
@Override
public AjaxResult leaseOutByInfo(LeaseOutDetails record) {
int res = 0;
try {
if (!CollectionUtils.isEmpty(record.getMaCodeList())) {
record.setCreateBy(SecurityUtils.getLoginUser().getUserid().toString());
record.setCreateTime(DateUtils.getNowDate());
record.setOutNum(record.getInputNum());
res = leaseOutDetailsMapper.insertLeaseOutDetails(record);
if (res == 0) {
return AjaxResult.error("出库失败");
}
for (LeaseOutDetails leaseOutDetails : record.getMaCodeList()) {
// 3插入出库记录修改库存修改机具状态
leaseOutDetails.setOutNum(BigDecimal.valueOf(1));
leaseOutDetails.setParentId(record.getParentId());
leaseOutDetails.setPublishTask(StringUtils.isNotBlank(record.getPublishTask()) ? record.getPublishTask() : null);
leaseOutDetails.setLeaseUnit(record.getLeaseUnit());
leaseOutDetails.setLeaseProject(record.getLeaseProject());
res = insertRecordsByInfo(leaseOutDetails);
if (res == 0) {
throw new RuntimeException("出库失败,更新设备规格库存数量时出错!");
}
// 4修改任务状态tm_task
res = updateTaskStatus(leaseOutDetails);
if (res == 0) {
throw new RuntimeException("出库失败,修改任务状态失败");
}
// 6如果标准箱入库需要将设备从标准箱移出
if (leaseOutDetails.getMaId() != null) {
// 先查询设备是否在标准箱中
List<BmQrBoxInfo> list = bmQrBoxMapper.selectByMaId(leaseOutDetails.getMaId());
if (!CollectionUtils.isEmpty(list)) {
res = updateBoxBind(leaseOutDetails);
if (res == 0) {
throw new RuntimeException("出库失败,移出设备失败");
}
}
}
}
} else {
return AjaxResult.error("机具编码不能为空");
}
} catch (Exception e) {
log.error(e.getMessage());
return AjaxResult.error("出库失败");
}
return AjaxResult.success("出库成功");
}
/**
* 信息采集领料出库
* @param record
* @return
*/
private int insertRecordsByInfo(LeaseOutDetails record) {
int res = 0;
// 首先更新领料任务详情表的领料数及状态lease_apply_details
res = leaseApplyDetailsMapper.updateLeaseApplyDetailsOutNum(record);
LeaseApplyDetails leaseApplyDetails = leaseApplyDetailsMapper.getLeaseApplyDetails(record);
if (leaseApplyDetails.getPreNum().equals(leaseApplyDetails.getAlNum()) || leaseApplyDetails.getAuditNum().equals(leaseApplyDetails.getAlNum())) {
leaseApplyDetailsMapper.updateLeaseApplyDetailsByLeaseOutRecord(record);
}
if (res > 0) {
// 插入领料出库明细表lease_out_details
record.setCreateBy(SecurityUtils.getLoginUser().getUserid().toString());
if (res > 0) {
res += leaseOutDetailsMapper.insertLeaseOutNum(record);
record.setIsBack(0);
res += leaseOutDetailsMapper.updateMachine(record);
}
}
return res;
}
/**
* 删除结算记录
* @param leaseOutDetails

View File

@ -303,4 +303,18 @@ public class MachineController extends BaseController {
return machineService.getHisByCode(machine);
}
/**
* 根据类型id获取编码
* @param machine
* @return
*/
@ApiOperation(value = "根据类型id获取编码")
@GetMapping(value = "/getInfoByTypeId")
public AjaxResult getInfoByTypeId(Machine machine) {
try {
return AjaxResult.success(machineService.getInfoByTypeId(machine));
} catch (Exception e) {
return error("查询失败,请联系管理员");
}
}
}

View File

@ -181,4 +181,11 @@ public interface MachineMapper
* @return
*/
MachineVo selectMaInfoByMaCode(BmQrBoxInfo info);
/**
* 根据typeId查询机具信息
* @param machine
* @return
*/
List<Machine> getInfoByTypeId(Machine machine);
}

View File

@ -126,4 +126,11 @@ public interface IMachineService
* @return
*/
List<Machine> getInfoByMaCode(Machine machine);
/**
* 根据类型id获取编码
* @param machine
* @return
*/
List<Machine> getInfoByTypeId(Machine machine);
}

View File

@ -444,4 +444,14 @@ public class MachineServiceImpl implements IMachineService
return infoByMaCode;
}
/**
* 根据类型id获取编码
* @param machine
* @return
*/
@Override
public List<Machine> getInfoByTypeId(Machine machine) {
return machineMapper.getInfoByTypeId(machine);
}
}

View File

@ -55,7 +55,7 @@ public class PurchaseBindController extends BaseController {
@PreventRepeatSubmit
// @RequiresPermissions("purchase:bind:add")
@PostMapping("/inventoryBind")
public AjaxResult inventoryBind(@RequestBody @NotNull(message = "参数不能为空") PurchaseDto dto) {
public AjaxResult inventoryBind(@RequestBody @NotNull(message = "参数不能为空") PurchaseVo dto) {
return purchaseBindService.inventoryBind(dto);
}

View File

@ -120,4 +120,6 @@ public class PurchaseVo {
private int isBindInventory;
private String updateBy;
}

View File

@ -152,9 +152,9 @@ public interface PurchaseBindMapper {
PurchaseVo getInventoryInfo(PurchaseDto dto);
int updateQrCodeInfo(PurchaseDto dto);
int updateQrCodeInfo(PurchaseVo dto);
int insertMachineBind(PurchaseDto dto);
int selectMaCodeCount(PurchaseDto dto);
int selectMaCodeCount(PurchaseVo dto);
}

View File

@ -57,7 +57,7 @@ public interface IPurchaseBindService {
AjaxResult getTypeByQrcode(PurchaseDto dto);
AjaxResult inventoryBind(PurchaseDto dto);
AjaxResult inventoryBind(PurchaseVo dto);
AjaxResult getInventoryInfo(PurchaseDto dto);
}

View File

@ -12,6 +12,8 @@ import com.bonus.common.core.utils.DateUtils;
import com.bonus.common.core.utils.StringUtils;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.security.utils.SecurityUtils;
import com.bonus.material.codeCollection.domain.WsMaInfo;
import com.bonus.material.codeCollection.mapper.WsMaInfoMapper;
import com.bonus.material.purchase.config.RemoteConfig;
import com.bonus.common.biz.domain.purchase.PurchaseDto;
import com.bonus.material.purchase.domain.PurchaseCheckDetails;
@ -54,6 +56,9 @@ public class PurchaseBindServiceImpl implements IPurchaseBindService {
@Resource
private PurchaseCheckDetailsMapper purchaseCheckDetailsMapper;
@Resource
private WsMaInfoMapper mapper;
/**
* 查询所有绑定信息
@ -142,7 +147,7 @@ public class PurchaseBindServiceImpl implements IPurchaseBindService {
return AjaxResult.error(1114,"二维码已绑定物资,请勿重复绑定");
}
if (CollectionUtils.isNotEmpty(tbBdDeviceRecord)) {
return AjaxResult.error(1114,"设备编码与库中重复,请勿重复添加");
return AjaxResult.error(1114,purchaseDto.getMaCode() + ":该设备编码与库中重复,请勿重复添加");
}
}
// 根据taskId查询厂商
@ -211,7 +216,7 @@ public class PurchaseBindServiceImpl implements IPurchaseBindService {
*/
@Override
@Transactional(rollbackFor = Exception.class)
public AjaxResult inventoryBind(PurchaseDto dto) {
public AjaxResult inventoryBind(PurchaseVo dto) {
if(dto.getQrCode() == null || dto.getQrCode().isEmpty()){
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), "二维码不能为空");
}
@ -233,9 +238,16 @@ public class PurchaseBindServiceImpl implements IPurchaseBindService {
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), "修改bm_qrcode_info表失败");
}
//插入ma_machine表
int countTwo = purchaseBindMapper.insertMachineBind(dto);
WsMaInfo wsMaInfo = new WsMaInfo();
wsMaInfo.setMaName(dto.getMaterialName());
wsMaInfo.setMaModel(dto.getMaterialModel());
wsMaInfo.setMaCode(dto.getMaCode());
wsMaInfo.setSupplier(dto.getSupplierName());
wsMaInfo.setModelId(dto.getTypeId() + "");
wsMaInfo.setQrCode(dto.getQrCode());
int countTwo = mapper.insert(wsMaInfo);
if (countTwo == 0) {
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), "插入ma_machine表失败");
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), "插入ws_ma_info表失败");
}
return AjaxResult.success("绑定成功");
}

View File

@ -79,4 +79,7 @@ public class WhHouseInfo extends BaseEntity {
@ApiModelProperty(value = "关键字")
private String keyWord;
@ApiModelProperty(value = "类型名称")
private String typeName;
}

View File

@ -58,4 +58,11 @@ public interface WhHouseInfoMapper
* @return 结果
*/
int deleteWhHouseInfoByHouseIds(Long[] houseIds);
/**
* 根据仓库id查询仓库信息
* @param houseId
* @return
*/
List<WhHouseInfo> selectByHouseId(Long houseId);
}

View File

@ -1,8 +1,11 @@
package com.bonus.material.warehouse.service.impl;
import java.util.List;
import com.alibaba.nacos.common.utils.CollectionUtils;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.DateUtils;
import com.bonus.common.core.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.bonus.material.warehouse.mapper.WhHouseInfoMapper;
@ -72,6 +75,9 @@ public class WhHouseInfoServiceImpl implements IWhHouseInfoService
{
whHouseInfo.setUpdateTime(DateUtils.getNowDate());
try {
if (StringUtils.isNotBlank(whHouseInfo.getTypeName())) {
whHouseInfo.setHouseName(whHouseInfo.getTypeName());
}
return whHouseInfoMapper.updateWhHouseInfo(whHouseInfo);
} catch (Exception e) {
throw new ServiceException("数据库错误或仓库重名");
@ -87,6 +93,12 @@ public class WhHouseInfoServiceImpl implements IWhHouseInfoService
@Override
public int deleteWhHouseInfoByHouseIds(Long[] houseIds)
{
for (Long houseId : houseIds) {
List<WhHouseInfo> list = whHouseInfoMapper.selectByHouseId(houseId);
if (CollectionUtils.isNotEmpty(list)) {
throw new ServiceException("该仓库下有资产,不能删除");
}
}
return whHouseInfoMapper.deleteWhHouseInfoByHouseIds(houseIds);
}

View File

@ -90,6 +90,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
)
</insert>
<insert id="insertBmAgreementInfoClz" parameterType="com.bonus.material.basic.domain.BmAgreementInfo" useGeneratedKeys="true" keyProperty="agreementId">
insert into clz_bm_agreement_info (agreement_code, sign_time, unit_id,
project_id, create_by, lease_day,
plan_start_time, contract_code, auth_person,
phone, create_time, update_by,
update_time, remark, company_id, protocol,
branch_project
)
values (#{agreementCode,jdbcType=VARCHAR}, #{signTime,jdbcType=VARCHAR}, #{unitId,jdbcType=INTEGER},
#{projectId,jdbcType=INTEGER}, #{createBy,jdbcType=VARCHAR}, #{leaseDay,jdbcType=INTEGER},
#{planStartTime,jdbcType=TIMESTAMP}, #{contractCode,jdbcType=VARCHAR}, #{authPerson,jdbcType=VARCHAR},
#{phone,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR},
#{updateTime,jdbcType=TIMESTAMP}, #{remark,jdbcType=VARCHAR}, #{companyId,jdbcType=INTEGER}, #{protocol,jdbcType=VARCHAR},
#{branchProIdsStr,jdbcType=VARCHAR}
)
</insert>
<update id="updateBmAgreementInfo" parameterType="com.bonus.material.basic.domain.BmAgreementInfo">
update bm_agreement_info
<trim prefix="SET" suffixOverrides=",">
@ -164,4 +181,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
unit_id = #{unitId}
and project_id = #{projectId}
</select>
<select id="queryByTeamIdAndProjectIdCl" resultType="com.bonus.material.basic.domain.BmAgreementInfo">
SELECT
agreement_id as agreementId,
agreement_code as agreementCode,
unit_id as teamId,
project_id as projectId
FROM
clz_bm_agreement_info
WHERE
unit_id = #{unitId}
and project_id = #{projectId}
</select>
</mapper>

View File

@ -401,6 +401,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
box_code = #{boxCode}
</select>
<select id="getBoxWsTypeList" resultType="java.lang.Long">
SELECT DISTINCT(wmi.model_id)
from bm_qrcode_box_bind qbb
LEFT JOIN ws_ma_info wmi on wmi.id = qbb.ma_id
WHERE qbb.box_id = #{boxId}
</select>
<select id="getBoxBindWsList" resultType="com.bonus.material.basic.domain.BmQrBoxInfo">
SELECT
qb.id as id, qb.box_id as boxId, qb.create_by as createBy, qb.create_time,
mt1.type_name as typeName,
mt.type_name as typeModelName,
wsi.id as maId,wsi.ma_code as maCode,wsi.model_id as maTypeId
FROM
bm_qrcode_box_bind qb
LEFT JOIN ws_ma_info wsi ON qb.ma_id = wsi.id
LEFT JOIN ma_type mt ON wsi.model_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>
qb.box_id = #{boxId}
<if test="keyWord != null and keyWord !=''">
and wsi.ma_code LIKE concat('%',#{keyWord},'%')
</if>
</where>
</select>
<update id="updateTaskStatus">
UPDATE tm_task SET task_status = 22 WHERE task_id = #{taskId}
</update>

View File

@ -15,6 +15,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
del_flag,
<if test="projectId != null">project_id,</if>
<if test="idCard != null">bzz_idcard,</if>
<if test="typeId != null">type_id,</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="teamName != null">#{teamName},</if>
@ -26,6 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
0,
<if test="projectId != null">#{projectId},</if>
<if test="idCard != null">#{idCard},</if>
<if test="typeId != null">#{typeId},</if>
</trim>
</insert>

View File

@ -226,7 +226,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN clz_back_apply_details bad on bad.parent_id = bai.id
LEFT JOIN tm_task tt on tt.task_id = bai.task_id
LEFT JOIN tm_task_agreement tta on tta.task_id = tt.task_id
LEFT JOIN bm_agreement_info bagi on bagi.agreement_id = tta.agreement_id
LEFT JOIN clz_bm_agreement_info bagi on bagi.agreement_id = tta.agreement_id
AND bagi.`status` = '1'
LEFT JOIN bm_project bp on bp.pro_id = bagi.project_id
AND bp.del_flag = '0'
@ -362,7 +362,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
FROM
clz_back_apply_info bai
LEFT JOIN tm_task_agreement tta ON bai.task_id = tta.task_id
LEFT JOIN bm_agreement_info ba ON ba.agreement_id = tta.agreement_id
LEFT JOIN clz_bm_agreement_info ba ON ba.agreement_id = tta.agreement_id
AND ba.`status` = 1
LEFT JOIN bm_unit bt ON bt.unit_id = ba.unit_id
AND bt.del_flag = '0'
@ -561,7 +561,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN clz_back_apply_info bai ON bcd.parent_id = bai.id
LEFT JOIN tm_task tt ON tt.task_id = bai.task_id
LEFT JOIN tm_task_agreement tta ON tta.task_id = tt.task_id
LEFT JOIN bm_agreement_info bagi ON bagi.agreement_id = tta.agreement_id
LEFT JOIN clz_bm_agreement_info bagi ON bagi.agreement_id = tta.agreement_id
AND bagi.`status` = '1'
LEFT JOIN bm_project bp ON bp.pro_id = bagi.project_id
AND bp.del_flag = '0'
@ -666,7 +666,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND mt2.del_flag = '0'
LEFT JOIN clz_slt_agreement_info sai on lod.type_id = sai.type_id
and sai.ma_id = lod.ma_id
LEFT JOIN bm_agreement_info ba ON sai.agreement_id = ba.agreement_id
LEFT JOIN clz_bm_agreement_info ba ON sai.agreement_id = ba.agreement_id
WHERE
sai.status = '0'
AND mt.type_id = #{typeId}

View File

@ -942,7 +942,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND mt2.del_flag = '0'
LEFT JOIN clz_slt_agreement_info sai on lod.type_id = sai.type_id
and sai.ma_id = lod.ma_id
LEFT JOIN bm_agreement_info ba ON sai.agreement_id = ba.agreement_id
LEFT JOIN clz_bm_agreement_info ba ON sai.agreement_id = ba.agreement_id
WHERE
sai.status = '0'
AND mt.type_id = #{typeId}
@ -1018,4 +1018,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
agreement_id = #{agreementId}
AND type_id = #{typeId}
</select>
<select id="getAgreementIdByProId" resultType="com.bonus.material.basic.domain.BmAgreementInfo">
SELECT
bai.agreement_id as agreementId,
bai.agreement_code as agreementCode
FROM
clz_bm_agreement_info bai
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
WHERE
bai.project_id = #{proId}
</select>
<select id="getAgreeId" resultType="com.bonus.material.basic.domain.BmAgreementInfo">
SELECT
bai.agreement_id as agreementId,
bai.agreement_code as agreementCode
FROM
clz_bm_agreement_info bai
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
WHERE
bai.project_id = #{proId}
AND bai.unit_id = #{teamId}
</select>
</mapper>

View File

@ -262,7 +262,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mt.manage_type AS manageType
FROM
clz_slt_agreement_info sai
LEFT JOIN bm_agreement_info bai ON sai.agreement_id = bai.agreement_id
LEFT JOIN clz_bm_agreement_info bai ON sai.agreement_id = bai.agreement_id
LEFT JOIN bm_unit bt ON bai.unit_id = bt.unit_id
LEFT JOIN ma_type mt ON mt.type_id = sai.type_id
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
@ -353,7 +353,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN clz_back_apply_info bai ON bai.id = bcd.parent_id
LEFT JOIN tm_task tt ON tt.task_id = bai.task_id
LEFT JOIN tm_task_agreement tta ON tta.task_id = tt.task_id
LEFT JOIN bm_agreement_info bagi ON bagi.agreement_id = tta.agreement_id
LEFT JOIN clz_bm_agreement_info bagi ON bagi.agreement_id = tta.agreement_id
LEFT JOIN ma_type mt1 ON mt1.type_id = bcd.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt1.parent_id
WHERE bagi.unit_id = #{id}
@ -404,7 +404,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN clz_back_apply_info bai ON bai.id = bcd.parent_id
LEFT JOIN tm_task tt ON tt.task_id = bai.task_id
LEFT JOIN tm_task_agreement tta ON tta.task_id = tt.task_id
LEFT JOIN bm_agreement_info bagi ON bagi.agreement_id = tta.agreement_id
LEFT JOIN clz_bm_agreement_info bagi ON bagi.agreement_id = tta.agreement_id
LEFT JOIN ma_type mt1 ON mt1.type_id = bcd.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt1.parent_id
WHERE bagi.unit_id = #{id}
@ -578,7 +578,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
on bai.id=bcd.parent_id
LEFT JOIN tm_task tt on tt.task_id = bai.task_id
LEFT JOIN tm_task_agreement tta on tta.task_id = tt.task_id
LEFT JOIN bm_agreement_info bagi on bagi.agreement_id = tta.agreement_id
LEFT JOIN clz_bm_agreement_info bagi on bagi.agreement_id = tta.agreement_id
WHERE
bagi.unit_id = #{teamId}
and bcd.is_finished='1'
@ -693,7 +693,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN ma_type mt ON mt.type_id = sai.type_id
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
LEFT JOIN ma_machine mm ON mm.ma_id = sai.ma_id
LEFT JOIN bm_agreement_info bai ON bai.agreement_id = sai.agreement_id
LEFT JOIN clz_bm_agreement_info bai ON bai.agreement_id = sai.agreement_id
LEFT JOIN bm_unit bt ON bai.unit_id = bt.unit_id
LEFT JOIN clz_lease_apply_info lai ON lai.id = sai.lease_id
WHERE

View File

@ -71,8 +71,8 @@
<select id="existsByModelAndCode" resultType="java.lang.Integer">
SELECT COUNT(*)
FROM ws_ma_info
WHERE ma_model = #{maModel}
AND ma_code = #{maCode}
WHERE
ma_code = #{maCode}
</select>
<select id="selectAll" resultMap="BaseResultMap" resultType="com.bonus.material.codeCollection.domain.WsMaInfo">
SELECT *
@ -88,10 +88,10 @@
<insert id="insert" parameterType="com.bonus.material.codeCollection.domain.WsMaInfo" useGeneratedKeys="true"
keyProperty="id">
INSERT INTO ws_ma_info (ma_name, ma_model, ma_code, supplier, this_check_time, next_check_time,
repair_man, check_man, phone, result, type, model_id, is_active, opt_user, opt_time)
repair_man, check_man, phone, result, type, model_id, is_active, opt_user, opt_time, qr_code)
VALUES (#{maName}, #{maModel}, #{maCode}, #{supplier}, DATE(now()),
DATE(DATE_SUB(DATE_ADD(NOW(), INTERVAL 1 YEAR), INTERVAL 1 DAY)),
#{repairMan}, #{checkMan}, #{phone}, #{result}, #{type}, #{modelId}, #{isActive}, #{optUser}, now())
#{repairMan}, #{checkMan}, #{phone}, #{result}, #{type}, #{modelId}, #{isActive}, #{optUser}, now(), #{qrCode})
</insert>
<update id="update" parameterType="com.bonus.material.codeCollection.domain.WsMaInfo">

View File

@ -455,17 +455,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!-- WHERE bzgl_bz.project_id = #{externalId}-->
<!-- </select>-->
<select id="getTeamList" resultType="com.bonus.material.common.domain.vo.SelectVo">
select bzgl_bz.id,
bzgl_bz.bzmc as name,
bzgl_bz.bzz_name as teamLeaderName,
bzgl_bz.bzz_idcard as teamLeaderIdCard,
bzgl_bz.bz as remark,
bzgl_bz.bz_status as teamStatus,
bzgl_bz.project_id as projectId,
bzgl_bz.project_name as projectName
from `micro-tool`.bzgl_bz bzgl_bz
SELECT
unit_id as id,
unit_name AS name
FROM
bm_unit
WHERE
type_id = 1731
</select>
<!-- <select id="getTeamList" resultType="com.bonus.material.common.domain.vo.SelectVo">-->
<select id="getAgreementInfoBy" resultType="com.bonus.material.common.domain.vo.AgreementVo">
SELECT
bai.agreement_id as agreementId,
bai.agreement_code as agreementCode
FROM
bm_agreement_info bai
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
LEFT JOIN bm_unit bu ON bai.unit_id = bu.unit_id
WHERE
bai.status = '1'
AND bu.type_id = 36
AND bai.project_id = #{projectId}
</select>
<!-- <select id="getTeamList" resultType="com.bonus.material.common.domain.vo.SelectVo">-->
<!-- SELECT id,-->
<!-- team_name as `name`-->
<!-- FROM `lease_team_info`-->

View File

@ -377,7 +377,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mt1.type_name as maTypeName,
mt.type_name as typeName,
mm.ma_code as maCode,
lod.create_by as createBy,
su.nick_name as createBy,
lod.create_time as createTime,
lod.ma_id as maId
FROM
@ -388,7 +388,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND mt1.del_flag = '0'
LEFT JOIN lease_apply_info lai ON lod.parent_id = lai.id
LEFT JOIN ma_machine mm ON lod.ma_id = mm.ma_id
where lai.task_id = #{taskId} and lod.type_id = #{typeId}
LEFT JOIN sys_user su ON lod.create_by = su.user_id
where lai.task_id = #{taskId} and lod.type_id = #{typeId}
ORDER BY
lod.create_time DESC
</select>

View File

@ -151,6 +151,83 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
NOW()
</trim>
</insert>
<insert id="insertLeaseOutNum">
insert into lease_out_num
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="parentId!= null">
parent_id,
</if>
<if test="typeId!= null">
type_id,
</if>
<if test="maId!= null">
ma_id,
</if>
<if test="outNum!= null">
out_num,
</if>
<if test="outType!= null">
out_type,
</if>
<if test="createBy!= null">
create_by,
</if>
<if test="updateBy!= null">
update_by,
</if>
<if test="remark!= null">
remark,
</if>
<if test="companyId!= null">
company_id,
</if>
<if test="carCode!= null">
car_code,
</if>
<if test="publishTask != null and publishTask != ''">
publish_task,
</if>
create_time,
update_time
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="parentId!= null">
#{parentId},
</if>
<if test="typeId!= null">
#{typeId},
</if>
<if test="maId!= null">
#{maId},
</if>
<if test="outNum!= null">
#{outNum},
</if>
<if test="outType!= null">
#{outType},
</if>
<if test="createBy!= null">
#{createBy},
</if>
<if test="updateBy!= null">
#{updateBy},
</if>
<if test="remark!= null">
#{remark},
</if>
<if test="companyId!= null">
#{companyId},
</if>
<if test="carCode!= null">
#{carCode},
</if>
<if test="publishTask != null and publishTask != ''">
#{publishTask},
</if>
NOW(),
NOW()
</trim>
</insert>
<update id="updateLeaseOutDetails" parameterType="com.bonus.common.biz.domain.lease.LeaseOutDetails">
update lease_out_details
@ -172,6 +249,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
</update>
<update id="updateMachine">
update ws_ma_info
<set>
<if test="leaseUnit != null">
lease_unit = #{leaseUnit},
</if>
<if test="leaseProject != null">
lease_project = #{leaseProject},
</if>
<if test="isBack != null">
is_back = #{isBack},
</if>
out_time = now()
</set>
where id = #{maId}
</update>
<delete id="deleteLeaseOutDetailsById" parameterType="Long">
delete from lease_out_details where id = #{id}
</delete>

View File

@ -740,9 +740,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
check_man as checkMan,
model_id as typeId,
result as inspectStatus,
phone as phone
phone as phone,
id as maId
FROM
ws_ma_info
where ma_code = #{maCode}
</select>
<select id="getInfoByTypeId" resultType="com.bonus.material.ma.domain.Machine">
SELECT
wsi.id as maId,
wsi.model_id as typeId,
wsi.ma_name as materialName,
wsi.ma_model as materialModel,
wsi.ma_code as maCode,
wsi.qr_code as qrCode
FROM
ws_ma_info wsi
LEFT JOIN ma_type mt ON wsi.model_id = mt.type_id
and mt.`level` = '4' and mt.del_flag = '0'
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
and mt2.`level` = '3' and mt2.del_flag = '0'
LEFT JOIN ma_type mt3 ON mt2.parent_id = mt3.type_id
and mt3.`level` = '2' and mt3.del_flag = '0'
LEFT JOIN ma_type mt4 ON mt3.parent_id = mt4.type_id
and mt4.`level` = '1' and mt4.del_flag = '0'
WHERE
wsi.lease_unit is null and wsi.lease_project is null
<if test="typeId != null ">
and wsi.model_id = #{typeId}
</if>
</select>
</mapper>

View File

@ -163,4 +163,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and agreement_id = #{agreementId}
</if>
</select>
<select id="selectTaskByIdByCl" resultType="com.bonus.material.task.domain.TmTask">
SELECT
creator as createBy,
create_time as createTime
FROM
clz_slt_agreement_apply
WHERE
1 =1
<if test="agreementId != null">
and agreement_id = #{agreementId}
</if>
</select>
</mapper>

View File

@ -53,7 +53,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectWhHouseInfoVo"/>
where house_id = #{houseId}
</select>
<select id="selectByHouseId" resultType="com.bonus.material.warehouse.domain.WhHouseInfo">
SELECT
whi.house_name,
whs.type_id
FROM
wh_house_info whi
LEFT JOIN wh_house_set whs ON whi.house_id = whs.house_id
WHERE
whs.del_flag = '0'
AND whi.house_id = #{houseId}
</select>
<insert id="insertWhHouseInfo" parameterType="com.bonus.material.warehouse.domain.WhHouseInfo" useGeneratedKeys="true" keyProperty="houseId">
insert into wh_house_info
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -116,7 +128,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<delete id="deleteWhHouseInfoByHouseIds" parameterType="String">
delete from wh_house_info where house_id in
update wh_house_info
set del_flag = '2'
where house_id in
<foreach item="houseId" collection="array" open="(" separator="," close=")">
#{houseId}
</foreach>