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