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.

1963 lines
60 KiB

3 weeks ago
  1. using NFine.Application.BBWMS;
  2. using NFine.Code;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Configuration;
  6. using System.Data;
  7. using System.IO;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Web;
  11. using System.Web.Mvc;
  12. namespace NFine.Web.Areas.BBWMS.Controllers
  13. {
  14. /// <summary>
  15. /// IQC来料检验
  16. /// </summary>
  17. public class IQCQualityController : ControllerBase
  18. {
  19. private IQCQualityApp app = new IQCQualityApp();
  20. // GET: WMS/IQCQuality
  21. public ActionResult AqlQuery()
  22. {
  23. return View();
  24. }
  25. public ActionResult ICSLookFiles()
  26. {
  27. return View();
  28. }
  29. public ActionResult AqlEdit(string ids)
  30. {
  31. ViewData["ids"] = ids;
  32. return View();
  33. }
  34. public ActionResult Item2AqlQuery()
  35. {
  36. return View();
  37. }
  38. public ActionResult Item2AqlEdit()
  39. {
  40. return View();
  41. }
  42. public ActionResult Item2AqlEditSingle(string ids)
  43. {
  44. ViewData["ids"] = ids;
  45. return View();
  46. }
  47. public ActionResult Item2AqlFileView(string ids)
  48. {
  49. ViewData["ids"] = ids;
  50. return View();
  51. }
  52. public ActionResult MaterialCheckLog(string ids)
  53. {
  54. ViewData["ids"] = ids;
  55. return View();
  56. }
  57. public ActionResult BadCodeGroupQuery()
  58. {
  59. return View();
  60. }
  61. public ActionResult BadCodeGroupEdit(string ids)
  62. {
  63. ViewData["ids"] = ids;
  64. return View();
  65. }
  66. public ActionResult BadReasonGroupQuery()
  67. {
  68. return View();
  69. }
  70. public ActionResult BadReasonGroupEdit(string ids)
  71. {
  72. ViewData["ids"] = ids;
  73. return View();
  74. }
  75. public ActionResult CheckItemGroupQuery()
  76. {
  77. return View();
  78. }
  79. public ActionResult CheckItemGroupEdit(string ids)
  80. {
  81. ViewData["ids"] = ids;
  82. return View();
  83. }
  84. public ActionResult Item2CheckItemGroupQuery()
  85. {
  86. return View();
  87. }
  88. public ActionResult Item2CheckItemGroupBind()
  89. {
  90. return View();
  91. }
  92. public ActionResult Item2CheckItemEdit(string ids)
  93. {
  94. ViewData["ids"] = ids;
  95. return View();
  96. }
  97. public ActionResult MaterialInStorageCheckQuery()
  98. {
  99. return View();
  100. }
  101. public ActionResult CPMaterialInStorageCheckQuery()
  102. {
  103. return View();
  104. }
  105. public ActionResult MaterialInStorageCheckEdit(string ids,decimal qty,string docType,string ASNCode,string InvCode,string InvBatcgNo
  106. )
  107. {
  108. ViewData["ids"] = ids;
  109. ViewData["qty"] = qty;
  110. ViewData["docType"] = docType;
  111. ViewData["ASNCode"] = ASNCode;
  112. ViewData["InvCode"] = InvCode;
  113. ViewData["InvBatcgNo"] = InvBatcgNo;
  114. return View();
  115. }
  116. public ActionResult CPMaterialInStorageCheckEdit(string ids, decimal qty,string asnCode)
  117. {
  118. ViewData["ids"] = ids;
  119. ViewData["qty"] = qty;
  120. ViewData["asnCode"] = asnCode;
  121. return View();
  122. }
  123. public ActionResult MaterialDestoryExperimentEdit(string ids)
  124. {
  125. ViewData["ids"] = ids;
  126. return View();
  127. }
  128. public ActionResult MaterialInStorageFinalQuery()
  129. {
  130. return View();
  131. }
  132. public ActionResult CPMaterialInStorageFinalQuery()
  133. {
  134. return View();
  135. }
  136. public ActionResult MaterialReJudgeEdit(string ids,string judgeRole)
  137. {
  138. ViewData["ids"] = ids;
  139. ViewData["judgeRole"] = judgeRole;
  140. return View();
  141. }
  142. public ActionResult MaterialReJudgeView(string ids, string judgeRole)
  143. {
  144. ViewData["ids"] = ids;
  145. ViewData["judgeRole"] = judgeRole;
  146. return View();
  147. }
  148. public ActionResult MaterialDoJudge(string ids)
  149. {
  150. ViewData["ids"] = ids;
  151. return View();
  152. }
  153. public ActionResult MaterialCheckDoJudge(string ids, decimal qty, string docType)
  154. {
  155. ViewData["ids"] = ids;
  156. ViewData["qty"] = qty;
  157. ViewData["docType"] = docType;
  158. return View();
  159. }
  160. public ActionResult MaterialFinalJudgeEdit(string ids)
  161. {
  162. ViewData["ids"] = ids;
  163. return View();
  164. }
  165. public ActionResult CPMaterialFinalJudgeEdit(string ids)
  166. {
  167. ViewData["ids"] = ids;
  168. return View();
  169. }
  170. public ActionResult MaterialHasReturnItemEdit(string ids)
  171. {
  172. ViewData["ids"] = ids;
  173. return View();
  174. }
  175. public ActionResult VendorFileIndex(string ASNCode, string InvCode,string BatchCode)
  176. {
  177. ViewData["ASNCode"] = ASNCode;
  178. ViewData["InvCode"] = InvCode;
  179. ViewData["BatchCode"] = BatchCode;
  180. return View();
  181. }
  182. /// <summary>
  183. /// 查询检验项目组列表
  184. /// </summary>
  185. /// <param name="pagination"></param>
  186. /// <param name="queryJson"></param>
  187. /// <returns></returns>
  188. [HttpPost]
  189. public ActionResult GetCheckItemGroupPageList(Pagination pagination, string queryJson)
  190. {
  191. DataTable ListData = app.GetCheckItemGroupPageList(queryJson, ref pagination);
  192. var JsonData = new
  193. {
  194. total = pagination.total,
  195. page = pagination.page,
  196. records = pagination.records,
  197. rows = ListData,
  198. };
  199. return Content(JsonData.ToJson());
  200. }
  201. /// <summary>
  202. /// 查询检验项目
  203. /// </summary>
  204. /// <param name="id"></param>
  205. /// <param name="pagination"></param>
  206. /// <returns></returns>
  207. [HttpGet]
  208. public ActionResult GetCheckItemDetailList(string id, Pagination pagination)
  209. {
  210. DataTable ListData = app.GetCheckItemDetailList(id, ref pagination);
  211. var JsonData = new
  212. {
  213. total = 1,
  214. page = 1,
  215. records = 0,
  216. rows = ListData,
  217. };
  218. return Content(JsonData.ToJson());
  219. }
  220. /// <summary>
  221. /// 查询Aql列表
  222. /// </summary>
  223. /// <param name="pagination"></param>
  224. /// <param name="queryJson"></param>
  225. /// <returns></returns>
  226. [HttpPost]
  227. public ActionResult GetGridJsonChengPing(Pagination pagination, string queryJson)
  228. {
  229. DataTable ListData = app.GetGridJsonChengPing(queryJson, ref pagination);
  230. var JsonData = new
  231. {
  232. total = pagination.total,
  233. page = pagination.page,
  234. records = pagination.records,
  235. rows = ListData,
  236. };
  237. return Content(JsonData.ToJson());
  238. }
  239. /// <summary>
  240. /// 查询不良状态组列表
  241. /// </summary>
  242. /// <param name="pagination"></param>
  243. /// <param name="queryJson"></param>
  244. /// <returns></returns>
  245. [HttpPost]
  246. public ActionResult GetBadCodeGroupPageList(Pagination pagination, string queryJson)
  247. {
  248. DataTable ListData = app.GetBadCodeGroupPageList(queryJson, ref pagination);
  249. var JsonData = new
  250. {
  251. total = pagination.total,
  252. page = pagination.page,
  253. records = pagination.records,
  254. rows = ListData,
  255. };
  256. return Content(JsonData.ToJson());
  257. }
  258. /// <summary>
  259. /// 查询不良状态列表
  260. /// </summary>
  261. /// <param name="id"></param>
  262. /// <param name="pagination"></param>
  263. /// <returns></returns>
  264. [HttpGet]
  265. public ActionResult GetBadCodeGroupDetailList(string id, Pagination pagination)
  266. {
  267. DataTable ListData = app.GetBadCodeGroupDetailList(id, ref pagination);
  268. var JsonData = new
  269. {
  270. total = 1,
  271. page = 1,
  272. records = 0,
  273. rows = ListData,
  274. };
  275. return Content(JsonData.ToJson());
  276. }
  277. /// <summary>
  278. /// 查询Aql明细
  279. /// </summary>
  280. /// <param name="id"></param>
  281. /// <param name="pagination"></param>
  282. /// <returns></returns>
  283. [HttpGet]
  284. public ActionResult GetAqlSubGridJsonList(string id, Pagination pagination)
  285. {
  286. DataTable ListData = app.GetAqlSubGridJsonList(id, ref pagination);
  287. var JsonData = new
  288. {
  289. total = 1,
  290. page = 1,
  291. records = 0,
  292. rows = ListData,
  293. };
  294. return Content(JsonData.ToJson());
  295. }
  296. /// <summary>
  297. /// 保存
  298. /// </summary>
  299. /// <param name="keyValue"></param>
  300. /// <returns></returns>
  301. [HttpPost]
  302. public ActionResult SaveAql(string keyValue)
  303. {
  304. string msg = app.SaveAql(keyValue);
  305. if (!string.IsNullOrEmpty(msg))
  306. {
  307. return Error(msg);
  308. }
  309. else
  310. {
  311. return Success("操作成功!");
  312. }
  313. }
  314. /// <summary>
  315. /// 获取单个
  316. /// </summary>
  317. /// <param name="keyValue"></param>
  318. /// <returns></returns>
  319. [HttpGet]
  320. public ActionResult GetAql(string keyValue)
  321. {
  322. var dt = app.GetAql(keyValue);
  323. return Content(dt.ToJson());
  324. }
  325. /// <summary>
  326. /// 删除
  327. /// </summary>
  328. /// <param name="keyValue"></param>
  329. /// <returns></returns>
  330. [HttpPost]
  331. public ActionResult DeleteAql(string keyValue)
  332. {
  333. var msg = app.DeleteAql(keyValue);
  334. if (!string.IsNullOrEmpty(msg))
  335. {
  336. return Error(msg);
  337. }
  338. else
  339. {
  340. return Success("操作成功!");
  341. }
  342. }
  343. /// <summary>
  344. /// 导出列表
  345. /// </summary>
  346. /// <param name="pagination"></param>
  347. /// <param name="queryJson"></param>
  348. /// <returns></returns>
  349. [HttpPost]
  350. public void ExportAllAqlList(string RulesCode, string RulesName, string Enable)
  351. {
  352. DataTable dt = app.ExportAllAqlList(RulesCode, RulesName, Enable);
  353. AsposeCell.Export(dt);
  354. }
  355. /// <summary>
  356. /// 查询物料Aql关系列表
  357. /// </summary>
  358. /// <param name="pagination"></param>
  359. /// <param name="queryJson"></param>
  360. /// <returns></returns>
  361. [HttpPost]
  362. public ActionResult GetItem2RuleList(Pagination pagination, string queryJson)
  363. {
  364. DataTable ListData = app.GetItem2RuleList(queryJson, ref pagination);
  365. var JsonData = new
  366. {
  367. total = pagination.total,
  368. page = pagination.page,
  369. records = pagination.records,
  370. rows = ListData,
  371. };
  372. return Content(JsonData.ToJson());
  373. }
  374. /// <summary>
  375. /// 获取所有物料(条件)
  376. /// </summary>
  377. /// <param name="keyValue"></param>
  378. /// <returns></returns>
  379. [HttpGet]
  380. public ActionResult GetAllItemList(string code)
  381. {
  382. var dt = app.GetAllItemList(code);
  383. return Content(dt.ToJson());
  384. }
  385. /// <summary>
  386. /// 获取所有Aql(条件)
  387. /// </summary>
  388. /// <param name="keyValue"></param>
  389. /// <returns></returns>
  390. [HttpGet]
  391. public ActionResult GetAllAqlList(string code)
  392. {
  393. var dt = app.GetAllAqlList(code);
  394. return Content(dt.ToJson());
  395. }
  396. /// <summary>
  397. /// 获取所有检验类型(条件)
  398. /// </summary>
  399. /// <param name="keyValue"></param>
  400. /// <returns></returns>
  401. [HttpGet]
  402. public ActionResult GetAllCheckGroupList(string code)
  403. {
  404. var dt = app.GetAllCheckGroupList(code);
  405. return Content(dt.ToJson());
  406. }
  407. /// <summary>
  408. /// 获取单个
  409. /// </summary>
  410. /// <param name="keyValue"></param>
  411. /// <returns></returns>
  412. [HttpGet]
  413. public ActionResult GetItem2Aql(string keyValue)
  414. {
  415. var dt = app.GetItem2Aql(keyValue);
  416. return Content(dt.ToJson());
  417. }
  418. /// <summary>
  419. /// 保存
  420. /// </summary>
  421. /// <param name="keyValue"></param>
  422. /// <returns></returns>
  423. [HttpPost]
  424. public ActionResult SaveItem2Aql(string keyValue)
  425. {
  426. string msg = app.SaveItem2Aql(keyValue);
  427. if (!string.IsNullOrEmpty(msg))
  428. {
  429. return Error(msg);
  430. }
  431. else
  432. {
  433. return Success("操作成功!");
  434. }
  435. }
  436. /// <summary>
  437. /// 保存
  438. /// </summary>
  439. /// <param name="keyValue"></param>
  440. /// <returns></returns>
  441. [HttpPost]
  442. public ActionResult SaveItem2AqlSingle(string keyValue)
  443. {
  444. string msg = app.SaveItem2AqlSingle(keyValue);
  445. if (!string.IsNullOrEmpty(msg))
  446. {
  447. return Error(msg);
  448. }
  449. else
  450. {
  451. return Success("操作成功!");
  452. }
  453. }
  454. /// <summary>
  455. /// 导入列表
  456. /// </summary>
  457. /// <param name="pagination"></param>
  458. /// <param name="queryJson"></param>
  459. /// <returns></returns>
  460. [HttpPost]
  461. public string UploadFile()
  462. {
  463. try
  464. {
  465. //string str_Year = Request.Form["txt_Year"];
  466. //String UPLoadType = Request.Form["UPLoadType"];
  467. HttpFileCollection hpFiles = System.Web.HttpContext.Current.Request.Files;
  468. if (hpFiles != null && hpFiles.Count > 0)
  469. {
  470. string IsXls = System.IO.Path.GetExtension(hpFiles[0].FileName).ToString().ToLower();//System.IO.Path.GetExtension获得文件的扩展名
  471. if (IsXls != ".xls" && IsXls != ".xlsx")
  472. {
  473. return "只可以选择Excel(.xls .xlsx)文件";//当选择的不是Excel文件时,返回
  474. }
  475. string filename = DateTime.Now.ToString("yyyyMMddhhmmss") + IsXls; //获取Execle文件名 DateTime日期函数
  476. string savePath = System.Web.HttpContext.Current.Server.MapPath("~\\File\\IQC\\" + filename);//Server.MapPath 获得虚拟服务器相对路径
  477. int iLen = hpFiles[0].ContentLength;
  478. if (Directory.Exists(savePath)) return "文件已存在";
  479. byte[] bData = new byte[iLen];
  480. hpFiles[0].InputStream.Read(bData, 0, iLen);
  481. FileStream newFile = new FileStream(savePath, FileMode.OpenOrCreate);
  482. newFile.Write(bData, 0, bData.Length);
  483. newFile.Flush();
  484. int _FileSizeTemp = hpFiles[0].ContentLength;
  485. newFile.Close();
  486. newFile.Dispose();
  487. //bool del = false;
  488. string mess = "";
  489. mess = app.SetData_PR(savePath);
  490. if (System.IO.File.Exists(savePath))//删除文件
  491. {
  492. System.IO.File.Delete(savePath);
  493. }
  494. return mess;
  495. }
  496. else
  497. {
  498. return "获取文件失败";
  499. }
  500. }
  501. catch (Exception ex)
  502. {
  503. return ex.ToString();
  504. }
  505. }
  506. /// <summary>
  507. /// 导出物料关联Aql列表
  508. /// </summary>
  509. /// <param name="pagination"></param>
  510. /// <param name="queryJson"></param>
  511. /// <returns></returns>
  512. [HttpPost]
  513. public void ExportAllItem2AqlList(string RulesCode, string RulesName, string InvCode, string InvName)
  514. {
  515. DataTable dt = app.ExportAllItem2AqlList(RulesCode, RulesName, InvCode, InvName);
  516. AsposeCell.Export(dt);
  517. }
  518. /// <summary>
  519. /// 删除
  520. /// </summary>
  521. /// <param name="keyValue"></param>
  522. /// <returns></returns>
  523. [HttpPost]
  524. public ActionResult DeleteItem2Aql(string keyValue)
  525. {
  526. var msg = app.DeleteItem2Aql(keyValue);
  527. if (!string.IsNullOrEmpty(msg))
  528. {
  529. return Error(msg);
  530. }
  531. else
  532. {
  533. return Success("操作成功!");
  534. }
  535. }
  536. [HttpPost]
  537. public ActionResult UpLoadItemRuleFile()
  538. {
  539. try
  540. {
  541. //获取上传的文件集合
  542. HttpFileCollection httpFile = System.Web.HttpContext.Current.Request.Files;
  543. //获取送货单号
  544. string ID = Request.Form["ID"].ToString();
  545. //string LableName = Request.Form["LableName"].ToString();
  546. string fileName = Path.GetFileNameWithoutExtension(httpFile[0].FileName)
  547. + Path.GetExtension(httpFile[0].FileName);
  548. string filePath = System.Web.HttpContext.Current.Server.MapPath("~\\File\\IQC\\" + fileName);
  549. if (System.IO.File.Exists(filePath))//删除文件
  550. {
  551. System.IO.File.Delete(filePath);
  552. }
  553. int iLen = httpFile[0].ContentLength;
  554. byte[] bData = new byte[iLen];
  555. httpFile[0].InputStream.Read(bData, 0, iLen);
  556. FileStream fs = new FileStream(filePath, FileMode.OpenOrCreate);
  557. fs.Write(bData, 0, bData.Length);
  558. fs.Flush();
  559. fs.Close();
  560. fs.Dispose();
  561. int count = app.UpLoadItemRuleFile(ID, fileName);
  562. if (count > 0)
  563. {
  564. return Success("上传成功!");
  565. }
  566. else
  567. {
  568. throw new Exception("");
  569. }
  570. }
  571. catch (Exception ex)
  572. {
  573. return Error(ex.Message);
  574. }
  575. }
  576. /// <summary>
  577. /// 检验异常文件
  578. /// </summary>
  579. /// <returns></returns>
  580. [HttpPost]
  581. public ActionResult UpLoadMaterialCheckExFile()
  582. {
  583. try
  584. {
  585. //获取上传的文件集合
  586. HttpFileCollection httpFile = System.Web.HttpContext.Current.Request.Files;
  587. //获取送货单号
  588. string ID = Request.Form["ID"].ToString();
  589. //string LableName = Request.Form["LableName"].ToString();
  590. string fileName = Path.GetFileNameWithoutExtension(httpFile[0].FileName)
  591. + Path.GetExtension(httpFile[0].FileName);
  592. string filePath = System.Web.HttpContext.Current.Server.MapPath("~\\File\\IQC\\" + fileName);
  593. if (System.IO.File.Exists(filePath))//删除文件
  594. {
  595. System.IO.File.Delete(filePath);
  596. }
  597. int iLen = httpFile[0].ContentLength;
  598. byte[] bData = new byte[iLen];
  599. httpFile[0].InputStream.Read(bData, 0, iLen);
  600. FileStream fs = new FileStream(filePath, FileMode.OpenOrCreate);
  601. fs.Write(bData, 0, bData.Length);
  602. fs.Flush();
  603. fs.Close();
  604. fs.Dispose();
  605. //int count = app.UpLoadItemRuleFile(ID, fileName);
  606. //if (count > 0)
  607. //{
  608. // return Success("上传成功!");
  609. //}
  610. //else
  611. //{
  612. // throw new Exception("");
  613. //}
  614. return Success("上传成功!");
  615. }
  616. catch (Exception ex)
  617. {
  618. return Error(ex.Message);
  619. }
  620. }
  621. [HttpPost]
  622. public ActionResult UpLoadFinalJudgeFile()
  623. {
  624. try
  625. {
  626. //获取上传的文件集合
  627. HttpFileCollection httpFile = System.Web.HttpContext.Current.Request.Files;
  628. //获取送货单号
  629. string ID = Request.Form["ID"].ToString();
  630. //string LableName = Request.Form["LableName"].ToString();
  631. string fileName = Path.GetFileNameWithoutExtension(httpFile[0].FileName)
  632. + Path.GetExtension(httpFile[0].FileName);
  633. string filePath = System.Web.HttpContext.Current.Server.MapPath("~\\File\\IQC\\" + fileName);
  634. if (System.IO.File.Exists(filePath))//删除文件
  635. {
  636. System.IO.File.Delete(filePath);
  637. }
  638. int iLen = httpFile[0].ContentLength;
  639. byte[] bData = new byte[iLen];
  640. httpFile[0].InputStream.Read(bData, 0, iLen);
  641. FileStream fs = new FileStream(filePath, FileMode.OpenOrCreate);
  642. fs.Write(bData, 0, bData.Length);
  643. fs.Flush();
  644. fs.Close();
  645. fs.Dispose();
  646. int count = app.UpLoadFinalJudgeFile(ID, fileName);
  647. if (count > 0)
  648. {
  649. return Success("上传成功!");
  650. }
  651. else
  652. {
  653. throw new Exception("");
  654. }
  655. }
  656. catch (Exception ex)
  657. {
  658. return Error(ex.Message);
  659. }
  660. }
  661. [HttpGet]
  662. public ActionResult GetItem2AqlFileList(string keyValue)
  663. {
  664. var dt = app.GetItem2AqlFileList(keyValue);
  665. return Content(dt.ToJson());
  666. }
  667. [HttpGet]
  668. public ActionResult GetMaterialCheckLog(string keyValue)
  669. {
  670. var dt = app.GetMaterialCheckLog(keyValue);
  671. return Content(dt.ToJson());
  672. }
  673. /// <summary>
  674. /// 删除物料规则文件
  675. /// </summary>
  676. /// <param name="keyValue"></param>
  677. /// <returns></returns>
  678. [HttpPost]
  679. public ActionResult DeleteItem2AqlFile(string keyValue)
  680. {
  681. var msg = app.DeleteItem2AqlFile(keyValue);
  682. if (!string.IsNullOrEmpty(msg))
  683. {
  684. return Error(msg);
  685. }
  686. else
  687. {
  688. return Success("操作成功!");
  689. }
  690. }
  691. /// <summary>
  692. /// 获取文件预览路径
  693. /// </summary>
  694. /// <param name="fileName"></param>
  695. /// <returns></returns>
  696. [HttpGet]
  697. public ActionResult GetItem2AqlFilePath(string fileName)
  698. {
  699. try
  700. {
  701. string fileServerPath = CommonHelper.GetBaseUrl(Request.Url)+ @"/File/IQC/"+ fileName;
  702. //string filePath = System.Web.HttpContext.Current.Server.MapPath("~\\File\\IQC\\" + fileName);
  703. return Success(fileServerPath);
  704. }
  705. catch (Exception ex)
  706. {
  707. return Error(ex.Message);
  708. }
  709. }
  710. /// <summary>
  711. /// 获取单个
  712. /// </summary>
  713. /// <param name="keyValue"></param>
  714. /// <returns></returns>
  715. [HttpGet]
  716. public ActionResult GetBadCodeGroup(string keyValue)
  717. {
  718. var dt = app.GetBadCodeGroup(keyValue);
  719. return Content(dt.ToJson());
  720. }
  721. /// <summary>
  722. /// 保存不良状态组
  723. /// </summary>
  724. /// <param name="keyValue"></param>
  725. /// <returns></returns>
  726. [HttpPost]
  727. public ActionResult SaveBadCodeGroup(string keyValue)
  728. {
  729. string msg = app.SaveBadCodeGroup(keyValue);
  730. if (!string.IsNullOrEmpty(msg))
  731. {
  732. return Error(msg);
  733. }
  734. else
  735. {
  736. return Success("操作成功!");
  737. }
  738. }
  739. /// <summary>
  740. /// 删除
  741. /// </summary>
  742. /// <param name="keyValue"></param>
  743. /// <returns></returns>
  744. [HttpPost]
  745. public ActionResult DeleteBadCodeGroup(string keyValue)
  746. {
  747. var msg = app.DeleteBadCodeGroup(keyValue);
  748. if (!string.IsNullOrEmpty(msg))
  749. {
  750. return Error(msg);
  751. }
  752. else
  753. {
  754. return Success("操作成功!");
  755. }
  756. }
  757. /// <summary>
  758. /// 导出列表
  759. /// </summary>
  760. /// <param name="pagination"></param>
  761. /// <param name="queryJson"></param>
  762. /// <returns></returns>
  763. [HttpPost]
  764. public void ExportAllBadCodeGroup(string BCGCode, string BCGDesc)
  765. {
  766. DataTable dt = app.ExportAllBadCodeGroup(BCGCode, BCGDesc);
  767. AsposeCell.Export(dt);
  768. }
  769. /// <summary>
  770. /// 查询不良现象组列表
  771. /// </summary>
  772. /// <param name="pagination"></param>
  773. /// <param name="queryJson"></param>
  774. /// <returns></returns>
  775. [HttpPost]
  776. public ActionResult GetBadReasonGroupPageList(Pagination pagination, string queryJson)
  777. {
  778. DataTable ListData = app.GetBadReasonGroupPageList(queryJson, ref pagination);
  779. var JsonData = new
  780. {
  781. total = pagination.total,
  782. page = pagination.page,
  783. records = pagination.records,
  784. rows = ListData,
  785. };
  786. return Content(JsonData.ToJson());
  787. }
  788. /// <summary>
  789. /// 查询不良现象列表
  790. /// </summary>
  791. /// <param name="id"></param>
  792. /// <param name="pagination"></param>
  793. /// <returns></returns>
  794. [HttpGet]
  795. public ActionResult GetBadReasonDetailList(string id, Pagination pagination)
  796. {
  797. DataTable ListData = app.GetBadReasonDetailList(id, ref pagination);
  798. var JsonData = new
  799. {
  800. total = 1,
  801. page = 1,
  802. records = 0,
  803. rows = ListData,
  804. };
  805. return Content(JsonData.ToJson());
  806. }
  807. /// <summary>
  808. /// 获取单个
  809. /// </summary>
  810. /// <param name="keyValue"></param>
  811. /// <returns></returns>
  812. [HttpGet]
  813. public ActionResult GetBadReasonGroup(string keyValue)
  814. {
  815. var dt = app.GetBadReasonGroup(keyValue);
  816. return Content(dt.ToJson());
  817. }
  818. /// <summary>
  819. /// 保存不良现象组
  820. /// </summary>
  821. /// <param name="keyValue"></param>
  822. /// <returns></returns>
  823. [HttpPost]
  824. public ActionResult SaveBadReasonGroup(string keyValue)
  825. {
  826. string msg = app.SaveBadReasonGroup(keyValue);
  827. if (!string.IsNullOrEmpty(msg))
  828. {
  829. return Error(msg);
  830. }
  831. else
  832. {
  833. return Success("操作成功!");
  834. }
  835. }
  836. /// <summary>
  837. /// 删除
  838. /// </summary>
  839. /// <param name="keyValue"></param>
  840. /// <returns></returns>
  841. [HttpPost]
  842. public ActionResult DeleteBadReasonGroup(string keyValue)
  843. {
  844. var msg = app.DeleteBadReasonGroup(keyValue);
  845. if (!string.IsNullOrEmpty(msg))
  846. {
  847. return Error(msg);
  848. }
  849. else
  850. {
  851. return Success("操作成功!");
  852. }
  853. }
  854. /// <summary>
  855. /// 导出列表
  856. /// </summary>
  857. /// <param name="pagination"></param>
  858. /// <param name="queryJson"></param>
  859. /// <returns></returns>
  860. [HttpPost]
  861. public void ExportAllBadReasonGroup(string BRGCode, string BRGDesc)
  862. {
  863. DataTable dt = app.ExportAllBadReasonGroup(BRGCode, BRGDesc);
  864. AsposeCell.Export(dt);
  865. }
  866. /// <summary>
  867. /// 获取单个
  868. /// </summary>
  869. /// <param name="keyValue"></param>
  870. /// <returns></returns>
  871. [HttpGet]
  872. public ActionResult GetCheckItemGroup(string keyValue)
  873. {
  874. var dt = app.GetCheckItemGroup(keyValue);
  875. return Content(dt.ToJson());
  876. }
  877. /// <summary>
  878. /// 保存检验类型
  879. /// </summary>
  880. /// <param name="keyValue"></param>
  881. /// <returns></returns>
  882. [HttpPost]
  883. public ActionResult SaveCheckItemGroup(string keyValue)
  884. {
  885. string msg = app.SaveCheckItemGroup(keyValue);
  886. if (!string.IsNullOrEmpty(msg))
  887. {
  888. return Error(msg);
  889. }
  890. else
  891. {
  892. return Success("操作成功!");
  893. }
  894. }
  895. /// <summary>
  896. /// 删除
  897. /// </summary>
  898. /// <param name="keyValue"></param>
  899. /// <returns></returns>
  900. [HttpPost]
  901. public ActionResult DeleteCheckItemGroup(string keyValue)
  902. {
  903. var msg = app.DeleteCheckItemGroup(keyValue);
  904. if (!string.IsNullOrEmpty(msg))
  905. {
  906. return Error(msg);
  907. }
  908. else
  909. {
  910. return Success("操作成功!");
  911. }
  912. }
  913. /// <summary>
  914. /// 导出列表
  915. /// </summary>
  916. /// <param name="pagination"></param>
  917. /// <param name="queryJson"></param>
  918. /// <returns></returns>
  919. [HttpPost]
  920. public void ExportAllCheckItemGroup(string GroupCode, string GroupName)
  921. {
  922. DataTable dt = app.ExportAllCheckItemGroup(GroupCode, GroupName);
  923. AsposeCell.Export(dt);
  924. }
  925. /// <summary>
  926. /// 导入列表
  927. /// </summary>
  928. /// <param name="pagination"></param>
  929. /// <param name="queryJson"></param>
  930. /// <returns></returns>
  931. [HttpPost]
  932. public string ImportCheckItem()
  933. {
  934. try
  935. {
  936. //string str_Year = Request.Form["txt_Year"];
  937. //String UPLoadType = Request.Form["UPLoadType"];
  938. HttpFileCollection hpFiles = System.Web.HttpContext.Current.Request.Files;
  939. if (hpFiles != null && hpFiles.Count > 0)
  940. {
  941. string IsXls = System.IO.Path.GetExtension(hpFiles[0].FileName).ToString().ToLower();//System.IO.Path.GetExtension获得文件的扩展名
  942. if (IsXls != ".xls" && IsXls != ".xlsx")
  943. {
  944. return "只可以选择Excel(.xls .xlsx)文件";//当选择的不是Excel文件时,返回
  945. }
  946. string filename = DateTime.Now.ToString("yyyyMMddhhmmss") + IsXls; //获取Execle文件名 DateTime日期函数
  947. string savePath = System.Web.HttpContext.Current.Server.MapPath("~\\File\\IQC\\" + filename);//Server.MapPath 获得虚拟服务器相对路径
  948. int iLen = hpFiles[0].ContentLength;
  949. if (Directory.Exists(savePath)) return "文件已存在";
  950. byte[] bData = new byte[iLen];
  951. hpFiles[0].InputStream.Read(bData, 0, iLen);
  952. FileStream newFile = new FileStream(savePath, FileMode.OpenOrCreate);
  953. newFile.Write(bData, 0, bData.Length);
  954. newFile.Flush();
  955. int _FileSizeTemp = hpFiles[0].ContentLength;
  956. newFile.Close();
  957. newFile.Dispose();
  958. //bool del = false;
  959. string mess = "";
  960. mess = app.ImportCheckItem(savePath);
  961. if (System.IO.File.Exists(savePath))//删除文件
  962. {
  963. System.IO.File.Delete(savePath);
  964. }
  965. return mess;
  966. }
  967. else
  968. {
  969. return "获取文件失败";
  970. }
  971. }
  972. catch (Exception ex)
  973. {
  974. return ex.ToString();
  975. }
  976. }
  977. /// <summary>
  978. /// 查询物料检验类型列表
  979. /// </summary>
  980. /// <param name="pagination"></param>
  981. /// <param name="queryJson"></param>
  982. /// <returns></returns>
  983. [HttpPost]
  984. public ActionResult GetItem2CheckItemPageList(Pagination pagination, string queryJson)
  985. {
  986. DataTable ListData = app.GetItem2CheckItemPageList(queryJson, ref pagination);
  987. var JsonData = new
  988. {
  989. total = pagination.total,
  990. page = pagination.page,
  991. records = pagination.records,
  992. rows = ListData,
  993. };
  994. return Content(JsonData.ToJson());
  995. }
  996. /// <summary>
  997. /// 保存物料检验类型
  998. /// </summary>
  999. /// <param name="keyValue"></param>
  1000. /// <returns></returns>
  1001. [HttpPost]
  1002. public ActionResult SaveItem2CheckItem(string keyValue)
  1003. {
  1004. string msg = app.SaveItem2CheckItem(keyValue);
  1005. if (!string.IsNullOrEmpty(msg))
  1006. {
  1007. return Error(msg);
  1008. }
  1009. else
  1010. {
  1011. return Success("操作成功!");
  1012. }
  1013. }
  1014. /// <summary>
  1015. /// 获取单个
  1016. /// </summary>
  1017. /// <param name="keyValue"></param>
  1018. /// <returns></returns>
  1019. [HttpGet]
  1020. public ActionResult GetItem2CheckItem(string keyValue)
  1021. {
  1022. var dt = app.GetItem2CheckItem(keyValue);
  1023. return Content(dt.ToJson());
  1024. }
  1025. /// <summary>
  1026. /// 保存物料检验类型
  1027. /// </summary>
  1028. /// <param name="keyValue"></param>
  1029. /// <returns></returns>
  1030. [HttpPost]
  1031. public ActionResult SaveItem2CheckItemSingle(string keyValue)
  1032. {
  1033. string msg = app.SaveItem2CheckItemSingle(keyValue);
  1034. if (!string.IsNullOrEmpty(msg))
  1035. {
  1036. return Error(msg);
  1037. }
  1038. else
  1039. {
  1040. return Success("操作成功!");
  1041. }
  1042. }
  1043. /// <summary>
  1044. /// 删除
  1045. /// </summary>
  1046. /// <param name="keyValue"></param>
  1047. /// <returns></returns>
  1048. [HttpPost]
  1049. public ActionResult DeleteItem2CheckItem(string keyValue)
  1050. {
  1051. var msg = app.DeleteItem2CheckItem(keyValue);
  1052. if (!string.IsNullOrEmpty(msg))
  1053. {
  1054. return Error(msg);
  1055. }
  1056. else
  1057. {
  1058. return Success("操作成功!");
  1059. }
  1060. }
  1061. /// <summary>
  1062. /// 导入列表
  1063. /// </summary>
  1064. /// <param name="pagination"></param>
  1065. /// <param name="queryJson"></param>
  1066. /// <returns></returns>
  1067. [HttpPost]
  1068. public string ImportItem2CheckGroup()
  1069. {
  1070. try
  1071. {
  1072. //string str_Year = Request.Form["txt_Year"];
  1073. //String UPLoadType = Request.Form["UPLoadType"];
  1074. HttpFileCollection hpFiles = System.Web.HttpContext.Current.Request.Files;
  1075. if (hpFiles != null && hpFiles.Count > 0)
  1076. {
  1077. string IsXls = System.IO.Path.GetExtension(hpFiles[0].FileName).ToString().ToLower();//System.IO.Path.GetExtension获得文件的扩展名
  1078. if (IsXls != ".xls" && IsXls != ".xlsx")
  1079. {
  1080. return "只可以选择Excel(.xls .xlsx)文件";//当选择的不是Excel文件时,返回
  1081. }
  1082. string filename = DateTime.Now.ToString("yyyyMMddhhmmss") + IsXls; //获取Execle文件名 DateTime日期函数
  1083. string savePath = System.Web.HttpContext.Current.Server.MapPath("~\\File\\IQC\\" + filename);//Server.MapPath 获得虚拟服务器相对路径
  1084. int iLen = hpFiles[0].ContentLength;
  1085. if (Directory.Exists(savePath)) return "文件已存在";
  1086. byte[] bData = new byte[iLen];
  1087. hpFiles[0].InputStream.Read(bData, 0, iLen);
  1088. FileStream newFile = new FileStream(savePath, FileMode.OpenOrCreate);
  1089. newFile.Write(bData, 0, bData.Length);
  1090. newFile.Flush();
  1091. int _FileSizeTemp = hpFiles[0].ContentLength;
  1092. newFile.Close();
  1093. newFile.Dispose();
  1094. //bool del = false;
  1095. string mess = "";
  1096. mess = app.ImportItem2CheckGroup(savePath);
  1097. if (System.IO.File.Exists(savePath))//删除文件
  1098. {
  1099. System.IO.File.Delete(savePath);
  1100. }
  1101. return mess;
  1102. }
  1103. else
  1104. {
  1105. return "获取文件失败";
  1106. }
  1107. }
  1108. catch (Exception ex)
  1109. {
  1110. return ex.ToString();
  1111. }
  1112. }
  1113. /// <summary>
  1114. /// 导出列表
  1115. /// </summary>
  1116. /// <param name="pagination"></param>
  1117. /// <param name="queryJson"></param>
  1118. /// <returns></returns>
  1119. [HttpPost]
  1120. public void ExportAllItem2CheckItem(string InvCode, string InvName,string ListCode, string ListName)
  1121. {
  1122. DataTable dt = app.ExportAllItem2CheckItem(InvCode, InvName, ListCode, ListName);
  1123. AsposeCell.Export(dt);
  1124. }
  1125. /// <summary>
  1126. /// 获取出货报告预览路径
  1127. /// </summary>
  1128. /// <param name="fileName"></param>
  1129. /// <returns></returns>
  1130. [HttpGet]
  1131. public ActionResult GetOutReportFilePath(string fileName)
  1132. {
  1133. try
  1134. {
  1135. //获取SRM虚拟路径
  1136. var baseUrl = ConfigurationManager.ConnectionStrings["SRMURL"].ConnectionString;
  1137. if (baseUrl.IsNullOrEmpty())
  1138. {
  1139. throw new Exception("没有维护SRM站点信息");
  1140. }
  1141. //fileName F:\桌面\Git\基础版\SRM\NFine.Web\File\VendorFile\01000000\DN0100000024000010101000001202406050001\222.txt
  1142. string fileServerPath = baseUrl+@"/"+ fileName.Substring( fileName.IndexOf("File"));
  1143. fileServerPath = fileServerPath.Replace(@"\", @"/");
  1144. //string filePath = System.Web.HttpContext.Current.Server.MapPath("~\\File\\IQC\\" + fileName);
  1145. return Success(fileServerPath);
  1146. }
  1147. catch (Exception ex)
  1148. {
  1149. return Error(ex.Message);
  1150. }
  1151. }
  1152. /// <summary>
  1153. /// 获取异常预览路径
  1154. /// </summary>
  1155. /// <param name="fileName"></param>
  1156. /// <returns></returns>
  1157. [HttpGet]
  1158. public ActionResult GetMaterialExFilePath(string fileName)
  1159. {
  1160. try
  1161. {
  1162. //获取SRM虚拟路径
  1163. //var baseUrl = ConfigurationManager.ConnectionStrings["SRMURL"].ConnectionString;
  1164. //if (baseUrl.IsNullOrEmpty())
  1165. //{
  1166. // throw new Exception("没有维护SRM站点信息");
  1167. //}
  1168. //fileName F:\桌面\Git\基础版\SRM\NFine.Web\File\VendorFile\01000000\DN0100000024000010101000001202406050001\222.txt
  1169. var baseUrl = new StringBuilder()
  1170. .Append(Request.Url.Scheme)
  1171. .Append("://")
  1172. .Append(Request.Url.Host)
  1173. .Append(":")
  1174. .Append(Request.Url.Port)
  1175. .ToString();
  1176. //string fileServerPath = baseUrl + @"/" + fileName.Substring(fileName.IndexOf("File"));
  1177. //fileServerPath = fileServerPath.Replace(@"\", @"/");
  1178. // string filePath = System.Web.HttpContext.Current.Server.MapPath("~\\File\\IQC\\" + fileName);
  1179. string filePath = baseUrl+ @"/File/IQC/"+ fileName;
  1180. return Success(filePath);
  1181. }
  1182. catch (Exception ex)
  1183. {
  1184. return Error(ex.Message);
  1185. }
  1186. }
  1187. /// <summary>
  1188. /// 查询来料送检列表
  1189. /// </summary>
  1190. /// <param name="pagination"></param>
  1191. /// <param name="queryJson"></param>
  1192. /// <returns></returns>
  1193. [HttpPost]
  1194. public ActionResult GetMaterialInStorageCheckPageList(Pagination pagination, string queryJson)
  1195. {
  1196. DataTable ListData = app.GetMaterialInStorageCheckPageList(queryJson, ref pagination);
  1197. var JsonData = new
  1198. {
  1199. total = pagination.total,
  1200. page = pagination.page,
  1201. records = pagination.records,
  1202. rows = ListData,
  1203. };
  1204. return Content(JsonData.ToJson());
  1205. }
  1206. /// <summary>
  1207. /// 查询成品来料送检列表
  1208. /// </summary>
  1209. /// <param name="pagination"></param>
  1210. /// <param name="queryJson"></param>
  1211. /// <returns></returns>
  1212. [HttpPost]
  1213. public ActionResult GetCPMaterialInStorageCheckPageList(Pagination pagination, string queryJson)
  1214. {
  1215. DataTable ListData = app.GetCPMaterialInStorageCheckPageList(queryJson, ref pagination);
  1216. var JsonData = new
  1217. {
  1218. total = pagination.total,
  1219. page = pagination.page,
  1220. records = pagination.records,
  1221. rows = ListData,
  1222. };
  1223. return Content(JsonData.ToJson());
  1224. }
  1225. /// <summary>
  1226. /// 查询来料检验明细
  1227. /// </summary>
  1228. /// <param name="id"></param>
  1229. /// <param name="pagination"></param>
  1230. /// <returns></returns>
  1231. [HttpGet]
  1232. public ActionResult GetMaterialInStorageCheckDetailList(string code,string lotno, string InvCode,Pagination pagination)
  1233. {
  1234. DataTable ListData = app.GetMaterialInStorageCheckDetailList(code, lotno, InvCode, ref pagination);
  1235. var JsonData = new
  1236. {
  1237. total = 1,
  1238. page = 1,
  1239. records = 0,
  1240. rows = ListData,
  1241. };
  1242. return Content(JsonData.ToJson());
  1243. }
  1244. /// <summary>
  1245. /// 成品查询来料检验明细
  1246. /// </summary>
  1247. /// <param name="id"></param>
  1248. /// <param name="pagination"></param>
  1249. /// <returns></returns>
  1250. [HttpGet]
  1251. public ActionResult GetCPMaterialInStorageCheckDetailList(string code, string invBatcgNo, string InvCode, Pagination pagination)
  1252. {
  1253. DataTable ListData = app.GetCPMaterialInStorageCheckDetailList(code, invBatcgNo, InvCode, ref pagination);
  1254. var JsonData = new
  1255. {
  1256. total = 1,
  1257. page = 1,
  1258. records = 0,
  1259. rows = ListData,
  1260. };
  1261. return Content(JsonData.ToJson());
  1262. }
  1263. /// <summary>
  1264. /// 导出列表
  1265. /// </summary>
  1266. /// <param name="pagination"></param>
  1267. /// <param name="queryJson"></param>
  1268. /// <returns></returns>
  1269. [HttpPost]
  1270. public void ExportAllMaterialInStorageCheck(string InvCode,string InvName, string StartDate, string EndDate, string IsCheck,string CheckStartDate,string CheckEndDate)
  1271. {
  1272. //return;
  1273. DataTable dt = app.ExportAllMaterialInStorageCheck(InvCode, InvName, IsCheck, StartDate, EndDate, CheckStartDate, CheckEndDate);
  1274. AsposeCell.Export(dt);
  1275. }
  1276. /// <summary>
  1277. /// 成品导出列表
  1278. /// </summary>
  1279. /// <param name="pagination"></param>
  1280. /// <param name="queryJson"></param>
  1281. /// <returns></returns>
  1282. [HttpPost]
  1283. public void ExportAllCPMaterialInStorageCheck(string InvCode, string InvName, string StartDate, string EndDate, string IsCheck, string CheckStartDate, string CheckEndDate, string CheckCode,string InvBatcgNo)
  1284. {
  1285. //return;
  1286. DataTable dt = app.ExportAllCPMaterialInStorageCheck(InvCode, InvName, IsCheck, StartDate, EndDate, CheckStartDate, CheckEndDate, CheckCode, InvBatcgNo);
  1287. AsposeCell.Export(dt);
  1288. }
  1289. /// <summary>
  1290. /// 导出列表
  1291. /// </summary>
  1292. /// <param name="pagination"></param>
  1293. /// <param name="queryJson"></param>
  1294. /// <returns></returns>
  1295. [HttpPost]
  1296. public void ExportMaterialInStorageFinalList(string InvCode, string InvName, string StartDate, string EndDate, string ASNCode, string VenCode, string VenName
  1297. , string InvBatcgNo, string IsCheckComplete, string JuegeProgess, string BcgCode)
  1298. {
  1299. //return;
  1300. DataTable dt = app.ExportMaterialInStorageFinalList(InvCode, InvName, IsCheckComplete, StartDate, EndDate, ASNCode, VenCode, VenName, InvBatcgNo, JuegeProgess, BcgCode);
  1301. AsposeCell.Export(dt);
  1302. }
  1303. /// <summary>
  1304. /// 查询破坏性实验记录
  1305. /// </summary>
  1306. /// <param name="id"></param>
  1307. /// <param name="pagination"></param>
  1308. /// <returns></returns>
  1309. [HttpGet]
  1310. public ActionResult GetMaterialInStorageCheckDetailList2(string code, string lotno,string invCode)
  1311. {
  1312. Pagination pagination = null;
  1313. DataTable ListData = app.GetMaterialInStorageCheckDetailList(code, lotno, invCode, ref pagination);
  1314. //var JsonData = new
  1315. //{
  1316. // total = 1,
  1317. // page = 1,
  1318. // records = 0,
  1319. // rows = ListData,
  1320. //};
  1321. return Content(ListData.ToJson());
  1322. }
  1323. /// <summary>
  1324. /// 查询破坏性实验记录
  1325. /// </summary>
  1326. /// <param name="id"></param>
  1327. /// <param name="pagination"></param>
  1328. /// <returns></returns>
  1329. [HttpGet]
  1330. public ActionResult GetCPMaterialInStorageCheckDetailList2(string code, string lotno, string invCode)
  1331. {
  1332. Pagination pagination = null;
  1333. DataTable ListData = app.GetCPMaterialInStorageCheckDetailList(code, lotno, invCode, ref pagination);
  1334. //var JsonData = new
  1335. //{
  1336. // total = 1,
  1337. // page = 1,
  1338. // records = 0,
  1339. // rows = ListData,
  1340. //};
  1341. return Content(ListData.ToJson());
  1342. }
  1343. /// <summary>
  1344. /// 来料检验加急
  1345. /// </summary>
  1346. /// <param name="keyValue"></param>
  1347. /// <returns></returns>
  1348. [HttpPost]
  1349. public ActionResult UpdateUrgent(string keyValue)
  1350. {
  1351. string msg = app.UpdateUrgent(keyValue);
  1352. if (!string.IsNullOrEmpty(msg))
  1353. {
  1354. return Error(msg);
  1355. }
  1356. else
  1357. {
  1358. return Success("操作成功!");
  1359. }
  1360. }
  1361. /// <summary>
  1362. /// 删除
  1363. /// </summary>
  1364. /// <param name="keyValue"></param>
  1365. /// <returns></returns>
  1366. [HttpPost]
  1367. public ActionResult DeleteMatCheck(string keyValue)
  1368. {
  1369. var msg = app.DeleteMatCheck(keyValue);
  1370. if (!string.IsNullOrEmpty(msg))
  1371. {
  1372. return Error(msg);
  1373. }
  1374. else
  1375. {
  1376. return Success("操作成功!");
  1377. }
  1378. }
  1379. /// <summary>
  1380. /// 仓库已退实物
  1381. /// </summary>
  1382. /// <param name="keyValue"></param>
  1383. /// <returns></returns>
  1384. [HttpPost]
  1385. public ActionResult UpdateMaterialHasReturnItem(string keyValue)
  1386. {
  1387. string msg = app.UpdateMaterialHasReturnItem(keyValue);
  1388. if (!string.IsNullOrEmpty(msg))
  1389. {
  1390. return Error(msg);
  1391. }
  1392. else
  1393. {
  1394. return Success("操作成功!");
  1395. }
  1396. }
  1397. /// <summary>
  1398. /// 复盘加急
  1399. /// </summary>
  1400. /// <param name="keyValue"></param>
  1401. /// <returns></returns>
  1402. [HttpPost]
  1403. public ActionResult UpdateMaterialReUrgent(string keyValue)
  1404. {
  1405. string msg = app.UpdateMaterialReUrgent(keyValue);
  1406. if (!string.IsNullOrEmpty(msg))
  1407. {
  1408. return Error(msg);
  1409. }
  1410. else
  1411. {
  1412. return Success("操作成功!");
  1413. }
  1414. }
  1415. /// <summary>
  1416. ///
  1417. /// </summary>
  1418. /// <param name="keyValue"></param>
  1419. /// <returns></returns>
  1420. [HttpPost]
  1421. public ActionResult IQC1Back(string keyValue)
  1422. {
  1423. string msg = app.IQC1Back(keyValue);
  1424. if (!string.IsNullOrEmpty(msg))
  1425. {
  1426. return Error(msg);
  1427. }
  1428. else
  1429. {
  1430. return Success("操作成功!");
  1431. }
  1432. }
  1433. /// <summary>
  1434. /// 获取单个
  1435. /// </summary>
  1436. /// <param name="keyValue"></param>
  1437. /// <returns></returns>
  1438. [HttpGet]
  1439. public ActionResult GetMaterialCheckMain(string keyValue)
  1440. {
  1441. var dt = app.GetMaterialCheckMain(keyValue);
  1442. return Content(dt.ToJson());
  1443. }
  1444. /// <summary>
  1445. /// 获取单个
  1446. /// </summary>
  1447. /// <param name="keyValue"></param>
  1448. /// <returns></returns>
  1449. [HttpGet]
  1450. public ActionResult GetMaterialCheckMain2(string keyValue,decimal qty)
  1451. {
  1452. var dt = app.GetMaterialCheckMain2(keyValue, qty);
  1453. return Content(dt.ToJson());
  1454. }
  1455. /// <summary>
  1456. /// 获取单个成品检验
  1457. /// </summary>
  1458. /// <param name="keyValue"></param>
  1459. /// <returns></returns>
  1460. [HttpGet]
  1461. public ActionResult GetCPMaterialCheckMain2(string keyValue, decimal qty)
  1462. {
  1463. var dt = app.GetCPMaterialCheckMain2(keyValue, qty);
  1464. return Content(dt.ToJson());
  1465. }
  1466. /// <summary>
  1467. /// 获取尺寸检验项目
  1468. /// </summary>
  1469. /// <param name="keyValue"></param>
  1470. /// <returns></returns>
  1471. [HttpGet]
  1472. public ActionResult GetMaterialCheckMain4CC(string keyValue)
  1473. {
  1474. var dt = app.GetMaterialCheckMain4CC(keyValue);
  1475. return Content(dt.ToJson());
  1476. }
  1477. /// <summary>
  1478. /// 获取尺寸检验项目
  1479. /// </summary>
  1480. /// <param name="keyValue"></param>
  1481. /// <returns></returns>
  1482. [HttpGet]
  1483. public ActionResult GetCPMaterialCheckMain4CC(string keyValue)
  1484. {
  1485. var dt = app.GetCPMaterialCheckMain4CC(keyValue);
  1486. return Content(dt.ToJson());
  1487. }
  1488. /// <summary>
  1489. /// 获取外观检验项目
  1490. /// </summary>
  1491. /// <param name="keyValue"></param>
  1492. /// <returns></returns>
  1493. [HttpGet]
  1494. public ActionResult GetMaterialCheckMain4WG(string keyValue)
  1495. {
  1496. var dt = app.GetMaterialCheckMain4WG(keyValue);
  1497. return Content(dt.ToJson());
  1498. }
  1499. /// <summary>
  1500. /// 获取性能检验项目
  1501. /// </summary>
  1502. /// <param name="keyValue"></param>
  1503. /// <returns></returns>
  1504. [HttpGet]
  1505. public ActionResult GetMaterialCheckMain4XN(string keyValue)
  1506. {
  1507. var dt = app.GetMaterialCheckMain4XN(keyValue);
  1508. return Content(dt.ToJson());
  1509. }
  1510. /// <summary>
  1511. /// 保存来料检验
  1512. /// </summary>
  1513. /// <param name="keyValue"></param>
  1514. /// <returns></returns>
  1515. [HttpPost]
  1516. public ActionResult SaveMaterialCheckResult(string keyValue)
  1517. {
  1518. string msg = app.SaveMaterialCheckResult(keyValue);
  1519. if (!string.IsNullOrEmpty(msg))
  1520. {
  1521. return Error(msg);
  1522. }
  1523. else
  1524. {
  1525. return Success("操作成功!");
  1526. }
  1527. }
  1528. /// <summary>
  1529. /// 保存成品来料检验
  1530. /// </summary>
  1531. /// <param name="keyValue"></param>
  1532. /// <returns></returns>
  1533. [HttpPost]
  1534. public ActionResult SaveCPMaterialCheckResult(string keyValue)
  1535. {
  1536. string msg = app.SaveCPMaterialCheckResult(keyValue);
  1537. if (!string.IsNullOrEmpty(msg))
  1538. {
  1539. return Error(msg);
  1540. }
  1541. else
  1542. {
  1543. return Success("操作成功!");
  1544. }
  1545. }
  1546. /// <summary>
  1547. /// 查询来料复判列表
  1548. /// </summary>
  1549. /// <param name="pagination"></param>
  1550. /// <param name="queryJson"></param>
  1551. /// <returns></returns>
  1552. [HttpPost]
  1553. public ActionResult GetMaterialInStorageFinalPageList(Pagination pagination, string queryJson)
  1554. {
  1555. DataTable ListData = app.GetMaterialInStorageFinalPageList(queryJson, ref pagination);
  1556. var JsonData = new
  1557. {
  1558. total = pagination.total,
  1559. page = pagination.page,
  1560. records = pagination.records,
  1561. rows = ListData,
  1562. };
  1563. return Content(JsonData.ToJson());
  1564. }
  1565. /// <summary>
  1566. /// 查询成品来料复判列表
  1567. /// </summary>
  1568. /// <param name="pagination"></param>
  1569. /// <param name="queryJson"></param>
  1570. /// <returns></returns>
  1571. [HttpPost]
  1572. public ActionResult GetCPMaterialInStorageFinalPageList(Pagination pagination, string queryJson)
  1573. {
  1574. DataTable ListData = app.GetCPMaterialInStorageFinalPageList(queryJson, ref pagination);
  1575. var JsonData = new
  1576. {
  1577. total = pagination.total,
  1578. page = pagination.page,
  1579. records = pagination.records,
  1580. rows = ListData,
  1581. };
  1582. return Content(JsonData.ToJson());
  1583. }
  1584. /// <summary>
  1585. /// 获取单个复判表头
  1586. /// </summary>
  1587. /// <param name="keyValue"></param>
  1588. /// <returns></returns>
  1589. [HttpGet]
  1590. public ActionResult GetMaterialReJudgeMain(string keyValue)
  1591. {
  1592. var dt = app.GetMaterialReJudgeMain(keyValue);
  1593. return Content(dt.ToJson());
  1594. }
  1595. /// <summary>
  1596. /// 保存复判结果
  1597. /// </summary>
  1598. /// <param name="keyValue"></param>
  1599. /// <returns></returns>
  1600. [HttpPost]
  1601. public ActionResult SaveMaterialCheckReJudgeResult(string keyValue)
  1602. {
  1603. string msg = app.SaveMaterialCheckReJudgeResult(keyValue);
  1604. if (!string.IsNullOrEmpty(msg))
  1605. {
  1606. return Error(msg);
  1607. }
  1608. else
  1609. {
  1610. return Success("操作成功!");
  1611. }
  1612. }
  1613. /// <summary>
  1614. /// 保存最终复判结果
  1615. /// </summary>
  1616. /// <param name="keyValue"></param>
  1617. /// <returns></returns>
  1618. [HttpPost]
  1619. public ActionResult SaveMaterialCheckFinalJudgeResult(string keyValue)
  1620. {
  1621. string msg = app.SaveMaterialCheckFinalJudgeResult(keyValue);
  1622. if (!string.IsNullOrEmpty(msg))
  1623. {
  1624. return Error(msg);
  1625. }
  1626. else
  1627. {
  1628. return Success("操作成功!");
  1629. }
  1630. }
  1631. /// <summary>
  1632. /// 获取所有不良状态
  1633. /// </summary>
  1634. /// <param name="keyValue"></param>
  1635. /// <returns></returns>
  1636. [HttpGet]
  1637. public ActionResult GetSelectBadCodeGroupList()
  1638. {
  1639. var dt = app.GetSelectBadCodeGroupList();
  1640. return Content(dt.ToJson());
  1641. }
  1642. /// <summary>
  1643. /// 获取所有不良现象
  1644. /// </summary>
  1645. /// <param name="keyValue"></param>
  1646. /// <returns></returns>
  1647. [HttpGet]
  1648. public ActionResult GetSelectBadReasonGroupList()
  1649. {
  1650. var dt = app.GetSelectBadReasonGroupList();
  1651. return Content(dt.ToJson());
  1652. }
  1653. /// <summary>
  1654. /// 获取不良现象明细
  1655. /// </summary>
  1656. /// <param name="keyValue"></param>
  1657. /// <returns></returns>
  1658. [HttpGet]
  1659. public ActionResult GetSelectBadReasonList(string keyValue)
  1660. {
  1661. var dt = app.GetSelectBadReasonList(keyValue);
  1662. return Content(dt.ToJson());
  1663. }
  1664. /// <summary>
  1665. /// 获取自定义档案列表
  1666. /// </summary>
  1667. /// <param name="keyValue"></param>
  1668. /// <returns></returns>
  1669. [HttpGet]
  1670. public ActionResult GetSelectItemList(string keyValue)
  1671. {
  1672. var dt = app.GetSelectItemList(keyValue);
  1673. return Content(dt.ToJson());
  1674. }
  1675. [HttpGet]
  1676. public ActionResult GetVendorFileList(string keyValue,string InvCode,string BatchCode)
  1677. {
  1678. var dt = app.GetVendorFileList(keyValue, InvCode, BatchCode);
  1679. return Content(dt.ToJson());
  1680. }
  1681. /// <summary>
  1682. /// 获取文件预览路径
  1683. /// </summary>
  1684. /// <param name="fileName"></param>
  1685. /// <returns></returns>
  1686. [HttpGet]
  1687. public ActionResult GetVendorFilePath(string fileName)
  1688. {
  1689. try
  1690. {
  1691. string customUrl = "http://192.168.5.181:8081";
  1692. // 使用自定义URL或默认Request.Url
  1693. Uri baseUrl = string.IsNullOrEmpty(customUrl)
  1694. ? Request.Url
  1695. : new Uri(customUrl);
  1696. string fileServerPath = CommonHelper.GetBaseUrl(baseUrl) + @"/File/IQC/" + fileName;
  1697. //string filePath = System.Web.HttpContext.Current.Server.MapPath("~\\File\\IQC\\" + fileName);
  1698. return Success(fileServerPath);
  1699. }
  1700. catch (Exception ex)
  1701. {
  1702. return Error(ex.Message);
  1703. }
  1704. }
  1705. [HttpPost]
  1706. public ActionResult UpLoadLabelFile(string id, string batchCode)
  1707. {
  1708. try
  1709. {
  1710. //获取上传的文件集合
  1711. HttpFileCollection httpFile = System.Web.HttpContext.Current.Request.Files;
  1712. //获取送货单号
  1713. //string ID = Request.Form["ID"].ToString();
  1714. //string LableName = Request.Form["LableName"].ToString();
  1715. string fileName = Path.GetFileNameWithoutExtension(httpFile[0].FileName)+"_"+id + Path.GetExtension(httpFile[0].FileName);
  1716. string filePath = System.Web.HttpContext.Current.Server.MapPath("~\\File\\InspectionFile\\" + fileName);
  1717. int iLen = httpFile[0].ContentLength;
  1718. byte[] bData = new byte[iLen];
  1719. httpFile[0].InputStream.Read(bData, 0, iLen);
  1720. FileStream fs = new FileStream(filePath, FileMode.OpenOrCreate);
  1721. fs.Write(bData, 0, bData.Length);
  1722. fs.Flush();
  1723. fs.Close();
  1724. fs.Dispose();
  1725. app.InsertICSInspectionFile(id, fileName, fileName, batchCode);
  1726. return Success("上传成功!");
  1727. }
  1728. catch (Exception ex)
  1729. {
  1730. return Error("上传失败"+ex.Message);
  1731. }
  1732. }
  1733. [HttpGet]
  1734. public ActionResult GetInspectionFile(Pagination pagination,string id,string batchCode)
  1735. {
  1736. DataTable ListData = app.GetInspectionFile(ref pagination,id,batchCode);
  1737. var JsonData = new
  1738. {
  1739. total = pagination.total,
  1740. page = pagination.page,
  1741. records = pagination.records,
  1742. rows = ListData,
  1743. };
  1744. return Content(JsonData.ToJson());
  1745. }
  1746. }
  1747. }