@ -1,6 +1,7 @@
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 ;
@ -29,6 +30,8 @@ public class WmsCommonService : IWmsCommonService
user = _serviceProvider . GetRequiredService < IUser > ( ) ;
}
#region 入库确认
/// <summary>
/// 初始化库存信息
/// </summary>
@ -146,6 +149,11 @@ public class WmsCommonService : IWmsCommonService
return DataResult < OP_WMS_PHYSICS_CHANGE > . Success ( change ) ;
}
# endregion
#region 出库确认
/// <summary>
/// 出库确认变更OP_WMS_CHANGE
/// </summary>
@ -227,10 +235,10 @@ public class WmsCommonService : IWmsCommonService
change . CHANGETYPE = WMSCHANGTYPE . 出 库 ;
change . CBM2 = physics . CBM ;
change . KGS2 = physics . KGS ;
change . PKGS2 = physics . PKGS ;
change . PKGS2 = physics . PKGS + doGoods . PKGS ;
change . SMALLPKGS2 = physics . SMALLPKGS ;
change . MINPKGS2 = physics . MINPKGS ;
change . STORAGEUNITCOUNT2 = physics . STORAGEUNITCOUNT + physics. LOCK STORAGEUNITCOUNT;
change . STORAGEUNITCOUNT2 = physics . STORAGEUNITCOUNT + doGoods. STORAGEUNITCOUNT;
change . RULEUNITCOUNT2 = physics . RULEUNITCOUNT ;
change . NETWEIGHT2 = physics . NETWEIGHT ;
@ -245,7 +253,7 @@ public class WmsCommonService : IWmsCommonService
change . CBM3 = physics . CBM - doGoods . CBM ;
change . KGS3 = physics . KGS - doGoods . KGS ;
change . PKGS3 = physics . PKGS - doGoods . PKGS ;
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 ;
@ -261,13 +269,243 @@ public class WmsCommonService : IWmsCommonService
physics . CBM - = doGoods . CBM ;
physics . NETWEIGHT - = doGoods . NETWEIGHT ;
physics . KGS - = doGoods . KGS ;
// physics.LOCKPKGS = - doGoods.PKGS;
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.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
}