mag3.py

1,import

import sys

from org.eclipse.jface.dialogs import MessageDialog
from org.eclipse.core.databinding.validation import ValidationStatus

from com.ifs.btt.cbs.dm import DomainManager
from com.ifs.btt.transport.factory import TransportFactory
from com.ifs.btt.context.global import GlobalContext

from javax.persistence import NoResultException
from java.math import BigDecimal
from java.math import BigInteger
from org.eclipse.swt.layout import GridData
from com.ifs.btt.context.model import AuthItem

from com.ifs.btt.event.manager import EventManager
from com.ifs.btt.event.tran import TranEvent
from java.lang import Math
from java.lang import Long

from com.ifs.btt.message.internal import MessageDataAccessor
from com.ifs.btt.message.xml.convertor import XMLMessageConvertor
from com.ifs.btt.message.xml.impl import XMLMessage

from com.ifs.btt.ui.xwt.scripts import ScriptLoader
from java.util import ArrayList
from java.text import SimpleDateFormat
from jarray import array
from java.lang import String
from com.ifs.btt.ui.xwt.widgets.fields import FComposite

#修改交易菜单检查
def update_tran_menus_init():
context = GlobalContext.getInstance().getTranContext()
tran_code = context.getTranTask().getCode()
load_tran_first_menus_update()
load_tran_second_menus_update()
return True

#加载更新一级菜单
def load_tran_first_menus_update():
context = GlobalContext.getInstance().getTranContext()
screen = context.getScreen()
group = u"交易菜单维护"
name = group + u".一级菜单"
f=DomainManager.getInstance().getFacadeContext()
widget=screen.getWidget(name)
fcombo=widget.getField()
l=list()
for v in f.nativeFetchMany(" select classification.id, classification.value from class_rollup,classification where relation_type_code ='TRAN_MENU_CLASSIFY' and class_rollup.parent_id is null and class_rollup.child_id = classification.id and classification.class_type_code ='TRAN_MENU_CLASS' order by classification.id asc ", []):
l.append(str(v[0]) + "#" + v[1])
fcombo.setOptions(",".join(l))
return True

#加载更新二级菜单
def load_tran_second_menus_update():
context = GlobalContext.getInstance().getTranContext()
screen = context.getScreen()
group = u"交易菜单维护"
name = group + u".二级菜单"
first_class = screen.getValue(group + u".一级菜单")
if first_class is None or first_class =="" :
  return False
f=DomainManager.getInstance().getFacadeContext()
widget=screen.getWidget(name)
fcombo=widget.getField()
l=list()

for v in f.nativeFetchMany(" select classification.id, classification.value from class_rollup,classification where relation_type_code ='TRAN_MENU_CLASSIFY' and class_rollup.parent_id = %s and class_rollup.child_id = classification.id and classification.class_type_code ='TRAN_MENU_CLASS' order by classification.id asc "%(first_class), []):
  l.append(str(v[0]) + "#" + v[1])
  fcombo.setOptions(",".join(l))
  fcombo.setIndex(-1)
return True

#交易码维护检查
def update_check_tran_code():
context = GlobalContext.getInstance().getTranContext()
screen = context.getScreen()
group = u"原交易信息"
name = group + u".交易代码"
f=DomainManager.getInstance().getFacadeContext()
tran_code = screen.getValue(name)
if tran_code is None or tran_code =="":
  if len(tran_code) != 6:
    MessageDialog.openError(None, "Error", u"交易代码长度不正确")
  return False
tran=f.fetchOne("Tran","Tran","where code=?1",[tran_code])
if tran is None or tran == "":
  MessageDialog.openError(None, "Error", u"交易码[%s]不存在" % tran_code)
else:
  screen.setValue(group+u".交易名称", tran.getName())
  screen.setValue(group+u".交易状态", tran.getTran_status())
  screen.setValue(group+u".交易说明", tran.getDescription())
if tran.getControl_level() == "":
  screen.setValue(group+u".重点监督级别", u"无")
else :
  screen.setValue(group+u".重点监督级别", tran.getControl_level())
if tran.getAuthz_class() == "" :
  screen.setValue(group+u".授权类型", u"")
else :
  screen.setValue(group+u".授权类型", tran.getAuthz_class())
if tran.getTran_status() == "Y":
  screen.setValue(group+u".是否允许反交易", u"是")
else :
  screen.setValue(group+u".是否允许反交易", u"否")

tran_task=f.fetchOne("TranTask","TranTask","where code=?1",[tran_code])
if tran_task is None or tran_task == "":
  return False

else :

  screen.setValue(group+u".服务名称", tran_task.getService())

if tran_task.getTran_task_type_code()=="NORMAL_TASK":
  screen.setValue(group+u".交易类型", u"普通交易任务")
elif tran_task.getTran_task_type_code()=="AUTH_TASK":
  screen.setValue(group+u".交易类型", u"授权交易任务")
elif tran_task.getTran_task_type_code()=="DELETE_TASK":
  screen.setValue(group+u".交易类型", u"删除交易任务")
elif tran_task.getTran_task_type_code()=="INPUT_TASK":
  screen.setValue(group+u".交易类型", u"录入交易任务")
elif tran_task.getTran_task_type_code()=="MODIFY_TASK":
  screen.setValue(group+u".交易类型", u"修改交易任务")
elif tran_task.getTran_task_type_code()=="PROCESS_TASK":
  screen.setValue(group+u".交易类型", u"流程交易任务")
elif tran_task.getTran_task_type_code()=="REVIEW_TASK":
  screen.setValue(group+u".交易类型", u"复核交易任务")

screen.setValue(group+u".交易状态", tran.getTran_status())
if tran.getTran_status() == "Y":
  screen.setValue(group+u".是否允许反交易", u"是")
else :
  screen.setValue(group+u".是否允许反交易", u"否")

#按照交易码取对应允许操作岗位
oper_position = f.nativeFetchOne(" select ac.id,ac.authc_type_code,ac.value from tran t,tran_authc ta ,authc ac where t.id =ta.tran_id and ac.id=ta.authc_id and ac.authc_type_code ='TRAN_OPER_POSITION' and t.id = ?1 ", [tran.getId()])
if oper_position is None:
  MessageDialog.openError(None, "Error", u"操作岗位不存在")
  return False
screen.getField(group+u".允许操作岗位").setValue(oper_position[2])

#按照交易码取对应的授权模式
authz_class = f.nativeFetchOne(" select atype.code, atype.name from tran t,tran_authz ta ,authz az,authz_type atype where t.id =ta.tran_id and az.id=ta.authz_id and az.authz_type_code=atype.code and atype.code !='REMOTE_REVIEW_AUTH' and t.id= ?1 ",[tran.getId()])
if authz_class is None :
  screen.getField(group+u".授权模式", u"不授权")
else:
  screen.getField(group+u".授权模式").setValue(authz_class[1])

#从交易码查对应的一级菜单和二级菜单
classification2 = f.fetchOne("classification", "Tran.classification", "where Tran.code = ?1" , [tran_code])
if classification2 is None:
  return False
screen.getField(group+u".原归属二级菜单").setValue(classification2.getValue())

classification1 = f.nativeFetchOne(" select classification.id, classification.value from class_rollup,classification where relation_type_code ='TRAN_MENU_CLASSIFY' and class_rollup.child_id = ?1 and class_rollup.parent_id = classification.id and classification.class_type_code ='TRAN_MENU_CLASS' ", [classification2.getId()])
screen.getField(group+u".原归属一级菜单").setValue(classification1[1])

return True

python 脚本的更多相关文章

  1. freeswitch嵌入python脚本

    操作系统:debian8.5_x64 freeswitch 版本 : 1.6.8 python版本:2.7.9 开启python模块 安装python lib库 apt-get install pyt ...

  2. python脚本后台运行

    问题描述: 环境: CentOS6.4 一个用python写的监控脚本test1.py,用while True方式一直运行,在ssh远程(使用putty终端)时通过以下命令启动脚本: python t ...

  3. 某互联网后台自动化组合测试框架RF+Sikuli+Python脚本

    某互联网后台自动化组合测试框架RF+Sikuli+Python脚本 http://www.jianshu.com/p/b3e204c8651a 字数949 阅读323 评论1 喜欢0 一.**Robo ...

  4. 动态执行python脚本

    前言 存在许多独立的python脚本,这些脚本可能会增加,也可能会减少,现在需要按照某种顺序调度这些程序.在python的standard library中,有一个模块imp可以实现动态的调用ptho ...

  5. 一个获取指定目录下一定格式的文件名称和文件修改时间并保存为文件的python脚本

    摘自:http://blog.csdn.net/forandever/article/details/5711319 一个获取指定目录下一定格式的文件名称和文件修改时间并保存为文件的python脚本 ...

  6. SecureCRT中python脚本编写

    SecureCRT中python脚本编写学习指南 SecureCRT python 引言 在测试网络设备中,通常使用脚本对设备端进行配置和测试以及维护:对于PE设备的测试维护人员来说使用较多是Secu ...

  7. Python脚本配合Linux计划任务工作

    经常遇到直接运行Python脚本没有问题,但是一放入/etc/crontab之后就歇菜的情况,总结了一下,大致需要注意以下几点: 1. 脚本首行加入#!/usr/bin/env python 2. 脚 ...

  8. Labview调用Python脚本

    Labview程序框图如下: Python脚本如下: #!/usr/bin/env pythonimport sys #Command Line Arguements are stored in li ...

  9. 使用Runtime.getRuntime().exec()在java中调用python脚本

    举例有一个Python脚本叫test.py,现在想要在Java里调用这个脚本.假定这个test.py里面使用了拓展的包,使得pythoninterpreter之类内嵌的编译器无法使用,那么只能采用ja ...

  10. FTP弱口令猜解【python脚本】

    ftp弱口令猜解 python脚本: #! /usr/bin/env python # _*_ coding:utf-8 _*_ import ftplib,time username_list=[' ...

随机推荐

  1. [引]LINQ to XML 类概述

    本文转自:http://msdn.microsoft.com/zh-cn/library/bb387023.aspx 本主题提供 System.Xml.Linq 命名空间中 LINQ to XML 类 ...

  2. 关于新feature对应的增加一个新的测试单子(QA)和文档单子(Doucmentation)的步骤

    一,增加一个new feature的文档单子. 1.new feature 增加对应的文档单子(公司有一个组是专门写产品说明的)所以增加一个新的功能就要有这个新的功能对应的一个文档(Documenta ...

  3. 关于SWT/JFace中其他常用的事件

    1.addSelectionListener:这个监听器最常用. 这个addSelectionListener是一个方法,addSelectionListener(SelectionListener ...

  4. Yii2查询语句使用不等于号

    Yii2 Active Record查询条件使用不等于号,需要使用到 operator format: [operator, operand1, operand2, ...] 运算符格式: [运算符, ...

  5. 多个DIV让float:left属性,最后一个DIV填满剩余的部分

    <DIV style="border:1px solid red; overflow:hidden;zoom:1;">      <DIV style='floa ...

  6. spark向量、矩阵类型

    先来个普通的数组: scala> var arr=Array(1.0,2,3,4) arr: Array[Double] = Array(1.0, 2.0, 3.0, 4.0) 可以将它转换成一 ...

  7. 动态上传多个文件(asp)

    CreateElements.html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" &quo ...

  8. 华为机试_字符串识别_Vector的使用;

    第一题:拼音转数字输入是一个只包含拼音的字符串,请输出对应的数字序列.转换关系如下:描述:      拼音        yi  er  san  si  wu  liu  qi  ba  jiu  ...

  9. WEB系统技术开发方向

    1. UI框架:要可以结合jquery+自定义服务器控件开发一套UI框架: 2.WEB报表设计器:用js开发一套可以自定义报表设计器: 3.WEB自定义表单+工作流设计器: 4.WEB打印组件: 5. ...

  10. 在.net中设置debug模式预设代码

    #region DEBUG #if DEBUG this.WorkOrgID.Value = "4DC4507E-434D-4EEB-967E-1E5CC28AA0C1"; thi ...