229 lines
7.7 KiB
C#
229 lines
7.7 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using DefaultNamespace;
|
||
using DefaultNamespace.ProcessMode;
|
||
using Framework.Manager;
|
||
using MotionFramework;
|
||
using TMPro;
|
||
using Unity.VisualScripting;
|
||
using UnityEngine;
|
||
using UnityEngine.UI;
|
||
|
||
namespace Zion.Scripts.ERP.库存物资报表的查询与解读
|
||
{
|
||
public class QueryInventoryMaterialReportManager : MonoBehaviour
|
||
{
|
||
RaycastHit hit;
|
||
|
||
|
||
// [SerializeField] private Button _menuBt;//菜单按钮,后续绑定
|
||
[SerializeField] private TMP_InputField _factoryNumber;
|
||
[SerializeField] private TMP_InputField _city;
|
||
[SerializeField] private Button _button;
|
||
[SerializeField] private Button _Savebutton1;
|
||
[SerializeField] private Button _Savebutton2;
|
||
public GameObject answerSheet;
|
||
public GameObject plane1;
|
||
public GameObject plane2;
|
||
public Button answerSheetButton;
|
||
|
||
|
||
private Framework.Dto.InventoryReversalVoucherAnalyzer returnRevVoucherAnalyzer;
|
||
|
||
|
||
public TMP_InputField jine1;
|
||
public TMP_InputField jine2;
|
||
public TMP_InputField tiaomu1;
|
||
public TMP_InputField tiaomu2;
|
||
|
||
|
||
public Button closebt;
|
||
private void Awake()
|
||
{
|
||
// _factoryNumber = transform.Find("Panel1/工厂").GetComponent<InputField>();
|
||
// _button = transform.Find("Panel1/查询").GetComponent<Button>();
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// 验证输入字段的内容是否正确
|
||
/// </summary>
|
||
/// <returns>返回验证结果</returns>
|
||
private bool ValidateInputFields()
|
||
{
|
||
bool isValid = true;
|
||
string errorMessage = "";
|
||
|
||
if (returnRevVoucherAnalyzer.formselection == "库存物资报表1")
|
||
{
|
||
// 验证表1的标准答案
|
||
if (jine1.text != "49.49")
|
||
{
|
||
isValid = false;
|
||
errorMessage += "金额1输入错误,正确答案应为:49.49\n";
|
||
}
|
||
if (jine2.text != "213.45")
|
||
{
|
||
isValid = false;
|
||
errorMessage += "金额2输入错误,正确答案应为:213.45\n";
|
||
}
|
||
if (tiaomu1.text != "14")
|
||
{
|
||
isValid = false;
|
||
errorMessage += "条目1输入错误,正确答案应为:14\n";
|
||
}
|
||
if (tiaomu2.text != "63")
|
||
{
|
||
isValid = false;
|
||
errorMessage += "条目2输入错误,正确答案应为:63\n";
|
||
}
|
||
}
|
||
else if (returnRevVoucherAnalyzer.formselection == "库存物资报表2")
|
||
{
|
||
// 验证表2的标准答案
|
||
if (jine1.text != "2556.61")
|
||
{
|
||
isValid = false;
|
||
errorMessage += "金额1输入错误,正确答案应为:2556.61\n";
|
||
}
|
||
if (jine2.text != "22.43")
|
||
{
|
||
isValid = false;
|
||
errorMessage += "金额2输入错误,正确答案应为:22.43\n";
|
||
}
|
||
if (tiaomu1.text != "124")
|
||
{
|
||
isValid = false;
|
||
errorMessage += "条目1输入错误,正确答案应为:124\n";
|
||
}
|
||
if (tiaomu2.text != "6")
|
||
{
|
||
isValid = false;
|
||
errorMessage += "条目2输入错误,正确答案应为:6\n";
|
||
}
|
||
}
|
||
|
||
if (isValid)
|
||
{
|
||
Debug.Log("输入验证通过:所有字段内容正确!");
|
||
|
||
List<string> list = new List<string>();
|
||
list.Add("49.49");
|
||
list.Add("14");
|
||
list.Add("213.45");
|
||
list.Add("63");
|
||
MotionEngine.GetModule<ProcessManager>().HandleClick(list);
|
||
}
|
||
else
|
||
{
|
||
List<string> list = new List<string>();
|
||
list.Add(jine1.text);
|
||
list.Add(tiaomu1.text);
|
||
list.Add(jine2.text);
|
||
list.Add(tiaomu2.text);
|
||
MotionEngine.GetModule<ProcessManager>().HandleClick(list);
|
||
|
||
Debug.LogWarning("输入验证失败:\n" + errorMessage);
|
||
}
|
||
|
||
return isValid;
|
||
}
|
||
|
||
public TMP_InputField [] inputFields;
|
||
|
||
private void Start()
|
||
{
|
||
_button.onClick.AddListener(OnClickQueryNumber);
|
||
_Savebutton1.onClick.AddListener(OnSaveButtonClick);
|
||
_Savebutton2.onClick.AddListener(OnSaveButtonClick);
|
||
answerSheetButton.onClick.AddListener(OnClickAnswerSheet);
|
||
|
||
returnRevVoucherAnalyzer = (Framework.Dto.InventoryReversalVoucherAnalyzer)MotionEngine.GetModule<GlobalDataStorage>().materialTaskObj;
|
||
closebt.onClick.AddListener(BtClose);
|
||
// _menuBt.onClick.AddListener(OnClickMenuBt);
|
||
}
|
||
|
||
private void BtClose()
|
||
{
|
||
TutorialGuideManager.Instance.HideGuide();
|
||
|
||
}
|
||
|
||
private void OnClickAnswerSheet()
|
||
{
|
||
// FileComponent.UploadExamFiles();
|
||
|
||
|
||
bool isInputValid = ValidateInputFields();
|
||
|
||
|
||
|
||
}
|
||
|
||
private void OnSaveButtonClick()
|
||
{
|
||
|
||
if (returnRevVoucherAnalyzer.formselection == "库存物资报表1")
|
||
{
|
||
FileComponent.DownloadSingleFile("附件1:库存物资报表的查询与解读--库存物资报表1");
|
||
}
|
||
else
|
||
{
|
||
FileComponent.DownloadSingleFile("附件1:库存物资报表的查询与解读--库存物资报表2");
|
||
|
||
}
|
||
|
||
answerSheet.SetActive(true);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 点击进入库存管理综合查询操作界面
|
||
/// </summary>
|
||
private void OnClickMenuBt()
|
||
{
|
||
if (MotionEngine.GetModule<ProcessManager>().HandleClick("库存管理综合查询操作界面"))
|
||
{
|
||
Debug.Log("成功");
|
||
}
|
||
else
|
||
{
|
||
Debug.Log("失败");
|
||
}
|
||
}
|
||
|
||
private void OnClickQueryNumber()
|
||
{
|
||
if (MotionEngine.GetModule<ProcessManager>().HandleClick(new List<string>() { _factoryNumber.text, _city.text }))
|
||
{
|
||
if (returnRevVoucherAnalyzer.formselection == "库存物资报表1")
|
||
{
|
||
plane1.SetActive(true);
|
||
|
||
}
|
||
else if (returnRevVoucherAnalyzer.formselection == "库存物资报表2")
|
||
{
|
||
plane2.SetActive(true);
|
||
}
|
||
TutorialGuideManager.Instance.TriggerNextGuide(_button.name);
|
||
}
|
||
}
|
||
|
||
|
||
// private void Update()
|
||
// {
|
||
// if (Input.GetMouseButtonUp(0)) //这里的GetMouseButtonUp是指鼠标点击回弹时触发;
|
||
// {
|
||
// var ray = Camera.main.ScreenPointToRay(Input.mousePosition); //发射射线
|
||
// if (Physics.Raycast(ray, out hit)) //如果射到物体
|
||
// {
|
||
// Debug.Log(hit.collider.gameObject.name); //控制台输出检测到物体的名称
|
||
//
|
||
// if (hit.collider.gameObject.name == "电脑")
|
||
// {
|
||
// MotionEngine.GetModule<ProcessManager>().HandleClick("系统正常");
|
||
// }
|
||
// }
|
||
// }
|
||
// }
|
||
}
|
||
} |