Tz2/Assets/Zion/Scripts/ERP/ManageInventoryReceivingShi...

782 lines
40 KiB
C#

using DefaultNamespace;
using DefaultNamespace.ProcessMode;
using MotionFramework;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Logical;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
using static InterfaceManager;
/// <summary>
/// 管理库存收发货
/// </summary>
public class ManageInventoryReceivingShipping : MonoBehaviour
{
/// <summary>
/// 单例
/// </summary>
public static ManageInventoryReceivingShipping Instance;
/// <summary>
/// UI文本
/// </summary>
public TextMeshProUGUI TextManageInventoryReceivingShipping;
/// <summary>
/// 收发货类型
/// </summary>
public TMP_Dropdown DropdownManageInventoryReceivingShippingType;
/// <summary>
/// 收发货类型子项
/// </summary>
public TMP_Dropdown DropdownManageInventoryReceivingShippingTypeItem;
/// <summary>
/// 订单号
/// </summary>
public TMP_InputField InputFieldManageInventoryReceivingShippingOrderNumber;
/// <summary>
///
/// </summary>
public Button BtnManageInventoryReceivingShippingOrderNumber;
/// <summary>
/// GR收货
/// </summary>
public TMP_InputField InputFieldManageInventoryReceivingShippingGRNumber;
/// <summary>
/// 凭证日期
/// </summary>
public TMP_InputField InputFieldManageInventoryReceivingShippingInDate;
/// <summary>
/// 过账日期
/// </summary>
public TMP_InputField InputFieldManageInventoryReceivingShippingOutDate;
/// <summary>
/// 检查按钮
/// </summary>
public Button BtnManageInventoryReceivingShippingCheck;
/// <summary>
/// 是否检查
/// </summary>
public bool IsCheck = false;
/// <summary>
/// 过账按钮
/// </summary>
public Button BtnManageInventoryReceivingShippingOut;
/// <summary>
/// 行项目 物料短文本
/// </summary>
public TMP_InputField InputFieldManageInventoryReceivingShippingItemShortText;
/// <summary>
/// 行项目 数量
/// </summary>
public TMP_InputField InputFieldManageInventoryReceivingShippingItemQuantity;
/// <summary>
/// 行项目 EUn
/// </summary>
public TMP_InputField InputFieldManageInventoryReceivingShippingItemEUn;
/// <summary>
/// 行项目 库存地点
/// </summary>
public TMP_InputField InputFieldManageInventoryReceivingShippingItemStorageLocation;
/// <summary>
/// 行项目 批次
/// </summary>
public TMP_InputField InputFieldManageInventoryReceivingShippingItemBatch;
/// <summary>
/// 行项目 单位
/// </summary>
public TMP_InputField InputFieldManageInventoryReceivingShippingItemUnit;
/// <summary>
/// 行项目 物料
/// </summary>
public TMP_InputField InputFieldManageInventoryReceivingShippingItemMaterial;
/// <summary>
/// 行项目 确认Toggle
/// </summary>
public Toggle ManageInventoryReceivingShippingOK;
/// <summary>
/// 凭证OK预制体
/// </summary>
public Animator ImgerManageInventoryReceivingShippingVoucherOK;
/// <summary>
/// 凭证OK
/// </summary>
public GameObject ManageInventoryReceivingShippingVoucherOK;
/// <summary>
/// 发货面板
/// </summary>
public Transform PanelManageInventoryReceivingShippingDelivery;
/// <summary>
/// 收货面板
/// </summary>
public Transform PanelManageInventoryReceivingShippingReceive;
/// <summary>
/// 物资退库入库
/// </summary>
public Transform PanelManageInventoryReceivingShippingReturnWarehousing;
/// <summary>
/// 确认按钮
/// </summary>
public Button ToConfirmPostVerification;
/// <summary>
/// 取消按钮
/// </summary>
public Button CancelPostVerification;
/// <summary>
/// 过账面板
/// </summary>
public Transform PostVerification;
/// <summary>
/// 物料凭证完成预制体
/// </summary>
public Animator MaterialDocumentPostingCompleted;
/// <summary>
/// 物料凭证完成
/// </summary>
public GameObject MaterialDocumentPostingCompletedOK;
/// <summary>
/// 物料过账
/// </summary>
public TextMeshProUGUI TextMaterialDocumentPostingCompleted;
/// <summary>
/// 物料过账完成文本
/// </summary>
public TextMeshProUGUI TextPanelMaterialDocumentPostingCompleted;
/// <summary>
/// 物料过账完成面板
/// </summary>
public Transform PanelMaterialDocumentPostingCompleted;
/// <summary>
/// 物料过账完成按钮
/// </summary>
public Button BtnPanelMaterialDocumentPostingCompleted;
/// <summary>
/// 工厂输入框面板
/// </summary>
public GameObject PanelManageInventoryReceivingShippingReceiveFactory;
/// <summary>
/// 工厂输入框
/// </summary>
public TMP_InputField PanelManageInventoryReceivingShippingReceiveFactoryInputField;
private void Awake()
{
Instance = this;
TextManageInventoryReceivingShipping = FindObjectByName<TextMeshProUGUI>("TextManageInventoryReceivingShipping");
DropdownManageInventoryReceivingShippingType = FindObjectByName<TMP_Dropdown>("DropdownManageInventoryReceivingShippingType");
DropdownManageInventoryReceivingShippingTypeItem = FindObjectByName<TMP_Dropdown>("DropdownManageInventoryReceivingShippingTypeItem");
InputFieldManageInventoryReceivingShippingOrderNumber = FindObjectByName<TMP_InputField>("InputFieldManageInventoryReceivingShippingOrderNumber");
BtnManageInventoryReceivingShippingOrderNumber = FindObjectByName<Button>("BtnManageInventoryReceivingShippingOrderNumber");
InputFieldManageInventoryReceivingShippingGRNumber = FindObjectByName<TMP_InputField>("InputFieldManageInventoryReceivingShippingGRNumber");
InputFieldManageInventoryReceivingShippingInDate = FindObjectByName<TMP_InputField>("InputFieldManageInventoryReceivingShippingInDate");
InputFieldManageInventoryReceivingShippingOutDate = FindObjectByName<TMP_InputField>("InputFieldManageInventoryReceivingShippingOutDate");
PanelManageInventoryReceivingShippingDelivery = FindObjectByName<Transform>("PanelManageInventoryReceivingShippingDelivery");
PanelManageInventoryReceivingShippingReceive = FindObjectByName<Transform>("PanelManageInventoryReceivingShippingReceive");
PanelManageInventoryReceivingShippingReturnWarehousing = FindObjectByName<Transform>("PanelManageInventoryReceivingShippingReturnWarehousing");
//行项目
InputFieldManageInventoryReceivingShippingItemShortText = FindObjectByName<TMP_InputField>("InputFieldManageInventoryReceivingShippingItemShortText");
InputFieldManageInventoryReceivingShippingItemQuantity = FindObjectByName<TMP_InputField>("InputFieldManageInventoryReceivingShippingItemQuantity");
InputFieldManageInventoryReceivingShippingItemEUn = FindObjectByName<TMP_InputField>("InputFieldManageInventoryReceivingShippingItemEUn");
InputFieldManageInventoryReceivingShippingItemStorageLocation = FindObjectByName<TMP_InputField>("InputFieldManageInventoryReceivingShippingItemStorageLocation");
InputFieldManageInventoryReceivingShippingItemBatch = FindObjectByName<TMP_InputField>("InputFieldManageInventoryReceivingShippingItemBatch");
InputFieldManageInventoryReceivingShippingItemUnit = FindObjectByName<TMP_InputField>("InputFieldManageInventoryReceivingShippingItemUnit");
InputFieldManageInventoryReceivingShippingItemMaterial = FindObjectByName<TMP_InputField>("InputFieldManageInventoryReceivingShippingItemMaterial");
ManageInventoryReceivingShippingOK = FindObjectByName<Toggle>("ManageInventoryReceivingShippingOK");
//检查按钮 过账按钮
BtnManageInventoryReceivingShippingCheck = FindObjectByName<Button>("BtnManageInventoryReceivingShippingCheck");
BtnManageInventoryReceivingShippingOut = FindObjectByName<Button>("BtnManageInventoryReceivingShippingOut");
ToConfirmPostVerification = FindObjectByName<Button>("ToConfirmPostVerification");
CancelPostVerification = FindObjectByName<Button>("CancelPostVerification");
PostVerification = FindObjectByName<Transform>("PostVerification");
ImgerManageInventoryReceivingShippingVoucherOK = FindObjectByName<Animator>("ImgerManageInventoryReceivingShippingVoucherOK");
MaterialDocumentPostingCompleted = FindObjectByName<Animator>("MaterialDocumentPostingCompleted");
PanelMaterialDocumentPostingCompleted = FindObjectByName<Transform>("PanelMaterialDocumentPostingCompleted");
BtnPanelMaterialDocumentPostingCompleted = FindObjectByName<Button>("BtnPanelMaterialDocumentPostingCompleted");
TextMaterialDocumentPostingCompleted = FindObjectByName<TextMeshProUGUI>("TextMaterialDocumentPostingCompleted");
TextPanelMaterialDocumentPostingCompleted = FindObjectByName<TextMeshProUGUI>("TextPanelMaterialDocumentPostingCompleted");
PanelManageInventoryReceivingShippingReceiveFactory = FindObjectByName<Transform>("PanelManageInventoryReceivingShippingReceiveFactory").gameObject;
PanelManageInventoryReceivingShippingReceiveFactoryInputField = FindObjectByName<TMP_InputField>("PanelManageInventoryReceivingShippingReceiveFactoryInputField");
}
// Start is called before the first frame update
void Start()
{
if (InputFieldManageInventoryReceivingShippingOrderNumber)
{
InputFieldManageInventoryReceivingShippingOrderNumber.onValueChanged.AddListener(OnOrderNumberSubmitted);
}
if (DropdownManageInventoryReceivingShippingType)
{
// 为收发货类型下拉菜单添加事件监听器
DropdownManageInventoryReceivingShippingType.onValueChanged.AddListener(OnShippingTypeChanged);
}
if (DropdownManageInventoryReceivingShippingTypeItem)
{
// 为收发货类型下拉菜单添加事件监听器
DropdownManageInventoryReceivingShippingTypeItem.onValueChanged.AddListener(OnShippingTypeItemChanged);
}
//检查
if (BtnManageInventoryReceivingShippingCheck)
{
BtnManageInventoryReceivingShippingCheck.onClick.AddListener(() =>
{
if (DropdownManageInventoryReceivingShippingType.value == 1 && DropdownManageInventoryReceivingShippingTypeItem.captionText.text != "其他")
{
MangerReceivingCheck();
}
else if (DropdownManageInventoryReceivingShippingType.value == 5)
{
ReturnmaterialCheck();
}
else if (DropdownManageInventoryReceivingShippingType.value == 1 && DropdownManageInventoryReceivingShippingTypeItem.captionText.text == "其他")
{
ExitAssetsCheck();
}
else if (DropdownManageInventoryReceivingShippingType.value == 0 && DropdownManageInventoryReceivingShippingTypeItem.captionText.text == "其他" || DropdownManageInventoryReceivingShippingType.value == 2 && DropdownManageInventoryReceivingShippingTypeItem.captionText.text == "其他")
{
NotUsedReturnmaterialCheck();
}
});
}
//确认过账
if (ToConfirmPostVerification)
{
ToConfirmPostVerification.onClick.AddListener(() =>
{
if (DropdownManageInventoryReceivingShippingType.value == 1 && DropdownManageInventoryReceivingShippingTypeItem.captionText.text != "其他")
{
ManageReceivingEnter();
}
else if (DropdownManageInventoryReceivingShippingType.value == 5)
{
ReturnmaterialEnter();
}
if (DropdownManageInventoryReceivingShippingType.value == 1 && DropdownManageInventoryReceivingShippingTypeItem.captionText.text == "其他")
{
ExitAssetsEnter();
}
else if (DropdownManageInventoryReceivingShippingType.value == 0 && DropdownManageInventoryReceivingShippingTypeItem.captionText.text == "其他" || DropdownManageInventoryReceivingShippingType.value == 2 && DropdownManageInventoryReceivingShippingTypeItem.captionText.text == "其他")
{
NotUsedReturnmaterialEnter();
}
});
}
//取消过账
if (CancelPostVerification)
{
CancelPostVerification.onClick.AddListener(() =>
{
if (ImgerManageInventoryReceivingShippingVoucherOK)
{
PostVerification.gameObject.SetActive(false);
}
});
}
//过账
if (BtnManageInventoryReceivingShippingOut)
{
BtnManageInventoryReceivingShippingOut.onClick.AddListener(() =>
{
PostVerification.gameObject.SetActive(true);
LoadTriggerNextGuide();
});
}
//
if (BtnPanelMaterialDocumentPostingCompleted)
{
BtnPanelMaterialDocumentPostingCompleted.onClick.AddListener(() =>
{
PanelMaterialDocumentPostingCompleted.gameObject.SetActive(false);
LoadTriggerNextGuide();
});
}
}
/// <summary>
/// 调拨入库存收货-采购订单过账
/// </summary>
public void ManageReceivingEnter()
{
string isOn = ManageInventoryReceivingShippingOK.isOn ? "true" : "false";
string isCheck = IsCheck ? "true" : "false";
List<string> list = new List<string>();
list.Add(isOn);
list.Add(isCheck);
// 你可以在这里调用其他方法来处理订单号
if (MotionFramework.MotionEngine.GetModule<ProcessManager>().HandleClick(list))
{
TextMaterialDocumentPostingCompleted.gameObject.SetActive(true);
MaterialDocumentPostingCompletedOK = Instantiate(MaterialDocumentPostingCompleted.gameObject, transform);
if (MaterialDocumentPostingCompletedOK)
{
Reset();
MaterialDocumentPostingCompletedOK.gameObject.SetActive(true);
PanelMaterialDocumentPostingCompleted.gameObject.SetActive(true);
Invoke(nameof(ImgerManageInventoryReceivingShippingVoucherOKFalse), 4f);
LoadTriggerNextGuide();
}
}
}
/// <summary>
/// 调拨入库存检查
/// </summary>
public void MangerReceivingCheck()
{
if (ManageInventoryReceivingShippingOK.isOn)
{
IsCheck = true;
if (ImgerManageInventoryReceivingShippingVoucherOK)
{
ManageInventoryReceivingShippingVoucherOK = Instantiate(ImgerManageInventoryReceivingShippingVoucherOK.gameObject, transform);
if (ManageInventoryReceivingShippingVoucherOK)
{
ManageInventoryReceivingShippingVoucherOK.gameObject.SetActive(true);
LoadTriggerNextGuide();
}
}
Invoke(nameof(ImgerManageInventoryReceivingShippingVoucherOKFalse), 4f);
}
}
/// <summary>
/// 退料入库过账
/// </summary>
public void ReturnmaterialEnter()
{
string isOn = ReceivingShippingReturnWarehousing.Instance.Isok.isOn ? "true" : "false";
string isCheck = IsCheck ? "true" : "false";
List<string> list = new List<string>();
list.Add(isCheck);
//list.Add(ReceivingShippingReturnWarehousing.Instance.point.text);
//list.Add(ReceivingShippingReturnWarehousing.Instance.Materialmessage.text);
list.Add(ReceivingShippingReturnWarehousing.Instance.number.text);
//list.Add(ReceivingShippingReturnWarehousing.Instance.batch.text);
list.Add(isOn);
// 你可以在这里调用其他方法来处理订单号
if (MotionFramework.MotionEngine.GetModule<ProcessManager>().HandleClick(list))
{
TextMaterialDocumentPostingCompleted.gameObject.SetActive(true);
MaterialDocumentPostingCompletedOK = Instantiate(MaterialDocumentPostingCompleted.gameObject, transform);
if (MaterialDocumentPostingCompletedOK)
{
Reset();
MaterialDocumentPostingCompletedOK.gameObject.SetActive(true);
PanelMaterialDocumentPostingCompleted.gameObject.SetActive(true);
PostVerification.gameObject.SetActive(false);
Invoke(nameof(ImgerManageInventoryReceivingShippingVoucherOKFalse), 4f);
LoadTriggerNextGuide();
}
}
}
/// <summary>
/// 退料入库检查
/// </summary>
public void ReturnmaterialCheck()
{
if (ReceivingShippingReturnWarehousing.Instance.Isok.isOn)
{
IsCheck = true;
if (ImgerManageInventoryReceivingShippingVoucherOK)
{
ManageInventoryReceivingShippingVoucherOK = Instantiate(ImgerManageInventoryReceivingShippingVoucherOK.gameObject, transform);
if (ManageInventoryReceivingShippingVoucherOK)
{
ManageInventoryReceivingShippingVoucherOK.gameObject.SetActive(true);
LoadTriggerNextGuide();
}
}
Invoke(nameof(ImgerManageInventoryReceivingShippingVoucherOKFalse), 4f);
}
}
/// <summary>
/// 不可用退库检查
/// </summary>
public void NotUsedReturnmaterialCheck()
{
if (ManageInventoryReceivingShippingOK.isOn)
{
IsCheck = true;
if (ImgerManageInventoryReceivingShippingVoucherOK)
{
ManageInventoryReceivingShippingVoucherOK = Instantiate(ImgerManageInventoryReceivingShippingVoucherOK.gameObject, transform);
if (ManageInventoryReceivingShippingVoucherOK)
{
ManageInventoryReceivingShippingVoucherOK.gameObject.SetActive(true);
LoadTriggerNextGuide();
}
}
Invoke(nameof(ImgerManageInventoryReceivingShippingVoucherOKFalse), 4f);
}
}
/// <summary>
/// 不可用退库确认过账
/// </summary>
public void NotUsedReturnmaterialEnter()
{
string isOn = ManageInventoryReceivingShippingOK.isOn ? "true" : "false";
string isCheck = IsCheck ? "true" : "false";
List<string> list = new List<string>();
//list.Add(isCheck);
list.Add(InputFieldManageInventoryReceivingShippingItemShortText.text);
list.Add(InputFieldManageInventoryReceivingShippingItemQuantity.text);
list.Add(InputFieldManageInventoryReceivingShippingItemBatch.text);
list.Add(InputFieldManageInventoryReceivingShippingItemStorageLocation.text);
list.Add(PanelManageInventoryReceivingShippingReceiveFactoryInputField.text);
//list.Add(InputFieldManageInventoryReceivingShippingItemMaterial.text);
//list.Add(isOn);
// 你可以在这里调用其他方法来处理订单号
if (MotionFramework.MotionEngine.GetModule<ProcessManager>().HandleClick(list))
{
TextMaterialDocumentPostingCompleted.gameObject.SetActive(true);
MaterialDocumentPostingCompletedOK = Instantiate(MaterialDocumentPostingCompleted.gameObject, transform);
if (MaterialDocumentPostingCompletedOK)
{
Reset();
MaterialDocumentPostingCompletedOK.gameObject.SetActive(true);
PanelMaterialDocumentPostingCompleted.gameObject.SetActive(true);
PostVerification.gameObject.SetActive(false);
Invoke(nameof(ImgerManageInventoryReceivingShippingVoucherOKFalse), 4f);
LoadTriggerNextGuide();
}
}
}
/// <summary>
/// 退出退役资产保管检查
/// </summary>
public void ExitAssetsCheck()
{
if (ManageInventoryReceivingShippingOK.isOn)
{
IsCheck = true;
if (ImgerManageInventoryReceivingShippingVoucherOK)
{
ManageInventoryReceivingShippingVoucherOK = Instantiate(ImgerManageInventoryReceivingShippingVoucherOK.gameObject, transform);
if (ManageInventoryReceivingShippingVoucherOK)
{
ManageInventoryReceivingShippingVoucherOK.gameObject.SetActive(true);
InputFieldManageInventoryReceivingShippingItemMaterial.text= MotionEngine.GetModule<GlobalDataStorage>().GetTaskBookValueByMapping("物料描述");
LoadTriggerNextGuide();
}
}
Invoke(nameof(ImgerManageInventoryReceivingShippingVoucherOKFalse), 4f);
}
}
/// <summary>
/// 退出退役资产保管确认过账
/// </summary>
public void ExitAssetsEnter()
{
string isOn = ManageInventoryReceivingShippingOK.isOn ? "true" : "false";
string isCheck = IsCheck ? "true" : "false";
List<string> list = new List<string>();
list.Add(isCheck);
list.Add(InputFieldManageInventoryReceivingShippingItemStorageLocation.text);
list.Add(InputFieldManageInventoryReceivingShippingItemMaterial.text);
list.Add(InputFieldManageInventoryReceivingShippingItemQuantity.text);
list.Add(InputFieldManageInventoryReceivingShippingItemBatch.text);
list.Add(isOn);
list.Add(PanelManageInventoryReceivingShippingReceiveFactoryInputField.text);
list.Add(InputFieldManageInventoryReceivingShippingItemShortText.text);
list.Add(DropdownManageInventoryReceivingShippingType.captionText.text);
list.Add(DropdownManageInventoryReceivingShippingTypeItem.captionText.text);
// 你可以在这里调用其他方法来处理订单号
if (MotionFramework.MotionEngine.GetModule<ProcessManager>().HandleClick(list))
{
TextMaterialDocumentPostingCompleted.gameObject.SetActive(true);
MaterialDocumentPostingCompletedOK = Instantiate(MaterialDocumentPostingCompleted.gameObject, transform);
if (MaterialDocumentPostingCompletedOK)
{
Reset();
MaterialDocumentPostingCompletedOK.gameObject.SetActive(true);
PanelMaterialDocumentPostingCompleted.gameObject.SetActive(true);
PostVerification.gameObject.SetActive(false);
Invoke(nameof(ImgerManageInventoryReceivingShippingVoucherOKFalse), 4f);
LoadTriggerNextGuide();
}
}
}
/// <summary>
/// 关闭凭证OK预制体
/// </summary>
private void ImgerManageInventoryReceivingShippingVoucherOKFalse()
{
if (ManageInventoryReceivingShippingVoucherOK)
{
GameObject.Destroy(ManageInventoryReceivingShippingVoucherOK.gameObject);
}
if (MaterialDocumentPostingCompletedOK)
{
MaterialDocumentPostingCompletedOK.gameObject.SetActive(true);
}
}
/// <summary>
/// 当订单号输入框按下回车键时触发
/// </summary>
/// <param name="orderNumber"></param>
private void OnOrderNumberSubmitted(string orderNumber)
{
if (DropdownManageInventoryReceivingShippingTypeItem.captionText.text != "其他" && InputFieldManageInventoryReceivingShippingOrderNumber.text != "")
{
InputFieldManageInventoryReceivingShippingOrderNumber.GetComponent<TMPInputFieldValidator>().enabled = false;
bool isTrue = false;
// 在这里编写当按下回车键后要执行的逻辑
Debug.Log("订单号已提交: " + orderNumber);
CombinedClass combinedClass = GameManager.Instance.combinedClass;
// 你可以在这里调用其他方法来处理订单号
if (MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("退料物资入库") && MotionEngine.GetModule<ProcessManager>().GetCurrentActionTitle() == "进行系统入库操作")
{
//if (InputFieldManageInventoryReceivingShippingOrderNumber.text == "500059672")
//{
// isTrue = MotionFramework.MotionEngine.GetModule<ProcessManager>().HandleClick("500107557");
//}
//else
//{
isTrue = MotionEngine.GetModule<ProcessManager>().HandleClick(InputFieldManageInventoryReceivingShippingOrderNumber.text);
if (isTrue)
{
InputFieldManageInventoryReceivingShippingInDate.text = "2025.03.04";
InputFieldManageInventoryReceivingShippingOutDate.text = "2025.03.04";
// 显示物料信息
//InputFieldManageInventoryReceivingShippingItemShortText.text = MotionEngine.GetModule<GlobalDataStorage>().GetTaskBookValueByMapping("物料编码");//物料编码
//InputFieldManageInventoryReceivingShippingItemQuantity.text = MotionEngine.GetModule<GlobalDataStorage>().GetTaskBookValueByMapping("台");//数量
//InputFieldManageInventoryReceivingShippingItemEUn.text = combinedClass.materialUnit;
//InputFieldManageInventoryReceivingShippingItemStorageLocation.text = MotionEngine.GetModule<GlobalDataStorage>().GetTaskBookValueByMapping("库存地点");//数量
//InputFieldManageInventoryReceivingShippingItemBatch.text = MotionEngine.GetModule<GlobalDataStorage>().GetTaskBookValueByMapping("批次");//批号
//InputFieldManageInventoryReceivingShippingItemUnit.text = combinedClass.materialUnit;
//InputFieldManageInventoryReceivingShippingItemMaterial.text = MotionEngine.GetModule<GlobalDataStorage>().GetTaskBookValueByMapping("物料描述");//物料描述
//TextMaterialDocumentPostingCompleted.text = "物料凭证" + "4300950077" + "已过帐";
//TextPanelMaterialDocumentPostingCompleted.text = "4300950077";
LoadTriggerNextGuide();
ReceivingShippingReturnWarehousing.Instance.Init();
}
}
else if (MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("调拨物资入库") && MotionEngine.GetModule<ProcessManager>().GetCurrentActionTitle() == "管理库存收发货")
{
isTrue = MotionEngine.GetModule<ProcessManager>().HandleClick(InputFieldManageInventoryReceivingShippingOrderNumber.text);
if (isTrue)
{
InputFieldManageInventoryReceivingShippingInDate.text = "2025.03.04";
InputFieldManageInventoryReceivingShippingOutDate.text = "2025.03.04";
// 显示物料信息
InputFieldManageInventoryReceivingShippingItemShortText.text = MotionEngine.GetModule<GlobalDataStorage>().GetTaskBookValueByMapping("物料编码");//物料编码
InputFieldManageInventoryReceivingShippingItemQuantity.text = GameManager.Instance.marteialnumber.ToString();//数量
InputFieldManageInventoryReceivingShippingItemEUn.text = GameManager.Instance.unit;
InputFieldManageInventoryReceivingShippingItemStorageLocation.text = MotionEngine.GetModule<GlobalDataStorage>().GetTaskBookValueByMapping("库存地点");//数量
InputFieldManageInventoryReceivingShippingItemBatch.text = MotionEngine.GetModule<GlobalDataStorage>().GetTaskBookValueByMapping("批次");//批号
InputFieldManageInventoryReceivingShippingItemUnit.text = GameManager.Instance.unit;
InputFieldManageInventoryReceivingShippingItemMaterial.text = MotionEngine.GetModule<GlobalDataStorage>().GetTaskBookValueByMapping("物料描述");//物料描述
TextMaterialDocumentPostingCompleted.text = "物料凭证" + "4300950077" + "已过帐";
TextPanelMaterialDocumentPostingCompleted.text = "4300950077";
LoadTriggerNextGuide();
}
}
}
}
/// <summary>
/// 当收发货类型下拉菜单改变时触发
/// </summary>
/// <param name="selectedIndex"></param>
private void OnShippingTypeChanged(int selectedIndex)
{
PanelMaterialDocumentPostingCompleted.gameObject.SetActive(false);
ManageInventoryReceivingShippingOK.isOn = false;
//ManageInventoryReceivingShippingReturnWarehousingOK.isOn = false;
if (selectedIndex == 0) // 0是发货
{
PanelManageInventoryReceivingShippingDelivery.gameObject.SetActive(true);
PanelManageInventoryReceivingShippingReceive.gameObject.SetActive(false);
PanelManageInventoryReceivingShippingReturnWarehousing.gameObject.SetActive(false);
DropdownManageInventoryReceivingShippingTypeItem.SetValueWithoutNotify(8);
TextManageInventoryReceivingShipping.text = DropdownManageInventoryReceivingShippingType.captionText.text + " " + DropdownManageInventoryReceivingShippingTypeItem.captionText.text;
if (MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("不可用办理实物退库") ||
MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("废旧物资入库"))
{
PanelManageInventoryReceivingShippingDelivery.gameObject.SetActive(false);
PanelManageInventoryReceivingShippingReceive.gameObject.SetActive(true);
PanelManageInventoryReceivingShippingReturnWarehousing.gameObject.SetActive(false);
PanelManageInventoryReceivingShippingReceiveFactory.SetActive(true);
DropdownManageInventoryReceivingShippingTypeItem.SetValueWithoutNotify(1);
InputFieldManageInventoryReceivingShippingGRNumber.text = "553";
}
else
{
InputFieldManageInventoryReceivingShippingGRNumber.text = "221";
}
}
else if (selectedIndex == 1) // 1是收货
{
PanelManageInventoryReceivingShippingDelivery.gameObject.SetActive(false);
PanelManageInventoryReceivingShippingReceive.gameObject.SetActive(true);
PanelManageInventoryReceivingShippingReturnWarehousing.gameObject.SetActive(false);
DropdownManageInventoryReceivingShippingTypeItem.SetValueWithoutNotify(7);
TextManageInventoryReceivingShipping.text = DropdownManageInventoryReceivingShippingType.captionText.text + " " + DropdownManageInventoryReceivingShippingTypeItem.captionText.text;
InputFieldManageInventoryReceivingShippingGRNumber.text = "101";
if (!MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("代保管")&& !MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("退料物资入库"))
{
LoadTriggerNextGuide();
}
}
else if (selectedIndex == 2) // 2是转移过账
{
PanelManageInventoryReceivingShippingDelivery.gameObject.SetActive(false);
PanelManageInventoryReceivingShippingReceive.gameObject.SetActive(true);
PanelManageInventoryReceivingShippingReturnWarehousing.gameObject.SetActive(false);
PanelManageInventoryReceivingShippingReceiveFactory.SetActive(true);
DropdownManageInventoryReceivingShippingTypeItem.SetValueWithoutNotify(1);
TextManageInventoryReceivingShipping.text = DropdownManageInventoryReceivingShippingType.captionText.text + " " + DropdownManageInventoryReceivingShippingTypeItem.captionText.text;
InputFieldManageInventoryReceivingShippingGRNumber.text = "322";
if (!MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("代保管") && !MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("退料物资入库"))
{
LoadTriggerNextGuide();
}
}
else if (selectedIndex == 5) // 5是返回交货
{
PanelManageInventoryReceivingShippingDelivery.gameObject.SetActive(false);
PanelManageInventoryReceivingShippingReceive.gameObject.SetActive(false);
PanelManageInventoryReceivingShippingReturnWarehousing.gameObject.SetActive(true);
DropdownManageInventoryReceivingShippingTypeItem.SetValueWithoutNotify(4);
TextManageInventoryReceivingShipping.text = DropdownManageInventoryReceivingShippingType.captionText.text + " " + DropdownManageInventoryReceivingShippingTypeItem.captionText.text;
InputFieldManageInventoryReceivingShippingGRNumber.text = "222";
if (!MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("代保管")&& MotionEngine.GetModule<GlobalDataStorage>().ExamName.Contains("退料物资入库"))
{
LoadTriggerNextGuide();
}
}
}
/// <summary>
/// 修改输入框的只读属性
/// </summary>
public void ChangeInputReadOnly()
{
if (DropdownManageInventoryReceivingShippingTypeItem.captionText.text == "其他")
{
InputFieldManageInventoryReceivingShippingItemShortText.readOnly = false;
InputFieldManageInventoryReceivingShippingItemQuantity.readOnly = false;
InputFieldManageInventoryReceivingShippingItemStorageLocation.readOnly = false;
InputFieldManageInventoryReceivingShippingItemBatch.readOnly = false;
InputFieldManageInventoryReceivingShippingItemMaterial.readOnly = false;
PanelManageInventoryReceivingShippingReceiveFactoryInputField.readOnly = false;
}
else
{
InputFieldManageInventoryReceivingShippingItemShortText.readOnly = true;
InputFieldManageInventoryReceivingShippingItemQuantity.readOnly = true;
InputFieldManageInventoryReceivingShippingItemStorageLocation.readOnly = true;
InputFieldManageInventoryReceivingShippingItemBatch.readOnly = true;
InputFieldManageInventoryReceivingShippingItemMaterial.readOnly = true;
PanelManageInventoryReceivingShippingReceiveFactoryInputField.readOnly = true;
}
}
private void Update()
{
ChangeInputReadOnly();
//if (!transform.GetComponent<Image>().enabled)
//{
// Debug.Log(transform.GetComponent<Image>().enabled);
//}
}
/// <summary>
/// 当收发货类型Item下拉菜单改变时触发
/// </summary>
/// <param name="selectedIndex"></param>
private void OnShippingTypeItemChanged(int selectedIndex)
{
if (selectedIndex == 0) // 0是传送
{
TextManageInventoryReceivingShipping.text = DropdownManageInventoryReceivingShippingType.captionText.text + " " + DropdownManageInventoryReceivingShippingTypeItem.captionText.text;
InputFieldManageInventoryReceivingShippingGRNumber.text = "221";
PanelManageInventoryReceivingShippingReceiveFactory.SetActive(false);
}
else if (selectedIndex == 1) // 1是其他
{
TextManageInventoryReceivingShipping.text = DropdownManageInventoryReceivingShippingType.captionText.text + " " + DropdownManageInventoryReceivingShippingTypeItem.captionText.text;
InputFieldManageInventoryReceivingShippingGRNumber.text = "X04";
InputFieldManageInventoryReceivingShippingItemEUn.text = GameManager.Instance.unit;
InputFieldManageInventoryReceivingShippingItemUnit.text = GameManager.Instance.unit;
PanelManageInventoryReceivingShippingReceiveFactory.SetActive(true);
}
else if (selectedIndex == 2) // 2是内向交货
{
TextManageInventoryReceivingShipping.text = DropdownManageInventoryReceivingShippingType.captionText.text + " " + DropdownManageInventoryReceivingShippingTypeItem.captionText.text;
InputFieldManageInventoryReceivingShippingGRNumber.text = "222";
PanelManageInventoryReceivingShippingReceiveFactory.SetActive(false);
}
else if (selectedIndex == 3) // 3是外向交货
{
TextManageInventoryReceivingShipping.text = DropdownManageInventoryReceivingShippingType.captionText.text + " " + DropdownManageInventoryReceivingShippingTypeItem.captionText.text;
InputFieldManageInventoryReceivingShippingGRNumber.text = "222";
PanelManageInventoryReceivingShippingReceiveFactory.SetActive(false);
}
else if (selectedIndex == 4) // 4是物料凭证
{
TextManageInventoryReceivingShipping.text = DropdownManageInventoryReceivingShippingType.captionText.text + " " + DropdownManageInventoryReceivingShippingTypeItem.captionText.text;
InputFieldManageInventoryReceivingShippingGRNumber.text = "222";
PanelManageInventoryReceivingShippingReceiveFactory.SetActive(false);
}
else if (selectedIndex == 5) // 5是订单
{
TextManageInventoryReceivingShipping.text = DropdownManageInventoryReceivingShippingType.captionText.text + " " + DropdownManageInventoryReceivingShippingTypeItem.captionText.text;
InputFieldManageInventoryReceivingShippingGRNumber.text = "322";
PanelManageInventoryReceivingShippingReceiveFactory.SetActive(false);
}
else if (selectedIndex == 6) // 5是订单
{
TextManageInventoryReceivingShipping.text = DropdownManageInventoryReceivingShippingType.captionText.text + " " + DropdownManageInventoryReceivingShippingTypeItem.captionText.text;
InputFieldManageInventoryReceivingShippingGRNumber.text = "222";
PanelManageInventoryReceivingShippingReceiveFactory.SetActive(false);
}
else if (selectedIndex == 7) // 5是订单
{
TextManageInventoryReceivingShipping.text = DropdownManageInventoryReceivingShippingType.captionText.text + " " + DropdownManageInventoryReceivingShippingTypeItem.captionText.text;
InputFieldManageInventoryReceivingShippingGRNumber.text = "101";
PanelManageInventoryReceivingShippingReceiveFactory.SetActive(false);
}
else if (selectedIndex == 8) // 5是订单
{
TextManageInventoryReceivingShipping.text = DropdownManageInventoryReceivingShippingType.captionText.text + " " + DropdownManageInventoryReceivingShippingTypeItem.captionText.text;
InputFieldManageInventoryReceivingShippingGRNumber.text = "221";
PanelManageInventoryReceivingShippingReceiveFactory.SetActive(false);
}
}
/// <summary>
/// 重置
/// </summary>
private void Reset()
{
InputFieldManageInventoryReceivingShippingInDate.text = "";
InputFieldManageInventoryReceivingShippingOutDate.text = "";
// 显示物料信息
InputFieldManageInventoryReceivingShippingItemShortText.text = "";
InputFieldManageInventoryReceivingShippingItemQuantity.text = "";
InputFieldManageInventoryReceivingShippingItemEUn.text = "";
InputFieldManageInventoryReceivingShippingItemStorageLocation.text = "";
InputFieldManageInventoryReceivingShippingItemBatch.text = "";
InputFieldManageInventoryReceivingShippingItemUnit.text = "";
InputFieldManageInventoryReceivingShippingItemMaterial.text = "";
PanelManageInventoryReceivingShippingReceiveFactoryInputField.text = "";
if (MaterialDocumentPostingCompletedOK != null)
{
MaterialDocumentPostingCompletedOK.SetActive(false);
}
PanelMaterialDocumentPostingCompleted.gameObject.SetActive(false);
OnShippingTypeChanged(0);
}
}