@ -15,7 +15,18 @@ using DSWeb.DataAccess;
using DSWeb.Models ;
using DSWeb.Models ;
using DSWeb.MvcShipping.Helper ;
using DSWeb.MvcShipping.Helper ;
using DSWeb.Areas.CommMng.DAL ;
using DSWeb.Areas.CommMng.DAL ;
using DSWeb.Common.DB ;
using System.Linq ;
using DSWeb.Areas.Account.Controllers ;
using DSWeb.MvcShipping.Models.MsOpAmend ;
using NPOI.HPSF ;
using DSWeb.Areas.Import.Controllers ;
using System.Web.UI.WebControls ;
using DSWeb.MvcShipping.Models.MsChFee ;
using DSWeb.MvcShipping.DAL.MsChFeeDAL ;
using DSWeb.Areas.MvcShipping.Helper ;
using DSWeb.Handler ;
namespace DSWeb.MvcShipping.DAL.RptWmsSettlementListDAL
namespace DSWeb.MvcShipping.DAL.RptWmsSettlementListDAL
{
{
@ -1547,6 +1558,14 @@ namespace DSWeb.MvcShipping.DAL.RptWmsSettlementListDAL
# endregion
# endregion
#region 费用入账
#region 费用入账
/// <summary>
/// 根据仓储结算清单信息 生成费用
/// </summary>
/// <param name="gids"></param>
/// <param name="strUserID"></param>
/// <param name="strCompanyID"></param>
/// <param name="strDEPTNAME"></param>
/// <returns></returns>
public static DBResult setislock ( string gids , string strUserID , string strCompanyID , string strDEPTNAME )
public static DBResult setislock ( string gids , string strUserID , string strCompanyID , string strDEPTNAME )
{
{
DBResult result = new DBResult ( ) ;
DBResult result = new DBResult ( ) ;
@ -1589,15 +1608,41 @@ namespace DSWeb.MvcShipping.DAL.RptWmsSettlementListDAL
{
{
try
try
{
{
var gidList = gids . Split ( ',' ) . ToList ( ) ;
gids = "'" + gids . Trim ( ) . Replace ( "," , "','" ) + "'" ;
gids = "'" + gids . Trim ( ) . Replace ( "," , "','" ) + "'" ;
#region 从【仓储结算明细临时表wms_settlement_detail】中提取数据, 按提单号循环插入ch_Fee, 因为添加锁定功能, 则暂时屏蔽
//20221128 对于费用锁定的业务 其费用生成到一个该业务下新增的费用更改单上
string strSql = "insert into ch_fee(GID,BSNO,FEETYPE,FEENAME,CUSTOMERNAME,UNIT,UNITPRICE,QUANTITY,AMOUNT,EXCHANGERATE,CURRENCY,COMMISSIONRATE,FEEFRT,REMARK,ISADVANCEDPAY,ENTEROPERATOR,ENTERDATE,FEESTATUS,WMSOUTBSNO,LINENUM,[TAXRATE],[NOTAXAMOUNT],[TAX],[ORDERSETTLEMENT],[TAXUNITPRICE],[ORDERINVSETTLEMENT]) "
+ "select newid() as GID,bsno=(select top 1 bsno from V_op_bill where mblno=[wms_settlement_detail].blno),1,'仓储费',CUSTOMERNAME,'单票',sum(isnull(OUTFEE,0)),1,sum(isnull(OUTFEE,0)),1,'RMB',0,'PP',((select top 1 CONVERT(char(10), STARTBILLINGDATE, 20) AS STARTBILLINGDATE from wms_settlement_detail where blno=wms_settlement_detail.blno and STARTBILLINGDATE is not null and CORPID='" + strCompanyID + "' and ISLOCK=0 and ISDELETE=0 and isnull(OUTFEE,0)<>0 and DUIGID in (" + gids + ")" + strRange + " order by STARTBILLINGDATE)+'至'+(select top 1 CONVERT(char(10), ENDBILLINGDATE, 20) AS ENDBILLINGDATE from wms_settlement_detail where blno=wms_settlement_detail.blno and ENDBILLINGDATE is not null and CORPID='" + strCompanyID + "' and ISLOCK=0 and ISDELETE=0 and isnull(OUTFEE,0)<>0 and DUIGID in (" + gids + ")" + strRange + " order by ENDBILLINGDATE desc)+'仓储结算清单'+DUINO+'”中的单票仓储费汇总'),0,'" + strUserID + "',getdate(),1,DUIGID,LINENUM=(select top 1 LINENUM=isnull((select top 1 LINENUM from ch_fee where bsno=(select top 1 bsno from v_op_bill where mblno=[wms_settlement_detail].blno) and feetype=1 order by LINENUM desc),0)+1),0,sum(isnull(OUTFEE,0)),0,0,sum(isnull(OUTFEE,0)),0"
var cdc = new CommonDataContext ( ) ;
+ " from [wms_settlement_detail] where CORPID='" + strCompanyID + "' and ISLOCK=0 and ISDELETE=0 and isnull(OUTFEE,0)<>0 and DUIGID in (" + gids + ")" + strRange + " group by blno,CUSTOMERNAME,CREATEUSER,CORPID,DUINO,DUIGID" ; //CREATEUSER='" + strUserID + "' and
int existVal = SqlHelper . ExecuteNonQuery ( sqlTran , CommandType . Text , strSql . ToString ( ) , null ) ;
var 将 生 成 至 费 用 更 改 单 的 wms_settlement_detailList = new List < wms_settlement_detail_md > ( ) ;
var 需 将 费 用 产 生 至 更 改 单 的 业 务 = get 需 将 费 用 产 生 至 更 改 单 的 业 务 ( gidList , out 将 生 成 至 费 用 更 改 单 的 wms_settlement_detailList ) ;
var donegids = 将 生 成 至 费 用 更 改 单 的 wms_settlement_detailList . Select ( s = > s . DUIGID ) . ToList ( ) ;
var needdogidArray = gidList . Where ( x = > ! donegids . Contains ( x ) ) . ToArray ( ) ;
var feegids = "'" + String . Join ( "','" , needdogidArray ) + "'" ;
int existVal = 0 ;
string strSql = "" ;
#region 从【仓储结算明细临时表wms_settlement_detail】中提取数据, 按提单号循环插入ch_Fee,
//费用锁定的业务
if ( needdogidArray . Length > 0 )
{
strSql = "insert into ch_fee(GID,BSNO,FEETYPE,FEENAME,CUSTOMERNAME,UNIT,UNITPRICE,QUANTITY,AMOUNT,EXCHANGERATE,CURRENCY,COMMISSIONRATE,FEEFRT,REMARK,ISADVANCEDPAY,ENTEROPERATOR,ENTERDATE,FEESTATUS,WMSOUTBSNO,LINENUM,[TAXRATE],[NOTAXAMOUNT],[TAX],[ORDERSETTLEMENT],[TAXUNITPRICE],[ORDERINVSETTLEMENT]) "
+ "select newid() as GID,bsno=(select top 1 bsno from V_op_bill where mblno=[wms_settlement_detail].blno),1,'仓储费',CUSTOMERNAME,'单票',sum(isnull(OUTFEE,0)),1,sum(isnull(OUTFEE,0)),1,'RMB',0,'PP',((select top 1 CONVERT(char(10), STARTBILLINGDATE, 20) AS STARTBILLINGDATE from wms_settlement_detail where blno=wms_settlement_detail.blno and STARTBILLINGDATE is not null and CORPID='" + strCompanyID + "' and ISLOCK=0 and ISDELETE=0 and isnull(OUTFEE,0)<>0 and DUIGID in (" + feegids + ")" + strRange + " order by STARTBILLINGDATE)+'至'+(select top 1 CONVERT(char(10), ENDBILLINGDATE, 20) AS ENDBILLINGDATE from wms_settlement_detail where blno=wms_settlement_detail.blno and ENDBILLINGDATE is not null and CORPID='" + strCompanyID + "' and ISLOCK=0 and ISDELETE=0 and isnull(OUTFEE,0)<>0 and DUIGID in (" + feegids + ")" + strRange + " order by ENDBILLINGDATE desc)+'仓储结算清单'+DUINO+'”中的单票仓储费汇总'),0,'" + strUserID + "',getdate(),1,DUIGID,LINENUM=(select top 1 LINENUM=isnull((select top 1 LINENUM from ch_fee where bsno=(select top 1 bsno from v_op_bill where mblno=[wms_settlement_detail].blno) and feetype=1 order by LINENUM desc),0)+1),0,sum(isnull(OUTFEE,0)),0,0,sum(isnull(OUTFEE,0)),0"
+ " from [wms_settlement_detail] where CORPID='" + strCompanyID + "' and ISLOCK=0 and ISDELETE=0 and isnull(OUTFEE,0)<>0 and DUIGID in (" + feegids + ")" + strRange + " group by blno,CUSTOMERNAME,CREATEUSER,CORPID,DUINO,DUIGID" ; //CREATEUSER='" + strUserID + "' and
existVal = SqlHelper . ExecuteNonQuery ( sqlTran , CommandType . Text , strSql . ToString ( ) , null ) ;
}
# endregion
# endregion
#region 把【仓储结算明细表wms_settlement_detail】中的指定数据锁定
#region 把【仓储结算明细表wms_settlement_detail】中的指定数据锁定
strSql = "update wms_settlement_detail set ISLOCK=1,LOCKUSER='" + strUserID + "',LOCKTIME=getdate() where ISLOCK=0 and DUIGID in (" + gids + ")" + strRange ;
strSql = "update wms_settlement_detail set ISLOCK=1,LOCKUSER='" + strUserID + "',LOCKTIME=getdate() where ISLOCK=0 and DUIGID in (" + gids + ")" + strRange ;
existVal = SqlHelper . ExecuteNonQuery ( sqlTran , CommandType . Text , strSql . ToString ( ) , null ) ;
existVal = SqlHelper . ExecuteNonQuery ( sqlTran , CommandType . Text , strSql . ToString ( ) , null ) ;
@ -1609,12 +1654,16 @@ namespace DSWeb.MvcShipping.DAL.RptWmsSettlementListDAL
# endregion
# endregion
sqlTran . Commit ( ) ;
sqlTran . Commit ( ) ;
//20221128 对于费用锁定的业务 其费用生成到一个该业务下新增的费用更改单上
生 成 费 用 更 改 单 ( 需 将 费 用 产 生 至 更 改 单 的 业 务 , 将 生 成 至 费 用 更 改 单 的 wms_settlement_detailList , strUserID ) ;
}
}
catch ( Exception )
catch ( Exception e )
{
{
sqlTran . Rollback ( ) ;
sqlTran . Rollback ( ) ;
result . Success = false ;
result . Success = false ;
result . Message = "操作出现错误 ,请重试或联系系统管理员";
result . Message = "操作出现错误 ["+ e . Message + "] ,请重试或联系系统管理员";
return result ;
return result ;
}
}
finally
finally
@ -1627,6 +1676,97 @@ namespace DSWeb.MvcShipping.DAL.RptWmsSettlementListDAL
result . Message = "操作成功!(注意如果用户权限不够,将不予以入账!)" ;
result . Message = "操作成功!(注意如果用户权限不够,将不予以入账!)" ;
return result ;
return result ;
}
}
/// <summary>
/// 20221128 逻辑是 从vopbs中 取得 bsno in(bsnolist)的 费用锁定(feestatus=1)的业务
/// </summary>
/// <param name="BSNOList"></param>
/// <returns></returns>
private static List < v_op_bs_mb > get 需 将 费 用 产 生 至 更 改 单 的 业 务 ( List < string > DUIGIDList , out List < wms_settlement_detail_md > DetailList ) {
var result = new List < v_op_bs_mb > ( ) ;
var cdc = new CommonDataContext ( ) ;
DetailList = cdc . wms_settlement_detail . Where ( x = > DUIGIDList . Contains ( x . DUIGID ) ) . ToList ( ) ;
var bsnoList = DetailList . Select ( s = > s . GID_LINK ) . ToList ( ) ;
var 已 费 用 锁 定 的 仓 储 业 务 List = cdc . v_op_bs . Where ( x = > bsnoList . Contains ( x . BSNO ) & & x . FEESTATUS = = 1 ) . ToList ( ) ;
bsnoList = 已 费 用 锁 定 的 仓 储 业 务 List . Select ( s = > s . BSNO ) . ToList ( ) ;
DetailList = cdc . wms_settlement_detail . Where ( x = > bsnoList . Contains ( x . GID_LINK ) ) . ToList ( ) ;
return 已 费 用 锁 定 的 仓 储 业 务 List ;
}
private static void 生 成 费 用 更 改 单 ( List < v_op_bs_mb > vOpBsList , List < wms_settlement_detail_md > DetailList , string USERID )
{
//遍历业务
var cdc = new CommonDataContext ( ) ;
var codefeelist = cdc . code_fee . Where ( x = > x . NAME = = "仓储费" ) . ToList ( ) ;
foreach ( var vopbs in vOpBsList ) {
var wmssettlementDetailList = DetailList . Where ( x = > x . GID_LINK = = vopbs . BSNO ) . ToList ( ) ;
var head = new MsOpAmend ( ) ;
head . BSNO = Guid . NewGuid ( ) . ToString ( ) ;
head . GID = head . BSNO ;
head . PARENTID = vopbs . BSNO ;
head . FEESTATUS = false ;
head . ACCDATE = System . DateTime . Now . ToString ( "yyyy-MM" ) ;
var _user = cdc . VW_user . FirstOrDefault ( x = > x . USERID = = USERID ) ;
head . CREATETIME = "" ;
var 该 业 务 此 次 生 成 更 改 单 时 涉 及 到 的 仓 储 对 账 单 GidList = wmssettlementDetailList . Select ( s = > s . DUIGID ) . Distinct ( ) . ToList ( ) ;
var 该 业 务 此 次 生 成 更 改 单 时 涉 及 到 的 仓 储 对 账 单 = cdc . wms_settlement_list . Where ( x = > 该 业 务 此 次 生 成 更 改 单 时 涉 及 到 的 仓 储 对 账 单 GidList . Contains ( x . GID ) ) . ToList ( ) ;
var billnolist = 该 业 务 此 次 生 成 更 改 单 时 涉 及 到 的 仓 储 对 账 单 . Select ( s = > s . DUINO ) . ToArray ( ) ;
head . REMARKS = "仓储对账单【" + String . Join ( "," , billnolist ) + "】自动产生" ;
var mschfeecontroller = new DSWeb . MvcShipping . Controllers . MsChFeeController ( ) ;
var addfeelist = new List < ch_fee_md > ( ) ;
void addfee ( ch_fee_md newfee ) {
if ( addfeelist . Exists ( x = > x . REMARK = = newfee . REMARK ) )
{
addfeelist . First ( x = > x . REMARK = = newfee . REMARK ) . AMOUNT + = newfee . AMOUNT ;
addfeelist . First ( x = > x . REMARK = = newfee . REMARK ) . setTax ( codefeelist ) ;
}
else {
addfeelist . Add ( newfee ) ;
}
}
foreach ( var detail in wmssettlementDetailList ) {
var newfee = MsChFeeDAL . MsChFeeDAL . getChFee ( USERID , head . BSNO , detail . CUSTOMERNAME , 1 , "仓储费" , ( decimal ) detail . OUTFEE , "单票" , 1 , detail . DUINO ) ;
newfee . BSNO = "*" ;
addfee ( newfee ) ;
}
var chfeelist = AutoMapperHelper . MapToList < ch_fee_md , MsChFee > ( addfeelist ) ;
mschfeecontroller . SaveAmend_Object ( head . BSNO , head , chfeelist , null , USERID , _user . SHOWNAME , _user . COMPANYID ) ;
var chfeeAudit = new Chfee_AuditController ( ) ;
var feeidlist = string . Join ( "," , addfeelist . Select ( s = > s . GID ) . ToList ( ) ) ;
chfeeAudit . SubmitAuditAmend_Object ( feeidlist , "op_other" , USERID , _user . COMPANYID ) ;
}
}
# endregion
# endregion
#region 取消入账
#region 取消入账
@ -1701,9 +1841,55 @@ namespace DSWeb.MvcShipping.DAL.RptWmsSettlementListDAL
}
}
# endregion
# endregion
#region 从【仓储结算明细临时表wms_settlement_detail】中提取数据, 按提单号循环插入ch_Fee, 因为添加锁定功能, 则暂时屏蔽
#region 如果存在 备注中包含仓储结算清单wms_settlement_list.duino的 ch_fee 且费用状态不为1或6 则不允许取消
string strSql = "delete from ch_fee where WMSOUTBSNO in (select gid from wms_settlement_list where ISLOCK=1 and gid in(" + gids + ") " + strRange + ")" ;
//如不存在 则查询 备注中包含仓储结算清单wms_settlement_list.duino的更改单 ;和 备注中包含仓储结算清单wms_settlement_list.duino 且费用状态不为1或6 的 ch_fee ,将他们都删除
var cdc = new CommonDataContext ( ) ;
//var _user = cdc.VW_user.First(x => x.USERID == strUserID);
var 仓 储 结 算 清 单 List = GetDataList ( "GID in(" + gids + ")" , strUserID , strCompanyID , "" , "" , "" ) ;
var 仓 储 结 算 清 单 BillNoList = 仓 储 结 算 清 单 List . Select ( s = > s . DUINO ) . ToList ( ) ;
//var 更改单List = MsChFeeDAL.MsChFeeDAL.GetAmendList(" GID in("+gids+")");
var 不 可 撤 销 的 更 改 单 FeeList = cdc . ch_fee . Where ( x = > 仓 储 结 算 清 单 BillNoList . Contains ( x . REMARK ) & & ( x . FEESTATUS ! = 1 & & x . FEESTATUS ! = 6 ) ) . ToList ( ) ;
if ( 不 可 撤 销 的 更 改 单 FeeList ! = null & & 不 可 撤 销 的 更 改 单 FeeList . Count > 0 ) {
sqlTran . Rollback ( ) ;
result . Success = false ;
result . Message = "有在费用更改单中“已申请开票、已开发票、已对帐”的费用,不允许取消入账,请重新操作!" ;
return result ;
}
var 要 撤 销 的 更 改 单 FeeList = cdc . ch_fee . Where ( x = > 仓 储 结 算 清 单 BillNoList . Contains ( x . REMARK ) & & ( x . FEESTATUS = = 1 | | x . FEESTATUS = = 6 ) ) . ToList ( ) ;
var 更 改 单 bsnoList = 要 撤 销 的 更 改 单 FeeList . Select ( s = > s . BSNO ) . ToList ( ) ;
var 这 些 更 改 单 中 不 可 撤 销 的 FeeList = cdc . ch_fee . Where ( x = > 更 改 单 bsnoList . Contains ( x . BSNO ) & & ( x . FEESTATUS ! = 1 & & x . FEESTATUS ! = 6 ) ) . ToList ( ) ;
if ( 这 些 更 改 单 中 不 可 撤 销 的 FeeList ! = null & & 这 些 更 改 单 中 不 可 撤 销 的 FeeList . Count > 0 )
{
sqlTran . Rollback ( ) ;
result . Success = false ;
result . Message = "有在费用更改单中“已申请开票、已开发票、已对帐”的费用,不允许取消入账,请重新操作!" ;
return result ;
}
//现在可以删除这些费用和更改单了
var bsnoListStr = "'" + string . Join ( "','" , 更 改 单 bsnoList ) + "'" ;
string strSql = "delete from op_amend where BSNO in (" + bsnoListStr + ")" ;
strSql + = "delete from ch_fee where BSNO in (" + bsnoListStr + ")" ;
int existVal = SqlHelper . ExecuteNonQuery ( sqlTran , CommandType . Text , strSql . ToString ( ) , null ) ;
int existVal = SqlHelper . ExecuteNonQuery ( sqlTran , CommandType . Text , strSql . ToString ( ) , null ) ;
# endregion
#region 从【仓储结算明细临时表wms_settlement_detail】中提取数据, 按提单号循环插入ch_Fee, 因为添加锁定功能, 则暂时屏蔽
strSql = "delete from ch_fee where WMSOUTBSNO in (select gid from wms_settlement_list where ISLOCK=1 and gid in(" + gids + ") " + strRange + ")" ;
existVal = SqlHelper . ExecuteNonQuery ( sqlTran , CommandType . Text , strSql . ToString ( ) , null ) ;
# endregion
# endregion
#region 把【仓储结算明细表wms_settlement_detail】中的指定数据锁定
#region 把【仓储结算明细表wms_settlement_detail】中的指定数据锁定
@ -1754,7 +1940,7 @@ namespace DSWeb.MvcShipping.DAL.RptWmsSettlementListDAL
/// <param name="sBillno">出库单号或其他单据号</param>
/// <param name="sBillno">出库单号或其他单据号</param>
/// <param name="ck_jsfee">是否计算仓储费</param>
/// <param name="ck_jsfee">是否计算仓储费</param>
/// <returns></returns>
/// <returns></returns>
public static String getWmsRate2 ( SqlTransaction sqlTran , string strSTARTBILLINGDATE , string strOLDCUSTFEEDATE , string strINBSNO , string strCUSTOMERNAME , D ecimal outnums , string strASSOCIATEDNO , int strFEETYPE , string strUserID , string strShowName , string sBillno , bool ck_jsfee , bool isKuCun )
public static String getWmsRate2 ( SqlTransaction sqlTran , string strSTARTBILLINGDATE , string strOLDCUSTFEEDATE , string strINBSNO , string strCUSTOMERNAME , d ecimal outnums , string strASSOCIATEDNO , int strFEETYPE , string strUserID , string strShowName , string sBillno , bool ck_jsfee , bool isKuCun )
{
{
string sR = "" ;
string sR = "" ;
int iState = 0 ;
int iState = 0 ;
@ -1768,7 +1954,7 @@ namespace DSWeb.MvcShipping.DAL.RptWmsSettlementListDAL
int feedays = 0 ; //区间仓储数
int feedays = 0 ; //区间仓储数
int prescale = 0 ; //总计费区间仓储数
int prescale = 0 ; //总计费区间仓储数
int feeMonth = 0 ; //区间仓储月数
int feeMonth = 0 ; //区间仓储月数
D ecimal sumfee = 0 ; //总仓储费
d ecimal sumfee = 0 ; //总仓储费
string strSTARTBILLINGDATE2 = strSTARTBILLINGDATE ; //按区间计费的开始计费日期
string strSTARTBILLINGDATE2 = strSTARTBILLINGDATE ; //按区间计费的开始计费日期
#region 删除费率出库明细表的区间仓储费
#region 删除费率出库明细表的区间仓储费
@ -1837,8 +2023,8 @@ namespace DSWeb.MvcShipping.DAL.RptWmsSettlementListDAL
if ( dsrate . Tables [ 0 ] . Rows . Count > 0 )
if ( dsrate . Tables [ 0 ] . Rows . Count > 0 )
{
{
int nowscale = 0 ; //区间计费区间(仓储月数/天数)
int nowscale = 0 ; //区间计费区间(仓储月数/天数)
D ecimal price = 0 ; //计费单价
d ecimal price = 0 ; //计费单价
D ecimal gradefee = 0 ; //区间仓储费
d ecimal gradefee = 0 ; //区间仓储费
int nowgrade = 1 ;
int nowgrade = 1 ;
for ( int i = 0 ; i < dsrate . Tables [ 0 ] . Rows . Count ; i + + )
for ( int i = 0 ; i < dsrate . Tables [ 0 ] . Rows . Count ; i + + )
@ -1853,9 +2039,9 @@ namespace DSWeb.MvcShipping.DAL.RptWmsSettlementListDAL
WmsRateDetailEntity model = new WmsRateDetailEntity ( ) ;
WmsRateDetailEntity model = new WmsRateDetailEntity ( ) ;
//nowgrade = int.Parse(dsrate.Tables[0].Rows[i]["FEEGRADE"].ToString());//计费等级
//nowgrade = int.Parse(dsrate.Tables[0].Rows[i]["FEEGRADE"].ToString());//计费等级
nowscale = int . Parse ( dsrate . Tables [ 0 ] . Rows [ i ] [ "FEESCALE" ] . ToString ( ) ) ; //计费区间
nowscale = int . Parse ( dsrate . Tables [ 0 ] . Rows [ i ] [ "FEESCALE" ] . ToString ( ) ) ; //计费区间
price = D ecimal. Parse ( dsrate . Tables [ 0 ] . Rows [ i ] [ "FEEPRICE" ] . ToString ( ) ) ; //计费单价
price = d ecimal. Parse ( dsrate . Tables [ 0 ] . Rows [ i ] [ "FEEPRICE" ] . ToString ( ) ) ; //计费单价
Decimal ADDPRICE = D ecimal. Parse ( dsrate . Tables [ 0 ] . Rows [ i ] [ "ADDPRICE" ] . ToString ( ) ) ; //增值价
decimal ADDPRICE = d ecimal. Parse ( dsrate . Tables [ 0 ] . Rows [ i ] [ "ADDPRICE" ] . ToString ( ) ) ; //增值价
Decimal CAPPRICE = D ecimal. Parse ( dsrate . Tables [ 0 ] . Rows [ i ] [ "CAPPRICE" ] . ToString ( ) ) ; / /
decimal CAPPRICE = d ecimal. Parse ( dsrate . Tables [ 0 ] . Rows [ i ] [ "CAPPRICE" ] . ToString ( ) ) ; / /
string FEEUNIT = dsrate . Tables [ 0 ] . Rows [ i ] [ "FEEUNIT" ] . ToString ( ) ; //计费单位
string FEEUNIT = dsrate . Tables [ 0 ] . Rows [ i ] [ "FEEUNIT" ] . ToString ( ) ; //计费单位
string ENDBILLINGDATE = dsrate . Tables [ 0 ] . Rows [ i ] [ "ENDBILLINGDATE" ] . ToString ( ) ; //结束计费日期
string ENDBILLINGDATE = dsrate . Tables [ 0 ] . Rows [ i ] [ "ENDBILLINGDATE" ] . ToString ( ) ; //结束计费日期
//计算区间是按天或按月
//计算区间是按天或按月
@ -1900,7 +2086,7 @@ namespace DSWeb.MvcShipping.DAL.RptWmsSettlementListDAL
//int imod = (int)(sjMonth % nowscale);
//int imod = (int)(sjMonth % nowscale);
int idiv = ( int ) ( sjMonth2 / nowscale ) ;
int idiv = ( int ) ( sjMonth2 / nowscale ) ;
int imod = ( int ) ( sjMonth2 % nowscale ) ;
int imod = ( int ) ( sjMonth2 % nowscale ) ;
D ecimal dprice = price ; //计费单价
d ecimal dprice = price ; //计费单价
for ( int j = 0 ; j < idiv ; j + + ) //循环求增值费率
for ( int j = 0 ; j < idiv ; j + + ) //循环求增值费率
{
{
//--- BEGIN --- 如果是月则计算开始和结束日期之间的天数
//--- BEGIN --- 如果是月则计算开始和结束日期之间的天数
@ -2116,7 +2302,7 @@ namespace DSWeb.MvcShipping.DAL.RptWmsSettlementListDAL
//int imod = (int)(sjMonth % nowscale);
//int imod = (int)(sjMonth % nowscale);
int idiv = ( int ) ( sjMonth2 / nowscale ) ;
int idiv = ( int ) ( sjMonth2 / nowscale ) ;
int imod = ( int ) ( sjMonth2 % nowscale ) ;
int imod = ( int ) ( sjMonth2 % nowscale ) ;
D ecimal dprice = price ; //计费单价
d ecimal dprice = price ; //计费单价
for ( int j = 0 ; j < idiv ; j + + ) //循环求增值费率
for ( int j = 0 ; j < idiv ; j + + ) //循环求增值费率
{
{
//--- BEGIN --- 如果是月则计算开始和结束日期之间的天数
//--- BEGIN --- 如果是月则计算开始和结束日期之间的天数
@ -2411,7 +2597,7 @@ namespace DSWeb.MvcShipping.DAL.RptWmsSettlementListDAL
/// <param name="sBillno">出库单号或其他单据号</param>
/// <param name="sBillno">出库单号或其他单据号</param>
/// <param name="ck_jsfee">是否计算仓储费</param>
/// <param name="ck_jsfee">是否计算仓储费</param>
/// <returns></returns>
/// <returns></returns>
public static void getWmsRate ( SqlTransaction sqlTran , string strSTARTBILLINGDATE , string strOLDCUSTFEEDATE , string strINBSNO , string strCUSTOMERNAME , D ecimal outnums , string strASSOCIATEDNO , int strFEETYPE , string strUserID , string strShowName , string sBillno , bool ck_jsfee , bool isKuCun )
public static void getWmsRate ( SqlTransaction sqlTran , string strSTARTBILLINGDATE , string strOLDCUSTFEEDATE , string strINBSNO , string strCUSTOMERNAME , d ecimal outnums , string strASSOCIATEDNO , int strFEETYPE , string strUserID , string strShowName , string sBillno , bool ck_jsfee , bool isKuCun )
{
{
int iState = 0 ;
int iState = 0 ;
int result = 0 ;
int result = 0 ;
@ -2456,8 +2642,8 @@ namespace DSWeb.MvcShipping.DAL.RptWmsSettlementListDAL
#region 基本信息
#region 基本信息
int iCount = dsrate . Tables [ 0 ] . Rows . Count ;
int iCount = dsrate . Tables [ 0 ] . Rows . Count ;
int nowscale = 0 ; //区间计费区间(仓储月数/天数)
int nowscale = 0 ; //区间计费区间(仓储月数/天数)
D ecimal price = 0 ; //计费单价
d ecimal price = 0 ; //计费单价
D ecimal gradefee = 0 ; //区间仓储费
d ecimal gradefee = 0 ; //区间仓储费
int nowgrade = 1 ;
int nowgrade = 1 ;
# endregion
# endregion
@ -2467,9 +2653,9 @@ namespace DSWeb.MvcShipping.DAL.RptWmsSettlementListDAL
WmsRateDetailEntity model = new WmsRateDetailEntity ( ) ;
WmsRateDetailEntity model = new WmsRateDetailEntity ( ) ;
//nowgrade = int.Parse(dsrate.Tables[0].Rows[i]["FEEGRADE"].ToString());//计费等级
//nowgrade = int.Parse(dsrate.Tables[0].Rows[i]["FEEGRADE"].ToString());//计费等级
nowscale = int . Parse ( dsrate . Tables [ 0 ] . Rows [ i ] [ "FEESCALE" ] . ToString ( ) ) ; //计费区间
nowscale = int . Parse ( dsrate . Tables [ 0 ] . Rows [ i ] [ "FEESCALE" ] . ToString ( ) ) ; //计费区间
price = D ecimal. Parse ( dsrate . Tables [ 0 ] . Rows [ i ] [ "FEEPRICE" ] . ToString ( ) ) ; //计费单价
price = d ecimal. Parse ( dsrate . Tables [ 0 ] . Rows [ i ] [ "FEEPRICE" ] . ToString ( ) ) ; //计费单价
Decimal ADDPRICE = D ecimal. Parse ( dsrate . Tables [ 0 ] . Rows [ i ] [ "ADDPRICE" ] . ToString ( ) ) ; //增值价
decimal ADDPRICE = d ecimal. Parse ( dsrate . Tables [ 0 ] . Rows [ i ] [ "ADDPRICE" ] . ToString ( ) ) ; //增值价
Decimal CAPPRICE = D ecimal. Parse ( dsrate . Tables [ 0 ] . Rows [ i ] [ "CAPPRICE" ] . ToString ( ) ) ; //封顶价
decimal CAPPRICE = d ecimal. Parse ( dsrate . Tables [ 0 ] . Rows [ i ] [ "CAPPRICE" ] . ToString ( ) ) ; //封顶价
string FEEUNIT = dsrate . Tables [ 0 ] . Rows [ i ] [ "FEEUNIT" ] . ToString ( ) ; //计费单位
string FEEUNIT = dsrate . Tables [ 0 ] . Rows [ i ] [ "FEEUNIT" ] . ToString ( ) ; //计费单位
string ENDBILLINGDATE = dsrate . Tables [ 0 ] . Rows [ i ] [ "ENDBILLINGDATE" ] . ToString ( ) ; //结束计费日期
string ENDBILLINGDATE = dsrate . Tables [ 0 ] . Rows [ i ] [ "ENDBILLINGDATE" ] . ToString ( ) ; //结束计费日期
//计算区间是按天或按月
//计算区间是按天或按月
@ -2488,7 +2674,7 @@ namespace DSWeb.MvcShipping.DAL.RptWmsSettlementListDAL
if ( ADDPRICE > 0 )
if ( ADDPRICE > 0 )
{
{
#region 有增值价
#region 有增值价
D ecimal dprice = price ; //计费单价
d ecimal dprice = price ; //计费单价
if ( isKuCun & & DateTime . Parse ( strSTARTBILLINGDATE2 ) > DateTime . Parse ( dsrate . Tables [ 0 ] . Rows [ i ] [ "ENDBILLINGDATE" ] . ToString ( ) ) )
if ( isKuCun & & DateTime . Parse ( strSTARTBILLINGDATE2 ) > DateTime . Parse ( dsrate . Tables [ 0 ] . Rows [ i ] [ "ENDBILLINGDATE" ] . ToString ( ) ) )
{
{
#region 有增值价时,如果开始计费日期大于当前区间的结束计费日期,则需计算开始计费的单价
#region 有增值价时,如果开始计费日期大于当前区间的结束计费日期,则需计算开始计费的单价