|  | @@ -1,61 +1,56 @@
 | 
	
		
			
				|  |  | -package nc.pubimpl.so.m30.pfxx;
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -import java.util.ArrayList;
 | 
	
		
			
				|  |  | -import java.util.List;
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -import nc.bs.framework.common.InvocationInfoProxy;
 | 
	
		
			
				|  |  | -import nc.bs.framework.common.NCLocator;
 | 
	
		
			
				|  |  | -import nc.impl.pubapp.pattern.data.bill.BillQuery;
 | 
	
		
			
				|  |  | -import nc.impl.pubapp.pattern.data.bill.tool.BillConcurrentTool;
 | 
	
		
			
				|  |  | -import nc.impl.pubapp.pattern.rule.IRule;
 | 
	
		
			
				|  |  | -import nc.impl.so.m30.action.main.InsertSaleOrderAction;
 | 
	
		
			
				|  |  | -import nc.impl.so.m30.action.main.UpdateSaleOrderAction;
 | 
	
		
			
				|  |  | -import nc.itf.uap.pf.IPFBusiAction;
 | 
	
		
			
				|  |  | -import nc.pubimpl.so.pfxx.AbstractSOPfxxPlugin;
 | 
	
		
			
				|  |  | -import nc.pubimpl.so.pfxx.check.BillFreeStatusCheckRule;
 | 
	
		
			
				|  |  | -import nc.pubimpl.so.pfxx.check.MnyTaxCheckRule;
 | 
	
		
			
				|  |  | -import nc.pubimpl.so.pfxx.check.WriteBackInfoCheckRule;
 | 
	
		
			
				|  |  | -import nc.vo.pub.AggregatedValueObject;
 | 
	
		
			
				|  |  | -import nc.vo.pub.BusinessException;
 | 
	
		
			
				|  |  | -import nc.vo.pub.pf.workflow.IPFActionName;
 | 
	
		
			
				|  |  | -import nc.vo.so.m30.entity.SaleOrderVO;
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -public class M30PfxxPlugin extends AbstractSOPfxxPlugin {
 | 
	
		
			
				|  |  | -	public List<IRule<AggregatedValueObject>> getCheckers() {
 | 
	
		
			
				|  |  | -		List<IRule<AggregatedValueObject>> rules = new ArrayList();
 | 
	
		
			
				|  |  | -		rules.add(new BillFreeStatusCheckRule());
 | 
	
		
			
				|  |  | -		rules.add(new MnyTaxCheckRule("ntax", "nmny", "ntaxmny"));
 | 
	
		
			
				|  |  | -		rules.add(new WriteBackInfoCheckRule(new String[]{"ntotalsendnum", "ntotalinvoicenum", "ntotaloutnum",
 | 
	
		
			
				|  |  | -				"ntotalnotoutnum", "ntotalsignnum", "ntranslossnum", "ntotalrushnum", "ntotalestarnum", "ntotalarnum",
 | 
	
		
			
				|  |  | -				"ntotalcostnum", "ntotalestarmny", "ntotalarmny", "ntotalpaymny", "norigsubmny", "narrangescornum",
 | 
	
		
			
				|  |  | -				"narrangepoappnum", "narrangetoornum", "narrangetoappnum", "narrangemonum", "narrangeponum",
 | 
	
		
			
				|  |  | -				"ntotalplonum", "ntotalreturnnum", "ntotaltradenum"}));
 | 
	
		
			
				|  |  | -		return rules;
 | 
	
		
			
				|  |  | -	}
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -	protected AggregatedValueObject insert(AggregatedValueObject vo) {
 | 
	
		
			
				|  |  | -		SaleOrderVO[] insertvo = new SaleOrderVO[]{(SaleOrderVO) vo};
 | 
	
		
			
				|  |  | -		InsertSaleOrderAction insertact = new InsertSaleOrderAction();
 | 
	
		
			
				|  |  | -		SaleOrderVO[] retvos = insertact.insert(insertvo);
 | 
	
		
			
				|  |  | -	    IPFBusiAction service = NCLocator.getInstance().lookup(IPFBusiAction.class);
 | 
	
		
			
				|  |  | -	    try {
 | 
	
		
			
				|  |  | -			service.processAction(IPFActionName.APPROVE,
 | 
	
		
			
				|  |  | -			     "30", null, retvos[0], null, null);
 | 
	
		
			
				|  |  | -		} catch (BusinessException e) {
 | 
	
		
			
				|  |  | -			// TODO ×Ô¶¯Éú³ÉµÄ catch ¿é
 | 
	
		
			
				|  |  | -			e.printStackTrace();
 | 
	
		
			
				|  |  | -		}
 | 
	
		
			
				|  |  | -		return null != retvos && retvos.length != 0 ? retvos[0] : null;
 | 
	
		
			
				|  |  | -	}
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -	protected AggregatedValueObject update(AggregatedValueObject vo, String vopk) {
 | 
	
		
			
				|  |  | -		SaleOrderVO[] updatevo = new SaleOrderVO[]{(SaleOrderVO) vo};
 | 
	
		
			
				|  |  | -		BillQuery<SaleOrderVO> billquery = new BillQuery(SaleOrderVO.class);
 | 
	
		
			
				|  |  | -		SaleOrderVO[] origvos = (SaleOrderVO[]) billquery.query(new String[]{vopk});
 | 
	
		
			
				|  |  | -		BillConcurrentTool tool = new BillConcurrentTool();
 | 
	
		
			
				|  |  | -		tool.lockBill(origvos);
 | 
	
		
			
				|  |  | -		UpdateSaleOrderAction insertact = new UpdateSaleOrderAction();
 | 
	
		
			
				|  |  | -		SaleOrderVO[] retvos = insertact.update(updatevo, origvos);
 | 
	
		
			
				|  |  | -		return null != retvos && retvos.length != 0 ? retvos[0] : null;
 | 
	
		
			
				|  |  | -	}
 | 
	
		
			
				|  |  | +package nc.pubimpl.so.m30.pfxx;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +import java.util.ArrayList;
 | 
	
		
			
				|  |  | +import java.util.List;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +import nc.bs.framework.common.InvocationInfoProxy;
 | 
	
		
			
				|  |  | +import nc.bs.framework.common.NCLocator;
 | 
	
		
			
				|  |  | +import nc.impl.pubapp.pattern.data.bill.BillQuery;
 | 
	
		
			
				|  |  | +import nc.impl.pubapp.pattern.data.bill.tool.BillConcurrentTool;
 | 
	
		
			
				|  |  | +import nc.impl.pubapp.pattern.rule.IRule;
 | 
	
		
			
				|  |  | +import nc.impl.so.m30.action.main.InsertSaleOrderAction;
 | 
	
		
			
				|  |  | +import nc.impl.so.m30.action.main.UpdateSaleOrderAction;
 | 
	
		
			
				|  |  | +import nc.itf.uap.pf.IPFBusiAction;
 | 
	
		
			
				|  |  | +import nc.pubimpl.so.pfxx.AbstractSOPfxxPlugin;
 | 
	
		
			
				|  |  | +import nc.pubimpl.so.pfxx.check.BillFreeStatusCheckRule;
 | 
	
		
			
				|  |  | +import nc.pubimpl.so.pfxx.check.MnyTaxCheckRule;
 | 
	
		
			
				|  |  | +import nc.pubimpl.so.pfxx.check.WriteBackInfoCheckRule;
 | 
	
		
			
				|  |  | +import nc.vo.pub.AggregatedValueObject;
 | 
	
		
			
				|  |  | +import nc.vo.pub.BusinessException;
 | 
	
		
			
				|  |  | +import nc.vo.pub.pf.workflow.IPFActionName;
 | 
	
		
			
				|  |  | +import nc.vo.so.m30.entity.SaleOrderVO;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +public class M30PfxxPlugin extends AbstractSOPfxxPlugin {
 | 
	
		
			
				|  |  | +	public List<IRule<AggregatedValueObject>> getCheckers() {
 | 
	
		
			
				|  |  | +		List<IRule<AggregatedValueObject>> rules = new ArrayList();
 | 
	
		
			
				|  |  | +		rules.add(new BillFreeStatusCheckRule());
 | 
	
		
			
				|  |  | +		rules.add(new MnyTaxCheckRule("ntax", "nmny", "ntaxmny"));
 | 
	
		
			
				|  |  | +		rules.add(new WriteBackInfoCheckRule(new String[]{"ntotalsendnum", "ntotalinvoicenum", "ntotaloutnum",
 | 
	
		
			
				|  |  | +				"ntotalnotoutnum", "ntotalsignnum", "ntranslossnum", "ntotalrushnum", "ntotalestarnum", "ntotalarnum",
 | 
	
		
			
				|  |  | +				"ntotalcostnum", "ntotalestarmny", "ntotalarmny", "ntotalpaymny", "norigsubmny", "narrangescornum",
 | 
	
		
			
				|  |  | +				"narrangepoappnum", "narrangetoornum", "narrangetoappnum", "narrangemonum", "narrangeponum",
 | 
	
		
			
				|  |  | +				"ntotalplonum", "ntotalreturnnum", "ntotaltradenum"}));
 | 
	
		
			
				|  |  | +		return rules;
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	protected AggregatedValueObject insert(AggregatedValueObject vo) throws BusinessException {
 | 
	
		
			
				|  |  | +		SaleOrderVO[] insertvo = new SaleOrderVO[]{(SaleOrderVO) vo};
 | 
	
		
			
				|  |  | +		InsertSaleOrderAction insertact = new InsertSaleOrderAction();
 | 
	
		
			
				|  |  | +		SaleOrderVO[] retvos = insertact.insert(insertvo);
 | 
	
		
			
				|  |  | +	    IPFBusiAction service = NCLocator.getInstance().lookup(IPFBusiAction.class);
 | 
	
		
			
				|  |  | +	    service.processAction(IPFActionName.APPROVE,
 | 
	
		
			
				|  |  | +			     "30", null, retvos[0], null, null);
 | 
	
		
			
				|  |  | +		return null != retvos && retvos.length != 0 ? retvos[0] : null;
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	protected AggregatedValueObject update(AggregatedValueObject vo, String vopk) {
 | 
	
		
			
				|  |  | +		SaleOrderVO[] updatevo = new SaleOrderVO[]{(SaleOrderVO) vo};
 | 
	
		
			
				|  |  | +		BillQuery<SaleOrderVO> billquery = new BillQuery(SaleOrderVO.class);
 | 
	
		
			
				|  |  | +		SaleOrderVO[] origvos = (SaleOrderVO[]) billquery.query(new String[]{vopk});
 | 
	
		
			
				|  |  | +		BillConcurrentTool tool = new BillConcurrentTool();
 | 
	
		
			
				|  |  | +		tool.lockBill(origvos);
 | 
	
		
			
				|  |  | +		UpdateSaleOrderAction insertact = new UpdateSaleOrderAction();
 | 
	
		
			
				|  |  | +		SaleOrderVO[] retvos = insertact.update(updatevo, origvos);
 | 
	
		
			
				|  |  | +		return null != retvos && retvos.length != 0 ? retvos[0] : null;
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  |  }
 |