Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mall.oytour.com
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
黄奎
mall.oytour.com
Commits
9fe4335f
Commit
9fe4335f
authored
Jul 06, 2020
by
liudong1993
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
43386d78
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
316 additions
and
4 deletions
+316
-4
RB_Goods_SpecificationPrice_Extend.cs
...odel/Extend/Product/RB_Goods_SpecificationPrice_Extend.cs
+4
-0
RB_Supplier_Extend.cs
Mall.Model/Extend/User/RB_Supplier_Extend.cs
+4
-0
PropertyModule.cs
Mall.Module.Property/PropertyModule.cs
+296
-2
RB_Supplies_MaterialRepository.cs
Mall.Repository/Property/RB_Supplies_MaterialRepository.cs
+4
-1
RB_SupplierRepository.cs
Mall.Repository/User/RB_SupplierRepository.cs
+4
-0
PropertyController.cs
Mall.WebApi/Controllers/Property/PropertyController.cs
+4
-1
No files found.
Mall.Model/Extend/Product/RB_Goods_SpecificationPrice_Extend.cs
View file @
9fe4335f
...
...
@@ -22,6 +22,10 @@ namespace Mall.Model.Extend.Product
/// </summary>
public
object
AttrList
{
get
;
set
;
}
/// <summary>
/// 规格值
/// </summary>
public
string
AttrStr
{
get
;
set
;
}
/// <summary>
/// 查询排序
/// </summary>
public
int
?
SortNum
{
get
;
set
;
}
...
...
Mall.Model/Extend/User/RB_Supplier_Extend.cs
View file @
9fe4335f
...
...
@@ -12,5 +12,9 @@ namespace Mall.Model.Extend.User
/// 账户信息
/// </summary>
public
RB_ClientBankAccount
ClientBankAccount
{
get
;
set
;
}
/// <summary>
/// ids
/// </summary>
public
string
SupplierIds
{
get
;
set
;
}
}
}
Mall.Module.Property/PropertyModule.cs
View file @
9fe4335f
...
...
@@ -36,6 +36,10 @@ namespace Mall.Module.Property
/// </summary>
private
readonly
RB_GoodsRepository
goodsRepository
=
new
RB_GoodsRepository
();
/// <summary>
/// 供应商
/// </summary>
private
readonly
RB_SupplierRepository
supplierRepository
=
new
RB_SupplierRepository
();
/// <summary>
/// 商品分类
/// </summary>
private
readonly
RB_Goods_CategoryRepository
goods_CategoryRepository
=
new
RB_Goods_CategoryRepository
();
...
...
@@ -48,6 +52,10 @@ namespace Mall.Module.Property
/// </summary>
private
readonly
RB_Goods_SpecificationValueRepository
goods_SpecificationValueRepository
=
new
RB_Goods_SpecificationValueRepository
();
/// <summary>
/// 商品价格
/// </summary>
private
readonly
RB_Goods_SpecificationPriceRepository
goods_SpecificationPriceRepository
=
new
RB_Goods_SpecificationPriceRepository
();
/// <summary>
/// 物料档案
/// </summary>
private
readonly
RB_Supplies_MaterialRepository
supplies_MaterialRepository
=
new
RB_Supplies_MaterialRepository
();
...
...
@@ -55,6 +63,10 @@ namespace Mall.Module.Property
/// 物料库存
/// </summary>
private
readonly
RB_Supplies_InventoryRepository
supplies_InventoryRepository
=
new
RB_Supplies_InventoryRepository
();
/// <summary>
/// 日志
/// </summary>
private
readonly
RB_Property_LogRepository
property_LogRepository
=
new
RB_Property_LogRepository
();
#
region
获取资产物料列表
...
...
@@ -102,9 +114,291 @@ namespace Mall.Module.Property
/// <param name="eRPEmpId"></param>
/// <param name="eRPGroupId"></param>
/// <returns></returns>
public
bool
SetSyncGoodsToMaterial
(
int
wareHouseId
,
List
<
int
>
categoryIdList
,
int
eRPEmpId
,
int
eRPGroupId
)
public
bool
SetSyncGoodsToMaterial
(
int
wareHouseId
,
List
<
int
>
categoryIdList
,
int
eRPEmpId
,
int
eRPBranchId
,
int
eRPGroupId
,
int
tenantId
,
int
mallBaseId
,
int
EmpId
)
{
try
{
string
CategoryIds
=
""
;
if
(
categoryIdList
.
Any
())
{
var
cateids
=
string
.
Join
(
","
,
categoryIdList
);
var
cateList
=
product_CategoryRepository
.
GetList
(
new
RB_Product_Category_Extend
()
{
CategoryIds
=
cateids
,
TenantId
=
tenantId
,
MallBaseId
=
mallBaseId
});
List
<
int
>
AllClist
=
new
List
<
int
>();
foreach
(
var
cmodel
in
cateList
)
{
//获取该分类下所有子集分类
if
(
cmodel
!=
null
)
{
AllClist
.
Add
(
cmodel
.
Id
);
var
clist
=
product_CategoryRepository
.
GetList
(
new
RB_Product_Category_Extend
()
{
TenantId
=
tenantId
,
MallBaseId
=
mallBaseId
,
RootId
=
cmodel
.
RootId
});
var
OneList
=
clist
.
Where
(
x
=>
x
.
ParentId
==
cmodel
.
Id
).
ToList
();
foreach
(
var
item
in
OneList
)
{
AllClist
.
Add
(
item
.
Id
);
var
TwoList
=
clist
.
Where
(
x
=>
x
.
ParentId
==
item
.
Id
).
ToList
();
if
(
TwoList
.
Any
())
{
AllClist
.
AddRange
(
TwoList
.
Select
(
x
=>
x
.
Id
).
Distinct
().
ToList
());
}
}
}
}
if
(
AllClist
.
Any
())
{
CategoryIds
=
string
.
Join
(
","
,
AllClist
);
}
}
//根据分类 查询出所有的商品
var
GoodsList
=
goodsRepository
.
GetList
(
new
RB_Goods_Extend
()
{
CategoryIds
=
CategoryIds
,
TenantId
=
tenantId
,
MallBaseId
=
mallBaseId
});
if
(
GoodsList
.
Any
())
{
var
SpecificationList
=
new
List
<
RB_Goods_Specification_Extend
>();
var
SpecificationPriceList
=
new
List
<
RB_Goods_SpecificationPrice_Extend
>();
//查询出商品规格
if
(
GoodsList
.
Where
(
x
=>
x
.
IsCustomSpecification
==
1
).
Any
())
{
string
goodsIds
=
string
.
Join
(
","
,
GoodsList
.
Where
(
x
=>
x
.
IsCustomSpecification
==
1
).
Select
(
x
=>
x
.
Id
));
SpecificationList
=
goods_SpecificationRepository
.
GetList
(
new
RB_Goods_Specification_Extend
()
{
GoodsIds
=
goodsIds
,
TenantId
=
tenantId
,
MallBaseId
=
mallBaseId
});
if
(
SpecificationList
.
Any
())
{
var
svlist
=
goods_SpecificationValueRepository
.
GetList
(
new
RB_Goods_SpecificationValue_Extend
()
{
GoodsIds
=
goodsIds
,
TenantId
=
tenantId
,
MallBaseId
=
mallBaseId
});
foreach
(
var
item
in
svlist
)
{
item
.
ImagePath
=
item
.
Image
;
}
foreach
(
var
item
in
SpecificationList
)
{
item
.
SpecificationValueList
=
svlist
.
Where
(
x
=>
x
.
SpecificationId
==
item
.
Id
).
ToList
();
}
}
SpecificationPriceList
=
goods_SpecificationPriceRepository
.
GetList
(
new
RB_Goods_SpecificationPrice_Extend
()
{
GoodsIds
=
goodsIds
,
TenantId
=
tenantId
,
MallBaseId
=
mallBaseId
});
foreach
(
var
item
in
SpecificationPriceList
)
{
if
(!
string
.
IsNullOrEmpty
(
item
.
SpecificationSort
))
{
var
ssarr
=
item
.
SpecificationSort
.
Split
(
':'
);
int
Sort
=
Convert
.
ToInt32
(
ssarr
[
0
]);
string
pic_url
=
SpecificationList
[
0
].
SpecificationValueList
.
Where
(
x
=>
x
.
Sort
==
Sort
).
FirstOrDefault
()?.
ImagePath
;
List
<
string
>
AttrList
=
new
List
<
string
>();
for
(
int
i
=
0
;
i
<
ssarr
.
Length
;
i
++)
{
var
smodel
=
SpecificationList
[
i
];
var
svmodel
=
smodel
.
SpecificationValueList
.
Where
(
x
=>
x
.
Sort
==
Convert
.
ToInt32
(
ssarr
[
i
])).
FirstOrDefault
();
AttrList
.
Add
(
smodel
.
Name
+
":"
+
svmodel
.
Name
);
}
item
.
AttrStr
=
JsonConvert
.
SerializeObject
(
AttrList
);
}
}
}
var
GCList
=
goods_CategoryRepository
.
GetList
(
new
RB_Goods_Category_Extend
()
{
GoodsIds
=
string
.
Join
(
","
,
GoodsList
.
Select
(
x
=>
x
.
Id
)),
TenantId
=
tenantId
,
MallBaseId
=
mallBaseId
});
string
SupplierIds
=
string
.
Join
(
","
,
GoodsList
.
Where
(
x
=>
x
.
SupplierId
>
0
).
Select
(
x
=>
x
.
SupplierId
).
Distinct
());
var
Supplierlist
=
supplierRepository
.
GetList
(
new
RB_Supplier_Extend
()
{
SupplierIds
=
SupplierIds
,
TenantId
=
tenantId
,
MallBaseId
=
mallBaseId
});
var
mList
=
supplies_MaterialRepository
.
GetList
(
new
RB_Supplies_Material_Extend
()
{
WareHouseId
=
wareHouseId
,
RB_Group_Id
=
eRPGroupId
});
foreach
(
var
item
in
GoodsList
)
{
throw
new
NotImplementedException
();
var
supplierModel
=
Supplierlist
.
Where
(
x
=>
x
.
ID
==
item
.
SupplierId
).
FirstOrDefault
();
var
QGCList
=
GCList
.
Where
(
x
=>
x
.
GoodsId
==
item
.
Id
).
ToList
();
string
GoodsCategoryIds
=
string
.
Join
(
","
,
QGCList
.
Select
(
x
=>
x
.
CategoryId
).
Distinct
());
string
GoodsCategoryName
=
JsonConvert
.
SerializeObject
(
QGCList
.
Select
(
x
=>
x
.
CategoryName
).
Distinct
());
var
spList
=
SpecificationPriceList
.
Where
(
x
=>
x
.
GoodsId
==
item
.
Id
).
ToList
();
if
(
spList
.
Any
())
{
foreach
(
var
qitem
in
spList
)
{
var
mModel
=
mList
.
Where
(
x
=>
x
.
GoodsId
==
item
.
Id
&&
x
.
SpecificationKey
==
qitem
.
SpecificationSort
).
FirstOrDefault
();
if
(
mModel
==
null
)
{
//新增该耗材
int
MaterialId
=
supplies_MaterialRepository
.
Insert
(
new
Model
.
Entity
.
Property
.
RB_Supplies_Material
()
{
Barcode
=
""
,
BrandName
=
""
,
CategoryId
=
1
,
CreateBy
=
eRPEmpId
,
CreateDate
=
DateTime
.
Now
,
GoodsCategoryIds
=
GoodsCategoryIds
,
GoodsCategoryName
=
GoodsCategoryName
,
GoodsId
=
item
.
Id
,
Id
=
0
,
Images
=
item
.
CarouselImage
,
Money
=
item
.
CostPrice
,
Name
=
item
.
Name
,
RB_Branch_Id
=
eRPBranchId
,
RB_Group_Id
=
eRPGroupId
,
Remark
=
"电商同步"
,
ReservedStock
=
0
,
SafetyStock
=
0
,
SpecificationKey
=
qitem
.
SpecificationSort
,
SpecificationName
=
qitem
.
AttrStr
,
Status
=
0
,
SupplierName
=
supplierModel
?.
Name
??
""
,
SuppliesModel
=
""
,
SuppliesNum
=
""
,
Units
=
item
.
Unit
,
UpdateBy
=
eRPEmpId
,
UpdateDate
=
DateTime
.
Now
});
if
(
MaterialId
>
0
)
{
//编码自动生成
string
BMStr
=
MaterialId
.
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
;
}
}
Dictionary
<
string
,
object
>
files
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Supplies_Material_Extend
.
SuppliesNum
),
BMStr
}
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Supplies_Material_Extend
.
Id
),
FiledValue
=
MaterialId
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
supplies_MaterialRepository
.
Update
(
files
,
wheres
);
}
}
else
{
//修改
Dictionary
<
string
,
object
>
files
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Supplies_Material_Extend
.
GoodsCategoryIds
),
GoodsCategoryIds
},
{
nameof
(
RB_Supplies_Material_Extend
.
GoodsCategoryName
),
GoodsCategoryName
},
{
nameof
(
RB_Supplies_Material_Extend
.
Images
),
item
.
CarouselImage
},
{
nameof
(
RB_Supplies_Material_Extend
.
Money
),
item
.
CostPrice
},
{
nameof
(
RB_Supplies_Material_Extend
.
Name
),
item
.
Name
},
{
nameof
(
RB_Supplies_Material_Extend
.
SpecificationKey
),
qitem
.
SpecificationSort
},
{
nameof
(
RB_Supplies_Material_Extend
.
SpecificationName
),
qitem
.
AttrStr
},
{
nameof
(
RB_Supplies_Material_Extend
.
Units
),
item
.
Unit
},
{
nameof
(
RB_Supplies_Material_Extend
.
SupplierName
),
supplierModel
?.
Name
??
""
},
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Supplies_Material_Extend
.
Id
),
FiledValue
=
mModel
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
supplies_MaterialRepository
.
Update
(
files
,
wheres
);
}
}
}
else
{
string
SpecificationName
=
"规格:"
+
item
.
DefaultSpecificationName
;
var
mModel
=
mList
.
Where
(
x
=>
x
.
GoodsId
==
item
.
Id
&&
x
.
SpecificationKey
==
""
).
FirstOrDefault
();
if
(
mModel
==
null
)
{
//新增该耗材
int
MaterialId
=
supplies_MaterialRepository
.
Insert
(
new
Model
.
Entity
.
Property
.
RB_Supplies_Material
()
{
Barcode
=
""
,
BrandName
=
""
,
CategoryId
=
1
,
CreateBy
=
eRPEmpId
,
CreateDate
=
DateTime
.
Now
,
GoodsCategoryIds
=
GoodsCategoryIds
,
GoodsCategoryName
=
GoodsCategoryName
,
GoodsId
=
item
.
Id
,
Id
=
0
,
Images
=
item
.
CarouselImage
,
Money
=
item
.
CostPrice
,
Name
=
item
.
Name
,
RB_Branch_Id
=
eRPBranchId
,
RB_Group_Id
=
eRPGroupId
,
Remark
=
"电商同步"
,
ReservedStock
=
0
,
SafetyStock
=
0
,
SpecificationKey
=
""
,
SpecificationName
=
SpecificationName
,
Status
=
0
,
SupplierName
=
supplierModel
?.
Name
??
""
,
SuppliesModel
=
""
,
SuppliesNum
=
""
,
Units
=
item
.
Unit
,
UpdateBy
=
eRPEmpId
,
UpdateDate
=
DateTime
.
Now
});
if
(
MaterialId
>
0
)
{
//编码自动生成
string
BMStr
=
MaterialId
.
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
;
}
}
Dictionary
<
string
,
object
>
files
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Supplies_Material_Extend
.
SuppliesNum
),
BMStr
}
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Supplies_Material_Extend
.
Id
),
FiledValue
=
MaterialId
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
supplies_MaterialRepository
.
Update
(
files
,
wheres
);
}
}
else
{
//修改
Dictionary
<
string
,
object
>
files
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Supplies_Material_Extend
.
GoodsCategoryIds
),
GoodsCategoryIds
},
{
nameof
(
RB_Supplies_Material_Extend
.
GoodsCategoryName
),
GoodsCategoryName
},
{
nameof
(
RB_Supplies_Material_Extend
.
Images
),
item
.
CarouselImage
},
{
nameof
(
RB_Supplies_Material_Extend
.
Money
),
item
.
CostPrice
},
{
nameof
(
RB_Supplies_Material_Extend
.
Name
),
item
.
Name
},
{
nameof
(
RB_Supplies_Material_Extend
.
SpecificationKey
),
""
},
{
nameof
(
RB_Supplies_Material_Extend
.
SpecificationName
),
SpecificationName
},
{
nameof
(
RB_Supplies_Material_Extend
.
Units
),
item
.
Unit
},
{
nameof
(
RB_Supplies_Material_Extend
.
SupplierName
),
supplierModel
?.
Name
??
""
},
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Supplies_Material_Extend
.
Id
),
FiledValue
=
mModel
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
supplies_MaterialRepository
.
Update
(
files
,
wheres
);
}
}
}
}
property_LogRepository
.
Insert
(
new
Model
.
Entity
.
Property
.
RB_Property_Log
()
{
Type
=
2
,
Content
=
"同步商品信息至资产耗材,wareHouseId="
+
wareHouseId
,
CreateBy
=
EmpId
,
CreateDate
=
DateTime
.
Now
,
Id
=
0
,
MallBaseId
=
mallBaseId
,
SourceId
=
0
,
TenantId
=
tenantId
});
return
true
;
}
catch
(
Exception
ex
)
{
LogHelper
.
Write
(
ex
,
"SetSyncGoodsToMaterial"
);
return
false
;
}
}
#
endregion
...
...
Mall.Repository/Property/RB_Supplies_MaterialRepository.cs
View file @
9fe4335f
...
...
@@ -78,7 +78,10 @@ left join rb_property_category pc on sm.CategoryId=pc.Id
{
where
+=
" and sm."
+
nameof
(
RB_Supplies_Material_Extend
.
SupplierName
)
+
" like '%"
+
dmodel
.
SupplierName
+
"%'"
;
}
if
(
dmodel
.
WareHouseId
>
0
)
{
where
+=
" and sm."
+
nameof
(
RB_Supplies_Material_Extend
.
WareHouseId
)
+
"="
+
dmodel
.
WareHouseId
;
}
if
(
dmodel
.
CategoryId
>
0
)
{
where
+=
" and sm."
+
nameof
(
RB_Supplies_Material_Extend
.
CategoryId
)
+
"="
+
dmodel
.
CategoryId
;
...
...
Mall.Repository/User/RB_SupplierRepository.cs
View file @
9fe4335f
...
...
@@ -61,6 +61,10 @@ namespace Mall.Repository.User
{
where
+=
$@" and a.
{
nameof
(
RB_Supplier
.
ID
)}
=
{
dmodel
.
ID
}
"
;
}
if
(!
string
.
IsNullOrEmpty
(
dmodel
.
SupplierIds
))
{
where
+=
$@" and a.
{
nameof
(
RB_Supplier
.
ID
)}
in(
{
dmodel
.
SupplierIds
}
)"
;
}
string
sql
=
$@"select * from
{
TableName
}
as A where
{
where
}
order by Id desc"
;
return
Get
<
RB_Supplier_Extend
>(
sql
).
ToList
();
}
...
...
Mall.WebApi/Controllers/Property/PropertyController.cs
View file @
9fe4335f
...
...
@@ -93,8 +93,11 @@ namespace Mall.WebApi.Controllers.MallBase
{
return
ApiResult
.
ParamIsNull
(
"分类格式有误"
);
}
if
(
requestParm
.
ERPEmpId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递关联ERP用户id"
);
}
bool
flag
=
propertyModule
.
SetSyncGoodsToMaterial
(
WareHouseId
,
categoryIdList
,
requestParm
.
ERPEmpId
,
requestParm
.
ERP
Grou
pId
);
bool
flag
=
propertyModule
.
SetSyncGoodsToMaterial
(
WareHouseId
,
categoryIdList
,
requestParm
.
ERPEmpId
,
requestParm
.
ERP
BranchId
,
requestParm
.
ERPGroupId
,
requestParm
.
TenantId
,
requestParm
.
MallBaseId
,
requestParm
.
Em
pId
);
if
(
flag
)
{
return
ApiResult
.
Success
();
...
...
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