948 lines
49 KiB
C#
948 lines
49 KiB
C#
using Framework.Manager;
|
||
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using System.Linq;
|
||
using DefaultNamespace;
|
||
using DefaultNamespace.ProcessMode;
|
||
using MotionFramework;
|
||
using UnityEngine;
|
||
using Newtonsoft.Json;
|
||
using Framework.Dto;
|
||
|
||
/// <summary>
|
||
/// 场景总控制
|
||
/// </summary>
|
||
public class GameManager : MonoBehaviour
|
||
{
|
||
/// <summary>
|
||
///
|
||
/// </summary>
|
||
public static GameManager Instance;
|
||
|
||
/// <summary>
|
||
/// 科目
|
||
/// </summary>
|
||
public GameObject[] subjects;
|
||
|
||
/// <summary>
|
||
/// 任务提示
|
||
/// </summary>
|
||
public TaskPrompt taskPrompt;
|
||
|
||
/// <summary>
|
||
/// 模型控制
|
||
/// </summary>
|
||
public ModerController moderController;
|
||
|
||
/// <summary>
|
||
/// 单据控制
|
||
/// </summary>
|
||
public DocumentManagement documentManagement;
|
||
|
||
/// <summary>
|
||
/// 总数据
|
||
/// </summary>
|
||
[Header("总数据")] public CombinedClass combinedClass;
|
||
|
||
/// <summary>
|
||
/// 物资品类检查
|
||
/// </summary>
|
||
[Header("物资品类检查")] public List<MaterialCheck> materialChecks;
|
||
|
||
/// <summary>
|
||
/// 附件
|
||
/// </summary>
|
||
[Header("附件")] public AccessoryDocuments[] accessoryDocuments;
|
||
|
||
|
||
public GameObject tijiaoanniu;
|
||
|
||
|
||
private void Awake()
|
||
{
|
||
Instance = this;
|
||
}
|
||
|
||
// Start is called before the first frame update
|
||
void Start()
|
||
{
|
||
taskPrompt = TaskPrompt.Instance;
|
||
moderController = ModerController.Instance;
|
||
documentManagement = DocumentManagement.Instance;
|
||
//eRPSystemControl= ERPSystemControl.Instance;
|
||
Init();
|
||
GetNumber();
|
||
combinedClass.BatchNumber = MotionEngine.GetModule<GlobalDataStorage>().GetTaskBookValueByMapping("批次");//批次号
|
||
combinedClass.materialCode = MotionEngine.GetModule<GlobalDataStorage>().GetTaskBookValueByMapping("物料编码");//批次号
|
||
combinedClass.materialName = MotionEngine.GetModule<GlobalDataStorage>().GetTaskBookValueByMapping("物料描述");//批次号
|
||
combinedClass.SupplierName = "江苏南瑞帕威尔电气有限公司";
|
||
combinedClass.materialUnit = unit;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 初始化
|
||
/// </summary>
|
||
private void Init()
|
||
{
|
||
if (GameLauncher.Instance.localtarge != "" && GameLauncher.Instance != null)
|
||
{
|
||
combinedClass.TargetLocation = GameLauncher.Instance.localtarge;
|
||
}
|
||
|
||
// yield return new WaitForSeconds(3);
|
||
//
|
||
// combinedClass = new CombinedClass();
|
||
// combinedClass.stage = MotionEngine.GetModule<GlobalDataStorage>().ExamData.Data.shows;
|
||
// ParseMaterialAndAssignToCombinedClass(MotionEngine.GetModule<GlobalDataStorage>().ExamData.Data.task);
|
||
|
||
// yield return new WaitForSeconds(0.5f);
|
||
// //初始化数据
|
||
// yield return new WaitForSeconds(0.5f);
|
||
|
||
//初始化数据
|
||
// ParseMaterialAndAssignToCombinedClass(MotionEngine.GetModule<GlobalDataStorage>().ExamData.Data.task);
|
||
|
||
|
||
if (MotionEngine.GetModule<ProcessManager>()._currentMode == ProcessMode.考试预览 ||
|
||
MotionEngine.GetModule<ProcessManager>()._currentMode == ProcessMode.教学模式)
|
||
{
|
||
tijiaoanniu.SetActive(false);
|
||
}
|
||
else if (MotionEngine.GetModule<ProcessManager>()._currentMode == ProcessMode.课程预览)
|
||
{
|
||
tijiaoanniu.SetActive(false);
|
||
}
|
||
|
||
|
||
// switch (GlobalDataStorage.Instance.bigName)
|
||
// {
|
||
// case "采购物资入库": // PurchaseMaterialInbound
|
||
//
|
||
// break;
|
||
// case "调拨物资入库": // TransferMaterialInbound
|
||
//
|
||
// break;
|
||
// case "退料物资入库": // ReturnMaterialInbound
|
||
//
|
||
// break;
|
||
// case "代保管物资入库": // CustodyMaterialInbound
|
||
//
|
||
// break;
|
||
// case "代保管物资出库": // CustodyMaterialOutbound
|
||
//
|
||
// break;
|
||
// case "调拨物资出库": // TransferMaterialOutbound
|
||
//
|
||
// break;
|
||
// case "废旧物资入库": // ScrapMaterialInbound
|
||
//
|
||
// break;
|
||
// case "借用物资出库": // BorrowMaterialOutbound
|
||
//
|
||
// break;
|
||
// case "借用物资入库": // BorrowMaterialInbound
|
||
//
|
||
// break;
|
||
// case "项目领用出库": // ProjectUseMaterialOutbound
|
||
//
|
||
// break;
|
||
// case "库存物资报废": // InventoryMaterialScrap
|
||
//
|
||
// break;
|
||
// }
|
||
|
||
|
||
switch (MotionEngine.GetModule<GlobalDataStorage>().ExamName)
|
||
{
|
||
case "1KV电缆终端到货验收入库":
|
||
combinedClass.moderName = "1kV电缆终端";
|
||
break;
|
||
case "1KV电缆终端调拨物资入库":
|
||
combinedClass.moderName = "1kV电缆终端";
|
||
break;
|
||
case "10kV变压器到货验收入库":
|
||
combinedClass.moderName = "1kV电缆终端";
|
||
break;
|
||
case "10kV变压器调拨物资入库":
|
||
combinedClass.moderName = "10kV变压器";
|
||
break;
|
||
case "10KV电缆终端调拨物资入库":
|
||
combinedClass.moderName = "10kV电缆终端";
|
||
break;
|
||
case "电缆分支箱到货验收":
|
||
combinedClass.moderName = "电缆分支箱";
|
||
break;
|
||
case "布电线调拨物资入库":
|
||
combinedClass.moderName = "布电线";
|
||
break;
|
||
case "电缆分支箱调拨物资入库":
|
||
combinedClass.moderName = "电缆分支箱";
|
||
break;
|
||
case "电力电缆调拨物资入库":
|
||
combinedClass.moderName = "电力电缆";
|
||
break;
|
||
case "碟式绝缘子调拨物资入库":
|
||
combinedClass.moderName = "蝶式绝缘子";
|
||
break;
|
||
case "高压熔断器调拨物资入库":
|
||
combinedClass.moderName = "高压熔断器";
|
||
break;
|
||
case "交流盘形县式瓷绝缘子调拨物资入库":
|
||
combinedClass.moderName = "交流盘形悬式瓷绝缘子";
|
||
break;
|
||
case "接地短路故障指示器调拨物资入库":
|
||
combinedClass.moderName = "接地短路故障指示器";
|
||
break;
|
||
case "接续金具-接地线夹调拨物资入库":
|
||
combinedClass.moderName = "接续金具-接地线夹";
|
||
break;
|
||
case "联结金具-直角挂板调拨物资入库":
|
||
combinedClass.moderName = "联结金具-直角挂板";
|
||
break;
|
||
case "配电箱调拨物资入库":
|
||
combinedClass.moderName = "配电箱";
|
||
break;
|
||
case "线路杜式瓷绝缘子调拨物资入库":
|
||
combinedClass.moderName = "线路柱式瓷绝缘子";
|
||
break;
|
||
case "柱上断路器调拨物资入库":
|
||
combinedClass.moderName = "柱上断路器";
|
||
break;
|
||
case "低压电流互感器调拨物资入库":
|
||
combinedClass.moderName = "低压电流互感器";
|
||
break;
|
||
case "10KV三相隔离开关调拨物资入库":
|
||
combinedClass.moderName = "10kV三相隔离开关";
|
||
break;
|
||
case "交流盘形悬式瓷绝缘子到货验收入库":
|
||
combinedClass.moderName = "交流盘形悬式瓷绝缘子";
|
||
break;
|
||
case "10kV电缆终端到货验收入库":
|
||
combinedClass.moderName = "10kV电缆终端";
|
||
break;
|
||
case "低压电流互感器到货验收":
|
||
combinedClass.moderName = "低压电流互感器";
|
||
break;
|
||
case "接地短路故障指示器到货验收":
|
||
combinedClass.moderName = "接地短路故障指示器";
|
||
break;
|
||
case "联结金具-直角挂板到货验收":
|
||
combinedClass.moderName = "联结金具-直角挂板";
|
||
break;
|
||
case "10KV三相隔离开关调拨入库":
|
||
combinedClass.moderName = "10kV三相隔离开关";
|
||
break;
|
||
case "高压熔断器调拨入库":
|
||
combinedClass.moderName = "高压熔断器调";
|
||
break;
|
||
case "接线金具-接地线夹调拨入库":
|
||
combinedClass.moderName = "接线金具-接地线夹";
|
||
break;
|
||
case "配电箱调拨入库":
|
||
combinedClass.moderName = "配电箱";
|
||
break;
|
||
case "退出退役资产物资代保管出库作业":
|
||
combinedClass.moderName = "10kV变压器";
|
||
break;
|
||
case "库存物资报废流程":
|
||
combinedClass.moderName = "电力电缆";
|
||
break;
|
||
case "领用出库":
|
||
combinedClass.moderName = "10kV变压器";
|
||
break;
|
||
// case "1kV电缆终端到货验收":
|
||
// break;
|
||
}
|
||
|
||
|
||
switch (GlobalDataStorage.Instance.bigName)
|
||
{
|
||
case "采购物资入库": // PurchaseMaterialInbound
|
||
Framework.Dto.PurchaseMaterialInbound purchaseMaterialInbound = (Framework.Dto.PurchaseMaterialInbound)GlobalDataStorage.Instance.materialTaskObj;
|
||
// 只有非null值才进行赋值,避免NullReferenceException
|
||
if (purchaseMaterialInbound.quantity != null)
|
||
combinedClass.incomeQuantity = purchaseMaterialInbound.quantity.ToString();
|
||
if (purchaseMaterialInbound.materialName != null)
|
||
combinedClass.moderName = purchaseMaterialInbound.materialName.ToString();
|
||
if (purchaseMaterialInbound.code != null)
|
||
combinedClass.materialCode = purchaseMaterialInbound.code.ToString();
|
||
if (purchaseMaterialInbound.description != null)
|
||
combinedClass.materialName = purchaseMaterialInbound.description.ToString();
|
||
if (purchaseMaterialInbound.location != null)
|
||
combinedClass.TargetLocation = purchaseMaterialInbound.location.ToString();
|
||
Debug.Log($"已反序列化为PurchaseMaterialInbound: {JsonConvert.SerializeObject(GlobalDataStorage.Instance.materialTaskObj)}");
|
||
break;
|
||
case "调拨物资入库": // TransferMaterialInbound
|
||
Framework.Dto.TransferMaterialInbound transferMaterialInbound = (Framework.Dto.TransferMaterialInbound)GlobalDataStorage.Instance.materialTaskObj;
|
||
// 智能判断数量字段:优先使用materialQuantity,如果为0则使用quantity
|
||
if (transferMaterialInbound.materialQuantity != null && transferMaterialInbound.materialQuantity > 0)
|
||
{
|
||
combinedClass.incomeQuantity = transferMaterialInbound.materialQuantity.ToString();
|
||
Debug.Log($"使用materialQuantity值: {transferMaterialInbound.materialQuantity}");
|
||
}
|
||
else if (transferMaterialInbound.quantity != null && transferMaterialInbound.quantity > 0)
|
||
{
|
||
combinedClass.incomeQuantity = transferMaterialInbound.quantity.ToString();
|
||
Debug.Log($"使用quantity值: {transferMaterialInbound.quantity}");
|
||
}
|
||
else
|
||
{
|
||
Debug.Log("两个数量字段都为0或null,不进行赋值");
|
||
}
|
||
|
||
if (transferMaterialInbound.materialName != null)
|
||
combinedClass.moderName = transferMaterialInbound.materialName.ToString();
|
||
if (transferMaterialInbound.materialCode != null)
|
||
combinedClass.materialCode = transferMaterialInbound.materialCode.ToString();
|
||
if (transferMaterialInbound.materialDescription != null)
|
||
combinedClass.materialName = transferMaterialInbound.materialDescription.ToString();
|
||
if (transferMaterialInbound.binNumber != null)
|
||
combinedClass.TargetLocation = transferMaterialInbound.binNumber.ToString();
|
||
Debug.Log($"已反序列化为TransferMaterialInbound: {JsonConvert.SerializeObject(GlobalDataStorage.Instance.materialTaskObj)}");
|
||
break;
|
||
case "退料物资入库": // ReturnMaterialInbound
|
||
Framework.Dto.ReturnMaterialInbound returnMaterialInbound = (Framework.Dto.ReturnMaterialInbound)GlobalDataStorage.Instance.materialTaskObj;
|
||
// 智能判断数量字段:优先使用materialQuantity,如果为0则使用quantity
|
||
if (returnMaterialInbound.materialQuantity != null && returnMaterialInbound.materialQuantity > 0)
|
||
{
|
||
combinedClass.incomeQuantity = returnMaterialInbound.materialQuantity.ToString();
|
||
Debug.Log($"使用materialQuantity值: {returnMaterialInbound.materialQuantity}");
|
||
}
|
||
else if (returnMaterialInbound.quantity != null && returnMaterialInbound.quantity > 0)
|
||
{
|
||
combinedClass.incomeQuantity = returnMaterialInbound.quantity.ToString();
|
||
Debug.Log($"使用quantity值: {returnMaterialInbound.quantity}");
|
||
}
|
||
else
|
||
{
|
||
Debug.Log("两个数量字段都为0或null,不进行赋值");
|
||
}
|
||
|
||
if (returnMaterialInbound.materialName != null)
|
||
combinedClass.moderName = returnMaterialInbound.materialName.ToString();
|
||
if (returnMaterialInbound.materialCode != null)
|
||
combinedClass.materialCode = returnMaterialInbound.materialCode.ToString();
|
||
if (returnMaterialInbound.materialDescription != null)
|
||
combinedClass.materialName = returnMaterialInbound.materialDescription.ToString();
|
||
if (returnMaterialInbound.binNumber != null)
|
||
combinedClass.TargetLocation = returnMaterialInbound.binNumber.ToString();
|
||
Debug.Log($"已反序列化为ReturnMaterialInbound: {JsonConvert.SerializeObject(GlobalDataStorage.Instance.materialTaskObj)}");
|
||
break;
|
||
case "代保管物资入库": // CustodyMaterialInbound
|
||
Framework.Dto.CustodyMaterialInbound custodyMaterialInbound = (Framework.Dto.CustodyMaterialInbound)GlobalDataStorage.Instance.materialTaskObj;
|
||
// 智能判断数量字段:优先使用materialQuantity,如果为0则使用quantity
|
||
if (custodyMaterialInbound.materialQuantity != null && custodyMaterialInbound.materialQuantity > 0)
|
||
{
|
||
combinedClass.incomeQuantity = custodyMaterialInbound.materialQuantity.ToString();
|
||
Debug.Log($"使用materialQuantity值: {custodyMaterialInbound.materialQuantity}");
|
||
}
|
||
else if (custodyMaterialInbound.quantity != null && custodyMaterialInbound.quantity > 0)
|
||
{
|
||
combinedClass.incomeQuantity = custodyMaterialInbound.quantity.ToString();
|
||
Debug.Log($"使用quantity值: {custodyMaterialInbound.quantity}");
|
||
}
|
||
else
|
||
{
|
||
Debug.Log("两个数量字段都为0或null,不进行赋值");
|
||
}
|
||
|
||
if (custodyMaterialInbound.materialName != null)
|
||
combinedClass.moderName = custodyMaterialInbound.materialName.ToString();
|
||
if (custodyMaterialInbound.materialCode != null)
|
||
combinedClass.materialCode = custodyMaterialInbound.materialCode.ToString();
|
||
if (custodyMaterialInbound.materialDescription != null)
|
||
combinedClass.materialName = custodyMaterialInbound.materialDescription.ToString();
|
||
if (custodyMaterialInbound.binNumber != null)
|
||
combinedClass.TargetLocation = custodyMaterialInbound.binNumber.ToString();
|
||
Debug.Log($"已反序列化为CustodyMaterialInbound: {JsonConvert.SerializeObject(GlobalDataStorage.Instance.materialTaskObj)}");
|
||
break;
|
||
case "代保管物资出库": // CustodyMaterialOutbound
|
||
Framework.Dto.CustodyMaterialOutbound custodyMaterialOutbound = (Framework.Dto.CustodyMaterialOutbound)GlobalDataStorage.Instance.materialTaskObj;
|
||
// 智能判断数量字段:优先使用materialQuantity,如果为0则使用quantity
|
||
if (custodyMaterialOutbound.materialQuantity != null && custodyMaterialOutbound.materialQuantity > 0)
|
||
{
|
||
combinedClass.incomeQuantity = custodyMaterialOutbound.materialQuantity.ToString();
|
||
Debug.Log($"使用materialQuantity值: {custodyMaterialOutbound.materialQuantity}");
|
||
}
|
||
else if (custodyMaterialOutbound.quantity != null && custodyMaterialOutbound.quantity > 0)
|
||
{
|
||
combinedClass.incomeQuantity = custodyMaterialOutbound.quantity.ToString();
|
||
Debug.Log($"使用quantity值: {custodyMaterialOutbound.quantity}");
|
||
}
|
||
else
|
||
{
|
||
Debug.Log("两个数量字段都为0或null,不进行赋值");
|
||
}
|
||
|
||
if (custodyMaterialOutbound.materialName != null)
|
||
combinedClass.moderName = custodyMaterialOutbound.materialName.ToString();
|
||
if (custodyMaterialOutbound.materialCode != null)
|
||
combinedClass.materialCode = custodyMaterialOutbound.materialCode.ToString();
|
||
if (custodyMaterialOutbound.materialDescription != null)
|
||
combinedClass.materialName = custodyMaterialOutbound.materialDescription.ToString();
|
||
if (custodyMaterialOutbound.storageBin != null)
|
||
combinedClass.TargetLocation = custodyMaterialOutbound.storageBin.ToString();
|
||
if (custodyMaterialOutbound.batchNumber != null)
|
||
combinedClass.BatchNumber = custodyMaterialOutbound.batchNumber.ToString();
|
||
Debug.Log($"已反序列化为CustodyMaterialOutbound: {JsonConvert.SerializeObject(GlobalDataStorage.Instance.materialTaskObj)}");
|
||
break;
|
||
case "调拨物资出库": // TransferMaterialOutbound
|
||
Framework.Dto.TransferMaterialOutbound transferMaterialOutbound = (Framework.Dto.TransferMaterialOutbound)GlobalDataStorage.Instance.materialTaskObj;
|
||
// 智能判断数量字段:优先使用materialQuantity,如果为0则使用quantity
|
||
if (transferMaterialOutbound.materialQuantity != null && transferMaterialOutbound.materialQuantity > 0)
|
||
{
|
||
combinedClass.incomeQuantity = transferMaterialOutbound.materialQuantity.ToString();
|
||
Debug.Log($"使用materialQuantity值: {transferMaterialOutbound.materialQuantity}");
|
||
}
|
||
else if (transferMaterialOutbound.quantity != null && transferMaterialOutbound.quantity > 0)
|
||
{
|
||
combinedClass.incomeQuantity = transferMaterialOutbound.quantity.ToString();
|
||
Debug.Log($"使用quantity值: {transferMaterialOutbound.quantity}");
|
||
}
|
||
else
|
||
{
|
||
Debug.Log("两个数量字段都为0或null,不进行赋值");
|
||
}
|
||
|
||
if (transferMaterialOutbound.materialName != null)
|
||
combinedClass.moderName = transferMaterialOutbound.materialName.ToString();
|
||
if (transferMaterialOutbound.materialCode != null)
|
||
combinedClass.materialCode = transferMaterialOutbound.materialCode.ToString();
|
||
if (transferMaterialOutbound.materialDescription != null)
|
||
combinedClass.materialName = transferMaterialOutbound.materialDescription.ToString();
|
||
if (transferMaterialOutbound.storageBin != null)
|
||
combinedClass.TargetLocation = transferMaterialOutbound.storageBin.ToString();
|
||
if (transferMaterialOutbound.batchNumber != null)
|
||
combinedClass.BatchNumber = transferMaterialOutbound.batchNumber.ToString();
|
||
Debug.Log($"已反序列化为TransferMaterialOutbound: {JsonConvert.SerializeObject(GlobalDataStorage.Instance.materialTaskObj)}");
|
||
break;
|
||
case "废旧物资入库": // ScrapMaterialInbound
|
||
Framework.Dto.ScrapMaterialInbound scrapMaterialInbound = (Framework.Dto.ScrapMaterialInbound)GlobalDataStorage.Instance.materialTaskObj;
|
||
// 智能判断数量字段:优先使用materialQuantity,如果为0则使用quantity
|
||
if (scrapMaterialInbound.materialQuantity != null && scrapMaterialInbound.materialQuantity > 0)
|
||
{
|
||
combinedClass.incomeQuantity = scrapMaterialInbound.materialQuantity.ToString();
|
||
Debug.Log($"使用materialQuantity值: {scrapMaterialInbound.materialQuantity}");
|
||
}
|
||
else if (scrapMaterialInbound.quantity != null && scrapMaterialInbound.quantity > 0)
|
||
{
|
||
combinedClass.incomeQuantity = scrapMaterialInbound.quantity.ToString();
|
||
Debug.Log($"使用quantity值: {scrapMaterialInbound.quantity}");
|
||
}
|
||
else
|
||
{
|
||
Debug.Log("两个数量字段都为0或null,不进行赋值");
|
||
}
|
||
|
||
if (scrapMaterialInbound.materialName != null)
|
||
combinedClass.moderName = scrapMaterialInbound.materialName.ToString();
|
||
if (scrapMaterialInbound.materialCode != null)
|
||
combinedClass.materialCode = scrapMaterialInbound.materialCode.ToString();
|
||
if (scrapMaterialInbound.materialDescription != null)
|
||
combinedClass.materialName = scrapMaterialInbound.materialDescription.ToString();
|
||
if (scrapMaterialInbound.storageBin != null)
|
||
combinedClass.TargetLocation = scrapMaterialInbound.storageBin.ToString();
|
||
if (scrapMaterialInbound.batchNumber != null)
|
||
combinedClass.BatchNumber = scrapMaterialInbound.batchNumber.ToString();
|
||
Debug.Log($"已反序列化为ScrapMaterialInbound: {JsonConvert.SerializeObject(GlobalDataStorage.Instance.materialTaskObj)}");
|
||
break;
|
||
case "借用物资出库": // BorrowMaterialOutbound
|
||
Framework.Dto.BorrowMaterialOutbound borrowMaterialOutbound = (Framework.Dto.BorrowMaterialOutbound)GlobalDataStorage.Instance.materialTaskObj;
|
||
// 智能判断数量字段:优先使用materialQuantity,如果为0则使用quantity
|
||
if (borrowMaterialOutbound.materialQuantity != null && borrowMaterialOutbound.materialQuantity > 0)
|
||
{
|
||
combinedClass.incomeQuantity = borrowMaterialOutbound.materialQuantity.ToString();
|
||
Debug.Log($"使用materialQuantity值: {borrowMaterialOutbound.materialQuantity}");
|
||
}
|
||
else if (borrowMaterialOutbound.quantity != null && borrowMaterialOutbound.quantity > 0)
|
||
{
|
||
combinedClass.incomeQuantity = borrowMaterialOutbound.quantity.ToString();
|
||
Debug.Log($"使用quantity值: {borrowMaterialOutbound.quantity}");
|
||
}
|
||
else
|
||
{
|
||
Debug.Log("两个数量字段都为0或null,不进行赋值");
|
||
}
|
||
|
||
if (borrowMaterialOutbound.materialName != null)
|
||
combinedClass.moderName = borrowMaterialOutbound.materialName.ToString();
|
||
if (borrowMaterialOutbound.materialCode != null)
|
||
combinedClass.materialCode = borrowMaterialOutbound.materialCode.ToString();
|
||
if (borrowMaterialOutbound.materialDescription != null)
|
||
combinedClass.materialName = borrowMaterialOutbound.materialDescription.ToString();
|
||
Debug.Log($"已反序列化为BorrowMaterialOutbound: {JsonConvert.SerializeObject(GlobalDataStorage.Instance.materialTaskObj)}");
|
||
break;
|
||
case "借用物资入库": // BorrowMaterialInbound
|
||
Framework.Dto.BorrowMaterialInbound borrowMaterialInbound = (Framework.Dto.BorrowMaterialInbound)GlobalDataStorage.Instance.materialTaskObj;
|
||
// 智能判断数量字段:优先使用materialQuantity,如果为0则使用quantity
|
||
if (borrowMaterialInbound.materialQuantity != null && borrowMaterialInbound.materialQuantity > 0)
|
||
{
|
||
combinedClass.incomeQuantity = borrowMaterialInbound.materialQuantity.ToString();
|
||
Debug.Log($"使用materialQuantity值: {borrowMaterialInbound.materialQuantity}");
|
||
}
|
||
else if (borrowMaterialInbound.quantity != null && borrowMaterialInbound.quantity > 0)
|
||
{
|
||
combinedClass.incomeQuantity = borrowMaterialInbound.quantity.ToString();
|
||
Debug.Log($"使用quantity值: {borrowMaterialInbound.quantity}");
|
||
}
|
||
else
|
||
{
|
||
Debug.Log("两个数量字段都为0或null,不进行赋值");
|
||
}
|
||
|
||
if (borrowMaterialInbound.materialName != null)
|
||
combinedClass.moderName = borrowMaterialInbound.materialName.ToString();
|
||
if (borrowMaterialInbound.materialCode != null)
|
||
combinedClass.materialCode = borrowMaterialInbound.materialCode.ToString();
|
||
if (borrowMaterialInbound.materialDescription != null)
|
||
combinedClass.materialName = borrowMaterialInbound.materialDescription.ToString();
|
||
Debug.Log($"已反序列化为BorrowMaterialInbound: {JsonConvert.SerializeObject(GlobalDataStorage.Instance.materialTaskObj)}");
|
||
break;
|
||
case "项目领用出库": // ProjectUseMaterialOutbound
|
||
Framework.Dto.ProjectUseMaterialOutbound projectUseMaterialOutbound = (Framework.Dto.ProjectUseMaterialOutbound)GlobalDataStorage.Instance.materialTaskObj;
|
||
// 智能判断数量字段:优先使用materialQuantity,如果为0则使用quantity
|
||
if (projectUseMaterialOutbound.materialQuantity != null && projectUseMaterialOutbound.materialQuantity > 0)
|
||
{
|
||
combinedClass.incomeQuantity = projectUseMaterialOutbound.materialQuantity.ToString();
|
||
Debug.Log($"使用materialQuantity值: {projectUseMaterialOutbound.materialQuantity}");
|
||
}
|
||
else if (projectUseMaterialOutbound.quantity != null && projectUseMaterialOutbound.quantity > 0)
|
||
{
|
||
combinedClass.incomeQuantity = projectUseMaterialOutbound.quantity.ToString();
|
||
Debug.Log($"使用quantity值: {projectUseMaterialOutbound.quantity}");
|
||
}
|
||
else
|
||
{
|
||
Debug.Log("两个数量字段都为0或null,不进行赋值");
|
||
}
|
||
|
||
if (projectUseMaterialOutbound.materialName != null)
|
||
combinedClass.moderName = projectUseMaterialOutbound.materialName.ToString();
|
||
if (projectUseMaterialOutbound.materialCode != null)
|
||
combinedClass.materialCode = projectUseMaterialOutbound.materialCode.ToString();
|
||
if (projectUseMaterialOutbound.materialDescription != null)
|
||
combinedClass.materialName = projectUseMaterialOutbound.materialDescription.ToString();
|
||
Debug.Log($"已反序列化为ProjectUseMaterialOutbound: {JsonConvert.SerializeObject(GlobalDataStorage.Instance.materialTaskObj)}");
|
||
break;
|
||
case "库存物资报废": // InventoryMaterialScrap
|
||
Framework.Dto.InventoryMaterialScrap inventoryMaterialScrap = (Framework.Dto.InventoryMaterialScrap)GlobalDataStorage.Instance.materialTaskObj;
|
||
// 智能判断数量字段:优先使用materialQuantity,如果为0则使用quantity
|
||
if (inventoryMaterialScrap.materialQuantity != null && inventoryMaterialScrap.materialQuantity > 0)
|
||
{
|
||
combinedClass.incomeQuantity = inventoryMaterialScrap.materialQuantity.ToString();
|
||
Debug.Log($"使用materialQuantity值: {inventoryMaterialScrap.materialQuantity}");
|
||
}
|
||
else if (inventoryMaterialScrap.quantity != null && inventoryMaterialScrap.quantity > 0)
|
||
{
|
||
combinedClass.incomeQuantity = inventoryMaterialScrap.quantity.ToString();
|
||
Debug.Log($"使用quantity值: {inventoryMaterialScrap.quantity}");
|
||
}
|
||
else
|
||
{
|
||
Debug.Log("两个数量字段都为0或null,不进行赋值");
|
||
}
|
||
|
||
if (inventoryMaterialScrap.materialName != null)
|
||
combinedClass.moderName = inventoryMaterialScrap.materialName.ToString();
|
||
if (inventoryMaterialScrap.materialCode != null)
|
||
combinedClass.materialCode = inventoryMaterialScrap.materialCode.ToString();
|
||
if (inventoryMaterialScrap.materialDescription != null)
|
||
combinedClass.materialName = inventoryMaterialScrap.materialDescription.ToString();
|
||
Debug.Log($"已反序列化为InventoryMaterialScrap: {JsonConvert.SerializeObject(GlobalDataStorage.Instance.materialTaskObj)}");
|
||
break;
|
||
}
|
||
|
||
// 检查并显示匹配的科目
|
||
CheckAndDisplayMatchingSubject();
|
||
FlowStepController.Instance.stepInits = FindObjectsOfType<StepInit>().ToList();
|
||
|
||
|
||
moderController.InitializeModelProcessors();
|
||
|
||
//初始化场景
|
||
//TutorialGuideManager.Instance.StartGuide();
|
||
if (taskPrompt != null)
|
||
{
|
||
// taskPrompt.Init(combinedClass.stage);
|
||
taskPrompt.Init(GlobalDataStorage.Instance.GetTaskBook());
|
||
}
|
||
|
||
if (moderController != null)
|
||
{
|
||
moderController.Init(combinedClass.moderName);
|
||
}
|
||
|
||
if (documentManagement != null)
|
||
{
|
||
documentManagement.Init();
|
||
}
|
||
|
||
|
||
FlowStepController.Instance.Init();
|
||
pice = GetPice();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 解析JSON为MaterialModel,然后将字段值赋值给combinedClass的对应字段
|
||
/// </summary>
|
||
/// <param name="jsonString">JSON字符串</param>
|
||
public void ParseMaterialAndAssignToCombinedClass(string jsonString)
|
||
{
|
||
try
|
||
{
|
||
// 先解析JSON为MaterialModel对象
|
||
InventoryEntry entry = JsonConvert.DeserializeObject<InventoryEntry>(jsonString);
|
||
|
||
// 匹配字段赋值
|
||
combinedClass.materialCode = entry.Code; // 物料编码
|
||
combinedClass.materialName = entry.Description; // 物料描述(说明:InventoryEntry 中的 Description 实际为物资描述)
|
||
combinedClass.moderName = entry.ModelName; // 物料模型名称
|
||
combinedClass.BatchNumber = entry.BatchNumber; // 批次号
|
||
combinedClass.storageNumber = entry.StorageDocument; // 入库单编号
|
||
combinedClass.goodsTransferNumber = entry.DocNo; // 货物交接单号
|
||
combinedClass.StockLocationCode = entry.InventoryLocation; // 库存地点代码
|
||
combinedClass.WarehouseNumber = entry.WarehouseNumber; // 仓库号
|
||
combinedClass.FactoryCode = entry.FactoryCode; // 工厂代码
|
||
combinedClass.TransportationTypeCode = entry.MovementType; // 移动类型代码
|
||
combinedClass.TargetLocation = entry.BinNumber; // 目标仓位
|
||
combinedClass.incomeQuantity = entry.ReceivedQty; // 收入数量
|
||
combinedClass.inventoryQuantity = entry.BalanceQty; // 结存数量
|
||
combinedClass.issueQuantity = entry.IssuedQty; // 发出数量
|
||
combinedClass.initialQuantity = entry.InitialQty; // 期初库存数量
|
||
combinedClass.materialUnit = entry.Quantity; // 物资数量单位
|
||
combinedClass.warehouseKeeper = entry.Librarian; // 库管员
|
||
combinedClass.warehouseDirector = entry.WarehouseSupervisor; // 仓库主管
|
||
combinedClass.materialCompanySign = entry.SupplierSign; // 物资公司签字
|
||
combinedClass.unitSign = entry.Receiver; // 单位签收人
|
||
combinedClass.supplierDelivery = entry.SupplierDeliverer; // 供应商交付人
|
||
combinedClass.shipper = entry.Shipper; // 发货方
|
||
combinedClass.deliveryParty = entry.Consignee; // 收货方
|
||
combinedClass.materialVoucherNumber = entry.MaterialDocument; // 物料凭证编号
|
||
combinedClass.AccountingDate = entry.DocumentDate; // 过账日期
|
||
combinedClass.Reviewers = entry.WarehouseSupervisor; // 审核人签字(假设复用仓库主管)
|
||
combinedClass.Suppliesdepartment = entry.SupplierSign; // 物资部门签字(假设复用物资公司签字)
|
||
combinedClass.Subjectname = MotionEngine.GetModule<GlobalDataStorage>().ExamData.Data.examName; // 科目名
|
||
|
||
|
||
combinedClass.unitPrice = ""; // 收货单价
|
||
combinedClass.TodayTime = ""; // 今天日期
|
||
combinedClass.VoucherDateStart = ""; // 凭证日期Start
|
||
combinedClass.VoucherDateEnd = ""; // 凭证日期End
|
||
combinedClass.OrderNumber = ""; // 订单号
|
||
combinedClass.NeedNumber = ""; // 需求数量
|
||
combinedClass.Attn = ""; // 经办人签字
|
||
combinedClass.SourceLocation = ""; // 源发地仓位
|
||
|
||
// 其他未匹配字段统一初始化为 ""
|
||
// combinedClass.stage = ""; // 任务要求
|
||
combinedClass.storageType = ""; // 出入库类型
|
||
combinedClass.ContractNumber = ""; // 合同编号
|
||
combinedClass.StockLocationName = ""; // 库存地点名称
|
||
combinedClass.FactoryName = ""; // 工厂名称
|
||
combinedClass.CompanyCode = ""; // 公司代码
|
||
combinedClass.CompanyName = ""; // 公司名称
|
||
combinedClass.TransportationTypeName = ""; // 移动类型名称
|
||
combinedClass.TransportationTypeDescription = ""; // 装运类型描述
|
||
combinedClass.SupplierCode = ""; // 供应商编码
|
||
combinedClass.SupplierName = ""; // 供应商名称
|
||
combinedClass.materialNumber = ""; // 物料编号
|
||
combinedClass.materialVoucherCreator = ""; // 物料凭证创建人
|
||
combinedClass.accountingVoucherNumber = ""; // 会计凭证号
|
||
combinedClass.DeliveryDate = ""; // 实际交货期
|
||
combinedClass.FromPartyDeliveryDate = ""; // 发货方时间
|
||
combinedClass.ToPartyDeliveryDate = ""; // 收货方时间
|
||
combinedClass.SupplierSignatureDate = ""; // 物资供应公司签字日期
|
||
combinedClass.ProjectUnitSignatureDate = ""; // 项目单位接收人签字日期
|
||
combinedClass.SupplierDeliverySignatureDate = ""; // 供应商交付人签字日期
|
||
combinedClass.PurchaseVoucherNumber = ""; // 采购凭证号
|
||
combinedClass.PurchaseVoucherItemNumber = ""; // 采购凭证的项目编号
|
||
combinedClass.SupplyPlanNumber = ""; // 供应计划编号
|
||
combinedClass.ElectronicAcceptanceReportNumber = ""; // 电子验收报告编号
|
||
|
||
Debug.Log("=== CombinedClass 字段值打印 ===");
|
||
|
||
Debug.Log($"任务要求: {combinedClass.stage}");
|
||
Debug.Log($"出入库类型: {combinedClass.storageType}");
|
||
Debug.Log($"物料编码: {combinedClass.materialCode}");
|
||
Debug.Log($"物料描述: {combinedClass.materialName}");
|
||
Debug.Log($"物料模型名称: {combinedClass.moderName}");
|
||
Debug.Log($"物料编号: {combinedClass.materialNumber}");
|
||
Debug.Log($"批次号: {combinedClass.BatchNumber}");
|
||
Debug.Log($"入库单编号: {combinedClass.storageNumber}");
|
||
Debug.Log($"货物交接单号: {combinedClass.goodsTransferNumber}");
|
||
Debug.Log($"合同编号: {combinedClass.ContractNumber}");
|
||
Debug.Log($"库存地点代码: {combinedClass.StockLocationCode}");
|
||
Debug.Log($"库存地点名称: {combinedClass.StockLocationName}");
|
||
Debug.Log($"仓库号: {combinedClass.WarehouseNumber}");
|
||
Debug.Log($"工厂代码: {combinedClass.FactoryCode}");
|
||
Debug.Log($"工厂名称: {combinedClass.FactoryName}");
|
||
Debug.Log($"公司代码: {combinedClass.CompanyCode}");
|
||
Debug.Log($"公司名称: {combinedClass.CompanyName}");
|
||
Debug.Log($"移动类型代码: {combinedClass.TransportationTypeCode}");
|
||
Debug.Log($"移动类型名称: {combinedClass.TransportationTypeName}");
|
||
Debug.Log($"装运类型描述: {combinedClass.TransportationTypeDescription}");
|
||
Debug.Log($"供应商编码: {combinedClass.SupplierCode}");
|
||
Debug.Log($"供应商名称: {combinedClass.SupplierName}");
|
||
Debug.Log($"目标仓位: {combinedClass.TargetLocation}");
|
||
Debug.Log($"源发地仓位: {combinedClass.SourceLocation}");
|
||
Debug.Log($"收入数量: {combinedClass.incomeQuantity}");
|
||
Debug.Log($"结存数量: {combinedClass.inventoryQuantity}");
|
||
Debug.Log($"发出数量: {combinedClass.issueQuantity}");
|
||
Debug.Log($"期初库存数量: {combinedClass.initialQuantity}");
|
||
Debug.Log($"物资数量单位: {combinedClass.materialUnit}");
|
||
Debug.Log($"收货单价: {combinedClass.unitPrice}");
|
||
Debug.Log($"库管员: {combinedClass.warehouseKeeper}");
|
||
Debug.Log($"仓库主管: {combinedClass.warehouseDirector}");
|
||
Debug.Log($"物资公司签字: {combinedClass.materialCompanySign}");
|
||
Debug.Log($"单位签收人: {combinedClass.unitSign}");
|
||
Debug.Log($"供应商交付人: {combinedClass.supplierDelivery}");
|
||
Debug.Log($"发货方: {combinedClass.shipper}");
|
||
Debug.Log($"收货方: {combinedClass.deliveryParty}");
|
||
Debug.Log($"物料凭证创建人: {combinedClass.materialVoucherCreator}");
|
||
Debug.Log($"会计凭证号: {combinedClass.accountingVoucherNumber}");
|
||
Debug.Log($"物料凭证编号: {combinedClass.materialVoucherNumber}");
|
||
Debug.Log($"实际交货期: {combinedClass.DeliveryDate}");
|
||
Debug.Log($"过账日期: {combinedClass.AccountingDate}");
|
||
Debug.Log($"发货方时间: {combinedClass.FromPartyDeliveryDate}");
|
||
Debug.Log($"收货方时间: {combinedClass.ToPartyDeliveryDate}");
|
||
Debug.Log($"物资供应公司签字日期: {combinedClass.SupplierSignatureDate}");
|
||
Debug.Log($"项目单位接收人签字日期: {combinedClass.ProjectUnitSignatureDate}");
|
||
Debug.Log($"供应商交付人签字日期: {combinedClass.SupplierDeliverySignatureDate}");
|
||
Debug.Log($"采购凭证号: {combinedClass.PurchaseVoucherNumber}");
|
||
Debug.Log($"采购凭证的项目编号: {combinedClass.PurchaseVoucherItemNumber}");
|
||
Debug.Log($"凭证日期Start: {combinedClass.VoucherDateStart}");
|
||
Debug.Log($"凭证日期End: {combinedClass.VoucherDateEnd}");
|
||
Debug.Log($"供应计划编号: {combinedClass.SupplyPlanNumber}");
|
||
Debug.Log($"电子验收报告编号: {combinedClass.ElectronicAcceptanceReportNumber}");
|
||
Debug.Log($"订单号: {combinedClass.OrderNumber}");
|
||
Debug.Log($"需求数量: {combinedClass.NeedNumber}");
|
||
Debug.Log($"审核人签字: {combinedClass.Reviewers}");
|
||
Debug.Log($"经办人签字: {combinedClass.Attn}");
|
||
Debug.Log($"物资部门签字: {combinedClass.Suppliesdepartment}");
|
||
Debug.Log($"今天日期: {combinedClass.TodayTime}");
|
||
Debug.Log($"科目名: {combinedClass.Subjectname}");
|
||
|
||
Debug.Log("=== 打印结束 ===");
|
||
|
||
|
||
//Debug.Log($"<color=green>【GameManager】</color>成功将MaterialModel数据赋值到combinedClass:{combinedClass.modelName},数量:{combinedClass.quantity}");
|
||
}
|
||
catch (System.Exception e)
|
||
{
|
||
Debug.LogError($"<color=red>【GameManager】</color>解析MaterialModel失败:{e.Message}");
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 物资数量
|
||
/// </summary>
|
||
public int marteialnumber;
|
||
/// <summary>
|
||
/// 单位
|
||
/// </summary>
|
||
public string unit;
|
||
|
||
/// <summary>
|
||
/// 单价
|
||
/// </summary>
|
||
public string pice;
|
||
/// <summary>
|
||
/// 获取价格
|
||
/// </summary>
|
||
public string GetPice()
|
||
{
|
||
if (ModerController.Instance.checkGoods.Count > 0)
|
||
{
|
||
|
||
|
||
if (ModerController.Instance.checkGoods[0].name.Contains("1kV电缆终端"))
|
||
{
|
||
return "123.89";
|
||
}
|
||
else if (ModerController.Instance.checkGoods[0].name.Contains("10kV变压器"))
|
||
{
|
||
return "75358.67";
|
||
}
|
||
else if (ModerController.Instance.checkGoods[0].name.Contains("10kV电缆终端"))
|
||
{
|
||
return "457.52";
|
||
}
|
||
else if (ModerController.Instance.checkGoods[0].name.Contains("10kV三相隔离开关"))
|
||
{
|
||
return "1118.58";
|
||
}
|
||
else if (MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("布电线"))
|
||
{
|
||
return "7.22";
|
||
}
|
||
else if (MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("低压电流互感器"))
|
||
{
|
||
return "272.57";
|
||
}
|
||
else if (MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("电缆分支箱"))
|
||
{
|
||
return "6273.05";
|
||
}
|
||
else if (MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("电力电缆"))
|
||
{
|
||
return "908309.73";
|
||
}
|
||
else if (MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("蝶式绝缘子"))
|
||
{
|
||
return "6.19";
|
||
}
|
||
else if (MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("高压熔断器"))
|
||
{
|
||
return "349.56";
|
||
}
|
||
else if (MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("交流盘形悬式瓷绝缘子"))
|
||
{
|
||
return "51.07";
|
||
}
|
||
else if (MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("接地短路故障指示器"))
|
||
{
|
||
return "183.19";
|
||
}
|
||
else if (MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("接续金具-接地线夹"))
|
||
{
|
||
return "10.09";
|
||
}
|
||
else if (MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("联结金具-直角挂板"))
|
||
{
|
||
return "6.27";
|
||
}
|
||
else if (MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("配电箱"))
|
||
{
|
||
return "17683.19";
|
||
}
|
||
else if (MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("线路柱式瓷绝缘子"))
|
||
{
|
||
return "44.27";
|
||
}
|
||
else if (MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("柱上断路器"))
|
||
{
|
||
return "21170";
|
||
}
|
||
else
|
||
{
|
||
return "";
|
||
}
|
||
}
|
||
else
|
||
{
|
||
return "";
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 获取数量
|
||
/// </summary>
|
||
public void GetNumber()
|
||
{
|
||
if (MotionEngine.GetModule<GlobalDataStorage>().GetTaskBookValueByMapping("台") != "")
|
||
{
|
||
marteialnumber = int.Parse(MotionEngine.GetModule<GlobalDataStorage>().GetTaskBookValueByMapping("台"));
|
||
unit = "台";
|
||
}
|
||
if (MotionEngine.GetModule<GlobalDataStorage>().GetTaskBookValueByMapping("套") != "")
|
||
{
|
||
marteialnumber = int.Parse(MotionEngine.GetModule<GlobalDataStorage>().GetTaskBookValueByMapping("套"));
|
||
unit = "套";
|
||
}
|
||
if (MotionEngine.GetModule<GlobalDataStorage>().GetTaskBookValueByMapping("组") != "")
|
||
{
|
||
marteialnumber = int.Parse(MotionEngine.GetModule<GlobalDataStorage>().GetTaskBookValueByMapping("组"));
|
||
unit = "组";
|
||
}
|
||
if (MotionEngine.GetModule<GlobalDataStorage>().GetTaskBookValueByMapping("米") != "")
|
||
{
|
||
marteialnumber = int.Parse(MotionEngine.GetModule<GlobalDataStorage>().GetTaskBookValueByMapping("米"));
|
||
unit = "米";
|
||
}
|
||
if (MotionEngine.GetModule<GlobalDataStorage>().GetTaskBookValueByMapping("千米") != "")
|
||
{
|
||
marteialnumber = int.Parse(MotionEngine.GetModule<GlobalDataStorage>().GetTaskBookValueByMapping("千米"));
|
||
unit = "千米";
|
||
}
|
||
if (MotionEngine.GetModule<GlobalDataStorage>().GetTaskBookValueByMapping("只") != "")
|
||
{
|
||
marteialnumber = int.Parse(MotionEngine.GetModule<GlobalDataStorage>().GetTaskBookValueByMapping("只"));
|
||
unit = "只";
|
||
}
|
||
if (MotionEngine.GetModule<GlobalDataStorage>().GetTaskBookValueByMapping("片") != "")
|
||
{
|
||
marteialnumber = int.Parse(MotionEngine.GetModule<GlobalDataStorage>().GetTaskBookValueByMapping("片"));
|
||
unit = "片";
|
||
}
|
||
if (MotionEngine.GetModule<GlobalDataStorage>().GetTaskBookValueByMapping("付") != "")
|
||
{
|
||
marteialnumber = int.Parse(MotionEngine.GetModule<GlobalDataStorage>().GetTaskBookValueByMapping("付"));
|
||
unit = "付";
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 检查并显示匹配的科目
|
||
/// </summary>
|
||
private void CheckAndDisplayMatchingSubject()
|
||
{
|
||
if (subjects == null || subjects.Length == 0)
|
||
{
|
||
Debug.LogWarning("没有配置科目对象");
|
||
return;
|
||
}
|
||
|
||
string examName = MotionEngine.GetModule<GlobalDataStorage>().ExamName;
|
||
if (string.IsNullOrEmpty(examName))
|
||
{
|
||
Debug.LogWarning("未获取到题目名称");
|
||
return;
|
||
}
|
||
|
||
|
||
// 遍历所有科目对象
|
||
foreach (var subject in subjects)
|
||
{
|
||
Debug.Log(subject.name);
|
||
if (subject != null && examName.Contains(subject.name))
|
||
{
|
||
// 显示匹配的科目对象
|
||
subject.gameObject.SetActive(true);
|
||
Debug.Log($"找到匹配的科目: {subject.name}");
|
||
}
|
||
else if (subject != null)
|
||
{
|
||
// 隐藏不匹配的科目对象
|
||
subject.gameObject.SetActive(false);
|
||
}
|
||
}
|
||
}
|
||
|
||
//
|
||
// /// <summary>
|
||
// /// 示例:使用提供的JSON字符串进行测试
|
||
// /// </summary>
|
||
// [ContextMenu("测试MaterialModel解析赋值")]
|
||
// public void TestMaterialModelParsing()
|
||
// {
|
||
// string testJson = "{\"quantity\":\"6\",\"modelName\":\"111\",\"code\":\"33\",\"description\":\"44\",\"storageArea\":\"横梁式货架存储区(B01)\",\"location\":\"B01-01\",\"docNo\":\"111\",\"factoryCode\":\"222\",\"batch\":\"33\",\"inventoryLocation\":\"445\",\"librarian\":\"12得分\",\"warehouseSupervisor\":\"阿斯蒂芬\",\"supplierSign\":\"操作需\",\"receiver\":\"出v发的\",\"supplierDeliverer\":\"阿斯蒂芬\",\"shipper\":\"尺寸v\",\"consignee\":\"试试\",\"receivedQty\":\"1\",\"balanceQty\":\"2\",\"issuedQty\":\"3\",\"initialQty\":\"3\"}";
|
||
//
|
||
// Debug.Log("=== 开始测试JSON解析 ===");
|
||
// ParseMaterialAndAssignToCombinedClass(testJson);
|
||
//
|
||
// Debug.Log("=== 解析完成,打印combinedClass所有字段 ===");
|
||
// }
|
||
//
|
||
// /// <summary>
|
||
// /// 使用用户提供的JSON字符串进行测试
|
||
// /// </summary>
|
||
// [ContextMenu("测试用户JSON")]
|
||
// public void TestUserProvidedJson()
|
||
// {
|
||
// // 注意:将quantity从数字6改为字符串"6",因为MaterialModel中的字段都是string类型
|
||
// string userJson = "{\"quantity\":\"6\",\"modelName\":\"111\",\"code\":\"33\",\"description\":\"44\",\"storageArea\":\"横梁式货架存储区(B01)\",\"location\":\"B01-01\",\"docNo\":\"111\",\"factoryCode\":\"222\",\"batch\":\"33\",\"inventoryLocation\":\"445\",\"librarian\":\"12得分\",\"warehouseSupervisor\":\"阿斯蒂芬\",\"supplierSign\":\"操作需\",\"receiver\":\"出v发的\",\"supplierDeliverer\":\"阿斯蒂芬\",\"shipper\":\"尺寸v\",\"consignee\":\"试试\",\"receivedQty\":\"1\",\"balanceQty\":\"2\",\"issuedQty\":\"3\",\"initialQty\":\"3\"}";
|
||
//
|
||
// Debug.Log("=== 开始测试用户提供的JSON ===");
|
||
// ParseMaterialAndAssignToCombinedClass(userJson);
|
||
//
|
||
// Debug.Log("=== 解析完成,打印combinedClass所有字段 ===");
|
||
// }
|
||
} |