123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Data;
- using NUnit.Framework.Constraints;
- using TMPro;
- using Unity.Mathematics;
- using Unity.VisualScripting;
- using System.Text.RegularExpressions;
- using UnityEngine;
- using UnityEngine.SceneManagement;
- using UnityEngine.UI;
- using UnityEngine.Video;
-
- public class Main : MonoBehaviour{
-
- [SerializeField] TextMeshProUGUI 使用者_tb,日期_tb,彈跳文字_tb,報告書流水號_tb,報告書扶手總長_tb,報告書申請人_tb,報告書開立人_tb,提示_tb,圖片讀取_tb,相片目前_tb,相片總數_tb,
- 扶手已使用長度_tb,扶手可使用長度_tb,輸入單項扶手總長度_tb,單項扶手長度_tb,扶手總長2_lb,扶手長度_lb,請輸入扶手總長度_lb,扶手總長度_lb,已使用扶手長度_lb,可使用扶手長度_lb,
- 扶手長度2_lb,項目清單2_lb,更換照片提示_tb,評估主頁抬頭_tb,報告書人員資料_申請人_tb,報告書人員資料_客編_tb,報告書人員資料_聯繫人_tb,報告書人員資料_聯繫人電話_tb,
- 報告書人員資料_地址_tb,報告書人員資料_聯繫人2_tb,報告書人員資料_聯繫人2電話_tb,報告書項目清單_報告書號_tb,報告書新增客編_tb,相關文件相片總數_tb,相關文件相片目前_tb,
- 施作圖片相片總數_tb,施作圖片相片目前_tb,施作圖片相片文件號_tb,文件圖片相片文件號_tb,施工前_tb,施工後_tb;
- [SerializeField] GameObject 背景_pl,首頁_pl,系統設定_pl,彈跳_pl,評估_pl,表頭_pl,複製體1,複製體2,評估主頁_pl,評估詳細_pl,拍照頁面_pl,評估紀錄_pl,圖片讀取_pl,新建_pl,選擇客戶_pl,
- 客戶清單表頭_pl,報告書圖片_pl,新增項目_pl,文件號_sv,項目清單_sv,報告書資料_pl,項目清單_lb,長照類_sv,圖片寬度_pl,頁面高度_pl,扶手總長_lb,扶手總長_tb,輸入扶手長度_pl,
- 輸入單項扶手長度_pl,備註_pl,更換照片_pl,報告書_pl,新客戶_pl,小工具_pl,倍瑞菲_pl,系統設定2_pl,主頁_pl,大主頁_pl,查詢_pl, 報告書人員清單_pl,報告書人員資料_pl,表頭2_pl,
- 報告書項目清單_pl,報告書新增人員_pl,報告書人員清單_年份_cb,報告書文件圖片讀取_pl,報告書文件圖片寬度_pl,報告書文件圖片_pl,施作項目_lb,施作項目_sv,施作圖片_pl,
- 評估報告書1_物料清單_sv,施作圖片圖片讀取_pl,施作圖片圖片寬度_pl;
- [SerializeField] GameObject 長照類_bt,身障類_bt,自費類_bt,返回3_bt,發送通知_bt,回選單_bt,新增項目_bt,刪除項目_bt,更換照片資料夾_bt,更換照片文件號_bt,更換照片確認_bt,
- 更換照片取消_bt,更換照片拍照確認_bt,核銷文件_bt,更換照片_bt,刪除照片_bt,業務系統_bt,系統設定_bt,施工前_bt,施工後_bt,拍照_bt,回上頁_bt,文件號_bt,返回8_bt,
- 長照類_相關文件_bt,長照類_核定通知書_bt,長照類_評估報告書1_bt,長照類_評估報告書2_bt,返回4_bt,長照類_申請人身分證反面_bt,長照類_受託人身分證反面_bt,長照類_所有權人身分證反面_bt,
- 長照類_房屋所有權狀_bt,長照類_土地所有權狀_bt,長照類_房屋稅籍證明_bt,長照類_土地稅籍證明_bt,長照類_房屋稅單_bt,長照類_土地稅單_bt,返回5_bt,拍照1_bt,刪除1_bt,存檔1_bt,返回1_bt,
- 返回2_bt,返回2_1_bt,查詢1_bt,新增客戶1_bt,長照類_申請人身心障礙證明_bt,拍照_文件號_bt,拍照_施工前_bt,拍照_施工後_bt,拍照_申請人身分證正反面_bt,拍照_委託人身分證正反面_bt,
- 拍照_所有權人身分證正反面_bt, 拍照_申請人身心障礙證明正反面_bt,拍照_房屋所有權狀_bt,拍照_土地所有權狀_bt,拍照_房屋稅籍證明_bt,拍照_土地稅籍證明_bt,拍照_房屋稅單_bt,
- 拍照_土地稅單_bt,施作項目_新增_bt,施作項目_刪除_bt,返回6_bt,返回7_bt,拍照_評估報告書1_bt,備註_bt,拍照_評估報告書2_bt,長照類_案場1_bt,長照類_案場2_bt,長照類_案場3_bt,
- 施作顯示_tb,存檔2_bt,拍照_核定通知書_bt,拍照_案場1_bt,拍照_案場2_bt,拍照_案場3_bt,產品序號_bt;
- [SerializeField] Image 施工前_img,施工後_img,產品序號_img;
- [SerializeField] TMP_InputField 輸入扶手總長_tb,扶手長度_tb,備註_tb,報告書查詢1_tb,報告書新增申請人_tb,報告書新增住址_tb,報告書新增電話_tb,報告書新增聯繫人_tb,
- 報告書新增聯繫人電話_tb,報告書新增聯繫人2_tb,報告書新增聯繫人2電話_tb,施作_tb;
- [SerializeField] RawImage 拍照用,放圖用,更換照片放圖用,更換照片拍照用;
- //[SerializeField] GridLayoutGroup gridLayout;
- private WebCamTexture myCam;
- public TMP_FontAsset myFont;
- public Sprite UIsprite;
- public Transform 報告書人員清單_tp;public GameObject 報告書人員清單_rpf;public GameObject 報告書人員清單_ct;public GameObject 報告書人員清單_lpf;
- public Transform 報告書清單_tp;public GameObject 報告書清單_rpf;public GameObject 報告書清單_ct;public GameObject 報告書清單_lpf;
- public Transform 文件號清單_tp;public GameObject 文件號清單_rpf;public GameObject 文件號清單_ct;public GameObject 文件號清單_lpf;
- public Transform 報告書項目清單_tp;public GameObject 報告書項目清單_rpf;public GameObject 報告書項目清單_ct;public GameObject 報告書項目清單_lpf;
- public Transform 報告書施工圖片_tp;public GameObject 報告書施工圖片_rpf;public GameObject 報告書施工圖片_ct;public GameObject 報告書施工圖片_lpf;
- public Transform 客戶清單_tp;public GameObject 客戶清單_rpf;public GameObject 客戶清單_ct;public GameObject 客戶清單_lpf;
- public Transform 長照物料清單_tp;public GameObject 長照物料清單_rpf;public GameObject 長照物料清單_ct;public GameObject 長照物料清單_lpf;
- public Transform 報告書文件圖片_tp;public GameObject 報告書文件圖片_rpf;public GameObject 報告書文件圖片_ct;public GameObject 報告書文件圖片_lpf;
- public Transform 報告書施作項目清單_tp;public GameObject 報告書施作項目清單_rpf;public GameObject 報告書施作項目清單_ct;public GameObject 報告書施作項目清單_lpf;
- public Transform 報告書施作圖片_tp;public GameObject 報告書施作圖片_rpf;public GameObject 報告書施作圖片_ct;public GameObject 報告書施作圖片_lpf;
- public Transform 報告書施作圖片_物料清單_tp;public GameObject 報告書施作圖片_物料清單_rpf;public GameObject 報告書施作圖片_物料清單_ct;public GameObject 報告書施作圖片_物料清單_lpf;
- public SQL_LINE sql_line;
-
- private string loadingText = "";
-
- private int dotCount = 0;
- void Start(){
- DateTime today = DateTime.Today;
- 使用者_tb.text = Global.使用者暱稱;
- 日期_tb.text = today.Year.ToString().PadLeft(2,'0')+" 年 "+today.Month.ToString().PadLeft(2,'0')+" 月 "+today.Day.ToString().PadLeft(2,'0')+" 日 "+ GetChineseDayOfWeek(today.DayOfWeek);
- Global.複製體1 = 複製體1;Global.複製體2 = 複製體2;
- StartCoroutine(AnimateText());
- }
- void Update(){
-
- }
-
- public void 系統設定2_bt(){
- 主頁_pl.SetActive(false);系統設定2_pl.SetActive(true);
- }
- public void 回主頁_bt(){
- 主頁_pl.SetActive(true);系統設定2_pl.SetActive(false);
- }
- public void 報告書_pl_bt(){
- 大主頁_pl.SetActive(false);主頁_pl.SetActive(false);系統設定2_pl.SetActive(false);報告書_pl.SetActive(true);
- 評估_pl.SetActive(true);新建_pl.SetActive(false);報告書新增人員_pl.SetActive(false);查詢1_bt.SetActive(true);新增客戶1_bt.SetActive(true);
- 報告書人員清單_年份_cb.GetComponent<TMP_Dropdown>().ClearOptions();
- List<string> yearList = new();
- int currentYear = DateTime.Now.Year;
- int defaultIndex = 0;
- SQL_Comm.SQL_客戶資料表_年份();
- while (SQL_Module.dr.Read()){
- string yearStr = SQL_Module.dr["年份"].ToString();
- yearList.Add(yearStr);
- if (yearStr == currentYear.ToString()) {
- defaultIndex = yearList.Count - 1;
- }
- }
- 報告書人員清單_年份_cb.GetComponent<TMP_Dropdown>().AddOptions(yearList);
- 報告書人員清單_年份_cb.GetComponent<TMP_Dropdown>().value=defaultIndex;
- 報告書人員清單_年份_cb.GetComponent<TMP_Dropdown>().RefreshShownValue();
- Set_報告書人員清單("");
- }
- public void 報告書返回1(){
- 大主頁_pl.SetActive(true);主頁_pl.SetActive(false);系統設定2_pl.SetActive(false);報告書_pl.SetActive(false);
- }
-
- public void 報告書清單返回1(){
- 大主頁_pl.SetActive(true);主頁_pl.SetActive(true);系統設定2_pl.SetActive(false);報告書_pl.SetActive(false);
-
- }
- public void 報告書清單返回2(){
- 報告書人員清單_pl.SetActive(true);報告書人員資料_pl.SetActive(false);報告書項目清單_pl.SetActive(false);報告書新增人員_pl.SetActive(false);
- 返回1_bt.SetActive(true);查詢1_bt.SetActive(true);新增客戶1_bt.SetActive(true);返回2_bt.SetActive(false);返回2_1_bt.SetActive(false);
- }
- public void 報告書清單返回3(){
- 報告書人員清單_pl.SetActive(false);報告書人員資料_pl.SetActive(true);報告書項目清單_pl.SetActive(false);
- 返回2_bt.SetActive(true);返回3_bt.SetActive(false);
- }
- public void 報告書清單返回4(){
- 長照類_bt.SetActive(true);身障類_bt.SetActive(true);自費類_bt.SetActive(true);返回3_bt.SetActive(true);
- 長照類_核定通知書_bt.SetActive(false);長照類_相關文件_bt.SetActive(false);長照類_評估報告書1_bt.SetActive(false);
- 長照類_評估報告書2_bt.SetActive(false);返回4_bt.SetActive(false);
- }
- public void 報告書清單返回8(){
- 長照類_bt.SetActive(true);身障類_bt.SetActive(true);自費類_bt.SetActive(true);返回3_bt.SetActive(true);
- 長照類_案場1_bt.SetActive(false);長照類_案場2_bt.SetActive(false);長照類_案場3_bt.SetActive(false);返回8_bt.SetActive(false);
- }
- public void 報告書清單返回5(){
- 長照類_核定通知書_bt.SetActive(true);長照類_相關文件_bt.SetActive(true);長照類_評估報告書1_bt.SetActive(true);
- 長照類_評估報告書2_bt.SetActive(true);返回4_bt.SetActive(true);
- 長照類_申請人身分證反面_bt.SetActive(false);長照類_受託人身分證反面_bt.SetActive(false);長照類_所有權人身分證反面_bt.SetActive(false);
- 長照類_房屋所有權狀_bt.SetActive(false);長照類_土地所有權狀_bt.SetActive(false);長照類_房屋稅籍證明_bt.SetActive(false);長照類_土地稅籍證明_bt.SetActive(false);
- 長照類_房屋稅單_bt.SetActive(false);長照類_土地稅單_bt.SetActive(false);返回5_bt.SetActive(false);拍照1_bt.SetActive(false);刪除1_bt.SetActive(false);
- 存檔1_bt.SetActive(false);報告書文件圖片_pl.SetActive(false);長照類_申請人身心障礙證明_bt.SetActive(false);
- RectTransform rt = 報告書文件圖片_pl.GetComponent<RectTransform>();
- rt.offsetMax = new Vector2(rt.offsetMax.x, -706.66f);
-
- }
- public void 報告書清單搜尋1(){
- 查詢_pl.SetActive(true);報告書查詢1_tb.text="";
- }
- public void 報告書清單搜尋確認1(){
- 查詢_pl.SetActive(false);string 搜尋條件 = " AND (客戶資料表.負責人 LIKE N'%" + 報告書查詢1_tb.text + "%' OR 客戶資料表.聯繫人1 LIKE N'%" + 報告書查詢1_tb.text + "%') ";
- Set_報告書人員清單(搜尋條件);
- }
- public void 主頁新增(){
- 大主頁_pl.SetActive(false);主頁_pl.SetActive(false);系統設定2_pl.SetActive(false);報告書_pl.SetActive(true);
- 評估_pl.SetActive(true);新建_pl.SetActive(false);
- Global.主頁新增=true;
- 真新增();
- }
- private void 真新增(){
- 報告書新增人員_pl.SetActive(true);報告書新增客編_tb.text="";報告書新增申請人_tb.text="";報告書新增住址_tb.text="";報告書新增電話_tb.text="";報告書新增聯繫人_tb.text="";
- 報告書新增聯繫人電話_tb.text="";
-
- 報告書人員清單_pl.SetActive(false);報告書人員資料_pl.SetActive(true);報告書項目清單_pl.SetActive(false);
- 評估主頁抬頭_tb.text = "";報告書人員資料_申請人_tb.text = "";報告書人員資料_客編_tb.text = "";報告書人員資料_聯繫人_tb.text = "";
- 報告書人員資料_聯繫人電話_tb.text = "";報告書人員資料_地址_tb.text = "";報告書人員資料_聯繫人2_tb.text="";報告書人員資料_聯繫人2電話_tb.text="";
- 返回1_bt.SetActive(false);查詢1_bt.SetActive(false);新增客戶1_bt.SetActive(false);
- if(Global.主頁新增){
- 返回2_bt.SetActive(false);返回2_1_bt.SetActive(true);
- }else{
- 返回2_bt.SetActive(true);返回2_1_bt.SetActive(false);
- }
-
-
- string 加盟商代號;
- SQL_Comm.SQL_載入供應商代號(Global.gUser區域);
- if(SQL_Module.dr.Read()){
- 加盟商代號=SQL_Module.dr["加盟商代號"].ToString();
- }else{
- 加盟商代號 = "CN";
- }
- SQL_Comm.SQL_客戶資料表_最後一筆資料(Global.gUser區域);
- if (SQL_Module.dr.Read()){
- 報告書新增客編_tb.text = SQL_Module.dr["流水號"].ToString();
- }else{
- 報告書新增客編_tb.text = $"{加盟商代號}{DateTime.Today:yyMM}000";
- }
- string 年份 = DateTime.Today.ToString("yy");
- string 月份 = DateTime.Today.ToString("MM");
- if (報告書新增客編_tb.text.Length >= 加盟商代號.Length + 4){
- if (報告書新增客編_tb.text.Substring(加盟商代號.Length, 2) == 年份 && 報告書新增客編_tb.text.Substring(加盟商代號.Length + 2, 2) == 月份){
- string lastThreeDigits = 報告書新增客編_tb.text[^3..];
- if (int.TryParse(lastThreeDigits, out int num)){
- num += 1;
- 報告書新增客編_tb.text = $"{加盟商代號}{年份}{月份}{num:000}";
- }else{
- 報告書新增客編_tb.text = $"{加盟商代號}{年份}{月份}001";
- }
- }else{
- 報告書新增客編_tb.text = $"{加盟商代號}{年份}{月份}001";
- }
- }else{
- 報告書新增客編_tb.text = $"{加盟商代號}{年份}{月份}001";
- }
- }
- public void 報告書清單新增人員1(){
- Global.主頁新增=false;真新增();
- }
- public void 報告書清單確認新增1(){
- 報告書新增人員_pl.SetActive(false);報告書人員資料_客編_tb.text = 報告書新增客編_tb.text;報告書人員資料_申請人_tb.text = 報告書新增申請人_tb.text;
- 報告書人員資料_聯繫人_tb.text = 報告書新增聯繫人_tb.text;報告書人員資料_聯繫人電話_tb.text = 報告書新增聯繫人電話_tb.text;報告書人員資料_地址_tb.text = 報告書新增住址_tb.text;
- 報告書人員資料_聯繫人2_tb.text = 報告書新增聯繫人2_tb.text;報告書人員資料_聯繫人2電話_tb.text = 報告書新增聯繫人2電話_tb.text;
- SQL_Comm.SQL_客戶資料表_新增(報告書人員資料_客編_tb.text,DateTime.Today.ToString("yyyy/MM/dd"),"","",報告書人員資料_地址_tb.text,報告書人員資料_申請人_tb.text,
- Global.gUserName,報告書人員資料_聯繫人_tb.text,報告書人員資料_聯繫人電話_tb.text,"","",Global.gUser區域,"","",報告書人員資料_聯繫人2_tb.text,
- 報告書人員資料_聯繫人2電話_tb.text,"","","","");
- Set_報告書人員清單("");
- }
- public void 報告書新增報告書(){
- double NUM1;string dat1;string 報告書號;string 圖檔資料庫="";
- Set_日期格式轉換();
- SQL_Comm.SQL_取得加盟商編號(Global.gUser區域);
- if(SQL_Module.dr.Read()){
- Global.gUser加盟商編號=SQL_Module.dr[0].ToString();
- }else{
- Global.gUser加盟商編號="未設定加盟商";
- }
- SQL_Comm.SQL_報告書_查詢流水號(Global.gUser區域);
- if(SQL_Module.dr.Read()){
- 報告書號 = SQL_Module.dr["流水號"].ToString();
- }else{
- 報告書號 = "RE" + Global.DTP1[2..] + "00-" + Global.gUser加盟商編號;
- }
- dat1 = 報告書號.Substring(2, 6);
- if(dat1 != Global.DTP1[2..]){
- NUM1 = 1;
- }else{
- NUM1 = double.Parse(報告書號.Substring(8, 2)) + 1;
- }
- 報告書號 = "RE" + Global.DTP1[2..] + NUM1.ToString().PadLeft(2, '0') + "-" + Global.gUser加盟商編號;
- SQL_Comm.SQL_查詢圖檔資料庫();
- if(SQL_Module.dr.Read()){
- 圖檔資料庫 = SQL_Module.dr[0].ToString();
- SQL_Comm.SQL_報告書_新增(報告書號, 報告書人員資料_客編_tb.text, DateTime.Today.ToString("yyyy/MM/dd"), Global.gUserName, Global.gUser區域, 圖檔資料庫);
- Set_報告書清單(報告書人員資料_客編_tb.text,報告書人員資料_申請人_tb.text,報告書人員資料_聯繫人_tb.text,報告書人員資料_聯繫人電話_tb.text,報告書人員資料_地址_tb.text,報告書人員資料_聯繫人2_tb.text,報告書人員資料_聯繫人2電話_tb.text);
- }
- }
- public void 報告書清單拍照1(){
- 拍照頁面_pl.SetActive(true);
- 拍照_文件號_bt.SetActive(false);拍照_施工前_bt.SetActive(false);拍照_施工後_bt.SetActive(false);拍照_申請人身分證正反面_bt.SetActive(false);拍照_委託人身分證正反面_bt.SetActive(false);
- 拍照_所有權人身分證正反面_bt.SetActive(false);拍照_申請人身心障礙證明正反面_bt.SetActive(false);拍照_房屋所有權狀_bt.SetActive(false);拍照_土地所有權狀_bt.SetActive(false);
- 拍照_房屋稅籍證明_bt.SetActive(false);拍照_土地稅籍證明_bt.SetActive(false);拍照_房屋稅單_bt.SetActive(false);拍照_土地稅單_bt.SetActive(false);拍照_評估報告書2_bt.SetActive(false);
- 拍照_評估報告書1_bt.SetActive(false);拍照_案場1_bt.SetActive(false);拍照_案場2_bt.SetActive(false);拍照_案場3_bt.SetActive(false);拍照_核定通知書_bt.SetActive(false);
- if(Global.報告書選項2 =="評估報告書1"){
- 拍照_評估報告書1_bt.SetActive(true);
- }else if(Global.報告書選項2 =="評估報告書2"){
- 拍照_評估報告書2_bt.SetActive(true);
- }else if(Global.報告書選項2 =="核定通知書"){
- 拍照_核定通知書_bt.SetActive(true);
- }else if(Global.報告書選項2 =="案場1"){
- 拍照_案場1_bt.SetActive(true);
- }else if(Global.報告書選項2 =="案場2"){
- 拍照_案場2_bt.SetActive(true);
- }else if(Global.報告書選項2 =="案場3"){
- 拍照_案場3_bt.SetActive(true);
- }else{
- if(Global.報告書選項3 =="申請人身分證正反面"){拍照_申請人身分證正反面_bt.SetActive(true);}
- else if(Global.報告書選項3 =="委託人身分證正反面"){拍照_委託人身分證正反面_bt.SetActive(true);}
- else if(Global.報告書選項3 =="所有權人身分證正反面"){拍照_所有權人身分證正反面_bt.SetActive(true);}
- else if(Global.報告書選項3 =="申請人身心障礙證明正反面"){拍照_申請人身心障礙證明正反面_bt.SetActive(true);}
- else if(Global.報告書選項3 =="房屋所有權狀"){拍照_房屋所有權狀_bt.SetActive(true);}
- else if(Global.報告書選項3 =="土地所有權狀"){拍照_土地所有權狀_bt.SetActive(true);}
- else if(Global.報告書選項3 =="房屋稅籍證明"){拍照_房屋稅籍證明_bt.SetActive(true);}
- else if(Global.報告書選項3 =="土地稅籍證明"){拍照_土地稅籍證明_bt.SetActive(true);}
- else if(Global.報告書選項3 =="房屋稅單"){拍照_房屋稅單_bt.SetActive(true);}
- else if(Global.報告書選項3 =="土地稅單"){拍照_土地稅單_bt.SetActive(true);}
- }
-
- StartCoroutine(open_Camera(60));
- 提示_tb.text ="拍照中";
- //拍照2(Global.報告書選項3);
- 拍照用.gameObject.SetActive(true);
- 放圖用.gameObject.SetActive(false);
- }
- public void 拍照2(string 階段){
- if (拍照用.gameObject.activeSelf && !放圖用.gameObject.activeSelf){
- Texture2D photoTexture = CapturePhoto();
- if (photoTexture != null){
- 放圖用.rectTransform.sizeDelta = new Vector2(720f, 1280f);
- 放圖用.texture = photoTexture;
- Texture2D texture2D = new((放圖用.texture as Texture2D).width, (放圖用.texture as Texture2D).height);
- Graphics.CopyTexture(放圖用.texture, texture2D);
- byte[] imageBytes = texture2D.EncodeToPNG();
- SQL_Comm.SQL_取得報告書資料(報告書流水號_tb.text);
- if(SQL_Module.dr.Read()){
- Global.圖檔資料庫 = SQL_Module.dr["圖檔資料庫"].ToString();
- SQL_CommString.SQL_連線字串_圖片_SQL(Global.圖檔資料庫,Global.資料庫IP);
- if(階段=="評估報告書1" || 階段=="評估報告書2" || 階段=="案場1" || 階段=="案場2" || 階段=="案場3"){
- SQL_Comm.SQL_讀取施工圖檔流水號(報告書流水號_tb.text,Global.報告書施工狀態,Global.報告書選項2,Global.報告書物料料號,Global.報告書物料明細流水號);
- int 流水號2;if(SQL_Module.dr.Read()){流水號2=int.Parse(SQL_Module.dr[0].ToString()[2..]);}else{流水號2 = 0;}流水號2+=1;
- SQL_Comm.SQL_上傳施工圖檔(報告書流水號_tb.text,Global.報告書施工狀態,Global.報告書選項2,Global.報告書物料料號,imageBytes,"JPG","IM"+流水號2.ToString().PadLeft(3,'0'),"0",Global.報告書物料明細流水號);
- }else{
- SQL_Comm.SQL_讀取相關文件圖檔流水號(報告書流水號_tb.text,階段);
- int 流水號;if(SQL_Module.dr.Read()){流水號=int.Parse(SQL_Module.dr["流水號"].ToString()[^8..]);}else{流水號 = 0;}流水號+=1;
- SQL_Comm.SQL_上傳相關文件圖檔("IM"+流水號.ToString().PadLeft(8,'0'),報告書流水號_tb.text,階段,imageBytes,"JPG","");
- }
- 拍照結束2(階段);
- }
- }
- myCam.Stop();
- myCam = null;
- 提示_tb.text ="";
- }
- }
- private void 拍照結束2(string 階段){
- 拍照頁面_pl.SetActive(false);
- //PhotoScroll.清除currentPage();
- if(階段=="評估報告書1" || 階段=="評估報告書2" || 階段=="案場1" || 階段=="案場2" || 階段=="案場3"){
- //Set_評估報告書1清單("評估報告書1");
- 載入圖片清單2(Global.報告書施工狀態,報告書施作圖片_tp,報告書施作圖片_rpf,報告書施作圖片_ct,報告書施作圖片_lpf,施作圖片圖片讀取_pl,施作圖片圖片寬度_pl);
- }else{
- 載入圖片清單(階段,報告書文件圖片_tp,報告書文件圖片_rpf,報告書文件圖片_ct,報告書文件圖片_lpf,報告書文件圖片讀取_pl,報告書文件圖片寬度_pl);
- }
-
- }
- public void Set_報告書人員清單年份刷新(){
- Set_報告書人員清單("");
- }
- private void 載入圖片清單(string 階段,Transform 文件圖片_tp, GameObject 文件圖片_rpf, GameObject 文件圖片_ct, GameObject 文件圖片_lpf,GameObject 圖片讀取,GameObject 圖片寬度){
- 圖片讀取.SetActive(true);
- Module.清除控件(文件圖片_ct);
- SQL_Comm.SQL_取得報告書資料(報告書項目清單_報告書號_tb.text);
- if(SQL_Module.dr.Read()){
- 報告書申請人_tb.text = SQL_Module.dr["負責人"].ToString();
- 報告書開立人_tb.text = SQL_Module.dr["開立人"].ToString();
- Global.圖檔資料庫 = SQL_Module.dr["圖檔資料庫"].ToString();
- Debug.Log(Global.圖檔資料庫);
- SQL_CommString.SQL_連線字串_圖片_SQL(Global.圖檔資料庫,Global.資料庫IP);
- SQL_Comm.SQL_報告書_相關文件圖片清單(報告書項目清單_報告書號_tb.text,階段);
- DataSet ds1 = new();
- SQL_Module.da.Fill(ds1);
- if(ds1.Tables[0].Rows.Count>0){
- 相關文件相片目前_tb.text="1";相關文件相片總數_tb.text=ds1.Tables[0].Rows.Count.ToString();
- 文件圖片相片文件號_tb.text=ds1.Tables[0].Rows[0][0].ToString();
- }else{
- 相關文件相片目前_tb.text="-";相關文件相片總數_tb.text="-";文件圖片相片文件號_tb.text="文件號";
- }
- Global.報告書相關文件_table = ds1.Tables[0];
- 文件圖片_ct.GetComponent<RectTransform>().sizeDelta=new Vector2(圖片寬度.GetComponent<RectTransform>().rect .width,文件圖片_ct.GetComponent<RectTransform>().sizeDelta.y);
- 文件圖片_rpf.GetComponent<RectTransform>().sizeDelta=new Vector2(圖片寬度.GetComponent<RectTransform>().rect .width,文件圖片_rpf.GetComponent<RectTransform>().sizeDelta.y);
- 載入報告書圖片("報告書相關文件"+階段,ds1.Tables[0],文件圖片_tp,文件圖片_rpf,文件圖片_ct,myFont,UIsprite,文件圖片_lpf,true);
- 圖片讀取.SetActive(false);
- }
- }
-
- void 更新按鈕顏色(string 階段){
- Dictionary<string, GameObject> 按鈕對應表 = new(){
- { "申請人身分證正反面", 長照類_申請人身分證反面_bt },{ "委託人身分證正反面", 長照類_受託人身分證反面_bt },{ "所有權人身分證正反面", 長照類_所有權人身分證反面_bt },
- { "申請人身心障礙證明正反面", 長照類_申請人身心障礙證明_bt },{ "房屋所有權狀", 長照類_房屋所有權狀_bt }, { "土地所有權狀", 長照類_土地所有權狀_bt },
- { "房屋稅籍證明", 長照類_房屋稅籍證明_bt },{ "土地稅籍證明", 長照類_土地稅籍證明_bt },{ "房屋稅單", 長照類_房屋稅單_bt },{ "土地稅單", 長照類_土地稅單_bt }
- };
- GameObject[] 所有按鈕 = {
- 長照類_申請人身分證反面_bt,長照類_申請人身心障礙證明_bt,長照類_所有權人身分證反面_bt,長照類_受託人身分證反面_bt,長照類_房屋所有權狀_bt,長照類_房屋稅籍證明_bt,
- 長照類_房屋稅單_bt,長照類_土地所有權狀_bt,長照類_土地稅籍證明_bt,長照類_土地稅單_bt
- };
- foreach (var 按鈕 in 所有按鈕){
- var image = 按鈕.transform.Find("Image")?.GetComponent<Image>();if (image != null) {image.color = new Color32(255, 255, 255, 255);}
- }
- if (按鈕對應表.TryGetValue(階段, out GameObject 高亮按鈕)) {
- var image = 高亮按鈕.transform.Find("Image")?.GetComponent<Image>();if (image != null){image.color = new Color32(158, 255, 183, 255);}
- }
- }
- public void 報告書相關文件(string 階段){
- Global.報告書選項3 = 階段;
- 更新按鈕顏色(階段);
- 載入圖片清單(階段,報告書文件圖片_tp,報告書文件圖片_rpf,報告書文件圖片_ct,報告書文件圖片_lpf,報告書文件圖片讀取_pl,報告書文件圖片寬度_pl);
- }
- public void 新增報告書_bt_Click(string 階段){
- Global.報告書選項3 = 階段;
- 載入圖片清單(階段,報告書文件圖片_tp,報告書文件圖片_rpf,報告書文件圖片_ct,報告書文件圖片_lpf,報告書文件圖片讀取_pl,報告書文件圖片寬度_pl);
- }
- private void 讀取施作(string 文件號){
- SQL_Comm.SQL_報告書_查詢施作(報告書流水號_tb.text,文件號);
- if(SQL_Module.dr.Read()){
- Global.報告書物料明細流水號=SQL_Module.dr[0].ToString();
- Global.報告書物料料號 = SQL_Module.dr[1].ToString();
- 施作_tb.text=SQL_Module.dr[1].ToString();
- }else{
- SQL_Comm.SQL_報告書_讀取流水號();
- string 流水號;
- if(SQL_Module.dr.Read()){
- 流水號 = SQL_Module.dr[0].ToString();
- }else{
- 流水號 = "WS00000000-FC001";
- }
- int 新流;
- if(流水號.Contains("-")){
- string[] 前後 = 流水號.Split('-');
- 新流 = int.Parse(前後[0][2..]) + 1;
- }else{
- 新流 = int.Parse(流水號[2..]) + 1;
- }
- string 欣欣 = "WS"+新流.ToString().PadLeft(8,'0');
- Global.報告書物料明細流水號=欣欣;
- Global.報告書物料料號 = "";
- 施作_tb.text="";
- SQL_Comm.SQL_報告書_新增施作("",報告書流水號_tb.text,文件號,欣欣);
- }
- }
- public void 長照類_案場1_bt_click(){
- 長照類_案場1_bt.SetActive(false);長照類_案場2_bt.SetActive(false);長照類_案場3_bt.SetActive(false);返回8_bt.SetActive(false);
- 施作項目_lb.SetActive(true);施作項目_sv.SetActive(false);施作圖片_pl.SetActive(true);施作項目_新增_bt.SetActive(false);施作項目_刪除_bt.SetActive(false);
- 施作顯示_tb.SetActive(true);存檔2_bt.SetActive(true);
- 返回6_bt.SetActive(true);施工前_bt.SetActive(true);施工後_bt.SetActive(true);備註_bt.SetActive(true);產品序號_bt.SetActive(false);
- 施工前_tb.text = "施工前";施工後_tb.text = "施工後";
- Set_評估報告書1清單("案場1");
- Global.報告書選項2="案場1";
- 讀取施作(Global.報告書選項2);
- }
- public void 長照類_案場2_bt_click(){
- 長照類_案場1_bt.SetActive(false);長照類_案場2_bt.SetActive(false);長照類_案場3_bt.SetActive(false);返回8_bt.SetActive(false);
- 施作項目_lb.SetActive(true);施作項目_sv.SetActive(false);施作圖片_pl.SetActive(true);施作項目_新增_bt.SetActive(false);施作項目_刪除_bt.SetActive(false);
- 施作顯示_tb.SetActive(true);存檔2_bt.SetActive(true);
- 返回6_bt.SetActive(true);施工前_bt.SetActive(true);施工後_bt.SetActive(true);備註_bt.SetActive(true);產品序號_bt.SetActive(false);
- 施工前_tb.text = "施工前";施工後_tb.text = "施工後";
- Set_評估報告書1清單("案場2");
- Global.報告書選項2="案場2";
- 讀取施作(Global.報告書選項2);
- }
- public void 長照類_案場3_bt_click(){
- 長照類_案場1_bt.SetActive(false);長照類_案場2_bt.SetActive(false);長照類_案場3_bt.SetActive(false);返回8_bt.SetActive(false);
- 施作項目_lb.SetActive(true);施作項目_sv.SetActive(false);施作圖片_pl.SetActive(true);施作項目_新增_bt.SetActive(false);施作項目_刪除_bt.SetActive(false);
- 施作顯示_tb.SetActive(true);存檔2_bt.SetActive(true);
- 返回6_bt.SetActive(true);施工前_bt.SetActive(true);施工後_bt.SetActive(true);備註_bt.SetActive(true);產品序號_bt.SetActive(false);
- Set_評估報告書1清單("案場3");
- 施工前_tb.text = "施工前";施工後_tb.text = "施工後";
- Global.報告書選項2="案場3";
- 讀取施作(Global.報告書選項2);
- }
- public void 長照類_存檔2_bt_click(){
- Global.報告書物料料號 = 施作_tb.text;
- SQL_Comm.SQL_報告書_修改施作(施作_tb.text,報告書流水號_tb.text,Global.報告書選項2,Global.報告書物料明細流水號);
- SQL_Comm.SQL_取得報告書資料(報告書流水號_tb.text);
- if(SQL_Module.dr.Read()){
- Global.圖檔資料庫 = SQL_Module.dr["圖檔資料庫"].ToString();
- SQL_CommString.SQL_連線字串_圖片_SQL(Global.圖檔資料庫,Global.資料庫IP);
- SQL_Comm.SQL_報告書_修改施作2(施作_tb.text,報告書流水號_tb.text,Global.報告書選項2);
- }
- }
- public void 長照類_評估報告書1_bt_click(){
- 長照類_核定通知書_bt.SetActive(false);長照類_相關文件_bt.SetActive(false);長照類_評估報告書1_bt.SetActive(false);
- 長照類_評估報告書2_bt.SetActive(false);返回4_bt.SetActive(false);
- 施作項目_lb.SetActive(true);施作項目_sv.SetActive(true);施作圖片_pl.SetActive(true);施作項目_新增_bt.SetActive(true);施作項目_刪除_bt.SetActive(true);
- 返回6_bt.SetActive(true);施工前_bt.SetActive(true);施工後_bt.SetActive(true);備註_bt.SetActive(true);產品序號_bt.SetActive(false);
- 施工前_tb.text = "施工前";施工後_tb.text = "施工後";
- Set_評估報告書1清單("評估報告書1");
- Global.報告書選項2="評估報告書1";
- }
- public void 長照類_評估報告書2_bt_click(){
- 長照類_核定通知書_bt.SetActive(false);長照類_相關文件_bt.SetActive(false);長照類_評估報告書1_bt.SetActive(false);
- 長照類_評估報告書2_bt.SetActive(false);返回4_bt.SetActive(false);
- 施作項目_lb.SetActive(true);施作項目_sv.SetActive(true);施作圖片_pl.SetActive(true);施作項目_新增_bt.SetActive(true);施作項目_刪除_bt.SetActive(true);
- 返回6_bt.SetActive(true);施工前_bt.SetActive(true);施工後_bt.SetActive(true);備註_bt.SetActive(true);產品序號_bt.SetActive(true);
- Set_評估報告書1清單("評估報告書2");
- if(Global.報告書選項1=="身障類" || Global.報告書選項1=="長照類"){
- 施工前_tb.text = "空拍輔具";施工後_tb.text = "使用中";
- }else{
- 施工前_tb.text = "施工前";施工後_tb.text = "施工後";
- }
- Global.報告書選項2="評估報告書2";
- }
- public void 報告書清單返回6(){
- if(Global.報告書選項2=="評估報告書1" || Global.報告書選項2=="評估報告書2"){
- 長照類_核定通知書_bt.SetActive(true);長照類_相關文件_bt.SetActive(true);長照類_評估報告書1_bt.SetActive(true);
- 長照類_評估報告書2_bt.SetActive(true);返回4_bt.SetActive(true);
- 施作項目_lb.SetActive(false);施作項目_sv.SetActive(false);施作圖片_pl.SetActive(false);施作項目_新增_bt.SetActive(false);施作項目_刪除_bt.SetActive(false);
- 施作顯示_tb.SetActive(false);存檔2_bt.SetActive(false);
- 返回6_bt.SetActive(false);施工前_bt.SetActive(false);施工後_bt.SetActive(false);備註_bt.SetActive(false);產品序號_bt.SetActive(false);
- 拍照1_bt.SetActive(false);刪除1_bt.SetActive(false);存檔1_bt.SetActive(false);
- Module.清除控件(報告書施作圖片_ct);
- }else{
- 長照類_案場1_bt.SetActive(true);長照類_案場2_bt.SetActive(true);長照類_案場3_bt.SetActive(true);返回8_bt.SetActive(true);
- 施作項目_lb.SetActive(false);施作項目_sv.SetActive(false);施作圖片_pl.SetActive(false);施作項目_新增_bt.SetActive(false);施作項目_刪除_bt.SetActive(false);
- 施作顯示_tb.SetActive(false);存檔2_bt.SetActive(false);
- 返回6_bt.SetActive(false);施工前_bt.SetActive(false);施工後_bt.SetActive(false);備註_bt.SetActive(false);產品序號_bt.SetActive(false);
- 拍照1_bt.SetActive(false);刪除1_bt.SetActive(false);存檔1_bt.SetActive(false);
- Module.清除控件(報告書施作圖片_ct);
- }
-
- }
- private void Set_評估報告書1清單(string 文件號){
- SQL_Comm.SQL_取得報告書項目清單2(報告書流水號_tb.text,文件號);
- DataSet ds1 = new();
- SQL_Module.da.Fill(ds1);
- for(int i=0;i<=ds1.Tables[0].Rows.Count-1;i++){
- ds1.Tables[0].Rows[i][1] = ds1.Tables[0].Rows[i][2].ToString() + " " + ds1.Tables[0].Rows[i][4].ToString();
- }
- if(文件號=="評估報告書1"){
- Global.報告書評估報告書1清單_tabel = ds1.Tables[0];
- }else if(文件號=="案場1"){
- Global.報告書案場1清單_tabel = ds1.Tables[0];
- }else if(文件號=="案場2"){
- Global.報告書案場2清單_tabel = ds1.Tables[0];
- }else if(文件號=="案場3"){
- Global.報告書案場3清單_tabel = ds1.Tables[0];
- }else{
- Global.報告書評估報告書2清單_tabel = ds1.Tables[0];
- }
- 載入報告書項目清單表格("報告書"+文件號+"清單",ds1.Tables[0],報告書施作項目清單_tp,報告書施作項目清單_rpf,報告書施作項目清單_ct,myFont,UIsprite,報告書施作項目清單_lpf,true);
- }
- public void 報告書評估報告書1新增(){
- 評估報告書1_物料清單_sv.SetActive(true);返回6_bt.SetActive(false);施作圖片_pl.SetActive(false);返回7_bt.SetActive(true);
- if(Global.報告書選項1=="長照類"){
- if(Global.報告書選項2=="評估報告書1"){
- Set_長照物料清單("施作項目","C",報告書施作圖片_物料清單_tp,報告書施作圖片_物料清單_rpf,報告書施作圖片_物料清單_ct,報告書施作圖片_物料清單_lpf,Global.報告書選項2+"物料清單");
- }else{
- Set_長照物料清單("施作項目","C2",報告書施作圖片_物料清單_tp,報告書施作圖片_物料清單_rpf,報告書施作圖片_物料清單_ct,報告書施作圖片_物料清單_lpf,Global.報告書選項2+"物料清單");
- }
- }else{
- if(Global.報告書選項2=="評估報告書1"){
- Set_長照物料清單("施作項目","D",報告書施作圖片_物料清單_tp,報告書施作圖片_物料清單_rpf,報告書施作圖片_物料清單_ct,報告書施作圖片_物料清單_lpf,Global.報告書選項2+"物料清單");
- }else{
- Set_長照物料清單("施作項目","D2",報告書施作圖片_物料清單_tp,報告書施作圖片_物料清單_rpf,報告書施作圖片_物料清單_ct,報告書施作圖片_物料清單_lpf,Global.報告書選項2+"物料清單");
- }
-
- }
- }
- public void 報告書評估報告書1刪除(){
- Debug.Log(Global.報告書物料料號);
- SQL_Comm.SQL_報告書_刪除報告書明細(報告書流水號_tb.text,Global.報告書選項2,Global.報告書物料料號);
- SQL_Comm.SQL_取得報告書資料(報告書流水號_tb.text);
- if(SQL_Module.dr.Read()){
- Global.圖檔資料庫 = SQL_Module.dr["圖檔資料庫"].ToString();
- SQL_CommString.SQL_連線字串_圖片_SQL(Global.圖檔資料庫,Global.資料庫IP);
- SQL_Comm.SQL_報告書_刪除報告書施工圖檔(報告書流水號_tb.text,Global.報告書選項2,Global.報告書物料料號);
- }
- Set_評估報告書1清單(Global.報告書選項2);
- }
- public void 報告書評估報告書1圖檔刪除(){
- if(Global.報告書選項2=="評估報告書1"){
- SQL_Comm.SQL_取得報告書資料(報告書流水號_tb.text);
- if(SQL_Module.dr.Read()){
- Global.圖檔資料庫 = SQL_Module.dr["圖檔資料庫"].ToString();
- SQL_CommString.SQL_連線字串_圖片_SQL(Global.圖檔資料庫,Global.資料庫IP);
- string 文件號=施作圖片相片文件號_tb.text;
- SQL_Comm.SQL_報告書_刪除報告書施工圖檔照片(報告書流水號_tb.text,Global.報告書選項2,Global.報告書施工狀態,Global.報告書物料明細流水號,Global.報告書物料料號,文件號);
- 載入圖片清單2(Global.報告書施工狀態,報告書施作圖片_tp,報告書施作圖片_rpf,報告書施作圖片_ct,報告書施作圖片_lpf,施作圖片圖片讀取_pl,施作圖片圖片寬度_pl);
- }
- }else if(Global.報告書選項2=="評估報告書2"){
- SQL_Comm.SQL_取得報告書資料(報告書流水號_tb.text);
- if(SQL_Module.dr.Read()){
- Global.圖檔資料庫 = SQL_Module.dr["圖檔資料庫"].ToString();
- SQL_CommString.SQL_連線字串_圖片_SQL(Global.圖檔資料庫,Global.資料庫IP);
- string 文件號=施作圖片相片文件號_tb.text;
- SQL_Comm.SQL_報告書_刪除報告書施工圖檔照片(報告書流水號_tb.text,Global.報告書選項2,Global.報告書施工狀態,Global.報告書物料明細流水號,Global.報告書物料料號,文件號);
- 載入圖片清單2(Global.報告書施工狀態,報告書施作圖片_tp,報告書施作圖片_rpf,報告書施作圖片_ct,報告書施作圖片_lpf,施作圖片圖片讀取_pl,施作圖片圖片寬度_pl);
- }
- }else if(Global.報告書選項2=="核定通知書"){
- string 文件號 = 文件圖片相片文件號_tb.text;
- SQL_Comm.SQL_報告書_刪除報告書相關文件圖檔照片(報告書流水號_tb.text,Global.報告書選項2,文件號);
- 載入圖片清單(Global.報告書選項2,報告書文件圖片_tp,報告書文件圖片_rpf,報告書文件圖片_ct,報告書文件圖片_lpf,報告書文件圖片讀取_pl,報告書文件圖片寬度_pl);
- }else{
- string 文件號 = 文件圖片相片文件號_tb.text;
- SQL_Comm.SQL_報告書_刪除報告書相關文件圖檔照片(報告書流水號_tb.text,Global.報告書選項3,文件號);
- 載入圖片清單(Global.報告書選項3,報告書文件圖片_tp,報告書文件圖片_rpf,報告書文件圖片_ct,報告書文件圖片_lpf,報告書文件圖片讀取_pl,報告書文件圖片寬度_pl);
- }
- }
- public void 報告書清單返回7(){
- 評估報告書1_物料清單_sv.SetActive(false);返回6_bt.SetActive(true);施作圖片_pl.SetActive(true);返回7_bt.SetActive(false);
- }
- public void 長照類_核定通知書_bt_click(){
- 長照類_核定通知書_bt.SetActive(false);長照類_相關文件_bt.SetActive(false);長照類_評估報告書1_bt.SetActive(false);
- 長照類_評估報告書2_bt.SetActive(false);返回4_bt.SetActive(false);
- 返回5_bt.SetActive(true);刪除1_bt.SetActive(true);
- 拍照1_bt.SetActive(true);報告書文件圖片_pl.SetActive(true);
- RectTransform rt = 報告書文件圖片_pl.GetComponent<RectTransform>();
- rt.offsetMax = new Vector2(rt.offsetMax.x, -114f);
- Global.報告書選項2="核定通知書";
- 載入圖片清單(Global.報告書選項2,報告書文件圖片_tp,報告書文件圖片_rpf,報告書文件圖片_ct,報告書文件圖片_lpf,報告書文件圖片讀取_pl,報告書文件圖片寬度_pl);
- }
- private void Set_日期格式轉換(){
- Global.DTP1 = DateTime.Today.Year.ToString().PadLeft(4,'0')+DateTime.Today.Month.ToString().PadLeft(2,'0')+DateTime.Today.Day.ToString().PadLeft(2,'0');
- }
- private void Set_報告書人員清單(string 搜尋條件){
- 報告書人員清單_pl.SetActive(true);報告書人員資料_pl.SetActive(false);報告書項目清單_pl.SetActive(false);
- 評估主頁抬頭_tb.text= "首頁";
- string 年份;
- if(報告書人員清單_年份_cb.GetComponent<TMP_Dropdown>().options[報告書人員清單_年份_cb.GetComponent<TMP_Dropdown>().value].text==""){
- 年份 = "%%";
- }else{
- 年份 = 報告書人員清單_年份_cb.GetComponent<TMP_Dropdown>().options[報告書人員清單_年份_cb.GetComponent<TMP_Dropdown>().value].text;
- }
- SQL_Comm.SQL_報告書_人員清單(Global.gUser區域,年份,搜尋條件);
- DataSet ds1 = new();
- SQL_Module.da.Fill(ds1);
- string[] columnNames = new string[] { ds1.Tables[0].Columns[1].ColumnName, ds1.Tables[0].Columns[2].ColumnName};
- Global.報告書人員清單_tabel = ds1.Tables[0];
- 載入報告書表格("報告書人員清單",ds1.Tables[0].DefaultView.ToTable(false, columnNames),報告書人員清單_tp,報告書人員清單_rpf,報告書人員清單_ct,myFont,UIsprite,報告書人員清單_lpf,true,表頭_pl);
- }
-
- private void Set_報告書清單(string 客戶編號,string 申請人,string 聯繫人,string 聯繫人電話,string 住址,string 聯繫人2,string 聯繫人2電話){
- 報告書人員清單_pl.SetActive(false);報告書人員資料_pl.SetActive(true);報告書項目清單_pl.SetActive(false);
- 評估主頁抬頭_tb.text = 申請人;報告書人員資料_申請人_tb.text = 申請人;報告書人員資料_客編_tb.text = 客戶編號;報告書人員資料_聯繫人_tb.text = 聯繫人;
- 報告書人員資料_聯繫人電話_tb.text = 聯繫人電話;報告書人員資料_地址_tb.text = 住址;報告書人員資料_聯繫人2_tb.text=聯繫人2;報告書人員資料_聯繫人2電話_tb.text=聯繫人2電話;
- 返回1_bt.SetActive(false);查詢1_bt.SetActive(false);新增客戶1_bt.SetActive(false);返回2_bt.SetActive(true);返回2_1_bt.SetActive(false);
- SQL_Comm.SQL_報告書_清單(客戶編號);
- DataSet ds1 = new();
- SQL_Module.da.Fill(ds1);
- string[] columnNames = new string[] { ds1.Tables[0].Columns[0].ColumnName, ds1.Tables[0].Columns[2].ColumnName};
- Global.報告書清單_tabel = ds1.Tables[0].DefaultView.ToTable(false, columnNames);
- 載入報告書表格("報告書清單",Global.報告書清單_tabel,報告書清單_tp,報告書清單_rpf,報告書清單_ct,myFont,UIsprite,報告書清單_lpf,true,表頭2_pl);
- }
- private void 載入報告書表格(string table_name,DataTable table,Transform tableParent,GameObject rowPrefab,GameObject ceneter,TMP_FontAsset myFont,Sprite UIsprite,
- GameObject LinePrefab,bool overflowMode,GameObject 表頭){
- Module.清除控件(表頭);
- float 表格高度 = 160f;
- for (int j = 0; j <= table.Columns.Count-1; j++){
- GameObject headerText = new(table_name+"_Headers (Clone)");
- headerText.transform.SetParent(表頭.transform, false);
- headerText.AddComponent<TextMeshProUGUI>().text = table.Columns[j].ColumnName;
- headerText.GetComponent<TextMeshProUGUI>().tag="Cells";
- if(overflowMode){headerText.GetComponent<TextMeshProUGUI>().overflowMode=TextOverflowModes.Ellipsis;}
- if(j==0){
- headerText.GetComponent<RectTransform>().anchoredPosition=new Vector2(0f,0f);
- headerText.GetComponent<RectTransform>().anchorMin = new Vector2(0f, 1f);
- headerText.GetComponent<RectTransform>().anchorMax = new Vector2(0f, 1f);
- headerText.GetComponent<RectTransform>().pivot = new Vector2(0f, 1f);
- float x = 表頭.GetComponent<RectTransform>().rect.width -275f;
- headerText.GetComponent<RectTransform>().sizeDelta = new Vector2(x, 表格高度);
- }else{
- headerText.GetComponent<RectTransform>().anchorMin = new Vector2(1f, 1f);
- headerText.GetComponent<RectTransform>().anchorMax = new Vector2(1f, 1f);
- headerText.GetComponent<RectTransform>().pivot = new Vector2(1f, 1f);
- headerText.GetComponent<RectTransform>().sizeDelta = new Vector2(270f, 表格高度);
- headerText.GetComponent<RectTransform>().anchoredPosition=new Vector2(0f,0f);
- }
- }
- GameObject Separation = Instantiate(LinePrefab, 表頭.transform);
- Separation.GetComponent<RectTransform>().sizeDelta = new Vector2(5f,表頭.GetComponent<RectTransform>().sizeDelta.y-5f);
- Separation.GetComponent<RectTransform>().anchoredPosition = new Vector2(-275f,-3f);
- Separation.GetComponent<RectTransform>().anchorMin = new Vector2(1f, 1f);
- Separation.GetComponent<RectTransform>().anchorMax = new Vector2(1f, 1f);
- Separation.GetComponent<RectTransform>().pivot = new Vector2(1f, 1f);
- Separation.GetComponent<Image>().color = Main.Global.系統主題 == 1 ? new Color(0f, 0f, 0f, 1f) : new Color(1f, 1f, 1f, 1f);
- TextMeshProUGUI[] texts = 表頭.GetComponentsInChildren<TextMeshProUGUI>();
- foreach (TextMeshProUGUI text in texts){
- if(text.tag.Contains("Cells")){
- text.font = myFont;
- text.color = Global.系統主題 == 1 ? new Color(0, 0, 0, 1) : text.color;
- text.alignment = TextAlignmentOptions.Center;
- text.enableAutoSizing = true;
- text.margin = new Vector4(10, 0, 10, 0);
- }else{
-
- }
- }
- //==============================================
- Module.清除控件(ceneter);
- Image centerImage = ceneter.GetComponent<Image>();
- if(centerImage == null){
- centerImage = ceneter.AddComponent<Image>();
- centerImage.type = Image.Type.Sliced;
- }
- centerImage.sprite = UIsprite;
- centerImage.fillCenter = false;
- centerImage.color = Main.Global.系統主題 == 1 ? new Color(0f, 0f, 0f, 1f) : new Color(1f, 1f, 1f, 1f);
- for (int i = 0; i < table.Rows.Count; i++){
- GameObject row = Instantiate(rowPrefab, tableParent);
- row.GetComponent<RectTransform>().anchoredPosition = new Vector2(0, (-表格高度 * i)+(-5*i));
- for (int j = 0; j < table.Columns.Count; j++){
- string value = table.Rows[i][j].ToString();
- GameObject cellText = new(table_name+"_Cells_"+i.ToString()+"_"+j.ToString());
- cellText.transform.SetParent(row.transform, false);
- cellText.AddComponent<TextMeshProUGUI>().text = value;
- cellText.GetComponent<TextMeshProUGUI>().tag="Cells";
- if(overflowMode){cellText.GetComponent<TextMeshProUGUI>().overflowMode=TextOverflowModes.Ellipsis;}
- cellText.AddComponent<Button>();
- cellText.GetComponent<Button>().onClick.AddListener(() => { 按鈕事件(cellText); });
- if(j==0){
- cellText.GetComponent<RectTransform>().anchoredPosition=new Vector2(0f,0f);
- cellText.GetComponent<RectTransform>().anchorMin = new Vector2(0f, 1f);
- cellText.GetComponent<RectTransform>().anchorMax = new Vector2(0f, 1f);
- cellText.GetComponent<RectTransform>().pivot = new Vector2(0f, 1f);
- float x = ceneter.GetComponent<RectTransform>().rect.width -275f;
- cellText.GetComponent<RectTransform>().sizeDelta = new Vector2(x, 表格高度);
- }else{
- cellText.GetComponent<RectTransform>().anchorMin = new Vector2(1f, 1f);
- cellText.GetComponent<RectTransform>().anchorMax = new Vector2(1f, 1f);
- cellText.GetComponent<RectTransform>().pivot = new Vector2(1f, 1f);
- cellText.GetComponent<RectTransform>().sizeDelta = new Vector2(270f, 表格高度);
- cellText.GetComponent<RectTransform>().anchoredPosition=new Vector2(0f,0f);
- }
- }
- }
- texts = ceneter.GetComponentsInChildren<TextMeshProUGUI>();
- foreach (TextMeshProUGUI text in texts){
- if(text.tag.Contains("Cells")){
- text.font = myFont;
- text.color = Global.系統主題 == 1 ? new Color(0, 0, 0, 1) : text.color;
- text.alignment = TextAlignmentOptions.Center;
- text.enableAutoSizing = true;;
-
- text.margin = new Vector4(10, 0, 10, 0);
- }else{
-
- }
- }
- ceneter.GetComponent<RectTransform>().sizeDelta = new Vector2(ceneter.GetComponent<RectTransform>().sizeDelta.x,table.Rows.Count*表格高度 +((table.Rows.Count-1)*5f));
- //========建立分隔線=============
- Separation = Instantiate(LinePrefab, tableParent);
- Separation.GetComponent<RectTransform>().sizeDelta = new Vector2(5f,ceneter.GetComponent<RectTransform>().sizeDelta.y-5f);
- Separation.GetComponent<RectTransform>().anchoredPosition = new Vector2(-275f,-3f);
- Separation.GetComponent<RectTransform>().anchorMin = new Vector2(1f, 1f);
- Separation.GetComponent<RectTransform>().anchorMax = new Vector2(1f, 1f);
- Separation.GetComponent<RectTransform>().pivot = new Vector2(1f, 1f);
- Separation.GetComponent<Image>().color = Main.Global.系統主題 == 1 ? new Color(0f, 0f, 0f, 1f) : new Color(1f, 1f, 1f, 1f);
- /*for(int i=1;i<=table.Rows.Count-1;i++){
- GameObject Separation2 = Instantiate(LinePrefab, tableParent);
- Separation2.GetComponent<RectTransform>().sizeDelta = new Vector2(ceneter.GetComponent<RectTransform>().rect.width-5f,5f);
- Separation2.GetComponent<RectTransform>().anchorMin = new Vector2(0f, 1f);
- Separation2.GetComponent<RectTransform>().anchorMax = new Vector2(0f, 1f);
- Separation2.GetComponent<RectTransform>().pivot = new Vector2(0f, 1f);
- Separation2.GetComponent<RectTransform>().anchoredPosition = new Vector2(0f, 5f * (1 - 19 * i));
- Separation2.GetComponent<Image>().color = Main.Global.系統主題 == 1 ? new Color(0f, 0f, 0f, 1f) : new Color(1f, 1f, 1f, 1f);
- }*/
- for(int i = 1; i <= table.Rows.Count - 1; i++) {
- GameObject Separation2 = Instantiate(LinePrefab, tableParent);
- Separation2.GetComponent<RectTransform>().sizeDelta = new Vector2(ceneter.GetComponent<RectTransform>().rect.width - 5f, 5f);
- Separation2.GetComponent<RectTransform>().anchorMin = new Vector2(0f, 1f);
- Separation2.GetComponent<RectTransform>().anchorMax = new Vector2(0f, 1f);
- Separation2.GetComponent<RectTransform>().pivot = new Vector2(0f, 1f);
- Separation2.GetComponent<RectTransform>().anchoredPosition = new Vector2(0f, - (表格高度 + 5f) * i + 5f);
- Separation2.GetComponent<Image>().color = Main.Global.系統主題 == 1 ? new Color(0f, 0f, 0f, 1f) : new Color(1f, 1f, 1f, 1f);
- }
- }
-
- private void 載入報告書詳細資料(string 報告書流水號){
- 文件號_sv.GetComponent<RectTransform>().sizeDelta=new Vector2(報告書資料_pl.GetComponent<RectTransform>().rect.width/2-10f,文件號_sv.GetComponent<RectTransform>().sizeDelta.y);
- 項目清單_lb.GetComponent<RectTransform>().sizeDelta=new Vector2(報告書資料_pl.GetComponent<RectTransform>().rect.width/2-10f,項目清單_lb.GetComponent<RectTransform>().sizeDelta.y);
- 項目清單_sv.GetComponent<RectTransform>().sizeDelta=new Vector2(報告書資料_pl.GetComponent<RectTransform>().rect.width/2-10f,項目清單_sv.GetComponent<RectTransform>().sizeDelta.y);
- 扶手總長_lb.GetComponent<RectTransform>().sizeDelta=new Vector2(報告書資料_pl.GetComponent<RectTransform>().rect.width/2-200f,扶手總長_lb.GetComponent<RectTransform>().sizeDelta.y);
- 扶手總長_tb.GetComponent<RectTransform>().sizeDelta=new Vector2(報告書資料_pl.GetComponent<RectTransform>().rect.width/2-200f,扶手總長_tb.GetComponent<RectTransform>().sizeDelta.y);
- 報告書扶手總長_tb.text="";單項扶手長度_tb.text="";
- SQL_Comm.SQL_取得報告書資料(報告書流水號);
- if(SQL_Module.dr.Read()){
- 報告書申請人_tb.text = SQL_Module.dr["負責人"].ToString();
- 報告書開立人_tb.text = SQL_Module.dr["開立人"].ToString();
- Global.圖檔資料庫 = SQL_Module.dr["圖檔資料庫"].ToString();
- Debug.Log(Global.圖檔資料庫);
- SQL_CommString.SQL_連線字串_圖片_SQL(Global.圖檔資料庫,Global.資料庫IP);
- SQL_Comm.SQL_取得文件號清單(報告書流水號);
- DataSet ds1 = new();
- SQL_Module.da.Fill(ds1);
- Global.文件號清單_table=ds1.Tables[0];
- for(int i=0;i<=ds1.Tables[0].Rows.Count-1;i++){
- ds1.Tables[0].Rows[i][0]="第 "+(i+1)+" 頁";
- }
- string[] columnNames = new string[]{ds1.Tables[0].Columns[0].ColumnName};
- DataTable table1 = ds1.Tables[0].DefaultView.ToTable(false, columnNames);
- 載入文件號表格("文件號清單",table1,文件號清單_tp,文件號清單_rpf,文件號清單_ct,myFont,UIsprite,文件號清單_lpf,true);
- }
- }
- private void 載入文件號表格(string table_name,DataTable table,Transform tableParent,GameObject rowPrefab,GameObject ceneter,TMP_FontAsset myFont,Sprite UIsprite,
- GameObject LinePrefab,bool overflowMode){
- Module.清除控件(ceneter);
- Image centerImage = ceneter.GetComponent<Image>();
- if(centerImage == null){
- centerImage = ceneter.AddComponent<Image>();
- centerImage.type = Image.Type.Sliced;
- }
- centerImage.sprite = UIsprite;
- centerImage.fillCenter = false;
- centerImage.color = Main.Global.系統主題 == 1 ? new Color(0f, 0f, 0f, 1f) : new Color(1f, 1f, 1f, 1f);
- for (int i = 0; i < table.Rows.Count; i++){
- GameObject row = Instantiate(rowPrefab, tableParent);
- row.GetComponent<RectTransform>().anchoredPosition = new Vector2(0, (-90 * i)+(-5*i));
- string value = table.Rows[i][0].ToString();
- GameObject cellText = new(table_name+"_Cells_"+i.ToString()+"_0");
- cellText.transform.SetParent(row.transform, false);
- cellText.AddComponent<TextMeshProUGUI>().text = value;
- cellText.GetComponent<TextMeshProUGUI>().tag="Cells";
- if(overflowMode){cellText.GetComponent<TextMeshProUGUI>().overflowMode=TextOverflowModes.Ellipsis;}
- cellText.AddComponent<Button>();
- cellText.GetComponent<Button>().onClick.AddListener(() => { 按鈕事件(cellText); });
- cellText.GetComponent<RectTransform>().anchoredPosition=new Vector2(0f,0f);
- cellText.GetComponent<RectTransform>().anchorMin = new Vector2(0f, 1f);
- cellText.GetComponent<RectTransform>().anchorMax = new Vector2(0f, 1f);
- cellText.GetComponent<RectTransform>().pivot = new Vector2(0f, 1f);
- cellText.GetComponent<RectTransform>().sizeDelta = new Vector2(ceneter.GetComponent<RectTransform>().rect.width, 90f);
- }
- TextMeshProUGUI[] texts = ceneter.GetComponentsInChildren<TextMeshProUGUI>();
- foreach (TextMeshProUGUI text in texts){
- if(text.tag.Contains("Cells")){
- text.font = myFont;
- text.color = Global.系統主題 == 1 ? new Color(0, 0, 0, 1) : text.color;
- text.alignment = TextAlignmentOptions.Center;
- text.fontStyle = FontStyles.Bold;
- text.fontSize=42;
- text.margin = new Vector4(10, 0, 10, 0);
- }else{
-
- }
- }
- ceneter.GetComponent<RectTransform>().sizeDelta = new Vector2(ceneter.GetComponent<RectTransform>().sizeDelta.x,table.Rows.Count*90f+((table.Rows.Count-1)*5f));
- //========建立分隔線=============
- for(int i=1;i<=table.Rows.Count-1;i++){
- GameObject Separation2 = Instantiate(LinePrefab, tableParent);
- Separation2.GetComponent<RectTransform>().sizeDelta = new Vector2(ceneter.GetComponent<RectTransform>().rect.width-5f,5f);
- Separation2.GetComponent<RectTransform>().anchorMin = new Vector2(0f, 1f);
- Separation2.GetComponent<RectTransform>().anchorMax = new Vector2(0f, 1f);
- Separation2.GetComponent<RectTransform>().pivot = new Vector2(0f, 1f);
- Separation2.GetComponent<RectTransform>().anchoredPosition = new Vector2(0f, 5f * (1 - 19 * i));
- Separation2.GetComponent<Image>().color = Main.Global.系統主題 == 1 ? new Color(0f, 0f, 0f, 1f) : new Color(1f, 1f, 1f, 1f);
- }
- }
- private void 載入報告書項目清單(string 文件號){
- SQL_Comm.SQL_取得報告書項目清單(報告書流水號_tb.text,文件號);
- DataSet ds1 = new();
- SQL_Module.da.Fill(ds1);
- Global.報告書項目清單_tabel = ds1.Tables[0];
- 載入報告書項目清單表格("報告書項目清單",ds1.Tables[0],報告書項目清單_tp,報告書項目清單_rpf,報告書項目清單_ct,myFont,UIsprite,報告書項目清單_lpf,true);
- }
- private void 載入報告書項目清單表格(string table_name,DataTable table,Transform tableParent,GameObject rowPrefab,GameObject ceneter,TMP_FontAsset myFont,Sprite UIsprite,
- GameObject LinePrefab,bool overflowMode){
- Module.清除控件(ceneter);
- Image centerImage = ceneter.GetComponent<Image>();
- if(centerImage == null){
- centerImage = ceneter.AddComponent<Image>();
- centerImage.type = Image.Type.Sliced;
- }
- centerImage.sprite = UIsprite;
- centerImage.fillCenter = false;
- centerImage.color = Global.系統主題 == 1 ? new Color(0f, 0f, 0f, 1f) : new Color(1f, 1f, 1f, 1f);
- for (int i = 0; i < table.Rows.Count; i++){
- GameObject row = Instantiate(rowPrefab, tableParent);
- row.GetComponent<RectTransform>().anchoredPosition = new Vector2(0, (-90 * i)+(-5*i));
- string value = table.Rows[i][1].ToString();
- GameObject cellText = new(table_name+"_Cells_"+i.ToString()+"_1");
- cellText.transform.SetParent(row.transform, false);
- cellText.AddComponent<TextMeshProUGUI>().text = value;
- cellText.GetComponent<TextMeshProUGUI>().tag="Cells";
- if(overflowMode){cellText.GetComponent<TextMeshProUGUI>().overflowMode=TextOverflowModes.Ellipsis;}
- cellText.AddComponent<Button>();
- cellText.GetComponent<Button>().onClick.AddListener(() => { 按鈕事件(cellText); });
- cellText.GetComponent<RectTransform>().anchoredPosition=new Vector2(0f,0f);
- cellText.GetComponent<RectTransform>().anchorMin = new Vector2(0f, 1f);
- cellText.GetComponent<RectTransform>().anchorMax = new Vector2(0f, 1f);
- cellText.GetComponent<RectTransform>().pivot = new Vector2(0f, 1f);
- cellText.GetComponent<RectTransform>().sizeDelta = new Vector2(ceneter.GetComponent<RectTransform>().rect.width, 90f);
- }
- TextMeshProUGUI[] texts = ceneter.GetComponentsInChildren<TextMeshProUGUI>();
- foreach (TextMeshProUGUI text in texts){
- if(text.tag.Contains("Cells")){
- text.font = myFont;
- text.color = Global.系統主題 == 1 ? new Color(0, 0, 0, 1) : text.color;
- text.alignment = TextAlignmentOptions.Center;
- text.fontStyle = FontStyles.Bold;
- text.fontSize=42;
-
- text.margin = new Vector4(10, 0, 10, 0);
- }else{
-
- }
- }
- ceneter.GetComponent<RectTransform>().sizeDelta = new Vector2(ceneter.GetComponent<RectTransform>().sizeDelta.x,table.Rows.Count*90f +((table.Rows.Count-1)*5f));
- //========建立分隔線=============
- for(int i=1;i<=table.Rows.Count-1;i++){
- GameObject Separation2 = Instantiate(LinePrefab, tableParent);
- Separation2.GetComponent<RectTransform>().sizeDelta = new Vector2(ceneter.GetComponent<RectTransform>().rect.width-5f,5f);
- Separation2.GetComponent<RectTransform>().anchorMin = new Vector2(0f, 1f);
- Separation2.GetComponent<RectTransform>().anchorMax = new Vector2(0f, 1f);
- Separation2.GetComponent<RectTransform>().pivot = new Vector2(0f, 1f);
- Separation2.GetComponent<RectTransform>().anchoredPosition = new Vector2(0f, 5f * (1 - 19 * i));
- Separation2.GetComponent<Image>().color = Main.Global.系統主題 == 1 ? new Color(0f, 0f, 0f, 1f) : new Color(1f, 1f, 1f, 1f);
- }
- }
- private void 載入報告書圖片(string table_name,DataTable table,Transform tableParent,GameObject rowPrefab,GameObject ceneter,TMP_FontAsset myFont,Sprite UIsprite,
- GameObject LinePrefab,bool overflowMode){
- Module.清除控件(ceneter);
- Image centerImage = ceneter.GetComponent<Image>();
- if(centerImage == null){
- centerImage = ceneter.AddComponent<Image>();
- centerImage.type = Image.Type.Sliced;
- }
- centerImage.sprite = UIsprite;
- centerImage.fillCenter = false;
- centerImage.color = Global.系統主題 == 1 ? new Color(0f, 0f, 0f, 1f) : new Color(1f, 1f, 1f, 1f);
- for (int i = 0; i < table.Rows.Count; i++){
- GameObject row = Instantiate(rowPrefab, tableParent);
-
- row.GetComponent<RectTransform>().anchoredPosition = new Vector2(rowPrefab.GetComponent<RectTransform>().rect.width*i ,0);
- GameObject Imagg = Instantiate(LinePrefab, row.GetComponent<Transform>());
-
- RawImage image = Imagg.AddComponent<RawImage>();
- byte[] imageData = (byte[])table.Rows[i][1];
- Texture2D texture = new(1, 1);
- texture.LoadImage(imageData);
- image.texture = texture;
- if (texture.width > texture.height){
- float scaleFactor = rowPrefab.GetComponent<RectTransform>().rect.width / texture.width;
- image.rectTransform.sizeDelta = new Vector2(row.GetComponent<RectTransform>().rect.width, texture.height * scaleFactor);
- }else{
- float scaleFactor = rowPrefab.GetComponent<RectTransform>().rect.width / texture.height;
- image.rectTransform.sizeDelta = new Vector2(texture.width * scaleFactor, row.GetComponent<RectTransform>().rect.width);
- }
- }
- int numm;
- if(table.Rows.Count>0){numm=table.Rows.Count;}else{numm=1;}
- ceneter.GetComponent<RectTransform>().sizeDelta = new Vector2(rowPrefab.GetComponent<RectTransform>().rect.width*numm, rowPrefab.GetComponent<RectTransform>().sizeDelta.y);
- }
- private void Set_客戶清單(){
- SQL_Comm.SQL_報告書_客戶清單(Global.gUser區域);
- // 客戶編號, 來電日期, 申請人, 聯繫人, 聯繫電話, 地址, 需求, 特殊需求
- DataSet ds1 = new();
- SQL_Module.da.Fill(ds1);
- string[] columnNames = new string[]{ds1.Tables[0].Columns[0].ColumnName,ds1.Tables[0].Columns[2].ColumnName,ds1.Tables[0].Columns[3].ColumnName};
- DataTable table1 = ds1.Tables[0].DefaultView.ToTable(false, columnNames);Global.客戶清單_tabel=ds1.Tables[0];
- 載入客戶清單表格("客戶清單",table1,客戶清單_tp,客戶清單_rpf,客戶清單_ct,myFont,UIsprite,客戶清單_lpf,true);
- }
- private void 載入客戶清單表格(string table_name,DataTable table,Transform tableParent,GameObject rowPrefab,GameObject ceneter,TMP_FontAsset myFont,Sprite UIsprite,
- GameObject LinePrefab,bool overflowMode){
- Module.清除控件(客戶清單表頭_pl);
- for (int j = 0; j <= table.Columns.Count-1; j++){
- GameObject headerText = new(table_name+"_Headers (Clone)");
- headerText.transform.SetParent(客戶清單表頭_pl.transform, false);
- headerText.AddComponent<TextMeshProUGUI>().text = table.Columns[j].ColumnName;
- headerText.GetComponent<TextMeshProUGUI>().tag="Cells";
- if(overflowMode){headerText.GetComponent<TextMeshProUGUI>().overflowMode=TextOverflowModes.Ellipsis;}
- if(j==0){
- headerText.GetComponent<RectTransform>().anchoredPosition=new Vector2(0f,0f);
- headerText.GetComponent<RectTransform>().anchorMin = new Vector2(0f, 1f);
- headerText.GetComponent<RectTransform>().anchorMax = new Vector2(0f, 1f);
- headerText.GetComponent<RectTransform>().pivot = new Vector2(0f, 1f);
- float x = 客戶清單表頭_pl.GetComponent<RectTransform>().rect.width -420f;
- headerText.GetComponent<RectTransform>().sizeDelta = new Vector2(x, 90f);
- }else if(j==1){
- headerText.GetComponent<RectTransform>().anchorMin = new Vector2(1f, 1f);
- headerText.GetComponent<RectTransform>().anchorMax = new Vector2(1f, 1f);
- headerText.GetComponent<RectTransform>().pivot = new Vector2(1f, 1f);
- headerText.GetComponent<RectTransform>().sizeDelta = new Vector2(205f, 90f);
- headerText.GetComponent<RectTransform>().anchoredPosition=new Vector2(-210f,0f);
- }else{
- headerText.GetComponent<RectTransform>().anchorMin = new Vector2(1f, 1f);
- headerText.GetComponent<RectTransform>().anchorMax = new Vector2(1f, 1f);
- headerText.GetComponent<RectTransform>().pivot = new Vector2(1f, 1f);
- headerText.GetComponent<RectTransform>().sizeDelta = new Vector2(205f, 90f);
- headerText.GetComponent<RectTransform>().anchoredPosition=new Vector2(0f,0f);
- }
- }
- for(int j = 0; j <= table.Columns.Count-2; j++){
- GameObject Separation2 = Instantiate(LinePrefab, 客戶清單表頭_pl.transform);
- Separation2.GetComponent<RectTransform>().sizeDelta = new Vector2(5f,客戶清單表頭_pl.GetComponent<RectTransform>().sizeDelta.y-5f);
- Separation2.GetComponent<RectTransform>().anchorMin = new Vector2(1f, 1f);
- Separation2.GetComponent<RectTransform>().anchorMax = new Vector2(1f, 1f);
- Separation2.GetComponent<RectTransform>().pivot = new Vector2(1f, 1f);
- Separation2.GetComponent<Image>().color = Main.Global.系統主題 == 1 ? new Color(0f, 0f, 0f, 1f) : new Color(1f, 1f, 1f, 1f);
- if(j==0){
- Separation2.GetComponent<RectTransform>().anchoredPosition = new Vector2(-205f,-3f);
- }else{
- Separation2.GetComponent<RectTransform>().anchoredPosition = new Vector2(-415f,-3f);
- }
- }
- TextMeshProUGUI[] texts = 客戶清單表頭_pl.GetComponentsInChildren<TextMeshProUGUI>();
- foreach (TextMeshProUGUI text in texts){
- if(text.tag.Contains("Cells")){
- text.font = myFont;
- text.color = Global.系統主題 == 1 ? new Color(0, 0, 0, 1) : text.color;
- text.alignment = TextAlignmentOptions.Center;
- text.fontStyle = FontStyles.Bold;
- text.fontSize=42;
- text.margin = new Vector4(10, 0, 10, 0);
- }else{
-
- }
- }
- //==========================================
- Module.清除控件(ceneter);
- Image centerImage = ceneter.GetComponent<Image>();
- if(centerImage == null){
- centerImage = ceneter.AddComponent<Image>();
- centerImage.type = Image.Type.Sliced;
- }
- centerImage.sprite = UIsprite;
- centerImage.fillCenter = false;
- centerImage.color = Main.Global.系統主題 == 1 ? new Color(0f, 0f, 0f, 1f) : new Color(1f, 1f, 1f, 1f);
- for (int i = 0; i < table.Rows.Count; i++){
- GameObject row = Instantiate(rowPrefab, tableParent);
- row.GetComponent<RectTransform>().anchoredPosition = new Vector2(0, (-90 * i)+(-5*i));
- for (int j = 0; j < table.Columns.Count; j++){
- string value = table.Rows[i][j].ToString();
- GameObject cellText = new(table_name+"_Cells_"+i.ToString()+"_"+j.ToString());
- cellText.transform.SetParent(row.transform, false);
- cellText.AddComponent<TextMeshProUGUI>().text = value;
- cellText.GetComponent<TextMeshProUGUI>().tag="Cells";
- if(overflowMode){cellText.GetComponent<TextMeshProUGUI>().overflowMode=TextOverflowModes.Ellipsis;}
- cellText.AddComponent<Button>();
- cellText.GetComponent<Button>().onClick.AddListener(() => { 按鈕事件(cellText); });
- if(j==0){
- cellText.GetComponent<RectTransform>().anchoredPosition=new Vector2(0f,0f);
- cellText.GetComponent<RectTransform>().anchorMin = new Vector2(0f, 1f);
- cellText.GetComponent<RectTransform>().anchorMax = new Vector2(0f, 1f);
- cellText.GetComponent<RectTransform>().pivot = new Vector2(0f, 1f);
- float x = ceneter.GetComponent<RectTransform>().rect.width -420f;
- cellText.GetComponent<RectTransform>().sizeDelta = new Vector2(x, 90f);
- }else if(j==1){
- cellText.GetComponent<RectTransform>().anchorMin = new Vector2(1f, 1f);
- cellText.GetComponent<RectTransform>().anchorMax = new Vector2(1f, 1f);
- cellText.GetComponent<RectTransform>().pivot = new Vector2(1f, 1f);
- cellText.GetComponent<RectTransform>().sizeDelta = new Vector2(205f, 90f);
- cellText.GetComponent<RectTransform>().anchoredPosition=new Vector2(-210f,0f);
- }else{
- cellText.GetComponent<RectTransform>().anchorMin = new Vector2(1f, 1f);
- cellText.GetComponent<RectTransform>().anchorMax = new Vector2(1f, 1f);
- cellText.GetComponent<RectTransform>().pivot = new Vector2(1f, 1f);
- cellText.GetComponent<RectTransform>().sizeDelta = new Vector2(205, 90f);
- cellText.GetComponent<RectTransform>().anchoredPosition=new Vector2(0f,0f);
- }
- }
- }
- texts = ceneter.GetComponentsInChildren<TextMeshProUGUI>();
- foreach (TextMeshProUGUI text in texts){
- if(text.tag.Contains("Cells")){
- text.font = myFont;
- text.color = Global.系統主題 == 1 ? new Color(0, 0, 0, 1) : text.color;
- text.alignment = TextAlignmentOptions.Center;
- //text.fontStyle = FontStyles.Bold;
- text.fontSize=42;
- //text.enableAutoSizing = true;
- //text.autoSizeTextContainer = true;
- text.margin = new Vector4(10, 0, 10, 0);
- }else{
-
- }
- }
- ceneter.GetComponent<RectTransform>().sizeDelta = new Vector2(ceneter.GetComponent<RectTransform>().sizeDelta.x,table.Rows.Count*90f +((table.Rows.Count-1)*5f));
- //========建立分隔線=============
- for(int i=0;i<=table.Columns.Count-2;i++){
- GameObject Separation = Instantiate(LinePrefab, tableParent);
- Separation.GetComponent<RectTransform>().sizeDelta = new Vector2(5f,ceneter.GetComponent<RectTransform>().sizeDelta.y-5f);
- Separation.GetComponent<RectTransform>().anchorMin = new Vector2(1f, 1f);
- Separation.GetComponent<RectTransform>().anchorMax = new Vector2(1f, 1f);
- Separation.GetComponent<RectTransform>().pivot = new Vector2(1f, 1f);
- Separation.GetComponent<Image>().color = Main.Global.系統主題 == 1 ? new Color(0f, 0f, 0f, 1f) : new Color(1f, 1f, 1f, 1f);
- Separation.GetComponent<RectTransform>().anchoredPosition = new Vector2(-210f*i-205f,-3f);
- }
- for(int i=1;i<=table.Rows.Count-1;i++){
- GameObject Separation2 = Instantiate(LinePrefab, tableParent);
- Separation2.GetComponent<RectTransform>().sizeDelta = new Vector2(ceneter.GetComponent<RectTransform>().rect.width-5f,5f);
- Separation2.GetComponent<RectTransform>().anchorMin = new Vector2(0f, 1f);
- Separation2.GetComponent<RectTransform>().anchorMax = new Vector2(0f, 1f);
- Separation2.GetComponent<RectTransform>().pivot = new Vector2(0f, 1f);
- Separation2.GetComponent<RectTransform>().anchoredPosition = new Vector2(0f, 5f * (1 - 19 * i));
- Separation2.GetComponent<Image>().color = Main.Global.系統主題 == 1 ? new Color(0f, 0f, 0f, 1f) : new Color(1f, 1f, 1f, 1f);
- }
- }
- private void Set_長照物料清單(string 類別,string 編號,Transform tableParent,GameObject rowPrefab,GameObject ceneter,GameObject LinePrefab,string 清單名稱){
- SQL_Comm.SQL_報告書_項目物料清單(類別,編號);
- // 客戶編號, 來電日期, 申請人, 聯繫人, 聯繫電話, 地址, 需求, 特殊需求
- DataSet ds1 = new();
- SQL_Module.da.Fill(ds1);
- for(int i=0;i<=ds1.Tables[0].Rows.Count-1;i++){
- ds1.Tables[0].Rows[i][0]=ds1.Tables[0].Rows[i][1].ToString()+"-"+ds1.Tables[0].Rows[i][2].ToString();
- }
- Global.長照物料清單_tabel = ds1.Tables[0];
-
- string[] columnNames = new string[]{ds1.Tables[0].Columns[0].ColumnName};
- DataTable table1 = ds1.Tables[0].DefaultView.ToTable(false, columnNames);
- 載入長照物料清單表格(清單名稱,table1,tableParent,rowPrefab,ceneter,myFont,UIsprite,LinePrefab,true);
- //載入長照物料清單表格("項目物料清單",table1,tableParent,rowPrefab,ceneter,myFont,UIsprite,LinePrefab,true);
- }
- private void 載入長照物料清單表格(string table_name,DataTable table,Transform tableParent,GameObject rowPrefab,GameObject ceneter,TMP_FontAsset myFont,Sprite UIsprite,
- GameObject LinePrefab,bool overflowMode){
- Module.清除控件(ceneter);
- Image centerImage = ceneter.GetComponent<Image>();
- if(centerImage == null){
- centerImage = ceneter.AddComponent<Image>();
- centerImage.type = Image.Type.Sliced;
- }
- centerImage.sprite = UIsprite;
- centerImage.fillCenter = false;
- centerImage.color = Main.Global.系統主題 == 1 ? new Color(0f, 0f, 0f, 1f) : new Color(1f, 1f, 1f, 1f);
- for (int i = 0; i < table.Rows.Count; i++){
- GameObject row = Instantiate(rowPrefab, tableParent);
- row.GetComponent<RectTransform>().anchoredPosition = new Vector2(0, (-90 * i)+(-5*i));
- string value = table.Rows[i][0].ToString();
- GameObject cellText = new(table_name+"_Cells_"+i.ToString().PadLeft(2,'0'));
- cellText.transform.SetParent(row.transform, false);
- cellText.AddComponent<TextMeshProUGUI>().text = value;
- cellText.GetComponent<TextMeshProUGUI>().tag="Cells";
- if(overflowMode){cellText.GetComponent<TextMeshProUGUI>().overflowMode=TextOverflowModes.Ellipsis;}
- cellText.AddComponent<Button>();
- cellText.GetComponent<Button>().onClick.AddListener(() => { 按鈕事件(cellText); });
- cellText.GetComponent<RectTransform>().anchoredPosition=new Vector2(0f,0f);
- cellText.GetComponent<RectTransform>().anchorMin = new Vector2(0f, 1f);
- cellText.GetComponent<RectTransform>().anchorMax = new Vector2(0f, 1f);
- cellText.GetComponent<RectTransform>().pivot = new Vector2(0f, 1f);
- cellText.GetComponent<RectTransform>().sizeDelta = new Vector2(ceneter.GetComponent<RectTransform>().rect.width, 90f);
- }
- TextMeshProUGUI[] texts = ceneter.GetComponentsInChildren<TextMeshProUGUI>();
- foreach (TextMeshProUGUI text in texts){
- if(text.tag.Contains("Cells")){
- text.font = myFont;
- text.color = Global.系統主題 == 1 ? new Color(0, 0, 0, 1) : text.color;
- text.alignment = TextAlignmentOptions.Left;
- text.fontStyle = FontStyles.Bold;
- text.fontSize = 30;
- text.margin = new Vector4(10, 0, 10, 0);
- }else{
-
- }
- }
- ceneter.GetComponent<RectTransform>().sizeDelta = new Vector2(ceneter.GetComponent<RectTransform>().sizeDelta.x,table.Rows.Count*90f+((table.Rows.Count-1)*5f));
- //========建立分隔線=============
- for(int i=1;i<=table.Rows.Count-1;i++){
- GameObject Separation2 = Instantiate(LinePrefab, tableParent);
- Separation2.GetComponent<RectTransform>().sizeDelta = new Vector2(ceneter.GetComponent<RectTransform>().rect.width-5f,5f);
- Separation2.GetComponent<RectTransform>().anchorMin = new Vector2(0f, 1f);
- Separation2.GetComponent<RectTransform>().anchorMax = new Vector2(0f, 1f);
- Separation2.GetComponent<RectTransform>().pivot = new Vector2(0f, 1f);
- Separation2.GetComponent<RectTransform>().anchoredPosition = new Vector2(0f, 5f * (1 - 19 * i));
- Separation2.GetComponent<Image>().color = Main.Global.系統主題 == 1 ? new Color(0f, 0f, 0f, 1f) : new Color(1f, 1f, 1f, 1f);
- }
- }
- public void 按鈕事件(GameObject cell_text){
- if(cell_text.name.Contains("報告書清單")){
- string row=cell_text.name.Substring(cell_text.name.Length-3,1);
- 返回2_bt.SetActive(false);返回3_bt.SetActive(true);
- 報告書流水號_tb.text = Global.報告書清單_tabel.Rows[int.Parse(row)][0].ToString();
- 報告書項目清單_報告書號_tb.text = Global.報告書清單_tabel.Rows[int.Parse(row)][0].ToString();
- 報告書人員清單_pl.SetActive(false);報告書人員資料_pl.SetActive(false);報告書項目清單_pl.SetActive(true);
-
- }else if(cell_text.name.Contains("報告書人員清單")){
- //Set_報告書人員資料();
- Debug.Log(cell_text.name);
- Match match = Regex.Match(cell_text.name, @"_(\d+)_");
- string row=match.Groups[1].Value;
- Debug.Log(row);
- string 客戶編號 = Global.報告書人員清單_tabel.Rows[int.Parse(row)]["客戶編號"].ToString();
- string 申請人 = Global.報告書人員清單_tabel.Rows[int.Parse(row)]["申請人"].ToString();
- string 聯繫人 = Global.報告書人員清單_tabel.Rows[int.Parse(row)]["聯繫人"].ToString();
- string 聯繫人電話 = Global.報告書人員清單_tabel.Rows[int.Parse(row)]["聯繫電話"].ToString();
- string 住址 = Global.報告書人員清單_tabel.Rows[int.Parse(row)]["地址"].ToString();
- string 聯繫人2 = Global.報告書人員清單_tabel.Rows[int.Parse(row)]["聯繫人3"].ToString();
- string 聯繫人2電話 = Global.報告書人員清單_tabel.Rows[int.Parse(row)]["聯繫人3電話"].ToString();
- Set_報告書清單(客戶編號,申請人,聯繫人,聯繫人電話,住址,聯繫人2,聯繫人2電話);
- }else if(cell_text.name.Contains("文件號清單")){
- Module.清除底色(文件號清單_ct);Global.報告書物料明細流水號="";Global.報告書物料料號 ="";報告書扶手總長_tb.text="";單項扶手長度_tb.text="";
- cell_text.GetComponentInParent<Image>().color = new Color(0.67f,1f,0.4f,1f);
- string 文件號id = cell_text.GetComponent<TextMeshProUGUI>().text;
- for(int i=0;i<=Global.文件號清單_table.Rows.Count-1;i++){
- if(文件號id==Global.文件號清單_table.Rows[i][0].ToString()){
- Global.報告書文件號 =Global.文件號清單_table.Rows[i][1].ToString();
- }
- }
- if(Global.報告書施工狀態!="文件號"){
- PhotoScroll.清除currentPage();
- }else{
- 載入施工圖片();
- }
- 載入報告書項目清單(Global.報告書文件號);
- }else if(cell_text.name.Contains("報告書項目清單")){
- Module.清除底色(報告書項目清單_ct);
- cell_text.GetComponentInParent<Image>().color = new Color(0.67f,1f,0.4f,1f);
- string row=cell_text.name.Substring(cell_text.name.Length-3,1);
- Global.報告書物料料號 = cell_text.GetComponent<TextMeshProUGUI>().text;
- Global.報告書物料明細流水號 = Global.報告書項目清單_tabel.Rows[int.Parse(row)][0].ToString();
- if(cell_text.GetComponent<TextMeshProUGUI>().text=="FA01" || cell_text.GetComponent<TextMeshProUGUI>().text=="137" ||
- cell_text.GetComponent<TextMeshProUGUI>().text=="FA09" || cell_text.GetComponent<TextMeshProUGUI>().text=="152"){
- if(cell_text.GetComponent<TextMeshProUGUI>().text=="FA01" || cell_text.GetComponent<TextMeshProUGUI>().text=="137"){
- 扶手總長2_lb.text="扶手總長";
- 扶手長度_lb.text="扶手長度";
- 請輸入扶手總長度_lb.text="請輸入扶手總長度";
- 扶手總長度_lb.text="扶手總長度";
- 已使用扶手長度_lb.text="已使用扶手長度";
- 可使用扶手長度_lb.text="可使用扶手長度";
- 扶手長度2_lb.text="扶手長度";
- }else{
- 扶手總長2_lb.text="總單位";
- 扶手長度_lb.text="單位";
- 請輸入扶手總長度_lb.text="請輸入總單位";
- 扶手總長度_lb.text="總單位";
- 已使用扶手長度_lb.text="已使用單位";
- 可使用扶手長度_lb.text="可使用單位";
- 扶手長度2_lb.text="單位";
- }
-
- 報告書扶手總長_tb.text = Global.報告書項目清單_tabel.Rows[int.Parse(row)][2].ToString();
- }else{
- 報告書扶手總長_tb.text = "不適用";
- 單項扶手長度_tb.text = "不適用";
- }
- if(Global.報告書施工狀態!="文件號"){
- 載入施工圖片();
- PhotoScroll.清除currentPage();
- }
- }else if(cell_text.name.Contains("客戶清單")){
- int NUM1;string dat1,報告書號;
- Set_日期格式轉換();SQL_Comm.SQL_取得加盟商編號(Global.gUser區域);
- if(SQL_Module.dr.Read()){
- Global.gUser加盟商編號=SQL_Module.dr[0].ToString();
- }else{
- Global.gUser加盟商編號="未設定加盟商";
- }
- SQL_Comm.SQL_報告書_查詢流水號(Global.gUser區域);
- if(SQL_Module.dr.Read()){
- 報告書號 = SQL_Module.dr["流水號"].ToString();
- }else{
- 報告書號 = "RE" + Global.DTP1[2..] + "00-" + Global.gUser加盟商編號;
- }
- dat1 = 報告書號.Substring(2, 6);
- if(dat1 != Global.DTP1[2..]){
- NUM1 = 1;
- }else{
- NUM1 = int.Parse(報告書號.Substring(8, 2)) + 1;
- }
- 報告書號 = "RE" + Global.DTP1[2..] + NUM1.ToString().PadLeft(2, '0') + "-" + Global.gUser加盟商編號;
- string 圖檔資料庫;
- SQL_Comm.SQL_查詢圖檔資料庫();
- if(SQL_Module.dr.Read()){
- 圖檔資料庫 = SQL_Module.dr[0].ToString();
- string 日期 = DateTime.Today.Year.ToString().PadLeft(4,'0')+"/"+DateTime.Today.Month.ToString().PadLeft(2,'0')+"/"+DateTime.Today.Day.ToString().PadLeft(2,'0');
- SQL_Comm.SQL_報告書_新增(報告書號,cell_text.GetComponent<TextMeshProUGUI>().text, 日期, Global.使用者暱稱, Global.gUser區域, 圖檔資料庫);
- 主頁面調整(false,true,false);
- 回上頁_bt.SetActive(true);拍照_bt.SetActive(true);業務系統_bt.SetActive(false);系統設定_bt.SetActive(false);
- 新增項目_bt.SetActive(true);刪除項目_bt.SetActive(true);
- 選擇客戶_pl.SetActive(false);評估詳細_pl.SetActive(true);評估主頁_pl.SetActive(false);
- 報告書流水號_tb.text=報告書號;
- 載入報告書詳細資料(報告書號);
- }else{
- 彈跳_pl.SetActive(true);
- 彈跳文字_tb.text="無可用資料庫,請通知系統商新增資料庫";
- Global.彈跳判斷="新增報告書";
- }
- }else if(cell_text.name.Contains("項目物料清單")){
- 報告書圖片_pl.SetActive(true);新增項目_pl.SetActive(false);
- string 物料料號;
- string row=cell_text.name.Substring(cell_text.name.Length-2,2);
- 物料料號=Global.長照物料清單_tabel.Rows[int.Parse(row)][1].ToString();
- if(物料料號=="FA01" || 物料料號=="137" || 物料料號=="FA09" || 物料料號=="152"){
- if(物料料號=="FA01" || 物料料號=="137"){
- 扶手總長2_lb.text="扶手總長";
- 扶手長度_lb.text="扶手長度";
- 請輸入扶手總長度_lb.text="請輸入扶手總長度";
- 扶手總長度_lb.text="扶手總長度";
- 已使用扶手長度_lb.text="已使用扶手長度";
- 可使用扶手長度_lb.text="可使用扶手長度";
- 扶手長度2_lb.text="扶手長度";
- }else{
- 扶手總長2_lb.text="總單位";
- 扶手長度_lb.text="單位";
- 請輸入扶手總長度_lb.text="請輸入總單位";
- 扶手總長度_lb.text="總單位";
- 已使用扶手長度_lb.text="已使用單位";
- 可使用扶手長度_lb.text="可使用單位";
- 扶手長度2_lb.text="單位";
- }
- Global.輸入物料料號=物料料號;
- 輸入扶手長度_pl.SetActive(true);
- }else{
- SQL_Comm.SQL_報告書_讀取流水號();
- string 明細流水號;double NUM;
- if(SQL_Module.dr.Read()){明細流水號 = SQL_Module.dr["流水號"].ToString();}else{明細流水號 = "WS00000000";}
- NUM = double.Parse(明細流水號.Substring(2, 8)) + 1;
- 明細流水號 = "WS" + NUM.ToString().PadLeft(8, '0');
- SQL_Comm.SQL_報告書_明細寫入(明細流水號, Global.報告書文件號, 物料料號, "", 報告書流水號_tb.text,"0");
- 載入報告書項目清單(Global.報告書文件號);
- }
- }else if(cell_text.name.Contains("報告書評估報告書1清單")){
- Module.清除底色(報告書施作項目清單_ct);
- cell_text.GetComponentInParent<Image>().color = new Color(0.67f,1f,0.4f,1f);
- string row=cell_text.name.Substring(cell_text.name.Length-3,1);
- Global.報告書物料料號 = Global.報告書評估報告書1清單_tabel.Rows[int.Parse(row)][2].ToString();
- Global.報告書物料明細流水號 = Global.報告書評估報告書1清單_tabel.Rows[int.Parse(row)][0].ToString();
- 施工前_img.color = new Color(1f,1f,1f,1f);
- 施工後_img.color = new Color(1f,1f,1f,1f);
- Module.清除控件(報告書施作圖片_ct);
- PhotoScroll.清除currentPage();
- }else if(cell_text.name.Contains("報告書評估報告書2清單")){
- Module.清除底色(報告書施作項目清單_ct);
- cell_text.GetComponentInParent<Image>().color = new Color(0.67f,1f,0.4f,1f);
- string row=cell_text.name.Substring(cell_text.name.Length-3,1);
- Global.報告書物料料號 = Global.報告書評估報告書2清單_tabel.Rows[int.Parse(row)][2].ToString();
- Global.報告書物料明細流水號 = Global.報告書評估報告書2清單_tabel.Rows[int.Parse(row)][0].ToString();
- 施工前_img.color = new Color(1f,1f,1f,1f);
- 施工後_img.color = new Color(1f,1f,1f,1f);
- Module.清除控件(報告書施作圖片_ct);
- PhotoScroll.清除currentPage();
- }else if(cell_text.name.Contains("評估報告書1物料清單")){
- 評估報告書1_物料清單_sv.SetActive(false);返回6_bt.SetActive(true);施作圖片_pl.SetActive(true);返回7_bt.SetActive(false);
- string 物料料號;
- string row=cell_text.name.Substring(cell_text.name.Length-2,2);
- 物料料號=Global.長照物料清單_tabel.Rows[int.Parse(row)][1].ToString();
- SQL_Comm.SQL_報告書_讀取流水號();
- string 明細流水號;double NUM;
- if(SQL_Module.dr.Read()){明細流水號 = SQL_Module.dr["流水號"].ToString();}else{明細流水號 = "WS00000000";}
- NUM = double.Parse(明細流水號.Substring(2, 8)) + 1;
- 明細流水號 = "WS" + NUM.ToString().PadLeft(8, '0');
- SQL_Comm.SQL_報告書_明細寫入(明細流水號,"評估報告書1", 物料料號, "", 報告書流水號_tb.text,"0");
- Set_評估報告書1清單("評估報告書1");
- }else if(cell_text.name.Contains("評估報告書2物料清單")){
- 評估報告書1_物料清單_sv.SetActive(false);返回6_bt.SetActive(true);施作圖片_pl.SetActive(true);返回7_bt.SetActive(false);
- string 物料料號;
- string row=cell_text.name.Substring(cell_text.name.Length-2,2);
- 物料料號=Global.長照物料清單_tabel.Rows[int.Parse(row)][1].ToString();
- SQL_Comm.SQL_報告書_讀取流水號();
- string 明細流水號;double NUM;
- if(SQL_Module.dr.Read()){明細流水號 = SQL_Module.dr["流水號"].ToString();}else{明細流水號 = "WS00000000";}
- NUM = double.Parse(明細流水號.Substring(2, 8)) + 1;
- 明細流水號 = "WS" + NUM.ToString().PadLeft(8, '0');
- SQL_Comm.SQL_報告書_明細寫入(明細流水號,"評估報告書2", 物料料號, "", 報告書流水號_tb.text,"0");
- Set_評估報告書1清單("評估報告書2");
- }
- }
- private void 載入圖片清單2(string 階段,Transform 文件圖片_tp, GameObject 文件圖片_rpf, GameObject 文件圖片_ct, GameObject 文件圖片_lpf,GameObject 圖片讀取,GameObject 圖片寬度){
- 圖片讀取.SetActive(true);
- Module.清除控件(文件圖片_ct);
- SQL_Comm.SQL_取得報告書資料(報告書項目清單_報告書號_tb.text);
- if(SQL_Module.dr.Read()){
- 報告書申請人_tb.text = SQL_Module.dr["負責人"].ToString();
- 報告書開立人_tb.text = SQL_Module.dr["開立人"].ToString();
- Global.圖檔資料庫 = SQL_Module.dr["圖檔資料庫"].ToString();
- Debug.Log(Global.圖檔資料庫);
- SQL_CommString.SQL_連線字串_圖片_SQL(Global.圖檔資料庫,Global.資料庫IP);
-
- SQL_Comm.SQL_報告書_施工圖片清單(報告書項目清單_報告書號_tb.text,階段,Global.報告書選項2,Global.報告書物料料號,Global.報告書物料明細流水號);
- DataSet ds1 = new();
- SQL_Module.da.Fill(ds1);
- if(ds1.Tables[0].Rows.Count>0){
- 施作圖片相片目前_tb.text="1";施作圖片相片總數_tb.text=ds1.Tables[0].Rows.Count.ToString();
- 施作圖片相片文件號_tb.text = ds1.Tables[0].Rows[0][0].ToString();
- }else{
- 施作圖片相片目前_tb.text="-";施作圖片相片總數_tb.text="-";施作圖片相片文件號_tb.text ="文件號";
- }
- Global.報告書施作圖片_table = ds1.Tables[0];
- 文件圖片_ct.GetComponent<RectTransform>().sizeDelta=new Vector2(圖片寬度.GetComponent<RectTransform>().rect .width,文件圖片_ct.GetComponent<RectTransform>().sizeDelta.y);
- 文件圖片_rpf.GetComponent<RectTransform>().sizeDelta=new Vector2(圖片寬度.GetComponent<RectTransform>().rect .width,文件圖片_rpf.GetComponent<RectTransform>().sizeDelta.y);
- 載入報告書圖片("報告書"+階段,ds1.Tables[0],文件圖片_tp,文件圖片_rpf,文件圖片_ct,myFont,UIsprite,文件圖片_lpf,true);
- 圖片讀取.SetActive(false);
- }
- }
- public void 施工前2(){
-
- 施工前_img.color = new Color(0.67f,1f,0.4f,1f);
- 施工後_img.color = new Color(1f,1f,1f,1f);
- 產品序號_img.color = new Color(1f,1f,1f,1f);
- Global.報告書施工狀態="施工前";
- 拍照1_bt.SetActive(true);刪除1_bt.SetActive(true);
- 載入圖片清單2(Global.報告書施工狀態,報告書施作圖片_tp,報告書施作圖片_rpf,報告書施作圖片_ct,報告書施作圖片_lpf,施作圖片圖片讀取_pl,施作圖片圖片寬度_pl);
- PhotoScroll.清除currentPage();
- }
- public void 施工後2(){
- 施工前_img.color = new Color(1f,1f,1f,1f);
- 施工後_img.color = new Color(0.67f,1f,0.4f,1f);
- 產品序號_img.color = new Color(1f,1f,1f,1f);
- 拍照1_bt.SetActive(true);刪除1_bt.SetActive(true);
- Global.報告書施工狀態="施工後";
- 載入圖片清單2(Global.報告書施工狀態,報告書施作圖片_tp,報告書施作圖片_rpf,報告書施作圖片_ct,報告書施作圖片_lpf,施作圖片圖片讀取_pl,施作圖片圖片寬度_pl);
- PhotoScroll.清除currentPage();
- }
- public void 產品序號2(){
- 施工前_img.color = new Color(1f,1f,1f,1f);
- 施工後_img.color = new Color(1f,1f,1f,1f);
- 產品序號_img.color = new Color(0.67f,1f,0.4f,1f);
- 拍照1_bt.SetActive(true);刪除1_bt.SetActive(true);
- Global.報告書施工狀態="產品序號";
- 載入圖片清單2(Global.報告書施工狀態,報告書施作圖片_tp,報告書施作圖片_rpf,報告書施作圖片_ct,報告書施作圖片_lpf,施作圖片圖片讀取_pl,施作圖片圖片寬度_pl);
- PhotoScroll.清除currentPage();
- }
- private void 載入施工圖片(){
- 圖片讀取_pl.SetActive(true);
- Module.清除控件(報告書施工圖片_ct);
- if(Global.報告書施工狀態=="文件號"){
- SQL_Comm.SQL_報告書_報告書圖片清單(報告書流水號_tb.text,"報告書",Global.報告書文件號);
- }else{
- SQL_Comm.SQL_報告書_施工圖片清單(報告書流水號_tb.text,Global.報告書施工狀態,Global.報告書文件號,Global.報告書物料料號,Global.報告書物料明細流水號);
- }
- DataSet ds1 = new();
- SQL_Module.da.Fill(ds1);
- if(ds1.Tables[0].Rows.Count>0){
- 相片目前_tb.text="1";相片總數_tb.text=ds1.Tables[0].Rows.Count.ToString();更換照片_bt.SetActive(true);刪除照片_bt.SetActive(true);
- }else{
- 相片目前_tb.text="-";相片總數_tb.text="-";更換照片_bt.SetActive(false);刪除照片_bt.SetActive(false);
- }
- Global.報告書施工圖片_table = ds1.Tables[0];
- 報告書施工圖片_ct.GetComponent<RectTransform>().sizeDelta=new Vector2(圖片寬度_pl.GetComponent<RectTransform>().rect .width,報告書施工圖片_ct.GetComponent<RectTransform>().sizeDelta.y);
- 報告書施工圖片_rpf.GetComponent<RectTransform>().sizeDelta=new Vector2(圖片寬度_pl.GetComponent<RectTransform>().rect .width,報告書施工圖片_rpf.GetComponent<RectTransform>().sizeDelta.y);
- 載入報告書圖片("報告書施工圖片",ds1.Tables[0],報告書施工圖片_tp,報告書施工圖片_rpf,報告書施工圖片_ct,myFont,UIsprite,報告書施工圖片_lpf,true);
- if(Global.報告書施工狀態 == "施工前" && ds1.Tables[0].Rows.Count > 0 && (Global.報告書物料料號 == "FA01" || Global.報告書物料料號 == "137" || Global.報告書物料料號 == "FA09" || Global.報告書物料料號 == "152")){
- if(Global.報告書物料料號=="FA01" || Global.報告書物料料號=="137"){
- 扶手總長2_lb.text="扶手總長";
- 扶手長度_lb.text="扶手長度";
- 請輸入扶手總長度_lb.text="請輸入扶手總長度";
- 扶手總長度_lb.text="扶手總長度";
- 已使用扶手長度_lb.text="已使用扶手長度";
- 可使用扶手長度_lb.text="可使用扶手長度";
- 扶手長度2_lb.text="扶手長度";
- }else{
- 扶手總長2_lb.text="總單位";
- 扶手長度_lb.text="單位";
- 請輸入扶手總長度_lb.text="請輸入總單位";
- 扶手總長度_lb.text="總單位";
- 已使用扶手長度_lb.text="已使用單位";
- 可使用扶手長度_lb.text="可使用單位";
- 扶手長度2_lb.text="單位";
- }
- string 文件號 = Global.報告書施工圖片_table.Rows[0][0].ToString();
- if(Global.報告書施工圖檔文件號==""){Global.報告書施工圖檔文件號 = 文件號;}
- SQL_Comm.SQL_報告書_施工圖檔扶手長度(報告書流水號_tb.text,Global.報告書文件號,Global.報告書物料料號,Global.報告書物料明細流水號,文件號);
- if(SQL_Module.dr.Read()){
- 單項扶手長度_tb.text=SQL_Module.dr[0].ToString();
- }else{
- 單項扶手長度_tb.text="";
- }
- }
- 圖片讀取_pl.SetActive(false);
- }
- private void 主頁面調整(bool 首頁,bool 評估,bool 新建){
- 首頁_pl.SetActive(首頁);評估_pl.SetActive(評估);新建_pl.SetActive(新建);
- }
- public void 開啟系統設定(){
- 主頁面調整(true,false,false);
- 評估紀錄_pl.SetActive(false);
- 系統設定_pl.SetActive(true);
- }
- public void 開啟首頁(){
- 主頁面調整(true,false,false);
- 評估紀錄_pl.SetActive(true);
- 系統設定_pl.SetActive(false);
- Module.清除底色(文件號清單_ct);
- Module.清除底色(報告書項目清單_ct);
- Module.清除控件(報告書施工圖片_ct);
- Global.報告書文件號="";Global.報告書物料料號="";Global.報告書物料明細流水號="";
- }
- public void 開啟評估頁面(){
- 主頁面調整(false,true,false);
- 系統設定_pl.SetActive(false);
- Set_報告書人員清單("");
- }
- public void 開啟新建報告書頁面(){
- 主頁面調整(false,false,true);
- 選擇客戶_pl.SetActive(true);
- Set_客戶清單();
- }
- public void 輸入扶手長度完畢(){
- if(Global.輸入物料料號=="" || 輸入扶手總長_tb.text==""){
- 輸入扶手長度_pl.SetActive(false);
- 彈跳_pl.SetActive(true);
- 彈跳文字_tb.text="輸入資料有誤!";
- Global.彈跳判斷="輸入扶手長度";
- }else{
- SQL_Comm.SQL_報告書_讀取流水號();
- string 明細流水號;double NUM;
- if(SQL_Module.dr.Read()){明細流水號 = SQL_Module.dr["流水號"].ToString();}else{明細流水號 = "WS00000000";}
- NUM = double.Parse(明細流水號.Substring(2, 8)) + 1;
- 明細流水號 = "WS" + NUM.ToString().PadLeft(8, '0');
- SQL_Comm.SQL_報告書_明細寫入(明細流水號, Global.報告書文件號, Global.輸入物料料號, "", 報告書流水號_tb.text,輸入扶手總長_tb.text);
- 載入報告書項目清單(Global.報告書文件號);
- 輸入扶手長度_pl.SetActive(false);
- }
- }
- public void 輸入單項扶手長度完畢(){
- double 扶手可使用長度 = double.Parse(扶手可使用長度_tb.text);double 扶手長度;
- if(扶手長度_tb.text==""){扶手長度=0;}else{扶手長度=double.Parse(扶手長度_tb.text);}
- if(扶手長度 > 扶手可使用長度){
- 彈跳_pl.SetActive(true);
- 彈跳文字_tb.text = "超出扶手可使用長度 !";
- Global.彈跳判斷 = "長度透支";
- }else{
- 輸入單項扶手長度_pl.SetActive(false);
- Texture2D texture2D = new((放圖用.texture as Texture2D).width, (放圖用.texture as Texture2D).height);
- Graphics.CopyTexture(放圖用.texture, texture2D);
- byte[] imageBytes = texture2D.EncodeToPNG();
- SQL_Comm.SQL_讀取施工圖檔流水號(報告書流水號_tb.text,Global.報告書施工狀態,Global.報告書文件號,Global.報告書物料料號,Global.報告書物料明細流水號);
- int 流水號;if(SQL_Module.dr.Read()){流水號=int.Parse(SQL_Module.dr[0].ToString()[2..]);}else{流水號 = 0;}流水號+=1;
-
- SQL_Comm.SQL_上傳施工圖檔(報告書流水號_tb.text,Global.報告書施工狀態,Global.報告書文件號,Global.報告書物料料號,imageBytes,"JPG","IM"+流水號.ToString().PadLeft(3,'0'),扶手長度.ToString(),Global.報告書物料明細流水號);
- 拍照結束();
- }
- }
- public void 回上頁(string 介面){
- if(介面=="評估"){
- 評估詳細_pl.SetActive(false);評估主頁_pl.SetActive(true);
- 回上頁_bt.SetActive(false);拍照_bt.SetActive(false);業務系統_bt.SetActive(true);系統設定_bt.SetActive(true);
- 新增項目_bt.SetActive(false);刪除項目_bt.SetActive(false);
- Module.清除控件(報告書項目清單_ct);Module.清除控件(報告書施工圖片_ct);
-
- 報告書流水號_tb.text="";報告書申請人_tb.text="";報告書開立人_tb.text="";Global.報告書物料明細流水號="";
- Set_報告書人員清單("");
- }
- }
- public void 新增相片(){
- if(Global.報告書施工狀態=="文件號"){
- if(報告書流水號_tb.text==""){
- 彈跳_pl.SetActive(true);
- 彈跳文字_tb.text = "看到這則訊息請聯絡系統開發商!";
- Global.彈跳判斷="報告書資料不齊全";
- }else{
- if (!拍照頁面_pl.activeSelf){
- 拍照頁面_pl.SetActive(true);
- StartCoroutine(open_Camera(60));
- 提示_tb.text ="拍照中";
- 拍照用.gameObject.SetActive(true);
- 放圖用.gameObject.SetActive(false);
- }
- }
- }else{
- if(Global.報告書物料料號=="" || Global.報告書文件號==""){
- 彈跳_pl.SetActive(true);
- 彈跳文字_tb.text = "請先選擇文件以及項目!";
- Global.彈跳判斷="報告書資料不齊全";
- }else{
- if (!拍照頁面_pl.activeSelf){
- 拍照頁面_pl.SetActive(true);
- StartCoroutine(open_Camera(60));
- 提示_tb.text ="拍照中";
- 拍照用.gameObject.SetActive(true);
- 放圖用.gameObject.SetActive(false);
- }
- }
- }
- }
- public void 拍照(){
- if (拍照用.gameObject.activeSelf && !放圖用.gameObject.activeSelf){
- Texture2D photoTexture = CapturePhoto();
- if (photoTexture != null){
- 放圖用.rectTransform.sizeDelta = new Vector2(720f, 1280f);
- 放圖用.texture = photoTexture;
- Texture2D texture2D = new((放圖用.texture as Texture2D).width, (放圖用.texture as Texture2D).height);
- Graphics.CopyTexture(放圖用.texture, texture2D);
- byte[] imageBytes = texture2D.EncodeToPNG();
- SQL_CommString.SQL_連線字串_圖片_SQL(Global.圖檔資料庫,Global.資料庫IP);
- if(Global.報告書施工狀態=="文件號"){
- SQL_Comm.SQL_讀取報告書檔案流水號(報告書流水號_tb.text);
- int 流水號;if(SQL_Module.dr.Read()){流水號=int.Parse(SQL_Module.dr[0].ToString()[2..]);}else{流水號 = 0;}流水號+=1;
- SQL_Comm.SQL_上傳報告書圖檔(報告書流水號_tb.text,"報告書","IM"+流水號.ToString().PadLeft(3,'0'),imageBytes,"JPG");
- 拍照結束();
- }else{
- if(Global.報告書施工狀態=="施工前" && (Global.報告書物料料號=="FA01" || Global.報告書物料料號=="137" || Global.報告書物料料號=="FA09" || Global.報告書物料料號=="152")){
- if(Global.報告書物料料號=="FA01" || Global.報告書物料料號=="137"){
- 扶手總長2_lb.text="扶手總長";
- 扶手長度_lb.text="扶手長度";
- 請輸入扶手總長度_lb.text="請輸入扶手總長度";
- 扶手總長度_lb.text="扶手總長度";
- 已使用扶手長度_lb.text="已使用扶手長度";
- 可使用扶手長度_lb.text="可使用扶手長度";
- 扶手長度2_lb.text="扶手長度";
- }else{
- 扶手總長2_lb.text="總單位";
- 扶手長度_lb.text="單位";
- 請輸入扶手總長度_lb.text="請輸入總單位";
- 扶手總長度_lb.text="總單位";
- 已使用扶手長度_lb.text="已使用單位";
- 可使用扶手長度_lb.text="可使用單位";
- 扶手長度2_lb.text="單位";
- }
- 輸入單項扶手總長度_tb.text = 報告書扶手總長_tb.text;
- SQL_Comm.SQL_報告書_施工圖檔扶手長度清單(報告書流水號_tb.text,Global.報告書文件號,Global.報告書物料料號,Global.報告書物料明細流水號);
- DataSet ds1 = new();
- SQL_Module.da.Fill(ds1);
- double 扶手累積長度=0;
- double 扶手總長度 = double.Parse(輸入單項扶手總長度_tb.text);
- for(int i =0;i<=ds1.Tables[0].Rows.Count-1;i++){
- 扶手累積長度 += double.Parse(ds1.Tables[0].Rows[i][0].ToString());
- }
- 扶手已使用長度_tb.text = 扶手累積長度.ToString();
- double 扶手可使用長度 = 扶手總長度 - 扶手累積長度;
- 扶手可使用長度_tb.text = 扶手可使用長度.ToString();
- 扶手長度_tb.text = "";
- 輸入單項扶手長度_pl.SetActive(true);
- }else{
- SQL_Comm.SQL_讀取施工圖檔流水號(報告書流水號_tb.text,Global.報告書施工狀態,Global.報告書文件號,Global.報告書物料料號,Global.報告書物料明細流水號);
- int 流水號;if(SQL_Module.dr.Read()){流水號=int.Parse(SQL_Module.dr[0].ToString()[2..]);}else{流水號 = 0;}流水號+=1;
- SQL_Comm.SQL_上傳施工圖檔(報告書流水號_tb.text,Global.報告書施工狀態,Global.報告書文件號,Global.報告書物料料號,imageBytes,"JPG","IM"+流水號.ToString().PadLeft(3,'0'),"0",Global.報告書物料明細流水號);
- 拍照結束();
- }
- }
- }
- myCam.Stop();
- myCam = null;
- 提示_tb.text ="";
- }
- }
- private void 拍照結束(){
- 拍照頁面_pl.SetActive(false);
- PhotoScroll.清除currentPage();
- 扶手長度_tb.text="";
- if(Global.報告書施工狀態=="文件號"){
- 載入報告書詳細資料(報告書流水號_tb.text);
- }else{
- 載入施工圖片();
- }
- }
-
- private Texture2D CapturePhoto(){
- if (myCam != null){
- int width = myCam.width;
- int height = myCam.height;
- Texture2D photoTexture = new Texture2D(width, height);
- photoTexture.SetPixels(myCam.GetPixels());
- photoTexture.Apply();
- Texture2D rotatedTexture = RotateTexture(photoTexture, true);
- return rotatedTexture;
- }
- return null;
- }
- private IEnumerator open_Camera(int fps){
- yield return Application.RequestUserAuthorization(UserAuthorization.WebCam); //授權開啟鏡頭
- if (Application.HasUserAuthorization(UserAuthorization.WebCam)){
- myCam = new WebCamTexture(WebCamTexture.devices[0].name, 720, 1280, fps);
- 拍照用.texture = myCam;
- myCam.Play();
- }
- }
- private IEnumerator open_Camera2(int fps){
- yield return Application.RequestUserAuthorization(UserAuthorization.WebCam); //授權開啟鏡頭
- if (Application.HasUserAuthorization(UserAuthorization.WebCam)){
- myCam = new WebCamTexture(WebCamTexture.devices[0].name, 720, 1280, fps);
- 更換照片拍照用.texture = myCam;
- myCam.Play();
- }
- }
- private Texture2D RotateTexture(Texture2D originalTexture, bool clockwise){
- int width = originalTexture.width;
- int height = originalTexture.height;
- Texture2D rotatedTexture = new Texture2D(height, width);
- Color32[] originalPixels = originalTexture.GetPixels32();
- Color32[] rotatedPixels = new Color32[width * height];
- for (int y = 0; y < height; y++){
- for (int x = 0; x < width; x++){
- int newX = clockwise ? y : height - y - 1;
- int newY = clockwise ? width - x - 1 : x;
- rotatedPixels[newY * height + newX] = originalPixels[y * width + x];
- }
- }
- rotatedTexture.SetPixels32(rotatedPixels);
- rotatedTexture.Apply();
- return rotatedTexture;
- }
- public void 施工前(){
- Global.報告書施工狀態="施工前";發送通知_bt.SetActive(false);
- 施工前_bt.GetComponentInParent<Image>().color = new Color(0.67f,1f,0.4f,1f);
- 施工後_bt.GetComponentInParent<Image>().color = new Color(1f,1f,1f,1f);
- 文件號_bt.GetComponentInParent<Image>().color = new Color(1f,1f,1f,1f);
- 核銷文件_bt.GetComponentInParent<Image>().color = new Color(1f,1f,1f,1f);
- 載入施工圖片();
- PhotoScroll.清除currentPage();
- }
- public void 施工後(){
- Global.報告書施工狀態="施工後";單項扶手長度_tb.text="";發送通知_bt.SetActive(true);
- 施工前_bt.GetComponentInParent<Image>().color = new Color(1f,1f,1f,1f);
- 施工後_bt.GetComponentInParent<Image>().color = new Color(0.67f,1f,0.4f,1f);
- 文件號_bt.GetComponentInParent<Image>().color = new Color(1f,1f,1f,1f);
- 核銷文件_bt.GetComponentInParent<Image>().color = new Color(1f,1f,1f,1f);
- 載入施工圖片();
- PhotoScroll.清除currentPage();
- }
- public void 核銷文件按鈕(){
- Global.報告書施工狀態="核銷文件";單項扶手長度_tb.text="";發送通知_bt.SetActive(false);
- 施工前_bt.GetComponentInParent<Image>().color = new Color(1f,1f,1f,1f);
- 施工後_bt.GetComponentInParent<Image>().color = new Color(1f,1f,1f,1f);
- 文件號_bt.GetComponentInParent<Image>().color = new Color(1f,1f,1f,1f);
- 核銷文件_bt.GetComponentInParent<Image>().color = new Color(0.67f,1f,0.4f,1f);
- 載入施工圖片();
- PhotoScroll.清除currentPage();
- }
- public void 更換照片_開啟(){
- if(!更換照片_pl.activeInHierarchy){
- 更換照片資料夾_bt.SetActive(true);更換照片文件號_bt.SetActive(true);更換照片確認_bt.SetActive(true);
- 更換照片取消_bt.SetActive(true);更換照片拍照確認_bt.SetActive(false);
- 更換照片_pl.SetActive(true);
- Transform 子1=報告書施工圖片_ct.transform.GetChild(1);
- Transform 子2 = 子1.transform.GetChild(1);
- 更換照片放圖用.texture=子2.gameObject.GetComponent<RawImage>().texture;
- 更換照片提示_tb.text="編輯中";
- }
- }
- public void 更換照片_取消(){
- if(更換照片_pl.activeInHierarchy){
- 更換照片放圖用.texture =null;更換照片拍照用.texture =null;更換照片_pl.SetActive(false);
- }
- }
- public void 更換照片_確認(){
- if(更換照片放圖用.texture != null){
- Texture2D originalTexture = 更換照片放圖用.texture as Texture2D;
- Texture2D texture2D = new(originalTexture.width, originalTexture.height, TextureFormat.RGBA32, false);
- Color[] pixels = originalTexture.GetPixels();
- texture2D.SetPixels(pixels);
- texture2D.Apply();
- byte[] imageBytes = texture2D.EncodeToPNG();
- SQL_CommString.SQL_連線字串_圖片_SQL(Global.圖檔資料庫,Global.資料庫IP);
- if(Global.報告書施工狀態=="文件號"){
- SQL_Comm.SQL_更新報告書圖檔(報告書流水號_tb.text,"報告書",Global.報告書文件號,imageBytes);
- 更換照片結束();
- }else{
- SQL_Comm.SQL_更新施工圖檔(報告書流水號_tb.text,Global.報告書施工狀態,Global.報告書文件號,Global.報告書物料料號,imageBytes,Global.報告書施工圖檔文件號,Global.報告書物料明細流水號);
- 更換照片結束();
- }
- }
- }
- public void 更換照片_拍照(){
- StartCoroutine(open_Camera2(60));
- 更換照片提示_tb.text ="拍照中";
- 更換照片資料夾_bt.SetActive(false);更換照片文件號_bt.SetActive(false);更換照片確認_bt.SetActive(false);
- 更換照片取消_bt.SetActive(false);更換照片拍照確認_bt.SetActive(true);
- 更換照片拍照用.gameObject.SetActive(true);
- 更換照片放圖用.gameObject.SetActive(false);
-
- }
- public void 更換照片_拍照確認(){
- 更換照片資料夾_bt.SetActive(true);更換照片文件號_bt.SetActive(true);更換照片確認_bt.SetActive(true);
- 更換照片取消_bt.SetActive(true);更換照片拍照確認_bt.SetActive(false);
- if (更換照片拍照用.gameObject.activeSelf && !更換照片放圖用.gameObject.activeSelf){
- Texture2D photoTexture = CapturePhoto();
- if (photoTexture != null){
- 更換照片放圖用.rectTransform.sizeDelta = new Vector2(720f, 1280f);
- 更換照片放圖用.texture = photoTexture;
- }
- myCam.Stop();
- myCam = null;
- 更換照片提示_tb.text ="編輯中";
- 更換照片拍照用.gameObject.SetActive(false);
- 更換照片放圖用.gameObject.SetActive(true);
- }
- }
- public void 更換照片_相簿(){
- if (NativeGallery.IsMediaPickerBusy())
- return;
-
- NativeGallery.Permission permission = NativeGallery.GetImageFromGallery((path) => {
- if (path != null) {
- Texture2D texture = NativeGallery.LoadImageAtPath(path,2048,false);
- if (texture == null) {
- Debug.LogError("無法載入圖片");
- return;
- }
- 更換照片放圖用.rectTransform.sizeDelta = new Vector2(720f, 1280f);
- 更換照片放圖用.texture = texture;
- }
- }, "選取一張圖片", "image/*");
-
- Debug.Log("Permission result: " + permission);
- }
- private void 更換照片結束(){
- 更換照片_pl.SetActive(false);
- PhotoScroll.清除currentPage();
- 扶手長度_tb.text="";
- if(Global.報告書施工狀態=="文件號"){
- 載入報告書詳細資料(報告書流水號_tb.text);
- Module.清除控件(報告書施工圖片_ct);
- }else{
- 載入施工圖片();
- }
- }
- public void 文件號(){
- Global.報告書施工狀態="文件號";單項扶手長度_tb.text="";發送通知_bt.SetActive(false);
- 施工前_bt.GetComponentInParent<Image>().color = new Color(1f,1f,1f,1f);
- 施工後_bt.GetComponentInParent<Image>().color = new Color(1f,1f,1f,1f);
- 文件號_bt.GetComponentInParent<Image>().color = new Color(0.67f,1f,0.4f,1f);
- 核銷文件_bt .GetComponentInParent<Image>().color = new Color(1f,1f,1f,1f);
- 載入施工圖片();
- PhotoScroll.清除currentPage();
- }
- public void 刪除照片(){
- if(相片總數_tb.text=="-"){
- 彈跳_pl.SetActive(true);
- 彈跳文字_tb.text="請先選擇要刪除的照片";
- }else{
- if(Global.報告書施工狀態=="文件號"){
- 彈跳_pl.SetActive(true);
- 彈跳文字_tb.text="確定要刪除此照片?";
- Global.彈跳判斷="文件號刪除照片";
- }else{
- 彈跳_pl.SetActive(true);
- 彈跳文字_tb.text="確定要刪除此照片?";
- Global.彈跳判斷="施工刪除照片";
- }
- }
- }
- public void 備註_返回(){
- 備註_pl.SetActive(false);備註_tb.text="";
- }
- public void 開啟備註(){
- 備註_pl.SetActive(true);string 備註="";
-
- SQL_Comm.SQL_報告書_讀取施工備註2(報告書流水號_tb.text,Global.報告書選項2,Global.報告書物料明細流水號,Global.報告書物料料號);
- //SQL_Comm.SQL_報告書_讀取施工備註(報告書流水號_tb.text,Global.報告書選項2,Global.報告書施工狀態,Global.報告書物料明細流水號,Global.報告書物料料號,文件號);
- if(SQL_Module.dr.Read()){
- 備註=SQL_Module.dr[0].ToString();
- }
- 備註_tb.text=備註;
- }
- public void 備註存檔(){
-
- //string 文件號 = 施作圖片相片文件號_tb.text;
- SQL_Comm.SQL_報告書_寫入施工備註2(報告書流水號_tb.text,Global.報告書選項2,Global.報告書物料明細流水號,Global.報告書物料料號,備註_tb.text);
- //SQL_Comm.SQL_報告書_寫入施工備註(報告書流水號_tb.text,Global.報告書選項2,Global.報告書施工狀態,Global.報告書物料明細流水號,Global.報告書物料料號,文件號,備註_tb.text);
-
- 備註_pl.SetActive (false);
- }
- public void 發送通知(){
- sql_line.LIN訊息通知("CC215","WS-系統通知(主管)",報告書流水號_tb.text,"");
- //sql_line.LIN訊息通知("CC215","王詩文",報告書流水號_tb.text,"");
- 彈跳_pl.SetActive(true);彈跳文字_tb.text="已發送通知!";Global.彈跳判斷="發送通知";
- }
- public void 新增項目(){
- if(新增項目_pl.activeInHierarchy ){
- 新增項目_pl.SetActive(false);報告書圖片_pl.SetActive(true);
- }else{
- if(報告書流水號_tb.text==""||Global.報告書文件號==""){
- 彈跳_pl.SetActive(true);
- 彈跳文字_tb.text = "請先選擇文件!";
- Global.彈跳判斷="報告書資料不齊全";
- }else{
- 報告書圖片_pl.SetActive(false);新增項目_pl.SetActive(true);
- 長照類_bt.SetActive(true);身障類_bt.SetActive(true);自費類_bt.SetActive(true);長照類_sv.SetActive(false);回選單_bt.SetActive(false);項目清單2_lb.gameObject.SetActive(false);
- }
- }
- }
- /*public void 長照類_bt_click(){
- 長照類_bt.SetActive(false);身障類_bt.SetActive(false);自費類_bt.SetActive(false);長照類_sv.SetActive(true);項目清單2_lb.gameObject.SetActive(true);回選單_bt.SetActive(true);
- 項目清單2_lb.text="長期照顧類";Set_長照物料清單("長期照顧類","C");
- }
- public void 身障類_bt_click(){
- 長照類_bt.SetActive(false);身障類_bt.SetActive(false);自費類_bt.SetActive(false);長照類_sv.SetActive(true);項目清單2_lb.gameObject.SetActive(true);回選單_bt.SetActive(true);
- 項目清單2_lb.text="身心障礙類";Set_長照物料清單("身心障礙類","D");
- }
- public void 自費類_bt_click(){
- 長照類_bt.SetActive(false);身障類_bt.SetActive(false);自費類_bt.SetActive(false);長照類_sv.SetActive(true);項目清單2_lb.gameObject.SetActive(true);回選單_bt.SetActive(true);
- 項目清單2_lb.text="自費類";Set_長照物料清單("自費類","B");
- }*/
- public void 長照類_bt_click(){
- 長照類_bt.SetActive(false);身障類_bt.SetActive(false);自費類_bt.SetActive(false);返回3_bt.SetActive(false);
- 長照類_核定通知書_bt.SetActive(true);長照類_相關文件_bt.SetActive(true);長照類_評估報告書1_bt.SetActive(true);
- 長照類_評估報告書2_bt.SetActive(true); 返回4_bt.SetActive(true);
- Global.報告書選項1="長照類";
- }
- public void 身障類_bt_click(){
- 長照類_bt.SetActive(false);身障類_bt.SetActive(false);自費類_bt.SetActive(false);返回3_bt.SetActive(false);
- 長照類_核定通知書_bt.SetActive(true);長照類_相關文件_bt.SetActive(true);長照類_評估報告書1_bt.SetActive(true);
- 長照類_評估報告書2_bt.SetActive(true); 返回4_bt.SetActive(true);
- Global.報告書選項1="身障類";
- }
- public void 自費類_bt_click(){
- 長照類_bt.SetActive(false);身障類_bt.SetActive(false);自費類_bt.SetActive(false);返回3_bt.SetActive(false);
- 長照類_案場1_bt.SetActive(true);長照類_案場2_bt.SetActive(true);長照類_案場3_bt.SetActive(true);
- 返回8_bt.SetActive(true);
- Global.報告書選項1="自費類";
- }
- public void 回選單_bt_click(){
- 長照類_bt.SetActive(true);身障類_bt.SetActive(true);自費類_bt.SetActive(true);長照類_sv.SetActive(false);項目清單2_lb.gameObject.SetActive(false);回選單_bt.SetActive(false);
- }
- public void 長照類_相關文件_bt_click(){
- 長照類_核定通知書_bt.SetActive(false);長照類_相關文件_bt.SetActive(false);長照類_評估報告書1_bt.SetActive(false);
- 長照類_評估報告書2_bt.SetActive(false);返回4_bt.SetActive(false);
- 長照類_申請人身分證反面_bt.SetActive(true);長照類_受託人身分證反面_bt.SetActive(true);長照類_所有權人身分證反面_bt.SetActive(true);
- 長照類_房屋所有權狀_bt.SetActive(true);長照類_土地所有權狀_bt.SetActive(true);長照類_房屋稅籍證明_bt.SetActive(true);長照類_土地稅籍證明_bt.SetActive(true);
- 長照類_房屋稅單_bt.SetActive(true);長照類_土地稅單_bt.SetActive(true);返回5_bt.SetActive(true);拍照1_bt.SetActive(true);刪除1_bt.SetActive(true);
- 存檔1_bt.SetActive(false);報告書文件圖片_pl.SetActive(true);長照類_申請人身心障礙證明_bt.SetActive(true);
- Global.報告書選項2="相關文件";
- }
-
- public void 倍瑞菲_bt_click(){
- string url ="";
- #if UNITY_ANDROID
- url = "https://lin.ee/rSFZlqK";
- #elif UNITY_IPHONE
- url = "https://lin.ee/rSFZlqK";
- #else
- url = "https://lin.ee/rSFZlqK";
- #endif
- Application.OpenURL(url);
- }
- public void 地圖_bt_Click(){
- if(報告書人員資料_地址_tb.text!=""){
- string address = 報告書人員資料_地址_tb.text;
- string url = "https://www.google.com/maps/search/?api=1&query=" + UnityEngine.Networking.UnityWebRequest.EscapeURL(address);
- Application.OpenURL(url);
- }else{
-
- }
- }
- public void 刪除項目(){
- if(Global.報告書物料明細流水號==""){
- 彈跳_pl.SetActive(true);
- 彈跳文字_tb.text = "請先選擇刪除項目!";
- Global.彈跳判斷="報告書資料不齊全";
- }else{
- SQL_Comm.SQL_報告書_明細刪除(Global.報告書物料明細流水號);Global.報告書物料明細流水號="";
- SQL_Comm.SQL_報告書_施工圖檔刪除(報告書流水號_tb.text,Global.報告書文件號,Global.報告書物料料號);
- 載入報告書項目清單(Global.報告書文件號);
- Module.清除控件(報告書施工圖片_ct);
- PhotoScroll.清除currentPage();
- }
- }
- public void 登出(){
- 彈跳_pl.SetActive(true);
- 彈跳文字_tb.text = "確認登出?";
- Global.彈跳判斷="登出";
- }
- public void 彈跳是(){
- if(Global.彈跳判斷=="登出"){
- 彈跳文字_tb.text ="";
- 彈跳_pl.SetActive(false);
- if(PlayerPrefs.HasKey("帳號")){
- PlayerPrefs.DeleteKey("帳號");
- }
- if(PlayerPrefs.HasKey("密碼")){
- PlayerPrefs.DeleteKey("密碼");
- }
- change_Secen(0);
- }else if(Global.彈跳判斷=="新增報告書"){
- 彈跳文字_tb.text ="";
- 彈跳_pl.SetActive(false);
- }else if(Global.彈跳判斷=="文件號刪除照片"){
- SQL_Comm.SQL_報告書_刪除報告書圖檔(報告書流水號_tb.text,Global.報告書文件號);
- SQL_Comm.SQL_報告書_刪除報告書明細(報告書流水號_tb.text,Global.報告書文件號,Global.報告書物料料號);
- SQL_Comm.SQL_報告書_刪除報告書施工圖檔(報告書流水號_tb.text,Global.報告書文件號,Global.報告書物料料號);
- 彈跳文字_tb.text ="刪除完畢";
- Global.彈跳判斷="文件號照片刪除完成";
- }else if(Global.彈跳判斷=="文件號照片刪除完成"){
- Module.清除控件(報告書施工圖片_ct);
- 載入報告書詳細資料(報告書流水號_tb.text);
- 彈跳文字_tb.text ="";
- 彈跳_pl.SetActive(false);
- }else if(Global.彈跳判斷=="施工刪除照片"){
- SQL_Comm.SQL_報告書_刪除報告書施工圖檔照片(報告書流水號_tb.text,Global.報告書文件號,Global.報告書施工狀態,Global.報告書物料明細流水號,Global.報告書物料料號,Global.報告書施工圖檔文件號);
- 彈跳文字_tb.text ="刪除完畢";
- Global.彈跳判斷="施工照片刪除完成";
- }else if(Global.彈跳判斷=="施工照片刪除完成"){
- 載入施工圖片();
- 彈跳文字_tb.text ="";
- 彈跳_pl.SetActive(false);
- }else{
- 彈跳文字_tb.text ="";
- 彈跳_pl.SetActive(false);
- }
- }
- public void 彈跳否(){
- 彈跳文字_tb.text ="";
- 彈跳_pl.SetActive(false);
- }
- IEnumerator AnimateText(){
- string qqq = 圖片讀取_tb.text.ToString();
- while (true){
- yield return new WaitForSeconds(0.5f);
- if (dotCount < 3){
- loadingText += ".";
- dotCount++;
- }else{
- loadingText = "";
- dotCount = 0;
- }
- 圖片讀取_tb.text = qqq+loadingText;
- }
- }
- string GetChineseDayOfWeek(DayOfWeek dayOfWeek){
- return dayOfWeek switch{
- DayOfWeek.Sunday => "星期日",
- DayOfWeek.Monday => "星期一",
- DayOfWeek.Tuesday => "星期二",
- DayOfWeek.Wednesday => "星期三",
- DayOfWeek.Thursday => "星期四",
- DayOfWeek.Friday => "星期五",
- DayOfWeek.Saturday => "星期六",
- _ => "",
- };
- }
- public static class Global{
- public static string 版本號 ="1.0.9",版本號比對,gUser區域,gUserName,gUser加盟商編號,DTP1,資料庫IP;
- public static string 使用者UID, 使用者暱稱, 使用者ID,螢幕格式,螢幕方向,彈跳判斷,圖檔資料庫,報告書文件號="",報告書物料料號="",輸入物料料號="",報告書物料明細流水號="",
- 報告書施工狀態="文件號",報告書施工圖檔文件號="",報告書選項1="",報告書選項2="",報告書選項3="";
- public static bool 鏡頭啟動,主頁新增;
- public static int camfps,系統主題=1;
- public static float rate , rate_ ,登入條件, 固高, 固寬, 固比, 固比1;
- public static string PA, PB, PC, PD, PE, PF, PG, PH, PI, PJ, PK, PA1, PA2, PA3, PA4, PA5, PA6, PA7, PA8, PA9, PA10;
- public static string[,] PHP = new string[5,2];
- public static GameObject 複製體1,複製體2,複製體3,複製體4;
- public static DataTable 報告書清單_tabel,報告書項目清單_tabel,客戶清單_tabel,長照物料清單_tabel,報告書施工圖片_table,文件號清單_table,報告書人員清單_tabel,
- 報告書相關文件_table,報告書評估報告書1清單_tabel,報告書評估報告書2清單_tabel,報告書施作圖片_table,報告書案場1清單_tabel,報告書案場2清單_tabel,報告書案場3清單_tabel;
- }
-
-
- public static void change_Secen(int _screenNum){
- SceneManager.LoadScene(_screenNum);
- }
-
- }
|