班前会
This commit is contained in:
@@ -4,6 +4,7 @@ using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices.ComTypes;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
@@ -160,6 +161,8 @@ namespace BLL
|
||||
string result = string.Empty;
|
||||
if (data.Items.Count() > 0)
|
||||
{
|
||||
var jsonData = JsonConvert.SerializeObject(data);
|
||||
ErrLogInfo.WriteLog($"【班前会接收数据】{jsonData}");
|
||||
//1、判断分包单位是否存在
|
||||
var unit = UnitService.getUnitByCollCropCodeUnitName(data.CollCropCode, data.UnitName);
|
||||
if (unit == null)
|
||||
@@ -243,6 +246,8 @@ namespace BLL
|
||||
db.SubmitChanges();
|
||||
}
|
||||
succ++;
|
||||
|
||||
//ErrLogInfo.WriteLog($"【班前会接收数据——内容附件】UnitDomain:{data.UnitDomain};AttachFileId:{item.AttachFileId};ToKeyId:{item.ToKeyId};AttachSource:{item.AttachSource};AttachUrl:{item.AttachUrl}");
|
||||
//附件处理:内容附件
|
||||
BLL.FileInsertService.SaveAttachFileRecords(data.UnitDomain, item.AttachFileId, item.ToKeyId, item.AttachSource, item.AttachUrl);
|
||||
//附件处理:签到表
|
||||
|
||||
@@ -122,6 +122,49 @@ namespace BLL
|
||||
/// <param name="attachUrl">附件路径</param>
|
||||
/// <returns></returns>
|
||||
public static void FileMoreInsert(List<byte[]> fileContextList, string attachUrl)
|
||||
{
|
||||
if (fileContextList.Count > 0)
|
||||
{
|
||||
string[] strs = attachUrl.Trim().Split(',');
|
||||
int i = 0;
|
||||
string physicalpath = ConfigurationManager.AppSettings["localRoot"];
|
||||
foreach (var item in fileContextList)
|
||||
{
|
||||
//HttpContext.Current.Request.PhysicalApplicationPath;
|
||||
string fullPath = (physicalpath + strs[i]).Replace('/', '\\');
|
||||
if (!File.Exists(fullPath))
|
||||
{
|
||||
byte[] fileContext = item;
|
||||
int index = fullPath.LastIndexOf("\\");
|
||||
string filePath = fullPath.Substring(0, index);
|
||||
|
||||
if (!Directory.Exists(filePath))
|
||||
{
|
||||
Directory.CreateDirectory(filePath);
|
||||
}
|
||||
//string savePath = fullPath + fileName;
|
||||
|
||||
//文件读写模式
|
||||
System.IO.FileMode fileMode = System.IO.FileMode.Create;
|
||||
|
||||
//写入文件
|
||||
using (System.IO.FileStream fs = new System.IO.FileStream(fullPath, fileMode, System.IO.FileAccess.Write))
|
||||
{
|
||||
fs.Write(fileContext, 0, fileContext.Length);
|
||||
}
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取多附件数据流类
|
||||
/// </summary>
|
||||
/// <param name="attachUrl">附件路径</param>
|
||||
/// <returns></returns>
|
||||
public static void FileMoreInsertOld(List<byte[]> fileContextList, string attachUrl)
|
||||
{
|
||||
if (fileContextList != null && fileContextList.Count() > 0)
|
||||
{
|
||||
@@ -223,12 +266,14 @@ namespace BLL
|
||||
/// </summary>
|
||||
public static void InsertAttachFilesRecord(string attachFileId, string dataId, string attachSource, string attachUrl, List<byte[]> fileContext)
|
||||
{
|
||||
BLL.ErrLogInfo.WriteLog($"数据和附件插入到多附件表:1");
|
||||
if (!string.IsNullOrEmpty(attachFileId))
|
||||
{
|
||||
//多附件
|
||||
var attachFile = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == dataId);
|
||||
if (attachFile == null)
|
||||
{
|
||||
BLL.ErrLogInfo.WriteLog($"数据和附件插入到多附件表:2:attachFile == null");
|
||||
////插入附件文件
|
||||
BLL.FileInsertService.FileMoreInsert(fileContext, attachUrl);
|
||||
|
||||
@@ -244,8 +289,10 @@ namespace BLL
|
||||
}
|
||||
else
|
||||
{
|
||||
BLL.ErrLogInfo.WriteLog($"数据和附件插入到多附件表:2:attachFile != null");
|
||||
if (attachFile.AttachUrl != attachUrl)
|
||||
{
|
||||
BLL.ErrLogInfo.WriteLog($"数据和附件插入到多附件表:2:attachFile != null attachFile.AttachUrl != attachUrl");
|
||||
/////删除附件文件
|
||||
//BLL.UploadAttachmentService.DeleteFile(ConfigurationManager.AppSettings["localRoot"], attachFile.AttachUrl);
|
||||
////插入附件文件
|
||||
|
||||
Reference in New Issue
Block a user