【一期物料主数据】1、制作物料批量导入,英文描述赋值

2、定时任务,物料SAP近两年使用量(新)优化
This commit is contained in:
10001392 2024-07-11 09:15:58 +08:00
parent c420b2812c
commit 8548f82c67
3 changed files with 33 additions and 1 deletions

View File

@ -39,6 +39,10 @@ public class MaterialSelfExcelDTO extends BaseImportExcelDTO {
@IgnoreExport
private String materialDesc;
@ApiModelProperty(value = "英文描述")
@IgnoreExport
private String materialDescEn;
@IgnoreExport
private String applyUserCode;

View File

@ -282,6 +282,9 @@ public class MaterialExcelService {
// 20231107大改动制作物料批量导入先保存物料数据流程状态为待提交这样可避免OA处理过久timeout报错而丢失保存物料数据
// 再发起OA流程等OA流程返回信息再更新物料表的oaRowId字段
excelEnt.setProcessState(MaterialProcessStateEnum.WAIT_SUBMIT.getValue());
if (ObjectUtil.isNotEmpty(excelEnt.getMaterialName())) {
excelEnt.setMaterialDescEn(query21MaterialDescEn(excelEnt.getMaterialName().split(" ")[0]));
}
}
//检查图号不能重复
@ -563,4 +566,15 @@ public class MaterialExcelService {
}
return "";
}
private static String query21MaterialDescEn(String cn) {
if (ObjectUtil.isEmpty(cn)) {
return "";
}
ResultVO<MaterialAttrValueI18n21Entity> i18n21EntityResultVO = SpringContextUtils.getBean(MaterialAttrValueService.class).getI18n21(cn);
if (ObjectUtil.isNotEmpty(i18n21EntityResultVO.getData())) {
return i18n21EntityResultVO.getData().getAttrValueEn();
}
return "";
}
}

View File

@ -2846,7 +2846,21 @@ public class MaterialMainService extends ServiceImpl<MaterialMainMapper, Materia
update.setTwoYearsUsage(new BigDecimal(out.get("BDMNG").toString()));
updateList.add(update);
});
materialMainMapper.updateBatchTwoYearsUsage(updateList);
// updateList 太大会超过 mysql 数据包大小默认4M所以每次10000条分批次执行
for (int i = 0; i < (updateList.size() / 10000) + 1; i++) {
int startIdx = i * 10000;
int endIdx = startIdx + 10000;
if (endIdx > updateList.size()) {
endIdx = updateList.size();
}
if (startIdx == updateList.size()) {
break;
}
log.info("" + (i + 1) + "次循环,区间:" + startIdx + "," + endIdx);
List<MaterialMainEntity> subList = updateList.subList(startIdx, endIdx);
materialMainMapper.updateBatchTwoYearsUsage(subList);
}
}
} catch (Exception e) {
log.error("【ZRFC_MM_003】异常{}", e.getMessage());