12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213 |
- 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;
- using System.Linq;
-
- 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,彈跳是_bt,彈跳否_bt;
- [SerializeField] Image 施工前_img,施工後_img,產品序號_img,文件圖片_img,施作圖片_img;
- [SerializeField] TMP_InputField 輸入扶手總長_tb,扶手長度_tb,備註_tb,報告書查詢1_tb,報告書新增申請人_tb,報告書新增住址_tb,報告書新增電話_tb,報告書新增聯繫人_tb,
- 報告書新增聯繫人電話_tb,報告書新增聯繫人2_tb,報告書新增聯繫人2電話_tb,施作_tb;
- [SerializeField] RawImage 拍照用,放圖用,更換照片放圖用,更換照片拍照用,文件圖片_rawimage,施作圖片_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 SQL_LINE sql_line;
- public CanvasScaler canvasScaler;
- float screenWidth,screenHeight;
- private string loadingText = "";
- private string 目前階段 = "",目前階段2="";
- private Texture2D currentTexture;
- private int dotCount = 0;
- void Start(){
- Screen.autorotateToPortrait = false;
- Screen.orientation = ScreenOrientation.Portrait;
- screenWidth = Screen.width;
- screenHeight = Screen.height;
- float rate = 900.0f / 1900.0f;
- if (canvasScaler == null)
- {
- canvasScaler = GetComponent<CanvasScaler>();
- }
- if (Screen.width<Screen.height)
- {
- Main.Global.rate = screenWidth/screenHeight;
- Main.Global.rate_ = 1/Main.Global.rate;
- if (Main.Global.rate>rate)
- {
- canvasScaler.matchWidthOrHeight = 1f;
- }
- else
- {
- canvasScaler.matchWidthOrHeight = 0f;
- }
- }
- else
- {
- Main.Global.rate_ = screenWidth/screenHeight;
- Main.Global.rate = 1/Main.Global.rate_;
- if (Main.Global.rate>rate)
- {
- canvasScaler.matchWidthOrHeight = 1f;
- }
- else
- {
- canvasScaler.matchWidthOrHeight = 0f;
- }
- }
- 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,"","","","");
- 報告書人員清單_年份_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 報告書新增報告書(){
- 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);
- }
- private Texture2D 鏡像圖片(Texture2D original){
- Texture2D flipped = new(original.width, original.height);
- for (int y = 0; y < original.height; y++){
- flipped.SetPixels(0, y, original.width, 1, original.GetPixels(0, original.height - 1, original.width, 1));
- }
- flipped.Apply();
- return flipped;
- }
- public void 拍照2(string 階段){
- if (拍照用.gameObject.activeSelf && !放圖用.gameObject.activeSelf){
- Texture2D photo = new Texture2D(myCam.width, myCam.height);
- photo.SetPixels(myCam.GetPixels());
- photo.Apply();
- Texture2D 上傳圖 = RotateTexture(photo, true);
- Texture2D 鏡像後 = 鏡像圖片(photo);
- 放圖用.rectTransform.sizeDelta = new Vector2(720f, 1280f);
- 放圖用.texture = 鏡像後;
- byte[] imageBytes = 上傳圖.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.報告書施工狀態,施作圖片圖片讀取_pl);
- }else{
- 載入圖片清單(階段,報告書文件圖片讀取_pl);
- }
-
- }
- public void Set_報告書人員清單年份刷新(){
- Set_報告書人員清單("");
- }
- private void 載入圖片清單(string 階段,GameObject 圖片讀取){
- 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();
- 圖片讀取.SetActive(true);
- 載入報告書圖片2(階段);
- 圖片讀取.SetActive(false);
- }else{
- 相關文件相片目前_tb.text="-";相關文件相片總數_tb.text="-";文件圖片相片文件號_tb.text="文件號";
- 文件圖片_img.sprite = null;
- }
-
- Global.報告書相關文件_table = ds1.Tables[0];
-
- }
- }
- private void 載入報告書圖片2(string 階段){
- SQL_Comm.SQL_報告書_相關文件讀取圖片(報告書項目清單_報告書號_tb.text,階段,文件圖片相片文件號_tb.text);
- if (SQL_Module.dr.Read() && !SQL_Module.dr.IsDBNull(0)){
- byte[] imageData = (byte[])SQL_Module.dr["圖片"];
- Sprite sp = ByteArrayToSprite(imageData);
- 文件圖片_img.sprite =sp;
- 文件圖片_img.preserveAspect = true;
- 文件圖片_img.SetNativeSize();
- 限制圖片不超過Panel範圍();
- }
- }
- private void 限制圖片不超過Panel範圍(){
- RectTransform imageRT = 文件圖片_img.GetComponent<RectTransform>();
- RectTransform panelRT = 文件圖片_img.transform.parent.GetComponent<RectTransform>();
-
- float panelWidth = panelRT.rect.width;
- float panelHeight = panelRT.rect.height;
-
- float imageWidth = imageRT.rect.width;
- float imageHeight = imageRT.rect.height;
-
- float widthRatio = panelWidth / imageWidth;
- float heightRatio = panelHeight / imageHeight;
- float minRatio = Mathf.Min(widthRatio, heightRatio, 1f); // 不放大,只縮小
-
- imageRT.sizeDelta = new Vector2(imageWidth * minRatio, imageHeight * minRatio);
- imageRT.anchoredPosition = Vector2.zero; // 置中
- }
- public void 下一張圖片(){
- int currentIndex = int.Parse(相關文件相片目前_tb.text);
- int total = Global.報告書相關文件_table.Rows.Count;
- if (currentIndex < total){
- currentIndex++;
- 相關文件相片目前_tb.text = currentIndex.ToString();
- 文件圖片相片文件號_tb.text = Global.報告書相關文件_table.Rows[currentIndex - 1][0].ToString();
- 載入報告書圖片2(目前階段);
- }else{
-
- }
- }
- public void 上一張圖片(){
- int currentIndex = int.Parse(相關文件相片目前_tb.text);
- if (currentIndex > 1){
- currentIndex--;
- 相關文件相片目前_tb.text = currentIndex.ToString();
- 文件圖片相片文件號_tb.text = Global.報告書相關文件_table.Rows[currentIndex - 1][0].ToString();
- 載入報告書圖片2(目前階段);
- }else{
-
- }
- }
- private Sprite ByteArrayToSprite(byte[] imageData) {
- if (currentTexture != null) Destroy(currentTexture);
- currentTexture = new Texture2D(2, 2);
- if (imageData != null && currentTexture.LoadImage(imageData)){
- Rect rect = new Rect(0, 0, currentTexture.width, currentTexture.height);
- return Sprite.Create(currentTexture, rect, new Vector2(0.5f, 0.5f));
- }
- return null;
- }
- 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 = 階段;
- 更新按鈕顏色(階段);
- 載入圖片清單(階段,報告書文件圖片讀取_pl);
- }
- public void 新增報告書_bt_Click(string 階段){
- Global.報告書選項3 = 階段;
- 載入圖片清單(階段,報告書文件圖片讀取_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";
- }
- 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);
- 施作圖片_img.sprite =null;
- }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);
- 施作圖片_img.sprite =null;
- }
-
- }
- 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" || Global.報告書選項2=="評估報告書2" || Global.報告書選項2=="案場1" || Global.報告書選項2=="案場2" || Global.報告書選項2=="案場3"){
- 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.報告書施工狀態,施作圖片圖片讀取_pl);
- }
- }else if(Global.報告書選項2=="核定通知書"){
- string 文件號 = 文件圖片相片文件號_tb.text;
- SQL_Comm.SQL_報告書_刪除報告書相關文件圖檔照片(報告書流水號_tb.text,Global.報告書選項2,文件號);
- 載入圖片清單(Global.報告書選項2,報告書文件圖片讀取_pl);
- }else{
- string 文件號 = 文件圖片相片文件號_tb.text;
- SQL_Comm.SQL_報告書_刪除報告書相關文件圖檔照片(報告書流水號_tb.text,Global.報告書選項3,文件號);
- 載入圖片清單(Global.報告書選項3,報告書文件圖片讀取_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);
- 拍照1_bt.SetActive(true);報告書文件圖片_pl.SetActive(true);
- RectTransform rt = 報告書文件圖片_pl.GetComponent<RectTransform>();
- rt.offsetMax = new Vector2(rt.offsetMax.x, -114f);
- Global.報告書選項2="核定通知書";
- 限制圖片不超過Panel範圍();
- 載入圖片清單(Global.報告書選項2,報告書文件圖片讀取_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);
- 限制圖片不超過Panel範圍2();施作圖片_img.sprite =null;
- 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);
- 限制圖片不超過Panel範圍2();施作圖片_img.sprite =null;
- 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 階段,GameObject 圖片讀取){
- 圖片讀取.SetActive(true);
- 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);
- 目前階段2 = 階段;
- 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();
- 圖片讀取.SetActive(true);
- 載入報告書圖片3(階段);
- 圖片讀取.SetActive(false);
- }else{
- 施作圖片相片目前_tb.text="-";施作圖片相片總數_tb.text="-";施作圖片相片文件號_tb.text ="文件號";
- 施作圖片_img.sprite = null;圖片讀取.SetActive(false);
- }
- Global.報告書施作圖片_table = ds1.Tables[0];
- }
- }
- private void 載入報告書圖片3(string 階段){
- SQL_Comm.SQL_報告書_施作讀取圖片(報告書項目清單_報告書號_tb.text,階段,Global.報告書選項2,Global.報告書物料料號,Global.報告書物料明細流水號,施作圖片相片文件號_tb.text);
- if (SQL_Module.dr.Read() && !SQL_Module.dr.IsDBNull(0)){
- byte[] imageData = (byte[])SQL_Module.dr["圖片"];
- Sprite sp = ByteArrayToSprite(imageData);
- 施作圖片_img.sprite =sp;
- 施作圖片_img.preserveAspect = true;
- 施作圖片_img.SetNativeSize();
- 限制圖片不超過Panel範圍2();
- }
- }
- private void 限制圖片不超過Panel範圍2(){
- RectTransform imageRT = 施作圖片_img.GetComponent<RectTransform>();
- RectTransform panelRT = 施作圖片_img.transform.parent.GetComponent<RectTransform>();
- float panelWidth = panelRT.rect.width;
- float panelHeight = panelRT.rect.height;
- float imageWidth = imageRT.rect.width;
- float imageHeight = imageRT.rect.height;
- float widthRatio = panelWidth / imageWidth;
- float heightRatio = panelHeight / imageHeight;
- float minRatio = Mathf.Min(widthRatio, heightRatio, 1f);
- imageRT.sizeDelta = new Vector2(imageWidth * minRatio, imageHeight * minRatio);
- imageRT.anchoredPosition = Vector2.zero;
- }
- public void 下一張圖片2(){
- int currentIndex = int.Parse(施作圖片相片目前_tb.text);
- int total = Global.報告書施作圖片_table.Rows.Count;
- if (currentIndex < total){
- currentIndex++;
- 施作圖片相片目前_tb.text = currentIndex.ToString();
- 施作圖片相片文件號_tb.text = Global.報告書施作圖片_table.Rows[currentIndex - 1][0].ToString();
- 載入報告書圖片3(目前階段2);
- }else{
-
- }
- }
- public void 上一張圖片2(){
- int currentIndex = int.Parse(施作圖片相片目前_tb.text);
- if (currentIndex > 1){
- currentIndex--;
- 施作圖片相片目前_tb.text = currentIndex.ToString();
- 施作圖片相片文件號_tb.text = Global.報告書施作圖片_table.Rows[currentIndex - 1][0].ToString();
- 載入報告書圖片3(目前階段2);
- }else{
-
- }
- }
- 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);存檔1_bt.SetActive(true);
- 載入圖片清單2(Global.報告書施工狀態,施作圖片圖片讀取_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);存檔1_bt.SetActive(true);
- Global.報告書施工狀態="施工後";
- 載入圖片清單2(Global.報告書施工狀態,施作圖片圖片讀取_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);存檔1_bt.SetActive(true);
- Global.報告書施工狀態="產品序號";
- 載入圖片清單2(Global.報告書施工狀態,施作圖片圖片讀取_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);
- }
- }
-
- 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(true);報告書文件圖片_pl.SetActive(true);長照類_申請人身心障礙證明_bt.SetActive(true);
- Global.報告書選項2="相關文件";
- 限制圖片不超過Panel範圍();
- }
-
- 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{
- 彈跳_pl.SetActive(true);
- 彈跳文字_tb.text = "地址沒有資料不能跳轉!!";
- Global.彈跳判斷 = "地址";
- }
- }
- public void 小工具_bt_Click(){
- Main.change_Secen(3);
- }
- public void 照片存檔_bt_Click(){
- RawImage rawImage ;
- if (施作圖片_pl.activeInHierarchy)
- {
- rawImage = GetCloneRawImage(施作圖片_pl,"施作文件");
- }
- else
- {
- rawImage = GetCloneRawImage(報告書文件圖片_pl,"相關文件");
- }
- if (rawImage.texture == null){
- Debug.LogWarning("RawImage 尚未載入任何圖片,無法儲存");
- return;
- }
- Texture2D tex = null;
- RenderTexture rt = null;
- try
- {
- tex = new Texture2D((int)rawImage.texture.width, (int)rawImage.texture.height, TextureFormat.RGB24, false);
- rt = RenderTexture.GetTemporary(tex.width, tex.height, 0);
- Graphics.Blit(rawImage.texture, rt);
- RenderTexture.active = rt;
- tex.ReadPixels(new Rect(0, 0, tex.width, tex.height), 0, 0);
- tex.Apply();
- }
- finally
- {
- RenderTexture.active = null;
- if (rt != null) RenderTexture.ReleaseTemporary(rt);
- }
- string filename = "RawImage_" + System.DateTime.Now.ToString("yyyyMMdd_HHmmss") + ".png";
- NativeGallery.SaveImageToGallery(tex, Application.productName, filename, (success, path) =>
- {
- if (success)
- {
- 彈跳_pl.SetActive(true);
- 彈跳文字_tb.text = "圖片儲存完成!";
- Global.彈跳判斷 = "圖片儲存";
- 彈跳否_bt.SetActive(false);
- }
- else
- {
- 彈跳_pl.SetActive(true);
- 彈跳文字_tb.text = "圖片未儲存,請檢查權限是否異常!";
- Global.彈跳判斷 = "圖片儲存";
- 彈跳否_bt.SetActive(false);
- }
- });
- }
- RawImage GetCloneRawImage(GameObject 圖片_panel,string 圖片panel){
- TextMeshProUGUI 相片目前_tb = 圖片panel switch{
- "施作文件" => 施作圖片相片目前_tb,
- _ => 相關文件相片目前_tb
- };
-
- // 轉換 index 數值
- if (!int.TryParse(相片目前_tb.text, out int index) || index <= 0){
- Debug.LogWarning($"{圖片panel} 相片目前_tb 不是有效數字");
- return null;
- }
-
- // 過濾所有符合的 RawImage
- var images = 圖片_panel.GetComponentsInChildren<RawImage>(true)
- .Where(r => r.name.Contains("Image(Clone)"))
- .ToList();
-
- if (index > images.Count){
- Debug.LogWarning($"要求第 {index} 張,但只有 {images.Count} 張可選({圖片panel})");
- return null;
- }
-
- return images[index - 1];
- }
- 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);
- 彈跳否_bt.SetActive(true);
- }
- }
- public void 彈跳否(){
- 彈跳文字_tb.text ="";
- 彈跳否_bt.SetActive(true);
- 彈跳_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.16",版本號比對,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);
- }
-
- }
|