针对组装单、拆卸单校验是否存在组合件和普通子件
This commit is contained in:
@@ -394,6 +394,10 @@ public class ExceptionConstants {
|
||||
//单据录入-本次欠款金额不能大于关联单据实际的欠款
|
||||
public static final int DEPOT_HEAD_BACK_BILL_DEBT_OVER_CODE = 8500019;
|
||||
public static final String DEPOT_HEAD_BACK_BILL_DEBT_OVER_MSG = "抱歉,本次欠款金额不能大于关联单据实际的欠款";
|
||||
//单据录入-单据明细中必须要有组合件和普通子件
|
||||
public static final int DEPOT_HEAD_CHECK_ASSEMBLE_EMPTY_CODE = 8000020;
|
||||
public static final String DEPOT_HEAD_CHECK_ASSEMBLE_EMPTY_MSG = "抱歉,单据明细中必须要有组合件和普通子件";
|
||||
|
||||
/**
|
||||
* 单据明细信息
|
||||
* type = 90
|
||||
|
||||
@@ -399,6 +399,8 @@ public class DepotItemService {
|
||||
deleteDepotItemHeadId(headerId);
|
||||
JSONArray rowArr = JSONArray.parseArray(rows);
|
||||
if (null != rowArr && rowArr.size()>0) {
|
||||
//针对组装单、拆卸单校验是否存在组合件和普通子件
|
||||
checkAssembleWithMaterialType(rowArr, depotHead.getSubType());
|
||||
for (int i = 0; i < rowArr.size(); i++) {
|
||||
DepotItem depotItem = new DepotItem();
|
||||
JSONObject rowObj = JSONObject.parseObject(rowArr.getString(i));
|
||||
@@ -774,6 +776,30 @@ public class DepotItemService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 针对组装单、拆卸单校验是否存在组合件和普通子件
|
||||
* @param rowArr
|
||||
* @param subType
|
||||
*/
|
||||
public void checkAssembleWithMaterialType(JSONArray rowArr, String subType) {
|
||||
if(BusinessConstants.SUB_TYPE_ASSEMBLE.equals(subType) ||
|
||||
BusinessConstants.SUB_TYPE_DISASSEMBLE.equals(subType)) {
|
||||
if(rowArr.size() > 1) {
|
||||
JSONObject firstRowObj = JSONObject.parseObject(rowArr.getString(0));
|
||||
JSONObject secondRowObj = JSONObject.parseObject(rowArr.getString(1));
|
||||
String firstMaterialType = firstRowObj.getString("mType");
|
||||
String secondMaterialType = secondRowObj.getString("mType");
|
||||
if(!"组合件".equals(firstMaterialType) || !"普通子件".equals(secondMaterialType)) {
|
||||
throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_CHECK_ASSEMBLE_EMPTY_CODE,
|
||||
String.format(ExceptionConstants.DEPOT_HEAD_CHECK_ASSEMBLE_EMPTY_MSG));
|
||||
}
|
||||
} else {
|
||||
throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_CHECK_ASSEMBLE_EMPTY_CODE,
|
||||
String.format(ExceptionConstants.DEPOT_HEAD_CHECK_ASSEMBLE_EMPTY_MSG));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新商品的价格
|
||||
* @param meId
|
||||
|
||||
Reference in New Issue
Block a user