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.

540 lines
22 KiB

1 year ago
1 year ago
1 year ago
12 months ago
12 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year 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 ProductionIssueApp : 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(string queryJson,ref Pagination jqgridparam)
  33. {
  34. DataTable dt = new DataTable();
  35. var queryParam = queryJson.ToJObject();
  36. List<DbParameter> parameter = new List<DbParameter>();
  37. string sql = @" select a.ID,a.ApplyNegCode,a.WHCode,b.WarehouseName,a.Status,a.Type,a.Memo,a.CreatePerson,a.CreateDateTime,a.MUSER,a.MUSERName
  38. ,a.EATTRIBUTE1,a.EATTRIBUTE2,a.EATTRIBUTE3,a.EATTRIBUTE4,a.EATTRIBUTE5,a.EATTRIBUTE6,a.EATTRIBUTE7,a.EATTRIBUTE8,
  39. a.EATTRIBUTE9,a.EATTRIBUTE10
  40. from ICSMOApplyNeg a
  41. left join ICSWarehouse b on a.WHCode=b.WarehouseCode and a.WorkPoint=b.WorkPoint
  42. where a.Type='1' ";
  43. if (!string.IsNullOrWhiteSpace(queryJson))
  44. {
  45. if (!string.IsNullOrWhiteSpace(queryParam["Code"].ToString()))
  46. {
  47. sql += " and a.ApplyNegCode like '%" + queryParam["Code"].ToString() + "%' ";
  48. }
  49. if (!string.IsNullOrWhiteSpace(queryParam["UserCode"].ToString()))
  50. {
  51. sql += " and a.MUSER like '%" + queryParam["UserCode"].ToString() + "%' ";
  52. }
  53. }
  54. // DataTable dttest = Repository().FindTablePageBySql(sql.ToString(), parameter.ToArray(), ref jqgridparam);
  55. return Repository().FindTablePageBySql(sql.ToString(), parameter.ToArray(), ref jqgridparam);
  56. }
  57. //子表查询
  58. public DataTable GetICSMOApplyNegDetail(string ApplyNegCode, ref Pagination jqgridparam)
  59. {
  60. string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
  61. DataTable dt = new DataTable();
  62. //var queryParam = queryJson.ToJObject();
  63. List<DbParameter> parameter = new List<DbParameter>();
  64. string sql = @"select a.ID,a.ApplyNegCode,a.Sequence,a.SourceDetailID,a.InvCode,a.Quantity,a.Amount,a.IssueNegQuantity,a.ExtensionID,a.MUSER,y.MOCode
  65. ,a.MUSERName,a.MTIME
  66. ,f.Colspan ,f.ProjectCode ,f.BatchCode ,f.Version ,f.Brand ,f.cFree1 ,f.cFree2 ,f.cFree3 ,f.cFree4
  67. ,f.cFree5 ,f.cFree6 ,f.cFree7 ,f.cFree8 ,f.cFree9 ,f.cFree10,x.EATTRIBUTE1,x.EATTRIBUTE2,x.EATTRIBUTE3,x.EATTRIBUTE4,x.EATTRIBUTE5,x.EATTRIBUTE6,x.EATTRIBUTE7,x.EATTRIBUTE8,
  68. x.EATTRIBUTE9,x.EATTRIBUTE10
  69. from ICSMOApplyNegDetail a
  70. left join ICSExtension f on a.ExtensionID=f.ID and a.WorkPoint=f.WorkPoint
  71. inner JOIN ICSMOPick x ON a.SourceDetailID=x.PickID AND a.WorkPoint=x.WorkPoint
  72. LEFT JOIN ICSMO y ON x.MODetailID=y.MODetailID AND x.WorkPoint=y.WorkPoint
  73. WHERE a.ApplyNegCode='" + ApplyNegCode + "' ";
  74. return Repository().FindTablePageBySql(sql.ToString(), parameter.ToArray(), ref jqgridparam);
  75. }
  76. public DataTable GetINV(string invcode, string Code, string Invstd,string EATTRIBUTE2, ref Pagination jqgridparam)
  77. {
  78. string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
  79. List<DbParameter> parameter = new List<DbParameter>();
  80. DataTable table = new DataTable();
  81. string wherestr = "";
  82. if (!string.IsNullOrEmpty(invcode))
  83. {
  84. wherestr += " and a.InvCode like '%" + invcode + "%'";
  85. }
  86. if (!string.IsNullOrEmpty(Code))
  87. {
  88. wherestr += " and c.MOCode like '%" + Code + "%'";
  89. }
  90. if (!string.IsNullOrEmpty(Invstd))
  91. {
  92. wherestr += " and b.InvStd like '%" + Invstd + "%'";
  93. }
  94. if (!string.IsNullOrEmpty(EATTRIBUTE2))
  95. {
  96. wherestr += " and a.EATTRIBUTE2 like '%" + EATTRIBUTE2 + "%'";
  97. }
  98. string sql = @" SELECT DISTINCT a.PickID as ZJID,c.MOCode,c.Sequence as MuHang,a.InvCode,a.Quantity,a.Amount,b.InvName,b.InvStd,b.InvUnit
  99. ,a.IssueQuantity,a.ExtensionID ,a.EATTRIBUTE2
  100. ,f.Colspan ,f.ProjectCode ,f.BatchCode ,f.Version ,f.Brand ,f.cFree1 ,f.cFree2 ,f.cFree3 ,f.cFree4
  101. ,f.cFree5 ,f.cFree6 ,f.cFree7 ,f.cFree8 ,f.cFree9 ,f.cFree10
  102. FROM ICSMOPick a
  103. left JOIN ICSInventory b ON a.InvCode = b.InvCode and a.WorkPoint=b.WorkPoint
  104. inner join ICSMO c on a.MODetailID=c.MODetailID and a.WorkPoint=c.WorkPoint and c.MOStatus<>'3' and c.ApsStatus='Y' and isnull(c.OrderStatus,'') <> 'Close'
  105. left join ICSExtension f on a.ExtensionID=f.ID and a.WorkPoint=f.WorkPoint
  106. where a.IssueQuantity>0 and a.WorkPoint = '" + WorkPoint + "'" + wherestr;
  107. return Repository().FindTablePageBySql(sql.ToString(), parameter.ToArray(), ref jqgridparam);
  108. }
  109. public DataTable GetICSMOPickLog(string invcode, ref Pagination jqgridparam)
  110. {
  111. string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
  112. List<DbParameter> parameter = new List<DbParameter>();
  113. DataTable table = new DataTable();
  114. //string wherestr = "";
  115. //if (!string.IsNullOrEmpty(invcode))
  116. //{
  117. // wherestr += " and a.InvCode like '%" + invcode + "'%";
  118. //}
  119. string sql = @" select distinct a.WHCode,b.MOCode,b.Sequence,a.Sequence as ZJHH,c.BatchCode,a.Quantity,a.Amount,a.ID,a.InvCode
  120. ,f.Colspan ,f.ProjectCode ,f.BatchCode ,f.Version ,f.Brand ,f.cFree1 ,f.cFree2 ,f.cFree3 ,f.cFree4
  121. ,f.cFree5 ,f.cFree6 ,f.cFree7 ,f.cFree8 ,f.cFree9 ,f.cFree10
  122. from ICSMOPick a
  123. left join ICSMO b on b.ID=a.MODetailID and b.WorkPoint=a.WorkPoint and b.MOStatus<>'3'
  124. left join ICSExtension f on a.ExtensionID=f.ID
  125. where a.InvCode='{0}' and a.WorkPoint='{1}'
  126. ";
  127. sql = string.Format(sql, invcode, WorkPoint);
  128. return Repository().FindTablePageBySql(sql.ToString(), parameter.ToArray(), ref jqgridparam);
  129. }
  130. /// <summary>
  131. /// 获取仓库列表
  132. /// </summary>
  133. /// <returns></returns>
  134. public DataTable GetWHCode()
  135. {
  136. string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
  137. string sql = @"
  138. select '' as WarehouseCode,'' as WarehouseName
  139. union all
  140. select WarehouseCode,WarehouseName from ICSWarehouse where Enable='1' and WorkPoint='{0}'
  141. ";
  142. //string role = NFine.Code.OperatorProvider.Provider.GetCurrent().RoleEnCode;
  143. //if (role != "admin")
  144. //{
  145. // sql += " and b.WorkPoint=" + WorkPoint.TrimEnd(',') + "";
  146. //}
  147. sql = string.Format(sql, WorkPoint);
  148. DataTable dt = SqlHelper.GetDataTableBySql(sql);
  149. return dt;
  150. }
  151. public DataTable GetICSReturnTemporary(string rfqno)
  152. {
  153. string sql = @"SELECT
  154. a.ApplyNegCode,
  155. a.InvCode,
  156. a.Quantity,
  157. a.Amount,
  158. a.SourceDetailID as ZJID,
  159. b.InvName,
  160. b.InvStd,
  161. b.InvUnit
  162. ,f.Colspan ,f.ProjectCode ,f.BatchCode ,f.Version ,f.Brand ,f.cFree1 ,f.cFree2 ,f.cFree3 ,f.cFree4
  163. ,f.cFree5 ,f.cFree6 ,f.cFree7 ,f.cFree8 ,f.cFree9 ,f.cFree10
  164. FROM
  165. ICSMOApplyNegDetail a
  166. LEFT JOIN ICSInventory b ON a.InvCode = b.InvCode
  167. left join ICSExtension f on a.ExtensionID=f.ID and a.WorkPoint=f.WorkPoint
  168. where a.ApplyNegCode='" + rfqno + "'";
  169. DataTable table = Repository().FindDataSetBySql(sql).Tables[0];
  170. DataTable dtCloned = table.Clone();
  171. foreach (DataColumn col in dtCloned.Columns)
  172. {
  173. col.DataType = typeof(string);
  174. }
  175. foreach (DataRow row in table.Rows)
  176. {
  177. DataRow newrow = dtCloned.NewRow();
  178. foreach (DataColumn column in dtCloned.Columns)
  179. {
  180. newrow[column.ColumnName] = row[column.ColumnName].ToString();
  181. }
  182. dtCloned.Rows.Add(newrow);
  183. }
  184. if (Invmes.Rows.Count > 0)
  185. {
  186. dtCloned.Merge(Invmes, false);
  187. }
  188. return dtCloned;
  189. }
  190. public string GetNewid()
  191. {
  192. string sql = "select newid() AS ID";
  193. return Repository().FindTableBySql(sql, null).Rows[0]["ID"].ToString();
  194. }
  195. public void AddMOApplyNegTemp(string json)
  196. {
  197. var data = json.ToJObject();
  198. if (Invmes.Columns.Count <= 0)
  199. {
  200. Invmes.Columns.Add("ZJID", typeof(string));
  201. Invmes.Columns.Add("InvCode", typeof(string));
  202. Invmes.Columns.Add("INVNAME", typeof(string));
  203. Invmes.Columns.Add("InvStd", typeof(string));
  204. Invmes.Columns.Add("InvUnit", typeof(string));
  205. Invmes.Columns.Add("Quantity", typeof(string));
  206. Invmes.Columns.Add("IssueQuantity", typeof(string));
  207. Invmes.Columns.Add("ExtensionID", typeof(string));
  208. Invmes.Columns.Add("Amount", typeof(string));
  209. Invmes.Columns.Add("ID", typeof(string));
  210. }
  211. string usercode = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode;
  212. DataRow newrow = Invmes.NewRow();
  213. newrow["ZJID"] = data["ZJID"];
  214. newrow["InvName"] = data["InvName"];
  215. newrow["InvCode"] = data["InvCode"];
  216. newrow["InvStd"] = data["InvStd"];
  217. newrow["InvUnit"] = data["InvUnit"];
  218. newrow["Amount"] = data["Amount"];
  219. newrow["IssueQuantity"] = data["IssueQuantity"];
  220. newrow["ExtensionID"] = data["ExtensionID"];
  221. newrow["Quantity"] = "";
  222. newrow["ID"] = data["ID"];
  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 SaveICSMOApplyNeg(string ICSASN)
  255. {
  256. string msg = "";
  257. string APIURL = ConfigurationManager.ConnectionStrings["APIURL"].ConnectionString + "AMMOIssueDocNegativeApply/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 UpdateICSMOApplyNeg(string ICSASN)
  269. {
  270. string msg = "";
  271. string APIURL = ConfigurationManager.ConnectionStrings["APIURL"].ConnectionString + "AMMOIssueDocNegativeApply/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 ApplyNegCode)
  332. {
  333. string sql = @"SELECT
  334. a.ID,
  335. a.ID as TLZID,
  336. a.ApplyNegCode,
  337. a.InvCode,
  338. a.Quantity,
  339. a.Amount,
  340. a.SourceDetailID as ZJID,
  341. b.InvName,
  342. b.InvStd,
  343. b.InvUnit,
  344. a.IssueNegQuantity,
  345. a.ExtensionID
  346. ,f.Colspan ,f.ProjectCode ,f.BatchCode ,f.Version ,f.Brand ,f.cFree1 ,f.cFree2 ,f.cFree3 ,f.cFree4
  347. ,f.cFree5 ,f.cFree6 ,f.cFree7 ,f.cFree8 ,f.cFree9 ,f.cFree10
  348. FROM
  349. ICSMOApplyNegDetail a
  350. LEFT JOIN ICSInventory b ON a.InvCode = b.InvCode
  351. left join ICSExtension f on a.ExtensionID=f.ID and a.WorkPoint=f.WorkPoint
  352. where a.ApplyNegCode='" + ApplyNegCode + "'";
  353. DataTable table = Repository().FindDataSetBySql(sql).Tables[0];
  354. if(Invmes==null || Invmes.Columns.Count<=0)
  355. Invmes = table.Clone();
  356. DataTable dtCloned = table.Clone();
  357. foreach (DataColumn col in dtCloned.Columns)
  358. {
  359. col.DataType = typeof(string);
  360. }
  361. foreach (DataRow row in table.Rows)
  362. {
  363. DataRow newrow = dtCloned.NewRow();
  364. foreach (DataColumn column in dtCloned.Columns)
  365. {
  366. newrow[column.ColumnName] = row[column.ColumnName].ToString();
  367. }
  368. dtCloned.Rows.Add(newrow);
  369. }
  370. if (Invmes.Rows.Count > 0)
  371. {
  372. //dtCloned.Merge(Invmes, false);
  373. foreach (DataRow data in Invmes.Rows)
  374. {
  375. var info = dtCloned.Select(string.Format("TLZID='{0}'", data["TLZID"]));
  376. if (info != null && info.Length > 0)
  377. {
  378. info[0]["ZJID"] = data["ZJID"];
  379. info[0]["InvName"] = data["InvName"];
  380. info[0]["InvCode"] = data["InvCode"];
  381. info[0]["InvStd"] = data["InvStd"];
  382. info[0]["InvUnit"] = data["InvUnit"];
  383. info[0]["Amount"] = data["Amount"];
  384. info[0]["IssueNegQuantity"] = data["IssueNegQuantity"];
  385. info[0]["ExtensionID"] = data["ExtensionID"];
  386. info[0]["Quantity"] = 0;
  387. }
  388. else
  389. {
  390. DataRow newrow = dtCloned.NewRow();
  391. newrow["ZJID"] = data["ZJID"];
  392. newrow["InvName"] = data["InvName"];
  393. newrow["InvCode"] = data["InvCode"];
  394. newrow["InvStd"] = data["InvStd"];
  395. newrow["InvUnit"] = data["InvUnit"];
  396. newrow["Amount"] = data["Amount"];
  397. newrow["Quantity"] = 0;
  398. newrow["ID"] = data["ID"];
  399. newrow["TLZID"] = data["TLZID"];
  400. newrow["IssueNegQuantity"] = data["IssueNegQuantity"];
  401. newrow["ExtensionID"] = data["ExtensionID"];
  402. dtCloned.Rows.Add(newrow);
  403. }
  404. }
  405. }
  406. return dtCloned;
  407. }
  408. public void UpdateMOApplyNegTemp(string json)
  409. {
  410. var data = json.ToJObject();
  411. string usercode = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode;
  412. var info = Invmes.Select(string.Format("TLZID='{0}'", data["TLZID"]));
  413. if (info != null && info.Length > 0)
  414. {
  415. info[0]["ZJID"] = data["ZJID"];
  416. info[0]["InvName"] = data["InvName"];
  417. info[0]["InvCode"] = data["InvCode"];
  418. info[0]["InvStd"] = data["InvStd"];
  419. info[0]["InvUnit"] = data["InvUnit"];
  420. info[0]["Amount"] = data["Amount"];
  421. info[0]["IssueNegQuantity"] = data["IssueNegQuantity"];
  422. info[0]["ExtensionID"] = data["ExtensionID"];
  423. info[0]["Quantity"] = 0;
  424. }
  425. else
  426. {
  427. DataRow newrow = Invmes.NewRow();
  428. newrow["ZJID"] = data["ZJID"];
  429. newrow["InvName"] = data["InvName"];
  430. newrow["InvCode"] = data["InvCode"];
  431. newrow["InvStd"] = data["InvStd"];
  432. newrow["InvUnit"] = data["InvUnit"];
  433. newrow["Amount"] = data["Amount"];
  434. newrow["IssueNegQuantity"] = data["IssueNegQuantity"];
  435. newrow["ExtensionID"] = data["ExtensionID"];
  436. newrow["Quantity"] = 0;
  437. newrow["ID"] = data["ID"];
  438. newrow["TLZID"] = data["TLZID"];
  439. Invmes.Rows.Add(newrow);
  440. }
  441. }
  442. public string AuditICSMOApplyNeg(string ICSASN)
  443. {
  444. string msg = "";
  445. string APIURL = ConfigurationManager.ConnectionStrings["APIURL"].ConnectionString + "MOIssueDocNegativeApply/Approve";
  446. string result = HttpPost(APIURL, ICSASN);
  447. JObject Obj = (JObject)JsonConvert.DeserializeObject(result);//或者JObject jo = JObject.Parse(jsonText);
  448. string MessAge = Obj["Message"].ToString();
  449. string Success = Obj["Success"].ToString();
  450. if (Success.ToUpper() == "FALSE")
  451. {
  452. msg = MessAge;
  453. }
  454. return msg;
  455. }
  456. public string DeleteICSMOApplyNeg(string keyValue)
  457. {
  458. //站点信息
  459. string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
  460. string msg = "";
  461. keyValue = keyValue.Substring(1, keyValue.Length - 2);
  462. string sql = string.Empty;
  463. string sqlSeach = string.Empty;
  464. sqlSeach = string.Format(@"select * from ICSMOApplyNeg a
  465. inner join dbo.ICSInventoryLotDetail b on a.ApplyNegCode=b.TransCode and a.WorkPoint=b.WorkPoint
  466. inner join dbo.ICSInventoryLot c on b.LotNo=c.LotNo and b.WorkPoint=c.WorkPoint
  467. where a.ApplyNegCode in ({0}) ", keyValue.TrimEnd(','));
  468. DataTable dt = SqlHelper.GetDataTableBySql(sqlSeach);
  469. if (dt.Rows.Count > 0)
  470. {
  471. throw new Exception("所选单据已生成条码,无法删除!");
  472. }
  473. else
  474. {
  475. sql += string.Format(@"DELETE FROM dbo.ICSMOApplyNeg WHERE ApplyNegCode IN ({0}) and WorkPoint ='{1}'", keyValue.TrimEnd(','), WorkPoint);
  476. sql += string.Format(@"DELETE FROM dbo.ICSMOApplyNegDetail WHERE ApplyNegCode IN ({0}) and WorkPoint ='{1}'", keyValue.TrimEnd(','), WorkPoint);
  477. }
  478. try
  479. {
  480. if (SqlHelper.CmdExecuteNonQueryLi(sql) > 0)
  481. {
  482. }
  483. }
  484. catch (Exception ex)
  485. {
  486. msg = ex.Message;
  487. }
  488. return msg;
  489. }
  490. }
  491. }