本文主要是介绍(tiptop erp)跨营运中心批量更新没有成本要素值记录的料件,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
直接上代码:
4fd文件
<?xml version="1.0" encoding="UTF-8" ?>
<Form CHECKSUM="-1" database_name="ds" fourSTFile="" gstVersion="11401" height="1" lstrtext="false" lstrtoallcomment="false" lstrtoallitem="false" lstrtoalltext="false" lstrtoalltitle="false" name="cima109" posX="0" posY="0" spacing="normal" text="cima109" width="35">
<Grid fontPitch="default" height="1" hidden="--------" lstrcomment="false" name="gr8" posX="0" posY="0" width="35">
<Text height="1" name="text7" posX="1" posY="0" text="dsno" width="5"/>
<FormField colName="dsnumber" fieldtype="FORM_ONLY" name="dsnumber" sqlTabName="formonly">
<ButtonEdit action="controlp" autoNext="--------" case="NONE" century="R" color="black" colorCondition="black" data_type="--------" fontPitch="default" formfieldname="formfield2" height="1" hidden="--------" image="zoom.png" imagetype="Image as URL" invisible="--------" justify="none" lstrcomment="false" name="dsnumber" noEntry="--------" notNull="true" posX="7" posY="0" required="--------" reverse="--------" scroll="--------" sizePolicy="initial" tabIndex="1" verify="--------" width="26"/>
</FormField>
</Grid>
</Form>
4gl文件
###############################################
#创建时间:2012-02-23
#创建作者:ROBACK
#作业说明:跨营运中心批量维护没有成本要素值的料件的成本要素值
###############################################
database ds
GLOBALS "../../../tiptop/config/top.global"
DEFINE g_db_type LIKE type_file.chr3,
g_sql string,
g_wc string
DEFINE g_forupd_sql STRING
DEFINE p_row,p_col LIKE type_file.num5
DEFINE dsnumber STRING
DEFINE dsArray DYNAMIC Array OF STRING
DEFINE Over INT
MAIN
OPTIONS
FORM LINE FIRST + 2,
MESSAGE LINE LAST,
PROMPT LINE LAST,
INPUT NO WRAP
DEFER INTERRUPT # Supress DEL key function
IF (NOT cl_user()) THEN
EXIT PROGRAM
END IF
WHENEVER ERROR CALL cl_err_msg_log
IF (NOT cl_setup("CIM")) THEN
EXIT PROGRAM
END IF
CALL cl_used(g_prog,g_time,1)
RETURNING g_time
LET Over=0
LET p_row = 3 LET p_col = 2
OPEN WINDOW a109_w AT p_row,p_col WITH FORM "cim/42f/cima109"
ATTRIBUTE (STYLE = g_win_style CLIPPED)
CALL cl_ui_init()
WHILE TRUE
CALL dsArray.clear()
#MESSAGE " "
IF Over=1 THEN
EXIT WHILE
END IF
CALL a109_menu()
IF INT_FLAG THEN
LET INT_FLAG = 0
CLOSE WINDOW a109_w
CALL cl_used(g_prog,g_time,2) RETURNING g_time
EXIT PROGRAM
END IF
END WHILE
#IF Over=0 THEN
# RETURN
#END IF
CALL cl_wait()
CLOSE WINDOW a109_w
CALL cl_used(g_prog,g_time,2)
RETURNING g_time
END MAIN
FUNCTION a109_menu()
CONSTRUCT BY NAME dsnumber ON dsnumber
BEFORE CONSTRUCT
CALL cl_qbe_init()
ON ACTION controlp
CASE
WHEN INFIELD(dsnumber)
CALL cl_init_qry_var()
LET g_qryparam.form = "cq_ds"
LET g_qryparam.state = "c"
CALL cl_create_qry() RETURNING g_qryparam.multiret
DISPLAY g_qryparam.multiret TO dsnumber
NEXT FIELD dsnumber
OTHERWISE EXIT CASE
END CASE
ON IDLE g_idle_seconds
CALL cl_on_idle()
CONTINUE CONSTRUCT
ON ACTION about
CALL cl_about()
ON ACTION help
CALL cl_show_help()
ON ACTION controlg
CALL cl_cmdask()
ON ACTION close
LET Over=1
#EXIT WHILE
exit program
END CONSTRUCT
CALL a109_bat()
END FUNCTION
FUNCTION a109_bat()
DEFINE str,str1 STRING
DEFINE strIndex INT,
strLength INT,
StartIndex INT,
ENDIndex INT
IF NOT cl_null(dsnumber) THEN
LET dsnumber=cl_replace_str(dsnumber,"dsnumber=","")
LET str=dsnumber
LET str1=dsnumber
LET strIndex=str.getIndexOf("(",1)
LET strLength=str.getLength()
LET str=str.subString(strIndex,strLength)
LET StartIndex=strIndex
LEt ENDIndex=0
WHILE TRUE
IF strIndex=0 THEN
EXIT WHILE
END IF
IF NOT cl_null(str) THEN
LET strIndex=str.getIndexOf(',',1)
LET ENDIndex=strIndex+StartIndex
LET str1=dsnumber.subString(StartIndex,ENDIndex-1)
LET str1=cl_replace_str(str1,"(","")
LET str1=cl_replace_str(str1,",","")
LET str1=cl_replace_str(str1,"'","")
LET str1=cl_replace_str(str1,")","")
IF NOT cl_null(str1) THEN
CALL dsArray.appendElement()
LET dsArray[dsArray.getLength()]=str1
END IF
LET StartIndex=ENDIndex
IF ENDIndex>0 THEN
LET str=dsnumber.subString(ENDIndex+1,strLength)
END IF
END IF
END WHILE
LET str1=cl_replace_str(dsnumber.subString(ENDIndex+1,strLength),")","")
IF NOT cl_null(str1) THEN
CALL dsArray.appendElement()
LET str1=cl_replace_str(str1,"'","")
LET dsArray[dsArray.getLength()]=str1
LET StartIndex=dsArray.getLength()
END IF
FOR StartIndex=1 TO dsArray.getLength()
MESSAGE "更新数据,请稍候..."
CALL UpdateDataBase(dsArray[StartIndex])
END FOR
MESSAGE "Over..."
END IF
END FUNCTION
FUNCTION UpdateDataBase(p)
DEFINE p STRING #营运中心编号
DEFINE ima DYNAMIC Array OF RECORD
ima01 LIKE ima_file.ima01
END RECORD
DEFINE g_sql STRING
DEFINE t INT
LET p=p.toLowerCase()
LET g_sql="SELECT ima01 From ",p,".ima_file WHERE ima01 NOT IN",
" (SELECT imb01 FROM ",p,".imb_file)"
PREPARE a109_prepare1 FROM g_sql
DECLARE a109_curs1 CURSOR FOR a109_prepare1
LET t=1
#循环插入记录
FOREACH a109_curs1 INTO ima[t].*
LET t=t+1
END FOREACH
FOR t=1 TO t-1
MESSAGE "更新 " ,ima[t].ima01
LET g_sql="insert into ds01.imb_file (",
"imb01,imb02,imb111,imb112,imb1131,",
"imb1132,imb114,imb115,imb1151,imb116,",
"imb1171,imb1172,imb119,imb118,imb120,",
"imb121,imb122,imb1231,imb1232,imb124,",
"imb125,imb1251,imb126,imb1271,imb1272,",
"imb129,imb130,imb211,imb212,imb2131,",
"imb2132,imb214,imb215,imb2151,imb216,",
"imb2171,imb2172,imb219,imb218,imb220,",
"imb221,imb222,imb2231,imb2232,imb224,",
"imb225,imb2251,imb226,imb2271,imb2272,",
"imb229,imb230,imb311,imb3131,imb3132,",
"imb314,imb315,imb3151,imb316,imb3171,",
"imb3172,imb319,imb318,imb320,imb321,",
"imb322,imb3231,imb3232,imb324,imb325,",
"imb3251,imb326,imb3271,imb3272,imb329,",
"imb330,imbacti,imbuser,imbgrup,imbmodu,imbdate,imb312",
")",
"Values",
"(",
"'",ima[t].ima01,"'",
"'0',0,0,0,0,0,",
"0,0,0,0,0,0,",
"0,0,0,0,0,0,",
"0,0,0,0,0,0,",
"0,0,0,0,0,0,",
"0,0,0,0,0,0,",
"0,0,0,0,0,0,",
"0,0,0,0,0,0,",
"0,0,0,0,0,0,",
"0,0,0,0,0,0,",
"0,0,0,0,0,0,",
"0,0,0,0,0,0,",
"0,0,0,0,'Y','zcb','DD','',sysdate,0",
")"
PREPARE roback FROM g_sql
EXECUTE roback
END FOR
#CALL cl_err('执行结束...',null,1)
END FUNCTION
这篇关于(tiptop erp)跨营运中心批量更新没有成本要素值记录的料件的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!