如我现在准备导入的文件有10条数据,有3条数据是与现在的数据库重复的,而且该文件本身就要3条数据重复,在导入时如何写代码判断出这些重复并记录下来和显示出来?请高手指教
/***********************************************
function : wf_itemcheck
author : baoshuai
create : 2006.09.08
des : 导入物质空值和唯一性检查
***********************************************/
string ls_pm,ls_cz,ls_gg,ls_cd,ls_ck,ls_cch,ls_rkph,ls_mdh,ls_kbh
string ls_jlfs,ls_wzly,ls_bz,ls_sl1,ls_sl2,ls_cph,ls_lph,ls_jbh,ls_jjdw
string ls_msg
long ll_row
dec lde_sl1,lde_sl2
datetime ldt_drrq
ldt_drrq = f_get_sysdate()
if al_rowcount <= 0 then return 0
for ll_row = 1 to al_rowcount
ls_pm = dw.object.pm_[ll_row]
if isnull(ls_pm) then
ls_msg = '第['+string(ll_row)+']行导入物资的品名不允许为空'
messagebox('提示',ls_msg)
return 0
end if
ls_cz = dw.object.cz_[ll_row]
if isnull(ls_cz) then
ls_msg = '第['+string(ll_row)+']行导入物资的材质不允许为空'
messagebox('提示',ls_msg)
return 0
end if
ls_gg = dw.object.gg_[ll_row]
if isnull(ls_gg) then
ls_msg = '第['+string(ll_row)+']行导入物资的规格不允许为空'
messagebox('提示',ls_msg)
return 0
end if
ls_cd = dw.object.cd_[ll_row]
if isnull(ls_cd) then
ls_msg = '第['+string(ll_row)+']行导入物资的产地不允许为空'
messagebox('提示',ls_msg)
return 0
end if
ls_ck = dw.object.ck_[ll_row]
if isnull(ls_ck) then
ls_msg = '第['+string(ll_row)+']行导入物资的仓库不允许为空'
messagebox('提示',ls_msg)
return 0
end if
ls_rkph = dw.object.rkph_[ll_row]
if isnull(ls_rkph) then
ls_msg = '第['+string(ll_row)+']行导入物资的入库批号不允许为空'
messagebox('提示',ls_msg)
return 0
end if
ls_cch = dw.object.cch_[ll_row]
if isnull(ls_cch) then
ls_msg = '第['+string(ll_row)+']行导入物资的仓储号不允许为空'
messagebox('提示',ls_msg)
return 0
end if
ls_mdh = dw.object.mdh_[ll_row]
if isnull(ls_mdh) then
ls_msg = '第['+string(ll_row)+']行导入物资的码单号不允许为空'
messagebox('提示',ls_msg)
return 0
end if
long ll_count,ll_row1,ll_cnt=0
for ll_row1 = 1 to ll_row -1
if ls_mdh = dw.object.mdh_[ll_row1] then ll_cnt += 1
next
select count(1) into :ll_count from jy_kc_wzdr where htfphm_ = :ls_mdh;
if ll_count > 0 or ll_cnt > 0 then
ls_msg = '第['+string(ll_row)+']行导入物资的码单号:“'+ls_mdh+'”数据库中已经存在。'
messagebox('提示',ls_msg)
return 0
end if
ls_sl1 = dw.object.sl1_[ll_row]
lde_sl1 = dec(trim(ls_sl1))
ls_sl2 = dw.object.sl2_[ll_row]
lde_sl2 = dec(trim(ls_sl2))
if isnull(lde_sl2) then lde_sl2 = 0
if lde_sl2 = 0 then
ls_msg = '第['+string(ll_row)+']行导入物资的入库重量不允许为“0”'
messagebox('提示',ls_msg)
return 0
end if
ls_jjdw = dw.object.jjdw_[ll_row]
if isnull(ls_jjdw) then
ls_msg = '第['+string(ll_row)+']行导入物资的记件单位不允许为空'
messagebox('提示',ls_msg)
return 0
end if
ls_jlfs = dw.object.jlfs_[ll_row]
if isnull(ls_jlfs) then
ls_msg = '第['+string(ll_row)+']行导入物资的计量方式不允许为空'
messagebox('提示',ls_msg)
return 0
end if
next
return 1
我写的代码,供参考