物料参照源码

This commit is contained in:
lj 2025-03-05 15:16:28 +08:00
parent 669eb4618b
commit f6270650fc
1 changed files with 257 additions and 0 deletions

View File

@ -0,0 +1,257 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package nc.ui.bd.ref.model;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Vector;
import nc.bs.framework.common.NCLocator;
import nc.bs.logging.Logger;
import nc.bs.sec.esapi.NCESAPI;
import nc.itf.bd.material.assign.IMaterialAssignService;
import nc.itf.uap.bd.ref.IAssignDataShowRefModel;
import nc.ui.bd.ref.AbstractRefGridTreeBigDataModel;
import nc.ui.bd.ref.IRefDocEdit;
import nc.ui.bd.ref.IRefMaintenanceHandler;
import nc.ui.bd.ref.RefSearchFieldSetting;
import nc.ui.pub.beans.ValueChangedEvent;
import nc.vo.bd.material.MaterialVersionVO;
import nc.vo.bd.material.marbasclass.MarBasClassSysParaUtil;
import nc.vo.bd.material.marbasclass.MarBasClassVO;
import nc.vo.bd.material.measdoc.MeasdocVO;
import nc.vo.ml.NCLangRes4VoTransl;
import nc.vo.org.OrgVO;
import nc.vo.pfxx.util.ArrayUtils;
import nc.vo.pub.BusinessException;
import nc.vo.util.BDVisibleUtil;
import nc.vo.util.SqlWhereUtil;
import nc.vo.util.VisibleUtil;
public class MaterialDefaultRefModel extends AbstractRefGridTreeBigDataModel implements IAssignDataShowRefModel {
private boolean isShowAssginDataChk = false;
private boolean isShowDisableData = false;
private boolean isAssginShowData = false;
private IMaterialAssignService assignService = null;
private Map<String, String> assginSqlMap = new HashMap();
private UserDefRefShow userDefRefShow = UserDefRefShowUtil.getInstance().getUserDefRefShow("c7dc0ccd-8872-4eee-8882-160e8f49dfad");
public MaterialDefaultRefModel() {
this.reset();
}
public void filterValueChanged(ValueChangedEvent changedValue) {
super.filterValueChanged(changedValue);
String[] pk_orgs = (String[])changedValue.getNewValue();
if (ArrayUtils.isNotEmpty(pk_orgs)) {
this.setPk_org(pk_orgs[0]);
}
}
public String getClassWherePart() {
SqlWhereUtil sw = new SqlWhereUtil(super.getClassWherePart());
try {
sw.and(VisibleUtil.getRefVisibleCondition(this.getPk_group(), this.getPk_org(), "c099f7d7-52a9-4b98-bee7-2e3a6c3ea263"));
if (this.isDisabledDataShow()) {
sw.and("enablestate in (2,3) ");
} else {
sw.and("enablestate = 2");
}
return sw.getSQLWhere();
} catch (BusinessException e) {
Logger.error(e.getMessage());
return " 1=2 ";
}
}
public String getCodingRule() {
String codeRule = null;
try {
codeRule = MarBasClassSysParaUtil.getCodeRuleSysPara(this.getPk_group(), this.getPk_org());
} catch (BusinessException e) {
Logger.error(e.getMessage(), e);
}
return codeRule;
}
public void reset() {
this.setRefNodeName("物料");
this.setRootName(NCLangRes4VoTransl.getNCLangRes().getStrByID("10140mclg", "110140mclg0002"));
this.setClassFieldCode(new String[]{"code", "name", "pk_marbasclass", "pk_org"});
this.setClassJoinField("pk_marbasclass");
this.setClassTableName(MarBasClassVO.getDefaultTableName());
this.setClassDefaultFieldCount(2);
this.setClassDataPower(true);
this.setClassWherePart("1 = 1");
this.setFieldCode(new String[]{"pk_org", "code", "name", "materialspec", "materialtype", "materialshortname", "materialmnecode", "graphid", "pk_measdoc"});
String[] fieldNames = new String[]{NCLangRes4VoTransl.getNCLangRes().getStrByID("common", "2UC000-000360"), NCLangRes4VoTransl.getNCLangRes().getStrByID("common", "UC000-0002911"), NCLangRes4VoTransl.getNCLangRes().getStrByID("common", "UC000-0002908"), NCLangRes4VoTransl.getNCLangRes().getStrByID("common", "UC000-0003448"), NCLangRes4VoTransl.getNCLangRes().getStrByID("common", "UC000-0001240"), NCLangRes4VoTransl.getNCLangRes().getStrByID("10140mag", "2materia-000017"), NCLangRes4VoTransl.getNCLangRes().getStrByID("common", "UC000-0000703"), NCLangRes4VoTransl.getNCLangRes().getStrByID("common", "UC000-0001223"), NCLangRes4VoTransl.getNCLangRes().getStrByID("common", "2UC000-000031")};
this.setFieldName(fieldNames);
String orgFomula = "getMLCValue(\"" + OrgVO.getDefaultTableName() + "\",\"" + "name" + "\",\"" + "pk_org" + "\"," + "pk_org" + ")";
String mesFomula = "getMLCValue(\"" + MeasdocVO.getDefaultTableName() + "\",\"" + "name" + "\",\"" + "pk_measdoc" + "\"," + "pk_measdoc" + ")";
this.setFormulas(new String[][]{{"pk_org", orgFomula}, {"pk_measdoc", mesFomula}});
this.setDefaultFieldCount(7);
this.setHiddenFieldCode(new String[]{"pk_material", "pk_source", "pk_marbasclass"});
this.setTableName(MaterialVersionVO.getDefaultTableName());
this.setPkFieldCode("pk_source");
this.setDocJoinField("pk_marbasclass");
this.setRefCodeField("code");
this.setRefNameField("name");
this.setMnecode(new String[]{"materialmnecode"});
this.setAddEnableStateWherePart(true);
this.setOrderPart("code");
this.setResourceID("material_v");
this.setClassResouceID("materialbasclass");
this.setRefMaintenanceHandler(new IRefMaintenanceHandler() {
public String[] getFucCodes() {
return new String[]{"10140MAG", "10140MAO"};
}
public IRefDocEdit getRefDocEdit() {
return null;
}
});
this.setCommonDataTableName(MaterialVersionVO.getDefaultTableName());
this.setFilterRefNodeName(new String[]{"业务单元"});
this.userDefRefShow.addUserDefItemFields(this);
this.resetFieldName();
this.assginSqlMap.clear();
Map<String, String> allFields = new LinkedHashMap();
allFields.put("pk_org", fieldNames[0]);
allFields.put("code", fieldNames[1]);
allFields.put("name", fieldNames[2]);
allFields.put("materialspec", fieldNames[3]);
allFields.put("materialtype", fieldNames[4]);
allFields.put("materialshortname", fieldNames[5]);
allFields.put("materialmnecode", fieldNames[6]);
allFields.put("graphid", fieldNames[7]);
String[] defaultSearchFields = new String[]{"code", "name"};
RefSearchFieldSetting setting = new RefSearchFieldSetting(this.getRefNodeName(), allFields, defaultSearchFields);
this.setSearchFieldSetting(setting);
}
// public void reset() {
// this.setRefNodeName("物料");
// this.setRootName(NCLangRes4VoTransl.getNCLangRes().getStrByID("10140mclg", "110140mclg0002"));
// this.setClassFieldCode(new String[]{"code", "name", "pk_marbasclass", "pk_org"});
// this.setClassJoinField("pk_marbasclass");
// this.setClassTableName(MarBasClassVO.getDefaultTableName());
// this.setClassDefaultFieldCount(2);
// this.setClassDataPower(true);
// this.setClassWherePart("1 = 1");
// this.setFieldCode(new String[]{"pk_org", "code", "name", "materialspec", "materialtype", "materialshortname", "materialmnecode", "graphid", "pk_measdoc"
//// , "memo"
// });
// String[] fieldNames = new String[]{NCLangRes4VoTransl.getNCLangRes().getStrByID("common", "2UC000-000360"),
// NCLangRes4VoTransl.getNCLangRes().getStrByID("common", "UC000-0002911"),
// NCLangRes4VoTransl.getNCLangRes().getStrByID("common", "UC000-0002908"),
// NCLangRes4VoTransl.getNCLangRes().getStrByID("common", "UC000-0003448"),
// NCLangRes4VoTransl.getNCLangRes().getStrByID("common", "UC000-0001240"),
// NCLangRes4VoTransl.getNCLangRes().getStrByID("10140mag", "2materia-000017"),
// NCLangRes4VoTransl.getNCLangRes().getStrByID("common", "UC000-0000703"),
// NCLangRes4VoTransl.getNCLangRes().getStrByID("common", "UC000-0001223"),
// NCLangRes4VoTransl.getNCLangRes().getStrByID("common", "2UC000-000031")
//// ,NCLangRes4VoTransl.getNCLangRes().getStrByID("common", "2UC000-000258")
// };
// this.setFieldName(fieldNames);
// String orgFomula = "getMLCValue(\"" + OrgVO.getDefaultTableName() + "\",\"" + "name" + "\",\"" + "pk_org" + "\"," + "pk_org" + ")";
// String mesFomula = "getMLCValue(\"" + MeasdocVO.getDefaultTableName() + "\",\"" + "name" + "\",\"" + "pk_measdoc" + "\"," + "pk_measdoc" + ")";
// this.setFormulas(new String[][]{{"pk_org", orgFomula}, {"pk_measdoc", mesFomula}});
// this.setDefaultFieldCount(7);
// this.setHiddenFieldCode(new String[]{"pk_material", "pk_source", "pk_marbasclass"});
// this.setTableName(MaterialVersionVO.getDefaultTableName());
// this.setPkFieldCode("pk_source");
// this.setDocJoinField("pk_marbasclass");
// this.setRefCodeField("code");
// this.setRefNameField("name");
// this.setMnecode(new String[]{"materialmnecode"});
// this.setAddEnableStateWherePart(true);
// this.setOrderPart("code");
// this.setResourceID("material_v");
// this.setClassResouceID("materialbasclass");
// this.setRefMaintenanceHandler(new IRefMaintenanceHandler() {
// public String[] getFucCodes() {
// return new String[]{"10140MAG", "10140MAO"};
// }
//
// public IRefDocEdit getRefDocEdit() {
// return null;
// }
// });
// this.setCommonDataTableName(MaterialVersionVO.getDefaultTableName());
// this.setFilterRefNodeName(new String[]{"业务单元"});
// this.userDefRefShow.addUserDefItemFields(this);
// this.resetFieldName();
// this.assginSqlMap.clear();
// Map<String, String> allFields = new LinkedHashMap();
// allFields.put("pk_org", fieldNames[0]);
// allFields.put("code", fieldNames[1]);
// allFields.put("name", fieldNames[2]);
// allFields.put("materialspec", fieldNames[3]);
// allFields.put("materialtype", fieldNames[4]);
// allFields.put("materialshortname", fieldNames[5]);
// allFields.put("materialmnecode", fieldNames[6]);
// allFields.put("graphid", fieldNames[7]);
//// allFields.put("memo", fieldNames[8]);
// String[] defaultSearchFields = new String[]{"code", "name"};
// RefSearchFieldSetting setting = new RefSearchFieldSetting(this.getRefNodeName(), allFields, defaultSearchFields);
// this.setSearchFieldSetting(setting);
// }
public Vector getData() {
Vector<Vector> v = super.getData();
this.userDefRefShow.proessorData(v);
return v;
}
protected String getEnvWherePart() {
SqlWhereUtil sw = new SqlWhereUtil();
try {
sw.and(BDVisibleUtil.getRefVisibleCondition(NCESAPI.clientSqlEncode(this.getPk_group()), NCESAPI.clientSqlEncode(this.getPk_org()), "c7dc0ccd-8872-4eee-8882-160e8f49dfad", this.isShowDisableData()));
} catch (BusinessException e) {
Logger.error(e.getMessage());
}
return sw.getSQLWhere();
}
public boolean isAssginShowData() {
return this.isAssginShowData;
}
public void setAssginShowData(boolean isAssginShowData) {
this.isAssginShowData = isAssginShowData;
}
private IMaterialAssignService getAssignService() {
if (this.assignService == null) {
this.assignService = (IMaterialAssignService)NCLocator.getInstance().lookup(IMaterialAssignService.class);
}
return this.assignService;
}
public boolean isShowAssginDataChk() {
return this.isShowAssginDataChk;
}
public void setShowAssginDataChk(boolean isShowAssginDataChk) {
this.isShowAssginDataChk = isShowAssginDataChk;
}
public void setShowDisableData(boolean isShowDisableData) {
this.isShowDisableData = isShowDisableData;
}
public boolean isShowDisableData() {
return this.isShowDisableData;
}
}