代码提交

This commit is contained in:
liang.chao 2025-10-10 21:39:19 +08:00
parent 5b686df136
commit d1235dcc06
11 changed files with 116 additions and 20 deletions

View File

@ -125,4 +125,7 @@ public class LeaseTotalInfo {
@ApiModelProperty(value = "工程id") @ApiModelProperty(value = "工程id")
private String proId; private String proId;
@ApiModelProperty(value = "领料方式")
private String leaseStyle;
} }

View File

@ -231,7 +231,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
if (projectUnitAgreementId != null && projectUnitAgreementId > GlobalConstants.INT_0) { if (projectUnitAgreementId != null && projectUnitAgreementId > GlobalConstants.INT_0) {
record.setProjectUnitAgreementId(projectUnitAgreementId); record.setProjectUnitAgreementId(projectUnitAgreementId);
} else { } else {
return AjaxResult.error("出库失败,没有找到班组所属项目部协议信息"); throw new ServiceException("出库失败,未找到班组项目部协议ID");
} }
// 设置默认可退还数量等同于领用数量因为班组的协议可以直接去分公司退还, 并设置source来源为2班组领用 // 设置默认可退还数量等同于领用数量因为班组的协议可以直接去分公司退还, 并设置source来源为2班组领用
record.setReturnNum(record.getOutNum()); record.setReturnNum(record.getOutNum());
@ -331,6 +331,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
materialLeaseApplyInfo.setLeaseStyle(SYNC_RESOURCE.toString()); materialLeaseApplyInfo.setLeaseStyle(SYNC_RESOURCE.toString());
materialLeaseApplyInfo.setTeamId(bmAgreementInfo.getUnitId().toString()); materialLeaseApplyInfo.setTeamId(bmAgreementInfo.getUnitId().toString());
materialLeaseApplyInfo.setProjectId(record.getLeaseProjectId().toString()); materialLeaseApplyInfo.setProjectId(record.getLeaseProjectId().toString());
materialLeaseApplyInfo.setProId(Long.parseLong(record.getLeaseProjectId().toString()));
materialLeaseApplyInfo.setCreateTime(DateUtils.getNowDate()); materialLeaseApplyInfo.setCreateTime(DateUtils.getNowDate());
materialLeaseApplyInfo.setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName()); materialLeaseApplyInfo.setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName());
int count = materialLeaseInfoMapper.insertLeaseApplyInfo(materialLeaseApplyInfo); int count = materialLeaseInfoMapper.insertLeaseApplyInfo(materialLeaseApplyInfo);
@ -405,7 +406,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
}*/ }*/
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage()); log.error(e.getMessage());
return AjaxResult.error("出库失败" + e.getMessage()); throw new ServiceException("出库失败" + e.getMessage());
} }
return AjaxResult.success("出库成功"); return AjaxResult.success("出库成功");
} }

View File

@ -21,10 +21,10 @@ import java.util.List;
/** /**
* @description 直转申请 * @author hay
* @author hay * @description 直转申请
* @date 2025/2/17 19:27 * @date 2025/2/17 19:27
*/ */
@Api(tags = " 直转申请") @Api(tags = " 直转申请")
@RestController @RestController
@RequestMapping("/directRotation") @RequestMapping("/directRotation")
@ -40,8 +40,37 @@ public class DirectRotationController extends BaseController {
@GetMapping("/getUseringData") @GetMapping("/getUseringData")
public AjaxResult getUseringData(SltAgreementInfo sltAgreementInfo) { public AjaxResult getUseringData(SltAgreementInfo sltAgreementInfo) {
try { try {
List<SltAgreementInfo> datas = new ArrayList<>();
List<SltAgreementInfo> useringData = service.getUseringData(sltAgreementInfo); List<SltAgreementInfo> useringData = service.getUseringData(sltAgreementInfo);
return AjaxResult.success(useringData); Integer projectId = service.getprojectId(sltAgreementInfo);
// 根据项目获取材料站在用机具
List<SltAgreementInfo> useringDataClz = service.getUseringDataByClz(projectId);
for (SltAgreementInfo useringDatum : useringData) {
boolean shouldAdd = true;
for (SltAgreementInfo agreementInfo : useringDataClz) {
// if (agreementInfo.getTypeName().equals("地锚") && agreementInfo.getTypeModelName().equals("10t")) {
// System.out.println("haha");
// }
if (useringDatum.getTypeId().equals(agreementInfo.getTypeId())) {
if (useringDatum.getMaId() == null && agreementInfo.getMaId() == null) {
if (useringDatum.getUseNum() > agreementInfo.getUseNum()) {
useringDatum.setUseNum(useringDatum.getUseNum() - agreementInfo.getUseNum());
} else {
shouldAdd = false;
break;
}
} else if (useringDatum.getMaId() != null && useringDatum.getMaId().equals(agreementInfo.getMaId())) {
// 匹配成功不需要添加到datas
shouldAdd = false;
break;
}
}
}
if (shouldAdd) {
datas.add(useringDatum);
}
}
return AjaxResult.success(datas);
} catch (Exception e) { } catch (Exception e) {
return AjaxResult.success(new ArrayList<>()); return AjaxResult.success(new ArrayList<>());
} }
@ -49,12 +78,13 @@ public class DirectRotationController extends BaseController {
/** /**
* 根据协议Id查询在用数据--类型名称下拉,规格型号下拉在用数据列表 * 根据协议Id查询在用数据--类型名称下拉,规格型号下拉在用数据列表
*
* @param bean * @param bean
* @return * @return
*/ */
@ApiOperation(value = "标准配置下拉选") @ApiOperation(value = "标准配置下拉选")
@PostMapping("/getTypeNameList") @PostMapping("/getTypeNameList")
public AjaxResult getTypeNameList(@RequestBody SltAgreementInfo bean){ public AjaxResult getTypeNameList(@RequestBody SltAgreementInfo bean) {
return service.getTypeNameList(bean); return service.getTypeNameList(bean);
} }
@ -112,6 +142,7 @@ public class DirectRotationController extends BaseController {
/** /**
* 导出直转记录查询列表 * 导出直转记录查询列表
*
* @param response * @param response
* @param directApplyInfo * @param directApplyInfo
*/ */
@ -164,7 +195,7 @@ public class DirectRotationController extends BaseController {
*/ */
@ApiOperation(value = "删除直转申请") @ApiOperation(value = "删除直转申请")
@PreventRepeatSubmit @PreventRepeatSubmit
@SysLog(title = "直转记录查询", businessType = OperaType.DELETE, logType = 1,module = "直转记录查询->删除直转申请") @SysLog(title = "直转记录查询", businessType = OperaType.DELETE, logType = 1, module = "直转记录查询->删除直转申请")
@DeleteMapping("/{id}") @DeleteMapping("/{id}")
public AjaxResult remove(@PathVariable Long id) { public AjaxResult remove(@PathVariable Long id) {
return toAjax(service.delData(id)); return toAjax(service.delData(id));

View File

@ -5,6 +5,7 @@ import com.bonus.material.ma.domain.DirectApplyExportInfo;
import com.bonus.material.ma.domain.DirectApplyInfo; import com.bonus.material.ma.domain.DirectApplyInfo;
import com.bonus.material.settlement.domain.SltAgreementInfo; import com.bonus.material.settlement.domain.SltAgreementInfo;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
@ -78,4 +79,8 @@ public interface DirectRotationMapper {
* @return * @return
*/ */
List<DirectApplyDetails> selectDetails(SltAgreementInfo sltAgreementInfo); List<DirectApplyDetails> selectDetails(SltAgreementInfo sltAgreementInfo);
List<SltAgreementInfo> getUseringDataByClz(@Param("projectId") Integer projectId);
Integer getprojectId(SltAgreementInfo sltAgreementInfo);
} }

View File

@ -6,6 +6,7 @@ import com.bonus.material.ma.domain.DirectApplyExportInfo;
import com.bonus.material.ma.domain.DirectApplyInfo; import com.bonus.material.ma.domain.DirectApplyInfo;
import com.bonus.material.ma.domain.DirectApplyInfoDetails; import com.bonus.material.ma.domain.DirectApplyInfoDetails;
import com.bonus.material.settlement.domain.SltAgreementInfo; import com.bonus.material.settlement.domain.SltAgreementInfo;
import org.apache.ibatis.annotations.Param;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.List; import java.util.List;
@ -79,4 +80,8 @@ public interface DirectRotationService {
* @return * @return
*/ */
AjaxResult submitNew(DirectApplyInfoDetails directApplyInfoDetails); AjaxResult submitNew(DirectApplyInfoDetails directApplyInfoDetails);
List<SltAgreementInfo> getUseringDataByClz(@Param("projectId") Integer projectId);
Integer getprojectId(SltAgreementInfo sltAgreementInfo);
} }

View File

@ -434,6 +434,16 @@ public class DirectRotationImpl implements DirectRotationService {
} }
} }
@Override
public List<SltAgreementInfo> getUseringDataByClz(Integer projectId) {
return mapper.getUseringDataByClz(projectId);
}
@Override
public Integer getprojectId(SltAgreementInfo sltAgreementInfo) {
return mapper.getprojectId(sltAgreementInfo);
}
/** /**
* 生成退料单号 * 生成退料单号

View File

@ -89,16 +89,16 @@ public class ProAuthorizeServiceImpl implements ProAuthorizeService {
// 使用 HashSet 来加速查找过程 // 使用 HashSet 来加速查找过程
Set<String> unsettledProjectIds = new HashSet<>(projectIdList); Set<String> unsettledProjectIds = new HashSet<>(projectIdList);
// 过滤掉不在未结算工程集合内的工程 // 过滤掉不在未结算工程集合内的工程
Iterator<LeasePublishInfo> iterator = list.iterator(); // Iterator<LeasePublishInfo> iterator = list.iterator();
while (iterator.hasNext()) { // while (iterator.hasNext()) {
LeasePublishInfo info = iterator.next(); // LeasePublishInfo info = iterator.next();
String proId = info.getLeaseProjectId() != null ? // String proId = info.getLeaseProjectId() != null ?
info.getLeaseProjectId().toString() : null; // info.getLeaseProjectId().toString() : null;
//
if (proId == null || !unsettledProjectIds.contains(proId)) { // if (proId == null || !unsettledProjectIds.contains(proId)) {
iterator.remove(); // iterator.remove();
} // }
} // }
} }
return list; return list;
} catch (Exception e){ } catch (Exception e){

View File

@ -254,6 +254,7 @@ public class SltAgreementInfo extends BaseEntity {
private String repairCode; private String repairCode;
private String unitValue; private String unitValue;
private String nextCheckTime;
/** /**
* 是否查询已结算的费用 * 是否查询已结算的费用

View File

@ -953,6 +953,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
lai.`code` as code, lai.`code` as code,
bp.imp_unit as impUnit, bp.imp_unit as impUnit,
bt.bzz_idcard as idCard, bt.bzz_idcard as idCard,
case when lai.lease_style = '0' then '材料领料'
when lai.lease_style = '1' then '工器具领料'
when lai.lease_style = '2' then '第三方推送'
else ''
end as leaseStyle,
lai.sub_unit_name as subUnitName lai.sub_unit_name as subUnitName
FROM FROM
clz_lease_out_details lod clz_lease_out_details lod

View File

@ -324,7 +324,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<select id="getProjectList" resultType="com.bonus.common.biz.domain.ProjectTreeNode"> <select id="getProjectList" resultType="com.bonus.common.biz.domain.ProjectTreeNode">
/*根据往来单位id关联协议查询工程*/
SELECT SELECT
* *
FROM FROM

View File

@ -61,6 +61,7 @@
mm.ma_code AS maCode, mm.ma_code AS maCode,
lai.lease_person as leasePerson, lai.lease_person as leasePerson,
DATE(sai.start_time) as startTime, DATE(sai.start_time) as startTime,
mm.next_check_time as nextCheckTime,
sai.ma_id as maId, sai.ma_id as maId,
sai.type_id as typeId, sai.type_id as typeId,
lai.create_time as createTime, lai.create_time as createTime,
@ -281,4 +282,39 @@
GROUP BY GROUP BY
dad.type_id dad.type_id
</select> </select>
<select id="getprojectId" resultType="java.lang.Integer">
SELECT
project_id
FROM
bm_agreement_info
WHERE
agreement_id = #{agreementId}
</select>
<select id="getUseringDataByClz" resultType="com.bonus.material.settlement.domain.SltAgreementInfo">
SELECT
mt2.type_name AS typeName,
mt.type_name AS typeModelName,
mt.unit_name as unitName,
ifnull(sum( sai.num ) ,0 ) AS useNum,
mm.ma_code AS maCode,
lai.lease_person as leasePerson,
DATE(sai.start_time) as startTime,
sai.ma_id as maId,
sai.type_id as typeId,
lai.create_time as createTime,
mt.unit_value as unitValue,
sai.*
FROM
clz_slt_agreement_info sai
LEFT JOIN ma_type mt on sai.type_id = mt.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
LEFT JOIN ma_machine mm on sai.ma_id = mm.ma_id
LEFT JOIN clz_lease_apply_info lai on lai.id=sai.lease_id
left join clz_bm_agreement_info col on col.agreement_id=sai.agreement_id
left join bm_project pro on pro.pro_id=col.project_id
where pro.pro_id = #{projectId} and sai.status = '0'
GROUP BY
sai.ma_id,sai.type_id
</select>
</mapper> </mapper>