Commit c73ae9be by liuyang

2024-05-08 优化工序单价导入提示显示

parent f6546259
......@@ -174,6 +174,7 @@ public class ServiceHGSJ003 extends ServiceEPBase {
@OperationLogAnnotation(operModul = "工艺单价",operType = "导入",operDesc = "导入操作")
public EiInfo importDate(EiInfo inInfo) {
try {
Map<String, Object> params = new HashMap<>(10);
String fileName = inInfo.getString("fileName");
Map<String,Object> map = HGSJTools.Hgsj003.getCompany(UserSession.getLoginName(),OrgTypeEnum.COMPANY.getCode());
......@@ -181,7 +182,12 @@ public class ServiceHGSJ003 extends ServiceEPBase {
params.put(HGSJ003.FIELD_FACTORY_CODE, map.get("orgEname"));
params.put(HGSJ003.FIELD_FACTORY_NAME, map.get("orgCname"));
//解析文件,将文件中数据传入到inInfo中
return ExcelUtils.importFromExcel(inInfo, fileName, params, new HGSJ003());
ExcelUtils.importFromExcel(inInfo, fileName, params, new HGSJ003());
}catch (Exception e){
inInfo.setStatus(EiConstant.STATUS_FAILURE);
LogUtils.setDetailMsg(inInfo, e, "导入失败");
}
return inInfo;
}
@OperationLogAnnotation(operModul = "工艺单价",operType = "下载模板",operDesc = "下载模板")
......@@ -194,7 +200,7 @@ public class ServiceHGSJ003 extends ServiceEPBase {
param.put("loginName",UserSession.getLoginName());
param.put(HGSJ003.FIELD_ACCOUNT_CODE,UserSessionUtils.getAccountCode());
List list = new ArrayList<>(Arrays.asList(HGSJ003.FIELD_PROCESS_CODE,HGSJ003.FIELD_PROCESS_NAME,HGSJ003.FIELD_PROCESS_CLASS,
List list = new ArrayList<>(Arrays.asList(HGSJ003.FIELD_PROCESS_CODE,HGSJ003.FIELD_PROCESS_NAME,HGSJ003.FIELD_PROCESS_CLASS_NAME,
HGSJ003.FIELD_UNIT,HGSJ003.FIELD_LENGTH,HGSJ003.FIELD_WIDTH,HGSJ003.FIELD_THICK));
return ExcelUtils.exportToExcel(ACConstants.SQL_COUNT, ACConstants.SQL_TEMPLATE, param, list, new HGSJ003());
......
......@@ -173,7 +173,7 @@ public class ExcelUtils {
String className = insertSql.substring(0,7);
List<Map> arrayList = inInfo.getBlock(SQL_OK_BLOCK).getRows();
// 数据校验
switch (className){
switch (className) {
/**
* 物料
*/
......@@ -193,7 +193,7 @@ public class ExcelUtils {
// checkTreeNodeLeaf(HPSC002.getParentId());
// }
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("导入成功"+okBlock.getRowCount()+"条");
inInfo.setMsg("导入成功" + okBlock.getRowCount() + "条");
} else {
inInfo.setStatus(EiConstant.STATUS_FAILURE);
}
......@@ -212,7 +212,7 @@ public class ExcelUtils {
// DaoUtils.insert("HPSC006.insert",HPSC006);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("导入成功"+okBlock.getRowCount()+"条");
inInfo.setMsg("导入成功" + okBlock.getRowCount() + "条");
} else {
inInfo.setStatus(EiConstant.STATUS_FAILURE);
}
......@@ -221,8 +221,8 @@ public class ExcelUtils {
HGSJ003 hgsj003 = new HGSJ003();
Map<String, String> mapSmall = HGSJTools.Hgsj003.getSmallCode("hggp.hgsj.processClass");
for (Map<?, ?> map : arrayList) {
String processClass = MapUtils.getString(mapSmall,map.get(HGSJ003.FIELD_PROCESS_CLASS_NAME));
AssertUtils.isEmpty(processClass,String.format("工序分类[%s]代码不存在,添加失败!",map.get(HGSJ003.FIELD_PROCESS_CLASS_NAME)));
String processClass = MapUtils.getString(mapSmall, map.get(HGSJ003.FIELD_PROCESS_CLASS_NAME));
AssertUtils.isEmpty(processClass, String.format("工序分类[%s]代码不存在,添加失败!", map.get(HGSJ003.FIELD_PROCESS_CLASS_NAME)));
hgsj003.fromMap(map);
// 设置规格
if (org.apache.commons.lang3.StringUtils.isBlank(hgsj003.getSpec())) {
......@@ -235,8 +235,9 @@ public class ExcelUtils {
checkAddData(hgsj003);
DaoUtils.insert(HGSJ003.INSERT, hgsj003);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("导入成功"+arrayList.size()+"条");
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("导入成功" + arrayList.size() + "条");
break;
default:
}
......
......@@ -161,7 +161,7 @@ $(function (){
NotificationUtil("请导入xls或xlsx文件", "error");
return;
}
if (ei.status === "-1") {
if (ei.status == "-1") {
NotificationUtil(
{msg: ei.msg, detailMsg: ei.detailMsg}, "error");
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment