uapbd_bom新增接口根据单据状态添加自动提交
This commit is contained in:
parent
6c42d69cca
commit
38660ff131
|
@ -110,26 +110,44 @@ public class APIBomBusinessServiceImpl implements IAPIBomBusinessService {
|
||||||
AggBomVO[] aggVOs = (AggBomVO[]) list.toArray(new AggBomVO[list.size()]);
|
AggBomVO[] aggVOs = (AggBomVO[]) list.toArray(new AggBomVO[list.size()]);
|
||||||
|
|
||||||
BillFieldsCodeToPkUtil.doTranslateVOFields(aggVOs);
|
BillFieldsCodeToPkUtil.doTranslateVOFields(aggVOs);
|
||||||
|
List<AggBomVO> commitAggvoList=new ArrayList<>();
|
||||||
|
List<AggBomVO> addAggvoList=new ArrayList<>();
|
||||||
for (AggBomVO agg : aggVOs) {
|
for (AggBomVO agg : aggVOs) {
|
||||||
// zhangxinah 对物料主键进行翻译
|
// zhangxinah 对物料主键进行翻译
|
||||||
dealWithMaterial(agg);
|
dealWithMaterial(agg);
|
||||||
dataSupplement(agg);
|
dataSupplement(agg);
|
||||||
|
|
||||||
UFBoolean flag = (UFBoolean) agg.getParent().getAttributeValue("hbdefault");
|
UFBoolean flag = (UFBoolean) agg.getParent().getAttributeValue("hbdefault");
|
||||||
|
Object fBillStatusFlag = agg.getParent().getAttributeValue("fbillstatus");
|
||||||
|
|
||||||
if (UFBoolean.TRUE.equals(flag)) {
|
if (UFBoolean.TRUE.equals(flag)) {
|
||||||
UFBoolean bHasOtherDefaultVersion = getIsExistDefaultVersion(agg);
|
UFBoolean bHasOtherDefaultVersion = getIsExistDefaultVersion(agg);
|
||||||
if (bHasOtherDefaultVersion.equals(UFBoolean.TRUE)) {
|
if (bHasOtherDefaultVersion.equals(UFBoolean.TRUE)) {
|
||||||
ExceptionUtils.wrappBusinessException("hasOtherDefaultVersion");
|
ExceptionUtils.wrappBusinessException("有其它默认版本,请检查!!!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
(new BomSavingValidation()).validate(agg);
|
(new BomSavingValidation()).validate(agg);
|
||||||
|
if(fBillStatusFlag==null||"-1".equals(fBillStatusFlag.toString())){
|
||||||
|
addAggvoList.add(agg);
|
||||||
|
}
|
||||||
|
if(fBillStatusFlag !=null && "1".equals(fBillStatusFlag.toString())){
|
||||||
|
commitAggvoList.add(agg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mapClear();
|
mapClear();
|
||||||
|
//请求参数状态为审批通过时,自动提交--不设审批流 start
|
||||||
AggBomVO[] result = service.insertBom((AggBomVO[]) list.toArray(new AggBomVO[0]));
|
AggBomVO[] result=null;
|
||||||
|
if(commitAggvoList.isEmpty()&&addAggvoList.isEmpty()){
|
||||||
|
return ResultMessageUtil.exceptionToJSON("BOM保存失败,不存在单据状态不为【空/自由/审批通过】的数据","999");
|
||||||
|
}else if(commitAggvoList.isEmpty()&&!addAggvoList.isEmpty()){
|
||||||
|
result= service.insertBom((AggBomVO[]) list.toArray(new AggBomVO[0]));
|
||||||
|
}else if(!commitAggvoList.isEmpty()&&addAggvoList.isEmpty()){
|
||||||
|
result = service.insertCommitBomWithParam((AggBomVO[]) list.toArray(new AggBomVO[0]),true,true);
|
||||||
|
}else{
|
||||||
|
return ResultMessageUtil.exceptionToJSON("BOM保存失败,新增不允许单据状态自由或者空和审批通过同时存在","999");
|
||||||
|
}
|
||||||
|
//请求参数状态为审批通过时,自动提交--不设审批流 end
|
||||||
return ResultMessageUtil.toJSON(result, "BOM保存成功");
|
return ResultMessageUtil.toJSON(result, "BOM保存成功");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return ResultMessageUtil.exceptionToJSON(e);
|
return ResultMessageUtil.exceptionToJSON(e);
|
||||||
|
|
Loading…
Reference in New Issue