Merge branch 'feature/bug-788' into develop
This commit is contained in:
commit
6226770de9
|
|
@ -12,6 +12,7 @@ import com.nflg.wms.common.pojo.ApiResult;
|
|||
import com.nflg.wms.common.pojo.PageData;
|
||||
import com.nflg.wms.common.pojo.dto.BarcodePrintingAddDTO;
|
||||
import com.nflg.wms.common.pojo.dto.DeliverNormalOrderItemDTO;
|
||||
import com.nflg.wms.common.pojo.qo.BarcodePrintingAddQO;
|
||||
import com.nflg.wms.common.pojo.qo.BarcodePrintingEditQO;
|
||||
import com.nflg.wms.common.pojo.qo.BarcodePrintingIdsQO;
|
||||
import com.nflg.wms.common.pojo.qo.BarcodePrintingQO;
|
||||
|
|
@ -28,9 +29,12 @@ import com.nflg.wms.starter.service.FileUploadService;
|
|||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
|
@ -43,7 +47,8 @@ import java.io.IOException;
|
|||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.net.URL;
|
||||
import java.text.DecimalFormat;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
|
|
@ -56,14 +61,13 @@ import java.util.*;
|
|||
@RestController
|
||||
@RequestMapping("/barcode")
|
||||
public class BarcodePrintingController extends BaseController {
|
||||
|
||||
@Resource
|
||||
private IWmsInventoryBarcodePrintingService printingService;
|
||||
|
||||
@Resource
|
||||
private FileUploadService fileUploadService;
|
||||
|
||||
private static final DecimalFormat DF = new DecimalFormat("0.00");
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
|
|
@ -78,8 +82,8 @@ public class BarcodePrintingController extends BaseController {
|
|||
*/
|
||||
@PostMapping("items")
|
||||
@ApiMark(moduleName = "仓储物流打印", apiName = "获取编辑记录")
|
||||
public ApiResult<List<BarcodePrintingVO>> getItems(@Valid @RequestBody BarcodePrintingIdsQO request) {
|
||||
List<WmsInventoryBarcodePrinting> items = printingService.listByIds(request.getIds());
|
||||
public ApiResult<List<BarcodePrintingVO>> getItems(@Valid @RequestBody @NotEmpty List<Long> ids) {
|
||||
List<WmsInventoryBarcodePrinting> items = printingService.listByIds(ids);
|
||||
List<BarcodePrintingVO> vos = new ArrayList<>();
|
||||
if (CollectionUtil.isNotEmpty(items)) {
|
||||
vos = Convert.toList(BarcodePrintingVO.class, items);
|
||||
|
|
@ -92,11 +96,8 @@ public class BarcodePrintingController extends BaseController {
|
|||
*/
|
||||
@PostMapping("delete")
|
||||
@ApiMark(moduleName = "仓储物流打印", apiName = "批量删除记录")
|
||||
public ApiResult<Void> deleteBarcodes(@Valid @RequestBody BarcodePrintingIdsQO request) {
|
||||
if (CollectionUtil.isEmpty(request.getIds())) {
|
||||
VUtil.trueThrowBusinessError(true).throwMessage("没有需要删除的数据");
|
||||
}
|
||||
printingService.removeByIds(request.getIds());
|
||||
public ApiResult<Void> deleteBarcodes(@Valid @RequestBody @NotEmpty List<Long> ids) {
|
||||
printingService.removeByIds(ids);
|
||||
return ApiResult.success();
|
||||
}
|
||||
|
||||
|
|
@ -125,6 +126,18 @@ public class BarcodePrintingController extends BaseController {
|
|||
return ApiResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出模板
|
||||
*/
|
||||
@GetMapping("export")
|
||||
public void exportKit(HttpServletResponse response) throws Exception {
|
||||
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
||||
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + URLEncoder.encode("库存物料打印导入模板.xlsx", StandardCharsets.UTF_8));
|
||||
new Workbook()
|
||||
.addSheet(new ListSheet<>(List.of(new BarcodePrintingAddQO())))
|
||||
.writeTo(response.getOutputStream());
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入物料清单
|
||||
* @param file 文件
|
||||
|
|
@ -157,7 +170,10 @@ public class BarcodePrintingController extends BaseController {
|
|||
if (!errorBuild.isEmpty()) {
|
||||
item.setError(errorBuild.toString());
|
||||
} else {
|
||||
codes.add(Convert.convert(WmsInventoryBarcodePrinting.class, item));
|
||||
WmsInventoryBarcodePrinting entity = Convert.convert(WmsInventoryBarcodePrinting.class, item);
|
||||
entity.setCreateBy(UserUtil.getUserName());
|
||||
entity.setCreateTime(LocalDateTime.now());
|
||||
codes.add(entity);
|
||||
}
|
||||
}
|
||||
if (data.stream().noneMatch(it -> StrUtil.isNotBlank(it.getError()))
|
||||
|
|
@ -180,9 +196,9 @@ public class BarcodePrintingController extends BaseController {
|
|||
}
|
||||
|
||||
private String generateQRContent(DeliverNormalOrderItemDTO order, String indexNo) {
|
||||
String content = StrUtil.format("{}${}${}${}${}${}${}${}"
|
||||
String content = StrUtil.format("{}${}${}${}${}${}${}${}${}"
|
||||
, order.getPrintNo(), order.getExternalOrderNo(), order.getRowNo(), order.getMaterialNo(), order.getPrintNum()
|
||||
, order.getMaterialDesc(), order.getBatchNo(), Optional.ofNullable(indexNo).orElse(""));
|
||||
, order.getMaterialDesc(), "", order.getBatchNo(), Optional.ofNullable(indexNo).orElse(""));
|
||||
log.debug("二维码内容:" + content);
|
||||
return content;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,22 +19,22 @@
|
|||
FROM
|
||||
wms_inventory_barcode_printing
|
||||
<where>
|
||||
<if test="request != null and request.materialNos != null and request.materialNos != ''">
|
||||
<if test="request.materialNos != null and request.materialNos != ''">
|
||||
AND material_no IN
|
||||
<foreach item="materialNo" index="index" collection="request.materialNos.split(',')"
|
||||
open="(" separator="," close=")">
|
||||
#{materialNo}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="request != null and request.batchNumbers != null and request.batchNumbers != ''">
|
||||
<if test="request.batchNumbers != null and request.batchNumbers != ''">
|
||||
AND batch_number IN
|
||||
<foreach item="batchNo" index="index" collection="request.batchNumbers.split(',')"
|
||||
open="(" separator="," close=")">
|
||||
#{batchNo}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="request != null and request.serialNumber != null and request.serialNumber != ''">
|
||||
AND serial_numbers LIKE CONCAT('%', #{serialNumber}, '%')
|
||||
<if test="request.serialNumber != null and request.serialNumber != ''">
|
||||
AND serial_numbers LIKE CONCAT('%', #{request.serialNumber}, '%')
|
||||
</if>
|
||||
<if test="request != null and request.materialDes != null and request.materialDes != ''">
|
||||
AND material_des LIKE CONCAT('%', #{request.materialDes}, '%')
|
||||
|
|
|
|||
Loading…
Reference in New Issue