using PmsSecondaryPackaging.Interface.Model.Carrier;
using PmsSecondaryPackaging.Interface.Model.StepBook;
using PmsSecondaryPackaging.Interface.Model.TaskBook;
using PmsSecondaryPackaging.Interface.Model.WareHouse;
using PmsSecondaryPackaging.TaskManager.TaskBookBehavior;
using System.Collections.Generic;
using System.Threading;

namespace ProjectManagementSystem.TaskBookEvent
{
    public class TaskBookBehavior_65052 : BaseTaskBookBehavior
    {
        public TaskBookBehavior_65052() : base(65052)
        {

        }

        public override bool TaskBookOperator(TaskDetailInfoModel taskDetailInfo, List<StepDetailInfoModel> taskStepInfoList, CarrierInfoModel carrierInfo)
        {
            InterfaceService.GetWarehouseListInfo("A3", out List<WareHouseInfoModel> wareHouseInfoModel, out string Message);
            StepAddInfoModel stepAddInfoModel = new StepAddInfoModel(taskDetailInfo.TaskID, wareHouseInfoModel[0].StationID, false, 65053);
            bool success = InterfaceService.TaskAddStep(stepAddInfoModel, out Message);
            while (!success)
            {
                success = InterfaceService.TaskAddStep(stepAddInfoModel, out Message);
                Thread.Sleep(1000);
            }
            return true;
        }
    }
}
