Sin descripción
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.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626
  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 chingo : MonoBehaviour
  22. {
  23. public GameObject buttonPrefab;
  24. public Transform buttonParent;
  25. public GameObject buttonceneter;
  26. public GameObject buttonPrefab1;
  27. public Transform buttonParent1;
  28. public GameObject buttonPrefab2;
  29. public Transform buttonParent2;
  30. public GameObject buttonceneter2;
  31. public GameObject buttonPrefab3;
  32. public Transform buttonParent3;
  33. public GameObject buttonceneter3;
  34. public GameObject buttonPrefab4;
  35. public Transform buttonParent4;
  36. public GameObject buttonceneter4;
  37. public GameObject textPrefab;
  38. public Transform textParent;
  39. public GameObject textceneter;
  40. public GameObject imagePrefab;
  41. public Transform paneltransform;
  42. private TextMeshProUGUI[] texts;
  43. [SerializeField] TextMeshProUGUI 選擇主項;
  44. [SerializeField] TextMeshProUGUI 選擇物料;
  45. [SerializeField] TextMeshProUGUI 選擇規格數量;
  46. [SerializeField] TextMeshProUGUI 管材s;
  47. [SerializeField] TextMeshProUGUI 電線s;
  48. [SerializeField] TextMeshProUGUI 電料s;
  49. [SerializeField] TextMeshProUGUI 槽架s;
  50. [SerializeField] TextMeshProUGUI 建材s;
  51. [SerializeField] TextMeshProUGUI 五金s;
  52. [SerializeField] TextMeshProUGUI 設備s;
  53. [SerializeField] TextMeshProUGUI 工具s;
  54. [SerializeField] TextMeshProUGUI 日用s;
  55. [SerializeField] TextMeshProUGUI 其他s;
  56. [SerializeField] TextMeshProUGUI 輸入授權碼;
  57. [SerializeField] TextMeshProUGUI 指定倉庫;
  58. [SerializeField] TextMeshProUGUI 申請人;
  59. [SerializeField] TextMeshProUGUI 請購單號;
  60. [SerializeField] TextMeshProUGUI 合約號;
  61. [SerializeField] TextMeshProUGUI 申請日期;
  62. [SerializeField] TextMeshProUGUI 需求日期;
  63. [SerializeField] TextMeshProUGUI 備註;
  64. [SerializeField] TextMeshProUGUI 項次;
  65. [SerializeField] TextMeshProUGUI 品名;
  66. [SerializeField] TextMeshProUGUI 規格;
  67. [SerializeField] TextMeshProUGUI 數量;
  68. [SerializeField] TextMeshProUGUI 單位;
  69. [SerializeField] TextMeshProUGUI 圖片;
  70. [SerializeField] TextMeshProUGUI 修改;
  71. [SerializeField] TextMeshProUGUI 刪除;
  72. [SerializeField] GameObject 語言選擇面板;
  73. [SerializeField] TextMeshProUGUI 選擇語言;
  74. [SerializeField] TextMeshProUGUI 中;
  75. [SerializeField] TextMeshProUGUI 英;
  76. [SerializeField] TextMeshProUGUI 印;
  77. [SerializeField] TextMeshProUGUI 簡;
  78. [SerializeField] Button 中按鈕;
  79. [SerializeField] Button 英按鈕;
  80. [SerializeField] Button 印按鈕;
  81. [SerializeField] Button 簡按鈕;
  82. [SerializeField] GameObject 彈窗按鈕_底圖1;
  83. [SerializeField] GameObject 彈窗按鈕_底圖2;
  84. [SerializeField] GameObject 彈窗按鈕_Y;
  85. [SerializeField] GameObject 彈窗按鈕_N;
  86. [SerializeField] GameObject 彈窗按鈕_Y1;
  87. [SerializeField] GameObject 彈窗按鈕_N1;
  88. [SerializeField] GameObject 彈窗按鈕X;
  89. [SerializeField] GameObject 畫面一;
  90. [SerializeField] GameObject 畫面四;
  91. [SerializeField] GameObject 畫面二;
  92. [SerializeField] GameObject 畫面三;
  93. [SerializeField] GameObject 畫面五;
  94. [SerializeField] GameObject 畫面六;
  95. [SerializeField] GameObject 畫面七;
  96. [SerializeField] GameObject 畫面驗證碼;
  97. [SerializeField] GameObject 畫面彈出;
  98. [SerializeField] GameObject 有合約號返回;
  99. [SerializeField] GameObject 購物按鈕;
  100. [SerializeField] GameObject 申請按鈕;
  101. [SerializeField] GameObject 備註寫入葉面;
  102. [SerializeField] TextMeshProUGUI 彈出s;
  103. [SerializeField] TextMeshProUGUI 申請日期s;
  104. [SerializeField] TextMeshProUGUI 需求日期s;
  105. [SerializeField] TextMeshProUGUI Dates;
  106. [SerializeField] TextMeshProUGUI Nos;
  107. [SerializeField] TextMeshProUGUI A方s;
  108. [SerializeField] TextMeshProUGUI B方s;
  109. [SerializeField] TextMeshProUGUI 聲請人s;
  110. [SerializeField] TextMeshProUGUI 請購單號s;
  111. [SerializeField] TextMeshProUGUI 合約號和驗證碼;
  112. [SerializeField] TMP_InputField 備註s;
  113. [SerializeField] TMP_InputField 驗證碼;
  114. [SerializeField] TMP_InputField 備註ss;
  115. [SerializeField] Button 備註導入;
  116. [SerializeField] TMP_Dropdown 倉名下拉;
  117. [SerializeField] RawImage rowImage;
  118. [SerializeField] Image 末項_輸入數量;
  119. [SerializeField] TextMeshProUGUI 是否有合約號;
  120. [SerializeField] TextMeshProUGUI 選擇甲方;
  121. [SerializeField] TextMeshProUGUI 選擇合約;
  122. public Sprite 沒圖;
  123. private List<GameObject> copy = new List<GameObject>();
  124. private List<GameObject> copy1 = new List<GameObject>();
  125. private List<GameObject> copy2 = new List<GameObject>();
  126. private List<GameObject> copy3 = new List<GameObject>();
  127. private List<GameObject> copy4 = new List<GameObject>();
  128. private List<GameObject> copy5 = new List<GameObject>();
  129. private TextMeshProUGUI[] texts1;
  130. private TextMeshProUGUI[] texts2;
  131. private TextMeshProUGUI[] texts3;
  132. private Button[] bts;
  133. private Button[] bts1;
  134. string 合約號s;
  135. bool 有無合約號;
  136. string[] strArray = new string[4];
  137. string[] 倉儲 = new string[2];
  138. public CanvasScaler canvasScaler;
  139. public float idleTime = 300f; // 5分鐘的閒置時間
  140. private float timeSinceLastInteraction = 0f;
  141. private JSONNode jsonData;
  142. private float timer = 0f;
  143. private float interval = 60f;
  144. // Start is called before the first frame update
  145. [SerializeField] GameObject 讀取面板;
  146. [SerializeField] TextMeshProUGUI 讀取;
  147. private string loadingText = "";
  148. private int dotCount = 0;
  149. [SerializeField] GameObject 網頁面板;
  150. UniWebView webView;
  151. public GameObject panel;
  152. float scale = 0;
  153. float xbar = 0;
  154. float ybar = 0;
  155. RectTransform panelRectTransform;
  156. bool L;
  157. bool W;
  158. bool M;
  159. void Start()
  160. {
  161. Main.Global.qwe=true;
  162. Screen.autorotateToPortrait = false;
  163. Screen.orientation = ScreenOrientation.LandscapeLeft;
  164. float screenWidth = Screen.width;
  165. float screenHeight = Screen.height;
  166. float rate = screenWidth/screenHeight;
  167. if (canvasScaler == null)
  168. {
  169. canvasScaler = GetComponent<CanvasScaler>();
  170. }
  171. if (rate>1.6)
  172. {
  173. canvasScaler.matchWidthOrHeight = 1f;
  174. }
  175. else
  176. {
  177. canvasScaler.matchWidthOrHeight = 0f;
  178. }
  179. if (canvasScaler.matchWidthOrHeight == 0f)
  180. {
  181. scale = screenWidth / 1600;
  182. xbar=0;
  183. ybar=(screenHeight-(1000*scale))/2;
  184. }
  185. else
  186. {
  187. scale = screenHeight/ 1000;
  188. xbar=(screenWidth-(1600*scale))/2;
  189. ybar=0;
  190. }
  191. panelRectTransform = panel.GetComponent<RectTransform>();
  192. 畫面一.SetActive(true);
  193. 畫面二.SetActive(false);
  194. 畫面三.SetActive(false);
  195. 購物按鈕.SetActive(false);
  196. 申請按鈕.SetActive(false);
  197. //初始化系統語言();
  198. //Main.Global.系統語言="繁體中文";
  199. 系統語言轉換();
  200. 語言選擇按鈕();
  201. //Main.Global.阿帕契路徑="http://106.1.48.106:8080/wp-content/themes/event-star/tab.php?";
  202. //Main.Global.阿帕契路徑="http://103.231.201.230/hxpgsweb/wp-content/themes/twentytwentyone/tab.php?";
  203. //Main.Global.人員="李協叡";
  204. //Main.Global.預設伺服器路徑="tw";
  205. StartCoroutine(判斷更新());
  206. StartCoroutine(AnimateText());
  207. Main.Global.有無清單=false;
  208. DateTime currentDate = DateTime.Now;
  209. 申請日期s.text=currentDate.ToString("yyyy/MM/dd");
  210. DateTime today = DateTime.Today;
  211. DateTime sevenDaysLater = today.AddDays(7);
  212. 需求日期s.text=sevenDaysLater.ToString("yyyy/MM/dd");
  213. 讀取面板.SetActive(true);
  214. 網頁(panelRectTransform, scale, xbar, ybar);
  215. StartCoroutine(倉名讀取());
  216. }
  217. IEnumerator AnimateText()
  218. {
  219. string qqq = 讀取.text.ToString();
  220. while (true)
  221. {
  222. yield return new WaitForSeconds(0.5f);
  223. if (dotCount < 3)
  224. {
  225. loadingText += ".";
  226. dotCount++;
  227. }
  228. else
  229. {
  230. loadingText = "";
  231. dotCount = 0;
  232. }
  233. 讀取.text = qqq+loadingText;
  234. }
  235. }
  236. void Update()
  237. {
  238. timer += Time.deltaTime;
  239. // 判斷是否達到時間間隔
  240. if (timer >= interval)
  241. {
  242. StartCoroutine(判斷更新());
  243. timer = 0f;
  244. }
  245. if (Main.Global.快速登入==false)
  246. {
  247. if (Input.anyKeyDown)
  248. {
  249. timeSinceLastInteraction = 0f;
  250. }
  251. else
  252. {
  253. timeSinceLastInteraction += Time.deltaTime;
  254. if (timeSinceLastInteraction > idleTime)
  255. {
  256. string qwe = 請購單號s.text;
  257. StartCoroutine(刪除請購單(qwe));
  258. change_Secen(1);
  259. }
  260. }
  261. }
  262. }
  263. IEnumerator 判斷更新()
  264. {
  265. string strcon = "更新";
  266. string strUrl = string.Format(Main.Global.阿帕契路徑+"comm={0}", strcon);
  267. UnityWebRequest request = UnityWebRequest.Get(strUrl);
  268. yield return request.SendWebRequest();
  269. if (request.result == UnityWebRequest.Result.ConnectionError)
  270. {
  271. yield break;
  272. }
  273. string str = request.downloadHandler.text.ToString();
  274. Debug.Log(str);
  275. if (str == "系統更新")
  276. {
  277. string qwe = 請購單號s.text;
  278. StartCoroutine(刪除請購單(qwe));
  279. change_Secen(1);
  280. }
  281. }
  282. IEnumerator 採購合約清單(string asd)
  283. {
  284. string strcon1 = "採購合約清單";
  285. string se = Main.Global.預設伺服器路徑;
  286. string strUrl1 = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&甲={2}", strcon1, se, asd);
  287. UnityWebRequest request1 = UnityWebRequest.Get(strUrl1);
  288. yield return request1.SendWebRequest();
  289. if (request1.result == UnityWebRequest.Result.ConnectionError)
  290. {
  291. //Debug.Log(request.error);
  292. yield break;
  293. }
  294. JSONNode json = JSON.Parse(request1.downloadHandler.text);
  295. int sum = 0;
  296. for (int i = 0; i < json.Count; i++)
  297. {
  298. GameObject buttonObj = Instantiate(buttonPrefab) as GameObject;
  299. buttonObj.GetComponent<RectTransform>().anchoredPosition = new Vector2(2, -sum);
  300. buttonObj.transform.SetParent(buttonParent, false);
  301. Button newButton = buttonObj.GetComponentInChildren<Button>();
  302. string idname = json[i][0].ToString();
  303. idname=idname.Trim('"');
  304. newButton.onClick.AddListener(() => OnClick(idname));
  305. texts = buttonObj.GetComponentsInChildren<TextMeshProUGUI>();
  306. if (Main.Global.系統語言=="繁體中文" || Main.Global.系統語言=="簡體中文")
  307. {
  308. texts[0].text=json[i][0];
  309. texts[1].text=json[i][1];
  310. }
  311. else
  312. {
  313. texts[0].text=json[i][0];
  314. texts[1].text=json[i][2];
  315. }
  316. sum+=75;
  317. copy.Add(buttonObj);
  318. }
  319. buttonceneter.GetComponent<RectTransform>().sizeDelta = new Vector2(buttonceneter.GetComponent<RectTransform>().sizeDelta.x, sum);
  320. 讀取面板.SetActive(false);
  321. }
  322. IEnumerator 採購甲方讀取()
  323. {
  324. string strcon1 = "採購甲方讀取";
  325. string se = Main.Global.預設伺服器路徑;
  326. string strUrl1 = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}", strcon1, se);
  327. UnityWebRequest request1 = UnityWebRequest.Get(strUrl1);
  328. yield return request1.SendWebRequest();
  329. if (request1.result == UnityWebRequest.Result.ConnectionError)
  330. {
  331. //Debug.Log(request.error);
  332. yield break;
  333. }
  334. JSONNode json = JSON.Parse(request1.downloadHandler.text);
  335. for (int i = 0; i<json.Count; i++)
  336. {
  337. GameObject buttonObj = Instantiate(buttonPrefab1) as GameObject;
  338. float xPos = i % 4 * 350f;
  339. float yPos = i / 4 * -150f;
  340. buttonObj.GetComponent<RectTransform>().anchoredPosition = new Vector2(xPos, yPos);
  341. buttonObj.transform.SetParent(buttonParent1, false);
  342. Button newButton = buttonObj.GetComponentInChildren<Button>();
  343. string idname = json[i].ToString();
  344. idname=idname.Trim('"');
  345. buttonObj.GetComponentInChildren<TextMeshProUGUI>().text = idname;
  346. newButton.onClick.AddListener(() => OnClick1(idname));
  347. }
  348. 讀取面板.SetActive(false);
  349. }
  350. IEnumerator 倉名讀取()
  351. {
  352. List<TMP_Dropdown.OptionData> options1 = new List<TMP_Dropdown.OptionData>();
  353. 倉名下拉.options.Clear();
  354. string strcon1 = "倉名讀取";
  355. string se = Main.Global.預設伺服器路徑;
  356. string strUrl1 = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}", strcon1, se);
  357. UnityWebRequest request1 = UnityWebRequest.Get(strUrl1);
  358. yield return request1.SendWebRequest();
  359. if (request1.result == UnityWebRequest.Result.ConnectionError)
  360. {
  361. //Debug.Log(request.error);
  362. yield break;
  363. }
  364. JSONNode json = JSON.Parse(request1.downloadHandler.text);
  365. options1.Add(new TMP_Dropdown.OptionData(""));
  366. for (int i = 0; i<json.Count; i++)
  367. {
  368. string str = json[i].ToString();
  369. str=str.Trim('"');
  370. options1.Add(new TMP_Dropdown.OptionData(str));
  371. }
  372. 倉名下拉.AddOptions(options1);
  373. yield return StartCoroutine(採購甲方讀取());
  374. }
  375. public void DeletetextCopy()
  376. {
  377. // 刪除複製出來的物件
  378. foreach (GameObject i in copy)
  379. {
  380. Destroy(i);
  381. }
  382. copy.Clear();
  383. }
  384. public void DeletetextCopy1()
  385. {
  386. // 刪除複製出來的物件
  387. foreach (GameObject i in copy1)
  388. {
  389. Destroy(i);
  390. }
  391. copy1.Clear();
  392. }
  393. public void DeletetextCopy2()
  394. {
  395. // 刪除複製出來的物件
  396. foreach (GameObject i in copy2)
  397. {
  398. Destroy(i);
  399. }
  400. copy2.Clear();
  401. }
  402. public void DeletetextCopy5()
  403. {
  404. // 刪除複製出來的物件
  405. foreach (GameObject i in copy5)
  406. {
  407. Destroy(i);
  408. }
  409. copy5.Clear();
  410. }
  411. public void DeletetextCopy34()
  412. {
  413. // 刪除複製出來的物件
  414. foreach (GameObject i in copy3)
  415. {
  416. Destroy(i);
  417. }
  418. copy3.Clear();
  419. foreach (GameObject i in copy4)
  420. {
  421. Destroy(i);
  422. }
  423. copy4.Clear();
  424. }
  425. public void 讀取倉儲()
  426. {
  427. StartCoroutine(倉儲資料());
  428. }
  429. IEnumerator 倉儲資料()
  430. {
  431. string strcon1 = "倉儲資料";
  432. string se = Main.Global.預設伺服器路徑;
  433. string pa = 倉名下拉.options[倉名下拉.value].text;
  434. string strUrl1 = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&PA22={2}", strcon1, se, pa);
  435. UnityWebRequest request1 = UnityWebRequest.Get(strUrl1);
  436. yield return request1.SendWebRequest();
  437. if (request1.result == UnityWebRequest.Result.ConnectionError)
  438. {
  439. //Debug.Log(request.error);
  440. yield break;
  441. }
  442. JSONNode json = JSON.Parse(request1.downloadHandler.text);
  443. 倉儲[0]=json[0];
  444. 倉儲[1]=json[1];
  445. //Debug.Log(倉儲[1]);
  446. }
  447. public void OnClick(string name)
  448. {
  449. 合約號s=name;
  450. 畫面一.SetActive(false);
  451. 畫面二.SetActive(false);
  452. 畫面三.SetActive(false);
  453. 畫面四.SetActive(true);
  454. 購物按鈕.SetActive(true);
  455. 申請按鈕.SetActive(true);
  456. 合約號和驗證碼.text=name;
  457. string[] substrings = name.Split(' ');
  458. string[] result = new string[substrings.Length * 2];
  459. for (int i = 0; i < substrings.Length; i++)
  460. {
  461. string[] parts = substrings[i].Split('-');
  462. result[i * 2] = parts[0];
  463. result[i * 2 + 1] = parts[1];
  464. }
  465. B方s.text=result[0];
  466. A方s.text=result[1];
  467. Dates.text=result[2];
  468. Nos.text=result[3];
  469. if (copy5 != null)
  470. {
  471. DeletetextCopy5();
  472. }
  473. StartCoroutine(流水號查詢());
  474. }
  475. public void 無合約button()
  476. {
  477. 有無合約號=false;
  478. 畫面一.SetActive(false);
  479. 畫面二.SetActive(false);
  480. 畫面三.SetActive(false);
  481. 畫面四.SetActive(true);
  482. 購物按鈕.SetActive(true);
  483. 申請按鈕.SetActive(true);
  484. 畫面驗證碼.SetActive(true);
  485. }
  486. public void 有合約button()
  487. {
  488. 有無合約號=true;
  489. 畫面一.SetActive(false);
  490. 畫面二.SetActive(true);
  491. 畫面三.SetActive(false);
  492. 畫面四.SetActive(false);
  493. 畫面驗證碼.SetActive(false);
  494. }
  495. public void 申請完成按鈕Y1()
  496. {
  497. if (Main.Global.系統語言=="繁體中文")
  498. {
  499. 彈出s.text="確認數量修改後是否儲存";
  500. }
  501. else if (Main.Global.系統語言=="簡體中文")
  502. {
  503. 彈出s.text="确认数量更改后是否保存";
  504. }
  505. else if (Main.Global.系統語言=="English")
  506. {
  507. 彈出s.text="Confirm to save the quantity changes";
  508. }
  509. else
  510. {
  511. 彈出s.text="Konfirmasi untuk menyimpan perubahan kuantitas";
  512. }
  513. 彈窗按鈕_底圖1.SetActive(true);
  514. 彈窗按鈕_底圖2.SetActive(true);
  515. 彈窗按鈕_Y1.SetActive(false);
  516. 彈窗按鈕_N1.SetActive(false);
  517. 彈窗按鈕X.SetActive(true);
  518. 彈窗按鈕_Y.SetActive(true);
  519. 彈窗按鈕_N.SetActive(true);
  520. }
  521. public void 申請完成按鈕N1()
  522. {
  523. 彈窗按鈕X.SetActive(true);
  524. 畫面彈出.SetActive(false);
  525. 彈窗按鈕_Y1.SetActive(false);
  526. 彈窗按鈕_N1.SetActive(false);
  527. 彈窗按鈕_底圖1.SetActive(false);
  528. 彈窗按鈕_底圖2.SetActive(false);
  529. string qwe = 請購單號s.text;
  530. StartCoroutine(刪除請購單(qwe));
  531. 購物按鈕.SetActive(false);
  532. 申請按鈕.SetActive(false);
  533. Main.Global.有無清單=false;
  534. if (有無合約號==true)
  535. {
  536. 聲請人s.text="";
  537. 備註s.text="";
  538. 請購單號s.text="";
  539. 合約號和驗證碼.text="";
  540. B方s.text="";
  541. A方s.text="";
  542. Dates.text="";
  543. Nos.text="";
  544. 倉名下拉.value = 0;
  545. 倉儲[0]="";
  546. 倉儲[1]="";
  547. 畫面一.SetActive(false);
  548. 畫面二.SetActive(false);
  549. 畫面三.SetActive(true);
  550. 畫面四.SetActive(false);
  551. }
  552. else
  553. {
  554. 聲請人s.text="";
  555. 請購單號s.text="";
  556. 合約號和驗證碼.text="";
  557. 備註s.text="";
  558. 驗證碼.text="";
  559. 倉名下拉.value = 0;
  560. 倉儲[0]="";
  561. 倉儲[1]="";
  562. 畫面一.SetActive(true);
  563. 畫面二.SetActive(false);
  564. 畫面三.SetActive(false);
  565. 畫面四.SetActive(false);
  566. }
  567. }
  568. public void 上一頁()
  569. {
  570. if (畫面二.activeSelf)
  571. {
  572. 畫面一.SetActive(true);
  573. 畫面二.SetActive(false);
  574. 畫面三.SetActive(false);
  575. 畫面四.SetActive(false);
  576. }
  577. if (畫面三.activeSelf)
  578. {
  579. if (copy != null)
  580. {
  581. DeletetextCopy();
  582. }
  583. 畫面一.SetActive(false);
  584. 畫面二.SetActive(true);
  585. 畫面三.SetActive(false);
  586. 畫面四.SetActive(false);
  587. }
  588. if (畫面四.activeSelf)
  589. {
  590. if (Main.Global.有無清單==true)
  591. {
  592. 畫面彈出.SetActive(true);
  593. if (Main.Global.系統語言=="繁體中文")
  594. {
  595. 彈出s.text="有讀取到清單是否要完成申請";
  596. }
  597. else if (Main.Global.系統語言=="簡體中文")
  598. {
  599. 彈出s.text="有读取到清单是否要完成申请";
  600. }
  601. else if (Main.Global.系統語言=="English")
  602. {
  603. 彈出s.text="Do you want to complete the application since the list has been loaded";
  604. }
  605. else
  606. {
  607. 彈出s.text="Apakah Anda ingin menyelesaikan aplikasi karena daftar telah dimuat";
  608. }
  609. 彈窗按鈕_Y1.SetActive(true);
  610. 彈窗按鈕_N1.SetActive(true);
  611. 彈窗按鈕_底圖1.SetActive(true);
  612. 彈窗按鈕_底圖2.SetActive(true);
  613. 彈窗按鈕X.SetActive(false);
  614. }
  615. else
  616. {
  617. string qwe = 請購單號s.text;
  618. StartCoroutine(刪除請購單(qwe));
  619. 購物按鈕.SetActive(false);
  620. 申請按鈕.SetActive(false);
  621. if (有無合約號==true)
  622. {
  623. 聲請人s.text="";
  624. 備註s.text="";
  625. 請購單號s.text="";
  626. 合約號和驗證碼.text="";
  627. B方s.text="";
  628. A方s.text="";
  629. Dates.text="";
  630. Nos.text="";
  631. 倉名下拉.value = 0;
  632. 倉儲[0]="";
  633. 倉儲[1]="";
  634. 畫面一.SetActive(false);
  635. 畫面二.SetActive(false);
  636. 畫面三.SetActive(true);
  637. 畫面四.SetActive(false);
  638. }
  639. else
  640. {
  641. 聲請人s.text="";
  642. 請購單號s.text="";
  643. 合約號和驗證碼.text="";
  644. 備註s.text="";
  645. 驗證碼.text="";
  646. 倉名下拉.value = 0;
  647. 倉儲[0]="";
  648. 倉儲[1]="";
  649. 畫面一.SetActive(true);
  650. 畫面二.SetActive(false);
  651. 畫面三.SetActive(false);
  652. 畫面四.SetActive(false);
  653. }
  654. }
  655. }
  656. if (畫面五.activeSelf)
  657. {
  658. 畫面一.SetActive(false);
  659. 畫面二.SetActive(false);
  660. 畫面三.SetActive(false);
  661. 購物按鈕.SetActive(true);
  662. 申請按鈕.SetActive(true);
  663. 畫面四.SetActive(true);
  664. 畫面五.SetActive(false);
  665. 畫面六.SetActive(false);
  666. if (copy5 != null)
  667. {
  668. DeletetextCopy5();
  669. }
  670. StartCoroutine(明細表清單());
  671. }
  672. if (畫面六.activeSelf)
  673. {
  674. if (copy2 != null)
  675. {
  676. DeletetextCopy2();
  677. }
  678. 畫面一.SetActive(false);
  679. 畫面二.SetActive(false);
  680. 畫面三.SetActive(false);
  681. 畫面四.SetActive(false);
  682. 畫面五.SetActive(true);
  683. 畫面六.SetActive(false);
  684. }
  685. if (畫面七.activeSelf)
  686. {
  687. if (copy3 != null)
  688. {
  689. DeletetextCopy34();
  690. }
  691. rowImage.texture = Texture2D.blackTexture;
  692. 畫面一.SetActive(false);
  693. 畫面二.SetActive(false);
  694. 畫面三.SetActive(false);
  695. 畫面四.SetActive(false);
  696. 畫面五.SetActive(false);
  697. 畫面六.SetActive(true);
  698. 畫面七.SetActive(false);
  699. }
  700. }
  701. public void OnClick1(string asd)
  702. {
  703. 讀取面板.SetActive(true);
  704. if (copy != null)
  705. {
  706. DeletetextCopy();
  707. }
  708. StartCoroutine(採購合約清單(asd));
  709. 畫面一.SetActive(false);
  710. 畫面二.SetActive(false);
  711. 畫面三.SetActive(true);
  712. 畫面四.SetActive(false);
  713. }
  714. public void 購物()
  715. {
  716. if (畫面四.activeSelf)
  717. {
  718. if (倉名下拉.value == 0)
  719. {
  720. 畫面彈出.SetActive(true);
  721. if (Main.Global.系統語言=="繁體中文")
  722. {
  723. 彈出s.text="請選擇倉名";
  724. }
  725. else if (Main.Global.系統語言=="簡體中文")
  726. {
  727. 彈出s.text="请选择仓名";
  728. }
  729. else if (Main.Global.系統語言=="English")
  730. {
  731. 彈出s.text="Please select a warehouse name";
  732. }
  733. else
  734. {
  735. 彈出s.text="Silakan pilih nama gudang";
  736. }
  737. }
  738. else
  739. {
  740. 畫面五.SetActive(true);
  741. 購物按鈕.SetActive(false);
  742. 申請按鈕.SetActive(false);
  743. 畫面四.SetActive(false);
  744. }
  745. }
  746. }
  747. public void 關閉畫面驗證碼()
  748. {
  749. 畫面一.SetActive(true);
  750. 畫面二.SetActive(false);
  751. 畫面三.SetActive(false);
  752. 畫面四.SetActive(false);
  753. 畫面驗證碼.SetActive(false);
  754. }
  755. public void 關閉彈出視窗()
  756. {
  757. 畫面彈出.SetActive(false);
  758. 彈窗按鈕_Y.SetActive(false);
  759. 彈窗按鈕_N.SetActive(false);
  760. 彈窗按鈕_底圖1.SetActive(false);
  761. 彈窗按鈕_底圖2.SetActive(false);
  762. 彈出s.text="";
  763. }
  764. public void 驗證授權碼()
  765. {
  766. string qwe = 驗證碼.text;
  767. StartCoroutine(驗證碼查詢(qwe));
  768. }
  769. IEnumerator 驗證碼查詢(string qwe)
  770. {
  771. Debug.Log(qwe);
  772. string strcon = "授權碼驗證";
  773. string se = Main.Global.預設伺服器路徑;
  774. string strUrl = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&PA9={2}", strcon, se, qwe);
  775. UnityWebRequest request = UnityWebRequest.Get(strUrl);
  776. yield return request.SendWebRequest();
  777. if (request.result == UnityWebRequest.Result.ConnectionError)
  778. {
  779. //Debug.Log(request.error);
  780. yield break;
  781. }
  782. string res = request.downloadHandler.text;
  783. Debug.Log(res);
  784. if (res == "有")
  785. {
  786. 畫面驗證碼.SetActive(false);
  787. 合約號和驗證碼.text= qwe;
  788. StartCoroutine(流水號查詢());
  789. }
  790. else
  791. {
  792. 驗證碼.text="";
  793. 畫面一.SetActive(true);
  794. 畫面二.SetActive(false);
  795. 畫面三.SetActive(false);
  796. 畫面四.SetActive(false);
  797. 畫面驗證碼.SetActive(false);
  798. }
  799. }
  800. IEnumerator 流水號查詢()
  801. {
  802. DateTime td = DateTime.Now;
  803. string dateString = td.ToString("yyyyMMdd");
  804. string qwe = "";
  805. for (int i = 1; i<=999; i++)
  806. {
  807. if (i<10)
  808. {
  809. qwe = "CR-"+dateString+"-00"+i.ToString();
  810. }
  811. else if (i>=10 && i<100)
  812. {
  813. qwe = "CR-"+dateString+"-0"+i.ToString();
  814. }
  815. else if (i>99)
  816. {
  817. qwe = "CR-"+dateString+"-"+i.ToString();
  818. }
  819. string strcon = "流水號查詢";
  820. string se = Main.Global.預設伺服器路徑;
  821. string strUrl = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&PA={2}", strcon, se, qwe);
  822. UnityWebRequest request = UnityWebRequest.Get(strUrl);
  823. yield return request.SendWebRequest();
  824. if (request.result == UnityWebRequest.Result.ConnectionError)
  825. {
  826. //Debug.Log(request.error);
  827. yield break;
  828. }
  829. string res = request.downloadHandler.text;
  830. if (res == "有")
  831. {
  832. continue;
  833. }
  834. else
  835. {
  836. break;
  837. }
  838. }
  839. //Debug.Log(qwe);
  840. StartCoroutine(新增請購單(qwe));
  841. 聲請人s.text=Main.Global.人員;
  842. 請購單號s.text=qwe;
  843. }
  844. IEnumerator 新增請購單(string asd)
  845. {
  846. string strcon = "新增請購單";
  847. string pa = asd;
  848. string pa1 = Main.Global.人員;
  849. DateTime Date = DateTime.Now;
  850. string pa2 =Date.ToString("yyyy/MM/dd-HH:mm:ss");
  851. string pa3 = 合約號和驗證碼.text;
  852. string pa4 = "";
  853. string pa5 = B方s.text;
  854. string pa6 = A方s.text;
  855. string pa7 = Dates.text;
  856. string pa8 = Nos.text;
  857. string se = Main.Global.預設伺服器路徑;
  858. string strUrl = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&PA={2}&PA1={3}&PA2={4}&PA3={5}&PA4={6}&PA5={7}&PA6={8}&PA7={9}&PA8={10}"
  859. , strcon, se, pa, pa1, pa2, pa3, pa4, pa5, pa6, pa7, pa8);
  860. UnityWebRequest request = UnityWebRequest.Get(strUrl);
  861. yield return request.SendWebRequest();
  862. if (request.result != UnityWebRequest.Result.Success)
  863. {
  864. Debug.LogError(request.error);
  865. }
  866. else
  867. {
  868. 畫面彈出.SetActive(true);
  869. if (Main.Global.系統語言=="繁體中文")
  870. {
  871. 彈出s.text="請購單 " +asd+ " 新增成功";
  872. }
  873. else if (Main.Global.系統語言=="簡體中文")
  874. {
  875. 彈出s.text="请购单 " +asd+ " 新增成功";
  876. }
  877. else if (Main.Global.系統語言=="English")
  878. {
  879. 彈出s.text="Purchase order " +asd+ " added successfully";
  880. }
  881. else
  882. {
  883. 彈出s.text="Pesanan pembelian " +asd+ " berhasil ditambahkan";
  884. }
  885. StartCoroutine(加需求日期());
  886. }
  887. //Debug.Log(Main.Global.有無清單);
  888. }
  889. IEnumerator 加需求日期()
  890. {
  891. string strcon1 = "需求日期修改";
  892. string se = Main.Global.預設伺服器路徑;
  893. string pa1 = 請購單號s.text;
  894. string pa = 需求日期s.text;
  895. string strUrl1 = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&PA27={2}&PA28={3}", strcon1, se, pa, pa1);
  896. UnityWebRequest request1 = UnityWebRequest.Get(strUrl1);
  897. yield return request1.SendWebRequest();
  898. if (request1.result == UnityWebRequest.Result.ConnectionError)
  899. {
  900. //Debug.Log(request.error);
  901. yield break;
  902. }
  903. }
  904. IEnumerator 刪除請購單(string asd)
  905. {
  906. string strcon = "刪除請購單";
  907. string pa = asd;
  908. string se = Main.Global.預設伺服器路徑;
  909. string strUrl = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&PA={2}", strcon, se, pa);
  910. UnityWebRequest request = UnityWebRequest.Get(strUrl);
  911. yield return request.SendWebRequest();
  912. if (request.result != UnityWebRequest.Result.Success)
  913. {
  914. Debug.LogError(request.error);
  915. }
  916. yield return StartCoroutine(刪除請購單明細(asd));
  917. 畫面彈出.SetActive(true);
  918. if (Main.Global.系統語言=="繁體中文")
  919. {
  920. 彈出s.text="請購單 " +asd+ " 刪除成功";
  921. }
  922. else if (Main.Global.系統語言=="簡體中文")
  923. {
  924. 彈出s.text="请购单 " +asd+ " 删除成功";
  925. }
  926. else if (Main.Global.系統語言=="English")
  927. {
  928. 彈出s.text="Purchase order " +asd+ " deleted successfully";
  929. }
  930. else
  931. {
  932. 彈出s.text="Pesanan pembelian " +asd+ " berhasil dihapus";
  933. }
  934. }
  935. IEnumerator 刪除請購單明細(string asd)
  936. {
  937. string pa = asd;
  938. string se = Main.Global.預設伺服器路徑;
  939. string strcon1 = "刪除請購單明細";
  940. string strUrl1 = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&PA={2}", strcon1, se, pa);
  941. UnityWebRequest request1 = UnityWebRequest.Get(strUrl1);
  942. yield return request1.SendWebRequest();
  943. if (request1.result != UnityWebRequest.Result.Success)
  944. {
  945. Debug.LogError(request1.error);
  946. }
  947. }
  948. public void exit_click()
  949. {
  950. StartCoroutine(回首頁刪單());
  951. }
  952. private IEnumerator 回首頁刪單()
  953. {
  954. string qwe = 請購單號s.text;
  955. yield return StartCoroutine(刪除請購單(qwe));
  956. change_Secen(3);
  957. }
  958. public void change_Secen(int _screenNum)
  959. {
  960. SceneManager.LoadScene(_screenNum);
  961. }
  962. public void 管材()
  963. {
  964. if (copy1 != null)
  965. {
  966. DeletetextCopy1();
  967. }
  968. StartCoroutine(物料群組("管材"));
  969. 畫面五.SetActive(false);
  970. 畫面六.SetActive(true);
  971. }
  972. public void 電線()
  973. {
  974. if (copy1 != null)
  975. {
  976. DeletetextCopy1();
  977. }
  978. StartCoroutine(物料群組("電線"));
  979. 畫面五.SetActive(false);
  980. 畫面六.SetActive(true);
  981. }
  982. public void 電料()
  983. {
  984. if (copy1 != null)
  985. {
  986. DeletetextCopy1();
  987. }
  988. StartCoroutine(物料群組("電料"));
  989. 畫面五.SetActive(false);
  990. 畫面六.SetActive(true);
  991. }
  992. public void 槽架()
  993. {
  994. if (copy1 != null)
  995. {
  996. DeletetextCopy1();
  997. }
  998. StartCoroutine(物料群組("槽架"));
  999. 畫面五.SetActive(false);
  1000. 畫面六.SetActive(true);
  1001. }
  1002. public void 建材()
  1003. {
  1004. if (copy1 != null)
  1005. {
  1006. DeletetextCopy1();
  1007. }
  1008. StartCoroutine(物料群組("建材"));
  1009. 畫面五.SetActive(false);
  1010. 畫面六.SetActive(true);
  1011. }
  1012. public void 五金()
  1013. {
  1014. if (copy1 != null)
  1015. {
  1016. DeletetextCopy1();
  1017. }
  1018. StartCoroutine(物料群組("五金"));
  1019. 畫面五.SetActive(false);
  1020. 畫面六.SetActive(true);
  1021. }
  1022. public void 設備()
  1023. {
  1024. if (copy1 != null)
  1025. {
  1026. DeletetextCopy1();
  1027. }
  1028. StartCoroutine(物料群組("設備"));
  1029. 畫面五.SetActive(false);
  1030. 畫面六.SetActive(true);
  1031. }
  1032. public void 工具()
  1033. {
  1034. if (copy1 != null)
  1035. {
  1036. DeletetextCopy1();
  1037. }
  1038. StartCoroutine(物料群組("工具"));
  1039. 畫面五.SetActive(false);
  1040. 畫面六.SetActive(true);
  1041. }
  1042. public void 日用()
  1043. {
  1044. if (copy1 != null)
  1045. {
  1046. DeletetextCopy1();
  1047. }
  1048. StartCoroutine(物料群組("日用"));
  1049. 畫面五.SetActive(false);
  1050. 畫面六.SetActive(true);
  1051. }
  1052. public void 其他()
  1053. {
  1054. if (copy1 != null)
  1055. {
  1056. DeletetextCopy1();
  1057. }
  1058. StartCoroutine(物料群組("其他"));
  1059. 畫面五.SetActive(false);
  1060. 畫面六.SetActive(true);
  1061. }
  1062. IEnumerator 物料群組(string pa)
  1063. {
  1064. 讀取面板.SetActive(true);
  1065. string strcon1 = "物料群組";
  1066. string se = Main.Global.預設伺服器路徑;
  1067. string pa1 = "";
  1068. if (Main.Global.系統語言=="簡體中文")
  1069. {
  1070. pa1 = "繁體中文";
  1071. }
  1072. else
  1073. {
  1074. pa1 = Main.Global.系統語言;
  1075. }
  1076. string strUrl1 = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&PA10={2}&PA11={3}", strcon1, se, pa, pa1);
  1077. UnityWebRequest request1 = UnityWebRequest.Get(strUrl1);
  1078. yield return request1.SendWebRequest();
  1079. if (request1.result == UnityWebRequest.Result.ConnectionError)
  1080. {
  1081. //Debug.Log(request.error);
  1082. yield break;
  1083. }
  1084. JSONNode json = JSON.Parse(request1.downloadHandler.text);
  1085. int sum = 0;
  1086. for (int i = 0; i < json.Count; i++)
  1087. {
  1088. GameObject buttonObj = Instantiate(buttonPrefab2) as GameObject;
  1089. buttonObj.GetComponent<RectTransform>().anchoredPosition = new Vector2(0, -sum);
  1090. buttonObj.transform.SetParent(buttonParent2, false);
  1091. string idname = json[i][1].ToString();
  1092. idname=idname.Trim('"');
  1093. buttonObj.GetComponentInChildren<TextMeshProUGUI>().text = idname;
  1094. byte[] bytes = System.Convert.FromBase64String(json[i][2]);
  1095. Texture2D texture = new Texture2D(2, 2);
  1096. texture.LoadImage(bytes);
  1097. Button newButton = buttonObj.GetComponentInChildren<Button>();
  1098. string idname1 = json[i][0].ToString();
  1099. idname1=idname1.Trim('"');
  1100. newButton.onClick.AddListener(() => OnClick2(idname1));
  1101. buttonObj.GetComponentInChildren<RawImage>().texture = texture;
  1102. sum+=350;
  1103. copy1.Add(buttonObj);
  1104. }
  1105. buttonceneter2.GetComponent<RectTransform>().sizeDelta = new Vector2(buttonceneter2.GetComponent<RectTransform>().sizeDelta.x, sum);
  1106. 讀取面板.SetActive(false);
  1107. }
  1108. public void OnClick2(string asd)
  1109. {
  1110. if (copy2 != null)
  1111. {
  1112. DeletetextCopy2();
  1113. }
  1114. StartCoroutine(物料清單(asd));
  1115. }
  1116. IEnumerator 物料清單(string pa)
  1117. {
  1118. 讀取面板.SetActive(true);
  1119. string strcon1 = "物料清單";
  1120. string se = Main.Global.預設伺服器路徑;
  1121. string pa1 = "";
  1122. if (Main.Global.系統語言=="簡體中文")
  1123. {
  1124. pa1 = "繁體中文";
  1125. }
  1126. else
  1127. {
  1128. pa1 = Main.Global.系統語言;
  1129. }
  1130. string strUrl1 = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&PA12={2}&PA13={3}", strcon1, se, pa, pa1);
  1131. UnityWebRequest request1 = UnityWebRequest.Get(strUrl1);
  1132. yield return request1.SendWebRequest();
  1133. if (request1.result == UnityWebRequest.Result.ConnectionError)
  1134. {
  1135. //Debug.Log(request.error);
  1136. yield break;
  1137. }
  1138. JSONNode json = JSON.Parse(request1.downloadHandler.text);
  1139. int sum = 2;
  1140. for (int i = 0; i < json.Count; i++)
  1141. {
  1142. GameObject buttonObj = Instantiate(buttonPrefab3) as GameObject;
  1143. buttonObj.GetComponent<RectTransform>().anchoredPosition = new Vector2(2, -sum);
  1144. buttonObj.transform.SetParent(buttonParent3, false);
  1145. texts1 =buttonObj.GetComponentsInChildren<TextMeshProUGUI>();
  1146. texts1[0].text=(i+1).ToString();
  1147. string str = json[i][2].ToString();
  1148. str=str.Trim('"');
  1149. texts1[1].text=str;
  1150. string str1 = json[i][3].ToString();
  1151. str1=str1.Trim('"');
  1152. texts1[2].text=str1;
  1153. //byte[] bytes = System.Convert.FromBase64String(json[i][4]);
  1154. string asd = json[i][4].ToString().Trim('"');
  1155. string qwe = json[i][5].ToString().Trim('"');
  1156. string path = Application.persistentDataPath + "/image/"+asd +"_"+qwe+".jpg";
  1157. if (File.Exists(path))
  1158. {
  1159. // 讀取圖片
  1160. byte[] bytes = File.ReadAllBytes(path);
  1161. Texture2D texture = new Texture2D(2, 2);
  1162. texture.LoadImage(bytes);
  1163. buttonObj.GetComponentInChildren<RawImage>().texture = texture;
  1164. }
  1165. else
  1166. {
  1167. buttonObj.GetComponentInChildren<RawImage>().texture = 沒圖.texture;
  1168. }
  1169. Button newButton = buttonObj.GetComponentInChildren<Button>();
  1170. string idname1 = json[i][1].ToString();
  1171. idname1=idname1.Trim('"');
  1172. string idname = json[i][0].ToString();
  1173. idname=idname.Trim('"');
  1174. newButton.onClick.AddListener(() => OnClick3(idname1, idname, str));
  1175. sum+=150;
  1176. copy2.Add(buttonObj);
  1177. }
  1178. buttonceneter3.GetComponent<RectTransform>().sizeDelta = new Vector2(buttonceneter3.GetComponent<RectTransform>().sizeDelta.x, sum);
  1179. 讀取面板.SetActive(false);
  1180. }
  1181. public void OnClick3(string asd, string asd1, string asd2)
  1182. {
  1183. strArray[3]=asd;
  1184. strArray[2]=asd1;
  1185. strArray[0]=asd2;
  1186. 畫面六.SetActive(false);
  1187. 畫面七.SetActive(true);
  1188. StartCoroutine(物料規格讀取(asd));
  1189. }
  1190. IEnumerator 物料規格讀取(string pa)
  1191. {
  1192. 讀取面板.SetActive(true);
  1193. string strcon1 = "物料規格讀取";
  1194. string se = Main.Global.預設伺服器路徑;
  1195. string strUrl1 = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&PA14={2}", strcon1, se, pa);
  1196. UnityWebRequest request1 = UnityWebRequest.Get(strUrl1);
  1197. yield return request1.SendWebRequest();
  1198. if (request1.result == UnityWebRequest.Result.ConnectionError)
  1199. {
  1200. //Debug.Log(request.error);
  1201. yield break;
  1202. }
  1203. JSONNode json = JSON.Parse(request1.downloadHandler.text);
  1204. string str = json[4].ToString();
  1205. str=str.Trim('"');
  1206. string str1 = json[2].ToString();
  1207. str1=str1.Trim('"');
  1208. string str2 = json[1].ToString();
  1209. str2=str2.Trim('"');
  1210. string str3 = json[3].ToString();
  1211. str3=str3.Trim('"');
  1212. strArray[1]=str3;
  1213. StartCoroutine(物料規格抬頭讀取(str, str3, str1, str2));
  1214. StartCoroutine(物料圖檔讀取(str1, str2));
  1215. }
  1216. IEnumerator 物料規格抬頭讀取(string pa, string str3, string str1, string str2)
  1217. {
  1218. string strcon1 = "物料規格抬頭讀取";
  1219. string se = Main.Global.預設伺服器路徑;
  1220. string pa1 = "";
  1221. if (Main.Global.系統語言=="簡體中文")
  1222. {
  1223. pa1 = "繁體中文";
  1224. }
  1225. else
  1226. {
  1227. pa1 = Main.Global.系統語言;
  1228. }
  1229. string strUrl1 = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&PA15={2}&PA16={3}", strcon1, se, pa, pa1);
  1230. UnityWebRequest request1 = UnityWebRequest.Get(strUrl1);
  1231. yield return request1.SendWebRequest();
  1232. if (request1.result == UnityWebRequest.Result.ConnectionError)
  1233. {
  1234. //Debug.Log(request.error);
  1235. yield break;
  1236. }
  1237. JSONNode json = JSON.Parse(request1.downloadHandler.text);
  1238. float count = 0; // 要創建的Image數量
  1239. float spacing = 2; // Image之間的間隔
  1240. if (str3=="SQLB03")
  1241. {
  1242. count = 3;
  1243. }
  1244. else if (str3=="SQLB04")
  1245. {
  1246. count = 4;
  1247. }
  1248. else if (str3=="SQLB05")
  1249. {
  1250. count = 5;
  1251. }
  1252. else if (str3=="SQLB06")
  1253. {
  1254. count = 6;
  1255. }
  1256. else if (str3=="SQLB07")
  1257. {
  1258. count = 7;
  1259. }
  1260. else if (str3=="SQLB08")
  1261. {
  1262. count = 8;
  1263. }
  1264. float imageWidth = (1498 -202 - 94 - (count + 2) * spacing) / count; // 計算每個Image的寬度
  1265. for (int i = 0; i < count; i++)
  1266. {
  1267. // 創建新的Image
  1268. GameObject newImage = Instantiate(imagePrefab, paneltransform);
  1269. // 設置Image的寬度和位置
  1270. RectTransform rt = newImage.GetComponent<RectTransform>();
  1271. rt.sizeDelta = new Vector2(imageWidth, 73);
  1272. rt.anchoredPosition = new Vector2(98 + i * (imageWidth + spacing), -2);
  1273. rt.GetComponentInChildren<TextMeshProUGUI>().text =json[i+1];
  1274. copy3.Add(newImage);
  1275. }
  1276. 末項_輸入數量.transform.SetAsLastSibling();
  1277. StartCoroutine(物料規格(str1, str2, count));
  1278. }
  1279. IEnumerator 物料規格(string pa, string pa1, float count)
  1280. {
  1281. string strcon1 = "物料規格";
  1282. string se = Main.Global.預設伺服器路徑;
  1283. string strUrl1 = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&PA17={2}&PA18={3}", strcon1, se, pa, pa1);
  1284. UnityWebRequest request1 = UnityWebRequest.Get(strUrl1);
  1285. yield return request1.SendWebRequest();
  1286. if (request1.result == UnityWebRequest.Result.ConnectionError)
  1287. {
  1288. //Debug.Log(request.error);
  1289. yield break;
  1290. }
  1291. jsonData = JSON.Parse(request1.downloadHandler.text);
  1292. JSONNode json = JSON.Parse(request1.downloadHandler.text);
  1293. int sum = 0;
  1294. for (int i = 0; i < json.Count; i++)
  1295. {
  1296. jsonData[i][14]="0";
  1297. GameObject buttonObj = Instantiate(buttonPrefab4) as GameObject;
  1298. buttonObj.GetComponent<RectTransform>().anchoredPosition = new Vector2(2, -sum);
  1299. buttonObj.transform.SetParent(buttonParent4, false);
  1300. bts1 =buttonObj.GetComponentsInChildren<Button>();
  1301. texts2 =buttonObj.GetComponentsInChildren<TextMeshProUGUI>();
  1302. TMP_InputField inputField = buttonObj.GetComponentInChildren<TMP_InputField>();
  1303. inputField.contentType = TMP_InputField.ContentType.IntegerNumber;
  1304. inputField.onValidateInput += delegate (string input, int charIndex, char addedChar)
  1305. {
  1306. if (!char.IsDigit(addedChar)) // 如果輸入字符不是數字,則不顯示在輸入欄位中
  1307. {
  1308. return '\0';
  1309. }
  1310. return addedChar;
  1311. };
  1312. texts2[0].text=(i+1).ToString();
  1313. for (int j = 0; j < count; j++)
  1314. {
  1315. texts2[j+1].text=json[i][j+4];
  1316. }
  1317. texts2[(int)count+1].text="";
  1318. inputField.text="0";
  1319. string 料號 = json[i][2].ToString();
  1320. 料號=料號.Trim('"');
  1321. Button firstButton1 = bts1[0];
  1322. Button firstButton2 = bts1[1];
  1323. //TextMeshProUGUI Text = texts2[(int)count+1];
  1324. TMP_InputField ttt1 = inputField;
  1325. int row = i;
  1326. ttt1.onValueChanged.AddListener((string text) => {
  1327. jsonData[row][14]= ttt1.text;
  1328. });
  1329. firstButton1.onClick.AddListener(() =>
  1330. {
  1331. int kk = Int32.Parse(ttt1.text.ToString());
  1332. kk+=1;
  1333. ttt1.text = kk.ToString();
  1334. jsonData[row][14]= kk.ToString();
  1335. });
  1336. firstButton2.onClick.AddListener(() =>
  1337. {
  1338. int kk = Int32.Parse(ttt1.text.ToString());
  1339. if (kk>0)
  1340. {
  1341. kk-=1;
  1342. }
  1343. ttt1.text = kk.ToString();
  1344. jsonData[row][14]= kk.ToString();
  1345. });
  1346. ttt1.image.color = new Color(ttt1.image.color.r, ttt1.image.color.g, ttt1.image.color.b, 1f);
  1347. firstButton1.image.color = new Color(firstButton1.image.color.r, firstButton1.image.color.g, firstButton1.image.color.b, 1f);
  1348. firstButton2.image.color = new Color(firstButton2.image.color.r, firstButton2.image.color.g, firstButton2.image.color.b, 1f);
  1349. sum+=75;
  1350. copy4.Add(buttonObj);
  1351. }
  1352. buttonceneter4.GetComponent<RectTransform>().sizeDelta = new Vector2(buttonceneter4.GetComponent<RectTransform>().sizeDelta.x, sum);
  1353. 讀取面板.SetActive(false);
  1354. }
  1355. public void 規格表格()
  1356. {
  1357. JSONNode json = jsonData;
  1358. StartCoroutine(規格表格Coroutine(json));
  1359. }
  1360. private IEnumerator 規格表格Coroutine(JSONNode json)
  1361. {
  1362. for (int i = 0; i < json.Count; i++)
  1363. {
  1364. // Debug.Log(json[i][14]);
  1365. if (json[i][14] != "0")
  1366. {
  1367. string asd = json[i][14].ToString().Trim('"');
  1368. string qwe = json[i][15].ToString().Trim('"');
  1369. yield return StartCoroutine(新增物料驗證(qwe, asd));
  1370. }
  1371. }
  1372. if (copy3 != null)
  1373. {
  1374. DeletetextCopy34();
  1375. }
  1376. rowImage.texture = Texture2D.blackTexture;
  1377. 畫面一.SetActive(false);
  1378. 畫面二.SetActive(false);
  1379. 畫面三.SetActive(false);
  1380. 畫面四.SetActive(false);
  1381. 畫面五.SetActive(false);
  1382. 畫面六.SetActive(true);
  1383. 畫面七.SetActive(false);
  1384. 畫面彈出.SetActive(true);
  1385. if (Main.Global.系統語言=="繁體中文")
  1386. {
  1387. 彈出s.text="物料新增成功";
  1388. }
  1389. else if (Main.Global.系統語言=="簡體中文")
  1390. {
  1391. 彈出s.text="物料添加成功";
  1392. }
  1393. else if (Main.Global.系統語言=="English")
  1394. {
  1395. 彈出s.text="Material added successfully";
  1396. }
  1397. else
  1398. {
  1399. 彈出s.text="Bahan berhasil ditambahkan";
  1400. }
  1401. }
  1402. IEnumerator 物料圖檔讀取(string pa, string pa1)
  1403. {
  1404. string strcon1 = "物料圖檔讀取";
  1405. string se = Main.Global.預設伺服器路徑;
  1406. string strUrl1 = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&PA17={2}&PA18={3}", strcon1, se, pa, pa1);
  1407. UnityWebRequest request1 = UnityWebRequest.Get(strUrl1);
  1408. yield return request1.SendWebRequest();
  1409. if (request1.result == UnityWebRequest.Result.ConnectionError)
  1410. {
  1411. Debug.Log(request1.error);
  1412. yield break;
  1413. }
  1414. JSONNode json = JSON.Parse(request1.downloadHandler.text);
  1415. string asd = json[0].ToString().Trim('"');
  1416. string qwe = json[1].ToString().Trim('"');
  1417. string path = Application.persistentDataPath + "/image/"+asd +"_"+qwe+".jpg";
  1418. string folderPath = Application.persistentDataPath + "/image/";
  1419. // Debug.Log(asd+qwe);
  1420. if (File.Exists(path))
  1421. {
  1422. // 讀取圖片
  1423. byte[] bytes = File.ReadAllBytes(path);
  1424. Texture2D texture = new Texture2D(2, 2);
  1425. texture.LoadImage(bytes);
  1426. rowImage.texture = texture;
  1427. }
  1428. else
  1429. {
  1430. rowImage.texture = 沒圖.texture;
  1431. byte[] bytes = System.Convert.FromBase64String(json[2]);
  1432. string[] files = Directory.GetFiles(folderPath, asd+"*");
  1433. if (files.Length > 0)
  1434. {
  1435. foreach (string file in files)
  1436. {
  1437. File.Delete(file); // 刪除符合條件的檔案
  1438. }
  1439. }
  1440. File.WriteAllBytes(path, bytes);
  1441. }
  1442. }
  1443. IEnumerator 新增物料驗證(string a1 ,string a2)
  1444. {
  1445. string strcon1 = "新增物料驗證";
  1446. string se = Main.Global.預設伺服器路徑;
  1447. string pa = 請購單號s.text;
  1448. string pa1 = a1;
  1449. string strUrl1 = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&PA20={2}&PA21={3}", strcon1, se, pa, pa1);
  1450. UnityWebRequest request1 = UnityWebRequest.Get(strUrl1);
  1451. yield return request1.SendWebRequest();
  1452. if (request1.result == UnityWebRequest.Result.ConnectionError)
  1453. {
  1454. yield break;
  1455. }
  1456. string strcon = "明細表項次最後一筆";
  1457. string strUrl = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&PA20={2}", strcon, se, pa);
  1458. UnityWebRequest request = UnityWebRequest.Get(strUrl);
  1459. yield return request.SendWebRequest();
  1460. if (request.result == UnityWebRequest.Result.ConnectionError)
  1461. {
  1462. yield break;
  1463. }
  1464. string htm1 = request.downloadHandler.text;
  1465. string htm2 = request1.downloadHandler.text;
  1466. //Debug.Log(htm1);
  1467. // Debug.Log(htm2);
  1468. string 項次 = "";
  1469. if (htm2=="n")
  1470. {
  1471. if (htm1=="n")
  1472. {
  1473. 項次="01";
  1474. }
  1475. else
  1476. {
  1477. int num = Int32.Parse(htm1);
  1478. num+=1;
  1479. //Debug.Log(num);
  1480. if (num < 10)
  1481. {
  1482. 項次="0"+num.ToString();
  1483. }
  1484. else if (num > 9 && num<100)
  1485. {
  1486. 項次=num.ToString();
  1487. }
  1488. // Debug.Log(項次);
  1489. }
  1490. //Debug.Log(項次);
  1491. StartCoroutine(新增明細表(項次, a1, a2));
  1492. }
  1493. }
  1494. IEnumerator 新增明細表(string str,string b1,string b2)
  1495. {
  1496. string strcon2 = "明細表新增";
  1497. string se = Main.Global.預設伺服器路徑;
  1498. string a = 請購單號s.text;
  1499. string a1 = strArray[0];
  1500. string a2 = strArray[1];
  1501. string a3 = "";
  1502. string a4 = b2;
  1503. string a5 = "";
  1504. string a6 = 倉儲[1];
  1505. string a7 = str;
  1506. string a8 = strArray[2];
  1507. string a9 = strArray[3];
  1508. string a10 = b1;
  1509. string strUrl2 = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&PA={2}&PA1={3}&PA2={4}&PA3={5}&PA4={6}&PA5={7}&PA6={8}&PA7={9}&PA8={10}&PA9={11}&PA10={12}"
  1510. , strcon2, se, a, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
  1511. UnityWebRequest request2 = UnityWebRequest.Get(strUrl2);
  1512. yield return request2.SendWebRequest();
  1513. if (request2.result == UnityWebRequest.Result.ConnectionError)
  1514. {
  1515. yield break;
  1516. }
  1517. }
  1518. IEnumerator 明細表清單()
  1519. {
  1520. 讀取面板.SetActive(true);
  1521. Main.Global.有無清單=true;
  1522. string strcon1 = "明細表清單";
  1523. string se = Main.Global.預設伺服器路徑;
  1524. string pa = 請購單號s.text;
  1525. string pa1 = "";
  1526. if (Main.Global.系統語言=="簡體中文")
  1527. {
  1528. pa1 = "繁體中文";
  1529. }
  1530. else
  1531. {
  1532. pa1 = Main.Global.系統語言;
  1533. }
  1534. string strUrl1 = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&PA20={2}&PA16={3}", strcon1, se, pa, pa1);
  1535. UnityWebRequest request1 = UnityWebRequest.Get(strUrl1);
  1536. yield return request1.SendWebRequest();
  1537. if (request1.result == UnityWebRequest.Result.ConnectionError)
  1538. {
  1539. //Debug.Log(request.error);
  1540. yield break;
  1541. }
  1542. JSONNode json = JSON.Parse(request1.downloadHandler.text);
  1543. // Debug.Log(json.Count);
  1544. if (json.Count ==0)
  1545. {
  1546. Main.Global.有無清單=false;
  1547. }
  1548. //Debug.Log(json.Count);
  1549. int sum = 0;
  1550. for (int i = 0; i < json.Count; i++)
  1551. {
  1552. GameObject buttonObj = Instantiate(textPrefab) as GameObject;
  1553. buttonObj.GetComponent<RectTransform>().anchoredPosition = new Vector2(0, -sum);
  1554. buttonObj.transform.SetParent(textParent, false);
  1555. texts3 =buttonObj.GetComponentsInChildren<TextMeshProUGUI>();
  1556. bts=buttonObj.GetComponentsInChildren<Button>();
  1557. for (int j = 0; j < 7; j++)
  1558. {
  1559. if (j==3)
  1560. {
  1561. double amo = double.Parse(json[i][j+2]);
  1562. int iamo = (int)Math.Round(amo);
  1563. texts3[j].text= iamo.ToString();
  1564. }
  1565. if (j==0)
  1566. {
  1567. texts3[j].text=json[i][j+1];
  1568. }
  1569. if (j==1)
  1570. {
  1571. texts3[j].text=json[i][j+1];
  1572. }
  1573. if (j==2)
  1574. {
  1575. texts3[j].text=json[i][j+1];
  1576. }
  1577. if (j==4)
  1578. {
  1579. texts3[j].text=json[i][j+2];
  1580. }
  1581. }
  1582. string asd = json[i][13].ToString().Trim('"');
  1583. string qwe = json[i][14].ToString().Trim('"');
  1584. string path = Application.persistentDataPath + "/image/"+asd +"_"+qwe+".jpg";
  1585. if (File.Exists(path))
  1586. {
  1587. // 讀取圖片
  1588. byte[] bytes = File.ReadAllBytes(path);
  1589. Texture2D texture = new Texture2D(2, 2);
  1590. texture.LoadImage(bytes);
  1591. buttonObj.GetComponentInChildren<RawImage>().texture = texture;
  1592. }
  1593. else
  1594. {
  1595. buttonObj.GetComponentInChildren<RawImage>().texture = 沒圖.texture;
  1596. }
  1597. Button firstButton = bts[0];
  1598. Button firstButton1 = bts[1];
  1599. Button firstButton2 = bts[2];
  1600. Button firstButton3 = bts[3];
  1601. Button firstButton4 = bts[4];
  1602. TextMeshProUGUI fourthText = texts3[3];
  1603. TextMeshProUGUI zeroText = texts3[0];
  1604. TextMeshProUGUI fiveText = texts3[5];
  1605. firstButton.onClick.AddListener(() =>
  1606. {
  1607. int kk = Int32.Parse(fourthText.text.ToString());
  1608. kk+=1;
  1609. fourthText.text = kk.ToString();
  1610. });
  1611. firstButton1.onClick.AddListener(() =>
  1612. {
  1613. int kk = Int32.Parse(fourthText.text.ToString());
  1614. if (kk>1)
  1615. {
  1616. kk-=1;
  1617. }
  1618. fourthText.text = kk.ToString();
  1619. });
  1620. firstButton3.onClick.AddListener(() =>
  1621. {
  1622. string it = zeroText.text.ToString();
  1623. //Debug.Log(it);
  1624. StartCoroutine(明細表單項刪除(it, json.Count));
  1625. });
  1626. firstButton2.onClick.AddListener(() =>
  1627. {
  1628. string it = zeroText.text.ToString();
  1629. int kk = Int32.Parse(fourthText.text.ToString());
  1630. string it1 = fiveText.text.ToString();
  1631. StartCoroutine(明細表修改(kk.ToString(), it,it1));
  1632. });
  1633. int index = i;
  1634. firstButton4.onClick.AddListener(() =>
  1635. {
  1636. 備註寫入葉面.SetActive(true);
  1637. 畫面彈出.SetActive(true);
  1638. 備註ss.text=fiveText.text;
  1639. 備註導入.onClick.RemoveAllListeners();
  1640. 備註導入.onClick.AddListener(() =>
  1641. {
  1642. if (備註ss.text.ToString() != "")
  1643. {
  1644. fiveText.text = 備註ss.text;
  1645. }
  1646. 備註寫入葉面.SetActive(false);
  1647. 備註ss.text="";
  1648. });
  1649. });
  1650. sum+=100;
  1651. copy5.Add(buttonObj);
  1652. }
  1653. textceneter.GetComponent<RectTransform>().sizeDelta = new Vector2(textceneter.GetComponent<RectTransform>().sizeDelta.x, sum);
  1654. 讀取面板.SetActive(false);
  1655. }
  1656. IEnumerator 明細表修改(string a1, string a2, string a3)
  1657. {
  1658. string strcon1 = "明細表修改";
  1659. string se = Main.Global.預設伺服器路徑;
  1660. string pa = 請購單號s.text;
  1661. string pa1 = a1;
  1662. string pa2 = a2;
  1663. string pa3 = a3;
  1664. string strUrl1 = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&PA23={2}&PA24={3}&PA25={4}&PA30={5}", strcon1, se, pa1, pa, pa2,pa3);
  1665. UnityWebRequest request1 = UnityWebRequest.Get(strUrl1);
  1666. yield return request1.SendWebRequest();
  1667. if (request1.result == UnityWebRequest.Result.ConnectionError)
  1668. {
  1669. //Debug.Log(request.error);
  1670. yield break;
  1671. }
  1672. 畫面彈出.SetActive(true);
  1673. if (Main.Global.系統語言=="繁體中文")
  1674. {
  1675. 彈出s.text="數量/備註修改成功";
  1676. }
  1677. else if (Main.Global.系統語言=="簡體中文")
  1678. {
  1679. 彈出s.text="数量/备注修改成功";
  1680. }
  1681. else if (Main.Global.系統語言=="English")
  1682. {
  1683. 彈出s.text="Quantity/remark updated successfully";
  1684. }
  1685. else
  1686. {
  1687. 彈出s.text="Kuantitas/keterangan berhasil diperbarui";
  1688. }
  1689. }
  1690. IEnumerator 明細表單項刪除(string a1, int a)
  1691. {
  1692. string strcon1 = "明細表單項刪除";
  1693. string se = Main.Global.預設伺服器路徑;
  1694. string pa = 請購單號s.text;
  1695. string pa1 = a1;
  1696. string strUrl1 = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&PA24={2}&PA25={3}", strcon1, se, pa, pa1);
  1697. UnityWebRequest request1 = UnityWebRequest.Get(strUrl1);
  1698. yield return request1.SendWebRequest();
  1699. if (request1.result == UnityWebRequest.Result.ConnectionError)
  1700. {
  1701. //Debug.Log(request.error);
  1702. yield break;
  1703. }
  1704. 畫面彈出.SetActive(true);
  1705. 彈出s.text="項次"+a1+"刪除成功";
  1706. if (Main.Global.系統語言=="繁體中文")
  1707. {
  1708. 彈出s.text="項次"+a1+"刪除成功";
  1709. }
  1710. else if (Main.Global.系統語言=="簡體中文")
  1711. {
  1712. 彈出s.text="项次"+a1+"删除成功";
  1713. }
  1714. else if (Main.Global.系統語言=="English")
  1715. {
  1716. 彈出s.text="No"+a1+" deleted successfully.";
  1717. }
  1718. else
  1719. {
  1720. 彈出s.text="No"+a1+" Pilih Tanggal";
  1721. }
  1722. int k1 = Int32.Parse(a1);
  1723. if (a>k1)
  1724. {
  1725. for (int i = k1; i<a; i++)
  1726. {
  1727. string ori = "";
  1728. string newi = "";
  1729. int j = 0;
  1730. j=i+1;
  1731. if (i < 10)
  1732. {
  1733. newi="0"+i.ToString();
  1734. }
  1735. else if (i > 9 && i<100)
  1736. {
  1737. newi=i.ToString();
  1738. }
  1739. if (j < 10)
  1740. {
  1741. ori="0"+j.ToString();
  1742. }
  1743. else if (j > 9 && j<100)
  1744. {
  1745. ori=j.ToString();
  1746. }
  1747. yield return StartCoroutine(項次修改(ori, newi));
  1748. }
  1749. }
  1750. else
  1751. {
  1752. if (copy5 != null)
  1753. {
  1754. DeletetextCopy5();
  1755. }
  1756. StartCoroutine(明細表清單());
  1757. }
  1758. }
  1759. IEnumerator 項次修改(string a1, string a2)
  1760. {
  1761. string strcon1 = "項次修改";
  1762. string se = Main.Global.預設伺服器路徑;
  1763. string pa = 請購單號s.text;
  1764. string pa1 = a1;
  1765. string pa2 = a2;
  1766. string strUrl1 = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&PA24={2}&PA25={3}&PA26={4}", strcon1, se, pa, pa1, pa2);
  1767. UnityWebRequest request1 = UnityWebRequest.Get(strUrl1);
  1768. yield return request1.SendWebRequest();
  1769. if (request1.result == UnityWebRequest.Result.ConnectionError)
  1770. {
  1771. //Debug.Log(request.error);
  1772. yield break;
  1773. }
  1774. if (copy5 != null)
  1775. {
  1776. DeletetextCopy5();
  1777. }
  1778. StartCoroutine(明細表清單());
  1779. }
  1780. public void 網頁(RectTransform panelRectTransform, float scale, float xbar, float ybar)
  1781. {
  1782. var webViewGameObject = new GameObject("UniWebView");
  1783. webView = webViewGameObject.AddComponent<UniWebView>();
  1784. webView.Frame =new Rect(panelRectTransform.anchoredPosition.x*scale+xbar, (-panelRectTransform.anchoredPosition.y*scale)+ybar, panelRectTransform.sizeDelta.x*scale, panelRectTransform.sizeDelta.y*scale);
  1785. if (Main.Global.系統語言=="繁體中文" || Main.Global.系統語言=="簡體中文")
  1786. {
  1787. webView.Load("https://gcm-smart.com/2023/06/14/hx-pgs-erp-app-9/");
  1788. }
  1789. else
  1790. {
  1791. webView.Load("https://gcm-smart.com/2023/06/14/hx-pgs-erp-app-10/");
  1792. }
  1793. StartCoroutine(說明顯示查詢());
  1794. //webView.Show();
  1795. }
  1796. IEnumerator 說明顯示查詢()
  1797. {
  1798. string strcon1 = "說明顯示查詢";
  1799. string se = Main.Global.預設伺服器路徑;
  1800. string pb1 = Main.Global.人員;
  1801. string pb2 = "APP-9-10";
  1802. DateTime currentDate = DateTime.Now;
  1803. int year = currentDate.Year;
  1804. string ys = year.ToString();
  1805. int month = currentDate.Month;
  1806. string ms = "";
  1807. if (month < 10)
  1808. {
  1809. ms = "0"+month.ToString();
  1810. }
  1811. else
  1812. {
  1813. ms = month.ToString();
  1814. }
  1815. string strUrl1 = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&PB1={2}&PB2={3}&PB5={4}&PB6={5}", strcon1, se, pb1, pb2, ys, ms);
  1816. UnityWebRequest request1 = UnityWebRequest.Get(strUrl1);
  1817. yield return request1.SendWebRequest();
  1818. if (request1.result == UnityWebRequest.Result.ConnectionError)
  1819. {
  1820. //Debug.Log(request.error);
  1821. yield break;
  1822. }
  1823. JSONNode json = JSON.Parse(request1.downloadHandler.text);
  1824. int 開啟, 公告;
  1825. bool 是否新增 = false;
  1826. if (json.Count>0)
  1827. {
  1828. float floatValue = float.Parse(json[2].ToString().Trim('"'));
  1829. 開啟 = Mathf.RoundToInt(floatValue);
  1830. float floatValue1 = float.Parse(json[3].ToString().Trim('"'));
  1831. 公告 = Mathf.RoundToInt(floatValue1);
  1832. if (開啟<3)
  1833. {
  1834. 網頁面板.SetActive(true);
  1835. webView.Show();
  1836. 開啟+=1;
  1837. 公告+=1;
  1838. }
  1839. else
  1840. {
  1841. 開啟+=1;
  1842. }
  1843. }
  1844. else
  1845. {
  1846. 網頁面板.SetActive(true);
  1847. webView.Show();
  1848. 開啟 = 1;
  1849. 公告 = 1;
  1850. 是否新增 = true;
  1851. }
  1852. if (是否新增==true)
  1853. {
  1854. yield return StartCoroutine(說明顯示新增(開啟, 公告));
  1855. }
  1856. else
  1857. {
  1858. yield return StartCoroutine(說明顯示修改(開啟, 公告));
  1859. }
  1860. }
  1861. IEnumerator 說明顯示新增(int a1, int a2)
  1862. {
  1863. string strcon1 = "說明顯示新增";
  1864. string se = Main.Global.預設伺服器路徑;
  1865. string pb1 = Main.Global.人員;
  1866. string pb2 = "APP-9-10";
  1867. string pb3 = a1.ToString();
  1868. string pb4 = a2.ToString();
  1869. DateTime currentDate = DateTime.Now;
  1870. int year = currentDate.Year;
  1871. string ys = year.ToString();
  1872. int month = currentDate.Month;
  1873. string ms = "";
  1874. if (month < 10)
  1875. {
  1876. ms = "0"+month.ToString();
  1877. }
  1878. else
  1879. {
  1880. ms = month.ToString();
  1881. }
  1882. 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);
  1883. UnityWebRequest request1 = UnityWebRequest.Get(strUrl1);
  1884. yield return request1.SendWebRequest();
  1885. if (request1.result == UnityWebRequest.Result.ConnectionError)
  1886. {
  1887. //Debug.Log(request.error);
  1888. yield break;
  1889. }
  1890. }
  1891. IEnumerator 說明顯示修改(int a1, int a2)
  1892. {
  1893. string strcon1 = "說明顯示修改";
  1894. string se = Main.Global.預設伺服器路徑;
  1895. string pb1 = Main.Global.人員;
  1896. string pb2 = "APP-9-10";
  1897. string pb3 = a1.ToString();
  1898. string pb4 = a2.ToString();
  1899. DateTime currentDate = DateTime.Now;
  1900. int year = currentDate.Year;
  1901. string ys = year.ToString();
  1902. int month = currentDate.Month;
  1903. string ms = "";
  1904. if (month < 10)
  1905. {
  1906. ms = "0"+month.ToString();
  1907. }
  1908. else
  1909. {
  1910. ms = month.ToString();
  1911. }
  1912. 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);
  1913. UnityWebRequest request1 = UnityWebRequest.Get(strUrl1);
  1914. yield return request1.SendWebRequest();
  1915. if (request1.result == UnityWebRequest.Result.ConnectionError)
  1916. {
  1917. //Debug.Log(request.error);
  1918. yield break;
  1919. }
  1920. }
  1921. public void 網頁面板關閉()
  1922. {
  1923. 網頁面板.SetActive(false);
  1924. webView.Hide();
  1925. //Destroy(webView);
  1926. }
  1927. public void 網頁面板開啟()
  1928. {
  1929. 網頁面板.SetActive(true);
  1930. webView.Show();
  1931. //Destroy(webView);
  1932. }
  1933. public void 備註修改()
  1934. {
  1935. StartCoroutine(控制表備註修改());
  1936. 畫面彈出.SetActive(true);
  1937. if (Main.Global.系統語言=="繁體中文")
  1938. {
  1939. 彈出s.text="備註修改成功";
  1940. }
  1941. else if (Main.Global.系統語言=="簡體中文")
  1942. {
  1943. 彈出s.text="备注修改成功";
  1944. }
  1945. else if (Main.Global.系統語言=="English")
  1946. {
  1947. 彈出s.text="Remark modified successfully";
  1948. }
  1949. else
  1950. {
  1951. 彈出s.text="Keterangan berhasil diubah";
  1952. }
  1953. }
  1954. IEnumerator 控制表備註修改()
  1955. {
  1956. string strcon1 = "控制表備註修改";
  1957. string se = Main.Global.預設伺服器路徑;
  1958. string pa = 請購單號s.text;
  1959. string pa1 = 備註s.text;
  1960. string strUrl1 = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&PA={2}&PA3={3}", strcon1, se, pa, pa1);
  1961. UnityWebRequest request1 = UnityWebRequest.Get(strUrl1);
  1962. yield return request1.SendWebRequest();
  1963. if (request1.result == UnityWebRequest.Result.ConnectionError)
  1964. {
  1965. //Debug.Log(request.error);
  1966. yield break;
  1967. }
  1968. }
  1969. public void 申請完成按鈕()
  1970. {
  1971. if (Main.Global.有無清單==true)
  1972. {
  1973. 畫面彈出.SetActive(true);
  1974. if (Main.Global.系統語言=="繁體中文")
  1975. {
  1976. 彈出s.text="確認數量修改/加入備註後是否儲存";
  1977. }
  1978. else if (Main.Global.系統語言=="簡體中文")
  1979. {
  1980. 彈出s.text="确认数量修改/添加备注后是否保存";
  1981. }
  1982. else if (Main.Global.系統語言=="English")
  1983. {
  1984. 彈出s.text="Save after modifying/adding notes to the confirmed quantity";
  1985. }
  1986. else
  1987. {
  1988. 彈出s.text="Simpan setelah memodifikasi/menambah catatan ke kuantitas yang dikonfirmasi";
  1989. }
  1990. 彈窗按鈕_Y.SetActive(true);
  1991. 彈窗按鈕_N.SetActive(true);
  1992. 彈窗按鈕_底圖1.SetActive(true);
  1993. 彈窗按鈕_底圖2.SetActive(true);
  1994. }
  1995. else
  1996. {
  1997. 畫面彈出.SetActive(true);
  1998. if (Main.Global.系統語言=="繁體中文")
  1999. {
  2000. 彈出s.text="清單無任何物料";
  2001. }
  2002. else if (Main.Global.系統語言=="簡體中文")
  2003. {
  2004. 彈出s.text="清单中没有任何物品";
  2005. }
  2006. else if (Main.Global.系統語言=="English")
  2007. {
  2008. 彈出s.text="No items in the list";
  2009. }
  2010. else
  2011. {
  2012. 彈出s.text="Tidak ada item dalam daftar";
  2013. }
  2014. }
  2015. }
  2016. public void 申請完成按鈕Y()
  2017. {
  2018. StartCoroutine(倉儲修改());
  2019. }
  2020. public void 申請完成按鈕N()
  2021. {
  2022. 畫面彈出.SetActive(false);
  2023. 彈窗按鈕_Y.SetActive(false);
  2024. 彈窗按鈕_N.SetActive(false);
  2025. 彈窗按鈕_底圖1.SetActive(false);
  2026. 彈窗按鈕_底圖2.SetActive(false);
  2027. 彈出s.text="";
  2028. }
  2029. IEnumerator 倉儲修改()
  2030. {
  2031. string strcon1 = "倉儲修改";
  2032. string se = Main.Global.預設伺服器路徑;
  2033. string pa1 = 請購單號s.text;
  2034. string pa = 倉儲[1];
  2035. string strUrl1 = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&PA1={2}&PA2={3}", strcon1, se, pa, pa1);
  2036. //Debug.Log(strUrl1);
  2037. UnityWebRequest request1 = UnityWebRequest.Get(strUrl1);
  2038. yield return request1.SendWebRequest();
  2039. if (request1.result == UnityWebRequest.Result.ConnectionError)
  2040. {
  2041. //Debug.Log(request.error);
  2042. yield break;
  2043. }
  2044. yield return StartCoroutine(需求日期修改());
  2045. }
  2046. IEnumerator 需求日期修改()
  2047. {
  2048. string strcon1 = "需求日期修改";
  2049. string se = Main.Global.預設伺服器路徑;
  2050. string pa1 = 請購單號s.text;
  2051. string pa = 需求日期s.text;
  2052. string strUrl1 = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&PA27={2}&PA28={3}", strcon1, se, pa, pa1);
  2053. UnityWebRequest request1 = UnityWebRequest.Get(strUrl1);
  2054. yield return request1.SendWebRequest();
  2055. if (request1.result == UnityWebRequest.Result.ConnectionError)
  2056. {
  2057. //Debug.Log(request.error);
  2058. yield break;
  2059. }
  2060. if (Main.Global.登入位置==true)
  2061. {
  2062. yield return StartCoroutine(人員級別讀取());
  2063. }
  2064. else
  2065. {
  2066. change_Secen(3);
  2067. }
  2068. }
  2069. IEnumerator 人員級別讀取()
  2070. {
  2071. string strcon1 = "級別";
  2072. string se = Main.Global.預設伺服器路徑;
  2073. string pa = 聲請人s.text;
  2074. string strUrl1 = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&姓名={2}", strcon1, se, pa);
  2075. UnityWebRequest request1 = UnityWebRequest.Get(strUrl1);
  2076. yield return request1.SendWebRequest();
  2077. if (request1.result == UnityWebRequest.Result.ConnectionError)
  2078. {
  2079. //Debug.Log(request.error);
  2080. yield break;
  2081. }
  2082. string str = request1.downloadHandler.text.ToString();
  2083. int 級 = int.Parse(str);
  2084. yield return StartCoroutine(人員主管清單(級));
  2085. }
  2086. IEnumerator 人員主管清單(int 級)
  2087. {
  2088. string strcon1 = "主管";
  2089. string se = Main.Global.預設伺服器路徑;
  2090. string pa = 聲請人s.text;
  2091. string strUrl1 = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&姓名={2}&LE={3}", strcon1, se, pa,級);
  2092. UnityWebRequest request1 = UnityWebRequest.Get(strUrl1);
  2093. yield return request1.SendWebRequest();
  2094. if (request1.result == UnityWebRequest.Result.ConnectionError)
  2095. {
  2096. //Debug.Log(request.error);
  2097. yield break;
  2098. }
  2099. JSONNode json = JSON.Parse(request1.downloadHandler.text);
  2100. JSONArray json1 = json["rows"].AsArray;
  2101. if (json1.Count == 1)
  2102. {
  2103. string 姓名 = json1[0][0].ToString().Trim('"');
  2104. yield return StartCoroutine(LINE_搜尋符合通知對象("CC207", 姓名));
  2105. }
  2106. else if (json1.Count > 1)
  2107. {
  2108. for (int i = 0; i < json1.Count; i++)
  2109. {
  2110. string 姓名 = json1[0][0].ToString().Trim('"');
  2111. yield return StartCoroutine(LINE_搜尋符合通知對象("CC207", 姓名));
  2112. }
  2113. }
  2114. yield return StartCoroutine(LINE_搜尋符合通知對象("CC207", "李協叡"));
  2115. change_Secen(3);
  2116. }
  2117. IEnumerator LINE_搜尋符合通知對象(string 代號, string 姓名)
  2118. {
  2119. string strcon1 = "LINE_搜尋符合通知對象";
  2120. string se = Main.Global.預設伺服器路徑;
  2121. string strUrl1 = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&PA9={2}&PA10={3}", strcon1, se, 代號, 姓名);
  2122. UnityWebRequest request1 = UnityWebRequest.Get(strUrl1);
  2123. yield return request1.SendWebRequest();
  2124. if (request1.result == UnityWebRequest.Result.ConnectionError)
  2125. {
  2126. Debug.Log(request1.error);
  2127. yield break;
  2128. }
  2129. JSONNode json = JSON.Parse(request1.downloadHandler.text);
  2130. if (json != null)
  2131. {
  2132. string token = json[1].ToString().Trim('"');
  2133. string 語言 = json[2].ToString().Trim('"');
  2134. string strcon = "LINE_通知內容";
  2135. string strUrl = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&PA9={2}", strcon, se, 代號);
  2136. UnityWebRequest request = UnityWebRequest.Get(strUrl);
  2137. yield return request.SendWebRequest();
  2138. if (request.result == UnityWebRequest.Result.ConnectionError)
  2139. {
  2140. Debug.Log(request.error);
  2141. yield break;
  2142. }
  2143. JSONNode json1 = JSON.Parse(request.downloadHandler.text);
  2144. string 內容 = "";
  2145. if (json1[1].ToString().Trim('"')== "A+X+B+Y+C")
  2146. {
  2147. string pa1 = 聲請人s.text.ToString();
  2148. string pa2 = "二日內";
  2149. 內容=json1[2].ToString().Trim('"')+ pa1+json1[3].ToString().Trim('"')+ pa2+json1[4].ToString().Trim('"');
  2150. }
  2151. if (json[6]==1)
  2152. {
  2153. L=true;
  2154. }
  2155. else
  2156. {
  2157. L=false;
  2158. }
  2159. if (json[7]==1)
  2160. {
  2161. W=true;
  2162. }
  2163. else
  2164. {
  2165. W=false;
  2166. }
  2167. if (json[8]==1)
  2168. {
  2169. M=true;
  2170. }
  2171. else
  2172. {
  2173. M=false;
  2174. }
  2175. if (L==true)
  2176. {
  2177. yield return StartCoroutine(LINE_發送內容(內容, token, 語言, "Line"));
  2178. }
  2179. string g1 = json[3].ToString().Trim('"');
  2180. string g2 = json[4].ToString().Trim('"');
  2181. string g3 = json[5].ToString().Trim('"');
  2182. if (W==true)
  2183. {
  2184. if (g1 != "")
  2185. {
  2186. yield return StartCoroutine(LINE_發送內容(內容, g1, 語言, "WhatsApp"));
  2187. }
  2188. if (g2 != "")
  2189. {
  2190. yield return StartCoroutine(LINE_發送內容(內容, g2, 語言, "WhatsApp"));
  2191. }
  2192. if (g3 != "")
  2193. {
  2194. yield return StartCoroutine(LINE_發送內容(內容, g3, 語言, "WhatsApp"));
  2195. }
  2196. }
  2197. if (M==true)
  2198. {
  2199. if (g1 != "")
  2200. {
  2201. yield return StartCoroutine(LINE_發送內容(內容, g1, 語言, "Message"));
  2202. }
  2203. if (g2 != "")
  2204. {
  2205. yield return StartCoroutine(LINE_發送內容(內容, g2, 語言, "Message"));
  2206. }
  2207. if (g3 != "")
  2208. {
  2209. yield return StartCoroutine(LINE_發送內容(內容, g3, 語言, "Message"));
  2210. }
  2211. }
  2212. }
  2213. }
  2214. IEnumerator LINE_發送內容(string a1, string a2, string a3, string a4)
  2215. {
  2216. string a = SQL_LINE_RandomCode();
  2217. string strcon1 = "LINE_發送內容";
  2218. string se = Main.Global.預設伺服器路徑;
  2219. string strUrl1 = string.Format(Main.Global.阿帕契路徑+"comm={0}&se={1}&PA4={2}&PA5={3}&PA6={4}&PA7={5}&PA8={6}", strcon1, se, a2, a1, a, a3, a4);
  2220. Debug.Log(strUrl1);
  2221. UnityWebRequest request1 = UnityWebRequest.Get(strUrl1);
  2222. yield return request1.SendWebRequest();
  2223. if (request1.result == UnityWebRequest.Result.ConnectionError)
  2224. {
  2225. Debug.Log(request1.error);
  2226. yield break;
  2227. }
  2228. }
  2229. public string SQL_LINE_RandomCode()
  2230. {
  2231. string rancode;
  2232. System.Random RndNum = new System.Random();
  2233. rancode = DateTime.Now.Year.ToString().Trim().PadLeft(4, '0') +
  2234. DateTime.Now.Month.ToString().Trim().PadLeft(2, '0') +
  2235. DateTime.Now.Day.ToString().Trim().PadLeft(2, '0') +
  2236. DateTime.Now.Hour.ToString().Trim().PadLeft(2, '0') +
  2237. DateTime.Now.Minute.ToString().Trim().PadLeft(2, '0') +
  2238. DateTime.Now.Second.ToString().Trim().PadLeft(2, '0') +
  2239. RndNum.Next(1000).ToString().Trim().PadLeft(4, '0');
  2240. return rancode;
  2241. }
  2242. private void OnApplicationQuit()
  2243. {
  2244. string qwe = 請購單號s.text;
  2245. StartCoroutine(刪除請購單(qwe));
  2246. StartCoroutine(刪除請購單明細(qwe));
  2247. }
  2248. public void setting_中()
  2249. {
  2250. Main.Global.系統語言="繁體中文";
  2251. 系統語言轉換();
  2252. 語言選擇按鈕();
  2253. 語言選擇面板.SetActive(false);
  2254. webView.Load("https://gcm-smart.com/2023/06/14/hx-pgs-erp-app-9/");
  2255. }
  2256. public void setting_簡()
  2257. {
  2258. Main.Global.系統語言="簡體中文";
  2259. 系統語言轉換();
  2260. 語言選擇按鈕();
  2261. 語言選擇面板.SetActive(false);
  2262. webView.Load("https://gcm-smart.com/2023/06/14/hx-pgs-erp-app-9/");
  2263. }
  2264. public void setting_英()
  2265. {
  2266. Main.Global.系統語言="English";
  2267. 系統語言轉換();
  2268. 語言選擇按鈕();
  2269. 語言選擇面板.SetActive(false);
  2270. webView.Load("https://gcm-smart.com/2023/06/14/hx-pgs-erp-app-10/");
  2271. }
  2272. public void setting_印()
  2273. {
  2274. Main.Global.系統語言="Indonesian";
  2275. 系統語言轉換();
  2276. 語言選擇按鈕();
  2277. 語言選擇面板.SetActive(false);
  2278. webView.Load("https://gcm-smart.com/2023/06/14/hx-pgs-erp-app-10/");
  2279. }
  2280. public void setting_click()
  2281. {
  2282. 語言選擇面板.SetActive(true);
  2283. }
  2284. public void setting_exit()
  2285. {
  2286. 語言選擇面板.SetActive(false);
  2287. }
  2288. public void 語言選擇按鈕()
  2289. {
  2290. if (bts == null)
  2291. {
  2292. if (Main.Global.系統語言=="繁體中文")
  2293. {
  2294. bts = new Button[] { 簡按鈕, 英按鈕, 印按鈕, 中按鈕 };
  2295. }
  2296. else if (Main.Global.系統語言=="簡體中文")
  2297. {
  2298. bts = new Button[] { 中按鈕, 英按鈕, 印按鈕, 簡按鈕 };
  2299. }
  2300. else if (Main.Global.系統語言=="English")
  2301. {
  2302. bts = new Button[] { 中按鈕, 簡按鈕, 印按鈕, 英按鈕 };
  2303. }
  2304. else
  2305. {
  2306. bts = new Button[] { 中按鈕, 簡按鈕, 英按鈕, 印按鈕 };
  2307. }
  2308. }
  2309. else
  2310. {
  2311. for (int j = 0; j < bts.Length; j++)
  2312. {
  2313. bts[j] = null;
  2314. }
  2315. if (Main.Global.系統語言=="繁體中文")
  2316. {
  2317. bts = new Button[] { 簡按鈕, 英按鈕, 印按鈕, 中按鈕 };
  2318. }
  2319. else if (Main.Global.系統語言=="簡體中文")
  2320. {
  2321. bts = new Button[] { 中按鈕, 英按鈕, 印按鈕, 簡按鈕 };
  2322. }
  2323. else if (Main.Global.系統語言=="English")
  2324. {
  2325. bts = new Button[] { 中按鈕, 簡按鈕, 印按鈕, 英按鈕 };
  2326. }
  2327. else
  2328. {
  2329. bts = new Button[] { 中按鈕, 簡按鈕, 英按鈕, 印按鈕 };
  2330. }
  2331. }
  2332. for (int i = 0; i < bts.Length; i++)
  2333. {
  2334. RectTransform rectTransform = bts[i].GetComponent<RectTransform>();
  2335. if (i==3)
  2336. {
  2337. rectTransform.anchoredPosition = new Vector2(1200, 1200);
  2338. }
  2339. else
  2340. {
  2341. rectTransform.anchoredPosition = new Vector2(300*i, 0);
  2342. }
  2343. }
  2344. }
  2345. private void 系統語言轉換()
  2346. {
  2347. string 介面 = "H07";
  2348. if (Main.Global.系統語言=="繁體中文")
  2349. {
  2350. 中.text = Main.Global.系統語言字典[介面+"00CH"];
  2351. 英.text = Main.Global.系統語言字典[介面+"01CH"];
  2352. 印.text = Main.Global.系統語言字典[介面+"02CH"];
  2353. 簡.text = Main.Global.系統語言字典[介面+"04CH"];
  2354. 選擇語言.text = Main.Global.系統語言字典[介面+"03CH"];
  2355. 是否有合約號.text = Main.Global.系統語言字典[介面+"05CH"];
  2356. 選擇甲方.text = Main.Global.系統語言字典[介面+"06CH"];
  2357. 選擇合約.text = Main.Global.系統語言字典[介面+"07CH"];
  2358. 輸入授權碼.text = Main.Global.系統語言字典[介面+"09CH"];
  2359. 指定倉庫.text = Main.Global.系統語言字典[介面+"10CH"];
  2360. 申請人.text = Main.Global.系統語言字典[介面+"11CH"];
  2361. 請購單號.text = Main.Global.系統語言字典[介面+"12CH"];
  2362. 合約號.text = Main.Global.系統語言字典[介面+"13CH"];
  2363. 申請日期.text = Main.Global.系統語言字典[介面+"14CH"];
  2364. 需求日期.text = Main.Global.系統語言字典[介面+"15CH"];
  2365. 備註.text = Main.Global.系統語言字典[介面+"16CH"];
  2366. 項次.text = Main.Global.系統語言字典[介面+"17CH"];
  2367. 品名.text = Main.Global.系統語言字典[介面+"18CH"];
  2368. 規格.text = Main.Global.系統語言字典[介面+"19CH"];
  2369. 數量.text = Main.Global.系統語言字典[介面+"20CH"];
  2370. 單位.text = Main.Global.系統語言字典[介面+"21CH"];
  2371. 圖片.text = Main.Global.系統語言字典[介面+"22CH"];
  2372. 修改.text = Main.Global.系統語言字典[介面+"23CH"];
  2373. 刪除.text = Main.Global.系統語言字典[介面+"24CH"];
  2374. 管材s.text = Main.Global.系統語言字典[介面+"25CH"];
  2375. 電線s.text = Main.Global.系統語言字典[介面+"26CH"];
  2376. 電料s.text = Main.Global.系統語言字典[介面+"27CH"];
  2377. 槽架s.text = Main.Global.系統語言字典[介面+"28CH"];
  2378. 建材s.text = Main.Global.系統語言字典[介面+"29CH"];
  2379. 五金s.text = Main.Global.系統語言字典[介面+"30CH"];
  2380. 設備s.text = Main.Global.系統語言字典[介面+"31CH"];
  2381. 工具s.text = Main.Global.系統語言字典[介面+"32CH"];
  2382. 日用s.text = Main.Global.系統語言字典[介面+"33CH"];
  2383. 其他s.text = Main.Global.系統語言字典[介面+"34CH"];
  2384. 選擇主項.text = Main.Global.系統語言字典[介面+"35CH"];
  2385. 選擇物料.text = Main.Global.系統語言字典[介面+"36CH"];
  2386. 選擇規格數量.text = Main.Global.系統語言字典[介面+"37CH"];
  2387. }
  2388. else if (Main.Global.系統語言=="簡體中文")
  2389. {
  2390. 中.text = Main.Global.系統語言字典[介面+"00CS"];
  2391. 英.text = Main.Global.系統語言字典[介面+"01CS"];
  2392. 印.text = Main.Global.系統語言字典[介面+"02CS"];
  2393. 簡.text = Main.Global.系統語言字典[介面+"04CS"];
  2394. 選擇語言.text = Main.Global.系統語言字典[介面+"03CS"];
  2395. 是否有合約號.text = Main.Global.系統語言字典[介面+"05CS"];
  2396. 選擇甲方.text = Main.Global.系統語言字典[介面+"06CS"];
  2397. 選擇合約.text = Main.Global.系統語言字典[介面+"07CS"];
  2398. 輸入授權碼.text = Main.Global.系統語言字典[介面+"09CS"];
  2399. 指定倉庫.text = Main.Global.系統語言字典[介面+"10CS"];
  2400. 申請人.text = Main.Global.系統語言字典[介面+"11CS"];
  2401. 請購單號.text = Main.Global.系統語言字典[介面+"12CS"];
  2402. 合約號.text = Main.Global.系統語言字典[介面+"13CS"];
  2403. 申請日期.text = Main.Global.系統語言字典[介面+"14CS"];
  2404. 需求日期.text = Main.Global.系統語言字典[介面+"15CS"];
  2405. 備註.text = Main.Global.系統語言字典[介面+"16CS"];
  2406. 項次.text = Main.Global.系統語言字典[介面+"17CS"];
  2407. 品名.text = Main.Global.系統語言字典[介面+"18CS"];
  2408. 規格.text = Main.Global.系統語言字典[介面+"19CS"];
  2409. 數量.text = Main.Global.系統語言字典[介面+"20CS"];
  2410. 單位.text = Main.Global.系統語言字典[介面+"21CS"];
  2411. 圖片.text = Main.Global.系統語言字典[介面+"22CS"];
  2412. 修改.text = Main.Global.系統語言字典[介面+"23CS"];
  2413. 刪除.text = Main.Global.系統語言字典[介面+"24CS"];
  2414. 管材s.text = Main.Global.系統語言字典[介面+"25CS"];
  2415. 電線s.text = Main.Global.系統語言字典[介面+"26CS"];
  2416. 電料s.text = Main.Global.系統語言字典[介面+"27CS"];
  2417. 槽架s.text = Main.Global.系統語言字典[介面+"28CS"];
  2418. 建材s.text = Main.Global.系統語言字典[介面+"29CS"];
  2419. 五金s.text = Main.Global.系統語言字典[介面+"30CS"];
  2420. 設備s.text = Main.Global.系統語言字典[介面+"31CS"];
  2421. 工具s.text = Main.Global.系統語言字典[介面+"32CS"];
  2422. 日用s.text = Main.Global.系統語言字典[介面+"33CS"];
  2423. 其他s.text = Main.Global.系統語言字典[介面+"34CS"];
  2424. 選擇主項.text = Main.Global.系統語言字典[介面+"35CS"];
  2425. 選擇物料.text = Main.Global.系統語言字典[介面+"36CS"];
  2426. 選擇規格數量.text = Main.Global.系統語言字典[介面+"37CS"];
  2427. }
  2428. else if (Main.Global.系統語言=="English")
  2429. {
  2430. 中.text = Main.Global.系統語言字典[介面+"00EN"];
  2431. 英.text = Main.Global.系統語言字典[介面+"01EN"];
  2432. 印.text = Main.Global.系統語言字典[介面+"02EN"];
  2433. 簡.text = Main.Global.系統語言字典[介面+"04EN"];
  2434. 選擇語言.text = Main.Global.系統語言字典[介面+"03EN"];
  2435. 是否有合約號.text = Main.Global.系統語言字典[介面+"05EN"];
  2436. 選擇甲方.text = Main.Global.系統語言字典[介面+"06EN"];
  2437. 選擇合約.text = Main.Global.系統語言字典[介面+"07EN"];
  2438. 輸入授權碼.text = Main.Global.系統語言字典[介面+"09EN"];
  2439. 指定倉庫.text = Main.Global.系統語言字典[介面+"10EN"];
  2440. 申請人.text = Main.Global.系統語言字典[介面+"11EN"];
  2441. 請購單號.text = Main.Global.系統語言字典[介面+"12EN"];
  2442. 合約號.text = Main.Global.系統語言字典[介面+"13EN"];
  2443. 申請日期.text = Main.Global.系統語言字典[介面+"14EN"];
  2444. 需求日期.text = Main.Global.系統語言字典[介面+"15EN"];
  2445. 備註.text = Main.Global.系統語言字典[介面+"16EN"];
  2446. 項次.text = Main.Global.系統語言字典[介面+"17EN"];
  2447. 品名.text = Main.Global.系統語言字典[介面+"18EN"];
  2448. 規格.text = Main.Global.系統語言字典[介面+"19EN"];
  2449. 數量.text = Main.Global.系統語言字典[介面+"20EN"];
  2450. 單位.text = Main.Global.系統語言字典[介面+"21EN"];
  2451. 圖片.text = Main.Global.系統語言字典[介面+"22EN"];
  2452. 修改.text = Main.Global.系統語言字典[介面+"23EN"];
  2453. 刪除.text = Main.Global.系統語言字典[介面+"24EN"];
  2454. 管材s.text = Main.Global.系統語言字典[介面+"25EN"];
  2455. 電線s.text = Main.Global.系統語言字典[介面+"26EN"];
  2456. 電料s.text = Main.Global.系統語言字典[介面+"27EN"];
  2457. 槽架s.text = Main.Global.系統語言字典[介面+"28EN"];
  2458. 建材s.text = Main.Global.系統語言字典[介面+"29EN"];
  2459. 五金s.text = Main.Global.系統語言字典[介面+"30EN"];
  2460. 設備s.text = Main.Global.系統語言字典[介面+"31EN"];
  2461. 工具s.text = Main.Global.系統語言字典[介面+"32EN"];
  2462. 日用s.text = Main.Global.系統語言字典[介面+"33EN"];
  2463. 其他s.text = Main.Global.系統語言字典[介面+"34EN"];
  2464. 選擇主項.text = Main.Global.系統語言字典[介面+"35EN"];
  2465. 選擇物料.text = Main.Global.系統語言字典[介面+"36EN"];
  2466. 選擇規格數量.text = Main.Global.系統語言字典[介面+"37EN"];
  2467. }
  2468. else
  2469. {
  2470. 中.text = Main.Global.系統語言字典[介面+"00ID"];
  2471. 英.text = Main.Global.系統語言字典[介面+"01ID"];
  2472. 印.text = Main.Global.系統語言字典[介面+"02ID"];
  2473. 簡.text = Main.Global.系統語言字典[介面+"04ID"];
  2474. 選擇語言.text = Main.Global.系統語言字典[介面+"03ID"];
  2475. 是否有合約號.text = Main.Global.系統語言字典[介面+"05ID"];
  2476. 選擇甲方.text = Main.Global.系統語言字典[介面+"06ID"];
  2477. 選擇合約.text = Main.Global.系統語言字典[介面+"07ID"];
  2478. 輸入授權碼.text = Main.Global.系統語言字典[介面+"09ID"];
  2479. 指定倉庫.text = Main.Global.系統語言字典[介面+"10ID"];
  2480. 申請人.text = Main.Global.系統語言字典[介面+"11ID"];
  2481. 請購單號.text = Main.Global.系統語言字典[介面+"12ID"];
  2482. 合約號.text = Main.Global.系統語言字典[介面+"13ID"];
  2483. 申請日期.text = Main.Global.系統語言字典[介面+"14ID"];
  2484. 需求日期.text = Main.Global.系統語言字典[介面+"15ID"];
  2485. 備註.text = Main.Global.系統語言字典[介面+"16ID"];
  2486. 項次.text = Main.Global.系統語言字典[介面+"17ID"];
  2487. 品名.text = Main.Global.系統語言字典[介面+"18ID"];
  2488. 規格.text = Main.Global.系統語言字典[介面+"19ID"];
  2489. 數量.text = Main.Global.系統語言字典[介面+"20ID"];
  2490. 單位.text = Main.Global.系統語言字典[介面+"21ID"];
  2491. 圖片.text = Main.Global.系統語言字典[介面+"22ID"];
  2492. 修改.text = Main.Global.系統語言字典[介面+"23ID"];
  2493. 刪除.text = Main.Global.系統語言字典[介面+"24ID"];
  2494. 管材s.text = Main.Global.系統語言字典[介面+"25ID"];
  2495. 電線s.text = Main.Global.系統語言字典[介面+"26ID"];
  2496. 電料s.text = Main.Global.系統語言字典[介面+"27ID"];
  2497. 槽架s.text = Main.Global.系統語言字典[介面+"28ID"];
  2498. 建材s.text = Main.Global.系統語言字典[介面+"29ID"];
  2499. 五金s.text = Main.Global.系統語言字典[介面+"30ID"];
  2500. 設備s.text = Main.Global.系統語言字典[介面+"31ID"];
  2501. 工具s.text = Main.Global.系統語言字典[介面+"32ID"];
  2502. 日用s.text = Main.Global.系統語言字典[介面+"33ID"];
  2503. 其他s.text = Main.Global.系統語言字典[介面+"34ID"];
  2504. 選擇主項.text = Main.Global.系統語言字典[介面+"35ID"];
  2505. 選擇物料.text = Main.Global.系統語言字典[介面+"36ID"];
  2506. 選擇規格數量.text = Main.Global.系統語言字典[介面+"37ID"];
  2507. }
  2508. }
  2509. private void 初始化系統語言()
  2510. {
  2511. TextAsset txt = Resources.Load("Tran") as TextAsset;
  2512. Main.Global.系統語言資料=txt.text.Split('\n');
  2513. for (int i = 1; i<=Main.Global.系統語言資料.Length; i++)
  2514. {
  2515. try
  2516. {
  2517. string key = Main.Global.系統語言資料[i].ToString().Substring(0, 3)+Main.Global.系統語言資料[i].ToString().Substring(4, 2)+Main.Global.系統語言資料[i].ToString().Substring(7, 2);
  2518. Main.Global.系統語言字典.Add(key, Main.Global.系統語言資料[i].ToString().Substring(10));
  2519. }
  2520. catch
  2521. {
  2522. // Debug.Log("No data");
  2523. }
  2524. }
  2525. }
  2526. }