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.

614 lines
22 KiB

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 year 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 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
10 months ago
10 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 year 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 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.Text;
  6. using NFine.Code;
  7. using NFine.Repository;
  8. using System.Data.Common;
  9. using NFine.Domain._03_Entity.SRM;
  10. using Newtonsoft.Json;
  11. using System.Configuration;
  12. using System.Net;
  13. using System.IO;
  14. using Newtonsoft.Json.Linq;
  15. using System.Linq;
  16. namespace NFine.Application.OMAY
  17. {
  18. public class OMAYApsApp : RepositoryFactory<ICSVendor>
  19. {
  20. public DataTable GetGridJsonChengPing(string queryJson, ref Pagination jqgridparam)
  21. {
  22. DataTable dt = new DataTable();
  23. var queryParam = queryJson.ToJObject();
  24. List<DbParameter> parameter = new List<DbParameter>();
  25. //object Figure = GetDecimalDigits();
  26. #region [SQL]
  27. string sql = @" select
  28. a.*
  29. from
  30. (
  31. select '' isSelect
  32. ,a.ID
  33. ,a.EATTRIBUTE5 as PreOrderNo --
  34. ,a.EATTRIBUTE6 as BusinessName --
  35. ,a.MOCode
  36. ,a.Sequence MoSeq
  37. ,a.MODetailID
  38. ,a.EATTRIBUTE1 MoTypeValue
  39. ,a.DepCode
  40. ,b.DepName --
  41. ,a.CreateDateTime --
  42. ,a.EATTRIBUTE3 PackageAsk --
  43. ,a.EATTRIBUTE4 SpecialAsk--
  44. ,a.EATTRIBUTE2 Useage--
  45. ,a.InvCode ItemCode
  46. ,c.EATTRIBUTE2 ItemAddCode
  47. ,c.InvName ItemName
  48. ,c.InvStd ItemStd
  49. ,c.InvUnit ItemUnit
  50. ,a.Amount
  51. ,CONVERT(varchar(10), a.StartDate,120) StartDate
  52. ,CONVERT(varchar(10), a.DueDate,120) DueDate
  53. ,case when a.PlanStartDate is null then CONVERT(varchar(10), a.StartDate,120)
  54. else CONVERT(varchar(10), a.PlanStartDate,120) end as PlanStartDate
  55. ,case when a.PlanEndDate is null then CONVERT(varchar(10), a.DueDate,120)
  56. else CONVERT(varchar(10), a.PlanEndDate,120) end as PlanEndDate
  57. ,a.ApsOrderDate
  58. ,a.APSStatus
  59. ,a.OrderStatus
  60. from ICSMO a with(nolock)
  61. left join ICSDepartment b with(nolock) on a.DepCode=b.DepCode
  62. left join ICSInventory c with(nolock) on a.InvCode=c.InvCode
  63. where 1=1
  64. <1>
  65. --order by a.CreateDateTime desc
  66. ) a
  67. where 1=1
  68. ";
  69. // sql += " WHERE 1=1 and a.MOStatus<>'3' ";
  70. //sql = string.Format(sql, Figure);
  71. //sql = string.Format(sql, DbHelper.GetErpIp(), DbHelper.GetErpName());
  72. #endregion
  73. if (!string.IsNullOrWhiteSpace(queryJson))
  74. {
  75. if (!string.IsNullOrWhiteSpace(queryParam["ItemCode"].ToString()))
  76. {
  77. sql += " and a.ItemCode like '%" + queryParam["ItemCode"].ToString() + "%' ";
  78. }
  79. if (!string.IsNullOrWhiteSpace(queryParam["ItemName"].ToString()))
  80. {
  81. sql += " and a.ItemName like '%" + queryParam["ItemName"].ToString() + "%' ";
  82. }
  83. var ssName1 = queryParam["SSName"].ToString();
  84. var ssName2 = queryParam["SSName2"].ToString();
  85. if (string.IsNullOrEmpty(ssName1) && string.IsNullOrEmpty(ssName2))
  86. {
  87. sql = sql.Replace("<1>", "and a.APSStatus is null ");
  88. }
  89. else
  90. {
  91. if (!string.IsNullOrEmpty(ssName1) && !string.IsNullOrEmpty(ssName2))
  92. {
  93. sql += " and a.DepName ='" + ssName1 + "' and a.APSStatus='Y' ";
  94. sql = sql.Replace("<1>", " ");
  95. }
  96. if (!string.IsNullOrEmpty(ssName1))
  97. {
  98. sql += " and a.DepName ='" + ssName1 + "' and a.APSStatus='Y' ";
  99. sql = sql.Replace("<1>", " ");
  100. }
  101. if (!string.IsNullOrEmpty(ssName2))
  102. {
  103. sql += " and a.DepName ='" + ssName2 + "' ";
  104. sql = sql.Replace("<1>", " and a.APSStatus is null ");
  105. }
  106. }
  107. if (!string.IsNullOrWhiteSpace(queryParam["MoCode"].ToString()))
  108. {
  109. sql += " and a.MOCode like '%" + queryParam["MoCode"].ToString() + "%' ";
  110. }
  111. if (!string.IsNullOrWhiteSpace(queryParam["OrderStatus"].ToString()))
  112. {
  113. sql += " and a.OrderStatus = '" + queryParam["OrderStatus"].ToString() + "' ";
  114. }
  115. else
  116. {
  117. sql += " and (a.OrderStatus is null or a.OrderStatus='')";
  118. }
  119. }
  120. //if (NFine.Code.OperatorProvider.Provider.GetCurrent().RoleEnCode != "admin")
  121. //{
  122. // sql = sql.Replace("{0}", "and a.WorkPoint = '" + NFine.Code.OperatorProvider.Provider.GetCurrent().Location + "'");
  123. // // sql += " and a.WorkPoint='" + NFine.Code.OperatorProvider.Provider.GetCurrent().Location + "'";
  124. //}
  125. //else
  126. //{
  127. // sql = sql.Replace("{0}", "");
  128. //}
  129. //if (NFine.Code.OperatorProvider.Provider.GetCurrent().RoleEnCode == "Vendor")
  130. //{
  131. // sql += " and a.VenCode='" + NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode + "'";
  132. //}
  133. return Repository().FindTablePageBySql(sql.ToString(), parameter.ToArray(), ref jqgridparam);
  134. }
  135. public string CancelSendMo(string keyValue)
  136. {
  137. string returnValue = string.Empty;
  138. try
  139. {
  140. var queryParam = keyValue.ToJObject();
  141. string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode;
  142. string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName;
  143. string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
  144. var ids = queryParam["ids"].ToString().Split(',');
  145. string sql = @" UPDATE dbo.ICSMO
  146. set MTIME=GETDATE(),MUSER='{0}',MUSERName='{1}',WorkPoint='{2}',APSStatus=null,ApsOrderDate=null,PlanStartDate=null,PlanEndDate=null
  147. WHERE ID in ('{3}') ";
  148. sql = string.Format(sql, MUSER, MUSERNAME, WorkPoint, string.Join("','", ids));
  149. var rows = SqlHelper.CmdExecuteNonQueryLi(sql) > 0;
  150. if (!rows)
  151. {
  152. throw new Exception("修改失败");
  153. }
  154. }
  155. catch (Exception ex)
  156. {
  157. returnValue = ex.Message;
  158. }
  159. return returnValue;
  160. }
  161. public string UpdateMoOrderStatus(string keyValue)
  162. {
  163. string returnValue = string.Empty;
  164. try
  165. {
  166. var queryParam = keyValue.ToJObject();
  167. var ids = queryParam["ids"].ToString().Split(',');
  168. if (ids.Length == 0)
  169. {
  170. throw new Exception("编号获取失败");
  171. }
  172. var orderStatus = queryParam["orderStatus"].ToString();
  173. //orderStatus = orderStatus == "" ? null : orderStatus;
  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. var sql = @"update ICSMO set OrderStatus ='{3}',MTIME=GETDATE(),MUSER='{0}',WorkPoint='{1}' where ID in ('{2}') ";
  178. sql = string.Format(sql, MUSER, WorkPoint, string.Join("','", ids),orderStatus);
  179. var rows = SqlHelper.CmdExecuteNonQueryLi(sql) > 0;
  180. if (!rows)
  181. {
  182. throw new Exception("修改失败");
  183. }
  184. }
  185. catch (Exception ex)
  186. {
  187. throw new Exception(ex.Message);
  188. }
  189. return returnValue;
  190. }
  191. public string GetOrgAName()
  192. {
  193. string returnValue = string.Empty;
  194. string sql = @"select
  195. b.F_FullName as OrgName
  196. ,b.F_EnCode as OrgCode
  197. ,a.*
  198. from [dbo].[Sys_SRM_Role] a
  199. left join Sys_SRM_Organize b on a.F_OrganizeId=b.F_Id
  200. where 1=1
  201. and a.F_EnCode='{0}'
  202. ";
  203. sql = string.Format(sql, NFine.Code.OperatorProvider.Provider.GetCurrent().RoleEnCode);
  204. var dt = Repository().FindDataSetBySql(sql.ToString()).Tables[0];
  205. if (dt == null || dt.Rows.Count == 0)
  206. {
  207. return returnValue;
  208. }
  209. returnValue = dt.Rows[0]["OrgName"].ToStringExt();
  210. return returnValue;
  211. }
  212. public string UpdateMoPlan2(string keyValue)
  213. {
  214. string returnValue = string.Empty;
  215. var queryParam = keyValue.ToJObject();
  216. string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode;
  217. string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName;
  218. string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
  219. string sql = string.Empty;
  220. sql = @"
  221. UPDATE dbo.ICSMO set MTIME=GETDATE(),MUSER='{0}',WorkPoint='{1}'
  222. <1>
  223. <2>
  224. <3>
  225. WHERE ID in ('{2}')";
  226. var ids = queryParam["ids"].ToString().Split(',');
  227. sql = string.Format(sql, MUSER, WorkPoint, string.Join("','", ids));
  228. if (!string.IsNullOrEmpty(queryParam["orderDate"].ToString()))
  229. {
  230. sql = sql.Replace("<1>", ",ApsOrderDate='" + queryParam["orderDate"].ToString() + "'");
  231. }
  232. if (!string.IsNullOrEmpty(queryParam["planStartDate"].ToString()))
  233. {
  234. sql = sql.Replace("<2>", ",planStartDate='" + queryParam["planStartDate"].ToString() + "'");
  235. }
  236. if (!string.IsNullOrEmpty(queryParam["planEndDate"].ToString()))
  237. {
  238. sql = sql.Replace("<3>", ",planEndDate='" + queryParam["planEndDate"].ToString() + "'");
  239. }
  240. var rows = SqlHelper.CmdExecuteNonQueryLi(sql) > 0;
  241. if (!rows)
  242. {
  243. throw new Exception("修改失败");
  244. }
  245. return returnValue;
  246. }
  247. public string UpdateMoPlan(string keyValue)
  248. {
  249. string returnValue = string.Empty;
  250. var queryParam = keyValue.ToJObject();
  251. var isCanUpdateStatus = queryParam["isCanUpdateStatus"].ToBool();
  252. string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode;
  253. string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName;
  254. string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
  255. string sql = string.Empty;
  256. sql = @"
  257. declare @DepCode nvarchar(100)
  258. select @DepCode= DepCode from ICSDepartment
  259. where DepName='{0}'
  260. --select @DepCode
  261. UPDATE dbo.ICSMO set DepCode=@DepCode, MTIME=GETDATE(),MUSER='{1}',WorkPoint='{2}',APSStatus='Y' <1> <2> <3> WHERE ID in ('{3}')";
  262. var ids = queryParam["ids"].ToString().Split(',');
  263. var sql4 = @"select count(1) Value
  264. from ICSMOPick a
  265. left join ICSMO b on a.MODetailID=b.MODetailID
  266. left join ICSInventory c on a.InvCode =c.InvCode
  267. where 1=1
  268. and a.EATTRIBUTE1=0
  269. and a.WorkPoint='"+ WorkPoint + "' and b.ID in ('"+string.Join("','", ids) +"')";
  270. var isCanUpdateDepCode= Repository().FindDataSetBySql(sql4.ToString()).Tables[0];
  271. if(isCanUpdateDepCode!=null&& isCanUpdateDepCode.Rows.Count > 0)
  272. {
  273. if (isCanUpdateDepCode.Rows[0]["Value"].ToInt() > 0)
  274. {
  275. sql = @"
  276. --select @DepCode
  277. UPDATE dbo.ICSMO set MTIME=GETDATE(),MUSER='{1}',WorkPoint='{2}',APSStatus='Y' <1> <2> <3> WHERE ID in ('{3}')";
  278. }
  279. }
  280. string APIURL = ConfigurationManager.ConnectionStrings["ERPAPIURL"].ConnectionString + "MOHKWam/Update";
  281. var planStartDate = queryParam["planStartDate"].ToStringExt();
  282. var planEndDate = queryParam["planEndDate"].ToStringExt();
  283. sql = string.Format(sql, queryParam["line"].ToString(), MUSER, WorkPoint, string.Join("','", ids), queryParam["orderDate"].ToString());
  284. if (!string.IsNullOrEmpty(queryParam["orderDate"].ToString()))
  285. {
  286. sql = sql.Replace("<1>", ",ApsOrderDate='" + queryParam["orderDate"].ToString() + "' ");
  287. }
  288. else
  289. {
  290. sql = sql.Replace("<1>", ",ApsOrderDate=getdate()");
  291. }
  292. if (!string.IsNullOrEmpty(planStartDate))
  293. {
  294. sql = sql.Replace("<2>", ",PlanStartDate='" + planStartDate + "'");
  295. }
  296. else
  297. {
  298. sql = sql.Replace("<2>", " ,PlanStartDate=StartDate");
  299. }
  300. if (!string.IsNullOrEmpty(planEndDate))
  301. {
  302. sql = sql.Replace("<3>", ",PlanEndDate='" + planEndDate + "'");
  303. }
  304. else
  305. {
  306. sql = sql.Replace("<3>", " ,PlanEndDate=DueDate");
  307. }
  308. //string sql11 = @"select a.* from ICSMO a where a.ID in ('0')";
  309. //sql11 = string.Format(sql11, string.Join("','", ids));
  310. //var dt11 = Repository().FindDataSetBySql(sql11.ToString()).Tables[0];
  311. //if (dt11 == null || dt11.Rows.Count == 0)
  312. //{
  313. // throw new Exception("获取工单数据失败");
  314. //}
  315. //foreach (DataRow item in dt11.Rows)
  316. //{
  317. //}
  318. try
  319. {
  320. string sql3 = @"
  321. declare @DepCode nvarchar(100)
  322. select @DepCode= DepCode from ICSDepartment
  323. where DepName='{0}'
  324. select @DepCode as DepCode ";
  325. sql3 = string.Format(sql3, queryParam["line"].ToString());
  326. var dt5 = Repository().FindDataSetBySql(sql3.ToString()).Tables[0];
  327. if (dt5 == null || dt5.Rows.Count == 0)
  328. {
  329. throw new Exception("当前部门获取失败");
  330. }
  331. var deptCode = dt5.Rows[0]["DepCode"].ToString();
  332. if (!isCanUpdateStatus)
  333. {
  334. sql = sql.Replace(",APSStatus='Y'", " ");
  335. //var rows2 = SqlHelper.CmdExecuteNonQueryLi(sql) > 0;
  336. //if (!rows2)
  337. //{
  338. // throw new Exception("修改失败");
  339. //}
  340. //return returnValue;
  341. }
  342. string objsql = @"
  343. declare @WorkPointCode varchar(100)
  344. select @WorkPointCode=WorkPointCode from Sys_WorkPoint
  345. select
  346. @WorkPointCode as WorkPoint
  347. ,a.MODetailID as MoDid
  348. ,CONVERT(varchar(10), a.StartDate,120) StartDate
  349. ,CONVERT(varchar(10), a.DueDate,120) DueDate
  350. ,a.DepCode cDept
  351. from ICSMO a with(nolock)
  352. where a.ID in ('{0}')
  353. ";
  354. objsql = string.Format(objsql, string.Join("','", ids));
  355. var dt = Repository().FindDataSetBySql(objsql.ToString()).Tables[0];
  356. if (dt == null || dt.Rows.Count == 0)
  357. {
  358. return returnValue;
  359. }
  360. List<object> objList = new List<object>();
  361. foreach (DataRow item in dt.Rows)
  362. {
  363. if (!string.IsNullOrEmpty(planStartDate))
  364. {
  365. }
  366. object obj = new
  367. {
  368. WorkPoint = item["WorkPoint"].ToString(),
  369. MoDid = item["MoDid"].ToString(),
  370. StartDate = string.IsNullOrEmpty(planStartDate) ? item["StartDate"].ToString() : planStartDate,
  371. DueDate = string.IsNullOrEmpty(planEndDate) ? item["DueDate"].ToString() : planEndDate,
  372. cDept = deptCode,
  373. };
  374. objList.Add(obj);
  375. }
  376. var result = HttpMethods.Post<ResultDto>(APIURL, objList).Result;
  377. if (!result.Success)
  378. {
  379. return result.Message;
  380. }
  381. var rows = SqlHelper.CmdExecuteNonQueryLi(sql) > 0;
  382. if (!rows)
  383. {
  384. throw new Exception("修改失败");
  385. }
  386. }
  387. catch (Exception ex)
  388. {
  389. returnValue = ex.Message;
  390. }
  391. return returnValue;
  392. }
  393. public DataTable GetApsPlanSelectSubItemList(string ids, ref Pagination pagination)
  394. {
  395. DataTable dt = new DataTable();
  396. // var queryParam = queryJson.ToJObject();
  397. List<DbParameter> parameter = new List<DbParameter>();
  398. //object Figure = GetDecimalDigits();
  399. #region [SQL]
  400. string sql = @"select
  401. a.SubItemCode,a.SubItemName,a.SubItemStd,a.InvUnit,a.AmountUnit
  402. ,sum( a.Quantity) Quantity
  403. ,sum( a.Amount) Amount
  404. ,max(a.ID) ID
  405. from
  406. (
  407. select 0 Code
  408. --a.*
  409. ,a.ID
  410. ,c.InvCode SubItemCode
  411. ,c.InvName SubItemName
  412. ,c.InvStd SubItemStd
  413. ,a.Quantity --
  414. ,c.InvUnit --
  415. ,a.Amount --
  416. ,c.AmountUnit --
  417. from ICSMOPick a with(nolock)
  418. left join ICSMO b with(nolock) on a.MODetailID=b.MODetailID
  419. left join ICSInventory c with(nolock) on a.InvCode =c.InvCode
  420. where 1=1
  421. <1>
  422. and a.EATTRIBUTE1=0
  423. ) a
  424. group by a.SubItemCode,a.SubItemName,a.SubItemStd,a.InvUnit,a.AmountUnit
  425. order by a.SubItemCode,a.SubItemName,a.SubItemStd
  426. ";
  427. // sql += " WHERE 1=1 and a.MOStatus<>'3' ";
  428. var list = ids.Split(',');
  429. sql = sql.Replace("<1>", " and b.ID in ('" + string.Join("','", list) + "')");
  430. //sql = sql.Replace("<2>", "and b.Sequence=" + moSeq + "");
  431. //sql = string.Format(sql, DbHelper.GetErpIp(), DbHelper.GetErpName());
  432. #endregion
  433. //if (NFine.Code.OperatorProvider.Provider.GetCurrent().RoleEnCode != "admin")
  434. //{
  435. // sql = sql.Replace("<3>", "and a.WorkPoint = '" + NFine.Code.OperatorProvider.Provider.GetCurrent().Location + "'");
  436. // // sql += " and a.WorkPoint='" + NFine.Code.OperatorProvider.Provider.GetCurrent().Location + "'";
  437. //}
  438. //else
  439. //{
  440. // sql = sql.Replace("<3>", "");
  441. //}
  442. //if (NFine.Code.OperatorProvider.Provider.GetCurrent().RoleEnCode == "Vendor")
  443. //{
  444. // sql += " and a.VenCode='" + NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode + "'";
  445. //}
  446. return Repository().FindDataSetBySql(sql.ToString(), parameter.ToArray()).Tables[0];
  447. }
  448. public DataTable GetApsPlanSubGridJsonList(string moCode, int moSeq, ref Pagination pagination)
  449. {
  450. DataTable dt = new DataTable();
  451. // var queryParam = queryJson.ToJObject();
  452. List<DbParameter> parameter = new List<DbParameter>();
  453. //object Figure = GetDecimalDigits();
  454. #region [SQL]
  455. string sql = @"select 0 Code
  456. --a.*
  457. ,a.ID
  458. ,a.Sequence SubSeq
  459. ,c.InvCode SubItemCode
  460. ,c.InvName SubItemName
  461. --,c.ClassCode
  462. --,c.ClassName
  463. ,c.InvStd SubItemDtd
  464. ,convert(nvarchar(100), floor (isnull( a.EATTRIBUTE3,0) *100)) +'%' as Rate --
  465. ,a.Quantity --
  466. ,c.InvUnit --
  467. ,a.Amount --
  468. ,c.AmountUnit --
  469. from ICSMOPick a with(nolock)
  470. left join ICSMO b with(nolock) on a.MODetailID=b.MODetailID
  471. left join ICSInventory c with(nolock) on a.InvCode =c.InvCode and a.WorkPoint=c.WorkPoint
  472. where 1=1
  473. <1>
  474. <2>
  475. and a.EATTRIBUTE1=0
  476. --and left( c.ClassCode,2)='01'
  477. order by a.Sequence
  478. ";
  479. // sql += " WHERE 1=1 and a.MOStatus<>'3' ";
  480. sql = sql.Replace("<1>", "and b.MOCode='" + moCode + "'");
  481. sql = sql.Replace("<2>", "and b.Sequence=" + moSeq + "");
  482. //sql = string.Format(sql, DbHelper.GetErpIp(), DbHelper.GetErpName());
  483. #endregion
  484. //if (!string.IsNullOrWhiteSpace(queryJson))
  485. //{
  486. // if (!string.IsNullOrWhiteSpace(queryParam["ItemCode"].ToString()))
  487. // {
  488. // sql += " and a.ItemCode like '%" + queryParam["ItemCode"].ToString() + "%' ";
  489. // }
  490. // if (!string.IsNullOrWhiteSpace(queryParam["ItemName"].ToString()))
  491. // {
  492. // sql += " and a.ItemName like '%" + queryParam["ItemName"].ToString() + "%' ";
  493. // }
  494. // //if (!string.IsNullOrWhiteSpace(queryParam["InvName"].ToString()))
  495. // //{
  496. // // sql += " and b.InvName like '%" + queryParam["InvName"].ToString() + "%' ";
  497. // //}
  498. // //if (!string.IsNullOrWhiteSpace(queryParam["BatchCode"].ToString()))
  499. // //{
  500. // // sql += " and f.BatchCode like '%" + queryParam["BatchCode"].ToString() + "%' ";
  501. // //}
  502. // //if (!string.IsNullOrWhiteSpace(queryParam["SelGDLX"].ToString()))
  503. // //{
  504. // // sql += " and a.MOType like '%" + queryParam["SelGDLX"].ToString() + "%' ";
  505. // //}
  506. // //if (!string.IsNullOrWhiteSpace(queryParam["POStatus"].ToString()))
  507. // //{
  508. // // string POStatus = queryParam["POStatus"].ToString();
  509. // // if (POStatus == "0")
  510. // // {
  511. // // //sql += " and a.Quantity=ISNULL(c.LotQty,0)";
  512. // // }
  513. // // else if (POStatus == "1")
  514. // // {
  515. // // sql += " and ISNULL(c.LOTQTY,0)>=a.Quantity";
  516. // // }
  517. // // else
  518. // // {
  519. // // sql += " and ISNULL(c.LOTQTY,0)<a.Quantity";
  520. // // }
  521. // //}
  522. //}
  523. //if (NFine.Code.OperatorProvider.Provider.GetCurrent().RoleEnCode != "admin")
  524. //{
  525. // sql = sql.Replace("<3>", "and a.WorkPoint = '" + NFine.Code.OperatorProvider.Provider.GetCurrent().Location + "'");
  526. // // sql += " and a.WorkPoint='" + NFine.Code.OperatorProvider.Provider.GetCurrent().Location + "'";
  527. //}
  528. //else
  529. //{
  530. // sql = sql.Replace("<3>", "");
  531. //}
  532. //if (NFine.Code.OperatorProvider.Provider.GetCurrent().RoleEnCode == "Vendor")
  533. //{
  534. // sql += " and a.VenCode='" + NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode + "'";
  535. //}
  536. return Repository().FindDataSetBySql(sql.ToString(), parameter.ToArray()).Tables[0];
  537. }
  538. }
  539. }