|
|
|
|
|
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.Model.ExcelModel;
|
|
|
using Estsh.Core.Util;
|
|
|
|
|
|
/***************************************************************************************************
|
|
|
*
|
|
|
* 更新人:sitong.dong
|
|
|
* 描述:库存调整
|
|
|
* 修改时间:2022.06.22
|
|
|
* 修改日志:系统迭代升级
|
|
|
*
|
|
|
**************************************************************************************************/
|
|
|
namespace Estsh.Core.Web.Controllers
|
|
|
{
|
|
|
public class StockAdjustDefineController : BaseController
|
|
|
{
|
|
|
private IStockAdjustDefineService service;
|
|
|
private IWebHostEnvironment hostingEnvironment;
|
|
|
public StockAdjustDefineController(IStockAdjustDefineService _service, IWebHostEnvironment _hostingEnvironment)
|
|
|
{
|
|
|
service = _service;
|
|
|
hostingEnvironment = _hostingEnvironment;
|
|
|
}
|
|
|
|
|
|
public ActionResult Index()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
public ActionResult GetAllData()
|
|
|
{
|
|
|
Hashtable resault = new Hashtable();
|
|
|
DataTable dt = null;
|
|
|
string _where = string.Empty;
|
|
|
_where = " and ";
|
|
|
|
|
|
if (!string.IsNullOrEmpty(Request.Form["txtPartNo"]))
|
|
|
{
|
|
|
_where += " c.part_no = '" + Request.Form["txtPartNo"].ToString().Trim() + "' and ";
|
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(Request.Form["txtlocateName"]))
|
|
|
{
|
|
|
_where += " b.locate_name = '" + Request.Form["txtlocateName"].ToString().Trim() + "' and ";
|
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(Request.Form["txtQCartonNo"]))
|
|
|
{
|
|
|
_where += " a.carton_no = '" + Request.Form["txtQCartonNo"].ToString().Trim() + "' and ";
|
|
|
}
|
|
|
if (!string.IsNullOrEmpty(Request.Form["txtRo_No"]))
|
|
|
{
|
|
|
_where += " a.order_No = '" + Request.Form["txtRo_No"].ToString().Trim() + "' and ";
|
|
|
}
|
|
|
|
|
|
if (_where.Contains(" and "))
|
|
|
{
|
|
|
_where = _where.Remove(_where.LastIndexOf(" and "));
|
|
|
}
|
|
|
List<SysStock> list = service.GetAllData(_where);
|
|
|
resault.Add("rows", list);
|
|
|
return Json(resault);
|
|
|
}
|
|
|
public ActionResult Edit(string ruid)
|
|
|
{
|
|
|
string where = " and ruid='" + ruid + "'";
|
|
|
List<SysStock> hstable = service.GetAllData(where);
|
|
|
ViewData.Add("editType", "editType");
|
|
|
if (hstable.Count > 0)
|
|
|
{
|
|
|
ViewData.Add("partNo", hstable[0].PartNo);
|
|
|
ViewData.Add("locateName", hstable[0].LocateName);
|
|
|
ViewData.Add("cartonNo", hstable[0].CartonNo);
|
|
|
ViewData.Add("qty", hstable[0].Qty);
|
|
|
ViewData.Add("ruid", hstable[0].Ruid);
|
|
|
}
|
|
|
return View("FrmDetail");
|
|
|
}
|
|
|
public ActionResult uploadFile()
|
|
|
{
|
|
|
return View("uploadFile");
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 导入
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult importData()
|
|
|
{
|
|
|
Hashtable result = new Hashtable();
|
|
|
IFormFile file = Request.Form.Files[0];
|
|
|
List<StockAdjustDefine> data = ExcelHelper.GetList<StockAdjustDefine>(file, 0);
|
|
|
result = service.ReadExcelFile(data, CurrentEmp.EmpId);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
public ActionResult generateCatalogId()
|
|
|
{
|
|
|
Hashtable result = new Hashtable();
|
|
|
String catalogId = Guid.NewGuid().ToString();
|
|
|
result.Add("catalogId", catalogId);
|
|
|
return Json(result);
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 将记录插入到历史库存表
|
|
|
/// </summary>
|
|
|
/// <param name="LotNo">编号</param>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult MoveStock()
|
|
|
{
|
|
|
Hashtable resault = new Hashtable();
|
|
|
string LotNo = string.Empty;
|
|
|
string message = string.Empty;
|
|
|
Boolean bo = service.MoveStock(LotNo);
|
|
|
if (bo)
|
|
|
message = "1";
|
|
|
else
|
|
|
message = "0";
|
|
|
resault.Add("status", message);
|
|
|
return Json(resault);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 判断箱号是否存在
|
|
|
/// </summary>
|
|
|
/// <param name="cartonNo">箱号</param>
|
|
|
/// <returns>ture 不存在 false 存在</returns>
|
|
|
public ActionResult IsExist()
|
|
|
{
|
|
|
Hashtable resault = new Hashtable();
|
|
|
string cartonNo = string.Empty;
|
|
|
string message = string.Empty;
|
|
|
Boolean bo = service.IsExist(cartonNo);
|
|
|
if (bo)
|
|
|
message = "1";
|
|
|
else
|
|
|
message = "0";
|
|
|
resault.Add("status", message);
|
|
|
return Json(resault);
|
|
|
}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 判断库存表中该库位信息是否存在
|
|
|
/// </summary>
|
|
|
/// <param name="locateId">库位ID</param>
|
|
|
/// <returns>ture 不存在 false 存在</returns>
|
|
|
public ActionResult Exist()
|
|
|
{
|
|
|
Hashtable resault = new Hashtable();
|
|
|
string locateID = string.Empty;
|
|
|
string message = string.Empty;
|
|
|
Boolean bo = service.Exist(locateID);
|
|
|
if (bo)
|
|
|
message = "1";
|
|
|
else
|
|
|
message = "0";
|
|
|
resault.Add("status", message);
|
|
|
return Json(resault);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 更新库位是否为空的状态
|
|
|
/// </summary>
|
|
|
/// <param name="locateID">库位编号</param>
|
|
|
public ActionResult UpdateLocateEmpty()
|
|
|
{
|
|
|
Hashtable resault = new Hashtable();
|
|
|
string locateID = string.Empty;
|
|
|
string message = string.Empty;
|
|
|
service.UpdateLocateEmpty(locateID);
|
|
|
message = "1";
|
|
|
resault.Add("status", message);
|
|
|
return Json(resault);
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 更新
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult update()
|
|
|
{
|
|
|
Hashtable resault = new Hashtable();
|
|
|
string message = string.Empty;
|
|
|
string lotNo = string.Empty;
|
|
|
string qty = string.Empty;
|
|
|
if (!string.IsNullOrEmpty(Request.Form["ruid"]))
|
|
|
{
|
|
|
lotNo = Request.Form["ruid"].ToString().Trim();
|
|
|
}
|
|
|
if (!string.IsNullOrEmpty(Request.Form["qty"]))
|
|
|
{
|
|
|
qty = Request.Form["qty"].ToString().Trim();
|
|
|
}
|
|
|
bool bo = service.update(qty, lotNo);
|
|
|
if (bo)
|
|
|
message = "保存成功";
|
|
|
else
|
|
|
message = "保存失败";
|
|
|
resault.Add("message", message);
|
|
|
return Json(resault);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 变更事务状态
|
|
|
/// </summary>
|
|
|
/// <param name="lotNo"></param>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult TransType()
|
|
|
{
|
|
|
Hashtable resault = new Hashtable();
|
|
|
string lotNo = string.Empty;
|
|
|
string message = string.Empty;
|
|
|
DataTable dt = null;
|
|
|
bool list = service.TransType(lotNo, ref dt);
|
|
|
resault.Add("rows", list);
|
|
|
return Json(resault);
|
|
|
}
|
|
|
}
|
|
|
}
|