diff --git a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqKdKdjlb/LqKdKdjlbUpdateFileInput.cs b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqKdKdjlb/LqKdKdjlbUpdateFileInput.cs
new file mode 100644
index 0000000..61f0fce
--- /dev/null
+++ b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqKdKdjlb/LqKdKdjlbUpdateFileInput.cs
@@ -0,0 +1,29 @@
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using NCC.Common.Model;
+
+namespace NCC.Extend.Entitys.Dto.LqKdKdjlb
+{
+ ///
+ /// 修改开单文件输入
+ ///
+ public class LqKdKdjlbUpdateFileInput
+ {
+ ///
+ /// 开单记录ID
+ ///
+ [Required(ErrorMessage = "开单记录ID不能为空")]
+ public string Id { get; set; }
+
+ ///
+ /// 上传文件
+ ///
+ public List scwj { get; set; }
+
+ ///
+ /// 方案其他
+ ///
+ public string F_FIleUrl { get; set; }
+ }
+}
+
diff --git a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Entity/Dto/LqMdTarget/GetManagedStoresInput.cs b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Entity/Dto/LqMdTarget/GetManagedStoresInput.cs
new file mode 100644
index 0000000..64899b4
--- /dev/null
+++ b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Entity/Dto/LqMdTarget/GetManagedStoresInput.cs
@@ -0,0 +1,29 @@
+using System.ComponentModel.DataAnnotations;
+
+namespace NCC.Extend.Entitys.Dto.LqMdTarget
+{
+ ///
+ /// 获取部门管理的门店列表输入
+ ///
+ public class GetManagedStoresInput
+ {
+ ///
+ /// 年月(YYYYMM格式,如:202511)
+ ///
+ [Required(ErrorMessage = "年月不能为空")]
+ public string Month { get; set; }
+
+ ///
+ /// 组织类型(事业部、科技部、教育部、大项目部)
+ ///
+ [Required(ErrorMessage = "组织类型不能为空")]
+ public string OrganizationType { get; set; }
+
+ ///
+ /// 部门ID
+ ///
+ [Required(ErrorMessage = "部门ID不能为空")]
+ public string DepartmentId { get; set; }
+ }
+}
+
diff --git a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Entity/Dto/LqMdTarget/ManagedStoreOutput.cs b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Entity/Dto/LqMdTarget/ManagedStoreOutput.cs
new file mode 100644
index 0000000..6ea2e8b
--- /dev/null
+++ b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Entity/Dto/LqMdTarget/ManagedStoreOutput.cs
@@ -0,0 +1,19 @@
+namespace NCC.Extend.Entitys.Dto.LqMdTarget
+{
+ ///
+ /// 管理的门店输出
+ ///
+ public class ManagedStoreOutput
+ {
+ ///
+ /// 门店ID
+ ///
+ public string StoreId { get; set; }
+
+ ///
+ /// 门店名称
+ ///
+ public string StoreName { get; set; }
+ }
+}
+
diff --git a/netcore/src/Modularity/Extend/NCC.Extend/LqKdKdjlbService.cs b/netcore/src/Modularity/Extend/NCC.Extend/LqKdKdjlbService.cs
index e1021ed..dc9196a 100644
--- a/netcore/src/Modularity/Extend/NCC.Extend/LqKdKdjlbService.cs
+++ b/netcore/src/Modularity/Extend/NCC.Extend/LqKdKdjlbService.cs
@@ -4261,6 +4261,121 @@ namespace NCC.Extend.LqKdKdjlb
throw NCCException.Oh($"清空欠款失败: {ex.Message}");
}
}
+
+ ///
+ /// 修改开单文件
+ ///
+ ///
+ /// 根据开单记录ID修改上传文件(scwj)和方案其他(F_FIleUrl)字段
+ ///
+ /// 示例请求:
+ /// ```json
+ /// {
+ /// "id": "开单记录ID",
+ /// "scwj": [
+ /// {
+ /// "name": "文件名",
+ /// "url": "文件URL"
+ /// }
+ /// ],
+ /// "F_FIleUrl": "方案其他文件URL"
+ /// }
+ /// ```
+ ///
+ /// 参数说明:
+ /// - id: 开单记录ID(必填)
+ /// - scwj: 上传文件列表(可选,不传则不更新)
+ /// - F_FIleUrl: 方案其他文件URL(可选,不传则不更新)
+ ///
+ /// 更新文件输入参数
+ /// 更新结果
+ /// 更新成功
+ /// 参数错误或开单记录不存在
+ /// 服务器错误
+ [HttpPut("UpdateFile")]
+ public async Task UpdateFile([FromBody] LqKdKdjlbUpdateFileInput input)
+ {
+ try
+ {
+ // 验证输入参数
+ if (input == null || string.IsNullOrEmpty(input.Id))
+ {
+ throw NCCException.Oh("开单记录ID不能为空");
+ }
+
+ // 检查开单记录是否存在且有效
+ var billingEntity = await _db.Queryable()
+ .Where(w => w.Id == input.Id && w.IsEffective == StatusEnum.有效.GetHashCode())
+ .FirstAsync();
+
+ if (billingEntity == null)
+ {
+ throw NCCException.Oh("开单记录不存在或已作废");
+ }
+
+ // 构建更新字段列表
+ var updatedFields = new List();
+
+ // 构建更新表达式(只更新提供的字段)
+ var updateBuilder = _db.Updateable()
+ .SetColumns(it => new LqKdKdjlbEntity
+ {
+ UpdateTime = DateTime.Now
+ });
+
+ // 如果提供了scwj,则更新上传文件
+ if (input.scwj != null)
+ {
+ updateBuilder = updateBuilder.SetColumns(it => new LqKdKdjlbEntity
+ {
+ Scwj = input.scwj.ToJson()
+ });
+ updatedFields.Add("scwj");
+ }
+
+ // 如果提供了F_FIleUrl,则更新方案其他
+ if (input.F_FIleUrl != null)
+ {
+ updateBuilder = updateBuilder.SetColumns(it => new LqKdKdjlbEntity
+ {
+ F_FIleUrl = input.F_FIleUrl
+ });
+ updatedFields.Add("F_FIleUrl");
+ }
+
+ // 如果没有提供任何字段,则返回错误
+ if (!updatedFields.Any())
+ {
+ throw NCCException.Oh("至少需要提供一个要更新的字段(scwj或F_FIleUrl)");
+ }
+
+ // 执行更新
+ var updateResult = await updateBuilder
+ .Where(w => w.Id == input.Id)
+ .ExecuteCommandAsync();
+
+ if (updateResult <= 0)
+ {
+ throw NCCException.Oh("更新开单文件失败");
+ }
+
+ return new
+ {
+ code = 200,
+ msg = "更新成功",
+ data = new
+ {
+ id = input.Id,
+ updatedFields = updatedFields
+ }
+ };
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, $"修改开单文件失败 - 开单ID: {input?.Id}");
+ throw NCCException.Oh($"修改开单文件失败: {ex.Message}");
+ }
+ }
#endregion
}
}
diff --git a/netcore/src/Modularity/Extend/NCC.Extend/LqMdTargetService.cs b/netcore/src/Modularity/Extend/NCC.Extend/LqMdTargetService.cs
index aff062b..9f9b894 100644
--- a/netcore/src/Modularity/Extend/NCC.Extend/LqMdTargetService.cs
+++ b/netcore/src/Modularity/Extend/NCC.Extend/LqMdTargetService.cs
@@ -181,28 +181,28 @@ namespace NCC.Extend.LqMdTarget
continue;
entities.Add(new LqMdTargetEntity
- {
- Id = YitIdHelper.NextId().ToString(),
- StoreId = storeId,
- Month = month,
- BusinessUnit = "",
- TechDepartment = "",
- EducationDepartment = "",
- MajorProjectDepartment = "",
- BusinessUnitTarget = 0,
- TechDepartmentTarget = 0,
- EducationDepartmentTarget = 0,
- BusinessUnitGeneralManager = "",
- BusinessUnitManager = "",
- StoreTarget = 0,
- StoreLifeline = 0,
- StoreConsumeTarget = 0,
- StoreProjectTarget = 0,
- StoreHeadcountTarget = 0,
- AssistantHeadcountTargetStage1 = 0,
- AssistantHeadcountTargetStage2 = 0,
- CreateTime = DateTime.Now,
- CreateUser = userInfo.userId,
+ {
+ Id = YitIdHelper.NextId().ToString(),
+ StoreId = storeId,
+ Month = month,
+ BusinessUnit = "",
+ TechDepartment = "",
+ EducationDepartment = "",
+ MajorProjectDepartment = "",
+ BusinessUnitTarget = 0,
+ TechDepartmentTarget = 0,
+ EducationDepartmentTarget = 0,
+ BusinessUnitGeneralManager = "",
+ BusinessUnitManager = "",
+ StoreTarget = 0,
+ StoreLifeline = 0,
+ StoreConsumeTarget = 0,
+ StoreProjectTarget = 0,
+ StoreHeadcountTarget = 0,
+ AssistantHeadcountTargetStage1 = 0,
+ AssistantHeadcountTargetStage2 = 0,
+ CreateTime = DateTime.Now,
+ CreateUser = userInfo.userId,
});
}
@@ -379,6 +379,104 @@ namespace NCC.Extend.LqMdTarget
};
}
#endregion
+
+ #region 获取部门管理的门店列表
+ ///
+ /// 获取部门管理的门店列表
+ ///
+ ///
+ /// 根据年月、组织类型、部门ID查询该部门在该月份管理的门店列表
+ ///
+ /// 示例请求:
+ /// ```json
+ /// {
+ /// "month": "202511",
+ /// "organizationType": "事业部",
+ /// "departmentId": "部门ID"
+ /// }
+ /// ```
+ ///
+ /// 参数说明:
+ /// - month: 年月,格式为YYYYMM(如:202511表示2025年11月)
+ /// - organizationType: 组织类型,可选值:事业部、科技部、教育部、大项目部
+ /// - departmentId: 部门ID
+ ///
+ /// 查询参数
+ /// 门店列表(包含门店ID和门店名称)
+ /// 成功返回门店列表
+ /// 参数错误
+ [HttpPost("GetManagedStores")]
+ public async Task GetManagedStores([FromBody] GetManagedStoresInput input)
+ {
+ try
+ {
+ // 验证参数
+ if (input == null)
+ {
+ throw NCCException.Oh("参数不能为空");
+ }
+
+ if (string.IsNullOrEmpty(input.Month))
+ {
+ throw NCCException.Oh("年月不能为空");
+ }
+
+ if (input.Month.Length != 6 || !Regex.IsMatch(input.Month, @"^\d{6}$"))
+ {
+ throw NCCException.Oh("年月格式必须为YYYYMM(如:202511)");
+ }
+
+ if (string.IsNullOrEmpty(input.OrganizationType))
+ {
+ throw NCCException.Oh("组织类型不能为空");
+ }
+
+ if (string.IsNullOrEmpty(input.DepartmentId))
+ {
+ throw NCCException.Oh("部门ID不能为空");
+ }
+
+ // 构建查询条件(使用多表关联方式)
+ var query = _db.Queryable(
+ (t, s) => t.StoreId == s.Id)
+ .Where((t, s) => t.Month == input.Month);
+
+ // 根据组织类型添加部门过滤条件
+ switch (input.OrganizationType)
+ {
+ case "事业部":
+ query = query.Where((t, s) => t.BusinessUnit == input.DepartmentId);
+ break;
+ case "科技部":
+ query = query.Where((t, s) => t.TechDepartment == input.DepartmentId);
+ break;
+ case "教育部":
+ query = query.Where((t, s) => t.EducationDepartment == input.DepartmentId);
+ break;
+ case "大项目部":
+ query = query.Where((t, s) => t.MajorProjectDepartment == input.DepartmentId);
+ break;
+ default:
+ throw NCCException.Oh($"不支持的组织类型:{input.OrganizationType},支持的类型:事业部、科技部、教育部、大项目部");
+ }
+
+ // 关联门店表获取门店名称
+ var result = await query
+ .Select((t, s) => new ManagedStoreOutput
+ {
+ StoreId = t.StoreId,
+ StoreName = s.Dm ?? "未知门店"
+ })
+ .ToListAsync();
+
+ return result;
+ }
+ catch (Exception ex)
+ {
+ throw NCCException.Oh($"查询失败:{ex.Message}");
+ }
+ }
+ #endregion
}
}