瀏覽代碼

材料请购单新增生成请购单按钮2

zthwr 1 年之前
父節點
當前提交
1d2f8815df
共有 1 個文件被更改,包括 66 次插入0 次删除
  1. 66 0
      xc/cg/src/client/u8c/ui/mytest/action/DemandPurchaseRequisitionAction.java

+ 66 - 0
xc/cg/src/client/u8c/ui/mytest/action/DemandPurchaseRequisitionAction.java

@@ -0,0 +1,66 @@
+package u8c.ui.mytest.action;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import nc.bs.framework.common.NCLocator;
+import nc.itf.uap.IUAPQueryBS;
+import nc.ui.hr.frame.FrameUI;
+import nc.ui.hr.frame.action.AbstractAction;
+import nc.ui.hr.frame.impl.MainBillMgrPanel;
+import nc.ui.pub.beans.MessageDialog;
+import nc.vo.hr.tools.pub.HRAggVO;
+import nc.vo.pub.BusinessException;
+import nc.vo.pub.CircularlyAccessibleValueObject;
+import nc.vo.pub.ValidationException;
+import u8c.itf.po.IDemandPurchaseRequisition;
+import u8c.ui.mytest.panel.DemandMainPanel;
+import u8c.ui.mytest.panel.DemandTestUI;
+import u8c.vo.DemandBVO;
+import u8c.vo.DemandVO;
+
+public class DemandPurchaseRequisitionAction extends AbstractAction {
+
+	private IUAPQueryBS iuap = NCLocator.getInstance().lookup(IUAPQueryBS.class);
+	DemandTestUI frameUI = null;
+	
+	public DemandPurchaseRequisitionAction(FrameUI frameUI1) {
+		super(frameUI1);
+		this.frameUI = (DemandTestUI) frameUI;
+	}
+
+	@Override
+	public void execute() throws Exception {
+		// TODO Auto-generated method stub
+		// 获取材料请购单
+		MainBillMgrPanel mainMgrPanel = (MainBillMgrPanel) getMainPanel();
+		int selectedRow = ((DemandMainPanel) getMainPanel()).getSelectedRow();
+		HRAggVO s = (HRAggVO) mainMgrPanel.getMainBillCardPanel().getData();
+		DemandVO demandVO = (DemandVO) s.getParentVO();//
+		if (1!=demandVO.getBillstatus()) {
+			throw new ValidationException("单据需要先审批");// 新增请购单
+		}
+		if (null != s && s != null) {
+//			getInstance(IDemandPurchaseRequisition.class).addPraybillVO(s);// 新增请购单
+			
+//			DemandVO demandVO = (DemandVO) s.getParentVO();//
+			CircularlyAccessibleValueObject[] demandBVOList =  s.getAllChildrenVO();//
+			List<DemandBVO> demandBVOs = new ArrayList();
+			for(CircularlyAccessibleValueObject vo : demandBVOList) {
+				if(vo instanceof DemandBVO) {
+					demandBVOs.add((DemandBVO)vo);
+				}
+			}
+			if(demandBVOs.size()==0) {
+				throw new BusinessException("当前材料采购单没有数据,请先添加数据");
+			}
+			IDemandPurchaseRequisition iDemandPurchaseRequisition = NCLocator.getInstance().lookup(IDemandPurchaseRequisition.class);
+			iDemandPurchaseRequisition.addPraybillVO(demandVO,demandBVOs);
+		}
+	}
+	
+//	private IDemandPurchaseRequisition getInstance(Class<IDemandPurchaseRequisition> class1) {
+//		return ServiceLocator.find(class1);
+//	}
+	
+}