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.

105 lines
3.5 KiB
C#

This file contains ambiguous Unicode 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 Estsh.Core.Controllers;
using Estsh.Core.Model.ExcelModel;
using Estsh.Core.Models;
using Estsh.Core.Services.IServices;
using Estsh.Core.Util;
using Microsoft.AspNetCore.Mvc;
using System.Collections;
/***************************************************************************************************
*
* 更新人sitong.dong
* 描述:成品异常领用
* 修改时间2022.06.22
* 修改日志:系统迭代升级
*
**************************************************************************************************/
namespace Estsh.Core.Web.Controllers
{
public class ProdunctFinishedController : BaseController
{
private IProdunctFinishedService service;
public ProdunctFinishedController(IProdunctFinishedService _service)
{
service = _service;
}
public ActionResult Index()
{
return View();
}
public string SetWhere()
{
string _where = "";
string dateStart = DateTime.MinValue.ToString("yyyy-MM-dd HH:mm:ss");
string dateEnd = DateTime.MaxValue.ToString("yyyy-MM-dd HH:mm:ss");
string chkUseTime = Request.Form["chkUseTime"];
if (string.IsNullOrEmpty(chkUseTime) == false)
{
dateStart = Request.Form["txtStartTime"].ToString();
dateEnd = Request.Form["txtEndTime"].ToString();
_where += " AND create_time BETWEEN '" + dateStart + "' AND '" + dateEnd + "' ";
}
return _where;
}
public ActionResult GetAll(Pager pager,string str)
{
if(string.IsNullOrEmpty(str))
{
return Json("");
}
string where = SetWhere();
int totalCount = 0;
List<GSnMisc> dtQuery = service.GetAll(where, pager, ref totalCount);
Hashtable result = new Hashtable();
result.Add("rows", dtQuery);
result.Add("pager.totalRows", totalCount);
return Json(result);
}
public ActionResult ProductShipping(string SerialNumber, string FinishPeople, string OutingNo, string Reason, string Remark, Pager pager)
{
Hashtable result = new Hashtable();
if (!string.IsNullOrEmpty(SerialNumber) && !string.IsNullOrEmpty(FinishPeople) && !string.IsNullOrEmpty(Reason))
{
bool CheckSN = service.IsCartonNoExists(SerialNumber);
if (CheckSN)
{
string tres = service.ProductShipping(SerialNumber, Remark, FinishPeople, 100, OutingNo, Reason);
result.Add("status", tres);
return Json(result);
}
else
{
result.Add("status", "条码不存在,请检查重新输入或者扫描!");
return Json(result);
}
}
else
{
result.Add("status", "数据校验失败,请检查!");
return Json(result);
}
}
public ActionResult exportData(Pager pager, int a)
{
int totalCount = 0;
string where = SetWhere();
List<ProdunctFinished> dataHt = service.getTableListByPage(where, pager, ref totalCount);
var memoryStream = ExcelHelper.ToExcel(dataHt);
return File(memoryStream.ToArray(), "application/ms-excel", "成品异常领用.xls");
}
}
}