using NFine.Application.WMS;
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using NFine.Code;
using System.Data.SqlClient;
using NFine.Data.Extensions;
using System.Data.OleDb;
using System.Configuration;
using ICS.Application.Entity;
using System.Text;
using NFine.Repository;
using System.Data.Common;
using NFine.Domain._03_Entity.SRM;
using System.Net;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json;
using NFine.Domain._03_Entity.WMS;
namespace NFine.Web.Areas.WMS.Controllers
{
    public class DeleteReceiptsController : ControllerBase
    {
        // GET: WMS/PickMaterial
        WMSDeleteReceipts App = new WMSDeleteReceipts();
        public ActionResult ICSDeleteReceipts()
        {
            return View();
        }

        //删除单据
        [HttpPost]
        [HandlerAjaxOnly]
        //[ValidateAntiForgeryToken]
        public ActionResult DeleteReceipts(string codes,string type)
        {
            try
            {
                int i = App.DeleteReceipt(codes,type);
                if (i > 0)
                {
                    return Success("删除成功!");
                }
                else
                {
                    return Error("删除失败!");
                }
            }
            catch (Exception ex)
            {
                return Error(ex.Message);
            }
        }

        //验证单据
        [HttpPost]
        [HandlerAjaxOnly]
        //[ValidateAntiForgeryToken]
        public ActionResult CheckReceipts(string codes, string type)
        {
            try
            {
                string msg = App.CheckReceipt(codes, type);
                if (!msg.IsEmpty())
                {
                    return Error(msg);
                }
                else 
                {
                    return Success("");
                }
                
            }
            catch (Exception ex)
            {
                return Error(ex.Message);
            }
        }


    }
}