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.

398 lines
12 KiB

  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 ICSRCVIQCsController : ControllerBase
  18. {
  19. ICSRCVIQCsApp App = new ICSRCVIQCsApp();
  20. // GET: WMS/ICSRCVIQCs
  21. public ActionResult ICSRCVIQCs()
  22. {
  23. return View();
  24. }
  25. public ActionResult Rejection()
  26. {
  27. return View();
  28. }
  29. public ActionResult WWRejection()
  30. {
  31. return View();
  32. }
  33. public ActionResult ICSInspectionDetail()
  34. {
  35. return View();
  36. }
  37. public ActionResult ICSLookFiles()
  38. {
  39. return View();
  40. }
  41. //采购
  42. [HttpGet]
  43. public ActionResult GetICSInspection(Pagination pagination, string queryJson)
  44. {
  45. DataTable ListData = App.GetICSInspection(ref pagination, queryJson);
  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. public ActionResult GetInspectionFile(Pagination pagination, string JYID, string queryJson)
  57. {
  58. DataTable ListData = App.GetInspectionFile(ref pagination, queryJson, JYID);
  59. var JsonData = new
  60. {
  61. total = pagination.total,
  62. page = pagination.page,
  63. records = pagination.records,
  64. rows = ListData,
  65. };
  66. return Content(JsonData.ToJson());
  67. }
  68. //委外
  69. [HttpGet]
  70. public ActionResult GetICSInspection2(Pagination pagination, string queryJson)
  71. {
  72. DataTable ListData = App.GetICSInspection2(ref pagination, queryJson);
  73. var JsonData = new
  74. {
  75. total = pagination.total,
  76. page = pagination.page,
  77. records = pagination.records,
  78. rows = ListData,
  79. };
  80. return Content(JsonData.ToJson());
  81. }
  82. //工单
  83. [HttpGet]
  84. public ActionResult GetICSInspection3(Pagination pagination, string queryJson)
  85. {
  86. DataTable ListData = App.GetICSInspection3(ref pagination, queryJson);
  87. var JsonData = new
  88. {
  89. total = pagination.total,
  90. page = pagination.page,
  91. records = pagination.records,
  92. rows = ListData,
  93. };
  94. return Content(JsonData.ToJson());
  95. }
  96. //其他入库
  97. [HttpGet]
  98. public ActionResult GetICSInspection4(Pagination pagination, string queryJson)
  99. {
  100. DataTable ListData = App.GetICSInspection4(ref pagination, queryJson);
  101. var JsonData = new
  102. {
  103. total = pagination.total,
  104. page = pagination.page,
  105. records = pagination.records,
  106. rows = ListData,
  107. };
  108. return Content(JsonData.ToJson());
  109. }
  110. //生产退料
  111. [HttpGet]
  112. public ActionResult GetICSInspection5(Pagination pagination, string queryJson)
  113. {
  114. DataTable ListData = App.GetICSInspection5(ref pagination, queryJson);
  115. var JsonData = new
  116. {
  117. total = pagination.total,
  118. page = pagination.page,
  119. records = pagination.records,
  120. rows = ListData,
  121. };
  122. return Content(JsonData.ToJson());
  123. }
  124. //委外退料
  125. [HttpGet]
  126. public ActionResult GetICSInspection6(Pagination pagination, string queryJson)
  127. {
  128. DataTable ListData = App.GetICSInspection6(ref pagination, queryJson);
  129. var JsonData = new
  130. {
  131. total = pagination.total,
  132. page = pagination.page,
  133. records = pagination.records,
  134. rows = ListData,
  135. };
  136. return Content(JsonData.ToJson());
  137. }
  138. //销售退货
  139. [HttpGet]
  140. public ActionResult GetICSInspection7(Pagination pagination, string queryJson)
  141. {
  142. DataTable ListData = App.GetICSInspection7(ref pagination, queryJson);
  143. var JsonData = new
  144. {
  145. total = pagination.total,
  146. page = pagination.page,
  147. records = pagination.records,
  148. rows = ListData,
  149. };
  150. return Content(JsonData.ToJson());
  151. }
  152. //不良原因
  153. [HttpGet]
  154. public ActionResult Select_ICSBadReason(string BCCode)
  155. {
  156. var data = App.Select_ICSBadReason(BCCode);
  157. return Content(data.ToJson());
  158. }
  159. [HttpGet]
  160. public ActionResult Select_ChangeA(string BCCode)
  161. {
  162. var data = App.Select_ChangeA(BCCode);
  163. return Content(data.ToJson());
  164. }
  165. [HttpGet]
  166. public ActionResult Select_ChangeB(string BRCode)
  167. {
  168. var data = App.Select_ChangeB(BRCode);
  169. return Content(data.ToJson());
  170. }
  171. //不良原因组
  172. [HttpGet]
  173. public ActionResult GetSelectICSBadCode(string BRCode)
  174. {
  175. var data = App.GetSelectICSBadCode(BRCode);
  176. return Content(data.ToJson());
  177. }
  178. /// <summary>
  179. /// 创建检验表
  180. /// </summary>
  181. /// <param name="keyValue"></param>
  182. /// <returns></returns>
  183. [HttpPost]
  184. [HandlerAjaxOnly]
  185. public ActionResult CreateICSInspection(string keyValue, string ICSInspections)
  186. {
  187. string msg = App.CreateICSInspection(keyValue, ICSInspections);
  188. if (!string.IsNullOrEmpty(msg))
  189. {
  190. return Error(msg);
  191. }
  192. else
  193. {
  194. return Success("添加成功!");
  195. }
  196. }
  197. //生成拒收单
  198. [HttpPost]
  199. [HandlerAjaxOnly]
  200. [ValidateAntiForgeryToken]
  201. public ActionResult CreateRejection(string keyValue,string Type)
  202. {
  203. string msg = "";
  204. if (Type=="1")
  205. {
  206. msg = App.CreateRejection(keyValue);
  207. }
  208. else if(Type == "8")
  209. {
  210. msg = App.CreateWLYRejection(keyValue);
  211. }
  212. else if (Type == "9")
  213. {
  214. msg = App.CreateWWWLYRejection(keyValue);
  215. }
  216. else
  217. {
  218. msg = App.CreateWWRejection(keyValue);
  219. }
  220. if (string.IsNullOrEmpty(msg))
  221. {
  222. return Success("操作成功!");
  223. }
  224. else
  225. {
  226. return Error("" + msg + "");
  227. }
  228. }
  229. /// <summary>
  230. /// 删除拒收单
  231. /// </summary>
  232. /// <returns></returns>
  233. [HttpPost]
  234. [HandlerAjaxOnly]
  235. [ValidateAntiForgeryToken]
  236. public ActionResult DelectRejection(string keyValue)
  237. {
  238. string msg = App.DelectRejection(keyValue);
  239. if (string.IsNullOrEmpty(msg))
  240. {
  241. return Success("删除成功!");
  242. }
  243. else
  244. {
  245. return Error(msg);
  246. }
  247. }
  248. [HttpPost]
  249. [HandlerAjaxOnly]
  250. [ValidateAntiForgeryToken]
  251. public ActionResult DelectWWRejection(string keyValue)
  252. {
  253. string msg = App.DelectWWRejection(keyValue);
  254. if (string.IsNullOrEmpty(msg))
  255. {
  256. return Success("删除成功!");
  257. }
  258. else
  259. {
  260. return Error(msg);
  261. }
  262. }
  263. [HttpGet]
  264. public ActionResult GetInventoryInspection(Pagination pagination, string InvCode, int SampleQuantity, string ResultINp)
  265. {
  266. DataTable ListData = App.GetInventoryInspection(ref pagination, InvCode, SampleQuantity, ResultINp);
  267. var JsonData = new
  268. {
  269. total = pagination.total,
  270. page = pagination.page,
  271. records = pagination.records,
  272. rows = ListData,
  273. };
  274. return Content(JsonData.ToJson());
  275. }
  276. [HttpPost]
  277. [HandlerAjaxOnly]
  278. public ActionResult SaveICSInspectionDetail(string ICSMTDOC, string InvCode, string ResultINp)
  279. {
  280. string msg = App.SaveICSInspectionDetail(ICSMTDOC, InvCode, ResultINp);
  281. if (!string.IsNullOrEmpty(msg))
  282. {
  283. return Error(msg);
  284. }
  285. else
  286. {
  287. return Success("保存成功!");
  288. }
  289. }
  290. /// <summary>
  291. /// 上传文件(检验信息)
  292. /// </summary>
  293. /// <param name="BidCode"></param>
  294. /// <param name="ID"></param>
  295. /// <returns></returns>
  296. [HttpPost]
  297. public ActionResult UpLoadFileImport(string ID,string DNCode)
  298. {
  299. string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode;
  300. string UploadfileName = "";
  301. string fileName = "";
  302. //获取上传的文件集合
  303. try
  304. {
  305. HttpFileCollection httpFile = System.Web.HttpContext.Current.Request.Files;
  306. for (int i = 0; i < httpFile.Count; i++)
  307. {
  308. //获取送货单号
  309. //string STNO = Request.Form["STNO"].ToString();
  310. UploadfileName = Path.GetFileNameWithoutExtension(httpFile[i].FileName)
  311. + Path.GetExtension(httpFile[i].FileName);
  312. fileName = DNCode + Path.GetExtension(httpFile[i].FileName);
  313. string Paths = System.Web.HttpContext.Current.Server.MapPath("~\\File\\InspectionFile\\");
  314. if (!Directory.Exists(Paths))
  315. {
  316. Directory.CreateDirectory(Paths);
  317. }
  318. string filePath = System.Web.HttpContext.Current.Server.MapPath("~\\File\\InspectionFile\\" + UploadfileName);
  319. int iLen = httpFile[0].ContentLength;
  320. byte[] bData = new byte[iLen];
  321. httpFile[0].InputStream.Read(bData, 0, iLen);
  322. FileStream fs = new FileStream(filePath, FileMode.OpenOrCreate);
  323. fs.Write(bData, 0, bData.Length);
  324. fs.Flush();
  325. fs.Close();
  326. fs.Dispose();
  327. App.InsertICSInspectionFile(ID, UploadfileName, fileName);
  328. }
  329. return Success("上传成功!");
  330. }
  331. catch (Exception ex)
  332. {
  333. return Error(ex.Message);
  334. }
  335. }
  336. //采购到货单检验
  337. [HttpGet]
  338. public ActionResult GetICSInspection8(Pagination pagination, string queryJson)
  339. {
  340. DataTable ListData = App.GetICSInspection8(ref pagination, queryJson);
  341. var JsonData = new
  342. {
  343. total = pagination.total,
  344. page = pagination.page,
  345. records = pagination.records,
  346. rows = ListData,
  347. };
  348. return Content(JsonData.ToJson());
  349. }
  350. //委外采购到货单检验
  351. [HttpGet]
  352. public ActionResult GetICSInspection9(Pagination pagination, string queryJson)
  353. {
  354. DataTable ListData = App.GetICSInspection9(ref pagination, queryJson);
  355. var JsonData = new
  356. {
  357. total = pagination.total,
  358. page = pagination.page,
  359. records = pagination.records,
  360. rows = ListData,
  361. };
  362. return Content(JsonData.ToJson());
  363. }
  364. }
  365. }