Commit 91012ee6 authored by liudong1993's avatar liudong1993
parents 9114355e fc7862e9
...@@ -269,5 +269,15 @@ namespace REBORN.Common ...@@ -269,5 +269,15 @@ namespace REBORN.Common
return new ConfigurationBuilder().Add(new JsonConfigurationSource { Path = "appsettings.json" }).Build().GetSection("PaymentFinanceApi").Value; return new ConfigurationBuilder().Add(new JsonConfigurationSource { Path = "appsettings.json" }).Build().GetSection("PaymentFinanceApi").Value;
} }
} }
/// <summary>
/// 生成成本的公司
/// </summary>
public static string ExpendBranchId
{
get
{
return new ConfigurationBuilder().Add(new JsonConfigurationSource { Path = "appsettings.json" }).Build().GetSection("ExpendBranchId").Value;
}
}
} }
} }
\ No newline at end of file
...@@ -93,11 +93,35 @@ namespace Property.Model.Entity.Mall ...@@ -93,11 +93,35 @@ namespace Property.Model.Entity.Mall
get; get;
set; set;
} }
/// <summary> /// <summary>
/// 规格key /// 规格key
/// </summary> /// </summary>
public string SpecificationSort { get; set; } public string SpecificationSort { get; set; }
/// <summary>
/// 规格key(出库的规格)
/// </summary>
public string NewSpecificationSort { get; set; }
/// <summary>
/// 规格(出库的数量)
/// </summary>
public int NewNumber
{
get;
set;
}
/// <summary>
/// 规格(出库的规格名称)
/// </summary>
public string NewSpecification
{
get;
set;
}
/// <summary> /// <summary>
/// 货号 /// 货号
/// </summary> /// </summary>
......
...@@ -239,9 +239,11 @@ namespace Property.Module.Mall ...@@ -239,9 +239,11 @@ namespace Property.Module.Mall
{ {
if (item.ID > 0) if (item.ID > 0)
{ {
Dictionary<string, object> files = new Dictionary<string, object>() { Dictionary<string, object> files = new Dictionary<string, object>()
{ {
nameof(RB_WarehouseOut_Goods.Number),item.Number} {nameof(RB_WarehouseOut_Goods.Number),item.Number},
{nameof(RB_WarehouseOut_Goods.NewSpecification),item.NewSpecification},
{nameof(RB_WarehouseOut_Goods.NewSpecificationSort),item.NewSpecificationSort},
}; };
List<WhereHelper> wheres = new List<WhereHelper>() { List<WhereHelper> wheres = new List<WhereHelper>() {
new WhereHelper(){ new WhereHelper(){
...@@ -270,7 +272,7 @@ namespace Property.Module.Mall ...@@ -270,7 +272,7 @@ namespace Property.Module.Mall
/// </summary> /// </summary>
/// <param name="demodel"></param> /// <param name="demodel"></param>
/// <returns></returns> /// <returns></returns>
public bool SetStockOutInfo(RB_WarehouseOut_Apply_Extend applyModel, RB_Supplies_StockOut_Extend demodel, List<RB_WarehouseOut_Goods_Extend> financeList, RB_Finance_Record_Extend record, int RB_Department_Id) public bool SetStockOutInfo(RB_WarehouseOut_Apply_Extend applyModel, RB_Supplies_StockOut_Extend demodel, List<RB_WarehouseOut_Goods_Extend> financeList, RB_Finance_Record_Extend record, int RB_Department_Id, List<RB_WarehouseOut_Goods_Extend> WarehouseOutGoodsList)
{ {
var trans = supplies_StockOutRepository.DbTransaction; var trans = supplies_StockOutRepository.DbTransaction;
try try
...@@ -296,7 +298,7 @@ namespace Property.Module.Mall ...@@ -296,7 +298,7 @@ namespace Property.Module.Mall
ClientID = 3134, ClientID = 3134,
CurrencyId = Config.OutCurrencyId, CurrencyId = Config.OutCurrencyId,
WBMoney = financeList.Sum(x => (x.CostMoney ?? 0) * (x.Number ?? 0)), WBMoney = financeList.Sum(x => (x.CostMoney ?? 0) * (x.Number ?? 0)),
RB_Branch_Id = demodel.RB_Branch_Id, RB_Branch_Id = Config.ExpendBranchId,
PayDate = System.DateTime.Now.ToString("yyyy-MM-dd"), PayDate = System.DateTime.Now.ToString("yyyy-MM-dd"),
TemplateId = 128, TemplateId = 128,
OrderSource = 16, OrderSource = 16,
...@@ -358,10 +360,11 @@ namespace Property.Module.Mall ...@@ -358,10 +360,11 @@ namespace Property.Module.Mall
//更新订单商品的财务id与成本价 //更新订单商品的财务id与成本价
decimal costMoney = 0; decimal costMoney = 0;
var nowGoods = financeList.Where(x => x.OrderGoodsId == item.OrderGoodsId); var nowGoods = applyModel.WarehouseOutGoodsDetailList.Where(x => x.OrderGoodsId == item.OrderGoodsId);
var nowGoodsFinan = WarehouseOutGoodsList.Where(x => x.OrderGoodsId == item.OrderGoodsId);
if (nowGoods != null && nowGoods.Any()) if (nowGoods != null && nowGoods.Any())
{ {
costMoney = (nowGoods.Sum(x => x.CostMoney ?? 0) / nowGoods.Sum(x => x.Number ?? 0)); costMoney = (nowGoods.Sum(x => x.CostMoney ?? 0) / nowGoodsFinan.Sum(x => x.Number ?? 0));
//更新申请单的出库状态 //更新申请单的出库状态
Dictionary<string, object> filesGoods = new Dictionary<string, object>() { Dictionary<string, object> filesGoods = new Dictionary<string, object>() {
{nameof(RB_Goods_OrderDetail.CostFinanceId),frid}, {nameof(RB_Goods_OrderDetail.CostFinanceId),frid},
......
...@@ -161,7 +161,7 @@ namespace Property.Repository.Mall ...@@ -161,7 +161,7 @@ namespace Property.Repository.Mall
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
builder.Append(@$"SELECT b.*,d.WarehouseId,d.Number as SuppliesNum,d.SuppliesId from rb_warehouseout_goods as b builder.Append(@$"SELECT b.*,d.WarehouseId,d.Number as SuppliesNum,d.SuppliesId from rb_warehouseout_goods as b
LEFT JOIN rb_warehouseout_apply as a on b.ApplyId=a.ID LEFT JOIN rb_warehouseout_apply as a on b.ApplyId=a.ID
LEFT JOIN rb_supplies_material as c on c.GoodsId=b.GoodsId and c.SpecificationKey=b.SpecificationSort LEFT JOIN rb_supplies_material as c on c.GoodsId=b.GoodsId and c.SpecificationKey=b.NewSpecificationSort
LEFT JOIN rb_supplies_inventory as d on d.SuppliesId=c.Id where a.`Status`=0 and b.`Status`=0 and c.`Status`=0 and d.`Status`=0 and b.IsOut=0 "); LEFT JOIN rb_supplies_inventory as d on d.SuppliesId=c.Id where a.`Status`=0 and b.`Status`=0 and c.`Status`=0 and d.`Status`=0 and b.IsOut=0 ");
if (query != null) if (query != null)
{ {
......
...@@ -165,6 +165,10 @@ namespace Property.WebApi.Controllers.Mall ...@@ -165,6 +165,10 @@ namespace Property.WebApi.Controllers.Mall
return ApiResult.Failed("商品名称:" + item.GoodsName + "订单号:" + item.OrderNo + "不属于当前申请单"); return ApiResult.Failed("商品名称:" + item.GoodsName + "订单号:" + item.OrderNo + "不属于当前申请单");
} }
} }
//判断商品规格是否属于该商品
var result = warehouseOutModule.UpdateWarehouseOutGoods(demodel.WarehouseOutGoodsList); var result = warehouseOutModule.UpdateWarehouseOutGoods(demodel.WarehouseOutGoodsList);
if (result) if (result)
{ {
...@@ -266,8 +270,8 @@ namespace Property.WebApi.Controllers.Mall ...@@ -266,8 +270,8 @@ namespace Property.WebApi.Controllers.Mall
applyModel.WarehouseOutGoodsDetailList.Where(x => x.OrderGoodsId == item.Key).ToList().ForEach(x => x.OrderId = oldOrderGoods.OrderId); applyModel.WarehouseOutGoodsDetailList.Where(x => x.OrderGoodsId == item.Key).ToList().ForEach(x => x.OrderId = oldOrderGoods.OrderId);
applyModel.WarehouseOutGoodsDetailList.Where(x => x.OrderGoodsId == item.Key).ToList().ForEach(x => x.GoodsId = oldOrderGoods.GoodsId); applyModel.WarehouseOutGoodsDetailList.Where(x => x.OrderGoodsId == item.Key).ToList().ForEach(x => x.GoodsId = oldOrderGoods.GoodsId);
applyModel.WarehouseOutGoodsDetailList.Where(x => x.OrderGoodsId == item.Key).ToList().ForEach(x => x.GoodsName = oldOrderGoods.GoodsName); applyModel.WarehouseOutGoodsDetailList.Where(x => x.OrderGoodsId == item.Key).ToList().ForEach(x => x.GoodsName = oldOrderGoods.GoodsName);
applyModel.WarehouseOutGoodsDetailList.Where(x => x.OrderGoodsId == item.Key).ToList().ForEach(x => x.Specification = oldOrderGoods.Specification); applyModel.WarehouseOutGoodsDetailList.Where(x => x.OrderGoodsId == item.Key).ToList().ForEach(x => x.Specification = oldOrderGoods.NewSpecification);
applyModel.WarehouseOutGoodsDetailList.Where(x => x.OrderGoodsId == item.Key).ToList().ForEach(x => x.SpecificationSort = oldOrderGoods.SpecificationSort); applyModel.WarehouseOutGoodsDetailList.Where(x => x.OrderGoodsId == item.Key).ToList().ForEach(x => x.SpecificationSort = oldOrderGoods.NewSpecificationSort);
applyModel.WarehouseOutGoodsDetailList.Where(x => x.OrderGoodsId == item.Key).ToList().ForEach(x => x.ProductCode = oldOrderGoods.ProductCode); applyModel.WarehouseOutGoodsDetailList.Where(x => x.OrderGoodsId == item.Key).ToList().ForEach(x => x.ProductCode = oldOrderGoods.ProductCode);
applyModel.WarehouseOutGoodsDetailList.Where(x => x.OrderGoodsId == item.Key).ToList().ForEach(x => x.TenantId = oldOrderGoods.TenantId); applyModel.WarehouseOutGoodsDetailList.Where(x => x.OrderGoodsId == item.Key).ToList().ForEach(x => x.TenantId = oldOrderGoods.TenantId);
applyModel.WarehouseOutGoodsDetailList.Where(x => x.OrderGoodsId == item.Key).ToList().ForEach(x => x.MallBaseId = oldOrderGoods.MallBaseId); applyModel.WarehouseOutGoodsDetailList.Where(x => x.OrderGoodsId == item.Key).ToList().ForEach(x => x.MallBaseId = oldOrderGoods.MallBaseId);
...@@ -284,7 +288,7 @@ namespace Property.WebApi.Controllers.Mall ...@@ -284,7 +288,7 @@ namespace Property.WebApi.Controllers.Mall
var nowGoodsList = applyModel.WarehouseOutGoodsDetailList.Where(x => x.OrderGoodsId == item.Key); var nowGoodsList = applyModel.WarehouseOutGoodsDetailList.Where(x => x.OrderGoodsId == item.Key);
int goodsCount = nowGoodsList.Count(); int goodsCount = nowGoodsList.Count();
if (oldOrderGoods.Number != goodsCount) if (oldOrderGoods.NewNumber != goodsCount)
{ {
return ApiResult.Failed("订单号:" + oldOrderGoods.OrderNo + "商品名称:" + oldOrderGoods.GoodsName + "必须一起出库"); return ApiResult.Failed("订单号:" + oldOrderGoods.OrderNo + "商品名称:" + oldOrderGoods.GoodsName + "必须一起出库");
} }
...@@ -292,6 +296,7 @@ namespace Property.WebApi.Controllers.Mall ...@@ -292,6 +296,7 @@ namespace Property.WebApi.Controllers.Mall
{ {
return ApiResult.Failed("订单号:" + oldOrderGoods.OrderNo + "商品名称:" + oldOrderGoods.GoodsName + "没在当前仓库"); return ApiResult.Failed("订单号:" + oldOrderGoods.OrderNo + "商品名称:" + oldOrderGoods.GoodsName + "没在当前仓库");
} }
oldOrderGoods.CostMoney = nowGoodsList.Sum(x => x.CostMoney ?? 0); oldOrderGoods.CostMoney = nowGoodsList.Sum(x => x.CostMoney ?? 0);
applyModel.WarehouseOutGoodsList.Add(oldOrderGoods); applyModel.WarehouseOutGoodsList.Add(oldOrderGoods);
...@@ -310,8 +315,8 @@ namespace Property.WebApi.Controllers.Mall ...@@ -310,8 +315,8 @@ namespace Property.WebApi.Controllers.Mall
OrderDetailId = oldOrderGoods.OrderGoodsId, OrderDetailId = oldOrderGoods.OrderGoodsId,
GoodsPrice = oldOrderGoods.CostMoney ?? 0, GoodsPrice = oldOrderGoods.CostMoney ?? 0,
FreightMoney = 0, FreightMoney = 0,
Unit_Price = Math.Round((oldOrderGoods.CostMoney ?? 0) / (oldOrderGoods.Number ?? 1), 2, MidpointRounding.AwayFromZero), Unit_Price = Math.Round((oldOrderGoods.CostMoney ?? 0) / (oldOrderGoods.NewNumber), 2, MidpointRounding.AwayFromZero),
Number = oldOrderGoods.Number Number = oldOrderGoods.NewNumber
}; };
record.RecordDetailList.Add(financeRecordDetail); record.RecordDetailList.Add(financeRecordDetail);
} }
...@@ -373,6 +378,12 @@ namespace Property.WebApi.Controllers.Mall ...@@ -373,6 +378,12 @@ namespace Property.WebApi.Controllers.Mall
foreach (var item in applyModel.WarehouseOutGoodsDetailList.GroupBy(x => x.MaterialId)) foreach (var item in applyModel.WarehouseOutGoodsDetailList.GroupBy(x => x.MaterialId))
{ {
var oldOrderGoods = wareHouseGoodsList.Where(x => x.SuppliesId == item.Key).FirstOrDefault();
if (!wareHouseGoodsList.Any(x => x.SuppliesId == item.Key))
{
return ApiResult.Failed("出库商品的规格与出库规格不一致");
}
RB_Supplies_StockOutDetail_Extend stockOutDetailModel = new RB_Supplies_StockOutDetail_Extend RB_Supplies_StockOutDetail_Extend stockOutDetailModel = new RB_Supplies_StockOutDetail_Extend
{ {
...@@ -467,7 +478,7 @@ namespace Property.WebApi.Controllers.Mall ...@@ -467,7 +478,7 @@ namespace Property.WebApi.Controllers.Mall
financeList.Add(warehouseOutModel); financeList.Add(warehouseOutModel);
} }
#endregion #endregion
bool flag = warehouseOutModule.SetStockOutInfo(applyModel, demodel, financeList, record, userInfo.RB_Department_Id); bool flag = warehouseOutModule.SetStockOutInfo(applyModel, demodel, financeList, record, userInfo.RB_Department_Id, oldModel.WarehouseOutGoodsList);
if (flag) if (flag)
{ {
return ApiResult.Success(); return ApiResult.Success();
......
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