|
@@ -0,0 +1,99 @@
|
|
|
+package nccloud.web.cdmc.cdm.repayprcpl.action;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+import nc.bs.logging.Logger;
|
|
|
+import nc.itf.cdmc.cdm.repayprcpl.IRepayPrcplQueryService;
|
|
|
+import nc.vo.cdmc.cdm.repayprcpl.AggRepayPrcplVO;
|
|
|
+import nc.vo.cdmc.cdm.repayprcpl.RepayPrcplVO;
|
|
|
+import nc.vo.cdmc.pub.adapter.FinancepaySagaInfoAdapter;
|
|
|
+import nc.vo.cdmc.pub.adapter.RepayPrcplSagaInfoAdapter;
|
|
|
+import nc.vo.cdmc.pub.constants.CdmcPubConst;
|
|
|
+import nc.vo.ml.NCLangRes4VoTransl;
|
|
|
+import nc.vo.pub.BusinessException;
|
|
|
+import nccloud.framework.core.exception.ExceptionUtils;
|
|
|
+import nccloud.framework.service.ServiceLocator;
|
|
|
+import nccloud.pubitf.tmpub.pub.ISagasBizService;
|
|
|
+import nccloud.web.cdmc.common.action.CommonOperatorAction;
|
|
|
+
|
|
|
+public class RepayPrcplDeleteAction extends CommonOperatorAction<AggRepayPrcplVO> {
|
|
|
+ private IRepayPrcplQueryService service = (IRepayPrcplQueryService) ServiceLocator
|
|
|
+ .find(IRepayPrcplQueryService.class);
|
|
|
+
|
|
|
+ protected AggRepayPrcplVO[] queryBillsByPks(String[] operaPks) throws BusinessException {
|
|
|
+ return this.service.queryAggRepayPrcplByPks(operaPks);
|
|
|
+ }
|
|
|
+
|
|
|
+ protected Object doBusinessProcess(AggRepayPrcplVO[] operaVOs, List<String> errList) throws BusinessException {
|
|
|
+ if (operaVOs != null && operaVOs.length != 0) {
|
|
|
+ List<AggRepayPrcplVO> succVOs = new ArrayList();
|
|
|
+ AggRepayPrcplVO[] var4 = operaVOs;
|
|
|
+ int var5 = operaVOs.length;
|
|
|
+
|
|
|
+ for (int var6 = 0; var6 < var5; ++var6) {
|
|
|
+ AggRepayPrcplVO operaVO = var4[var6];
|
|
|
+ String vdef4 = (String) operaVO.getParent().getAttributeValue("vdef4");
|
|
|
+ if(vdef4 != null) {
|
|
|
+ String str = "该单据是由上游单据生成,请在上游单据取消生单!";
|
|
|
+ errList.add(
|
|
|
+ NCLangRes4VoTransl.getNCLangRes().getStrByID("cdmc_ncc003_0", "0cdmc_ncc003-0000")
|
|
|
+ + operaVO.getParentVO().getVbillno() + NCLangRes4VoTransl.getNCLangRes()
|
|
|
+ .getStrByID("cdmc_ncc003_0", "0cdmc_ncc003-0001")
|
|
|
+ + str);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (this.checkBefore(operaVO, errList)) {
|
|
|
+ try {
|
|
|
+ super.callActionScript(CdmcPubConst.CONST_ACTION_DELETE, CdmcPubConst.CONST_BILLTYPE_REPAYPRCPL,
|
|
|
+ new AggRepayPrcplVO[]{operaVO});
|
|
|
+ succVOs.add(operaVO);
|
|
|
+ } catch (BusinessException var9) {
|
|
|
+ Logger.error(var9.getMessage(), var9);
|
|
|
+ errList.add(
|
|
|
+ NCLangRes4VoTransl.getNCLangRes().getStrByID("cdmc_ncc003_0", "0cdmc_ncc003-0000")
|
|
|
+ + operaVO.getParentVO().getVbillno() + NCLangRes4VoTransl.getNCLangRes()
|
|
|
+ .getStrByID("cdmc_ncc003_0", "0cdmc_ncc003-0001")
|
|
|
+ + this.getExceptionMsg(var9));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return succVOs.toArray(new AggRepayPrcplVO[0]);
|
|
|
+ } else {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private boolean checkBefore(AggRepayPrcplVO operaVO, List<String> errList) {
|
|
|
+ RepayPrcplVO head = operaVO.getParentVO();
|
|
|
+
|
|
|
+ try {
|
|
|
+ if (head != null && head.getPrimaryKey() != null) {
|
|
|
+ RepayPrcplSagaInfoAdapter adapter = new RepayPrcplSagaInfoAdapter();
|
|
|
+ ISagasBizService sagaService = (ISagasBizService) ServiceLocator.find(ISagasBizService.class);
|
|
|
+ sagaService.checkFrozen(adapter, head.getPrimaryKey());
|
|
|
+ if (head.getPk_financepay() != null) {
|
|
|
+ FinancepaySagaInfoAdapter adapterFinancePay = new FinancepaySagaInfoAdapter();
|
|
|
+ sagaService.checkFrozen(adapterFinancePay, head.getPk_financepay());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception var7) {
|
|
|
+ errList.add(NCLangRes4VoTransl.getNCLangRes().getStrByID("cdmc_ncc003_0", "0cdmc_ncc003-0000")
|
|
|
+ + head.getVbillno() + this.getExceptionMsg(var7));
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (-1 != head.getVbillstatus()) {
|
|
|
+ errList.add(NCLangRes4VoTransl.getNCLangRes().getStrByID("cdmc_ncc003_0", "0cdmc_ncc003-0000")
|
|
|
+ + head.getVbillno()
|
|
|
+ + NCLangRes4VoTransl.getNCLangRes().getStrByID("cdmc_ncc003_0", "0cdmc_ncc003-0002"));
|
|
|
+ return false;
|
|
|
+ } else {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ protected String getActionCode() {
|
|
|
+ return CdmcPubConst.CONST_ACTION_DELETE;
|
|
|
+ }
|
|
|
+}
|