Commit f46ce85e authored by lanbaoming's avatar lanbaoming

Merge branch 'dev'

parents 0bff0b48 e1b13f77
......@@ -62,4 +62,6 @@ public interface BoxLadingBillService extends IService<BoxLadingBillDO> {
List<BoxLadingBillDO> getBoxLadingBillList(BoxLadingBillQueryVO query);
Map<String,String> getBoxLadingBillPdf(Long shipmentId) throws Exception;
Map<String,String> getBoxLadingBillPdf_2(Long shipmentId) throws Exception;
}
......@@ -166,6 +166,7 @@ public class BoxLadingBillServiceImpl extends AbstractService<BoxLadingBillMappe
return boxLadingBillMapper.selectList(query);
}
/*
空运提单补料 lanbm 2024-05-28 添加注释
*/
......@@ -180,8 +181,9 @@ public class BoxLadingBillServiceImpl extends AbstractService<BoxLadingBillMappe
}
//包装单位 lanbm 2024-06-11 add
//2024-06-14 确认使用的单位字典
List<DictDataRespDTO> listPack =
dictDataApi.getDictDatas("packaging_type");
dictDataApi.getDictDatas("goods_package_type");
Map<String, String> PackMap = null;
if (CollectionUtil.isNotEmpty(listPack)) {
PackMap = listPack.stream().collect(
......@@ -189,8 +191,6 @@ public class BoxLadingBillServiceImpl extends AbstractService<BoxLadingBillMappe
DictDataRespDTO::getLabel));
}
//end 包装单位 lanbm 2024-06-11 add
BoxShippingDO boxShippingDO =
boxShippingService.getOne(
new LambdaQueryWrapperX<BoxShippingDO>().eq(BoxShippingDO::getShipmentId,
......@@ -240,22 +240,14 @@ public class BoxLadingBillServiceImpl extends AbstractService<BoxLadingBillMappe
if (boxLadingBillDO.getStartPortId() != null && boxLadingBillDO.getStartPortId() > 0L) {
String s_loadingPort = "";
//lanbm 2024-05-28 添加语言判断
if (lan == 0) {
s_loadingPort = dockService.getDock(boxLadingBillDO.getStartPortId()).getTitleZh();
} else {
s_loadingPort = dockService.getDock(boxLadingBillDO.getStartPortId()).getTitleEn();
}
headMap.put("loadingPort", s_loadingPort);
}
//目的港
if (boxLadingBillDO.getDestPortId() != null && boxLadingBillDO.getDestPortId() > 0L) {
//lanbm 2024-05-28 添加语言判断
//lanbm 2024-05-28 添加语言判断 lan =0 中文 其他英语
String s_dischargingPort = "";
if (lan == 0) {
s_dischargingPort = dockService.getDock(boxLadingBillDO.getDestPortId()).getTitleZh();
} else {
s_dischargingPort = dockService.getDock(boxLadingBillDO.getDestPortId()).getTitleEn();
}
headMap.put("dischargingPort", s_dischargingPort);
}
......@@ -271,20 +263,6 @@ public class BoxLadingBillServiceImpl extends AbstractService<BoxLadingBillMappe
headMap.put("pkgs", boxLadingBillDO.getPackageNum() == null ? "" : boxLadingBillDO.getPackageNum() + "");
}
}
// StringBuffer stringBuffer = new StringBuffer();
// SupplierExternalDO supplierExternal = supplierExternalService.selectOne(SupplierExternalDO::getSupplierId,boxLadingBillDO.getAgentId());
// if (supplierExternal != null) {
// if (StringUtils.isNotBlank(supplierExternal.getFromNo())) {
// stringBuffer.append("FROM M NO.:").append(supplierExternal.getFromNo()+"\r\n");
// }
// if (StringUtils.isNotBlank(supplierExternal.getBaNo())) {
// stringBuffer.append("BA NO.:").append(supplierExternal.getBaNo()+"\r\n");
// }
// if (StringUtils.isNotBlank(supplierExternal.getCtnNo())) {
// stringBuffer.append("CTN NO.:").append(supplierExternal.getCtnNo()+"\r\n");
// }
// }
// headMap.put("description",boxLadingBillDO.getGoodsDesc()+"\r\n"+stringBuffer.toString());
//lanbm 2024-06-06 添加保存数量和单位
String sPackName = "";
......@@ -292,7 +270,7 @@ public class BoxLadingBillServiceImpl extends AbstractService<BoxLadingBillMappe
if (CollectionUtil.isNotEmpty(PackMap) && sUnit != null && sUnit.length() > 0) {
sPackName = sPackName = PackMap.get(sUnit);
}
String sDes = boxLadingBillDO.getPackageNum() + sPackName;
String sDes = ""; //boxLadingBillDO.getPackageNum() + sPackName;
sDes += "\r\n" + boxLadingBillDO.getGoodsDesc();
headMap.put("description", sDes);
//headMap.put("description", boxLadingBillDO.getGoodsDesc());
......@@ -306,6 +284,78 @@ public class BoxLadingBillServiceImpl extends AbstractService<BoxLadingBillMappe
return headMap;
}
/*
海运提单 lanbm 2024-06-14 添加注释
*/
@Override
public Map<String, String> getBoxLadingBillPdf_2(Long shipmentId) throws Exception {
BoxLadingBillDO boxLadingBillDO =
boxLadingBillMapper.selectOne(BoxLadingBillDO::getShipmentId, shipmentId);
if (boxLadingBillDO == null) {
throw exception(MAKE_BILL_OF_LADING_NOT_EXISTS);
}
BoxShippingDO boxShippingDO = boxShippingService.getOne(new LambdaQueryWrapperX<BoxShippingDO>().eq(BoxShippingDO::getShipmentId, shipmentId));
BoxDO box = boxMapper.selectById(shipmentId);
CabinetDO cabinet = cabinetService.getCabinet(box.getCabinetId());
Map<String, String> headMap = new HashMap<>();
String shipType = "X1";
if (cabinet != null) {
shipType = cabinet.getName() + "X1";
}
headMap.put("shipperInfo", buildMsg(boxLadingBillDO.getShipperId(), 0));
headMap.put("consigneeInfo", buildMsg(boxLadingBillDO.getAgentId(), 1));
headMap.put("notifyInfo", buildMsg(boxLadingBillDO.getAgentId(), 2));
headMap.put("mblNo", boxLadingBillDO.getBlMblNo());
headMap.put("soNo", boxLadingBillDO.getSoNo());
if (boxShippingDO != null) {
headMap.put("date", boxShippingDO.getDtRealShipTime() == null ? "" : DateUtil.formatDateTime(boxShippingDO.getDtRealShipTime()));
}
if (boxLadingBillDO.getShipCompanyId() != null && boxLadingBillDO.getShipCompanyId() > 0L) {
headMap.put("shipCompany", supplierService.getSupplier(boxLadingBillDO.getShipCompanyId()).getCompanyEn());
}
if (box != null) {
headMap.put("qyDate", box.getQyDate() == null ? "" : DateUtil.formatDateTime(box.getQyDate()));
}
headMap.put("shipType", shipType);
headMap.put("freight", "FREIGHT PREPAID");
StringBuffer remarks = new StringBuffer();
Integer issueType = boxLadingBillDO.getIssueType();
if (StringUtils.isNotBlank(boxLadingBillDO.getRemarks())) {
remarks.append(boxLadingBillDO.getRemarks());
}
if (issueType == 1) {
remarks.append("\r\n").append("正本");
} else if (issueType == 2) {
remarks.append("\r\n").append("电放");
}
headMap.put("remark", remarks.toString());
if (boxLadingBillDO.getStartPortId() != null && boxLadingBillDO.getStartPortId() > 0L) {
headMap.put("loadingPort", dockService.getDock(boxLadingBillDO.getStartPortId()).getTitleEn());
}
if (boxLadingBillDO.getDestPortId() != null && boxLadingBillDO.getDestPortId() > 0L) {
headMap.put("dischargingPort", dockService.getDock(boxLadingBillDO.getDestPortId()).getTitleEn());
}
headMap.put("markNo", boxLadingBillDO.getMarkNo());
if (StringUtils.isEmpty(boxLadingBillDO.getPackageUnit())) {
headMap.put("pkgs", boxLadingBillDO.getPackageNum() == null ? "" : boxLadingBillDO.getPackageNum() + "");
} else {
DictDataRespDTO dictDataFromCache = DictFrameworkUtils.getDictDataFromCache("goods_package_type", boxLadingBillDO.getPackageUnit());
if (dictDataFromCache != null) {
headMap.put("pkgs", boxLadingBillDO.getPackageNum() == null ? "" : boxLadingBillDO.getPackageNum() + dictDataFromCache.getLabelEn());
} else {
headMap.put("pkgs", boxLadingBillDO.getPackageNum() == null ? "" : boxLadingBillDO.getPackageNum() + "");
}
}
headMap.put("description", boxLadingBillDO.getGoodsDesc());
headMap.put("weight", boxLadingBillDO.getKgs() == null ? "" : String.valueOf(boxLadingBillDO.getKgs().doubleValue()));
headMap.put("volume", boxLadingBillDO.getCbm() == null ? "" : String.valueOf(boxLadingBillDO.getCbm().doubleValue()));
headMap.put("boxNo", boxLadingBillDO.getContainerSealNo());
headMap.put("totalNum", "SAY(" + shipType + ")ONLY ");
headMap.put("selfNo", box.getSelfNo() == null ? "" : box.getSelfNo());
return headMap;
}
private String buildMsg(Long id, int i) {
StringBuffer stringBuffer = new StringBuffer("");
if (id == null || id == 0L) {
......
......@@ -456,10 +456,14 @@ public class BoxMergePkgServiceImpl extends AbstractService<BoxMergePkgMapper, B
if (boxMergePkgDO == null) {
throw exception(BOX_MERGE_PKG_NOT_EXISTS);
}
List<BoxPkgOrderDO> boxPkgOrderDOS = boxPkgOrderService.selectList(BoxPkgOrderDO::getPkgId, boxMergePkgDO.getId());
List<BoxPkgOrderDO> boxPkgOrderDOS =
boxPkgOrderService.selectList(BoxPkgOrderDO::getPkgId,
boxMergePkgDO.getId());
List<Long> orderIds = boxPkgOrderDOS.stream().map(BoxPkgOrderDO::getOrderId).distinct().collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(orderIds)) {
List<OrderDO> orderDOS = orderService.selectList(OrderDO::getOrderId, orderIds);
List<OrderDO> orderDOS =
orderService.selectList(OrderDO::getOrderId, orderIds);
orderDOS.stream().forEach(item -> {
BoxMergePkgPDAVO boxMergePkgPDAVO = new BoxMergePkgPDAVO();
boxMergePkgPDAVO.setOrderId(item.getOrderId());
......
......@@ -18,10 +18,13 @@ import com.alibaba.excel.write.metadata.WriteSheet;
import com.itextpdf.text.pdf.*;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.*;
import javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
......@@ -33,8 +36,10 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.error;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
@Validated
......@@ -109,7 +114,7 @@ public class BoxLadingBillController {
@GetMapping("/getBoxLadingBillPdf")
@ApiOperation("获得提单补料pdf")
@ApiImplicitParam(name = "shipmentId", value = "出货编号", required = true, example = "1024", dataTypeClass = Long.class)
public CommonResult<String> getBoxLadingBillPdf(@RequestParam("shipmentId") Long shipmentId,@RequestParam("type") Integer type,HttpServletResponse response) throws Exception {
public CommonResult<String> getBoxLadingBillPdf(@RequestParam("shipmentId") Long shipmentId, @RequestParam("type") Integer type, HttpServletResponse response) throws Exception {
InputStream inputStream = null;
OutputStream outputStream = null;
BoxLadingBillDO boxLadingBillDO = boxLadingBillService.selectOne(BoxLadingBillDO::getShipmentId, shipmentId);
......@@ -118,19 +123,27 @@ public class BoxLadingBillController {
}
try {
// inputStream = new FileInputStream(new File("C:\\lzlj\\boxLadingBill.xlsx"));
if(type==1){
if (type == 1) {
//从海运页面进入
//海运叫提单确认件
inputStream = this.getClass().getClassLoader().getResourceAsStream(path + "/boxLadingBill.xlsx");
}else if(type==2){
inputStream = this.getClass().getClassLoader().
getResourceAsStream(path + "/boxLadingBill.xlsx");
} else if (type == 2) {
//空运叫提单补料
inputStream = this.getClass().getClassLoader().getResourceAsStream(path + "/boxAirLadingBill.xlsx");
inputStream = this.getClass().getClassLoader().
getResourceAsStream(path + "/boxAirLadingBill.xlsx");
}
outputStream = response.getOutputStream();
//获取模板字段值 lanbm 2024-05-28 添加注释
Map<String, String> boxLadingBillPdf =
boxLadingBillService.getBoxLadingBillPdf(shipmentId);
Map<String, String> boxLadingBillPdf = null;
if (type == 2)
//空运
boxLadingBillPdf = boxLadingBillService.getBoxLadingBillPdf(shipmentId);
else if (type == 1)
//海运
boxLadingBillPdf = boxLadingBillService.getBoxLadingBillPdf_2(shipmentId);
ExcelWriter excelWriter =
EasyExcel.write(outputStream).withTemplate(inputStream).build();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment