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.

548 lines
24 KiB

3 weeks ago
  1. using Newtonsoft.Json.Linq;
  2. using Newtonsoft.Json;
  3. using NFine.Code;
  4. using NFine.Data.Extensions;
  5. using NFine.Domain._03_Entity.SRM;
  6. using NFine.Repository;
  7. using System;
  8. using System.Collections.Generic;
  9. using System.Data;
  10. using System.Data.Common;
  11. using System.Linq;
  12. using System.Text;
  13. using System.Threading.Tasks;
  14. using System.Configuration;
  15. using System.IO;
  16. using System.Net;
  17. using NFine.Application.WMS;
  18. using NFine.Application.Models;
  19. using System.Reflection;
  20. using NFine.Application.Entity;
  21. using NFine.Domain.Entity.SystemSecurity;
  22. using System.Xml;
  23. using System.Collections;
  24. using System.Data.SqlClient;
  25. namespace NFine.Application.BBWMS
  26. {
  27. #region 工单子线实体对象
  28. /// <summary>
  29. /// 新增工单子线实体对象
  30. /// </summary>
  31. public class MOModel
  32. {
  33. /// <summary>
  34. /// 工单编码
  35. /// </summary>
  36. public string MOCode { get; set; }
  37. /// <summary>
  38. /// 行号
  39. /// </summary>
  40. public string Sequence { get; set; }
  41. /// <summary>
  42. /// 物料编码
  43. /// </summary>
  44. public string InvCode { get; set; }
  45. /// <summary>
  46. /// 数量
  47. /// </summary>
  48. public decimal Quantity { get; set; }
  49. /// <summary>
  50. ///
  51. /// </summary>
  52. public string ExtensionID { get; set; }
  53. }
  54. #endregion
  55. public class ICSManufactureReceiveApp : RepositoryFactory<ICSVendor>
  56. {
  57. #region 获取送检单主表数据
  58. /// <summary>
  59. /// 获取产品入库单数据
  60. /// </summary>
  61. /// <param name="queryJson"></param>
  62. /// <param name="jqgridparam"></param>
  63. /// <returns></returns>
  64. public DataTable GetManufactureReceive(string queryJson, ref Pagination jqgridparam)
  65. {
  66. DataTable dt = new DataTable();
  67. var queryParam = queryJson.ToJObject();
  68. List<DbParameter> parameter = new List<DbParameter>();
  69. object Figure = GetDecimalDigits();
  70. string wheresql = string.Empty;
  71. string workPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
  72. if (!string.IsNullOrWhiteSpace(queryJson))
  73. {
  74. if (!string.IsNullOrWhiteSpace(queryParam["POCode"].ToString()))
  75. {
  76. wheresql += " and a.CheckCode like '%" + queryParam["POCode"].ToString() + "%' ";
  77. }
  78. }
  79. if (NFine.Code.OperatorProvider.Provider.GetCurrent().RoleEnCode != "admin")
  80. {
  81. wheresql += " and a.WorkPoint='" + workPoint + "'";
  82. }
  83. #region [SQL]
  84. string sql = $@"SELECT DISTINCT a.CheckCode CheckNo,b.FinalResult,b.FinalUser,b.FinalTime,a.MTIME,a.MUSERName from ICSInspectionSheet a
  85. LEFT JOIN IcsMatCheckResult b ON b.EATTRIBUTE4='1'AND a.CheckCode=b.CheckNo
  86. WHERE 1=1 {wheresql} ";
  87. #endregion
  88. return Repository().FindTablePageBySql(sql.ToString(), parameter.ToArray(), ref jqgridparam);
  89. }
  90. #endregion
  91. #region 获取条码信息
  92. /// <summary>
  93. /// 获取条码信息
  94. /// </summary>
  95. /// <param name="ApplyNegCode"></param>
  96. /// <param name="Sequence"></param>
  97. /// <param name="Type"></param>
  98. /// <param name="isPrint"></param>
  99. /// <param name="jqgridparam"></param>
  100. /// <returns></returns>
  101. public DataTable GetManufactureReceiveLot(string ProductionCode, string WHCode, string InvCode,ref Pagination jqgridparam)
  102. {
  103. DataTable dt = new DataTable();
  104. List<DbParameter> parameter = new List<DbParameter>();
  105. string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location.TrimEnd(',');
  106. //多个出库单会有重复数据,需要去重
  107. string sql = $@" SELECT distinct c.ID,c.LotNo,c.Quantity,a.SourceCode ProductionCode,b.InvCode,b.InvName,b.InvStd,c.MUSERName,c.MTIME
  108. FROM ICSManufactureReceive a
  109. INNER JOIN ICSInventory b ON a.InvCode=b.InvCode AND a.WorkPoint=b.WorkPoint
  110. INNER JOIN ICSManufactureReceiveLot c ON a.SourceCode=c.ProductionCode AND a.WorkPoint=c.WorkPoint AND a.InvCode=c.InvCode and IsBind='0'
  111. WHERE a.SourceCode='{ProductionCode}' AND a.WHCode='{WHCode}' and a.InvCode='{InvCode}' and a.WorkPoint='{WorkPoint}' ";
  112. return Repository().FindTablePageBySql(sql.ToString(), parameter.ToArray(), ref jqgridparam);
  113. }
  114. #endregion
  115. #region 获取条码信息
  116. /// <summary>
  117. /// 获取条码信息
  118. /// </summary>
  119. /// <param name="ApplyNegCode"></param>
  120. /// <param name="Sequence"></param>
  121. /// <param name="Type"></param>
  122. /// <param name="isPrint"></param>
  123. /// <param name="jqgridparam"></param>
  124. /// <returns></returns>
  125. public DataTable GetLotGridJson(string LotNo)
  126. {
  127. DataTable dt = new DataTable();
  128. List<DbParameter> parameter = new List<DbParameter>();
  129. string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location.TrimEnd(',');
  130. //多个出库单会有重复数据,需要去重
  131. string sql = $@" SELECT a.LOTNO,a.Quantity,b.BatchCode,c.InvCode,c.InvName,c.InvUnit,c.InvStd,c.InvDesc
  132. FROM ICSInventoryLot a
  133. INNER JOIN ICSExtension b ON a.ExtensionID=b.ID
  134. INNER JOIN ICSInventory c ON a.INVCODE=c.InvCode AND a.WorkPoint=b.WorkPoint
  135. WHERE a.WorkPoint='{WorkPoint}' AND a.LOTNO='{LotNo}' ";
  136. return SqlHelper.CmdExecuteDataTable(sql);
  137. }
  138. #endregion
  139. #region 创建送检单
  140. /// <summary>
  141. /// 创建送检单
  142. /// </summary>
  143. /// <param name="Lots">条码信息</param>
  144. /// <returns></returns>
  145. public string CreateCheckNO(string Lots)
  146. {
  147. string msg = string.Empty;
  148. try
  149. {
  150. var lots = Lots.Substring(1, Lots.Length-3);
  151. string WorkPoints = NFine.Code.OperatorProvider.Provider.GetCurrent().Location.TrimEnd(',');
  152. string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode;
  153. string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName;
  154. string sqlSeach = $@" select * from dbo.ICSInventoryLot where EATTRIBUTE30='1' and LotNo IN({lots})";
  155. DataTable dtASN = SqlHelper.GetDataTableBySql(sqlSeach);
  156. if (dtASN != null && dtASN.Rows.Count > 0)
  157. {
  158. throw new Exception("所选条码中存在已检索状态的条码,无法创建!");
  159. }
  160. var pre = "CKNO" + DateTime.Now.ToString("yyyy-MM-dd");
  161. var checkNO = GetSerialCode(WorkPoints, "ICSInspectionSheet", "CheckCode", pre, 5);
  162. string sql = $@" INSERT INTO ICSInspectionSheet([ID], [CheckCode],[InvCode], [LotNo], [Quantity], [Amount], [ExtensionID], [MUSER], [MUSERName], [WorkPoint], [MTIME]) SELECT NEWID(),'{checkNO}',InvCode,LotNO,Quantity,Amount,ExtensionID,'{MUSER}','{MUSERNAME}','{WorkPoints}',GETDATE()
  163. FROM ICSInventoryLot WHERE LOTNO IN({lots}); ";
  164. int count = SqlHelper.CmdExecuteNonQueryLi(sql);
  165. return msg;
  166. }
  167. catch (Exception ex)
  168. {
  169. return ex.Message;
  170. }
  171. }
  172. #endregion
  173. public object GetDecimalDigits()
  174. {
  175. string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location.TrimEnd(',');
  176. try
  177. {
  178. string sql = string.Empty;
  179. sql = @"select Figure from ICSConfiguration where Code='Figure001' and Enable='1' and WorkPoint='" + WorkPoint + "'";
  180. object Figure = SqlHelper.ExecuteScalar(sql);
  181. return Figure;
  182. }
  183. catch (Exception ex)
  184. {
  185. throw new Exception(ex.Message.ToString());
  186. }
  187. }
  188. /// <summary>
  189. /// 删除条码
  190. /// </summary>
  191. /// <param name="keyValue"></param>
  192. /// <returns></returns>
  193. public string DeleteItemLot(string CheckNos)
  194. {
  195. string msg = string.Empty;
  196. try
  197. {
  198. string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
  199. //string sql = $@"SELECT * FROM dbo.ICSMOSubInventoryLot
  200. //WHERE MOCode IN ({MOCodes}) and WorkPoint in ('{WorkPoint}') and isnull(EATTRIBUTE1,'') !='' ";
  201. //DataTable dtASN = SqlHelper.GetDataTableBySql(sql);
  202. //if (dtASN != null && dtASN.Rows.Count > 0)
  203. //{
  204. // msg = "所选条码已绑定,无法删除!";
  205. // return msg;
  206. //}
  207. if (string.IsNullOrEmpty(msg))
  208. {
  209. string sqls = $"DELETE FROM ICSInspectionSheet WHERE CheckCode in({CheckNos}) AND WorkPoint in ('{WorkPoint}') ";
  210. SqlHelper.CmdExecuteNonQueryLi(sqls);
  211. }
  212. }
  213. catch (Exception ex)
  214. {
  215. return ex.Message;
  216. }
  217. return msg;
  218. }
  219. public string GetSerialCode(string workPointCode, string tbName, string colName, string Pre, int numLen)
  220. {
  221. string sql = "EXEC Addins_GetSerialCode '{0}','{1}','{2}','{3}',{4}";
  222. sql = string.Format(sql, new object[] { workPointCode, tbName, colName, Pre, numLen });
  223. //return Repository().FindTableBySql(sql.ToString());
  224. return SqlHelper.ExecuteScalar(sql).ToString();
  225. //return DbHelper.ExecuteScalar(CommandType.Text, sql).ToString();
  226. }
  227. public static string HttpPost(string url, string body)
  228. {
  229. try
  230. {
  231. Encoding encoding = Encoding.UTF8;
  232. HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
  233. request.Method = "POST";
  234. request.Accept = "application/json, text/javascript, */*"; //"text/html, application/xhtml+xml, */*";
  235. request.ContentType = "application/json; charset=utf-8";
  236. byte[] buffer = encoding.GetBytes(body);
  237. request.ContentLength = buffer.Length;
  238. request.GetRequestStream().Write(buffer, 0, buffer.Length);
  239. HttpWebResponse response = (HttpWebResponse)request.GetResponse();
  240. using (StreamReader reader = new StreamReader(response.GetResponseStream(), encoding))
  241. {
  242. return reader.ReadToEnd();
  243. }
  244. }
  245. catch (WebException ex)
  246. {
  247. throw new Exception(ex.Message);
  248. }
  249. }
  250. /// <summary>
  251. /// 检验子表信息
  252. /// </summary>
  253. /// <param name="ApplyNegCode"></param>
  254. /// <param name="Sequence"></param>
  255. /// <param name="Type"></param>
  256. /// <param name="jqgridparam"></param>
  257. /// <returns></returns>
  258. public DataTable GetSubGridJson(string CheckNo, ref Pagination jqgridparam)
  259. {
  260. DataTable dt = new DataTable();
  261. object Figure = GetDecimalDigits();
  262. List<DbParameter> parameter = new List<DbParameter>();
  263. string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location.TrimEnd(',');
  264. string sql = $@" SELECT a.ID,a.LotNo,a.InvCode,c.InvName,c.InvUnit,a.CheckCode CheckNo,a.Quantity
  265. FROM ICSInspectionSheet a
  266. INNER JOIN ICSInventory c ON a.InvCode=c.InvCode AND a.WorkPoint=c.WorkPoint
  267. WHERE a.CheckCode='{CheckNo}' AND a.WorkPoint='{WorkPoint}'";
  268. sql = string.Format(sql, Figure);
  269. return Repository().FindTablePageBySql(sql.ToString(), parameter.ToArray(), ref jqgridparam);
  270. }
  271. /// <summary>
  272. /// 出库单条码绑定导入
  273. /// </summary>
  274. /// <param name="savePath"></param>
  275. /// <returns></returns>
  276. public string UploadFileBinding(String savePath)
  277. {
  278. //数据获取
  279. try
  280. {
  281. int index = 1;
  282. string msg = "";
  283. string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode;
  284. string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName;
  285. string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
  286. string MTIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  287. string sql = string.Empty;
  288. SqlConnection conn = SqlHelper.GetDataCenterConn();
  289. int count = 0;
  290. DataTable data = FileToExcel.ExcelToTable(savePath);
  291. var parent = data.DefaultView.ToTable(true, "入库单号", "入库单行号", "生产订单号", "物料编码", "条码", "数量", "库位编码");
  292. parent.PrimaryKey = new DataColumn[] { parent.Columns["column1"], parent.Columns["column2"], parent.Columns["column3"], parent.Columns["column4"], parent.Columns["column5"], parent.Columns["column6"] };
  293. DataTable distinctTable = parent.DefaultView.ToTable(true);
  294. foreach (DataRow distinctds in distinctTable.Rows)
  295. {
  296. string ID = Guid.NewGuid().ToString();
  297. index++;
  298. string RCVCode = distinctds["入库单号"].ToString().Trim();
  299. string RCVSequence = distinctds["入库单行号"].ToString().Trim();
  300. string ProductionCode = distinctds["生产订单号"].ToString().Trim();
  301. string InvCode = distinctds["物料编码"].ToString().Trim();
  302. string LotNo = distinctds["条码"].ToString().Trim();
  303. string Quantity = distinctds["数量"].ToString().Trim();
  304. string LocationCode = distinctds["库位编码"].ToString().Trim();
  305. #region 判断必填项
  306. if (ProductionCode == "" || ProductionCode == null)
  307. {
  308. throw new Exception("第 " + index + " 行生产订单号不能为空!");
  309. }
  310. if (InvCode == "" || InvCode == null)
  311. {
  312. throw new Exception("第 " + index + " 行物料编码不能为空!");
  313. }
  314. if (LotNo == "" || LotNo == null)
  315. {
  316. throw new Exception("第 " + index + " 行条码不能为空!");
  317. }
  318. if (Quantity == "" || Quantity == null)
  319. {
  320. throw new Exception("第 " + index + " 行数量不能为空!");
  321. }
  322. if (LocationCode == "" || LocationCode == null)
  323. {
  324. throw new Exception("第 " + index + " 行库位编码不能为空!");
  325. }
  326. #endregion
  327. sql += $@"
  328. INSERT INTO [dbo].[ICSInventoryLot] ([ID], [LotNo], [InvCode], [ProductDate], [ExpirationDate], [Quantity], [Amount], [ExtensionID], [Type], [PrintTimes], [LastPrintUser], [LastPrintTime], [MUSER], [MUSERName], [MTIME], [WorkPoint]) SELECT NEWID(), N'{LotNo}', N'{InvCode}', '{MTIME}', case when EffectiveEnable='1' THEN DATEADD(day,EffectiveDays,GETDATE()) else '2099-12-31' END, {Quantity}, 0.000000, (SELECT ID FROM ICSExtension WHERE Colspan='~~~~~~~~~~~~~'), N'9', NULL, NULL, NULL, N'{MUSER}', N'{MUSERNAME}', '{MTIME}', N'KC47' FROM ICSInventory WHERE InvCode='{InvCode}' AND WorkPoint='{WorkPoint}' ;
  329. INSERT INTO [dbo].[ICSInventoryLotDetail] ([LotNo], [TransID], [TransCode], [TransSequence], [MUSER], [MUSERName], [MTIME], [WorkPoint]) SELECT N'{LotNo}', ID, MOCode, Sequence,'{MUSER}', N'{MUSERNAME}', '{MTIME}', N'{WorkPoint}' FROM ICSMO WHERE MOCode='{ProductionCode}' AND Sequence='1' AND WorkPoint='{WorkPoint}' ;
  330. INSERT INTO [dbo].[ICSManufactureReceiveLot] ([ID], [ProductionCode], [ProductionSequence], [RCVCode], [RCVSequence], [LotNo], [InvCode], [WarehouseCode], [LocationCode], [Quantity], [Memo], [IsBind], [MUSER], [MUSERName], [MTIME], [WorkPoint]) SELECT NEWID(), N'{ProductionCode}', N'1', N'', N'', N'{LotNo}', N'{InvCode}', a.WarehouseCode, N'{LocationCode}', '{Quantity}', NULL, '0', N'{MUSER}', N'{MUSERNAME}', '{MTIME}', N'{WorkPoint}' FROM ICSWarehouse a
  331. INNER JOIN ICSLocation b ON a.Id=b.WHID AND a.workpoint=b.WorkPoint
  332. where b.LocationCode='{LocationCode}' and a.Workpoint='{WorkPoint}'; ";
  333. if (RCVCode != "" && RCVCode != null && RCVSequence != "" && RCVSequence != null)
  334. {
  335. sql += $@" IF NOT EXISTS(SELECT a.ID FROM ICSManufactureReceive a
  336. INNER JOIN ICSManufactureReceiveLot b ON a.SourceCode = b.ProductionCode AND a.WorkPoint = b.WorkPoint AND a.InvCode = b.InvCode
  337. WHERE a.RCVCode = '{RCVCode}' AND a.InvCode = '{InvCode}' AND b.LOTNO = '{LotNo}' and a.Sequence = '{RCVSequence}' and a.WorkPoint = '{WorkPoint}')
  338. BEGIN
  339. RAISERROR(':{LotNo}:{RCVCode}', 16, 1);
  340. RETURN
  341. END;
  342. UPDATE ICSManufactureReceiveLot SET IsBind = '1', RCVCode = '{RCVCode}', RCVSequence = '1' WHERE LotNo = '{LotNo}' and WorkPoint = '{WorkPoint}';
  343. IF EXISTS(SELECT a.Quantity FROM ICSManufactureReceive a
  344. INNER JOIN ICSManufactureReceiveLot b ON a.SourceCode = b.ProductionCode AND a.WorkPoint = b.WorkPoint AND a.InvCode = b.InvCode
  345. WHERE a.RCVCode = '{RCVCode}' and a.Sequence = '{RCVSequence}' AND a.InvCode = '{InvCode}' AND b.IsBind = '1'
  346. GROUP BY a.Quantity
  347. HAVING sum(b.Quantity) > a.Quantity)
  348. BEGIN
  349. RAISERROR(':{RCVCode}', 16, 1);
  350. RETURN
  351. END; ";
  352. }
  353. }
  354. count = SqlHelper.CmdExecuteNonQueryLi(sql);
  355. if (count > 0)
  356. {
  357. msg = "导入成功";
  358. }
  359. else
  360. {
  361. return "无有效的导入数据。";
  362. }
  363. return msg;
  364. }
  365. catch (Exception ex)
  366. {
  367. return ex.Message;
  368. }
  369. }
  370. public DataTable GetINV(string invcode, string Code, string Invstd, string EATTRIBUTE2, string TimeFrom, string TimeArrive,string isSeachStatus, ref Pagination jqgridparam)
  371. {
  372. string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
  373. List<DbParameter> parameter = new List<DbParameter>();
  374. DataTable table = new DataTable();
  375. string wherestr = "";
  376. if (!string.IsNullOrEmpty(invcode) || !string.IsNullOrEmpty(Code) || !string.IsNullOrEmpty(Invstd) || !string.IsNullOrEmpty(isSeachStatus))
  377. {
  378. if (!string.IsNullOrEmpty(invcode))
  379. {
  380. wherestr += " and a.InvCode like '%" + invcode + "%'";
  381. }
  382. if (!string.IsNullOrEmpty(Code))
  383. {
  384. wherestr += " and c.TransCode like '%" + Code + "%'";
  385. }
  386. if (!string.IsNullOrEmpty(Invstd))
  387. {
  388. wherestr += " and b.InvStd like '%" + Invstd + "%'";
  389. }
  390. if (!string.IsNullOrEmpty(isSeachStatus))
  391. {
  392. if (isSeachStatus=="1")
  393. {
  394. wherestr += " and a.EATTRIBUTE30 = '1'";
  395. }
  396. else if (isSeachStatus == "2")
  397. {
  398. wherestr += " and (a.EATTRIBUTE30 = '0' or isnull(a.EATTRIBUTE30,'')='')";
  399. }
  400. else
  401. {
  402. }
  403. }
  404. }
  405. else
  406. {
  407. wherestr += " and a.MTIME >= '" + TimeFrom + "'";
  408. wherestr += " and a.MTIME <= '" + TimeArrive + "'";
  409. }
  410. string sql = @"
  411. select a.ID,a.LotNo as LotNO,a.Quantity,a.InvCode,b.InvName,b.InvStd,b.InvUnit,d.BatchCode
  412. ,case when a.EATTRIBUTE30='1' then '是' else '否' end isSeachStatus,c.EATTRIBUTE30,c.TransCode
  413. from dbo.ICSInventoryLot a
  414. left join dbo.ICSInventory b on a.InvCode=b.InvCode and a.WorkPoint=b.WorkPoint
  415. left join dbo.ICSInventoryLotDetail c on a.LotNo=c.LotNo and a.WorkPoint=b.WorkPoint
  416. left join dbo.ICSExtension d on a.ExtensionID=d.ID and a.WorkPoint=d.WorkPoint
  417. left join dbo.ICSInspectionSheet e on a.LotNo=e.LotNo and a.WorkPoint=e.WorkPoint
  418. where a.Type='3' and e.LotNo is null and b.InvFQC='1' and a.WorkPoint = '" + WorkPoint + "'" + wherestr;
  419. return Repository().FindTablePageBySql(sql.ToString(), parameter.ToArray(), ref jqgridparam);
  420. }
  421. public string UpdateLotSeachStatus(string keyValue,string Type)
  422. {
  423. //站点信息
  424. string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
  425. string msg = "";
  426. keyValue = keyValue.Substring(1, keyValue.Length - 2);
  427. string sql = string.Empty;
  428. sql = string.Format(@" update dbo.ICSInventoryLot set EATTRIBUTE30='{2}' WHERE LotNo IN ({0}) and WorkPoint ='{1}'", keyValue.TrimEnd(','), WorkPoint, Type);
  429. try
  430. {
  431. if (SqlHelper.CmdExecuteNonQueryLi(sql) > 0)
  432. {
  433. }
  434. }
  435. catch (Exception ex)
  436. {
  437. msg = ex.Message;
  438. }
  439. return msg;
  440. }
  441. /// <summary>
  442. /// 送检单导出
  443. /// </summary>
  444. /// <param name="ProductBrand"></param>
  445. /// <param name="cCusName"></param>
  446. /// <param name="DesignAddRate"></param>
  447. /// <returns></returns>
  448. public DataTable StatementExportAll(string CheckNo)
  449. {
  450. string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location.TrimEnd(',');
  451. string sql = string.Empty;
  452. object Figure = GetDecimalDigits();
  453. string TableCode = string.Empty;
  454. #region sql语句
  455. sql = @"SELECT DISTINCT a.CheckCode '送检单号',a.LotNo '条码',a.InvCode '料品代码',c.InvName '料品名称',c.InvUnit '规格型号',a.Quantity '条码数量',a.Amount '辅计量数量',c.InvUnit '单位',b.FinalResult '检验结果',b.FinalUser '检验人',b.FinalTime '检验时间',a.MTIME '创建时间',a.MUSERName '创建人'
  456. from ICSInspectionSheet a
  457. LEFT JOIN IcsMatCheckResult b ON b.EATTRIBUTE4='1' AND a.CheckCode=b.CheckNo
  458. INNER JOIN ICSInventory c ON a.InvCode=c.InvCode AND a.WorkPoint=c.WorkPoint and a.CheckCode in (" + CheckNo.TrimEnd(',') + ")";
  459. #endregion
  460. sql = sql + " and a.WorkPoint='{1}'";
  461. sql = string.Format(sql, Figure, WorkPoint);
  462. DataTable dt = SqlHelper.GetDataTableBySql(sql);
  463. return dt;
  464. }
  465. }
  466. }