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.

557 lines
24 KiB

  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 SalesOrderApp : RepositoryFactory<ICSVendor>
  24. {
  25. public static DataTable Invmes = new DataTable();
  26. // public static DataTable Supplier = new DataTable();
  27. /// <summary>
  28. /// 退料
  29. /// </summary>
  30. /// <param name="jqgridparam"></param>
  31. /// <returns></returns>
  32. public DataTable GetICSMOApplyNeg(ref Pagination jqgridparam)
  33. {
  34. DataTable dt = new DataTable();
  35. List<DbParameter> parameter = new List<DbParameter>();
  36. string sql = @" select distinct a.SDNCode,a.Status,a.Type,a.CreatePerson,a.CreateDateTime,a.MUSER,a.MUSERName,a.CusCode,a.WHCode
  37. from ICSSDN a
  38. where a.Type='3'";
  39. sql = string.Format(sql);
  40. DataTable dttest = Repository().FindTablePageBySql(sql.ToString(), parameter.ToArray(), ref jqgridparam);
  41. return Repository().FindTablePageBySql(sql.ToString(), parameter.ToArray(), ref jqgridparam);
  42. }
  43. //子表查询
  44. public DataTable GetICSMOApplyNegDetail(string POCode, ref Pagination jqgridparam)
  45. {
  46. string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
  47. DataTable dt = new DataTable();
  48. //var queryParam = queryJson.ToJObject();
  49. List<DbParameter> parameter = new List<DbParameter>();
  50. string sql = @"select a.ID,a.SDNCode,a.Sequence,a.InvCode,a.Amount,a.Quantity,a.ExtensionID,a.MUSER
  51. ,a.MUSERName,a.MTIME
  52. ,f.Colspan ,f.ProjectCode ,f.BatchCode ,f.Version ,f.Brand ,f.cFree1 ,f.cFree2 ,f.cFree3 ,f.cFree4
  53. ,f.cFree5 ,f.cFree6 ,f.cFree7 ,f.cFree8 ,f.cFree9 ,f.cFree10,a.EATTRIBUTE1,a.EATTRIBUTE2,a.EATTRIBUTE3,a.EATTRIBUTE4,a.EATTRIBUTE5,a.EATTRIBUTE6,a.EATTRIBUTE7,a.EATTRIBUTE8,
  54. a.EATTRIBUTE9,a.EATTRIBUTE10
  55. from ICSSDN a
  56. left join ICSExtension f on a.ExtensionID=f.ID and a.WorkPoint=f.WorkPoint
  57. WHERE a.SDNCode='" + POCode + "' ";
  58. return Repository().FindTablePageBySql(sql.ToString(), parameter.ToArray(), ref jqgridparam);
  59. }
  60. public DataTable GetINV(string invcode, ref Pagination jqgridparam)
  61. {
  62. string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
  63. List<DbParameter> parameter = new List<DbParameter>();
  64. DataTable table = new DataTable();
  65. string wherestr = "";
  66. if (!string.IsNullOrEmpty(invcode))
  67. {
  68. //wherestr += " and a.InvCode like '%" + invcode + "%'";
  69. wherestr += " and InvCode like '%" + invcode + "%'";
  70. }
  71. // string sql = @"SELECT DISTINCT a.ID,a.SDNCode,a.Sequence,a.InvCode,a.Quantity,a.Amount,b.InvName,b.InvStd,b.InvUnit,a.ExtensionID
  72. //,f.Colspan,isnull(f.ProjectCode,'') AS ProjectCode ,isnull(f.BatchCode,'') AS BatchCode ,isnull(f.Version,'') AS Version ,isnull(f.Brand,'') AS Brand ,isnull(f.cFree1,'') AS cFree1,isnull(f.cFree2,'') AS cFree2,isnull(f.cFree3,'') AS cFree3 ,isnull(f.cFree4,'') AS cFree4
  73. //,isnull(f.cFree5,'') AS cFree5 ,isnull(f.cFree6,'') AS cFree6 ,isnull(f.cFree7,'') AS cFree7 ,isnull(f.cFree8,'') AS cFree8 ,isnull(f.cFree9,'') AS cFree9 ,isnull(f.cFree10,'') AS cFree10
  74. //FROM ICSSDN a
  75. //left JOIN ICSInventory b ON a.InvCode = b.InvCode and a.WorkPoint=b.WorkPoint
  76. // left join ICSExtension f on a.ExtensionID=f.ID and a.WorkPoint=f.WorkPoint
  77. //where a.WorkPoint = '" + WorkPoint + "'" + wherestr;
  78. string sql = @"select ID, InvCode ,InvName ,InvStd ,InvUnit ,ClassCode ,ClassName from ICSInventory where WorkPoint = '" + WorkPoint + "'" + wherestr;
  79. return Repository().FindTablePageBySql(sql.ToString(), parameter.ToArray(), ref jqgridparam);
  80. }
  81. public DataTable GetICSMOPickLog(string invcode, ref Pagination jqgridparam)
  82. {
  83. string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
  84. List<DbParameter> parameter = new List<DbParameter>();
  85. DataTable table = new DataTable();
  86. //string wherestr = "";
  87. //if (!string.IsNullOrEmpty(invcode))
  88. //{
  89. // wherestr += " and a.InvCode like '%" + invcode + "'%";
  90. //}
  91. string sql = @" select distinct a.SDNCode,a.Sequence,a.Quantity,a.Amount,a.ID,a.InvCode
  92. ,f.Colspan ,f.ProjectCode ,f.BatchCode ,f.Version ,f.Brand ,f.cFree1 ,f.cFree2 ,f.cFree3 ,f.cFree4
  93. ,f.cFree5 ,f.cFree6 ,f.cFree7 ,f.cFree8 ,f.cFree9 ,f.cFree10
  94. from ICSSDN a
  95. left join ICSExtension f on a.ExtensionID=f.ID
  96. where a.InvCode='{0}' and a.WorkPoint='{1}'
  97. ";
  98. sql = string.Format(sql, invcode, WorkPoint);
  99. return Repository().FindTablePageBySql(sql.ToString(), parameter.ToArray(), ref jqgridparam);
  100. }
  101. /// <summary>
  102. /// 获取仓库列表
  103. /// </summary>
  104. /// <returns></returns>
  105. public DataTable GetInvCode()
  106. {
  107. string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
  108. string sql = @"
  109. select '' as InvCode,
  110. union all
  111. select InvCode from ICSInventory where WorkPoint='{0}'
  112. ";
  113. //string role = NFine.Code.OperatorProvider.Provider.GetCurrent().RoleEnCode;
  114. //if (role != "admin")
  115. //{
  116. // sql += " and b.WorkPoint=" + WorkPoint.TrimEnd(',') + "";
  117. //}
  118. sql = string.Format(sql, WorkPoint);
  119. DataTable dt = SqlHelper.GetDataTableBySql(sql);
  120. return dt;
  121. }
  122. public DataTable GetICSReturnTemporary(string rfqno)
  123. {
  124. string sql = @"SELECT
  125. a.SDNCode,
  126. a.InvCode,
  127. a.Quantity,
  128. a.Amount,
  129. b.InvName,
  130. b.InvStd,
  131. b.InvUnit
  132. ,f.Colspan ,f.ProjectCode ,f.BatchCode ,f.Version ,f.Brand ,f.cFree1 ,f.cFree2 ,f.cFree3 ,f.cFree4
  133. ,f.cFree5 ,f.cFree6 ,f.cFree7 ,f.cFree8 ,f.cFree9 ,f.cFree10
  134. FROM
  135. ICSSDN a
  136. LEFT JOIN ICSInventory b ON a.InvCode = b.InvCode
  137. left join ICSExtension f on a.ExtensionID=f.ID and a.WorkPoint=f.WorkPoint
  138. where a.SDNCode='" + rfqno + "'";
  139. DataTable table = Repository().FindDataSetBySql(sql).Tables[0];
  140. DataTable dtCloned = table.Clone();
  141. foreach (DataColumn col in dtCloned.Columns)
  142. {
  143. col.DataType = typeof(string);
  144. }
  145. foreach (DataRow row in table.Rows)
  146. {
  147. DataRow newrow = dtCloned.NewRow();
  148. foreach (DataColumn column in dtCloned.Columns)
  149. {
  150. newrow[column.ColumnName] = row[column.ColumnName].ToString();
  151. }
  152. dtCloned.Rows.Add(newrow);
  153. }
  154. if (Invmes.Rows.Count > 0)
  155. {
  156. dtCloned.Merge(Invmes, false);
  157. }
  158. return dtCloned;
  159. }
  160. public string GetNewid()
  161. {
  162. string sql = "select newid() AS ID";
  163. return Repository().FindTableBySql(sql, null).Rows[0]["ID"].ToString();
  164. }
  165. public void AddPurOrderTemp(string json)
  166. {
  167. var data = json.ToJObject();
  168. if (Invmes.Columns.Count <= 0)
  169. {
  170. //Invmes.Columns.Add("ID", typeof(string));
  171. //Invmes.Columns.Add("PoCode", typeof(string));
  172. Invmes.Columns.Add("InvCode", typeof(string));
  173. Invmes.Columns.Add("InvName", typeof(string));
  174. Invmes.Columns.Add("InvStd", typeof(string));
  175. Invmes.Columns.Add("InvUnit", typeof(string));
  176. Invmes.Columns.Add("Quantity", typeof(string));
  177. //Invmes.Columns.Add("IssueQuantity", typeof(string));
  178. Invmes.Columns.Add("ExtensionID", typeof(string));
  179. Invmes.Columns.Add("Amount", typeof(string));
  180. Invmes.Columns.Add("ID", typeof(string));
  181. Invmes.Columns.Add("ProjectCode", typeof(string));
  182. Invmes.Columns.Add("BatchCode", typeof(string));
  183. Invmes.Columns.Add("Version", typeof(string));
  184. Invmes.Columns.Add("Brand", typeof(string));
  185. Invmes.Columns.Add("cFree1", typeof(string));
  186. Invmes.Columns.Add("cFree2", typeof(string));
  187. Invmes.Columns.Add("cFree3", typeof(string));
  188. Invmes.Columns.Add("cFree4", typeof(string));
  189. Invmes.Columns.Add("cFree5", typeof(string));
  190. Invmes.Columns.Add("cFree6", typeof(string));
  191. Invmes.Columns.Add("cFree7", typeof(string));
  192. Invmes.Columns.Add("cFree8", typeof(string));
  193. Invmes.Columns.Add("cFree9", typeof(string));
  194. Invmes.Columns.Add("cFree10", typeof(string));
  195. }
  196. string usercode = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode;
  197. DataRow newrow = Invmes.NewRow();
  198. //newrow["ID"] = data["ID"];
  199. //newrow["PoCode"] = data["PoCode"];
  200. newrow["InvName"] = data["InvName"];
  201. newrow["InvCode"] = data["InvCode"];
  202. newrow["InvStd"] = data["InvStd"];
  203. newrow["InvUnit"] = data["InvUnit"];
  204. newrow["Amount"] = data["Amount"];
  205. //newrow["IssueQuantity"] = data["IssueQuantity"];
  206. newrow["ExtensionID"] = data["ExtensionID"];
  207. newrow["Quantity"] = "";
  208. newrow["ID"] = data["ID"];
  209. newrow["ProjectCode"] = data["ProjectCode"];
  210. newrow["BatchCode"] = data["BatchCode"];
  211. newrow["Version"] = data["Version"];
  212. newrow["Brand"] = data["Brand"];
  213. newrow["cFree1"] = data["cFree1"];
  214. newrow["cFree2"] = data["cFree2"];
  215. newrow["cFree3"] = data["cFree3"];
  216. newrow["cFree4"] = data["cFree4"];
  217. newrow["cFree5"] = data["cFree5"];
  218. newrow["cFree6"] = data["cFree6"];
  219. newrow["cFree7"] = data["cFree7"];
  220. newrow["cFree8"] = data["cFree8"];
  221. newrow["cFree9"] = data["cFree9"];
  222. newrow["cFree10"] = data["cFree10"];
  223. Invmes.Rows.Add(newrow);
  224. }
  225. public string DeleteMopick(string json)
  226. {
  227. try
  228. {
  229. string wheresql = "(";
  230. string[] id = json.Split(',');
  231. for (int i = 0; i < id.Length; i++)
  232. {
  233. wheresql += "'" + id[i].Replace(']', ' ').Replace('[', ' ').Replace('"', ' ').Trim() + "',";
  234. }
  235. wheresql = wheresql.Trim(',') + ")";
  236. string sql = "delete from ICSMOApplyNeg where id in" + wheresql;
  237. int count = DbHelper.ExecuteNonQuery(CommandType.Text, sql);
  238. DataRow[] row = Invmes.Select("ID in " + wheresql + "");
  239. foreach (DataRow a in row)
  240. {
  241. Invmes.Rows.Remove(a);
  242. }
  243. return "删除成功!";
  244. }
  245. catch (Exception ex)
  246. {
  247. return ex.Message + " 删除失败!";
  248. }
  249. }
  250. public void ClearTemp()
  251. {
  252. Invmes.Rows.Clear();
  253. }
  254. public string SaveICSPurOrder(string ICSASN)
  255. {
  256. string msg = "";
  257. string APIURL = ConfigurationManager.ConnectionStrings["APIURL"].ConnectionString + "SalesOrderCreate/Create";
  258. string result = HttpPost(APIURL, ICSASN);
  259. JObject Obj = (JObject)JsonConvert.DeserializeObject(result);//或者JObject jo = JObject.Parse(jsonText);
  260. string MessAge = Obj["Message"].ToString();
  261. string Success = Obj["Success"].ToString();
  262. if (Success.ToUpper() == "FALSE")
  263. {
  264. msg = MessAge;
  265. }
  266. return msg;
  267. }
  268. public string UpdateICSPurOrder(string ICSASN)
  269. {
  270. string msg = "";
  271. string APIURL = ConfigurationManager.ConnectionStrings["APIURL"].ConnectionString + "SalesOrderUpdate/Update";
  272. string result = HttpPost(APIURL, ICSASN);
  273. JObject Obj = (JObject)JsonConvert.DeserializeObject(result);//或者JObject jo = JObject.Parse(jsonText);
  274. string MessAge = Obj["Message"].ToString();
  275. string Success = Obj["Success"].ToString();
  276. if (Success.ToUpper() == "FALSE")
  277. {
  278. msg = MessAge;
  279. }
  280. return msg;
  281. }
  282. //接口api解析
  283. public static string HttpPost(string url, string body)
  284. {
  285. try
  286. {
  287. Encoding encoding = Encoding.UTF8;
  288. HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
  289. request.Method = "POST";
  290. request.Accept = "application/json, text/javascript, */*"; //"text/html, application/xhtml+xml, */*";
  291. request.ContentType = "application/json; charset=utf-8";
  292. byte[] buffer = encoding.GetBytes(body);
  293. request.ContentLength = buffer.Length;
  294. request.GetRequestStream().Write(buffer, 0, buffer.Length);
  295. HttpWebResponse response = (HttpWebResponse)request.GetResponse();
  296. using (StreamReader reader = new StreamReader(response.GetResponseStream(), encoding))
  297. {
  298. return reader.ReadToEnd();
  299. }
  300. }
  301. catch (WebException ex)
  302. {
  303. throw new Exception(ex.Message);
  304. }
  305. }
  306. /// <summary>
  307. /// 获取料品属性修改文本框值
  308. /// </summary>
  309. /// <param name="POCode"></param>
  310. /// <param name="PORow"></param>
  311. /// <returns></returns>
  312. public DataTable GetInputValue(string ID)
  313. {
  314. try
  315. {
  316. DataTable dt = new DataTable();
  317. //var queryParam = queryJson.ToJObject();
  318. List<DbParameter> parameter = new List<DbParameter>();
  319. string sql = @"select InvCode,InvName,InvDesc,InvStd,InvUnit,AmountUnit, ClassCode,ClassName,InvRate,InvVersion,InvBrand,InvIQC,
  320. InvFQC,EffectiveEnable,EffectiveDays,BatchEnable,LotEnable,PrintEnable,WHUser
  321. from ICSInventory
  322. WHERE 1=1 AND ID='{0}' ";
  323. sql = string.Format(sql, ID);
  324. return Repository().FindTableBySql(sql.ToString());
  325. }
  326. catch (Exception ex)
  327. {
  328. throw new Exception(ex.Message.ToString());
  329. }
  330. }
  331. public DataTable GetICSMOApplyNegDetailTemp(string PoCode)
  332. {
  333. string sql = @"SELECT DISTINCT
  334. a.ID,
  335. a.ID as TLZID,
  336. a.SDNCode,
  337. a.InvCode,
  338. a.Quantity,
  339. a.Amount,
  340. b.InvName,
  341. b.InvStd,
  342. b.InvUnit,a.CusCode,a.WHCode,
  343. a.ExtensionID
  344. ,f.Colspan ,f.ProjectCode ,f.BatchCode ,f.Version ,f.Brand ,f.cFree1 ,f.cFree2 ,f.cFree3 ,f.cFree4
  345. ,f.cFree5 ,f.cFree6 ,f.cFree7 ,f.cFree8 ,f.cFree9 ,f.cFree10
  346. FROM
  347. ICSSDN a
  348. LEFT JOIN ICSInventory b ON a.InvCode = b.InvCode
  349. left join ICSExtension f on a.ExtensionID=f.ID and a.WorkPoint=f.WorkPoint
  350. where a.SDNCode='" + PoCode + "'";
  351. DataTable table = Repository().FindDataSetBySql(sql).Tables[0];
  352. if(Invmes==null || Invmes.Columns.Count<=0)
  353. Invmes = table.Clone();
  354. DataTable dtCloned = table.Clone();
  355. foreach (DataColumn col in dtCloned.Columns)
  356. {
  357. col.DataType = typeof(string);
  358. }
  359. foreach (DataRow row in table.Rows)
  360. {
  361. DataRow newrow = dtCloned.NewRow();
  362. foreach (DataColumn column in dtCloned.Columns)
  363. {
  364. newrow[column.ColumnName] = row[column.ColumnName].ToString();
  365. }
  366. dtCloned.Rows.Add(newrow);
  367. }
  368. if (Invmes.Rows.Count > 0)
  369. {
  370. //dtCloned.Merge(Invmes, false);
  371. foreach (DataRow data in Invmes.Rows)
  372. {
  373. var info = dtCloned.Select(string.Format("TLZID='{0}'", data["TLZID"]));
  374. if (info != null && info.Length > 0)
  375. {
  376. info[0]["ZJID"] = data["ZJID"];
  377. info[0]["InvName"] = data["InvName"];
  378. info[0]["InvCode"] = data["InvCode"];
  379. info[0]["InvStd"] = data["InvStd"];
  380. info[0]["InvUnit"] = data["InvUnit"];
  381. info[0]["Amount"] = data["Amount"];
  382. info[0]["IssueNegQuantity"] = data["IssueNegQuantity"];
  383. info[0]["ExtensionID"] = data["ExtensionID"];
  384. info[0]["Quantity"] = 0;
  385. info[0]["ProjectCode"] = data["ProjectCode"];
  386. info[0]["BatchCode"] = data["BatchCode"];
  387. info[0]["Version"] = data["Version"];
  388. info[0]["Brand"] = data["Brand"];
  389. info[0]["cFree1"] = data["cFree1"];
  390. info[0]["cFree2"] = data["cFree2"];
  391. info[0]["cFree3"] = data["cFree3"];
  392. info[0]["cFree4"] = data["cFree4"];
  393. info[0]["cFree5"] = data["cFree5"];
  394. info[0]["cFree6"] = data["cFree6"];
  395. info[0]["cFree7"] = data["cFree7"];
  396. info[0]["cFree8"] = data["cFree8"];
  397. info[0]["cFree9"] = data["cFree9"];
  398. info[0]["cFree10"] = data["cFree10"];
  399. }
  400. else
  401. {
  402. DataRow newrow = dtCloned.NewRow();
  403. newrow["ZJID"] = data["ZJID"];
  404. newrow["InvName"] = data["InvName"];
  405. newrow["InvCode"] = data["InvCode"];
  406. newrow["InvStd"] = data["InvStd"];
  407. newrow["InvUnit"] = data["InvUnit"];
  408. newrow["Amount"] = data["Amount"];
  409. newrow["Quantity"] = 0;
  410. newrow["ID"] = data["ID"];
  411. newrow["TLZID"] = data["TLZID"];
  412. newrow["IssueNegQuantity"] = data["IssueNegQuantity"];
  413. newrow["ExtensionID"] = data["ExtensionID"];
  414. newrow["ProjectCode"] = data["ProjectCode"];
  415. newrow["BatchCode"] = data["BatchCode"];
  416. newrow["Version"] = data["Version"];
  417. newrow["Brand"] = data["Brand"];
  418. newrow["cFree1"] = data["cFree1"];
  419. newrow["cFree2"] = data["cFree2"];
  420. newrow["cFree3"] = data["cFree3"];
  421. newrow["cFree4"] = data["cFree4"];
  422. newrow["cFree5"] = data["cFree5"];
  423. newrow["cFree6"] = data["cFree6"];
  424. newrow["cFree7"] = data["cFree7"];
  425. newrow["cFree8"] = data["cFree8"];
  426. newrow["cFree9"] = data["cFree9"];
  427. newrow["cFree10"] = data["cFree10"];
  428. dtCloned.Rows.Add(newrow);
  429. }
  430. }
  431. }
  432. return dtCloned;
  433. }
  434. public void UpdateMOApplyNegTemp(string json)
  435. {
  436. var data = json.ToJObject();
  437. string usercode = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode;
  438. var info = Invmes.Select(string.Format("TLZID='{0}'", data["TLZID"]));
  439. if (info != null && info.Length > 0)
  440. {
  441. info[0]["ZJID"] = data["ZJID"];
  442. info[0]["InvName"] = data["InvName"];
  443. info[0]["InvCode"] = data["InvCode"];
  444. info[0]["InvStd"] = data["InvStd"];
  445. info[0]["InvUnit"] = data["InvUnit"];
  446. info[0]["Amount"] = data["Amount"];
  447. info[0]["IssueNegQuantity"] = data["IssueNegQuantity"];
  448. info[0]["ExtensionID"] = data["ExtensionID"];
  449. info[0]["Quantity"] = 0;
  450. }
  451. else
  452. {
  453. DataRow newrow = Invmes.NewRow();
  454. newrow["ZJID"] = data["ZJID"];
  455. newrow["InvName"] = data["InvName"];
  456. newrow["InvCode"] = data["InvCode"];
  457. newrow["InvStd"] = data["InvStd"];
  458. newrow["InvUnit"] = data["InvUnit"];
  459. newrow["Amount"] = data["Amount"];
  460. newrow["IssueNegQuantity"] = data["IssueNegQuantity"];
  461. newrow["ExtensionID"] = data["ExtensionID"];
  462. newrow["Quantity"] = 0;
  463. newrow["ID"] = data["ID"];
  464. newrow["TLZID"] = data["TLZID"];
  465. Invmes.Rows.Add(newrow);
  466. }
  467. }
  468. public string AuditICSPurOrder(string ICSASN)
  469. {
  470. string msg = "";
  471. string APIURL = ConfigurationManager.ConnectionStrings["APIURL"].ConnectionString + "SalesOrderApprove/Approve";
  472. string result = HttpPost(APIURL, ICSASN);
  473. JObject Obj = (JObject)JsonConvert.DeserializeObject(result);//或者JObject jo = JObject.Parse(jsonText);
  474. string MessAge = Obj["Message"].ToString();
  475. string Success = Obj["Success"].ToString();
  476. if (Success.ToUpper() == "FALSE")
  477. {
  478. msg = MessAge;
  479. }
  480. return msg;
  481. }
  482. public string DeleteICSPurchaseOrder(string keyValue)
  483. {
  484. //站点信息
  485. string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
  486. string msg = "";
  487. keyValue = keyValue.Substring(1, keyValue.Length - 2);
  488. string sql = string.Empty;
  489. sql += string.Format(@"IF EXISTS(SELECT 1 FROM ICSSDN WHERE SDNCode IN ({0}) and WorkPoint ='{1}' and SDNQuantity>0)
  490. BEGIN
  491. RAISERROR('',16,1);
  492. RETURN
  493. END
  494. ELSE
  495. BEGIN
  496. DELETE FROM ICSSDN WHERE SDNCode IN ({0}) and WorkPoint ='{1}'
  497. END", keyValue.TrimEnd(','), WorkPoint);
  498. try
  499. {
  500. SqlHelper.ExecuteNonQuery(sql);
  501. }
  502. catch (Exception ex)
  503. {
  504. msg = ex.Message;
  505. }
  506. return msg;
  507. }
  508. }
  509. }