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_63001 : BaseTaskBookBehavior
    {
        LocationPropertyManager locationManager = new LocationPropertyManager();

        public TaskBookBehavior_63001() : base(63001)
        {
        }


        public override bool TaskBookOperator(TaskDetailInfoModel taskDetailInfo, List<StepDetailInfoModel> taskStepInfoList, CarrierInfoModel carrierInfo)
        {
            try
            {
                var stepInfo = TaskBookRegister.GetCurrentStepDetailInfo(taskDetailInfo, taskStepInfoList);
                bool result = locationManager.UpdateStatus(stepInfo.WareHouseID, LocationStatus.Filled);
                TaskBookRegister.Log(taskDetailInfo, stepInfo, $"库位置满，操作结果:{result}");
                return result;
            }
            catch (Exception ex)
            {
                TaskBookRegister.LogException(ex);
            }
            return false;
        }
    }
}
