using HH.AutoBom.Core;
using HH.WMS.WebUI.Controllers;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace HH.WMS.WebUI.Areas.Check.Controllers
{
///
/// 盘点(南通桑德)
///
public class CheckNtsdController : BaseController
{
///
/// 盘点首页
///
///
public ActionResult Index()
{
return View();
}
public ActionResult Add()
{
return View();
}
#region GET
///
/// 获取盘点主表数据
///
/// 盘点单号
/// 仓库编码
/// 库区
/// 物料编码
/// 盘点日期
/// 类型
///
/// [HanHe(LT)] CREATED 2018/7/4
public string GetCheckMst(int pageIndex, int pageSize, string CN_S_OP_NO, string CN_S_TYPE, string CN_S_STOCK_CODE, string CHECKTIME, string CN_S_STATE, string valueDate)
{
string sqlWhere = "WHERE 1=1";
//仓库编码
if (!string.IsNullOrEmpty(CN_S_OP_NO))
{
sqlWhere += " AND CN_S_OP_NO like '%" + CN_S_OP_NO.Trim() + "%'";
}
//仓库编码
if (!string.IsNullOrEmpty(CN_S_STOCK_CODE))
{
sqlWhere += " AND CN_S_STOCK_CODE = '" + CN_S_STOCK_CODE + "'";
}
//类型
if (!string.IsNullOrEmpty(CN_S_TYPE))
{
sqlWhere += " AND CN_S_TYPE = '" + CN_S_TYPE + "' ";
}
string[] date = new string[2];
if (!string.IsNullOrEmpty(valueDate))
{
date = JsonConvert.DeserializeObject(valueDate);
////开始时间
if (!string.IsNullOrEmpty(date[0]))
{
sqlWhere += " AND CN_T_CREATE >= '" + date[0] + "' ";
}
//结束时间
if (!string.IsNullOrEmpty(date[1]))
{
sqlWhere += " AND CN_T_CREATE <= DateAdd(dd, 1, '" + date[1] + "')";
}
}
////开始时间
//if (!string.IsNullOrEmpty(STARTTIME))
//{
// sqlWhere += " AND CN_T_CREATE >= '" + STARTTIME + "' ";
//}
////结束时间
//if (!string.IsNullOrEmpty(ENDTIME))
//{
// sqlWhere += " AND CN_T_CREATE <= DateAdd(dd, 1, '" + ENDTIME + "')";
//}
//状态
if (!string.IsNullOrEmpty(CN_S_STATE))
{
sqlWhere += " AND CN_S_STATE = '" + CN_S_STATE + "'";
}
string OrdeBy = " order by CN_T_CREATE DESC";
var loginer = FormsAuth.GetUserData();
var entity = new
{
tokenId = loginer.Extend1,
OrdeBy = OrdeBy,
sqlWhere = sqlWhere,
pageSize = pageSize,
pageIndex = pageIndex
};
string stringjson = JsonConvert.SerializeObject(entity);
string list = HttpWMS_Post("Api/CheckNtsd/GetCheckMst", stringjson);
return list;
}
///
/// 获取盘点明细数据
///
/// 仓库编码
///
/// [HanHe(LT)] CREATED 2018/7/4
/// [HanHe(dbs)] CREATED 2019/3/18
public string GetCheckDtl(string opNo)
{
string list = HttpWMS_Get("Api/CheckNtsd/GetCheckDtl?opNo=" + opNo);
return list;
}
public string GetCheckList(int pageIndex, int pageSize,string CN_S_STOCK_CODE)
{
string sqlWhere = "WHERE 1=1";
////仓库编码
//if (!string.IsNullOrEmpty(CN_S_OP_NO))
//{
// sqlWhere += " AND CN_S_OP_NO like '%" + CN_S_OP_NO.Trim() + "%'";
//}
////仓库编码
//if (!string.IsNullOrEmpty(CN_S_STOCK_CODE))
//{
// sqlWhere += " AND CN_S_STOCK_CODE = '" + CN_S_STOCK_CODE + "'";
//}
////类型
//if (!string.IsNullOrEmpty(CN_S_TYPE))
//{
// sqlWhere += " AND CN_S_TYPE = '" + CN_S_TYPE + "' ";
//}
//string[] date = new string[2];
//if (!string.IsNullOrEmpty(valueDate))
//{
// date = JsonConvert.DeserializeObject(valueDate);
// ////开始时间
// if (!string.IsNullOrEmpty(date[0]))
// {
// sqlWhere += " AND CN_T_CREATE >= '" + date[0] + "' ";
// }
// //结束时间
// if (!string.IsNullOrEmpty(date[1]))
// {
// sqlWhere += " AND CN_T_CREATE <= DateAdd(dd, 1, '" + date[1] + "')";
// }
//}
////开始时间
//if (!string.IsNullOrEmpty(STARTTIME))
//{
// sqlWhere += " AND CN_T_CREATE >= '" + STARTTIME + "' ";
//}
////结束时间
//if (!string.IsNullOrEmpty(ENDTIME))
//{
// sqlWhere += " AND CN_T_CREATE <= DateAdd(dd, 1, '" + ENDTIME + "')";
//}
//状态
//if (!string.IsNullOrEmpty(CN_S_STATE))
//{
// sqlWhere += " AND CN_S_STATE = '" + CN_S_STATE + "'";
//}
string OrdeBy = " order by CN_T_CREATE DESC";
var loginer = FormsAuth.GetUserData();
var entity = new
{
tokenId = loginer.Extend1,
OrdeBy = OrdeBy,
sqlWhere = sqlWhere,
pageSize = pageSize,
pageIndex = pageIndex
};
string stringjson = JsonConvert.SerializeObject(entity);
string list = HttpWMS_Post("Api/CheckNtsd/GetCheckMst", stringjson);
return list;
}
#endregion
#region ADD
#endregion
}
}