Merge branch 'master' of http://192.168.0.56:3000/bonus/Bonus-Cloud-Material
This commit is contained in:
commit
bc7c4f57fd
|
|
@ -10,7 +10,7 @@ import com.bonus.common.core.web.domain.BaseEntity;
|
|||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 新购验收编号管理对象 purchase_macode_info
|
||||
* 新购验收编号管理对象 bm_qrcode_info
|
||||
*
|
||||
* @author xsheng
|
||||
* @date 2024-10-16
|
||||
|
|
|
|||
|
|
@ -60,6 +60,9 @@ public class PurchaseVo {
|
|||
@ApiModelProperty(value="验收数量")
|
||||
private BigDecimal checkNum;
|
||||
|
||||
@ApiModelProperty(value="待绑定数量")
|
||||
private BigDecimal pendingBindNum;
|
||||
|
||||
@ApiModelProperty(value="绑定数量")
|
||||
private BigDecimal bindNum;
|
||||
|
||||
|
|
|
|||
|
|
@ -100,4 +100,11 @@ public interface PurchaseBindMapper {
|
|||
List<PurchaseCheckDetails> getMachineById(PurchaseDto dto);
|
||||
|
||||
List<PurchaseVo> getTypeByQrcode(PurchaseDto dto);
|
||||
|
||||
/**
|
||||
* 查询绑定详情
|
||||
* @param purchaseDto
|
||||
* @return
|
||||
*/
|
||||
List<PurchaseVo> selectPurchaseCheckDetailsById(PurchaseDto purchaseDto);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -276,7 +276,14 @@ public class PurchaseBindServiceImpl implements IPurchaseBindService {
|
|||
*/
|
||||
private void handlePurchaseId(Set<String> addedEntries, PurchaseDto purchaseDto, List<PurchaseVo> codeList, Integer status, ZipOutputStream zos, String genMonth) throws IOException, WriterException {
|
||||
if (status == 1) {
|
||||
Select(addedEntries, purchaseDto, zos);
|
||||
List<PurchaseVo> details = purchaseBindMapper.getDetails(purchaseDto);
|
||||
if (CollectionUtils.isNotEmpty(details)) {
|
||||
PurchaseVo detail = details.get(0);
|
||||
if (detail.getBindNum() != null ) {
|
||||
detail.setPendingBindNum(detail.getCheckNum().subtract(detail.getBindNum()) );
|
||||
}
|
||||
Select(addedEntries, purchaseDto, zos, detail);
|
||||
}
|
||||
} else {
|
||||
int num = getInitialNum(codeList);
|
||||
List<PurchaseVo> details = purchaseBindMapper.getDetails(purchaseDto);
|
||||
|
|
@ -306,7 +313,7 @@ public class PurchaseBindServiceImpl implements IPurchaseBindService {
|
|||
* @throws IOException
|
||||
*/
|
||||
private void getString(Set<String> addedEntries, PurchaseDto purchaseDto, String genMonth, int num, ZipOutputStream zos, String materialModel, String materialName, Integer typeId, BigDecimal checkNum) throws WriterException, IOException {
|
||||
int genNum = Integer.parseInt(String.valueOf(checkNum));
|
||||
int genNum = (int) checkNum.doubleValue();
|
||||
for (int j = 1; j <= genNum; j++) {
|
||||
genMonth = genMonth.replace("-", "");
|
||||
String code = genMonth + "-" + String.format("%5d", num + j).replace(" ", "0");
|
||||
|
|
@ -364,8 +371,12 @@ public class PurchaseBindServiceImpl implements IPurchaseBindService {
|
|||
* @param zos
|
||||
* @throws IOException
|
||||
*/
|
||||
private void Select(Set<String> addedEntries, PurchaseDto purchaseDto, ZipOutputStream zos) throws IOException {
|
||||
List<PurchaseVo> list = purchaseBindMapper.selectPurchaseCheckInfoById(purchaseDto);
|
||||
private void Select(Set<String> addedEntries, PurchaseDto purchaseDto, ZipOutputStream zos, PurchaseVo detail) throws IOException {
|
||||
List<PurchaseVo> list = purchaseBindMapper.selectPurchaseCheckDetailsById(purchaseDto);
|
||||
if (detail.getPendingBindNum() != null && detail.getPendingBindNum().compareTo(BigDecimal.ZERO) > 0) {
|
||||
int num = (int) detail.getPendingBindNum().doubleValue();
|
||||
list = list.subList(0, num);
|
||||
}
|
||||
if (com.alibaba.nacos.common.utils.CollectionUtils.isNotEmpty(list)) {
|
||||
for (PurchaseVo purchaseVo : list) {
|
||||
String materialModel = purchaseVo.getMaterialModel();
|
||||
|
|
|
|||
|
|
@ -139,9 +139,6 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService {
|
|||
*/
|
||||
@Override
|
||||
public List<PurchaseCheckInfo> selectPurchaseCheckInfoList(PurchaseQueryDto purchaseQueryDto) {
|
||||
// TODO 引入采购任务阶段管理、先写死 后期由前端传入
|
||||
// purchaseQueryDto.setTaskStage(PurchaseTaskStageEnum.CHECK.getCode());
|
||||
|
||||
List<PurchaseCheckInfo> purchaseCheckInfos = purchaseCheckInfoMapper.selectPurchaseCheckInfoJoinList(purchaseQueryDto);
|
||||
if (CollectionUtils.isEmpty(purchaseCheckInfos) ) {return Collections.emptyList();}
|
||||
AtomicReference<Long> loginUserId = new AtomicReference<>(SecurityUtils.getUserId());
|
||||
|
|
@ -162,8 +159,7 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService {
|
|||
OptionalInt minStatus = purchaseCheckDetails.stream().mapToInt(PurchaseCheckDetails::getStatus).min();
|
||||
|
||||
if (isAllowPartTransfer) {
|
||||
// 过滤由前端传入的物资所属状态
|
||||
// TODO 2024-12-23日 取消状态过滤,修改由任务阶段来过滤 --- by 阮世耀
|
||||
// 2024-12-23日 取消状态过滤,修改由任务阶段来过滤 --- by 阮世耀
|
||||
// if (!CollectionUtils.isEmpty(purchaseQueryDto.getStatusList())) {
|
||||
// purchaseCheckDetails = purchaseCheckDetails.stream().filter(o -> purchaseQueryDto.getStatusList().contains(o.getStatus())).collect(Collectors.toList());
|
||||
// }
|
||||
|
|
@ -189,6 +185,7 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService {
|
|||
).collect(Collectors.toList());
|
||||
break;
|
||||
default:
|
||||
System.err.println("未知的新购任务阶段:" + purchaseQueryDto.getTaskStage());
|
||||
return Collections.emptyList();
|
||||
}
|
||||
purchaseInfo.setPurchaseMaTypeName(purchaseCheckDetailsMapper.selectMaTypeNameByTaskAndStatusList(purchaseInfo.getTaskId(), purchaseQueryDto.getStatusList()));
|
||||
|
|
|
|||
|
|
@ -643,23 +643,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<select id="getPurchaseRecordList" resultType="com.bonus.material.basic.domain.PurchaseInputInfo">
|
||||
SELECT
|
||||
pcd.task_id as taskId,
|
||||
mt2.type_name AS typeName,
|
||||
mt.type_name AS typeModelName,
|
||||
mt.buy_price AS buyPrice,
|
||||
IFNULL( pcd.check_num, 0 ) - IFNULL( pcd.input_num, 0 ) AS inputNum,
|
||||
tt.`code` AS purchaseCode,
|
||||
GROUP_CONCAT( DISTINCT su.nick_name ORDER BY su.nick_name SEPARATOR ', ' ) AS maKeeper,
|
||||
pcd.check_time AS checkTime
|
||||
pcd.task_id as taskId,
|
||||
mt2.type_name AS typeName,
|
||||
mt.type_name AS typeModelName,
|
||||
mt.buy_price AS buyPrice,
|
||||
IFNULL( pcd.check_num, 0 ) - IFNULL( pcd.input_num, 0 ) AS inputNum,
|
||||
tt.`code` AS purchaseCode,
|
||||
GROUP_CONCAT( DISTINCT su.nick_name ORDER BY su.nick_name SEPARATOR ', ' ) AS maKeeper,
|
||||
pcd.check_time AS checkTime
|
||||
FROM
|
||||
purchase_check_details pcd
|
||||
purchase_check_details pcd
|
||||
LEFT JOIN ma_type mt ON mt.type_id = pcd.type_id
|
||||
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
|
||||
LEFT JOIN tm_task tt ON pcd.task_id = tt.task_id
|
||||
LEFT JOIN ma_type_keeper mtk ON mtk.type_id = pcd.type_id
|
||||
LEFT JOIN sys_user su ON mtk.user_id = su.user_id
|
||||
WHERE
|
||||
pcd.`status` IN ( 3, 4, 13, 14 )
|
||||
pcd.`status` IN ( 3, 4, 13, 14 )
|
||||
<if test="typeId != null">
|
||||
AND pcd.type_id = #{typeId}
|
||||
</if>
|
||||
|
|
@ -714,14 +714,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
pmi.type_id as typeId,
|
||||
pmi.ma_code as maCode
|
||||
FROM
|
||||
purchase_macode_info pmi
|
||||
LEFT JOIN ma_machine mm ON pmi.ma_code = mm.ma_code
|
||||
AND mm.type_id = #{typeId}
|
||||
bm_qrcode_info pmi
|
||||
LEFT JOIN ma_machine mm ON pmi.ma_code = mm.ma_code AND mm.type_id = #{typeId}
|
||||
WHERE
|
||||
pmi.task_id = #{taskId}
|
||||
AND pmi.type_id = #{typeId}
|
||||
AND mm.ma_code IS NULL
|
||||
AND pmi.ma_code IS NOT NULL
|
||||
AND pmi.type_id = #{typeId}
|
||||
AND mm.ma_code IS NULL
|
||||
AND pmi.ma_code IS NOT NULL
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</insert>
|
||||
|
||||
<insert id="add">
|
||||
insert into purchase_macode_info
|
||||
insert into bm_qrcode_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="taskId != null">task_id,</if>
|
||||
<if test="typeId != null">type_id,</if>
|
||||
|
|
@ -43,7 +43,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</insert>
|
||||
|
||||
<insert id="insert">
|
||||
INSERT INTO purchase_macode_info
|
||||
INSERT INTO bm_qrcode_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="qrCode != null">
|
||||
qr_code,
|
||||
|
|
@ -62,7 +62,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</if>
|
||||
create_time,
|
||||
del_flag,
|
||||
status
|
||||
`status`
|
||||
</trim>
|
||||
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
|
||||
<if test="qrCode != null">
|
||||
|
|
@ -174,7 +174,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
pcd.bind_num AS bindNum,
|
||||
pcd.status AS status
|
||||
FROM
|
||||
purchase_macode_info pm
|
||||
bm_qrcode_info pm
|
||||
LEFT JOIN purchase_check_details pcd ON pm.task_id = pcd.task_id
|
||||
AND pm.type_id = pcd.type_id
|
||||
LEFT JOIN ma_type mt ON pcd.type_id = mt.type_id
|
||||
|
|
@ -224,7 +224,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
LEFT JOIN ma_type mt ON pcd.type_id = mt.type_id
|
||||
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
|
||||
LEFT JOIN ma_supplier_info ms ON pcd.supplier_id = ms.supplier_id
|
||||
LEFT JOIN purchase_macode_info pm on pcd.task_id = pm.task_id and pm.type_id = pcd.type_id
|
||||
LEFT JOIN bm_qrcode_info pm on pcd.task_id = pm.task_id and pm.type_id = pcd.type_id
|
||||
where 1 = 1
|
||||
<if test="typeId != null and typeId != ''">
|
||||
AND mt.type_id = #{typeId}
|
||||
|
|
@ -249,7 +249,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
SELECT
|
||||
qr_code as qrCode
|
||||
FROM
|
||||
purchase_macode_info
|
||||
bm_qrcode_info
|
||||
WHERE
|
||||
DATE_FORMAT(create_time, '%Y-%m') = #{genMonth} and ma_code is null
|
||||
ORDER BY
|
||||
|
|
@ -262,7 +262,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
type_id as typeId,
|
||||
ma_code as maCode
|
||||
FROM
|
||||
purchase_macode_info
|
||||
bm_qrcode_info
|
||||
where del_flag = '0' and ma_code = #{maCode}
|
||||
</select>
|
||||
|
||||
|
|
@ -298,7 +298,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
LEFT JOIN ma_type mt ON pcd.type_id = mt.type_id
|
||||
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
|
||||
LEFT JOIN ma_supplier_info ms ON pcd.supplier_id = ms.supplier_id
|
||||
LEFT JOIN purchase_macode_info pm on pcd.task_id = pm.task_id and pm.type_id = pcd.type_id
|
||||
LEFT JOIN bm_qrcode_info pm on pcd.task_id = pm.task_id and pm.type_id = pcd.type_id
|
||||
where 1 = 1
|
||||
<if test="typeId != null and typeId != ''">
|
||||
AND mt.id = #{typeId}
|
||||
|
|
@ -313,19 +313,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<select id="getMachineById" resultType="com.bonus.material.purchase.domain.PurchaseCheckDetails">
|
||||
SELECT
|
||||
pmi.id as id,
|
||||
pmi.task_id as taskId,
|
||||
pmi.type_id as typeId,
|
||||
pmi.ma_code as maCode
|
||||
pmi.id as id,
|
||||
pmi.task_id as taskId,
|
||||
pmi.type_id as typeId,
|
||||
pmi.ma_code as maCode
|
||||
FROM
|
||||
purchase_macode_info pmi
|
||||
LEFT JOIN ma_machine mm ON pmi.ma_code = mm.ma_code
|
||||
AND mm.type_id = #{typeId}
|
||||
bm_qrcode_info pmi
|
||||
LEFT JOIN ma_machine mm ON pmi.ma_code = mm.ma_code AND mm.type_id = #{typeId}
|
||||
WHERE
|
||||
pmi.task_id = #{taskId}
|
||||
AND pmi.type_id = #{typeId}
|
||||
AND mm.ma_status = '0'
|
||||
AND pmi.ma_code IS NOT NULL
|
||||
pmi.task_id = #{taskId}
|
||||
AND pmi.type_id = #{typeId}
|
||||
AND mm.ma_status = '0'
|
||||
AND pmi.ma_code IS NOT NULL
|
||||
</select>
|
||||
|
||||
<select id="getTypeByQrcode" resultType="com.bonus.material.purchase.domain.vo.PurchaseVo">
|
||||
|
|
@ -337,4 +336,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
WHERE
|
||||
qr_code = #{qrCode}
|
||||
</select>
|
||||
|
||||
<select id="selectPurchaseCheckDetailsById" resultType="com.bonus.material.purchase.domain.vo.PurchaseVo">
|
||||
SELECT
|
||||
pm.task_id AS taskId,
|
||||
pcd.id AS purchaseId,
|
||||
mt1.type_name AS materialName,
|
||||
mt.type_name AS materialModel,
|
||||
pm.ma_code AS maCode,
|
||||
pm.create_by AS createBy,
|
||||
pm.create_time AS createTime,
|
||||
pm.type_id AS typeId,
|
||||
pm.out_fac_code AS outFacCode,
|
||||
pcd.production_time AS productDate,
|
||||
pm.qr_code AS qrCode,
|
||||
pm.qr_url AS qrUrl,
|
||||
pcd.check_num AS purchaseNum,
|
||||
pcd.check_num AS checkNum,
|
||||
pcd.bind_num AS bindNum,
|
||||
pcd.status AS status
|
||||
FROM
|
||||
bm_qrcode_info pm
|
||||
LEFT JOIN purchase_check_details pcd ON pm.task_id = pcd.task_id
|
||||
AND pm.type_id = pcd.type_id
|
||||
LEFT JOIN ma_type mt ON pcd.type_id = mt.type_id
|
||||
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
|
||||
WHERE
|
||||
1=1 and pm.qr_code IS NOT NULL
|
||||
<if test="purchaseId != null">
|
||||
AND pcd.id = #{purchaseId}
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -26,10 +26,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</resultMap>
|
||||
|
||||
<sql id="selectPurchaseMacodeInfoVo">
|
||||
select pmi.id, pmi.task_id, pmi.type_id, pmi.ma_code, pmi.qr_code, pmi.fix_code, pmi.code_type, pmi.status,
|
||||
select pmi.id, pmi.task_id, pmi.type_id, pmi.ma_code, pmi.qr_code, pmi.status,
|
||||
pmi.create_by, pmi.create_time, pmi.update_by, pmi.update_time, pmi.remark, pmi.company_id, pmi.out_fac_code,
|
||||
mt.type_name, mt.unit_name, mtp.type_name as ma_type_name, pcd.production_time
|
||||
from purchase_macode_info pmi
|
||||
from bm_qrcode_info pmi
|
||||
left join ma_type mt on pmi.type_id = mt.type_id
|
||||
left join ma_type mtp on mt.parent_id = mtp.type_id
|
||||
left join purchase_check_details pcd on pmi.task_id = pcd.task_id and pmi.type_id = pcd.type_id
|
||||
|
|
@ -56,7 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</select>
|
||||
|
||||
<insert id="insertPurchaseMacodeInfo" parameterType="com.bonus.material.purchase.domain.PurchaseMacodeInfo" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into purchase_macode_info
|
||||
insert into bm_qrcode_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="taskId != null">task_id,</if>
|
||||
<if test="typeId != null">type_id,</if>
|
||||
|
|
@ -92,7 +92,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</insert>
|
||||
|
||||
<update id="updatePurchaseMacodeInfo" parameterType="com.bonus.material.purchase.domain.PurchaseMacodeInfo">
|
||||
update purchase_macode_info
|
||||
update bm_qrcode_info
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="taskId != null">task_id = #{taskId},</if>
|
||||
<if test="typeId != null">type_id = #{typeId},</if>
|
||||
|
|
@ -113,17 +113,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</update>
|
||||
|
||||
<delete id="deletePurchaseMacodeInfoById" parameterType="Long">
|
||||
delete from purchase_macode_info where id = #{id}
|
||||
delete from bm_qrcode_info where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deletePurchaseMacodeInfoByIds" parameterType="String">
|
||||
delete from purchase_macode_info where id in
|
||||
delete from bm_qrcode_info where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="getPurchaseMaCodeCount" resultType="Integer">
|
||||
select count(1) from purchase_macode_info where task_id = #{taskId} and type_id = #{typeId}
|
||||
select count(1) from bm_qrcode_info where task_id = #{taskId} and type_id = #{typeId}
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue