From KDCommunity
You can refer to the following script to add the buttons to the order book of the purchased Warehouse orders:
/*-------------------------------------
Button name: Outsourcing warehouse receiving ticket
Button ID 10002
Production Task List ID: 36 fmenuid = 90
-- If the button is added to the book when the warehouse receiving order is purchased outside, find the menuid
Select FID, fmenuid, * From iclisttemplate where fname like '% purchased warehouse receiving %'
-- (FID = 1, fmenuid = 82)
*/-------------------------------------
Select * From t_menutoolbar
Select * From ictransactiontype
-- Add metadata button
Delete from t_menutoolbar where ftoolid = 10002
Insert into t_menutoolbar (ftoolid, fname, fcaption, delimiter, delimiter, fimagename, ftooltip, delimiter, delimiter, fcontroltype, fvisible, fenable, fchecked, fshortcut, fcblist, disable, disable, fcbstyle, fcbwidth, findex, ftoolcaption, ftoolcaption_cht, ftoolcaption_en)
Values (10002, 'fmenupc1', 'Task ticket id', '39 ', 'Task ticket id', 'Task ticket id ', 'Task ticket id', 0, 0, '', 0, 'Task ticket id ')
-- Insert the button above to the toolbar and menu bar
Select * From t_bandtoolmapping where FID = 90
Delete from t_bandtoolmapping where fbandid = 18 and ftoolid = 10002 and FID = 82
Insert into t_bandtoolmapping (FID, fbandid, ftoolid, fsubbandid, findex, fcomname, fbegingroup)
Values (82,18, 10002,0, 65, '| icmolistbill. listbill', 0)
Delete from t_bandtoolmapping where fbandid = 52 and ftoolid = 10002 and FID = 82
Insert into t_bandtoolmapping (FID, fbandid, ftoolid, fsubbandid, findex, fcomname, fbegingroup)
Values (82,52, 10002,0, 65, '| icmolistbill. listbill', 0)
-- The thin display button for warehouse receiving order (if there is "| V" in it, you can only add a single dish at the end)
Update iclisttemplate
Set flogicstr = flogicstr + case when right (flogicstr, 1) = '| 'then' V: fmenupc1 'else' | V: fmenupc1 'end
Where FID = 1 and not flogicstr like '% fmenupc1 %'
Create a DLL project named icmolistbill and the class named listbill. Add the following to the class listbill:Code:
Private declare function getcurrentprocessid lib "Kernel32" () as long
Public sub mainfunction (byval skey as string, olist as object, byref bcancel as Boolean)
Dim CNN as string
Dim strsql as string
Dim cn as ADODB. Connection
Dim RS as ADODB. recordset
Dim odatasrv as object
Dim obill as object
If skey = "fmenupc1" then
'Get the connection string
CNN = left (getconn, instr (1, getconn, "}")-1)
CNN = mid (CNN, 16)
Set Cn = new ADODB. Connection
With Cn
. Connectionstring = CNN
. Open
End
Strsql = "select fsourceinterid from icstockbillentry where finterid =" & olist. listselectbillinfo (1) ("finterid") & "and fentryid =" & olist. listselectbillinfo (1) ("fentryid ")
Set rs = cn. Execute (strsql)
If not Rs. EOF then
Set odatasrv = Createobject ("k3classtpl. datasrv ")
Odatasrv. classtypeid = 288888808.
Set obill = Createobject ("k3singleclassbill. classinfomanager ")
With obill
. Datasrv = odatasrv
. Isnetcontrol = true
. Ischeckright = true
. Show RS ("fsourceinterid"), 0
'**********************
'Show parameter type
'First parameter optional byval lid as long = 0; ID of the document to be modified or viewed
'The second parameter optional byval bshowgroup as Boolean = false; Whether to display the group if the basic data is used
'Third parameter optional byval billstatus as long = enu_billstatus_new; Display Mode 0-view; 1-add; 2-Modify
'Fourth parameter optional byval dctdata as KFO. dictionary 'initial value of the document
'**********************
End
Set odatasrv = nothing
Set obill = nothing
End if
Set rs = nothing
Set Cn = nothing
End if
End sub
Private function getconn () as string
Dim lproc as long
Lproc = getcurrentprocessid ()
Set spmmgr = Createobject ("propsmgr. extends props ")
If isobject (spmmgr. getproperty (lproc, "propsstring") then
Getconn = spmmgr. getproperty (lproc, "propsstring ")
Else
Getconn = spmmgr. getproperty (lproc, "propsstring ")
End if
Set spmmgr = nothing
Exit Function
End Function
(Note that Microsoft adox2 must be referenced in this project. 6)