Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Property
Project
Project
Details
Activity
Releases
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
liudong1993
Property
Commits
809a0469
Commit
809a0469
authored
Jul 13, 2020
by
吴春
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://gitlab.oytour.com/liudong1993/property
parents
bb456408
8e443eba
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
195 additions
and
2 deletions
+195
-2
QRCodeHelper.cs
Property.Common/Plugin/QRCodeHelper.cs
+45
-1
Property.Common.csproj
Property.Common/Property.Common.csproj
+1
-0
SuppliesModule.cs
Property.Modele.FixedAssets/SuppliesModule.cs
+105
-1
SuppliesController.cs
Property.WebApi/Controllers/Property/SuppliesController.cs
+42
-0
Startup.cs
Property.WebApi/Startup.cs
+2
-0
No files found.
Property.Common/Plugin/QRCodeHelper.cs
View file @
809a0469
using
Newtonsoft.Json
;
using
BarcodeLib
;
using
Newtonsoft.Json
;
using
Newtonsoft.Json.Converters
;
using
Newtonsoft.Json.Linq
;
using
QRCoder
;
...
...
@@ -103,5 +104,48 @@ namespace REBORN.Common.Plugin
}
#
endregion
#
region
条形码生成
/// <summary>
/// 批量生成二维码图片
/// </summary>
public
static
bool
CreateQRCode
(
string
path
,
int
imgSize
,
string
logoPath
,
string
savePath
,
System
.
Drawing
.
Imaging
.
ImageFormat
imageFormat
)
{
try
{
//生成图片
Bitmap
image
=
GetPTQRCode
(
path
,
imgSize
);
//保存图片
SaveImg
(
savePath
,
image
,
imageFormat
);
return
true
;
}
catch
(
Exception
ex
)
{
LogHelper
.
Write
(
ex
,
"Create_CodeImages"
);
return
false
;
}
}
public
static
void
CreateTQRCode
(
string
message
,
string
path
,
System
.
Drawing
.
Imaging
.
ImageFormat
imageFormat
,
int
width
=
500
,
int
height
=
100
)
{
Barcode
b
=
new
Barcode
();
Image
img
=
b
.
Encode
(
TYPE
.
CODE128
,
message
,
Color
.
Black
,
Color
.
White
,
width
,
height
);
MemoryStream
stream
=
new
MemoryStream
();
img
.
Save
(
stream
,
imageFormat
);
Bitmap
imgData
=
(
Bitmap
)(
img
);
string
DirectoryPath
=
Path
.
GetDirectoryName
(
path
);
//保存图片到目录
if
(!
Directory
.
Exists
(
DirectoryPath
))
{
//当前目录不存在,则创建
Directory
.
CreateDirectory
(
DirectoryPath
);
}
//文件名称
imgData
.
Save
(
path
,
imageFormat
);
}
#
endregion
}
}
Property.Common/Property.Common.csproj
View file @
809a0469
...
...
@@ -5,6 +5,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="BarcodeLib" Version="2.2.5" />
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.2.2" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="3.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.0.1" />
...
...
Property.Modele.FixedAssets/SuppliesModule.cs
View file @
809a0469
...
...
@@ -9,6 +9,7 @@ using System.Collections.Generic;
using
System.Linq
;
using
Newtonsoft.Json
;
using
REBORN.Commom.Plugin
;
using
System.IO
;
namespace
Property.Module.FixedAssets
{
...
...
@@ -1961,6 +1962,109 @@ namespace Property.Module.FixedAssets
};
}
/// <summary>
/// 获取入库单的标签
/// </summary>
/// <param name="procurementId"></param>
/// <param name="StockInId"></param>
/// <param name="userInfo"></param>
/// <returns></returns>
public
object
GetProcurementStockInLableList
(
int
procurementId
,
int
StockInId
,
UserInfo
userInfo
)
{
List
<
object
>
RObj
=
new
List
<
object
>();
var
pmodel
=
procurementRepository
.
GetEntity
(
procurementId
);
int
eRPGroupId
=
userInfo
.
RB_Group_id
;
var
siList
=
supplies_StockInRepository
.
GetList
(
new
RB_Supplies_StockIn_Extend
()
{
RB_Group_Id
=
eRPGroupId
,
ProcurementId
=
procurementId
,
Id
=
StockInId
});
if
(
siList
.
Any
())
{
string
siIds
=
string
.
Join
(
","
,
siList
.
Where
(
x
=>
x
.
StockInState
==
StockInStatusEnum
.
StockIn
).
Select
(
x
=>
x
.
Id
));
var
sidList
=
supplies_StockInDetailRepository
.
GetList
(
new
RB_Supplies_StockInDetail_Extend
()
{
RB_Group_Id
=
eRPGroupId
,
StockInIdStr
=
siIds
});
List
<
RB_Supplies_Material_Extend
>
materialList
=
new
List
<
RB_Supplies_Material_Extend
>();
if
(
sidList
.
Any
())
{
string
matIds
=
string
.
Join
(
","
,
sidList
.
Select
(
x
=>
x
.
SuppliesId
).
Distinct
());
materialList
=
supplies_MaterialRepository
.
GetList
(
new
RB_Supplies_Material_Extend
()
{
RB_Group_Id
=
eRPGroupId
,
SuppliesIdStr
=
matIds
});
}
foreach
(
var
item
in
sidList
)
{
var
siModel
=
siList
.
Where
(
x
=>
x
.
Id
==
item
.
StockInId
).
FirstOrDefault
();
var
materialModel
=
materialList
.
Where
(
x
=>
x
.
Id
==
item
.
SuppliesId
).
FirstOrDefault
();
if
(
materialModel
==
null
)
{
continue
;
}
List
<
string
>
spList
=
new
List
<
string
>();
if
(!
string
.
IsNullOrEmpty
(
materialModel
.
SpecificationName
)
&&
materialModel
.
SpecificationName
!=
"[]"
)
{
spList
=
JsonConvert
.
DeserializeObject
<
List
<
string
>>(
materialModel
.
SpecificationName
);
}
string
QRCode
=
"D-"
+
(
siModel
.
WarehouseId
??
0
)
+
"-"
+
procurementId
+
"-"
+
(
item
.
SuppliesId
??
0
)
+
"-"
+
(
item
.
StockInId
??
0
);
string
TQRCode
=
"DA"
+
(
siModel
.
WarehouseId
??
0
)
+
"A"
+
procurementId
+
"A"
+
(
item
.
SuppliesId
??
0
)
+
"A"
+
(
item
.
StockInId
??
0
);
#
region
生成二维码
+
条形码
string
QRName
=
"QR-"
+
DateTime
.
Now
.
ToString
(
"yyyyMMdd"
)
+
"-"
+
procurementId
+
"-"
+
(
item
.
SuppliesId
??
0
)
+
".jpg"
;
string
TQRName
=
"TQR-"
+
DateTime
.
Now
.
ToString
(
"yyyyMMdd"
)
+
"-"
+
procurementId
+
"-"
+
(
item
.
SuppliesId
??
0
)
+
".jpg"
;
string
basepath
=
AppContext
.
BaseDirectory
;
string
QRPath
=
basepath
+
"\\upfile\\qrcode\\"
+
QRName
;
string
QRImage
=
"/upfile/qrcode/"
+
QRName
;
string
TQRPath
=
basepath
+
"\\upfile\\qrcode\\"
+
TQRName
;
string
TQRImage
=
"/upfile/qrcode/"
+
TQRName
;
//验证文件是否存在, 存在的话就不用生成了
if
(!
File
.
Exists
(
QRPath
))
{
QRCodeHelper
.
CreateQRCode
(
QRCode
,
5
,
""
,
QRPath
,
System
.
Drawing
.
Imaging
.
ImageFormat
.
Jpeg
);
}
if
(!
File
.
Exists
(
TQRPath
))
{
int
width
=
340
;
if
(
TQRCode
.
Length
>
30
)
{
width
=
370
;
}
QRCodeHelper
.
CreateTQRCode
(
TQRCode
,
TQRPath
,
System
.
Drawing
.
Imaging
.
ImageFormat
.
Jpeg
,
width
,
50
);
}
#
endregion
var
empModel
=
CacheManager
.
User
.
UserReidsCache
.
GetEmployee
(
item
.
CreateBy
);
for
(
int
i
=
0
;
i
<
(
item
.
Number
??
0
);
i
++)
{
RObj
.
Add
(
new
{
materialModel
.
GoodsId
,
GoodsName
=
materialModel
.
Name
,
SpecificationList
=
spList
,
CreateDate
=
item
.
CreateDate
.
HasValue
?
item
.
CreateDate
.
Value
.
ToString
(
"yyyy-MM-dd"
)
:
""
,
EmName
=
empModel
?.
EmName
??
""
,
siModel
.
WareHouseName
,
CostMoney
=
item
.
UnitPrice
,
QRImage
,
TQRImage
,
TQRCode
});
}
}
}
return
RObj
;
}
/// <summary>
/// 获取采购入库批次列表
/// </summary>
/// <param name="procurementId"></param>
/// <param name="userInfo"></param>
/// <returns></returns>
public
object
GetProcurementSotckInBatchList
(
int
procurementId
,
UserInfo
userInfo
)
{
List
<
object
>
RObj
=
new
List
<
object
>();
var
siList
=
supplies_StockInRepository
.
GetList
(
new
RB_Supplies_StockIn_Extend
()
{
RB_Group_Id
=
userInfo
.
RB_Group_id
,
ProcurementId
=
procurementId
});
siList
=
siList
.
Where
(
x
=>
x
.
StockInState
==
StockInStatusEnum
.
StockIn
).
ToList
();
return
siList
.
Select
(
x
=>
new
{
StockInId
=
x
.
Id
,
x
.
StockInNum
});
}
#
endregion
}
}
Property.WebApi/Controllers/Property/SuppliesController.cs
View file @
809a0469
...
...
@@ -1506,6 +1506,48 @@ namespace Property.WebApi.Controllers.User
});
}
/// <summary>
/// 获取采购单 入库批次
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetProcurementSotckInBatchList
()
{
var
requestParm
=
GetRequestParm
();
UserInfo
userInfo
=
CacheManager
.
User
.
UserReidsCache
.
GetUserLoginInfo
(
requestParm
.
uid
);
JObject
parms
=
JObject
.
Parse
(
requestParm
.
msg
.
ToString
());
int
ProcurementId
=
parms
.
GetInt
(
"ProcurementId"
,
0
);
if
(
ProcurementId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递参数"
);
}
var
list
=
suppliesModule
.
GetProcurementSotckInBatchList
(
ProcurementId
,
userInfo
);
return
ApiResult
.
Success
(
""
,
list
);
}
/// <summary>
/// 获取采购入库 的标签
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetProcurementStockInLableList
()
{
var
requestParm
=
GetRequestParm
();
UserInfo
userInfo
=
CacheManager
.
User
.
UserReidsCache
.
GetUserLoginInfo
(
requestParm
.
uid
);
JObject
parms
=
JObject
.
Parse
(
requestParm
.
msg
.
ToString
());
int
ProcurementId
=
parms
.
GetInt
(
"ProcurementId"
,
0
);
int
StockInId
=
parms
.
GetInt
(
"StockInId"
,
0
);
if
(
ProcurementId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递参数"
);
}
var
list
=
suppliesModule
.
GetProcurementStockInLableList
(
ProcurementId
,
StockInId
,
userInfo
);
return
ApiResult
.
Success
(
""
,
list
);
}
#
endregion
#
region
根据二维码标识
获取商品信息
...
...
Property.WebApi/Startup.cs
View file @
809a0469
...
...
@@ -53,6 +53,8 @@ namespace Property.WebApi
"http://www.test.com:8080"
,
"http://www.test.com:8081"
,
"http://www.test.com:8082"
,
"http://localhost:8080"
,
"http://localhost:8081"
,
"http://testzcyx.oytour.com:8080"
,
"http://testzcyx.oytour.com:8081"
,
"http://testzcyx.oytour.com"
,
...
...
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