Java-Jaspersoft模板打印
1.使用TIBCO Jaspersoft Studio-6.18.1 编写模板,放在指定位置
注:后端需要引入配置文件
RuoYi-Vue后端的ruoyi-admin的resources下创建jasperreports_extension.properties文件。内容:
net.sf.jasperreports.extension.registry.factory.simple.font.families=net.sf.jasperreports.engine.fonts.SimpleFontExtensionsRegistryFactory
net.sf.jasperreports.extension.simple.font.families.lobstertwo=config/fonts.xml
RuoYi-Vue后端的ruoyi-admin的resources下创建config文件夹,config文件夹下创建fonts.xml文件。内容:
<?xml version="1.0" encoding="UTF-8"?>
<fontFamilies>
<!-- <fontFamily name="楷体">-->
<!-- <normal>config/simkai.ttf</normal>-->
<!-- <bold>config/simkai.ttf</bold>-->
<!-- <italic>config/simkai.ttf</italic>-->
<!-- <boldItalic>config/simkai.ttf</boldItalic>-->
<!-- <pdfEncoding>Identity-H</pdfEncoding>-->
<!-- <pdfEmbedded>true</pdfEmbedded>-->
<!-- <exportFonts>-->
<!-- <export key="net.sf.jasperreports.html">'楷体', Arial, Helvetica, sans-serif</export>-->
<!-- <export key="net.sf.jasperreports.xhtml">'楷体', Arial, Helvetica, sans-serif</export>-->
<!-- </exportFonts>-->
<!-- </fontFamily>-->
<!-- 只能启用一种字体-->
<fontFamily name="黑体">
<normal>config/simhei.ttf</normal>
<bold>config/simhei.ttf</bold>
<italic>config/simhei.ttf</italic>
<boldItalic>config/simhei.ttf</boldItalic>
<pdfEncoding>Identity-H</pdfEncoding>
<pdfEmbedded>true</pdfEmbedded>
<exportFonts>
<export key="net.sf.jasperreports.html">'黑体', Arial, Helvetica, sans-serif</export>
<export key="net.sf.jasperreports.xhtml">'黑体', Arial, Helvetica, sans-serif</export>
</exportFonts>
</fontFamily>
</fontFamilies>
将需要用到的字体也放在config文件夹下,文件有:simhei.ttf、simkai.ttf、simsunb.ttf
2.获取打印数据
注:前端Vue需要引入pdf
参考网址:https://blog.csdn.net/Cckkkkkc/article/details/112648132?ydreferer=aHR0cHM6Ly93d3cucGlhbnNoZW4uY29tL2FydGljbGUvNjE2NjIyNTA3MzAv
pdf下载地址:http://mozilla.github.io/pdf.js/getting_started/#download
将下载解压后的文件全部放在public下即可
3.前端代码
var data = {};
data.etNo = this.formOne.etNo;
printCmz(data).then((res) => {
for (var i = 0; i < res.rows.length; i++) {
var data = res.rows[i];
data.PT = "出门证"; //
data.format = "PDF"; //文件格式
data.reportName = "GLRcmz"; //模板名称
printXP(data).then((res) => {
var binaryData = [];
binaryData.push(res);
let url = window.URL.createObjectURL(
new Blob(binaryData, { type: "application/pdf" })
);
//预览
// window.open(url, "_blank");
//打印
const iframe = document.createElement("iframe");
iframe.className = "tmp-pdf";
iframe.style.display = "none";
iframe.src = url;
document.body.appendChild(iframe);
setTimeout(function () {
iframe.contentWindow.print();
document.body.removechild(iframe);
}, 100);
});
}
}).catch((err) => {
this.loading = false;
});
4.后端代码
@Api(tags = "打印")
@RestController
@RequestMapping("/basic/print")
public class PrintController extends BaseController {
private static final Logger log = LoggerFactory.getLogger(PrintController.class);
@Autowired
IPrintService iPrintService;
@RequestMapping(value = "/printXP")
@ResponseBody
//@CkeckDataSource
public void printXP(@RequestParam Map<String, String> map, HttpServletResponse response) {
try {
response.setCharacterEncoding("utf-8");
//响应类型
String format = map.get("format") == null ? "PDF" : map.get("format");
String contentType = "";
if ("PDF".equals(format) || "pdf".equals(format)) {
contentType = "application/pdf;charset=utf-8";
} else if ("DOC".equals(format) || "doc".equals(format)) {
contentType = "application/x-msword";
} else if ("XLS".equals(format) || "xls".equals(format)) {
contentType = "application/vnd_ms-excel";
} else if ("CSV".equals(format) || "csv".equals(format)) {
contentType = "";
} else if ("HTML".equals(format) || "html".equals(format)) {
contentType = "text/html";
}
response.setContentType(contentType);
response.setCharacterEncoding("utf-8");
JasperPrint jasperPrint = new JasperPrint();
if ("GLRzxlhd".equals(map.get("reportName"))) {
//港联荣-装箱理货单
List<HashMap> hashMapList = new ArrayList<>();
//整理打印数据
HashMap<String, Object> item = new HashMap<>();
// item.put("TOPLACE",map.get("TOPlace") == null ? "" : map.get("TOPlace").trim());
item.put("SL_NO", map.get("SL_NO") == null ? "" : map.get("SL_NO").trim());
// item.put("TO_CZ",map.get("TO_CZ") == null ? "" : map.get("TO_CZ").trim());
item.put("FROMP", map.get("FromP") == null ? "" : map.get("FromP").trim());
item.put("CUS_NO", map.get("CUS_NO") == null ? "" : map.get("CUS_NO").trim());
item.put("CNAME", map.get("CNAME") == null ? "" : map.get("CNAME").trim());
item.put("OVOY", map.get("OVOY") == null ? "" : map.get("OVOY").trim());
item.put("END_PORT", map.get("END_PORT") == null ? "" : map.get("END_PORT").trim());
//获取返场站点 select top 10 NAME from T_QW_CZ where cz_no='map.get("FCZ_NO")'
String fName = "";
if(map.get("FCZ_NO")!=null){
fName = iPrintService.queryName(map.get("FCZ_NO"));
}
item.put("CZ_TEL", fName==null?"返场站点请通过陆海通预约": "".equals(fName)?"返场站点请通过陆海通预约":fName);
// item.put("CZ_TEL", map.get("FCZ_NO") == null ? "" : map.get("FCZ_NO").trim());
item.put("TEMPERATURE", map.get("TEMPERATURE") == null ? "" : map.get("TEMPERATURE").trim());
item.put("TD_NO", map.get("TD_NO") == null ? "" : map.get("TD_NO").trim());
item.put("BOX_NO", map.get("BOX_NO") == null ? "" : map.get("BOX_NO").trim());
item.put("SEAL_NO", map.get("SEAL_NO") == null ? "" : map.get("SEAL_NO").trim());
item.put("CC", map.get("CC") == null ? "" : map.get("CC").trim());
String str = map.get("MAX_WEIGHT") == null ? "0" : map.get("MAX_WEIGHT").trim();
item.put("MAX_WEIGHT", "PAYLOAD: " + str + " KG");
item.put("XX", map.get("XX") == null ? "" : map.get("XX").trim());
item.put("AIRRATE", map.get("AIRRATE") == null ? "" : map.get("AIRRATE").trim());
item.put("HUMIDITY", map.get("HUMIDITY") == null ? "" : map.get("HUMIDITY").trim());
item.put("REM", map.get("REM") == null ? "" : map.get("REM").trim());
item.put("ET_TYPE", map.get("ET_TYPE") == null ? "" : map.get("ET_TYPE").trim());
String slDd = "";
if (map.get("SL_DD") != null && !"".equals(map.get("SL_DD"))) {
slDd = map.get("SL_DD").replace("T", " ").split("\\.")[0].replace("-"," ").replace(":"," ");
}
item.put("SL_DD", slDd);
item.put("O_USR", map.get("O_USR") == null ? "" : map.get("O_USR").trim());
item.put("SEALREM", map.get("SEALREM") == null ? "" : map.get("SEALREM").trim());
item.put("SALNAME", map.get("SALNAME") == null ? "" : map.get("SALNAME").trim());
item.put("TEL", map.get("TEL") == null ? "" : map.get("TEL").trim());
item.put("PLATE_NO", map.get("PLATE_NO") == null ? "" : map.get("PLATE_NO").trim());
item.put("ADDREM", map.get("ADDREM") == null ? "" : map.get("ADDREM").trim());
HashMap<String, Object> parameters = new HashMap<>();
// item.put("BOX_NO","CMA001002");
//条形码
if (map.get("BOX_NO") != null && map.get("BOX_NO").trim().length() > 0) {
BufferedImage bufferedImage = BarCodeUtils.getBarCodeWithWords(map.get("BOX_NO"), "", "", "");
ByteArrayOutputStream os = new ByteArrayOutputStream();
ImageIO.write(bufferedImage, "jpg", os);
InputStream inputStream = new ByteArrayInputStream(os.toByteArray());
parameters.put("IMAGE1", inputStream);
}
//模板位置
String reportName = map.get("reportName") == null ? "GLRzxlhd" : map.get("reportName");
String path = "D:\\JAVA\\jasper\\" + reportName + ".jasper";
File file = new File(path);
if (!file.exists()) {
path = Autowired.class.getResource("/jasper/" + reportName + ".jasper").getPath();
file = new File(path);
}
//创建打印
InputStream inReport = new FileInputStream(file);
hashMapList.add(item);
jasperPrint = JasperFillManager.fillReport(inReport, parameters, new JRBeanCollectionDataSource(hashMapList));
// JasperPrintManager.printReport(jasperPrint,true);
// JasperViewer.viewReport(jasperPrint,true);
} else if("GLRcmz".equals(map.get("reportName"))){//纸质出门证
List<HashMap> hashMapList = new ArrayList<>();
//整理打印数据
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
HashMap<String, Object> item = new HashMap<>();
// item.put("TITLE","青岛港集装箱出港证");
item.put("PLATE_NO", map.get("PLATE_NO") == null ? "" : map.get("PLATE_NO").trim());
item.put("PRNTIME", simpleDateFormat.format(new Date()));
if(!ValueUtil.stringOfNullAndEmpty(map.get("SHIP_OVOY").toString())){
item.put("SHIP", map.get("SHIP_OVOY").toString().trim().substring(0,3));
item.put("OVOY", map.get("SHIP_OVOY").toString().trim().substring(3,map.get("SHIP_OVOY").toString().trim().length()));
}else {
item.put("SHIP","");
item.put("OVOY","");
}
// item.put("BGNCE", map.get("NAME") == null ? "" : map.get("NAME").trim());
item.put("CX", map.get("CX") == null ? "" : map.get("CX").trim());
item.put("BOX_NO", map.get("BOX_NO") == null ? "" : map.get("BOX_NO").trim());
item.put("KZ", map.get("KZ") == null ? "" : map.get("KZ").trim());
item.put("COMPNAME", "");
item.put("OTMIN","60");
item.put("CZNAME",map.get("NAME") == null ? "" : map.get("NAME").trim());
item.put("USR", SecurityUtils.getLoginUser().getUsername());
//模板位置
String reportName = map.get("reportName") == null ? "GLRcmz" : map.get("reportName");
String path = "D:\\JAVA\\jasper\\" + reportName + ".jasper";
File file = new File(path);
if (!file.exists()) {
path = Autowired.class.getResource("/jasper/" + reportName + ".jasper").getPath();
file = new File(path);
}
//创建打印
InputStream inReport = new FileInputStream(file);
hashMapList.add(item);
jasperPrint = JasperFillManager.fillReport(inReport, null, new JRBeanCollectionDataSource(hashMapList));
} else if ("GLRrctxOne".equals(map.get("reportName"))) {
//入场提箱单背
List<HashMap> hashMapList = new ArrayList<>();
//整理打印数据
HashMap<String, Object> item = new HashMap<>();
item.put("DCZNAME1", "入场提箱小票");
item.put("ET_NO", map.get("ET_NO") == null ? "受 理 号 " : "受 理 号 "+"<font size=\"4\"><u>"+map.get("ET_NO").trim()+"</u></font>");
item.put("PLATE_NO", map.get("PLATE_NO") == null ? "车 牌 号 " : "车 牌 号 "+map.get("PLATE_NO").trim());
item.put("TEL1", map.get("TEL1") == null ? "" : map.get("TEL1").trim());
item.put("TEL2", map.get("TEL2") == null ? "" : map.get("TEL2").trim());
item.put("TEL3", map.get("TEL3") == null ? "" : map.get("TEL3").trim());
item.put("TEL4", map.get("TEL4") == null ? "" : map.get("TEL4").trim());
item.put("ZTD_NO", map.get("ZTD_NO") == null ? "" : map.get("ZTD_NO").trim());
item.put("SHIP_OVOY", map.get("SHIP_OVOY") == null ? "船 次 " : "船 次 "+map.get("SHIP_OVOY").trim());
item.put("TEMPERATURE", map.get("TEMPERATURE1") == null ? "温 度 " : "温 度 "+map.get("TEMPERATURE1").trim());
item.put("AIRRATE", map.get("AIRRATE1") == null ? "通风量 " : "通风量 "+map.get("AIRRATE1").trim());
item.put("REM1", map.get("REM1") == null ? "备注 " : "备注 "+map.get("REM1").trim());
item.put("BOX_NO", map.get("BOX_NO") == null ? "箱 号 " : "箱 号 "+map.get("BOX_NO").trim());
item.put("SEAL_NO", map.get("SEAL_NO") == null ? "铅封号 " : "铅封号 "+map.get("SEAL_NO").trim());
item.put("CCXX", "尺寸箱型 "+(map.get("CC") == null ? "" : map.get("CC").trim())+(map.get("XX")==null?"":map.get("XX").trim()));
item.put("VICE_SEAL_NO", map.get("VICE_SEAL_NO") == null ? "封条号 " : "封条号 "+map.get("VICE_SEAL_NO").trim());
item.put("END_PORT", map.get("END_PORT") == null ? "目的港 " : "目的港 "+map.get("END_PORT").trim());
item.put("HUMIDITY", map.get("HUMIDITY1") == null ? "湿度 " : "湿度 "+map.get("HUMIDITY1").trim());
item.put("XPXW", map.get("XPXW") == null ? "" : ""+map.get("XPXW").trim());
item.put("GB_BOX", map.get("GB_BOX") == null ? "箱况 " : "箱况 "+map.get("GB_BOX").trim());
item.put("CUS_NO", map.get("CUS_NO") == null ? "箱属 " : "箱属 "+map.get("CUS_NO").trim());
item.put("GRAD", map.get("GRAD") == null ? "危险主等级 " : "危险主等级 "+map.get("GRAD").trim());
item.put("N_WGNO", map.get("N_WGNO") == null ? "主危号" : "主危号 "+map.get("N_WGNO").trim());
item.put("GRAD1", map.get("GRAD1") == null ? "危险副等级 " : "危险副等级 "+map.get("GRAD1").trim());
item.put("C_WGNO", map.get("C_WGNO") == null ? "副危号 " : "副危号 "+map.get("C_WGNO").trim());
item.put("CZNOTE2", map.get("CZNOTE2") == null ? "" : map.get("CZNOTE2").trim());
item.put("DCZPIC", map.get("DCZPIC") == null ? "未知" : map.get("DCZPIC").trim());
item.put("SEA_FLG", map.get("SEA_FLG") == null ? "是否为海洋污染物 " : "是否为海洋污染物 "+("F".equals(map.get("SEA_FLG").trim())?"否":"是"));
item.put("IMAGENAME", map.get("THECZNAME") == null ? "[未知]" : "["+map.get("THECZNAME").trim()+"]"+"["+item.get("DCZPIC")+"]");
item.put("REM", map.get("REM") == null ? "" : map.get("REM").trim());
item.put("USR", "制单人 "+SecurityUtils.getUsr());
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String formatDate = simpleDateFormat.format(new Date());
item.put("ZDDATE", "制单日期 "+formatDate);
item.put("CZNOTEHX", map.get("CZNOTEHX") == null ? "换箱位置 " : "换箱位置 "+map.get("CZNOTEHX").trim());
item.put("CZNOTE1", map.get("CZNOTE1") == null ? "" : map.get("CZNOTE1").trim());
HashMap<String, Object> parameters = new HashMap<>();
//二维码
String imagePath = "";
if (map.get("DCZPIC") != null) {
if(map.get("DCZPIC").indexOf("QkSystem")!=-1){
String tempPic1 = map.get("DCZPIC").split("\\\\")[1];
map.remove("DCZPIC");
map.put("DCZPIC",tempPic1);
}
imagePath = "D:\\JAVA\\picture\\QkSystem\\" + map.get("DCZPIC").trim();
if ("D:\\JAVA\\picture\\QkSystem\\".equals(imagePath)) {
imagePath = "";
}
}
File imageFile = new File(imagePath);
//获取某个位置的二维码
if (imagePath.length() > 0) {
//判断图片是否存在
parameters.put("IMAGENAME", map.get("DCZPIC") == null ? "未知" : map.get("DCZPIC").trim());
if (imageFile.exists()) {
//将图片定义为字节流,放入map中
InputStream is = new FileInputStream(imagePath);
parameters.put("IMAGE1", is);
} else {
parameters.put("IMAGE1", null);
}
}
//模板位置
String reportName = map.get("reportName") == null ? "GLRrctxOne" : map.get("reportName");
String path = "D:\\JAVA\\jasper\\" + reportName + ".jasper";
File file = new File(path);
if (!file.exists()) {
path = Autowired.class.getResource("/jasper/" + reportName + ".jasper").getPath();
file = new File(path);
}
//创建打印
InputStream inReport = new FileInputStream(file);
hashMapList.add(item);
jasperPrint = JasperFillManager.fillReport(inReport, parameters, new JRBeanCollectionDataSource(hashMapList));
}else if ("GLRrctxTwo".equals(map.get("reportName"))) {
//入场提箱双背
List<HashMap> hashMapList = new ArrayList<>();
//整理打印数据
HashMap<String, Object> item = new HashMap<>();
item.put("DCZNAME1", "入场提箱小票");
item.put("ET_NO", map.get("ET_NO") == null ? "受 理 号 " : "受 理 号 "+"<font size=\"4\"><u>"+map.get("ET_NO").trim()+"</u></font>");
item.put("PLATE_NO", map.get("PLATE_NO") == null ? "车 牌 号 " : "车 牌 号 "+map.get("PLATE_NO").trim());
item.put("TEL1", map.get("TEL1") == null ? "" : map.get("TEL1").trim());
item.put("TEL2", map.get("TEL2") == null ? "" : map.get("TEL2").trim());
item.put("TEL3", map.get("TEL3") == null ? "" : map.get("TEL3").trim());
item.put("TEL4", map.get("TEL4") == null ? "" : map.get("TEL4").trim());
item.put("ZTD_NO", map.get("ZTD_NO") == null ? "" : map.get("ZTD_NO").trim());
item.put("SHIP_OVOY", map.get("SHIP_OVOY") == null ? "船 次 " : "船 次 "+map.get("SHIP_OVOY").trim());
item.put("TEMPERATURE", map.get("TEMPERATURE1") == null ? "温 度 " : "温 度 "+map.get("TEMPERATURE1").trim());
item.put("AIRRATE", map.get("AIRRATE1") == null ? "通风量 " : "通风量 "+map.get("AIRRATE1").trim());
item.put("REM1", map.get("REM1") == null ? "备注 " : "备注 "+map.get("REM1").trim());
item.put("BOX_NO", map.get("BOX_NO") == null ? "箱 号 " : "箱 号 "+map.get("BOX_NO").trim());
item.put("SEAL_NO", map.get("SEAL_NO") == null ? "铅封号 " : "铅封号 "+map.get("SEAL_NO").trim());
item.put("CCXX", "尺寸箱型 "+(map.get("CC") == null ? "" : map.get("CC").trim())+(map.get("XX")==null?"":map.get("XX").trim()));
item.put("VICE_SEAL_NO", map.get("VICE_SEAL_NO") == null ? "封条号 " : "封条号 "+map.get("VICE_SEAL_NO").trim());
item.put("END_PORT", map.get("END_PORT") == null ? "目的港 " : "目的港 "+map.get("END_PORT").trim());
item.put("HUMIDITY", map.get("HUMIDITY1") == null ? "湿度 " : "湿度 "+map.get("HUMIDITY1").trim());
item.put("XPXW", map.get("XPXW") == null ? "" : ""+map.get("XPXW").trim());
item.put("GB_BOX", map.get("GB_BOX") == null ? "箱况 " : "箱况 "+map.get("GB_BOX").trim());
item.put("CUS_NO", map.get("CUS_NO") == null ? "箱属 " : "箱属 "+map.get("CUS_NO").trim());
item.put("GRAD", map.get("GRAD") == null ? "危险主等级 " : "危险主等级 "+map.get("GRAD").trim());
item.put("N_WGNO", map.get("N_WGNO") == null ? "主危号" : "主危号 "+map.get("N_WGNO").trim());
item.put("GRAD1", map.get("GRAD1") == null ? "危险副等级 " : "危险副等级 "+map.get("GRAD1").trim());
item.put("C_WGNO", map.get("C_WGNO") == null ? "副危号 " : "副危号 "+map.get("C_WGNO").trim());
item.put("CZNOTE2", map.get("CZNOTE2") == null ? "" : map.get("CZNOTE2").trim());
item.put("DCZPIC", map.get("DCZPIC") == null ? "未知" : map.get("DCZPIC").trim());
item.put("SEA_FLG", map.get("SEA_FLG") == null ? "是否为海洋污染物 " : "是否为海洋污染物 "+("F".equals(map.get("SEA_FLG").trim())?"否":"是"));
item.put("IMAGENAME", map.get("THECZNAME") == null ? "[未知]" : "["+map.get("THECZNAME").trim()+"]"+"["+item.get("DCZPIC")+"]");
item.put("REM", map.get("REM") == null ? "" : map.get("REM").trim());
item.put("USR", "制单人 "+SecurityUtils.getUsr());
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String formatDate = simpleDateFormat.format(new Date());
item.put("ZDDATE", "制单日期 "+formatDate);
item.put("CZNOTEHX", map.get("CZNOTEHX") == null ? "换箱位置 " : "换箱位置 "+map.get("CZNOTEHX").trim());
item.put("CZNOTE1", map.get("CZNOTE1") == null ? "" : map.get("CZNOTE1").trim());
//双背第二个箱子
item.put("BOX_NO1", map.get("BOX_NOTX") == null ? "箱 号 " : "箱 号 "+map.get("BOX_NOTX").trim());
item.put("SEAL_NO1", map.get("SEAL_NOTX") == null ? "铅封号 " : "铅封号 "+map.get("SEAL_NOTX").trim());
item.put("CUS_NO1", map.get("CUS_NOTX") == null ? "箱属 " : "箱属 "+map.get("CUS_NOTX").trim());
item.put("VICE_SEAL_NO1", map.get("VICE_SEAL_NOTX") == null ? "封条号 " : "封条号 "+map.get("VICE_SEAL_NOTX").trim());
item.put("CCXX1", "尺寸箱型 "+(map.get("CCTX") == null ? "" : map.get("CCTX").trim()));
item.put("GB_BOX1", map.get("GB_BOXTX") == null ? "箱况 " : "箱况 "+map.get("GB_BOXTX").trim());
item.put("XPXW1", map.get("XPXWTX") == null ? "" : ""+map.get("XPXWTX").trim());
item.put("GRAD2", map.get("GRADTX") == null ? "危险主等级 " : "危险主等级 "+map.get("GRADTX").trim());
item.put("N_WGNO1", map.get("N_WGNOTX") == null ? "主危号" : "主危号 "+map.get("N_WGNOTX").trim());
item.put("GRAD3", map.get("GRAD1TX") == null ? "危险副等级 " : "危险副等级 "+map.get("GRAD1TX").trim());
item.put("C_WGNO1", map.get("C_WGNOTX") == null ? "副危号 " : "副危号 "+map.get("C_WGNOTX").trim());
item.put("SEA_FLG1", map.get("SEA_FLGTX") == null ? "是否为海洋污染物 " : "是否为海洋污染物 "+("F".equals(map.get("SEA_FLGTX").trim())?"否":"是"));
item.put("IMAGENAME1", map.get("THECZNAME1") == null ? "[未知]" : "["+map.get("THECZNAME1").trim()+"]"+"["+map.get("DCZPIC1")==null?"未知":map.get("DCZPIC1")+"]");
HashMap<String, Object> parameters = new HashMap<>();
//二维码1
String imagePath = "";
if (map.get("DCZPIC") != null) {
if(map.get("DCZPIC").indexOf("QkSystem")!=-1){
String tempPic = map.get("DCZPIC").split("\\\\")[1];
map.remove("DCZPIC");
map.put("DCZPIC",tempPic);
}
imagePath = "D:\\JAVA\\picture\\QkSystem\\" + map.get("DCZPIC").trim();
if ("D:\\JAVA\\picture\\QkSystem\\".equals(imagePath)) {
imagePath = "";
}
}
File imageFile = new File(imagePath);
//获取某个位置的二维码
if (imagePath.length() > 0) {
//判断图片是否存在
parameters.put("IMAGENAME", map.get("DCZPIC") == null ? "未知" : "".equals(map.get("DCZPIC").trim())?"未知": "".equals(map.get("DCZPIC").trim()));
if (imageFile.exists()) {
//将图片定义为字节流,放入map中
InputStream is = new FileInputStream(imagePath);
parameters.put("IMAGE1", is);
} else {
parameters.put("IMAGE1", null);
}
}
//二维码2
String imagePath2 = "";
if (map.get("DCZPIC1") != null) {
if(map.get("DCZPIC1").indexOf("QkSystem")!=-1){
String tempPic1 = map.get("DCZPIC1").split("\\\\")[1];
map.remove("DCZPIC1");
map.put("DCZPIC1",tempPic1);
}
imagePath2 = "D:\\JAVA\\picture\\QkSystem\\" + map.get("DCZPIC1").trim();
if ("D:\\JAVA\\picture\\QkSystem\\".equals(imagePath2)) {
imagePath2 = "";
}
}
File imageFile2 = new File(imagePath2);
//获取某个位置的二维码
if (imagePath2.length() > 0) {
//判断图片是否存在
parameters.put("IMAGENAME1", map.get("DCZPIC1") == null ? "未知" : "".equals(map.get("DCZPIC1").trim())?"未知":map.get("DCZPIC1").trim());
if (imageFile2.exists()) {
//将图片定义为字节流,放入map中
InputStream is = new FileInputStream(imagePath2);
parameters.put("IMAGE2", is);
} else {
parameters.put("IMAGE2", parameters.get("IMAGE1"));
}
}
//模板位置
String reportName = map.get("reportName") == null ? "GLRrctxTwo" : map.get("reportName");
String path = "D:\\JAVA\\jasper\\" + reportName + ".jasper";
File file = new File(path);
if (!file.exists()) {
path = Autowired.class.getResource("/jasper/" + reportName + ".jasper").getPath();
file = new File(path);
}
//创建打印
InputStream inReport = new FileInputStream(file);
hashMapList.add(item);
jasperPrint = JasperFillManager.fillReport(inReport, parameters, new JRBeanCollectionDataSource(hashMapList));
} else if ("GLRtxccrgd".equals(map.get("reportName"))) {
List<HashMap> hashMapList = new ArrayList<>();
//整理打印数据
HashMap<String, Object> item = new HashMap<>();
item.put("CNAME", map.get("CNAME") == null ? "" : map.get("CNAME").trim());
item.put("OVOY", map.get("OVOY") == null ? "" : map.get("OVOY").trim());
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
item.put("DATE", formatter.format(new Date()));
item.put("BOX_NO", map.get("BOX_NO") == null ? "" : map.get("BOX_NO").trim());
item.put("CC", map.get("CC") == null ? "" : map.get("CC").trim());
item.put("XX", map.get("XX") == null ? "" : map.get("XX").trim());
item.put("CUS_NO", map.get("CUS_NO") == null ? "" : map.get("CUS_NO").trim());
item.put("T_WEIGHT", map.get("T_WEIGHT") == null ? "" : map.get("T_WEIGHT").trim());
item.put("TD_NO", map.get("TD_NO") == null ? "" : map.get("TD_NO").trim());
item.put("TRAN_PORT", map.get("TRAN_PORT") == null ? "" : map.get("TRAN_PORT").trim());
item.put("SEAL_NO", map.get("SEAL_NO") == null ? "" : map.get("SEAL_NO").trim());
item.put("TEMPERATURE", map.get("TEMPERATURE") == null ? "" : map.get("TEMPERATURE").trim());
item.put("HUMIDITY", map.get("HUMIDITY") == null ? "" : map.get("HUMIDITY").trim());
item.put("AIRRATE", map.get("AIRRATE") == null ? "" : map.get("AIRRATE").trim());
item.put("END_PORT", map.get("END_PORT") == null ? "" : map.get("END_PORT").trim());
item.put("TEL", map.get("TEL") == null ? "" : map.get("TEL").trim());
//模板位置
String reportName = map.get("reportName") == null ? "GLRzxlhd" : map.get("reportName");
// String path = Autowired.class.getResource("/jasper/" + reportName + ".jasper").getPath();
String path = "D:\\JAVA\\jasper\\" + reportName + ".jasper";
File file = new File(path);
if (!file.exists()) {
path = Autowired.class.getResource("/jasper/" + reportName + ".jasper").getPath();
file = new File(path);
}
//创建打印
InputStream inReport = new FileInputStream(file);
hashMapList.add(item);
jasperPrint = JasperFillManager.fillReport(inReport, null, new JRBeanCollectionDataSource(hashMapList));
} else if ("M3".equals(map.get("reportName"))) {
//收据小票
//执行查询
JSONObject mapObject = new JSONObject();
for (String key : map.keySet()) {
mapObject.put(key, map.get(key).trim());
}
//对制单人重新赋值
mapObject.put("USR", SecurityUtils.getUsr());
Map<String, Object> conditionMap = new HashMap<>();
conditionMap.put("mapObject", mapObject.toJSONString());
//DYNAMIC_PRINT
Map<String, String> returnResult = iPrintService.getDYNAMIC_PRINT(conditionMap);
//整理打印数据
HashMap<String, Object> parameters = new HashMap<String, Object>();
//标题
parameters.put("TITLE1", returnResult.get("TITLE1") == null ? "XXXX" : returnResult.get("TITLE1").trim());
//循环打印字段
int num = 0;
int name = 0;
List<HashMap> hashMapList = new ArrayList<>();
for (String key : returnResult.keySet()) {
name++;
String hangStr = "NAME" + name;
HashMap<String, String> item = new HashMap<String, String>();
if (returnResult.get(hangStr) != null) {
num++;
item.put("Field1", returnResult.get(hangStr));
hashMapList.add(item);
}
}
//条形码
String imagePath1 = returnResult.get("IMAGE1") == null ? "" : returnResult.get("IMAGE1").trim();
if (imagePath1.trim().length() > 0) {
//条形码
BufferedImage bufferedImage = BarCodeUtils.getBarCodeWithWords(imagePath1, imagePath1, "", "");
ByteArrayOutputStream os = new ByteArrayOutputStream();
ImageIO.write(bufferedImage, "jpg", os);
InputStream inputStream = new ByteArrayInputStream(os.toByteArray());
parameters.put("IMAGE1", inputStream);
}
//收费吗
String imagePath2 = returnResult.get("IMAGE2") == null ? "" : returnResult.get("IMAGE2").trim();
//生成收据二维码
if (imagePath2.trim().length() > 0) {
BufferedImage bufferedImage = QrCodeUtil.generate(imagePath2, 300, 300);
ByteArrayOutputStream os = new ByteArrayOutputStream();
ImageIO.write(bufferedImage, "jpg", os);
InputStream inputStream = new ByteArrayInputStream(os.toByteArray());
parameters.put("IMAGE2", inputStream);
parameters.put("REM1", returnResult.get("REM1") == null ? "" : returnResult.get("REM1").trim());
}
//箱位导航位置
String imagePath3 = returnResult.get("IMAGE3") == null ? "" : returnResult.get("IMAGE3").trim();
//获取某个位置的二维码
if (imagePath3.length() > 0 && !"".equals(imagePath3)) {
imagePath3 = "D:\\JAVA\\picture\\" + imagePath3;
File imageFile = new File(imagePath3);
//将图片定义为字节流,放入map中
if (imageFile.exists()) {
InputStream is = new FileInputStream(imagePath3);
parameters.put("IMAGE3", is);
}
parameters.put("REM2", returnResult.get("REM2") == null ? "" : returnResult.get("REM2").trim());
}
//模板位置
String reportName = map.get("reportName") == null ? "M3" : map.get("reportName");
// String path = Autowired.class.getResource("/jasper/" + reportName + ".jasper").getPath();
String path = "D:\\JAVA\\jasper\\" + reportName + ".jasper";
File file = new File(path);
if (!file.exists()) {
path = Autowired.class.getResource("/jasper/" + reportName + ".jasper").getPath();
file = new File(path);
}
//创建打印
InputStream inReport = new FileInputStream(file);
jasperPrint = JasperFillManager.fillReport(inReport, parameters, new JRBeanCollectionDataSource(hashMapList));
//设置打印高度
int height = 50 + 20 * num;
if (imagePath1.length() > 0) {
height = height + 110;
}
if (imagePath2.length() > 0) {
height = height + 120;
}
if (imagePath3.length() > 0) {
height = height + 120;
}
jasperPrint.setPageHeight(height);
} else if ("M1".equals(map.get("reportName"))) {
//执行查询
JSONObject mapObject = new JSONObject();
for (String key : map.keySet()) {
mapObject.put(key, map.get(key).trim());
}
//对制单人重新赋值
System.out.println("SecurityUtils.getUsr()==" + SecurityUtils.getUsr());
mapObject.put("USR", SecurityUtils.getUsr());
Map<String, Object> conditionMap = new HashMap<>();
conditionMap.put("mapObject", mapObject.toJSONString());
//DYNAMIC_PRINT
Map<String, String> returnResult = iPrintService.getDYNAMIC_PRINT(conditionMap);
//进场箱管理单双背格式突出箱位
if("1".equals(map.get("PT"))){
//NAME11
String name11 = returnResult.get("NAME11");
returnResult.remove("NAME11");
returnResult.put("NAME11","<font size=\"4\"><u>"+name11+"</u></font>");
}else if("10".equals(map.get("PT"))){
//NAME11 NAME14
String name11 = returnResult.get("NAME11");
returnResult.remove("NAME11");
returnResult.put("NAME11","<font size=\"4\"><u>"+name11+"</u></font>");
String name14 = returnResult.get("NAME14");
returnResult.remove("NAME14");
returnResult.put("NAME14","<font size=\"4\"><u>"+name14+"</u></font>");
}
//整理打印数据
HashMap<String, Object> parameters = new HashMap<String, Object>();
//标题
parameters.put("TITLE1", returnResult.get("TITLE1") == null ? "XXXX" : returnResult.get("TITLE1").trim());
//循环打印字段
int num = 0;
int name = 0;
Boolean haveAdd = false;
List<HashMap> hashMapList = new ArrayList<>();
for (String key : returnResult.keySet()) {
name++;
String hangStr = "NAME" + name;
HashMap<String, String> item = new HashMap<String, String>();
if (returnResult.get(hangStr) != null && returnResult.get(hangStr).toString().trim().length() > 0) {
num++;
//判断是否有:司机师傅,谢谢合作,入场须知
//提示:神州场站可能需要依据入场须知调整一下高度,不然会留有空白
if (returnResult.get(hangStr).toString().contains("司机师傅")
|| returnResult.get(hangStr).toString().contains("谢谢合作")
|| returnResult.get(hangStr).toString().contains("入场须知")) {
haveAdd = true;
}
item.put("Field1", returnResult.get(hangStr));
hashMapList.add(item);
}
}
//正式环境图片地址
String imagePath = "";
if (returnResult.get("IMAGE1") != null) {
imagePath = "D:\\JAVA\\picture\\" + returnResult.get("IMAGE1").trim();
if ("D:\\JAVA\\picture\\".equals(imagePath)) {
imagePath = "";
}
}
File imageFile = new File(imagePath);
if (parameters.get("TITLE1").toString().contains("交接单")) {
//交接单生成二维码
if (imagePath.trim().length() > 0) {
BufferedImage bufferedImage = QrCodeUtil.generate(imagePath, 300, 300);
ByteArrayOutputStream os = new ByteArrayOutputStream();
ImageIO.write(bufferedImage, "jpg", os);
InputStream inputStream = new ByteArrayInputStream(os.toByteArray());
parameters.put("IMAGE1", inputStream);
}
} else {
//获取某个位置的二维码
if (imagePath.length() > 0) {
//判断图片是否存在
parameters.put("IMAGENAME", returnResult.get("IMAGENAME") == null ? "未知" : returnResult.get("IMAGENAME").trim());
if (imageFile.exists()) {
//将图片定义为字节流,放入map中
InputStream is = new FileInputStream(imagePath);
parameters.put("IMAGE1", is);
} else {
parameters.put("IMAGE1", null);
}
}
}
//模板位置
String reportName = map.get("reportName") == null ? "M1" : map.get("reportName");
// String path = Autowired.class.getResource("/jasper/" + reportName + ".jasper").getPath();
String path = "D:\\JAVA\\jasper\\" + reportName + ".jasper";
File file = new File(path);
if (!file.exists()) {
path = Autowired.class.getResource("/jasper/" + reportName + ".jasper").getPath();
file = new File(path);
}
//创建打印
InputStream inReport = new FileInputStream(file);
jasperPrint = JasperFillManager.fillReport(inReport, parameters, new JRBeanCollectionDataSource(hashMapList));
//设置打印高度
int height = 155 + 20 * num;
if (haveAdd) {
height = height + 120;
}
jasperPrint.setPageHeight(height);
}
//返回到浏览器
ServletOutputStream out = response.getOutputStream();
JasperExportManager.exportReportToPdfStream(jasperPrint, out);
} catch (Exception e) {
log.error(e.getMessage());
AjaxResult.error(e.getMessage());
}
}
}
5.存储过程
ALTER PROCEDURE [dbo].[DYNAMIC_PRINT](@CONDITION varchar(MAX))as
--创建临时表
IF OBJECT_ID('TEMPDB..#DYNAMIC_PRINT') IS NOT NULL DROP TABLE #DYNAMIC_PRINT
CREATE TABLE #DYNAMIC_PRINT(
PT VARCHAR(20),
THECZNAME VARCHAR(100),
THECZNAME1 VARCHAR(100),
DCZNAME VARCHAR(20),
DCZNAME1 VARCHAR(20),
DCZXW VARCHAR(20),
DCZPIC VARCHAR(MAX),
DCZPIC1 VARCHAR(MAX),
CHEDUI VARCHAR(100),
STOPMSG VARCHAR(20),
TEL1 VARCHAR(100),
TEL2 VARCHAR(100),
TEL3 VARCHAR(100),
TEL4 VARCHAR(100),
TEL5 VARCHAR(100),
TEL6 VARCHAR(100),
TEL7 VARCHAR(100),
TEL8 VARCHAR(100),
TEL9 VARCHAR(100),
CZNOTE1 VARCHAR(MAX),
CZNOTE2 VARCHAR(MAX),
CZNOTE3 VARCHAR(MAX),
CZNOTE4 VARCHAR(MAX),
CZNOTE5 VARCHAR(MAX),
CZNOTEHX VARCHAR(100),
XPXW VARCHAR(MAX),
XPXW2 VARCHAR(MAX),
SFX VARCHAR(20),
SFX1 VARCHAR(20),
SBW VARCHAR(20),
SXW VARCHAR(20),
SXW1 VARCHAR(20),
JFXW VARCHAR(20),
BOXES VARCHAR(20),
DCZPICHX VARCHAR(MAX),
PLATE_NO VARCHAR(20),
EI_NO VARCHAR(40),
ET_NO VARCHAR(40),
REM VARCHAR(MAX),
REM1 VARCHAR(MAX),
BOX_NO VARCHAR(MAX),
CC VARCHAR(10),
XX VARCHAR(10),
CUS_NO VARCHAR(20),
EI_TYPE VARCHAR(5),
XW VARCHAR(15),
BOX_NO2 VARCHAR(20),
CC2 VARCHAR(10),
XX2 VARCHAR(10),
CUS_NO2 VARCHAR(20),
EI_TYPE2 VARCHAR(5),
XW2 VARCHAR(15),
SBW2 VARCHAR(20),
USR VARCHAR(10),
SHIP_NO VARCHAR(20),
OVOY VARCHAR(20),
LPORT VARCHAR(20),
ZTD_NO VARCHAR(30),
SEAL_NO VARCHAR(30),
TRAN_PORT VARCHAR(20),
END_PORT VARCHAR(20),
TEMPERATURE VARCHAR(20),
HUMIDITY VARCHAR(20),
AIRRATE VARCHAR(20),
TEMPERATURE1 VARCHAR(20),
HUMIDITY1 VARCHAR(20),
AIRRATE1 VARCHAR(20),
T_WEIGHT VARCHAR(20),
NAME VARCHAR(100),
ZZYQ VARCHAR(20),
TEL VARCHAR(100),
EBOX VARCHAR(20),
JGSJ VARCHAR(100),
GRAD VARCHAR(20),
GRAD1 VARCHAR(20),
N_WGNO VARCHAR(20),
C_WGNO VARCHAR(20),
PRD_NAME VARCHAR(20),
FI_FLAG VARCHAR(20),
TD_NO VARCHAR(40),
SHIP_OVOY VARCHAR(20),
VICE_SEAL_NO VARCHAR(40),
GB_BOX VARCHAR(20),
SEA_FLG VARCHAR(20),
REMID VARCHAR(MAX),
KF VARCHAR(40),
MK_DD VARCHAR(40),
XFL VARCHAR(MAX),
BOX_NO1 VARCHAR(40),
CODE VARCHAR(MAX),
KDDATE VARCHAR(40),
PTTIME VARCHAR(20),
CUSTNAME VARCHAR(MAX),
TITLE VARCHAR(MAX),
FEENAME VARCHAR(MAX),
AMTN VARCHAR(40),
AMTNSUM VARCHAR(50),
INVOICENO VARCHAR(MAX),
ADDRESS VARCHAR(MAX),
CARE VARCHAR(MAX),
CNAMTN VARCHAR(40),
CUSTNUMBER VARCHAR(MAX),
BOXPOSITION VARCHAR(MAX),
BOX_NOTX VARCHAR(MAX),
SEAL_NOTX VARCHAR(MAX),
CUS_NOTX VARCHAR(MAX),
CCTX VARCHAR(MAX),
XXTX VARCHAR(MAX),
VICE_SEAL_NOTX VARCHAR(MAX),
GB_BOXTX VARCHAR(MAX),
XPXWTX VARCHAR(MAX),
GRADTX VARCHAR(MAX),
N_WGNOTX VARCHAR(MAX),
GRAD1TX VARCHAR(MAX),
C_WGNOTX VARCHAR(MAX),
SEA_FLGTX VARCHAR(MAX)
)
--将传入的参数存入临时表
INSERT #DYNAMIC_PRINT(
PT,
THECZNAME ,
THECZNAME1,
DCZNAME,
DCZNAME1,
DCZXW,
DCZPIC,
DCZPIC1,
CHEDUI,
STOPMSG,
TEL1,
TEL2,
TEL3,
TEL4,
TEL5,
TEL6,
TEL7,
TEL8,
TEL9,
CZNOTE1,
CZNOTE2,
CZNOTE3,
CZNOTE4,
CZNOTE5,
CZNOTEHX,
XPXW,
XPXW2,
SFX,
SFX1,
SBW,
SXW,
SXW1,
JFXW,
BOXES,
DCZPICHX,
PLATE_NO,
EI_NO,
ET_NO,
REM,
REM1,
BOX_NO,
CC,
XX,
CUS_NO,
EI_TYPE,
XW,
BOX_NO2,
CC2,
XX2,
CUS_NO2,
EI_TYPE2,
XW2,
SBW2,
USR,
SHIP_NO,
OVOY,
LPORT,
ZTD_NO,
SEAL_NO,
TRAN_PORT,
END_PORT,
TEMPERATURE,
HUMIDITY,
AIRRATE,
TEMPERATURE1,
HUMIDITY1,
AIRRATE1,
T_WEIGHT,
NAME ,
ZZYQ,
TEL ,
EBOX,
JGSJ,
GRAD,
GRAD1,
N_WGNO,
C_WGNO,
PRD_NAME,
FI_FLAG,
TD_NO ,
SHIP_OVOY,
VICE_SEAL_NO,
GB_BOX ,
SEA_FLG,
REMID,
KF,
MK_DD,
XFL,
BOX_NO1,
CODE,
KDDATE,
PTTIME,
CUSTNAME,
TITLE,
FEENAME,
AMTN,
AMTNSUM,
INVOICENO,
ADDRESS,
CARE,
CNAMTN,
CUSTNUMBER,
BOXPOSITION,
BOX_NOTX,
SEAL_NOTX,
CUS_NOTX,
CCTX,
XXTX,
VICE_SEAL_NOTX,
GB_BOXTX,
XPXWTX,
GRADTX,
N_WGNOTX,
GRAD1TX,
C_WGNOTX,
SEA_FLGTX
)
SELECT
PT,
THECZNAME ,
THECZNAME1,
DCZNAME,
DCZNAME1,
DCZXW,
DCZPIC,
DCZPIC1,
CHEDUI,
STOPMSG,
TEL1,
TEL2,
TEL3,
TEL4,
TEL5,
TEL6,
TEL7,
TEL8,
TEL9,
CZNOTE1,
CZNOTE2,
CZNOTE3,
CZNOTE4,
CZNOTE5,
CZNOTEHX,
XPXW,
XPXW2,
SFX,
SFX1,
SBW,
SXW,
SXW1,
JFXW,
BOXES,
DCZPICHX,
PLATE_NO,
EI_NO,
ET_NO,
REM,
REM1,
BOX_NO,
CC,
XX,
CUS_NO,
EI_TYPE,
XW,
BOX_NO2,
CC2,
XX2,
CUS_NO2,
EI_TYPE2,
XW2,
SBW2,
USR,
SHIP_NO,
OVOY,
LPORT,
ZTD_NO,
SEAL_NO,
TRAN_PORT,
END_PORT,
TEMPERATURE,
HUMIDITY,
AIRRATE,
TEMPERATURE1,
HUMIDITY1,
AIRRATE1,
T_WEIGHT,
NAME ,
ZZYQ,
TEL ,
EBOX,
JGSJ,
GRAD,
GRAD1,
N_WGNO,
C_WGNO,
PRD_NAME,
FI_FLAG,
TD_NO ,
SHIP_OVOY,
VICE_SEAL_NO,
GB_BOX ,
SEA_FLG,
REMID,
KF,
MK_DD,
XFL,
BOX_NO1,
CODE,
KDDATE,
PTTIME,
CUSTNAME,
TITLE,
FEENAME,
AMTN,
AMTNSUM,
INVOICENO,
ADDRESS,
CARE,
CNAMTN,
CUSTNUMBER,
BOXPOSITION,
BOX_NOTX,
SEAL_NOTX,
CUS_NOTX,
CCTX,
XXTX,
VICE_SEAL_NOTX,
GB_BOXTX,
XPXWTX,
GRADTX,
N_WGNOTX,
GRAD1TX,
C_WGNOTX,
SEA_FLGTX
FROM OPENJSON(@CONDITION)
WITH(
PT VARCHAR(20) '$.PT',
THECZNAME VARCHAR(100) '$.THECZNAME',
THECZNAME1 VARCHAR(100) '$.THECZNAME1',
DCZNAME VARCHAR(20) '$.DCZNAME',
DCZNAME1 VARCHAR(20) '$.DCZNAME1',
DCZXW VARCHAR(20) '$.DCZXW',
DCZPIC VARCHAR(MAX) '$.DCZPIC',
DCZPIC1 VARCHAR(MAX) '$.DCZPIC1',
CHEDUI VARCHAR(100) '$.CHEDUI',
STOPMSG VARCHAR(20) '$.STOPMSG',
TEL1 VARCHAR(100) '$.TEL1',
TEL2 VARCHAR(100) '$.TEL2',
TEL3 VARCHAR(100) '$.TEL3' ,
TEL4 VARCHAR(100) '$.TEL4',
TEL5 VARCHAR(100) '$.TEL5',
TEL6 VARCHAR(100) '$.TEL6',
TEL7 VARCHAR(100) '$.TEL7',
TEL8 VARCHAR(100) '$.TEL8',
TEL9 VARCHAR(100) '$.TEL9',
CZNOTE1 VARCHAR(MAX) '$.CZNOTE1',
CZNOTE2 VARCHAR(MAX) '$.CZNOTE2',
CZNOTE3 VARCHAR(MAX) '$.CZNOTE3',
CZNOTE4 VARCHAR(MAX) '$.CZNOTE4',
CZNOTE5 VARCHAR(MAX) '$.CZNOTE5',
CZNOTEHX VARCHAR(100) '$.CZNOTEHX',
XPXW VARCHAR(MAX) '$.XPXW',
XPXW2 VARCHAR(MAX) '$.XPXW2',
SFX VARCHAR(20) '$.SFX',
SFX1 VARCHAR(20) '$.SFX1',
SBW VARCHAR(20) '$.SBW',
SXW VARCHAR(20) '$.SXW',
SXW1 VARCHAR(20) '$.SXW1',
JFXW VARCHAR(20) '$.JFXW',
BOXES VARCHAR(20) '$.BOXES',
DCZPICHX VARCHAR(20) '$.DCZPICHX',
PLATE_NO VARCHAR(20) '$.PLATE_NO',
EI_NO VARCHAR(40) '$.EI_NO',
ET_NO VARCHAR(40) '$.ET_NO',
REM VARCHAR(MAX) '$.REM',
REM1 VARCHAR(MAX) '$.REM1',
BOX_NO VARCHAR(MAX) '$.BOX_NO',
CC VARCHAR(10) '$.CC',
XX VARCHAR(10) '$.XX',
CUS_NO VARCHAR(20) '$.CUS_NO',
EI_TYPE VARCHAR(5) '$.EI_TYPE',
XW VARCHAR(15) '$.XW',
BOX_NO2 VARCHAR(20) '$.BOX_NO2',
CC2 VARCHAR(10) '$.CC2',
XX2 VARCHAR(10) '$.XX2',
CUS_NO2 VARCHAR(20) '$.CUS_NO2',
EI_TYPE2 VARCHAR(5) '$.EI_TYPE2',
XW2 VARCHAR(15) '$.XW2',
SBW2 VARCHAR(20) '$.SBW2',
USR VARCHAR(10) '$.USR',
SHIP_NO VARCHAR(20) '$.SHIP_NO',
OVOY VARCHAR(20) '$.OVOY',
LPORT VARCHAR(20) '$.LPORT',
ZTD_NO VARCHAR(30) '$.ZTD_NO',
SEAL_NO VARCHAR(30) '$.SEAL_NO',
TRAN_PORT VARCHAR(20) '$.TRAN_PORT',
END_PORT VARCHAR(20) '$.END_PORT',
TEMPERATURE VARCHAR(20) '$.TEMPERATURE',
HUMIDITY VARCHAR(20) '$.HUMIDITY',
AIRRATE VARCHAR(20) '$.AIRRATE',
TEMPERATURE1 VARCHAR(20) '$.TEMPERATURE1',
HUMIDITY1 VARCHAR(20) '$.HUMIDITY1',
AIRRATE1 VARCHAR(20) '$.AIRRATE1',
T_WEIGHT VARCHAR(20) '$.T_WEIGHT',
NAME VARCHAR(100) '$.NAME',
ZZYQ VARCHAR(20) '$.ZZYQ',
TEL VARCHAR(100) '$.TEL',
EBOX VARCHAR(20) '$.EBOX',
JGSJ VARCHAR(100) '$.JGSJ',
GRAD VARCHAR(20) '$.GRAD',
GRAD1 VARCHAR(20) '$.GRAD1',
N_WGNO VARCHAR(20) '$.N_WGNO',
C_WGNO VARCHAR(20) '$.C_WGNO',
PRD_NAME VARCHAR(20) '$.PRD_NAME',
FI_FLAG VARCHAR(20) '$.FI_FLAG',
TD_NO VARCHAR(40) '$.TD_NO',
SHIP_OVOY VARCHAR(20) '$.SHIP_OVOY',
VICE_SEAL_NO VARCHAR(40) '$.VICE_SEAL_NO',
GB_BOX VARCHAR(20) '$.GB_BOX',
SEA_FLG VARCHAR(20) '$.SEA_FLG',
REMID VARCHAR(MAX) '$.REMID',
KF VARCHAR(40) '$.KF',
MK_DD VARCHAR(40) '$.MK_DD',
XFL VARCHAR(MAX) '$.XFL',
BOX_NO1 VARCHAR(40) '$.BOX_NO1',
CODE VARCHAR(MAX) '$.CODE',
KDDATE VARCHAR(40) '$.KDDATE',
PTTIME VARCHAR(20) '$.PTTIME',
CUSTNAME VARCHAR(MAX) '$.CUSTNAME',
TITLE VARCHAR(MAX) '$.TITLE',
FEENAME VARCHAR(MAX) '$.FEENAME',
AMTN VARCHAR(40) '$.AMTN',
AMTNSUM VARCHAR(50) '$.AMTNSUM',
INVOICENO VARCHAR(MAX) '$.INVOICENO',
ADDRESS VARCHAR(MAX) '$.ADDRESS',
CARE VARCHAR(MAX) '$.CARE',
CNAMTN VARCHAR(40) '$.CNAMTN',
CUSTNUMBER VARCHAR(MAX) '$.CUSTNUMBER',
BOXPOSITION VARCHAR(MAX) '$.BOXPOSITION',
BOX_NOTX VARCHAR(MAX) '$.BOX_NOTX',
SEAL_NOTX VARCHAR(MAX) '$.SEAL_NOTX',
CUS_NOTX VARCHAR(MAX) '$.CUS_NOTX',
CCTX VARCHAR(MAX) '$.CCTX',
XXTX VARCHAR(MAX) '$.XXTX',
VICE_SEAL_NOTX VARCHAR(MAX) '$.VICE_SEAL_NOTX',
GB_BOXTX VARCHAR(MAX) '$.GB_BOXTX',
XPXWTX VARCHAR(MAX) '$.XPXWTX',
GRADTX VARCHAR(MAX) '$.GRADTX',
N_WGNOTX VARCHAR(MAX) '$.N_WGNOTX',
GRAD1TX VARCHAR(MAX) '$.GRAD1TX',
C_WGNOTX VARCHAR(MAX) '$.C_WGNOTX',
SEA_FLGTX VARCHAR(MAX) '$.SEA_FLGTX'
)
--声明传入参数
DECLARE
@PT VARCHAR(20),
@THECZNAME VARCHAR(100),
@THECZNAME1 VARCHAR(100),
@DCZNAME VARCHAR(20),
@DCZNAME1 VARCHAR(20),
@DCZXW VARCHAR(20),
@DCZPIC VARCHAR(MAX),
@DCZPIC1 VARCHAR(MAX),
@CHEDUI VARCHAR(100),
@STOPMSG VARCHAR(20),
@TEL1 VARCHAR(100),
@TEL2 VARCHAR(100),
@TEL3 VARCHAR(100),
@TEL4 VARCHAR(100),
@TEL5 VARCHAR(100),
@TEL6 VARCHAR(100),
@TEL7 VARCHAR(100),
@TEL8 VARCHAR(100),
@TEL9 VARCHAR(100),
@CZNOTE1 VARCHAR(MAX),
@CZNOTE2 VARCHAR(MAX),
@CZNOTE3 VARCHAR(MAX),
@CZNOTE4 VARCHAR(MAX),
@CZNOTE5 VARCHAR(MAX),
@CZNOTEHX VARCHAR(100),
@XPXW VARCHAR(MAX),
@XPXW2 VARCHAR(MAX),
@SFX VARCHAR(20),
@SFX1 VARCHAR(20),
@SBW VARCHAR(20),
@SXW VARCHAR(20),
@SXW1 VARCHAR(20),
@JFXW VARCHAR(20),
@BOXES VARCHAR(20),
@DCZPICHX VARCHAR(100),
@PLATE_NO VARCHAR(20),
@EI_NO VARCHAR(40),
@ET_NO VARCHAR(40),
@REM VARCHAR(MAX),
@REM1 VARCHAR(MAX),
@BOX_NO VARCHAR(MAX),
@CC VARCHAR(10),
@XX VARCHAR(10),
@CUS_NO VARCHAR(20),
@EI_TYPE VARCHAR(5),
@XW VARCHAR(15),
@BOX_NO2 VARCHAR(20),
@CC2 VARCHAR(10),
@XX2 VARCHAR(10),
@CUS_NO2 VARCHAR(20),
@EI_TYPE2 VARCHAR(5),
@XW2 VARCHAR(15),
@SBW2 VARCHAR(20),
@USR VARCHAR(10),
@SHIP_NO VARCHAR(20),
@OVOY VARCHAR(20),
@LPORT VARCHAR(20),
@ZTD_NO VARCHAR(30),
@SEAL_NO VARCHAR(30),
@TRAN_PORT VARCHAR(20),
@END_PORT VARCHAR(20),
@TEMPERATURE VARCHAR(20),
@HUMIDITY VARCHAR(20),
@AIRRATE VARCHAR(20),
@TEMPERATURE1 VARCHAR(20),
@HUMIDITY1 VARCHAR(20),
@AIRRATE1 VARCHAR(20),
@T_WEIGHT VARCHAR(20),
@NAME VARCHAR(100),
@ZZYQ VARCHAR(20),
@TEL VARCHAR(100),
@EBOX VARCHAR(20),
@JGSJ VARCHAR(100),
@GRAD VARCHAR(20),
@GRAD1 VARCHAR(20),
@N_WGNO VARCHAR(20),
@C_WGNO VARCHAR(20),
@PRD_NAME VARCHAR(20),
@FI_FLAG VARCHAR(20),
@TD_NO VARCHAR(40),
@SHIP_OVOY VARCHAR(20),
@VICE_SEAL_NO VARCHAR(40),
@GB_BOX VARCHAR(20),
@SEA_FLG VARCHAR(20),
@REMID VARCHAR(MAX),
@KF VARCHAR(40),
@MK_DD VARCHAR(40),
@XFL VARCHAR(MAX),
@BOX_NO1 VARCHAR(40),
@CODE VARCHAR(MAX),
@KDDATE VARCHAR(40),
@PTTIME VARCHAR(20),
@CUSTNAME VARCHAR(MAX),
@TITLE VARCHAR(MAX),
@FEENAME VARCHAR(MAX),
@AMTN VARCHAR(40),
@AMTNSUM VARCHAR(50),
@INVOICENO VARCHAR(MAX),
@ADDRESS VARCHAR(MAX),
@CARE VARCHAR(MAX),
@CNAMTN VARCHAR(40),
@CUSTNUMBER VARCHAR(MAX),
@BOXPOSITION VARCHAR(MAX),
@BOX_NOTX VARCHAR(MAX),
@SEAL_NOTX VARCHAR(MAX),
@CUS_NOTX VARCHAR(MAX),
@CCTX VARCHAR(MAX),
@XXTX VARCHAR(MAX),
@VICE_SEAL_NOTX VARCHAR(MAX),
@GB_BOXTX VARCHAR(MAX),
@XPXWTX VARCHAR(MAX),
@GRADTX VARCHAR(MAX),
@N_WGNOTX VARCHAR(MAX),
@GRAD1TX VARCHAR(MAX),
@C_WGNOTX VARCHAR(MAX),
@SEA_FLGTX VARCHAR(MAX)
--从临时表里查询出传入的参数
SELECT
@PT=PT,
@THECZNAME=THECZNAME,
@THECZNAME1=THECZNAME1,
@DCZNAME=DCZNAME,
@DCZNAME1=DCZNAME1,
@DCZXW=DCZXW,
@DCZPIC=DCZPIC,
@DCZPIC1=DCZPIC1,
@CHEDUI=CHEDUI,
@STOPMSG=STOPMSG,
@TEL1=TEL1,
@TEL2=TEL2,
@TEL3=TEL3,
@TEL4=TEL4,
@TEL5=TEL5,
@TEL6=TEL6,
@TEL7=TEL7,
@TEL8=TEL8,
@TEL9=TEL9,
@CZNOTE1=CZNOTE1,
@CZNOTE2=CZNOTE2,
@CZNOTE3=CZNOTE3,
@CZNOTE4=CZNOTE4,
@CZNOTE5=CZNOTE5,
@CZNOTEHX=CZNOTEHX,
@XPXW=XPXW,
@XPXW2=XPXW2,
@SFX=SFX,
@SFX1=SFX1,
@SBW=SBW,
@SXW=SXW,
@SXW1=SXW1,
@JFXW=JFXW,
@BOXES=BOXES,
@DCZPICHX=DCZPICHX,
@PLATE_NO=PLATE_NO,
@EI_NO=EI_NO,
@ET_NO=ET_NO,
@REM=REM,
@REM1=REM1,
@BOX_NO=BOX_NO,
@CC=CC,
@XX=XX,
@CUS_NO=CUS_NO,
@EI_TYPE=EI_TYPE,
@XW=XW,
@BOX_NO2=BOX_NO2,
@CC2=CC2,
@XX2=XX2,
@CUS_NO2=CUS_NO2,
@EI_TYPE2=EI_TYPE2,
@XW2=XW2,
@SBW2=SBW2,
@USR=USR,
@SHIP_NO=SHIP_NO,
@OVOY=OVOY,
@LPORT=LPORT,
@ZTD_NO=ZTD_NO,
@SEAL_NO=SEAL_NO,
@TRAN_PORT=TRAN_PORT,
@END_PORT=END_PORT,
@TEMPERATURE=TEMPERATURE,
@HUMIDITY=HUMIDITY,
@AIRRATE=AIRRATE,
@TEMPERATURE1=TEMPERATURE1,
@HUMIDITY1=HUMIDITY1,
@AIRRATE1=AIRRATE1,
@T_WEIGHT=T_WEIGHT,
@NAME=NAME,
@ZZYQ=ZZYQ,
@TEL=TEL,
@EBOX=EBOX,
@JGSJ=JGSJ,
@GRAD=GRAD,
@GRAD1=GRAD1,
@N_WGNO=N_WGNO,
@C_WGNO=C_WGNO,
@PRD_NAME=PRD_NAME,
@EBOX=EBOX,
@FI_FLAG=FI_FLAG,
@TD_NO=TD_NO,
@SHIP_OVOY=SHIP_OVOY,
@VICE_SEAL_NO=VICE_SEAL_NO,
@GB_BOX=GB_BOX,
@SEA_FLG=SEA_FLG,
@REMID=REMID,
@KF=KF,
@MK_DD=MK_DD,
@XFL=XFL,
@BOX_NO1=BOX_NO1,
@CODE=CODE,
@KDDATE=KDDATE,
@PTTIME=PTTIME,
@CUSTNAME=CUSTNAME,
@TITLE=TITLE,
@FEENAME=FEENAME,
@AMTN=AMTN,
@AMTNSUM=AMTNSUM,
@INVOICENO=INVOICENO,
@ADDRESS=ADDRESS,
@CARE=CARE,
@CNAMTN=CNAMTN,
@CUSTNUMBER=CUSTNUMBER,
@BOXPOSITION=BOXPOSITION,
@BOX_NOTX=BOX_NOTX,
@SEAL_NOTX=SEAL_NOTX,
@CUS_NOTX=CUS_NOTX,
@CCTX=CCTX,
@XXTX=XXTX,
@VICE_SEAL_NOTX=VICE_SEAL_NOTX,
@GB_BOXTX=GB_BOXTX,
@XPXWTX=XPXWTX,
@GRADTX=GRADTX,
@N_WGNOTX=N_WGNOTX,
@GRAD1TX=GRAD1TX,
@C_WGNOTX=C_WGNOTX,
@SEA_FLGTX=SEA_FLGTX
FROM #DYNAMIC_PRINT
--@PT 类型,进行区分不同的小票
--TITLE1 副标题
--NAME1 第一行
--NAME2 第二行
--NAME3 第三行
--NAME4 第四行
--.
--.
--.
--IMAGE1 二维码地址,需要则赋值,不需要则赋值''
begin
if @PT='999'
begin
SELECT top 1
'测试小票' TITLE1,
'提号:XXXXXXXXXXXX' NAME1,
'主提号:XXXXXXX' NAME2,
'车号:XXXXXXX 靠泊单位:XXXXX' NAME3,
'箱型:XX 箱属:XXXXX' NAME4,
'C:\\Users\\Administrator\\Desktop\\共享BS\\A07垛-glja07013.png' IMAGE1
FROM T_MF_TD
-- where TD_NO = @TD_NO and ZTD_NO = @ZTD_NO
end
else
if @PT='1' --小票
begin
SELECT top 1
'进场箱小票' AS TITLE1,
'受理号:'+ISNULL(@EI_NO, '') AS NAME1,
'车号:'+ISNULL(@PLATE_NO, '') AS NAME2,
'车队:'+ISNULL(@CHEDUI, '') AS NAME3,
ISNULL(@TEL1, '') AS NAME4,
ISNULL(@TEL2, '') AS NAME5,
ISNULL(@TEL3, '') AS NAME6,
ISNULL(@TEL4, '') AS NAME7,
'备注:'+ISNULL(@REM, '') AS NAME8,
'编号:'+ISNULL(@BOX_NO, '')+' 尺寸:'+ISNULL(@CC, '')+ISNULL(@XX, '') AS NAME9,
'归属:'+ISNULL(@CUS_NO, '')+' 类型:'+ISNULL(@EI_TYPE, '') AS NAME10,
'位置:'+ISNULL(@XPXW, '') AS NAME11,
'制单人:'+ISNULL(@USR, '') AS NAME12,
'制单日期:'+CONVERT(NVARCHAR, GETDATE(), 120) AS NAME13,
ISNULL(@CZNOTE1, '________________________________________') AS NAME14,
case WHEN len(ISNULL(@DCZPIC, '')) > 0 then @CZNOTE2 else '' end NAME15,
ISNULL(@DCZPIC, '') AS IMAGE1,
'['+ISNULL(@THECZNAME, '未知')+']['+ISNULL(@DCZPIC, '未知')+']' AS IMAGENAME
FROM CUST
end
if @PT='10' -小票
begin
SELECT top 1
'小票' AS TITLE1,
'编号:'+ISNULL(@EI_NO, '') AS NAME1,
'车号:'+ISNULL(@PLATE_NO, '') AS NAME2,
'车队:'+ISNULL(@CHEDUI, '') AS NAME3,
ISNULL(@TEL1, '') AS NAME4,
ISNULL(@TEL2, '') AS NAME5,
ISNULL(@TEL3, '') AS NAME6,
ISNULL(@TEL4, '') AS NAME7,
'备注:'+ISNULL(@REM, '') AS NAME8,
'编号:'+ISNULL(@BOX_NO, '')+' 尺寸:'+ISNULL(@CC, '')+ISNULL(@XX, '') AS NAME9,
'归属:'+ISNULL(@CUS_NO, '')+' 类型:'+ISNULL(@EI_TYPE, '') AS NAME10,
'位置:'+ISNULL(@XPXW, '') AS NAME11,
'编号:'+ISNULL(@BOX_NO2, '')+' 尺寸:'+ISNULL(@CC2, '')+ISNULL(@XX2, '') AS NAME12,
'归属:'+ISNULL(@CUS_NO2, '')+' 类型:'+ISNULL(@EI_TYPE2, '') AS NAME13,
'位置:'+ISNULL(@XPXW2, '') AS NAME14,
'制单人:'+ISNULL(@USR, '') AS NAME15,
'制单日期:'+CONVERT(NVARCHAR, GETDATE(), 120) AS NAME16,
ISNULL(@CZNOTE1, '________________________________________') AS NAME17,
case WHEN len(ISNULL(@DCZPIC, '')) > 0 then @CZNOTE2 else '' end NAME18,
ISNULL(@DCZPIC, '') AS IMAGE1,
'['+ISNULL(@THECZNAME, '未知')+']['+ISNULL(@DCZPIC, '未知')+']' AS IMAGENAME
FROM CUST
end
if @PT='2'
begin
SELECT top 1
' ' AS TITLE1,
'车号:'+ISNULL(@OVOY, '')+' 单位:'+ISNULL(@LPORT, '') AS NAME1,
'名次:'+ISNULL(@SHIP_NO, '') AS NAME2,
'提号:'+ISNULL(@ZTD_NO, '') AS NAME3,
'编号:'+ISNULL(@BOX_NO, '') AS NAME4,
'封号:'+ISNULL(@SEAL_NO, '') AS NAME5,
'尺寸:'+ISNULL(@XX, '')+' 归属:'+ISNULL(@cus_no, '') AS NAME6,
'中途:'+ISNULL(@TRAN_PORT, '')+' 目的:'+ISNULL(@END_PORT, '') AS NAME7,
'温度:'+ISNULL(@TEMPERATURE, '')+' 湿度:'+ISNULL(@HUMIDITY, '') AS NAME8,
'通风量:'+ISNULL(@AIRRATE, '') AS NAME9,
'整箱重:'+ISNULL(@T_WEIGHT, '')+' KG'+' 货名:'+ISNULL(@PRD_NAME, '') AS NAME10,
'特殊装载:'+ISNULL(@ZZYQ, '') AS NAME11,
'危险品类别:'+ISNULL(@GRAD, '')+' 联合国编号:'+ISNULL(@N_WGNO, '') AS NAME12,
'危险品副标:'+ISNULL(@GRAD1, '')+' 联合国编号:'+ISNULL(@C_WGNO, '') AS NAME13,
'空箱集港标识:'+ISNULL(@EBOX, '')+' 内外贸标识:'+ISNULL(@FI_FLAG, '') AS NAME14,
ISNULL(@JGSJ,'') AS NAME15,
ISNULL(@TEL, '') AS NAME16
-- '投诉电话:'+ISNULL(@TEL, '') AS NAME17,
-- ' 安 全 第 一 ,预 防 为 主' AS NAME17
FROM CUST
end
if @PT='20'(入港单) 双背
begin
SELECT top 1
'集装箱装箱单(入港单)' AS TITLE1,
'车号:'+ISNULL(@OVOY, '')+' 靠泊单位:'+ISNULL(@NAME, '') AS NAME1,
'名次:'+ISNULL(@SHIP_NO, '') AS NAME2,
'提号:'+ISNULL(@ZTD_NO, '') AS NAME3,
'编号:'+ISNULL(@BOX_NO, '') AS NAME4,
'铅封号:'+ISNULL(@SEAL_NO, '') AS NAME5,
'尺寸箱型:'+ISNULL(@XX, '')+' 箱属:'+ISNULL(@cus_no, '') AS NAME6,
'中转港:'+ISNULL(@TRAN_PORT, '')+' 目的港:'+ISNULL(@END_PORT, '') AS NAME7,
'温度:'+ISNULL(@TEMPERATURE, '')+' 湿度:'+ISNULL(@HUMIDITY, '') AS NAME8,
'通风量:'+ISNULL(@AIRRATE, '') AS NAME9,
'整箱重:'+ISNULL(@T_WEIGHT, '')+' KG'+' 货名:'+ISNULL(@PRD_NAME, '') AS NAME10,
'特殊装载:'+ISNULL(@ZZYQ, '') AS NAME11,
'危险品类别:'+ISNULL(@GRAD, '')+' 联合国编号:'+ISNULL(@N_WGNO, '') AS NAME12,
'危险品副标:'+ISNULL(@GRAD1, '')+' 联合国编号:'+ISNULL(@C_WGNO, '') AS NAME13,
'空箱集港标识:'+ISNULL(@EBOX, '')+' 内外贸标识:'+ISNULL(@FI_FLAG, '') AS NAME14,
ISNULL(@JGSJ,'') AS NAME15,
ISNULL(@TEL, '') AS NAME16,
-- '投诉电话:'+ISNULL(@TEL, '') AS NAME17,
' 安 全 第 一 ,预 防 为 主' AS NAME17
FROM CUST
end
if @PT='3'
begin
SELECT top 1
'小票' AS TITLE1,
'受理号:'+ISNULL(@ET_NO, '') AS NAME1,
'车号:'+ISNULL(@PLATE_NO, '') AS NAME2,
' ' AS NAME3,
ISNULL(@TEL1, '') AS NAME4,
ISNULL(@TEL2, '') AS NAME5,
ISNULL(@TEL3, '') AS NAME6,
ISNULL(@TEL4, '') AS NAME7,
'提 单:'+ISNULL(@ZTD_NO, '') AS NAME8,
'船 次:'+ISNULL(@SHIP_OVOY, '')+' 目的港:'+ISNULL(@END_PORT, '') AS NAME9,
'温 度:'+ISNULL(@TEMPERATURE, '')+' 湿度:'+ISNULL(@HUMIDITY, 'OFF') AS NAME10,
'通风量:'+ISNULL(@AIRRATE, 'OFF') AS NAME11,
'备 注 '+ISNULL(@REM1, '') AS NAME12,
'___________________________________' AS NAME13,
'编号:'+ISNULL(@BOX_NO, '') AS NAME14,
'铅封号:'+ISNULL(@SEAL_NO, '') AS NAME15,
'箱属:'+ISNULL(@CUS_NO, '')+' 尺寸箱型:'+ISNULL(@CC, '') AS NAME16,
'封条号:'+ISNULL(@VICE_SEAL_NO, '')AS NAME17,
'箱位:'+ISNULL(@XPXW,'') +' 箱况:'+ISNULL(@GB_BOX, '') AS NAME18,
'危险主等级:'+ISNULL(@GRAD, '')+' 主危号:'+ISNULL(@N_WGNO, '') AS NAME19,
'危险副等级:'+ISNULL(@GRAD1, '') +' 副危号:'+ISNULL(@C_WGNO, '') AS NAME20,
'是否为海洋污染物:'+ISNULL(@SEA_FLG, '') AS NAME21,
ISNULL(@DCZPIC, '') AS IMAGE1,
'['+ISNULL(@THECZNAME, '未知')+']['+ISNULL(@DCZPIC, '未知')+']' AS IMAGENAME,
' ____ 'AS NAME22,
ISNULL(@BOX_NOTX, '') AS NAME23,
ISNULL(@SEAL_NOTX, '') AS NAME24,
ISNULL(@CUS_NOTX, '') +' '+ISNULL(@CCTX, '') AS NAME25,
ISNULL(@VICE_SEAL_NOTX, '')AS NAME26,
ISNULL(@XPXWTX,'')+' '+ISNULL(@GB_BOXTX, '') AS NAME27,
ISNULL(@GRADTX, '')+' '+ISNULL(@N_WGNOTX, '') AS NAME28,
ISNULL(@GRAD1TX, '') +' '+ISNULL(@C_WGNOTX, '') AS NAME29,
ISNULL(@SEA_FLGTX, '') AS NAME30,
ISNULL(@DCZPIC1, '') AS IMAGE2,
'['+ISNULL(@THECZNAME1, '未知')+']['+ISNULL(@DCZPIC1, '未知')+']' AS IMAGENAME1,
'___________________________________' AS NAME31,
'说明:'+ISNULL(@REM, '') AS NAME32,
ISNULL(@CZNOTE2, '') AS NAME33,
'制单人:'+ISNULL(@USR, '') AS NAME34,
'制单日期:'+CONVERT(NVARCHAR, GETDATE(), 120) AS NAME35,
'换箱位置:'+ISNULL(@CZNOTEHX, '') AS NAME36,
ISNULL(@CZNOTE1, '_________________________________') AS NAME37,
' 'AS NAME38
FROM CUST
end
if @PT='4' --站点设备交接单
begin
SELECT top 1
'站点设备交接单' AS TITLE1,
'提号:'+ISNULL(@TD_NO, '') AS NAME1,
'编号:'+ISNULL(@BOX_NO, '') AS NAME2,
'铅封号:'+ISNULL(@SEAL_NO, '') AS NAME3,
'电话:'+ISNULL(@KF, '') AS NAME4,
'车号:'+ISNULL(@PLATE_NO,'') AS NAME5,
'装货工厂签章_________________' AS NAME6,
' ' AS NAME7,
'请装货司机使用微信绑定的手机号,扫描二维码填写货名及件重尺' AS NAME8,
' ' AS NAME9,
'https://newoss.sdland-sea.com/eir/appoint?containerNo='+ISNULL(@BOX_NO, '')+'&billNo='+ISNULL(@TD_NO, '') AS IMAGE1
FROM CUST
end
if @PT='5' --租箱检验小票
begin
SELECT top 1
'检验小票' AS TITLE1,
'司机师傅:
装箱后请先到门检处,粘贴 PES贴,最后
在到闸口办理出场手续,此小票需交回出
场闸口!' AS NAME1,
'北站门检:86917620' AS NAME2,
'总站门检:82987586' AS NAME3,
'南站门检:18053230421' AS NAME4,
'受 理 号:'+ ISNULL(@ET_NO, '') AS NAME5,
'车 牌 号:'+ISNULL(@PLATE_NO, '') AS NAME6,
'提箱时间:' +CONVERT(NVARCHAR, GETDATE(), 120) AS NAME7,
'计划单号:'+ISNULL(@TD_NO, '') AS NAME8,
'箱 分 类:'+ISNULL(@CZNOTE1, '') AS NAME9,
' ' AS NAME10,
'箱 号:'+ISNULL(@CZNOTE2, '') AS NAME11,
' ' AS NAME12,
' ' AS NAME13,
'签字:' AS NAME14,
''AS NAME15,
'门检同事:箱分类为CWCA-1标准时,期限延长30个
月,粘贴后请签字,交于司机。
箱分类为CWCA-2标准时,期限延长18个
月,粘贴后请签字,交于司机' AS NAME16,
'' AS NAME17,
'' AS NAME18,
'' AS NAME19,
'' AS NAME20
FROM CUST
end
if @PT='6' --拍照小票
begin
SELECT top 1
'检验小票' AS TITLE1,
'司机师傅,您好:
装箱后请先到门检处拍照,
最后在到闸口办理出场手续,此小票需交
回出场闸口!' AS NAME1,
'北站门检:18053230417' AS NAME2,
'总站门检:82987586' AS NAME3,
'南站门检:18053230421' AS NAME4,
'受 理 号:'+ ISNULL(@ET_NO, '') AS NAME5,
'计划单号:'+ISNULL(@TD_NO, '') AS NAME6,
'箱 属:' + ISNULL(@CUS_NO, '') AS NAME7,
'箱 分 类:'+ISNULL(@CZNOTE1, '') AS NAME8,
'箱 号:'+ISNULL(@CZNOTE2, '') AS NAME9,
' ' AS NAME10,
'签字:' AS NAME11,
'' AS NAME12,
'门检同事:箱分类为CWCA-1标准时,期限延长30个
月,粘贴后请签字,交于司机。
箱分类为CWCA-2标准时,期限延长18个
月,粘贴后请签字,交于司机' AS NAME13,
'' AS NAME14,
'' AS NAME15,
'' AS NAME16
FROM CUST
end
if @PT='7'
begin
SELECT top 1
'检验小票' AS TITLE1,
'司机师傅,您好:回出场闸口!' AS NAME1,
'门 检:86917620' AS NAME2,
'门 检:82987586' AS NAME3,
'门 检:18053230421' AS NAME4,
'时 间:'+CONVERT(NVARCHAR, GETDATE(), 120) AS NAME5,
'计 划 号:'+ISNULL(@TD_NO, '') AS NAME6,
'归 属:' + ISNULL(@CUS_NO, '') AS NAME7,
'分 类:'+ISNULL(@CZNOTE1, '') AS NAME8,
'编 号:'+ISNULL(@CZNOTE2, '') AS NAME9,
'签字:' AS NAME10,
'同事签字:'+ISNULL(@REM, '') AS NAME11
FROM CUST
end
if @PT='8' --证明
begin
SELECT top 1
'证明' AS TITLE1,
ISNULL(@ET_NO, '') AS NAME1,
'名次:'+ISNULL(@SHIP_OVOY,'') AS NAME2,
'主提号:'+ISNULL(@ZTD_NO,'') AS NAME3,
'型号:'+ISNULL(@XX,'') AS NAME4,
'编号:'+ISNULL(@BOX_NO,'')+' '+ISNULL(@BOX_NO1,'') AS NAME5,
'站点:'+ISNULL(@CZNOTEHX,'') AS NAME6,
'车号:'+ISNULL(@PLATE_NO,'') AS NAME7,
'打印时间:'+CONVERT(NVARCHAR, GETDATE(), 120) AS NAME8,
'操作员:'+ISNULL(@USR, '') AS NAME9
FROM CUST
end
if @PT='9' --收据小票
begin
SELECT top 1
ISNULL(@TITLE,'')+'收据' AS TITLE1,
'日期:'+ISNULL(@KDDATE,'') AS NAME1,
'客户:'+ISNULL(@CUSTNUMBER,'') AS NAME2,
'单位:'+ISNULL(@CUSTNAME,'') AS NAME3,
'提号:'+ISNULL(@TD_NO,'') AS NAME4,
'编号:'+ISNULL(@BOX_NO,'') AS NAME5,
'车号:'+ISNULL(@PLATE_NO,'') AS NAME6,
'___________________________________'AS NAME7,
'名称:'+ISNULL(@FEENAME,'') AS NAME8,
'金额: '+ISNULL(@AMTN,'') AS NAME9,
'小写合计: ¥'+ISNULL(@AMTNSUM,'') AS NAME10,
'大写合计:'+ISNULL(@CNAMTN,'') AS NAME11,
'___________________________________'AS NAME12,
'收款人:'+ISNULL(@USR, '') AS NAME13,
'受理号:'+ISNULL(@ET_NO,'')AS NAME14,
'名次:'+ISNULL(@SHIP_OVOY,'') AS NAME15,
'第 '+ISNULL(@PTTIME,'')+' 次打印'AS NAME16,
ISNULL(@INVOICENO,'') AS IMAGE1,
ISNULL(@CODE,'') AS IMAGE2,
'1.初次开票请提供盖公章的开票资料及营业执照复印件。 2.请于60日内到'+ISNULL(@CARE,'') +' 更换发票:可扫下方二维码导航'AS REM1,
'3.换发票地址:'+ISNULL(@ADDRESS,'')+' 4.收据请远离热源、光源、水源。' AS REM2,
ISNULL(@BOXPOSITION,'') AS IMAGE3
FROM CUST
end
end