parent
a42df50cd8
commit
924bf4c5ff
|
|
@ -19,6 +19,7 @@ import com.nflg.wms.common.pojo.dto.ZWM3A06Input1DTO;
|
|||
import com.nflg.wms.common.pojo.dto.ZWM3A06Input2DTO;
|
||||
import com.nflg.wms.common.pojo.qo.OutPurchaseSearchQO;
|
||||
import com.nflg.wms.common.pojo.qo.zwm3A05QO;
|
||||
import com.nflg.wms.common.pojo.vo.OutPurchaseVO;
|
||||
import com.nflg.wms.common.pojo.vo.ZWM3A05VO;
|
||||
import com.nflg.wms.common.util.UserUtil;
|
||||
import com.nflg.wms.common.util.VUtil;
|
||||
|
|
@ -106,38 +107,42 @@ public class OutPurchaseController extends BaseController {
|
|||
item.setId(IdUtil.getSnowflakeNextId());
|
||||
item.setOrderId(order.getId());
|
||||
item.setNum(BigDecimal.ZERO);
|
||||
it.getQrCodes().forEach(qrCode -> {
|
||||
MaterialQRCodeContentDTO dto = NoUtil.getMaterialQRCodeContent(qrCode);
|
||||
VUtil.trueThrowBusinessError(!StrUtil.equals(dto.getMaterialNo(), it.getMatnr()))
|
||||
.throwMessage("物料" + it.getMatnr() + "与二维码不匹配");
|
||||
VUtil.trueThrowBusinessError(!check(dto, it.getCharg(), it.getSernrs()))
|
||||
.throwMessage("物料" + it.getMatnr() + "包含不符合批次号和序列号的扫码记录");
|
||||
item.setNum(item.getNum().add(dto.getNum()));
|
||||
records.add(new OutMaterialScanRecord()
|
||||
.setSource(6)
|
||||
.setSourceId(order.getId())
|
||||
.setSourceItemId(item.getId())
|
||||
.setTicketId(order.getId())
|
||||
.setTicketItemId(item.getId())
|
||||
.setMaterialNo(dto.getMaterialNo())
|
||||
.setContent(qrCode)
|
||||
.setBatchNo(dto.getBatchNo())
|
||||
.setSerialNo(dto.getSerialNo())
|
||||
.setUniqNo(dto.getUniqNo())
|
||||
.setFactoryNo(item.getWerks())
|
||||
.setWarehouseNo(item.getLgort())
|
||||
.setNum(dto.getNum())
|
||||
.setUnit(it.getMeins())
|
||||
.setEbeln(order.getEbeln())
|
||||
.setEbeln(it.getEbelp())
|
||||
.setCreateBy(UserUtil.getUserName())
|
||||
.setCreateTime(Instant.now())
|
||||
);
|
||||
});
|
||||
if (CollectionUtil.isNotEmpty(it.getQrCodes())) {
|
||||
it.getQrCodes().forEach(qrCode -> {
|
||||
MaterialQRCodeContentDTO dto = NoUtil.getMaterialQRCodeContent(qrCode);
|
||||
VUtil.trueThrowBusinessError(!StrUtil.equals(dto.getMaterialNo(), it.getMatnr()))
|
||||
.throwMessage("物料" + it.getMatnr() + "与二维码不匹配");
|
||||
VUtil.trueThrowBusinessError(!check(dto, it.getCharg(), it.getSernrs()))
|
||||
.throwMessage("物料" + it.getMatnr() + "包含不符合批次号和序列号的扫码记录");
|
||||
item.setNum(item.getNum().add(dto.getNum()));
|
||||
records.add(new OutMaterialScanRecord()
|
||||
.setSource(6)
|
||||
.setSourceId(order.getId())
|
||||
.setSourceItemId(item.getId())
|
||||
.setTicketId(order.getId())
|
||||
.setTicketItemId(item.getId())
|
||||
.setMaterialNo(dto.getMaterialNo())
|
||||
.setContent(qrCode)
|
||||
.setBatchNo(dto.getBatchNo())
|
||||
.setSerialNo(dto.getSerialNo())
|
||||
.setUniqNo(dto.getUniqNo())
|
||||
.setFactoryNo(item.getWerks())
|
||||
.setWarehouseNo(item.getLgort())
|
||||
.setNum(dto.getNum())
|
||||
.setUnit(it.getMeins())
|
||||
.setEbeln(order.getEbeln())
|
||||
.setEbeln(it.getEbelp())
|
||||
.setCreateBy(UserUtil.getUserName())
|
||||
.setCreateTime(Instant.now())
|
||||
);
|
||||
});
|
||||
}
|
||||
VUtil.trueThrowBusinessError(it.getNum().compareTo(item.getTemng()) > 0)
|
||||
.throwMessage("物料" + it.getMatnr() + "的扫码数量大于退货数量");
|
||||
VUtil.trueThrowBusinessError(item.getNum().compareTo(it.getNum()) != 0)
|
||||
.throwMessage("物料" + it.getMatnr() + "的扫码数量不一致");
|
||||
items.add(item);
|
||||
if (item.getNum().compareTo(BigDecimal.ZERO) > 0) {
|
||||
items.add(item);
|
||||
input1.add(new ZWM3A06Input1DTO()
|
||||
.setEbelp(it.getEbelp())
|
||||
.setRetpo(it.getRetpo())
|
||||
|
|
@ -213,7 +218,7 @@ public class OutPurchaseController extends BaseController {
|
|||
* 搜索列表
|
||||
*/
|
||||
@PostMapping("search")
|
||||
public ApiResult<PageData<WmsOutPurchase>> search(@Valid @RequestBody OutPurchaseSearchQO request) {
|
||||
public ApiResult<PageData<OutPurchaseVO>> search(@Valid @RequestBody OutPurchaseSearchQO request) {
|
||||
return ApiResult.success(outPurchaseService.search(request));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,51 @@
|
|||
package com.nflg.wms.common.pojo.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class OutPurchaseVO {
|
||||
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 退库单号
|
||||
*/
|
||||
private String no;
|
||||
|
||||
/**
|
||||
* 采购凭证号
|
||||
*/
|
||||
private String ebeln;
|
||||
|
||||
/**
|
||||
* 供应商或债权人的帐号
|
||||
*/
|
||||
private String lifnr;
|
||||
|
||||
/**
|
||||
* 供应商或债权人名称
|
||||
*/
|
||||
private String lifnrName;
|
||||
|
||||
/**
|
||||
* 物料凭证编号
|
||||
*/
|
||||
private String matDoc;
|
||||
|
||||
/**
|
||||
* 物料凭证年度
|
||||
*/
|
||||
private String docYear;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
}
|
||||
|
|
@ -1,13 +1,13 @@
|
|||
package com.nflg.wms.common.pojo.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Data
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
|
|
@ -56,6 +56,7 @@ public class ZWM3A05ItemVO {
|
|||
/**
|
||||
* 退货数量
|
||||
*/
|
||||
@NotNull
|
||||
private BigDecimal temng;
|
||||
|
||||
/**
|
||||
|
|
@ -91,9 +92,14 @@ public class ZWM3A05ItemVO {
|
|||
/**
|
||||
* 实际退货数量(扫码后计算)
|
||||
*/
|
||||
@NotNull(message = "实际退货数量不能为空")
|
||||
private BigDecimal num;
|
||||
|
||||
@NotEmpty(message = "请扫码添加物料")
|
||||
public BigDecimal getNum() {
|
||||
return Optional.ofNullable(num).orElse(BigDecimal.ZERO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 二维码列表
|
||||
*/
|
||||
private List<String> qrCodes = new ArrayList<>();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,10 @@
|
|||
package com.nflg.wms.repository.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.nflg.wms.common.pojo.qo.OutPurchaseSearchQO;
|
||||
import com.nflg.wms.common.pojo.vo.OutPurchaseVO;
|
||||
import com.nflg.wms.repository.entity.WmsOutPurchase;
|
||||
|
||||
/**
|
||||
|
|
@ -12,4 +16,6 @@ import com.nflg.wms.repository.entity.WmsOutPurchase;
|
|||
* @since 2025
|
||||
*/
|
||||
public interface WmsOutPurchaseMapper extends BaseMapper<WmsOutPurchase> {
|
||||
|
||||
IPage<OutPurchaseVO> search(OutPurchaseSearchQO request, Page<?> page);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.nflg.wms.repository.service;
|
|||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.nflg.wms.common.pojo.qo.OutPurchaseSearchQO;
|
||||
import com.nflg.wms.common.pojo.vo.OutPurchaseVO;
|
||||
import com.nflg.wms.repository.entity.WmsOutPurchase;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
|
|
@ -16,5 +17,5 @@ import jakarta.validation.Valid;
|
|||
*/
|
||||
public interface IWmsOutPurchaseService extends IService<WmsOutPurchase> {
|
||||
|
||||
IPage<WmsOutPurchase> search(@Valid OutPurchaseSearchQO request);
|
||||
IPage<OutPurchaseVO> search(@Valid OutPurchaseSearchQO request);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,17 +1,15 @@
|
|||
package com.nflg.wms.repository.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.nflg.wms.common.pojo.qo.OutPurchaseSearchQO;
|
||||
import com.nflg.wms.common.pojo.vo.OutPurchaseVO;
|
||||
import com.nflg.wms.repository.entity.WmsOutPurchase;
|
||||
import com.nflg.wms.repository.mapper.WmsOutPurchaseMapper;
|
||||
import com.nflg.wms.repository.service.IWmsOutPurchaseService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 退库-采购中心退库 服务实现类
|
||||
|
|
@ -23,14 +21,7 @@ import java.util.Objects;
|
|||
public class WmsOutPurchaseServiceImpl extends ServiceImpl<WmsOutPurchaseMapper, WmsOutPurchase> implements IWmsOutPurchaseService {
|
||||
|
||||
@Override
|
||||
public IPage<WmsOutPurchase> search(OutPurchaseSearchQO request) {
|
||||
return lambdaQuery()
|
||||
.eq(StrUtil.isNotBlank(request.getNo()), WmsOutPurchase::getNo, request.getNo())
|
||||
.eq(StrUtil.isNotBlank(request.getEbeln()), WmsOutPurchase::getEbeln, request.getEbeln())
|
||||
.eq(StrUtil.isNotBlank(request.getLifnr()), WmsOutPurchase::getLifnr, request.getLifnr())
|
||||
.ge(Objects.nonNull(request.getStartDate()), WmsOutPurchase::getCreateTime, request.getStartDate())
|
||||
.le(Objects.nonNull(request.getEndDate()), WmsOutPurchase::getCreateTime, request.getEndDate())
|
||||
.orderByDesc(WmsOutPurchase::getId)
|
||||
.page(new Page<>(request.getPage(), request.getPageSize()));
|
||||
public IPage<OutPurchaseVO> search(OutPurchaseSearchQO request) {
|
||||
return baseMapper.search(request, new Page<>(request.getPage(), request.getPageSize()));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,27 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.nflg.wms.repository.mapper.WmsOutPurchaseMapper">
|
||||
|
||||
<select id="search" resultType="com.nflg.wms.common.pojo.vo.OutPurchaseVO">
|
||||
select op.*,us.supplier_name as "lifnr_name"
|
||||
from wms_out_purchase op
|
||||
left join user_supplier us on op.lifnr=us.supplier_code
|
||||
<where>
|
||||
<if test="request.startDate != null">
|
||||
and op.create_time >= #{request.startDate}
|
||||
</if>
|
||||
<if test="request.endDate != null">
|
||||
and op.create_time <= #{request.endDate}
|
||||
</if>
|
||||
<if test="request.no!=null and request.no!=''">
|
||||
and op."no" ilike concat('%', #{request.no}, '%')
|
||||
</if>
|
||||
<if test="request.ebeln!=null and request.ebeln!=''">
|
||||
and op.ebeln ilike concat('%', #{request.ebeln}, '%')
|
||||
</if>
|
||||
<if test="request.lifnr!=null and request.lifnr!=''">
|
||||
and op.lifnr ilike concat('%', #{request.lifnr}, '%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue