PB实现库房台账模糊查询功能
俗话说,天下PB一般丑,←我说的。
PB做出来的界面是真的丑。。先给一张图吧
简单的不能再简单了,那个tab可以更美观一点,公司的人都是干了十七八年PB的老员工,问他们这些也不太好意思,是那么回事就行了,反正实现的功能一样。。美观。。是给客户看的又不是我。。要改再说。
没写多少函数,至于这些函数干什么的,每个公司跟每个公司都不一样,有需要的话我可以分享给大家。
写下模糊查询吧,可能大家比较在意怎么实现拼接语句,库房的人总不能一打开台账全部的单子都查的吧。
dwo的语法就是 select * from table 没有where条件。没有入参
投机取巧了,where条件是写了一个字符串哈哈哈,反正客户看不见。。。。。
String ls_input
String is_sqlwhere,ls_sqlstr,newSql
int stime,etime
is_sqlwhere =' Where db_center='+"'"+gs_dbname+"'"
//====================================================================
// 检测是否含有'号
//====================================================================
//IF Pos(sle_input.Text,"'") > 0 THEN
// RETURN
//END IF
//
//
//====================================================================
// 查询条件
//====================================================================
// ls_input = Trim(sle_input.Text)
//po
IF cbx_po.Checked THEN
if len(ls_sqlstr) > 0 then
ls_sqlstr += " and INV_WarehouseAccount.po_sn like N'%"+Trim(sle_po.Text) +"%' "
else
ls_sqlstr = " and INV_WarehouseAccount.po_sn like N'%"+Trim(sle_po.Text) +"%' "
end if
END IF
//material code
IF cbx_mc.Checked THEN
if len(ls_sqlstr) > 0 then
ls_sqlstr += " and INV_WarehouseAccount.Item_code like N'%"+Trim(sle_mc.Text) +"%' "
else
ls_sqlstr = " and INV_WarehouseAccount.Item_code like N'%"+Trim(sle_mc.Text) +"%' "
end if
END IF
//Material Name
IF cbx_mn.Checked THEN
if len(ls_sqlstr) > 0 then
ls_sqlstr += " and INV_WarehouseAccount.Material_Name like N'%"+Trim(sle_mn.Text) +"%' "
else
ls_sqlstr = " and INV_WarehouseAccount.Material_Name like N'%"+Trim(sle_mn.Text) +"%' "
end if
END IF
///warehouse
IF cbx_warehouse.Checked THEN
if len(ls_sqlstr) > 0 then
ls_sqlstr += " and INV_WarehouseAccount.warehouse_sn like N'%"+Trim(sle_warehouse.Text) +"%' "
else
ls_sqlstr = " and INV_WarehouseAccount.warehouse_sn like N'%"+Trim(sle_warehouse.Text) +"%' "
end if
END IF
//bin
IF cbx_bin.Checked THEN
if len(ls_sqlstr) > 0 then
ls_sqlstr += " and INV_WarehouseAccount.Bin_sn like N'%"+Trim(sle_bin.Text) +"%' "
else
ls_sqlstr = " and INV_WarehouseAccount.Bin_sn like N'%"+Trim(sle_bin.Text) +"%' "
end if
END IF
//date
IF cbx_date.Checked THEN
stime = len(sle_stime.text)
etime = len(sle_etime.text)
if stime>0 and etime=0 then
if len(ls_sqlstr) > 0 then
ls_sqlstr +="and INV_WarehouseAccount.create_date >='"+Trim(sle_stime.text)+"'"
else
ls_sqlstr ="and INV_WarehouseAccount.create_date >='"+Trim(sle_stime.text)+"'"
end if
end if
if stime=0 and etime>0 then
if len(ls_sqlstr) > 0 then
ls_sqlstr +="and INV_WarehouseAccount.create_date <='"+Trim(sle_etime.text)+"'"
else
ls_sqlstr ="and INV_WarehouseAccount.create_date <='"+Trim(sle_etime.text)+"'"
end if
end if
if stime>0 and etime>0 then
if len(ls_sqlstr) > 0 then
ls_sqlstr +="and INV_WarehouseAccount.create_date between'"+Trim(sle_stime.text)+"'"+" and '"+Trim(sle_etime.text)+"'"
else
ls_sqlstr ="and INV_WarehouseAccount.create_date between'"+Trim(sle_stime.text)+"'"+" and '"+Trim(sle_etime.text)+"'"
end if
//todo change time swap
end if
END IF
//====================================================================
// 检索数据
//====================================================================
dw_list.setredraw(false)
newSql = oldSql + is_sqlwhere + ls_sqlstr +" order by INV_WarehouseAccount.po_sn,INV_WarehouseAccount.item_code,INV_WarehouseAccount.batch_no;"
dw_list.setsqlselect(newSql)
//newSql=dw_list.getsqlselect( )
dw_list.retrieve()
dw_list.setredraw(true)