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.

505 lines
15 KiB

3 weeks ago
  1. using NFine.Application.PNWMS;
  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.PNWMS.Controllers
  16. {
  17. public class BlitemController : ControllerBase
  18. {
  19. BlitemApp App = new BlitemApp();
  20. // GET: WMS/Blitem
  21. public ActionResult BlitemList()
  22. {
  23. return View();
  24. }
  25. public ActionResult From()
  26. {
  27. return View();
  28. }
  29. public ActionResult SeachInventory()
  30. {
  31. return View();
  32. }
  33. public ActionResult SeachLocation()
  34. {
  35. return View();
  36. }
  37. public ActionResult BlitemListApprove()
  38. {
  39. return View();
  40. }
  41. public ActionResult ICSCheckAdd()
  42. {
  43. return View();
  44. }
  45. public ActionResult GetHierarchy()
  46. {
  47. return View();
  48. }
  49. public ActionResult ICSInvCheckAdd()
  50. {
  51. return View();
  52. }
  53. [HttpGet]
  54. [HandlerAjaxOnly]
  55. public ActionResult GetGridJson(Pagination pagination, string queryJson)
  56. {
  57. DataTable ListData = App.GetGridJson(queryJson, ref pagination);
  58. var JsonData = new
  59. {
  60. total = pagination.total,
  61. page = pagination.page,
  62. records = pagination.records,
  63. rows = ListData,
  64. };
  65. return Content(JsonData.ToJson());
  66. }
  67. [HttpGet]
  68. [HandlerAjaxOnly]
  69. public ActionResult GetGridJsonForIntermediate(Pagination pagination, string queryJson)
  70. {
  71. DataTable ListData = App.GetGridJsonForIntermediate(queryJson, ref pagination);
  72. var JsonData = new
  73. {
  74. total = pagination.total,
  75. page = pagination.page,
  76. records = pagination.records,
  77. rows = ListData,
  78. };
  79. return Content(JsonData.ToJson());
  80. }
  81. [HttpGet]
  82. [HandlerAjaxOnly]
  83. public ActionResult GetSubGridJsonForIntermediate(string ID, string Inventory, string InvCode, Pagination pagination)
  84. {
  85. DataTable ListData = App.GetSubGridJsonForIntermediate(ID, Inventory, InvCode, ref pagination);
  86. var JsonData = new
  87. {
  88. total = pagination.total,
  89. page = pagination.page,
  90. records = pagination.records,
  91. rows = ListData,
  92. };
  93. return Content(JsonData.ToJson());
  94. }
  95. [HttpGet]
  96. [HandlerAjaxOnly]
  97. public ActionResult GetGridJsonForApprove(Pagination pagination, string queryJson)
  98. {
  99. DataTable ListData = App.GetGridJsonForApprove(queryJson, ref pagination);
  100. var JsonData = new
  101. {
  102. total = pagination.total,
  103. page = pagination.page,
  104. records = pagination.records,
  105. rows = ListData,
  106. };
  107. return Content(JsonData.ToJson());
  108. }
  109. [HttpGet]
  110. [HandlerAjaxOnly]
  111. public ActionResult GetSubGridJson(string ID, string Inventory,string InvCode, Pagination pagination)
  112. {
  113. DataTable ListData = App.GetSubGridJson(ID, Inventory, InvCode,ref pagination);
  114. var JsonData = new
  115. {
  116. total = pagination.total,
  117. page = pagination.page,
  118. records = pagination.records,
  119. rows = ListData,
  120. };
  121. return Content(JsonData.ToJson());
  122. }
  123. public ActionResult DeleteICSCheckDetail(string ID)
  124. {
  125. //keyValue = keyValue.Substring(1, keyValue.Length - 2);
  126. //WorkPoint = WorkPoint.Substring(1, WorkPoint.Length - 2);
  127. string msg = App.DeleteICSCheckDetail(ID);
  128. if (string.IsNullOrWhiteSpace(msg))
  129. {
  130. return Success("删除成功!");
  131. }
  132. else
  133. {
  134. return Error(msg);
  135. }
  136. }
  137. //获取仓库
  138. public ActionResult GetWHCode()
  139. {
  140. DataTable dt = App.GetWHCode();
  141. return Content(dt.ToJson());
  142. }
  143. public ActionResult GetQU(string WHCodeID)
  144. {
  145. DataTable dt = App.GetQU(WHCodeID);
  146. return Content(dt.ToJson());
  147. }
  148. //[HttpGet]
  149. //public ActionResult GetQU(string WHCodeID)
  150. //{
  151. // try
  152. // {
  153. // DataTable data = App.GetQU(WHCodeID);
  154. // return Content(data.ToJson());
  155. // }
  156. // catch (Exception ex)
  157. // {
  158. // return Error(ex.ToString());
  159. // }
  160. //}
  161. public ActionResult GetPai(string WHCodeID, string Qu)
  162. {
  163. DataTable dt = App.GetPai(WHCodeID, Qu);
  164. return Content(dt.ToJson());
  165. }
  166. public ActionResult GetHuoJia(string WHCodeID, string Qu, string Pai)
  167. {
  168. DataTable dt = App.GetHuoJia(WHCodeID, Qu, Pai);
  169. return Content(dt.ToJson());
  170. }
  171. public ActionResult GetCeng(string WHCodeID, string Qu, string Pai, string HuoJia)
  172. {
  173. DataTable dt = App.GetCeng(WHCodeID, Qu, Pai, HuoJia);
  174. return Content(dt.ToJson());
  175. }
  176. public ActionResult GetGe(string WHCodeID, string Qu, string Pai, string HuoJia, string Ceng)
  177. {
  178. DataTable dt = App.GetGe(WHCodeID, Qu, Pai, HuoJia, Ceng);
  179. return Content(dt.ToJson());
  180. }
  181. [HttpPost]
  182. [HandlerAjaxOnly]
  183. public ActionResult AddICSCheck(string Parameter)
  184. {
  185. string msg = App.AddICSCheck(Parameter);
  186. if (!string.IsNullOrEmpty(msg))
  187. {
  188. return Error(msg);
  189. }
  190. else
  191. {
  192. return Success("添加成功!");
  193. }
  194. }
  195. [HttpPost]
  196. [HandlerAjaxOnly]
  197. [ValidateAntiForgeryToken]
  198. public ActionResult DeleteICSCheck(string keyValue)
  199. {
  200. string msg = App.DeleteICSCheck(keyValue);
  201. if (string.IsNullOrEmpty(msg))
  202. {
  203. return Success("删除成功!");
  204. }
  205. else
  206. {
  207. return Error(msg);
  208. }
  209. }
  210. [HttpGet]
  211. [HandlerAjaxOnly]
  212. public ActionResult GetGridJsonWarehouse(Pagination pagination, string queryJson)
  213. {
  214. DataTable ListData = App.GetGridJsonWarehouse(queryJson, ref pagination);
  215. var JsonData = new
  216. {
  217. total = pagination.total,
  218. page = pagination.page,
  219. records = pagination.records,
  220. rows = ListData,
  221. };
  222. return Content(JsonData.ToJson());
  223. }
  224. [HttpGet]
  225. [HandlerAjaxOnly]
  226. public ActionResult GetSubGridJsonRegion(string ID, Pagination pagination)
  227. {
  228. DataTable ListData = App.GetSubGridJsonRegion(ID, ref pagination);
  229. var JsonData = new
  230. {
  231. total = pagination.total,
  232. page = pagination.page,
  233. records = pagination.records,
  234. rows = ListData,
  235. };
  236. return Content(JsonData.ToJson());
  237. }
  238. [HttpGet]
  239. [HandlerAjaxOnly]
  240. public ActionResult GetSubGridJsonRow(string WHID, string Region, Pagination pagination)
  241. {
  242. DataTable ListData = App.GetSubGridJsonRow(WHID, Region, ref pagination);
  243. var JsonData = new
  244. {
  245. total = pagination.total,
  246. page = pagination.page,
  247. records = pagination.records,
  248. rows = ListData,
  249. };
  250. return Content(JsonData.ToJson());
  251. }
  252. [HttpGet]
  253. [HandlerAjaxOnly]
  254. public ActionResult GetSubGridJsonGoodsShelf(string WHID, string Region, string Row, Pagination pagination)
  255. {
  256. DataTable ListData = App.GetSubGridJsonGoodsShelf(WHID, Region, Row, ref pagination);
  257. var JsonData = new
  258. {
  259. total = pagination.total,
  260. page = pagination.page,
  261. records = pagination.records,
  262. rows = ListData,
  263. };
  264. return Content(JsonData.ToJson());
  265. }
  266. [HttpGet]
  267. [HandlerAjaxOnly]
  268. public ActionResult GetSubGridJsonTier(string WHID, string Region, string Row, string GoodsShelf, Pagination pagination)
  269. {
  270. DataTable ListData = App.GetSubGridJsonTier(WHID, Region, Row, GoodsShelf, ref pagination);
  271. var JsonData = new
  272. {
  273. total = pagination.total,
  274. page = pagination.page,
  275. records = pagination.records,
  276. rows = ListData,
  277. };
  278. return Content(JsonData.ToJson());
  279. }
  280. [HttpGet]
  281. [HandlerAjaxOnly]
  282. public ActionResult GetSubGridJsonGrid(string WHID, string Region, string Row, string GoodsShelf, string Tier, Pagination pagination)
  283. {
  284. DataTable ListData = App.GetSubGridJsonGrid(WHID, Region, Row, GoodsShelf, Tier, ref pagination);
  285. var JsonData = new
  286. {
  287. total = pagination.total,
  288. page = pagination.page,
  289. records = pagination.records,
  290. rows = ListData,
  291. };
  292. return Content(JsonData.ToJson());
  293. }
  294. [HttpPost]
  295. public void StatementExportAll(string ID,string Inventory,string InvCode)
  296. {
  297. //ID = ID.Substring(0, ID.Length - 2);
  298. DataTable dt = App.StatementExportAll(ID, Inventory, InvCode);
  299. AsposeCell.Export(dt);
  300. }
  301. /// <summary>
  302. /// 盘点审核界面按单据导出
  303. /// </summary>
  304. /// <param name="ID"></param>
  305. /// <param name="Inventory"></param>
  306. /// <param name="InvCode"></param>
  307. [HttpPost]
  308. public void StatementExportAllByDoc(string ID, string Inventory, string InvCode)
  309. {
  310. //ID = ID.Substring(0, ID.Length - 2);
  311. DataTable dt = App.StatementExportAllByDoc(ID, Inventory, InvCode);
  312. AsposeCell.Export(dt);
  313. }
  314. /// <summary>
  315. /// 盘点审核界面按条码导出
  316. /// </summary>
  317. /// <param name="ID"></param>
  318. /// <param name="Inventory"></param>
  319. /// <param name="InvCode"></param>
  320. [HttpPost]
  321. public void StatementExportAllByLot(string ID, string Inventory, string InvCode)
  322. {
  323. //ID = ID.Substring(0, ID.Length - 2);
  324. DataTable dt = App.StatementExportAllByLot(ID, Inventory, InvCode);
  325. AsposeCell.Export(dt);
  326. }
  327. [HttpGet]
  328. //[HandlerAjaxOnly]
  329. public ActionResult GetGridJsonInv(Pagination pagination, string queryJson)
  330. {
  331. DataTable ListData = App.GetGridJsonInv(queryJson, ref pagination);
  332. var JsonData = new
  333. {
  334. total = pagination.total,
  335. page = pagination.page,
  336. records = pagination.records,
  337. rows = ListData,
  338. };
  339. return Content(JsonData.ToJson());
  340. }
  341. [HttpPost]
  342. [HandlerAjaxOnly]
  343. public ActionResult AuditICSCheck(string keyValue)
  344. {
  345. string msg = App.AuditICSCheck(keyValue);
  346. if (!string.IsNullOrEmpty(msg))
  347. {
  348. return Error(msg);
  349. }
  350. else
  351. {
  352. return Success("操作成功!");
  353. }
  354. }
  355. [HttpPost]
  356. [HandlerAjaxOnly]
  357. public ActionResult ApproveWMSCheckResult(string keyValue)
  358. {
  359. string msg = App.ApproveWMSCheckResult(keyValue);
  360. if (!string.IsNullOrEmpty(msg))
  361. {
  362. return Error(msg);
  363. }
  364. else
  365. {
  366. return Success("操作成功!");
  367. }
  368. }
  369. /// <summary>
  370. /// 派纳盘点单生成条码获取盘点单信息
  371. /// </summary>
  372. /// <param name="CheckCode"></param>
  373. /// <param name="WorkPoint"></param>
  374. /// <returns></returns>
  375. [HttpGet]
  376. [HandlerAjaxOnly]
  377. public ActionResult GetCheckDocInfo(string CheckCode, string WorkPoint)
  378. {
  379. DataTable ListData = App.GetCheckDocInfo(CheckCode, WorkPoint);
  380. var JsonData = new
  381. {
  382. rows = ListData,
  383. };
  384. return Content(JsonData.ToJson());
  385. }
  386. [HttpGet]
  387. public ActionResult GetINV(string invcode, Pagination pagination)
  388. {
  389. DataTable ListData = App.GetINV(invcode, ref pagination);
  390. var JsonData = new
  391. {
  392. total = pagination.total,
  393. page = pagination.page,
  394. records = pagination.records,
  395. rows = ListData,
  396. };
  397. return Content(JsonData.ToJson());
  398. }
  399. [HttpGet]
  400. public ActionResult GetLocation(string WHCode, Pagination pagination)
  401. {
  402. DataTable ListData = App.GetLocation(WHCode, ref pagination);
  403. var JsonData = new
  404. {
  405. total = pagination.total,
  406. page = pagination.page,
  407. records = pagination.records,
  408. rows = ListData,
  409. };
  410. return Content(JsonData.ToJson());
  411. }
  412. /// <summary>
  413. /// 派纳 盘点生成条码 保存
  414. /// </summary>
  415. /// <param name="TransferNO"></param>
  416. /// <param name="keyValue"></param>
  417. /// <param name="WorkPoint"></param>
  418. /// <returns></returns>
  419. [HttpPost]
  420. [HandlerAjaxOnly]
  421. [ValidateAntiForgeryToken]
  422. public ActionResult CreateLotNoForPD(string CheckCode, string keyValue, string WorkPoint)
  423. {
  424. int i = App.CreateLotNoForPD(CheckCode, keyValue, WorkPoint);
  425. if (i > 0)
  426. {
  427. return Success("生成成功!");
  428. }
  429. else
  430. {
  431. return Error("生成失败!");
  432. }
  433. }
  434. /// <summary>
  435. /// 派纳盘点删除条码
  436. /// </summary>
  437. /// <param name="keyValue"></param>
  438. /// <returns></returns>
  439. [HttpPost]
  440. [HandlerAjaxOnly]
  441. [ValidateAntiForgeryToken]
  442. public ActionResult DeleteItemLot(string keyValue)
  443. {
  444. keyValue = keyValue.Substring(1, keyValue.Length - 2);
  445. //WorkPoint = WorkPoint.Substring(1, WorkPoint.Length - 2);
  446. string msg = App.DeleteItemLot(keyValue);
  447. if (string.IsNullOrWhiteSpace(msg))
  448. {
  449. return Success("删除成功!");
  450. }
  451. else
  452. {
  453. return Error(msg);
  454. }
  455. }
  456. }
  457. }