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.

810 lines
44 KiB

  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. namespace NFine.Application.OMAY
  16. {
  17. public class ICSOOCreateLotApp : RepositoryFactory<ICSVendor>
  18. {
  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 distinct a.ID, a.OODetailID,a.OOCode,a.Sequence, CAST(a.InQuantity AS DECIMAL(18,{0})) as RCVQuantity ,a.InvCode,b.InvName,b.InvDesc,b.InvStd,b.InvUnit,CAST( a.Quantity AS DECIMAL(18,{0})) as Quantity,CAST( a.Amount as DECIMAL(18,{0})) as Amount
  28. ,a.Status,a.ExtensionID,a.MUSERName,a.MTIME ,CAST(c.LOTQTY AS DECIMAL(18,{0})) as LOTQTY ,CAST( a.Quantity AS DECIMAL(18,{0})) -CAST(a.InQuantity AS DECIMAL(18,{0})) as ERPNum
  29. ,f.Colspan ,f.ProjectCode ,f.BatchCode ,f.Version ,f.Brand ,f.cFree1 ,f.cFree2 ,f.cFree3 ,f.cFree4
  30. ,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,
  31. a.EATTRIBUTE9,a.EATTRIBUTE10
  32. from ICSOutsourcingOrder a
  33. left join ICSInventory b on a.InvCode=b.InvCode and a.WorkPoint=b.WorkPoint
  34. left join (
  35. select mm.TransCode,mm.TransSequence,sum(isnull(ee.Quantity,0)) LOTQTY,ee.WorkPoint from ICSInventoryLot ee
  36. left join ICSInventoryLotDetail mm on ee.LotNo=mm.LotNo and ee.type='3'
  37. where isnull(ee.EATTRIBUTE1,'')=''
  38. group by mm.TransCode,mm.TransSequence,ee.WorkPoint
  39. )c
  40. on a.OOCode=c.TransCode and a.Sequence=c.TransSequence and a.WorkPoint=c.WorkPoint
  41. left join ICSExtension f on a.ExtensionID=f.ID and a.WorkPoint=f.WorkPoint WHERE 1=1 and a.Status='2'";
  42. sql = string.Format(sql, Figure);
  43. sql = string.Format(sql, DbHelper.GetErpIp(), DbHelper.GetErpName());
  44. #endregion
  45. if (!string.IsNullOrWhiteSpace(queryJson))
  46. {
  47. if (!string.IsNullOrWhiteSpace(queryParam["POCode"].ToString()))
  48. {
  49. sql += " and a.OOCode like '%" + queryParam["POCode"].ToString() + "%' ";
  50. }
  51. if (!string.IsNullOrWhiteSpace(queryParam["InvCode"].ToString()))
  52. {
  53. sql += " and a.InvCode like '%" + queryParam["InvCode"].ToString() + "%' ";
  54. }
  55. if (!string.IsNullOrWhiteSpace(queryParam["InvName"].ToString()))
  56. {
  57. sql += " and b.InvName like '%" + queryParam["InvName"].ToString() + "%' ";
  58. }
  59. if (!string.IsNullOrWhiteSpace(queryParam["BatchCode"].ToString()))
  60. {
  61. sql += " and f.BatchCode like '%" + queryParam["BatchCode"].ToString() + "%' ";
  62. }
  63. if (!string.IsNullOrWhiteSpace(queryParam["SelGDLX"].ToString()))
  64. {
  65. sql += " and a.MOType like '%" + queryParam["SelGDLX"].ToString() + "%' ";
  66. }
  67. if (!string.IsNullOrWhiteSpace(queryParam["POStatus"].ToString()))
  68. {
  69. string POStatus = queryParam["POStatus"].ToString();
  70. if (POStatus == "0")
  71. {
  72. //sql += " and a.Quantity=ISNULL(c.LotQty,0)";
  73. }
  74. else if (POStatus == "1")
  75. {
  76. sql += " and ISNULL(c.LOTQTY,0)>=a.Quantity";
  77. }
  78. else
  79. {
  80. sql += " and ISNULL(c.LOTQTY,0)<a.Quantity";
  81. }
  82. }
  83. }
  84. if (NFine.Code.OperatorProvider.Provider.GetCurrent().RoleEnCode != "admin")
  85. {
  86. sql += " and a.WorkPoint='" + NFine.Code.OperatorProvider.Provider.GetCurrent().Location + "'";
  87. }
  88. if (NFine.Code.OperatorProvider.Provider.GetCurrent().RoleEnCode == "Vendor")
  89. {
  90. sql += " and a.VenCode='" + NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode + "'";
  91. }
  92. return Repository().FindTablePageBySql(sql.ToString(), parameter.ToArray(), ref jqgridparam);
  93. }
  94. //生成条码子表查询
  95. public DataTable GetSubGridJson(string ApplyNegCode, string Sequence, string Type, ref Pagination jqgridparam)
  96. {
  97. DataTable dt = new DataTable();
  98. object Figure = GetDecimalDigits();
  99. List<DbParameter> parameter = new List<DbParameter>();
  100. string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location.TrimEnd(',');
  101. string sql = @" select c.TransCode,c.TransSequence ,a.ID,a.LotNo, CAST( a.Quantity AS DECIMAL(18,{0})) as Quantity ,a.MUSERName,a.MTIME
  102. ,f.Colspan ,f.ProjectCode ,f.BatchCode ,f.Version ,f.Brand ,f.cFree1 ,f.cFree2 ,f.cFree3 ,f.cFree4
  103. ,f.cFree5 ,f.cFree6 ,f.cFree7 ,f.cFree8 ,f.cFree9 ,f.cFree10,
  104. case when isnull(d.ID,'')='' then '' else '' end as isStorage,
  105. case when g.InvIQC='1'and isnull(e.ID,'')='' then '' else '' end as isInspection,
  106. case when g.InvIQC='1' then '是' else '否' end as isExemption,a.Amount,
  107. convert(varchar(20),a.ProductDate,23) as ProductDate,convert(varchar(20),a.ExpirationDate,23) as ExpirationDate ,g.EffectiveDays
  108. from ICSInventoryLot a
  109. left join (select count(LotNo) LotNoCount,LotNo,WorkPoint from ICSWareHouseLotInfo
  110. group by LotNo,WorkPoint)b on a.LotNo=b.LotNo and a.WorkPoint=b.WorkPoint
  111. left join ICSInventoryLotDetail c on a.LotNo=c.LotNo and a.WorkPoint=c.WorkPoint
  112. left join ICSExtension f on a.ExtensionID=f.ID and a.WorkPoint=f.WorkPoint
  113. left join dbo.ICSWareHouseLotInfo d on a.LotNo=d.LotNo and a.WorkPoint=d.WorkPoint
  114. left join ICSInspection e on a.LotNo=e.LotNo and e.Enable='1' and a.WorkPoint=e.WorkPoint
  115. left join ICSInventory g on a.InvCode=g.InvCode and a.WorkPoint=g.WorkPoint
  116. WHERE isnull(a.EATTRIBUTE1,'')='' and a.Type='" + Type + "' and c.TransCode='" + ApplyNegCode + "' and c.TransSequence='" + Sequence + "' and a.WorkPoint in ('" + WorkPoint + "')";
  117. sql = string.Format(sql, Figure);
  118. return Repository().FindTablePageBySql(sql.ToString(), parameter.ToArray(), ref jqgridparam);
  119. }
  120. //获取小数点数位
  121. public object GetDecimalDigits()
  122. {
  123. string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location.TrimEnd(',');
  124. try
  125. {
  126. string sql = string.Empty;
  127. sql = @"select Figure from ICSConfiguration where Code='Figure001' and Enable='1' and WorkPoint='" + WorkPoint + "'";
  128. object Figure = SqlHelper.ExecuteScalar(sql);
  129. return Figure;
  130. }
  131. catch (Exception ex)
  132. {
  133. throw new Exception(ex.Message.ToString());
  134. }
  135. }
  136. //工单生成条码获取物料数量信息
  137. public DataTable GetSubGridJsonChengPingByCreate(string OOCode, string Sequence, string WorkPoint)
  138. {
  139. DataTable dt = new DataTable();
  140. object Figure = GetDecimalDigits();
  141. List<DbParameter> parameter = new List<DbParameter>();
  142. string sql = @"select d.Enable, a.InvCode,b.ClassCode,b.InvName,b.InvStd,b.InvUnit, CAST( a.Quantity AS DECIMAL(18,{0})) as Quantity,CAST( a.Amount as DECIMAL(18,{0})) as Amount, CAST( isnull(c.LOTQTY,0) as DECIMAL(18,{0})) as CreatedQty,
  143. CAST( (a.Quantity-ISNULL(c.LOTQTY,0)) as DECIMAL(18,{0})) as thisCreateQty,isnull(b.EffectiveEnable,0) as EffectiveEnable, CAST( isnull(b.EffectiveDays,0) as DECIMAL(18,{0})) as EffectiveDays
  144. ,e.ProjectCode,e.BatchCode,e.Version,e.Brand,e.cFree1,e.cFree2,e.cFree3,e.cFree4,e.cFree5,e.cFree6,e.cFree7,e.cFree8,e.cFree9,e.cFree10
  145. from ICSOutsourcingOrder a
  146. left join ICSInventory b on a.InvCode=b.InvCode and a.WorkPoint=b.WorkPoint
  147. left join (
  148. select b.TransCode,b.TransSequence,sum(isnull(Quantity,0)) LOTQTY from ICSInventoryLot a
  149. left join ICSInventoryLotDetail b on a.LotNo=b.LotNo and a.Type='3'
  150. where isnull(a.EATTRIBUTE1,'')=''
  151. group by b.TransCode,b.TransSequence
  152. ) c on a.OOCode=c.TransCode and a.Sequence=c.TransSequence
  153. left join ICSConfiguration d on d.Code='CompleteVerification001' and a.WorkPoint =d.WorkPoint
  154. left join ICSExtension e on a.ExtensionID=e.ID and a.WorkPoint=e.WorkPoint
  155. WHERE 1 =1 and a.Status='2'
  156. and a.OOCode='" + OOCode + "' and a.Sequence='" + Sequence + "'";
  157. sql += " and a.WorkPoint='" + WorkPoint + "'";
  158. sql = string.Format(sql, Figure);
  159. return Repository().FindTableBySql(sql.ToString());
  160. }
  161. //查询超生比例
  162. public DataTable GetScale()
  163. {
  164. DataTable dt = new DataTable();
  165. List<DbParameter> parameter = new List<DbParameter>();
  166. string sql = @" SELECT Top 1 a.F_Define1 as Prorate
  167. FROM [dbo].[Sys_SRM_ItemsDetail] a
  168. LEFT JOIN [dbo].[Sys_SRM_Items] b ON a.F_ItemId=b.F_Id AND b.F_EnabledMark='1'
  169. WHERE b.F_EnCode='CS0001' ORDER BY a.F_ItemCode";
  170. return Repository().FindTableBySql(sql.ToString());
  171. }
  172. //调用接口来显示本次可生产数量
  173. public object GetAbsolveQty(string OOCode, string Sequence,string Qty)
  174. {
  175. decimal AvailQty = 0;
  176. decimal AllQty = 0;
  177. string msg = "";
  178. string sql = @"select
  179. a.WorkPoint as WorkPoint,
  180. a.OODetailID as DetailID,
  181. '' as Type,
  182. cast( isnull(c.LOTQTY,0) as DECIMAL(18,4)) as InQty,
  183. " + Qty + @" as Qty,
  184. flag.F_Define1 as Prorate
  185. from ICSOutsourcingOrder a
  186. left join ICSInventory b on a.InvCode=b.InvCode and a.WorkPoint=b.WorkPoint
  187. left join (
  188. select b.TransCode,b.TransSequence,sum(isnull(Quantity,0)) LOTQTY from ICSInventoryLot a
  189. left join ICSInventoryLotDetail b on a.LotNo=b.LotNo and a.Type='3'
  190. where isnull(a.EATTRIBUTE1,'')=''
  191. group by b.TransCode,b.TransSequence
  192. ) c on a.OOCode=c.TransCode and a.Sequence=c.TransSequence
  193. left join (
  194. select b.TransCode,PARSENAME(REPLACE(b.TransSequence, '~', '.'), 2) as TransSequence ,sum(isnull(Quantity,0)) OOPickQTY from ICSInventoryLot a
  195. left join ICSInventoryLotDetail b on a.LotNo=b.LotNo and a.Type='20'
  196. where isnull(a.EATTRIBUTE1,'')=''
  197. group by b.TransCode,PARSENAME(REPLACE(b.TransSequence, '~', '.'), 2)
  198. ) f on a.OOCode=f.TransCode and a.Sequence=f.TransSequence
  199. left join ICSConfiguration d on d.Code='CompleteVerification001' and a.WorkPoint =d.WorkPoint
  200. left join ICSExtension e on a.ExtensionID=e.ID and a.WorkPoint=e.WorkPoint
  201. left join Sys_SRM_ItemsDetail flag on flag.F_ItemCode='GDCS0001'
  202. WHERE 1 =1 and a.Status='2'
  203. and a.OOCode='" + OOCode + "' and a.Sequence='" + Sequence + "'";
  204. DataTable dt = SqlHelper.GetDataTableBySql(sql);
  205. string Inputstr = JsonConvert.SerializeObject(dt);
  206. string APIURL = ConfigurationManager.ConnectionStrings["ERPAPIURL"].ConnectionString + "Completeamnew/Approve";
  207. string result = HttpPost(APIURL, Inputstr);
  208. JObject Obj = (JObject)JsonConvert.DeserializeObject(result);//或者JObject jo = JObject.Parse(jsonText);
  209. string MessAge = Obj["Message"].ToString();
  210. string Success = Obj["Success"].ToString();
  211. if (Success.ToUpper() == "FALSE")
  212. {
  213. msg = MessAge;
  214. }
  215. else
  216. {
  217. if (msg == "")
  218. {
  219. JObject dataObj = JObject.Parse(Obj["Data"].ToString());
  220. AvailQty = decimal.Parse(dataObj["AvailQty"].ToString());
  221. AllQty = decimal.Parse(dataObj["AllQty"].ToString());
  222. //JArray res = (JArray)JsonConvert.DeserializeObject(Obj["Data"].ToString());
  223. //foreach (var item in res)
  224. //{
  225. // JObject jo = (JObject)item;
  226. // //var aa= jo["min_lotqty"].ToString();
  227. // Num = Convert.ToDecimal(jo["AllQty"].ToString());
  228. //}
  229. }
  230. }
  231. var Header = new
  232. {
  233. msg = msg,
  234. AvailQty = AvailQty,
  235. AllQty= AllQty,
  236. };
  237. return Header;
  238. }
  239. //接口api解析
  240. public static string HttpPost(string url, string body)
  241. {
  242. try
  243. {
  244. Encoding encoding = Encoding.UTF8;
  245. HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
  246. request.Method = "POST";
  247. request.Accept = "application/json, text/javascript, */*"; //"text/html, application/xhtml+xml, */*";
  248. request.ContentType = "application/json; charset=utf-8";
  249. byte[] buffer = encoding.GetBytes(body);
  250. request.ContentLength = buffer.Length;
  251. request.GetRequestStream().Write(buffer, 0, buffer.Length);
  252. HttpWebResponse response = (HttpWebResponse)request.GetResponse();
  253. using (StreamReader reader = new StreamReader(response.GetResponseStream(), encoding))
  254. {
  255. return reader.ReadToEnd();
  256. }
  257. }
  258. catch (WebException ex)
  259. {
  260. throw new Exception(ex.Message);
  261. }
  262. }
  263. //委外订单生成条码
  264. public int SubmitFormChengPing(string OOCode, string Sequence, string keyValue, string WorkPoint,string AMEnable)
  265. {
  266. var queryParam = keyValue.ToJObject();
  267. string WorkPoints = NFine.Code.OperatorProvider.Provider.GetCurrent().Location.TrimEnd(',');
  268. int createPageCount = Convert.ToInt32(queryParam["createPageCount"].ToString());
  269. decimal minPackQty = Convert.ToDecimal(queryParam["minPackQty"].ToString());
  270. decimal thisCreateQty = Convert.ToDecimal(queryParam["thisCreateQty"].ToString());
  271. decimal LOTQTY = minPackQty;
  272. //string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
  273. //string VenCode = GetVendorCode(ApplyNegCode, Sequence, WorkPoint);
  274. string Pre = "CP" + OOCode + (Convert.ToInt32(Sequence)).ToString("D4");
  275. string sql = string.Empty;
  276. //string VendorLot = queryParam["VendorLot"].ToString();
  277. string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode;
  278. string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName;
  279. string PRODUCTDATE = queryParam["PRODUCTDATE"].ToString();
  280. string InvCode = queryParam["ClassCode"].ToString();
  281. string sqls = string.Empty;
  282. string Colspan = "";
  283. string str1 = "";
  284. string LotNo=string.Empty;
  285. List<string> ExtensionIDList = new List<string>();
  286. for (int i = 0; i < createPageCount; i++)
  287. {
  288. if (i + 1 == createPageCount)
  289. {
  290. if (minPackQty * createPageCount > thisCreateQty)
  291. {
  292. LOTQTY = thisCreateQty - (minPackQty * (createPageCount - 1));
  293. }
  294. }
  295. Colspan = queryParam["ProjectCode"].ToString() + "~" + queryParam["BatchCode"].ToString() + "~" + queryParam["Version"].ToString() + "~" + queryParam["Brand"].ToString() + "~" + queryParam["cFree1"].ToString() + "~" + queryParam["cFree2"].ToString() + "~" + queryParam["cFree3"].ToString() + "~" + queryParam["cFree4"].ToString() + "~" + queryParam["cFree5"].ToString() + "~" + queryParam["cFree6"].ToString() + "~" + queryParam["cFree7"].ToString() + "~" + queryParam["cFree8"].ToString() + "~" + queryParam["cFree9"].ToString() + "~" + queryParam["cFree10"].ToString();
  296. sqls = string.Format(@"select ID from ICSExtension where Colspan='{0}' and WorkPoint='{1}'", Colspan, WorkPoint);
  297. object ExtensionID = SqlHelper.ExecuteScalar(sqls);
  298. bool flag = true;
  299. foreach (var item in ExtensionIDList)
  300. {
  301. if (item == Colspan + WorkPoint)
  302. {
  303. flag = false;
  304. }
  305. }
  306. if (ExtensionID == null && flag == true)
  307. {
  308. str1 = Guid.NewGuid().ToString();
  309. sql += string.Format(@"Insert into ICSExtension(ID, Colspan, ProjectCode, BatchCode, Version, Brand, cFree1, cFree2, cFree3, cFree4, cFree5, cFree6, cFree7, cFree8, cFree9, cFree10, MTIME, MUSER, MUSERName, WorkPoint)
  310. Values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}',getdate(),'{16}','{17}','{18}' )",
  311. str1, Colspan, queryParam["ProjectCode"].ToString(), queryParam["BatchCode"].ToString(), queryParam["Version"].ToString(), queryParam["Brand"].ToString(), queryParam["cFree1"].ToString(), queryParam["cFree2"].ToString(), queryParam["cFree3"].ToString(), queryParam["cFree4"].ToString(), queryParam["cFree5"].ToString(), queryParam["cFree6"].ToString(), queryParam["cFree7"].ToString(), queryParam["cFree8"].ToString(), queryParam["cFree9"].ToString(), queryParam["cFree10"].ToString(),
  312. MUSER, MUSERNAME, WorkPoints);
  313. }
  314. else if (ExtensionID != null)
  315. {
  316. str1 = ExtensionID.ToString();
  317. }
  318. ExtensionIDList.Add(Colspan + WorkPoint);
  319. //传过来的参数判断是否是奥美的项目奥美项目执行独有生成条码规则
  320. if (AMEnable == "true")
  321. {
  322. LotNo = SqlHelper.GetLOTNumber(InvCode, WorkPoint);
  323. }
  324. else
  325. {
  326. LotNo = GetSerialCode(WorkPoint, "ICSInventoryLot", "LotNO", Pre, 5);
  327. }
  328. sql += string.Format(@"Insert into ICSInventoryLotDetail(LotNo, TransCode,TransSequence,MUSER,MUSERName,MTIME,WorkPoint)
  329. Values('{0}','{1}','{2}','{3}','{4}',getdate(),'{5}' )",
  330. LotNo, OOCode, Sequence, MUSER, MUSERNAME, WorkPoints);
  331. //if (SqlHelper.ExecuteNonQuery(sqls) > 0)
  332. //{
  333. sql += string.Format(@"insert into ICSInventoryLot
  334. (ID,LotNo,InvCode,ProductDate,ExpirationDate,Quantity,ExtensionID,Type,MUSER,MUSERName,MTIME,WorkPoint,Amount
  335. ,EATTRIBUTE1,EATTRIBUTE2,EATTRIBUTE3,EATTRIBUTE4,EATTRIBUTE5,EATTRIBUTE6,EATTRIBUTE7,EATTRIBUTE8,EATTRIBUTE9,EATTRIBUTE10)
  336. select
  337. newid(),'{0}',InvCode,'{1}','{10}','{2}','{8}','201','{3}','{4}', getdate(),'{5}','{9}','{11}','{12}','{13}','{14}','{15}','{16}','{17}','{18}','{19}','{20}'
  338. from ICSOutsourcingOrder where OOCode='{6}' and Sequence='{7}' and WorkPoint='{5}' ",
  339. LotNo, PRODUCTDATE, LOTQTY, MUSER, MUSERNAME, WorkPoints, OOCode, Sequence, str1, Convert.ToDecimal(queryParam["Amount"].ToString()) / minPackQty * LOTQTY, queryParam["ExpirationDate"].ToString()
  340. , queryParam["EATTRIBUTE1"].ToString(), queryParam["EATTRIBUTE2"].ToString(), queryParam["EATTRIBUTE3"].ToString(), queryParam["EATTRIBUTE4"].ToString(), queryParam["EATTRIBUTE5"].ToString(),
  341. queryParam["EATTRIBUTE6"].ToString(), queryParam["EATTRIBUTE7"].ToString(), queryParam["EATTRIBUTE8"].ToString(), queryParam["EATTRIBUTE9"].ToString(), queryParam["EATTRIBUTE10"].ToString());
  342. sql += "\r\n";
  343. //}
  344. }
  345. int count = SqlHelper.CmdExecuteNonQueryLi(sql);
  346. return count;
  347. }
  348. public string GetSerialCode(string workPointCode, string tbName, string colName, string Pre, int numLen)
  349. {
  350. string sql = "EXEC Addins_GetSerialCode '{0}','{1}','{2}','{3}',{4}";
  351. sql = string.Format(sql, new object[] { workPointCode, tbName, colName, Pre, numLen });
  352. //return Repository().FindTableBySql(sql.ToString());
  353. return SqlHelper.ExecuteScalar(sql).ToString();
  354. //return DbHelper.ExecuteScalar(CommandType.Text, sql).ToString();
  355. }
  356. //委外子件
  357. public DataTable GetGridJsonOOPick(string queryJson, ref Pagination jqgridparam)
  358. {
  359. DataTable dt = new DataTable();
  360. var queryParam = queryJson.ToJObject();
  361. List<DbParameter> parameter = new List<DbParameter>();
  362. object Figure = GetDecimalDigits();
  363. #region [SQL]
  364. string sql = @"select a.ID,d.OOCode,d.Sequence+'~'+ a.Sequence as Sequence,a.PickID,a.InvCode as ZInvCode,d.InvCode as MInvCode,b.InvName,b.InvDesc,b.InvStd,b.InvUnit,
  365. CAST(a.Quantity AS DECIMAL(18,{0})) as Quantity ,a.OODetailID,
  366. CAST(a.Amount AS DECIMAL(18,{0})) as Amount,CAST(a.IssueQuantity AS DECIMAL(18,{0})) as IssueQuantity ,a.ExtensionID,a.MUSERName,a.MTIME ,CAST(c.LOTQTY AS DECIMAL(18,{0})) as LOTQTY
  367. ,f.Colspan ,f.ProjectCode ,f.BatchCode ,f.Version ,f.Brand ,f.cFree1 ,f.cFree2 ,f.cFree3 ,f.cFree4
  368. ,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,
  369. a.EATTRIBUTE9,a.EATTRIBUTE10
  370. from ICSOOPick a
  371. inner join ICSOutsourcingOrder d on a.OODetailID=d.OODetailID and a.WorkPoint=d.WorkPoint and d.Status='2'
  372. inner join ICSInventory b on a.InvCode=b.InvCode and a.WorkPoint=b.WorkPoint
  373. left join (
  374. select mm.TransCode,mm.TransSequence,sum(isnull(ee.Quantity,0)) LOTQTY,ee.WorkPoint from ICSInventoryLot ee
  375. left join ICSInventoryLotDetail mm on ee.LotNo=mm.LotNo and ee.type='20'
  376. where isnull(ee.EATTRIBUTE1,'')=''
  377. group by mm.TransCode,mm.TransSequence,ee.WorkPoint
  378. )c
  379. on d.OOCode=c.TransCode and d.Sequence+'~'+a.Sequence=c.TransSequence and a.WorkPoint=c.WorkPoint
  380. left join ICSExtension f on a.ExtensionID=f.ID and a.WorkPoint=f.WorkPoint
  381. where a.EATTRIBUTE1='1' ";
  382. sql = string.Format(sql, Figure);
  383. sql = string.Format(sql, DbHelper.GetErpIp(), DbHelper.GetErpName());
  384. #endregion
  385. if (!string.IsNullOrWhiteSpace(queryJson))
  386. {
  387. if (!string.IsNullOrWhiteSpace(queryParam["POCode"].ToString()))
  388. {
  389. sql += " and d.OOCode like '%" + queryParam["POCode"].ToString() + "%' ";
  390. }
  391. if (!string.IsNullOrWhiteSpace(queryParam["InvCode"].ToString()))
  392. {
  393. sql += " and a.InvCode like '%" + queryParam["InvCode"].ToString() + "%' ";
  394. }
  395. if (!string.IsNullOrWhiteSpace(queryParam["InvName"].ToString()))
  396. {
  397. sql += " and b.InvName like '%" + queryParam["InvName"].ToString() + "%' ";
  398. }
  399. if (!string.IsNullOrWhiteSpace(queryParam["BatchCode"].ToString()))
  400. {
  401. sql += " and f.BatchCode like '%" + queryParam["BatchCode"].ToString() + "%' ";
  402. }
  403. if (!string.IsNullOrWhiteSpace(queryParam["POStatus"].ToString()))
  404. {
  405. string POStatus = queryParam["POStatus"].ToString();
  406. if (POStatus == "0")
  407. {
  408. //sql += " and a.Quantity=ISNULL(c.LotQty,0)";
  409. }
  410. else if (POStatus == "1")
  411. {
  412. sql += " and ISNULL(c.LOTQTY,0)>=a.Quantity";
  413. }
  414. else
  415. {
  416. sql += " and ISNULL(c.LOTQTY,0)<a.Quantity";
  417. }
  418. }
  419. }
  420. if (NFine.Code.OperatorProvider.Provider.GetCurrent().RoleEnCode != "admin")
  421. {
  422. sql += " and a.WorkPoint='" + NFine.Code.OperatorProvider.Provider.GetCurrent().Location + "'";
  423. }
  424. if (NFine.Code.OperatorProvider.Provider.GetCurrent().RoleEnCode == "Vendor")
  425. {
  426. sql += " and a.VenCode='" + NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode + "'";
  427. }
  428. return Repository().FindTablePageBySql(sql.ToString(), parameter.ToArray(), ref jqgridparam);
  429. }
  430. //副产品生成条码获取物料数量信息
  431. public DataTable GetSubGridJsonOOPickCreate(string OOPickCode, string Sequence, string WorkPoint)
  432. {
  433. DataTable dt = new DataTable();
  434. object Figure = GetDecimalDigits();
  435. List<DbParameter> parameter = new List<DbParameter>();
  436. string sql = @"
  437. select
  438. a.InvCode,b.InvName,b.ClassCode,b.InvStd,b.InvUnit, a.Quantity as Quantity,
  439. cast( isnull(c.LOTQTY,0)+isnull(f.GDQTY,0) as DECIMAL(18,4)) as CreatedQty,
  440. cast( a.Amount as DECIMAL(18,4)) as Amount,
  441. isnull(b.EffectiveEnable,0) as EffectiveEnable,
  442. cast( isnull(b.EffectiveDays,0) as DECIMAL(18,4)) as EffectiveDays
  443. ,e.ProjectCode,e.BatchCode,e.Version,e.Brand,e.cFree1,e.cFree2,e.cFree3,e.cFree4,e.cFree5,e.cFree6,e.cFree7,e.cFree8,e.cFree9,e.cFree10
  444. from ICSOOPick a
  445. left join ICSOutsourcingOrder d on a.OODetailID=d.OODetailID and a.WorkPoint=d.WorkPoint and d.Status='2'
  446. --
  447. left join ICSInventory b on a.InvCode=b.InvCode and a.WorkPoint=b.WorkPoint
  448. left join (
  449. select b.TransCode,b.TransSequence,sum(isnull(Quantity,0)) LOTQTY from ICSInventoryLot a
  450. left join ICSInventoryLotDetail b on a.LotNo=b.LotNo and a.Type='20'
  451. where isnull(a.EATTRIBUTE1,'')=''
  452. group by b.TransCode,b.TransSequence
  453. ) c on d.OOCode=c.TransCode and d.Sequence+'~'+a.Sequence=c.TransSequence
  454. --
  455. left join (
  456. select b.TransCode,b.TransSequence ,sum(isnull(Quantity,0)) GDQTY from ICSInventoryLot a
  457. left join ICSInventoryLotDetail b on a.LotNo=b.LotNo and a.Type='3'
  458. where isnull(a.EATTRIBUTE1,'')=''
  459. group by b.TransCode,b.TransSequence
  460. ) f on d.OOCode=f.TransCode and d.Sequence=f.TransSequence
  461. left join ICSExtension e on d.ExtensionID=e.ID and a.WorkPoint=e.WorkPoint
  462. WHERE 1=1
  463. and d.OOCode='" + OOPickCode + "' and d.Sequence+'~'+a.Sequence='" + Sequence + "'";
  464. sql += " and a.WorkPoint='" + WorkPoint + "'";
  465. sql = string.Format(sql, Figure);
  466. return Repository().FindTableBySql(sql.ToString());
  467. }
  468. //副产品调用接口获取可生成数量
  469. public object GetOOPickAbsolveQty(string OOCode, string Sequence, string Qty)
  470. {
  471. decimal AvailQty = 0;
  472. decimal AllQty = 0;
  473. string msg = "";
  474. string sql = @"
  475. select
  476. a.WorkPoint as WorkPoint,
  477. a.OODetailID as DetailID,
  478. '' as Type,
  479. cast( isnull(c.LOTQTY,0) as DECIMAL(18,4)) as InQty,
  480. " + Qty + @" as Qty,
  481. flag.F_Define1 as Prorate
  482. from ICSOOPick a
  483. left join ICSOutsourcingOrder d on a.OODetailID=d.OODetailID and a.WorkPoint=d.WorkPoint and d.Status='2'
  484. --
  485. left join ICSInventory b on a.InvCode=b.InvCode and a.WorkPoint=b.WorkPoint
  486. left join (
  487. select b.TransCode,b.TransSequence,sum(isnull(Quantity,0)) LOTQTY from ICSInventoryLot a
  488. left join ICSInventoryLotDetail b on a.LotNo=b.LotNo and a.Type='20'
  489. where isnull(a.EATTRIBUTE1,'')=''
  490. group by b.TransCode,b.TransSequence
  491. ) c on d.OOCode=c.TransCode and d.Sequence+'~'+a.Sequence=c.TransSequence
  492. --
  493. left join (
  494. select b.TransCode,b.TransSequence ,sum(isnull(Quantity,0)) GDQTY from ICSInventoryLot a
  495. left join ICSInventoryLotDetail b on a.LotNo=b.LotNo and a.Type='3'
  496. where isnull(a.EATTRIBUTE1,'')=''
  497. group by b.TransCode,b.TransSequence
  498. ) f on d.OOCode=f.TransCode and d.Sequence=f.TransSequence
  499. left join ICSExtension e on d.ExtensionID=e.ID and a.WorkPoint=e.WorkPoint
  500. left join Sys_SRM_ItemsDetail flag on flag.F_ItemCode='GDCS0001'
  501. WHERE 1=1
  502. and d.OOCode='" + OOCode + "' and d.Sequence+'~'+a.Sequence='" + Sequence + "'";
  503. DataTable dt = SqlHelper.GetDataTableBySql(sql);
  504. string Inputstr = JsonConvert.SerializeObject(dt);
  505. string APIURL = ConfigurationManager.ConnectionStrings["ERPAPIURL"].ConnectionString + "Completeamnew/Approve";
  506. string result = HttpPost(APIURL, Inputstr);
  507. JObject Obj = (JObject)JsonConvert.DeserializeObject(result);//或者JObject jo = JObject.Parse(jsonText);
  508. string MessAge = Obj["Message"].ToString();
  509. string Success = Obj["Success"].ToString();
  510. if (Success.ToUpper() == "FALSE")
  511. {
  512. msg = MessAge;
  513. }
  514. else
  515. {
  516. if (msg == "")
  517. {
  518. JObject dataObj = JObject.Parse(Obj["Data"].ToString());
  519. AvailQty = decimal.Parse(dataObj["AvailQty"].ToString());
  520. AllQty = decimal.Parse(dataObj["AllQty"].ToString());
  521. }
  522. }
  523. var Header = new
  524. {
  525. msg = msg,
  526. AvailQty = AvailQty,
  527. AllQty = AllQty,
  528. };
  529. return Header;
  530. }
  531. //联副产品
  532. public int SubmitFormOOPick(string OOPickCode, string Sequence, string keyValue, string WorkPoint,string AMEnable)
  533. {
  534. var queryParam = keyValue.ToJObject();
  535. string WorkPoints = NFine.Code.OperatorProvider.Provider.GetCurrent().Location.TrimEnd(',');
  536. int createPageCount = Convert.ToInt32(queryParam["createPageCount"].ToString());
  537. decimal minPackQty = Convert.ToDecimal(queryParam["minPackQty"].ToString());
  538. decimal thisCreateQty = Convert.ToDecimal(queryParam["thisCreateQty"].ToString());
  539. decimal LOTQTY = minPackQty;
  540. string Sequences = Sequence.Replace("~", "");
  541. string Pre = "OOPick" + OOPickCode + (Convert.ToInt32(Sequences)).ToString("D4");
  542. string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode;
  543. string sql = string.Empty;
  544. string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName;
  545. string PRODUCTDATE = queryParam["PRODUCTDATE"].ToString();
  546. string InvCode = queryParam["ClassCode"].ToString();
  547. string sqls = string.Empty;
  548. string Colspan = "";
  549. string str1 = "";
  550. string LotNo = string.Empty;
  551. List<string> ExtensionIDList = new List<string>();
  552. for (int i = 0; i < createPageCount; i++)
  553. {
  554. if (i + 1 == createPageCount)
  555. {
  556. if (minPackQty * createPageCount > thisCreateQty)
  557. {
  558. LOTQTY = thisCreateQty - (minPackQty * (createPageCount - 1));
  559. }
  560. }
  561. Colspan = queryParam["ProjectCode"].ToString() + "~" + queryParam["BatchCode"].ToString() + "~" + queryParam["Version"].ToString() + "~" + queryParam["Brand"].ToString() + "~" + queryParam["cFree1"].ToString() + "~" + queryParam["cFree2"].ToString() + "~" + queryParam["cFree3"].ToString() + "~" + queryParam["cFree4"].ToString() + "~" + queryParam["cFree5"].ToString() + "~" + queryParam["cFree6"].ToString() + "~" + queryParam["cFree7"].ToString() + "~" + queryParam["cFree8"].ToString() + "~" + queryParam["cFree9"].ToString() + "~" + queryParam["cFree10"].ToString();
  562. sqls = string.Format(@"select ID from ICSExtension where Colspan='{0}' and WorkPoint='{1}'", Colspan, WorkPoint);
  563. object ExtensionID = SqlHelper.ExecuteScalar(sqls);
  564. bool flag = true;
  565. foreach (var item in ExtensionIDList)
  566. {
  567. if (item == Colspan + WorkPoint)
  568. {
  569. flag = false;
  570. }
  571. }
  572. if (ExtensionID == null && flag == true)
  573. {
  574. str1 = Guid.NewGuid().ToString();
  575. sql += string.Format(@"Insert into ICSExtension(ID, Colspan, ProjectCode, BatchCode, Version, Brand, cFree1, cFree2, cFree3, cFree4, cFree5, cFree6, cFree7, cFree8, cFree9, cFree10, MTIME, MUSER, MUSERName, WorkPoint)
  576. Values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}',getdate(),'{16}','{17}','{18}' )",
  577. str1, Colspan, queryParam["ProjectCode"].ToString(), queryParam["BatchCode"].ToString(), queryParam["Version"].ToString(), queryParam["Brand"].ToString(), queryParam["cFree1"].ToString(), queryParam["cFree2"].ToString(), queryParam["cFree3"].ToString(), queryParam["cFree4"].ToString(), queryParam["cFree5"].ToString(), queryParam["cFree6"].ToString(), queryParam["cFree7"].ToString(), queryParam["cFree8"].ToString(), queryParam["cFree9"].ToString(), queryParam["cFree10"].ToString(),
  578. MUSER, MUSERNAME, WorkPoints);
  579. }
  580. else if (ExtensionID != null)
  581. {
  582. str1 = ExtensionID.ToString();
  583. }
  584. ExtensionIDList.Add(Colspan + WorkPoint);
  585. //传过来的参数判断是否是奥美的项目奥美项目执行独有生成条码规则
  586. if (AMEnable == "true")
  587. {
  588. LotNo = SqlHelper.GetLOTNumber(InvCode, WorkPoint);
  589. }
  590. else
  591. {
  592. LotNo = GetSerialCode(WorkPoint, "ICSInventoryLot", "LotNO", Pre, 5);
  593. }
  594. sql += string.Format(@"Insert into ICSInventoryLotDetail(LotNo, TransCode,TransSequence,MUSER,MUSERName,MTIME,WorkPoint)
  595. Values('{0}','{1}','{2}','{3}','{4}',getdate(),'{5}' )",
  596. LotNo, OOPickCode, Sequence, MUSER, MUSERNAME, WorkPoints);
  597. sql += string.Format(@"insert into ICSInventoryLot
  598. (ID,LotNo,InvCode,ProductDate,ExpirationDate,Quantity,ExtensionID,Type,MUSER,MUSERName,MTIME,WorkPoint,Amount ,EATTRIBUTE1,EATTRIBUTE2,EATTRIBUTE3,EATTRIBUTE4,EATTRIBUTE5,EATTRIBUTE6,EATTRIBUTE7,EATTRIBUTE8,EATTRIBUTE9,EATTRIBUTE10)
  599. select
  600. newid(),'{0}',a.InvCode,'{1}','{10}','{2}','{8}','20','{3}','{4}', getdate(),'{5}','{9}','{11}','{12}','{13}','{14}','{15}','{16}','{17}','{18}','{19}','{20}'
  601. from ICSOOPick a left join ICSOutsourcingOrder d on a.OODetailID=d.OODetailID and a.WorkPoint=d.WorkPoint and d.Status='2' where d.OOCode='{6}' and d.Sequence+'~'+a.Sequence='{7}' and a.WorkPoint='{5}' ",
  602. LotNo, PRODUCTDATE, LOTQTY, MUSER, MUSERNAME, WorkPoints, OOPickCode, Sequence, str1, Convert.ToDecimal(queryParam["Amount"].ToString()) / minPackQty * LOTQTY, queryParam["ExpirationDate"].ToString()
  603. , queryParam["EATTRIBUTE1"].ToString(), queryParam["EATTRIBUTE2"].ToString(), queryParam["EATTRIBUTE3"].ToString(), queryParam["EATTRIBUTE4"].ToString(), queryParam["EATTRIBUTE5"].ToString(),
  604. queryParam["EATTRIBUTE6"].ToString(), queryParam["EATTRIBUTE7"].ToString(), queryParam["EATTRIBUTE8"].ToString(), queryParam["EATTRIBUTE9"].ToString(), queryParam["EATTRIBUTE10"].ToString());
  605. sql += "\r\n";
  606. }
  607. int count = SqlHelper.CmdExecuteNonQueryLi(sql);
  608. return count;
  609. }
  610. public DataTable GetByproductGridJson(string queryJson, ref Pagination jqgridparam)
  611. {
  612. DataTable dt = new DataTable();
  613. var queryParam = queryJson.ToJObject();
  614. List<DbParameter> parameter = new List<DbParameter>();
  615. #region [SQL]
  616. string sql = @" select a.ID,a.LotNo,a.InvCode,c.InvName,c.InvStd,a.Quantity,a.MUSERName,b.MTIME as WMTIME,a.MTIME
  617. from dbo.ICSInventoryLot a
  618. left join dbo.ICSWareHouseLotInfo b on a.LotNo=b.LotNo and a.WorkPoint=b.WorkPoint
  619. inner join dbo.ICSInventory c on a.InvCode=c.InvCode
  620. where a.Type='19'";
  621. // sql += " WHERE 1=1";
  622. sql = string.Format(sql, DbHelper.GetErpIp(), DbHelper.GetErpName());
  623. #endregion
  624. if (!string.IsNullOrWhiteSpace(queryJson))
  625. {
  626. if (!string.IsNullOrWhiteSpace(queryParam["MTDOCCode"].ToString()))
  627. {
  628. sql += " and a.MTDOCCode like '%" + queryParam["MTDOCCode"].ToString() + "%' ";
  629. }
  630. }
  631. if (NFine.Code.OperatorProvider.Provider.GetCurrent().RoleEnCode != "admin")
  632. {
  633. sql += " and a.WorkPoint='" + NFine.Code.OperatorProvider.Provider.GetCurrent().Location + "'";
  634. }
  635. //if (NFine.Code.OperatorProvider.Provider.GetCurrent().RoleEnCode == "Vendor")
  636. //{
  637. // sql += " and a.VenCode='" + NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode + "'";
  638. //}
  639. return Repository().FindTablePageBySql(sql.ToString(), parameter.ToArray(), ref jqgridparam);
  640. }
  641. public DataTable GetInvCode()
  642. {
  643. string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
  644. string sql = @"
  645. select '' as Code,'' as InvCode
  646. union all
  647. SELECT InvCode as Code ,InvCode as InvCode FROM dbo.ICSInventory WITH (NOLOCK) WHERE 1=1 and SUBSTRING(ClassCode, 1, 2) IN ('05') ";
  648. sql += " and WorkPoint='" + WorkPoint + "'";
  649. DataTable dt = SqlHelper.GetDataTableBySql(sql);
  650. return dt;
  651. }
  652. public int SubmitFormOOPickNoCode (string keyValue, string WorkPoint, string AMEnable)
  653. {
  654. var queryParam = keyValue.ToJObject();
  655. string WorkPoints = NFine.Code.OperatorProvider.Provider.GetCurrent().Location.TrimEnd(',');
  656. int createPageCount = Convert.ToInt32(queryParam["createPageCount"].ToString());
  657. decimal minPackQty = Convert.ToDecimal(queryParam["minPackQty"].ToString());
  658. string InvCode = queryParam["InvCode"].ToString();
  659. decimal LOTQTY = minPackQty;
  660. //string Sequences = Sequence.Replace("~", "");
  661. //string Pre = "OOPick" + OOPickOOCode + (Convert.ToInt32(Sequences)).ToString("D4");
  662. string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode;
  663. string sql = string.Empty;
  664. string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName;
  665. // string PRODUCTDATE = queryParam["PRODUCTDATE"].ToString();
  666. string ClassCode = queryParam["ClassCode"].ToString();
  667. string sqls = string.Empty;
  668. string Colspan = "";
  669. string str1 = "";
  670. string LotNo = string.Empty;
  671. List<string> ExtensionIDList = new List<string>();
  672. for (int i = 0; i < createPageCount; i++)
  673. {
  674. //if (i + 1 == createPageCount)
  675. //{
  676. // if (minPackQty * createPageCount > thisCreateQty)
  677. // {
  678. // LOTQTY = thisCreateQty - (minPackQty * (createPageCount - 1));
  679. // }
  680. //}
  681. Colspan = queryParam["ProjectCode"].ToString() + "~" + queryParam["BatchCode"].ToString() + "~" + queryParam["Version"].ToString() + "~" + queryParam["Brand"].ToString() + "~" + queryParam["cFree1"].ToString() + "~" + queryParam["cFree2"].ToString() + "~" + queryParam["cFree3"].ToString() + "~" + queryParam["cFree4"].ToString() + "~" + queryParam["cFree5"].ToString() + "~" + queryParam["cFree6"].ToString() + "~" + queryParam["cFree7"].ToString() + "~" + queryParam["cFree8"].ToString() + "~" + queryParam["cFree9"].ToString() + "~" + queryParam["cFree10"].ToString();
  682. sqls = string.Format(@"select ID from ICSExtension where Colspan='{0}' and WorkPoint='{1}'", Colspan, WorkPoint);
  683. object ExtensionID = SqlHelper.ExecuteScalar(sqls);
  684. bool flag = true;
  685. foreach (var item in ExtensionIDList)
  686. {
  687. if (item == Colspan + WorkPoint)
  688. {
  689. flag = false;
  690. }
  691. }
  692. if (ExtensionID == null && flag == true)
  693. {
  694. str1 = Guid.NewGuid().ToString();
  695. sql += string.Format(@"Insert into ICSExtension(ID, Colspan, ProjectCode, BatchCode, Version, Brand, cFree1, cFree2, cFree3, cFree4, cFree5, cFree6, cFree7, cFree8, cFree9, cFree10, MTIME, MUSER, MUSERName, WorkPoint)
  696. Values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}',getdate(),'{16}','{17}','{18}' )",
  697. str1, Colspan, queryParam["ProjectCode"].ToString(), queryParam["BatchCode"].ToString(), queryParam["Version"].ToString(), queryParam["Brand"].ToString(), queryParam["cFree1"].ToString(), queryParam["cFree2"].ToString(), queryParam["cFree3"].ToString(), queryParam["cFree4"].ToString(), queryParam["cFree5"].ToString(), queryParam["cFree6"].ToString(), queryParam["cFree7"].ToString(), queryParam["cFree8"].ToString(), queryParam["cFree9"].ToString(), queryParam["cFree10"].ToString(),
  698. MUSER, MUSERNAME, WorkPoints);
  699. }
  700. else if (ExtensionID != null)
  701. {
  702. str1 = ExtensionID.ToString();
  703. }
  704. ExtensionIDList.Add(Colspan + WorkPoint);
  705. //传过来的参数判断是否是奥美的项目奥美项目执行独有生成条码规则
  706. if (AMEnable == "true")
  707. {
  708. LotNo = SqlHelper.GetLOTNumber(ClassCode, WorkPoint);
  709. }
  710. sql += string.Format(@"insert into ICSInventoryLot (ID,LotNo,InvCode,ProductDate,ExpirationDate,Quantity,ExtensionID,Type,MUSER,MUSERName,MTIME,WorkPoint,Amount ,EATTRIBUTE1,EATTRIBUTE2,EATTRIBUTE3,EATTRIBUTE4,EATTRIBUTE5,EATTRIBUTE6,EATTRIBUTE7,EATTRIBUTE8,EATTRIBUTE9,EATTRIBUTE10)
  711. values(newid(),'{0}','{1}',getdate(),'{2}','{3}','{4}','19','{5}','{6}',getdate(),'{7}','{8}','','{9}','{10}','{11}','{12}','{13}','{14}','{15}','{16}','{17}')",
  712. LotNo, InvCode, queryParam["ExpirationDate"].ToString(), LOTQTY, str1, MUSER, MUSERNAME, WorkPoints, queryParam["Amount"].ToString(),
  713. queryParam["EATTRIBUTE2"].ToString(), queryParam["EATTRIBUTE3"].ToString(), queryParam["EATTRIBUTE4"].ToString(), queryParam["EATTRIBUTE5"].ToString(),
  714. queryParam["EATTRIBUTE6"].ToString(), queryParam["EATTRIBUTE7"].ToString(), queryParam["EATTRIBUTE8"].ToString(), queryParam["EATTRIBUTE9"].ToString(), queryParam["EATTRIBUTE10"].ToString());
  715. sql += "\r\n";
  716. }
  717. int count = SqlHelper.CmdExecuteNonQueryLi(sql);
  718. return count;
  719. }
  720. }
  721. }