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.

391 lines
14 KiB

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