Notifications
Clear all

Cách chặn nhập thành phẩm nếu chưa xuất toàn bộ nguyên liệu thành phần và nguồn lực của lệnh sản xuất

1 Posts
1 Users
0 Likes
107 Views
admin
Posts: 339
Admin
Topic starter
(@admin)
Prominent Member
Joined: 3 years ago

Một số khách hàng có sử dụng phân hệ sản xuất (production) thường có yêu cầu chặn giao dịch nhập kho thành phẩm (receipt from production) nếu như các nguyên liệu thành phần (materials) và nguồn lực sản xuất (resources) chưa được xuất dùng cho phần nguyên liệu hoặc xác nhận sử dụng cho nguồn lực máy móc/nhân công.

Sau đây là câu lệnh Store Procedure Transaction Notification áp dụng cho phiên bản MS SQL, dùng để chặn cho tình huống trên.

if @object_type = '59' and @transaction_type in ('A')
begin	
		if exists (select T1.ItemCode from OIGN T0 inner join IGN1 T1 on T0.DocEntry = T1.DocEntry and T1.BaseType='202'
					left join WOR1 T2 on T1.BaseRef = T2.DocEntry
					where isnull(T2.IssuedQty,0) = 0 and T0.DocEntry = @list_of_cols_val_tab_del)
			begin
				set @error = 5920201
				set @error_message =  'All components need to issue before receipt completion'
			end
end
Reply
Share:
x  Powerful Protection for WordPress, from Shield Security
This Site Is Protected By
Shield Security