Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
PropertyEdu
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
PropertyEdu
Commits
958e71c6
Commit
958e71c6
authored
Jun 24, 2021
by
liudong1993
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
资产调整
parent
dcde14c7
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
1777 additions
and
29 deletions
+1777
-29
PropertyStatusEnum.cs
Property.Common/Enum/Property/PropertyStatusEnum.cs
+6
-1
RB_Allocate_Record.cs
Property.Model/Entity/Property/RB_Allocate_Record.cs
+81
-0
RB_Property_Info.cs
Property.Model/Entity/Property/RB_Property_Info.cs
+5
-0
RB_Supplies_StockIn.cs
Property.Model/Entity/Supplies/RB_Supplies_StockIn.cs
+15
-0
RB_Supplies_StockOut.cs
Property.Model/Entity/Supplies/RB_Supplies_StockOut.cs
+5
-0
RB_Allocate_Record_Extend.cs
Property.Model/Extend/Property/RB_Allocate_Record_Extend.cs
+39
-0
RB_Supplies_StockOut_Extend.cs
...erty.Model/Extend/Supplies/RB_Supplies_StockOut_Extend.cs
+5
-0
PropertyModule.cs
Property.Modele.FixedAssets/PropertyModule.cs
+69
-0
SuppliesModule.cs
Property.Modele.FixedAssets/SuppliesModule.cs
+854
-1
RB_Allocate_RecordRepository.cs
Property.Repository/Property/RB_Allocate_RecordRepository.cs
+77
-0
RB_Property_InfoRepository.cs
Property.Repository/Property/RB_Property_InfoRepository.cs
+9
-0
RB_Supplies_StockInRepository.cs
...erty.Repository/Supplies/RB_Supplies_StockInRepository.cs
+118
-2
RB_Supplies_StockOutApplyForRepository.cs
...sitory/Supplies/RB_Supplies_StockOutApplyForRepository.cs
+4
-0
RB_Supplies_StockOutRepository.cs
...rty.Repository/Supplies/RB_Supplies_StockOutRepository.cs
+34
-1
PropertyController.cs
Property.WebApi/Controllers/Property/PropertyController.cs
+53
-0
SuppliesController.cs
Property.WebApi/Controllers/Property/SuppliesController.cs
+403
-24
No files found.
Property.Common/Enum/Property/PropertyStatusEnum.cs
View file @
958e71c6
...
@@ -56,6 +56,11 @@ namespace REBORN.Common.Enum
...
@@ -56,6 +56,11 @@ namespace REBORN.Common.Enum
/// 已处置
/// 已处置
/// </summary>
/// </summary>
[
EnumField
(
"已处置"
)]
[
EnumField
(
"已处置"
)]
Dispose
=
10
Dispose
=
10
,
/// <summary>
/// 耗材调拨
/// </summary>
[
EnumField
(
"耗材调拨"
)]
Supplies
=
11
}
}
}
}
Property.Model/Entity/Property/RB_Allocate_Record.cs
0 → 100644
View file @
958e71c6
using
System
;
using
REBORN.Common.AOP
;
using
REBORN.Common.Plugin
;
namespace
Property.Model.Entity
{
/// <summary>
/// 资产耗材调拨日志实体
/// </summary>
[
Serializable
]
[
DB
(
ConnectionName
=
"PropertyConnection"
)]
public
class
RB_Allocate_Record
{
/// <summary>
/// Id
/// </summary>
public
int
Id
{
get
;
set
;
}
/// <summary>
/// 类型 1 资产转耗材 2耗材转资产
/// </summary>
public
int
Type
{
get
;
set
;
}
/// <summary>
/// 资产id
/// </summary>
public
int
PropertyId
{
get
;
set
;
}
/// <summary>
/// 资产校区id
/// </summary>
public
int
SchoolId
{
get
;
set
;
}
/// <summary>
/// 耗材id
/// </summary>
public
int
MaterialId
{
get
;
set
;
}
/// <summary>
/// 耗材所在仓库
/// </summary>
public
int
WarehouseId
{
get
;
set
;
}
/// <summary>
/// 转入资产分类
/// </summary>
public
int
CategoryId
{
get
;
set
;
}
/// <summary>
/// 相关入库出库单号
/// </summary>
public
string
StockInOutNo
{
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/Property/RB_Property_Info.cs
View file @
958e71c6
...
@@ -242,5 +242,10 @@ namespace Property.Model.Entity
...
@@ -242,5 +242,10 @@ namespace Property.Model.Entity
/// 资产采购单id
/// 资产采购单id
/// </summary>
/// </summary>
public
int
ProcurementId
{
get
;
set
;
}
public
int
ProcurementId
{
get
;
set
;
}
/// <summary>
/// 是否折旧 1是 其他否
/// </summary>
public
int
IsDepreciation
{
get
;
set
;
}
}
}
}
}
\ No newline at end of file
Property.Model/Entity/Supplies/RB_Supplies_StockIn.cs
View file @
958e71c6
...
@@ -139,5 +139,20 @@ namespace Property.Model.Entity
...
@@ -139,5 +139,20 @@ namespace Property.Model.Entity
/// 流程模板id
/// 流程模板id
/// </summary>
/// </summary>
public
int
?
TempleteId
{
get
;
set
;
}
public
int
?
TempleteId
{
get
;
set
;
}
/// <summary>
/// 是否重新入库 1是 其他否
/// </summary>
public
int
IsAgainStock
{
get
;
set
;
}
/// <summary>
/// 退库对应 - 出库单号
/// </summary>
public
int
ReturnsId
{
get
;
set
;
}
/// <summary>
/// 出库单号
/// </summary>
public
string
ReturnsNo
{
get
;
set
;
}
}
}
}
}
\ No newline at end of file
Property.Model/Entity/Supplies/RB_Supplies_StockOut.cs
View file @
958e71c6
...
@@ -136,5 +136,10 @@ namespace Property.Model.Entity
...
@@ -136,5 +136,10 @@ namespace Property.Model.Entity
/// 耗材出库申请id
/// 耗材出库申请id
/// </summary>
/// </summary>
public
int
ApplyForId
{
get
;
set
;
}
public
int
ApplyForId
{
get
;
set
;
}
/// <summary>
/// 是否已退库 1是
/// </summary>
public
int
IsReturns
{
get
;
set
;
}
}
}
}
}
\ No newline at end of file
Property.Model/Extend/Property/RB_Allocate_Record_Extend.cs
0 → 100644
View file @
958e71c6
using
System
;
using
Property.Model.Entity
;
using
REBORN.Common.AOP
;
namespace
Property.Model.Extend
{
/// <summary>
/// 资产耗材调拨日志扩展实体
/// </summary>
[
Serializable
]
[
DB
(
ConnectionName
=
"PropertyConnection"
)]
public
class
RB_Allocate_Record_Extend
:
RB_Allocate_Record
{
/// <summary>
/// 耗材数量
/// </summary>
public
int
SuppliesNumber
{
get
;
set
;
}
/// <summary>
/// 购置日期
/// </summary>
public
string
BuyDate
{
get
;
set
;
}
/// <summary>
/// 资产名称
/// </summary>
public
string
PropertyName
{
get
;
set
;
}
/// <summary>
/// 物料名称
/// </summary>
public
string
SuppliesName
{
get
;
set
;
}
/// <summary>
/// 仓库名称
/// </summary>
public
string
WarehouseName
{
get
;
set
;
}
}
}
\ No newline at end of file
Property.Model/Extend/Supplies/RB_Supplies_StockOut_Extend.cs
View file @
958e71c6
...
@@ -12,6 +12,11 @@ namespace Property.Model.Extend
...
@@ -12,6 +12,11 @@ namespace Property.Model.Extend
[
DB
(
ConnectionName
=
"PropertyConnection"
)]
[
DB
(
ConnectionName
=
"PropertyConnection"
)]
public
class
RB_Supplies_StockOut_Extend
:
RB_Supplies_StockOut
public
class
RB_Supplies_StockOut_Extend
:
RB_Supplies_StockOut
{
{
/// <summary>
/// 出库ids
/// </summary>
public
string
StockOutIds
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 出库开始时间
/// 出库开始时间
/// </summary>
/// </summary>
...
...
Property.Modele.FixedAssets/PropertyModule.cs
View file @
958e71c6
...
@@ -13,6 +13,7 @@ using REBORN.Common.API;
...
@@ -13,6 +13,7 @@ using REBORN.Common.API;
using
System.Data
;
using
System.Data
;
using
REBORN.IM.Service
;
using
REBORN.IM.Service
;
using
Newtonsoft.Json.Linq
;
using
Newtonsoft.Json.Linq
;
using
System.IO
;
namespace
Property.Module.FixedAssets
namespace
Property.Module.FixedAssets
{
{
...
@@ -304,6 +305,33 @@ namespace Property.Module.FixedAssets
...
@@ -304,6 +305,33 @@ namespace Property.Module.FixedAssets
return
list
;
return
list
;
}
}
/// <summary>
/// 获取资产二维码列表
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public
List
<
RB_Property_Info_Extend
>
GetPropertyQRCodeList_V2
(
RB_Property_Info_Extend
demodel
)
{
var
list
=
property_InfoRepository
.
GetPropertyQRCodeList
(
demodel
);
foreach
(
var
item
in
list
)
{
string
QRCode
=
"PropertyCheck|Id="
+
item
.
Id
;
#
region
生成二维码
+
条形码
string
QRName
=
"QR-"
+
DateTime
.
Now
.
ToString
(
"yyyyMMdd"
)
+
"-PropertyCheck"
+
item
.
Id
+
".jpg"
;
string
basepath
=
AppContext
.
BaseDirectory
;
string
QRPath
=
basepath
+
"\\upfile\\code\\"
+
QRName
;
string
QRImage
=
"/upfile/code/"
+
QRName
;
//验证文件是否存在, 存在的话就不用生成了
if
(!
File
.
Exists
(
QRPath
))
{
QRCodeHelper
.
CreateQRCode
(
QRCode
,
5
,
""
,
QRPath
,
System
.
Drawing
.
Imaging
.
ImageFormat
.
Jpeg
);
}
#
endregion
item
.
QRCode
=
QRImage
;
}
return
list
;
}
/// <summary>
/// <summary>
/// 获取资产履历分页列表
/// 获取资产履历分页列表
/// </summary>
/// </summary>
...
@@ -670,6 +698,46 @@ namespace Property.Module.FixedAssets
...
@@ -670,6 +698,46 @@ namespace Property.Module.FixedAssets
return
flag
;
return
flag
;
}
}
/// <summary>
/// 设置资产折旧
/// </summary>
/// <param name="propertyId"></param>
/// <param name="isDepreciation"></param>
/// <param name="userInfo"></param>
/// <returns></returns>
public
bool
SetPropertyDepreciation
(
int
propertyId
,
int
isDepreciation
,
UserInfo
userInfo
)
{
Dictionary
<
string
,
object
>
files
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Property_Info
.
IsDepreciation
),
isDepreciation
},
{
nameof
(
RB_Property_Info
.
UpdateBy
),
userInfo
.
EmployeeId
},
{
nameof
(
RB_Property_Info
.
UpdateDate
),
DateTime
.
Now
}
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Property_Info
.
Id
),
FiledValue
=
propertyId
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
bool
flag
=
property_InfoRepository
.
Update
(
files
,
wheres
);
if
(
flag
)
{
//写入日志
property_LogRepository
.
Insert
(
new
RB_Property_Log
()
{
PropertyId
=
propertyId
,
Status
=
0
,
Content
=
"设置资产折旧为 "
+
(
isDepreciation
==
1
?
"参与折旧"
:
"不参与折旧"
),
TypeName
=
"折旧"
,
RB_Branch_Id
=
userInfo
.
RB_Branch_id
,
RB_Group_Id
=
userInfo
.
RB_Group_id
,
CreateBy
=
userInfo
.
EmployeeId
,
CreateDate
=
DateTime
.
Now
});
}
return
flag
;
}
/// <summary>
/// <summary>
/// 资产保存
/// 资产保存
/// </summary>
/// </summary>
...
@@ -4705,6 +4773,7 @@ namespace Property.Module.FixedAssets
...
@@ -4705,6 +4773,7 @@ namespace Property.Module.FixedAssets
pModel
.
BackTime
=
null
;
pModel
.
BackTime
=
null
;
pModel
.
SupplierId
=
opModel
.
SupplierId
;
pModel
.
SupplierId
=
opModel
.
SupplierId
;
pModel
.
ProcurementId
=
demodel
.
ProcurementId
;
pModel
.
ProcurementId
=
demodel
.
ProcurementId
;
pModel
.
IsDepreciation
=
1
;
//采购入库 默认需要折旧
pModel
.
Status
=
0
;
pModel
.
Status
=
0
;
pModel
.
BranchId
=
demodel
.
SchoolId
;
pModel
.
BranchId
=
demodel
.
SchoolId
;
pModel
.
RB_Branch_Id
=
userInfo
.
RB_Branch_id
;
pModel
.
RB_Branch_Id
=
userInfo
.
RB_Branch_id
;
...
...
Property.Modele.FixedAssets/SuppliesModule.cs
View file @
958e71c6
...
@@ -76,6 +76,18 @@ namespace Property.Module.FixedAssets
...
@@ -76,6 +76,18 @@ namespace Property.Module.FixedAssets
/// </summary>
/// </summary>
private
readonly
RB_Property_CategoryRepository
property_CategoryRepository
=
new
RB_Property_CategoryRepository
();
private
readonly
RB_Property_CategoryRepository
property_CategoryRepository
=
new
RB_Property_CategoryRepository
();
/// <summary>
/// <summary>
/// 资产
/// </summary>
private
readonly
RB_Property_InfoRepository
property_InfoRepository
=
new
RB_Property_InfoRepository
();
/// <summary>
/// 资产日志
/// </summary>
private
readonly
RB_Property_LogRepository
property_LogRepository
=
new
RB_Property_LogRepository
();
/// <summary>
/// 调拨记录
/// </summary>
private
readonly
RB_Allocate_RecordRepository
allocate_RecordRepository
=
new
RB_Allocate_RecordRepository
();
/// <summary>
/// 采购单
/// 采购单
/// </summary>
/// </summary>
private
readonly
RB_ProcurementRepository
procurementRepository
=
new
RB_ProcurementRepository
();
private
readonly
RB_ProcurementRepository
procurementRepository
=
new
RB_ProcurementRepository
();
...
@@ -236,6 +248,17 @@ namespace Property.Module.FixedAssets
...
@@ -236,6 +248,17 @@ namespace Property.Module.FixedAssets
return
list
;
return
list
;
}
}
/// <summary>
/// 获取物料档案列表
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public
List
<
RB_Supplies_Material_Extend
>
GetMaterialList
(
RB_Supplies_Material_Extend
demodel
)
{
var
list
=
supplies_MaterialRepository
.
GetList
(
demodel
);
return
list
;
}
/// <summary>
/// <summary>
/// 设置物料档案信息
/// 设置物料档案信息
/// </summary>
/// </summary>
...
@@ -472,6 +495,64 @@ namespace Property.Module.FixedAssets
...
@@ -472,6 +495,64 @@ namespace Property.Module.FixedAssets
return
list
;
return
list
;
}
}
/// <summary>
/// 获取退库单列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="demodel"></param>
/// <param name="count"></param>
/// <returns></returns>
public
List
<
RB_Supplies_StockIn_Extend
>
GetReturnsStockInPageList
(
int
pageIndex
,
int
pageSize
,
RB_Supplies_StockIn_Extend
demodel
,
out
long
count
,
bool
IsFlow
=
true
)
{
var
list
=
supplies_StockInRepository
.
GetReturnsPageList
(
pageIndex
,
pageSize
,
demodel
,
out
count
);
List
<
RB_Supplies_StockInDetail_Extend
>
sdList
=
new
List
<
RB_Supplies_StockInDetail_Extend
>();
List
<
Rb_Workflow_AuditRelevance_Extend
>
warlist
=
new
List
<
Rb_Workflow_AuditRelevance_Extend
>();
List
<
RB_Supplies_StockIn_Extend
>
outList
=
new
List
<
RB_Supplies_StockIn_Extend
>();
//出库单
if
(
list
.
Any
())
{
//查询出所有的耗材详细
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
});
//获取流程相关信息
if
(
IsFlow
)
{
warlist
=
workflow_AuditRelevanceRepository
.
GetAuditRelevanceList
(
0
,
IdStr
,
null
,
1
);
}
}
foreach
(
var
item
in
list
)
{
item
.
DetailList
=
sdList
.
Where
(
x
=>
x
.
StockInId
==
item
.
Id
).
ToList
();
foreach
(
var
qitem
in
item
.
DetailList
)
{
qitem
.
GoodsSpecificationList
=
new
List
<
string
>();
qitem
.
GoodsCategoryList
=
new
List
<
string
>();
if
(!
string
.
IsNullOrEmpty
(
qitem
.
SpecificationName
))
{
qitem
.
GoodsSpecificationList
=
JsonConvert
.
DeserializeObject
<
List
<
string
>>(
qitem
.
SpecificationName
);
}
if
(!
string
.
IsNullOrEmpty
(
qitem
.
GoodsCategoryName
))
{
qitem
.
GoodsCategoryList
=
JsonConvert
.
DeserializeObject
<
List
<
string
>>(
qitem
.
GoodsCategoryName
);
}
}
//流程
if
(
IsFlow
)
{
//下一步审核节点描述
var
NextModel
=
warlist
.
Where
(
x
=>
x
.
WorkFlowId
==
item
.
Id
&&
x
.
Stauts
==
WFRrocessStatus
.
NotAudit
).
OrderBy
(
x
=>
x
.
Sort
)?.
FirstOrDefault
();
if
(
item
.
Status
!=
1
)
{
item
.
AuditDescription
=
NextModel
!=
null
?
NextModel
.
AuditDescription
:
""
;
}
}
}
return
list
;
}
/// <summary>
/// <summary>
/// 删除仓库
/// 删除仓库
/// </summary>
/// </summary>
...
@@ -937,6 +1018,188 @@ namespace Property.Module.FixedAssets
...
@@ -937,6 +1018,188 @@ namespace Property.Module.FixedAssets
}
}
}
}
/// <summary>
/// 生成退库单
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public
string
SetReturnsStockInInfo
(
RB_Supplies_StockIn_Extend
demodel
)
{
#
region
验证退库单
var
outModel
=
supplies_StockOutRepository
.
GetEntity
(
demodel
.
ReturnsId
);
var
outDetailList
=
supplies_StockOutDetailRepository
.
GetList
(
new
RB_Supplies_StockOutDetail_Extend
()
{
RB_Group_Id
=
demodel
.
RB_Group_Id
,
StockOutId
=
demodel
.
ReturnsId
});
if
(
outModel
==
null
)
{
return
"出库单不存在"
;
}
if
(
outModel
.
IsReturns
==
1
)
{
return
"已重新入库,无法重复操作"
;
}
if
(
outDetailList
==
null
||
!
outDetailList
.
Any
())
{
return
"出库存不存在!"
;
}
foreach
(
var
item
in
demodel
.
DetailList
)
{
var
detailmodel
=
outDetailList
.
Where
(
x
=>
x
.
SuppliesId
==
item
.
SuppliesId
).
FirstOrDefault
();
if
(
detailmodel
==
null
)
{
return
"该出库商品不存在"
;
}
if
(
item
.
Number
>
detailmodel
.
Number
)
{
return
"物料编码:"
+
item
.
SuppliesId
+
" 不能大于出库数量"
;
}
}
demodel
.
WarehouseId
=
outModel
.
WarehouseId
;
//demodel.Money = 0; //前端传递
demodel
.
SupplierName
=
"重新入库"
;
demodel
.
ProcurementId
=
0
;
demodel
.
IsAgainStock
=
1
;
demodel
.
ReturnsNo
=
outModel
.
StockOutNum
;
#
endregion
var
trans
=
supplies_StockInRepository
.
DbTransaction
;
try
{
//生产编号
demodel
.
StockInState
=
StockInStatusEnum
.
StockIn
;
int
Id
=
supplies_StockInRepository
.
Insert
(
demodel
,
trans
);
if
(
Id
>
0
)
{
//编码自动生成
string
BMStr
=
Id
.
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
=
"TK"
+
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
=
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
supplies_StockInRepository
.
Update
(
files
,
wheres
,
trans
);
//新增明细
foreach
(
var
item
in
demodel
.
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
);
}
}
}
#
region
更新出库单
退库状态
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Supplies_StockOut
.
IsReturns
),
1
}
};
List
<
WhereHelper
>
wheres1
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Supplies_StockOut
.
Id
),
FiledValue
=
outModel
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
supplies_StockOutRepository
.
Update
(
keyValues
,
wheres1
,
trans
);
#
endregion
}
supplies_StockInRepository
.
DBSession
.
Commit
();
return
Id
>
0
?
""
:
"出错了,请联系管理员"
;
}
catch
(
Exception
ex
)
{
supplies_StockInRepository
.
DBSession
.
Rollback
(
"SetReturnsStockInInfo"
);
LogHelper
.
Write
(
ex
,
"SetReturnsStockInInfo"
);
return
"出错了,请联系管理员"
;
}
}
/// <summary>
/// <summary>
/// 根据出库id 获取订单号
/// 根据出库id 获取订单号
/// </summary>
/// </summary>
...
@@ -1067,6 +1330,50 @@ namespace Property.Module.FixedAssets
...
@@ -1067,6 +1330,50 @@ namespace Property.Module.FixedAssets
return
list
;
return
list
;
}
}
/// <summary>
/// 设置库存总金额
/// </summary>
/// <param name="inventoryId"></param>
/// <param name="totalMoney"></param>
/// <param name="userInfo"></param>
/// <returns></returns>
public
string
SetInventoryMoney
(
int
inventoryId
,
decimal
totalMoney
,
UserInfo
userInfo
)
{
var
imodel
=
supplies_InventoryRepository
.
GetEntity
(
inventoryId
);
if
(
imodel
==
null
||
imodel
.
Status
==
1
||
imodel
.
RB_Group_Id
!=
userInfo
.
RB_Group_id
)
{
return
"库存不存在"
;
}
if
(
imodel
.
Number
==
0
)
{
return
"没有库存,无法修改总额"
;
}
if
(
imodel
.
Money
==
totalMoney
)
{
return
""
;
}
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Supplies_Inventory_Extend
.
Money
),
totalMoney
}
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Supplies_Inventory_Extend
.
Id
),
FiledValue
=
imodel
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
bool
flag
=
supplies_InventoryRepository
.
Update
(
keyValues
,
wheres
);
if
(
flag
)
{
//插入记录
supplies_InventoryDetailRepository
.
Insert
(
new
RB_Supplies_InventoryDetail
()
{
Id
=
0
,
InventoryId
=
imodel
.
Id
,
Type
=
1
,
Number
=
0
,
Description
=
"修改库存总金额:由"
+
(
imodel
.
Money
??
0
)
+
" 修改为"
+
totalMoney
+
",当前库存:"
+
imodel
.
Number
,
Status
=
0
,
Money
=
totalMoney
-
(
imodel
.
Money
??
0
),
RB_Group_Id
=
imodel
.
RB_Group_Id
,
RB_Branch_Id
=
imodel
.
RB_Branch_Id
,
CreateBy
=
userInfo
.
EmployeeId
,
CreateDate
=
DateTime
.
Now
});
}
return
flag
?
""
:
"出错了,请联系管理员"
;
}
/// <summary>
/// <summary>
/// 取消出库单
/// 取消出库单
...
@@ -1592,11 +1899,26 @@ namespace Property.Module.FixedAssets
...
@@ -1592,11 +1899,26 @@ namespace Property.Module.FixedAssets
Status
=
0
,
Status
=
0
,
Type
=
2
,
Type
=
2
,
Id
=
0
,
Id
=
0
,
Description
=
"减少库存-取消入库单"
Description
=
demodel
.
IsAgainStock
==
1
?
"减少库存-取消退库单"
:
"减少库存-取消入库单"
});
});
}
}
}
}
}
}
if
(
demodel
.
IsAgainStock
==
1
&&
demodel
.
ReturnsId
>
0
)
{
//需更新出库单 退库状态
Dictionary
<
string
,
object
>
files2
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Supplies_StockOut
.
IsReturns
),
0
},
};
List
<
WhereHelper
>
wheres2
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Supplies_StockOut
.
Id
),
FiledValue
=
demodel
.
ReturnsId
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
supplies_StockOutRepository
.
Update
(
files2
,
wheres2
);
}
}
}
return
flag
;
return
flag
;
}
}
...
@@ -4840,5 +5162,536 @@ namespace Property.Module.FixedAssets
...
@@ -4840,5 +5162,536 @@ namespace Property.Module.FixedAssets
}
}
#
endregion
#
endregion
#
region
资产耗材调拨
/// <summary>
/// 设置资产耗材调拨
/// </summary>
/// <param name="demodel"></param>
/// <param name="userInfo"></param>
/// <returns></returns>
public
string
SetPropertySuppliesAllot
(
RB_Allocate_Record_Extend
demodel
,
UserInfo
userInfo
)
{
if
(
demodel
.
Type
==
1
)
{
//资产转耗材
var
pmodel
=
property_InfoRepository
.
GetEntity
(
demodel
.
PropertyId
);
if
(
pmodel
==
null
||
pmodel
.
Status
==
1
)
{
return
"资产不存在"
;
}
if
(
pmodel
.
PropertyStatus
!=
PropertyStatusEnum
.
Leisure
)
{
return
"不是空闲资产,无法调拨至耗材"
;
}
//资产供应商
string
SupplierName
=
property_SupplierRepository
.
GetEntity
(
pmodel
.
SupplierId
)?.
Name
??
""
;
//查询耗材信息
var
mmodel
=
supplies_MaterialRepository
.
GetEntity
(
demodel
.
MaterialId
);
if
(
mmodel
==
null
||
mmodel
.
Status
==
1
)
{
return
"物料档案不存在"
;
}
var
wmodel
=
supplies_WareHouseRepository
.
GetEntity
(
demodel
.
WarehouseId
);
if
(
wmodel
==
null
||
wmodel
.
Status
==
1
)
{
return
"仓库不存在"
;
}
//初始化数据
RB_Supplies_StockIn_Extend
smodel
=
new
RB_Supplies_StockIn_Extend
()
{
Id
=
0
,
WarehouseId
=
demodel
.
WarehouseId
,
StockInState
=
StockInStatusEnum
.
StockIn
,
StockInDate
=
pmodel
.
BuyDate
,
Money
=
pmodel
.
Money
,
SupplierName
=
SupplierName
,
Remark
=
"资产("
+
pmodel
.
Id
+
")调拨至耗材"
,
Status
=
0
,
RB_Branch_Id
=
userInfo
.
RB_Branch_id
,
RB_Group_Id
=
userInfo
.
RB_Group_id
,
CreateBy
=
userInfo
.
EmployeeId
,
CreateDate
=
DateTime
.
Now
,
UpdateBy
=
userInfo
.
EmployeeId
,
UpdateDate
=
DateTime
.
Now
,
StockInNum
=
""
,
ProcurementId
=
0
,
TempleteId
=
0
,
IsAgainStock
=
0
,
ReturnsId
=
0
,
ReturnsNo
=
""
};
smodel
.
DetailList
=
new
List
<
RB_Supplies_StockInDetail_Extend
>()
{
new
RB_Supplies_StockInDetail_Extend
(){
CreateBy
=
demodel
.
CreateBy
,
CreateDate
=
DateTime
.
Now
,
Money
=
pmodel
.
Money
,
Number
=
1
,
RB_Branch_Id
=
userInfo
.
RB_Branch_id
,
Id
=
0
,
RB_Group_Id
=
userInfo
.
RB_Group_id
,
Remark
=
""
,
Status
=
0
,
StockInId
=
0
,
SuppliesId
=
demodel
.
MaterialId
,
UnitPrice
=
pmodel
.
Money
,
UpdateBy
=
userInfo
.
EmployeeId
,
UpdateDate
=
DateTime
.
Now
}
};
//生产编号
var
trans
=
allocate_RecordRepository
.
DbTransaction
;
try
{
int
Id
=
supplies_StockInRepository
.
Insert
(
smodel
,
trans
);
if
(
Id
>
0
)
{
//编码自动生成
string
BMStr
=
Id
.
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
=
"TRK"
+
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
=
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
supplies_StockInRepository
.
Update
(
files
,
wheres
,
trans
);
//新增明细
foreach
(
var
item
in
smodel
.
DetailList
)
{
supplies_StockInDetailRepository
.
Insert
(
new
RB_Supplies_StockInDetail
()
{
CreateBy
=
item
.
CreateBy
,
CreateDate
=
item
.
CreateDate
,
Money
=
item
.
Money
,
Number
=
item
.
Number
,
RB_Branch_Id
=
item
.
RB_Branch_Id
,
Id
=
0
,
RB_Group_Id
=
item
.
RB_Group_Id
,
Remark
=
item
.
Remark
,
Status
=
0
,
StockInId
=
Id
,
SuppliesId
=
item
.
SuppliesId
,
UnitPrice
=
item
.
UnitPrice
,
UpdateBy
=
item
.
UpdateBy
,
UpdateDate
=
item
.
UpdateDate
},
trans
);
//新增库存表数据
var
ilist
=
supplies_InventoryRepository
.
GetList
(
new
RB_Supplies_Inventory_Extend
()
{
RB_Group_Id
=
smodel
.
RB_Group_Id
,
WarehouseId
=
smodel
.
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
=
smodel
.
CreateBy
,
CreateDate
=
DateTime
.
Now
,
InventoryId
=
iModel
.
Id
,
Number
=
item
.
Number
,
Money
=
item
.
Money
,
RB_Branch_Id
=
smodel
.
RB_Branch_Id
,
RB_Group_Id
=
smodel
.
RB_Group_Id
,
Status
=
0
,
Type
=
1
,
Id
=
0
,
Description
=
"新增库存 - 资产调拨至耗材"
},
trans
);
}
}
else
{
//新增库存表
int
iId
=
supplies_InventoryRepository
.
Insert
(
new
RB_Supplies_Inventory
()
{
CreateBy
=
smodel
.
CreateBy
,
CreateDate
=
DateTime
.
Now
,
Id
=
0
,
Number
=
item
.
Number
,
Money
=
item
.
Money
,
RB_Branch_Id
=
smodel
.
RB_Branch_Id
,
RB_Group_Id
=
smodel
.
RB_Group_Id
,
Status
=
0
,
SuppliesId
=
item
.
SuppliesId
,
UpdateBy
=
smodel
.
UpdateBy
,
UpdateDate
=
smodel
.
UpdateDate
,
WarehouseId
=
smodel
.
WarehouseId
},
trans
);
if
(
iId
>
0
)
{
//增加库存明细
supplies_InventoryDetailRepository
.
Insert
(
new
RB_Supplies_InventoryDetail
()
{
CreateBy
=
smodel
.
CreateBy
,
CreateDate
=
DateTime
.
Now
,
InventoryId
=
iId
,
Number
=
item
.
Number
,
Money
=
item
.
Money
,
RB_Branch_Id
=
smodel
.
RB_Branch_Id
,
RB_Group_Id
=
smodel
.
RB_Group_Id
,
Status
=
0
,
Type
=
1
,
Id
=
0
,
Description
=
"新增库存 - 知产调拨至耗材"
},
trans
);
}
}
}
#
region
更新资产为调拨
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Property_Info
.
PropertyStatus
),
PropertyStatusEnum
.
Supplies
}
};
List
<
WhereHelper
>
wheres1
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Property_Info
.
Id
),
FiledValue
=
pmodel
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
property_InfoRepository
.
Update
(
keyValues
,
wheres1
,
trans
);
property_LogRepository
.
Insert
(
new
RB_Property_Log
()
{
PropertyId
=
pmodel
.
Id
,
Content
=
"资产调拨至耗材"
,
CreateBy
=
userInfo
.
EmployeeId
,
CreateDate
=
DateTime
.
Now
,
Id
=
0
,
RB_Branch_Id
=
userInfo
.
RB_Branch_id
,
RB_Group_Id
=
userInfo
.
RB_Group_id
,
Status
=
0
,
TypeName
=
"耗材调拨"
},
trans
);
#
endregion
#
region
记录调拨日志
demodel
.
StockInOutNo
=
BMStr
;
allocate_RecordRepository
.
Insert
(
demodel
,
trans
);
#
endregion
}
allocate_RecordRepository
.
DBSession
.
Commit
();
return
""
;
}
catch
(
Exception
ex
)
{
LogHelper
.
Write
(
ex
,
"SetPropertySuppliesAllot"
);
allocate_RecordRepository
.
DBSession
.
Rollback
();
return
"出错了,请联系管理员"
;
}
}
else
{
//耗材转资产
//查询耗材信息
var
mmodel
=
supplies_MaterialRepository
.
GetEntity
(
demodel
.
MaterialId
);
if
(
mmodel
==
null
||
mmodel
.
Status
==
1
)
{
return
"物料档案不存在"
;
}
var
wmodel
=
supplies_WareHouseRepository
.
GetEntity
(
demodel
.
WarehouseId
);
if
(
wmodel
==
null
||
wmodel
.
Status
==
1
)
{
return
"仓库不存在"
;
}
var
imodel
=
supplies_InventoryRepository
.
GetList
(
new
RB_Supplies_Inventory_Extend
()
{
RB_Group_Id
=
demodel
.
RB_Group_Id
,
WarehouseId
=
demodel
.
WarehouseId
,
SuppliesId
=
demodel
.
MaterialId
}).
FirstOrDefault
();
if
(
imodel
==
null
||
(
imodel
.
Number
??
0
)
<=
0
)
{
return
"该物料库存不足"
;
}
decimal
UnitPrice
=
Math
.
Round
((
imodel
.
Money
??
0
)
/
(
imodel
.
Number
??
1
),
2
,
MidpointRounding
.
AwayFromZero
);
//资产单价
//初始化资产信息
RB_Property_Info
pmodel
=
new
RB_Property_Info
()
{
Name
=
mmodel
.
Name
,
PropertyNum
=
""
,
CategoryId
=
demodel
.
CategoryId
,
BrandName
=
mmodel
.
BrandName
,
Money
=
UnitPrice
,
BuyDate
=
Convert
.
ToDateTime
(
demodel
.
BuyDate
),
BuyType
=
PropertyBuyTypeEnum
.
Purchase
,
Units
=
mmodel
.
Units
,
UseMonths
=
0
,
UseStatus
=
PropertyUseStateEnum
.
Normal
,
PropertyStatus
=
PropertyStatusEnum
.
Leisure
,
PropertyModel
=
mmodel
.
SuppliesModel
,
Images
=
mmodel
.
Images
,
SerialNumber
=
""
,
Remark
=
"耗材转资产"
,
EmployeeId
=
0
,
GetTime
=
null
,
BackTime
=
null
,
SupplierId
=
12
,
//弄个默认的
Status
=
0
,
RB_Branch_Id
=
userInfo
.
RB_Branch_id
,
RB_Group_Id
=
userInfo
.
RB_Group_id
,
CreateBy
=
userInfo
.
EmployeeId
,
CreateDate
=
DateTime
.
Now
,
UpdateBy
=
userInfo
.
EmployeeId
,
UpdateDate
=
DateTime
.
Now
,
BranchId
=
demodel
.
SchoolId
,
QRCode
=
""
,
//这个需要生成
ProcurementId
=
0
,
IsDepreciation
=
0
};
//初始化出库单
RB_Supplies_StockOut_Extend
smodel
=
new
RB_Supplies_StockOut_Extend
()
{
Id
=
0
,
EmployeeId
=
0
,
WarehouseId
=
demodel
.
WarehouseId
,
StockOutState
=
StockOutStatusEnum
.
StockOut
,
StockOutDate
=
DateTime
.
Now
,
Remark
=
"耗材转资产"
,
Status
=
0
,
RB_Branch_Id
=
userInfo
.
RB_Branch_id
,
RB_Group_Id
=
userInfo
.
RB_Group_id
,
CreateBy
=
userInfo
.
EmployeeId
,
CreateDate
=
DateTime
.
Now
,
UpdateBy
=
userInfo
.
EmployeeId
,
UpdateDate
=
DateTime
.
Now
,
DepartmentId
=
userInfo
.
RB_Department_Id
,
BranchId
=
demodel
.
SchoolId
,
StockOutNum
=
""
,
ApplyForId
=
0
,
IsReturns
=
0
};
smodel
.
DetailList
=
new
List
<
RB_Supplies_StockOutDetail_Extend
>()
{
new
RB_Supplies_StockOutDetail_Extend
(){
CreateBy
=
demodel
.
CreateBy
,
CreateDate
=
DateTime
.
Now
,
Number
=
demodel
.
SuppliesNumber
,
RB_Branch_Id
=
userInfo
.
RB_Branch_id
,
Id
=
0
,
RB_Group_Id
=
userInfo
.
RB_Group_id
,
Remark
=
""
,
Status
=
0
,
StockOutId
=
0
,
SuppliesId
=
demodel
.
MaterialId
,
Money
=
UnitPrice
*
demodel
.
SuppliesNumber
,
UpdateBy
=
userInfo
.
EmployeeId
,
UpdateDate
=
DateTime
.
Now
}
};
var
trans
=
allocate_RecordRepository
.
DbTransaction
;
try
{
//首先生成出库信息
int
Id
=
supplies_StockOutRepository
.
Insert
(
smodel
,
trans
);
if
(
Id
>
0
)
{
//编码自动生成
string
BMStr
=
Id
.
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
=
"TCK"
+
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
=
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
supplies_StockOutRepository
.
Update
(
files
,
wheres
,
trans
);
//新增明细
foreach
(
var
item
in
smodel
.
DetailList
)
{
var
ilist
=
supplies_InventoryRepository
.
GetList
(
new
RB_Supplies_Inventory_Extend
()
{
RB_Group_Id
=
smodel
.
RB_Group_Id
,
WarehouseId
=
smodel
.
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
=
smodel
.
CreateBy
,
CreateDate
=
smodel
.
CreateDate
,
Number
=
item
.
Number
,
Money
=
Price
,
RB_Branch_Id
=
smodel
.
RB_Branch_Id
,
Id
=
0
,
RB_Group_Id
=
smodel
.
RB_Group_Id
,
Remark
=
item
.
Remark
,
Status
=
0
,
StockOutId
=
Id
,
SuppliesId
=
item
.
SuppliesId
,
UpdateBy
=
smodel
.
UpdateBy
,
UpdateDate
=
smodel
.
UpdateDate
},
trans
);
//新增库存表数据
if
(
ilist
.
Any
()
&&
smodel
.
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
=
smodel
.
CreateBy
,
CreateDate
=
DateTime
.
Now
,
InventoryId
=
iModel
.
Id
,
Number
=
item
.
Number
,
Money
=
Price
,
RB_Branch_Id
=
smodel
.
RB_Branch_Id
,
RB_Group_Id
=
smodel
.
RB_Group_Id
,
Status
=
0
,
Type
=
2
,
Id
=
0
,
Description
=
"减少库存-耗材调拨至资产"
},
trans
);
}
}
}
#
region
生成资产
for
(
var
i
=
1
;
i
<=
demodel
.
SuppliesNumber
;
i
++)
{
int
PropertyId
=
property_InfoRepository
.
Insert
(
pmodel
);
bool
flag
=
PropertyId
>
0
;
if
(
flag
)
{
//编码自动生成
string
BMStr2
=
PropertyId
.
ToString
();
if
(
BMStr2
.
Length
<
5
)
{
switch
(
BMStr2
.
Length
)
{
case
1
:
BMStr2
=
"0000"
+
BMStr2
;
break
;
case
2
:
BMStr2
=
"000"
+
BMStr2
;
break
;
case
3
:
BMStr2
=
"00"
+
BMStr2
;
break
;
case
4
:
BMStr2
=
"0"
+
BMStr2
;
break
;
}
}
#
region
生成二维码
string
QRPath
=
DateTime
.
Now
.
Ticks
.
ToString
()
+
".png"
;
string
basepath
=
AppContext
.
BaseDirectory
;
string
path_server
=
basepath
+
"\\upfile\\code\\"
+
QRPath
;
string
ImageAddress
=
"/upfile/code/"
+
QRPath
;
string
logoPath
=
basepath
+
"\\ExportFile\\Branch\\Logo.png"
;
try
{
QRCodeHelper
.
Create_CodeImages
(
"PropertyCheck|Id="
+
PropertyId
,
5
,
logoPath
,
path_server
,
System
.
Drawing
.
Imaging
.
ImageFormat
.
Png
);
}
catch
(
Exception
ex
)
{
LogHelper
.
Write
(
ex
,
"QRCodeHelper.Create_CodeImages"
);
ImageAddress
=
""
;
}
#
endregion
Dictionary
<
string
,
object
>
files2
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Property_Info
.
PropertyNum
),
BMStr2
},
{
nameof
(
RB_Property_Info
.
QRCode
),
ImageAddress
}
};
List
<
WhereHelper
>
wheres2
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Property_Info
.
Id
),
FiledValue
=
PropertyId
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
property_InfoRepository
.
Update
(
files2
,
wheres2
);
//写入日志
property_LogRepository
.
Insert
(
new
RB_Property_Log
()
{
PropertyId
=
PropertyId
,
Status
=
0
,
Content
=
"新增资产 - 耗材调拨至资产"
,
TypeName
=
"入库"
,
RB_Branch_Id
=
userInfo
.
RB_Branch_id
,
RB_Group_Id
=
userInfo
.
RB_Group_id
,
CreateBy
=
userInfo
.
EmployeeId
,
CreateDate
=
DateTime
.
Now
});
//记录调拨日志
demodel
.
StockInOutNo
=
BMStr
;
demodel
.
PropertyId
=
PropertyId
;
allocate_RecordRepository
.
Insert
(
demodel
,
trans
);
}
}
#
endregion
}
allocate_RecordRepository
.
DBSession
.
Commit
();
return
""
;
}
catch
(
Exception
ex
)
{
LogHelper
.
Write
(
ex
,
"SetPropertySuppliesAllot"
);
allocate_RecordRepository
.
DBSession
.
Rollback
();
return
"出错了,请联系管理员"
;
}
}
}
/// <summary>
/// 资产耗材调拨导出
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="demodel"></param>
/// <returns></returns>
public
List
<
RB_Allocate_Record_Extend
>
GetPropertySuppliesAllotPageList
(
int
pageIndex
,
int
pageSize
,
out
long
count
,
RB_Allocate_Record_Extend
demodel
)
{
var
list
=
allocate_RecordRepository
.
GetPageList
(
pageIndex
,
pageSize
,
demodel
,
out
count
);
if
(
list
.
Any
())
{
//查询资产
string
pids
=
string
.
Join
(
","
,
list
.
Select
(
x
=>
x
.
PropertyId
));
var
plist
=
property_InfoRepository
.
GetList
(
new
RB_Property_Info_Extend
()
{
RB_Group_Id
=
demodel
.
RB_Group_Id
,
PropertyIdStr
=
pids
});
//查询物料
string
mids
=
string
.
Join
(
","
,
list
.
Select
(
x
=>
x
.
MaterialId
));
var
mlist
=
supplies_MaterialRepository
.
GetList
(
new
RB_Supplies_Material_Extend
()
{
RB_Group_Id
=
demodel
.
RB_Group_Id
,
SuppliesIdStr
=
mids
});
//查询仓库
string
wids
=
string
.
Join
(
","
,
list
.
Select
(
x
=>
x
.
WarehouseId
));
var
wlist
=
supplies_WareHouseRepository
.
GetList
(
new
RB_Supplies_WareHouse_Extend
()
{
RB_Group_Id
=
demodel
.
RB_Group_Id
,
WareHouseIdStr
=
wids
});
foreach
(
var
item
in
list
)
{
item
.
PropertyName
=
plist
.
Where
(
x
=>
x
.
Id
==
item
.
PropertyId
).
FirstOrDefault
()?.
Name
??
""
;
item
.
SuppliesName
=
mlist
.
Where
(
x
=>
x
.
Id
==
item
.
MaterialId
).
FirstOrDefault
()?.
Name
??
""
;
item
.
WarehouseName
=
wlist
.
Where
(
x
=>
x
.
Id
==
item
.
WarehouseId
).
FirstOrDefault
()?.
Name
??
""
;
}
}
return
list
;
}
#
endregion
}
}
}
}
Property.Repository/Property/RB_Allocate_RecordRepository.cs
0 → 100644
View file @
958e71c6
using
Property.Model.Entity
;
using
Property.Model.Extend
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
namespace
Property.Repository
{
/// <summary>
/// 资产耗材调拨日志仓储类
/// </summary>
public
partial
class
RB_Allocate_RecordRepository
:
RepositoryBase
<
RB_Allocate_Record
>
{
/// <summary>
/// 获取岗位分页数据
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="dmodel"></param>
/// <param name="count"></param>
/// <returns></returns>
public
List
<
RB_Allocate_Record_Extend
>
GetPageList
(
int
pageIndex
,
int
pageSize
,
RB_Allocate_Record_Extend
dmodel
,
out
long
count
)
{
string
where
=
" where 1=1 "
;
where
+=
string
.
Format
(
" AND {0}={1}"
,
nameof
(
RB_Allocate_Record_Extend
.
Status
),
0
);
where
+=
$@" and RB_Group_Id=
{
dmodel
.
RB_Group_Id
}
"
;
if
(
dmodel
.
PropertyId
>
0
)
{
where
+=
" and "
+
nameof
(
RB_Allocate_Record_Extend
.
PropertyId
)
+
"="
+
dmodel
.
PropertyId
;
}
if
(
dmodel
.
Type
>
0
)
{
where
+=
" and "
+
nameof
(
RB_Allocate_Record_Extend
.
Type
)
+
"="
+
dmodel
.
Type
;
}
if
(
dmodel
.
MaterialId
>
0
)
{
where
+=
" and "
+
nameof
(
RB_Allocate_Record_Extend
.
MaterialId
)
+
"="
+
dmodel
.
MaterialId
;
}
if
(
dmodel
.
WarehouseId
>
0
)
{
where
+=
" and "
+
nameof
(
RB_Allocate_Record_Extend
.
WarehouseId
)
+
"="
+
dmodel
.
WarehouseId
;
}
string
sql
=
$@" select * from RB_Allocate_Record
{
where
}
order by Id desc"
;
return
GetPage
<
RB_Allocate_Record_Extend
>(
pageIndex
,
pageSize
,
out
count
,
sql
).
ToList
();
}
/// <summary>
/// 获取列表数据
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public
List
<
RB_Allocate_Record_Extend
>
GetList
(
RB_Allocate_Record_Extend
dmodel
)
{
string
where
=
" where 1=1 "
;
where
+=
string
.
Format
(
" AND {0}={1}"
,
nameof
(
RB_Allocate_Record_Extend
.
Status
),
0
);
where
+=
$@" and RB_Group_Id=
{
dmodel
.
RB_Group_Id
}
"
;
if
(
dmodel
.
PropertyId
>
0
)
{
where
+=
" and "
+
nameof
(
RB_Allocate_Record_Extend
.
PropertyId
)
+
"="
+
dmodel
.
PropertyId
;
}
if
(
dmodel
.
Type
>
0
)
{
where
+=
" and "
+
nameof
(
RB_Allocate_Record_Extend
.
Type
)
+
"="
+
dmodel
.
Type
;
}
if
(
dmodel
.
MaterialId
>
0
)
{
where
+=
" and "
+
nameof
(
RB_Allocate_Record_Extend
.
MaterialId
)
+
"="
+
dmodel
.
MaterialId
;
}
if
(
dmodel
.
WarehouseId
>
0
)
{
where
+=
" and "
+
nameof
(
RB_Allocate_Record_Extend
.
WarehouseId
)
+
"="
+
dmodel
.
WarehouseId
;
}
string
sql
=
$@" select * from RB_Allocate_Record
{
where
}
order by Id desc"
;
return
Get
<
RB_Allocate_Record_Extend
>(
sql
).
ToList
();
}
}
}
Property.Repository/Property/RB_Property_InfoRepository.cs
View file @
958e71c6
...
@@ -87,6 +87,11 @@ namespace Property.Repository
...
@@ -87,6 +87,11 @@ namespace Property.Repository
if
(
dmodel
.
IsSelectUseProperty
==
1
)
{
if
(
dmodel
.
IsSelectUseProperty
==
1
)
{
where
+=
" and pi.EmployeeId > 0 "
;
where
+=
" and pi.EmployeeId > 0 "
;
}
}
if
(
dmodel
.
IsDepreciation
==
1
)
{
where
+=
" and pi."
+
nameof
(
RB_Property_Info_Extend
.
IsDepreciation
)
+
"="
+
dmodel
.
IsDepreciation
;
}
string
sql
=
$@" select pi.*,pc.Name as CategoryName,ps.Name as SupplierName from RB_Property_Info pi
string
sql
=
$@" select pi.*,pc.Name as CategoryName,ps.Name as SupplierName from RB_Property_Info pi
left join RB_Property_Category pc on pc.Id=pi.CategoryId
left join RB_Property_Category pc on pc.Id=pi.CategoryId
left join rb_property_supplier ps on pi.SupplierId=ps.Id
left join rb_property_supplier ps on pi.SupplierId=ps.Id
...
@@ -164,6 +169,10 @@ left join rb_property_supplier ps on pi.SupplierId=ps.Id
...
@@ -164,6 +169,10 @@ left join rb_property_supplier ps on pi.SupplierId=ps.Id
{
{
where
+=
" and pi."
+
nameof
(
RB_Property_Info_Extend
.
PropertyStatus
)
+
"!="
+
(
int
)
REBORN
.
Common
.
Enum
.
PropertyStatusEnum
.
Dispose
;
where
+=
" and pi."
+
nameof
(
RB_Property_Info_Extend
.
PropertyStatus
)
+
"!="
+
(
int
)
REBORN
.
Common
.
Enum
.
PropertyStatusEnum
.
Dispose
;
}
}
if
(
dmodel
.
IsDepreciation
==
1
)
{
where
+=
" and pi."
+
nameof
(
RB_Property_Info_Extend
.
IsDepreciation
)
+
"="
+
dmodel
.
IsDepreciation
;
}
string
sql
=
$@" select pi.*,pc.Name as CategoryName,ps.Name as SupplierName from RB_Property_Info pi
string
sql
=
$@" select pi.*,pc.Name as CategoryName,ps.Name as SupplierName from RB_Property_Info pi
left join RB_Property_Category pc on pc.Id=pi.CategoryId
left join RB_Property_Category pc on pc.Id=pi.CategoryId
...
...
Property.Repository/Supplies/RB_Supplies_StockInRepository.cs
View file @
958e71c6
...
@@ -25,7 +25,7 @@ namespace Property.Repository
...
@@ -25,7 +25,7 @@ namespace Property.Repository
{
{
string
where
=
" where 1=1 "
;
string
where
=
" where 1=1 "
;
where
+=
string
.
Format
(
" AND ss.{0}={1}"
,
nameof
(
RB_Supplies_StockIn_Extend
.
Status
),
0
);
where
+=
string
.
Format
(
" AND ss.{0}={1}"
,
nameof
(
RB_Supplies_StockIn_Extend
.
Status
),
0
);
where
+=
$@" and ss.RB_Group_Id=
{
dmodel
.
RB_Group_Id
}
"
;
where
+=
$@" and ss.RB_Group_Id=
{
dmodel
.
RB_Group_Id
}
and ss.IsAgainStock =0
"
;
if
(!
string
.
IsNullOrWhiteSpace
(
dmodel
.
StartTime
))
if
(!
string
.
IsNullOrWhiteSpace
(
dmodel
.
StartTime
))
{
{
where
+=
$@" and ss.
{
nameof
(
RB_Supplies_StockIn_Extend
.
StockInDate
)}
>='
{
dmodel
.
StartTime
}
'"
;
where
+=
$@" and ss.
{
nameof
(
RB_Supplies_StockIn_Extend
.
StockInDate
)}
>='
{
dmodel
.
StartTime
}
'"
;
...
@@ -83,7 +83,7 @@ left join rb_supplies_procurement p on ss.ProcurementId=p.Id
...
@@ -83,7 +83,7 @@ left join rb_supplies_procurement p on ss.ProcurementId=p.Id
{
{
string
where
=
" where 1=1 "
;
string
where
=
" where 1=1 "
;
where
+=
string
.
Format
(
" AND ss.{0}={1}"
,
nameof
(
RB_Supplies_StockIn_Extend
.
Status
),
0
);
where
+=
string
.
Format
(
" AND ss.{0}={1}"
,
nameof
(
RB_Supplies_StockIn_Extend
.
Status
),
0
);
where
+=
$@" and ss.RB_Group_Id=
{
dmodel
.
RB_Group_Id
}
"
;
where
+=
$@" and ss.RB_Group_Id=
{
dmodel
.
RB_Group_Id
}
and ss.IsAgainStock =0
"
;
if
(!
string
.
IsNullOrWhiteSpace
(
dmodel
.
StartTime
))
if
(!
string
.
IsNullOrWhiteSpace
(
dmodel
.
StartTime
))
{
{
where
+=
$@" and ss.
{
nameof
(
RB_Supplies_StockIn_Extend
.
StockInDate
)}
>='
{
dmodel
.
StartTime
}
'"
;
where
+=
$@" and ss.
{
nameof
(
RB_Supplies_StockIn_Extend
.
StockInDate
)}
>='
{
dmodel
.
StartTime
}
'"
;
...
@@ -249,5 +249,121 @@ LEFT JOIN rb_workflow_auditrelevance war on wa.AuditId=war.Id
...
@@ -249,5 +249,121 @@ LEFT JOIN rb_workflow_auditrelevance war on wa.AuditId=war.Id
{
where
}
group by ss.Id order by ss.Id desc"
;
{
where
}
group by ss.Id order by ss.Id desc"
;
return
GetPage
<
RB_Supplies_StockIn_Extend
>(
pageIndex
,
pageSize
,
out
count
,
sql
).
ToList
();
return
GetPage
<
RB_Supplies_StockIn_Extend
>(
pageIndex
,
pageSize
,
out
count
,
sql
).
ToList
();
}
}
/// <summary>
/// 获取耗材分页数据
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="dmodel"></param>
/// <param name="count"></param>
/// <returns></returns>
public
List
<
RB_Supplies_StockIn_Extend
>
GetReturnsPageList
(
int
pageIndex
,
int
pageSize
,
RB_Supplies_StockIn_Extend
dmodel
,
out
long
count
)
{
string
where
=
" where 1=1 "
;
where
+=
string
.
Format
(
" AND ss.{0}={1}"
,
nameof
(
RB_Supplies_StockIn_Extend
.
Status
),
0
);
where
+=
$@" and ss.RB_Group_Id=
{
dmodel
.
RB_Group_Id
}
and ss.IsAgainStock =1"
;
if
(!
string
.
IsNullOrWhiteSpace
(
dmodel
.
StartTime
))
{
where
+=
$@" and ss.
{
nameof
(
RB_Supplies_StockIn_Extend
.
StockInDate
)}
>='
{
dmodel
.
StartTime
}
'"
;
}
if
(!
string
.
IsNullOrWhiteSpace
(
dmodel
.
EndTime
))
{
where
+=
$@" and ss.
{
nameof
(
RB_Supplies_StockIn_Extend
.
StockInDate
)}
<='
{
dmodel
.
EndTime
+
" 23:59:59"
}
'"
;
}
if
(!
string
.
IsNullOrWhiteSpace
(
dmodel
.
StockInNum
))
{
where
+=
" and ss."
+
nameof
(
RB_Supplies_StockIn_Extend
.
StockInNum
)
+
" like '%"
+
dmodel
.
StockInNum
+
"%'"
;
}
if
(!
string
.
IsNullOrWhiteSpace
(
dmodel
.
ReturnsNo
))
{
where
+=
" and ss."
+
nameof
(
RB_Supplies_StockIn_Extend
.
ReturnsNo
)
+
" like '%"
+
dmodel
.
ReturnsNo
+
"%'"
;
}
if
(!
string
.
IsNullOrWhiteSpace
(
dmodel
.
SuppliesNum
))
{
where
+=
" and sm."
+
nameof
(
RB_Supplies_StockIn_Extend
.
SuppliesNum
)
+
" like '%"
+
dmodel
.
SuppliesNum
.
Trim
()
+
"%'"
;
}
if
(!
string
.
IsNullOrWhiteSpace
(
dmodel
.
SuppliesName
))
{
where
+=
" and sm."
+
nameof
(
RB_Supplies_Material
.
Name
)
+
" like '%"
+
dmodel
.
SuppliesName
.
Trim
()
+
"%'"
;
}
if
(!
string
.
IsNullOrWhiteSpace
(
dmodel
.
SupplierName
))
{
where
+=
" and ss."
+
nameof
(
RB_Supplies_StockIn_Extend
.
SupplierName
)
+
" like '%"
+
dmodel
.
SupplierName
.
Trim
()
+
"%'"
;
}
if
(
dmodel
.
WarehouseId
>
0
)
{
where
+=
" and ss."
+
nameof
(
RB_Supplies_StockIn_Extend
.
WarehouseId
)
+
"="
+
dmodel
.
WarehouseId
;
}
if
(
dmodel
.
FinanceId
>
0
)
{
where
+=
" and p.FinanceId ="
+
dmodel
.
FinanceId
;
}
if
(
dmodel
.
ProcurementId
>
0
)
{
where
+=
" and ss.ProcurementId ="
+
dmodel
.
ProcurementId
;
}
if
(
dmodel
.
StockInState
>
0
)
{
where
+=
" and ss."
+
nameof
(
RB_Supplies_StockIn_Extend
.
StockInState
)
+
"="
+
(
int
)
dmodel
.
StockInState
;
}
string
sql
=
$@" select ss.*,sw.Name as WareHouseName,p.FinanceId from RB_Supplies_StockIn ss
left join rb_supplies_warehouse sw on ss.WarehouseId=sw.Id
left join rb_supplies_stockindetail ssd on ss.Id=ssd.StockInId
left join rb_supplies_material sm on ssd.SuppliesId=sm.Id
left join rb_supplies_procurement p on ss.ProcurementId=p.Id
{
where
}
group by ss.Id order by ss.Id desc"
;
return
GetPage
<
RB_Supplies_StockIn_Extend
>(
pageIndex
,
pageSize
,
out
count
,
sql
).
ToList
();
}
/// <summary>
/// 获取耗材分页数据
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public
List
<
RB_Supplies_StockIn_Extend
>
GetReturnsList
(
RB_Supplies_StockIn_Extend
dmodel
)
{
string
where
=
" where 1=1 "
;
where
+=
string
.
Format
(
" AND ss.{0}={1}"
,
nameof
(
RB_Supplies_StockIn_Extend
.
Status
),
0
);
where
+=
$@" and ss.RB_Group_Id=
{
dmodel
.
RB_Group_Id
}
and ss.IsAgainStock =1"
;
if
(!
string
.
IsNullOrWhiteSpace
(
dmodel
.
StartTime
))
{
where
+=
$@" and ss.
{
nameof
(
RB_Supplies_StockIn_Extend
.
StockInDate
)}
>='
{
dmodel
.
StartTime
}
'"
;
}
if
(!
string
.
IsNullOrWhiteSpace
(
dmodel
.
EndTime
))
{
where
+=
$@" and ss.
{
nameof
(
RB_Supplies_StockIn_Extend
.
StockInDate
)}
<='
{
dmodel
.
EndTime
+
" 23:59:59"
}
'"
;
}
if
(!
string
.
IsNullOrWhiteSpace
(
dmodel
.
StockInNum
))
{
where
+=
" and ss."
+
nameof
(
RB_Supplies_StockIn_Extend
.
StockInNum
)
+
" like '%"
+
dmodel
.
StockInNum
+
"%'"
;
}
if
(!
string
.
IsNullOrWhiteSpace
(
dmodel
.
SupplierName
))
{
where
+=
" and ss."
+
nameof
(
RB_Supplies_StockIn_Extend
.
SupplierName
)
+
" like '%"
+
dmodel
.
SupplierName
.
Trim
()
+
"%'"
;
}
if
(
dmodel
.
Id
>
0
)
{
where
+=
" and ss."
+
nameof
(
RB_Supplies_StockIn_Extend
.
Id
)
+
"="
+
dmodel
.
Id
;
}
if
(
dmodel
.
WarehouseId
>
0
)
{
where
+=
" and ss."
+
nameof
(
RB_Supplies_StockIn_Extend
.
WarehouseId
)
+
"="
+
dmodel
.
WarehouseId
;
}
if
(
dmodel
.
ProcurementId
>
0
)
{
where
+=
" and ss."
+
nameof
(
RB_Supplies_StockIn_Extend
.
ProcurementId
)
+
"="
+
dmodel
.
ProcurementId
;
}
string
sql
=
$@" select ss.*,sw.Name as WareHouseName from RB_Supplies_StockIn ss
left join rb_supplies_warehouse sw on ss.WarehouseId=sw.Id
{
where
}
order by ss.Id desc"
;
return
Get
<
RB_Supplies_StockIn_Extend
>(
sql
).
ToList
();
}
}
}
}
}
Property.Repository/Supplies/RB_Supplies_StockOutApplyForRepository.cs
View file @
958e71c6
...
@@ -26,6 +26,10 @@ namespace Property.Repository
...
@@ -26,6 +26,10 @@ namespace Property.Repository
string
where
=
" where 1=1 "
;
string
where
=
" where 1=1 "
;
where
+=
string
.
Format
(
" AND pc.{0}={1}"
,
nameof
(
RB_Supplies_StockOutApplyFor_Extend
.
Status
),
0
);
where
+=
string
.
Format
(
" AND pc.{0}={1}"
,
nameof
(
RB_Supplies_StockOutApplyFor_Extend
.
Status
),
0
);
where
+=
$@" and pc.RB_Group_Id=
{
dmodel
.
RB_Group_Id
}
"
;
where
+=
$@" and pc.RB_Group_Id=
{
dmodel
.
RB_Group_Id
}
"
;
if
(
dmodel
.
Id
>
0
)
{
where
+=
" and pc."
+
nameof
(
RB_Supplies_StockOutApplyFor_Extend
.
Id
)
+
"="
+
dmodel
.
Id
;
}
if
(
dmodel
.
AuditStatus
>
0
)
if
(
dmodel
.
AuditStatus
>
0
)
{
{
where
+=
" and pc."
+
nameof
(
RB_Supplies_StockOutApplyFor_Extend
.
AuditStatus
)
+
"="
+
dmodel
.
AuditStatus
;
where
+=
" and pc."
+
nameof
(
RB_Supplies_StockOutApplyFor_Extend
.
AuditStatus
)
+
"="
+
dmodel
.
AuditStatus
;
...
...
Property.Repository/Supplies/RB_Supplies_StockOutRepository.cs
View file @
958e71c6
...
@@ -62,5 +62,38 @@ left join rb_supplies_material sm on ssd.SuppliesId=sm.Id
...
@@ -62,5 +62,38 @@ left join rb_supplies_material sm on ssd.SuppliesId=sm.Id
{
where
}
order by ss.Id desc"
;
{
where
}
order by ss.Id desc"
;
return
GetPage
<
RB_Supplies_StockOut_Extend
>(
pageIndex
,
pageSize
,
out
count
,
sql
).
ToList
();
return
GetPage
<
RB_Supplies_StockOut_Extend
>(
pageIndex
,
pageSize
,
out
count
,
sql
).
ToList
();
}
}
/// <summary>
/// 获取列表
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public
List
<
RB_Supplies_StockOut_Extend
>
GetList
(
RB_Supplies_StockOut_Extend
dmodel
)
{
string
where
=
" where 1=1 "
;
where
+=
string
.
Format
(
" AND ss.{0}={1}"
,
nameof
(
RB_Supplies_StockOut_Extend
.
Status
),
0
);
where
+=
$@" and ss.RB_Group_Id=
{
dmodel
.
RB_Group_Id
}
"
;
if
(
dmodel
.
Id
>
0
)
{
where
+=
" and ss."
+
nameof
(
RB_Supplies_StockOut_Extend
.
Id
)
+
"="
+
dmodel
.
Id
;
}
if
(!
string
.
IsNullOrEmpty
(
dmodel
.
StockOutIds
))
{
where
+=
" and ss."
+
nameof
(
RB_Supplies_StockOut_Extend
.
Id
)
+
" in("
+
dmodel
.
StockOutIds
+
")"
;
}
if
(
dmodel
.
WarehouseId
>
0
)
{
where
+=
" and ss."
+
nameof
(
RB_Supplies_StockOut_Extend
.
WarehouseId
)
+
"="
+
dmodel
.
WarehouseId
;
}
if
(
dmodel
.
EmployeeId
>
0
)
{
where
+=
" and ss."
+
nameof
(
RB_Supplies_StockOut_Extend
.
EmployeeId
)
+
"="
+
dmodel
.
EmployeeId
;
}
string
sql
=
$@" select distinct ss.*,sw.Name as WareHouseName from RB_Supplies_StockOut ss
{
where
}
order by ss.Id desc"
;
return
Get
<
RB_Supplies_StockOut_Extend
>(
sql
).
ToList
();
}
}
}
}
}
Property.WebApi/Controllers/Property/PropertyController.cs
View file @
958e71c6
...
@@ -262,6 +262,7 @@ namespace Property.WebApi.Controllers.User
...
@@ -262,6 +262,7 @@ namespace Property.WebApi.Controllers.User
x
.
BranchId
,
x
.
BranchId
,
x
.
UseMonths
,
x
.
UseMonths
,
x
.
QRCode
,
x
.
QRCode
,
x
.
IsDepreciation
,
UseReceiveId
=
x
.
UseReceiveId
??
0
,
UseReceiveId
=
x
.
UseReceiveId
??
0
,
BranchName
=
CacheManager
.
User
.
BranchReidsCache
.
GetBranch
(
x
.
BranchId
)?.
BName
??
""
,
BranchName
=
CacheManager
.
User
.
BranchReidsCache
.
GetBranch
(
x
.
BranchId
)?.
BName
??
""
,
UpdateBy
=
CacheManager
.
User
.
UserReidsCache
.
GetEmployee
(
x
.
UpdateBy
)?.
EmName
??
""
,
UpdateBy
=
CacheManager
.
User
.
UserReidsCache
.
GetEmployee
(
x
.
UpdateBy
)?.
EmName
??
""
,
...
@@ -744,6 +745,33 @@ namespace Property.WebApi.Controllers.User
...
@@ -744,6 +745,33 @@ namespace Property.WebApi.Controllers.User
}
}
}
}
/// <summary>
/// 设置资产折旧
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SetPropertyDepreciation
()
{
RequestParm
requestParm
=
GetRequestParm
();
UserInfo
userInfo
=
CacheManager
.
User
.
UserReidsCache
.
GetUserLoginInfo
(
requestParm
.
uid
);
JObject
parms
=
JObject
.
Parse
(
requestParm
.
msg
.
ToString
());
int
PropertyId
=
parms
.
GetInt
(
"PropertyId"
,
0
);
int
IsDepreciation
=
parms
.
GetInt
(
"IsDepreciation"
,
1
);
// 1折旧 2不参与折旧
if
(
PropertyId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递参数id"
);
}
bool
flag
=
propertyModule
.
SetPropertyDepreciation
(
PropertyId
,
IsDepreciation
,
userInfo
);
if
(
flag
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
();
}
}
/// <summary>
/// <summary>
/// 获取供应商分页列表
/// 获取供应商分页列表
/// </summary>
/// </summary>
...
@@ -4030,6 +4058,29 @@ namespace Property.WebApi.Controllers.User
...
@@ -4030,6 +4058,29 @@ namespace Property.WebApi.Controllers.User
x
.
QRCode
x
.
QRCode
}));
}));
}
}
/// <summary>
/// 获取资产二维码打印列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetPropertyQRCodeList_V2
()
{
var
requestParm
=
GetRequestParm
();
UserInfo
userInfo
=
CacheManager
.
User
.
UserReidsCache
.
GetUserLoginInfo
(
requestParm
.
uid
);
RB_Property_Info_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Property_Info_Extend
>(
requestParm
.
msg
.
ToString
());
demodel
.
RB_Group_Id
=
userInfo
.
RB_Group_id
;
var
list
=
propertyModule
.
GetPropertyQRCodeList_V2
(
demodel
);
return
ApiResult
.
Success
(
""
,
list
.
Select
(
x
=>
new
{
x
.
Id
,
x
.
Name
,
x
.
PropertyNum
,
x
.
QRCode
}));
}
#
endregion
#
endregion
#
region
统计报表
#
region
统计报表
...
@@ -4051,6 +4102,7 @@ namespace Property.WebApi.Controllers.User
...
@@ -4051,6 +4102,7 @@ namespace Property.WebApi.Controllers.User
}
}
demodel
.
EndTime
=
Convert
.
ToDateTime
(
demodel
.
EndTime
+
"-01"
).
AddMonths
(
1
).
AddDays
(-
1
).
ToString
(
"yyyy-MM-dd"
);
demodel
.
EndTime
=
Convert
.
ToDateTime
(
demodel
.
EndTime
+
"-01"
).
AddMonths
(
1
).
AddDays
(-
1
).
ToString
(
"yyyy-MM-dd"
);
demodel
.
IsSelectDepreciation
=
1
;
demodel
.
IsSelectDepreciation
=
1
;
demodel
.
IsDepreciation
=
1
;
demodel
.
RB_Group_Id
=
userInfo
.
RB_Group_id
;
demodel
.
RB_Group_Id
=
userInfo
.
RB_Group_id
;
var
list
=
propertyModule
.
GetDepreciationStatisticsPageList
(
pagelist
.
pageIndex
,
pagelist
.
pageSize
,
demodel
,
out
long
count
);
var
list
=
propertyModule
.
GetDepreciationStatisticsPageList
(
pagelist
.
pageIndex
,
pagelist
.
pageSize
,
demodel
,
out
long
count
);
pagelist
.
count
=
Convert
.
ToInt32
(
count
);
pagelist
.
count
=
Convert
.
ToInt32
(
count
);
...
@@ -4132,6 +4184,7 @@ namespace Property.WebApi.Controllers.User
...
@@ -4132,6 +4184,7 @@ namespace Property.WebApi.Controllers.User
demodel
.
EndTime
=
Convert
.
ToDateTime
(
demodel
.
EndTime
+
"-01"
).
AddMonths
(
1
).
AddDays
(-
1
).
ToString
(
"yyyy-MM-dd"
);
demodel
.
EndTime
=
Convert
.
ToDateTime
(
demodel
.
EndTime
+
"-01"
).
AddMonths
(
1
).
AddDays
(-
1
).
ToString
(
"yyyy-MM-dd"
);
demodel
.
IsSelectDepreciation
=
1
;
demodel
.
IsSelectDepreciation
=
1
;
demodel
.
IsDepreciation
=
1
;
demodel
.
RB_Group_Id
=
userInfo
.
RB_Group_id
;
demodel
.
RB_Group_Id
=
userInfo
.
RB_Group_id
;
var
list
=
propertyModule
.
GetDepreciationStatisticsList
(
demodel
);
var
list
=
propertyModule
.
GetDepreciationStatisticsList
(
demodel
);
...
...
Property.WebApi/Controllers/Property/SuppliesController.cs
View file @
958e71c6
...
@@ -62,6 +62,27 @@ namespace Property.WebApi.Controllers.User
...
@@ -62,6 +62,27 @@ namespace Property.WebApi.Controllers.User
return
ApiResult
.
Success
(
""
,
pagelist
);
return
ApiResult
.
Success
(
""
,
pagelist
);
}
}
/// <summary>
/// 获取物料档案列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetMaterialList
()
{
var
requestParm
=
GetRequestParm
();
UserInfo
userInfo
=
CacheManager
.
User
.
UserReidsCache
.
GetUserLoginInfo
(
requestParm
.
uid
);
RB_Supplies_Material_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Supplies_Material_Extend
>(
requestParm
.
msg
.
ToString
());
demodel
.
RB_Group_Id
=
userInfo
.
RB_Group_id
;
var
list
=
suppliesModule
.
GetMaterialList
(
demodel
);
return
ApiResult
.
Success
(
""
,
list
.
Select
(
x
=>
new
{
x
.
Id
,
x
.
Name
,
x
.
SuppliesNum
}));
}
/// <summary>
/// <summary>
/// 获取物料详情
/// 获取物料详情
/// </summary>
/// </summary>
...
@@ -446,6 +467,246 @@ namespace Property.WebApi.Controllers.User
...
@@ -446,6 +467,246 @@ namespace Property.WebApi.Controllers.User
}
}
/// <summary>
/// 获取退库单列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetReturnsStockInPageList
()
{
var
requestParm
=
GetRequestParm
();
UserInfo
userInfo
=
CacheManager
.
User
.
UserReidsCache
.
GetUserLoginInfo
(
requestParm
.
uid
);
ResultPageModel
pagelist
=
JsonConvert
.
DeserializeObject
<
ResultPageModel
>(
requestParm
.
msg
.
ToString
());
RB_Supplies_StockIn_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Supplies_StockIn_Extend
>(
requestParm
.
msg
.
ToString
());
demodel
.
RB_Group_Id
=
userInfo
.
RB_Group_id
;
var
list
=
suppliesModule
.
GetReturnsStockInPageList
(
pagelist
.
pageIndex
,
pagelist
.
pageSize
,
demodel
,
out
long
count
);
pagelist
.
count
=
Convert
.
ToInt32
(
count
);
pagelist
.
pageData
=
list
.
Select
(
x
=>
new
{
x
.
Id
,
x
.
StockInState
,
StockInStateStr
=
x
.
StockInState
.
GetEnumName
(),
StockInDate
=
x
.
StockInDate
.
HasValue
?
x
.
StockInDate
.
Value
.
ToString
(
"yyyy-MM-dd"
)
:
""
,
x
.
StockInNum
,
x
.
WareHouseName
,
x
.
WarehouseId
,
x
.
Remark
,
x
.
Money
,
x
.
SupplierName
,
x
.
FinanceId
,
x
.
AuditDescription
,
x
.
ProcurementId
,
DetailList
=
x
.
DetailList
.
Select
(
z
=>
new
{
z
.
Id
,
z
.
CategoryName
,
z
.
UnitPrice
,
z
.
Money
,
z
.
Number
,
z
.
SuppliesName
,
z
.
SuppliesNum
,
z
.
BrandName
,
z
.
SuppliesModel
,
z
.
SuppliesId
,
z
.
Units
,
z
.
Remark
,
z
.
GoodsSpecificationList
,
z
.
GoodsCategoryList
}),
x
.
ReturnsId
,
x
.
ReturnsNo
,
UpdateBy
=
CacheManager
.
User
.
UserReidsCache
.
GetEmployee
(
x
.
UpdateBy
)?.
EmName
??
""
,
UpdateDate
=
x
.
UpdateDate
.
Value
.
ToString
(
"yyyy-MM-dd"
)
});
return
ApiResult
.
Success
(
""
,
pagelist
);
}
/// <summary>
/// 退库单下载excel
/// </summary>
[
HttpPost
]
public
FileContentResult
GetReturnsStockInPageListToExcel
()
{
var
requestParm
=
GetRequestParm
();
UserInfo
userInfo
=
CacheManager
.
User
.
UserReidsCache
.
GetUserLoginInfo
(
requestParm
.
uid
);
RB_Supplies_StockIn_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Supplies_StockIn_Extend
>(
requestParm
.
msg
.
ToString
());
List
<
ExcelDataSource
>
slist
=
new
List
<
ExcelDataSource
>();
ExcelDataSource
header
=
new
ExcelDataSource
()
{
ExcelRows
=
new
List
<
ExcelColumn
>(
30
)
{
new
ExcelColumn
(
value
:
"退库状态"
){
CellWidth
=
25
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"退库编码"
){
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"退库时间"
){
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"仓库名称"
){
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"供应商名称"
){
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"耗材编码"
){
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"耗材名称"
){
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"分类名称"
){
CellWidth
=
25
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"品牌"
){
CellWidth
=
25
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"单价"
){
CellWidth
=
20
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"金额"
){
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"数量"
){
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"出库单号"
){
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
},
};
slist
.
Add
(
header
);
try
{
demodel
.
RB_Group_Id
=
userInfo
.
RB_Group_id
;
var
list
=
suppliesModule
.
GetStockInPageList
(
1
,
99999
,
demodel
,
out
long
count
,
false
);
#
region
组装数据
int
Num
=
1
;
foreach
(
var
item
in
list
)
{
Num
=
1
;
foreach
(
var
citem
in
item
.
DetailList
)
{
int
Count
=
item
.
DetailList
.
Count
();
if
(
Num
==
1
)
{
ExcelDataSource
datarow
=
new
ExcelDataSource
()
{
ExcelRows
=
new
List
<
ExcelColumn
>(
30
)
{
new
ExcelColumn
(
value
:
item
.
StockInState
.
GetEnumName
()){
Rowspan
=
Count
},
new
ExcelColumn
(
value
:
item
.
StockInNum
){
Rowspan
=
Count
},
new
ExcelColumn
(
value
:
item
.
StockInDate
.
HasValue
?
item
.
StockInDate
.
Value
.
ToString
(
"yyyy-MM-dd"
):
""
){
Rowspan
=
Count
},
new
ExcelColumn
(
value
:
item
.
WareHouseName
){
Rowspan
=
Count
},
new
ExcelColumn
(
value
:
item
.
SupplierName
){
Rowspan
=
Count
},
new
ExcelColumn
(
value
:
citem
.
SuppliesNum
){
},
new
ExcelColumn
(
value
:
citem
.
SuppliesName
){
},
new
ExcelColumn
(
value
:
citem
.
CategoryName
){
},
new
ExcelColumn
(
value
:
citem
.
BrandName
){
},
new
ExcelColumn
(
value
:(
citem
.
UnitPrice
??
0
).
ToString
()){
},
new
ExcelColumn
(
value
:(
citem
.
Money
??
0
).
ToString
()){
},
new
ExcelColumn
(
value
:(
citem
.
Number
??
0
).
ToString
()){
},
new
ExcelColumn
(
value
:
item
.
ReturnsNo
){
Rowspan
=
Count
},
}
};
slist
.
Add
(
datarow
);
}
else
{
ExcelDataSource
datarow
=
new
ExcelDataSource
()
{
ExcelRows
=
new
List
<
ExcelColumn
>(
30
)
{
new
ExcelColumn
(
value
:
""
){
},
new
ExcelColumn
(
value
:
""
){
},
new
ExcelColumn
(
value
:
""
){
},
new
ExcelColumn
(
value
:
""
){
},
new
ExcelColumn
(
value
:
""
){
},
new
ExcelColumn
(
value
:
citem
.
SuppliesNum
){
},
new
ExcelColumn
(
value
:
citem
.
SuppliesName
){
},
new
ExcelColumn
(
value
:
citem
.
CategoryName
){
},
new
ExcelColumn
(
value
:
citem
.
BrandName
){
},
new
ExcelColumn
(
value
:(
citem
.
UnitPrice
??
0
).
ToString
()){
},
new
ExcelColumn
(
value
:(
citem
.
Money
??
0
).
ToString
()){
},
new
ExcelColumn
(
value
:(
citem
.
Number
??
0
).
ToString
()),
new
ExcelColumn
(
value
:
""
){
},
}
};
slist
.
Add
(
datarow
);
}
Num
++;
}
}
#
endregion
var
byteData
=
ExcelTempLateHelper
.
ToExcelExtend
(
slist
);
return
File
(
byteData
,
"application/octet-stream"
,
"耗材入库单.xls"
);
}
catch
(
Exception
ex
)
{
LogHelper
.
Write
(
ex
,
string
.
Format
(
"GetFileFromWebApi_requestData: {0}"
,
JsonHelper
.
Serialize
(
requestParm
)));
var
byteData1
=
ExcelTempLateHelper
.
ToExcelExtend
(
slist
);
return
File
(
byteData1
,
"application/octet-stream"
,
"耗材入库单.xls"
);
}
}
/// <summary>
/// 设置出库单 重新入库
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SetReturnsStockInInfo
()
{
var
requestParm
=
GetRequestParm
();
UserInfo
userInfo
=
CacheManager
.
User
.
UserReidsCache
.
GetUserLoginInfo
(
requestParm
.
uid
);
RB_Supplies_StockIn_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Supplies_StockIn_Extend
>(
requestParm
.
msg
.
ToString
());
if
(
demodel
.
ReturnsId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递出库单id"
);
}
if
(
demodel
.
DetailList
==
null
||
!
demodel
.
DetailList
.
Any
())
{
return
ApiResult
.
ParamIsNull
(
"请选择物料"
);
}
if
(!
demodel
.
StockInDate
.
HasValue
)
{
return
ApiResult
.
ParamIsNull
(
"请输入退库日期"
);
}
foreach
(
var
item
in
demodel
.
DetailList
)
{
if
(
item
.
SuppliesId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递正确的物料id"
);
}
if
(!
item
.
Money
.
HasValue
)
{
return
ApiResult
.
ParamIsNull
(
"请输入退库金额"
);
}
if
(
item
.
Number
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请输入退库数量"
);
}
}
//判断当前仓库是否在盘点中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
=
demodel
.
WarehouseId
??
0
,
CheckState
=
REBORN
.
Common
.
Enum
.
SuppliesCheckStatusEnum
.
InTheInventory
});
if
(
suppliesCheckList
!=
null
&&
suppliesCheckList
.
Any
())
{
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
(
"请选择耗材"
);
}
demodel
.
Status
=
0
;
demodel
.
RB_Branch_Id
=
userInfo
.
RB_Branch_id
;
demodel
.
RB_Group_Id
=
userInfo
.
RB_Group_id
;
demodel
.
CreateBy
=
userInfo
.
EmployeeId
;
demodel
.
CreateDate
=
DateTime
.
Now
;
demodel
.
UpdateBy
=
userInfo
.
EmployeeId
;
demodel
.
UpdateDate
=
DateTime
.
Now
;
string
msg
=
suppliesModule
.
SetReturnsStockInInfo
(
demodel
);
if
(
msg
==
""
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
(
msg
);
}
}
/// <summary>
/// <summary>
/// 设置入库单
/// 设置入库单
/// </summary>
/// </summary>
...
@@ -686,8 +947,10 @@ namespace Property.WebApi.Controllers.User
...
@@ -686,8 +947,10 @@ namespace Property.WebApi.Controllers.User
z
.
Remark
,
z
.
Remark
,
z
.
InventoryNum
,
z
.
InventoryNum
,
z
.
GoodsSpecificationList
,
z
.
GoodsSpecificationList
,
z
.
GoodsCategoryList
z
.
GoodsCategoryList
,
z
.
Money
}),
}),
x
.
IsReturns
,
UpdateBy
=
(
CacheManager
.
User
.
UserReidsCache
.
GetEmployee
(
x
.
UpdateBy
)?.
EmName
??
""
),
UpdateBy
=
(
CacheManager
.
User
.
UserReidsCache
.
GetEmployee
(
x
.
UpdateBy
)?.
EmName
??
""
),
UpdateDate
=
x
.
UpdateDate
.
Value
.
ToString
(
"yyyy-MM-dd"
)
UpdateDate
=
x
.
UpdateDate
.
Value
.
ToString
(
"yyyy-MM-dd"
)
});
});
...
@@ -718,8 +981,8 @@ namespace Property.WebApi.Controllers.User
...
@@ -718,8 +981,8 @@ namespace Property.WebApi.Controllers.User
new
ExcelColumn
(
value
:
"品牌"
){
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"品牌"
){
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"库存"
){
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"库存"
){
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"数量"
){
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"数量"
){
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"
关联订单"
){
CellWidth
=
2
5
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"
出库金额"
){
CellWidth
=
1
5
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"
关联单据
"
){
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
new
ExcelColumn
(
value
:
"
申请单号
"
){
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
},
},
},
};
};
slist
.
Add
(
header
);
slist
.
Add
(
header
);
...
@@ -727,12 +990,6 @@ namespace Property.WebApi.Controllers.User
...
@@ -727,12 +990,6 @@ namespace Property.WebApi.Controllers.User
{
{
demodel
.
RB_Group_Id
=
userInfo
.
RB_Group_id
;
demodel
.
RB_Group_Id
=
userInfo
.
RB_Group_id
;
List
<
RB_Supplies_StockOut_Extend
>
list
=
suppliesModule
.
GetStockOutPageList
(
1
,
99999
,
demodel
,
out
long
count
);
List
<
RB_Supplies_StockOut_Extend
>
list
=
suppliesModule
.
GetStockOutPageList
(
1
,
99999
,
demodel
,
out
long
count
);
List
<
Model
.
Extend
.
Mall
.
RB_WarehouseOut_GoodsDetail_Extend
>
orderList
=
new
List
<
Model
.
Extend
.
Mall
.
RB_WarehouseOut_GoodsDetail_Extend
>();
if
(
list
.
Any
())
{
//查询对应的订单号
string
StockOutIds
=
string
.
Join
(
","
,
list
.
Select
(
x
=>
x
.
Id
));
orderList
=
suppliesModule
.
GetStockOutOrderNoList
(
StockOutIds
);
}
#
region
组装数据
#
region
组装数据
int
Num
=
1
;
int
Num
=
1
;
foreach
(
var
item
in
list
)
foreach
(
var
item
in
list
)
...
@@ -740,16 +997,6 @@ namespace Property.WebApi.Controllers.User
...
@@ -740,16 +997,6 @@ namespace Property.WebApi.Controllers.User
Num
=
1
;
Num
=
1
;
foreach
(
var
citem
in
item
.
DetailList
)
foreach
(
var
citem
in
item
.
DetailList
)
{
{
string
OrderNo
=
""
;
List
<
int
>
FinanceIdList
=
new
List
<
int
>();
foreach
(
var
qqitem
in
orderList
.
Where
(
x
=>
x
.
MaterialId
==
citem
.
SuppliesId
&&
x
.
StockOutId
==
item
.
Id
))
{
OrderNo
+=
qqitem
.
OrderNo
+
"("
+
qqitem
.
OrderId
+
")"
+
","
;
FinanceIdList
.
Add
(
qqitem
.
FinanceId
);
}
if
(!
string
.
IsNullOrEmpty
(
OrderNo
))
{
OrderNo
=
OrderNo
[
0.
.^
1
];
}
string
FinanceIds
=
string
.
Join
(
","
,
FinanceIdList
.
Distinct
());
int
Count
=
item
.
DetailList
.
Count
();
int
Count
=
item
.
DetailList
.
Count
();
if
(
Num
==
1
)
if
(
Num
==
1
)
{
{
...
@@ -765,9 +1012,9 @@ namespace Property.WebApi.Controllers.User
...
@@ -765,9 +1012,9 @@ namespace Property.WebApi.Controllers.User
new
ExcelColumn
(
value
:
citem
.
CategoryName
){
},
new
ExcelColumn
(
value
:
citem
.
CategoryName
){
},
new
ExcelColumn
(
value
:
citem
.
BrandName
){
},
new
ExcelColumn
(
value
:
citem
.
BrandName
){
},
new
ExcelColumn
(
value
:(
citem
.
InventoryNum
??
0
).
ToString
()){
},
new
ExcelColumn
(
value
:(
citem
.
InventoryNum
??
0
).
ToString
()){
},
new
ExcelColumn
(
value
:(
citem
.
Number
??
0
).
ToString
()),
new
ExcelColumn
(
value
:(
citem
.
Number
??
0
).
ToString
())
{
}
,
new
ExcelColumn
(
value
:
OrderNo
)
,
new
ExcelColumn
(
value
:
(
citem
.
Money
??
0
).
ToString
(
"#0.00"
)){
}
,
new
ExcelColumn
(
value
:
FinanceIds
)
,
new
ExcelColumn
(
value
:
item
.
ApplyForId
.
ToString
()){
Rowspan
=
Count
}
,
}
}
};
};
slist
.
Add
(
datarow
);
slist
.
Add
(
datarow
);
...
@@ -787,8 +1034,8 @@ namespace Property.WebApi.Controllers.User
...
@@ -787,8 +1034,8 @@ namespace Property.WebApi.Controllers.User
new
ExcelColumn
(
value
:
citem
.
BrandName
){
},
new
ExcelColumn
(
value
:
citem
.
BrandName
){
},
new
ExcelColumn
(
value
:(
citem
.
InventoryNum
??
0
).
ToString
()){
},
new
ExcelColumn
(
value
:(
citem
.
InventoryNum
??
0
).
ToString
()){
},
new
ExcelColumn
(
value
:(
citem
.
Number
??
0
).
ToString
()),
new
ExcelColumn
(
value
:(
citem
.
Number
??
0
).
ToString
()),
new
ExcelColumn
(
value
:
OrderNo
),
new
ExcelColumn
(
value
:
(
citem
.
Money
??
0
).
ToString
(
"#0.00"
)
),
new
ExcelColumn
(
value
:
FinanceIds
),
new
ExcelColumn
(
value
:
""
),
}
}
};
};
slist
.
Add
(
datarow
);
slist
.
Add
(
datarow
);
...
@@ -1001,6 +1248,34 @@ namespace Property.WebApi.Controllers.User
...
@@ -1001,6 +1248,34 @@ namespace Property.WebApi.Controllers.User
return
ApiResult
.
Success
(
""
,
pagelist
);
return
ApiResult
.
Success
(
""
,
pagelist
);
}
}
/// <summary>
/// 设置库存金额
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SetInventoryMoney
()
{
var
requestParm
=
GetRequestParm
();
UserInfo
userInfo
=
CacheManager
.
User
.
UserReidsCache
.
GetUserLoginInfo
(
requestParm
.
uid
);
JObject
parms
=
JObject
.
Parse
(
requestParm
.
msg
.
ToString
());
int
InventoryId
=
parms
.
GetInt
(
"InventoryId"
,
0
);
//库存
decimal
TotalMoney
=
parms
.
GetDecimal
(
"TotalMoney"
);
//总金额
if
(
InventoryId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递库存id"
);
}
if
(
TotalMoney
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递总金额"
);
}
string
msg
=
suppliesModule
.
SetInventoryMoney
(
InventoryId
,
TotalMoney
,
userInfo
);
if
(
msg
==
""
)
{
return
ApiResult
.
Success
(
""
);
}
else
{
return
ApiResult
.
Failed
(
msg
);
}
}
/// <summary>
/// <summary>
/// 物料库存统计下载excel
/// 物料库存统计下载excel
/// </summary>
/// </summary>
...
@@ -3325,5 +3600,109 @@ namespace Property.WebApi.Controllers.User
...
@@ -3325,5 +3600,109 @@ namespace Property.WebApi.Controllers.User
}
}
#
endregion
#
endregion
#
region
资产耗材调拨
/// <summary>
/// 资产耗材 调拨
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SetPropertySuppliesAllot
()
{
var
requestParm
=
GetRequestParm
();
UserInfo
userInfo
=
CacheManager
.
User
.
UserReidsCache
.
GetUserLoginInfo
(
requestParm
.
uid
);
RB_Allocate_Record_Extend
demodel
=
JsonHelper
.
DeserializeObject
<
RB_Allocate_Record_Extend
>(
requestParm
.
msg
.
ToString
());
if
(
demodel
.
Type
==
1
)
{
//资产转耗材
if
(
demodel
.
PropertyId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递资产id"
);
}
if
(
demodel
.
MaterialId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递转入物料id"
);
}
if
(
demodel
.
WarehouseId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递转入仓库id"
);
}
}
else
{
//耗材转资产
if
(
demodel
.
MaterialId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递转出物料id"
);
}
if
(
demodel
.
WarehouseId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递转出仓库id"
);
}
if
(
demodel
.
SuppliesNumber
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递转出耗材的数量"
);
}
if
(
demodel
.
CategoryId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递转入资产分类id"
);
}
if
(
demodel
.
SchoolId
<
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递转入校区id"
);
}
if
(
string
.
IsNullOrEmpty
(
demodel
.
BuyDate
))
{
return
ApiResult
.
ParamIsNull
(
"请传递购置日期"
);
}
}
demodel
.
RB_Group_Id
=
userInfo
.
RB_Group_id
;
demodel
.
RB_Branch_Id
=
userInfo
.
RB_Branch_id
;
demodel
.
Status
=
0
;
demodel
.
CreateBy
=
userInfo
.
EmployeeId
;
demodel
.
CreateDate
=
DateTime
.
Now
;
string
msg
=
suppliesModule
.
SetPropertySuppliesAllot
(
demodel
,
userInfo
);
if
(
msg
==
""
)
{
return
ApiResult
.
Success
(
""
);
}
else
{
return
ApiResult
.
Failed
(
msg
);
}
}
/// <summary>
/// 获取资产耗材调拨明细
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetPropertySuppliesAllotPageList
()
{
var
requestParm
=
GetRequestParm
();
UserInfo
userInfo
=
CacheManager
.
User
.
UserReidsCache
.
GetUserLoginInfo
(
requestParm
.
uid
);
ResultPageModel
pagelist
=
JsonConvert
.
DeserializeObject
<
ResultPageModel
>(
requestParm
.
msg
.
ToString
());
RB_Allocate_Record_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Allocate_Record_Extend
>(
requestParm
.
msg
.
ToString
());
demodel
.
RB_Group_Id
=
userInfo
.
RB_Group_id
;
var
list
=
suppliesModule
.
GetPropertySuppliesAllotPageList
(
pagelist
.
pageIndex
,
pagelist
.
pageSize
,
out
long
count
,
demodel
);
pagelist
.
count
=
Convert
.
ToInt32
(
count
);
pagelist
.
pageData
=
list
.
Select
(
x
=>
new
{
x
.
Id
,
x
.
Type
,
x
.
PropertyId
,
x
.
PropertyName
,
x
.
MaterialId
,
x
.
SuppliesName
,
x
.
WarehouseId
,
x
.
WarehouseName
,
x
.
StockInOutNo
,
x
.
CreateBy
,
CreateByName
=
CacheManager
.
User
.
UserReidsCache
.
GetEmployee
(
x
.
CreateBy
)?.
EmName
??
""
,
CreateDate
=
x
.
CreateDate
.
ToString
(
"yyyy-MM-dd HH:mm"
)
});
return
ApiResult
.
Success
(
""
,
pagelist
);
}
#
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