Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
TakeStock
Overview
Overview
Details
Activity
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
pengjinyang
TakeStock
Commits
899a98ef
Commit
899a98ef
authored
Jul 12, 2019
by
pengjinyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交
parent
dd46c2a8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
5 deletions
+23
-5
TakeStockService.cs
Service/TakeStock/TakeStockService.cs
+7
-0
Program.cs
TakeStock.Subscriber/Program.cs
+16
-5
No files found.
Service/TakeStock/TakeStockService.cs
View file @
899a98ef
...
...
@@ -49,6 +49,13 @@ namespace Service.TakeStock
{
return
await
Task
.
Run
(()
=>
{
string
[]
skus
=
orders
.
Select
(
o
=>
o
.
Sku
).
ToArray
();
if
(
schedule
.
IsAutomation
)
{
int
count
=
_orderRepository
.
Count
(
o
=>
o
.
WarehouseCode
.
Equals
(
schedule
.
WarehouseCode
)
&&
skus
.
Contains
(
o
.
Sku
)
&&
o
.
State
!=
TSOrderState
.
取消
&&
o
.
CreationTime
<
DateTime
.
UtcNow
.
AddHours
(
8
).
AddDays
(
2
));
if
(
count
>
0
)
return
false
;
}
int
scheduleId
=
_scheduleRepository
.
CreateOrder
(
schedule
,
orders
);
if
(
scheduleId
>
0
)
BackgroundJob
.
Enqueue
(()
=>
ReTry
(
scheduleId
));
...
...
TakeStock.Subscriber/Program.cs
View file @
899a98ef
using
EasyNetQ
;
using
EasyNetQ.Topology
;
using
Message.TakeStock
;
using
Microsoft.Extensions.DependencyInjection
;
using
Newtonsoft.Json
;
...
...
@@ -6,6 +7,7 @@ using System;
using
System.Collections.Generic
;
using
System.Net.Http
;
using
System.Net.Http.Headers
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
TakeStock.Subscriber
...
...
@@ -17,8 +19,8 @@ namespace TakeStock.Subscriber
try
{
Init
();
//111.230.164.154
var
connStr
=
"host=
owms-rabbitmq:5672;username=bailun;password=1234abcd
;prefetchcount=2;publisherConfirms=true;timeout=10"
;
//111.230.164.154
owms-rabbitmq
var
connStr
=
"host=
118.126.94.233:5672;username=wms;password=bailun
;prefetchcount=2;publisherConfirms=true;timeout=10"
;
var
bus
=
RabbitHutch
.
CreateBus
(
connStr
);
bus
.
SubscribeAsync
<
CreateTakeStockMessage
>(
"Create"
,
async
message
=>
await
Exec
(
message
)
.
ContinueWith
(
task
=>
...
...
@@ -32,14 +34,23 @@ namespace TakeStock.Subscriber
throw
new
EasyNetQException
(
"Message processing exception - look in the default error queue (broker)"
);
}
}));
//CreateTakeStockMessage msg = new CreateTakeStockMessage
//{
// WarehouseCode = "BLTEST",
// Sku = "TEST000
1
"
// Sku = "TEST000
4
"
//};
//bus.Publish(msg);
//MessageProperties messageProperties = new MessageProperties();
//messageProperties.Type = "TakeStock.Create";
//var advancedBus = bus.Advanced;
//var queue = advancedBus.QueueDeclare("TakeStock_Create");
//var exchange = advancedBus.ExchangeDeclare("TakeStock", ExchangeType.Topic);
//var binding = advancedBus.Bind(exchange, queue, "TakeStock_Create");
//byte[] message = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(msg));
//advancedBus.Publish(exchange, "TakeStock_Create", false, messageProperties, message);
}
catch
(
Exception
ex
)
{
...
...
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