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

164 lines
6.8 KiB

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}' , MTIME=getdate(),MUSER='{1}',MUSERName='{2}' 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 RevocationPicking(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 += @"update ICSWareHouseLotInfo set Quantity=Quantity+'{0}',MTIME=getdate(),MUSER='{1}',MUSERName='{2}' where LotNo='{3}' and WorkPoint='{7}' ";
  64. sql += @"update a set IssueQuantity =IssueQuantity-'{0}' , MTIME=getdate(),MUSER='{1}',MUSERName='{2}' from ICSMOPick a left join ICSMO b on a.MODetailID=b.MODetailID and a.WorkPoint=b.WorkPoint
  65. where b.MOCode='{4}' and a.Sequence='{5}' and a.WorkPoint='{7}'";
  66. sql += @"update ICSWareHouseLotInfoLog set EATTRIBUTE1 ='1' , MTIME=getdate(),MUSER='{1}',MUSERName='{2}' where ID='{6}' and WorkPoint='{7}'";
  67. sql = string.Format(sql, Parameter["Quantity"].ToString(), MUSER, MUSERNAME, Parameter["LotNo"].ToString(), Parameter["TransCode"].ToString(), Parameter["TransSequence"].ToString(), Parameter["ID"].ToString(), WorkPoint);
  68. try
  69. {
  70. if (SqlHelper.CmdExecuteNonQueryLi(sql) > 0)
  71. {
  72. }
  73. else
  74. {
  75. msg = "撤销失败";
  76. }
  77. }
  78. catch (Exception ex)
  79. {
  80. throw new Exception(ex.Message);
  81. }
  82. return msg;
  83. }
  84. //产成品入库
  85. public string RevocationFinished(string keyValue)
  86. {
  87. string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode;
  88. string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName;
  89. string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
  90. string msg = "";
  91. string sql = string.Empty;
  92. var Parameter = keyValue.ToJObject();
  93. sql += @"delete from ICSWareHouseLotInfo where LotNo='{3}' and WorkPoint='{7}' ";
  94. sql += @"update ICSMO set RCVQuantity =RCVQuantity-'{0}' , MTIME=getdate(),MUSER='{1}',MUSERName='{2}' where MOCode='{4}' and Sequence='{5}' and 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 RevocationMarket(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 ICSSDN set SDNQuantity =SDNQuantity-'{0}' , MTIME=getdate(),MUSER='{1}',MUSERName='{2}' where SDNCode='{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. }