Commit 65c58a2c authored by 吴春's avatar 吴春

提交代码

parent 87f6ad82
...@@ -99,6 +99,31 @@ namespace Mall.Model.Entity.Property ...@@ -99,6 +99,31 @@ namespace Mall.Model.Entity.Property
/// </summary> /// </summary>
public string SpecificationSort { get; set; } public string SpecificationSort { get; set; }
/// <summary>
/// 规格key(出库的规格),没有修改为
/// </summary>
public string NewSpecificationSort { get; set; }
/// <summary>
/// 规格(出库的规格名称)
/// </summary>
public string NewSpecification
{
get;
set;
}
/// <summary>
/// 规格(出库的数量)
/// </summary>
public int NewNumber
{
get;
set;
}
/// <summary> /// <summary>
/// 货号 /// 货号
/// </summary> /// </summary>
...@@ -134,7 +159,7 @@ namespace Mall.Model.Entity.Property ...@@ -134,7 +159,7 @@ namespace Mall.Model.Entity.Property
set; set;
} }
/// <summary> /// <summary>
/// 成本价 /// 成本价
......
...@@ -155,5 +155,30 @@ namespace Mall.Model.Extend.Product ...@@ -155,5 +155,30 @@ namespace Mall.Model.Extend.Product
/// </summary> /// </summary>
public int IsSelectAll { get; set; } public int IsSelectAll { get; set; }
/// <summary>
/// 规格key(出库的规格),没有修改为
/// </summary>
public string NewSpecificationSort { get; set; }
/// <summary>
/// 规格(出库的规格名称)
/// </summary>
public string NewSpecification
{
get;
set;
}
/// <summary>
/// 规格(出库的数量)
/// </summary>
public int NewNumber
{
get;
set;
}
} }
} }
...@@ -31,7 +31,7 @@ namespace Mall.Module.Property ...@@ -31,7 +31,7 @@ namespace Mall.Module.Property
/// </summary> /// </summary>
public class PropertyModule public class PropertyModule
{ {
/// <summary> /// <summary>
/// 商品分类 /// 商品分类
/// </summary> /// </summary>
...@@ -120,15 +120,18 @@ namespace Mall.Module.Property ...@@ -120,15 +120,18 @@ namespace Mall.Module.Property
public List<RB_Procurement_Extend> GetProcurementPageList(int pageIndex, int pageSize, RB_Procurement_Extend demodel, out long count) public List<RB_Procurement_Extend> GetProcurementPageList(int pageIndex, int pageSize, RB_Procurement_Extend demodel, out long count)
{ {
var list = procurementRepository.GetPageList(pageIndex, pageSize, demodel, out count); var list = procurementRepository.GetPageList(pageIndex, pageSize, demodel, out count);
if (list.Any()) { if (list.Any())
{
string procurementIds = string.Join(",", list.Select(x => x.Id)); string procurementIds = string.Join(",", list.Select(x => x.Id));
//查询明细 //查询明细
var pdList = procurement_DetailRepository.GetList(new RB_Procurement_Detail_Extend() { RB_Group_Id = demodel.RB_Group_Id, ProcurementIds = procurementIds, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId }); var pdList = procurement_DetailRepository.GetList(new RB_Procurement_Detail_Extend() { RB_Group_Id = demodel.RB_Group_Id, ProcurementIds = procurementIds, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId });
//查询物料 //查询物料
if (pdList.Any()) { if (pdList.Any())
{
string MaterialIds = string.Join(",", pdList.Select(x => x.MaterialId).Distinct()); string MaterialIds = string.Join(",", pdList.Select(x => x.MaterialId).Distinct());
var mList = supplies_MaterialRepository.GetList(new RB_Supplies_Material_Extend() { RB_Group_Id = demodel.RB_Group_Id, SuppliesIdStr = MaterialIds, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId }); var mList = supplies_MaterialRepository.GetList(new RB_Supplies_Material_Extend() { RB_Group_Id = demodel.RB_Group_Id, SuppliesIdStr = MaterialIds, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId });
foreach (var item in pdList) { foreach (var item in pdList)
{
item.MaterialModel = mList.Where(x => x.Id == item.MaterialId).FirstOrDefault(); item.MaterialModel = mList.Where(x => x.Id == item.MaterialId).FirstOrDefault();
if (item.MaterialModel != null) if (item.MaterialModel != null)
{ {
...@@ -148,14 +151,16 @@ namespace Mall.Module.Property ...@@ -148,14 +151,16 @@ namespace Mall.Module.Property
} }
item.MaterialModel.ImageList = JsonConvert.DeserializeObject<List<string>>(item.MaterialModel.Images); item.MaterialModel.ImageList = JsonConvert.DeserializeObject<List<string>>(item.MaterialModel.Images);
} }
else { else
{
item.MaterialModel = new RB_Supplies_Material_Extend(); item.MaterialModel = new RB_Supplies_Material_Extend();
} }
} }
} }
//var elist = employeeRepository.GetEmployeeListRepository(new Model.Entity.User.RB_Employee_Extend() { EmployeeIds = string.Join(",", list.Select(x => x.CreateBy ?? 0).Distinct()) }); //var elist = employeeRepository.GetEmployeeListRepository(new Model.Entity.User.RB_Employee_Extend() { EmployeeIds = string.Join(",", list.Select(x => x.CreateBy ?? 0).Distinct()) });
var wlist = supplies_WareHouseRepository.GetList(new RB_Supplies_WareHouse_Extend() { RB_Group_Id = demodel.RB_Group_Id, WareHouseIdStr = string.Join(",", list.Select(x => x.WareHouseId ?? 0).Distinct()) }); var wlist = supplies_WareHouseRepository.GetList(new RB_Supplies_WareHouse_Extend() { RB_Group_Id = demodel.RB_Group_Id, WareHouseIdStr = string.Join(",", list.Select(x => x.WareHouseId ?? 0).Distinct()) });
foreach (var item in list) { foreach (var item in list)
{
item.DetailList = pdList.Where(x => x.ProcurementId == item.Id).ToList(); item.DetailList = pdList.Where(x => x.ProcurementId == item.Id).ToList();
//item.CreateByName = elist.Where(x => x.EmpId == item.CreateBy).FirstOrDefault()?.EmpName ?? ""; //item.CreateByName = elist.Where(x => x.EmpId == item.CreateBy).FirstOrDefault()?.EmpName ?? "";
item.WareHouseName = wlist.Where(x => x.Id == item.WareHouseId).FirstOrDefault()?.Name ?? ""; item.WareHouseName = wlist.Where(x => x.Id == item.WareHouseId).FirstOrDefault()?.Name ?? "";
...@@ -217,7 +222,7 @@ namespace Mall.Module.Property ...@@ -217,7 +222,7 @@ namespace Mall.Module.Property
} }
} }
} }
//查询分类 //查询分类
string ids = string.Join(",", GoodsList.Select(x => x.Id)); string ids = string.Join(",", GoodsList.Select(x => x.Id));
var clist = goods_CategoryRepository.GetList(new RB_Goods_Category_Extend() { GoodsIds = ids, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId }); var clist = goods_CategoryRepository.GetList(new RB_Goods_Category_Extend() { GoodsIds = ids, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId });
...@@ -230,13 +235,14 @@ namespace Mall.Module.Property ...@@ -230,13 +235,14 @@ namespace Mall.Module.Property
{ {
List<string> CarouselIdList = JsonConvert.DeserializeObject<List<string>>(item.CarouselImage); List<string> CarouselIdList = JsonConvert.DeserializeObject<List<string>>(item.CarouselImage);
//封面图 //封面图
item.CoverImage = CarouselIdList[0]; item.CoverImage = CarouselIdList[0];
} }
if (item.IsCustomSpecification == 1) if (item.IsCustomSpecification == 1)
{ {
item.SpecificationPriceList = SpecificationPriceList.Where(x => x.GoodsId == item.Id).ToList(); item.SpecificationPriceList = SpecificationPriceList.Where(x => x.GoodsId == item.Id).ToList();
} }
else { else
{
item.SpecificationPriceList = new List<RB_Goods_SpecificationPrice_Extend>(); item.SpecificationPriceList = new List<RB_Goods_SpecificationPrice_Extend>();
item.SpecificationPriceList.Add(new RB_Goods_SpecificationPrice_Extend() item.SpecificationPriceList.Add(new RB_Goods_SpecificationPrice_Extend()
{ {
...@@ -261,7 +267,7 @@ namespace Mall.Module.Property ...@@ -261,7 +267,7 @@ namespace Mall.Module.Property
/// <param name="TenantId"></param> /// <param name="TenantId"></param>
/// <param name="MallBaseId"></param> /// <param name="MallBaseId"></param>
/// <returns></returns> /// <returns></returns>
public RB_Procurement_Extend GetProcurementInfo(int procurementId,int TenantId,int MallBaseId,int ERPGroupId) public RB_Procurement_Extend GetProcurementInfo(int procurementId, int TenantId, int MallBaseId, int ERPGroupId)
{ {
var pmodel = procurementRepository.GetEntity<RB_Procurement_Extend>(procurementId); var pmodel = procurementRepository.GetEntity<RB_Procurement_Extend>(procurementId);
//查询明细 //查询明细
...@@ -323,14 +329,17 @@ namespace Mall.Module.Property ...@@ -323,14 +329,17 @@ namespace Mall.Module.Property
//核实提交的商品物料里是否存在 //核实提交的商品物料里是否存在
string GoodsIds = string.Join(",", demodel.DetailList.Select(x => x.GoodsId).Distinct()); string GoodsIds = string.Join(",", demodel.DetailList.Select(x => x.GoodsId).Distinct());
var mList = supplies_MaterialRepository.GetList(new RB_Supplies_Material_Extend() { RB_Group_Id = eRPGroupId, GoodsIds = GoodsIds, TenantId = tenantId, MallBaseId = mallBaseId }); var mList = supplies_MaterialRepository.GetList(new RB_Supplies_Material_Extend() { RB_Group_Id = eRPGroupId, GoodsIds = GoodsIds, TenantId = tenantId, MallBaseId = mallBaseId });
foreach (var item in demodel.DetailList) { foreach (var item in demodel.DetailList)
{
var mModel = mList.Where(x => x.GoodsId == item.GoodsId && x.SpecificationKey == item.SpecificationKey).FirstOrDefault(); var mModel = mList.Where(x => x.GoodsId == item.GoodsId && x.SpecificationKey == item.SpecificationKey).FirstOrDefault();
if (mModel == null) { if (mModel == null)
{
return "商品未找到对应的资产物料档案,商品ID:" + item.GoodsId; return "商品未找到对应的资产物料档案,商品ID:" + item.GoodsId;
} }
item.MaterialId = mModel.Id; item.MaterialId = mModel.Id;
item.GoodsRemark = mModel.Name +"("+ item.GoodsId + ")"+ " "; item.GoodsRemark = mModel.Name + "(" + item.GoodsId + ")" + " ";
if (!string.IsNullOrEmpty(mModel.SpecificationName)) { if (!string.IsNullOrEmpty(mModel.SpecificationName))
{
var sList = JsonConvert.DeserializeObject<List<string>>(mModel.SpecificationName); var sList = JsonConvert.DeserializeObject<List<string>>(mModel.SpecificationName);
item.GoodsRemark += string.Join(",", sList); item.GoodsRemark += string.Join(",", sList);
} }
...@@ -409,7 +418,7 @@ namespace Mall.Module.Property ...@@ -409,7 +418,7 @@ namespace Mall.Module.Property
/// </summary> /// </summary>
/// <param name="omodel"></param> /// <param name="omodel"></param>
/// <returns></returns> /// <returns></returns>
public bool OrderProcurementFinanceModule(RB_Procurement_Extend demodel, int BankAccountId,int pid,string pRemark) public bool OrderProcurementFinanceModule(RB_Procurement_Extend demodel, int BankAccountId, int pid, string pRemark)
{ {
var flag = false; var flag = false;
try try
...@@ -495,7 +504,7 @@ namespace Mall.Module.Property ...@@ -495,7 +504,7 @@ namespace Mall.Module.Property
}; };
procurementRepository.Update(keyValues, wheres); procurementRepository.Update(keyValues, wheres);
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
...@@ -520,19 +529,24 @@ namespace Mall.Module.Property ...@@ -520,19 +529,24 @@ namespace Mall.Module.Property
public string SetProcurementStockIn(RB_Procurement_Extend demodel, int eRPEmpId, int eRPBranchId, int eRPGroupId, int tenantId, int mallBaseId, int empId) public string SetProcurementStockIn(RB_Procurement_Extend demodel, int eRPEmpId, int eRPBranchId, int eRPGroupId, int tenantId, int mallBaseId, int empId)
{ {
var pModel = procurementRepository.GetEntity(demodel.Id); var pModel = procurementRepository.GetEntity(demodel.Id);
if (pModel == null) { if (pModel == null)
{
return "未能找到采购单"; return "未能找到采购单";
} }
if (pModel.StockInStatus == 3) { if (pModel.StockInStatus == 3)
{
return "该采购单已入库完毕"; return "该采购单已入库完毕";
} }
var DetailList = procurement_DetailRepository.GetList(new RB_Procurement_Detail_Extend() { RB_Group_Id = eRPGroupId, ProcurementId = demodel.Id }); var DetailList = procurement_DetailRepository.GetList(new RB_Procurement_Detail_Extend() { RB_Group_Id = eRPGroupId, ProcurementId = demodel.Id });
if (DetailList.Any()) { if (DetailList.Any())
{
string materialIds = string.Join(",", DetailList.Select(x => x.MaterialId ?? 0).Distinct()); string materialIds = string.Join(",", DetailList.Select(x => x.MaterialId ?? 0).Distinct());
var materialList = supplies_MaterialRepository.GetList(new RB_Supplies_Material_Extend() { RB_Group_Id = eRPGroupId, SuppliesIdStr = materialIds }); var materialList = supplies_MaterialRepository.GetList(new RB_Supplies_Material_Extend() { RB_Group_Id = eRPGroupId, SuppliesIdStr = materialIds });
foreach (var item in DetailList) { foreach (var item in DetailList)
{
var materialModel = materialList.Where(x => x.Id == item.MaterialId).FirstOrDefault(); var materialModel = materialList.Where(x => x.Id == item.MaterialId).FirstOrDefault();
if (materialModel == null) { if (materialModel == null)
{
return "未能查询到物料信息"; return "未能查询到物料信息";
} }
item.GoodsId = materialModel.GoodsId ?? 0; item.GoodsId = materialModel.GoodsId ?? 0;
...@@ -540,19 +554,23 @@ namespace Mall.Module.Property ...@@ -540,19 +554,23 @@ namespace Mall.Module.Property
} }
} }
//验证已入库数量 //验证已入库数量
foreach (var item in demodel.DetailList) { foreach (var item in demodel.DetailList)
{
var dModel = DetailList.Where(x => x.GoodsId == item.GoodsId && x.SpecificationKey == item.SpecificationKey).FirstOrDefault(); var dModel = DetailList.Where(x => x.GoodsId == item.GoodsId && x.SpecificationKey == item.SpecificationKey).FirstOrDefault();
if (dModel == null) { if (dModel == null)
{
return "未找到相关商品信息,商品ID:" + item.GoodsId; return "未找到相关商品信息,商品ID:" + item.GoodsId;
} }
if ((dModel.Number ?? 0) - (dModel.StockInNum ?? 0) < item.InStockNum) { if ((dModel.Number ?? 0) - (dModel.StockInNum ?? 0) < item.InStockNum)
{
return "剩余入库数量不足,请核实后再试,商品ID:" + item.GoodsId; return "剩余入库数量不足,请核实后再试,商品ID:" + item.GoodsId;
} }
dModel.StockInNum = (dModel.StockInNum ?? 0) + item.InStockNum; dModel.StockInNum = (dModel.StockInNum ?? 0) + item.InStockNum;
} }
bool IsComplete = true; bool IsComplete = true;
foreach (var item in DetailList) { foreach (var item in DetailList)
{
if ((item.Number ?? 0) > (item.StockInNum ?? 0)) if ((item.Number ?? 0) > (item.StockInNum ?? 0))
{ {
IsComplete = false;//部分入库 IsComplete = false;//部分入库
...@@ -579,7 +597,7 @@ namespace Mall.Module.Property ...@@ -579,7 +597,7 @@ namespace Mall.Module.Property
//增加采购单已入库数量 //增加采购单已入库数量
foreach (var item in demodel.DetailList) foreach (var item in demodel.DetailList)
{ {
var dModel = DetailList.Where(x => x.GoodsId == item.GoodsId && x.SpecificationKey == item.SpecificationKey).FirstOrDefault(); var dModel = DetailList.Where(x => x.GoodsId == item.GoodsId && x.SpecificationKey == item.SpecificationKey).FirstOrDefault();
Dictionary<string, object> keyValues1 = new Dictionary<string, object>() { Dictionary<string, object> keyValues1 = new Dictionary<string, object>() {
{ nameof(RB_Procurement_Detail_Extend.StockInNum),dModel.StockInNum} { nameof(RB_Procurement_Detail_Extend.StockInNum),dModel.StockInNum}
}; };
...@@ -608,7 +626,8 @@ namespace Mall.Module.Property ...@@ -608,7 +626,8 @@ namespace Mall.Module.Property
stockInModel.SupplierName = pModel.SupplierName; stockInModel.SupplierName = pModel.SupplierName;
stockInModel.DetailList = new List<RB_Supplies_StockInDetail_Extend>(); stockInModel.DetailList = new List<RB_Supplies_StockInDetail_Extend>();
stockInModel.Money = 0; stockInModel.Money = 0;
foreach (var item in demodel.DetailList) { foreach (var item in demodel.DetailList)
{
var dModel = DetailList.Where(x => x.GoodsId == item.GoodsId && x.SpecificationKey == item.SpecificationKey).FirstOrDefault(); var dModel = DetailList.Where(x => x.GoodsId == item.GoodsId && x.SpecificationKey == item.SpecificationKey).FirstOrDefault();
decimal Money = (dModel.CostMoney ?? 0) * item.InStockNum; decimal Money = (dModel.CostMoney ?? 0) * item.InStockNum;
stockInModel.Money += Money; stockInModel.Money += Money;
...@@ -630,9 +649,10 @@ namespace Mall.Module.Property ...@@ -630,9 +649,10 @@ namespace Mall.Module.Property
UpdateDate = DateTime.Now UpdateDate = DateTime.Now
}); });
} }
bool falg2 = SetStockInInfo(stockInModel, trans); bool falg2 = SetStockInInfo(stockInModel, trans);
if (falg2 == false) { if (falg2 == false)
{
procurementRepository.DBSession.Rollback(); procurementRepository.DBSession.Rollback();
return "资产入库单生成失败"; return "资产入库单生成失败";
} }
...@@ -658,7 +678,7 @@ namespace Mall.Module.Property ...@@ -658,7 +678,7 @@ namespace Mall.Module.Property
LogHelper.Write(ex, ""); LogHelper.Write(ex, "");
procurementRepository.DBSession.Rollback(); procurementRepository.DBSession.Rollback();
return "出错啦,请联系管理员"; return "出错啦,请联系管理员";
} }
} }
/// <summary> /// <summary>
...@@ -809,12 +829,13 @@ namespace Mall.Module.Property ...@@ -809,12 +829,13 @@ namespace Mall.Module.Property
/// <param name="eRPGroupId"></param> /// <param name="eRPGroupId"></param>
/// <param name="empId"></param> /// <param name="empId"></param>
/// <returns></returns> /// <returns></returns>
public object GetProcurementStockInLableList(int procurementId,int StockInId, int eRPEmpId, int eRPGroupId, int empId) public object GetProcurementStockInLableList(int procurementId, int StockInId, int eRPEmpId, int eRPGroupId, int empId)
{ {
List<object> RObj = new List<object>(); List<object> RObj = new List<object>();
var pmodel = procurementRepository.GetEntity(procurementId); var pmodel = procurementRepository.GetEntity(procurementId);
var siList = supplies_StockInRepository.GetList(new RB_Supplies_StockIn_Extend() { RB_Group_Id = eRPGroupId, ProcurementId = procurementId, Id = StockInId }); var siList = supplies_StockInRepository.GetList(new RB_Supplies_StockIn_Extend() { RB_Group_Id = eRPGroupId, ProcurementId = procurementId, Id = StockInId });
if (siList.Any()) { if (siList.Any())
{
string siIds = string.Join(",", siList.Where(x => x.StockInState == 1).Select(x => x.Id)); string siIds = string.Join(",", siList.Where(x => x.StockInState == 1).Select(x => x.Id));
var sidList = supplies_StockInDetailRepository.GetList(new RB_Supplies_StockInDetail_Extend() { RB_Group_Id = eRPGroupId, StockInIdStr = siIds }); var sidList = supplies_StockInDetailRepository.GetList(new RB_Supplies_StockInDetail_Extend() { RB_Group_Id = eRPGroupId, StockInIdStr = siIds });
List<RB_Supplies_Material_Extend> materialList = new List<RB_Supplies_Material_Extend>(); List<RB_Supplies_Material_Extend> materialList = new List<RB_Supplies_Material_Extend>();
...@@ -827,14 +848,16 @@ namespace Mall.Module.Property ...@@ -827,14 +848,16 @@ namespace Mall.Module.Property
string erpEmpIds = string.Join(",", sidList.Select(x => x.CreateBy ?? 0).Distinct()); string erpEmpIds = string.Join(",", sidList.Select(x => x.CreateBy ?? 0).Distinct());
empList = erpemployeeRepository.GetList(new Model.Extend.Property.RB_Employee_Extend() { RB_Group_id = eRPGroupId, EmployeeIds = erpEmpIds }); empList = erpemployeeRepository.GetList(new Model.Extend.Property.RB_Employee_Extend() { RB_Group_id = eRPGroupId, EmployeeIds = erpEmpIds });
} }
foreach (var item in sidList) { foreach (var item in sidList)
{
var siModel = siList.Where(x => x.Id == item.StockInId).FirstOrDefault(); var siModel = siList.Where(x => x.Id == item.StockInId).FirstOrDefault();
var materialModel = materialList.Where(x => x.Id == item.SuppliesId).FirstOrDefault(); var materialModel = materialList.Where(x => x.Id == item.SuppliesId).FirstOrDefault();
if (materialModel == null) { continue; } if (materialModel == null) { continue; }
List<string> spList = new List<string>(); List<string> spList = new List<string>();
if (!string.IsNullOrEmpty(materialModel.SpecificationName) && materialModel.SpecificationName != "[]") { if (!string.IsNullOrEmpty(materialModel.SpecificationName) && materialModel.SpecificationName != "[]")
{
spList = JsonConvert.DeserializeObject<List<string>>(materialModel.SpecificationName); spList = JsonConvert.DeserializeObject<List<string>>(materialModel.SpecificationName);
} }
var empModel = empList.Where(x => x.EmployeeId == item.CreateBy).FirstOrDefault(); var empModel = empList.Where(x => x.EmployeeId == item.CreateBy).FirstOrDefault();
...@@ -850,18 +873,22 @@ namespace Mall.Module.Property ...@@ -850,18 +873,22 @@ namespace Mall.Module.Property
string TQRPath = basepath + "\\upfile\\code\\" + TQRName; string TQRPath = basepath + "\\upfile\\code\\" + TQRName;
string TQRImage = "/upfile/code/" + TQRName; string TQRImage = "/upfile/code/" + TQRName;
//验证文件是否存在, 存在的话就不用生成了 //验证文件是否存在, 存在的话就不用生成了
if (!File.Exists(QRPath)) { if (!File.Exists(QRPath))
{
QRCodeHelper.CreateQRCode(QRCode, 5, "", QRPath, ImageFormat.Jpeg); QRCodeHelper.CreateQRCode(QRCode, 5, "", QRPath, ImageFormat.Jpeg);
} }
if (!File.Exists(TQRPath)) { if (!File.Exists(TQRPath))
{
int width = 340; int width = 340;
if (TQRCode.Length > 30) { if (TQRCode.Length > 30)
{
width = 370; width = 370;
} }
QRCodeHelper.CreateTQRCode(TQRCode, TQRPath, ImageFormat.Jpeg, width, 50); QRCodeHelper.CreateTQRCode(TQRCode, TQRPath, ImageFormat.Jpeg, width, 50);
} }
#endregion #endregion
for (int i = 0; i < (item.Number ?? 0); i++) { for (int i = 0; i < (item.Number ?? 0); i++)
{
RObj.Add(new RObj.Add(new
{ {
materialModel.GoodsId, materialModel.GoodsId,
...@@ -931,14 +958,16 @@ namespace Mall.Module.Property ...@@ -931,14 +958,16 @@ namespace Mall.Module.Property
item.Images = "[]"; item.Images = "[]";
} }
item.ImageList = JsonConvert.DeserializeObject<List<string>>(item.Images); item.ImageList = JsonConvert.DeserializeObject<List<string>>(item.Images);
item.InventoryNum = iList.Where(x => x.SuppliesId == item.Id).FirstOrDefault()?.Number ?? 0; item.InventoryNum = iList.Where(x => x.SuppliesId == item.Id).FirstOrDefault()?.Number ?? 0;
item.GoodsSpecificationList = new List<string>(); item.GoodsSpecificationList = new List<string>();
item.GoodsCategoryList = new List<string>(); item.GoodsCategoryList = new List<string>();
if (!string.IsNullOrEmpty(item.SpecificationName)) { if (!string.IsNullOrEmpty(item.SpecificationName))
{
item.GoodsSpecificationList = JsonConvert.DeserializeObject<List<string>>(item.SpecificationName); item.GoodsSpecificationList = JsonConvert.DeserializeObject<List<string>>(item.SpecificationName);
} }
if (!string.IsNullOrEmpty(item.GoodsCategoryName)) { if (!string.IsNullOrEmpty(item.GoodsCategoryName))
{
item.GoodsCategoryList = JsonConvert.DeserializeObject<List<string>>(item.GoodsCategoryName); item.GoodsCategoryList = JsonConvert.DeserializeObject<List<string>>(item.GoodsCategoryName);
} }
} }
...@@ -953,12 +982,13 @@ namespace Mall.Module.Property ...@@ -953,12 +982,13 @@ namespace Mall.Module.Property
/// <param name="eRPEmpId"></param> /// <param name="eRPEmpId"></param>
/// <param name="eRPGroupId"></param> /// <param name="eRPGroupId"></param>
/// <returns></returns> /// <returns></returns>
public bool SetSyncGoodsToMaterial(int wareHouseId, List<int> categoryIdList, int eRPEmpId,int eRPBranchId, int eRPGroupId, int tenantId, int mallBaseId,int EmpId) public bool SetSyncGoodsToMaterial(int wareHouseId, List<int> categoryIdList, int eRPEmpId, int eRPBranchId, int eRPGroupId, int tenantId, int mallBaseId, int EmpId)
{ {
try try
{ {
string CategoryIds = ""; string CategoryIds = "";
if (categoryIdList.Any()) { if (categoryIdList.Any())
{
var cateids = string.Join(",", categoryIdList); var cateids = string.Join(",", categoryIdList);
var cateList = product_CategoryRepository.GetList(new RB_Product_Category_Extend() { CategoryIds = cateids, TenantId = tenantId, MallBaseId = mallBaseId }); var cateList = product_CategoryRepository.GetList(new RB_Product_Category_Extend() { CategoryIds = cateids, TenantId = tenantId, MallBaseId = mallBaseId });
List<int> AllClist = new List<int>(); List<int> AllClist = new List<int>();
...@@ -978,7 +1008,7 @@ namespace Mall.Module.Property ...@@ -978,7 +1008,7 @@ namespace Mall.Module.Property
{ {
AllClist.AddRange(TwoList.Select(x => x.Id).Distinct().ToList()); AllClist.AddRange(TwoList.Select(x => x.Id).Distinct().ToList());
} }
} }
} }
} }
if (AllClist.Any()) if (AllClist.Any())
...@@ -1039,8 +1069,10 @@ namespace Mall.Module.Property ...@@ -1039,8 +1069,10 @@ namespace Mall.Module.Property
string GoodsCategoryIds = string.Join(",", QGCList.Select(x => x.CategoryId).Distinct()); string GoodsCategoryIds = string.Join(",", QGCList.Select(x => x.CategoryId).Distinct());
string GoodsCategoryName = JsonConvert.SerializeObject(QGCList.Select(x => x.CategoryName).Distinct()); string GoodsCategoryName = JsonConvert.SerializeObject(QGCList.Select(x => x.CategoryName).Distinct());
var spList = SpecificationPriceList.Where(x => x.GoodsId == item.Id).ToList(); var spList = SpecificationPriceList.Where(x => x.GoodsId == item.Id).ToList();
if (spList.Any()) { if (spList.Any())
foreach (var qitem in spList) { {
foreach (var qitem in spList)
{
var mModel = mList.Where(x => x.GoodsId == item.Id && x.SpecificationKey == qitem.SpecificationSort).FirstOrDefault(); var mModel = mList.Where(x => x.GoodsId == item.Id && x.SpecificationKey == qitem.SpecificationSort).FirstOrDefault();
if (mModel == null) if (mModel == null)
{ {
...@@ -1076,7 +1108,8 @@ namespace Mall.Module.Property ...@@ -1076,7 +1108,8 @@ namespace Mall.Module.Property
TenantId = tenantId, TenantId = tenantId,
MallBaseId = mallBaseId MallBaseId = mallBaseId
}); });
if (MaterialId > 0) { if (MaterialId > 0)
{
//编码自动生成 //编码自动生成
string BMStr = MaterialId.ToString(); string BMStr = MaterialId.ToString();
if (BMStr.Length < 5) if (BMStr.Length < 5)
...@@ -1106,7 +1139,8 @@ namespace Mall.Module.Property ...@@ -1106,7 +1139,8 @@ namespace Mall.Module.Property
supplies_MaterialRepository.Update(files, wheres); supplies_MaterialRepository.Update(files, wheres);
} }
} }
else { else
{
//修改 //修改
Dictionary<string, object> files = new Dictionary<string, object>() { Dictionary<string, object> files = new Dictionary<string, object>() {
{ nameof(RB_Supplies_Material_Extend.GoodsCategoryIds),GoodsCategoryIds}, { nameof(RB_Supplies_Material_Extend.GoodsCategoryIds),GoodsCategoryIds},
...@@ -1130,7 +1164,8 @@ namespace Mall.Module.Property ...@@ -1130,7 +1164,8 @@ namespace Mall.Module.Property
} }
} }
} }
else { else
{
string SpecificationName = "[\"规格:" + item.DefaultSpecificationName + "\"]"; string SpecificationName = "[\"规格:" + item.DefaultSpecificationName + "\"]";
var mModel = mList.Where(x => x.GoodsId == item.Id && x.SpecificationKey == "").FirstOrDefault(); var mModel = mList.Where(x => x.GoodsId == item.Id && x.SpecificationKey == "").FirstOrDefault();
if (mModel == null) if (mModel == null)
...@@ -1244,6 +1279,16 @@ namespace Mall.Module.Property ...@@ -1244,6 +1279,16 @@ namespace Mall.Module.Property
} }
} }
/// <summary>
/// 获取列表
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public List<RB_Supplies_Material_Extend> GetSuppliesMaterialList(RB_Supplies_Material_Extend dmodel)
{
return supplies_MaterialRepository.GetList(dmodel);
}
#endregion #endregion
} }
} }
...@@ -93,6 +93,10 @@ left join rb_property_category pc on sm.CategoryId=pc.Id ...@@ -93,6 +93,10 @@ left join rb_property_category pc on sm.CategoryId=pc.Id
{ {
where += " and sm." + nameof(RB_Supplies_Material_Extend.CategoryId) + "=" + dmodel.CategoryId; where += " and sm." + nameof(RB_Supplies_Material_Extend.CategoryId) + "=" + dmodel.CategoryId;
} }
if (dmodel.GoodsId > 0)
{
where += " and sm." + nameof(RB_Supplies_Material_Extend.GoodsId) + "=" + dmodel.GoodsId;
}
if (!string.IsNullOrEmpty(dmodel.SuppliesIdStr)) { if (!string.IsNullOrEmpty(dmodel.SuppliesIdStr)) {
where += " and sm." + nameof(RB_Supplies_Material_Extend.Id) + " in(" + dmodel.SuppliesIdStr + ")"; where += " and sm." + nameof(RB_Supplies_Material_Extend.Id) + " in(" + dmodel.SuppliesIdStr + ")";
} }
......
...@@ -24,6 +24,7 @@ namespace Mall.WebApi.Controllers.Property ...@@ -24,6 +24,7 @@ namespace Mall.WebApi.Controllers.Property
private readonly WarehouseOutModule warehouseOutModule = new WarehouseOutModule(); private readonly WarehouseOutModule warehouseOutModule = new WarehouseOutModule();
private readonly OrderModule orderModule = new OrderModule(); private readonly OrderModule orderModule = new OrderModule();
private readonly PropertyModule propertyModule = new PropertyModule();
/// <summary> /// <summary>
/// 获取出库申请列表 /// 获取出库申请列表
...@@ -59,6 +60,24 @@ namespace Mall.WebApi.Controllers.Property ...@@ -59,6 +60,24 @@ namespace Mall.WebApi.Controllers.Property
/// <summary>
/// 根据商品id获取物料规格信息
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetSuppliesMaterialList()
{
var parms = RequestParm;
// var materialList = propertyModule.GetSuppliesMaterialList(new RB_Supplies_Material_Extend { GoodsIds = goodsIds, RB_Group_Id = requestParm.ERPGroupId, TenantId = requestParm.TenantId, MallBaseId = requestParm.MallBaseId });
RB_Supplies_Material_Extend demodel = JsonConvert.DeserializeObject<RB_Supplies_Material_Extend>(parms.msg.ToString());
demodel.TenantId = parms.TenantId;
demodel.MallBaseId = parms.MallBaseId;
demodel.RB_Group_Id = parms.ERPGroupId;
var list = propertyModule.GetSuppliesMaterialList(demodel);
return ApiResult.Success("", list);
}
/// <summary> /// <summary>
/// 提交出库申请 /// 提交出库申请
/// </summary> /// </summary>
...@@ -77,7 +96,7 @@ namespace Mall.WebApi.Controllers.Property ...@@ -77,7 +96,7 @@ namespace Mall.WebApi.Controllers.Property
{ {
return ApiResult.ParamIsNull("请传递参数"); return ApiResult.ParamIsNull("请传递参数");
} }
if (demodel.WarehouseOutGoodsList == null || !demodel.WarehouseOutGoodsList.Any()) if (demodel.WarehouseOutGoodsList == null || !demodel.WarehouseOutGoodsList.Any())
{ {
return ApiResult.ParamIsNull("请选择商品"); return ApiResult.ParamIsNull("请选择商品");
...@@ -89,6 +108,7 @@ namespace Mall.WebApi.Controllers.Property ...@@ -89,6 +108,7 @@ namespace Mall.WebApi.Controllers.Property
return ApiResult.ParamIsNull("订单商品id未传递"); return ApiResult.ParamIsNull("订单商品id未传递");
} }
} }
//根据订单商品id查询商品信息 //根据订单商品id查询商品信息
var orderGoodsIds = string.Join(",", demodel.WarehouseOutGoodsList.Select(x => x.OrderGoodsId)); var orderGoodsIds = string.Join(",", demodel.WarehouseOutGoodsList.Select(x => x.OrderGoodsId));
var orderGoodsList = orderModule.GetOrderGoodsList(new Model.Extend.Product.RB_Goods_OrderDetail_Extend { TenantId = requestParm.TenantId, MallBaseId = requestParm.MallBaseId, IdList = demodel.WarehouseOutGoodsList.Select(x => x.OrderGoodsId).ToList() }); var orderGoodsList = orderModule.GetOrderGoodsList(new Model.Extend.Product.RB_Goods_OrderDetail_Extend { TenantId = requestParm.TenantId, MallBaseId = requestParm.MallBaseId, IdList = demodel.WarehouseOutGoodsList.Select(x => x.OrderGoodsId).ToList() });
...@@ -124,9 +144,33 @@ namespace Mall.WebApi.Controllers.Property ...@@ -124,9 +144,33 @@ namespace Mall.WebApi.Controllers.Property
return ApiResult.Failed("订单号:" + msg + "的商品已申请出库,请勿重复申请"); return ApiResult.Failed("订单号:" + msg + "的商品已申请出库,请勿重复申请");
} }
//获取商品的出库规格物料信息
var goodsIds = string.Join(",", orderGoodsList.Select(x => x.GoodsId));
var materialList = propertyModule.GetSuppliesMaterialList(new RB_Supplies_Material_Extend { GoodsIds = goodsIds, RB_Group_Id = requestParm.ERPGroupId, TenantId = requestParm.TenantId, MallBaseId = requestParm.MallBaseId });
foreach (var item in demodel.WarehouseOutGoodsList) foreach (var item in demodel.WarehouseOutGoodsList)
{ {
if (item.NewNumber <= 0)
{
return ApiResult.Failed("出库商品数量不能小于0");
}
var orderGoodsDetailModel = orderGoodsList.Where(x => x.Id == item.OrderGoodsId).FirstOrDefault(); var orderGoodsDetailModel = orderGoodsList.Where(x => x.Id == item.OrderGoodsId).FirstOrDefault();
if (item.NewSpecificationSort != item.SpecificationSort)//修改了规格的判断新规格是否在物料中存在
{
var materialModel = materialList.Where(x => x.GoodsId == orderGoodsDetailModel.GoodsId && x.SpecificationKey == item.NewSpecificationSort).FirstOrDefault();
if (materialModel == null)
{
return ApiResult.Failed("订单号:" + item.OrderNo + "的商品:" + item.GoodsName + "不存在物料请先同步");
}
item.NewSpecificationSort = materialModel.SpecificationKey;
item.NewSpecification = materialModel.SpecificationName;
}
else//没有就直接等于订单的规格和数量
{
item.NewSpecificationSort = orderGoodsDetailModel.SpecificationSort;
item.NewNumber = orderGoodsDetailModel.Number.Value;
item.NewSpecification = orderGoodsDetailModel.Specification;
}
if (orderGoodsDetailModel != null) if (orderGoodsDetailModel != null)
{ {
item.TenantId = orderGoodsDetailModel.TenantId; item.TenantId = orderGoodsDetailModel.TenantId;
...@@ -188,6 +232,9 @@ namespace Mall.WebApi.Controllers.Property ...@@ -188,6 +232,9 @@ namespace Mall.WebApi.Controllers.Property
demodel.TenantId = parms.TenantId; demodel.TenantId = parms.TenantId;
demodel.MallBaseId = parms.MallBaseId; demodel.MallBaseId = parms.MallBaseId;
var list = orderModule.GetNoOutOrderGoodsList(pagelist.pageIndex, pagelist.pageSize, out long count, demodel); var list = orderModule.GetNoOutOrderGoodsList(pagelist.pageIndex, pagelist.pageSize, out long count, demodel);
list.ForEach(x => x.NewSpecificationSort = x.SpecificationSort);
list.ForEach(x => x.NewSpecification = x.Specification);
list.ForEach(x => x.NewNumber = (x.Number ?? 0));
pagelist.count = Convert.ToInt32(count); pagelist.count = Convert.ToInt32(count);
pagelist.pageData = list; pagelist.pageData = list;
return ApiResult.Success("", pagelist); return ApiResult.Success("", pagelist);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment