首页 新闻 会员 周边 捐助

!!!!!!

0
[已关闭问题] 关闭于 2017-05-10 10:06

如何在Pdm中进行文档汇出,只有一级关系的???

private void TuExport()
{
DataSet ds = TUDANG_BLL.GetDataSetBySQL("select distinct PITEM_ID from PDM_TUDANG");
lbl_TUDataCount.Text = ds.Tables[0].Rows.Count.ToString();

List<PDM.Model.PDM_TUDANG> List_TUDANG = new List<PDM.Model.PDM_TUDANG>();
List_TUDANG = TUDANG_BLL.GetModelList("");
lbl_TUFileCount.Text = List_TUDANG.Count.ToString();

int i = 0;
int j = 0;
int l = 0;


foreach (DataRow dr in ds.Tables[0].Rows)
{
try
{
i++;
if (!Directory.Exists(Application.StartupPath + "\\ATTACH\\related file\\" + dr["PITEM_ID"].ToString().Trim().Replace('*', '_')))
{
Directory.CreateDirectory(Application.StartupPath + "\\ATTACH\\related file\\" + dr["PITEM_ID"].ToString().Trim().Replace('*', '_'));
}
SafeSetText(lbl_TUcdata, i.ToString());


#region 导出档案
List<PDM.Model.PDM_TUDANG> list = List_TUDANG.FindAll((PDM.Model.PDM_TUDANG p) => { return p.PITEM_ID.Trim() == dr["PITEM_ID"].ToString().Trim(); });
foreach (PDM.Model.PDM_TUDANG _list in list)
{
j++;
try
{
//建立版本文件夹
if (!Directory.Exists(Application.StartupPath + "\\ATTACH\\related file\\" + _list.PITEM_ID.Trim().Replace('*', '_') + "\\" + _list.PITEM_REVISION_ID.Trim()))
{
Directory.CreateDirectory(Application.StartupPath + "\\ATTACH\\related file\\" + _list.PITEM_ID.Trim().Replace('*', '_') + "\\" + _list.PITEM_REVISION_ID.Trim());
}

if (!File.Exists(Application.StartupPath + "\\ATTACH\\related file\\" + _list.PITEM_ID.Trim().Replace('*', '_') + "\\" + _list.PITEM_REVISION_ID + "\\" + _list.PORIGINAL_FILE_NAME.Trim()))
{

File.Copy(String.Format("{0}\\{1}\\{2}", txt_TU_Path.Text.Trim(), _list.PSD_PATH_NAME.Trim(), _list.PFILE_NAME.Trim()), Application.StartupPath + "\\ATTACH\\related file\\" + _list.PITEM_ID.Trim().Replace('*', '_') + "\\" + _list.PITEM_REVISION_ID + "\\" + _list.PORIGINAL_FILE_NAME.Trim());

}
}
catch (Exception err)
{
l++;
WriteLog("TUDANG:" + DateTime.Now.ToString("yyyyMMddHH:mm:ss") + "," + _list.PITEM_ID + "," + _list.PITEM_REVISION_ID + "," + _list.PORIGINAL_FILE_NAME + "," + _list.PFILE_NAME + "," + _list.PSD_PATH_NAME);
WriteErrLog("TUDANG:" + DateTime.Now.ToString("yyyyMMddHH:mm:ss") + "," + err.Message.ToString());
SafeSetText(lbl_TU_Fail, l.ToString());

}

//lbl_cfile.Text = j.ToString();
SafeSetText(lbl_TUcfile, j.ToString());
}
#endregion
}
catch (Exception err)
{
WriteErrLog("TUDANG:" + DateTime.Now.ToString("yyyyMMddHH:mm:ss") + "," + dr["PITEM_ID"].ToString().Trim() + "," + err.Message.ToString());
}
}


SafeSetText(lbl_TUtotal, "汇出完成");

}

笑叹、的主页 笑叹、 | 初学一级 | 园豆:34
提问于:2016-09-07 15:28
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册