采购订单、采购需求物料分类改为基础资料F7
This commit is contained in:
parent
7057e05c1f
commit
29bb5b0644
|
@ -283,7 +283,7 @@ public class ContractMaterialImportPlugin extends AbstractFormPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
String name = (String) map.get("qeug_materialnames"); // 物料单位
|
String name = (String) map.get("qeug_materialnames"); // 物料单位
|
||||||
String model = (String) map.get("qeug_importmodel"); // 物料单位
|
String model = (String) map.get("qeug_importmodel"); // 物料规格
|
||||||
|
|
||||||
// 校验物料编码是否已经存在于当前页面的表格中
|
// 校验物料编码是否已经存在于当前页面的表格中
|
||||||
if (existComb.contains(name.trim()+model.trim())) {
|
if (existComb.contains(name.trim()+model.trim())) {
|
||||||
|
|
|
@ -36,9 +36,20 @@ public class MaterialSaveCarryNumberPlugin extends AbstractBillPlugIn implements
|
||||||
public void registerListener(EventObject e) {
|
public void registerListener(EventObject e) {
|
||||||
super.registerListener(e);
|
super.registerListener(e);
|
||||||
this.addItemClickListeners("tbmain");
|
this.addItemClickListeners("tbmain");
|
||||||
//监听分录物料F7
|
String name = this.getModel().getDataEntityType().getName();
|
||||||
|
if (StringUtils.equals(name,"recon_contractbill")){
|
||||||
|
//监听分录物料F7-合同非定额物料
|
||||||
BasedataEdit bEdit = this.getView().getControl("qeug_material");
|
BasedataEdit bEdit = this.getView().getControl("qeug_material");
|
||||||
bEdit.addAfterF7SelectListener(this);
|
bEdit.addAfterF7SelectListener(this);
|
||||||
|
}else if (StringUtils.equals(name,"repe_orderform")){
|
||||||
|
//监听分录物料F7-采购订单物料
|
||||||
|
BasedataEdit bEdit = this.getView().getControl("material");
|
||||||
|
bEdit.addAfterF7SelectListener(this);
|
||||||
|
}else if (StringUtils.equals(name,"recon_settleplanbill")){
|
||||||
|
//监听分录物料F7-采购订单物料
|
||||||
|
BasedataEdit bEdit = this.getView().getControl("qeug_materialmasterid");
|
||||||
|
bEdit.addAfterF7SelectListener(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -157,14 +157,15 @@ public class SettlePlanMaterialImportPlugin extends AbstractFormPlugin implement
|
||||||
}
|
}
|
||||||
|
|
||||||
materialList.clear();
|
materialList.clear();
|
||||||
Set<String> existCodes = new HashSet<>();
|
Set<String> existComb = new HashSet<>();
|
||||||
|
|
||||||
// 获取已存在的物料编码
|
// 获取已存在的物料编码
|
||||||
DynamicObjectCollection orderFormEntry = (DynamicObjectCollection) this.getModel().getValue("qeug_cgxqentry");
|
DynamicObjectCollection orderFormEntry = (DynamicObjectCollection) this.getModel().getValue("qeug_cgxqentry");
|
||||||
if (orderFormEntry != null && !orderFormEntry.isEmpty()) {
|
if (orderFormEntry != null && !orderFormEntry.isEmpty()) {
|
||||||
for (DynamicObject dynamicObject : orderFormEntry) {
|
for (DynamicObject dynamicObject : orderFormEntry) {
|
||||||
String number = dynamicObject.getString("qeug_materialmasterid.number");
|
String name = dynamicObject.getString("qeug_materialname");
|
||||||
existCodes.add(number);
|
String model = dynamicObject.getString("qeug_importmodel");
|
||||||
|
existComb.add(name.trim()+model.trim());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,12 +202,14 @@ public class SettlePlanMaterialImportPlugin extends AbstractFormPlugin implement
|
||||||
importMaterial.setMaterialNumber(material.getString("number"));
|
importMaterial.setMaterialNumber(material.getString("number"));
|
||||||
}
|
}
|
||||||
//物料类型校验
|
//物料类型校验
|
||||||
String impMaterialType = (String) map.get("qeug_importmaterialtype");
|
String typeName="待分类";
|
||||||
if (!validMaterialTypes.contains(impMaterialType)) {
|
JSONObject materialType = (JSONObject) map.get("qeug_materialtypeid");//物料分类
|
||||||
map.replace("qeug_importmaterialtype", "待分类");
|
if (materialType!=null && validMaterialTypes.contains(materialType.getString("name"))){
|
||||||
|
typeName = materialType.getString("name");
|
||||||
|
|
||||||
}
|
}
|
||||||
importMaterial.setMaterialName((String) map.get("qeug_materialname"));
|
importMaterial.setMaterialName((String) map.get("qeug_materialname"));
|
||||||
importMaterial.setMaterialType((String) map.get("qeug_importmaterialtype"));
|
importMaterial.setMaterialType(typeName);
|
||||||
importMaterial.setMaterialModel((String) map.get("qeug_importmodel"));
|
importMaterial.setMaterialModel((String) map.get("qeug_importmodel"));
|
||||||
importMaterial.setMaterialUnit((String) map.get("qeug_importunit"));
|
importMaterial.setMaterialUnit((String) map.get("qeug_importunit"));
|
||||||
importMaterial.setMaterialBrand((String) map.get("qeug_brand"));
|
importMaterial.setMaterialBrand((String) map.get("qeug_brand"));
|
||||||
|
@ -224,7 +227,7 @@ public class SettlePlanMaterialImportPlugin extends AbstractFormPlugin implement
|
||||||
}
|
}
|
||||||
|
|
||||||
// 进行校验
|
// 进行校验
|
||||||
Map<Integer, String> indexVsMsgMap = validateEntry(entryEntityImportDataList, existCodes);
|
Map<Integer, String> indexVsMsgMap = validateEntry(entryEntityImportDataList, existComb);
|
||||||
Set<Integer> indexSet = indexVsMsgMap.keySet();
|
Set<Integer> indexSet = indexVsMsgMap.keySet();
|
||||||
Map<String, List<Object>> logMap = e.getEntryDataMap();
|
Map<String, List<Object>> logMap = e.getEntryDataMap();
|
||||||
ImportLogger importLogger = (ImportLogger) logMap.get(entryName).get(0);
|
ImportLogger importLogger = (ImportLogger) logMap.get(entryName).get(0);
|
||||||
|
@ -256,12 +259,11 @@ public class SettlePlanMaterialImportPlugin extends AbstractFormPlugin implement
|
||||||
/**
|
/**
|
||||||
* 校验物料名称、物料单位
|
* 校验物料名称、物料单位
|
||||||
* @param entryDataList
|
* @param entryDataList
|
||||||
* @param existingMaterialCodes
|
* @param existComb
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private Map<Integer, String> validateEntry(List<ImportEntryData> entryDataList,Set<String> existingMaterialCodes) {
|
private Map<Integer, String> validateEntry(List<ImportEntryData> entryDataList,Set<String> existComb) {
|
||||||
Map<Integer, String> indexVsMsgMap = new HashMap<>();
|
Map<Integer, String> indexVsMsgMap = new HashMap<>();
|
||||||
// Set<String> encounteredMaterialCodes = new HashSet<>(); // 用于记录当前批次中的物料编码
|
|
||||||
|
|
||||||
for (int i = 0; i < entryDataList.size(); i++) {
|
for (int i = 0; i < entryDataList.size(); i++) {
|
||||||
ImportEntryData entryData = entryDataList.get(i);
|
ImportEntryData entryData = entryDataList.get(i);
|
||||||
|
@ -269,33 +271,23 @@ public class SettlePlanMaterialImportPlugin extends AbstractFormPlugin implement
|
||||||
// 获取当前行的 JSONObject 数据
|
// 获取当前行的 JSONObject 数据
|
||||||
JSONObject data = entryData.getData();
|
JSONObject data = entryData.getData();
|
||||||
Map<String, Object> map = data.toJavaObject(Map.class);
|
Map<String, Object> map = data.toJavaObject(Map.class);
|
||||||
//JSONObject material = (JSONObject) map.get("qeug_materialmasterid");
|
|
||||||
|
|
||||||
// 获取物料编码和物料单位
|
|
||||||
//String materialCode = material.getString("number"); // 物料编码
|
|
||||||
String materialUnit = (String) map.get("qeug_importunit"); // 物料单位
|
String materialUnit = (String) map.get("qeug_importunit"); // 物料单位
|
||||||
// 获取当前行号
|
// 获取当前行号
|
||||||
Integer rowNum = (Integer) entryData.getData().get("rowNum");
|
Integer rowNum = (Integer) entryData.getData().get("rowNum");
|
||||||
|
|
||||||
// 校验物料编码和物料单位
|
|
||||||
// if (materialCode == null || materialCode.trim().isEmpty()) {
|
|
||||||
// indexVsMsgMap.put(rowNum, "第" + (i + 1) + "行:物料编码不能为空或空字符串");
|
|
||||||
// }
|
|
||||||
if (materialUnit == null || materialUnit.trim().isEmpty()) {
|
if (materialUnit == null || materialUnit.trim().isEmpty()) {
|
||||||
indexVsMsgMap.put(rowNum, "第" + (i + 1) + "行:物料单位不能为空或空字符串");
|
indexVsMsgMap.put(rowNum, "第" + (i + 1) + "行:物料单位不能为空或空字符串");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 校验物料编码是否重复
|
String name = (String) map.get("qeug_materialname"); // 物料名称
|
||||||
// if (encounteredMaterialCodes.contains(materialCode)) {
|
String model = (String) map.get("qeug_importmodel"); // 物料规格
|
||||||
// indexVsMsgMap.put(rowNum, "第" + (i + 1) + "行:物料编码重复");
|
|
||||||
// } else {
|
// 校验物料编码是否已经存在于当前页面的表格中
|
||||||
// encounteredMaterialCodes.add(materialCode);
|
if (existComb.contains(name.trim()+model.trim())) {
|
||||||
// }
|
indexVsMsgMap.put(rowNum, "第" + (i + 1) + "行:物料+规格已存在,请勿重复导入");
|
||||||
//
|
}
|
||||||
// // 校验物料编码是否已经存在于当前页面的表格中
|
|
||||||
// if (existingMaterialCodes.contains(materialCode)) {
|
|
||||||
// indexVsMsgMap.put(rowNum, "第" + (i + 1) + "行:物料编码已存在,不能重复");
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return indexVsMsgMap;
|
return indexVsMsgMap;
|
||||||
|
|
|
@ -159,14 +159,15 @@ public class OrderFormMaterialImportPlugin extends AbstractFormPlugin implements
|
||||||
}
|
}
|
||||||
|
|
||||||
materialList.clear();
|
materialList.clear();
|
||||||
Set<String> existCodes = new HashSet<>();
|
Set<String> existComb = new HashSet<>();
|
||||||
|
|
||||||
// 获取已存在的物料编码
|
// 获取已存在的物料编码
|
||||||
DynamicObjectCollection orderFormEntry = (DynamicObjectCollection) this.getModel().getValue("orderformentry");
|
DynamicObjectCollection orderFormEntry = (DynamicObjectCollection) this.getModel().getValue("orderformentry");
|
||||||
if (orderFormEntry != null && !orderFormEntry.isEmpty()) {
|
if (orderFormEntry != null && !orderFormEntry.isEmpty()) {
|
||||||
for (DynamicObject dynamicObject : orderFormEntry) {
|
for (DynamicObject dynamicObject : orderFormEntry) {
|
||||||
String number = dynamicObject.getString("material.number");
|
String name = dynamicObject.getString("qeug_materialnames");
|
||||||
existCodes.add(number);
|
String model = dynamicObject.getString("qeug_importmodel");
|
||||||
|
existComb.add(name.trim()+model.trim());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -203,12 +204,14 @@ public class OrderFormMaterialImportPlugin extends AbstractFormPlugin implements
|
||||||
importMaterial.setMaterialNumber(material.getString("number"));
|
importMaterial.setMaterialNumber(material.getString("number"));
|
||||||
}
|
}
|
||||||
//物料类型校验
|
//物料类型校验
|
||||||
String impMaterialType = (String) map.get("qeug_importmaterialtype");
|
String typeName="待分类";
|
||||||
if (!validMaterialTypes.contains(impMaterialType)) {
|
JSONObject materialType = (JSONObject) map.get("qeug_materialtypeid");//物料分类
|
||||||
map.replace("qeug_importmaterialtype", "待分类");
|
if (materialType!=null && validMaterialTypes.contains(materialType.getString("name"))){
|
||||||
|
typeName = materialType.getString("name");
|
||||||
|
|
||||||
}
|
}
|
||||||
importMaterial.setMaterialName((String) map.get("qeug_materialnames"));
|
importMaterial.setMaterialName((String) map.get("qeug_materialnames"));
|
||||||
importMaterial.setMaterialType((String) map.get("qeug_importmaterialtype"));
|
importMaterial.setMaterialType(typeName);
|
||||||
importMaterial.setMaterialModel((String) map.get("qeug_importmodel"));
|
importMaterial.setMaterialModel((String) map.get("qeug_importmodel"));
|
||||||
importMaterial.setMaterialUnit((String) map.get("qeug_importunit"));
|
importMaterial.setMaterialUnit((String) map.get("qeug_importunit"));
|
||||||
importMaterial.setMaterialBrand((String) map.get("qeug_brand"));
|
importMaterial.setMaterialBrand((String) map.get("qeug_brand"));
|
||||||
|
@ -226,7 +229,7 @@ public class OrderFormMaterialImportPlugin extends AbstractFormPlugin implements
|
||||||
}
|
}
|
||||||
|
|
||||||
// 进行校验
|
// 进行校验
|
||||||
Map<Integer, String> indexVsMsgMap = validateEntry(entryEntityImportDataList, existCodes);
|
Map<Integer, String> indexVsMsgMap = validateEntry(entryEntityImportDataList, existComb);
|
||||||
Set<Integer> indexSet = indexVsMsgMap.keySet();
|
Set<Integer> indexSet = indexVsMsgMap.keySet();
|
||||||
Map<String, List<Object>> logMap = e.getEntryDataMap();
|
Map<String, List<Object>> logMap = e.getEntryDataMap();
|
||||||
ImportLogger importLogger = (ImportLogger) logMap.get(entryName).get(0);
|
ImportLogger importLogger = (ImportLogger) logMap.get(entryName).get(0);
|
||||||
|
@ -258,10 +261,10 @@ public class OrderFormMaterialImportPlugin extends AbstractFormPlugin implements
|
||||||
/**
|
/**
|
||||||
* 校验物料名称、物料单位
|
* 校验物料名称、物料单位
|
||||||
* @param entryDataList
|
* @param entryDataList
|
||||||
* @param existingMaterialCodes
|
* @param existComb
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private Map<Integer, String> validateEntry(List<ImportEntryData> entryDataList,Set<String> existingMaterialCodes) {
|
private Map<Integer, String> validateEntry(List<ImportEntryData> entryDataList,Set<String> existComb) {
|
||||||
Map<Integer, String> indexVsMsgMap = new HashMap<>();
|
Map<Integer, String> indexVsMsgMap = new HashMap<>();
|
||||||
|
|
||||||
for (int i = 0; i < entryDataList.size(); i++) {
|
for (int i = 0; i < entryDataList.size(); i++) {
|
||||||
|
@ -278,6 +281,13 @@ public class OrderFormMaterialImportPlugin extends AbstractFormPlugin implements
|
||||||
if (materialUnit == null || materialUnit.trim().isEmpty()) {
|
if (materialUnit == null || materialUnit.trim().isEmpty()) {
|
||||||
indexVsMsgMap.put(rowNum, "第" + (i + 1) + "行:物料单位不能为空或空字符串");
|
indexVsMsgMap.put(rowNum, "第" + (i + 1) + "行:物料单位不能为空或空字符串");
|
||||||
}
|
}
|
||||||
|
String name = (String) map.get("qeug_materialnames"); // 物料名称
|
||||||
|
String model = (String) map.get("qeug_importmodel"); // 物料规格
|
||||||
|
|
||||||
|
// 校验物料编码是否已经存在于当前页面的表格中
|
||||||
|
if (existComb.contains(name.trim()+model.trim())) {
|
||||||
|
indexVsMsgMap.put(rowNum, "第" + (i + 1) + "行:物料+规格已存在,请勿重复导入");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return indexVsMsgMap;
|
return indexVsMsgMap;
|
||||||
|
|
Loading…
Reference in New Issue