/// <summary> /// 处理超期条码 /// </summary> /// <param name="dtHandle"></param> private void BarCodeExpiryDateHandle(DataTable dtHandle) { Dictionary <string, string> dicBarCode = new Dictionary <string, string>();//KEY-BarCode Value- flag 0-正常 1-超期 2-预警 if (dtHandle.Rows.Count > 0) { foreach (DataRow dr in dtHandle.Rows) { if (dicBarCode.ContainsKey(dr["SerialNumber"].ToString())) { continue; } if (dr["flag"].ToString() == "0") { dicBarCode.Add(dr["SerialNumber"].ToString(), "0"); } else if (dr["flag"].ToString() == "1") { dicBarCode.Add(dr["SerialNumber"].ToString(), "1"); } else if (dr["flag"].ToString() == "2") { dicBarCode.Add(dr["SerialNumber"].ToString(), "2"); } } BLL_Bllb_StockInfo_tbsi.UpdateBarCodeLockStatus(dicBarCode); } }
private void btn_ok_Click(object sender, EventArgs e) { if (cboStatus.Text.Trim() == string.Empty) { MsgBox.Error("请先选择状态!"); return; } //查询需要送检的条码 dtBarCode = BLL_Bllb_StockInfo_tbsi.QuerySendToErCheckBarCode(cboStatus.Text.Trim()); if (dtBarCode.Rows.Count == 0) { MsgBox.Error("该状态下无条码!"); return; } try { string strwhere_materialcode = string.Empty; if (cboStatus.Text.Trim() == "预警") { strwhere_materialcode += string.Format("and dateDiff(month,a.Finally_Time,getDate()) between -7 and 0 and (a.Lock_Flag='0' or a.Lock_Flag is null or a.Lock_Flag='')"); } else if (cboStatus.Text.Trim() == "超期") { strwhere_materialcode += string.Format("and a.Finally_Time <= getDate() and a.Lock_Flag = '2'"); } BLL_Bllb_StockInfo_tbsi.SendToErCheckBarCode(dtBarCode, strwhere_materialcode, cboStatus.Text.Trim()); } catch (Exception ex) { MsgBox.Error(ex.Message.ToString()); return; } this.DialogResult = DialogResult.OK; this.Close(); }
/// <summary> /// 查询 /// </summary> private void Query() { string strwhere = string.Empty; ///无条件处理超期条码 BarCodeExpiryDateHandle(BLL_Bllb_StockInfo_tbsi.QueryExpiryDate(strwhere)); if (!string.IsNullOrEmpty(txtMaterialCode.Text.Trim())) { strwhere += string.Format(" and a.MaterialCode='{0}'", txtMaterialCode.Text.Trim()); } dtExpriyDate = BLL_Bllb_StockInfo_tbsi.QueryShowData(strwhere); dgvBarCode.DataSource = dtExpriyDate; }