|
@@ -0,0 +1,123 @@
|
|
|
+package nc.bs.bd.bom.bom0202.pfxx.plugin;
|
|
|
+
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.Date;
|
|
|
+
|
|
|
+import nc.bs.framework.common.InvocationInfoProxy;
|
|
|
+import nc.bs.framework.common.NCLocator;
|
|
|
+import nc.bs.pfxx.ISwapContext;
|
|
|
+import nc.itf.bd.bom.bom0202.IBomBillMaintainService;
|
|
|
+import nc.itf.uap.pf.IPFBusiAction;
|
|
|
+import nc.vo.bd.bom.bom0202.entity.AggBomVO;
|
|
|
+import nc.vo.bd.bom.bom0202.entity.BomUseOrgVO;
|
|
|
+import nc.vo.bd.bom.bom0202.entity.BomVO;
|
|
|
+import nc.vo.pfxx.auxiliary.AggxsysregisterVO;
|
|
|
+import nc.vo.pfxx.util.PfxxPluginUtils;
|
|
|
+import nc.vo.pub.AggregatedValueObject;
|
|
|
+import nc.vo.pub.BusinessException;
|
|
|
+import nc.vo.pub.CircularlyAccessibleValueObject;
|
|
|
+import nc.vo.pub.VOStatus;
|
|
|
+import nc.vo.pubapp.pattern.exception.ExceptionUtils;
|
|
|
+import nc.vo.pubapp.pattern.pub.PubAppTool;
|
|
|
+
|
|
|
+
|
|
|
+ * <b> 在此处简要描述此类的功能 </b>
|
|
|
+ * <p>
|
|
|
+ * 在此处添加此类的描述信息
|
|
|
+ * </p>
|
|
|
+ *
|
|
|
+ * @author ufsoft
|
|
|
+ * @version Your Project V60
|
|
|
+ */
|
|
|
+public class MMbdBomPfxxPlugin extends nc.bs.pfxx.plugin.AbstractPfxxPlugin {
|
|
|
+
|
|
|
+ private IBomBillMaintainService service = null;
|
|
|
+
|
|
|
+ private IBomBillMaintainService getiBomBillMaintainService() {
|
|
|
+ if (this.service == null) {
|
|
|
+ this.service = NCLocator.getInstance().lookup(IBomBillMaintainService.class);
|
|
|
+ }
|
|
|
+ return this.service;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * 将由XML转换过来的VO导入NC系统。业务插件实现此方法即可。<br>
|
|
|
+ * 请注意,业务方法的校验一定要充分
|
|
|
+ *
|
|
|
+ * @param vo
|
|
|
+ * 转换后的vo数据,在NC系统中可能为ValueObject,SuperVO,AggregatedValueObject,IExAggVO等。
|
|
|
+ * @param swapContext
|
|
|
+ * 各种交换参数,组织,接受方,发送方,帐套等等
|
|
|
+ * @param aggxsysvo
|
|
|
+ * 辅助信息vo
|
|
|
+ * @return
|
|
|
+ * @throws BusinessException
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ protected Object processBill(Object vo, ISwapContext swapContext, AggxsysregisterVO aggxsysvo)
|
|
|
+ throws BusinessException {
|
|
|
+
|
|
|
+
|
|
|
+ AggregatedValueObject resvo = (AggregatedValueObject) vo;
|
|
|
+
|
|
|
+
|
|
|
+ String vopk = PfxxPluginUtils.queryBillPKBeforeSaveOrUpdate(swapContext.getBilltype(), swapContext.getDocID());
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ AggregatedValueObject returnVO = null;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if (PubAppTool.isNull(vopk)) {
|
|
|
+ resvo.getParentVO().setStatus(VOStatus.NEW);
|
|
|
+ for (CircularlyAccessibleValueObject bvo : resvo.getChildrenVO()) {
|
|
|
+ bvo.setStatus(VOStatus.NEW);
|
|
|
+ }
|
|
|
+
|
|
|
+ try {
|
|
|
+
|
|
|
+ SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ Object dateTimeString = resvo.getParentVO().getAttributeValue("tmaketime");
|
|
|
+ if(dateTimeString != null) {
|
|
|
+ Date date = format.parse(dateTimeString.toString());
|
|
|
+ long timestamp = date.getTime();
|
|
|
+ InvocationInfoProxy.getInstance().setBizDateTime(timestamp);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ ExceptionUtils.wrappException(e);
|
|
|
+ }
|
|
|
+ AggBomVO aggBomVO = (AggBomVO) resvo;
|
|
|
+ BomVO bomVO = (BomVO) resvo.getParentVO();
|
|
|
+ BomUseOrgVO bomUseOrgVO = new BomUseOrgVO();
|
|
|
+ bomUseOrgVO.setPk_useorg(bomVO.getPk_org());
|
|
|
+ aggBomVO.setChildren(BomUseOrgVO.class, new BomUseOrgVO[] {bomUseOrgVO});
|
|
|
+ returnVO = this.getiBomBillMaintainService().insertBom(new AggBomVO[] {
|
|
|
+ (AggBomVO) resvo
|
|
|
+ })[0];
|
|
|
+ NCLocator.getInstance().lookup(IPFBusiAction.class) .processBatch("APPROVE", "19B1",new AggBomVO[] {(AggBomVO) returnVO}, null, null, null);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ returnVO = this.getiBomBillMaintainService().updateBom(new AggBomVO[] {
|
|
|
+ (AggBomVO) resvo
|
|
|
+ })[0];
|
|
|
+ }
|
|
|
+ vopk = returnVO.getParentVO().getPrimaryKey();
|
|
|
+
|
|
|
+ PfxxPluginUtils.addDocIDVsPKContrast(swapContext.getBilltype(), swapContext.getDocID(), vopk);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ return vopk;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+}
|