This commit is contained in:
mashuai 2025-10-16 09:14:02 +08:00
parent b1fe3d440b
commit 3450cad3b4
11 changed files with 79 additions and 18 deletions

View File

@ -1,6 +1,7 @@
package com.bonus.material.clz.mapper;
import com.bonus.common.biz.domain.TypeTreeNode;
import com.bonus.common.biz.domain.lease.LeaseApplyInfo;
import com.bonus.common.biz.domain.lease.LeaseOutDetails;
import com.bonus.material.back.domain.vo.MaCodeVo;
import com.bonus.material.basic.domain.BmAgreementInfo;
@ -476,4 +477,18 @@ public interface MaterialLeaseInfoMapper {
* @return
*/
List<MaterialLeaseApplyDetailExport> selectLeaseApplyLY(MaterialLeaseApplyInfo bean);
/**
* 根据父id查询领料单信息
* @param parentId
* @return
*/
LeaseApplyInfo selectLeaseInfo(Long parentId);
/**
* 根据父id查询发布单信息
* @param parentId
* @return
*/
LeaseApplyInfo selectPublishInfo(Long parentId);
}

View File

@ -250,7 +250,7 @@ public class SelectController {
@ApiOperation(value = "在用设备类型树")
@PostMapping("/getUseTypeTree")
public AjaxResult getUseTypeTree(@RequestBody BackApplyInfo bean) {
BmUnit queryUnitInfo = bmUnitMapper.selectBmUnitByUnitId(bean.getUnitId());
/*BmUnit queryUnitInfo = bmUnitMapper.selectBmUnitByUnitId(bean.getUnitId());
if (queryUnitInfo == null) {
throw new ServiceException("单位不存在");
}
@ -260,7 +260,7 @@ public class SelectController {
if (queryUnitInfo.getTypeId() == 1731L) {
// 获取班组在用量
return service.getBzUseTypeTree(bean);
}
}*/
return service.getUseTypeTree(bean);
}

View File

@ -89,10 +89,10 @@ public interface LeaseApplyInfoMapper {
/**
* 查询领料任务的单位ID
* @param leaseId 领料任务id
* @param leaseUnitId 领料单位id
* @return 单位ID
*/
Long selectLeaseApplyInfoUnitIdByLeaseId(Long leaseId);
Long selectLeaseApplyInfoUnitIdByLeaseId(Integer leaseUnitId);
/**
* 根据班组ID和工程ID查询挂靠的项目部的协议id

View File

@ -236,7 +236,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
// 设置默认可退还数量等同于领用数量因为班组的协议可以直接去分公司退还, 并设置source来源为2班组领用
record.setReturnNum(record.getOutNum());
// 查询申请领料的项目部单位ID
Long originLeaseUnitId = leaseApplyInfoMapper.selectLeaseApplyInfoUnitIdByLeaseId(record.getParentId());
Long originLeaseUnitId = leaseApplyInfoMapper.selectLeaseApplyInfoUnitIdByLeaseId(record.getLeaseUnitId());
record.setLeaseUnitId(Math.toIntExact(originLeaseUnitId));
// 插入项目部领料的结算记录
int inserts = insSltInfo(taskId, record);
@ -334,6 +334,17 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
materialLeaseApplyInfo.setProId(Long.parseLong(record.getLeaseProjectId().toString()));
materialLeaseApplyInfo.setCreateTime(DateUtils.getNowDate());
materialLeaseApplyInfo.setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName());
// 根据领料id查询领料人和领料电话
LeaseApplyInfo leaseApplyInfo = new LeaseApplyInfo();
if (StringUtils.isNotBlank(record.getPublishTask())) {
leaseApplyInfo = materialLeaseInfoMapper.selectPublishInfo(record.getParentId());
} else {
leaseApplyInfo = materialLeaseInfoMapper.selectLeaseInfo(record.getParentId());
}
if (leaseApplyInfo != null) {
materialLeaseApplyInfo.setLeasePerson(StringUtils.isNotBlank(leaseApplyInfo.getLeasePerson()) ? leaseApplyInfo.getLeasePerson() : "");
materialLeaseApplyInfo.setPhone(StringUtils.isNotBlank(leaseApplyInfo.getPhone()) ? leaseApplyInfo.getPhone() : "");
}
int count = materialLeaseInfoMapper.insertLeaseApplyInfo(materialLeaseApplyInfo);
if (count > GlobalConstants.INT_0) {
return insertPurchaseCheckDetails(record, createBy, tmTask.getTaskId(), materialLeaseApplyInfo.getId());
@ -461,6 +472,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
Type maType = typeMapper.getMaType(record.getTypeId());
maType.setFinalPrice(maType.getLeasePrice());
record.setLeaseStyle("2");
record.setSource(2);
res = materialLeaseInfoMapper.insSltInfo(record, agreementId, maType);
}
return res;

View File

@ -122,4 +122,7 @@ public class PurchaseVo {
private String updateBy;
@ApiModelProperty(value="入库数量")
private BigDecimal inPutNum;
}

View File

@ -225,6 +225,12 @@ public class PurchaseStorageServiceImpl implements IPurchaseStorageService {
//数量入库
List<PurchaseVo> details = purchaseBindMapper.getDetails(purchaseDto);
if (CollectionUtils.isNotEmpty(details)) {
if (details.get(0).getCheckNum().compareTo(details.get(0).getInPutNum()) == 0) {
purchaseStorageMapper.updateStatusById(PurchaseTaskStatusEnum.IN_STORE.getStatus(), Integer.parseInt(purchaseDto.getPurchaseId()));
List<PurchaseVo> statusList = purchaseStorageMapper.select(purchaseDto.getTaskId());
result += updateTaskStatus(statusList);
return AjaxResult.error("该设备已全部入库,请勿重复操作");
}
purchaseDto.setInputNum(details.get(0).getCheckNum());
result += updatePurchaseInfoAndDetails(details.get(0), Integer.parseInt(purchaseDto.getPurchaseId()));
}

View File

@ -329,7 +329,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
back_id AS backId,
lease_price AS leasePrice,
buy_price AS buyPrice,
company_id AS companyId
company_id AS companyId,
source AS source
FROM
slt_agreement_info
WHERE
@ -787,8 +788,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<insert id="insStlInfoTwo">
insert into slt_agreement_info (agreement_id,type_id,ma_id,num,start_time,status,lease_id,lease_price,buy_price,is_slt,company_id,lease_type,create_time)
values (#{info.agreementId},#{info.typeId},#{info.maId},#{many},#{info.startTime},#{info.status},#{info.leaseId},#{info.leasePrice},#{info.buyPrice},'0',#{info.companyId},#{info.leaseType},now());
insert into slt_agreement_info (agreement_id,type_id,ma_id,num,start_time,status,lease_id,lease_price,buy_price,is_slt,company_id,lease_type,create_time, source)
values (#{info.agreementId},#{info.typeId},#{info.maId},#{many},#{info.startTime},#{info.status},#{info.leaseId},#{info.leasePrice},#{info.buyPrice},'0',#{info.companyId},#{info.leaseType},now(), #{info.source});
</insert>
<insert id="addHandlingOrder">
@ -1487,7 +1488,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
back_id AS backId,
lease_price AS leasePrice,
buy_price AS buyPrice,
company_id AS companyId
company_id AS companyId,
source AS source
FROM
slt_agreement_info
WHERE

View File

@ -300,8 +300,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</insert>
<insert id="insSltInfo">
insert into clz_slt_agreement_info (agreement_id,type_id,ma_id,num,start_time,status,lease_id,lease_price,buy_price,is_slt,company_id,lease_type,create_time,publish_task, lease_style)
values (#{agreementId},#{record.typeId},#{record.maId},#{record.outNum},now(),0,#{record.parentId},#{ma.finalPrice},#{ma.buyPrice},'0',#{record.companyId},#{record.leaseType},now(),#{record.publishTask}, #{record.leaseStyle});
insert into clz_slt_agreement_info (agreement_id,type_id,ma_id,num,start_time,status,lease_id,lease_price,buy_price,is_slt,company_id,lease_type,create_time,publish_task, lease_style, source)
values (#{agreementId},#{record.typeId},#{record.maId},#{record.outNum},now(),0,#{record.parentId},#{ma.finalPrice},#{ma.buyPrice},'0',#{record.companyId},#{record.leaseType},now(),#{record.publishTask}, #{record.leaseStyle}, #{record.source});
</insert>
<insert id="insertLeaseApplyDetails">
@ -1736,4 +1736,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
GROUP BY lod.publish_task,lod.type_id
ORDER BY lpd.create_time
</select>
<select id="selectLeaseInfo" resultType="com.bonus.common.biz.domain.lease.LeaseApplyInfo">
SELECT
lease_person as leasePerson,
phone as phone
FROM
lease_apply_info
WHERE
id = #{parentId}
</select>
<select id="selectPublishInfo" resultType="com.bonus.common.biz.domain.lease.LeaseApplyInfo">
SELECT
lease_person as leasePerson,
phone as phone
FROM
lease_publish_details
WHERE
parent_id = #{parentId}
LIMIT 1
</select>
</mapper>

View File

@ -2013,7 +2013,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHEN subquery1.typeId = 36 THEN
GREATEST(IFNULL(subquery1.usNum, 0) - IFNULL(subquery3.usNum, 0), 0)
ELSE
IFNULL(subquery3.usNum, 0)
0
END AS storeNum,
CASE
WHEN subquery1.typeId = 36 THEN

View File

@ -884,12 +884,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectLeaseApplyInfoUnitIdByLeaseId" resultType="java.lang.Long">
select
lai.unit_id as unitId
from
lease_apply_info lai
where
lai.id = #{leaseId}
SELECT
project_unit_id AS unitId
FROM
bm_agreement_info
WHERE
unit_id = #{leaseUnitId}
</select>
<select id="selectUnitTypeByUnitId" resultType="java.lang.Long">
@ -906,6 +906,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN bm_agreement_info baii ON baii.unit_id = bai.project_unit_id AND baii.project_id = #{projectId}
WHERE
bai.unit_id = #{teamId} AND bai.project_id = #{projectId}
LIMIT 1
</select>
<select id="getOutNum" resultType="com.bonus.common.biz.domain.lease.LeaseApplyInfo">

View File

@ -224,6 +224,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
IFNULL(pcd.check_num, 0) AS purchaseNum,
IFNULL(pcd.check_num, 0) AS checkNum,
IFNULL(pcd.bind_num,0) AS bindNum,
IFNULL(pcd.input_num,0) AS inPutNum,
pcd.type_id as typeId,
mt.unit_name AS unitName,
ms.supplier AS supplierName,