Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
J
JunmpPoliceStation
概览
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
JunmpPoliceStation
Commits
8de6fa57
Commit
8de6fa57
authored
Dec 15, 2022
by
zxw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
99a8e7a9
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
159 行增加
和
102 行删除
+159
-102
BaseCharge.cs
JunmpPoliceStation/Controllers/BaseCharge.cs
+61
-60
PoliceShiftJobsController.cs
JunmpPoliceStation/Controllers/PoliceShiftJobsController.cs
+12
-6
PrintController.cs
JunmpPoliceStation/Controllers/PrintController.cs
+4
-3
Screen3DShowController.cs
JunmpPoliceStation/Controllers/Screen3DShowController.cs
+62
-24
CronJob.cs
JunmpPoliceStation/Extensions/CronJob.cs
+6
-2
MQTTServer.cs
JunmpPoliceStation/Extensions/MQTTServer.cs
+12
-7
nlog.config.xml
JunmpPoliceStation/nlog.config.xml
+2
-0
没有找到文件。
JunmpPoliceStation/Controllers/BaseCharge.cs
View file @
8de6fa57
...
...
@@ -167,69 +167,70 @@ namespace JunmpPoliceStation.Controllers
{
try
{
if
(
jdata
!=
null
)
{
var
entity
=
JsonManager
.
GetJsonEntity
(
jdata
);
return
JsonManager
.
SimpleStatusResponse
(
ResultCode
.
OPERATE_SUCCESS
);
//if (jdata != null)
//{
// var entity = JsonManager.GetJsonEntity(jdata);
if
(
entity
==
null
)
{
return
JsonManager
.
SimpleStatusResponse
(
ResultCode
.
OPERATE_FAILED
);
}
else
if
(
string
.
IsNullOrEmpty
(
entity
.
orgId
??
""
))
{
return
JsonManager
.
SimpleCustResponse
(
$"orgId is require"
);
}
else
if
(
string
.
IsNullOrEmpty
(
entity
.
equName
??
""
))
{
return
JsonManager
.
SimpleCustResponse
(
$"equName is require"
);
}
else
if
(
string
.
IsNullOrEmpty
(
entity
.
equCode
??
""
))
{
return
JsonManager
.
SimpleCustResponse
(
$"equCode is require"
);
}
else
if
(
string
.
IsNullOrEmpty
(
entity
.
epc
??
""
))
{
return
JsonManager
.
SimpleCustResponse
(
$"epc is require"
);
}
else
if
(
string
.
IsNullOrEmpty
(
entity
.
startTime
??
""
))
{
return
JsonManager
.
SimpleCustResponse
(
$"startTime is require"
);
}
else
if
(
string
.
IsNullOrEmpty
(
entity
.
endTime
??
""
))
{
return
JsonManager
.
SimpleCustResponse
(
$"endTime is require"
);
}
else
{
string
startTime
=
entity
.
startTime
;
//新增数据
BaseCharge
addObject
=
new
BaseCharge
()
{
Id
=
Guid
.
NewGuid
(),
OrgId
=
entity
.
orgId
,
EquName
=
entity
.
equName
,
EquCode
=
entity
.
equCode
,
Epc
=
entity
.
epc
,
StartTime
=
Convert
.
ToDateTime
(
startTime
),
EndTime
=
System
.
DateTime
.
Now
};
//
if (entity == null)
//
{
//
return JsonManager.SimpleStatusResponse(ResultCode.OPERATE_FAILED);
//
}
//
else if (string.IsNullOrEmpty(entity.orgId ?? ""))
//
{
//
return JsonManager.SimpleCustResponse($"orgId is require");
//
}
//
else if (string.IsNullOrEmpty(entity.equName ?? ""))
//
{
//
return JsonManager.SimpleCustResponse($"equName is require");
//
}
//
else if (string.IsNullOrEmpty(entity.equCode ?? ""))
//
{
//
return JsonManager.SimpleCustResponse($"equCode is require");
//
}
//
else if (string.IsNullOrEmpty(entity.epc ?? ""))
//
{
//
return JsonManager.SimpleCustResponse($"epc is require");
//
}
//
else if (string.IsNullOrEmpty(entity.startTime ?? ""))
//
{
//
return JsonManager.SimpleCustResponse($"startTime is require");
//
}
//
else if (string.IsNullOrEmpty(entity.endTime ?? ""))
//
{
//
return JsonManager.SimpleCustResponse($"endTime is require");
//
}
//
else
//
{
//
string startTime = entity.startTime;
//
//新增数据
//
BaseCharge addObject = new BaseCharge()
//
{
//
Id = Guid.NewGuid(),
//
OrgId = entity.orgId,
//
EquName = entity.equName,
//
EquCode = entity.equCode,
//
Epc = entity.epc,
//
StartTime = Convert.ToDateTime(startTime),
//
EndTime = System.DateTime.Now
//
};
bool
result
=
_unitOfWork
.
BaseChargeRepository
.
Insert
(
addObject
);
//
bool result = _unitOfWork.BaseChargeRepository.Insert(addObject);
if
(
result
)
{
return
JsonManager
.
SimpleStatusResponse
(
ResultCode
.
OPERATE_SUCCESS
);
}
else
{
return
JsonManager
.
SimpleStatusResponse
(
ResultCode
.
REQUEST_DATA_ERROR
);
}
}
}
else
{
return
JsonManager
.
SimpleStatusResponse
(
ResultCode
.
REQUEST_DATA_ERROR
);
}
//
if (result)
//
{
//
return JsonManager.SimpleStatusResponse(ResultCode.OPERATE_SUCCESS);
//
}
//
else
//
{
//
return JsonManager.SimpleStatusResponse(ResultCode.REQUEST_DATA_ERROR);
//
}
//
}
//
}
//
else
//
{
//
return JsonManager.SimpleStatusResponse(ResultCode.REQUEST_DATA_ERROR);
//
}
}
catch
(
Exception
ex
)
{
...
...
JunmpPoliceStation/Controllers/PoliceShiftJobsController.cs
View file @
8de6fa57
...
...
@@ -446,15 +446,16 @@ namespace JunmpPoliceStation.Controllers
order
.
Note
=
entity
.
note
;
List
<
string
>
tmpList
=
JsonManager
.
GetDetailIds
(
entity
.
detailList
);
//移除不在上传数据内数据
order
.
CommonJpPoliceShiftJobsApplyDetails
=
order
.
CommonJpPoliceShiftJobsApplyDetails
.
Where
(
x
=>
tmpList
.
Contains
(
x
.
Id
))
.
ToList
();
if
(
entity
.
detailList
is
IEnumerable
)
{
List
<
string
>
tmpList
=
JsonManager
.
GetDetailIds
(
entity
.
detailList
);
//移除不在上传数据内数据
order
.
CommonJpPoliceShiftJobsApplyDetails
=
order
.
CommonJpPoliceShiftJobsApplyDetails
.
Where
(
x
=>
tmpList
.
Contains
(
x
.
Id
))
.
ToList
();
foreach
(
var
item
in
entity
.
detailList
)
{
if
(
string
.
IsNullOrEmpty
(
item
.
equipmentId
??
""
))
...
...
@@ -510,6 +511,11 @@ namespace JunmpPoliceStation.Controllers
}
}
}
else
{
//清空所有携带的装备
order
.
CommonJpPoliceShiftJobsApplyDetails
.
Clear
();
}
bool
result
=
_unitOfWork
.
CommonJpPoliceShiftJobsApplyRepository
.
Update
(
order
,
true
);
if
(
result
)
...
...
JunmpPoliceStation/Controllers/PrintController.cs
View file @
8de6fa57
...
...
@@ -3800,7 +3800,8 @@ namespace JunmpPoliceStation.Controllers
if
(
entity
.
data
==
null
&&
entity
.
xbdata
==
null
)
{
return
JsonManager
.
SimpleCustResponse
(
$"无效参数"
);
//无数据更新
return
JsonManager
.
SimpleStatusResponse
(
ResultCode
.
OPERATE_SUCCESS
);
}
var
addList
=
new
List
<
CommonJpEquipmentInventory
>();
...
...
@@ -3918,9 +3919,9 @@ namespace JunmpPoliceStation.Controllers
{
string
editType
=
item
.
editType
??
""
;
string
id
=
item
.
id
??
""
;
string
bCreateTime
=
DateTime
.
TryParse
(
item
.
createTime
??
""
,
out
DateTime
createTime
);
bool
bCreateTime
=
DateTime
.
TryParse
(
item
.
createTime
??
""
,
out
DateTime
createTime
);
string
epc
=
item
.
epc
??
""
;
string
bOneBoxNum
=
int
.
TryParse
(
item
.
oneBoxNum
??
""
,
out
int
oneBoxNum
);
bool
bOneBoxNum
=
int
.
TryParse
(
item
.
oneBoxNum
??
""
,
out
int
oneBoxNum
);
string
equipmentDetailId
=
item
.
equipmentDetailId
??
""
;
string
sizeId
=
item
.
sizeId
??
""
;
string
supplierId
=
item
.
supplierId
??
""
;
...
...
JunmpPoliceStation/Controllers/Screen3DShowController.cs
View file @
8de6fa57
...
...
@@ -12,6 +12,9 @@ using System.Linq.Expressions;
using
System.Net.Http
;
using
System.Threading.Tasks
;
using
JunmpPoliceStation.App_Start
;
using
Newtonsoft.Json.Serialization
;
using
Newtonsoft.Json
;
using
System.Text
;
namespace
JunmpPoliceStation.Controllers
{
...
...
@@ -98,12 +101,20 @@ namespace JunmpPoliceStation.Controllers
imgurl
=
"http://192.168.2.39:5000/Screen3DShow/1.png"
})
.
ToList
();
var
content
=
new
{
totalElements
=
data
.
Count
,
content
=
data
.
Skip
(
page
*
size
).
Take
(
size
)
};
return
JsonManager
.
ReturnSuccessResponse
(
content
);
//var content = new
//{
// totalElements = data.Count,
// content = data.Skip(page * size).Take(size)
//};
JsonSerializerSettings
setting
=
new
JsonSerializerSettings
();
setting
.
DateFormatHandling
=
DateFormatHandling
.
MicrosoftDateFormat
;
setting
.
DateFormatString
=
"yyyy-MM-dd HH:mm:ss"
;
setting
.
ContractResolver
=
new
CamelCasePropertyNamesContractResolver
();
setting
.
MaxDepth
=
10
;
//设置序列化的最大层数
setting
.
ReferenceLoopHandling
=
ReferenceLoopHandling
.
Ignore
;
return
new
HttpResponseMessage
{
Content
=
new
StringContent
(
JsonConvert
.
SerializeObject
(
data
,
Formatting
.
Indented
,
setting
),
Encoding
.
GetEncoding
(
"UTF-8"
),
"application/json"
)
};
}
else
...
...
@@ -187,12 +198,21 @@ namespace JunmpPoliceStation.Controllers
imgurl
=
"http://192.168.2.39:5000/Screen3DShow/1.png"
})
.
ToList
();
var
content
=
new
{
totalElements
=
equipmentStates
.
totalElements
,
content
=
data
};
return
JsonManager
.
ReturnSuccessResponse
(
content
);
//var content = new
//{
// totalElements = equipmentStates.totalElements,
// content = data
//};
JsonSerializerSettings
setting
=
new
JsonSerializerSettings
();
setting
.
DateFormatHandling
=
DateFormatHandling
.
MicrosoftDateFormat
;
setting
.
DateFormatString
=
"yyyy-MM-dd HH:mm:ss"
;
setting
.
ContractResolver
=
new
CamelCasePropertyNamesContractResolver
();
setting
.
MaxDepth
=
10
;
//设置序列化的最大层数
setting
.
ReferenceLoopHandling
=
ReferenceLoopHandling
.
Ignore
;
return
new
HttpResponseMessage
{
Content
=
new
StringContent
(
JsonConvert
.
SerializeObject
(
data
,
Formatting
.
Indented
,
setting
),
Encoding
.
GetEncoding
(
"UTF-8"
),
"application/json"
)
};
}
else
...
...
@@ -274,12 +294,21 @@ namespace JunmpPoliceStation.Controllers
value
=
x
.
Count
()
})
.
ToList
();
var
content
=
new
{
totalElements
=
data
.
Count
,
content
=
data
.
Skip
(
page
*
size
).
Take
(
size
)
};
return
JsonManager
.
ReturnSuccessResponse
(
content
);
//var content = new
//{
// totalElements = data.Count,
// content = data.Skip(page * size).Take(size)
//};
JsonSerializerSettings
setting
=
new
JsonSerializerSettings
();
setting
.
DateFormatHandling
=
DateFormatHandling
.
MicrosoftDateFormat
;
setting
.
DateFormatString
=
"yyyy-MM-dd HH:mm:ss"
;
setting
.
ContractResolver
=
new
CamelCasePropertyNamesContractResolver
();
setting
.
MaxDepth
=
10
;
//设置序列化的最大层数
setting
.
ReferenceLoopHandling
=
ReferenceLoopHandling
.
Ignore
;
return
new
HttpResponseMessage
{
Content
=
new
StringContent
(
JsonConvert
.
SerializeObject
(
data
,
Formatting
.
Indented
,
setting
),
Encoding
.
GetEncoding
(
"UTF-8"
),
"application/json"
)
};
}
else
...
...
@@ -360,12 +389,21 @@ namespace JunmpPoliceStation.Controllers
x
.
CurrentState
==
3
?
"在库"
:
"不在库"
})
.
ToList
();
var
content
=
new
{
totalElements
=
data
.
Count
,
content
=
data
.
Skip
(
page
*
size
).
Take
(
size
)
};
return
JsonManager
.
ReturnSuccessResponse
(
content
);
//var content = new
//{
// totalElements = data.Count,
// content = data.Skip(page * size).Take(size)
//};
JsonSerializerSettings
setting
=
new
JsonSerializerSettings
();
setting
.
DateFormatHandling
=
DateFormatHandling
.
MicrosoftDateFormat
;
setting
.
DateFormatString
=
"yyyy-MM-dd HH:mm:ss"
;
setting
.
ContractResolver
=
new
CamelCasePropertyNamesContractResolver
();
setting
.
MaxDepth
=
10
;
//设置序列化的最大层数
setting
.
ReferenceLoopHandling
=
ReferenceLoopHandling
.
Ignore
;
return
new
HttpResponseMessage
{
Content
=
new
StringContent
(
JsonConvert
.
SerializeObject
(
data
,
Formatting
.
Indented
,
setting
),
Encoding
.
GetEncoding
(
"UTF-8"
),
"application/json"
)
};
}
else
...
...
JunmpPoliceStation/Extensions/CronJob.cs
View file @
8de6fa57
...
...
@@ -162,7 +162,7 @@ namespace JunmpPoliceStation.Extensions
foreach
(
var
reality
in
borrow
.
CommonJpBorrowReturnDetailRealities
.
Where
(
x
=>
x
.
State
!=
2
))
{
var
equConfigSingle
=
equConfig
.
FirstOrDefault
(
x
=>
x
.
EquipmentDetailId
==
reality
.
EquipmentDetailId
);
if
(
equConfigSingle
!=
null
&&
equConfigSingle
.
OverdueBorrowDay
!=
-
1
)
if
(
equConfigSingle
is
{
IsNotReturned
:
true
}
)
{
//计算是否超期未还
if
(
view
.
ExpectedTime
<
DateTime
.
Now
.
AddDays
(-
equConfigSingle
.
OverdueBorrowDay
))
...
...
@@ -264,7 +264,11 @@ namespace JunmpPoliceStation.Extensions
/// </summary>
public
bool
IsNeedRemind
{
get
;
set
;
}
/// <summary>
/// 超期未还x天后提醒(-1不提醒)
/// 是否需要提醒(超期未还)
/// </summary>
public
bool
IsNotReturned
{
get
;
set
;
}
/// <summary>
/// 超期未还x天后提醒
/// </summary>
public
int
OverdueBorrowDay
{
get
;
set
;
}
}
...
...
JunmpPoliceStation/Extensions/MQTTServer.cs
View file @
8de6fa57
...
...
@@ -10,6 +10,7 @@ using System;
using
System.Text
;
using
JunmpPoliceStation.Controllers
;
using
Microsoft.Extensions.DependencyInjection
;
using
Microsoft.Extensions.Logging
;
using
Newtonsoft.Json.Linq
;
namespace
JunmpPoliceStation.Extensions
...
...
@@ -20,6 +21,7 @@ namespace JunmpPoliceStation.Extensions
//public JunmppolicesqlContext _dbContext;
private
IConfiguration
_configuration
;
public
MQTTServer
(
IConfiguration
configuration
)
{
_configuration
=
configuration
;
...
...
@@ -236,6 +238,7 @@ namespace JunmpPoliceStation.Extensions
{
//通道回复
message
.
Token
=
jObj
[
"token"
]?.
Value
<
string
>();
dbContext
?.
ApiMqttMessages
.
Add
(
message
);
break
;
}
case
"ShelfGetData"
:
...
...
@@ -252,21 +255,23 @@ namespace JunmpPoliceStation.Extensions
{
//获取单据信息
var
warehouseId
=
jObj
[
"warehouseId"
]?.
Value
<
string
>();
var
shelfController
=
scope
.
ServiceProvider
.
GetService
<
ShelfController
>();
await
shelfController
?.
GetOpenOrderInvInfo
(
JObject
.
Parse
(
@
$"
{{
""
warehouseId
""
:
""
{
warehouseId
}
""
,
""
pushClientId
""
:
""
{
e
.
ClientId
}
""
}}
"
))!;
break
;
}
}
}
dbContext
?.
SaveChanges
();
}
else
{
//保存文件
var
str
=
message
.
CreateTime
+
"|"
+
message
.
DeviceNo
+
"|"
+
message
.
Topic
+
"|"
+
message
.
Payload
;
var
logger
=
scope
.
ServiceProvider
.
GetService
<
ILogger
<
MQTTServer
>>();
logger
.
LogInformation
(
str
);
}
dbContext
?.
ApiMqttMessages
.
Add
(
message
);
dbContext
?.
SaveChanges
();
}
//Console.WriteLine($"客户端[{e.ClientId}]>> 主题:{e.ApplicationMessage.Topic} 负荷:{Encoding.UTF8.GetString(e.ApplicationMessage.Payload)} Qos:{e.ApplicationMessage.QualityOfServiceLevel} 保留:{e.ApplicationMessage.Retain}");
}
...
...
JunmpPoliceStation/nlog.config.xml
View file @
8de6fa57
...
...
@@ -10,12 +10,14 @@
<target
xsi:type=
"File"
name=
"Debug"
fileName=
"Nlogs/Debug/nlog-Debug-${shortdate}.log"
layout=
"${longdate}|${logger}|${uppercase:${level}}|${message} ${exception}"
/>
<target
xsi:type=
"File"
name=
"Error"
fileName=
"Nlogs/Error/nlog-Error-${shortdate}.log"
layout=
"${longdate}|${logger}|${uppercase:${level}}|${message} ${exception}"
/>
<target
xsi:type=
"File"
name=
"Information"
fileName=
"Nlogs/Information/nlog-Information-${shortdate}.log"
layout=
"${longdate}|${logger}|${uppercase:${level}}|${message} ${exception}"
/>
<target
xsi:type=
"File"
name=
"MQTT"
fileName=
"Nlogs/MQTT/${shortdate}.log"
layout=
"${longdate}|${logger}|${uppercase:${level}}|${message} ${exception}"
/>
<target
xsi:type=
"Null"
name=
"blackhole"
/>
</targets>
<rules>
<!--<logger name="*" minlevel="Trace" writeTo="file" />-->
<!--<logger name="*" minlevel="Information" maxlevel="Information" writeTo="Information" />-->
<logger
name=
"JunmpPoliceStation.Extensions.MQTTServer"
minlevel=
"Information"
maxlevel=
"Information"
writeTo=
"MQTT"
/>
<logger
name=
"JunmpPoliceStation.*"
minlevel=
"Debug"
maxlevel=
"Debug"
writeTo=
"Debug"
/>
<logger
name=
"*"
minlevel=
"Error"
maxlevel=
"Error"
writeTo=
"Error"
/>
<!--日志级别:Trace -》Debug-》 Information -》Warning-》 Error-》 Critical-->
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论