private List <EpcDetail> getHisEpcs(DocInfo doc, bool jiaohuodan = true) { Dictionary <string, string> reDic = new Dictionary <string, string>(); List <EpcDetail> re = new List <EpcDetail>(); if (doc == null) { return(re); } try { string sql = string.Format(@"select * from {0} where DOCNO='{1}' and Result='{2}'", jiaohuodan? "epcdetail" : "epcdetail_dema", doc.DOCNO, "S"); DataTable dt = DBHelper.GetTable(sql, false); if (dt != null && dt.Rows.Count > 0) { foreach (DataRow r in dt.Rows) { string epc = r["EPC_SER"] == null ? "" : r["EPC_SER"].ToString(); if (epc == "" || reDic.ContainsKey(epc)) { continue; } EpcDetail epcDetail = new EpcDetail(); epcDetail.DOCCAT = doc.DOCTYPE; epcDetail.DOCNO = doc.DOCNO; epcDetail.EPC_SER = epc; epcDetail.Floor = ""; epcDetail.Handled = 0; epcDetail.HU = r["HU"] == null ? "" : r["HU"].ToString(); epcDetail.LGNUM = SysConfig.LGNUM; epcDetail.Result = "S"; epcDetail.Timestamp = DateTime.Now; re.Add(epcDetail); reDic.Add(epc, epc); } } } catch (Exception ex) { LogHelper.WriteLine(ex.ToString()); } return(re); }
/// <summary> /// 获取历史EPC数据,只获取箱码和EPC /// 此方法仅用于检测大通道机交货系统中,箱码重复使用,商品已扫描,重投三种情况 /// </summary> /// <param name="epcList"></param> /// <returns></returns> public static List <EpcDetail> GetBeforeEpcDetailByEpcList(string docno, List <string> epcList, ReceiveType type) { List <EpcDetail> result = new List <EpcDetail>(); string epcparams = ""; foreach (string item in epcList) { epcparams += string.Format("'{0}',", item); } if (epcparams.EndsWith(",")) { epcparams = epcparams.Substring(0, epcparams.Length - 1); } string sql; if (type == ReceiveType.交接单收货) { sql = string.Format(@"SELECT EPC_SER,HU FROM dbo.epcdetail_dema WHERE EPC_SER IN ({0}) AND Result='S' AND DOCNO = '{1}'", epcparams, docno); } else { sql = string.Format(@"SELECT EPC_SER,HU FROM dbo.epcdetail WHERE EPC_SER IN ({0}) AND Result='S'", epcparams); } DataTable dt = DBHelper.GetTable(sql, false); //MessageBox.Show(JsonConvert.SerializeObject(dt)); if (dt?.Rows?.Count > 0) { foreach (DataRow row in dt.Rows) { EpcDetail epc = new EpcDetail(); epc.HU = row["HU"].CastTo(""); epc.EPC_SER = row["EPC_SER"].CastTo(""); result.Add(epc); } } return(result); }