库存转储单:从IQC仓转储到W1A仓的批次必须填写到期日期
小于 1 分钟
代码示例
IF @object_type = '67'
BEGIN
IF @transaction_type = 'A'
OR @transaction_type = 'U'
BEGIN
IF EXISTS
(
SELECT T0.[Docentry] , T1.[ItemCode], T1.[Dscription]
, T1.[FromWhsCod] AS 从仓库
, T1.[WhsCode] AS 到仓库, TS.[BatchNum] AS 批次号, Ts.[ExpDate] AS 过期日期
FROM OWTR T0
INNER JOIN WTR1 T1 ON T0.[DocEntry] = T1.[DocEntry]
INNER JOIN OITM T2 ON T1.[ItemCode] = T2.[ItemCode]
INNER JOIN OITB T3 ON T2.[ItmsGrpCod] = T3.[ItmsGrpCod]
LEFT JOIN (
SELECT T2.[BinCode], T1.[Quantity], T1.[SnBMDAbs], T4.[BatchNum], T0.[LocCode]
, T0.[DocEntry], T0.[ItemCode], T0.[BaseType],T3.[ExpDate]
FROM OILM T0
INNER JOIN OBTL T1 ON T0.[MessageID] = T1.[MessageID]
INNER JOIN OBIN T2 ON T1.[BinAbs] = T2.[AbsEntry]
INNER JOIN OBTN T3 ON T3.ABSENTRY = T1.[SnBMDAbs]
INNER JOIN IBT1 T4
ON T4.[BatchNum] = T3.[DistNumber]
AND T4.itemcode = t0.itemcode
AND T4.[WhsCode] = T0.[LocCode]
AND T4.[BaseEntry]= T0.[DocEntry]
) TS
ON Ts.[DocEntry] = t0.docentry
AND Ts.[ItemCode] = t1.itemcode
AND Ts.[LocCode] = t1.whscode
AND TS.[BaseType] = t0.objtype
WHERE
T1.[FromWhsCod]='IQC' AND T1.[WhsCode]='W1A' AND Ts.[ExpDate] IS NULL
AND T0.DocEntry=@(list_of_cols_val_tab_del)
BEGIN
SET @error =5601
SET @error_message = '从IQC转储到WA1仓的批次必须填写到期日期';
END;
END;
END