📄 preadvicepagehtmlbuilder.java
字号:
/* PreAdvicePageHTMLBuilder.java, Auto-generated by PreAdvicePageBuilder.xsl
*/
package com.oocllogistics.threepl.preadvice.service;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.StringTokenizer;
import com.cargosmart.system.frm.taskwork.DataPacket;
import com.oocl.frm.util.jsp.JSPHelper;
import com.oocllogistics.common.base.supp.domain.DocumentFieldConstant;
import com.oocllogistics.common.util.task.SessionContext;
import com.oocllogistics.framework.util.exception.ServiceException;
import com.oocllogistics.framework.util.tool.StringHelper;
import com.oocllogistics.threepl.postadvice.service.AbstractPrePostAdviceVisitor;
import com.oocllogistics.threepl.postadvice.service.AdvicePageBuilder;
import com.oocllogistics.threepl.postadvice.service.FieldCustomizeField;
import com.oocllogistics.threepl.postadvice.service.FieldCustomizeSection;
import com.oocllogistics.threepl.postadvice.service.PrePostAdviceGroupVisitor;
import com.oocllogistics.threepl.preadvice.domain.PreAdvice;
// import
// com.oocllogistics.threepl.postadvice.service.AbstractPrePostAdviceVisitor;
// import com.oocllogistics.threepl.postadvice.service.AdvicePageBuilder;
// import
// com.oocllogistics.threepl.postadvice.service.PrePostAdviceGroupVisitor;
/**
* @author LIUAF
*
*/
public class PreAdvicePageHTMLBuilder extends AdvicePageBuilder {
private boolean isFirstGroup = true;
protected String multiLine2BR(String line) {
StringBuffer result = new StringBuffer();
for (StringTokenizer tokenizer = new StringTokenizer(line, ";"); tokenizer.hasMoreTokens();) {
result.append(tokenizer.nextToken()).append("<br>");
}
return result.toString();
}
protected String getAlignByField(String code) {
String result = "left";
if (PreAdviceFieldConstants.FIELD_SUMMARY_TOTAL_WEIGHT.equals(code) || PreAdviceFieldConstants.FIELD_SUMMARY_TOTAL_VOLUMN.equals(code)
|| PreAdviceFieldConstants.FIELD_SUMMARY_TOTAL_PACKAGE.equals(code) || PreAdviceFieldConstants.FIELD_SUMMARY_TOTAL_UNITS.equals(code) ||
PreAdviceFieldConstants.FIELD_DETAIL_TOTAL_UNITS.equals(code) || PreAdviceFieldConstants.FIELD_DETAIL_VOLUME.equals(code) || PreAdviceFieldConstants.FIELD_DETAIL_WEIGHT.equals(code)
|| PreAdviceFieldConstants.FIELD_DETAIL_PACKING.equals(code) || PreAdviceFieldConstants.FIELD_DETAIL_SIZE.equals(code)) {
result = "right";
}
return result;
}
// private List args = new ArrayList();
public PreAdvicePageHTMLBuilder(DataPacket dp, String state, String userId, String custCode, SessionContext sc) throws Exception {
super(dp, state, sc);
this.template = PreAdviceTemplate.getInstance(userId, custCode);
}
public PreAdvicePageHTMLBuilder(JSPHelper hp, String state, String userId, String custCode, SessionContext sc) throws Exception {
super(hp, state, sc);
this.template = PreAdviceTemplate.getInstance(userId, custCode);
}
public PreAdvicePageHTMLBuilder(DataPacket dp, String state, SessionContext sc) {
super(dp, state, sc);
}
public PreAdvicePageHTMLBuilder(JSPHelper hp, String state, SessionContext sc) {
super(hp, state, sc);
}
public PreAdvicePageHTMLBuilder(DataPacket dp, String state, String userId, String custCode) throws Exception {
super(dp, state);
this.template = PreAdviceTemplate.getInstance(userId, custCode);
}
public PreAdvicePageHTMLBuilder(JSPHelper hp, String state, String userId, String custCode) throws Exception {
super(hp, state);
this.template = PreAdviceTemplate.getInstance(userId, custCode);
}
public PreAdvicePageHTMLBuilder(DataPacket dp, String state) {
super(dp, state);
}
public PreAdvicePageHTMLBuilder(JSPHelper hp, String state) {
super(hp, state);
}
private class BizTypeGroupVisitor extends PrePostAdviceGroupVisitor {
public BizTypeGroupVisitor(String index) {
super(index);
}
public StringBuffer after() {
StringBuffer content = super.after();
content.append("<!-- BizTypeGroupVisitor.after: begin -->\n");
content.append("<!-- BizTypeGroupVisitor.after: end -->\n");
content.append(" ");
return content;
}
public StringBuffer before() throws ServiceException {
StringBuffer content = super.before();
content.append("<!-- BizTypeGroupVisitor.before: begin -->\n");
content.append("<!-- BizTypeGroupVisitor.before: end -->\n");
content.append(" ");
return content;
}
}
private class TypeOfMovementGroupVisitor extends PrePostAdviceGroupVisitor {
public TypeOfMovementGroupVisitor(String index) {
super(index);
}
public StringBuffer after() {
StringBuffer content = super.after();
content.append("<!-- TypeOfMovementGroupVisitor.after: begin -->\n");
content.append("<!-- TypeOfMovementGroupVisitor.after: end -->\n");
content.append(" ");
return content;
}
public StringBuffer before() throws ServiceException {
StringBuffer content = super.before();
content.append("<!-- TypeOfMovementGroupVisitor.before: begin -->\n");
content.append("<!-- TypeOfMovementGroupVisitor.before: end -->\n");
content.append(" ");
return content;
}
}
private class ForwarderGroupVisitor extends PrePostAdviceGroupVisitor {
public ForwarderGroupVisitor(String index) {
super(index);
}
public StringBuffer after() {
StringBuffer content = super.after();
content.append("<!-- ForwarderGroupVisitor.after: begin -->\n");
content.append("<!-- ForwarderGroupVisitor.after: end -->\n");
content.append(" ");
return content;
}
public StringBuffer before() throws ServiceException {
StringBuffer content = super.before();
content.append("<!-- ForwarderGroupVisitor.before: begin -->\n");
String nodePrefix = "node_list[" + getIndex() + "]";
String infoIndex = hp.getDPNodeStr(nodePrefix + ".info_index");
List args = new ArrayList();
args.add(infoIndex);
String typeOfMovementPrefix = PreAdvicePageConstants.GROUP_PREFIX_TYPE_OF_MOVEMENT + "[" + infoIndex + "]";
String forwarderPrefix = PreAdvicePageConstants.GROUP_PREFIX_FORWARDER + "[" + infoIndex + "]";
String forwarder = hp.getDPNodeStr(forwarderPrefix + ".forwarder");
String showStuffing = hp.getDPNodeStr("show_stuffing");
String isStuff = hp.getDPNodeStr(forwarderPrefix + ".is_stuff");
String typeOfMovement = hp.getDPNodeStr(forwarderPrefix + ".type_of_movement");
String bizType = hp.getDPNodeStr(forwarderPrefix + ".biz_type");
/*
* //for VDL or CRD without showStuffing String typeOfMovement = "";
* String bizType = ""; if
* ("VDL".equals(hp.getDPNodeStr(forwarderPrefix + ".biz_type")) ||
* ("CRD".equals(hp.getDPNodeStr(forwarderPrefix + ".biz_type")) &&
* "fasle".equals(showStuffing))) { typeOfMovement =
* hp.getDPNodeStr(forwarderPrefix + ".type_of_movement"); bizType =
* hp.getDPNodeStr(forwarderPrefix + ".biz_type"); } else if
* ("CRD".equals(hp.getDPNodeStr(forwarderPrefix + ".biz_type")) &&
* "true".endsWith(showStuffing)) { typeOfMovement =
* hp.getDPNodeStr(forwarderPrefix + ".type_of_movement"); bizType =
* hp.getDPNodeStr(forwarderPrefix + ".biz_type"); }
*/
// forwarder route info
content.append("<!-- ForwarderRouteInfo.before: begin -->\n");
content.append(buildRoute(forwarder));
content.append("<!-- ForwarderRouteInfo.before: end -->\n");
content.append("<!-- Container Information : begin -->\n");
boolean readOnly = "VDL".equals(bizType);
readOnly = readOnly || "true".equals(showStuffing);
readOnly = readOnly
// || PreAdviceServiceConstants.PAGE_STATE_READONLY.equals(state)
|| PreAdviceServiceConstants.PAGE_STATE_OLI_VIEW.equals(state) || PreAdviceServiceConstants.PAGE_STATE_OLI_PAGE_IS_SENT.equals(state)
|| PreAdviceServiceConstants.PAGE_STATE_OLI_PAGE_SEND_ONLY.equals(state) || PreAdviceServiceConstants.PAGE_STATE_OLI_PAGE_SEND_ONLY.equals(state)
|| PreAdviceServiceConstants.PAGE_STATE_CUSTOMER_VIEW.equals(state) || PreAdviceServiceConstants.PAGE_STATE_EMAIL_VIEW.equals(state)
|| PreAdviceServiceConstants.PAGE_STATE_OLI_CANCEL.equals(state);
boolean hasException = "true".equals(hp.getDPNodeStr(typeOfMovementPrefix + ".stuffing_exception"));
content.append(" <table border=\"0\" width=\"100%\">\n");
content.append(" <tr>\n");
if (!("CRD".equals(bizType) && "CFS-CY".equals(typeOfMovement) && "true".equals(isStuff)) && !("CFS-CFS".equals(typeOfMovement) && "true".equals(isStuff))) {
for (Iterator it = template.getSection(PreAdviceFieldConstants.SECTION_HEADER).getFields().iterator(); it.hasNext();) {
FieldCustomizeField field = (FieldCustomizeField) it.next();
content.append(" <td class=LABEL_FORM>");
content.append(field.getDispName());
content.append("</td>\n");
// for container size type field
if (PreAdviceFieldConstants.FIELD_HEADER_CONTAINER_SIZE_TYPE.equals(field.getCode())) {
if (readOnly) { // readonly
content.append(" <td class=DISPLAY_FORM valign=\"top\" nowrap>\n");
content.append(hp.getDPNodeStr(forwarderPrefix + ".size_type_memo"));
StringBuffer strEqu = new StringBuffer();
for (int i2 = 0, l2 = hp.getDPListSize(typeOfMovementPrefix + ".proposed_container_list"); i2 < l2; i2++) {
String proposedContainerPrefix = typeOfMovementPrefix + ".proposed_container_list[" + i2 + "]";
String equQty = hp.getDPNodeStr(proposedContainerPrefix + ".qty");
String equSizeAbbr = hp.getDPNodeStr(proposedContainerPrefix + ".equipmentsize.abbr");
String equTypeAbbr = hp.getDPNodeStr(proposedContainerPrefix + ".equipmenttype.abbr");
// String containerPlanNum =
// hp.getDPNodeStr(proposedContainerPrefix +
// ".container_plan");
// strEqu.append((strEqu.length() == 0 ? "" : ",
// ") + ("1".equals(equQty) ? "" : equQty + " x
// ") + equSizeAbbr + " " + equTypeAbbr +
// ("".equals(containerPlanNum) ? "" :
// "container plan: " + containerPlanNum));
if (!(StringHelper.isEmpty(equQty) && StringHelper.isEmpty(equSizeAbbr) && StringHelper.isEmpty(equTypeAbbr))) {
strEqu.append(("1".equals(equQty) ? "" : equQty + " x ") + equSizeAbbr + " " + equTypeAbbr).append(i2 < l2 - 1 ? ", " : "");
}
}
content.append(" ");
content.append(hasException && !PreAdviceServiceConstants.PAGE_STATE_EMAIL_VIEW.equals(state) ? "<img src='/images/exceptions.gif'/>" : "");
content.append(" ");
content.append(hasException && PreAdviceServiceConstants.PAGE_STATE_EMAIL_VIEW.equals(state) ? "<font color='RED'><strong>! </strong></font>" : "");
content.append(" ");
content.append(strEqu.toString());
content.append(" </td>\n");
} else { // not read only
content.append(" <td class=DISPLAY_FORM valign=\"top\">\n");
content.append(hp.getDPNodeStr(forwarderPrefix + ".size_type_memo"));
content.append(" <span id=\"template.container[");
content.append(typeOfMovementPrefix);
content.append("]\" style='display:none'>\n");
content.append(" <input type='checkbox' value=\"\">\n");
content.append(" <input class='DISPLAY_FORM' type='text' size='5' maxlength='5' value=''/> x \n");
content.append(" <select class='DISPLAY_FORM' onchange='javascript:onContainerChange(this)'>\n");
for (int i2 = 0, l2 = hp.getDPListSize(typeOfMovementPrefix + ".container_list"); i2 < l2; i2++) {
String containerPrefix = typeOfMovementPrefix + ".container_list[" + i2 + "]";
String equSizeOid = hp.getDPNodeStr(containerPrefix + ".equipmentsize.id");
String equTypeOid = hp.getDPNodeStr(containerPrefix + ".equipmenttype.id");
String equSizeAbbr = hp.getDPNodeStr(containerPrefix + ".equipmentsize.abbr");
String equTypeAbbr = hp.getDPNodeStr(containerPrefix + ".equipmenttype.abbr");
content.append(" <option value=\"");
content.append(equSizeOid + "," + equTypeOid);
content.append("\">");
content.append(equSizeAbbr + " " + equTypeAbbr);
content.append("</option>\n");
}
if (!"AIR".equals(bizType)) {
content.append(" </select>\n");
content.append(" <input type='hidden' value='false'/> <!-- flag for deleted -->\n");
content.append(" <input type='hidden' value=''/> <!-- typeofmovement -->\n");
content.append(" <input type='hidden' value=''/> <!-- biz type -->\n");
content.append(" <input type='hidden' value=''/> <!-- equipment oid -->\n");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -