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.

290 lines
9.3 KiB

4 days ago
2 days ago
4 days ago
2 days ago
4 days ago
2 days ago
4 days ago
2 days ago
4 days ago
2 days ago
4 days ago
  1. using NFine.Application;
  2. using NFine.Application.ProductManage;
  3. using NFine.Code;
  4. using NFine.Domain.Entity.ProductManage;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Data;
  8. using System.IO;
  9. using System.Linq;
  10. using System.Web;
  11. using System.Web.Mvc;
  12. namespace NFine.Web.Areas.SRM.Controllers
  13. {
  14. public class CAAddController : ControllerBase
  15. {
  16. private CAManageApp App = new CAManageApp();
  17. [HttpGet]
  18. [HandlerAjaxOnly]
  19. public ActionResult GetGridJson(Pagination pagination, string queryJson)
  20. {
  21. DataTable ListData = App.GetGridJson(queryJson, ref pagination);
  22. var JsonData = new
  23. {
  24. total = pagination.total,
  25. page = pagination.page,
  26. records = pagination.records,
  27. rows = ListData,
  28. };
  29. return Content(JsonData.ToJson());
  30. }
  31. /// <summary>
  32. /// 对账单新增明细 二级界面
  33. /// </summary>
  34. /// <param name="queryJson"></param>
  35. /// <param name="pagination"></param>
  36. /// <returns></returns>
  37. //[HttpGet]
  38. //[HandlerAjaxOnly]
  39. //public ActionResult GetSubGridJson(string queryJson, Pagination pagination)
  40. //{
  41. // DataTable ListData = App.GetSubGridJson_Add(queryJson, ref pagination);
  42. // var JsonData = new
  43. // {
  44. // total = pagination.total,
  45. // page = pagination.page,
  46. // records = pagination.records,
  47. // rows = ListData,SaveItemCode
  48. // };
  49. // return Content(JsonData.ToJson());
  50. //}
  51. [HttpGet]
  52. [HandlerAjaxOnly]
  53. //public ActionResult GetSubGridJson(string queryJson, string CartonNo, Pagination pagination)
  54. //{
  55. // DataTable ListData = App.GetSubGridJson(CartonNo, ref pagination);
  56. // var JsonData = new
  57. // {
  58. // total = pagination.total,
  59. // page = pagination.page,
  60. // records = pagination.records,
  61. // rows = ListData,
  62. // };
  63. // return Content(JsonData.ToJson());
  64. //}
  65. public ActionResult Index()
  66. {
  67. return View();
  68. }
  69. [HttpPost]
  70. [HandlerAjaxOnly]
  71. [ValidateAntiForgeryToken]
  72. public ActionResult SubmitForm(string POCode, string PORow, string keyValue)
  73. {
  74. int i = App.CreateItemLotNo(POCode, PORow, keyValue);
  75. if (i > 0)
  76. {
  77. return Success("发布成功!");
  78. }
  79. else
  80. {
  81. return Error("发布失败!");
  82. }
  83. }
  84. [HttpGet]
  85. [HandlerAjaxOnly]
  86. public ActionResult GetSubGridJsonByCreate(string POCode, string PORow)
  87. {
  88. DataTable ListData = App.GetSubGridJsonByCreate(POCode, PORow);
  89. var JsonData = new
  90. {
  91. rows = ListData,
  92. };
  93. return Content(JsonData.ToJson());
  94. }
  95. [HttpGet]
  96. [HandlerAjaxOnly]
  97. public ActionResult GetVendorLotNo(string VenCode, string WorkPoint)
  98. {
  99. DataTable ListData = App.GetVendorLotNo(VenCode, WorkPoint);
  100. var JsonData = new
  101. {
  102. VendorLotNo = ListData.Rows[0][0].ToString(),
  103. };
  104. return Content(JsonData.ToJson());
  105. }
  106. [HttpGet]
  107. [HandlerAjaxOnly]
  108. public ActionResult GetDocNo(string Tax, string WorkPoint, string Vendor)
  109. {
  110. string cDocNo = App.GetDocNo(Tax, WorkPoint, Vendor);
  111. var JsonData = new
  112. {
  113. DocNo = cDocNo,
  114. VenCode = NFine.Code.OperatorProvider.Provider.GetCurrent().VenCode
  115. };
  116. return Content(JsonData.ToJson());
  117. }
  118. [HttpGet]
  119. [HandlerAjaxOnly]
  120. public ActionResult GetDocNoByPerson(string SupplierCode, string Tax, string WorkPoint)
  121. {
  122. string cDocNo = App.GetDocNoByPerson(SupplierCode, Tax, WorkPoint);
  123. var JsonData = new
  124. {
  125. DocNo = cDocNo,
  126. VenCode = NFine.Code.OperatorProvider.Provider.GetCurrent().VenCode
  127. };
  128. return Content(JsonData.ToJson());
  129. }
  130. /// <summary>
  131. /// 对账单添加,保存到明细表
  132. /// </summary>
  133. /// <param name="queryJson"></param>
  134. /// <param name="DocNo"></param>
  135. /// <param name="WorkPoint"></param>
  136. /// <returns></returns>
  137. [HttpPost]
  138. [HandlerAjaxOnly]
  139. public ActionResult SaveItemCode(string queryJson, string DocNo, string WorkPoint)
  140. {
  141. queryJson = queryJson.Substring(1, queryJson.Length - 2);
  142. string msg = App.CheckSTNO_ItemCode(queryJson, DocNo, WorkPoint);
  143. if (!string.IsNullOrEmpty(msg))
  144. {
  145. return Error(msg);
  146. }
  147. else
  148. {
  149. return Success("添加成功!");
  150. }
  151. }
  152. [HttpPost]
  153. [HandlerAjaxOnly]
  154. [ValidateAntiForgeryToken]
  155. public ActionResult DeleteInfo(string keyValue, string WorkPoint)
  156. {
  157. keyValue = keyValue.Substring(1, keyValue.Length - 2);
  158. WorkPoint = WorkPoint.Substring(1, WorkPoint.Length - 2);
  159. string msg = App.DeleteInfo(keyValue, WorkPoint);
  160. if (string.IsNullOrEmpty(msg))
  161. {
  162. return Success("删除成功!");
  163. }
  164. else
  165. {
  166. return Error(msg);
  167. }
  168. }
  169. [HttpPost]
  170. [HandlerAjaxOnly]
  171. [ValidateAntiForgeryToken]
  172. public ActionResult DeleteDocNoSuit(string keyValue, string DeleteFlag, string WorkPoint,string Tax, string detail)
  173. {
  174. try
  175. {
  176. if (DeleteFlag == "1")
  177. {
  178. string msg = App.DeleteDocNoSuit(keyValue, WorkPoint);
  179. }
  180. else
  181. {
  182. string msg = App.UpdateSTNO(keyValue, WorkPoint, Tax, detail);
  183. }
  184. return Success("操作成功!");
  185. }
  186. catch (Exception ex)
  187. {
  188. return Error("操作失败!:"+ex.Message);
  189. }
  190. }
  191. public ActionResult DeleteDocNoSuitBYX(string keyValue, string DeleteFlag, string WorkPoint)
  192. {
  193. string msg = App.DeleteDocNoSuit(keyValue, WorkPoint);
  194. return Success("操作成功!");
  195. }
  196. [HttpPost]
  197. [HandlerAjaxOnly]
  198. [ValidateAntiForgeryToken]
  199. public ActionResult DeleteDocNo(string keyValue, string DeleteFlag, string WorkPoint)
  200. {
  201. if (DeleteFlag == "1")
  202. {
  203. string msg = App.DeleteDocNo(keyValue, WorkPoint);
  204. }
  205. return Success("操作成功!");
  206. }
  207. public ActionResult ISCA(string queryJson, string WorkPoint)
  208. {
  209. try
  210. {
  211. App.ISCA(queryJson, WorkPoint);
  212. return Success("修改成功!");
  213. }
  214. catch (Exception ex)
  215. {
  216. return Error(ex.Message);
  217. }
  218. }
  219. public ActionResult GetVendorWorkPoint(string WorkPoint)
  220. {
  221. string VenCode = App.GetVendorWorkPoint(WorkPoint);
  222. return Content(VenCode);
  223. }
  224. /// <summary>
  225. /// 上传扣款文件
  226. /// </summary>
  227. /// <param name="DocNo"></param>
  228. /// <returns></returns>
  229. [HttpPost]
  230. public ActionResult UpLoadFileImport(string DocNo)
  231. {
  232. string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode;
  233. string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location.TrimEnd(',');
  234. string FileName = "";
  235. string Name = "";
  236. //获取上传的文件集合
  237. HttpFileCollection httpFile = System.Web.HttpContext.Current.Request.Files;
  238. try
  239. {
  240. for (int i = 0; i < httpFile.Count; i++)
  241. {
  242. FileName = Path.GetFileNameWithoutExtension(httpFile[i].FileName) + Path.GetExtension(httpFile[i].FileName);
  243. string Paths = System.Web.HttpContext.Current.Server.MapPath("~\\File\\CAAddFile\\" + DocNo + "\\");
  244. if (!Directory.Exists(Paths))
  245. {
  246. Directory.CreateDirectory(Paths);
  247. }
  248. string PathName = System.Web.HttpContext.Current.Server.MapPath("~\\File\\CAAddFile\\" + DocNo + "\\" + FileName);
  249. int iLen = httpFile[0].ContentLength;
  250. byte[] bData = new byte[iLen];
  251. httpFile[0].InputStream.Read(bData, 0, iLen);
  252. FileStream fs = new FileStream(PathName, FileMode.OpenOrCreate);
  253. fs.Write(bData, 0, bData.Length);
  254. fs.Flush();
  255. fs.Close();
  256. fs.Dispose();
  257. Name = "" + FileName + ";";
  258. }
  259. }
  260. catch (Exception ex)
  261. {
  262. return Error(ex.Message);
  263. }
  264. return Success("上传成功!");
  265. }
  266. }
  267. }