123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.SceneManagement;
- using UnityEngine.UI;
- using UnityEngine.Networking;
- using System.Text.RegularExpressions;
- using System.Data.SqlClient;
- using TMPro;
- using System;
- using System.IO;
- using ZXing;
- using ZXing.QrCode;
- using System.Net;
- using SimpleJSON;
- using System.ComponentModel;
- using System.Runtime.InteropServices;
-
- public class 設備檢點表 : MonoBehaviour
- {
- [SerializeField] Button 新增;
- [SerializeField] Button 修改;
- [SerializeField] Button 存檔;
- [SerializeField] Button 刪除;
- [SerializeField] Button 看明細;
- [SerializeField] Button 回首頁;
-
- [SerializeField] TextMeshProUGUI 備註s;
- [SerializeField] TextMeshProUGUI 名稱s;
- [SerializeField] TextMeshProUGUI 上ISO;
- [SerializeField] TextMeshProUGUI 下ISO;
- [SerializeField] TextMeshProUGUI 明細標題;
-
- [SerializeField] GameObject 頁面一;
- [SerializeField] GameObject 頁面二;
- [SerializeField] GameObject 上一頁按鈕;
- public TMP_Dropdown 年;
- public TMP_Dropdown 月;
- public TMP_Dropdown 日;
- public TMP_Dropdown 名稱;
-
- public GameObject buttonPrefab;
- public Transform buttonParent;
- public GameObject buttonceneter;
- private List<GameObject> copy = new List<GameObject>();
- public GameObject buttonPrefab1;
- public Transform buttonParent1;
- public GameObject buttonceneter1;
- private List<GameObject> copy1 = new List<GameObject>();
-
- public GameObject buttonPrefab2;
- public Transform buttonParent2;
- public GameObject buttonceneter2;
- private List<GameObject> copy2 = new List<GameObject>();
-
- public CanvasScaler canvasScaler;
-
- private string loadingText = "";
- private int dotCount = 0;
-
- [SerializeField] GameObject 讀取面板;
- [SerializeField] TextMeshProUGUI 讀取;
-
- [SerializeField] GameObject 彈跳面板;
- [SerializeField] TextMeshProUGUI 彈跳文字;
- JSONArray 點檢表;
- string 控制流水號 = "";
- string 設備流水號 = "";
- string 編輯模式 = "";
- JSONNode 檢點明細;
- // Start is called before the first frame update
- void Start()
- {
- Screen.autorotateToPortrait = false;
- Screen.orientation = ScreenOrientation.LandscapeLeft;
- float rate = 1600.0f / 1000.0f;
- if (Main.Global.rate>rate)
- {
- canvasScaler.matchWidthOrHeight = 1f;
- }
- else
- {
- canvasScaler.matchWidthOrHeight = 0f;
- }
- //Main.Global.阿帕契路徑="http://106.1.48.106:8080/wp-content/themes/event-star/ow_main.php?";
- //Main.Global.預設伺服器路徑="test";
- //Main.Global.人員="李卓叡";
- 讀取面板.SetActive(true);
- StartCoroutine(AnimateText());
- StartCoroutine(表單ISO編碼());
- 頁面一.SetActive(true);
- 頁面二.SetActive(false);
- 上一頁按鈕.SetActive(false);
- 新增.interactable = false;
- 修改.interactable = false;
- 存檔.interactable = false;
- 刪除.interactable = false;
- DateTime currentDate = DateTime.Now;
- int currentIndex = 年.options.FindIndex(option => option.text == currentDate.Year.ToString());
- 年.value = currentIndex;
- string monStr = $"{currentDate.Month:00}";
- int currentIndex1 = 月.options.FindIndex(option => option.text == monStr);
- 月.value = currentIndex1;
- string yearStr = 年.options[年.value].text;
- string monthStr = 月.options[月.value].text;
- if (int.TryParse(yearStr, out int year) && int.TryParse(monthStr, out int month))
- {
- 日期讀取(year, month);
- string dayStr = $"{currentDate.Day:00}";
- int currentIndex2 = 日.options.FindIndex(option => option.text == dayStr);
- 日.value = currentIndex2;
- }
- StartCoroutine(點檢表系統名稱下拉清單());
- 年.onValueChanged.AddListener((value) => OnDropdown1ValueChanged());
- 月.onValueChanged.AddListener((value) => OnDropdown1ValueChanged());
- 日.onValueChanged.AddListener((value) => OnDropdown1ValueChanged());
- }
- public void 日期讀取(int year, int month)
- {
- int daysInMonth = DateTime.DaysInMonth(year, month);
- 日.options.Clear();
- List<TMP_Dropdown.OptionData> options = new List<TMP_Dropdown.OptionData>();
- for (int i = 1; i <= daysInMonth; i++)
- {
- string dayStr = i < 10 ? "0" + i.ToString() : i.ToString();
- options.Add(new TMP_Dropdown.OptionData(dayStr));
- }
- 日.AddOptions(options);
- }
- private void OnDropdown1ValueChanged()
- {
- string yearStr = 年.options[年.value].text;
- string monthStr = 月.options[月.value].text;
- if (int.TryParse(yearStr, out int year) && int.TryParse(monthStr, out int month))
- {
- 日期讀取(year, month);
- 控制流水號 = "";
- 設備流水號 = "";
- 名稱s.text= "";
- 備註s.text="";
- 明細標題.text= "";
- 新增.interactable = false;
- 修改.interactable = false;
- 存檔.interactable = false;
- 刪除.interactable = false;
- if (copy2!= null)
- {
- DeleteCopies(copy2);
- }
- StartCoroutine(點檢表系統名稱清單());
- }
- }
- 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;
- }
- }
- IEnumerator 表單ISO編碼()
- {
- string strcon = "表單ISO編碼";
- string se = Main.Global.預設伺服器路徑;
- string pa = "設備點檢表";
- string strUrl = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&PA={2}", strcon, se,pa);
- UnityWebRequest request = UnityWebRequest.Get(strUrl);
- yield return request.SendWebRequest();
- if (request.result == UnityWebRequest.Result.ConnectionError)
- {
- Debug.Log(request.error);
- yield break;
- }
- JSONNode json = JSON.Parse(request.downloadHandler.text);
- Debug.Log(json);
- 上ISO.text=json[0].ToString().Trim('"');
- 下ISO.text=json[1].ToString().Trim('"');
- }
- IEnumerator 點檢表系統名稱下拉清單()
- {
- string strcon = "點檢表系統名稱下拉清單";
- string se = Main.Global.預設伺服器路徑;
- string strUrl = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}", strcon, se);
- UnityWebRequest request = UnityWebRequest.Get(strUrl);
- yield return request.SendWebRequest();
- if (request.result == UnityWebRequest.Result.ConnectionError)
- {
- Debug.Log(request.error);
- yield break;
- }
- JSONNode json = JSON.Parse(request.downloadHandler.text);
- 名稱.options.Clear();
- List<TMP_Dropdown.OptionData> options = new List<TMP_Dropdown.OptionData>();
- for (int i = 0; i < json.Count; i++)
- {
- string str = json[i].ToString().Trim('"');
- options.Add(new TMP_Dropdown.OptionData(str));
- }
- 名稱.AddOptions(options);
- 名稱.onValueChanged.AddListener((value) => OnDropdown1ValueChanged1());
- yield return StartCoroutine(點檢表系統名稱清單());
- }
- private void OnDropdown1ValueChanged1()
- {
- 控制流水號 = "";
- 設備流水號 = "";
- 名稱s.text= "";
- 備註s.text="";
- 明細標題.text= "";
- 新增.interactable = false;
- 修改.interactable = false;
- 存檔.interactable = false;
- 刪除.interactable = false;
- if (copy2!= null)
- {
- DeleteCopies(copy2);
- }
- StartCoroutine(點檢表系統名稱清單());
- }
- IEnumerator 點檢表系統名稱清單()
- {
- 讀取面板.SetActive(true);
- if (copy!= null)
- {
- DeleteCopies(copy);
- }
- string strcon = "點檢表系統名稱清單";
- string se = Main.Global.預設伺服器路徑;
- string pa = 年.options[年.value].text+"/"+月.options[月.value].text;
- string pa1 = 名稱.options[名稱.value].text;
- string strUrl = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&PA={2}&PA1={3}", strcon, se,pa,pa1);
- UnityWebRequest request = UnityWebRequest.Get(strUrl);
- yield return request.SendWebRequest();
- if (request.result == UnityWebRequest.Result.ConnectionError)
- {
- Debug.Log(request.error);
- yield break;
- }
- JSONNode json = JSON.Parse(request.downloadHandler.text);
-
- int sum = 5;
- GameObject selectedButton = null;
- 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);
- TextMeshProUGUI text = buttonObj.GetComponentInChildren<TextMeshProUGUI>();
- Button bt = buttonObj.GetComponentInChildren<Button>();
- Image[] im = buttonObj.GetComponentsInChildren<Image>();
- int index = i;
- bt.onClick.AddListener(() =>
- {
-
- if (selectedButton != null)
- {
- Image[] prevButtonImages = selectedButton.GetComponentsInChildren<Image>();
- prevButtonImages[1].color = Color.white;
- }
- 控制流水號 = json[index][1].ToString().Trim('"');
- 設備流水號 = json[index][8].ToString().Trim('"');
- 名稱s.text= json[index][4].ToString().Trim('"');
- 備註s.text= json[index][9].ToString().Trim('"');
- string str = json[index][3].ToString().Trim('"');
- 明細標題.text= 年.options[年.value].text+"/"+月.options[月.value].text+str+"設備日常檢點表";
- StartCoroutine(確認是否有明細());
- // 設定當前按鈕為選中狀態
- im[1].color = new Color32(160, 255, 160, 255);
- selectedButton = buttonObj;
- });
- text.text = json[i][4].ToString().Trim('"');
- sum+=75;
- copy.Add(buttonObj);
- }
- buttonceneter.GetComponent<RectTransform>().sizeDelta = new Vector2(buttonceneter.GetComponent<RectTransform>().sizeDelta.x, sum);
- 讀取面板.SetActive(false);
- }
- IEnumerator 檢點項目內容()
- {
- 讀取面板.SetActive(true);
- string strcon = "檢點項目內容";
- string se = Main.Global.預設伺服器路徑;
- string pa = 設備流水號;
- string strUrl = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&PA={2}", strcon, se, pa);
- UnityWebRequest request = UnityWebRequest.Get(strUrl);
- yield return request.SendWebRequest();
- if (request.result == UnityWebRequest.Result.ConnectionError)
- {
- Debug.Log(request.error);
- yield break;
- }
- JSONNode json = JSON.Parse(request.downloadHandler.text);
- 點檢表 = new JSONArray();
- for (int i = 0; i < json.Count; i++)
- {
- JSONNode newValue = new JSONObject();
- newValue["項目"] = json[i][1].ToString().Trim('"');
- for (int j = 1; j < 32; j++)
- {
- newValue[j.ToString("D2")] = "";
- }
- 點檢表.Add(newValue);
- }
- JSONNode lastValue = new JSONObject();
- lastValue["項目"] = "點檢人員";
- for (int j = 1; j < 32; j++)
- {
- lastValue[j.ToString("D2")] = "";
- }
- 點檢表.Add(lastValue);
- yield return StartCoroutine(點檢明細表());
- }
- IEnumerator 點檢明細表()
- {
- string strcon = "點檢明細表";
- string se = Main.Global.預設伺服器路徑;
- string pa = 年.options[年.value].text+"/"+月.options[月.value].text;
- string pa1 = 控制流水號;
- string strUrl = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&PA={2}&PA1={3}", strcon, se, pa, pa1);
- UnityWebRequest request = UnityWebRequest.Get(strUrl);
- yield return request.SendWebRequest();
- if (request.result == UnityWebRequest.Result.ConnectionError)
- {
- Debug.Log(request.error);
- yield break;
- }
- JSONNode json = JSON.Parse(request.downloadHandler.text);
-
- for (int i = 0; i < json.Count; i++)
- {
- string str = json[i][6].ToString().Trim('"');
- for (int j = 0; j < json.Count; j++)
- {
- string str1 = 點檢表[j][0].ToString().Trim('"');
- if (str1 == str)
- {
- string date = json[i][3].ToString().Trim('"');
- string ld = date.Substring(date.Length - 2);
- if (int.TryParse(ld, out int result))
- {
- 點檢表[j][result]=json[i][5].ToString().Trim('"');
- int a = 點檢表.Count - 1;
- 點檢表[a][result]=json[i][4].ToString().Trim('"');
- }
- }
- }
- }
- if (copy1!= null)
- {
- DeleteCopies(copy1);
- }
- int sum = 5;
- for (int i = 0; i < 點檢表.Count; i++)
- {
- GameObject buttonObj = Instantiate(buttonPrefab1) as GameObject;
- buttonObj.GetComponent<RectTransform>().anchoredPosition = new Vector2(2, -sum);
- string str = 點檢表[i][0].ToString().Trim('"');
- if (i == 點檢表.Count-1)
- {
- float xbar = buttonObj.GetComponent<RectTransform>().sizeDelta.x;
- float ybar = buttonObj.GetComponent<RectTransform>().sizeDelta.y*2;
- buttonObj.GetComponent<RectTransform>().sizeDelta=new Vector2(xbar, ybar);
- sum+=75;
- }
- buttonObj.transform.SetParent(buttonParent1, false);
- TextMeshProUGUI[] text = buttonObj.GetComponentsInChildren<TextMeshProUGUI>();
- for (int j = 0; j < text.Length; j++)
- {
- text[j].text = 點檢表[i][j].ToString().Trim('"');
- }
- sum+=75;
- copy1.Add(buttonObj);
- }
- buttonceneter1.GetComponent<RectTransform>().sizeDelta = new Vector2(buttonceneter1.GetComponent<RectTransform>().sizeDelta.x, sum);
- 讀取面板.SetActive(false);
- }
- IEnumerator 確認是否有明細()
- {
- string strcon = "點檢明細表";
- string se = Main.Global.預設伺服器路徑;
- string pa = 年.options[年.value].text+"/"+月.options[月.value].text+"/"+日.options[日.value].text;
- string pa1 = 控制流水號;
- string strUrl = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&PA={2}&PA1={3}", strcon, se, pa, pa1);
- UnityWebRequest request = UnityWebRequest.Get(strUrl);
- yield return request.SendWebRequest();
- if (request.result == UnityWebRequest.Result.ConnectionError)
- {
- Debug.Log(request.error);
- yield break;
- }
- 檢點明細= JSON.Parse(request.downloadHandler.text);
- Debug.Log(檢點明細);
- if (檢點明細.Count>0)
- {
- 修改.interactable = true;
- 新增.interactable = false;
- if (編輯模式 == "新增")
- {
- 修改.interactable = false;
- }
- if (copy2!= null)
- {
- DeleteCopies(copy2);
- }
- int sum = 5;
- for (int i = 0; i < 檢點明細.Count; i++)
- {
- GameObject buttonObj = Instantiate(buttonPrefab2) as GameObject;
- buttonObj.GetComponent<RectTransform>().anchoredPosition = new Vector2(2, -sum);
- buttonObj.transform.SetParent(buttonParent2, false);
- TextMeshProUGUI text = buttonObj.GetComponentInChildren<TextMeshProUGUI>();
- Toggle[] tg = buttonObj.GetComponentsInChildren<Toggle>();
- Button[] bt = buttonObj.GetComponentsInChildren<Button>();
- text.text =檢點明細[i][6].ToString().Trim('"');
- string str = 檢點明細[i][5].ToString().Trim('"');
- int index = i;
- if(str == "V")
- {
- tg[0].isOn =true;
- tg[1].isOn =false;
- }
- else if(str == "X")
- {
- tg[0].isOn =false;
- tg[1].isOn =true;
- }
- else
- {
- tg[0].isOn =false;
- tg[1].isOn =false;
- }
- bt[0].onClick.AddListener(() =>
- {
- if (編輯模式 == "修改" || 編輯模式 == "新增")
- {
- if(tg[0].isOn ==false && tg[1].isOn ==false)
- {
- tg[0].isOn=true;
- tg[1].isOn =false;
- 檢點明細[index][5]="V";
- }
- else if (tg[0].isOn ==false && tg[1].isOn ==true)
- {
- tg[0].isOn=true;
- tg[1].isOn =false;
- 檢點明細[index][5]="V";
- }
- else if (tg[0].isOn ==true && tg[1].isOn ==false)
- {
- tg[0].isOn=false;
- tg[1].isOn =false;
- 檢點明細[index][5]="";
- }
- Debug.Log(檢點明細);
- }
- });
- bt[1].onClick.AddListener(() =>
- {
- if (編輯模式 == "修改" || 編輯模式 == "新增")
- {
- if (tg[0].isOn ==false && tg[1].isOn ==false)
- {
- tg[1].isOn=true;
- tg[0].isOn =false;
- 檢點明細[index][5]="X";
- }
- else if (tg[0].isOn ==true && tg[1].isOn ==false)
- {
- tg[1].isOn=true;
- tg[0].isOn =false;
- 檢點明細[index][5]="X";
- }
- else if (tg[0].isOn ==false && tg[1].isOn ==true)
- {
- tg[0].isOn=false;
- tg[1].isOn =false;
- 檢點明細[index][5]="";
- }
- Debug.Log(檢點明細);
- }
- });
- sum+=75;
- copy2.Add(buttonObj);
- }
- buttonceneter2.GetComponent<RectTransform>().sizeDelta = new Vector2(buttonceneter2.GetComponent<RectTransform>().sizeDelta.x, sum);
- }
- else
- {
- 新增.interactable = true;
- 修改.interactable = false;
- if (copy2!= null)
- {
- DeleteCopies(copy2);
- }
- }
- }
- IEnumerator 查找檢點明細表最後一筆流水號()
- {
- string strcon = "查找檢點明細表最後一筆流水號";
- string se = Main.Global.預設伺服器路徑;
- string strUrl = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}", strcon, se);
- UnityWebRequest request = UnityWebRequest.Get(strUrl);
- yield return request.SendWebRequest();
- if (request.result == UnityWebRequest.Result.ConnectionError)
- {
- Debug.Log(request.error);
- yield break;
- }
- string num = request.downloadHandler.text.ToString();
- string 流水號 = "";
- if (num == "n")
- {
- 流水號 ="IS00000000";
- }
- else
- {
- 流水號 =num;
- }
- yield return StartCoroutine(新增項目內容(流水號));
- }
- IEnumerator 新增項目內容(string 流水號)
- {
- string strcon = "檢點項目內容";
- string se = Main.Global.預設伺服器路徑;
- string pa = 設備流水號;
- string strUrl = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&PA={2}", strcon, se, pa);
- UnityWebRequest request = UnityWebRequest.Get(strUrl);
- yield return request.SendWebRequest();
- if (request.result == UnityWebRequest.Result.ConnectionError)
- {
- Debug.Log(request.error);
- yield break;
- }
- JSONNode json = JSON.Parse(request.downloadHandler.text);
- string cnum = 流水號.Substring(2);
- int inum = int.Parse(cnum);
-
- for (int i = 0; i < json.Count; i++)
- {
- inum+=1;
- string 新流水 = "IS";
- if (inum<10)
- {
- 新流水+="0000000"+inum.ToString();
- }
- if (inum>9 && inum<100)
- {
- 新流水+="000000"+inum.ToString();
- }
- if (inum>99 && inum<1000)
- {
- 新流水+="00000"+inum.ToString();
- }
- if (inum>999 && inum<10000)
- {
- 新流水+="0000"+inum.ToString();
- }
- if (inum>9999 && inum<100000)
- {
- 新流水+="000"+inum.ToString();
- }
- if (inum>99999 && inum<10000000)
- {
- 新流水+="00"+inum.ToString();
- }
- if (inum>999999 && inum<10000000)
- {
- 新流水+="0"+inum.ToString();
- }
- if (inum>9999999 && inum<100000000)
- {
- 新流水+=inum.ToString();
- }
- string str = json[i][0].ToString().Trim('"');
- yield return StartCoroutine(新增檢點明細表(新流水, str));
- }
- yield return StartCoroutine(確認是否有明細());
- }
- IEnumerator 新增檢點明細表(string 流水號, string 項目流水號)
- {
- string strcon = "新增檢點明細表";
- string se = Main.Global.預設伺服器路徑;
- string pa = 流水號;
- string pa1 = 控制流水號;
- string pa2 = 項目流水號;
- string pa3 = 年.options[年.value].text+"/"+月.options[月.value].text+"/"+日.options[日.value].text;
- string pa4 = Main.Global.人員;
- string strUrl = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&PA={2}&PA1={3}&PA2={4}&PA3={5}&PA4={6}",strcon,se,pa,pa1,pa2,pa3,pa4);
- UnityWebRequest request = UnityWebRequest.Get(strUrl);
- yield return request.SendWebRequest();
- if (request.result == UnityWebRequest.Result.ConnectionError)
- {
- Debug.Log(request.error);
- yield break;
- }
- }
- IEnumerator 檢點明細表更新(string 明細流水號, string 狀態)
- {
- string strcon = "檢點明細表更新";
- string se = Main.Global.預設伺服器路徑;
- string pa = 狀態;
- string pa1 = 明細流水號;
- string strUrl = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&PA={2}&PA1={3}", strcon, se, pa, pa1);
- Debug.Log(strUrl);
- UnityWebRequest request = UnityWebRequest.Get(strUrl);
- yield return request.SendWebRequest();
- if (request.result == UnityWebRequest.Result.ConnectionError)
- {
- Debug.Log(request.error);
- yield break;
- }
-
- }
- IEnumerator 檢點明細表刪除()
- {
- string strcon = "檢點明細表刪除";
- string se = Main.Global.預設伺服器路徑;
- string pa = 控制流水號;
- string pa1 = 年.options[年.value].text+"/"+月.options[月.value].text+"/"+日.options[日.value].text;
- string strUrl = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&PA={2}&PA1={3}", strcon, se, pa, pa1);
- Debug.Log(strUrl);
- UnityWebRequest request = UnityWebRequest.Get(strUrl);
- yield return request.SendWebRequest();
- if (request.result == UnityWebRequest.Result.ConnectionError)
- {
- Debug.Log(request.error);
- yield break;
- }
-
- }
- public void 新增s()
- {
- 編輯模式="新增";
- 新增.interactable = false;
- 修改.interactable = false;
- 存檔.interactable = true;
- 刪除.interactable = true;
- 看明細.interactable = false;
- 年.interactable = false;
- 月.interactable = false;
- 日.interactable = false;
- 名稱.interactable = false;
- 回首頁.interactable = false;
- StartCoroutine(查找檢點明細表最後一筆流水號());
- }
- public void 修改s()
- {
- 編輯模式="修改";
- 新增.interactable = false;
- 修改.interactable = false;
- 存檔.interactable = true;
- 刪除.interactable = true;
- 看明細.interactable = false;
- 年.interactable = false;
- 月.interactable = false;
- 日.interactable = false;
- 名稱.interactable = false;
- 回首頁.interactable = false;
- }
- public void 存檔s()
- {
- 讀取面板.SetActive(true);
- for (int i = 0; i < 檢點明細.Count; i++)
- {
- string str = 檢點明細[i][0].ToString().Trim('"');
- string str1 = 檢點明細[i][5].ToString().Trim('"');
- StartCoroutine(檢點明細表更新(str,str1));
- }
- 編輯模式="";
- 新增.interactable = false;
- 修改.interactable = true;
- 存檔.interactable = false;
- 刪除.interactable = false;
- 看明細.interactable = true;
- 年.interactable = true;
- 月.interactable = true;
- 日.interactable = true;
- 名稱.interactable = true;
- 回首頁.interactable = true;
- 彈跳面板.SetActive(true);
- 彈跳文字.text="儲存成功";
- 讀取面板.SetActive(false);
- }
- public void 刪除s()
- {
- 編輯模式="";
- StartCoroutine(檢點明細表刪除());
- if (copy2!= null)
- {
- DeleteCopies(copy2);
- }
- 讀取面板.SetActive(true);
- 新增.interactable = true;
- 修改.interactable = false;
- 存檔.interactable = false;
- 刪除.interactable = false;
- 看明細.interactable = true;
- 年.interactable = true;
- 月.interactable = true;
- 日.interactable = true;
- 名稱.interactable = true;
- 回首頁.interactable = true;
- 彈跳面板.SetActive(true);
- 彈跳文字.text="刪除成功";
- 讀取面板.SetActive(false);
- }
- public void 顯示檢點內容()
- {
- if (控制流水號 == "")
- {
- 彈跳面板.SetActive(true);
- 彈跳文字.text="未選擇產品名稱";
- }
- else
- {
- 頁面一.SetActive(false);
- 頁面二.SetActive(true);
- 上一頁按鈕.SetActive(true);
- StartCoroutine(檢點項目內容());
- }
-
- }
- public void 彈出面板關閉()
- {
- 彈跳面板.SetActive(false);
- 彈跳文字.text="";
- }
- public void 上一頁()
- {
-
- 頁面一.SetActive(true);
- 頁面二.SetActive(false);
- 上一頁按鈕.SetActive(false);
- }
- private void DeleteCopies(List<GameObject> copyList)
- {
- foreach (GameObject copy in copyList)
- {
- Destroy(copy);
- }
- copyList.Clear();
- }
- public void back()
- {
- change_Secen(1);
- }
- public void change_Secen(int _screenNum)
- {
-
- SceneManager.LoadScene(_screenNum);
- }
- }
|