/// <summary> /// 获取样品编号 /// </summary> public string GetSampleNum() { string samplenum = ""; BLL.RoleManage.T_tb_Area _area = new BLL.RoleManage.T_tb_Area(); string _areaname = _area.GetModel(CurrentUserInfo.AreaID.Value).AreaName; switch (_areaname) { case "食品检测中心": _areaname = "JC"; break; case "葫芦岛实验室": _areaname = "HL"; break; case "深圳实验室": _areaname = "SZ"; break; case "湛江实验室": _areaname = "ZJ"; break; case "龙口实验室": _areaname = "LK"; break; case "烹饪加工营养项目": _areaname = "PR"; break; case "原料食品安全项目": _areaname = "YL"; break; default: _areaname = ""; break; } var list = _samplebll.GetModelList("DATEDIFF(day , createDate, '" + DateTime.Now.ToShortDateString() + "')=0 and AreaID = " + CurrentUserInfo.AreaID); int count = (list != null && list.Count > 0) ? list.Count + 1 : 1; samplenum = _areaname + DateTime.Now.ToString("yyyyMMdd") + "—" + count.ToString("D3"); return(samplenum); }
/// <summary> /// 跳转页面 /// 作者:章建国 /// </summary> /// <param name="id"></param> /// <returns></returns> public ActionResult doSampleInfo(int id) { ViewBag._PersonnelName = CurrentUserInfo.PersonnelName; BLL.RoleManage.T_tb_Area _area = new BLL.RoleManage.T_tb_Area(); String _areaname = _area.GetModel(CurrentUserInfo.AreaID.Value).AreaName; switch (_areaname) { case "食品检测中心": { _areaname = "JC"; break; } case "葫芦岛实验室": { _areaname = "HL"; break; } case "深圳实验室": { _areaname = "SZ"; break; } case "湛江实验室": { _areaname = "ZJ"; break; } case "龙口实验室": { _areaname = "LK"; break; } case "烹饪加工营养项目": { _areaname = "PR"; break; } case "原料食品安全项目": { _areaname = "YL"; break; } default: { _areaname = ""; break; } } tb_Sample model = new tb_Sample(); if (id == 0) { model.sampleNum = DateTime.Now.ToShortDateString(); var list = _samplebll.GetModelList("DATEDIFF(day , createDate, '" + DateTime.Now.ToShortDateString() + "')=0 and createUser in (select PersonnelID from tb_InPersonnel where AreaID = " + CurrentUserInfo.AreaID + ")"); if (list != null && list.Count > 0) { int count = list.Count + 1; model.sampleNum = _areaname + DateTime.Now.ToString("yyyyMMdd") + "—" + count.ToString("D3"); } else { model.sampleNum = _areaname + DateTime.Now.ToString("yyyyMMdd") + "—001"; } return(View(model)); } model = _samplebll.GetModel(id); return(View(model)); }