这个是保存按钮代码,uid=thisform.uid.value
text1=ALLTRIM(UPPER(thisform.text1.Value))
text2=ALLTRIM(thisform.text2.Value)
text2=CHRTRAN(text2,"'",'"')
text3=ALLTRIM(UPPER(thisform.text3.Value))
text4=ALLTRIM(thisform.text4.Value)
text4=CHRTRAN(text4,"'",'"')
text5=ALLTRIM(UPPER(thisform.text5.Value))
text6=ALLTRIM(UPPER())
text7=ALLTRIM(UPPER(thisform.text7.Value))
text8=ALLTRIM(thisform.text8.Value)
text9=ALLTRIM()
lcTextString=(thisform.pageframe1.page1.text1.Value)
ImageName=JUSTFNAME(thisform.pageframe1.page1.text1.Value)
ImagePath=Strconv(Filetostr(lcTextString),13)&&
*************外购标准件和电子电气类必须输入厂牌
IF (text6='外购标准件' OR text6='电子电气') AND EMPTY(text8) then
MESSAGEBOX(text6+"必须指定厂牌!",64,"提示")
RETURN
ENDIF
*************
IF EMPTY(text6)
text6=ALLTRIM(thisform.text6.value)
ENDIF
IF LEN(text1)<>12 then
MESSAGEBOX("物料代码长度应该为12位!",48,"提示")
RETURN
ENDIF
IF EMPTY(text2) then
MESSAGEBOX("物料名称为空!",48,"提示")
thisform.text2.SetFocus
RETURN
ENDIF
IF EMPTY(text4) then
MESSAGEBOX("型号规格!",48,"提示")
thisform.text4.SetFocus
RETURN
ENDIF
IF EMPTY(text5) then
MESSAGEBOX("请输入物料的单位!",48,"提示")
thisform.text5.SetFocus
RETURN
ENDIF
IF uid=0 then
IF EMPTY(text3)=.f.
xsql="select * from jbwl where 图号=?text3"
SQLEXEC(x_conn,xsql,"cxtu")
SELECT cxtu
IF RECCOUNT()>0
MESSAGEBOX("图号重复!",48,"提示")
USE
RETURN
ELSE
SELECT cxtu
USE
ENDIF
ENDIF
xsql="物料代码='"+text1+"'"
sql="select 物料代码 from jbwl where &xsql"
SQLEXEC(x_conn,sql,"abc")
SELECT abc
COUNT TO jls
IF jls>0 then
MESSAGEBOX("物料代码重复!",48,"提示")
USE
RETURN
ELSE
SELECT abc
USE
sql="insert into jbwl(物料代码,物料名称,图号,型号规格,单位,物料类别,日期,录入,相片名称,相片,备注,厂牌,二级分类) values(?text1,?text2,?text3,?text4,?text5,?text6,?transform(DATE()),?zdr,?ImageName,?ImagePath,?text7,?text8,?text9)"
SQLEXEC(x_conn,sql)
SQL="select uid from jbwl where 物料代码='"+text1+"'"
SQLEXEC(x_conn,sql,'idcx')
SELECT idcx
cid=uid
INSERT INTO Tb20170221(物料代码,物料名称,图号,型号规格,单位,物料类别,uid,录入,日期,相片名称,相片,备注,厂牌,二级分类) values(text1,text2,text3,text4,text5,TEXT6,cid,zdr,TRANSFORM(DATE()),ImageName,ImagePath,text7,text8,text9)
thisform.Release
*!* sql_jbwl.datainit.click
ENDIF
ENDIF
IF uid>0 THEN &&修改指令
xsql="物料代码='"+text1+"'"
sql="update jbwl set 物料名称=?text2,图号=?text3,型号规格='"+text4+"',单位='"+text5+"',物料类别='"+text6+"',相片名称=?ImageName,相片=?ImagePath,备注=?text7,厂牌=?text8,二级分类=?text9 where "+xsql
SQLEXEC(x_conn,sql)
xsql="update kcsl_s set 物料名称='"+text2+"',型号规格='"+text4+"',单位='"+text5+"',物料类别=?text6 where "+xsql
SQLEXEC(x_conn,xsql)
UPDATE Tb20170221 set 物料名称=text2,图号=text3,型号规格=text4,单位=text5,物料类别=text6,相片名称=ImageName,相片=ImagePath,备注=text7,厂牌=text8,二级分类=text9 WHERE 物料代码=text1
thisform.Release
*!* sql_jbwl.datainit.click
ENDIF
想再禁用后面加代码,让后面请购单都引用不了这个物料,以前请购过得不影响查看。