using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using com.hnshituo.core.webapp.vo;

namespace Common
{
    /// <summary>
    /// 计量入库称预报表相关接口
    /// </summary>
    public class MeterWorkStorageCalibrationService
    {
        /// <summary>
        /// 平台默认查询接口，0表示get接口
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public RESTfulResult<List<MeterWorkStorageCalibration>> doQueryWf(MeterWorkStorageCalibration info)
        {
            DbHelper db = new DbHelper();
            RESTfulResult<PageList<List<MeterWorkStorageCalibration>>> rm = db.doOption<PageList<List<MeterWorkStorageCalibration>>>("meterworkstoragecalibrations", "/", new object[] { info }, 0);

            RESTfulResult<List<MeterWorkStorageCalibration>> result = new RESTfulResult<List<MeterWorkStorageCalibration>>();
            result.Succeed = rm.Succeed;
            result.Status = rm.Status;
            result.Message = rm.Message;
            result.ResultMessage = rm.ResultMessage;
            result.Code = rm.Code;
            if (rm.Data != null && rm.Data.list != null && rm.Data.list.Count > 0)
            {
                result.Data = rm.Data.list;
            }

            return result;
        }


        /// <summary>
        /// 成品秤校秤数据保存
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public RESTfulResult<string> doAddWf(List<MeterWorkStorageCalibration> lt)
        {
            DbHelper db = new DbHelper();
            RESTfulResult<string> rm = db.doOption<string>("meterworkstoragecalibrations", "doAddWf", new object[] { lt }, 1);
            return rm;
        }

        /// <summary>
        /// 成品秤校秤数据保存：从实绩转换重量
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public RESTfulResult<string> doAddWf(MeterWorkStorageCalibration storageCalibration)
        {
            DbHelper db = new DbHelper();
            List<MeterWorkStorageCalibration> lt = new List<MeterWorkStorageCalibration>();
            lt.Add(storageCalibration);
            RESTfulResult<string> rm = db.doOption<string>("meterworkstoragecalibrations", "doAddWf", new object[] { lt }, 1);
            return rm;
        }

        /// <summary>
        /// 成品秤校秤数据保存:手动选择重量
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public RESTfulResult<string> doAddManual(MeterWorkStorageCalibration storageCalibration)
        {
            DbHelper db = new DbHelper();
            List<MeterWorkStorageCalibration> lt = new List<MeterWorkStorageCalibration>();
            lt.Add(storageCalibration);
            RESTfulResult<string> rm = db.doOption<string>("meterworkstoragecalibrations", "doAddManual", new object[] { lt }, 1);
            return rm;
        }

        /// <summary>
        /// 成品秤校秤数据更新
        /// </summary>
        /// <param name="lt"></param>
        /// <returns></returns>
        public RESTfulResult<string> doUpdateWf(List<MeterWorkStorageCalibration> lt)
        {
            DbHelper db = new DbHelper();
            RESTfulResult<string> rm = db.doOption<string>("meterworkstoragecalibrations", "doUpdateWf", new object[] { lt }, 1);
            return rm;
        }

        /// <summary>
        /// 成品秤校秤数据保存：未生产
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public RESTfulResult<string> doAddNotProd(MeterWorkStorageCalibration storageCalibration)
        {
            DbHelper db = new DbHelper();
            List<MeterWorkStorageCalibration> lt = new List<MeterWorkStorageCalibration>();
            lt.Add(storageCalibration);
            RESTfulResult<string> rm = db.doOption<string>("meterworkstoragecalibrations", "doAddNotProd", new object[] { lt }, 1);
            return rm;
        }

    }
}
