using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Pub_Class;
using RestSharp;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Web;
using System.Web.Http;
using System.Windows.Forms;
using WebAPI.Models;
using WebAPI.Service;
using System.Text.RegularExpressions;
using WebAPI.Controllers.SCGL.日计划管理;
using SyntacticSugar.constant;
namespace WebAPI.Controllers
{
    public class Gy_MaterialController : ApiController
    {
        //获取系统参数
        Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
        public DBUtility.ClsPub.Enum_BillStatus BillStatus;
        public string sWhere = "";
        private json objJsonResult = new json();
        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
        DataSet ds;
        string fileip = System.Configuration.ConfigurationManager.AppSettings["FileIP"];
        ////检测 当前选中行的 项目状态
        //[Route("Gy_Material/CheckUseStatus")]
        //[HttpGet]
        //public void Sub_CheckUseStatus(int grd, int IDCol, string sProcName)
        //{
        //    SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
        //    Int64 sItemID;
        //    try
        //    {
        //        //循环当前网格选中项目
        //        for (int i = 0; i < grd.SelectedRows.Count; i++)
        //        {
        //            //得到内码
        //            sItemID = DBUtility.ClsPub.isLong(grd.Rows[grd.SelectedRows[i].Index].Cells[IDCol].Value);
        //            //调用储存过程 h_p_Gy_CheckUseDept 
        //            oCn.RunProc("exec " + sProcName + " " + sItemID.ToString(), ref ClsPub.sExeReturnInfo);
        //        }
        //    }
        //    catch (Exception e)
        //    {
        //        MessageBox.Show("检测错误!原因:" + ClsPub.sExeReturnInfo);
        //        //objJsonResult.code = "0";
        //        //objJsonResult.count = 0;
        //        //objJsonResult.Message = "检测错误!原因:" + ClsPub.sExeReturnInfo;
        //        //objJsonResult.data = null;
        //        //return objJsonResult;
        //    }
        //}
        /// 
        /// 返回物料列表
        ///参数:string sql。
        ///返回值:object。
        /// 
        [Route("Gy_Material/list")]
        [HttpGet]
        public object list(string sWhere, string user, string Organization)
        {
            try
            {
                List