BOM production

BOM production

Postby damianodec » Thu Apr 26, 2018 1:24 pm

Hi to All,
Is it possible to represent "BOM production" by Tree object ?

thanks
FiveWin for xHarbour 17.09 - Sep. 2017 - Embarcadero C++ 7.00 for Win32
FWH 64 for Harbour 19.06 (MSVC++) Jun. 2019 - Harbour 3.2.0dev (r1904111533)
Visual Studio 2019 - Pelles C V.8.00.60 (Win64)
User avatar
damianodec
 
Posts: 419
Joined: Wed Jun 06, 2007 2:58 pm
Location: Italia

Re: BOM production

Postby Carles » Thu Apr 26, 2018 8:05 pm

damianodec,

You can say that tree like a abstract view of BOM, if you refer a "bill of materials" of couse....If you to know to build a tree example, then you can do a BOM view. You can do a lot of levels like product, subproduct and raw material
Salutacions, saludos, regards

"...programar es fácil, hacer programas es difícil..."

UT Page -> https://carles9000.github.io/
Forum UT -> https://discord.gg/bq8a9yGMWh
Skype -> https://join.skype.com/cnzQg3Kr1dnk
User avatar
Carles
 
Posts: 1139
Joined: Fri Feb 10, 2006 2:34 pm
Location: Barcelona

Re: BOM production

Postby ShumingWang » Fri Apr 27, 2018 2:03 am

/*
myapp.rc

CONTROL "", 201, "SysTreeView32", 0 | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_HSCROLL| TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_SHOWSELALWAYS, 3, 80, 148, 252

*/

// ....
::oTree :=TTreeView(): REDEFINE( 201, odlg,0,nrgb(255,255,255))
// tree rc 属性 + TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_SHOWSELALWAYS,


ACTIVATE DIALOG odlg nomodal;
ON INIT (oself1:eng0300()

method eng0300() class eng03class
local odb1,odb2

odb1:=::odb1
odb2:=::odb2

::oTree:bChanged := {|oTree,oItem|eng0303(self) }
// ...
return

FUNCTION eng0303(obl1)
local itemid1,version1
oitem:=obl1:oTree:GetSelected()

itemid1:=LEFT(oitem:cprompt,nitemidlen)
version1:=SUBSTR(oitem:cprompt,nitemidlen+3,10)
obl1:odb1:cquery:="select * from "+obl1:odb1:ctable+" where itemid='"+itemid1+"' and version='"+version1+"'"
obl1:odb1:refresh()
eng0324(obl1)
obl1:obrow:refresh()
obl1:odb4:cquery:="select * from "+obl1:odb4:ctable+" where itemid='"+itemid1+"' and version='"+version1+"' order by csort"
obl1:odb4:refresh()
obl1:obrow4:refresh()

if obl1:odb1:ctable=="bom1"
eng050401(oitem,.f.,"bom1","bom2")
else
eng050401(oitem,.f.,"engbom1","engbom2")
end

obl1:ledit:=.f.
obl1:odlg:UPDATE()
obl1:odlg:obar:AEVALwhen()

return


FUNCTION eng0504(itemid1,version1,ctable1,ctable2)

local oWnd1, oTree, oBmp1, oBmp2, odb1
// private oImageList

if ctable1==nil
ctable1:="bom1"
end
if ctable2==nil
ctable2:="bom2"
end

DEFINE WINDOW oWnd1 FROM 3, 0 TO 30, 120 ;
TITLE citemtitle+" "+ALLTRIM(itemid1) + " 树型BOM展开表"
// COLOR "n/w"

oImageList = TImageList():New()

oBmp1 = TBitmap():Define( "folder",, oWnd )
oBmp2 = TBitmap():Define( "fldMask",, oWnd)

oImageList:Add( oBmp1, oBmp2 )

oTree = TTreeView():New( 3, 0, oWnd1)
oTree:bChanged = { || eng050401( oTree:GetSelected(),,ctable1,ctable2) }

oTree:SetImageList( oImageList )

oItem = oTree:Add(itemid1)

odb1:=oServer:Query("select bom2.itemidc itemidc,cversion,goods2.descrip descrip,goods2.size size,unit.unit unit,substring(bom2.mem,1,25) mem,bom2.qty/bom2.qtydevisor*(1+ifnull(bom2.scraprate,0)/100)+bom2.fixscrap qty,bom1.version version,bom2.position position";
+" from "+ctable1+" bom1,"+ctable2+" bom2,goods2,unit";
+" where bom1.itemid='"+itemid1+"' and bom1.version='"+version1+"' and bom1.startdate<=curdate() and bom1.enddate>=curdate() and bom2.itemid='"+itemid1+"' and bom2.version=bom1.version and goods2.itemid=bom2.itemidc and unit.itemid=bom2.itemidc and unit.unitid=bom2.unitid")

while !odb1:EOF()
oItem:Add(odb1:itemidc+" V"+odb1:cversion+" "+odb1:descrip+if(lsize," "+odb1:SIZE,"")+" "+odb1:unit+" "+padl(cvaltochar(ROUND(odb1:qty,nqtydec+1)),nqtylen," ")+" "+odb1:mem+" "+odb1:position)
odb1:SKIP()
enddo

oWnd1:oClient:=oTree
oTree:Expand()
SET MESSAGE OF oWnd1 TO "BOM树型展开表" FONT ofont14
ACTIVATE WINDOW oWnd1
//VALID (oBmp1:End(),oBmp2:End(),.t.)
odb1:end()
oImageList:End()
oBmp1:End()
oBmp2:End()
return

FUNCTION eng050401(oItem,lcat,ctable1,ctable2)
local odb1
if lcat==nil;lcat:=.t.; end

if LEN(oItem:aItems)==0

odb1:=oserver:Query("select bom2.itemidc itemidc,bom2.cversion cversion,goods2.descrip descrip,goods2.size size,unit.unit unit,substring(bom2.mem,1,25) mem,bom2.qty/bom2.qtydevisor*(1+ifnull(bom2.scraprate,0)/100)+bom2.fixscrap qty,bom1.version version ,bom2.position ";
+" from "+ctable1+" bom1,"+ctable2+" bom2,goods2,unit ";
+" where bom1.itemid='"+LEFT(oitem:cprompt,nitemidlen)+"' and bom1.version='"+SUBSTR(oitem:cprompt,nitemidlen+3,10)+"' and bom1.startdate<=curdate() and bom1.enddate>=curdate() and bom2.itemid='"+LEFT(oitem:cprompt,nitemidlen)+"' and bom2.version=bom1.version and goods2.itemid=bom2.itemidc and unit.itemid=bom2.itemidc and unit.unitid=bom2.unitid")


while !odb1:EOF()
oItem:Add(odb1:itemidc+" V"+odb1:cversion+" "+odb1:descrip+if(lsize," "+odb1:SIZE,"")+" "+odb1:unit+" "+STR(ROUND(odb1:qty*if(lcat,val(strtoken(oitem:cprompt,5+if(lsize,1,0)," ")),1),nqtydec+1))+" "+odb1:mem+" "+odb1:position)
odb1:SKIP()
enddo
oitem:expand()
odb1:end()
endif

return
http://www.xtech2.top
Mobile:(86)13802729058
Email:100200651@qq.com
QQ:100200651
Weixin: qq100200651
ShumingWang
 
Posts: 465
Joined: Sun Oct 30, 2005 6:37 am
Location: Guangzhou(Canton),China

Re: BOM production

Postby damianodec » Thu May 03, 2018 3:42 pm

thank you!
FiveWin for xHarbour 17.09 - Sep. 2017 - Embarcadero C++ 7.00 for Win32
FWH 64 for Harbour 19.06 (MSVC++) Jun. 2019 - Harbour 3.2.0dev (r1904111533)
Visual Studio 2019 - Pelles C V.8.00.60 (Win64)
User avatar
damianodec
 
Posts: 419
Joined: Wed Jun 06, 2007 2:58 pm
Location: Italia


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 99 guests