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
4fbd0a71
Commit
4fbd0a71
authored
Sep 24, 2020
by
zhaojinzhan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
发起盘点接口修改
parent
c00ab9c3
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
8 deletions
+31
-8
ReturnPlanDto.cs
Domain/Dto/ReturnPlanDto.cs
+13
-0
ITakeStockService.cs
IService/TakeStock/ITakeStockService.cs
+1
-1
TakeStockService.cs
Service/TakeStock/TakeStockService.cs
+14
-5
TakeStockController.cs
TakeStock.API/Controllers/TakeStockController.cs
+2
-1
TakeStockAppService.cs
TakeStock.Application/TakeStock/TakeStockAppService.cs
+1
-1
No files found.
Domain/Dto/ReturnPlanDto.cs
0 → 100644
View file @
4fbd0a71
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Domain.TakeStock
{
public
class
ReturnPlanDto
{
public
bool
IsSuccess
{
get
;
set
;
}
public
string
Message
{
get
;
set
;
}
}
}
IService/TakeStock/ITakeStockService.cs
View file @
4fbd0a71
...
...
@@ -13,7 +13,7 @@ namespace IService.TakeStock
/// </summary>
/// <param name="record"></param>
/// <returns></returns>
Task
<
bool
>
CreateTakeStockOrderAsync
(
TakeStockSchedule
record
,
List
<
TakeStockOrder
>
orders
);
Task
<
ReturnPlanDto
>
CreateTakeStockOrderAsync
(
TakeStockSchedule
record
,
List
<
TakeStockOrder
>
orders
);
Task
<
bool
>
ReTry
(
int
scheduleId
);
...
...
Service/TakeStock/TakeStockService.cs
View file @
4fbd0a71
...
...
@@ -45,21 +45,30 @@ namespace Service.TakeStock
/// </summary>
/// <param name="schedule"></param>
/// <returns></returns>
public
async
Task
<
bool
>
CreateTakeStockOrderAsync
(
TakeStockSchedule
schedule
,
List
<
TakeStockOrder
>
orders
)
public
async
Task
<
ReturnPlanDto
>
CreateTakeStockOrderAsync
(
TakeStockSchedule
schedule
,
List
<
TakeStockOrder
>
orders
)
{
return
await
Task
.
Run
(()
=>
return
await
Task
.
Factory
.
StartNew
<
ReturnPlanDto
>
(()
=>
{
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
.
State
!=
TSOrderState
.
完成
);
//&& o.CreationTime > DateTime.Now.AddDays(-1)
if
(
count
>
0
)
return
false
;
Expression
<
Func
<
TakeStockOrder
,
bool
>>
predicate
=
o
=>
o
.
WarehouseCode
.
Equals
(
schedule
.
WarehouseCode
)
&&
skus
.
Contains
(
o
.
Sku
)
&&
o
.
State
!=
TSOrderState
.
取消
&&
o
.
State
!=
TSOrderState
.
完成
;
int
count
=
_orderRepository
.
Count
(
predicate
);
//&& o.CreationTime > DateTime.Now.AddDays(-1)
if
(
count
>
0
)
{
// 如果发现有存在的记录再查询这些记录返回单号
var
existIds
=
_orderRepository
.
GetAllList
(
predicate
).
Select
(
t
=>
t
.
ScheduleId
).
ToArray
();
var
exisPlanCodes
=
_scheduleRepository
.
GetAllList
(
t
=>
existIds
.
Contains
(
t
.
Id
)).
Select
(
t
=>
t
.
Code
).
ToArray
();
return
new
ReturnPlanDto
()
{
IsSuccess
=
false
,
Message
=
$"存在盘点计划单号未处理:
{
string
.
Join
(
','
,
exisPlanCodes
)}
"
};
}
}
int
scheduleId
=
_scheduleRepository
.
CreateOrder
(
schedule
,
orders
);
if
(
scheduleId
>
0
)
BackgroundJob
.
Enqueue
(()
=>
ReTry
(
scheduleId
));
return
scheduleId
>
0
;
return
new
ReturnPlanDto
()
{
IsSuccess
=
true
,
Message
=
""
};
});
}
...
...
TakeStock.API/Controllers/TakeStockController.cs
View file @
4fbd0a71
...
...
@@ -2,6 +2,7 @@
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Threading.Tasks
;
using
Domain.TakeStock
;
using
IService.TakeStock
;
using
Microsoft.AspNetCore.Authorization
;
using
Microsoft.AspNetCore.Http
;
...
...
@@ -45,7 +46,7 @@ namespace TakeStock.API.Controllers
//}
[
HttpPost
]
public
async
Task
<
bool
>
CreateTakeStockSchedule
([
FromBody
]
ScheduleInputDto
record
)
public
async
Task
<
ReturnPlanDto
>
CreateTakeStockSchedule
([
FromBody
]
ScheduleInputDto
record
)
{
var
result
=
await
takeStockAppService
.
CreateTakeStockSchedule
(
record
);
return
result
;
...
...
TakeStock.Application/TakeStock/TakeStockAppService.cs
View file @
4fbd0a71
...
...
@@ -24,7 +24,7 @@ namespace TakeStock.Application.TakeStock
this
.
takeStockService
=
takeStockService
;
}
public
async
Task
<
bool
>
CreateTakeStockSchedule
(
ScheduleInputDto
input
)
public
async
Task
<
ReturnPlanDto
>
CreateTakeStockSchedule
(
ScheduleInputDto
input
)
{
var
str
=
JsonConvert
.
SerializeObject
(
input
);
TakeStockSchedule
schedule
=
JsonConvert
.
DeserializeObject
<
TakeStockSchedule
>(
str
);
...
...
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