1.直接执行update语句
private static BaseDAO bd null;
private static BaseDAO getBasedao(){
if(bd null){
bd new BaseDAO();
}
return bd;
}
getBasedao().executeUpdate(
UPDATE fhjy_listmaintainb SET kpsqhx N WHERE nvl(dr,0) 0 and
2.SQL语句中添加 in的语句
import nc.ui.bd.ref.RefPubUtil;
RefPubUtil.getInSubSql( Pk_sample ,codeList.toArray(new String[0])) and nvl(dr,0) 0
3.查询一个值(两个值)的方法
import nc.jdbc.framework.processor.ColumnProcessor;
dept getString(iq.executeQuery(sql, new ColumnProcessor()),null);
ArrayList TaskVO result (ArrayList TaskVO ) iq.executeQuery(sql, new BeanListProcessor(TaskVO.class));
4.查询多个值的方法
import nc.jdbc.framework.processor.ArrayListProcessor;
public Object[] queryMateiralMes(String pk_material) throws BusinessException {
String sql select a.pk_material,a.pk_source,a.pk_measdoc,\\n
b.pk_taxcode,c.taxrate from bd_material a,bd_taxcode b ,bd_taxrate c\\n
where a.pk_mattaxes b.mattaxes and b.pk_taxcode c.pk_taxcode\\n
and a.pk_material pk_material
and a.latest Y and a.enablestate 2\\n
and nvl(a.dr,0) 0 and nvl(b.dr,0) 0 and nvl(c.dr,0) 0
try {
ArrayList list (ArrayList) iq.executeQuery(sql,
new ArrayListProcessor());
if (list ! null list.size() 0) {
Object[] obj (Object[]) list.get(0);
return obj;
}else{
throw new BusinessException( 未找到 pk_material 对应的物料信息!
}
} catch (DAOException e) {
throw new BusinessException( 查找物料信息出错 e.getMessage());
}
}
5.流程平台动作处理接口 实现新增 删除 签字 审批 弃审
//流程平台动作处理 服务接口
IPFBusiAction ifbaction null;
private IPFBusiAction getIPFBsiAction(){
if(ifbaction null){
ifbaction NCLocator.getInstance().lookup(IPFBusiAction.class);
}
return ifbaction;
}
//destBill是aggvo
SapplyBillVO[] obj (SapplyBillVO[]) getIPFBsiAction().processAction( WRITE , 4455 , null, destBill, null, null);
6.判空代码
public static String getString(Object value, String str) {
if (value null || value.toString().trim().length() 0) {
return str;
}
return value.toString().trim();
}
7.StringUtils 判断字符串是否为空
StringUtils.isNotEmpty(materialVOs[0].getPk_fac())
8.ArrayUtils 判断集合是否为空
ArrayUtils.isNotEmpty(facVOs)
9.数据库查询工具 查询一个数组
DataAccessUtils utils new DataAccessUtils();
IRowSet rowset utils.query(sql.toString());
String[] pk_checkbills rowset.toOneDimensionStringArray();
10.刷新调用
nc.ui.pubapp.uif2app.actions.RefreshSingleAction refreshaction new RefreshSingleAction();
refreshaction.doAction(e1);
11.根据id查询sm_user表的vo
IUserManageQuery userQry NCLocator.getInstance().lookup(IUserManageQuery.class);
UserVO user userQry.getUser(cuserid);
UserVO user userQry.getUser(cuserid);
12.根据cuserid 明文密码校验
Boolean flag RbacUserPwdUtil.checkUserPassword(user, oldpwd2);//根据cuserid 明文密码校验
13.根据明文密码和UserVO修改密码
IUserPasswordManage mange NCLocator.getInstance().lookup(IUserPasswordManage.class);
mange.changeUserPassWord(user, newpwd);
14.一些工具类
BFPubTool
MathTool
StringUtil
15.生成单据pk和单据号
String pk NCLocator.getInstance().lookup(OidGenerator.class).nextOid( 0001
import nc.jdbc.framework.generator.IdGenerator;
import nc.jdbc.framework.generator.SequenceGenerator;
IdGenerator idGenerator new SequenceGenerator();
String pk idGenerator.generate();
批量单据号和pk
nc.bs.pub.billcodemanage.BillcodeGenerater gene new nc.bs.pub.billcodemanage.BillcodeGenerater();
String[] codes gene.getBatchBillCodes( WGD , 1001 , null, costarr.size());//批量单据号
String[] pks new SequenceGenerator().generate( 1001 , costarr.size());//批量pk
单据号
前置任务 配置单据号规则
创建单据号 new HYPubBO().getBillNo(单据类型, 组织, null, null);
或者 getVbillCode(单据类型,组织);
new BillcodeGenerater ().getBillCode (单据类型, 组织,null,null);
16持久化查询服务接口 uapbs
IMDPersistenceQueryService
17.用户密码工具类
//uservo,密码
Boolean flag RbacUserPwdUtil.checkUserPassword(uservo, passWord);
18.根据数据源和usercode获得uservo
INCUserQueryService service NCLocator.getInstance().lookup(
INCUserQueryService.class);
UserVO uservo service.findUserVO( nc65 , userCode);
19.查询审批流表里面的信息
//这个接口 可以得到审批流的信息 第三个参数 1是工作流 2是审批流
FlowHistoryQryResult result NCLocator.getInstance().lookup(IPFWorkflowQry.class).queryFlowHistoryQryResult(billtype, billid, 2);
20按钮里面调刷新
//new一个按钮
nc.ui.pubapp.uif2app.actions.RefreshSingleAction refreshaction new RefreshSingleAction();
//传数据给这个按钮
refreshaction.setModel(this.gethModel());
//新增一个事件。。。模拟这个按钮事件
ActionEvent e1 new ActionEvent(refreshaction, 1001, 刷新
//执行这个按钮的doAction方法 把这个模拟事件传进去
refreshaction.doAction(e1);
21NC单据每次提交必走的地方
nc.bs.pub.taskmanager.TaskManagerDMO.insertWorkitemsOfTask
WorkflownoteVO 会有你要的数据
22工作流查询接口
//工作流查询接口
FlowHistoryQryResult result NCLocator .getInstance().lookup(IPFWorkflowQry.class).queryFlowHistoryQryResult(billtype, billid, 2);
MessageMetaVO[] metavos result.getMessageMetaVOs();
23提交和审批会走的地方
nc.bs.pub.taskmanager.TaskManagerDMO
public void insertWorkitemsOfTask(String[] userIds, WFTask task, IWorkitemDistributor... dists)
24approve脚本中
注释 这个类中 在状态传0或者2时 都是不批准的接口方法
这时就会驳回至制单人
if ( 0 .equals(result)) {
// 不批准
notevo.setApproveresult( N
} else if ( 1 .equals(result)) {
// 批准
notevo.setApproveresult( Y
} else if ( 2 .equals(result)) {
// 驳回
notevo.setApproveresult( R
WFTask currTask notevo.getTaskInfo().getTask();
currTask.setBackToFirstActivity(true);
currTask.setTaskType(4);
}
25获取选中行得到选中行的VO 获取字段值
String tabCode panel.getCurrentBodyTableCode();
int[] rows panel.getBillTable().getSelectedRows();//获取选中的那一行
CombinePriceVO bvo (CombinePriceVO) panel.getBodyPanel(tabCode).getTableModel().getBodyValueRowVO(rows[0],CombinePriceVO.class.getName());//得到选中那一行的VO
UFBoolean isgrad bvo.getIsgrad();//是否梯度计价
26报错方法
MessageDialog.showErrorDlg(null, 提示 , 本次付款金额( jiemianMoney ) 累计付款金额( addallmoney ) 采购付款计划金额( allmoney )\\n
ExceptionUtils.wrappBusinessException( 本次付款金额( jiemianMoney ) 累计付款金额( addallmoney ) 采购付款计划金额( allmoney )\\n
27更新实体中变化的字段到到数据库中
VOUpdate CzyPayPlanBVO update new VOUpdate CzyPayPlanBVO
update.update(planBVOs, new String[]{ occupationmny
28将list转出 in 的 SQL
import nc.ui.bd.ref.RefPubUtil;
RefPubUtil.getInSubSql( pk_material ,list.toArray(new String[0]))
29表体编辑后 编辑物料多选 自动带出多行表体
29.1写在 AceBodyAfterEditHandler
String key e.getKey();
if (key.equals( pk_material )) {
nc.ui.czyplan.randomdata.handler.MaterialHandler handler new nc.ui.czyplan.randomdata.handler.MaterialHandler();
handler.afterEdit(e);
}
MaterialHandler 类
/**
* 物料的编辑事件处理类
*
* since 6.0
* version 2011-7-7 下午02:44:20
* author duy
*/
public class MaterialHandler {
/**
* 物料的编辑后事件处理
*
* param e 编辑后事件
*/
public void afterEdit(CardBodyAfterEditEvent event) {
// 物料的多选处理
RefMoreSelectedUtils utils new RefMoreSelectedUtils(event.getBillCardPanel());
int[] rows utils.refMoreSelected(event.getRow(), OrderItemVO.PK_MATERIAL, true);
}
/**
* 物料的编辑前事件处理
*
* param e 编辑前事件处理
*/
public void beforeEdit(CardBodyBeforeEditEvent e) {
BillCardPanel panel e.getBillCardPanel();
// 设置物料的参照允许多选
UIRefPane refPane (UIRefPane) panel.getBodyItem(e.getKey()).getComponent();
refPane.setMultiSelectedEnabled(true);
e.setReturnValue(Boolean.TRUE);
}
}
30得到选中行VO
TaskVO selectVo (TaskVO) getBillCardPanelWrapper().getBillCardPanel().getBodyPanel().getTableModel().getBodyValueRowVO(rows[0],TaskVO.class.getName());
31显示错误信息
/**
* 显示错误信息
*
* param title
* 标题
* param content
* 内容
*/
private void showErrorMessage(String title, String content) {
String newTitle title;
String newContent content;
MessageDialog.showErrorDlg(getBillUI(), newTitle, newContent);
}
32 NC57 页面底下报错信息
import nc.ui.pub.beans.MessageDialog;
/**
* author mmx
* 创建时间 2020-3-14 下午06:35:54
* H3 作用: /H3 执行 按钮的处理方法 BR
* throws BusinessException
*/
private void execute() throws BusinessException {
UFDateTime beginTs new UFDateTime(System.currentTimeMillis());
UFDateTime endTs null;
StringBuffer sb new StringBuffer();
int type
ITaskMaintain taskbtn NCLocator.getInstance().lookup(ITaskMaintain.class);
int[] rows getBillCardPanelWrapper().getBillCardPanel().getBillTable().getSelectedRows();
if(rows.length 1){//选中行大于一行时 报错
ExceptionUtils.wrappBusinessException( 只能选中一行数据
return;
}else{
TaskVO selectVo (TaskVO) getBillCardPanelWrapper().getBillCardPanel().getBodyPanel().getTableModel().getBodyValueRowVO(rows[0],TaskVO.class.getName());
StringBuffer result2 this.checkTaskVO(selectVo);
if(result2 ! null result2.length() 0){
MessageDialog.showHintDlg(null, 提示 , result2.toString());
return;
}else{
taskbtn.ExecuteTaskorNotExecuteTask(selectVo,type,_getOperator(),sb);
if(sb ! null sb.length() 0){
// throw new BusinessException(sb.toString());
this.showErrorMessage( 执行失败 ,sb.toString());
return;
}else{
endTs new UFDateTime(System.currentTimeMillis());
StringBuilder newMsg new StringBuilder();
newMsg.append( 开始时间
newMsg.append(beginTs.toString());
newMsg.append( 结束时间
newMsg.append(endTs.toString());
getBillUI().showHintMessage( 执行成功! newMsg.toString());
MessageDialog.showHintDlg(this.getBillUI(), 提示 , 【执行】操作成功
}
}
}
}
33获取程序运行了多长时间
long starttime System.currentTimeMillis();
long endtime System.currentTimeMillis();
System.out.println( 新增【物料消耗其他厂消耗汇总】完成,耗时: (endtime - starttime) / 1000 秒 操作结束时间 : new UFDateTime() );
34 NC57获取当前时间
new UFDateTime(System.currentTimeMillis())
35查询方法
IUAPQueryBS iq NCLocator.getInstance().lookup(IUAPQueryBS.class);// 查
String sql select user_name,cuserid from sm_user where RefPubUtil.getInSubSql( user_name , creatorList.toArray(new String[0]));
List Object[] list (List Object[] ) iq.executeQuery(sql,new ArrayListProcessor());
for(Object[] s : list){
creatorMap.put(ValueUtils.getInstance().getString(s[0]), ValueUtils.getInstance().getString(s[1]));
}
36建立大模块
37调用转换规则
PurchaseInaggvo 上游aggvo 上游单据类型 45
MaterialOutVO 下游aggvo 下游单据类型 4D
import nc.itf.scmpub.reference.uap.pf.PfServiceScmUtil;
//2调单据转换规则
MaterialOutVO[] MaterialOutVOaggvo PfServiceScmUtil.executeVOChange( 45 , 4D ,new AggregatedValueObject[]{PurchaseInaggvo});
38设置单据类型的SQL
为了配置【单据转换规则】
UPDATE bd_billtype SET bd_billtype.forwardbilltype 4K,5X,55AC,4D,55A2,4455,55C2,55B4,422X WHERE pk_billtypecode 55A3
-- 下游单据类型表
insert into bd_fwdbilltype (DR, ISBIZFLOWBILL, ISCROSSGRP, PK_BACKBILLTYPE, PK_BILLTYPE, PK_BILLTYPEID, PK_FWDBILLTYPE, TS)
values (0, N , Y , 55A3 , 422X , 55A3 , 1001ZA1000000001P664 , 2020-03-24 19:36:13
--查询执行结果
SELECT * FROM bd_billtype WHERE pk_billtypecode 55A3
SELECT * FROM bd_fwdbilltype WHERE pk_billtypeid 55A3
39调动作脚本
//流程平台动作处理 服务接口
IPFBusiAction ifbaction null;
private IPFBusiAction getIPFBsiAction(){
if(ifbaction null){
ifbaction NCLocator.getInstance().lookup(IPFBusiAction.class);
}
return ifbaction;
}
SapplyBillVO[] obj (SapplyBillVO[]) getIPFBsiAction().processAction( WRITE , 4455 , null, destBill, null, null);
//55A3 上游 422X 下游
StoreReqAppVO[] reqAppaggvo PfServiceScmUtil.executeVOChange( 55A3 , 422X ,new AggregatedValueObject[]{aggvo});
40创建临时表
public UFBoolean[] isCreateSubOrder(String[] sInvProducePKs)
throws SQLException {
//zhangjing 2012-10-08 注销下面内容 重新编写。
//原因 由于数据有可能会很多 故要分批执行。
//创建临时表
ArrayList List String pr_value new ArrayList List String ();
for (int i i sInvProducePKs.length; i ) {
ArrayList String pr_row new ArrayList String
pr_row.add(sInvProducePKs[i]);
pr_value.add(pr_row);
}
String[] columns new String[] { pk_produce
String[] types new String[] { char(20)
String sTableName null;
try {
nc.bs.scm.pub.TempTableDMO tmpTable new nc.bs.scm.pub.TempTableDMO();
sTableName tmpTable.getTempStringTable( pc_bfriend_produce , columns,
types, null, pr_value);
} catch (Exception e) {
throw new SQLException( 创建临时表失败
}
if (sTableName null) {
throw new SQLException( 创建临时表失败
}
Map map new HashMap();
BaseDAO dao new BaseDAO();
String sql select a.pk_produce, a.virtualflag, a.iscreatesonprodorder from bd_produce a , sTableName b where
a.pk_produce b.pk_produce and isnull(a.dr,0) 0
try {
ArrayList list (ArrayList) dao.executeQuery(sql, new ArrayListProcessor());
if(list ! null list.size() 0){
for(int i i list.size();i ){
Object[] obj (Object[]) list.get(i);
String invpk, virtualFlag, createFlag;
invpk BFPubTool.getString_TrimAsNull(obj[0]);
virtualFlag BFPubTool.getString_TrimAsNull(obj[1]);
createFlag BFPubTool.getString_TrimAsNull(obj[2]);
map.put(invpk, new UFBoolean(createFlag ! null
new UFBoolean(createFlag).booleanValue()));
}
}
} catch (DAOException e) {
throw new SQLException( 查询bd_produce 错误
}
//zhangjing end
UFBoolean[] retFlags new UFBoolean[sInvProducePKs.length];
for (int i i sInvProducePKs.length; i ) {
retFlags[i] map.containsKey(sInvProducePKs[i]) ? (UFBoolean) map
.get(sInvProducePKs[i]) : new UFBoolean(false);
}
return retFlags;
}
41 表体集合塞aggvo
PickmItemVO[] bvos bvoList.toArray(new PickmItemVO[bvoList.size()]);
aggvo.setChildrenVO(bvos);
SapplyBillVO destBill new SapplyBillVO();
SapplyBillBodyVO destBody returnBVO(bill);
SapplyBillHeadVO destHead returnHVO(bill);
destBill.setParentVO(destHead);
destBill.setChildren(SapplyBillBodyVO.class, new SapplyBillBodyVO[]{destBody});
42NC65中的MessageDialog弹框
//返回 确认 1 取消 2
int yn MessageDialog.showOkCancelDlg(null, 提示 ,
//返回 是 4 否 8
int yesNo MessageDialog.showYesNoDlg(null, 提示 ,
//输入框
Object value MessageDialog.showInputDlg(null, 提示 , 请输入人员编码 , 默认值
43插入有pk的数据
new BaseDAO().insertVOWithPK(PickmItemVO);
44单据联查追溯的类
nc.impl.pubapp.linkquery.MultiSrcBillFinder.getSourceBill
45单据界面选中数据 点击按钮 跳转到别的节点
按钮doAction里面调这个方法
TD02From55A3Bill handler new TD02From55A3Bill();
handler.process(aggvo, bvos[0]);
这个类继承GeneralToBill
这个是基类
还需要改xml的监听(打开节点的监听 下游的xml)
!-- 打开节点监听 --
bean id InitDataListener class nc.ui.czyplan.pub.listener.FuncNodeInitDataListener
property name model ref manageAppModel /
property name context ref context /property
property name cardForm ref billFormEditor /
property name listView ref listView /
property name container ref actionsOfList /property
!-- VO的类名 --
property name voClassName value nc.vo.czyplan.czyplan_bpickm.AggCzy_pickm /
!-- 打开节点节点后要显示的界面 --
property name autoShowUpComponent ref billFormEditor /
/bean
Czy_pickmBillForm 继承 ShowUpableBillForm 这个类
nc.ui.pubapp.uif2app.view.ShowUpableBillForm
46参照编辑后时间中设置多选后自动增行
if(tableCode.equals( id )){
String key e.getKey();
if( pk .equalsIgnoreCase(key)){
RefMoreSelectedUtils utils new RefMoreSelectedUtils(e.getBillCardPanel());
utils.refMoreSelected(e.getRow(),key,true)
}
}
47nc中限制只能输入数字
if (e.getKey().equals( ifloor )){
String ifloor (String) e.getBillCardPanel().getHeadItem( ifloor ).getValueObject();
Pattern pattern Pattern.compile( [0-9]*
Matcher isNum pattern.matcher(ifloor);
if(!isNum.matches()){
MessageDialog.showErrorDlg(e.getBillCardPanel(), 提示 , 楼层只能输入数字
e.getBillCardPanel().setHeadItem( ifloor , null);
}
}
48 NC65复制出没有权限的节点
原节点 委外订单维护
复制节点 委外订单之维护
1自己注册功能注册 挂在摸个节点下面 除了功能编码 和 功能名称 不一样 其他完全一样





本文链接: http://pfscm.immuno-online.com/view-743440.html