@ -155,8 +155,14 @@ namespace DSWeb.MvcShipping.DAL.RptWmsSettlementListDAL
+ ", isnull((select sum(GOODSPACKPFSL) as GOODSPACKPFSL from wms_out_detail where INBSNO=wms.GID " + strCondition4 + "),0) as GOODSPACKPFSL"
+ ", isnull((select sum(GOODSPACKPFSL) as GOODSPACKPFSL from wms_out_detail where INBSNO=wms.GID " + strCondition2 + "),0) as GOODSPACKPFSL_MONTH"
+ ", GOODSPACKACTUAL, GOODSRKSLACTUAL, CORPID "
+ " FROM wms WHERE CHARGEUNIT <> 'CBM' AND ISDELETE = 0 " + strCondition
+ " FROM wms WHERE ISDELETE = 0 "
//20230214 增加 防止明细出库的仓储信息出现在这里
+ " and not exists(select 1 from wms_out_detail where INBSNO in(select gid from wms_in where ASSOCIATEDNO=wms.GID)) "
+ strCondition //CHARGEUNIT <> 'CBM' AND
+ ") as A where 1=1 " + strCondition3
+ " GROUP BY GID, WMSNO, CUSTOMERNAME, STORAGENAME, AREANAME, BLNO, GOODSNAME, GOODSMODEL, ASSOCIATEDNO, CONTRACTNO, CHARGEUNIT, CUSTOMNO, GOODSGRADE, GOODSSLICE, GOODSSTANDARD, GOODSRKSL, GOODSPACK, GOODSPACKACTUAL, GOODSRKSLACTUAL, WMSDATE, STARTBILLINGDATE"
+ " UNION ALL "
+ "select GID, WMSNO, WMSDATE, STARTBILLINGDATE, CUSTOMERNAME, BLNO, STORAGENAME, AREANAME, GOODSNAME, GOODSMODEL, ASSOCIATEDNO, CONTRACTNO, CHARGEUNIT, CUSTOMNO, GOODSGRADE, ISNULL(GOODSSLICE, 0) AS GOODSSLICE, GOODSSTANDARD, '' AS REMARK"
@ -181,7 +187,10 @@ namespace DSWeb.MvcShipping.DAL.RptWmsSettlementListDAL
+ ", isnull((select sum(GOODSPACKPFSL) as GOODSPACKPFSL from wms_out_detail where INBSNO=i.GID " + strCondition4 + "),0) as GOODSPACKPFSL"
+ ", isnull((select sum(GOODSPACKPFSL) as GOODSPACKPFSL from wms_out_detail where INBSNO=i.GID " + strCondition2 + "),0) as GOODSPACKPFSL_MONTH"
+ ", i.GOODSPACKACTUAL, i.GOODSRKSLACTUAL, w.CORPID "
+ " FROM wms_in AS i LEFT OUTER JOIN wms AS w ON i.ASSOCIATEDNO = w.GID WHERE i.CHARGEUNIT = 'CBM' AND i.ISDELETE = 0 " + strCondition
+ " FROM wms_in AS i LEFT OUTER JOIN wms AS w ON i.ASSOCIATEDNO = w.GID WHERE i.ISDELETE = 0 " + strCondition // i.CHARGEUNIT = 'CBM'AND
+ " and exists(select 1 from wms_out_detail where INBSNO =i.GID) "
+ ") as A where 1=1 " + strCondition3
+ " GROUP BY GID, WMSNO, CUSTOMERNAME, STORAGENAME, AREANAME, BLNO, GOODSNAME, GOODSMODEL, ASSOCIATEDNO, CONTRACTNO, CHARGEUNIT, CUSTOMNO, GOODSGRADE, GOODSSLICE, GOODSSTANDARD, GOODSRKSL, GOODSPACK, GOODSPACKACTUAL, GOODSRKSLACTUAL, WMSDATE, STARTBILLINGDATE) as a" ;
iState = SqlHelper . ExecuteNonQuery ( sqlTran , CommandType . Text , strSql , null ) ;
@ -192,8 +201,38 @@ namespace DSWeb.MvcShipping.DAL.RptWmsSettlementListDAL
}
# endregion
//20230214 增加对旧仓储业务明细出库的支持
//首先看这票货的GID, 查找wms_in.ASSOCIATEDNO=wms.gid 看入库明细
//然后看这些入库明细wms_in.GID 看是否有出库明细的inbsno=这些入库明细的wms_in.gid
//如果有 则具有【明细出库】
//如具有【明细出库】 则依据每次明细出库的数量 增加一条TableName_ls的记录, 同时减少这票货的总数
//var wmsgidList = new List<string>();
//strSql = "select distinct GID from [" + TableName_ls + "] where CREATEUSER='" + strUserID + "' and CORPID='" + strCompanyID + "'";
//DataSet dsKCMX = SqlHelper.ExecuteQueryDataset(sqlTran, CommandType.Text, strSql, null);
//if (dsKCMX != null)
//{
// foreach (DataRow dr in dsKCMX.Tables[0].Rows)
// {
// wmsgidList.Add( dr["GID"].ToString());
// }
//}
//var cdc = new CommonDataContext();
//foreach (var wmsgid in wmsgidList) {
// var wmsinList = cdc.wms_in.Where(x => x.ASSOCIATEDNO == wmsgid);
// var wmsinGidList = wmsinList.Select(s => s.GID).ToList();
// var wmsoutDetailList = cdc.wms_out_detail.Where(x => wmsinGidList.Contains(x.INBSNO)).ToList();
// if (wmsoutDetailList != null && wmsoutDetailList.Count > 0) {
// //如具有【明细出库】 则依据每次明细出库的数量 增加一条TableName_ls的记录, 同时减少这票货的总数
// wmsoutDetailList = wmsoutDetailList.OrderBy(o => o.DODATE).ThenBy(o => o.BSNO).ToList();
// foreach (var wmsoutdetail in wmsoutDetailList) {
// }
// }
//}
#region 5.从【库存】中提取数据,生成【仓储明细表[wms_settlement_detail_rate_detail_temp]】
strSql = "select * from [" + TableName_ls + "] where CREATEUSER='" + strUserID + "' and CORPID='" + strCompanyID + "'" ;
DataSet dsKC = SqlHelper . ExecuteQueryDataset ( sqlTran , CommandType . Text , strSql , null ) ;
if ( dsKC ! = null )