• 全部
  • API 调用
  • 基础类
  • 控件与界面
  • 数据库相关
  • DataWindow
  • 项目管理
  • Web 应用
  • 脚本语言

数据窗口共享的问题

fmilan 2003-05-20 03:23:31
子数据窗口共享主数据窗口的数据,数据显示出来了,更新子数据窗口中的数据进数据库,没有报错信息,但是数据未更新入数据库
目的是为了不同的数据库系统之间数据交换,如果用两个datastore实现数据共享可以么?

代码如下:
string ls_name
datastore lds_store,lds_st_update

disconnect;
fn_connect_store();
//lds_store = create datastore
dw_1.dataobject = "d_product_class"
st_1.text = "ÕýÔÚretrieveÊý¾Ý"
dw_1.settransobject(sqlca)
dw_1.retrieve()

i_dst = create transaction
i_dst.DBMS = "ODBC"
i_dst.AutoCommit = False
i_dst.DBParm = "ConnectString='DSN=query;UID=;PWD='"

connect using i_dst;
If i_dst.sqlcode <> 0 then
Messagebox("Ä¿±êÊý¾Ý¿âÁ¬½Ó´íÎó",i_dst.sqlerrtext)
Return -1
End If

dw_2.dataobject = "d_st_pro_class"
dw_2.settransobject(i_dst)
//dw_2.retrieve()
if dw_1.sharedata(dw_2) <> 1 then
messagebox("share date error","retry!")
return -1
end if

if dw_2.update() <> 1 then
messagebox("updateÊý¾Ýµ¼Èë³ö´í","ÇëÖØÐÂupdate!")
rollback;
return -1
end if
commit using i_dst;

messagebox("update success","ok")
disconnect using sqlca;
disconnect using i_dst;
destroy i_dst;
destroy lds_store;
destroy lds_st_update;


...全文
73 点赞 收藏 16
写回复
16 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
homeness 2003-05-21
//我以前写的一个新增出库单的窗口例子,导入后自已看看吧!
$PBExportHeader$w_dj_new_ckd.srw
$PBExportComments$新增出库单
forward
global type w_dj_new_ckd from w_center
end type
type uo_import_text from uo_sys_pfc_bmpbutton_down within w_dj_new_ckd
end type
type uo_edit from uo_sys_pfc_bmpbutton_down within w_dj_new_ckd
end type
type uo_face from uo_sys_djface within w_dj_new_ckd
end type
type uo_deleterow from uo_sys_pfc_bmpbutton_down within w_dj_new_ckd
end type
type uo_insertrow from uo_sys_pfc_bmpbutton_down within w_dj_new_ckd
end type
type uo_exit from uo_sys_pfc_bmpbutton_down within w_dj_new_ckd
end type
type uo_end from uo_sys_pfc_bmpbutton_down within w_dj_new_ckd
end type
type uo_next from uo_sys_pfc_bmpbutton_down within w_dj_new_ckd
end type
type uo_front from uo_sys_pfc_bmpbutton_down within w_dj_new_ckd
end type
type uo_top from uo_sys_pfc_bmpbutton_down within w_dj_new_ckd
end type
type uo_delete from uo_sys_pfc_bmpbutton_down within w_dj_new_ckd
end type
type uo_datain from uo_sys_pfc_bmpbutton_down within w_dj_new_ckd
end type
type uo_seek from uo_sys_pfc_bmpbutton_down within w_dj_new_ckd
end type
type uo_save from uo_sys_pfc_bmpbutton_down within w_dj_new_ckd
end type
type uo_new from uo_sys_pfc_bmpbutton_down within w_dj_new_ckd
end type
type dw_ckds from uo_sys_datawindow within w_dj_new_ckd
end type
type dw_ckd_null from uo_sys_datawindow within w_dj_new_ckd
end type
end forward

global type w_dj_new_ckd from w_center
integer width = 3415
integer height = 2024
boolean minbox = false
boolean maxbox = false
boolean resizable = false
windowtype windowtype = response!
event ue_post_open ( )
uo_import_text uo_import_text
uo_edit uo_edit
uo_face uo_face
uo_deleterow uo_deleterow
uo_insertrow uo_insertrow
uo_exit uo_exit
uo_end uo_end
uo_next uo_next
uo_front uo_front
uo_top uo_top
uo_delete uo_delete
uo_datain uo_datain
uo_seek uo_seek
uo_save uo_save
uo_new uo_new
dw_ckds dw_ckds
dw_ckd_null dw_ckd_null
end type
global w_dj_new_ckd w_dj_new_ckd

回复
joss 2003-05-21
public subroutine wf_button_enabled (string as_connect);//******************************************************************************************
/***************************************************
隶属:w_dj_new_ckd
对象:Function
名称:wf_button_enabled
接口:public
参数:Name Arguments Type Pass By Explain
as_connect string value 判断参数
返回:none
功能:根据传来的参数判断进行何种操作,改变按钮的属性
创建:jixiaoyi 2002.8.1
修改:
***************************************************/
Choose Case as_connect
Case "noconnect"
uo_datain.buttonenabled=False
End Choose

end subroutine

public function integer wf_ckd_edit ();//******************************************************************************************
/***************************************************
隶属:w_dj_new_ckd
对象:Function
名称:wf_ckd_edit
接口:public
参数:Name Arguments Type Pass By Explain
返回:integer
功能:执行修改出库单表头操作
创建:jixiaoyi 2002.8.2
修改:
***************************************************/
if ids_ckd.getrow() < 1 then
messagebox("错误","当前系统没有未审核出库单,无法修改!")
return -1
end if
long ll_row
ll_row = ids_ckd.getrow()
gs_ckdh = ids_ckd.getitemstring(ll_row,"ckdh")
gd_ckdate = Date(ids_ckd.getitemDatetime(ll_row,"ckdate"))
gs_xhdw = ids_ckd.getitemstring(ll_row,"xhdw")
gs_xhdwbh = ids_ckd.getitemstring(ll_row,"xhdwbh")
gs_zb = ids_ckd.getitemstring(ll_row,"zb")
gs_dgdh = ids_ckd.getitemstring(ll_row,"dgdh")
openwithparm(w_sys_ckd_sj,"editckd")
if message.DoubleParm = 1 then
wf_setitem_ckd_null()
wf_setitem_ckd("editrow")
end if
return 1
end function

public function integer wf_ckd_save ();//******************************************************************************************
/***************************************************
隶属:w_dj_new_ckd
对象:Function
名称:wf_ckd_save
接口:public
参数:Name Arguments Type Pass By Explain
返回:integer
功能:保存表体内容,因为表头是一次保存的,所以表头不需要保存
创建:jixiaoyi 2002.8.1
修改:
***************************************************/
if dw_ckds.getrow() < 1 then
messagebox("错误","当前出库单明细为空不能保存!")
return -1
end if

if dw_ckds.update() < 0 then
rollback;
messagebox("错误","保存未成功!")
return -1
else
commit;
// messagebox("提示","")
return 1
end if

end function

public function integer wf_ckd_insertrow ();//******************************************************************************************
/***************************************************
隶属:w_dj_new_ckd
对象:Function
名称:wf_ckd_insertrow
接口:public
参数:Name Arguments Type Pass By Explain
返回:integer
功能:执行插入明细记录的操作,一般用在手工增加出库单
返回1表示执行插入操作,返回-1表示不能插入记录
创建:jixiaoyi 2002.8.2
修改:
***************************************************/
if ids_ckd.getrow() < 1 then
messagebox("错误","当前没有出库单,不能增加明细!")
return -1
end if
if dw_ckds.getrow() > 0 then
if wf_ckd_save() = -1 then //假如保存明细失败
return -1
end if
end if
long ll_row
ll_row = dw_ckds.insertrow(0)
dw_ckds.scrolltorow(ll_row)
dw_ckds.setfocus()
dw_ckds.setitem(ll_row,"headid",ids_ckd.getitemnumber(ids_ckd.getrow(),"id"))
//messagebox("",string(ids_ckd.getitemnumber(ids_ckd.getrow(),"id")))
return 1

end function

public function integer wf_ckd_deleterow ();//******************************************************************************************
/***************************************************
隶属:w_dj_new_ckd
对象:Function
名称:wf_ckd_deleterow
接口:public
参数:Name Arguments Type Pass By Explain
返回:integer
功能:招待删除行操作
创建:jixiaoyi 2002.8.2
修改:
***************************************************/
//return 1
dw_ckds.SelectRow(0, FALSE)
dw_ckds.SelectRow(dw_ckds.getrow(), TRUE)
if messagebox("警告","真的要删除当前行吗?",Exclamation!,YesNo!,2) = 2 then
dw_ckds.SelectRow(0, FALSE)
return -1
end if
dw_ckds.deleterow(dw_ckds.getrow())
return 1

end function

回复
joss 2003-05-21
//接上
type variables
//******************************************************************************************
/***************************************************
隶属:w_dj_new_ckd
对象:Declare
范围:Instance Variables
说明:
创建:2002.7.31
修改:
***************************************************/
transaction my_connect //声明事务
Datastore ids_jxc_ckd //JXC中的出库单
Datastore ids_ckd //出库单表头
integer ii_myconnect = 0 //判断连接是否成功
integer ii_ckd_rowcount //出库单未审未开票单数

//////以下定义相关出库明细的变量
long il_ckds_rowcount //表示一张明细表有几行数据(等于循环的次数)
string is_lb[],is_xh[],is_flpm[],is_gg[],is_hw[],is_sh[],is_gd[],is_dw[]
Dec idec_cksl[],idec_ckdj[]

//////////////////得到表头保存后自动生成的表头id号
integer ii_id_ckd

//
string is_ckdh,is_filename,is_path



//is_path = profilestring("main.ini","database","ckdPath",'')
//"D:\pb\wkpgl\ckd\"
string is_dlfw //出库单是何种导入范围,1为一张,2为成批
end variables

forward prototypes
public subroutine wf_button_enabled (string as_connect)
public function integer wf_ckd_edit ()
public function integer wf_ckd_save ()
public function integer wf_ckd_insertrow ()
public function integer wf_ckd_deleterow ()
public function integer wf_ckd_delete ()
public function integer wf_ckd_seek ()
public function integer wf_ckd_retrieve ()
public function integer wf_ckd_new ()
public function integer wf_getitem_ckds ()
public subroutine wf_resize ()
public function integer wf_setitem_ckd_null ()
public function integer wf_importckd (string as_msg)
public function integer wf_connectdatabase ()
public function integer wf_ckd_refresh (string as_ckdh)
public function integer wf_seek_jxc_ckd (string as_ckdh)
public function integer wf_seek_ckdh_text (string as_ckdh)
public function integer wf_seek_ckdh (string as_ckdh)
public function integer wf_scrolltorow (string as_msg)
public function integer wf_setitem_ckd (string as_msg)
public function integer wf_setitem_ckds (long al_rowcount)
public function integer wf_import_text_all ()
public function integer wf_import_text_item (string as_msg)
public function integer wf_import_text ()
end prototypes

event ue_post_open;//******************************************************************************************
/***************************************************
隶属:w_dj_new_ckd
对象:Function
名称:ue_post_open
接口:public
参数:Name Arguments Type Pass By Explain
返回:none
功能:延时打开事件,连接数据库
创建:jixiaoyi 2002.7.31
修改:
***************************************************/
if wf_connectdatabase() < 0 then
wf_button_enabled("noconnect")
messagebox("错误","未能连接上进销存系统,请核对!")
else
ids_jxc_ckd = Create Datastore
ids_jxc_ckd.DataObject = "ds_dj_ckd_jxc"
ids_jxc_ckd.settransobject(my_connect)
end if
ii_ckd_rowcount = ids_ckd.retrieve(0,"1")
if ii_ckd_rowcount > 0 then
wf_ckd_retrieve()
else
messagebox("提示","已经没有未审核出库单!")
end if


end event


回复
joss 2003-05-21
//我以前写的一个新增出库单的窗口例子,导入后自已看看吧!
$PBExportHeader$w_dj_new_ckd.srw
$PBExportComments$新增出库单
forward
global type w_dj_new_ckd from w_center
end type
type uo_import_text from uo_sys_pfc_bmpbutton_down within w_dj_new_ckd
end type
type uo_edit from uo_sys_pfc_bmpbutton_down within w_dj_new_ckd
end type
type uo_face from uo_sys_djface within w_dj_new_ckd
end type
type uo_deleterow from uo_sys_pfc_bmpbutton_down within w_dj_new_ckd
end type
type uo_insertrow from uo_sys_pfc_bmpbutton_down within w_dj_new_ckd
end type
type uo_exit from uo_sys_pfc_bmpbutton_down within w_dj_new_ckd
end type
type uo_end from uo_sys_pfc_bmpbutton_down within w_dj_new_ckd
end type
type uo_next from uo_sys_pfc_bmpbutton_down within w_dj_new_ckd
end type
type uo_front from uo_sys_pfc_bmpbutton_down within w_dj_new_ckd
end type
type uo_top from uo_sys_pfc_bmpbutton_down within w_dj_new_ckd
end type
type uo_delete from uo_sys_pfc_bmpbutton_down within w_dj_new_ckd
end type
type uo_datain from uo_sys_pfc_bmpbutton_down within w_dj_new_ckd
end type
type uo_seek from uo_sys_pfc_bmpbutton_down within w_dj_new_ckd
end type
type uo_save from uo_sys_pfc_bmpbutton_down within w_dj_new_ckd
end type
type uo_new from uo_sys_pfc_bmpbutton_down within w_dj_new_ckd
end type
type dw_ckds from uo_sys_datawindow within w_dj_new_ckd
end type
type dw_ckd_null from uo_sys_datawindow within w_dj_new_ckd
end type
end forward

global type w_dj_new_ckd from w_center
integer width = 3415
integer height = 2024
boolean minbox = false
boolean maxbox = false
boolean resizable = false
windowtype windowtype = response!
event ue_post_open ( )
uo_import_text uo_import_text
uo_edit uo_edit
uo_face uo_face
uo_deleterow uo_deleterow
uo_insertrow uo_insertrow
uo_exit uo_exit
uo_end uo_end
uo_next uo_next
uo_front uo_front
uo_top uo_top
uo_delete uo_delete
uo_datain uo_datain
uo_seek uo_seek
uo_save uo_save
uo_new uo_new
dw_ckds dw_ckds
dw_ckd_null dw_ckd_null
end type
global w_dj_new_ckd w_dj_new_ckd


回复
xirumin 2003-05-21
因是sharedata(), 所以子数据窗口是不能update的。(因为状态没变)
回复
dengxun78 2003-05-21
学习!
回复
fmilan 2003-05-21
datastore我知道怎么用,关键是数据窗口共享的问题,我的子窗口共享了主窗口的数据,但是似乎无法更新入数据库;还有我看的共享数据窗口的示例一般都是一个数据窗口和一个datastore,不知道用两个数据窗口实现数据共享行不行;
关键问题是我想实现两个数据库系统中的数据交换,上次听吃好喝好说除了pipeline、导入到文本文件还可以用datastore来实现数据交换的,所以想尝试一下
回复
tchatcha 2003-05-21
datastore是一个不可视的数据窗口,与DW的功能相似,所以说你自己可以完成,看看PB的帮助
回复
fmilan 2003-05-21
哇!好多啊,慢慢研究,其实那个问题用rowscopy也可以搞定,只是想找出最有效率的方法,没办法,数据量太大了,动不动都是几十万条数据...
回复
skylineman 2003-05-21
event clicked;call super::clicked;wf_ckd_edit()
end event

type uo_face from uo_sys_djface within w_dj_new_ckd
integer x = 41
integer y = 216
integer width = 3150
integer height = 1452
integer taborder = 90
end type

on uo_face.destroy
call uo_sys_djface::destroy
end on

type uo_deleterow from uo_sys_pfc_bmpbutton_down within w_dj_new_ckd
integer x = 1618
integer y = 36
integer taborder = 80
string buttontext = "删除行"
string tooltip = "删除当前行出库明细"
string normalpicturename = "c:\bmp\deleterow.bmp"
end type

on uo_deleterow.destroy
call uo_sys_pfc_bmpbutton_down::destroy
end on

event clicked;call super::clicked;wf_ckd_deleterow()
end event

type uo_insertrow from uo_sys_pfc_bmpbutton_down within w_dj_new_ckd
integer x = 1394
integer y = 36
integer taborder = 60
string buttontext = "插入行"
string tooltip = "增加一行出库明细"
string normalpicturename = "c:\bmp\insertrow.bmp"
end type

on uo_insertrow.destroy
call uo_sys_pfc_bmpbutton_down::destroy
end on

event clicked;call super::clicked;wf_ckd_insertrow()
end event

type uo_exit from uo_sys_pfc_bmpbutton_down within w_dj_new_ckd
integer x = 2738
integer y = 36
integer taborder = 70
string buttontext = "退出"
string tooltip = "关闭窗口"
string normalpicturename = "c:\bmp\exit1.bmp"
end type

on uo_exit.destroy
call uo_sys_pfc_bmpbutton_down::destroy
end on

event clicked;call super::clicked;close(parent)
end event

type uo_end from uo_sys_pfc_bmpbutton_down within w_dj_new_ckd
integer x = 2514
integer y = 36
integer taborder = 60
string buttontext = "末张"
string tooltip = "转到最后一张出库单"
string normalpicturename = "c:\bmp\end.bmp"
end type

on uo_end.destroy
call uo_sys_pfc_bmpbutton_down::destroy
end on

event clicked;call super::clicked;wf_scrolltorow("end")
end event

type uo_next from uo_sys_pfc_bmpbutton_down within w_dj_new_ckd
integer x = 2290
integer y = 36
integer taborder = 50
string buttontext = "下一张"
string tooltip = "转到下一张出库单"
string normalpicturename = "c:\bmp\next.bmp"
end type

on uo_next.destroy
call uo_sys_pfc_bmpbutton_down::destroy
end on

event clicked;call super::clicked;wf_scrolltorow("next")
end event

type uo_front from uo_sys_pfc_bmpbutton_down within w_dj_new_ckd
integer x = 2066
integer y = 36
integer taborder = 50
string buttontext = "上一张"
string tooltip = "转到上一张出库单"
string normalpicturename = "c:\bmp\front.bmp"
end type

on uo_front.destroy
call uo_sys_pfc_bmpbutton_down::destroy
end on

event clicked;call super::clicked;wf_scrolltorow("front")
end event

type uo_top from uo_sys_pfc_bmpbutton_down within w_dj_new_ckd
integer x = 1842
integer y = 36
integer taborder = 40
string buttontext = "首张"
string tooltip = "转到第一张出库单"
string normalpicturename = "c:\bmp\top.bmp"
end type

on uo_top.destroy
call uo_sys_pfc_bmpbutton_down::destroy
end on

event clicked;call super::clicked;wf_scrolltorow("top")
end event

type uo_delete from uo_sys_pfc_bmpbutton_down within w_dj_new_ckd
integer x = 1170
integer y = 36
integer taborder = 40
string buttontext = "删除"
string tooltip = "删除当前出库单"
string normalpicturename = "c:\bmp\garbage.bmp"
end type

on uo_delete.destroy
call uo_sys_pfc_bmpbutton_down::destroy
end on

event clicked;call super::clicked;wf_ckd_delete()
end event

type uo_datain from uo_sys_pfc_bmpbutton_down within w_dj_new_ckd
integer x = 50
integer y = 36
integer taborder = 30
string buttontext = "导入"
string tooltip = "从进销存系统导入指定出库单"
string normalpicturename = "c:\bmp\datain.bmp"
end type

on uo_datain.destroy
call uo_sys_pfc_bmpbutton_down::destroy
end on

event clicked;call super::clicked;openwithparm(w_sys_dj,"importckd")

if Message.DoubleParm = -1 Then
return -1
end if
wf_importckd(Message.Stringparm)

end event

type uo_seek from uo_sys_pfc_bmpbutton_down within w_dj_new_ckd
integer x = 946
integer y = 36
integer taborder = 40
string buttontext = "查找"
string tooltip = "查找指定出库单"
string normalpicturename = "c:\bmp\look.bmp."
end type

on uo_seek.destroy
call uo_sys_pfc_bmpbutton_down::destroy
end on

event clicked;call super::clicked;wf_ckd_seek()
end event

type uo_save from uo_sys_pfc_bmpbutton_down within w_dj_new_ckd
integer x = 274
integer y = 36
integer taborder = 30
string buttontext = "保存"
string tooltip = "保存当前出库单"
string normalpicturename = "c:\bmp\save.bmp"
end type

on uo_save.destroy
call uo_sys_pfc_bmpbutton_down::destroy
end on

event clicked;call super::clicked;wf_ckd_save()
end event

type uo_new from uo_sys_pfc_bmpbutton_down within w_dj_new_ckd
integer x = 498
integer y = 36
integer taborder = 20
string buttontext = "增加"
string tooltip = "新增加一张出库单"
string normalpicturename = "c:\bmp\new.bmp"
end type

on uo_new.destroy
call uo_sys_pfc_bmpbutton_down::destroy
end on

event clicked;call super::clicked;wf_ckd_new()
end event

type dw_ckds from uo_sys_datawindow within w_dj_new_ckd
integer x = 114
integer y = 688
integer width = 3159
integer height = 1060
integer taborder = 100
boolean bringtotop = true
string dataobject = "dw_dj_newckds"
boolean hscrollbar = true
boolean vscrollbar = true
borderstyle borderstyle = stylebox!
end type

event clicked;call super::clicked;//This.SelectRow(0, FALSE)
//This.SelectRow(row, TRUE)
end event

event rowfocuschanged;call super::rowfocuschanged;//if currentrow > 0 then
// if wf_ckd_save() = -1 then
// messagebox("","")
// return -1
// end if
//end if
end event

type dw_ckd_null from uo_sys_datawindow within w_dj_new_ckd
integer x = 219
integer y = 268
integer width = 2935
integer height = 396
integer taborder = 100
boolean bringtotop = true
string dataobject = "dw_dj_newckd_null"
boolean border = false
borderstyle borderstyle = stylebox!
end type

本来想将问题归纳一下,但直接将内容全部贴出,慢慢看看吧!
回复
skylineman 2003-05-21
/***************************************
接下来的步骤:
1、设置表头[INSERTROW(0)]
2、保存表头并取出新保存后得到的id赋到ii_id_ckd中
3、增加表明细,并保存!
****************************************/
if wf_setitem_ckd("insertrow") = 1 then
dw_ckds.retrieve(ii_id_ckd)
wf_setitem_ckds(il_ckds_rowcount) //根据出库单的总行数追加表
end if
wf_ckd_refresh(gs_ckdh) //刷新Datastore<ids_ckd>
return 1
else
return -1
end if
end function

public function integer wf_import_text ();//******************************************************************************************
/***************************************************
隶属:w_dj_new_ckd
对象:Function
名称:wf_import_text
接口:public
参数:Name Arguments Type Pass By Explain
返回:integer
功能:导入出库单,为文本文件!
创建:jixiaoyi 2002.9.2
修改:
***************************************************/
openwithparm(w_sys_dj,"importckd")
if Message.DoubleParm = -1 Then
return -1
end if
string ls_msg
ls_msg = Message.Stringparm

if wf_seek_ckdh(ls_msg) = - 1 then
messagebox("错误","系统中已经有此号码的出库单!")
return 0
end if

string ls_ckdh
long ll_row,ll_i,ll_len
ll_len = len(ls_msg) //得到长度
ll_i = 11 - ll_len + 1 //开始截取的位置
ls_ckdh = replace(space(11),ll_i,ll_len,ls_msg) //得到截取替换后的位置

integer li_seek_ckd //查询出库单函数wf_seek_jxc_ckd的返回值
li_seek_ckd = wf_seek_ckdh_text(ls_msg)
if li_seek_ckd > 0 then
if messagebox("提示","你真的要导入<"+ls_msg+">号出库单吗?",Question!,OKCancel!,2) = 2 then
return -1
end if
Datastore lds_text
lds_text = Create Datastore
lds_text.Dataobject="ds_dj_ckd_import"
lds_text.settransobject(sqlca)
lds_text.retrieve()
lds_text.ImportFile(is_filename)
il_ckds_rowcount = lds_text.rowcount()

is_lb = lds_text.object.lb[1,il_ckds_rowcount] //取明细内容
is_xh = lds_text.object.xh[1,il_ckds_rowcount]
is_flpm = lds_text.object.flpm[1,il_ckds_rowcount]
is_gg = lds_text.object.gg[1,il_ckds_rowcount]
is_hw = lds_text.object.hw[1,il_ckds_rowcount]
is_sh = lds_text.object.sh[1,il_ckds_rowcount]
is_gd = lds_text.object.gd[1,il_ckds_rowcount]
is_dw = lds_text.object.dw[1,il_ckds_rowcount]
idec_cksl = lds_text.object.ik5[1,il_ckds_rowcount]
idec_ckdj = lds_text.object.xsdj[1,il_ckds_rowcount]

gs_ckdh = ls_msg
string ls_date
ls_date = lds_text.object.rq[1]
gd_ckdate = date(long(mid(ls_date,7,2)),long(mid(ls_date,1,2)),long(mid(ls_date,4,2)))
// gd_ckdate = lds_text.getitemDate(1,"rq") //取表头内容
gs_xhdw = lds_text.getitemstring(1,"khmc")
gs_xhdwbh = lds_text.getitemstring(1,"khbh")
gs_zb = lds_text.getitemstring(1,"zb")
gs_dgdh = lds_text.getitemstring(1,"ddh")
wf_setitem_ckd_null()
/***************************************
接下来的步骤:
1、设置表头[INSERTROW(0)]
2、保存表头并取出新保存后得到的id赋到ii_id_ckd中
3、增加表明细,并保存!
****************************************/
if wf_setitem_ckd("insertrow") = 1 then
dw_ckds.retrieve(ii_id_ckd)
wf_setitem_ckds(il_ckds_rowcount) //根据出库单的总行数追加表
end if
wf_ckd_refresh(gs_ckdh) //刷新Datastore<ids_ckd>
return 1
else
return 0
end if
end function
on w_dj_new_ckd.create
int iCurrent
call super::create
this.uo_import_text=create uo_import_text
this.uo_edit=create uo_edit
this.uo_face=create uo_face
this.uo_deleterow=create uo_deleterow
this.uo_insertrow=create uo_insertrow
this.uo_exit=create uo_exit
this.uo_end=create uo_end
this.uo_next=create uo_next
this.uo_front=create uo_front
this.uo_top=create uo_top
this.uo_delete=create uo_delete
this.uo_datain=create uo_datain
this.uo_seek=create uo_seek
this.uo_save=create uo_save
this.uo_new=create uo_new
this.dw_ckds=create dw_ckds
this.dw_ckd_null=create dw_ckd_null
iCurrent=UpperBound(this.Control)
this.Control[iCurrent+1]=this.uo_import_text
this.Control[iCurrent+2]=this.uo_edit
this.Control[iCurrent+3]=this.uo_face
this.Control[iCurrent+4]=this.uo_deleterow
this.Control[iCurrent+5]=this.uo_insertrow
this.Control[iCurrent+6]=this.uo_exit
this.Control[iCurrent+7]=this.uo_end
this.Control[iCurrent+8]=this.uo_next
this.Control[iCurrent+9]=this.uo_front
this.Control[iCurrent+10]=this.uo_top
this.Control[iCurrent+11]=this.uo_delete
this.Control[iCurrent+12]=this.uo_datain
this.Control[iCurrent+13]=this.uo_seek
this.Control[iCurrent+14]=this.uo_save
this.Control[iCurrent+15]=this.uo_new
this.Control[iCurrent+16]=this.dw_ckds
this.Control[iCurrent+17]=this.dw_ckd_null
end on

on w_dj_new_ckd.destroy
call super::destroy
destroy(this.uo_import_text)
destroy(this.uo_edit)
destroy(this.uo_face)
destroy(this.uo_deleterow)
destroy(this.uo_insertrow)
destroy(this.uo_exit)
destroy(this.uo_end)
destroy(this.uo_next)
destroy(this.uo_front)
destroy(this.uo_top)
destroy(this.uo_delete)
destroy(this.uo_datain)
destroy(this.uo_seek)
destroy(this.uo_save)
destroy(this.uo_new)
destroy(this.dw_ckds)
destroy(this.dw_ckd_null)
end on

event close;call super::close;//******************************************************************************************
/***************************************************
隶属对象:w_dj_new_ckd
事件名称:close
系统变量:Name Type Explain
返 回 值:long
功能说明:关闭事件,销毁定义的事件my_connect
创建时间:jixiaoyi 2002.7.31
修改时间:
***************************************************/
if ii_myconnect = 1 then //如果数据库连接成功则先断开连接
// messagebox("","disconnet") //测试用JXY
disconnect using my_connect;
end if

Destroy my_connect
Destroy ids_jxc_ckd
Destroy ids_ckd
end event

event open;call super::open;//******************************************************************************************
/***************************************************
隶属对象:w_dj_new_ckd
事件名称:open
系统变量:Name Type Explain
返 回 值:long
功能说明:打开事件,打开延时事件ue_post_open,窗口初始化。
创建时间:jixiaoyi 2002.7.31
修改时间:
***************************************************/
This.Title = "增加出库单"
dw_ckds.settransobject(sqlca)
ids_ckd=Create Datastore
ids_ckd.Dataobject="dw_dj_newckd"
ids_ckd.SetTransObject(sqlca)
is_path = profilestring("main.ini","database","ckdPath",'')
//SetProfileString ("main.ini","database","ckdPath","D:\pb\wkpgl\ckd\")
dw_ckd_null.insertrow(0)

this.postevent("ue_post_open")
end event

event resize;call super::resize;wf_resize()
end event

type uo_import_text from uo_sys_pfc_bmpbutton_down within w_dj_new_ckd
integer x = 2962
integer y = 36
integer taborder = 80
string buttontext = "导入"
string tooltip = "单个文件的导入"
string normalpicturename = "c:\bmp\login_s.bmp"
end type

on uo_import_text.destroy
call uo_sys_pfc_bmpbutton_down::destroy
end on

event clicked;call super::clicked;openwithparm(w_app_dlfw,"importckd")
if Message.DoubleParm = -1 Then
return -1
end if
string ls_msg
ls_msg = Message.Stringparm
Choose Case ls_msg
Case "one"
is_dlfw = "1"
wf_import_text()
Case "all"
is_dlfw = "2"
wf_import_text_all()
End Choose






end event

type uo_edit from uo_sys_pfc_bmpbutton_down within w_dj_new_ckd
integer x = 722
integer y = 36
integer taborder = 90
string buttontext = "修改"
string tooltip = "修改出库单表头内容"
string normalpicturename = "C:\bmp\edit.bmp"
end type

on uo_edit.destroy
call uo_sys_pfc_bmpbutton_down::destroy
end on

回复
skylineman 2003-05-21
up
回复
joss 2003-05-21
public function integer wf_seek_ckdh (string as_ckdh);//******************************************************************************************
/***************************************************
隶属:
对象:Function
名称:wf_seek_ckdh
接口:public
参数:Name Arguments Type Pass By Explain
as_ckdh string value 出库单号
返回:integer 1表示当前表中没有此单号,-1表示已经有此单号
功能:根据传递来的出库单号判断出当前数据库中有无此单号的出库间,
系统不允许增加重复的出库单号,根据检索结果返回值
创建:jixiaoyi 2002.8.1
修改:
***************************************************/
Datastore lds_ckdh
lds_ckdh = Create Datastore
lds_ckdh.DataObject = "ds_dj_seek_ckdh"
lds_ckdh.settransobject(sqlca)
if lds_ckdh.retrieve(as_ckdh) > 0 then
Destroy lds_ckdh
return - 1
else
Destroy lds_ckdh
return 1
end if
end function
public function integer wf_scrolltorow (string as_msg);//******************************************************************************************
/***************************************************
隶属:w_dj_new_ckd
对象:Function
名称:wf_scrolltorow
接口:public
参数:Name Arguments Type Pass By Explain
as_msg string vlaue
返回:integer
功能:根据传来的参数判断是执行四种翻转的其中哪一种
创建:jixiaoyi 2002.8.1
修改:
***************************************************/
if ids_ckd.getrow() < 0 then
messagebox("提示","没有出库单!")
return -1
end if
if wf_ckd_save() = -1 then
// messagebox("错误","当前出库单未能成功保存,不能")
return -1
end if
long ll_row,ll_count
ll_row = ids_ckd.getrow()
ll_count = ids_ckd.rowcount()
Choose Case as_msg
Case "top"
ids_ckd.SetRow(1)
wf_ckd_retrieve()
Case "front"
if ll_row > 1 then
ids_ckd.SetRow(ll_row - 1)
wf_ckd_retrieve()
end if
Case "next"
if ll_count > ll_row then
ids_ckd.SetRow(ll_row + 1)
wf_ckd_retrieve()
end if
Case "end"
ids_ckd.SetRow(ll_count)
wf_ckd_retrieve()
End Choose

return 1
end function

public function integer wf_setitem_ckd (string as_msg);//******************************************************************************************
/***************************************************
隶属:w_dj_new_ckd
对象:Function
名称:wf_setitem_ckd
接口:public
参数:Name Arguments Type Pass By Explain
as_msg string vlaue 区别变量
返回:integer 1 表示成功, - 1表示失败
功能:根据参数判断是修改数据还是追加数据,并数据赋进ids_ckd中。
创建:jixiaoyi 2002.8.1
修改:2002.8.2
***************************************************/
long ll_row
Choose Case as_msg
Case "insertrow"
ll_row = ids_ckd.insertrow(0)
Case "editrow"
ll_row = ids_ckd.getrow()
End Choose
ids_ckd.setitem(ll_row,"ckdh",gs_ckdh)
ids_ckd.setitem(ll_row,"ckdate",datetime(gd_ckdate))
ids_ckd.setitem(ll_row,"xhdw",gs_xhdw)
ids_ckd.setitem(ll_row,"xhdwbh",gs_xhdwbh)
ids_ckd.setitem(ll_row,"zb",gs_zb)
ids_ckd.setitem(ll_row,"dgdh",gs_dgdh)
if ids_ckd.update() > 0 then
ii_id_ckd = ids_ckd.object.id[ll_row]
Commit ;
return 1
else
rollback ;
if as_msg = "insertrow" then
ids_ckd.deleterow(ll_row)
if ids_ckd.update() < 0 then
messagebox("系统错误","新增加的表头记录没能删除掉!,请检查数据库!")
return -1
end if
end if
messagebox("错误","没能保存到表头中!")
return - 1
end if

end function

public function integer wf_setitem_ckds (long al_rowcount);//******************************************************************************************
/***************************************************
隶属:w_dj_new_ckd
对象:Function
名称:wf_setitem_ckds
接口:public
参数:Name Arguments Type Pass By Explain
al_rowcount long value 明细最大行数
返回:integer
功能:利用循环设置明细表数据,数据从JXC中取来
创建:jixiaoyi 2002.8.23
修改:
***************************************************/
long ll_i,ll_row
for ll_i = 1 to al_rowcount
ll_row = dw_ckds.insertrow(0)
//messagebox(string(ll_row),string(ii_id_ckd))
//dw_ckds.setitem(ll_row,"headid",long(ii_id_ckd))
dw_ckds.object.headid[ll_row] = ii_id_ckd //保存表头的ID
dw_ckds.object.lb[ll_row] = Trim(is_lb[ll_i])
dw_ckds.object.xh[ll_row] = Trim(is_xh[ll_i])
dw_ckds.object.flpm[ll_row] = Trim(is_flpm[ll_i])
dw_ckds.object.gg[ll_row] = Trim(is_gg[ll_i])
dw_ckds.object.hw[ll_row] = Trim(is_hw[ll_i])
dw_ckds.object.sh[ll_row] = Trim(is_sh[ll_i])
dw_ckds.object.gd[ll_row] = Trim(is_gd[ll_i])
dw_ckds.object.dw[ll_row] = Trim(is_dw[ll_i])
dw_ckds.object.cksl[ll_row] = idec_cksl[ll_i]
dw_ckds.object.ckdj[ll_row] = idec_ckdj[ll_i]
next

if dw_ckds.update() > 0 then
commit;
return 1
else
Rollback;
messagebox("出错","系统没能保存明细数据!")
return - 1
end if

end function

public function integer wf_import_text_all ();//成批导入出库单
openwithparm(w_app_import_fw,"importckd")
if Message.DoubleParm = -1 Then
return -1
end if
integer li_all,li_import
long ll_n
li_all = 0
li_import = 0
Setpointer(hourglass!)
this.setredraw(false)
for ll_n = gl_ckdh_from to gl_ckdh_to
if wf_import_text_item(string(ll_n)) =1 then
li_import = li_import +1
end if
li_all= li_all +1
next
this.setredraw(true)
Setpointer(Arrow!)
if li_all = li_import then
messagebox("提示","全部出库单导入均成功!~r~n共有"+string(li_all)+"张出库单导入!")
else
if li_import = 0 then
messagebox("导入失败","没能导入出库单!")
else
messagebox("导入结束!","部分出库单被导入!~r~n输入的范围共计:"+string(li_all)+&
"张出库单!~r~n共计导入出库单:"+string(li_import)+"张!")
end if
end if

return 1

end function

public function integer wf_import_text_item (string as_msg);string ls_msg
ls_msg = trim(as_msg)
if wf_seek_ckdh(ls_msg) = - 1 then
// messagebox("错误","系统中已经有此号码的出库单!")
return -1
end if

string ls_ckdh
long ll_row,ll_i,ll_len
ll_len = len(ls_msg) //得到长度
ll_i = 11 - ll_len + 1 //开始截取的位置
ls_ckdh = replace(space(11),ll_i,ll_len,ls_msg) //得到截取替换后的位置

integer li_seek_ckd //查询出库单函数wf_seek_jxc_ckd的返回值
li_seek_ckd = wf_seek_ckdh_text(ls_msg)

if li_seek_ckd > 0 then

// if messagebox("提示","你真的要导入<"+ls_msg+">号出库单吗?",Question!,OKCancel!,2) = 2 then
// return -1
// end if
Datastore lds_text
lds_text = Create Datastore
lds_text.Dataobject="ds_dj_ckd_import"
lds_text.settransobject(sqlca)
lds_text.retrieve()
lds_text.ImportFile(is_filename)
il_ckds_rowcount = lds_text.rowcount()

if il_ckds_rowcount = 0 then
messagebox("导入出错","["+ls_msg+"]号出库单导入数据为空!导入数据失败!")
return -1
end if

is_lb = lds_text.object.lb[1,il_ckds_rowcount] //取明细内容
is_xh = lds_text.object.xh[1,il_ckds_rowcount]
is_flpm = lds_text.object.flpm[1,il_ckds_rowcount]
is_gg = lds_text.object.gg[1,il_ckds_rowcount]
is_hw = lds_text.object.hw[1,il_ckds_rowcount]
is_sh = lds_text.object.sh[1,il_ckds_rowcount]
is_gd = lds_text.object.gd[1,il_ckds_rowcount]
is_dw = lds_text.object.dw[1,il_ckds_rowcount]
idec_cksl = lds_text.object.ik5[1,il_ckds_rowcount]
idec_ckdj = lds_text.object.xsdj[1,il_ckds_rowcount]

gs_ckdh = ls_msg
string ls_date
ls_date = lds_text.object.rq[1]
gd_ckdate = date(long(mid(ls_date,7,2)),long(mid(ls_date,1,2)),long(mid(ls_date,4,2)))
// gd_ckdate = lds_text.getitemDate(1,"rq") //取表头内容
// messagebox("",string(gd_ckdate)+"1111111")

gs_xhdw = lds_text.getitemstring(1,"khmc")
gs_xhdwbh = lds_text.getitemstring(1,"khbh")
gs_zb = lds_text.getitemstring(1,"zb")
gs_dgdh = lds_text.getitemstring(1,"ddh")
wf_setitem_ckd_null()
回复
joss 2003-05-21
public function integer wf_setitem_ckd_null ();//******************************************************************************************
/***************************************************
隶属:w_dj_new_ckd
对象:Function
名称:wf_setitem_ckd_null
接口:public
参数:Name Arguments Type Pass By Explain
返回:integer
功能:设置空表头中的记录,
创建:jixiaoyi 2002.8.1
修改:2002.9.3
***************************************************/
if dw_ckd_null.getrow() < 1 then
messagebox("错误","出库单没有增加,不能进行操作!")
return 0
end if
dw_ckd_null.setitem(1,"ckdh",gs_ckdh)
dw_ckd_null.setitem(1,"ckdate",gd_ckdate)
dw_ckd_null.setitem(1,"xhdw",gs_xhdw)
dw_ckd_null.setitem(1,"xhdwbh",gs_xhdwbh)
dw_ckd_null.setitem(1,"zb",gs_zb)
dw_ckd_null.setitem(1,"dgdh",gs_dgdh)
return 1
end function

public function integer wf_importckd (string as_msg);//******************************************************************************************
/***************************************************
隶属:w_dj_new_ckd
对象:Function
名称:wf_importckd
接口:public
参数:Name Arguments Type Pass By Explain
as_msg string value 传递来的出库单号
返回:integer
功能:根据返回值出库单号,进行系列判断,执行导入JXC系统出库单程序
创建:jixiaoyi 2002.8.1
修改:2002.8.23
***************************************************/
if wf_seek_ckdh(as_msg) = - 1 then
messagebox("错误","系统中已经有此号码的出库单!")
return 0
end if

string ls_ckdh
long ll_row,ll_i,ll_len
ll_len = len(as_msg) //得到长度
ll_i = 11 - ll_len + 1 //开始截取的位置
ls_ckdh = replace(space(11),ll_i,ll_len,as_msg) //得到截取替换后的位置

integer li_seek_ckd //查询出库单函数wf_seek_jxc_ckd的返回值
li_seek_ckd = wf_seek_jxc_ckd(ls_ckdh)
if li_seek_ckd > 0 then
if messagebox("提示","你真的要导入<"+as_msg+">号出库单吗?",Question!,OKCancel!,2) = 2 then
return -1
end if
il_ckds_rowcount = ids_jxc_ckd.rowcount()
wf_getitem_ckds()
gs_ckdh = as_msg
gd_ckdate = ids_jxc_ckd.getitemDate(1,"rq")
gs_xhdw = ids_jxc_ckd.getitemstring(1,"khmc")
gs_xhdwbh = ids_jxc_ckd.getitemstring(1,"khbh")
gs_zb = ids_jxc_ckd.getitemstring(1,"zb")
gs_dgdh = ids_jxc_ckd.getitemstring(1,"ddh")
wf_setitem_ckd_null() //设置空表头
/***************************************
接下来的步骤:
1、设置表头[INSERTROW(0)]
2、保存表头并取出新保存后得到的id赋到ii_id_ckd中
3、增加表明细,并保存!
****************************************/
if wf_setitem_ckd("insertrow") = 1 then
dw_ckds.retrieve(ii_id_ckd)
wf_setitem_ckds(il_ckds_rowcount) //根据出库单的总行数追加表
end if
if li_seek_ckd = 2 then //假如 qycksj和ipss同时有该出库单号则再追加qycksj中的记录
ids_jxc_ckd.DataObject = "ds_dj_ckd_jxc"
ids_jxc_ckd.settransobject(my_connect)
ids_jxc_ckd.retrieve(ls_ckdh)
il_ckds_rowcount = ids_jxc_ckd.rowcount()
wf_getitem_ckds()
wf_setitem_ckds(il_ckds_rowcount)
end if
wf_ckd_refresh(gs_ckdh) //刷新Datastore<ids_ckd>
else
messagebox("提示","当前进销存系统没有<"+as_msg+">号出库单!")
return 0
end if

return 1
end function

public function integer wf_connectdatabase ();//******************************************************************************************
/***************************************************
隶属:w_dj_new_ckd
对象:Function
名称:wf_connectdatabase
接口:public
参数:Name Arguments Type Pass By Explain
返回:integer
功能:连接进销存DBF文件数据库,判断事务是否成功,成功则返回1否则返回-1
创建:jixiaoyi 2002.7.31
修改:
***************************************************/

my_connect = Create transaction

//// Profile jxc
//my_connect.DBMS = "ODBC"
//my_connect.AutoCommit = False
//my_connect.DBParm = "ConnectString='DSN=qycksj;UID=dba;PWD=sql'"

// Profile jxc
my_connect.DBMS = "ODBC"
my_connect.AutoCommit = False
my_connect.DBParm = "ConnectString='DSN=jxc;UID=dba;PWD=sql'"

connect using my_connect;

if my_connect.sqlcode <> 0 then
ii_myconnect = 0
return -1
else
ii_myconnect = 1
return 1
end if
end function

public function integer wf_ckd_refresh (string as_ckdh);//******************************************************************************************
/***************************************************
隶属:w_dj_new_ckd
对象:Function
名称:wf_ckd_refresh
接口:public
参数:Name Arguments Type Pass By Explain
as_ckdh stirng value 出库单号
返回:integer
功能:当导入或增加出库后,应当刷新一个窗口,使插入数据放在合理的位置
根据新插入的出库单号,设置焦点
注意,这里不需要将dw_ckds 和dw_ckd_null数据窗口刷新,只要把Datastore刷新便可
创建:jixiaoyi 2002.8.2
修改:
***************************************************/
if ids_ckd.getrow() <1 then
messagebox("提示","当前出库单没有记录,不用刷新!")
return -1
end if
ids_ckd.retrieve(0,"1")
long ll_found
ll_found = ids_ckd.Find( "ckdh = '"+as_ckdh+"' ", 1, ids_ckd.RowCount())
if ll_found > 0 then //找到
ids_ckd.setrow(ll_found)
return 1
else //未找到
messagebox("提示","没有查到相关条件的出库单!")
return -1
end if
end function

public function integer wf_seek_jxc_ckd (string as_ckdh);//******************************************************************************************
/***************************************************
隶属:w_dj_new_ckd
对象:Function
名称:wf_seek_jxc_ckd
接口:public
参数:Name Arguments Type Pass By Explain
as_ckdh string value 出库单号
返回:integer 返回1表示有,返回-1表示没有
功能:查找进销存中有无指定的出库单
创建:jixiaoyi 2002.8.23
修改:
***************************************************/
long ll_row
//假如qycksj表中没有该出库单,再查找ipss中无该出库单
ids_jxc_ckd.DataObject = "ds_dj_ckd_jxc"
ids_jxc_ckd.settransobject(my_connect)
ids_jxc_ckd.retrieve(as_ckdh)
ll_row = ids_jxc_ckd.rowcount()
if ll_row < 1 then //在qycksj中没找到
ids_jxc_ckd.DataObject = "ds_dj_ckd_jxc_ipss"
ids_jxc_ckd.settransobject(my_connect)
ids_jxc_ckd.retrieve(as_ckdh)
ll_row = ids_jxc_ckd.rowcount()
if ll_row < 1 then //在ipss中也没找到
return -1
else
return 1
end if
else //qycksj中有该出库单,再判断ipss中有没有此出库单
ids_jxc_ckd.DataObject = "ds_dj_ckd_jxc_ipss"
ids_jxc_ckd.settransobject(my_connect)
ids_jxc_ckd.retrieve(as_ckdh)
ll_row = ids_jxc_ckd.rowcount()
if ll_row > 0 then //在ipss中也有!!!
messagebox("错误","该出库单同时出现在qycksj和ipss两个表中!!!")
return 2
else //正常情况,转回至qycksj表下
ids_jxc_ckd.DataObject = "ds_dj_ckd_jxc"
ids_jxc_ckd.settransobject(my_connect)
ids_jxc_ckd.retrieve(as_ckdh)
return 1
end if
end if


end function

public function integer wf_seek_ckdh_text (string as_ckdh);//******************************************************************************************
/***************************************************
隶属:w_dj_new_ckd
对象:Function
名称:wf_seek_ckdh_text
接口:public
参数:Name Arguments Type Pass By Explain
as_ckdh string value
返回:integer
功能:查找有无出库单存在<.txt>有则返回1,没有存在则返回0
创建:jixiaoyi 2002.9.2
修改:
***************************************************/
string ls_filename
boolean lb_exist
ls_filename = is_path + as_ckdh +".TxT"
is_filename = ls_filename
is_ckdh = as_ckdh
lb_exist = FileExists(ls_filename)
IF lb_exist THEN
return 1
Else
if is_dlfw = "1" then
messagebox("错误","没有找到文件<"+as_ckdh+".txt>,无法导入出库单!")
end if
return 0
End If

end function


回复
joss 2003-05-21
public function integer wf_ckd_delete ();//******************************************************************************************
/***************************************************
隶属:w_dj_new_ckd
对象:Function
名称:wf_ckd_delete
接口:public
参数:Name Arguments Type Pass By Explain
返回:integer
功能:删除当前出库单
创建:jixiaoyi 2002.8.1
修改:
***************************************************/
if ids_ckd.getrow() < 0 then
messagebox("错误","没有内容,不能删除!")
return 0
end if
ii_id_ckd = ids_ckd.getitemnumber(ids_ckd.getrow(),"id")
gs_ckdh = ids_ckd.getitemstring(ids_ckd.getrow(),"ckdh")

if messagebox("提示","真的要删除<"+gs_ckdh+">号出库单吗?",Question!,OKCancel!,2) = 2 then
return 0
end if
delete from u_dj_ckds
where headid = :ii_id_ckd ;
//if sqlca.sqlcode > 0 then
ids_ckd.deleterow(ids_ckd.getrow())
if ids_ckd.update() > 0 then
wf_ckd_retrieve()
messagebox("提示","出库单删除完毕!")
return 1
else
messagebox("错误","没能删除出库单<表头>!")
return -1
end if
//else
//messagebox("错误","没有删除出库单<表体>!")
//return -1
//end if

end function

public function integer wf_ckd_seek ();//******************************************************************************************
/***************************************************
隶属:w_dj_new_ckd
对象:Function
名称:wf_ckd_seek
接口:public
参数:Name Arguments Type Pass By Explain
返回:integer
功能:执行查找出库单功能
创建:jixiaoyi 2002.8.2
修改:
***************************************************/
long ll_found,ll_row
ll_row = ids_ckd.getrow()
if ll_row > 0 then
if wf_ckd_save() = 1 then
ii_id_ckd = ids_ckd.object.id[ll_row]
else
return -1
end if
else
messagebox("错误","当前没有未审核出库单,无法查找!")
return -1
end if
openwithparm(w_sys_dj,"seekckd")
if Message.DoubleParm = -1 Then
return 0
end if
string ls_msg
ls_msg = Message.Stringparm
ll_found = ids_ckd.Find( &
"ckdh = '"+ls_msg+"' ", &
1, ids_ckd.RowCount())
if ll_found > 0 then //找到
ids_ckd.setrow(ll_found)
wf_ckd_retrieve()
return 1
else //未找到
messagebox("提示","没有查到相关条件的出库单!")
return -1
end if
end function

public function integer wf_ckd_retrieve ();//******************************************************************************************
/***************************************************
隶属:w_dj_new_ckd
对象:Function
名称:wf_ckd_retrieve
接口:public
参数:Name Arguments Type Pass By Explain
返回:integer
功能:检索出当前未审出库单
创建:jixiaoyi 2002.8.2
修改:2002.8.23
***************************************************/
if ids_ckd.getrow() < 1 then
dw_ckd_null.retrieve()
dw_ckd_null.insertrow(0)
dw_ckds.retrieve(0)
messagebox("提示","没有未审核出库单!")
return -1
end if

long ll_row
ll_row = ids_ckd.getrow()
dw_ckd_null.setitem(1,"ckdh",ids_ckd.getitemstring(ll_row,"ckdh"))
dw_ckd_null.setitem(1,"ckdate",ids_ckd.getitemdatetime(ll_row,"ckdate"))
dw_ckd_null.setitem(1,"xhdw",ids_ckd.getitemstring(ll_row,"xhdw"))
dw_ckd_null.setitem(1,"xhdwbh",ids_ckd.getitemstring(ll_row,"xhdwbh"))
dw_ckd_null.setitem(1,"zb",ids_ckd.getitemstring(ll_row,"zb"))
dw_ckd_null.setitem(1,"dgdh",ids_ckd.getitemstring(ll_row,"dgdh"))
dw_ckds.retrieve(ids_ckd.getitemnumber(ll_row,"id"))
//messagebox("",string(ll_row))
return 1


end function

public function integer wf_ckd_new ();//******************************************************************************************
/***************************************************
隶属:w_dj_new_ckd
对象:Function
名称:wf_ckd_new
接口:public
参数:Name Arguments Type Pass By Explain
返回:integer
功能:手工新增加出库单,针对JXC中没有的出库单的情况!
创建:jixiaoyi 2002.8.1
修改:2002.8.23
***************************************************/
if ids_ckd.getrow() > 0 then //假如出库单表头有记录,则执行表体保存。
if wf_ckd_save() = -1 then //假如当前出库表休不能正常保存,可能应为无记录!则不能增加出库
return -1
end if
end if
openwithparm(w_sys_ckd_sj,"newckd")
if message.DoubleParm = 1 then //选择确定按钮
if wf_seek_ckdh(gs_ckdh) = - 1 then
messagebox("错误","系统中已经有此号码的出库单!")
return -1
end if
wf_setitem_ckd_null()
if wf_setitem_ckd("insertrow") = 1 then //假如设置表头并保存成功则检索明细数据窗口
dw_ckds.retrieve(ii_id_ckd)
wf_ckd_refresh(gs_ckdh) //刷新Datastore<ids_ckd>
else
messagebox("错误","没有增加到出库单")
end if
return 1
else //选择取消按钮
return -1
end if
end function

public function integer wf_getitem_ckds ();//******************************************************************************************
/***************************************************
隶属:w_dj_new_ckd
对象:Function
名称:wf_getitem_ckds
接口:public
参数:Name Arguments Type Pass By Explain
返回:integer
功能:将JXC中相应的出库数据赋予变量组
创建:jixiaoyi 2002.8.1
修改:
***************************************************/
is_lb = ids_jxc_ckd.object.lb[1,il_ckds_rowcount]
is_xh = ids_jxc_ckd.object.xh[1,il_ckds_rowcount]
is_flpm = ids_jxc_ckd.object.flpm[1,il_ckds_rowcount]
is_gg = ids_jxc_ckd.object.gg[1,il_ckds_rowcount]
is_hw = ids_jxc_ckd.object.hw[1,il_ckds_rowcount]
is_sh = ids_jxc_ckd.object.sh[1,il_ckds_rowcount]
is_gd = ids_jxc_ckd.object.gd[1,il_ckds_rowcount]
is_dw = ids_jxc_ckd.object.dw[1,il_ckds_rowcount]
idec_cksl = ids_jxc_ckd.object.ik5[1,il_ckds_rowcount]
idec_ckdj = ids_jxc_ckd.object.xsdj[1,il_ckds_rowcount]
return 1
end function
public subroutine wf_resize ();//******************************************************************************************
/***************************************************
隶属:w_dj_new_ckd
对象:Function
名称:wf_resize
接口:public
参数:Name Arguments Type Pass By Explain
返回:none
功能:自动编排窗口,使窗口美观
创建:jixiaoyi 2002.8.1
修改:2002.9.3
***************************************************/

integer li_bar=15,li_h,li_w //height,width
integer li_hthick,li_vthick //水平厚度,垂直厚度 //按钮间
long ll_width,ll_height //窗口高度宽度变量

li_h=uo_new.height
li_w=uo_new.width

///=======调整窗口最小有限制

ll_Width = this.WorkSpaceWidth() //宽度等于窗口宽度
ll_Height = this.WorkspaceHeight() //高度等于窗口高度
//注意用户对象按钮大小调整要在编程时调整,不能动态生成
//=======
uo_datain.move(li_bar*4,li_bar)
uo_save.move(uo_datain.x+li_w , li_bar)
uo_new.move(uo_save.x+li_w , li_bar)
uo_edit.move(uo_new.x+li_w , li_bar)
uo_seek.move(uo_edit.x+li_w , li_bar)
uo_delete.move(uo_seek.x+li_w , li_bar)
uo_import_text.move(uo_delete.x+li_w , li_bar)
uo_insertrow.move(uo_import_text.x+li_w , li_bar)
uo_deleterow.move(uo_insertrow.x+li_w , li_bar)
uo_top.move(uo_deleterow.x+li_w , li_bar)
uo_front.move(uo_top.x+li_w , li_bar)
uo_next.move(uo_front.x+li_w , li_bar)
uo_end.move(uo_next.x+li_w , li_bar)
uo_exit.move(uo_end.x+li_w , li_bar)

uo_face.resize(ll_width - li_bar*8 , ll_height - li_bar*8 - uo_new.y - li_h)
uo_face.move(li_bar*4 ,uo_new.y + li_h + li_bar*4)
uo_face.uf_resize(uo_face.width,uo_face.height)

end subroutine


回复
fmilan 2003-05-20
其实就是用datastore实现不同的数据库系统之间的数据交换;另外请教可否用两个datastore进行数据共享?谁有这方面的示例代码,谢谢了
回复
相关推荐
发帖
PowerBuilder
创建于2007-09-28

865

社区成员

PowerBuilder 相关问题讨论
申请成为版主
帖子事件
创建了帖子
2003-05-20 03:23
社区公告
暂无公告