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.

346 lines
12 KiB

  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=="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. var JsonData = new
  83. {
  84. total = pagination.total,
  85. page = pagination.page,
  86. records = pagination.records,
  87. rows = ListData,
  88. };
  89. return Content(JsonData.ToJson());
  90. }
  91. //子表查询
  92. [HttpGet]
  93. [HandlerAjaxOnly]
  94. public ActionResult GetSubGridJson(string Code, string Type, string Mechanism, string InvCode, Pagination pagination)
  95. {
  96. DataTable ListData = new DataTable();
  97. if (Type == "1") { ListData = App.GetSubGridJson1(Code, Mechanism, InvCode, ref pagination); }//工单
  98. if (Type == "2") { ListData = App.GetSubGridJson2(Code, InvCode, ref pagination); }//工单发料
  99. if (Type == "3") { ListData = App.GetSubGridJson3(Code, InvCode, ref pagination); }//材料出库
  100. if (Type == "4") { ListData = App.GetSubGridJson4(Code, InvCode, ref pagination); }//委外备料
  101. if (Type == "5") { ListData = App.GetSubGridJson5(Code, InvCode, ref pagination); }//委外领料
  102. if (Type == "6") { ListData = App.GetSubGridJson6(Code, InvCode, ref pagination); }//委外材料出库
  103. if (Type == "7") { ListData = App.GetSubGridJson7(Code, InvCode, ref pagination); }//销售发货
  104. if (Type == "8") { ListData = App.GetSubGridJson8(Code, InvCode, ref pagination); }//其它出库
  105. if (Type == "9") { ListData = App.GetSubGridJson9(Code, InvCode, ref pagination); }//借用单
  106. if (Type == "10") { ListData = App.GetSubGridJson10(Code, InvCode, ref pagination); }//物料调拨
  107. if (Type == "11") { ListData = App.GetSubGridJson11(Code, InvCode, ref pagination); }//两步调出
  108. if (Type == "12") { ListData = App.GetSubGridJson12(Code, InvCode, ref pagination); }//补料
  109. var JsonData = new
  110. {
  111. total = pagination.total,
  112. page = pagination.page,
  113. records = pagination.records,
  114. rows = ListData,
  115. };
  116. return Content(JsonData.ToJson());
  117. }
  118. [HttpGet]
  119. [HandlerAjaxOnly]
  120. public ActionResult GetICSMOPickMergeTemp(Pagination pagination, string ID,string Type,string flag,string Mechanism,string InvCode)
  121. {
  122. DataTable ListData = new DataTable();
  123. if (flag=="1")
  124. {
  125. ListData = App.GetICSMOPickMergeTemp(ID, Type, Mechanism, InvCode);
  126. }
  127. else
  128. {
  129. ListData = App.GetICSMOPickMergeTemp2(ID, Type, Mechanism, InvCode);
  130. }
  131. var JsonData = new
  132. {
  133. total = pagination.total,
  134. page = pagination.page,
  135. records = pagination.records,
  136. rows = ListData,
  137. };
  138. return Content(JsonData.ToJson());
  139. }
  140. [HttpPost]
  141. [HandlerAjaxOnly]
  142. public ActionResult MergeMaterial(string keyValue,string Type)
  143. {
  144. string msg = App.MergeMaterial(keyValue, Type);
  145. if (!string.IsNullOrEmpty(msg))
  146. {
  147. return Error(msg);
  148. }
  149. else
  150. {
  151. return Success("添加成功!");
  152. }
  153. }
  154. [HttpPost]
  155. [HandlerAjaxOnly]
  156. public ActionResult BackMergeMaterial(string keyValue, string Type)
  157. {
  158. string msg = App.BackMergeMaterial(keyValue, Type);
  159. if (!string.IsNullOrEmpty(msg))
  160. {
  161. return Error(msg);
  162. }
  163. else
  164. {
  165. return Success("回撤成功!");
  166. }
  167. }
  168. [HttpPost]
  169. public ActionResult CheckQty(string objArr)
  170. {
  171. string i = App.CheckQty(objArr);
  172. var JsonData = new
  173. {
  174. count = i
  175. };
  176. return Content(JsonData.ToJson());
  177. }
  178. public ActionResult GetPickingListType()
  179. {
  180. 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
  181. where a.F_EnCode='PL00001' order by cast(b.F_SortCode as int) asc";
  182. DataTable ListData = SqlHelper.GetDataTableBySql(sql);
  183. return Content(ListData.ToJson());
  184. }
  185. [HttpPost]
  186. [HandlerAjaxOnly]
  187. public ActionResult SaveSeizeMaterial(string ID,string flag,string Type,string LotNoInfo,string obj)
  188. {
  189. string msg = string.Empty;
  190. if (flag=="1")
  191. {
  192. msg = App.SaveSeizeMaterial(ID, Type, LotNoInfo, obj);
  193. }
  194. else
  195. {
  196. msg = App.SaveSeizeMaterial2(ID, Type, LotNoInfo,obj);
  197. }
  198. if (!string.IsNullOrEmpty(msg))
  199. {
  200. return Error(msg);
  201. }
  202. else
  203. {
  204. return Success("添加成功!");
  205. }
  206. }
  207. [HttpPost]
  208. public ActionResult SeachPickingListType(string Type)
  209. {
  210. object Falg = App.SeachPickingListType(Type);
  211. var JsonData = new
  212. {
  213. count = Falg
  214. };
  215. return Content(JsonData.ToJson());
  216. }
  217. //查询占料
  218. public ActionResult GetGridJsonSeizeM(Pagination pagination, string queryJson, string Type)
  219. {
  220. DataTable ListData = new DataTable();
  221. if (Type == "1")//工单
  222. {
  223. ListData = App.GetGridJsonSeizeM(queryJson, ref pagination);
  224. }
  225. if (Type == "2")//工单发料
  226. {
  227. ListData = App.GetGridJsonSeizeM2(queryJson, ref pagination);
  228. }
  229. if (Type == "3")//工单材料出库
  230. {
  231. ListData = App.GetGridJsonSeizeM3(queryJson, ref pagination);
  232. }
  233. if (Type == "4")//委外备料
  234. {
  235. ListData = App.GetGridJsonSeizeM4(queryJson, ref pagination);
  236. }
  237. if (Type == "5")//委外领料
  238. {
  239. ListData = App.GetGridJsonSeizeM5(queryJson, ref pagination);
  240. }
  241. if (Type == "6")//委外材料出库
  242. {
  243. ListData = App.GetGridJsonSeizeM6(queryJson, ref pagination);
  244. }
  245. if (Type == "7")//销售发货
  246. {
  247. ListData = App.GetGridJsonSeizeM7(queryJson, ref pagination);
  248. }
  249. if (Type == "8")//其它出库
  250. {
  251. ListData = App.GetGridJsonSeizeM8(queryJson, ref pagination);
  252. }
  253. if (Type == "9")//借用单
  254. {
  255. ListData = App.GetGridJsonSeizeM9(queryJson, ref pagination);
  256. }
  257. if (Type == "10")//物料调拨
  258. {
  259. ListData = App.GetGridJsonSeizeM10(queryJson, ref pagination);
  260. }
  261. if (Type == "11")//两步调出
  262. {
  263. ListData = App.GetGridJson11(queryJson, ref pagination);
  264. }
  265. var JsonData = new
  266. {
  267. total = pagination.total,
  268. page = pagination.page,
  269. records = pagination.records,
  270. rows = ListData,
  271. };
  272. return Content(JsonData.ToJson());
  273. }
  274. //查询占料(子表查询)
  275. [HttpGet]
  276. [HandlerAjaxOnly]
  277. public ActionResult GetSubGridJsonSeizeM(string Code, string Type, Pagination pagination)
  278. {
  279. DataTable ListData = new DataTable();
  280. if (Type == "1") { ListData = App.GetSubGridJsonSeizeM1(Code, ref pagination); }//工单
  281. if (Type == "2") { ListData = App.GetSubGridJsonSeizeM2(Code, ref pagination); }//工单发料
  282. if (Type == "3") { ListData = App.GetSubGridJsonSeizeM3(Code, ref pagination); }//材料出库
  283. if (Type == "4") { ListData = App.GetSubGridJsonSeizeM4(Code, ref pagination); }//委外备料
  284. if (Type == "5") { ListData = App.GetSubGridJsonSeizeM5(Code, ref pagination); }//委外领料
  285. if (Type == "6") { ListData = App.GetSubGridJsonSeizeM6(Code, ref pagination); }//委外材料出库
  286. if (Type == "7") { ListData = App.GetSubGridJsonSeizeM7(Code, ref pagination); }//销售发货
  287. if (Type == "8") { ListData = App.GetSubGridJsonSeizeM8(Code, ref pagination); }//其它出库
  288. if (Type == "9") { ListData = App.GetSubGridJsonSeizeM9(Code, ref pagination); }//借用单
  289. if (Type == "10") { ListData = App.GetSubGridJsonSeizeM10(Code, ref pagination); }//物料调拨
  290. if (Type == "11") { ListData = App.GetSubGridJsonSeizeM11(Code, ref pagination); }//两步调出
  291. var JsonData = new
  292. {
  293. total = pagination.total,
  294. page = pagination.page,
  295. records = pagination.records,
  296. rows = ListData,
  297. };
  298. return Content(JsonData.ToJson());
  299. }
  300. // [HttpPost]
  301. //[HandlerAjaxOnly]
  302. //[ValidateAntiForgeryToken]
  303. public ActionResult DelPickLog(string objCode)
  304. {
  305. string msg = App.DelPickLog(objCode);
  306. if (string.IsNullOrEmpty(msg))
  307. {
  308. return Success("取消占料成功!");
  309. }
  310. else
  311. {
  312. return Error(msg);
  313. }
  314. }
  315. }
  316. }