单据明细导入:校验条码是否存在

This commit is contained in:
季圣华
2023-05-14 22:40:59 +08:00
parent be23ba32a7
commit 5baab7fe48
3 changed files with 75 additions and 68 deletions

View File

@@ -414,6 +414,10 @@ public class ExceptionConstants {
//修改单据明细信息失败 //修改单据明细信息失败
public static final int DEPOT_ITEM_EDIT_FAILED_CODE = 9000002; public static final int DEPOT_ITEM_EDIT_FAILED_CODE = 9000002;
public static final String DEPOT_ITEM_EDIT_FAILED_MSG = "修改单据明细信息失败"; public static final String DEPOT_ITEM_EDIT_FAILED_MSG = "修改单据明细信息失败";
//单据明细-明细中商品不存在
public static final int DEPOT_ITEM_BARCODE_IS_NOT_EXIST_CODE = 9000003;
public static final String DEPOT_ITEM_BARCODE_IS_NOT_EXIST_MSG = "抱歉,商品条码:%s在商品管理中不存在";
/** /**
* 财务信息 * 财务信息
* type = 95 * type = 95

View File

@@ -934,6 +934,10 @@ public class DepotItemController {
} }
res.data = map; res.data = map;
} }
} catch (BusinessRunTimeException e) {
res.code = 500;
data.put("message", e.getData().get("message"));
res.data = data;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
message = "导入失败,请检查表格内容"; message = "导入失败,请检查表格内容";

View File

@@ -1116,7 +1116,6 @@ public class DepotItemService {
public JSONObject parseMapByExcelData(String barCodes, List<Map<String, String>> detailList, String prefixNo) { public JSONObject parseMapByExcelData(String barCodes, List<Map<String, String>> detailList, String prefixNo) {
JSONObject map = new JSONObject(); JSONObject map = new JSONObject();
try {
JSONArray arr = new JSONArray(); JSONArray arr = new JSONArray();
List<MaterialVo4Unit> list = depotItemMapperEx.getBillItemByParam(barCodes); List<MaterialVo4Unit> list = depotItemMapperEx.getBillItemByParam(barCodes);
Map<String, MaterialVo4Unit> materialMap = new HashMap<>(); Map<String, MaterialVo4Unit> materialMap = new HashMap<>();
@@ -1179,12 +1178,12 @@ public class DepotItemService {
item.put("taxLastMoney", taxLastMoney); item.put("taxLastMoney", taxLastMoney);
item.put("remark", remark); item.put("remark", remark);
arr.add(item); arr.add(item);
} else {
throw new BusinessRunTimeException(ExceptionConstants.DEPOT_ITEM_BARCODE_IS_NOT_EXIST_CODE,
String.format(ExceptionConstants.DEPOT_ITEM_BARCODE_IS_NOT_EXIST_MSG, barCode));
} }
} }
map.put("rows", arr); map.put("rows", arr);
} catch (Exception e) {
e.printStackTrace();
}
return map; return map;
} }
} }