using DefaultNamespace;
using DefaultNamespace.ProcessMode;
using MotionFramework;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
using static InterfaceManager;
///
/// ERP 维护货物交接单
///
public class ERPMaintainGoodsHandoverForm : MonoBehaviour
{
///
/// 货物交接单号
///
//public string deliveryListNumber;
#region UI控件
///
/// 货物交接单
///
public InputField input_DeliveryList;
///
/// 查询按钮
///
public Button btn_Query;
///
/// 过账按钮
///
public Button btn_Post;
///
/// 确认
///
public Button btn_Confirm;
///
/// 过账面板
///
public Transform panel_Post;
///
/// 发货方
///
public InputField input_Shipper;
///
/// 收货方
///
public InputField input_ReceivingParty;
///
/// 合同编号
///
public InputField input_ContractNumber;
///
/// 供应商名称
///
public InputField input_SupplierName;
///
/// 实际交货期
///
public InputField input_ActualDeliveryDate;
///
/// 发货方时间
///
public InputField input_ShipperDate;
///
/// 收货方时间
///
public InputField input_ReceivingPartyDate;
///
/// 库存地点 TMPro
///
public TMP_InputField input_StorageLocation;
///
/// 查询显示
///
public List panel_QueryShow;
///
/// 明细数据
///
public List input_ERPDeliveryLists;
///
/// 货物交接单号
///
public TMP_InputField input_DeliveryListNumber;
///
/// 物料编码
///
public TMP_InputField input_MaterialCode;
#endregion
///
/// 验证数据
///
//public DeliveryList eRPDeliveryListMain;
///
/// 货物交接单验证数据
///
public string str_DeliveryList;
#region 高亮提示
///
/// 货物交接单高亮引导
///
public Transform hightObjDeliveryListQuery;
///
/// 发货人输入高亮提示
///
public Transform hightObjShipperMaintainGoods;
///
/// 收货人输入高亮提示
///
public Transform hightObjReceivingPartyMaintainGoods;
///
/// 库存地点输入高亮提示
///
public Transform hightObjStorageLocationMaintainGoods;
#endregion
// Start is called before the first frame update
void Start()
{
Init();
}
///
///
///
private void Init()
{
//初始化UI
if (btn_Query != null)
{
btn_Query.onClick.AddListener(() =>
{
// if (input_DeliveryList != null &&
// MotionFramework.MotionEngine.GetModule().HandleClick(input_DeliveryList.text))//查询
// {
// Query();
// }
// else
// {
// Debug.Log("货物交接单号不匹配或UI组件未正确初始化");
// }
if (input_DeliveryList != null
)//查询
{
MotionFramework.MotionEngine.GetModule().HandleClick(input_DeliveryList.text);
Query();
}
else
{
Debug.Log("货物交接单号不匹配或UI组件未正确初始化");
}
});
}
else
{
Debug.LogError("btn_Query UI组件未正确初始化");
}
if (btn_Post != null)
{
btn_Post.onClick.AddListener(() =>
{
if (input_Shipper != null && input_ReceivingParty != null && input_StorageLocation != null)
{
if (MotionFramework.MotionEngine.GetModule().HandleClick(new List { input_Shipper.text, input_ReceivingParty.text, input_StorageLocation.text }))
{
Post();
}
}
else
{
Debug.LogError("eRPDeliveryListMain 或 UI组件未正确初始化");
}
});
}
else
{
Debug.LogError("btn_Post UI组件未正确初始化");
}
///确认按钮
btn_Confirm.onClick.AddListener(() =>
{
ResetUI();
});
//
hightObjDeliveryListQuery = FindObjectByName("hightObjDeliveryListQuery");
hightObjShipperMaintainGoods = FindObjectByName("hightObjShipperMaintainGoods");
hightObjReceivingPartyMaintainGoods = FindObjectByName("hightObjReceivingPartyMaintainGoods");
hightObjStorageLocationMaintainGoods = FindObjectByName("hightObjStorageLocationMaintainGoods");
}
///
/// 查询按钮点击事件
///
public void Query()
{
for (int i = 0; i < panel_QueryShow.Count; i++)
{
panel_QueryShow[i].gameObject.SetActive(true);
}
CombinedClass combinedClass = GameManager.Instance.combinedClass;
input_ContractNumber.text = combinedClass.ContractNumber;//合同编号
input_SupplierName.text = "江苏南瑞帕威尔电气有限公司";//供应商名称
input_ActualDeliveryDate.text = "2025.03.04";//实际交货期
input_ShipperDate.text = combinedClass.FromPartyDeliveryDate;//发货方时间
input_ReceivingPartyDate.text = "2025.03.04";//收货方时间
//显示数据
input_ERPDeliveryLists[0].text = MotionEngine.GetModule().GetTaskBookValueByMapping("物料编码");//物料编码
input_ERPDeliveryLists[1].text = MotionEngine.GetModule().GetTaskBookValueByMapping("物料描述");//物料描述
input_ERPDeliveryLists[2].text = combinedClass.PurchaseVoucherNumber;//采购凭证号
input_ERPDeliveryLists[3].text = combinedClass.PurchaseVoucherItemNumber;//采购凭证子项号
input_ERPDeliveryLists[4].text = combinedClass.SupplyPlanNumber;//供应计划号
input_ERPDeliveryLists[5].text = combinedClass.CompanyCode;//公司代码
input_ERPDeliveryLists[6].text = "01D1";
input_ERPDeliveryLists[7].text = GameManager.Instance.marteialnumber.ToString();//数量
input_ERPDeliveryLists[8].text = GameManager.Instance.unit;//单位
input_ERPDeliveryLists[9].text = MotionEngine.GetModule().GetTaskBookValueByMapping("批次");//批号
input_ERPDeliveryLists[10].text = combinedClass.goodsTransferNumber;//交货通知单号
hightObjDeliveryListQuery.gameObject.SetActive(false);
LoadTriggerNextGuide();
}
///
/// 过账按钮点击事件
///
public void Post()
{
CombinedClass combinedClass = GameManager.Instance.combinedClass;
if (combinedClass != null)
{
input_DeliveryListNumber.text = combinedClass.goodsTransferNumber;
input_MaterialCode.text = combinedClass.materialCode;
panel_Post.gameObject.SetActive(true);
}
else
{
Debug.LogError("eRPDeliveryListMain 未正确初始化");
}
LoadTriggerNextGuide();
hightObjShipperMaintainGoods.gameObject.SetActive(false);
hightObjReceivingPartyMaintainGoods.gameObject.SetActive(false);
hightObjStorageLocationMaintainGoods.gameObject.SetActive(false);
}
//重置界面
public void ResetUI()
{
for (int i = 0; i < panel_QueryShow.Count; i++)
{
panel_QueryShow[i].gameObject.SetActive(false);
}
panel_Post.gameObject.SetActive(false);
input_DeliveryListNumber.text = "";
input_MaterialCode.text = "";
input_ActualDeliveryDate.text = "";
input_ShipperDate.text = "";
input_ReceivingPartyDate.text = "";
input_StorageLocation.text = "";
input_DeliveryList.text = "";
input_Shipper.text = "";
input_ReceivingParty.text = "";
for (int i = 0; i < input_ERPDeliveryLists.Count; i++)
{
input_ERPDeliveryLists[i].text = "";
}
}
}