Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
Education
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄奎
Education
Commits
faddee3b
Commit
faddee3b
authored
3 years ago
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增处理类
parent
08bf293b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
158 additions
and
0 deletions
+158
-0
RB_Duty_Plan_ViewModel.cs
Edu.Model/ViewModel/Duty/RB_Duty_Plan_ViewModel.cs
+4
-0
DutyPlanModule.cs
Edu.Module.Duty/DutyPlanModule.cs
+143
-0
RB_Duty_PlanDetailsRepository.cs
Edu.Repository/Duty/RB_Duty_PlanDetailsRepository.cs
+11
-0
No files found.
Edu.Model/ViewModel/Duty/RB_Duty_Plan_ViewModel.cs
View file @
faddee3b
...
@@ -10,5 +10,9 @@ namespace Edu.Model.ViewModel.Duty
...
@@ -10,5 +10,9 @@ namespace Edu.Model.ViewModel.Duty
/// </summary>
/// </summary>
public
class
RB_Duty_Plan_ViewModel
:
RB_Duty_Plan
public
class
RB_Duty_Plan_ViewModel
:
RB_Duty_Plan
{
{
/// <summary>
/// 值班详情
/// </summary>
public
List
<
RB_Duty_PlanDetails_ViewModel
>
PlanDetails
{
get
;
set
;
}
}
}
}
}
This diff is collapsed.
Click to expand it.
Edu.Module.Duty/DutyPlanModule.cs
0 → 100644
View file @
faddee3b
using
Edu.Model.ViewModel.Duty
;
using
Edu.Repository.Duty
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
VT.FW.AOP.CustomerAttribute
;
using
VT.FW.DB
;
namespace
Edu.Module.Duty
{
/// <summary>
/// 值班计划处理类
/// </summary>
public
class
DutyPlanModule
{
/// <summary>
/// 值班计划仓储层对象
/// </summary>
private
readonly
RB_Duty_PlanRepository
duty_PlanRepository
=
new
RB_Duty_PlanRepository
();
/// <summary>
/// 值班班次仓储层对象
/// </summary>
private
readonly
RB_Duty_PlanDetailsRepository
duty_PlanDetailsRepository
=
new
RB_Duty_PlanDetailsRepository
();
/// <summary>
/// 获取值班计划分页列表【管理端】
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public
List
<
RB_Duty_Plan_ViewModel
>
GetDutyPlanPageModule
(
int
pageIndex
,
int
pageSize
,
out
long
rowsCount
,
RB_Duty_Plan_ViewModel
query
)
{
var
list
=
duty_PlanRepository
.
GetDutyPlanPageRepository
(
pageIndex
,
pageSize
,
out
rowsCount
,
query
);
return
list
;
}
/// <summary>
/// 获取我的值班计划分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public
List
<
RB_Duty_Plan_ViewModel
>
GetMyDutyPlanPageModule
(
int
pageIndex
,
int
pageSize
,
out
long
rowsCount
,
RB_Duty_Plan_ViewModel
query
)
{
var
list
=
duty_PlanRepository
.
GetMyDutyPlanPageRepository
(
pageIndex
,
pageSize
,
out
rowsCount
,
query
);
return
list
;
}
/// <summary>
/// 新增修改值班计划
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
[
TransactionCallHandler
]
public
virtual
bool
SetDutyPlanModule
(
RB_Duty_Plan_ViewModel
model
)
{
bool
flag
=
false
;
if
(
model
.
Id
>
0
)
{
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Duty_Plan_ViewModel
.
Date
),
model
.
Date
}
};
flag
=
duty_PlanRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Duty_Plan_ViewModel
.
Id
),
model
.
Id
));
}
else
{
var
newId
=
duty_PlanRepository
.
Insert
(
model
);
model
.
Id
=
newId
;
flag
=
newId
>
0
;
}
//原班次列表
var
oldPlanDetailsList
=
duty_PlanDetailsRepository
.
GetDutyPlanDetailsListRepository
(
new
RB_Duty_PlanDetails_ViewModel
()
{
PlanId
=
model
.
Id
});
//原没有班次信息
if
(
oldPlanDetailsList
==
null
||
(
oldPlanDetailsList
!=
null
&&
oldPlanDetailsList
.
Count
==
0
))
{
if
(
model
.
PlanDetails
!=
null
&&
model
.
PlanDetails
.
Count
>
0
)
{
foreach
(
var
item
in
model
.
PlanDetails
)
{
item
.
PlanId
=
model
.
Id
;
duty_PlanDetailsRepository
.
Insert
(
item
);
}
}
}
else
{
//现在没有阶梯报价了【直接删除以前的阶梯报价】
if
(
model
.
PlanDetails
==
null
||
(
model
.
PlanDetails
!=
null
&&
model
.
PlanDetails
.
Count
==
0
))
{
duty_PlanDetailsRepository
.
DeletePlanDetailsRepository
(
model
.
Id
);
}
//找出差异的数据
var
deleteList
=
oldPlanDetailsList
.
Where
(
qitem
=>
!
model
.
PlanDetails
.
Any
(
oldItem
=>
qitem
.
Id
==
oldItem
.
Id
)).
ToList
();
foreach
(
var
dItem
in
deleteList
)
{
if
(
dItem
.
Id
>
0
)
{
duty_PlanDetailsRepository
.
Delete
(
dItem
.
Id
);
}
}
foreach
(
var
item
in
model
.
PlanDetails
)
{
item
.
PlanId
=
model
.
Id
;
if
(
item
.
Id
==
0
)
{
duty_PlanDetailsRepository
.
Insert
(
item
);
}
else
{
duty_PlanDetailsRepository
.
Update
(
item
);
}
}
}
return
flag
;
}
/// <summary>
/// 根据编号获取计划详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public
RB_Duty_Plan_ViewModel
GetDutyPlanModule
(
int
Id
)
{
RB_Duty_Plan_ViewModel
model
=
duty_PlanRepository
.
GetEntity
<
RB_Duty_Plan_ViewModel
>(
Id
);
if
(
model
!=
null
&&
model
.
Id
>
0
)
{
model
.
PlanDetails
=
duty_PlanDetailsRepository
.
GetDutyPlanDetailsListRepository
(
new
RB_Duty_PlanDetails_ViewModel
()
{
PlanId
=
model
.
Id
});
}
return
model
;
}
}
}
This diff is collapsed.
Click to expand it.
Edu.Repository/Duty/RB_Duty_PlanDetailsRepository.cs
View file @
faddee3b
...
@@ -42,5 +42,16 @@ WHERE 1=1
...
@@ -42,5 +42,16 @@ WHERE 1=1
}
}
return
Get
<
RB_Duty_PlanDetails_ViewModel
>(
builder
.
ToString
()).
ToList
();
return
Get
<
RB_Duty_PlanDetails_ViewModel
>(
builder
.
ToString
()).
ToList
();
}
}
/// <summary>
/// 根据计划编号删除班次
/// </summary>
/// <param name="PlanId"></param>
/// <returns></returns>
public
bool
DeletePlanDetailsRepository
(
int
PlanId
)
{
bool
flag
=
base
.
DeleteOne
(
new
VT
.
FW
.
DB
.
WhereHelper
(
nameof
(
RB_Duty_PlanDetails_ViewModel
.
PlanId
),
PlanId
));
return
flag
;
}
}
}
}
}
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment