This commit is contained in:
parent
b0b2ad64f9
commit
96bb9c2bcd
@ -22,6 +22,7 @@ import tech.riemann.ims.service.material.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
@ -44,6 +45,9 @@ public class ApplyFormController {
|
||||
private final ITypeService typeService;
|
||||
private final IManualStockDetailService manualStockDetailService;
|
||||
|
||||
// 缓存需要审核的报废出库数据 key是申请id,value是材料库存详情列表
|
||||
private final Map<String, List<String>> scrapOutCacheMap = new HashMap<>();
|
||||
|
||||
@GetMapping("applies")
|
||||
@Operation(summary = "分页查询申请列表")
|
||||
public IPage<ApplyDTO> searchPage(
|
||||
@ -162,11 +166,47 @@ public class ApplyFormController {
|
||||
"m_stock = m_stock + " + detail.getQuantity())
|
||||
));
|
||||
} else if (applyType == ApplyTypeEnum.SCRAP_OUT) {
|
||||
//
|
||||
// 将扫码的数据缓存起来方便下次使用
|
||||
List<String> list = applyInfo.getDetailList().stream().map(MaterialStockDetail::getBarcode).toList();
|
||||
scrapOutCacheMap.put(applyInfo.getApplyForm().getId().toString(), list);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("scrap-out/{applyId}")
|
||||
@Operation(summary = "获取报废出库申请单")
|
||||
public List<ScrapOutApplyDTO> getScrapOutById(@Parameter(description = "申请单ID") @PathVariable(name = "applyId") Integer applyId) {
|
||||
List<ScrapOutApplyDTO> result = applyDetailService.getScrapOutById(applyId);
|
||||
result.forEach(item -> item
|
||||
.setTypeName(typeService.getTypeName(item.getType()))
|
||||
);
|
||||
return result;
|
||||
}
|
||||
|
||||
@PostMapping("scrap-out-review")
|
||||
@Operation(summary = "提交报废出库审核")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void submitScrapOutReview(@Parameter(description = "异常数据列表") @RequestBody ReviewDTO reviewDTO) {
|
||||
//修改申请状态
|
||||
applyFormService.update(Wrappers.<ApplyForm>lambdaUpdate()
|
||||
.set(ApplyForm::getReviewResult, reviewDTO.getReviewResult())
|
||||
.set(ApplyForm::getReviewRemark, reviewDTO.getRemark())
|
||||
.set(ApplyForm::getConfirm, Boolean.TRUE)
|
||||
.eq(ApplyForm::getId, reviewDTO.getApplyId()));
|
||||
if (reviewDTO.getReviewResult() == ReviewResultEnum.PASS) {
|
||||
// 修改物料状态
|
||||
List<String> barcodeList = scrapOutCacheMap.get(reviewDTO.getApplyId());
|
||||
if(barcodeList == null || barcodeList.isEmpty()){
|
||||
return;
|
||||
}
|
||||
barcodeList.forEach(barcode -> materialStockDetailService.update(Wrappers.<MaterialStockDetail>lambdaUpdate()
|
||||
.set(MaterialStockDetail::getStatus, StockStatusEnum.SCRAP_OUT)
|
||||
.eq(MaterialStockDetail::getBarcode, barcode)));
|
||||
}
|
||||
// 删除缓存
|
||||
scrapOutCacheMap.remove(reviewDTO.getApplyId());
|
||||
}
|
||||
|
||||
@PostMapping("audit-apply")
|
||||
@Operation(summary = "提交盘点申请单")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
|
@ -9,6 +9,7 @@ import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.nutz.json.JsonField;
|
||||
import tech.riemann.ims.enums.ApplyTypeEnum;
|
||||
import tech.riemann.ims.enums.ReviewResultEnum;
|
||||
|
||||
/**
|
||||
* @author mayong
|
||||
@ -20,6 +21,9 @@ import tech.riemann.ims.enums.ApplyTypeEnum;
|
||||
@NoArgsConstructor
|
||||
public class ApplyDTO {
|
||||
|
||||
@Schema(description = "申请id")
|
||||
private Long applyId;
|
||||
|
||||
@Schema(description = "申请类型")
|
||||
private ApplyTypeEnum applyType;
|
||||
|
||||
@ -41,6 +45,9 @@ public class ApplyDTO {
|
||||
@Schema(description = "申请人")
|
||||
private String applicant;
|
||||
|
||||
@Schema(description = "审核人")
|
||||
private String reviewer;
|
||||
|
||||
@Schema(description = "申请日期")
|
||||
private String applyDate;
|
||||
|
||||
@ -53,6 +60,11 @@ public class ApplyDTO {
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "是否确认")
|
||||
private Boolean confirm;
|
||||
|
||||
@Schema(description = "审核状态")
|
||||
private ReviewResultEnum reviewResult;
|
||||
|
||||
@JsonGetter
|
||||
@JsonField
|
||||
|
@ -0,0 +1,49 @@
|
||||
package tech.riemann.ims.dto.response;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @author mayong
|
||||
* @since 2025/3/15 10:39
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
public class ScrapOutApplyDTO {
|
||||
|
||||
@Schema(description = "物料名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "类型")
|
||||
private String type;
|
||||
|
||||
@Schema(description = "类型名称")
|
||||
private String typeName;
|
||||
|
||||
@Schema(description = "物料规格")
|
||||
private String spec;
|
||||
|
||||
@Schema(description = "单价")
|
||||
private String price;
|
||||
|
||||
@Schema(description = "申请人")
|
||||
private String applicant;
|
||||
|
||||
@Schema(description = "确认数量")
|
||||
private Integer confirmQuantity;
|
||||
|
||||
@Schema(description = "条码集合")
|
||||
private String barcodeList;
|
||||
|
||||
@Schema(description = "报废原因")
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
@ -17,6 +17,7 @@ public enum StockStatusEnum implements ICodeBook {
|
||||
OUT("1", "外借"),
|
||||
OFF("2", "下架"),
|
||||
LOST("3", "丢失"),
|
||||
SCRAP_OUT("4", "报废"),
|
||||
|
||||
;
|
||||
|
||||
|
@ -2,6 +2,7 @@ package tech.riemann.ims.mapper.material;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import tech.riemann.ims.dto.response.ScrapOutApplyDTO;
|
||||
import tech.riemann.ims.dto.response.WaitScanInfo;
|
||||
import tech.riemann.ims.entity.material.ApplyDetail;
|
||||
|
||||
@ -13,4 +14,6 @@ import java.util.List;
|
||||
*/
|
||||
public interface ApplyDetailMapper extends BaseMapper<ApplyDetail> {
|
||||
List<WaitScanInfo> getWaitScanData(@Param("applyId") Long applyId);
|
||||
|
||||
List<ScrapOutApplyDTO> getScrapOutById(Integer applyId);
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package tech.riemann.ims.service.material;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nutz.spring.boot.service.interfaces.IdNameEntityService;
|
||||
import tech.riemann.ims.dto.response.ScrapOutApplyDTO;
|
||||
import tech.riemann.ims.dto.response.WaitScanInfo;
|
||||
import tech.riemann.ims.entity.material.ApplyDetail;
|
||||
|
||||
@ -14,4 +15,6 @@ import java.util.List;
|
||||
public interface IApplyDetailService extends IService<ApplyDetail>, IdNameEntityService<ApplyDetail> {
|
||||
|
||||
List<WaitScanInfo> getWaitScanData(Long applyId);
|
||||
|
||||
List<ScrapOutApplyDTO> getScrapOutById(Integer applyId);
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.springframework.stereotype.Service;
|
||||
import tech.riemann.ims.dto.response.ScrapOutApplyDTO;
|
||||
import tech.riemann.ims.dto.response.WaitScanInfo;
|
||||
import tech.riemann.ims.entity.material.ApplyDetail;
|
||||
import tech.riemann.ims.mapper.material.ApplyDetailMapper;
|
||||
@ -30,4 +31,9 @@ public class ApplyDetailServiceImpl extends ServiceImpl<ApplyDetailMapper, Apply
|
||||
public List<WaitScanInfo> getWaitScanData(Long applyId) {
|
||||
return baseMapper.getWaitScanData(applyId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ScrapOutApplyDTO> getScrapOutById(Integer applyId) {
|
||||
return baseMapper.getScrapOutById(applyId);
|
||||
}
|
||||
}
|
||||
|
@ -17,4 +17,31 @@
|
||||
WHERE
|
||||
d.ad_apply_id = #{applyId}
|
||||
</select>
|
||||
|
||||
<resultMap id="resultMap2" type="tech.riemann.ims.dto.response.ScrapOutApplyDTO">
|
||||
<result property="name" column="m_name" />
|
||||
<result property="type" column="m_type" />
|
||||
<result property="spec" column="m_spec" />
|
||||
<result property="price" column="m_price" />
|
||||
<result property="confirmQuantity" column="ad_confirm_quantity" />
|
||||
<result property="remark" column="ad_exception_remark" />
|
||||
<result property="applicant" column="af_applicant" />
|
||||
</resultMap>
|
||||
|
||||
<select id="getScrapOutById" resultMap="resultMap2">
|
||||
SELECT
|
||||
m.m_name,
|
||||
m.m_type,
|
||||
m.m_spec,
|
||||
m.m_price,
|
||||
d.ad_confirm_quantity,
|
||||
d.ad_exception_remark,
|
||||
a.af_applicant
|
||||
FROM
|
||||
t_apply_detail d
|
||||
LEFT JOIN t_material m ON m.id = d.ad_material_id
|
||||
LEFT JOIN t_apply_form a ON a.id = d.ad_apply_id
|
||||
WHERE
|
||||
d.ad_apply_id = #{applyId}
|
||||
</select>
|
||||
</mapper>
|
@ -3,9 +3,11 @@
|
||||
<mapper namespace="tech.riemann.ims.mapper.material.ApplyFormMapper">
|
||||
|
||||
<resultMap id="resultMap" type="tech.riemann.ims.dto.response.ApplyDTO">
|
||||
<id property="applyId" column="id" />
|
||||
<result property="applyNum" column="ad_quantity" />
|
||||
<result property="applyDate" column="af_apply_date" />
|
||||
<result property="applicant" column="af_applicant" />
|
||||
<result property="reviewer" column="af_reviewer" />
|
||||
<result property="confirmNum" column="ad_confirm_quantity" />
|
||||
<result property="type" column="m_type" />
|
||||
<result property="code" column="m_code" />
|
||||
@ -13,20 +15,26 @@
|
||||
<result property="spec" column="m_spec" />
|
||||
<result property="applyType" column="af_type" />
|
||||
<result property="remark" column="ad_exception_remark" />
|
||||
<result property="confirm" column="af_is_confirm" />
|
||||
<result property="reviewResult" column="af_review_result" />
|
||||
</resultMap>
|
||||
|
||||
<select id="searchPage" resultMap="resultMap">
|
||||
SELECT
|
||||
f.id,
|
||||
d.ad_quantity,
|
||||
f.af_apply_date,
|
||||
d.ad_exception_remark,
|
||||
d.ad_confirm_quantity,
|
||||
f.af_applicant,
|
||||
f.af_reviewer,
|
||||
m.m_type,
|
||||
m.m_code,
|
||||
m.m_name,
|
||||
m.m_spec,
|
||||
f.af_type
|
||||
f.af_type,
|
||||
f.af_is_confirm,
|
||||
f.af_review_result
|
||||
FROM
|
||||
t_apply_form f
|
||||
LEFT JOIN t_apply_detail d ON f.id = d.ad_apply_id
|
||||
|
Loading…
x
Reference in New Issue
Block a user