纽威
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.

282 lines
8.3 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years 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. [HttpGet]
  26. [HandlerAjaxOnly]
  27. public ActionResult GetGridJson(Pagination pagination, string queryJson, string Type)
  28. {
  29. DataTable ListData = new DataTable();
  30. if (Type == "1")//工单
  31. {
  32. ListData = App.GetGridJson(queryJson, ref pagination);
  33. }
  34. if (Type=="2")//工单发料
  35. {
  36. ListData = App.GetGridJson2(queryJson, ref pagination);
  37. }
  38. if ( Type == "12")//售后领料
  39. {
  40. ListData = App.GetGridJson12(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. var JsonData = new
  79. {
  80. total = pagination.total,
  81. page = pagination.page,
  82. records = pagination.records,
  83. rows = ListData,
  84. };
  85. return Content(JsonData.ToJson());
  86. }
  87. //子表查询
  88. [HttpGet]
  89. [HandlerAjaxOnly]
  90. public ActionResult GetSubGridJson(Pagination pagination, string Code, string queryJson, string Type)
  91. {
  92. DataTable ListData = new DataTable();
  93. if (Type=="1"){ListData = App.GetSubGridJson1(Code); }//工单
  94. if (Type=="2"){ListData = App.GetSubGridJson2(queryJson,Code,ref pagination); }//工单发料
  95. if (Type == "12") { ListData = App.GetSubGridJson12(queryJson, Code); }//工单发料
  96. if (Type == "3") { ListData = App.GetSubGridJson3(Code); }//材料出库
  97. if (Type == "4") { ListData = App.GetSubGridJson4(Code); }//委外备料
  98. if (Type == "5") { ListData = App.GetSubGridJson5(Code, queryJson, ref pagination); }//委外领料
  99. if (Type == "6") { ListData = App.GetSubGridJson6(Code); }//委外材料出库
  100. if (Type == "7") { ListData = App.GetSubGridJson7(Code, queryJson, ref pagination); }//销售发货
  101. if (Type == "8") { ListData = App.GetSubGridJson8(Code, queryJson, ref pagination); }//其它出库
  102. if (Type == "9") { ListData = App.GetSubGridJson9(Code); }//借用单
  103. if (Type == "10") { ListData = App.GetSubGridJson10(Code, queryJson, ref pagination); }//物料调拨
  104. if (Type == "11") { ListData = App.GetSubGridJson11(Code); }//两步调出
  105. var JsonData = new
  106. {
  107. total = pagination.total,
  108. page = pagination.page,
  109. records = pagination.records,
  110. rows = ListData,
  111. };
  112. return Content(JsonData.ToJson());
  113. }
  114. [HttpGet]
  115. [HandlerAjaxOnly]
  116. public ActionResult GetICSMOPickMergeTemp(Pagination pagination, string ID,string Type,string flag)
  117. {
  118. DataTable ListData = new DataTable();
  119. if (flag=="1")
  120. {
  121. ListData = App.GetICSMOPickMergeTemp(ID, Type);
  122. }
  123. else
  124. {
  125. ListData = App.GetICSMOPickMergeTemp2(ID, Type);
  126. }
  127. var JsonData = new
  128. {
  129. total = pagination.total,
  130. page = pagination.page,
  131. records = pagination.records,
  132. rows = ListData,
  133. };
  134. return Content(JsonData.ToJson());
  135. }
  136. /// <summary>
  137. /// 合并拣料的接口
  138. /// </summary>
  139. /// <param name="keyValue"></param>
  140. /// <param name="Type"></param>
  141. /// <returns></returns>
  142. [HttpPost]
  143. [HandlerAjaxOnly]
  144. public ActionResult MergeMaterial(string keyValue,string Type)
  145. {
  146. string msg = App.MergeMaterial(keyValue, Type);
  147. if (!string.IsNullOrEmpty(msg))
  148. {
  149. return Error(msg);
  150. }
  151. else
  152. {
  153. return Success("添加成功!");
  154. }
  155. }
  156. /// <summary>
  157. /// 取消合并拣料的接口
  158. /// </summary>
  159. /// <param name="keyValue"></param>
  160. /// <param name="Type"></param>
  161. /// <returns></returns>
  162. [HttpPost]
  163. [HandlerAjaxOnly]
  164. public ActionResult CancelMergeMaterial(string keyValue, string Type)
  165. {
  166. string msg = App.CancelMergeMaterial(keyValue, Type);
  167. if (!string.IsNullOrEmpty(msg))
  168. {
  169. return Error(msg);
  170. }
  171. else
  172. {
  173. return Success("取消成功!");
  174. }
  175. }
  176. [HttpPost]
  177. public ActionResult CheckQty(string objArr)
  178. {
  179. string i = App.CheckQty(objArr);
  180. var JsonData = new
  181. {
  182. count = i
  183. };
  184. return Content(JsonData.ToJson());
  185. }
  186. [HttpPost]
  187. [HandlerAjaxOnly]
  188. [ValidateAntiForgeryToken]
  189. public ActionResult DelPickLog(string objCode)
  190. {
  191. string msg = App.DelPickLog(objCode);
  192. if (string.IsNullOrEmpty(msg))
  193. {
  194. return Success("取消占料成功!");
  195. }
  196. else
  197. {
  198. return Error(msg);
  199. }
  200. }
  201. [HttpPost]
  202. public ActionResult SeachPickLog(string objCode)
  203. {
  204. string Falg = "";
  205. objCode = objCode.TrimEnd(',');
  206. string[] parameters = objCode.Split(',');
  207. int parameterCount = parameters.Length;
  208. int i = App.SeachPickLog(objCode);
  209. if (i == 0)
  210. {
  211. Falg = "0";//代表全部未占料
  212. }
  213. if (i != parameterCount && i != 0)
  214. {
  215. Falg = "1";//代表有占料跟非占料的 同时存在
  216. }
  217. else if (i == parameterCount)
  218. {
  219. Falg = "2";//代表全部已占料
  220. }
  221. var JsonData = new
  222. {
  223. count = Falg
  224. };
  225. return Content(JsonData.ToJson());
  226. }
  227. [HttpGet]
  228. [HandlerAjaxOnly]
  229. public ActionResult GetPickLogInfo(Pagination pagination, string ID)
  230. {
  231. DataTable ListData = new DataTable();
  232. ListData = App.GetPickLogInfo(ID);
  233. var JsonData = new
  234. {
  235. total = pagination.total,
  236. page = pagination.page,
  237. records = pagination.records,
  238. rows = ListData,
  239. };
  240. return Content(JsonData.ToJson());
  241. }
  242. }
  243. }