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.KBSWMS;
  2. using NFine.Code;
  3. using NFine.Data.Extensions;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Data;
  7. using System.Linq;
  8. using System.Web;
  9. using System.Web.Mvc;
  10. namespace NFine.Web.Areas.KBSWMS.Controllers
  11. {
  12. public class PickMaterialController : ControllerBase
  13. {
  14. // GET: WMS/PickMaterial
  15. PickMaterialApp App = new PickMaterialApp();
  16. public ActionResult ICSMOPickMerge()
  17. {
  18. return View();
  19. }
  20. public ActionResult ICSMOPickMergeSeach()
  21. {
  22. return View();
  23. }
  24. //[HttpGet]
  25. //[HandlerAjaxOnly]
  26. public ActionResult GetGridJson(Pagination pagination, string queryJson, string Type)
  27. {
  28. DataTable ListData = new DataTable();
  29. if (Type == "1")//工单1
  30. {
  31. ListData = App.GetGridJson1(queryJson, ref pagination);
  32. }
  33. if (Type == "1-1")//工单(咖博士)
  34. {
  35. ListData = App.GetGridJson1(queryJson, ref pagination);
  36. }
  37. if (Type == "2")//工单发料
  38. {
  39. ListData = App.GetGridJson2(queryJson, ref pagination);
  40. }
  41. if (Type == "3")//工单材料出库
  42. {
  43. ListData = App.GetGridJson3(queryJson, ref pagination);
  44. }
  45. if (Type == "4")//委外备料
  46. {
  47. ListData = App.GetGridJson4(queryJson, ref pagination);
  48. }
  49. if (Type == "5")//委外领料
  50. {
  51. ListData = App.GetGridJson5(queryJson, ref pagination);
  52. }
  53. if (Type == "6")//委外材料出库
  54. {
  55. ListData = App.GetGridJson6(queryJson, ref pagination);
  56. }
  57. if (Type == "7")//销售发货
  58. {
  59. ListData = App.GetGridJson7(queryJson, ref pagination);
  60. }
  61. if (Type == "8")//其它出库
  62. {
  63. ListData = App.GetGridJson8(queryJson, ref pagination);
  64. }
  65. if (Type == "9")//借用单
  66. {
  67. ListData = App.GetGridJson9(queryJson, ref pagination);
  68. }
  69. if (Type == "10")//物料调拨
  70. {
  71. ListData = App.GetGridJson10(queryJson, ref pagination);
  72. }
  73. if (Type == "11")//两步调出
  74. {
  75. ListData = App.GetGridJson11(queryJson, ref pagination);
  76. }
  77. if (Type == "12")//补料
  78. {
  79. ListData = App.GetGridJson12(queryJson, ref pagination);
  80. }
  81. if (Type == "13")//采购退货
  82. {
  83. ListData = App.GetGridJson13(queryJson, ref pagination);
  84. }
  85. if (Type == "14")//采购退货---红字入库单
  86. {
  87. ListData = App.GetGridJson14(queryJson, ref pagination);
  88. }
  89. if (Type == "15")//红字其他入库
  90. {
  91. ListData = App.GetGridJson15(queryJson, ref pagination);
  92. }
  93. if (Type == "16")//销售出库单
  94. {
  95. ListData = App.GetGridJson16(queryJson, ref pagination);
  96. }
  97. if (Type == "17")//调拨申请单
  98. {
  99. ListData = App.GetGridJson17(queryJson, ref pagination);
  100. }
  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. [HandlerAjaxOnly]
  113. public ActionResult GetSubGridJson(string Code, string Type, string Mechanism, string InvCode, Pagination pagination)
  114. {
  115. DataTable ListData = new DataTable();
  116. if (Type == "1") { ListData = App.GetSubGridJson1(Code, Mechanism, InvCode, ref pagination); }//工单
  117. if (Type == "1-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. }