public static void DelBcf(string progId, List <string> list, LibDataAccess dataAccess, LibManagerMessage manager = null) { if (manager == null) { manager = new LibManagerMessage(); } try { foreach (var item in list) { if (!string.IsNullOrEmpty(item)) { LibBcfData bcfData = (LibBcfData)LibBcfSystem.Default.GetBcfInstance(progId); bcfData.DataAccess = dataAccess; DataSet ds = bcfData.BrowseTo(new object[] { item }); if (ds == null || ds.Tables.Count <= 0 || ds.Tables[0].Rows.Count <= 0) { continue; } ds.Clear(); bcfData.Delete(new object[] { item }); } } } catch (Exception ex) { manager.AddMessage(new LibMessage() { MessageKind = LibMessageKind.Error, Message = string.Format("系统错误:{0}", ex.Message) }); } }
public OutWareCheckData GetOutWareCheckData(string billNo) { OutWareCheckData outWareCheckData = null; if (!string.IsNullOrEmpty(billNo)) { outWareCheckData = this.Get <OutWareCheckData>(billNo); } if (outWareCheckData == null) { object lockItem = lockObjDic.GetOrAdd(billNo, new object()); lock (lockItem) { outWareCheckData = this.Get <OutWareCheckData>(billNo); if (outWareCheckData == null) { //CacheItemPolicy policy = new CacheItemPolicy(); //policy.SlidingExpiration = new TimeSpan(0, 60, 0); //60分钟内不访问自动剔除 LibBcfData ppWorkOrderBcf = (LibBcfData)LibBcfSystem.Default.GetBcfInstance("qc.OwQualityCheck"); DataSet ds = ppWorkOrderBcf.BrowseTo(new object[] { billNo }); outWareCheckData = new OutWareCheckData(ds); this.Set(billNo, outWareCheckData, new TimeSpan(0, 60, 0)); } } } return(outWareCheckData); }
public PurCheckData GetPurCheckData(string billNo) { PurCheckData purCheckData = null; byte[] mybyte = this.StringGetBytes(billNo); if (mybyte != null) { purCheckData = (PurCheckData)RetrieveObjectex(mybyte); } if (purCheckData == null) { object lockItem = lockObjDic.GetOrAdd(billNo, new object()); lock (lockItem) { mybyte = this.StringGetBytes(billNo); if (mybyte != null) { purCheckData = (PurCheckData)RetrieveObjectex(mybyte); } // purCheckData = this.Get< PurCheckData>(billNo) ; if (purCheckData == null) { //CacheItemPolicy policy = new CacheItemPolicy(); //policy.SlidingExpiration = new TimeSpan(0, 60, 0); //60分钟内不访问自动剔除 LibBcfData ppWorkOrderBcf = (LibBcfData)LibBcfSystem.Default.GetBcfInstance("qc.PurQualityCheck"); DataSet ds = ppWorkOrderBcf.BrowseTo(new object[] { billNo }); purCheckData = new PurCheckData(ds); this.Set(billNo, purCheckData, new TimeSpan(0, 720, 0)); // byte[] binaryDataResult = GetBinaryFormatData(purCheckData); // Default.StringSetBytes(billNo, binaryDataResult, new TimeSpan(0, 30, 0)); } } } return(purCheckData); }
/// <summary> /// 获取审核单据数据 /// </summary> /// <param name="progId"></param> /// <param name="billNo"></param> /// <param name="RowId"></param> /// <returns></returns> public static Result GetBillInfo(string userId, string handle, string progId, string billNo, int RowId) { Result res = new Result(); res.ReturnValue = true; LibHandle Handle = LibHandleCache.Default.IsExistsHandle(LibHandeleType.PC, userId); VerificationHandle(userId, handle, Handle, res); if (res.ReturnValue) { try { LibBcfData bcfData = (LibBcfData)LibBcfSystem.Default.GetBcfInstance(progId); DataSet ds = bcfData.BrowseTo(new object[] { billNo }); if (RowId > 0) { DataSet newDs = new DataSet(); DataTable dt = ds.Tables[1].Clone(); newDs.Tables.Add(ds.Tables[0].Copy()); DataRow selrow = ds.Tables[1].Select("ROW_ID='" + RowId + "'")[0]; dt.ImportRow(selrow); newDs.Tables.Add(dt); res.Info = newDs; } else { res.Info = ds; } res.ReturnValue = true; } catch (Exception ex) { res.ReturnValue = false; res.Message = "审核失败!" + ex.Message; } } return(res); }
/// <summary> /// 将object格式化成字节数组byte[] /// </summary> /// <param name="billNo">单据编号</param> /// <returns>字节数组</returns> public ProduceData GetProduceData(string billNo) { ProduceData produceData = null; string json = this.StringGet(billNo); if (!string.IsNullOrEmpty((json))) { produceData = JsonUtiler.Deserialize <ProduceData>(json); } if (produceData == null) { object lockItem = lockObjDic.GetOrAdd(billNo, new object()); lock (lockItem) { json = this.StringGet(billNo); if (!string.IsNullOrEmpty((json))) { produceData = JsonUtiler.Deserialize <ProduceData>(json); } // produceData = this.Get< ProduceData>(billNo) ; if (produceData == null) { //CacheItemPolicy policy = new CacheItemPolicy(); //policy.SlidingExpiration = new TimeSpan(0, 60, 0); //60分钟内不访问自动剔除 LibBcfData ppWorkOrderBcf = (LibBcfData)LibBcfSystem.Default.GetBcfInstance("pp.WorkOrder"); DataSet ds = ppWorkOrderBcf.BrowseTo(new object[] { billNo }); produceData = new ProduceData(ds); this.Set(billNo, produceData, new TimeSpan(0, 720, 0)); // byte[] binaryDataResult = GetBinaryFormatData(produceData); // Default.StringSetBytes(billNo, binaryDataResult, new TimeSpan(0, 30, 0)); } } } return(produceData); }