出入库后端调整
This commit is contained in:
@@ -59,6 +59,7 @@ namespace DOAN.Model.BZFM.Dto
|
||||
/// </summary>
|
||||
public class MmLocationOption
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string LocationCode { get; set; }
|
||||
public string LocationName { get; set; }
|
||||
public string WarehouseCode { get; set; }
|
||||
|
||||
@@ -70,6 +70,7 @@ namespace DOAN.Model.BZFM.Dto
|
||||
/// </summary>
|
||||
public class MmMaterialOption
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string MaterialCode { get; set; }
|
||||
public string MaterialName { get; set; }
|
||||
public string Specification { get; set; }
|
||||
|
||||
@@ -113,6 +113,7 @@ namespace DOAN.Service.BZFM
|
||||
.Where(it => it.Status == "启用")
|
||||
.Select(it => new MmMaterialOption
|
||||
{
|
||||
Id = it.Id,
|
||||
MaterialCode = it.MaterialCode,
|
||||
MaterialName = it.MaterialName,
|
||||
CategoryCode = it.CategoryCode,
|
||||
@@ -121,6 +122,7 @@ namespace DOAN.Service.BZFM
|
||||
SupplierName = it.SupplierName,
|
||||
Type = it.Type,
|
||||
})
|
||||
.OrderBy(it => it.Type)
|
||||
.ToList();
|
||||
}
|
||||
catch (Exception)
|
||||
@@ -138,6 +140,7 @@ namespace DOAN.Service.BZFM
|
||||
.Where(it => it.Status == "启用")
|
||||
.Select(it => new MmLocationOption
|
||||
{
|
||||
Id = it.Id,
|
||||
WarehouseCode = it.WarehouseCode,
|
||||
WarehouseName = it.WarehouseName,
|
||||
LocationCode = it.LocationCode,
|
||||
@@ -239,9 +242,10 @@ namespace DOAN.Service.BZFM
|
||||
}
|
||||
else
|
||||
{
|
||||
mmInventory.CurrentQty += delta;
|
||||
Context
|
||||
.Updateable(mmInventory)
|
||||
.SetColumns(it => it.CurrentQty == it.CurrentQty + delta)
|
||||
.UpdateColumns(it => it.CurrentQty)
|
||||
.ExecuteCommand();
|
||||
}
|
||||
|
||||
@@ -341,10 +345,10 @@ namespace DOAN.Service.BZFM
|
||||
Context.Ado.RollbackTran();
|
||||
return "库存不足,无法出库";
|
||||
}
|
||||
|
||||
mmInventory.CurrentQty -= delta;
|
||||
Context
|
||||
.Updateable(mmInventory)
|
||||
.SetColumns(it => it.CurrentQty == it.CurrentQty - delta)
|
||||
.UpdateColumns(it => it.CurrentQty)
|
||||
.ExecuteCommand();
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ namespace DOAN.Service.BZFM
|
||||
|
||||
var response = Queryable()
|
||||
.Where(predicate.ToExpression())
|
||||
.OrderByDescending(it => it.CreatedTime)
|
||||
.ToPage<MmRecordInbound, MmRecordInboundDto>(parm);
|
||||
|
||||
return response;
|
||||
|
||||
@@ -14,7 +14,10 @@ namespace DOAN.Service.BZFM
|
||||
/// <summary>
|
||||
/// 出库记录表Service业务层处理
|
||||
/// </summary>
|
||||
[AppService(ServiceType = typeof(IMmRecordOutboundService), ServiceLifetime = LifeTime.Transient)]
|
||||
[AppService(
|
||||
ServiceType = typeof(IMmRecordOutboundService),
|
||||
ServiceLifetime = LifeTime.Transient
|
||||
)]
|
||||
public class MmRecordOutboundService : BaseService<MmRecordOutbound>, IMmRecordOutboundService
|
||||
{
|
||||
/// <summary>
|
||||
@@ -28,12 +31,12 @@ namespace DOAN.Service.BZFM
|
||||
|
||||
var response = Queryable()
|
||||
.Where(predicate.ToExpression())
|
||||
.OrderByDescending(it => it.CreatedTime)
|
||||
.ToPage<MmRecordOutbound, MmRecordOutboundDto>(parm);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取详情
|
||||
/// </summary>
|
||||
@@ -41,9 +44,7 @@ namespace DOAN.Service.BZFM
|
||||
/// <returns></returns>
|
||||
public MmRecordOutbound GetInfo(int Id)
|
||||
{
|
||||
var response = Queryable()
|
||||
.Where(x => x.Id == Id)
|
||||
.First();
|
||||
var response = Queryable().Where(x => x.Id == Id).First();
|
||||
|
||||
return response;
|
||||
}
|
||||
@@ -82,11 +83,24 @@ namespace DOAN.Service.BZFM
|
||||
parm.CreatedTime[0] = parm.CreatedTime[0].Date;
|
||||
parm.CreatedTime[1] = parm.CreatedTime[1].Date;
|
||||
}
|
||||
var predicate = Expressionable.Create<MmRecordOutbound>()
|
||||
.AndIF(!string.IsNullOrEmpty(parm.MaterialCode), it => it.MaterialCode.Contains(parm.MaterialCode))
|
||||
.AndIF(!string.IsNullOrEmpty(parm.OutboundNo), it => it.OutboundNo.Contains(parm.OutboundNo))
|
||||
.AndIF(!string.IsNullOrEmpty(parm.TransactionType), it => it.TransactionType.Contains(parm.TransactionType))
|
||||
.AndIF(!string.IsNullOrEmpty(parm.Operator), it => it.Operator.Contains(parm.Operator))
|
||||
var predicate = Expressionable
|
||||
.Create<MmRecordOutbound>()
|
||||
.AndIF(
|
||||
!string.IsNullOrEmpty(parm.MaterialCode),
|
||||
it => it.MaterialCode.Contains(parm.MaterialCode)
|
||||
)
|
||||
.AndIF(
|
||||
!string.IsNullOrEmpty(parm.OutboundNo),
|
||||
it => it.OutboundNo.Contains(parm.OutboundNo)
|
||||
)
|
||||
.AndIF(
|
||||
!string.IsNullOrEmpty(parm.TransactionType),
|
||||
it => it.TransactionType.Contains(parm.TransactionType)
|
||||
)
|
||||
.AndIF(
|
||||
!string.IsNullOrEmpty(parm.Operator),
|
||||
it => it.Operator.Contains(parm.Operator)
|
||||
)
|
||||
.AndIF(
|
||||
parm.CreatedTime != null && parm.CreatedTime[0] > DateTime.MinValue,
|
||||
it => it.CreatedTime >= parm.CreatedTime[0]
|
||||
@@ -124,7 +138,8 @@ namespace DOAN.Service.BZFM
|
||||
IRow currentRow = sheet.GetRow(row);
|
||||
if (currentRow != null) // 确保行不为空
|
||||
{
|
||||
MmRecordOutboundExcelDto recordoutbound = new MmRecordOutboundExcelDto();
|
||||
MmRecordOutboundExcelDto recordoutbound =
|
||||
new MmRecordOutboundExcelDto();
|
||||
|
||||
//00 ID
|
||||
NPOI.SS.UserModel.ICell currentCell_00 = currentRow.GetCell(0);
|
||||
@@ -132,7 +147,8 @@ namespace DOAN.Service.BZFM
|
||||
|
||||
//01 创建时间
|
||||
NPOI.SS.UserModel.ICell currentCell_01 = currentRow.GetCell(1);
|
||||
recordoutbound.CreatedTime = currentCell_01?.DateCellValue ?? DateTime.Now;
|
||||
recordoutbound.CreatedTime =
|
||||
currentCell_01?.DateCellValue ?? DateTime.Now;
|
||||
|
||||
//02 出库单号
|
||||
NPOI.SS.UserModel.ICell currentCell_02 = currentRow.GetCell(2);
|
||||
@@ -273,8 +289,6 @@ namespace DOAN.Service.BZFM
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
// TODO 3.调用SplitInsert方法实现导入操作,注意主键列的配置(建议优化为,ID相同则修改,不同则新增)
|
||||
|
||||
@@ -357,4 +371,4 @@ namespace DOAN.Service.BZFM
|
||||
return query.ToPage(pager);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user