You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
144 lines
4.7 KiB
C#
144 lines
4.7 KiB
C#
using DS.Module.Core;
|
|
using DS.Module.Core.Extensions;
|
|
using DS.Module.User;
|
|
using DS.WMS.Core.WmsModule.Entity;
|
|
using DS.WMS.Core.WmsModule.Interface;
|
|
using Mapster;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using SqlSugar;
|
|
|
|
namespace DS.WMS.Core.WmsModule.Method;
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public class WmsCommonService : IWmsCommonService
|
|
{
|
|
private readonly IServiceProvider _serviceProvider;
|
|
private readonly ISqlSugarClient db;
|
|
private readonly IUser user;
|
|
|
|
/// <summary>
|
|
/// 构造函数
|
|
/// </summary>
|
|
/// <param name="serviceProvider"></param>
|
|
public WmsCommonService(IServiceProvider serviceProvider)
|
|
{
|
|
_serviceProvider = serviceProvider;
|
|
db = _serviceProvider.GetRequiredService<ISqlSugarClient>();
|
|
user = _serviceProvider.GetRequiredService<IUser>();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 初始化库存信息
|
|
/// </summary>
|
|
/// <param name="wmsInDo"></param>
|
|
/// <param name="doGoods"></param>
|
|
/// <returns></returns>
|
|
public DataResult<OP_WMS> InitOpWms(OP_WMS_IN_DO wmsInDo, OP_WMS_IN_DO_GOODS doGoods)
|
|
{
|
|
var billNo = NumUtil.GetBillNo(db, "WM10");
|
|
if (billNo.IsNullOrEmpty())
|
|
{
|
|
return DataResult<OP_WMS>.Failed("请设置编码规则-库存信息");
|
|
}
|
|
|
|
Guid wmsid = Guid.NewGuid();
|
|
var wms = doGoods.Adapt<OP_WMS>();
|
|
wms.WMSID = wmsid;
|
|
wms.BSNO = billNo;
|
|
wms.CORPID = user.GetCompanyId();
|
|
wms.CUSTOMERNAME = wmsInDo.CUSTOMERNAME;
|
|
wms.ISCLEAR = false;
|
|
wms.BSSTATUS = false;
|
|
wms.FEESTATUS = false;
|
|
wms.INDATE = wmsInDo.DODATE;
|
|
wms.FEESTARTDATE = wmsInDo.FEESTARTDATE;
|
|
wms.FEERATESTARTDATE = wmsInDo.FEESTARTDATE;
|
|
wms.WMSINDATE = wmsInDo.DODATE;
|
|
wms.CUSTOMNO = wmsInDo.CUSTOMNO;
|
|
wms.BILLTYPE = wmsInDo.BILLTYPE;
|
|
wms.GOODSOWNER = wmsInDo.GOODSOWNER;
|
|
wms.ARCLIENTWMSOUT = wmsInDo.ARCLIENTWMSOUT;
|
|
|
|
wms.setsingle();
|
|
wms.WMSBASEID = wms.WMSID;
|
|
return DataResult<OP_WMS>.Success(wms);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 初始化库存基础信息
|
|
/// </summary>
|
|
/// <param name="wms"></param>
|
|
/// <param name="doGoods"></param>
|
|
/// <param name="planGoods"></param>
|
|
/// <returns></returns>
|
|
public DataResult<OP_WMS_BASE> InitOpWmsBase(OP_WMS wms, OP_WMS_IN_DO_GOODS doGoods,
|
|
OP_WMS_IN_PLAN_GOODS planGoods = null)
|
|
{
|
|
OP_WMS_BASE wmsbase = wms.Adapt<OP_WMS_BASE>();
|
|
|
|
wmsbase.WMSBASEID = wms.WMSID;
|
|
|
|
if (planGoods.IsNotNull())
|
|
{
|
|
planGoods.Adapt(wmsbase);
|
|
}
|
|
|
|
// wmsbase.SEALNO = doGoods.SEALNO_PLAN;
|
|
wmsbase.REMARK_GOODS = doGoods.REMARK;
|
|
wmsbase.REMARK_BOX = doGoods.REMARK2;
|
|
wmsbase.TRUCKNO = doGoods.TRUCKNO;
|
|
return DataResult<OP_WMS_BASE>.Success(wmsbase);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 初始化物理库存信息
|
|
/// </summary>
|
|
/// <param name="wms"></param>
|
|
/// <param name="wmsInDo"></param>
|
|
/// <param name="doGoods"></param>
|
|
/// <returns></returns>
|
|
public DataResult<OP_WMS_PHYSICS> InitOpWmsPhysics(OP_WMS wms, OP_WMS_IN_DO wmsInDo,
|
|
OP_WMS_IN_DO_GOODS doGoods)
|
|
{
|
|
OP_WMS_PHYSICS physics = doGoods.Adapt<OP_WMS_PHYSICS>();
|
|
physics.WMSPHYSICSID = Guid.NewGuid();
|
|
physics.WMSID = wms.WMSID;
|
|
physics.STARTDATE = wmsInDo.DODATE;
|
|
physics.setsingle();
|
|
return DataResult<OP_WMS_PHYSICS>.Success(physics);
|
|
}
|
|
/// <summary>
|
|
/// 初始化产生库存变动日志
|
|
/// </summary>
|
|
/// <param name="wms"></param>
|
|
/// <param name="wmsInDo"></param>
|
|
/// <param name="doGoods"></param>
|
|
/// <returns></returns>
|
|
public DataResult<OP_WMS_CHANGE> InitOpWmsChange(OP_WMS wms, OP_WMS_IN_DO wmsInDo, OP_WMS_IN_DO_GOODS doGoods)
|
|
{
|
|
OP_WMS_CHANGE change = doGoods.Adapt<OP_WMS_CHANGE>();
|
|
change.WMSID = wms.WMSID;
|
|
change.DODATE = wmsInDo.DODATE;
|
|
change.setNew(doGoods);
|
|
return DataResult<OP_WMS_CHANGE>.Success(change);
|
|
}
|
|
/// <summary>
|
|
/// 初始化产生物理库存变动日志
|
|
/// </summary>
|
|
/// <param name="wmsId"></param>
|
|
/// <param name="physicsId"></param>
|
|
/// <param name="doDate"></param>
|
|
/// <param name="doGoods"></param>
|
|
/// <returns></returns>
|
|
public DataResult<OP_WMS_PHYSICS_CHANGE> InitOpWmsPhysicsChange(Guid wmsId, Guid physicsId,DateTime? doDate, OP_WMS_IN_DO_GOODS doGoods)
|
|
{
|
|
OP_WMS_PHYSICS_CHANGE change = doGoods.Adapt<OP_WMS_PHYSICS_CHANGE>();
|
|
change.WMSID = wmsId;
|
|
change.WMSPHYSICSID = physicsId;
|
|
change.DODATE = doDate;
|
|
change.setNew(doGoods);
|
|
return DataResult<OP_WMS_PHYSICS_CHANGE>.Success(change);
|
|
}
|
|
} |