/// <summary> /// 单独处理问题箱子 /// </summary> /// <param name="issueFiles"></param> /// <param name="boxnumber">如果传具体箱子 则单独处理该箱数据</param> /// <returns></returns> public ReturnValue ReProcessBindBox(string issueFiles, string boxnumber = null) { ReturnValue _result = new ReturnValue(); YHFramework.DAL.ActionLogDal actionlog = new YHFramework.DAL.ActionLogDal(); IProcessFile processFile = ProcessFileFactory.CreateNewObj(ProcessFileType.DaNeng_Hongquan); ReturnValue _itemResult = processFile.RealseDataFile(issueFiles); if (_itemResult.Success == false) { _result.MessageList.Add(_itemResult.ErrMessage); #region 日志 actionlog.Add(new ActionLogModel() { ActionName = "离线文件绑定-" + "解析文件", Notes = issueFiles + _itemResult.ErrMessage, KeyData = "手工操作", UserName = Right.UserId.ToString(), ActionResult = "失败", CreateOn = DateTime.Now }); #endregion _result.Success = false; return(_result); } string xlsfilename = System.IO.Path.GetFileName(issueFiles); List <RequestBindData> reqeustdatalist = _itemResult.ObjectValue as List <RequestBindData>; foreach (RequestBindData requestdata in reqeustdatalist) { if (string.IsNullOrEmpty(boxnumber) == false) { if (requestdata.BoxNumber != boxnumber) { continue; } } ReturnValue _bindResult = ProcessBindBox(requestdata, "问题文件--" + xlsfilename, true, true); if (_bindResult.Success == false) { _result.MessageList.Add(_bindResult.ErrMessage); #region 日志 actionlog.Add(new ActionLogModel() { ActionName = "离线文件绑定-" + "绑定", Notes = requestdata.BoxNumber + "-" + issueFiles + "-" + _bindResult.ErrMessage, KeyData = "手工操作", UserName = Right.UserId.ToString(), ActionResult = "失败", CreateOn = DateTime.Now }); #endregion _result.Success = false; return(_result); } } return(_result); }
public ReturnValue ProcessUpInfoData(int upInfoId, string password) { ReturnValue _result = new ReturnValue(); YHFramework.DAL.ActionLogDal actionlog = new YHFramework.DAL.ActionLogDal(); YHFramework.DAL.UpInfoDal upinfodal = new YHFramework.DAL.UpInfoDal(); IProcessFile processFile = ProcessFileFactory.CreateNewObj(ProcessFileType.DaNeng_Hongquan); UpInfoModel upinfodata = upinfodal.GetModel(upInfoId); if (upinfodata.ID == 0) { _result.Success = false; _result.ErrMessage = "没有找到任何数据"; } if (upinfodata.Status != 0) { _result.Success = false; _result.ErrMessage = "文件已经被处理完毕"; } upinfodata.Status = 1; upinfodata.Remarks += "开始处理" + upinfodata.Status + DateTime.Now.ToString("yyyyMMddHHmmss"); upinfodata.UpdateTime = DateTime.Now; upinfodal.Update(upinfodata); #region 准备文件 string filename = System.AppDomain.CurrentDomain.BaseDirectory + upinfodata.Url.Replace("/", "\\").TrimStart("\\".ToCharArray()); #endregion #region 解压文件 _result = processFile.UnZipFiles(filename, password); if (_result.Success == false) { #region 日志 actionlog.Add(new ActionLogModel() { ActionName = "离线文件绑定-" + "解压文件", Notes = _result.ErrMessage, KeyData = upinfodata.ID.ToString(), UserName = Right.UserId.ToString(), ActionResult = "失败", CreateOn = DateTime.Now }); #endregion return(_result); } #endregion List <string> taskFiles = _result.ObjectValue as List <string>; if (taskFiles.Count == 0) { _result.Success = false; _result.ErrMessage = "压缩包文件没有找到任何文件" + filename; #region 日志 actionlog.Add(new ActionLogModel() { ActionName = "离线文件绑定-" + "解压文件", Notes = _result.ErrMessage, KeyData = upinfodata.ID.ToString(), UserName = Right.UserId.ToString(), ActionResult = "失败", CreateOn = DateTime.Now }); #endregion return(_result); } #region 处理文件 foreach (string item in taskFiles) { ReturnValue _itemResult = processFile.RealseDataFile(item); if (_itemResult.Success == false) { _result.MessageList.Add(_itemResult.ErrMessage); #region 日志 actionlog.Add(new ActionLogModel() { ActionName = "离线文件绑定-" + "解析文件", Notes = item + _itemResult.ErrMessage, KeyData = upinfodata.ID.ToString(), UserName = Right.UserId.ToString(), ActionResult = "失败", CreateOn = DateTime.Now }); #endregion continue; } string xlsfilename = System.IO.Path.GetFileName(item); List <RequestBindData> reqeustdatalist = _itemResult.ObjectValue as List <RequestBindData>; foreach (RequestBindData requestdata in reqeustdatalist) { ReturnValue _bindResult = ProcessBindBox(requestdata, upinfodata.Url + "--" + xlsfilename, true, true); if (_bindResult.Success == false) { _result.MessageList.Add(_bindResult.ErrMessage); #region 日志 actionlog.Add(new ActionLogModel() { ActionName = "离线文件绑定-" + "绑定", Notes = requestdata.BoxNumber + "-" + item + "-" + _bindResult.ErrMessage, KeyData = upinfodata.ID.ToString(), UserName = Right.UserId.ToString(), ActionResult = "失败", CreateOn = DateTime.Now }); #endregion } } } #endregion #region 更新任务状态 upinfodata.Status = 2; upinfodata.Remarks += "更新完毕" + upinfodata.Status + DateTime.Now.ToString("yyyyMMddHHmmss"); upinfodata.UpdateTime = DateTime.Now; upinfodal.Update(upinfodata); #endregion #region 日志 actionlog.Add(new ActionLogModel() { ActionName = "离线文件绑定-" + "完成", Notes = _result.ErrMessage + string.Join("-", _result.MessageList.ToArray <string>()), KeyData = upinfodata.ID.ToString(), UserName = Right.UserId.ToString(), ActionResult = "执行完毕成功", CreateOn = DateTime.Now }); #endregion return(_result); }