|
|
|
|
|
using System.Collections;
|
|
|
using Aspose.Cells;
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
using Estsh.Core.Services.IServices;
|
|
|
using Estsh.Core.Model.Result;
|
|
|
using Estsh.Core.Models;
|
|
|
using System.Text.Json;
|
|
|
using Estsh.Core.Controllers;
|
|
|
using System.Data;
|
|
|
using Estsh.Core.Util;
|
|
|
using Estsh.Core.Model.ExcelModel;
|
|
|
|
|
|
/***************************************************************************************************
|
|
|
*
|
|
|
* 更新人:sitong.dong
|
|
|
* 描述:库存明细查询
|
|
|
* 修改时间:2022.06.22
|
|
|
* 修改日志:系统迭代升级
|
|
|
*
|
|
|
**************************************************************************************************/
|
|
|
namespace Estsh.Core.Web.Controllers
|
|
|
{
|
|
|
public class StockDetailQueryController :BaseController
|
|
|
{
|
|
|
private IStockDetailQueryService service;
|
|
|
public StockDetailQueryController(IStockDetailQueryService _service)
|
|
|
{
|
|
|
service = _service;
|
|
|
|
|
|
}
|
|
|
//
|
|
|
// GET: /Menu/
|
|
|
public ActionResult Index()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 库区汇总
|
|
|
/// </summary>
|
|
|
/// <param name="warehouseName"></param>
|
|
|
/// <param name="partId"></param>
|
|
|
/// <param name="pager"></param>
|
|
|
/// <param name="direction"></param>
|
|
|
/// <param name="sort"></param>
|
|
|
/// <param name="enabled"></param>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult getZoneListByPage(string zoneName, Pager pager, String direction, String sort, string enabled = "Y")
|
|
|
{
|
|
|
int factoryId = CurrentEmp.FactoryId;
|
|
|
Hashtable result = new Hashtable();
|
|
|
result.Add("pager.pageNo", pager.pageNo);
|
|
|
Hashtable dataHt = this.service.getZoneList(zoneName, enabled, factoryId, pager, direction, sort);
|
|
|
result.Add("rows", dataHt["dataList"]);
|
|
|
result.Add("pager.totalRows", dataHt["totalCount"]);
|
|
|
result.Add("sort", sort);
|
|
|
result.Add("direction", direction);
|
|
|
return Json(result);
|
|
|
}
|
|
|
public ActionResult GetStockType()
|
|
|
{
|
|
|
Hashtable resault = new Hashtable();
|
|
|
List<KeyValueResult> pdlineList = service.GetStockType();
|
|
|
resault.Add("list", pdlineList);
|
|
|
return Json(resault);
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 库位汇总
|
|
|
/// </summary>
|
|
|
/// <param name="warehouseName"></param>
|
|
|
/// <param name="partId"></param>
|
|
|
/// <param name="menuName"></param>
|
|
|
/// <param name="locateType"></param>
|
|
|
/// <param name="pager"></param>
|
|
|
/// <param name="direction"></param>
|
|
|
/// <param name="sort"></param>
|
|
|
/// <param name="enabled"></param>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult getLocateListByPage( string zoneName, string locateName, string enabled = "Y")
|
|
|
{
|
|
|
int factoryId = CurrentEmp.FactoryId;
|
|
|
Hashtable result = new Hashtable();
|
|
|
List<SysStock> dataHt = this.service.getLocateListByPage(zoneName, locateName,enabled, factoryId);
|
|
|
result.Add("rows", dataHt);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 条码汇总
|
|
|
/// </summary>
|
|
|
/// <param name="partNo"></param>
|
|
|
/// <param name="pager"></param>
|
|
|
/// <param name="direction"></param>
|
|
|
/// <param name="sort"></param>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult getDPSListByPage(string zoneName, string locateName, string cartonNo, string partNo, string partSpec,string stockType, string enabled = "Y")
|
|
|
{
|
|
|
string wheres = "";
|
|
|
int factoryId = CurrentEmp.FactoryId;
|
|
|
Hashtable result = new Hashtable();
|
|
|
List<SysStock> dataHt = this.service.getDPSListByPage(zoneName, locateName, cartonNo, partNo, partSpec ,enabled, factoryId, stockType);
|
|
|
result.Add("rows", dataHt);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 导出数据到Excel
|
|
|
/// BY NOAH
|
|
|
/// </summary>carImport
|
|
|
/// <returns></returns>
|
|
|
public ActionResult exportData(string zoneName, string locateName, string cartonNo, string partNo, string partSpec,string stockType , string enabled = "Y")
|
|
|
{
|
|
|
string factoryId = CurrentEmp.FactoryId.ToString();
|
|
|
List<StockDetailQuery> listHt = this.service.getExportList(zoneName, locateName, cartonNo, partNo, partSpec, enabled, factoryId, stockType);
|
|
|
var memoryStream = ExcelHelper.ToExcel(listHt);
|
|
|
string dateTime = DateTime.Now.ToString("yyyyMMddHHmmss");
|
|
|
return File(memoryStream.ToArray(), "application/ms-excel", "库存条码明细" + dateTime + ".xls");
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取零件号
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult GetPartNo()
|
|
|
{
|
|
|
Hashtable resault = new Hashtable();
|
|
|
List<KeyValueResult> list = service.GetPartNo();
|
|
|
resault.Add("list", list);
|
|
|
return Json(resault);
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 获取库位
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult GetLocateName()
|
|
|
{
|
|
|
Hashtable resault = new Hashtable();
|
|
|
List<KeyValueResult> list = service.GetLocateName();
|
|
|
resault.Add("list", list);
|
|
|
return Json(resault);
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 获取系统参数
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult GetSysEnum()
|
|
|
{
|
|
|
Hashtable resault = new Hashtable();
|
|
|
List<KeyValueResult> list = service.GetSysEnum("sys_stock_status");
|
|
|
resault.Add("list", list);
|
|
|
return Json(resault);
|
|
|
}
|
|
|
|
|
|
public ActionResult GetWareHouseName()
|
|
|
{
|
|
|
Hashtable resault = new Hashtable();
|
|
|
List<KeyValueResult> pdlineList = service.GetWareHouseName();
|
|
|
resault.Add("list", pdlineList);
|
|
|
return Json(resault);
|
|
|
}
|
|
|
|
|
|
private string InitWhereStr(string wareHouse_id)
|
|
|
{
|
|
|
string wheres = string.Empty;
|
|
|
string pdlineStr = string.Empty;
|
|
|
string[] pdLineArr = wareHouse_id.Split(',');
|
|
|
foreach (string str in pdLineArr)
|
|
|
{
|
|
|
pdlineStr += " '" + str + "' ,";
|
|
|
}
|
|
|
|
|
|
pdlineStr = pdlineStr.Substring(0, pdlineStr.Length - 2);
|
|
|
wheres += string.Format(" AND ( w.warehouse_id IN ({0}))", pdlineStr);
|
|
|
return wheres;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 解冻
|
|
|
/// </summary>
|
|
|
/// <param name="ids"></param>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult onEnable(String ids)
|
|
|
{
|
|
|
int delCount = 0;
|
|
|
try
|
|
|
{
|
|
|
string empId = CurrentEmp.EmpId.ToString();
|
|
|
delCount = this.service.EnableData(ids, empId);
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
delCount = -1;
|
|
|
}
|
|
|
Hashtable result = new Hashtable();
|
|
|
result.Add("status", delCount);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
}
|