2018年9月26日 星期三

ABAP/4 讀取 Database table, store procedure
  1. data:
  2. PAR1(30) type C,
  3. PAR2(30) type C,
  4. OUT1 type I,
  5. OUT2(30) type C,
  6. OUT3(30) type C.
  7.  
  8. exec sql performig sp_return.
  9. select * from $PROC$sp_dummy
  10. where ( :par1, :par2 )
  11. into :out1, :out2, : out3
  12. endexec.
  13.  
  14. form sp_return.
  15. * some coding
  16. endform

General Types
Predefined data types without special semantic attributes.
Numeric Types
TypeValid Places mInitial ValueMeaningABAP Type
INT1301-byte integer, 0 to 255b
INT2502-byte integer, -32,768 to 32,767s
INT41004-byte integer, -2,147,483,648 to +2,147,483,647i
INT81908-byte integer, -9,223,372,036,854,775,808 to +9,223,372,036,854,775,807int8
DEC1-310Packed number BCD formatp, length m DIV 2 + 1
DF16_DEC1-150Decimal floating point number stored in BCD formatdecfloat16
DF16_RAW160Decimal floating point number stored in binary formatdecfloat16
DF34_DEC1-310Decimal floating point number stored in BCD formatdecfloat34
DF34_RAW340Decimal floating point number stored in binary formatdecfloat34
FLTP160Floating point numberf

Character-Like Types
TypeValid Places mInitial ValueMeaningABAP Type
CHAR1-30000, maximum of 1333 for table fieldsm blanksCharacter stringc, length m
LCHR256-32000Nonelong character stringc, length m
SSTRING1-1333Empty stringCharacter stringstring
STRING256-...Empty stringCharacter string (CLOB)string

Byte-like types
TypeValid Places mInitial ValueMeaningABAP Type
RAW1-32000 maximum of 255 for table fieldsNoneByte stringx, length m
LRAW256-32000NoneLong byte stringx, length m
RAWSTRING256-...Empty stringByte string (BLOB)xstring

Special Types
Predefined data types with special semantic attributes.
Date Types/Time Types
TypeValid Places mInitial ValueMeaningABAP Type
DATS800000000Date in the format YYYYMMDDd
TIMS6000000Time in the format HHMMSSt
ACCP66 blanksPosting period in the format YYYYMMn, length 6

Character-Like Types with Special Semantics
TypeValid Places mInitial ValueMeaningABAP Type
NUMC1-255m zeroesNumeric textn, length m
CLNT3000Clientc, length 3
LANG1BlankLanguage keyc, length 1

Currency Fields and Quantity Fields
TypeValid Places mInitial ValueMeaningABAP Type
CURR1-310Currency field in BCD formatp, length m DIV 2 + 1
CUKY55 blanksCurrency key for currency fieldsc, length 5
QUAN1-310Quantity field in BCD formatp, length m DIV 2 + 1
UNIT2-32 or 3 blanksUnit key of a quantity fieldc, length m

Obsolete Types
TypeValid Places mInitial ValueMeaningABAP Type
DF16_SCL160Decimal floating point number stored in binary format with scaling specified (obsolete)decfloat16
DF34_SCL340Decimal floating point number stored in binary format with scaling specified (obsolete)decfloat34
PREC20Obsolete data types
VARC1-...NoneObsolete data typec, length m



Character-Like Types and Byte-Like Types
Character Strings
The following predefined data types in ABAP Dictionary are available for general character strings:
  • CHAR for text fields
The predefined type CHAR, mapped to the ABAP type c, is used to describe general text fields with a maximum length of 30000 characters (only 1333 characters for table fields).
  • LCHR for long text fields
The predefined type LCHR, also mapped to the ABAP type c, is used to describe general text fields with lengths between 256 and 32000 characters. In database tables, the maximum length must be specified as the value of a preceding INT2 or INT4 field. Table fields of this type cannot be used as key fields of database tables or in any positions in Open SQL statements.
The predefined type SSTRING is mapped to the ABAP type string, but handled like the type CHAR or VARCHAR in ABAP Dictionary and by database tables. The length is restricted to a maximum of 1333, but table fields of this type can also be used as key fields by database tables and used by Open SQL statements in almost all positions where text fields are possible.
The predefined type STRING is mapped to the ABAP type string and also handled like a text string (CLOB) in ABAP Dictionary and by database tables. Table fields of this type cannot be used as key fields or index fields in database tables or in any positions in Open SQL statements.
Notes
  • In general structures, the length of a component of type CHAR is not restricted to 1333.
  • In database tables, there can be only one table field of the type LCHR and it must be the last table field. This means that the type LRAW cannot be used simultaneously in the same database table. If the statement SELECT is used to read an LCHR field, the preceding length field must also be read. In writes using Open SQL, the length field must be given the correct value or data may be lost.
  • LCHR is no longer recommended for new developments. The type STRING is recommended instead, however it is also not suitable for key fields of database tables or for unrestricted use in Open SQL. Where possible, SSTRING can be used here instead.
  • Switching existing dictionary objects from LCHR to STRING or SSTRING, on the other hand, can be critical, since all ABAP types and ABAP objects that reference dictionary objects like this are then given a deep data type. A switch from a flat data type to a deep data type usually constitutes an incompatible change and can produce syntax errors in ABAP programs.

Example
Like the example for literals; the row to be read is here also specified using host variables. The addition STRUCTURE is specified after INTO. However, this is not necessary since wa can be identified statically as a structure. The structure wa is handled in the INTO clause as if all substrings were specified separately: INTO :wa-cityfrom, :wa-cityto.
PARAMETERS: p_carrid TYPE spfli-carrid,
            p_connid TYPE spfli-connid.

DATA: BEGIN OF wa,
        cityfrom TYPE spfli-cityfrom,
        cityto   TYPE spfli-cityto,
      END OF wa.

EXEC SQL.
  SELECT cityfrom, cityto
         INTO STRUCTURE :wa
         FROM spfli
         WHERE mandt  = :sy-mandt AND
               carrid = :p_carrid AND connid = :p_connid
ENDEXEC. 



Example
Reads multiple rows from the database table SPFLI using cursor handling and host variables in static Native SQL. If rows are found, sy-subrc is set to 0 and sy-dbcnt is increased by one for each row read.
PARAMETERS p_carrid TYPE spfli-carrid.

DATA:  connid   TYPE spfli-connid,
       cityfrom TYPE spfli-cityfrom,
       cityto   TYPE spfli-cityto.

EXEC SQL.
  OPEN dbcur FOR
    SELECT connid, cityfrom, cityto
           FROM spfli
           WHERE mandt  = :sy-mandt AND
                 carrid = :p_carrid
ENDEXEC.

DO.
  EXEC SQL.
    FETCH NEXT dbcur INTO :connid, :cityfrom, :cityto
  ENDEXEC.
  IF sy-subrc <> 0.
    EXIT.
  ELSE.
    ...
  ENDIF.
ENDDO.

EXEC SQL.
  CLOSE dbcur
ENDEXEC. 

Bad Example
Reads multiple rows from the database table SCARR and calls the subroutine evaluate for each row read.
DATA wa TYPE spfli-carrid.

EXEC SQL PERFORMING evaluate.
  SELECT carrid FROM spfli INTO :wa WHERE mandt = :sy-mandt
ENDEXEC.
cl_demo_output=>display( ).

FORM evaluate.
  cl_demo_output=>write( |{ wa } | ).
ENDFORM.
Good Example
Explicit cursor processing.
DATA wa TYPE spfli-carrid.

EXEC SQL.
  OPEN CUR FOR
  SELECT carrid FROM spfli WHERE mandt = :sy-mandt
ENDEXEC.

DO.
  EXEC SQL.
    FETCH NEXT CUR INTO :wa
  ENDEXEC.
  IF sy-subrc <> 0.
    EXIT.
  ENDIF.
  cl_demo_output=>write( |{ wa } | ).
ENDDO.
cl_demo_output=>display( ).

2018年8月20日 星期一

現場SFC交易檔自動轉入ERP
假如有生產入庫退回時
不能用負數拋入
會造成一正一負

要先找出原先拋入的生產入庫
找出已存在的入庫資料
TRX_ID,TRANSACTION_DATE
8607,2018/7/25 下午 04:05:12
18504,2018/7/25 下午 04:15:08
TRX_ID,ORGANIZATION_CODE,BATCH_NO,ITEM_NO,LOT_NUMBER,TRANSACTION_QUANTITY,TRANSACTION_UOM,
SUBINVENTORY_CODE,TRANSACTION_DATE,
ATTRIBUTE1,ATTRIBUTE2,ATTRIBUTE3,ATTRIBUTE4,ATTRIBUTE5,ATTRIBUTE6,
ATTRIBUTE7,ATTRIBUTE8,ATTRIBUTE9,ATTRIBUTE10,ATTRIBUTE11,
STATUS,STATUS_MESSAGE,CREATION_DATE,CREATION_BY_NAME,
ERP_UPDATE_DATE,REQUEST_ID,ORGANIZATION_ID,INVENTORY_ITEM_ID,BATCH_ID,OPRN_NO
-----------------------
8607,TH1,5212018012202,4B1-7A0353-A51002,171215312-T17112001,-7,PCS,
1308,2018/7/25 下午 04:05:12,
D322018012216Q,,1,3,2,,0,-80,kg,P0821A,,E,,
2018/1/22,,2018/7/25 下午 04:51:22,1553024,121,8248,2231,5502

18504,TH1,5162018020803,4B1-D00302-T51004,180207513-A18020411,-300,PCS,
1208,2018/7/25 下午 04:15:08,
D322018021012Q,D001,1,5,3,,0,230.15,kg,,,S,,2018/2/10,,

2018/7/25 下午 06:04:53,1553167,121,9146,4640,5501


                       SELECT ROW_NUMBER() OVER(PARTITION BY
                                      MMT.TRANSACTION_SOURCE_ID, 

                                      MMT.INVENTORY_ITEM_ID, 
                                      MTL.LOT_NUMBER 
                                      ORDER BY 
                                      MTL.TRANSACTION_QUANTITY DESC) ROW_NUM,
 -- 以上先將同一 Source + Item + Lot 並列 並依據數量排序                                

                                      MMT.TRANSACTION_SOURCE_ID, 
                                      MMT.INVENTORY_ITEM_ID,
                                      MTL.LOT_NUMBER,
                                      MMT.TRANSACTION_ID,
                                      MMT.ORGANIZATION_ID,
                                      MMT.TRANSACTION_DATE,
                                      
                                   --ABS(IN_TRANSACTION_QUANTITY) START_QUANTITY,
                                      MTL.TRANSACTION_QUANTITY QUANTITY_ISSUED,
                                      MT.TRANSACTION_TYPE_NAME
                           FROM APPS.MTL_MATERIAL_TRANSACTIONS        MMT,
                                       APPS.MTL_TRANSACTION_LOT_NUMBERS MTL,
                                       APPS.MTL_TRANSACTION_TYPES                MT
                        WHERE 1 = 1
                              AND MMT.TRANSACTION_TYPE_ID     = MT.TRANSACTION_TYPE_ID
                              AND MT.TRANSACTION_TYPE_NAME LIKE 'WIP%Completion'
                              AND MTL.TRANSACTION_ID                 = MMT.TRANSACTION_ID
                                
                              AND MMT.TRANSACTION_SOURCE_ID =  IN_BATCH_ID
                              AND MMT.INVENTORY_ITEM_ID             =  IN_ITEM_ID
                              AND MTL.LOT_NUMBER                          =  IN_LOT_NUMBER
                              AND MMT.SUBINVENTORY_CODE         =  IN_SUBINV_CODE








不分料號的前一個日期

SELECT product_id, order_date,
LAG (order_date,1) OVER (ORDER BY order_date) AS prev_order_date
FROM orders;
要分的前一個日期

SELECT product_id, order_date,
LAG (order_date,1) OVER (PARTITION BY product_id ORDER BY order_date) AS prev_order_date
FROM orders;

2018年5月12日 星期六

傳統產業ERP開發流程及導入

東西很貴不能改就是好 因為不得以 所以將就上路 就是"上路" 員工辛苦點抄下"畫面資料" 重新開畫面目錄找到要的作業敲下重新查詢 這就是"目前"高級ERP需要用人幫電腦找資料的"好處"
大家好,目前我在家族傳統產業上班,父親為公司總經理。 最近想要發發牢騷及看是否板上的大大們有什麼建議。 我大概簡述一下我的背景。 在科技業零件供應商及手機組裝廠工作幾年。 所以對於工廠流程及工廠內部會產生的問題,有一定程度的瞭解。 回台灣工作,主要也是想為家裡及台灣盡一份心力。 再來簡述一下公司的情況。 家裡公司為傳統產業,許多零件我們委外加工, 加工完後到我們工廠再做最後組裝。 進來公司後,初期當然先了解公司流程及看有什麼改進的地方。 發現公司在許多操作及文件傳輸上都還是以紙本為主。(連發票都還是手開發票Orz) 當然目前有使用幾年的ERP系統,只能算算堪用(銷單/工單/訂貨等等的資訊紀錄), 但功能不夠全面(會計與進銷存無連線/庫存及成本不明確.....)。 在我實地操作(包含接單/生產/採購/加工/會計)及研究後, 認為公司在系統及流程上需要做一定程度的改變,才能持續成長。 當然,我也知道傳統產業從業人員較不喜歡改變及接收新的想法, 導入一個新的或更新ERP,不僅僅是要系統上的升級, 各單位的人員也需強力配合才行。(這也是最頭痛的地方><)。 我認為目前要更新或導入新的ERP主要為 1. 公司貨品數目在帳上有帳(數量/成本) ==> 公司目前所有的貨品都是處於無帳的狀態。 (當然屆時還是需要倉管人員先一次性盤點及追蹤,光想到就頭很痛。) 2. 再來就是會計與進銷存無連線, 對於會計人員或管理階層來說,其實資訊相當不請楚。 ==>(無法產生損益表/資產負債表等等的資訊。) 之後的打算,想要開始為公司找專職的MIS人員來協助導入系統這一塊。 (目前沒有專職MIS人員) 因為是小公司,可能MIS進駐後,有一些部分也會變成總管部分。 (設定影印機/Outlook/網路等等的) 但還是想要找專職幫忙建立整體公司資訊化的人才。 (ERP/WMS/門禁等等的系統開發) 不知道此人才在產業上是否好找。 公司要導入那家廠商或是自行再開發,目前有眉目而已。 我一直覺得,雖然在傳統產業,但在這個時代, 資訊的流通/快速性/減少錯誤率才能讓公司有更一步的成長。 現在公司大概還在20年前左右的作業模式吧, 所以才想要更新電子資訊以至於不會落後別的公司太多。 真心覺得,ERP這種東西真的要一次搞好, 不然其實很容易大家就放棄不用。 已經拜讀板上許多文章, 看到有些厲害的板友在傳產產業成功導入系統, 真心佩服以及羨慕。 主要就是看看版上大大有沒有有什麼建議, 或是駐在板上的傳產前輩也可以聊聊, 或是有在傳產導入ERP經驗分享一下經驗也好 有一部分也是現在上班比起以前科技業也較閒, 和分享一下大部分傳統產業的現況。 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 218.161.6.100 ※ 文章網址: https://www.ptt.cc/bbs/MIS/M.1525414509.A.258.html
→ Uni1122: 願意花多少錢,請多少人決定了你想導入ERP系統的成效和 05/04 14:47
時間,看起來還包含基礎資訊系統需要建設,要花不少時間 05/04 14:47
和金錢 05/04 14:47
推 yamaraja: 請問貴公司編制有多少人呢?(會用到電腦的人) 05/04 14:47
→ slash66: 找ERP廠商先來輔導,ERP是要全公司一起投入的 05/04 14:48
→ yamaraja: 另外建議BPM也要推, 這樣跟ERP接軌後, 簽核管理才能一體 05/04 14:49
→ slash66: 後續還有很多勞心勞力的事情,錢幾百萬還算小事 05/04 14:49
→ yamaraja: 導e化還有一個很關鍵的因素就是要讓員工知道,老闆很支持 05/04 14:50
→ johnson922: 前幾百萬肯定是要花的,但就怕花下去結果也沒成效。 編制算一算,目前應該約為10~15個吧。 05/04 14:52
推 aeolus0829: 人不會難找 問題是找到對的人 05/04 14:52

05/04 14:54
→ Weky: 建議你review自家公司規模 小公司導入不見得有幫助 05/04 14:56
推 Uni1122: 傳產10-15人的資訊部,公司規模應該不小了,這些人都可以 05/04 15:00
拆組別寫系統了,導erp是全面的事情,最主要要看老闆願 05/04 15:00
不願意當靠山給MIS靠,遇到阻力老闆願不願意給與支持很大 05/04 15:00
程度會影響導入成效 05/04 15:00
→ johnson922: 知道會花時間/金錢/勞師動眾,但就是希望改下去後 05/04 15:07
會有成效才行。 05/04 15:08
Unu1122大大,不是資訊部有15人拉,是會用到電腦的人 05/04 15:09
採購業務開發生管等等的。 05/04 15:09
→ Uni1122: 順便說如果想導T100的話最好不要,除非想當白老鼠 05/04 15:11
→ johnson922: Uni1122謝謝建議。鼎新網路上貌似貶大於褒。 05/04 15:13
→ Uni1122: 咦!10到15人會用電腦,那只能往套裝erp下手了,可以客製 05/04 15:14
的功能就不多了 05/04 15:14
→ johnson922: 但同產業的,許多也是使用鼎新系統的。 05/04 15:14
其實也不排斥用套裝,但就像大家所說的,需要做取捨。 05/04 15:15
再仔細算一算應該也是有20人左右會用到電腦。 05/04 15:16
→ Uni1122: 除了T100其他產品因為開發時間比較久相對成熟,而且可能 05/04 15:17
其他公司有自己養人寫程式,所以大多數就繼續用著 05/04 15:17
因為我只接觸過鼎新系統,所以只能說一些東西。 05/04 15:28
1.每年保護費可能不少。2.客製費不便宜,而且出來bug可 05/04 15:31
能還不少。3.保護費可能不包含版更。4.可能需要養寫程式 05/04 15:31
的人lol 05/04 15:31
→ johnson922: 對的,所以你所提到的東西也都在我們考慮的範圍內。 05/04 16:05
→ testPtt: 20萬找2個程式熟手 10萬找3個打雜 自己開發比較好解bug 05/04 16:25
推 sano153759: 除了找mis外各部門也要選定種子人員負責學系統與反應 05/04 17:02
→ sano153759: 流程與部門作業是否符合,否則只有個新來的mis會孤掌 05/04 17:02
→ sano153759: 難鳴喔!加油 05/04 17:02
→ johnson922: 是的。要導入,基本上內部的人員我會去協調及要求。 05/04 17:10
→ johnson922: 不然MIS人員有很大機率會叫不太動。XD 05/04 17:11
推 resad: 其實可以考慮WF 會比較好管理,費用也不會太高 05/04 23:49
→ resad: 只是套裝的功能要去熟悉而已 05/04 23:50
→ dragon6: 有點手癢。有一些中小型的ERP,挑對製造業的模組來用。 05/05 01:44
→ dragon6: 一開始別用太高級複雜的ERP,花錢又難上手。 05/05 01:44
→ sad3: 我們公司只要跟電啊網路啊有關的都找MIS,真的好累喔... 05/06 19:07
→ sad3: 如果真的要導入系統,請一定要審慎的評估,是一個挑戰喔 05/06 19:08
→ sad3: 以前我公司電子零件業,也是用鼎新,費用真的滿高昂的, 05/06 19:09
→ sad3: 不過相對來說,當時也是撐過來了呢!現在大家都以系統為準 05/06 19:10
→ sad3: 比較少有料件缺少問題,這是蠻明顯的效果。 05/06 19:10
→ sad3: 還有在帳務方面,也可以串聯起來,我自己覺得不錯只是太貴了 05/06 19:12
推 sad3: 發票將於109年開始施行電子發票,這個要注意喔! 05/06 19:17
→ AvatarH: 你可能先需要一個聽得懂資訊人員在講什麼的人。在導入資 05/06 20:24
→ AvatarH: 訊系統時,有些專有名詞要先翻成「人話」才聽得懂。 05/06 20:27
推 aleeon: 北部的話可以聊聊~ 05/07 02:13
→ johnson922: Sad3大大,對的。小公司也沒辦法一整個完整的MIS團隊 05/07 13:49
→ johnson922: 但看到您說您們公司用鼎新後效果明顯成長。表示貴公司 05/07 13:50
→ johnson922: 流程跟鼎新系統也是蠻Match的。 05/07 13:50
→ johnson922: 軟體花下去真的不少錢,但就怕花錢了又沒有效應。 05/07 13:52
→ johnson922: 這才是我比較擔憂的地方Orz~~ 05/07 13:52
→ konkonchou: 有沒有機房>冷氣>UPS>L3 switch > 防火牆>DB/AP ser 05/08 08:47
→ konkonchou: ver > 相關 License 05/08 08:47
→ konkonchou: 很多基礎建設作下去就會發現根本還沒到作系統>ERP就 05/08 08:51
→ konkonchou: 已經一大筆支出,但這些才是一開始真正要花的,對於 05/08 08:51
→ konkonchou: 作管理這些都沒什麼幫助,對於系統上線後先作是事半 05/08 08:51
→ konkonchou: 功倍 05/08 08:51
→ konkonchou: 先想好公司至少未來三年成長的規劃,再決定哪些是基 05/08 08:57
→ konkonchou: 礎該投資建設的,若沒信心怕花錢又失敗,真的別想著 05/08 08:57
→ konkonchou: ERP了,不如買/作個小系統管理核心問題才是捷徑 05/08 08:57
→ johnson922: konknochou大大,謝謝你的建議。會好好思考的~ 05/08 15:10
推 sad3: 其實當時導入也不是有一整個團隊,是各部門都要找人出來當窗 05/09 00:07
→ sad3: 口,每個部門都有辛苦的地方,不是只有資訊部在做哦 05/09 00:08
推文自動更新已關閉

2018年5月11日 星期五

目前出生地政權不一定你的祖國...

目前地主
擁有你以前的土地
你是前地主
前地主不是後來的地主的"祖先"

目前政權
擁有你以前的領地
你是前政權
前政權不是後來的政權的"祖國"





1235年蒙古大軍開始進攻欽察、俄羅斯,攻佔莫斯科等城市。
1240年成吉思汗的孫子拔都攻佔基輔。
1267年至1279年,經過對南宋多年的征戰,元軍終於滅宋。
蒙古將俄羅斯納入版圖,
至少比中國納入蒙古帝國早近40年
爲什麽在中國和俄羅斯先後獨立後,
=====================================
::精神錯亂那時候沒中華人民共和國只有大宋國::
蒙古將俄羅斯國納入版圖,
至少比大宋國納入蒙古帝國早近40年
爲什麽在大明國和俄羅斯國先後又建立自己國家後,
=========================================
俄羅斯人從來不曾將蒙古帝國以及他們的始祖成吉思汗當做自己的國家、朝代的一部份,
和祖先來看待?
=============
而曾被蒙古侵略統治的我們中國人,
卻將那段亡國時期當做是一個中國朝代?
卻將那侵略我國的始祖當做祖先來拜?

這可以明確看出荒謬的地方!
現在俄羅斯境內也有不少蒙古族人,
他們現在是俄羅斯國籍的俄羅斯人

但俄羅斯政府會把蒙古帝國當做是自己曾經的一個朝代看待嗎?
會把蒙古人鐵木真當始祖來拜並歌功頌德嗎?不會!

這種畸形可悲的事情只有發生在中國,
而任何曾被蒙古帝國征服的國家都未曾發生
滿清侵略並且統治蒙古,
也比中國更早爲什麽今天蒙古國人就不曾把滿清當做是他們的朝代?

這道理不能再簡單了
難道閣下不知道大明曾經與蒙古結盟對抗後金?
這是兩個國家結盟對抗另一個國家,
結果這兩個國家都被這個國家併吞
結果蒙古獨立後的今天,
不曾把滿清當做蒙古
而中國卻把滿清當做中國?
這實在可笑


他山之石 Openbravo ERP 收費制度下 版本與人數控管機制

   
先去授權檔案抓"lincensetype"授權型式
1.DMD   :: LicenseType.ON_DEMAND 即選需求
2.USR    ::  LicenseType.CONCURRENT_USERS  同時上線人數
3.以上全非 :: 就用 LicenseType.CONCURRENT_USERS  同時上線人數

    String pLicenseType = getProperty("lincensetype");
    if ("DMD".equals(pLicenseType)) {
      licenseType = LicenseType.ON_DEMAND;
    } else if ("USR".equals(pLicenseType)) {
      licenseType = LicenseType.CONCURRENT_USERS;
    } else {
      log4j.warn("Unknown license type:" + pLicenseType + ". Using Concurrent Users!.");
      licenseType = LicenseType.CONCURRENT_USERS;
    }


   即選需求
   假如不是"即選需求"
   if (licenseType == LicenseType.ON_DEMAND) {
      if (!checkInOnDemandPlatform()) {
        outOfPlatform = true;
        String limitusers = getProperty("limitusers");
        maxUsers = StringUtils.isEmpty(limitusers) ? 0L : Long.valueOf(limitusers);
        if (maxUsers == 0L) {
          maxUsers = OUT_OF_PLATFORM_DEMAND_MAX_USERS;
        }
        log.warn("On Demand license ouf of platform limiting to " + maxUsers + " concurrent users");
      } else {
        maxUsers = 0L;
      }
    }

    if (licenseType == LicenseType.CONCURRENT_USERS) {
      String limitusers = getProperty("limitusers");
      maxUsers = StringUtils.isEmpty(limitusers) ? 0L : Long.valueOf(limitusers);
    }

    // Check for dates to know if the instance is active
    subscriptionConvertedProperty = "true".equals(getProperty("subscriptionConverted"));

    trial = "true".equals(getProperty("trial"));
    golden = "true".equals(getProperty("golden"));

    String strUnlimitedWsAccess = getProperty("unlimitedWsAccess");

    if (StringUtils.isEmpty(strUnlimitedWsAccess)) {
      // old license, setting defaults
      if (trial || golden) {
        limitedWsAccess = true;
        maxWsCalls = 500L;
        instanceProperties.put("wsPacks", "1");
        instanceProperties.put("wsUnitsPerUnit", "500");
        initializeWsCounter();
      } else {
        limitedWsAccess = false;
      }
    } else {
      limitedWsAccess = "false".equals(getProperty("unlimitedWsAccess"));
      if (limitedWsAccess) {
        String packs = getProperty("wsPacks");
        String unitsPack = getProperty("wsUnitsPerUnit");

        if (StringUtils.isEmpty(packs) || StringUtils.isEmpty(unitsPack)) {
          log.warn("Couldn't determine ws call limitation, setting unlimited.");
          limitedWsAccess = false;
        } else {
          try {
            Integer nPacks = Integer.parseInt(packs);
            Integer nUnitsPack = Integer.parseInt(unitsPack);
            maxWsCalls = nPacks * nUnitsPack;
            log.debug("Maximum ws calls: " + maxWsCalls);
            initializeWsCounter();
          } catch (Exception e) {
            log.error("Error setting ws call limitation, setting unlimited.", e);
            limitedWsAccess = false;
          }
        }
      }
    }