优化备料计划保存前校验逻辑及代码格式
This commit is contained in:
parent
f58750634b
commit
5e9839b804
|
@ -5,8 +5,6 @@
|
|||
|
||||
package nc.bs.pub.action;
|
||||
|
||||
import java.util.Hashtable;
|
||||
|
||||
import nc.bs.dao.BaseDAO;
|
||||
import nc.bs.framework.common.NCLocator;
|
||||
import nc.bs.ic.pub.env.ICBSContext;
|
||||
|
@ -27,6 +25,8 @@ import nc.vo.pubapp.pattern.exception.ExceptionUtils;
|
|||
import nc.vo.pubapp.pattern.pub.MathTool;
|
||||
import nccloud.baseapp.core.log.NCCForUAPLogger;
|
||||
|
||||
import java.util.Hashtable;
|
||||
|
||||
/**
|
||||
* 合并备料计划保存前校验申请数量是否超过计划数量-2005适配2312
|
||||
*
|
||||
|
@ -46,7 +46,7 @@ public class N_4455_WRITE extends AbstractCompiler2 {
|
|||
try {
|
||||
super.m_tmpVo = vo;
|
||||
ICBSContext context = new ICBSContext();
|
||||
ICPFParameter pfparam = (ICPFParameter)this.getUserObj();
|
||||
ICPFParameter pfparam = (ICPFParameter) this.getUserObj();
|
||||
if (pfparam == null) {
|
||||
pfparam = new ICPFParameter();
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ public class N_4455_WRITE extends AbstractCompiler2 {
|
|||
}
|
||||
|
||||
context.setICPFParameter(pfparam);
|
||||
SapplyBillVO[] outVOs = (SapplyBillVO[])this.getVos();
|
||||
SapplyBillVO[] outVOs = (SapplyBillVO[]) this.getVos();
|
||||
// 保存前校验申请数量是否超过计划数量
|
||||
for (SapplyBillVO billVO : outVOs) {
|
||||
SapplyBillBodyVO[] bodyVOS = billVO.getBodys();
|
||||
|
@ -95,31 +95,31 @@ public class N_4455_WRITE extends AbstractCompiler2 {
|
|||
));
|
||||
UFDouble applyNum1 = applyNum.add(bodyVO.getNassistnum());
|
||||
if (MathTool.compareTo(plantNum, applyNum1) < 0) {
|
||||
nccloud.framework.core.exception.ExceptionUtils.wrapBusinessException("申请数量已超出计划数量,请检查!");
|
||||
throw new BusinessException("申请数量已超出计划数量,请检查!");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (null != outVOs[0] && null != outVOs[0].getHead() && null != outVOs[0].getHead().getCgeneralhid()) {
|
||||
PfParameterUtil<SapplyBillVO> util = new PfParameterUtil(this.getPfParameterVO(), outVOs);
|
||||
SapplyBillVO[] originBills = (SapplyBillVO[])util.getOrginBills();
|
||||
SapplyBillVO[] originBills = (SapplyBillVO[]) util.getOrginBills();
|
||||
if (originBills == null) {
|
||||
originBills = (SapplyBillVO[])(new ICBillVOQuery()).fetchVOWithLoc(outVOs);
|
||||
originBills = (SapplyBillVO[]) (new ICBillVOQuery()).fetchVOWithLoc(outVOs);
|
||||
}
|
||||
|
||||
SapplyBillVO[] clientFullBills = (SapplyBillVO[])util.getClientFullInfoBill();
|
||||
return ((ISapplyBillMaintain)NCLocator.getInstance().lookup(ISapplyBillMaintain.class)).update(clientFullBills, originBills);
|
||||
SapplyBillVO[] clientFullBills = (SapplyBillVO[]) util.getClientFullInfoBill();
|
||||
return ((ISapplyBillMaintain) NCLocator.getInstance().lookup(ISapplyBillMaintain.class)).update(clientFullBills, originBills);
|
||||
} else {
|
||||
SapplyBillVO[] retunVos = new SapplyBillVO[outVOs.length];
|
||||
ISapplyBillMaintain service = (ISapplyBillMaintain)NCLocator.getInstance().lookup(ISapplyBillMaintain.class);
|
||||
ISapplyBillMaintain service = (ISapplyBillMaintain) NCLocator.getInstance().lookup(ISapplyBillMaintain.class);
|
||||
|
||||
for(int i = 0; i < outVOs.length; ++i) {
|
||||
for (int i = 0; i < outVOs.length; ++i) {
|
||||
retunVos[i] = service.insert(new SapplyBillVO[]{outVOs[i]})[0];
|
||||
}
|
||||
|
||||
return retunVos;
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ExceptionUtils.marsh(ex);
|
||||
} catch (Exception e) {
|
||||
ExceptionUtils.marsh(e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue