using DefaultNamespace; using DefaultNamespace.ProcessMode; using MotionFramework; using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine; using UnityEngine.UI; using ZTools; using static InterfaceManager; /// /// m查询物资采购合同执行状态 /// public class QueryExecutionStatusMaterial : MonoBehaviour { [Header("mSAP上下架功能")] #region mSAP上下架功能 /// /// 日历组件 /// public ZCalendarDemo zCalendarDemo; /// /// 日历按钮 /// public Button btnQueryStart; /// /// 日历按钮 /// public Button btnQueryEnd; /// /// 仓库号 /// public InputField inputWarehouse; /// /// 物料编码 /// public InputField inputMaterialCode; /// /// 批次 /// public InputField inputMaterialBatch; /// /// 物料凭证 /// public InputField inputMaterialVoucher; /// /// 凭证日期从 /// public InputField inputStart; /// /// 凭证日期至 /// public InputField inputEnd; /// /// 上架 /// public Toggle toggleOnShelf; /// /// 下架 /// public Toggle toggleOffShelf; /// /// 查询按钮 /// public Button btnQuery; #endregion [Header("m仓库上下架管理")] #region m仓库上下架管理 /// /// 仓库上下架管理 /// public Transform warehouseTransform; /// /// 行项目 /// public List inputERPDeliveryLists; /// /// 选择 /// public Toggle toggleERPDeliveryLists; /// /// 黄条 /// public GameObject yellowTicket; /// /// 状态 /// public GameObject status; /// /// 分配仓位 /// public Button btnAllocatePosition; /// /// 生成转储单 /// public Button btnGenerateTransferOrder; #endregion [Header("m分配仓位")] #region m分配仓位 /// /// m分配仓位 /// public Transform mTransformPosition; /// /// 数量 /// public TMP_InputField inputERPDeliveryLists_Quantity; /// /// 未清数量 /// public TMP_InputField inputERPDeliveryLists_UnClearQuantity; /// /// 单位 /// public TMP_InputField inputERPDeliveryLists_Unit; /// /// 仓库号 /// public TMP_InputField inputERPDeliveryLists_Warehouse; /// /// 物料编码 /// public TMP_InputField inputERPDeliveryLists_MaterialCode; /// /// 物料名称 /// public TMP_InputField inputERPDeliveryLists_MaterialName; /// /// 特殊库存 /// public TMP_InputField inputERPDeliveryLists_SpecialStock; /// /// 工厂/库存地点 /// public TMP_InputField inputERPDeliveryLists_FactoryLocation; /// /// 批次 /// public TMP_InputField inputERPDeliveryLists_Batch; /// /// 目标仓位 /// public TMP_InputField inputERPDeliveryLists_TargetPosition; /// /// 数量 /// public TMP_InputField inputERPDeliveryLists_QuantityTwo; /// /// 保存 /// public Button btnSave; /// /// 确定 /// public Button btnConfirm; /// /// 成功 /// public GameObject success; #endregion #region /// /// 返回信息 /// public InputField returnmessage; /// /// 转储单号 /// public InputField order; /// /// 工厂 /// public InputField factory; /// /// 仓库号 /// public InputField locationorder; /// /// 入库日期 /// public InputField indata; /// /// 物料编码 /// public InputField material; /// /// 目标仓位 /// public InputField targlocal; /// /// 上下架数量 /// public InputField outnumber; /// /// 物料描述 /// public InputField matrialmessage; /// /// 批次 /// public InputField Bathch; #endregion bool isclicklocatePosition = false; // Start is called before the first frame update void Start() { targlocal.text = ""; outnumber.text = ""; Init(); } /// /// 生成转储信息 /// private void SetMessage() { returnmessage.text = "转储运单0200223484生成成功"; order.text = "0200223484"; locationorder.text = "HA1"; } private void Init() { // 查找场景中ZCalendarDemo组件 if (zCalendarDemo == null) zCalendarDemo = FindObjectOfType(); if (btnQueryStart != null) { btnQueryStart.onClick.AddListener(() => { InputDate(inputStart); }); } if (btnQueryEnd != null) { btnQueryEnd.onClick.AddListener((() => { InputDate(inputEnd); })); } if (btnQuery != null) { btnQuery.onClick.AddListener(() => { string onShelf = toggleOnShelf.isOn ? "true" : "false"; string offShelf = toggleOffShelf.isOn ? "true" : "false"; List inputList = new List(); inputList.Add(inputWarehouse.text); inputList.Add(inputMaterialCode.text); inputList.Add(inputMaterialBatch.text); inputList.Add(inputMaterialVoucher.text); inputList.Add(inputStart.text); inputList.Add(inputEnd.text); inputList.Add(onShelf); inputList.Add(offShelf); if (MotionFramework.MotionEngine.GetModule()._currentMode == ProcessMode.教学模式 || MotionFramework.MotionEngine.GetModule()._currentMode == ProcessMode.课程预览) { if (MotionEngine.GetModule().HandleClick(inputList)) Query(); } else { MotionEngine.GetModule().HandleClick(inputList); Query(); } }); } if (toggleERPDeliveryLists != null) { toggleERPDeliveryLists.onValueChanged.AddListener((bool value) => { yellowTicket.SetActive(value); }); } //分配仓位 if (btnAllocatePosition != null) { btnAllocatePosition.onClick.AddListener(() => { if (toggleERPDeliveryLists.isOn) { AllocatePosition(); LoadTriggerNextGuide(); } }); } //生成转储单 if (btnGenerateTransferOrder != null) { btnGenerateTransferOrder.onClick.AddListener(() => { string onShelf = toggleERPDeliveryLists.isOn ? "true" : "false"; bool isMatch = MotionFramework.MotionEngine.GetModule().HandleClick(new List { onShelf, inputERPDeliveryLists[7].text, inputERPDeliveryLists[9].text }); status.SetActive(true); SetMessage(); LoadTriggerNextGuide(); }); } //保存 if (btnSave != null) { btnSave.onClick.AddListener(() => { bool isMatch = MotionFramework.MotionEngine.GetModule().HandleClick(new List { inputERPDeliveryLists_TargetPosition.text, inputERPDeliveryLists_QuantityTwo.text }); inputERPDeliveryLists[7].text = inputERPDeliveryLists_TargetPosition.text; inputERPDeliveryLists[8].text = inputERPDeliveryLists_QuantityTwo.text; success.SetActive(true); LoadTriggerNextGuide(); targlocal.text = MotionEngine.GetModule().GetTaskBookValueByMapping("上架仓位"); outnumber.text = GameManager.Instance.marteialnumber.ToString(); mTransformPosition.gameObject.SetActive(false); }); } //确定 //if (btnConfirm != null) //{ // btnConfirm.onClick.AddListener(() => // { // mTransformPosition.gameObject.SetActive(false); // LoadTriggerNextGuide(); // }); //} } /// /// 查询 DA1 2024.07.15 2024.07.15 /// private void Query() { warehouseTransform.gameObject.SetActive(true); CombinedClass combinedClass = GameManager.Instance.combinedClass; if (combinedClass != null && inputERPDeliveryLists.Count >= 14) { inputERPDeliveryLists[0].text = combinedClass.FactoryCode; inputERPDeliveryLists[1].text = combinedClass.WarehouseNumber; inputERPDeliveryLists[2].text = combinedClass.DeliveryDate; inputERPDeliveryLists[3].text = combinedClass.BatchNumber; inputERPDeliveryLists[4].text = combinedClass.TransportationTypeDescription; inputERPDeliveryLists[5].text = combinedClass.materialCode; inputERPDeliveryLists[6].text = combinedClass.SourceLocation; //inputERPDeliveryLists[7].text = combinedClass.TargetLocation; //inputERPDeliveryLists[8].text = combinedClass.Quantity.ToString(); //inputERPDeliveryLists[10].text = combinedClass.materialUnit; inputERPDeliveryLists[9].text = combinedClass.incomeQuantity; //inputERPDeliveryLists[10].text = combinedClass.materialUnit; inputERPDeliveryLists[11].text = combinedClass.materialVoucherNumber; inputERPDeliveryLists[12].text = combinedClass.materialName; //inputERPDeliveryLists[13].text = combinedClass.SpecialStockType; //inputERPDeliveryLists[14].text = combinedClass.SpecialStockNumber; } LoadTriggerNextGuide(); } /// /// 分配仓位 生成转储单 /// private void AllocatePosition() { CombinedClass combinedClass = GameManager.Instance.combinedClass; if (combinedClass != null) { inputERPDeliveryLists_Quantity.text = combinedClass.incomeQuantity; inputERPDeliveryLists_UnClearQuantity.text = combinedClass.incomeQuantity; inputERPDeliveryLists_Unit.text = combinedClass.materialUnit; inputERPDeliveryLists_Warehouse.text = combinedClass.WarehouseNumber; inputERPDeliveryLists_MaterialCode.text = combinedClass.materialCode; inputERPDeliveryLists_MaterialName.text = combinedClass.materialName; //inputERPDeliveryLists_SpecialStock.text = combinedClass.specialStockNumber; inputERPDeliveryLists_FactoryLocation.text = combinedClass.FactoryCode + "/" + combinedClass.StockLocationCode; inputERPDeliveryLists_Batch.text = combinedClass.BatchNumber; } mTransformPosition.gameObject.SetActive(true); } /// /// 输入日期 /// /// public void InputDate(InputField inputField) { // 检查是否找到了ZCalendarDemo组件 if (zCalendarDemo == null) { Debug.LogError("未在场景中找到ZCalendarDemo组件"); } else { //zCalendarDemo.onConfirm += InputDate(); zCalendarDemo.show(inputField); } } private void Update() { factory.text = MotionEngine.GetModule().GetTaskBookValueByMapping("工厂代码"); indata.text = MotionEngine.GetModule().GetTaskBookValueByMapping("日期为"); material.text = MotionEngine.GetModule().GetTaskBookValueByMapping("物料编码"); matrialmessage.text = MotionEngine.GetModule().GetTaskBookValueByMapping("物料描述"); Bathch.text = MotionEngine.GetModule().GetTaskBookValueByMapping("批次"); inputERPDeliveryLists[10].text = GameManager.Instance.unit; inputERPDeliveryLists_Unit.text = GameManager.Instance.unit; inputERPDeliveryLists_MaterialCode.text=MotionEngine.GetModule().GetTaskBookValueByMapping("物料编码"); inputERPDeliveryLists_MaterialName.text=MotionEngine.GetModule().GetTaskBookValueByMapping("物料描述"); inputERPDeliveryLists_Quantity.text=GameManager.Instance.marteialnumber.ToString(); } }