parent
1f9687b20d
commit
ceb6c19a2e
|
|
@ -9,6 +9,7 @@ import com.nflg.wms.admin.pojo.dto.QCMaterialSyncDTO;
|
|||
import com.nflg.wms.admin.pojo.dto.ZWM3A17DTO;
|
||||
import com.nflg.wms.admin.repository.SrmMaterialReceiptNoScanCodesRepository;
|
||||
import com.nflg.wms.admin.repository.SrmMaterialReceiptScanCodesRepository;
|
||||
import com.nflg.wms.common.constant.BarCodeProcessStage;
|
||||
import com.nflg.wms.common.pojo.document.SrmMaterialReceiptNoScanCodes;
|
||||
import com.nflg.wms.common.pojo.document.SrmMaterialReceiptScanCodes;
|
||||
import com.nflg.wms.common.pojo.dto.*;
|
||||
|
|
@ -634,6 +635,10 @@ public class NormalPGIControllerService {
|
|||
boolean exists = dto.getQrCodes().stream().anyMatch(qrCode ->
|
||||
qrCode.getBarcodeCode().equals(parent.getBarcodeCode()));
|
||||
if (!exists) {
|
||||
parent.setProcessStage(BarCodeProcessStage.Received.getState());
|
||||
parent.setLastScanBy(UserUtil.getUserId());
|
||||
parent.setLastScanByname(UserUtil.getUserName());
|
||||
parent.setLastScanTime(LocalDateTime.now());
|
||||
dto.getQrCodes().add(parent);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,84 @@
|
|||
package com.nflg.wms.common.pojo.vo;
|
||||
|
||||
import com.nflg.wms.common.util.NumberUtil;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 物料明细打印预览VO
|
||||
*/
|
||||
@Data
|
||||
public class MaterialItemPrintVO {
|
||||
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 物料编号
|
||||
*/
|
||||
private String materialNo;
|
||||
|
||||
/**
|
||||
* 物料描述
|
||||
*/
|
||||
private String materialDescribe;
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
private BigDecimal num;
|
||||
|
||||
/**
|
||||
* 数量文本
|
||||
*/
|
||||
private String numText;
|
||||
|
||||
public String getNumText() {
|
||||
return NumberUtil.format(num);
|
||||
}
|
||||
|
||||
/**
|
||||
* 实发数量
|
||||
*/
|
||||
private BigDecimal actualNum;
|
||||
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
private String unit;
|
||||
|
||||
/**
|
||||
* 项目类型
|
||||
*/
|
||||
private String projectType;
|
||||
|
||||
/**
|
||||
* 生产订单号
|
||||
*/
|
||||
private String productionOrderNumber;
|
||||
|
||||
/**
|
||||
* 箱号
|
||||
*/
|
||||
private String boxNo;
|
||||
|
||||
/**
|
||||
* 机台编号
|
||||
*/
|
||||
private String deviceNo;
|
||||
|
||||
/**
|
||||
* 客户名称
|
||||
*/
|
||||
private String customerName;
|
||||
|
||||
/**
|
||||
* 二维码(Base64)
|
||||
*/
|
||||
private String qrCode;
|
||||
|
||||
/**
|
||||
* 图片(Base64)
|
||||
*/
|
||||
private String image;
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package com.nflg.wms.repository.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.nflg.wms.common.pojo.vo.MaterialItemPrintVO;
|
||||
import com.nflg.wms.common.pojo.vo.ShipmentMaterialCodeItemVO;
|
||||
import com.nflg.wms.repository.entity.WmsShipmentMaterialCodeItem;
|
||||
|
||||
|
|
@ -20,4 +21,8 @@ public interface WmsShipmentMaterialCodeItemMapper extends BaseMapper<WmsShipmen
|
|||
List<ShipmentMaterialCodeItemVO> getByCodeId(Long codeId);
|
||||
|
||||
void updatePackingNum(Set<Long> ids);
|
||||
|
||||
List<MaterialItemPrintVO> getListByMaterialNos(Set<String> materialNos);
|
||||
|
||||
List<MaterialItemPrintVO> getListByItemIds(List<Long> ids);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import com.nflg.wms.common.pojo.vo.ShipmentMaterialCodeQRVO;
|
|||
import com.nflg.wms.repository.entity.WmsShipmentMaterialCodeItemQr;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
|
@ -21,4 +22,6 @@ public interface WmsShipmentMaterialCodeItemQrMapper extends BaseMapper<WmsShipm
|
|||
List<ShipmentMaterialCodeQRVO> getListVOByItemIds(List<Long> ids);
|
||||
|
||||
List<ShipmentMaterialCodeQRVO> getListVOByCodeIds(List<Long> ids);
|
||||
|
||||
List<ShipmentMaterialCodeQRVO> getListVOByMaterialNos(Set<String> materialNos);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||
import jakarta.validation.constraints.NotEmpty;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
|
@ -22,4 +23,6 @@ public interface IWmsShipmentMaterialCodeItemQrService extends IService<WmsShipm
|
|||
List<ShipmentMaterialCodeQRVO> getListVOByItemIds(List<Long> ids);
|
||||
|
||||
List<ShipmentMaterialCodeQRVO> getListVOByCodeIds(List<Long> ids);
|
||||
|
||||
List<ShipmentMaterialCodeQRVO> getListVOByMaterialNos(Set<String> materialNos);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.nflg.wms.repository.service;
|
||||
|
||||
import com.nflg.wms.common.pojo.vo.MaterialItemPrintVO;
|
||||
import com.nflg.wms.common.pojo.vo.ShipmentMaterialCodeItemVO;
|
||||
import com.nflg.wms.repository.entity.WmsShipmentMaterialCodeItem;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
|
@ -20,4 +21,8 @@ public interface IWmsShipmentMaterialCodeItemService extends IService<WmsShipmen
|
|||
List<ShipmentMaterialCodeItemVO> getByCodeId(Long codeId);
|
||||
|
||||
void updatePackingNum(Set<Long> ids);
|
||||
|
||||
List<MaterialItemPrintVO> getListByMaterialNos(Set<String> materialNos);
|
||||
|
||||
List<MaterialItemPrintVO> getListByItemIds(List<Long> ids);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
|
@ -34,4 +35,9 @@ public class WmsShipmentMaterialCodeItemQrServiceImpl extends ServiceImpl<WmsShi
|
|||
public List<ShipmentMaterialCodeQRVO> getListVOByCodeIds(List<Long> ids) {
|
||||
return baseMapper.getListVOByCodeIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ShipmentMaterialCodeQRVO> getListVOByMaterialNos(Set<String> materialNos) {
|
||||
return baseMapper.getListVOByMaterialNos(materialNos);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.nflg.wms.repository.service.impl;
|
||||
|
||||
import com.nflg.wms.common.pojo.vo.MaterialItemPrintVO;
|
||||
import com.nflg.wms.common.pojo.vo.ShipmentMaterialCodeItemVO;
|
||||
import com.nflg.wms.repository.entity.WmsShipmentMaterialCodeItem;
|
||||
import com.nflg.wms.repository.mapper.WmsShipmentMaterialCodeItemMapper;
|
||||
|
|
@ -30,4 +31,14 @@ public class WmsShipmentMaterialCodeItemServiceImpl extends ServiceImpl<WmsShipm
|
|||
public void updatePackingNum(Set<Long> ids) {
|
||||
baseMapper.updatePackingNum(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MaterialItemPrintVO> getListByMaterialNos(Set<String> materialNos) {
|
||||
return baseMapper.getListByMaterialNos(materialNos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MaterialItemPrintVO> getListByItemIds(List<Long> ids) {
|
||||
return baseMapper.getListByItemIds(ids);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,4 +25,28 @@
|
|||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<select id="getListByMaterialNos" resultType="com.nflg.wms.common.pojo.vo.MaterialItemPrintVO">
|
||||
SELECT it.id, it.material_no, it.material_describe, it.num, it.actual_num, it.unit,
|
||||
it.project_type, it.production_order_number, it.box_no,
|
||||
mc.device_no, mc.customer_name
|
||||
FROM wms_shipment_material_code_item it
|
||||
INNER JOIN wms_shipment_material_code mc ON mc."id" = it.material_code_id
|
||||
WHERE it.material_no IN
|
||||
<foreach item="item" collection="materialNos" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="getListByItemIds" resultType="com.nflg.wms.common.pojo.vo.MaterialItemPrintVO">
|
||||
SELECT it.id, it.material_no, it.material_describe, it.num, it.actual_num, it.unit,
|
||||
it.project_type, it.production_order_number, it.box_no,
|
||||
mc.device_no, mc.customer_name
|
||||
FROM wms_shipment_material_code_item it
|
||||
INNER JOIN wms_shipment_material_code mc ON mc."id" = it.material_code_id
|
||||
WHERE it.id IN
|
||||
<foreach item="item" collection="ids" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -31,4 +31,15 @@
|
|||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="getListVOByMaterialNos" resultType="com.nflg.wms.common.pojo.vo.ShipmentMaterialCodeQRVO">
|
||||
SELECT qr.id,qr.no,it.material_no,it.material_describe,qr.num,it.unit,qr.status,mc.device_no,mc.customer_name
|
||||
FROM wms_shipment_material_code_item_qr qr
|
||||
INNER JOIN wms_shipment_material_code_item it ON qr.item_id=it."id"
|
||||
INNER JOIN wms_shipment_material_code mc ON mc."id"=it.material_code_id
|
||||
where it.material_no in
|
||||
<foreach item="item" collection="materialNos" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import com.nflg.wms.common.pojo.dto.MaterialCodePrintDTO;
|
|||
import com.nflg.wms.common.pojo.dto.MaterialPdfDTO;
|
||||
import com.nflg.wms.common.pojo.qo.*;
|
||||
import com.nflg.wms.common.pojo.vo.MaterialPdfVO;
|
||||
import com.nflg.wms.common.pojo.vo.MaterialItemPrintVO;
|
||||
import com.nflg.wms.common.pojo.vo.ShipmentMaterialCodeQRVO;
|
||||
import com.nflg.wms.common.pojo.vo.ShipmentMaterialCodeItemVO;
|
||||
import com.nflg.wms.common.util.EecExcelUtil;
|
||||
|
|
@ -826,21 +827,26 @@ public class MaterialCodeController extends BaseController {
|
|||
* 导出标签图片PDF(打印预览)
|
||||
*
|
||||
* @param response HTTP响应
|
||||
* @param ids 清单明细id列表
|
||||
* @param ids 物料主数据id列表(wms_shipment_material.id)
|
||||
*/
|
||||
@PostMapping("exportToPdf")
|
||||
public void exportToPdf(HttpServletResponse response, @RequestBody @NotEmpty List<Long> ids) throws Exception {
|
||||
List<ShipmentMaterialCodeQRVO> datas = materialCodeItemQrService.getListVOByItemIds(ids);
|
||||
VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(datas)).throwMessage("没有需要导出的数据");
|
||||
// 根据物料主数据ID查询物料编号
|
||||
List<WmsShipmentMaterial> materials = materialService.listByIds(ids);
|
||||
VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(materials)).throwMessage("物料数据不存在");
|
||||
|
||||
// 获取物料图片
|
||||
Map<String, String> images = materialService.lambdaQuery()
|
||||
.select(WmsShipmentMaterial::getNo, WmsShipmentMaterial::getImage)
|
||||
.in(WmsShipmentMaterial::getNo, datas.stream().map(ShipmentMaterialCodeQRVO::getMaterialNo).collect(Collectors.toSet()))
|
||||
.list()
|
||||
.stream()
|
||||
Set<String> materialNos = materials.stream()
|
||||
.map(WmsShipmentMaterial::getNo)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
// 根据物料编号查询物料图片
|
||||
Map<String, String> images = materials.stream()
|
||||
.collect(Collectors.toMap(WmsShipmentMaterial::getNo, WmsShipmentMaterial::getImage));
|
||||
|
||||
// 根据物料编号查询清单明细二维码数据
|
||||
List<ShipmentMaterialCodeQRVO> datas = materialCodeItemQrService.getListVOByMaterialNos(materialNos);
|
||||
VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(datas)).throwMessage("没有需要导出的数据");
|
||||
|
||||
// 构建打印数据
|
||||
Map<String, Object> variables = new HashMap<>();
|
||||
variables.put("list", datas.stream()
|
||||
|
|
@ -862,4 +868,92 @@ public class MaterialCodeController extends BaseController {
|
|||
URL baseUrl = new ClassPathResource("template/label/").getURL();
|
||||
PdfGeneratorUtil.generatePdf("物料码标签", html, baseUrl.toString(), response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据明细ID导出物料明细PDF(打印预览)
|
||||
*
|
||||
* @param response HTTP响应
|
||||
* @param ids 明细id列表(wms_shipment_material_code_item.id)
|
||||
*/
|
||||
@PostMapping("exportItemToPdf")
|
||||
public void exportItemToPdf(HttpServletResponse response, @RequestBody @NotEmpty List<Long> ids) throws Exception {
|
||||
// 根据明细ID查询数据
|
||||
List<MaterialItemPrintVO> datas = materialCodeItemService.getListByItemIds(ids);
|
||||
VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(datas)).throwMessage("没有需要导出的数据");
|
||||
|
||||
// 获取物料图片
|
||||
Map<String, String> images = materialService.lambdaQuery()
|
||||
.select(WmsShipmentMaterial::getNo, WmsShipmentMaterial::getImage)
|
||||
.in(WmsShipmentMaterial::getNo, datas.stream().map(MaterialItemPrintVO::getMaterialNo).collect(Collectors.toSet()))
|
||||
.list()
|
||||
.stream()
|
||||
.collect(Collectors.toMap(WmsShipmentMaterial::getNo, WmsShipmentMaterial::getImage));
|
||||
|
||||
// 构建打印数据
|
||||
Map<String, Object> variables = new HashMap<>();
|
||||
variables.put("list", datas.stream()
|
||||
.map(data -> new MaterialCodePrintDTO()
|
||||
.setNo(data.getMaterialNo() + "-" + data.getId())
|
||||
.setQrCode(QRCodeUtil.generateQRCodeBase64(data.getMaterialNo() + "-" + data.getId(), 200, 200))
|
||||
.setMaterialNo(data.getMaterialNo())
|
||||
.setMaterialDescribe(data.getMaterialDescribe())
|
||||
.setNum(data.getNum())
|
||||
.setNumText(data.getNumText())
|
||||
.setUnit(data.getUnit())
|
||||
.setDeviceNo(data.getDeviceNo())
|
||||
.setCustomerName(data.getCustomerName())
|
||||
.setLst(images.get(data.getMaterialNo()))
|
||||
).toList()
|
||||
);
|
||||
|
||||
String html = ThymeleafUtil.generator("/template/label/", "material-pdf", ".html", variables);
|
||||
URL baseUrl = new ClassPathResource("template/label/").getURL();
|
||||
PdfGeneratorUtil.generatePdf("物料明细标签", html, baseUrl.toString(), response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据物料主数据ID导出物料明细PDF(打印预览)
|
||||
*
|
||||
* @param response HTTP响应
|
||||
* @param ids 物料主数据id列表(wms_shipment_material.id)
|
||||
*/
|
||||
@PostMapping("exportMaterialItemToPdf")
|
||||
public void exportMaterialItemToPdf(HttpServletResponse response, @RequestBody @NotEmpty List<Long> ids) throws Exception {
|
||||
// 根据物料主数据ID查询物料编号
|
||||
List<WmsShipmentMaterial> materials = materialService.listByIds(ids);
|
||||
VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(materials)).throwMessage("物料数据不存在");
|
||||
|
||||
Set<String> materialNos = materials.stream()
|
||||
.map(WmsShipmentMaterial::getNo)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
// 根据物料编号查询物料图片
|
||||
Map<String, String> images = materials.stream()
|
||||
.collect(Collectors.toMap(WmsShipmentMaterial::getNo, WmsShipmentMaterial::getImage));
|
||||
|
||||
// 根据物料编号查询明细数据
|
||||
List<MaterialItemPrintVO> datas = materialCodeItemService.getListByMaterialNos(materialNos);
|
||||
VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(datas)).throwMessage("没有需要导出的数据");
|
||||
|
||||
// 构建打印数据
|
||||
Map<String, Object> variables = new HashMap<>();
|
||||
variables.put("list", datas.stream()
|
||||
.map(data -> new MaterialCodePrintDTO()
|
||||
.setNo(data.getMaterialNo() + "-" + data.getId())
|
||||
.setQrCode(QRCodeUtil.generateQRCodeBase64(data.getMaterialNo() + "-" + data.getId(), 200, 200))
|
||||
.setMaterialNo(data.getMaterialNo())
|
||||
.setMaterialDescribe(data.getMaterialDescribe())
|
||||
.setNum(data.getNum())
|
||||
.setNumText(data.getNumText())
|
||||
.setUnit(data.getUnit())
|
||||
.setDeviceNo(data.getDeviceNo())
|
||||
.setCustomerName(data.getCustomerName())
|
||||
.setLst(images.get(data.getMaterialNo()))
|
||||
).toList()
|
||||
);
|
||||
|
||||
String html = ThymeleafUtil.generator("/template/label/", "material-pdf", ".html", variables);
|
||||
URL baseUrl = new ClassPathResource("template/label/").getURL();
|
||||
PdfGeneratorUtil.generatePdf("物料明细标签", html, baseUrl.toString(), response);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue