Files
old_jintiantongye_wms/db/数据库更新20171028(入库库位分配语句).sql
2025-09-12 17:30:18 +08:00

18 lines
1.6 KiB
Transact-SQL
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

USE ASRS_WXZD_JYMH_CPK
go
-- 增加sbid!=?条件相应CkczManager类也需要更新
update sys_SQL_statements set SQL_string=
'SELECT TOP 1 kwbh,zsl,nckw,kws,wckw,r.hdh FROM kwjbxx r
LEFT JOIN (SELECT hdh,availablePairs,kws FROM TF_待入库产品各巷道库位分配数(?)) b ON r.hdh=b.hdh
JOIN (SELECT hdh hdid,COUNT(*) 空库位数 FROM kwjbxx
WHERE zsl=0 AND 托盘个数=0 AND sfsd=0 AND xnkw=0 AND sfyx=1 GROUP BY hdh) c ON r.hdh=c.hdid
LEFT JOIN (SELECT hdh hdid,COUNT(*) 有货库位数 FROM wxzd_sbztxx
WHERE hdh IS NOT NULL AND flagYouHuo=1 AND sbid!=?
GROUP BY hdh) d ON r.hdh=d.hdid
WHERE zsl=0 AND 托盘个数=0 AND sfsd=0 AND xnkw=0 AND sfyx=1
AND NOT EXISTS(SELECT 2 FROM v_未完成指令 w WHERE w.kwbh=r.kwbh)
AND 空库位数>ISNULL(有货库位数,0)
AND ckmc=? AND pai BETWEEN ? AND ?'
where ID='可入库位搜索语句';
go