373 lines
12 KiB
C#
373 lines
12 KiB
C#
using DefaultNamespace;
|
|
using DefaultNamespace.ProcessMode;
|
|
using MotionFramework;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.Networking;
|
|
using UnityEngine.UI;
|
|
using static InterfaceManager;
|
|
|
|
/// <summary>
|
|
/// 维护到货验收单
|
|
/// </summary>
|
|
public class ERPMaintainArrivalInspectionForm : MonoBehaviour
|
|
{
|
|
/// <summary>
|
|
/// 货物交接单号
|
|
/// </summary>
|
|
[Header("货物交接单号")] public string deliveryListNumber;
|
|
|
|
/// <summary>
|
|
/// 货物交接单
|
|
/// </summary>
|
|
[Header("货物交接单")] public InputField input_DeliveryList;
|
|
|
|
/// <summary>
|
|
/// 公司代码
|
|
/// </summary>
|
|
[Header("公司代码")] public InputField input_CompanyCode;
|
|
|
|
/// <summary>
|
|
/// 实际验收日期
|
|
/// </summary>
|
|
[Header("实际验收日期")] public InputField input_ActualInspectionDate;
|
|
|
|
/// <summary>
|
|
/// 过账日期
|
|
/// </summary>
|
|
[Header("过账日期")] public InputField input_PostingDate;
|
|
|
|
/// <summary>
|
|
/// 供应商名称
|
|
/// </summary>
|
|
[Header("供应商名称")] public InputField input_SupplierName;
|
|
|
|
/// <summary>
|
|
/// 物资供应公司签字
|
|
/// </summary>
|
|
[Header("物资供应公司签字")] public InputField input_SupplierSign;
|
|
|
|
/// <summary>
|
|
/// 物资供应公司签字日期
|
|
/// </summary>
|
|
[Header("物资供应公司签字日期")] public InputField input_SupplierSignDate;
|
|
|
|
/// <summary>
|
|
/// 项目单位接收人签字
|
|
/// </summary>
|
|
[Header("项目单位接收人签字")] public InputField input_ProjectUnitSign;
|
|
|
|
/// <summary>
|
|
/// 项目单位接收人签字日期
|
|
/// </summary>
|
|
[Header("项目单位接收人签字日期")] public InputField input_ProjectUnitSignDate;
|
|
|
|
/// <summary>
|
|
/// 供应商交付人签字
|
|
/// </summary>
|
|
[Header("供应商交付人签字")] public InputField input_SupplierDeliverySign;
|
|
|
|
/// <summary>
|
|
/// 供应商交付人签字日期
|
|
/// </summary>
|
|
[Header("供应商交付人签字日期")] public InputField input_SupplierDeliverySignDate;
|
|
|
|
/// <summary>
|
|
/// 查询显示
|
|
/// </summary>
|
|
public List<Transform> panel_QueryShow;
|
|
|
|
/// <summary>
|
|
/// 正常收获
|
|
/// </summary>
|
|
public Button btnNormal;
|
|
|
|
/// <summary>
|
|
/// 过账
|
|
/// </summary>
|
|
public Button btnPosting;
|
|
|
|
/// <summary>
|
|
/// 行项目
|
|
/// </summary>
|
|
public List<TMP_InputField> input_ERPDeliveryLists;
|
|
|
|
/// <summary>
|
|
/// 物资身份码
|
|
/// </summary>
|
|
public List<Toggle> materialToggle;
|
|
|
|
/// <summary>
|
|
/// 选择身份码
|
|
/// </summary>
|
|
public Button ChooseToggle;
|
|
/// <summary>
|
|
/// 身份码面板
|
|
/// </summary>
|
|
public ScrollRect IDcarPanel;
|
|
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
//初始化UI
|
|
if (btnNormal != null)
|
|
{
|
|
btnNormal.onClick.AddListener(() =>
|
|
{
|
|
if (input_DeliveryList != null
|
|
) //查询
|
|
{
|
|
MotionFramework.MotionEngine.GetModule<ProcessManager>().HandleClick(input_DeliveryList.text);
|
|
Normal();
|
|
}
|
|
else
|
|
{
|
|
Debug.Log("货物交接单号不匹配或UI组件未正确初始化");
|
|
}
|
|
});
|
|
}
|
|
else
|
|
{
|
|
Debug.LogError("btn_Query UI组件未正确初始化");
|
|
}
|
|
|
|
//过账
|
|
if (btnPosting != null)
|
|
{
|
|
btnPosting.onClick.AddListener(() =>
|
|
{
|
|
if (input_SupplierSign != null && input_ProjectUnitSign != null && input_SupplierDeliverySign != null)
|
|
{
|
|
//无身份码
|
|
if (RemoveIDcode(MotionEngine.GetModule<GlobalDataStorage>().ExamName))
|
|
{
|
|
if (MotionFramework.MotionEngine.GetModule<ProcessManager>().HandleClick(new List<string> { input_SupplierSign.text, input_ProjectUnitSign.text, input_SupplierDeliverySign.text }))
|
|
ResetUI();
|
|
} //有身份码
|
|
else
|
|
{
|
|
if (MotionFramework.MotionEngine.GetModule<ProcessManager>().HandleClick(new List<string> { input_SupplierSign.text, input_ProjectUnitSign.text, input_SupplierDeliverySign.text, ischoosetrue }))
|
|
ResetUI();
|
|
}
|
|
|
|
}
|
|
else
|
|
{
|
|
Debug.LogError("eRPDeliveryListMain 或 UI组件未正确初始化");
|
|
}
|
|
});
|
|
}
|
|
//电力电缆对应两个身份码
|
|
if (MotionEngine.GetModule<GlobalDataStorage>().ExamName == "电力电缆到货验收入库")
|
|
{
|
|
|
|
int number = GameManager.Instance.marteialnumber * 2;
|
|
for (int i = 0; i < materialToggle.Count; i++)
|
|
{
|
|
if (i >= number)
|
|
{
|
|
materialToggle[i].gameObject.SetActive(false);
|
|
}
|
|
else
|
|
{
|
|
materialToggle[i].gameObject.SetActive(true);
|
|
}
|
|
|
|
}
|
|
|
|
ChooseToggle.onClick.AddListener(() =>
|
|
{
|
|
int trues = 1;
|
|
for (int i = 0; i < materialToggle.Count; i++)
|
|
{
|
|
if (materialToggle[i].isOn)
|
|
{
|
|
trues++;
|
|
}
|
|
}
|
|
|
|
if (trues >= GameManager.Instance.marteialnumber)
|
|
{
|
|
ischoosetrue = "true";
|
|
LoadTriggerNextGuide();
|
|
}
|
|
else
|
|
{
|
|
ischoosetrue = "false";
|
|
}
|
|
});
|
|
}
|
|
else
|
|
{
|
|
int number = GameManager.Instance.marteialnumber;
|
|
for (int i = 0; i < materialToggle.Count; i++)
|
|
{
|
|
if (i >= number)
|
|
{
|
|
materialToggle[i].gameObject.SetActive(false);
|
|
}
|
|
else
|
|
{
|
|
materialToggle[i].gameObject.SetActive(true);
|
|
}
|
|
|
|
}
|
|
|
|
ChooseToggle.onClick.AddListener(() =>
|
|
{
|
|
int trues = 1;
|
|
for (int i = 0; i < materialToggle.Count; i++)
|
|
{
|
|
if (materialToggle[i].isOn)
|
|
{
|
|
trues++;
|
|
}
|
|
}
|
|
|
|
if (trues >= GameManager.Instance.marteialnumber)
|
|
{
|
|
ischoosetrue = "true";
|
|
LoadTriggerNextGuide();
|
|
}
|
|
else
|
|
{
|
|
ischoosetrue = "false";
|
|
}
|
|
});
|
|
}
|
|
|
|
//有身份码
|
|
if (!RemoveIDcode(MotionEngine.GetModule<GlobalDataStorage>().ExamName))
|
|
{
|
|
IDcarPanel = FindObjectByName<ScrollRect>("身份码面版");
|
|
input_SupplierDeliverySign.onValueChanged.AddListener((s) =>
|
|
{
|
|
if (input_SupplierDeliverySign.text == "刘一" && IDcarPanel.horizontalNormalizedPosition != 1)
|
|
{
|
|
IDcarPanel.horizontalNormalizedPosition = 1f;
|
|
LoadTriggerNextGuide();
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
bool isnextstoggle = false;
|
|
private void Update()
|
|
{
|
|
if (materialToggle[0].isOn && !isnextstoggle)
|
|
{
|
|
int clicktoggle = 0;
|
|
for (int i = 0; i < materialToggle.Count; i++)
|
|
{
|
|
if (materialToggle[i].isOn)
|
|
{
|
|
clicktoggle++;
|
|
}
|
|
if (clicktoggle >= GameManager.Instance.marteialnumber && !isnextstoggle)
|
|
{
|
|
LoadTriggerNextGuide();
|
|
ChooseToggle.interactable = true;
|
|
isnextstoggle = true;
|
|
}
|
|
}
|
|
}
|
|
else if (!isnextstoggle)
|
|
{
|
|
ChooseToggle.interactable = false;
|
|
}
|
|
}
|
|
|
|
string ischoosetrue;
|
|
|
|
/// <summary>
|
|
/// 正常收货
|
|
/// </summary>
|
|
public void Normal()
|
|
{
|
|
for (int i = 0; i < panel_QueryShow.Count; i++)
|
|
{
|
|
panel_QueryShow[i].gameObject.SetActive(true);
|
|
}
|
|
|
|
CombinedClass combinedClass = GameManager.Instance.combinedClass;
|
|
if (combinedClass != null)
|
|
{
|
|
input_CompanyCode.text = combinedClass.CompanyCode;
|
|
input_ActualInspectionDate.text = "2025.03.04";
|
|
input_PostingDate.text = "2025.03.04";
|
|
input_SupplierName.text = combinedClass.SupplierName;
|
|
input_SupplierSignDate.text = combinedClass.SupplierSignatureDate;
|
|
input_ProjectUnitSignDate.text = combinedClass.ProjectUnitSignatureDate;
|
|
input_SupplierDeliverySignDate.text = combinedClass.SupplierDeliverySignatureDate;
|
|
|
|
input_ERPDeliveryLists[0].text = MotionEngine.GetModule<GlobalDataStorage>().GetTaskBookValueByMapping("物料编码");
|
|
input_ERPDeliveryLists[1].text = combinedClass.materialName; //物料名称
|
|
input_ERPDeliveryLists[2].text = combinedClass.incomeQuantity; //实际到货数量
|
|
input_ERPDeliveryLists[3].text = GameManager.Instance.unit; //单位
|
|
input_ERPDeliveryLists[4].text = combinedClass.StockLocationCode; //库位
|
|
input_ERPDeliveryLists[5].text = combinedClass.goodsTransferNumber; //物料凭证号
|
|
input_ERPDeliveryLists[6].text = combinedClass.FactoryCode; //工厂
|
|
}
|
|
else
|
|
{
|
|
Debug.LogError("arrivalInspectionForm 未正确初始化");
|
|
}
|
|
|
|
LoadTriggerNextGuide();
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 重置界面
|
|
/// </summary>
|
|
public void ResetUI()
|
|
{
|
|
for (int i = 0; i < panel_QueryShow.Count; i++)
|
|
{
|
|
panel_QueryShow[i].gameObject.SetActive(false);
|
|
}
|
|
|
|
input_CompanyCode.text = "";
|
|
input_ActualInspectionDate.text = "";
|
|
input_PostingDate.text = "";
|
|
input_SupplierName.text = "";
|
|
input_SupplierSignDate.text = "";
|
|
input_ProjectUnitSignDate.text = "";
|
|
input_SupplierDeliverySignDate.text = "";
|
|
for (int i = 0; i < input_ERPDeliveryLists.Count; i++)
|
|
{
|
|
input_ERPDeliveryLists[i].text = "";
|
|
}
|
|
|
|
LoadTriggerNextGuide();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 剔除没有身份码的考试
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public bool RemoveIDcode(string ExamName)
|
|
{
|
|
if (ExamName == "1KV电缆终端到货验收入库" ||
|
|
ExamName == "10KV电缆终端到货验收入库" ||
|
|
ExamName == "布电线到货验收入库" ||
|
|
ExamName == "低压电流互感器到货验收入库" ||
|
|
ExamName == "蝶式绝缘子到货验收入库" ||
|
|
ExamName == "高压熔断器到货验收入库" ||
|
|
ExamName == "交流盘形悬式瓷绝缘子到货验收入库" ||
|
|
ExamName == "接地短路故障指示器到货验收入库" ||
|
|
ExamName == "接续金具-接地线夹到货验收入库" ||
|
|
ExamName == "联结金具-直角挂板到货验收入库" ||
|
|
ExamName == "线路柱式瓷绝缘子到货验收入库")
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
} |