Geen omschrijving
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

採購.cs 34KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.SceneManagement;
  5. using UnityEngine.UI;
  6. using UnityEngine.Networking;
  7. using UnityEngine.EventSystems;
  8. using System.Text.RegularExpressions;
  9. using System.Data.SqlClient;
  10. using System.Runtime.InteropServices;
  11. using System.Text;
  12. using TMPro;
  13. using System;
  14. using System.IO;
  15. using ZXing;
  16. using ZXing.QrCode;
  17. using System.Net;
  18. using System.Data;
  19. using SimpleJSON;
  20. using System.Linq;
  21. public class 採購 : MonoBehaviour
  22. {
  23. [SerializeField] GameObject 畫面一;
  24. [SerializeField] GameObject 畫面二;
  25. [SerializeField] GameObject 彈出面板;
  26. [SerializeField] TextMeshProUGUI 備註s;
  27. [SerializeField] GameObject 語言選擇面板;
  28. [SerializeField] GameObject 供應商資訊;
  29. [SerializeField] TextMeshProUGUI 選擇語言;
  30. [SerializeField] TextMeshProUGUI 中;
  31. [SerializeField] TextMeshProUGUI 英;
  32. [SerializeField] TextMeshProUGUI 印;
  33. [SerializeField] TextMeshProUGUI 簡;
  34. [SerializeField] Button 中按鈕;
  35. [SerializeField] Button 英按鈕;
  36. [SerializeField] Button 印按鈕;
  37. [SerializeField] Button 簡按鈕;
  38. [SerializeField] TextMeshProUGUI 選擇公司單號;
  39. [SerializeField] TextMeshProUGUI 合約編號;
  40. [SerializeField] TextMeshProUGUI 選擇公司;
  41. [SerializeField] TextMeshProUGUI 需求日期;
  42. [SerializeField] TextMeshProUGUI 使用地點;
  43. [SerializeField] TextMeshProUGUI 總金額;
  44. [SerializeField] TextMeshProUGUI 電話;
  45. [SerializeField] TextMeshProUGUI 傳真;
  46. [SerializeField] TextMeshProUGUI 郵件;
  47. [SerializeField] TextMeshProUGUI 地址;
  48. [SerializeField] TextMeshProUGUI 項次;
  49. [SerializeField] TextMeshProUGUI 合約號;
  50. [SerializeField] TextMeshProUGUI 品名;
  51. [SerializeField] TextMeshProUGUI 規格;
  52. [SerializeField] TextMeshProUGUI 數量;
  53. [SerializeField] TextMeshProUGUI 單價;
  54. [SerializeField] TextMeshProUGUI 圖片;
  55. [SerializeField] TextMeshProUGUI 備註;
  56. [SerializeField] TextMeshProUGUI 選擇公司s;
  57. [SerializeField] TextMeshProUGUI 需求日期s;
  58. [SerializeField] TextMeshProUGUI 使用地點s;
  59. [SerializeField] TextMeshProUGUI 供應商s;
  60. [SerializeField] TextMeshProUGUI 折扣s;
  61. [SerializeField] TextMeshProUGUI 折扣ss;
  62. [SerializeField] TextMeshProUGUI PPNs;
  63. [SerializeField] TextMeshProUGUI PPNss;
  64. [SerializeField] TextMeshProUGUI 總金額s;
  65. [SerializeField] TextMeshProUGUI 電話s;
  66. [SerializeField] TextMeshProUGUI 傳真s;
  67. [SerializeField] TextMeshProUGUI 郵件s;
  68. [SerializeField] TextMeshProUGUI 地址s;
  69. public GameObject buttonPrefab;
  70. public Transform buttonParent;
  71. public GameObject buttonceneter;
  72. public GameObject buttonPrefab1;
  73. public Transform buttonParent1;
  74. public GameObject buttonceneter1;
  75. private List<GameObject> copy = new List<GameObject>();
  76. private List<GameObject> copy1 = new List<GameObject>();
  77. private TextMeshProUGUI[] texts1;
  78. public Sprite 沒圖;
  79. private Button[] bts;
  80. public CanvasScaler canvasScaler;
  81. public float idleTime = 300f; // 5分鐘的閒置時間
  82. private float timeSinceLastInteraction = 0f;
  83. private float timer = 0f;
  84. private float interval = 60f;
  85. [SerializeField] GameObject 讀取面板;
  86. [SerializeField] TextMeshProUGUI 讀取;
  87. private string loadingText = "";
  88. private int dotCount = 0;
  89. [SerializeField] GameObject 網頁面板;
  90. UniWebView webView;
  91. public GameObject panel;
  92. float scale = 0;
  93. float xbar = 0;
  94. float ybar = 0;
  95. RectTransform panelRectTransform;
  96. // Start is called before the first frame update
  97. void Start()
  98. {
  99. Main.Global.qwe=true;
  100. Screen.autorotateToPortrait = false;
  101. Screen.orientation = ScreenOrientation.LandscapeLeft;
  102. float screenWidth = Screen.width;
  103. float screenHeight = Screen.height;
  104. float rate = screenWidth/screenHeight;
  105. if (canvasScaler == null)
  106. {
  107. canvasScaler = GetComponent<CanvasScaler>();
  108. }
  109. if (rate>1.6)
  110. {
  111. canvasScaler.matchWidthOrHeight = 1f;
  112. }
  113. else
  114. {
  115. canvasScaler.matchWidthOrHeight = 0f;
  116. }
  117. if (canvasScaler.matchWidthOrHeight == 0f)
  118. {
  119. scale = screenWidth / 1600;
  120. xbar=0;
  121. ybar=(screenHeight-(1000*scale))/2;
  122. }
  123. else
  124. {
  125. scale = screenHeight/ 1000;
  126. xbar=(screenWidth-(1600*scale))/2;
  127. ybar=0;
  128. }
  129. panelRectTransform = panel.GetComponent<RectTransform>();
  130. //初始化系統語言();
  131. //Main.Global.系統語言="繁體中文";
  132. StartCoroutine(判斷更新());
  133. StartCoroutine(AnimateText());
  134. 網頁(panelRectTransform, scale, xbar, ybar);
  135. 系統語言轉換();
  136. 語言選擇按鈕();
  137. //Main.Global.阿帕契路徑="http://106.1.48.106:8080/wp-content/themes/event-star/tab.php?";
  138. //Main.Global.阿帕契路徑="http://103.231.201.230/hxpgsweb/wp-content/themes/twentytwentyone/tab.php?";
  139. //Main.Global.預設伺服器路徑="tw";
  140. }
  141. IEnumerator AnimateText()
  142. {
  143. string qqq = 讀取.text.ToString();
  144. while (true)
  145. {
  146. yield return new WaitForSeconds(0.5f);
  147. if (dotCount < 3)
  148. {
  149. loadingText += ".";
  150. dotCount++;
  151. }
  152. else
  153. {
  154. loadingText = "";
  155. dotCount = 0;
  156. }
  157. 讀取.text = qqq+loadingText;
  158. }
  159. }
  160. public void PGS清單()
  161. {
  162. 選擇公司s.text="PT PUNCAK GEMILANG SEMESTA";
  163. if (copy != null)
  164. {
  165. DeletetextCopy();
  166. }
  167. 讀取面板.SetActive(true);
  168. StartCoroutine(採購單核准清單1());
  169. }
  170. public void HXI清單()
  171. {
  172. 選擇公司s.text="PT HONG XHE INDUSTRIAL";
  173. if (copy != null)
  174. {
  175. DeletetextCopy();
  176. }
  177. 讀取面板.SetActive(true);
  178. StartCoroutine(採購單核准清單2());
  179. }
  180. IEnumerator 判斷更新()
  181. {
  182. string strcon = "更新";
  183. string strUrl = string.Format(Main.Global.阿帕契路徑+"comm={0}", strcon);
  184. UnityWebRequest request = UnityWebRequest.Get(strUrl);
  185. yield return request.SendWebRequest();
  186. if (request.result == UnityWebRequest.Result.ConnectionError)
  187. {
  188. yield break;
  189. }
  190. string str = request.downloadHandler.text.ToString();
  191. Debug.Log(str);
  192. if (str == "系統更新")
  193. {
  194. change_Secen(1);
  195. }
  196. }
  197. IEnumerator 採購單核准清單1()
  198. {
  199. string strcon1 = "採購單核准清單1";
  200. string se = Main.Global.預設伺服器路徑;
  201. string strUrl1 = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}", strcon1, se);
  202. UnityWebRequest request1 = UnityWebRequest.Get(strUrl1);
  203. yield return request1.SendWebRequest();
  204. if (request1.result == UnityWebRequest.Result.ConnectionError)
  205. {
  206. //Debug.Log(request.error);
  207. yield break;
  208. }
  209. JSONNode json = JSON.Parse(request1.downloadHandler.text);
  210. Debug.Log(json);
  211. if (copy != null)
  212. {
  213. DeletetextCopy();
  214. }
  215. int sum = 0;
  216. for (int i = 0; i < json.Count; i++)
  217. {
  218. GameObject buttonObj = Instantiate(buttonPrefab) as GameObject;
  219. buttonObj.GetComponent<RectTransform>().anchoredPosition = new Vector2(2, -sum);
  220. buttonObj.transform.SetParent(buttonParent, false);
  221. Button newButton = buttonObj.GetComponentInChildren<Button>();
  222. TextMeshProUGUI text = buttonObj.GetComponentInChildren<TextMeshProUGUI>();
  223. string name = json[i][0].ToString().Trim('"');
  224. text.text = name;
  225. string idname = json[i][1].ToString().Trim('"');
  226. int index = i;
  227. newButton.onClick.AddListener(() =>
  228. {
  229. 需求日期s.text=json[index][2];
  230. 使用地點s.text=json[index][3];
  231. 折扣s.text=json[index][13];
  232. PPNs.text=json[index][15];
  233. string qa = json[index][0].ToString().Trim('"');
  234. Debug.Log(qa);
  235. StartCoroutine(採購單明細(qa));
  236. StartCoroutine(供應商資料(idname));
  237. 畫面一.SetActive(false);
  238. 畫面二.SetActive(true);
  239. 讀取面板.SetActive(true);
  240. });
  241. sum+=75;
  242. copy.Add(buttonObj);
  243. }
  244. buttonceneter.GetComponent<RectTransform>().sizeDelta = new Vector2(buttonceneter.GetComponent<RectTransform>().sizeDelta.x, sum);
  245. 讀取面板.SetActive(false);
  246. }
  247. IEnumerator 採購單核准清單2()
  248. {
  249. string strcon1 = "採購單核准清單2";
  250. string se = Main.Global.預設伺服器路徑;
  251. string strUrl1 = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}", strcon1, se);
  252. UnityWebRequest request1 = UnityWebRequest.Get(strUrl1);
  253. yield return request1.SendWebRequest();
  254. if (request1.result == UnityWebRequest.Result.ConnectionError)
  255. {
  256. //Debug.Log(request.error);
  257. yield break;
  258. }
  259. JSONNode json = JSON.Parse(request1.downloadHandler.text);
  260. int sum = 0;
  261. if (copy != null)
  262. {
  263. DeletetextCopy();
  264. }
  265. for (int i = 0; i < json.Count; i++)
  266. {
  267. GameObject buttonObj = Instantiate(buttonPrefab) as GameObject;
  268. buttonObj.GetComponent<RectTransform>().anchoredPosition = new Vector2(2, -sum);
  269. buttonObj.transform.SetParent(buttonParent, false);
  270. Button newButton = buttonObj.GetComponentInChildren<Button>();
  271. TextMeshProUGUI text = buttonObj.GetComponentInChildren<TextMeshProUGUI>();
  272. string name = json[i][0].ToString().Trim('"');
  273. text.text = name;
  274. string idname = json[i][1].ToString().Trim('"');
  275. int index = i;
  276. newButton.onClick.AddListener(() =>
  277. {
  278. 需求日期s.text=json[index][2];
  279. 使用地點s.text=json[index][3];
  280. 折扣s.text=json[index][13];
  281. PPNs.text=json[index][15];
  282. string qa = json[index][0].ToString().Trim('"');
  283. Debug.Log(qa);
  284. StartCoroutine(採購單明細(qa));
  285. StartCoroutine(供應商資料(idname));
  286. 畫面一.SetActive(false);
  287. 畫面二.SetActive(true);
  288. 讀取面板.SetActive(true);
  289. });
  290. sum+=75;
  291. copy.Add(buttonObj);
  292. }
  293. buttonceneter.GetComponent<RectTransform>().sizeDelta = new Vector2(buttonceneter.GetComponent<RectTransform>().sizeDelta.x, sum);
  294. 讀取面板.SetActive(false);
  295. }
  296. IEnumerator 採購單明細(string pa)
  297. {
  298. string strcon1 = "採購單明細";
  299. string se = Main.Global.預設伺服器路徑;
  300. string pa1 = Main.Global.系統語言;
  301. string strUrl1 = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&PA1={2}&PA2={3}", strcon1, se, pa,pa1);
  302. UnityWebRequest request1 = UnityWebRequest.Get(strUrl1);
  303. yield return request1.SendWebRequest();
  304. if (request1.result == UnityWebRequest.Result.ConnectionError)
  305. {
  306. //Debug.Log(request.error);
  307. yield break;
  308. }
  309. JSONNode json = JSON.Parse(request1.downloadHandler.text);
  310. Debug.Log(json);
  311. int sum = 0;
  312. double total = 0;
  313. for (int i = 0; i < json.Count; i++)
  314. {
  315. GameObject buttonObj = Instantiate(buttonPrefab1) as GameObject;
  316. buttonObj.GetComponent<RectTransform>().anchoredPosition = new Vector2(0, -sum);
  317. buttonObj.transform.SetParent(buttonParent1, false);
  318. Button newButton = buttonObj.GetComponentInChildren<Button>();
  319. texts1 =buttonObj.GetComponentsInChildren<TextMeshProUGUI>();
  320. if (i<9)
  321. {
  322. texts1[0].text="0"+(i+1).ToString();
  323. }
  324. else
  325. {
  326. texts1[0].text=(i+1).ToString();
  327. }
  328. texts1[1].text=json[i][2];
  329. texts1[2].text=json[i][3];
  330. texts1[3].text=json[i][4];
  331. texts1[6].text=json[i][5];
  332. double amo = double.Parse(json[i][6]);
  333. int iamo = (int)Math.Round(amo);
  334. texts1[4].text=iamo.ToString();
  335. double amo1 = double.Parse(json[i][8]);
  336. int iamo1 = (int)Math.Round(amo1);
  337. texts1[5].text=iamo1.ToString("#,##0");
  338. double amo2 = double.Parse(json[i][9]);
  339. total+=amo2;
  340. for (int j = 17; j < 24; j++)
  341. {
  342. if (!string.IsNullOrEmpty(json[i][j])) // 判斷第二到第六格是否有資料
  343. {
  344. string te = json[i][j].ToString().Trim('"');
  345. texts1[3].text += "、" + te; // 進行字串拼接
  346. }
  347. }
  348. string asd = json[i][25].ToString().Trim('"');
  349. string qwe = json[i][26].ToString().Trim('"');
  350. string path = Application.persistentDataPath + "/image/"+asd +"_"+qwe+".jpg";
  351. if (File.Exists(path))
  352. {
  353. // 讀取圖片
  354. byte[] bytes = File.ReadAllBytes(path);
  355. Texture2D texture = new Texture2D(2, 2);
  356. texture.LoadImage(bytes);
  357. buttonObj.GetComponentInChildren<RawImage>().texture = texture;
  358. }
  359. else
  360. {
  361. buttonObj.GetComponentInChildren<RawImage>().texture = 沒圖.texture;
  362. }
  363. TextMeshProUGUI fiveText = texts1[6];
  364. newButton.onClick.AddListener(() =>
  365. {
  366. 彈出面板.SetActive(true);
  367. 備註s.text=fiveText.text;
  368. });
  369. sum+=100;
  370. copy1.Add(buttonObj);
  371. }
  372. double cou = double.Parse(折扣s.text);
  373. double ppn = double.Parse(PPNs.text);
  374. double cons = cou*total;
  375. double ppns = 0;
  376. 折扣ss.text=cons.ToString("#,##0");
  377. if (PPNs.text !="0")
  378. {
  379. if (折扣s.text=="0")
  380. {
  381. ppns = total*ppn/100;
  382. PPNss.text=ppns.ToString("#,##0");
  383. }
  384. else
  385. {
  386. ppns = (total-cons)*ppn/100;
  387. PPNss.text=ppns.ToString("#,##0");
  388. }
  389. }
  390. else
  391. {
  392. PPNss.text="0";
  393. }
  394. total = total - cons + ppns;
  395. 總金額s.text=total.ToString("#,##0");
  396. buttonceneter1.GetComponent<RectTransform>().sizeDelta = new Vector2(buttonceneter1.GetComponent<RectTransform>().sizeDelta.x, sum);
  397. 讀取面板.SetActive(false);
  398. }
  399. IEnumerator 供應商資料(string pa)
  400. {
  401. string strcon1 = "供應商資料";
  402. string se = Main.Global.預設伺服器路徑;
  403. string strUrl1 = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&PA={2}", strcon1, se,pa);
  404. UnityWebRequest request1 = UnityWebRequest.Get(strUrl1);
  405. yield return request1.SendWebRequest();
  406. if (request1.result == UnityWebRequest.Result.ConnectionError)
  407. {
  408. //Debug.Log(request.error);
  409. yield break;
  410. }
  411. JSONNode json = JSON.Parse(request1.downloadHandler.text);
  412. 供應商s.text=json[0];
  413. 地址s.text=json[1];
  414. 電話s.text=json[2];
  415. 傳真s.text=json[3];
  416. 郵件s.text=json[4];
  417. }
  418. public void 網頁(RectTransform panelRectTransform, float scale, float xbar, float ybar)
  419. {
  420. var webViewGameObject = new GameObject("UniWebView");
  421. webView = webViewGameObject.AddComponent<UniWebView>();
  422. webView.Frame =new Rect(panelRectTransform.anchoredPosition.x*scale+xbar, (-panelRectTransform.anchoredPosition.y*scale)+ybar, panelRectTransform.sizeDelta.x*scale, panelRectTransform.sizeDelta.y*scale);
  423. if (Main.Global.系統語言=="繁體中文" || Main.Global.系統語言=="簡體中文")
  424. {
  425. webView.Load("https://gcm-smart.com/2023/06/14/hx-pgs-erp-app-13/");
  426. }
  427. else
  428. {
  429. webView.Load("https://gcm-smart.com/2023/06/14/hx-pgs-erp-app-14/");
  430. }
  431. StartCoroutine(說明顯示查詢());
  432. //webView.Show();
  433. }
  434. IEnumerator 說明顯示查詢()
  435. {
  436. string strcon1 = "說明顯示查詢";
  437. string se = Main.Global.預設伺服器路徑;
  438. string pb1 = Main.Global.人員;
  439. string pb2 = "APP-13-14";
  440. DateTime currentDate = DateTime.Now;
  441. int year = currentDate.Year;
  442. string ys = year.ToString();
  443. int month = currentDate.Month;
  444. string ms = "";
  445. if (month < 10)
  446. {
  447. ms = "0"+month.ToString();
  448. }
  449. else
  450. {
  451. ms = month.ToString();
  452. }
  453. string strUrl1 = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&PB1={2}&PB2={3}&PB5={4}&PB6={5}", strcon1, se, pb1, pb2, ys, ms);
  454. UnityWebRequest request1 = UnityWebRequest.Get(strUrl1);
  455. yield return request1.SendWebRequest();
  456. if (request1.result == UnityWebRequest.Result.ConnectionError)
  457. {
  458. //Debug.Log(request.error);
  459. yield break;
  460. }
  461. JSONNode json = JSON.Parse(request1.downloadHandler.text);
  462. int 開啟, 公告;
  463. bool 是否新增 = false;
  464. if (json.Count>0)
  465. {
  466. float floatValue = float.Parse(json[2].ToString().Trim('"'));
  467. 開啟 = Mathf.RoundToInt(floatValue);
  468. float floatValue1 = float.Parse(json[3].ToString().Trim('"'));
  469. 公告 = Mathf.RoundToInt(floatValue1);
  470. if (開啟<3)
  471. {
  472. 網頁面板.SetActive(true);
  473. webView.Show();
  474. 開啟+=1;
  475. 公告+=1;
  476. }
  477. else
  478. {
  479. 開啟+=1;
  480. }
  481. }
  482. else
  483. {
  484. 網頁面板.SetActive(true);
  485. webView.Show();
  486. 開啟 = 1;
  487. 公告 = 1;
  488. 是否新增 = true;
  489. }
  490. if (是否新增==true)
  491. {
  492. yield return StartCoroutine(說明顯示新增(開啟, 公告));
  493. }
  494. else
  495. {
  496. yield return StartCoroutine(說明顯示修改(開啟, 公告));
  497. }
  498. }
  499. IEnumerator 說明顯示新增(int a1, int a2)
  500. {
  501. string strcon1 = "說明顯示新增";
  502. string se = Main.Global.預設伺服器路徑;
  503. string pb1 = Main.Global.人員;
  504. string pb2 = "APP-13-14";
  505. string pb3 = a1.ToString();
  506. string pb4 = a2.ToString();
  507. DateTime currentDate = DateTime.Now;
  508. int year = currentDate.Year;
  509. string ys = year.ToString();
  510. int month = currentDate.Month;
  511. string ms = "";
  512. if (month < 10)
  513. {
  514. ms = "0"+month.ToString();
  515. }
  516. else
  517. {
  518. ms = month.ToString();
  519. }
  520. 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);
  521. UnityWebRequest request1 = UnityWebRequest.Get(strUrl1);
  522. yield return request1.SendWebRequest();
  523. if (request1.result == UnityWebRequest.Result.ConnectionError)
  524. {
  525. //Debug.Log(request.error);
  526. yield break;
  527. }
  528. }
  529. IEnumerator 說明顯示修改(int a1, int a2)
  530. {
  531. string strcon1 = "說明顯示修改";
  532. string se = Main.Global.預設伺服器路徑;
  533. string pb1 = Main.Global.人員;
  534. string pb2 = "APP-13-14";
  535. string pb3 = a1.ToString();
  536. string pb4 = a2.ToString();
  537. DateTime currentDate = DateTime.Now;
  538. int year = currentDate.Year;
  539. string ys = year.ToString();
  540. int month = currentDate.Month;
  541. string ms = "";
  542. if (month < 10)
  543. {
  544. ms = "0"+month.ToString();
  545. }
  546. else
  547. {
  548. ms = month.ToString();
  549. }
  550. 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);
  551. UnityWebRequest request1 = UnityWebRequest.Get(strUrl1);
  552. yield return request1.SendWebRequest();
  553. if (request1.result == UnityWebRequest.Result.ConnectionError)
  554. {
  555. //Debug.Log(request.error);
  556. yield break;
  557. }
  558. }
  559. public void 網頁面板關閉()
  560. {
  561. 網頁面板.SetActive(false);
  562. webView.Hide();
  563. //Destroy(webView);
  564. }
  565. public void 網頁面板開啟()
  566. {
  567. 網頁面板.SetActive(true);
  568. webView.Show();
  569. //Destroy(webView);
  570. }
  571. public void DeletetextCopy()
  572. {
  573. // 刪除複製出來的物件
  574. foreach (GameObject i in copy)
  575. {
  576. Destroy(i);
  577. }
  578. copy.Clear();
  579. }
  580. public void DeletetextCopy1()
  581. {
  582. // 刪除複製出來的物件
  583. foreach (GameObject i in copy1)
  584. {
  585. Destroy(i);
  586. }
  587. copy1.Clear();
  588. }
  589. void Update()
  590. {
  591. timer += Time.deltaTime;
  592. // 判斷是否達到時間間隔
  593. if (timer >= interval)
  594. {
  595. StartCoroutine(判斷更新());
  596. timer = 0f;
  597. }
  598. if (Main.Global.快速登入==false)
  599. {
  600. if (Input.anyKeyDown)
  601. {
  602. timeSinceLastInteraction = 0f;
  603. }
  604. else
  605. {
  606. timeSinceLastInteraction += Time.deltaTime;
  607. if (timeSinceLastInteraction > idleTime)
  608. {
  609. change_Secen(1);
  610. }
  611. }
  612. }
  613. }
  614. public void change_Secen(int _screenNum)
  615. {
  616. //Main.Global.判斷是否第一次=true;
  617. SceneManager.LoadScene(_screenNum);
  618. }
  619. public void 彈出面板關閉()
  620. {
  621. 備註s.text="";
  622. 彈出面板.SetActive(false);
  623. }
  624. public void 回首頁()
  625. {
  626. change_Secen(3);
  627. }
  628. public void 上一頁()
  629. {
  630. 需求日期s.text="";
  631. 使用地點s.text="";
  632. 折扣s.text="";
  633. 折扣ss.text="";
  634. PPNs.text="";
  635. PPNss.text="";
  636. 總金額s.text="";
  637. 供應商s.text="";
  638. 電話s.text="";
  639. 傳真s.text="";
  640. 郵件s.text="";
  641. 地址s.text="";
  642. if (copy1 != null)
  643. {
  644. DeletetextCopy1();
  645. }
  646. if (畫面二.activeSelf)
  647. {
  648. 畫面一.SetActive(true);
  649. 畫面二.SetActive(false);
  650. }
  651. }
  652. public void 供應商資訊按鈕()
  653. {
  654. 供應商資訊.SetActive(!供應商資訊.activeSelf);
  655. }
  656. public void setting_中()
  657. {
  658. Main.Global.系統語言="繁體中文";
  659. 系統語言轉換();
  660. 語言選擇按鈕();
  661. 語言選擇面板.SetActive(false);
  662. webView.Load("https://gcm-smart.com/2023/06/14/hx-pgs-erp-app-13/");
  663. }
  664. public void setting_簡()
  665. {
  666. Main.Global.系統語言="簡體中文";
  667. 系統語言轉換();
  668. 語言選擇按鈕();
  669. 語言選擇面板.SetActive(false);
  670. webView.Load("https://gcm-smart.com/2023/06/14/hx-pgs-erp-app-13/");
  671. }
  672. public void setting_英()
  673. {
  674. Main.Global.系統語言="English";
  675. 系統語言轉換();
  676. 語言選擇按鈕();
  677. 語言選擇面板.SetActive(false);
  678. webView.Load("https://gcm-smart.com/2023/06/14/hx-pgs-erp-app-14/");
  679. }
  680. public void setting_印()
  681. {
  682. Main.Global.系統語言="Indonesian";
  683. 系統語言轉換();
  684. 語言選擇按鈕();
  685. 語言選擇面板.SetActive(false);
  686. webView.Load("https://gcm-smart.com/2023/06/14/hx-pgs-erp-app-14/");
  687. }
  688. public void setting_click()
  689. {
  690. 語言選擇面板.SetActive(true);
  691. }
  692. public void setting_exit()
  693. {
  694. 語言選擇面板.SetActive(false);
  695. }
  696. public void 語言選擇按鈕()
  697. {
  698. if (bts == null)
  699. {
  700. if (Main.Global.系統語言=="繁體中文")
  701. {
  702. bts = new Button[] { 簡按鈕, 英按鈕, 印按鈕, 中按鈕 };
  703. }
  704. else if (Main.Global.系統語言=="簡體中文")
  705. {
  706. bts = new Button[] { 中按鈕, 英按鈕, 印按鈕, 簡按鈕 };
  707. }
  708. else if (Main.Global.系統語言=="English")
  709. {
  710. bts = new Button[] { 中按鈕, 簡按鈕, 印按鈕, 英按鈕 };
  711. }
  712. else
  713. {
  714. bts = new Button[] { 中按鈕, 簡按鈕, 英按鈕, 印按鈕 };
  715. }
  716. }
  717. else
  718. {
  719. for (int j = 0; j < bts.Length; j++)
  720. {
  721. bts[j] = null;
  722. }
  723. if (Main.Global.系統語言=="繁體中文")
  724. {
  725. bts = new Button[] { 簡按鈕, 英按鈕, 印按鈕, 中按鈕 };
  726. }
  727. else if (Main.Global.系統語言=="簡體中文")
  728. {
  729. bts = new Button[] { 中按鈕, 英按鈕, 印按鈕, 簡按鈕 };
  730. }
  731. else if (Main.Global.系統語言=="English")
  732. {
  733. bts = new Button[] { 中按鈕, 簡按鈕, 印按鈕, 英按鈕 };
  734. }
  735. else
  736. {
  737. bts = new Button[] { 中按鈕, 簡按鈕, 英按鈕, 印按鈕 };
  738. }
  739. }
  740. for (int i = 0; i < bts.Length; i++)
  741. {
  742. RectTransform rectTransform = bts[i].GetComponent<RectTransform>();
  743. if (i==3)
  744. {
  745. rectTransform.anchoredPosition = new Vector2(1200, 1200);
  746. }
  747. else
  748. {
  749. rectTransform.anchoredPosition = new Vector2(300*i, 0);
  750. }
  751. }
  752. }
  753. private void 系統語言轉換()
  754. {
  755. string 介面 = "H08";
  756. if (Main.Global.系統語言=="繁體中文")
  757. {
  758. 中.text = Main.Global.系統語言字典[介面+"00CH"];
  759. 英.text = Main.Global.系統語言字典[介面+"01CH"];
  760. 印.text = Main.Global.系統語言字典[介面+"02CH"];
  761. 簡.text = Main.Global.系統語言字典[介面+"04CH"];
  762. 選擇語言.text = Main.Global.系統語言字典[介面+"03CH"];
  763. 選擇公司單號.text = Main.Global.系統語言字典[介面+"05CH"];
  764. 合約編號.text = Main.Global.系統語言字典[介面+"06CH"];
  765. 選擇公司.text = Main.Global.系統語言字典[介面+"07CH"];
  766. 需求日期.text = Main.Global.系統語言字典[介面+"08CH"];
  767. 使用地點.text = Main.Global.系統語言字典[介面+"10CH"];
  768. 總金額.text = Main.Global.系統語言字典[介面+"11CH"];
  769. 電話.text = Main.Global.系統語言字典[介面+"12CH"];
  770. 傳真.text = Main.Global.系統語言字典[介面+"13CH"];
  771. 郵件.text = Main.Global.系統語言字典[介面+"14CH"];
  772. 地址.text = Main.Global.系統語言字典[介面+"15CH"];
  773. 項次.text = Main.Global.系統語言字典[介面+"17CH"];
  774. 合約號.text = Main.Global.系統語言字典[介面+"23CH"];
  775. 品名.text = Main.Global.系統語言字典[介面+"18CH"];
  776. 規格.text = Main.Global.系統語言字典[介面+"19CH"];
  777. 數量.text = Main.Global.系統語言字典[介面+"20CH"];
  778. 單價.text = Main.Global.系統語言字典[介面+"21CH"];
  779. 圖片.text = Main.Global.系統語言字典[介面+"22CH"];
  780. 備註.text = Main.Global.系統語言字典[介面+"16CH"];
  781. }
  782. else if (Main.Global.系統語言=="簡體中文")
  783. {
  784. 中.text = Main.Global.系統語言字典[介面+"00CS"];
  785. 英.text = Main.Global.系統語言字典[介面+"01CS"];
  786. 印.text = Main.Global.系統語言字典[介面+"02CS"];
  787. 簡.text = Main.Global.系統語言字典[介面+"04CS"];
  788. 選擇語言.text = Main.Global.系統語言字典[介面+"03CS"];
  789. 選擇公司單號.text = Main.Global.系統語言字典[介面+"05CS"];
  790. 合約編號.text = Main.Global.系統語言字典[介面+"06CS"];
  791. 選擇公司.text = Main.Global.系統語言字典[介面+"07CS"];
  792. 需求日期.text = Main.Global.系統語言字典[介面+"08CS"];
  793. 使用地點.text = Main.Global.系統語言字典[介面+"10CS"];
  794. 總金額.text = Main.Global.系統語言字典[介面+"11CS"];
  795. 電話.text = Main.Global.系統語言字典[介面+"12CS"];
  796. 傳真.text = Main.Global.系統語言字典[介面+"13CS"];
  797. 郵件.text = Main.Global.系統語言字典[介面+"14CS"];
  798. 地址.text = Main.Global.系統語言字典[介面+"15CS"];
  799. 項次.text = Main.Global.系統語言字典[介面+"17CS"];
  800. 合約號.text = Main.Global.系統語言字典[介面+"23CS"];
  801. 品名.text = Main.Global.系統語言字典[介面+"18CS"];
  802. 規格.text = Main.Global.系統語言字典[介面+"19CS"];
  803. 數量.text = Main.Global.系統語言字典[介面+"20CS"];
  804. 單價.text = Main.Global.系統語言字典[介面+"21CS"];
  805. 圖片.text = Main.Global.系統語言字典[介面+"22CS"];
  806. 備註.text = Main.Global.系統語言字典[介面+"16CS"];
  807. }
  808. else if (Main.Global.系統語言=="English")
  809. {
  810. 中.text = Main.Global.系統語言字典[介面+"00EN"];
  811. 英.text = Main.Global.系統語言字典[介面+"01EN"];
  812. 印.text = Main.Global.系統語言字典[介面+"02EN"];
  813. 簡.text = Main.Global.系統語言字典[介面+"04EN"];
  814. 選擇語言.text = Main.Global.系統語言字典[介面+"03EN"];
  815. 選擇公司單號.text = Main.Global.系統語言字典[介面+"05EN"];
  816. 合約編號.text = Main.Global.系統語言字典[介面+"06EN"];
  817. 選擇公司.text = Main.Global.系統語言字典[介面+"07EN"];
  818. 需求日期.text = Main.Global.系統語言字典[介面+"08EN"];
  819. 使用地點.text = Main.Global.系統語言字典[介面+"10EN"];
  820. 總金額.text = Main.Global.系統語言字典[介面+"11EN"];
  821. 電話.text = Main.Global.系統語言字典[介面+"12EN"];
  822. 傳真.text = Main.Global.系統語言字典[介面+"13EN"];
  823. 郵件.text = Main.Global.系統語言字典[介面+"14EN"];
  824. 地址.text = Main.Global.系統語言字典[介面+"15EN"];
  825. 項次.text = Main.Global.系統語言字典[介面+"17EN"];
  826. 合約號.text = Main.Global.系統語言字典[介面+"23EN"];
  827. 品名.text = Main.Global.系統語言字典[介面+"18EN"];
  828. 規格.text = Main.Global.系統語言字典[介面+"19EN"];
  829. 數量.text = Main.Global.系統語言字典[介面+"20EN"];
  830. 單價.text = Main.Global.系統語言字典[介面+"21EN"];
  831. 圖片.text = Main.Global.系統語言字典[介面+"22EN"];
  832. 備註.text = Main.Global.系統語言字典[介面+"16EN"];
  833. }
  834. else
  835. {
  836. 中.text = Main.Global.系統語言字典[介面+"00ID"];
  837. 英.text = Main.Global.系統語言字典[介面+"01ID"];
  838. 印.text = Main.Global.系統語言字典[介面+"02ID"];
  839. 簡.text = Main.Global.系統語言字典[介面+"04ID"];
  840. 選擇語言.text = Main.Global.系統語言字典[介面+"03ID"];
  841. 選擇公司單號.text = Main.Global.系統語言字典[介面+"05ID"];
  842. 合約編號.text = Main.Global.系統語言字典[介面+"06ID"];
  843. 選擇公司.text = Main.Global.系統語言字典[介面+"07ID"];
  844. 需求日期.text = Main.Global.系統語言字典[介面+"08ID"];
  845. 使用地點.text = Main.Global.系統語言字典[介面+"10ID"];
  846. 總金額.text = Main.Global.系統語言字典[介面+"11ID"];
  847. 電話.text = Main.Global.系統語言字典[介面+"12ID"];
  848. 傳真.text = Main.Global.系統語言字典[介面+"13ID"];
  849. 郵件.text = Main.Global.系統語言字典[介面+"14ID"];
  850. 地址.text = Main.Global.系統語言字典[介面+"15ID"];
  851. 項次.text = Main.Global.系統語言字典[介面+"17ID"];
  852. 合約號.text = Main.Global.系統語言字典[介面+"23ID"];
  853. 品名.text = Main.Global.系統語言字典[介面+"18ID"];
  854. 規格.text = Main.Global.系統語言字典[介面+"19ID"];
  855. 數量.text = Main.Global.系統語言字典[介面+"20ID"];
  856. 單價.text = Main.Global.系統語言字典[介面+"21ID"];
  857. 圖片.text = Main.Global.系統語言字典[介面+"22ID"];
  858. 備註.text = Main.Global.系統語言字典[介面+"16ID"];
  859. }
  860. }
  861. private void 初始化系統語言()
  862. {
  863. TextAsset txt = Resources.Load("Tran") as TextAsset;
  864. Main.Global.系統語言資料=txt.text.Split('\n');
  865. for (int i = 1; i<=Main.Global.系統語言資料.Length; i++)
  866. {
  867. try
  868. {
  869. string key = Main.Global.系統語言資料[i].ToString().Substring(0, 3)+Main.Global.系統語言資料[i].ToString().Substring(4, 2)+Main.Global.系統語言資料[i].ToString().Substring(7, 2);
  870. Main.Global.系統語言字典.Add(key, Main.Global.系統語言資料[i].ToString().Substring(10));
  871. }
  872. catch
  873. {
  874. // Debug.Log("No data");
  875. }
  876. }
  877. }
  878. }