You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/DSWeb/Areas/Storage/Controllers/StorageController.cs

1612 lines
51 KiB
C#

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

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);
}
/// <summary>
/// 裕龙公众号 库存查询
/// </summary>
/// <param name="openid"></param>
/// <param name="mblno"></param>
/// <param name="goodsfeetype"></param>
/// <param name="goodsowner"></param>
/// <param name="page"></param>
/// <param name="pageSize"></param>
/// <returns></returns>
[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);
}
/// <summary>
/// 当前库存
/// </summary>
/// <param name="openid"></param>
/// <param name="page"></param>
/// <param name="pageSize"></param>
/// <returns></returns>
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 = @" <div class=""NO01"">
<table cellspacing=""0"" cellpadding=""0"">
<tbody>
<tr>
<td>
<ul>
<b>A1-4</b>
<li id='00010001'></li>
</ul>
<ul>
<li id='00020002'></li>
<b>A1-3</b>
</ul>
<div class=""open-space""></div>
<ul>
<b>A1-2</b>
<li id='00050034'></li>
</ul>
<ul>
<li id='00050033'></li>
<b>A1-1</b>
</ul>
</td>
<td class=""NO-space"" style=""width:80px;background:#f8f8f9;"">
<div class=""south"">
<span>↑</span>
</div>
<div class=""north"">
<span>↓</span>
</div>
<div class=""NO01-door"">6号门</div>
</td>
<td>
<ul>
<b>A2-4</b>
<li id='00050040'></li>
</ul>
<ul>
<li id='00050039'></li>
<b>A2-3</b>
</ul>
<div class=""open-space""></div>
<ul>
<b>A2-2</b>
<li id='00050038'></li>
</ul>
<ul>
<li id='00050037'></li>
<b>A2-1</b>
</ul>
</td>
<td>
<ul>
<b>A3-4</b>
<li id='00050044'></li>
</ul>
<ul>
<li id='00050043'></li>
<b>A3-3</b>
</ul>
<div class=""open-space""></div>
<ul>
<b>A3-2</b>
<li id='00050042'></li>
</ul>
<ul>
<li id='00050041'></li>
<b>A3-1</b>
</ul>
</td>
<td class=""NO-space"" style=""width:80px;background:#f8f8f9;"">
<div class=""south"">
<span>↑</span>
</div>
<div class=""north"">
<span>↓</span>
</div>
<div class=""NO01-door"">5号门</div>
</td>
<td>
<ul>
<b>A4-4</b>
<li id='00050048'></li>
</ul>
<ul>
<li id='00050047'></li>
<b>A4-3</b>
</ul>
<div class=""open-space""></div>
<ul>
<b>A4-2</b>
<li id='00050046'></li>
</ul>
<ul>
<li id='00050045'></li>
<b>A4-1</b>
</ul>
</td>
<td>
<ul>
<b>B1-4</b>
<li id='00050020'></li>
</ul>
<ul>
<li id='00050019'></li>
<b>B1-3</b>
</ul>
<div class=""open-space""></div>
<ul>
<b>B1-2</b>
<li id='00050018'></li>
</ul>
<ul>
<li id='00050017'></li>
<b>B1-1</b>
</ul>
</td>
<td class=""NO-space"" style=""width:80px;background:#f8f8f9;"">
<div class=""south"">
<span>↑</span>
</div>
<div class=""north"">
<span>↓</span>
</div>
<div class=""NO01-door"">4号门</div>
</td>
<td>
<ul>
<b>B2-4</b>
<li id='00050024'></li>
</ul>
<ul>
<li id='00050023'></li>
<b>B2-3</b>
</ul>
<div class=""open-space""></div>
<ul>
<b>B2-2</b>
<li id='00050022'></li>
</ul>
<ul>
<li id='00050021'></li>
<b>B2-1</b>
</ul>
</td>
<td>
<ul>
<b>B3-4</b>
<li id='00050028'></li>
</ul>
<ul>
<li id='00050027'></li>
<b>B3-3</b>
</ul>
<div class=""open-space""></div>
<ul>
<b>B3-2</b>
<li id='00050026'></li>
</ul>
<ul>
<li id='00050025'></li>
<b>B3-1</b>
</ul>
</td>
<td class=""NO-space"" style=""width:80px;background:#f8f8f9;"">
<div class=""south"">
<span>↑</span>
</div>
<div class=""north"">
<span>↓</span>
</div>
<div class=""NO01-door"">3号门</div>
</td>
<td>
<ul>
<b>B4-4</b>
<li id='00050032'></li>
</ul>
<ul>
<li id='00050031'></li>
<b>B4-3</b>
</ul>
<div class=""open-space""></div>
<ul>
<b>B4-2</b>
<li id='00050030'></li>
</ul>
<ul>
<li id='00050029'></li>
<b>B4-1</b>
</ul>
</td>
<td>
<ul>
<b>C1-4</b>
<li id='00050004'></li>
</ul>
<ul>
<li id='00050003'></li>
<b>C1-3</b>
</ul>
<div class=""open-space""></div>
<ul>
<b>C1-2</b>
<li id='00050002'></li>
</ul>
<ul>
<li id='00050001'></li>
<b>C1-1</b>
</ul>
</td>
<td class=""NO-space"" style=""width:80px;background:#f8f8f9;"">
<div class=""south"">
<span>↑</span>
</div>
<div class=""north"">
<span>↓</span>
</div>
<div class=""NO01-door"">2号门</div>
</td>
<td>
<ul>
<b>C2-4</b>
<li id='00050008'></li>
</ul>
<ul>
<li id='00050007'></li>
<b>C2-3</b>
</ul>
<div class=""open-space""></div>
<ul>
<b>C2-2</b>
<li id='00050006'></li>
</ul>
<ul>
<li id='00050005'></li>
<b>C2-1</b>
</ul>
</td>
<td>
<ul>
<b>C3-4</b>
<li id='00050012'></li>
</ul>
<ul>
<li id='00050011'></li>
<b>C3-3</b>
</ul>
<div class=""open-space""></div>
<ul>
<b>C3-2</b>
<li id='00050010'></li>
</ul>
<ul>
<li id='00050009'></li>
<b>C3-1</b>
</ul>
</td>
<td class=""NO-space"" style=""width:80px;background:#f8f8f9;"">
<div class=""south"">
<span>↑</span>
</div>
<div class=""north"">
<span>↓</span>
</div>
<div class=""NO01-door"">1号门</div>
</td>
<td>
<ul>
<b>C4-4</b>
<li id='00050016'></li>
</ul>
<ul>
<li id='00050015'></li>
<b>C4-3</b>
</ul>
<div class=""open-space""></div>
<ul>
<b>C4-2</b>
<li id='00050014'></li>
</ul>
<ul>
<li id='00050013'></li>
<b>C4-1</b>
</ul>
</td>
</tr>
</tbody>
</table>
</div>";
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);
//向前寻找<ul> 将其修改为
var keyfield = "<ul";
var newfield = @"<ul style=""background: orange; """;
if (areaIndex == -1) return;//没找到就结束
Html = Html.Insert(areaIndex+2+AREACODE.Length, GOODSINFO);
var lastulindex = Html.Substring(0, areaIndex).LastIndexOf(keyfield);
Html = Html.Remove(lastulindex, keyfield.Length).Insert(lastulindex, newfield);
}
private string GetBaseHtml(string htmlstr) {
var result= @"<!DOCTYPE html>
<html>
<head>
<meta charset=""utf-8"">
<title></title>
<style type=""text/css"">
.shengjie-map {
width: 1200px;
height: 600px;
position: relative;
margin: 15px auto;
padding: 15px;
}
.shengjie-map .east-01,
.shengjie-map .east-02,
.shengjie-map .east-03,
.shengjie-map .east-04 {
width: 500px;
height: 110px;
line-height: 110px;
text-align: center;
background: #bed6f8;
border: 1px dashed #6391c0;
font-size: 18px;
color: #6391c0;
margin-bottom: 10px;
}
.shengjie-map .west-01,
.shengjie-map .west-02,
.shengjie-map .west-03,
.shengjie-map .west-04 {
width: 500px;
height: 110px;
line-height: 110px;
text-align: center;
background: #fbcbb4;
border: 1px dashed #b45c50;
font-size: 18px;
color: #b45c50;
margin-bottom: 10px;
}
.shengjie-map .dire {
padding-top: 50px;
padding-right: 50px;
}
/*公共样式 */
table tbody tr td ul li {
list-style: none;
}
.NO1 {
width: 95%;
margin: 15px auto;
padding: 10px;
overflow-x: hidden;
overflow-x: scroll;
}
.NO2 {
width: 95%;
margin: 15px auto;
padding: 10px;
overflow-x: hidden;
overflow-x: scroll;
}
.NO3 {
width: 95%;
margin: 15px auto;
padding: 10px;
overflow-x: hidden;
overflow-x: scroll;
}
/*所有库方向 */
.direction {
font-size: 18px;
margin-bottom: 20px;
margin-left: 20px;
}
.direction span {
font-size: 22px;
margin-right: 5px;
}
.tit {
text-align: center;
font-size: 18px;
font-weight: bold;
}
table tr td {
position: relative;
}
table tr td ul {
width: 130px;
height: 140px;
padding: 5px 8px;
background: rgba(255, 235, 236, .45);
border: 1px solid rgba(239, 22, 18, .12);
border-top: 2px solid rgba(239, 22, 18, .4);
margin-right: 2px;
margin-bottom: 2px;
border-radius: 3px;
position: relative;
box-shadow: -1px -1px 3px 1px #ebebeb;
}
table tr td ul b {
font-size: 14px;
}
table tr td ul li {
color: #757575;
word-break: break-all;
/*border-bottom:1px solid rgba(239,22,18,.12);*/
}
table tr td ul.right b {
position: absolute;
top: 55px;
right: -40px;
z-index: 2;
}
table tr td ul.left b {
position: absolute;
top: 30px;
left: -40px;
}
table tr td ul.bottom b {
position: absolute;
bottom: -25px;
left: 50px;
z-index: 2;
}
table tr td ul.top b {
position: absolute;
top: -25px;
left: 50px;
z-index: 2;
}
/*办公区 */
.NO1 .administrative-Area {
height: 100px;
line-height: 100px;
text-align: center;
}
/*消防栓 */
.fire-hydrant {
width: 80px;
height: 30px;
line-height: 30px;
text-align: center;
text-align: center;
color: red;
font-size: 12px;
font-weight: bold;
position: absolute;
}
.NO-door {
position: relative;
font-size: 14px;
}
.NO1 .NO1-door .fire-hydrant {
top: -35px;
left: -10px;
}
.NO1 .NO2-door .fire-hydrant {
top: -35px;
left: -52px;
}
.NO1 .NO3-door .fire-hydrant {
top: -35px;
left: 54px;
}
.NO1 .NO4-door .fire-hydrant {
top: -35px;
left: 5px;
}
/*道路空隙 */
.open-space {
height: 50px;
background: #f8f8f9;
position: relative;
}
/*门框 */
.NO1 .door-frame {
width: 1164px;
}
.NO2 .door-frame {
width: 1034px;
}
.NO3 .door-frame {
width: 2064px;
}
.door-frame {
background: url(../../../src/assets/imgs/door_back.png) repeat-x center;
}
/*几号门 */
.NO-door {
width: 80px;
height: 21px;
line-height: 25px;
text-align: center;
font-weight: bold;
background: #FFF;
}
/*控制室 */
.control-room {
width: 80px;
height: 78px;
line-height: 78px;
text-align: center;
margin-top: 547px;
}
/*竖墙 */
.vertical-door-frame {
width: 30px;
margin: 0 10px;
background: url(../../../src/assets/imgs/vertical_door_back.png) repeat-y;
}
.vertical-door-frame div {
width: 18px;
position: absolute;
background: #FFF;
padding: 7px 0;
text-align: center;
font-weight: bold;
font-size: 14px;
line-height: 16px;
}
.vertical-door-frame .NO1-door {
top: 128px;
}
.vertical-door-frame .NO2-door {
top: 512px;
}
.vertical-door-frame .NO3-door {
top: 565px;
}
/*库3 */
.NO3 {
margin-bottom: 30px;
}
.NO3 table tr td ul {
height: 60px;
}
.NO3 table tr td ul.right b {
position: absolute;
top: 40px;
right: -40px;
z-index: 2;
}
.NO3 table tr td ul.left b {
position: absolute;
top: 16px;
left: -40px;
}
.NO3 table tr td ul.bottom b {
position: absolute;
bottom: -25px;
left: 50px;
z-index: 2;
}
.NO3 table tr td ul.top b {
position: absolute;
top: -25px;
left: 50px;
z-index: 2;
}
/*所有库空隙 */
.NO-space div {
width: 80px;
}
.NO3 .ladder {
height: 60px;
margin-bottom: 2px;
}
/*新加样式 */
.NO01 {
width: 95%;
margin: 15px auto;
padding: 10px;
overflow-x: hidden;
overflow-x: scroll;
}
.NO01 table tbody tr td ul,
.NO02 table tbody tr td ul,
.NO03 table tbody tr td ul,
.NO05 table tbody tr td ul,
.NO06 table tbody tr td ul,
.NO01-west table tbody tr td ul,
.NO02-c table tbody tr td ul {
height: 160px;
position: relative;
}
.NO01 table tbody tr td ul:nth-child(3n) b,
.NO02 table tbody tr td ul:nth-child(3n) b,
.NO03 table tbody tr td ul:nth-child(3n) b,
.NO05 table tbody tr td ul:nth-child(3n) b,
.NO06 table tbody tr td ul:nth-child(3n) b,
.NO01-west table tbody tr td ul:nth-child(3n) b {
position: absolute;
bottom: 0;
}
.NO-space .south,
.NO-space .north {
height: 165px;
font-size: 18px;
text-align: center;
}
/*裕龙盛捷方向 */
.ShengJie .NO-space .south,
.ShengJie .NO-space .north {
height: 300px;
font-size: 18px;
text-align: center;
}
.ShengJie .NO-space .south {
padding-top: 110px;
}
.ShengJie .NO-space .north {
padding-top: 185px;
}
.ShengJie .NO-space .NO01-door {
padding-top: 60px;
}
.NO-space .south span,
.NO-space .north span {
display: block;
font-size: 30px;
}
.NO-space .south {
padding-top: 15px;
}
.NO-space .north {
padding-top: 50px;
}
.NO-space .north span {
margin-bottom: 10px;
}
.NO01-door {
font-size: 14px;
font-weight: bold;
text-align: center;
}
.NO02 {
width: 95%;
margin: 15px auto;
padding: 10px;
overflow-x: hidden;
overflow-x: scroll;
}
.NO03 {
width: 95%;
margin: 15px auto;
padding: 10px;
overflow-x: hidden;
overflow-x: scroll;
}
.NO05 {
width: 95%;
margin: 15px auto;
padding: 10px;
overflow-x: hidden;
overflow-x: scroll;
}
.NO06 {
width: 95%;
margin: 15px auto;
padding: 10px;
overflow-x: hidden;
overflow-x: scroll;
}
/*一号库西区 */
.NO01-west,
.NO02-c {
width: 95%;
margin: 15px auto;
padding: 10px;
overflow-x: hidden;
overflow-x: scroll;
}
.NO01-west .NO-space .south {
padding-top: 60px;
}
.NO01-west .NO-space .north {
padding-top: 90px;
}
.warehouse-map {
width: 1260px;
height: 600px;
position: relative;
border: 1px solid #ebebeb;
}
.warehouse-map .ware-01 {
width: 645px;
height: 110px;
line-height: 110px;
text-align: center;
background: #bed6f8;
border: 1px dashed #6391c0;
font-size: 18px;
color: #6391c0;
position: absolute;
top: 50px;
left: 50px;
}
.warehouse-map .ware-02 {
width: 435px;
height: 110px;
line-height: 110px;
text-align: center;
background: #bed6f8;
border: 1px dashed #6391c0;
font-size: 18px;
color: #6391c0;
position: absolute;
top: 385px;
left: 50px;
}
.warehouse-map .CP-01 {
width: 145px;
height: 145px;
line-height: 145px;
text-align: center;
background: #fff4bc;
border: 1px dashed #e3be64;
font-size: 18px;
color: #d3990b;
position: absolute;
top: 50px;
left: 745px;
}
.warehouse-map .SW-01 {
width: 290px;
height: 240px;
line-height: 240px;
text-align: center;
background: #fbcbb4;
border: 1px dashed #b45c50;
font-size: 18px;
color: #b45c50;
position: absolute;
top: 25px;
left: 920px;
}
.warehouse-map .SW-02 {
width: 435px;
height: 60px;
line-height: 60px;
text-align: center;
background: #fbcbb4;
border: 1px dashed #b45c50;
font-size: 18px;
color: #b45c50;
position: absolute;
top: 190px;
left: 260px;
}
.warehouse-map .SW-03 {
width: 765px;
height: 60px;
line-height: 60px;
text-align: center;
background: #fbcbb4;
border: 1px dashed #b45c50;
font-size: 18px;
color: #b45c50;
position: absolute;
top: 296px;
left: 446px;
}
.warehouse-map .dire {
position: absolute;
top: 410px;
right: 100px;
}
/*原有库位图样式 */
.red {
background: #ffebec;
border: 1px solid rgba(239, 22, 18, .15);
}
.green {
background: #e8f6e9;
border: 1px solid rgba(39, 116, 30, .15);
}
.s-red {
background: #fdc1c4;
border: 1px solid rgba(239, 22, 18, .15);
}
.warehouse {
margin: 20px auto 15px;
display: none;
}
.warehouse tr {
padding-bottom: 30px;
}
.warehouse tr td {
width: 360px;
height: 100px !important;
border-right: 30px solid #f8f8f9;
border-bottom: 30px solid #f8f8f9;
margin-right: 5%;
position: relative;
}
.warehouse tr td:nth-child(3n) {
border-right: none;
}
.warehouse tr td:nth-child(3n) .aisle2 {
display: none;
}
.warehouse tr td ul {
height: 135px;
padding: 7px 0 10px 15px;
box-shadow: -1px -1px 5px 1px #ebebeb;
/*border: 1px solid rgba(51,118,255,.15);*/
border-radius: 5px;
overflow: hidden;
overflow-y: auto;
}
.warehouse tr td ul b {
font-size: 14px;
}
.warehouse tr td li {
list-style: none;
line-height: 21px;
color: #666;
}
.warehouse tr td li.aisle1 {
width: 317px;
height: 30px;
line-height: 30px;
text-align: center;
position: absolute;
top: -30px;
left: 0px;
color: #cbcbcb;
font-size: 8px;
}
.warehouse tr td li.aisle2 {
width: 20px;
height: 130px;
text-align: center;
position: absolute;
top: 34px;
right: -25px;
color: #cbcbcb;
font-size: 8px;
}
</style>
</head>
<body>"+ htmlstr + @"</body>
</html>";
return result;
}
/// <summary>
/// 全角转半角
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public static String ToDBC(String input)
{
char[] c = input.ToCharArray();
for (int i = 0; i<c.Length; i++)
{
if (c[i] == 12288)
{
c[i] = (char)32;
continue;
}
if (c[i] > 65280 && c[i] < 65375)
c[i] = (char) (c[i] - 65248);
}
return new String(c);
}
[HttpPost]
public JsonResult StorageData_WUTONG(string openid, string mblno,string comp, int page = 1, int pageSize = 10)
{
RespGetKuCun resp = new RespGetKuCun();
//var infoClient = dataContext.IndoInfo.FirstOrDefault(d => d.MBLNO == mblno);
var condition = "";
//var corpid = "Comcab2d43f60454327af30a131fc1d3abd";
var corpid = "";
DSWeb.Common.DB.CommonDataContext cdc = new DSWeb.Common.DB.CommonDataContext();
corpid = cdc.company.FirstOrDefault(x => x.CODENAME == comp).GID;
var corpcondition = $" CORPID = '{corpid}'";
mblno = ToDBC(mblno);
//mblno = mblno.Replace("", ",");
mblno = mblno.Replace(" ", ",");
mblno = mblno.Replace("+", ",");
//mblno = mblno.Replace(" ", ",");
//mblno = mblno.Replace("", ",");
if (mblno.Trim() == "全部")
{
condition = corpcondition;
}
else
{
if (mblno.IndexOf(",") >= 0) {
var mblnolist = mblno.Split(',').ToList();
var mblnocondition = "";
foreach (var _mblno in mblnolist) {
if (string.IsNullOrWhiteSpace(_mblno)) {
continue;
}
var mblnostr = _mblno.PadLeft(4, '#');
if (mblnocondition != "") mblnocondition += " or ";
mblnocondition += $" mblno like '%{mblnostr}' ";
}
condition = corpcondition;
if (!string.IsNullOrWhiteSpace(mblnocondition))
{
condition += " and (" + mblnocondition + ")";
}
}
else
{
mblno = mblno.PadLeft(4, '#');
condition = " MBLNO like '%" + mblno + $"' and " + corpcondition;
}
//mblno = mblno.PadLeft(4, '#');
//if (!string.IsNullOrWhiteSpace(mblno))
//{
// condition = " MBLNO like '%" + mblno + $"' and CORPID='{corpid}' ";
//}
}
var dataList = MsWMSDAL.GetKuCunDataList_WUTONG(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);
}
#endregion
#region 其他
public JsonResult Regist(UserRegistViewModel model)
{
RespCommon resp = new RespCommon();
if (!string.IsNullOrWhiteSpace(model.OpenId))
{
var driver = dataContext.UserRegist.FirstOrDefault(d => d.OpenId == model.OpenId);
if (driver == null)
{
BasicDataRefDAL.SaveLog(model, "", "裕龙公众号", "新用户");
driver = model.AsDriverInfo();
dataContext.UserRegist.Add(driver);
}
else
{
BasicDataRefDAL.SaveLog(model, "", "裕龙公众号", "老用户");
model.AsDriverInfo(driver);
}
dataContext.SaveChanges();
resp.Success = true;
resp.Message = "操作成功";
}
else
{
resp.Success = false;
resp.Message = "参数无效";
}
return Json(resp);
}
public ActionResult AuthRedirect(string code, string state)
{
try
{
BasicDataRefDAL.SaveLog($"code={code},state={state}", "微信公众号", "裕龙公众号", "AuthRedirect");
var url = $"https://api.weixin.qq.com/sns/oauth2/access_token?appid={appid}&secret={appsecret}&code={code}&grant_type=authorization_code";
string rtnStr = WebRequestHelper.DoGet(url);
BasicDataRefDAL.SaveLog("{"+ url + "}"+ rtnStr, "微信公众号", "裕龙公众号", "gettoken");
var obj = new { access_token = "", expires_in = 0, refresh_token = "", openid = "", scope = "" };
var jsonObj = JsonConvert.DeserializeAnonymousType(rtnStr, obj);
if (state == StateKeyRegistCustHJ)
{
BasicDataRefDAL.SaveLog(dispatchServerUrl, "微信公众号", "裕龙公众号", "Regist");
return Redirect($"{dispatchServerUrl}/Dispatch/Stock/Regist?openid={jsonObj.openid}");
}
else if (state == StateKeyStorageList)
{//目前用于出入库查询
var redirecturl = $"{storageServerUrl}/Storage/Storage/StorageList?openid={jsonObj.openid}";
BasicDataRefDAL.SaveLog(redirecturl, "微信公众号", "裕龙公众号", "storagelist");
return Redirect(redirecturl);
}
else if (state == StateKeyKucunList)
{//库存查询
var redirecturl = $"{storageServerUrl}/Storage/Storage/KucunList?openid={jsonObj.openid}";
BasicDataRefDAL.SaveLog(redirecturl, "微信公众号", "裕龙公众号", "kucunlist");
return Redirect(redirecturl);
}
else if (state == StateKeyKucunList2)
{//库存查询
var redirecturl = $"{storageServerUrl}/Storage/Storage/KucunList2?openid={jsonObj.openid}";
BasicDataRefDAL.SaveLog(redirecturl, "微信公众号", "裕龙公众号", "kucunlist2");
return Redirect(redirecturl);
}
else
{
return Content($"非法请求");
}
}
catch (Exception ex)
{
return Content($"出错啦:{ex.Message}");
}
}
public ActionResult ShowStorageList(string code, string state) {
try
{
//BasicDataRefDAL.SaveLog($"code={code},state={state}", "微信公众号", "裕龙公众号", "AuthRedirect");
var url = $"https://api.weixin.qq.com/sns/oauth2/access_token?appid={appid}&secret={appsecret}&code={code}&grant_type=authorization_code";
string rtnStr = WebRequestHelper.DoGet(url);
//BasicDataRefDAL.SaveLog("{" + url + "}" + rtnStr, "微信公众号", "裕龙公众号", "gettoken");
var obj = new { access_token = "", expires_in = 0, refresh_token = "", openid = "", scope = "" };
var jsonObj = JsonConvert.DeserializeAnonymousType(rtnStr, obj);
/*
if (state == StateKey_WUTONGStockList_ZHONGSHUI)
{//库存查询
var redirecturl = $"{storageServerUrl}/Storage/Storage/WUTONGKucunList?openid={jsonObj.openid}&comp=ZHONGSHUI";
BasicDataRefDAL.SaveLog(redirecturl, "微信公众号", "裕龙公众号", "kucunlist");
return Redirect(redirecturl);
}
if (state == StateKey_WUTONGStockList_WUTONG)
{//库存查询
var redirecturl = $"{storageServerUrl}/Storage/Storage/WUTONGKucunList?openid={jsonObj.openid}&comp=WUTONG";
BasicDataRefDAL.SaveLog(redirecturl, "微信公众号", "裕龙公众号", "kucunlist");
return Redirect(redirecturl);
}
else
*/
var redirecturl = $"{storageServerUrl}/Storage/Storage/WUTONGKucunList?openid={jsonObj.openid}&comp={state}";
BasicDataRefDAL.SaveLog(redirecturl, "微信公众号", "裕龙公众号", "kucunlist");
return Redirect(redirecturl);
}
catch (Exception ex)
{
return Content($"出错啦:{ex.Message}");
}
}
public ActionResult CreateMenu()
{
try
{
string token = string.Empty;
string errorMsg = string.Empty;
bool success = TokenHelper.GetMpToken(appid, out token, out errorMsg);
if (success)
{
var url = $"https://api.weixin.qq.com/cgi-bin/menu/create?access_token={token}";
string regRtnUrl = HttpUtility.UrlEncode($"{dispatchServerUrl}/dispatch/dispatch/AuthRedirect");
string regUrl = $"https://open.weixin.qq.com/connect/oauth2/authorize?appid={appid}&redirect_uri={regRtnUrl}&response_type=code&scope=snsapi_base&state={StateKeyRegist}#wechat_redirect";
//string listUrl = $"https://open.weixin.qq.com/connect/oauth2/authorize?appid={appid}&redirect_uri={regRtnUrl}&response_type=code&scope=snsapi_base&state={StateKeyDispatchList}#wechat_redirect";
//string listUrlGrab = $"https://open.weixin.qq.com/connect/oauth2/authorize?appid={appid}&redirect_uri={regRtnUrl}&response_type=code&scope=snsapi_base&state={StateKeyGrabList}#wechat_redirect";
//string feeUrl = $"https://open.weixin.qq.com/connect/oauth2/authorize?appid={appid}&redirect_uri={regRtnUrl}&response_type=code&scope=snsapi_base&state={StateKeyFeeList}#wechat_redirect";
string regUrlCust = $"https://open.weixin.qq.com/connect/oauth2/authorize?appid={appid}&redirect_uri={regRtnUrl}&response_type=code&scope=snsapi_base&state={StateKeyRegistCust}#wechat_redirect";
string opseaeUrl = $"https://open.weixin.qq.com/connect/oauth2/authorize?appid={appid}&redirect_uri={regRtnUrl}&response_type=code&scope=snsapi_base&state={StateKeyStorageList}#wechat_redirect";
var menuJson = new
{
button = new object[]
{
new
{
type="view",
name ="客户注册",
url =regUrlCust
},
new
{
type="view",
name="查询",
url =opseaeUrl
}
}
};
string jsonStr = JsonConvert.SerializeObject(menuJson);
string rtnStr = WebRequestHelper.DoPost(url, jsonStr);
return Content(rtnStr);
}
else
{
return Content($"获取token时出错{errorMsg}");
}
}
catch (Exception ex)
{
return Content($"error:{ex.Message}");
}
}
public ActionResult SendTemplateTest(string openid = "oHgaQ5no1pqAXeRZK3WcV2UzjHY4")
{
List<Tuple<string, string, string>> values = new List<Tuple<string, string, string>>();
values.Add(new Tuple<string, string, string>("TITLE", "收到新的库存消息,点击查看:", "#FF0000"));
values.Add(new Tuple<string, string, string>("XX", "OTG01256", ""));
values.Add(new Tuple<string, string, string>("DW", "1568KG", ""));
values.Add(new Tuple<string, string, string>("ZHSJ", DateTime.Today.ToString("yyyy-MM-dd"), ""));
values.Add(new Tuple<string, string, string>("JGSJ", DateTime.Today.AddDays(5).ToString("yyyy-MM-dd"), ""));
values.Add(new Tuple<string, string, string>("GCDZ", "市南区湛山街道", ""));
values.Add(new Tuple<string, string, string>("FOOTTER", "赶快点击去抢单吧~", "#0000FF"));
string mess = string.Empty;
bool success = TemplateMessageHelper.SendTemplateMessage(appid, "5zWCiYhS44naUs1dolJuMtAhzqvrfpdHUK6JQJdtkLw", values, openid, $"{dispatchServerUrl}/Dispatch/Dispatch/DispatchDetail?leid=123", out mess);
return Content($"{success} {mess}");
}
private repobj getOpenId(string code)
{
//var appid = ConfigurationManager.AppSettings["appid"];
//var appsecret = ConfigurationManager.AppSettings["secret"];
var url = $"https://api.weixin.qq.com/sns/jscode2session?appid={appid}&secret={appsecret}&js_code={code}&grant_type=authorization_code";
//log.Debug("获取openid" + url);
string resp = WebRequestHelper.DoGet(url);
repobj result = JsonConvert.DeserializeAnonymousType(resp, new repobj { openid = "", errcode = 0 });
//log.Debug("返回:" + resp);
return result;
}
#endregion
}
}