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

307 lines
13 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. using NFine.Data.Extensions;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Data;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using NFine.Code;
  9. using NFine.Repository;
  10. using System.Data.Common;
  11. using NFine.Domain._03_Entity.SRM;
  12. using ICS.Application.Entity;
  13. using Newtonsoft.Json;
  14. using System.Configuration;
  15. using System.Data.SqlClient;
  16. using ICS.Data;
  17. using Newtonsoft.Json.Linq;
  18. using NFine.Domain._03_Entity.WMS;
  19. using System.Net;
  20. using System.IO;
  21. namespace NFine.Application.WMS
  22. {
  23. public class RevokeBusinessApp : RepositoryFactory<ICSVendor>
  24. {
  25. //采购入库撤销
  26. public string RevocationPurchase(string keyValue)
  27. {
  28. string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode;
  29. string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName;
  30. string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
  31. string msg = "";
  32. string sql = string.Empty;
  33. var Parameter = keyValue.ToJObject();
  34. sql += @" delete from ICSWareHouseLotInfo where LotNo='{3}' and WorkPoint='{7}' ";
  35. sql += @"update ICSPurchaseOrder set InQuantity =InQuantity-'{0}' where POCode='{4}' and Sequence='{5}' and WorkPoint='{7}'";
  36. sql += @"update ICSWareHouseLotInfoLog set EATTRIBUTE1 ='1' , MTIME=getdate(),MUSER='{1}',MUSERName='{2}' where ID='{6}' and WorkPoint='{7}'";
  37. sql = string.Format(sql, Parameter["Quantity"].ToString(), MUSER, MUSERNAME, Parameter["LotNo"].ToString(), Parameter["TransCode"].ToString(), Parameter["TransSequence"].ToString(), Parameter["ID"].ToString(), WorkPoint);
  38. try
  39. {
  40. if (SqlHelper.CmdExecuteNonQueryLi(sql) > 0)
  41. {
  42. }
  43. else
  44. {
  45. msg = "撤销失败";
  46. }
  47. }
  48. catch (Exception ex)
  49. {
  50. throw new Exception(ex.Message);
  51. }
  52. return msg;
  53. }
  54. //采购入库-采购到货单撤销
  55. public string RevocationDeliveryNotice(string keyValue)
  56. {
  57. string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode;
  58. string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName;
  59. string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
  60. string msg = "";
  61. string sql = string.Empty;
  62. var Parameter = keyValue.ToJObject();
  63. sql += @" delete from ICSWareHouseLotInfo where LotNo='{3}' and WorkPoint='{7}' ";
  64. sql += @"update ICSDeliveryNotice set RCVQuantity =RCVQuantity-'{0}' where DNCode='{4}' and Sequence='{5}' and WorkPoint='{7}' and DNType='1'";
  65. sql += @"update ICSWareHouseLotInfoLog set EATTRIBUTE1 ='1' , MTIME=getdate(),MUSER='{1}',MUSERName='{2}' where ID='{6}' and WorkPoint='{7}'";
  66. sql = string.Format(sql, Parameter["Quantity"].ToString(), MUSER, MUSERNAME, Parameter["LotNo"].ToString(), Parameter["TransCode"].ToString(), Parameter["TransSequence"].ToString(), Parameter["ID"].ToString(), WorkPoint);
  67. try
  68. {
  69. if (SqlHelper.CmdExecuteNonQueryLi(sql) > 0)
  70. {
  71. }
  72. else
  73. {
  74. msg = "撤销失败";
  75. }
  76. }
  77. catch (Exception ex)
  78. {
  79. throw new Exception(ex.Message);
  80. }
  81. return msg;
  82. }
  83. //生产订单备料表
  84. public string RevocationPicking(string keyValue)
  85. {
  86. string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode;
  87. string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName;
  88. string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
  89. string msg = "";
  90. string sql = string.Empty;
  91. var Parameter = keyValue.ToJObject();
  92. sql += @"update ICSWareHouseLotInfo set Quantity=Quantity+'{0}',MTIME=getdate(),MUSER='{1}',MUSERName='{2}' where LotNo='{3}' and WorkPoint='{7}' ";
  93. sql += @"update a set IssueQuantity =IssueQuantity-'{0}' from ICSMOPick a left join ICSMO b on a.MODetailID=b.MODetailID and a.WorkPoint=b.WorkPoint
  94. where b.MOCode='{4}' and b.Sequence+'~'+a.Sequence='{5}' and a.WorkPoint='{7}'";
  95. sql += @"update ICSWareHouseLotInfoLog set EATTRIBUTE1 ='1' , MTIME=getdate(),MUSER='{1}',MUSERName='{2}' where ID='{6}' and WorkPoint='{7}'";
  96. sql = string.Format(sql, Parameter["Quantity"].ToString(), MUSER, MUSERNAME, Parameter["LotNo"].ToString(), Parameter["TransCode"].ToString(), Parameter["TransSequence"].ToString(), Parameter["ID"].ToString(), WorkPoint);
  97. try
  98. {
  99. if (SqlHelper.CmdExecuteNonQueryLi(sql) > 0)
  100. {
  101. }
  102. else
  103. {
  104. msg = "撤销失败";
  105. }
  106. }
  107. catch (Exception ex)
  108. {
  109. throw new Exception(ex.Message);
  110. }
  111. return msg;
  112. }
  113. //领料申请单
  114. public string RevocationMOApply(string keyValue)
  115. {
  116. string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode;
  117. string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName;
  118. string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
  119. string msg = "";
  120. string sql = string.Empty;
  121. var Parameter = keyValue.ToJObject();
  122. sql += @"update ICSWareHouseLotInfo set Quantity=Quantity+'{0}',MTIME=getdate(),MUSER='{1}',MUSERName='{2}' where LotNo='{3}' and WorkPoint='{7}' ";
  123. sql += @"update ICSMOApply set IssueQuantity =IssueQuantity-'{0}' where ApplyCode='{4}' and Sequence='{5}' and WorkPoint='{7}' ";
  124. sql += @"update ICSWareHouseLotInfoLog set EATTRIBUTE1 ='1' , MTIME=getdate(),MUSER='{1}',MUSERName='{2}' where ID='{6}' and WorkPoint='{7}'";
  125. sql = string.Format(sql, Parameter["Quantity"].ToString(), MUSER, MUSERNAME, Parameter["LotNo"].ToString(), Parameter["TransCode"].ToString(), Parameter["TransSequence"].ToString(), Parameter["ID"].ToString(), WorkPoint);
  126. try
  127. {
  128. if (SqlHelper.CmdExecuteNonQueryLi(sql) > 0)
  129. {
  130. }
  131. else
  132. {
  133. msg = "撤销失败";
  134. }
  135. }
  136. catch (Exception ex)
  137. {
  138. throw new Exception(ex.Message);
  139. }
  140. return msg;
  141. }
  142. //材料出库
  143. public string RevocationMOIssue(string keyValue)
  144. {
  145. string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode;
  146. string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName;
  147. string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
  148. string msg = "";
  149. string sql = string.Empty;
  150. var Parameter = keyValue.ToJObject();
  151. sql += @"update ICSWareHouseLotInfo set Quantity=Quantity+'{0}',MTIME=getdate(),MUSER='{1}',MUSERName='{2}' where LotNo='{3}' and WorkPoint='{7}' ";
  152. sql += @"update ICSMOIssue set IssueQuantity =IssueQuantity-'{0}' where IssueCode='{4}' and Sequence='{5}' and WorkPoint='{7}' and Type='1' and Status='2'";
  153. sql += @"update ICSWareHouseLotInfoLog set EATTRIBUTE1 ='1' , MTIME=getdate(),MUSER='{1}',MUSERName='{2}' where ID='{6}' and WorkPoint='{7}'";
  154. sql = string.Format(sql, Parameter["Quantity"].ToString(), MUSER, MUSERNAME, Parameter["LotNo"].ToString(), Parameter["TransCode"].ToString(), Parameter["TransSequence"].ToString(), Parameter["ID"].ToString(), WorkPoint);
  155. try
  156. {
  157. if (SqlHelper.CmdExecuteNonQueryLi(sql) > 0)
  158. {
  159. }
  160. else
  161. {
  162. msg = "撤销失败";
  163. }
  164. }
  165. catch (Exception ex)
  166. {
  167. throw new Exception(ex.Message);
  168. }
  169. return msg;
  170. }
  171. //产成品入库-生产订单
  172. public string RevocationFinished(string keyValue)
  173. {
  174. string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode;
  175. string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName;
  176. string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
  177. string msg = "";
  178. string sql = string.Empty;
  179. var Parameter = keyValue.ToJObject();
  180. sql += @"delete from ICSWareHouseLotInfo where LotNo='{3}' and WorkPoint='{7}' ";
  181. sql += @"update ICSMO set RCVQuantity =RCVQuantity-'{0}' where MOCode='{4}' and Sequence='{5}' and WorkPoint='{7}'";
  182. sql += @"update ICSWareHouseLotInfoLog set EATTRIBUTE1 ='1' , MTIME=getdate(),MUSER='{1}',MUSERName='{2}' where ID='{6}' and WorkPoint='{7}'";
  183. sql = string.Format(sql, Parameter["Quantity"].ToString(), MUSER, MUSERNAME, Parameter["LotNo"].ToString(), Parameter["TransCode"].ToString(), Parameter["TransSequence"].ToString(), Parameter["ID"].ToString(), WorkPoint);
  184. try
  185. {
  186. if (SqlHelper.CmdExecuteNonQueryLi(sql) > 0)
  187. {
  188. }
  189. else
  190. {
  191. msg = "撤销失败";
  192. }
  193. }
  194. catch (Exception ex)
  195. {
  196. throw new Exception(ex.Message);
  197. }
  198. return msg;
  199. }
  200. //产成品入库-产成品入库单
  201. public string RevocationManufactureReceive(string keyValue)
  202. {
  203. string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode;
  204. string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName;
  205. string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
  206. string msg = "";
  207. string sql = string.Empty;
  208. var Parameter = keyValue.ToJObject();
  209. sql += @"delete from ICSWareHouseLotInfo where LotNo='{3}' and WorkPoint='{7}' ";
  210. sql += @" update ICSManufactureReceive set RCVQuantity =RCVQuantity-'{0}' where RCVCode='{4}' and Sequence='{5}' and WorkPoint='{7}' and Type='1' and Status='2'";
  211. sql += @"update ICSWareHouseLotInfoLog set EATTRIBUTE1 ='1' , MTIME=getdate(),MUSER='{1}',MUSERName='{2}' where ID='{6}' and WorkPoint='{7}'";
  212. sql = string.Format(sql, Parameter["Quantity"].ToString(), MUSER, MUSERNAME, Parameter["LotNo"].ToString(), Parameter["TransCode"].ToString(), Parameter["TransSequence"].ToString(), Parameter["ID"].ToString(), WorkPoint);
  213. try
  214. {
  215. if (SqlHelper.CmdExecuteNonQueryLi(sql) > 0)
  216. {
  217. }
  218. else
  219. {
  220. msg = "撤销失败";
  221. }
  222. }
  223. catch (Exception ex)
  224. {
  225. throw new Exception(ex.Message);
  226. }
  227. return msg;
  228. }
  229. //销售出库
  230. public string RevocationMarket(string keyValue)
  231. {
  232. string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode;
  233. string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName;
  234. string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
  235. string msg = "";
  236. string sql = string.Empty;
  237. var Parameter = keyValue.ToJObject();
  238. sql += @"update ICSWareHouseLotInfo set Quantity=Quantity+'{0}',MTIME=getdate(),MUSER='{1}',MUSERName='{2}' where LotNo='{3}' and WorkPoint='{7}' ";
  239. sql += @"update ICSSDN set SDNQuantity =SDNQuantity-'{0}' , MTIME=getdate(),MUSER='{1}',MUSERName='{2}' where SDNCode='{4}' and Sequence='{5}' and WorkPoint='{7}'";
  240. sql += @"update ICSWareHouseLotInfoLog set EATTRIBUTE1 ='1' , MTIME=getdate(),MUSER='{1}',MUSERName='{2}' where ID='{6}' and WorkPoint='{7}'";
  241. sql = string.Format(sql, Parameter["Quantity"].ToString(), MUSER, MUSERNAME, Parameter["LotNo"].ToString(), Parameter["TransCode"].ToString(), Parameter["TransSequence"].ToString(), Parameter["ID"].ToString(), WorkPoint);
  242. try
  243. {
  244. if (SqlHelper.CmdExecuteNonQueryLi(sql) > 0)
  245. {
  246. }
  247. else
  248. {
  249. msg = "撤销失败";
  250. }
  251. }
  252. catch (Exception ex)
  253. {
  254. throw new Exception(ex.Message);
  255. }
  256. return msg;
  257. }
  258. }
  259. }