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/MvcShipping/Controllers/AppApiController.cs

135 lines
4.2 KiB
C#

3 years ago
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web.Mvc;
using DSWeb.Areas.Mobile.DAL;
using DSWeb.EntityDA;
using DSWeb.Models;
using DSWeb.MvcShipping.DAL.MsSysParamSet;
using DSWeb.MvcShipping.DAL.WMSDeliver;
using DSWeb.MvcShipping.DAL.WMSNewDAL;
using DSWeb.MvcShipping.DAL.WMSStock;
using DSWeb.MvcShipping.Helper;
using DSWeb.MvcShipping.Models.WMSDeliver;
using DSWeb.MvcShipping.Models.WMSNew;
using HcUtility.Comm;
using Microsoft.Practices.EnterpriseLibrary.Data;
namespace DSWeb.Areas.MvcShipping.Controllers
{
public class AppApiController : Controller
{
#region 送货单
#region 送货单明细,包括商品信息
public JsonResult GetDeliverDetail(string deliverNO)
{
var ds = WMSEIPSDeliverDAL.GetTrayAndGoodsListWithDeliver(deliverNO);
var result = JsonConvert.ToJson(ds.Tables[0]);
foreach (var dic in result)
{
var bsno = dic["BSNO"];
DataView dv = new DataView(ds.Tables[1]);
dv.RowFilter = $"BSNO='{bsno}'";
var tray = JsonConvert.ToJson(dv.ToTable());
dic.Add("TRAY_LIST", tray);
foreach (var dd in tray)
{
var gid = dd["GID"];
DataView dvSub = new DataView(ds.Tables[2]);
dvSub.RowFilter = $"TRGID='{gid}'";
var goods = JsonConvert.ToJson(dvSub.ToTable());
dd.Add("GOODS_LIST", goods);
}
}
return Json(result);
}
#endregion
#region 送货单接收
public JsonResult Receive(string data)
{
bool flag = WMSEIPSDeliverDAL.DeliverToWMS(data, null);
return Json(new { Success = flag, Message = "" });
}
#endregion
#endregion
#region 备货单
#region 待备货列表
public JsonResult StockUpList()
{
var dt = WMSEIPStockDAL.GetStockUpList();
return Json(JsonConvert.ToJson(dt));
}
#endregion
#region 待备货托列表信息
public JsonResult TrayListForStockUp(string BSNO)
{
var dt = WMSEIPStockDAL.GetTrayListForStockUp(BSNO);
return Json(JsonConvert.ToJson(dt));
}
#endregion
#region 托备货,置备货状态
public JsonResult SetStockUp(string trayNO, string BSNO)
{
string msg = string.Empty;
bool success = WMSEIPStockDAL.SetStockUp(trayNO, BSNO, out msg);
return Json(new { Success = success, Message = msg });
}
#endregion
#endregion
#region 入库单
/// <summary>
/// 获取库位
/// </summary>
/// <returns></returns>
public JsonResult GetStorageAreaList()
{
LogDA logDA = new LogDA();
DataSet ds = logDA.GetExcuteSql("select areaname from wms_storage_area where isenable=1");
var areaList = JsonConvert.ToJson(ds.Tables[0]);
return Json(areaList);
}
public JsonResult GetWmsNoLockAndAreaList()
{
DataTable tb = WMSNewDAL.GetWmsNoLockAndArea();
return Json(JsonConvert.ToJson(tb));
}
public JsonResult GetWmsInList(string associatedNO)
{
DataTable tb = WMSNewDAL.GetWmsInWithAssociatedNO(associatedNO);
return Json(JsonConvert.ToJson(tb));
}
public ContentResult GetWmsInAreaNameAssociatedNO(string associatedNO)
{
string str = WMSNewDAL.GetWmsInAreaNameAssociatedNO(associatedNO);
return Content(str);
}
public JsonResult FillAreaName(string associatedNO, string trayNOStart, string trayNOEnd, string areaName)
{
WMSNewDAL.FillAreaName(associatedNO, trayNOStart, trayNOEnd, areaName);
return Json(new { Success = true, Message = "" });
}
public JsonResult FilleAreaForTray(string trayNO, string areaName)
{
var rtn = WMSNewDAL.FilleAreaForTray(trayNO, areaName);
return Json(new { Success = rtn, Message = "" });
}
#endregion
}
}