纽威
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

216 lines
6.3 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
3 years ago
  1. using NFine.Application.WMS;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Data;
  5. using System.IO;
  6. using System.Linq;
  7. using System.Web;
  8. using System.Web.Mvc;
  9. using NFine.Code;
  10. using System.Data.SqlClient;
  11. using NFine.Data.Extensions;
  12. using System.Data.OleDb;
  13. using System.Configuration;
  14. using ICS.Application.Entity;
  15. namespace NFine.Web.Areas.WMS.Controllers
  16. {
  17. public class ICSMTDOCController : ControllerBase
  18. {
  19. ICSMTDOCApp App = new ICSMTDOCApp();
  20. // GET: WMS/ICSMTDOC
  21. public ActionResult Metamorphosis()
  22. {
  23. return View();
  24. }
  25. public ActionResult ICSMTDOCAdd()
  26. {
  27. return View();
  28. }
  29. public ActionResult GetICSInventory()
  30. {
  31. return View();
  32. }
  33. public ActionResult GetBatchCode()
  34. {
  35. return View();
  36. }
  37. public ActionResult MetamorphosisToLead()
  38. {
  39. return View();
  40. }
  41. [HttpGet]
  42. [HandlerAjaxOnly]
  43. public ActionResult GetGridJson(Pagination pagination, string queryJson)
  44. {
  45. DataTable ListData = App.GetGridJson(queryJson, ref pagination);
  46. var JsonData = new
  47. {
  48. total = pagination.total,
  49. page = pagination.page,
  50. records = pagination.records,
  51. rows = ListData,
  52. };
  53. return Content(JsonData.ToJson());
  54. }
  55. [HttpGet]
  56. [HandlerAjaxOnly]
  57. public ActionResult GetSubGridJson(string MTDOCCode)
  58. {
  59. DataTable ListData = App.GetSubGridJson(MTDOCCode);
  60. var JsonData = new
  61. {
  62. rows = ListData,
  63. };
  64. return Content(JsonData.ToJson());
  65. }
  66. //在库条码
  67. public ActionResult GetRepertory(string LotNo ,Pagination pagination)
  68. {
  69. DataTable ListData = App.GetRepertory(LotNo, ref pagination);
  70. var JsonData = new
  71. {
  72. total = pagination.total,
  73. page = pagination.page,
  74. records = pagination.records,
  75. rows = ListData,
  76. };
  77. return Content(JsonData.ToJson());
  78. }
  79. public ActionResult GetInvcode(string Invcode, Pagination pagination)
  80. {
  81. DataTable ListData = App.GetInvcode(Invcode, ref pagination);
  82. var JsonData = new
  83. {
  84. total = pagination.total,
  85. page = pagination.page,
  86. records = pagination.records,
  87. rows = ListData,
  88. };
  89. return Content(JsonData.ToJson());
  90. }
  91. public ActionResult GetCode(string Type, string Common ,Pagination pagination)
  92. {
  93. DataTable ListData = App.GetCode(Type, Common, ref pagination);
  94. var JsonData = new
  95. {
  96. total = pagination.total,
  97. page = pagination.page,
  98. records = pagination.records,
  99. rows = ListData,
  100. };
  101. return Content(JsonData.ToJson());
  102. }
  103. /// <summary>
  104. /// 创建形态转换
  105. /// </summary>
  106. /// <param name="keyValue"></param>
  107. /// <returns></returns>
  108. [HttpPost]
  109. [HandlerAjaxOnly]
  110. public ActionResult CreateICSMTDOC(string ICSMTDOC, string InvCode, string Memo)
  111. {
  112. string msg = App.CreateICSMTDOC(ICSMTDOC, InvCode, Memo);
  113. if (!string.IsNullOrEmpty(msg))
  114. {
  115. return Error(msg);
  116. }
  117. else
  118. {
  119. return Success("添加成功!");
  120. }
  121. }
  122. //审核
  123. public ActionResult ICSMTDOCAudit(string MTDOCCode)
  124. {
  125. string msg = App.ICSMTDOCAudit(MTDOCCode);
  126. if (string.IsNullOrEmpty(msg))
  127. {
  128. return Success("操作成功!");
  129. }
  130. else
  131. {
  132. return Error("" + msg + "");
  133. }
  134. }
  135. [HttpPost]
  136. /// <summary>
  137. /// 文件上传到本地
  138. /// </summary>
  139. public string UploadFile()
  140. {
  141. try
  142. {
  143. string str_Year = Request.Form["txt_Year"];
  144. String UPLoadType = Request.Form["UPLoadType"];
  145. HttpFileCollection hpFiles = System.Web.HttpContext.Current.Request.Files;
  146. if (hpFiles != null && hpFiles.Count > 0)
  147. {
  148. string IsXls = System.IO.Path.GetExtension(hpFiles[0].FileName).ToString().ToLower();//System.IO.Path.GetExtension获得文件的扩展名
  149. if (IsXls != ".xls" && IsXls != ".xlsx")
  150. {
  151. return "只可以选择Excel(.xls .xlsx)文件";//当选择的不是Excel文件时,返回
  152. }
  153. string filename = DateTime.Now.ToString("yyyyMMddhhmmss") + UPLoadType + IsXls; //获取Execle文件名 DateTime日期函数
  154. string savePath = System.Web.HttpContext.Current.Server.MapPath("~\\File\\UPLoadFile\\" + filename);//Server.MapPath 获得虚拟服务器相对路径
  155. int iLen = hpFiles[0].ContentLength;
  156. if (Directory.Exists(savePath)) return "文件已存在";
  157. byte[] bData = new byte[iLen];
  158. hpFiles[0].InputStream.Read(bData, 0, iLen);
  159. FileStream newFile = new FileStream(savePath, FileMode.OpenOrCreate);
  160. newFile.Write(bData, 0, bData.Length);
  161. newFile.Flush();
  162. int _FileSizeTemp = hpFiles[0].ContentLength;
  163. newFile.Close();
  164. newFile.Dispose();
  165. //bool del = false;
  166. string mess = "";
  167. mess = App.ToLead(savePath, str_Year);
  168. if (System.IO.File.Exists(savePath))//删除文件
  169. {
  170. System.IO.File.Delete(savePath);
  171. }
  172. return mess;
  173. }
  174. else
  175. {
  176. return "获取文件失败";
  177. }
  178. }
  179. catch (Exception ex)
  180. {
  181. return ex.ToString();
  182. }
  183. }
  184. }
  185. }