Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
data-center-auto
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
bltdc
data-center-auto
Commits
39c85f48
Commit
39c85f48
authored
May 14, 2020
by
泽锋 李
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增下首单推送接口
parent
2a3994a6
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
123 additions
and
0 deletions
+123
-0
dc_auto_first_order_sku_dao.cs
AutoTurnOver.DB/dc_auto_first_order_sku_dao.cs
+53
-0
dc_auto_first_order_sku.cs
AutoTurnOver.Models/dc_auto_first_order_sku.cs
+32
-0
FirstOrderService.cs
AutoTurnOver.Services/FirstOrderService.cs
+16
-0
ApiController.cs
AutoTurnOver/Controllers/ApiController.cs
+22
-0
No files found.
AutoTurnOver.DB/dc_auto_first_order_sku_dao.cs
0 → 100644
View file @
39c85f48
using
AutoTurnOver.Models
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
using
Dapper
;
namespace
AutoTurnOver.DB
{
/// <summary>
/// 下首单
/// </summary>
public
class
dc_auto_first_order_sku_dao
:
connectionHelper
{
public
static
void
Add
(
dc_auto_first_order_sku_input_dto
input_data
)
{
var
now
=
DateTime
.
Now
;
if
(
input_data
.
detailed
==
null
||
input_data
.
detailed
.
Count
<=
0
)
{
throw
new
Exception
(
"sku必填"
);
}
if
(
input_data
.
sendtype
<=
0
)
{
throw
new
Exception
(
"运输方式必填"
);
}
if
(
string
.
IsNullOrWhiteSpace
(
input_data
.
warehouse_code
))
{
throw
new
Exception
(
"仓库编码必填"
);
}
using
(
var
conn
=
_connection
)
{
conn
.
Open
();
using
(
var
t
=
conn
.
BeginTransaction
())
{
foreach
(
var
item
in
input_data
.
detailed
)
{
var
old_data
=
conn
.
QuerySingleOrDefault
<
dc_auto_first_order_sku
>(
" select * from dc_auto_first_order_sku where bailun_sku=@bailun_sku and warehouse_code=@warehouse_code "
,
new
{
bailun_sku
=
item
,
warehouse_code
=
input_data
.
warehouse_code
});
if
(
old_data
!=
null
)
throw
new
Exception
(
$" sku
{
item
}
, 仓库编码 :
{
input_data
.
warehouse_code
}
已存在 "
);
conn
.
Insert
(
new
dc_auto_first_order_sku
{
bailun_sku
=
item
,
push_date
=
now
,
warehouse_code
=
input_data
.
warehouse_code
,
sendtype
=
input_data
.
sendtype
},
t
);
}
t
.
Commit
();
}
}
}
}
}
AutoTurnOver.Models/dc_auto_first_order_sku.cs
0 → 100644
View file @
39c85f48
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
AutoTurnOver.Models
{
/// <summary>
/// 下首单的sku
/// </summary>
public
class
dc_auto_first_order_sku
{
public
int
id
{
get
;
set
;
}
public
string
bailun_sku
{
get
;
set
;
}
public
DateTime
push_date
{
get
;
set
;
}
public
string
warehouse_code
{
get
;
set
;
}
/// <summary>
/// 运输方式 1=陆运 2=海运 3=空运 4=铁路运输
/// </summary>
public
int
sendtype
{
get
;
set
;
}
public
DateTime
?
order_time
{
get
;
set
;
}
}
public
class
dc_auto_first_order_sku_input_dto
{
public
string
warehouse_code
{
get
;
set
;
}
public
int
sendtype
{
get
;
set
;
}
public
List
<
string
>
detailed
{
get
;
set
;
}
}
}
AutoTurnOver.Services/FirstOrderService.cs
0 → 100644
View file @
39c85f48
using
AutoTurnOver.DB
;
using
AutoTurnOver.Models
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
AutoTurnOver.Services
{
public
class
FirstOrderService
{
public
void
Add
(
dc_auto_first_order_sku_input_dto
input_data
)
{
dc_auto_first_order_sku_dao
.
Add
(
input_data
);
}
}
}
AutoTurnOver/Controllers/ApiController.cs
View file @
39c85f48
...
@@ -81,5 +81,26 @@ namespace AutoTurnOver.Controllers
...
@@ -81,5 +81,26 @@ namespace AutoTurnOver.Controllers
});
});
}
}
}
}
[
HttpPost
(
"FirstOrderSkuAdd"
)]
public
JsonResult
FirstOrderSkuAdd
([
FromBody
]
dc_auto_first_order_sku_input_dto
inputData
)
{
try
{
new
FirstOrderService
().
Add
(
inputData
);
return
new
JsonResult
(
new
{
success
=
true
,
});
}
catch
(
Exception
ex
)
{
return
new
JsonResult
(
new
{
message
=
ex
.
Message
,
success
=
false
,
});
}
}
}
}
}
}
\ No newline at end of file
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