|
|
|
using DS.Module.Core;
|
|
|
|
using DS.Module.Core.Extensions;
|
|
|
|
using DS.Module.UserModule;
|
|
|
|
using DS.WMS.Core.App.Dtos;
|
|
|
|
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>();
|
|
|
|
}
|
|
|
|
|
|
|
|
#region 入库确认
|
|
|
|
|
|
|
|
/// <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.ClientId = wmsInDo.ClientId;
|
|
|
|
// 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.ClientId = wmsInDo.ClientId;
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region 出库确认
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 出库确认变更OP_WMS_CHANGE
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="wms"></param>
|
|
|
|
/// <param name="wmsOutDo"></param>
|
|
|
|
/// <param name="doGoods"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
public DataResult<OP_WMS_CHANGE> OpWmsOutChange(OP_WMS wms, OP_WMS_OUT_DO wmsOutDo, OP_WMS_OUT_DO_GOODS doGoods)
|
|
|
|
{
|
|
|
|
OP_WMS_CHANGE change = doGoods.Adapt<OP_WMS_CHANGE>();
|
|
|
|
change.WMSID = wms.WMSID;
|
|
|
|
change.DOBSNO = doGoods.WMSDOID.ToString();
|
|
|
|
change.DOGID = doGoods.WMSDODETAILID;
|
|
|
|
change.CHANGETYPE = WMSCHANGTYPE.出库;
|
|
|
|
change.KGS2 = wms.KGS;
|
|
|
|
change.NETWEIGHT2 = wms.NETWEIGHT;
|
|
|
|
change.CBM2 = wms.CBM;
|
|
|
|
change.PKGS2 = wms.PKGS;
|
|
|
|
change.SMALLPKGS2 = wms.SMALLPKGS;
|
|
|
|
change.MINPKGS2 = wms.MINPKGS;
|
|
|
|
change.STORAGEUNITCOUNT2 = wms.STORAGEUNITCOUNT;
|
|
|
|
change.RULEUNITCOUNT2 = wms.RULEUNITCOUNT;
|
|
|
|
|
|
|
|
change.KGS -= doGoods.KGS;
|
|
|
|
change.NETWEIGHT -= doGoods.NETWEIGHT;
|
|
|
|
change.CBM -= doGoods.CBM;
|
|
|
|
change.PKGS -= doGoods.PKGS;
|
|
|
|
change.SMALLPKGS -= doGoods.SMALLPKGS;
|
|
|
|
change.MINPKGS -= doGoods.MINPKGS;
|
|
|
|
change.STORAGEUNITCOUNT -= doGoods.STORAGEUNITCOUNT;
|
|
|
|
change.RULEUNITCOUNT -= doGoods.RULEUNITCOUNT;
|
|
|
|
|
|
|
|
change.KGS3 = wms.KGS - doGoods.KGS;
|
|
|
|
change.NETWEIGHT3 = wms.NETWEIGHT - doGoods.NETWEIGHT;
|
|
|
|
change.CBM3 = wms.CBM - doGoods.CBM;
|
|
|
|
change.PKGS3 = wms.PKGS - doGoods.PKGS;
|
|
|
|
change.SMALLPKGS3 = wms.SMALLPKGS - doGoods.SMALLPKGS;
|
|
|
|
change.MINPKGS3 = wms.MINPKGS - doGoods.MINPKGS;
|
|
|
|
change.STORAGEUNITCOUNT3 = wms.STORAGEUNITCOUNT - doGoods.STORAGEUNITCOUNT;
|
|
|
|
change.RULEUNITCOUNT3 = wms.RULEUNITCOUNT - doGoods.RULEUNITCOUNT;
|
|
|
|
return DataResult<OP_WMS_CHANGE>.Success(change);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 出库确认 OP_WMS减库存
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="wms"></param>
|
|
|
|
/// <param name="doGoods"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
public DataResult<OP_WMS> OpWmsOutReduce(OP_WMS wms, OP_WMS_OUT_DO_GOODS doGoods)
|
|
|
|
{
|
|
|
|
wms.KGS -= doGoods.KGS;
|
|
|
|
wms.NETWEIGHT -= doGoods.NETWEIGHT;
|
|
|
|
wms.CBM -= doGoods.CBM;
|
|
|
|
wms.PKGS -= doGoods.PKGS;
|
|
|
|
wms.SMALLPKGS -= doGoods.SMALLPKGS;
|
|
|
|
wms.MINPKGS -= doGoods.MINPKGS;
|
|
|
|
wms.STORAGEUNITCOUNT -= doGoods.STORAGEUNITCOUNT;
|
|
|
|
wms.RULEUNITCOUNT -= doGoods.RULEUNITCOUNT;
|
|
|
|
return DataResult<OP_WMS>.Success(wms);
|
|
|
|
}
|
|
|
|
|
|
|
|
public DataResult<OP_WMS_PHYSICS_CHANGE> OpWmsPhysicsOutChange(OP_WMS_PHYSICS physics, OP_WMS_OUT_DO wmsOutDo,
|
|
|
|
OP_WMS_OUT_DO_GOODS doGoods)
|
|
|
|
{
|
|
|
|
OP_WMS_PHYSICS_CHANGE change = doGoods.Adapt<OP_WMS_PHYSICS_CHANGE>();
|
|
|
|
change.WMSID = doGoods.WMSPHYSICSID;
|
|
|
|
change.WMSPHYSICSID = doGoods.WMSPHYSICSID;
|
|
|
|
change.DODATE = wmsOutDo.DODATE;
|
|
|
|
change.WMSPHYSICS_LOGID = new Guid();
|
|
|
|
change.DOBSNO = doGoods.WMSDOID.ToString();
|
|
|
|
change.DOGID = doGoods.WMSDODETAILID.ToString();
|
|
|
|
|
|
|
|
change.STOREHOUSE2 = physics.STOREHOUSE;
|
|
|
|
change.STOREHOUSE3 = physics.STOREHOUSE;
|
|
|
|
change.AREACODE2 = physics.AREACODE;
|
|
|
|
change.AREACODE3 = physics.AREACODE;
|
|
|
|
|
|
|
|
change.CHANGETYPE = WMSCHANGTYPE.出库;
|
|
|
|
change.CBM2 = physics.CBM;
|
|
|
|
change.KGS2 = physics.KGS;
|
|
|
|
change.PKGS2 = physics.PKGS + doGoods.PKGS;
|
|
|
|
change.SMALLPKGS2 = physics.SMALLPKGS;
|
|
|
|
change.MINPKGS2 = physics.MINPKGS;
|
|
|
|
change.STORAGEUNITCOUNT2 = physics.STORAGEUNITCOUNT + doGoods.STORAGEUNITCOUNT;
|
|
|
|
change.RULEUNITCOUNT2 = physics.RULEUNITCOUNT;
|
|
|
|
change.NETWEIGHT2 = physics.NETWEIGHT;
|
|
|
|
|
|
|
|
change.CBM = -doGoods.CBM;
|
|
|
|
change.KGS = -doGoods.KGS;
|
|
|
|
change.PKGS = -doGoods.PKGS;
|
|
|
|
change.SMALLPKGS = -doGoods.SMALLPKGS;
|
|
|
|
change.MINPKGS = -doGoods.MINPKGS;
|
|
|
|
change.STORAGEUNITCOUNT = -doGoods.STORAGEUNITCOUNT;
|
|
|
|
change.RULEUNITCOUNT = -doGoods.RULEUNITCOUNT;
|
|
|
|
change.NETWEIGHT = -doGoods.NETWEIGHT;
|
|
|
|
|
|
|
|
change.CBM3 = physics.CBM - doGoods.CBM;
|
|
|
|
change.KGS3 = physics.KGS - doGoods.KGS;
|
|
|
|
change.PKGS3 = physics.PKGS + physics.LOCKPKGS - doGoods.PKGS;
|
|
|
|
change.SMALLPKGS3 = physics.SMALLPKGS - doGoods.SMALLPKGS;
|
|
|
|
change.MINPKGS3 = physics.MINPKGS - doGoods.MINPKGS;
|
|
|
|
change.STORAGEUNITCOUNT3 = physics.STORAGEUNITCOUNT + physics.LOCKSTORAGEUNITCOUNT - doGoods.STORAGEUNITCOUNT;
|
|
|
|
change.RULEUNITCOUNT3 = physics.RULEUNITCOUNT - doGoods.RULEUNITCOUNT;
|
|
|
|
change.NETWEIGHT3 = physics.NETWEIGHT - doGoods.NETWEIGHT;
|
|
|
|
|
|
|
|
|
|
|
|
return DataResult<OP_WMS_PHYSICS_CHANGE>.Success(change);
|
|
|
|
}
|
|
|
|
|
|
|
|
public DataResult<OP_WMS_PHYSICS> OpWmsPhysicsOutReduce(OP_WMS_PHYSICS physics, OP_WMS_OUT_DO_GOODS doGoods)
|
|
|
|
{
|
|
|
|
physics.CBM -= doGoods.CBM;
|
|
|
|
physics.NETWEIGHT -= doGoods.NETWEIGHT;
|
|
|
|
physics.KGS -= doGoods.KGS;
|
|
|
|
physics.LOCKPKGS -= doGoods.PKGS;
|
|
|
|
physics.LOCKSTORAGEUNITCOUNT -= doGoods.STORAGEUNITCOUNT;
|
|
|
|
// physics.PKGS -= doGoods.PKGS;
|
|
|
|
physics.SMALLPKGS -= doGoods.SMALLPKGS;
|
|
|
|
physics.MINPKGS -= doGoods.MINPKGS;
|
|
|
|
// physics.STORAGEUNITCOUNT = physics.STORAGEUNITCOUNT - doGoods.STORAGEUNITCOUNT;
|
|
|
|
physics.RULEUNITCOUNT -= doGoods.RULEUNITCOUNT;
|
|
|
|
return DataResult<OP_WMS_PHYSICS>.Success(physics);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region 清关移库
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 清关移库 原 OP_WMS减库存
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="wms"></param>
|
|
|
|
/// <param name="doGoods"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
public DataResult<OP_WMS> OpWmsReduce_ClearanceMove(OP_WMS wms, ClearanceMovePlanGoodsInput doGoods)
|
|
|
|
{
|
|
|
|
wms.KGS -= doGoods.KGS;
|
|
|
|
wms.NETWEIGHT -= doGoods.NETWEIGHT;
|
|
|
|
wms.CBM -= doGoods.CBM;
|
|
|
|
wms.PKGS -= doGoods.PKGS;
|
|
|
|
wms.SMALLPKGS -= doGoods.SMALLPKGS;
|
|
|
|
wms.MINPKGS -= doGoods.MINPKGS;
|
|
|
|
wms.STORAGEUNITCOUNT -= doGoods.STORAGEUNITCOUNT;
|
|
|
|
wms.RULEUNITCOUNT -= doGoods.RULEUNITCOUNT;
|
|
|
|
return DataResult<OP_WMS>.Success(wms);
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
|
|
/// 清关移库 原库存 OP_WMS_CHANGE
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="wms"></param>
|
|
|
|
/// <param name="wmsOutDo"></param>
|
|
|
|
/// <param name="doGoods"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
public DataResult<OP_WMS_CHANGE> OpWmsChange_ClearanceMove(OP_WMS wms, OP_WMS_CLEARANCE wmsClearance, ClearanceMovePlanGoodsInput doGoods)
|
|
|
|
{
|
|
|
|
OP_WMS_CHANGE change = doGoods.Adapt<OP_WMS_CHANGE>();
|
|
|
|
change.WMSID = wms.WMSID;
|
|
|
|
change.DOBSNO = doGoods.WMSPLANID.ToString();
|
|
|
|
change.DOGID = doGoods.WMSCLEARANCEDETAILID;
|
|
|
|
change.CHANGETYPE = WMSCHANGTYPE.出库;
|
|
|
|
change.KGS2 = wms.KGS;
|
|
|
|
change.NETWEIGHT2 = wms.NETWEIGHT;
|
|
|
|
change.CBM2 = wms.CBM;
|
|
|
|
change.PKGS2 = wms.PKGS;
|
|
|
|
change.SMALLPKGS2 = wms.SMALLPKGS;
|
|
|
|
change.MINPKGS2 = wms.MINPKGS;
|
|
|
|
change.STORAGEUNITCOUNT2 = wms.STORAGEUNITCOUNT;
|
|
|
|
change.RULEUNITCOUNT2 = wms.RULEUNITCOUNT;
|
|
|
|
|
|
|
|
change.KGS -= doGoods.KGS;
|
|
|
|
change.NETWEIGHT -= doGoods.NETWEIGHT;
|
|
|
|
change.CBM -= doGoods.CBM;
|
|
|
|
change.PKGS -= doGoods.PKGS;
|
|
|
|
change.SMALLPKGS -= doGoods.SMALLPKGS;
|
|
|
|
change.MINPKGS -= doGoods.MINPKGS;
|
|
|
|
change.STORAGEUNITCOUNT -= doGoods.STORAGEUNITCOUNT;
|
|
|
|
change.RULEUNITCOUNT -= doGoods.RULEUNITCOUNT;
|
|
|
|
|
|
|
|
change.KGS3 = wms.KGS - doGoods.KGS;
|
|
|
|
change.NETWEIGHT3 = wms.NETWEIGHT - doGoods.NETWEIGHT;
|
|
|
|
change.CBM3 = wms.CBM - doGoods.CBM;
|
|
|
|
change.PKGS3 = wms.PKGS - doGoods.PKGS;
|
|
|
|
change.SMALLPKGS3 = wms.SMALLPKGS - doGoods.SMALLPKGS;
|
|
|
|
change.MINPKGS3 = wms.MINPKGS - doGoods.MINPKGS;
|
|
|
|
change.STORAGEUNITCOUNT3 = wms.STORAGEUNITCOUNT - doGoods.STORAGEUNITCOUNT;
|
|
|
|
change.RULEUNITCOUNT3 = wms.RULEUNITCOUNT - doGoods.RULEUNITCOUNT;
|
|
|
|
return DataResult<OP_WMS_CHANGE>.Success(change);
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
|
|
/// 初始化 新库存 OP_WMS
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="wms"></param>
|
|
|
|
/// <param name="doGoods"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
public DataResult<OP_WMS> OpWmsInit_ClearanceMove(OP_WMS wms, ClearanceMovePlanGoodsInput doGoods)
|
|
|
|
{
|
|
|
|
var billNo = NumUtil.GetBillNo(db, "WM10");
|
|
|
|
if (billNo.IsNullOrEmpty())
|
|
|
|
{
|
|
|
|
return DataResult<OP_WMS>.Failed("请设置编码规则-库存信息");
|
|
|
|
}
|
|
|
|
Guid wmsid = Guid.NewGuid();
|
|
|
|
var newWms = doGoods.Adapt<OP_WMS>();
|
|
|
|
newWms.WMSID = wmsid;
|
|
|
|
newWms.BSNO = billNo;
|
|
|
|
newWms.CORPID = wms.CORPID;
|
|
|
|
newWms.CUSTOMERNAME = wms.CUSTOMERNAME;
|
|
|
|
newWms.ISCLEAR = false;
|
|
|
|
newWms.BSSTATUS = false;
|
|
|
|
newWms.FEESTATUS = false;
|
|
|
|
newWms.INDATE = DateTime.Now;
|
|
|
|
newWms.FEESTARTDATE = DateTime.Now;
|
|
|
|
newWms.FEERATESTARTDATE = DateTime.Now;
|
|
|
|
newWms.WMSINDATE = DateTime.Now;
|
|
|
|
newWms.CUSTOMNO = wms.CUSTOMNO;
|
|
|
|
newWms.BILLTYPE = "0";
|
|
|
|
newWms.GOODSOWNER = wms.GOODSOWNER;
|
|
|
|
newWms.ARCLIENTWMSOUT = wms.ARCLIENTWMSOUT;
|
|
|
|
newWms.ClientId = wms.ClientId;
|
|
|
|
newWms.setsingle();
|
|
|
|
newWms.WMSBASEID = wms.WMSBASEID;
|
|
|
|
return DataResult<OP_WMS>.Success(newWms);
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
|
|
/// 清关移库 新库存 OP_WMS_CHANGE 初始化
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="wms"></param>
|
|
|
|
/// <param name="wmsInDo"></param>
|
|
|
|
/// <param name="doGoods"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
public DataResult<OP_WMS_CHANGE> InitOpWmsChange_ClearanceMove(OP_WMS wms, OP_WMS_CLEARANCE wmsInDo, ClearanceMovePlanGoodsInput doGoods)
|
|
|
|
{
|
|
|
|
OP_WMS_CHANGE change = doGoods.Adapt<OP_WMS_CHANGE>();
|
|
|
|
change.WMSID = wms.WMSID;
|
|
|
|
change.DODATE = DateTime.Now;
|
|
|
|
change.setNew(doGoods);
|
|
|
|
return DataResult<OP_WMS_CHANGE>.Success(change);
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
|
|
/// 清关移库 原库存 OP_WMS_PHYSICS减少
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="physics"></param>
|
|
|
|
/// <param name="doGoods"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
public DataResult<OP_WMS_PHYSICS> OpWmsPhysicsReduce_ClearanceMove(OP_WMS_PHYSICS physics, ClearanceMovePlanGoodsInput doGoods)
|
|
|
|
{
|
|
|
|
physics.CBM -= doGoods.CBM;
|
|
|
|
physics.NETWEIGHT -= doGoods.NETWEIGHT;
|
|
|
|
physics.KGS -= doGoods.KGS;
|
|
|
|
physics.LOCKPKGS -= doGoods.PKGS;
|
|
|
|
physics.LOCKSTORAGEUNITCOUNT -= doGoods.STORAGEUNITCOUNT;
|
|
|
|
// physics.PKGS -= doGoods.PKGS;
|
|
|
|
physics.SMALLPKGS -= doGoods.SMALLPKGS;
|
|
|
|
physics.MINPKGS -= doGoods.MINPKGS;
|
|
|
|
// physics.STORAGEUNITCOUNT = physics.STORAGEUNITCOUNT - doGoods.STORAGEUNITCOUNT;
|
|
|
|
physics.RULEUNITCOUNT -= doGoods.RULEUNITCOUNT;
|
|
|
|
return DataResult<OP_WMS_PHYSICS>.Success(physics);
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
|
|
/// 清关移库 原库存 OP_WMS_PHYSICS_CHANGE
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="physics"></param>
|
|
|
|
/// <param name="wmsClearance"></param>
|
|
|
|
/// <param name="doGoods"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
public DataResult<OP_WMS_PHYSICS_CHANGE> OpWmsPhysicsChange_ClearanceMove(OP_WMS_PHYSICS physics, OP_WMS_CLEARANCE wmsClearance,
|
|
|
|
ClearanceMovePlanGoodsInput doGoods)
|
|
|
|
{
|
|
|
|
OP_WMS_PHYSICS_CHANGE change = doGoods.Adapt<OP_WMS_PHYSICS_CHANGE>();
|
|
|
|
change.WMSID = doGoods.WMSPHYSICSID;
|
|
|
|
change.WMSPHYSICSID = doGoods.WMSPHYSICSID;
|
|
|
|
change.DODATE = DateTime.Now;
|
|
|
|
change.WMSPHYSICS_LOGID = new Guid();
|
|
|
|
change.DOBSNO = doGoods.WMSPLANID.ToString();
|
|
|
|
change.DOGID = doGoods.WMSCLEARANCEDETAILID.ToString();
|
|
|
|
|
|
|
|
change.STOREHOUSE2 = physics.STOREHOUSE;
|
|
|
|
change.STOREHOUSE3 = physics.STOREHOUSE;
|
|
|
|
change.AREACODE2 = physics.AREACODE;
|
|
|
|
change.AREACODE3 = physics.AREACODE;
|
|
|
|
|
|
|
|
change.CHANGETYPE = WMSCHANGTYPE.出库;
|
|
|
|
change.CBM2 = physics.CBM;
|
|
|
|
change.KGS2 = physics.KGS;
|
|
|
|
change.PKGS2 = physics.PKGS + doGoods.PKGS;
|
|
|
|
change.SMALLPKGS2 = physics.SMALLPKGS;
|
|
|
|
change.MINPKGS2 = physics.MINPKGS;
|
|
|
|
change.STORAGEUNITCOUNT2 = physics.STORAGEUNITCOUNT + doGoods.STORAGEUNITCOUNT;
|
|
|
|
change.RULEUNITCOUNT2 = physics.RULEUNITCOUNT;
|
|
|
|
change.NETWEIGHT2 = physics.NETWEIGHT;
|
|
|
|
|
|
|
|
change.CBM = -doGoods.CBM;
|
|
|
|
change.KGS = -doGoods.KGS;
|
|
|
|
change.PKGS = -doGoods.PKGS;
|
|
|
|
change.SMALLPKGS = -doGoods.SMALLPKGS;
|
|
|
|
change.MINPKGS = -doGoods.MINPKGS;
|
|
|
|
change.STORAGEUNITCOUNT = -doGoods.STORAGEUNITCOUNT;
|
|
|
|
change.RULEUNITCOUNT = -doGoods.RULEUNITCOUNT;
|
|
|
|
change.NETWEIGHT = -doGoods.NETWEIGHT;
|
|
|
|
|
|
|
|
change.CBM3 = physics.CBM - doGoods.CBM;
|
|
|
|
change.KGS3 = physics.KGS - doGoods.KGS;
|
|
|
|
change.PKGS3 = physics.PKGS + physics.LOCKPKGS - doGoods.PKGS;
|
|
|
|
change.SMALLPKGS3 = physics.SMALLPKGS - doGoods.SMALLPKGS;
|
|
|
|
change.MINPKGS3 = physics.MINPKGS - doGoods.MINPKGS;
|
|
|
|
change.STORAGEUNITCOUNT3 = physics.STORAGEUNITCOUNT + physics.LOCKSTORAGEUNITCOUNT - doGoods.STORAGEUNITCOUNT;
|
|
|
|
change.RULEUNITCOUNT3 = physics.RULEUNITCOUNT - doGoods.RULEUNITCOUNT;
|
|
|
|
change.NETWEIGHT3 = physics.NETWEIGHT - doGoods.NETWEIGHT;
|
|
|
|
|
|
|
|
|
|
|
|
return DataResult<OP_WMS_PHYSICS_CHANGE>.Success(change);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 清关移库 新库存 初始化OP_WMS_PHYSICS
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="wms"></param>
|
|
|
|
/// <param name="wmsInDo"></param>
|
|
|
|
/// <param name="doGoods"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
public DataResult<OP_WMS_PHYSICS> InitOpWmsPhysics_ClearanceMove(OP_WMS wms, OP_WMS_CLEARANCE wmsInDo,
|
|
|
|
ClearanceMovePlanGoodsInput doGoods)
|
|
|
|
{
|
|
|
|
OP_WMS_PHYSICS physics = doGoods.Adapt<OP_WMS_PHYSICS>();
|
|
|
|
physics.WMSPHYSICSID = Guid.NewGuid();
|
|
|
|
physics.WMSID = wms.WMSID;
|
|
|
|
physics.STARTDATE = DateTime.Now;
|
|
|
|
physics.ClientId = wmsInDo.ClientId;
|
|
|
|
physics.STOREHOUSE = wmsInDo.MoveStoreHouse;
|
|
|
|
physics.AREACODE = doGoods.AREACODE;
|
|
|
|
physics.setsingle();
|
|
|
|
return DataResult<OP_WMS_PHYSICS>.Success(physics);
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
|
|
/// 清关移库 新库存 初始化OpWmsPhysicsChange
|
|
|
|
/// </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_ClearanceMove(Guid wmsId, Guid physicsId,
|
|
|
|
ClearanceMovePlanGoodsInput doGoods)
|
|
|
|
{
|
|
|
|
OP_WMS_PHYSICS_CHANGE change = doGoods.Adapt<OP_WMS_PHYSICS_CHANGE>();
|
|
|
|
change.WMSID = wmsId;
|
|
|
|
change.WMSPHYSICSID = physicsId;
|
|
|
|
change.DODATE = DateTime.Now;
|
|
|
|
change.setNew(doGoods);
|
|
|
|
return DataResult<OP_WMS_PHYSICS_CHANGE>.Success(change);
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
}
|