|
|
@ -293,7 +293,7 @@ public class MesImportImpl implements IMesImportService {
|
|
|
|
if (rowT == null) {
|
|
|
|
if (rowT == null) {
|
|
|
|
continue; // 如果行为空,跳过
|
|
|
|
continue; // 如果行为空,跳过
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Cell cellT = rowT.getCell(2);
|
|
|
|
Cell cellT = rowT.getCell(0);
|
|
|
|
if (StringUtils.isNull(cellT)) {
|
|
|
|
if (StringUtils.isNull(cellT)) {
|
|
|
|
throw new ServiceException("Excel格式错误!");
|
|
|
|
throw new ServiceException("Excel格式错误!");
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -304,7 +304,7 @@ public class MesImportImpl implements IMesImportService {
|
|
|
|
throw new ServiceException("Excel格式错误:物料编号:" + productBom + "的信息不存在!");
|
|
|
|
throw new ServiceException("Excel格式错误:物料编号:" + productBom + "的信息不存在!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
i = i + 3;//标题下一行
|
|
|
|
i = i + 2;//标题下一行
|
|
|
|
MesRaiseCapitalBom selectBom = new MesRaiseCapitalBom();
|
|
|
|
MesRaiseCapitalBom selectBom = new MesRaiseCapitalBom();
|
|
|
|
selectBom.setMaterialId(productMaterial.getMaterialId());
|
|
|
|
selectBom.setMaterialId(productMaterial.getMaterialId());
|
|
|
|
selectBom.setMaterialBomDesc(productMaterial.getMaterialName());
|
|
|
|
selectBom.setMaterialBomDesc(productMaterial.getMaterialName());
|
|
|
@ -314,13 +314,14 @@ public class MesImportImpl implements IMesImportService {
|
|
|
|
finishedProductNameList.add(productMaterial.getMaterialName());
|
|
|
|
finishedProductNameList.add(productMaterial.getMaterialName());
|
|
|
|
if (productBomList.size() > 0) {
|
|
|
|
if (productBomList.size() > 0) {
|
|
|
|
MesRaiseCapitalBom mesMaterialBom = productBomList.get(0);
|
|
|
|
MesRaiseCapitalBom mesMaterialBom = productBomList.get(0);
|
|
|
|
parentBomId = mesMaterialBom.getRaiseCapitalId();
|
|
|
|
throw new ServiceException(mesMaterialBom.getMaterialName() + "已存在!" + "任务编号:" + mesMaterialBom.getTaskCode());
|
|
|
|
MesRaiseCapitalBom materialBom = new MesRaiseCapitalBom();
|
|
|
|
// parentBomId = mesMaterialBom.getRaiseCapitalId();
|
|
|
|
materialBom.setParentId(mesMaterialBom.getRaiseCapitalId());
|
|
|
|
// MesRaiseCapitalBom materialBom = new MesRaiseCapitalBom();
|
|
|
|
List<MesRaiseCapitalBom> mesMaterialBoms = mesRaiseCapitalBomService.selectMesRaiseCapitalBomList(materialBom);
|
|
|
|
// materialBom.setParentId(mesMaterialBom.getRaiseCapitalId());
|
|
|
|
for (MesRaiseCapitalBom bom : mesMaterialBoms) {
|
|
|
|
// List<MesRaiseCapitalBom> mesMaterialBoms = mesRaiseCapitalBomService.selectMesRaiseCapitalBomList(materialBom);
|
|
|
|
mesRaiseCapitalBomService.deleteMesRaiseCapitalBomByRaiseCapitalId(bom.getRaiseCapitalId());
|
|
|
|
// for (MesRaiseCapitalBom bom : mesMaterialBoms) {
|
|
|
|
}
|
|
|
|
// mesRaiseCapitalBomService.deleteMesRaiseCapitalBomByRaiseCapitalId(bom.getRaiseCapitalId());
|
|
|
|
|
|
|
|
// }
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
MesRaiseCapitalBom materialBom = new MesRaiseCapitalBom();
|
|
|
|
MesRaiseCapitalBom materialBom = new MesRaiseCapitalBom();
|
|
|
|
materialBom.setTaskCode(taskCode);
|
|
|
|
materialBom.setTaskCode(taskCode);
|
|
|
@ -354,6 +355,7 @@ public class MesImportImpl implements IMesImportService {
|
|
|
|
materialCode = materialCodeCell.getStringCellValue();
|
|
|
|
materialCode = materialCodeCell.getStringCellValue();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Cell amountCell = rowC.getCell(5);
|
|
|
|
Cell amountCell = rowC.getCell(5);
|
|
|
|
|
|
|
|
Cell brandCell = rowC.getCell(6);
|
|
|
|
if (StringUtils.isNotEmpty(materialCode)) {
|
|
|
|
if (StringUtils.isNotEmpty(materialCode)) {
|
|
|
|
MesBaseMaterialInfo materialInfo = mesBaseMaterialInfoMapper.selectMesBaseMaterialInfoByMaterialCode(materialCode);
|
|
|
|
MesBaseMaterialInfo materialInfo = mesBaseMaterialInfoMapper.selectMesBaseMaterialInfoByMaterialCode(materialCode);
|
|
|
|
if (StringUtils.isNotNull(materialInfo)) {
|
|
|
|
if (StringUtils.isNotNull(materialInfo)) {
|
|
|
@ -366,6 +368,9 @@ public class MesImportImpl implements IMesImportService {
|
|
|
|
materialBom.setActiveFlag("1");
|
|
|
|
materialBom.setActiveFlag("1");
|
|
|
|
materialBom.setStandardAmount(BigDecimal.valueOf(amountCell.getNumericCellValue()));
|
|
|
|
materialBom.setStandardAmount(BigDecimal.valueOf(amountCell.getNumericCellValue()));
|
|
|
|
materialBom.setErpMaterialId(materialInfo.getErpId());
|
|
|
|
materialBom.setErpMaterialId(materialInfo.getErpId());
|
|
|
|
|
|
|
|
if (brandCell != null){
|
|
|
|
|
|
|
|
materialBom.setBrand(brandCell.getStringCellValue());
|
|
|
|
|
|
|
|
}
|
|
|
|
bomList.add(materialBom);
|
|
|
|
bomList.add(materialBom);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
failureMsg.append("物料编号:").append(materialCode).append("|");
|
|
|
|
failureMsg.append("物料编号:").append(materialCode).append("|");
|
|
|
|