Browse Source

硬标一键导出增加合同复选框,默认不勾选

master
han\hanst 2 months ago
parent
commit
35fe93b6ec
  1. 66
      src/main/java/com/xujie/sys/modules/ecss/service/impl/CoDelExcelTXServiceImpl.java
  2. 59
      src/main/java/com/xujie/sys/modules/ecss/service/impl/CoDelServiceImpl.java
  3. 14
      src/main/resources/mapper/ecss/CoDelMapper.xml
  4. BIN
      src/main/resources/templates/ALPHA/declaration-all-template.xlsx
  5. BIN
      src/main/resources/templates/ALPHA/declaration-packingList-template.xlsx
  6. BIN
      src/main/resources/templates/TX/declaration-all-template.xlsx
  7. BIN
      src/main/resources/templates/TX/declaration-packingList-template.xlsx
  8. BIN
      src/main/resources/templates/TX/declaration-template.xlsx
  9. BIN
      src/main/resources/templates/YB/declaration-all-template-pdf.xlsx
  10. BIN
      src/main/resources/templates/YB/declaration-all-template.xlsx
  11. BIN
      src/main/resources/templates/YB/declaration-packingList-template.xlsx

66
src/main/java/com/xujie/sys/modules/ecss/service/impl/CoDelExcelTXServiceImpl.java

@ -1488,7 +1488,9 @@ public class CoDelExcelTXServiceImpl implements CoDelExcelTXService {
extractedContract(data, templateAdapter);
template.render(5);*/
} else if (isHardtag) {
ExcelTemplateYB template = ExcelTemplateYB.load(new ClassPathResource("templates/YB/declaration-all-template.xlsx").getInputStream());
ExcelTemplateYB template = ExcelTemplateYB.load(new ClassPathResource(
data.getContractFlag()!=null && data.getContractFlag()?"templates/YB/declaration-all-template-invoice.xlsx"
:"templates/YB/declaration-all-template.xlsx").getInputStream());
ExcelTemplateAdapter templateAdapter = new Yb2ExcelTemplateAdapter(template);
// 第一个sheet - 出口货物委托书
@ -1514,14 +1516,21 @@ public class CoDelExcelTXServiceImpl implements CoDelExcelTXService {
templateAdapter.clearAll();
extractedElements(data, templateAdapter);
template.render(4);
// 第六个sheet - 合同
templateAdapter.clearAll();
extractedContract(data, templateAdapter);
template.render(5);
// 第7个sheet - 出货通知
templateAdapter.clearAll();
extractedShippingNotice(templateAdapter, notifyHeader);
template.render(6);
if (data.getContractFlag()!=null && data.getContractFlag()) {
// 第六个sheet - 合同
templateAdapter.clearAll();
extractedContract(data, templateAdapter);
template.render(5);
// 第7个sheet - 出货通知
templateAdapter.clearAll();
extractedShippingNotice(templateAdapter, notifyHeader);
template.render(6);
} else {
// 第六个sheet - 出货通知
templateAdapter.clearAll();
extractedShippingNotice(templateAdapter, notifyHeader);
template.render(5);
}
} else {
ExcelTemplateALPHA template = ExcelTemplateALPHA.load(new ClassPathResource("templates/ALPHA/declaration-all-template.xlsx").getInputStream());
ExcelTemplateAdapter templateAdapter = new YbExcelTemplateAdapter(template);
@ -1606,7 +1615,7 @@ public class CoDelExcelTXServiceImpl implements CoDelExcelTXService {
template.render(3);
} else if (isHardtag) {
String xlsx = "templates/YB/declaration-all-template-pdf.xlsx";
String xlsx = data.getContractFlag()!=null && data.getContractFlag()?"templates/YB/declaration-all-template-invoice-pdf.xlsx":"templates/YB/declaration-all-template-pdf.xlsx";
ExcelTemplateYB template = ExcelTemplateYB.load(new ClassPathResource(xlsx).getInputStream());
ExcelTemplateAdapter templateAdapter = new Yb2ExcelTemplateAdapter(template);
@ -1629,10 +1638,21 @@ public class CoDelExcelTXServiceImpl implements CoDelExcelTXService {
extractedElements(data, templateAdapter);
template.render(3);
// 第五个sheet - 合同
templateAdapter.clearAll();
extractedContract(data, templateAdapter);
template.render(4);
if (data.getContractFlag()!=null && data.getContractFlag()) {
// 合同
templateAdapter.clearAll();
extractedContract(data, templateAdapter);
template.render(4);
// 出货通知
templateAdapter.clearAll();
extractedShippingNotice(templateAdapter, notifyHeader);
template.render(5);
} else {
// 出货通知
templateAdapter.clearAll();
extractedShippingNotice(templateAdapter, notifyHeader);
template.render(4);
}
} else {
String xlsx = "templates/ALPHA/declaration-all-template-pdf.xlsx";
ExcelTemplateALPHA template = ExcelTemplateALPHA.load(new ClassPathResource(xlsx).getInputStream());
@ -1809,13 +1829,15 @@ public class CoDelExcelTXServiceImpl implements CoDelExcelTXService {
for (int i = 0; i < detailList.size(); i++) {
Map eorder = detailList.get(i);
eorder.put("row_num", i + 1);
if (data.getDeclarationWeight()!=null && data.getDeclarationWeight().equals("显示")) {
/* if (data.getDeclarationWeight()!=null && data.getDeclarationWeight().equals("显示")) {
eorder.put("net_weight", eorder.get("net_weight") != null ? eorder.get("net_weight").toString() : "");
eorder.put("weight_unit", eorder.get("weight_unit") != null ? eorder.get("weight_unit").toString() : "");
} else {
eorder.put("net_weight", "");
eorder.put("weight_unit", "");
}
}*/
eorder.put("net_weight", eorder.get("net_weight") != null ? eorder.get("net_weight").toString() : "");
eorder.put("weight_unit", eorder.get("weight_unit") != null ? eorder.get("weight_unit").toString() : "");
if (eorder.get("currency") != null) {
String currency = stringInput((String) eorder.get("currency"));
if (currency.toUpperCase().startsWith("RMB")) {
@ -1947,7 +1969,7 @@ public class CoDelExcelTXServiceImpl implements CoDelExcelTXService {
return "";
}
final int maxCharsPerLine = 85;
final int maxCharsPerLine = 100;
StringBuilder result = new StringBuilder();
int currentLineLength = 0;
@ -1996,7 +2018,7 @@ public class CoDelExcelTXServiceImpl implements CoDelExcelTXService {
template.addVar("localShipAddress", notifyHeader.getLocalShipAddress());
template.addVar("ccusname", stringInput(notifyHeader.getOverseasShipper()));
template.addVar("cDeliverAdd", stringInput(notifyHeader.getOverseasAddress()));
template.addVar("invoiceTitle", data.getContractFlag()!=null && data.getContractFlag()? "合同" : "INVOICE No.");
template.addVar("invoiceTitle", "INVOICE No.");
template.addVar("cmc_invoice", notifyHeader.getCmcInvoice());
template.addVar("dateStr", notifyHeader.getReadyDate() == null ? "" :
new java.text.SimpleDateFormat("d-MMM-yyyy", java.util.Locale.ENGLISH).format(notifyHeader.getReadyDate()));
@ -2214,7 +2236,7 @@ public class CoDelExcelTXServiceImpl implements CoDelExcelTXService {
// 构建artNo内容
String artNoContent = eorder.get("pn")+" " + eorder.get("part_description") + "\n"
+ "PO#" + eorder.get("po_no") +
+ " PO#" + eorder.get("po_no") +
(data.getHsCodeFlag()!=null && data.getHsCodeFlag()?" HS CODE#" + eorder.get("hsCode"):"");
eorder.put("artNo", artNoContent);
// 计算artNo内容的行数动态设置行高
@ -2462,7 +2484,9 @@ public class CoDelExcelTXServiceImpl implements CoDelExcelTXService {
eorder.put("net_weight", isFirstRow ? ((BigDecimal) list.get(m).get("net_weight")).setScale(2, RoundingMode.HALF_UP) : "");
// 构建artNo内容
String artNoContent = eorder.get("pn")+" " + eorder.get("part_description") ;
String artNoContent = eorder.get("pn")+" " + eorder.get("part_description") + "\n"
+ " PO:" + eorder.get("po_no") +
(data.getHsCodeFlag()!=null && data.getHsCodeFlag()?" HS CODE:" + eorder.get("hsCode"):"");
eorder.put("artNo", artNoContent);
// 计算artNo内容的行数动态设置行高
int lineCount = calculateLineCount(artNoContent);
@ -2707,7 +2731,7 @@ public class CoDelExcelTXServiceImpl implements CoDelExcelTXService {
// 构建artNo内容
String artNoContent = eorder.get("pn")+" " + eorder.get("part_description") + "\n"
+ "PO:" + eorder.get("po_no") +
+ " PO:" + eorder.get("po_no") +
(data.getHsCodeFlag()!=null && data.getHsCodeFlag()?" HS CODE:" + eorder.get("hsCode"):"");
eorder.put("artNo", artNoContent);
// 计算artNo内容的行数动态设置行高

59
src/main/java/com/xujie/sys/modules/ecss/service/impl/CoDelServiceImpl.java

@ -420,9 +420,18 @@ public class CoDelServiceImpl implements CoDelService {
public void saveHSCodeData(EcssHsCodeData inData) {
SysUserEntity currentUser = (SysUserEntity) SecurityUtils.getSubject().getPrincipal();
String site = coDelMapper.getSiteByBu(inData.getBuNo());
List<PropertyModelHeader> checkModel = coDelMapper.checkPropertiesModel(site, inData.getBuNo(), inData.getCodeNo(), "ECSS");
if (checkModel.size() == 0) {
throw new RuntimeException("属性模板不存在。");
String codeNo = inData.getCodeNo();
if (codeNo == null) {
codeNo = "";
}
codeNo = codeNo.trim();
inData.setCodeNo(codeNo);
boolean hasCodeNo = StringUtils.isNotBlank(codeNo);
if (hasCodeNo) {
List<PropertyModelHeader> checkModel = coDelMapper.checkPropertiesModel(site, inData.getBuNo(), inData.getCodeNo(), "ECSS");
if (checkModel.size() == 0) {
throw new RuntimeException("属性模板不存在。");
}
}
if (inData.getAddFlag() == 0) {
//0是新增
@ -433,14 +442,16 @@ public class CoDelServiceImpl implements CoDelService {
throw new RuntimeException("该BU已经存在了这个品名,请检查数据。");
}
coDelMapper.insertHsCodeData(inData);
PartSubPropertiesValueData propertiesData = new PartSubPropertiesValueData();
propertiesData.setSite(site);
propertiesData.setBuNo(inData.getBuNo());
propertiesData.setCodeNo(inData.getCodeNo());
propertiesData.setRecordType("ECSS");
propertiesData.setPartNo(inData.getHsCodeDesc());
partInformationMapper.savePartSubPropertiesValueHeader(propertiesData);
partInformationMapper.savePartSubPropertiesValue(propertiesData);
if (hasCodeNo) {
PartSubPropertiesValueData propertiesData = new PartSubPropertiesValueData();
propertiesData.setSite(site);
propertiesData.setBuNo(inData.getBuNo());
propertiesData.setCodeNo(inData.getCodeNo());
propertiesData.setRecordType("ECSS");
propertiesData.setPartNo(inData.getHsCodeDesc());
partInformationMapper.savePartSubPropertiesValueHeader(propertiesData);
partInformationMapper.savePartSubPropertiesValue(propertiesData);
}
} else {
inData.setUpdateBy(currentUser.getUsername());
inData.setSite(site);
@ -449,18 +460,20 @@ public class CoDelServiceImpl implements CoDelService {
throw new RuntimeException("这个品名已经不存在,请检查数据。");
}
coDelMapper.updateHsCodeData(inData);
PartSubPropertiesValueData propertiesData = new PartSubPropertiesValueData();
propertiesData.setSite(site);
propertiesData.setBuNo(inData.getBuNo());
propertiesData.setCodeNo(inData.getCodeNo());
propertiesData.setRecordType("ECSS");
propertiesData.setPartNo(inData.getHsCodeDesc());
List<PartSubPropertiesValueHeaderData> checkValueHeaderData = partInformationMapper.checkValueHeaderData(propertiesData);
if (checkValueHeaderData.size() == 0) {
partInformationMapper.deletePartSubPropertiesValueHeader(propertiesData);
partInformationMapper.deletePartSubPropertiesValue(propertiesData);
partInformationMapper.savePartSubPropertiesValueHeader(propertiesData);
partInformationMapper.savePartSubPropertiesValue(propertiesData);
if (hasCodeNo) {
PartSubPropertiesValueData propertiesData = new PartSubPropertiesValueData();
propertiesData.setSite(site);
propertiesData.setBuNo(inData.getBuNo());
propertiesData.setCodeNo(inData.getCodeNo());
propertiesData.setRecordType("ECSS");
propertiesData.setPartNo(inData.getHsCodeDesc());
List<PartSubPropertiesValueHeaderData> checkValueHeaderData = partInformationMapper.checkValueHeaderData(propertiesData);
if (checkValueHeaderData.size() == 0) {
partInformationMapper.deletePartSubPropertiesValueHeader(propertiesData);
partInformationMapper.deletePartSubPropertiesValue(propertiesData);
partInformationMapper.savePartSubPropertiesValueHeader(propertiesData);
partInformationMapper.savePartSubPropertiesValue(propertiesData);
}
}

14
src/main/resources/mapper/ecss/CoDelMapper.xml

@ -366,6 +366,12 @@
<if test="query.hsCode != null and query.hsCode != ''">
AND a.HsCode like #{query.hsCode}
</if>
<if test="query.hsCodeDesc != null and query.hsCodeDesc != ''">
AND a.HsCodeDesc like #{query.hsCodeDesc}
</if>
<if test="query.brand != null and query.brand != ''">
AND ISNULL(a.brand,'无') = ISNULL(#{query.brand},'无')
</if>
</where>
order by a.CreateDate ,a.HsCode
@ -374,9 +380,7 @@
<select id="checkHsCodeDescData" resultType="EcssHsCodeData">
select a.Site,a.BuNo,a.HsCode,a.hsCodeDesc,a.brand
from ecss_hsCode a where a.site=#{site} and a.buNo=#{buNo} and a.HsCodeDesc=#{hsCodeDesc}
<if test="brand != null and brand != ''">
AND a.brand = #{brand}
</if>
AND ISNULL(a.brand,'无') = ISNULL(#{brand},'无')
</select>
<select id="checkPropertiesModel" resultType="com.xujie.sys.modules.attrbute.entity.PropertyModelHeader">
select site,bu_no,function_type ,code_no from plm_properties_model_header
@ -390,11 +394,11 @@
<update id="updateHsCodeData">
update ecss_hsCode set Remark=#{remark} ,codeNo=#{codeNo},HsCode=#{hsCode},unit=#{unit} ,brand=#{brand},UpdateDate=GetDate(),UpdateBy=#{updateBy},hsCodeDescEn=#{hsCodeDescEn}
where site=#{site} and buNo=#{buNo} and hsCodeDesc=#{hsCodeDesc}
where site=#{site} and buNo=#{buNo} and hsCodeDesc=#{hsCodeDesc} and ISNULL(brand,'无') = ISNULL(#{brand},'无')
</update>
<select id="deleteHsCode" >
delete from ecss_hsCode where site=#{site} and buNo=#{buNo} and hsCodeDesc=#{hsCodeDesc}
delete from ecss_hsCode where site=#{site} and buNo=#{buNo} and hsCodeDesc=#{hsCodeDesc} and ISNULL(brand,'无') = ISNULL(#{brand},'无')
</select>
<select id="searchPropertiesItemList" resultType="com.xujie.sys.modules.attrbute.entity.PropertyItem">

BIN
src/main/resources/templates/ALPHA/declaration-all-template.xlsx

BIN
src/main/resources/templates/ALPHA/declaration-packingList-template.xlsx

BIN
src/main/resources/templates/TX/declaration-all-template.xlsx

BIN
src/main/resources/templates/TX/declaration-packingList-template.xlsx

BIN
src/main/resources/templates/TX/declaration-template.xlsx

BIN
src/main/resources/templates/YB/declaration-all-template-pdf.xlsx

BIN
src/main/resources/templates/YB/declaration-all-template.xlsx

BIN
src/main/resources/templates/YB/declaration-packingList-template.xlsx

Loading…
Cancel
Save