/// <summary> /// 扫描数据(传入事务处理) /// </summary> /// <param name="p_BE">要新增的实体</param> /// <param name="sqlTrans">事务类</param> public int RScan(int p_ID, string p_ISN, int p_YPQty, string p_Vendorid, int p_ZHID, DateTime p_Time, IDBTransAccess sqlTrans) { int outi = 0; try { CheckForm entity = new CheckForm(sqlTrans); if (p_ID == 0) { FormNoControlRule prule = new FormNoControlRule(); //entity.FormCode = prule.RGetFormNo("ADH_CheckForm", "FormCode", sqlTrans); entity.FormCode = prule.RGetFormNo((int)FormNoControlEnum.样品报价单号); entity.DVendorID = p_Vendorid; entity.FormDate = DateTime.Now; entity.DataDHID = p_ZHID; entity.BJHL = 1; this.RAdd(entity, sqlTrans); outi = entity.ID; CheckFormDtsRule dtsrule = new CheckFormDtsRule(); dtsrule.RScan(entity.ID, p_ISN, p_YPQty, p_Time, sqlTrans); } else { outi = p_ID; entity.ID = p_ID; if (entity.SelectByID())//找到订货单 { if (entity.SubmitFlag == (int)YesOrNo.Yes) { throw new Exception("单据已完成,不能操作"); } CheckFormDtsRule dtsrule = new CheckFormDtsRule(); dtsrule.RScan(entity.ID, p_ISN, p_YPQty, p_Time, sqlTrans); } } //记录扫描历史 string sql = string.Empty; sql = "INSERT INTO ADH_ScanHis(ISN,DataDHID,DVendorID) VALUES(" + SysString.ToDBString(p_ISN) + "," + SysString.ToDBString(p_ZHID) + "," + SysString.ToDBString(p_Vendorid) + ")"; sqlTrans.ExecuteNonQuery(sql); } catch (BaseException) { throw; } catch (Exception E) { throw new BaseException(E.Message); } return(outi); }
/// <summary> /// 设置 /// </summary> public override void EntitySet() { Common.BindVendor(drpVendorID, new int[] { (int)EnumVendorType.客户 }, true); CheckForm entity = new CheckForm(); entity.ID = HTDataID; bool findFlag = entity.SelectByID(); txtFormCode.Text = entity.FormCode.ToString(); txtFormDate.DateTime = entity.FormDate; drpDataDHID.EditValue = entity.DataDHID; if (entity.DVendorName == "") { txtVendorName.Text = Common.GetVendorNameByVendorID(entity.DVendorID); } else { txtVendorName.Text = entity.DVendorName.ToString(); } txtVendorID.Text = entity.DVendorID.ToString(); txtRemark.Text = entity.DRemark.ToString(); drpBJHB.EditValue = entity.BJHB; txtBJHL.Text = entity.BJHL.ToString(); txtAddress.Text = entity.Address.ToString(); txtTel.Text = entity.Tel.ToString(); txtConOPName.Text = entity.ConOPName.ToString(); drpSaleOPID.EditValue = entity.SaleOPID.ToString(); drpLevel.EditValue = entity.LevelID; if (txtBJHL.Text == "0") { txtBJHL.Text = "1"; } if (entity.DYFlag == 1) { chkDYFlag.Checked = true; } else { chkDYFlag.Checked = false; } //if (entity.SubmitFlag == 0) //{ // label8.Text = "进行中"; //} //else //{ // label8.Text = "已完成"; //} HTDataSubmitFlag = entity.SubmitFlag; BindGridDts(); lblTime.Text = "扫描时间:" + SysConvert.ToString(gridView1.GetRowCellValue(gridView1.RowCount - 1, "AddTime")); }
/// <summary> /// 扫描数据(传入事务处理) /// </summary> /// <param name="p_BE">要新增的实体</param> /// <param name="sqlTrans">事务类</param> public void RScanCancel(int p_ID, string p_ISN, IDBTransAccess sqlTrans) { try { CheckForm entity = new CheckForm(sqlTrans); if (p_ID == 0) { throw new Exception("未找到单据"); } else { entity.ID = p_ID; entity.SelectByID(); if (entity.SubmitFlag == (int)YesOrNo.Yes) { throw new Exception("单据已完成,不能操作"); } string sql = string.Empty; if (p_ISN == string.Empty) { sql = "DELETE FROM ADH_CheckFormDts WHERE MainID=" + SysString.ToDBString(p_ID); sqlTrans.ExecuteNonQuery(sql); } else { if (sqlTrans.Fill("SELECT MainID FROM ADH_CheckFormDts WHERE MainID=" + SysString.ToDBString(p_ID) + " AND ISN=" + SysString.ToDBString(p_ISN)).Rows.Count != 0) { sql = "DELETE FROM ADH_CheckFormDts WHERE MainID=" + SysString.ToDBString(p_ID) + " AND ISN=" + SysString.ToDBString(p_ISN); sqlTrans.ExecuteNonQuery(sql); } else { throw new Exception("单据内未找到此条码"); } } } } catch (BaseException) { throw; } catch (Exception E) { throw new BaseException(E.Message); } }
/// <summary> /// 扫描数据(传入事务处理) /// </summary> /// <param name="p_BE">要新增的实体</param> /// <param name="sqlTrans">事务类</param> public int RScanOK(int p_ID, IDBTransAccess sqlTrans) { int outi = 0; try { CheckForm entity = new CheckForm(sqlTrans); if (p_ID == 0) { throw new Exception("未找到单据"); } else { outi = p_ID; entity.ID = p_ID; if (entity.SelectByID())//找到订货单 { if (entity.SubmitFlag == (int)YesOrNo.Yes) { throw new Exception("单据已完成,不能操作"); } entity.SubmitFlag = 1; this.RUpdate(entity, sqlTrans); } } } catch (BaseException) { throw; } catch (Exception E) { throw new BaseException(E.Message); } return(outi); }
/// <summary> /// 获得实体 /// </summary> /// <returns></returns> private CheckForm EntityGet() { CheckForm entity = new CheckForm(); entity.ID = HTDataID; entity.SelectByID(); entity.FormCode = txtFormCode.Text.Trim(); entity.FormDate = txtFormDate.DateTime.Date; entity.DataDHID = SysConvert.ToInt32(drpDataDHID.EditValue); entity.DVendorID = txtVendorID.Text.Trim(); //SysConvert.ToString(drpVendorID.EditValue); entity.DVendorName = txtVendorName.Text.Trim(); entity.DRemark = txtRemark.Text.Trim(); entity.BJHB = SysConvert.ToString(drpBJHB.EditValue); entity.BJHL = SysConvert.ToDecimal(txtBJHL.Text); entity.FormTypeID = FormListAID;//得到单据类型 entity.ConOPName = txtConOPName.Text.Trim(); entity.Tel = txtTel.Text.Trim(); entity.Address = txtAddress.Text.Trim(); entity.DYFlag = SysConvert.ToInt32(chkDYFlag.Checked); entity.LevelID = SysConvert.ToInt32(drpLevel.EditValue); entity.SaleOPID = SysConvert.ToString(drpSaleOPID.EditValue); return(entity); }