/// <summary> /// 绑定条形码 /// </summary> /// <param name="barCode">条形码</param> /// <param name="jobID">工单号</param> /// <returns></returns> public void BindFile(string barCode, string jobID) { try { JobBar da = new JobBar(); DataTable dt = da.GetList("IsDelete=0 and JobID='" + jobID + "'").Tables[0]; Entity.JobBar bar = new Entity.JobBar(); if (dt.Rows.Count > 0) { bar = da.DataRowToModel(dt.Rows[0]); bar.BarCode = barCode; da.Update(bar); } else { bar.Guid = Guid.NewGuid().ToString(); bar.BarCode = barCode; bar.JobID = jobID; bar.IsDelete = false; da.Add(bar); } } catch (Exception ex) { throw ex; } }
/// <summary> /// 解绑条形码 /// </summary> /// <param name="jobID">工单号</param> /// <returns></returns> public void DisBindFile(string jobID) { try { JobBar da = new JobBar(); DataTable dt = da.GetList("IsDelete=0 and jobID='" + jobID + "'").Tables[0]; Entity.JobBar bar = new Entity.JobBar(); if (dt.Rows.Count > 0) { bar = da.DataRowToModel(dt.Rows[0]); bar.IsDelete = true; da.Update(bar); } } catch (Exception ex) { throw ex; } }