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
182d6cbf
Commit
182d6cbf
authored
Jan 06, 2023
by
zxw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
大屏调用接口转发主平台
调整定时任务调用的数据库模式
parent
5c9dc64a
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
244 行增加
和
335 行删除
+244
-335
InventoryController.cs
JunmpPoliceStation/Controllers/InventoryController.cs
+151
-0
ViewController.cs
JunmpPoliceStation/Controllers/ViewController.cs
+86
-331
CronJob.cs
JunmpPoliceStation/Extensions/CronJob.cs
+7
-4
没有找到文件。
JunmpPoliceStation/Controllers/InventoryController.cs
View file @
182d6cbf
...
...
@@ -2085,6 +2085,157 @@ namespace JunmpPoliceStation.Controllers
}
/// <summary>
/// 通过箱标/件标epc获取件标epc(混装 智能货架使用)
/// </summary>
/// <remarks>
///
/// ## 例子
///
/// {
/// "epcList":[
/// {"epc":"箱标/件标epc"},
/// {"epc":"箱标/件标epc"},
/// ]
///
/// }
///
/// </remarks>
/// <param name="jdata"></param>
/// <returns></returns>
[
HttpPost
(
"GetEpcListByEpc"
)]
public
async
Task
<
HttpResponseMessage
>
GetEpcListByEpc
([
FromBody
]
JObject
jdata
)
{
return
await
Task
.
Run
(()
=>
{
try
{
if
(
jdata
!=
null
)
{
var
entity
=
JsonManager
.
GetJsonEntity
(
jdata
);
Expression
<
Func
<
CommonJpEquipmentBoxMark
,
bool
>>
xbExpression
=
t
=>
t
.
ReloadBoxingState
!=
1
;
Expression
<
Func
<
CommonJpEquipmentInventory
,
bool
>>
jbExpression
=
t
=>
t
.
InventoryState
!=
"loss"
&&
t
.
CurrentState
==
0
;
var
xbEpcList
=
new
List
<
string
>();
var
jbEpcList
=
new
List
<
string
>();
foreach
(
var
epc
in
entity
.
epcList
)
{
if
(!
string
.
IsNullOrEmpty
(
epc
.
epc
))
{
if
(
epc
.
epc
.
Length
==
24
)
{
//旧版箱标
xbEpcList
.
Add
(
epc
.
epc
);
continue
;
}
var
buffer
=
EpcConvert
.
ToHexByte
(
epc
.
epc
);
var
epc_info
=
EpcConvert
.
EpcAnlysing
(
buffer
);
if
(
epc_info
.
TagType
==
0x00
)
{
//件标
jbEpcList
.
Add
(
epc
.
epc
);
}
else
{
xbEpcList
.
Add
(
epc
.
epc
);
}
}
}
if
(
xbEpcList
.
Count
==
0
&&
jbEpcList
.
Count
==
0
)
{
return
JsonManager
.
SimpleStatusResponse
(
ResultCode
.
REQUEST_DATA_ERROR
);
}
xbExpression
=
xbExpression
.
AndAlso
(
x
=>
xbEpcList
.
Contains
(
x
.
Epc
)
||
xbEpcList
.
Contains
(
x
.
OldEpc
));
jbExpression
=
jbExpression
.
AndAlso
(
x
=>
jbEpcList
.
Contains
(
x
.
Epc
));
var
param
=
new
string
[]
{
"Warehouse"
,
"EquipmentDetail"
,
"Size"
,
"Supplier"
,
"CommonJpEquipmentInventories"
};
var
param2
=
new
string
[]
{
"WarehouseCodeNavigation"
,
"EquipmentCodeNavigation"
,
"EquipmentSizecodeNavigation"
,
"SupplierCodeNavigation"
,
};
var
data
=
_unitOfWork
.
EquipmentBoxMarkRepository
.
GetList
(
xbExpression
,
includes
:
param
).
ToList
();
var
data2
=
_unitOfWork
.
EquipmentInventoryRepository
.
GetList
(
jbExpression
,
includes
:
param2
).
ToList
();
var
res
=
new
List
<
object
>();
res
.
AddRange
(
data
.
Select
(
x
=>
new
{
id
=
x
.
Id
,
createTime
=
x
.
CreateTime
,
epc
=
x
.
Epc
,
oneBoxNum
=
x
.
OneBoxNum
,
warehouseId
=
x
.
WarehouseId
,
warehouseName
=
x
.
Warehouse
.
Name
,
orgizationId
=
x
.
Warehouse
.
OrgizationId
,
equipmentInfoId
=
x
.
EquipmentDetail
.
EquipmentId
,
equipmentDetailId
=
x
.
EquipmentDetailId
,
equipmentDetailName
=
x
.
EquipmentDetail
.
Name
,
equipmentDetailCode
=
x
.
EquipmentDetail
.
Code
,
sizeId
=
x
.
SizeId
,
sizeName
=
x
.
Size
.
SizeName
,
sizeCode
=
x
.
Size
.
SizeCode
,
sizeEpcType
=
x
.
Size
.
EpcType
,
supplierId
=
x
.
SupplierId
,
supplierCode
=
x
.
Supplier
.
SupplierCode
,
supplierName
=
x
.
Supplier
.
Name
,
oldEpc
=
x
.
OldEpc
,
epcList
=
x
.
CommonJpEquipmentInventories
.
Select
(
y
=>
y
.
Epc
)
}).
ToList
());
res
.
AddRange
(
data2
.
Select
(
x
=>
new
{
id
=
x
.
Id
,
createTime
=
x
.
CreateTime
,
epc
=
x
.
Epc
,
oneBoxNum
=
1
,
warehouseId
=
x
.
WarehouseCode
,
warehouseName
=
x
.
WarehouseCodeNavigation
.
Name
,
orgizationId
=
x
.
WarehouseCodeNavigation
.
OrgizationId
,
equipmentInfoId
=
x
.
EquipmentCodeNavigation
.
EquipmentId
,
equipmentDetailId
=
x
.
EquipmentCode
,
equipmentDetailName
=
x
.
EquipmentCodeNavigation
.
Name
,
equipmentDetailCode
=
x
.
EquipmentCodeNavigation
.
Code
,
sizeId
=
x
.
EquipmentSizecode
,
sizeName
=
x
.
EquipmentSizecodeNavigation
.
SizeName
,
sizeCode
=
x
.
EquipmentSizecodeNavigation
.
SizeCode
,
sizeEpcType
=
x
.
EquipmentSizecodeNavigation
.
EpcType
,
supplierId
=
x
.
SupplierCode
,
supplierCode
=
x
.
SupplierCodeNavigation
.
SupplierCode
,
supplierName
=
x
.
SupplierCodeNavigation
.
Name
,
oldEpc
=
(
string
)
null
,
epcList
=
new
List
<
string
>()
{
x
.
Epc
}
}).
ToList
());
return
JsonManager
.
ReturnSuccessResponse
(
res
);
}
else
{
return
JsonManager
.
SimpleStatusResponse
(
ResultCode
.
REQUEST_DATA_ERROR
);
}
}
catch
(
Exception
ex
)
{
//_logger.LogError("Login/SignIn 错误:" + ex.ToString());
return
JsonManager
.
SimpleStatusResponse
(
ResultCode
.
OPERATE_FAILED
);
}
});
}
/// <summary>
/// 根据装备包实例id获取物资出入流水记录
/// </summary>
/// <remarks>
...
...
JunmpPoliceStation/Controllers/ViewController.cs
View file @
182d6cbf
...
...
@@ -3,6 +3,7 @@ using JmpCommon.Tools;
using
JmpModel.Model
;
using
JmpModel.Model.Repository
;
using
JunmpPoliceStation.App_Start
;
using
JunmpPoliceStation.Extensions
;
using
JunmpPoliceStation.Models.Repository
;
using
Microsoft.AspNetCore.Mvc
;
using
Microsoft.EntityFrameworkCore
;
...
...
@@ -15,8 +16,10 @@ using System.Collections.Generic;
using
System.IO
;
using
System.Linq
;
using
System.Linq.Expressions
;
using
System.Net
;
using
System.Net.Http
;
using
System.Net.WebSockets
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
JunmpPoliceStation.Controllers
...
...
@@ -29,12 +32,14 @@ namespace JunmpPoliceStation.Controllers
//private ICabinetRepository _CabinetRepository;
private
ILogger
<
ViewController
>
_logger
;
UnitOfWork
_unitOfWork
;
private
HttpHelper
_httpHelper
;
public
ViewController
(
ILogger
<
ViewController
>
logger
,
UnitOfWork
unitOfWork
)
public
ViewController
(
ILogger
<
ViewController
>
logger
,
UnitOfWork
unitOfWork
,
HttpHelper
httpHelper
)
{
_logger
=
logger
;
//_CabinetRepository = CabinetRepository;
_unitOfWork
=
unitOfWork
;
_httpHelper
=
httpHelper
;
}
/// <summary>
...
...
@@ -59,93 +64,26 @@ namespace JunmpPoliceStation.Controllers
{
try
{
if
(
jdata
!=
null
)
//转发主平台
var
httpResult
=
_httpHelper
.
GetHtml
(
new
HttpItem
()
{
var
entity
=
JsonManager
.
GetJsonEntity
(
jdata
);
//在库总量、领用总量、维修数量、报废总量、单警柜数、仓库数
int
zkTopCount
=
0
;
int
zkCount
=
0
;
int
lyCount
=
0
;
int
wxCount
=
0
;
int
bfCount
=
0
;
int
houseCount
=
0
;
var
jjbfCount
=
0
;
string
FindCode
=
entity
.
findCode
;
Expression
<
Func
<
ViewEquipment
,
bool
>>
ViewEquipmentExpression
=
t
=>
!
t
.
OrgId
.
Equals
(
null
);
string
level
=
entity
.
level
;
if
(
string
.
IsNullOrEmpty
(
level
))
{
level
=
"本级及下级"
;
}
if
(
level
==
"本级"
)
{
ViewEquipmentExpression
=
t
=>
t
.
OrgCode
==
FindCode
.
PadRight
(
12
,
'0'
)
&&
t
.
ParentName
!=
null
;
}
else
if
(
level
==
"本级及下级"
)
{
ViewEquipmentExpression
=
t
=>
t
.
OrgCode
.
IndexOf
(
FindCode
)
==
0
&&
t
.
ParentName
!=
null
;
}
else
{
return
JsonManager
.
SimpleStatusResponse
(
ResultCode
.
REQUEST_DATA_ERROR
);
}
IQueryable
<
ViewEquipment
>
ViewEquipmentList
=
_unitOfWork
.
ViewEquipmentRepository
.
GetArray
(
ViewEquipmentExpression
,
t
=>
t
.
FindCode
,
false
);
//在库总量
zkTopCount
=
ViewEquipmentList
.
Count
();
if
(!
String
.
IsNullOrEmpty
(
entity
.
name
))
{
string
parentName
=
entity
.
name
;
zkCount
=
ViewEquipmentList
.
Where
(
c
=>
c
.
ParentName
.
Equals
(
parentName
)
&&
(
c
.
CurrentState
.
Equals
(
0
)
||
c
.
CurrentState
.
Equals
(
3
))).
Count
();
//调拨数量
houseCount
=
ViewEquipmentList
.
Where
(
c
=>
c
.
ParentName
.
Equals
(
parentName
)
&&
c
.
CurrentState
.
Equals
(
1
)).
Count
();
//领用总量
lyCount
=
ViewEquipmentList
.
Where
(
c
=>
c
.
ParentName
.
Equals
(
parentName
)
&&
!(
c
.
CurrentState
.
Equals
(
0
)
||
c
.
CurrentState
.
Equals
(
3
)
||
c
.
CurrentState
.
Equals
(
1
)
||
c
.
CurrentState
.
Equals
(
4
)
||
c
.
CurrentState
.
Equals
(
6
))).
Count
();
//维修数量
wxCount
=
ViewEquipmentList
.
Where
(
c
=>
c
.
ParentName
.
Equals
(
parentName
)
&&
c
.
CurrentState
.
Equals
(
4
)).
Count
();
//报废总量
bfCount
=
ViewEquipmentList
.
Where
(
c
=>
c
.
ParentName
.
Equals
(
parentName
)
&&
c
.
CurrentState
.
Equals
(
6
)).
Count
();
//即将报废
jjbfCount
=
ViewEquipmentList
.
Where
(
c
=>
c
.
ParentName
.
Equals
(
parentName
)
&&
c
.
SafeLevel
.
Equals
(
1
)
&&
!
c
.
CurrentState
.
Equals
(
6
)).
Count
();
}
else
{
zkCount
=
ViewEquipmentList
.
Where
(
c
=>
(
c
.
CurrentState
.
Equals
(
0
)
||
c
.
CurrentState
.
Equals
(
3
))).
Count
();
//调拨数量
houseCount
=
ViewEquipmentList
.
Where
(
c
=>
c
.
CurrentState
.
Equals
(
1
)).
Count
();
//领用总量
lyCount
=
ViewEquipmentList
.
Where
(
c
=>
!(
c
.
CurrentState
.
Equals
(
0
)
||
c
.
CurrentState
.
Equals
(
3
)
||
c
.
CurrentState
.
Equals
(
1
)
||
c
.
CurrentState
.
Equals
(
4
)
||
c
.
CurrentState
.
Equals
(
6
))).
Count
();
//维修数量
wxCount
=
ViewEquipmentList
.
Where
(
c
=>
c
.
CurrentState
.
Equals
(
4
)).
Count
();
//报废总量
bfCount
=
ViewEquipmentList
.
Where
(
c
=>
c
.
CurrentState
.
Equals
(
6
)).
Count
();
//即将报废
jjbfCount
=
ViewEquipmentList
.
Where
(
c
=>
c
.
SafeLevel
.
Equals
(
1
)
&&
!
c
.
CurrentState
.
Equals
(
6
)).
Count
();
}
var
reData
=
new
{
zkCount
=
zkCount
,
lyCount
=
lyCount
,
wxCount
=
wxCount
,
bfCount
=
bfCount
,
houseCount
=
houseCount
,
zkTopCount
=
zkTopCount
,
jjbfCount
=
jjbfCount
};
return
JsonManager
.
ReturnSuccessResponse
(
reData
);
URL
=
_httpHelper
.
_centerServerAddress
+
"/api/View/GetCount"
,
Encoding
=
Encoding
.
UTF8
,
Method
=
"POST"
,
ContentType
=
"application/json"
,
Timeout
=
5000
,
Postdata
=
jdata
.
ToString
()
});
if
(
httpResult
.
StatusCode
!=
HttpStatusCode
.
OK
||
string
.
IsNullOrEmpty
(
httpResult
.
Html
))
{
return
JsonManager
.
SimpleCustResponse
(
"远端上报数据失败"
);
}
else
var
obj
=
JsonConvert
.
DeserializeObject
<
JmpBaseResponse
<
object
>>(
httpResult
.
Html
);
if
(
obj
.
code
!=
"10000"
)
{
return
JsonManager
.
Simple
StatusResponse
(
ResultCode
.
REQUEST_DATA_ERROR
);
return
JsonManager
.
Simple
CustResponse
(
obj
.
msg
);
}
return
JsonManager
.
ReturnSuccessResponse
(
obj
.
data
);
}
catch
(
Exception
ex
)
{
...
...
@@ -318,45 +256,26 @@ namespace JunmpPoliceStation.Controllers
{
try
{
if
(
jdata
!=
null
)
//转发主平台
var
httpResult
=
_httpHelper
.
GetHtml
(
new
HttpItem
()
{
var
entity
=
JsonManager
.
GetJsonEntity
(
jdata
);
Expression
<
Func
<
ViewEquipment
,
bool
>>
ViewEquipmentExpression
=
t
=>
!
t
.
OrgId
.
Equals
(
null
);
string
FindCode
=
entity
.
findCode
;
string
level
=
entity
.
level
;
if
(
string
.
IsNullOrEmpty
(
level
))
{
level
=
"本级及下级"
;
}
if
(
level
==
"本级"
)
{
ViewEquipmentExpression
=
t
=>
t
.
OrgCode
==
FindCode
.
PadRight
(
12
,
'0'
)
&&
t
.
ParentName
!=
null
&&
(
t
.
CurrentState
.
Equals
(
0
)
||
t
.
CurrentState
.
Equals
(
3
));
}
else
if
(
level
==
"本级及下级"
)
{
ViewEquipmentExpression
=
t
=>
t
.
OrgCode
.
IndexOf
(
FindCode
)
==
0
&&
t
.
ParentName
!=
null
&&
(
t
.
CurrentState
.
Equals
(
0
)
||
t
.
CurrentState
.
Equals
(
3
));
}
else
{
return
JsonManager
.
SimpleStatusResponse
(
ResultCode
.
REQUEST_DATA_ERROR
);
}
IQueryable
<
ViewEquipment
>
ViewEquipmentList
=
_unitOfWork
.
ViewEquipmentRepository
.
GetArray
(
ViewEquipmentExpression
,
t
=>
t
.
FindCode
,
false
);
var
groupList
=
ViewEquipmentList
.
GroupBy
(
c
=>
c
.
ParentName
).
Select
(
g
=>
new
{
name
=
g
.
Key
,
value
=
g
.
Count
()
}).
ToList
();
return
JsonManager
.
ReturnSuccessResponse
(
groupList
);
URL
=
_httpHelper
.
_centerServerAddress
+
"/api/View/GetGroupByCount"
,
Encoding
=
Encoding
.
UTF8
,
Method
=
"POST"
,
ContentType
=
"application/json"
,
Timeout
=
5000
,
Postdata
=
jdata
.
ToString
()
});
if
(
httpResult
.
StatusCode
!=
HttpStatusCode
.
OK
||
string
.
IsNullOrEmpty
(
httpResult
.
Html
))
{
return
JsonManager
.
SimpleCustResponse
(
"远端上报数据失败"
);
}
else
var
obj
=
JsonConvert
.
DeserializeObject
<
JmpBaseResponse
<
object
>>(
httpResult
.
Html
);
if
(
obj
.
code
!=
"10000"
)
{
return
JsonManager
.
Simple
StatusResponse
(
ResultCode
.
REQUEST_DATA_ERROR
);
return
JsonManager
.
Simple
CustResponse
(
obj
.
msg
);
}
return
JsonManager
.
ReturnSuccessResponse
(
obj
.
data
);
}
catch
(
Exception
ex
)
{
...
...
@@ -540,27 +459,26 @@ namespace JunmpPoliceStation.Controllers
{
try
{
if
(
jdata
!=
null
)
//转发主平台
var
httpResult
=
_httpHelper
.
GetHtml
(
new
HttpItem
()
{
var
entity
=
JsonManager
.
GetJsonEntity
(
jdata
);
string
FindCode
=
entity
.
findCode
;
List
<
CSyP
>
data
=
_unitOfWork
.
ViewEquipmentRepository
.
Exec_ProP
(
" EXEC c_top5_sy_ps @p_findCode ='"
+
FindCode
+
"'"
).
ToList
();
List
<
Object
>
itemList
=
new
List
<
object
>();
for
(
var
i
=
0
;
i
<
data
.
Count
;
i
++)
{
var
item
=
new
{
id
=
i
+
1
,
itemNum
=
data
[
i
].
MonthP
,
workUnit
=
data
[
i
].
ParentName
};
itemList
.
Add
(
item
);
}
return
JsonManager
.
ReturnSuccessResponse
(
itemList
);
URL
=
_httpHelper
.
_centerServerAddress
+
"/api/View/GetTop5"
,
Encoding
=
Encoding
.
UTF8
,
Method
=
"POST"
,
ContentType
=
"application/json"
,
Timeout
=
5000
,
Postdata
=
jdata
.
ToString
()
});
if
(
httpResult
.
StatusCode
!=
HttpStatusCode
.
OK
||
string
.
IsNullOrEmpty
(
httpResult
.
Html
))
{
return
JsonManager
.
SimpleCustResponse
(
"远端上报数据失败"
);
}
else
var
obj
=
JsonConvert
.
DeserializeObject
<
JmpBaseResponse
<
object
>>(
httpResult
.
Html
);
if
(
obj
.
code
!=
"10000"
)
{
return
JsonManager
.
Simple
StatusResponse
(
ResultCode
.
REQUEST_DATA_ERROR
);
return
JsonManager
.
Simple
CustResponse
(
obj
.
msg
);
}
return
JsonManager
.
ReturnSuccessResponse
(
obj
.
data
);
}
catch
(
Exception
ex
)
{
...
...
@@ -596,120 +514,26 @@ namespace JunmpPoliceStation.Controllers
{
try
{
if
(
jdata
!=
null
)
//转发主平台
var
httpResult
=
_httpHelper
.
GetHtml
(
new
HttpItem
()
{
var
entity
=
JsonManager
.
GetJsonEntity
(
jdata
);
string
FindCode
=
entity
.
findCode
;
List
<
CSyP
>
sydata
=
_unitOfWork
.
ViewEquipmentRepository
.
Exec_ProP
(
"EXEC c_sy_ps @p_findCode ='"
+
FindCode
+
"'"
).
ToList
();
List
<
CSyP
>
wxdata
=
_unitOfWork
.
ViewEquipmentRepository
.
Exec_ProP
(
"EXEC c_wx_p @p_findCode ='"
+
FindCode
+
"'"
).
ToList
();
List
<
CSyP
>
bfdata
=
_unitOfWork
.
ViewEquipmentRepository
.
Exec_ProP
(
"EXEC c_bf_p @p_findCode ='"
+
FindCode
+
"'"
).
ToList
();
sydata
=
sydata
.
OrderBy
(
c
=>
c
.
ParentName
).
ToList
();
wxdata
=
wxdata
.
OrderBy
(
c
=>
c
.
ParentName
).
ToList
();
bfdata
=
bfdata
.
OrderBy
(
c
=>
c
.
ParentName
).
ToList
();
List
<
String
>
pList
=
new
List
<
String
>();
List
<
List
<
int
>>
dataType
=
new
List
<
List
<
int
>>();
for
(
var
i
=
0
;
i
<
sydata
.
Count
;
i
++)
{
if
(!
pList
.
Contains
(
sydata
[
i
].
ParentName
))
{
pList
.
Add
(
sydata
[
i
].
ParentName
);
}
}
for
(
var
i
=
0
;
i
<
wxdata
.
Count
;
i
++)
{
if
(!
pList
.
Contains
(
wxdata
[
i
].
ParentName
))
{
pList
.
Add
(
wxdata
[
i
].
ParentName
);
}
}
for
(
var
i
=
0
;
i
<
bfdata
.
Count
;
i
++)
{
if
(!
pList
.
Contains
(
bfdata
[
i
].
ParentName
))
{
pList
.
Add
(
bfdata
[
i
].
ParentName
);
}
}
List
<
int
>
syList
=
new
List
<
int
>();
for
(
var
i
=
0
;
i
<
pList
.
Count
;
i
++)
{
var
flg
=
true
;
for
(
var
j
=
0
;
j
<
sydata
.
Count
;
j
++)
{
if
(
pList
[
i
].
Equals
(
sydata
[
j
].
ParentName
))
{
syList
.
Add
(
int
.
Parse
(
sydata
[
i
].
MonthP
.
ToString
()));
flg
=
false
;
break
;
}
}
if
(
flg
)
{
syList
.
Add
(
0
);
}
}
dataType
.
Add
(
syList
);
List
<
int
>
wxList
=
new
List
<
int
>();
for
(
var
i
=
0
;
i
<
pList
.
Count
;
i
++)
{
var
flg
=
true
;
for
(
var
j
=
0
;
j
<
wxdata
.
Count
;
j
++)
{
if
(
pList
[
i
].
Equals
(
wxdata
[
j
].
ParentName
))
{
wxList
.
Add
(
int
.
Parse
(
wxdata
[
i
].
WeekP
.
ToString
()));
flg
=
false
;
break
;
}
}
if
(
flg
)
{
wxList
.
Add
(
0
);
}
}
dataType
.
Add
(
wxList
);
List
<
int
>
bfList
=
new
List
<
int
>();
for
(
var
i
=
0
;
i
<
pList
.
Count
;
i
++)
{
var
flg
=
true
;
for
(
var
j
=
0
;
j
<
bfdata
.
Count
;
j
++)
{
if
(
pList
[
i
].
Equals
(
bfdata
[
j
].
ParentName
))
{
bfList
.
Add
(
int
.
Parse
(
bfdata
[
i
].
WeekP
.
ToString
()));
flg
=
false
;
break
;
}
}
if
(
flg
)
{
bfList
.
Add
(
0
);
}
}
dataType
.
Add
(
bfList
);
var
reData
=
new
{
pList
=
pList
,
dataType
=
dataType
};
return
JsonManager
.
ReturnSuccessResponse
(
reData
);
URL
=
_httpHelper
.
_centerServerAddress
+
"/api/View/GetSyWxBf"
,
Encoding
=
Encoding
.
UTF8
,
Method
=
"POST"
,
ContentType
=
"application/json"
,
Timeout
=
5000
,
Postdata
=
jdata
.
ToString
()
});
if
(
httpResult
.
StatusCode
!=
HttpStatusCode
.
OK
||
string
.
IsNullOrEmpty
(
httpResult
.
Html
))
{
return
JsonManager
.
SimpleCustResponse
(
"远端上报数据失败"
);
}
else
var
obj
=
JsonConvert
.
DeserializeObject
<
JmpBaseResponse
<
object
>>(
httpResult
.
Html
);
if
(
obj
.
code
!=
"10000"
)
{
return
JsonManager
.
Simple
StatusResponse
(
ResultCode
.
REQUEST_DATA_ERROR
);
return
JsonManager
.
Simple
CustResponse
(
obj
.
msg
);
}
return
JsonManager
.
ReturnSuccessResponse
(
obj
.
data
);
}
catch
(
Exception
ex
)
{
...
...
@@ -1057,95 +881,26 @@ namespace JunmpPoliceStation.Controllers
{
try
{
if
(
jdata
!=
null
)
//转发主平台
var
httpResult
=
_httpHelper
.
GetHtml
(
new
HttpItem
()
{
var
entity
=
JsonManager
.
GetJsonEntity
(
jdata
);
string
findcode
=
entity
.
findCode
;
if
(
string
.
IsNullOrEmpty
(
findcode
))
{
return
JsonManager
.
SimpleStatusResponse
(
ResultCode
.
REQUEST_DATA_ERROR
);
}
Expression
<
Func
<
ViewEquipment
,
bool
>>
expressionPoliceman
=
null
;
expressionPoliceman
=
t
=>
t
.
FindCode
.
Contains
(
findcode
);
List
<
ViewEquipment
>
equipmentList
=
_unitOfWork
.
ViewEquipmentRepository
.
GetList
(
expressionPoliceman
).
OrderBy
(
c
=>
c
.
FindCode
.
Length
).
ToList
();
if
(
findcode
.
Length
==
6
)
{
var
data
=
equipmentList
.
GroupBy
(
t
=>
t
.
OrgName
).
Select
(
c
=>
new
{
c
.
FirstOrDefault
().
OrgName
,
c
.
FirstOrDefault
().
OrgCode
,
c
.
FirstOrDefault
().
FindCode
,
c
.
FirstOrDefault
().
IsMap
,
children
=
c
.
GroupBy
(
a
=>
a
.
ParentName
).
Select
(
c
=>
new
{
id
=
c
.
FirstOrDefault
().
TypeOneId
,
name
=
c
.
FirstOrDefault
().
ParentName
,
zsCount
=
c
.
Count
(
f
=>
f
.
CurrentState
!=
null
)
}).
Where
(
f
=>
f
.
id
!=
null
&&
f
.
zsCount
!=
0
).
OrderBy
(
c
=>
c
.
id
).
ToList
()
}).
ToList
();
List
<
String
>
pList
=
new
List
<
String
>();
for
(
var
i
=
0
;
i
<
data
.
Count
;
i
++)
{
for
(
var
j
=
0
;
j
<
data
[
i
].
children
.
Count
;
j
++)
{
if
(!
pList
.
Contains
(
data
[
i
].
children
[
j
].
name
))
{
pList
.
Add
(
data
[
i
].
children
[
j
].
name
);
}
}
}
var
redata
=
new
{
data
=
data
.
OrderBy
(
x
=>
x
.
OrgCode
).
ToList
(),
pList
=
pList
};
return
JsonManager
.
ReturnSuccessResponse
(
redata
);
}
else
{
var
codeLen
=
findcode
.
Length
+
2
;
var
data
=
equipmentList
.
GroupBy
(
t
=>
t
.
FindCode
.
PadLeft
(
codeLen
,
'0'
).
Substring
(
0
,
codeLen
)).
Select
(
c
=>
new
{
OrgName
=
c
.
FirstOrDefault
().
AreaName
,
c
.
FirstOrDefault
(
x
=>
x
.
OrgCode
==
c
.
FirstOrDefault
().
FindCode
.
PadRight
(
12
,
'0'
))?.
OrgCode
,
c
.
FirstOrDefault
().
FindCode
,
isMap
=
c
.
FirstOrDefault
(
x
=>
x
.
OrgCode
==
c
.
FirstOrDefault
().
FindCode
.
PadRight
(
12
,
'0'
))?.
IsMap
??
0
,
zsCount
=
c
.
Count
(
f
=>
f
.
CurrentState
!=
null
),
children
=
c
.
GroupBy
(
a
=>
a
.
ParentName
).
Select
(
c
=>
new
{
id
=
c
.
FirstOrDefault
().
TypeOneId
,
name
=
c
.
FirstOrDefault
().
ParentName
,
zsCount
=
c
.
Count
(
f
=>
f
.
CurrentState
!=
null
)
}).
Where
(
f
=>
f
.
id
!=
null
).
OrderBy
(
c
=>
c
.
id
).
ToList
()
}).
ToList
();
List
<
String
>
pList
=
new
List
<
String
>();
for
(
var
i
=
0
;
i
<
data
.
Count
;
i
++)
{
for
(
var
j
=
0
;
j
<
data
[
i
].
children
.
Count
;
j
++)
{
if
(!
pList
.
Contains
(
data
[
i
].
children
[
j
].
name
))
{
pList
.
Add
(
data
[
i
].
children
[
j
].
name
);
}
}
}
var
redata
=
new
{
data
=
data
.
OrderBy
(
x
=>
x
.
OrgCode
).
ToList
(),
pList
=
pList
};
return
JsonManager
.
ReturnSuccessResponse
(
redata
);
}
URL
=
_httpHelper
.
_centerServerAddress
+
"/api/View/GetAreaType"
,
Encoding
=
Encoding
.
UTF8
,
Method
=
"POST"
,
ContentType
=
"application/json"
,
Timeout
=
5000
,
Postdata
=
jdata
.
ToString
()
});
if
(
httpResult
.
StatusCode
!=
HttpStatusCode
.
OK
||
string
.
IsNullOrEmpty
(
httpResult
.
Html
))
{
return
JsonManager
.
SimpleCustResponse
(
"远端上报数据失败"
);
}
else
var
obj
=
JsonConvert
.
DeserializeObject
<
JmpBaseResponse
<
object
>>(
httpResult
.
Html
);
if
(
obj
.
code
!=
"10000"
)
{
return
JsonManager
.
Simple
StatusResponse
(
ResultCode
.
REQUEST_DATA_ERROR
);
return
JsonManager
.
Simple
CustResponse
(
obj
.
msg
);
}
return
JsonManager
.
ReturnSuccessResponse
(
obj
.
data
);
}
catch
(
Exception
ex
)
{
...
...
JunmpPoliceStation/Extensions/CronJob.cs
View file @
182d6cbf
...
...
@@ -28,12 +28,15 @@ namespace JunmpPoliceStation.Extensions
HttpHelper
_httpHelper
;
private
IConfiguration
Configuration
;
private
ILogger
<
CronJob
>
_logger
;
public
CronJob
(
JunmppolicesqlContext
dbContext
,
IConfiguration
configuration
,
ILogger
<
CronJob
>
logger
,
HttpHelper
httpHelper
)
public
CronJob
(
IConfiguration
configuration
,
ILogger
<
CronJob
>
logger
,
HttpHelper
httpHelper
)
{
_dbContext
=
dbContext
;
_httpHelper
=
httpHelper
;
Configuration
=
configuration
;
_logger
=
logger
;
var
options
=
new
DbContextOptionsBuilder
<
JunmppolicesqlContext
>();
options
.
UseMySQL
(
Configuration
.
GetConnectionString
(
"MySqlConnection"
));
_dbContext
=
new
JunmppolicesqlContext
(
options
.
Options
);
}
public
void
SyncEquipmentState
()
...
...
@@ -169,9 +172,9 @@ namespace JunmpPoliceStation.Extensions
Postdata
=
reqData
,
IsNoTIP
=
true
});
if
(
res
.
StatusCode
!=
HttpStatusCode
.
Created
)
if
(
res
.
StatusCode
!=
HttpStatusCode
.
Created
)
{
_logger
.
LogError
(
"获取ACCESS_TOKEN失败 code:"
+
res
.
StatusCode
+
JsonConvert
.
SerializeObject
(
res
));
_logger
.
LogError
(
"获取ACCESS_TOKEN失败 code:"
+
res
.
StatusCode
+
JsonConvert
.
SerializeObject
(
res
));
return
false
;
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论