DS7/DSWeb/Areas/WMS/Controllers/WMSController.cs

191 lines
5.1 KiB
C#

using System;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using DSWeb.MvcShipping.Helper;
using DSWeb.MvcShipping.Comm.Cookie;
using HcUtility.Comm;
using HcUtility.Core;
using System.Collections.Generic;
using System.IO;
using System.Data;
using DSWeb.Areas.CommMng.DAL;
using DSWeb.TruckMng.Helper.Repository;
using DSWeb.Areas.OA.Models.WorkFlow;
using DSWeb.EntityDA;
using DSWeb.MvcShipping.DAL.MsSysParamSet;
using Microsoft.Practices.EnterpriseLibrary.Data;
using DSWeb.MvcShipping.DAL.MsSysBillNoSet;//编码规则
using DSWeb.Areas.SysMng.DAL.SysTask;
using DSWeb.WMS.DAL.WMS;
using DSWeb.WMS.Models.WMS;
using DSWeb.Areas.CommMng.Models;
using DSWeb.MvcShipping.DAL.MsBaseInfoDAL;//查询OP权限
using DSWeb.MvcShipping.DAL.MsCodeOpDef;
namespace DSWeb.WMS.Controllers
{
/// <summary>
/// 库存模块 邓羽 20200720
/// </summary>
[JsonRequestBehavior]
public class WMSController : Controller
{
//
// GET: /RptMng/MsRptPcHeadQry
public ActionResult Index()
{
return View();
}
public ActionResult Edit()
{
return View();
}
#region 仓储信息 头表/物理库存/逻辑仓储区
public ContentResult GetDataList(int start, int limit, string condition, string sort="")
{
var dataList = WMSDAL.GetDataList(condition,Session["USERID"].ToString(),start,limit, sort);
var _list = dataList.Skip(start).Take(limit);
//var list = new List<Dictionary<string, string>>();
//if (_list.Count() > 0) {
// foreach (var data in _list) {
// list.Add(data.ExtendDic);
// }
//}
var list_2 = ModelObjectBill.getDicList(ModelObjectConvert<WMSmb>.ToModelObjectList(dataList));
var list_3 = list_2.Skip(start).Take(limit);
var json = JsonConvert.Serialize(new
{
Success = true,
Message = "查询成功",
totalCount = dataList.Count(),
data = list_3.ToList()
//totalCount = dataList.Count,
//data = list.ToList()
//,fieldlist = fieldlist.ToList()
});
return new ContentResult() { Content = json };
}
public ContentResult GetData( string condition)
{
var data = WMSDAL.GetData(condition, Session["USERID"].ToString());
var result = new WMSmb();
result = data;
var json = JsonConvert.Serialize(new
{
Success = true,
Message = "查询成功",
//totalCount = 1,
data = result.ExtendDic
//,fieldlist = fieldlist.ToList()
});
return new ContentResult() { Content = json };
}
public ContentResult GetPhysicsList( string condition )
{
var dataList = WMSDAL.getPhysicsList(condition);
var list = new List<Dictionary<string, string>>();
if (dataList.Count() > 0)
{
foreach (var data in dataList)
{
list.Add(data.ExtendDic);
}
}
var json = JsonConvert.Serialize(new
{
Success = true,
Message = "查询成功",
totalCount = list.Count,
data = list.ToList()
});
return new ContentResult() { Content = json };
}
public ContentResult GetLogicList(string condition)
{
var dataList = WMSDAL.getLogicList(condition);
var list = new List<Dictionary<string, string>>();
if (dataList.Count() > 0)
{
foreach (var data in dataList)
{
list.Add(data.ExtendDic);
}
}
var json = JsonConvert.Serialize(new
{
Success = true,
Message = "查询成功",
totalCount = list.Count,
data = list.ToList()
});
return new ContentResult() { Content = json };
}
#endregion
#region 获取打印的sql文本
public ContentResult GetPrintSql(string printname,string BSNOList)
{
var jsonRespose = new JsonResponse { Success = false, Message = "" };
if (printname == "Print1")
{
var result = new PrintSql();
result.sql1 = WMSDAL.getHeadListStr(" and BSNO in("+ BSNOList + ")", Session["USERID"].ToString(),0,9999).ToString();
result.sql2 = WMSDAL.getPhysicsListStr(" and BSNO in(" + BSNOList + ")");
result.sql2 = WMSDAL.getLogicListStr(" and BSNO in(" + BSNOList + ")");
jsonRespose.Success = true;
jsonRespose.Message = "查询成功";
jsonRespose.Data = result;
}
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
#endregion
}
}