|
|
@ -86,8 +86,7 @@ namespace ICSSoft.FromERP |
|
|
|
var lastMonth = "2024-01-01";// Dates.AddDays(-Dates.Day + 1).ToString("yyyy-MM-dd");//"2024-01-01";
|
|
|
|
// 月库存统计:每个月14号,查询上月截止到月末的库存数据累计数量和金额 因为期初数量本来就是统计历史收发数量,所以期初数量+收发数量 = 收发数量总和,金额同理
|
|
|
|
string sqls = @"
|
|
|
|
|
|
|
|
select * from (select cWhCode,a.cInvCode,convert(nvarchar(10),getdate(),112) IF_STD_DATE, |
|
|
|
select *,COUNT(*) OVER (PARTITION BY getdate()) GEN_ROW_CNT from (select cWhCode,a.cInvCode,convert(nvarchar(10),getdate(),112) IF_STD_DATE, |
|
|
|
convert(nvarchar(10),getdate(),112) STCK_STD_DATE, |
|
|
|
a.cWhCode WRHS_CD, |
|
|
|
a.cInvCode ITEM_CD,c.cInvName, |
|
|
@ -98,13 +97,12 @@ namespace ICSSoft.FromERP |
|
|
|
(case when cInvStd is null then null else (CASE WHEN ISNUMERIC(left(cinvstd,3)) = 1 THEN UPPER(REPLACE(SUBSTRING(cinvstd, 1, CHARINDEX('/', cinvstd) - 1),left(cinvstd,3),'')) ELSE (CASE WHEN ISNUMERIC(left(cinvstd,2)) = 1 |
|
|
|
THEN UPPER(REPLACE(SUBSTRING(cinvstd, 1, CHARINDEX('/', cinvstd) - 1),left(cinvstd,2),'')) ELSE (CASE WHEN ISNUMERIC(left(cinvstd,1)) = 1 |
|
|
|
THEN UPPER(REPLACE(SUBSTRING(cinvstd, 1, CHARINDEX('/', cinvstd) - 1),left(cinvstd,1),'')) ELSE '' END) END) END) end) STCK_UOM, |
|
|
|
cInvStd PACK_MIN_QTY, |
|
|
|
COUNT(*) OVER (PARTITION BY getdate()) GEN_ROW_CNT |
|
|
|
cInvStd PACK_MIN_QTY |
|
|
|
from IA_Subsidiary a |
|
|
|
left join dbo.Inventory c on a.cInvCode=c.cInvCode |
|
|
|
where a.dKeepDate < N'{0}' and a.cVouType<> N'33' and ISNULL(a.iMonth,0)<>0 and ISNULL(a.cBatchia,'') != '' |
|
|
|
group by a.cInvCode,a.cWhCode,a.cBatchia,c.cInvName,c.cinvstd) a |
|
|
|
where STCK_QTY > 0";
|
|
|
|
where STCK_QTY > 0 and STCK_VALUE_CNY > 0";
|
|
|
|
|
|
|
|
sqls = string.Format(sqls, lastMonth); |
|
|
|
log.Info("YERP_010 sql:" + sqls); |
|
|
|