Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Property
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
liudong1993
Property
Commits
2bc0e534
Commit
2bc0e534
authored
Jan 19, 2020
by
liudong1993
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
资产管理 耗材申请时间管理
parent
ccd0ff30
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
587 additions
and
10 deletions
+587
-10
RB_Supplies_Applyfor.cs
Property.Model/Entity/Supplies/RB_Supplies_Applyfor.cs
+4
-0
RB_Property_UseReceive_Extend.cs
...ty.Model/Extend/Property/RB_Property_UseReceive_Extend.cs
+4
-0
RB_Supplies_ApplyforSpecial_Extend.cs
...del/Extend/Supplies/RB_Supplies_ApplyforSpecial_Extend.cs
+4
-1
RB_Supplies_ApplyforWeekday_Extend.cs
...del/Extend/Supplies/RB_Supplies_ApplyforWeekday_Extend.cs
+4
-1
RB_Supplies_Applyfor_Extend.cs
...erty.Model/Extend/Supplies/RB_Supplies_Applyfor_Extend.cs
+9
-1
PropertyModule.cs
Property.Modele.FixedAssets/PropertyModule.cs
+42
-0
SuppliesModule.cs
Property.Modele.FixedAssets/SuppliesModule.cs
+254
-0
RB_Supplies_ApplyforRepository.cs
...rty.Repository/Supplies/RB_Supplies_ApplyforRepository.cs
+9
-2
RB_Supplies_ApplyforSpecialRepository.cs
...ository/Supplies/RB_Supplies_ApplyforSpecialRepository.cs
+6
-0
RB_Supplies_ApplyforWeekdayRepository.cs
...ository/Supplies/RB_Supplies_ApplyforWeekdayRepository.cs
+8
-5
PropertyController.cs
Property.WebApi/Controllers/Property/PropertyController.cs
+2
-0
SuppliesController.cs
Property.WebApi/Controllers/Property/SuppliesController.cs
+241
-0
No files found.
Property.Model/Entity/Supplies/RB_Supplies_Applyfor.cs
View file @
2bc0e534
...
...
@@ -30,6 +30,10 @@ namespace Property.Model.Entity
set
;
}
/// <summary>
/// 启用 1是 2否
/// </summary>
public
int
?
Enabled
{
get
;
set
;
}
/// <summary>
/// 状态 0正常 1删除
/// </summary>
public
int
?
Status
...
...
Property.Model/Extend/Property/RB_Property_UseReceive_Extend.cs
View file @
2bc0e534
...
...
@@ -12,6 +12,10 @@ namespace Property.Model.Extend
[
DB
(
ConnectionName
=
"PropertyConnection"
)]
public
class
RB_Property_UseReceive_Extend
:
RB_Property_UseReceive
{
/// <summary>
/// 是否是申请人签名 1是 其他否
/// </summary>
public
int
?
IsApplyForSign
{
get
;
set
;
}
/// <summary>
/// 数量
/// </summary>
...
...
Property.Model/Extend/Supplies/RB_Supplies_ApplyforSpecial_Extend.cs
View file @
2bc0e534
...
...
@@ -11,6 +11,9 @@ namespace Property.Model.Extend
[
DB
(
ConnectionName
=
"PropertyConnection"
)]
public
class
RB_Supplies_ApplyforSpecial_Extend
:
RB_Supplies_ApplyforSpecial
{
/// <summary>
/// 设置申请ids
/// </summary>
public
string
ApplyforIds
{
get
;
set
;
}
}
}
\ No newline at end of file
Property.Model/Extend/Supplies/RB_Supplies_ApplyforWeekday_Extend.cs
View file @
2bc0e534
...
...
@@ -11,6 +11,9 @@ namespace Property.Model.Extend
[
DB
(
ConnectionName
=
"PropertyConnection"
)]
public
class
RB_Supplies_ApplyforWeekday_Extend
:
RB_Supplies_ApplyforWeekday
{
/// <summary>
/// 设置ids
/// </summary>
public
string
ApplyforIds
{
get
;
set
;
}
}
}
\ No newline at end of file
Property.Model/Extend/Supplies/RB_Supplies_Applyfor_Extend.cs
View file @
2bc0e534
using
System
;
using
System.Collections.Generic
;
using
Property.Model.Entity
;
using
REBORN.Common.AOP
;
...
...
@@ -11,6 +12,13 @@ namespace Property.Model.Extend
[
DB
(
ConnectionName
=
"PropertyConnection"
)]
public
class
RB_Supplies_Applyfor_Extend
:
RB_Supplies_Applyfor
{
/// <summary>
/// 耗材申请工作日
/// </summary>
public
List
<
RB_Supplies_ApplyforWeekday_Extend
>
WeekdayList
{
get
;
set
;
}
/// <summary>
/// 特殊日期
/// </summary>
public
List
<
RB_Supplies_ApplyforSpecial_Extend
>
SpecialList
{
get
;
set
;
}
}
}
\ No newline at end of file
Property.Modele.FixedAssets/PropertyModule.cs
View file @
2bc0e534
...
...
@@ -985,6 +985,14 @@ namespace Property.Module.FixedAssets
bOldlist
=
branchRepository
.
GetBranchNameByIds
(
boldstr
);
bInlist
=
branchRepository
.
GetBranchNameByIds
(
bnewstr
);
List
<
Rb_Workflow_AuditRelevance_Extend
>
arlist
=
new
List
<
Rb_Workflow_AuditRelevance_Extend
>();
if
(
demodel
.
IsSelfApplication
==
1
)
{
//自助申请的查询
//查询所有的签名流程
arlist
=
workflow_AuditRelevanceRepository
.
GetAuditRelevanceList
(
0
,
rstr
,
WFRrocessStatus
.
NotAudit
);
}
foreach
(
var
item
in
list
)
{
item
.
DetailList
=
urlist
.
Where
(
x
=>
x
.
ReceiveId
==
item
.
Id
).
ToList
();
...
...
@@ -1010,6 +1018,16 @@ namespace Property.Module.FixedAssets
item
.
ImageList
.
Add
(
Config
.
GetFileUrl
(
img
));
}
}
item
.
IsApplyForSign
=
0
;
if
(
demodel
.
IsSelfApplication
==
1
)
{
var
arModel
=
arlist
.
Where
(
x
=>
x
.
WorkFlowId
==
item
.
Id
).
OrderBy
(
x
=>
x
.
Sort
).
FirstOrDefault
();
if
(
arModel
!=
null
&&
arModel
.
SpecialNode
==
WFSpecialNodeEnum
.
Pay
)
{
item
.
IsApplyForSign
=
1
;
}
}
}
}
return
list
;
...
...
@@ -2342,6 +2360,12 @@ namespace Property.Module.FixedAssets
{
string
rstr
=
string
.
Join
(
","
,
list
.
Select
(
x
=>
x
.
Id
));
urlist
=
useRelevanceRepository
.
GetList
(
new
RB_Property_UseRelevance_Extend
()
{
RB_Group_Id
=
demodel
.
RB_Group_Id
,
ReceiveIdStr
=
rstr
});
List
<
Rb_Workflow_AuditRelevance_Extend
>
arlist
=
new
List
<
Rb_Workflow_AuditRelevance_Extend
>();
if
(
demodel
.
IsSelfApplication
==
1
)
{
//自助申请的查询
//查询所有的签名流程
arlist
=
workflow_AuditRelevanceRepository
.
GetAuditRelevanceList
(
0
,
rstr
,
WFRrocessStatus
.
NotAudit
);
}
foreach
(
var
item
in
list
)
{
...
...
@@ -2350,6 +2374,15 @@ namespace Property.Module.FixedAssets
foreach
(
var
item2
in
item
.
DetailList
)
{
item2
.
CancelStockEmployeeName
=
CacheManager
.
User
.
UserReidsCache
.
GetEmployee
(
item2
.
CancelStockEmployeeId
)?.
EmName
??
""
;
}
item
.
IsApplyForSign
=
0
;
if
(
demodel
.
IsSelfApplication
==
1
)
{
var
arModel
=
arlist
.
Where
(
x
=>
x
.
WorkFlowId
==
item
.
Id
).
OrderBy
(
x
=>
x
.
Sort
).
FirstOrDefault
();
if
(
arModel
!=
null
&&
arModel
.
SpecialNode
==
WFSpecialNodeEnum
.
Pay
)
{
item
.
IsApplyForSign
=
1
;
}
}
}
}
return
list
;
...
...
@@ -2525,6 +2558,15 @@ namespace Property.Module.FixedAssets
}
}
/// <summary>
/// 更新审核人
/// </summary>
/// <param name="AuditId"></param>
/// <param name="OldEmId"></param>
/// <param name="NewEmId"></param>
/// <param name="coModelList"></param>
/// <param name="trans"></param>
/// <returns></returns>
public
bool
UpdateAuditEmId
(
int
AuditId
,
int
OldEmId
,
int
NewEmId
,
List
<
SetCareOfModel
>
coModelList
,
System
.
Data
.
IDbTransaction
trans
=
null
)
{
bool
flag
=
true
,
recordflag
=
true
;
...
...
Property.Modele.FixedAssets/SuppliesModule.cs
View file @
2bc0e534
...
...
@@ -51,6 +51,10 @@ namespace Property.Module.FixedAssets
private
readonly
RB_Supplies_StockOutDetailRepository
supplies_StockOutDetailRepository
=
new
RB_Supplies_StockOutDetailRepository
();
private
readonly
Rb_branchRepository
branchRepository
=
new
Rb_branchRepository
();
private
readonly
Rb_departmentRepository
departmentRepository
=
new
Rb_departmentRepository
();
//耗材申请
private
readonly
RB_Supplies_ApplyforRepository
supplies_ApplyforRepository
=
new
RB_Supplies_ApplyforRepository
();
private
readonly
RB_Supplies_ApplyforWeekdayRepository
supplies_ApplyforWeekdayRepository
=
new
RB_Supplies_ApplyforWeekdayRepository
();
private
readonly
RB_Supplies_ApplyforSpecialRepository
supplies_ApplyforSpecialRepository
=
new
RB_Supplies_ApplyforSpecialRepository
();
/// <summary>
/// 获取物料档案分页列表
...
...
@@ -1380,5 +1384,255 @@ namespace Property.Module.FixedAssets
}
return
flag
;
}
#
region
耗材申请日期设置
/// <summary>
/// 耗材申请设置分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="demodel"></param>
/// <param name="count"></param>
/// <returns></returns>
public
List
<
RB_Supplies_Applyfor_Extend
>
GetApplyForSetPageList
(
int
pageIndex
,
int
pageSize
,
RB_Supplies_Applyfor_Extend
demodel
,
out
long
count
)
{
var
list
=
supplies_ApplyforRepository
.
GetPageList
(
pageIndex
,
pageSize
,
demodel
,
out
count
);
var
slist
=
new
List
<
RB_Supplies_ApplyforWeekday_Extend
>();
var
aslist
=
new
List
<
RB_Supplies_ApplyforSpecial_Extend
>();
if
(
list
.
Any
())
{
slist
=
supplies_ApplyforWeekdayRepository
.
GetList
(
new
RB_Supplies_ApplyforWeekday_Extend
()
{
RB_Group_Id
=
demodel
.
RB_Group_Id
,
ApplyforIds
=
string
.
Join
(
","
,
list
.
Select
(
x
=>
x
.
Id
).
Distinct
())
});
aslist
=
supplies_ApplyforSpecialRepository
.
GetList
(
new
RB_Supplies_ApplyforSpecial_Extend
()
{
ApplyforIds
=
string
.
Join
(
","
,
list
.
Select
(
x
=>
x
.
Id
).
Distinct
())
});
}
foreach
(
var
item
in
list
)
{
//查询所有周期
item
.
WeekdayList
=
slist
.
Where
(
x
=>
x
.
ApplyforId
==
item
.
Id
).
ToList
();
item
.
SpecialList
=
aslist
.
Where
(
x
=>
x
.
ApplyforId
==
item
.
Id
).
ToList
();
}
return
list
;
}
/// <summary>
/// 设置耗材申请时间
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public
bool
SetApplyForInfo
(
RB_Supplies_Applyfor_Extend
demodel
)
{
var
trans
=
supplies_ApplyforRepository
.
DbTransaction
;
try
{
if
(
demodel
.
Id
>
0
)
{
Dictionary
<
string
,
object
>
files
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Supplies_Applyfor_Extend
.
BranchId
),
demodel
.
BranchId
}
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Supplies_Applyfor_Extend
.
Id
),
FiledValue
=
demodel
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
bool
flag
=
supplies_ApplyforRepository
.
Update
(
files
,
wheres
,
trans
);
if
(
flag
)
{
var
slist
=
supplies_ApplyforWeekdayRepository
.
GetList
(
new
RB_Supplies_ApplyforWeekday_Extend
()
{
RB_Group_Id
=
demodel
.
RB_Group_Id
,
ApplyforId
=
demodel
.
Id
});
var
aslist
=
supplies_ApplyforSpecialRepository
.
GetList
(
new
RB_Supplies_ApplyforSpecial_Extend
()
{
ApplyforId
=
demodel
.
Id
});
//删除所有工作日信息
foreach
(
var
item
in
slist
)
{
supplies_ApplyforWeekdayRepository
.
Delete
(
item
,
trans
);
}
//再新增
foreach
(
var
item
in
demodel
.
WeekdayList
)
{
supplies_ApplyforWeekdayRepository
.
Insert
(
new
RB_Supplies_ApplyforWeekday
()
{
ApplyforId
=
demodel
.
Id
,
Id
=
0
,
Weekday
=
item
.
Weekday
,
CreateBy
=
demodel
.
CreateBy
,
CreateDate
=
demodel
.
CreateDate
,
EndTime
=
item
.
EndTime
,
RB_Branch_Id
=
demodel
.
RB_Branch_Id
,
RB_Group_Id
=
demodel
.
RB_Group_Id
,
StartTime
=
item
.
StartTime
,
Status
=
0
,
UpdateBy
=
demodel
.
UpdateBy
,
UpdateDate
=
demodel
.
UpdateDate
},
trans
);
}
//特殊日期
foreach
(
var
item
in
aslist
)
{
supplies_ApplyforSpecialRepository
.
Delete
(
item
,
trans
);
}
//写入特殊日期
if
(
demodel
.
SpecialList
!=
null
&&
demodel
.
SpecialList
.
Any
())
{
foreach
(
var
item
in
demodel
.
SpecialList
)
{
supplies_ApplyforSpecialRepository
.
Insert
(
new
RB_Supplies_ApplyforSpecial
()
{
ApplyforId
=
demodel
.
Id
,
Id
=
0
,
CreateBy
=
demodel
.
CreateBy
,
CreateDate
=
demodel
.
CreateDate
,
Date
=
item
.
Date
,
EndTime
=
item
.
EndTime
,
StartTime
=
item
.
StartTime
,
Status
=
0
,
UpdateBy
=
demodel
.
UpdateBy
,
UpdateDate
=
demodel
.
UpdateDate
},
trans
);
}
}
}
}
else
{
//新增
demodel
.
Status
=
0
;
demodel
.
Enabled
=
1
;
//默认启用
int
Id
=
supplies_ApplyforRepository
.
Insert
(
demodel
,
trans
);
if
(
Id
>
0
)
{
//写入工作日
foreach
(
var
item
in
demodel
.
WeekdayList
)
{
supplies_ApplyforWeekdayRepository
.
Insert
(
new
RB_Supplies_ApplyforWeekday
()
{
ApplyforId
=
Id
,
Id
=
0
,
Weekday
=
item
.
Weekday
,
CreateBy
=
demodel
.
CreateBy
,
CreateDate
=
demodel
.
CreateDate
,
EndTime
=
item
.
EndTime
,
RB_Branch_Id
=
demodel
.
RB_Branch_Id
,
RB_Group_Id
=
demodel
.
RB_Group_Id
,
StartTime
=
item
.
StartTime
,
Status
=
0
,
UpdateBy
=
demodel
.
UpdateBy
,
UpdateDate
=
demodel
.
UpdateDate
},
trans
);
}
//写入特殊日期
if
(
demodel
.
SpecialList
!=
null
&&
demodel
.
SpecialList
.
Any
())
{
foreach
(
var
item
in
demodel
.
SpecialList
)
{
supplies_ApplyforSpecialRepository
.
Insert
(
new
RB_Supplies_ApplyforSpecial
()
{
ApplyforId
=
Id
,
Id
=
0
,
CreateBy
=
demodel
.
CreateBy
,
CreateDate
=
demodel
.
CreateDate
,
Date
=
item
.
Date
,
EndTime
=
item
.
EndTime
,
StartTime
=
item
.
StartTime
,
Status
=
0
,
UpdateBy
=
demodel
.
UpdateBy
,
UpdateDate
=
demodel
.
UpdateDate
},
trans
);
}
}
}
}
supplies_ApplyforRepository
.
DBSession
.
Commit
();
return
true
;
}
catch
(
Exception
ex
)
{
LogHelper
.
Write
(
ex
,
"SetApplyForInfo"
);
supplies_ApplyforRepository
.
DBSession
.
Rollback
();
return
false
;
}
}
/// <summary>
/// 验证公司别
/// </summary>
/// <param name="demodel"></param>
/// <param name="userInfo"></param>
/// <returns></returns>
public
bool
ValidateBranch
(
RB_Supplies_Applyfor_Extend
demodel
,
UserInfo
userInfo
)
{
var
list
=
supplies_ApplyforRepository
.
GetList
(
new
RB_Supplies_Applyfor_Extend
()
{
RB_Group_Id
=
userInfo
.
RB_Group_id
,
BranchId
=
demodel
.
BranchId
});
if
(
demodel
.
Id
>
0
)
{
if
(
list
.
Where
(
x
=>
x
.
Id
!=
demodel
.
Id
).
Any
())
{
return
true
;
}
}
else
{
if
(
list
.
Any
())
{
return
true
;
}
}
return
false
;
}
/// <summary>
/// 设置状态
/// </summary>
/// <param name="applyforId"></param>
/// <param name="userInfo"></param>
/// <returns></returns>
public
bool
SetApplyForStatus
(
int
applyforId
,
UserInfo
userInfo
)
{
var
model
=
supplies_ApplyforRepository
.
GetEntity
(
applyforId
);
if
(
model
==
null
)
{
return
false
;
}
if
(
model
.
Status
==
1
)
{
return
false
;
}
Dictionary
<
string
,
object
>
files
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Supplies_Applyfor_Extend
.
Enabled
),
model
.
Enabled
==
1
?
2
:
1
},
{
nameof
(
RB_Supplies_Applyfor_Extend
.
UpdateBy
),
userInfo
.
EmployeeId
},
{
nameof
(
RB_Supplies_Applyfor_Extend
.
UpdateDate
),
DateTime
.
Now
}
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Supplies_Applyfor_Extend
.
Id
),
FiledValue
=
applyforId
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
return
supplies_ApplyforRepository
.
Update
(
files
,
wheres
);
}
/// <summary>
/// 获取详情
/// </summary>
/// <param name="userInfo"></param>
/// <returns></returns>
public
RB_Supplies_Applyfor_Extend
GetApplyForInfo
(
UserInfo
userInfo
)
{
var
list
=
supplies_ApplyforRepository
.
GetList
(
new
RB_Supplies_Applyfor_Extend
()
{
BranchId
=
userInfo
.
RB_Branch_id
,
RB_Group_Id
=
userInfo
.
RB_Group_id
});
if
(
list
.
Any
())
{
var
demodel
=
list
.
FirstOrDefault
();
var
slist
=
supplies_ApplyforWeekdayRepository
.
GetList
(
new
RB_Supplies_ApplyforWeekday_Extend
()
{
RB_Group_Id
=
demodel
.
RB_Group_Id
,
ApplyforId
=
demodel
.
Id
});
var
aslist
=
supplies_ApplyforSpecialRepository
.
GetList
(
new
RB_Supplies_ApplyforSpecial_Extend
()
{
ApplyforId
=
demodel
.
Id
});
demodel
.
WeekdayList
=
slist
;
demodel
.
SpecialList
=
aslist
;
return
demodel
;
}
else
{
//查询通用化的
list
=
supplies_ApplyforRepository
.
GetList
(
new
RB_Supplies_Applyfor_Extend
()
{
BranchId
=
-
1
,
RB_Group_Id
=
userInfo
.
RB_Group_id
});
if
(
list
.
Any
())
{
var
demodel
=
list
.
FirstOrDefault
();
var
slist
=
supplies_ApplyforWeekdayRepository
.
GetList
(
new
RB_Supplies_ApplyforWeekday_Extend
()
{
RB_Group_Id
=
demodel
.
RB_Group_Id
,
ApplyforId
=
demodel
.
Id
});
var
aslist
=
supplies_ApplyforSpecialRepository
.
GetList
(
new
RB_Supplies_ApplyforSpecial_Extend
()
{
ApplyforId
=
demodel
.
Id
});
demodel
.
WeekdayList
=
slist
;
demodel
.
SpecialList
=
aslist
;
return
demodel
;
}
else
{
return
new
RB_Supplies_Applyfor_Extend
()
{
Id
=
-
1
};
}
}
}
#
endregion
}
}
Property.Repository/Supplies/RB_Supplies_ApplyforRepository.cs
View file @
2bc0e534
...
...
@@ -24,10 +24,13 @@ namespace Property.Repository
string
where
=
" where 1=1 "
;
where
+=
string
.
Format
(
" AND {0}={1}"
,
nameof
(
RB_Supplies_Applyfor_Extend
.
Status
),
0
);
where
+=
$@" and RB_Group_Id=
{
dmodel
.
RB_Group_Id
}
"
;
if
(
dmodel
.
BranchId
>=
0
)
if
(
dmodel
.
BranchId
>=
-
1
)
{
where
+=
" and "
+
nameof
(
RB_Supplies_Applyfor_Extend
.
BranchId
)
+
" ="
+
dmodel
.
BranchId
;
}
if
(
dmodel
.
Enabled
>
0
)
{
where
+=
" and "
+
nameof
(
RB_Supplies_Applyfor_Extend
.
Enabled
)
+
" ="
+
dmodel
.
Enabled
;
}
string
sql
=
$@" select * from RB_Supplies_Applyfor
{
where
}
order by Id desc"
;
return
GetPage
<
RB_Supplies_Applyfor_Extend
>(
pageIndex
,
pageSize
,
out
count
,
sql
).
ToList
();
...
...
@@ -44,10 +47,14 @@ namespace Property.Repository
string
where
=
" where 1=1 "
;
where
+=
string
.
Format
(
" AND {0}={1}"
,
nameof
(
RB_Supplies_Applyfor_Extend
.
Status
),
0
);
where
+=
$@" and RB_Group_Id=
{
dmodel
.
RB_Group_Id
}
"
;
if
(
dmodel
.
BranchId
>=
0
)
if
(
dmodel
.
BranchId
>=
-
1
)
{
where
+=
" and "
+
nameof
(
RB_Supplies_Applyfor_Extend
.
BranchId
)
+
" ="
+
dmodel
.
BranchId
;
}
if
(
dmodel
.
Enabled
>
0
)
{
where
+=
" and "
+
nameof
(
RB_Supplies_Applyfor_Extend
.
Enabled
)
+
" ="
+
dmodel
.
Enabled
;
}
string
sql
=
$@" select * from RB_Supplies_Applyfor
{
where
}
order by Id desc"
;
return
Get
<
RB_Supplies_Applyfor_Extend
>(
sql
).
ToList
();
...
...
Property.Repository/Supplies/RB_Supplies_ApplyforSpecialRepository.cs
View file @
2bc0e534
using
Property.Model.Entity
;
using
Property.Model.Extend
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
...
...
@@ -42,10 +43,15 @@ namespace Property.Repository
{
string
where
=
" where 1=1 "
;
where
+=
string
.
Format
(
" AND {0}={1}"
,
nameof
(
RB_Supplies_ApplyforSpecial_Extend
.
Status
),
0
);
where
+=
$@" and
{
nameof
(
RB_Supplies_ApplyforSpecial_Extend
.
Date
)}
>='
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd"
)}
'"
;
//必须要大于等于当前时间
if
(
dmodel
.
ApplyforId
>=
0
)
{
where
+=
" and "
+
nameof
(
RB_Supplies_ApplyforSpecial_Extend
.
ApplyforId
)
+
" ="
+
dmodel
.
ApplyforId
;
}
if
(!
string
.
IsNullOrEmpty
(
dmodel
.
ApplyforIds
))
{
where
+=
" and "
+
nameof
(
RB_Supplies_ApplyforSpecial_Extend
.
ApplyforId
)
+
" in("
+
dmodel
.
ApplyforIds
+
")"
;
}
string
sql
=
$@" select * from RB_Supplies_ApplyforSpecial
{
where
}
order by Id desc"
;
return
Get
<
RB_Supplies_ApplyforSpecial_Extend
>(
sql
).
ToList
();
...
...
Property.Repository/Supplies/RB_Supplies_ApplyforWeekdayRepository.cs
View file @
2bc0e534
...
...
@@ -23,13 +23,13 @@ namespace Property.Repository
{
string
where
=
" where 1=1 "
;
where
+=
string
.
Format
(
" AND {0}={1}"
,
nameof
(
RB_Supplies_ApplyforWeekday_Extend
.
Status
),
0
);
where
+=
$@" and RB_Group_Id=
{
dmodel
.
RB_Group_Id
}
"
;
if
(
dmodel
.
ApplyforId
>=
0
)
where
+=
$@" and RB_Group_Id=
{
dmodel
.
RB_Group_Id
}
"
;
if
(
dmodel
.
ApplyforId
>
0
)
{
where
+=
" and "
+
nameof
(
RB_Supplies_ApplyforWeekday_Extend
.
ApplyforId
)
+
" ="
+
dmodel
.
ApplyforId
;
}
string
sql
=
$@" select * from RB_Supplies_Applyfor
{
where
}
order by Id desc"
;
string
sql
=
$@" select * from RB_Supplies_Applyfor
Weekday
{
where
}
order by Id desc"
;
return
GetPage
<
RB_Supplies_ApplyforWeekday_Extend
>(
pageIndex
,
pageSize
,
out
count
,
sql
).
ToList
();
}
...
...
@@ -44,12 +44,15 @@ namespace Property.Repository
string
where
=
" where 1=1 "
;
where
+=
string
.
Format
(
" AND {0}={1}"
,
nameof
(
RB_Supplies_ApplyforWeekday_Extend
.
Status
),
0
);
where
+=
$@" and RB_Group_Id=
{
dmodel
.
RB_Group_Id
}
"
;
if
(
dmodel
.
ApplyforId
>
=
0
)
if
(
dmodel
.
ApplyforId
>
0
)
{
where
+=
" and "
+
nameof
(
RB_Supplies_ApplyforWeekday_Extend
.
ApplyforId
)
+
" ="
+
dmodel
.
ApplyforId
;
}
if
(!
string
.
IsNullOrEmpty
(
dmodel
.
ApplyforIds
))
{
where
+=
" and "
+
nameof
(
RB_Supplies_ApplyforWeekday_Extend
.
ApplyforId
)
+
" in("
+
dmodel
.
ApplyforIds
+
")"
;
}
string
sql
=
$@" select * from RB_Supplies_Applyfor
{
where
}
order by Id desc"
;
string
sql
=
$@" select * from RB_Supplies_Applyfor
Weekday
{
where
}
order by Id desc"
;
return
Get
<
RB_Supplies_ApplyforWeekday_Extend
>(
sql
).
ToList
();
}
}
...
...
Property.WebApi/Controllers/Property/PropertyController.cs
View file @
2bc0e534
...
...
@@ -1061,6 +1061,7 @@ namespace Property.WebApi.Controllers.User
x
.
BranchName
,
x
.
DepartmentName
,
TempleteId
=
x
.
TempleteId
??
0
,
x
.
IsApplyForSign
,
DetailList
=
x
.
DetailList
.
Select
(
z
=>
new
{
z
.
Id
,
...
...
@@ -1397,6 +1398,7 @@ namespace Property.WebApi.Controllers.User
x
.
OrderCode
,
AuditStatusName
=
x
.
AuditStatus
.
GetEnumName
(),
TempleteId
=
x
.
TempleteId
??
0
,
x
.
IsApplyForSign
,
DetailList
=
x
.
DetailList
.
Select
(
z
=>
new
{
z
.
Id
,
...
...
Property.WebApi/Controllers/Property/SuppliesController.cs
View file @
2bc0e534
...
...
@@ -1111,7 +1111,248 @@ namespace Property.WebApi.Controllers.User
#
region
耗材申请日期
/// <summary>
/// 获取耗材申请设置分页列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetApplyForSetPageList
()
{
var
requestParm
=
GetRequestParm
();
UserInfo
userInfo
=
CacheManager
.
User
.
UserReidsCache
.
GetUserLoginInfo
(
requestParm
.
uid
);
ResultPageModel
pagelist
=
JsonConvert
.
DeserializeObject
<
ResultPageModel
>(
requestParm
.
msg
.
ToString
());
RB_Supplies_Applyfor_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Supplies_Applyfor_Extend
>(
requestParm
.
msg
.
ToString
());
demodel
.
RB_Group_Id
=
userInfo
.
RB_Group_id
;
List
<
RB_Supplies_Applyfor_Extend
>
list
=
suppliesModule
.
GetApplyForSetPageList
(
pagelist
.
pageIndex
,
pagelist
.
pageSize
,
demodel
,
out
long
count
);
pagelist
.
count
=
Convert
.
ToInt32
(
count
);
pagelist
.
pageData
=
list
.
Select
(
x
=>
new
{
x
.
Id
,
x
.
BranchId
,
BranchName
=
x
.
BranchId
==-
1
?
"通用"
:
CacheManager
.
User
.
BranchReidsCache
.
GetBranch
(
x
.
BranchId
)?.
BName
??
""
,
x
.
Enabled
,
WeekdayList
=
x
.
WeekdayList
.
Select
(
x
=>
new
{
x
.
Id
,
x
.
ApplyforId
,
x
.
Weekday
,
x
.
StartTime
,
x
.
EndTime
}),
SpecialList
=
x
.
SpecialList
.
Select
(
x
=>
new
{
x
.
Id
,
x
.
ApplyforId
,
Date
=
x
.
Date
.
Value
.
ToString
(
"yyyy-MM-dd"
),
x
.
StartTime
,
x
.
EndTime
}),
UpdateBy
=
(
CacheManager
.
User
.
UserReidsCache
.
GetEmployee
(
x
.
UpdateBy
)?.
EmName
??
""
),
UpdateDate
=
x
.
UpdateDate
.
Value
.
ToString
(
"yyyy-MM-dd"
)
});
return
ApiResult
.
Success
(
""
,
pagelist
);
}
/// <summary>
/// 新增耗材申请设置
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SetApplyForInfo
()
{
var
requestParm
=
GetRequestParm
();
UserInfo
userInfo
=
CacheManager
.
User
.
UserReidsCache
.
GetUserLoginInfo
(
requestParm
.
uid
);
RB_Supplies_Applyfor_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Supplies_Applyfor_Extend
>(
requestParm
.
msg
.
ToString
());
if
((
demodel
.
BranchId
??
-
1
)
<
-
1
)
{
return
ApiResult
.
ParamIsNull
(
"请选择公司别"
);
}
if
(
demodel
.
WeekdayList
==
null
||
!
demodel
.
WeekdayList
.
Any
())
{
return
ApiResult
.
ParamIsNull
(
"请选择工作日"
);
}
foreach
(
var
item
in
demodel
.
WeekdayList
)
{
if
(
string
.
IsNullOrEmpty
(
item
.
Weekday
))
{
return
ApiResult
.
ParamIsNull
(
"工作日设置有误"
);
}
if
(
string
.
IsNullOrEmpty
(
item
.
StartTime
))
{
return
ApiResult
.
ParamIsNull
(
"工作日时间设置有误"
);
}
if
(
string
.
IsNullOrEmpty
(
item
.
EndTime
)){
return
ApiResult
.
ParamIsNull
(
"工作日时间设置有误"
);
}
}
if
(
demodel
.
SpecialList
!=
null
&&
demodel
.
SpecialList
.
Any
())
{
foreach
(
var
item
in
demodel
.
SpecialList
)
{
if
(!
item
.
Date
.
HasValue
)
{
return
ApiResult
.
ParamIsNull
(
"请选择特殊日期"
);
}
if
(
string
.
IsNullOrEmpty
(
item
.
StartTime
))
{
return
ApiResult
.
ParamIsNull
(
"特殊日期时间设置有误"
);
}
if
(
string
.
IsNullOrEmpty
(
item
.
EndTime
))
{
return
ApiResult
.
ParamIsNull
(
"特殊日期时间设置有误"
);
}
}
}
//验证公司别是否重复
if
(
suppliesModule
.
ValidateBranch
(
demodel
,
userInfo
))
{
return
ApiResult
.
Failed
(
"该公司已存在记录,无法新增"
);
}
demodel
.
CreateBy
=
userInfo
.
EmployeeId
;
demodel
.
CreateDate
=
DateTime
.
Now
;
demodel
.
UpdateBy
=
userInfo
.
EmployeeId
;
demodel
.
UpdateDate
=
DateTime
.
Now
;
demodel
.
RB_Branch_Id
=
userInfo
.
RB_Branch_id
;
demodel
.
RB_Group_Id
=
userInfo
.
RB_Group_id
;
bool
flag
=
suppliesModule
.
SetApplyForInfo
(
demodel
);
if
(
flag
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
();
}
}
/// <summary>
/// 设置申请状态
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SetApplyForStatus
()
{
var
requestParm
=
GetRequestParm
();
UserInfo
userInfo
=
CacheManager
.
User
.
UserReidsCache
.
GetUserLoginInfo
(
requestParm
.
uid
);
JObject
parms
=
JObject
.
Parse
(
requestParm
.
msg
.
ToString
());
int
ApplyforId
=
parms
.
GetInt
(
"ApplyforId"
,
0
);
if
(
ApplyforId
==
0
)
{
return
ApiResult
.
Failed
(
"请传递id"
);
}
bool
flag
=
suppliesModule
.
SetApplyForStatus
(
ApplyforId
,
userInfo
);
if
(
flag
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
();
}
}
/// <summary>
/// 获取耗材申请设置
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetApplyForInfo
()
{
var
requestParm
=
GetRequestParm
();
UserInfo
userInfo
=
CacheManager
.
User
.
UserReidsCache
.
GetUserLoginInfo
(
requestParm
.
uid
);
var
Model
=
suppliesModule
.
GetApplyForInfo
(
userInfo
);
if
(
Model
.
Id
==
-
1
)
{
return
ApiResult
.
Success
(
""
,
new
{
Status
=
1
,
Model
=
""
});
}
else
{
return
ApiResult
.
Success
(
""
,
new
{
Status
=
2
,
Model
=
new
{
Model
.
Id
,
Model
.
BranchId
,
BranchName
=
CacheManager
.
User
.
BranchReidsCache
.
GetBranch
(
Model
.
BranchId
)?.
BName
??
""
,
WeekdayList
=
Model
.
WeekdayList
.
Select
(
x
=>
new
{
x
.
Weekday
,
x
.
StartTime
,
x
.
EndTime
}),
SpecialList
=
Model
.
SpecialList
.
Select
(
x
=>
new
{
Date
=
x
.
Date
.
Value
.
ToString
(
"yyyy-MM-dd"
),
x
.
StartTime
,
x
.
EndTime
})
}
});
}
}
/// <summary>
/// 是否可以申请
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetCanApplyFor
()
{
var
requestParm
=
GetRequestParm
();
UserInfo
userInfo
=
CacheManager
.
User
.
UserReidsCache
.
GetUserLoginInfo
(
requestParm
.
uid
);
var
Model
=
suppliesModule
.
GetApplyForInfo
(
userInfo
);
if
(
Model
.
Id
==
-
1
)
{
return
ApiResult
.
Success
();
}
else
{
if
(
Model
.
SpecialList
!=
null
&&
Model
.
SpecialList
.
Any
())
{
var
smodel
=
Model
.
SpecialList
.
Where
(
x
=>
x
.
Date
==
Convert
.
ToDateTime
(
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd"
))).
FirstOrDefault
();
if
(
smodel
!=
null
)
{
smodel
.
StartTime
=
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd"
)
+
" "
+
smodel
.
StartTime
;
smodel
.
EndTime
=
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd"
)
+
" "
+
smodel
.
EndTime
;
if
(
Convert
.
ToDateTime
(
smodel
.
StartTime
)
<=
DateTime
.
Now
&&
DateTime
.
Now
<=
Convert
.
ToDateTime
(
smodel
.
EndTime
))
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
();
}
}
}
int
Week
=
(
int
)
DateTime
.
Now
.
DayOfWeek
;
string
WeekDay
=
""
;
switch
(
Week
)
{
case
0
:
WeekDay
=
"周日"
;
break
;
case
1
:
WeekDay
=
"周一"
;
break
;
case
2
:
WeekDay
=
"周二"
;
break
;
case
3
:
WeekDay
=
"周三"
;
break
;
case
4
:
WeekDay
=
"周四"
;
break
;
case
5
:
WeekDay
=
"周五"
;
break
;
case
6
:
WeekDay
=
"周六"
;
break
;
}
var
wmodel
=
Model
.
WeekdayList
.
Where
(
x
=>
x
.
Weekday
==
WeekDay
).
FirstOrDefault
();
if
(
wmodel
==
null
)
{
return
ApiResult
.
Failed
();
}
wmodel
.
StartTime
=
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd"
)
+
" "
+
wmodel
.
StartTime
;
wmodel
.
EndTime
=
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd"
)
+
" "
+
wmodel
.
EndTime
;
if
(
Convert
.
ToDateTime
(
wmodel
.
StartTime
)
<=
DateTime
.
Now
&&
DateTime
.
Now
<=
Convert
.
ToDateTime
(
wmodel
.
EndTime
))
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
();
}
}
}
#
endregion
...
...
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