using DbCommon.BusinessCore.BaseCore;
using DbCommon.Enties.DbModels;
using PmsSecondaryPackaging.Interface.Model.Carrier;
using PmsSecondaryPackaging.Interface.Model.StepBook;
using PmsSecondaryPackaging.Interface.Model.TaskBook;
using PmsSecondaryPackaging.TaskManager.TaskBookBehavior;
using ProjectManagementSystem.Common.Log;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ProjectManagementSystem.TaskBookEvent
{
    public class TaskBookBehavior_63400 : BaseTaskBookBehavior
    {
        public TaskBookBehavior_63400() : base(63400)
        {
        }

        public override bool TaskBookOperator(TaskDetailInfoModel taskDetailInfo, List<StepDetailInfoModel> taskStepInfoList, CarrierInfoModel carrierInfo)
        {
            try
            {
                bool result = true;
                int startStepId = taskDetailInfo.CurrentStepID + 1;
                int endStepId = startStepId + 4;

                for (int i = startStepId; i < endStepId; i++)
                {
                    var data = new StepUpdateWareHouseInfoModel(taskDetailInfo.TaskID, i, "A03");
                    result &= InterfaceService.UpdateStepWarehouse(data, out string Message);
                }
                return result;
            }
            catch (Exception ex)
            {
                TaskBookRegister.LogException(ex);
            }
            return false;
        }
    }
}
