2024年12月5日 星期四

Python: openpyxl.utils.exceptions.IllegalCharacterError

久未更動的程式, 突然出現error:


  File "C:\Users\XXX\AppData\Local\Programs\Python\Python38-32\lib\site-packages\openpyxl\cell\cell.py", line 159, in check_string

    raise IllegalCharacterError

openpyxl.utils.exceptions.IllegalCharacterError


原因是有範圍為8進制 [\000-\010]|[\013-\014]|[\016-\037] 的字元.

查了查, 最終發現應是使用者貼資料到系統時, 字串第1個字元是 HEX 16 , 不知從哪複製來的.


治標方式:


from openpyxl.cell.cell import ILLEGAL_CHARACTERS_RE

...

v_item = ILLEGAL_CHARACTERS_RE.sub(r'', v_item)


治本, 還是要修正源頭資料.


Ref:

1.openpyxl.utils.exceptions.IllegalCharacterError报错原因及解决办法

  https://www.cnblogs.com/hengdin/p/16996512.html


2.openpyxl.utils.exceptions.IllegalCharacterError 错误原因分析及解决办法

  https://blog.csdn.net/javajiawei/article/details/97147219


3.pandas写入excel时报错openpyxl.utils.exceptions.IllegalCharacterError解决

https://blog.csdn.net/koxb/article/details/131718681



2024年12月3日 星期二

Python: 畫甘特圖

Python: 畫甘特圖

1.使用 Matplotlib , 主要是 broken_barh()

2.使用plotly.express


Ref:

1.Python | Basic Gantt chart using Matplotlib

https://www.geeksforgeeks.org/python-basic-gantt-chart-using-matplotlib/


2.plotting job scheduling chart in Python

https://stackoverflow.com/questions/65183169/plotting-job-scheduling-chart-in-python


3.Gantt Charts in Python

https://plotly.com/python/gantt/


2024年10月15日 星期二

2024 AWS 生成式 AI 創新產業應用日

 2024 AWS 生成式 AI 創新產業應用日


1.Opening


算力層,平台層,應用層


Amazon應用: 影像產生,假評價阻擋,音樂產生,購物助理,輔助建立物流中心,Amazom Q Business,  Amazon Q Developer


算法重於算力


Data is the future oil


The foundation for AI is in the CLOUD 


Amazon Bedrock: broad choice of model 

AI21labs, Aamazon, Meta, stability.ai


生成式AI互動範例:詢問車輛保險


使用者輸入 -> 提示工程 -> LLM回應


應用:依草稿產出完整設計圖


三預測:

會使用AI的人較出眾

自然語言是下一個程式語言

內嵌式AI與機器人



2.智邦


AI發展歷程:

 2018:部門成立

 2019:2D AOI

 2020:3D AOI

 2022:使用Amazon平台


雲地混合式架構,各site工程師收集資料上傳,再分享給各site


AI訓練方式:自動記錄程序,記錄影像,以AI標記資料集,確認資料集,訓練模型,佈署模型


智邦AOI檢測能力,優於傳統2D AOI


智慧製造解決方案:4K IP cam記錄檢測 (以影片展示成品與配件裝箱時的辨識狀況)

效益:檢測時間減少90%


生成式AI辦公助手:提供界面讓user發問


應用:

自然語言產出報表

CodeGen

叫修記錄上傳共享


智邦AI應用平台:微服務,AWS


智慧製造相關事項可聯絡:mike_shen@accton.com



3.趨勢科技


2005開始以ML作anti-spam


使用AWS建立responsible AI


LLM應用生命週期:

data, model and agent, app and use


負面案例;

南韓AI公司不當使用個人資料

Open source LLM造成公司資料外流

駭客以提示注入工程取得機敏資料


Learn architecture 

https://trend-tw.com/PN0kB


以AI gateway確保AI使用安全


總結:AI的使用帶來新的風險挑戰



4.Kkday


GraghRAG:基於knowledge gragh的RAG


Graph:基於關聯的數據模型,包含Node 與Edge 


運用場景:social network...


Knowledge graph:連結不同資料來源,改善搜尋結果,增強AI/ML


GraghRAG生成步驟:

1.知識圖自動生成

2.回答問題


GraghRAG架構範例


優點:

 找出最相關數據來源

 尋找關聯數據潛在來源

 使用已驗證資料

 使用相關數據豐富主題


GraghRAG應用範例:旅途規劃


Amazon Neptune:圖形資料運算全託管雲端資料庫


Amazon Neptune Analytic: Amazon Neptune分析引擎


支援的程式框架:Llamaindex, langchain


傳統搜尋:

  嵐山賞楓,拆兩個詞搜尋:嵐山,賞楓

  加入AI:京都,一日遊,包車


透過LLM建立knowledge graph,目前使用Claude 3 Haiku


Future work:

Data source 多元

Parsing

Knowledgde gragh, vector darabase

RAG

Applications



5.Gogolook


Ideation, exection, governance


Build data foundation


找適合工具,Generative AI stack:application, LLM, infrastructure


三大主要業務:

消費者防詐,企業防詐,金融科技服務


AI如何改善whoscall流程:

 現有流程與挑戰:資料來源多,人工理解與貼標

 考量成本,穩定性,跨語言

 建立正確資料集,給予LLM更多必要細節

 以AI歸納提供建議標籤,若仍有不足再人工處理


開發流程:

商務需求,提示設計,模型選擇,評估,測試..


Whoscall新功能: 以拍照方式進行詐騙判斷


總結:

與AWS合作效益,使用OpenSearch、RedRock



6.AccuHit


生成式AI價值:新體驗,生產力,洞見,創意


系統:

 CDP:跨渠道顧客數據平台

 NIX:對話式商務應用平台

 FLOW.ai:企業級AI方案,使用向量資料庫


使用Amazon CodeBuild, CodePipeline, Bedrock


行銷案例:唯豐肉鬆

 建立行銷文本資料庫,匯入舊文案,排除不相關資料

 蒐集,清洗,貼標,萃取,驗證

 強化專屬AI訓練:50%採舊有文案,50%採現有產品資訊


成效:

1.開銷減少,行銷委外費-75%

2.貼文產能提升

3.效益增加:推文開封率+5%

4.營收成長:同期YOY+89萬


大語言模型在商品推薦的應用:用戶資料,商品資料,用戶行為


以LLM解決標籤製作困境:提供資料,標籤探索,探索結果,呈現


其他事項:

 RAG效能檢測

 提示工程

 微調大語言模型

 Agents


導入RAG痛點:AI答覆正確性,知識庫資料即時性


RAG系統性能量測七指標




2024年3月22日 星期五

Delphi: 解決早期版本Delphi unicode問題的工具: TMS Unicode Component Pack

由於Delphi 7不支援unicode, 造成越南文顯示及儲存的亂碼問題, 變通作法為:

1.英文windows加語言包

2.資料庫連接方式從BDE改成ADO


有找到個工具, TMS Unicode Component Pack , 但實際效果還要再測.


Ref:

1.TMS Unicode Component Pack

https://www.tmssoftware.com/site/tmsuni.asp


2.delphi 支持越南文的问题(200分)

http://wedelphi.com/t/314997/


2023年12月21日 星期四

Oracle EBS: 修正PO interface資料重轉

 Oracle EBS: 修正PO interface資料重轉


select * from po_headers_interface

 where ...


select * from po_lines_interface

 where interface_header_id = ?19248184


update po_headers_interface

  set process_code = null,

      processing_id = null

 where interface_header_id = ?19248184


update po_lines_interface

  set process_code = null,

      processing_id = null

 where interface_header_id = ?19248184


select * from po_interface_errors

  where interface_header_id = ?19248184

  


Oracle EBS: 修改RCV interface資料以重收貨

Oracle EBS: 修改RCV interface資料以重收貨


update rcv_headers_interface rhi

 set processing_request_id=null ,

receipt_header_id=null ,

validation_flag = 'Y' ,

processing_status_code = 'PENDING'

where 1=1 --group_id = 2634307

  and processing_status_code = 'ERROR'

  and exists  (select header_interface_id 

                 from rcv_transactions_interface rti

                where rhi.HEADER_INTERFACE_ID=rti.HEADER_INTERFACE_ID )


  

update rcv_transactions_interface

  set request_id=null ,

processing_request_id=null ,

order_transaction_id=null ,

primary_quantity=null ,

primary_unit_of_measure=null ,

interface_transaction_qty=null ,

validation_flag = 'Y' ,

processing_status_code = 'PENDING' ,

transaction_status_code = 'PENDING' 

 where 1=1 --group_id = 2634307

   and (processing_status_code = 'ERROR' or transaction_status_code = 'ERROR')

      

--------------------------------------------------------------------------------------


update rcv_headers_interface rhi

 set processing_request_id=null ,

receipt_header_id=null ,

validation_flag = 'Y' ,

processing_status_code = 'PENDING'

where group_id = ?2638496

  and processing_status_code = 'ERROR'

  and exists  (select header_interface_id 

                 from rcv_transactions_interface rti

                where rhi.HEADER_INTERFACE_ID=rti.HEADER_INTERFACE_ID )


  

update rcv_transactions_interface

  set request_id=null ,

processing_request_id=null ,

order_transaction_id=null ,

primary_quantity=null ,

primary_unit_of_measure=null ,

interface_transaction_qty=null ,

validation_flag = 'Y' ,

processing_status_code = 'PENDING' ,

transaction_status_code = 'PENDING' 

 where group_id = ?2638496


 

2023年8月14日 星期一

Oracle EBS: 用於處理OM order之API

Oracle EBS: 用於處理OM order之API


OE_ORDER_PUB.Process_order(

Standard Parameters

Specific Parameters)

 

功能包括:

CREATE

UPDATE

Reserve

Unreserve

Split line

Delete

Book order

Apply hold

Release hold


Ref:

1.Process Order API In Order Management (Doc ID 746787.1)

2023年8月11日 星期五

Oracle EBS: OM的transaction type是否有API可用?

Q: OM的transaction type是否有API可用?

A: 沒有, 若要update, 可以直接改table, 但對於新增, 尚未能確定要寫入哪些table, 或許可以只處理以下兩個table:

OE_TRANSACTION_TYPES_ALL.

OE_TRANSACTION_TYPES_TL.


Ref:

1.API for creating transaction type in order management in r12

https://community.oracle.com/mosc/discussion/4297735/api-for-creating-transaction-type-in-order-management-in-r12



2023年8月4日 星期五

Oracle EBS: Receipt Routing概述

 Receipt Routing常看到, 但沒特別注意有什麼差別. 既然有人問了, 就來查查.

依原始說明資料:

Direct Delivery: 收貨後直接入庫, 在同一筆交易中

Standard Receipt: 收貨與入庫是各自獨立的交易, 入庫前可作檢驗或轉倉

Inspection Required: 收貨後進行檢驗, 另一筆獨立交易作入庫


--

Direct Delivery

Shipments are received into a receiving location and put away in the same transaction. Put away happens automatically upon receipt creation.

Standard Receipt

Shipments are received into a receiving location and then put away in a separate transaction. Standard receipts can be inspected or transferred before put away.

Inspection Required

Shipments are received into a receiving location and then inspected and put away in separate transactions. You can accept or reject material during the inspection, and put away to separate locations, based on the inspection result.


Ref:

1.Receipt Routing

https://docs.oracle.com/en/cloud/saas/supply-chain-management/23a/famli/receipt-routing.html#s20029748



2023年6月28日 星期三

EXCEL: 解決 UTF-8 編碼 CSV 檔案出現亂碼問題

解決 UTF-8 編碼 CSV 檔案出現亂碼問題


STEP 1: 在 Excel 中選擇「資料」頁籤中的「從文字/CSV匯入」。

STEP 2: 選擇自己的 CSV 檔案。

STEP 3: 實際匯入資料之前可以先預覽資料的狀況,預設的編碼方式是 Big5,要選擇正確的編碼才能得到正確的資料。

STEP 4: 如果是 UTF-8 編碼的 CSV 檔案,就選擇「65001: Unicode (UTF-8)」這個編碼方式。

STEP 5: 如果選擇的編碼正確,就可以看到實際的資料了,如果分隔符號不是逗號,也可以在這裡調整。確認資料沒問題之後,按下「載入」即可匯入資料。

STEP 6: 這是搭配正確的編碼,將 UTF-8 資料匯入的結果。


Ref:

1.Excel 解決 UTF-8 編碼 CSV 檔案出現亂碼問題教學

https://officeguide.cc/excel-import-csv-file-with-utf8-big5-encoding-tutorial-examples/



2023年5月22日 星期一

Oracle EBS: 客製的 Oracle Form 查不出使用記錄

問題: 客製的 Oracle Form 多數查不出使用記錄, 只有少數Form有記錄

原因: 客製的Form需要在 Pre-Form 中註明 Form name 跟 Application , 才會被加入使用記錄中





Oracle EBS: 查詢 Oracle Form 使用記錄

 查詢 Oracle Form 使用記錄


開啟 Oracle EBS 表單使用紀錄,且從DB查詢資料

SELECT ff.form_name,
fu.user_name,
he.full_name,
fl.start_time,
fl.end_time,
fl.pid,
fl.spid
FROM fnd_login_resp_forms flrf,
fnd_logins fl,
fnd_form ff,
fnd_user fu,
hr_employees he
WHERE ff.form_name = 'XXOMF005'
AND fl.start_time = TO_DATE('20110101', 'yyyymmdd')
AND fu.user_id = fl.user_id
AND flrf.login_id = fl.login_id
AND ff.form_id = flrf.form_id
AND he.employee_id(+) = fu.employee_id
ORDER BY start_time;

Notice:

需要將 profile: Sign-On:Audit Level 設成為 FORM , FND_LOGIN_RESP_FORMS 才會有資料
修改 profile Oracle AP 要重新啟動才會生效


Ref:

1. 查詢 Oracle Form 使用記錄

https://j178.mtgbb.com/?p=5


2. 找出180天內新增Form的使用次數

https://blog.twtnn.com/2017/04/ebs180form.html


3. {How TO} 誰曾經使用某個Form的紀錄?

https://somebabytina.pixnet.net/blog/post/11181884


2023年4月3日 星期一

Oracle EBS: reopen closed Inventory period

 標準功能不支援, 但可用SQL達成


--

DISCLAIMER: THE RE-OPENING OF A CLOSED INVENTORY PERIOD COULD POTENTIALLY CAUSE DATA CORRUPTION AND ANY DATA CORRUPTION CAUSED BY RE-OPENING A CLOSED INVENTORY PERIOD WILL BE THE RESPONSIBILITY OF THE CUSTOMER AND NO DATA FIX WILL BE PROVIDED FOR ANY DATA CORRUPTION THAT HAS BEEN CAUSED BY RE-OPENING A CLOSED PERIOD.


TEST THOROUGHLY ALL SCRIPTS ON A NON-PRODUCTION INSTANCE, FIRST BACKING UP ALL TABLE DATA PRIOR TO IMPLEMENTING IN PRODUCTION.


IF THERE IS CONCERN THAT RE-OPENING A CLOSED PERIOD MAY CAUSE DATA CORRUPTION PLEASE OPEN AN SR WITH ORACLE SUPPORT PRIOR TO RE-OPENING A CLOSED PERIOD.


-- A script to list all inventory periods for a specific organization

-- A script to reopen closed inventory accounting periods

-- The script will reopen all inventory periods for the specified 

-- Delete scripts to remove the rows created during the period close process to prevent duplicate rows

-- organization starting from the specified accounting period. 

-- The organization_id can be obtained from the MTL_PARAMETERS table. 

-- The acct_period_id can be obtained from the ORG_ACCT_PERIODS table.


1. Backup the following tables:

 org_acct_periods, mtl_period_summary, mtl_period_cg_summary, mtl_per_close_dtls and cst_period_close_summary.

 

2. SELECT acct_period_id period, open_flag, period_name name,

period_start_date, schedule_close_date, period_close_date

FROM org_acct_periods

WHERE organization_id = &org_id

order by 1,2;


3. UPDATE org_acct_periods

SET open_flag = 'Y',

period_close_date = NULL,

summarized_flag = 'N'

WHERE organization_id = &&org_id

AND acct_period_id >= &&acct_period_id;


DELETE mtl_period_summary

WHERE organization_id = &org_id

AND acct_period_id >= &acct_period_id;


DELETE mtl_period_cg_summary

WHERE organization_id = &org_id

AND acct_period_id >= &acct_period_id;


DELETE mtl_per_close_dtls

WHERE organization_id = &org_id

AND acct_period_id >= &acct_period_id;


DELETE cst_period_close_summary

WHERE organization_id = &org_id

AND acct_period_id >= &acct_period_id;


4. commit

5.Re-summarize all periods after problematic period again in order by running 'Period Close Reconciliation Report'.


Note:

The tables,  mtl_period_summary, mtl_period_cg_summary and mtl_per_close_dtls are designed in 11i. After R12 upgrade they were not used.

But as the script is available from earlier days, those tables were kept like that without deleting from the resummarization script.

they can ignore these tables  now.

The table cst_period_close_summary is the only table used in R12. The PCRR report picks the records from this table.



Ref:

1.Re-Open a Closed Inventory Accounting Period (Doc ID 472631.1)



2023年1月10日 星期二

Oracle EBS: 開啟Oracle Reports出現閃退問題

 問題: 開啟Oracle Reports出現閃退問題


原因: 可能有用過其他編碼儲存過檔案


解法: 新增環境變數

NLS_LANG = AMERICAN_AMERICA.UTF8


補充:

1.檔案路徑名稱不可有中文

2.若有在client端執行的Form , 中文會變亂碼



2022年12月30日 星期五

Oracle EBS: Supplier Item Catalog畫面Due Date之作用

 Oracle EBS: Supplier Item Catalog畫面Due Date之作用

在說明文件上查到:

11. Enter the Due Date to get documents that are current as of this date or future effective. If you access this window from the Requisitions or Purchase Orders window, the default is the due date on the originating document line.




Ref:

1.Finding Supplier Items

https://docs.oracle.com/cd/A60725_05/html/comnls/us/po/sicov01.htm



2022年12月26日 星期一

以Windows 命令列查看記憶體晶片資訊

 以Windows 命令列查看記憶體晶片資訊


wmic memorychip get capacity, speed


若不下參數, 還能看到廠牌型號等其他資訊.




2022年11月17日 星期四

Oracle EBS: 舊PO已approve過, 把新舊PO號碼對調後, 新PO無法正常approve

問題: 因要保留舊PO號碼, 故對調新舊PO號碼. 舊PO已approve過, 把新舊PO號碼對調後, 新PO無法正常approve


Error Message(在workflow及user收到的通知信上):

po.plsql.PO_DOCUMENT_ACTION_AUTH.approve:90:archive_po not successful -  po.plsql.PO_DOCUMENT_ACTION_PVT.do_action:110:unexpected error in action call


原因: archive中已有相同PO號碼及版次, 造成unique key衝突


解法: 修改archive資料


Ref:

1.PO Approval Errors: Po.plsql.PO_DOCUMENT_ACTION_AUTH.Approve:90:Archive_po Not Successful: ORA-00001: (PO.PO_HEADERS_ARCHIVE_U2) (Doc ID 1296639.1)



2022年10月28日 星期五

Oracle SQL: 去除換行、空格、水平符號

Oracle SQL: 去除換行、空格、水平符號


基本款:

select replace(replace(replace(replace(?string, chr(13), ''), chr(10), ''), chr(9), ''), ' ', '') from dual



進階款:

select translate(?string, 'a ' || chr(9) || chr(10) || chr(13), 'a') from dual



2022年10月13日 星期四

Oracle EBS: 使用excel格式(97-2003)的BI publisher report是否筆數能超過65536筆?

Q: 使用excel格式(97-2003)的BI publisher report是否筆數能超過65536筆?

A: 不行, 只能使用RTF格式, 或是把資料分割到多到工作表中. 在BI Publisher 11.1.1.9及後版本可以產生xslx檔. 


Ref:

1.Can we get more than 66K records by using BI publisher reports in excel output format ?

https://community.oracle.com/mosc/discussion/4115589/can-we-get-more-than-66k-records-by-using-bi-publisher-reports-in-excel-output-format


2.Splitting the Report into Multiple Sheets (Fusion Middleware Report Designer's Guide for Oracle Business Intelligence Publisher)

https://docs.oracle.com/middleware/11119/bip/BIPRD/create_excel_tmpl.htm#ext_multsheets


3.BI Publisher Excel Template Layout Output is Truncating Data to 65536 Rows (Doc ID 1469264.1)

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=533024111404255&id=1469264.1&_afrWindowMode=0&_adf.ctrl-state=orvd8jckk_4



2022年9月1日 星期四

Oracle EBS: 工單狀況與lookup_code對應

 工單狀況與lookup_code對應


SELECT flv.language,

       flv.lookup_code,

       flv.meaning,

       flv.description,

       flv.source_lang,

       flv.security_group_id,

       flv.tag,

       flttl.lookup_type,

       flttl.view_application_id,

       flttl.language,

       flttl.meaning,

       flttl.description

  FROM applsys.fnd_lookup_values flv, applsys.fnd_lookup_types_tl flttl

 WHERE (flttl.lookup_type = flv.lookup_type

        AND flv.lookup_type LIKE 'WIP_JOB_STATUS');