spd,powerbuilder开发日记

1.free类型窗口,字段过长自动换行

在这里插入图片描述

在数据窗口里,找到该列,右键属性,设置edit,勾选auto vertical scroll
在这里插入图片描述

2.数据窗口更新操作失败,rows->specify update properties编辑

总单明细的窗口,在明细窗口新增了字段。之后操作人员在保存明细单时报错。
在这里插入图片描述
需要设置update属性,位置:数据窗口->rows->specify update properties
在这里插入图片描述
[updateble columns]里面点选的列,允许更新到[w_pccmd_dtl]表里,还需在[unique key column]里勾选主键

3.需求:在A页面点选数据后,点击按钮,弹出一个窗口B(数据窗口和打印按钮)

1 -response 窗口的应用
1、windows 是按消息运行的,不同的窗口有不同的句柄,这是受到windows控制的,他们之间的信息传递也是靠消息的
2、open(w_x,‘aa’) open(w_x,1) ,open(w_x,dw_1)
分别代表传递,string ,double,powerobject给w_x窗口
3、在窗口的open 事件里
string ls_msg
ls_mst = message.stringparm

long ll_msg
ll_msg = message.doubleparm

fc_dw ldw
ldw = message.powerobjectparm
可以得到传进来的值

2 精度问题,
例如页面有条数据,列名为price,值为14.8
用getitemnumber会丢失小数点后精度,取到的值为15
应该用getitemdecimal

4.用户对象A,窗口B。A中写函数,将B窗口中的数据窗口中的已选则数据取消选择

在窗口B里新增函数 of_clear()
在用户对象中调用

idw_master.selectrow(0,false)
mywin.dynamic of_clear()

5.进入一个功能时,第一次查询正常,第二次报错(column doesn’t match 之类的)

解决:
方式一:打开pb里此数据窗口的sql,将未选择的列选上
方式二:数据窗口的列类型未设置正确,edit source修改即可

6.细单里,只要有一条数据的status为2,就********

if idw_detail.find("status=2",1,9999)  >0 then
	messagebox("提示","已经确定的采购订单无法修改",StopSign!)
	return 
end if

7.把一个字符串按照逗号分隔,然后换行显示

//zfj 发票换行显示
	ll_one=pos(ls_invno,',',1)
	if ll_one <>0 then
		ll_two=pos(ls_invno,',',ll_one+1)
		if ll_two <> 0 then
				fp_one = mid(ls_invno,1,ll_two)
				fp_two = mid(ls_invno,ll_two+1)
				ls_invno = fp_one+'~r '+fp_two
		end if
	end if

pos函数:
    例:pos(ls_invno , ‘,’ , 1) //返回 在ls_invno字符串中,从位置1开始,第一次出现‘,’(逗号)出现的位置

mid函数:
    例:mid(ls_invno,1,ll_two)//在ls_invno中,截取位置1到ll_two的字符串
    例;mid(ls_invno,ll_two+1) //在ls_invno中,截取位置(ll_two+1)到最后的字符串
在两个字符串中间加上'~r'或者‘~r ~n’来实现换行

8.创建查询序列号

        在sequences包下新建
在这里插入图片描述在这里插入图片描述

9. 高值消耗管理

数组
//定义一个长度为3的string类型数组
string stockcode[3]

.
场景:在总单或者明细改变时做操作,位置在事件 udw_mstcardeditchanged 或者 udw_dtlcardeditchanged
场景:每次扫码之后都要进行判断操作,位置在事件 fc_pickerbefore
场景:获取总单或者明细上 某一列的值, if dwo.name = 'XXX' then instanname = data

设置查询后不可插入,就是设置总单明细为只读

ids_DeveProp.setitem(1,'ifinsertonquery',0)
idw_detail.object.datawindow.readonly = 'YES'
idw_master.object.datawindow.readonly = 'YES'

新增总单后,取消总单明细的只读

ids_DeveProp.setitem(1,'ifinsertonquery',1)
idw_detail.object.datawindow.readonly = 'NO'
idw_master.object.datawindow.readonly = 'NO'

清空数据窗口数据:ids_nowbarcode.reset()

在提交(fc_commit)和提交后(fc_commitafter)事件里

//先将总单明细设置为只读
idw_master.modify("datawindow.readonly='yes'")
idw_detail.modify("datawindow.readonly='yes'")
ids_DeveProp.setitem(1,'ifinsertonquery',0)
//after;刷新总单明细
idw_master.retrieve()
idw_detail.retrieve()

打开一个窗口,将自己的数据窗口数据传过去,双击窗口中的数据,返回选中的行数

弹出窗口后,有三种操作。1.取消;2.选中数据然后点击确定;3.双击数据
//取消的clicked
closewithretrun(parent,0)
//确定的clicked
long ll_row
ll_row = dw_1.getselectedrow(0)
closewithreturn(parent,ll_row)
//双击,双击就是调用【确定】的单击事件
if row > 0 then
	cb_1.TriggerEvent(Clicked!)
end if

10.循环

do while循环

do while ll_row > 0 
		if nvl(idw_master.getitemnumber(ll_row,"finflag"),0) <> 0 then
		  messagebox("提示","第"+string(ll_row)+"行,只有未完成的请领单才可强制完成",StopSign!)
		  return  
		end if
	  ll_row = idw_master.getselectedrow(ll_row)
loop

11.打开窗口

//打开窗口,获取窗口的返回值
openwithparm(w_selecttext,'填写强制原因')
string ls_reason
ls_reason = message.stringparm
if isnull(ls_reason ) then
	return 
end if

在这里插入图片描述

//确定按钮的点击事件
closewithreturn(parent ,mle_1.text)
//取消按钮的点击事件
string ls_null 
setnull(ls_null)
closewithreturn(parent,ls_null)

12.实例化用户对象

n_barprint objectname
objectname = create n_barprint
//调用该类方法
objectname.方法名()

13.messagebox的使用

if MessageBox('提示信息','是否删除?',&Question! ,OKCancel! , 1 ) = 1 then//选择确定
MessageBox('提示信息', '你选择了删除')
else//选择取消
   MessageBox('提示信息','你选择了不删除')
end if

13.数据窗口某个时间列(近效期),过期之后列文本变为红色

在这里插入图片描述
在这里插入图片描述
选中列,font-》textcolor-》点击右边进入表达式标记框
输入

if(daysafter(expiredate,today())>0 ,RGB(255,0,0) ,rgb(0,0,0))
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值