fix(销售出货平台):送货单打印预览自定义

This commit is contained in:
chengzhaofeng 2025-03-13 19:39:22 +08:00
parent 64b5d14b6d
commit 05120e9934
6 changed files with 123 additions and 9 deletions

View File

@ -28,11 +28,17 @@ public class InventorySummaryReportNewThreeDTO {
private String erpStorageLocation;
/**
* 卷号(托)
* 卷号
*/
@ExcelProperty("卷号(托)")
@ExcelProperty("卷号")
private String inventoryId;
/**
* 载具
*/
@ExcelProperty("载具")
private String carrier;
/**
* 状态
*/

View File

@ -111,4 +111,7 @@ public class SaleOutDetailDTO {
@TableField(exist = false)
private String productType;
@TableField(exist = false)
private String remarks;
}

View File

@ -25,6 +25,7 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
/**
@ -176,6 +177,20 @@ public class PickingController {
return R.ok(pickingService.printDeliveryLabel(saleOutRequestDTO));
}
@ApiOperation(value = "销售出货-出货单预览-新", notes = "销售出货-出货单预览-新")
@SysLog("销售出货-出货单预览-新")
@PostMapping("/printDeliveryLabelPreview")
public R printDeliveryLabelPreview(@RequestBody SaleOutRequestDTO saleOutRequestDTO) {
return R.ok(pickingService.printDeliveryLabelPreview(saleOutRequestDTO));
}
@ApiOperation(value = "销售出货-出货单打印-新", notes = "销售出货-出货单打印-新")
@SysLog("销售出货-出货单打印-新")
@PostMapping("/printDeliveryLabelPrint")
public R printDeliveryLabelPrint(@RequestBody Map<String, Object> allParam) {
return R.ok(pickingService.printDeliveryLabelPrint(allParam));
}
@ApiOperation(value = "销售出货-附件打印", notes = "销售出货-附件打印")
@SysLog("销售出货-附件打印")
@PostMapping("/attachmentPrint")

View File

@ -9,6 +9,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
/**
* 拣货明细表
@ -31,6 +32,10 @@ public interface PickingService extends IService<Picking> {
String printLabel(SaleOutRequestDTO saleOutRequestDTO);
String printDeliveryLabel(SaleOutRequestDTO saleOutRequestDTO);
Map<String, Object> printDeliveryLabelPreview(SaleOutRequestDTO saleOutRequestDTO);
String printDeliveryLabelPrint(Map<String, Object> allParam);
String attachmentPrint(SaleOutRequestDTO saleOutRequestDTO);

View File

@ -299,6 +299,88 @@ public class PickingServiceImpl extends ServiceImpl<PickingMapper, Picking> impl
}
return base64String;
}
/**
* 预览
* @param saleOutRequestDTO
* @return
*/
@Override
public Map<String, Object> printDeliveryLabelPreview(SaleOutRequestDTO saleOutRequestDTO) {
String documentNo = saleOutRequestDTO.getDocumentNo();
List<String> seqList = saleOutRequestDTO.getSeqList();
String site = TenantContextHolder.getTenantId();
Map<String, Object> allParam = assemblePrintData(site, documentNo, seqList, "D");
// 追加一些参数
allParam.put("deliveryPartyAddress", saleOutRequestDTO.getDeliveryPartyAddress());
allParam.put("reFields4", saleOutRequestDTO.getReFields4());
allParam.put("dnRemarks", saleOutRequestDTO.getDnRemarks());
// 更新DN单的物料单号和物流单位
String dnNumber = saleOutRequestDTO.getExternalDocumentNo();
DnOrder dnOrder = dnOrderService.getById(DnOrder.genHandle(TenantContextHolder.getTenantId(), dnNumber));
// 新增是否内外贸标识, 当wms_dn_order.DELIVERY_TYPE等于(ZLF1、ZLF3)时展示,(ZLF2、ZLF4)时隐藏;
String isExt = dnOrder == null ? "E" : dnOrder.getDeliveryType();
if ("ZLF1".equals(isExt) || "ZLF3".equals(isExt)) {
allParam.put("isExt", "(内贸)" );
allParam.put("extWarehourseRemarks", saleOutRequestDTO.getExtWarehourseRemarks());
}else if ("ZLF2".equals(isExt) || "ZLF4".equals(isExt)) {
allParam.put("isExt", "(外贸)" );
allParam.put("extWarehourseRemarks", "");
}else {
allParam.put("isExt", "(未知)" );
allParam.put("extWarehourseRemarks", "");
}
return allParam;
}
/**
* 打印
* @param allParam
* @return
*/
@Override
public String printDeliveryLabelPrint(Map<String, Object> allParam) {
String externalDocumentNo, dnRemarks;
if (allParam.get("externalDocumentNo") == null){
throw BusinessException.build("打印失败: 为获取到DN单号");
}
externalDocumentNo = allParam.get("externalDocumentNo").toString();
if (allParam.get("dnRemarks") == null){
throw BusinessException.build("打印失败: 为获取到物流单号");
}
dnRemarks = allParam.get("dnRemarks").toString();
// 更新DN单的物料单号和物流单位
DnOrder dnOrder = dnOrderService.getById(DnOrder.genHandle(TenantContextHolder.getTenantId(), externalDocumentNo));
if (dnOrder != null) {
// 只更新物流单号
dnOrder.setDnRemarks(dnRemarks);
dnOrder.setModifyDateTime(LocalDateTime.now());
dnOrder.setModifyUser(SecurityUtils.getUserName());
dnOrderService.updateById(dnOrder);
}
// 拿取模板
String base64String;
String site = TenantContextHolder.getTenantId();
PrintLabelTemplate printLabelTemplate = new PrintLabelTemplate();
printLabelTemplate.setTemplateCode("SALES_OUT_DELIVERY_DOC");
printLabelTemplate.setSite(site);
byte[] srcBytes = remotePrintService.getReportByCode(printLabelTemplate).getData();
if (srcBytes != null && srcBytes.length > 0) {
try {
byte[] fileBytes = JxlsUtil.transferExcel(new ByteArrayInputStream(srcBytes), allParam);
InputStream byteInputStream = new ByteArrayInputStream(fileBytes);
fileBytes = JxlsUtil.callPostConvertFileToPdf(byteInputStream);
byteInputStream.close();
base64String = Base64.getEncoder().encodeToString(fileBytes);
} catch (IOException e) {
throw BusinessException.build("JXLS渲染失败:" + e);
}
} else {
throw BusinessException.build("获取打印模板失败");
}
return base64String;
}
@Override
public String attachmentPrint(SaleOutRequestDTO saleOutRequestDTO) {

View File

@ -1496,7 +1496,7 @@
wi.STATUS,
wi.ITEM_BO,
count(wi.INVENTORY_ID) as branchSum,
CAST(sum(wi.QTY_ON_HAND) AS UNSIGNED) as qtySum
0 + CAST(sum(wi.QTY_ON_HAND) AS CHAR) as qtySum
from wms.wms_inventory wi
where wi.site = #{dto.site} and wi.ERP_STORAGE_LOCATION is not null
<if test="dto.erpStorageLocation != null and dto.erpStorageLocation != ''">
@ -1524,6 +1524,7 @@
from a
left join wip.item i on a.ITEM_BO = i.HANDLE
left join momx.sys_dict_item sdi on sdi.DICT_TYPE = 'INVENTORY_ID_STATUS' and sdi.DEL_FLAG = '0' and sdi.TENANT_ID = a.site and a.status = sdi.ITEM_VALUE
order by a.ERP_STORAGE_LOCATION, i.ITEM, a.STATUS
</select>
<select id="pageInventorySummaryReportNewTwo"
resultType="com.foreverwin.mom.wms.dto.InventorySummaryReportNewTwoDTO">
@ -1532,10 +1533,10 @@
wi.site,
wi.STATUS,
wi.QUALITY_INSPECTION_STATUS,
CAST(wi.QTY_ON_HAND AS UNSIGNED) qty,
0 + CAST(wi.QTY_ON_HAND AS CHAR) qty,
count(wi.QTY_ON_HAND) branch,
concat(CAST(wi.QTY_ON_HAND AS UNSIGNED), '米 X ', count(wi.QTY_ON_HAND), '支') specifications,
CAST(sum(wi.QTY_ON_HAND) AS UNSIGNED) qtySum
concat(0 + CAST(wi.QTY_ON_HAND AS CHAR), '米 X ', count(wi.QTY_ON_HAND), '支') specifications,
0 + CAST(sum(wi.QTY_ON_HAND) AS CHAR) qtySum
from wms.wms_inventory wi
where wi.ERP_STORAGE_LOCATION is not null and wi.SITE = #{dto.site} and wi.STATUS = #{dto.status} and
wi.ERP_STORAGE_LOCATION = #{dto.erpStorageLocation} and wi.ITEM_BO = concat('ItemBO:', #{dto.site}, ',',
@ -1578,14 +1579,16 @@
#{dto.item} as item,
#{dto.itemDescription} as itemDescription,
#{dto.unitOfMeasure} as unitOfMeasure,
cast(#{dto.qty} AS UNSIGNED) as qty,
0 + cast(#{dto.qty} AS CHAR) as qty,
wi.STATUS,
sdi.LABEL as STATUS_DESCRIPTION,
wi.QUALITY_INSPECTION_STATUS,
sdi2.LABEL as QUALITY_INSPECTION_STATUS_DESC
sdi2.LABEL as QUALITY_INSPECTION_STATUS_DESC,
substring_index(wcm.CARRIER_BO, ',', -1) as carrier
from wms.wms_inventory wi
left join momx.sys_dict_item sdi on sdi.DICT_TYPE = 'INVENTORY_ID_STATUS' and sdi.DEL_FLAG = '0' and sdi.TENANT_ID = wi.site and wi.status = sdi.ITEM_VALUE
left join momx.sys_dict_item sdi2 on sdi2.DICT_TYPE = 'INSPEC_LEVEL' and sdi2.DEL_FLAG = '0' and sdi2.TENANT_ID = wi.site and wi.QUALITY_INSPECTION_STATUS = sdi2.ITEM_VALUE
left join wms.wms_carrier_member wcm on wi.HANDLE = wcm.CARRIER_OR_INVENTORY_BO
where wi.ERP_STORAGE_LOCATION is not null
and wi.SITE = #{dto.site}
and wi.STATUS = #{dto.status}
@ -1598,6 +1601,6 @@
<if test="dto.qualityInspectionStatus == null and dto.qualityInspectionStatus == ''">
and wi.QUALITY_INSPECTION_STATUS is null
</if>
order by wi.INVENTORY_ID asc
order by wi.INVENTORY_ID
</select>
</mapper>