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

328 lines
9.6 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 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. try
  119. {
  120. DataTable ListData = new DataTable();
  121. if (flag == "1")
  122. {
  123. ListData = App.GetICSMOPickMergeTemp(ID, Type);
  124. }
  125. else
  126. {
  127. ListData = App.GetICSMOPickMergeTemp2(ID, Type);
  128. }
  129. var JsonData = new
  130. {
  131. total = pagination.total,
  132. page = pagination.page,
  133. records = pagination.records,
  134. rows = ListData,
  135. msg="",
  136. };
  137. return Content(JsonData.ToJson());
  138. }
  139. catch (Exception ex)
  140. {
  141. var JsonData = new
  142. {
  143. total = 0,
  144. page = 0,
  145. records = 0,
  146. rows = "",
  147. msg=ex.Message,
  148. };
  149. return Content(JsonData.ToJson());
  150. }
  151. }
  152. /// <summary>
  153. /// 合并拣料的接口
  154. /// </summary>
  155. /// <param name="keyValue"></param>
  156. /// <param name="Type"></param>
  157. /// <returns></returns>
  158. [HttpPost]
  159. [HandlerAjaxOnly]
  160. public ActionResult MergeMaterial(string keyValue, string Type)
  161. {
  162. string msg = App.MergeMaterial(keyValue, Type);
  163. if (!string.IsNullOrEmpty(msg))
  164. {
  165. return Error(msg);
  166. }
  167. else
  168. {
  169. return Success("添加成功!");
  170. }
  171. }
  172. /// <summary>
  173. /// 取消合并拣料的接口
  174. /// </summary>
  175. /// <param name="keyValue"></param>
  176. /// <param name="Type"></param>
  177. /// <returns></returns>
  178. [HttpPost]
  179. [HandlerAjaxOnly]
  180. public ActionResult CancelMergeMaterial(string keyValue, string Type)
  181. {
  182. string msg = App.CancelMergeMaterial(keyValue, Type);
  183. if (!string.IsNullOrEmpty(msg))
  184. {
  185. return Error(msg);
  186. }
  187. else
  188. {
  189. return Success("取消成功!");
  190. }
  191. }
  192. [HttpPost]
  193. public ActionResult CheckQty(string objArr)
  194. {
  195. string i = App.CheckQty(objArr);
  196. var JsonData = new
  197. {
  198. count = i
  199. };
  200. return Content(JsonData.ToJson());
  201. }
  202. [HttpPost]
  203. [HandlerAjaxOnly]
  204. [ValidateAntiForgeryToken]
  205. public ActionResult DelPickLog(string objCode)
  206. {
  207. string msg = App.DelPickLog(objCode);
  208. if (string.IsNullOrEmpty(msg))
  209. {
  210. return Success("取消占料成功!");
  211. }
  212. else
  213. {
  214. return Error(msg);
  215. }
  216. }
  217. [HttpPost]
  218. public ActionResult SeachPickLog(string objCode)
  219. {
  220. string Falg = "";
  221. objCode = objCode.TrimEnd(',');
  222. string[] parameters = objCode.Split(',');
  223. int parameterCount = parameters.Length;
  224. int i = App.SeachPickLog(objCode);
  225. if (i == 0)
  226. {
  227. Falg = "0";//代表全部未占料
  228. }
  229. if (i != parameterCount && i != 0)
  230. {
  231. Falg = "1";//代表有占料跟非占料的 同时存在
  232. }
  233. else if (i == parameterCount)
  234. {
  235. Falg = "2";//代表全部已占料
  236. }
  237. var JsonData = new
  238. {
  239. count = Falg
  240. };
  241. return Content(JsonData.ToJson());
  242. }
  243. /// <summary>
  244. /// 记录打印次数
  245. /// </summary>
  246. /// <param name="objCode"></param>
  247. /// <returns></returns>
  248. [HttpPost]
  249. [HandlerAjaxOnly]
  250. public ActionResult PrintCount(string objCode,string type)
  251. {
  252. try
  253. {
  254. objCode = objCode.TrimEnd(',');
  255. string[] parameters = objCode.Split(',');
  256. int parameterCount = parameters.Length;
  257. int i = App.PrintCount(objCode, type);
  258. if (i > 0)
  259. {
  260. return Success("记录成功!");
  261. }
  262. else
  263. {
  264. return Error("记录失败!");
  265. }
  266. }
  267. catch (Exception ex)
  268. {
  269. return Error(ex.Message);
  270. }
  271. }
  272. [HttpGet]
  273. [HandlerAjaxOnly]
  274. public ActionResult GetPickLogInfo(Pagination pagination, string ID)
  275. {
  276. DataTable ListData = new DataTable();
  277. ListData = App.GetPickLogInfo(ID);
  278. var JsonData = new
  279. {
  280. total = pagination.total,
  281. page = pagination.page,
  282. records = pagination.records,
  283. rows = ListData,
  284. };
  285. return Content(JsonData.ToJson());
  286. }
  287. }
  288. }