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.

386 lines
14 KiB

3 weeks ago
  1. using NFine.Application.HGWMS;
  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.HGWMS.Controllers
  16. {
  17. public class PickMaterialController : ControllerBase
  18. {
  19. // GET: WMS/PickMaterial
  20. PickMaterialApp App = new PickMaterialApp();
  21. public ActionResult ICSMOPickMerge()
  22. {
  23. return View();
  24. }
  25. public ActionResult ICSMOPickMergeSeach()
  26. {
  27. return View();
  28. }
  29. //[HttpGet]
  30. //[HandlerAjaxOnly]
  31. public ActionResult GetGridJson(Pagination pagination, string queryJson, string Type)
  32. {
  33. DataTable ListData = new DataTable();
  34. if (Type == "1")//工单1
  35. {
  36. ListData = App.GetGridJson(queryJson, ref pagination);
  37. }
  38. if (Type == "2")//工单发料
  39. {
  40. ListData = App.GetGridJson2(queryJson, ref pagination);
  41. }
  42. if (Type == "3")//工单材料出库
  43. {
  44. ListData = App.GetGridJson3(queryJson, ref pagination);
  45. }
  46. if (Type == "4")//委外备料
  47. {
  48. ListData = App.GetGridJson4(queryJson, ref pagination);
  49. }
  50. if (Type == "5")//委外领料
  51. {
  52. ListData = App.GetGridJson5(queryJson, ref pagination);
  53. }
  54. if (Type == "6")//委外材料出库
  55. {
  56. ListData = App.GetGridJson6(queryJson, ref pagination);
  57. }
  58. if (Type == "7")//销售发货
  59. {
  60. ListData = App.GetGridJson7(queryJson, ref pagination);
  61. }
  62. if (Type == "8")//其它出库
  63. {
  64. ListData = App.GetGridJson8(queryJson, ref pagination);
  65. }
  66. if (Type == "9")//借用单
  67. {
  68. ListData = App.GetGridJson9(queryJson, ref pagination);
  69. }
  70. if (Type == "10")//物料调拨
  71. {
  72. ListData = App.GetGridJson10(queryJson, ref pagination);
  73. }
  74. if (Type == "11")//两步调出
  75. {
  76. ListData = App.GetGridJson11(queryJson, ref pagination);
  77. }
  78. if (Type == "12")//补料
  79. {
  80. ListData = App.GetGridJson12(queryJson, ref pagination);
  81. }
  82. if (Type == "13")//采购退货
  83. {
  84. ListData = App.GetGridJson13(queryJson, ref pagination);
  85. }
  86. if (Type == "14")//采购退货---红字入库单
  87. {
  88. ListData = App.GetGridJson14(queryJson, ref pagination);
  89. }
  90. if (Type == "15")//红字其他入库
  91. {
  92. ListData = App.GetGridJson15(queryJson, ref pagination);
  93. }
  94. if (Type == "16")//销售出库单
  95. {
  96. ListData = App.GetGridJson16(queryJson, ref pagination);
  97. }
  98. if (Type == "17")//调拨申请单
  99. {
  100. ListData = App.GetGridJson17(queryJson, ref pagination);
  101. }
  102. var JsonData = new
  103. {
  104. total = pagination.total,
  105. page = pagination.page,
  106. records = pagination.records,
  107. rows = ListData,
  108. };
  109. return Content(JsonData.ToJson());
  110. }
  111. //子表查询
  112. [HttpGet]
  113. [HandlerAjaxOnly]
  114. public ActionResult GetSubGridJson(string Code, string Type, string Mechanism, string InvCode, Pagination pagination)
  115. {
  116. DataTable ListData = new DataTable();
  117. if (Type == "1") { ListData = App.GetSubGridJson1(Code, Mechanism, InvCode, ref pagination); }//工单
  118. if (Type == "2") { ListData = App.GetSubGridJson2(Code, InvCode, ref pagination); }//工单发料
  119. if (Type == "3") { ListData = App.GetSubGridJson3(Code, InvCode, ref pagination); }//材料出库
  120. if (Type == "4") { ListData = App.GetSubGridJson4(Code, InvCode, ref pagination); }//委外备料
  121. if (Type == "5") { ListData = App.GetSubGridJson5(Code, InvCode, ref pagination); }//委外领料
  122. if (Type == "6") { ListData = App.GetSubGridJson6(Code, InvCode, ref pagination); }//委外材料出库
  123. if (Type == "7") { ListData = App.GetSubGridJson7(Code, InvCode, ref pagination); }//销售发货
  124. if (Type == "8") { ListData = App.GetSubGridJson8(Code, InvCode, ref pagination); }//其它出库
  125. if (Type == "9") { ListData = App.GetSubGridJson9(Code, InvCode, ref pagination); }//借用单
  126. if (Type == "10") { ListData = App.GetSubGridJson10(Code, InvCode, ref pagination); }//物料调拨
  127. if (Type == "11") { ListData = App.GetSubGridJson11(Code, InvCode, ref pagination); }//两步调出
  128. if (Type == "12") { ListData = App.GetSubGridJson12(Code, InvCode, ref pagination); }//补料
  129. if (Type == "13") { ListData = App.GetSubGridJson13(Code, InvCode, ref pagination); }//采购退货
  130. if (Type == "14") { ListData = App.GetSubGridJson14(Code, InvCode, ref pagination); }//采购退货---红字入库单
  131. if (Type == "15") { ListData = App.GetSubGridJson15(Code, InvCode, ref pagination); }//红字其他入库
  132. if (Type == "16") { ListData = App.GetSubGridJson16(Code, InvCode, ref pagination); }//红字其他入库
  133. if (Type == "17") { ListData = App.GetSubGridJson17(Code, InvCode, ref pagination); }//红字其他入库
  134. var JsonData = new
  135. {
  136. total = pagination.total,
  137. page = pagination.page,
  138. records = pagination.records,
  139. rows = ListData,
  140. };
  141. return Content(JsonData.ToJson());
  142. }
  143. [HttpGet]
  144. [HandlerAjaxOnly]
  145. public ActionResult GetICSMOPickMergeTemp(Pagination pagination, string ID, string Type, string flag, string Mechanism, string InvCode)
  146. {
  147. DataTable ListData = new DataTable();
  148. if (flag == "1")
  149. {
  150. ListData = App.GetICSMOPickMergeTemp(ID, Type, Mechanism, InvCode);
  151. }
  152. else
  153. {
  154. ListData = App.GetICSMOPickMergeTemp2(ID, Type, Mechanism, InvCode);
  155. }
  156. var JsonData = new
  157. {
  158. total = pagination.total,
  159. page = pagination.page,
  160. records = pagination.records,
  161. rows = ListData,
  162. };
  163. return Content(JsonData.ToJson());
  164. }
  165. [HttpPost]
  166. [HandlerAjaxOnly]
  167. public ActionResult MergeMaterial(string keyValue, string Type)
  168. {
  169. string msg = App.MergeMaterial(keyValue, Type);
  170. if (!string.IsNullOrEmpty(msg))
  171. {
  172. return Error(msg);
  173. }
  174. else
  175. {
  176. return Success("添加成功!");
  177. }
  178. }
  179. [HttpPost]
  180. [HandlerAjaxOnly]
  181. public ActionResult BackMergeMaterial(string keyValue, string Type)
  182. {
  183. string msg = App.BackMergeMaterial(keyValue, Type);
  184. if (!string.IsNullOrEmpty(msg))
  185. {
  186. return Error(msg);
  187. }
  188. else
  189. {
  190. return Success("回撤成功!");
  191. }
  192. }
  193. [HttpPost]
  194. public ActionResult CheckQty(string objArr)
  195. {
  196. string i = App.CheckQty(objArr);
  197. var JsonData = new
  198. {
  199. count = i
  200. };
  201. return Content(JsonData.ToJson());
  202. }
  203. public ActionResult GetPickingListType()
  204. {
  205. string sql = @"select b.F_ItemCode as Code ,b.F_ItemName as Name from Sys_SRM_Items a left join Sys_SRM_ItemsDetail b on a.F_Id=b.F_ItemId
  206. where a.F_EnCode='PL00001' order by cast(b.F_SortCode as int) asc";
  207. DataTable ListData = SqlHelper.GetDataTableBySql(sql);
  208. return Content(ListData.ToJson());
  209. }
  210. [HttpPost]
  211. [HandlerAjaxOnly]
  212. public ActionResult SaveSeizeMaterial(string ID, string flag, string Type, string LotNoInfo, string obj)
  213. {
  214. string msg = string.Empty;
  215. if (flag == "1")
  216. {
  217. msg = App.SaveSeizeMaterial(ID, Type, LotNoInfo, obj);
  218. }
  219. else
  220. {
  221. msg = App.SaveSeizeMaterial2(ID, Type, LotNoInfo, obj);
  222. }
  223. if (!string.IsNullOrEmpty(msg))
  224. {
  225. return Error(msg);
  226. }
  227. else
  228. {
  229. return Success("添加成功!");
  230. }
  231. }
  232. [HttpPost]
  233. public ActionResult SeachPickingListType(string Type)
  234. {
  235. object Falg = App.SeachPickingListType(Type);
  236. var JsonData = new
  237. {
  238. count = Falg
  239. };
  240. return Content(JsonData.ToJson());
  241. }
  242. //查询占料
  243. public ActionResult GetGridJsonSeizeM(Pagination pagination, string queryJson, string Type)
  244. {
  245. DataTable ListData = new DataTable();
  246. if (Type == "1")//工单
  247. {
  248. ListData = App.GetGridJsonSeizeM(queryJson, ref pagination);
  249. }
  250. if (Type == "2")//工单发料
  251. {
  252. ListData = App.GetGridJsonSeizeM2(queryJson, ref pagination);
  253. }
  254. if (Type == "3")//工单材料出库
  255. {
  256. ListData = App.GetGridJsonSeizeM3(queryJson, ref pagination);
  257. }
  258. if (Type == "4")//委外备料
  259. {
  260. ListData = App.GetGridJsonSeizeM4(queryJson, ref pagination);
  261. }
  262. if (Type == "5")//委外领料
  263. {
  264. ListData = App.GetGridJsonSeizeM5(queryJson, ref pagination);
  265. }
  266. if (Type == "6")//委外材料出库
  267. {
  268. ListData = App.GetGridJsonSeizeM6(queryJson, ref pagination);
  269. }
  270. if (Type == "7")//销售发货
  271. {
  272. ListData = App.GetGridJsonSeizeM7(queryJson, ref pagination);
  273. }
  274. if (Type == "8")//其它出库
  275. {
  276. ListData = App.GetGridJsonSeizeM8(queryJson, ref pagination);
  277. }
  278. if (Type == "9")//借用单
  279. {
  280. ListData = App.GetGridJsonSeizeM9(queryJson, ref pagination);
  281. }
  282. if (Type == "10")//物料调拨
  283. {
  284. ListData = App.GetGridJsonSeizeM10(queryJson, ref pagination);
  285. }
  286. if (Type == "11")//两步调出
  287. {
  288. ListData = App.GetGridJson11(queryJson, ref pagination);
  289. }
  290. if (Type == "15")//两步调出
  291. {
  292. ListData = App.GetGridJson15(queryJson, ref pagination);
  293. }
  294. if (Type == "16")//两步调出
  295. {
  296. ListData = App.GetGridJson16(queryJson, ref pagination);
  297. }
  298. if (Type == "17")//调拨申请
  299. {
  300. ListData = App.GetGridJson17(queryJson, ref pagination);
  301. }
  302. var JsonData = new
  303. {
  304. total = pagination.total,
  305. page = pagination.page,
  306. records = pagination.records,
  307. rows = ListData,
  308. };
  309. return Content(JsonData.ToJson());
  310. }
  311. //查询占料(子表查询)
  312. [HttpGet]
  313. [HandlerAjaxOnly]
  314. public ActionResult GetSubGridJsonSeizeM(string Code, string Type, Pagination pagination)
  315. {
  316. DataTable ListData = new DataTable();
  317. if (Type == "1") { ListData = App.GetSubGridJsonSeizeM1(Code, ref pagination); }//工单
  318. if (Type == "2") { ListData = App.GetSubGridJsonSeizeM2(Code, ref pagination); }//工单发料
  319. if (Type == "3") { ListData = App.GetSubGridJsonSeizeM3(Code, ref pagination); }//材料出库
  320. if (Type == "4") { ListData = App.GetSubGridJsonSeizeM4(Code, ref pagination); }//委外备料
  321. if (Type == "5") { ListData = App.GetSubGridJsonSeizeM5(Code, ref pagination); }//委外领料
  322. if (Type == "6") { ListData = App.GetSubGridJsonSeizeM6(Code, ref pagination); }//委外材料出库
  323. if (Type == "7") { ListData = App.GetSubGridJsonSeizeM7(Code, ref pagination); }//销售发货
  324. if (Type == "8") { ListData = App.GetSubGridJsonSeizeM8(Code, ref pagination); }//其它出库
  325. if (Type == "9") { ListData = App.GetSubGridJsonSeizeM9(Code, ref pagination); }//借用单
  326. if (Type == "10") { ListData = App.GetSubGridJsonSeizeM10(Code, ref pagination); }//物料调拨
  327. if (Type == "11") { ListData = App.GetSubGridJsonSeizeM11(Code, ref pagination); }//两步调出
  328. if (Type == "13") { ListData = App.GetSubGridJsonSeizeM11(Code, ref pagination); }//采购退货
  329. if (Type == "15") { ListData = App.GetSubGridJsonSeizeM15(Code, ref pagination); }//采购退货
  330. if (Type == "16") { ListData = App.GetSubGridJsonSeizeM16(Code, ref pagination); }//销售出库单
  331. if (Type == "16") { ListData = App.GetSubGridJsonSeizeM17(Code, 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. //[ValidateAntiForgeryToken]
  344. public ActionResult DelPickLog(string objCode)
  345. {
  346. string msg = App.DelPickLog(objCode);
  347. if (string.IsNullOrEmpty(msg))
  348. {
  349. return Success("取消占料成功!");
  350. }
  351. else
  352. {
  353. return Error(msg);
  354. }
  355. }
  356. }
  357. }