|
|
using NFine.Application.BBWMS;using NFine.Code;using System;using System.Collections.Generic;using System.Data;using System.IO;using System.Linq;using System.Web;using System.Web.Mvc;
namespace NFine.Web.Areas.BBWMS.Controllers{ public class ICSManufactureReceiveController : ControllerBase { private ICSManufactureReceiveApp App = new ICSManufactureReceiveApp(); public ActionResult Index() { return View(); }
public ActionResult BindAdd() { return View(); } public ActionResult SeachLotUpdate() { return View(); }
public ActionResult ComparisonLot() { return View(); } /// <summary>
/// 获取检验单数据
/// </summary>
/// <param name="pagination"></param>
/// <param name="queryJson"></param>
/// <returns></returns>
[HttpGet] [HandlerAjaxOnly] public ActionResult GetManufactureReceive(Pagination pagination, string queryJson) { DataTable ListData = App.GetManufactureReceive(queryJson, ref pagination); var JsonData = new { total = pagination.total, page = pagination.page, records = pagination.records, rows = ListData, }; return Content(JsonData.ToJson()); }
[HttpGet] [HandlerAjaxOnly] public ActionResult GetManufactureReceiveLot(string ProductionCode, string WHCode,string InvCode,Pagination pagination) { DataTable ListData = App.GetManufactureReceiveLot(ProductionCode, WHCode, InvCode,ref pagination); var JsonData = new { total = pagination.total, page = pagination.page, records = pagination.records, rows = ListData, }; return Content(JsonData.ToJson()); }
//
/// <summary>
/// 获取扫描条码信息
/// </summary>
/// <param name="LotNo"></param>
/// <returns></returns>
[HttpGet] [HandlerAjaxOnly] public ActionResult GetLotGridJson(string LotNO) { string ListData = App.GetLotGridJson(LotNO).ToJson(); return Content(ListData); }
//入库单绑定条码
[HttpPost] [HandlerAjaxOnly] [ValidateAntiForgeryToken] public ActionResult CreateCheckNO( string Lots) { string msg = App.CreateCheckNO(Lots); if (msg=="") { return Success("绑定成功!"); } else { return Error(msg); } }
/// <summary>
/// 删除送检单信息
/// </summary>
/// <param name="keyValue"></param>
/// <returns></returns>
[HttpPost] [HandlerAjaxOnly] [ValidateAntiForgeryToken] public ActionResult DeleteItemLot(string CheckNos) { CheckNos = CheckNos.Substring(1, CheckNos.Length-2); string msg = App.DeleteItemLot(CheckNos); if (string.IsNullOrWhiteSpace(msg)) { return Success("删除成功!"); } else { return Error(msg); } }
[HttpGet] [HandlerAjaxOnly] public ActionResult GetSubGridJson(string CheckNo, Pagination pagination) { DataTable ListData = App.GetSubGridJson(CheckNo, ref pagination); var JsonData = new { total = pagination.total, page = pagination.page, records = pagination.records, rows = ListData, }; return Content(JsonData.ToJson()); }
[HttpPost] /// <summary>
/// 条码绑定入库单导入
/// </summary>
public string UploadFileBinding() { try { HttpFileCollection hpFiles = System.Web.HttpContext.Current.Request.Files; if (hpFiles != null && hpFiles.Count > 0) {
string IsXls = System.IO.Path.GetExtension(hpFiles[0].FileName).ToString().ToLower();//System.IO.Path.GetExtension获得文件的扩展名
if (IsXls != ".xls" && IsXls != ".xlsx") {
return "只可以选择Excel(.xls .xlsx)文件";//当选择的不是Excel文件时,返回
} string filename = DateTime.Now.ToString("yyyyMMddhhmmss") + Guid.NewGuid() + IsXls; //获取Execle文件名 DateTime日期函数
string savePath = System.Web.HttpContext.Current.Server.MapPath("~\\File\\UPLoadFile\\" + filename);//Server.MapPath 获得虚拟服务器相对路径
int iLen = hpFiles[0].ContentLength; if (Directory.Exists(savePath)) return "文件已存在"; byte[] bData = new byte[iLen]; hpFiles[0].InputStream.Read(bData, 0, iLen);
FileStream newFile = new FileStream(savePath, FileMode.OpenOrCreate); newFile.Write(bData, 0, bData.Length); newFile.Flush(); int _FileSizeTemp = hpFiles[0].ContentLength;
newFile.Close(); newFile.Dispose(); //bool del = false;
string mess = ""; mess = App.UploadFileBinding(savePath); if (System.IO.File.Exists(savePath))//删除文件
{
System.IO.File.Delete(savePath); } return mess;
} else { return "获取文件失败"; } } catch (Exception ex) {
return ex.ToString(); } }
[HttpGet] public ActionResult GetINV(string invcode, string Code, string Invstd, string EATTRIBUTE2, string TimeFrom, string TimeArrive,string isSeachStatus, Pagination pagination) { DataTable ListData = App.GetINV(invcode, Code, Invstd, EATTRIBUTE2, TimeFrom, TimeArrive, isSeachStatus, ref pagination); var JsonData = new { total = pagination.total, page = pagination.page, records = pagination.records, rows = ListData, }; return Content(JsonData.ToJson()); }
[HttpPost] [HandlerAjaxOnly] [ValidateAntiForgeryToken] public ActionResult UpdateLotSeachStatus(string keyValue,string Type) { string msg = App.UpdateLotSeachStatus(keyValue, Type); if (string.IsNullOrEmpty(msg)) { return Success("检索成功!"); } else { return Error(msg); } }
[HttpPost] public void StatementExportAll( string CheckNo) { //ID = ID.Substring(0, ID.Length - 2);
DataTable dt = App.StatementExportAll(CheckNo); AsposeCell.Export(dt); }
}}
|