Commit b6b616f2 authored by 吴春's avatar 吴春

提交diam

parent f4676dde
...@@ -113,6 +113,20 @@ namespace Property.Model.Entity.Mall ...@@ -113,6 +113,20 @@ namespace Property.Model.Entity.Mall
set; set;
} }
/// <summary>
/// 商品id
/// </summary>
public int NewGoodsId
{
get;
set;
}
/// <summary>
/// 出库商品名称
/// </summary>
public string NewGoodsName { get; set; }
/// <summary> /// <summary>
/// 规格(出库的规格名称) /// 规格(出库的规格名称)
/// </summary> /// </summary>
......
using System;
using REBORN.Common.AOP;
using REBORN.Common.Enum;
using REBORN.Common.Plugin;
namespace Property.Model.Entity
{
/// <summary>
/// 资产报损实体
/// </summary>
[Serializable]
[DB(ConnectionName = "PropertyConnection")]
public class RB_Supplies_ReportLossRecord
{
/// <summary>
/// Id
/// </summary>
public int Id
{
get;
set;
}
/// <summary>
/// 盘点期数id
/// </summary>
public int? CheckId
{
get;
set;
}
/// <summary>
/// 出库/入库id
/// </summary>
public int OutOrInId { get; set; }
/// <summary>
/// 报损/报溢 自动生成财务单据
/// </summary>
public int? FinanceId
{
get;
set;
}
/// <summary>
/// 盘点状态
/// </summary>
public PropertyCheckStatusEnum? CheckStatus
{
get;
set;
}
/// <summary>
/// 仓库id
/// </summary>
public int? WarehouseId
{
get;
set;
}
/// <summary>
/// 备注
/// </summary>
public string Remark
{
get;
set;
}
/// <summary>
/// 状态 0正常 1删除
/// </summary>
public int? Status
{
get;
set;
}
/// <summary>
/// 公司
/// </summary>
public int? RB_Branch_Id
{
get;
set;
}
/// <summary>
/// 集团
/// </summary>
public int? RB_Group_Id
{
get;
set;
}
/// <summary>
/// CreateBy
/// </summary>
public int? CreateBy
{
get;
set;
}
/// <summary>
/// CreateDate
/// </summary>
public DateTime? CreateDate
{
get;
set;
}
}
}
\ No newline at end of file
using System;
using REBORN.Common.AOP;
using REBORN.Common.Enum;
using REBORN.Common.Plugin;
namespace Property.Model.Entity
{
/// <summary>
/// 耗材盘点报损记录详情
/// </summary>
[Serializable]
[DB(ConnectionName = "PropertyConnection")]
public class RB_Supplies_ReportLossRecordDetail
{
/// <summary>
/// Id
/// </summary>
public int Id
{
get;
set;
}
/// <summary>
/// 盘点期数id
/// </summary>
public int? CheckId
{
get;
set;
}
/// <summary>
/// 盘点商品对应的id
/// </summary>
public int CheckDetailId { get; set; }
/// <summary>
/// 报损记录id
/// </summary>
public int? ReportLossRecordId
{
get;
set;
}
/// <summary>
/// 耗材id
/// </summary>
public int? SuppliesId
{
get;
set;
}
/// <summary>
/// 报损数量
/// </summary>
public int? ReportLossNum
{
get;
set;
}
/// <summary>
/// 报损价格
/// </summary>
public decimal? ReportLossPrice
{
get;
set;
}
/// <summary>
/// 盘点状态
/// </summary>
public PropertyCheckStatusEnum? CheckStatus
{
get;
set;
}
/// <summary>
/// 备注(报损 /报溢 需备注记录 出库单号/入库单号)
/// </summary>
public string Remark
{
get;
set;
}
/// <summary>
/// 状态 0正常 1删除
/// </summary>
public int? Status
{
get;
set;
}
/// <summary>
/// 公司
/// </summary>
public int? RB_Branch_Id
{
get;
set;
}
/// <summary>
/// 集团
/// </summary>
public int? RB_Group_Id
{
get;
set;
}
/// <summary>
/// CreateBy
/// </summary>
public int? CreateBy
{
get;
set;
}
/// <summary>
/// CreateDate
/// </summary>
public DateTime? CreateDate
{
get;
set;
}
}
}
\ No newline at end of file
using Property.Model.Entity;
using REBORN.Common.AOP;
using System;
using System.Collections.Generic;
using System.Text;
namespace Property.Model.Extend.Supplies
{
/// <summary>
/// 耗材盘点报损记录扩展表
/// </summary>
[Serializable]
[DB(ConnectionName = "PropertyConnection")]
public class RB_Supplies_ReportLossRecordDetail_Extend : RB_Supplies_ReportLossRecordDetail
{
/// <summary>
/// 商品名称
/// </summary>
public string GoodsName { get; set; }
/// <summary>
/// 商品规格名称
/// </summary>
public string SpecificationName { get; set; }
}
}
using Property.Model.Entity;
using REBORN.Common.AOP;
using System;
using System.Collections.Generic;
using System.Text;
namespace Property.Model.Extend.Supplies
{
/// <summary>
/// 资产报损扩展体
/// </summary>
[Serializable]
[DB(ConnectionName = "PropertyConnection")]
public class RB_Supplies_ReportLossRecord_Extend : RB_Supplies_ReportLossRecord
{
/// <summary>
/// 报损详情
/// </summary>
public List<RB_Supplies_ReportLossRecordDetail_Extend> DetailList { get; set; }
}
}
...@@ -78,6 +78,10 @@ namespace Property.Repository ...@@ -78,6 +78,10 @@ namespace Property.Repository
{ {
where += " and " + nameof(RB_Supplies_Check_Extend.WarehouseId) + "=" + dmodel.WarehouseId; where += " and " + nameof(RB_Supplies_Check_Extend.WarehouseId) + "=" + dmodel.WarehouseId;
} }
if (dmodel.Id > 0)
{
where += " and " + nameof(RB_Supplies_Check_Extend.Id) + "=" + dmodel.Id;
}
if (dmodel.CheckState.HasValue && dmodel.CheckState > 0) if (dmodel.CheckState.HasValue && dmodel.CheckState > 0)
{ {
where += " and " + nameof(RB_Supplies_Check_Extend.CheckState) + "=" + (int)dmodel.CheckState; where += " and " + nameof(RB_Supplies_Check_Extend.CheckState) + "=" + (int)dmodel.CheckState;
......
using Property.Model.Entity;
using Property.Model.Extend.Supplies;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Property.Repository.Supplies
{
public class RB_Supplies_ReportLossRecordDetailRepository : RepositoryBase<RB_Supplies_ReportLossRecordDetail>
{
public string TableName { get { return nameof(RB_Supplies_ReportLossRecordDetail); } }
/// <summary>
/// 盘点报损分页
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Supplies_ReportLossRecordDetail_Extend> GetWarehouseOutPageList(int pageIndex, int pageSize, out long rowCount, RB_Supplies_ReportLossRecordDetail_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.Append($" select * from {TableName} as a where a.Status=0 ");
if (query != null)
{
if (query.Id > 0)
{
builder.Append($" AND a.{nameof(RB_Supplies_ReportLossRecordDetail_Extend.Id)}={query.Id}");
}
if (query.SuppliesId > 0)
{
builder.Append($" AND a.{nameof(RB_Supplies_ReportLossRecordDetail_Extend.SuppliesId)}={query.SuppliesId}");
}
if (query.ReportLossRecordId > 0)
{
builder.Append($" AND a.{nameof(RB_Supplies_ReportLossRecordDetail_Extend.ReportLossRecordId)}={query.ReportLossRecordId}");
}
}
return GetPage<RB_Supplies_ReportLossRecordDetail_Extend>(pageIndex, pageSize, out rowCount, builder.ToString()).ToList();
}
/// <summary>
/// 盘点报损列表
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Supplies_ReportLossRecordDetail_Extend> GetWarehouseOutList(RB_Supplies_ReportLossRecordDetail_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.Append($" select * from {TableName} as a where a.Status=0 ");
if (query != null)
{
if (query.Id > 0)
{
builder.Append($" AND a.{nameof(RB_Supplies_ReportLossRecordDetail_Extend.Id)}={query.Id}");
}
if (query.SuppliesId > 0)
{
builder.Append($" AND a.{nameof(RB_Supplies_ReportLossRecordDetail_Extend.SuppliesId)}={query.SuppliesId}");
}
if (query.ReportLossRecordId > 0)
{
builder.Append($" AND a.{nameof(RB_Supplies_ReportLossRecordDetail_Extend.ReportLossRecordId)}={query.ReportLossRecordId}");
}
}
return Get<RB_Supplies_ReportLossRecordDetail_Extend>(builder.ToString()).ToList();
}
}
}
using Property.Model.Entity;
using Property.Model.Extend.Supplies;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Property.Repository.Supplies
{
public class RB_Supplies_ReportLossRecordRepository : RepositoryBase<RB_Supplies_ReportLossRecord>
{
public string TableName { get { return nameof(RB_Supplies_ReportLossRecord); } }
/// <summary>
/// 盘点报损分页
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Supplies_ReportLossRecord_Extend> GetSuppliesReportLossRecordPageList(int pageIndex, int pageSize, out long rowCount, RB_Supplies_ReportLossRecord_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.Append($" select * from {TableName} as a where a.Status=0 ");
if (query != null)
{
if (query.Id > 0)
{
builder.Append($" AND a.{nameof(RB_Supplies_ReportLossRecord_Extend.Id)}={query.Id}");
}
if (query.WarehouseId > 0)
{
builder.Append($" AND a.{nameof(RB_Supplies_ReportLossRecord_Extend.WarehouseId)}={query.WarehouseId}");
}
if (query.CheckId > 0)
{
builder.Append($" AND a.{nameof(RB_Supplies_ReportLossRecord_Extend.CheckId)}={query.CheckId}");
}
if (query.CheckStatus.HasValue && query.CheckStatus > 0)
{
builder.Append($" AND a.{nameof(RB_Supplies_ReportLossRecord_Extend.CheckStatus)}={(int)query.CheckStatus}");
}
}
return GetPage<RB_Supplies_ReportLossRecord_Extend>(pageIndex, pageSize, out rowCount, builder.ToString()).ToList();
}
/// <summary>
/// 盘点报损列表
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Supplies_ReportLossRecord_Extend> GetWarehouseOutList(RB_Supplies_ReportLossRecord_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.Append($" select * from {TableName} as a where a.Status=0 ");
if (query != null)
{
if (query.Id > 0)
{
builder.Append($" AND a.{nameof(RB_Supplies_ReportLossRecord_Extend.Id)}={query.Id}");
}
if (query.WarehouseId > 0)
{
builder.Append($" AND a.{nameof(RB_Supplies_ReportLossRecord_Extend.WarehouseId)}={query.WarehouseId}");
}
if (query.CheckId > 0)
{
builder.Append($" AND a.{nameof(RB_Supplies_ReportLossRecord_Extend.CheckId)}={query.CheckId}");
}
if (query.CheckStatus.HasValue && query.CheckStatus > 0)
{
builder.Append($" AND a.{nameof(RB_Supplies_ReportLossRecord_Extend.CheckStatus)}={(int)query.CheckStatus}");
}
}
return Get<RB_Supplies_ReportLossRecord_Extend>(builder.ToString()).ToList();
}
}
}
...@@ -228,7 +228,7 @@ namespace Property.WebApi.Controllers.Mall ...@@ -228,7 +228,7 @@ namespace Property.WebApi.Controllers.Mall
//判断当前仓库是否在盘点中2020-07-28 Add By:W //判断当前仓库是否在盘点中2020-07-28 Add By:W
var suppliesCheckList = suppliesModule.GetSuppliesCheckList(new RB_Supplies_Check_Extend { RB_Group_Id = userInfo.RB_Group_id, StartDate = System.DateTime.Now, EndDate = System.DateTime.Now, WarehouseId = applyModel.WarehouseId , CheckState =REBORN.Common.Enum.SuppliesCheckStatusEnum.InTheInventory }); var suppliesCheckList = suppliesModule.GetSuppliesCheckList(new RB_Supplies_Check_Extend { RB_Group_Id = userInfo.RB_Group_id, StartDate = System.DateTime.Now, EndDate = System.DateTime.Now, WarehouseId = applyModel.WarehouseId, CheckState = REBORN.Common.Enum.SuppliesCheckStatusEnum.InTheInventory });
if (suppliesCheckList != null && suppliesCheckList.Any()) if (suppliesCheckList != null && suppliesCheckList.Any())
{ {
return ApiResult.ParamIsNull("仓库盘点中,不能出库"); return ApiResult.ParamIsNull("仓库盘点中,不能出库");
...@@ -263,7 +263,8 @@ namespace Property.WebApi.Controllers.Mall ...@@ -263,7 +263,8 @@ namespace Property.WebApi.Controllers.Mall
//判断此次商品是否已出库与数量是否相等 //判断此次商品是否已出库与数量是否相等
applyModel.WarehouseOutGoodsList = new List<RB_WarehouseOut_Goods_Extend>(); applyModel.WarehouseOutGoodsList = new List<RB_WarehouseOut_Goods_Extend>();
var goodsList = applyModel.WarehouseOutGoodsDetailList.GroupBy(x => x.OrderGoodsId); // var goodsList = applyModel.WarehouseOutGoodsDetailList.GroupBy(x => x.OrderGoodsId);
var goodsList = applyModel.WarehouseOutGoodsDetailList.GroupBy(x => new { x.OrderGoodsId, x.GoodsId, x.SpecificationSort });
oldModel.RB_Group_Id = userInfo.RB_Group_id; oldModel.RB_Group_Id = userInfo.RB_Group_id;
applyModel.RB_Branch_Id = oldModel.RB_Branch_Id; applyModel.RB_Branch_Id = oldModel.RB_Branch_Id;
applyModel.RB_Group_Id = oldModel.RB_Group_Id; applyModel.RB_Group_Id = oldModel.RB_Group_Id;
...@@ -273,33 +274,32 @@ namespace Property.WebApi.Controllers.Mall ...@@ -273,33 +274,32 @@ namespace Property.WebApi.Controllers.Mall
var wareHouseGoodsList = warehouseOutModule.GetOuGoodsByWarehouseId(oldModel); var wareHouseGoodsList = warehouseOutModule.GetOuGoodsByWarehouseId(oldModel);
foreach (var item in goodsList) foreach (var item in goodsList)
{ {
var oldOrderGoods = oldModel.WarehouseOutGoodsList.Where(x => x.OrderGoodsId == item.Key).FirstOrDefault(); var oldOrderGoods = oldModel.WarehouseOutGoodsList.Where(x => x.OrderGoodsId == item.Key.OrderGoodsId && x.NewGoodsId == item.Key.GoodsId && x.NewSpecificationSort == item.Key.SpecificationSort).FirstOrDefault();
applyModel.WarehouseOutGoodsDetailList.Where(x => x.OrderGoodsId == item.Key).ToList().ForEach(x => x.OrderId = oldOrderGoods.OrderId); applyModel.WarehouseOutGoodsDetailList.Where(x => x.OrderGoodsId == item.Key.OrderGoodsId && x.GoodsId == item.Key.GoodsId && x.SpecificationSort == item.Key.SpecificationSort).ToList().ForEach(x => x.OrderId = oldOrderGoods.OrderId);
applyModel.WarehouseOutGoodsDetailList.Where(x => x.OrderGoodsId == item.Key).ToList().ForEach(x => x.GoodsId = oldOrderGoods.GoodsId); applyModel.WarehouseOutGoodsDetailList.Where(x => x.OrderGoodsId == item.Key.OrderGoodsId && x.GoodsId == item.Key.GoodsId && x.SpecificationSort == item.Key.SpecificationSort).ToList().ForEach(x => x.GoodsId = oldOrderGoods.NewGoodsId);
applyModel.WarehouseOutGoodsDetailList.Where(x => x.OrderGoodsId == item.Key).ToList().ForEach(x => x.GoodsName = oldOrderGoods.GoodsName); applyModel.WarehouseOutGoodsDetailList.Where(x => x.OrderGoodsId == item.Key.OrderGoodsId && x.GoodsId == item.Key.GoodsId && x.SpecificationSort == item.Key.SpecificationSort).ToList().ForEach(x => x.GoodsName = oldOrderGoods.NewGoodsName);
applyModel.WarehouseOutGoodsDetailList.Where(x => x.OrderGoodsId == item.Key).ToList().ForEach(x => x.Specification = oldOrderGoods.NewSpecification); applyModel.WarehouseOutGoodsDetailList.Where(x => x.OrderGoodsId == item.Key.OrderGoodsId && x.GoodsId == item.Key.GoodsId && x.SpecificationSort == item.Key.SpecificationSort).ToList().ForEach(x => x.Specification = oldOrderGoods.NewSpecification);
applyModel.WarehouseOutGoodsDetailList.Where(x => x.OrderGoodsId == item.Key).ToList().ForEach(x => x.SpecificationSort = oldOrderGoods.NewSpecificationSort); applyModel.WarehouseOutGoodsDetailList.Where(x => x.OrderGoodsId == item.Key.OrderGoodsId && x.GoodsId == item.Key.GoodsId && x.SpecificationSort == item.Key.SpecificationSort).ToList().ForEach(x => x.SpecificationSort = oldOrderGoods.NewSpecificationSort);
applyModel.WarehouseOutGoodsDetailList.Where(x => x.OrderGoodsId == item.Key).ToList().ForEach(x => x.ProductCode = oldOrderGoods.ProductCode); applyModel.WarehouseOutGoodsDetailList.Where(x => x.OrderGoodsId == item.Key.OrderGoodsId && x.GoodsId == item.Key.GoodsId && x.SpecificationSort == item.Key.SpecificationSort).ToList().ForEach(x => x.ProductCode = oldOrderGoods.ProductCode);
applyModel.WarehouseOutGoodsDetailList.Where(x => x.OrderGoodsId == item.Key).ToList().ForEach(x => x.TenantId = oldOrderGoods.TenantId); applyModel.WarehouseOutGoodsDetailList.Where(x => x.OrderGoodsId == item.Key.OrderGoodsId && x.GoodsId == item.Key.GoodsId && x.SpecificationSort == item.Key.SpecificationSort).ToList().ForEach(x => x.TenantId = oldOrderGoods.TenantId);
applyModel.WarehouseOutGoodsDetailList.Where(x => x.OrderGoodsId == item.Key).ToList().ForEach(x => x.MallBaseId = oldOrderGoods.MallBaseId); applyModel.WarehouseOutGoodsDetailList.Where(x => x.OrderGoodsId == item.Key.OrderGoodsId && x.GoodsId == item.Key.GoodsId && x.SpecificationSort == item.Key.SpecificationSort).ToList().ForEach(x => x.MallBaseId = oldOrderGoods.MallBaseId);
if (oldOrderGoods == null) if (oldOrderGoods == null)
{ {
var nowOrderGoods = applyModel.WarehouseOutGoodsDetailList.Where(x => x.OrderGoodsId == item.Key).FirstOrDefault(); var nowOrderGoods = applyModel.WarehouseOutGoodsDetailList.Where(x => x.OrderGoodsId == item.Key.OrderGoodsId && x.GoodsId == item.Key.GoodsId && x.SpecificationSort == item.Key.SpecificationSort).FirstOrDefault();
return ApiResult.Failed("商品不属于出库单,请核实后再出库"); return ApiResult.Failed("商品不属于出库单,请核实后再出库");
} }
else if (oldOrderGoods.IsOut == 1) else if (oldOrderGoods.IsOut == 1)
{ {
return ApiResult.Failed("订单号:" + oldOrderGoods.OrderNo + "商品名称:" + oldOrderGoods.GoodsName + "申请单中已出库"); return ApiResult.Failed("订单号:" + oldOrderGoods.OrderNo + "商品名称:" + oldOrderGoods.GoodsName + "申请单中已出库");
} }
var nowGoodsList = applyModel.WarehouseOutGoodsDetailList.Where(x => x.OrderGoodsId == item.Key.OrderGoodsId && x.GoodsId == item.Key.GoodsId && x.SpecificationSort == item.Key.SpecificationSort);
var nowGoodsList = applyModel.WarehouseOutGoodsDetailList.Where(x => x.OrderGoodsId == item.Key);
int goodsCount = nowGoodsList.Count(); int goodsCount = nowGoodsList.Count();
if (oldOrderGoods.NewNumber != goodsCount) if (oldOrderGoods.NewNumber != goodsCount)
{ {
return ApiResult.Failed("订单号:" + oldOrderGoods.OrderNo + "商品名称:" + oldOrderGoods.GoodsName + "必须一起出库"); return ApiResult.Failed("订单号:" + oldOrderGoods.OrderNo + "商品名称:" + oldOrderGoods.GoodsName + "必须一起出库");
} }
if (!wareHouseGoodsList.Any(x => x.OrderGoodsId == item.Key)) if (!wareHouseGoodsList.Any(x => x.OrderGoodsId == item.Key.OrderGoodsId && x.GoodsId == item.Key.GoodsId && x.SpecificationSort == item.Key.SpecificationSort))
{ {
return ApiResult.Failed("订单号:" + oldOrderGoods.OrderNo + "商品名称:" + oldOrderGoods.GoodsName + "没在当前仓库"); return ApiResult.Failed("订单号:" + oldOrderGoods.OrderNo + "商品名称:" + oldOrderGoods.GoodsName + "没在当前仓库");
} }
...@@ -307,7 +307,6 @@ namespace Property.WebApi.Controllers.Mall ...@@ -307,7 +307,6 @@ namespace Property.WebApi.Controllers.Mall
oldOrderGoods.CostMoney = nowGoodsList.Sum(x => x.CostMoney ?? 0); oldOrderGoods.CostMoney = nowGoodsList.Sum(x => x.CostMoney ?? 0);
applyModel.WarehouseOutGoodsList.Add(oldOrderGoods); applyModel.WarehouseOutGoodsList.Add(oldOrderGoods);
RB_Finance_RecordDetail financeRecordDetail = new RB_Finance_RecordDetail RB_Finance_RecordDetail financeRecordDetail = new RB_Finance_RecordDetail
{ {
ID = 0, ID = 0,
...@@ -328,6 +327,18 @@ namespace Property.WebApi.Controllers.Mall ...@@ -328,6 +327,18 @@ namespace Property.WebApi.Controllers.Mall
record.RecordDetailList.Add(financeRecordDetail); record.RecordDetailList.Add(financeRecordDetail);
} }
//2020-07-29 Add By:W 判断同一个订单商品拆分后的商品是否是一起出库
var orderGoodsList = applyModel.WarehouseOutGoodsDetailList.GroupBy(x => x.OrderGoodsId);
foreach (var item in orderGoodsList)
{
var oldOrderGoodsList = oldModel.WarehouseOutGoodsList.Where(x => x.OrderGoodsId == item.Key);
var outGoodsList = applyModel.WarehouseOutGoodsDetailList.Where(x=>x.OrderGoodsId==item.Key);
if (oldOrderGoodsList.Count()!= outGoodsList.Count())
{
return ApiResult.Failed("订单号:" + oldOrderGoodsList.FirstOrDefault()?.OrderNo + "中的商品必须一起出库");
}
}
if (oldModel.WarehouseOutGoodsList.Where(x => x.IsOut == 0).Count() == wareHouseGoodsList.Count()) if (oldModel.WarehouseOutGoodsList.Where(x => x.IsOut == 0).Count() == wareHouseGoodsList.Count())
{ {
......
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