Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
DataCenter_Core2.1_20190520
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
DataCenter_Core2.1_20190520
Commits
ac7a95ce
Commit
ac7a95ce
authored
Jun 07, 2021
by
guanzhenshan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加获取库龄接口
parent
f472f299
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
97 additions
and
0 deletions
+97
-0
requestSkuAges.cs
Bailun.DC.Models/Api/requestSkuAges.cs
+16
-0
InventoryServices.cs
Bailun.DC.Services/InventoryServices.cs
+25
-0
ApiController.cs
Bailun.DC.Web/Controllers/ApiController.cs
+56
-0
No files found.
Bailun.DC.Models/Api/requestSkuAges.cs
0 → 100644
View file @
ac7a95ce
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Bailun.DC.Models.Api
{
/// <summary>
/// 请求获取sku+仓库的库龄数据
/// </summary>
public
class
requestSkuAges
{
public
List
<
string
>
skus
{
get
;
set
;
}
public
string
warehouse_code
{
get
;
set
;
}
}
}
Bailun.DC.Services/InventoryServices.cs
View file @
ac7a95ce
...
...
@@ -1239,6 +1239,31 @@ namespace Bailun.DC.Services
}
}
/// <summary>
/// 根据sku+仓库获取库龄信息
/// </summary>
/// <param name="skus">sku集合</param>
/// <param name="warehousecode">仓库编码</param>
/// <returns></returns>
public
List
<
dc_mid_stock_age
>
GetSkuStockAge
(
List
<
string
>
skus
,
string
warehousecode
)
{
var
sql
=
$"select * from dc_mid_stock_age where warehouse_code='
{
warehousecode
}
' and bailun_sku in ('
{
string
.
Join
(
"','"
,
skus
)}
')"
;
using
(
var
cn
=
new
MySqlConnection
(
Common
.
GlobalConfig
.
ConnectionString_read
))
{
if
(
cn
.
State
==
ConnectionState
.
Closed
)
{
cn
.
Open
();
}
var
list
=
cn
.
Query
<
dc_mid_stock_age
>(
sql
).
AsList
();
return
list
;
}
}
#
endregion
#
region
进销存
...
...
Bailun.DC.Web/Controllers/ApiController.cs
View file @
ac7a95ce
...
...
@@ -2,6 +2,7 @@
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Threading.Tasks
;
using
Bailun.DC.Models.Api
;
using
Bailun.DC.Models.Orders
;
using
Microsoft.AspNetCore.Hosting
;
using
Microsoft.AspNetCore.Http
;
...
...
@@ -1073,6 +1074,61 @@ namespace Bailun.DC.Web.Controllers
}
/// <summary>
/// 获取同仓库的sku库龄数据
/// </summary>
/// <param name="sku"></param>
/// <param name="warehouse"></param>
/// <returns></returns>
[
HttpPost
]
public
JsonResult
SkuAges
([
FromBody
]
requestSkuAges
m
)
{
if
(
m
.
skus
.
Count
==
0
)
{
return
Json
(
new
{
success
=
false
,
msg
=
"sku不能为空"
});
}
if
(
string
.
IsNullOrEmpty
(
m
.
warehouse_code
))
{
return
Json
(
new
{
success
=
false
,
msg
=
"仓库编码不能为空"
});
}
try
{
var
obj
=
new
Services
.
InventoryServices
().
GetSkuStockAge
(
m
.
skus
,
m
.
warehouse_code
);
return
Json
(
new
{
success
=
true
,
msg
=
""
,
data
=
obj
.
GroupBy
(
a
=>
a
.
bailun_sku
).
Select
(
b
=>
new
{
bailun_sku
=
b
.
Key
,
list
=
b
.
Select
(
o
=>
new
{
o
.
bailun_sku
,
o
.
warehouse_code
,
o
.
stock
,
o
.
createtime
,
o
.
basisdata_json
})
})
});
}
catch
(
Exception
ex
)
{
return
Json
(
new
{
success
=
false
,
msg
=
ex
.
Message
});
}
}
//public JsonResult TestInsertBuyer()
...
...
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