123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.SceneManagement;
- using UnityEngine.UI;
- using UnityEngine.Networking;
- using UnityEngine.EventSystems;
- using System.Text.RegularExpressions;
- using System.Data.SqlClient;
- using System.Runtime.InteropServices;
- using System.Text;
- using TMPro;
- using System;
- using System.IO;
- using ZXing;
- using ZXing.QrCode;
- using System.Net;
- using System.Data;
- using SimpleJSON;
- using System.Linq;
-
-
- public class 採購 : MonoBehaviour
- {
- [SerializeField] GameObject 畫面一;
- [SerializeField] GameObject 畫面二;
- [SerializeField] GameObject 彈出面板;
- [SerializeField] TextMeshProUGUI 備註s;
-
- [SerializeField] GameObject 語言選擇面板;
- [SerializeField] GameObject 供應商資訊;
- [SerializeField] TextMeshProUGUI 選擇語言;
- [SerializeField] TextMeshProUGUI 中;
- [SerializeField] TextMeshProUGUI 英;
- [SerializeField] TextMeshProUGUI 印;
- [SerializeField] TextMeshProUGUI 簡;
- [SerializeField] Button 中按鈕;
- [SerializeField] Button 英按鈕;
- [SerializeField] Button 印按鈕;
- [SerializeField] Button 簡按鈕;
-
-
- [SerializeField] TextMeshProUGUI 選擇公司單號;
- [SerializeField] TextMeshProUGUI 合約編號;
- [SerializeField] TextMeshProUGUI 選擇公司;
- [SerializeField] TextMeshProUGUI 需求日期;
- [SerializeField] TextMeshProUGUI 使用地點;
- [SerializeField] TextMeshProUGUI 總金額;
- [SerializeField] TextMeshProUGUI 電話;
- [SerializeField] TextMeshProUGUI 傳真;
- [SerializeField] TextMeshProUGUI 郵件;
- [SerializeField] TextMeshProUGUI 地址;
- [SerializeField] TextMeshProUGUI 項次;
- [SerializeField] TextMeshProUGUI 合約號;
- [SerializeField] TextMeshProUGUI 品名;
- [SerializeField] TextMeshProUGUI 規格;
- [SerializeField] TextMeshProUGUI 數量;
- [SerializeField] TextMeshProUGUI 單價;
- [SerializeField] TextMeshProUGUI 圖片;
- [SerializeField] TextMeshProUGUI 備註;
-
-
- [SerializeField] TextMeshProUGUI 選擇公司s;
- [SerializeField] TextMeshProUGUI 需求日期s;
- [SerializeField] TextMeshProUGUI 使用地點s;
- [SerializeField] TextMeshProUGUI 供應商s;
- [SerializeField] TextMeshProUGUI 折扣s;
- [SerializeField] TextMeshProUGUI 折扣ss;
- [SerializeField] TextMeshProUGUI PPNs;
- [SerializeField] TextMeshProUGUI PPNss;
- [SerializeField] TextMeshProUGUI 總金額s;
- [SerializeField] TextMeshProUGUI 電話s;
- [SerializeField] TextMeshProUGUI 傳真s;
- [SerializeField] TextMeshProUGUI 郵件s;
- [SerializeField] TextMeshProUGUI 地址s;
-
-
-
- public GameObject buttonPrefab;
- public Transform buttonParent;
- public GameObject buttonceneter;
-
- public GameObject buttonPrefab1;
- public Transform buttonParent1;
- public GameObject buttonceneter1;
-
- private List<GameObject> copy = new List<GameObject>();
- private List<GameObject> copy1 = new List<GameObject>();
- private TextMeshProUGUI[] texts1;
-
- public Sprite 沒圖;
- private Button[] bts;
- public CanvasScaler canvasScaler;
- public float idleTime = 300f; // 5分鐘的閒置時間
- private float timeSinceLastInteraction = 0f;
-
-
- private float timer = 0f;
- private float interval = 60f;
-
- [SerializeField] GameObject 讀取面板;
- [SerializeField] TextMeshProUGUI 讀取;
- private string loadingText = "";
- private int dotCount = 0;
-
- [SerializeField] GameObject 網頁面板;
- UniWebView webView;
- public GameObject panel;
- float scale = 0;
- float xbar = 0;
- float ybar = 0;
- RectTransform panelRectTransform;
- // Start is called before the first frame update
- void Start()
- {
- Main.Global.qwe=true;
- Screen.autorotateToPortrait = false;
- Screen.orientation = ScreenOrientation.LandscapeLeft;
-
- float screenWidth = Screen.width;
- float screenHeight = Screen.height;
- float rate = screenWidth/screenHeight;
- if (canvasScaler == null)
- {
- canvasScaler = GetComponent<CanvasScaler>();
- }
- if (rate>1.6)
- {
- canvasScaler.matchWidthOrHeight = 1f;
- }
- else
- {
- canvasScaler.matchWidthOrHeight = 0f;
- }
- if (canvasScaler.matchWidthOrHeight == 0f)
- {
- scale = screenWidth / 1600;
- xbar=0;
- ybar=(screenHeight-(1000*scale))/2;
- }
- else
- {
- scale = screenHeight/ 1000;
- xbar=(screenWidth-(1600*scale))/2;
- ybar=0;
- }
-
- panelRectTransform = panel.GetComponent<RectTransform>();
- //初始化系統語言();
- //Main.Global.系統語言="繁體中文";
- StartCoroutine(判斷更新());
- StartCoroutine(AnimateText());
- 網頁(panelRectTransform, scale, xbar, ybar);
- 系統語言轉換();
- 語言選擇按鈕();
- //Main.Global.阿帕契路徑="http://106.1.48.106:8080/wp-content/themes/event-star/tab.php?";
- //Main.Global.阿帕契路徑="http://103.231.201.230/hxpgsweb/wp-content/themes/twentytwentyone/tab.php?";
- //Main.Global.預設伺服器路徑="tw";
- }
- IEnumerator AnimateText()
- {
- string qqq = 讀取.text.ToString();
- while (true)
- {
- yield return new WaitForSeconds(0.5f);
-
- if (dotCount < 3)
- {
- loadingText += ".";
- dotCount++;
- }
- else
- {
- loadingText = "";
- dotCount = 0;
- }
-
- 讀取.text = qqq+loadingText;
- }
- }
- public void PGS清單()
- {
- 選擇公司s.text="PT PUNCAK GEMILANG SEMESTA";
- if (copy != null)
- {
- DeletetextCopy();
- }
- 讀取面板.SetActive(true);
- StartCoroutine(採購單核准清單1());
- }
- public void HXI清單()
- {
- 選擇公司s.text="PT HONG XHE INDUSTRIAL";
- if (copy != null)
- {
- DeletetextCopy();
- }
- 讀取面板.SetActive(true);
- StartCoroutine(採購單核准清單2());
- }
- IEnumerator 判斷更新()
- {
- string strcon = "更新";
- string strUrl = string.Format(Main.Global.阿帕契路徑+"comm={0}", strcon);
- UnityWebRequest request = UnityWebRequest.Get(strUrl);
- yield return request.SendWebRequest();
- if (request.result == UnityWebRequest.Result.ConnectionError)
- {
- yield break;
- }
- string str = request.downloadHandler.text.ToString();
- Debug.Log(str);
- if (str == "系統更新")
- {
- change_Secen(1);
- }
- }
-
-
- IEnumerator 採購單核准清單1()
- {
- string strcon1 = "採購單核准清單1";
- string se = Main.Global.預設伺服器路徑;
- string strUrl1 = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}", strcon1, se);
- UnityWebRequest request1 = UnityWebRequest.Get(strUrl1);
- yield return request1.SendWebRequest();
- if (request1.result == UnityWebRequest.Result.ConnectionError)
- {
- //Debug.Log(request.error);
- yield break;
- }
- JSONNode json = JSON.Parse(request1.downloadHandler.text);
- Debug.Log(json);
- if (copy != null)
- {
- DeletetextCopy();
- }
- int sum = 0;
- for (int i = 0; i < json.Count; i++)
- {
- GameObject buttonObj = Instantiate(buttonPrefab) as GameObject;
- buttonObj.GetComponent<RectTransform>().anchoredPosition = new Vector2(2, -sum);
- buttonObj.transform.SetParent(buttonParent, false);
- Button newButton = buttonObj.GetComponentInChildren<Button>();
- TextMeshProUGUI text = buttonObj.GetComponentInChildren<TextMeshProUGUI>();
- string name = json[i][0].ToString().Trim('"');
- text.text = name;
- string idname = json[i][1].ToString().Trim('"');
- int index = i;
- newButton.onClick.AddListener(() =>
- {
- 需求日期s.text=json[index][2];
- 使用地點s.text=json[index][3];
- 折扣s.text=json[index][13];
- PPNs.text=json[index][15];
- string qa = json[index][0].ToString().Trim('"');
- Debug.Log(qa);
- StartCoroutine(採購單明細(qa));
- StartCoroutine(供應商資料(idname));
- 畫面一.SetActive(false);
- 畫面二.SetActive(true);
- 讀取面板.SetActive(true);
- });
- sum+=75;
- copy.Add(buttonObj);
- }
- buttonceneter.GetComponent<RectTransform>().sizeDelta = new Vector2(buttonceneter.GetComponent<RectTransform>().sizeDelta.x, sum);
- 讀取面板.SetActive(false);
- }
- IEnumerator 採購單核准清單2()
- {
- string strcon1 = "採購單核准清單2";
- string se = Main.Global.預設伺服器路徑;
- string strUrl1 = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}", strcon1, se);
- UnityWebRequest request1 = UnityWebRequest.Get(strUrl1);
- yield return request1.SendWebRequest();
- if (request1.result == UnityWebRequest.Result.ConnectionError)
- {
- //Debug.Log(request.error);
- yield break;
- }
- JSONNode json = JSON.Parse(request1.downloadHandler.text);
- int sum = 0;
- if (copy != null)
- {
- DeletetextCopy();
- }
- for (int i = 0; i < json.Count; i++)
- {
- GameObject buttonObj = Instantiate(buttonPrefab) as GameObject;
- buttonObj.GetComponent<RectTransform>().anchoredPosition = new Vector2(2, -sum);
- buttonObj.transform.SetParent(buttonParent, false);
- Button newButton = buttonObj.GetComponentInChildren<Button>();
- TextMeshProUGUI text = buttonObj.GetComponentInChildren<TextMeshProUGUI>();
- string name = json[i][0].ToString().Trim('"');
- text.text = name;
- string idname = json[i][1].ToString().Trim('"');
- int index = i;
- newButton.onClick.AddListener(() =>
- {
- 需求日期s.text=json[index][2];
- 使用地點s.text=json[index][3];
- 折扣s.text=json[index][13];
- PPNs.text=json[index][15];
- string qa = json[index][0].ToString().Trim('"');
- Debug.Log(qa);
- StartCoroutine(採購單明細(qa));
- StartCoroutine(供應商資料(idname));
- 畫面一.SetActive(false);
- 畫面二.SetActive(true);
- 讀取面板.SetActive(true);
- });
- sum+=75;
- copy.Add(buttonObj);
- }
- buttonceneter.GetComponent<RectTransform>().sizeDelta = new Vector2(buttonceneter.GetComponent<RectTransform>().sizeDelta.x, sum);
- 讀取面板.SetActive(false);
- }
- IEnumerator 採購單明細(string pa)
- {
- string strcon1 = "採購單明細";
- string se = Main.Global.預設伺服器路徑;
- string pa1 = Main.Global.系統語言;
- string strUrl1 = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&PA1={2}&PA2={3}", strcon1, se, pa,pa1);
- UnityWebRequest request1 = UnityWebRequest.Get(strUrl1);
- yield return request1.SendWebRequest();
- if (request1.result == UnityWebRequest.Result.ConnectionError)
- {
- //Debug.Log(request.error);
- yield break;
- }
- JSONNode json = JSON.Parse(request1.downloadHandler.text);
- Debug.Log(json);
- int sum = 0;
- double total = 0;
- for (int i = 0; i < json.Count; i++)
- {
- GameObject buttonObj = Instantiate(buttonPrefab1) as GameObject;
- buttonObj.GetComponent<RectTransform>().anchoredPosition = new Vector2(0, -sum);
- buttonObj.transform.SetParent(buttonParent1, false);
- Button newButton = buttonObj.GetComponentInChildren<Button>();
- texts1 =buttonObj.GetComponentsInChildren<TextMeshProUGUI>();
- if (i<9)
- {
- texts1[0].text="0"+(i+1).ToString();
- }
- else
- {
- texts1[0].text=(i+1).ToString();
- }
- texts1[1].text=json[i][2];
- texts1[2].text=json[i][3];
- texts1[3].text=json[i][4];
- texts1[6].text=json[i][5];
- double amo = double.Parse(json[i][6]);
- int iamo = (int)Math.Round(amo);
- texts1[4].text=iamo.ToString();
- double amo1 = double.Parse(json[i][8]);
- int iamo1 = (int)Math.Round(amo1);
- texts1[5].text=iamo1.ToString("#,##0");
- double amo2 = double.Parse(json[i][9]);
- total+=amo2;
- for (int j = 17; j < 24; j++)
- {
- if (!string.IsNullOrEmpty(json[i][j])) // 判斷第二到第六格是否有資料
- {
- string te = json[i][j].ToString().Trim('"');
- texts1[3].text += "、" + te; // 進行字串拼接
- }
- }
- string asd = json[i][25].ToString().Trim('"');
- string qwe = json[i][26].ToString().Trim('"');
- string path = Application.persistentDataPath + "/image/"+asd +"_"+qwe+".jpg";
- if (File.Exists(path))
- {
- // 讀取圖片
- byte[] bytes = File.ReadAllBytes(path);
- Texture2D texture = new Texture2D(2, 2);
- texture.LoadImage(bytes);
- buttonObj.GetComponentInChildren<RawImage>().texture = texture;
- }
- else
- {
- buttonObj.GetComponentInChildren<RawImage>().texture = 沒圖.texture;
- }
- TextMeshProUGUI fiveText = texts1[6];
- newButton.onClick.AddListener(() =>
- {
- 彈出面板.SetActive(true);
- 備註s.text=fiveText.text;
- });
- sum+=100;
- copy1.Add(buttonObj);
- }
- double cou = double.Parse(折扣s.text);
- double ppn = double.Parse(PPNs.text);
- double cons = cou*total;
- double ppns = 0;
- 折扣ss.text=cons.ToString("#,##0");
- if (PPNs.text !="0")
- {
- if (折扣s.text=="0")
- {
- ppns = total*ppn/100;
- PPNss.text=ppns.ToString("#,##0");
- }
- else
- {
- ppns = (total-cons)*ppn/100;
- PPNss.text=ppns.ToString("#,##0");
- }
- }
- else
- {
- PPNss.text="0";
- }
- total = total - cons + ppns;
- 總金額s.text=total.ToString("#,##0");
- buttonceneter1.GetComponent<RectTransform>().sizeDelta = new Vector2(buttonceneter1.GetComponent<RectTransform>().sizeDelta.x, sum);
- 讀取面板.SetActive(false);
- }
- IEnumerator 供應商資料(string pa)
- {
- string strcon1 = "供應商資料";
- string se = Main.Global.預設伺服器路徑;
- string strUrl1 = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&PA={2}", strcon1, se,pa);
- UnityWebRequest request1 = UnityWebRequest.Get(strUrl1);
- yield return request1.SendWebRequest();
- if (request1.result == UnityWebRequest.Result.ConnectionError)
- {
- //Debug.Log(request.error);
- yield break;
- }
- JSONNode json = JSON.Parse(request1.downloadHandler.text);
- 供應商s.text=json[0];
- 地址s.text=json[1];
- 電話s.text=json[2];
- 傳真s.text=json[3];
- 郵件s.text=json[4];
- }
- public void 網頁(RectTransform panelRectTransform, float scale, float xbar, float ybar)
- {
- var webViewGameObject = new GameObject("UniWebView");
- webView = webViewGameObject.AddComponent<UniWebView>();
- webView.Frame =new Rect(panelRectTransform.anchoredPosition.x*scale+xbar, (-panelRectTransform.anchoredPosition.y*scale)+ybar, panelRectTransform.sizeDelta.x*scale, panelRectTransform.sizeDelta.y*scale);
- if (Main.Global.系統語言=="繁體中文" || Main.Global.系統語言=="簡體中文")
- {
- webView.Load("https://gcm-smart.com/2023/06/14/hx-pgs-erp-app-13/");
- }
- else
- {
- webView.Load("https://gcm-smart.com/2023/06/14/hx-pgs-erp-app-14/");
- }
- StartCoroutine(說明顯示查詢());
-
- //webView.Show();
- }
- IEnumerator 說明顯示查詢()
- {
- string strcon1 = "說明顯示查詢";
- string se = Main.Global.預設伺服器路徑;
- string pb1 = Main.Global.人員;
- string pb2 = "APP-13-14";
- DateTime currentDate = DateTime.Now;
- int year = currentDate.Year;
- string ys = year.ToString();
- int month = currentDate.Month;
- string ms = "";
- if (month < 10)
- {
- ms = "0"+month.ToString();
- }
- else
- {
- ms = month.ToString();
- }
- string strUrl1 = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&PB1={2}&PB2={3}&PB5={4}&PB6={5}", strcon1, se, pb1, pb2, ys, ms);
- UnityWebRequest request1 = UnityWebRequest.Get(strUrl1);
- yield return request1.SendWebRequest();
- if (request1.result == UnityWebRequest.Result.ConnectionError)
- {
- //Debug.Log(request.error);
- yield break;
- }
- JSONNode json = JSON.Parse(request1.downloadHandler.text);
- int 開啟, 公告;
- bool 是否新增 = false;
- if (json.Count>0)
- {
- float floatValue = float.Parse(json[2].ToString().Trim('"'));
- 開啟 = Mathf.RoundToInt(floatValue);
- float floatValue1 = float.Parse(json[3].ToString().Trim('"'));
- 公告 = Mathf.RoundToInt(floatValue1);
- if (開啟<3)
- {
- 網頁面板.SetActive(true);
- webView.Show();
- 開啟+=1;
- 公告+=1;
- }
- else
- {
- 開啟+=1;
- }
- }
- else
- {
- 網頁面板.SetActive(true);
- webView.Show();
- 開啟 = 1;
- 公告 = 1;
- 是否新增 = true;
- }
-
- if (是否新增==true)
- {
- yield return StartCoroutine(說明顯示新增(開啟, 公告));
- }
- else
- {
- yield return StartCoroutine(說明顯示修改(開啟, 公告));
- }
- }
- IEnumerator 說明顯示新增(int a1, int a2)
- {
- string strcon1 = "說明顯示新增";
- string se = Main.Global.預設伺服器路徑;
- string pb1 = Main.Global.人員;
- string pb2 = "APP-13-14";
- string pb3 = a1.ToString();
- string pb4 = a2.ToString();
- DateTime currentDate = DateTime.Now;
- int year = currentDate.Year;
- string ys = year.ToString();
- int month = currentDate.Month;
- string ms = "";
- if (month < 10)
- {
- ms = "0"+month.ToString();
- }
- else
- {
- ms = month.ToString();
- }
- string strUrl1 = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&PB1={2}&PB2={3}&PB3={4}&PB4={5}&PB5={6}&PB6={7}", strcon1, se, pb1, pb2, pb3, pb4, ys, ms);
- UnityWebRequest request1 = UnityWebRequest.Get(strUrl1);
- yield return request1.SendWebRequest();
- if (request1.result == UnityWebRequest.Result.ConnectionError)
- {
- //Debug.Log(request.error);
- yield break;
- }
- }
- IEnumerator 說明顯示修改(int a1, int a2)
- {
- string strcon1 = "說明顯示修改";
- string se = Main.Global.預設伺服器路徑;
- string pb1 = Main.Global.人員;
- string pb2 = "APP-13-14";
- string pb3 = a1.ToString();
- string pb4 = a2.ToString();
- DateTime currentDate = DateTime.Now;
- int year = currentDate.Year;
- string ys = year.ToString();
- int month = currentDate.Month;
- string ms = "";
- if (month < 10)
- {
- ms = "0"+month.ToString();
- }
- else
- {
- ms = month.ToString();
- }
- string strUrl1 = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&PB1={2}&PB2={3}&PB3={4}&PB4={5}&PB5={6}&PB6={7}", strcon1, se, pb1, pb2, pb3, pb4, ys, ms);
- UnityWebRequest request1 = UnityWebRequest.Get(strUrl1);
- yield return request1.SendWebRequest();
- if (request1.result == UnityWebRequest.Result.ConnectionError)
- {
- //Debug.Log(request.error);
- yield break;
- }
- }
- public void 網頁面板關閉()
- {
- 網頁面板.SetActive(false);
- webView.Hide();
- //Destroy(webView);
- }
- public void 網頁面板開啟()
- {
- 網頁面板.SetActive(true);
- webView.Show();
- //Destroy(webView);
- }
- public void DeletetextCopy()
- {
- // 刪除複製出來的物件
- foreach (GameObject i in copy)
- {
- Destroy(i);
- }
- copy.Clear();
- }
- public void DeletetextCopy1()
- {
- // 刪除複製出來的物件
- foreach (GameObject i in copy1)
- {
- Destroy(i);
- }
- copy1.Clear();
- }
- void Update()
- {
- timer += Time.deltaTime;
- // 判斷是否達到時間間隔
- if (timer >= interval)
- {
- StartCoroutine(判斷更新());
- timer = 0f;
- }
- if (Main.Global.快速登入==false)
- {
- if (Input.anyKeyDown)
- {
- timeSinceLastInteraction = 0f;
- }
- else
- {
- timeSinceLastInteraction += Time.deltaTime;
- if (timeSinceLastInteraction > idleTime)
- {
- change_Secen(1);
- }
- }
- }
- }
- public void change_Secen(int _screenNum)
- {
- //Main.Global.判斷是否第一次=true;
- SceneManager.LoadScene(_screenNum);
- }
- public void 彈出面板關閉()
- {
- 備註s.text="";
- 彈出面板.SetActive(false);
- }
- public void 回首頁()
- {
- change_Secen(3);
- }
- public void 上一頁()
- {
- 需求日期s.text="";
- 使用地點s.text="";
- 折扣s.text="";
- 折扣ss.text="";
- PPNs.text="";
- PPNss.text="";
- 總金額s.text="";
- 供應商s.text="";
- 電話s.text="";
- 傳真s.text="";
- 郵件s.text="";
- 地址s.text="";
- if (copy1 != null)
- {
- DeletetextCopy1();
- }
- if (畫面二.activeSelf)
- {
- 畫面一.SetActive(true);
- 畫面二.SetActive(false);
- }
- }
- public void 供應商資訊按鈕()
- {
- 供應商資訊.SetActive(!供應商資訊.activeSelf);
-
- }
- public void setting_中()
- {
- Main.Global.系統語言="繁體中文";
- 系統語言轉換();
- 語言選擇按鈕();
- 語言選擇面板.SetActive(false);
- webView.Load("https://gcm-smart.com/2023/06/14/hx-pgs-erp-app-13/");
- }
- public void setting_簡()
- {
- Main.Global.系統語言="簡體中文";
- 系統語言轉換();
- 語言選擇按鈕();
- 語言選擇面板.SetActive(false);
- webView.Load("https://gcm-smart.com/2023/06/14/hx-pgs-erp-app-13/");
- }
- public void setting_英()
- {
- Main.Global.系統語言="English";
- 系統語言轉換();
- 語言選擇按鈕();
- 語言選擇面板.SetActive(false);
- webView.Load("https://gcm-smart.com/2023/06/14/hx-pgs-erp-app-14/");
-
- }
- public void setting_印()
- {
- Main.Global.系統語言="Indonesian";
- 系統語言轉換();
- 語言選擇按鈕();
- 語言選擇面板.SetActive(false);
- webView.Load("https://gcm-smart.com/2023/06/14/hx-pgs-erp-app-14/");
-
- }
- public void setting_click()
- {
- 語言選擇面板.SetActive(true);
- }
- public void setting_exit()
- {
- 語言選擇面板.SetActive(false);
- }
- public void 語言選擇按鈕()
- {
- if (bts == null)
- {
- if (Main.Global.系統語言=="繁體中文")
- {
- bts = new Button[] { 簡按鈕, 英按鈕, 印按鈕, 中按鈕 };
- }
- else if (Main.Global.系統語言=="簡體中文")
- {
- bts = new Button[] { 中按鈕, 英按鈕, 印按鈕, 簡按鈕 };
- }
- else if (Main.Global.系統語言=="English")
- {
- bts = new Button[] { 中按鈕, 簡按鈕, 印按鈕, 英按鈕 };
- }
- else
- {
- bts = new Button[] { 中按鈕, 簡按鈕, 英按鈕, 印按鈕 };
- }
- }
- else
- {
- for (int j = 0; j < bts.Length; j++)
- {
- bts[j] = null;
- }
- if (Main.Global.系統語言=="繁體中文")
- {
- bts = new Button[] { 簡按鈕, 英按鈕, 印按鈕, 中按鈕 };
- }
- else if (Main.Global.系統語言=="簡體中文")
- {
- bts = new Button[] { 中按鈕, 英按鈕, 印按鈕, 簡按鈕 };
- }
- else if (Main.Global.系統語言=="English")
- {
- bts = new Button[] { 中按鈕, 簡按鈕, 印按鈕, 英按鈕 };
- }
- else
- {
- bts = new Button[] { 中按鈕, 簡按鈕, 英按鈕, 印按鈕 };
- }
-
- }
- for (int i = 0; i < bts.Length; i++)
- {
- RectTransform rectTransform = bts[i].GetComponent<RectTransform>();
- if (i==3)
- {
- rectTransform.anchoredPosition = new Vector2(1200, 1200);
- }
- else
- {
- rectTransform.anchoredPosition = new Vector2(300*i, 0);
- }
-
- }
- }
- private void 系統語言轉換()
- {
- string 介面 = "H08";
- if (Main.Global.系統語言=="繁體中文")
- {
- 中.text = Main.Global.系統語言字典[介面+"00CH"];
- 英.text = Main.Global.系統語言字典[介面+"01CH"];
- 印.text = Main.Global.系統語言字典[介面+"02CH"];
- 簡.text = Main.Global.系統語言字典[介面+"04CH"];
- 選擇語言.text = Main.Global.系統語言字典[介面+"03CH"];
- 選擇公司單號.text = Main.Global.系統語言字典[介面+"05CH"];
- 合約編號.text = Main.Global.系統語言字典[介面+"06CH"];
- 選擇公司.text = Main.Global.系統語言字典[介面+"07CH"];
- 需求日期.text = Main.Global.系統語言字典[介面+"08CH"];
- 使用地點.text = Main.Global.系統語言字典[介面+"10CH"];
- 總金額.text = Main.Global.系統語言字典[介面+"11CH"];
- 電話.text = Main.Global.系統語言字典[介面+"12CH"];
- 傳真.text = Main.Global.系統語言字典[介面+"13CH"];
- 郵件.text = Main.Global.系統語言字典[介面+"14CH"];
- 地址.text = Main.Global.系統語言字典[介面+"15CH"];
- 項次.text = Main.Global.系統語言字典[介面+"17CH"];
- 合約號.text = Main.Global.系統語言字典[介面+"23CH"];
- 品名.text = Main.Global.系統語言字典[介面+"18CH"];
- 規格.text = Main.Global.系統語言字典[介面+"19CH"];
- 數量.text = Main.Global.系統語言字典[介面+"20CH"];
- 單價.text = Main.Global.系統語言字典[介面+"21CH"];
- 圖片.text = Main.Global.系統語言字典[介面+"22CH"];
- 備註.text = Main.Global.系統語言字典[介面+"16CH"];
- }
- else if (Main.Global.系統語言=="簡體中文")
- {
- 中.text = Main.Global.系統語言字典[介面+"00CS"];
- 英.text = Main.Global.系統語言字典[介面+"01CS"];
- 印.text = Main.Global.系統語言字典[介面+"02CS"];
- 簡.text = Main.Global.系統語言字典[介面+"04CS"];
- 選擇語言.text = Main.Global.系統語言字典[介面+"03CS"];
- 選擇公司單號.text = Main.Global.系統語言字典[介面+"05CS"];
- 合約編號.text = Main.Global.系統語言字典[介面+"06CS"];
- 選擇公司.text = Main.Global.系統語言字典[介面+"07CS"];
- 需求日期.text = Main.Global.系統語言字典[介面+"08CS"];
- 使用地點.text = Main.Global.系統語言字典[介面+"10CS"];
- 總金額.text = Main.Global.系統語言字典[介面+"11CS"];
- 電話.text = Main.Global.系統語言字典[介面+"12CS"];
- 傳真.text = Main.Global.系統語言字典[介面+"13CS"];
- 郵件.text = Main.Global.系統語言字典[介面+"14CS"];
- 地址.text = Main.Global.系統語言字典[介面+"15CS"];
- 項次.text = Main.Global.系統語言字典[介面+"17CS"];
- 合約號.text = Main.Global.系統語言字典[介面+"23CS"];
- 品名.text = Main.Global.系統語言字典[介面+"18CS"];
- 規格.text = Main.Global.系統語言字典[介面+"19CS"];
- 數量.text = Main.Global.系統語言字典[介面+"20CS"];
- 單價.text = Main.Global.系統語言字典[介面+"21CS"];
- 圖片.text = Main.Global.系統語言字典[介面+"22CS"];
- 備註.text = Main.Global.系統語言字典[介面+"16CS"];
-
- }
- else if (Main.Global.系統語言=="English")
- {
- 中.text = Main.Global.系統語言字典[介面+"00EN"];
- 英.text = Main.Global.系統語言字典[介面+"01EN"];
- 印.text = Main.Global.系統語言字典[介面+"02EN"];
- 簡.text = Main.Global.系統語言字典[介面+"04EN"];
- 選擇語言.text = Main.Global.系統語言字典[介面+"03EN"];
- 選擇公司單號.text = Main.Global.系統語言字典[介面+"05EN"];
- 合約編號.text = Main.Global.系統語言字典[介面+"06EN"];
- 選擇公司.text = Main.Global.系統語言字典[介面+"07EN"];
- 需求日期.text = Main.Global.系統語言字典[介面+"08EN"];
- 使用地點.text = Main.Global.系統語言字典[介面+"10EN"];
- 總金額.text = Main.Global.系統語言字典[介面+"11EN"];
- 電話.text = Main.Global.系統語言字典[介面+"12EN"];
- 傳真.text = Main.Global.系統語言字典[介面+"13EN"];
- 郵件.text = Main.Global.系統語言字典[介面+"14EN"];
- 地址.text = Main.Global.系統語言字典[介面+"15EN"];
- 項次.text = Main.Global.系統語言字典[介面+"17EN"];
- 合約號.text = Main.Global.系統語言字典[介面+"23EN"];
- 品名.text = Main.Global.系統語言字典[介面+"18EN"];
- 規格.text = Main.Global.系統語言字典[介面+"19EN"];
- 數量.text = Main.Global.系統語言字典[介面+"20EN"];
- 單價.text = Main.Global.系統語言字典[介面+"21EN"];
- 圖片.text = Main.Global.系統語言字典[介面+"22EN"];
- 備註.text = Main.Global.系統語言字典[介面+"16EN"];
-
- }
- else
- {
- 中.text = Main.Global.系統語言字典[介面+"00ID"];
- 英.text = Main.Global.系統語言字典[介面+"01ID"];
- 印.text = Main.Global.系統語言字典[介面+"02ID"];
- 簡.text = Main.Global.系統語言字典[介面+"04ID"];
- 選擇語言.text = Main.Global.系統語言字典[介面+"03ID"];
- 選擇公司單號.text = Main.Global.系統語言字典[介面+"05ID"];
- 合約編號.text = Main.Global.系統語言字典[介面+"06ID"];
- 選擇公司.text = Main.Global.系統語言字典[介面+"07ID"];
- 需求日期.text = Main.Global.系統語言字典[介面+"08ID"];
- 使用地點.text = Main.Global.系統語言字典[介面+"10ID"];
- 總金額.text = Main.Global.系統語言字典[介面+"11ID"];
- 電話.text = Main.Global.系統語言字典[介面+"12ID"];
- 傳真.text = Main.Global.系統語言字典[介面+"13ID"];
- 郵件.text = Main.Global.系統語言字典[介面+"14ID"];
- 地址.text = Main.Global.系統語言字典[介面+"15ID"];
- 項次.text = Main.Global.系統語言字典[介面+"17ID"];
- 合約號.text = Main.Global.系統語言字典[介面+"23ID"];
- 品名.text = Main.Global.系統語言字典[介面+"18ID"];
- 規格.text = Main.Global.系統語言字典[介面+"19ID"];
- 數量.text = Main.Global.系統語言字典[介面+"20ID"];
- 單價.text = Main.Global.系統語言字典[介面+"21ID"];
- 圖片.text = Main.Global.系統語言字典[介面+"22ID"];
- 備註.text = Main.Global.系統語言字典[介面+"16ID"];
-
- }
- }
- private void 初始化系統語言()
- {
- TextAsset txt = Resources.Load("Tran") as TextAsset;
- Main.Global.系統語言資料=txt.text.Split('\n');
- for (int i = 1; i<=Main.Global.系統語言資料.Length; i++)
- {
- try
- {
- string key = Main.Global.系統語言資料[i].ToString().Substring(0, 3)+Main.Global.系統語言資料[i].ToString().Substring(4, 2)+Main.Global.系統語言資料[i].ToString().Substring(7, 2);
- Main.Global.系統語言字典.Add(key, Main.Global.系統語言資料[i].ToString().Substring(10));
- }
- catch
- {
- // Debug.Log("No data");
- }
-
- }
- }
- }
|