private void btnPrint_Click(object sender, EventArgs e) { try { try { gridView1.FocusedRowHandle -= 1; gridView1.FocusedRowHandle += 1; } catch { } Rep = new RepBaseGrid(); if (File.Exists(sPrintLayOutUser)) { Rep.LoadLayout(sPrintLayOutUser); } else if (File.Exists(sPrintLayOutMod)) { Rep.LoadLayout(sPrintLayOutMod); } else { MessageBox.Show("加载报表模板失败,请与管理员联系"); return; } string sErr = ""; string sWarn = ""; if (Rep.dsPrint == null) { throw new Exception("没有需要打印的数据"); } int iCou = 0; SqlConnection conn = new SqlConnection(DbHelperSQL.connectionString); conn.Open(); //启用事务 SqlTransaction tran = conn.BeginTransaction(); try { Rep.dsPrint.Tables.Clear(); DataTable dtGrid = ((DataTable)gridControl1.DataSource).Copy(); string sSQL = "select getdate()"; DataTable dt = DbHelperSQL.ExecuteDataset(tran, CommandType.Text, sSQL).Tables[0]; DateTime dDateSer = BaseFunction.ReturnDate(dt.Rows[0][0]); if (dDateSer.Date < BaseFunction.ReturnDate("2014-8-1")) { throw new Exception("获得系统日期失败"); } sSQL = "select max(BarCode) from dbo._BarCodeList where BarCode like '" + dDateSer.ToString("yyMMdd") + "%' "; dt = DbHelperSQL.ExecuteDataset(tran, CommandType.Text, sSQL).Tables[0]; string sMaxCode = ""; if (dt != null && dt.Rows.Count > 0) { sMaxCode = dt.Rows[0][0].ToString().Trim(); } long lMaxID = 0; if (sMaxCode != "") { lMaxID = BaseFunction.ReturnLong(sMaxCode.Substring(6)); } Guid sGuid = Guid.NewGuid(); for (int i = 0; i < gridView1.RowCount; i++) { if (BaseFunction.ReturnBool(gridView1.GetRowCellValue(i, gridColchoose))) { decimal dQuantity = BaseFunction.ReturnDecimal(gridView1.GetRowCellValue(i, gridColiQuantity)); if (dQuantity < 0) { dQuantity = -1 * dQuantity; } decimal dBatch = BaseFunction.ReturnDecimal(gridView1.GetRowCellValue(i, gridCol包装批量)); if (dBatch == 0) { dBatch = dQuantity; } int iCount = BaseFunction.ReturnInt(Math.Ceiling(dQuantity / dBatch)); for (int j = 0; j < iCount; j++) { Model_BarCodeList model = new Model_BarCodeList(); lMaxID += 1; string sBarCode = getBaseData.GetBarCode(dDateSer, lMaxID); model.cInvCode = gridView1.GetRowCellValue(i, gridColcInvCode).ToString().Trim(); model.cInvName = gridView1.GetRowCellValue(i, gridColcInvName).ToString().Trim(); model.cInvStd = gridView1.GetRowCellValue(i, gridColcInvStd).ToString().Trim(); model.BarCode = sBarCode; model.ExsID = BaseFunction.ReturnLong(gridView1.GetRowCellValue(i, gridColAutoID)); model.ExCode = gridView1.GetRowCellValue(i, gridColcCode).ToString().Trim(); model.ExType = "采购入库单"; model.ExRowNo = BaseFunction.ReturnInt(gridView1.GetRowCellValue(i, gridColirowno)); model.ExVenCode = gridView1.GetRowCellValue(i, gridColcVenCode).ToString().Trim(); model.ExVenName = gridView1.GetRowCellValue(i, gridColcVenName).ToString().Trim(); model.ExQuantity = dQuantity; model.ExBatchQty = dBatch; model.GUID = sGuid; model.cWhCode = gridView1.GetRowCellValue(i, gridColcWhCode).ToString().Trim(); model.cWhName = gridView1.GetRowCellValue(i, gridColcWhName).ToString().Trim(); model.ExcPTName = gridView1.GetRowCellValue(i, gridColcPTName).ToString().Trim(); model.ExcInvDefine3 = gridView1.GetRowCellValue(i, gridColcInvDefine3).ToString().Trim(); model.ExcComUnitName = gridView1.GetRowCellValue(i, gridColcComUnitName).ToString().Trim(); model.ExcPTCode = gridView1.GetRowCellValue(i, gridColcPTCode).ToString().Trim(); //国外供应商批号: R+采购订单号(后7位)+日期+订单行号 //国内供应商批号:采购订单号(后7位)+日期+订单行号 sSQL = @" select a.cVenCode,b.cVCCode ,b. cVCName from Vendor a inner join VendorClass b on a.cVCCode = b.cVCCode where a.cVenCode = '111111' "; sSQL = sSQL.Replace("111111", gridView1.GetRowCellValue(0, gridColcVenCode).ToString().Trim()); DataTable dtVen = DbHelperSQL.ExecuteDataset(tran, CommandType.Text, sSQL).Tables[0]; string scVCCode = dtVen.Rows[0]["cVCCode"].ToString().Trim(); string sDDCode = gridView1.GetRowCellValue(i, gridColcPOID).ToString().Trim(); if (sDDCode.Length >= 7) { sDDCode = sDDCode.Substring(sDDCode.Length - 7); } if (scVCCode == "20") { model.Batch = "R" + sDDCode + "-" + dDateSer.ToString("yyMMdd") + "-" + gridView1.GetRowCellValue(i, gridColPORowNo).ToString().Trim(); } else { model.Batch = "" + sDDCode + "-" + dDateSer.ToString("yyMMdd") + "-" + gridView1.GetRowCellValue(i, gridColPORowNo).ToString().Trim(); } model.CreateUserName = sUserName; model.CreateDate = dDateSer; model.ExDepCode = gridView1.GetRowCellValue(i, gridColcDepCode).ToString().Trim(); model.ExDepName = gridView1.GetRowCellValue(i, gridColcDepName).ToString().Trim(); model.valid = true; model.Used = 0; model.ExcMemo = gridView1.GetRowCellValue(i, gridColcMemo).ToString().Trim(); model.ExcInvDefine4 = gridView1.GetRowCellValue(i, gridColcInvDefine4).ToString().Trim(); model.ExcInvDefine5 = gridView1.GetRowCellValue(i, gridColcInvDefine5).ToString().Trim(); if (j != iCount - 1) { model.iQty = dBatch; } else { model.iQty = dQuantity - dBatch * (iCount - 1); } model.PosCode = gridView1.GetRowCellValue(i, gridCol货位).ToString().Trim(); sSQL = DAL.Add(model); iCou = iCou + DbHelperSQL.ExecuteNonQuery(tran, CommandType.Text, sSQL); } } } sSQL = @" select a.* from [_BarCodeList] a where GUID = '" + sGuid.ToString().Trim() + "'"; DataTable dtPrint = DbHelperSQL.ExecuteDataset(tran, CommandType.Text, sSQL).Tables[0]; dtPrint.TableName = "dtGrid"; Rep.dsPrint.Tables.Add(dtPrint.Copy()); if (dtPrint.Rows.Count < 1) { if (sErr.Length > 0) { throw new Exception(sErr); } else { throw new Exception("没有要打印的单据"); } } if (sErr.Trim() != "") { throw new Exception(sErr); } if (iCou == 0) { throw new Exception("请选择需要保存的数据"); } //Rep.Print(); Rep.ShowPreview(); tran.Commit(); } catch (Exception error) { tran.Rollback(); throw new Exception(error.Message); } } catch (Exception ee) { FrmMsgBox f = new FrmMsgBox(); f.Text = "打印失败"; f.richTextBox1.Text = ee.Message; f.ShowDialog(); } }
private void btnPrint_Click(object sender, EventArgs e) { try { try { gridView1.FocusedRowHandle -= 1; gridView1.FocusedRowHandle += 1; } catch { } Rep = new RepBaseGrid(); Rep.dsPrint.Tables.Clear(); if (radioCG.Checked) { sPrintLayOutMod = Application.StartupPath + "\\UAP\\Runtime\\print\\Model\\历史条形码打印Mod.dll"; sPrintLayOutUser = Application.StartupPath + "\\UAP\\Runtime\\print\\User\\历史条形码打印User.dll"; if (radioBarCode.Checked) { if (File.Exists(sPrintLayOutUser)) { Rep.LoadLayout(sPrintLayOutUser); } else if (File.Exists(sPrintLayOutMod)) { Rep.LoadLayout(sPrintLayOutMod); } else { MessageBox.Show("加载报表模板失败,请与管理员联系"); return; } } if (radioBarCodeBox.Checked) { if (File.Exists(sPrintLayOutUser2)) { Rep.LoadLayout(sPrintLayOutUser2); } else if (File.Exists(sPrintLayOutMod2)) { Rep.LoadLayout(sPrintLayOutMod2); } else { MessageBox.Show("加载报表模板失败,请与管理员联系"); return; } } string sErr = ""; string sWarn = ""; if (Rep.dsPrint == null) { throw new Exception("没有需要打印的数据"); } int iCou = 0; SqlConnection conn = new SqlConnection(DbHelperSQL.connectionString); conn.Open(); //启用事务 SqlTransaction tran = conn.BeginTransaction(); try { Rep.dsPrint.Tables.Clear(); DataTable dtGrid = ((DataTable)gridControl1.DataSource).Copy(); string sSQL = "select getdate()"; DataTable dt = DbHelperSQL.ExecuteDataset(tran, CommandType.Text, sSQL).Tables[0]; DateTime dDateSer = BaseFunction.ReturnDate(dt.Rows[0][0]); if (dDateSer.Date < BaseFunction.ReturnDate("2014-8-1")) { throw new Exception("获得系统日期失败"); } string sCode = dDateSer.ToString("yyMMrrhhmmss"); long lMaxID = 0; if (radioBarCode.Checked) { sSQL = "select max(BarCode) from dbo._BarCodeList where BarCode like '" + dDateSer.ToString("yyMMdd") + "%' "; dt = DbHelperSQL.ExecuteDataset(tran, CommandType.Text, sSQL).Tables[0]; string sMaxCode = ""; if (dt != null && dt.Rows.Count > 0) { sMaxCode = dt.Rows[0][0].ToString().Trim(); } if (sMaxCode != "") { lMaxID = BaseFunction.ReturnLong(sMaxCode.Substring(6)); } } if (radioBarCodeBox.Checked) { sSQL = "select max(BarCode) from dbo._BarCodeList where BarCode not like '" + dDateSer.ToString("yyMMdd") + "%' "; dt = DbHelperSQL.ExecuteDataset(tran, CommandType.Text, sSQL).Tables[0]; string sMaxCode = ""; if (dt != null && dt.Rows.Count > 0) { sMaxCode = dt.Rows[0][0].ToString().Trim(); } if (sMaxCode != "") { lMaxID = BaseFunction.ReturnLong(sMaxCode.Substring(7)); } } Guid sGuid = Guid.NewGuid(); for (int i = 0; i < gridView1.RowCount; i++) { if (BaseFunction.ReturnBool(gridView1.GetRowCellValue(i, gridColchoose))) { string sBarCodeHis = gridView1.GetRowCellValue(i, gridColBarCode).ToString().Trim(); DataRow[] drList = dtGrid.Select("BarCode = '" + sBarCodeHis + "'"); DataRow dr = drList[0]; Model_BarCodeList model = new Model_BarCodeList(); lMaxID += 1; string sBarCode = ""; if (radioBarCode.Checked) { sBarCode = getBaseData.GetBarCode(dDateSer, lMaxID); } if (radioBarCodeBox.Checked) { sBarCode = getBaseData.GetBarCodeBox(dDateSer, lMaxID); } model = DAL.DataRowToModel(dr); model.BarCode = sBarCode; model.BarCodeHis = sBarCodeHis; model.ExQuantity = BaseFunction.ReturnDecimal(gridView1.GetRowCellValue(i, gridColiQty)); model.iQty = BaseFunction.ReturnDecimal(gridView1.GetRowCellValue(i, gridColUseQty)); model.CreateUserName = sUserName; model.CreateDate = dDateSer; model.valid = true; model.Used = 0; model.GUID = sGuid; sSQL = DAL.Add(model); iCou = iCou + DbHelperSQL.ExecuteNonQuery(tran, CommandType.Text, sSQL); sSQL = "update _BarCodeList set valid = 0 where BarCode = '" + sBarCodeHis + "'"; DbHelperSQL.ExecuteNonQuery(tran, CommandType.Text, sSQL); if (radioBarCode.Checked) { //登记源条码作废 Model_BarCodeRD modelRD = new Model_BarCodeRD(); DAL_BarCodeRD dalRD = new DAL_BarCodeRD(); modelRD.sCode = sCode; modelRD.BarCode = sBarCodeHis; modelRD.sType = "历史条码打印"; modelRD.cInvCode = gridView1.GetRowCellValue(i, gridColcInvCode).ToString().Trim(); modelRD.Qty = BaseFunction.ReturnDecimal(gridView1.GetRowCellValue(i, gridColUseQty)); modelRD.CreateUid = sUserName; modelRD.CreateDate = dDateSer; modelRD.ExCode = sBarCodeHis; modelRD.RDType = 2; sSQL = dalRD.Add(modelRD); DbHelperSQL.ExecuteNonQuery(tran, CommandType.Text, sSQL); modelRD.BarCode = sBarCode; modelRD.RDType = 1; sSQL = dalRD.Add(modelRD); DbHelperSQL.ExecuteNonQuery(tran, CommandType.Text, sSQL); } } } sSQL = "select * from [_BarCodeList] where GUID = '" + sGuid.ToString().Trim() + "'"; DataTable dtPrint = DbHelperSQL.ExecuteDataset(tran, CommandType.Text, sSQL).Tables[0]; dtPrint.TableName = "dtGrid"; Rep.dsPrint.Tables.Add(dtPrint.Copy()); if (dtPrint.Rows.Count < 1) { throw new Exception("没有要打印的单据"); } if (sErr.Trim() != "") { throw new Exception(sErr); } if (iCou == 0) { throw new Exception("请选择需要保存的数据"); } //Rep.Print(); Rep.ShowPreview(); tran.Commit(); btnRefresh_Click(null, null); } catch (Exception error) { tran.Rollback(); throw new Exception(error.Message); } } if (radioQC.Checked) { sPrintLayOutMod = Application.StartupPath + "\\UAP\\Runtime\\print\\Model\\期初条形码打印Mod.dll"; sPrintLayOutUser = Application.StartupPath + "\\UAP\\Runtime\\print\\User\\期初条形码打印User.dll"; if (radioBarCode.Checked) { if (File.Exists(sPrintLayOutUser)) { Rep.LoadLayout(sPrintLayOutUser); } else if (File.Exists(sPrintLayOutMod)) { Rep.LoadLayout(sPrintLayOutMod); } else { MessageBox.Show("加载报表模板失败,请与管理员联系"); return; } } DataTable dtPrint = (DataTable)gridControl1.DataSource; DataTable dtPrTemp = dtPrint.Copy(); for (int i = dtPrTemp.Rows.Count - 1; i >= 0; i--) { bool b = BaseFunction.ReturnBool(dtPrTemp.Rows[i]["choose"]); if (!b) { dtPrTemp.Rows.RemoveAt(i); } } dtPrTemp.TableName = "dtGrid"; Rep.dsPrint.Tables.Add(dtPrTemp.Copy()); if (dtPrint.Rows.Count < 1) { throw new Exception("没有要打印的单据"); } //Rep.Print(); Rep.ShowPreview(); } } catch (Exception ee) { FrmMsgBox f = new FrmMsgBox(); f.Text = "打印失败"; f.richTextBox1.Text = ee.Message; f.ShowDialog(); } }
private void btnPrintBox_Click(object sender, EventArgs e) { try { try { gridView1.FocusedRowHandle -= 1; gridView1.FocusedRowHandle += 1; } catch { } Rep = new RepBaseGrid(); if (File.Exists(sPrintLayOutUserBox)) { Rep.LoadLayout(sPrintLayOutUserBox); } else if (File.Exists(sPrintLayOutModBox)) { Rep.LoadLayout(sPrintLayOutModBox); } else { MessageBox.Show("加载报表模板失败,请与管理员联系"); return; } string sErr = ""; string sWarn = ""; if (Rep.dsPrint == null) { throw new Exception("没有需要打印的数据"); } int iCou = 0; SqlConnection conn = new SqlConnection(DbHelperSQL.connectionString); conn.Open(); //启用事务 SqlTransaction tran = conn.BeginTransaction(); try { Rep.dsPrint.Tables.Clear(); DataTable dtGrid = ((DataTable)gridControl1.DataSource).Copy(); string sSQL = "select getdate()"; DataTable dt = DbHelperSQL.ExecuteDataset(tran, CommandType.Text, sSQL).Tables[0]; DateTime dDateSer = BaseFunction.ReturnDate(dt.Rows[0][0]); if (dDateSer.Date < BaseFunction.ReturnDate("2014-8-1")) { throw new Exception("获得系统日期失败"); } sSQL = "select max(BarCode) from dbo._BarCodeList where BarCode like 'X" + dDateSer.ToString("yyMMdd") + "%' "; dt = DbHelperSQL.ExecuteDataset(tran, CommandType.Text, sSQL).Tables[0]; string sMaxCode = ""; if (dt != null && dt.Rows.Count > 0) { sMaxCode = dt.Rows[0][0].ToString().Trim(); } long lMaxID = 0; if (sMaxCode != "") { lMaxID = BaseFunction.ReturnLong(sMaxCode.Substring(7)); } Guid sGuid = Guid.NewGuid(); for (int i = 0; i < gridView1.RowCount; i++) { if (BaseFunction.ReturnBool(gridView1.GetRowCellValue(i, gridColchoose))) { decimal dQuantity = BaseFunction.ReturnDecimal(gridView1.GetRowCellValue(i, gridColiQuantity)); if (dQuantity < 0) { dQuantity = -1 * dQuantity; } decimal dBatch = BaseFunction.ReturnDecimal(gridView1.GetRowCellValue(i, gridCol包装批量)); if (dBatch == 0) { sErr = sErr + "行" + (i + 1).ToString().Trim() + "请设置包装批量\n"; continue; } int iCount = BaseFunction.ReturnInt(Math.Ceiling(dQuantity / dBatch)); for (int j = 0; j < iCount; j++) { Model_BarCodeList model = new Model_BarCodeList(); lMaxID += 1; string sBarCode = getBaseData.GetBarCodeBox(dDateSer, lMaxID); model.BarCode = sBarCode; model.ExsID = BaseFunction.ReturnLong(gridView1.GetRowCellValue(i, gridColAutoID)); model.ExCode = gridView1.GetRowCellValue(i, gridColcCode).ToString().Trim(); model.ExRowNo = BaseFunction.ReturnInt(gridView1.GetRowCellValue(i, gridColirowno)); model.ExQuantity = dQuantity; model.ExDepCode = gridView1.GetRowCellValue(i, gridColcDepCode).ToString().Trim(); model.ExDepName = gridView1.GetRowCellValue(i, gridColcDepName).ToString().Trim(); model.ExBatchQty = dBatch; model.Used = 0; if (j == iCount - 1) { model.iQty = dQuantity - dBatch * (iCount - 1); } else { model.iQty = dBatch; } model.CreateUserName = sUserName; model.CreateDate = dDateSer; model.ExType = "生产订单"; model.GUID = sGuid; model.valid = true; model.PosCode = gridView1.GetRowCellValue(i, gridCol货位).ToString().Trim(); sSQL = DAL.Add(model); iCou = iCou + DbHelperSQL.ExecuteNonQuery(tran, CommandType.Text, sSQL); } } } sSQL = "select * from [_BarCodeList] where GUID = '" + sGuid.ToString().Trim() + "'"; DataTable dtPrint = DbHelperSQL.ExecuteDataset(tran, CommandType.Text, sSQL).Tables[0]; dtPrint.TableName = "dtGrid"; Rep.dsPrint.Tables.Add(dtPrint.Copy()); if (dtPrint.Rows.Count < 1) { throw new Exception("没有要打印的单据"); } if (sErr.Trim() != "") { throw new Exception(sErr); } if (iCou == 0) { throw new Exception("请选择需要保存的数据"); } if (sErr.Length > 0) { throw new Exception(sErr); } Rep.ShowPreview(); tran.Commit(); } catch (Exception error) { tran.Rollback(); throw new Exception(error.Message); } } catch (Exception ee) { FrmMsgBox f = new FrmMsgBox(); f.Text = "打印失败"; f.richTextBox1.Text = ee.Message; f.ShowDialog(); } }
private void btnPrint_Click(object sender, EventArgs e) { try { Rep = new RepBaseGrid(); if (File.Exists(sPrintLayOutUser)) { Rep.LoadLayout(sPrintLayOutUser); } else if (File.Exists(sPrintLayOutMod)) { Rep.LoadLayout(sPrintLayOutMod); } else { MessageBox.Show("加载报表模板失败,请与管理员联系"); return; } string sErr = ""; string sWarn = ""; if (Rep.dsPrint == null) { throw new Exception("没有需要打印的数据"); } int iBoxCount = BaseFunction.ReturnInt(textEditBoxQTY.Text.Trim()); if (iBoxCount <= 0) { textEditBoxQTY.Focus(); throw new Exception("请输入箱数"); } int iCou = 0; SqlConnection conn = new SqlConnection(DbHelperSQL.connectionString); conn.Open(); //启用事务 SqlTransaction tran = conn.BeginTransaction(); try { Rep.dsPrint.Tables.Clear(); string sSQL = "select getdate()"; DataTable dt = DbHelperSQL.ExecuteDataset(tran, CommandType.Text, sSQL).Tables[0]; DateTime dDateSer = BaseFunction.ReturnDate(dt.Rows[0][0]); if (dDateSer.Date < BaseFunction.ReturnDate("2014-8-1")) { throw new Exception("获得系统日期失败"); } sSQL = "select max(BarCode) from dbo._BarCodeList where BarCode like 'X" + dDateSer.ToString("yyMMdd") + "%' "; dt = DbHelperSQL.ExecuteDataset(tran, CommandType.Text, sSQL).Tables[0]; string sMaxCode = ""; if (dt != null && dt.Rows.Count > 0) { sMaxCode = dt.Rows[0][0].ToString().Trim(); } long lMaxID = 0; if (sMaxCode != "") { lMaxID = BaseFunction.ReturnLong(sMaxCode.Substring(7)); } Guid sGuid = Guid.NewGuid(); for (int i = 0; i < iBoxCount; i++) { decimal dQuantity = BaseFunction.ReturnDecimal(textEditQTY.Text.Trim()); if (dQuantity < 0) { dQuantity = -1 * dQuantity; } Model_BarCodeList model = new Model_BarCodeList(); lMaxID += 1; string sBarCode = getBaseData.GetBarCodeBox(dDateSer, lMaxID); model.BarCode = sBarCode; model.ExCode = textEditMomCode.Text.Trim(); model.ExQuantity = dQuantity; model.Used = 0; model.iQty = dQuantity; model.CreateUserName = sUserName; model.CreateDate = dDateSer; model.ExType = "生产箱码"; model.GUID = sGuid; model.valid = true; model.Batch = textEditBatch.Text.Trim(); model.PosCode = textEditHW.Text.Trim(); sSQL = DAL.Add(model); iCou = iCou + DbHelperSQL.ExecuteNonQuery(tran, CommandType.Text, sSQL); } sSQL = "select * from [_BarCodeList] where GUID = '" + sGuid.ToString().Trim() + "'"; DataTable dtPrint = DbHelperSQL.ExecuteDataset(tran, CommandType.Text, sSQL).Tables[0]; dtPrint.TableName = "dtGrid"; Rep.dsPrint.Tables.Add(dtPrint.Copy()); if (dtPrint.Rows.Count < 1) { throw new Exception("没有要打印的单据"); } if (sErr.Trim() != "") { throw new Exception(sErr); } if (iCou == 0) { throw new Exception("请选择需要保存的数据"); } if (sErr.Length > 0) { throw new Exception(sErr); } Rep.ShowPreview(); tran.Commit(); } catch (Exception error) { tran.Rollback(); throw new Exception(error.Message); } } catch (Exception ee) { FrmMsgBox f = new FrmMsgBox(); f.Text = "打印失败"; f.richTextBox1.Text = ee.Message; f.ShowDialog(); } }
/// <summary> /// 得到一个对象实体 /// </summary> public UFIDA.U8.UAP.CustomApp.ControlForm.Model_BarCodeList DataRowToModel(DataRow row) { UFIDA.U8.UAP.CustomApp.ControlForm.Model_BarCodeList model = new Model_BarCodeList(); if (row != null) { if (row["iID"] != null && row["iID"].ToString() != "") { model.iID = int.Parse(row["iID"].ToString()); } if (row["BarCode"] != null) { model.BarCode = row["BarCode"].ToString(); } if (row["ExsID"] != null && row["ExsID"].ToString() != "") { model.ExsID = int.Parse(row["ExsID"].ToString()); } if (row["ExCode"] != null) { model.ExCode = row["ExCode"].ToString(); } if (row["ExRowNo"] != null && row["ExRowNo"].ToString() != "") { model.ExRowNo = int.Parse(row["ExRowNo"].ToString()); } if (row["ExType"] != null) { model.ExType = row["ExType"].ToString(); } if (row["ExVenCode"] != null) { model.ExVenCode = row["ExVenCode"].ToString(); } if (row["ExVenName"] != null) { model.ExVenName = row["ExVenName"].ToString(); } if (row["ExDepCode"] != null) { model.ExDepCode = row["ExDepCode"].ToString(); } if (row["ExDepName"] != null) { model.ExDepName = row["ExDepName"].ToString(); } if (row["ExQuantity"] != null && row["ExQuantity"].ToString() != "") { model.ExQuantity = decimal.Parse(row["ExQuantity"].ToString()); } if (row["ExBatchQty"] != null && row["ExBatchQty"].ToString() != "") { model.ExBatchQty = decimal.Parse(row["ExBatchQty"].ToString()); } if (row["cWhCode"] != null) { model.cWhCode = row["cWhCode"].ToString(); } if (row["cWhName"] != null) { model.cWhName = row["cWhName"].ToString(); } if (row["iQty"] != null && row["iQty"].ToString() != "") { model.iQty = decimal.Parse(row["iQty"].ToString()); } if (row["Batch"] != null) { model.Batch = row["Batch"].ToString(); } if (row["SerialNO"] != null) { model.SerialNO = row["SerialNO"].ToString(); } if (row["PosCode"] != null) { model.PosCode = row["PosCode"].ToString(); } if (row["CreateUserName"] != null) { model.CreateUserName = row["CreateUserName"].ToString(); } if (row["CreateDate"] != null && row["CreateDate"].ToString() != "") { model.CreateDate = DateTime.Parse(row["CreateDate"].ToString()); } //if (row["PrintCout"] != null && row["PrintCout"].ToString() != "") //{ // model.PrintCout = int.Parse(row["PrintCout"].ToString()); //} if (row["SysDate"] != null && row["SysDate"].ToString() != "") { model.SysDate = DateTime.Parse(row["SysDate"].ToString()); } if (row["GUID"] != null && row["GUID"].ToString() != "") { model.GUID = new Guid(row["GUID"].ToString()); } if (row["AFsID"] != null && row["AFsID"].ToString() != "") { model.AFsID = int.Parse(row["AFsID"].ToString()); } if (row["AFCode"] != null) { model.AFCode = row["AFCode"].ToString(); } if (row["AFRowNo"] != null && row["AFRowNo"].ToString() != "") { model.AFRowNo = int.Parse(row["AFRowNo"].ToString()); } if (row["AFType"] != null) { model.AFType = row["AFType"].ToString(); } if (row["AFVenCode"] != null) { model.AFVenCode = row["AFVenCode"].ToString(); } if (row["AFVenName"] != null) { model.AFVenName = row["AFVenName"].ToString(); } if (row["AFCusName"] != null) { model.AFCusName = row["AFCusName"].ToString(); } if (row["AFCusCode"] != null) { model.AFCusCode = row["AFCusCode"].ToString(); } if (row["AFQuantity"] != null && row["AFQuantity"].ToString() != "") { model.AFQuantity = decimal.Parse(row["AFQuantity"].ToString()); } if (row["XBarCode"] != null) { model.XBarCode = row["XBarCode"].ToString(); } if (row["cInvCode"] != null) { model.cInvCode = row["cInvCode"].ToString(); } if (row["cInvName"] != null) { model.cInvName = row["cInvName"].ToString(); } if (row["cInvStd"] != null) { model.cInvStd = row["cInvStd"].ToString(); } if (row["Used"] != null && row["Used"].ToString() != "") { model.Used = int.Parse(row["Used"].ToString()); } if (row["valid"] != null && row["valid"].ToString() != "") { if ((row["valid"].ToString() == "1") || (row["valid"].ToString().ToLower() == "true")) { model.valid = true; } else { model.valid = false; } } if (row["BarCodeHis"] != null) { model.BarCodeHis = row["BarCodeHis"].ToString(); } if (row["ExcPTCode"] != null) { model.ExcPTCode = row["ExcPTCode"].ToString(); } if (row["ExcPTName"] != null) { model.ExcPTName = row["ExcPTName"].ToString(); } if (row["ExcInvDefine3"] != null) { model.ExcInvDefine3 = row["ExcInvDefine3"].ToString(); } if (row["ExcComUnitName"] != null) { model.ExcComUnitName = row["ExcComUnitName"].ToString(); } if (row["ExcMemo"] != null) { model.ExcMemo = row["ExcMemo"].ToString(); } if (row["ExcInvDefine4"] != null) { model.ExcInvDefine4 = row["ExcInvDefine4"].ToString(); } if (row["ExcInvDefine5"] != null) { model.ExcInvDefine5 = row["ExcInvDefine5"].ToString(); } } return(model); }