using DSWeb.Areas.Storage.DB; using DSWeb.Areas.Storage.Models; using System.Web.Mvc; using System.Linq; using System.Configuration; using DSWeb.Areas.Storage.Helper; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Web; using System.Globalization; using DSWeb.Areas.Dispatch.Controllers; using DSWeb.Storage.DAL; using log4net; using HcUtility.Comm; using DSWeb.SoftMng.BLL; using DSWeb.SoftMng.Model; using DSWeb.SoftMng.Common; using DSWeb.Areas.CommMng.DAL; using DSWeb.Areas.Dispatch.DB; namespace DSWeb.Areas.Storage.Controllers { public class StorageController: Controller { private static readonly string StateKeyRegist = "regist"; //private static readonly string StateKeyDispatchList = "dispatchlist"; //private static readonly string StateKeyGrabList = "grablist"; //private static readonly string StateKeyFeeList = "feelist"; private static readonly string StateKeyRegistCust = "registCust"; private static readonly string StateKeyStockList = "stocklist"; //裕龙库存查询 private static readonly string StateKeyStorageList = "storagelist";// 裕龙 出入库 private static readonly string StateKeyKucunList = "kucunlist"; //裕龙库存查询 private static readonly string StateKeyRegistCustHJ = "registCustHJ"; //裕龙注册(新仓储通用) private static readonly string StateKeyKucunList2 = "kucunlist2"; //裕龙库存查询 private static string appid = ConfigurationManager.AppSettings["YuLongStorageAppId"]; private static string appsecret = ConfigurationManager.AppSettings["secret"]; private static string dispatchServerUrl = ConfigurationManager.AppSettings["BeitongDispatchServerUrl"]; private static string storageServerUrl = ConfigurationManager.AppSettings["YuLongStorageServerUrl"]; private ILog logger = LogManager.GetLogger("StorageController"); private Storage.DB. DataContext dataContext = new Storage.DB.DataContext(); public StorageController() { //var config = dataContext.MpConfigs.FirstOrDefault(c => c.AppId == appid); //if (config == null) //{ // throw new Exception($"未找到公众号(ID: {appid}) 的配置记录,请配置后再试!"); //} //appsecret = config.AppSecret; } #region 出入库查询 public ActionResult StorageList(string OPENID) { ViewData["openid"] = OPENID; return View(); } #endregion #region 查询入库 //public ActionResult InDoList(string mblno) //{ // var indoinfo = dataContext.IndoInfo.FirstOrDefault(d => d.MBLNO == mblno); // if (indoinfo == null) // { // return RedirectToAction("DispInfoClientRegist", new { mblno }); // } // ViewData["mblno"] = mblno; // return View(); //} [HttpPost] public JsonResult InDoListData(string openid,string mblno, int page = 1, int pageSize = 10) { RespGetIndo resp = new RespGetIndo(); //var infoClient = dataContext.IndoInfo.FirstOrDefault(d => d.MBLNO == mblno); var dataList = MsWMSDAL.GetIndoDataList(mblno, null, null); //var list = dataList.Skip((page - 1) * pageSize).Take(pageSize); resp.Success = true; resp.Message = "查询成功"; resp.Data = dataList.ToList(); resp.Total = dataList.Count; return Json(resp); } #endregion #region 查询出库 //public ActionResult OutDoList(string mblno) //{ // var indoinfo = dataContext.OutdoInfo.FirstOrDefault(d => d.MBLNO == mblno); // ViewData["mblno"] = mblno; // return View(); //} [HttpPost] public JsonResult OutDoListData(string openid, string mblno, int page = 1, int pageSize = 10) { RespGetOutdo resp = new RespGetOutdo(); //var infoClient = dataContext.OutdoInfo.FirstOrDefault(d => d.MBLNO == mblno); var dataList = MsWMSDAL.GetOutdoDataList(mblno, null, null); //var list = dataList.Skip((page - 1) * pageSize).Take(pageSize); resp.Success = true; resp.Message = "查询成功"; resp.Data = dataList.ToList(); resp.Total = dataList.Count; return Json(resp); } #endregion #region 入库委托详情 public ActionResult StorageInDetail(string wmsid) { ViewData["wmsid"] = wmsid; return View(); } public ActionResult StorageInDetailData(string wmsid) { var model = MsWMSDAL.GetOneIndoByWMSID(wmsid); var obj = new { model.WMSID, model.MBLNO, model.DODATE, model.GOODSNAME, model.PKGS, model.KGS // FEE_LIST = dataList, //STATE_LIST = staList }; return Json(obj); } #endregion #region 出库委托详情 public ActionResult StorageOutDetail(string wmsid) { ViewData["wmsid"] = wmsid; return View(); } public ActionResult StorageOutDetailData(string wmsid) { var model = MsWMSDAL.GetOneOutdoByWMSID(wmsid); var obj = new { model.WMSID, model.MBLNO, model.DODATE, model.GOODSNAME, model.PKGS, model.KGS // FEE_LIST = dataList, //STATE_LIST = staList }; return Json(obj); } #endregion #region 库存查询 [HttpPost] public JsonResult StorageData(string openid, string mblno, int page = 1, int pageSize = 10) { RespGetKuCun resp = new RespGetKuCun(); //var infoClient = dataContext.IndoInfo.FirstOrDefault(d => d.MBLNO == mblno); var condition = ""; if (!string.IsNullOrWhiteSpace(mblno)) { condition = " MBLNO like '%" + mblno + "'"; } var dataList = MsWMSDAL.GetKuCunDataList(openid, condition, null); //var list = dataList.Skip((page - 1) * pageSize).Take(pageSize); resp.Success = true; resp.Message = "查询成功"; resp.Data = dataList.ToList();//暂不进行分页 resp.Total = dataList.Count; return Json(resp, JsonRequestBehavior.AllowGet); } [HttpPost] public JsonResult StorageData2(string openid, string mblno, string goodsfeetype, string goodsowner, int page = 1, int pageSize = 10) { RespGetKuCun resp = new RespGetKuCun(); //var infoClient = dataContext.IndoInfo.FirstOrDefault(d => d.MBLNO == mblno); var condition = " 1=1 "; if (!string.IsNullOrWhiteSpace(mblno)) { condition += " and MBLNO like '%" + mblno + "'"; } if (!string.IsNullOrWhiteSpace(goodsfeetype)) { condition += " and goodsfeetype like '%" + goodsfeetype + "%'"; } if (!string.IsNullOrWhiteSpace(goodsowner)) { condition += " and goodsowner like '%" + goodsowner + "'"; } var dataList = MsWMSDAL.GetKuCunDataList(openid, condition, null); //var list = dataList.Skip((page - 1) * pageSize).Take(pageSize); resp.Success = true; resp.Message = "查询成功"; resp.Data = dataList.ToList();//暂不进行分页 resp.Total = dataList.Count; return Json(resp, JsonRequestBehavior.AllowGet); } /// /// 当前库存 /// /// /// /// /// public JsonResult DQStorageData(string openid,string mblno, int page = 1, int pageSize = 10) { RespGetKuCun resp = new RespGetKuCun(); //var infoClient = dataContext.IndoInfo.FirstOrDefault(d => d.MBLNO == mblno); var condition = ""; if (!string.IsNullOrWhiteSpace(mblno)) { condition = " MBLNO like '%" + mblno + "'"; } var dataList = MsWMSDAL.GetDQKuCunDataList(openid, condition, null); //var list = dataList.Skip((page - 1) * pageSize).Take(pageSize); resp.Success = true; resp.Message = "查询成功"; resp.Data = dataList.ToList();//暂不进行分页 resp.Total = dataList.Count; return Json(resp, JsonRequestBehavior.AllowGet); } public ActionResult KucunList(string openid) { ViewData["openid"] = openid; return View(); } public ActionResult KucunList2(string openid) { ViewData["openid"] = openid; return View(); } public ActionResult WUTONGKucunList(string openid,string comp) { ViewData["openid"] = openid; ViewData["comp"] = comp; return View(); } public ActionResult StorageMap(string STOREHOUSE,string AREACODE) { ViewData["STOREHOUSE"] = STOREHOUSE; ViewData["AREACODE"] = AREACODE; //var MapHtml = GetMapHtml(STOREHOUSE, AREACODE); //ViewData["MapHtml"] = MapHtml; return View(); } public ActionResult StorageMapstr(string STOREHOUSE, string AREACODE,string GOODSINFO) { //ViewData["STOREHOUSE"] = STOREHOUSE; //ViewData["AREACODE"] = AREACODE; var MapHtml = GetMapHtml(STOREHOUSE, AREACODE, GOODSINFO); //ViewData["MapHtml"] = MapHtml; return Content(MapHtml); } private string GetMapHtml(string STOREHOUSE, string AREACODE, string GOODSINFO) { string result = ""; result = GetMapDetail(STOREHOUSE); //然后寻找这个AREACODE所在的单元 将它所在的格设置成红色 SetAreacodeColor(ref result,AREACODE, GOODSINFO); result = GetBaseHtml(result); return result; } private string GetMapDetail(string STOREHOUSE) { string result = ""; //if (STOREHOUSE == "0001")// 00050036 //{ result = @"
    A1-4
  • A1-3
    A1-2
  • A1-1
6号门
    A2-4
  • A2-3
    A2-2
  • A2-1
    A3-4
  • A3-3
    A3-2
  • A3-1
5号门
    A4-4
  • A4-3
    A4-2
  • A4-1
    B1-4
  • B1-3
    B1-2
  • B1-1
4号门
    B2-4
  • B2-3
    B2-2
  • B2-1
    B3-4
  • B3-3
    B3-2
  • B3-1
3号门
    B4-4
  • B4-3
    B4-2
  • B4-1
    C1-4
  • C1-3
    C1-2
  • C1-1
2号门
    C2-4
  • C2-3
    C2-2
  • C2-1
    C3-4
  • C3-3
    C3-2
  • C3-1
1号门
    C4-4
  • C4-3
    C4-2
  • C4-1
"; var storehouseinfo = MsWMSDAL.GetSTOREHOUSE(STOREHOUSE); if (!string.IsNullOrWhiteSpace(storehouseinfo.MAPHTML)) { result = storehouseinfo.MAPHTML; } //} return result; } private void SetAreacodeColor(ref string Html, string AREACODE, string GOODSINFO) { var areaIndex = Html.IndexOf(AREACODE); //向前寻找