using SlnMesnac.Model.domain;
using SlnMesnac.Repository.service;
using System;
using System.Collections.Generic;
using System.Text;

namespace SlnMesnac.Business.business
{
    public class DatabaseHandleBusniess
    {
        private ProdPlanInfoService _prodPlanInfoService;
        private List<ProdPLanInfo> prodPlanInfos;
       
        public DatabaseHandleBusniess(ProdPlanInfoService prodPlanInfoService)
        {
            _prodPlanInfoService = prodPlanInfoService;
            prodPlanInfos = _prodPlanInfoService.GetRecordStaffAttendances();
        }

        /// <summary>
        /// 查询所有计划工位
        /// </summary>
        /// <returns></returns>
        public List<string> GetProductLineCodes()
        {
           
            List<string> productLineCodes = new List<string>();
            foreach (var prodPlanInfo in prodPlanInfos)
            {
                productLineCodes.Add(prodPlanInfo.StationCode);
            }
            return productLineCodes;
        }

        /// <summary>
        /// 查询所有工单编号
        /// </summary>
        /// <returns></returns>
        public List<string> GetPlanCodes()
        {

            List<string> planCodes = new List<string>();
            foreach (var prodPlanInfo in prodPlanInfos)
            {
                planCodes.Add(prodPlanInfo.PlanCode);
            }
            return planCodes;
        }

        /// <summary>
        /// 查询所有订单编号
        /// </summary>
        /// <returns></returns>
        public List<string> GetOrderCodes()
        {

            List<string> orderCodes = new List<string>();
            foreach (var prodPlanInfo in prodPlanInfos)
            {
                orderCodes.Add(prodPlanInfo.OrderCode);
            }
            return orderCodes;
        }

        /// <summary>
        /// 查询所有物料名称
        /// </summary>
        /// <returns></returns>
        public List<string> GetMaterialNames()
        {

            List<string> materialNames = new List<string>();
            foreach (var prodPlanInfo in prodPlanInfos)
            {
                materialNames.Add(prodPlanInfo.MaterialName);
            }
            return materialNames;
        }
    }
}
