Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
J
JPSMysql
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Members
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
zxw
JPSMysql
Commits
c434458c
Commit
c434458c
authored
Sep 19, 2022
by
zonevg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
c735d02b
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
101 行增加
和
103 行删除
+101
-103
CabinetController.cs
JunmpPoliceStation/Controllers/CabinetController.cs
+101
-103
没有找到文件。
JunmpPoliceStation/Controllers/CabinetController.cs
View file @
c434458c
...
...
@@ -3426,7 +3426,9 @@ namespace JunmpPoliceStation.Controllers
_unitOfWork
.
EquipmentInventoryRepository
.
Update
(
OutEpc
,
false
);
//更新被拿走的物资信息
}
if
(
_unitOfWork
.
SaveChanges
()
>
0
)
_unitOfWork
.
SaveChanges
();
if
(
OutEpc
.
Count
>
0
)
{
//上报数据
var
httpResult
=
_httpHelper
.
GetHtml
(
new
HttpItem
()
...
...
@@ -3477,127 +3479,123 @@ namespace JunmpPoliceStation.Controllers
scope
.
Rollback
();
return
JsonManager
.
SimpleCustResponse
(
obj
.
msg
);
}
scope
.
Commit
();
var
CurrentEI
=
_unitOfWork
.
EquipmentInventoryRepository
.
GetList
(
p
=>
p
.
InventoryState
!=
"loss"
&&
p
.
Cabinet
.
CabinetRealNum
.
Equals
(
cabinetID
)
&&
p
.
Cabinet
.
CabinetChildNum
.
Equals
(
Convert
.
ToInt32
(
cabinetChildID
)),
null
,
false
,
param
);
var
InsideEI
=
CurrentEI
.
Where
(
p
=>
p
.
CurrentState
.
Equals
(
3
)).
ToList
();
//在单警柜中的物资
var
OutsideEI
=
CurrentEI
.
Where
(
p
=>
p
.
CurrentState
.
Equals
(
7
)).
ToList
();
//在单警柜外的物资
if
(
rebind
.
Equals
(
"false"
)
&&
((
InsertState
.
Where
(
p
=>
p
.
ActionState
.
Equals
(
5
)
&&
p
.
OutInState
.
Equals
(
1
)).
ToList
().
Count
>
0
&&
InsertState
.
Where
(
p
=>
p
.
ActionState
.
Equals
(
5
)
&&
p
.
OutInState
.
Equals
(
0
)).
ToList
().
Count
>
0
&&
InsideEI
.
Count
()
>
0
)
||
(
InsertState
.
Where
(
p
=>
p
.
ActionState
.
Equals
(
5
)
&&
p
.
OutInState
.
Equals
(
1
)).
ToList
()
.
Count
<=
0
&&
InsertState
.
Where
(
p
=>
p
.
ActionState
.
Equals
(
5
)
&&
p
.
OutInState
.
Equals
(
0
)).
ToList
().
Count
<=
0
&&
OutsideEI
.
Count
>
0
&&
InsideEI
.
Count
>
0
)))
//有拿有还则选择拿的
}
scope
.
Commit
();
var
CurrentEI
=
_unitOfWork
.
EquipmentInventoryRepository
.
GetList
(
p
=>
p
.
InventoryState
!=
"loss"
&&
p
.
Cabinet
.
CabinetRealNum
.
Equals
(
cabinetID
)
&&
p
.
Cabinet
.
CabinetChildNum
.
Equals
(
Convert
.
ToInt32
(
cabinetChildID
)),
null
,
false
,
param
);
var
InsideEI
=
CurrentEI
.
Where
(
p
=>
p
.
CurrentState
.
Equals
(
3
)).
ToList
();
//在单警柜中的物资
var
OutsideEI
=
CurrentEI
.
Where
(
p
=>
p
.
CurrentState
.
Equals
(
7
)).
ToList
();
//在单警柜外的物资
if
(
rebind
.
Equals
(
"false"
)
&&
((
InsertState
.
Where
(
p
=>
p
.
ActionState
.
Equals
(
5
)
&&
p
.
OutInState
.
Equals
(
1
)).
ToList
().
Count
>
0
&&
InsertState
.
Where
(
p
=>
p
.
ActionState
.
Equals
(
5
)
&&
p
.
OutInState
.
Equals
(
0
)).
ToList
().
Count
>
0
&&
InsideEI
.
Count
()
>
0
)
||
(
InsertState
.
Where
(
p
=>
p
.
ActionState
.
Equals
(
5
)
&&
p
.
OutInState
.
Equals
(
1
)).
ToList
()
.
Count
<=
0
&&
InsertState
.
Where
(
p
=>
p
.
ActionState
.
Equals
(
5
)
&&
p
.
OutInState
.
Equals
(
0
)).
ToList
().
Count
<=
0
&&
OutsideEI
.
Count
>
0
&&
InsideEI
.
Count
>
0
)))
//有拿有还则选择拿的
{
if
(
policeman
!=
null
)
{
if
(
policeman
!=
null
)
SendMsg
equipmentDic
=
new
SendMsg
();
equipmentDic
.
State
=
"error"
;
equipmentDic
.
Msg
=
"missTake"
;
equipmentDic
.
Time
=
time
;
equipmentDic
.
BoxNum
=
cabinetChildID
;
equipmentDic
.
UserName
=
policeman
?.
Name
;
foreach
(
var
item
in
InsideEI
)
{
SendMsg
equipmentDic
=
new
SendMsg
();
equipmentDic
.
State
=
"error"
;
equipmentDic
.
Msg
=
"missTake"
;
equipmentDic
.
Time
=
time
;
equipmentDic
.
BoxNum
=
cabinetChildID
;
equipmentDic
.
UserName
=
policeman
?.
Name
;
foreach
(
var
item
in
InsideEI
)
{
equipmentDic
.
EPC
=
string
.
IsNullOrEmpty
(
equipmentDic
.
EPC
)
?
item
.
Epc
:
equipmentDic
.
EPC
+
","
+
item
.
Epc
;
equipmentDic
.
Name
=
string
.
IsNullOrEmpty
(
equipmentDic
.
Name
)
?
item
.
EquipmentCodeNavigation
.
Name
+
"-"
+
item
.
EquipmentSizecodeNavigation
.
SizeName
:
equipmentDic
.
Name
+
","
+
item
.
EquipmentCodeNavigation
.
Name
+
"-"
+
item
.
EquipmentSizecodeNavigation
.
SizeName
;
}
InvStates
.
Add
(
equipmentDic
);
equipmentDic
.
EPC
=
string
.
IsNullOrEmpty
(
equipmentDic
.
EPC
)
?
item
.
Epc
:
equipmentDic
.
EPC
+
","
+
item
.
Epc
;
equipmentDic
.
Name
=
string
.
IsNullOrEmpty
(
equipmentDic
.
Name
)
?
item
.
EquipmentCodeNavigation
.
Name
+
"-"
+
item
.
EquipmentSizecodeNavigation
.
SizeName
:
equipmentDic
.
Name
+
","
+
item
.
EquipmentCodeNavigation
.
Name
+
"-"
+
item
.
EquipmentSizecodeNavigation
.
SizeName
;
}
InvStates
.
Add
(
equipmentDic
);
}
else
if
(
rebind
.
Equals
(
"false"
)
&&
(
InsertState
.
Where
(
p
=>
p
.
ActionState
.
Equals
(
5
)
&&
p
.
OutInState
.
Equals
(
1
)).
ToList
().
Count
>
0
&&
InsertState
.
Where
(
p
=>
p
.
ActionState
.
Equals
(
5
)
&&
p
.
OutInState
.
Equals
(
0
)).
ToList
().
Count
<=
0
&&
OutsideEI
.
Count
()
>
0
))
//放入了物资 少还了物资
}
else
if
(
rebind
.
Equals
(
"false"
)
&&
(
InsertState
.
Where
(
p
=>
p
.
ActionState
.
Equals
(
5
)
&&
p
.
OutInState
.
Equals
(
1
)).
ToList
().
Count
>
0
&&
InsertState
.
Where
(
p
=>
p
.
ActionState
.
Equals
(
5
)
&&
p
.
OutInState
.
Equals
(
0
)).
ToList
().
Count
<=
0
&&
OutsideEI
.
Count
()
>
0
))
//放入了物资 少还了物资
{
if
(
policeman
!=
null
)
{
if
(
policeman
!=
null
)
SendMsg
equipmentDic
=
new
SendMsg
();
equipmentDic
.
State
=
"error"
;
equipmentDic
.
Msg
=
"missReturn"
;
equipmentDic
.
Time
=
time
;
equipmentDic
.
BoxNum
=
cabinetChildID
;
equipmentDic
.
UserName
=
policeman
?.
Name
;
foreach
(
var
item
in
OutsideEI
)
{
SendMsg
equipmentDic
=
new
SendMsg
();
equipmentDic
.
State
=
"error"
;
equipmentDic
.
Msg
=
"missReturn"
;
equipmentDic
.
Time
=
time
;
equipmentDic
.
BoxNum
=
cabinetChildID
;
equipmentDic
.
UserName
=
policeman
?.
Name
;
foreach
(
var
item
in
OutsideEI
)
{
equipmentDic
.
EPC
=
string
.
IsNullOrEmpty
(
equipmentDic
.
EPC
)
?
item
.
Epc
:
equipmentDic
.
EPC
+
","
+
item
.
Epc
;
equipmentDic
.
Name
=
string
.
IsNullOrEmpty
(
equipmentDic
.
Name
)
?
item
.
EquipmentCodeNavigation
.
Name
+
"-"
+
item
.
EquipmentSizecodeNavigation
.
SizeName
:
equipmentDic
.
Name
+
","
+
item
.
EquipmentCodeNavigation
.
Name
+
"-"
+
item
.
EquipmentSizecodeNavigation
.
SizeName
;
}
InvStates
.
Add
(
equipmentDic
);
equipmentDic
.
EPC
=
string
.
IsNullOrEmpty
(
equipmentDic
.
EPC
)
?
item
.
Epc
:
equipmentDic
.
EPC
+
","
+
item
.
Epc
;
equipmentDic
.
Name
=
string
.
IsNullOrEmpty
(
equipmentDic
.
Name
)
?
item
.
EquipmentCodeNavigation
.
Name
+
"-"
+
item
.
EquipmentSizecodeNavigation
.
SizeName
:
equipmentDic
.
Name
+
","
+
item
.
EquipmentCodeNavigation
.
Name
+
"-"
+
item
.
EquipmentSizecodeNavigation
.
SizeName
;
}
InvStates
.
Add
(
equipmentDic
);
}
else
if
(
rebind
.
Equals
(
"false"
)
&&
(
InsertState
.
Where
(
p
=>
p
.
ActionState
.
Equals
(
5
)
&&
p
.
OutInState
.
Equals
(
1
)).
ToList
().
Count
<=
0
&&
InsertState
.
Where
(
p
=>
p
.
ActionState
.
Equals
(
5
)
&&
p
.
OutInState
.
Equals
(
0
)).
ToList
().
Count
>
0
&&
InsideEI
.
Count
()
>
0
))
//拿出了物资 少拿了物资
}
else
if
(
rebind
.
Equals
(
"false"
)
&&
(
InsertState
.
Where
(
p
=>
p
.
ActionState
.
Equals
(
5
)
&&
p
.
OutInState
.
Equals
(
1
)).
ToList
().
Count
<=
0
&&
InsertState
.
Where
(
p
=>
p
.
ActionState
.
Equals
(
5
)
&&
p
.
OutInState
.
Equals
(
0
)).
ToList
().
Count
>
0
&&
InsideEI
.
Count
()
>
0
))
//拿出了物资 少拿了物资
{
if
(
policeman
!=
null
)
{
if
(
policeman
!=
null
)
SendMsg
equipmentDic
=
new
SendMsg
();
equipmentDic
.
State
=
"error"
;
equipmentDic
.
Msg
=
"missTake"
;
equipmentDic
.
Time
=
time
;
equipmentDic
.
BoxNum
=
cabinetChildID
;
equipmentDic
.
UserName
=
policeman
?.
Name
;
foreach
(
var
item
in
InsideEI
)
{
SendMsg
equipmentDic
=
new
SendMsg
();
equipmentDic
.
State
=
"error"
;
equipmentDic
.
Msg
=
"missTake"
;
equipmentDic
.
Time
=
time
;
equipmentDic
.
BoxNum
=
cabinetChildID
;
equipmentDic
.
UserName
=
policeman
?.
Name
;
foreach
(
var
item
in
InsideEI
)
{
equipmentDic
.
EPC
=
string
.
IsNullOrEmpty
(
equipmentDic
.
EPC
)
?
item
.
Epc
:
equipmentDic
.
EPC
+
","
+
item
.
Epc
;
equipmentDic
.
Name
=
string
.
IsNullOrEmpty
(
equipmentDic
.
Name
)
?
item
.
EquipmentCodeNavigation
.
Name
+
"-"
+
item
.
EquipmentSizecodeNavigation
.
SizeName
:
equipmentDic
.
Name
+
","
+
item
.
EquipmentCodeNavigation
.
Name
+
"-"
+
item
.
EquipmentSizecodeNavigation
.
SizeName
;
}
InvStates
.
Add
(
equipmentDic
);
equipmentDic
.
EPC
=
string
.
IsNullOrEmpty
(
equipmentDic
.
EPC
)
?
item
.
Epc
:
equipmentDic
.
EPC
+
","
+
item
.
Epc
;
equipmentDic
.
Name
=
string
.
IsNullOrEmpty
(
equipmentDic
.
Name
)
?
item
.
EquipmentCodeNavigation
.
Name
+
"-"
+
item
.
EquipmentSizecodeNavigation
.
SizeName
:
equipmentDic
.
Name
+
","
+
item
.
EquipmentCodeNavigation
.
Name
+
"-"
+
item
.
EquipmentSizecodeNavigation
.
SizeName
;
}
InvStates
.
Add
(
equipmentDic
);
}
var
InsideTimeEq
=
OutEpc
.
Where
(
p
=>
p
.
WarrantyCycle
!=
0
&&
p
.
ProductTime
!=
null
).
ToList
();
InsideTimeEq
=
InsideTimeEq
.
Where
(
p
=>
p
.
ProductTime
.
Value
.
AddMonths
(
Convert
.
ToInt32
(
p
.
WarrantyCycle
))
<=
DateTime
.
Now
).
ToList
();
}
var
InsideTimeEq
=
OutEpc
.
Where
(
p
=>
p
.
WarrantyCycle
!=
0
&&
p
.
ProductTime
!=
null
).
ToList
();
InsideTimeEq
=
InsideTimeEq
.
Where
(
p
=>
p
.
ProductTime
.
Value
.
AddMonths
(
Convert
.
ToInt32
(
p
.
WarrantyCycle
))
<=
DateTime
.
Now
).
ToList
();
if
(
InsideTimeEq
.
Count
>
0
)
if
(
InsideTimeEq
.
Count
>
0
)
{
foreach
(
var
item
in
InsideTimeEq
)
{
foreach
(
var
item
in
InsideTimeEq
)
{
SendMsg
outTimeEq
=
new
SendMsg
();
//过期判断
outTimeEq
.
State
=
"exceed"
;
outTimeEq
.
Time
=
time
;
outTimeEq
.
BoxNum
=
cabinetChildID
;
outTimeEq
.
UserName
=
policeman
?.
Name
;
outTimeEq
.
EPC
=
string
.
Empty
;
outTimeEq
.
Name
=
item
.
EquipmentCodeNavigation
.
Name
+
"-"
+
item
.
EquipmentSizecodeNavigation
.
SizeName
;
outTimeEq
.
EPC
=
string
.
IsNullOrEmpty
(
outTimeEq
.
EPC
)
?
item
.
Epc
:
outTimeEq
.
EPC
+
","
+
item
.
Epc
;
outTimeEq
.
Msg
=
"物资:"
+
item
.
EquipmentCodeNavigation
.
Name
+
"-"
+
item
.
EquipmentSizecodeNavigation
.
SizeName
+
"已于"
+
item
.
ProductTime
.
Value
.
AddMonths
(
Convert
.
ToInt32
(
item
.
WarrantyCycle
)).
ToString
()
+
"过期"
;
InvStates
.
Add
(
outTimeEq
);
SendMsg
outTimeEq
=
new
SendMsg
();
//过期判断
outTimeEq
.
State
=
"exceed"
;
outTimeEq
.
Time
=
time
;
outTimeEq
.
BoxNum
=
cabinetChildID
;
outTimeEq
.
UserName
=
policeman
?.
Name
;
outTimeEq
.
EPC
=
string
.
Empty
;
outTimeEq
.
Name
=
item
.
EquipmentCodeNavigation
.
Name
+
"-"
+
item
.
EquipmentSizecodeNavigation
.
SizeName
;
outTimeEq
.
EPC
=
string
.
IsNullOrEmpty
(
outTimeEq
.
EPC
)
?
item
.
Epc
:
outTimeEq
.
EPC
+
","
+
item
.
Epc
;
outTimeEq
.
Msg
=
"物资:"
+
item
.
EquipmentCodeNavigation
.
Name
+
"-"
+
item
.
EquipmentSizecodeNavigation
.
SizeName
+
"已于"
+
item
.
ProductTime
.
Value
.
AddMonths
(
Convert
.
ToInt32
(
item
.
WarrantyCycle
)).
ToString
()
+
"过期"
;
InvStates
.
Add
(
outTimeEq
);
}
}
}
//预警记录 记录 error:异常 exceed:过期
_unitOfWork
.
DbContext
.
BaseJpCabinetInvErrorMsgs
.
AddRange
(
InvStates
.
Where
(
x
=>
x
.
State
==
"error"
||
x
.
State
==
"exceed"
)
.
Select
(
x
=>
new
BaseJpCabinetInvErrorMsg
{
Id
=
Guid
.
NewGuid
().
ToString
(),
CabinetRealNum
=
cabinet
.
CabinetRealNum
,
CabinetNum
=
cabinet
.
CabinetNum
,
CabinetChildNum
=
cabinet
.
CabinetChildNum
,
CabinetId
=
cabinet
.
Id
,
OrganizationId
=
cabinet
.
OrganizationId
,
State
=
x
.
State
,
Msg
=
x
.
Msg
,
PushTime
=
DateTime
.
Now
,
UserName
=
x
.
UserName
,
CurrentUserName
=
x
.
CurrentUserName
,
Epc
=
x
.
EPC
,
}));
_unitOfWork
.
SaveChanges
();
//预警记录 记录 error:异常 exceed:过期
_unitOfWork
.
DbContext
.
BaseJpCabinetInvErrorMsgs
.
AddRange
(
InvStates
.
Where
(
x
=>
x
.
State
==
"error"
||
x
.
State
==
"exceed"
)
.
Select
(
x
=>
new
BaseJpCabinetInvErrorMsg
{
Id
=
Guid
.
NewGuid
().
ToString
(),
CabinetRealNum
=
cabinet
.
CabinetRealNum
,
CabinetNum
=
cabinet
.
CabinetNum
,
CabinetChildNum
=
cabinet
.
CabinetChildNum
,
CabinetId
=
cabinet
.
Id
,
OrganizationId
=
cabinet
.
OrganizationId
,
State
=
x
.
State
,
Msg
=
x
.
Msg
,
PushTime
=
DateTime
.
Now
,
UserName
=
x
.
UserName
,
CurrentUserName
=
x
.
CurrentUserName
,
Epc
=
x
.
EPC
,
}));
_unitOfWork
.
SaveChanges
();
_logger
.
LogDebug
(
"Cabinet/UploadRFIDInner数据上报数据返回:"
+
JsonConvert
.
SerializeObject
(
InvStates
).
ToString
());
return
JsonManager
.
ReturnSuccessResponse
(
InvStates
);
_logger
.
LogDebug
(
"Cabinet/UploadRFIDInner数据上报数据返回:"
+
JsonConvert
.
SerializeObject
(
InvStates
).
ToString
());
return
JsonManager
.
ReturnSuccessResponse
(
InvStates
);
}
else
{
scope
.
Rollback
();
return
JsonManager
.
SimpleStatusResponse
(
ResultCode
.
REQUEST_DATA_ERROR
);
}
}
catch
(
Exception
e
)
{
...
...
@@ -4215,7 +4213,7 @@ namespace JunmpPoliceStation.Controllers
if
(
jdata
!=
null
)
{
var
entity
=
JsonManager
.
GetJsonEntity
(
jdata
);
_logger
.
LogDebug
(
"DeletePoliceAndCabinet"
+
jdata
.
ToString
());
string
organizationId
=
entity
?.
organizationId
??
""
;
...
...
@@ -4346,7 +4344,7 @@ namespace JunmpPoliceStation.Controllers
catch
(
Exception
ex
)
{
//
_logger.LogError("Login/SignIn 错误:" + ex.ToString());
_logger
.
LogError
(
"Login/SignIn 错误:"
+
ex
.
ToString
());
return
JsonManager
.
SimpleStatusResponse
(
ResultCode
.
OPERATE_FAILED
);
}
});
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论