
package nccloud.bs.ic.ic.aggbusi.ace.bp;
import nc.vo.sap.syproconfig.AggSyProConfigVO;
import nc.impl.pubapp.pattern.data.bill.BillUpdate;
import nc.vo.pub.VOStatus;
import nc.vo.pub.pf.BillStatusEnum;

/**
 * 标准单据收回的BP
 */
public class AceNccsynergyUnSendApproveBP {

        public AggSyProConfigVO[] unSend(AggSyProConfigVO[] clientBills,
                        AggSyProConfigVO[] originBills) {
                // 把VO持久化到数据库中
                this.setHeadVOStatus(clientBills);
                BillUpdate<AggSyProConfigVO> update = new BillUpdate<AggSyProConfigVO>();
                AggSyProConfigVO[] returnVos = update.update(clientBills, originBills);
                return returnVos;
        }

        private void setHeadVOStatus(AggSyProConfigVO[] clientBills) {
                for (AggSyProConfigVO clientBill : clientBills) {
                        clientBill.getParentVO().setAttributeValue("${vmObject.billstatus}",
                                        BillStatusEnum.FREE.value());
                        clientBill.getParentVO().setStatus(VOStatus.UPDATED);
                }
        }
}
