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
b6b616f2
Commit
b6b616f2
authored
Jul 30, 2020
by
吴春
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交diam
parent
f4676dde
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
1293 additions
and
97 deletions
+1293
-97
RB_WarehouseOut_Goods.cs
Property.Model/Entity/Mall/RB_WarehouseOut_Goods.cs
+14
-0
RB_Supplies_ReportLossRecord.cs
...rty.Model/Entity/Supplies/RB_Supplies_ReportLossRecord.cs
+118
-0
RB_Supplies_ReportLossRecordDetail.cs
...del/Entity/Supplies/RB_Supplies_ReportLossRecordDetail.cs
+133
-0
RB_Supplies_ReportLossRecordDetail_Extend.cs
...end/Supplies/RB_Supplies_ReportLossRecordDetail_Extend.cs
+29
-0
RB_Supplies_ReportLossRecord_Extend.cs
...el/Extend/Supplies/RB_Supplies_ReportLossRecord_Extend.cs
+21
-0
SuppliesModule.cs
Property.Modele.FixedAssets/SuppliesModule.cs
+505
-71
RB_Supplies_CheckRepository.cs
Property.Repository/Supplies/RB_Supplies_CheckRepository.cs
+4
-0
RB_Supplies_ReportLossRecordDetailRepository.cs
.../Supplies/RB_Supplies_ReportLossRecordDetailRepository.cs
+75
-0
RB_Supplies_ReportLossRecordRepository.cs
...sitory/Supplies/RB_Supplies_ReportLossRecordRepository.cs
+84
-0
WarehouseOutController.cs
Property.WebApi/Controllers/Mall/WarehouseOutController.cs
+27
-16
SuppliesController.cs
Property.WebApi/Controllers/Property/SuppliesController.cs
+283
-10
No files found.
Property.Model/Entity/Mall/RB_WarehouseOut_Goods.cs
View file @
b6b616f2
...
@@ -113,6 +113,20 @@ namespace Property.Model.Entity.Mall
...
@@ -113,6 +113,20 @@ namespace Property.Model.Entity.Mall
set
;
set
;
}
}
/// <summary>
/// 商品id
/// </summary>
public
int
NewGoodsId
{
get
;
set
;
}
/// <summary>
/// 出库商品名称
/// </summary>
public
string
NewGoodsName
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 规格(出库的规格名称)
/// 规格(出库的规格名称)
/// </summary>
/// </summary>
...
...
Property.Model/Entity/Supplies/RB_Supplies_ReportLossRecord.cs
0 → 100644
View file @
b6b616f2
using
System
;
using
REBORN.Common.AOP
;
using
REBORN.Common.Enum
;
using
REBORN.Common.Plugin
;
namespace
Property.Model.Entity
{
/// <summary>
/// 资产报损实体
/// </summary>
[
Serializable
]
[
DB
(
ConnectionName
=
"PropertyConnection"
)]
public
class
RB_Supplies_ReportLossRecord
{
/// <summary>
/// Id
/// </summary>
public
int
Id
{
get
;
set
;
}
/// <summary>
/// 盘点期数id
/// </summary>
public
int
?
CheckId
{
get
;
set
;
}
/// <summary>
/// 出库/入库id
/// </summary>
public
int
OutOrInId
{
get
;
set
;
}
/// <summary>
/// 报损/报溢 自动生成财务单据
/// </summary>
public
int
?
FinanceId
{
get
;
set
;
}
/// <summary>
/// 盘点状态
/// </summary>
public
PropertyCheckStatusEnum
?
CheckStatus
{
get
;
set
;
}
/// <summary>
/// 仓库id
/// </summary>
public
int
?
WarehouseId
{
get
;
set
;
}
/// <summary>
/// 备注
/// </summary>
public
string
Remark
{
get
;
set
;
}
/// <summary>
/// 状态 0正常 1删除
/// </summary>
public
int
?
Status
{
get
;
set
;
}
/// <summary>
/// 公司
/// </summary>
public
int
?
RB_Branch_Id
{
get
;
set
;
}
/// <summary>
/// 集团
/// </summary>
public
int
?
RB_Group_Id
{
get
;
set
;
}
/// <summary>
/// CreateBy
/// </summary>
public
int
?
CreateBy
{
get
;
set
;
}
/// <summary>
/// CreateDate
/// </summary>
public
DateTime
?
CreateDate
{
get
;
set
;
}
}
}
\ No newline at end of file
Property.Model/Entity/Supplies/RB_Supplies_ReportLossRecordDetail.cs
0 → 100644
View file @
b6b616f2
using
System
;
using
REBORN.Common.AOP
;
using
REBORN.Common.Enum
;
using
REBORN.Common.Plugin
;
namespace
Property.Model.Entity
{
/// <summary>
/// 耗材盘点报损记录详情
/// </summary>
[
Serializable
]
[
DB
(
ConnectionName
=
"PropertyConnection"
)]
public
class
RB_Supplies_ReportLossRecordDetail
{
/// <summary>
/// Id
/// </summary>
public
int
Id
{
get
;
set
;
}
/// <summary>
/// 盘点期数id
/// </summary>
public
int
?
CheckId
{
get
;
set
;
}
/// <summary>
/// 盘点商品对应的id
/// </summary>
public
int
CheckDetailId
{
get
;
set
;
}
/// <summary>
/// 报损记录id
/// </summary>
public
int
?
ReportLossRecordId
{
get
;
set
;
}
/// <summary>
/// 耗材id
/// </summary>
public
int
?
SuppliesId
{
get
;
set
;
}
/// <summary>
/// 报损数量
/// </summary>
public
int
?
ReportLossNum
{
get
;
set
;
}
/// <summary>
/// 报损价格
/// </summary>
public
decimal
?
ReportLossPrice
{
get
;
set
;
}
/// <summary>
/// 盘点状态
/// </summary>
public
PropertyCheckStatusEnum
?
CheckStatus
{
get
;
set
;
}
/// <summary>
/// 备注(报损 /报溢 需备注记录 出库单号/入库单号)
/// </summary>
public
string
Remark
{
get
;
set
;
}
/// <summary>
/// 状态 0正常 1删除
/// </summary>
public
int
?
Status
{
get
;
set
;
}
/// <summary>
/// 公司
/// </summary>
public
int
?
RB_Branch_Id
{
get
;
set
;
}
/// <summary>
/// 集团
/// </summary>
public
int
?
RB_Group_Id
{
get
;
set
;
}
/// <summary>
/// CreateBy
/// </summary>
public
int
?
CreateBy
{
get
;
set
;
}
/// <summary>
/// CreateDate
/// </summary>
public
DateTime
?
CreateDate
{
get
;
set
;
}
}
}
\ No newline at end of file
Property.Model/Extend/Supplies/RB_Supplies_ReportLossRecordDetail_Extend.cs
0 → 100644
View file @
b6b616f2
using
Property.Model.Entity
;
using
REBORN.Common.AOP
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Property.Model.Extend.Supplies
{
/// <summary>
/// 耗材盘点报损记录扩展表
/// </summary>
[
Serializable
]
[
DB
(
ConnectionName
=
"PropertyConnection"
)]
public
class
RB_Supplies_ReportLossRecordDetail_Extend
:
RB_Supplies_ReportLossRecordDetail
{
/// <summary>
/// 商品名称
/// </summary>
public
string
GoodsName
{
get
;
set
;
}
/// <summary>
/// 商品规格名称
/// </summary>
public
string
SpecificationName
{
get
;
set
;
}
}
}
Property.Model/Extend/Supplies/RB_Supplies_ReportLossRecord_Extend.cs
0 → 100644
View file @
b6b616f2
using
Property.Model.Entity
;
using
REBORN.Common.AOP
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Property.Model.Extend.Supplies
{
/// <summary>
/// 资产报损扩展体
/// </summary>
[
Serializable
]
[
DB
(
ConnectionName
=
"PropertyConnection"
)]
public
class
RB_Supplies_ReportLossRecord_Extend
:
RB_Supplies_ReportLossRecord
{
/// <summary>
/// 报损详情
/// </summary>
public
List
<
RB_Supplies_ReportLossRecordDetail_Extend
>
DetailList
{
get
;
set
;
}
}
}
Property.Modele.FixedAssets/SuppliesModule.cs
View file @
b6b616f2
...
@@ -10,6 +10,9 @@ using System.Linq;
...
@@ -10,6 +10,9 @@ using System.Linq;
using
Newtonsoft.Json
;
using
Newtonsoft.Json
;
using
REBORN.Commom.Plugin
;
using
REBORN.Commom.Plugin
;
using
System.IO
;
using
System.IO
;
using
Property.Repository.Supplies
;
using
Property.Model.Extend.Supplies
;
using
Newtonsoft.Json.Linq
;
namespace
Property.Module.FixedAssets
namespace
Property.Module.FixedAssets
{
{
...
@@ -77,6 +80,15 @@ namespace Property.Module.FixedAssets
...
@@ -77,6 +80,15 @@ namespace Property.Module.FixedAssets
/// </summary>
/// </summary>
private
readonly
RB_Supplies_CheckDetailRepository
supplies_CheckDetailRepository
=
new
RB_Supplies_CheckDetailRepository
();
private
readonly
RB_Supplies_CheckDetailRepository
supplies_CheckDetailRepository
=
new
RB_Supplies_CheckDetailRepository
();
/// <summary>
///盘点报损记录
/// </summary>
private
readonly
RB_Supplies_ReportLossRecordRepository
suppliesReportLossRecordRepository
=
new
RB_Supplies_ReportLossRecordRepository
();
/// <summary>
/// 盘点报损记录详情
/// </summary>
private
readonly
RB_Supplies_ReportLossRecordDetailRepository
suppliesReportLossRecordDetailRepository
=
new
RB_Supplies_ReportLossRecordDetailRepository
();
#
region
基础配置
#
region
基础配置
...
@@ -103,7 +115,8 @@ namespace Property.Module.FixedAssets
...
@@ -103,7 +115,8 @@ namespace Property.Module.FixedAssets
{
{
model
.
ImageList
.
Add
(
Config
.
GetFileUrl
(
img
));
model
.
ImageList
.
Add
(
Config
.
GetFileUrl
(
img
));
}
}
if
(
model
.
CategoryId
>
0
)
{
if
(
model
.
CategoryId
>
0
)
{
model
.
CategoryName
=
property_CategoryRepository
.
GetEntity
(
model
.
CategoryId
)?.
Name
??
""
;
model
.
CategoryName
=
property_CategoryRepository
.
GetEntity
(
model
.
CategoryId
)?.
Name
??
""
;
}
}
return
model
;
return
model
;
...
@@ -326,7 +339,8 @@ namespace Property.Module.FixedAssets
...
@@ -326,7 +339,8 @@ namespace Property.Module.FixedAssets
};
};
return
supplies_WareHouseRepository
.
Update
(
files
,
wheres
);
return
supplies_WareHouseRepository
.
Update
(
files
,
wheres
);
}
}
else
{
else
{
return
supplies_WareHouseRepository
.
Insert
(
demodel
)
>
0
;
return
supplies_WareHouseRepository
.
Insert
(
demodel
)
>
0
;
}
}
}
}
...
@@ -343,14 +357,17 @@ namespace Property.Module.FixedAssets
...
@@ -343,14 +357,17 @@ namespace Property.Module.FixedAssets
{
{
var
list
=
supplies_StockInRepository
.
GetPageList
(
pageIndex
,
pageSize
,
demodel
,
out
count
);
var
list
=
supplies_StockInRepository
.
GetPageList
(
pageIndex
,
pageSize
,
demodel
,
out
count
);
List
<
RB_Supplies_StockInDetail_Extend
>
sdList
=
new
List
<
RB_Supplies_StockInDetail_Extend
>();
List
<
RB_Supplies_StockInDetail_Extend
>
sdList
=
new
List
<
RB_Supplies_StockInDetail_Extend
>();
if
(
list
.
Any
())
{
if
(
list
.
Any
())
{
//查询出所有的耗材详细
//查询出所有的耗材详细
string
IdStr
=
string
.
Join
(
","
,
list
.
Select
(
x
=>
x
.
Id
).
Distinct
());
string
IdStr
=
string
.
Join
(
","
,
list
.
Select
(
x
=>
x
.
Id
).
Distinct
());
sdList
=
supplies_StockInDetailRepository
.
GetList
(
new
RB_Supplies_StockInDetail_Extend
()
{
RB_Group_Id
=
demodel
.
RB_Group_Id
,
StockInIdStr
=
IdStr
});
sdList
=
supplies_StockInDetailRepository
.
GetList
(
new
RB_Supplies_StockInDetail_Extend
()
{
RB_Group_Id
=
demodel
.
RB_Group_Id
,
StockInIdStr
=
IdStr
});
}
}
foreach
(
var
item
in
list
)
{
foreach
(
var
item
in
list
)
{
item
.
DetailList
=
sdList
.
Where
(
x
=>
x
.
StockInId
==
item
.
Id
).
ToList
();
item
.
DetailList
=
sdList
.
Where
(
x
=>
x
.
StockInId
==
item
.
Id
).
ToList
();
foreach
(
var
qitem
in
item
.
DetailList
)
{
foreach
(
var
qitem
in
item
.
DetailList
)
{
qitem
.
GoodsSpecificationList
=
new
List
<
string
>();
qitem
.
GoodsSpecificationList
=
new
List
<
string
>();
qitem
.
GoodsCategoryList
=
new
List
<
string
>();
qitem
.
GoodsCategoryList
=
new
List
<
string
>();
if
(!
string
.
IsNullOrEmpty
(
qitem
.
SpecificationName
))
if
(!
string
.
IsNullOrEmpty
(
qitem
.
SpecificationName
))
...
@@ -406,17 +423,20 @@ namespace Property.Module.FixedAssets
...
@@ -406,17 +423,20 @@ namespace Property.Module.FixedAssets
foreach
(
var
item
in
UpdateList
)
foreach
(
var
item
in
UpdateList
)
{
{
var
dmodel
=
demodel
.
DetailList
.
Where
(
x
=>
x
.
SuppliesId
==
item
.
SuppliesId
).
FirstOrDefault
();
var
dmodel
=
demodel
.
DetailList
.
Where
(
x
=>
x
.
SuppliesId
==
item
.
SuppliesId
).
FirstOrDefault
();
if
((
dmodel
.
Number
??
0
)
-
(
item
.
Number
??
0
)
<
0
)
{
if
((
dmodel
.
Number
??
0
)
-
(
item
.
Number
??
0
)
<
0
)
{
//新增库存表数据
//新增库存表数据
var
ilist
=
supplies_InventoryRepository
.
GetList
(
new
RB_Supplies_Inventory_Extend
()
{
RB_Group_Id
=
demodel
.
RB_Group_Id
,
WarehouseId
=
demodel
.
WarehouseId
,
SuppliesId
=
item
.
SuppliesId
});
var
ilist
=
supplies_InventoryRepository
.
GetList
(
new
RB_Supplies_Inventory_Extend
()
{
RB_Group_Id
=
demodel
.
RB_Group_Id
,
WarehouseId
=
demodel
.
WarehouseId
,
SuppliesId
=
item
.
SuppliesId
});
if
(
ilist
.
Any
())
if
(
ilist
.
Any
())
{
{
var
iModel
=
ilist
.
FirstOrDefault
();
var
iModel
=
ilist
.
FirstOrDefault
();
if
(
iModel
.
Number
<
(
item
.
Number
??
0
)
-
(
dmodel
.
Number
??
0
))
{
if
(
iModel
.
Number
<
(
item
.
Number
??
0
)
-
(
dmodel
.
Number
??
0
))
{
return
false
;
return
false
;
}
}
}
}
else
{
else
{
return
false
;
return
false
;
}
}
}
}
...
@@ -493,7 +513,8 @@ namespace Property.Module.FixedAssets
...
@@ -493,7 +513,8 @@ namespace Property.Module.FixedAssets
model
.
UpdateDate
=
demodel
.
UpdateDate
;
model
.
UpdateDate
=
demodel
.
UpdateDate
;
model
.
StockInState
=
StockInStatusEnum
.
StockIn
;
model
.
StockInState
=
StockInStatusEnum
.
StockIn
;
bool
flag
=
supplies_StockInRepository
.
Update
(
model
,
trans
);
bool
flag
=
supplies_StockInRepository
.
Update
(
model
,
trans
);
if
(
flag
)
{
if
(
flag
)
{
//更新明细
//更新明细
var
list
=
supplies_StockInDetailRepository
.
GetList
(
new
RB_Supplies_StockInDetail_Extend
()
{
RB_Group_Id
=
demodel
.
RB_Group_Id
,
StockInId
=
demodel
.
Id
});
var
list
=
supplies_StockInDetailRepository
.
GetList
(
new
RB_Supplies_StockInDetail_Extend
()
{
RB_Group_Id
=
demodel
.
RB_Group_Id
,
StockInId
=
demodel
.
Id
});
...
@@ -503,7 +524,8 @@ namespace Property.Module.FixedAssets
...
@@ -503,7 +524,8 @@ namespace Property.Module.FixedAssets
var
UpdateList
=
list
.
Where
(
x
=>
demodel
.
DetailList
.
Select
(
y
=>
y
.
SuppliesId
).
Contains
(
x
.
SuppliesId
)).
ToList
();
var
UpdateList
=
list
.
Where
(
x
=>
demodel
.
DetailList
.
Select
(
y
=>
y
.
SuppliesId
).
Contains
(
x
.
SuppliesId
)).
ToList
();
//删除
//删除
var
DelList
=
list
.
Where
(
x
=>
!
demodel
.
DetailList
.
Select
(
y
=>
y
.
SuppliesId
).
Contains
(
x
.
SuppliesId
)).
ToList
();
var
DelList
=
list
.
Where
(
x
=>
!
demodel
.
DetailList
.
Select
(
y
=>
y
.
SuppliesId
).
Contains
(
x
.
SuppliesId
)).
ToList
();
foreach
(
var
item
in
InsertList
)
{
foreach
(
var
item
in
InsertList
)
{
supplies_StockInDetailRepository
.
Insert
(
new
RB_Supplies_StockInDetail
()
supplies_StockInDetailRepository
.
Insert
(
new
RB_Supplies_StockInDetail
()
{
{
CreateBy
=
demodel
.
CreateBy
,
CreateBy
=
demodel
.
CreateBy
,
...
@@ -672,7 +694,8 @@ namespace Property.Module.FixedAssets
...
@@ -672,7 +694,8 @@ namespace Property.Module.FixedAssets
}
}
}
}
}
}
foreach
(
var
item
in
DelList
)
{
foreach
(
var
item
in
DelList
)
{
Dictionary
<
string
,
object
>
files
=
new
Dictionary
<
string
,
object
>()
{
Dictionary
<
string
,
object
>
files
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Supplies_StockInDetail
.
Status
),(
int
)
DateStateEnum
.
Delete
}
{
nameof
(
RB_Supplies_StockInDetail
.
Status
),(
int
)
DateStateEnum
.
Delete
}
};
};
...
@@ -694,7 +717,8 @@ namespace Property.Module.FixedAssets
...
@@ -694,7 +717,8 @@ namespace Property.Module.FixedAssets
//生产编号
//生产编号
demodel
.
StockInState
=
StockInStatusEnum
.
StockIn
;
demodel
.
StockInState
=
StockInStatusEnum
.
StockIn
;
int
Id
=
supplies_StockInRepository
.
Insert
(
demodel
,
trans
);
int
Id
=
supplies_StockInRepository
.
Insert
(
demodel
,
trans
);
if
(
Id
>
0
)
{
if
(
Id
>
0
)
{
//编码自动生成
//编码自动生成
string
BMStr
=
Id
.
ToString
();
string
BMStr
=
Id
.
ToString
();
if
(
BMStr
.
Length
<
5
)
if
(
BMStr
.
Length
<
5
)
...
@@ -725,7 +749,8 @@ namespace Property.Module.FixedAssets
...
@@ -725,7 +749,8 @@ namespace Property.Module.FixedAssets
supplies_StockInRepository
.
Update
(
files
,
wheres
,
trans
);
supplies_StockInRepository
.
Update
(
files
,
wheres
,
trans
);
//新增明细
//新增明细
foreach
(
var
item
in
demodel
.
DetailList
)
{
foreach
(
var
item
in
demodel
.
DetailList
)
{
supplies_StockInDetailRepository
.
Insert
(
new
RB_Supplies_StockInDetail
()
supplies_StockInDetailRepository
.
Insert
(
new
RB_Supplies_StockInDetail
()
{
{
CreateBy
=
demodel
.
CreateBy
,
CreateBy
=
demodel
.
CreateBy
,
...
@@ -752,7 +777,8 @@ namespace Property.Module.FixedAssets
...
@@ -752,7 +777,8 @@ namespace Property.Module.FixedAssets
iModel
.
Number
+=
item
.
Number
;
//增加库存
iModel
.
Number
+=
item
.
Number
;
//增加库存
iModel
.
Money
+=
item
.
Money
;
iModel
.
Money
+=
item
.
Money
;
var
iflag
=
supplies_InventoryRepository
.
Update
(
iModel
,
trans
);
var
iflag
=
supplies_InventoryRepository
.
Update
(
iModel
,
trans
);
if
(
iflag
)
{
if
(
iflag
)
{
//增加库存明细
//增加库存明细
supplies_InventoryDetailRepository
.
Insert
(
new
RB_Supplies_InventoryDetail
()
supplies_InventoryDetailRepository
.
Insert
(
new
RB_Supplies_InventoryDetail
()
{
{
...
@@ -770,7 +796,8 @@ namespace Property.Module.FixedAssets
...
@@ -770,7 +796,8 @@ namespace Property.Module.FixedAssets
},
trans
);
},
trans
);
}
}
}
}
else
{
else
{
//新增库存表
//新增库存表
int
iId
=
supplies_InventoryRepository
.
Insert
(
new
RB_Supplies_Inventory
()
int
iId
=
supplies_InventoryRepository
.
Insert
(
new
RB_Supplies_Inventory
()
{
{
...
@@ -787,7 +814,8 @@ namespace Property.Module.FixedAssets
...
@@ -787,7 +814,8 @@ namespace Property.Module.FixedAssets
UpdateDate
=
demodel
.
UpdateDate
,
UpdateDate
=
demodel
.
UpdateDate
,
WarehouseId
=
demodel
.
WarehouseId
WarehouseId
=
demodel
.
WarehouseId
},
trans
);
},
trans
);
if
(
iId
>
0
)
{
if
(
iId
>
0
)
{
//增加库存明细
//增加库存明细
supplies_InventoryDetailRepository
.
Insert
(
new
RB_Supplies_InventoryDetail
()
supplies_InventoryDetailRepository
.
Insert
(
new
RB_Supplies_InventoryDetail
()
{
{
...
@@ -845,13 +873,15 @@ namespace Property.Module.FixedAssets
...
@@ -845,13 +873,15 @@ namespace Property.Module.FixedAssets
var
list
=
supplies_StockOutDetailRepository
.
GetRecipientsQueryPageList
(
pageIndex
,
pageSize
,
demodel
,
out
count
);
var
list
=
supplies_StockOutDetailRepository
.
GetRecipientsQueryPageList
(
pageIndex
,
pageSize
,
demodel
,
out
count
);
List
<
RB_Branch_Extend
>
blist
=
new
List
<
RB_Branch_Extend
>();
List
<
RB_Branch_Extend
>
blist
=
new
List
<
RB_Branch_Extend
>();
List
<
RB_Department_Extend
>
dlist
=
new
List
<
RB_Department_Extend
>();
List
<
RB_Department_Extend
>
dlist
=
new
List
<
RB_Department_Extend
>();
if
(
list
.
Any
())
{
if
(
list
.
Any
())
{
string
bstr
=
string
.
Join
(
","
,
list
.
Select
(
x
=>
x
.
BranchId
??
0
).
Distinct
());
string
bstr
=
string
.
Join
(
","
,
list
.
Select
(
x
=>
x
.
BranchId
??
0
).
Distinct
());
string
dstr
=
string
.
Join
(
","
,
list
.
Select
(
x
=>
x
.
DepartmentId
??
0
).
Distinct
());
string
dstr
=
string
.
Join
(
","
,
list
.
Select
(
x
=>
x
.
DepartmentId
??
0
).
Distinct
());
blist
=
branchRepository
.
GetBranchNameByIds
(
bstr
);
blist
=
branchRepository
.
GetBranchNameByIds
(
bstr
);
dlist
=
departmentRepository
.
GetDepartmentByDepartmentIds
(
dstr
);
dlist
=
departmentRepository
.
GetDepartmentByDepartmentIds
(
dstr
);
}
}
foreach
(
var
item
in
list
)
{
foreach
(
var
item
in
list
)
{
var
bmodel
=
blist
.
Where
(
x
=>
x
.
Id
==
item
.
BranchId
).
FirstOrDefault
();
var
bmodel
=
blist
.
Where
(
x
=>
x
.
Id
==
item
.
BranchId
).
FirstOrDefault
();
var
dmodel
=
dlist
.
Where
(
x
=>
x
.
DepartmentID
==
item
.
DepartmentId
).
FirstOrDefault
();
var
dmodel
=
dlist
.
Where
(
x
=>
x
.
DepartmentID
==
item
.
DepartmentId
).
FirstOrDefault
();
item
.
BranchName
=
bmodel
?.
BName
??
""
;
item
.
BranchName
=
bmodel
?.
BName
??
""
;
...
@@ -882,7 +912,8 @@ namespace Property.Module.FixedAssets
...
@@ -882,7 +912,8 @@ namespace Property.Module.FixedAssets
public
List
<
RB_Supplies_Inventory_Extend
>
GetInventoryPageList
(
int
pageIndex
,
int
pageSize
,
RB_Supplies_Inventory_Extend
demodel
,
out
long
count
)
public
List
<
RB_Supplies_Inventory_Extend
>
GetInventoryPageList
(
int
pageIndex
,
int
pageSize
,
RB_Supplies_Inventory_Extend
demodel
,
out
long
count
)
{
{
var
list
=
supplies_InventoryRepository
.
GetPageList
(
pageIndex
,
pageSize
,
demodel
,
out
count
);
var
list
=
supplies_InventoryRepository
.
GetPageList
(
pageIndex
,
pageSize
,
demodel
,
out
count
);
if
(
list
.
Any
())
{
if
(
list
.
Any
())
{
string
wstr
=
string
.
Join
(
","
,
list
.
Select
(
x
=>
x
.
WarehouseId
??
0
).
Distinct
());
string
wstr
=
string
.
Join
(
","
,
list
.
Select
(
x
=>
x
.
WarehouseId
??
0
).
Distinct
());
string
sstr
=
string
.
Join
(
","
,
list
.
Select
(
x
=>
x
.
SuppliesId
??
0
).
Distinct
());
string
sstr
=
string
.
Join
(
","
,
list
.
Select
(
x
=>
x
.
SuppliesId
??
0
).
Distinct
());
//查询仓库
//查询仓库
...
@@ -890,13 +921,16 @@ namespace Property.Module.FixedAssets
...
@@ -890,13 +921,16 @@ namespace Property.Module.FixedAssets
//查询耗材
//查询耗材
var
mlist
=
supplies_MaterialRepository
.
GetList
(
new
RB_Supplies_Material_Extend
()
{
RB_Group_Id
=
demodel
.
RB_Group_Id
,
SuppliesIdStr
=
sstr
},
true
);
var
mlist
=
supplies_MaterialRepository
.
GetList
(
new
RB_Supplies_Material_Extend
()
{
RB_Group_Id
=
demodel
.
RB_Group_Id
,
SuppliesIdStr
=
sstr
},
true
);
foreach
(
var
item
in
list
)
{
foreach
(
var
item
in
list
)
{
item
.
WModel
=
wlist
.
Where
(
x
=>
x
.
Id
==
item
.
WarehouseId
).
FirstOrDefault
();
item
.
WModel
=
wlist
.
Where
(
x
=>
x
.
Id
==
item
.
WarehouseId
).
FirstOrDefault
();
item
.
SModel
=
mlist
.
Where
(
x
=>
x
.
Id
==
item
.
SuppliesId
).
FirstOrDefault
();
item
.
SModel
=
mlist
.
Where
(
x
=>
x
.
Id
==
item
.
SuppliesId
).
FirstOrDefault
();
if
(
item
.
WModel
==
null
)
{
if
(
item
.
WModel
==
null
)
{
item
.
WModel
=
new
RB_Supplies_WareHouse_Extend
();
item
.
WModel
=
new
RB_Supplies_WareHouse_Extend
();
}
}
if
(
item
.
SModel
==
null
)
{
if
(
item
.
SModel
==
null
)
{
item
.
SModel
=
new
RB_Supplies_Material_Extend
();
item
.
SModel
=
new
RB_Supplies_Material_Extend
();
}
}
item
.
SModel
.
GoodsSpecificationList
=
new
List
<
string
>();
item
.
SModel
.
GoodsSpecificationList
=
new
List
<
string
>();
...
@@ -1079,7 +1113,8 @@ namespace Property.Module.FixedAssets
...
@@ -1079,7 +1113,8 @@ namespace Property.Module.FixedAssets
if
(
demodel
.
Id
>
0
)
if
(
demodel
.
Id
>
0
)
{
{
var
model
=
supplies_StockOutRepository
.
GetEntity
(
demodel
.
Id
);
var
model
=
supplies_StockOutRepository
.
GetEntity
(
demodel
.
Id
);
if
(
demodel
.
IsSelfApplication
==
1
&&
model
.
StockOutState
!=
StockOutStatusEnum
.
StockOutWait
)
{
if
(
demodel
.
IsSelfApplication
==
1
&&
model
.
StockOutState
!=
StockOutStatusEnum
.
StockOutWait
)
{
supplies_StockInRepository
.
DBSession
.
Commit
();
supplies_StockInRepository
.
DBSession
.
Commit
();
return
false
;
return
false
;
}
}
...
@@ -1092,9 +1127,11 @@ namespace Property.Module.FixedAssets
...
@@ -1092,9 +1127,11 @@ namespace Property.Module.FixedAssets
model
.
UpdateDate
=
demodel
.
UpdateDate
;
model
.
UpdateDate
=
demodel
.
UpdateDate
;
model
.
StockOutState
=
StockOutStatusEnum
.
StockOut
;
model
.
StockOutState
=
StockOutStatusEnum
.
StockOut
;
bool
flag
=
supplies_StockOutRepository
.
Update
(
model
,
trans
);
bool
flag
=
supplies_StockOutRepository
.
Update
(
model
,
trans
);
if
(
flag
)
{
if
(
flag
)
{
//删除明细
//删除明细
foreach
(
var
item
in
delList
)
{
foreach
(
var
item
in
delList
)
{
supplies_StockOutDetailRepository
.
Delete
(
item
);
supplies_StockOutDetailRepository
.
Delete
(
item
);
}
}
//新增明细
//新增明细
...
@@ -1307,7 +1344,8 @@ namespace Property.Module.FixedAssets
...
@@ -1307,7 +1344,8 @@ namespace Property.Module.FixedAssets
foreach
(
var
item
in
list
)
foreach
(
var
item
in
list
)
{
{
item
.
DetailList
=
sdList
.
Where
(
x
=>
x
.
StockOutId
==
item
.
Id
).
ToList
();
item
.
DetailList
=
sdList
.
Where
(
x
=>
x
.
StockOutId
==
item
.
Id
).
ToList
();
foreach
(
var
citem
in
item
.
DetailList
)
{
foreach
(
var
citem
in
item
.
DetailList
)
{
citem
.
InventoryNum
=
iList
.
Where
(
x
=>
x
.
WarehouseId
==
item
.
WarehouseId
&&
x
.
SuppliesId
==
citem
.
SuppliesId
).
FirstOrDefault
()?.
Number
??
0
;
citem
.
InventoryNum
=
iList
.
Where
(
x
=>
x
.
WarehouseId
==
item
.
WarehouseId
&&
x
.
SuppliesId
==
citem
.
SuppliesId
).
FirstOrDefault
()?.
Number
??
0
;
}
}
}
}
...
@@ -1320,7 +1358,8 @@ namespace Property.Module.FixedAssets
...
@@ -1320,7 +1358,8 @@ namespace Property.Module.FixedAssets
/// </summary>
/// </summary>
/// <param name="Id"></param>
/// <param name="Id"></param>
/// <returns></returns>
/// <returns></returns>
public
RB_Supplies_StockIn
GetStockInInfo
(
int
Id
)
{
public
RB_Supplies_StockIn
GetStockInInfo
(
int
Id
)
{
return
supplies_StockInRepository
.
GetEntity
(
Id
);
return
supplies_StockInRepository
.
GetEntity
(
Id
);
}
}
...
@@ -1412,7 +1451,8 @@ namespace Property.Module.FixedAssets
...
@@ -1412,7 +1451,8 @@ namespace Property.Module.FixedAssets
}
}
};
};
bool
flag
=
supplies_StockInRepository
.
Update
(
files
,
wheres
);
bool
flag
=
supplies_StockInRepository
.
Update
(
files
,
wheres
);
if
(
flag
)
{
if
(
flag
)
{
//删除明细 --- 查库存操作
//删除明细 --- 查库存操作
var
list
=
supplies_StockInDetailRepository
.
GetList
(
new
RB_Supplies_StockInDetail_Extend
()
{
RB_Group_Id
=
demodel
.
RB_Group_Id
,
StockInId
=
stockInId
});
var
list
=
supplies_StockInDetailRepository
.
GetList
(
new
RB_Supplies_StockInDetail_Extend
()
{
RB_Group_Id
=
demodel
.
RB_Group_Id
,
StockInId
=
stockInId
});
foreach
(
var
item
in
list
)
foreach
(
var
item
in
list
)
...
@@ -1424,7 +1464,8 @@ namespace Property.Module.FixedAssets
...
@@ -1424,7 +1464,8 @@ namespace Property.Module.FixedAssets
var
iModel
=
ilist
.
FirstOrDefault
();
var
iModel
=
ilist
.
FirstOrDefault
();
iModel
.
Number
-=
item
.
Number
;
//减少库存
iModel
.
Number
-=
item
.
Number
;
//减少库存
iModel
.
Money
-=
item
.
Money
;
iModel
.
Money
-=
item
.
Money
;
if
(
iModel
.
Money
<
0
)
{
if
(
iModel
.
Money
<
0
)
{
iModel
.
Money
=
0
;
iModel
.
Money
=
0
;
}
}
var
iflag
=
supplies_InventoryRepository
.
Update
(
iModel
);
var
iflag
=
supplies_InventoryRepository
.
Update
(
iModel
);
...
@@ -1510,17 +1551,19 @@ namespace Property.Module.FixedAssets
...
@@ -1510,17 +1551,19 @@ namespace Property.Module.FixedAssets
var
list
=
supplies_ApplyforRepository
.
GetPageList
(
pageIndex
,
pageSize
,
demodel
,
out
count
);
var
list
=
supplies_ApplyforRepository
.
GetPageList
(
pageIndex
,
pageSize
,
demodel
,
out
count
);
var
slist
=
new
List
<
RB_Supplies_ApplyforWeekday_Extend
>();
var
slist
=
new
List
<
RB_Supplies_ApplyforWeekday_Extend
>();
var
aslist
=
new
List
<
RB_Supplies_ApplyforSpecial_Extend
>();
var
aslist
=
new
List
<
RB_Supplies_ApplyforSpecial_Extend
>();
if
(
list
.
Any
())
{
if
(
list
.
Any
())
{
slist
=
supplies_ApplyforWeekdayRepository
.
GetList
(
new
RB_Supplies_ApplyforWeekday_Extend
()
{
RB_Group_Id
=
demodel
.
RB_Group_Id
,
ApplyforIds
=
string
.
Join
(
","
,
list
.
Select
(
x
=>
x
.
Id
).
Distinct
())
});
slist
=
supplies_ApplyforWeekdayRepository
.
GetList
(
new
RB_Supplies_ApplyforWeekday_Extend
()
{
RB_Group_Id
=
demodel
.
RB_Group_Id
,
ApplyforIds
=
string
.
Join
(
","
,
list
.
Select
(
x
=>
x
.
Id
).
Distinct
())
});
aslist
=
supplies_ApplyforSpecialRepository
.
GetList
(
new
RB_Supplies_ApplyforSpecial_Extend
()
{
ApplyforIds
=
string
.
Join
(
","
,
list
.
Select
(
x
=>
x
.
Id
).
Distinct
())
});
aslist
=
supplies_ApplyforSpecialRepository
.
GetList
(
new
RB_Supplies_ApplyforSpecial_Extend
()
{
ApplyforIds
=
string
.
Join
(
","
,
list
.
Select
(
x
=>
x
.
Id
).
Distinct
())
});
}
}
foreach
(
var
item
in
list
)
{
foreach
(
var
item
in
list
)
{
//查询所有周期
//查询所有周期
item
.
WeekdayList
=
slist
.
Where
(
x
=>
x
.
ApplyforId
==
item
.
Id
).
ToList
();
item
.
WeekdayList
=
slist
.
Where
(
x
=>
x
.
ApplyforId
==
item
.
Id
).
ToList
();
item
.
SpecialList
=
aslist
.
Where
(
x
=>
x
.
ApplyforId
==
item
.
Id
).
ToList
();
item
.
SpecialList
=
aslist
.
Where
(
x
=>
x
.
ApplyforId
==
item
.
Id
).
ToList
();
}
}
return
list
;
return
list
;
}
}
/// <summary>
/// <summary>
/// 设置耗材申请时间
/// 设置耗材申请时间
...
@@ -1545,11 +1588,13 @@ namespace Property.Module.FixedAssets
...
@@ -1545,11 +1588,13 @@ namespace Property.Module.FixedAssets
}
}
};
};
bool
flag
=
supplies_ApplyforRepository
.
Update
(
files
,
wheres
,
trans
);
bool
flag
=
supplies_ApplyforRepository
.
Update
(
files
,
wheres
,
trans
);
if
(
flag
)
{
if
(
flag
)
{
var
slist
=
supplies_ApplyforWeekdayRepository
.
GetList
(
new
RB_Supplies_ApplyforWeekday_Extend
()
{
RB_Group_Id
=
demodel
.
RB_Group_Id
,
ApplyforId
=
demodel
.
Id
});
var
slist
=
supplies_ApplyforWeekdayRepository
.
GetList
(
new
RB_Supplies_ApplyforWeekday_Extend
()
{
RB_Group_Id
=
demodel
.
RB_Group_Id
,
ApplyforId
=
demodel
.
Id
});
var
aslist
=
supplies_ApplyforSpecialRepository
.
GetList
(
new
RB_Supplies_ApplyforSpecial_Extend
()
{
ApplyforId
=
demodel
.
Id
});
var
aslist
=
supplies_ApplyforSpecialRepository
.
GetList
(
new
RB_Supplies_ApplyforSpecial_Extend
()
{
ApplyforId
=
demodel
.
Id
});
//删除所有工作日信息
//删除所有工作日信息
foreach
(
var
item
in
slist
)
{
foreach
(
var
item
in
slist
)
{
supplies_ApplyforWeekdayRepository
.
Delete
(
item
,
trans
);
supplies_ApplyforWeekdayRepository
.
Delete
(
item
,
trans
);
}
}
//再新增
//再新增
...
@@ -1572,7 +1617,8 @@ namespace Property.Module.FixedAssets
...
@@ -1572,7 +1617,8 @@ namespace Property.Module.FixedAssets
},
trans
);
},
trans
);
}
}
//特殊日期
//特殊日期
foreach
(
var
item
in
aslist
)
{
foreach
(
var
item
in
aslist
)
{
supplies_ApplyforSpecialRepository
.
Delete
(
item
,
trans
);
supplies_ApplyforSpecialRepository
.
Delete
(
item
,
trans
);
}
}
//写入特殊日期
//写入特殊日期
...
@@ -1625,8 +1671,10 @@ namespace Property.Module.FixedAssets
...
@@ -1625,8 +1671,10 @@ namespace Property.Module.FixedAssets
},
trans
);
},
trans
);
}
}
//写入特殊日期
//写入特殊日期
if
(
demodel
.
SpecialList
!=
null
&&
demodel
.
SpecialList
.
Any
())
{
if
(
demodel
.
SpecialList
!=
null
&&
demodel
.
SpecialList
.
Any
())
foreach
(
var
item
in
demodel
.
SpecialList
)
{
{
foreach
(
var
item
in
demodel
.
SpecialList
)
{
supplies_ApplyforSpecialRepository
.
Insert
(
new
RB_Supplies_ApplyforSpecial
()
supplies_ApplyforSpecialRepository
.
Insert
(
new
RB_Supplies_ApplyforSpecial
()
{
{
ApplyforId
=
Id
,
ApplyforId
=
Id
,
...
@@ -1671,8 +1719,10 @@ namespace Property.Module.FixedAssets
...
@@ -1671,8 +1719,10 @@ namespace Property.Module.FixedAssets
return
true
;
return
true
;
}
}
}
}
else
{
else
if
(
list
.
Any
())
{
{
if
(
list
.
Any
())
{
return
true
;
return
true
;
}
}
}
}
...
@@ -1688,10 +1738,12 @@ namespace Property.Module.FixedAssets
...
@@ -1688,10 +1738,12 @@ namespace Property.Module.FixedAssets
public
bool
SetApplyForStatus
(
int
applyforId
,
UserInfo
userInfo
)
public
bool
SetApplyForStatus
(
int
applyforId
,
UserInfo
userInfo
)
{
{
var
model
=
supplies_ApplyforRepository
.
GetEntity
(
applyforId
);
var
model
=
supplies_ApplyforRepository
.
GetEntity
(
applyforId
);
if
(
model
==
null
)
{
if
(
model
==
null
)
{
return
false
;
return
false
;
}
}
if
(
model
.
Status
==
1
)
{
if
(
model
.
Status
==
1
)
{
return
false
;
return
false
;
}
}
Dictionary
<
string
,
object
>
files
=
new
Dictionary
<
string
,
object
>()
{
Dictionary
<
string
,
object
>
files
=
new
Dictionary
<
string
,
object
>()
{
...
@@ -1726,7 +1778,8 @@ namespace Property.Module.FixedAssets
...
@@ -1726,7 +1778,8 @@ namespace Property.Module.FixedAssets
demodel
.
SpecialList
=
aslist
;
demodel
.
SpecialList
=
aslist
;
return
demodel
;
return
demodel
;
}
}
else
{
else
{
//查询通用化的
//查询通用化的
list
=
supplies_ApplyforRepository
.
GetList
(
new
RB_Supplies_Applyfor_Extend
()
{
BranchId
=
-
1
,
RB_Group_Id
=
userInfo
.
RB_Group_id
});
list
=
supplies_ApplyforRepository
.
GetList
(
new
RB_Supplies_Applyfor_Extend
()
{
BranchId
=
-
1
,
RB_Group_Id
=
userInfo
.
RB_Group_id
});
if
(
list
.
Any
())
if
(
list
.
Any
())
...
@@ -1738,7 +1791,8 @@ namespace Property.Module.FixedAssets
...
@@ -1738,7 +1791,8 @@ namespace Property.Module.FixedAssets
demodel
.
SpecialList
=
aslist
;
demodel
.
SpecialList
=
aslist
;
return
demodel
;
return
demodel
;
}
}
else
{
else
{
return
new
RB_Supplies_Applyfor_Extend
()
{
Id
=
-
1
};
return
new
RB_Supplies_Applyfor_Extend
()
{
Id
=
-
1
};
}
}
}
}
...
@@ -1871,14 +1925,16 @@ namespace Property.Module.FixedAssets
...
@@ -1871,14 +1925,16 @@ namespace Property.Module.FixedAssets
{
{
code
=
code
.
Replace
(
"A"
,
"-"
);
code
=
code
.
Replace
(
"A"
,
"-"
);
string
[]
codeArr
=
code
.
Split
(
'-'
);
string
[]
codeArr
=
code
.
Split
(
'-'
);
if
(
codeArr
.
Length
!=
5
)
{
if
(
codeArr
.
Length
!=
5
)
{
return
new
return
new
{
{
Status
=
1
,
Status
=
1
,
Msg
=
"编码格式不正确"
Msg
=
"编码格式不正确"
};
};
}
}
if
(
codeArr
[
0
]
!=
"D"
)
{
if
(
codeArr
[
0
]
!=
"D"
)
{
return
new
return
new
{
{
Status
=
1
,
Status
=
1
,
...
@@ -1889,7 +1945,8 @@ namespace Property.Module.FixedAssets
...
@@ -1889,7 +1945,8 @@ namespace Property.Module.FixedAssets
int
ProcurementId
=
Convert
.
ToInt32
(
codeArr
[
2
]);
int
ProcurementId
=
Convert
.
ToInt32
(
codeArr
[
2
]);
int
SuppliesId
=
Convert
.
ToInt32
(
codeArr
[
3
]);
int
SuppliesId
=
Convert
.
ToInt32
(
codeArr
[
3
]);
int
StockInId
=
Convert
.
ToInt32
(
codeArr
[
4
]);
int
StockInId
=
Convert
.
ToInt32
(
codeArr
[
4
]);
if
(
WarehouseId
!=
wareHouseId
)
{
if
(
WarehouseId
!=
wareHouseId
)
{
return
new
return
new
{
{
Status
=
1
,
Status
=
1
,
...
@@ -1898,7 +1955,8 @@ namespace Property.Module.FixedAssets
...
@@ -1898,7 +1955,8 @@ namespace Property.Module.FixedAssets
}
}
var
materialModel
=
supplies_MaterialRepository
.
GetEntity
(
SuppliesId
);
var
materialModel
=
supplies_MaterialRepository
.
GetEntity
(
SuppliesId
);
if
(
materialModel
==
null
)
{
if
(
materialModel
==
null
)
{
return
new
return
new
{
{
Status
=
1
,
Status
=
1
,
...
@@ -1907,10 +1965,12 @@ namespace Property.Module.FixedAssets
...
@@ -1907,10 +1965,12 @@ namespace Property.Module.FixedAssets
}
}
List
<
string
>
SpecificationList
=
new
List
<
string
>();
List
<
string
>
SpecificationList
=
new
List
<
string
>();
List
<
string
>
ImageList
=
new
List
<
string
>();
List
<
string
>
ImageList
=
new
List
<
string
>();
if
(!
string
.
IsNullOrEmpty
(
materialModel
.
SpecificationName
)
&&
materialModel
.
SpecificationName
!=
"[]"
)
{
if
(!
string
.
IsNullOrEmpty
(
materialModel
.
SpecificationName
)
&&
materialModel
.
SpecificationName
!=
"[]"
)
{
SpecificationList
=
JsonConvert
.
DeserializeObject
<
List
<
string
>>(
materialModel
.
SpecificationName
);
SpecificationList
=
JsonConvert
.
DeserializeObject
<
List
<
string
>>(
materialModel
.
SpecificationName
);
}
}
if
(!
string
.
IsNullOrEmpty
(
materialModel
.
Images
)
&&
materialModel
.
Images
!=
"[]"
)
{
if
(!
string
.
IsNullOrEmpty
(
materialModel
.
Images
)
&&
materialModel
.
Images
!=
"[]"
)
{
ImageList
=
JsonConvert
.
DeserializeObject
<
List
<
string
>>(
materialModel
.
Images
);
ImageList
=
JsonConvert
.
DeserializeObject
<
List
<
string
>>(
materialModel
.
Images
);
}
}
...
@@ -1931,7 +1991,8 @@ namespace Property.Module.FixedAssets
...
@@ -1931,7 +1991,8 @@ namespace Property.Module.FixedAssets
#
endregion
#
endregion
var
stockInList
=
supplies_StockInRepository
.
GetList
(
new
RB_Supplies_StockIn_Extend
()
{
RB_Group_Id
=
userInfo
.
RB_Group_id
,
Id
=
StockInId
,
ProcurementId
=
ProcurementId
});
var
stockInList
=
supplies_StockInRepository
.
GetList
(
new
RB_Supplies_StockIn_Extend
()
{
RB_Group_Id
=
userInfo
.
RB_Group_id
,
Id
=
StockInId
,
ProcurementId
=
ProcurementId
});
if
(!
stockInList
.
Any
())
{
if
(!
stockInList
.
Any
())
{
return
new
return
new
{
{
Status
=
1
,
Status
=
1
,
...
@@ -1940,7 +2001,8 @@ namespace Property.Module.FixedAssets
...
@@ -1940,7 +2001,8 @@ namespace Property.Module.FixedAssets
}
}
var
stockInModel
=
stockInList
.
FirstOrDefault
();
var
stockInModel
=
stockInList
.
FirstOrDefault
();
var
stockInDetailList
=
supplies_StockInDetailRepository
.
GetList
(
new
RB_Supplies_StockInDetail_Extend
()
{
RB_Group_Id
=
userInfo
.
RB_Group_id
,
SuppliesId
=
SuppliesId
,
StockInId
=
StockInId
});
var
stockInDetailList
=
supplies_StockInDetailRepository
.
GetList
(
new
RB_Supplies_StockInDetail_Extend
()
{
RB_Group_Id
=
userInfo
.
RB_Group_id
,
SuppliesId
=
SuppliesId
,
StockInId
=
StockInId
});
if
(!
stockInDetailList
.
Any
())
{
if
(!
stockInDetailList
.
Any
())
{
return
new
return
new
{
{
Status
=
1
,
Status
=
1
,
...
@@ -1954,7 +2016,8 @@ namespace Property.Module.FixedAssets
...
@@ -1954,7 +2016,8 @@ namespace Property.Module.FixedAssets
{
{
Status
=
0
,
Status
=
0
,
Msg
=
"查询成功"
,
Msg
=
"查询成功"
,
GoodsModel
=
new
{
GoodsModel
=
new
{
WarehouseId
,
WarehouseId
,
SuppliesId
,
SuppliesId
,
materialModel
.
GoodsId
,
materialModel
.
GoodsId
,
...
@@ -2090,10 +2153,12 @@ namespace Property.Module.FixedAssets
...
@@ -2090,10 +2153,12 @@ namespace Property.Module.FixedAssets
public
List
<
RB_Supplies_Check_Extend
>
GetSuppliesCheckPageList
(
int
pageIndex
,
int
pageSize
,
RB_Supplies_Check_Extend
demodel
,
out
long
count
)
public
List
<
RB_Supplies_Check_Extend
>
GetSuppliesCheckPageList
(
int
pageIndex
,
int
pageSize
,
RB_Supplies_Check_Extend
demodel
,
out
long
count
)
{
{
var
list
=
supplies_CheckRepository
.
GetPageList
(
pageIndex
,
pageSize
,
demodel
,
out
count
);
var
list
=
supplies_CheckRepository
.
GetPageList
(
pageIndex
,
pageSize
,
demodel
,
out
count
);
if
(
list
.
Any
())
{
if
(
list
.
Any
())
{
//查询仓库
//查询仓库
var
wlist
=
supplies_WareHouseRepository
.
GetList
(
new
RB_Supplies_WareHouse_Extend
()
{
RB_Group_Id
=
demodel
.
RB_Group_Id
,
WareHouseIdStr
=
string
.
Join
(
","
,
list
.
Select
(
x
=>
x
.
WarehouseId
??
0
).
Distinct
())
});
var
wlist
=
supplies_WareHouseRepository
.
GetList
(
new
RB_Supplies_WareHouse_Extend
()
{
RB_Group_Id
=
demodel
.
RB_Group_Id
,
WareHouseIdStr
=
string
.
Join
(
","
,
list
.
Select
(
x
=>
x
.
WarehouseId
??
0
).
Distinct
())
});
foreach
(
var
item
in
list
)
{
foreach
(
var
item
in
list
)
{
var
wmodel
=
wlist
.
Where
(
x
=>
x
.
Id
==
item
.
WarehouseId
).
FirstOrDefault
();
var
wmodel
=
wlist
.
Where
(
x
=>
x
.
Id
==
item
.
WarehouseId
).
FirstOrDefault
();
item
.
WarehouseName
=
wmodel
?.
Name
??
""
;
item
.
WarehouseName
=
wmodel
?.
Name
??
""
;
}
}
...
@@ -2185,7 +2250,8 @@ namespace Property.Module.FixedAssets
...
@@ -2185,7 +2250,8 @@ namespace Property.Module.FixedAssets
/// </summary>
/// </summary>
/// <param name="Id"></param>
/// <param name="Id"></param>
/// <returns></returns>
/// <returns></returns>
public
RB_Supplies_Check_Extend
GetSuppliesCheck
(
int
Id
)
{
public
RB_Supplies_Check_Extend
GetSuppliesCheck
(
int
Id
)
{
return
supplies_CheckRepository
.
GetEntity
<
RB_Supplies_Check_Extend
>(
Id
);
return
supplies_CheckRepository
.
GetEntity
<
RB_Supplies_Check_Extend
>(
Id
);
}
}
...
@@ -2234,7 +2300,8 @@ namespace Property.Module.FixedAssets
...
@@ -2234,7 +2300,8 @@ namespace Property.Module.FixedAssets
}
}
};
};
bool
flag
=
supplies_CheckRepository
.
Update
(
keyValues
,
wheres
);
bool
flag
=
supplies_CheckRepository
.
Update
(
keyValues
,
wheres
);
if
(
flag
)
{
if
(
flag
)
{
//是否需要重置盘点明细的盘点状态
//是否需要重置盘点明细的盘点状态
}
}
...
@@ -2253,11 +2320,14 @@ namespace Property.Module.FixedAssets
...
@@ -2253,11 +2320,14 @@ namespace Property.Module.FixedAssets
{
{
var
list
=
supplies_CheckDetailRepository
.
GetPageList
(
pageIndex
,
pageSize
,
demodel
,
out
count
);
var
list
=
supplies_CheckDetailRepository
.
GetPageList
(
pageIndex
,
pageSize
,
demodel
,
out
count
);
if
(
list
.
Any
())
{
if
(
list
.
Any
())
{
//组装规格
//组装规格
foreach
(
var
item
in
list
)
{
foreach
(
var
item
in
list
)
{
item
.
SpecificationList
=
new
List
<
string
>();
item
.
SpecificationList
=
new
List
<
string
>();
if
(!
string
.
IsNullOrEmpty
(
item
.
SpecificationName
)
&&
item
.
SpecificationName
!=
"[]"
)
{
if
(!
string
.
IsNullOrEmpty
(
item
.
SpecificationName
)
&&
item
.
SpecificationName
!=
"[]"
)
{
item
.
SpecificationList
=
JsonConvert
.
DeserializeObject
<
List
<
string
>>(
item
.
SpecificationName
);
item
.
SpecificationList
=
JsonConvert
.
DeserializeObject
<
List
<
string
>>(
item
.
SpecificationName
);
}
}
item
.
ImageList
=
new
List
<
string
>();
item
.
ImageList
=
new
List
<
string
>();
...
@@ -2281,14 +2351,15 @@ namespace Property.Module.FixedAssets
...
@@ -2281,14 +2351,15 @@ namespace Property.Module.FixedAssets
public
List
<
RB_Supplies_CheckDetail_Extend
>
GetSuppliesCheckDetailBreakagePageList
(
int
pageIndex
,
int
pageSize
,
RB_Supplies_CheckDetail_Extend
demodel
,
out
long
count
)
public
List
<
RB_Supplies_CheckDetail_Extend
>
GetSuppliesCheckDetailBreakagePageList
(
int
pageIndex
,
int
pageSize
,
RB_Supplies_CheckDetail_Extend
demodel
,
out
long
count
)
{
{
var
cmodel
=
supplies_CheckRepository
.
GetEntity
(
demodel
.
CheckId
);
var
cmodel
=
supplies_CheckRepository
.
GetEntity
(
demodel
.
CheckId
);
if
(
cmodel
==
null
)
{
if
(
cmodel
==
null
)
{
count
=
0
;
count
=
0
;
return
new
List
<
RB_Supplies_CheckDetail_Extend
>();
return
new
List
<
RB_Supplies_CheckDetail_Extend
>();
}
}
var
list
=
supplies_CheckDetailRepository
.
GetPageList
(
pageIndex
,
pageSize
,
demodel
,
out
count
);
var
list
=
supplies_CheckDetailRepository
.
GetPageList
(
pageIndex
,
pageSize
,
demodel
,
out
count
);
if
(
list
.
Any
())
if
(
list
.
Any
())
{
{
//组装规格
//组装规格
foreach
(
var
item
in
list
)
foreach
(
var
item
in
list
)
{
{
...
@@ -2330,9 +2401,21 @@ namespace Property.Module.FixedAssets
...
@@ -2330,9 +2401,21 @@ namespace Property.Module.FixedAssets
/// </summary>
/// </summary>
/// <param name="checkDetailId"></param>
/// <param name="checkDetailId"></param>
/// <returns></returns>
/// <returns></returns>
public
RB_Supplies_CheckDetail_Extend
GetSuppliesCheckDetailInfo
(
int
checkDetailId
)
{
public
RB_Supplies_CheckDetail_Extend
GetSuppliesCheckDetailInfo
(
int
checkDetailId
)
{
return
supplies_CheckDetailRepository
.
GetEntity
<
RB_Supplies_CheckDetail_Extend
>(
checkDetailId
);
return
supplies_CheckDetailRepository
.
GetEntity
<
RB_Supplies_CheckDetail_Extend
>(
checkDetailId
);
}
}
/// <summary>
/// 根据条件获取盘点列表
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public
List
<
RB_Supplies_CheckDetail_Extend
>
GetSuppliesCheckDetailList
(
RB_Supplies_CheckDetail_Extend
dmodel
)
{
return
supplies_CheckDetailRepository
.
GetList
(
dmodel
);
}
/// <summary>
/// <summary>
/// 设置盘点明细 耗材实盘数量
/// 设置盘点明细 耗材实盘数量
...
@@ -2350,16 +2433,22 @@ namespace Property.Module.FixedAssets
...
@@ -2350,16 +2433,22 @@ namespace Property.Module.FixedAssets
if
(
dmodel
==
null
)
{
return
false
;
}
if
(
dmodel
==
null
)
{
return
false
;
}
if
(
type
==
1
)
if
(
type
==
1
)
{
{
if
(
dmodel
.
CheckStatus
!=
PropertyCheckStatusEnum
.
NoInventory
&&
dmodel
.
CheckStatus
!=
PropertyCheckStatusEnum
.
HaveInventory
&&
dmodel
.
DealStatus
==
1
)
{
if
(
dmodel
.
CheckStatus
!=
PropertyCheckStatusEnum
.
NoInventory
&&
dmodel
.
CheckStatus
!=
PropertyCheckStatusEnum
.
HaveInventory
&&
dmodel
.
DealStatus
==
1
)
{
return
false
;
return
false
;
}
}
//更新实际数量
//更新实际数量
PropertyCheckStatusEnum
pcs
=
PropertyCheckStatusEnum
.
HaveInventory
;
PropertyCheckStatusEnum
pcs
=
PropertyCheckStatusEnum
.
HaveInventory
;
if
(
reality
==
(
dmodel
.
InventoryNum
??
0
))
{
if
(
reality
==
(
dmodel
.
InventoryNum
??
0
))
{
pcs
=
PropertyCheckStatusEnum
.
HaveInventory
;
pcs
=
PropertyCheckStatusEnum
.
HaveInventory
;
}
else
if
(
reality
>
(
dmodel
.
InventoryNum
??
0
))
{
}
else
if
(
reality
>
(
dmodel
.
InventoryNum
??
0
))
{
pcs
=
PropertyCheckStatusEnum
.
InventoryProfit
;
pcs
=
PropertyCheckStatusEnum
.
InventoryProfit
;
}
else
if
(
reality
<
(
dmodel
.
InventoryNum
??
0
))
{
}
else
if
(
reality
<
(
dmodel
.
InventoryNum
??
0
))
{
pcs
=
PropertyCheckStatusEnum
.
InventoryLosses
;
pcs
=
PropertyCheckStatusEnum
.
InventoryLosses
;
}
}
...
@@ -2420,14 +2509,16 @@ namespace Property.Module.FixedAssets
...
@@ -2420,14 +2509,16 @@ namespace Property.Module.FixedAssets
/// <param name="list"></param>
/// <param name="list"></param>
/// <param name="userInfo"></param>
/// <param name="userInfo"></param>
/// <returns></returns>
/// <returns></returns>
public
bool
SetBatchSuppliesCheckDetailReality
(
List
<
RB_Supplies_CheckDetail_Extend
>
list
,
UserInfo
userInfo
,
int
Type
=
1
)
public
bool
SetBatchSuppliesCheckDetailReality
(
List
<
RB_Supplies_CheckDetail_Extend
>
list
,
UserInfo
userInfo
,
int
Type
=
1
)
{
{
string
checkdetailIds
=
string
.
Join
(
","
,
list
.
Select
(
x
=>
x
.
Id
));
string
checkdetailIds
=
string
.
Join
(
","
,
list
.
Select
(
x
=>
x
.
Id
));
var
dlist
=
supplies_CheckDetailRepository
.
GetList
(
new
RB_Supplies_CheckDetail_Extend
()
{
RB_Group_Id
=
userInfo
.
RB_Group_id
,
CheckDetailIds
=
checkdetailIds
});
var
dlist
=
supplies_CheckDetailRepository
.
GetList
(
new
RB_Supplies_CheckDetail_Extend
()
{
RB_Group_Id
=
userInfo
.
RB_Group_id
,
CheckDetailIds
=
checkdetailIds
});
if
(
dlist
.
Select
(
x
=>
x
.
CheckId
).
Distinct
().
Count
()
!=
1
)
{
if
(
dlist
.
Select
(
x
=>
x
.
CheckId
).
Distinct
().
Count
()
!=
1
)
{
return
false
;
return
false
;
}
}
foreach
(
var
item
in
dlist
)
{
foreach
(
var
item
in
dlist
)
{
int
reality
=
list
.
Where
(
x
=>
x
.
Id
==
item
.
Id
).
FirstOrDefault
()?.
RealityNum
??
0
;
int
reality
=
list
.
Where
(
x
=>
x
.
Id
==
item
.
Id
).
FirstOrDefault
()?.
RealityNum
??
0
;
if
(
item
.
CheckStatus
!=
PropertyCheckStatusEnum
.
NoInventory
&&
item
.
CheckStatus
!=
PropertyCheckStatusEnum
.
HaveInventory
&&
item
.
DealStatus
==
1
)
if
(
item
.
CheckStatus
!=
PropertyCheckStatusEnum
.
NoInventory
&&
item
.
CheckStatus
!=
PropertyCheckStatusEnum
.
HaveInventory
&&
item
.
DealStatus
==
1
)
{
{
...
@@ -2454,7 +2545,8 @@ namespace Property.Module.FixedAssets
...
@@ -2454,7 +2545,8 @@ namespace Property.Module.FixedAssets
{
nameof
(
RB_Supplies_CheckDetail
.
CheckEmpId
),
userInfo
.
EmployeeId
},
{
nameof
(
RB_Supplies_CheckDetail
.
CheckEmpId
),
userInfo
.
EmployeeId
},
{
nameof
(
RB_Supplies_CheckDetail
.
CheckDate
),
DateTime
.
Now
},
{
nameof
(
RB_Supplies_CheckDetail
.
CheckDate
),
DateTime
.
Now
},
};
};
if
(
Type
==
2
)
{
if
(
Type
==
2
)
{
if
(!
string
.
IsNullOrEmpty
(
item
.
Remark
))
if
(!
string
.
IsNullOrEmpty
(
item
.
Remark
))
{
{
keyValues
.
Add
(
nameof
(
RB_Supplies_CheckDetail
.
Remark
),
item
.
Remark
);
keyValues
.
Add
(
nameof
(
RB_Supplies_CheckDetail
.
Remark
),
item
.
Remark
);
...
@@ -2508,7 +2600,8 @@ namespace Property.Module.FixedAssets
...
@@ -2508,7 +2600,8 @@ namespace Property.Module.FixedAssets
{
{
flies1
.
Add
(
nameof
(
RB_Supplies_CheckDetail_Extend
.
CheckStatus
),
PropertyCheckStatusEnum
.
HaveInventory
);
flies1
.
Add
(
nameof
(
RB_Supplies_CheckDetail_Extend
.
CheckStatus
),
PropertyCheckStatusEnum
.
HaveInventory
);
}
}
else
if
((
item
.
InventoryNum
??
0
)
<
(
item
.
RealityNum
??
0
))
{
else
if
((
item
.
InventoryNum
??
0
)
<
(
item
.
RealityNum
??
0
))
{
flies1
.
Add
(
nameof
(
RB_Supplies_CheckDetail_Extend
.
CheckStatus
),
PropertyCheckStatusEnum
.
InventoryProfit
);
flies1
.
Add
(
nameof
(
RB_Supplies_CheckDetail_Extend
.
CheckStatus
),
PropertyCheckStatusEnum
.
InventoryProfit
);
}
}
List
<
WhereHelper
>
wheres1
=
new
List
<
WhereHelper
>()
{
List
<
WhereHelper
>
wheres1
=
new
List
<
WhereHelper
>()
{
...
@@ -2526,5 +2619,346 @@ namespace Property.Module.FixedAssets
...
@@ -2526,5 +2619,346 @@ namespace Property.Module.FixedAssets
}
}
#
endregion
#
endregion
#
region
盘点报损
/// <summary>
/// 盘点报损分页
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public
List
<
RB_Supplies_ReportLossRecord_Extend
>
GetSuppliesReportLossRecordPageList
(
int
pageIndex
,
int
pageSize
,
out
long
rowCount
,
RB_Supplies_ReportLossRecord_Extend
query
)
{
var
list
=
suppliesReportLossRecordRepository
.
GetSuppliesReportLossRecordPageList
(
pageIndex
,
pageSize
,
out
rowCount
,
query
);
return
list
;
}
/// <summary>
/// 保存商品盘点记录
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public
bool
SetReportLossRecord
(
RB_Supplies_ReportLossRecord_Extend
applyModel
,
RB_Supplies_StockOut_Extend
demodel
,
RB_Supplies_StockIn_Extend
inDemodel
,
int
RB_Department_Id
)
{
var
trans
=
suppliesReportLossRecordRepository
.
DbTransaction
;
try
{
int
Id
=
suppliesReportLossRecordRepository
.
Insert
(
applyModel
,
trans
);
if
(
Id
>
0
)
{
#
region
生成财务单据
var
detailList
=
applyModel
.
DetailList
.
Select
(
x
=>
new
{
CostTypeId
=
applyModel
.
CheckStatus
==
PropertyCheckStatusEnum
.
InventoryLosses
?
225
:
226
,
Number
=
x
.
ReportLossNum
,
OriginalMoney
=
(
x
.
ReportLossPrice
??
0
)
*
(
x
.
ReportLossNum
??
0
),
UnitPrice
=
Math
.
Round
((
x
.
ReportLossPrice
??
0
)
/
(
x
.
ReportLossNum
??
1
),
2
,
MidpointRounding
.
AwayFromZero
),
Remark
=
x
.
GoodsName
+
x
.
SpecificationName
});
var
financeObj
=
new
{
CreateBy
=
demodel
.
CreateBy
,
IsPublic
=
0
,
// supplierModel.ClientBankAccount.AccountType, //financeConfigurineModel.AccountType,
ClientType
=
10
,
ClientID
=
3134
,
CurrencyId
=
Config
.
OutCurrencyId
,
WBMoney
=
applyModel
.
DetailList
.
Sum
(
x
=>
(
x
.
ReportLossPrice
??
0
)),
RB_Branch_Id
=
Config
.
ExpendBranchId
,
PayDate
=
System
.
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd"
),
TemplateId
=
applyModel
.
CheckStatus
==
PropertyCheckStatusEnum
.
InventoryLosses
?
129
:
130
,
OrderSource
=
16
,
OtherType
=
17
,
Remark
=
System
.
DateTime
.
Now
.
ToString
(
"yyyy年MM月dd日"
)
+
"生成"
+
(
applyModel
.
CheckStatus
==
PropertyCheckStatusEnum
.
InventoryLosses
?
"盘亏"
:
"盘盈"
)
+
"财务单据"
,
detailList
,
RB_Depart_Id
=
RB_Department_Id
,
ReFinanceId
=
Id
};
string
sign
=
EncryptionHelper
.
AesEncrypt
(
JsonHelper
.
Serialize
(
financeObj
),
Config
.
FinanceKey
);
var
resultInfo
=
new
{
msg
=
sign
,
};
string
apiResult
=
HttpHelper
.
HttpPost
(
applyModel
.
CheckStatus
==
PropertyCheckStatusEnum
.
InventoryLosses
?
Config
.
PaymentFinanceApi
:
Config
.
IncomeFinanceApi
,
JsonHelper
.
Serialize
(
resultInfo
),
""
);
JObject
parmsJob
=
JObject
.
Parse
(
apiResult
);
string
resultCode
=
parmsJob
.
GetStringValue
(
"resultCode"
);
int
frid
=
parmsJob
.
GetInt
(
"data"
,
0
);
#
endregion
if
(
resultCode
==
"1"
&&
frid
>
0
)
//新增记录
{
applyModel
.
FinanceId
=
frid
;
applyModel
.
DetailList
.
ForEach
(
x
=>
x
.
ReportLossRecordId
=
Id
);
applyModel
.
DetailList
.
ForEach
(
x
=>
x
.
CheckId
=
applyModel
.
CheckId
);
applyModel
.
DetailList
.
ForEach
(
x
=>
x
.
CheckStatus
=
applyModel
.
CheckStatus
);
//更新已出库的商品信息
foreach
(
var
item
in
applyModel
.
DetailList
)
//更新盘点商品的盘点状态
{
Dictionary
<
string
,
object
>
filesApplyGoods
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Supplies_CheckDetail
.
DealStatus
),
1
},
{
nameof
(
RB_Supplies_CheckDetail
.
UpdateBy
),
applyModel
.
CreateBy
},
{
nameof
(
RB_Supplies_CheckDetail
.
UpdateDate
),
applyModel
.
CreateDate
}
};
List
<
WhereHelper
>
wheresApplyGoods
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Supplies_CheckDetail
.
Id
),
FiledValue
=
item
.
CheckDetailId
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
supplies_CheckDetailRepository
.
Update
(
filesApplyGoods
,
wheresApplyGoods
,
trans
);
}
//新增盘点商品的信息
suppliesReportLossRecordDetailRepository
.
InsertBatch
(
applyModel
.
DetailList
,
trans
);
}
int
outOrInId
=
0
;
if
(
applyModel
.
CheckStatus
==
PropertyCheckStatusEnum
.
InventoryLosses
)
{
outOrInId
=
supplies_StockOutRepository
.
Insert
(
demodel
);
//编码自动生成
string
BMStr
=
outOrInId
.
ToString
();
if
(
BMStr
.
Length
<
5
)
{
switch
(
BMStr
.
Length
)
{
case
1
:
BMStr
=
"0000"
+
BMStr
;
break
;
case
2
:
BMStr
=
"000"
+
BMStr
;
break
;
case
3
:
BMStr
=
"00"
+
BMStr
;
break
;
case
4
:
BMStr
=
"0"
+
BMStr
;
break
;
}
}
BMStr
=
"CK"
+
DateTime
.
Now
.
ToString
(
"yyyyMMdd"
)
+
BMStr
;
Dictionary
<
string
,
object
>
files
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Supplies_StockOut
.
StockOutNum
),
BMStr
}
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Supplies_StockOut
.
Id
),
FiledValue
=
outOrInId
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
supplies_StockOutRepository
.
Update
(
files
,
wheres
,
trans
);
//新增明细
foreach
(
var
item
in
demodel
.
DetailList
)
{
var
ilist
=
supplies_InventoryRepository
.
GetList
(
new
RB_Supplies_Inventory_Extend
()
{
RB_Group_Id
=
demodel
.
RB_Group_Id
,
WarehouseId
=
demodel
.
WarehouseId
,
SuppliesId
=
item
.
SuppliesId
});
decimal
Price
=
0
;
if
(
ilist
.
Any
())
{
var
iModel
=
ilist
.
FirstOrDefault
();
Price
=
Math
.
Round
((
iModel
.
Money
??
0
)
/
(
iModel
.
Number
??
1
),
2
,
MidpointRounding
.
AwayFromZero
)
*
(
item
.
Number
??
0
);
}
supplies_StockOutDetailRepository
.
Insert
(
new
RB_Supplies_StockOutDetail
()
{
CreateBy
=
demodel
.
CreateBy
,
CreateDate
=
demodel
.
CreateDate
,
Number
=
item
.
Number
,
Money
=
Price
,
RB_Branch_Id
=
demodel
.
RB_Branch_Id
,
Id
=
0
,
RB_Group_Id
=
demodel
.
RB_Group_Id
,
Remark
=
item
.
Remark
,
Status
=
0
,
StockOutId
=
Id
,
SuppliesId
=
item
.
SuppliesId
,
UpdateBy
=
demodel
.
UpdateBy
,
UpdateDate
=
demodel
.
UpdateDate
},
trans
);
//新增库存表数据
if
(
ilist
.
Any
()
&&
demodel
.
StockOutState
==
StockOutStatusEnum
.
StockOut
)
{
var
iModel
=
ilist
.
FirstOrDefault
();
iModel
.
Number
-=
item
.
Number
;
//减少库存
iModel
.
Money
-=
Price
;
if
(
iModel
.
Money
<
0
)
{
iModel
.
Money
=
0
;
}
var
iflag
=
supplies_InventoryRepository
.
Update
(
iModel
,
trans
);
if
(
iflag
)
{
//增加库存明细
supplies_InventoryDetailRepository
.
Insert
(
new
RB_Supplies_InventoryDetail
()
{
CreateBy
=
demodel
.
CreateBy
,
CreateDate
=
DateTime
.
Now
,
InventoryId
=
iModel
.
Id
,
Number
=
item
.
Number
,
Money
=
Price
,
RB_Branch_Id
=
demodel
.
RB_Branch_Id
,
RB_Group_Id
=
demodel
.
RB_Group_Id
,
Status
=
0
,
Type
=
2
,
Id
=
0
,
Description
=
"商品盘亏-出库"
},
trans
);
}
}
}
}
else
if
(
applyModel
.
CheckStatus
==
PropertyCheckStatusEnum
.
InventoryProfit
)
{
inDemodel
.
StockInState
=
StockInStatusEnum
.
StockIn
;
outOrInId
=
supplies_StockInRepository
.
Insert
(
inDemodel
,
trans
);
//编码自动生成
string
BMStr
=
outOrInId
.
ToString
();
if
(
BMStr
.
Length
<
5
)
{
switch
(
BMStr
.
Length
)
{
case
1
:
BMStr
=
"0000"
+
BMStr
;
break
;
case
2
:
BMStr
=
"000"
+
BMStr
;
break
;
case
3
:
BMStr
=
"00"
+
BMStr
;
break
;
case
4
:
BMStr
=
"0"
+
BMStr
;
break
;
}
}
BMStr
=
"RK"
+
DateTime
.
Now
.
ToString
(
"yyyyMMdd"
)
+
BMStr
;
Dictionary
<
string
,
object
>
files
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Supplies_StockIn
.
StockInNum
),
BMStr
}
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Supplies_StockIn
.
Id
),
FiledValue
=
outOrInId
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
supplies_StockInRepository
.
Update
(
files
,
wheres
,
trans
);
//新增明细
foreach
(
var
item
in
inDemodel
.
DetailList
)
{
supplies_StockInDetailRepository
.
Insert
(
new
RB_Supplies_StockInDetail
()
{
CreateBy
=
demodel
.
CreateBy
,
CreateDate
=
demodel
.
CreateDate
,
Money
=
item
.
Money
,
Number
=
item
.
Number
,
RB_Branch_Id
=
demodel
.
RB_Branch_Id
,
Id
=
0
,
RB_Group_Id
=
demodel
.
RB_Group_Id
,
Remark
=
item
.
Remark
,
Status
=
0
,
StockInId
=
Id
,
SuppliesId
=
item
.
SuppliesId
,
UnitPrice
=
item
.
UnitPrice
,
UpdateBy
=
demodel
.
UpdateBy
,
UpdateDate
=
demodel
.
UpdateDate
},
trans
);
//新增库存表数据
var
ilist
=
supplies_InventoryRepository
.
GetList
(
new
RB_Supplies_Inventory_Extend
()
{
RB_Group_Id
=
demodel
.
RB_Group_Id
,
WarehouseId
=
demodel
.
WarehouseId
,
SuppliesId
=
item
.
SuppliesId
});
if
(
ilist
.
Any
())
{
var
iModel
=
ilist
.
FirstOrDefault
();
iModel
.
Number
+=
item
.
Number
;
//增加库存
iModel
.
Money
+=
item
.
Money
;
var
iflag
=
supplies_InventoryRepository
.
Update
(
iModel
,
trans
);
if
(
iflag
)
{
//增加库存明细
supplies_InventoryDetailRepository
.
Insert
(
new
RB_Supplies_InventoryDetail
()
{
CreateBy
=
demodel
.
CreateBy
,
CreateDate
=
DateTime
.
Now
,
InventoryId
=
iModel
.
Id
,
Number
=
item
.
Number
,
Money
=
item
.
Money
,
RB_Branch_Id
=
demodel
.
RB_Branch_Id
,
RB_Group_Id
=
demodel
.
RB_Group_Id
,
Status
=
0
,
Type
=
1
,
Id
=
0
,
Description
=
"商品盘赢-入库"
},
trans
);
}
}
else
{
//新增库存表
int
iId
=
supplies_InventoryRepository
.
Insert
(
new
RB_Supplies_Inventory
()
{
CreateBy
=
demodel
.
CreateBy
,
CreateDate
=
DateTime
.
Now
,
Id
=
0
,
Number
=
item
.
Number
,
Money
=
item
.
Money
,
RB_Branch_Id
=
demodel
.
RB_Branch_Id
,
RB_Group_Id
=
demodel
.
RB_Group_Id
,
Status
=
0
,
SuppliesId
=
item
.
SuppliesId
,
UpdateBy
=
demodel
.
UpdateBy
,
UpdateDate
=
demodel
.
UpdateDate
,
WarehouseId
=
demodel
.
WarehouseId
},
trans
);
if
(
iId
>
0
)
{
//增加库存明细
supplies_InventoryDetailRepository
.
Insert
(
new
RB_Supplies_InventoryDetail
()
{
CreateBy
=
demodel
.
CreateBy
,
CreateDate
=
DateTime
.
Now
,
InventoryId
=
iId
,
Number
=
item
.
Number
,
Money
=
item
.
Money
,
RB_Branch_Id
=
demodel
.
RB_Branch_Id
,
RB_Group_Id
=
demodel
.
RB_Group_Id
,
Status
=
0
,
Type
=
1
,
Id
=
0
,
Description
=
"商品盘赢-入库"
},
trans
);
}
}
}
}
//更新申请单的出库状态
Dictionary
<
string
,
object
>
filesApply
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Supplies_ReportLossRecord
.
OutOrInId
),
outOrInId
}
};
List
<
WhereHelper
>
wheresApply
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Supplies_ReportLossRecord
.
Id
),
FiledValue
=
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
suppliesReportLossRecordRepository
.
Update
(
filesApply
,
wheresApply
,
trans
);
}
suppliesReportLossRecordRepository
.
DBSession
.
Commit
();
return
Id
>
0
;
}
catch
(
Exception
ex
)
{
suppliesReportLossRecordRepository
.
DBSession
.
Rollback
(
"SetReportLossRecord"
);
LogHelper
.
Write
(
ex
,
"SetReportLossRecord"
);
return
false
;
}
}
#
endregion
}
}
}
}
Property.Repository/Supplies/RB_Supplies_CheckRepository.cs
View file @
b6b616f2
...
@@ -78,6 +78,10 @@ namespace Property.Repository
...
@@ -78,6 +78,10 @@ namespace Property.Repository
{
{
where
+=
" and "
+
nameof
(
RB_Supplies_Check_Extend
.
WarehouseId
)
+
"="
+
dmodel
.
WarehouseId
;
where
+=
" and "
+
nameof
(
RB_Supplies_Check_Extend
.
WarehouseId
)
+
"="
+
dmodel
.
WarehouseId
;
}
}
if
(
dmodel
.
Id
>
0
)
{
where
+=
" and "
+
nameof
(
RB_Supplies_Check_Extend
.
Id
)
+
"="
+
dmodel
.
Id
;
}
if
(
dmodel
.
CheckState
.
HasValue
&&
dmodel
.
CheckState
>
0
)
if
(
dmodel
.
CheckState
.
HasValue
&&
dmodel
.
CheckState
>
0
)
{
{
where
+=
" and "
+
nameof
(
RB_Supplies_Check_Extend
.
CheckState
)
+
"="
+
(
int
)
dmodel
.
CheckState
;
where
+=
" and "
+
nameof
(
RB_Supplies_Check_Extend
.
CheckState
)
+
"="
+
(
int
)
dmodel
.
CheckState
;
...
...
Property.Repository/Supplies/RB_Supplies_ReportLossRecordDetailRepository.cs
0 → 100644
View file @
b6b616f2
using
Property.Model.Entity
;
using
Property.Model.Extend.Supplies
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
namespace
Property.Repository.Supplies
{
public
class
RB_Supplies_ReportLossRecordDetailRepository
:
RepositoryBase
<
RB_Supplies_ReportLossRecordDetail
>
{
public
string
TableName
{
get
{
return
nameof
(
RB_Supplies_ReportLossRecordDetail
);
}
}
/// <summary>
/// 盘点报损分页
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public
List
<
RB_Supplies_ReportLossRecordDetail_Extend
>
GetWarehouseOutPageList
(
int
pageIndex
,
int
pageSize
,
out
long
rowCount
,
RB_Supplies_ReportLossRecordDetail_Extend
query
)
{
StringBuilder
builder
=
new
StringBuilder
();
builder
.
Append
(
$" select * from
{
TableName
}
as a where a.Status=0 "
);
if
(
query
!=
null
)
{
if
(
query
.
Id
>
0
)
{
builder
.
Append
(
$" AND a.
{
nameof
(
RB_Supplies_ReportLossRecordDetail_Extend
.
Id
)}
=
{
query
.
Id
}
"
);
}
if
(
query
.
SuppliesId
>
0
)
{
builder
.
Append
(
$" AND a.
{
nameof
(
RB_Supplies_ReportLossRecordDetail_Extend
.
SuppliesId
)}
=
{
query
.
SuppliesId
}
"
);
}
if
(
query
.
ReportLossRecordId
>
0
)
{
builder
.
Append
(
$" AND a.
{
nameof
(
RB_Supplies_ReportLossRecordDetail_Extend
.
ReportLossRecordId
)}
=
{
query
.
ReportLossRecordId
}
"
);
}
}
return
GetPage
<
RB_Supplies_ReportLossRecordDetail_Extend
>(
pageIndex
,
pageSize
,
out
rowCount
,
builder
.
ToString
()).
ToList
();
}
/// <summary>
/// 盘点报损列表
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public
List
<
RB_Supplies_ReportLossRecordDetail_Extend
>
GetWarehouseOutList
(
RB_Supplies_ReportLossRecordDetail_Extend
query
)
{
StringBuilder
builder
=
new
StringBuilder
();
builder
.
Append
(
$" select * from
{
TableName
}
as a where a.Status=0 "
);
if
(
query
!=
null
)
{
if
(
query
.
Id
>
0
)
{
builder
.
Append
(
$" AND a.
{
nameof
(
RB_Supplies_ReportLossRecordDetail_Extend
.
Id
)}
=
{
query
.
Id
}
"
);
}
if
(
query
.
SuppliesId
>
0
)
{
builder
.
Append
(
$" AND a.
{
nameof
(
RB_Supplies_ReportLossRecordDetail_Extend
.
SuppliesId
)}
=
{
query
.
SuppliesId
}
"
);
}
if
(
query
.
ReportLossRecordId
>
0
)
{
builder
.
Append
(
$" AND a.
{
nameof
(
RB_Supplies_ReportLossRecordDetail_Extend
.
ReportLossRecordId
)}
=
{
query
.
ReportLossRecordId
}
"
);
}
}
return
Get
<
RB_Supplies_ReportLossRecordDetail_Extend
>(
builder
.
ToString
()).
ToList
();
}
}
}
Property.Repository/Supplies/RB_Supplies_ReportLossRecordRepository.cs
0 → 100644
View file @
b6b616f2
using
Property.Model.Entity
;
using
Property.Model.Extend.Supplies
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
namespace
Property.Repository.Supplies
{
public
class
RB_Supplies_ReportLossRecordRepository
:
RepositoryBase
<
RB_Supplies_ReportLossRecord
>
{
public
string
TableName
{
get
{
return
nameof
(
RB_Supplies_ReportLossRecord
);
}
}
/// <summary>
/// 盘点报损分页
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public
List
<
RB_Supplies_ReportLossRecord_Extend
>
GetSuppliesReportLossRecordPageList
(
int
pageIndex
,
int
pageSize
,
out
long
rowCount
,
RB_Supplies_ReportLossRecord_Extend
query
)
{
StringBuilder
builder
=
new
StringBuilder
();
builder
.
Append
(
$" select * from
{
TableName
}
as a where a.Status=0 "
);
if
(
query
!=
null
)
{
if
(
query
.
Id
>
0
)
{
builder
.
Append
(
$" AND a.
{
nameof
(
RB_Supplies_ReportLossRecord_Extend
.
Id
)}
=
{
query
.
Id
}
"
);
}
if
(
query
.
WarehouseId
>
0
)
{
builder
.
Append
(
$" AND a.
{
nameof
(
RB_Supplies_ReportLossRecord_Extend
.
WarehouseId
)}
=
{
query
.
WarehouseId
}
"
);
}
if
(
query
.
CheckId
>
0
)
{
builder
.
Append
(
$" AND a.
{
nameof
(
RB_Supplies_ReportLossRecord_Extend
.
CheckId
)}
=
{
query
.
CheckId
}
"
);
}
if
(
query
.
CheckStatus
.
HasValue
&&
query
.
CheckStatus
>
0
)
{
builder
.
Append
(
$" AND a.
{
nameof
(
RB_Supplies_ReportLossRecord_Extend
.
CheckStatus
)}
=
{(
int
)
query
.
CheckStatus
}
"
);
}
}
return
GetPage
<
RB_Supplies_ReportLossRecord_Extend
>(
pageIndex
,
pageSize
,
out
rowCount
,
builder
.
ToString
()).
ToList
();
}
/// <summary>
/// 盘点报损列表
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public
List
<
RB_Supplies_ReportLossRecord_Extend
>
GetWarehouseOutList
(
RB_Supplies_ReportLossRecord_Extend
query
)
{
StringBuilder
builder
=
new
StringBuilder
();
builder
.
Append
(
$" select * from
{
TableName
}
as a where a.Status=0 "
);
if
(
query
!=
null
)
{
if
(
query
.
Id
>
0
)
{
builder
.
Append
(
$" AND a.
{
nameof
(
RB_Supplies_ReportLossRecord_Extend
.
Id
)}
=
{
query
.
Id
}
"
);
}
if
(
query
.
WarehouseId
>
0
)
{
builder
.
Append
(
$" AND a.
{
nameof
(
RB_Supplies_ReportLossRecord_Extend
.
WarehouseId
)}
=
{
query
.
WarehouseId
}
"
);
}
if
(
query
.
CheckId
>
0
)
{
builder
.
Append
(
$" AND a.
{
nameof
(
RB_Supplies_ReportLossRecord_Extend
.
CheckId
)}
=
{
query
.
CheckId
}
"
);
}
if
(
query
.
CheckStatus
.
HasValue
&&
query
.
CheckStatus
>
0
)
{
builder
.
Append
(
$" AND a.
{
nameof
(
RB_Supplies_ReportLossRecord_Extend
.
CheckStatus
)}
=
{(
int
)
query
.
CheckStatus
}
"
);
}
}
return
Get
<
RB_Supplies_ReportLossRecord_Extend
>(
builder
.
ToString
()).
ToList
();
}
}
}
Property.WebApi/Controllers/Mall/WarehouseOutController.cs
View file @
b6b616f2
...
@@ -228,7 +228,7 @@ namespace Property.WebApi.Controllers.Mall
...
@@ -228,7 +228,7 @@ namespace Property.WebApi.Controllers.Mall
//判断当前仓库是否在盘点中2020-07-28 Add By:W
//判断当前仓库是否在盘点中2020-07-28 Add By:W
var
suppliesCheckList
=
suppliesModule
.
GetSuppliesCheckList
(
new
RB_Supplies_Check_Extend
{
RB_Group_Id
=
userInfo
.
RB_Group_id
,
StartDate
=
System
.
DateTime
.
Now
,
EndDate
=
System
.
DateTime
.
Now
,
WarehouseId
=
applyModel
.
WarehouseId
,
CheckState
=
REBORN
.
Common
.
Enum
.
SuppliesCheckStatusEnum
.
InTheInventory
});
var
suppliesCheckList
=
suppliesModule
.
GetSuppliesCheckList
(
new
RB_Supplies_Check_Extend
{
RB_Group_Id
=
userInfo
.
RB_Group_id
,
StartDate
=
System
.
DateTime
.
Now
,
EndDate
=
System
.
DateTime
.
Now
,
WarehouseId
=
applyModel
.
WarehouseId
,
CheckState
=
REBORN
.
Common
.
Enum
.
SuppliesCheckStatusEnum
.
InTheInventory
});
if
(
suppliesCheckList
!=
null
&&
suppliesCheckList
.
Any
())
if
(
suppliesCheckList
!=
null
&&
suppliesCheckList
.
Any
())
{
{
return
ApiResult
.
ParamIsNull
(
"仓库盘点中,不能出库"
);
return
ApiResult
.
ParamIsNull
(
"仓库盘点中,不能出库"
);
...
@@ -263,7 +263,8 @@ namespace Property.WebApi.Controllers.Mall
...
@@ -263,7 +263,8 @@ namespace Property.WebApi.Controllers.Mall
//判断此次商品是否已出库与数量是否相等
//判断此次商品是否已出库与数量是否相等
applyModel
.
WarehouseOutGoodsList
=
new
List
<
RB_WarehouseOut_Goods_Extend
>();
applyModel
.
WarehouseOutGoodsList
=
new
List
<
RB_WarehouseOut_Goods_Extend
>();
var
goodsList
=
applyModel
.
WarehouseOutGoodsDetailList
.
GroupBy
(
x
=>
x
.
OrderGoodsId
);
// var goodsList = applyModel.WarehouseOutGoodsDetailList.GroupBy(x => x.OrderGoodsId);
var
goodsList
=
applyModel
.
WarehouseOutGoodsDetailList
.
GroupBy
(
x
=>
new
{
x
.
OrderGoodsId
,
x
.
GoodsId
,
x
.
SpecificationSort
});
oldModel
.
RB_Group_Id
=
userInfo
.
RB_Group_id
;
oldModel
.
RB_Group_Id
=
userInfo
.
RB_Group_id
;
applyModel
.
RB_Branch_Id
=
oldModel
.
RB_Branch_Id
;
applyModel
.
RB_Branch_Id
=
oldModel
.
RB_Branch_Id
;
applyModel
.
RB_Group_Id
=
oldModel
.
RB_Group_Id
;
applyModel
.
RB_Group_Id
=
oldModel
.
RB_Group_Id
;
...
@@ -273,33 +274,32 @@ namespace Property.WebApi.Controllers.Mall
...
@@ -273,33 +274,32 @@ namespace Property.WebApi.Controllers.Mall
var
wareHouseGoodsList
=
warehouseOutModule
.
GetOuGoodsByWarehouseId
(
oldModel
);
var
wareHouseGoodsList
=
warehouseOutModule
.
GetOuGoodsByWarehouseId
(
oldModel
);
foreach
(
var
item
in
goodsList
)
foreach
(
var
item
in
goodsList
)
{
{
var
oldOrderGoods
=
oldModel
.
WarehouseOutGoodsList
.
Where
(
x
=>
x
.
OrderGoodsId
==
item
.
Key
).
FirstOrDefault
();
var
oldOrderGoods
=
oldModel
.
WarehouseOutGoodsList
.
Where
(
x
=>
x
.
OrderGoodsId
==
item
.
Key
.
OrderGoodsId
&&
x
.
NewGoodsId
==
item
.
Key
.
GoodsId
&&
x
.
NewSpecificationSort
==
item
.
Key
.
SpecificationSort
).
FirstOrDefault
();
applyModel
.
WarehouseOutGoodsDetailList
.
Where
(
x
=>
x
.
OrderGoodsId
==
item
.
Key
).
ToList
().
ForEach
(
x
=>
x
.
OrderId
=
oldOrderGoods
.
OrderId
);
applyModel
.
WarehouseOutGoodsDetailList
.
Where
(
x
=>
x
.
OrderGoodsId
==
item
.
Key
.
OrderGoodsId
&&
x
.
GoodsId
==
item
.
Key
.
GoodsId
&&
x
.
SpecificationSort
==
item
.
Key
.
SpecificationSort
).
ToList
().
ForEach
(
x
=>
x
.
OrderId
=
oldOrderGoods
.
OrderId
);
applyModel
.
WarehouseOutGoodsDetailList
.
Where
(
x
=>
x
.
OrderGoodsId
==
item
.
Key
).
ToList
().
ForEach
(
x
=>
x
.
GoodsId
=
oldOrderGoods
.
GoodsId
);
applyModel
.
WarehouseOutGoodsDetailList
.
Where
(
x
=>
x
.
OrderGoodsId
==
item
.
Key
.
OrderGoodsId
&&
x
.
GoodsId
==
item
.
Key
.
GoodsId
&&
x
.
SpecificationSort
==
item
.
Key
.
SpecificationSort
).
ToList
().
ForEach
(
x
=>
x
.
GoodsId
=
oldOrderGoods
.
New
GoodsId
);
applyModel
.
WarehouseOutGoodsDetailList
.
Where
(
x
=>
x
.
OrderGoodsId
==
item
.
Key
).
ToList
().
ForEach
(
x
=>
x
.
GoodsName
=
oldOrderGoods
.
GoodsName
);
applyModel
.
WarehouseOutGoodsDetailList
.
Where
(
x
=>
x
.
OrderGoodsId
==
item
.
Key
.
OrderGoodsId
&&
x
.
GoodsId
==
item
.
Key
.
GoodsId
&&
x
.
SpecificationSort
==
item
.
Key
.
SpecificationSort
).
ToList
().
ForEach
(
x
=>
x
.
GoodsName
=
oldOrderGoods
.
New
GoodsName
);
applyModel
.
WarehouseOutGoodsDetailList
.
Where
(
x
=>
x
.
OrderGoodsId
==
item
.
Key
).
ToList
().
ForEach
(
x
=>
x
.
Specification
=
oldOrderGoods
.
NewSpecification
);
applyModel
.
WarehouseOutGoodsDetailList
.
Where
(
x
=>
x
.
OrderGoodsId
==
item
.
Key
.
OrderGoodsId
&&
x
.
GoodsId
==
item
.
Key
.
GoodsId
&&
x
.
SpecificationSort
==
item
.
Key
.
SpecificationSort
).
ToList
().
ForEach
(
x
=>
x
.
Specification
=
oldOrderGoods
.
NewSpecification
);
applyModel
.
WarehouseOutGoodsDetailList
.
Where
(
x
=>
x
.
OrderGoodsId
==
item
.
Key
).
ToList
().
ForEach
(
x
=>
x
.
SpecificationSort
=
oldOrderGoods
.
NewSpecificationSort
);
applyModel
.
WarehouseOutGoodsDetailList
.
Where
(
x
=>
x
.
OrderGoodsId
==
item
.
Key
.
OrderGoodsId
&&
x
.
GoodsId
==
item
.
Key
.
GoodsId
&&
x
.
SpecificationSort
==
item
.
Key
.
SpecificationSort
).
ToList
().
ForEach
(
x
=>
x
.
SpecificationSort
=
oldOrderGoods
.
NewSpecificationSort
);
applyModel
.
WarehouseOutGoodsDetailList
.
Where
(
x
=>
x
.
OrderGoodsId
==
item
.
Key
).
ToList
().
ForEach
(
x
=>
x
.
ProductCode
=
oldOrderGoods
.
ProductCode
);
applyModel
.
WarehouseOutGoodsDetailList
.
Where
(
x
=>
x
.
OrderGoodsId
==
item
.
Key
.
OrderGoodsId
&&
x
.
GoodsId
==
item
.
Key
.
GoodsId
&&
x
.
SpecificationSort
==
item
.
Key
.
SpecificationSort
).
ToList
().
ForEach
(
x
=>
x
.
ProductCode
=
oldOrderGoods
.
ProductCode
);
applyModel
.
WarehouseOutGoodsDetailList
.
Where
(
x
=>
x
.
OrderGoodsId
==
item
.
Key
).
ToList
().
ForEach
(
x
=>
x
.
TenantId
=
oldOrderGoods
.
TenantId
);
applyModel
.
WarehouseOutGoodsDetailList
.
Where
(
x
=>
x
.
OrderGoodsId
==
item
.
Key
.
OrderGoodsId
&&
x
.
GoodsId
==
item
.
Key
.
GoodsId
&&
x
.
SpecificationSort
==
item
.
Key
.
SpecificationSort
).
ToList
().
ForEach
(
x
=>
x
.
TenantId
=
oldOrderGoods
.
TenantId
);
applyModel
.
WarehouseOutGoodsDetailList
.
Where
(
x
=>
x
.
OrderGoodsId
==
item
.
Key
).
ToList
().
ForEach
(
x
=>
x
.
MallBaseId
=
oldOrderGoods
.
MallBaseId
);
applyModel
.
WarehouseOutGoodsDetailList
.
Where
(
x
=>
x
.
OrderGoodsId
==
item
.
Key
.
OrderGoodsId
&&
x
.
GoodsId
==
item
.
Key
.
GoodsId
&&
x
.
SpecificationSort
==
item
.
Key
.
SpecificationSort
).
ToList
().
ForEach
(
x
=>
x
.
MallBaseId
=
oldOrderGoods
.
MallBaseId
);
if
(
oldOrderGoods
==
null
)
if
(
oldOrderGoods
==
null
)
{
{
var
nowOrderGoods
=
applyModel
.
WarehouseOutGoodsDetailList
.
Where
(
x
=>
x
.
OrderGoodsId
==
item
.
Key
).
FirstOrDefault
();
var
nowOrderGoods
=
applyModel
.
WarehouseOutGoodsDetailList
.
Where
(
x
=>
x
.
OrderGoodsId
==
item
.
Key
.
OrderGoodsId
&&
x
.
GoodsId
==
item
.
Key
.
GoodsId
&&
x
.
SpecificationSort
==
item
.
Key
.
SpecificationSort
).
FirstOrDefault
();
return
ApiResult
.
Failed
(
"商品不属于出库单,请核实后再出库"
);
return
ApiResult
.
Failed
(
"商品不属于出库单,请核实后再出库"
);
}
}
else
if
(
oldOrderGoods
.
IsOut
==
1
)
else
if
(
oldOrderGoods
.
IsOut
==
1
)
{
{
return
ApiResult
.
Failed
(
"订单号:"
+
oldOrderGoods
.
OrderNo
+
"商品名称:"
+
oldOrderGoods
.
GoodsName
+
"申请单中已出库"
);
return
ApiResult
.
Failed
(
"订单号:"
+
oldOrderGoods
.
OrderNo
+
"商品名称:"
+
oldOrderGoods
.
GoodsName
+
"申请单中已出库"
);
}
}
var
nowGoodsList
=
applyModel
.
WarehouseOutGoodsDetailList
.
Where
(
x
=>
x
.
OrderGoodsId
==
item
.
Key
.
OrderGoodsId
&&
x
.
GoodsId
==
item
.
Key
.
GoodsId
&&
x
.
SpecificationSort
==
item
.
Key
.
SpecificationSort
);
var
nowGoodsList
=
applyModel
.
WarehouseOutGoodsDetailList
.
Where
(
x
=>
x
.
OrderGoodsId
==
item
.
Key
);
int
goodsCount
=
nowGoodsList
.
Count
();
int
goodsCount
=
nowGoodsList
.
Count
();
if
(
oldOrderGoods
.
NewNumber
!=
goodsCount
)
if
(
oldOrderGoods
.
NewNumber
!=
goodsCount
)
{
{
return
ApiResult
.
Failed
(
"订单号:"
+
oldOrderGoods
.
OrderNo
+
"商品名称:"
+
oldOrderGoods
.
GoodsName
+
"必须一起出库"
);
return
ApiResult
.
Failed
(
"订单号:"
+
oldOrderGoods
.
OrderNo
+
"商品名称:"
+
oldOrderGoods
.
GoodsName
+
"必须一起出库"
);
}
}
if
(!
wareHouseGoodsList
.
Any
(
x
=>
x
.
OrderGoodsId
==
item
.
Key
))
if
(!
wareHouseGoodsList
.
Any
(
x
=>
x
.
OrderGoodsId
==
item
.
Key
.
OrderGoodsId
&&
x
.
GoodsId
==
item
.
Key
.
GoodsId
&&
x
.
SpecificationSort
==
item
.
Key
.
SpecificationSort
))
{
{
return
ApiResult
.
Failed
(
"订单号:"
+
oldOrderGoods
.
OrderNo
+
"商品名称:"
+
oldOrderGoods
.
GoodsName
+
"没在当前仓库"
);
return
ApiResult
.
Failed
(
"订单号:"
+
oldOrderGoods
.
OrderNo
+
"商品名称:"
+
oldOrderGoods
.
GoodsName
+
"没在当前仓库"
);
}
}
...
@@ -307,7 +307,6 @@ namespace Property.WebApi.Controllers.Mall
...
@@ -307,7 +307,6 @@ namespace Property.WebApi.Controllers.Mall
oldOrderGoods
.
CostMoney
=
nowGoodsList
.
Sum
(
x
=>
x
.
CostMoney
??
0
);
oldOrderGoods
.
CostMoney
=
nowGoodsList
.
Sum
(
x
=>
x
.
CostMoney
??
0
);
applyModel
.
WarehouseOutGoodsList
.
Add
(
oldOrderGoods
);
applyModel
.
WarehouseOutGoodsList
.
Add
(
oldOrderGoods
);
RB_Finance_RecordDetail
financeRecordDetail
=
new
RB_Finance_RecordDetail
RB_Finance_RecordDetail
financeRecordDetail
=
new
RB_Finance_RecordDetail
{
{
ID
=
0
,
ID
=
0
,
...
@@ -328,6 +327,18 @@ namespace Property.WebApi.Controllers.Mall
...
@@ -328,6 +327,18 @@ namespace Property.WebApi.Controllers.Mall
record
.
RecordDetailList
.
Add
(
financeRecordDetail
);
record
.
RecordDetailList
.
Add
(
financeRecordDetail
);
}
}
//2020-07-29 Add By:W 判断同一个订单商品拆分后的商品是否是一起出库
var
orderGoodsList
=
applyModel
.
WarehouseOutGoodsDetailList
.
GroupBy
(
x
=>
x
.
OrderGoodsId
);
foreach
(
var
item
in
orderGoodsList
)
{
var
oldOrderGoodsList
=
oldModel
.
WarehouseOutGoodsList
.
Where
(
x
=>
x
.
OrderGoodsId
==
item
.
Key
);
var
outGoodsList
=
applyModel
.
WarehouseOutGoodsDetailList
.
Where
(
x
=>
x
.
OrderGoodsId
==
item
.
Key
);
if
(
oldOrderGoodsList
.
Count
()!=
outGoodsList
.
Count
())
{
return
ApiResult
.
Failed
(
"订单号:"
+
oldOrderGoodsList
.
FirstOrDefault
()?.
OrderNo
+
"中的商品必须一起出库"
);
}
}
if
(
oldModel
.
WarehouseOutGoodsList
.
Where
(
x
=>
x
.
IsOut
==
0
).
Count
()
==
wareHouseGoodsList
.
Count
())
if
(
oldModel
.
WarehouseOutGoodsList
.
Where
(
x
=>
x
.
IsOut
==
0
).
Count
()
==
wareHouseGoodsList
.
Count
())
{
{
...
...
Property.WebApi/Controllers/Property/SuppliesController.cs
View file @
b6b616f2
...
@@ -9,6 +9,8 @@ using REBORN.Common.Plugin;
...
@@ -9,6 +9,8 @@ using REBORN.Common.Plugin;
using
Property.Module.FixedAssets
;
using
Property.Module.FixedAssets
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
Property.Model.Extend.Supplies
;
using
Google.Protobuf.WellKnownTypes
;
namespace
Property.WebApi.Controllers.User
namespace
Property.WebApi.Controllers.User
{
{
...
@@ -1806,7 +1808,7 @@ namespace Property.WebApi.Controllers.User
...
@@ -1806,7 +1808,7 @@ namespace Property.WebApi.Controllers.User
/// </summary>
/// </summary>
/// <returns></returns>
/// <returns></returns>
[
HttpPost
]
[
HttpPost
]
public
ApiResult
SetSuppliesCheckComplete
()
public
ApiResult
SetSuppliesCheckComplete
()
{
{
RequestParm
requestParm
=
GetRequestParm
();
RequestParm
requestParm
=
GetRequestParm
();
UserInfo
userInfo
=
CacheManager
.
User
.
UserReidsCache
.
GetUserLoginInfo
(
requestParm
.
uid
);
UserInfo
userInfo
=
CacheManager
.
User
.
UserReidsCache
.
GetUserLoginInfo
(
requestParm
.
uid
);
...
@@ -1917,7 +1919,7 @@ namespace Property.WebApi.Controllers.User
...
@@ -1917,7 +1919,7 @@ namespace Property.WebApi.Controllers.User
var
sdmodel
=
suppliesModule
.
GetSuppliesCheckDetailInfo
(
CheckDetailId
);
var
sdmodel
=
suppliesModule
.
GetSuppliesCheckDetailInfo
(
CheckDetailId
);
if
(
sdmodel
==
null
)
{
return
ApiResult
.
Failed
(
"盘点单不存在"
);
}
if
(
sdmodel
==
null
)
{
return
ApiResult
.
Failed
(
"盘点单不存在"
);
}
if
(
Type
==
1
&&
(
sdmodel
.
CheckStatus
==
REBORN
.
Common
.
Enum
.
PropertyCheckStatusEnum
.
InventoryProfit
||
sdmodel
.
CheckStatus
==
REBORN
.
Common
.
Enum
.
PropertyCheckStatusEnum
.
InventoryLosses
)
&&
sdmodel
.
DealStatus
==
1
)
if
(
Type
==
1
&&
(
sdmodel
.
CheckStatus
==
REBORN
.
Common
.
Enum
.
PropertyCheckStatusEnum
.
InventoryProfit
||
sdmodel
.
CheckStatus
==
REBORN
.
Common
.
Enum
.
PropertyCheckStatusEnum
.
InventoryLosses
)
&&
sdmodel
.
DealStatus
==
1
)
{
{
return
ApiResult
.
Failed
(
"该耗材已报溢/报损处理,无法修改数量"
);
return
ApiResult
.
Failed
(
"该耗材已报溢/报损处理,无法修改数量"
);
}
}
...
@@ -1937,20 +1939,24 @@ namespace Property.WebApi.Controllers.User
...
@@ -1937,20 +1939,24 @@ namespace Property.WebApi.Controllers.User
/// </summary>
/// </summary>
/// <returns></returns>
/// <returns></returns>
[
HttpPost
]
[
HttpPost
]
public
ApiResult
SetBatchSuppliesCheckDetailReality
()
public
ApiResult
SetBatchSuppliesCheckDetailReality
()
{
{
var
requestParm
=
GetRequestParm
();
var
requestParm
=
GetRequestParm
();
UserInfo
userInfo
=
CacheManager
.
User
.
UserReidsCache
.
GetUserLoginInfo
(
requestParm
.
uid
);
UserInfo
userInfo
=
CacheManager
.
User
.
UserReidsCache
.
GetUserLoginInfo
(
requestParm
.
uid
);
List
<
RB_Supplies_CheckDetail_Extend
>
list
=
JsonConvert
.
DeserializeObject
<
List
<
RB_Supplies_CheckDetail_Extend
>>(
requestParm
.
msg
.
ToString
());
List
<
RB_Supplies_CheckDetail_Extend
>
list
=
JsonConvert
.
DeserializeObject
<
List
<
RB_Supplies_CheckDetail_Extend
>>(
requestParm
.
msg
.
ToString
());
if
(!
list
.
Any
())
{
if
(!
list
.
Any
())
{
return
ApiResult
.
ParamIsNull
(
"请传递列表"
);
return
ApiResult
.
ParamIsNull
(
"请传递列表"
);
}
}
foreach
(
var
item
in
list
)
{
foreach
(
var
item
in
list
)
if
(
item
.
Id
<=
0
)
{
{
if
(
item
.
Id
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递盘点单明细id"
);
return
ApiResult
.
ParamIsNull
(
"请传递盘点单明细id"
);
}
}
if
((
item
.
RealityNum
??
0
)
<
0
)
{
if
((
item
.
RealityNum
??
0
)
<
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递实际库存数量"
);
return
ApiResult
.
ParamIsNull
(
"请传递实际库存数量"
);
}
}
}
}
...
@@ -1959,7 +1965,8 @@ namespace Property.WebApi.Controllers.User
...
@@ -1959,7 +1965,8 @@ namespace Property.WebApi.Controllers.User
{
{
return
ApiResult
.
Success
();
return
ApiResult
.
Success
();
}
}
else
{
else
{
return
ApiResult
.
Failed
();
return
ApiResult
.
Failed
();
}
}
}
}
...
@@ -1969,7 +1976,8 @@ namespace Property.WebApi.Controllers.User
...
@@ -1969,7 +1976,8 @@ namespace Property.WebApi.Controllers.User
/// </summary>
/// </summary>
/// <returns></returns>
/// <returns></returns>
[
HttpPost
]
[
HttpPost
]
public
FileContentResult
GetSuppliesCheckDetailToExcel
()
{
public
FileContentResult
GetSuppliesCheckDetailToExcel
()
{
var
requestParm
=
GetRequestParm
();
var
requestParm
=
GetRequestParm
();
UserInfo
userInfo
=
CacheManager
.
User
.
UserReidsCache
.
GetUserLoginInfo
(
requestParm
.
uid
);
UserInfo
userInfo
=
CacheManager
.
User
.
UserReidsCache
.
GetUserLoginInfo
(
requestParm
.
uid
);
RB_Supplies_CheckDetail_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Supplies_CheckDetail_Extend
>(
requestParm
.
msg
.
ToString
());
RB_Supplies_CheckDetail_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Supplies_CheckDetail_Extend
>(
requestParm
.
msg
.
ToString
());
...
@@ -2048,7 +2056,8 @@ namespace Property.WebApi.Controllers.User
...
@@ -2048,7 +2056,8 @@ namespace Property.WebApi.Controllers.User
{
{
demodel
.
IsSelectCheckLoss
=
1
;
demodel
.
IsSelectCheckLoss
=
1
;
}
}
if
(
demodel
.
CheckId
<=
0
)
{
if
(
demodel
.
CheckId
<=
0
)
{
return
ApiResult
.
Failed
(
"请传递盘点单id"
);
return
ApiResult
.
Failed
(
"请传递盘点单id"
);
}
}
var
list
=
suppliesModule
.
GetSuppliesCheckDetailBreakagePageList
(
pagelist
.
pageIndex
,
pagelist
.
pageSize
,
demodel
,
out
long
count
);
var
list
=
suppliesModule
.
GetSuppliesCheckDetailBreakagePageList
(
pagelist
.
pageIndex
,
pagelist
.
pageSize
,
demodel
,
out
long
count
);
...
@@ -2076,5 +2085,269 @@ namespace Property.WebApi.Controllers.User
...
@@ -2076,5 +2085,269 @@ namespace Property.WebApi.Controllers.User
}
}
#
endregion
#
endregion
#
region
盘点报损
/// <summary>
/// 保存盘点报损信息
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SetSuppliesReportLoss
()
{
var
requestParm
=
GetRequestParm
();
UserInfo
userInfo
=
CacheManager
.
User
.
UserReidsCache
.
GetUserLoginInfo
(
requestParm
.
uid
);
DateTime
NowStr
=
System
.
DateTime
.
Now
;
RB_Supplies_ReportLossRecord_Extend
applyModel
=
JsonConvert
.
DeserializeObject
<
RB_Supplies_ReportLossRecord_Extend
>(
requestParm
.
msg
.
ToString
());
if
(
applyModel
.
WarehouseId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请选择仓库"
);
}
if
((
applyModel
.
CheckId
??
0
)
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请选择盘点期数"
);
}
if
(
applyModel
.
DetailList
==
null
&&
!
applyModel
.
DetailList
.
Any
())
{
return
ApiResult
.
Failed
(
"请选择您要报损的商品"
);
}
//判断当前仓库是否在盘点中2020-07-28 Add By:W
var
suppliesCheckModel
=
suppliesModule
.
GetSuppliesCheckList
(
new
RB_Supplies_Check_Extend
{
Id
=
applyModel
.
CheckId
??
0
,
RB_Group_Id
=
userInfo
.
RB_Group_id
,
WarehouseId
=
applyModel
.
WarehouseId
}).
FirstOrDefault
();
if
(
suppliesCheckModel
==
null
)
{
return
ApiResult
.
ParamIsNull
(
"盘点期数不存在"
);
}
if
(
suppliesCheckModel
.
CheckState
!=
REBORN
.
Common
.
Enum
.
SuppliesCheckStatusEnum
.
Completed
)
{
return
ApiResult
.
ParamIsNull
(
"盘点未完成不能报损"
);
}
//查询盘点信息
var
checkDetailList
=
suppliesModule
.
GetSuppliesCheckDetailList
(
new
RB_Supplies_CheckDetail_Extend
{
CheckId
=
applyModel
.
CheckId
??
0
,
RB_Group_Id
=
userInfo
.
RB_Group_id
});
foreach
(
var
item
in
applyModel
.
DetailList
)
//判断盘点商品是否已经报损或者是否是损益
{
var
detailModel
=
checkDetailList
.
Where
(
x
=>
x
.
SuppliesId
==
item
.
SuppliesId
).
FirstOrDefault
();
if
(
detailModel
==
null
)
{
return
ApiResult
.
Failed
(
"盘点部分损益商品不属于当前盘点期数"
);
}
if
(
detailModel
.
DealStatus
==
1
)
{
return
ApiResult
.
Failed
(
"盘点部分损益商品已处理"
);
}
int
ReportLossNum
=
((
detailModel
.
RealityNum
??
0
)
-
(
detailModel
.
InventoryNum
??
0
));
if
(
applyModel
.
CheckStatus
==
REBORN
.
Common
.
Enum
.
PropertyCheckStatusEnum
.
InventoryLosses
)
{
if
(
ReportLossNum
>
0
)
{
return
ApiResult
.
Failed
(
"部分盘点商品不是盘亏商品"
);
}
ReportLossNum
=
ReportLossNum
*
-
1
;
}
else
if
(
applyModel
.
CheckStatus
==
REBORN
.
Common
.
Enum
.
PropertyCheckStatusEnum
.
InventoryProfit
)
{
if
(
ReportLossNum
<
0
)
{
return
ApiResult
.
Failed
(
"部分盘点商品不是盘赢商品"
);
}
}
if
(
item
.
ReportLossNum
!=
ReportLossNum
)
{
return
ApiResult
.
Failed
(
"部分盘点商品亏盈数错误"
);
}
}
#
region
出库记录信息
RB_Supplies_StockOut_Extend
demodel
=
new
RB_Supplies_StockOut_Extend
();
//出库申请表,等会儿组装
RB_Supplies_StockIn_Extend
demodelStockIn
=
new
RB_Supplies_StockIn_Extend
();
if
(
applyModel
.
CheckStatus
==
REBORN
.
Common
.
Enum
.
PropertyCheckStatusEnum
.
InventoryLosses
)
//盘亏出库
{
demodel
.
WarehouseId
=
applyModel
.
WarehouseId
;
demodel
.
EmployeeId
=
userInfo
.
EmployeeId
;
demodel
.
CreateBy
=
userInfo
.
EmployeeId
;
demodel
.
StockOutDate
=
NowStr
;
demodel
.
StockOutState
=
REBORN
.
Common
.
Enum
.
StockOutStatusEnum
.
StockOut
;
demodel
.
Remark
=
"电商商品盘点-盘亏出库"
;
demodel
.
Status
=
0
;
demodel
.
RB_Branch_Id
=
userInfo
.
RB_Branch_id
;
demodel
.
RB_Group_Id
=
userInfo
.
RB_Group_id
;
demodel
.
CreateDate
=
NowStr
;
demodel
.
UpdateBy
=
userInfo
.
EmployeeId
;
demodel
.
UpdateDate
=
NowStr
;
demodel
.
DepartmentId
=
userInfo
.
RB_Department_Id
;
demodel
.
BranchId
=
userInfo
.
RB_Branch_id
;
demodel
.
DetailList
=
new
List
<
RB_Supplies_StockOutDetail_Extend
>();
foreach
(
var
item
in
applyModel
.
DetailList
)
{
RB_Supplies_StockOutDetail_Extend
stockOutDetailModel
=
new
RB_Supplies_StockOutDetail_Extend
{
Id
=
0
,
StockOutId
=
0
,
SuppliesId
=
item
.
SuppliesId
,
Number
=
item
.
ReportLossNum
,
Remark
=
"电商商品盘点-盘亏出库"
,
Status
=
0
,
RB_Branch_Id
=
userInfo
.
RB_Branch_id
,
RB_Group_Id
=
userInfo
.
RB_Group_id
,
CreateBy
=
userInfo
.
EmployeeId
,
CreateDate
=
NowStr
,
UpdateBy
=
userInfo
.
EmployeeId
,
UpdateDate
=
NowStr
,
Money
=
item
.
ReportLossPrice
,
};
demodel
.
DetailList
.
Add
(
stockOutDetailModel
);
}
if
(
demodel
.
DetailList
==
null
||
!
demodel
.
DetailList
.
Any
())
{
return
ApiResult
.
ParamIsNull
(
"请选择物料"
);
}
if
(!
demodel
.
StockOutDate
.
HasValue
)
{
return
ApiResult
.
ParamIsNull
(
"请输入出库日期"
);
}
if
(
demodel
.
EmployeeId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请选择领用人"
);
}
foreach
(
var
item
in
demodel
.
DetailList
)
{
if
(
item
.
SuppliesId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递正确的物料id"
);
}
if
(
item
.
Number
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请输入出库数量"
);
}
}
if
(
demodel
.
DetailList
.
Any
())
{
var
slist
=
demodel
.
DetailList
.
Select
(
x
=>
x
.
SuppliesId
).
Distinct
().
ToList
();
foreach
(
var
item
in
slist
)
{
if
(
demodel
.
DetailList
.
Where
(
x
=>
x
.
SuppliesId
==
item
).
Count
()
>
1
)
{
return
ApiResult
.
Failed
(
"每种耗材只能选择一个"
);
}
}
}
else
{
return
ApiResult
.
Failed
(
"请选择耗材"
);
}
//验证库存是否足够
if
(!
suppliesModule
.
ValidateStockOutInsert
(
demodel
))
{
return
ApiResult
.
Failed
(
"库存不足无法出库,请核实后再试"
);
}
}
#
endregion
#
region
入库记录
else
if
(
applyModel
.
CheckStatus
==
REBORN
.
Common
.
Enum
.
PropertyCheckStatusEnum
.
InventoryProfit
)
//盘赢入库
{
demodelStockIn
.
WarehouseId
=
applyModel
.
WarehouseId
;
demodelStockIn
.
CreateBy
=
userInfo
.
EmployeeId
;
demodelStockIn
.
StockInDate
=
NowStr
;
demodelStockIn
.
StockInState
=
REBORN
.
Common
.
Enum
.
StockInStatusEnum
.
StockIn
;
demodelStockIn
.
Remark
=
"电商商品盘点-盘赢入库"
;
demodelStockIn
.
Status
=
0
;
demodelStockIn
.
RB_Branch_Id
=
userInfo
.
RB_Branch_id
;
demodelStockIn
.
RB_Group_Id
=
userInfo
.
RB_Group_id
;
demodelStockIn
.
CreateDate
=
NowStr
;
demodelStockIn
.
UpdateBy
=
userInfo
.
EmployeeId
;
demodelStockIn
.
UpdateDate
=
NowStr
;
demodelStockIn
.
SupplierName
=
"电商商品盘点"
;
demodelStockIn
.
DetailList
=
new
List
<
RB_Supplies_StockInDetail_Extend
>();
foreach
(
var
item
in
applyModel
.
DetailList
)
{
RB_Supplies_StockInDetail_Extend
stockOutDetailModel
=
new
RB_Supplies_StockInDetail_Extend
{
Id
=
0
,
StockInId
=
0
,
SuppliesId
=
item
.
SuppliesId
,
Number
=
item
.
ReportLossNum
,
Remark
=
"电商商品盘点-盘赢入库"
,
Status
=
0
,
RB_Branch_Id
=
userInfo
.
RB_Branch_id
,
RB_Group_Id
=
userInfo
.
RB_Group_id
,
CreateBy
=
userInfo
.
EmployeeId
,
CreateDate
=
NowStr
,
UpdateBy
=
userInfo
.
EmployeeId
,
UpdateDate
=
NowStr
,
Money
=
item
.
ReportLossPrice
,
UnitPrice
=
Math
.
Round
((
item
.
ReportLossPrice
??
0
)
/
(
item
.
ReportLossNum
??
1
),
2
,
MidpointRounding
.
AwayFromZero
)
};
demodelStockIn
.
DetailList
.
Add
(
stockOutDetailModel
);
}
demodelStockIn
.
ProcurementId
=
0
;
demodelStockIn
.
Money
=
demodelStockIn
.
DetailList
.
Sum
(
x
=>
x
.
Money
);
if
(
demodelStockIn
.
WarehouseId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请选择仓库"
);
}
if
(
demodelStockIn
.
DetailList
==
null
||
!
demodelStockIn
.
DetailList
.
Any
())
{
return
ApiResult
.
ParamIsNull
(
"请选择物料"
);
}
if
(!
demodelStockIn
.
StockInDate
.
HasValue
)
{
return
ApiResult
.
ParamIsNull
(
"请输入入库日期"
);
}
foreach
(
var
item
in
demodelStockIn
.
DetailList
)
{
if
(
item
.
SuppliesId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递正确的物料id"
);
}
if
(!
item
.
Money
.
HasValue
)
{
return
ApiResult
.
ParamIsNull
(
"请输入入库金额"
);
}
if
(
item
.
Number
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请输入入库数量"
);
}
}
}
#
endregion
#
region
报损记录
applyModel
.
CreateDate
=
System
.
DateTime
.
Now
;
applyModel
.
CreateBy
=
userInfo
.
EmployeeId
;
applyModel
.
Remark
=
applyModel
.
CheckStatus
==
REBORN
.
Common
.
Enum
.
PropertyCheckStatusEnum
.
InventoryLosses
?
"电商商品盘点-盘亏"
:
"电商商品盘点-盘盈"
;
applyModel
.
Status
=
0
;
applyModel
.
RB_Branch_Id
=
userInfo
.
RB_Branch_id
;
applyModel
.
RB_Group_Id
=
userInfo
.
RB_Group_id
;
#
endregion
bool
flag
=
suppliesModule
.
SetReportLossRecord
(
applyModel
,
demodel
,
demodelStockIn
,
userInfo
.
RB_Department_Id
);
if
(
flag
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
();
}
}
#
endregion
}
}
}
}
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